[SCM] linbox: library for exact linear algebra branch, master, updated. debian/1.1.6_rc0-4.1-8-g9d2c312

Lifeng Sun lifongsun at gmail.com
Tue Aug 9 10:21:09 UTC 2011


The following commit has been merged in the master branch:
commit 4e111576b1006720b12733e8f506e46fefb33e32
Author: Lifeng Sun <lifongsun at gmail.com>
Date:   Tue Aug 9 15:19:47 2011 +0800

    Imported Upstream version 1.2.0

diff --git a/AUTHORS b/AUTHORS
index b6978ba..37611be 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -4,7 +4,7 @@ Jean-Guillaume Dumas <Jean-Guillaume.Dumas at imag.fr>
 Mark Giesbrecht <mwg at csd.uwo.ca>
 Pascal Giorgi <Pascal.Giorgi at ens-lyon.fr>
 Bradford Hovinen <hovinen at cis.udel.edu>
-Erich Kaltofen <kaltofen at unity.ncsu.edu>
+Erich Kaltofen <kaltofen at math.ncsu.edu>
 Clement Pernet <Clement.Pernet at imag.fr>
 Daniel Roche <roche at cis.udel.edu>
 B. David Saunders <saunders at cis.udel.edu>
diff --git a/ChangeLog b/ChangeLog
index 6fefa16..4da39ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,40 @@
+2011-05-11 bboyer
+        linbox-1.2.0 released:
+	* Many many bug fixes, many memleaks, much code beautify.
+	* Licence/copyright added to (hopefully) every file.
+	* Vi/emacs magic lines for auto-indentation.
+	* Some documentation added + improved Doxygen framework (dev/user
+	documentation, more *.doxy items, bug/todo list, bibliography list)
+	* Upgrade to givaro 3.4.0 series ( new namespace, new API for integer
+	operations, a few new functions (naturallog...) )
+	* Upgrade to fflas-ffpack 1.4.0 (new namespace, new includes)
+	* Some initial work introduced here and there (matrix permutation
+	representations, symbolic/numeric solver, sparse matrix
+	representation...)
+	* CRA algorithms reworked and tested, some added.
+	* Timer moved to Givaro
+	* Some debug/util moved to FflasFfpack
+	* Better configure.ac/Makefiles (more options, icc/gcc
+	customisation,...)
+	* More m4 rules
+	* Possibility to use IML functions as a shared library (and some
+	examples given)
+	* 'make fullcheck' checks all possible tests given and reports
+	* Auto-installer from sources/svn with plenty of options
+	* Some new field functions like characteristic()
+	* Work on synchronising field member functions signatures for
+	better compatibility between all fields (in progress)
+2010-11-03 cpernet
+	linbox-1.1.7 released:
+	* bug fixes and minor enhancements
+	* New interface to sage (supporting native floating point
+	representation)
+	* new rebind interface
+	* incorporate the code for computations over the rationals (by A
+	Ubranska), still waiting to be cleaned-up (it is not used yet by default)
+2008-09-22 cpernet
+	linbox-1.1.6 released:
+	* compilation pb, and bug fixes, for cygwin support and debianization
 2008-06-10 cpernet
 	* Upgrade fflas-ffpack to v1.3.3 (safer and tighter bounds, bug
 	fixes,...)
@@ -42,7 +79,7 @@
 	* and accumulate-special in field/modular.h to better support sums of field elements efficiently.
 2006-06-01 bds 
 	* rank.h adjusted to work around faulty PIVOT_LINEAR code in sparse elim.
-	* test-rank.C now tests blackbox, elimination, hybrid methods as well as...:wq
+	* test-rank.C now tests blackbox, elimination, hybrid methods as well as...
 2006-04-18 bds and Hui Wang
 	* examples/smith.C minor changes
 	* linbox/blackbox/apply.h - don't recall what we did to wreck this.
diff --git a/INSTALL b/INSTALL
index d3c5b40..7d1c323 100644
--- a/INSTALL
+++ b/INSTALL
@@ -2,18 +2,24 @@ Installation Instructions
 *************************
 
 Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
-2006, 2007 Free Software Foundation, Inc.
+2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
-This file is free documentation; the Free Software Foundation gives
-unlimited permission to copy, distribute and modify it.
+   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
+   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.
+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
@@ -42,7 +48,7 @@ may remove or edit it.
 you want to change it or regenerate `configure' using a newer version
 of `autoconf'.
 
-The simplest way to compile this package is:
+   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.
@@ -53,12 +59,22 @@ The simplest way to compile this package is:
   2. Type `make' to compile the package.
 
   3. Optionally, type `make check' to run any self-tests that come with
-     the package.
+     the package, generally using the just-built uninstalled binaries.
 
   4. Type `make install' to install the programs and any data files and
-     documentation.
-
-  5. You can remove the program binaries and object files from the
+     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
@@ -67,15 +83,22 @@ The simplest way to compile this package is:
      all sorts of other programs in order to regenerate files that came
      with the distribution.
 
-  6. Often, you can also type `make uninstall' to remove the installed
-     files again.
+  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.
+   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
@@ -88,25 +111,41 @@ is an example:
 Compiling For Multiple Architectures
 ====================================
 
-You can compile the package for more than one kind of computer at the
+   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 `..'.
+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
+   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'.
+`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
@@ -117,16 +156,47 @@ 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.
+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'.
 
-Optional Features
-=================
-
-Some packages pay attention to `--enable-FEATURE' options to
+   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
@@ -138,14 +208,53 @@ 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
+   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:
 
@@ -153,7 +262,8 @@ type, such as `sun4', or a canonical name which has the form:
 
 where SYSTEM can have one of these forms:
 
-     OS KERNEL-OS
+     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
@@ -171,9 +281,9 @@ 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'.
+   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.
@@ -182,7 +292,7 @@ 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
+   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
@@ -201,11 +311,19 @@ an Autoconf bug.  Until the bug is fixed you can use this workaround:
 `configure' Invocation
 ======================
 
-`configure' recognizes the following options to control how it operates.
+   `configure' recognizes the following options to control how it
+operates.
 
 `--help'
 `-h'
-     Print a summary of the options to `configure', and exit.
+     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'
@@ -232,6 +350,16 @@ an Autoconf bug.  Until the bug is fixed you can use this workaround:
      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.
 
diff --git a/Makefile.am b/Makefile.am
index 00e95f2..82f0639 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,15 +1,43 @@
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+
+ACLOCAL_AMFLAGS = -I macros
+
 SUBDIRS=linbox macros tests interfaces doc examples
 
+# I intend to pare down the target "check" so as to be a smaller check used
+# at installation time with a focus on confirming that dependencies on
+# other packages and compilation environment are in order.  In contrast, the
+# target "fullcheck" should become as exhaustive as possible to serve
+# developers for regression testing. -bds 2011Feb ...also benchmarks will be.
+
+#  Fullcheck provides a full check for regression testing purposes.
+fullcheck:
+	(make ; cd tests; make fullcheck)
+
 docs:doc/linbox-html/index.html
 
 doc/linbox-html/index.html:
 	(cd doc; make docs)
 
-examples:examples/dot-product
+docs_dev:doc/linbox-dev-html/index.html
+
+doc/linbox-dev-html/index.html:
+	(cd doc; make docs_dev)
 
-#examples/dot-product:linbox/linbox-config.h
-#	(cd examples; make examples)
+examples:
+	(cd examples; make examples)
+
+
+.PHONY:examples
 
 bin_SCRIPTS=linbox-config
 
-VERSION=1.1.6rc0
+bundled:
+	sh auto-install.sh
+
+VERSION=1.2.0
+
+EXTRA_DIST=auto-install.sh
+#incremente-versions
diff --git a/Makefile.in b/Makefile.in
index 625fca2..d665426 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -14,6 +15,10 @@
 
 @SET_MAKE@
 
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -36,23 +41,31 @@ subdir = .
 DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in $(srcdir)/config.h.in \
 	$(srcdir)/linbox-config.in $(top_srcdir)/configure AUTHORS \
-	COPYING ChangeLog INSTALL NEWS TODO config.guess config.sub \
-	install-sh ltmain.sh missing
+	COPYING ChangeLog INSTALL NEWS TODO build-aux/config.guess \
+	build-aux/config.sub build-aux/install-sh build-aux/ltmain.sh \
+	build-aux/missing
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
-	$(top_srcdir)/macros/blas-check.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
 	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
 	$(top_srcdir)/macros/givaro-check.m4 \
 	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
 	$(top_srcdir)/macros/lidia-check.m4 \
 	$(top_srcdir)/macros/linbox-doc.m4 \
 	$(top_srcdir)/macros/linbox-misc.m4 \
 	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
 	$(top_srcdir)/macros/maple-check.m4 \
 	$(top_srcdir)/macros/ntl-check.m4 \
 	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
@@ -98,18 +111,21 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
 CC = @CC@
+CCNAM = @CCNAM@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
 DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -117,19 +133,24 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
 GIVARO_CFLAGS = @GIVARO_CFLAGS@
 GIVARO_LIBS = @GIVARO_LIBS@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
 GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
@@ -137,41 +158,52 @@ LIBTOOL = @LIBTOOL@
 LIDIA_CFLAGS = @LIDIA_CFLAGS@
 LIDIA_LIBS = @LIDIA_LIBS@
 LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MAPLE_CFLAGS = @MAPLE_CFLAGS@
 MAPLE_HOME = @MAPLE_HOME@
 MAPLE_LIBS = @MAPLE_LIBS@
 MAPLE_VERSION = @MAPLE_VERSION@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
 NTL_CFLAGS = @NTL_CFLAGS@
 NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RM = @RM@
 SACLIB_CFLAGS = @SACLIB_CFLAGS@
 SACLIB_LIBS = @SACLIB_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
-VERSION = 1.1.6rc0
+TESTS_CFLAGS = @TESTS_CFLAGS@
+VERSION = 1.2.0
+WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -212,13 +244,13 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+ACLOCAL_AMFLAGS = -I macros
 SUBDIRS = linbox macros tests interfaces doc examples
-
-#examples/dot-product:linbox/linbox-config.h
-#	(cd examples; make examples)
 bin_SCRIPTS = linbox-config
+EXTRA_DIST = auto-install.sh
 all: config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-recursive
 
@@ -302,7 +334,7 @@ clean-libtool:
 	-rm -rf .libs _libs
 
 distclean-libtool:
-	-rm -f libtool
+	-rm -f libtool config.lt
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
@@ -311,7 +343,7 @@ distclean-libtool:
 #     (which will cause the Makefiles to be regenerated when you run `make');
 # (2) otherwise, pass the desired values on the `make' command line.
 $(RECURSIVE_TARGETS):
-	@failcom='exit 1'; \
+	@fail= failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
 	    *=* | --[!k]*);; \
@@ -336,7 +368,7 @@ $(RECURSIVE_TARGETS):
 	fi; test -z "$$fail"
 
 $(RECURSIVE_CLEAN_TARGETS):
-	@failcom='exit 1'; \
+	@fail= failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
 	    *=* | --[!k]*);; \
@@ -379,7 +411,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
@@ -479,7 +511,8 @@ distdir: $(DISTFILES)
 	      || exit 1; \
 	  fi; \
 	done
-	-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+	-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 {} {} \; \
@@ -630,6 +663,8 @@ dvi-am:
 
 html: html-recursive
 
+html-am:
+
 info: info-recursive
 
 info-am:
@@ -638,18 +673,28 @@ install-data-am:
 
 install-dvi: install-dvi-recursive
 
+install-dvi-am:
+
 install-exec-am: install-binSCRIPTS
 
 install-html: install-html-recursive
 
+install-html-am:
+
 install-info: install-info-recursive
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-recursive
 
+install-pdf-am:
+
 install-ps: install-ps-recursive
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-recursive
@@ -693,12 +738,34 @@ uninstall-am: uninstall-binSCRIPTS
 	uninstall-binSCRIPTS
 
 
+# I intend to pare down the target "check" so as to be a smaller check used
+# at installation time with a focus on confirming that dependencies on
+# other packages and compilation environment are in order.  In contrast, the
+# target "fullcheck" should become as exhaustive as possible to serve
+# developers for regression testing. -bds 2011Feb ...also benchmarks will be.
+
+#  Fullcheck provides a full check for regression testing purposes.
+fullcheck:
+	(make ; cd tests; make fullcheck)
+
 docs:doc/linbox-html/index.html
 
 doc/linbox-html/index.html:
 	(cd doc; make docs)
 
-examples:examples/dot-product
+docs_dev:doc/linbox-dev-html/index.html
+
+doc/linbox-dev-html/index.html:
+	(cd doc; make docs_dev)
+
+examples:
+	(cd examples; make examples)
+
+.PHONY:examples
+
+bundled:
+	sh auto-install.sh
+#incremente-versions
 # 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/README b/README
index 00d7a4a..f45d39b 100644
--- a/README
+++ b/README
@@ -25,8 +25,8 @@ compiler supporting advanced template features.
 The linbox website is http://linalg.org
 
 Corrections, suggestions and comments to : 
-Jean-Guillaume.Dumas at imag.fr
+linbox-use at googlegroups.com
  
-Last update : 2005 July
+Last update : 2009 September
  
 
diff --git a/TODO b/TODO
index 4c769df..ce7456b 100644
--- a/TODO
+++ b/TODO
@@ -21,3 +21,6 @@ Before meeting:
  - Add solver, determinant to Jean-Guillaume's code?
  - Add more pivoting strategies?
  - New Compose implementation?
+
+----
+ - NoCblasErrorChecks on release version ?
diff --git a/aclocal.m4 b/aclocal.m4
index 438fb26..b9ee875 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.10.1 -*- Autoconf -*-
+# generated automatically by aclocal 1.10.3 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2005, 2006, 2007, 2008, 2009  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,6665 +13,13 @@
 
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(AC_AUTOCONF_VERSION, [2.61],,
-[m4_warning([this file was generated for autoconf 2.61.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
+[m4_warning([this file was generated for autoconf 2.68.
 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'.])])
 
-# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
-
-# serial 52 Debian 1.5.26-4 AC_PROG_LIBTOOL
-
-
-# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
-# -----------------------------------------------------------
-# If this macro is not defined by Autoconf, define it here.
-m4_ifdef([AC_PROVIDE_IFELSE],
-         [],
-         [m4_define([AC_PROVIDE_IFELSE],
-	         [m4_ifdef([AC_PROVIDE_$1],
-		           [$2], [$3])])])
-
-
-# AC_PROG_LIBTOOL
-# ---------------
-AC_DEFUN([AC_PROG_LIBTOOL],
-[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
-dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
-dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
-  AC_PROVIDE_IFELSE([AC_PROG_CXX],
-    [AC_LIBTOOL_CXX],
-    [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
-  ])])
-dnl And a similar setup for Fortran 77 support
-  AC_PROVIDE_IFELSE([AC_PROG_F77],
-    [AC_LIBTOOL_F77],
-    [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77
-])])
-
-dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
-dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
-dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
-  AC_PROVIDE_IFELSE([AC_PROG_GCJ],
-    [AC_LIBTOOL_GCJ],
-    [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
-      [AC_LIBTOOL_GCJ],
-      [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
-	[AC_LIBTOOL_GCJ],
-      [ifdef([AC_PROG_GCJ],
-	     [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])
-       ifdef([A][M_PROG_GCJ],
-	     [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])])
-       ifdef([LT_AC_PROG_GCJ],
-	     [define([LT_AC_PROG_GCJ],
-		defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])])
-])])# AC_PROG_LIBTOOL
-
-
-# _AC_PROG_LIBTOOL
-# ----------------
-AC_DEFUN([_AC_PROG_LIBTOOL],
-[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
-AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
-AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl
-AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
-
-# This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
-
-# Always use our own libtool.
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
-AC_SUBST(LIBTOOL)dnl
-
-# Prevent multiple expansion
-define([AC_PROG_LIBTOOL], [])
-])# _AC_PROG_LIBTOOL
-
-
-# AC_LIBTOOL_SETUP
-# ----------------
-AC_DEFUN([AC_LIBTOOL_SETUP],
-[AC_PREREQ(2.50)dnl
-AC_REQUIRE([AC_ENABLE_SHARED])dnl
-AC_REQUIRE([AC_ENABLE_STATIC])dnl
-AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_PROG_LD])dnl
-AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
-AC_REQUIRE([AC_PROG_NM])dnl
-
-AC_REQUIRE([AC_PROG_LN_S])dnl
-AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
-# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
-AC_REQUIRE([AC_OBJEXT])dnl
-AC_REQUIRE([AC_EXEEXT])dnl
-dnl
-AC_LIBTOOL_SYS_MAX_CMD_LEN
-AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
-AC_LIBTOOL_OBJDIR
-
-AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
-_LT_AC_PROG_ECHO_BACKSLASH
-
-case $host_os in
-aix3*)
-  # AIX sometimes has problems with the GCC collect2 program.  For some
-  # reason, if we set the COLLECT_NAMES environment variable, the problems
-  # vanish in a puff of smoke.
-  if test "X${COLLECT_NAMES+set}" != Xset; then
-    COLLECT_NAMES=
-    export COLLECT_NAMES
-  fi
-  ;;
-esac
-
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed='sed -e 1s/^X//'
-[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g']
-
-# Same as above, but do not quote variable references.
-[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g']
-
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
-
-# Constants:
-rm="rm -f"
-
-# Global variables:
-default_ofile=libtool
-can_build_shared=yes
-
-# All known linkers require a `.a' archive for static linking (except MSVC,
-# which needs '.lib').
-libext=a
-ltmain="$ac_aux_dir/ltmain.sh"
-ofile="$default_ofile"
-with_gnu_ld="$lt_cv_prog_gnu_ld"
-
-AC_CHECK_TOOL(AR, ar, false)
-AC_CHECK_TOOL(RANLIB, ranlib, :)
-AC_CHECK_TOOL(STRIP, strip, :)
-
-old_CC="$CC"
-old_CFLAGS="$CFLAGS"
-
-# Set sane defaults for various variables
-test -z "$AR" && AR=ar
-test -z "$AR_FLAGS" && AR_FLAGS=cru
-test -z "$AS" && AS=as
-test -z "$CC" && CC=cc
-test -z "$LTCC" && LTCC=$CC
-test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-test -z "$LD" && LD=ld
-test -z "$LN_S" && LN_S="ln -s"
-test -z "$MAGIC_CMD" && MAGIC_CMD=file
-test -z "$NM" && NM=nm
-test -z "$SED" && SED=sed
-test -z "$OBJDUMP" && OBJDUMP=objdump
-test -z "$RANLIB" && RANLIB=:
-test -z "$STRIP" && STRIP=:
-test -z "$ac_objext" && ac_objext=o
-
-# Determine commands to create old-style static archives.
-old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
-old_postinstall_cmds='chmod 644 $oldlib'
-old_postuninstall_cmds=
-
-if test -n "$RANLIB"; then
-  case $host_os in
-  openbsd*)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
-    ;;
-  *)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
-    ;;
-  esac
-  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
-fi
-
-_LT_CC_BASENAME([$compiler])
-
-# Only perform the check for file, if the check method requires it
-case $deplibs_check_method in
-file_magic*)
-  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
-    AC_PATH_MAGIC
-  fi
-  ;;
-esac
-
-_LT_REQUIRED_DARWIN_CHECKS
-
-AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
-AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
-enable_win32_dll=yes, enable_win32_dll=no)
-
-AC_ARG_ENABLE([libtool-lock],
-    [AC_HELP_STRING([--disable-libtool-lock],
-	[avoid locking (might break parallel builds)])])
-test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
-
-AC_ARG_WITH([pic],
-    [AC_HELP_STRING([--with-pic],
-	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
-    [pic_mode="$withval"],
-    [pic_mode=default])
-test -z "$pic_mode" && pic_mode=default
-
-# Use C for the default configuration in the libtool script
-tagname=
-AC_LIBTOOL_LANG_C_CONFIG
-_LT_AC_TAGCONFIG
-])# AC_LIBTOOL_SETUP
-
-
-# _LT_AC_SYS_COMPILER
-# -------------------
-AC_DEFUN([_LT_AC_SYS_COMPILER],
-[AC_REQUIRE([AC_PROG_CC])dnl
-
-# If no C compiler was specified, use CC.
-LTCC=${LTCC-"$CC"}
-
-# If no C compiler flags were specified, use CFLAGS.
-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
-
-# Allow CC to be a program name with arguments.
-compiler=$CC
-])# _LT_AC_SYS_COMPILER
-
-
-# _LT_CC_BASENAME(CC)
-# -------------------
-# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
-AC_DEFUN([_LT_CC_BASENAME],
-[for cc_temp in $1""; do
-  case $cc_temp in
-    compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
-    distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
-    \-*) ;;
-    *) break;;
-  esac
-done
-cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
-])
-
-
-# _LT_COMPILER_BOILERPLATE
-# ------------------------
-# Check for compiler boilerplate output or warnings with
-# the simple compiler test code.
-AC_DEFUN([_LT_COMPILER_BOILERPLATE],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_compile_test_code" >conftest.$ac_ext
-eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_compiler_boilerplate=`cat conftest.err`
-$rm conftest*
-])# _LT_COMPILER_BOILERPLATE
-
-
-# _LT_LINKER_BOILERPLATE
-# ----------------------
-# Check for linker boilerplate output or warnings with
-# the simple link test code.
-AC_DEFUN([_LT_LINKER_BOILERPLATE],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_link_test_code" >conftest.$ac_ext
-eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_linker_boilerplate=`cat conftest.err`
-$rm -r conftest*
-])# _LT_LINKER_BOILERPLATE
-
-# _LT_REQUIRED_DARWIN_CHECKS
-# --------------------------
-# Check for some things on darwin
-AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS],[
-  case $host_os in
-    rhapsody* | darwin*)
-    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
-    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
-
-    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
-      [lt_cv_apple_cc_single_mod=no
-      if test -z "${LT_MULTI_MODULE}"; then
-   # By default we will add the -single_module flag. You can override
-   # by either setting the environment variable LT_MULTI_MODULE
-   # non-empty at configure time, or by adding -multi_module to the
-   # link flags.
-   echo "int foo(void){return 1;}" > conftest.c
-   $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
-     -dynamiclib ${wl}-single_module conftest.c
-   if test -f libconftest.dylib; then
-     lt_cv_apple_cc_single_mod=yes
-     rm -rf libconftest.dylib*
-   fi
-   rm conftest.c
-      fi])
-    AC_CACHE_CHECK([for -exported_symbols_list linker flag],
-      [lt_cv_ld_exported_symbols_list],
-      [lt_cv_ld_exported_symbols_list=no
-      save_LDFLAGS=$LDFLAGS
-      echo "_main" > conftest.sym
-      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
-      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
-   [lt_cv_ld_exported_symbols_list=yes],
-   [lt_cv_ld_exported_symbols_list=no])
-   LDFLAGS="$save_LDFLAGS"
-    ])
-    case $host_os in
-    rhapsody* | darwin1.[[0123]])
-      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
-    darwin1.*)
-     _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-    darwin*)
-      # if running on 10.5 or later, the deployment target defaults
-      # to the OS version, if on x86, and 10.4, the deployment
-      # target defaults to 10.4. Don't you love it?
-      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
-   10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
-     _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
-   10.[[012]]*)
-     _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-   10.*)
-     _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
-      esac
-    ;;
-  esac
-    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
-      _lt_dar_single_mod='$single_module'
-    fi
-    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
-      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
-    else
-      _lt_dar_export_syms="~$NMEDIT -s \$output_objdir/\${libname}-symbols.expsym \${lib}"
-    fi
-    if test "$DSYMUTIL" != ":"; then
-      _lt_dsymutil="~$DSYMUTIL \$lib || :"
-    else
-      _lt_dsymutil=
-    fi
-    ;;
-  esac
-])
-
-# _LT_AC_SYS_LIBPATH_AIX
-# ----------------------
-# Links a minimal program and checks the executable
-# for the system default hardcoded library path. In most cases,
-# this is /usr/lib:/lib, but when the MPI compilers are used
-# the location of the communication and MPI libs are included too.
-# If we don't find anything, use the default library path according
-# to the aix ld manual.
-AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_LINK_IFELSE(AC_LANG_PROGRAM,[
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi],[])
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
-])# _LT_AC_SYS_LIBPATH_AIX
-
-
-# _LT_AC_SHELL_INIT(ARG)
-# ----------------------
-AC_DEFUN([_LT_AC_SHELL_INIT],
-[ifdef([AC_DIVERSION_NOTICE],
-	     [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
-	 [AC_DIVERT_PUSH(NOTICE)])
-$1
-AC_DIVERT_POP
-])# _LT_AC_SHELL_INIT
-
-
-# _LT_AC_PROG_ECHO_BACKSLASH
-# --------------------------
-# Add some code to the start of the generated configure script which
-# will find an echo command which doesn't interpret backslashes.
-AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
-[_LT_AC_SHELL_INIT([
-# Check that we are running under the correct shell.
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-case X$ECHO in
-X*--fallback-echo)
-  # Remove one level of quotation (which was required for Make).
-  ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
-  ;;
-esac
-
-echo=${ECHO-echo}
-if test "X[$]1" = X--no-reexec; then
-  # Discard the --no-reexec flag, and continue.
-  shift
-elif test "X[$]1" = X--fallback-echo; then
-  # Avoid inline document here, it may be left over
-  :
-elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
-  # Yippee, $echo works!
-  :
-else
-  # Restart under the correct shell.
-  exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
-fi
-
-if test "X[$]1" = X--fallback-echo; then
-  # used as fallback echo
-  shift
-  cat <<EOF
-[$]*
-EOF
-  exit 0
-fi
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-if test -z "$ECHO"; then
-if test "X${echo_test_string+set}" != Xset; then
-# find a string as large as possible, as long as the shell can cope with it
-  for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
-    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
-    if (echo_test_string=`eval $cmd`) 2>/dev/null &&
-       echo_test_string=`eval $cmd` &&
-       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
-    then
-      break
-    fi
-  done
-fi
-
-if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
-   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
-   test "X$echo_testing_string" = "X$echo_test_string"; then
-  :
-else
-  # The Solaris, AIX, and Digital Unix default echo programs unquote
-  # backslashes.  This makes it impossible to quote backslashes using
-  #   echo "$something" | sed 's/\\/\\\\/g'
-  #
-  # So, first we look for a working echo in the user's PATH.
-
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-  for dir in $PATH /usr/ucb; do
-    IFS="$lt_save_ifs"
-    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
-       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
-       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
-       test "X$echo_testing_string" = "X$echo_test_string"; then
-      echo="$dir/echo"
-      break
-    fi
-  done
-  IFS="$lt_save_ifs"
-
-  if test "X$echo" = Xecho; then
-    # We didn't find a better echo, so look for alternatives.
-    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
-       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
-       test "X$echo_testing_string" = "X$echo_test_string"; then
-      # This shell has a builtin print -r that does the trick.
-      echo='print -r'
-    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
-	 test "X$CONFIG_SHELL" != X/bin/ksh; then
-      # If we have ksh, try running configure again with it.
-      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-      export ORIGINAL_CONFIG_SHELL
-      CONFIG_SHELL=/bin/ksh
-      export CONFIG_SHELL
-      exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
-    else
-      # Try using printf.
-      echo='printf %s\n'
-      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
-	 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
-	 test "X$echo_testing_string" = "X$echo_test_string"; then
-	# Cool, printf works
-	:
-      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
-	   test "X$echo_testing_string" = 'X\t' &&
-	   echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	   test "X$echo_testing_string" = "X$echo_test_string"; then
-	CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
-	export CONFIG_SHELL
-	SHELL="$CONFIG_SHELL"
-	export SHELL
-	echo="$CONFIG_SHELL [$]0 --fallback-echo"
-      elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
-	   test "X$echo_testing_string" = 'X\t' &&
-	   echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	   test "X$echo_testing_string" = "X$echo_test_string"; then
-	echo="$CONFIG_SHELL [$]0 --fallback-echo"
-      else
-	# maybe with a smaller string...
-	prev=:
-
-	for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
-	  if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
-	  then
-	    break
-	  fi
-	  prev="$cmd"
-	done
-
-	if test "$prev" != 'sed 50q "[$]0"'; then
-	  echo_test_string=`eval $prev`
-	  export echo_test_string
-	  exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
-	else
-	  # Oops.  We lost completely, so just stick with echo.
-	  echo=echo
-	fi
-      fi
-    fi
-  fi
-fi
-fi
-
-# Copy echo and quote the copy suitably for passing to libtool from
-# the Makefile, instead of quoting the original, which is used later.
-ECHO=$echo
-if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
-   ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
-fi
-
-AC_SUBST(ECHO)
-])])# _LT_AC_PROG_ECHO_BACKSLASH
-
-
-# _LT_AC_LOCK
-# -----------
-AC_DEFUN([_LT_AC_LOCK],
-[AC_ARG_ENABLE([libtool-lock],
-    [AC_HELP_STRING([--disable-libtool-lock],
-	[avoid locking (might break parallel builds)])])
-test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
-
-# Some flags need to be propagated to the compiler or linker for good
-# libtool support.
-case $host in
-ia64-*-hpux*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if AC_TRY_EVAL(ac_compile); then
-    case `/usr/bin/file conftest.$ac_objext` in
-    *ELF-32*)
-      HPUX_IA64_MODE="32"
-      ;;
-    *ELF-64*)
-      HPUX_IA64_MODE="64"
-      ;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
-*-*-irix6*)
-  # Find out which ABI we are using.
-  echo '[#]line __oline__ "configure"' > conftest.$ac_ext
-  if AC_TRY_EVAL(ac_compile); then
-   if test "$lt_cv_prog_gnu_ld" = yes; then
-    case `/usr/bin/file conftest.$ac_objext` in
-    *32-bit*)
-      LD="${LD-ld} -melf32bsmip"
-      ;;
-    *N32*)
-      LD="${LD-ld} -melf32bmipn32"
-      ;;
-    *64-bit*)
-      LD="${LD-ld} -melf64bmip"
-      ;;
-    esac
-   else
-    case `/usr/bin/file conftest.$ac_objext` in
-    *32-bit*)
-      LD="${LD-ld} -32"
-      ;;
-    *N32*)
-      LD="${LD-ld} -n32"
-      ;;
-    *64-bit*)
-      LD="${LD-ld} -64"
-      ;;
-    esac
-   fi
-  fi
-  rm -rf conftest*
-  ;;
-
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
-s390*-*linux*|sparc*-*linux*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if AC_TRY_EVAL(ac_compile); then
-    case `/usr/bin/file conftest.o` in
-    *32-bit*)
-      case $host in
-        x86_64-*kfreebsd*-gnu)
-          LD="${LD-ld} -m elf_i386_fbsd"
-          ;;
-        x86_64-*linux*)
-          LD="${LD-ld} -m elf_i386"
-          ;;
-        ppc64-*linux*|powerpc64-*linux*)
-          LD="${LD-ld} -m elf32ppclinux"
-          ;;
-        s390x-*linux*)
-          LD="${LD-ld} -m elf_s390"
-          ;;
-        sparc64-*linux*)
-          LD="${LD-ld} -m elf32_sparc"
-          ;;
-      esac
-      ;;
-    *64-bit*)
-      case $host in
-        x86_64-*kfreebsd*-gnu)
-          LD="${LD-ld} -m elf_x86_64_fbsd"
-          ;;
-        x86_64-*linux*)
-          LD="${LD-ld} -m elf_x86_64"
-          ;;
-        ppc*-*linux*|powerpc*-*linux*)
-          LD="${LD-ld} -m elf64ppc"
-          ;;
-        s390*-*linux*)
-          LD="${LD-ld} -m elf64_s390"
-          ;;
-        sparc*-*linux*)
-          LD="${LD-ld} -m elf64_sparc"
-          ;;
-      esac
-      ;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
-
-*-*-sco3.2v5*)
-  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
-  SAVE_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS -belf"
-  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
-    [AC_LANG_PUSH(C)
-     AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
-     AC_LANG_POP])
-  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
-    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
-    CFLAGS="$SAVE_CFLAGS"
-  fi
-  ;;
-sparc*-*solaris*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if AC_TRY_EVAL(ac_compile); then
-    case `/usr/bin/file conftest.o` in
-    *64-bit*)
-      case $lt_cv_prog_gnu_ld in
-      yes*) LD="${LD-ld} -m elf64_sparc" ;;
-      *)
-        if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
-	  LD="${LD-ld} -64"
-	fi
-	;;
-      esac
-      ;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
-
-AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
-[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
-  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
-  AC_CHECK_TOOL(AS, as, false)
-  AC_CHECK_TOOL(OBJDUMP, objdump, false)
-  ;;
-  ])
-esac
-
-need_locks="$enable_libtool_lock"
-
-])# _LT_AC_LOCK
-
-
-# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
-#		[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
-# ----------------------------------------------------------------
-# Check whether the given compiler option works
-AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION],
-[AC_REQUIRE([LT_AC_PROG_SED])
-AC_CACHE_CHECK([$1], [$2],
-  [$2=no
-  ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-   lt_compiler_flag="$3"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   # The option is referenced via a variable to avoid confusing sed.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
-   (eval "$lt_compile" 2>conftest.err)
-   ac_status=$?
-   cat conftest.err >&AS_MESSAGE_LOG_FD
-   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
-   if (exit $ac_status) && test -s "$ac_outfile"; then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings other than the usual output.
-     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
-     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
-       $2=yes
-     fi
-   fi
-   $rm conftest*
-])
-
-if test x"[$]$2" = xyes; then
-    ifelse([$5], , :, [$5])
-else
-    ifelse([$6], , :, [$6])
-fi
-])# AC_LIBTOOL_COMPILER_OPTION
-
-
-# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
-#                          [ACTION-SUCCESS], [ACTION-FAILURE])
-# ------------------------------------------------------------
-# Check whether the given compiler option works
-AC_DEFUN([AC_LIBTOOL_LINKER_OPTION],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_CACHE_CHECK([$1], [$2],
-  [$2=no
-   save_LDFLAGS="$LDFLAGS"
-   LDFLAGS="$LDFLAGS $3"
-   echo "$lt_simple_link_test_code" > conftest.$ac_ext
-   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
-     # The linker can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     if test -s conftest.err; then
-       # Append any errors to the config.log.
-       cat conftest.err 1>&AS_MESSAGE_LOG_FD
-       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
-       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-       if diff conftest.exp conftest.er2 >/dev/null; then
-         $2=yes
-       fi
-     else
-       $2=yes
-     fi
-   fi
-   $rm -r conftest*
-   LDFLAGS="$save_LDFLAGS"
-])
-
-if test x"[$]$2" = xyes; then
-    ifelse([$4], , :, [$4])
-else
-    ifelse([$5], , :, [$5])
-fi
-])# AC_LIBTOOL_LINKER_OPTION
-
-
-# AC_LIBTOOL_SYS_MAX_CMD_LEN
-# --------------------------
-AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN],
-[# find the maximum length of command line arguments
-AC_MSG_CHECKING([the maximum length of command line arguments])
-AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
-  i=0
-  teststring="ABCD"
-
-  case $build_os in
-  msdosdjgpp*)
-    # On DJGPP, this test can blow up pretty badly due to problems in libc
-    # (any single argument exceeding 2000 bytes causes a buffer overrun
-    # during glob expansion).  Even if it were fixed, the result of this
-    # check would be larger than it should be.
-    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
-    ;;
-
-  gnu*)
-    # Under GNU Hurd, this test is not required because there is
-    # no limit to the length of command line arguments.
-    # Libtool will interpret -1 as no limit whatsoever
-    lt_cv_sys_max_cmd_len=-1;
-    ;;
-
-  cygwin* | mingw*)
-    # On Win9x/ME, this test blows up -- it succeeds, but takes
-    # about 5 minutes as the teststring grows exponentially.
-    # Worse, since 9x/ME are not pre-emptively multitasking,
-    # you end up with a "frozen" computer, even though with patience
-    # the test eventually succeeds (with a max line length of 256k).
-    # Instead, let's just punt: use the minimum linelength reported by
-    # all of the supported platforms: 8192 (on NT/2K/XP).
-    lt_cv_sys_max_cmd_len=8192;
-    ;;
-
-  amigaos*)
-    # On AmigaOS with pdksh, this test takes hours, literally.
-    # So we just punt and use a minimum line length of 8192.
-    lt_cv_sys_max_cmd_len=8192;
-    ;;
-
-  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
-    # This has been around since 386BSD, at least.  Likely further.
-    if test -x /sbin/sysctl; then
-      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
-    elif test -x /usr/sbin/sysctl; then
-      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
-    else
-      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
-    fi
-    # And add a safety zone
-    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
-    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
-    ;;
-
-  interix*)
-    # We know the value 262144 and hardcode it with a safety zone (like BSD)
-    lt_cv_sys_max_cmd_len=196608
-    ;;
-
-  osf*)
-    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
-    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
-    # nice to cause kernel panics so lets avoid the loop below.
-    # First set a reasonable default.
-    lt_cv_sys_max_cmd_len=16384
-    #
-    if test -x /sbin/sysconfig; then
-      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
-        *1*) lt_cv_sys_max_cmd_len=-1 ;;
-      esac
-    fi
-    ;;
-  sco3.2v5*)
-    lt_cv_sys_max_cmd_len=102400
-    ;;
-  sysv5* | sco5v6* | sysv4.2uw2*)
-    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
-    if test -n "$kargmax"; then
-      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ 	]]//'`
-    else
-      lt_cv_sys_max_cmd_len=32768
-    fi
-    ;;
-  *)
-    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
-    if test -n "$lt_cv_sys_max_cmd_len"; then
-      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
-      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
-    else
-      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
-      while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \
-	       = "XX$teststring") >/dev/null 2>&1 &&
-	      new_result=`expr "X$teststring" : ".*" 2>&1` &&
-	      lt_cv_sys_max_cmd_len=$new_result &&
-	      test $i != 17 # 1/2 MB should be enough
-      do
-        i=`expr $i + 1`
-        teststring=$teststring$teststring
-      done
-      teststring=
-      # Add a significant safety factor because C++ compilers can tack on massive
-      # amounts of additional arguments before passing them to the linker.
-      # It appears as though 1/2 is a usable value.
-      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
-    fi
-    ;;
-  esac
-])
-if test -n $lt_cv_sys_max_cmd_len ; then
-  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
-else
-  AC_MSG_RESULT(none)
-fi
-])# AC_LIBTOOL_SYS_MAX_CMD_LEN
-
-
-# _LT_AC_CHECK_DLFCN
-# ------------------
-AC_DEFUN([_LT_AC_CHECK_DLFCN],
-[AC_CHECK_HEADERS(dlfcn.h)dnl
-])# _LT_AC_CHECK_DLFCN
-
-
-# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
-#                           ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
-# ---------------------------------------------------------------------
-AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
-[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
-if test "$cross_compiling" = yes; then :
-  [$4]
-else
-  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-  lt_status=$lt_dlunknown
-  cat > conftest.$ac_ext <<EOF
-[#line __oline__ "configure"
-#include "confdefs.h"
-
-#if HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
-
-#include <stdio.h>
-
-#ifdef RTLD_GLOBAL
-#  define LT_DLGLOBAL		RTLD_GLOBAL
-#else
-#  ifdef DL_GLOBAL
-#    define LT_DLGLOBAL		DL_GLOBAL
-#  else
-#    define LT_DLGLOBAL		0
-#  endif
-#endif
-
-/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
-   find out it does not work in some platform. */
-#ifndef LT_DLLAZY_OR_NOW
-#  ifdef RTLD_LAZY
-#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
-#  else
-#    ifdef DL_LAZY
-#      define LT_DLLAZY_OR_NOW		DL_LAZY
-#    else
-#      ifdef RTLD_NOW
-#        define LT_DLLAZY_OR_NOW	RTLD_NOW
-#      else
-#        ifdef DL_NOW
-#          define LT_DLLAZY_OR_NOW	DL_NOW
-#        else
-#          define LT_DLLAZY_OR_NOW	0
-#        endif
-#      endif
-#    endif
-#  endif
-#endif
-
-#ifdef __cplusplus
-extern "C" void exit (int);
-#endif
-
-void fnord() { int i=42;}
-int main ()
-{
-  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
-  int status = $lt_dlunknown;
-
-  if (self)
-    {
-      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
-      /* dlclose (self); */
-    }
-  else
-    puts (dlerror ());
-
-    exit (status);
-}]
-EOF
-  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
-    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
-    lt_status=$?
-    case x$lt_status in
-      x$lt_dlno_uscore) $1 ;;
-      x$lt_dlneed_uscore) $2 ;;
-      x$lt_dlunknown|x*) $3 ;;
-    esac
-  else :
-    # compilation failed
-    $3
-  fi
-fi
-rm -fr conftest*
-])# _LT_AC_TRY_DLOPEN_SELF
-
-
-# AC_LIBTOOL_DLOPEN_SELF
-# ----------------------
-AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
-[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
-if test "x$enable_dlopen" != xyes; then
-  enable_dlopen=unknown
-  enable_dlopen_self=unknown
-  enable_dlopen_self_static=unknown
-else
-  lt_cv_dlopen=no
-  lt_cv_dlopen_libs=
-
-  case $host_os in
-  beos*)
-    lt_cv_dlopen="load_add_on"
-    lt_cv_dlopen_libs=
-    lt_cv_dlopen_self=yes
-    ;;
-
-  mingw* | pw32*)
-    lt_cv_dlopen="LoadLibrary"
-    lt_cv_dlopen_libs=
-   ;;
-
-  cygwin*)
-    lt_cv_dlopen="dlopen"
-    lt_cv_dlopen_libs=
-   ;;
-
-  darwin*)
-  # if libdl is installed we need to link against it
-    AC_CHECK_LIB([dl], [dlopen],
-		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
-    lt_cv_dlopen="dyld"
-    lt_cv_dlopen_libs=
-    lt_cv_dlopen_self=yes
-    ])
-   ;;
-
-  *)
-    AC_CHECK_FUNC([shl_load],
-	  [lt_cv_dlopen="shl_load"],
-      [AC_CHECK_LIB([dld], [shl_load],
-	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
-	[AC_CHECK_FUNC([dlopen],
-	      [lt_cv_dlopen="dlopen"],
-	  [AC_CHECK_LIB([dl], [dlopen],
-		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
-	    [AC_CHECK_LIB([svld], [dlopen],
-		  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
-	      [AC_CHECK_LIB([dld], [dld_link],
-		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
-	      ])
-	    ])
-	  ])
-	])
-      ])
-    ;;
-  esac
-
-  if test "x$lt_cv_dlopen" != xno; then
-    enable_dlopen=yes
-  else
-    enable_dlopen=no
-  fi
-
-  case $lt_cv_dlopen in
-  dlopen)
-    save_CPPFLAGS="$CPPFLAGS"
-    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
-
-    save_LDFLAGS="$LDFLAGS"
-    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
-
-    save_LIBS="$LIBS"
-    LIBS="$lt_cv_dlopen_libs $LIBS"
-
-    AC_CACHE_CHECK([whether a program can dlopen itself],
-	  lt_cv_dlopen_self, [dnl
-	  _LT_AC_TRY_DLOPEN_SELF(
-	    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
-	    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
-    ])
-
-    if test "x$lt_cv_dlopen_self" = xyes; then
-      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
-      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
-    	  lt_cv_dlopen_self_static, [dnl
-	  _LT_AC_TRY_DLOPEN_SELF(
-	    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
-	    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
-      ])
-    fi
-
-    CPPFLAGS="$save_CPPFLAGS"
-    LDFLAGS="$save_LDFLAGS"
-    LIBS="$save_LIBS"
-    ;;
-  esac
-
-  case $lt_cv_dlopen_self in
-  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
-  *) enable_dlopen_self=unknown ;;
-  esac
-
-  case $lt_cv_dlopen_self_static in
-  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
-  *) enable_dlopen_self_static=unknown ;;
-  esac
-fi
-])# AC_LIBTOOL_DLOPEN_SELF
-
-
-# AC_LIBTOOL_PROG_CC_C_O([TAGNAME])
-# ---------------------------------
-# Check to see if options -c and -o are simultaneously supported by compiler
-AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
-AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
-  [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
-  [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
-   $rm -r conftest 2>/dev/null
-   mkdir conftest
-   cd conftest
-   mkdir out
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
-   lt_compiler_flag="-o out/conftest2.$ac_objext"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
-   (eval "$lt_compile" 2>out/conftest.err)
-   ac_status=$?
-   cat out/conftest.err >&AS_MESSAGE_LOG_FD
-   echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
-   if (exit $ac_status) && test -s out/conftest2.$ac_objext
-   then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
-     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
-     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
-       _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
-     fi
-   fi
-   chmod u+w . 2>&AS_MESSAGE_LOG_FD
-   $rm conftest*
-   # SGI C++ compiler will create directory out/ii_files/ for
-   # template instantiation
-   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
-   $rm out/* && rmdir out
-   cd ..
-   rmdir conftest
-   $rm conftest*
-])
-])# AC_LIBTOOL_PROG_CC_C_O
-
-
-# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME])
-# -----------------------------------------
-# Check to see if we can do hard links to lock some files if needed
-AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS],
-[AC_REQUIRE([_LT_AC_LOCK])dnl
-
-hard_links="nottested"
-if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
-  # do not overwrite the value of need_locks provided by the user
-  AC_MSG_CHECKING([if we can lock with hard links])
-  hard_links=yes
-  $rm conftest*
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  touch conftest.a
-  ln conftest.a conftest.b 2>&5 || hard_links=no
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  AC_MSG_RESULT([$hard_links])
-  if test "$hard_links" = no; then
-    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
-    need_locks=warn
-  fi
-else
-  need_locks=no
-fi
-])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS
-
-
-# AC_LIBTOOL_OBJDIR
-# -----------------
-AC_DEFUN([AC_LIBTOOL_OBJDIR],
-[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
-[rm -f .libs 2>/dev/null
-mkdir .libs 2>/dev/null
-if test -d .libs; then
-  lt_cv_objdir=.libs
-else
-  # MS-DOS does not allow filenames that begin with a dot.
-  lt_cv_objdir=_libs
-fi
-rmdir .libs 2>/dev/null])
-objdir=$lt_cv_objdir
-])# AC_LIBTOOL_OBJDIR
-
-
-# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME])
-# ----------------------------------------------
-# Check hardcoding attributes.
-AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH],
-[AC_MSG_CHECKING([how to hardcode library paths into programs])
-_LT_AC_TAGVAR(hardcode_action, $1)=
-if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \
-   test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \
-   test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
-
-  # We can hardcode non-existant directories.
-  if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != no &&
-     # If the only mechanism to avoid hardcoding is shlibpath_var, we
-     # have to relink, otherwise we might link with an installed library
-     # when we should be linking with a yet-to-be-installed one
-     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
-     test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then
-    # Linking always hardcodes the temporary library directory.
-    _LT_AC_TAGVAR(hardcode_action, $1)=relink
-  else
-    # We can link without hardcoding, and we can hardcode nonexisting dirs.
-    _LT_AC_TAGVAR(hardcode_action, $1)=immediate
-  fi
-else
-  # We cannot hardcode anything, or else we can only hardcode existing
-  # directories.
-  _LT_AC_TAGVAR(hardcode_action, $1)=unsupported
-fi
-AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)])
-
-if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then
-  # Fast installation is not supported
-  enable_fast_install=no
-elif test "$shlibpath_overrides_runpath" = yes ||
-     test "$enable_shared" = no; then
-  # Fast installation is not necessary
-  enable_fast_install=needless
-fi
-])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH
-
-
-# AC_LIBTOOL_SYS_LIB_STRIP
-# ------------------------
-AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP],
-[striplib=
-old_striplib=
-AC_MSG_CHECKING([whether stripping libraries is possible])
-if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
-  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
-  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
-  AC_MSG_RESULT([yes])
-else
-# FIXME - insert some real tests, host_os isn't really good enough
-  case $host_os in
-   darwin*)
-       if test -n "$STRIP" ; then
-         striplib="$STRIP -x"
-         old_striplib="$STRIP -S"
-         AC_MSG_RESULT([yes])
-       else
-  AC_MSG_RESULT([no])
-fi
-       ;;
-   *)
-  AC_MSG_RESULT([no])
-    ;;
-  esac
-fi
-])# AC_LIBTOOL_SYS_LIB_STRIP
-
-
-# AC_LIBTOOL_SYS_DYNAMIC_LINKER
-# -----------------------------
-# PORTME Fill in your ld.so characteristics
-AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_MSG_CHECKING([dynamic linker characteristics])
-library_names_spec=
-libname_spec='lib$name'
-soname_spec=
-shrext_cmds=".so"
-postinstall_cmds=
-postuninstall_cmds=
-finish_cmds=
-finish_eval=
-shlibpath_var=
-shlibpath_overrides_runpath=unknown
-version_type=none
-dynamic_linker="$host_os ld.so"
-sys_lib_dlsearch_path_spec="/lib /usr/lib"
-m4_if($1,[],[
-if test "$GCC" = yes; then
-  case $host_os in
-    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
-    *) lt_awk_arg="/^libraries:/" ;;
-  esac
-  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-  if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then
-    # if the path contains ";" then we assume it to be the separator
-    # otherwise default to the standard path separator (i.e. ":") - it is
-    # assumed that no part of a normal pathname contains ";" but that should
-    # okay in the real world where ";" in dirpaths is itself problematic.
-    lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'`
-  else
-    lt_search_path_spec=`echo "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-  fi
-  # Ok, now we have the path, separated by spaces, we can step through it
-  # and add multilib dir if necessary.
-  lt_tmp_lt_search_path_spec=
-  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
-  for lt_sys_path in $lt_search_path_spec; do
-    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
-      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
-    else
-      test -d "$lt_sys_path" && \
-	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
-    fi
-  done
-  lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk '
-BEGIN {RS=" "; FS="/|\n";} {
-  lt_foo="";
-  lt_count=0;
-  for (lt_i = NF; lt_i > 0; lt_i--) {
-    if ($lt_i != "" && $lt_i != ".") {
-      if ($lt_i == "..") {
-        lt_count++;
-      } else {
-        if (lt_count == 0) {
-          lt_foo="/" $lt_i lt_foo;
-        } else {
-          lt_count--;
-        }
-      }
-    }
-  }
-  if (lt_foo != "") { lt_freq[[lt_foo]]++; }
-  if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
-}'`
-  sys_lib_search_path_spec=`echo $lt_search_path_spec`
-else
-  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
-fi])
-need_lib_prefix=unknown
-hardcode_into_libs=no
-
-# when you set need_version to no, make sure it does not cause -set_version
-# flags to be left without arguments
-need_version=unknown
-
-case $host_os in
-aix3*)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
-  shlibpath_var=LIBPATH
-
-  # AIX 3 has no versioning support, so we append a major version to the name.
-  soname_spec='${libname}${release}${shared_ext}$major'
-  ;;
-
-aix[[4-9]]*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  hardcode_into_libs=yes
-  if test "$host_cpu" = ia64; then
-    # AIX 5 supports IA64
-    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
-    shlibpath_var=LD_LIBRARY_PATH
-  else
-    # With GCC up to 2.95.x, collect2 would create an import file
-    # for dependence libraries.  The import file would start with
-    # the line `#! .'.  This would cause the generated library to
-    # depend on `.', always an invalid library.  This was fixed in
-    # development snapshots of GCC prior to 3.0.
-    case $host_os in
-      aix4 | aix4.[[01]] | aix4.[[01]].*)
-      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
-	   echo ' yes '
-	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
-	:
-      else
-	can_build_shared=no
-      fi
-      ;;
-    esac
-    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
-    # soname into executable. Probably we can add versioning support to
-    # collect2, so additional links can be useful in future.
-    if test "$aix_use_runtimelinking" = yes; then
-      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
-      # instead of lib<name>.a to let people know that these are not
-      # typical AIX shared libraries.
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    else
-      # We preserve .a as extension for shared libraries through AIX4.2
-      # and later when we are not doing run time linking.
-      library_names_spec='${libname}${release}.a $libname.a'
-      soname_spec='${libname}${release}${shared_ext}$major'
-    fi
-    shlibpath_var=LIBPATH
-  fi
-  ;;
-
-amigaos*)
-  library_names_spec='$libname.ixlibrary $libname.a'
-  # Create ${libname}_ixlibrary.a entries in /sys/libs.
-  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
-  ;;
-
-beos*)
-  library_names_spec='${libname}${shared_ext}'
-  dynamic_linker="$host_os ld.so"
-  shlibpath_var=LIBRARY_PATH
-  ;;
-
-bsdi[[45]]*)
-  version_type=linux
-  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'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
-  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
-  # the default ld.so.conf also contains /usr/contrib/lib and
-  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
-  # libtool to hard-code these into programs
-  ;;
-
-cygwin* | mingw* | pw32*)
-  version_type=windows
-  shrext_cmds=".dll"
-  need_version=no
-  need_lib_prefix=no
-
-  case $GCC,$host_os in
-  yes,cygwin* | yes,mingw* | yes,pw32*)
-    library_names_spec='$libname.dll.a'
-    # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
-      dldir=$destdir/`dirname \$dlpath`~
-      test -d \$dldir || mkdir -p \$dldir~
-      $install_prog $dir/$dlname \$dldir/$dlname~
-      chmod a+x \$dldir/$dlname'
-    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
-      dlpath=$dir/\$dldll~
-       $rm \$dlpath'
-    shlibpath_overrides_runpath=yes
-
-    case $host_os in
-    cygwin*)
-      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
-      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
-      ;;
-    mingw*)
-      # MinGW DLLs use traditional 'lib' prefix
-      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-      if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then
-        # It is most probably a Windows format PATH printed by
-        # mingw gcc, but we are running on Cygwin. Gcc prints its search
-        # path with ; separators, and with drive letters. We can handle the
-        # drive letters (cygwin fileutils understands them), so leave them,
-        # especially as we might pass files found there to a mingw objdump,
-        # which wouldn't understand a cygwinified path. Ahh.
-        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-      else
-        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-      fi
-      ;;
-    pw32*)
-      # pw32 DLLs use 'pw' prefix rather than 'lib'
-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    esac
-    ;;
-
-  *)
-    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
-    ;;
-  esac
-  dynamic_linker='Win32 ld.exe'
-  # FIXME: first we should search . and the directory the executable is in
-  shlibpath_var=PATH
-  ;;
-
-darwin* | rhapsody*)
-  dynamic_linker="$host_os dyld"
-  version_type=darwin
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
-  soname_spec='${libname}${release}${major}$shared_ext'
-  shlibpath_overrides_runpath=yes
-  shlibpath_var=DYLD_LIBRARY_PATH
-  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
-  m4_if([$1], [],[
-  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) 
-  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
-  ;;
-
-dgux*)
-  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
-  ;;
-
-freebsd1*)
-  dynamic_linker=no
-  ;;
-
-freebsd* | dragonfly*)
-  # DragonFly does not have aout.  When/if they implement a new
-  # versioning mechanism, adjust this.
-  if test -x /usr/bin/objformat; then
-    objformat=`/usr/bin/objformat`
-  else
-    case $host_os in
-    freebsd[[123]]*) objformat=aout ;;
-    *) objformat=elf ;;
-    esac
-  fi
-  version_type=freebsd-$objformat
-  case $version_type in
-    freebsd-elf*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-      need_version=no
-      need_lib_prefix=no
-      ;;
-    freebsd-*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
-      need_version=yes
-      ;;
-  esac
-  shlibpath_var=LD_LIBRARY_PATH
-  case $host_os in
-  freebsd2*)
-    shlibpath_overrides_runpath=yes
-    ;;
-  freebsd3.[[01]]* | freebsdelf3.[[01]]*)
-    shlibpath_overrides_runpath=yes
-    hardcode_into_libs=yes
-    ;;
-  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
-  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
-    shlibpath_overrides_runpath=no
-    hardcode_into_libs=yes
-    ;;
-  *) # from 4.6 on, and DragonFly
-    shlibpath_overrides_runpath=yes
-    hardcode_into_libs=yes
-    ;;
-  esac
-  ;;
-
-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
-  hardcode_into_libs=yes
-  ;;
-
-hpux9* | hpux10* | hpux11*)
-  # Give a soname corresponding to the major version so that dld.sl refuses to
-  # link against other versions.
-  version_type=sunos
-  need_lib_prefix=no
-  need_version=no
-  case $host_cpu in
-  ia64*)
-    shrext_cmds='.so'
-    hardcode_into_libs=yes
-    dynamic_linker="$host_os dld.so"
-    shlibpath_var=LD_LIBRARY_PATH
-    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    if test "X$HPUX_IA64_MODE" = X32; then
-      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
-    else
-      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
-    fi
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
-    ;;
-   hppa*64*)
-     shrext_cmds='.sl'
-     hardcode_into_libs=yes
-     dynamic_linker="$host_os dld.sl"
-     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
-     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-     soname_spec='${libname}${release}${shared_ext}$major'
-     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
-     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
-     ;;
-   *)
-    shrext_cmds='.sl'
-    dynamic_linker="$host_os dld.sl"
-    shlibpath_var=SHLIB_PATH
-    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    ;;
-  esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555.
-  postinstall_cmds='chmod 555 $lib'
-  ;;
-
-interix[[3-9]]*)
-  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'
-  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
-
-irix5* | irix6* | nonstopux*)
-  case $host_os in
-    nonstopux*) version_type=nonstopux ;;
-    *)
-	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux
-	else
-		version_type=irix
-	fi ;;
-  esac
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
-  case $host_os in
-  irix5* | nonstopux*)
-    libsuff= shlibsuff=
-    ;;
-  *)
-    case $LD in # libtool.m4 will add one of these switches to LD
-    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
-      libsuff= shlibsuff= libmagic=32-bit;;
-    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
-      libsuff=32 shlibsuff=N32 libmagic=N32;;
-    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
-      libsuff=64 shlibsuff=64 libmagic=64-bit;;
-    *) libsuff= shlibsuff= libmagic=never-match;;
-    esac
-    ;;
-  esac
-  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
-  shlibpath_overrides_runpath=no
-  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
-  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
-  hardcode_into_libs=yes
-  ;;
-
-# No shared lib support for Linux oldld, aout, or coff.
-linux*oldld* | linux*aout* | linux*coff*)
-  dynamic_linker=no
-  ;;
-
-# This must be Linux ELF.
-linux* | k*bsd*-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'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  # This implies no fast_install, which is unacceptable.
-  # Some rework will be needed to allow for fast_install
-  # before this can be enabled.
-  hardcode_into_libs=yes
-
-  # Append ld.so.conf contents to the search path
-  if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
-  fi
-
-  # We used to test for /lib/ld.so.1 and disable shared libraries on
-  # powerpc, because MkLinux only supported shared libraries with the
-  # GNU dynamic linker.  Since this was broken with cross compilers,
-  # most powerpc-linux boxes support dynamic linking these days and
-  # people can always --disable-shared, the test was removed, and we
-  # assume the GNU/Linux dynamic linker is in use.
-  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
-  need_version=no
-  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-    dynamic_linker='NetBSD (a.out) ld.so'
-  else
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    dynamic_linker='NetBSD ld.elf_so'
-  fi
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  ;;
-
-newsos6)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  ;;
-
-nto-qnx*)
-  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=yes
-  ;;
-
-openbsd*)
-  version_type=sunos
-  sys_lib_dlsearch_path_spec="/usr/lib"
-  need_lib_prefix=no
-  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
-  case $host_os in
-    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
-    *)                         need_version=no  ;;
-  esac
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    case $host_os in
-      openbsd2.[[89]] | openbsd2.[[89]].*)
-	shlibpath_overrides_runpath=no
-	;;
-      *)
-	shlibpath_overrides_runpath=yes
-	;;
-      esac
-  else
-    shlibpath_overrides_runpath=yes
-  fi
-  ;;
-
-os2*)
-  libname_spec='$name'
-  shrext_cmds=".dll"
-  need_lib_prefix=no
-  library_names_spec='$libname${shared_ext} $libname.a'
-  dynamic_linker='OS/2 ld.exe'
-  shlibpath_var=LIBPATH
-  ;;
-
-osf3* | osf4* | osf5*)
-  version_type=osf
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
-  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
-  ;;
-
-rdos*)
-  dynamic_linker=no
-  ;;
-
-solaris*)
-  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=yes
-  hardcode_into_libs=yes
-  # ldd complains unless libraries are executable
-  postinstall_cmds='chmod +x $lib'
-  ;;
-
-sunos4*)
-  version_type=sunos
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  if test "$with_gnu_ld" = yes; then
-    need_lib_prefix=no
-  fi
-  need_version=yes
-  ;;
-
-sysv4 | sysv4.3*)
-  version_type=linux
-  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
-  case $host_vendor in
-    sni)
-      shlibpath_overrides_runpath=no
-      need_lib_prefix=no
-      export_dynamic_flag_spec='${wl}-Blargedynsym'
-      runpath_var=LD_RUN_PATH
-      ;;
-    siemens)
-      need_lib_prefix=no
-      ;;
-    motorola)
-      need_lib_prefix=no
-      need_version=no
-      shlibpath_overrides_runpath=no
-      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
-      ;;
-  esac
-  ;;
-
-sysv4*MP*)
-  if test -d /usr/nec ;then
-    version_type=linux
-    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
-    soname_spec='$libname${shared_ext}.$major'
-    shlibpath_var=LD_LIBRARY_PATH
-  fi
-  ;;
-
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  version_type=freebsd-elf
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  hardcode_into_libs=yes
-  if test "$with_gnu_ld" = yes; then
-    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
-    shlibpath_overrides_runpath=no
-  else
-    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
-    shlibpath_overrides_runpath=yes
-    case $host_os in
-      sco3.2v5*)
-        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
-	;;
-    esac
-  fi
-  sys_lib_dlsearch_path_spec='/usr/lib'
-  ;;
-
-uts4*)
-  version_type=linux
-  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
-  ;;
-
-*)
-  dynamic_linker=no
-  ;;
-esac
-AC_MSG_RESULT([$dynamic_linker])
-test "$dynamic_linker" = no && can_build_shared=no
-
-AC_CACHE_VAL([lt_cv_sys_lib_search_path_spec],
-[lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"])
-sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
-AC_CACHE_VAL([lt_cv_sys_lib_dlsearch_path_spec],
-[lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"])
-sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
-
-variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
-if test "$GCC" = yes; then
-  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
-fi
-])# AC_LIBTOOL_SYS_DYNAMIC_LINKER
-
-
-# _LT_AC_TAGCONFIG
-# ----------------
-AC_DEFUN([_LT_AC_TAGCONFIG],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_ARG_WITH([tags],
-    [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@],
-        [include additional configurations @<:@automatic@:>@])],
-    [tagnames="$withval"])
-
-if test -f "$ltmain" && test -n "$tagnames"; then
-  if test ! -f "${ofile}"; then
-    AC_MSG_WARN([output file `$ofile' does not exist])
-  fi
-
-  if test -z "$LTCC"; then
-    eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
-    if test -z "$LTCC"; then
-      AC_MSG_WARN([output file `$ofile' does not look like a libtool script])
-    else
-      AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile'])
-    fi
-  fi
-  if test -z "$LTCFLAGS"; then
-    eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
-  fi
-
-  # Extract list of available tagged configurations in $ofile.
-  # Note that this assumes the entire list is on one line.
-  available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
-
-  lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-  for tagname in $tagnames; do
-    IFS="$lt_save_ifs"
-    # Check whether tagname contains only valid characters
-    case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in
-    "") ;;
-    *)  AC_MSG_ERROR([invalid tag name: $tagname])
-	;;
-    esac
-
-    if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
-    then
-      AC_MSG_ERROR([tag name \"$tagname\" already exists])
-    fi
-
-    # Update the list of available tags.
-    if test -n "$tagname"; then
-      echo appending configuration tag \"$tagname\" to $ofile
-
-      case $tagname in
-      CXX)
-	if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
-	    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
-	    (test "X$CXX" != "Xg++"))) ; then
-	  AC_LIBTOOL_LANG_CXX_CONFIG
-	else
-	  tagname=""
-	fi
-	;;
-
-      F77)
-	if test -n "$F77" && test "X$F77" != "Xno"; then
-	  AC_LIBTOOL_LANG_F77_CONFIG
-	else
-	  tagname=""
-	fi
-	;;
-
-      GCJ)
-	if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
-	  AC_LIBTOOL_LANG_GCJ_CONFIG
-	else
-	  tagname=""
-	fi
-	;;
-
-      RC)
-	AC_LIBTOOL_LANG_RC_CONFIG
-	;;
-
-      *)
-	AC_MSG_ERROR([Unsupported tag name: $tagname])
-	;;
-      esac
-
-      # Append the new tag name to the list of available tags.
-      if test -n "$tagname" ; then
-      available_tags="$available_tags $tagname"
-    fi
-    fi
-  done
-  IFS="$lt_save_ifs"
-
-  # Now substitute the updated list of available tags.
-  if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
-    mv "${ofile}T" "$ofile"
-    chmod +x "$ofile"
-  else
-    rm -f "${ofile}T"
-    AC_MSG_ERROR([unable to update list of available tagged configurations.])
-  fi
-fi
-])# _LT_AC_TAGCONFIG
-
-
-# AC_LIBTOOL_DLOPEN
-# -----------------
-# enable checks for dlopen support
-AC_DEFUN([AC_LIBTOOL_DLOPEN],
- [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])
-])# AC_LIBTOOL_DLOPEN
-
-
-# AC_LIBTOOL_WIN32_DLL
-# --------------------
-# declare package support for building win32 DLLs
-AC_DEFUN([AC_LIBTOOL_WIN32_DLL],
-[AC_BEFORE([$0], [AC_LIBTOOL_SETUP])
-])# AC_LIBTOOL_WIN32_DLL
-
-
-# AC_ENABLE_SHARED([DEFAULT])
-# ---------------------------
-# implement the --enable-shared flag
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
-AC_DEFUN([AC_ENABLE_SHARED],
-[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
-AC_ARG_ENABLE([shared],
-    [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
-	[build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])],
-    [p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_shared=yes ;;
-    no) enable_shared=no ;;
-    *)
-      enable_shared=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_shared=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [enable_shared=]AC_ENABLE_SHARED_DEFAULT)
-])# AC_ENABLE_SHARED
-
-
-# AC_DISABLE_SHARED
-# -----------------
-# set the default shared flag to --disable-shared
-AC_DEFUN([AC_DISABLE_SHARED],
-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-AC_ENABLE_SHARED(no)
-])# AC_DISABLE_SHARED
-
-
-# AC_ENABLE_STATIC([DEFAULT])
-# ---------------------------
-# implement the --enable-static flag
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
-AC_DEFUN([AC_ENABLE_STATIC],
-[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
-AC_ARG_ENABLE([static],
-    [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@],
-	[build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])],
-    [p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_static=yes ;;
-    no) enable_static=no ;;
-    *)
-     enable_static=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_static=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [enable_static=]AC_ENABLE_STATIC_DEFAULT)
-])# AC_ENABLE_STATIC
-
-
-# AC_DISABLE_STATIC
-# -----------------
-# set the default static flag to --disable-static
-AC_DEFUN([AC_DISABLE_STATIC],
-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-AC_ENABLE_STATIC(no)
-])# AC_DISABLE_STATIC
-
-
-# AC_ENABLE_FAST_INSTALL([DEFAULT])
-# ---------------------------------
-# implement the --enable-fast-install flag
-# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
-AC_DEFUN([AC_ENABLE_FAST_INSTALL],
-[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
-AC_ARG_ENABLE([fast-install],
-    [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
-    [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
-    [p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_fast_install=yes ;;
-    no) enable_fast_install=no ;;
-    *)
-      enable_fast_install=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_fast_install=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac],
-    [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT)
-])# AC_ENABLE_FAST_INSTALL
-
-
-# AC_DISABLE_FAST_INSTALL
-# -----------------------
-# set the default to --disable-fast-install
-AC_DEFUN([AC_DISABLE_FAST_INSTALL],
-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-AC_ENABLE_FAST_INSTALL(no)
-])# AC_DISABLE_FAST_INSTALL
-
-
-# AC_LIBTOOL_PICMODE([MODE])
-# --------------------------
-# implement the --with-pic flag
-# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
-AC_DEFUN([AC_LIBTOOL_PICMODE],
-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-pic_mode=ifelse($#,1,$1,default)
-])# AC_LIBTOOL_PICMODE
-
-
-# AC_PROG_EGREP
-# -------------
-# This is predefined starting with Autoconf 2.54, so this conditional
-# definition can be removed once we require Autoconf 2.54 or later.
-m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP],
-[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
-   [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
-    then ac_cv_prog_egrep='grep -E'
-    else ac_cv_prog_egrep='egrep'
-    fi])
- EGREP=$ac_cv_prog_egrep
- AC_SUBST([EGREP])
-])])
-
-
-# AC_PATH_TOOL_PREFIX
-# -------------------
-# find a file program which can recognize shared library
-AC_DEFUN([AC_PATH_TOOL_PREFIX],
-[AC_REQUIRE([AC_PROG_EGREP])dnl
-AC_MSG_CHECKING([for $1])
-AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
-[case $MAGIC_CMD in
-[[\\/*] |  ?:[\\/]*])
-  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
-  ;;
-*)
-  lt_save_MAGIC_CMD="$MAGIC_CMD"
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-dnl $ac_dummy forces splitting on constant user-supplied paths.
-dnl POSIX.2 word splitting is done only on the output of word expansions,
-dnl not every word.  This closes a longstanding sh security hole.
-  ac_dummy="ifelse([$2], , $PATH, [$2])"
-  for ac_dir in $ac_dummy; do
-    IFS="$lt_save_ifs"
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$1; then
-      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
-      if test -n "$file_magic_test_file"; then
-	case $deplibs_check_method in
-	"file_magic "*)
-	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
-	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
-	    $EGREP "$file_magic_regex" > /dev/null; then
-	    :
-	  else
-	    cat <<EOF 1>&2
-
-*** Warning: the command libtool uses to detect shared libraries,
-*** $file_magic_cmd, produces output that libtool cannot recognize.
-*** The result is that libtool may fail to recognize shared libraries
-*** as such.  This will affect the creation of libtool libraries that
-*** depend on shared libraries, but programs linked with such libtool
-*** libraries will work regardless of this problem.  Nevertheless, you
-*** may want to report the problem to your system manager and/or to
-*** bug-libtool at gnu.org
-
-EOF
-	  fi ;;
-	esac
-      fi
-      break
-    fi
-  done
-  IFS="$lt_save_ifs"
-  MAGIC_CMD="$lt_save_MAGIC_CMD"
-  ;;
-esac])
-MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-if test -n "$MAGIC_CMD"; then
-  AC_MSG_RESULT($MAGIC_CMD)
-else
-  AC_MSG_RESULT(no)
-fi
-])# AC_PATH_TOOL_PREFIX
-
-
-# AC_PATH_MAGIC
-# -------------
-# find a file program which can recognize a shared library
-AC_DEFUN([AC_PATH_MAGIC],
-[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
-if test -z "$lt_cv_path_MAGIC_CMD"; then
-  if test -n "$ac_tool_prefix"; then
-    AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
-  else
-    MAGIC_CMD=:
-  fi
-fi
-])# AC_PATH_MAGIC
-
-
-# AC_PROG_LD
-# ----------
-# find the pathname to the GNU or non-GNU linker
-AC_DEFUN([AC_PROG_LD],
-[AC_ARG_WITH([gnu-ld],
-    [AC_HELP_STRING([--with-gnu-ld],
-	[assume the C compiler uses GNU ld @<:@default=no@:>@])],
-    [test "$withval" = no || with_gnu_ld=yes],
-    [with_gnu_ld=no])
-AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-ac_prog=ld
-if test "$GCC" = yes; then
-  # Check if gcc -print-prog-name=ld gives a path.
-  AC_MSG_CHECKING([for ld used by $CC])
-  case $host in
-  *-*-mingw*)
-    # gcc leaves a trailing carriage return which upsets mingw
-    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
-  *)
-    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
-  esac
-  case $ac_prog in
-    # Accept absolute paths.
-    [[\\/]]* | ?:[[\\/]]*)
-      re_direlt='/[[^/]][[^/]]*/\.\./'
-      # Canonicalize the pathname of ld
-      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
-      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
-	ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
-      done
-      test -z "$LD" && LD="$ac_prog"
-      ;;
-  "")
-    # If it fails, then pretend we aren't using GCC.
-    ac_prog=ld
-    ;;
-  *)
-    # If it is relative, then search for the first ld in PATH.
-    with_gnu_ld=unknown
-    ;;
-  esac
-elif test "$with_gnu_ld" = yes; then
-  AC_MSG_CHECKING([for GNU ld])
-else
-  AC_MSG_CHECKING([for non-GNU ld])
-fi
-AC_CACHE_VAL(lt_cv_path_LD,
-[if test -z "$LD"; then
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-  for ac_dir in $PATH; do
-    IFS="$lt_save_ifs"
-    test -z "$ac_dir" && ac_dir=.
-    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
-      lt_cv_path_LD="$ac_dir/$ac_prog"
-      # Check to see if the program is GNU ld.  I'd rather use --version,
-      # but apparently some variants of GNU ld only accept -v.
-      # Break only if it was the GNU/non-GNU ld that we prefer.
-      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
-      *GNU* | *'with BFD'*)
-	test "$with_gnu_ld" != no && break
-	;;
-      *)
-	test "$with_gnu_ld" != yes && break
-	;;
-      esac
-    fi
-  done
-  IFS="$lt_save_ifs"
-else
-  lt_cv_path_LD="$LD" # Let the user override the test with a path.
-fi])
-LD="$lt_cv_path_LD"
-if test -n "$LD"; then
-  AC_MSG_RESULT($LD)
-else
-  AC_MSG_RESULT(no)
-fi
-test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
-AC_PROG_LD_GNU
-])# AC_PROG_LD
-
-
-# AC_PROG_LD_GNU
-# --------------
-AC_DEFUN([AC_PROG_LD_GNU],
-[AC_REQUIRE([AC_PROG_EGREP])dnl
-AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
-[# I'd rather use --version here, but apparently some GNU lds only accept -v.
-case `$LD -v 2>&1 </dev/null` in
-*GNU* | *'with BFD'*)
-  lt_cv_prog_gnu_ld=yes
-  ;;
-*)
-  lt_cv_prog_gnu_ld=no
-  ;;
-esac])
-with_gnu_ld=$lt_cv_prog_gnu_ld
-])# AC_PROG_LD_GNU
-
-
-# AC_PROG_LD_RELOAD_FLAG
-# ----------------------
-# find reload flag for linker
-#   -- PORTME Some linkers may need a different reload flag.
-AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
-[AC_CACHE_CHECK([for $LD option to reload object files],
-  lt_cv_ld_reload_flag,
-  [lt_cv_ld_reload_flag='-r'])
-reload_flag=$lt_cv_ld_reload_flag
-case $reload_flag in
-"" | " "*) ;;
-*) reload_flag=" $reload_flag" ;;
-esac
-reload_cmds='$LD$reload_flag -o $output$reload_objs'
-case $host_os in
-  darwin*)
-    if test "$GCC" = yes; then
-      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
-    else
-      reload_cmds='$LD$reload_flag -o $output$reload_objs'
-    fi
-    ;;
-esac
-])# AC_PROG_LD_RELOAD_FLAG
-
-
-# AC_DEPLIBS_CHECK_METHOD
-# -----------------------
-# how to check for library dependencies
-#  -- PORTME fill in with the dynamic library characteristics
-AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
-[AC_CACHE_CHECK([how to recognize dependent libraries],
-lt_cv_deplibs_check_method,
-[lt_cv_file_magic_cmd='$MAGIC_CMD'
-lt_cv_file_magic_test_file=
-lt_cv_deplibs_check_method='unknown'
-# Need to set the preceding variable on all platforms that support
-# interlibrary dependencies.
-# 'none' -- dependencies not supported.
-# `unknown' -- same as none, but documents that we really don't know.
-# 'pass_all' -- all dependencies passed with no checks.
-# 'test_compile' -- check by making test program.
-# 'file_magic [[regex]]' -- check by looking for files in library path
-# which responds to the $file_magic_cmd with a given extended regex.
-# If you have `file' or equivalent on your system and you're not sure
-# whether `pass_all' will *always* work, you probably want this one.
-
-case $host_os in
-aix[[4-9]]*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-beos*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-bsdi[[45]]*)
-  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
-  lt_cv_file_magic_cmd='/usr/bin/file -L'
-  lt_cv_file_magic_test_file=/shlib/libc.so
-  ;;
-
-cygwin*)
-  # func_win32_libid is a shell function defined in ltmain.sh
-  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
-  lt_cv_file_magic_cmd='func_win32_libid'
-  ;;
-
-mingw* | pw32*)
-  # Base MSYS/MinGW do not provide the 'file' command needed by
-  # func_win32_libid shell function, so use a weaker test based on 'objdump',
-  # unless we find 'file', for example because we are cross-compiling.
-  if ( file / ) >/dev/null 2>&1; then
-    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
-    lt_cv_file_magic_cmd='func_win32_libid'
-  else
-    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
-    lt_cv_file_magic_cmd='$OBJDUMP -f'
-  fi
-  ;;
-
-darwin* | rhapsody*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-freebsd* | dragonfly*)
-  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
-    case $host_cpu in
-    i*86 )
-      # Not sure whether the presence of OpenBSD here was a mistake.
-      # Let's accept both of them until this is cleared up.
-      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
-      lt_cv_file_magic_cmd=/usr/bin/file
-      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
-      ;;
-    esac
-  else
-    lt_cv_deplibs_check_method=pass_all
-  fi
-  ;;
-
-gnu*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-hpux10.20* | hpux11*)
-  lt_cv_file_magic_cmd=/usr/bin/file
-  case $host_cpu in
-  ia64*)
-    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
-    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
-    ;;
-  hppa*64*)
-    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
-    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
-    ;;
-  *)
-    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
-    lt_cv_file_magic_test_file=/usr/lib/libc.sl
-    ;;
-  esac
-  ;;
-
-interix[[3-9]]*)
-  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
-  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
-  ;;
-
-irix5* | irix6* | nonstopux*)
-  case $LD in
-  *-32|*"-32 ") libmagic=32-bit;;
-  *-n32|*"-n32 ") libmagic=N32;;
-  *-64|*"-64 ") libmagic=64-bit;;
-  *) libmagic=never-match;;
-  esac
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-# This must be Linux ELF.
-linux* | k*bsd*-gnu)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-netbsd* | netbsdelf*-gnu)
-  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
-    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
-  fi
-  ;;
-
-newos6*)
-  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
-  lt_cv_file_magic_cmd=/usr/bin/file
-  lt_cv_file_magic_test_file=/usr/lib/libnls.so
-  ;;
-
-nto-qnx*)
-  lt_cv_deplibs_check_method=unknown
-  ;;
-
-openbsd*)
-  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
-  else
-    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
-  fi
-  ;;
-
-osf3* | osf4* | osf5*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-rdos*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-solaris*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-sysv4 | sysv4.3*)
-  case $host_vendor in
-  motorola)
-    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
-    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
-    ;;
-  ncr)
-    lt_cv_deplibs_check_method=pass_all
-    ;;
-  sequent)
-    lt_cv_file_magic_cmd='/bin/file'
-    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
-    ;;
-  sni)
-    lt_cv_file_magic_cmd='/bin/file'
-    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
-    lt_cv_file_magic_test_file=/lib/libc.so
-    ;;
-  siemens)
-    lt_cv_deplibs_check_method=pass_all
-    ;;
-  pc)
-    lt_cv_deplibs_check_method=pass_all
-    ;;
-  esac
-  ;;
-
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-esac
-])
-file_magic_cmd=$lt_cv_file_magic_cmd
-deplibs_check_method=$lt_cv_deplibs_check_method
-test -z "$deplibs_check_method" && deplibs_check_method=unknown
-])# AC_DEPLIBS_CHECK_METHOD
-
-
-# AC_PROG_NM
-# ----------
-# find the pathname to a BSD-compatible name lister
-AC_DEFUN([AC_PROG_NM],
-[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM,
-[if test -n "$NM"; then
-  # Let the user override the test.
-  lt_cv_path_NM="$NM"
-else
-  lt_nm_to_check="${ac_tool_prefix}nm"
-  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
-    lt_nm_to_check="$lt_nm_to_check nm"
-  fi
-  for lt_tmp_nm in $lt_nm_to_check; do
-    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
-      IFS="$lt_save_ifs"
-      test -z "$ac_dir" && ac_dir=.
-      tmp_nm="$ac_dir/$lt_tmp_nm"
-      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
-	# Check to see if the nm accepts a BSD-compat flag.
-	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
-	#   nm: unknown option "B" ignored
-	# Tru64's nm complains that /dev/null is an invalid object file
-	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
-	*/dev/null* | *'Invalid file or object type'*)
-	  lt_cv_path_NM="$tmp_nm -B"
-	  break
-	  ;;
-	*)
-	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
-	  */dev/null*)
-	    lt_cv_path_NM="$tmp_nm -p"
-	    break
-	    ;;
-	  *)
-	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
-	    continue # so that we can try to find one that supports BSD flags
-	    ;;
-	  esac
-	  ;;
-	esac
-      fi
-    done
-    IFS="$lt_save_ifs"
-  done
-  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
-fi])
-NM="$lt_cv_path_NM"
-])# AC_PROG_NM
-
-
-# AC_CHECK_LIBM
-# -------------
-# check for math library
-AC_DEFUN([AC_CHECK_LIBM],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-LIBM=
-case $host in
-*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
-  # These system don't have libm, or don't need it
-  ;;
-*-ncr-sysv4.3*)
-  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
-  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
-  ;;
-*)
-  AC_CHECK_LIB(m, cos, LIBM="-lm")
-  ;;
-esac
-])# AC_CHECK_LIBM
-
-
-# AC_LIBLTDL_CONVENIENCE([DIRECTORY])
-# -----------------------------------
-# sets LIBLTDL to the link flags for the libltdl convenience library and
-# LTDLINCL to the include flags for the libltdl header and adds
-# --enable-ltdl-convenience to the configure arguments.  Note that
-# AC_CONFIG_SUBDIRS is not called here.  If DIRECTORY is not provided,
-# it is assumed to be `libltdl'.  LIBLTDL will be prefixed with
-# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/'
-# (note the single quotes!).  If your package is not flat and you're not
-# using automake, define top_builddir and top_srcdir appropriately in
-# the Makefiles.
-AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-  case $enable_ltdl_convenience in
-  no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
-  "") enable_ltdl_convenience=yes
-      ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
-  esac
-  LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
-  LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
-  # For backwards non-gettext consistent compatibility...
-  INCLTDL="$LTDLINCL"
-])# AC_LIBLTDL_CONVENIENCE
-
-
-# AC_LIBLTDL_INSTALLABLE([DIRECTORY])
-# -----------------------------------
-# sets LIBLTDL to the link flags for the libltdl installable library and
-# LTDLINCL to the include flags for the libltdl header and adds
-# --enable-ltdl-install to the configure arguments.  Note that
-# AC_CONFIG_SUBDIRS is not called here.  If DIRECTORY is not provided,
-# and an installed libltdl is not found, it is assumed to be `libltdl'.
-# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with
-# '${top_srcdir}/' (note the single quotes!).  If your package is not
-# flat and you're not using automake, define top_builddir and top_srcdir
-# appropriately in the Makefiles.
-# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
-AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
-[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
-  AC_CHECK_LIB(ltdl, lt_dlinit,
-  [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
-  [if test x"$enable_ltdl_install" = xno; then
-     AC_MSG_WARN([libltdl not installed, but installation disabled])
-   else
-     enable_ltdl_install=yes
-   fi
-  ])
-  if test x"$enable_ltdl_install" = x"yes"; then
-    ac_configure_args="$ac_configure_args --enable-ltdl-install"
-    LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
-    LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
-  else
-    ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
-    LIBLTDL="-lltdl"
-    LTDLINCL=
-  fi
-  # For backwards non-gettext consistent compatibility...
-  INCLTDL="$LTDLINCL"
-])# AC_LIBLTDL_INSTALLABLE
-
-
-# AC_LIBTOOL_CXX
-# --------------
-# enable support for C++ libraries
-AC_DEFUN([AC_LIBTOOL_CXX],
-[AC_REQUIRE([_LT_AC_LANG_CXX])
-])# AC_LIBTOOL_CXX
-
-
-# _LT_AC_LANG_CXX
-# ---------------
-AC_DEFUN([_LT_AC_LANG_CXX],
-[AC_REQUIRE([AC_PROG_CXX])
-AC_REQUIRE([_LT_AC_PROG_CXXCPP])
-_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX])
-])# _LT_AC_LANG_CXX
-
-# _LT_AC_PROG_CXXCPP
-# ------------------
-AC_DEFUN([_LT_AC_PROG_CXXCPP],
-[
-AC_REQUIRE([AC_PROG_CXX])
-if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
-    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
-    (test "X$CXX" != "Xg++"))) ; then
-  AC_PROG_CXXCPP
-fi
-])# _LT_AC_PROG_CXXCPP
-
-# AC_LIBTOOL_F77
-# --------------
-# enable support for Fortran 77 libraries
-AC_DEFUN([AC_LIBTOOL_F77],
-[AC_REQUIRE([_LT_AC_LANG_F77])
-])# AC_LIBTOOL_F77
-
-
-# _LT_AC_LANG_F77
-# ---------------
-AC_DEFUN([_LT_AC_LANG_F77],
-[AC_REQUIRE([AC_PROG_F77])
-_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77])
-])# _LT_AC_LANG_F77
-
-
-# AC_LIBTOOL_GCJ
-# --------------
-# enable support for GCJ libraries
-AC_DEFUN([AC_LIBTOOL_GCJ],
-[AC_REQUIRE([_LT_AC_LANG_GCJ])
-])# AC_LIBTOOL_GCJ
-
-
-# _LT_AC_LANG_GCJ
-# ---------------
-AC_DEFUN([_LT_AC_LANG_GCJ],
-[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
-  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
-    [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
-      [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
-	 [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
-	   [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
-_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ])
-])# _LT_AC_LANG_GCJ
-
-
-# AC_LIBTOOL_RC
-# -------------
-# enable support for Windows resource files
-AC_DEFUN([AC_LIBTOOL_RC],
-[AC_REQUIRE([LT_AC_PROG_RC])
-_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC])
-])# AC_LIBTOOL_RC
-
-
-# AC_LIBTOOL_LANG_C_CONFIG
-# ------------------------
-# Ensure that the configuration vars for the C compiler are
-# suitably defined.  Those variables are subsequently used by
-# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
-AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG])
-AC_DEFUN([_LT_AC_LANG_C_CONFIG],
-[lt_save_CC="$CC"
-AC_LANG_PUSH(C)
-
-# Source file extension for C test sources.
-ac_ext=c
-
-# Object file extension for compiled C test sources.
-objext=o
-_LT_AC_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='int main(){return(0);}'
-
-_LT_AC_SYS_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
-AC_LIBTOOL_PROG_COMPILER_PIC($1)
-AC_LIBTOOL_PROG_CC_C_O($1)
-AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
-AC_LIBTOOL_PROG_LD_SHLIBS($1)
-AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
-AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
-AC_LIBTOOL_SYS_LIB_STRIP
-AC_LIBTOOL_DLOPEN_SELF
-
-# Report which library types will actually be built
-AC_MSG_CHECKING([if libtool supports shared libraries])
-AC_MSG_RESULT([$can_build_shared])
-
-AC_MSG_CHECKING([whether to build shared libraries])
-test "$can_build_shared" = "no" && enable_shared=no
-
-# On AIX, shared libraries and static libraries use the same namespace, and
-# are all built from PIC.
-case $host_os in
-aix3*)
-  test "$enable_shared" = yes && enable_static=no
-  if test -n "$RANLIB"; then
-    archive_cmds="$archive_cmds~\$RANLIB \$lib"
-    postinstall_cmds='$RANLIB $lib'
-  fi
-  ;;
-
-aix[[4-9]]*)
-  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-    test "$enable_shared" = yes && enable_static=no
-  fi
-    ;;
-esac
-AC_MSG_RESULT([$enable_shared])
-
-AC_MSG_CHECKING([whether to build static libraries])
-# Make sure either enable_shared or enable_static is yes.
-test "$enable_shared" = yes || enable_static=yes
-AC_MSG_RESULT([$enable_static])
-
-AC_LIBTOOL_CONFIG($1)
-
-AC_LANG_POP
-CC="$lt_save_CC"
-])# AC_LIBTOOL_LANG_C_CONFIG
-
-
-# AC_LIBTOOL_LANG_CXX_CONFIG
-# --------------------------
-# Ensure that the configuration vars for the C compiler are
-# suitably defined.  Those variables are subsequently used by
-# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
-AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)])
-AC_DEFUN([_LT_AC_LANG_CXX_CONFIG],
-[AC_LANG_PUSH(C++)
-AC_REQUIRE([AC_PROG_CXX])
-AC_REQUIRE([_LT_AC_PROG_CXXCPP])
-
-_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-_LT_AC_TAGVAR(allow_undefined_flag, $1)=
-_LT_AC_TAGVAR(always_export_symbols, $1)=no
-_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
-_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
-_LT_AC_TAGVAR(hardcode_direct, $1)=no
-_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
-_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
-_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
-_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-_LT_AC_TAGVAR(hardcode_automatic, $1)=no
-_LT_AC_TAGVAR(module_cmds, $1)=
-_LT_AC_TAGVAR(module_expsym_cmds, $1)=
-_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
-_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_AC_TAGVAR(no_undefined_flag, $1)=
-_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
-_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-
-# Dependencies to place before and after the object being linked:
-_LT_AC_TAGVAR(predep_objects, $1)=
-_LT_AC_TAGVAR(postdep_objects, $1)=
-_LT_AC_TAGVAR(predeps, $1)=
-_LT_AC_TAGVAR(postdeps, $1)=
-_LT_AC_TAGVAR(compiler_lib_search_path, $1)=
-_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=
-
-# Source file extension for C++ test sources.
-ac_ext=cpp
-
-# Object file extension for compiled C++ test sources.
-objext=o
-_LT_AC_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_AC_SYS_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-# Allow CC to be a program name with arguments.
-lt_save_CC=$CC
-lt_save_LD=$LD
-lt_save_GCC=$GCC
-GCC=$GXX
-lt_save_with_gnu_ld=$with_gnu_ld
-lt_save_path_LD=$lt_cv_path_LD
-if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
-  lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
-else
-  $as_unset lt_cv_prog_gnu_ld
-fi
-if test -n "${lt_cv_path_LDCXX+set}"; then
-  lt_cv_path_LD=$lt_cv_path_LDCXX
-else
-  $as_unset lt_cv_path_LD
-fi
-test -z "${LDCXX+set}" || LD=$LDCXX
-CC=${CXX-"c++"}
-compiler=$CC
-_LT_AC_TAGVAR(compiler, $1)=$CC
-_LT_CC_BASENAME([$compiler])
-
-# We don't want -fno-exception wen compiling C++ code, so set the
-# no_builtin_flag separately
-if test "$GXX" = yes; then
-  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
-else
-  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
-fi
-
-if test "$GXX" = yes; then
-  # Set up default GNU C++ configuration
-
-  AC_PROG_LD
-
-  # Check if GNU C++ uses GNU ld as the underlying linker, since the
-  # archiving commands below assume that GNU ld is being used.
-  if test "$with_gnu_ld" = yes; then
-    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
-    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-
-    # If archive_cmds runs LD, not CC, wlarc should be empty
-    # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
-    #     investigate it a little bit more. (MM)
-    wlarc='${wl}'
-
-    # ancient GNU ld didn't support --whole-archive et. al.
-    if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
-	grep 'no-whole-archive' > /dev/null; then
-      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-    else
-      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
-    fi
-  else
-    with_gnu_ld=no
-    wlarc=
-
-    # A generic and very simple default shared library creation
-    # command for GNU C++ for the case where it uses the native
-    # linker, instead of GNU ld.  If possible, this setting should
-    # overridden to take advantage of the native linker features on
-    # the platform it is being used on.
-    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
-  fi
-
-  # Commands to make compiler produce verbose output that lists
-  # what "hidden" libraries, object files and flags are used when
-  # linking a shared library.
-  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
-
-else
-  GXX=no
-  with_gnu_ld=no
-  wlarc=
-fi
-
-# PORTME: fill in a description of your system's C++ link characteristics
-AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
-_LT_AC_TAGVAR(ld_shlibs, $1)=yes
-case $host_os in
-  aix3*)
-    # FIXME: insert proper C++ library support
-    _LT_AC_TAGVAR(ld_shlibs, $1)=no
-    ;;
-  aix[[4-9]]*)
-    if test "$host_cpu" = ia64; then
-      # On IA64, the linker does run time linking by default, so we don't
-      # have to do anything special.
-      aix_use_runtimelinking=no
-      exp_sym_flag='-Bexport'
-      no_entry_flag=""
-    else
-      aix_use_runtimelinking=no
-
-      # Test if we are trying to use run time linking or normal
-      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
-      # need to do runtime linking.
-      case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
-	for ld_flag in $LDFLAGS; do
-	  case $ld_flag in
-	  *-brtl*)
-	    aix_use_runtimelinking=yes
-	    break
-	    ;;
-	  esac
-	done
-	;;
-      esac
-
-      exp_sym_flag='-bexport'
-      no_entry_flag='-bnoentry'
-    fi
-
-    # When large executables or shared objects are built, AIX ld can
-    # have problems creating the table of contents.  If linking a library
-    # or program results in "error TOC overflow" add -mminimal-toc to
-    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
-    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
-
-    _LT_AC_TAGVAR(archive_cmds, $1)=''
-    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
-    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-
-    if test "$GXX" = yes; then
-      case $host_os in aix4.[[012]]|aix4.[[012]].*)
-      # We only want to do this on AIX 4.2 and lower, the check
-      # below for broken collect2 doesn't work under 4.3+
-	collect2name=`${CC} -print-prog-name=collect2`
-	if test -f "$collect2name" && \
-	   strings "$collect2name" | grep resolve_lib_name >/dev/null
-	then
-	  # We have reworked collect2
-	  :
-	else
-	  # We have old collect2
-	  _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
-	  # It fails to find uninstalled libraries when the uninstalled
-	  # path is not listed in the libpath.  Setting hardcode_minus_L
-	  # to unsupported forces relinking
-	  _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
-	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
-	fi
-	;;
-      esac
-      shared_flag='-shared'
-      if test "$aix_use_runtimelinking" = yes; then
-	shared_flag="$shared_flag "'${wl}-G'
-      fi
-    else
-      # not using gcc
-      if test "$host_cpu" = ia64; then
-	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
-	# chokes on -Wl,-G. The following line is correct:
-	shared_flag='-G'
-      else
-	if test "$aix_use_runtimelinking" = yes; then
-	  shared_flag='${wl}-G'
-	else
-	  shared_flag='${wl}-bM:SRE'
-	fi
-      fi
-    fi
-
-    # It seems that -bexpall does not export symbols beginning with
-    # underscore (_), so it is better to generate a list of symbols to export.
-    _LT_AC_TAGVAR(always_export_symbols, $1)=yes
-    if test "$aix_use_runtimelinking" = yes; then
-      # Warning - without using the other runtime loading flags (-brtl),
-      # -berok will link without error, but may produce a broken library.
-      _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
-      # Determine the default libpath from the value encoded in an empty executable.
-      _LT_AC_SYS_LIBPATH_AIX
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-
-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
-     else
-      if test "$host_cpu" = ia64; then
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
-	_LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
-      else
-	# Determine the default libpath from the value encoded in an empty executable.
-	_LT_AC_SYS_LIBPATH_AIX
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-	# Warning - without using the other run time loading flags,
-	# -berok will link without error, but may produce a broken library.
-	_LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
-	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-	# Exported symbols can be pulled into shared objects from archives
-	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
-	_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
-	# This is similar to how AIX traditionally builds its shared libraries.
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
-      fi
-    fi
-    ;;
-
-  beos*)
-    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
-      # Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
-      # support --undefined.  This deserves some investigation.  FIXME
-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-    else
-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
-    fi
-    ;;
-
-  chorus*)
-    case $cc_basename in
-      *)
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-    esac
-    ;;
-
-  cygwin* | mingw* | pw32*)
-    # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
-    # as there is no search path for DLLs.
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-    _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
-    _LT_AC_TAGVAR(always_export_symbols, $1)=no
-    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-
-    if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-      # If the export-symbols file already is a .def file (1st line
-      # is EXPORTS), use it as is; otherwise, prepend...
-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	cp $export_symbols $output_objdir/$soname.def;
-      else
-	echo EXPORTS > $output_objdir/$soname.def;
-	cat $export_symbols >> $output_objdir/$soname.def;
-      fi~
-      $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-    else
-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
-    fi
-  ;;
-      darwin* | rhapsody*)
-      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-      _LT_AC_TAGVAR(hardcode_direct, $1)=no
-      _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
-      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-      _LT_AC_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
-      if test "$GXX" = yes ; then
-      output_verbose_link_cmd='echo'
-      _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
-      _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
-      _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
-      if test "$lt_cv_apple_cc_single_mod" != "yes"; then
-        _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
-        _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
-      fi
-      else
-      case $cc_basename in
-        xlc*)
-         output_verbose_link_cmd='echo'
-          _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
-          _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
-          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
-          _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-          _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-          ;;
-       *)
-         _LT_AC_TAGVAR(ld_shlibs, $1)=no
-          ;;
-      esac
-      fi
-        ;;
-
-  dgux*)
-    case $cc_basename in
-      ec++*)
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-      ghcx*)
-	# Green Hills C++ Compiler
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-      *)
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-    esac
-    ;;
-  freebsd[[12]]*)
-    # C++ shared libraries reported to be fairly broken before switch to ELF
-    _LT_AC_TAGVAR(ld_shlibs, $1)=no
-    ;;
-  freebsd-elf*)
-    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-    ;;
-  freebsd* | dragonfly*)
-    # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
-    # conventions
-    _LT_AC_TAGVAR(ld_shlibs, $1)=yes
-    ;;
-  gnu*)
-    ;;
-  hpux9*)
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-    _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-    _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
-				# but as the default
-				# location of the library.
-
-    case $cc_basename in
-    CC*)
-      # FIXME: insert proper C++ library support
-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
-      ;;
-    aCC*)
-      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      # Commands to make compiler produce verbose output that lists
-      # what "hidden" libraries, object files and flags are used when
-      # linking a shared library.
-      #
-      # There doesn't appear to be a way to prevent this compiler from
-      # explicitly linking system object files so we need to strip them
-      # from the output so that they don't get included in the library
-      # dependencies.
-      output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
-      ;;
-    *)
-      if test "$GXX" = yes; then
-        _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      else
-        # FIXME: insert proper C++ library support
-        _LT_AC_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-    esac
-    ;;
-  hpux10*|hpux11*)
-    if test $with_gnu_ld = no; then
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
-      case $host_cpu in
-      hppa*64*|ia64*) ;;
-      *)
-	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-        ;;
-      esac
-    fi
-    case $host_cpu in
-    hppa*64*|ia64*)
-      _LT_AC_TAGVAR(hardcode_direct, $1)=no
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-    *)
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
-					      # but as the default
-					      # location of the library.
-      ;;
-    esac
-
-    case $cc_basename in
-      CC*)
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-      aCC*)
-	case $host_cpu in
-	hppa*64*)
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	  ;;
-	ia64*)
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	  ;;
-	*)
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	  ;;
-	esac
-	# Commands to make compiler produce verbose output that lists
-	# what "hidden" libraries, object files and flags are used when
-	# linking a shared library.
-	#
-	# There doesn't appear to be a way to prevent this compiler from
-	# explicitly linking system object files so we need to strip them
-	# from the output so that they don't get included in the library
-	# dependencies.
-	output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
-	;;
-      *)
-	if test "$GXX" = yes; then
-	  if test $with_gnu_ld = no; then
-	    case $host_cpu in
-	    hppa*64*)
-	      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	      ;;
-	    ia64*)
-	      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	      ;;
-	    *)
-	      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	      ;;
-	    esac
-	  fi
-	else
-	  # FIXME: insert proper C++ library support
-	  _LT_AC_TAGVAR(ld_shlibs, $1)=no
-	fi
-	;;
-    esac
-    ;;
-  interix[[3-9]]*)
-    _LT_AC_TAGVAR(hardcode_direct, $1)=no
-    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-    # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
-    # Instead, shared libraries are loaded at an image base (0x10000000 by
-    # default) and relocated if they conflict, which is a slow very memory
-    # consuming and fragmenting process.  To avoid this, we pick a random,
-    # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
-    # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
-    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-    ;;
-  irix5* | irix6*)
-    case $cc_basename in
-      CC*)
-	# SGI C++
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-
-	# Archives containing C++ object files must be created using
-	# "CC -ar", where "CC" is the IRIX C++ compiler.  This is
-	# necessary to make sure instantiated templates are included
-	# in the archive.
-	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
-	;;
-      *)
-	if test "$GXX" = yes; then
-	  if test "$with_gnu_ld" = no; then
-	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	  else
-	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
-	  fi
-	fi
-	_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-	;;
-    esac
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-    ;;
-  linux* | k*bsd*-gnu)
-    case $cc_basename in
-      KCC*)
-	# Kuck and Associates, Inc. (KAI) C++ Compiler
-
-	# KCC will only create a shared library if the output file
-	# ends with ".so" (or ".sl" for HP-UX), so rename the library
-	# to its proper name (with version) after linking.
-	_LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
-	# Commands to make compiler produce verbose output that lists
-	# what "hidden" libraries, object files and flags are used when
-	# linking a shared library.
-	#
-	# There doesn't appear to be a way to prevent this compiler from
-	# explicitly linking system object files so we need to strip them
-	# from the output so that they don't get included in the library
-	# dependencies.
-	output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
-
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir'
-	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-
-	# Archives containing C++ object files must be created using
-	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
-	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
-	;;
-      icpc*)
-	# Intel C++
-	with_gnu_ld=yes
-	# version 8.0 and above of icpc choke on multiply defined symbols
-	# if we add $predep_objects and $postdep_objects, however 7.1 and
-	# earlier do not add the objects themselves.
-	case `$CC -V 2>&1` in
-	*"Version 7."*)
-  	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-  	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-	  ;;
-	*)  # Version 8.0 or newer
-	  tmp_idyn=
-	  case $host_cpu in
-	    ia64*) tmp_idyn=' -i_dynamic';;
-	  esac
-  	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-	  ;;
-	esac
-	_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-	;;
-      pgCC* | pgcpp*)
-        # Portland Group C++ compiler
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
-  	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
-
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
-	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-        ;;
-      cxx*)
-	# Compaq C++
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
-
-	runpath_var=LD_RUN_PATH
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
-	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	# Commands to make compiler produce verbose output that lists
-	# what "hidden" libraries, object files and flags are used when
-	# linking a shared library.
-	#
-	# There doesn't appear to be a way to prevent this compiler from
-	# explicitly linking system object files so we need to strip them
-	# from the output so that they don't get included in the library
-	# dependencies.
-	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
-	;;
-      *)
-	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)
-	  # Sun C++ 5.9
-	  _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
-	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-
-	  # Not sure whether something based on
-	  # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
-	  # would be better.
-	  output_verbose_link_cmd='echo'
-
-	  # Archives containing C++ object files must be created using
-	  # "CC -xar", where "CC" is the Sun C++ compiler.  This is
-	  # necessary to make sure instantiated templates are included
-	  # in the archive.
-	  _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
-	  ;;
-	esac
-	;;
-    esac
-    ;;
-  lynxos*)
-    # FIXME: insert proper C++ library support
-    _LT_AC_TAGVAR(ld_shlibs, $1)=no
-    ;;
-  m88k*)
-    # FIXME: insert proper C++ library support
-    _LT_AC_TAGVAR(ld_shlibs, $1)=no
-    ;;
-  mvs*)
-    case $cc_basename in
-      cxx*)
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-      *)
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-    esac
-    ;;
-  netbsd* | netbsdelf*-gnu)
-    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
-      wlarc=
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-    fi
-    # Workaround some broken pre-1.5 toolchains
-    output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
-    ;;
-  openbsd2*)
-    # C++ shared libraries are fairly broken
-    _LT_AC_TAGVAR(ld_shlibs, $1)=no
-    ;;
-  openbsd*)
-    if test -f /usr/libexec/ld.so; then
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
-	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-      fi
-      output_verbose_link_cmd='echo'
-    else
-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
-    fi
-    ;;
-  osf3*)
-    case $cc_basename in
-      KCC*)
-	# Kuck and Associates, Inc. (KAI) C++ Compiler
-
-	# KCC will only create a shared library if the output file
-	# ends with ".so" (or ".sl" for HP-UX), so rename the library
-	# to its proper name (with version) after linking.
-	_LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
-
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	# Archives containing C++ object files must be created using
-	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
-	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
-
-	;;
-      RCC*)
-	# Rational C++ 2.4.1
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-      cxx*)
-	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	# Commands to make compiler produce verbose output that lists
-	# what "hidden" libraries, object files and flags are used when
-	# linking a shared library.
-	#
-	# There doesn't appear to be a way to prevent this compiler from
-	# explicitly linking system object files so we need to strip them
-	# from the output so that they don't get included in the library
-	# dependencies.
-	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
-	;;
-      *)
-	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
-	  _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-
-	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	  # Commands to make compiler produce verbose output that lists
-	  # what "hidden" libraries, object files and flags are used when
-	  # linking a shared library.
-	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
-
-	else
-	  # FIXME: insert proper C++ library support
-	  _LT_AC_TAGVAR(ld_shlibs, $1)=no
-	fi
-	;;
-    esac
-    ;;
-  osf4* | osf5*)
-    case $cc_basename in
-      KCC*)
-	# Kuck and Associates, Inc. (KAI) C++ Compiler
-
-	# KCC will only create a shared library if the output file
-	# ends with ".so" (or ".sl" for HP-UX), so rename the library
-	# to its proper name (with version) after linking.
-	_LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
-
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	# Archives containing C++ object files must be created using
-	# the KAI C++ compiler.
-	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs'
-	;;
-      RCC*)
-	# Rational C++ 2.4.1
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-      cxx*)
-	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
-	  echo "-hidden">> $lib.exp~
-	  $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  `test -n "$verstring" && echo -set_version	$verstring` -update_registry ${output_objdir}/so_locations -o $lib~
-	  $rm $lib.exp'
-
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
-	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	# Commands to make compiler produce verbose output that lists
-	# what "hidden" libraries, object files and flags are used when
-	# linking a shared library.
-	#
-	# There doesn't appear to be a way to prevent this compiler from
-	# explicitly linking system object files so we need to strip them
-	# from the output so that they don't get included in the library
-	# dependencies.
-	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
-	;;
-      *)
-	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
-	  _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	 _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-
-	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	  # Commands to make compiler produce verbose output that lists
-	  # what "hidden" libraries, object files and flags are used when
-	  # linking a shared library.
-	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
-
-	else
-	  # FIXME: insert proper C++ library support
-	  _LT_AC_TAGVAR(ld_shlibs, $1)=no
-	fi
-	;;
-    esac
-    ;;
-  psos*)
-    # FIXME: insert proper C++ library support
-    _LT_AC_TAGVAR(ld_shlibs, $1)=no
-    ;;
-  sunos4*)
-    case $cc_basename in
-      CC*)
-	# Sun C++ 4.x
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-      lcc*)
-	# Lucid
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-      *)
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-    esac
-    ;;
-  solaris*)
-    case $cc_basename in
-      CC*)
-	# Sun C++ 4.2, 5.x and Centerline C++
-        _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes
-	_LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-	$CC -G${allow_undefined_flag}  ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
-
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-	case $host_os in
-	  solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
-	  *)
-	    # The compiler driver will combine and reorder linker options,
-	    # but understands `-z linker_flag'.
-	    # Supported since Solaris 2.6 (maybe 2.5.1?)
-	    _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
-	    ;;
-	esac
-	_LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-
-	output_verbose_link_cmd='echo'
-
-	# Archives containing C++ object files must be created using
-	# "CC -xar", where "CC" is the Sun C++ compiler.  This is
-	# necessary to make sure instantiated templates are included
-	# in the archive.
-	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
-	;;
-      gcx*)
-	# Green Hills C++ Compiler
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
-
-	# The C++ compiler must be used to create the archive.
-	_LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
-	;;
-      *)
-	# GNU C++ compiler with Solaris linker
-	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
-	  _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
-	  if $CC --version | grep -v '^2\.7' > /dev/null; then
-	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
-	    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-		$CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
-
-	    # Commands to make compiler produce verbose output that lists
-	    # what "hidden" libraries, object files and flags are used when
-	    # linking a shared library.
-	    output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
-	  else
-	    # g++ 2.7 appears to require `-G' NOT `-shared' on this
-	    # platform.
-	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
-	    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-		$CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
-
-	    # Commands to make compiler produce verbose output that lists
-	    # what "hidden" libraries, object files and flags are used when
-	    # linking a shared library.
-	    output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
-	  fi
-
-	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
-	  case $host_os in
-	  solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
-	  *)
-	    _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
-	    ;;
-	  esac
-	fi
-	;;
-    esac
-    ;;
-  sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
-    _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-    runpath_var='LD_RUN_PATH'
-
-    case $cc_basename in
-      CC*)
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	;;
-      *)
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	;;
-    esac
-    ;;
-  sysv5* | sco3.2v5* | sco5v6*)
-    # Note: We can NOT use -z defs as we might desire, because we do not
-    # link with -lc, and that would cause any symbols used from libc to
-    # always be unresolved, which means just about no library would
-    # ever link correctly.  If we're not using GNU ld we use -z text
-    # though, which does catch some bad symbols but isn't as heavy-handed
-    # as -z defs.
-    # For security reasons, it is highly recommended that you always
-    # use absolute paths for naming shared libraries, and exclude the
-    # DT_RUNPATH tag from executables and libraries.  But doing so
-    # requires that you compile everything twice, which is a pain.
-    # So that behaviour is only enabled if SCOABSPATH is set to a
-    # non-empty value in the environment.  Most likely only useful for
-    # creating official distributions of packages.
-    # This is a hack until libtool officially supports absolute path
-    # names for shared libraries.
-    _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-    _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
-    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-    _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
-    _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
-    _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
-    runpath_var='LD_RUN_PATH'
-
-    case $cc_basename in
-      CC*)
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	;;
-      *)
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	;;
-    esac
-    ;;
-  tandem*)
-    case $cc_basename in
-      NCC*)
-	# NonStop-UX NCC 3.20
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-      *)
-	# FIXME: insert proper C++ library support
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	;;
-    esac
-    ;;
-  vxworks*)
-    # FIXME: insert proper C++ library support
-    _LT_AC_TAGVAR(ld_shlibs, $1)=no
-    ;;
-  *)
-    # FIXME: insert proper C++ library support
-    _LT_AC_TAGVAR(ld_shlibs, $1)=no
-    ;;
-esac
-AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
-test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
-
-_LT_AC_TAGVAR(GCC, $1)="$GXX"
-_LT_AC_TAGVAR(LD, $1)="$LD"
-
-AC_LIBTOOL_POSTDEP_PREDEP($1)
-AC_LIBTOOL_PROG_COMPILER_PIC($1)
-AC_LIBTOOL_PROG_CC_C_O($1)
-AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
-AC_LIBTOOL_PROG_LD_SHLIBS($1)
-AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
-AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
-
-AC_LIBTOOL_CONFIG($1)
-
-AC_LANG_POP
-CC=$lt_save_CC
-LDCXX=$LD
-LD=$lt_save_LD
-GCC=$lt_save_GCC
-with_gnu_ldcxx=$with_gnu_ld
-with_gnu_ld=$lt_save_with_gnu_ld
-lt_cv_path_LDCXX=$lt_cv_path_LD
-lt_cv_path_LD=$lt_save_path_LD
-lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
-lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
-])# AC_LIBTOOL_LANG_CXX_CONFIG
-
-# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME])
-# ------------------------------------
-# Figure out "hidden" library dependencies from verbose
-# compiler output when linking a shared library.
-# Parse the compiler output and extract the necessary
-# objects, libraries and library flags.
-AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-dnl we can't use the lt_simple_compile_test_code here,
-dnl because it contains code intended for an executable,
-dnl not a library.  It's possible we should let each
-dnl tag define a new lt_????_link_test_code variable,
-dnl but it's only used here...
-ifelse([$1],[],[cat > conftest.$ac_ext <<EOF
-int a;
-void foo (void) { a = 0; }
-EOF
-],[$1],[CXX],[cat > conftest.$ac_ext <<EOF
-class Foo
-{
-public:
-  Foo (void) { a = 0; }
-private:
-  int a;
-};
-EOF
-],[$1],[F77],[cat > conftest.$ac_ext <<EOF
-      subroutine foo
-      implicit none
-      integer*4 a
-      a=0
-      return
-      end
-EOF
-],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF
-public class foo {
-  private int a;
-  public void bar (void) {
-    a = 0;
-  }
-};
-EOF
-])
-dnl Parse the compiler output and extract the necessary
-dnl objects, libraries and library flags.
-if AC_TRY_EVAL(ac_compile); then
-  # Parse the compiler output and extract the necessary
-  # objects, libraries and library flags.
-
-  # Sentinel used to keep track of whether or not we are before
-  # the conftest object file.
-  pre_test_object_deps_done=no
-
-  # The `*' in the case matches for architectures that use `case' in
-  # $output_verbose_cmd can trigger glob expansion during the loop
-  # eval without this substitution.
-  output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
-
-  for p in `eval $output_verbose_link_cmd`; do
-    case $p in
-
-    -L* | -R* | -l*)
-       # Some compilers place space between "-{L,R}" and the path.
-       # Remove the space.
-       if test $p = "-L" \
-	  || test $p = "-R"; then
-	 prev=$p
-	 continue
-       else
-	 prev=
-       fi
-
-       if test "$pre_test_object_deps_done" = no; then
-	 case $p in
-	 -L* | -R*)
-	   # Internal compiler library paths should come after those
-	   # provided the user.  The postdeps already come after the
-	   # user supplied libs so there is no need to process them.
-	   if test -z "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
-	     _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
-	   else
-	     _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
-	   fi
-	   ;;
-	 # The "-l" case would never come before the object being
-	 # linked, so don't bother handling this case.
-	 esac
-       else
-	 if test -z "$_LT_AC_TAGVAR(postdeps, $1)"; then
-	   _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}"
-	 else
-	   _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${prev}${p}"
-	 fi
-       fi
-       ;;
-
-    *.$objext)
-       # This assumes that the test object file only shows up
-       # once in the compiler output.
-       if test "$p" = "conftest.$objext"; then
-	 pre_test_object_deps_done=yes
-	 continue
-       fi
-
-       if test "$pre_test_object_deps_done" = no; then
-	 if test -z "$_LT_AC_TAGVAR(predep_objects, $1)"; then
-	   _LT_AC_TAGVAR(predep_objects, $1)="$p"
-	 else
-	   _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p"
-	 fi
-       else
-	 if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then
-	   _LT_AC_TAGVAR(postdep_objects, $1)="$p"
-	 else
-	   _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p"
-	 fi
-       fi
-       ;;
-
-    *) ;; # Ignore the rest.
-
-    esac
-  done
-
-  # Clean up.
-  rm -f a.out a.exe
-else
-  echo "libtool.m4: error: problem compiling $1 test program"
-fi
-
-$rm -f confest.$objext
-
-_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=
-if test -n "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
-  _LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_AC_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
-fi
-
-# PORTME: override above test on systems where it is broken
-ifelse([$1],[CXX],
-[case $host_os in
-interix[[3-9]]*)
-  # Interix 3.5 installs completely hosed .la files for C++, so rather than
-  # hack all around it, let's just trust "g++" to DTRT.
-  _LT_AC_TAGVAR(predep_objects,$1)=
-  _LT_AC_TAGVAR(postdep_objects,$1)=
-  _LT_AC_TAGVAR(postdeps,$1)=
-  ;;
-
-linux*)
-  case `$CC -V 2>&1 | sed 5q` in
-  *Sun\ C*)
-    # Sun C++ 5.9
-    #
-    # The more standards-conforming stlport4 library is
-    # incompatible with the Cstd library. Avoid specifying
-    # it if it's in CXXFLAGS. Ignore libCrun as
-    # -library=stlport4 depends on it.
-    case " $CXX $CXXFLAGS " in
-    *" -library=stlport4 "*)
-      solaris_use_stlport4=yes
-      ;;
-    esac
-    if test "$solaris_use_stlport4" != yes; then
-      _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
-    fi
-    ;;
-  esac
-  ;;
-
-solaris*)
-  case $cc_basename in
-  CC*)
-    # The more standards-conforming stlport4 library is
-    # incompatible with the Cstd library. Avoid specifying
-    # it if it's in CXXFLAGS. Ignore libCrun as
-    # -library=stlport4 depends on it.
-    case " $CXX $CXXFLAGS " in
-    *" -library=stlport4 "*)
-      solaris_use_stlport4=yes
-      ;;
-    esac
-
-    # Adding this requires a known-good setup of shared libraries for
-    # Sun compiler versions before 5.6, else PIC objects from an old
-    # archive will be linked into the output, leading to subtle bugs.
-    if test "$solaris_use_stlport4" != yes; then
-      _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
-    fi
-    ;;
-  esac
-  ;;
-esac
-])
-case " $_LT_AC_TAGVAR(postdeps, $1) " in
-*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;;
-esac
-])# AC_LIBTOOL_POSTDEP_PREDEP
-
-# AC_LIBTOOL_LANG_F77_CONFIG
-# --------------------------
-# Ensure that the configuration vars for the C compiler are
-# suitably defined.  Those variables are subsequently used by
-# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
-AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)])
-AC_DEFUN([_LT_AC_LANG_F77_CONFIG],
-[AC_REQUIRE([AC_PROG_F77])
-AC_LANG_PUSH(Fortran 77)
-
-_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-_LT_AC_TAGVAR(allow_undefined_flag, $1)=
-_LT_AC_TAGVAR(always_export_symbols, $1)=no
-_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
-_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
-_LT_AC_TAGVAR(hardcode_direct, $1)=no
-_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
-_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
-_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
-_LT_AC_TAGVAR(hardcode_automatic, $1)=no
-_LT_AC_TAGVAR(module_cmds, $1)=
-_LT_AC_TAGVAR(module_expsym_cmds, $1)=
-_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
-_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_AC_TAGVAR(no_undefined_flag, $1)=
-_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
-_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-
-# Source file extension for f77 test sources.
-ac_ext=f
-
-# Object file extension for compiled f77 test sources.
-objext=o
-_LT_AC_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="\
-      subroutine t
-      return
-      end
-"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code="\
-      program t
-      end
-"
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_AC_SYS_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-# Allow CC to be a program name with arguments.
-lt_save_CC="$CC"
-CC=${F77-"f77"}
-compiler=$CC
-_LT_AC_TAGVAR(compiler, $1)=$CC
-_LT_CC_BASENAME([$compiler])
-
-AC_MSG_CHECKING([if libtool supports shared libraries])
-AC_MSG_RESULT([$can_build_shared])
-
-AC_MSG_CHECKING([whether to build shared libraries])
-test "$can_build_shared" = "no" && enable_shared=no
-
-# On AIX, shared libraries and static libraries use the same namespace, and
-# are all built from PIC.
-case $host_os in
-aix3*)
-  test "$enable_shared" = yes && enable_static=no
-  if test -n "$RANLIB"; then
-    archive_cmds="$archive_cmds~\$RANLIB \$lib"
-    postinstall_cmds='$RANLIB $lib'
-  fi
-  ;;
-aix[[4-9]]*)
-  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-    test "$enable_shared" = yes && enable_static=no
-  fi
-  ;;
-esac
-AC_MSG_RESULT([$enable_shared])
-
-AC_MSG_CHECKING([whether to build static libraries])
-# Make sure either enable_shared or enable_static is yes.
-test "$enable_shared" = yes || enable_static=yes
-AC_MSG_RESULT([$enable_static])
-
-_LT_AC_TAGVAR(GCC, $1)="$G77"
-_LT_AC_TAGVAR(LD, $1)="$LD"
-
-AC_LIBTOOL_PROG_COMPILER_PIC($1)
-AC_LIBTOOL_PROG_CC_C_O($1)
-AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
-AC_LIBTOOL_PROG_LD_SHLIBS($1)
-AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
-AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
-
-AC_LIBTOOL_CONFIG($1)
-
-AC_LANG_POP
-CC="$lt_save_CC"
-])# AC_LIBTOOL_LANG_F77_CONFIG
-
-
-# AC_LIBTOOL_LANG_GCJ_CONFIG
-# --------------------------
-# Ensure that the configuration vars for the C compiler are
-# suitably defined.  Those variables are subsequently used by
-# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
-AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)])
-AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG],
-[AC_LANG_SAVE
-
-# Source file extension for Java test sources.
-ac_ext=java
-
-# Object file extension for compiled Java test sources.
-objext=o
-_LT_AC_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="class foo {}"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_AC_SYS_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-# Allow CC to be a program name with arguments.
-lt_save_CC="$CC"
-CC=${GCJ-"gcj"}
-compiler=$CC
-_LT_AC_TAGVAR(compiler, $1)=$CC
-_LT_CC_BASENAME([$compiler])
-
-# GCJ did not exist at the time GCC didn't implicitly link libc in.
-_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-
-_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-
-AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
-AC_LIBTOOL_PROG_COMPILER_PIC($1)
-AC_LIBTOOL_PROG_CC_C_O($1)
-AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
-AC_LIBTOOL_PROG_LD_SHLIBS($1)
-AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
-AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
-
-AC_LIBTOOL_CONFIG($1)
-
-AC_LANG_RESTORE
-CC="$lt_save_CC"
-])# AC_LIBTOOL_LANG_GCJ_CONFIG
-
-
-# AC_LIBTOOL_LANG_RC_CONFIG
-# -------------------------
-# Ensure that the configuration vars for the Windows resource compiler are
-# suitably defined.  Those variables are subsequently used by
-# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
-AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)])
-AC_DEFUN([_LT_AC_LANG_RC_CONFIG],
-[AC_LANG_SAVE
-
-# Source file extension for RC test sources.
-ac_ext=rc
-
-# Object file extension for compiled RC test sources.
-objext=o
-_LT_AC_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
-
-# Code to be used in simple link tests
-lt_simple_link_test_code="$lt_simple_compile_test_code"
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_AC_SYS_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-# Allow CC to be a program name with arguments.
-lt_save_CC="$CC"
-CC=${RC-"windres"}
-compiler=$CC
-_LT_AC_TAGVAR(compiler, $1)=$CC
-_LT_CC_BASENAME([$compiler])
-_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
-
-AC_LIBTOOL_CONFIG($1)
-
-AC_LANG_RESTORE
-CC="$lt_save_CC"
-])# AC_LIBTOOL_LANG_RC_CONFIG
-
-
-# AC_LIBTOOL_CONFIG([TAGNAME])
-# ----------------------------
-# If TAGNAME is not passed, then create an initial libtool script
-# with a default configuration from the untagged config vars.  Otherwise
-# add code to config.status for appending the configuration named by
-# TAGNAME from the matching tagged config vars.
-AC_DEFUN([AC_LIBTOOL_CONFIG],
-[# The else clause should only fire when bootstrapping the
-# libtool distribution, otherwise you forgot to ship ltmain.sh
-# with your package, and you will get complaints that there are
-# no rules to generate ltmain.sh.
-if test -f "$ltmain"; then
-  # See if we are running on zsh, and set the options which allow our commands through
-  # without removal of \ escapes.
-  if test -n "${ZSH_VERSION+set}" ; then
-    setopt NO_GLOB_SUBST
-  fi
-  # Now quote all the things that may contain metacharacters while being
-  # careful not to overquote the AC_SUBSTed values.  We take copies of the
-  # variables and quote the copies for generation of the libtool script.
-  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
-    SED SHELL STRIP \
-    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
-    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
-    deplibs_check_method reload_flag reload_cmds need_locks \
-    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
-    lt_cv_sys_global_symbol_to_c_name_address \
-    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
-    old_postinstall_cmds old_postuninstall_cmds \
-    _LT_AC_TAGVAR(compiler, $1) \
-    _LT_AC_TAGVAR(CC, $1) \
-    _LT_AC_TAGVAR(LD, $1) \
-    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \
-    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \
-    _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \
-    _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \
-    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \
-    _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \
-    _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \
-    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \
-    _LT_AC_TAGVAR(old_archive_cmds, $1) \
-    _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \
-    _LT_AC_TAGVAR(predep_objects, $1) \
-    _LT_AC_TAGVAR(postdep_objects, $1) \
-    _LT_AC_TAGVAR(predeps, $1) \
-    _LT_AC_TAGVAR(postdeps, $1) \
-    _LT_AC_TAGVAR(compiler_lib_search_path, $1) \
-    _LT_AC_TAGVAR(compiler_lib_search_dirs, $1) \
-    _LT_AC_TAGVAR(archive_cmds, $1) \
-    _LT_AC_TAGVAR(archive_expsym_cmds, $1) \
-    _LT_AC_TAGVAR(postinstall_cmds, $1) \
-    _LT_AC_TAGVAR(postuninstall_cmds, $1) \
-    _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \
-    _LT_AC_TAGVAR(allow_undefined_flag, $1) \
-    _LT_AC_TAGVAR(no_undefined_flag, $1) \
-    _LT_AC_TAGVAR(export_symbols_cmds, $1) \
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \
-    _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \
-    _LT_AC_TAGVAR(hardcode_automatic, $1) \
-    _LT_AC_TAGVAR(module_cmds, $1) \
-    _LT_AC_TAGVAR(module_expsym_cmds, $1) \
-    _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \
-    _LT_AC_TAGVAR(fix_srcfile_path, $1) \
-    _LT_AC_TAGVAR(exclude_expsyms, $1) \
-    _LT_AC_TAGVAR(include_expsyms, $1); do
-
-    case $var in
-    _LT_AC_TAGVAR(old_archive_cmds, $1) | \
-    _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \
-    _LT_AC_TAGVAR(archive_cmds, $1) | \
-    _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \
-    _LT_AC_TAGVAR(module_cmds, $1) | \
-    _LT_AC_TAGVAR(module_expsym_cmds, $1) | \
-    _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \
-    _LT_AC_TAGVAR(export_symbols_cmds, $1) | \
-    extract_expsyms_cmds | reload_cmds | finish_cmds | \
-    postinstall_cmds | postuninstall_cmds | \
-    old_postinstall_cmds | old_postuninstall_cmds | \
-    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
-      # Double-quote double-evaled strings.
-      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
-      ;;
-    *)
-      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
-      ;;
-    esac
-  done
-
-  case $lt_echo in
-  *'\[$]0 --fallback-echo"')
-    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'`
-    ;;
-  esac
-
-ifelse([$1], [],
-  [cfgfile="${ofile}T"
-  trap "$rm \"$cfgfile\"; exit 1" 1 2 15
-  $rm -f "$cfgfile"
-  AC_MSG_NOTICE([creating $ofile])],
-  [cfgfile="$ofile"])
-
-  cat <<__EOF__ >> "$cfgfile"
-ifelse([$1], [],
-[#! $SHELL
-
-# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
-# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
-# NOTE: Changes made to this file will be lost: look at ltmain.sh.
-#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
-# Free Software Foundation, Inc.
-#
-# This file is part of GNU Libtool:
-# Originally by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# 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.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# A sed program that does not truncate output.
-SED=$lt_SED
-
-# Sed that helps us avoid accidentally triggering echo(1) options like -n.
-Xsed="$SED -e 1s/^X//"
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-# The names of the tagged configurations supported by this script.
-available_tags=
-
-# ### BEGIN LIBTOOL CONFIG],
-[# ### BEGIN LIBTOOL TAG CONFIG: $tagname])
-
-# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-
-# Shell to use when invoking shell scripts.
-SHELL=$lt_SHELL
-
-# Whether or not to build shared libraries.
-build_libtool_libs=$enable_shared
-
-# Whether or not to build static libraries.
-build_old_libs=$enable_static
-
-# Whether or not to add -lc for building shared libraries.
-build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)
-
-# Whether or not to disallow shared libs when runtime libs are static
-allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)
-
-# Whether or not to optimize for fast installation.
-fast_install=$enable_fast_install
-
-# The host system.
-host_alias=$host_alias
-host=$host
-host_os=$host_os
-
-# The build system.
-build_alias=$build_alias
-build=$build
-build_os=$build_os
-
-# An echo program that does not interpret backslashes.
-echo=$lt_echo
-
-# The archiver.
-AR=$lt_AR
-AR_FLAGS=$lt_AR_FLAGS
-
-# A C compiler.
-LTCC=$lt_LTCC
-
-# LTCC compiler flags.
-LTCFLAGS=$lt_LTCFLAGS
-
-# A language-specific compiler.
-CC=$lt_[]_LT_AC_TAGVAR(compiler, $1)
-
-# Is the compiler the GNU C compiler?
-with_gcc=$_LT_AC_TAGVAR(GCC, $1)
-
-# An ERE matcher.
-EGREP=$lt_EGREP
-
-# The linker used to build libraries.
-LD=$lt_[]_LT_AC_TAGVAR(LD, $1)
-
-# Whether we need hard or soft links.
-LN_S=$lt_LN_S
-
-# A BSD-compatible nm program.
-NM=$lt_NM
-
-# A symbol stripping program
-STRIP=$lt_STRIP
-
-# Used to examine libraries when file_magic_cmd begins "file"
-MAGIC_CMD=$MAGIC_CMD
-
-# Used on cygwin: DLL creation program.
-DLLTOOL="$DLLTOOL"
-
-# Used on cygwin: object dumper.
-OBJDUMP="$OBJDUMP"
-
-# Used on cygwin: assembler.
-AS="$AS"
-
-# The name of the directory that contains temporary libtool files.
-objdir=$objdir
-
-# How to create reloadable object files.
-reload_flag=$lt_reload_flag
-reload_cmds=$lt_reload_cmds
-
-# How to pass a linker flag through the compiler.
-wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
-
-# Object file suffix (normally "o").
-objext="$ac_objext"
-
-# Old archive suffix (normally "a").
-libext="$libext"
-
-# Shared library suffix (normally ".so").
-shrext_cmds='$shrext_cmds'
-
-# Executable file suffix (normally "").
-exeext="$exeext"
-
-# Additional compiler flags for building library objects.
-pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
-pic_mode=$pic_mode
-
-# What is the maximum length of a command?
-max_cmd_len=$lt_cv_sys_max_cmd_len
-
-# Does compiler simultaneously support -c and -o options?
-compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)
-
-# Must we lock files when doing compilation?
-need_locks=$lt_need_locks
-
-# Do we need the lib prefix for modules?
-need_lib_prefix=$need_lib_prefix
-
-# Do we need a version for libraries?
-need_version=$need_version
-
-# Whether dlopen is supported.
-dlopen_support=$enable_dlopen
-
-# Whether dlopen of programs is supported.
-dlopen_self=$enable_dlopen_self
-
-# Whether dlopen of statically linked programs is supported.
-dlopen_self_static=$enable_dlopen_self_static
-
-# Compiler flag to prevent dynamic linking.
-link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1)
-
-# Compiler flag to turn off builtin functions.
-no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)
-
-# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)
-
-# Compiler flag to generate shared objects directly from archives.
-whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1)
-
-# Compiler flag to generate thread-safe objects.
-thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1)
-
-# Library versioning type.
-version_type=$version_type
-
-# Format of library name prefix.
-libname_spec=$lt_libname_spec
-
-# List of archive names.  First name is the real one, the rest are links.
-# The last name is the one that the linker finds with -lNAME.
-library_names_spec=$lt_library_names_spec
-
-# The coded name of the library, if different from the real name.
-soname_spec=$lt_soname_spec
-
-# Commands used to build and install an old-style archive.
-RANLIB=$lt_RANLIB
-old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1)
-old_postinstall_cmds=$lt_old_postinstall_cmds
-old_postuninstall_cmds=$lt_old_postuninstall_cmds
-
-# Create an old-style archive from a shared archive.
-old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1)
-
-# Create a temporary old-style archive to link instead of a shared archive.
-old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)
-
-# Commands used to build and install a shared archive.
-archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1)
-archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1)
-postinstall_cmds=$lt_postinstall_cmds
-postuninstall_cmds=$lt_postuninstall_cmds
-
-# Commands used to build a loadable module (assumed same as above if empty)
-module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1)
-module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1)
-
-# Commands to strip libraries.
-old_striplib=$lt_old_striplib
-striplib=$lt_striplib
-
-# Dependencies to place before the objects being linked to create a
-# shared library.
-predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1)
-
-# Dependencies to place after the objects being linked to create a
-# shared library.
-postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1)
-
-# Dependencies to place before the objects being linked to create a
-# shared library.
-predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1)
-
-# Dependencies to place after the objects being linked to create a
-# shared library.
-postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1)
-
-# The directories searched by this compiler when creating a shared
-# library
-compiler_lib_search_dirs=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)
-
-# The library search path used internally by the compiler when linking
-# a shared library.
-compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
-
-# Method to check whether dependent libraries are shared objects.
-deplibs_check_method=$lt_deplibs_check_method
-
-# Command to use when deplibs_check_method == file_magic.
-file_magic_cmd=$lt_file_magic_cmd
-
-# Flag that allows shared libraries with undefined symbols to be built.
-allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1)
-
-# Flag that forces no undefined symbols.
-no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1)
-
-# Commands used to finish a libtool library installation in a directory.
-finish_cmds=$lt_finish_cmds
-
-# Same as above, but a single script fragment to be evaled but not shown.
-finish_eval=$lt_finish_eval
-
-# Take the output of nm and produce a listing of raw symbols and C names.
-global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
-
-# Transform the output of nm in a proper C declaration
-global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
-
-# Transform the output of nm in a C name address pair
-global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
-
-# This is the shared library runtime path variable.
-runpath_var=$runpath_var
-
-# This is the shared library path variable.
-shlibpath_var=$shlibpath_var
-
-# Is shlibpath searched before the hard-coded library search path?
-shlibpath_overrides_runpath=$shlibpath_overrides_runpath
-
-# How to hardcode a shared library path into an executable.
-hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1)
-
-# Whether we should hardcode library paths into libraries.
-hardcode_into_libs=$hardcode_into_libs
-
-# Flag to hardcode \$libdir into a binary during linking.
-# This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)
-
-# If ld is used when linking, flag to hardcode \$libdir into
-# a binary during linking. This must work even if \$libdir does
-# not exist.
-hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)
-
-# Whether we need a single -rpath flag with a separated argument.
-hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1)
-
-# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
-# resulting binary.
-hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1)
-
-# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
-# resulting binary.
-hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1)
-
-# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
-# the resulting binary.
-hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)
-
-# Set to yes if building a shared library automatically hardcodes DIR into the library
-# and all subsequent libraries and executables linked against it.
-hardcode_automatic=$_LT_AC_TAGVAR(hardcode_automatic, $1)
-
-# Variables whose values should be saved in libtool wrapper scripts and
-# restored at relink time.
-variables_saved_for_relink="$variables_saved_for_relink"
-
-# Whether libtool must link a program against all its dependency libraries.
-link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1)
-
-# Compile-time system search path for libraries
-sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
-
-# Run-time system search path for libraries
-sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
-
-# Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path=$lt_fix_srcfile_path
-
-# Set to yes if exported symbols are required.
-always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1)
-
-# The commands to list exported symbols.
-export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1)
-
-# The commands to extract the exported symbol list from a shared archive.
-extract_expsyms_cmds=$lt_extract_expsyms_cmds
-
-# Symbols that should not be listed in the preloaded symbols.
-exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1)
-
-# Symbols that must always be exported.
-include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1)
-
-ifelse([$1],[],
-[# ### END LIBTOOL CONFIG],
-[# ### END LIBTOOL TAG CONFIG: $tagname])
-
-__EOF__
-
-ifelse([$1],[], [
-  case $host_os in
-  aix3*)
-    cat <<\EOF >> "$cfgfile"
-
-# AIX sometimes has problems with the GCC collect2 program.  For some
-# reason, if we set the COLLECT_NAMES environment variable, the problems
-# vanish in a puff of smoke.
-if test "X${COLLECT_NAMES+set}" != Xset; then
-  COLLECT_NAMES=
-  export COLLECT_NAMES
-fi
-EOF
-    ;;
-  esac
-
-  # We use sed instead of cat because bash on DJGPP gets confused if
-  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
-  # text mode, it properly converts lines to CR/LF.  This bash problem
-  # is reportedly fixed, but why not run on old versions too?
-  sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
-
-  mv -f "$cfgfile" "$ofile" || \
-    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
-  chmod +x "$ofile"
-])
-else
-  # If there is no Makefile yet, we rely on a make rule to execute
-  # `config.status --recheck' to rerun these tests and create the
-  # libtool script then.
-  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
-  if test -f "$ltmain_in"; then
-    test -f Makefile && make "$ltmain"
-  fi
-fi
-])# AC_LIBTOOL_CONFIG
-
-
-# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME])
-# -------------------------------------------
-AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI],
-[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
-
-_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
-
-if test "$GCC" = yes; then
-  _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
-
-  AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
-    lt_cv_prog_compiler_rtti_exceptions,
-    [-fno-rtti -fno-exceptions], [],
-    [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
-fi
-])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI
-
-
-# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
-# ---------------------------------
-AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
-[AC_REQUIRE([AC_CANONICAL_HOST])
-AC_REQUIRE([LT_AC_PROG_SED])
-AC_REQUIRE([AC_PROG_NM])
-AC_REQUIRE([AC_OBJEXT])
-# Check for command to grab the raw symbol name followed by C symbol from nm.
-AC_MSG_CHECKING([command to parse $NM output from $compiler object])
-AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
-[
-# These are sane defaults that work on at least a few old systems.
-# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
-
-# Character class describing NM global symbol codes.
-symcode='[[BCDEGRST]]'
-
-# Regexp to match symbols that can be accessed directly from C.
-sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
-
-# Transform an extracted symbol line into a proper C declaration
-lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
-
-# Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
-
-# Define system-specific variables.
-case $host_os in
-aix*)
-  symcode='[[BCDT]]'
-  ;;
-cygwin* | mingw* | pw32*)
-  symcode='[[ABCDGISTW]]'
-  ;;
-hpux*) # Its linker distinguishes data from code symbols
-  if test "$host_cpu" = ia64; then
-    symcode='[[ABCDEGRST]]'
-  fi
-  lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
-  lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
-  ;;
-linux* | k*bsd*-gnu)
-  if test "$host_cpu" = ia64; then
-    symcode='[[ABCDGIRSTW]]'
-    lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
-    lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
-  fi
-  ;;
-irix* | nonstopux*)
-  symcode='[[BCDEGRST]]'
-  ;;
-osf*)
-  symcode='[[BCDEGQRST]]'
-  ;;
-solaris*)
-  symcode='[[BDRT]]'
-  ;;
-sco3.2v5*)
-  symcode='[[DT]]'
-  ;;
-sysv4.2uw2*)
-  symcode='[[DT]]'
-  ;;
-sysv5* | sco5v6* | unixware* | OpenUNIX*)
-  symcode='[[ABDT]]'
-  ;;
-sysv4)
-  symcode='[[DFNSTU]]'
-  ;;
-esac
-
-# Handle CRLF in mingw tool chain
-opt_cr=
-case $build_os in
-mingw*)
-  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
-  ;;
-esac
-
-# If we're using GNU nm, then use its standard symbol codes.
-case `$NM -V 2>&1` in
-*GNU* | *'with BFD'*)
-  symcode='[[ABCDGIRSTW]]' ;;
-esac
-
-# Try without a prefix undercore, then with it.
-for ac_symprfx in "" "_"; do
-
-  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
-  symxfrm="\\1 $ac_symprfx\\2 \\2"
-
-  # Write the raw and C identifiers.
-  lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ 	]]\($symcode$symcode*\)[[ 	]][[ 	]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
-
-  # Check to see that the pipe works correctly.
-  pipe_works=no
-
-  rm -f conftest*
-  cat > conftest.$ac_ext <<EOF
-#ifdef __cplusplus
-extern "C" {
-#endif
-char nm_test_var;
-void nm_test_func(){}
-#ifdef __cplusplus
-}
-#endif
-int main(){nm_test_var='a';nm_test_func();return(0);}
-EOF
-
-  if AC_TRY_EVAL(ac_compile); then
-    # Now try to grab the symbols.
-    nlist=conftest.nm
-    if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
-      # Try sorting and uniquifying the output.
-      if sort "$nlist" | uniq > "$nlist"T; then
-	mv -f "$nlist"T "$nlist"
-      else
-	rm -f "$nlist"T
-      fi
-
-      # Make sure that we snagged all the symbols we need.
-      if grep ' nm_test_var$' "$nlist" >/dev/null; then
-	if grep ' nm_test_func$' "$nlist" >/dev/null; then
-	  cat <<EOF > conftest.$ac_ext
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-EOF
-	  # Now generate the symbol file.
-	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
-
-	  cat <<EOF >> conftest.$ac_ext
-#if defined (__STDC__) && __STDC__
-# define lt_ptr_t void *
-#else
-# define lt_ptr_t char *
-# define const
-#endif
-
-/* The mapping between symbol names and symbols. */
-const struct {
-  const char *name;
-  lt_ptr_t address;
-}
-lt_preloaded_symbols[[]] =
-{
-EOF
-	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
-	  cat <<\EOF >> conftest.$ac_ext
-  {0, (lt_ptr_t) 0}
-};
-
-#ifdef __cplusplus
-}
-#endif
-EOF
-	  # Now try linking the two files.
-	  mv conftest.$ac_objext conftstm.$ac_objext
-	  lt_save_LIBS="$LIBS"
-	  lt_save_CFLAGS="$CFLAGS"
-	  LIBS="conftstm.$ac_objext"
-	  CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
-	  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
-	    pipe_works=yes
-	  fi
-	  LIBS="$lt_save_LIBS"
-	  CFLAGS="$lt_save_CFLAGS"
-	else
-	  echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
-	fi
-      else
-	echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
-      fi
-    else
-      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
-    fi
-  else
-    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
-    cat conftest.$ac_ext >&5
-  fi
-  rm -rf conftest* conftst*
-
-  # Do not use the global_symbol_pipe unless it works.
-  if test "$pipe_works" = yes; then
-    break
-  else
-    lt_cv_sys_global_symbol_pipe=
-  fi
-done
-])
-if test -z "$lt_cv_sys_global_symbol_pipe"; then
-  lt_cv_sys_global_symbol_to_cdecl=
-fi
-if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
-  AC_MSG_RESULT(failed)
-else
-  AC_MSG_RESULT(ok)
-fi
-]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
-
-
-# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME])
-# ---------------------------------------
-AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC],
-[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=
-_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
-_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=
-
-AC_MSG_CHECKING([for $compiler option to produce PIC])
- ifelse([$1],[CXX],[
-  # C++ specific cases for pic, static, wl, etc.
-  if test "$GXX" = yes; then
-    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
-
-    case $host_os in
-    aix*)
-      # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      fi
-      ;;
-    amigaos*)
-      # FIXME: we need at least 68020 code to build shared libraries, but
-      # adding the `-m68020' flag to GCC prevents building anything better,
-      # like `-m68040'.
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
-      ;;
-    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
-      # PIC is the default for these OSes.
-      ;;
-    mingw* | cygwin* | os2* | pw32*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      # Although the cygwin gcc ignores -fPIC, still need this for old-style
-      # (--disable-auto-import) libraries
-      m4_if([$1], [GCJ], [],
-	[_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
-      ;;
-    darwin* | rhapsody*)
-      # PIC is the default on this platform
-      # Common symbols not allowed in MH_DYLIB files
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
-      ;;
-    *djgpp*)
-      # DJGPP does not support shared libraries at all
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
-      ;;
-    interix[[3-9]]*)
-      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
-      # Instead, we relocate shared libraries at runtime.
-      ;;
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
-      fi
-      ;;
-    hpux*)
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
-      case $host_cpu in
-      hppa*64*|ia64*)
-	;;
-      *)
-	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	;;
-      esac
-      ;;
-    *)
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-      ;;
-    esac
-  else
-    case $host_os in
-      aix[[4-9]]*)
-	# All AIX code is PIC.
-	if test "$host_cpu" = ia64; then
-	  # AIX 5 now supports IA64 processor
-	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	else
-	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
-	fi
-	;;
-      chorus*)
-	case $cc_basename in
-	cxch68*)
-	  # Green Hills C++ Compiler
-	  # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
-	  ;;
-	esac
-	;;
-       darwin*)
-         # PIC is the default on this platform
-         # Common symbols not allowed in MH_DYLIB files
-         case $cc_basename in
-           xlc*)
-           _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
-           _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-           ;;
-         esac
-       ;;
-      dgux*)
-	case $cc_basename in
-	  ec++*)
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    ;;
-	  ghcx*)
-	    # Green Hills C++ Compiler
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      freebsd* | dragonfly*)
-	# FreeBSD uses GNU C++
-	;;
-      hpux9* | hpux10* | hpux11*)
-	case $cc_basename in
-	  CC*)
-	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
-	    if test "$host_cpu" != ia64; then
-	      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
-	    fi
-	    ;;
-	  aCC*)
-	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
-	    case $host_cpu in
-	    hppa*64*|ia64*)
-	      # +Z the default
-	      ;;
-	    *)
-	      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
-	      ;;
-	    esac
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      interix*)
-	# This is c89, which is MS Visual C++ (no shared libs)
-	# Anyone wants to do a port?
-	;;
-      irix5* | irix6* | nonstopux*)
-	case $cc_basename in
-	  CC*)
-	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-	    # CC pic flag -KPIC is the default.
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      linux* | k*bsd*-gnu)
-	case $cc_basename in
-	  KCC*)
-	    # KAI C++ Compiler
-	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	    ;;
-	  icpc* | ecpc*)
-	    # Intel C++
-	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
-	    ;;
-	  pgCC* | pgcpp*)
-	    # Portland Group C++ compiler.
-	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
-	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	    ;;
-	  cxx*)
-	    # Compaq C++
-	    # Make sure the PIC flag is empty.  It appears that all Alpha
-	    # Linux and Compaq Tru64 Unix objects are PIC.
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
-	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-	    ;;
-	  *)
-	    case `$CC -V 2>&1 | sed 5q` in
-	    *Sun\ C*)
-	      # Sun C++ 5.9
-	      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
-	      ;;
-	    esac
-	    ;;
-	esac
-	;;
-      lynxos*)
-	;;
-      m88k*)
-	;;
-      mvs*)
-	case $cc_basename in
-	  cxx*)
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      netbsd* | netbsdelf*-gnu)
-	;;
-      osf3* | osf4* | osf5*)
-	case $cc_basename in
-	  KCC*)
-	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
-	    ;;
-	  RCC*)
-	    # Rational C++ 2.4.1
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-	    ;;
-	  cxx*)
-	    # Digital/Compaq C++
-	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    # Make sure the PIC flag is empty.  It appears that all Alpha
-	    # Linux and Compaq Tru64 Unix objects are PIC.
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
-	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      psos*)
-	;;
-      solaris*)
-	case $cc_basename in
-	  CC*)
-	    # Sun C++ 4.2, 5.x and Centerline C++
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
-	    ;;
-	  gcx*)
-	    # Green Hills C++ Compiler
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      sunos4*)
-	case $cc_basename in
-	  CC*)
-	    # Sun C++ 4.x
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	    ;;
-	  lcc*)
-	    # Lucid
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      tandem*)
-	case $cc_basename in
-	  NCC*)
-	    # NonStop-UX NCC 3.20
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
-	case $cc_basename in
-	  CC*)
-	    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	    ;;
-	esac
-	;;
-      vxworks*)
-	;;
-      *)
-	_LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
-	;;
-    esac
-  fi
-],
-[
-  if test "$GCC" = yes; then
-    _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-    _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
-
-    case $host_os in
-      aix*)
-      # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      fi
-      ;;
-
-    amigaos*)
-      # FIXME: we need at least 68020 code to build shared libraries, but
-      # adding the `-m68020' flag to GCC prevents building anything better,
-      # like `-m68040'.
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
-      ;;
-
-    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
-      # PIC is the default for these OSes.
-      ;;
-
-    mingw* | cygwin* | pw32* | os2*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      # Although the cygwin gcc ignores -fPIC, still need this for old-style
-      # (--disable-auto-import) libraries
-      m4_if([$1], [GCJ], [],
-	[_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
-      ;;
-
-    darwin* | rhapsody*)
-      # PIC is the default on this platform
-      # Common symbols not allowed in MH_DYLIB files
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
-      ;;
-
-    interix[[3-9]]*)
-      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
-      # Instead, we relocate shared libraries at runtime.
-      ;;
-
-    msdosdjgpp*)
-      # Just because we use GCC doesn't mean we suddenly get shared libraries
-      # on systems that don't support them.
-      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
-      enable_shared=no
-      ;;
-
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
-      fi
-      ;;
-
-    hpux*)
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
-      case $host_cpu in
-      hppa*64*|ia64*)
-	# +Z the default
-	;;
-      *)
-	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-	;;
-      esac
-      ;;
-
-    *)
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
-      ;;
-    esac
-  else
-    # PORTME Check for flag to pass linker flags through the system compiler.
-    case $host_os in
-    aix*)
-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      else
-	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
-      fi
-      ;;
-      darwin*)
-        # PIC is the default on this platform
-        # Common symbols not allowed in MH_DYLIB files
-       case $cc_basename in
-         xlc*)
-         _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
-         _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-         ;;
-       esac
-       ;;
-
-    mingw* | cygwin* | pw32* | os2*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      m4_if([$1], [GCJ], [],
-	[_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
-      ;;
-
-    hpux9* | hpux10* | hpux11*)
-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
-      case $host_cpu in
-      hppa*64*|ia64*)
-	# +Z the default
-	;;
-      *)
-	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
-	;;
-      esac
-      # Is there a better lt_prog_compiler_static that works with the bundled CC?
-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
-      ;;
-
-    irix5* | irix6* | nonstopux*)
-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      # PIC (with -KPIC) is the default.
-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-      ;;
-
-    newsos6)
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    linux* | k*bsd*-gnu)
-      case $cc_basename in
-      icc* | ecc*)
-	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
-        ;;
-      pgcc* | pgf77* | pgf90* | pgf95*)
-        # Portland Group compilers (*not* the Pentium gcc compiler,
-	# which looks to be a dead project)
-	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
-	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-        ;;
-      ccc*)
-        _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-        # All Alpha code is PIC.
-        _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-        ;;
-      *)
-        case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)
-	  # Sun C 5.9
-	  _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-	  ;;
-	*Sun\ F*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
-	  _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-	  _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-	  _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=''
-	  ;;
-	esac
-	;;
-      esac
-      ;;
-
-    osf3* | osf4* | osf5*)
-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      # All OSF/1 code is PIC.
-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-      ;;
-
-    rdos*)
-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
-      ;;
-
-    solaris*)
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      case $cc_basename in
-      f77* | f90* | f95*)
-	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
-      *)
-	_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
-      esac
-      ;;
-
-    sunos4*)
-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    sysv4 | sysv4.2uw2* | sysv4.3*)
-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    sysv4*MP*)
-      if test -d /usr/nec ;then
-	_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
-	_LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      fi
-      ;;
-
-    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    unicos*)
-      _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
-      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
-      ;;
-
-    uts4*)
-      _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
-      _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
-      ;;
-
-    *)
-      _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
-      ;;
-    esac
-  fi
-])
-AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)])
-
-#
-# Check to make sure the PIC flag actually works.
-#
-if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then
-  AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works],
-    _LT_AC_TAGVAR(lt_cv_prog_compiler_pic_works, $1),
-    [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [],
-    [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in
-     "" | " "*) ;;
-     *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;;
-     esac],
-    [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
-     _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
-fi
-case $host_os in
-  # For platforms which do not support PIC, -DPIC is meaningless:
-  *djgpp*)
-    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
-    ;;
-  *)
-    _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])"
-    ;;
-esac
-
-#
-# Check to make sure the static flag actually works.
-#
-wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\"
-AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
-  _LT_AC_TAGVAR(lt_cv_prog_compiler_static_works, $1),
-  $lt_tmp_static_flag,
-  [],
-  [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=])
-])
-
-
-# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME])
-# ------------------------------------
-# See if the linker supports building shared libraries.
-AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
-ifelse([$1],[CXX],[
-  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  case $host_os in
-  aix[[4-9]]*)
-    # If we're using GNU nm, then we don't want the "-C" option.
-    # -C means demangle to AIX nm, but means don't demangle with GNU nm
-    if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
-      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
-    else
-      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
-    fi
-    ;;
-  pw32*)
-    _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
-  ;;
-  cygwin* | mingw*)
-    _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
-  ;;
-  linux* | k*bsd*-gnu)
-    _LT_AC_TAGVAR(link_all_deplibs, $1)=no
-  ;;
-  *)
-    _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  ;;
-  esac
-  _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
-],[
-  runpath_var=
-  _LT_AC_TAGVAR(allow_undefined_flag, $1)=
-  _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-  _LT_AC_TAGVAR(archive_cmds, $1)=
-  _LT_AC_TAGVAR(archive_expsym_cmds, $1)=
-  _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)=
-  _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)=
-  _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
-  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
-  _LT_AC_TAGVAR(thread_safe_flag_spec, $1)=
-  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
-  _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
-  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
-  _LT_AC_TAGVAR(hardcode_direct, $1)=no
-  _LT_AC_TAGVAR(hardcode_minus_L, $1)=no
-  _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-  _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
-  _LT_AC_TAGVAR(hardcode_automatic, $1)=no
-  _LT_AC_TAGVAR(module_cmds, $1)=
-  _LT_AC_TAGVAR(module_expsym_cmds, $1)=
-  _LT_AC_TAGVAR(always_export_symbols, $1)=no
-  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  # include_expsyms should be a list of space-separated symbols to be *always*
-  # included in the symbol list
-  _LT_AC_TAGVAR(include_expsyms, $1)=
-  # exclude_expsyms can be an extended regexp of symbols to exclude
-  # it will be wrapped by ` (' and `)$', so one must not match beginning or
-  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
-  # as well as any symbol that contains `d'.
-  _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
-  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
-  # platforms (ab)use it in PIC code, but their linkers get confused if
-  # the symbol is explicitly referenced.  Since portable code cannot
-  # rely on this symbol name, it's probably fine to never include it in
-  # preloaded symbol tables.
-  # Exclude shared library initialization/finalization symbols.
-dnl Note also adjust exclude_expsyms for C++ above.
-  extract_expsyms_cmds=
-  # Just being paranoid about ensuring that cc_basename is set.
-  _LT_CC_BASENAME([$compiler])
-  case $host_os in
-  cygwin* | mingw* | pw32*)
-    # FIXME: the MSVC++ port hasn't been tested in a loooong time
-    # When not using gcc, we currently assume that we are using
-    # Microsoft Visual C++.
-    if test "$GCC" != yes; then
-      with_gnu_ld=no
-    fi
-    ;;
-  interix*)
-    # we just hope/assume this is gcc and not c89 (= MSVC++)
-    with_gnu_ld=yes
-    ;;
-  openbsd*)
-    with_gnu_ld=no
-    ;;
-  esac
-
-  _LT_AC_TAGVAR(ld_shlibs, $1)=yes
-  if test "$with_gnu_ld" = yes; then
-    # If archive_cmds runs LD, not CC, wlarc should be empty
-    wlarc='${wl}'
-
-    # Set some defaults for GNU ld with shared library support. These
-    # are reset later if shared libraries are not supported. Putting them
-    # here allows them to be overridden if necessary.
-    runpath_var=LD_RUN_PATH
-    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
-    _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-    # ancient GNU ld didn't support --whole-archive et. al.
-    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
-	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-      else
-  	_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
-    fi
-    supports_anon_versioning=no
-    case `$LD -v 2>/dev/null` in
-      *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
-      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
-      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
-      *\ 2.11.*) ;; # other 2.11 versions
-      *) supports_anon_versioning=yes ;;
-    esac
-
-    # See if GNU ld supports shared libraries.
-    case $host_os in
-    aix[[3-9]]*)
-      # On AIX/PPC, the GNU linker is very broken
-      if test "$host_cpu" != ia64; then
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	cat <<EOF 1>&2
-
-*** Warning: the GNU linker, at least up to release 2.9.1, is reported
-*** to be unable to reliably create shared libraries on AIX.
-*** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to modify your PATH
-*** so that a non-GNU linker is found, and then restart.
-
-EOF
-      fi
-      ;;
-
-    amigaos*)
-      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
-
-      # Samuel A. Falvo II <kc5tja at dolphin.openprojects.net> reports
-      # that the semantics of dynamic libraries on AmigaOS, at least up
-      # to version 4, is to share data among multiple programs linked
-      # with the same dynamic library.  Since this doesn't match the
-      # behavior of shared libraries on other platforms, we can't use
-      # them.
-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
-      ;;
-
-    beos*)
-      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-	_LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
-	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
-	# support --undefined.  This deserves some investigation.  FIXME
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-      else
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    cygwin* | mingw* | pw32*)
-      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
-      # as there is no search path for DLLs.
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
-      _LT_AC_TAGVAR(always_export_symbols, $1)=no
-      _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-      _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
-
-      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
-        _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	# If the export-symbols file already is a .def file (1st line
-	# is EXPORTS), use it as is; otherwise, prepend...
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	  cp $export_symbols $output_objdir/$soname.def;
-	else
-	  echo EXPORTS > $output_objdir/$soname.def;
-	  cat $export_symbols >> $output_objdir/$soname.def;
-	fi~
-	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-      else
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    interix[[3-9]]*)
-      _LT_AC_TAGVAR(hardcode_direct, $1)=no
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
-      # Instead, shared libraries are loaded at an image base (0x10000000 by
-      # default) and relocated if they conflict, which is a slow very memory
-      # consuming and fragmenting process.  To avoid this, we pick a random,
-      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
-      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      ;;
-
-    gnu* | linux* | k*bsd*-gnu)
-      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-	tmp_addflag=
-	case $cc_basename,$host_cpu in
-	pgcc*)				# Portland Group C compiler
-	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_addflag=' $pic_flag'
-	  ;;
-	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
-	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_addflag=' $pic_flag -Mnomain' ;;
-	ecc*,ia64* | icc*,ia64*)		# Intel C compiler on ia64
-	  tmp_addflag=' -i_dynamic' ;;
-	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
-	  tmp_addflag=' -i_dynamic -nofor_main' ;;
-	ifc* | ifort*)			# Intel Fortran compiler
-	  tmp_addflag=' -nofor_main' ;;
-	esac
-	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)			# Sun C 5.9
-	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_sharedflag='-G' ;;
-	*Sun\ F*)			# Sun Fortran 8.3
-	  tmp_sharedflag='-G' ;;
-	*)
-	  tmp_sharedflag='-shared' ;;
-	esac
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-
-	if test $supports_anon_versioning = yes; then
-	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $output_objdir/$libname.ver~
-  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-  $echo "local: *; };" >> $output_objdir/$libname.ver~
-	  $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
-	fi
-	_LT_AC_TAGVAR(link_all_deplibs, $1)=no
-      else
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    netbsd* | netbsdelf*-gnu)
-      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
-	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
-	wlarc=
-      else
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      fi
-      ;;
-
-    solaris*)
-      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	cat <<EOF 1>&2
-
-*** Warning: The releases 2.8.* of the GNU linker cannot reliably
-*** create shared libraries on Solaris systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.9.1 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
-
-EOF
-      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      else
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
-      case `$LD -v 2>&1` in
-        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-	cat <<_LT_EOF 1>&2
-
-*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
-*** reliably create shared libraries on SCO systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
-
-_LT_EOF
-	;;
-	*)
-	  if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-	    _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
-	    _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
-	    _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
-	  else
-	    _LT_AC_TAGVAR(ld_shlibs, $1)=no
-	  fi
-	;;
-      esac
-      ;;
-
-    sunos4*)
-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      wlarc=
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    *)
-      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      else
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-    esac
-
-    if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then
-      runpath_var=
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
-      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
-    fi
-  else
-    # PORTME fill in a description of your system's linker (not GNU ld)
-    case $host_os in
-    aix3*)
-      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
-      _LT_AC_TAGVAR(always_export_symbols, $1)=yes
-      _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
-      # Note: this linker hardcodes the directories in LIBPATH if there
-      # are no directories specified by -L.
-      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
-      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
-	# Neither direct hardcoding nor static linking is supported with a
-	# broken collect2.
-	_LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
-      fi
-      ;;
-
-    aix[[4-9]]*)
-      if test "$host_cpu" = ia64; then
-	# On IA64, the linker does run time linking by default, so we don't
-	# have to do anything special.
-	aix_use_runtimelinking=no
-	exp_sym_flag='-Bexport'
-	no_entry_flag=""
-      else
-	# If we're using GNU nm, then we don't want the "-C" option.
-	# -C means demangle to AIX nm, but means don't demangle with GNU nm
-	if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
-	  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
-	else
-	  _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
-	fi
-	aix_use_runtimelinking=no
-
-	# Test if we are trying to use run time linking or normal
-	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
-	# need to do runtime linking.
-	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
-	  for ld_flag in $LDFLAGS; do
-  	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
-  	    aix_use_runtimelinking=yes
-  	    break
-  	  fi
-	  done
-	  ;;
-	esac
-
-	exp_sym_flag='-bexport'
-	no_entry_flag='-bnoentry'
-      fi
-
-      # When large executables or shared objects are built, AIX ld can
-      # have problems creating the table of contents.  If linking a library
-      # or program results in "error TOC overflow" add -mminimal-toc to
-      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
-      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
-
-      _LT_AC_TAGVAR(archive_cmds, $1)=''
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
-      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-
-      if test "$GCC" = yes; then
-	case $host_os in aix4.[[012]]|aix4.[[012]].*)
-	# We only want to do this on AIX 4.2 and lower, the check
-	# below for broken collect2 doesn't work under 4.3+
-	  collect2name=`${CC} -print-prog-name=collect2`
-	  if test -f "$collect2name" && \
-  	   strings "$collect2name" | grep resolve_lib_name >/dev/null
-	  then
-  	  # We have reworked collect2
-  	  :
-	  else
-  	  # We have old collect2
-  	  _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
-  	  # It fails to find uninstalled libraries when the uninstalled
-  	  # path is not listed in the libpath.  Setting hardcode_minus_L
-  	  # to unsupported forces relinking
-  	  _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
-  	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-  	  _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
-	  fi
-	  ;;
-	esac
-	shared_flag='-shared'
-	if test "$aix_use_runtimelinking" = yes; then
-	  shared_flag="$shared_flag "'${wl}-G'
-	fi
-      else
-	# not using gcc
-	if test "$host_cpu" = ia64; then
-  	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
-  	# chokes on -Wl,-G. The following line is correct:
-	  shared_flag='-G'
-	else
-	  if test "$aix_use_runtimelinking" = yes; then
-	    shared_flag='${wl}-G'
-	  else
-	    shared_flag='${wl}-bM:SRE'
-	  fi
-	fi
-      fi
-
-      # It seems that -bexpall does not export symbols beginning with
-      # underscore (_), so it is better to generate a list of symbols to export.
-      _LT_AC_TAGVAR(always_export_symbols, $1)=yes
-      if test "$aix_use_runtimelinking" = yes; then
-	# Warning - without using the other runtime loading flags (-brtl),
-	# -berok will link without error, but may produce a broken library.
-	_LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
-       # Determine the default libpath from the value encoded in an empty executable.
-       _LT_AC_SYS_LIBPATH_AIX
-       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
-       else
-	if test "$host_cpu" = ia64; then
-	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
-	  _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
-	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
-	else
-	 # Determine the default libpath from the value encoded in an empty executable.
-	 _LT_AC_SYS_LIBPATH_AIX
-	 _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-	  # Warning - without using the other run time loading flags,
-	  # -berok will link without error, but may produce a broken library.
-	  _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
-	  _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
-	  # Exported symbols can be pulled into shared objects from archives
-	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
-	  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
-	  # This is similar to how AIX traditionally builds its shared libraries.
-	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
-	fi
-      fi
-      ;;
-
-    amigaos*)
-      _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
-      # see comment about different semantics on the GNU ld section
-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
-      ;;
-
-    bsdi[[45]]*)
-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
-      ;;
-
-    cygwin* | mingw* | pw32*)
-      # When not using gcc, we currently assume that we are using
-      # Microsoft Visual C++.
-      # hardcode_libdir_flag_spec is actually meaningless, as there is
-      # no search path for DLLs.
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
-      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
-      # Tell ltmain to make .lib files, not .a files.
-      libext=lib
-      # Tell ltmain to make .dll files, not .so files.
-      shrext_cmds=".dll"
-      # FIXME: Setting linknames here is a bad hack.
-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
-      # The linker will automatically build a .lib file if we build a DLL.
-      _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true'
-      # FIXME: Should let the user specify the lib program.
-      _LT_AC_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
-      _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
-      _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-      ;;
-
-    darwin* | rhapsody*)
-      case $host_os in
-        rhapsody* | darwin1.[[012]])
-         _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
-         ;;
-       *) # Darwin 1.3 on
-         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
-           _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
-         else
-           case ${MACOSX_DEPLOYMENT_TARGET} in
-             10.[[012]])
-               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
-               ;;
-             10.*)
-               _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
-               ;;
-           esac
-         fi
-         ;;
-      esac
-      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-      _LT_AC_TAGVAR(hardcode_direct, $1)=no
-      _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-      _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
-      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-    if test "$GCC" = yes ; then
-    	output_verbose_link_cmd='echo'
-        _LT_AC_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
-        _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-        _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
-        _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
-    else
-      case $cc_basename in
-        xlc*)
-         output_verbose_link_cmd='echo'
-         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
-         _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
-          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
-         _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-          _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-          ;;
-       *)
-         _LT_AC_TAGVAR(ld_shlibs, $1)=no
-          ;;
-      esac
-    fi
-      ;;
-
-    dgux*)
-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    freebsd1*)
-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
-      ;;
-
-    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
-    # support.  Future versions do this automatically, but an explicit c++rt0.o
-    # does not break anything, and helps significantly (at the cost of a little
-    # extra space).
-    freebsd2.2*)
-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2*)
-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd* | dragonfly*)
-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    hpux9*)
-      if test "$GCC" = yes; then
-	_LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      else
-	_LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      fi
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-
-      # hardcode_minus_L: Not really in the search PATH,
-      # but as the default location of the library.
-      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-      ;;
-
-    hpux10*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
-      fi
-      if test "$with_gnu_ld" = no; then
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	_LT_AC_TAGVAR(hardcode_direct, $1)=yes
-	_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-
-	# hardcode_minus_L: Not really in the search PATH,
-	# but as the default location of the library.
-	_LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
-      fi
-      ;;
-
-    hpux11*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	case $host_cpu in
-	hppa*64*)
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	ia64*)
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	esac
-      else
-	case $host_cpu in
-	hppa*64*)
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	ia64*)
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	esac
-      fi
-      if test "$with_gnu_ld" = no; then
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
-	_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
-	case $host_cpu in
-	hppa*64*|ia64*)
-	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
-	  _LT_AC_TAGVAR(hardcode_direct, $1)=no
-	  _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-	  ;;
-	*)
-	  _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-	  _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-
-	  # hardcode_minus_L: Not really in the search PATH,
-	  # but as the default location of the library.
-	  _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
-	  ;;
-	esac
-      fi
-      ;;
-
-    irix5* | irix6* | nonstopux*)
-      if test "$GCC" = yes; then
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-      else
-	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
-      fi
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-      ;;
-
-    netbsd* | netbsdelf*-gnu)
-      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
-	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
-      else
-	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
-      fi
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    newsos6)
-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    openbsd*)
-      if test -f /usr/libexec/ld.so; then
-	_LT_AC_TAGVAR(hardcode_direct, $1)=yes
-	_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-	if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	  _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
-	  _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	  _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
-	else
-	  case $host_os in
-	   openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
-	     _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-	     _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-	     ;;
-	   *)
-	     _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	     _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
-	     ;;
-	  esac
-        fi
-      else
-	_LT_AC_TAGVAR(ld_shlibs, $1)=no
-      fi
-      ;;
-
-    os2*)
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
-      _LT_AC_TAGVAR(archive_cmds, $1)='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
-      _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
-      ;;
-
-    osf3*)
-      if test "$GCC" = yes; then
-	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-      else
-	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-      fi
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-      ;;
-
-    osf4* | osf5*)	# as osf3* with the addition of -msym flag
-      if test "$GCC" = yes; then
-	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
-      else
-	_LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
-	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
-	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
-
-	# Both c and cxx compiler support -rpath directly
-	_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
-      fi
-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-      ;;
-
-    solaris*)
-      _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text'
-      if test "$GCC" = yes; then
-	wlarc='${wl}'
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-	  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
-      else
-	wlarc=''
-	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-  	$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
-      fi
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      case $host_os in
-      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
-      *)
-	# The compiler driver will combine and reorder linker options,
-	# but understands `-z linker_flag'.  GCC discards it without `$wl',
-	# but is careful enough not to reorder.
- 	# Supported since Solaris 2.6 (maybe 2.5.1?)
-	if test "$GCC" = yes; then
-	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
-	else
-	  _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
-	fi
-	;;
-      esac
-      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-      ;;
-
-    sunos4*)
-      if test "x$host_vendor" = xsequent; then
-	# Use $CC to link under sequent, because it throws in some extra .o
-	# files that make .init and .fini sections work.
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
-      fi
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_AC_TAGVAR(hardcode_direct, $1)=yes
-      _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    sysv4)
-      case $host_vendor in
-	sni)
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true???
-	;;
-	siemens)
-	  ## LD is ld it makes a PLAMLIB
-	  ## CC just makes a GrossModule.
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
-	  _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
-	  _LT_AC_TAGVAR(hardcode_direct, $1)=no
-        ;;
-	motorola)
-	  _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
-	;;
-      esac
-      runpath_var='LD_RUN_PATH'
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    sysv4.3*)
-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
-      ;;
-
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	_LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-	runpath_var=LD_RUN_PATH
-	hardcode_runpath_var=yes
-	_LT_AC_TAGVAR(ld_shlibs, $1)=yes
-      fi
-      ;;
-
-    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
-      _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      runpath_var='LD_RUN_PATH'
-
-      if test "$GCC" = yes; then
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      fi
-      ;;
-
-    sysv5* | sco3.2v5* | sco5v6*)
-      # Note: We can NOT use -z defs as we might desire, because we do not
-      # link with -lc, and that would cause any symbols used from libc to
-      # always be unresolved, which means just about no library would
-      # ever link correctly.  If we're not using GNU ld we use -z text
-      # though, which does catch some bad symbols but isn't as heavy-handed
-      # as -z defs.
-      _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
-      _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
-      _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
-      _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
-      _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
-      _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
-      runpath_var='LD_RUN_PATH'
-
-      if test "$GCC" = yes; then
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	_LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	_LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-      fi
-      ;;
-
-    uts4*)
-      _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
-      _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
-      ;;
-
-    *)
-      _LT_AC_TAGVAR(ld_shlibs, $1)=no
-      ;;
-    esac
-  fi
-])
-AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
-test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
-
-#
-# Do we need to explicitly link libc?
-#
-case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in
-x|xyes)
-  # Assume -lc should be added
-  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
-
-  if test "$enable_shared" = yes && test "$GCC" = yes; then
-    case $_LT_AC_TAGVAR(archive_cmds, $1) in
-    *'~'*)
-      # FIXME: we may have to deal with multi-command sequences.
-      ;;
-    '$CC '*)
-      # Test whether the compiler implicitly links with -lc since on some
-      # systems, -lgcc has to come before -lc. If gcc already passes -lc
-      # to ld, don't add -lc before -lgcc.
-      AC_MSG_CHECKING([whether -lc should be explicitly linked in])
-      $rm conftest*
-      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
-      if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
-        soname=conftest
-        lib=conftest
-        libobjs=conftest.$ac_objext
-        deplibs=
-        wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
-	pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
-        compiler_flags=-v
-        linker_flags=-v
-        verstring=
-        output_objdir=.
-        libname=conftest
-        lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1)
-        _LT_AC_TAGVAR(allow_undefined_flag, $1)=
-        if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1)
-        then
-	  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
-        else
-	  _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
-        fi
-        _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
-      else
-        cat conftest.err 1>&5
-      fi
-      $rm conftest*
-      AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)])
-      ;;
-    esac
-  fi
-  ;;
-esac
-])# AC_LIBTOOL_PROG_LD_SHLIBS
-
-
-# _LT_AC_FILE_LTDLL_C
-# -------------------
-# Be careful that the start marker always follows a newline.
-AC_DEFUN([_LT_AC_FILE_LTDLL_C], [
-# /* ltdll.c starts here */
-# #define WIN32_LEAN_AND_MEAN
-# #include <windows.h>
-# #undef WIN32_LEAN_AND_MEAN
-# #include <stdio.h>
-#
-# #ifndef __CYGWIN__
-# #  ifdef __CYGWIN32__
-# #    define __CYGWIN__ __CYGWIN32__
-# #  endif
-# #endif
-#
-# #ifdef __cplusplus
-# extern "C" {
-# #endif
-# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
-# #ifdef __cplusplus
-# }
-# #endif
-#
-# #ifdef __CYGWIN__
-# #include <cygwin/cygwin_dll.h>
-# DECLARE_CYGWIN_DLL( DllMain );
-# #endif
-# HINSTANCE __hDllInstance_base;
-#
-# BOOL APIENTRY
-# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
-# {
-#   __hDllInstance_base = hInst;
-#   return TRUE;
-# }
-# /* ltdll.c ends here */
-])# _LT_AC_FILE_LTDLL_C
-
-
-# _LT_AC_TAGVAR(VARNAME, [TAGNAME])
-# ---------------------------------
-AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])])
-
-
-# old names
-AC_DEFUN([AM_PROG_LIBTOOL],   [AC_PROG_LIBTOOL])
-AC_DEFUN([AM_ENABLE_SHARED],  [AC_ENABLE_SHARED($@)])
-AC_DEFUN([AM_ENABLE_STATIC],  [AC_ENABLE_STATIC($@)])
-AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
-AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
-AC_DEFUN([AM_PROG_LD],        [AC_PROG_LD])
-AC_DEFUN([AM_PROG_NM],        [AC_PROG_NM])
-
-# This is just to silence aclocal about the macro not being used
-ifelse([AC_DISABLE_FAST_INSTALL])
-
-AC_DEFUN([LT_AC_PROG_GCJ],
-[AC_CHECK_TOOL(GCJ, gcj, no)
-  test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
-  AC_SUBST(GCJFLAGS)
-])
-
-AC_DEFUN([LT_AC_PROG_RC],
-[AC_CHECK_TOOL(RC, windres, no)
-])
-
-
-# Cheap backport of AS_EXECUTABLE_P and required macros
-# from Autoconf 2.59; we should not use $as_executable_p directly.
-
-# _AS_TEST_PREPARE
-# ----------------
-m4_ifndef([_AS_TEST_PREPARE],
-[m4_defun([_AS_TEST_PREPARE],
-[if test -x / >/dev/null 2>&1; then
-  as_executable_p='test -x'
-else
-  as_executable_p='test -f'
-fi
-])])# _AS_TEST_PREPARE
-
-# AS_EXECUTABLE_P
-# ---------------
-# Check whether a file is executable.
-m4_ifndef([AS_EXECUTABLE_P],
-[m4_defun([AS_EXECUTABLE_P],
-[AS_REQUIRE([_AS_TEST_PREPARE])dnl
-$as_executable_p $1[]dnl
-])])# AS_EXECUTABLE_P
-
-# NOTE: This macro has been submitted for inclusion into   #
-#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
-#  a released version of Autoconf we should remove this    #
-#  macro and use it instead.                               #
-# LT_AC_PROG_SED
-# --------------
-# Check for a fully-functional sed program, that truncates
-# as few characters as possible.  Prefer GNU sed if found.
-AC_DEFUN([LT_AC_PROG_SED],
-[AC_MSG_CHECKING([for a sed that does not truncate output])
-AC_CACHE_VAL(lt_cv_path_SED,
-[# Loop through the user's path and test for sed and gsed.
-# Then use that list of sed's as ones to test for truncation.
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for lt_ac_prog in sed gsed; do
-    for ac_exec_ext in '' $ac_executable_extensions; do
-      if AS_EXECUTABLE_P(["$as_dir/$lt_ac_prog$ac_exec_ext"]); then
-        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
-      fi
-    done
-  done
-done
-IFS=$as_save_IFS
-lt_ac_max=0
-lt_ac_count=0
-# Add /usr/xpg4/bin/sed as it is typically found on Solaris
-# along with /bin/sed that truncates output.
-for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
-  test ! -f $lt_ac_sed && continue
-  cat /dev/null > conftest.in
-  lt_ac_count=0
-  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
-  # Check for GNU sed and select it if it is found.
-  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
-    lt_cv_path_SED=$lt_ac_sed
-    break
-  fi
-  while true; do
-    cat conftest.in conftest.in >conftest.tmp
-    mv conftest.tmp conftest.in
-    cp conftest.in conftest.nl
-    echo >>conftest.nl
-    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
-    cmp -s conftest.out conftest.nl || break
-    # 10000 chars as input seems more than enough
-    test $lt_ac_count -gt 10 && break
-    lt_ac_count=`expr $lt_ac_count + 1`
-    if test $lt_ac_count -gt $lt_ac_max; then
-      lt_ac_max=$lt_ac_count
-      lt_cv_path_SED=$lt_ac_sed
-    fi
-  done
-done
-])
-SED=$lt_cv_path_SED
-AC_SUBST([SED])
-AC_MSG_RESULT([$SED])
-])
-
-# Copyright (C) 2002, 2003, 2005, 2006, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -6686,7 +34,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
 [am__api_version='1.10'
 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.1], [],
+m4_if([$1], [1.10.3], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -6700,12 +48,12 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # AM_SET_CURRENT_AUTOMAKE_VERSION
 # -------------------------------
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
-# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.10.1])dnl
+[AM_AUTOMAKE_VERSION([1.10.3])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)])
+_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
 
 # AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
 
@@ -6795,14 +143,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
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
 # 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 9
+# serial 10
 
 # 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,
@@ -6859,6 +207,16 @@ AC_CACHE_CHECK([dependency style of $depcc],
   if test "$am_compiler_list" = ""; then
      am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
   fi
+  am__universal=false
+  m4_case([$1], [CC],
+    [case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac],
+    [CXX],
+    [case " $depcc " in #(
+     *\ -arch\ *\ -arch\ *) am__universal=true ;;
+     esac])
+
   for depmode in $am_compiler_list; do
     # Setup a source with many dependencies, because some compilers
     # like to wrap large dependency lists on column 80 (with \), and
@@ -6876,7 +234,17 @@ AC_CACHE_CHECK([dependency style of $depcc],
     done
     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
 
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.  Also, some Intel
+    # versions had trouble with output in subdirs
+    am__obj=sub/conftest.${OBJEXT-o}
+    am__minus_obj="-o $am__obj"
     case $depmode in
+    gcc)
+      # This depmode causes a compiler race in universal mode.
+      test "$am__universal" = false || continue
+      ;;
     nosideeffect)
       # after this tag, mechanisms are not by side-effect, so they'll
       # only be used when explicitly requested
@@ -6886,19 +254,23 @@ AC_CACHE_CHECK([dependency style of $depcc],
 	break
       fi
       ;;
+    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.
+      am__obj=conftest.${OBJEXT-o}
+      am__minus_obj=
+      ;;
     none) break ;;
     esac
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
-    # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.
     if depmode=$depmode \
-       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       source=sub/conftest.c object=$am__obj \
        depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
-       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+       $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
          >/dev/null 2>conftest.err &&
        grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
        grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
-       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
       # icc doesn't choke on unknown options, it will just issue warnings
       # or remarks (even with -Werror).  So we grep stderr for any message
@@ -6955,57 +327,68 @@ _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
 
 # Generate code to set up dependency tracking.              -*- Autoconf -*-
 
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Copyright (C) 1999, 2000, 2001, 2002, 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 3
+#serial 5
 
 # _AM_OUTPUT_DEPENDENCY_COMMANDS
 # ------------------------------
 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
-[for mf in $CONFIG_FILES; do
-  # Strip MF so we end up with the name of the file.
-  mf=`echo "$mf" | sed -e 's/:.*$//'`
-  # Check whether this is an Automake generated Makefile or not.
-  # We used to match only the files named `Makefile.in', but
-  # some people rename them; so instead we look at the file content.
-  # Grep'ing the first line is not enough: some people post-process
-  # each Makefile.in and add a new line on top of each file to say so.
-  # Grep'ing the whole file is not good either: AIX grep has a line
-  # limit of 2048, but all sed's we know have understand at least 4000.
-  if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
-    dirpart=`AS_DIRNAME("$mf")`
-  else
-    continue
-  fi
-  # Extract the definition of DEPDIR, am__include, and am__quote
-  # from the Makefile without running `make'.
-  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
-  test -z "$DEPDIR" && continue
-  am__include=`sed -n 's/^am__include = //p' < "$mf"`
-  test -z "am__include" && continue
-  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-  # When using ansi2knr, U may be empty or an underscore; expand it
-  U=`sed -n 's/^U = //p' < "$mf"`
-  # Find all dependency output files, they are included files with
-  # $(DEPDIR) in their names.  We invoke sed twice because it is the
-  # simplest approach to changing $(DEPDIR) to its actual value in the
-  # expansion.
-  for file in `sed -n "
-    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
-    # Make sure the directory exists.
-    test -f "$dirpart/$file" && continue
-    fdir=`AS_DIRNAME(["$file"])`
-    AS_MKDIR_P([$dirpart/$fdir])
-    # echo "creating $dirpart/$file"
-    echo '# dummy' > "$dirpart/$file"
+[{
+  # Autoconf 2.62 quotes --file arguments for eval, but not when files
+  # are listed without --file.  Let's play safe and only enable the eval
+  # if we detect the quoting.
+  case $CONFIG_FILES in
+  *\'*) eval set x "$CONFIG_FILES" ;;
+  *)   set x $CONFIG_FILES ;;
+  esac
+  shift
+  for mf
+  do
+    # Strip MF so we end up with the name of the file.
+    mf=`echo "$mf" | sed -e 's/:.*$//'`
+    # Check whether this is an Automake generated Makefile or not.
+    # We used to match only the files named `Makefile.in', but
+    # some people rename them; so instead we look at the file content.
+    # Grep'ing the first line is not enough: some people post-process
+    # each Makefile.in and add a new line on top of each file to say so.
+    # Grep'ing the whole file is not good either: AIX grep has a line
+    # limit of 2048, but all sed's we know have understand at least 4000.
+    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+      dirpart=`AS_DIRNAME("$mf")`
+    else
+      continue
+    fi
+    # Extract the definition of DEPDIR, am__include, and am__quote
+    # from the Makefile without running `make'.
+    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+    test -z "$DEPDIR" && continue
+    am__include=`sed -n 's/^am__include = //p' < "$mf"`
+    test -z "am__include" && continue
+    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+    # When using ansi2knr, U may be empty or an underscore; expand it
+    U=`sed -n 's/^U = //p' < "$mf"`
+    # Find all dependency output files, they are included files with
+    # $(DEPDIR) in their names.  We invoke sed twice because it is the
+    # simplest approach to changing $(DEPDIR) to its actual value in the
+    # expansion.
+    for file in `sed -n "
+      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+      # Make sure the directory exists.
+      test -f "$dirpart/$file" && continue
+      fdir=`AS_DIRNAME(["$file"])`
+      AS_MKDIR_P([$dirpart/$fdir])
+      # echo "creating $dirpart/$file"
+      echo '# dummy' > "$dirpart/$file"
+    done
   done
-done
+}
 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
 
 
@@ -7037,7 +420,7 @@ AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
 # Do all the work for Automake.                             -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2008 Free Software Foundation, Inc.
+# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -7111,8 +494,8 @@ AM_MISSING_PROG(AUTOCONF, autoconf)
 AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
 AM_MISSING_PROG(AUTOHEADER, autoheader)
 AM_MISSING_PROG(MAKEINFO, makeinfo)
-AM_PROG_INSTALL_SH
-AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
 AC_REQUIRE([AM_PROG_MKDIR_P])dnl
 # We need awk for the "check" target.  The system "awk" is bad on
 # some platforms.
@@ -7288,13 +671,13 @@ esac
 
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 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 3
+# serial 4
 
 # _AM_MANGLE_OPTION(NAME)
 # -----------------------
@@ -7311,7 +694,7 @@ AC_DEFUN([_AM_SET_OPTION],
 # ----------------------------------
 # OPTIONS is a space-separated list of Automake options.
 AC_DEFUN([_AM_SET_OPTIONS],
-[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
 
 # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
 # -------------------------------------------
@@ -7507,3 +890,24 @@ AC_SUBST([am__tar])
 AC_SUBST([am__untar])
 ]) # _AM_PROG_TAR
 
+m4_include([macros/aclocal-include.m4])
+m4_include([macros/config-header.m4])
+m4_include([macros/debug.m4])
+m4_include([macros/expat-check.m4])
+m4_include([macros/fflaflas-check.m4])
+m4_include([macros/givaro-check.m4])
+m4_include([macros/gmp-check.m4])
+m4_include([macros/iml-check.m4])
+m4_include([macros/libtool.m4])
+m4_include([macros/lidia-check.m4])
+m4_include([macros/linbox-doc.m4])
+m4_include([macros/linbox-misc.m4])
+m4_include([macros/linbox-opt.m4])
+m4_include([macros/ltoptions.m4])
+m4_include([macros/ltsugar.m4])
+m4_include([macros/ltversion.m4])
+m4_include([macros/lt~obsolete.m4])
+m4_include([macros/maple-check.m4])
+m4_include([macros/ntl-check.m4])
+m4_include([macros/saclib-check.m4])
+m4_include([macros/sage-check.m4])
diff --git a/auto-install.sh b/auto-install.sh
new file mode 100755
index 0000000..4f2233f
--- /dev/null
+++ b/auto-install.sh
@@ -0,0 +1,431 @@
+#!/bin/bash - 
+
+# Copyright(c) 2011 LinBox
+# Written by BB <bboyer at imag.fr>
+# see COPYING for more details.
+
+
+# TODO : create .extracted, .configured, .build, .installed and use a switch
+# (like --force) when you want to rebuild
+# TODO : manage icc/gcc
+# TODO : add gmp in givaro and use auto-install in givaro
+# TODO : use an optionnal message in die function.
+# TODO : add options to make like '-j'
+
+STABLE_FFLAS=1.4.0
+STABLE_GIVARO=3.4.1
+GIV_TAR=123
+GIV_MD5=124
+
+#switches
+STABLE=true
+DEBUG=""
+WARNINGS=""
+OPTIM="--enable-optimization"
+CHECK=false
+#options
+PREFIX_LOC="/tmp"
+PREFIX="--prefix=$PREFIX_LOC"
+BLAS=""
+NTL=""
+EXTRA=""
+
+DONE="\033[0;36m done !\033[0m"
+BEG="\033[1;32m * \033[0m"
+
+#########
+#  die  #
+#########
+
+die() {
+	echo -e "\n\033[1;31m * \033[0mfailed" ;   
+	exit -1 ;  
+}
+
+cool() {
+	echo -e $DONE
+}
+
+##############
+#   helper   #
+##############
+
+help() {
+	echo
+	echo " script for building and installing linbox the simple way (hopefully)"
+	echo
+	echo " * usage :"
+	echo
+	echo " --stable              : install latest stable versions or latest svn versions."
+	echo "                          Default : yes."
+	echo " --prefix=MY/PATH      : install all libraries under MY/PATH."
+	echo "                         Default : /tmp/"
+	echo " --with-gmp=GMP/PATH   : tell where gmp is."
+	echo "                         Default : /usr, /usr/local"
+	echo " --with-blas=BLAS/PATH : same for Blas installation."
+	echo " --with-ntl=NTL/PATH   : same for NTL."
+	echo " --extra-flags=\"\"      : give extra compiler flags."
+	echo "                         Default : empty"
+	echo " --enable-debug        : build in debugging mode."
+	echo "                         Default : no."
+	echo " --enable-check        : run make check."
+	echo "                         Default : no."
+	echo " --enable-warnings     : build with extra compile warnings."
+	echo "                         Default : no."
+	echo " --enable-optimization : build with compile-time optimization."
+	echo "                         Default : yes."
+	echo " --help, -h, -?        : print help and exit."
+}
+
+############
+#  parser  # 
+############
+
+for i in $* ; do
+	case "$i" in
+		# switches
+	"--help"|"-h"|"-?") 
+		help
+		exit 0
+		;;
+	"--no-stable")
+		STABLE=false;
+		;;
+	"--stable")
+		#default
+		;;
+	"--enable-debug")
+		DEBUG=$i;
+		;;
+	"--no-enable-debug")
+		DEBUG="";
+		;;
+	"--enable-check")
+		CHECK=true;
+		;;
+	"--no-enable-check")
+		CHECK=false;
+		;;
+	"--enable-warnings")
+		WARNINGS=$i;
+		;;
+	"--no-enable-warnings")
+		WARNINGS="";
+		;;
+	"--enable-optimization")
+		OPTIM=$i;
+		;;
+	"--no-enable-optimization")
+		OPTIM="";
+		;;
+	"--with-ntl")
+		NTL=$i
+		;;
+	*)
+		if [[ ! "$i" =~ --.*=.+ ]] ; then
+			echo "bad switch : $i"
+			help ;
+			exit -1 ;
+		fi
+		# options (now we can cut)
+		QUI="`echo $i | cut -d'=' -f1`"
+		QUOI="`echo $i | cut -d'=' -f2`"
+		# echo "$QUI = $QUOI"
+		case "$QUI" in
+			"--prefix")
+				PREFIX=$i
+				PREFIX_LOC=$QUOI
+				;;
+			"--extra-flags")
+				EXTRA=$QUOI
+				;;
+			"--with-gmp")
+				GMP=$i
+				;;
+			"--with-blas")
+				BLAS=$i
+				;;
+			"--with-ntl")
+				NTL=$i
+				;;
+			"--enable-optimization")
+				[[ "$QUOI" =~ y|yes|Y|1 ]] && OPTIM="--enable-optimization" || OPTIM=""
+				;;
+			"--enable-warnings")
+				[[ "$QUOI" =~ y|yes|Y|1 ]] && WARNINGS="--enable-warnings" || WARNINGS=""
+				;;
+			"--enable-debug")
+				[[ "$QUOI" =~ y|yes|Y|1 ]] && DEBUG="--enable-debug" || DEBUG=""
+				;;
+		"--enable-check")
+				[[ "$QUOI" =~ y|yes|Y|1 ]] && CHECK="true" || CHECK="false"
+				;;
+
+			*)
+				echo "unkown swith option $i" ;
+				help ;
+				exit -1 ;
+				;;
+		esac
+		;;
+esac
+done
+
+######################
+#  create build dir  #
+######################
+
+echo -en "${BEG}Preparing build directory..."
+if [ -e build ] ; then
+	if [ ! -d build ] ; then
+		rm -rf build ;
+		mkdir build;
+	fi
+	# echo -n "emptying build directory..."
+	# rm -rf build/
+	# mkdir build
+else
+	# echo -n "creating empty build directory..."
+	mkdir build
+fi
+cool
+
+####################
+#  fectch sources  #
+####################
+
+cd build ;
+
+### Fflas-ffpack ###
+
+echo -en "${BEG}fecthing Fflas-Ffpack..."
+if [ "$STABLE" = "true" ]; then
+	if [ -f fflas-ffpack-$STABLE_FFLAS.tar.gz ] ; then
+		echo "already there"
+	   	echo -ne "${BEG}fetching md5sum" ; 
+		[ -f fflas-ffpack-$STABLE_FFLAS.tar.gz.md5sum ] && rm fflas-ffpack-${STABLE_FFLAS}.tar.gz.md5sum ;
+		wget http://linalg.org/fflas-ffpack-$STABLE_FFLAS.tar.gz.md5sum >/dev/null 2>&1 || die
+		[ -f fflas-ffpack-$STABLE_FFLAS.tar.gz.md5sum ] || die
+		cool
+		echo -ne "${BEG}"
+		md5sum -c fflas-ffpack-$STABLE_FFLAS.tar.gz.md5sum || die
+	else
+		wget http://linalg.org/fflas-ffpack-$STABLE_FFLAS.tar.gz  >/dev/null 2>&1 || die
+		[ -f fflas-ffpack-$STABLE_FFLAS.tar.gz ] || die
+	   	echo -ne "${BEG}fetching md5sum" ; 
+		wget http://linalg.org/fflas-ffpack-$STABLE_FFLAS.tar.gz.md5sum >/dev/null 2>&1 || die
+		cool
+		echo -ne "${BEG}"
+		md5sum -c fflas-ffpack-$STABLE_FFLAS.tar.gz.md5sum || die
+	fi
+else
+	OK=0 ;
+	svn co svn://linalg.org/fflas-ffpack 2>&1 >/dev/null && OK=1 
+	[ "$OK" = "1" ] &&  cool  || die
+fi
+
+### Givaro ###
+
+echo -en "${BEG}fecthing Givaro..."
+if [ "$STABLE" = "true" ]; then
+	if [ -f givaro-$STABLE_GIVARO.tar.gz ] ; then
+		echo "already there"
+	   	echo -ne "${BEG}fetching md5sum" ; 
+		[ -f givaro-$STABLE_GIVARO.tar.gz.md5sum ] && rm givaro-${STABLE_GIVARO}.tar.gz.md5sum ;
+		wget --no-check-certificate https://forge.imag.fr/frs/download.php/$GIV_MD5/givaro-$STABLE_GIVARO.tar.gz.md5sum >/dev/null 2>&1 || die
+		[ -f givaro-$STABLE_GIVARO.tar.gz.md5sum ] || die
+		cool
+		echo -ne "${BEG}"
+		md5sum -c givaro-$STABLE_GIVARO.tar.gz.md5sum || die
+	else
+		wget --no-check-certificate https://forge.imag.fr/frs/download.php/$GIV_TAR/givaro-$STABLE_GIVARO.tar.gz >/dev/null 2>&1 || die
+		[ -f givaro-$STABLE_GIVARO.tar.gz ] || die
+	   	echo -ne "${BEG}fetching md5sum" ; 
+		wget --no-check-certificate https://forge.imag.fr/frs/download.php/$GIV_MD5/givaro-$STABLE_GIVARO.tar.gz.md5sum >/dev/null 2>&1 || die
+		cool
+		echo -ne "${BEG}"
+		md5sum -c givaro-$STABLE_GIVARO.tar.gz.md5sum || die
+	fi
+else
+	OK=0 ;
+	svn co svn://scm.forge.imag.fr/var/lib/gforge/chroot/scmrepos/svn/givaro/trunk 2>&1 >/dev/null && OK=1 
+	[ "$OK" = "1" ] &&  cool  || die 
+fi
+
+
+#####################
+#  extract sources  #
+#####################
+
+### Fflas-ffpack ###
+
+OK=0
+if [ "$STABLE" = "true" ]; then
+	echo -en "${BEG}extracting Fflas-Ffpack..."
+	tar xzf fflas-ffpack-$STABLE_FFLAS.tar.gz  && OK=1
+	[ "$OK" = "1" ] &&  cool   || die
+fi
+
+### Givaro ###
+
+OK=0
+if [ "$STABLE" = "true" ]; then
+	echo -en "${BEG}extracting Givaro..."
+	tar xzf givaro-$STABLE_GIVARO.tar.gz  && OK=1
+	[ "$OK" = "1" ] &&  cool   || die 
+fi
+
+##########################
+#  install fflas-ffpack  #
+##########################
+
+if [ "$STABLE" = "true" ]; then
+	cd fflas-ffpack-$STABLE_FFLAS/ || die
+else
+	cd fflas-ffpack/ || die
+fi
+
+
+if [ -f Makefile ] ; then
+	echo -e "${BEG}cleaning Fflas-Ffpack..."
+	make clean || die
+	make distclean || die 
+	# make unistall || die
+	cool
+fi
+
+echo -e "${BEG}configuring Fflas-Ffpack..."
+
+if [ "$STABLE" = "true" ]; then
+	echo "./configure  $PREFIX $DEBUG $OPTIM $BLAS $WARNINGS"
+	./configure  $PREFIX $DEBUG $OPTIM $BLAS $WARNINGS || die
+else
+	echo "./autogen.sh $PREFIX $DEBUG $OPTIM $BLAS $WARNINGS"
+	./autogen.sh $PREFIX $DEBUG $OPTIM $BLAS $WARNINGS || die
+fi
+
+echo -e "${BEG}building Fflas-Ffpack..."
+echo "make CXXFLAGS+=\"$EXTRA\""
+if [ -n "$EXTRA" ] ; then
+	make "CXXFLAGS+=\"$EXTRA\"" || die
+else
+	make || die
+fi
+
+if [ "$CHECK" = "true" ] ; then
+	echo -e "${BEG}checking Fflas-Ffpack..."
+	make check || die
+fi
+
+
+echo -e "${BEG}installing Fflas-Ffpack..."
+make install || die
+
+cool
+#return in build
+cd ..
+
+####################
+#  install Givaro  #
+####################
+
+if [ "$STABLE" = "true" ]; then
+	cd givaro-$STABLE_GIVARO || die
+else
+	cd trunk/ || die
+fi
+
+if [ -f Makefile ] ; then
+	echo -e "${BEG}cleaning Givaro..."
+	make clean || die
+	make distclean || die 
+	# make unistall || die
+	cool
+fi
+
+echo -e "${BEG}configuring Givaro..."
+
+if [ "$STABLE" = "true" ]; then
+	echo "./configure  $PREFIX $DEBUG $OPTIM $GMP $WARNINGS"
+	./configure  $PREFIX $DEBUG $OPTIM $GMP $WARNINGS || die
+else
+	echo "./autogen.sh $PREFIX $DEBUG $OPTIM $GMP $WARNINGS"
+	./autogen.sh $PREFIX $DEBUG $OPTIM $GMP $WARNINGS || die
+fi
+
+echo -e "${BEG}building Givaro..."
+echo "make CXXFLAGS+=\"$EXTRA\""
+
+if [ -n "$EXTRA" ] ; then
+	make "CXXFLAGS+=\"$EXTRA\"" || die
+else
+	make || die
+fi
+
+if [ "$CHECK" = "true" ] ; then
+	echo -e "${BEG}checking Fflas-Ffpack..."
+	make check || die
+fi
+
+echo -e "${BEG}installing Givaro..."
+make install || die
+
+#return in build
+cd ..
+
+cool
+
+#return in linbox
+cd ..
+
+#####################
+#  cleaning LinBox  #
+#####################
+
+if [ -f Makefile ] ; then
+	echo -e "${BEG}cleaning LinBox..."
+	make clean || die
+	make distclean || die 
+	# make unistall || die
+	cool
+fi
+
+echo -e "${BEG}configuring LinBox..."
+
+
+GIVARO="--with-givaro=$PREFIX_LOC"
+FFLAFLAS="--with-fflas-ffpack=$PREFIX_LOC"
+
+if [ -x autogen.sh ] ;  then 
+	./autogen.sh $PREFIX $DEBUG $OPTIM $GMP $BLAS $GIVARO $FFLAFLAS $WARNINGS || die
+else
+	./configure $PREFIX $DEBUG $OPTIM $GMP $BLAS $GIVARO $FFLAFLAS $WARNINGS || die
+fi
+
+echo -e "${BEG}building LinBox..."
+echo "make CXXFLAGS+=\"$EXTRA\""
+
+if [ -n "$EXTRA" ] ; then
+	make "CXXFLAGS+=\"$EXTRA\"" || die
+else
+	make || die
+fi
+
+if [ "$CHECK" = "true" ] ; then
+	echo -e "${BEG}checking LinBox..."
+	make check || die
+fi
+
+echo -e "${BEG}installing LinBox..."
+make install || die
+
+cool
+
+echo
+echo -e "${BEG}Don't forget to run something like"
+echo -e " *   'export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:$PREFIX_LOC/lib'"
+echo -e " * to ensure you don't get undefined symobols !"
+echo 
+echo -e " * Happy LinBoxing ! (installed in $PREFIX_LOC)"
+echo
+cool
diff --git a/build-aux/config.guess b/build-aux/config.guess
new file mode 100755
index 0000000..187cd54
--- /dev/null
+++ b/build-aux/config.guess
@@ -0,0 +1,1511 @@
+#! /bin/sh
+# 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.
+
+timestamp='2011-02-02'
+
+# 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
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# 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.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner.  Please send patches (context
+# diff format) to <config-patches at gnu.org> and include a ChangeLog
+# entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches at gnu.org>."
+
+version="\
+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.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi at noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+	PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+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
+
+# 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*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    sh5el) machine=sh5le-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently, or will in the future.
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep -q __ELF__
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+		fi
+		;;
+	    *)
+		os=netbsd
+		;;
+	esac
+	# The OS release
+	# Debian GNU/NetBSD machines have a different userland, and
+	# thus, need a distinct triplet. However, they do not need
+	# kernel version information, so it can be replaced with a
+	# suitable tag, in the style of linux-gnu.
+	case "${UNAME_VERSION}" in
+	    Debian*)
+		release='-gnu'
+		;;
+	    *)
+		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		;;
+	esac
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit ;;
+    *:OpenBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+	exit ;;
+    *:ekkoBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	exit ;;
+    *:SolidBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	exit ;;
+    macppc:MirBSD:*:*)
+	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    *:MirBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    alpha:OSF1:*:*)
+	case $UNAME_RELEASE in
+	*4.0)
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+		;;
+	*5.*)
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		;;
+	esac
+	# According to Compaq, /usr/sbin/psrinfo has been available on
+	# OSF/1 and Tru64 systems produced since 1995.  I hope that
+	# covers most systems running today.  This code pipes the CPU
+	# types through head -n 1, so we only detect the type of CPU 0.
+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	case "$ALPHA_CPU_TYPE" in
+	    "EV4 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV4.5 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "LCA4 (21066/21068)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV5 (21164)")
+		UNAME_MACHINE="alphaev5" ;;
+	    "EV5.6 (21164A)")
+		UNAME_MACHINE="alphaev56" ;;
+	    "EV5.6 (21164PC)")
+		UNAME_MACHINE="alphapca56" ;;
+	    "EV5.7 (21164PC)")
+		UNAME_MACHINE="alphapca57" ;;
+	    "EV6 (21264)")
+		UNAME_MACHINE="alphaev6" ;;
+	    "EV6.7 (21264A)")
+		UNAME_MACHINE="alphaev67" ;;
+	    "EV6.8CB (21264C)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8AL (21264B)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8CX (21264D)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.9A (21264/EV69A)")
+		UNAME_MACHINE="alphaev69" ;;
+	    "EV7 (21364)")
+		UNAME_MACHINE="alphaev7" ;;
+	    "EV7.9 (21364A)")
+		UNAME_MACHINE="alphaev79" ;;
+	esac
+	# A Pn.n version is a patched version.
+	# A Vn.n version is a released version.
+	# A Tn.n version is a released field test version.
+	# A Xn.n version is an unreleased experimental baselevel.
+	# 1.2 uses "1.2" for uname -r.
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
+	exitcode=$?
+	trap '' 0
+	exit $exitcode ;;
+    Alpha\ *:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# Should we change UNAME_MACHINE based on the output of uname instead
+	# of the specific Alpha model?
+	echo alpha-pc-interix
+	exit ;;
+    21064:Windows_NT:50:3)
+	echo alpha-dec-winnt3.5
+	exit ;;
+    Amiga*:UNIX_System_V:4.0:*)
+	echo m68k-unknown-sysv4
+	exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-amigaos
+	exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
+	exit ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit ;;
+    *:z/VM:*:*)
+	echo s390-ibm-zvmoe
+	exit ;;
+    *:OS400:*:*)
+	echo powerpc-ibm-os400
+	exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+	echo arm-unknown-riscos
+	exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+	echo hppa1.1-hitachi-hiuxmpp
+	exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+	# akee at wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+		echo pyramid-pyramid-sysv3
+	else
+		echo pyramid-pyramid-bsd
+	fi
+	exit ;;
+    NILE*:*:*:dcosx)
+	echo pyramid-pyramid-svr4
+	exit ;;
+    DRS?6000:unix:4.0:6*)
+	echo sparc-icl-nx6
+	exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7; exit ;;
+	esac ;;
+    s390x:SunOS:*:*)
+	echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4H:SunOS:5.*:*)
+	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+	echo i386-pc-auroraux${UNAME_RELEASE}
+	exit ;;
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+	eval $set_cc_for_build
+	SUN_ARCH="i386"
+	# If there is a compiler, see if it is configured for 64-bit objects.
+	# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+	# This test works for both compilers.
+	if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+	    if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+		(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		grep IS_64BIT_ARCH >/dev/null
+	    then
+		SUN_ARCH="x86_64"
+	    fi
+	fi
+	echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:6*:*)
+	# According to config.sub, this is the proper way to canonicalize
+	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+	# it's likely to be more like Solaris than SunOS4.
+	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:*:*)
+	case "`/usr/bin/arch -k`" in
+	    Series*|S4*)
+		UNAME_RELEASE=`uname -v`
+		;;
+	esac
+	# Japanese Language versions have a version number like `4.1.3-JL'.
+	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	exit ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit ;;
+    sun*:*:4.2BSD:*)
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	case "`/bin/arch`" in
+	    sun3)
+		echo m68k-sun-sunos${UNAME_RELEASE}
+		;;
+	    sun4)
+		echo sparc-sun-sunos${UNAME_RELEASE}
+		;;
+	esac
+	exit ;;
+    aushp:SunOS:*:*)
+	echo sparc-auspex-sunos${UNAME_RELEASE}
+	exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+	echo m68k-milan-mint${UNAME_RELEASE}
+	exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+	echo m68k-hades-mint${UNAME_RELEASE}
+	exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+	echo m68k-unknown-mint${UNAME_RELEASE}
+	exit ;;
+    m68k:machten:*:*)
+	echo m68k-apple-machten${UNAME_RELEASE}
+	exit ;;
+    powerpc:machten:*:*)
+	echo powerpc-apple-machten${UNAME_RELEASE}
+	exit ;;
+    RISC*:Mach:*:*)
+	echo mips-dec-mach_bsd4.3
+	exit ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+	echo clipper-intergraph-clix${UNAME_RELEASE}
+	exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
+	#if defined (host_mips) && defined (MIPSEB)
+	#if defined (SYSTYPE_SYSV)
+	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_SVR4)
+	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+	#endif
+	#endif
+	  exit (-1);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c &&
+	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+	  SYSTEM_NAME=`$dummy $dummyarg` &&
+	    { echo "$SYSTEM_NAME"; exit; }
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+	echo powerpc-harris-powerunix
+	exit ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit ;;
+    AViiON:dgux:*:*)
+	# DG/UX returns AViiON for all architectures
+	UNAME_PROCESSOR=`/usr/bin/uname -p`
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
+		echo m88k-dg-dgux${UNAME_RELEASE}
+	    else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    fi
+	else
+	    echo i586-dg-dgux${UNAME_RELEASE}
+	fi
+	exit ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	exit ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+	echo i386-ibm-aix
+	exit ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		eval $set_cc_for_build
+		sed 's/^		//' << EOF >$dummy.c
+		#include <sys/systemcfg.h>
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+		then
+			echo "$SYSTEM_NAME"
+		else
+			echo rs6000-ibm-aix3.2.5
+		fi
+	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+		echo rs6000-ibm-aix3.2.4
+	else
+		echo rs6000-ibm-aix3.2
+	fi
+	exit ;;
+    *:AIX:*:[4567])
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+		IBM_ARCH=rs6000
+	else
+		IBM_ARCH=powerpc
+	fi
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+	echo romp-ibm-bsd4.4
+	exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit ;;
+    9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/[678][0-9][0-9])
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+		    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+		    case "${sc_cpu_version}" in
+		      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+		      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+		      532)                      # CPU_PA_RISC2_0
+			case "${sc_kernel_bits}" in
+			  32) HP_ARCH="hppa2.0n" ;;
+			  64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+			esac ;;
+		    esac
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^		//' << EOF >$dummy.c
+
+		#define _HPUX_SOURCE
+		#include <stdlib.h>
+		#include <unistd.h>
+
+		int main ()
+		{
+		#if defined(_SC_KERNEL_BITS)
+		    long bits = sysconf(_SC_KERNEL_BITS);
+		#endif
+		    long cpu  = sysconf (_SC_CPU_VERSION);
+
+		    switch (cpu)
+			{
+			case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+			case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+			case CPU_PA_RISC2_0:
+		#if defined(_SC_KERNEL_BITS)
+			    switch (bits)
+				{
+				case 64: puts ("hppa2.0w"); break;
+				case 32: puts ("hppa2.0n"); break;
+				default: puts ("hppa2.0"); break;
+				} break;
+		#else  /* !defined(_SC_KERNEL_BITS) */
+			    puts ("hppa2.0"); break;
+		#endif
+			default: puts ("hppa1.0"); break;
+			}
+		    exit (0);
+		}
+EOF
+		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    test -z "$HP_ARCH" && HP_ARCH=hppa
+		fi ;;
+	esac
+	if [ ${HP_ARCH} = "hppa2.0w" ]
+	then
+	    eval $set_cc_for_build
+
+	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+	    # generating 64-bit code.  GNU and HP use different nomenclature:
+	    #
+	    # $ CC_FOR_BUILD=cc ./config.guess
+	    # => hppa2.0w-hp-hpux11.23
+	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+	    # => hppa64-hp-hpux11.23
+
+	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+		grep -q __LP64__
+	    then
+		HP_ARCH="hppa2.0w"
+	    else
+		HP_ARCH="hppa64"
+	    fi
+	fi
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit ;;
+    ia64:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux${HPUX_REV}
+	exit ;;
+    3050*:HI-UX:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <unistd.h>
+	int
+	main ()
+	{
+	  long cpu = sysconf (_SC_CPU_VERSION);
+	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+	     results, however.  */
+	  if (CPU_IS_PA_RISC (cpu))
+	    {
+	      switch (cpu)
+		{
+		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+		  default: puts ("hppa-hitachi-hiuxwe2"); break;
+		}
+	    }
+	  else if (CPU_IS_HP_MC68K (cpu))
+	    puts ("m68k-hitachi-hiuxwe2");
+	  else puts ("unknown-hitachi-hiuxwe2");
+	  exit (0);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+		{ echo "$SYSTEM_NAME"; exit; }
+	echo unknown-hitachi-hiuxwe2
+	exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+	echo hppa1.0-hp-mpeix
+	exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit ;;
+    i*86:OSF1:*:*)
+	if [ -x /usr/sbin/sysversion ] ; then
+	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	else
+	    echo ${UNAME_MACHINE}-unknown-osf1
+	fi
+	exit ;;
+    parisc*:Lites*:*:*)
+	echo hppa1.1-hp-lites
+	exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+	exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+	exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+	exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+	exit ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*[A-Z]90:*:*:*)
+	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*TS:*:*:*)
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*T3E:*:*:*)
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    *:UNICOS/mp:*:*)
+	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+	echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
+    5000:UNIX_System_V:4.*:*)
+	FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+	FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+	echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit ;;
+    sparc*:BSD/OS:*:*)
+	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:FreeBSD:*:*)
+	case ${UNAME_MACHINE} in
+	    pc98)
+		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    amd64)
+		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    *)
+		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	esac
+	exit ;;
+    i*:CYGWIN*:*)
+	echo ${UNAME_MACHINE}-pc-cygwin
+	exit ;;
+    *:MINGW*:*)
+	echo ${UNAME_MACHINE}-pc-mingw32
+	exit ;;
+    i*:windows32*:*)
+	# uname -m includes "-pc" on this system.
+	echo ${UNAME_MACHINE}-mingw32
+	exit ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit ;;
+    *:Interix*:*)
+	case ${UNAME_MACHINE} in
+	    x86)
+		echo i586-pc-interix${UNAME_RELEASE}
+		exit ;;
+	    authenticamd | genuineintel | EM64T)
+		echo x86_64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	    IA64)
+		echo ia64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	esac ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+	echo i${UNAME_MACHINE}-pc-mks
+	exit ;;
+    8664:Windows_NT:*)
+	echo x86_64-pc-mks
+	exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+	# UNAME_MACHINE based on the output of uname instead of i386?
+	echo i586-pc-interix
+	exit ;;
+    i*:UWIN*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+	echo x86_64-unknown-cygwin
+	exit ;;
+    p*:CYGWIN*:*)
+	echo powerpcle-unknown-cygwin
+	exit ;;
+    prep*:SunOS:5.*:*)
+	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    *:GNU:*:*)
+	# the GNU system
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`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
+	exit ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  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}
+	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
+	else
+	    echo ${UNAME_MACHINE}-unknown-linux-gnueabi
+	fi
+	exit ;;
+    avr32*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    cris:Linux:*:*)
+	echo cris-axis-linux-gnu
+	exit ;;
+    crisv32:Linux:*:*)
+	echo crisv32-axis-linux-gnu
+	exit ;;
+    frv:Linux:*:*)
+	echo frv-unknown-linux-gnu
+	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}"
+	exit ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m32r*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    mips:Linux:*:* | mips64:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef ${UNAME_MACHINE}
+	#undef ${UNAME_MACHINE}el
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=${UNAME_MACHINE}el
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=${UNAME_MACHINE}
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    or32:Linux:*:*)
+	echo or32-unknown-linux-gnu
+	exit ;;
+    padre:Linux:*:*)
+	echo sparc-unknown-linux-gnu
+	exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	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 ;;
+	esac
+	exit ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
+	exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux
+	exit ;;
+    sh64*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    tile*:Linux:*:*)
+	echo ${UNAME_MACHINE}-tilera-linux-gnu
+	exit ;;
+    vax:Linux:*:*)
+	echo ${UNAME_MACHINE}-dec-linux-gnu
+	exit ;;
+    x86_64:Linux:*:*)
+	echo x86_64-unknown-linux-gnu
+	exit ;;
+    xtensa*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
+	echo i386-sequent-sysv4
+	exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+	# Unixware is an offshoot of SVR4, but it has its own version
+	# number series starting with 2...
+	# I am not positive that other SVR4 systems won't match this,
+	# I just have to hope.  -- rms.
+	# Use sysv4.2uw... so that sysv4* matches it.
+	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	exit ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit ;;
+    i*86:syllable:*:*)
+	echo ${UNAME_MACHINE}-pc-syllable
+	exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+	else
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+	fi
+	exit ;;
+    i*86:*:5:[678]*)
+	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit ;;
+    i*86:*:3.2:*)
+	if test -f /usr/options/cb.name; then
+		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+	elif /bin/uname -X 2>/dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+			&& UNAME_MACHINE=i586
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-pc-sysv32
+	fi
+	exit ;;
+    pc:*:*:*)
+	# Left here for compatibility:
+	# uname -m prints for DJGPP always 'pc', but it prints nothing about
+	# the processor, so we play safe by assuming i586.
+	# Note: whatever this is, it MUST be the same as what config.sub
+	# prints for the "djgpp" host, or else GDB configury will decide that
+	# this is a cross-build.
+	echo i586-pc-msdosdjgpp
+	exit ;;
+    Intel:Mach:3*:*)
+	echo i386-pc-mach3
+	exit ;;
+    paragon:*:*:*)
+	echo i860-intel-osf1
+	exit ;;
+    i860:*:4.*:*) # i860-SVR4
+	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	else # Add other i860-SVR4 vendors below as they are discovered.
+	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	fi
+	exit ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit ;;
+    M680?0:D-NIX:5.3:*)
+	echo m68k-diab-dnix
+	exit ;;
+    M68*:*:R3V[5678]*:*)
+	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+	OS_REL=''
+	test -r /etc/.relid \
+	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4; exit; } ;;
+    NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+	OS_REL='.3'
+	test -r /etc/.relid \
+	    && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	    && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+	    && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    rs6000:LynxOS:2.*:*)
+	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+	echo mips-dde-sysv${UNAME_RELEASE}
+	exit ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    *:SINIX-*:*:*)
+	if uname -p 2>/dev/null >/dev/null ; then
+		UNAME_MACHINE=`(uname -p) 2>/dev/null`
+		echo ${UNAME_MACHINE}-sni-sysv4
+	else
+		echo ns32k-sni-sysv
+	fi
+	exit ;;
+    PENTIUM:*:4.0*:*)	# Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+			# says <Richard.M.Bartel at ccMail.Census.GOV>
+	echo i586-unisys-sysv4
+	exit ;;
+    *:UNIX_System_V:4*:FTX*)
+	# From Gerald Hewes <hewes at openmarket.com>.
+	# How about differentiating between stratus architectures? -djm
+	echo hppa1.1-stratus-sysv4
+	exit ;;
+    *:*:*:FTX*)
+	# From seanf at swdc.stratus.com.
+	echo i860-stratus-sysv4
+	exit ;;
+    i*86:VOS:*:*)
+	# From Paul.Green at stratus.com.
+	echo ${UNAME_MACHINE}-stratus-vos
+	exit ;;
+    *:VOS:*:*)
+	# From Paul.Green at stratus.com.
+	echo hppa1.1-stratus-vos
+	exit ;;
+    mc68*:A/UX:*:*)
+	echo m68k-apple-aux${UNAME_RELEASE}
+	exit ;;
+    news*:NEWS-OS:6*:*)
+	echo mips-sony-newsos6
+	exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+	if [ -d /usr/nec ]; then
+		echo mips-nec-sysv${UNAME_RELEASE}
+	else
+		echo mips-unknown-sysv${UNAME_RELEASE}
+	fi
+	exit ;;
+    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
+	echo powerpc-be-beos
+	exit ;;
+    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
+	echo powerpc-apple-beos
+	exit ;;
+    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
+	echo i586-pc-beos
+	exit ;;
+    BePC:Haiku:*:*)	# Haiku running on Intel PC compatible.
+	echo i586-pc-haiku
+	exit ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-7:SUPER-UX:*:*)
+	echo sx7-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8:SUPER-UX:*:*)
+	echo sx8-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8R:SUPER-UX:*:*)
+	echo sx8r-nec-superux${UNAME_RELEASE}
+	exit ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Darwin:*:*)
+	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+	case $UNAME_PROCESSOR in
+	    i386)
+		eval $set_cc_for_build
+		if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+		  if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+		      (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+		      grep IS_64BIT_ARCH >/dev/null
+		  then
+		      UNAME_PROCESSOR="x86_64"
+		  fi
+		fi ;;
+	    unknown) UNAME_PROCESSOR=powerpc ;;
+	esac
+	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+	exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
+	fi
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	exit ;;
+    *:QNX:*:4*)
+	echo i386-pc-qnx
+	exit ;;
+    NEO-?:NONSTOP_KERNEL:*:*)
+	echo neo-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+	echo nse-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit ;;
+    SEI:*:*:SEIUX)
+	echo mips-sei-seiux${UNAME_RELEASE}
+	exit ;;
+    *:DragonFly:*:*)
+	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit ;;
+    *:*VMS:*:*)
+	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	case "${UNAME_MACHINE}" in
+	    A*) echo alpha-dec-vms ; exit ;;
+	    I*) echo ia64-dec-vms ; exit ;;
+	    V*) echo vax-dec-vms ; exit ;;
+	esac ;;
+    *:XENIX:*:SysV)
+	echo i386-pc-xenix
+	exit ;;
+    i*86:skyos:*:*)
+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+	exit ;;
+    i*86:rdos:*:*)
+	echo ${UNAME_MACHINE}-pc-rdos
+	exit ;;
+    i*86:AROS:*:*)
+	echo ${UNAME_MACHINE}-pc-aros
+	exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+	"4"
+#else
+	""
+#endif
+	); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+	printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+	printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+	{ echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+	echo c1-convex-bsd
+	exit ;;
+    c2*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit ;;
+    c34*)
+	echo c34-convex-bsd
+	exit ;;
+    c38*)
+	echo c38-convex-bsd
+	exit ;;
+    c4*)
+	echo c4-convex-bsd
+	exit ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
+and
+  http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches at gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/build-aux/config.sub b/build-aux/config.sub
new file mode 100755
index 0000000..30fdca8
--- /dev/null
+++ b/build-aux/config.sub
@@ -0,0 +1,1760 @@
+#! /bin/sh
+# 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.
+
+timestamp='2011-03-23'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# 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
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU 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.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches at gnu.org>.  Submit a context
+# diff and a properly formatted GNU ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches at gnu.org>."
+
+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.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
+  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
+  knetbsd*-gnu* | netbsd*-gnu* | \
+  kopensolaris*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+	-sun*os*)
+		# Prevent following clause from handling this invalid input.
+		;;
+	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+	-apple | -axis | -knuth | -cray | -microblaze)
+		os=
+		basic_machine=$1
+		;;
+	-bluegene*)
+		os=-cnk
+		;;
+	-sim | -cisco | -oki | -wec | -winbond)
+		os=
+		basic_machine=$1
+		;;
+	-scout)
+		;;
+	-wrs)
+		os=-vxworks
+		basic_machine=$1
+		;;
+	-chorusos*)
+		os=-chorusos
+		basic_machine=$1
+		;;
+	-chorusrdb)
+		os=-chorusrdb
+		basic_machine=$1
+		;;
+	-hiux*)
+		os=-hiuxwe2
+		;;
+	-sco6)
+		os=-sco5v6
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5)
+		os=-sco3.2v5
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco4)
+		os=-sco3.2v4
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2.[4-9]*)
+		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2v[4-9]*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5v6*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco*)
+		os=-sco3.2v2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-udk*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-isc)
+		os=-isc2.2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-clix*)
+		basic_machine=clipper-intergraph
+		;;
+	-isc*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-lynx*)
+		os=-lynxos
+		;;
+	-ptx*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+		;;
+	-windowsnt*)
+		os=`echo $os | sed -e 's/windowsnt/winnt/'`
+		;;
+	-psos*)
+		os=-psos
+		;;
+	-mint | -mint[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+	# Recognize the basic CPU types without company name.
+	# Some are omitted here because they have special meanings below.
+	1750a | 580 \
+	| a29k \
+	| 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 \
+	| bfin \
+	| c4x | clipper \
+	| d10v | d30v | dlx | dsp16xx \
+	| fido | fr30 | frv \
+	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| i370 | i860 | i960 | ia64 \
+	| ip2k | iq2000 \
+	| lm32 \
+	| m32c | m32r | m32rle | m68000 | m68k | m88k \
+	| maxq | mb | microblaze | mcore | mep | metag \
+	| mips | mipsbe | mipseb | mipsel | mipsle \
+	| mips16 \
+	| mips64 | mips64el \
+	| mips64octeon | mips64octeonel \
+	| mips64orion | mips64orionel \
+	| mips64r5900 | mips64r5900el \
+	| mips64vr | mips64vrel \
+	| mips64vr4100 | mips64vr4100el \
+	| mips64vr4300 | mips64vr4300el \
+	| mips64vr5000 | mips64vr5000el \
+	| mips64vr5900 | mips64vr5900el \
+	| mipsisa32 | mipsisa32el \
+	| mipsisa32r2 | mipsisa32r2el \
+	| mipsisa64 | mipsisa64el \
+	| mipsisa64r2 | mipsisa64r2el \
+	| mipsisa64sb1 | mipsisa64sb1el \
+	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipstx39 | mipstx39el \
+	| mn10200 | mn10300 \
+	| moxie \
+	| mt \
+	| msp430 \
+	| nds32 | nds32le | nds32be \
+	| nios | nios2 \
+	| ns16k | ns32k \
+	| open8 \
+	| or32 \
+	| pdp10 | pdp11 | pj | pjl \
+	| powerpc | powerpc64 | powerpc64le | powerpcle \
+	| pyramid \
+	| 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 \
+	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+	| spu \
+	| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
+	| ubicom32 \
+	| v850 | v850e \
+	| we32k \
+	| x86 | xc16x | xstormy16 | xtensa \
+	| z8k | z80)
+		basic_machine=$basic_machine-unknown
+		;;
+	c54x)
+		basic_machine=tic54x-unknown
+		;;
+	c55x)
+		basic_machine=tic55x-unknown
+		;;
+	c6x)
+		basic_machine=tic6x-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12 | picochip)
+		# Motorola 68HC11/12.
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+		;;
+	ms1)
+		basic_machine=mt-unknown
+		;;
+
+	strongarm | thumb | xscale)
+		basic_machine=arm-unknown
+		;;
+
+	xscaleeb)
+		basic_machine=armeb-unknown
+		;;
+
+	xscaleel)
+		basic_machine=armel-unknown
+		;;
+
+	# We use `pc' rather than `unknown'
+	# because (1) that's what they normally are, and
+	# (2) the word "unknown" tends to confuse beginning users.
+	i*86 | x86_64)
+	  basic_machine=$basic_machine-pc
+	  ;;
+	# Object if more than one company name word.
+	*-*-*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+	# Recognize the basic CPU types with company name.
+	580-* \
+	| a29k-* \
+	| 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-* \
+	| bfin-* | bs2000-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* \
+	| clipper-* | craynv-* | cydra-* \
+	| d10v-* | d30v-* | dlx-* \
+	| elxsi-* \
+	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+	| h8300-* | h8500-* \
+	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| i*86-* | i860-* | i960-* | ia64-* \
+	| ip2k-* | iq2000-* \
+	| lm32-* \
+	| m32c-* | m32r-* | m32rle-* \
+	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
+	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+	| mips16-* \
+	| mips64-* | mips64el-* \
+	| mips64octeon-* | mips64octeonel-* \
+	| mips64orion-* | mips64orionel-* \
+	| mips64r5900-* | mips64r5900el-* \
+	| mips64vr-* | mips64vrel-* \
+	| mips64vr4100-* | mips64vr4100el-* \
+	| mips64vr4300-* | mips64vr4300el-* \
+	| mips64vr5000-* | mips64vr5000el-* \
+	| mips64vr5900-* | mips64vr5900el-* \
+	| mipsisa32-* | mipsisa32el-* \
+	| mipsisa32r2-* | mipsisa32r2el-* \
+	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64r2-* | mipsisa64r2el-* \
+	| mipsisa64sb1-* | mipsisa64sb1el-* \
+	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipstx39-* | mipstx39el-* \
+	| mmix-* \
+	| mt-* \
+	| msp430-* \
+	| nds32-* | nds32le-* | nds32be-* \
+	| nios-* | nios2-* \
+	| none-* | np1-* | ns16k-* | ns32k-* \
+	| open8-* \
+	| orion-* \
+	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+	| pyramid-* \
+	| 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-* \
+	| sparclite-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
+	| tahoe-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tile-* | tilegx-* \
+	| tron-* \
+	| ubicom32-* \
+	| v850-* | v850e-* | vax-* \
+	| we32k-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* \
+	| xstormy16-* | xtensa*-* \
+	| ymp-* \
+	| z8k-* | z80-*)
+		;;
+	# Recognize the basic CPU types without company name, with glob match.
+	xtensa*)
+		basic_machine=$basic_machine-unknown
+		;;
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	386bsd)
+		basic_machine=i386-unknown
+		os=-bsd
+		;;
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		basic_machine=m68000-att
+		;;
+	3b*)
+		basic_machine=we32k-att
+		;;
+	a29khif)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	abacus)
+		basic_machine=abacus-unknown
+		;;
+	adobe68k)
+		basic_machine=m68010-adobe
+		os=-scout
+		;;
+	alliant | fx80)
+		basic_machine=fx80-alliant
+		;;
+	altos | altos3068)
+		basic_machine=m68k-altos
+		;;
+	am29k)
+		basic_machine=a29k-none
+		os=-bsd
+		;;
+	amd64)
+		basic_machine=x86_64-pc
+		;;
+	amd64-*)
+		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	amdahl)
+		basic_machine=580-amdahl
+		os=-sysv
+		;;
+	amiga | amiga-*)
+		basic_machine=m68k-unknown
+		;;
+	amigaos | amigados)
+		basic_machine=m68k-unknown
+		os=-amigaos
+		;;
+	amigaunix | amix)
+		basic_machine=m68k-unknown
+		os=-sysv4
+		;;
+	apollo68)
+		basic_machine=m68k-apollo
+		os=-sysv
+		;;
+	apollo68bsd)
+		basic_machine=m68k-apollo
+		os=-bsd
+		;;
+	aros)
+		basic_machine=i386-pc
+		os=-aros
+		;;
+	aux)
+		basic_machine=m68k-apple
+		os=-aux
+		;;
+	balance)
+		basic_machine=ns32k-sequent
+		os=-dynix
+		;;
+	blackfin)
+		basic_machine=bfin-unknown
+		os=-linux
+		;;
+	blackfin-*)
+		basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	bluegene*)
+		basic_machine=powerpc-ibm
+		os=-cnk
+		;;
+	c54x-*)
+		basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	c55x-*)
+		basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	c6x-*)
+		basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	c90)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
+	cegcc)
+		basic_machine=arm-unknown
+		os=-cegcc
+		;;
+	convex-c1)
+		basic_machine=c1-convex
+		os=-bsd
+		;;
+	convex-c2)
+		basic_machine=c2-convex
+		os=-bsd
+		;;
+	convex-c32)
+		basic_machine=c32-convex
+		os=-bsd
+		;;
+	convex-c34)
+		basic_machine=c34-convex
+		os=-bsd
+		;;
+	convex-c38)
+		basic_machine=c38-convex
+		os=-bsd
+		;;
+	cray | j90)
+		basic_machine=j90-cray
+		os=-unicos
+		;;
+	craynv)
+		basic_machine=craynv-cray
+		os=-unicosmp
+		;;
+	cr16 | cr16-*)
+		basic_machine=cr16-unknown
+		os=-elf
+		;;
+	crds | unos)
+		basic_machine=m68k-crds
+		;;
+	crisv32 | crisv32-* | etraxfs*)
+		basic_machine=crisv32-axis
+		;;
+	cris | cris-* | etrax*)
+		basic_machine=cris-axis
+		;;
+	crx)
+		basic_machine=crx-unknown
+		os=-elf
+		;;
+	da30 | da30-*)
+		basic_machine=m68k-da30
+		;;
+	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+		basic_machine=mips-dec
+		;;
+	decsystem10* | dec10*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		basic_machine=m68k-motorola
+		;;
+	delta88)
+		basic_machine=m88k-motorola
+		os=-sysv3
+		;;
+	dicos)
+		basic_machine=i686-pc
+		os=-dicos
+		;;
+	djgpp)
+		basic_machine=i586-pc
+		os=-msdosdjgpp
+		;;
+	dpx20 | dpx20-*)
+		basic_machine=rs6000-bull
+		os=-bosx
+		;;
+	dpx2* | dpx2*-bull)
+		basic_machine=m68k-bull
+		os=-sysv3
+		;;
+	ebmon29k)
+		basic_machine=a29k-amd
+		os=-ebmon
+		;;
+	elxsi)
+		basic_machine=elxsi-elxsi
+		os=-bsd
+		;;
+	encore | umax | mmax)
+		basic_machine=ns32k-encore
+		;;
+	es1800 | OSE68k | ose68k | ose | OSE)
+		basic_machine=m68k-ericsson
+		os=-ose
+		;;
+	fx2800)
+		basic_machine=i860-alliant
+		;;
+	genix)
+		basic_machine=ns32k-ns
+		;;
+	gmicro)
+		basic_machine=tron-gmicro
+		os=-sysv
+		;;
+	go32)
+		basic_machine=i386-pc
+		os=-go32
+		;;
+	h3050r* | hiux*)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	h8300hms)
+		basic_machine=h8300-hitachi
+		os=-hms
+		;;
+	h8300xray)
+		basic_machine=h8300-hitachi
+		os=-xray
+		;;
+	h8500hms)
+		basic_machine=h8500-hitachi
+		os=-hms
+		;;
+	harris)
+		basic_machine=m88k-harris
+		os=-sysv3
+		;;
+	hp300-*)
+		basic_machine=m68k-hp
+		;;
+	hp300bsd)
+		basic_machine=m68k-hp
+		os=-bsd
+		;;
+	hp300hpux)
+		basic_machine=m68k-hp
+		os=-hpux
+		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		basic_machine=m68000-hp
+		;;
+	hp9k3[2-9][0-9])
+		basic_machine=m68k-hp
+		;;
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hppa-next)
+		os=-nextstep3
+		;;
+	hppaosf)
+		basic_machine=hppa1.1-hp
+		os=-osf
+		;;
+	hppro)
+		basic_machine=hppa1.1-hp
+		os=-proelf
+		;;
+	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
+		;;
+	i*86v4*)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv4
+		;;
+	i*86v)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv
+		;;
+	i*86sol2)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-solaris2
+		;;
+	i386mach)
+		basic_machine=i386-mach
+		os=-mach
+		;;
+	i386-vsta | vsta)
+		basic_machine=i386-unknown
+		os=-vsta
+		;;
+	iris | iris4d)
+		basic_machine=mips-sgi
+		case $os in
+		    -irix*)
+			;;
+		    *)
+			os=-irix4
+			;;
+		esac
+		;;
+	isi68 | isi)
+		basic_machine=m68k-isi
+		os=-sysv
+		;;
+	m68knommu)
+		basic_machine=m68k-unknown
+		os=-linux
+		;;
+	m68knommu-*)
+		basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	m88k-omron*)
+		basic_machine=m88k-omron
+		;;
+	magnum | m3230)
+		basic_machine=mips-mips
+		os=-sysv
+		;;
+	merlin)
+		basic_machine=ns32k-utek
+		os=-sysv
+		;;
+	microblaze)
+		basic_machine=microblaze-xilinx
+		;;
+	mingw32)
+		basic_machine=i386-pc
+		os=-mingw32
+		;;
+	mingw32ce)
+		basic_machine=arm-unknown
+		os=-mingw32ce
+		;;
+	miniframe)
+		basic_machine=m68000-convergent
+		;;
+	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+	mips3*-*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		;;
+	mips3*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		;;
+	monitor)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	morphos)
+		basic_machine=powerpc-unknown
+		os=-morphos
+		;;
+	msdos)
+		basic_machine=i386-pc
+		os=-msdos
+		;;
+	ms1-*)
+		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+		;;
+	mvs)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
+	ncr3000)
+		basic_machine=i486-ncr
+		os=-sysv4
+		;;
+	netbsd386)
+		basic_machine=i386-unknown
+		os=-netbsd
+		;;
+	netwinder)
+		basic_machine=armv4l-rebel
+		os=-linux
+		;;
+	news | news700 | news800 | news900)
+		basic_machine=m68k-sony
+		os=-newsos
+		;;
+	news1000)
+		basic_machine=m68030-sony
+		os=-newsos
+		;;
+	news-3600 | risc-news)
+		basic_machine=mips-sony
+		os=-newsos
+		;;
+	necv70)
+		basic_machine=v70-nec
+		os=-sysv
+		;;
+	next | m*-next )
+		basic_machine=m68k-next
+		case $os in
+		    -nextstep* )
+			;;
+		    -ns2*)
+		      os=-nextstep2
+			;;
+		    *)
+		      os=-nextstep3
+			;;
+		esac
+		;;
+	nh3000)
+		basic_machine=m68k-harris
+		os=-cxux
+		;;
+	nh[45]000)
+		basic_machine=m88k-harris
+		os=-cxux
+		;;
+	nindy960)
+		basic_machine=i960-intel
+		os=-nindy
+		;;
+	mon960)
+		basic_machine=i960-intel
+		os=-mon960
+		;;
+	nonstopux)
+		basic_machine=mips-compaq
+		os=-nonstopux
+		;;
+	np1)
+		basic_machine=np1-gould
+		;;
+	neo-tandem)
+		basic_machine=neo-tandem
+		;;
+	nse-tandem)
+		basic_machine=nse-tandem
+		;;
+	nsr-tandem)
+		basic_machine=nsr-tandem
+		;;
+	op50n-* | op60c-*)
+		basic_machine=hppa1.1-oki
+		os=-proelf
+		;;
+	openrisc | openrisc-*)
+		basic_machine=or32-unknown
+		;;
+	os400)
+		basic_machine=powerpc-ibm
+		os=-os400
+		;;
+	OSE68000 | ose68000)
+		basic_machine=m68000-ericsson
+		os=-ose
+		;;
+	os68k)
+		basic_machine=m68k-none
+		os=-os68k
+		;;
+	pa-hitachi)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	paragon)
+		basic_machine=i860-intel
+		os=-osf
+		;;
+	parisc)
+		basic_machine=hppa-unknown
+		os=-linux
+		;;
+	parisc-*)
+		basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
+		os=-linux
+		;;
+	pbd)
+		basic_machine=sparc-tti
+		;;
+	pbb)
+		basic_machine=m68k-tti
+		;;
+	pc532 | pc532-*)
+		basic_machine=ns32k-pc532
+		;;
+	pc98)
+		basic_machine=i386-pc
+		;;
+	pc98-*)
+		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium | p5 | k5 | k6 | nexgen | viac3)
+		basic_machine=i586-pc
+		;;
+	pentiumpro | p6 | 6x86 | athlon | athlon_*)
+		basic_machine=i686-pc
+		;;
+	pentiumii | pentium2 | pentiumiii | pentium3)
+		basic_machine=i686-pc
+		;;
+	pentium4)
+		basic_machine=i786-pc
+		;;
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium4-*)
+		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pn)
+		basic_machine=pn-gould
+		;;
+	power)	basic_machine=power-ibm
+		;;
+	ppc | ppcbe)	basic_machine=powerpc-unknown
+		;;
+	ppc-* | ppcbe-*)
+		basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppcle | powerpclittle | ppc-le | powerpc-little)
+		basic_machine=powerpcle-unknown
+		;;
+	ppcle-* | powerpclittle-*)
+		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64)	basic_machine=powerpc64-unknown
+		;;
+	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+		basic_machine=powerpc64le-unknown
+		;;
+	ppc64le-* | powerpc64little-*)
+		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ps2)
+		basic_machine=i386-ibm
+		;;
+	pw32)
+		basic_machine=i586-unknown
+		os=-pw32
+		;;
+	rdos)
+		basic_machine=i386-pc
+		os=-rdos
+		;;
+	rom68k)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	rm[46]00)
+		basic_machine=mips-siemens
+		;;
+	rtpc | rtpc-*)
+		basic_machine=romp-ibm
+		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
+	sa29200)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	sb1)
+		basic_machine=mipsisa64sb1-unknown
+		;;
+	sb1el)
+		basic_machine=mipsisa64sb1el-unknown
+		;;
+	sde)
+		basic_machine=mipsisa32-sde
+		os=-elf
+		;;
+	sei)
+		basic_machine=mips-sei
+		os=-seiux
+		;;
+	sequent)
+		basic_machine=i386-sequent
+		;;
+	sh)
+		basic_machine=sh-hitachi
+		os=-hms
+		;;
+	sh5el)
+		basic_machine=sh5le-unknown
+		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparclite-wrs | simso-wrs)
+		basic_machine=sparclite-wrs
+		os=-vxworks
+		;;
+	sps7)
+		basic_machine=m68k-bull
+		os=-sysv2
+		;;
+	spur)
+		basic_machine=spur-unknown
+		;;
+	st2000)
+		basic_machine=m68k-tandem
+		;;
+	stratus)
+		basic_machine=i860-stratus
+		os=-sysv4
+		;;
+	strongarm-* | thumb-*)
+		basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	sun2)
+		basic_machine=m68000-sun
+		;;
+	sun2os3)
+		basic_machine=m68000-sun
+		os=-sunos3
+		;;
+	sun2os4)
+		basic_machine=m68000-sun
+		os=-sunos4
+		;;
+	sun3os3)
+		basic_machine=m68k-sun
+		os=-sunos3
+		;;
+	sun3os4)
+		basic_machine=m68k-sun
+		os=-sunos4
+		;;
+	sun4os3)
+		basic_machine=sparc-sun
+		os=-sunos3
+		;;
+	sun4os4)
+		basic_machine=sparc-sun
+		os=-sunos4
+		;;
+	sun4sol2)
+		basic_machine=sparc-sun
+		os=-solaris2
+		;;
+	sun3 | sun3-*)
+		basic_machine=m68k-sun
+		;;
+	sun4)
+		basic_machine=sparc-sun
+		;;
+	sun386 | sun386i | roadrunner)
+		basic_machine=i386-sun
+		;;
+	sv1)
+		basic_machine=sv1-cray
+		os=-unicos
+		;;
+	symmetry)
+		basic_machine=i386-sequent
+		os=-dynix
+		;;
+	t3e)
+		basic_machine=alphaev5-cray
+		os=-unicos
+		;;
+	t90)
+		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
+		os=-linux-gnu
+		;;
+	tx39)
+		basic_machine=mipstx39-unknown
+		;;
+	tx39el)
+		basic_machine=mipstx39el-unknown
+		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
+	tower | tower-32)
+		basic_machine=m68k-ncr
+		;;
+	tpf)
+		basic_machine=s390x-ibm
+		os=-tpf
+		;;
+	udi29k)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	ultra3)
+		basic_machine=a29k-nyu
+		os=-sym1
+		;;
+	v810 | necv810)
+		basic_machine=v810-nec
+		os=-none
+		;;
+	vaxv)
+		basic_machine=vax-dec
+		os=-sysv
+		;;
+	vms)
+		basic_machine=vax-dec
+		os=-vms
+		;;
+	vpp*|vx|vx-*)
+		basic_machine=f301-fujitsu
+		;;
+	vxworks960)
+		basic_machine=i960-wrs
+		os=-vxworks
+		;;
+	vxworks68)
+		basic_machine=m68k-wrs
+		os=-vxworks
+		;;
+	vxworks29k)
+		basic_machine=a29k-wrs
+		os=-vxworks
+		;;
+	w65*)
+		basic_machine=w65-wdc
+		os=-none
+		;;
+	w89k-*)
+		basic_machine=hppa1.1-winbond
+		os=-proelf
+		;;
+	xbox)
+		basic_machine=i686-pc
+		os=-mingw32
+		;;
+	xps | xps100)
+		basic_machine=xps100-honeywell
+		;;
+	xscale-* | xscalee[bl]-*)
+		basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
+		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
+	z8k-*-coff)
+		basic_machine=z8k-unknown
+		os=-sim
+		;;
+	z80-*-coff)
+		basic_machine=z80-unknown
+		os=-sim
+		;;
+	none)
+		basic_machine=none-none
+		os=-none
+		;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		basic_machine=hppa1.1-winbond
+		;;
+	op50n)
+		basic_machine=hppa1.1-oki
+		;;
+	op60c)
+		basic_machine=hppa1.1-oki
+		;;
+	romp)
+		basic_machine=romp-ibm
+		;;
+	mmix)
+		basic_machine=mmix-knuth
+		;;
+	rs6000)
+		basic_machine=rs6000-ibm
+		;;
+	vax)
+		basic_machine=vax-dec
+		;;
+	pdp10)
+		# there are many clones, so DEC is not a safe bet
+		basic_machine=pdp10-unknown
+		;;
+	pdp11)
+		basic_machine=pdp11-dec
+		;;
+	we32k)
+		basic_machine=we32k-att
+		;;
+	sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+		basic_machine=sh-unknown
+		;;
+	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+		basic_machine=sparc-sun
+		;;
+	cydra)
+		basic_machine=cydra-cydrome
+		;;
+	orion)
+		basic_machine=orion-highlevel
+		;;
+	orion105)
+		basic_machine=clipper-highlevel
+		;;
+	mac | mpw | mac-mpw)
+		basic_machine=m68k-apple
+		;;
+	pmac | pmac-mpw)
+		basic_machine=powerpc-apple
+		;;
+	*-unknown)
+		# Make sure to match an already-canonicalized machine name.
+		;;
+	*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+	*-digital*)
+		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+		;;
+	*-commodore*)
+		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+		;;
+	*)
+		;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+	# First match some system type aliases
+	# that might get confused with valid system types.
+	# -solaris* is a basic system type, with this one exception.
+	-auroraux)
+		os=-auroraux
+		;;
+	-solaris1 | -solaris1.*)
+		os=`echo $os | sed -e 's|solaris1|sunos4|'`
+		;;
+	-solaris)
+		os=-solaris2
+		;;
+	-svr4*)
+		os=-sysv4
+		;;
+	-unixware*)
+		os=-sysv4.2uw
+		;;
+	-gnu/linux*)
+		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+		;;
+	# First accept the basic system types.
+	# The portable systems comes first.
+	# Each alternative MUST END IN A *, to match a version number.
+	# -sysv* is not here because it comes later, after sysvr4.
+	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+	      | -sym* | -kopensolaris* \
+	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+	      | -aos* | -aros* \
+	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+	      | -openbsd* | -solidbsd* \
+	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -chorusos* | -chorusrdb* | -cegcc* \
+	      | -cygwin* | -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* \
+	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
+	# Remember, each alternative MUST END IN *, to match a version number.
+		;;
+	-qnx*)
+		case $basic_machine in
+		    x86-* | i*86-*)
+			;;
+		    *)
+			os=-nto$os
+			;;
+		esac
+		;;
+	-nto-qnx*)
+		;;
+	-nto*)
+		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+		;;
+	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+		;;
+	-mac*)
+		os=`echo $os | sed -e 's|mac|macos|'`
+		;;
+	-linux-dietlibc)
+		os=-linux-dietlibc
+		;;
+	-linux*)
+		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+		;;
+	-sunos5*)
+		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		;;
+	-sunos6*)
+		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		;;
+	-opened*)
+		os=-openedition
+		;;
+	-os400*)
+		os=-os400
+		;;
+	-wince*)
+		os=-wince
+		;;
+	-osfrose*)
+		os=-osfrose
+		;;
+	-osf*)
+		os=-osf
+		;;
+	-utek*)
+		os=-bsd
+		;;
+	-dynix*)
+		os=-bsd
+		;;
+	-acis*)
+		os=-aos
+		;;
+	-atheos*)
+		os=-atheos
+		;;
+	-syllable*)
+		os=-syllable
+		;;
+	-386bsd)
+		os=-bsd
+		;;
+	-ctix* | -uts*)
+		os=-sysv
+		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
+	-ns2 )
+		os=-nextstep2
+		;;
+	-nsk*)
+		os=-nsk
+		;;
+	# Preserve the version number of sinix5.
+	-sinix5.*)
+		os=`echo $os | sed -e 's|sinix|sysv|'`
+		;;
+	-sinix*)
+		os=-sysv4
+		;;
+	-tpf*)
+		os=-tpf
+		;;
+	-triton*)
+		os=-sysv3
+		;;
+	-oss*)
+		os=-sysv3
+		;;
+	-svr4)
+		os=-sysv4
+		;;
+	-svr3)
+		os=-sysv3
+		;;
+	-sysvr4)
+		os=-sysv4
+		;;
+	# This must come after -sysvr4.
+	-sysv*)
+		;;
+	-ose*)
+		os=-ose
+		;;
+	-es1800*)
+		os=-ose
+		;;
+	-xenix)
+		os=-xenix
+		;;
+	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+		os=-mint
+		;;
+	-aros*)
+		os=-aros
+		;;
+	-kaos*)
+		os=-kaos
+		;;
+	-zvmoe)
+		os=-zvmoe
+		;;
+	-dicos*)
+		os=-dicos
+		;;
+	-nacl*)
+		;;
+	-none)
+		;;
+	*)
+		# Get rid of the `-' at the beginning of $os.
+		os=`echo $os | sed 's/[^-]*-//'`
+		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+		exit 1
+		;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+	score-*)
+		os=-elf
+		;;
+	spu-*)
+		os=-elf
+		;;
+	*-acorn)
+		os=-riscix1.2
+		;;
+	arm*-rebel)
+		os=-linux
+		;;
+	arm*-semi)
+		os=-aout
+		;;
+	c4x-* | tic4x-*)
+		os=-coff
+		;;
+	tic54x-*)
+		os=-coff
+		;;
+	tic55x-*)
+		os=-coff
+		;;
+	tic6x-*)
+		os=-coff
+		;;
+	# This must come before the *-dec entry.
+	pdp10-*)
+		os=-tops20
+		;;
+	pdp11-*)
+		os=-none
+		;;
+	*-dec | vax-*)
+		os=-ultrix4.2
+		;;
+	m68*-apollo)
+		os=-domain
+		;;
+	i386-sun)
+		os=-sunos4.0.2
+		;;
+	m68000-sun)
+		os=-sunos3
+		# This also exists in the configure program, but was not the
+		# default.
+		# os=-sunos4
+		;;
+	m68*-cisco)
+		os=-aout
+		;;
+	mep-*)
+		os=-elf
+		;;
+	mips*-cisco)
+		os=-elf
+		;;
+	mips*-*)
+		os=-elf
+		;;
+	or32-*)
+		os=-coff
+		;;
+	*-tti)	# must be before sparc entry or we get the wrong os.
+		os=-sysv3
+		;;
+	sparc-* | *-sun)
+		os=-sunos4.1.1
+		;;
+	*-be)
+		os=-beos
+		;;
+	*-haiku)
+		os=-haiku
+		;;
+	*-ibm)
+		os=-aix
+		;;
+	*-knuth)
+		os=-mmixware
+		;;
+	*-wec)
+		os=-proelf
+		;;
+	*-winbond)
+		os=-proelf
+		;;
+	*-oki)
+		os=-proelf
+		;;
+	*-hp)
+		os=-hpux
+		;;
+	*-hitachi)
+		os=-hiux
+		;;
+	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+		os=-sysv
+		;;
+	*-cbm)
+		os=-amigaos
+		;;
+	*-dg)
+		os=-dgux
+		;;
+	*-dolphin)
+		os=-sysv3
+		;;
+	m68k-ccur)
+		os=-rtu
+		;;
+	m88k-omron*)
+		os=-luna
+		;;
+	*-next )
+		os=-nextstep
+		;;
+	*-sequent)
+		os=-ptx
+		;;
+	*-crds)
+		os=-unos
+		;;
+	*-ns)
+		os=-genix
+		;;
+	i370-*)
+		os=-mvs
+		;;
+	*-next)
+		os=-nextstep3
+		;;
+	*-gould)
+		os=-sysv
+		;;
+	*-highlevel)
+		os=-bsd
+		;;
+	*-encore)
+		os=-bsd
+		;;
+	*-sgi)
+		os=-irix
+		;;
+	*-siemens)
+		os=-sysv4
+		;;
+	*-masscomp)
+		os=-rtu
+		;;
+	f30[01]-fujitsu | f700-fujitsu)
+		os=-uxpv
+		;;
+	*-rom68k)
+		os=-coff
+		;;
+	*-*bug)
+		os=-coff
+		;;
+	*-apple)
+		os=-macos
+		;;
+	*-atari*)
+		os=-mint
+		;;
+	*)
+		os=-none
+		;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+	*-unknown)
+		case $os in
+			-riscix*)
+				vendor=acorn
+				;;
+			-sunos*)
+				vendor=sun
+				;;
+			-cnk*|-aix*)
+				vendor=ibm
+				;;
+			-beos*)
+				vendor=be
+				;;
+			-hpux*)
+				vendor=hp
+				;;
+			-mpeix*)
+				vendor=hp
+				;;
+			-hiux*)
+				vendor=hitachi
+				;;
+			-unos*)
+				vendor=crds
+				;;
+			-dgux*)
+				vendor=dg
+				;;
+			-luna*)
+				vendor=omron
+				;;
+			-genix*)
+				vendor=ns
+				;;
+			-mvs* | -opened*)
+				vendor=ibm
+				;;
+			-os400*)
+				vendor=ibm
+				;;
+			-ptx*)
+				vendor=sequent
+				;;
+			-tpf*)
+				vendor=ibm
+				;;
+			-vxsim* | -vxworks* | -windiss*)
+				vendor=wrs
+				;;
+			-aux*)
+				vendor=apple
+				;;
+			-hms*)
+				vendor=hitachi
+				;;
+			-mpw* | -macos*)
+				vendor=apple
+				;;
+			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+				vendor=atari
+				;;
+			-vos*)
+				vendor=stratus
+				;;
+		esac
+		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/build-aux/install-sh b/build-aux/install-sh
new file mode 100755
index 0000000..6781b98
--- /dev/null
+++ b/build-aux/install-sh
@@ -0,0 +1,520 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2009-04-28.21; # UTC
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+nl='
+'
+IFS=" ""	$nl"
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit=${DOITPROG-}
+if test -z "$doit"; then
+  doit_exec=exec
+else
+  doit_exec=$doit
+fi
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_glob='?'
+initialize_posix_glob='
+  test "$posix_glob" != "?" || {
+    if (set -f) 2>/dev/null; then
+      posix_glob=
+    else
+      posix_glob=:
+    fi
+  }
+'
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+no_target_directory=
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+   or: $0 [OPTION]... SRCFILES... DIRECTORY
+   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+   or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+     --help     display this help and exit.
+     --version  display version info and exit.
+
+  -c            (ignored)
+  -C            install only if different (preserve the last data modification time)
+  -d            create directories instead of installing files.
+  -g GROUP      $chgrpprog installed files to GROUP.
+  -m MODE       $chmodprog installed files to MODE.
+  -o USER       $chownprog installed files to USER.
+  -s            $stripprog installed files.
+  -t DIRECTORY  install into DIRECTORY.
+  -T            report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+  RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+  case $1 in
+    -c) ;;
+
+    -C) copy_on_change=true;;
+
+    -d) dir_arg=true;;
+
+    -g) chgrpcmd="$chgrpprog $2"
+	shift;;
+
+    --help) echo "$usage"; exit $?;;
+
+    -m) mode=$2
+	case $mode in
+	  *' '* | *'	'* | *'
+'*	  | *'*'* | *'?'* | *'['*)
+	    echo "$0: invalid mode: $mode" >&2
+	    exit 1;;
+	esac
+	shift;;
+
+    -o) chowncmd="$chownprog $2"
+	shift;;
+
+    -s) stripcmd=$stripprog;;
+
+    -t) dst_arg=$2
+	shift;;
+
+    -T) no_target_directory=true;;
+
+    --version) echo "$0 $scriptversion"; exit $?;;
+
+    --)	shift
+	break;;
+
+    -*)	echo "$0: invalid option: $1" >&2
+	exit 1;;
+
+    *)  break;;
+  esac
+  shift
+done
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+  # When -d is used, all remaining arguments are directories to create.
+  # When -t is used, the destination is already specified.
+  # Otherwise, the last argument is the destination.  Remove it from $@.
+  for arg
+  do
+    if test -n "$dst_arg"; then
+      # $@ is not empty: it contains at least $arg.
+      set fnord "$@" "$dst_arg"
+      shift # fnord
+    fi
+    shift # arg
+    dst_arg=$arg
+  done
+fi
+
+if test $# -eq 0; then
+  if test -z "$dir_arg"; then
+    echo "$0: no input file specified." >&2
+    exit 1
+  fi
+  # It's OK to call `install-sh -d' without argument.
+  # This can happen when creating conditional directories.
+  exit 0
+fi
+
+if test -z "$dir_arg"; then
+  trap '(exit $?); exit' 1 2 13 15
+
+  # Set umask so as not to create temps with too-generous modes.
+  # However, 'strip' requires both read and write access to temps.
+  case $mode in
+    # Optimize common cases.
+    *644) cp_umask=133;;
+    *755) cp_umask=22;;
+
+    *[0-7])
+      if test -z "$stripcmd"; then
+	u_plus_rw=
+      else
+	u_plus_rw='% 200'
+      fi
+      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+    *)
+      if test -z "$stripcmd"; then
+	u_plus_rw=
+      else
+	u_plus_rw=,u+rw
+      fi
+      cp_umask=$mode$u_plus_rw;;
+  esac
+fi
+
+for src
+do
+  # Protect names starting with `-'.
+  case $src in
+    -*) src=./$src;;
+  esac
+
+  if test -n "$dir_arg"; then
+    dst=$src
+    dstdir=$dst
+    test -d "$dstdir"
+    dstdir_status=$?
+  else
+
+    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+    # might cause directories to be created, which would be especially bad
+    # if $src (and thus $dsttmp) contains '*'.
+    if test ! -f "$src" && test ! -d "$src"; then
+      echo "$0: $src does not exist." >&2
+      exit 1
+    fi
+
+    if test -z "$dst_arg"; then
+      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.
+    if test -d "$dst"; then
+      if test -n "$no_target_directory"; then
+	echo "$0: $dst_arg: Is a directory" >&2
+	exit 1
+      fi
+      dstdir=$dst
+      dst=$dstdir/`basename "$src"`
+      dstdir_status=0
+    else
+      # Prefer dirname, but fall back on a substitute if dirname fails.
+      dstdir=`
+	(dirname "$dst") 2>/dev/null ||
+	expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	     X"$dst" : 'X\(//\)[^/]' \| \
+	     X"$dst" : 'X\(//\)$' \| \
+	     X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+	echo X"$dst" |
+	    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\/\)[^/].*/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\/\)$/{
+		   s//\1/
+		   q
+		 }
+		 /^X\(\/\).*/{
+		   s//\1/
+		   q
+		 }
+		 s/.*/./; q'
+      `
+
+      test -d "$dstdir"
+      dstdir_status=$?
+    fi
+  fi
+
+  obsolete_mkdir_used=false
+
+  if test $dstdir_status != 0; then
+    case $posix_mkdir in
+      '')
+	# Create intermediate dirs using mode 755 as modified by the umask.
+	# This is like FreeBSD 'install' as of 1997-10-28.
+	umask=`umask`
+	case $stripcmd.$umask in
+	  # Optimize common cases.
+	  *[2367][2367]) mkdir_umask=$umask;;
+	  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+	  *[0-7])
+	    mkdir_umask=`expr $umask + 22 \
+	      - $umask % 100 % 40 + $umask % 20 \
+	      - $umask % 10 % 4 + $umask % 2
+	    `;;
+	  *) mkdir_umask=$umask,go-w;;
+	esac
+
+	# With -d, create the new directory with the user-specified mode.
+	# Otherwise, rely on $mkdir_umask.
+	if test -n "$dir_arg"; then
+	  mkdir_mode=-m$mode
+	else
+	  mkdir_mode=
+	fi
+
+	posix_mkdir=false
+	case $umask in
+	  *[123567][0-7][0-7])
+	    # POSIX mkdir -p sets u+wx bits regardless of umask, which
+	    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+	    ;;
+	  *)
+	    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+	    trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+	    if (umask $mkdir_umask &&
+		exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+	    then
+	      if test -z "$dir_arg" || {
+		   # Check for POSIX incompatibilities with -m.
+		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+		   # other-writeable bit of parent directory when it shouldn't.
+		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
+		   case $ls_ld_tmpdir in
+		     d????-?r-*) different_mode=700;;
+		     d????-?--*) different_mode=755;;
+		     *) false;;
+		   esac &&
+		   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+		     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+		     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+		   }
+		 }
+	      then posix_mkdir=:
+	      fi
+	      rmdir "$tmpdir/d" "$tmpdir"
+	    else
+	      # Remove any dirs left behind by ancient mkdir implementations.
+	      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+	    fi
+	    trap '' 0;;
+	esac;;
+    esac
+
+    if
+      $posix_mkdir && (
+	umask $mkdir_umask &&
+	$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+      )
+    then :
+    else
+
+      # The umask is ridiculous, or mkdir does not conform to POSIX,
+      # or it failed possibly due to a race condition.  Create the
+      # directory the slow way, step by step, checking for races as we go.
+
+      case $dstdir in
+	/*) prefix='/';;
+	-*) prefix='./';;
+	*)  prefix='';;
+      esac
+
+      eval "$initialize_posix_glob"
+
+      oIFS=$IFS
+      IFS=/
+      $posix_glob set -f
+      set fnord $dstdir
+      shift
+      $posix_glob set +f
+      IFS=$oIFS
+
+      prefixes=
+
+      for d
+      do
+	test -z "$d" && continue
+
+	prefix=$prefix$d
+	if test -d "$prefix"; then
+	  prefixes=
+	else
+	  if $posix_mkdir; then
+	    (umask=$mkdir_umask &&
+	     $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+	    # Don't fail if two instances are running concurrently.
+	    test -d "$prefix" || exit 1
+	  else
+	    case $prefix in
+	      *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+	      *) qprefix=$prefix;;
+	    esac
+	    prefixes="$prefixes '$qprefix'"
+	  fi
+	fi
+	prefix=$prefix/
+      done
+
+      if test -n "$prefixes"; then
+	# Don't fail if two instances are running concurrently.
+	(umask $mkdir_umask &&
+	 eval "\$doit_exec \$mkdirprog $prefixes") ||
+	  test -d "$dstdir" || exit 1
+	obsolete_mkdir_used=true
+      fi
+    fi
+  fi
+
+  if test -n "$dir_arg"; then
+    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+  else
+
+    # Make a couple of temp file names in the proper directory.
+    dsttmp=$dstdir/_inst.$$_
+    rmtmp=$dstdir/_rm.$$_
+
+    # Trap to clean up those temp files at exit.
+    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+    # Copy the file name to the temp name.
+    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+    # and set any options; do chmod last to preserve setuid bits.
+    #
+    # If any of these fail, we abort the whole thing.  If we want to
+    # ignore errors from any of these, just make sure not to ignore
+    # errors from the above "$doit $cpprog $src $dsttmp" command.
+    #
+    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+    # If -C, don't bother to copy if it wouldn't change the file.
+    if $copy_on_change &&
+       old=`LC_ALL=C ls -dlL "$dst"	2>/dev/null` &&
+       new=`LC_ALL=C ls -dlL "$dsttmp"	2>/dev/null` &&
+
+       eval "$initialize_posix_glob" &&
+       $posix_glob set -f &&
+       set X $old && old=:$2:$4:$5:$6 &&
+       set X $new && new=:$2:$4:$5:$6 &&
+       $posix_glob set +f &&
+
+       test "$old" = "$new" &&
+       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+    then
+      rm -f "$dsttmp"
+    else
+      # Rename the file to the real destination.
+      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+      # The rename failed, perhaps because mv can't rename something else
+      # to itself, or perhaps because mv is so ancient that it does not
+      # support -f.
+      {
+	# Now remove or move aside any old file at destination location.
+	# We try this two ways since rm can't unlink itself on some
+	# systems and the destination file might be busy for other
+	# reasons.  In this case, the final cleanup might fail but the new
+	# file should still install successfully.
+	{
+	  test ! -f "$dst" ||
+	  $doit $rmcmd -f "$dst" 2>/dev/null ||
+	  { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+	    { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+	  } ||
+	  { echo "$0: cannot unlink or rename $dst" >&2
+	    (exit 1); exit 1
+	  }
+	} &&
+
+	# Now rename the file to the real destination.
+	$doit $mvcmd "$dsttmp" "$dst"
+      }
+    fi || exit 1
+
+    trap '' 0
+  fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/build-aux/ltmain.sh b/build-aux/ltmain.sh
new file mode 100755
index 0000000..6f650ae
--- /dev/null
+++ b/build-aux/ltmain.sh
@@ -0,0 +1,9642 @@
+
+# libtool (GNU libtool) 2.4
+# Written by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
+# 2007, 2008, 2009, 2010 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.
+
+# GNU Libtool is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html,
+# or obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# Usage: $progname [OPTION]... [MODE-ARG]...
+#
+# Provide generalized library-building support services.
+#
+#       --config             show all configuration variables
+#       --debug              enable verbose shell tracing
+#   -n, --dry-run            display commands without modifying any files
+#       --features           display basic configuration information and exit
+#       --mode=MODE          use operation mode MODE
+#       --preserve-dup-deps  don't remove duplicate dependency libraries
+#       --quiet, --silent    don't print informational messages
+#       --no-quiet, --no-silent
+#                            print informational messages (default)
+#       --tag=TAG            use configuration variables from tag TAG
+#   -v, --verbose            print more informational messages than default
+#       --no-verbose         don't print the extra informational messages
+#       --version            print version information
+#   -h, --help, --help-all   print short, long, or detailed help message
+#
+# MODE must be one of the following:
+#
+#         clean              remove files from the build directory
+#         compile            compile a source file into a libtool object
+#         execute            automatically set library path, then run a program
+#         finish             complete the installation of libtool libraries
+#         install            install libraries or executables
+#         link               create a library or an executable
+#         uninstall          remove libraries from an installed directory
+#
+# MODE-ARGS vary depending on the MODE.  When passed as first option,
+# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
+# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
+#
+# When reporting a bug, please describe a test case to reproduce it and
+# include the following information:
+#
+#         host-triplet:	$host
+#         shell:		$SHELL
+#         compiler:		$LTCC
+#         compiler flags:		$LTCFLAGS
+#         linker:		$LD (gnu? $with_gnu_ld)
+#         $progname:	(GNU libtool) 2.4 Debian-2.4-2
+#         automake:	$automake_version
+#         autoconf:	$autoconf_version
+#
+# Report bugs to <bug-libtool at gnu.org>.
+# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
+# General help using GNU software: <http://www.gnu.org/gethelp/>.
+
+PROGRAM=libtool
+PACKAGE=libtool
+VERSION="2.4 Debian-2.4-2"
+TIMESTAMP=""
+package_revision=1.3293
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+}
+
+# NLS nuisances: We save the old values to restore during execute mode.
+lt_user_locale=
+lt_safe_locale=
+for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+do
+  eval "if test \"\${$lt_var+set}\" = set; then
+          save_$lt_var=\$$lt_var
+          $lt_var=C
+	  export $lt_var
+	  lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
+	  lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
+	fi"
+done
+LC_ALL=C
+LANGUAGE=C
+export LANGUAGE LC_ALL
+
+$lt_unset CDPATH
+
+
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+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"}
+: ${LN_S="ln -s"}
+: ${MAKE="make"}
+: ${MKDIR="mkdir"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+: ${SED="/bin/sed"}
+: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
+: ${Xsed="$SED -e 1s/^X//"}
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
+EXIT_SKIP=77	  # $? = 77 is used to indicate a skipped test to automake.
+
+exit_status=$EXIT_SUCCESS
+
+# Make sure IFS has a sensible default
+lt_nl='
+'
+IFS=" 	$lt_nl"
+
+dirname="s,/[^/]*$,,"
+basename="s,^.*/,,"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+    func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
+    if test "X$func_dirname_result" = "X${1}"; then
+      func_dirname_result="${3}"
+    else
+      func_dirname_result="$func_dirname_result${2}"
+    fi
+} # func_dirname may be replaced by extended shell implementation
+
+
+# func_basename file
+func_basename ()
+{
+    func_basename_result=`$ECHO "${1}" | $SED "$basename"`
+} # func_basename may be replaced by extended shell implementation
+
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+#   dirname:  Compute the dirname of FILE.  If nonempty,
+#             add APPEND to the result, otherwise set result
+#             to NONDIR_REPLACEMENT.
+#             value returned in "$func_dirname_result"
+#   basename: Compute filename of FILE.
+#             value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+    # Extract subdirectory from the argument.
+    func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
+    if test "X$func_dirname_result" = "X${1}"; then
+      func_dirname_result="${3}"
+    else
+      func_dirname_result="$func_dirname_result${2}"
+    fi
+    func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
+} # func_dirname_and_basename may be replaced by extended shell implementation
+
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+    case ${2} in
+      .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+      *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+    esac
+} # func_stripname may be replaced by extended shell implementation
+
+
+# These SED scripts presuppose an absolute path with a trailing slash.
+pathcar='s,^/\([^/]*\).*$,\1,'
+pathcdr='s,^/[^/]*,,'
+removedotparts=':dotsl
+		s@/\./@/@g
+		t dotsl
+		s,/\.$,/,'
+collapseslashes='s@/\{1,\}@/@g'
+finalslash='s,/*$,/,'
+
+# func_normal_abspath PATH
+# Remove doubled-up and trailing slashes, "." path components,
+# and cancel out any ".." path components in PATH after making
+# it an absolute path.
+#             value returned in "$func_normal_abspath_result"
+func_normal_abspath ()
+{
+  # Start from root dir and reassemble the path.
+  func_normal_abspath_result=
+  func_normal_abspath_tpath=$1
+  func_normal_abspath_altnamespace=
+  case $func_normal_abspath_tpath in
+    "")
+      # Empty path, that just means $cwd.
+      func_stripname '' '/' "`pwd`"
+      func_normal_abspath_result=$func_stripname_result
+      return
+    ;;
+    # The next three entries are used to spot a run of precisely
+    # two leading slashes without using negated character classes;
+    # we take advantage of case's first-match behaviour.
+    ///*)
+      # Unusual form of absolute path, do nothing.
+    ;;
+    //*)
+      # Not necessarily an ordinary path; POSIX reserves leading '//'
+      # and for example Cygwin uses it to access remote file shares
+      # over CIFS/SMB, so we conserve a leading double slash if found.
+      func_normal_abspath_altnamespace=/
+    ;;
+    /*)
+      # Absolute path, do nothing.
+    ;;
+    *)
+      # Relative path, prepend $cwd.
+      func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
+    ;;
+  esac
+  # Cancel out all the simple stuff to save iterations.  We also want
+  # the path to end with a slash for ease of parsing, so make sure
+  # there is one (and only one) here.
+  func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
+  while :; do
+    # Processed it all yet?
+    if test "$func_normal_abspath_tpath" = / ; then
+      # If we ascended to the root using ".." the result may be empty now.
+      if test -z "$func_normal_abspath_result" ; then
+        func_normal_abspath_result=/
+      fi
+      break
+    fi
+    func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$pathcar"`
+    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
+        -e "$pathcdr"`
+    # Figure out what to do with it
+    case $func_normal_abspath_tcomponent in
+      "")
+        # Trailing empty path component, ignore it.
+      ;;
+      ..)
+        # Parent dir; strip last assembled component from result.
+        func_dirname "$func_normal_abspath_result"
+        func_normal_abspath_result=$func_dirname_result
+      ;;
+      *)
+        # Actual path component, append it.
+        func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
+      ;;
+    esac
+  done
+  # Restore leading double-slash if one was found on entry.
+  func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
+}
+
+# func_relative_path SRCDIR DSTDIR
+# generates a relative path from SRCDIR to DSTDIR, with a trailing
+# slash if non-empty, suitable for immediately appending a filename
+# without needing to append a separator.
+#             value returned in "$func_relative_path_result"
+func_relative_path ()
+{
+  func_relative_path_result=
+  func_normal_abspath "$1"
+  func_relative_path_tlibdir=$func_normal_abspath_result
+  func_normal_abspath "$2"
+  func_relative_path_tbindir=$func_normal_abspath_result
+
+  # Ascend the tree starting from libdir
+  while :; do
+    # check if we have found a prefix of bindir
+    case $func_relative_path_tbindir in
+      $func_relative_path_tlibdir)
+        # found an exact match
+        func_relative_path_tcancelled=
+        break
+        ;;
+      $func_relative_path_tlibdir*)
+        # found a matching prefix
+        func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
+        func_relative_path_tcancelled=$func_stripname_result
+        if test -z "$func_relative_path_result"; then
+          func_relative_path_result=.
+        fi
+        break
+        ;;
+      *)
+        func_dirname $func_relative_path_tlibdir
+        func_relative_path_tlibdir=${func_dirname_result}
+        if test "x$func_relative_path_tlibdir" = x ; then
+          # Have to descend all the way to the root!
+          func_relative_path_result=../$func_relative_path_result
+          func_relative_path_tcancelled=$func_relative_path_tbindir
+          break
+        fi
+        func_relative_path_result=../$func_relative_path_result
+        ;;
+    esac
+  done
+
+  # Now calculate path; take care to avoid doubling-up slashes.
+  func_stripname '' '/' "$func_relative_path_result"
+  func_relative_path_result=$func_stripname_result
+  func_stripname '/' '/' "$func_relative_path_tcancelled"
+  if test "x$func_stripname_result" != x ; then
+    func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
+  fi
+
+  # Normalisation. If bindir is libdir, return empty string,
+  # else relative path ending with a slash; either way, target
+  # file name can be directly appended.
+  if test ! -z "$func_relative_path_result"; then
+    func_stripname './' '' "$func_relative_path_result/"
+    func_relative_path_result=$func_stripname_result
+  fi
+}
+
+# The name of this program:
+func_dirname_and_basename "$progpath"
+progname=$func_basename_result
+
+# Make sure we have an absolute path for reexecution:
+case $progpath in
+  [\\/]*|[A-Za-z]:\\*) ;;
+  *[\\/]*)
+     progdir=$func_dirname_result
+     progdir=`cd "$progdir" && pwd`
+     progpath="$progdir/$progname"
+     ;;
+  *)
+     save_IFS="$IFS"
+     IFS=:
+     for progdir in $PATH; do
+       IFS="$save_IFS"
+       test -x "$progdir/$progname" && break
+     done
+     IFS="$save_IFS"
+     test -n "$progdir" || progdir=`pwd`
+     progpath="$progdir/$progname"
+     ;;
+esac
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution that turns a string into a regex matching for the
+# string literally.
+sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
+
+# Sed substitution that converts a w32 file name or path
+# which contains forward slashes, into one that contains
+# (escaped) backslashes.  A very naive implementation.
+lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+
+# Re-`\' parameter expansions in output of double_quote_subst that were
+# `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
+# in input to double_quote_subst, that '$' was protected from expansion.
+# Since each input `\' is now two `\'s, look for any number of runs of
+# four `\'s followed by two `\'s and then a '$'.  `\' that '$'.
+bs='\\'
+bs2='\\\\'
+bs4='\\\\\\\\'
+dollar='\$'
+sed_double_backslash="\
+  s/$bs4/&\\
+/g
+  s/^$bs2$dollar/$bs&/
+  s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
+  s/\n//g"
+
+# Standard options:
+opt_dry_run=false
+opt_help=false
+opt_quiet=false
+opt_verbose=false
+opt_warning=:
+
+# func_echo arg...
+# Echo program name prefixed message, along with the current mode
+# name if it has been set yet.
+func_echo ()
+{
+    $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
+}
+
+# func_verbose arg...
+# Echo program name prefixed message in verbose mode only.
+func_verbose ()
+{
+    $opt_verbose && func_echo ${1+"$@"}
+
+    # A bug in bash halts the script if the last line of a function
+    # fails when set -e is in force, so we need another command to
+    # work around that:
+    :
+}
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "$*"
+}
+
+# func_error arg...
+# Echo program name prefixed message to standard error.
+func_error ()
+{
+    $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
+}
+
+# func_warning arg...
+# Echo program name prefixed warning message to standard error.
+func_warning ()
+{
+    $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
+
+    # bash bug again:
+    :
+}
+
+# func_fatal_error arg...
+# Echo program name prefixed message to standard error, and exit.
+func_fatal_error ()
+{
+    func_error ${1+"$@"}
+    exit $EXIT_FAILURE
+}
+
+# func_fatal_help arg...
+# Echo program name prefixed message to standard error, followed by
+# a help hint, and exit.
+func_fatal_help ()
+{
+    func_error ${1+"$@"}
+    func_fatal_error "$help"
+}
+help="Try \`$progname --help' for more information."  ## default
+
+
+# func_grep expression filename
+# Check whether EXPRESSION matches any line of FILENAME, without output.
+func_grep ()
+{
+    $GREP "$1" "$2" >/dev/null 2>&1
+}
+
+
+# func_mkdir_p directory-path
+# Make sure the entire path to DIRECTORY-PATH is available.
+func_mkdir_p ()
+{
+    my_directory_path="$1"
+    my_dir_list=
+
+    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
+
+      # Protect directory names starting with `-'
+      case $my_directory_path in
+        -*) my_directory_path="./$my_directory_path" ;;
+      esac
+
+      # While some portion of DIR does not yet exist...
+      while test ! -d "$my_directory_path"; do
+        # ...make a list in topmost first order.  Use a colon delimited
+	# list incase some portion of path contains whitespace.
+        my_dir_list="$my_directory_path:$my_dir_list"
+
+        # If the last portion added has no slash in it, the list is done
+        case $my_directory_path in */*) ;; *) break ;; esac
+
+        # ...otherwise throw away the child directory and loop
+        my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
+      done
+      my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
+
+      save_mkdir_p_IFS="$IFS"; IFS=':'
+      for my_dir in $my_dir_list; do
+	IFS="$save_mkdir_p_IFS"
+        # mkdir can fail with a `File exist' error if two processes
+        # try to create one of the directories concurrently.  Don't
+        # stop in that case!
+        $MKDIR "$my_dir" 2>/dev/null || :
+      done
+      IFS="$save_mkdir_p_IFS"
+
+      # Bail out if we (or some other process) failed to create a directory.
+      test -d "$my_directory_path" || \
+        func_fatal_error "Failed to create \`$1'"
+    fi
+}
+
+
+# func_mktempdir [string]
+# Make a temporary directory that won't clash with other running
+# libtool processes, and avoids race conditions if possible.  If
+# given, STRING is the basename for that directory.
+func_mktempdir ()
+{
+    my_template="${TMPDIR-/tmp}/${1-$progname}"
+
+    if test "$opt_dry_run" = ":"; then
+      # Return a directory name, but don't create it in dry-run mode
+      my_tmpdir="${my_template}-$$"
+    else
+
+      # If mktemp works, use that first and foremost
+      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
+
+      if test ! -d "$my_tmpdir"; then
+        # Failing that, at least try and use $RANDOM to avoid a race
+        my_tmpdir="${my_template}-${RANDOM-0}$$"
+
+        save_mktempdir_umask=`umask`
+        umask 0077
+        $MKDIR "$my_tmpdir"
+        umask $save_mktempdir_umask
+      fi
+
+      # If we're not in dry-run mode, bomb out on failure
+      test -d "$my_tmpdir" || \
+        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
+    fi
+
+    $ECHO "$my_tmpdir"
+}
+
+
+# func_quote_for_eval arg
+# Aesthetically quote ARG to be evaled later.
+# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
+# is double-quoted, suitable for a subsequent eval, whereas
+# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
+# which are still active within double quotes backslashified.
+func_quote_for_eval ()
+{
+    case $1 in
+      *[\\\`\"\$]*)
+	func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
+      *)
+        func_quote_for_eval_unquoted_result="$1" ;;
+    esac
+
+    case $func_quote_for_eval_unquoted_result in
+      # Double-quote args containing shell metacharacters to delay
+      # word splitting, command substitution and and variable
+      # expansion for a subsequent eval.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, so we specify it separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+        func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
+        ;;
+      *)
+        func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
+    esac
+}
+
+
+# func_quote_for_expand arg
+# Aesthetically quote ARG to be evaled later; same as above,
+# but do not quote variable references.
+func_quote_for_expand ()
+{
+    case $1 in
+      *[\\\`\"]*)
+	my_arg=`$ECHO "$1" | $SED \
+	    -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
+      *)
+        my_arg="$1" ;;
+    esac
+
+    case $my_arg in
+      # Double-quote args containing shell metacharacters to delay
+      # word splitting and command substitution for a subsequent eval.
+      # Many Bourne shells cannot handle close brackets correctly
+      # in scan sets, so we specify it separately.
+      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
+        my_arg="\"$my_arg\""
+        ;;
+    esac
+
+    func_quote_for_expand_result="$my_arg"
+}
+
+
+# func_show_eval cmd [fail_exp]
+# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
+# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.
+func_show_eval ()
+{
+    my_cmd="$1"
+    my_fail_exp="${2-:}"
+
+    ${opt_silent-false} || {
+      func_quote_for_expand "$my_cmd"
+      eval "func_echo $func_quote_for_expand_result"
+    }
+
+    if ${opt_dry_run-false}; then :; else
+      eval "$my_cmd"
+      my_status=$?
+      if test "$my_status" -eq 0; then :; else
+	eval "(exit $my_status); $my_fail_exp"
+      fi
+    fi
+}
+
+
+# func_show_eval_locale cmd [fail_exp]
+# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
+# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.  Use the saved locale for evaluation.
+func_show_eval_locale ()
+{
+    my_cmd="$1"
+    my_fail_exp="${2-:}"
+
+    ${opt_silent-false} || {
+      func_quote_for_expand "$my_cmd"
+      eval "func_echo $func_quote_for_expand_result"
+    }
+
+    if ${opt_dry_run-false}; then :; else
+      eval "$lt_user_locale
+	    $my_cmd"
+      my_status=$?
+      eval "$lt_safe_locale"
+      if test "$my_status" -eq 0; then :; else
+	eval "(exit $my_status); $my_fail_exp"
+      fi
+    fi
+}
+
+# func_tr_sh
+# Turn $1 into a string suitable for a shell variable name.
+# Result is stored in $func_tr_sh_result.  All characters
+# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
+# if $1 begins with a digit, a '_' is prepended as well.
+func_tr_sh ()
+{
+  case $1 in
+  [0-9]* | *[!a-zA-Z0-9_]*)
+    func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
+    ;;
+  * )
+    func_tr_sh_result=$1
+    ;;
+  esac
+}
+
+
+# func_version
+# Echo version message to standard output and exit.
+func_version ()
+{
+    $opt_debug
+
+    $SED -n '/(C)/!b go
+	:more
+	/\./!{
+	  N
+	  s/\n# / /
+	  b more
+	}
+	:go
+	/^# '$PROGRAM' (GNU /,/# warranty; / {
+        s/^# //
+	s/^# *$//
+        s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
+        p
+     }' < "$progpath"
+     exit $?
+}
+
+# func_usage
+# Echo short help message to standard output and exit.
+func_usage ()
+{
+    $opt_debug
+
+    $SED -n '/^# Usage:/,/^#  *.*--help/ {
+        s/^# //
+	s/^# *$//
+	s/\$progname/'$progname'/
+	p
+    }' < "$progpath"
+    echo
+    $ECHO "run \`$progname --help | more' for full usage"
+    exit $?
+}
+
+# func_help [NOEXIT]
+# Echo long help message to standard output and exit,
+# unless 'noexit' is passed as argument.
+func_help ()
+{
+    $opt_debug
+
+    $SED -n '/^# Usage:/,/# Report bugs to/ {
+	:print
+        s/^# //
+	s/^# *$//
+	s*\$progname*'$progname'*
+	s*\$host*'"$host"'*
+	s*\$SHELL*'"$SHELL"'*
+	s*\$LTCC*'"$LTCC"'*
+	s*\$LTCFLAGS*'"$LTCFLAGS"'*
+	s*\$LD*'"$LD"'*
+	s/\$with_gnu_ld/'"$with_gnu_ld"'/
+	s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
+	s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
+	p
+	d
+     }
+     /^# .* home page:/b print
+     /^# General help using/b print
+     ' < "$progpath"
+    ret=$?
+    if test -z "$1"; then
+      exit $ret
+    fi
+}
+
+# func_missing_arg argname
+# Echo program name prefixed message to standard error and set global
+# exit_cmd.
+func_missing_arg ()
+{
+    $opt_debug
+
+    func_error "missing argument for $1."
+    exit_cmd=exit
+}
+
+
+# func_split_short_opt shortopt
+# Set func_split_short_opt_name and func_split_short_opt_arg shell
+# variables after splitting SHORTOPT after the 2nd character.
+func_split_short_opt ()
+{
+    my_sed_short_opt='1s/^\(..\).*$/\1/;q'
+    my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
+
+    func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
+    func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
+} # func_split_short_opt may be replaced by extended shell implementation
+
+
+# func_split_long_opt longopt
+# Set func_split_long_opt_name and func_split_long_opt_arg shell
+# variables after splitting LONGOPT at the `=' sign.
+func_split_long_opt ()
+{
+    my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
+    my_sed_long_arg='1s/^--[^=]*=//'
+
+    func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
+    func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
+} # func_split_long_opt may be replaced by extended shell implementation
+
+exit_cmd=:
+
+
+
+
+
+magic="%%%MAGIC variable%%%"
+magic_exe="%%%MAGIC EXE variable%%%"
+
+# Global variables.
+nonopt=
+preserve_args=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
+
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end.  This prevents here-documents from being
+# left over by shells.
+exec_cmd=
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+    eval "${1}=\$${1}\${2}"
+} # func_append may be replaced by extended shell implementation
+
+# func_append_quoted var value
+# Quote VALUE and append to the end of shell variable VAR, separated
+# by a space.
+func_append_quoted ()
+{
+    func_quote_for_eval "${2}"
+    eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
+} # func_append_quoted may be replaced by extended shell implementation
+
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+    func_arith_result=`expr "${@}"`
+} # func_arith may be replaced by extended shell implementation
+
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+    func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
+} # func_len may be replaced by extended shell implementation
+
+
+# func_lo2o object
+func_lo2o ()
+{
+    func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
+} # func_lo2o may be replaced by extended shell implementation
+
+
+# func_xform libobj-or-source
+func_xform ()
+{
+    func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
+} # func_xform may be replaced by extended shell implementation
+
+
+# func_fatal_configuration arg...
+# Echo program name prefixed message to standard error, followed by
+# a configuration failure hint, and exit.
+func_fatal_configuration ()
+{
+    func_error ${1+"$@"}
+    func_error "See the $PACKAGE documentation for more information."
+    func_fatal_error "Fatal configuration error."
+}
+
+
+# func_config
+# Display the configuration for all the tags in this script.
+func_config ()
+{
+    re_begincf='^# ### BEGIN LIBTOOL'
+    re_endcf='^# ### END LIBTOOL'
+
+    # Default configuration.
+    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
+
+    # Now print the configurations for the tags.
+    for tagname in $taglist; do
+      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
+    done
+
+    exit $?
+}
+
+# func_features
+# Display the features supported by this script.
+func_features ()
+{
+    echo "host: $host"
+    if test "$build_libtool_libs" = yes; then
+      echo "enable shared libraries"
+    else
+      echo "disable shared libraries"
+    fi
+    if test "$build_old_libs" = yes; then
+      echo "enable static libraries"
+    else
+      echo "disable static libraries"
+    fi
+
+    exit $?
+}
+
+# func_enable_tag tagname
+# Verify that TAGNAME is valid, and either flag an error and exit, or
+# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
+# variable here.
+func_enable_tag ()
+{
+  # Global variable:
+  tagname="$1"
+
+  re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
+  re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
+  sed_extractcf="/$re_begincf/,/$re_endcf/p"
+
+  # Validate tagname.
+  case $tagname in
+    *[!-_A-Za-z0-9,/]*)
+      func_fatal_error "invalid tag name: $tagname"
+      ;;
+  esac
+
+  # Don't test for the "default" C tag, as we know it's
+  # there but not specially marked.
+  case $tagname in
+    CC) ;;
+    *)
+      if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
+	taglist="$taglist $tagname"
+
+	# Evaluate the configuration.  Be careful to quote the path
+	# and the sed script, to avoid splitting on whitespace, but
+	# also don't use non-portable quotes within backquotes within
+	# quotes we have to do it in 2 steps:
+	extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
+	eval "$extractedcf"
+      else
+	func_error "ignoring unknown tag $tagname"
+      fi
+      ;;
+  esac
+}
+
+# func_check_version_match
+# Ensure that we are using m4 macros, and libtool script from the same
+# release of libtool.
+func_check_version_match ()
+{
+  if test "$package_revision" != "$macro_revision"; then
+    if test "$VERSION" != "$macro_version"; then
+      if test -z "$macro_version"; then
+        cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from an older release.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+      else
+        cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+      fi
+    else
+      cat >&2 <<_LT_EOF
+$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
+$progname: but the definition of this LT_INIT comes from revision $macro_revision.
+$progname: You should recreate aclocal.m4 with macros from revision $package_revision
+$progname: of $PACKAGE $VERSION and run autoconf again.
+_LT_EOF
+    fi
+
+    exit $EXIT_MISMATCH
+  fi
+}
+
+
+# Shorthand for --mode=foo, only valid as the first argument
+case $1 in
+clean|clea|cle|cl)
+  shift; set dummy --mode clean ${1+"$@"}; shift
+  ;;
+compile|compil|compi|comp|com|co|c)
+  shift; set dummy --mode compile ${1+"$@"}; shift
+  ;;
+execute|execut|execu|exec|exe|ex|e)
+  shift; set dummy --mode execute ${1+"$@"}; shift
+  ;;
+finish|finis|fini|fin|fi|f)
+  shift; set dummy --mode finish ${1+"$@"}; shift
+  ;;
+install|instal|insta|inst|ins|in|i)
+  shift; set dummy --mode install ${1+"$@"}; shift
+  ;;
+link|lin|li|l)
+  shift; set dummy --mode link ${1+"$@"}; shift
+  ;;
+uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
+  shift; set dummy --mode uninstall ${1+"$@"}; shift
+  ;;
+esac
+
+
+
+# Option defaults:
+opt_debug=:
+opt_dry_run=false
+opt_config=false
+opt_preserve_dup_deps=false
+opt_features=false
+opt_finish=false
+opt_help=false
+opt_help_all=false
+opt_silent=:
+opt_verbose=:
+opt_silent=false
+opt_verbose=false
+
+
+# Parse options once, thoroughly.  This comes as soon as possible in the
+# script to make things like `--version' happen as quickly as we can.
+{
+  # this just eases exit handling
+  while test $# -gt 0; do
+    opt="$1"
+    shift
+    case $opt in
+      --debug|-x)	opt_debug='set -x'
+			func_echo "enabling shell trace mode"
+			$opt_debug
+			;;
+      --dry-run|--dryrun|-n)
+			opt_dry_run=:
+			;;
+      --config)
+			opt_config=:
+func_config
+			;;
+      --dlopen|-dlopen)
+			optarg="$1"
+			opt_dlopen="${opt_dlopen+$opt_dlopen
+}$optarg"
+			shift
+			;;
+      --preserve-dup-deps)
+			opt_preserve_dup_deps=:
+			;;
+      --features)
+			opt_features=:
+func_features
+			;;
+      --finish)
+			opt_finish=:
+set dummy --mode finish ${1+"$@"}; shift
+			;;
+      --help)
+			opt_help=:
+			;;
+      --help-all)
+			opt_help_all=:
+opt_help=': help-all'
+			;;
+      --mode)
+			test $# = 0 && func_missing_arg $opt && break
+			optarg="$1"
+			opt_mode="$optarg"
+case $optarg in
+  # Valid mode arguments:
+  clean|compile|execute|finish|install|link|relink|uninstall) ;;
+
+  # Catch anything else as an error
+  *) func_error "invalid argument for $opt"
+     exit_cmd=exit
+     break
+     ;;
+esac
+			shift
+			;;
+      --no-silent|--no-quiet)
+			opt_silent=false
+func_append preserve_args " $opt"
+			;;
+      --no-verbose)
+			opt_verbose=false
+func_append preserve_args " $opt"
+			;;
+      --silent|--quiet)
+			opt_silent=:
+func_append preserve_args " $opt"
+        opt_verbose=false
+			;;
+      --verbose|-v)
+			opt_verbose=:
+func_append preserve_args " $opt"
+opt_silent=false
+			;;
+      --tag)
+			test $# = 0 && func_missing_arg $opt && break
+			optarg="$1"
+			opt_tag="$optarg"
+func_append preserve_args " $opt $optarg"
+func_enable_tag "$optarg"
+			shift
+			;;
+
+      -\?|-h)		func_usage				;;
+      --help)		func_help				;;
+      --version)	func_version				;;
+
+      # Separate optargs to long options:
+      --*=*)
+			func_split_long_opt "$opt"
+			set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
+			shift
+			;;
+
+      # Separate non-argument short options:
+      -\?*|-h*|-n*|-v*)
+			func_split_short_opt "$opt"
+			set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
+			shift
+			;;
+
+      --)		break					;;
+      -*)		func_fatal_help "unrecognized option \`$opt'" ;;
+      *)		set dummy "$opt" ${1+"$@"};	shift; break  ;;
+    esac
+  done
+
+  # Validate options:
+
+  # save first non-option argument
+  if test "$#" -gt 0; then
+    nonopt="$opt"
+    shift
+  fi
+
+  # preserve --debug
+  test "$opt_debug" = : || func_append preserve_args " --debug"
+
+  case $host in
+    *cygwin* | *mingw* | *pw32* | *cegcc*)
+      # don't eliminate duplications in $postdeps and $predeps
+      opt_duplicate_compiler_generated_deps=:
+      ;;
+    *)
+      opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
+      ;;
+  esac
+
+  $opt_help || {
+    # Sanity checks first:
+    func_check_version_match
+
+    if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+      func_fatal_configuration "not configured to build any kind of library"
+    fi
+
+    # Darwin sucks
+    eval std_shrext=\"$shrext_cmds\"
+
+    # Only execute mode is allowed to have -dlopen flags.
+    if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
+      func_error "unrecognized option \`-dlopen'"
+      $ECHO "$help" 1>&2
+      exit $EXIT_FAILURE
+    fi
+
+    # Change the help message to a mode-specific one.
+    generic_help="$help"
+    help="Try \`$progname --help --mode=$opt_mode' for more information."
+  }
+
+
+  # Bail if the options were screwed
+  $exit_cmd $EXIT_FAILURE
+}
+
+
+
+
+## ----------- ##
+##    Main.    ##
+## ----------- ##
+
+# func_lalib_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_lalib_p ()
+{
+    test -f "$1" &&
+      $SED -e 4q "$1" 2>/dev/null \
+        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
+}
+
+# func_lalib_unsafe_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function implements the same check as func_lalib_p without
+# resorting to external programs.  To this end, it redirects stdin and
+# closes it afterwards, without saving the original file descriptor.
+# As a safety measure, use it only where a negative result would be
+# fatal anyway.  Works if `file' does not exist.
+func_lalib_unsafe_p ()
+{
+    lalib_p=no
+    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
+	for lalib_p_l in 1 2 3 4
+	do
+	    read lalib_p_line
+	    case "$lalib_p_line" in
+		\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
+	    esac
+	done
+	exec 0<&5 5<&-
+    fi
+    test "$lalib_p" = yes
+}
+
+# func_ltwrapper_script_p file
+# True iff FILE is a libtool wrapper script
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_script_p ()
+{
+    func_lalib_p "$1"
+}
+
+# func_ltwrapper_executable_p file
+# True iff FILE is a libtool wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_executable_p ()
+{
+    func_ltwrapper_exec_suffix=
+    case $1 in
+    *.exe) ;;
+    *) func_ltwrapper_exec_suffix=.exe ;;
+    esac
+    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
+}
+
+# func_ltwrapper_scriptname file
+# Assumes file is an ltwrapper_executable
+# uses $file to determine the appropriate filename for a
+# temporary ltwrapper_script.
+func_ltwrapper_scriptname ()
+{
+    func_dirname_and_basename "$1" "" "."
+    func_stripname '' '.exe' "$func_basename_result"
+    func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
+}
+
+# func_ltwrapper_p file
+# True iff FILE is a libtool wrapper script or wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_p ()
+{
+    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
+}
+
+
+# func_execute_cmds commands fail_cmd
+# Execute tilde-delimited COMMANDS.
+# If FAIL_CMD is given, eval that upon failure.
+# FAIL_CMD may read-access the current command in variable CMD!
+func_execute_cmds ()
+{
+    $opt_debug
+    save_ifs=$IFS; IFS='~'
+    for cmd in $1; do
+      IFS=$save_ifs
+      eval cmd=\"$cmd\"
+      func_show_eval "$cmd" "${2-:}"
+    done
+    IFS=$save_ifs
+}
+
+
+# func_source file
+# Source FILE, adding directory component if necessary.
+# Note that it is not necessary on cygwin/mingw to append a dot to
+# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
+# behavior happens only for exec(3), not for open(2)!  Also, sourcing
+# `FILE.' does not work on cygwin managed mounts.
+func_source ()
+{
+    $opt_debug
+    case $1 in
+    */* | *\\*)	. "$1" ;;
+    *)		. "./$1" ;;
+    esac
+}
+
+
+# func_resolve_sysroot PATH
+# Replace a leading = in PATH with a sysroot.  Store the result into
+# func_resolve_sysroot_result
+func_resolve_sysroot ()
+{
+  func_resolve_sysroot_result=$1
+  case $func_resolve_sysroot_result in
+  =*)
+    func_stripname '=' '' "$func_resolve_sysroot_result"
+    func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
+    ;;
+  esac
+}
+
+# func_replace_sysroot PATH
+# If PATH begins with the sysroot, replace it with = and
+# store the result into func_replace_sysroot_result.
+func_replace_sysroot ()
+{
+  case "$lt_sysroot:$1" in
+  ?*:"$lt_sysroot"*)
+    func_stripname "$lt_sysroot" '' "$1"
+    func_replace_sysroot_result="=$func_stripname_result"
+    ;;
+  *)
+    # Including no sysroot.
+    func_replace_sysroot_result=$1
+    ;;
+  esac
+}
+
+# func_infer_tag arg
+# Infer tagged configuration to use if any are available and
+# if one wasn't chosen via the "--tag" command line option.
+# Only attempt this if the compiler in the base compile
+# command doesn't match the default compiler.
+# arg is usually of the form 'gcc ...'
+func_infer_tag ()
+{
+    $opt_debug
+    if test -n "$available_tags" && test -z "$tagname"; then
+      CC_quoted=
+      for arg in $CC; do
+	func_append_quoted CC_quoted "$arg"
+      done
+      CC_expanded=`func_echo_all $CC`
+      CC_quoted_expanded=`func_echo_all $CC_quoted`
+      case $@ in
+      # Blanks in the command may have been stripped by the calling shell,
+      # but not from the CC environment variable when configure was run.
+      " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+      " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
+      # Blanks at the start of $base_compile will cause this to fail
+      # if we don't check for them as well.
+      *)
+	for z in $available_tags; do
+	  if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+	    # Evaluate the configuration.
+	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
+	    CC_quoted=
+	    for arg in $CC; do
+	      # Double-quote args containing other shell metacharacters.
+	      func_append_quoted CC_quoted "$arg"
+	    done
+	    CC_expanded=`func_echo_all $CC`
+	    CC_quoted_expanded=`func_echo_all $CC_quoted`
+	    case "$@ " in
+	    " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
+	    " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
+	      # The compiler in the base compile command matches
+	      # the one in the tagged configuration.
+	      # Assume this is the tagged configuration we want.
+	      tagname=$z
+	      break
+	      ;;
+	    esac
+	  fi
+	done
+	# If $tagname still isn't set, then no tagged configuration
+	# was found and let the user know that the "--tag" command
+	# line option must be used.
+	if test -z "$tagname"; then
+	  func_echo "unable to infer tagged configuration"
+	  func_fatal_error "specify a tag with \`--tag'"
+#	else
+#	  func_verbose "using $tagname tagged configuration"
+	fi
+	;;
+      esac
+    fi
+}
+
+
+
+# func_write_libtool_object output_name pic_name nonpic_name
+# Create a libtool object file (analogous to a ".la" file),
+# but don't create it if we're doing a dry run.
+func_write_libtool_object ()
+{
+    write_libobj=${1}
+    if test "$build_libtool_libs" = yes; then
+      write_lobj=\'${2}\'
+    else
+      write_lobj=none
+    fi
+
+    if test "$build_old_libs" = yes; then
+      write_oldobj=\'${3}\'
+    else
+      write_oldobj=none
+    fi
+
+    $opt_dry_run || {
+      cat >${write_libobj}T <<EOF
+# $write_libobj - a libtool object file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object=$write_lobj
+
+# Name of the non-PIC object
+non_pic_object=$write_oldobj
+
+EOF
+      $MV "${write_libobj}T" "${write_libobj}"
+    }
+}
+
+
+##################################################
+# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
+##################################################
+
+# func_convert_core_file_wine_to_w32 ARG
+# Helper function used by file name conversion functions when $build is *nix,
+# and $host is mingw, cygwin, or some other w32 environment. Relies on a
+# correctly configured wine environment available, with the winepath program
+# in $build's $PATH.
+#
+# ARG is the $build file name to be converted to w32 format.
+# Result is available in $func_convert_core_file_wine_to_w32_result, and will
+# be empty on error (or when ARG is empty)
+func_convert_core_file_wine_to_w32 ()
+{
+  $opt_debug
+  func_convert_core_file_wine_to_w32_result="$1"
+  if test -n "$1"; then
+    # Unfortunately, winepath does not exit with a non-zero error code, so we
+    # are forced to check the contents of stdout. On the other hand, if the
+    # command is not found, the shell will set an exit code of 127 and print
+    # *an error message* to stdout. So we must check for both error code of
+    # zero AND non-empty stdout, which explains the odd construction:
+    func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
+    if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
+      func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
+        $SED -e "$lt_sed_naive_backslashify"`
+    else
+      func_convert_core_file_wine_to_w32_result=
+    fi
+  fi
+}
+# end: func_convert_core_file_wine_to_w32
+
+
+# func_convert_core_path_wine_to_w32 ARG
+# Helper function used by path conversion functions when $build is *nix, and
+# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
+# configured wine environment available, with the winepath program in $build's
+# $PATH. Assumes ARG has no leading or trailing path separator characters.
+#
+# ARG is path to be converted from $build format to win32.
+# Result is available in $func_convert_core_path_wine_to_w32_result.
+# Unconvertible file (directory) names in ARG are skipped; if no directory names
+# are convertible, then the result may be empty.
+func_convert_core_path_wine_to_w32 ()
+{
+  $opt_debug
+  # unfortunately, winepath doesn't convert paths, only file names
+  func_convert_core_path_wine_to_w32_result=""
+  if test -n "$1"; then
+    oldIFS=$IFS
+    IFS=:
+    for func_convert_core_path_wine_to_w32_f in $1; do
+      IFS=$oldIFS
+      func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
+      if test -n "$func_convert_core_file_wine_to_w32_result" ; then
+        if test -z "$func_convert_core_path_wine_to_w32_result"; then
+          func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
+        else
+          func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
+        fi
+      fi
+    done
+    IFS=$oldIFS
+  fi
+}
+# end: func_convert_core_path_wine_to_w32
+
+
+# func_cygpath ARGS...
+# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
+# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
+# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
+# (2), returns the Cygwin file name or path in func_cygpath_result (input
+# file name or path is assumed to be in w32 format, as previously converted
+# from $build's *nix or MSYS format). In case (3), returns the w32 file name
+# or path in func_cygpath_result (input file name or path is assumed to be in
+# Cygwin format). Returns an empty string on error.
+#
+# ARGS are passed to cygpath, with the last one being the file name or path to
+# be converted.
+#
+# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
+# environment variable; do not put it in $PATH.
+func_cygpath ()
+{
+  $opt_debug
+  if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
+    func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
+    if test "$?" -ne 0; then
+      # on failure, ensure result is empty
+      func_cygpath_result=
+    fi
+  else
+    func_cygpath_result=
+    func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
+  fi
+}
+#end: func_cygpath
+
+
+# func_convert_core_msys_to_w32 ARG
+# Convert file name or path ARG from MSYS format to w32 format.  Return
+# result in func_convert_core_msys_to_w32_result.
+func_convert_core_msys_to_w32 ()
+{
+  $opt_debug
+  # awkward: cmd appends spaces to result
+  func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
+    $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
+}
+#end: func_convert_core_msys_to_w32
+
+
+# func_convert_file_check ARG1 ARG2
+# Verify that ARG1 (a file name in $build format) was converted to $host
+# format in ARG2. Otherwise, emit an error message, but continue (resetting
+# func_to_host_file_result to ARG1).
+func_convert_file_check ()
+{
+  $opt_debug
+  if test -z "$2" && test -n "$1" ; then
+    func_error "Could not determine host file name corresponding to"
+    func_error "  \`$1'"
+    func_error "Continuing, but uninstalled executables may not work."
+    # Fallback:
+    func_to_host_file_result="$1"
+  fi
+}
+# end func_convert_file_check
+
+
+# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
+# Verify that FROM_PATH (a path in $build format) was converted to $host
+# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
+# func_to_host_file_result to a simplistic fallback value (see below).
+func_convert_path_check ()
+{
+  $opt_debug
+  if test -z "$4" && test -n "$3"; then
+    func_error "Could not determine the host path corresponding to"
+    func_error "  \`$3'"
+    func_error "Continuing, but uninstalled executables may not work."
+    # Fallback.  This is a deliberately simplistic "conversion" and
+    # should not be "improved".  See libtool.info.
+    if test "x$1" != "x$2"; then
+      lt_replace_pathsep_chars="s|$1|$2|g"
+      func_to_host_path_result=`echo "$3" |
+        $SED -e "$lt_replace_pathsep_chars"`
+    else
+      func_to_host_path_result="$3"
+    fi
+  fi
+}
+# end func_convert_path_check
+
+
+# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
+# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
+# and appending REPL if ORIG matches BACKPAT.
+func_convert_path_front_back_pathsep ()
+{
+  $opt_debug
+  case $4 in
+  $1 ) func_to_host_path_result="$3$func_to_host_path_result"
+    ;;
+  esac
+  case $4 in
+  $2 ) func_append func_to_host_path_result "$3"
+    ;;
+  esac
+}
+# end func_convert_path_front_back_pathsep
+
+
+##################################################
+# $build to $host FILE NAME CONVERSION FUNCTIONS #
+##################################################
+# invoked via `$to_host_file_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# Result will be available in $func_to_host_file_result.
+
+
+# func_to_host_file ARG
+# Converts the file name ARG from $build format to $host format. Return result
+# in func_to_host_file_result.
+func_to_host_file ()
+{
+  $opt_debug
+  $to_host_file_cmd "$1"
+}
+# end func_to_host_file
+
+
+# func_to_tool_file ARG LAZY
+# converts the file name ARG from $build format to toolchain format. Return
+# result in func_to_tool_file_result.  If the conversion in use is listed
+# in (the comma separated) LAZY, no conversion takes place.
+func_to_tool_file ()
+{
+  $opt_debug
+  case ,$2, in
+    *,"$to_tool_file_cmd",*)
+      func_to_tool_file_result=$1
+      ;;
+    *)
+      $to_tool_file_cmd "$1"
+      func_to_tool_file_result=$func_to_host_file_result
+      ;;
+  esac
+}
+# end func_to_tool_file
+
+
+# func_convert_file_noop ARG
+# Copy ARG to func_to_host_file_result.
+func_convert_file_noop ()
+{
+  func_to_host_file_result="$1"
+}
+# end func_convert_file_noop
+
+
+# func_convert_file_msys_to_w32 ARG
+# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper.  Returns result in
+# func_to_host_file_result.
+func_convert_file_msys_to_w32 ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    func_convert_core_msys_to_w32 "$1"
+    func_to_host_file_result="$func_convert_core_msys_to_w32_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_w32
+
+
+# func_convert_file_cygwin_to_w32 ARG
+# Convert file name ARG from Cygwin to w32 format.  Returns result in
+# func_to_host_file_result.
+func_convert_file_cygwin_to_w32 ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
+    # LT_CYGPATH in this case.
+    func_to_host_file_result=`cygpath -m "$1"`
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_cygwin_to_w32
+
+
+# func_convert_file_nix_to_w32 ARG
+# Convert file name ARG from *nix to w32 format.  Requires a wine environment
+# and a working winepath. Returns result in func_to_host_file_result.
+func_convert_file_nix_to_w32 ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    func_convert_core_file_wine_to_w32 "$1"
+    func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_w32
+
+
+# func_convert_file_msys_to_cygwin ARG
+# Convert file name ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_file_msys_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    func_convert_core_msys_to_w32 "$1"
+    func_cygpath -u "$func_convert_core_msys_to_w32_result"
+    func_to_host_file_result="$func_cygpath_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_msys_to_cygwin
+
+
+# func_convert_file_nix_to_cygwin ARG
+# Convert file name ARG from *nix to Cygwin format.  Requires Cygwin installed
+# in a wine environment, working winepath, and LT_CYGPATH set.  Returns result
+# in func_to_host_file_result.
+func_convert_file_nix_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_file_result="$1"
+  if test -n "$1"; then
+    # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
+    func_convert_core_file_wine_to_w32 "$1"
+    func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
+    func_to_host_file_result="$func_cygpath_result"
+  fi
+  func_convert_file_check "$1" "$func_to_host_file_result"
+}
+# end func_convert_file_nix_to_cygwin
+
+
+#############################################
+# $build to $host PATH CONVERSION FUNCTIONS #
+#############################################
+# invoked via `$to_host_path_cmd ARG'
+#
+# In each case, ARG is the path to be converted from $build to $host format.
+# The result will be available in $func_to_host_path_result.
+#
+# Path separators are also converted from $build format to $host format.  If
+# ARG begins or ends with a path separator character, it is preserved (but
+# converted to $host format) on output.
+#
+# All path conversion functions are named using the following convention:
+#   file name conversion function    : func_convert_file_X_to_Y ()
+#   path conversion function         : func_convert_path_X_to_Y ()
+# where, for any given $build/$host combination the 'X_to_Y' value is the
+# same.  If conversion functions are added for new $build/$host combinations,
+# the two new functions must follow this pattern, or func_init_to_host_path_cmd
+# will break.
+
+
+# func_init_to_host_path_cmd
+# Ensures that function "pointer" variable $to_host_path_cmd is set to the
+# appropriate value, based on the value of $to_host_file_cmd.
+to_host_path_cmd=
+func_init_to_host_path_cmd ()
+{
+  $opt_debug
+  if test -z "$to_host_path_cmd"; then
+    func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
+    to_host_path_cmd="func_convert_path_${func_stripname_result}"
+  fi
+}
+
+
+# func_to_host_path ARG
+# Converts the path ARG from $build format to $host format. Return result
+# in func_to_host_path_result.
+func_to_host_path ()
+{
+  $opt_debug
+  func_init_to_host_path_cmd
+  $to_host_path_cmd "$1"
+}
+# end func_to_host_path
+
+
+# func_convert_path_noop ARG
+# Copy ARG to func_to_host_path_result.
+func_convert_path_noop ()
+{
+  func_to_host_path_result="$1"
+}
+# end func_convert_path_noop
+
+
+# func_convert_path_msys_to_w32 ARG
+# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
+# conversion to w32 is not available inside the cwrapper.  Returns result in
+# func_to_host_path_result.
+func_convert_path_msys_to_w32 ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # Remove leading and trailing path separator characters from ARG.  MSYS
+    # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
+    # and winepath ignores them completely.
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+    func_to_host_path_result="$func_convert_core_msys_to_w32_result"
+    func_convert_path_check : ";" \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+  fi
+}
+# end func_convert_path_msys_to_w32
+
+
+# func_convert_path_cygwin_to_w32 ARG
+# Convert path ARG from Cygwin to w32 format.  Returns result in
+# func_to_host_file_result.
+func_convert_path_cygwin_to_w32 ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # See func_convert_path_msys_to_w32:
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
+    func_convert_path_check : ";" \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+  fi
+}
+# end func_convert_path_cygwin_to_w32
+
+
+# func_convert_path_nix_to_w32 ARG
+# Convert path ARG from *nix to w32 format.  Requires a wine environment and
+# a working winepath.  Returns result in func_to_host_file_result.
+func_convert_path_nix_to_w32 ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # See func_convert_path_msys_to_w32:
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+    func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
+    func_convert_path_check : ";" \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
+  fi
+}
+# end func_convert_path_nix_to_w32
+
+
+# func_convert_path_msys_to_cygwin ARG
+# Convert path ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
+# Returns result in func_to_host_file_result.
+func_convert_path_msys_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # See func_convert_path_msys_to_w32:
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
+    func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
+    func_to_host_path_result="$func_cygpath_result"
+    func_convert_path_check : : \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+  fi
+}
+# end func_convert_path_msys_to_cygwin
+
+
+# func_convert_path_nix_to_cygwin ARG
+# Convert path ARG from *nix to Cygwin format.  Requires Cygwin installed in a
+# a wine environment, working winepath, and LT_CYGPATH set.  Returns result in
+# func_to_host_file_result.
+func_convert_path_nix_to_cygwin ()
+{
+  $opt_debug
+  func_to_host_path_result="$1"
+  if test -n "$1"; then
+    # Remove leading and trailing path separator characters from
+    # ARG. msys behavior is inconsistent here, cygpath turns them
+    # into '.;' and ';.', and winepath ignores them completely.
+    func_stripname : : "$1"
+    func_to_host_path_tmp1=$func_stripname_result
+    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
+    func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
+    func_to_host_path_result="$func_cygpath_result"
+    func_convert_path_check : : \
+      "$func_to_host_path_tmp1" "$func_to_host_path_result"
+    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+  fi
+}
+# end func_convert_path_nix_to_cygwin
+
+
+# func_mode_compile arg...
+func_mode_compile ()
+{
+    $opt_debug
+    # Get the compilation command and the source file.
+    base_compile=
+    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
+    suppress_opt=yes
+    suppress_output=
+    arg_mode=normal
+    libobj=
+    later=
+    pie_flag=
+
+    for arg
+    do
+      case $arg_mode in
+      arg  )
+	# do not "continue".  Instead, add this to base_compile
+	lastarg="$arg"
+	arg_mode=normal
+	;;
+
+      target )
+	libobj="$arg"
+	arg_mode=normal
+	continue
+	;;
+
+      normal )
+	# Accept any command-line options.
+	case $arg in
+	-o)
+	  test -n "$libobj" && \
+	    func_fatal_error "you cannot specify \`-o' more than once"
+	  arg_mode=target
+	  continue
+	  ;;
+
+	-pie | -fpie | -fPIE)
+          func_append pie_flag " $arg"
+	  continue
+	  ;;
+
+	-shared | -static | -prefer-pic | -prefer-non-pic)
+	  func_append later " $arg"
+	  continue
+	  ;;
+
+	-no-suppress)
+	  suppress_opt=no
+	  continue
+	  ;;
+
+	-Xcompiler)
+	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
+	  continue      #  The current "srcfile" will either be retained or
+	  ;;            #  replaced later.  I would guess that would be a bug.
+
+	-Wc,*)
+	  func_stripname '-Wc,' '' "$arg"
+	  args=$func_stripname_result
+	  lastarg=
+	  save_ifs="$IFS"; IFS=','
+	  for arg in $args; do
+	    IFS="$save_ifs"
+	    func_append_quoted lastarg "$arg"
+	  done
+	  IFS="$save_ifs"
+	  func_stripname ' ' '' "$lastarg"
+	  lastarg=$func_stripname_result
+
+	  # Add the arguments to base_compile.
+	  func_append base_compile " $lastarg"
+	  continue
+	  ;;
+
+	*)
+	  # Accept the current argument as the source file.
+	  # The previous "srcfile" becomes the current argument.
+	  #
+	  lastarg="$srcfile"
+	  srcfile="$arg"
+	  ;;
+	esac  #  case $arg
+	;;
+      esac    #  case $arg_mode
+
+      # Aesthetically quote the previous argument.
+      func_append_quoted base_compile "$lastarg"
+    done # for arg
+
+    case $arg_mode in
+    arg)
+      func_fatal_error "you must specify an argument for -Xcompile"
+      ;;
+    target)
+      func_fatal_error "you must specify a target with \`-o'"
+      ;;
+    *)
+      # Get the name of the library object.
+      test -z "$libobj" && {
+	func_basename "$srcfile"
+	libobj="$func_basename_result"
+      }
+      ;;
+    esac
+
+    # Recognize several different file suffixes.
+    # If the user specifies -o file.o, it is replaced with file.lo
+    case $libobj in
+    *.[cCFSifmso] | \
+    *.ada | *.adb | *.ads | *.asm | \
+    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
+    *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup)
+      func_xform "$libobj"
+      libobj=$func_xform_result
+      ;;
+    esac
+
+    case $libobj in
+    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
+    *)
+      func_fatal_error "cannot determine name of library object from \`$libobj'"
+      ;;
+    esac
+
+    func_infer_tag $base_compile
+
+    for arg in $later; do
+      case $arg in
+      -shared)
+	test "$build_libtool_libs" != yes && \
+	  func_fatal_configuration "can not build a shared library"
+	build_old_libs=no
+	continue
+	;;
+
+      -static)
+	build_libtool_libs=no
+	build_old_libs=yes
+	continue
+	;;
+
+      -prefer-pic)
+	pic_mode=yes
+	continue
+	;;
+
+      -prefer-non-pic)
+	pic_mode=no
+	continue
+	;;
+      esac
+    done
+
+    func_quote_for_eval "$libobj"
+    test "X$libobj" != "X$func_quote_for_eval_result" \
+      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'	 &()|`$[]' \
+      && func_warning "libobj name \`$libobj' may not contain shell special characters."
+    func_dirname_and_basename "$obj" "/" ""
+    objname="$func_basename_result"
+    xdir="$func_dirname_result"
+    lobj=${xdir}$objdir/$objname
+
+    test -z "$base_compile" && \
+      func_fatal_help "you must specify a compilation command"
+
+    # Delete any leftover library objects.
+    if test "$build_old_libs" = yes; then
+      removelist="$obj $lobj $libobj ${libobj}T"
+    else
+      removelist="$lobj $libobj ${libobj}T"
+    fi
+
+    # On Cygwin there's no "real" PIC flag so we must build both object types
+    case $host_os in
+    cygwin* | mingw* | pw32* | os2* | cegcc*)
+      pic_mode=default
+      ;;
+    esac
+    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
+      # non-PIC code in shared libraries is not supported
+      pic_mode=default
+    fi
+
+    # Calculate the filename of the output object if compiler does
+    # not support -o with -c
+    if test "$compiler_c_o" = no; then
+      output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
+      lockfile="$output_obj.lock"
+    else
+      output_obj=
+      need_locks=no
+      lockfile=
+    fi
+
+    # Lock this critical section if it is needed
+    # We use this script file to make the link, it avoids creating a new file
+    if test "$need_locks" = yes; then
+      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+	func_echo "Waiting for $lockfile to be removed"
+	sleep 2
+      done
+    elif test "$need_locks" = warn; then
+      if test -f "$lockfile"; then
+	$ECHO "\
+*** ERROR, $lockfile exists and contains:
+`cat $lockfile 2>/dev/null`
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$opt_dry_run || $RM $removelist
+	exit $EXIT_FAILURE
+      fi
+      func_append removelist " $output_obj"
+      $ECHO "$srcfile" > "$lockfile"
+    fi
+
+    $opt_dry_run || $RM $removelist
+    func_append removelist " $lockfile"
+    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
+
+    func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
+    srcfile=$func_to_tool_file_result
+    func_quote_for_eval "$srcfile"
+    qsrcfile=$func_quote_for_eval_result
+
+    # Only build a PIC object if we are building libtool libraries.
+    if test "$build_libtool_libs" = yes; then
+      # Without this assignment, base_compile gets emptied.
+      fbsd_hideous_sh_bug=$base_compile
+
+      if test "$pic_mode" != no; then
+	command="$base_compile $qsrcfile $pic_flag"
+      else
+	# Don't build PIC code
+	command="$base_compile $qsrcfile"
+      fi
+
+      func_mkdir_p "$xdir$objdir"
+
+      if test -z "$output_obj"; then
+	# Place PIC objects in $objdir
+	func_append command " -o $lobj"
+      fi
+
+      func_show_eval_locale "$command"	\
+          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
+
+      if test "$need_locks" = warn &&
+	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+	$ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$opt_dry_run || $RM $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed, then go on to compile the next one
+      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
+	func_show_eval '$MV "$output_obj" "$lobj"' \
+	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+      fi
+
+      # Allow error messages only from the first compilation.
+      if test "$suppress_opt" = yes; then
+	suppress_output=' >/dev/null 2>&1'
+      fi
+    fi
+
+    # Only build a position-dependent object if we build old libraries.
+    if test "$build_old_libs" = yes; then
+      if test "$pic_mode" != yes; then
+	# Don't build PIC code
+	command="$base_compile $qsrcfile$pie_flag"
+      else
+	command="$base_compile $qsrcfile $pic_flag"
+      fi
+      if test "$compiler_c_o" = yes; then
+	func_append command " -o $obj"
+      fi
+
+      # Suppress compiler output if we already did a PIC compilation.
+      func_append command "$suppress_output"
+      func_show_eval_locale "$command" \
+        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
+
+      if test "$need_locks" = warn &&
+	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
+	$ECHO "\
+*** ERROR, $lockfile contains:
+`cat $lockfile 2>/dev/null`
+
+but it should contain:
+$srcfile
+
+This indicates that another process is trying to use the same
+temporary object file, and libtool could not work around it because
+your compiler does not support \`-c' and \`-o' together.  If you
+repeat this compilation, it may succeed, by chance, but you had better
+avoid parallel builds (make -j) in this platform, or get a better
+compiler."
+
+	$opt_dry_run || $RM $removelist
+	exit $EXIT_FAILURE
+      fi
+
+      # Just move the object if needed
+      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
+	func_show_eval '$MV "$output_obj" "$obj"' \
+	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+      fi
+    fi
+
+    $opt_dry_run || {
+      func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
+
+      # Unlock the critical section if it was locked
+      if test "$need_locks" != no; then
+	removelist=$lockfile
+        $RM "$lockfile"
+      fi
+    }
+
+    exit $EXIT_SUCCESS
+}
+
+$opt_help || {
+  test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
+}
+
+func_mode_help ()
+{
+    # We need to display help for each of the modes.
+    case $opt_mode in
+      "")
+        # Generic help is extracted from the usage comments
+        # at the start of this file.
+        func_help
+        ;;
+
+      clean)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+        ;;
+
+      compile)
+      $ECHO \
+"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
+  -no-suppress      do not suppress compiler output for multiple passes
+  -prefer-pic       try to build PIC objects only
+  -prefer-non-pic   try to build non-PIC objects only
+  -shared           do not build a \`.o' file suitable for static linking
+  -static           only build a \`.o' file suitable for static linking
+  -Wc,FLAG          pass FLAG directly to the compiler
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+        ;;
+
+      execute)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+  -dlopen FILE      add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+        ;;
+
+      finish)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges.  Use
+the \`--dry-run' option if you just want to see what would be executed."
+        ;;
+
+      install)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command.  The first component should be
+either the \`install' or \`cp' program.
+
+The following components of INSTALL-COMMAND are treated specially:
+
+  -inst-prefix-dir PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+        ;;
+
+      link)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+  -all-static       do not do any dynamic linking at all
+  -avoid-version    do not add a version suffix if possible
+  -bindir BINDIR    specify path to binaries directory (for systems where
+                    libraries must be found in the PATH setting at runtime)
+  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
+  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
+  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+  -export-symbols SYMFILE
+                    try to export only the symbols listed in SYMFILE
+  -export-symbols-regex REGEX
+                    try to export only the symbols matching REGEX
+  -LLIBDIR          search LIBDIR for required installed libraries
+  -lNAME            OUTPUT-FILE requires the installed library libNAME
+  -module           build a library that can dlopened
+  -no-fast-install  disable the fast-install mode
+  -no-install       link a not-installable executable
+  -no-undefined     declare that a library does not refer to external symbols
+  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
+  -objectlist FILE  Use a list of object files found in FILE to specify objects
+  -precious-files-regex REGEX
+                    don't remove output files matching REGEX
+  -release RELEASE  specify package release information
+  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
+  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
+  -shared           only do dynamic linking of libtool libraries
+  -shrext SUFFIX    override the standard shared library file extension
+  -static           do not do any dynamic linking of uninstalled libtool libraries
+  -static-libtool-libs
+                    do not do any dynamic linking of libtool libraries
+  -version-info CURRENT[:REVISION[:AGE]]
+                    specify library version info [each variable defaults to 0]
+  -weak LIBNAME     declare that the target provides the LIBNAME interface
+  -Wc,FLAG
+  -Xcompiler FLAG   pass linker-specific FLAG directly to the compiler
+  -Wl,FLAG
+  -Xlinker FLAG     pass linker-specific FLAG directly to the linker
+  -XCClinker FLAG   pass link-specific FLAG to the compiler driver (CC)
+
+All other options (arguments beginning with \`-') are ignored.
+
+Every other argument is treated as a filename.  Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+        ;;
+
+      uninstall)
+        $ECHO \
+"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+        ;;
+
+      *)
+        func_fatal_help "invalid operation mode \`$opt_mode'"
+        ;;
+    esac
+
+    echo
+    $ECHO "Try \`$progname --help' for more information about other modes."
+}
+
+# Now that we've collected a possible --mode arg, show help if necessary
+if $opt_help; then
+  if test "$opt_help" = :; then
+    func_mode_help
+  else
+    {
+      func_help noexit
+      for opt_mode in compile link execute install finish uninstall clean; do
+	func_mode_help
+      done
+    } | sed -n '1p; 2,$s/^Usage:/  or: /p'
+    {
+      func_help noexit
+      for opt_mode in compile link execute install finish uninstall clean; do
+	echo
+	func_mode_help
+      done
+    } |
+    sed '1d
+      /^When reporting/,/^Report/{
+	H
+	d
+      }
+      $x
+      /information about other modes/d
+      /more detailed .*MODE/d
+      s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
+  fi
+  exit $?
+fi
+
+
+# func_mode_execute arg...
+func_mode_execute ()
+{
+    $opt_debug
+    # The first argument is the command name.
+    cmd="$nonopt"
+    test -z "$cmd" && \
+      func_fatal_help "you must specify a COMMAND"
+
+    # Handle -dlopen flags immediately.
+    for file in $opt_dlopen; do
+      test -f "$file" \
+	|| func_fatal_help "\`$file' is not a file"
+
+      dir=
+      case $file in
+      *.la)
+	func_resolve_sysroot "$file"
+	file=$func_resolve_sysroot_result
+
+	# Check to see that this really is a libtool archive.
+	func_lalib_unsafe_p "$file" \
+	  || func_fatal_help "\`$lib' is not a valid libtool archive"
+
+	# Read the libtool library.
+	dlname=
+	library_names=
+	func_source "$file"
+
+	# Skip this library if it cannot be dlopened.
+	if test -z "$dlname"; then
+	  # Warn if it was a shared library.
+	  test -n "$library_names" && \
+	    func_warning "\`$file' was not linked with \`-export-dynamic'"
+	  continue
+	fi
+
+	func_dirname "$file" "" "."
+	dir="$func_dirname_result"
+
+	if test -f "$dir/$objdir/$dlname"; then
+	  func_append dir "/$objdir"
+	else
+	  if test ! -f "$dir/$dlname"; then
+	    func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
+	  fi
+	fi
+	;;
+
+      *.lo)
+	# Just add the directory containing the .lo file.
+	func_dirname "$file" "" "."
+	dir="$func_dirname_result"
+	;;
+
+      *)
+	func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
+	continue
+	;;
+      esac
+
+      # Get the absolute pathname.
+      absdir=`cd "$dir" && pwd`
+      test -n "$absdir" && dir="$absdir"
+
+      # Now add the directory to shlibpath_var.
+      if eval "test -z \"\$$shlibpath_var\""; then
+	eval "$shlibpath_var=\"\$dir\""
+      else
+	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+      fi
+    done
+
+    # This variable tells wrapper scripts just to set shlibpath_var
+    # rather than running their programs.
+    libtool_execute_magic="$magic"
+
+    # Check if any of the arguments is a wrapper script.
+    args=
+    for file
+    do
+      case $file in
+      -* | *.la | *.lo ) ;;
+      *)
+	# Do a test to see if this is really a libtool program.
+	if func_ltwrapper_script_p "$file"; then
+	  func_source "$file"
+	  # Transform arg to wrapped name.
+	  file="$progdir/$program"
+	elif func_ltwrapper_executable_p "$file"; then
+	  func_ltwrapper_scriptname "$file"
+	  func_source "$func_ltwrapper_scriptname_result"
+	  # Transform arg to wrapped name.
+	  file="$progdir/$program"
+	fi
+	;;
+      esac
+      # Quote arguments (to preserve shell metacharacters).
+      func_append_quoted args "$file"
+    done
+
+    if test "X$opt_dry_run" = Xfalse; then
+      if test -n "$shlibpath_var"; then
+	# Export the shlibpath_var.
+	eval "export $shlibpath_var"
+      fi
+
+      # Restore saved environment variables
+      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+      do
+	eval "if test \"\${save_$lt_var+set}\" = set; then
+                $lt_var=\$save_$lt_var; export $lt_var
+	      else
+		$lt_unset $lt_var
+	      fi"
+      done
+
+      # Now prepare to actually exec the command.
+      exec_cmd="\$cmd$args"
+    else
+      # Display what would be done.
+      if test -n "$shlibpath_var"; then
+	eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
+	echo "export $shlibpath_var"
+      fi
+      $ECHO "$cmd$args"
+      exit $EXIT_SUCCESS
+    fi
+}
+
+test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
+
+
+# func_mode_finish arg...
+func_mode_finish ()
+{
+    $opt_debug
+    libs=
+    libdirs=
+    admincmds=
+
+    for opt in "$nonopt" ${1+"$@"}
+    do
+      if test -d "$opt"; then
+	func_append libdirs " $opt"
+
+      elif test -f "$opt"; then
+	if func_lalib_unsafe_p "$opt"; then
+	  func_append libs " $opt"
+	else
+	  func_warning "\`$opt' is not a valid libtool archive"
+	fi
+
+      else
+	func_fatal_error "invalid argument \`$opt'"
+      fi
+    done
+
+    if test -n "$libs"; then
+      if test -n "$lt_sysroot"; then
+        sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
+        sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
+      else
+        sysroot_cmd=
+      fi
+
+      # Remove sysroot references
+      if $opt_dry_run; then
+        for lib in $libs; do
+          echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
+        done
+      else
+        tmpdir=`func_mktempdir`
+        for lib in $libs; do
+	  sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
+	    > $tmpdir/tmp-la
+	  mv -f $tmpdir/tmp-la $lib
+	done
+        ${RM}r "$tmpdir"
+      fi
+    fi
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      for libdir in $libdirs; do
+	if test -n "$finish_cmds"; then
+	  # Do each command in the finish commands.
+	  func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
+'"$cmd"'"'
+	fi
+	if test -n "$finish_eval"; then
+	  # Do the single finish_eval.
+	  eval cmds=\"$finish_eval\"
+	  $opt_dry_run || eval "$cmds" || func_append admincmds "
+       $cmds"
+	fi
+      done
+    fi
+
+    # Exit here if they wanted silent mode.
+    $opt_silent && exit $EXIT_SUCCESS
+
+    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+      echo "----------------------------------------------------------------------"
+      echo "Libraries have been installed in:"
+      for libdir in $libdirs; do
+	$ECHO "   $libdir"
+      done
+      echo
+      echo "If you ever happen to want to link against installed libraries"
+      echo "in a given directory, LIBDIR, you must either use libtool, and"
+      echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+      echo "flag during linking and do at least one of the following:"
+      if test -n "$shlibpath_var"; then
+	echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
+	echo "     during execution"
+      fi
+      if test -n "$runpath_var"; then
+	echo "   - add LIBDIR to the \`$runpath_var' environment variable"
+	echo "     during linking"
+      fi
+      if test -n "$hardcode_libdir_flag_spec"; then
+	libdir=LIBDIR
+	eval flag=\"$hardcode_libdir_flag_spec\"
+
+	$ECHO "   - use the \`$flag' linker flag"
+      fi
+      if test -n "$admincmds"; then
+	$ECHO "   - have your system administrator run these commands:$admincmds"
+      fi
+      if test -f /etc/ld.so.conf; then
+	echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+      fi
+      echo
+
+      echo "See any operating system documentation about shared libraries for"
+      case $host in
+	solaris2.[6789]|solaris2.1[0-9])
+	  echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
+	  echo "pages."
+	  ;;
+	*)
+	  echo "more information, such as the ld(1) and ld.so(8) manual pages."
+	  ;;
+      esac
+      echo "----------------------------------------------------------------------"
+    fi
+    exit $EXIT_SUCCESS
+}
+
+test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
+
+
+# func_mode_install arg...
+func_mode_install ()
+{
+    $opt_debug
+    # There may be an optional sh(1) argument at the beginning of
+    # install_prog (especially on Windows NT).
+    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+       # Allow the use of GNU shtool's install command.
+       case $nonopt in *shtool*) :;; *) false;; esac; then
+      # Aesthetically quote it.
+      func_quote_for_eval "$nonopt"
+      install_prog="$func_quote_for_eval_result "
+      arg=$1
+      shift
+    else
+      install_prog=
+      arg=$nonopt
+    fi
+
+    # The real first argument should be the name of the installation program.
+    # Aesthetically quote it.
+    func_quote_for_eval "$arg"
+    func_append install_prog "$func_quote_for_eval_result"
+    install_shared_prog=$install_prog
+    case " $install_prog " in
+      *[\\\ /]cp\ *) install_cp=: ;;
+      *) install_cp=false ;;
+    esac
+
+    # We need to accept at least all the BSD install flags.
+    dest=
+    files=
+    opts=
+    prev=
+    install_type=
+    isdir=no
+    stripme=
+    no_mode=:
+    for arg
+    do
+      arg2=
+      if test -n "$dest"; then
+	func_append files " $dest"
+	dest=$arg
+	continue
+      fi
+
+      case $arg in
+      -d) isdir=yes ;;
+      -f)
+	if $install_cp; then :; else
+	  prev=$arg
+	fi
+	;;
+      -g | -m | -o)
+	prev=$arg
+	;;
+      -s)
+	stripme=" -s"
+	continue
+	;;
+      -*)
+	;;
+      *)
+	# If the previous option needed an argument, then skip it.
+	if test -n "$prev"; then
+	  if test "x$prev" = x-m && test -n "$install_override_mode"; then
+	    arg2=$install_override_mode
+	    no_mode=false
+	  fi
+	  prev=
+	else
+	  dest=$arg
+	  continue
+	fi
+	;;
+      esac
+
+      # Aesthetically quote the argument.
+      func_quote_for_eval "$arg"
+      func_append install_prog " $func_quote_for_eval_result"
+      if test -n "$arg2"; then
+	func_quote_for_eval "$arg2"
+      fi
+      func_append install_shared_prog " $func_quote_for_eval_result"
+    done
+
+    test -z "$install_prog" && \
+      func_fatal_help "you must specify an install program"
+
+    test -n "$prev" && \
+      func_fatal_help "the \`$prev' option requires an argument"
+
+    if test -n "$install_override_mode" && $no_mode; then
+      if $install_cp; then :; else
+	func_quote_for_eval "$install_override_mode"
+	func_append install_shared_prog " -m $func_quote_for_eval_result"
+      fi
+    fi
+
+    if test -z "$files"; then
+      if test -z "$dest"; then
+	func_fatal_help "no file or destination specified"
+      else
+	func_fatal_help "you must specify a destination"
+      fi
+    fi
+
+    # Strip any trailing slash from the destination.
+    func_stripname '' '/' "$dest"
+    dest=$func_stripname_result
+
+    # Check to see that the destination is a directory.
+    test -d "$dest" && isdir=yes
+    if test "$isdir" = yes; then
+      destdir="$dest"
+      destname=
+    else
+      func_dirname_and_basename "$dest" "" "."
+      destdir="$func_dirname_result"
+      destname="$func_basename_result"
+
+      # Not a directory, so check to see that there is only one file specified.
+      set dummy $files; shift
+      test "$#" -gt 1 && \
+	func_fatal_help "\`$dest' is not a directory"
+    fi
+    case $destdir in
+    [\\/]* | [A-Za-z]:[\\/]*) ;;
+    *)
+      for file in $files; do
+	case $file in
+	*.lo) ;;
+	*)
+	  func_fatal_help "\`$destdir' must be an absolute directory name"
+	  ;;
+	esac
+      done
+      ;;
+    esac
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    staticlibs=
+    future_libdirs=
+    current_libdirs=
+    for file in $files; do
+
+      # Do each installation.
+      case $file in
+      *.$libext)
+	# Do the static libraries later.
+	func_append staticlibs " $file"
+	;;
+
+      *.la)
+	func_resolve_sysroot "$file"
+	file=$func_resolve_sysroot_result
+
+	# Check to see that this really is a libtool archive.
+	func_lalib_unsafe_p "$file" \
+	  || func_fatal_help "\`$file' is not a valid libtool archive"
+
+	library_names=
+	old_library=
+	relink_command=
+	func_source "$file"
+
+	# Add the libdir to current_libdirs if it is the destination.
+	if test "X$destdir" = "X$libdir"; then
+	  case "$current_libdirs " in
+	  *" $libdir "*) ;;
+	  *) func_append current_libdirs " $libdir" ;;
+	  esac
+	else
+	  # Note the libdir as a future libdir.
+	  case "$future_libdirs " in
+	  *" $libdir "*) ;;
+	  *) func_append future_libdirs " $libdir" ;;
+	  esac
+	fi
+
+	func_dirname "$file" "/" ""
+	dir="$func_dirname_result"
+	func_append dir "$objdir"
+
+	if test -n "$relink_command"; then
+	  # Determine the prefix the user has applied to our future dir.
+	  inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
+
+	  # Don't allow the user to place us outside of our expected
+	  # location b/c this prevents finding dependent libraries that
+	  # are installed to the same prefix.
+	  # At present, this check doesn't affect windows .dll's that
+	  # are installed into $libdir/../bin (currently, that works fine)
+	  # but it's something to keep an eye on.
+	  test "$inst_prefix_dir" = "$destdir" && \
+	    func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
+
+	  if test -n "$inst_prefix_dir"; then
+	    # Stick the inst_prefix_dir data into the link command.
+	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+	  else
+	    relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
+	  fi
+
+	  func_warning "relinking \`$file'"
+	  func_show_eval "$relink_command" \
+	    'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
+	fi
+
+	# See the names of the shared library.
+	set dummy $library_names; shift
+	if test -n "$1"; then
+	  realname="$1"
+	  shift
+
+	  srcname="$realname"
+	  test -n "$relink_command" && srcname="$realname"T
+
+	  # Install the shared library and build the symlinks.
+	  func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
+	      'exit $?'
+	  tstripme="$stripme"
+	  case $host_os in
+	  cygwin* | mingw* | pw32* | cegcc*)
+	    case $realname in
+	    *.dll.a)
+	      tstripme=""
+	      ;;
+	    esac
+	    ;;
+	  esac
+	  if test -n "$tstripme" && test -n "$striplib"; then
+	    func_show_eval "$striplib $destdir/$realname" 'exit $?'
+	  fi
+
+	  if test "$#" -gt 0; then
+	    # Delete the old symlinks, and create new ones.
+	    # Try `ln -sf' first, because the `ln' binary might depend on
+	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
+	    # so we also need to try rm && ln -s.
+	    for linkname
+	    do
+	      test "$linkname" != "$realname" \
+		&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
+	    done
+	  fi
+
+	  # Do each command in the postinstall commands.
+	  lib="$destdir/$realname"
+	  func_execute_cmds "$postinstall_cmds" 'exit $?'
+	fi
+
+	# Install the pseudo-library for information purposes.
+	func_basename "$file"
+	name="$func_basename_result"
+	instname="$dir/$name"i
+	func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
+
+	# Maybe install the static library, too.
+	test -n "$old_library" && func_append staticlibs " $dir/$old_library"
+	;;
+
+      *.lo)
+	# Install (i.e. copy) a libtool object.
+
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  func_basename "$file"
+	  destfile="$func_basename_result"
+	  destfile="$destdir/$destfile"
+	fi
+
+	# Deduce the name of the destination old-style object file.
+	case $destfile in
+	*.lo)
+	  func_lo2o "$destfile"
+	  staticdest=$func_lo2o_result
+	  ;;
+	*.$objext)
+	  staticdest="$destfile"
+	  destfile=
+	  ;;
+	*)
+	  func_fatal_help "cannot copy a libtool object to \`$destfile'"
+	  ;;
+	esac
+
+	# Install the libtool object if requested.
+	test -n "$destfile" && \
+	  func_show_eval "$install_prog $file $destfile" 'exit $?'
+
+	# Install the old object if enabled.
+	if test "$build_old_libs" = yes; then
+	  # Deduce the name of the old-style object file.
+	  func_lo2o "$file"
+	  staticobj=$func_lo2o_result
+	  func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
+	fi
+	exit $EXIT_SUCCESS
+	;;
+
+      *)
+	# Figure out destination file name, if it wasn't already specified.
+	if test -n "$destname"; then
+	  destfile="$destdir/$destname"
+	else
+	  func_basename "$file"
+	  destfile="$func_basename_result"
+	  destfile="$destdir/$destfile"
+	fi
+
+	# If the file is missing, and there is a .exe on the end, strip it
+	# because it is most likely a libtool script we actually want to
+	# install
+	stripped_ext=""
+	case $file in
+	  *.exe)
+	    if test ! -f "$file"; then
+	      func_stripname '' '.exe' "$file"
+	      file=$func_stripname_result
+	      stripped_ext=".exe"
+	    fi
+	    ;;
+	esac
+
+	# Do a test to see if this is really a libtool program.
+	case $host in
+	*cygwin* | *mingw*)
+	    if func_ltwrapper_executable_p "$file"; then
+	      func_ltwrapper_scriptname "$file"
+	      wrapper=$func_ltwrapper_scriptname_result
+	    else
+	      func_stripname '' '.exe' "$file"
+	      wrapper=$func_stripname_result
+	    fi
+	    ;;
+	*)
+	    wrapper=$file
+	    ;;
+	esac
+	if func_ltwrapper_script_p "$wrapper"; then
+	  notinst_deplibs=
+	  relink_command=
+
+	  func_source "$wrapper"
+
+	  # Check the variables that should have been set.
+	  test -z "$generated_by_libtool_version" && \
+	    func_fatal_error "invalid libtool wrapper script \`$wrapper'"
+
+	  finalize=yes
+	  for lib in $notinst_deplibs; do
+	    # Check to see that each library is installed.
+	    libdir=
+	    if test -f "$lib"; then
+	      func_source "$lib"
+	    fi
+	    libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
+	    if test -n "$libdir" && test ! -f "$libfile"; then
+	      func_warning "\`$lib' has not been installed in \`$libdir'"
+	      finalize=no
+	    fi
+	  done
+
+	  relink_command=
+	  func_source "$wrapper"
+
+	  outputname=
+	  if test "$fast_install" = no && test -n "$relink_command"; then
+	    $opt_dry_run || {
+	      if test "$finalize" = yes; then
+	        tmpdir=`func_mktempdir`
+		func_basename "$file$stripped_ext"
+		file="$func_basename_result"
+	        outputname="$tmpdir/$file"
+	        # Replace the output file specification.
+	        relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
+
+	        $opt_silent || {
+	          func_quote_for_expand "$relink_command"
+		  eval "func_echo $func_quote_for_expand_result"
+	        }
+	        if eval "$relink_command"; then :
+	          else
+		  func_error "error: relink \`$file' with the above command before installing it"
+		  $opt_dry_run || ${RM}r "$tmpdir"
+		  continue
+	        fi
+	        file="$outputname"
+	      else
+	        func_warning "cannot relink \`$file'"
+	      fi
+	    }
+	  else
+	    # Install the binary that we compiled earlier.
+	    file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
+	  fi
+	fi
+
+	# remove .exe since cygwin /usr/bin/install will append another
+	# one anyway
+	case $install_prog,$host in
+	*/usr/bin/install*,*cygwin*)
+	  case $file:$destfile in
+	  *.exe:*.exe)
+	    # this is ok
+	    ;;
+	  *.exe:*)
+	    destfile=$destfile.exe
+	    ;;
+	  *:*.exe)
+	    func_stripname '' '.exe' "$destfile"
+	    destfile=$func_stripname_result
+	    ;;
+	  esac
+	  ;;
+	esac
+	func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
+	$opt_dry_run || if test -n "$outputname"; then
+	  ${RM}r "$tmpdir"
+	fi
+	;;
+      esac
+    done
+
+    for file in $staticlibs; do
+      func_basename "$file"
+      name="$func_basename_result"
+
+      # Set up the ranlib parameters.
+      oldlib="$destdir/$name"
+
+      func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
+
+      if test -n "$stripme" && test -n "$old_striplib"; then
+	func_show_eval "$old_striplib $oldlib" 'exit $?'
+      fi
+
+      # Do each command in the postinstall commands.
+      func_execute_cmds "$old_postinstall_cmds" 'exit $?'
+    done
+
+    test -n "$future_libdirs" && \
+      func_warning "remember to run \`$progname --finish$future_libdirs'"
+
+    if test -n "$current_libdirs"; then
+      # Maybe just do a dry run.
+      $opt_dry_run && current_libdirs=" -n$current_libdirs"
+      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+    else
+      exit $EXIT_SUCCESS
+    fi
+}
+
+test "$opt_mode" = install && func_mode_install ${1+"$@"}
+
+
+# func_generate_dlsyms outputname originator pic_p
+# Extract symbols from dlprefiles and create ${outputname}S.o with
+# a dlpreopen symbol table.
+func_generate_dlsyms ()
+{
+    $opt_debug
+    my_outputname="$1"
+    my_originator="$2"
+    my_pic_p="${3-no}"
+    my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
+    my_dlsyms=
+
+    if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+      if test -n "$NM" && test -n "$global_symbol_pipe"; then
+	my_dlsyms="${my_outputname}S.c"
+      else
+	func_error "not configured to extract global symbols from dlpreopened files"
+      fi
+    fi
+
+    if test -n "$my_dlsyms"; then
+      case $my_dlsyms in
+      "") ;;
+      *.c)
+	# Discover the nlist of each of the dlfiles.
+	nlist="$output_objdir/${my_outputname}.nm"
+
+	func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
+
+	# Parse the name list into a source file.
+	func_verbose "creating $output_objdir/$my_dlsyms"
+
+	$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
+/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
+/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
+#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
+#endif
+
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
+
+/* External symbol declarations for the compiler. */\
+"
+
+	if test "$dlself" = yes; then
+	  func_verbose "generating symbol list for \`$output'"
+
+	  $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
+
+	  # Add our own program objects to the symbol list.
+	  progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+	  for progfile in $progfiles; do
+	    func_to_tool_file "$progfile" func_convert_file_msys_to_w32
+	    func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
+	    $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
+	  done
+
+	  if test -n "$exclude_expsyms"; then
+	    $opt_dry_run || {
+	      eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+	      eval '$MV "$nlist"T "$nlist"'
+	    }
+	  fi
+
+	  if test -n "$export_symbols_regex"; then
+	    $opt_dry_run || {
+	      eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+	      eval '$MV "$nlist"T "$nlist"'
+	    }
+	  fi
+
+	  # Prepare the list of exported symbols
+	  if test -z "$export_symbols"; then
+	    export_symbols="$output_objdir/$outputname.exp"
+	    $opt_dry_run || {
+	      $RM $export_symbols
+	      eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+	      case $host in
+	      *cygwin* | *mingw* | *cegcc* )
+                eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+                eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+	        ;;
+	      esac
+	    }
+	  else
+	    $opt_dry_run || {
+	      eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+	      eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+	      eval '$MV "$nlist"T "$nlist"'
+	      case $host in
+	        *cygwin* | *mingw* | *cegcc* )
+	          eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+	          eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+	          ;;
+	      esac
+	    }
+	  fi
+	fi
+
+	for dlprefile in $dlprefiles; do
+	  func_verbose "extracting global C symbols from \`$dlprefile'"
+	  func_basename "$dlprefile"
+	  name="$func_basename_result"
+          case $host in
+	    *cygwin* | *mingw* | *cegcc* )
+	      # if an import library, we need to obtain dlname
+	      if func_win32_import_lib_p "$dlprefile"; then
+	        func_tr_sh "$dlprefile"
+	        eval "curr_lafile=\$libfile_$func_tr_sh_result"
+	        dlprefile_dlbasename=""
+	        if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
+	          # Use subshell, to avoid clobbering current variable values
+	          dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
+	          if test -n "$dlprefile_dlname" ; then
+	            func_basename "$dlprefile_dlname"
+	            dlprefile_dlbasename="$func_basename_result"
+	          else
+	            # no lafile. user explicitly requested -dlpreopen <import library>.
+	            $sharedlib_from_linklib_cmd "$dlprefile"
+	            dlprefile_dlbasename=$sharedlib_from_linklib_result
+	          fi
+	        fi
+	        $opt_dry_run || {
+	          if test -n "$dlprefile_dlbasename" ; then
+	            eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
+	          else
+	            func_warning "Could not compute DLL name from $name"
+	            eval '$ECHO ": $name " >> "$nlist"'
+	          fi
+	          func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+	          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
+	            $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
+	        }
+	      else # not an import lib
+	        $opt_dry_run || {
+	          eval '$ECHO ": $name " >> "$nlist"'
+	          func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+	          eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+	        }
+	      fi
+	    ;;
+	    *)
+	      $opt_dry_run || {
+	        eval '$ECHO ": $name " >> "$nlist"'
+	        func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
+	        eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+	      }
+	    ;;
+          esac
+	done
+
+	$opt_dry_run || {
+	  # Make sure we have at least an empty file.
+	  test -f "$nlist" || : > "$nlist"
+
+	  if test -n "$exclude_expsyms"; then
+	    $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+	    $MV "$nlist"T "$nlist"
+	  fi
+
+	  # Try sorting and uniquifying the output.
+	  if $GREP -v "^: " < "$nlist" |
+	      if sort -k 3 </dev/null >/dev/null 2>&1; then
+		sort -k 3
+	      else
+		sort +2
+	      fi |
+	      uniq > "$nlist"S; then
+	    :
+	  else
+	    $GREP -v "^: " < "$nlist" > "$nlist"S
+	  fi
+
+	  if test -f "$nlist"S; then
+	    eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
+	  else
+	    echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
+	  fi
+
+	  echo >> "$output_objdir/$my_dlsyms" "\
+
+/* The mapping between symbol names and symbols.  */
+typedef struct {
+  const char *name;
+  void *address;
+} lt_dlsymlist;
+extern LT_DLSYM_CONST lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[];
+LT_DLSYM_CONST lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[] =
+{\
+  { \"$my_originator\", (void *) 0 },"
+
+	  case $need_lib_prefix in
+	  no)
+	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
+	    ;;
+	  *)
+	    eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
+	    ;;
+	  esac
+	  echo >> "$output_objdir/$my_dlsyms" "\
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt_${my_prefix}_LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+	} # !$opt_dry_run
+
+	pic_flag_for_symtable=
+	case "$compile_command " in
+	*" -static "*) ;;
+	*)
+	  case $host in
+	  # compiling the symbol table file with pic_flag works around
+	  # a FreeBSD bug that causes programs to crash when -lm is
+	  # linked before any other PIC object.  But we must not use
+	  # pic_flag when linking with -static.  The problem exists in
+	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+	    pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
+	  *-*-hpux*)
+	    pic_flag_for_symtable=" $pic_flag"  ;;
+	  *)
+	    if test "X$my_pic_p" != Xno; then
+	      pic_flag_for_symtable=" $pic_flag"
+	    fi
+	    ;;
+	  esac
+	  ;;
+	esac
+	symtab_cflags=
+	for arg in $LTCFLAGS; do
+	  case $arg in
+	  -pie | -fpie | -fPIE) ;;
+	  *) func_append symtab_cflags " $arg" ;;
+	  esac
+	done
+
+	# Now compile the dynamic symbol file.
+	func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
+
+	# Clean up the generated files.
+	func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
+
+	# Transform the symbol file into the correct name.
+	symfileobj="$output_objdir/${my_outputname}S.$objext"
+	case $host in
+	*cygwin* | *mingw* | *cegcc* )
+	  if test -f "$output_objdir/$my_outputname.def"; then
+	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+	  else
+	    compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	    finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	  fi
+	  ;;
+	*)
+	  compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	  finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
+	  ;;
+	esac
+	;;
+      *)
+	func_fatal_error "unknown suffix for \`$my_dlsyms'"
+	;;
+      esac
+    else
+      # We keep going just in case the user didn't refer to
+      # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
+      # really was required.
+
+      # Nullify the symbol file.
+      compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
+      finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
+    fi
+}
+
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+# Despite the name, also deal with 64 bit binaries.
+func_win32_libid ()
+{
+  $opt_debug
+  win32_libid_type="unknown"
+  win32_fileres=`file -L $1 2>/dev/null`
+  case $win32_fileres in
+  *ar\ archive\ import\ library*) # definitely import
+    win32_libid_type="x86 archive import"
+    ;;
+  *ar\ archive*) # could be an import, or static
+    # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
+    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
+       $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
+      func_to_tool_file "$1" func_convert_file_msys_to_w32
+      win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
+	$SED -n -e '
+	    1,100{
+		/ I /{
+		    s,.*,import,
+		    p
+		    q
+		}
+	    }'`
+      case $win32_nmres in
+      import*)  win32_libid_type="x86 archive import";;
+      *)        win32_libid_type="x86 archive static";;
+      esac
+    fi
+    ;;
+  *DLL*)
+    win32_libid_type="x86 DLL"
+    ;;
+  *executable*) # but shell scripts are "executable" too...
+    case $win32_fileres in
+    *MS\ Windows\ PE\ Intel*)
+      win32_libid_type="x86 DLL"
+      ;;
+    esac
+    ;;
+  esac
+  $ECHO "$win32_libid_type"
+}
+
+# func_cygming_dll_for_implib ARG
+#
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+# Invoked by eval'ing the libtool variable
+#    $sharedlib_from_linklib_cmd
+# Result is available in the variable
+#    $sharedlib_from_linklib_result
+func_cygming_dll_for_implib ()
+{
+  $opt_debug
+  sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
+}
+
+# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
+#
+# The is the core of a fallback implementation of a
+# platform-specific function to extract the name of the
+# DLL associated with the specified import library LIBNAME.
+#
+# SECTION_NAME is either .idata$6 or .idata$7, depending
+# on the platform and compiler that created the implib.
+#
+# Echos the name of the DLL associated with the
+# specified import library.
+func_cygming_dll_for_implib_fallback_core ()
+{
+  $opt_debug
+  match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
+  $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
+    $SED '/^Contents of section '"$match_literal"':/{
+      # Place marker at beginning of archive member dllname section
+      s/.*/====MARK====/
+      p
+      d
+    }
+    # These lines can sometimes be longer than 43 characters, but
+    # are always uninteresting
+    /:[	 ]*file format pe[i]\{,1\}-/d
+    /^In archive [^:]*:/d
+    # Ensure marker is printed
+    /^====MARK====/p
+    # Remove all lines with less than 43 characters
+    /^.\{43\}/!d
+    # From remaining lines, remove first 43 characters
+    s/^.\{43\}//' |
+    $SED -n '
+      # Join marker and all lines until next marker into a single line
+      /^====MARK====/ b para
+      H
+      $ b para
+      b
+      :para
+      x
+      s/\n//g
+      # Remove the marker
+      s/^====MARK====//
+      # Remove trailing dots and whitespace
+      s/[\. \t]*$//
+      # Print
+      /./p' |
+    # we now have a list, one entry per line, of the stringified
+    # contents of the appropriate section of all members of the
+    # archive which possess that section. Heuristic: eliminate
+    # all those which have a first or second character that is
+    # a '.' (that is, objdump's representation of an unprintable
+    # character.) This should work for all archives with less than
+    # 0x302f exports -- but will fail for DLLs whose name actually
+    # begins with a literal '.' or a single character followed by
+    # a '.'.
+    #
+    # Of those that remain, print the first one.
+    $SED -e '/^\./d;/^.\./d;q'
+}
+
+# func_cygming_gnu_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is a GNU/binutils-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_gnu_implib_p ()
+{
+  $opt_debug
+  func_to_tool_file "$1" func_convert_file_msys_to_w32
+  func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
+  test -n "$func_cygming_gnu_implib_tmp"
+}
+
+# func_cygming_ms_implib_p ARG
+# This predicate returns with zero status (TRUE) if
+# ARG is an MS-style import library. Returns
+# with nonzero status (FALSE) otherwise.
+func_cygming_ms_implib_p ()
+{
+  $opt_debug
+  func_to_tool_file "$1" func_convert_file_msys_to_w32
+  func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
+  test -n "$func_cygming_ms_implib_tmp"
+}
+
+# func_cygming_dll_for_implib_fallback ARG
+# Platform-specific function to extract the
+# name of the DLL associated with the specified
+# import library ARG.
+#
+# This fallback implementation is for use when $DLLTOOL
+# does not support the --identify-strict option.
+# Invoked by eval'ing the libtool variable
+#    $sharedlib_from_linklib_cmd
+# Result is available in the variable
+#    $sharedlib_from_linklib_result
+func_cygming_dll_for_implib_fallback ()
+{
+  $opt_debug
+  if func_cygming_gnu_implib_p "$1" ; then
+    # binutils import library
+    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
+  elif func_cygming_ms_implib_p "$1" ; then
+    # ms-generated import library
+    sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
+  else
+    # unknown
+    sharedlib_from_linklib_result=""
+  fi
+}
+
+
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+    $opt_debug
+    f_ex_an_ar_dir="$1"; shift
+    f_ex_an_ar_oldlib="$1"
+    if test "$lock_old_archive_extraction" = yes; then
+      lockfile=$f_ex_an_ar_oldlib.lock
+      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+	func_echo "Waiting for $lockfile to be removed"
+	sleep 2
+      done
+    fi
+    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
+		   'stat=$?; rm -f "$lockfile"; exit $stat'
+    if test "$lock_old_archive_extraction" = yes; then
+      $opt_dry_run || rm -f "$lockfile"
+    fi
+    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+     :
+    else
+      func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
+    fi
+}
+
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+    $opt_debug
+    my_gentop="$1"; shift
+    my_oldlibs=${1+"$@"}
+    my_oldobjs=""
+    my_xlib=""
+    my_xabs=""
+    my_xdir=""
+
+    for my_xlib in $my_oldlibs; do
+      # Extract the objects.
+      case $my_xlib in
+	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+	*) my_xabs=`pwd`"/$my_xlib" ;;
+      esac
+      func_basename "$my_xlib"
+      my_xlib="$func_basename_result"
+      my_xlib_u=$my_xlib
+      while :; do
+        case " $extracted_archives " in
+	*" $my_xlib_u "*)
+	  func_arith $extracted_serial + 1
+	  extracted_serial=$func_arith_result
+	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
+	*) break ;;
+	esac
+      done
+      extracted_archives="$extracted_archives $my_xlib_u"
+      my_xdir="$my_gentop/$my_xlib_u"
+
+      func_mkdir_p "$my_xdir"
+
+      case $host in
+      *-darwin*)
+	func_verbose "Extracting $my_xabs"
+	# Do not bother doing anything if just a dry run
+	$opt_dry_run || {
+	  darwin_orig_dir=`pwd`
+	  cd $my_xdir || exit $?
+	  darwin_archive=$my_xabs
+	  darwin_curdir=`pwd`
+	  darwin_base_archive=`basename "$darwin_archive"`
+	  darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
+	  if test -n "$darwin_arches"; then
+	    darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
+	    darwin_arch=
+	    func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
+	    for darwin_arch in  $darwin_arches ; do
+	      func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+	      $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+	      cd "$darwin_curdir"
+	      $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+	    done # $darwin_arches
+            ## Okay now we've a bunch of thin objects, gotta fatten them up :)
+	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
+	    darwin_file=
+	    darwin_files=
+	    for darwin_file in $darwin_filelist; do
+	      darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
+	      $LIPO -create -output "$darwin_file" $darwin_files
+	    done # $darwin_filelist
+	    $RM -rf unfat-$$
+	    cd "$darwin_orig_dir"
+	  else
+	    cd $darwin_orig_dir
+	    func_extract_an_archive "$my_xdir" "$my_xabs"
+	  fi # $darwin_arches
+	} # !$opt_dry_run
+	;;
+      *)
+        func_extract_an_archive "$my_xdir" "$my_xabs"
+	;;
+      esac
+      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
+    done
+
+    func_extract_archives_result="$my_oldobjs"
+}
+
+
+# func_emit_wrapper [arg=no]
+#
+# Emit a libtool wrapper script on stdout.
+# Don't directly open a file because we may want to
+# incorporate the script contents within a cygwin/mingw
+# wrapper executable.  Must ONLY be called from within
+# func_mode_link because it depends on a number of variables
+# set therein.
+#
+# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
+# variable will take.  If 'yes', then the emitted script
+# will assume that the directory in which it is stored is
+# the $objdir directory.  This is a cygwin/mingw-specific
+# behavior.
+func_emit_wrapper ()
+{
+	func_emit_wrapper_arg1=${1-no}
+
+	$ECHO "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting.  It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='$sed_quote_subst'
+
+# Be Bourne compatible
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+  # install mode needs the following variables:
+  generated_by_libtool_version='$macro_version'
+  notinst_deplibs='$notinst_deplibs'
+else
+  # When we are sourced in execute mode, \$file and \$ECHO are already set.
+  if test \"\$libtool_execute_magic\" != \"$magic\"; then
+    file=\"\$0\""
+
+    qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
+    $ECHO "\
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
+}
+    ECHO=\"$qECHO\"
+  fi
+
+# Very basic option parsing. These options are (a) specific to
+# the libtool wrapper, (b) are identical between the wrapper
+# /script/ and the wrapper /executable/ which is used only on
+# windows platforms, and (c) all begin with the string "--lt-"
+# (application programs are unlikely to have options which match
+# this pattern).
+#
+# There are only two supported options: --lt-debug and
+# --lt-dump-script. There is, deliberately, no --lt-help.
+#
+# The first argument to this parsing function should be the
+# script's $0 value, followed by "$@".
+lt_option_debug=
+func_parse_lt_options ()
+{
+  lt_script_arg0=\$0
+  shift
+  for lt_opt
+  do
+    case \"\$lt_opt\" in
+    --lt-debug) lt_option_debug=1 ;;
+    --lt-dump-script)
+        lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
+        test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
+        lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
+        cat \"\$lt_dump_D/\$lt_dump_F\"
+        exit 0
+      ;;
+    --lt-*)
+        \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
+        exit 1
+      ;;
+    esac
+  done
+
+  # Print the debug banner immediately:
+  if test -n \"\$lt_option_debug\"; then
+    echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
+  fi
+}
+
+# Used when --lt-debug. Prints its arguments to stdout
+# (redirection is the responsibility of the caller)
+func_lt_dump_args ()
+{
+  lt_dump_args_N=1;
+  for lt_arg
+  do
+    \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
+    lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
+  done
+}
+
+# Core function for launching the target application
+func_exec_program_core ()
+{
+"
+  case $host in
+  # Backslashes separate directories on plain windows
+  *-*-mingw | *-*-os2* | *-cegcc*)
+    $ECHO "\
+      if test -n \"\$lt_option_debug\"; then
+        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
+        func_lt_dump_args \${1+\"\$@\"} 1>&2
+      fi
+      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+    ;;
+
+  *)
+    $ECHO "\
+      if test -n \"\$lt_option_debug\"; then
+        \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
+        func_lt_dump_args \${1+\"\$@\"} 1>&2
+      fi
+      exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+    ;;
+  esac
+  $ECHO "\
+      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
+      exit 1
+}
+
+# A function to encapsulate launching the target application
+# Strips options in the --lt-* namespace from \$@ and
+# launches target application with the remaining arguments.
+func_exec_program ()
+{
+  for lt_wr_arg
+  do
+    case \$lt_wr_arg in
+    --lt-*) ;;
+    *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
+    esac
+    shift
+  done
+  func_exec_program_core \${1+\"\$@\"}
+}
+
+  # Parse options
+  func_parse_lt_options \"\$0\" \${1+\"\$@\"}
+
+  # Find the directory that this script lives in.
+  thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
+  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+  # Follow symbolic links until we get to the real thisdir.
+  file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
+  while test -n \"\$file\"; do
+    destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
+
+    # If there was a directory component, then change thisdir.
+    if test \"x\$destdir\" != \"x\$file\"; then
+      case \"\$destdir\" in
+      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+      *) thisdir=\"\$thisdir/\$destdir\" ;;
+      esac
+    fi
+
+    file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
+    file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
+  done
+
+  # Usually 'no', except on cygwin/mingw when embedded into
+  # the cwrapper.
+  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
+  if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
+    # special case for '.'
+    if test \"\$thisdir\" = \".\"; then
+      thisdir=\`pwd\`
+    fi
+    # remove .libs from thisdir
+    case \"\$thisdir\" in
+    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
+    $objdir )   thisdir=. ;;
+    esac
+  fi
+
+  # Try to get the absolute directory name.
+  absdir=\`cd \"\$thisdir\" && pwd\`
+  test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+	if test "$fast_install" = yes; then
+	  $ECHO "\
+  program=lt-'$outputname'$exeext
+  progdir=\"\$thisdir/$objdir\"
+
+  if test ! -f \"\$progdir/\$program\" ||
+     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+    file=\"\$\$-\$program\"
+
+    if test ! -d \"\$progdir\"; then
+      $MKDIR \"\$progdir\"
+    else
+      $RM \"\$progdir/\$file\"
+    fi"
+
+	  $ECHO "\
+
+    # relink executable if necessary
+    if test -n \"\$relink_command\"; then
+      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+      else
+	$ECHO \"\$relink_command_output\" >&2
+	$RM \"\$progdir/\$file\"
+	exit 1
+      fi
+    fi
+
+    $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+    { $RM \"\$progdir/\$program\";
+      $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+    $RM \"\$progdir/\$file\"
+  fi"
+	else
+	  $ECHO "\
+  program='$outputname'
+  progdir=\"\$thisdir/$objdir\"
+"
+	fi
+
+	$ECHO "\
+
+  if test -f \"\$progdir/\$program\"; then"
+
+	# fixup the dll searchpath if we need to.
+	#
+	# Fix the DLL searchpath if we need to.  Do this before prepending
+	# to shlibpath, because on Windows, both are PATH and uninstalled
+	# libraries must come first.
+	if test -n "$dllsearchpath"; then
+	  $ECHO "\
+    # Add the dll search path components to the executable PATH
+    PATH=$dllsearchpath:\$PATH
+"
+	fi
+
+	# Export our shlibpath_var if we have one.
+	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+	  $ECHO "\
+    # Add our own library path to $shlibpath_var
+    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+    # Some systems cannot cope with colon-terminated $shlibpath_var
+    # The second colon is a workaround for a bug in BeOS R4 sed
+    $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
+
+    export $shlibpath_var
+"
+	fi
+
+	$ECHO "\
+    if test \"\$libtool_execute_magic\" != \"$magic\"; then
+      # Run the actual program with our arguments.
+      func_exec_program \${1+\"\$@\"}
+    fi
+  else
+    # The program doesn't exist.
+    \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+    \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
+    \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
+    exit 1
+  fi
+fi\
+"
+}
+
+
+# func_emit_cwrapperexe_src
+# emit the source code for a wrapper executable on stdout
+# Must ONLY be called from within func_mode_link because
+# it depends on a number of variable set therein.
+func_emit_cwrapperexe_src ()
+{
+	cat <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+   Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+
+   The $output program cannot be directly executed until all the libtool
+   libraries that it depends on are installed.
+
+   This wrapper executable should never be moved out of the build directory.
+   If it is, it will not operate correctly.
+*/
+EOF
+	    cat <<"EOF"
+#ifdef _MSC_VER
+# define _CRT_SECURE_NO_DEPRECATE 1
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef _MSC_VER
+# include <direct.h>
+# include <process.h>
+# include <io.h>
+#else
+# include <unistd.h>
+# include <stdint.h>
+# ifdef __CYGWIN__
+#  include <io.h>
+# endif
+#endif
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+/* declarations of non-ANSI functions */
+#if defined(__MINGW32__)
+# ifdef __STRICT_ANSI__
+int _putenv (const char *);
+# endif
+#elif defined(__CYGWIN__)
+# ifdef __STRICT_ANSI__
+char *realpath (const char *, char *);
+int putenv (char *);
+int setenv (const char *, const char *, int);
+# endif
+/* #elif defined (other platforms) ... */
+#endif
+
+/* portability defines, excluding path handling macros */
+#if defined(_MSC_VER)
+# define setmode _setmode
+# define stat    _stat
+# define chmod   _chmod
+# define getcwd  _getcwd
+# define putenv  _putenv
+# define S_IXUSR _S_IEXEC
+# ifndef _INTPTR_T_DEFINED
+#  define _INTPTR_T_DEFINED
+#  define intptr_t int
+# endif
+#elif defined(__MINGW32__)
+# define setmode _setmode
+# define stat    _stat
+# define chmod   _chmod
+# define getcwd  _getcwd
+# define putenv  _putenv
+#elif defined(__CYGWIN__)
+# define HAVE_SETENV
+# define FOPEN_WB "wb"
+/* #elif defined (other platforms) ... */
+#endif
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef S_IXOTH
+# define S_IXOTH 0
+#endif
+#ifndef S_IXGRP
+# define S_IXGRP 0
+#endif
+
+/* path handling portability macros */
+#ifndef DIR_SEPARATOR
+# define DIR_SEPARATOR '/'
+# define PATH_SEPARATOR ':'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+  defined (__OS2__)
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# define FOPEN_WB "wb"
+# ifndef DIR_SEPARATOR_2
+#  define DIR_SEPARATOR_2 '\\'
+# endif
+# ifndef PATH_SEPARATOR_2
+#  define PATH_SEPARATOR_2 ';'
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+	(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#ifndef PATH_SEPARATOR_2
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
+#else /* PATH_SEPARATOR_2 */
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
+#endif /* PATH_SEPARATOR_2 */
+
+#ifndef FOPEN_WB
+# define FOPEN_WB "w"
+#endif
+#ifndef _O_BINARY
+# define _O_BINARY 0
+#endif
+
+#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+  if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+#if defined(LT_DEBUGWRAPPER)
+static int lt_debug = 1;
+#else
+static int lt_debug = 0;
+#endif
+
+const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
+
+void *xmalloc (size_t num);
+char *xstrdup (const char *string);
+const char *base_name (const char *name);
+char *find_executable (const char *wrapper);
+char *chase_symlinks (const char *pathspec);
+int make_executable (const char *path);
+int check_executable (const char *path);
+char *strendzap (char *str, const char *pat);
+void lt_debugprintf (const char *file, int line, const char *fmt, ...);
+void lt_fatal (const char *file, int line, const char *message, ...);
+static const char *nonnull (const char *s);
+static const char *nonempty (const char *s);
+void lt_setenv (const char *name, const char *value);
+char *lt_extend_str (const char *orig_value, const char *add, int to_end);
+void lt_update_exe_path (const char *name, const char *value);
+void lt_update_lib_path (const char *name, const char *value);
+char **prepare_spawn (char **argv);
+void lt_dump_script (FILE *f);
+EOF
+
+	    cat <<EOF
+volatile const char * MAGIC_EXE = "$magic_exe";
+const char * LIB_PATH_VARNAME = "$shlibpath_var";
+EOF
+
+	    if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+              func_to_host_path "$temp_rpath"
+	      cat <<EOF
+const char * LIB_PATH_VALUE   = "$func_to_host_path_result";
+EOF
+	    else
+	      cat <<"EOF"
+const char * LIB_PATH_VALUE   = "";
+EOF
+	    fi
+
+	    if test -n "$dllsearchpath"; then
+              func_to_host_path "$dllsearchpath:"
+	      cat <<EOF
+const char * EXE_PATH_VARNAME = "PATH";
+const char * EXE_PATH_VALUE   = "$func_to_host_path_result";
+EOF
+	    else
+	      cat <<"EOF"
+const char * EXE_PATH_VARNAME = "";
+const char * EXE_PATH_VALUE   = "";
+EOF
+	    fi
+
+	    if test "$fast_install" = yes; then
+	      cat <<EOF
+const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
+EOF
+	    else
+	      cat <<EOF
+const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
+EOF
+	    fi
+
+
+	    cat <<"EOF"
+
+#define LTWRAPPER_OPTION_PREFIX         "--lt-"
+
+static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
+static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
+static const char *debug_opt            = LTWRAPPER_OPTION_PREFIX "debug";
+
+int
+main (int argc, char *argv[])
+{
+  char **newargz;
+  int  newargc;
+  char *tmp_pathspec;
+  char *actual_cwrapper_path;
+  char *actual_cwrapper_name;
+  char *target_name;
+  char *lt_argv_zero;
+  intptr_t rval = 127;
+
+  int i;
+
+  program_name = (char *) xstrdup (base_name (argv[0]));
+  newargz = XMALLOC (char *, argc + 1);
+
+  /* very simple arg parsing; don't want to rely on getopt
+   * also, copy all non cwrapper options to newargz, except
+   * argz[0], which is handled differently
+   */
+  newargc=0;
+  for (i = 1; i < argc; i++)
+    {
+      if (strcmp (argv[i], dumpscript_opt) == 0)
+	{
+EOF
+	    case "$host" in
+	      *mingw* | *cygwin* )
+		# make stdout use "unix" line endings
+		echo "          setmode(1,_O_BINARY);"
+		;;
+	      esac
+
+	    cat <<"EOF"
+	  lt_dump_script (stdout);
+	  return 0;
+	}
+      if (strcmp (argv[i], debug_opt) == 0)
+	{
+          lt_debug = 1;
+          continue;
+	}
+      if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
+        {
+          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
+             namespace, but it is not one of the ones we know about and
+             have already dealt with, above (inluding dump-script), then
+             report an error. Otherwise, targets might begin to believe
+             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
+             namespace. The first time any user complains about this, we'll
+             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
+             or a configure.ac-settable value.
+           */
+          lt_fatal (__FILE__, __LINE__,
+		    "unrecognized %s option: '%s'",
+                    ltwrapper_option_prefix, argv[i]);
+        }
+      /* otherwise ... */
+      newargz[++newargc] = xstrdup (argv[i]);
+    }
+  newargz[++newargc] = NULL;
+
+EOF
+	    cat <<EOF
+  /* The GNU banner must be the first non-error debug message */
+  lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
+EOF
+	    cat <<"EOF"
+  lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
+  lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
+
+  tmp_pathspec = find_executable (argv[0]);
+  if (tmp_pathspec == NULL)
+    lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
+  lt_debugprintf (__FILE__, __LINE__,
+                  "(main) found exe (before symlink chase) at: %s\n",
+		  tmp_pathspec);
+
+  actual_cwrapper_path = chase_symlinks (tmp_pathspec);
+  lt_debugprintf (__FILE__, __LINE__,
+                  "(main) found exe (after symlink chase) at: %s\n",
+		  actual_cwrapper_path);
+  XFREE (tmp_pathspec);
+
+  actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
+  strendzap (actual_cwrapper_path, actual_cwrapper_name);
+
+  /* wrapper name transforms */
+  strendzap (actual_cwrapper_name, ".exe");
+  tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
+  XFREE (actual_cwrapper_name);
+  actual_cwrapper_name = tmp_pathspec;
+  tmp_pathspec = 0;
+
+  /* target_name transforms -- use actual target program name; might have lt- prefix */
+  target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
+  strendzap (target_name, ".exe");
+  tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
+  XFREE (target_name);
+  target_name = tmp_pathspec;
+  tmp_pathspec = 0;
+
+  lt_debugprintf (__FILE__, __LINE__,
+		  "(main) libtool target name: %s\n",
+		  target_name);
+EOF
+
+	    cat <<EOF
+  newargz[0] =
+    XMALLOC (char, (strlen (actual_cwrapper_path) +
+		    strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
+  strcpy (newargz[0], actual_cwrapper_path);
+  strcat (newargz[0], "$objdir");
+  strcat (newargz[0], "/");
+EOF
+
+	    cat <<"EOF"
+  /* stop here, and copy so we don't have to do this twice */
+  tmp_pathspec = xstrdup (newargz[0]);
+
+  /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
+  strcat (newargz[0], actual_cwrapper_name);
+
+  /* DO want the lt- prefix here if it exists, so use target_name */
+  lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
+  XFREE (tmp_pathspec);
+  tmp_pathspec = NULL;
+EOF
+
+	    case $host_os in
+	      mingw*)
+	    cat <<"EOF"
+  {
+    char* p;
+    while ((p = strchr (newargz[0], '\\')) != NULL)
+      {
+	*p = '/';
+      }
+    while ((p = strchr (lt_argv_zero, '\\')) != NULL)
+      {
+	*p = '/';
+      }
+  }
+EOF
+	    ;;
+	    esac
+
+	    cat <<"EOF"
+  XFREE (target_name);
+  XFREE (actual_cwrapper_path);
+  XFREE (actual_cwrapper_name);
+
+  lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
+  lt_setenv ("DUALCASE", "1");  /* for MSK sh */
+  /* Update the DLL searchpath.  EXE_PATH_VALUE ($dllsearchpath) must
+     be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
+     because on Windows, both *_VARNAMEs are PATH but uninstalled
+     libraries must come first. */
+  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
+  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
+
+  lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
+		  nonnull (lt_argv_zero));
+  for (i = 0; i < newargc; i++)
+    {
+      lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
+		      i, nonnull (newargz[i]));
+    }
+
+EOF
+
+	    case $host_os in
+	      mingw*)
+		cat <<"EOF"
+  /* execv doesn't actually work on mingw as expected on unix */
+  newargz = prepare_spawn (newargz);
+  rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
+  if (rval == -1)
+    {
+      /* failed to start process */
+      lt_debugprintf (__FILE__, __LINE__,
+		      "(main) failed to launch target \"%s\": %s\n",
+		      lt_argv_zero, nonnull (strerror (errno)));
+      return 127;
+    }
+  return rval;
+EOF
+		;;
+	      *)
+		cat <<"EOF"
+  execv (lt_argv_zero, newargz);
+  return rval; /* =127, but avoids unused variable warning */
+EOF
+		;;
+	    esac
+
+	    cat <<"EOF"
+}
+
+void *
+xmalloc (size_t num)
+{
+  void *p = (void *) malloc (num);
+  if (!p)
+    lt_fatal (__FILE__, __LINE__, "memory exhausted");
+
+  return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+  return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
+			  string) : NULL;
+}
+
+const char *
+base_name (const char *name)
+{
+  const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  /* Skip over the disk name in MSDOS pathnames. */
+  if (isalpha ((unsigned char) name[0]) && name[1] == ':')
+    name += 2;
+#endif
+
+  for (base = name; *name; name++)
+    if (IS_DIR_SEPARATOR (*name))
+      base = name + 1;
+  return base;
+}
+
+int
+check_executable (const char *path)
+{
+  struct stat st;
+
+  lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
+                  nonempty (path));
+  if ((!path) || (!*path))
+    return 0;
+
+  if ((stat (path, &st) >= 0)
+      && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
+    return 1;
+  else
+    return 0;
+}
+
+int
+make_executable (const char *path)
+{
+  int rval = 0;
+  struct stat st;
+
+  lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
+                  nonempty (path));
+  if ((!path) || (!*path))
+    return 0;
+
+  if (stat (path, &st) >= 0)
+    {
+      rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
+    }
+  return rval;
+}
+
+/* Searches for the full path of the wrapper.  Returns
+   newly allocated full path name if found, NULL otherwise
+   Does not chase symlinks, even on platforms that support them.
+*/
+char *
+find_executable (const char *wrapper)
+{
+  int has_slash = 0;
+  const char *p;
+  const char *p_next;
+  /* static buffer for getcwd */
+  char tmp[LT_PATHMAX + 1];
+  int tmp_len;
+  char *concat_name;
+
+  lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
+                  nonempty (wrapper));
+
+  if ((wrapper == NULL) || (*wrapper == '\0'))
+    return NULL;
+
+  /* Absolute path? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+  if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
+    {
+      concat_name = xstrdup (wrapper);
+      if (check_executable (concat_name))
+	return concat_name;
+      XFREE (concat_name);
+    }
+  else
+    {
+#endif
+      if (IS_DIR_SEPARATOR (wrapper[0]))
+	{
+	  concat_name = xstrdup (wrapper);
+	  if (check_executable (concat_name))
+	    return concat_name;
+	  XFREE (concat_name);
+	}
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+    }
+#endif
+
+  for (p = wrapper; *p; p++)
+    if (*p == '/')
+      {
+	has_slash = 1;
+	break;
+      }
+  if (!has_slash)
+    {
+      /* no slashes; search PATH */
+      const char *path = getenv ("PATH");
+      if (path != NULL)
+	{
+	  for (p = path; *p; p = p_next)
+	    {
+	      const char *q;
+	      size_t p_len;
+	      for (q = p; *q; q++)
+		if (IS_PATH_SEPARATOR (*q))
+		  break;
+	      p_len = q - p;
+	      p_next = (*q == '\0' ? q : q + 1);
+	      if (p_len == 0)
+		{
+		  /* empty path: current directory */
+		  if (getcwd (tmp, LT_PATHMAX) == NULL)
+		    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+                              nonnull (strerror (errno)));
+		  tmp_len = strlen (tmp);
+		  concat_name =
+		    XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+		  memcpy (concat_name, tmp, tmp_len);
+		  concat_name[tmp_len] = '/';
+		  strcpy (concat_name + tmp_len + 1, wrapper);
+		}
+	      else
+		{
+		  concat_name =
+		    XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
+		  memcpy (concat_name, p, p_len);
+		  concat_name[p_len] = '/';
+		  strcpy (concat_name + p_len + 1, wrapper);
+		}
+	      if (check_executable (concat_name))
+		return concat_name;
+	      XFREE (concat_name);
+	    }
+	}
+      /* not found in PATH; assume curdir */
+    }
+  /* Relative path | not found in path: prepend cwd */
+  if (getcwd (tmp, LT_PATHMAX) == NULL)
+    lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
+              nonnull (strerror (errno)));
+  tmp_len = strlen (tmp);
+  concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
+  memcpy (concat_name, tmp, tmp_len);
+  concat_name[tmp_len] = '/';
+  strcpy (concat_name + tmp_len + 1, wrapper);
+
+  if (check_executable (concat_name))
+    return concat_name;
+  XFREE (concat_name);
+  return NULL;
+}
+
+char *
+chase_symlinks (const char *pathspec)
+{
+#ifndef S_ISLNK
+  return xstrdup (pathspec);
+#else
+  char buf[LT_PATHMAX];
+  struct stat s;
+  char *tmp_pathspec = xstrdup (pathspec);
+  char *p;
+  int has_symlinks = 0;
+  while (strlen (tmp_pathspec) && !has_symlinks)
+    {
+      lt_debugprintf (__FILE__, __LINE__,
+		      "checking path component for symlinks: %s\n",
+		      tmp_pathspec);
+      if (lstat (tmp_pathspec, &s) == 0)
+	{
+	  if (S_ISLNK (s.st_mode) != 0)
+	    {
+	      has_symlinks = 1;
+	      break;
+	    }
+
+	  /* search backwards for last DIR_SEPARATOR */
+	  p = tmp_pathspec + strlen (tmp_pathspec) - 1;
+	  while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+	    p--;
+	  if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+	    {
+	      /* no more DIR_SEPARATORS left */
+	      break;
+	    }
+	  *p = '\0';
+	}
+      else
+	{
+	  lt_fatal (__FILE__, __LINE__,
+		    "error accessing file \"%s\": %s",
+		    tmp_pathspec, nonnull (strerror (errno)));
+	}
+    }
+  XFREE (tmp_pathspec);
+
+  if (!has_symlinks)
+    {
+      return xstrdup (pathspec);
+    }
+
+  tmp_pathspec = realpath (pathspec, buf);
+  if (tmp_pathspec == 0)
+    {
+      lt_fatal (__FILE__, __LINE__,
+		"could not follow symlinks for %s", pathspec);
+    }
+  return xstrdup (tmp_pathspec);
+#endif
+}
+
+char *
+strendzap (char *str, const char *pat)
+{
+  size_t len, patlen;
+
+  assert (str != NULL);
+  assert (pat != NULL);
+
+  len = strlen (str);
+  patlen = strlen (pat);
+
+  if (patlen <= len)
+    {
+      str += len - patlen;
+      if (strcmp (str, pat) == 0)
+	*str = '\0';
+    }
+  return str;
+}
+
+void
+lt_debugprintf (const char *file, int line, const char *fmt, ...)
+{
+  va_list args;
+  if (lt_debug)
+    {
+      (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
+      va_start (args, fmt);
+      (void) vfprintf (stderr, fmt, args);
+      va_end (args);
+    }
+}
+
+static void
+lt_error_core (int exit_status, const char *file,
+	       int line, const char *mode,
+	       const char *message, va_list ap)
+{
+  fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
+  vfprintf (stderr, message, ap);
+  fprintf (stderr, ".\n");
+
+  if (exit_status >= 0)
+    exit (exit_status);
+}
+
+void
+lt_fatal (const char *file, int line, const char *message, ...)
+{
+  va_list ap;
+  va_start (ap, message);
+  lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
+  va_end (ap);
+}
+
+static const char *
+nonnull (const char *s)
+{
+  return s ? s : "(null)";
+}
+
+static const char *
+nonempty (const char *s)
+{
+  return (s && !*s) ? "(empty)" : nonnull (s);
+}
+
+void
+lt_setenv (const char *name, const char *value)
+{
+  lt_debugprintf (__FILE__, __LINE__,
+		  "(lt_setenv) setting '%s' to '%s'\n",
+                  nonnull (name), nonnull (value));
+  {
+#ifdef HAVE_SETENV
+    /* always make a copy, for consistency with !HAVE_SETENV */
+    char *str = xstrdup (value);
+    setenv (name, str, 1);
+#else
+    int len = strlen (name) + 1 + strlen (value) + 1;
+    char *str = XMALLOC (char, len);
+    sprintf (str, "%s=%s", name, value);
+    if (putenv (str) != EXIT_SUCCESS)
+      {
+        XFREE (str);
+      }
+#endif
+  }
+}
+
+char *
+lt_extend_str (const char *orig_value, const char *add, int to_end)
+{
+  char *new_value;
+  if (orig_value && *orig_value)
+    {
+      int orig_value_len = strlen (orig_value);
+      int add_len = strlen (add);
+      new_value = XMALLOC (char, add_len + orig_value_len + 1);
+      if (to_end)
+        {
+          strcpy (new_value, orig_value);
+          strcpy (new_value + orig_value_len, add);
+        }
+      else
+        {
+          strcpy (new_value, add);
+          strcpy (new_value + add_len, orig_value);
+        }
+    }
+  else
+    {
+      new_value = xstrdup (add);
+    }
+  return new_value;
+}
+
+void
+lt_update_exe_path (const char *name, const char *value)
+{
+  lt_debugprintf (__FILE__, __LINE__,
+		  "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
+                  nonnull (name), nonnull (value));
+
+  if (name && *name && value && *value)
+    {
+      char *new_value = lt_extend_str (getenv (name), value, 0);
+      /* some systems can't cope with a ':'-terminated path #' */
+      int len = strlen (new_value);
+      while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
+        {
+          new_value[len-1] = '\0';
+        }
+      lt_setenv (name, new_value);
+      XFREE (new_value);
+    }
+}
+
+void
+lt_update_lib_path (const char *name, const char *value)
+{
+  lt_debugprintf (__FILE__, __LINE__,
+		  "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
+                  nonnull (name), nonnull (value));
+
+  if (name && *name && value && *value)
+    {
+      char *new_value = lt_extend_str (getenv (name), value, 0);
+      lt_setenv (name, new_value);
+      XFREE (new_value);
+    }
+}
+
+EOF
+	    case $host_os in
+	      mingw*)
+		cat <<"EOF"
+
+/* Prepares an argument vector before calling spawn().
+   Note that spawn() does not by itself call the command interpreter
+     (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
+      ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+         GetVersionEx(&v);
+         v.dwPlatformId == VER_PLATFORM_WIN32_NT;
+      }) ? "cmd.exe" : "command.com").
+   Instead it simply concatenates the arguments, separated by ' ', and calls
+   CreateProcess().  We must quote the arguments since Win32 CreateProcess()
+   interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
+   special way:
+   - Space and tab are interpreted as delimiters. They are not treated as
+     delimiters if they are surrounded by double quotes: "...".
+   - Unescaped double quotes are removed from the input. Their only effect is
+     that within double quotes, space and tab are treated like normal
+     characters.
+   - Backslashes not followed by double quotes are not special.
+   - But 2*n+1 backslashes followed by a double quote become
+     n backslashes followed by a double quote (n >= 0):
+       \" -> "
+       \\\" -> \"
+       \\\\\" -> \\"
+ */
+#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
+char **
+prepare_spawn (char **argv)
+{
+  size_t argc;
+  char **new_argv;
+  size_t i;
+
+  /* Count number of arguments.  */
+  for (argc = 0; argv[argc] != NULL; argc++)
+    ;
+
+  /* Allocate new argument vector.  */
+  new_argv = XMALLOC (char *, argc + 1);
+
+  /* Put quoted arguments into the new argument vector.  */
+  for (i = 0; i < argc; i++)
+    {
+      const char *string = argv[i];
+
+      if (string[0] == '\0')
+	new_argv[i] = xstrdup ("\"\"");
+      else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
+	{
+	  int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
+	  size_t length;
+	  unsigned int backslashes;
+	  const char *s;
+	  char *quoted_string;
+	  char *p;
+
+	  length = 0;
+	  backslashes = 0;
+	  if (quote_around)
+	    length++;
+	  for (s = string; *s != '\0'; s++)
+	    {
+	      char c = *s;
+	      if (c == '"')
+		length += backslashes + 1;
+	      length++;
+	      if (c == '\\')
+		backslashes++;
+	      else
+		backslashes = 0;
+	    }
+	  if (quote_around)
+	    length += backslashes + 1;
+
+	  quoted_string = XMALLOC (char, length + 1);
+
+	  p = quoted_string;
+	  backslashes = 0;
+	  if (quote_around)
+	    *p++ = '"';
+	  for (s = string; *s != '\0'; s++)
+	    {
+	      char c = *s;
+	      if (c == '"')
+		{
+		  unsigned int j;
+		  for (j = backslashes + 1; j > 0; j--)
+		    *p++ = '\\';
+		}
+	      *p++ = c;
+	      if (c == '\\')
+		backslashes++;
+	      else
+		backslashes = 0;
+	    }
+	  if (quote_around)
+	    {
+	      unsigned int j;
+	      for (j = backslashes; j > 0; j--)
+		*p++ = '\\';
+	      *p++ = '"';
+	    }
+	  *p = '\0';
+
+	  new_argv[i] = quoted_string;
+	}
+      else
+	new_argv[i] = (char *) string;
+    }
+  new_argv[argc] = NULL;
+
+  return new_argv;
+}
+EOF
+		;;
+	    esac
+
+            cat <<"EOF"
+void lt_dump_script (FILE* f)
+{
+EOF
+	    func_emit_wrapper yes |
+              $SED -e 's/\([\\"]\)/\\\1/g' \
+	           -e 's/^/  fputs ("/' -e 's/$/\\n", f);/'
+
+            cat <<"EOF"
+}
+EOF
+}
+# end: func_emit_cwrapperexe_src
+
+# func_win32_import_lib_p ARG
+# True if ARG is an import lib, as indicated by $file_magic_cmd
+func_win32_import_lib_p ()
+{
+    $opt_debug
+    case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
+    *import*) : ;;
+    *) false ;;
+    esac
+}
+
+# func_mode_link arg...
+func_mode_link ()
+{
+    $opt_debug
+    case $host in
+    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+      # It is impossible to link a dll without this setting, and
+      # we shouldn't force the makefile maintainer to figure out
+      # which system we are compiling for in order to pass an extra
+      # flag for every libtool invocation.
+      # allow_undefined=no
+
+      # FIXME: Unfortunately, there are problems with the above when trying
+      # to make a dll which has undefined symbols, in which case not
+      # even a static library is built.  For now, we need to specify
+      # -no-undefined on the libtool link line when we can be certain
+      # that all symbols are satisfied, otherwise we get a static library.
+      allow_undefined=yes
+      ;;
+    *)
+      allow_undefined=yes
+      ;;
+    esac
+    libtool_args=$nonopt
+    base_compile="$nonopt $@"
+    compile_command=$nonopt
+    finalize_command=$nonopt
+
+    compile_rpath=
+    finalize_rpath=
+    compile_shlibpath=
+    finalize_shlibpath=
+    convenience=
+    old_convenience=
+    deplibs=
+    old_deplibs=
+    compiler_flags=
+    linker_flags=
+    dllsearchpath=
+    lib_search_path=`pwd`
+    inst_prefix_dir=
+    new_inherited_linker_flags=
+
+    avoid_version=no
+    bindir=
+    dlfiles=
+    dlprefiles=
+    dlself=no
+    export_dynamic=no
+    export_symbols=
+    export_symbols_regex=
+    generated=
+    libobjs=
+    ltlibs=
+    module=no
+    no_install=no
+    objs=
+    non_pic_objects=
+    precious_files_regex=
+    prefer_static_libs=no
+    preload=no
+    prev=
+    prevarg=
+    release=
+    rpath=
+    xrpath=
+    perm_rpath=
+    temp_rpath=
+    thread_safe=no
+    vinfo=
+    vinfo_number=no
+    weak_libs=
+    single_module="${wl}-single_module"
+    func_infer_tag $base_compile
+
+    # We need to know -static, to get the right output filenames.
+    for arg
+    do
+      case $arg in
+      -shared)
+	test "$build_libtool_libs" != yes && \
+	  func_fatal_configuration "can not build a shared library"
+	build_old_libs=no
+	break
+	;;
+      -all-static | -static | -static-libtool-libs)
+	case $arg in
+	-all-static)
+	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
+	    func_warning "complete static linking is impossible in this configuration"
+	  fi
+	  if test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=yes
+	  ;;
+	-static)
+	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=built
+	  ;;
+	-static-libtool-libs)
+	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
+	    dlopen_self=$dlopen_self_static
+	  fi
+	  prefer_static_libs=yes
+	  ;;
+	esac
+	build_libtool_libs=no
+	build_old_libs=yes
+	break
+	;;
+      esac
+    done
+
+    # See if our shared archives depend on static archives.
+    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
+
+    # Go through the arguments, transforming them on the way.
+    while test "$#" -gt 0; do
+      arg="$1"
+      shift
+      func_quote_for_eval "$arg"
+      qarg=$func_quote_for_eval_unquoted_result
+      func_append libtool_args " $func_quote_for_eval_result"
+
+      # If the previous option needs an argument, assign it.
+      if test -n "$prev"; then
+	case $prev in
+	output)
+	  func_append compile_command " @OUTPUT@"
+	  func_append finalize_command " @OUTPUT@"
+	  ;;
+	esac
+
+	case $prev in
+	bindir)
+	  bindir="$arg"
+	  prev=
+	  continue
+	  ;;
+	dlfiles|dlprefiles)
+	  if test "$preload" = no; then
+	    # Add the symbol object into the linking commands.
+	    func_append compile_command " @SYMFILE@"
+	    func_append finalize_command " @SYMFILE@"
+	    preload=yes
+	  fi
+	  case $arg in
+	  *.la | *.lo) ;;  # We handle these cases below.
+	  force)
+	    if test "$dlself" = no; then
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  self)
+	    if test "$prev" = dlprefiles; then
+	      dlself=yes
+	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
+	      dlself=yes
+	    else
+	      dlself=needless
+	      export_dynamic=yes
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  *)
+	    if test "$prev" = dlfiles; then
+	      func_append dlfiles " $arg"
+	    else
+	      func_append dlprefiles " $arg"
+	    fi
+	    prev=
+	    continue
+	    ;;
+	  esac
+	  ;;
+	expsyms)
+	  export_symbols="$arg"
+	  test -f "$arg" \
+	    || func_fatal_error "symbol file \`$arg' does not exist"
+	  prev=
+	  continue
+	  ;;
+	expsyms_regex)
+	  export_symbols_regex="$arg"
+	  prev=
+	  continue
+	  ;;
+	framework)
+	  case $host in
+	    *-*-darwin*)
+	      case "$deplibs " in
+		*" $qarg.ltframework "*) ;;
+		*) func_append deplibs " $qarg.ltframework" # this is fixed later
+		   ;;
+	      esac
+	      ;;
+	  esac
+	  prev=
+	  continue
+	  ;;
+	inst_prefix)
+	  inst_prefix_dir="$arg"
+	  prev=
+	  continue
+	  ;;
+	objectlist)
+	  if test -f "$arg"; then
+	    save_arg=$arg
+	    moreargs=
+	    for fil in `cat "$save_arg"`
+	    do
+#	      func_append moreargs " $fil"
+	      arg=$fil
+	      # A libtool-controlled object.
+
+	      # Check to see that this really is a libtool object.
+	      if func_lalib_unsafe_p "$arg"; then
+		pic_object=
+		non_pic_object=
+
+		# Read the .lo file
+		func_source "$arg"
+
+		if test -z "$pic_object" ||
+		   test -z "$non_pic_object" ||
+		   test "$pic_object" = none &&
+		   test "$non_pic_object" = none; then
+		  func_fatal_error "cannot find name of object for \`$arg'"
+		fi
+
+		# Extract subdirectory from the argument.
+		func_dirname "$arg" "/" ""
+		xdir="$func_dirname_result"
+
+		if test "$pic_object" != none; then
+		  # Prepend the subdirectory the object is found in.
+		  pic_object="$xdir$pic_object"
+
+		  if test "$prev" = dlfiles; then
+		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+		      func_append dlfiles " $pic_object"
+		      prev=
+		      continue
+		    else
+		      # If libtool objects are unsupported, then we need to preload.
+		      prev=dlprefiles
+		    fi
+		  fi
+
+		  # CHECK ME:  I think I busted this.  -Ossama
+		  if test "$prev" = dlprefiles; then
+		    # Preload the old-style object.
+		    func_append dlprefiles " $pic_object"
+		    prev=
+		  fi
+
+		  # A PIC object.
+		  func_append libobjs " $pic_object"
+		  arg="$pic_object"
+		fi
+
+		# Non-PIC object.
+		if test "$non_pic_object" != none; then
+		  # Prepend the subdirectory the object is found in.
+		  non_pic_object="$xdir$non_pic_object"
+
+		  # A standard non-PIC object
+		  func_append non_pic_objects " $non_pic_object"
+		  if test -z "$pic_object" || test "$pic_object" = none ; then
+		    arg="$non_pic_object"
+		  fi
+		else
+		  # If the PIC object exists, use it instead.
+		  # $xdir was prepended to $pic_object above.
+		  non_pic_object="$pic_object"
+		  func_append non_pic_objects " $non_pic_object"
+		fi
+	      else
+		# Only an error if not doing a dry-run.
+		if $opt_dry_run; then
+		  # Extract subdirectory from the argument.
+		  func_dirname "$arg" "/" ""
+		  xdir="$func_dirname_result"
+
+		  func_lo2o "$arg"
+		  pic_object=$xdir$objdir/$func_lo2o_result
+		  non_pic_object=$xdir$func_lo2o_result
+		  func_append libobjs " $pic_object"
+		  func_append non_pic_objects " $non_pic_object"
+	        else
+		  func_fatal_error "\`$arg' is not a valid libtool object"
+		fi
+	      fi
+	    done
+	  else
+	    func_fatal_error "link input file \`$arg' does not exist"
+	  fi
+	  arg=$save_arg
+	  prev=
+	  continue
+	  ;;
+	precious_regex)
+	  precious_files_regex="$arg"
+	  prev=
+	  continue
+	  ;;
+	release)
+	  release="-$arg"
+	  prev=
+	  continue
+	  ;;
+	rpath | xrpath)
+	  # We need an absolute path.
+	  case $arg in
+	  [\\/]* | [A-Za-z]:[\\/]*) ;;
+	  *)
+	    func_fatal_error "only absolute run-paths are allowed"
+	    ;;
+	  esac
+	  if test "$prev" = rpath; then
+	    case "$rpath " in
+	    *" $arg "*) ;;
+	    *) func_append rpath " $arg" ;;
+	    esac
+	  else
+	    case "$xrpath " in
+	    *" $arg "*) ;;
+	    *) func_append xrpath " $arg" ;;
+	    esac
+	  fi
+	  prev=
+	  continue
+	  ;;
+	shrext)
+	  shrext_cmds="$arg"
+	  prev=
+	  continue
+	  ;;
+	weak)
+	  func_append weak_libs " $arg"
+	  prev=
+	  continue
+	  ;;
+	xcclinker)
+	  func_append linker_flags " $qarg"
+	  func_append compiler_flags " $qarg"
+	  prev=
+	  func_append compile_command " $qarg"
+	  func_append finalize_command " $qarg"
+	  continue
+	  ;;
+	xcompiler)
+	  func_append compiler_flags " $qarg"
+	  prev=
+	  func_append compile_command " $qarg"
+	  func_append finalize_command " $qarg"
+	  continue
+	  ;;
+	xlinker)
+	  func_append linker_flags " $qarg"
+	  func_append compiler_flags " $wl$qarg"
+	  prev=
+	  func_append compile_command " $wl$qarg"
+	  func_append finalize_command " $wl$qarg"
+	  continue
+	  ;;
+	*)
+	  eval "$prev=\"\$arg\""
+	  prev=
+	  continue
+	  ;;
+	esac
+      fi # test -n "$prev"
+
+      prevarg="$arg"
+
+      case $arg in
+      -all-static)
+	if test -n "$link_static_flag"; then
+	  # See comment for -static flag below, for more details.
+	  func_append compile_command " $link_static_flag"
+	  func_append finalize_command " $link_static_flag"
+	fi
+	continue
+	;;
+
+      -allow-undefined)
+	# FIXME: remove this flag sometime in the future.
+	func_fatal_error "\`-allow-undefined' must not be used because it is the default"
+	;;
+
+      -avoid-version)
+	avoid_version=yes
+	continue
+	;;
+
+      -bindir)
+	prev=bindir
+	continue
+	;;
+
+      -dlopen)
+	prev=dlfiles
+	continue
+	;;
+
+      -dlpreopen)
+	prev=dlprefiles
+	continue
+	;;
+
+      -export-dynamic)
+	export_dynamic=yes
+	continue
+	;;
+
+      -export-symbols | -export-symbols-regex)
+	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+	  func_fatal_error "more than one -exported-symbols argument is not allowed"
+	fi
+	if test "X$arg" = "X-export-symbols"; then
+	  prev=expsyms
+	else
+	  prev=expsyms_regex
+	fi
+	continue
+	;;
+
+      -framework)
+	prev=framework
+	continue
+	;;
+
+      -inst-prefix-dir)
+	prev=inst_prefix
+	continue
+	;;
+
+      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
+      # so, if we see these flags be careful not to treat them like -L
+      -L[A-Z][A-Z]*:*)
+	case $with_gcc/$host in
+	no/*-*-irix* | /*-*-irix*)
+	  func_append compile_command " $arg"
+	  func_append finalize_command " $arg"
+	  ;;
+	esac
+	continue
+	;;
+
+      -L*)
+	func_stripname "-L" '' "$arg"
+	if test -z "$func_stripname_result"; then
+	  if test "$#" -gt 0; then
+	    func_fatal_error "require no space between \`-L' and \`$1'"
+	  else
+	    func_fatal_error "need path for \`-L' option"
+	  fi
+	fi
+	func_resolve_sysroot "$func_stripname_result"
+	dir=$func_resolve_sysroot_result
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	*)
+	  absdir=`cd "$dir" && pwd`
+	  test -z "$absdir" && \
+	    func_fatal_error "cannot determine absolute directory name of \`$dir'"
+	  dir="$absdir"
+	  ;;
+	esac
+	case "$deplibs " in
+	*" -L$dir "* | *" $arg "*)
+	  # Will only happen for absolute or sysroot arguments
+	  ;;
+	*)
+	  # Preserve sysroot, but never include relative directories
+	  case $dir in
+	    [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
+	    *) func_append deplibs " -L$dir" ;;
+	  esac
+	  func_append lib_search_path " $dir"
+	  ;;
+	esac
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+	  testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
+	  case :$dllsearchpath: in
+	  *":$dir:"*) ;;
+	  ::) dllsearchpath=$dir;;
+	  *) func_append dllsearchpath ":$dir";;
+	  esac
+	  case :$dllsearchpath: in
+	  *":$testbindir:"*) ;;
+	  ::) dllsearchpath=$testbindir;;
+	  *) func_append dllsearchpath ":$testbindir";;
+	  esac
+	  ;;
+	esac
+	continue
+	;;
+
+      -l*)
+	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
+	  case $host in
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
+	    # These systems don't actually have a C or math library (as such)
+	    continue
+	    ;;
+	  *-*-os2*)
+	    # These systems don't actually have a C library (as such)
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	    # Do not include libc due to us having libc/libc_r.
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-rhapsody* | *-*-darwin1.[012])
+	    # Rhapsody C and math libraries are in the System framework
+	    func_append deplibs " System.ltframework"
+	    continue
+	    ;;
+	  *-*-sco3.2v5* | *-*-sco5v6*)
+	    # Causes problems with __ctype
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+	    # Compiler inserts libc in the correct place for threads to work
+	    test "X$arg" = "X-lc" && continue
+	    ;;
+	  esac
+	elif test "X$arg" = "X-lc_r"; then
+	 case $host in
+	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	   # Do not include libc_r directly, use -pthread flag.
+	   continue
+	   ;;
+	 esac
+	fi
+	func_append deplibs " $arg"
+	continue
+	;;
+
+      -module)
+	module=yes
+	continue
+	;;
+
+      # Tru64 UNIX uses -model [arg] to determine the layout of C++
+      # classes, name mangling, and exception handling.
+      # Darwin uses the -arch flag to determine output architecture.
+      -model|-arch|-isysroot|--sysroot)
+	func_append compiler_flags " $arg"
+	func_append compile_command " $arg"
+	func_append finalize_command " $arg"
+	prev=xcompiler
+	continue
+	;;
+
+      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+	func_append compiler_flags " $arg"
+	func_append compile_command " $arg"
+	func_append finalize_command " $arg"
+	case "$new_inherited_linker_flags " in
+	    *" $arg "*) ;;
+	    * ) func_append new_inherited_linker_flags " $arg" ;;
+	esac
+	continue
+	;;
+
+      -multi_module)
+	single_module="${wl}-multi_module"
+	continue
+	;;
+
+      -no-fast-install)
+	fast_install=no
+	continue
+	;;
+
+      -no-install)
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
+	  # The PATH hackery in wrapper scripts is required on Windows
+	  # and Darwin in order for the loader to find any dlls it needs.
+	  func_warning "\`-no-install' is ignored for $host"
+	  func_warning "assuming \`-no-fast-install' instead"
+	  fast_install=no
+	  ;;
+	*) no_install=yes ;;
+	esac
+	continue
+	;;
+
+      -no-undefined)
+	allow_undefined=no
+	continue
+	;;
+
+      -objectlist)
+	prev=objectlist
+	continue
+	;;
+
+      -o) prev=output ;;
+
+      -precious-files-regex)
+	prev=precious_regex
+	continue
+	;;
+
+      -release)
+	prev=release
+	continue
+	;;
+
+      -rpath)
+	prev=rpath
+	continue
+	;;
+
+      -R)
+	prev=xrpath
+	continue
+	;;
+
+      -R*)
+	func_stripname '-R' '' "$arg"
+	dir=$func_stripname_result
+	# We need an absolute path.
+	case $dir in
+	[\\/]* | [A-Za-z]:[\\/]*) ;;
+	=*)
+	  func_stripname '=' '' "$dir"
+	  dir=$lt_sysroot$func_stripname_result
+	  ;;
+	*)
+	  func_fatal_error "only absolute run-paths are allowed"
+	  ;;
+	esac
+	case "$xrpath " in
+	*" $dir "*) ;;
+	*) func_append xrpath " $dir" ;;
+	esac
+	continue
+	;;
+
+      -shared)
+	# The effects of -shared are defined in a previous loop.
+	continue
+	;;
+
+      -shrext)
+	prev=shrext
+	continue
+	;;
+
+      -static | -static-libtool-libs)
+	# The effects of -static are defined in a previous loop.
+	# We used to do the same as -all-static on platforms that
+	# didn't have a PIC flag, but the assumption that the effects
+	# would be equivalent was wrong.  It would break on at least
+	# Digital Unix and AIX.
+	continue
+	;;
+
+      -thread-safe)
+	thread_safe=yes
+	continue
+	;;
+
+      -version-info)
+	prev=vinfo
+	continue
+	;;
+
+      -version-number)
+	prev=vinfo
+	vinfo_number=yes
+	continue
+	;;
+
+      -weak)
+        prev=weak
+	continue
+	;;
+
+      -Wc,*)
+	func_stripname '-Wc,' '' "$arg"
+	args=$func_stripname_result
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+          func_quote_for_eval "$flag"
+	  func_append arg " $func_quote_for_eval_result"
+	  func_append compiler_flags " $func_quote_for_eval_result"
+	done
+	IFS="$save_ifs"
+	func_stripname ' ' '' "$arg"
+	arg=$func_stripname_result
+	;;
+
+      -Wl,*)
+	func_stripname '-Wl,' '' "$arg"
+	args=$func_stripname_result
+	arg=
+	save_ifs="$IFS"; IFS=','
+	for flag in $args; do
+	  IFS="$save_ifs"
+          func_quote_for_eval "$flag"
+	  func_append arg " $wl$func_quote_for_eval_result"
+	  func_append compiler_flags " $wl$func_quote_for_eval_result"
+	  func_append linker_flags " $func_quote_for_eval_result"
+	done
+	IFS="$save_ifs"
+	func_stripname ' ' '' "$arg"
+	arg=$func_stripname_result
+	;;
+
+      -Xcompiler)
+	prev=xcompiler
+	continue
+	;;
+
+      -Xlinker)
+	prev=xlinker
+	continue
+	;;
+
+      -XCClinker)
+	prev=xcclinker
+	continue
+	;;
+
+      # -msg_* for osf cc
+      -msg_*)
+	func_quote_for_eval "$arg"
+	arg="$func_quote_for_eval_result"
+	;;
+
+      # Flags to be passed through unchanged, with rationale:
+      # -64, -mips[0-9]      enable 64-bit mode for the SGI compiler
+      # -r[0-9][0-9]*        specify processor for the SGI compiler
+      # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
+      # +DA*, +DD*           enable 64-bit mode for the HP compiler
+      # -q*                  compiler args for the IBM compiler
+      # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
+      # -F/path              path to uninstalled frameworks, gcc on darwin
+      # -p, -pg, --coverage, -fprofile-*  profiling flags for GCC
+      # @file                GCC response files
+      # -tp=*                Portland pgcc target processor selection
+      # --sysroot=*          for sysroot support
+      # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
+      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
+      -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
+        func_quote_for_eval "$arg"
+	arg="$func_quote_for_eval_result"
+        func_append compile_command " $arg"
+        func_append finalize_command " $arg"
+        func_append compiler_flags " $arg"
+        continue
+        ;;
+
+      # Some other compiler flag.
+      -* | +*)
+        func_quote_for_eval "$arg"
+	arg="$func_quote_for_eval_result"
+	;;
+
+      *.$objext)
+	# A standard object.
+	func_append objs " $arg"
+	;;
+
+      *.lo)
+	# A libtool-controlled object.
+
+	# Check to see that this really is a libtool object.
+	if func_lalib_unsafe_p "$arg"; then
+	  pic_object=
+	  non_pic_object=
+
+	  # Read the .lo file
+	  func_source "$arg"
+
+	  if test -z "$pic_object" ||
+	     test -z "$non_pic_object" ||
+	     test "$pic_object" = none &&
+	     test "$non_pic_object" = none; then
+	    func_fatal_error "cannot find name of object for \`$arg'"
+	  fi
+
+	  # Extract subdirectory from the argument.
+	  func_dirname "$arg" "/" ""
+	  xdir="$func_dirname_result"
+
+	  if test "$pic_object" != none; then
+	    # Prepend the subdirectory the object is found in.
+	    pic_object="$xdir$pic_object"
+
+	    if test "$prev" = dlfiles; then
+	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
+		func_append dlfiles " $pic_object"
+		prev=
+		continue
+	      else
+		# If libtool objects are unsupported, then we need to preload.
+		prev=dlprefiles
+	      fi
+	    fi
+
+	    # CHECK ME:  I think I busted this.  -Ossama
+	    if test "$prev" = dlprefiles; then
+	      # Preload the old-style object.
+	      func_append dlprefiles " $pic_object"
+	      prev=
+	    fi
+
+	    # A PIC object.
+	    func_append libobjs " $pic_object"
+	    arg="$pic_object"
+	  fi
+
+	  # Non-PIC object.
+	  if test "$non_pic_object" != none; then
+	    # Prepend the subdirectory the object is found in.
+	    non_pic_object="$xdir$non_pic_object"
+
+	    # A standard non-PIC object
+	    func_append non_pic_objects " $non_pic_object"
+	    if test -z "$pic_object" || test "$pic_object" = none ; then
+	      arg="$non_pic_object"
+	    fi
+	  else
+	    # If the PIC object exists, use it instead.
+	    # $xdir was prepended to $pic_object above.
+	    non_pic_object="$pic_object"
+	    func_append non_pic_objects " $non_pic_object"
+	  fi
+	else
+	  # Only an error if not doing a dry-run.
+	  if $opt_dry_run; then
+	    # Extract subdirectory from the argument.
+	    func_dirname "$arg" "/" ""
+	    xdir="$func_dirname_result"
+
+	    func_lo2o "$arg"
+	    pic_object=$xdir$objdir/$func_lo2o_result
+	    non_pic_object=$xdir$func_lo2o_result
+	    func_append libobjs " $pic_object"
+	    func_append non_pic_objects " $non_pic_object"
+	  else
+	    func_fatal_error "\`$arg' is not a valid libtool object"
+	  fi
+	fi
+	;;
+
+      *.$libext)
+	# An archive.
+	func_append deplibs " $arg"
+	func_append old_deplibs " $arg"
+	continue
+	;;
+
+      *.la)
+	# A libtool-controlled library.
+
+	func_resolve_sysroot "$arg"
+	if test "$prev" = dlfiles; then
+	  # This library was specified with -dlopen.
+	  func_append dlfiles " $func_resolve_sysroot_result"
+	  prev=
+	elif test "$prev" = dlprefiles; then
+	  # The library was specified with -dlpreopen.
+	  func_append dlprefiles " $func_resolve_sysroot_result"
+	  prev=
+	else
+	  func_append deplibs " $func_resolve_sysroot_result"
+	fi
+	continue
+	;;
+
+      # Some other compiler argument.
+      *)
+	# Unknown arguments in both finalize_command and compile_command need
+	# to be aesthetically quoted because they are evaled later.
+	func_quote_for_eval "$arg"
+	arg="$func_quote_for_eval_result"
+	;;
+      esac # arg
+
+      # Now actually substitute the argument into the commands.
+      if test -n "$arg"; then
+	func_append compile_command " $arg"
+	func_append finalize_command " $arg"
+      fi
+    done # argument parsing loop
+
+    test -n "$prev" && \
+      func_fatal_help "the \`$prevarg' option requires an argument"
+
+    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
+      eval arg=\"$export_dynamic_flag_spec\"
+      func_append compile_command " $arg"
+      func_append finalize_command " $arg"
+    fi
+
+    oldlibs=
+    # calculate the name of the file, without its directory
+    func_basename "$output"
+    outputname="$func_basename_result"
+    libobjs_save="$libobjs"
+
+    if test -n "$shlibpath_var"; then
+      # get the directories listed in $shlibpath_var
+      eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
+    else
+      shlib_search_path=
+    fi
+    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
+    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
+
+    func_dirname "$output" "/" ""
+    output_objdir="$func_dirname_result$objdir"
+    func_to_tool_file "$output_objdir/"
+    tool_output_objdir=$func_to_tool_file_result
+    # Create the object directory.
+    func_mkdir_p "$output_objdir"
+
+    # Determine the type of output
+    case $output in
+    "")
+      func_fatal_help "you must specify an output file"
+      ;;
+    *.$libext) linkmode=oldlib ;;
+    *.lo | *.$objext) linkmode=obj ;;
+    *.la) linkmode=lib ;;
+    *) linkmode=prog ;; # Anything else should be a program.
+    esac
+
+    specialdeplibs=
+
+    libs=
+    # Find all interdependent deplibs by searching for libraries
+    # that are linked more than once (e.g. -la -lb -la)
+    for deplib in $deplibs; do
+      if $opt_preserve_dup_deps ; then
+	case "$libs " in
+	*" $deplib "*) func_append specialdeplibs " $deplib" ;;
+	esac
+      fi
+      func_append libs " $deplib"
+    done
+
+    if test "$linkmode" = lib; then
+      libs="$predeps $libs $compiler_lib_search_path $postdeps"
+
+      # Compute libraries that are listed more than once in $predeps
+      # $postdeps and mark them as special (i.e., whose duplicates are
+      # not to be eliminated).
+      pre_post_deps=
+      if $opt_duplicate_compiler_generated_deps; then
+	for pre_post_dep in $predeps $postdeps; do
+	  case "$pre_post_deps " in
+	  *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
+	  esac
+	  func_append pre_post_deps " $pre_post_dep"
+	done
+      fi
+      pre_post_deps=
+    fi
+
+    deplibs=
+    newdependency_libs=
+    newlib_search_path=
+    need_relink=no # whether we're linking any uninstalled libtool libraries
+    notinst_deplibs= # not-installed libtool libraries
+    notinst_path= # paths that contain not-installed libtool libraries
+
+    case $linkmode in
+    lib)
+	passes="conv dlpreopen link"
+	for file in $dlfiles $dlprefiles; do
+	  case $file in
+	  *.la) ;;
+	  *)
+	    func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
+	    ;;
+	  esac
+	done
+	;;
+    prog)
+	compile_deplibs=
+	finalize_deplibs=
+	alldeplibs=no
+	newdlfiles=
+	newdlprefiles=
+	passes="conv scan dlopen dlpreopen link"
+	;;
+    *)  passes="conv"
+	;;
+    esac
+
+    for pass in $passes; do
+      # The preopen pass in lib mode reverses $deplibs; put it back here
+      # so that -L comes before libs that need it for instance...
+      if test "$linkmode,$pass" = "lib,link"; then
+	## FIXME: Find the place where the list is rebuilt in the wrong
+	##        order, and fix it there properly
+        tmp_deplibs=
+	for deplib in $deplibs; do
+	  tmp_deplibs="$deplib $tmp_deplibs"
+	done
+	deplibs="$tmp_deplibs"
+      fi
+
+      if test "$linkmode,$pass" = "lib,link" ||
+	 test "$linkmode,$pass" = "prog,scan"; then
+	libs="$deplibs"
+	deplibs=
+      fi
+      if test "$linkmode" = prog; then
+	case $pass in
+	dlopen) libs="$dlfiles" ;;
+	dlpreopen) libs="$dlprefiles" ;;
+	link)
+	  libs="$deplibs %DEPLIBS%"
+	  test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
+	  ;;
+	esac
+      fi
+      if test "$linkmode,$pass" = "lib,dlpreopen"; then
+	# Collect and forward deplibs of preopened libtool libs
+	for lib in $dlprefiles; do
+	  # Ignore non-libtool-libs
+	  dependency_libs=
+	  func_resolve_sysroot "$lib"
+	  case $lib in
+	  *.la)	func_source "$func_resolve_sysroot_result" ;;
+	  esac
+
+	  # Collect preopened libtool deplibs, except any this library
+	  # has declared as weak libs
+	  for deplib in $dependency_libs; do
+	    func_basename "$deplib"
+            deplib_base=$func_basename_result
+	    case " $weak_libs " in
+	    *" $deplib_base "*) ;;
+	    *) func_append deplibs " $deplib" ;;
+	    esac
+	  done
+	done
+	libs="$dlprefiles"
+      fi
+      if test "$pass" = dlopen; then
+	# Collect dlpreopened libraries
+	save_deplibs="$deplibs"
+	deplibs=
+      fi
+
+      for deplib in $libs; do
+	lib=
+	found=no
+	case $deplib in
+	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+	  if test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$deplib $compile_deplibs"
+	    finalize_deplibs="$deplib $finalize_deplibs"
+	  else
+	    func_append compiler_flags " $deplib"
+	    if test "$linkmode" = lib ; then
+		case "$new_inherited_linker_flags " in
+		    *" $deplib "*) ;;
+		    * ) func_append new_inherited_linker_flags " $deplib" ;;
+		esac
+	    fi
+	  fi
+	  continue
+	  ;;
+	-l*)
+	  if test "$linkmode" != lib && test "$linkmode" != prog; then
+	    func_warning "\`-l' is ignored for archives/objects"
+	    continue
+	  fi
+	  func_stripname '-l' '' "$deplib"
+	  name=$func_stripname_result
+	  if test "$linkmode" = lib; then
+	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
+	  else
+	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
+	  fi
+	  for searchdir in $searchdirs; do
+	    for search_ext in .la $std_shrext .so .a; do
+	      # Search the libtool library
+	      lib="$searchdir/lib${name}${search_ext}"
+	      if test -f "$lib"; then
+		if test "$search_ext" = ".la"; then
+		  found=yes
+		else
+		  found=no
+		fi
+		break 2
+	      fi
+	    done
+	  done
+	  if test "$found" != yes; then
+	    # deplib doesn't seem to be a libtool library
+	    if test "$linkmode,$pass" = "prog,link"; then
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      deplibs="$deplib $deplibs"
+	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    continue
+	  else # deplib is a libtool library
+	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
+	    # We need to do some special things here, and not later.
+	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+	      case " $predeps $postdeps " in
+	      *" $deplib "*)
+		if func_lalib_p "$lib"; then
+		  library_names=
+		  old_library=
+		  func_source "$lib"
+		  for l in $old_library $library_names; do
+		    ll="$l"
+		  done
+		  if test "X$ll" = "X$old_library" ; then # only static version available
+		    found=no
+		    func_dirname "$lib" "" "."
+		    ladir="$func_dirname_result"
+		    lib=$ladir/$old_library
+		    if test "$linkmode,$pass" = "prog,link"; then
+		      compile_deplibs="$deplib $compile_deplibs"
+		      finalize_deplibs="$deplib $finalize_deplibs"
+		    else
+		      deplibs="$deplib $deplibs"
+		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
+		    fi
+		    continue
+		  fi
+		fi
+		;;
+	      *) ;;
+	      esac
+	    fi
+	  fi
+	  ;; # -l
+	*.ltframework)
+	  if test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$deplib $compile_deplibs"
+	    finalize_deplibs="$deplib $finalize_deplibs"
+	  else
+	    deplibs="$deplib $deplibs"
+	    if test "$linkmode" = lib ; then
+		case "$new_inherited_linker_flags " in
+		    *" $deplib "*) ;;
+		    * ) func_append new_inherited_linker_flags " $deplib" ;;
+		esac
+	    fi
+	  fi
+	  continue
+	  ;;
+	-L*)
+	  case $linkmode in
+	  lib)
+	    deplibs="$deplib $deplibs"
+	    test "$pass" = conv && continue
+	    newdependency_libs="$deplib $newdependency_libs"
+	    func_stripname '-L' '' "$deplib"
+	    func_resolve_sysroot "$func_stripname_result"
+	    func_append newlib_search_path " $func_resolve_sysroot_result"
+	    ;;
+	  prog)
+	    if test "$pass" = conv; then
+	      deplibs="$deplib $deplibs"
+	      continue
+	    fi
+	    if test "$pass" = scan; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    func_stripname '-L' '' "$deplib"
+	    func_resolve_sysroot "$func_stripname_result"
+	    func_append newlib_search_path " $func_resolve_sysroot_result"
+	    ;;
+	  *)
+	    func_warning "\`-L' is ignored for archives/objects"
+	    ;;
+	  esac # linkmode
+	  continue
+	  ;; # -L
+	-R*)
+	  if test "$pass" = link; then
+	    func_stripname '-R' '' "$deplib"
+	    func_resolve_sysroot "$func_stripname_result"
+	    dir=$func_resolve_sysroot_result
+	    # Make sure the xrpath contains only unique directories.
+	    case "$xrpath " in
+	    *" $dir "*) ;;
+	    *) func_append xrpath " $dir" ;;
+	    esac
+	  fi
+	  deplibs="$deplib $deplibs"
+	  continue
+	  ;;
+	*.la)
+	  func_resolve_sysroot "$deplib"
+	  lib=$func_resolve_sysroot_result
+	  ;;
+	*.$libext)
+	  if test "$pass" = conv; then
+	    deplibs="$deplib $deplibs"
+	    continue
+	  fi
+	  case $linkmode in
+	  lib)
+	    # Linking convenience modules into shared libraries is allowed,
+	    # but linking other static libraries is non-portable.
+	    case " $dlpreconveniencelibs " in
+	    *" $deplib "*) ;;
+	    *)
+	      valid_a_lib=no
+	      case $deplibs_check_method in
+		match_pattern*)
+		  set dummy $deplibs_check_method; shift
+		  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+		  if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
+		    | $EGREP "$match_pattern_regex" > /dev/null; then
+		    valid_a_lib=yes
+		  fi
+		;;
+		pass_all)
+		  valid_a_lib=yes
+		;;
+	      esac
+	      if test "$valid_a_lib" != yes; then
+		echo
+		$ECHO "*** Warning: Trying to link with static lib archive $deplib."
+		echo "*** I have the capability to make that library automatically link in when"
+		echo "*** you link to this library.  But I can only do this if you have a"
+		echo "*** shared version of the library, which you do not appear to have"
+		echo "*** because the file extensions .$libext of this argument makes me believe"
+		echo "*** that it is just a static archive that I should not use here."
+	      else
+		echo
+		$ECHO "*** Warning: Linking the shared library $output against the"
+		$ECHO "*** static library $deplib is not portable!"
+		deplibs="$deplib $deplibs"
+	      fi
+	      ;;
+	    esac
+	    continue
+	    ;;
+	  prog)
+	    if test "$pass" != link; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    fi
+	    continue
+	    ;;
+	  esac # linkmode
+	  ;; # *.$libext
+	*.lo | *.$objext)
+	  if test "$pass" = conv; then
+	    deplibs="$deplib $deplibs"
+	  elif test "$linkmode" = prog; then
+	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
+	      # If there is no dlopen support or we're linking statically,
+	      # we need to preload.
+	      func_append newdlprefiles " $deplib"
+	      compile_deplibs="$deplib $compile_deplibs"
+	      finalize_deplibs="$deplib $finalize_deplibs"
+	    else
+	      func_append newdlfiles " $deplib"
+	    fi
+	  fi
+	  continue
+	  ;;
+	%DEPLIBS%)
+	  alldeplibs=yes
+	  continue
+	  ;;
+	esac # case $deplib
+
+	if test "$found" = yes || test -f "$lib"; then :
+	else
+	  func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
+	fi
+
+	# Check to see that this really is a libtool archive.
+	func_lalib_unsafe_p "$lib" \
+	  || func_fatal_error "\`$lib' is not a valid libtool archive"
+
+	func_dirname "$lib" "" "."
+	ladir="$func_dirname_result"
+
+	dlname=
+	dlopen=
+	dlpreopen=
+	libdir=
+	library_names=
+	old_library=
+	inherited_linker_flags=
+	# If the library was installed with an old release of libtool,
+	# it will not redefine variables installed, or shouldnotlink
+	installed=yes
+	shouldnotlink=no
+	avoidtemprpath=
+
+
+	# Read the .la file
+	func_source "$lib"
+
+	# Convert "-framework foo" to "foo.ltframework"
+	if test -n "$inherited_linker_flags"; then
+	  tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
+	  for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
+	    case " $new_inherited_linker_flags " in
+	      *" $tmp_inherited_linker_flag "*) ;;
+	      *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
+	    esac
+	  done
+	fi
+	dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	if test "$linkmode,$pass" = "lib,link" ||
+	   test "$linkmode,$pass" = "prog,scan" ||
+	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
+	  test -n "$dlopen" && func_append dlfiles " $dlopen"
+	  test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
+	fi
+
+	if test "$pass" = conv; then
+	  # Only check for convenience libraries
+	  deplibs="$lib $deplibs"
+	  if test -z "$libdir"; then
+	    if test -z "$old_library"; then
+	      func_fatal_error "cannot find name of link library for \`$lib'"
+	    fi
+	    # 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
+	  continue
+	fi # $pass = conv
+
+
+	# Get the name of the library we link against.
+	linklib=
+	if test -n "$old_library" &&
+	   { test "$prefer_static_libs" = yes ||
+	     test "$prefer_static_libs,$installed" = "built,no"; }; then
+	  linklib=$old_library
+	else
+	  for l in $old_library $library_names; do
+	    linklib="$l"
+	  done
+	fi
+	if test -z "$linklib"; then
+	  func_fatal_error "cannot find name of link library for \`$lib'"
+	fi
+
+	# This library was specified with -dlopen.
+	if test "$pass" = dlopen; then
+	  if test -z "$libdir"; then
+	    func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
+	  fi
+	  if test -z "$dlname" ||
+	     test "$dlopen_support" != yes ||
+	     test "$build_libtool_libs" = no; then
+	    # If there is no dlname, no dlopen support or we're linking
+	    # statically, we need to preload.  We also need to preload any
+	    # dependent libraries so libltdl's deplib preloader doesn't
+	    # bomb out in the load deplibs phase.
+	    func_append dlprefiles " $lib $dependency_libs"
+	  else
+	    func_append newdlfiles " $lib"
+	  fi
+	  continue
+	fi # $pass = dlopen
+
+	# We need an absolute path.
+	case $ladir in
+	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
+	*)
+	  abs_ladir=`cd "$ladir" && pwd`
+	  if test -z "$abs_ladir"; then
+	    func_warning "cannot determine absolute directory name of \`$ladir'"
+	    func_warning "passing it literally to the linker, although it might fail"
+	    abs_ladir="$ladir"
+	  fi
+	  ;;
+	esac
+	func_basename "$lib"
+	laname="$func_basename_result"
+
+	# Find the relevant object directory and library name.
+	if test "X$installed" = Xyes; then
+	  if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	    func_warning "library \`$lib' was moved."
+	    dir="$ladir"
+	    absdir="$abs_ladir"
+	    libdir="$abs_ladir"
+	  else
+	    dir="$lt_sysroot$libdir"
+	    absdir="$lt_sysroot$libdir"
+	  fi
+	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
+	else
+	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+	    dir="$ladir"
+	    absdir="$abs_ladir"
+	    # Remove this search path later
+	    func_append notinst_path " $abs_ladir"
+	  else
+	    dir="$ladir/$objdir"
+	    absdir="$abs_ladir/$objdir"
+	    # Remove this search path later
+	    func_append notinst_path " $abs_ladir"
+	  fi
+	fi # $installed = yes
+	func_stripname 'lib' '.la' "$laname"
+	name=$func_stripname_result
+
+	# This library was specified with -dlpreopen.
+	if test "$pass" = dlpreopen; then
+	  if test -z "$libdir" && test "$linkmode" = prog; then
+	    func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
+	  fi
+	  case "$host" in
+	    # special handling for platforms with PE-DLLs.
+	    *cygwin* | *mingw* | *cegcc* )
+	      # Linker will automatically link against shared library if both
+	      # static and shared are present.  Therefore, ensure we extract
+	      # symbols from the import library if a shared library is present
+	      # (otherwise, the dlopen module name will be incorrect).  We do
+	      # this by putting the import library name into $newdlprefiles.
+	      # We recover the dlopen module name by 'saving' the la file
+	      # name in a special purpose variable, and (later) extracting the
+	      # dlname from the la file.
+	      if test -n "$dlname"; then
+	        func_tr_sh "$dir/$linklib"
+	        eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
+	        func_append newdlprefiles " $dir/$linklib"
+	      else
+	        func_append newdlprefiles " $dir/$old_library"
+	        # Keep a list of preopened convenience libraries to check
+	        # that they are being used correctly in the link pass.
+	        test -z "$libdir" && \
+	          func_append dlpreconveniencelibs " $dir/$old_library"
+	      fi
+	    ;;
+	    * )
+	      # Prefer using a static library (so that no silly _DYNAMIC symbols
+	      # are required to link).
+	      if test -n "$old_library"; then
+	        func_append newdlprefiles " $dir/$old_library"
+	        # Keep a list of preopened convenience libraries to check
+	        # that they are being used correctly in the link pass.
+	        test -z "$libdir" && \
+	          func_append dlpreconveniencelibs " $dir/$old_library"
+	      # Otherwise, use the dlname, so that lt_dlopen finds it.
+	      elif test -n "$dlname"; then
+	        func_append newdlprefiles " $dir/$dlname"
+	      else
+	        func_append newdlprefiles " $dir/$linklib"
+	      fi
+	    ;;
+	  esac
+	fi # $pass = dlpreopen
+
+	if test -z "$libdir"; then
+	  # Link the convenience library
+	  if test "$linkmode" = lib; then
+	    deplibs="$dir/$old_library $deplibs"
+	  elif test "$linkmode,$pass" = "prog,link"; then
+	    compile_deplibs="$dir/$old_library $compile_deplibs"
+	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
+	  else
+	    deplibs="$lib $deplibs" # used for prog,scan pass
+	  fi
+	  continue
+	fi
+
+
+	if test "$linkmode" = prog && test "$pass" != link; then
+	  func_append newlib_search_path " $ladir"
+	  deplibs="$lib $deplibs"
+
+	  linkalldeplibs=no
+	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
+	     test "$build_libtool_libs" = no; then
+	    linkalldeplibs=yes
+	  fi
+
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    case $deplib in
+	    -L*) func_stripname '-L' '' "$deplib"
+	         func_resolve_sysroot "$func_stripname_result"
+	         func_append newlib_search_path " $func_resolve_sysroot_result"
+		 ;;
+	    esac
+	    # Need to link against all dependency_libs?
+	    if test "$linkalldeplibs" = yes; then
+	      deplibs="$deplib $deplibs"
+	    else
+	      # Need to hardcode shared library paths
+	      # or/and link against static libraries
+	      newdependency_libs="$deplib $newdependency_libs"
+	    fi
+	    if $opt_preserve_dup_deps ; then
+	      case "$tmp_libs " in
+	      *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+	      esac
+	    fi
+	    func_append tmp_libs " $deplib"
+	  done # for deplib
+	  continue
+	fi # $linkmode = prog...
+
+	if test "$linkmode,$pass" = "prog,link"; then
+	  if test -n "$library_names" &&
+	     { { test "$prefer_static_libs" = no ||
+	         test "$prefer_static_libs,$installed" = "built,yes"; } ||
+	       test -z "$old_library"; }; then
+	    # We need to hardcode the library path
+	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
+	      # Make sure the rpath contains only unique directories.
+	      case "$temp_rpath:" in
+	      *"$absdir:"*) ;;
+	      *) func_append temp_rpath "$absdir:" ;;
+	      esac
+	    fi
+
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) func_append compile_rpath " $absdir" ;;
+	      esac
+	      ;;
+	    esac
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) func_append finalize_rpath " $libdir" ;;
+	      esac
+	      ;;
+	    esac
+	  fi # $linkmode,$pass = prog,link...
+
+	  if test "$alldeplibs" = yes &&
+	     { test "$deplibs_check_method" = pass_all ||
+	       { test "$build_libtool_libs" = yes &&
+		 test -n "$library_names"; }; }; then
+	    # We only need to search for static libraries
+	    continue
+	  fi
+	fi
+
+	link_static=no # Whether the deplib will be linked statically
+	use_static_libs=$prefer_static_libs
+	if test "$use_static_libs" = built && test "$installed" = yes; then
+	  use_static_libs=no
+	fi
+	if test -n "$library_names" &&
+	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
+	  case $host in
+	  *cygwin* | *mingw* | *cegcc*)
+	      # No point in relinking DLLs because paths are not encoded
+	      func_append notinst_deplibs " $lib"
+	      need_relink=no
+	    ;;
+	  *)
+	    if test "$installed" = no; then
+	      func_append notinst_deplibs " $lib"
+	      need_relink=yes
+	    fi
+	    ;;
+	  esac
+	  # This is a shared library
+
+	  # Warn about portability, can't link against -module's on some
+	  # systems (darwin).  Don't bleat about dlopened modules though!
+	  dlopenmodule=""
+	  for dlpremoduletest in $dlprefiles; do
+	    if test "X$dlpremoduletest" = "X$lib"; then
+	      dlopenmodule="$dlpremoduletest"
+	      break
+	    fi
+	  done
+	  if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
+	    echo
+	    if test "$linkmode" = prog; then
+	      $ECHO "*** Warning: Linking the executable $output against the loadable module"
+	    else
+	      $ECHO "*** Warning: Linking the shared library $output against the loadable module"
+	    fi
+	    $ECHO "*** $linklib is not portable!"
+	  fi
+	  if test "$linkmode" = lib &&
+	     test "$hardcode_into_libs" = yes; then
+	    # Hardcode the library path.
+	    # Skip directories that are in the system default run-time
+	    # search path.
+	    case " $sys_lib_dlsearch_path " in
+	    *" $absdir "*) ;;
+	    *)
+	      case "$compile_rpath " in
+	      *" $absdir "*) ;;
+	      *) func_append compile_rpath " $absdir" ;;
+	      esac
+	      ;;
+	    esac
+	    case " $sys_lib_dlsearch_path " in
+	    *" $libdir "*) ;;
+	    *)
+	      case "$finalize_rpath " in
+	      *" $libdir "*) ;;
+	      *) func_append finalize_rpath " $libdir" ;;
+	      esac
+	      ;;
+	    esac
+	  fi
+
+	  if test -n "$old_archive_from_expsyms_cmds"; then
+	    # figure out the soname
+	    set dummy $library_names
+	    shift
+	    realname="$1"
+	    shift
+	    libname=`eval "\\$ECHO \"$libname_spec\""`
+	    # use dlname if we got it. it's perfectly good, no?
+	    if test -n "$dlname"; then
+	      soname="$dlname"
+	    elif test -n "$soname_spec"; then
+	      # bleh windows
+	      case $host in
+	      *cygwin* | mingw* | *cegcc*)
+	        func_arith $current - $age
+		major=$func_arith_result
+		versuffix="-$major"
+		;;
+	      esac
+	      eval soname=\"$soname_spec\"
+	    else
+	      soname="$realname"
+	    fi
+
+	    # Make a new name for the extract_expsyms_cmds to use
+	    soroot="$soname"
+	    func_basename "$soroot"
+	    soname="$func_basename_result"
+	    func_stripname 'lib' '.dll' "$soname"
+	    newlib=libimp-$func_stripname_result.a
+
+	    # If the library has no export list, then create one now
+	    if test -f "$output_objdir/$soname-def"; then :
+	    else
+	      func_verbose "extracting exported symbol list from \`$soname'"
+	      func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
+	    fi
+
+	    # Create $newlib
+	    if test -f "$output_objdir/$newlib"; then :; else
+	      func_verbose "generating import library for \`$soname'"
+	      func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
+	    fi
+	    # make sure the library variables are pointing to the new library
+	    dir=$output_objdir
+	    linklib=$newlib
+	  fi # test -n "$old_archive_from_expsyms_cmds"
+
+	  if test "$linkmode" = prog || test "$opt_mode" != relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    lib_linked=yes
+	    case $hardcode_action in
+	    immediate | unsupported)
+	      if test "$hardcode_direct" = no; then
+		add="$dir/$linklib"
+		case $host in
+		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
+		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
+		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
+		    *-*-unixware7*) add_dir="-L$dir" ;;
+		  *-*-darwin* )
+		    # if the lib is a (non-dlopened) module then we can not
+		    # link against it, someone is ignoring the earlier warnings
+		    if /usr/bin/file -L $add 2> /dev/null |
+			 $GREP ": [^:]* bundle" >/dev/null ; then
+		      if test "X$dlopenmodule" != "X$lib"; then
+			$ECHO "*** Warning: lib $linklib is a module, not a shared library"
+			if test -z "$old_library" ; then
+			  echo
+			  echo "*** And there doesn't seem to be a static archive available"
+			  echo "*** The link will probably fail, sorry"
+			else
+			  add="$dir/$old_library"
+			fi
+		      elif test -n "$old_library"; then
+			add="$dir/$old_library"
+		      fi
+		    fi
+		esac
+	      elif test "$hardcode_minus_L" = no; then
+		case $host in
+		*-*-sunos*) add_shlibpath="$dir" ;;
+		esac
+		add_dir="-L$dir"
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = no; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    relink)
+	      if test "$hardcode_direct" = yes &&
+	         test "$hardcode_direct_absolute" = no; then
+		add="$dir/$linklib"
+	      elif test "$hardcode_minus_L" = yes; then
+		add_dir="-L$dir"
+		# Try looking first in the location we're being installed to.
+		if test -n "$inst_prefix_dir"; then
+		  case $libdir in
+		    [\\/]*)
+		      func_append add_dir " -L$inst_prefix_dir$libdir"
+		      ;;
+		  esac
+		fi
+		add="-l$name"
+	      elif test "$hardcode_shlibpath_var" = yes; then
+		add_shlibpath="$dir"
+		add="-l$name"
+	      else
+		lib_linked=no
+	      fi
+	      ;;
+	    *) lib_linked=no ;;
+	    esac
+
+	    if test "$lib_linked" != yes; then
+	      func_fatal_configuration "unsupported hardcode properties"
+	    fi
+
+	    if test -n "$add_shlibpath"; then
+	      case :$compile_shlibpath: in
+	      *":$add_shlibpath:"*) ;;
+	      *) func_append compile_shlibpath "$add_shlibpath:" ;;
+	      esac
+	    fi
+	    if test "$linkmode" = prog; then
+	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
+	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	      if test "$hardcode_direct" != yes &&
+		 test "$hardcode_minus_L" != yes &&
+		 test "$hardcode_shlibpath_var" = yes; then
+		case :$finalize_shlibpath: in
+		*":$libdir:"*) ;;
+		*) func_append finalize_shlibpath "$libdir:" ;;
+		esac
+	      fi
+	    fi
+	  fi
+
+	  if test "$linkmode" = prog || test "$opt_mode" = relink; then
+	    add_shlibpath=
+	    add_dir=
+	    add=
+	    # Finalize command for both is simple: just hardcode it.
+	    if test "$hardcode_direct" = yes &&
+	       test "$hardcode_direct_absolute" = no; then
+	      add="$libdir/$linklib"
+	    elif test "$hardcode_minus_L" = yes; then
+	      add_dir="-L$libdir"
+	      add="-l$name"
+	    elif test "$hardcode_shlibpath_var" = yes; then
+	      case :$finalize_shlibpath: in
+	      *":$libdir:"*) ;;
+	      *) func_append finalize_shlibpath "$libdir:" ;;
+	      esac
+	      add="-l$name"
+	    elif test "$hardcode_automatic" = yes; then
+	      if test -n "$inst_prefix_dir" &&
+		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
+		add="$inst_prefix_dir$libdir/$linklib"
+	      else
+		add="$libdir/$linklib"
+	      fi
+	    else
+	      # We cannot seem to hardcode it, guess we'll fake it.
+	      add_dir="-L$libdir"
+	      # Try looking first in the location we're being installed to.
+	      if test -n "$inst_prefix_dir"; then
+		case $libdir in
+		  [\\/]*)
+		    func_append add_dir " -L$inst_prefix_dir$libdir"
+		    ;;
+		esac
+	      fi
+	      add="-l$name"
+	    fi
+
+	    if test "$linkmode" = prog; then
+	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
+	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
+	    else
+	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
+	      test -n "$add" && deplibs="$add $deplibs"
+	    fi
+	  fi
+	elif test "$linkmode" = prog; then
+	  # Here we assume that one of hardcode_direct or hardcode_minus_L
+	  # is not unsupported.  This is valid on all known static and
+	  # shared platforms.
+	  if test "$hardcode_direct" != unsupported; then
+	    test -n "$old_library" && linklib="$old_library"
+	    compile_deplibs="$dir/$linklib $compile_deplibs"
+	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
+	  else
+	    compile_deplibs="-l$name -L$dir $compile_deplibs"
+	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
+	  fi
+	elif test "$build_libtool_libs" = yes; then
+	  # Not a shared library
+	  if test "$deplibs_check_method" != pass_all; then
+	    # We're trying link a shared library against a static one
+	    # but the system doesn't support it.
+
+	    # Just print a warning and add the library to dependency_libs so
+	    # that the program can be linked against the static library.
+	    echo
+	    $ECHO "*** Warning: This system can not link to static lib archive $lib."
+	    echo "*** I have the capability to make that library automatically link in when"
+	    echo "*** you link to this library.  But I can only do this if you have a"
+	    echo "*** shared version of the library, which you do not appear to have."
+	    if test "$module" = yes; then
+	      echo "*** But as you try to build a module library, libtool will still create "
+	      echo "*** a static module, that should work as long as the dlopening application"
+	      echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+	      if test -z "$global_symbol_pipe"; then
+		echo
+		echo "*** However, this would only work if libtool was able to extract symbol"
+		echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+		echo "*** not find such a program.  So, this module is probably useless."
+		echo "*** \`nm' from GNU binutils and a full rebuild may help."
+	      fi
+	      if test "$build_old_libs" = no; then
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  else
+	    deplibs="$dir/$old_library $deplibs"
+	    link_static=yes
+	  fi
+	fi # link shared/static library?
+
+	if test "$linkmode" = lib; then
+	  if test -n "$dependency_libs" &&
+	     { test "$hardcode_into_libs" != yes ||
+	       test "$build_old_libs" = yes ||
+	       test "$link_static" = yes; }; then
+	    # Extract -R from dependency_libs
+	    temp_deplibs=
+	    for libdir in $dependency_libs; do
+	      case $libdir in
+	      -R*) func_stripname '-R' '' "$libdir"
+	           temp_xrpath=$func_stripname_result
+		   case " $xrpath " in
+		   *" $temp_xrpath "*) ;;
+		   *) func_append xrpath " $temp_xrpath";;
+		   esac;;
+	      *) func_append temp_deplibs " $libdir";;
+	      esac
+	    done
+	    dependency_libs="$temp_deplibs"
+	  fi
+
+	  func_append newlib_search_path " $absdir"
+	  # Link against this library
+	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
+	  # ... and its dependency_libs
+	  tmp_libs=
+	  for deplib in $dependency_libs; do
+	    newdependency_libs="$deplib $newdependency_libs"
+	    case $deplib in
+              -L*) func_stripname '-L' '' "$deplib"
+                   func_resolve_sysroot "$func_stripname_result";;
+              *) func_resolve_sysroot "$deplib" ;;
+            esac
+	    if $opt_preserve_dup_deps ; then
+	      case "$tmp_libs " in
+	      *" $func_resolve_sysroot_result "*)
+                func_append specialdeplibs " $func_resolve_sysroot_result" ;;
+	      esac
+	    fi
+	    func_append tmp_libs " $func_resolve_sysroot_result"
+	  done
+
+	  if test "$link_all_deplibs" != no; then
+	    # Add the search paths of all dependency libraries
+	    for deplib in $dependency_libs; do
+	      path=
+	      case $deplib in
+	      -L*) path="$deplib" ;;
+	      *.la)
+	        func_resolve_sysroot "$deplib"
+	        deplib=$func_resolve_sysroot_result
+	        func_dirname "$deplib" "" "."
+		dir=$func_dirname_result
+		# We need an absolute path.
+		case $dir in
+		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
+		*)
+		  absdir=`cd "$dir" && pwd`
+		  if test -z "$absdir"; then
+		    func_warning "cannot determine absolute directory name of \`$dir'"
+		    absdir="$dir"
+		  fi
+		  ;;
+		esac
+		if $GREP "^installed=no" $deplib > /dev/null; then
+		case $host in
+		*-*-darwin*)
+		  depdepl=
+		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+		  if test -n "$deplibrary_names" ; then
+		    for tmp in $deplibrary_names ; do
+		      depdepl=$tmp
+		    done
+		    if test -f "$absdir/$objdir/$depdepl" ; then
+		      depdepl="$absdir/$objdir/$depdepl"
+		      darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
+                      if test -z "$darwin_install_name"; then
+                          darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
+                      fi
+		      func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
+		      func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
+		      path=
+		    fi
+		  fi
+		  ;;
+		*)
+		  path="-L$absdir/$objdir"
+		  ;;
+		esac
+		else
+		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		  test -z "$libdir" && \
+		    func_fatal_error "\`$deplib' is not a valid libtool archive"
+		  test "$absdir" != "$libdir" && \
+		    func_warning "\`$deplib' seems to be moved"
+
+		  path="-L$absdir"
+		fi
+		;;
+	      esac
+	      case " $deplibs " in
+	      *" $path "*) ;;
+	      *) deplibs="$path $deplibs" ;;
+	      esac
+	    done
+	  fi # link_all_deplibs != no
+	fi # linkmode = lib
+      done # for deplib in $libs
+      if test "$pass" = link; then
+	if test "$linkmode" = "prog"; then
+	  compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
+	  finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
+	else
+	  compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	fi
+      fi
+      dependency_libs="$newdependency_libs"
+      if test "$pass" = dlpreopen; then
+	# Link the dlpreopened libraries before other libraries
+	for deplib in $save_deplibs; do
+	  deplibs="$deplib $deplibs"
+	done
+      fi
+      if test "$pass" != dlopen; then
+	if test "$pass" != conv; then
+	  # Make sure lib_search_path contains only unique directories.
+	  lib_search_path=
+	  for dir in $newlib_search_path; do
+	    case "$lib_search_path " in
+	    *" $dir "*) ;;
+	    *) func_append lib_search_path " $dir" ;;
+	    esac
+	  done
+	  newlib_search_path=
+	fi
+
+	if test "$linkmode,$pass" != "prog,link"; then
+	  vars="deplibs"
+	else
+	  vars="compile_deplibs finalize_deplibs"
+	fi
+	for var in $vars dependency_libs; do
+	  # Add libraries to $var in reverse order
+	  eval tmp_libs=\"\$$var\"
+	  new_libs=
+	  for deplib in $tmp_libs; do
+	    # FIXME: Pedantically, this is the right thing to do, so
+	    #        that some nasty dependency loop isn't accidentally
+	    #        broken:
+	    #new_libs="$deplib $new_libs"
+	    # Pragmatically, this seems to cause very few problems in
+	    # practice:
+	    case $deplib in
+	    -L*) new_libs="$deplib $new_libs" ;;
+	    -R*) ;;
+	    *)
+	      # And here is the reason: when a library appears more
+	      # than once as an explicit dependence of a library, or
+	      # is implicitly linked in more than once by the
+	      # compiler, it is considered special, and multiple
+	      # occurrences thereof are not removed.  Compare this
+	      # with having the same library being listed as a
+	      # dependency of multiple other libraries: in this case,
+	      # we know (pedantically, we assume) the library does not
+	      # need to be listed more than once, so we keep only the
+	      # last copy.  This is not always right, but it is rare
+	      # enough that we require users that really mean to play
+	      # such unportable linking tricks to link the library
+	      # using -Wl,-lname, so that libtool does not consider it
+	      # for duplicate removal.
+	      case " $specialdeplibs " in
+	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
+	      *)
+		case " $new_libs " in
+		*" $deplib "*) ;;
+		*) new_libs="$deplib $new_libs" ;;
+		esac
+		;;
+	      esac
+	      ;;
+	    esac
+	  done
+	  tmp_libs=
+	  for deplib in $new_libs; do
+	    case $deplib in
+	    -L*)
+	      case " $tmp_libs " in
+	      *" $deplib "*) ;;
+	      *) func_append tmp_libs " $deplib" ;;
+	      esac
+	      ;;
+	    *) func_append tmp_libs " $deplib" ;;
+	    esac
+	  done
+	  eval $var=\"$tmp_libs\"
+	done # for var
+      fi
+      # Last step: remove runtime libs from dependency_libs
+      # (they stay in deplibs)
+      tmp_libs=
+      for i in $dependency_libs ; do
+	case " $predeps $postdeps $compiler_lib_search_path " in
+	*" $i "*)
+	  i=""
+	  ;;
+	esac
+	if test -n "$i" ; then
+	  func_append tmp_libs " $i"
+	fi
+      done
+      dependency_libs=$tmp_libs
+    done # for pass
+    if test "$linkmode" = prog; then
+      dlfiles="$newdlfiles"
+    fi
+    if test "$linkmode" = prog || test "$linkmode" = lib; then
+      dlprefiles="$newdlprefiles"
+    fi
+
+    case $linkmode in
+    oldlib)
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	func_warning "\`-dlopen' is ignored for archives"
+      fi
+
+      case " $deplibs" in
+      *\ -l* | *\ -L*)
+	func_warning "\`-l' and \`-L' are ignored for archives" ;;
+      esac
+
+      test -n "$rpath" && \
+	func_warning "\`-rpath' is ignored for archives"
+
+      test -n "$xrpath" && \
+	func_warning "\`-R' is ignored for archives"
+
+      test -n "$vinfo" && \
+	func_warning "\`-version-info/-version-number' is ignored for archives"
+
+      test -n "$release" && \
+	func_warning "\`-release' is ignored for archives"
+
+      test -n "$export_symbols$export_symbols_regex" && \
+	func_warning "\`-export-symbols' is ignored for archives"
+
+      # Now set the variables for building old libraries.
+      build_libtool_libs=no
+      oldlibs="$output"
+      func_append objs "$old_deplibs"
+      ;;
+
+    lib)
+      # Make sure we only generate libraries of the form `libNAME.la'.
+      case $outputname in
+      lib*)
+	func_stripname 'lib' '.la' "$outputname"
+	name=$func_stripname_result
+	eval shared_ext=\"$shrext_cmds\"
+	eval libname=\"$libname_spec\"
+	;;
+      *)
+	test "$module" = no && \
+	  func_fatal_help "libtool library \`$output' must begin with \`lib'"
+
+	if test "$need_lib_prefix" != no; then
+	  # Add the "lib" prefix for modules if required
+	  func_stripname '' '.la' "$outputname"
+	  name=$func_stripname_result
+	  eval shared_ext=\"$shrext_cmds\"
+	  eval libname=\"$libname_spec\"
+	else
+	  func_stripname '' '.la' "$outputname"
+	  libname=$func_stripname_result
+	fi
+	;;
+      esac
+
+      if test -n "$objs"; then
+	if test "$deplibs_check_method" != pass_all; then
+	  func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
+	else
+	  echo
+	  $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
+	  $ECHO "*** objects $objs is not portable!"
+	  func_append libobjs " $objs"
+	fi
+      fi
+
+      test "$dlself" != no && \
+	func_warning "\`-dlopen self' is ignored for libtool libraries"
+
+      set dummy $rpath
+      shift
+      test "$#" -gt 1 && \
+	func_warning "ignoring multiple \`-rpath's for a libtool library"
+
+      install_libdir="$1"
+
+      oldlibs=
+      if test -z "$rpath"; then
+	if test "$build_libtool_libs" = yes; then
+	  # Building a libtool convenience library.
+	  # Some compilers have problems with a `.al' extension so
+	  # convenience libraries should have the same extension an
+	  # archive normally would.
+	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
+	  build_libtool_libs=convenience
+	  build_old_libs=yes
+	fi
+
+	test -n "$vinfo" && \
+	  func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
+
+	test -n "$release" && \
+	  func_warning "\`-release' is ignored for convenience libraries"
+      else
+
+	# Parse the version information argument.
+	save_ifs="$IFS"; IFS=':'
+	set dummy $vinfo 0 0 0
+	shift
+	IFS="$save_ifs"
+
+	test -n "$7" && \
+	  func_fatal_help "too many parameters to \`-version-info'"
+
+	# convert absolute version numbers to libtool ages
+	# this retains compatibility with .la files and attempts
+	# to make the code below a bit more comprehensible
+
+	case $vinfo_number in
+	yes)
+	  number_major="$1"
+	  number_minor="$2"
+	  number_revision="$3"
+	  #
+	  # There are really only two kinds -- those that
+	  # use the current revision as the major version
+	  # and those that subtract age and use age as
+	  # a minor version.  But, then there is irix
+	  # which has an extra 1 added just for fun
+	  #
+	  case $version_type in
+	  darwin|linux|osf|windows|none)
+	    func_arith $number_major + $number_minor
+	    current=$func_arith_result
+	    age="$number_minor"
+	    revision="$number_revision"
+	    ;;
+	  freebsd-aout|freebsd-elf|qnx|sunos)
+	    current="$number_major"
+	    revision="$number_minor"
+	    age="0"
+	    ;;
+	  irix|nonstopux)
+	    func_arith $number_major + $number_minor
+	    current=$func_arith_result
+	    age="$number_minor"
+	    revision="$number_minor"
+	    lt_irix_increment=no
+	    ;;
+	  *)
+	    func_fatal_configuration "$modename: unknown library version type \`$version_type'"
+	    ;;
+	  esac
+	  ;;
+	no)
+	  current="$1"
+	  revision="$2"
+	  age="$3"
+	  ;;
+	esac
+
+	# Check that each of the things are valid numbers.
+	case $current in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  func_error "CURRENT \`$current' must be a nonnegative integer"
+	  func_fatal_error "\`$vinfo' is not valid version information"
+	  ;;
+	esac
+
+	case $revision in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  func_error "REVISION \`$revision' must be a nonnegative integer"
+	  func_fatal_error "\`$vinfo' is not valid version information"
+	  ;;
+	esac
+
+	case $age in
+	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
+	*)
+	  func_error "AGE \`$age' must be a nonnegative integer"
+	  func_fatal_error "\`$vinfo' is not valid version information"
+	  ;;
+	esac
+
+	if test "$age" -gt "$current"; then
+	  func_error "AGE \`$age' is greater than the current interface number \`$current'"
+	  func_fatal_error "\`$vinfo' is not valid version information"
+	fi
+
+	# Calculate the version variables.
+	major=
+	versuffix=
+	verstring=
+	case $version_type in
+	none) ;;
+
+	darwin)
+	  # Like Linux, but with the current version available in
+	  # verstring for coding it into the library header
+	  func_arith $current - $age
+	  major=.$func_arith_result
+	  versuffix="$major.$age.$revision"
+	  # Darwin ld doesn't like 0 for these options...
+	  func_arith $current + 1
+	  minor_current=$func_arith_result
+	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+	  ;;
+
+	freebsd-aout)
+	  major=".$current"
+	  versuffix=".$current.$revision";
+	  ;;
+
+	freebsd-elf)
+	  major=".$current"
+	  versuffix=".$current"
+	  ;;
+
+	irix | nonstopux)
+	  if test "X$lt_irix_increment" = "Xno"; then
+	    func_arith $current - $age
+	  else
+	    func_arith $current - $age + 1
+	  fi
+	  major=$func_arith_result
+
+	  case $version_type in
+	    nonstopux) verstring_prefix=nonstopux ;;
+	    *)         verstring_prefix=sgi ;;
+	  esac
+	  verstring="$verstring_prefix$major.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$revision
+	  while test "$loop" -ne 0; do
+	    func_arith $revision - $loop
+	    iface=$func_arith_result
+	    func_arith $loop - 1
+	    loop=$func_arith_result
+	    verstring="$verstring_prefix$major.$iface:$verstring"
+	  done
+
+	  # Before this point, $major must not contain `.'.
+	  major=.$major
+	  versuffix="$major.$revision"
+	  ;;
+
+	linux)
+	  func_arith $current - $age
+	  major=.$func_arith_result
+	  versuffix="$major.$age.$revision"
+	  ;;
+
+	osf)
+	  func_arith $current - $age
+	  major=.$func_arith_result
+	  versuffix=".$current.$age.$revision"
+	  verstring="$current.$age.$revision"
+
+	  # Add in all the interfaces that we are compatible with.
+	  loop=$age
+	  while test "$loop" -ne 0; do
+	    func_arith $current - $loop
+	    iface=$func_arith_result
+	    func_arith $loop - 1
+	    loop=$func_arith_result
+	    verstring="$verstring:${iface}.0"
+	  done
+
+	  # Make executables depend on our current version.
+	  func_append verstring ":${current}.0"
+	  ;;
+
+	qnx)
+	  major=".$current"
+	  versuffix=".$current"
+	  ;;
+
+	sunos)
+	  major=".$current"
+	  versuffix=".$current.$revision"
+	  ;;
+
+	windows)
+	  # Use '-' rather than '.', since we only want one
+	  # extension on DOS 8.3 filesystems.
+	  func_arith $current - $age
+	  major=$func_arith_result
+	  versuffix="-$major"
+	  ;;
+
+	*)
+	  func_fatal_configuration "unknown library version type \`$version_type'"
+	  ;;
+	esac
+
+	# Clear the version info if we defaulted, and they specified a release.
+	if test -z "$vinfo" && test -n "$release"; then
+	  major=
+	  case $version_type in
+	  darwin)
+	    # we can't check for "0.0" in archive_cmds due to quoting
+	    # problems, so we reset it completely
+	    verstring=
+	    ;;
+	  *)
+	    verstring="0.0"
+	    ;;
+	  esac
+	  if test "$need_version" = no; then
+	    versuffix=
+	  else
+	    versuffix=".0.0"
+	  fi
+	fi
+
+	# Remove version info from name if versioning should be avoided
+	if test "$avoid_version" = yes && test "$need_version" = no; then
+	  major=
+	  versuffix=
+	  verstring=""
+	fi
+
+	# Check to see if the archive will have undefined symbols.
+	if test "$allow_undefined" = yes; then
+	  if test "$allow_undefined_flag" = unsupported; then
+	    func_warning "undefined symbols not allowed in $host shared libraries"
+	    build_libtool_libs=no
+	    build_old_libs=yes
+	  fi
+	else
+	  # Don't allow undefined symbols.
+	  allow_undefined_flag="$no_undefined_flag"
+	fi
+
+      fi
+
+      func_generate_dlsyms "$libname" "$libname" "yes"
+      func_append libobjs " $symfileobj"
+      test "X$libobjs" = "X " && libobjs=
+
+      if test "$opt_mode" != relink; then
+	# Remove our outputs, but don't remove object files since they
+	# may have been created when compiling PIC objects.
+	removelist=
+	tempremovelist=`$ECHO "$output_objdir/*"`
+	for p in $tempremovelist; do
+	  case $p in
+	    *.$objext | *.gcno)
+	       ;;
+	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
+	       if test "X$precious_files_regex" != "X"; then
+		 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+		 then
+		   continue
+		 fi
+	       fi
+	       func_append removelist " $p"
+	       ;;
+	    *) ;;
+	  esac
+	done
+	test -n "$removelist" && \
+	  func_show_eval "${RM}r \$removelist"
+      fi
+
+      # Now set the variables for building old libraries.
+      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
+	func_append oldlibs " $output_objdir/$libname.$libext"
+
+	# Transform .lo files to .o files.
+	oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
+      fi
+
+      # Eliminate all temporary directories.
+      #for path in $notinst_path; do
+      #	lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
+      #	deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
+      #	dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
+      #done
+
+      if test -n "$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	temp_xrpath=
+	for libdir in $xrpath; do
+	  func_replace_sysroot "$libdir"
+	  func_append temp_xrpath " -R$func_replace_sysroot_result"
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) func_append finalize_rpath " $libdir" ;;
+	  esac
+	done
+	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
+	  dependency_libs="$temp_xrpath $dependency_libs"
+	fi
+      fi
+
+      # Make sure dlfiles contains only unique files that won't be dlpreopened
+      old_dlfiles="$dlfiles"
+      dlfiles=
+      for lib in $old_dlfiles; do
+	case " $dlprefiles $dlfiles " in
+	*" $lib "*) ;;
+	*) func_append dlfiles " $lib" ;;
+	esac
+      done
+
+      # Make sure dlprefiles contains only unique files
+      old_dlprefiles="$dlprefiles"
+      dlprefiles=
+      for lib in $old_dlprefiles; do
+	case "$dlprefiles " in
+	*" $lib "*) ;;
+	*) func_append dlprefiles " $lib" ;;
+	esac
+      done
+
+      if test "$build_libtool_libs" = yes; then
+	if test -n "$rpath"; then
+	  case $host in
+	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
+	    # these systems don't actually have a c library (as such)!
+	    ;;
+	  *-*-rhapsody* | *-*-darwin1.[012])
+	    # Rhapsody C library is in the System framework
+	    func_append deplibs " System.ltframework"
+	    ;;
+	  *-*-netbsd*)
+	    # Don't link with libc until the a.out ld.so is fixed.
+	    ;;
+	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
+	    # Do not include libc due to us having libc/libc_r.
+	    ;;
+	  *-*-sco3.2v5* | *-*-sco5v6*)
+	    # Causes problems with __ctype
+	    ;;
+	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
+	    # Compiler inserts libc in the correct place for threads to work
+	    ;;
+	  *)
+	    # Add libc to deplibs on all other systems if necessary.
+	    if test "$build_libtool_need_lc" = "yes"; then
+	      func_append deplibs " -lc"
+	    fi
+	    ;;
+	  esac
+	fi
+
+	# Transform deplibs into only deplibs that can be linked in shared.
+	name_save=$name
+	libname_save=$libname
+	release_save=$release
+	versuffix_save=$versuffix
+	major_save=$major
+	# I'm not sure if I'm treating the release correctly.  I think
+	# release should show up in the -l (ie -lgmp5) so we don't want to
+	# add it in twice.  Is that correct?
+	release=""
+	versuffix=""
+	major=""
+	newdeplibs=
+	droppeddeps=no
+	case $deplibs_check_method in
+	pass_all)
+	  # Don't check for shared/static.  Everything works.
+	  # This might be a little naive.  We might want to check
+	  # whether the library exists or not.  But this is on
+	  # osf3 & osf4 and I'm not really sure... Just
+	  # implementing what was already the behavior.
+	  newdeplibs=$deplibs
+	  ;;
+	test_compile)
+	  # This code stresses the "libraries are programs" paradigm to its
+	  # limits. Maybe even breaks it.  We compile a program, linking it
+	  # against the deplibs as a proxy for the library.  Then we can check
+	  # whether they linked in statically or dynamically with ldd.
+	  $opt_dry_run || $RM conftest.c
+	  cat > conftest.c <<EOF
+	  int main() { return 0; }
+EOF
+	  $opt_dry_run || $RM conftest
+	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
+	    ldd_output=`ldd conftest`
+	    for i in $deplibs; do
+	      case $i in
+	      -l*)
+		func_stripname -l '' "$i"
+		name=$func_stripname_result
+		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		  case " $predeps $postdeps " in
+		  *" $i "*)
+		    func_append newdeplibs " $i"
+		    i=""
+		    ;;
+		  esac
+		fi
+		if test -n "$i" ; then
+		  libname=`eval "\\$ECHO \"$libname_spec\""`
+		  deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+		  set dummy $deplib_matches; shift
+		  deplib_match=$1
+		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		    func_append newdeplibs " $i"
+		  else
+		    droppeddeps=yes
+		    echo
+		    $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+		    echo "*** I have the capability to make that library automatically link in when"
+		    echo "*** you link to this library.  But I can only do this if you have a"
+		    echo "*** shared version of the library, which I believe you do not have"
+		    echo "*** because a test_compile did reveal that the linker did not use it for"
+		    echo "*** its dynamic dependency list that programs get resolved with at runtime."
+		  fi
+		fi
+		;;
+	      *)
+		func_append newdeplibs " $i"
+		;;
+	      esac
+	    done
+	  else
+	    # Error occurred in the first compile.  Let's try to salvage
+	    # the situation: Compile a separate program for each library.
+	    for i in $deplibs; do
+	      case $i in
+	      -l*)
+		func_stripname -l '' "$i"
+		name=$func_stripname_result
+		$opt_dry_run || $RM conftest
+		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
+		  ldd_output=`ldd conftest`
+		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		    case " $predeps $postdeps " in
+		    *" $i "*)
+		      func_append newdeplibs " $i"
+		      i=""
+		      ;;
+		    esac
+		  fi
+		  if test -n "$i" ; then
+		    libname=`eval "\\$ECHO \"$libname_spec\""`
+		    deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+		    set dummy $deplib_matches; shift
+		    deplib_match=$1
+		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+		      func_append newdeplibs " $i"
+		    else
+		      droppeddeps=yes
+		      echo
+		      $ECHO "*** Warning: dynamic linker does not accept needed library $i."
+		      echo "*** I have the capability to make that library automatically link in when"
+		      echo "*** you link to this library.  But I can only do this if you have a"
+		      echo "*** shared version of the library, which you do not appear to have"
+		      echo "*** because a test_compile did reveal that the linker did not use this one"
+		      echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+		    fi
+		  fi
+		else
+		  droppeddeps=yes
+		  echo
+		  $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
+		  echo "*** make it link in!  You will probably need to install it or some"
+		  echo "*** library that it depends on before this library will be fully"
+		  echo "*** functional.  Installing it before continuing would be even better."
+		fi
+		;;
+	      *)
+		func_append newdeplibs " $i"
+		;;
+	      esac
+	    done
+	  fi
+	  ;;
+	file_magic*)
+	  set dummy $deplibs_check_method; shift
+	  file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+	  for a_deplib in $deplibs; do
+	    case $a_deplib in
+	    -l*)
+	      func_stripname -l '' "$a_deplib"
+	      name=$func_stripname_result
+	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		case " $predeps $postdeps " in
+		*" $a_deplib "*)
+		  func_append newdeplibs " $a_deplib"
+		  a_deplib=""
+		  ;;
+		esac
+	      fi
+	      if test -n "$a_deplib" ; then
+		libname=`eval "\\$ECHO \"$libname_spec\""`
+		if test -n "$file_magic_glob"; then
+		  libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
+		else
+		  libnameglob=$libname
+		fi
+		test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
+		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+		  if test "$want_nocaseglob" = yes; then
+		    shopt -s nocaseglob
+		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+		    $nocaseglob
+		  else
+		    potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
+		  fi
+		  for potent_lib in $potential_libs; do
+		      # Follow soft links.
+		      if ls -lLd "$potent_lib" 2>/dev/null |
+			 $GREP " -> " >/dev/null; then
+			continue
+		      fi
+		      # The statement above tries to avoid entering an
+		      # endless loop below, in case of cyclic links.
+		      # We might still enter an endless loop, since a link
+		      # loop can be closed while we follow links,
+		      # but so what?
+		      potlib="$potent_lib"
+		      while test -h "$potlib" 2>/dev/null; do
+			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
+			case $potliblink in
+			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
+			*) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
+			esac
+		      done
+		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
+			 $SED -e 10q |
+			 $EGREP "$file_magic_regex" > /dev/null; then
+			func_append newdeplibs " $a_deplib"
+			a_deplib=""
+			break 2
+		      fi
+		  done
+		done
+	      fi
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		echo
+		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+		echo "*** I have the capability to make that library automatically link in when"
+		echo "*** you link to this library.  But I can only do this if you have a"
+		echo "*** shared version of the library, which you do not appear to have"
+		echo "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
+		else
+		  $ECHO "*** with $libname and none of the candidates passed a file format test"
+		  $ECHO "*** using a file magic. Last file checked: $potlib"
+		fi
+	      fi
+	      ;;
+	    *)
+	      # Add a -L argument.
+	      func_append newdeplibs " $a_deplib"
+	      ;;
+	    esac
+	  done # Gone through all deplibs.
+	  ;;
+	match_pattern*)
+	  set dummy $deplibs_check_method; shift
+	  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+	  for a_deplib in $deplibs; do
+	    case $a_deplib in
+	    -l*)
+	      func_stripname -l '' "$a_deplib"
+	      name=$func_stripname_result
+	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+		case " $predeps $postdeps " in
+		*" $a_deplib "*)
+		  func_append newdeplibs " $a_deplib"
+		  a_deplib=""
+		  ;;
+		esac
+	      fi
+	      if test -n "$a_deplib" ; then
+		libname=`eval "\\$ECHO \"$libname_spec\""`
+		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
+		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+		  for potent_lib in $potential_libs; do
+		    potlib="$potent_lib" # see symlink-check above in file_magic test
+		    if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
+		       $EGREP "$match_pattern_regex" > /dev/null; then
+		      func_append newdeplibs " $a_deplib"
+		      a_deplib=""
+		      break 2
+		    fi
+		  done
+		done
+	      fi
+	      if test -n "$a_deplib" ; then
+		droppeddeps=yes
+		echo
+		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
+		echo "*** I have the capability to make that library automatically link in when"
+		echo "*** you link to this library.  But I can only do this if you have a"
+		echo "*** shared version of the library, which you do not appear to have"
+		echo "*** because I did check the linker path looking for a file starting"
+		if test -z "$potlib" ; then
+		  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
+		else
+		  $ECHO "*** with $libname and none of the candidates passed a file format test"
+		  $ECHO "*** using a regex pattern. Last file checked: $potlib"
+		fi
+	      fi
+	      ;;
+	    *)
+	      # Add a -L argument.
+	      func_append newdeplibs " $a_deplib"
+	      ;;
+	    esac
+	  done # Gone through all deplibs.
+	  ;;
+	none | unknown | *)
+	  newdeplibs=""
+	  tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
+	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
+	    for i in $predeps $postdeps ; do
+	      # can't use Xsed below, because $i might contain '/'
+	      tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
+	    done
+	  fi
+	  case $tmp_deplibs in
+	  *[!\	\ ]*)
+	    echo
+	    if test "X$deplibs_check_method" = "Xnone"; then
+	      echo "*** Warning: inter-library dependencies are not supported in this platform."
+	    else
+	      echo "*** Warning: inter-library dependencies are not known to be supported."
+	    fi
+	    echo "*** All declared inter-library dependencies are being dropped."
+	    droppeddeps=yes
+	    ;;
+	  esac
+	  ;;
+	esac
+	versuffix=$versuffix_save
+	major=$major_save
+	release=$release_save
+	libname=$libname_save
+	name=$name_save
+
+	case $host in
+	*-*-rhapsody* | *-*-darwin1.[012])
+	  # On Rhapsody replace the C library with the System framework
+	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
+	  ;;
+	esac
+
+	if test "$droppeddeps" = yes; then
+	  if test "$module" = yes; then
+	    echo
+	    echo "*** Warning: libtool could not satisfy all declared inter-library"
+	    $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
+	    echo "*** a static module, that should work as long as the dlopening"
+	    echo "*** application is linked with the -dlopen flag."
+	    if test -z "$global_symbol_pipe"; then
+	      echo
+	      echo "*** However, this would only work if libtool was able to extract symbol"
+	      echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+	      echo "*** not find such a program.  So, this module is probably useless."
+	      echo "*** \`nm' from GNU binutils and a full rebuild may help."
+	    fi
+	    if test "$build_old_libs" = no; then
+	      oldlibs="$output_objdir/$libname.$libext"
+	      build_libtool_libs=module
+	      build_old_libs=yes
+	    else
+	      build_libtool_libs=no
+	    fi
+	  else
+	    echo "*** The inter-library dependencies that have been dropped here will be"
+	    echo "*** automatically added whenever a program is linked with this library"
+	    echo "*** or is declared to -dlopen it."
+
+	    if test "$allow_undefined" = no; then
+	      echo
+	      echo "*** Since this library must not contain undefined symbols,"
+	      echo "*** because either the platform does not support them or"
+	      echo "*** it was explicitly requested with -no-undefined,"
+	      echo "*** libtool will only create a static version of it."
+	      if test "$build_old_libs" = no; then
+		oldlibs="$output_objdir/$libname.$libext"
+		build_libtool_libs=module
+		build_old_libs=yes
+	      else
+		build_libtool_libs=no
+	      fi
+	    fi
+	  fi
+	fi
+	# Done checking deplibs!
+	deplibs=$newdeplibs
+      fi
+      # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+      case $host in
+	*-*-darwin*)
+	  newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	  ;;
+      esac
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+	case " $new_libs " in
+	*" -L$path/$objdir "*) ;;
+	*)
+	  case " $deplibs " in
+	  *" -L$path/$objdir "*)
+	    func_append new_libs " -L$path/$objdir" ;;
+	  esac
+	  ;;
+	esac
+      done
+      for deplib in $deplibs; do
+	case $deplib in
+	-L*)
+	  case " $new_libs " in
+	  *" $deplib "*) ;;
+	  *) func_append new_libs " $deplib" ;;
+	  esac
+	  ;;
+	*) func_append new_libs " $deplib" ;;
+	esac
+      done
+      deplibs="$new_libs"
+
+      # All the library-specific variables (install_libdir is set above).
+      library_names=
+      old_library=
+      dlname=
+
+      # Test again, we may have decided not to build it any more
+      if test "$build_libtool_libs" = yes; then
+	if test "$hardcode_into_libs" = yes; then
+	  # Hardcode the library paths
+	  hardcode_libdirs=
+	  dep_rpath=
+	  rpath="$finalize_rpath"
+	  test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
+	  for libdir in $rpath; do
+	    if test -n "$hardcode_libdir_flag_spec"; then
+	      if test -n "$hardcode_libdir_separator"; then
+		func_replace_sysroot "$libdir"
+		libdir=$func_replace_sysroot_result
+		if test -z "$hardcode_libdirs"; then
+		  hardcode_libdirs="$libdir"
+		else
+		  # Just accumulate the unique libdirs.
+		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		    ;;
+		  *)
+		    func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+		    ;;
+		  esac
+		fi
+	      else
+		eval flag=\"$hardcode_libdir_flag_spec\"
+		func_append dep_rpath " $flag"
+	      fi
+	    elif test -n "$runpath_var"; then
+	      case "$perm_rpath " in
+	      *" $libdir "*) ;;
+	      *) func_apped perm_rpath " $libdir" ;;
+	      esac
+	    fi
+	  done
+	  # Substitute the hardcoded libdirs into the rpath.
+	  if test -n "$hardcode_libdir_separator" &&
+	     test -n "$hardcode_libdirs"; then
+	    libdir="$hardcode_libdirs"
+	    if test -n "$hardcode_libdir_flag_spec_ld"; then
+	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
+	    else
+	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
+	    fi
+	  fi
+	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
+	    # We should set the runpath_var.
+	    rpath=
+	    for dir in $perm_rpath; do
+	      func_append rpath "$dir:"
+	    done
+	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
+	  fi
+	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
+	fi
+
+	shlibpath="$finalize_shlibpath"
+	test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+	if test -n "$shlibpath"; then
+	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
+	fi
+
+	# Get the real and link names of the library.
+	eval shared_ext=\"$shrext_cmds\"
+	eval library_names=\"$library_names_spec\"
+	set dummy $library_names
+	shift
+	realname="$1"
+	shift
+
+	if test -n "$soname_spec"; then
+	  eval soname=\"$soname_spec\"
+	else
+	  soname="$realname"
+	fi
+	if test -z "$dlname"; then
+	  dlname=$soname
+	fi
+
+	lib="$output_objdir/$realname"
+	linknames=
+	for link
+	do
+	  func_append linknames " $link"
+	done
+
+	# Use standard objects if they are pic
+	test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
+	test "X$libobjs" = "X " && libobjs=
+
+	delfiles=
+	if test -n "$export_symbols" && test -n "$include_expsyms"; then
+	  $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
+	  export_symbols="$output_objdir/$libname.uexp"
+	  func_append delfiles " $export_symbols"
+	fi
+
+	orig_export_symbols=
+	case $host_os in
+	cygwin* | mingw* | cegcc*)
+	  if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
+	    # exporting using user supplied symfile
+	    if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
+	      # and it's NOT already a .def file. Must figure out
+	      # which of the given symbols are data symbols and tag
+	      # them as such. So, trigger use of export_symbols_cmds.
+	      # export_symbols gets reassigned inside the "prepare
+	      # the list of exported symbols" if statement, so the
+	      # include_expsyms logic still works.
+	      orig_export_symbols="$export_symbols"
+	      export_symbols=
+	      always_export_symbols=yes
+	    fi
+	  fi
+	  ;;
+	esac
+
+	# Prepare the list of exported symbols
+	if test -z "$export_symbols"; then
+	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
+	    func_verbose "generating symbol list for \`$libname.la'"
+	    export_symbols="$output_objdir/$libname.exp"
+	    $opt_dry_run || $RM $export_symbols
+	    cmds=$export_symbols_cmds
+	    save_ifs="$IFS"; IFS='~'
+	    for cmd1 in $cmds; do
+	      IFS="$save_ifs"
+	      # Take the normal branch if the nm_file_list_spec branch
+	      # doesn't work or if tool conversion is not needed.
+	      case $nm_file_list_spec~$to_tool_file_cmd in
+		*~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
+		  try_normal_branch=yes
+		  eval cmd=\"$cmd1\"
+		  func_len " $cmd"
+		  len=$func_len_result
+		  ;;
+		*)
+		  try_normal_branch=no
+		  ;;
+	      esac
+	      if test "$try_normal_branch" = yes \
+		 && { test "$len" -lt "$max_cmd_len" \
+		      || test "$max_cmd_len" -le -1; }
+	      then
+		func_show_eval "$cmd" 'exit $?'
+		skipped_export=false
+	      elif test -n "$nm_file_list_spec"; then
+		func_basename "$output"
+		output_la=$func_basename_result
+		save_libobjs=$libobjs
+		save_output=$output
+		output=${output_objdir}/${output_la}.nm
+		func_to_tool_file "$output"
+		libobjs=$nm_file_list_spec$func_to_tool_file_result
+		func_append delfiles " $output"
+		func_verbose "creating $NM input file list: $output"
+		for obj in $save_libobjs; do
+		  func_to_tool_file "$obj"
+		  $ECHO "$func_to_tool_file_result"
+		done > "$output"
+		eval cmd=\"$cmd1\"
+		func_show_eval "$cmd" 'exit $?'
+		output=$save_output
+		libobjs=$save_libobjs
+		skipped_export=false
+	      else
+		# The command line is too long to execute in one step.
+		func_verbose "using reloadable object file for export list..."
+		skipped_export=:
+		# Break out early, otherwise skipped_export may be
+		# set to false by a later but shorter cmd.
+		break
+	      fi
+	    done
+	    IFS="$save_ifs"
+	    if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
+	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+	    fi
+	  fi
+	fi
+
+	if test -n "$export_symbols" && test -n "$include_expsyms"; then
+	  tmp_export_symbols="$export_symbols"
+	  test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+	  $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+	fi
+
+	if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
+	  # The given exports_symbols file has to be filtered, so filter it.
+	  func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+	  # FIXME: $output_objdir/$libname.filter potentially contains lots of
+	  # 's' commands which not all seds can handle. GNU sed should be fine
+	  # though. Also, the filter scales superlinearly with the number of
+	  # global variables. join(1) would be nice here, but unfortunately
+	  # isn't a blessed tool.
+	  $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+	  func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+	  export_symbols=$output_objdir/$libname.def
+	  $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+	fi
+
+	tmp_deplibs=
+	for test_deplib in $deplibs; do
+	  case " $convenience " in
+	  *" $test_deplib "*) ;;
+	  *)
+	    func_append tmp_deplibs " $test_deplib"
+	    ;;
+	  esac
+	done
+	deplibs="$tmp_deplibs"
+
+	if test -n "$convenience"; then
+	  if test -n "$whole_archive_flag_spec" &&
+	    test "$compiler_needs_object" = yes &&
+	    test -z "$libobjs"; then
+	    # extract the archives, so we have objects to list.
+	    # TODO: could optimize this to just extract one archive.
+	    whole_archive_flag_spec=
+	  fi
+	  if test -n "$whole_archive_flag_spec"; then
+	    save_libobjs=$libobjs
+	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+	    test "X$libobjs" = "X " && libobjs=
+	  else
+	    gentop="$output_objdir/${outputname}x"
+	    func_append generated " $gentop"
+
+	    func_extract_archives $gentop $convenience
+	    func_append libobjs " $func_extract_archives_result"
+	    test "X$libobjs" = "X " && libobjs=
+	  fi
+	fi
+
+	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
+	  eval flag=\"$thread_safe_flag_spec\"
+	  func_append linker_flags " $flag"
+	fi
+
+	# Make a backup of the uninstalled library when relinking
+	if test "$opt_mode" = relink; then
+	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
+	fi
+
+	# Do each of the archive commands.
+	if test "$module" = yes && test -n "$module_cmds" ; then
+	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+	    eval test_cmds=\"$module_expsym_cmds\"
+	    cmds=$module_expsym_cmds
+	  else
+	    eval test_cmds=\"$module_cmds\"
+	    cmds=$module_cmds
+	  fi
+	else
+	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+	    eval test_cmds=\"$archive_expsym_cmds\"
+	    cmds=$archive_expsym_cmds
+	  else
+	    eval test_cmds=\"$archive_cmds\"
+	    cmds=$archive_cmds
+	  fi
+	fi
+
+	if test "X$skipped_export" != "X:" &&
+	   func_len " $test_cmds" &&
+	   len=$func_len_result &&
+	   test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	  :
+	else
+	  # The command line is too long to link in one step, link piecewise
+	  # or, if using GNU ld and skipped_export is not :, use a linker
+	  # script.
+
+	  # Save the value of $output and $libobjs because we want to
+	  # use them later.  If we have whole_archive_flag_spec, we
+	  # want to use save_libobjs as it was before
+	  # whole_archive_flag_spec was expanded, because we can't
+	  # assume the linker understands whole_archive_flag_spec.
+	  # This may have to be revisited, in case too many
+	  # convenience libraries get linked in and end up exceeding
+	  # the spec.
+	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
+	    save_libobjs=$libobjs
+	  fi
+	  save_output=$output
+	  func_basename "$output"
+	  output_la=$func_basename_result
+
+	  # Clear the reloadable object creation command queue and
+	  # initialize k to one.
+	  test_cmds=
+	  concat_cmds=
+	  objlist=
+	  last_robj=
+	  k=1
+
+	  if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
+	    output=${output_objdir}/${output_la}.lnkscript
+	    func_verbose "creating GNU ld script: $output"
+	    echo 'INPUT (' > $output
+	    for obj in $save_libobjs
+	    do
+	      func_to_tool_file "$obj"
+	      $ECHO "$func_to_tool_file_result" >> $output
+	    done
+	    echo ')' >> $output
+	    func_append delfiles " $output"
+	    func_to_tool_file "$output"
+	    output=$func_to_tool_file_result
+	  elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
+	    output=${output_objdir}/${output_la}.lnk
+	    func_verbose "creating linker input file list: $output"
+	    : > $output
+	    set x $save_libobjs
+	    shift
+	    firstobj=
+	    if test "$compiler_needs_object" = yes; then
+	      firstobj="$1 "
+	      shift
+	    fi
+	    for obj
+	    do
+	      func_to_tool_file "$obj"
+	      $ECHO "$func_to_tool_file_result" >> $output
+	    done
+	    func_append delfiles " $output"
+	    func_to_tool_file "$output"
+	    output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
+	  else
+	    if test -n "$save_libobjs"; then
+	      func_verbose "creating reloadable object files..."
+	      output=$output_objdir/$output_la-${k}.$objext
+	      eval test_cmds=\"$reload_cmds\"
+	      func_len " $test_cmds"
+	      len0=$func_len_result
+	      len=$len0
+
+	      # Loop over the list of objects to be linked.
+	      for obj in $save_libobjs
+	      do
+		func_len " $obj"
+		func_arith $len + $func_len_result
+		len=$func_arith_result
+		if test "X$objlist" = X ||
+		   test "$len" -lt "$max_cmd_len"; then
+		  func_append objlist " $obj"
+		else
+		  # The command $test_cmds is almost too long, add a
+		  # command to the queue.
+		  if test "$k" -eq 1 ; then
+		    # The first file doesn't have a previous command to add.
+		    reload_objs=$objlist
+		    eval concat_cmds=\"$reload_cmds\"
+		  else
+		    # All subsequent reloadable object files will link in
+		    # the last one created.
+		    reload_objs="$objlist $last_robj"
+		    eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
+		  fi
+		  last_robj=$output_objdir/$output_la-${k}.$objext
+		  func_arith $k + 1
+		  k=$func_arith_result
+		  output=$output_objdir/$output_la-${k}.$objext
+		  objlist=" $obj"
+		  func_len " $last_robj"
+		  func_arith $len0 + $func_len_result
+		  len=$func_arith_result
+		fi
+	      done
+	      # Handle the remaining objects by creating one last
+	      # reloadable object file.  All subsequent reloadable object
+	      # files will link in the last one created.
+	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	      reload_objs="$objlist $last_robj"
+	      eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
+	      if test -n "$last_robj"; then
+	        eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
+	      fi
+	      func_append delfiles " $output"
+
+	    else
+	      output=
+	    fi
+
+	    if ${skipped_export-false}; then
+	      func_verbose "generating symbol list for \`$libname.la'"
+	      export_symbols="$output_objdir/$libname.exp"
+	      $opt_dry_run || $RM $export_symbols
+	      libobjs=$output
+	      # Append the command to create the export file.
+	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	      eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
+	      if test -n "$last_robj"; then
+		eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
+	      fi
+	    fi
+
+	    test -n "$save_libobjs" &&
+	      func_verbose "creating a temporary reloadable object file: $output"
+
+	    # Loop through the commands generated above and execute them.
+	    save_ifs="$IFS"; IFS='~'
+	    for cmd in $concat_cmds; do
+	      IFS="$save_ifs"
+	      $opt_silent || {
+		  func_quote_for_expand "$cmd"
+		  eval "func_echo $func_quote_for_expand_result"
+	      }
+	      $opt_dry_run || eval "$cmd" || {
+		lt_exit=$?
+
+		# Restore the uninstalled library and exit
+		if test "$opt_mode" = relink; then
+		  ( cd "$output_objdir" && \
+		    $RM "${realname}T" && \
+		    $MV "${realname}U" "$realname" )
+		fi
+
+		exit $lt_exit
+	      }
+	    done
+	    IFS="$save_ifs"
+
+	    if test -n "$export_symbols_regex" && ${skipped_export-false}; then
+	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+	    fi
+	  fi
+
+          if ${skipped_export-false}; then
+	    if test -n "$export_symbols" && test -n "$include_expsyms"; then
+	      tmp_export_symbols="$export_symbols"
+	      test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+	      $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
+	    fi
+
+	    if test -n "$orig_export_symbols"; then
+	      # The given exports_symbols file has to be filtered, so filter it.
+	      func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+	      # FIXME: $output_objdir/$libname.filter potentially contains lots of
+	      # 's' commands which not all seds can handle. GNU sed should be fine
+	      # though. Also, the filter scales superlinearly with the number of
+	      # global variables. join(1) would be nice here, but unfortunately
+	      # isn't a blessed tool.
+	      $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+	      func_append delfiles " $export_symbols $output_objdir/$libname.filter"
+	      export_symbols=$output_objdir/$libname.def
+	      $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+	    fi
+	  fi
+
+	  libobjs=$output
+	  # Restore the value of output.
+	  output=$save_output
+
+	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
+	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+	    test "X$libobjs" = "X " && libobjs=
+	  fi
+	  # Expand the library linking commands again to reset the
+	  # value of $libobjs for piecewise linking.
+
+	  # Do each of the archive commands.
+	  if test "$module" = yes && test -n "$module_cmds" ; then
+	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
+	      cmds=$module_expsym_cmds
+	    else
+	      cmds=$module_cmds
+	    fi
+	  else
+	    if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+	      cmds=$archive_expsym_cmds
+	    else
+	      cmds=$archive_cmds
+	    fi
+	  fi
+	fi
+
+	if test -n "$delfiles"; then
+	  # Append the command to remove temporary files to $cmds.
+	  eval cmds=\"\$cmds~\$RM $delfiles\"
+	fi
+
+	# Add any objects from preloaded convenience libraries
+	if test -n "$dlprefiles"; then
+	  gentop="$output_objdir/${outputname}x"
+	  func_append generated " $gentop"
+
+	  func_extract_archives $gentop $dlprefiles
+	  func_append libobjs " $func_extract_archives_result"
+	  test "X$libobjs" = "X " && libobjs=
+	fi
+
+	save_ifs="$IFS"; IFS='~'
+	for cmd in $cmds; do
+	  IFS="$save_ifs"
+	  eval cmd=\"$cmd\"
+	  $opt_silent || {
+	    func_quote_for_expand "$cmd"
+	    eval "func_echo $func_quote_for_expand_result"
+	  }
+	  $opt_dry_run || eval "$cmd" || {
+	    lt_exit=$?
+
+	    # Restore the uninstalled library and exit
+	    if test "$opt_mode" = relink; then
+	      ( cd "$output_objdir" && \
+	        $RM "${realname}T" && \
+		$MV "${realname}U" "$realname" )
+	    fi
+
+	    exit $lt_exit
+	  }
+	done
+	IFS="$save_ifs"
+
+	# Restore the uninstalled library and exit
+	if test "$opt_mode" = relink; then
+	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
+
+	  if test -n "$convenience"; then
+	    if test -z "$whole_archive_flag_spec"; then
+	      func_show_eval '${RM}r "$gentop"'
+	    fi
+	  fi
+
+	  exit $EXIT_SUCCESS
+	fi
+
+	# Create links to the real library.
+	for linkname in $linknames; do
+	  if test "$realname" != "$linkname"; then
+	    func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
+	  fi
+	done
+
+	# If -module or -export-dynamic was specified, set the dlname.
+	if test "$module" = yes || test "$export_dynamic" = yes; then
+	  # On all known operating systems, these are identical.
+	  dlname="$soname"
+	fi
+      fi
+      ;;
+
+    obj)
+      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+	func_warning "\`-dlopen' is ignored for objects"
+      fi
+
+      case " $deplibs" in
+      *\ -l* | *\ -L*)
+	func_warning "\`-l' and \`-L' are ignored for objects" ;;
+      esac
+
+      test -n "$rpath" && \
+	func_warning "\`-rpath' is ignored for objects"
+
+      test -n "$xrpath" && \
+	func_warning "\`-R' is ignored for objects"
+
+      test -n "$vinfo" && \
+	func_warning "\`-version-info' is ignored for objects"
+
+      test -n "$release" && \
+	func_warning "\`-release' is ignored for objects"
+
+      case $output in
+      *.lo)
+	test -n "$objs$old_deplibs" && \
+	  func_fatal_error "cannot build library object \`$output' from non-libtool objects"
+
+	libobj=$output
+	func_lo2o "$libobj"
+	obj=$func_lo2o_result
+	;;
+      *)
+	libobj=
+	obj="$output"
+	;;
+      esac
+
+      # Delete the old objects.
+      $opt_dry_run || $RM $obj $libobj
+
+      # Objects from convenience libraries.  This assumes
+      # single-version convenience libraries.  Whenever we create
+      # different ones for PIC/non-PIC, this we'll have to duplicate
+      # the extraction.
+      reload_conv_objs=
+      gentop=
+      # reload_cmds runs $LD directly, so let us get rid of
+      # -Wl from whole_archive_flag_spec and hope we can get by with
+      # turning comma into space..
+      wl=
+
+      if test -n "$convenience"; then
+	if test -n "$whole_archive_flag_spec"; then
+	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
+	  reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
+	else
+	  gentop="$output_objdir/${obj}x"
+	  func_append generated " $gentop"
+
+	  func_extract_archives $gentop $convenience
+	  reload_conv_objs="$reload_objs $func_extract_archives_result"
+	fi
+      fi
+
+      # If we're not building shared, we need to use non_pic_objs
+      test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
+
+      # Create the old-style object.
+      reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+
+      output="$obj"
+      func_execute_cmds "$reload_cmds" 'exit $?'
+
+      # Exit if we aren't doing a library object file.
+      if test -z "$libobj"; then
+	if test -n "$gentop"; then
+	  func_show_eval '${RM}r "$gentop"'
+	fi
+
+	exit $EXIT_SUCCESS
+      fi
+
+      if test "$build_libtool_libs" != yes; then
+	if test -n "$gentop"; then
+	  func_show_eval '${RM}r "$gentop"'
+	fi
+
+	# Create an invalid libtool object if no PIC, so that we don't
+	# accidentally link it into a program.
+	# $show "echo timestamp > $libobj"
+	# $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
+	exit $EXIT_SUCCESS
+      fi
+
+      if test -n "$pic_flag" || test "$pic_mode" != default; then
+	# Only do commands if we really have different PIC objects.
+	reload_objs="$libobjs $reload_conv_objs"
+	output="$libobj"
+	func_execute_cmds "$reload_cmds" 'exit $?'
+      fi
+
+      if test -n "$gentop"; then
+	func_show_eval '${RM}r "$gentop"'
+      fi
+
+      exit $EXIT_SUCCESS
+      ;;
+
+    prog)
+      case $host in
+	*cygwin*) func_stripname '' '.exe' "$output"
+	          output=$func_stripname_result.exe;;
+      esac
+      test -n "$vinfo" && \
+	func_warning "\`-version-info' is ignored for programs"
+
+      test -n "$release" && \
+	func_warning "\`-release' is ignored for programs"
+
+      test "$preload" = yes \
+        && test "$dlopen_support" = unknown \
+	&& test "$dlopen_self" = unknown \
+	&& test "$dlopen_self_static" = unknown && \
+	  func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
+
+      case $host in
+      *-*-rhapsody* | *-*-darwin1.[012])
+	# On Rhapsody replace the C library is the System framework
+	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
+	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
+	;;
+      esac
+
+      case $host in
+      *-*-darwin*)
+	# Don't allow lazy linking, it breaks C++ global constructors
+	# But is supposedly fixed on 10.4 or later (yay!).
+	if test "$tagname" = CXX ; then
+	  case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
+	    10.[0123])
+	      func_append compile_command " ${wl}-bind_at_load"
+	      func_append finalize_command " ${wl}-bind_at_load"
+	    ;;
+	  esac
+	fi
+	# Time to change all our "foo.ltframework" stuff back to "-framework foo"
+	compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+	;;
+      esac
+
+
+      # move library search paths that coincide with paths to not yet
+      # installed libraries to the beginning of the library search list
+      new_libs=
+      for path in $notinst_path; do
+	case " $new_libs " in
+	*" -L$path/$objdir "*) ;;
+	*)
+	  case " $compile_deplibs " in
+	  *" -L$path/$objdir "*)
+	    func_append new_libs " -L$path/$objdir" ;;
+	  esac
+	  ;;
+	esac
+      done
+      for deplib in $compile_deplibs; do
+	case $deplib in
+	-L*)
+	  case " $new_libs " in
+	  *" $deplib "*) ;;
+	  *) func_append new_libs " $deplib" ;;
+	  esac
+	  ;;
+	*) func_append new_libs " $deplib" ;;
+	esac
+      done
+      compile_deplibs="$new_libs"
+
+
+      func_append compile_command " $compile_deplibs"
+      func_append finalize_command " $finalize_deplibs"
+
+      if test -n "$rpath$xrpath"; then
+	# If the user specified any rpath flags, then add them.
+	for libdir in $rpath $xrpath; do
+	  # This is the magic to use -rpath.
+	  case "$finalize_rpath " in
+	  *" $libdir "*) ;;
+	  *) func_append finalize_rpath " $libdir" ;;
+	  esac
+	done
+      fi
+
+      # Now hardcode the library paths
+      rpath=
+      hardcode_libdirs=
+      for libdir in $compile_rpath $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval flag=\"$hardcode_libdir_flag_spec\"
+	    func_append rpath " $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) func_append perm_rpath " $libdir" ;;
+	  esac
+	fi
+	case $host in
+	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+	  testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
+	  case :$dllsearchpath: in
+	  *":$libdir:"*) ;;
+	  ::) dllsearchpath=$libdir;;
+	  *) func_append dllsearchpath ":$libdir";;
+	  esac
+	  case :$dllsearchpath: in
+	  *":$testbindir:"*) ;;
+	  ::) dllsearchpath=$testbindir;;
+	  *) func_append dllsearchpath ":$testbindir";;
+	  esac
+	  ;;
+	esac
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      compile_rpath="$rpath"
+
+      rpath=
+      hardcode_libdirs=
+      for libdir in $finalize_rpath; do
+	if test -n "$hardcode_libdir_flag_spec"; then
+	  if test -n "$hardcode_libdir_separator"; then
+	    if test -z "$hardcode_libdirs"; then
+	      hardcode_libdirs="$libdir"
+	    else
+	      # Just accumulate the unique libdirs.
+	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
+	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
+		;;
+	      *)
+		func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+		;;
+	      esac
+	    fi
+	  else
+	    eval flag=\"$hardcode_libdir_flag_spec\"
+	    func_append rpath " $flag"
+	  fi
+	elif test -n "$runpath_var"; then
+	  case "$finalize_perm_rpath " in
+	  *" $libdir "*) ;;
+	  *) func_append finalize_perm_rpath " $libdir" ;;
+	  esac
+	fi
+      done
+      # Substitute the hardcoded libdirs into the rpath.
+      if test -n "$hardcode_libdir_separator" &&
+	 test -n "$hardcode_libdirs"; then
+	libdir="$hardcode_libdirs"
+	eval rpath=\" $hardcode_libdir_flag_spec\"
+      fi
+      finalize_rpath="$rpath"
+
+      if test -n "$libobjs" && test "$build_old_libs" = yes; then
+	# Transform all the library objects into standard objects.
+	compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+	finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+      fi
+
+      func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
+
+      # template prelinking step
+      if test -n "$prelink_cmds"; then
+	func_execute_cmds "$prelink_cmds" 'exit $?'
+      fi
+
+      wrappers_required=yes
+      case $host in
+      *cegcc* | *mingw32ce*)
+        # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
+        wrappers_required=no
+        ;;
+      *cygwin* | *mingw* )
+        if test "$build_libtool_libs" != yes; then
+          wrappers_required=no
+        fi
+        ;;
+      *)
+        if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+          wrappers_required=no
+        fi
+        ;;
+      esac
+      if test "$wrappers_required" = no; then
+	# Replace the output file specification.
+	compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+	link_command="$compile_command$compile_rpath"
+
+	# We have no uninstalled library dependencies, so finalize right now.
+	exit_status=0
+	func_show_eval "$link_command" 'exit_status=$?'
+
+	if test -n "$postlink_cmds"; then
+	  func_to_tool_file "$output"
+	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+	  func_execute_cmds "$postlink_cmds" 'exit $?'
+	fi
+
+	# Delete the generated files.
+	if test -f "$output_objdir/${outputname}S.${objext}"; then
+	  func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
+	fi
+
+	exit $exit_status
+      fi
+
+      if test -n "$compile_shlibpath$finalize_shlibpath"; then
+	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
+      fi
+      if test -n "$finalize_shlibpath"; then
+	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
+      fi
+
+      compile_var=
+      finalize_var=
+      if test -n "$runpath_var"; then
+	if test -n "$perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $perm_rpath; do
+	    func_append rpath "$dir:"
+	  done
+	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+	if test -n "$finalize_perm_rpath"; then
+	  # We should set the runpath_var.
+	  rpath=
+	  for dir in $finalize_perm_rpath; do
+	    func_append rpath "$dir:"
+	  done
+	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
+	fi
+      fi
+
+      if test "$no_install" = yes; then
+	# We don't need to create a wrapper script.
+	link_command="$compile_var$compile_command$compile_rpath"
+	# Replace the output file specification.
+	link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+	# Delete the old output file.
+	$opt_dry_run || $RM $output
+	# Link the executable and exit
+	func_show_eval "$link_command" 'exit $?'
+
+	if test -n "$postlink_cmds"; then
+	  func_to_tool_file "$output"
+	  postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+	  func_execute_cmds "$postlink_cmds" 'exit $?'
+	fi
+
+	exit $EXIT_SUCCESS
+      fi
+
+      if test "$hardcode_action" = relink; then
+	# Fast installation is not supported
+	link_command="$compile_var$compile_command$compile_rpath"
+	relink_command="$finalize_var$finalize_command$finalize_rpath"
+
+	func_warning "this platform does not like uninstalled shared libraries"
+	func_warning "\`$output' will be relinked during installation"
+      else
+	if test "$fast_install" != no; then
+	  link_command="$finalize_var$compile_command$finalize_rpath"
+	  if test "$fast_install" = yes; then
+	    relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
+	  else
+	    # fast_install is set to needless
+	    relink_command=
+	  fi
+	else
+	  link_command="$compile_var$compile_command$compile_rpath"
+	  relink_command="$finalize_var$finalize_command$finalize_rpath"
+	fi
+      fi
+
+      # Replace the output file specification.
+      link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+
+      # Delete the old output files.
+      $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
+
+      func_show_eval "$link_command" 'exit $?'
+
+      if test -n "$postlink_cmds"; then
+	func_to_tool_file "$output_objdir/$outputname"
+	postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
+	func_execute_cmds "$postlink_cmds" 'exit $?'
+      fi
+
+      # Now create the wrapper script.
+      func_verbose "creating $output"
+
+      # Quote the relink command for shipping.
+      if test -n "$relink_command"; then
+	# Preserve any variables that may affect compiler behavior
+	for var in $variables_saved_for_relink; do
+	  if eval test -z \"\${$var+set}\"; then
+	    relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+	  elif eval var_value=\$$var; test -z "$var_value"; then
+	    relink_command="$var=; export $var; $relink_command"
+	  else
+	    func_quote_for_eval "$var_value"
+	    relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+	  fi
+	done
+	relink_command="(cd `pwd`; $relink_command)"
+	relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+      fi
+
+      # Only actually do things if not in dry run mode.
+      $opt_dry_run || {
+	# win32 will think the script is a binary if it has
+	# a .exe suffix, so we strip it off here.
+	case $output in
+	  *.exe) func_stripname '' '.exe' "$output"
+	         output=$func_stripname_result ;;
+	esac
+	# test for cygwin because mv fails w/o .exe extensions
+	case $host in
+	  *cygwin*)
+	    exeext=.exe
+	    func_stripname '' '.exe' "$outputname"
+	    outputname=$func_stripname_result ;;
+	  *) exeext= ;;
+	esac
+	case $host in
+	  *cygwin* | *mingw* )
+	    func_dirname_and_basename "$output" "" "."
+	    output_name=$func_basename_result
+	    output_path=$func_dirname_result
+	    cwrappersource="$output_path/$objdir/lt-$output_name.c"
+	    cwrapper="$output_path/$output_name.exe"
+	    $RM $cwrappersource $cwrapper
+	    trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+	    func_emit_cwrapperexe_src > $cwrappersource
+
+	    # The wrapper executable is built using the $host compiler,
+	    # because it contains $host paths and files. If cross-
+	    # compiling, it, like the target executable, must be
+	    # executed on the $host or under an emulation environment.
+	    $opt_dry_run || {
+	      $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
+	      $STRIP $cwrapper
+	    }
+
+	    # Now, create the wrapper script for func_source use:
+	    func_ltwrapper_scriptname $cwrapper
+	    $RM $func_ltwrapper_scriptname_result
+	    trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
+	    $opt_dry_run || {
+	      # note: this script will not be executed, so do not chmod.
+	      if test "x$build" = "x$host" ; then
+		$cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
+	      else
+		func_emit_wrapper no > $func_ltwrapper_scriptname_result
+	      fi
+	    }
+	  ;;
+	  * )
+	    $RM $output
+	    trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
+
+	    func_emit_wrapper no > $output
+	    chmod +x $output
+	  ;;
+	esac
+      }
+      exit $EXIT_SUCCESS
+      ;;
+    esac
+
+    # See if we need to build an old-fashioned archive.
+    for oldlib in $oldlibs; do
+
+      if test "$build_libtool_libs" = convenience; then
+	oldobjs="$libobjs_save $symfileobj"
+	addlibs="$convenience"
+	build_libtool_libs=no
+      else
+	if test "$build_libtool_libs" = module; then
+	  oldobjs="$libobjs_save"
+	  build_libtool_libs=no
+	else
+	  oldobjs="$old_deplibs $non_pic_objects"
+	  if test "$preload" = yes && test -f "$symfileobj"; then
+	    func_append oldobjs " $symfileobj"
+	  fi
+	fi
+	addlibs="$old_convenience"
+      fi
+
+      if test -n "$addlibs"; then
+	gentop="$output_objdir/${outputname}x"
+	func_append generated " $gentop"
+
+	func_extract_archives $gentop $addlibs
+	func_append oldobjs " $func_extract_archives_result"
+      fi
+
+      # Do each command in the archive commands.
+      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
+	cmds=$old_archive_from_new_cmds
+      else
+
+	# Add any objects from preloaded convenience libraries
+	if test -n "$dlprefiles"; then
+	  gentop="$output_objdir/${outputname}x"
+	  func_append generated " $gentop"
+
+	  func_extract_archives $gentop $dlprefiles
+	  func_append oldobjs " $func_extract_archives_result"
+	fi
+
+	# POSIX demands no paths to be encoded in archives.  We have
+	# to avoid creating archives with duplicate basenames if we
+	# might have to extract them afterwards, e.g., when creating a
+	# static archive out of a convenience library, or when linking
+	# the entirety of a libtool archive into another (currently
+	# not supported by libtool).
+	if (for obj in $oldobjs
+	    do
+	      func_basename "$obj"
+	      $ECHO "$func_basename_result"
+	    done | sort | sort -uc >/dev/null 2>&1); then
+	  :
+	else
+	  echo "copying selected object files to avoid basename conflicts..."
+	  gentop="$output_objdir/${outputname}x"
+	  func_append generated " $gentop"
+	  func_mkdir_p "$gentop"
+	  save_oldobjs=$oldobjs
+	  oldobjs=
+	  counter=1
+	  for obj in $save_oldobjs
+	  do
+	    func_basename "$obj"
+	    objbase="$func_basename_result"
+	    case " $oldobjs " in
+	    " ") oldobjs=$obj ;;
+	    *[\ /]"$objbase "*)
+	      while :; do
+		# Make sure we don't pick an alternate name that also
+		# overlaps.
+		newobj=lt$counter-$objbase
+		func_arith $counter + 1
+		counter=$func_arith_result
+		case " $oldobjs " in
+		*[\ /]"$newobj "*) ;;
+		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
+		esac
+	      done
+	      func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+	      func_append oldobjs " $gentop/$newobj"
+	      ;;
+	    *) func_append oldobjs " $obj" ;;
+	    esac
+	  done
+	fi
+	eval cmds=\"$old_archive_cmds\"
+
+	func_len " $cmds"
+	len=$func_len_result
+	if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+	  cmds=$old_archive_cmds
+	elif test -n "$archiver_list_spec"; then
+	  func_verbose "using command file archive linking..."
+	  for obj in $oldobjs
+	  do
+	    func_to_tool_file "$obj"
+	    $ECHO "$func_to_tool_file_result"
+	  done > $output_objdir/$libname.libcmd
+	  func_to_tool_file "$output_objdir/$libname.libcmd"
+	  oldobjs=" $archiver_list_spec$func_to_tool_file_result"
+	  cmds=$old_archive_cmds
+	else
+	  # the command line is too long to link in one step, link in parts
+	  func_verbose "using piecewise archive linking..."
+	  save_RANLIB=$RANLIB
+	  RANLIB=:
+	  objlist=
+	  concat_cmds=
+	  save_oldobjs=$oldobjs
+	  oldobjs=
+	  # Is there a better way of finding the last object in the list?
+	  for obj in $save_oldobjs
+	  do
+	    last_oldobj=$obj
+	  done
+	  eval test_cmds=\"$old_archive_cmds\"
+	  func_len " $test_cmds"
+	  len0=$func_len_result
+	  len=$len0
+	  for obj in $save_oldobjs
+	  do
+	    func_len " $obj"
+	    func_arith $len + $func_len_result
+	    len=$func_arith_result
+	    func_append objlist " $obj"
+	    if test "$len" -lt "$max_cmd_len"; then
+	      :
+	    else
+	      # the above command should be used before it gets too long
+	      oldobjs=$objlist
+	      if test "$obj" = "$last_oldobj" ; then
+		RANLIB=$save_RANLIB
+	      fi
+	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
+	      objlist=
+	      len=$len0
+	    fi
+	  done
+	  RANLIB=$save_RANLIB
+	  oldobjs=$objlist
+	  if test "X$oldobjs" = "X" ; then
+	    eval cmds=\"\$concat_cmds\"
+	  else
+	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
+	  fi
+	fi
+      fi
+      func_execute_cmds "$cmds" 'exit $?'
+    done
+
+    test -n "$generated" && \
+      func_show_eval "${RM}r$generated"
+
+    # Now create the libtool archive.
+    case $output in
+    *.la)
+      old_library=
+      test "$build_old_libs" = yes && old_library="$libname.$libext"
+      func_verbose "creating $output"
+
+      # Preserve any variables that may affect compiler behavior
+      for var in $variables_saved_for_relink; do
+	if eval test -z \"\${$var+set}\"; then
+	  relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+	elif eval var_value=\$$var; test -z "$var_value"; then
+	  relink_command="$var=; export $var; $relink_command"
+	else
+	  func_quote_for_eval "$var_value"
+	  relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+	fi
+      done
+      # Quote the link command for shipping.
+      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
+      relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+      if test "$hardcode_automatic" = yes ; then
+	relink_command=
+      fi
+
+      # Only create the output if not a dry run.
+      $opt_dry_run || {
+	for installed in no yes; do
+	  if test "$installed" = yes; then
+	    if test -z "$install_libdir"; then
+	      break
+	    fi
+	    output="$output_objdir/$outputname"i
+	    # Replace all uninstalled libtool libraries with the installed ones
+	    newdependency_libs=
+	    for deplib in $dependency_libs; do
+	      case $deplib in
+	      *.la)
+		func_basename "$deplib"
+		name="$func_basename_result"
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+		test -z "$libdir" && \
+		  func_fatal_error "\`$deplib' is not a valid libtool archive"
+		func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
+		;;
+	      -L*)
+		func_stripname -L '' "$deplib"
+		func_replace_sysroot "$func_stripname_result"
+		func_append newdependency_libs " -L$func_replace_sysroot_result"
+		;;
+	      -R*)
+		func_stripname -R '' "$deplib"
+		func_replace_sysroot "$func_stripname_result"
+		func_append newdependency_libs " -R$func_replace_sysroot_result"
+		;;
+	      *) func_append newdependency_libs " $deplib" ;;
+	      esac
+	    done
+	    dependency_libs="$newdependency_libs"
+	    newdlfiles=
+
+	    for lib in $dlfiles; do
+	      case $lib in
+	      *.la)
+	        func_basename "$lib"
+		name="$func_basename_result"
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+		test -z "$libdir" && \
+		  func_fatal_error "\`$lib' is not a valid libtool archive"
+		func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
+		;;
+	      *) func_append newdlfiles " $lib" ;;
+	      esac
+	    done
+	    dlfiles="$newdlfiles"
+	    newdlprefiles=
+	    for lib in $dlprefiles; do
+	      case $lib in
+	      *.la)
+		# Only pass preopened files to the pseudo-archive (for
+		# eventual linking with the app. that links it) if we
+		# didn't already link the preopened objects directly into
+		# the library:
+		func_basename "$lib"
+		name="$func_basename_result"
+		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+		test -z "$libdir" && \
+		  func_fatal_error "\`$lib' is not a valid libtool archive"
+		func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
+		;;
+	      esac
+	    done
+	    dlprefiles="$newdlprefiles"
+	  else
+	    newdlfiles=
+	    for lib in $dlfiles; do
+	      case $lib in
+		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+		*) abs=`pwd`"/$lib" ;;
+	      esac
+	      func_append newdlfiles " $abs"
+	    done
+	    dlfiles="$newdlfiles"
+	    newdlprefiles=
+	    for lib in $dlprefiles; do
+	      case $lib in
+		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
+		*) abs=`pwd`"/$lib" ;;
+	      esac
+	      func_append newdlprefiles " $abs"
+	    done
+	    dlprefiles="$newdlprefiles"
+	  fi
+	  $RM $output
+	  # place dlname in correct position for cygwin
+	  # In fact, it would be nice if we could use this code for all target
+	  # systems that can't hard-code library paths into their executables
+	  # and that have no shared library path variable independent of PATH,
+	  # but it turns out we can't easily determine that from inspecting
+	  # libtool variables, so we have to hard-code the OSs to which it
+	  # applies here; at the moment, that means platforms that use the PE
+	  # object format with DLL files.  See the long comment at the top of
+	  # tests/bindir.at for full details.
+	  tdlname=$dlname
+	  case $host,$output,$installed,$module,$dlname in
+	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
+	      # If a -bindir argument was supplied, place the dll there.
+	      if test "x$bindir" != x ;
+	      then
+		func_relative_path "$install_libdir" "$bindir"
+		tdlname=$func_relative_path_result$dlname
+	      else
+		# Otherwise fall back on heuristic.
+		tdlname=../bin/$dlname
+	      fi
+	      ;;
+	  esac
+	  $ECHO > $output "\
+# $outputname - a libtool library file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# The name that we can dlopen(3).
+dlname='$tdlname'
+
+# Names of this library.
+library_names='$library_names'
+
+# The name of the static archive.
+old_library='$old_library'
+
+# Linker flags that can not go in dependency_libs.
+inherited_linker_flags='$new_inherited_linker_flags'
+
+# Libraries that this one depends upon.
+dependency_libs='$dependency_libs'
+
+# Names of additional weak libraries provided by this library
+weak_library_names='$weak_libs'
+
+# Version information for $libname.
+current=$current
+age=$age
+revision=$revision
+
+# Is this an already installed library?
+installed=$installed
+
+# Should we warn about portability when linking against -modules?
+shouldnotlink=$module
+
+# Files to dlopen/dlpreopen
+dlopen='$dlfiles'
+dlpreopen='$dlprefiles'
+
+# Directory that this library needs to be installed in:
+libdir='$install_libdir'"
+	  if test "$installed" = no && test "$need_relink" = yes; then
+	    $ECHO >> $output "\
+relink_command=\"$relink_command\""
+	  fi
+	done
+      }
+
+      # Do a symbolic link so that the libtool archive can be found in
+      # LD_LIBRARY_PATH before the program is installed.
+      func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
+      ;;
+    esac
+    exit $EXIT_SUCCESS
+}
+
+{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
+    func_mode_link ${1+"$@"}
+
+
+# func_mode_uninstall arg...
+func_mode_uninstall ()
+{
+    $opt_debug
+    RM="$nonopt"
+    files=
+    rmforce=
+    exit_status=0
+
+    # This variable tells wrapper scripts just to set variables rather
+    # than running their programs.
+    libtool_install_magic="$magic"
+
+    for arg
+    do
+      case $arg in
+      -f) func_append RM " $arg"; rmforce=yes ;;
+      -*) func_append RM " $arg" ;;
+      *) func_append files " $arg" ;;
+      esac
+    done
+
+    test -z "$RM" && \
+      func_fatal_help "you must specify an RM program"
+
+    rmdirs=
+
+    for file in $files; do
+      func_dirname "$file" "" "."
+      dir="$func_dirname_result"
+      if test "X$dir" = X.; then
+	odir="$objdir"
+      else
+	odir="$dir/$objdir"
+      fi
+      func_basename "$file"
+      name="$func_basename_result"
+      test "$opt_mode" = uninstall && odir="$dir"
+
+      # Remember odir for removal later, being careful to avoid duplicates
+      if test "$opt_mode" = clean; then
+	case " $rmdirs " in
+	  *" $odir "*) ;;
+	  *) func_append rmdirs " $odir" ;;
+	esac
+      fi
+
+      # Don't error if the file doesn't exist and rm -f was used.
+      if { test -L "$file"; } >/dev/null 2>&1 ||
+	 { test -h "$file"; } >/dev/null 2>&1 ||
+	 test -f "$file"; then
+	:
+      elif test -d "$file"; then
+	exit_status=1
+	continue
+      elif test "$rmforce" = yes; then
+	continue
+      fi
+
+      rmfiles="$file"
+
+      case $name in
+      *.la)
+	# Possibly a libtool archive, so verify it.
+	if func_lalib_p "$file"; then
+	  func_source $dir/$name
+
+	  # Delete the libtool libraries and symlinks.
+	  for n in $library_names; do
+	    func_append rmfiles " $odir/$n"
+	  done
+	  test -n "$old_library" && func_append rmfiles " $odir/$old_library"
+
+	  case "$opt_mode" in
+	  clean)
+	    case " $library_names " in
+	    *" $dlname "*) ;;
+	    *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
+	    esac
+	    test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
+	    ;;
+	  uninstall)
+	    if test -n "$library_names"; then
+	      # Do each command in the postuninstall commands.
+	      func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+	    fi
+
+	    if test -n "$old_library"; then
+	      # Do each command in the old_postuninstall commands.
+	      func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+	    fi
+	    # FIXME: should reinstall the best remaining shared library.
+	    ;;
+	  esac
+	fi
+	;;
+
+      *.lo)
+	# Possibly a libtool object, so verify it.
+	if func_lalib_p "$file"; then
+
+	  # Read the .lo file
+	  func_source $dir/$name
+
+	  # Add PIC object to the list of files to remove.
+	  if test -n "$pic_object" &&
+	     test "$pic_object" != none; then
+	    func_append rmfiles " $dir/$pic_object"
+	  fi
+
+	  # Add non-PIC object to the list of files to remove.
+	  if test -n "$non_pic_object" &&
+	     test "$non_pic_object" != none; then
+	    func_append rmfiles " $dir/$non_pic_object"
+	  fi
+	fi
+	;;
+
+      *)
+	if test "$opt_mode" = clean ; then
+	  noexename=$name
+	  case $file in
+	  *.exe)
+	    func_stripname '' '.exe' "$file"
+	    file=$func_stripname_result
+	    func_stripname '' '.exe' "$name"
+	    noexename=$func_stripname_result
+	    # $file with .exe has already been added to rmfiles,
+	    # add $file without .exe
+	    func_append rmfiles " $file"
+	    ;;
+	  esac
+	  # Do a test to see if this is a libtool program.
+	  if func_ltwrapper_p "$file"; then
+	    if func_ltwrapper_executable_p "$file"; then
+	      func_ltwrapper_scriptname "$file"
+	      relink_command=
+	      func_source $func_ltwrapper_scriptname_result
+	      func_append rmfiles " $func_ltwrapper_scriptname_result"
+	    else
+	      relink_command=
+	      func_source $dir/$noexename
+	    fi
+
+	    # note $name still contains .exe if it was in $file originally
+	    # as does the version of $file that was added into $rmfiles
+	    func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
+	    if test "$fast_install" = yes && test -n "$relink_command"; then
+	      func_append rmfiles " $odir/lt-$name"
+	    fi
+	    if test "X$noexename" != "X$name" ; then
+	      func_append rmfiles " $odir/lt-${noexename}.c"
+	    fi
+	  fi
+	fi
+	;;
+      esac
+      func_show_eval "$RM $rmfiles" 'exit_status=1'
+    done
+
+    # Try to remove the ${objdir}s in the directories where we deleted files
+    for dir in $rmdirs; do
+      if test -d "$dir"; then
+	func_show_eval "rmdir $dir >/dev/null 2>&1"
+      fi
+    done
+
+    exit $exit_status
+}
+
+{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
+    func_mode_uninstall ${1+"$@"}
+
+test -z "$opt_mode" && {
+  help="$generic_help"
+  func_fatal_help "you must specify a MODE"
+}
+
+test -z "$exec_cmd" && \
+  func_fatal_help "invalid operation mode \`$opt_mode'"
+
+if test -n "$exec_cmd"; then
+  eval exec "$exec_cmd"
+  exit $EXIT_FAILURE
+fi
+
+exit $exit_status
+
+
+# The TAGs below are defined such that we never get into a situation
+# in which we disable both kinds of libraries.  Given conflicting
+# choices, we go for a static library, that is the most portable,
+# since we can't tell whether shared libraries were disabled because
+# the user asked for that or because the platform doesn't support
+# them.  This is particularly important on AIX, because we don't
+# support having both static and shared libraries enabled at the same
+# time on that platform, so we default to a shared-only configuration.
+# If a disable-shared tag is given, we'll fallback to a static-only
+# configuration.  But we'll never go from static-only to shared-only.
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
+build_libtool_libs=no
+build_old_libs=yes
+# ### END LIBTOOL TAG CONFIG: disable-shared
+
+# ### BEGIN LIBTOOL TAG CONFIG: disable-static
+build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+# ### END LIBTOOL TAG CONFIG: disable-static
+
+# Local Variables:
+# mode:shell-script
+# sh-indentation:2
+# End:
+# vi:sw=2
+
diff --git a/build-aux/missing b/build-aux/missing
new file mode 100755
index 0000000..ac3d51c
--- /dev/null
+++ b/build-aux/missing
@@ -0,0 +1,378 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2009-04-28.21; # UTC
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
+# 2008, 2009 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
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU 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.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try \`$0 --help' for more information"
+  exit 1
+fi
+
+run=:
+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+  configure_ac=configure.ac
+else
+  configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case $1 in
+--run)
+  # Try to run requested program, and just exit if it succeeds.
+  run=
+  shift
+  "$@" && exit 0
+  # Exit code 63 means version mismatch.  This often happens
+  # when the user try to use an ancient version of a tool on
+  # a file that requires a minimum version.  In this case we
+  # we should proceed has if the program had been absent, or
+  # if --run hadn't been passed.
+  if test $? = 63; then
+    run=:
+    msg="probably too old"
+  fi
+  ;;
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+  --run           try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+  aclocal      touch file \`aclocal.m4'
+  autoconf     touch file \`configure'
+  autoheader   touch file \`config.h.in'
+  autom4te     touch the output file, or create a stub one
+  automake     touch all \`Makefile.in' files
+  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
+  flex         create \`lex.yy.c', if possible, from existing .c
+  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
+\`g' are ignored when checking the name.
+
+Send bug reports to <bug-automake at gnu.org>."
+    exit $?
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing $scriptversion (GNU Automake)"
+    exit $?
+    ;;
+
+  -*)
+    echo 1>&2 "$0: Unknown \`$1' option"
+    echo 1>&2 "Try \`$0 --help' for more information"
+    exit 1
+    ;;
+
+esac
+
+# normalize program name to check for.
+program=`echo "$1" | sed '
+  s/^gnu-//; t
+  s/^gnu//; t
+  s/^g//; t'`
+
+# Now exit if we have it, but it failed.  Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).  This is about non-GNU programs, so use $1 not
+# $program.
+case $1 in
+  lex*|yacc*)
+    # 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.
+       exit 1
+    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+       # Could not run --version or --help.  This is probably someone
+       # running `$TOOL --version' or `$TOOL --help' to check whether
+       # $TOOL exists and not knowing $TOOL uses missing.
+       exit 1
+    fi
+    ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case $program in
+  aclocal*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
+         to install the \`Automake' and \`Perl' packages.  Grab them from
+         any GNU archive site."
+    touch aclocal.m4
+    ;;
+
+  autoconf*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`${configure_ac}'.  You might want to install the
+         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
+         archive site."
+    touch configure
+    ;;
+
+  autoheader*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
+         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
+         from any GNU archive site."
+    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+    test -z "$files" && files="config.h"
+    touch_files=
+    for f in $files; do
+      case $f in
+      *:*) touch_files="$touch_files "`echo "$f" |
+				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+      *) touch_files="$touch_files $f.in";;
+      esac
+    done
+    touch $touch_files
+    ;;
+
+  automake*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+         You might want to install the \`Automake' and \`Perl' packages.
+         Grab them from any GNU archive site."
+    find . -type f -name Makefile.am -print |
+	   sed 's/\.am$/.in/' |
+	   while read f; do touch "$f"; done
+    ;;
+
+  autom4te*)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+         You might have modified some files without having the
+         proper tools for further handling them.
+         You can get \`$1' as part of \`Autoconf' from any GNU
+         archive site."
+
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+    if test -f "$file"; then
+	touch $file
+    else
+	test -z "$file" || exec >$file
+	echo "#! /bin/sh"
+	echo "# Created by GNU Automake missing as a replacement of"
+	echo "#  $ $@"
+	echo "exit 0"
+	chmod +x $file
+	exit 1
+    fi
+    ;;
+
+  bison*|yacc*)
+    echo 1>&2 "\
+WARNING: \`$1' $msg.  You should only need it if
+         you modified a \`.y' file.  You may need the \`Bison' package
+         in order for those modifications to take effect.  You can get
+         \`Bison' from any GNU archive site."
+    rm -f y.tab.c y.tab.h
+    if test $# -ne 1; then
+        eval LASTARG="\${$#}"
+	case $LASTARG in
+	*.y)
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+	    if test -f "$SRCFILE"; then
+	         cp "$SRCFILE" y.tab.c
+	    fi
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+	    if test -f "$SRCFILE"; then
+	         cp "$SRCFILE" y.tab.h
+	    fi
+	  ;;
+	esac
+    fi
+    if test ! -f y.tab.h; then
+	echo >y.tab.h
+    fi
+    if test ! -f y.tab.c; then
+	echo 'main() { return 0; }' >y.tab.c
+    fi
+    ;;
+
+  lex*|flex*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.l' file.  You may need the \`Flex' package
+         in order for those modifications to take effect.  You can get
+         \`Flex' from any GNU archive site."
+    rm -f lex.yy.c
+    if test $# -ne 1; then
+        eval LASTARG="\${$#}"
+	case $LASTARG in
+	*.l)
+	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+	    if test -f "$SRCFILE"; then
+	         cp "$SRCFILE" lex.yy.c
+	    fi
+	  ;;
+	esac
+    fi
+    if test ! -f lex.yy.c; then
+	echo 'main() { return 0; }' >lex.yy.c
+    fi
+    ;;
+
+  help2man*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+	 you modified a dependency of a manual page.  You may need the
+	 \`Help2man' package in order for those modifications to take
+	 effect.  You can get \`Help2man' from any GNU archive site."
+
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+    if test -f "$file"; then
+	touch $file
+    else
+	test -z "$file" || exec >$file
+	echo ".ab help2man is required to generate this page"
+	exit $?
+    fi
+    ;;
+
+  makeinfo*)
+    echo 1>&2 "\
+WARNING: \`$1' is $msg.  You should only need it if
+         you modified a \`.texi' or \`.texinfo' file, or any other file
+         indirectly affecting the aspect of the manual.  The spurious
+         call might also be the consequence of using a buggy \`make' (AIX,
+         DU, IRIX).  You might want to install the \`Texinfo' package or
+         the \`GNU make' package.  Grab either from any GNU archive site."
+    # The file to touch is that specified with -o ...
+    file=`echo "$*" | sed -n "$sed_output"`
+    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+    if test -z "$file"; then
+      # ... or it is the one specified with @setfilename ...
+      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '
+	/^@setfilename/{
+	  s/.* \([^ ]*\) *$/\1/
+	  p
+	  q
+	}' $infile`
+      # ... or it is derived from the source name (dir/f.texi becomes f.info)
+      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+    fi
+    # If the file does not exist, the user really needs makeinfo;
+    # let's fail without touching anything.
+    test -f $file || exit 1
+    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.
+         You might have modified some files without having the
+         proper tools for further handling them.  Check the \`README' file,
+         it often tells you about the needed prerequisites for installing
+         this package.  You may also peek at any GNU archive site, in case
+         some other package would contain this missing \`$1' program."
+    exit 1
+    ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/config.guess b/config.guess
deleted file mode 100755
index 278f9e9..0000000
--- a/config.guess
+++ /dev/null
@@ -1,1516 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
-#   Inc.
-
-timestamp='2007-07-22'
-
-# 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
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# 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.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Originally written by Per Bothner <per at bothner.com>.
-# Please send patches to <config-patches at gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# This script attempts to guess a canonical system name similar to
-# config.sub.  If it succeeds, it prints the system name on stdout, and
-# exits with 0.  Otherwise, it exits with 1.
-#
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit build system type.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION]
-
-Output the configuration name of the system \`$me' is run on.
-
-Operation modes:
-  -h, --help         print this help, then exit
-  -t, --time-stamp   print date of last modification, then exit
-  -v, --version      print version number, then exit
-
-Report bugs and patches to <config-patches at gnu.org>."
-
-version="\
-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
-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."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
-  case $1 in
-    --time-stamp | --time* | -t )
-       echo "$timestamp" ; exit ;;
-    --version | -v )
-       echo "$version" ; exit ;;
-    --help | --h* | -h )
-       echo "$usage"; exit ;;
-    -- )     # Stop option processing
-       shift; break ;;
-    - )	# Use stdin as input.
-       break ;;
-    -* )
-       echo "$me: invalid option $1$help" >&2
-       exit 1 ;;
-    * )
-       break ;;
-  esac
-done
-
-if test $# != 0; then
-  echo "$me: too many arguments$help" >&2
-  exit 1
-fi
-
-trap 'exit 1' 1 2 15
-
-# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
-# compiler to aid in system detection is discouraged as it requires
-# temporary files to be created and, as you can see below, it is a
-# headache to deal with in a portable fashion.
-
-# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
-# use `HOST_CC' if defined, but it is deprecated.
-
-# Portable tmp directory creation inspired by the Autoconf team.
-
-set_cc_for_build='
-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
-: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
-dummy=$tmp/dummy ;
-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,)    echo "int x;" > $dummy.c ;
-	for c in cc gcc c89 c99 ; do
-	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
-	     CC_FOR_BUILD="$c"; break ;
-	  fi ;
-	done ;
-	if test x"$CC_FOR_BUILD" = x ; then
-	  CC_FOR_BUILD=no_compiler_found ;
-	fi
-	;;
- ,,*)   CC_FOR_BUILD=$CC ;;
- ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
-esac ; set_cc_for_build= ;'
-
-# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi at noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
-	PATH=$PATH:/.attbin ; export PATH
-fi
-
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-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
-
-# 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*,
-	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
-	# switched to ELF, *-*-netbsd* would select the old
-	# object file format.  This provides both forward
-	# compatibility and a consistent mechanism for selecting the
-	# object file format.
-	#
-	# Note: NetBSD doesn't particularly care about the vendor
-	# portion of the name.  We always set it to "unknown".
-	sysctl="sysctl -n hw.machine_arch"
-	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
-	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
-	case "${UNAME_MACHINE_ARCH}" in
-	    armeb) machine=armeb-unknown ;;
-	    arm*) machine=arm-unknown ;;
-	    sh3el) machine=shl-unknown ;;
-	    sh3eb) machine=sh-unknown ;;
-	    sh5el) machine=sh5le-unknown ;;
-	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
-	esac
-	# The Operating System including object format, if it has switched
-	# to ELF recently, or will in the future.
-	case "${UNAME_MACHINE_ARCH}" in
-	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
-		eval $set_cc_for_build
-		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
-			| grep __ELF__ >/dev/null
-		then
-		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
-		    # Return netbsd for either.  FIX?
-		    os=netbsd
-		else
-		    os=netbsdelf
-		fi
-		;;
-	    *)
-	        os=netbsd
-		;;
-	esac
-	# The OS release
-	# Debian GNU/NetBSD machines have a different userland, and
-	# thus, need a distinct triplet. However, they do not need
-	# kernel version information, so it can be replaced with a
-	# suitable tag, in the style of linux-gnu.
-	case "${UNAME_VERSION}" in
-	    Debian*)
-		release='-gnu'
-		;;
-	    *)
-		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
-		;;
-	esac
-	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
-	# contains redundant information, the shorter form:
-	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
-	echo "${machine}-${os}${release}"
-	exit ;;
-    *:OpenBSD:*:*)
-	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
-	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
-	exit ;;
-    *:ekkoBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
-	exit ;;
-    *:SolidBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
-	exit ;;
-    macppc:MirBSD:*:*)
-	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
-	exit ;;
-    *:MirBSD:*:*)
-	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
-	exit ;;
-    alpha:OSF1:*:*)
-	case $UNAME_RELEASE in
-	*4.0)
-		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
-		;;
-	*5.*)
-	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
-		;;
-	esac
-	# According to Compaq, /usr/sbin/psrinfo has been available on
-	# OSF/1 and Tru64 systems produced since 1995.  I hope that
-	# covers most systems running today.  This code pipes the CPU
-	# types through head -n 1, so we only detect the type of CPU 0.
-	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
-	case "$ALPHA_CPU_TYPE" in
-	    "EV4 (21064)")
-		UNAME_MACHINE="alpha" ;;
-	    "EV4.5 (21064)")
-		UNAME_MACHINE="alpha" ;;
-	    "LCA4 (21066/21068)")
-		UNAME_MACHINE="alpha" ;;
-	    "EV5 (21164)")
-		UNAME_MACHINE="alphaev5" ;;
-	    "EV5.6 (21164A)")
-		UNAME_MACHINE="alphaev56" ;;
-	    "EV5.6 (21164PC)")
-		UNAME_MACHINE="alphapca56" ;;
-	    "EV5.7 (21164PC)")
-		UNAME_MACHINE="alphapca57" ;;
-	    "EV6 (21264)")
-		UNAME_MACHINE="alphaev6" ;;
-	    "EV6.7 (21264A)")
-		UNAME_MACHINE="alphaev67" ;;
-	    "EV6.8CB (21264C)")
-		UNAME_MACHINE="alphaev68" ;;
-	    "EV6.8AL (21264B)")
-		UNAME_MACHINE="alphaev68" ;;
-	    "EV6.8CX (21264D)")
-		UNAME_MACHINE="alphaev68" ;;
-	    "EV6.9A (21264/EV69A)")
-		UNAME_MACHINE="alphaev69" ;;
-	    "EV7 (21364)")
-		UNAME_MACHINE="alphaev7" ;;
-	    "EV7.9 (21364A)")
-		UNAME_MACHINE="alphaev79" ;;
-	esac
-	# A Pn.n version is a patched version.
-	# A Vn.n version is a released version.
-	# A Tn.n version is a released field test version.
-	# A Xn.n version is an unreleased experimental baselevel.
-	# 1.2 uses "1.2" for uname -r.
-	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-	exit ;;
-    Alpha\ *:Windows_NT*:*)
-	# How do we know it's Interix rather than the generic POSIX subsystem?
-	# Should we change UNAME_MACHINE based on the output of uname instead
-	# of the specific Alpha model?
-	echo alpha-pc-interix
-	exit ;;
-    21064:Windows_NT:50:3)
-	echo alpha-dec-winnt3.5
-	exit ;;
-    Amiga*:UNIX_System_V:4.0:*)
-	echo m68k-unknown-sysv4
-	exit ;;
-    *:[Aa]miga[Oo][Ss]:*:*)
-	echo ${UNAME_MACHINE}-unknown-amigaos
-	exit ;;
-    *:[Mm]orph[Oo][Ss]:*:*)
-	echo ${UNAME_MACHINE}-unknown-morphos
-	exit ;;
-    *:OS/390:*:*)
-	echo i370-ibm-openedition
-	exit ;;
-    *:z/VM:*:*)
-	echo s390-ibm-zvmoe
-	exit ;;
-    *:OS400:*:*)
-        echo powerpc-ibm-os400
-	exit ;;
-    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
-	echo arm-acorn-riscix${UNAME_RELEASE}
-	exit ;;
-    arm:riscos:*:*|arm:RISCOS:*:*)
-	echo arm-unknown-riscos
-	exit ;;
-    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
-	echo hppa1.1-hitachi-hiuxmpp
-	exit ;;
-    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
-	# akee at wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
-	if test "`(/bin/universe) 2>/dev/null`" = att ; then
-		echo pyramid-pyramid-sysv3
-	else
-		echo pyramid-pyramid-bsd
-	fi
-	exit ;;
-    NILE*:*:*:dcosx)
-	echo pyramid-pyramid-svr4
-	exit ;;
-    DRS?6000:unix:4.0:6*)
-	echo sparc-icl-nx6
-	exit ;;
-    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
-	case `/usr/bin/uname -p` in
-	    sparc) echo sparc-icl-nx7; exit ;;
-	esac ;;
-    sun4H:SunOS:5.*:*)
-	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit ;;
-    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
-	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit ;;
-    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
-	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit ;;
-    sun4*:SunOS:6*:*)
-	# According to config.sub, this is the proper way to canonicalize
-	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
-	# it's likely to be more like Solaris than SunOS4.
-	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit ;;
-    sun4*:SunOS:*:*)
-	case "`/usr/bin/arch -k`" in
-	    Series*|S4*)
-		UNAME_RELEASE=`uname -v`
-		;;
-	esac
-	# Japanese Language versions have a version number like `4.1.3-JL'.
-	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
-	exit ;;
-    sun3*:SunOS:*:*)
-	echo m68k-sun-sunos${UNAME_RELEASE}
-	exit ;;
-    sun*:*:4.2BSD:*)
-	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
-	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
-	case "`/bin/arch`" in
-	    sun3)
-		echo m68k-sun-sunos${UNAME_RELEASE}
-		;;
-	    sun4)
-		echo sparc-sun-sunos${UNAME_RELEASE}
-		;;
-	esac
-	exit ;;
-    aushp:SunOS:*:*)
-	echo sparc-auspex-sunos${UNAME_RELEASE}
-	exit ;;
-    # The situation for MiNT is a little confusing.  The machine name
-    # can be virtually everything (everything which is not
-    # "atarist" or "atariste" at least should have a processor
-    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
-    # to the lowercase version "mint" (or "freemint").  Finally
-    # the system name "TOS" denotes a system which is actually not
-    # MiNT.  But MiNT is downward compatible to TOS, so this should
-    # be no problem.
-    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
-	exit ;;
-    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
-	echo m68k-atari-mint${UNAME_RELEASE}
-        exit ;;
-    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
-	exit ;;
-    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
-        echo m68k-milan-mint${UNAME_RELEASE}
-        exit ;;
-    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
-        echo m68k-hades-mint${UNAME_RELEASE}
-        exit ;;
-    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-        echo m68k-unknown-mint${UNAME_RELEASE}
-        exit ;;
-    m68k:machten:*:*)
-	echo m68k-apple-machten${UNAME_RELEASE}
-	exit ;;
-    powerpc:machten:*:*)
-	echo powerpc-apple-machten${UNAME_RELEASE}
-	exit ;;
-    RISC*:Mach:*:*)
-	echo mips-dec-mach_bsd4.3
-	exit ;;
-    RISC*:ULTRIX:*:*)
-	echo mips-dec-ultrix${UNAME_RELEASE}
-	exit ;;
-    VAX*:ULTRIX*:*:*)
-	echo vax-dec-ultrix${UNAME_RELEASE}
-	exit ;;
-    2020:CLIX:*:* | 2430:CLIX:*:*)
-	echo clipper-intergraph-clix${UNAME_RELEASE}
-	exit ;;
-    mips:*:*:UMIPS | mips:*:*:RISCos)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-#ifdef __cplusplus
-#include <stdio.h>  /* for printf() prototype */
-	int main (int argc, char *argv[]) {
-#else
-	int main (argc, argv) int argc; char *argv[]; {
-#endif
-	#if defined (host_mips) && defined (MIPSEB)
-	#if defined (SYSTYPE_SYSV)
-	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
-	#endif
-	#if defined (SYSTYPE_SVR4)
-	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
-	#endif
-	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
-	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
-	#endif
-	#endif
-	  exit (-1);
-	}
-EOF
-	$CC_FOR_BUILD -o $dummy $dummy.c &&
-	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
-	  SYSTEM_NAME=`$dummy $dummyarg` &&
-	    { echo "$SYSTEM_NAME"; exit; }
-	echo mips-mips-riscos${UNAME_RELEASE}
-	exit ;;
-    Motorola:PowerMAX_OS:*:*)
-	echo powerpc-motorola-powermax
-	exit ;;
-    Motorola:*:4.3:PL8-*)
-	echo powerpc-harris-powermax
-	exit ;;
-    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
-	echo powerpc-harris-powermax
-	exit ;;
-    Night_Hawk:Power_UNIX:*:*)
-	echo powerpc-harris-powerunix
-	exit ;;
-    m88k:CX/UX:7*:*)
-	echo m88k-harris-cxux7
-	exit ;;
-    m88k:*:4*:R4*)
-	echo m88k-motorola-sysv4
-	exit ;;
-    m88k:*:3*:R3*)
-	echo m88k-motorola-sysv3
-	exit ;;
-    AViiON:dgux:*:*)
-        # DG/UX returns AViiON for all architectures
-        UNAME_PROCESSOR=`/usr/bin/uname -p`
-	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
-	then
-	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
-	       [ ${TARGET_BINARY_INTERFACE}x = x ]
-	    then
-		echo m88k-dg-dgux${UNAME_RELEASE}
-	    else
-		echo m88k-dg-dguxbcs${UNAME_RELEASE}
-	    fi
-	else
-	    echo i586-dg-dgux${UNAME_RELEASE}
-	fi
- 	exit ;;
-    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
-	echo m88k-dolphin-sysv3
-	exit ;;
-    M88*:*:R3*:*)
-	# Delta 88k system running SVR3
-	echo m88k-motorola-sysv3
-	exit ;;
-    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
-	echo m88k-tektronix-sysv3
-	exit ;;
-    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
-	echo m68k-tektronix-bsd
-	exit ;;
-    *:IRIX*:*:*)
-	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
-	exit ;;
-    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
-	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
-	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
-    i*86:AIX:*:*)
-	echo i386-ibm-aix
-	exit ;;
-    ia64:AIX:*:*)
-	if [ -x /usr/bin/oslevel ] ; then
-		IBM_REV=`/usr/bin/oslevel`
-	else
-		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
-	fi
-	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
-	exit ;;
-    *:AIX:2:3)
-	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
-		eval $set_cc_for_build
-		sed 's/^		//' << EOF >$dummy.c
-		#include <sys/systemcfg.h>
-
-		main()
-			{
-			if (!__power_pc())
-				exit(1);
-			puts("powerpc-ibm-aix3.2.5");
-			exit(0);
-			}
-EOF
-		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
-		then
-			echo "$SYSTEM_NAME"
-		else
-			echo rs6000-ibm-aix3.2.5
-		fi
-	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
-		echo rs6000-ibm-aix3.2.4
-	else
-		echo rs6000-ibm-aix3.2
-	fi
-	exit ;;
-    *:AIX:*:[45])
-	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
-	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
-		IBM_ARCH=rs6000
-	else
-		IBM_ARCH=powerpc
-	fi
-	if [ -x /usr/bin/oslevel ] ; then
-		IBM_REV=`/usr/bin/oslevel`
-	else
-		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
-	fi
-	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
-	exit ;;
-    *:AIX:*:*)
-	echo rs6000-ibm-aix
-	exit ;;
-    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
-	echo romp-ibm-bsd4.4
-	exit ;;
-    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
-	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
-	exit ;;                             # report: romp-ibm BSD 4.3
-    *:BOSX:*:*)
-	echo rs6000-bull-bosx
-	exit ;;
-    DPX/2?00:B.O.S.:*:*)
-	echo m68k-bull-sysv3
-	exit ;;
-    9000/[34]??:4.3bsd:1.*:*)
-	echo m68k-hp-bsd
-	exit ;;
-    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
-	echo m68k-hp-bsd4.4
-	exit ;;
-    9000/[34678]??:HP-UX:*:*)
-	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-	case "${UNAME_MACHINE}" in
-	    9000/31? )            HP_ARCH=m68000 ;;
-	    9000/[34]?? )         HP_ARCH=m68k ;;
-	    9000/[678][0-9][0-9])
-		if [ -x /usr/bin/getconf ]; then
-		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
-                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
-                    case "${sc_cpu_version}" in
-                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
-                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
-                      532)                      # CPU_PA_RISC2_0
-                        case "${sc_kernel_bits}" in
-                          32) HP_ARCH="hppa2.0n" ;;
-                          64) HP_ARCH="hppa2.0w" ;;
-			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
-                        esac ;;
-                    esac
-		fi
-		if [ "${HP_ARCH}" = "" ]; then
-		    eval $set_cc_for_build
-		    sed 's/^              //' << EOF >$dummy.c
-
-              #define _HPUX_SOURCE
-              #include <stdlib.h>
-              #include <unistd.h>
-
-              int main ()
-              {
-              #if defined(_SC_KERNEL_BITS)
-                  long bits = sysconf(_SC_KERNEL_BITS);
-              #endif
-                  long cpu  = sysconf (_SC_CPU_VERSION);
-
-                  switch (cpu)
-              	{
-              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
-              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
-              	case CPU_PA_RISC2_0:
-              #if defined(_SC_KERNEL_BITS)
-              	    switch (bits)
-              		{
-              		case 64: puts ("hppa2.0w"); break;
-              		case 32: puts ("hppa2.0n"); break;
-              		default: puts ("hppa2.0"); break;
-              		} break;
-              #else  /* !defined(_SC_KERNEL_BITS) */
-              	    puts ("hppa2.0"); break;
-              #endif
-              	default: puts ("hppa1.0"); break;
-              	}
-                  exit (0);
-              }
-EOF
-		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
-		    test -z "$HP_ARCH" && HP_ARCH=hppa
-		fi ;;
-	esac
-	if [ ${HP_ARCH} = "hppa2.0w" ]
-	then
-	    eval $set_cc_for_build
-
-	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
-	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
-	    # generating 64-bit code.  GNU and HP use different nomenclature:
-	    #
-	    # $ CC_FOR_BUILD=cc ./config.guess
-	    # => hppa2.0w-hp-hpux11.23
-	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
-	    # => hppa64-hp-hpux11.23
-
-	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
-		grep __LP64__ >/dev/null
-	    then
-		HP_ARCH="hppa2.0w"
-	    else
-		HP_ARCH="hppa64"
-	    fi
-	fi
-	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
-	exit ;;
-    ia64:HP-UX:*:*)
-	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-	echo ia64-hp-hpux${HPUX_REV}
-	exit ;;
-    3050*:HI-UX:*:*)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#include <unistd.h>
-	int
-	main ()
-	{
-	  long cpu = sysconf (_SC_CPU_VERSION);
-	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
-	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
-	     results, however.  */
-	  if (CPU_IS_PA_RISC (cpu))
-	    {
-	      switch (cpu)
-		{
-		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
-		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
-		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
-		  default: puts ("hppa-hitachi-hiuxwe2"); break;
-		}
-	    }
-	  else if (CPU_IS_HP_MC68K (cpu))
-	    puts ("m68k-hitachi-hiuxwe2");
-	  else puts ("unknown-hitachi-hiuxwe2");
-	  exit (0);
-	}
-EOF
-	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
-		{ echo "$SYSTEM_NAME"; exit; }
-	echo unknown-hitachi-hiuxwe2
-	exit ;;
-    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
-	echo hppa1.1-hp-bsd
-	exit ;;
-    9000/8??:4.3bsd:*:*)
-	echo hppa1.0-hp-bsd
-	exit ;;
-    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
-	echo hppa1.0-hp-mpeix
-	exit ;;
-    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
-	echo hppa1.1-hp-osf
-	exit ;;
-    hp8??:OSF1:*:*)
-	echo hppa1.0-hp-osf
-	exit ;;
-    i*86:OSF1:*:*)
-	if [ -x /usr/sbin/sysversion ] ; then
-	    echo ${UNAME_MACHINE}-unknown-osf1mk
-	else
-	    echo ${UNAME_MACHINE}-unknown-osf1
-	fi
-	exit ;;
-    parisc*:Lites*:*:*)
-	echo hppa1.1-hp-lites
-	exit ;;
-    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
-	echo c1-convex-bsd
-        exit ;;
-    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
-	if getsysinfo -f scalar_acc
-	then echo c32-convex-bsd
-	else echo c2-convex-bsd
-	fi
-        exit ;;
-    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
-	echo c34-convex-bsd
-        exit ;;
-    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
-	echo c38-convex-bsd
-        exit ;;
-    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
-	echo c4-convex-bsd
-        exit ;;
-    CRAY*Y-MP:*:*:*)
-	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
-    CRAY*[A-Z]90:*:*:*)
-	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
-	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
-	      -e 's/\.[^.]*$/.X/'
-	exit ;;
-    CRAY*TS:*:*:*)
-	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
-    CRAY*T3E:*:*:*)
-	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
-    CRAY*SV1:*:*:*)
-	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
-    *:UNICOS/mp:*:*)
-	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-	exit ;;
-    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
-	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
-        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-        exit ;;
-    5000:UNIX_System_V:4.*:*)
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
-        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-	exit ;;
-    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
-	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
-	exit ;;
-    sparc*:BSD/OS:*:*)
-	echo sparc-unknown-bsdi${UNAME_RELEASE}
-	exit ;;
-    *:BSD/OS:*:*)
-	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
-	exit ;;
-    *:FreeBSD:*:*)
-	case ${UNAME_MACHINE} in
-	    pc98)
-		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
-	    amd64)
-		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
-	    *)
-		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
-	esac
-	exit ;;
-    i*:CYGWIN*:*)
-	echo ${UNAME_MACHINE}-pc-cygwin
-	exit ;;
-    *:MINGW*:*)
-	echo ${UNAME_MACHINE}-pc-mingw32
-	exit ;;
-    i*:windows32*:*)
-    	# uname -m includes "-pc" on this system.
-    	echo ${UNAME_MACHINE}-mingw32
-	exit ;;
-    i*:PW*:*)
-	echo ${UNAME_MACHINE}-pc-pw32
-	exit ;;
-    *:Interix*:[3456]*)
-    	case ${UNAME_MACHINE} in
-	    x86)
-		echo i586-pc-interix${UNAME_RELEASE}
-		exit ;;
-	    EM64T | authenticamd)
-		echo x86_64-unknown-interix${UNAME_RELEASE}
-		exit ;;
-	esac ;;
-    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
-	echo i${UNAME_MACHINE}-pc-mks
-	exit ;;
-    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
-	# How do we know it's Interix rather than the generic POSIX subsystem?
-	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
-	# UNAME_MACHINE based on the output of uname instead of i386?
-	echo i586-pc-interix
-	exit ;;
-    i*:UWIN*:*)
-	echo ${UNAME_MACHINE}-pc-uwin
-	exit ;;
-    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
-	echo x86_64-unknown-cygwin
-	exit ;;
-    p*:CYGWIN*:*)
-	echo powerpcle-unknown-cygwin
-	exit ;;
-    prep*:SunOS:5.*:*)
-	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-	exit ;;
-    *:GNU:*:*)
-	# the GNU system
-	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`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
-	exit ;;
-    i*86:Minix:*:*)
-	echo ${UNAME_MACHINE}-pc-minix
-	exit ;;
-    arm*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    avr32*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    cris:Linux:*:*)
-	echo cris-axis-linux-gnu
-	exit ;;
-    crisv32:Linux:*:*)
-	echo crisv32-axis-linux-gnu
-	exit ;;
-    frv:Linux:*:*)
-    	echo frv-unknown-linux-gnu
-	exit ;;
-    ia64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    m32r*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    m68*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    mips:Linux:*:*)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#undef CPU
-	#undef mips
-	#undef mipsel
-	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-	CPU=mipsel
-	#else
-	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-	CPU=mips
-	#else
-	CPU=
-	#endif
-	#endif
-EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^CPU/{
-		s: ::g
-		p
-	    }'`"
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
-	;;
-    mips64:Linux:*:*)
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#undef CPU
-	#undef mips64
-	#undef mips64el
-	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-	CPU=mips64el
-	#else
-	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-	CPU=mips64
-	#else
-	CPU=
-	#endif
-	#endif
-EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^CPU/{
-		s: ::g
-		p
-	    }'`"
-	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
-	;;
-    or32:Linux:*:*)
-	echo or32-unknown-linux-gnu
-	exit ;;
-    ppc:Linux:*:*)
-	echo powerpc-unknown-linux-gnu
-	exit ;;
-    ppc64:Linux:*:*)
-	echo powerpc64-unknown-linux-gnu
-	exit ;;
-    alpha:Linux:*:*)
-	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
-	  EV5)   UNAME_MACHINE=alphaev5 ;;
-	  EV56)  UNAME_MACHINE=alphaev56 ;;
-	  PCA56) UNAME_MACHINE=alphapca56 ;;
-	  PCA57) UNAME_MACHINE=alphapca56 ;;
-	  EV6)   UNAME_MACHINE=alphaev6 ;;
-	  EV67)  UNAME_MACHINE=alphaev67 ;;
-	  EV68*) UNAME_MACHINE=alphaev68 ;;
-        esac
-	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
-	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
-	echo ${UNAME_MACHINE}-unknown-linux-gnu${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 ;;
-	esac
-	exit ;;
-    parisc64:Linux:*:* | hppa64:Linux:*:*)
-	echo hppa64-unknown-linux-gnu
-	exit ;;
-    s390:Linux:*:* | s390x:Linux:*:*)
-	echo ${UNAME_MACHINE}-ibm-linux
-	exit ;;
-    sh64*:Linux:*:*)
-    	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    sh*:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    sparc:Linux:*:* | sparc64:Linux:*:*)
-	echo ${UNAME_MACHINE}-unknown-linux-gnu
-	exit ;;
-    vax:Linux:*:*)
-	echo ${UNAME_MACHINE}-dec-linux-gnu
-	exit ;;
-    x86_64:Linux:*:*)
-	echo x86_64-unknown-linux-gnu
-	exit ;;
-    xtensa:Linux:*:*)
-    	echo xtensa-unknown-linux-gnu
-	exit ;;
-    i*86:Linux:*:*)
-	# The BFD linker knows what the default object file format is, so
-	# first see if it will tell us. cd to the root directory to prevent
-	# problems with other programs or directories called `ld' in the path.
-	# Set LC_ALL=C to ensure ld outputs messages in English.
-	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
-			 | sed -ne '/supported targets:/!d
-				    s/[ 	][ 	]*/ /g
-				    s/.*supported targets: *//
-				    s/ .*//
-				    p'`
-        case "$ld_supported_targets" in
-	  elf32-i386)
-		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
-		;;
-	  a.out-i386-linux)
-		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
-		exit ;;
-	  coff-i386)
-		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
-		exit ;;
-	  "")
-		# Either a pre-BFD a.out linker (linux-gnuoldld) or
-		# one that does not give us useful --help.
-		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
-		exit ;;
-	esac
-	# Determine whether the default compiler is a.out or elf
-	eval $set_cc_for_build
-	sed 's/^	//' << EOF >$dummy.c
-	#include <features.h>
-	#ifdef __ELF__
-	# ifdef __GLIBC__
-	#  if __GLIBC__ >= 2
-	LIBC=gnu
-	#  else
-	LIBC=gnulibc1
-	#  endif
-	# else
-	LIBC=gnulibc1
-	# endif
-	#else
-	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
-	LIBC=gnu
-	#else
-	LIBC=gnuaout
-	#endif
-	#endif
-	#ifdef __dietlibc__
-	LIBC=dietlibc
-	#endif
-EOF
-	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-	    /^LIBC/{
-		s: ::g
-		p
-	    }'`"
-	test x"${LIBC}" != x && {
-		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
-		exit
-	}
-	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
-	;;
-    i*86:DYNIX/ptx:4*:*)
-	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
-	# earlier versions are messed up and put the nodename in both
-	# sysname and nodename.
-	echo i386-sequent-sysv4
-	exit ;;
-    i*86:UNIX_SV:4.2MP:2.*)
-        # Unixware is an offshoot of SVR4, but it has its own version
-        # number series starting with 2...
-        # I am not positive that other SVR4 systems won't match this,
-	# I just have to hope.  -- rms.
-        # Use sysv4.2uw... so that sysv4* matches it.
-	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
-	exit ;;
-    i*86:OS/2:*:*)
-	# If we were able to find `uname', then EMX Unix compatibility
-	# is probably installed.
-	echo ${UNAME_MACHINE}-pc-os2-emx
-	exit ;;
-    i*86:XTS-300:*:STOP)
-	echo ${UNAME_MACHINE}-unknown-stop
-	exit ;;
-    i*86:atheos:*:*)
-	echo ${UNAME_MACHINE}-unknown-atheos
-	exit ;;
-    i*86:syllable:*:*)
-	echo ${UNAME_MACHINE}-pc-syllable
-	exit ;;
-    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
-	echo i386-unknown-lynxos${UNAME_RELEASE}
-	exit ;;
-    i*86:*DOS:*:*)
-	echo ${UNAME_MACHINE}-pc-msdosdjgpp
-	exit ;;
-    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
-	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
-	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
-		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
-	else
-		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
-	fi
-	exit ;;
-    i*86:*:5:[678]*)
-    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
-	case `/bin/uname -X | grep "^Machine"` in
-	    *486*)	     UNAME_MACHINE=i486 ;;
-	    *Pentium)	     UNAME_MACHINE=i586 ;;
-	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
-	esac
-	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
-	exit ;;
-    i*86:*:3.2:*)
-	if test -f /usr/options/cb.name; then
-		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
-		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
-	elif /bin/uname -X 2>/dev/null >/dev/null ; then
-		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
-		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
-		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
-			&& UNAME_MACHINE=i586
-		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
-			&& UNAME_MACHINE=i686
-		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
-			&& UNAME_MACHINE=i686
-		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
-	else
-		echo ${UNAME_MACHINE}-pc-sysv32
-	fi
-	exit ;;
-    pc:*:*:*)
-	# Left here for compatibility:
-        # uname -m prints for DJGPP always 'pc', but it prints nothing about
-        # the processor, so we play safe by assuming i386.
-	echo i386-pc-msdosdjgpp
-        exit ;;
-    Intel:Mach:3*:*)
-	echo i386-pc-mach3
-	exit ;;
-    paragon:*:*:*)
-	echo i860-intel-osf1
-	exit ;;
-    i860:*:4.*:*) # i860-SVR4
-	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
-	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
-	else # Add other i860-SVR4 vendors below as they are discovered.
-	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
-	fi
-	exit ;;
-    mini*:CTIX:SYS*5:*)
-	# "miniframe"
-	echo m68010-convergent-sysv
-	exit ;;
-    mc68k:UNIX:SYSTEM5:3.51m)
-	echo m68k-convergent-sysv
-	exit ;;
-    M680?0:D-NIX:5.3:*)
-	echo m68k-diab-dnix
-	exit ;;
-    M68*:*:R3V[5678]*:*)
-	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
-    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
-	OS_REL=''
-	test -r /etc/.relid \
-	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
-	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
-	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
-	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
-    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
-        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-          && { echo i486-ncr-sysv4; exit; } ;;
-    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
-	echo m68k-unknown-lynxos${UNAME_RELEASE}
-	exit ;;
-    mc68030:UNIX_System_V:4.*:*)
-	echo m68k-atari-sysv4
-	exit ;;
-    TSUNAMI:LynxOS:2.*:*)
-	echo sparc-unknown-lynxos${UNAME_RELEASE}
-	exit ;;
-    rs6000:LynxOS:2.*:*)
-	echo rs6000-unknown-lynxos${UNAME_RELEASE}
-	exit ;;
-    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
-	echo powerpc-unknown-lynxos${UNAME_RELEASE}
-	exit ;;
-    SM[BE]S:UNIX_SV:*:*)
-	echo mips-dde-sysv${UNAME_RELEASE}
-	exit ;;
-    RM*:ReliantUNIX-*:*:*)
-	echo mips-sni-sysv4
-	exit ;;
-    RM*:SINIX-*:*:*)
-	echo mips-sni-sysv4
-	exit ;;
-    *:SINIX-*:*:*)
-	if uname -p 2>/dev/null >/dev/null ; then
-		UNAME_MACHINE=`(uname -p) 2>/dev/null`
-		echo ${UNAME_MACHINE}-sni-sysv4
-	else
-		echo ns32k-sni-sysv
-	fi
-	exit ;;
-    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
-                      # says <Richard.M.Bartel at ccMail.Census.GOV>
-        echo i586-unisys-sysv4
-        exit ;;
-    *:UNIX_System_V:4*:FTX*)
-	# From Gerald Hewes <hewes at openmarket.com>.
-	# How about differentiating between stratus architectures? -djm
-	echo hppa1.1-stratus-sysv4
-	exit ;;
-    *:*:*:FTX*)
-	# From seanf at swdc.stratus.com.
-	echo i860-stratus-sysv4
-	exit ;;
-    i*86:VOS:*:*)
-	# From Paul.Green at stratus.com.
-	echo ${UNAME_MACHINE}-stratus-vos
-	exit ;;
-    *:VOS:*:*)
-	# From Paul.Green at stratus.com.
-	echo hppa1.1-stratus-vos
-	exit ;;
-    mc68*:A/UX:*:*)
-	echo m68k-apple-aux${UNAME_RELEASE}
-	exit ;;
-    news*:NEWS-OS:6*:*)
-	echo mips-sony-newsos6
-	exit ;;
-    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
-	if [ -d /usr/nec ]; then
-	        echo mips-nec-sysv${UNAME_RELEASE}
-	else
-	        echo mips-unknown-sysv${UNAME_RELEASE}
-	fi
-        exit ;;
-    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
-	echo powerpc-be-beos
-	exit ;;
-    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
-	echo powerpc-apple-beos
-	exit ;;
-    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
-	echo i586-pc-beos
-	exit ;;
-    SX-4:SUPER-UX:*:*)
-	echo sx4-nec-superux${UNAME_RELEASE}
-	exit ;;
-    SX-5:SUPER-UX:*:*)
-	echo sx5-nec-superux${UNAME_RELEASE}
-	exit ;;
-    SX-6:SUPER-UX:*:*)
-	echo sx6-nec-superux${UNAME_RELEASE}
-	exit ;;
-    SX-7:SUPER-UX:*:*)
-	echo sx7-nec-superux${UNAME_RELEASE}
-	exit ;;
-    SX-8:SUPER-UX:*:*)
-	echo sx8-nec-superux${UNAME_RELEASE}
-	exit ;;
-    SX-8R:SUPER-UX:*:*)
-	echo sx8r-nec-superux${UNAME_RELEASE}
-	exit ;;
-    Power*:Rhapsody:*:*)
-	echo powerpc-apple-rhapsody${UNAME_RELEASE}
-	exit ;;
-    *:Rhapsody:*:*)
-	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
-	exit ;;
-    *:Darwin:*:*)
-	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
-	case $UNAME_PROCESSOR in
-	    unknown) UNAME_PROCESSOR=powerpc ;;
-	esac
-	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
-	exit ;;
-    *:procnto*:*:* | *:QNX:[0123456789]*:*)
-	UNAME_PROCESSOR=`uname -p`
-	if test "$UNAME_PROCESSOR" = "x86"; then
-		UNAME_PROCESSOR=i386
-		UNAME_MACHINE=pc
-	fi
-	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
-	exit ;;
-    *:QNX:*:4*)
-	echo i386-pc-qnx
-	exit ;;
-    NSE-?:NONSTOP_KERNEL:*:*)
-	echo nse-tandem-nsk${UNAME_RELEASE}
-	exit ;;
-    NSR-?:NONSTOP_KERNEL:*:*)
-	echo nsr-tandem-nsk${UNAME_RELEASE}
-	exit ;;
-    *:NonStop-UX:*:*)
-	echo mips-compaq-nonstopux
-	exit ;;
-    BS2000:POSIX*:*:*)
-	echo bs2000-siemens-sysv
-	exit ;;
-    DS/*:UNIX_System_V:*:*)
-	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
-	exit ;;
-    *:Plan9:*:*)
-	# "uname -m" is not consistent, so use $cputype instead. 386
-	# is converted to i386 for consistency with other x86
-	# operating systems.
-	if test "$cputype" = "386"; then
-	    UNAME_MACHINE=i386
-	else
-	    UNAME_MACHINE="$cputype"
-	fi
-	echo ${UNAME_MACHINE}-unknown-plan9
-	exit ;;
-    *:TOPS-10:*:*)
-	echo pdp10-unknown-tops10
-	exit ;;
-    *:TENEX:*:*)
-	echo pdp10-unknown-tenex
-	exit ;;
-    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
-	echo pdp10-dec-tops20
-	exit ;;
-    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
-	echo pdp10-xkl-tops20
-	exit ;;
-    *:TOPS-20:*:*)
-	echo pdp10-unknown-tops20
-	exit ;;
-    *:ITS:*:*)
-	echo pdp10-unknown-its
-	exit ;;
-    SEI:*:*:SEIUX)
-        echo mips-sei-seiux${UNAME_RELEASE}
-	exit ;;
-    *:DragonFly:*:*)
-	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
-	exit ;;
-    *:*VMS:*:*)
-    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
-	case "${UNAME_MACHINE}" in
-	    A*) echo alpha-dec-vms ; exit ;;
-	    I*) echo ia64-dec-vms ; exit ;;
-	    V*) echo vax-dec-vms ; exit ;;
-	esac ;;
-    *:XENIX:*:SysV)
-	echo i386-pc-xenix
-	exit ;;
-    i*86:skyos:*:*)
-	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
-	exit ;;
-    i*86:rdos:*:*)
-	echo ${UNAME_MACHINE}-pc-rdos
-	exit ;;
-esac
-
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
-eval $set_cc_for_build
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
-  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
-     I don't know....  */
-  printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
-  printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
-          "4"
-#else
-	  ""
-#endif
-         ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
-  printf ("arm-acorn-riscix\n"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
-  printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
-  int version;
-  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
-  if (version < 4)
-    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
-  else
-    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
-  exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
-  printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
-  printf ("ns32k-encore-mach\n"); exit (0);
-#else
-  printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
-  printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
-  printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
-  printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
-    struct utsname un;
-
-    uname(&un);
-
-    if (strncmp(un.version, "V2", 2) == 0) {
-	printf ("i386-sequent-ptx2\n"); exit (0);
-    }
-    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
-	printf ("i386-sequent-ptx1\n"); exit (0);
-    }
-    printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-# if !defined (ultrix)
-#  include <sys/param.h>
-#  if defined (BSD)
-#   if BSD == 43
-      printf ("vax-dec-bsd4.3\n"); exit (0);
-#   else
-#    if BSD == 199006
-      printf ("vax-dec-bsd4.3reno\n"); exit (0);
-#    else
-      printf ("vax-dec-bsd\n"); exit (0);
-#    endif
-#   endif
-#  else
-    printf ("vax-dec-bsd\n"); exit (0);
-#  endif
-# else
-    printf ("vax-dec-ultrix\n"); exit (0);
-# endif
-#endif
-
-#if defined (alliant) && defined (i860)
-  printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
-  exit (1);
-}
-EOF
-
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
-	{ echo "$SYSTEM_NAME"; exit; }
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
-    case `getsysinfo -f cpu_type` in
-    c1*)
-	echo c1-convex-bsd
-	exit ;;
-    c2*)
-	if getsysinfo -f scalar_acc
-	then echo c32-convex-bsd
-	else echo c2-convex-bsd
-	fi
-	exit ;;
-    c34*)
-	echo c34-convex-bsd
-	exit ;;
-    c38*)
-	echo c38-convex-bsd
-	exit ;;
-    c4*)
-	echo c4-convex-bsd
-	exit ;;
-    esac
-fi
-
-cat >&2 <<EOF
-$0: unable to guess system type
-
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
-
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
-and
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
-
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches at gnu.org> in order to provide the needed
-information to handle your system.
-
-config.guess timestamp = $timestamp
-
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
-
-hostinfo               = `(hostinfo) 2>/dev/null`
-/bin/universe          = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch              = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
-
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM  = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
-EOF
-
-exit 1
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/config.h.in b/config.h.in
index 9ee44a7..78d4dc9 100644
--- a/config.h.in
+++ b/config.h.in
@@ -1,13 +1,7 @@
-/* config.h.in.  Generated from configure.in by autoheader.  */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
 
-/* Enable Autoimplementation of dgetri routine with dtrti and dtrsm */
-#undef AUTOIMPLEMENT_DGETRI
-
-/* Define if BLAS routines are available */
-#undef BLAS_AVAILABLE
-
-/* Define if GMP has no <gmpxx.h> */
-#undef GMP_NO_CXX
+/* Define if building universal (internal helper macro) */
+#undef AC_APPLE_UNIVERSAL_BUILD
 
 /* Define if GMP is version 3.xxx */
 #undef GMP_VERSION_3
@@ -15,23 +9,14 @@
 /* Define that architecture uses big endian storage */
 #undef HAVE_BIG_ENDIAN
 
-/* Define if BLAS is installed */
-#undef HAVE_BLAS
-
-/* Define if C interface to BLAS is available */
-#undef HAVE_CBLAS
-
-/* Define if dgetrf is available */
-#undef HAVE_DGETRF
-
-/* Define if dgetri is available */
-#undef HAVE_DGETRI
-
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
-/* Define if dtrtri is available */
-#undef HAVE_DTRTRI
+/* Define if FFLAFLAS is installed */
+#undef HAVE_FFLAFLAS
+
+/* Define to 1 if you have the <float.h> header file. */
+#undef HAVE_FLOAT_H
 
 /* Define if GIVARO is installed */
 #undef HAVE_GIVARO
@@ -39,12 +24,18 @@
 /* Define if GMP is installed */
 #undef HAVE_GMP
 
+/* Define if IML is installed */
+#undef HAVE_IML
+
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
 /* Define if LIDIA is installed */
 #undef HAVE_LIDIA
 
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
 /* Define that architecture uses little endian storage */
 #undef HAVE_LITTLE_ENDIAN
 
@@ -60,6 +51,9 @@
 /* Define if SACLIB is installed */
 #undef HAVE_SACLIB
 
+/* Define to 1 if you have the <stddef.h> header file. */
+#undef HAVE_STDDEF_H
+
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
@@ -75,6 +69,9 @@
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #undef HAVE_SYS_STAT_H
 
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
 /* Define to 1 if you have the <sys/types.h> header file. */
 #undef HAVE_SYS_TYPES_H
 
@@ -93,6 +90,10 @@
 /* Canonical 8-bit data type */
 #undef INT8
 
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#undef LT_OBJDIR
+
 /* define is the version of Maple have access function to gmp data */
 #undef MAPLE_GMP_ACCESS
 
@@ -111,6 +112,9 @@
 /* Define to the one symbol short name of this package. */
 #undef PACKAGE_TARNAME
 
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
@@ -145,5 +149,17 @@
 /* optimized threshold for switching to strassen matrix multiplication */
 #undef WINOTHRESHOLD
 
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+#  define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+#  undef WORDS_BIGENDIAN
+# endif
+#endif
+
 /* Define if Expat is installed */
 #undef XMLENABLED
diff --git a/config.sub b/config.sub
deleted file mode 100755
index 1761d8b..0000000
--- a/config.sub
+++ /dev/null
@@ -1,1626 +0,0 @@
-#! /bin/sh
-# Configuration validation subroutine script.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
-#   Inc.
-
-timestamp='2007-06-28'
-
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine.  It does not imply ALL GNU software can.
-#
-# 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
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU 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.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Please send patches to <config-patches at gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# Configuration subroutine to validate and canonicalize a configuration type.
-# Supply the specified configuration type as an argument.
-# If it is invalid, we print an error message on stderr and exit with code 1.
-# Otherwise, we print the canonical config type on stdout and succeed.
-
-# This file is supposed to be the same for all GNU packages
-# and recognize all the CPU types, system types and aliases
-# that are meaningful with *any* GNU software.
-# Each package is responsible for reporting which valid configurations
-# it does not support.  The user should be able to distinguish
-# a failure to support a valid configuration from a meaningless
-# configuration.
-
-# The goal of this file is to map all the various variations of a given
-# machine specification into a single specification in the form:
-#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or in some cases, the newer four-part form:
-#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# It is wrong to echo any other type of specification.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
-       $0 [OPTION] ALIAS
-
-Canonicalize a configuration name.
-
-Operation modes:
-  -h, --help         print this help, then exit
-  -t, --time-stamp   print date of last modification, then exit
-  -v, --version      print version number, then exit
-
-Report bugs and patches to <config-patches at gnu.org>."
-
-version="\
-GNU config.sub ($timestamp)
-
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-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."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
-  case $1 in
-    --time-stamp | --time* | -t )
-       echo "$timestamp" ; exit ;;
-    --version | -v )
-       echo "$version" ; exit ;;
-    --help | --h* | -h )
-       echo "$usage"; exit ;;
-    -- )     # Stop option processing
-       shift; break ;;
-    - )	# Use stdin as input.
-       break ;;
-    -* )
-       echo "$me: invalid option $1$help"
-       exit 1 ;;
-
-    *local*)
-       # First pass through any local machine types.
-       echo $1
-       exit ;;
-
-    * )
-       break ;;
-  esac
-done
-
-case $# in
- 0) echo "$me: missing argument$help" >&2
-    exit 1;;
- 1) ;;
- *) echo "$me: too many arguments$help" >&2
-    exit 1;;
-esac
-
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-case $maybe_os in
-  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
-  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
-  storm-chaos* | os2-emx* | rtmk-nova*)
-    os=-$maybe_os
-    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
-    ;;
-  *)
-    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
-    if [ $basic_machine != $1 ]
-    then os=`echo $1 | sed 's/.*-/-/'`
-    else os=; fi
-    ;;
-esac
-
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work.  We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
-	-sun*os*)
-		# Prevent following clause from handling this invalid input.
-		;;
-	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
-	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
-	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
-	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-	-apple | -axis | -knuth | -cray)
-		os=
-		basic_machine=$1
-		;;
-	-sim | -cisco | -oki | -wec | -winbond)
-		os=
-		basic_machine=$1
-		;;
-	-scout)
-		;;
-	-wrs)
-		os=-vxworks
-		basic_machine=$1
-		;;
-	-chorusos*)
-		os=-chorusos
-		basic_machine=$1
-		;;
- 	-chorusrdb)
- 		os=-chorusrdb
-		basic_machine=$1
- 		;;
-	-hiux*)
-		os=-hiuxwe2
-		;;
-	-sco6)
-		os=-sco5v6
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco5)
-		os=-sco3.2v5
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco4)
-		os=-sco3.2v4
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco3.2.[4-9]*)
-		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco3.2v[4-9]*)
-		# Don't forget version if it is 3.2v4 or newer.
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco5v6*)
-		# Don't forget version if it is 3.2v4 or newer.
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-sco*)
-		os=-sco3.2v2
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-udk*)
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-isc)
-		os=-isc2.2
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-clix*)
-		basic_machine=clipper-intergraph
-		;;
-	-isc*)
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-		;;
-	-lynx*)
-		os=-lynxos
-		;;
-	-ptx*)
-		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
-		;;
-	-windowsnt*)
-		os=`echo $os | sed -e 's/windowsnt/winnt/'`
-		;;
-	-psos*)
-		os=-psos
-		;;
-	-mint | -mint[0-9]*)
-		basic_machine=m68k-atari
-		os=-mint
-		;;
-esac
-
-# Decode aliases for certain CPU-COMPANY combinations.
-case $basic_machine in
-	# Recognize the basic CPU types without company name.
-	# Some are omitted here because they have special meanings below.
-	1750a | 580 \
-	| a29k \
-	| 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 \
-	| bfin \
-	| c4x | clipper \
-	| d10v | d30v | dlx | dsp16xx \
-	| fido | fr30 | frv \
-	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
-	| i370 | i860 | i960 | ia64 \
-	| ip2k | iq2000 \
-	| m32c | m32r | m32rle | m68000 | m68k | m88k \
-	| maxq | mb | microblaze | mcore | mep \
-	| mips | mipsbe | mipseb | mipsel | mipsle \
-	| mips16 \
-	| mips64 | mips64el \
-	| mips64vr | mips64vrel \
-	| mips64orion | mips64orionel \
-	| mips64vr4100 | mips64vr4100el \
-	| mips64vr4300 | mips64vr4300el \
-	| mips64vr5000 | mips64vr5000el \
-	| mips64vr5900 | mips64vr5900el \
-	| mipsisa32 | mipsisa32el \
-	| mipsisa32r2 | mipsisa32r2el \
-	| mipsisa64 | mipsisa64el \
-	| mipsisa64r2 | mipsisa64r2el \
-	| mipsisa64sb1 | mipsisa64sb1el \
-	| mipsisa64sr71k | mipsisa64sr71kel \
-	| mipstx39 | mipstx39el \
-	| mn10200 | mn10300 \
-	| mt \
-	| msp430 \
-	| nios | nios2 \
-	| ns16k | ns32k \
-	| or32 \
-	| pdp10 | pdp11 | pj | pjl \
-	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
-	| pyramid \
-	| score \
-	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
-	| sh64 | sh64le \
-	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
-	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
-	| spu | strongarm \
-	| tahoe | thumb | tic4x | tic80 | tron \
-	| v850 | v850e \
-	| we32k \
-	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
-	| z8k)
-		basic_machine=$basic_machine-unknown
-		;;
-	m6811 | m68hc11 | m6812 | m68hc12)
-		# Motorola 68HC11/12.
-		basic_machine=$basic_machine-unknown
-		os=-none
-		;;
-	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
-		;;
-	ms1)
-		basic_machine=mt-unknown
-		;;
-
-	# We use `pc' rather than `unknown'
-	# because (1) that's what they normally are, and
-	# (2) the word "unknown" tends to confuse beginning users.
-	i*86 | x86_64)
-	  basic_machine=$basic_machine-pc
-	  ;;
-	# Object if more than one company name word.
-	*-*-*)
-		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
-		exit 1
-		;;
-	# Recognize the basic CPU types with company name.
-	580-* \
-	| a29k-* \
-	| 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-* \
-	| bfin-* | bs2000-* \
-	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
-	| clipper-* | craynv-* | cydra-* \
-	| d10v-* | d30v-* | dlx-* \
-	| elxsi-* \
-	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
-	| h8300-* | h8500-* \
-	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
-	| i*86-* | i860-* | i960-* | ia64-* \
-	| ip2k-* | iq2000-* \
-	| m32c-* | m32r-* | m32rle-* \
-	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-	| m88110-* | m88k-* | maxq-* | mcore-* \
-	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
-	| mips16-* \
-	| mips64-* | mips64el-* \
-	| mips64vr-* | mips64vrel-* \
-	| mips64orion-* | mips64orionel-* \
-	| mips64vr4100-* | mips64vr4100el-* \
-	| mips64vr4300-* | mips64vr4300el-* \
-	| mips64vr5000-* | mips64vr5000el-* \
-	| mips64vr5900-* | mips64vr5900el-* \
-	| mipsisa32-* | mipsisa32el-* \
-	| mipsisa32r2-* | mipsisa32r2el-* \
-	| mipsisa64-* | mipsisa64el-* \
-	| mipsisa64r2-* | mipsisa64r2el-* \
-	| mipsisa64sb1-* | mipsisa64sb1el-* \
-	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
-	| mipstx39-* | mipstx39el-* \
-	| mmix-* \
-	| mt-* \
-	| msp430-* \
-	| nios-* | nios2-* \
-	| none-* | np1-* | ns16k-* | ns32k-* \
-	| orion-* \
-	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
-	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
-	| pyramid-* \
-	| romp-* | rs6000-* \
-	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
-	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
-	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
-	| sparclite-* \
-	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
-	| tahoe-* | thumb-* \
-	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
-	| tron-* \
-	| v850-* | v850e-* | vax-* \
-	| we32k-* \
-	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
-	| xstormy16-* | xtensa-* \
-	| ymp-* \
-	| z8k-*)
-		;;
-	# Recognize the various machine names and aliases which stand
-	# for a CPU type and a company and sometimes even an OS.
-	386bsd)
-		basic_machine=i386-unknown
-		os=-bsd
-		;;
-	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
-		basic_machine=m68000-att
-		;;
-	3b*)
-		basic_machine=we32k-att
-		;;
-	a29khif)
-		basic_machine=a29k-amd
-		os=-udi
-		;;
-    	abacus)
-		basic_machine=abacus-unknown
-		;;
-	adobe68k)
-		basic_machine=m68010-adobe
-		os=-scout
-		;;
-	alliant | fx80)
-		basic_machine=fx80-alliant
-		;;
-	altos | altos3068)
-		basic_machine=m68k-altos
-		;;
-	am29k)
-		basic_machine=a29k-none
-		os=-bsd
-		;;
-	amd64)
-		basic_machine=x86_64-pc
-		;;
-	amd64-*)
-		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	amdahl)
-		basic_machine=580-amdahl
-		os=-sysv
-		;;
-	amiga | amiga-*)
-		basic_machine=m68k-unknown
-		;;
-	amigaos | amigados)
-		basic_machine=m68k-unknown
-		os=-amigaos
-		;;
-	amigaunix | amix)
-		basic_machine=m68k-unknown
-		os=-sysv4
-		;;
-	apollo68)
-		basic_machine=m68k-apollo
-		os=-sysv
-		;;
-	apollo68bsd)
-		basic_machine=m68k-apollo
-		os=-bsd
-		;;
-	aux)
-		basic_machine=m68k-apple
-		os=-aux
-		;;
-	balance)
-		basic_machine=ns32k-sequent
-		os=-dynix
-		;;
-	c90)
-		basic_machine=c90-cray
-		os=-unicos
-		;;
-	convex-c1)
-		basic_machine=c1-convex
-		os=-bsd
-		;;
-	convex-c2)
-		basic_machine=c2-convex
-		os=-bsd
-		;;
-	convex-c32)
-		basic_machine=c32-convex
-		os=-bsd
-		;;
-	convex-c34)
-		basic_machine=c34-convex
-		os=-bsd
-		;;
-	convex-c38)
-		basic_machine=c38-convex
-		os=-bsd
-		;;
-	cray | j90)
-		basic_machine=j90-cray
-		os=-unicos
-		;;
-	craynv)
-		basic_machine=craynv-cray
-		os=-unicosmp
-		;;
-	cr16)
-		basic_machine=cr16-unknown
-		os=-elf
-		;;
-	crds | unos)
-		basic_machine=m68k-crds
-		;;
-	crisv32 | crisv32-* | etraxfs*)
-		basic_machine=crisv32-axis
-		;;
-	cris | cris-* | etrax*)
-		basic_machine=cris-axis
-		;;
-	crx)
-		basic_machine=crx-unknown
-		os=-elf
-		;;
-	da30 | da30-*)
-		basic_machine=m68k-da30
-		;;
-	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
-		basic_machine=mips-dec
-		;;
-	decsystem10* | dec10*)
-		basic_machine=pdp10-dec
-		os=-tops10
-		;;
-	decsystem20* | dec20*)
-		basic_machine=pdp10-dec
-		os=-tops20
-		;;
-	delta | 3300 | motorola-3300 | motorola-delta \
-	      | 3300-motorola | delta-motorola)
-		basic_machine=m68k-motorola
-		;;
-	delta88)
-		basic_machine=m88k-motorola
-		os=-sysv3
-		;;
-	djgpp)
-		basic_machine=i586-pc
-		os=-msdosdjgpp
-		;;
-	dpx20 | dpx20-*)
-		basic_machine=rs6000-bull
-		os=-bosx
-		;;
-	dpx2* | dpx2*-bull)
-		basic_machine=m68k-bull
-		os=-sysv3
-		;;
-	ebmon29k)
-		basic_machine=a29k-amd
-		os=-ebmon
-		;;
-	elxsi)
-		basic_machine=elxsi-elxsi
-		os=-bsd
-		;;
-	encore | umax | mmax)
-		basic_machine=ns32k-encore
-		;;
-	es1800 | OSE68k | ose68k | ose | OSE)
-		basic_machine=m68k-ericsson
-		os=-ose
-		;;
-	fx2800)
-		basic_machine=i860-alliant
-		;;
-	genix)
-		basic_machine=ns32k-ns
-		;;
-	gmicro)
-		basic_machine=tron-gmicro
-		os=-sysv
-		;;
-	go32)
-		basic_machine=i386-pc
-		os=-go32
-		;;
-	h3050r* | hiux*)
-		basic_machine=hppa1.1-hitachi
-		os=-hiuxwe2
-		;;
-	h8300hms)
-		basic_machine=h8300-hitachi
-		os=-hms
-		;;
-	h8300xray)
-		basic_machine=h8300-hitachi
-		os=-xray
-		;;
-	h8500hms)
-		basic_machine=h8500-hitachi
-		os=-hms
-		;;
-	harris)
-		basic_machine=m88k-harris
-		os=-sysv3
-		;;
-	hp300-*)
-		basic_machine=m68k-hp
-		;;
-	hp300bsd)
-		basic_machine=m68k-hp
-		os=-bsd
-		;;
-	hp300hpux)
-		basic_machine=m68k-hp
-		os=-hpux
-		;;
-	hp3k9[0-9][0-9] | hp9[0-9][0-9])
-		basic_machine=hppa1.0-hp
-		;;
-	hp9k2[0-9][0-9] | hp9k31[0-9])
-		basic_machine=m68000-hp
-		;;
-	hp9k3[2-9][0-9])
-		basic_machine=m68k-hp
-		;;
-	hp9k6[0-9][0-9] | hp6[0-9][0-9])
-		basic_machine=hppa1.0-hp
-		;;
-	hp9k7[0-79][0-9] | hp7[0-79][0-9])
-		basic_machine=hppa1.1-hp
-		;;
-	hp9k78[0-9] | hp78[0-9])
-		# FIXME: really hppa2.0-hp
-		basic_machine=hppa1.1-hp
-		;;
-	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
-		# FIXME: really hppa2.0-hp
-		basic_machine=hppa1.1-hp
-		;;
-	hp9k8[0-9][13679] | hp8[0-9][13679])
-		basic_machine=hppa1.1-hp
-		;;
-	hp9k8[0-9][0-9] | hp8[0-9][0-9])
-		basic_machine=hppa1.0-hp
-		;;
-	hppa-next)
-		os=-nextstep3
-		;;
-	hppaosf)
-		basic_machine=hppa1.1-hp
-		os=-osf
-		;;
-	hppro)
-		basic_machine=hppa1.1-hp
-		os=-proelf
-		;;
-	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
-		;;
-	i*86v4*)
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-		os=-sysv4
-		;;
-	i*86v)
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-		os=-sysv
-		;;
-	i*86sol2)
-		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-		os=-solaris2
-		;;
-	i386mach)
-		basic_machine=i386-mach
-		os=-mach
-		;;
-	i386-vsta | vsta)
-		basic_machine=i386-unknown
-		os=-vsta
-		;;
-	iris | iris4d)
-		basic_machine=mips-sgi
-		case $os in
-		    -irix*)
-			;;
-		    *)
-			os=-irix4
-			;;
-		esac
-		;;
-	isi68 | isi)
-		basic_machine=m68k-isi
-		os=-sysv
-		;;
-	m88k-omron*)
-		basic_machine=m88k-omron
-		;;
-	magnum | m3230)
-		basic_machine=mips-mips
-		os=-sysv
-		;;
-	merlin)
-		basic_machine=ns32k-utek
-		os=-sysv
-		;;
-	mingw32)
-		basic_machine=i386-pc
-		os=-mingw32
-		;;
-	mingw32ce)
-		basic_machine=arm-unknown
-		os=-mingw32ce
-		;;
-	miniframe)
-		basic_machine=m68000-convergent
-		;;
-	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
-		basic_machine=m68k-atari
-		os=-mint
-		;;
-	mips3*-*)
-		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
-		;;
-	mips3*)
-		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
-		;;
-	monitor)
-		basic_machine=m68k-rom68k
-		os=-coff
-		;;
-	morphos)
-		basic_machine=powerpc-unknown
-		os=-morphos
-		;;
-	msdos)
-		basic_machine=i386-pc
-		os=-msdos
-		;;
-	ms1-*)
-		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
-		;;
-	mvs)
-		basic_machine=i370-ibm
-		os=-mvs
-		;;
-	ncr3000)
-		basic_machine=i486-ncr
-		os=-sysv4
-		;;
-	netbsd386)
-		basic_machine=i386-unknown
-		os=-netbsd
-		;;
-	netwinder)
-		basic_machine=armv4l-rebel
-		os=-linux
-		;;
-	news | news700 | news800 | news900)
-		basic_machine=m68k-sony
-		os=-newsos
-		;;
-	news1000)
-		basic_machine=m68030-sony
-		os=-newsos
-		;;
-	news-3600 | risc-news)
-		basic_machine=mips-sony
-		os=-newsos
-		;;
-	necv70)
-		basic_machine=v70-nec
-		os=-sysv
-		;;
-	next | m*-next )
-		basic_machine=m68k-next
-		case $os in
-		    -nextstep* )
-			;;
-		    -ns2*)
-		      os=-nextstep2
-			;;
-		    *)
-		      os=-nextstep3
-			;;
-		esac
-		;;
-	nh3000)
-		basic_machine=m68k-harris
-		os=-cxux
-		;;
-	nh[45]000)
-		basic_machine=m88k-harris
-		os=-cxux
-		;;
-	nindy960)
-		basic_machine=i960-intel
-		os=-nindy
-		;;
-	mon960)
-		basic_machine=i960-intel
-		os=-mon960
-		;;
-	nonstopux)
-		basic_machine=mips-compaq
-		os=-nonstopux
-		;;
-	np1)
-		basic_machine=np1-gould
-		;;
-	nsr-tandem)
-		basic_machine=nsr-tandem
-		;;
-	op50n-* | op60c-*)
-		basic_machine=hppa1.1-oki
-		os=-proelf
-		;;
-	openrisc | openrisc-*)
-		basic_machine=or32-unknown
-		;;
-	os400)
-		basic_machine=powerpc-ibm
-		os=-os400
-		;;
-	OSE68000 | ose68000)
-		basic_machine=m68000-ericsson
-		os=-ose
-		;;
-	os68k)
-		basic_machine=m68k-none
-		os=-os68k
-		;;
-	pa-hitachi)
-		basic_machine=hppa1.1-hitachi
-		os=-hiuxwe2
-		;;
-	paragon)
-		basic_machine=i860-intel
-		os=-osf
-		;;
-	pbd)
-		basic_machine=sparc-tti
-		;;
-	pbb)
-		basic_machine=m68k-tti
-		;;
-	pc532 | pc532-*)
-		basic_machine=ns32k-pc532
-		;;
-	pc98)
-		basic_machine=i386-pc
-		;;
-	pc98-*)
-		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	pentium | p5 | k5 | k6 | nexgen | viac3)
-		basic_machine=i586-pc
-		;;
-	pentiumpro | p6 | 6x86 | athlon | athlon_*)
-		basic_machine=i686-pc
-		;;
-	pentiumii | pentium2 | pentiumiii | pentium3)
-		basic_machine=i686-pc
-		;;
-	pentium4)
-		basic_machine=i786-pc
-		;;
-	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
-		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	pentiumpro-* | p6-* | 6x86-* | athlon-*)
-		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
-		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	pentium4-*)
-		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	pn)
-		basic_machine=pn-gould
-		;;
-	power)	basic_machine=power-ibm
-		;;
-	ppc)	basic_machine=powerpc-unknown
-		;;
-	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	ppcle | powerpclittle | ppc-le | powerpc-little)
-		basic_machine=powerpcle-unknown
-		;;
-	ppcle-* | powerpclittle-*)
-		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	ppc64)	basic_machine=powerpc64-unknown
-		;;
-	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
-		basic_machine=powerpc64le-unknown
-		;;
-	ppc64le-* | powerpc64little-*)
-		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
-		;;
-	ps2)
-		basic_machine=i386-ibm
-		;;
-	pw32)
-		basic_machine=i586-unknown
-		os=-pw32
-		;;
-	rdos)
-		basic_machine=i386-pc
-		os=-rdos
-		;;
-	rom68k)
-		basic_machine=m68k-rom68k
-		os=-coff
-		;;
-	rm[46]00)
-		basic_machine=mips-siemens
-		;;
-	rtpc | rtpc-*)
-		basic_machine=romp-ibm
-		;;
-	s390 | s390-*)
-		basic_machine=s390-ibm
-		;;
-	s390x | s390x-*)
-		basic_machine=s390x-ibm
-		;;
-	sa29200)
-		basic_machine=a29k-amd
-		os=-udi
-		;;
-	sb1)
-		basic_machine=mipsisa64sb1-unknown
-		;;
-	sb1el)
-		basic_machine=mipsisa64sb1el-unknown
-		;;
-	sde)
-		basic_machine=mipsisa32-sde
-		os=-elf
-		;;
-	sei)
-		basic_machine=mips-sei
-		os=-seiux
-		;;
-	sequent)
-		basic_machine=i386-sequent
-		;;
-	sh)
-		basic_machine=sh-hitachi
-		os=-hms
-		;;
-	sh5el)
-		basic_machine=sh5le-unknown
-		;;
-	sh64)
-		basic_machine=sh64-unknown
-		;;
-	sparclite-wrs | simso-wrs)
-		basic_machine=sparclite-wrs
-		os=-vxworks
-		;;
-	sps7)
-		basic_machine=m68k-bull
-		os=-sysv2
-		;;
-	spur)
-		basic_machine=spur-unknown
-		;;
-	st2000)
-		basic_machine=m68k-tandem
-		;;
-	stratus)
-		basic_machine=i860-stratus
-		os=-sysv4
-		;;
-	sun2)
-		basic_machine=m68000-sun
-		;;
-	sun2os3)
-		basic_machine=m68000-sun
-		os=-sunos3
-		;;
-	sun2os4)
-		basic_machine=m68000-sun
-		os=-sunos4
-		;;
-	sun3os3)
-		basic_machine=m68k-sun
-		os=-sunos3
-		;;
-	sun3os4)
-		basic_machine=m68k-sun
-		os=-sunos4
-		;;
-	sun4os3)
-		basic_machine=sparc-sun
-		os=-sunos3
-		;;
-	sun4os4)
-		basic_machine=sparc-sun
-		os=-sunos4
-		;;
-	sun4sol2)
-		basic_machine=sparc-sun
-		os=-solaris2
-		;;
-	sun3 | sun3-*)
-		basic_machine=m68k-sun
-		;;
-	sun4)
-		basic_machine=sparc-sun
-		;;
-	sun386 | sun386i | roadrunner)
-		basic_machine=i386-sun
-		;;
-	sv1)
-		basic_machine=sv1-cray
-		os=-unicos
-		;;
-	symmetry)
-		basic_machine=i386-sequent
-		os=-dynix
-		;;
-	t3e)
-		basic_machine=alphaev5-cray
-		os=-unicos
-		;;
-	t90)
-		basic_machine=t90-cray
-		os=-unicos
-		;;
-	tic54x | c54x*)
-		basic_machine=tic54x-unknown
-		os=-coff
-		;;
-	tic55x | c55x*)
-		basic_machine=tic55x-unknown
-		os=-coff
-		;;
-	tic6x | c6x*)
-		basic_machine=tic6x-unknown
-		os=-coff
-		;;
-	tx39)
-		basic_machine=mipstx39-unknown
-		;;
-	tx39el)
-		basic_machine=mipstx39el-unknown
-		;;
-	toad1)
-		basic_machine=pdp10-xkl
-		os=-tops20
-		;;
-	tower | tower-32)
-		basic_machine=m68k-ncr
-		;;
-	tpf)
-		basic_machine=s390x-ibm
-		os=-tpf
-		;;
-	udi29k)
-		basic_machine=a29k-amd
-		os=-udi
-		;;
-	ultra3)
-		basic_machine=a29k-nyu
-		os=-sym1
-		;;
-	v810 | necv810)
-		basic_machine=v810-nec
-		os=-none
-		;;
-	vaxv)
-		basic_machine=vax-dec
-		os=-sysv
-		;;
-	vms)
-		basic_machine=vax-dec
-		os=-vms
-		;;
-	vpp*|vx|vx-*)
-		basic_machine=f301-fujitsu
-		;;
-	vxworks960)
-		basic_machine=i960-wrs
-		os=-vxworks
-		;;
-	vxworks68)
-		basic_machine=m68k-wrs
-		os=-vxworks
-		;;
-	vxworks29k)
-		basic_machine=a29k-wrs
-		os=-vxworks
-		;;
-	w65*)
-		basic_machine=w65-wdc
-		os=-none
-		;;
-	w89k-*)
-		basic_machine=hppa1.1-winbond
-		os=-proelf
-		;;
-	xbox)
-		basic_machine=i686-pc
-		os=-mingw32
-		;;
-	xps | xps100)
-		basic_machine=xps100-honeywell
-		;;
-	ymp)
-		basic_machine=ymp-cray
-		os=-unicos
-		;;
-	z8k-*-coff)
-		basic_machine=z8k-unknown
-		os=-sim
-		;;
-	none)
-		basic_machine=none-none
-		os=-none
-		;;
-
-# Here we handle the default manufacturer of certain CPU types.  It is in
-# some cases the only manufacturer, in others, it is the most popular.
-	w89k)
-		basic_machine=hppa1.1-winbond
-		;;
-	op50n)
-		basic_machine=hppa1.1-oki
-		;;
-	op60c)
-		basic_machine=hppa1.1-oki
-		;;
-	romp)
-		basic_machine=romp-ibm
-		;;
-	mmix)
-		basic_machine=mmix-knuth
-		;;
-	rs6000)
-		basic_machine=rs6000-ibm
-		;;
-	vax)
-		basic_machine=vax-dec
-		;;
-	pdp10)
-		# there are many clones, so DEC is not a safe bet
-		basic_machine=pdp10-unknown
-		;;
-	pdp11)
-		basic_machine=pdp11-dec
-		;;
-	we32k)
-		basic_machine=we32k-att
-		;;
-	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
-		basic_machine=sh-unknown
-		;;
-	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
-		basic_machine=sparc-sun
-		;;
-	cydra)
-		basic_machine=cydra-cydrome
-		;;
-	orion)
-		basic_machine=orion-highlevel
-		;;
-	orion105)
-		basic_machine=clipper-highlevel
-		;;
-	mac | mpw | mac-mpw)
-		basic_machine=m68k-apple
-		;;
-	pmac | pmac-mpw)
-		basic_machine=powerpc-apple
-		;;
-	*-unknown)
-		# Make sure to match an already-canonicalized machine name.
-		;;
-	*)
-		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
-		exit 1
-		;;
-esac
-
-# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
-	*-digital*)
-		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
-		;;
-	*-commodore*)
-		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
-		;;
-	*)
-		;;
-esac
-
-# Decode manufacturer-specific aliases for certain operating systems.
-
-if [ x"$os" != x"" ]
-then
-case $os in
-        # First match some system type aliases
-        # that might get confused with valid system types.
-	# -solaris* is a basic system type, with this one exception.
-	-solaris1 | -solaris1.*)
-		os=`echo $os | sed -e 's|solaris1|sunos4|'`
-		;;
-	-solaris)
-		os=-solaris2
-		;;
-	-svr4*)
-		os=-sysv4
-		;;
-	-unixware*)
-		os=-sysv4.2uw
-		;;
-	-gnu/linux*)
-		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
-		;;
-	# First accept the basic system types.
-	# The portable systems comes first.
-	# Each alternative MUST END IN A *, to match a version number.
-	# -sysv* is not here because it comes later, after sysvr4.
-	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
-	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
-	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
-	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-	      | -aos* \
-	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
-	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
-	      | -openbsd* | -solidbsd* \
-	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
-	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
-	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
-	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
-	      | -chorusos* | -chorusrdb* \
-	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-	      | -mingw32* | -linux-gnu* | -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* \
-	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
-	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
-	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
-	# Remember, each alternative MUST END IN *, to match a version number.
-		;;
-	-qnx*)
-		case $basic_machine in
-		    x86-* | i*86-*)
-			;;
-		    *)
-			os=-nto$os
-			;;
-		esac
-		;;
-	-nto-qnx*)
-		;;
-	-nto*)
-		os=`echo $os | sed -e 's|nto|nto-qnx|'`
-		;;
-	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
-	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
-	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
-		;;
-	-mac*)
-		os=`echo $os | sed -e 's|mac|macos|'`
-		;;
-	-linux-dietlibc)
-		os=-linux-dietlibc
-		;;
-	-linux*)
-		os=`echo $os | sed -e 's|linux|linux-gnu|'`
-		;;
-	-sunos5*)
-		os=`echo $os | sed -e 's|sunos5|solaris2|'`
-		;;
-	-sunos6*)
-		os=`echo $os | sed -e 's|sunos6|solaris3|'`
-		;;
-	-opened*)
-		os=-openedition
-		;;
-        -os400*)
-		os=-os400
-		;;
-	-wince*)
-		os=-wince
-		;;
-	-osfrose*)
-		os=-osfrose
-		;;
-	-osf*)
-		os=-osf
-		;;
-	-utek*)
-		os=-bsd
-		;;
-	-dynix*)
-		os=-bsd
-		;;
-	-acis*)
-		os=-aos
-		;;
-	-atheos*)
-		os=-atheos
-		;;
-	-syllable*)
-		os=-syllable
-		;;
-	-386bsd)
-		os=-bsd
-		;;
-	-ctix* | -uts*)
-		os=-sysv
-		;;
-	-nova*)
-		os=-rtmk-nova
-		;;
-	-ns2 )
-		os=-nextstep2
-		;;
-	-nsk*)
-		os=-nsk
-		;;
-	# Preserve the version number of sinix5.
-	-sinix5.*)
-		os=`echo $os | sed -e 's|sinix|sysv|'`
-		;;
-	-sinix*)
-		os=-sysv4
-		;;
-        -tpf*)
-		os=-tpf
-		;;
-	-triton*)
-		os=-sysv3
-		;;
-	-oss*)
-		os=-sysv3
-		;;
-	-svr4)
-		os=-sysv4
-		;;
-	-svr3)
-		os=-sysv3
-		;;
-	-sysvr4)
-		os=-sysv4
-		;;
-	# This must come after -sysvr4.
-	-sysv*)
-		;;
-	-ose*)
-		os=-ose
-		;;
-	-es1800*)
-		os=-ose
-		;;
-	-xenix)
-		os=-xenix
-		;;
-	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
-		os=-mint
-		;;
-	-aros*)
-		os=-aros
-		;;
-	-kaos*)
-		os=-kaos
-		;;
-	-zvmoe)
-		os=-zvmoe
-		;;
-	-none)
-		;;
-	*)
-		# Get rid of the `-' at the beginning of $os.
-		os=`echo $os | sed 's/[^-]*-//'`
-		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
-		exit 1
-		;;
-esac
-else
-
-# Here we handle the default operating systems that come with various machines.
-# The value should be what the vendor currently ships out the door with their
-# machine or put another way, the most popular os provided with the machine.
-
-# Note that if you're going to try to match "-MANUFACTURER" here (say,
-# "-sun"), then you have to tell the case statement up towards the top
-# that MANUFACTURER isn't an operating system.  Otherwise, code above
-# will signal an error saying that MANUFACTURER isn't an operating
-# system, and we'll never get to this point.
-
-case $basic_machine in
-        score-*)
-		os=-elf
-		;;
-        spu-*)
-		os=-elf
-		;;
-	*-acorn)
-		os=-riscix1.2
-		;;
-	arm*-rebel)
-		os=-linux
-		;;
-	arm*-semi)
-		os=-aout
-		;;
-        c4x-* | tic4x-*)
-        	os=-coff
-		;;
-	# This must come before the *-dec entry.
-	pdp10-*)
-		os=-tops20
-		;;
-	pdp11-*)
-		os=-none
-		;;
-	*-dec | vax-*)
-		os=-ultrix4.2
-		;;
-	m68*-apollo)
-		os=-domain
-		;;
-	i386-sun)
-		os=-sunos4.0.2
-		;;
-	m68000-sun)
-		os=-sunos3
-		# This also exists in the configure program, but was not the
-		# default.
-		# os=-sunos4
-		;;
-	m68*-cisco)
-		os=-aout
-		;;
-        mep-*)
-		os=-elf
-		;;
-	mips*-cisco)
-		os=-elf
-		;;
-	mips*-*)
-		os=-elf
-		;;
-	or32-*)
-		os=-coff
-		;;
-	*-tti)	# must be before sparc entry or we get the wrong os.
-		os=-sysv3
-		;;
-	sparc-* | *-sun)
-		os=-sunos4.1.1
-		;;
-	*-be)
-		os=-beos
-		;;
-	*-haiku)
-		os=-haiku
-		;;
-	*-ibm)
-		os=-aix
-		;;
-    	*-knuth)
-		os=-mmixware
-		;;
-	*-wec)
-		os=-proelf
-		;;
-	*-winbond)
-		os=-proelf
-		;;
-	*-oki)
-		os=-proelf
-		;;
-	*-hp)
-		os=-hpux
-		;;
-	*-hitachi)
-		os=-hiux
-		;;
-	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
-		os=-sysv
-		;;
-	*-cbm)
-		os=-amigaos
-		;;
-	*-dg)
-		os=-dgux
-		;;
-	*-dolphin)
-		os=-sysv3
-		;;
-	m68k-ccur)
-		os=-rtu
-		;;
-	m88k-omron*)
-		os=-luna
-		;;
-	*-next )
-		os=-nextstep
-		;;
-	*-sequent)
-		os=-ptx
-		;;
-	*-crds)
-		os=-unos
-		;;
-	*-ns)
-		os=-genix
-		;;
-	i370-*)
-		os=-mvs
-		;;
-	*-next)
-		os=-nextstep3
-		;;
-	*-gould)
-		os=-sysv
-		;;
-	*-highlevel)
-		os=-bsd
-		;;
-	*-encore)
-		os=-bsd
-		;;
-	*-sgi)
-		os=-irix
-		;;
-	*-siemens)
-		os=-sysv4
-		;;
-	*-masscomp)
-		os=-rtu
-		;;
-	f30[01]-fujitsu | f700-fujitsu)
-		os=-uxpv
-		;;
-	*-rom68k)
-		os=-coff
-		;;
-	*-*bug)
-		os=-coff
-		;;
-	*-apple)
-		os=-macos
-		;;
-	*-atari*)
-		os=-mint
-		;;
-	*)
-		os=-none
-		;;
-esac
-fi
-
-# Here we handle the case where we know the os, and the CPU type, but not the
-# manufacturer.  We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
-	*-unknown)
-		case $os in
-			-riscix*)
-				vendor=acorn
-				;;
-			-sunos*)
-				vendor=sun
-				;;
-			-aix*)
-				vendor=ibm
-				;;
-			-beos*)
-				vendor=be
-				;;
-			-hpux*)
-				vendor=hp
-				;;
-			-mpeix*)
-				vendor=hp
-				;;
-			-hiux*)
-				vendor=hitachi
-				;;
-			-unos*)
-				vendor=crds
-				;;
-			-dgux*)
-				vendor=dg
-				;;
-			-luna*)
-				vendor=omron
-				;;
-			-genix*)
-				vendor=ns
-				;;
-			-mvs* | -opened*)
-				vendor=ibm
-				;;
-			-os400*)
-				vendor=ibm
-				;;
-			-ptx*)
-				vendor=sequent
-				;;
-			-tpf*)
-				vendor=ibm
-				;;
-			-vxsim* | -vxworks* | -windiss*)
-				vendor=wrs
-				;;
-			-aux*)
-				vendor=apple
-				;;
-			-hms*)
-				vendor=hitachi
-				;;
-			-mpw* | -macos*)
-				vendor=apple
-				;;
-			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
-				vendor=atari
-				;;
-			-vos*)
-				vendor=stratus
-				;;
-		esac
-		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
-		;;
-esac
-
-echo $basic_machine$os
-exit
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/configure b/configure
index a7df4ea..b89c629 100755
--- a/configure
+++ b/configure
@@ -1,62 +1,85 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for linbox 1.1.6rc0.
+# Generated by GNU Autoconf 2.68 for LinBox 1.2.0.
 #
 # Report bugs to <linbox-use at googlegroups.com>.
 #
+#
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+# Foundation, Inc.
+#
+#
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
-## --------------------- ##
-## M4sh Initialization.  ##
-## --------------------- ##
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
 
 # Be more Bourne compatible
 DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
   NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
   # is contrary to our usage.  Disable this feature.
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
 else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
 esac
-
 fi
 
 
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
   else
-    PATH_SEPARATOR=:
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in #(
+      *"$as_nl"*)
+	expr "X$arg" : "X\\(.*\\)$as_nl";
+	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
   fi
-  rm -f conf$$.sh
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
 fi
 
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  as_unset=unset
-else
-  as_unset=false
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
 fi
 
 
@@ -65,20 +88,19 @@ fi
 # there to prevent editors from complaining about space-tab.
 # (If _AS_PATH_WALK were called with IFS unset, it would disable word
 # splitting by setting IFS to empty value.)
-as_nl='
-'
 IFS=" ""	$as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
-case $0 in
+as_myself=
+case $0 in #((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
 IFS=$as_save_IFS
 
      ;;
@@ -89,32 +111,286 @@ if test "x$as_myself" = x; then
   as_myself=$0
 fi
 if test ! -f "$as_myself"; then
-  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  { (exit 1); exit 1; }
+  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  exit 1
 fi
 
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
 done
 PS1='$ '
 PS2='> '
 PS4='+ '
 
 # NLS nuisances.
-for as_var in \
-  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
-  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
-  LC_TELEPHONE LC_TIME
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+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
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '\${1+\"\$@\"}'='\"\$@\"'
+  setopt NO_GLOB_SUBST
+else
+  case \`(set -o) 2>/dev/null\` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
+fi
+"
+  as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+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"
+  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'\" &&
+  test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1
+
+  test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
+    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+    ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
+    PATH=/empty FPATH=/empty; export PATH FPATH
+    test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
+      || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1"
+  if (eval "$as_required") 2>/dev/null; then :
+  as_have_required=yes
+else
+  as_have_required=no
+fi
+  if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
 do
-  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
-    eval $as_var=C; export $as_var
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  as_found=:
+  case $as_dir in #(
+	 /*)
+	   for as_base in sh bash ksh sh5; do
+	     # Try only shells that exist, to save several forks.
+	     as_shell=$as_dir/$as_base
+	     if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+		    { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  CONFIG_SHELL=$as_shell as_have_required=yes
+		   if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+  break 2
+fi
+fi
+	   done;;
+       esac
+  as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+	      { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+  CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+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+"$@"}
+fi
+
+    if test x$as_have_required = xno; then :
+  $as_echo "$0: This script requires a shell more modern than all"
+  $as_echo "$0: the shells that I found on your system."
+  if test x${ZSH_VERSION+set} = xset ; then
+    $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+    $as_echo "$0: be upgraded to zsh 4.3.4 or later."
   else
-    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+    $as_echo "$0: Please tell bug-autoconf at gnu.org and
+$0: linbox-use at googlegroups.com about your system,
+$0: including any error possibly output before this
+$0: message. Then install a modern shell, or manually run
+$0: the script under such a shell if you do have one."
   fi
-done
+  exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
+else
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+  fi
+  $as_echo "$as_me: error: $2" >&2
+  as_fn_exit $as_status
+} # as_fn_error
 
-# Required to use basename.
 if expr a : '\(a\)' >/dev/null 2>&1 &&
    test "X`expr 00001 : '.*\(...\)'`" = X001; then
   as_expr=expr
@@ -128,13 +404,17 @@ else
   as_basename=false
 fi
 
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
 
-# Name of the executable.
 as_me=`$as_basename -- "$0" ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
 	 X"$0" : 'X\(//\)$' \| \
 	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-echo X/"$0" |
+$as_echo X/"$0" |
     sed '/^.*\/\([^/][^/]*\)\/*$/{
 	    s//\1/
 	    q
@@ -149,568 +429,131 @@ echo X/"$0" |
 	  }
 	  s/.*/./; q'`
 
-# CDPATH.
-$as_unset CDPATH
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
 
 
-if test "x$CONFIG_SHELL" = x; then
-  if (eval ":") 2>/dev/null; then
-  as_have_required=yes
-else
-  as_have_required=no
-fi
+  as_lineno_1=$LINENO as_lineno_1a=$LINENO
+  as_lineno_2=$LINENO as_lineno_2a=$LINENO
+  eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+  test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+  # Blame Lee E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  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 test $as_have_required = yes && 	 (eval ":
-(as_func_return () {
-  (exit \$1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
+  # 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).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
 }
 
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
-
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
-fi
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+  case `echo 'xy\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='	';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
 
-if as_func_ret_success; then
-  :
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
 else
-  exitcode=1
-  echo as_func_ret_success failed.
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... 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'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -p'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -p'
+  fi
+else
+  as_ln_s='cp -p'
 fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
 
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p='mkdir -p "$as_dir"'
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
 fi
 
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
-  :
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
 else
-  exitcode=1
-  echo positional parameters were not saved.
+  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
 
-test \$exitcode = 0) || { (exit 1); exit 1; }
+# 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'"
 
-(
-  as_lineno_1=\$LINENO
-  as_lineno_2=\$LINENO
-  test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
-  test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
-") 2> /dev/null; then
-  :
-else
-  as_candidate_shells=
-    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  case $as_dir in
-	 /*)
-	   for as_base in sh bash ksh sh5; do
-	     as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
-	   done;;
-       esac
-done
-IFS=$as_save_IFS
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
+SHELL=${CONFIG_SHELL-/bin/sh}
 
-      for as_shell in $as_candidate_shells $SHELL; do
-	 # Try only shells that exist, to save several forks.
-	 if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
-		{ ("$as_shell") 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
 
-fi
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
 
-
-:
-_ASEOF
-}; then
-  CONFIG_SHELL=$as_shell
-	       as_have_required=yes
-	       if { "$as_shell" 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
-
-fi
-
-
-:
-(as_func_return () {
-  (exit $1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
-}
-
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
-
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
-  :
-else
-  exitcode=1
-  echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = "$1" ); then
-  :
-else
-  exitcode=1
-  echo positional parameters were not saved.
-fi
-
-test $exitcode = 0) || { (exit 1); exit 1; }
-
-(
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
-
-_ASEOF
-}; then
-  break
-fi
-
-fi
-
-      done
-
-      if test "x$CONFIG_SHELL" != x; then
-  for as_var in BASH_ENV ENV
-        do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-        done
-        export CONFIG_SHELL
-        exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
-fi
-
-
-    if test $as_have_required = no; then
-  echo This script requires a shell more modern than all the
-      echo shells that I found on your system.  Please install a
-      echo modern shell, or manually run the script under such a
-      echo shell if you do have one.
-      { (exit 1); exit 1; }
-fi
-
-
-fi
-
-fi
-
-
-
-(eval "as_func_return () {
-  (exit \$1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
-}
-
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
-
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
-  :
-else
-  exitcode=1
-  echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
-  :
-else
-  exitcode=1
-  echo positional parameters were not saved.
-fi
-
-test \$exitcode = 0") || {
-  echo No shell found that supports shell functions.
-  echo Please tell autoconf at gnu.org about your system,
-  echo including any error possibly output before this
-  echo message
-}
-
-
-
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
-
-  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
-  # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line after each line using $LINENO; the second 'sed'
-  # does the real work.  The second script uses 'N' to pair each
-  # line-number line with the line containing $LINENO, and appends
-  # trailing '-' during substitution so that $LINENO is not a special
-  # case at line end.
-  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # scripts with optimization help from Paolo Bonzini.  Blame Lee
-  # E. McMahon (1931-1989) for sed's syntax.  :-)
-  sed -n '
-    p
-    /[$]LINENO/=
-  ' <$as_myself |
-    sed '
-      s/[$]LINENO.*/&-/
-      t lineno
-      b
-      :lineno
-      N
-      :loop
-      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
-      t loop
-      s/-\n.*//
-    ' >$as_me.lineno &&
-  chmod +x "$as_me.lineno" ||
-    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
-   { (exit 1); exit 1; }; }
-
-  # 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).
-  . "./$as_me.lineno"
-  # Exit status is that of the last command.
-  exit
-}
-
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-  as_dirname=dirname
-else
-  as_dirname=false
-fi
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
--n*)
-  case `echo 'x\c'` in
-  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
-  *)   ECHO_C='\c';;
-  esac;;
-*)
-  ECHO_N='-n';;
-esac
-
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
-  rm -f conf$$.dir/conf$$.file
-else
-  rm -f conf$$.dir
-  mkdir conf$$.dir
-fi
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s='ln -s'
-  # ... 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'.
-  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-    as_ln_s='cp -p'
-elif ln conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s=ln
-else
-  as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
-
-if mkdir -p . 2>/dev/null; then
-  as_mkdir_p=:
-else
-  test -d ./-p && rmdir ./-p
-  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
-
-# 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'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-
-
-# Check that we are running under the correct shell.
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-case X$ECHO in
-X*--fallback-echo)
-  # Remove one level of quotation (which was required for Make).
-  ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','`
-  ;;
-esac
-
-echo=${ECHO-echo}
-if test "X$1" = X--no-reexec; then
-  # Discard the --no-reexec flag, and continue.
-  shift
-elif test "X$1" = X--fallback-echo; then
-  # Avoid inline document here, it may be left over
-  :
-elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
-  # Yippee, $echo works!
-  :
-else
-  # Restart under the correct shell.
-  exec $SHELL "$0" --no-reexec ${1+"$@"}
-fi
-
-if test "X$1" = X--fallback-echo; then
-  # used as fallback echo
-  shift
-  cat <<EOF
-$*
-EOF
-  exit 0
-fi
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-if test -z "$ECHO"; then
-if test "X${echo_test_string+set}" != Xset; then
-# find a string as large as possible, as long as the shell can cope with it
-  for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
-    # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
-    if (echo_test_string=`eval $cmd`) 2>/dev/null &&
-       echo_test_string=`eval $cmd` &&
-       (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
-    then
-      break
-    fi
-  done
-fi
-
-if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
-   echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
-   test "X$echo_testing_string" = "X$echo_test_string"; then
-  :
-else
-  # The Solaris, AIX, and Digital Unix default echo programs unquote
-  # backslashes.  This makes it impossible to quote backslashes using
-  #   echo "$something" | sed 's/\\/\\\\/g'
-  #
-  # So, first we look for a working echo in the user's PATH.
-
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-  for dir in $PATH /usr/ucb; do
-    IFS="$lt_save_ifs"
-    if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
-       test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
-       echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
-       test "X$echo_testing_string" = "X$echo_test_string"; then
-      echo="$dir/echo"
-      break
-    fi
-  done
-  IFS="$lt_save_ifs"
-
-  if test "X$echo" = Xecho; then
-    # We didn't find a better echo, so look for alternatives.
-    if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
-       echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
-       test "X$echo_testing_string" = "X$echo_test_string"; then
-      # This shell has a builtin print -r that does the trick.
-      echo='print -r'
-    elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
-	 test "X$CONFIG_SHELL" != X/bin/ksh; then
-      # If we have ksh, try running configure again with it.
-      ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-      export ORIGINAL_CONFIG_SHELL
-      CONFIG_SHELL=/bin/ksh
-      export CONFIG_SHELL
-      exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
-    else
-      # Try using printf.
-      echo='printf %s\n'
-      if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
-	 echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
-	 test "X$echo_testing_string" = "X$echo_test_string"; then
-	# Cool, printf works
-	:
-      elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
-	   test "X$echo_testing_string" = 'X\t' &&
-	   echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	   test "X$echo_testing_string" = "X$echo_test_string"; then
-	CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
-	export CONFIG_SHELL
-	SHELL="$CONFIG_SHELL"
-	export SHELL
-	echo="$CONFIG_SHELL $0 --fallback-echo"
-      elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
-	   test "X$echo_testing_string" = 'X\t' &&
-	   echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
-	   test "X$echo_testing_string" = "X$echo_test_string"; then
-	echo="$CONFIG_SHELL $0 --fallback-echo"
-      else
-	# maybe with a smaller string...
-	prev=:
-
-	for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
-	  if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
-	  then
-	    break
-	  fi
-	  prev="$cmd"
-	done
-
-	if test "$prev" != 'sed 50q "$0"'; then
-	  echo_test_string=`eval $prev`
-	  export echo_test_string
-	  exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
-	else
-	  # Oops.  We lost completely, so just stick with echo.
-	  echo=echo
-	fi
-      fi
-    fi
-  fi
-fi
-fi
-
-# Copy echo and quote the copy suitably for passing to libtool from
-# the Makefile, instead of quoting the original, which is used later.
-ECHO=$echo
-if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
-   ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
-fi
-
-
-
-
-tagnames=${tagnames+${tagnames},}CXX
-
-tagnames=${tagnames+${tagnames},}F77
-
-exec 7<&0 </dev/null 6>&1
-
-# Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
-# so uname gets run too.
-ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+# Name of the host.
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
 
 #
 # Initializations.
@@ -723,14 +566,14 @@ cross_compiling=no
 subdirs=
 MFLAGS=
 MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
 
 # Identity of this package.
-PACKAGE_NAME='linbox'
+PACKAGE_NAME='LinBox'
 PACKAGE_TARNAME='linbox'
-PACKAGE_VERSION='1.1.6rc0'
-PACKAGE_STRING='linbox 1.1.6rc0'
+PACKAGE_VERSION='1.2.0'
+PACKAGE_STRING='LinBox 1.2.0'
 PACKAGE_BUGREPORT='linbox-use at googlegroups.com'
+PACKAGE_URL='http://www.linalg.org/'
 
 # Factoring default headers for most tests.
 ac_includes_default="\
@@ -768,128 +611,226 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL
-PATH_SEPARATOR
-PACKAGE_NAME
-PACKAGE_TARNAME
-PACKAGE_VERSION
-PACKAGE_STRING
-PACKAGE_BUGREPORT
-exec_prefix
-prefix
-program_transform_name
-bindir
-sbindir
-libexecdir
-datarootdir
-datadir
-sysconfdir
-sharedstatedir
-localstatedir
-includedir
-oldincludedir
-docdir
-infodir
-htmldir
-dvidir
-pdfdir
-psdir
-libdir
-localedir
-mandir
-DEFS
-ECHO_C
-ECHO_N
-ECHO_T
-LIBS
-build_alias
-host_alias
-target_alias
-INSTALL_PROGRAM
-INSTALL_SCRIPT
-INSTALL_DATA
-am__isrc
-CYGPATH_W
-PACKAGE
-VERSION
-ACLOCAL
-AUTOCONF
-AUTOMAKE
-AUTOHEADER
-MAKEINFO
-install_sh
-STRIP
-INSTALL_STRIP_PROGRAM
-mkdir_p
-AWK
-SET_MAKE
-am__leading_dot
-AMTAR
-am__tar
-am__untar
-MAINTAINER_MODE_TRUE
-MAINTAINER_MODE_FALSE
-MAINT
-AMDEP_TRUE
-AMDEP_FALSE
-AMDEPBACKSLASH
-MKDIR_P
-CC
-CFLAGS
-LDFLAGS
-CPPFLAGS
+ac_subst_vars='LTLIBOBJS
+LIBOBJS
+LINBOX_BUILD_DOC_FALSE
+LINBOX_BUILD_DOC_TRUE
+LINBOX_DOC_PATH
+LINBOX_HAVE_EXPAT_FALSE
+LINBOX_HAVE_EXPAT_TRUE
+EXPAT_LIBS
+EXPAT_CFLAGS
+LINBOX_HAVE_FFLAFLAS_FALSE
+LINBOX_HAVE_FFLAFLAS_TRUE
+BLAS_LIBS
+FFLAFLAS_LOC
+FFLAFLAS_LIBS
+FFLAFLAS_CFLAGS
+LINBOX_HAVE_SAGE_FALSE
+LINBOX_HAVE_SAGE_TRUE
+LINBOX_HAVE_MAPLE_FALSE
+LINBOX_HAVE_MAPLE_TRUE
+MAPLE_VERSION
+MAPLE_HOME
+MAPLE_CFLAGS
+MAPLE_LIBS
+LINBOX_HAVE_LIDIA_FALSE
+LINBOX_HAVE_LIDIA_TRUE
+LIDIA_LIBS
+LIDIA_CFLAGS
+LINBOX_HAVE_SACLIB_FALSE
+LINBOX_HAVE_SACLIB_TRUE
+SACLIB_LIBS
+SACLIB_CFLAGS
+LINBOX_HAVE_GIVARO_FALSE
+LINBOX_HAVE_GIVARO_TRUE
+GIVARO_LIBS
+GIVARO_CFLAGS
+LINBOX_HAVE_NTL_FALSE
+LINBOX_HAVE_NTL_TRUE
+NTL_LIBS
+NTL_CFLAGS
+LINBOX_HAVE_IML_FALSE
+LINBOX_HAVE_IML_TRUE
+IML_LIBS
+IML_CFLAGS
+GMP_VERSION
+GMP_LIBS
+GMP_CFLAGS
+LINBOX_COMPILE_DRIVERS_FALSE
+LINBOX_COMPILE_DRIVERS_TRUE
+OTOOL64
+OTOOL
+LIPO
+NMEDIT
+DSYMUTIL
+MANIFEST_TOOL
+RANLIB
+ac_ct_AR
+AR
+DLLTOOL
+OBJDUMP
+LN_S
+NM
+ac_ct_DUMPBIN
+DUMPBIN
+LD
+FGREP
+SED
 ac_ct_CC
-EXEEXT
-OBJEXT
-CXX
-CXXFLAGS
-ac_ct_CXX
-CPP
-GREP
-EGREP
-build
-build_cpu
-build_vendor
-build_os
-host
-host_cpu
-host_vendor
+CFLAGS
+CC
 host_os
-SED
-LN_S
-ECHO
-AR
-RANLIB
-DSYMUTIL
-NMEDIT
-CXXCPP
-F77
-FFLAGS
-ac_ct_F77
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
 LIBTOOL
-LIBOBJS
-LTLIBOBJS'
+EGREP
+GREP
+CXXCPP
+TESTS_CFLAGS
+DEBUG_CFLAGS
+DEFAULT_CFLAGS
+CCNAM
+OBJEXT
+EXEEXT
+ac_ct_CXX
+CPPFLAGS
+LDFLAGS
+CXXFLAGS
+CXX
+WARN
+WARNINGS_FALSE
+WARNINGS_TRUE
+DBG
+DEBUG_FALSE
+DEBUG_TRUE
+INSIDE_GNOME_COMMON_FALSE
+INSIDE_GNOME_COMMON_TRUE
+AMDEPBACKSLASH
+AMDEP_FALSE
+AMDEP_TRUE
+MAINT
+MAINTAINER_MODE_FALSE
+MAINTAINER_MODE_TRUE
+RM
+am__untar
+am__tar
+AMTAR
+am__leading_dot
+SET_MAKE
+AWK
+mkdir_p
+MKDIR_P
+INSTALL_STRIP_PROGRAM
+STRIP
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+VERSION
+PACKAGE
+CYGPATH_W
+am__isrc
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
 ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_maintainer_mode
+enable_dependency_tracking
+enable_debug
+enable_warnings
+enable_shared
+enable_static
+with_pic
+enable_fast_install
+with_gnu_ld
+with_sysroot
+enable_libtool_lock
+with_default
+with_all
+enable_drivers
+with_gmp
+with_iml
+with_ntl
+with_givaro
+with_saclib
+with_lidia
+with_maple
+enable_sage
+with_fflas_ffpack
+with___with_expat=<path>|yes|no
+with_expat
+enable_optimization
+with_docdir
+with_doxygen
+enable_doc
+'
       ac_precious_vars='build_alias
 host_alias
 target_alias
-CC
-CFLAGS
+CXX
+CXXFLAGS
 LDFLAGS
 LIBS
 CPPFLAGS
-CXX
-CXXFLAGS
 CCC
-CPP
 CXXCPP
-F77
-FFLAGS'
+CC
+CFLAGS'
 
 
 # Initialize some variables set by options.
 ac_init_help=
 ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
 # The variables have the same names as the options, with
 # dashes changed to underlines.
 cache_file=/dev/null
@@ -945,8 +886,9 @@ do
   fi
 
   case $ac_option in
-  *=*)	ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
-  *)	ac_optarg=yes ;;
+  *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *=)   ac_optarg= ;;
+  *)    ac_optarg=yes ;;
   esac
 
   # Accept the important Cygnus configure options, so we can diagnose typos.
@@ -988,13 +930,20 @@ do
     datarootdir=$ac_optarg ;;
 
   -disable-* | --disable-*)
-    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
-      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
-   { (exit 1); exit 1; }; }
-    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
-    eval enable_$ac_feature=no ;;
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=no ;;
 
   -docdir | --docdir | --docdi | --doc | --do)
     ac_prev=docdir ;;
@@ -1007,13 +956,20 @@ do
     dvidir=$ac_optarg ;;
 
   -enable-* | --enable-*)
-    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
-      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
-   { (exit 1); exit 1; }; }
-    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
-    eval enable_$ac_feature=\$ac_optarg ;;
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid feature name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"enable_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval enable_$ac_useropt=\$ac_optarg ;;
 
   -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
   | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -1204,22 +1160,36 @@ do
     ac_init_version=: ;;
 
   -with-* | --with-*)
-    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
-      { echo "$as_me: error: invalid package name: $ac_package" >&2
-   { (exit 1); exit 1; }; }
-    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
-    eval with_$ac_package=\$ac_optarg ;;
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=\$ac_optarg ;;
 
   -without-* | --without-*)
-    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
-      { echo "$as_me: error: invalid package name: $ac_package" >&2
-   { (exit 1); exit 1; }; }
-    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
-    eval with_$ac_package=no ;;
+    expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+      as_fn_error $? "invalid package name: $ac_useropt"
+    ac_useropt_orig=$ac_useropt
+    ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+    case $ac_user_opts in
+      *"
+"with_$ac_useropt"
+"*) ;;
+      *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+	 ac_unrecognized_sep=', ';;
+    esac
+    eval with_$ac_useropt=no ;;
 
   --x)
     # Obsolete; use --with-x.
@@ -1239,26 +1209,26 @@ do
   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
     x_libraries=$ac_optarg ;;
 
-  -*) { echo "$as_me: error: unrecognized option: $ac_option
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; }
+  -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
     ;;
 
   *=*)
     ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
-      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
-   { (exit 1); exit 1; }; }
+    case $ac_envvar in #(
+      '' | [0-9]* | *[!_$as_cr_alnum]* )
+      as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+    esac
     eval $ac_envvar=\$ac_optarg
     export $ac_envvar ;;
 
   *)
     # FIXME: should be removed in autoconf 3.0.
-    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
     expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
-      echo "$as_me: WARNING: invalid host type: $ac_option" >&2
-    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+      $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
     ;;
 
   esac
@@ -1266,23 +1236,36 @@ done
 
 if test -n "$ac_prev"; then
   ac_option=--`echo $ac_prev | sed 's/_/-/g'`
-  { echo "$as_me: error: missing argument to $ac_option" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+  case $enable_option_checking in
+    no) ;;
+    fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+    *)     $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+  esac
 fi
 
-# Be sure to have absolute directory names.
+# Check all directory arguments for consistency.
 for ac_var in	exec_prefix prefix bindir sbindir libexecdir datarootdir \
 		datadir sysconfdir sharedstatedir localstatedir includedir \
 		oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
 		libdir localedir mandir
 do
   eval ac_val=\$$ac_var
+  # Remove trailing slashes.
+  case $ac_val in
+    */ )
+      ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+      eval $ac_var=\$ac_val;;
+  esac
+  # Be sure to have absolute directory names.
   case $ac_val in
     [\\/$]* | ?:[\\/]* )  continue;;
     NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
   esac
-  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
 done
 
 # There might be people who depend on the old broken behavior: `$host'
@@ -1296,8 +1279,8 @@ target=$target_alias
 if test "x$host_alias" != x; then
   if test "x$build_alias" = x; then
     cross_compiling=maybe
-    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
+    $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,23 +1295,21 @@ test "$silent" = yes && exec 6>/dev/null
 ac_pwd=`pwd` && test -n "$ac_pwd" &&
 ac_ls_di=`ls -di .` &&
 ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
-  { echo "$as_me: error: Working directory cannot be determined" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "working directory cannot be determined"
 test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
-  { echo "$as_me: error: pwd does not report name of working directory" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "pwd does not report name of working directory"
 
 
 # Find the source files, if location was not specified.
 if test -z "$srcdir"; then
   ac_srcdir_defaulted=yes
   # Try the directory containing this script, then the parent directory.
-  ac_confdir=`$as_dirname -- "$0" ||
-$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$0" : 'X\(//\)[^/]' \| \
-	 X"$0" : 'X\(//\)$' \| \
-	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$0" |
+  ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_myself" : 'X\(//\)[^/]' \| \
+	 X"$as_myself" : 'X\(//\)$' \| \
+	 X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
     sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
 	    s//\1/
 	    q
@@ -1355,13 +1336,11 @@ else
 fi
 if test ! -r "$srcdir/$ac_unique_file"; then
   test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
-  { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
-   { (exit 1); exit 1; }; }
+  as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
 fi
 ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
 ac_abs_confdir=`(
-	cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
-   { (exit 1); exit 1; }; }
+	cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
 	pwd)`
 # When building in place, set srcdir=.
 if test "$ac_abs_confdir" = "$ac_pwd"; then
@@ -1387,7 +1366,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 linbox 1.1.6rc0 to adapt to many kinds of systems.
+\`configure' configures LinBox 1.2.0 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1401,7 +1380,7 @@ Configuration:
       --help=short        display options specific to this package
       --help=recursive    display the short help of all the included packages
   -V, --version           display version information and exit
-  -q, --quiet, --silent   do not print \`checking...' messages
+  -q, --quiet, --silent   do not print \`checking ...' messages
       --cache-file=FILE   cache test results in FILE [disabled]
   -C, --config-cache      alias for \`--cache-file=config.cache'
   -n, --no-create         do not create output files
@@ -1409,9 +1388,9 @@ Configuration:
 
 Installation directories:
   --prefix=PREFIX         install architecture-independent files in PREFIX
-			  [$ac_default_prefix]
+                          [$ac_default_prefix]
   --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
-			  [PREFIX]
+                          [PREFIX]
 
 By default, \`make install' will install all the files in
 \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
@@ -1421,25 +1400,25 @@ for instance \`--prefix=\$HOME'.
 For better control, use the options below.
 
 Fine tuning of the installation directories:
-  --bindir=DIR           user executables [EPREFIX/bin]
-  --sbindir=DIR          system admin executables [EPREFIX/sbin]
-  --libexecdir=DIR       program executables [EPREFIX/libexec]
-  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
-  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
-  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
-  --libdir=DIR           object code libraries [EPREFIX/lib]
-  --includedir=DIR       C header files [PREFIX/include]
-  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
-  --datarootdir=DIR      read-only arch.-independent data root [PREFIX/share]
-  --datadir=DIR          read-only architecture-independent data [DATAROOTDIR]
-  --infodir=DIR          info documentation [DATAROOTDIR/info]
-  --localedir=DIR        locale-dependent data [DATAROOTDIR/locale]
-  --mandir=DIR           man documentation [DATAROOTDIR/man]
-  --docdir=DIR           documentation root [DATAROOTDIR/doc/linbox]
-  --htmldir=DIR          html documentation [DOCDIR]
-  --dvidir=DIR           dvi documentation [DOCDIR]
-  --pdfdir=DIR           pdf documentation [DOCDIR]
-  --psdir=DIR            ps documentation [DOCDIR]
+  --bindir=DIR            user executables [EPREFIX/bin]
+  --sbindir=DIR           system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR        program executables [EPREFIX/libexec]
+  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --libdir=DIR            object code libraries [EPREFIX/lib]
+  --includedir=DIR        C header files [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
+  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
+  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
+  --infodir=DIR           info documentation [DATAROOTDIR/info]
+  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
+  --mandir=DIR            man documentation [DATAROOTDIR/man]
+  --docdir=DIR            documentation root [DATAROOTDIR/doc/linbox]
+  --htmldir=DIR           html documentation [DOCDIR]
+  --dvidir=DIR            dvi documentation [DOCDIR]
+  --pdfdir=DIR            pdf documentation [DOCDIR]
+  --psdir=DIR             ps documentation [DOCDIR]
 _ACEOF
 
   cat <<\_ACEOF
@@ -1457,50 +1436,139 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of linbox 1.1.6rc0:";;
+     short | recursive ) echo "Configuration of LinBox 1.2.0:";;
    esac
   cat <<\_ACEOF
 
 Optional Features:
+  --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   --enable-maintainer-mode  enable make rules and dependencies not useful
 			  (and sometimes confusing) to the casual installer
   --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-shared[=PKGS]  build shared libraries [default=yes]
   --enable-static[=PKGS]  build static libraries [default=yes]
   --enable-fast-install[=PKGS]
                           optimize for fast installation [default=yes]
   --disable-libtool-lock  avoid locking (might break parallel builds)
+  --enable-drivers        Enable the compilation of the drivers
+  --enable-shared         Check for shared compilation (needed by
+                          --with-maple)
+  --enable-sage           Enable the compilation of the sage interface
+  --enable-optimization   Enable run time optimization in LinBox code (only
+                          Strassen matrix threshold for now)
+  --enable-doc            Enable building documentation
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
   --with-pic              try to use only PIC/non-PIC objects [default=use
                           both]
-  --with-tags[=TAGS]      include additional configurations [automatic]
+  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
+  --with-sysroot=DIR Search for dependent libraries within DIR
+                        (or the compiler's sysroot if not specified).
+  --with-default=<path>   Add <path> to the default path for external package
+                          checking. Set as default with /usr and /usr/local.
+  --with-all=<path>|yes|no
+                          Use all external packages. If the argument is no,
+                          you not sure that all libraries are reachable with
+                          the default path. If the argument is yes or <empty>,
+                          that means that all libraries are reachable with the
+                          default path. Otherwise add <path> to default path
+                          and enable all external packages.
+  --with-gmp= <path>|yes  Use GMP library. This library is mandatory for
+                          LinBox compilation. If argument is yes or <empty>
+                          that means the library is reachable with the
+                          standard search path "/usr" or "/usr/local" (set as
+                          default). Otherwise you give the <path> to the
+                          directory which contain the library.
+  --with-iml=<path>|yes   Use IML library. This library is (not yet) mandatory
+                          for LinBox compilation. If argument is yes or
+                          <empty> or <bad> :) that means the library is
+                          reachable with the standard search path (/usr or
+                          /usr/local). Otherwise you give the <path> to the
+                          directory which contains the library.
+  --with-ntl=<path>|yes|no
+                          Use NTL library. If argument is no, you do not have
+                          the library installed on your machine (set as
+                          default). If argument is yes or <empty> that means
+                          the library is reachable with the standard search
+                          path (/usr or /usr/local). Otherwise you give the
+                          <path> to the directory which contain the library.
+  --with-givaro=<path>|yes
+                          Use Givaro library. This library is mandatory for
+                          LinBox compilation. If argument is yes or <empty>
+                          that means the library is reachable with the
+                          standard search path (/usr or /usr/local). Otherwise
+                          you give the <path> to the directory which contains
+                          the library.
+  --with-saclib=<path>|yes|no
+                          Use Saclib library. If argument is no, you do not
+                          have the library installed on your machine (set as
+                          default). If argument is yes or <empty> that means
+                          the library is reachable with the standard search
+                          path (/usr or /usr/local). Otherwise you give the
+                          <path> to the directory which contain the library.
+  --with-lidia=<path>|yes|no
+                          Use Lidia library. If argument is no, you do not
+                          have the library installed on your machine (set as
+                          default). If argument is yes or <empty> that means
+                          the library is reachable with the standard search
+                          path (/usr or /usr/local). Otherwise you give the
+                          <path> to the directory which contain the library.
+  --with-maple=<path>|yes|no
+                          Use Maple library. If argument is no, you do not
+                          have the library installed on your machine (set as
+                          default). If argument is yes or <empty> that means
+                          the library is well installed and so reachable.
+                          Otherwise you give the <path> to the directory which
+                          contains the Software.
+  --with-fflas-ffpack=<path>|yes
+                          Use Fflas-Ffpack library. This library is mandatory
+                          for LinBox compilation. If argument is yes or
+                          <empty> or <bad> :) that means the library is
+                          reachable with the standard search path (/usr or
+                          /usr/local). Otherwise you give the <path> to the
+                          directory which contains the library. Available at
+                          "http://linalg.org/projects/fflas-ffpack".
+
+Use Expat library. If argument is no, you do not
+                             have the library installed on your machine (set
+			     as default). If argument is yes or <empty> that
+			     means the library is reachable with the standard
+			     search path (/usr or /usr/local). Otherwise you
+			     give the <path> to the directory which contain the
+			     library.
+
+# Check whether --with---with-expat=<path>|yes|no was given.
+if test "${with___with_expat=<path>|yes|no+set}" = set; then :
+  withval=$with___with_expat=<path>|yes|no;
+fi
+
+  --with-docdir=<path>    Where the LinBox documentation should be installed
+  --with-doxygen=<path>   Give the path to Doxygen. Note: --enable-doc needed
 
 Some influential environment variables:
-  CC          C compiler command
-  CFLAGS      C compiler flags
+  CXX         C++ compiler command
+  CXXFLAGS    C++ compiler flags
   LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
               nonstandard directory <lib dir>
   LIBS        libraries to pass to the linker, e.g. -l<library>
-  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
               you have headers in a nonstandard directory <include dir>
-  CXX         C++ compiler command
-  CXXFLAGS    C++ compiler flags
-  CPP         C preprocessor
   CXXCPP      C++ preprocessor
-  F77         Fortran 77 compiler command
-  FFLAGS      Fortran 77 compiler flags
+  CC          C compiler command
+  CFLAGS      C compiler flags
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
 
 Report bugs to <linbox-use at googlegroups.com>.
+LinBox home page: <http://www.linalg.org/>.
 _ACEOF
 ac_status=$?
 fi
@@ -1508,15 +1576,17 @@ fi
 if test "$ac_init_help" = "recursive"; then
   # If there are subdirs, report their specific --help.
   for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
-    test -d "$ac_dir" || continue
+    test -d "$ac_dir" ||
+      { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+      continue
     ac_builddir=.
 
 case "$ac_dir" in
 .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
 *)
-  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
   # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
   case $ac_top_builddir_sub in
   "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
   *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
@@ -1552,7 +1622,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
       echo &&
       $SHELL "$ac_srcdir/configure" --help=recursive
     else
-      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+      $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
     fi || ac_status=$?
     cd "$ac_pwd" || { ac_status=$?; break; }
   done
@@ -1561,737 +1631,1171 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-linbox configure 1.1.6rc0
-generated by GNU Autoconf 2.61
+LinBox configure 1.2.0
+generated by GNU Autoconf 2.68
 
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
   exit
 fi
-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 linbox $as_me 1.1.6rc0, which was
-generated by GNU Autoconf 2.61.  Invocation command line was
 
-  $ $0 $@
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
 
-_ACEOF
-exec 5>>config.log
+# ac_fn_cxx_try_compile LINENO
+# ----------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_compile ()
 {
-cat <<_ASUNAME
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
-/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+	ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
 
-/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
-/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
-/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
-/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
-/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+} # ac_fn_cxx_try_compile
 
-_ASUNAME
+# ac_fn_cxx_try_run LINENO
+# ------------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_cxx_try_run ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: program exited with status $ac_status" >&5
+       $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  echo "PATH: $as_dir"
-done
-IFS=$as_save_IFS
+       ac_retval=$ac_status
+fi
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
 
-} >&5
-
-cat >&5 <<_ACEOF
-
-
-## ----------- ##
-## Core tests. ##
-## ----------- ##
-
-_ACEOF
+} # ac_fn_cxx_try_run
 
+# ac_fn_cxx_try_cpp LINENO
+# ------------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_cpp ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } > conftest.i && {
+	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-# Keep a trace of the command line.
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Strip out --silent because we don't want to record it for future runs.
-# Also quote any args containing shell meta-characters.
-# Make two passes to allow for proper duplicate-argument suppression.
-ac_configure_args=
-ac_configure_args0=
-ac_configure_args1=
-ac_must_keep_next=false
-for ac_pass in 1 2
-do
-  for ac_arg
-  do
-    case $ac_arg in
-    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
-    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-    | -silent | --silent | --silen | --sile | --sil)
-      continue ;;
-    *\'*)
-      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
-    esac
-    case $ac_pass in
-    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
-    2)
-      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
-      if test $ac_must_keep_next = true; then
-	ac_must_keep_next=false # Got value, back to normal.
-      else
-	case $ac_arg in
-	  *=* | --config-cache | -C | -disable-* | --disable-* \
-	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
-	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
-	  | -with-* | --with-* | -without-* | --without-* | --x)
-	    case "$ac_configure_args0 " in
-	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
-	    esac
-	    ;;
-	  -* ) ac_must_keep_next=true ;;
-	esac
-      fi
-      ac_configure_args="$ac_configure_args '$ac_arg'"
-      ;;
-    esac
-  done
-done
-$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
-$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+    ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
 
-# When interrupted or exit'd, cleanup temporary files, and complete
-# config.log.  We remove comments because anyway the quotes in there
-# would cause problems or look ugly.
-# WARNING: Use '\'' to represent an apostrophe within the trap.
-# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
-trap 'exit_status=$?
-  # Save into config.log some information that might help in debugging.
-  {
-    echo
+} # ac_fn_cxx_try_cpp
 
-    cat <<\_ASBOX
-## ---------------- ##
-## Cache variables. ##
-## ---------------- ##
-_ASBOX
-    echo
-    # The following way of writing the cache mishandles newlines in values,
-(
-  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
-    eval ac_val=\$$ac_var
-    case $ac_val in #(
-    *${as_nl}*)
-      case $ac_var in #(
-      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
-      esac
-      case $ac_var in #(
-      _ | IFS | as_nl) ;; #(
-      *) $as_unset $ac_var ;;
-      esac ;;
-    esac
-  done
-  (set) 2>&1 |
-    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
-    *${as_nl}ac_space=\ *)
-      sed -n \
-	"s/'\''/'\''\\\\'\'''\''/g;
-	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
-      ;; #(
-    *)
-      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
-      ;;
-    esac |
-    sort
-)
-    echo
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext
+  if { { ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-    cat <<\_ASBOX
-## ----------------- ##
-## Output variables. ##
-## ----------------- ##
-_ASBOX
-    echo
-    for ac_var in $ac_subst_vars
-    do
-      eval ac_val=\$$ac_var
-      case $ac_val in
-      *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
-      esac
-      echo "$ac_var='\''$ac_val'\''"
-    done | sort
-    echo
+	ac_retval=1
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
 
-    if test -n "$ac_subst_files"; then
-      cat <<\_ASBOX
-## ------------------- ##
-## File substitutions. ##
-## ------------------- ##
-_ASBOX
-      echo
-      for ac_var in $ac_subst_files
-      do
-	eval ac_val=\$$ac_var
-	case $ac_val in
-	*\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
-	esac
-	echo "$ac_var='\''$ac_val'\''"
-      done | sort
-      echo
-    fi
+} # ac_fn_c_try_compile
 
-    if test -s confdefs.h; then
-      cat <<\_ASBOX
-## ----------- ##
-## confdefs.h. ##
-## ----------- ##
-_ASBOX
-      echo
-      cat confdefs.h
-      echo
-    fi
-    test "$ac_signal" != 0 &&
-      echo "$as_me: caught signal $ac_signal"
-    echo "$as_me: exit $exit_status"
-  } >&5
-  rm -f core *.core core.conftest.* &&
-    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
-    exit $exit_status
-' 0
-for ac_signal in 1 2 13 15; do
-  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
-done
-ac_signal=0
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 $as_test_x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -f -r conftest* confdefs.h
+	ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
 
-# Predefined preprocessor variables.
+} # ac_fn_c_try_link
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_NAME "$PACKAGE_NAME"
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
 _ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
+} # ac_fn_c_check_header_compile
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
-_ACEOF
-
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $2 innocuous_$2
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_VERSION "$PACKAGE_VERSION"
-_ACEOF
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $2 (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
 
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_STRING "$PACKAGE_STRING"
-_ACEOF
+#undef $2
 
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+int
+main ()
+{
+return $2 ();
+  ;
+  return 0;
+}
 _ACEOF
-
-
-# Let the site file select an alternate cache file if it wants to.
-# Prefer explicitly selected file to automatically selected ones.
-if test -n "$CONFIG_SITE"; then
-  set x "$CONFIG_SITE"
-elif test "x$prefix" != xNONE; then
-  set x "$prefix/share/config.site" "$prefix/etc/config.site"
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$3=yes"
 else
-  set x "$ac_default_prefix/share/config.site" \
-	"$ac_default_prefix/etc/config.site"
+  eval "$3=no"
 fi
-shift
-for ac_site_file
-do
-  if test -r "$ac_site_file"; then
-    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
-echo "$as_me: loading site script $ac_site_file" >&6;}
-    sed 's/^/| /' "$ac_site_file" >&5
-    . "$ac_site_file"
-  fi
-done
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
-if test -r "$cache_file"; then
-  # Some versions of bash will fail to source /dev/null (special
-  # files actually), so we avoid doing that.
-  if test -f "$cache_file"; then
-    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
-echo "$as_me: loading cache $cache_file" >&6;}
-    case $cache_file in
-      [\\/]* | ?:[\\/]* ) . "$cache_file";;
-      *)                      . "./$cache_file";;
-    esac
+} # ac_fn_c_check_func
+
+# ac_fn_cxx_try_link LINENO
+# -------------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
   fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+	 test -z "$ac_cxx_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+	 test "$cross_compiling" = yes ||
+	 $as_test_x conftest$ac_exeext
+       }; then :
+  ac_retval=0
 else
-  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
-echo "$as_me: creating cache $cache_file" >&6;}
-  >$cache_file
-fi
-
-# Check that the precious variables saved in the cache have kept the same
-# value.
-ac_cache_corrupted=false
-for ac_var in $ac_precious_vars; do
-  eval ac_old_set=\$ac_cv_env_${ac_var}_set
-  eval ac_new_set=\$ac_env_${ac_var}_set
-  eval ac_old_val=\$ac_cv_env_${ac_var}_value
-  eval ac_new_val=\$ac_env_${ac_var}_value
-  case $ac_old_set,$ac_new_set in
-    set,)
-      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
-      ac_cache_corrupted=: ;;
-    ,set)
-      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
-      ac_cache_corrupted=: ;;
-    ,);;
-    *)
-      if test "x$ac_old_val" != "x$ac_new_val"; then
-	{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
-echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
-	{ echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
-echo "$as_me:   former value:  $ac_old_val" >&2;}
-	{ echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
-echo "$as_me:   current value: $ac_new_val" >&2;}
-	ac_cache_corrupted=:
-      fi;;
-  esac
-  # Pass precious variables to config.status.
-  if test "$ac_new_set" = set; then
-    case $ac_new_val in
-    *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
-    *) ac_arg=$ac_var=$ac_new_val ;;
-    esac
-    case " $ac_configure_args " in
-      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
-      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
-    esac
-  fi
-done
-if $ac_cache_corrupted; then
-  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
-echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
-   { (exit 1); exit 1; }; }
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_retval=1
 fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
 
+} # ac_fn_cxx_try_link
 
+# ac_fn_cxx_compute_int LINENO EXPR VAR INCLUDES
+# ----------------------------------------------
+# Tries to find the compile-time value of EXPR in a program that includes
+# INCLUDES, setting VAR accordingly. Returns whether the value could be
+# computed
+ac_fn_cxx_compute_int ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if test "$cross_compiling" = yes; then
+    # Depending upon the size, compute the lo and hi bounds.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= 0)];
+test_array [0] = 0
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_hi=$ac_mid; break
+else
+  as_fn_arith $ac_mid + 1 && ac_lo=$as_val
+			if test $ac_lo -le $ac_mid; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) < 0)];
+test_array [0] = 0
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) >= $ac_mid)];
+test_array [0] = 0
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_lo=$ac_mid; break
+else
+  as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
+			if test $ac_mid -le $ac_hi; then
+			  ac_lo= ac_hi=
+			  break
+			fi
+			as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  ac_lo= ac_hi=
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+static int test_array [1 - 2 * !(($2) <= $ac_mid)];
+test_array [0] = 0
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_hi=$ac_mid
+else
+  as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in #((
+?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
+'') ac_retval=1 ;;
+esac
+  else
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+static long int longval () { return $2; }
+static unsigned long int ulongval () { return $2; }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
 
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    return 1;
+  if (($2) < 0)
+    {
+      long int i = longval ();
+      if (i != ($2))
+	return 1;
+      fprintf (f, "%ld", i);
+    }
+  else
+    {
+      unsigned long int i = ulongval ();
+      if (i != ($2))
+	return 1;
+      fprintf (f, "%lu", i);
+    }
+  /* Do not output a trailing newline, as this causes \r\n confusion
+     on some platforms.  */
+  return ferror (f) || fclose (f) != 0;
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_run "$LINENO"; then :
+  echo >>conftest.val; read $3 <conftest.val; ac_retval=0
+else
+  ac_retval=1
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f conftest.val
 
+  fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
 
+} # ac_fn_cxx_compute_int
 
+# ac_fn_cxx_check_header_mongrel LINENO HEADER VAR INCLUDES
+# ---------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_cxx_check_header_mongrel ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  if eval \${$3+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+  # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_header_compiler=yes
+else
+  ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
 
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <$2>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+  ac_header_preproc=yes
+else
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
 
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in #((
+  yes:no: )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+    ;;
+  no:yes:* )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2:     check for missing prerequisite headers?" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## ------------------------------------------ ##
+## Report this to linbox-use at googlegroups.com ##
+## ------------------------------------------ ##"
+     ) | sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
+} # ac_fn_cxx_check_header_mongrel
+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 LinBox $as_me 1.2.0, which was
+generated by GNU Autoconf 2.68.  Invocation command line was
 
+  $ $0 $@
 
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
 
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
 
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
 
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
 
+_ASUNAME
 
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    $as_echo "PATH: $as_dir"
+  done
+IFS=$as_save_IFS
 
+} >&5
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
+cat >&5 <<_ACEOF
 
-am__api_version='1.10'
 
-ac_aux_dir=
-for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
-  if test -f "$ac_dir/install-sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install-sh -c"
-    break
-  elif test -f "$ac_dir/install.sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install.sh -c"
-    break
-  elif test -f "$ac_dir/shtool"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/shtool install -c"
-    break
-  fi
-done
-if test -z "$ac_aux_dir"; then
-  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
-echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
-   { (exit 1); exit 1; }; }
-fi
+## ----------- ##
+## Core tests. ##
+## ----------- ##
 
-# These three variables are undocumented and unsupported,
-# and are intended to be withdrawn in a future Autoconf release.
-# They can cause serious problems if a builder's source tree is in a directory
-# whose full name contains unusual characters.
-ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
-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.
+_ACEOF
 
 
-# Find a good install program.  We prefer a C program (faster),
-# so one script is as good as another.  But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AmigaOS /C/install, which installs bootblocks on floppy discs
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# OS/2's system install, which has a completely different semantic
-# ./install, which can be erroneously created by make from ./install.sh.
-{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
-if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  # Account for people who put trailing slashes in PATH elements.
-case $as_dir/ in
-  ./ | .// | /cC/* | \
-  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
-  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
-  /usr/ucb/* ) ;;
-  *)
-    # OSF1 and SCO ODT 3.0 have their own names for install.
-    # Don't use installbsd from OSF since it installs stuff as root
-    # 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 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.
-	    :
-	  elif test $ac_prog = install &&
-	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-	    # program-specific install script used by HP pwplus--don't use.
-	    :
-	  else
-	    ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
-	    break 3
-	  fi
-	fi
-      done
-    done
-    ;;
-esac
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *\'*)
+      ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+    2)
+      as_fn_append ac_configure_args1 " '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+	ac_must_keep_next=false # Got value, back to normal.
+      else
+	case $ac_arg in
+	  *=* | --config-cache | -C | -disable-* | --disable-* \
+	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+	  | -with-* | --with-* | -without-* | --without-* | --x)
+	    case "$ac_configure_args0 " in
+	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+	    esac
+	    ;;
+	  -* ) ac_must_keep_next=true ;;
+	esac
+      fi
+      as_fn_append ac_configure_args " '$ac_arg'"
+      ;;
+    esac
+  done
 done
-IFS=$as_save_IFS
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
 
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
 
-fi
-  if test "${ac_cv_path_install+set}" = set; then
-    INSTALL=$ac_cv_path_install
-  else
-    # As a last resort, use the slow shell script.  Don't cache a
-    # value for INSTALL within a source directory, because that will
-    # break other packages using the cache if that directory is
-    # removed, or if the value is a relative name.
-    INSTALL=$ac_install_sh
-  fi
-fi
-{ echo "$as_me:$LINENO: result: $INSTALL" >&5
-echo "${ECHO_T}$INSTALL" >&6; }
+    $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+(
+  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) { eval $ac_var=; unset $ac_var;} ;;
+      esac ;;
+    esac
+  done
+  (set) 2>&1 |
+    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      sed -n \
+	"s/'\''/'\''\\\\'\'''\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+      ;; #(
+    *)
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+)
+    echo
 
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+    $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=\$$ac_var
+      case $ac_val in
+      *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      esac
+      $as_echo "$ac_var='\''$ac_val'\''"
+    done | sort
+    echo
 
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+    if test -n "$ac_subst_files"; then
+      $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+      echo
+      for ac_var in $ac_subst_files
+      do
+	eval ac_val=\$$ac_var
+	case $ac_val in
+	*\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+	esac
+	$as_echo "$ac_var='\''$ac_val'\''"
+      done | sort
+      echo
+    fi
 
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+    if test -s confdefs.h; then
+      $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+      echo
+      cat confdefs.h
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      $as_echo "$as_me: caught signal $ac_signal"
+    $as_echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core core.conftest.* &&
+    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
 
-{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5
-echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; }
-# Just in case
-sleep 1
-echo timestamp > conftest.file
-# 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`
-   if test "$*" = "X"; then
-      # -L didn't work.
-      set X `ls -t $srcdir/configure conftest.file`
-   fi
-   rm -f conftest.file
-   if test "$*" != "X $srcdir/configure conftest.file" \
-      && test "$*" != "X conftest.file $srcdir/configure"; then
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
 
-      # If neither matched, then we have a broken ls.  This can happen
-      # if, for instance, CONFIG_SHELL is bash and it inherits a
-      # broken ls alias from the environment.  This has actually
-      # happened.  Such a system could not be considered "sane".
-      { { echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
-alias in your environment" >&5
-echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
-alias in your environment" >&2;}
-   { (exit 1); exit 1; }; }
-   fi
+$as_echo "/* confdefs.h */" > confdefs.h
 
-   test "$2" = conftest.file
-   )
-then
-   # Ok.
-   :
-else
-   { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
-Check your system clock" >&5
-echo "$as_me: error: newly created file is older than distributed files!
-Check your system clock" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-{ echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-test "$program_prefix" != NONE &&
-  program_transform_name="s&^&$program_prefix&;$program_transform_name"
-# Use a double $ so make ignores it.
-test "$program_suffix" != NONE &&
-  program_transform_name="s&\$&$program_suffix&;$program_transform_name"
-# Double any \ or $.  echo might interpret backslashes.
-# By default was `s,x,x', remove it if useless.
-cat <<\_ACEOF >conftest.sed
-s/[\\$]/&&/g;s/;s,x,x,$//
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
 _ACEOF
-program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
-rm -f conftest.sed
 
-# expand $ac_aux_dir to an absolute path
-am_aux_dir=`cd $ac_aux_dir && pwd`
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
 
-test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
-# Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
-  am_missing_run="$MISSING --run "
-else
-  am_missing_run=
-  { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
-echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
-fi
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
 
-{ echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
-echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; }
-if test -z "$MKDIR_P"; then
-  if test "${ac_cv_path_mkdir+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+  # We do not want a PATH search for config.site.
+  case $CONFIG_SITE in #((
+    -*)  ac_site_file1=./$CONFIG_SITE;;
+    */*) ac_site_file1=$CONFIG_SITE;;
+    *)   ac_site_file1=./$CONFIG_SITE;;
+  esac
+elif test "x$prefix" != xNONE; then
+  ac_site_file1=$prefix/share/config.site
+  ac_site_file2=$prefix/etc/config.site
 else
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+  ac_site_file1=$ac_default_prefix/share/config.site
+  ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
 do
-  IFS=$as_save_IFS
-  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
-	   case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
-	     'mkdir (GNU coreutils) '* | \
-	     'mkdir (coreutils) '* | \
-	     'mkdir (fileutils) '4.1*)
-	       ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
-	       break 3;;
-	   esac
-	 done
-       done
+  test "x$ac_site_file" = xNONE && continue
+  if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file" \
+      || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
+  fi
 done
-IFS=$as_save_IFS
 
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special files
+  # actually), so we avoid doing that.  DJGPP emulates it as a regular file.
+  if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . "$cache_file";;
+      *)                      . "./$cache_file";;
+    esac
+  fi
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
 fi
 
-  if test "${ac_cv_path_mkdir+set}" = set; then
-    MKDIR_P="$ac_cv_path_mkdir -p"
-  else
-    # As a last resort, use the slow shell script.  Don't cache a
-    # value for MKDIR_P within a source directory, because that will
-    # break other packages using the cache if that directory is
-    # removed, or if the value is a relative name.
-    test -d ./--version && rmdir ./--version
-    MKDIR_P="$ac_install_sh -d"
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val=\$ac_cv_env_${ac_var}_value
+  eval ac_new_val=\$ac_env_${ac_var}_value
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+	# differences in whitespace do not lead to failure.
+	ac_old_val_w=`echo x $ac_old_val`
+	ac_new_val_w=`echo x $ac_new_val`
+	if test "$ac_old_val_w" != "$ac_new_val_w"; then
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+	  ac_cache_corrupted=:
+	else
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+	  eval $ac_var=\$ac_old_val
+	fi
+	{ $as_echo "$as_me:${as_lineno-$LINENO}:   former value:  \`$ac_old_val'" >&5
+$as_echo "$as_me:   former value:  \`$ac_old_val'" >&2;}
+	{ $as_echo "$as_me:${as_lineno-$LINENO}:   current value: \`$ac_new_val'" >&5
+$as_echo "$as_me:   current value: \`$ac_new_val'" >&2;}
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+    esac
   fi
+done
+if $ac_cache_corrupted; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+  { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
 fi
-{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5
-echo "${ECHO_T}$MKDIR_P" >&6; }
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
 
-mkdir_p="$MKDIR_P"
-case $mkdir_p in
-  [\\/$]* | ?:[\\/]*) ;;
-  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-for ac_prog in gawk mawk nawk awk
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_AWK+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$AWK"; then
-  ac_cv_prog_AWK="$AWK" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-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
-    ac_cv_prog_AWK="$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
+
+
+ac_aux_dir=
+for ac_dir in build-aux "$srcdir"/build-aux; do
+  if test -f "$ac_dir/install-sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f "$ac_dir/install.sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f "$ac_dir/shtool"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
   fi
 done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-AWK=$ac_cv_prog_AWK
-if test -n "$AWK"; then
-  { echo "$as_me:$LINENO: result: $AWK" >&5
-echo "${ECHO_T}$AWK" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+if test -z "$ac_aux_dir"; then
+  as_fn_error $? "cannot find install-sh, install.sh, or shtool in build-aux \"$srcdir\"/build-aux" "$LINENO" 5
 fi
 
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
+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.
+
 
-  test -n "$AWK" && break
-done
+am__api_version='1.10'
 
-{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
-echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; }
-set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if ${ac_cv_path_install+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.make <<\_ACEOF
-SHELL = /bin/sh
-all:
-	@echo '@@@%%%=$(MAKE)=@@@%%%'
-_ACEOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-case `${MAKE-make} -f conftest.make 2>/dev/null` in
-  *@@@%%%=?*=@@@%%%*)
-    eval ac_cv_prog_make_${ac_make}_set=yes;;
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+  ./ | .// | /[cC]/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+  /usr/ucb/* ) ;;
   *)
-    eval ac_cv_prog_make_${ac_make}_set=no;;
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # 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 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.
+	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
+	  else
+	    rm -rf conftest.one conftest.two conftest.dir
+	    echo one > conftest.one
+	    echo two > conftest.two
+	    mkdir conftest.dir
+	    if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+	      test -s conftest.one && test -s conftest.two &&
+	      test -s conftest.dir/conftest.one &&
+	      test -s conftest.dir/conftest.two
+	    then
+	      ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+	      break 3
+	    fi
+	  fi
+	fi
+      done
+    done
+    ;;
 esac
-rm -f conftest.make
-fi
-if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
-  { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-  SET_MAKE=
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-  SET_MAKE="MAKE=${MAKE-make}"
-fi
 
-rm -rf .tst 2>/dev/null
-mkdir .tst 2>/dev/null
-if test -d .tst; then
-  am__leading_dot=.
-else
-  am__leading_dot=_
-fi
-rmdir .tst 2>/dev/null
+  done
+IFS=$as_save_IFS
 
-if test "`cd $srcdir && pwd`" != "`pwd`"; then
-  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
-  # is not polluted with repeated "-I."
-  am__isrc=' -I$(srcdir)'
-  # test to see if srcdir already configured
-  if test -f $srcdir/config.status; then
-    { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
-echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
-   { (exit 1); exit 1; }; }
-  fi
-fi
+rm -rf conftest.one conftest.two conftest.dir
 
-# test whether we have cygpath
-if test -z "$CYGPATH_W"; then
-  if (cygpath --version) >/dev/null 2>/dev/null; then
-    CYGPATH_W='cygpath -w'
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
   else
-    CYGPATH_W=echo
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    INSTALL=$ac_install_sh
   fi
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
 
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
 
-# Define the identity of the package.
- PACKAGE='linbox'
- VERSION='1.1.6rc0'
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE "$PACKAGE"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define VERSION "$VERSION"
-_ACEOF
-
-# Some tools Automake needs.
-
-ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
-
-
-AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
 
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
-AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# 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`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$*" != "X $srcdir/configure conftest.file" \
+      && test "$*" != "X conftest.file $srcdir/configure"; then
 
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      as_fn_error $? "ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" "$LINENO" 5
+   fi
 
-AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+   test "$2" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   as_fn_error $? "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+test "$program_prefix" != NONE &&
+  program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+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`
 
-MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
 
 install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
 
@@ -2303,10 +2807,10 @@ if test "$cross_compiling" != no; then
   if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
 set dummy ${ac_tool_prefix}strip; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_STRIP+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$STRIP"; then
   ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
@@ -2316,25 +2820,25 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    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
     ac_cv_prog_STRIP="${ac_tool_prefix}strip"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 STRIP=$ac_cv_prog_STRIP
 if test -n "$STRIP"; then
-  { echo "$as_me:$LINENO: result: $STRIP" >&5
-echo "${ECHO_T}$STRIP" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
@@ -2343,10 +2847,10 @@ if test -z "$ac_cv_prog_STRIP"; then
   ac_ct_STRIP=$STRIP
   # Extract the first word of "strip", so it can be a program name with args.
 set dummy strip; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
   if test -n "$ac_ct_STRIP"; then
   ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
@@ -2356,25 +2860,25 @@ for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    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
     ac_cv_prog_ac_ct_STRIP="strip"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
 if test -n "$ac_ct_STRIP"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
-echo "${ECHO_T}$ac_ct_STRIP" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
   if test "x$ac_ct_STRIP" = x; then
@@ -2382,12 +2886,8 @@ fi
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
     STRIP=$ac_ct_STRIP
@@ -2399,6 +2899,186 @@ fi
 fi
 INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+if test -z "$MKDIR_P"; then
+  if ${ac_cv_path_mkdir+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+  IFS=$as_save_IFS
+  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
+	   case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+	     'mkdir (GNU coreutils) '* | \
+	     'mkdir (coreutils) '* | \
+	     'mkdir (fileutils) '4.1*)
+	       ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+	       break 3;;
+	   esac
+	 done
+       done
+  done
+IFS=$as_save_IFS
+
+fi
+
+  test -d ./--version && rmdir ./--version
+  if test "${ac_cv_path_mkdir+set}" = set; then
+    MKDIR_P="$ac_cv_path_mkdir -p"
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for MKDIR_P within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    MKDIR_P="$ac_install_sh -d"
+  fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+mkdir_p="$MKDIR_P"
+case $mkdir_p in
+  [\\/$]* | ?:[\\/]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+
+for ac_prog in gawk mawk nawk awk
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AWK+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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
+    ac_cv_prog_AWK="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$AWK" && break
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+	@echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+  *@@@%%%=?*=@@@%%%*)
+    eval ac_cv_prog_make_${ac_make}_set=yes;;
+  *)
+    eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+  SET_MAKE=
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  am__isrc=' -I$(srcdir)'
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
+  fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='linbox'
+ VERSION='1.2.0'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+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.
@@ -2411,22 +3091,68 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
 
 
 
-
 ac_config_headers="$ac_config_headers config.h"
 
-AX_PREFIX_CONFIG_H(linbox/linbox-config.h, __LINBOX)
+ac_config_headers="$ac_config_headers "
+
+
+ac_config_commands="$ac_config_commands linbox/linbox-config.h"
+
+# Extract the first word of "rm", so it can be a program name with args.
+set dummy rm; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_RM+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $RM in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_RM="$RM" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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
+    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
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_RM" && ac_cv_path_RM="$FALSE"
+  ;;
+esac
+fi
+RM=$ac_cv_path_RM
+if test -n "$RM"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RM" >&5
+$as_echo "$RM" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+RM="$RM -f"
 
-{ echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
-echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6; }
+
+{ $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.
-if test "${enable_maintainer_mode+set}" = set; then
+if test "${enable_maintainer_mode+set}" = set; then :
   enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
 else
   USE_MAINTAINER_MODE=no
 fi
 
-  { echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5
-echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5
+$as_echo "$USE_MAINTAINER_MODE" >&6; }
    if test $USE_MAINTAINER_MODE = yes; then
   MAINTAINER_MODE_TRUE=
   MAINTAINER_MODE_FALSE='#'
@@ -2439,7 +3165,7 @@ fi
 
 
 # Check whether --enable-dependency-tracking was given.
-if test "${enable_dependency_tracking+set}" = set; then
+if test "${enable_dependency_tracking+set}" = set; then :
   enableval=$enable_dependency_tracking;
 fi
 
@@ -2460,367 +3186,226 @@ ac_config_commands="$ac_config_commands depfiles"
 
 
 
-# Give a sane default for CFLAGS and CXXFLAGS
-# The sane thing is to define the flags differenly in tests, examples, interfaces, etc.  -bds
-#DEFAULT_CFLAGS="-O2 -Wall"
 
-CFLAGS=${CFLAGS:-$DEFAULT_CFLAGS}
-CXXFLAGS=${CXXFLAGS:-$DEFAULT_CFLAGS}
+	 if test x = y; then
+  INSIDE_GNOME_COMMON_TRUE=
+  INSIDE_GNOME_COMMON_FALSE='#'
+else
+  INSIDE_GNOME_COMMON_TRUE='#'
+  INSIDE_GNOME_COMMON_FALSE=
+fi
+
+
+	test -n "$ACLOCAL_FLAGS" && ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
+
+	for k in macros ; do ACLOCAL="$ACLOCAL -I $k" ; done
 
 
 # work around to fix the backward compatibility issue of automake 1.10 with 1.9 (pb with MKDIR_P)
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+{ $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.
+if test "${enable_debug+set}" = set; then :
+  enableval=$enable_debug; USE_DEBUG=$enableval
 else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
+  USE_DEBUG=no
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_DEBUG" >&5
+$as_echo "$USE_DEBUG" >&6; }
+   if test $USE_DEBUG = yes; then
+  DEBUG_TRUE=
+  DEBUG_FALSE='#'
+else
+  DEBUG_TRUE='#'
+  DEBUG_FALSE=
+fi
+
+  DBG=$USE_DEBUG
+
+
+# AC_FULL_DEBUG
+{ $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.
+if test "${enable_warnings+set}" = set; then :
+  enableval=$enable_warnings; USE_WARNINGS=$enableval
+else
+  USE_WARNINGS=no
+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='#'
+else
+  WARNINGS_TRUE='#'
+  WARNINGS_FALSE=
+fi
+
+  WARN=$USE_WARNINGS
+
+
+
+# CFLAGS=${CFLAGS:-$DEFAULT_CFLAGS}
+# CXXFLAGS=${CXXFLAGS:-$DEFAULT_CXXFLAGS}
+
+######################################################
+# Try and pass different flags according to compiler #
+######################################################
+
+
+# disable default -g -O2 CXXFLAGS
+: ${CXXFLAGS=""}
+
+#set CXX
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+  if test -n "$CCC"; then
+    CXX=$CCC
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CXX"; then
+  ac_cv_prog_CXX="$CXX" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    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
-    ac_cv_prog_CC="${ac_tool_prefix}gcc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    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
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
+    test -n "$CXX" && break
+  done
 fi
-if test -z "$ac_cv_prog_CC"; then
-  ac_ct_CC=$CC
-  # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-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
-    ac_cv_prog_ac_ct_CC="gcc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-  if test "x$ac_ct_CC" = x; then
-    CC=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
-  fi
-else
-  CC="$ac_cv_prog_CC"
-fi
-
-if test -z "$CC"; then
-          if test -n "$ac_tool_prefix"; then
-    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-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
-    ac_cv_prog_CC="${ac_tool_prefix}cc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-  fi
-fi
-if test -z "$CC"; then
-  # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-  ac_prog_rejected=no
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-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 test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
-       ac_prog_rejected=yes
-       continue
-     fi
-    ac_cv_prog_CC="cc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-if test $ac_prog_rejected = yes; then
-  # We found a bogon in the path, so make sure we never use it.
-  set dummy $ac_cv_prog_CC
-  shift
-  if test $# != 0; then
-    # We chose a different compiler from the bogus one.
-    # However, it has the same basename, so the bogon will be chosen
-    # first if we set CC to just the basename; use the full file name.
-    shift
-    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
-  fi
-fi
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-fi
-if test -z "$CC"; then
-  if test -n "$ac_tool_prefix"; then
-  for ac_prog in cl.exe
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-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
-    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-    test -n "$CC" && break
-  done
-fi
-if test -z "$CC"; then
-  ac_ct_CC=$CC
-  for ac_prog in cl.exe
+if test -z "$CXX"; then
+  ac_ct_CXX=$CXX
+  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+  if test -n "$ac_ct_CXX"; then
+  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    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
-    ac_cv_prog_ac_ct_CC="$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    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
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6; }
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
-  test -n "$ac_ct_CC" && break
+  test -n "$ac_ct_CXX" && break
 done
 
-  if test "x$ac_ct_CC" = x; then
-    CC=""
+  if test "x$ac_ct_CXX" = x; then
+    CXX="g++"
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
-    CC=$ac_ct_CC
+    CXX=$ac_ct_CXX
   fi
 fi
 
+  fi
 fi
-
-
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-
 # Provide some information about the compiler.
-echo "$as_me:$LINENO: checking for C compiler version" >&5
-ac_compiler=`set X $ac_compile; echo $2`
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler --version >&5") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler -v >&5") 2>&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler -V >&5") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
 
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -2832,42 +3417,38 @@ main ()
 }
 _ACEOF
 ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.exe b.out"
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
 # Try to create an executable without -o first, disregard a.out.
 # It will help us diagnose broken compilers, and finding out an intuition
 # of exeext.
-{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
-ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-#
-# List of possible output files, starting from the most likely.
-# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
-# only as a last resort.  b.out is created by i960 compilers.
-ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
-#
-# The IRIX 6 linker writes into existing files which may not be
-# executable, retaining their permissions.  Remove them first so a
-# subsequent execution test works.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler works" >&5
+$as_echo_n "checking whether the C++ compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
 ac_rmfiles=
 for ac_file in $ac_files
 do
   case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
     * ) ac_rmfiles="$ac_rmfiles $ac_file";;
   esac
 done
 rm -f $ac_rmfiles
 
-if { (ac_try="$ac_link_default"
+if { { ac_try="$ac_link_default"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
   (eval "$ac_link_default") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
   # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
 # So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
 # in a Makefile.  We should not override ac_cv_exeext if it was cached,
@@ -2877,14 +3458,14 @@ for ac_file in $ac_files ''
 do
   test -f "$ac_file" || continue
   case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
 	;;
     [ab].out )
 	# We found the default executable, but exeext='' is most
 	# certainly right.
 	break;;
     *.* )
-        if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+	if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
 	then :; else
 	   ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
 	fi
@@ -2903,78 +3484,41 @@ test "$ac_cv_exeext" = no && ac_cv_exeext=
 else
   ac_file=''
 fi
-
-{ echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6; }
-if test -z "$ac_file"; then
-  echo "$as_me: failed program was:" >&5
+if test -z "$ac_file"; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
-See \`config.log' for more details." >&5
-echo "$as_me: error: C compiler cannot create executables
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C++ compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 fi
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler default output file name" >&5
+$as_echo_n "checking for C++ compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
 ac_exeext=$ac_cv_exeext
 
-# Check that the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; }
-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
-  if { ac_try='./$ac_file'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-    cross_compiling=no
-  else
-    if test "$cross_compiling" = maybe; then
-	cross_compiling=yes
-    else
-	{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-    fi
-  fi
-fi
-{ echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-
-rm -f a.out a.exe conftest$ac_cv_exeext b.out
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
 ac_clean_files=$ac_clean_files_save
-# Check that the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
-{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
-echo "${ECHO_T}$cross_compiling" >&6; }
-
-{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
-if { (ac_try="$ac_link"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
   (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
   # If both `conftest.exe' and `conftest' are `present' (well, observable)
 # catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
 # work properly (i.e., refer to `conftest.exe'), while it won't with
@@ -2982,192 +3526,182 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
 for ac_file in conftest.exe conftest conftest.*; do
   test -f "$ac_file" || continue
   case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
     *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
 	  break;;
     * ) break;;
   esac
 done
 else
-  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+  { { $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 compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
 fi
-
-rm -f conftest$ac_cv_exeext
-{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-echo "${ECHO_T}$ac_cv_exeext" >&6; }
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
 
 rm -f conftest.$ac_ext
 EXEEXT=$ac_cv_exeext
 ac_exeext=$EXEEXT
-{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
-echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
-if test "${ac_cv_objext+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
+#include <stdio.h>
 int
 main ()
 {
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
 
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.o conftest.obj
-if { (ac_try="$ac_compile"
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+  { { ac_try="$ac_link"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-  for ac_file in conftest.o conftest.obj conftest.*; do
-  test -f "$ac_file" || continue;
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
-    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
-       break;;
-  esac
-done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+  if { ac_try='./conftest$ac_cv_exeext'
+  { { case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_try") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { $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 C++ compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+    fi
+  fi
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
 
-rm -f conftest.$ac_cv_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-echo "${ECHO_T}$ac_cv_objext" >&6; }
-OBJEXT=$ac_cv_objext
-ac_objext=$OBJEXT
-{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if ${ac_cv_objext+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
-#ifndef __GNUC__
-       choke me
-#endif
 
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
 case "(($ac_try" in
   *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
   *) ac_try_echo=$ac_try;;
 esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compile") 2>&5
   ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_compiler_gnu=yes
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then :
+  for ac_file in conftest.o conftest.obj conftest.*; do
+  test -f "$ac_file" || continue;
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
 else
-  echo "$as_me: failed program was:" >&5
+  $as_echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_compiler_gnu=no
+{ { $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 compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_c_compiler_gnu=$ac_compiler_gnu
-
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
-GCC=`test $ac_compiler_gnu = yes && echo yes`
-ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
-{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
+if ${ac_cv_cxx_compiler_gnu+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  ac_save_c_werror_flag=$ac_c_werror_flag
-   ac_c_werror_flag=yes
-   ac_cv_prog_cc_g=no
-   CFLAGS="-g"
-   cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
+#ifndef __GNUC__
+       choke me
+#endif
 
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_prog_cc_g=yes
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
 
-	CFLAGS=""
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GXX=yes
+else
+  GXX=
+fi
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
+if ${ac_cv_prog_cxx_g+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+   ac_cxx_werror_flag=yes
+   ac_cv_prog_cxx_g=no
+   CXXFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -3178,35 +3712,11 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_c_werror_flag=$ac_save_c_werror_flag
-	 CFLAGS="-g"
-	 cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  CXXFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -3217,1950 +3727,1407 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_prog_cc_g=yes
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+	 CXXFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_prog_cxx_g=yes
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-   ac_c_werror_flag=$ac_save_c_werror_flag
+   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
-if test "$ac_test_CFLAGS" = set; then
-  CFLAGS=$ac_save_CFLAGS
-elif test $ac_cv_prog_cc_g = yes; then
-  if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+  CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+  if test "$GXX" = yes; then
+    CXXFLAGS="-g -O2"
   else
-    CFLAGS="-g"
+    CXXFLAGS="-g"
   fi
 else
-  if test "$GCC" = yes; then
-    CFLAGS="-O2"
+  if test "$GXX" = yes; then
+    CXXFLAGS="-O2"
   else
-    CFLAGS=
+    CXXFLAGS=
   fi
 fi
-{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
-echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+
+
+{ $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
+
+
 else
-  ac_cv_prog_cc_c89=no
-ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-/* 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);
-static char *e (p, i)
-     char **p;
-     int i;
-{
-  return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
-  char *s;
-  va_list v;
-  va_start (v,p);
-  s = g (p, va_arg (v,int));
-  va_end (v);
-  return s;
-}
+   #ifdef __INTEL_COMPILER
+   int main() { return 0 ; }
+   #else
+   pas intel
+   #endif
+_ACEOF
+if ac_fn_cxx_try_run "$LINENO"; then :
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: icc" >&5
+$as_echo "icc" >&6; }
+   CCNAM=icc
 
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
-   function prototypes and stuff, but not '\xHH' hex character constants.
-   These don't provoke an error unfortunately, instead are silently treated
-   as 'x'.  The following induces an error, until -std is added to get
-   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
-   array size at least.  It's necessary to write '\x00'==0 to get something
-   that's true only with -std.  */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
 
-/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
-   inside strings and character constants.  */
-#define FOO(x) 'x'
-int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+else
+     if test "$cross_compiling" = yes; then :
 
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
-  ;
-  return 0;
-}
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5
+$as_echo "unknown" >&6; }
+   CCNAM=unknown
+
+
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __GNUC__
+   int main() { return 0 ; }
+   #else
+   pas gcc non plus.
+   #endif
 _ACEOF
-for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
-  CC="$ac_save_CC $ac_arg"
-  rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_prog_cc_c89=$ac_arg
+if ac_fn_cxx_try_run "$LINENO"; then :
+
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: gcc" >&5
+$as_echo "gcc" >&6; }
+   CCNAM=gcc
+
+
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5
+$as_echo "unknown" >&6; }
+   CCNAM=unknown
 
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-rm -f core conftest.err conftest.$ac_objext
-  test "x$ac_cv_prog_cc_c89" != "xno" && break
-done
-rm -f conftest.$ac_ext
-CC=$ac_save_CC
 
 fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c89" in
-  x)
-    { echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6; } ;;
-  xno)
-    { echo "$as_me:$LINENO: result: unsupported" >&5
-echo "${ECHO_T}unsupported" >&6; } ;;
-  *)
-    CC="$CC $ac_cv_prog_cc_c89"
-    { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
-esac
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
 
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+TESTS_CFLAGS="-O0 -g"
+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 -D_LB_DEBUG"
+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"
+		else
+			echo
+			echo "*******************************************************"
+			echo "unsupported compiler ($CCNAM). Please file a bug."
+			echo "*******************************************************"
+			echo
+			WARN_CFLAGS="${WARN_CFLAGS}"
+		fi
+	fi
+fi
+
+
+DEFAULT_CFLAGS="${DEFAULT_CFLAGS} ${WARN_CFLAGS} ${DEBUG_CFLAGS}"
+TESTS_CFLAGS="${TESTS_CFLAGS} ${WARN_CFLAGS} ${DEBUG_CFLAGS}"
+
 
 ac_ext=cpp
 ac_cpp='$CXXCPP $CPPFLAGS'
 ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-if test -z "$CXX"; then
-  if test -n "$CCC"; then
-    CXX=$CCC
-  else
-    if test -n "$ac_tool_prefix"; then
-  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CXX+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$CXX"; then
-  ac_cv_prog_CXX="$CXX" # Let the user override the test.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5
+$as_echo_n "checking how to run the C++ preprocessor... " >&6; }
+if test -z "$CXXCPP"; then
+  if ${ac_cv_prog_CXXCPP+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
+      # Double quotes because CXXCPP needs to be expanded
+    for CXXCPP in "$CXX -E" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
 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
-    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
 
+else
+  # Broken: fails on valid input.
+continue
 fi
-fi
-CXX=$ac_cv_prog_CXX
-if test -n "$CXX"; then
-  { echo "$as_me:$LINENO: result: $CXX" >&5
-echo "${ECHO_T}$CXX" >&6; }
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+  break
 fi
 
+    done
+    ac_cv_prog_CXXCPP=$CXXCPP
 
-    test -n "$CXX" && break
-  done
 fi
-if test -z "$CXX"; then
-  ac_ct_CXX=$CXX
-  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+  CXXCPP=$ac_cv_prog_CXXCPP
+else
+  ac_cv_prog_CXXCPP=$CXXCPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5
+$as_echo "$CXXCPP" >&6; }
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
 do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+
 else
-  if test -n "$ac_ct_CXX"; then
-  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
 else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$GREP"; then
+  ac_path_GREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
 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
-    ac_cv_prog_ac_ct_CXX="$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
+    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
+# 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
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
 
-fi
-fi
-ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
-if test -n "$ac_ct_CXX"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
-echo "${ECHO_T}$ac_ct_CXX" >&6; }
+      $ac_path_GREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_GREP"; then
+    as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+  fi
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  ac_cv_path_GREP=$GREP
 fi
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
 
-  test -n "$ac_ct_CXX" && break
-done
 
-  if test "x$ac_ct_CXX" = x; then
-    CXX="g++"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&2;}
-ac_tool_warned=yes ;;
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     if test -z "$EGREP"; then
+  ac_path_EGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    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
+# 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
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
 esac
-    CXX=$ac_ct_CXX
+
+      $ac_path_EGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_EGREP"; then
+    as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
+else
+  ac_cv_path_EGREP=$EGREP
 fi
 
-  fi
+   fi
 fi
-# Provide some information about the compiler.
-echo "$as_me:$LINENO: checking for C++ compiler version" >&5
-ac_compiler=`set X $ac_compile; echo $2`
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler --version >&5") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler -v >&5") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler -V >&5") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
 
-{ echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; }
-if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
 
 int
 main ()
 {
-#ifndef __GNUC__
-       choke me
-#endif
 
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_compiler_gnu=yes
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_header_stdc=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_compiler_gnu=no
+  ac_cv_header_stdc=no
 fi
-
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
 
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; }
-GXX=`test $ac_compiler_gnu = yes && echo yes`
-ac_test_CXXFLAGS=${CXXFLAGS+set}
-ac_save_CXXFLAGS=$CXXFLAGS
-{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
-echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; }
-if test "${ac_cv_prog_cxx_g+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
-   ac_cxx_werror_flag=yes
-   ac_cv_prog_cxx_g=no
-   CXXFLAGS="-g"
-   cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
+#include <string.h>
 
-int
-main ()
-{
-
-  ;
-  return 0;
-}
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_prog_cxx_g=yes
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then :
+
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
 
-	CXXFLAGS=""
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+fi
 
-int
-main ()
-{
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
 
-  ;
-  return 0;
-}
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  :
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then :
+
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
 
-	ac_cxx_werror_flag=$ac_save_cxx_werror_flag
-	 CXXFLAGS="-g"
-	 cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then :
+  :
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
 
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
 int
 main ()
 {
-
-  ;
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_prog_cxx_g=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+if ac_fn_cxx_try_run "$LINENO"; then :
 
+else
+  ac_cv_header_stdc=no
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; }
-if test "$ac_test_CXXFLAGS" = set; then
-  CXXFLAGS=$ac_save_CXXFLAGS
-elif test $ac_cv_prog_cxx_g = yes; then
-  if test "$GXX" = yes; then
-    CXXFLAGS="-g -O2"
-  else
-    CXXFLAGS="-g"
-  fi
-else
-  if test "$GXX" = yes; then
-    CXXFLAGS="-O2"
-  else
-    CXXFLAGS=
-  fi
 fi
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
-  CPP=
-fi
-if test -z "$CPP"; then
-  if test "${ac_cv_prog_CPP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-      # Double quotes because CPP needs to be expanded
-    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
-    do
-      ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-		     Syntax error
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  :
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
 
-  # Broken: fails on valid input.
-continue
 fi
 
-rm -f conftest.err conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+case `pwd` in
+  *\ * | *\	*)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
+$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
 esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  # Broken: success on invalid input.
-continue
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
 
-rm -f conftest.err conftest.$ac_ext
 
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
-  break
-fi
+macro_version='2.4'
+macro_revision='1.3293'
 
-    done
-    ac_cv_prog_CPP=$CPP
 
-fi
-  CPP=$ac_cv_prog_CPP
-else
-  ac_cv_prog_CPP=$CPP
-fi
-{ echo "$as_me:$LINENO: result: $CPP" >&5
-echo "${ECHO_T}$CPP" >&6; }
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-		     Syntax error
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  :
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-  # Broken: fails on valid input.
-continue
-fi
 
-rm -f conftest.err conftest.$ac_ext
 
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  # Broken: success on invalid input.
-continue
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
 
-rm -f conftest.err conftest.$ac_ext
 
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
-  :
-else
-  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&5
-echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-fi
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
-echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  # Extract the first word of "grep ggrep" to use in msg output
-if test -z "$GREP"; then
-set dummy grep ggrep; ac_prog_name=$2
-if test "${ac_cv_path_GREP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_path_GREP_found=false
-# Loop through the user's path and test for each of PROGNAME-LIST
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  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
-    # 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
-*GNU*)
-  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
-*)
-  ac_count=0
-  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    echo 'GREP' >> "conftest.nl"
-    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
-    if test $ac_count -gt ${ac_path_GREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_GREP="$ac_path_GREP"
-      ac_path_GREP_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
 
 
-    $ac_path_GREP_found && break 3
-  done
-done
+ltmain="$ac_aux_dir/ltmain.sh"
 
-done
-IFS=$as_save_IFS
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if ${ac_cv_build+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+  as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
 
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
 
-GREP="$ac_cv_path_GREP"
-if test -z "$GREP"; then
-  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
-fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if ${ac_cv_host+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  ac_cv_path_GREP=$GREP
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
 fi
 
-
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
-echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
- GREP="$ac_cv_path_GREP"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 
 
-{ echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
-   then ac_cv_path_EGREP="$GREP -E"
-   else
-     # Extract the first word of "egrep" to use in msg output
-if test -z "$EGREP"; then
-set dummy egrep; ac_prog_name=$2
-if test "${ac_cv_path_EGREP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_path_EGREP_found=false
-# Loop through the user's path and test for each of PROGNAME-LIST
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  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
-    # 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
-*GNU*)
-  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
-*)
-  ac_count=0
-  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    echo 'EGREP' >> "conftest.nl"
-    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
-    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_EGREP="$ac_path_EGREP"
-      ac_path_EGREP_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
+# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
 
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
 
-    $ac_path_EGREP_found && break 3
-  done
-done
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
 
-done
-IFS=$as_save_IFS
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
 
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
 
+ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
+$as_echo_n "checking how to print strings... " >&6; }
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='printf %s\n'
+else
+  # Use this function as a fallback that always works.
+  func_fallback_echo ()
+  {
+    eval 'cat <<_LTECHO_EOF
+$1
+_LTECHO_EOF'
+  }
+  ECHO='func_fallback_echo'
 fi
 
-EGREP="$ac_cv_path_EGREP"
-if test -z "$EGREP"; then
-  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
-fi
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO ""
+}
 
-else
-  ac_cv_path_EGREP=$EGREP
-fi
+case "$ECHO" in
+  printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
+$as_echo "printf" >&6; } ;;
+  print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
+$as_echo "print -r" >&6; } ;;
+  *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
+$as_echo "cat" >&6; } ;;
+esac
 
 
-   fi
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
-echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
- EGREP="$ac_cv_path_EGREP"
 
 
-{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
 
-int
-main ()
-{
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_header_stdc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_header_stdc=no
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
-if test $ac_cv_header_stdc = yes; then
-  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <string.h>
 
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "memchr" >/dev/null 2>&1; then
-  :
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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
+    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
+  fi
+done
+  done
+IFS=$as_save_IFS
 
 fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-if test $ac_cv_header_stdc = yes; then
-  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdlib.h>
 
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "free" >/dev/null 2>&1; then
-  :
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  ac_cv_header_stdc=no
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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
+    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
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
-rm -f conftest*
 
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
 fi
 
-if test $ac_cv_header_stdc = yes; then
-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then
-  :
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
-		   (('a' <= (c) && (c) <= 'i') \
-		     || ('j' <= (c) && (c) <= 'r') \
-		     || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
-  int i;
-  for (i = 0; i < 256; i++)
-    if (XOR (islower (i), ISLOWER (i))
-	|| toupper (i) != TOUPPER (i))
-      return 2;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_header_stdc=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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
+    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
+  fi
+done
+  done
+IFS=$as_save_IFS
 
 fi
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
-
-fi
-
-#AC_DISABLE_SHARED
-#AC_DISABLE_STATIC
-#AM_PROG_LIBTOOL
-# JGD 08.06.2004 : new name
-# Check whether --enable-shared was given.
-if test "${enable_shared+set}" = set; then
-  enableval=$enable_shared; p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_shared=yes ;;
-    no) enable_shared=no ;;
-    *)
-      enable_shared=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_shared=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
 else
-  enable_shared=yes
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
-# Check whether --enable-static was given.
-if test "${enable_static+set}" = set; then
-  enableval=$enable_static; p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_static=yes ;;
-    no) enable_static=no ;;
-    *)
-     enable_static=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_static=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac
-else
-  enable_static=yes
+  fi
 fi
-
-
-# Check whether --enable-fast-install was given.
-if test "${enable_fast_install+set}" = set; then
-  enableval=$enable_fast_install; p=${PACKAGE-default}
-    case $enableval in
-    yes) enable_fast_install=yes ;;
-    no) enable_fast_install=no ;;
-    *)
-      enable_fast_install=no
-      # Look at the argument we got.  We use all the common list separators.
-      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-      for pkg in $enableval; do
-	IFS="$lt_save_ifs"
-	if test "X$pkg" = "X$p"; then
-	  enable_fast_install=yes
-	fi
-      done
-      IFS="$lt_save_ifs"
-      ;;
-    esac
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  enable_fast_install=yes
-fi
-
-
-# Make sure we can run config.sub.
-$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-  { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
-echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
-   { (exit 1); exit 1; }; }
-
-{ echo "$as_me:$LINENO: checking build system type" >&5
-echo $ECHO_N "checking build system type... $ECHO_C" >&6; }
-if test "${ac_cv_build+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
 else
-  ac_build_alias=$build_alias
-test "x$ac_build_alias" = x &&
-  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
-test "x$ac_build_alias" = x &&
-  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
-echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
-   { (exit 1); exit 1; }; }
-ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
-  { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
-echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
-   { (exit 1); exit 1; }; }
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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 test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
-echo "${ECHO_T}$ac_cv_build" >&6; }
-case $ac_cv_build in
-*-*-*) ;;
-*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
-echo "$as_me: error: invalid value of canonical build" >&2;}
-   { (exit 1); exit 1; }; };;
-esac
-build=$ac_cv_build
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_build
-shift
-build_cpu=$1
-build_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-build_os=$*
-IFS=$ac_save_IFS
-case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
-
-
-{ echo "$as_me:$LINENO: checking host system type" >&5
-echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
-if test "${ac_cv_host+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test "x$host_alias" = x; then
-  ac_cv_host=$ac_cv_build
-else
-  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
-    { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
-echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
-   { (exit 1); exit 1; }; }
 fi
-
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
-echo "${ECHO_T}$ac_cv_host" >&6; }
-case $ac_cv_host in
-*-*-*) ;;
-*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
-echo "$as_me: error: invalid value of canonical host" >&2;}
-   { (exit 1); exit 1; }; };;
-esac
-host=$ac_cv_host
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_host
-shift
-host_cpu=$1
-host_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-host_os=$*
-IFS=$ac_save_IFS
-case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
 
-{ echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
-echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; }
-if test "${lt_cv_path_SED+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
 else
-  # Loop through the user's path and test for sed and gsed.
-# Then use that list of sed's as ones to test for truncation.
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for lt_ac_prog in sed gsed; do
     for ac_exec_ext in '' $ac_executable_extensions; do
-      if { test -f "$as_dir/$lt_ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$lt_ac_prog$ac_exec_ext"; }; then
-        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
-      fi
-    done
-  done
-done
-IFS=$as_save_IFS
-lt_ac_max=0
-lt_ac_count=0
-# Add /usr/xpg4/bin/sed as it is typically found on Solaris
-# along with /bin/sed that truncates output.
-for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
-  test ! -f $lt_ac_sed && continue
-  cat /dev/null > conftest.in
-  lt_ac_count=0
-  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
-  # Check for GNU sed and select it if it is found.
-  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
-    lt_cv_path_SED=$lt_ac_sed
-    break
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
   fi
-  while true; do
-    cat conftest.in conftest.in >conftest.tmp
-    mv conftest.tmp conftest.in
-    cp conftest.in conftest.nl
-    echo >>conftest.nl
-    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
-    cmp -s conftest.out conftest.nl || break
-    # 10000 chars as input seems more than enough
-    test $lt_ac_count -gt 10 && break
-    lt_ac_count=`expr $lt_ac_count + 1`
-    if test $lt_ac_count -gt $lt_ac_max; then
-      lt_ac_max=$lt_ac_count
-      lt_cv_path_SED=$lt_ac_sed
-    fi
-  done
 done
+  done
+IFS=$as_save_IFS
 
 fi
-
-SED=$lt_cv_path_SED
-
-{ echo "$as_me:$LINENO: result: $SED" >&5
-echo "${ECHO_T}$SED" >&6; }
-
-
-# Check whether --with-gnu-ld was given.
-if test "${with_gnu_ld+set}" = set; then
-  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
 else
-  with_gnu_ld=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-ac_prog=ld
-if test "$GCC" = yes; then
-  # Check if gcc -print-prog-name=ld gives a path.
-  { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
-echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
-  case $host in
-  *-*-mingw*)
-    # gcc leaves a trailing carriage return which upsets mingw
-    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
-  *)
-    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
-  esac
-  case $ac_prog in
-    # Accept absolute paths.
-    [\\/]* | ?:[\\/]*)
-      re_direlt='/[^/][^/]*/\.\./'
-      # Canonicalize the pathname of ld
-      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
-      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
-	ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
-      done
-      test -z "$LD" && LD="$ac_prog"
-      ;;
-  "")
-    # If it fails, then pretend we aren't using GCC.
-    ac_prog=ld
-    ;;
-  *)
-    # If it is relative, then search for the first ld in PATH.
-    with_gnu_ld=unknown
-    ;;
-  esac
-elif test "$with_gnu_ld" = yes; then
-  { echo "$as_me:$LINENO: checking for GNU ld" >&5
-echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
-else
-  { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
-echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
+
+    test -n "$CC" && break
+  done
 fi
-if test "${lt_cv_path_LD+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  if test -z "$LD"; then
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-  for ac_dir in $PATH; do
-    IFS="$lt_save_ifs"
-    test -z "$ac_dir" && ac_dir=.
-    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
-      lt_cv_path_LD="$ac_dir/$ac_prog"
-      # Check to see if the program is GNU ld.  I'd rather use --version,
-      # but apparently some variants of GNU ld only accept -v.
-      # Break only if it was the GNU/non-GNU ld that we prefer.
-      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
-      *GNU* | *'with BFD'*)
-	test "$with_gnu_ld" != no && break
-	;;
-      *)
-	test "$with_gnu_ld" != yes && break
-	;;
-      esac
-    fi
-  done
-  IFS="$lt_save_ifs"
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
 else
-  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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
+    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
+  fi
+done
+  done
+IFS=$as_save_IFS
+
 fi
 fi
-
-LD="$lt_cv_path_LD"
-if test -n "$LD"; then
-  { echo "$as_me:$LINENO: result: $LD" >&5
-echo "${ECHO_T}$LD" >&6; }
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
-test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
-echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
-   { (exit 1); exit 1; }; }
-{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
-echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
-if test "${lt_cv_prog_gnu_ld+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  # I'd rather use --version here, but apparently some GNU lds only accept -v.
-case `$LD -v 2>&1 </dev/null` in
-*GNU* | *'with BFD'*)
-  lt_cv_prog_gnu_ld=yes
-  ;;
-*)
-  lt_cv_prog_gnu_ld=no
-  ;;
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
 esac
+    CC=$ac_ct_CC
+  fi
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
-echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
-with_gnu_ld=$lt_cv_prog_gnu_ld
 
-
-{ echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
-echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6; }
-if test "${lt_cv_ld_reload_flag+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  lt_cv_ld_reload_flag='-r'
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
-echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6; }
-reload_flag=$lt_cv_ld_reload_flag
-case $reload_flag in
-"" | " "*) ;;
-*) reload_flag=" $reload_flag" ;;
-esac
-reload_cmds='$LD$reload_flag -o $output$reload_objs'
-case $host_os in
-  darwin*)
-    if test "$GCC" = yes; then
-      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
-    else
-      reload_cmds='$LD$reload_flag -o $output$reload_objs'
-    fi
-    ;;
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+  { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
 esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    sed '10a\
+... rest of stderr output deleted ...
+         10q' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+  fi
+  rm -f conftest.er1 conftest.err
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+done
 
-{ echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5
-echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6; }
-if test "${lt_cv_path_NM+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  if test -n "$NM"; then
-  # Let the user override the test.
-  lt_cv_path_NM="$NM"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_compiler_gnu=yes
 else
-  lt_nm_to_check="${ac_tool_prefix}nm"
-  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
-    lt_nm_to_check="$lt_nm_to_check nm"
-  fi
-  for lt_tmp_nm in $lt_nm_to_check; do
-    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
-      IFS="$lt_save_ifs"
-      test -z "$ac_dir" && ac_dir=.
-      tmp_nm="$ac_dir/$lt_tmp_nm"
-      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
-	# Check to see if the nm accepts a BSD-compat flag.
-	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
-	#   nm: unknown option "B" ignored
-	# Tru64's nm complains that /dev/null is an invalid object file
-	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
-	*/dev/null* | *'Invalid file or object type'*)
-	  lt_cv_path_NM="$tmp_nm -B"
-	  break
-	  ;;
-	*)
-	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
-	  */dev/null*)
-	    lt_cv_path_NM="$tmp_nm -p"
-	    break
-	    ;;
-	  *)
-	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
-	    continue # so that we can try to find one that supports BSD flags
-	    ;;
-	  esac
-	  ;;
-	esac
-      fi
-    done
-    IFS="$lt_save_ifs"
-  done
-  test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
-fi
+  ac_compiler_gnu=no
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
-echo "${ECHO_T}$lt_cv_path_NM" >&6; }
-NM="$lt_cv_path_NM"
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
 
-{ echo "$as_me:$LINENO: checking whether ln -s works" >&5
-echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; }
-LN_S=$as_ln_s
-if test "$LN_S" = "ln -s"; then
-  { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+  GCC=yes
 else
-  { echo "$as_me:$LINENO: result: no, using $LN_S" >&5
-echo "${ECHO_T}no, using $LN_S" >&6; }
+  GCC=
 fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
 
-{ echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5
-echo $ECHO_N "checking how to recognize dependent libraries... $ECHO_C" >&6; }
-if test "${lt_cv_deplibs_check_method+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
 else
-  lt_cv_file_magic_cmd='$MAGIC_CMD'
-lt_cv_file_magic_test_file=
-lt_cv_deplibs_check_method='unknown'
-# Need to set the preceding variable on all platforms that support
-# interlibrary dependencies.
-# 'none' -- dependencies not supported.
-# `unknown' -- same as none, but documents that we really don't know.
-# 'pass_all' -- all dependencies passed with no checks.
-# 'test_compile' -- check by making test program.
-# 'file_magic [[regex]]' -- check by looking for files in library path
-# which responds to the $file_magic_cmd with a given extended regex.
-# If you have `file' or equivalent on your system and you're not sure
-# whether `pass_all' will *always* work, you probably want this one.
+  CFLAGS=""
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-case $host_os in
-aix[4-9]*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
+int
+main ()
+{
 
-beos*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
 
-bsdi[45]*)
-  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
-  lt_cv_file_magic_cmd='/usr/bin/file -L'
-  lt_cv_file_magic_test_file=/shlib/libc.so
-  ;;
+else
+  ac_c_werror_flag=$ac_save_c_werror_flag
+	 CFLAGS="-g"
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-cygwin*)
-  # func_win32_libid is a shell function defined in ltmain.sh
-  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
-  lt_cv_file_magic_cmd='func_win32_libid'
-  ;;
+int
+main ()
+{
 
-mingw* | pw32*)
-  # Base MSYS/MinGW do not provide the 'file' command needed by
-  # func_win32_libid shell function, so use a weaker test based on 'objdump',
-  # unless we find 'file', for example because we are cross-compiling.
-  if ( file / ) >/dev/null 2>&1; then
-    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
-    lt_cv_file_magic_cmd='func_win32_libid'
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
   else
-    lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
-    lt_cv_file_magic_cmd='$OBJDUMP -f'
+    CFLAGS="-g"
   fi
-  ;;
-
-darwin* | rhapsody*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-
-freebsd* | dragonfly*)
-  if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
-    case $host_cpu in
-    i*86 )
-      # Not sure whether the presence of OpenBSD here was a mistake.
-      # Let's accept both of them until this is cleared up.
-      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
-      lt_cv_file_magic_cmd=/usr/bin/file
-      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
-      ;;
-    esac
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
   else
-    lt_cv_deplibs_check_method=pass_all
+    CFLAGS=
   fi
-  ;;
-
-gnu*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* 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);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
 
-hpux10.20* | hpux11*)
-  lt_cv_file_magic_cmd=/usr/bin/file
-  case $host_cpu in
-  ia64*)
-    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
-    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
-    ;;
-  hppa*64*)
-    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
-    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
-    ;;
-  *)
-    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
-    lt_cv_file_magic_test_file=/usr/lib/libc.sl
-    ;;
-  esac
-  ;;
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
 
-interix[3-9]*)
-  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
-  lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
-  ;;
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
 
-irix5* | irix6* | nonstopux*)
-  case $LD in
-  *-32|*"-32 ") libmagic=32-bit;;
-  *-n32|*"-n32 ") libmagic=N32;;
-  *-64|*"-64 ") libmagic=64-bit;;
-  *) libmagic=never-match;;
-  esac
-  lt_cv_deplibs_check_method=pass_all
-  ;;
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+	-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
 
-# This must be Linux ELF.
-linux* | k*bsd*-gnu)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+  xno)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
 
-netbsd* | netbsdelf*-gnu)
-  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
-    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
-  fi
-  ;;
+fi
 
-newos6*)
-  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
-  lt_cv_file_magic_cmd=/usr/bin/file
-  lt_cv_file_magic_test_file=/usr/lib/libnls.so
-  ;;
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
-nto-qnx*)
-  lt_cv_deplibs_check_method=unknown
-  ;;
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if ${ac_cv_path_SED+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+            ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+     for ac_i in 1 2 3 4 5 6 7; do
+       ac_script="$ac_script$as_nl$ac_script"
+     done
+     echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+     { ac_script=; unset ac_script;}
+     if test -z "$SED"; then
+  ac_path_SED_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    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
+# 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
+*GNU*)
+  ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo '' >> "conftest.nl"
+    "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_SED_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_SED="$ac_path_SED"
+      ac_path_SED_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
 
-openbsd*)
-  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
-  else
-    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+      $ac_path_SED_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_SED"; then
+    as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
   fi
-  ;;
-
-osf3* | osf4* | osf5*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
+else
+  ac_cv_path_SED=$SED
+fi
 
-rdos*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+  rm -f conftest.sed
 
-solaris*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
 
-sysv4 | sysv4.3*)
-  case $host_vendor in
-  motorola)
-    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
-    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
-    ;;
-  ncr)
-    lt_cv_deplibs_check_method=pass_all
-    ;;
-  sequent)
-    lt_cv_file_magic_cmd='/bin/file'
-    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
-    ;;
-  sni)
-    lt_cv_file_magic_cmd='/bin/file'
-    lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
-    lt_cv_file_magic_test_file=/lib/libc.so
-    ;;
-  siemens)
-    lt_cv_deplibs_check_method=pass_all
-    ;;
-  pc)
-    lt_cv_deplibs_check_method=pass_all
-    ;;
-  esac
-  ;;
 
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  lt_cv_deplibs_check_method=pass_all
-  ;;
-esac
 
-fi
-{ echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
-echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6; }
-file_magic_cmd=$lt_cv_file_magic_cmd
-deplibs_check_method=$lt_cv_deplibs_check_method
-test -z "$deplibs_check_method" && deplibs_check_method=unknown
 
 
 
 
-# If no C compiler was specified, use CC.
-LTCC=${LTCC-"$CC"}
 
-# If no C compiler flags were specified, use CFLAGS.
-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
 
-# Allow CC to be a program name with arguments.
-compiler=$CC
 
-# Check whether --enable-libtool-lock was given.
-if test "${enable_libtool_lock+set}" = set; then
-  enableval=$enable_libtool_lock;
-fi
 
-test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
-
-# Some flags need to be propagated to the compiler or linker for good
-# libtool support.
-case $host in
-ia64-*-hpux*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-    case `/usr/bin/file conftest.$ac_objext` in
-    *ELF-32*)
-      HPUX_IA64_MODE="32"
-      ;;
-    *ELF-64*)
-      HPUX_IA64_MODE="64"
-      ;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
-*-*-irix6*)
-  # Find out which ABI we are using.
-  echo '#line 4973 "configure"' > conftest.$ac_ext
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-   if test "$lt_cv_prog_gnu_ld" = yes; then
-    case `/usr/bin/file conftest.$ac_objext` in
-    *32-bit*)
-      LD="${LD-ld} -melf32bsmip"
-      ;;
-    *N32*)
-      LD="${LD-ld} -melf32bmipn32"
-      ;;
-    *64-bit*)
-      LD="${LD-ld} -melf64bmip"
-      ;;
-    esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
+$as_echo_n "checking for fgrep... " >&6; }
+if ${ac_cv_path_FGREP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
+   then ac_cv_path_FGREP="$GREP -F"
    else
-    case `/usr/bin/file conftest.$ac_objext` in
-    *32-bit*)
-      LD="${LD-ld} -32"
-      ;;
-    *N32*)
-      LD="${LD-ld} -n32"
-      ;;
-    *64-bit*)
-      LD="${LD-ld} -64"
-      ;;
-    esac
-   fi
-  fi
-  rm -rf conftest*
-  ;;
+     if test -z "$FGREP"; then
+  ac_path_FGREP_found=false
+  # Loop through the user's path and test for each of PROGNAME-LIST
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    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
+# 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
+*GNU*)
+  ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
+*)
+  ac_count=0
+  $as_echo_n 0123456789 >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    $as_echo 'FGREP' >> "conftest.nl"
+    "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    as_fn_arith $ac_count + 1 && ac_count=$as_val
+    if test $ac_count -gt ${ac_path_FGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_FGREP="$ac_path_FGREP"
+      ac_path_FGREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
 
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
-s390*-*linux*|sparc*-*linux*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-    case `/usr/bin/file conftest.o` in
-    *32-bit*)
-      case $host in
-        x86_64-*kfreebsd*-gnu)
-          LD="${LD-ld} -m elf_i386_fbsd"
-          ;;
-        x86_64-*linux*)
-          LD="${LD-ld} -m elf_i386"
-          ;;
-        ppc64-*linux*|powerpc64-*linux*)
-          LD="${LD-ld} -m elf32ppclinux"
-          ;;
-        s390x-*linux*)
-          LD="${LD-ld} -m elf_s390"
-          ;;
-        sparc64-*linux*)
-          LD="${LD-ld} -m elf32_sparc"
-          ;;
-      esac
-      ;;
-    *64-bit*)
-      case $host in
-        x86_64-*kfreebsd*-gnu)
-          LD="${LD-ld} -m elf_x86_64_fbsd"
-          ;;
-        x86_64-*linux*)
-          LD="${LD-ld} -m elf_x86_64"
-          ;;
-        ppc*-*linux*|powerpc*-*linux*)
-          LD="${LD-ld} -m elf64ppc"
-          ;;
-        s390*-*linux*)
-          LD="${LD-ld} -m elf64_s390"
-          ;;
-        sparc*-*linux*)
-          LD="${LD-ld} -m elf64_sparc"
-          ;;
-      esac
-      ;;
-    esac
+      $ac_path_FGREP_found && break 3
+    done
+  done
+  done
+IFS=$as_save_IFS
+  if test -z "$ac_cv_path_FGREP"; then
+    as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
   fi
-  rm -rf conftest*
-  ;;
-
-*-*-sco3.2v5*)
-  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
-  SAVE_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS -belf"
-  { echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
-echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6; }
-if test "${lt_cv_cc_needs_belf+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+  ac_cv_path_FGREP=$FGREP
+fi
 
-     cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+   fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
+$as_echo "$ac_cv_path_FGREP" >&6; }
+ FGREP="$ac_cv_path_FGREP"
 
-int
-main ()
-{
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  lt_cv_cc_needs_belf=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+test -z "$GREP" && GREP=grep
 
-	lt_cv_cc_needs_belf=no
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-     ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-fi
-{ echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
-echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6; }
-  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
-    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
-    CFLAGS="$SAVE_CFLAGS"
-  fi
-  ;;
-sparc*-*solaris*)
-  # Find out which ABI we are using.
-  echo 'int i;' > conftest.$ac_ext
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-    case `/usr/bin/file conftest.o` in
-    *64-bit*)
-      case $lt_cv_prog_gnu_ld in
-      yes*) LD="${LD-ld} -m elf64_sparc" ;;
-      *)
-        if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
-	  LD="${LD-ld} -64"
-	fi
-	;;
-      esac
-      ;;
-    esac
-  fi
-  rm -rf conftest*
-  ;;
 
 
-esac
 
-need_locks="$enable_libtool_lock"
 
 
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
 
 
 
@@ -5170,712 +5137,337 @@ need_locks="$enable_libtool_lock"
 
 
 
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
-		  inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
 
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  eval "$as_ac_Header=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	eval "$as_ac_Header=no"
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if ${lt_cv_path_LD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
 fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
 
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if ${lt_cv_prog_gnu_ld+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
 
-done
 
 
 
-for ac_header in dlfcn.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
+$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
+if ${lt_cv_path_NM+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ------------------------------------------ ##
-## Report this to linbox-use at googlegroups.com ##
-## ------------------------------------------ ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-	       { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
-    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
-    (test "X$CXX" != "Xg++"))) ; then
-  ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-{ echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5
-echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6; }
-if test -z "$CXXCPP"; then
-  if test "${ac_cv_prog_CXXCPP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-      # Double quotes because CXXCPP needs to be expanded
-    for CXXCPP in "$CXX -E" "/lib/cpp"
-    do
-      ac_preproc_ok=false
-for ac_cxx_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-		     Syntax error
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  :
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  # Broken: fails on valid input.
-continue
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  # Broken: success on invalid input.
-continue
+  if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
-  break
-fi
-
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+	# Check to see if the nm accepts a BSD-compat flag.
+	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	#   nm: unknown option "B" ignored
+	# Tru64's nm complains that /dev/null is an invalid object file
+	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+	*/dev/null* | *'Invalid file or object type'*)
+	  lt_cv_path_NM="$tmp_nm -B"
+	  break
+	  ;;
+	*)
+	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+	  */dev/null*)
+	    lt_cv_path_NM="$tmp_nm -p"
+	    break
+	    ;;
+	  *)
+	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	    continue # so that we can try to find one that supports BSD flags
+	    ;;
+	  esac
+	  ;;
+	esac
+      fi
     done
-    ac_cv_prog_CXXCPP=$CXXCPP
-
-fi
-  CXXCPP=$ac_cv_prog_CXXCPP
-else
-  ac_cv_prog_CXXCPP=$CXXCPP
-fi
-{ echo "$as_me:$LINENO: result: $CXXCPP" >&5
-echo "${ECHO_T}$CXXCPP" >&6; }
-ac_preproc_ok=false
-for ac_cxx_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-		     Syntax error
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  :
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  # Broken: fails on valid input.
-continue
+    IFS="$lt_save_ifs"
+  done
+  : ${lt_cv_path_NM=no}
 fi
-
-rm -f conftest.err conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null && {
-	 test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       }; then
-  # Broken: success on invalid input.
-continue
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  # Passes both tests.
-ac_preproc_ok=:
-break
 fi
-
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
-  :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
+$as_echo "$lt_cv_path_NM" >&6; }
+if test "$lt_cv_path_NM" != "no"; then
+  NM="$lt_cv_path_NM"
 else
-  { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check
-See \`config.log' for more details." >&5
-echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-fi
-
-
-ac_ext=f
-ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
-ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_f77_compiler_gnu
-if test -n "$ac_tool_prefix"; then
-  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+  # Didn't find any BSD compatible name lister, look for dumpbin.
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    if test -n "$ac_tool_prefix"; then
+  for ac_prog in dumpbin "link -dump"
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_F77+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DUMPBIN+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  if test -n "$F77"; then
-  ac_cv_prog_F77="$F77" # Let the user override the test.
+  if test -n "$DUMPBIN"; then
+  ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    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
-    ac_cv_prog_F77="$ac_tool_prefix$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    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
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
-F77=$ac_cv_prog_F77
-if test -n "$F77"; then
-  { echo "$as_me:$LINENO: result: $F77" >&5
-echo "${ECHO_T}$F77" >&6; }
+DUMPBIN=$ac_cv_prog_DUMPBIN
+if test -n "$DUMPBIN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
+$as_echo "$DUMPBIN" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
-    test -n "$F77" && break
+    test -n "$DUMPBIN" && break
   done
 fi
-if test -z "$F77"; then
-  ac_ct_F77=$F77
-  for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+if test -z "$DUMPBIN"; then
+  ac_ct_DUMPBIN=$DUMPBIN
+  for ac_prog in dumpbin "link -dump"
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_F77+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  if test -n "$ac_ct_F77"; then
-  ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test.
+  if test -n "$ac_ct_DUMPBIN"; then
+  ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    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
-    ac_cv_prog_ac_ct_F77="$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    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
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
-ac_ct_F77=$ac_cv_prog_ac_ct_F77
-if test -n "$ac_ct_F77"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_F77" >&5
-echo "${ECHO_T}$ac_ct_F77" >&6; }
+ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
+if test -n "$ac_ct_DUMPBIN"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
+$as_echo "$ac_ct_DUMPBIN" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
-  test -n "$ac_ct_F77" && break
+  test -n "$ac_ct_DUMPBIN" && break
 done
 
-  if test "x$ac_ct_F77" = x; then
-    F77=""
+  if test "x$ac_ct_DUMPBIN" = x; then
+    DUMPBIN=":"
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
-    F77=$ac_ct_F77
+    DUMPBIN=$ac_ct_DUMPBIN
   fi
 fi
 
+    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols"
+      ;;
+    *)
+      DUMPBIN=:
+      ;;
+    esac
+  fi
 
-# Provide some information about the compiler.
-echo "$as_me:$LINENO: checking for Fortran 77 compiler version" >&5
-ac_compiler=`set X $ac_compile; echo $2`
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler --version >&5") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler -v >&5") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler -V >&5") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-rm -f a.out
-
-# If we don't use `.F' as extension, the preprocessor is not run on the
-# input file.  (Note that this only needs to work for GNU compilers.)
-ac_save_ext=$ac_ext
-ac_ext=F
-{ echo "$as_me:$LINENO: checking whether we are using the GNU Fortran 77 compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU Fortran 77 compiler... $ECHO_C" >&6; }
-if test "${ac_cv_f77_compiler_gnu+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-      program main
-#ifndef __GNUC__
-       choke me
-#endif
-
-      end
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_f77_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_compiler_gnu=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_compiler_gnu=no
+  if test "$DUMPBIN" != ":"; then
+    NM="$DUMPBIN"
+  fi
 fi
+test -z "$NM" && NM=nm
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_f77_compiler_gnu=$ac_compiler_gnu
 
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_f77_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_f77_compiler_gnu" >&6; }
-ac_ext=$ac_save_ext
-ac_test_FFLAGS=${FFLAGS+set}
-ac_save_FFLAGS=$FFLAGS
-FFLAGS=
-{ echo "$as_me:$LINENO: checking whether $F77 accepts -g" >&5
-echo $ECHO_N "checking whether $F77 accepts -g... $ECHO_C" >&6; }
-if test "${ac_cv_prog_f77_g+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  FFLAGS=-g
-cat >conftest.$ac_ext <<_ACEOF
-      program main
 
-      end
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_f77_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_prog_f77_g=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_prog_f77_g=no
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_prog_f77_g" >&5
-echo "${ECHO_T}$ac_cv_prog_f77_g" >&6; }
-if test "$ac_test_FFLAGS" = set; then
-  FFLAGS=$ac_save_FFLAGS
-elif test $ac_cv_prog_f77_g = yes; then
-  if test "x$ac_cv_f77_compiler_gnu" = xyes; then
-    FFLAGS="-g -O2"
-  else
-    FFLAGS="-g"
-  fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
+$as_echo_n "checking the name lister ($NM) interface... " >&6; }
+if ${lt_cv_nm_interface+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  if test "x$ac_cv_f77_compiler_gnu" = xyes; then
-    FFLAGS="-O2"
-  else
-    FFLAGS=
+  lt_cv_nm_interface="BSD nm"
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
+  (eval "$ac_compile" 2>conftest.err)
+  cat conftest.err >&5
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+  cat conftest.err >&5
+  (eval echo "\"\$as_me:$LINENO: output\"" >&5)
+  cat conftest.out >&5
+  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+    lt_cv_nm_interface="MS dumpbin"
   fi
+  rm -f conftest*
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
+$as_echo "$lt_cv_nm_interface" >&6; }
 
-G77=`test $ac_compiler_gnu = yes && echo yes`
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
 
-# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
 # find the maximum length of command line arguments
-{ echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
-echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6; }
-if test "${lt_cv_sys_max_cmd_len+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
+$as_echo_n "checking the maximum length of command line arguments... " >&6; }
+if ${lt_cv_sys_max_cmd_len+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
     i=0
   teststring="ABCD"
@@ -5896,7 +5488,7 @@ else
     lt_cv_sys_max_cmd_len=-1;
     ;;
 
-  cygwin* | mingw*)
+  cygwin* | mingw* | cegcc*)
     # On Win9x/ME, this test blows up -- it succeeds, but takes
     # about 5 minutes as the teststring grows exponentially.
     # Worse, since 9x/ME are not pre-emptively multitasking,
@@ -5907,6 +5499,11 @@ else
     lt_cv_sys_max_cmd_len=8192;
     ;;
 
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
   amigaos*)
     # On AmigaOS with pdksh, this test takes hours, literally.
     # So we just punt and use a minimum line length of 8192.
@@ -5951,7 +5548,7 @@ else
   sysv5* | sco5v6* | sysv4.2uw2*)
     kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
     if test -n "$kargmax"; then
-      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ 	]//'`
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[	 ]//'`
     else
       lt_cv_sys_max_cmd_len=32768
     fi
@@ -5962,20 +5559,28 @@ else
       lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
       lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
     else
+      # Make teststring a little bigger before we do anything with it.
+      # a 1K string should be a reasonable start.
+      for i in 1 2 3 4 5 6 7 8 ; do
+        teststring=$teststring$teststring
+      done
       SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
-      while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \
-	       = "XX$teststring") >/dev/null 2>&1 &&
-	      new_result=`expr "X$teststring" : ".*" 2>&1` &&
-	      lt_cv_sys_max_cmd_len=$new_result &&
+      # If test is not a shell built-in, we'll probably end up computing a
+      # maximum length that is only half of the actual maximum length, but
+      # we can't tell.
+      while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
 	      test $i != 17 # 1/2 MB should be enough
       do
         i=`expr $i + 1`
         teststring=$teststring$teststring
       done
+      # Only check the string length outside the loop.
+      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
       teststring=
-      # Add a significant safety factor because C++ compilers can tack on massive
-      # amounts of additional arguments before passing them to the linker.
-      # It appears as though 1/2 is a usable value.
+      # Add a significant safety factor because C++ compilers can tack on
+      # massive amounts of additional arguments before passing them to the
+      # linker.  It appears as though 1/2 is a usable value.
       lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
     fi
     ;;
@@ -5984,1000 +5589,797 @@ else
 fi
 
 if test -n $lt_cv_sys_max_cmd_len ; then
-  { echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
-echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
+$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
 else
-  { echo "$as_me:$LINENO: result: none" >&5
-echo "${ECHO_T}none" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
+$as_echo "none" >&6; }
 fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
 
 
 
 
 
-# Check for command to grab the raw symbol name followed by C symbol from nm.
-{ echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
-echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6; }
-if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
 
-# These are sane defaults that work on at least a few old systems.
-# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
 
-# Character class describing NM global symbol codes.
-symcode='[BCDEGRST]'
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
+$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,b/c, \
+    && eval 'test $(( 1 + 1 )) -eq 2 \
+    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+  && xsi_shell=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
+$as_echo "$xsi_shell" >&6; }
 
-# Regexp to match symbols that can be accessed directly from C.
-sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
 
-# Transform an extracted symbol line into a proper C declaration
-lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
+$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
+    >/dev/null 2>&1 \
+  && lt_shell_append=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
+$as_echo "$lt_shell_append" >&6; }
 
-# Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
 
-# Define system-specific variables.
-case $host_os in
-aix*)
-  symcode='[BCDT]'
-  ;;
-cygwin* | mingw* | pw32*)
-  symcode='[ABCDGISTW]'
-  ;;
-hpux*) # Its linker distinguishes data from code symbols
-  if test "$host_cpu" = ia64; then
-    symcode='[ABCDEGRST]'
-  fi
-  lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
-  lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
-  ;;
-linux* | k*bsd*-gnu)
-  if test "$host_cpu" = ia64; then
-    symcode='[ABCDGIRSTW]'
-    lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
-    lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/  {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (lt_ptr) \&\2},/p'"
-  fi
-  ;;
-irix* | nonstopux*)
-  symcode='[BCDEGRST]'
-  ;;
-osf*)
-  symcode='[BCDEGQRST]'
-  ;;
-solaris*)
-  symcode='[BDRT]'
-  ;;
-sco3.2v5*)
-  symcode='[DT]'
-  ;;
-sysv4.2uw2*)
-  symcode='[DT]'
-  ;;
-sysv5* | sco5v6* | unixware* | OpenUNIX*)
-  symcode='[ABDT]'
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  lt_unset=unset
+else
+  lt_unset=false
+fi
+
+
+
+
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  lt_SP2NL='tr \040 \012'
+  lt_NL2SP='tr \015\012 \040\040'
   ;;
-sysv4)
-  symcode='[DFNSTU]'
+ *) # EBCDIC based system
+  lt_SP2NL='tr \100 \n'
+  lt_NL2SP='tr \r\n \100\100'
   ;;
 esac
 
-# Handle CRLF in mingw tool chain
-opt_cr=
-case $build_os in
-mingw*)
-  opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
-  ;;
-esac
 
-# If we're using GNU nm, then use its standard symbol codes.
-case `$NM -V 2>&1` in
-*GNU* | *'with BFD'*)
-  symcode='[ABCDGIRSTW]' ;;
-esac
 
-# Try without a prefix undercore, then with it.
-for ac_symprfx in "" "_"; do
 
-  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
-  symxfrm="\\1 $ac_symprfx\\2 \\2"
 
-  # Write the raw and C identifiers.
-  lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ 	]\($symcode$symcode*\)[ 	][ 	]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
 
-  # Check to see that the pipe works correctly.
-  pipe_works=no
 
-  rm -f conftest*
-  cat > conftest.$ac_ext <<EOF
-#ifdef __cplusplus
-extern "C" {
-#endif
-char nm_test_var;
-void nm_test_func(){}
-#ifdef __cplusplus
-}
-#endif
-int main(){nm_test_var='a';nm_test_func();return(0);}
-EOF
 
-  if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-    # Now try to grab the symbols.
-    nlist=conftest.nm
-    if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5
-  (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && test -s "$nlist"; then
-      # Try sorting and uniquifying the output.
-      if sort "$nlist" | uniq > "$nlist"T; then
-	mv -f "$nlist"T "$nlist"
-      else
-	rm -f "$nlist"T
-      fi
 
-      # Make sure that we snagged all the symbols we need.
-      if grep ' nm_test_var$' "$nlist" >/dev/null; then
-	if grep ' nm_test_func$' "$nlist" >/dev/null; then
-	  cat <<EOF > conftest.$ac_ext
-#ifdef __cplusplus
-extern "C" {
-#endif
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
+$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
+if ${lt_cv_to_host_file_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+        ;;
+    esac
+    ;;
+  *-*-cygwin* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_noop
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+        ;;
+    esac
+    ;;
+  * ) # unhandled hosts (and "normal" native builds)
+    lt_cv_to_host_file_cmd=func_convert_file_noop
+    ;;
+esac
 
-EOF
-	  # Now generate the symbol file.
-	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
+fi
 
-	  cat <<EOF >> conftest.$ac_ext
-#if defined (__STDC__) && __STDC__
-# define lt_ptr_t void *
-#else
-# define lt_ptr_t char *
-# define const
-#endif
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
+$as_echo "$lt_cv_to_host_file_cmd" >&6; }
 
-/* The mapping between symbol names and symbols. */
-const struct {
-  const char *name;
-  lt_ptr_t address;
-}
-lt_preloaded_symbols[] =
-{
-EOF
-	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
-	  cat <<\EOF >> conftest.$ac_ext
-  {0, (lt_ptr_t) 0}
-};
 
-#ifdef __cplusplus
-}
-#endif
-EOF
-	  # Now try linking the two files.
-	  mv conftest.$ac_objext conftstm.$ac_objext
-	  lt_save_LIBS="$LIBS"
-	  lt_save_CFLAGS="$CFLAGS"
-	  LIBS="conftstm.$ac_objext"
-	  CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
-	  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && test -s conftest${ac_exeext}; then
-	    pipe_works=yes
-	  fi
-	  LIBS="$lt_save_LIBS"
-	  CFLAGS="$lt_save_CFLAGS"
-	else
-	  echo "cannot find nm_test_func in $nlist" >&5
-	fi
-      else
-	echo "cannot find nm_test_var in $nlist" >&5
-      fi
-    else
-      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
-    fi
-  else
-    echo "$progname: failed program was:" >&5
-    cat conftest.$ac_ext >&5
-  fi
-  rm -rf conftest* conftst*
 
-  # Do not use the global_symbol_pipe unless it works.
-  if test "$pipe_works" = yes; then
-    break
-  else
-    lt_cv_sys_global_symbol_pipe=
-  fi
-done
 
-fi
 
-if test -z "$lt_cv_sys_global_symbol_pipe"; then
-  lt_cv_sys_global_symbol_to_cdecl=
-fi
-if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
-  { echo "$as_me:$LINENO: result: failed" >&5
-echo "${ECHO_T}failed" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
+$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
+if ${lt_cv_to_tool_file_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  { echo "$as_me:$LINENO: result: ok" >&5
-echo "${ECHO_T}ok" >&6; }
-fi
+  #assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+        ;;
+    esac
+    ;;
+esac
 
-{ echo "$as_me:$LINENO: checking for objdir" >&5
-echo $ECHO_N "checking for objdir... $ECHO_C" >&6; }
-if test "${lt_cv_objdir+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  rm -f .libs 2>/dev/null
-mkdir .libs 2>/dev/null
-if test -d .libs; then
-  lt_cv_objdir=.libs
-else
-  # MS-DOS does not allow filenames that begin with a dot.
-  lt_cv_objdir=_libs
-fi
-rmdir .libs 2>/dev/null
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
-echo "${ECHO_T}$lt_cv_objdir" >&6; }
-objdir=$lt_cv_objdir
 
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
+$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
 
 
 
 
-case $host_os in
-aix3*)
-  # AIX sometimes has problems with the GCC collect2 program.  For some
-  # reason, if we set the COLLECT_NAMES environment variable, the problems
-  # vanish in a puff of smoke.
-  if test "X${COLLECT_NAMES+set}" != Xset; then
-    COLLECT_NAMES=
-    export COLLECT_NAMES
-  fi
-  ;;
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
+$as_echo_n "checking for $LD option to reload object files... " >&6; }
+if ${lt_cv_ld_reload_flag+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_reload_flag='-r'
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
+$as_echo "$lt_cv_ld_reload_flag" >&6; }
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    if test "$GCC" != yes; then
+      reload_cmds=false
+    fi
+    ;;
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
 esac
 
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed='sed -e 1s/^X//'
-sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
 
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
 
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
 
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
 
-# Constants:
-rm="rm -f"
 
-# Global variables:
-default_ofile=libtool
-can_build_shared=yes
 
-# All known linkers require a `.a' archive for static linking (except MSVC,
-# which needs '.lib').
-libext=a
-ltmain="$ac_aux_dir/ltmain.sh"
-ofile="$default_ofile"
-with_gnu_ld="$lt_cv_prog_gnu_ld"
+
 
 if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ar; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_AR+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OBJDUMP+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  if test -n "$AR"; then
-  ac_cv_prog_AR="$AR" # Let the user override the test.
+  if test -n "$OBJDUMP"; then
+  ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    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
-    ac_cv_prog_AR="${ac_tool_prefix}ar"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    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
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
-AR=$ac_cv_prog_AR
-if test -n "$AR"; then
-  { echo "$as_me:$LINENO: result: $AR" >&5
-echo "${ECHO_T}$AR" >&6; }
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
 fi
-if test -z "$ac_cv_prog_AR"; then
-  ac_ct_AR=$AR
-  # Extract the first word of "ar", so it can be a program name with args.
-set dummy ar; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+if test -z "$ac_cv_prog_OBJDUMP"; then
+  ac_ct_OBJDUMP=$OBJDUMP
+  # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  if test -n "$ac_ct_AR"; then
-  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+  if test -n "$ac_ct_OBJDUMP"; then
+  ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    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
-    ac_cv_prog_ac_ct_AR="ar"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    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
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
-ac_ct_AR=$ac_cv_prog_ac_ct_AR
-if test -n "$ac_ct_AR"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
-echo "${ECHO_T}$ac_ct_AR" >&6; }
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
+$as_echo "$ac_ct_OBJDUMP" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-  if test "x$ac_ct_AR" = x; then
-    AR="false"
+  if test "x$ac_ct_OBJDUMP" = x; then
+    OBJDUMP="false"
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
-    AR=$ac_ct_AR
+    OBJDUMP=$ac_ct_OBJDUMP
   fi
 else
-  AR="$ac_cv_prog_AR"
+  OBJDUMP="$ac_cv_prog_OBJDUMP"
 fi
 
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_RANLIB+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$RANLIB"; then
-  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-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
-    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
+test -z "$OBJDUMP" && OBJDUMP=objdump
 
-fi
-fi
-RANLIB=$ac_cv_prog_RANLIB
-if test -n "$RANLIB"; then
-  { echo "$as_me:$LINENO: result: $RANLIB" >&5
-echo "${ECHO_T}$RANLIB" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
 
 
-fi
-if test -z "$ac_cv_prog_RANLIB"; then
-  ac_ct_RANLIB=$RANLIB
-  # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$ac_ct_RANLIB"; then
-  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-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
-    ac_cv_prog_ac_ct_RANLIB="ranlib"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
 
-fi
-fi
-ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
-if test -n "$ac_ct_RANLIB"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
-echo "${ECHO_T}$ac_ct_RANLIB" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
 
-  if test "x$ac_ct_RANLIB" = x; then
-    RANLIB=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    RANLIB=$ac_ct_RANLIB
-  fi
-else
-  RANLIB="$ac_cv_prog_RANLIB"
-fi
 
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
-set dummy ${ac_tool_prefix}strip; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$STRIP"; then
-  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-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
-    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
 
-fi
-fi
-STRIP=$ac_cv_prog_STRIP
-if test -n "$STRIP"; then
-  { echo "$as_me:$LINENO: result: $STRIP" >&5
-echo "${ECHO_T}$STRIP" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
 
 
-fi
-if test -z "$ac_cv_prog_STRIP"; then
-  ac_ct_STRIP=$STRIP
-  # Extract the first word of "strip", so it can be a program name with args.
-set dummy strip; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$ac_ct_STRIP"; then
-  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
+$as_echo_n "checking how to recognize dependent libraries... " >&6; }
+if ${lt_cv_deplibs_check_method+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-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
-    ac_cv_prog_ac_ct_STRIP="strip"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
+  lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
 
-fi
-fi
-ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
-if test -n "$ac_ct_STRIP"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
-echo "${ECHO_T}$ac_ct_STRIP" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
+case $host_os in
+aix[4-9]*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
-  if test "x$ac_ct_STRIP" = x; then
-    STRIP=":"
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[45]*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump',
+  # unless we find 'file', for example because we are cross-compiling.
+  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
   else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    STRIP=$ac_ct_STRIP
+    # Keep this pattern in sync with the one in func_win32_libid.
+    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
   fi
-else
-  STRIP="$ac_cv_prog_STRIP"
-fi
+  ;;
 
+cegcc*)
+  # use the weaker test based on 'objdump'. See mingw*.
+  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
 
-old_CC="$CC"
-old_CFLAGS="$CFLAGS"
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
-# Set sane defaults for various variables
-test -z "$AR" && AR=ar
-test -z "$AR_FLAGS" && AR_FLAGS=cru
-test -z "$AS" && AS=as
-test -z "$CC" && CC=cc
-test -z "$LTCC" && LTCC=$CC
-test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-test -z "$LD" && LD=ld
-test -z "$LN_S" && LN_S="ln -s"
-test -z "$MAGIC_CMD" && MAGIC_CMD=file
-test -z "$NM" && NM=nm
-test -z "$SED" && SED=sed
-test -z "$OBJDUMP" && OBJDUMP=objdump
-test -z "$RANLIB" && RANLIB=:
-test -z "$STRIP" && STRIP=:
-test -z "$ac_objext" && ac_objext=o
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
 
-# Determine commands to create old-style static archives.
-old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
-old_postinstall_cmds='chmod 644 $oldlib'
-old_postuninstall_cmds=
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
-if test -n "$RANLIB"; then
-  case $host_os in
-  openbsd*)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+haiku*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
     ;;
   *)
-    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
     ;;
   esac
-  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
-fi
+  ;;
 
-for cc_temp in $compiler""; do
-  case $cc_temp in
-    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
-    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
-    \-*) ;;
-    *) break;;
+interix[3-9]*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
   esac
-done
-cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
-# Only perform the check for file, if the check method requires it
-case $deplibs_check_method in
-file_magic*)
-  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
-    { echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
-echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6; }
-if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $MAGIC_CMD in
-[\\/*] |  ?:[\\/]*)
-  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+netbsd* | netbsdelf*-gnu)
+  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
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+  fi
   ;;
-*)
-  lt_save_MAGIC_CMD="$MAGIC_CMD"
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
-  for ac_dir in $ac_dummy; do
-    IFS="$lt_save_ifs"
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/${ac_tool_prefix}file; then
-      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
-      if test -n "$file_magic_test_file"; then
-	case $deplibs_check_method in
-	"file_magic "*)
-	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
-	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
-	    $EGREP "$file_magic_regex" > /dev/null; then
-	    :
-	  else
-	    cat <<EOF 1>&2
 
-*** Warning: the command libtool uses to detect shared libraries,
-*** $file_magic_cmd, produces output that libtool cannot recognize.
-*** The result is that libtool may fail to recognize shared libraries
-*** as such.  This will affect the creation of libtool libraries that
-*** depend on shared libraries, but programs linked with such libtool
-*** libraries will work regardless of this problem.  Nevertheless, you
-*** may want to report the problem to your system manager and/or to
-*** bug-libtool at gnu.org
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
 
-EOF
-	  fi ;;
-	esac
-      fi
-      break
-    fi
-  done
-  IFS="$lt_save_ifs"
-  MAGIC_CMD="$lt_save_MAGIC_CMD"
+*nto* | *qnx*)
+  lt_cv_deplibs_check_method=pass_all
   ;;
-esac
-fi
 
-MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-if test -n "$MAGIC_CMD"; then
-  { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
-echo "${ECHO_T}$MAGIC_CMD" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+  fi
+  ;;
 
-if test -z "$lt_cv_path_MAGIC_CMD"; then
-  if test -n "$ac_tool_prefix"; then
-    { echo "$as_me:$LINENO: checking for file" >&5
-echo $ECHO_N "checking for file... $ECHO_C" >&6; }
-if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $MAGIC_CMD in
-[\\/*] |  ?:[\\/]*)
-  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
   ;;
-*)
-  lt_save_MAGIC_CMD="$MAGIC_CMD"
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
-  for ac_dir in $ac_dummy; do
-    IFS="$lt_save_ifs"
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/file; then
-      lt_cv_path_MAGIC_CMD="$ac_dir/file"
-      if test -n "$file_magic_test_file"; then
-	case $deplibs_check_method in
-	"file_magic "*)
-	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
-	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
-	    $EGREP "$file_magic_regex" > /dev/null; then
-	    :
-	  else
-	    cat <<EOF 1>&2
 
-*** Warning: the command libtool uses to detect shared libraries,
-*** $file_magic_cmd, produces output that libtool cannot recognize.
-*** The result is that libtool may fail to recognize shared libraries
-*** as such.  This will affect the creation of libtool libraries that
-*** depend on shared libraries, but programs linked with such libtool
-*** libraries will work regardless of this problem.  Nevertheless, you
-*** may want to report the problem to your system manager and/or to
-*** bug-libtool at gnu.org
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
-EOF
-	  fi ;;
-	esac
-      fi
-      break
-    fi
-  done
-  IFS="$lt_save_ifs"
-  MAGIC_CMD="$lt_save_MAGIC_CMD"
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
   ;;
-esac
-fi
 
-MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
-if test -n "$MAGIC_CMD"; then
-  { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
-echo "${ECHO_T}$MAGIC_CMD" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
 
-  else
-    MAGIC_CMD=:
-  fi
-fi
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
 
-  fi
+tpf*)
+  lt_cv_deplibs_check_method=pass_all
   ;;
 esac
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
+$as_echo "$lt_cv_deplibs_check_method" >&6; }
 
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
   case $host_os in
-    rhapsody* | darwin*)
-    if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
-set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_DSYMUTIL+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  mingw* | pw32*)
+    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+      want_nocaseglob=yes
+    else
+      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
+    fi
+    ;;
+  esac
+fi
+
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DLLTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  if test -n "$DSYMUTIL"; then
-  ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
+  if test -n "$DLLTOOL"; then
+  ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    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
-    ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    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
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
-DSYMUTIL=$ac_cv_prog_DSYMUTIL
-if test -n "$DSYMUTIL"; then
-  { echo "$as_me:$LINENO: result: $DSYMUTIL" >&5
-echo "${ECHO_T}$DSYMUTIL" >&6; }
+DLLTOOL=$ac_cv_prog_DLLTOOL
+if test -n "$DLLTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
+$as_echo "$DLLTOOL" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
 fi
-if test -z "$ac_cv_prog_DSYMUTIL"; then
-  ac_ct_DSYMUTIL=$DSYMUTIL
-  # Extract the first word of "dsymutil", so it can be a program name with args.
-set dummy dsymutil; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+if test -z "$ac_cv_prog_DLLTOOL"; then
+  ac_ct_DLLTOOL=$DLLTOOL
+  # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  if test -n "$ac_ct_DSYMUTIL"; then
-  ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
+  if test -n "$ac_ct_DLLTOOL"; then
+  ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    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
-    ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    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
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
-ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
-if test -n "$ac_ct_DSYMUTIL"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_DSYMUTIL" >&5
-echo "${ECHO_T}$ac_ct_DSYMUTIL" >&6; }
+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
+if test -n "$ac_ct_DLLTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
+$as_echo "$ac_ct_DLLTOOL" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-  if test "x$ac_ct_DSYMUTIL" = x; then
-    DSYMUTIL=":"
+  if test "x$ac_ct_DLLTOOL" = x; then
+    DLLTOOL="false"
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
-    DSYMUTIL=$ac_ct_DSYMUTIL
+    DLLTOOL=$ac_ct_DLLTOOL
   fi
 else
-  DSYMUTIL="$ac_cv_prog_DSYMUTIL"
+  DLLTOOL="$ac_cv_prog_DLLTOOL"
 fi
 
-    if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
-set dummy ${ac_tool_prefix}nmedit; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_NMEDIT+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
+$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
+if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  if test -n "$NMEDIT"; then
-  ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
+  lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+  # two different shell functions defined in ltmain.sh
+  # decide which to use based on capabilities of $DLLTOOL
+  case `$DLLTOOL --help 2>&1` in
+  *--identify-strict*)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+    ;;
+  *)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+    ;;
+  esac
+  ;;
+*)
+  # fallback: assume linklib IS sharedlib
+  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+  ;;
+esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
+$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+  for ac_prog in ar
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AR+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$AR"; then
+  ac_cv_prog_AR="$AR" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    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
-    ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    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
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
-NMEDIT=$ac_cv_prog_NMEDIT
-if test -n "$NMEDIT"; then
-  { echo "$as_me:$LINENO: result: $NMEDIT" >&5
-echo "${ECHO_T}$NMEDIT" >&6; }
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
+    test -n "$AR" && break
+  done
 fi
-if test -z "$ac_cv_prog_NMEDIT"; then
-  ac_ct_NMEDIT=$NMEDIT
-  # Extract the first word of "nmedit", so it can be a program name with args.
-set dummy nmedit; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+if test -z "$AR"; then
+  ac_ct_AR=$AR
+  for ac_prog in ar
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  if test -n "$ac_ct_NMEDIT"; then
-  ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
+  if test -n "$ac_ct_AR"; then
+  ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
+    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
-    ac_cv_prog_ac_ct_NMEDIT="nmedit"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    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
   fi
 done
-done
+  done
 IFS=$as_save_IFS
 
 fi
 fi
-ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
-if test -n "$ac_ct_NMEDIT"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_NMEDIT" >&5
-echo "${ECHO_T}$ac_ct_NMEDIT" >&6; }
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
 else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-  if test "x$ac_ct_NMEDIT" = x; then
-    NMEDIT=":"
+
+  test -n "$ac_ct_AR" && break
+done
+
+  if test "x$ac_ct_AR" = x; then
+    AR="false"
   else
     case $cross_compiling:$ac_tool_warned in
 yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf at gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
 ac_tool_warned=yes ;;
 esac
-    NMEDIT=$ac_ct_NMEDIT
+    AR=$ac_ct_AR
   fi
-else
-  NMEDIT="$ac_cv_prog_NMEDIT"
 fi
 
+: ${AR=ar}
+: ${AR_FLAGS=cru}
 
-    { echo "$as_me:$LINENO: checking for -single_module linker flag" >&5
-echo $ECHO_N "checking for -single_module linker flag... $ECHO_C" >&6; }
-if test "${lt_cv_apple_cc_single_mod+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  lt_cv_apple_cc_single_mod=no
-      if test -z "${LT_MULTI_MODULE}"; then
-   # By default we will add the -single_module flag. You can override
-   # by either setting the environment variable LT_MULTI_MODULE
-   # non-empty at configure time, or by adding -multi_module to the
-   # link flags.
-   echo "int foo(void){return 1;}" > conftest.c
-   $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
-     -dynamiclib ${wl}-single_module conftest.c
-   if test -f libconftest.dylib; then
-     lt_cv_apple_cc_single_mod=yes
-     rm -rf libconftest.dylib*
-   fi
-   rm conftest.c
-      fi
-fi
-{ echo "$as_me:$LINENO: result: $lt_cv_apple_cc_single_mod" >&5
-echo "${ECHO_T}$lt_cv_apple_cc_single_mod" >&6; }
-    { echo "$as_me:$LINENO: checking for -exported_symbols_list linker flag" >&5
-echo $ECHO_N "checking for -exported_symbols_list linker flag... $ECHO_C" >&6; }
-if test "${lt_cv_ld_exported_symbols_list+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
+$as_echo_n "checking for archiver @FILE support... " >&6; }
+if ${lt_cv_ar_at_file+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  lt_cv_ld_exported_symbols_list=no
-      save_LDFLAGS=$LDFLAGS
-      echo "_main" > conftest.sym
-      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  lt_cv_ar_at_file=no
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -6988,5639 +6390,3852 @@ main ()
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  echo conftest.$ac_objext > conftest.lst
+      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
+      { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+  (eval $lt_ar_try) 2>&5
   ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  lt_cv_ld_exported_symbols_list=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+      if test "$ac_status" -eq 0; then
+	# Ensure the archiver fails upon bogus file names.
+	rm -f conftest.$ac_objext libconftest.a
+	{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
+  (eval $lt_ar_try) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+	if test "$ac_status" -ne 0; then
+          lt_cv_ar_at_file=@
+        fi
+      fi
+      rm -f conftest.* libconftest.a
 
-	lt_cv_ld_exported_symbols_list=no
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-   LDFLAGS="$save_LDFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
+$as_echo "$lt_cv_ar_at_file" >&6; }
 
+if test "x$lt_cv_ar_at_file" = xno; then
+  archiver_list_spec=
+else
+  archiver_list_spec=$lt_cv_ar_at_file
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_ld_exported_symbols_list" >&5
-echo "${ECHO_T}$lt_cv_ld_exported_symbols_list" >&6; }
-    case $host_os in
-    rhapsody* | darwin1.[0123])
-      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
-    darwin1.*)
-     _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-    darwin*)
-      # if running on 10.5 or later, the deployment target defaults
-      # to the OS version, if on x86, and 10.4, the deployment
-      # target defaults to 10.4. Don't you love it?
-      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
-   10.0,*86*-darwin8*|10.0,*-darwin[91]*)
-     _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
-   10.[012]*)
-     _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
-   10.*)
-     _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
-      esac
-    ;;
-  esac
-    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
-      _lt_dar_single_mod='$single_module'
-    fi
-    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
-      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
-    else
-      _lt_dar_export_syms="~$NMEDIT -s \$output_objdir/\${libname}-symbols.expsym \${lib}"
-    fi
-    if test "$DSYMUTIL" != ":"; then
-      _lt_dsymutil="~$DSYMUTIL \$lib || :"
-    else
-      _lt_dsymutil=
-    fi
-    ;;
-  esac
 
 
-enable_dlopen=no
-enable_win32_dll=no
 
-# Check whether --enable-libtool-lock was given.
-if test "${enable_libtool_lock+set}" = set; then
-  enableval=$enable_libtool_lock;
-fi
 
-test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
 
 
-# Check whether --with-pic was given.
-if test "${with_pic+set}" = set; then
-  withval=$with_pic; pic_mode="$withval"
-else
-  pic_mode=default
-fi
 
-test -z "$pic_mode" && pic_mode=default
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_STRIP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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
+    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
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-# Use C for the default configuration in the libtool script
-tagname=
-lt_save_CC="$CC"
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
 
-# Source file extension for C test sources.
-ac_ext=c
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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
+    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
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-# Object file extension for compiled C test sources.
-objext=o
-objext=$objext
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;"
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
 
-# Code to be used in simple link tests
-lt_simple_link_test_code='int main(){return(0);}'
+test -z "$STRIP" && STRIP=:
 
 
-# If no C compiler was specified, use CC.
-LTCC=${LTCC-"$CC"}
 
-# If no C compiler flags were specified, use CFLAGS.
-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
 
-# Allow CC to be a program name with arguments.
-compiler=$CC
 
 
-# save warnings/boilerplate of simple test code
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_compile_test_code" >conftest.$ac_ext
-eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_compiler_boilerplate=`cat conftest.err`
-$rm conftest*
-
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_link_test_code" >conftest.$ac_ext
-eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_linker_boilerplate=`cat conftest.err`
-$rm -r conftest*
-
-
-
-lt_prog_compiler_no_builtin_flag=
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_RANLIB+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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
+    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
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-if test "$GCC" = yes; then
-  lt_prog_compiler_no_builtin_flag=' -fno-builtin'
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
 
-{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
-echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
-if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+  ac_ct_RANLIB=$RANLIB
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  lt_cv_prog_compiler_rtti_exceptions=no
-  ac_outfile=conftest.$ac_objext
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-   lt_compiler_flag="-fno-rtti -fno-exceptions"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   # The option is referenced via a variable to avoid confusing sed.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7153: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>conftest.err)
-   ac_status=$?
-   cat conftest.err >&5
-   echo "$as_me:7157: \$? = $ac_status" >&5
-   if (exit $ac_status) && test -s "$ac_outfile"; then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings other than the usual output.
-     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
-     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_rtti_exceptions=yes
-     fi
-   fi
-   $rm conftest*
+  if test -n "$ac_ct_RANLIB"; then
+  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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
+    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
+  fi
+done
+  done
+IFS=$as_save_IFS
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
-
-if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
-    lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
 else
-    :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
+  if test "x$ac_ct_RANLIB" = x; then
+    RANLIB=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    RANLIB=$ac_ct_RANLIB
+  fi
+else
+  RANLIB="$ac_cv_prog_RANLIB"
 fi
 
-lt_prog_compiler_wl=
-lt_prog_compiler_pic=
-lt_prog_compiler_static=
+test -z "$RANLIB" && RANLIB=:
 
-{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
-echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
 
-  if test "$GCC" = yes; then
-    lt_prog_compiler_wl='-Wl,'
-    lt_prog_compiler_static='-static'
 
-    case $host_os in
-      aix*)
-      # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	lt_prog_compiler_static='-Bstatic'
-      fi
-      ;;
 
-    amigaos*)
-      # FIXME: we need at least 68020 code to build shared libraries, but
-      # adding the `-m68020' flag to GCC prevents building anything better,
-      # like `-m68040'.
-      lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
-      ;;
 
-    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
-      # PIC is the default for these OSes.
-      ;;
 
-    mingw* | cygwin* | pw32* | os2*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      # Although the cygwin gcc ignores -fPIC, still need this for old-style
-      # (--disable-auto-import) libraries
-      lt_prog_compiler_pic='-DDLL_EXPORT'
-      ;;
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
 
-    darwin* | rhapsody*)
-      # PIC is the default on this platform
-      # Common symbols not allowed in MH_DYLIB files
-      lt_prog_compiler_pic='-fno-common'
-      ;;
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
 
-    interix[3-9]*)
-      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
-      # Instead, we relocate shared libraries at runtime.
-      ;;
+case $host_os in
+  darwin*)
+    lock_old_archive_extraction=yes ;;
+  *)
+    lock_old_archive_extraction=no ;;
+esac
 
-    msdosdjgpp*)
-      # Just because we use GCC doesn't mean we suddenly get shared libraries
-      # on systems that don't support them.
-      lt_prog_compiler_can_build_shared=no
-      enable_shared=no
-      ;;
 
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	lt_prog_compiler_pic=-Kconform_pic
-      fi
-      ;;
 
-    hpux*)
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
-      case $host_cpu in
-      hppa*64*|ia64*)
-	# +Z the default
-	;;
-      *)
-	lt_prog_compiler_pic='-fPIC'
-	;;
-      esac
-      ;;
 
-    *)
-      lt_prog_compiler_pic='-fPIC'
-      ;;
-    esac
-  else
-    # PORTME Check for flag to pass linker flags through the system compiler.
-    case $host_os in
-    aix*)
-      lt_prog_compiler_wl='-Wl,'
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	lt_prog_compiler_static='-Bstatic'
-      else
-	lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
-      fi
-      ;;
-      darwin*)
-        # PIC is the default on this platform
-        # Common symbols not allowed in MH_DYLIB files
-       case $cc_basename in
-         xlc*)
-         lt_prog_compiler_pic='-qnocommon'
-         lt_prog_compiler_wl='-Wl,'
-         ;;
-       esac
-       ;;
 
-    mingw* | cygwin* | pw32* | os2*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      lt_prog_compiler_pic='-DDLL_EXPORT'
-      ;;
 
-    hpux9* | hpux10* | hpux11*)
-      lt_prog_compiler_wl='-Wl,'
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
-      case $host_cpu in
-      hppa*64*|ia64*)
-	# +Z the default
-	;;
-      *)
-	lt_prog_compiler_pic='+Z'
-	;;
-      esac
-      # Is there a better lt_prog_compiler_static that works with the bundled CC?
-      lt_prog_compiler_static='${wl}-a ${wl}archive'
-      ;;
 
-    irix5* | irix6* | nonstopux*)
-      lt_prog_compiler_wl='-Wl,'
-      # PIC (with -KPIC) is the default.
-      lt_prog_compiler_static='-non_shared'
-      ;;
 
-    newsos6)
-      lt_prog_compiler_pic='-KPIC'
-      lt_prog_compiler_static='-Bstatic'
-      ;;
 
-    linux* | k*bsd*-gnu)
-      case $cc_basename in
-      icc* | ecc*)
-	lt_prog_compiler_wl='-Wl,'
-	lt_prog_compiler_pic='-KPIC'
-	lt_prog_compiler_static='-static'
-        ;;
-      pgcc* | pgf77* | pgf90* | pgf95*)
-        # Portland Group compilers (*not* the Pentium gcc compiler,
-	# which looks to be a dead project)
-	lt_prog_compiler_wl='-Wl,'
-	lt_prog_compiler_pic='-fpic'
-	lt_prog_compiler_static='-Bstatic'
-        ;;
-      ccc*)
-        lt_prog_compiler_wl='-Wl,'
-        # All Alpha code is PIC.
-        lt_prog_compiler_static='-non_shared'
-        ;;
-      *)
-        case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)
-	  # Sun C 5.9
-	  lt_prog_compiler_pic='-KPIC'
-	  lt_prog_compiler_static='-Bstatic'
-	  lt_prog_compiler_wl='-Wl,'
-	  ;;
-	*Sun\ F*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
-	  lt_prog_compiler_pic='-KPIC'
-	  lt_prog_compiler_static='-Bstatic'
-	  lt_prog_compiler_wl=''
-	  ;;
-	esac
-	;;
-      esac
-      ;;
 
-    osf3* | osf4* | osf5*)
-      lt_prog_compiler_wl='-Wl,'
-      # All OSF/1 code is PIC.
-      lt_prog_compiler_static='-non_shared'
-      ;;
 
-    rdos*)
-      lt_prog_compiler_static='-non_shared'
-      ;;
 
-    solaris*)
-      lt_prog_compiler_pic='-KPIC'
-      lt_prog_compiler_static='-Bstatic'
-      case $cc_basename in
-      f77* | f90* | f95*)
-	lt_prog_compiler_wl='-Qoption ld ';;
-      *)
-	lt_prog_compiler_wl='-Wl,';;
-      esac
-      ;;
 
-    sunos4*)
-      lt_prog_compiler_wl='-Qoption ld '
-      lt_prog_compiler_pic='-PIC'
-      lt_prog_compiler_static='-Bstatic'
-      ;;
 
-    sysv4 | sysv4.2uw2* | sysv4.3*)
-      lt_prog_compiler_wl='-Wl,'
-      lt_prog_compiler_pic='-KPIC'
-      lt_prog_compiler_static='-Bstatic'
-      ;;
 
-    sysv4*MP*)
-      if test -d /usr/nec ;then
-	lt_prog_compiler_pic='-Kconform_pic'
-	lt_prog_compiler_static='-Bstatic'
-      fi
-      ;;
 
-    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
-      lt_prog_compiler_wl='-Wl,'
-      lt_prog_compiler_pic='-KPIC'
-      lt_prog_compiler_static='-Bstatic'
-      ;;
 
-    unicos*)
-      lt_prog_compiler_wl='-Wl,'
-      lt_prog_compiler_can_build_shared=no
-      ;;
 
-    uts4*)
-      lt_prog_compiler_pic='-pic'
-      lt_prog_compiler_static='-Bstatic'
-      ;;
 
-    *)
-      lt_prog_compiler_can_build_shared=no
-      ;;
-    esac
-  fi
 
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic" >&6; }
 
-#
-# Check to make sure the PIC flag actually works.
-#
-if test -n "$lt_prog_compiler_pic"; then
 
-{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
-echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6; }
-if test "${lt_cv_prog_compiler_pic_works+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  lt_cv_prog_compiler_pic_works=no
-  ac_outfile=conftest.$ac_objext
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-   lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   # The option is referenced via a variable to avoid confusing sed.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7443: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>conftest.err)
-   ac_status=$?
-   cat conftest.err >&5
-   echo "$as_me:7447: \$? = $ac_status" >&5
-   if (exit $ac_status) && test -s "$ac_outfile"; then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings other than the usual output.
-     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
-     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_pic_works=yes
-     fi
-   fi
-   $rm conftest*
 
-fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_pic_works" >&6; }
 
-if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
-    case $lt_prog_compiler_pic in
-     "" | " "*) ;;
-     *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
-     esac
-else
-    lt_prog_compiler_pic=
-     lt_prog_compiler_can_build_shared=no
-fi
 
-fi
-case $host_os in
-  # For platforms which do not support PIC, -DPIC is meaningless:
-  *djgpp*)
-    lt_prog_compiler_pic=
-    ;;
-  *)
-    lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
-    ;;
-esac
 
-#
-# Check to make sure the static flag actually works.
-#
-wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
-{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
-echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
-if test "${lt_cv_prog_compiler_static_works+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  lt_cv_prog_compiler_static_works=no
-   save_LDFLAGS="$LDFLAGS"
-   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
-   echo "$lt_simple_link_test_code" > conftest.$ac_ext
-   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
-     # The linker can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     if test -s conftest.err; then
-       # Append any errors to the config.log.
-       cat conftest.err 1>&5
-       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
-       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-       if diff conftest.exp conftest.er2 >/dev/null; then
-         lt_cv_prog_compiler_static_works=yes
-       fi
-     else
-       lt_cv_prog_compiler_static_works=yes
-     fi
-   fi
-   $rm -r conftest*
-   LDFLAGS="$save_LDFLAGS"
 
-fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_static_works" >&6; }
 
-if test x"$lt_cv_prog_compiler_static_works" = xyes; then
-    :
-else
-    lt_prog_compiler_static=
-fi
 
 
-{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
-if test "${lt_cv_prog_compiler_c_o+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  lt_cv_prog_compiler_c_o=no
-   $rm -r conftest 2>/dev/null
-   mkdir conftest
-   cd conftest
-   mkdir out
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
-   lt_compiler_flag="-o out/conftest2.$ac_objext"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:7547: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>out/conftest.err)
-   ac_status=$?
-   cat out/conftest.err >&5
-   echo "$as_me:7551: \$? = $ac_status" >&5
-   if (exit $ac_status) && test -s out/conftest2.$ac_objext
-   then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
-     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
-     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_c_o=yes
-     fi
-   fi
-   chmod u+w . 2>&5
-   $rm conftest*
-   # SGI C++ compiler will create directory out/ii_files/ for
-   # template instantiation
-   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
-   $rm out/* && rmdir out
-   cd ..
-   rmdir conftest
-   $rm conftest*
 
-fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; }
 
 
-hard_links="nottested"
-if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
-  # do not overwrite the value of need_locks provided by the user
-  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
-echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
-  hard_links=yes
-  $rm conftest*
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  touch conftest.a
-  ln conftest.a conftest.b 2>&5 || hard_links=no
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  { echo "$as_me:$LINENO: result: $hard_links" >&5
-echo "${ECHO_T}$hard_links" >&6; }
-  if test "$hard_links" = no; then
-    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
-echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
-    need_locks=warn
-  fi
-else
-  need_locks=no
-fi
 
-{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
 
-  runpath_var=
-  allow_undefined_flag=
-  enable_shared_with_static_runtimes=no
-  archive_cmds=
-  archive_expsym_cmds=
-  old_archive_From_new_cmds=
-  old_archive_from_expsyms_cmds=
-  export_dynamic_flag_spec=
-  whole_archive_flag_spec=
-  thread_safe_flag_spec=
-  hardcode_libdir_flag_spec=
-  hardcode_libdir_flag_spec_ld=
-  hardcode_libdir_separator=
-  hardcode_direct=no
-  hardcode_minus_L=no
-  hardcode_shlibpath_var=unsupported
-  link_all_deplibs=unknown
-  hardcode_automatic=no
-  module_cmds=
-  module_expsym_cmds=
-  always_export_symbols=no
-  export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  # include_expsyms should be a list of space-separated symbols to be *always*
-  # included in the symbol list
-  include_expsyms=
-  # exclude_expsyms can be an extended regexp of symbols to exclude
-  # it will be wrapped by ` (' and `)$', so one must not match beginning or
-  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
-  # as well as any symbol that contains `d'.
-  exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
-  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
-  # platforms (ab)use it in PIC code, but their linkers get confused if
-  # the symbol is explicitly referenced.  Since portable code cannot
-  # rely on this symbol name, it's probably fine to never include it in
-  # preloaded symbol tables.
-  # Exclude shared library initialization/finalization symbols.
-  extract_expsyms_cmds=
-  # Just being paranoid about ensuring that cc_basename is set.
-  for cc_temp in $compiler""; do
-  case $cc_temp in
-    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
-    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
-    \-*) ;;
-    *) break;;
-  esac
-done
-cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
 
-  case $host_os in
-  cygwin* | mingw* | pw32*)
-    # FIXME: the MSVC++ port hasn't been tested in a loooong time
-    # When not using gcc, we currently assume that we are using
-    # Microsoft Visual C++.
-    if test "$GCC" != yes; then
-      with_gnu_ld=no
-    fi
-    ;;
-  interix*)
-    # we just hope/assume this is gcc and not c89 (= MSVC++)
-    with_gnu_ld=yes
-    ;;
-  openbsd*)
-    with_gnu_ld=no
-    ;;
-  esac
 
-  ld_shlibs=yes
-  if test "$with_gnu_ld" = yes; then
-    # If archive_cmds runs LD, not CC, wlarc should be empty
-    wlarc='${wl}'
 
-    # Set some defaults for GNU ld with shared library support. These
-    # are reset later if shared libraries are not supported. Putting them
-    # here allows them to be overridden if necessary.
-    runpath_var=LD_RUN_PATH
-    hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
-    export_dynamic_flag_spec='${wl}--export-dynamic'
-    # ancient GNU ld didn't support --whole-archive et. al.
-    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
-	whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-      else
-  	whole_archive_flag_spec=
-    fi
-    supports_anon_versioning=no
-    case `$LD -v 2>/dev/null` in
-      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
-      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
-      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
-      *\ 2.11.*) ;; # other 2.11 versions
-      *) supports_anon_versioning=yes ;;
-    esac
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
 
-    # See if GNU ld supports shared libraries.
-    case $host_os in
-    aix[3-9]*)
-      # On AIX/PPC, the GNU linker is very broken
-      if test "$host_cpu" != ia64; then
-	ld_shlibs=no
-	cat <<EOF 1>&2
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
 
-*** Warning: the GNU linker, at least up to release 2.9.1, is reported
-*** to be unable to reliably create shared libraries on AIX.
-*** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to modify your PATH
-*** so that a non-GNU linker is found, and then restart.
+# Allow CC to be a program name with arguments.
+compiler=$CC
 
-EOF
-      fi
-      ;;
 
-    amigaos*)
-      archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-      hardcode_libdir_flag_spec='-L$libdir'
-      hardcode_minus_L=yes
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
+$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
+if ${lt_cv_sys_global_symbol_pipe+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
 
-      # Samuel A. Falvo II <kc5tja at dolphin.openprojects.net> reports
-      # that the semantics of dynamic libraries on AmigaOS, at least up
-      # to version 4, is to share data among multiple programs linked
-      # with the same dynamic library.  Since this doesn't match the
-      # behavior of shared libraries on other platforms, we can't use
-      # them.
-      ld_shlibs=no
-      ;;
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
 
-    beos*)
-      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-	allow_undefined_flag=unsupported
-	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
-	# support --undefined.  This deserves some investigation.  FIXME
-	archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-      else
-	ld_shlibs=no
-      fi
-      ;;
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
 
-    cygwin* | mingw* | pw32*)
-      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
-      # as there is no search path for DLLs.
-      hardcode_libdir_flag_spec='-L$libdir'
-      allow_undefined_flag=unsupported
-      always_export_symbols=no
-      enable_shared_with_static_runtimes=yes
-      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
 
-      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
-        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	# If the export-symbols file already is a .def file (1st line
-	# is EXPORTS), use it as is; otherwise, prepend...
-	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	  cp $export_symbols $output_objdir/$soname.def;
-	else
-	  echo EXPORTS > $output_objdir/$soname.def;
-	  cat $export_symbols >> $output_objdir/$soname.def;
-	fi~
-	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-      else
-	ld_shlibs=no
-      fi
-      ;;
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[BCDT]'
+  ;;
+cygwin* | mingw* | pw32* | cegcc*)
+  symcode='[ABCDGISTW]'
+  ;;
+hpux*)
+  if test "$host_cpu" = ia64; then
+    symcode='[ABCDEGRST]'
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[BCDEGRST]'
+  ;;
+osf*)
+  symcode='[BCDEGQRST]'
+  ;;
+solaris*)
+  symcode='[BDRT]'
+  ;;
+sco3.2v5*)
+  symcode='[DT]'
+  ;;
+sysv4.2uw2*)
+  symcode='[DT]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[ABDT]'
+  ;;
+sysv4)
+  symcode='[DFNSTU]'
+  ;;
+esac
 
-    interix[3-9]*)
-      hardcode_direct=no
-      hardcode_shlibpath_var=no
-      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-      export_dynamic_flag_spec='${wl}-E'
-      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
-      # Instead, shared libraries are loaded at an image base (0x10000000 by
-      # default) and relocated if they conflict, which is a slow very memory
-      # consuming and fragmenting process.  To avoid this, we pick a random,
-      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
-      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
-      archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      ;;
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[ABCDGIRSTW]' ;;
+esac
 
-    gnu* | linux* | k*bsd*-gnu)
-      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-	tmp_addflag=
-	case $cc_basename,$host_cpu in
-	pgcc*)				# Portland Group C compiler
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_addflag=' $pic_flag'
-	  ;;
-	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
-	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_addflag=' $pic_flag -Mnomain' ;;
-	ecc*,ia64* | icc*,ia64*)		# Intel C compiler on ia64
-	  tmp_addflag=' -i_dynamic' ;;
-	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
-	  tmp_addflag=' -i_dynamic -nofor_main' ;;
-	ifc* | ifort*)			# Intel Fortran compiler
-	  tmp_addflag=' -nofor_main' ;;
-	esac
-	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)			# Sun C 5.9
-	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_sharedflag='-G' ;;
-	*Sun\ F*)			# Sun Fortran 8.3
-	  tmp_sharedflag='-G' ;;
-	*)
-	  tmp_sharedflag='-shared' ;;
-	esac
-	archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
 
-	if test $supports_anon_versioning = yes; then
-	  archive_expsym_cmds='$echo "{ global:" > $output_objdir/$libname.ver~
-  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-  $echo "local: *; };" >> $output_objdir/$libname.ver~
-	  $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
-	fi
-	link_all_deplibs=no
-      else
-	ld_shlibs=no
-      fi
-      ;;
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
 
-    netbsd* | netbsdelf*-gnu)
-      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
-	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
-	wlarc=
-      else
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      fi
-      ;;
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
 
-    solaris*)
-      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
-	ld_shlibs=no
-	cat <<EOF 1>&2
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
 
-*** Warning: The releases 2.8.* of the GNU linker cannot reliably
-*** create shared libraries on Solaris systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.9.1 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+    # Fake it for dumpbin and say T for any non-static function
+    # and D for any global variable.
+    # Also find C++ and __fastcall symbols from MSVC++,
+    # which start with @ or ?.
+    lt_cv_sys_global_symbol_pipe="$AWK '"\
+"     {last_section=section; section=\$ 3};"\
+"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+"     \$ 0!~/External *\|/{next};"\
+"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+"     {if(hide[section]) next};"\
+"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
+"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+"     ' prfx=^$ac_symprfx"
+  else
+    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[	 ]\($symcode$symcode*\)[	 ][	 ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+  fi
+  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
 
-EOF
-      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+  rm -f conftest*
+  cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
+  (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
       else
-	ld_shlibs=no
+	rm -f "$nlist"T
       fi
-      ;;
 
-    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
-      case `$LD -v 2>&1` in
-        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
-	ld_shlibs=no
-	cat <<_LT_EOF 1>&2
+      # Make sure that we snagged all the symbols we need.
+      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT_DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT_DLSYM_CONST
+#else
+# define LT_DLSYM_CONST const
+#endif
 
-*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
-*** reliably create shared libraries on SCO systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 _LT_EOF
-	;;
-	*)
-	  if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-	    hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
-	    archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
-	    archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
-	  else
-	    ld_shlibs=no
-	  fi
-	;;
-      esac
-      ;;
+	  # Now generate the symbol file.
+	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
 
-    sunos4*)
-      archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      wlarc=
-      hardcode_direct=yes
-      hardcode_shlibpath_var=no
-      ;;
+	  cat <<_LT_EOF >> conftest.$ac_ext
 
-    *)
-      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+/* The mapping between symbol names and symbols.  */
+LT_DLSYM_CONST struct {
+  const char *name;
+  void       *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[] =
+{
+  { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+	  cat <<\_LT_EOF >> conftest.$ac_ext
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  lt_globsym_save_LIBS=$LIBS
+	  lt_globsym_save_CFLAGS=$CFLAGS
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext}; then
+	    pipe_works=yes
+	  fi
+	  LIBS=$lt_globsym_save_LIBS
+	  CFLAGS=$lt_globsym_save_CFLAGS
+	else
+	  echo "cannot find nm_test_func in $nlist" >&5
+	fi
       else
-	ld_shlibs=no
+	echo "cannot find nm_test_var in $nlist" >&5
       fi
-      ;;
-    esac
-
-    if test "$ld_shlibs" = no; then
-      runpath_var=
-      hardcode_libdir_flag_spec=
-      export_dynamic_flag_spec=
-      whole_archive_flag_spec=
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
     fi
   else
-    # PORTME fill in a description of your system's linker (not GNU ld)
-    case $host_os in
-    aix3*)
-      allow_undefined_flag=unsupported
-      always_export_symbols=yes
-      archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
-      # Note: this linker hardcodes the directories in LIBPATH if there
-      # are no directories specified by -L.
-      hardcode_minus_L=yes
-      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
-	# Neither direct hardcoding nor static linking is supported with a
-	# broken collect2.
-	hardcode_direct=unsupported
-      fi
-      ;;
+    echo "$progname: failed program was:" >&5
+    cat conftest.$ac_ext >&5
+  fi
+  rm -rf conftest* conftst*
 
-    aix[4-9]*)
-      if test "$host_cpu" = ia64; then
-	# On IA64, the linker does run time linking by default, so we don't
-	# have to do anything special.
-	aix_use_runtimelinking=no
-	exp_sym_flag='-Bexport'
-	no_entry_flag=""
-      else
-	# If we're using GNU nm, then we don't want the "-C" option.
-	# -C means demangle to AIX nm, but means don't demangle with GNU nm
-	if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
-	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
-	else
-	  export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
-	fi
-	aix_use_runtimelinking=no
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
 
-	# Test if we are trying to use run time linking or normal
-	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
-	# need to do runtime linking.
-	case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
-	  for ld_flag in $LDFLAGS; do
-  	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
-  	    aix_use_runtimelinking=yes
-  	    break
-  	  fi
-	  done
-	  ;;
-	esac
+fi
 
-	exp_sym_flag='-bexport'
-	no_entry_flag='-bnoentry'
-      fi
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
+fi
 
-      # When large executables or shared objects are built, AIX ld can
-      # have problems creating the table of contents.  If linking a library
-      # or program results in "error TOC overflow" add -mminimal-toc to
-      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
-      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
+  nm_file_list_spec='@'
+fi
 
-      archive_cmds=''
-      hardcode_direct=yes
-      hardcode_libdir_separator=':'
-      link_all_deplibs=yes
 
-      if test "$GCC" = yes; then
-	case $host_os in aix4.[012]|aix4.[012].*)
-	# We only want to do this on AIX 4.2 and lower, the check
-	# below for broken collect2 doesn't work under 4.3+
-	  collect2name=`${CC} -print-prog-name=collect2`
-	  if test -f "$collect2name" && \
-  	   strings "$collect2name" | grep resolve_lib_name >/dev/null
-	  then
-  	  # We have reworked collect2
-  	  :
-	  else
-  	  # We have old collect2
-  	  hardcode_direct=unsupported
-  	  # It fails to find uninstalled libraries when the uninstalled
-  	  # path is not listed in the libpath.  Setting hardcode_minus_L
-  	  # to unsupported forces relinking
-  	  hardcode_minus_L=yes
-  	  hardcode_libdir_flag_spec='-L$libdir'
-  	  hardcode_libdir_separator=
-	  fi
-	  ;;
-	esac
-	shared_flag='-shared'
-	if test "$aix_use_runtimelinking" = yes; then
-	  shared_flag="$shared_flag "'${wl}-G'
-	fi
-      else
-	# not using gcc
-	if test "$host_cpu" = ia64; then
-  	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
-  	# chokes on -Wl,-G. The following line is correct:
-	  shared_flag='-G'
-	else
-	  if test "$aix_use_runtimelinking" = yes; then
-	    shared_flag='${wl}-G'
-	  else
-	    shared_flag='${wl}-bM:SRE'
-	  fi
-	fi
-      fi
 
-      # It seems that -bexpall does not export symbols beginning with
-      # underscore (_), so it is better to generate a list of symbols to export.
-      always_export_symbols=yes
-      if test "$aix_use_runtimelinking" = yes; then
-	# Warning - without using the other runtime loading flags (-brtl),
-	# -berok will link without error, but may produce a broken library.
-	allow_undefined_flag='-berok'
-       # Determine the default libpath from the value encoded in an empty executable.
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-int
-main ()
-{
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
 
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
-       hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
-	archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
-       else
-	if test "$host_cpu" = ia64; then
-	  hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
-	  allow_undefined_flag="-z nodefs"
-	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
-	else
-	 # Determine the default libpath from the value encoded in an empty executable.
-	 cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-int
-main ()
-{
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
 
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
-	 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
-	  # Warning - without using the other run time loading flags,
-	  # -berok will link without error, but may produce a broken library.
-	  no_undefined_flag=' ${wl}-bernotok'
-	  allow_undefined_flag=' ${wl}-berok'
-	  # Exported symbols can be pulled into shared objects from archives
-	  whole_archive_flag_spec='$convenience'
-	  archive_cmds_need_lc=yes
-	  # This is similar to how AIX traditionally builds its shared libraries.
-	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
-	fi
-      fi
-      ;;
 
-    amigaos*)
-      archive_cmds='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-      hardcode_libdir_flag_spec='-L$libdir'
-      hardcode_minus_L=yes
-      # see comment about different semantics on the GNU ld section
-      ld_shlibs=no
-      ;;
 
-    bsdi[45]*)
-      export_dynamic_flag_spec=-rdynamic
-      ;;
 
-    cygwin* | mingw* | pw32*)
-      # When not using gcc, we currently assume that we are using
-      # Microsoft Visual C++.
-      # hardcode_libdir_flag_spec is actually meaningless, as there is
-      # no search path for DLLs.
-      hardcode_libdir_flag_spec=' '
-      allow_undefined_flag=unsupported
-      # Tell ltmain to make .lib files, not .a files.
-      libext=lib
-      # Tell ltmain to make .dll files, not .so files.
-      shrext_cmds=".dll"
-      # FIXME: Setting linknames here is a bad hack.
-      archive_cmds='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
-      # The linker will automatically build a .lib file if we build a DLL.
-      old_archive_From_new_cmds='true'
-      # FIXME: Should let the user specify the lib program.
-      old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
-      fix_srcfile_path='`cygpath -w "$srcfile"`'
-      enable_shared_with_static_runtimes=yes
-      ;;
 
-    darwin* | rhapsody*)
-      case $host_os in
-        rhapsody* | darwin1.[012])
-         allow_undefined_flag='${wl}-undefined ${wl}suppress'
-         ;;
-       *) # Darwin 1.3 on
-         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
-           allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
-         else
-           case ${MACOSX_DEPLOYMENT_TARGET} in
-             10.[012])
-               allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
-               ;;
-             10.*)
-               allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup'
-               ;;
-           esac
-         fi
-         ;;
-      esac
-      archive_cmds_need_lc=no
-      hardcode_direct=no
-      hardcode_automatic=yes
-      hardcode_shlibpath_var=unsupported
-      whole_archive_flag_spec=''
-      link_all_deplibs=yes
-    if test "$GCC" = yes ; then
-    	output_verbose_link_cmd='echo'
-        archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
-        module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-        archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
-        module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
-    else
-      case $cc_basename in
-        xlc*)
-         output_verbose_link_cmd='echo'
-         archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
-         module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
-          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
-         archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-          module_expsym_cmds='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-          ;;
-       *)
-         ld_shlibs=no
-          ;;
-      esac
-    fi
-      ;;
 
-    dgux*)
-      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_libdir_flag_spec='-L$libdir'
-      hardcode_shlibpath_var=no
-      ;;
 
-    freebsd1*)
-      ld_shlibs=no
-      ;;
 
-    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
-    # support.  Future versions do this automatically, but an explicit c++rt0.o
-    # does not break anything, and helps significantly (at the cost of a little
-    # extra space).
-    freebsd2.2*)
-      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
-      hardcode_libdir_flag_spec='-R$libdir'
-      hardcode_direct=yes
-      hardcode_shlibpath_var=no
-      ;;
 
-    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2*)
-      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_direct=yes
-      hardcode_minus_L=yes
-      hardcode_shlibpath_var=no
-      ;;
 
-    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd* | dragonfly*)
-      archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
-      hardcode_libdir_flag_spec='-R$libdir'
-      hardcode_direct=yes
-      hardcode_shlibpath_var=no
-      ;;
 
-    hpux9*)
-      if test "$GCC" = yes; then
-	archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      else
-	archive_cmds='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      fi
-      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
-      hardcode_libdir_separator=:
-      hardcode_direct=yes
 
-      # hardcode_minus_L: Not really in the search PATH,
-      # but as the default location of the library.
-      hardcode_minus_L=yes
-      export_dynamic_flag_spec='${wl}-E'
-      ;;
 
-    hpux10*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
-      fi
-      if test "$with_gnu_ld" = no; then
-	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
-	hardcode_libdir_separator=:
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
+$as_echo_n "checking for sysroot... " >&6; }
 
-	hardcode_direct=yes
-	export_dynamic_flag_spec='${wl}-E'
+# Check whether --with-sysroot was given.
+if test "${with_sysroot+set}" = set; then :
+  withval=$with_sysroot;
+else
+  with_sysroot=no
+fi
 
-	# hardcode_minus_L: Not really in the search PATH,
-	# but as the default location of the library.
-	hardcode_minus_L=yes
-      fi
-      ;;
 
-    hpux11*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	case $host_cpu in
-	hppa*64*)
-	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	ia64*)
-	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	  archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	esac
-      else
-	case $host_cpu in
-	hppa*64*)
-	  archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	ia64*)
-	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	esac
-      fi
-      if test "$with_gnu_ld" = no; then
-	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
-	hardcode_libdir_separator=:
-
-	case $host_cpu in
-	hppa*64*|ia64*)
-	  hardcode_libdir_flag_spec_ld='+b $libdir'
-	  hardcode_direct=no
-	  hardcode_shlibpath_var=no
-	  ;;
-	*)
-	  hardcode_direct=yes
-	  export_dynamic_flag_spec='${wl}-E'
-
-	  # hardcode_minus_L: Not really in the search PATH,
-	  # but as the default location of the library.
-	  hardcode_minus_L=yes
-	  ;;
-	esac
-      fi
-      ;;
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+   if test "$GCC" = yes; then
+     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+   fi
+   ;; #(
+ /*)
+   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+   ;; #(
+ no|'')
+   ;; #(
+ *)
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5
+$as_echo "${with_sysroot}" >&6; }
+   as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
+   ;;
+esac
 
-    irix5* | irix6* | nonstopux*)
-      if test "$GCC" = yes; then
-	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-      else
-	archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-	hardcode_libdir_flag_spec_ld='-rpath $libdir'
-      fi
-      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-      hardcode_libdir_separator=:
-      link_all_deplibs=yes
-      ;;
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
+$as_echo "${lt_sysroot:-no}" >&6; }
 
-    netbsd* | netbsdelf*-gnu)
-      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
-	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
-      else
-	archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
-      fi
-      hardcode_libdir_flag_spec='-R$libdir'
-      hardcode_direct=yes
-      hardcode_shlibpath_var=no
-      ;;
 
-    newsos6)
-      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_direct=yes
-      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-      hardcode_libdir_separator=:
-      hardcode_shlibpath_var=no
-      ;;
 
-    openbsd*)
-      if test -f /usr/libexec/ld.so; then
-	hardcode_direct=yes
-	hardcode_shlibpath_var=no
-	if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	  archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	  archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
-	  hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-	  export_dynamic_flag_spec='${wl}-E'
-	else
-	  case $host_os in
-	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
-	     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-	     hardcode_libdir_flag_spec='-R$libdir'
-	     ;;
-	   *)
-	     archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	     hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
-	     ;;
-	  esac
-        fi
-      else
-	ld_shlibs=no
-      fi
-      ;;
 
-    os2*)
-      hardcode_libdir_flag_spec='-L$libdir'
-      hardcode_minus_L=yes
-      allow_undefined_flag=unsupported
-      archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
-      old_archive_From_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
-      ;;
 
-    osf3*)
-      if test "$GCC" = yes; then
-	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-      else
-	allow_undefined_flag=' -expect_unresolved \*'
-	archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-      fi
-      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-      hardcode_libdir_separator=:
-      ;;
 
-    osf4* | osf5*)	# as osf3* with the addition of -msym flag
-      if test "$GCC" = yes; then
-	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
-      else
-	allow_undefined_flag=' -expect_unresolved \*'
-	archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
-	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then :
+  enableval=$enable_libtool_lock;
+fi
 
-	# Both c and cxx compiler support -rpath directly
-	hardcode_libdir_flag_spec='-rpath $libdir'
-      fi
-      hardcode_libdir_separator=:
-      ;;
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
 
-    solaris*)
-      no_undefined_flag=' -z text'
-      if test "$GCC" = yes; then
-	wlarc='${wl}'
-	archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-	  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
-      else
-	wlarc=''
-	archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-  	$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
-      fi
-      hardcode_libdir_flag_spec='-R$libdir'
-      hardcode_shlibpath_var=no
-      case $host_os in
-      solaris2.[0-5] | solaris2.[0-5].*) ;;
-      *)
-	# The compiler driver will combine and reorder linker options,
-	# but understands `-z linker_flag'.  GCC discards it without `$wl',
-	# but is careful enough not to reorder.
- 	# Supported since Solaris 2.6 (maybe 2.5.1?)
-	if test "$GCC" = yes; then
-	  whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
-	else
-	  whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
-	fi
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.$ac_objext` in
+      *ELF-32*)
+	HPUX_IA64_MODE="32"
 	;;
-      esac
-      link_all_deplibs=yes
-      ;;
-
-    sunos4*)
-      if test "x$host_vendor" = xsequent; then
-	# Use $CC to link under sequent, because it throws in some extra .o
-	# files that make .init and .fini sections work.
-	archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
-      fi
-      hardcode_libdir_flag_spec='-L$libdir'
-      hardcode_direct=yes
-      hardcode_minus_L=yes
-      hardcode_shlibpath_var=no
-      ;;
-
-    sysv4)
-      case $host_vendor in
-	sni)
-	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  hardcode_direct=yes # is this really true???
+      *ELF-64*)
+	HPUX_IA64_MODE="64"
 	;;
-	siemens)
-	  ## LD is ld it makes a PLAMLIB
-	  ## CC just makes a GrossModule.
-	  archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
-	  reload_cmds='$CC -r -o $output$reload_objs'
-	  hardcode_direct=no
-        ;;
-	motorola)
-	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '#line '$LINENO' "configure"' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    if test "$lt_cv_prog_gnu_ld" = yes; then
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -melf32bsmip"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -melf32bmipn32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -melf64bmip"
 	;;
       esac
-      runpath_var='LD_RUN_PATH'
-      hardcode_shlibpath_var=no
-      ;;
+    else
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -32"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -n32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -64"
+	  ;;
+      esac
+    fi
+  fi
+  rm -rf conftest*
+  ;;
 
-    sysv4.3*)
-      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_shlibpath_var=no
-      export_dynamic_flag_spec='-Bexport'
-      ;;
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.o` in
+      *32-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_i386_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_i386"
+	    ;;
+	  ppc64-*linux*|powerpc64-*linux*)
+	    LD="${LD-ld} -m elf32ppclinux"
+	    ;;
+	  s390x-*linux*)
+	    LD="${LD-ld} -m elf_s390"
+	    ;;
+	  sparc64-*linux*)
+	    LD="${LD-ld} -m elf32_sparc"
+	    ;;
+	esac
+	;;
+      *64-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_x86_64_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_x86_64"
+	    ;;
+	  ppc*-*linux*|powerpc*-*linux*)
+	    LD="${LD-ld} -m elf64ppc"
+	    ;;
+	  s390*-*linux*|s390*-*tpf*)
+	    LD="${LD-ld} -m elf64_s390"
+	    ;;
+	  sparc*-*linux*)
+	    LD="${LD-ld} -m elf64_sparc"
+	    ;;
+	esac
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
 
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	hardcode_shlibpath_var=no
-	runpath_var=LD_RUN_PATH
-	hardcode_runpath_var=yes
-	ld_shlibs=yes
-      fi
-      ;;
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
+$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
+if ${lt_cv_cc_needs_belf+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
-      no_undefined_flag='${wl}-z,text'
-      archive_cmds_need_lc=no
-      hardcode_shlibpath_var=no
-      runpath_var='LD_RUN_PATH'
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-      if test "$GCC" = yes; then
-	archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      fi
-      ;;
+int
+main ()
+{
 
-    sysv5* | sco3.2v5* | sco5v6*)
-      # Note: We can NOT use -z defs as we might desire, because we do not
-      # link with -lc, and that would cause any symbols used from libc to
-      # always be unresolved, which means just about no library would
-      # ever link correctly.  If we're not using GNU ld we use -z text
-      # though, which does catch some bad symbols but isn't as heavy-handed
-      # as -z defs.
-      no_undefined_flag='${wl}-z,text'
-      allow_undefined_flag='${wl}-z,nodefs'
-      archive_cmds_need_lc=no
-      hardcode_shlibpath_var=no
-      hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
-      hardcode_libdir_separator=':'
-      link_all_deplibs=yes
-      export_dynamic_flag_spec='${wl}-Bexport'
-      runpath_var='LD_RUN_PATH'
-
-      if test "$GCC" = yes; then
-	archive_cmds='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	archive_cmds='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-      fi
-      ;;
-
-    uts4*)
-      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_libdir_flag_spec='-L$libdir'
-      hardcode_shlibpath_var=no
-      ;;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  lt_cv_cc_needs_belf=yes
+else
+  lt_cv_cc_needs_belf=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+     ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-    *)
-      ld_shlibs=no
-      ;;
-    esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
+$as_echo "$lt_cv_cc_needs_belf" >&6; }
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
   fi
-
-{ echo "$as_me:$LINENO: result: $ld_shlibs" >&5
-echo "${ECHO_T}$ld_shlibs" >&6; }
-test "$ld_shlibs" = no && can_build_shared=no
-
-#
-# Do we need to explicitly link libc?
-#
-case "x$archive_cmds_need_lc" in
-x|xyes)
-  # Assume -lc should be added
-  archive_cmds_need_lc=yes
-
-  if test "$enable_shared" = yes && test "$GCC" = yes; then
-    case $archive_cmds in
-    *'~'*)
-      # FIXME: we may have to deal with multi-command sequences.
-      ;;
-    '$CC '*)
-      # Test whether the compiler implicitly links with -lc since on some
-      # systems, -lgcc has to come before -lc. If gcc already passes -lc
-      # to ld, don't add -lc before -lgcc.
-      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
-echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
-      $rm conftest*
-      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
-      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  ;;
+sparc*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } 2>conftest.err; then
-        soname=conftest
-        lib=conftest
-        libobjs=conftest.$ac_objext
-        deplibs=
-        wl=$lt_prog_compiler_wl
-	pic_flag=$lt_prog_compiler_pic
-        compiler_flags=-v
-        linker_flags=-v
-        verstring=
-        output_objdir=.
-        libname=conftest
-        lt_save_allow_undefined_flag=$allow_undefined_flag
-        allow_undefined_flag=
-        if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
-  (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-        then
-	  archive_cmds_need_lc=no
-        else
-	  archive_cmds_need_lc=yes
-        fi
-        allow_undefined_flag=$lt_save_allow_undefined_flag
-      else
-        cat conftest.err 1>&5
-      fi
-      $rm conftest*
-      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
-echo "${ECHO_T}$archive_cmds_need_lc" >&6; }
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      *)
+	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+	  LD="${LD-ld} -64"
+	fi
+	;;
+      esac
       ;;
     esac
   fi
+  rm -rf conftest*
   ;;
 esac
 
-{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
-echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
-library_names_spec=
-libname_spec='lib$name'
-soname_spec=
-shrext_cmds=".so"
-postinstall_cmds=
-postuninstall_cmds=
-finish_cmds=
-finish_eval=
-shlibpath_var=
-shlibpath_overrides_runpath=unknown
-version_type=none
-dynamic_linker="$host_os ld.so"
-sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_locks="$enable_libtool_lock"
 
-if test "$GCC" = yes; then
-  case $host_os in
-    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
-    *) lt_awk_arg="/^libraries:/" ;;
-  esac
-  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-  if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then
-    # if the path contains ";" then we assume it to be the separator
-    # otherwise default to the standard path separator (i.e. ":") - it is
-    # assumed that no part of a normal pathname contains ";" but that should
-    # okay in the real world where ";" in dirpaths is itself problematic.
-    lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'`
-  else
-    lt_search_path_spec=`echo "$lt_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
+set dummy ${ac_tool_prefix}mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_MANIFEST_TOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$MANIFEST_TOOL"; then
+  ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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
+    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
   fi
-  # Ok, now we have the path, separated by spaces, we can step through it
-  # and add multilib dir if necessary.
-  lt_tmp_lt_search_path_spec=
-  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
-  for lt_sys_path in $lt_search_path_spec; do
-    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
-      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
-    else
-      test -d "$lt_sys_path" && \
-	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
-    fi
+done
   done
-  lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk '
-BEGIN {RS=" "; FS="/|\n";} {
-  lt_foo="";
-  lt_count=0;
-  for (lt_i = NF; lt_i > 0; lt_i--) {
-    if ($lt_i != "" && $lt_i != ".") {
-      if ($lt_i == "..") {
-        lt_count++;
-      } else {
-        if (lt_count == 0) {
-          lt_foo="/" $lt_i lt_foo;
-        } else {
-          lt_count--;
-        }
-      }
-    }
-  }
-  if (lt_foo != "") { lt_freq[lt_foo]++; }
-  if (lt_freq[lt_foo] == 1) { print lt_foo; }
-}'`
-  sys_lib_search_path_spec=`echo $lt_search_path_spec`
+IFS=$as_save_IFS
+
+fi
+fi
+MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
+if test -n "$MANIFEST_TOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
+$as_echo "$MANIFEST_TOOL" >&6; }
 else
-  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
-need_lib_prefix=unknown
-hardcode_into_libs=no
 
-# when you set need_version to no, make sure it does not cause -set_version
-# flags to be left without arguments
-need_version=unknown
 
-case $host_os in
-aix3*)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
-  shlibpath_var=LIBPATH
+fi
+if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
+  ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
+  # Extract the first word of "mt", so it can be a program name with args.
+set dummy mt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_MANIFEST_TOOL"; then
+  ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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
+    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
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-  # AIX 3 has no versioning support, so we append a major version to the name.
-  soname_spec='${libname}${release}${shared_ext}$major'
-  ;;
+fi
+fi
+ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
+if test -n "$ac_ct_MANIFEST_TOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
+$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-aix[4-9]*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  hardcode_into_libs=yes
-  if test "$host_cpu" = ia64; then
-    # AIX 5 supports IA64
-    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
-    shlibpath_var=LD_LIBRARY_PATH
+  if test "x$ac_ct_MANIFEST_TOOL" = x; then
+    MANIFEST_TOOL=":"
   else
-    # With GCC up to 2.95.x, collect2 would create an import file
-    # for dependence libraries.  The import file would start with
-    # the line `#! .'.  This would cause the generated library to
-    # depend on `.', always an invalid library.  This was fixed in
-    # development snapshots of GCC prior to 3.0.
-    case $host_os in
-      aix4 | aix4.[01] | aix4.[01].*)
-      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
-	   echo ' yes '
-	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
-	:
-      else
-	can_build_shared=no
-      fi
-      ;;
-    esac
-    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
-    # soname into executable. Probably we can add versioning support to
-    # collect2, so additional links can be useful in future.
-    if test "$aix_use_runtimelinking" = yes; then
-      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
-      # instead of lib<name>.a to let people know that these are not
-      # typical AIX shared libraries.
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    else
-      # We preserve .a as extension for shared libraries through AIX4.2
-      # and later when we are not doing run time linking.
-      library_names_spec='${libname}${release}.a $libname.a'
-      soname_spec='${libname}${release}${shared_ext}$major'
-    fi
-    shlibpath_var=LIBPATH
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
   fi
-  ;;
+else
+  MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
+fi
 
-amigaos*)
-  library_names_spec='$libname.ixlibrary $libname.a'
-  # Create ${libname}_ixlibrary.a entries in /sys/libs.
-  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
-  ;;
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
+$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
+if ${lt_cv_path_mainfest_tool+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_path_mainfest_tool=no
+  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
+  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+  cat conftest.err >&5
+  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+    lt_cv_path_mainfest_tool=yes
+  fi
+  rm -f conftest*
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
+$as_echo "$lt_cv_path_mainfest_tool" >&6; }
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+  MANIFEST_TOOL=:
+fi
 
-beos*)
-  library_names_spec='${libname}${shared_ext}'
-  dynamic_linker="$host_os ld.so"
-  shlibpath_var=LIBRARY_PATH
-  ;;
 
-bsdi[45]*)
-  version_type=linux
-  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'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
-  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
-  # the default ld.so.conf also contains /usr/contrib/lib and
-  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
-  # libtool to hard-code these into programs
-  ;;
 
-cygwin* | mingw* | pw32*)
-  version_type=windows
-  shrext_cmds=".dll"
-  need_version=no
-  need_lib_prefix=no
 
-  case $GCC,$host_os in
-  yes,cygwin* | yes,mingw* | yes,pw32*)
-    library_names_spec='$libname.dll.a'
-    # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
-      dldir=$destdir/`dirname \$dlpath`~
-      test -d \$dldir || mkdir -p \$dldir~
-      $install_prog $dir/$dlname \$dldir/$dlname~
-      chmod a+x \$dldir/$dlname'
-    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
-      dlpath=$dir/\$dldll~
-       $rm \$dlpath'
-    shlibpath_overrides_runpath=yes
 
-    case $host_os in
-    cygwin*)
-      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
-      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
-      ;;
-    mingw*)
-      # MinGW DLLs use traditional 'lib' prefix
-      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
-        # It is most probably a Windows format PATH printed by
-        # mingw gcc, but we are running on Cygwin. Gcc prints its search
-        # path with ; separators, and with drive letters. We can handle the
-        # drive letters (cygwin fileutils understands them), so leave them,
-        # especially as we might pass files found there to a mingw objdump,
-        # which wouldn't understand a cygwinified path. Ahh.
-        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-      else
-        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-      fi
-      ;;
-    pw32*)
-      # pw32 DLLs use 'pw' prefix rather than 'lib'
-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    esac
-    ;;
 
-  *)
-    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
-    ;;
-  esac
-  dynamic_linker='Win32 ld.exe'
-  # FIXME: first we should search . and the directory the executable is in
-  shlibpath_var=PATH
-  ;;
+  case $host_os in
+    rhapsody* | darwin*)
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_DSYMUTIL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$DSYMUTIL"; then
+  ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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
+    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
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-darwin* | rhapsody*)
-  dynamic_linker="$host_os dyld"
-  version_type=darwin
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
-  soname_spec='${libname}${release}${major}$shared_ext'
-  shlibpath_overrides_runpath=yes
-  shlibpath_var=DYLD_LIBRARY_PATH
-  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+fi
+fi
+DSYMUTIL=$ac_cv_prog_DSYMUTIL
+if test -n "$DSYMUTIL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
+$as_echo "$DSYMUTIL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
-  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
-  ;;
 
-dgux*)
-  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
-  ;;
+fi
+if test -z "$ac_cv_prog_DSYMUTIL"; then
+  ac_ct_DSYMUTIL=$DSYMUTIL
+  # Extract the first word of "dsymutil", so it can be a program name with args.
+set dummy dsymutil; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_DSYMUTIL"; then
+  ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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
+    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
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-freebsd1*)
-  dynamic_linker=no
-  ;;
+fi
+fi
+ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
+if test -n "$ac_ct_DSYMUTIL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
+$as_echo "$ac_ct_DSYMUTIL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-freebsd* | dragonfly*)
-  # DragonFly does not have aout.  When/if they implement a new
-  # versioning mechanism, adjust this.
-  if test -x /usr/bin/objformat; then
-    objformat=`/usr/bin/objformat`
+  if test "x$ac_ct_DSYMUTIL" = x; then
+    DSYMUTIL=":"
   else
-    case $host_os in
-    freebsd[123]*) objformat=aout ;;
-    *) objformat=elf ;;
-    esac
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    DSYMUTIL=$ac_ct_DSYMUTIL
   fi
-  version_type=freebsd-$objformat
-  case $version_type in
-    freebsd-elf*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-      need_version=no
-      need_lib_prefix=no
-      ;;
-    freebsd-*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
-      need_version=yes
-      ;;
-  esac
-  shlibpath_var=LD_LIBRARY_PATH
-  case $host_os in
-  freebsd2*)
-    shlibpath_overrides_runpath=yes
-    ;;
-  freebsd3.[01]* | freebsdelf3.[01]*)
-    shlibpath_overrides_runpath=yes
-    hardcode_into_libs=yes
-    ;;
-  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
-  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
-    shlibpath_overrides_runpath=no
-    hardcode_into_libs=yes
-    ;;
-  *) # from 4.6 on, and DragonFly
-    shlibpath_overrides_runpath=yes
-    hardcode_into_libs=yes
-    ;;
-  esac
-  ;;
+else
+  DSYMUTIL="$ac_cv_prog_DSYMUTIL"
+fi
 
-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
-  hardcode_into_libs=yes
-  ;;
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
+set dummy ${ac_tool_prefix}nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_NMEDIT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$NMEDIT"; then
+  ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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
+    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
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-hpux9* | hpux10* | hpux11*)
-  # Give a soname corresponding to the major version so that dld.sl refuses to
-  # link against other versions.
-  version_type=sunos
-  need_lib_prefix=no
-  need_version=no
-  case $host_cpu in
-  ia64*)
-    shrext_cmds='.so'
-    hardcode_into_libs=yes
-    dynamic_linker="$host_os dld.so"
-    shlibpath_var=LD_LIBRARY_PATH
-    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    if test "X$HPUX_IA64_MODE" = X32; then
-      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
-    else
-      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
-    fi
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
-    ;;
-   hppa*64*)
-     shrext_cmds='.sl'
-     hardcode_into_libs=yes
-     dynamic_linker="$host_os dld.sl"
-     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
-     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-     soname_spec='${libname}${release}${shared_ext}$major'
-     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
-     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
-     ;;
-   *)
-    shrext_cmds='.sl'
-    dynamic_linker="$host_os dld.sl"
-    shlibpath_var=SHLIB_PATH
-    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    ;;
-  esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555.
-  postinstall_cmds='chmod 555 $lib'
-  ;;
+fi
+fi
+NMEDIT=$ac_cv_prog_NMEDIT
+if test -n "$NMEDIT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
+$as_echo "$NMEDIT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-interix[3-9]*)
-  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'
-  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
 
-irix5* | irix6* | nonstopux*)
-  case $host_os in
-    nonstopux*) version_type=nonstopux ;;
-    *)
-	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux
-	else
-		version_type=irix
-	fi ;;
-  esac
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
-  case $host_os in
-  irix5* | nonstopux*)
-    libsuff= shlibsuff=
-    ;;
-  *)
-    case $LD in # libtool.m4 will add one of these switches to LD
-    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
-      libsuff= shlibsuff= libmagic=32-bit;;
-    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
-      libsuff=32 shlibsuff=N32 libmagic=N32;;
-    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
-      libsuff=64 shlibsuff=64 libmagic=64-bit;;
-    *) libsuff= shlibsuff= libmagic=never-match;;
-    esac
-    ;;
-  esac
-  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
-  shlibpath_overrides_runpath=no
-  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
-  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
-  hardcode_into_libs=yes
-  ;;
+fi
+if test -z "$ac_cv_prog_NMEDIT"; then
+  ac_ct_NMEDIT=$NMEDIT
+  # Extract the first word of "nmedit", so it can be a program name with args.
+set dummy nmedit; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_NMEDIT"; then
+  ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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
+    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
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-# No shared lib support for Linux oldld, aout, or coff.
-linux*oldld* | linux*aout* | linux*coff*)
-  dynamic_linker=no
-  ;;
+fi
+fi
+ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
+if test -n "$ac_ct_NMEDIT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
+$as_echo "$ac_ct_NMEDIT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-# This must be Linux ELF.
-linux* | k*bsd*-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'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  # This implies no fast_install, which is unacceptable.
-  # Some rework will be needed to allow for fast_install
-  # before this can be enabled.
-  hardcode_into_libs=yes
+  if test "x$ac_ct_NMEDIT" = x; then
+    NMEDIT=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    NMEDIT=$ac_ct_NMEDIT
+  fi
+else
+  NMEDIT="$ac_cv_prog_NMEDIT"
+fi
 
-  # Append ld.so.conf contents to the search path
-  if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
+set dummy ${ac_tool_prefix}lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_LIPO+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$LIPO"; then
+  ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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
+    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
   fi
+done
+  done
+IFS=$as_save_IFS
 
-  # We used to test for /lib/ld.so.1 and disable shared libraries on
-  # powerpc, because MkLinux only supported shared libraries with the
-  # GNU dynamic linker.  Since this was broken with cross compilers,
-  # most powerpc-linux boxes support dynamic linking these days and
-  # people can always --disable-shared, the test was removed, and we
-  # assume the GNU/Linux dynamic linker is in use.
-  dynamic_linker='GNU/Linux ld.so'
-  ;;
+fi
+fi
+LIPO=$ac_cv_prog_LIPO
+if test -n "$LIPO"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
+$as_echo "$LIPO" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-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
-  need_version=no
-  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-    dynamic_linker='NetBSD (a.out) ld.so'
-  else
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    dynamic_linker='NetBSD ld.elf_so'
+fi
+if test -z "$ac_cv_prog_LIPO"; then
+  ac_ct_LIPO=$LIPO
+  # Extract the first word of "lipo", so it can be a program name with args.
+set dummy lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_LIPO+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_LIPO"; then
+  ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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
+    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
   fi
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  ;;
-
-newsos6)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  ;;
+done
+  done
+IFS=$as_save_IFS
 
-nto-qnx*)
-  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=yes
-  ;;
+fi
+fi
+ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
+if test -n "$ac_ct_LIPO"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
+$as_echo "$ac_ct_LIPO" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-openbsd*)
-  version_type=sunos
-  sys_lib_dlsearch_path_spec="/usr/lib"
-  need_lib_prefix=no
-  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
-  case $host_os in
-    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
-    *)                         need_version=no  ;;
-  esac
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    case $host_os in
-      openbsd2.[89] | openbsd2.[89].*)
-	shlibpath_overrides_runpath=no
-	;;
-      *)
-	shlibpath_overrides_runpath=yes
-	;;
-      esac
+  if test "x$ac_ct_LIPO" = x; then
+    LIPO=":"
   else
-    shlibpath_overrides_runpath=yes
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    LIPO=$ac_ct_LIPO
   fi
-  ;;
-
-os2*)
-  libname_spec='$name'
-  shrext_cmds=".dll"
-  need_lib_prefix=no
-  library_names_spec='$libname${shared_ext} $libname.a'
-  dynamic_linker='OS/2 ld.exe'
-  shlibpath_var=LIBPATH
-  ;;
+else
+  LIPO="$ac_cv_prog_LIPO"
+fi
 
-osf3* | osf4* | osf5*)
-  version_type=osf
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
-  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
-  ;;
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OTOOL"; then
+  ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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
+    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
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-rdos*)
-  dynamic_linker=no
-  ;;
+fi
+fi
+OTOOL=$ac_cv_prog_OTOOL
+if test -n "$OTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
+$as_echo "$OTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-solaris*)
-  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=yes
-  hardcode_into_libs=yes
-  # ldd complains unless libraries are executable
-  postinstall_cmds='chmod +x $lib'
-  ;;
 
-sunos4*)
-  version_type=sunos
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  if test "$with_gnu_ld" = yes; then
-    need_lib_prefix=no
+fi
+if test -z "$ac_cv_prog_OTOOL"; then
+  ac_ct_OTOOL=$OTOOL
+  # Extract the first word of "otool", so it can be a program name with args.
+set dummy otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OTOOL+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OTOOL"; then
+  ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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
+    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
   fi
-  need_version=yes
-  ;;
-
-sysv4 | sysv4.3*)
-  version_type=linux
-  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
-  case $host_vendor in
-    sni)
-      shlibpath_overrides_runpath=no
-      need_lib_prefix=no
-      export_dynamic_flag_spec='${wl}-Blargedynsym'
-      runpath_var=LD_RUN_PATH
-      ;;
-    siemens)
-      need_lib_prefix=no
-      ;;
-    motorola)
-      need_lib_prefix=no
-      need_version=no
-      shlibpath_overrides_runpath=no
-      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
-      ;;
-  esac
-  ;;
+done
+  done
+IFS=$as_save_IFS
 
-sysv4*MP*)
-  if test -d /usr/nec ;then
-    version_type=linux
-    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
-    soname_spec='$libname${shared_ext}.$major'
-    shlibpath_var=LD_LIBRARY_PATH
-  fi
-  ;;
+fi
+fi
+ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
+if test -n "$ac_ct_OTOOL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
+$as_echo "$ac_ct_OTOOL" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  version_type=freebsd-elf
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  hardcode_into_libs=yes
-  if test "$with_gnu_ld" = yes; then
-    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
-    shlibpath_overrides_runpath=no
+  if test "x$ac_ct_OTOOL" = x; then
+    OTOOL=":"
   else
-    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
-    shlibpath_overrides_runpath=yes
-    case $host_os in
-      sco3.2v5*)
-        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
-	;;
-    esac
-  fi
-  sys_lib_dlsearch_path_spec='/usr/lib'
-  ;;
-
-uts4*)
-  version_type=linux
-  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
-  ;;
-
-*)
-  dynamic_linker=no
-  ;;
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
 esac
-{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
-echo "${ECHO_T}$dynamic_linker" >&6; }
-test "$dynamic_linker" = no && can_build_shared=no
-
-if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+    OTOOL=$ac_ct_OTOOL
+  fi
 else
-  lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"
+  OTOOL="$ac_cv_prog_OTOOL"
 fi
 
-sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
-if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+    if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_OTOOL64+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OTOOL64"; then
+  ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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
+    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
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL64=$ac_cv_prog_OTOOL64
+if test -n "$OTOOL64"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
+$as_echo "$OTOOL64" >&6; }
 else
-  lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
 
-variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
-if test "$GCC" = yes; then
-  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
 fi
+if test -z "$ac_cv_prog_OTOOL64"; then
+  ac_ct_OTOOL64=$OTOOL64
+  # Extract the first word of "otool64", so it can be a program name with args.
+set dummy otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OTOOL64"; then
+  ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+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
+    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
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
-echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
-hardcode_action=
-if test -n "$hardcode_libdir_flag_spec" || \
-   test -n "$runpath_var" || \
-   test "X$hardcode_automatic" = "Xyes" ; then
+fi
+fi
+ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
+if test -n "$ac_ct_OTOOL64"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
+$as_echo "$ac_ct_OTOOL64" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-  # We can hardcode non-existant directories.
-  if test "$hardcode_direct" != no &&
-     # If the only mechanism to avoid hardcoding is shlibpath_var, we
-     # have to relink, otherwise we might link with an installed library
-     # when we should be linking with a yet-to-be-installed one
-     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no &&
-     test "$hardcode_minus_L" != no; then
-    # Linking always hardcodes the temporary library directory.
-    hardcode_action=relink
+  if test "x$ac_ct_OTOOL64" = x; then
+    OTOOL64=":"
   else
-    # We can link without hardcoding, and we can hardcode nonexisting dirs.
-    hardcode_action=immediate
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OTOOL64=$ac_ct_OTOOL64
   fi
 else
-  # We cannot hardcode anything, or else we can only hardcode existing
-  # directories.
-  hardcode_action=unsupported
+  OTOOL64="$ac_cv_prog_OTOOL64"
 fi
-{ echo "$as_me:$LINENO: result: $hardcode_action" >&5
-echo "${ECHO_T}$hardcode_action" >&6; }
 
-if test "$hardcode_action" = relink; then
-  # Fast installation is not supported
-  enable_fast_install=no
-elif test "$shlibpath_overrides_runpath" = yes ||
-     test "$enable_shared" = no; then
-  # Fast installation is not necessary
-  enable_fast_install=needless
-fi
 
-striplib=
-old_striplib=
-{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
-echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; }
-if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
-  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
-  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
-  { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-else
-# FIXME - insert some real tests, host_os isn't really good enough
-  case $host_os in
-   darwin*)
-       if test -n "$STRIP" ; then
-         striplib="$STRIP -x"
-         old_striplib="$STRIP -S"
-         { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-       else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-       ;;
-   *)
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-    ;;
-  esac
-fi
 
-if test "x$enable_dlopen" != xyes; then
-  enable_dlopen=unknown
-  enable_dlopen_self=unknown
-  enable_dlopen_self_static=unknown
-else
-  lt_cv_dlopen=no
-  lt_cv_dlopen_libs=
 
-  case $host_os in
-  beos*)
-    lt_cv_dlopen="load_add_on"
-    lt_cv_dlopen_libs=
-    lt_cv_dlopen_self=yes
-    ;;
 
-  mingw* | pw32*)
-    lt_cv_dlopen="LoadLibrary"
-    lt_cv_dlopen_libs=
-   ;;
 
-  cygwin*)
-    lt_cv_dlopen="dlopen"
-    lt_cv_dlopen_libs=
-   ;;
 
-  darwin*)
-  # if libdl is installed we need to link against it
-    { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
+$as_echo_n "checking for -single_module linker flag... " >&6; }
+if ${lt_cv_apple_cc_single_mod+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldl  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  lt_cv_apple_cc_single_mod=no
+      if test -z "${LT_MULTI_MODULE}"; then
+	# By default we will add the -single_module flag. You can override
+	# by either setting the environment variable LT_MULTI_MODULE
+	# non-empty at configure time, or by adding -multi_module to the
+	# link flags.
+	rm -rf libconftest.dylib*
+	echo "int foo(void){return 1;}" > conftest.c
+	echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&5
+	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+        _lt_result=$?
+	if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+	  lt_cv_apple_cc_single_mod=yes
+	else
+	  cat conftest.err >&5
+	fi
+	rm -rf libconftest.dylib*
+	rm -f conftest.*
+      fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
+$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
+$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
+if ${lt_cv_ld_exported_symbols_list+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dlopen ();
 int
 main ()
 {
-return dlopen ();
+
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  ac_cv_lib_dl_dlopen=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  lt_cv_ld_exported_symbols_list=yes
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_lib_dl_dlopen=no
+  lt_cv_ld_exported_symbols_list=no
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+	LDFLAGS="$save_LDFLAGS"
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
-if test $ac_cv_lib_dl_dlopen = yes; then
-  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
+$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
+$as_echo_n "checking for -force_load linker flag... " >&6; }
+if ${lt_cv_ld_force_load+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
+  lt_cv_ld_force_load=no
+      cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
+      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
+      echo "$AR cru libconftest.a conftest.o" >&5
+      $AR cru libconftest.a conftest.o 2>&5
+      echo "$RANLIB libconftest.a" >&5
+      $RANLIB libconftest.a 2>&5
+      cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
+      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+      _lt_result=$?
+      if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+	lt_cv_ld_force_load=yes
+      else
+	cat conftest.err >&5
+      fi
+        rm -f conftest.err libconftest.a conftest conftest.c
+        rm -rf conftest.dSYM
 
-    lt_cv_dlopen="dyld"
-    lt_cv_dlopen_libs=
-    lt_cv_dlopen_self=yes
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
+$as_echo "$lt_cv_ld_force_load" >&6; }
+    case $host_os in
+    rhapsody* | darwin1.[012])
+      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+    darwin1.*)
+      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+    darwin*) # darwin 5.x on
+      # if running on 10.5 or later, the deployment target defaults
+      # to the OS version, if on x86, and 10.4, the deployment
+      # target defaults to 10.4. Don't you love it?
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+	10.0,*86*-darwin8*|10.0,*-darwin[91]*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+	10.[012]*)
+	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+	10.*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+      esac
+    ;;
+  esac
+    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+      _lt_dar_single_mod='$single_module'
+    fi
+    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+    else
+      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    fi
+    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+      _lt_dsymutil='~$DSYMUTIL $lib || :'
+    else
+      _lt_dsymutil=
+    fi
+    ;;
+  esac
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+		  inttypes.h stdint.h unistd.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
 
 fi
 
-   ;;
+done
 
-  *)
-    { echo "$as_me:$LINENO: checking for shl_load" >&5
-echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; }
-if test "${ac_cv_func_shl_load+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+
+for ac_header in dlfcn.h
+do :
+  ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_dlfcn_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_DLFCN_H 1
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define shl_load innocuous_shl_load
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char shl_load (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
+fi
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
+done
 
-#undef shl_load
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char shl_load ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_shl_load || defined __stub___shl_load
-choke me
-#endif
 
-int
-main ()
+func_stripname_cnf ()
 {
-return shl_load ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  ac_cv_func_shl_load=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  case ${2} in
+  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+  esac
+} # func_stripname_cnf
 
-	ac_cv_func_shl_load=no
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
-echo "${ECHO_T}$ac_cv_func_shl_load" >&6; }
-if test $ac_cv_func_shl_load = yes; then
-  lt_cv_dlopen="shl_load"
-else
-  { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
-echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; }
-if test "${ac_cv_lib_dld_shl_load+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldld  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char shl_load ();
-int
-main ()
-{
-return shl_load ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  ac_cv_lib_dld_shl_load=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_dld_shl_load=no
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
-echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; }
-if test $ac_cv_lib_dld_shl_load = yes; then
-  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
-else
-  { echo "$as_me:$LINENO: checking for dlopen" >&5
-echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; }
-if test "${ac_cv_func_dlopen+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define dlopen innocuous_dlopen
+# Set options
 
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char dlopen (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
 
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
 
-#undef dlopen
+        enable_dlopen=no
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dlopen ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_dlopen || defined __stub___dlopen
-choke me
-#endif
 
-int
-main ()
-{
-return dlopen ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  ac_cv_func_dlopen=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  enable_win32_dll=no
 
-	ac_cv_func_dlopen=no
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
-echo "${ECHO_T}$ac_cv_func_dlopen" >&6; }
-if test $ac_cv_func_dlopen = yes; then
-  lt_cv_dlopen="dlopen"
-else
-  { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
-echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
-if test "${ac_cv_lib_dl_dlopen+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+            # Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then :
+  enableval=$enable_shared; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldl  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+  enable_shared=yes
+fi
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dlopen ();
-int
-main ()
-{
-return dlopen ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  ac_cv_lib_dl_dlopen=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_dl_dlopen=no
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
-if test $ac_cv_lib_dl_dlopen = yes; then
-  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
-else
-  { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
-echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; }
-if test "${ac_cv_lib_svld_dlopen+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsvld  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dlopen ();
-int
-main ()
-{
-return dlopen ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  ac_cv_lib_svld_dlopen=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_svld_dlopen=no
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
-echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; }
-if test $ac_cv_lib_svld_dlopen = yes; then
-  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
-else
-  { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
-echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; }
-if test "${ac_cv_lib_dld_dld_link+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldld  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dld_link ();
-int
-main ()
-{
-return dld_link ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-  ac_cv_lib_dld_dld_link=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_lib_dld_dld_link=no
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
-echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; }
-if test $ac_cv_lib_dld_dld_link = yes; then
-  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+  # Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then :
+  enableval=$enable_static; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
+else
+  enable_static=yes
 fi
 
 
-fi
 
 
-fi
 
 
-fi
 
 
-fi
 
 
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then :
+  withval=$with_pic; pic_mode="$withval"
+else
+  pic_mode=default
 fi
 
-    ;;
-  esac
 
-  if test "x$lt_cv_dlopen" != xno; then
-    enable_dlopen=yes
-  else
-    enable_dlopen=no
-  fi
+test -z "$pic_mode" && pic_mode=default
 
-  case $lt_cv_dlopen in
-  dlopen)
-    save_CPPFLAGS="$CPPFLAGS"
-    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
 
-    save_LDFLAGS="$LDFLAGS"
-    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
 
-    save_LIBS="$LIBS"
-    LIBS="$lt_cv_dlopen_libs $LIBS"
 
-    { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
-echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; }
-if test "${lt_cv_dlopen_self+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  	  if test "$cross_compiling" = yes; then :
-  lt_cv_dlopen_self=cross
+
+
+
+  # Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then :
+  enableval=$enable_fast_install; p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac
 else
-  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-  lt_status=$lt_dlunknown
-  cat > conftest.$ac_ext <<EOF
-#line 9924 "configure"
-#include "confdefs.h"
+  enable_fast_install=yes
+fi
 
-#if HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
 
-#include <stdio.h>
 
-#ifdef RTLD_GLOBAL
-#  define LT_DLGLOBAL		RTLD_GLOBAL
-#else
-#  ifdef DL_GLOBAL
-#    define LT_DLGLOBAL		DL_GLOBAL
-#  else
-#    define LT_DLGLOBAL		0
-#  endif
-#endif
 
-/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
-   find out it does not work in some platform. */
-#ifndef LT_DLLAZY_OR_NOW
-#  ifdef RTLD_LAZY
-#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
-#  else
-#    ifdef DL_LAZY
-#      define LT_DLLAZY_OR_NOW		DL_LAZY
-#    else
-#      ifdef RTLD_NOW
-#        define LT_DLLAZY_OR_NOW	RTLD_NOW
-#      else
-#        ifdef DL_NOW
-#          define LT_DLLAZY_OR_NOW	DL_NOW
-#        else
-#          define LT_DLLAZY_OR_NOW	0
-#        endif
-#      endif
-#    endif
-#  endif
-#endif
 
-#ifdef __cplusplus
-extern "C" void exit (int);
-#endif
 
-void fnord() { int i=42;}
-int main ()
-{
-  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
-  int status = $lt_dlunknown;
 
-  if (self)
-    {
-      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
-      /* dlclose (self); */
-    }
-  else
-    puts (dlerror ());
 
-    exit (status);
-}
-EOF
-  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
-    (./conftest; exit; ) >&5 2>/dev/null
-    lt_status=$?
-    case x$lt_status in
-      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
-      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
-      x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
-    esac
-  else :
-    # compilation failed
-    lt_cv_dlopen_self=no
-  fi
-fi
-rm -fr conftest*
 
 
-fi
-{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
-echo "${ECHO_T}$lt_cv_dlopen_self" >&6; }
 
-    if test "x$lt_cv_dlopen_self" = xyes; then
-      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
-      { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
-echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; }
-if test "${lt_cv_dlopen_self_static+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  	  if test "$cross_compiling" = yes; then :
-  lt_cv_dlopen_self_static=cross
-else
-  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
-  lt_status=$lt_dlunknown
-  cat > conftest.$ac_ext <<EOF
-#line 10024 "configure"
-#include "confdefs.h"
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
 
-#if HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
 
-#include <stdio.h>
 
-#ifdef RTLD_GLOBAL
-#  define LT_DLGLOBAL		RTLD_GLOBAL
-#else
-#  ifdef DL_GLOBAL
-#    define LT_DLGLOBAL		DL_GLOBAL
-#  else
-#    define LT_DLGLOBAL		0
-#  endif
-#endif
 
-/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
-   find out it does not work in some platform. */
-#ifndef LT_DLLAZY_OR_NOW
-#  ifdef RTLD_LAZY
-#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
-#  else
-#    ifdef DL_LAZY
-#      define LT_DLLAZY_OR_NOW		DL_LAZY
-#    else
-#      ifdef RTLD_NOW
-#        define LT_DLLAZY_OR_NOW	RTLD_NOW
-#      else
-#        ifdef DL_NOW
-#          define LT_DLLAZY_OR_NOW	DL_NOW
-#        else
-#          define LT_DLLAZY_OR_NOW	0
-#        endif
-#      endif
-#    endif
-#  endif
-#endif
 
-#ifdef __cplusplus
-extern "C" void exit (int);
-#endif
 
-void fnord() { int i=42;}
-int main ()
-{
-  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
-  int status = $lt_dlunknown;
 
-  if (self)
-    {
-      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
-      else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
-      /* dlclose (self); */
-    }
-  else
-    puts (dlerror ());
 
-    exit (status);
-}
-EOF
-  if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
-    (./conftest; exit; ) >&5 2>/dev/null
-    lt_status=$?
-    case x$lt_status in
-      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
-      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
-      x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
-    esac
-  else :
-    # compilation failed
-    lt_cv_dlopen_self_static=no
-  fi
-fi
-rm -fr conftest*
 
 
-fi
-{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
-echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; }
-    fi
 
-    CPPFLAGS="$save_CPPFLAGS"
-    LDFLAGS="$save_LDFLAGS"
-    LIBS="$save_LIBS"
-    ;;
-  esac
-
-  case $lt_cv_dlopen_self in
-  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
-  *) enable_dlopen_self=unknown ;;
-  esac
-
-  case $lt_cv_dlopen_self_static in
-  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
-  *) enable_dlopen_self_static=unknown ;;
-  esac
-fi
 
 
-# Report which library types will actually be built
-{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
-echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; }
-{ echo "$as_me:$LINENO: result: $can_build_shared" >&5
-echo "${ECHO_T}$can_build_shared" >&6; }
 
-{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
-echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
-test "$can_build_shared" = "no" && enable_shared=no
 
-# On AIX, shared libraries and static libraries use the same namespace, and
-# are all built from PIC.
-case $host_os in
-aix3*)
-  test "$enable_shared" = yes && enable_static=no
-  if test -n "$RANLIB"; then
-    archive_cmds="$archive_cmds~\$RANLIB \$lib"
-    postinstall_cmds='$RANLIB $lib'
-  fi
-  ;;
 
-aix[4-9]*)
-  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-    test "$enable_shared" = yes && enable_static=no
-  fi
-    ;;
-esac
-{ echo "$as_me:$LINENO: result: $enable_shared" >&5
-echo "${ECHO_T}$enable_shared" >&6; }
-
-{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
-echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
-# Make sure either enable_shared or enable_static is yes.
-test "$enable_shared" = yes || enable_static=yes
-{ echo "$as_me:$LINENO: result: $enable_static" >&5
-echo "${ECHO_T}$enable_static" >&6; }
-
-# The else clause should only fire when bootstrapping the
-# libtool distribution, otherwise you forgot to ship ltmain.sh
-# with your package, and you will get complaints that there are
-# no rules to generate ltmain.sh.
-if test -f "$ltmain"; then
-  # See if we are running on zsh, and set the options which allow our commands through
-  # without removal of \ escapes.
-  if test -n "${ZSH_VERSION+set}" ; then
-    setopt NO_GLOB_SUBST
-  fi
-  # Now quote all the things that may contain metacharacters while being
-  # careful not to overquote the AC_SUBSTed values.  We take copies of the
-  # variables and quote the copies for generation of the libtool script.
-  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
-    SED SHELL STRIP \
-    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
-    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
-    deplibs_check_method reload_flag reload_cmds need_locks \
-    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
-    lt_cv_sys_global_symbol_to_c_name_address \
-    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
-    old_postinstall_cmds old_postuninstall_cmds \
-    compiler \
-    CC \
-    LD \
-    lt_prog_compiler_wl \
-    lt_prog_compiler_pic \
-    lt_prog_compiler_static \
-    lt_prog_compiler_no_builtin_flag \
-    export_dynamic_flag_spec \
-    thread_safe_flag_spec \
-    whole_archive_flag_spec \
-    enable_shared_with_static_runtimes \
-    old_archive_cmds \
-    old_archive_from_new_cmds \
-    predep_objects \
-    postdep_objects \
-    predeps \
-    postdeps \
-    compiler_lib_search_path \
-    compiler_lib_search_dirs \
-    archive_cmds \
-    archive_expsym_cmds \
-    postinstall_cmds \
-    postuninstall_cmds \
-    old_archive_from_expsyms_cmds \
-    allow_undefined_flag \
-    no_undefined_flag \
-    export_symbols_cmds \
-    hardcode_libdir_flag_spec \
-    hardcode_libdir_flag_spec_ld \
-    hardcode_libdir_separator \
-    hardcode_automatic \
-    module_cmds \
-    module_expsym_cmds \
-    lt_cv_prog_compiler_c_o \
-    fix_srcfile_path \
-    exclude_expsyms \
-    include_expsyms; do
-
-    case $var in
-    old_archive_cmds | \
-    old_archive_from_new_cmds | \
-    archive_cmds | \
-    archive_expsym_cmds | \
-    module_cmds | \
-    module_expsym_cmds | \
-    old_archive_from_expsyms_cmds | \
-    export_symbols_cmds | \
-    extract_expsyms_cmds | reload_cmds | finish_cmds | \
-    postinstall_cmds | postuninstall_cmds | \
-    old_postinstall_cmds | old_postuninstall_cmds | \
-    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
-      # Double-quote double-evaled strings.
-      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
-      ;;
-    *)
-      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
-      ;;
-    esac
-  done
 
-  case $lt_echo in
-  *'\$0 --fallback-echo"')
-    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
-    ;;
-  esac
 
-cfgfile="${ofile}T"
-  trap "$rm \"$cfgfile\"; exit 1" 1 2 15
-  $rm -f "$cfgfile"
-  { echo "$as_me:$LINENO: creating $ofile" >&5
-echo "$as_me: creating $ofile" >&6;}
 
-  cat <<__EOF__ >> "$cfgfile"
-#! $SHELL
 
-# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
-# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
-# NOTE: Changes made to this file will be lost: look at ltmain.sh.
-#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
-# Free Software Foundation, Inc.
-#
-# This file is part of GNU Libtool:
-# Originally by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# 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.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
 
-# A sed program that does not truncate output.
-SED=$lt_SED
 
-# Sed that helps us avoid accidentally triggering echo(1) options like -n.
-Xsed="$SED -e 1s/^X//"
 
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
-# The names of the tagged configurations supported by this script.
-available_tags=
 
-# ### BEGIN LIBTOOL CONFIG
 
-# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
 
-# Shell to use when invoking shell scripts.
-SHELL=$lt_SHELL
+test -z "$LN_S" && LN_S="ln -s"
 
-# Whether or not to build shared libraries.
-build_libtool_libs=$enable_shared
 
-# Whether or not to build static libraries.
-build_old_libs=$enable_static
 
-# Whether or not to add -lc for building shared libraries.
-build_libtool_need_lc=$archive_cmds_need_lc
 
-# Whether or not to disallow shared libs when runtime libs are static
-allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
 
-# Whether or not to optimize for fast installation.
-fast_install=$enable_fast_install
 
-# The host system.
-host_alias=$host_alias
-host=$host
-host_os=$host_os
 
-# The build system.
-build_alias=$build_alias
-build=$build
-build_os=$build_os
 
-# An echo program that does not interpret backslashes.
-echo=$lt_echo
 
-# The archiver.
-AR=$lt_AR
-AR_FLAGS=$lt_AR_FLAGS
 
-# A C compiler.
-LTCC=$lt_LTCC
 
-# LTCC compiler flags.
-LTCFLAGS=$lt_LTCFLAGS
 
-# A language-specific compiler.
-CC=$lt_compiler
 
-# Is the compiler the GNU C compiler?
-with_gcc=$GCC
 
-# An ERE matcher.
-EGREP=$lt_EGREP
+if test -n "${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
 
-# The linker used to build libraries.
-LD=$lt_LD
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
+$as_echo_n "checking for objdir... " >&6; }
+if ${lt_cv_objdir+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5
+$as_echo "$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
 
-# Whether we need hard or soft links.
-LN_S=$lt_LN_S
 
-# A BSD-compatible nm program.
-NM=$lt_NM
 
-# A symbol stripping program
-STRIP=$lt_STRIP
 
-# Used to examine libraries when file_magic_cmd begins "file"
-MAGIC_CMD=$MAGIC_CMD
 
-# Used on cygwin: DLL creation program.
-DLLTOOL="$DLLTOOL"
+cat >>confdefs.h <<_ACEOF
+#define LT_OBJDIR "$lt_cv_objdir/"
+_ACEOF
 
-# Used on cygwin: object dumper.
-OBJDUMP="$OBJDUMP"
 
-# Used on cygwin: assembler.
-AS="$AS"
 
-# The name of the directory that contains temporary libtool files.
-objdir=$objdir
 
-# How to create reloadable object files.
-reload_flag=$lt_reload_flag
-reload_cmds=$lt_reload_cmds
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
 
-# How to pass a linker flag through the compiler.
-wl=$lt_lt_prog_compiler_wl
+# Global variables:
+ofile=libtool
+can_build_shared=yes
 
-# Object file suffix (normally "o").
-objext="$ac_objext"
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
 
-# Old archive suffix (normally "a").
-libext="$libext"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
 
-# Shared library suffix (normally ".so").
-shrext_cmds='$shrext_cmds'
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
 
-# Executable file suffix (normally "").
-exeext="$exeext"
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
 
-# Additional compiler flags for building library objects.
-pic_flag=$lt_lt_prog_compiler_pic
-pic_mode=$pic_mode
+for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
 
-# What is the maximum length of a command?
-max_cmd_len=$lt_cv_sys_max_cmd_len
 
-# Does compiler simultaneously support -c and -o options?
-compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
+$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/${ac_tool_prefix}file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<_LT_EOF 1>&2
 
-# Must we lock files when doing compilation?
-need_locks=$lt_need_locks
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool at gnu.org
 
-# Do we need the lib prefix for modules?
-need_lib_prefix=$need_lib_prefix
+_LT_EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
 
-# Do we need a version for libraries?
-need_version=$need_version
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-# Whether dlopen is supported.
-dlopen_support=$enable_dlopen
 
-# Whether dlopen of programs is supported.
-dlopen_self=$enable_dlopen_self
 
-# Whether dlopen of statically linked programs is supported.
-dlopen_self_static=$enable_dlopen_self_static
 
-# Compiler flag to prevent dynamic linking.
-link_static_flag=$lt_lt_prog_compiler_static
 
-# Compiler flag to turn off builtin functions.
-no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
+$as_echo_n "checking for file... " >&6; }
+if ${lt_cv_path_MAGIC_CMD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $MAGIC_CMD in
+[\\/*] |  ?:[\\/]*)
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/file; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/file"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<_LT_EOF 1>&2
 
-# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool at gnu.org
 
-# Compiler flag to generate shared objects directly from archives.
-whole_archive_flag_spec=$lt_whole_archive_flag_spec
+_LT_EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac
+fi
 
-# Compiler flag to generate thread-safe objects.
-thread_safe_flag_spec=$lt_thread_safe_flag_spec
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-# Library versioning type.
-version_type=$version_type
 
-# Format of library name prefix.
-libname_spec=$lt_libname_spec
+  else
+    MAGIC_CMD=:
+  fi
+fi
 
-# List of archive names.  First name is the real one, the rest are links.
-# The last name is the one that the linker finds with -lNAME.
-library_names_spec=$lt_library_names_spec
+  fi
+  ;;
+esac
 
-# The coded name of the library, if different from the real name.
-soname_spec=$lt_soname_spec
+# Use C for the default configuration in the libtool script
 
-# Commands used to build and install an old-style archive.
-RANLIB=$lt_RANLIB
-old_archive_cmds=$lt_old_archive_cmds
-old_postinstall_cmds=$lt_old_postinstall_cmds
-old_postuninstall_cmds=$lt_old_postuninstall_cmds
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-# Create an old-style archive from a shared archive.
-old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
 
-# Create a temporary old-style archive to link instead of a shared archive.
-old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+# Source file extension for C test sources.
+ac_ext=c
 
-# Commands used to build and install a shared archive.
-archive_cmds=$lt_archive_cmds
-archive_expsym_cmds=$lt_archive_expsym_cmds
-postinstall_cmds=$lt_postinstall_cmds
-postuninstall_cmds=$lt_postuninstall_cmds
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
 
-# Commands used to build a loadable module (assumed same as above if empty)
-module_cmds=$lt_module_cmds
-module_expsym_cmds=$lt_module_expsym_cmds
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
 
-# Commands to strip libraries.
-old_striplib=$lt_old_striplib
-striplib=$lt_striplib
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
 
-# Dependencies to place before the objects being linked to create a
-# shared library.
-predep_objects=$lt_predep_objects
 
-# Dependencies to place after the objects being linked to create a
-# shared library.
-postdep_objects=$lt_postdep_objects
 
-# Dependencies to place before the objects being linked to create a
-# shared library.
-predeps=$lt_predeps
 
-# Dependencies to place after the objects being linked to create a
-# shared library.
-postdeps=$lt_postdeps
 
-# The directories searched by this compiler when creating a shared
-# library
-compiler_lib_search_dirs=$lt_compiler_lib_search_dirs
 
-# The library search path used internally by the compiler when linking
-# a shared library.
-compiler_lib_search_path=$lt_compiler_lib_search_path
 
-# Method to check whether dependent libraries are shared objects.
-deplibs_check_method=$lt_deplibs_check_method
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
 
-# Command to use when deplibs_check_method == file_magic.
-file_magic_cmd=$lt_file_magic_cmd
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
 
-# Flag that allows shared libraries with undefined symbols to be built.
-allow_undefined_flag=$lt_allow_undefined_flag
+# Allow CC to be a program name with arguments.
+compiler=$CC
 
-# Flag that forces no undefined symbols.
-no_undefined_flag=$lt_no_undefined_flag
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
 
-# Commands used to finish a libtool library installation in a directory.
-finish_cmds=$lt_finish_cmds
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
 
-# Same as above, but a single script fragment to be evaled but not shown.
-finish_eval=$lt_finish_eval
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
 
-# Take the output of nm and produce a listing of raw symbols and C names.
-global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
 
-# Transform the output of nm in a proper C declaration
-global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
 
-# Transform the output of nm in a C name address pair
-global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+lt_prog_compiler_no_builtin_flag=
 
-# This is the shared library runtime path variable.
-runpath_var=$runpath_var
+if test "$GCC" = yes; then
+  case $cc_basename in
+  nvcc*)
+    lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
+  *)
+    lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
+  esac
 
-# This is the shared library path variable.
-shlibpath_var=$shlibpath_var
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
+if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_rtti_exceptions=no
+   ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="-fno-rtti -fno-exceptions"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_rtti_exceptions=yes
+     fi
+   fi
+   $RM conftest*
 
-# Is shlibpath searched before the hard-coded library search path?
-shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
 
-# How to hardcode a shared library path into an executable.
-hardcode_action=$hardcode_action
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+    lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+    :
+fi
 
-# Whether we should hardcode library paths into libraries.
-hardcode_into_libs=$hardcode_into_libs
+fi
 
-# Flag to hardcode \$libdir into a binary during linking.
-# This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
 
-# If ld is used when linking, flag to hardcode \$libdir into
-# a binary during linking. This must work even if \$libdir does
-# not exist.
-hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
 
-# Whether we need a single -rpath flag with a separated argument.
-hardcode_libdir_separator=$lt_hardcode_libdir_separator
 
-# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
-# resulting binary.
-hardcode_direct=$hardcode_direct
 
-# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
-# resulting binary.
-hardcode_minus_L=$hardcode_minus_L
 
-# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
-# the resulting binary.
-hardcode_shlibpath_var=$hardcode_shlibpath_var
+  lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
 
-# Set to yes if building a shared library automatically hardcodes DIR into the library
-# and all subsequent libraries and executables linked against it.
-hardcode_automatic=$hardcode_automatic
 
-# Variables whose values should be saved in libtool wrapper scripts and
-# restored at relink time.
-variables_saved_for_relink="$variables_saved_for_relink"
+  if test "$GCC" = yes; then
+    lt_prog_compiler_wl='-Wl,'
+    lt_prog_compiler_static='-static'
 
-# Whether libtool must link a program against all its dependency libraries.
-link_all_deplibs=$link_all_deplibs
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
 
-# Compile-time system search path for libraries
-sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            lt_prog_compiler_pic='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
 
-# Run-time system search path for libraries
-sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
 
-# Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path=$lt_fix_srcfile_path
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
 
-# Set to yes if exported symbols are required.
-always_export_symbols=$always_export_symbols
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic='-fno-common'
+      ;;
 
-# The commands to list exported symbols.
-export_symbols_cmds=$lt_export_symbols_cmds
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      lt_prog_compiler_static=
+      ;;
 
-# The commands to extract the exported symbol list from a shared archive.
-extract_expsyms_cmds=$lt_extract_expsyms_cmds
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic='-fPIC'
+	;;
+      esac
+      ;;
 
-# Symbols that should not be listed in the preloaded symbols.
-exclude_expsyms=$lt_exclude_expsyms
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
 
-# Symbols that must always be exported.
-include_expsyms=$lt_include_expsyms
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      lt_prog_compiler_can_build_shared=no
+      enable_shared=no
+      ;;
 
-# ### END LIBTOOL CONFIG
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic='-fPIC -shared'
+      ;;
 
-__EOF__
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic=-Kconform_pic
+      fi
+      ;;
 
+    *)
+      lt_prog_compiler_pic='-fPIC'
+      ;;
+    esac
 
-  case $host_os in
-  aix3*)
-    cat <<\EOF >> "$cfgfile"
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      lt_prog_compiler_wl='-Xlinker '
+      lt_prog_compiler_pic='-Xcompiler -fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      lt_prog_compiler_wl='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static='-Bstatic'
+      else
+	lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
 
-# AIX sometimes has problems with the GCC collect2 program.  For some
-# reason, if we set the COLLECT_NAMES environment variable, the problems
-# vanish in a puff of smoke.
-if test "X${COLLECT_NAMES+set}" != Xset; then
-  COLLECT_NAMES=
-  export COLLECT_NAMES
-fi
-EOF
-    ;;
-  esac
-
-  # We use sed instead of cat because bash on DJGPP gets confused if
-  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
-  # text mode, it properly converts lines to CR/LF.  This bash problem
-  # is reportedly fixed, but why not run on old versions too?
-  sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
-
-  mv -f "$cfgfile" "$ofile" || \
-    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
-  chmod +x "$ofile"
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      lt_prog_compiler_pic='-DDLL_EXPORT'
+      ;;
 
-else
-  # If there is no Makefile yet, we rely on a make rule to execute
-  # `config.status --recheck' to rerun these tests and create the
-  # libtool script then.
-  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
-  if test -f "$ltmain_in"; then
-    test -f Makefile && make "$ltmain"
-  fi
-fi
+    hpux9* | hpux10* | hpux11*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	lt_prog_compiler_pic='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      lt_prog_compiler_static='${wl}-a ${wl}archive'
+      ;;
 
+    irix5* | irix6* | nonstopux*)
+      lt_prog_compiler_wl='-Wl,'
+      # PIC (with -KPIC) is the default.
+      lt_prog_compiler_static='-non_shared'
+      ;;
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      case $cc_basename in
+      # old Intel for x86_64 which still supported -KPIC.
+      ecc*)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-KPIC'
+	lt_prog_compiler_static='-static'
+        ;;
+      # icc used to be incompatible with GCC.
+      # ICC 10 doesn't accept -KPIC any more.
+      icc* | ifort*)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-fPIC'
+	lt_prog_compiler_static='-static'
+        ;;
+      # Lahey Fortran 8.1.
+      lf95*)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='--shared'
+	lt_prog_compiler_static='--static'
+	;;
+      nagfor*)
+	# NAG Fortran compiler
+	lt_prog_compiler_wl='-Wl,-Wl,,'
+	lt_prog_compiler_pic='-PIC'
+	lt_prog_compiler_static='-Bstatic'
+	;;
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-fpic'
+	lt_prog_compiler_static='-Bstatic'
+        ;;
+      ccc*)
+        lt_prog_compiler_wl='-Wl,'
+        # All Alpha code is PIC.
+        lt_prog_compiler_static='-non_shared'
+        ;;
+      xl* | bgxl* | bgf* | mpixl*)
+	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+	lt_prog_compiler_wl='-Wl,'
+	lt_prog_compiler_pic='-qpic'
+	lt_prog_compiler_static='-qstaticlink'
+	;;
+      *)
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ F* | *Sun*Fortran*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl=''
+	  ;;
+	*Sun\ C*)
+	  # Sun C 5.9
+	  lt_prog_compiler_pic='-KPIC'
+	  lt_prog_compiler_static='-Bstatic'
+	  lt_prog_compiler_wl='-Wl,'
+	  ;;
+	esac
+	;;
+      esac
+      ;;
 
-CC="$lt_save_CC"
+    newsos6)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
 
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic='-fPIC -shared'
+      ;;
 
-# Check whether --with-tags was given.
-if test "${with_tags+set}" = set; then
-  withval=$with_tags; tagnames="$withval"
-fi
+    osf3* | osf4* | osf5*)
+      lt_prog_compiler_wl='-Wl,'
+      # All OSF/1 code is PIC.
+      lt_prog_compiler_static='-non_shared'
+      ;;
 
+    rdos*)
+      lt_prog_compiler_static='-non_shared'
+      ;;
 
-if test -f "$ltmain" && test -n "$tagnames"; then
-  if test ! -f "${ofile}"; then
-    { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5
-echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;}
-  fi
+    solaris*)
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+	lt_prog_compiler_wl='-Qoption ld ';;
+      *)
+	lt_prog_compiler_wl='-Wl,';;
+      esac
+      ;;
 
-  if test -z "$LTCC"; then
-    eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
-    if test -z "$LTCC"; then
-      { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5
-echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;}
-    else
-      { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5
-echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;}
-    fi
-  fi
-  if test -z "$LTCFLAGS"; then
-    eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
-  fi
+    sunos4*)
+      lt_prog_compiler_wl='-Qoption ld '
+      lt_prog_compiler_pic='-PIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
 
-  # Extract list of available tagged configurations in $ofile.
-  # Note that this assumes the entire list is on one line.
-  available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
 
-  lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
-  for tagname in $tagnames; do
-    IFS="$lt_save_ifs"
-    # Check whether tagname contains only valid characters
-    case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in
-    "") ;;
-    *)  { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5
-echo "$as_me: error: invalid tag name: $tagname" >&2;}
-   { (exit 1); exit 1; }; }
-	;;
-    esac
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	lt_prog_compiler_pic='-Kconform_pic'
+	lt_prog_compiler_static='-Bstatic'
+      fi
+      ;;
 
-    if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
-    then
-      { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5
-echo "$as_me: error: tag name \"$tagname\" already exists" >&2;}
-   { (exit 1); exit 1; }; }
-    fi
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_pic='-KPIC'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
 
-    # Update the list of available tags.
-    if test -n "$tagname"; then
-      echo appending configuration tag \"$tagname\" to $ofile
+    unicos*)
+      lt_prog_compiler_wl='-Wl,'
+      lt_prog_compiler_can_build_shared=no
+      ;;
 
-      case $tagname in
-      CXX)
-	if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
-	    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
-	    (test "X$CXX" != "Xg++"))) ; then
-	  ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+    uts4*)
+      lt_prog_compiler_pic='-pic'
+      lt_prog_compiler_static='-Bstatic'
+      ;;
 
+    *)
+      lt_prog_compiler_can_build_shared=no
+      ;;
+    esac
+  fi
 
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic=
+    ;;
+  *)
+    lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+    ;;
+esac
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+if ${lt_cv_prog_compiler_pic+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
+$as_echo "$lt_cv_prog_compiler_pic" >&6; }
+lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
 
-archive_cmds_need_lc_CXX=no
-allow_undefined_flag_CXX=
-always_export_symbols_CXX=no
-archive_expsym_cmds_CXX=
-export_dynamic_flag_spec_CXX=
-hardcode_direct_CXX=no
-hardcode_libdir_flag_spec_CXX=
-hardcode_libdir_flag_spec_ld_CXX=
-hardcode_libdir_separator_CXX=
-hardcode_minus_L_CXX=no
-hardcode_shlibpath_var_CXX=unsupported
-hardcode_automatic_CXX=no
-module_cmds_CXX=
-module_expsym_cmds_CXX=
-link_all_deplibs_CXX=unknown
-old_archive_cmds_CXX=$old_archive_cmds
-no_undefined_flag_CXX=
-whole_archive_flag_spec_CXX=
-enable_shared_with_static_runtimes_CXX=no
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
+if ${lt_cv_prog_compiler_pic_works+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic_works=no
+   ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_pic_works=yes
+     fi
+   fi
+   $RM conftest*
 
-# Dependencies to place before and after the object being linked:
-predep_objects_CXX=
-postdep_objects_CXX=
-predeps_CXX=
-postdeps_CXX=
-compiler_lib_search_path_CXX=
-compiler_lib_search_dirs_CXX=
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
 
-# Source file extension for C++ test sources.
-ac_ext=cpp
+if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
+    case $lt_prog_compiler_pic in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+     esac
+else
+    lt_prog_compiler_pic=
+     lt_prog_compiler_can_build_shared=no
+fi
 
-# Object file extension for compiled C++ test sources.
-objext=o
-objext_CXX=$objext
+fi
 
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;"
 
-# Code to be used in simple link tests
-lt_simple_link_test_code='int main(int, char *[]) { return(0); }'
 
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
 
-# If no C compiler was specified, use CC.
-LTCC=${LTCC-"$CC"}
 
-# If no C compiler flags were specified, use CFLAGS.
-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
 
-# Allow CC to be a program name with arguments.
-compiler=$CC
 
 
-# save warnings/boilerplate of simple test code
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_compile_test_code" >conftest.$ac_ext
-eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_compiler_boilerplate=`cat conftest.err`
-$rm conftest*
 
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_link_test_code" >conftest.$ac_ext
-eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_linker_boilerplate=`cat conftest.err`
-$rm -r conftest*
 
 
-# Allow CC to be a program name with arguments.
-lt_save_CC=$CC
-lt_save_LD=$LD
-lt_save_GCC=$GCC
-GCC=$GXX
-lt_save_with_gnu_ld=$with_gnu_ld
-lt_save_path_LD=$lt_cv_path_LD
-if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
-  lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
-else
-  $as_unset lt_cv_prog_gnu_ld
-fi
-if test -n "${lt_cv_path_LDCXX+set}"; then
-  lt_cv_path_LD=$lt_cv_path_LDCXX
-else
-  $as_unset lt_cv_path_LD
-fi
-test -z "${LDCXX+set}" || LD=$LDCXX
-CC=${CXX-"c++"}
-compiler=$CC
-compiler_CXX=$CC
-for cc_temp in $compiler""; do
-  case $cc_temp in
-    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
-    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
-    \-*) ;;
-    *) break;;
-  esac
-done
-cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
-
-
-# We don't want -fno-exception wen compiling C++ code, so set the
-# no_builtin_flag separately
-if test "$GXX" = yes; then
-  lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
-else
-  lt_prog_compiler_no_builtin_flag_CXX=
-fi
-
-if test "$GXX" = yes; then
-  # Set up default GNU C++ configuration
-
-
-# Check whether --with-gnu-ld was given.
-if test "${with_gnu_ld+set}" = set; then
-  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if ${lt_cv_prog_compiler_static_works+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  with_gnu_ld=no
-fi
+  lt_cv_prog_compiler_static_works=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler_static_works=yes
+       fi
+     else
+       lt_cv_prog_compiler_static_works=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
 
-ac_prog=ld
-if test "$GCC" = yes; then
-  # Check if gcc -print-prog-name=ld gives a path.
-  { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
-echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
-  case $host in
-  *-*-mingw*)
-    # gcc leaves a trailing carriage return which upsets mingw
-    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
-  *)
-    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
-  esac
-  case $ac_prog in
-    # Accept absolute paths.
-    [\\/]* | ?:[\\/]*)
-      re_direlt='/[^/][^/]*/\.\./'
-      # Canonicalize the pathname of ld
-      ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
-      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
-	ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
-      done
-      test -z "$LD" && LD="$ac_prog"
-      ;;
-  "")
-    # If it fails, then pretend we aren't using GCC.
-    ac_prog=ld
-    ;;
-  *)
-    # If it is relative, then search for the first ld in PATH.
-    with_gnu_ld=unknown
-    ;;
-  esac
-elif test "$with_gnu_ld" = yes; then
-  { echo "$as_me:$LINENO: checking for GNU ld" >&5
-echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
-else
-  { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
-echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
-fi
-if test "${lt_cv_path_LD+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -z "$LD"; then
-  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
-  for ac_dir in $PATH; do
-    IFS="$lt_save_ifs"
-    test -z "$ac_dir" && ac_dir=.
-    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
-      lt_cv_path_LD="$ac_dir/$ac_prog"
-      # Check to see if the program is GNU ld.  I'd rather use --version,
-      # but apparently some variants of GNU ld only accept -v.
-      # Break only if it was the GNU/non-GNU ld that we prefer.
-      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
-      *GNU* | *'with BFD'*)
-	test "$with_gnu_ld" != no && break
-	;;
-      *)
-	test "$with_gnu_ld" != yes && break
-	;;
-      esac
-    fi
-  done
-  IFS="$lt_save_ifs"
-else
-  lt_cv_path_LD="$LD" # Let the user override the test with a path.
-fi
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
+$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
 
-LD="$lt_cv_path_LD"
-if test -n "$LD"; then
-  { echo "$as_me:$LINENO: result: $LD" >&5
-echo "${ECHO_T}$LD" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
-echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
-   { (exit 1); exit 1; }; }
-{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
-echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
-if test "${lt_cv_prog_gnu_ld+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+if test x"$lt_cv_prog_compiler_static_works" = xyes; then
+    :
 else
-  # I'd rather use --version here, but apparently some GNU lds only accept -v.
-case `$LD -v 2>&1 </dev/null` in
-*GNU* | *'with BFD'*)
-  lt_cv_prog_gnu_ld=yes
-  ;;
-*)
-  lt_cv_prog_gnu_ld=no
-  ;;
-esac
+    lt_prog_compiler_static=
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
-echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
-with_gnu_ld=$lt_cv_prog_gnu_ld
 
 
 
-  # Check if GNU C++ uses GNU ld as the underlying linker, since the
-  # archiving commands below assume that GNU ld is being used.
-  if test "$with_gnu_ld" = yes; then
-    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-    archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-
-    hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
-    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
 
-    # If archive_cmds runs LD, not CC, wlarc should be empty
-    # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
-    #     investigate it a little bit more. (MM)
-    wlarc='${wl}'
 
-    # ancient GNU ld didn't support --whole-archive et. al.
-    if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
-	grep 'no-whole-archive' > /dev/null; then
-      whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-    else
-      whole_archive_flag_spec_CXX=
-    fi
-  else
-    with_gnu_ld=no
-    wlarc=
-
-    # A generic and very simple default shared library creation
-    # command for GNU C++ for the case where it uses the native
-    # linker, instead of GNU ld.  If possible, this setting should
-    # overridden to take advantage of the native linker features on
-    # the platform it is being used on.
-    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
-  fi
 
-  # Commands to make compiler produce verbose output that lists
-  # what "hidden" libraries, object files and flags are used when
-  # linking a shared library.
-  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
 
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  GXX=no
-  with_gnu_ld=no
-  wlarc=
-fi
+  lt_cv_prog_compiler_c_o=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
-# PORTME: fill in a description of your system's C++ link characteristics
-{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
-ld_shlibs_CXX=yes
-case $host_os in
-  aix3*)
-    # FIXME: insert proper C++ library support
-    ld_shlibs_CXX=no
-    ;;
-  aix[4-9]*)
-    if test "$host_cpu" = ia64; then
-      # On IA64, the linker does run time linking by default, so we don't
-      # have to do anything special.
-      aix_use_runtimelinking=no
-      exp_sym_flag='-Bexport'
-      no_entry_flag=""
-    else
-      aix_use_runtimelinking=no
-
-      # Test if we are trying to use run time linking or normal
-      # AIX style linking. If -brtl is somewhere in LDFLAGS, we
-      # need to do runtime linking.
-      case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
-	for ld_flag in $LDFLAGS; do
-	  case $ld_flag in
-	  *-brtl*)
-	    aix_use_runtimelinking=yes
-	    break
-	    ;;
-	  esac
-	done
-	;;
-      esac
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
 
-      exp_sym_flag='-bexport'
-      no_entry_flag='-bnoentry'
-    fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
 
-    # When large executables or shared objects are built, AIX ld can
-    # have problems creating the table of contents.  If linking a library
-    # or program results in "error TOC overflow" add -mminimal-toc to
-    # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
-    # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
 
-    archive_cmds_CXX=''
-    hardcode_direct_CXX=yes
-    hardcode_libdir_separator_CXX=':'
-    link_all_deplibs_CXX=yes
 
-    if test "$GXX" = yes; then
-      case $host_os in aix4.[012]|aix4.[012].*)
-      # We only want to do this on AIX 4.2 and lower, the check
-      # below for broken collect2 doesn't work under 4.3+
-	collect2name=`${CC} -print-prog-name=collect2`
-	if test -f "$collect2name" && \
-	   strings "$collect2name" | grep resolve_lib_name >/dev/null
-	then
-	  # We have reworked collect2
-	  :
-	else
-	  # We have old collect2
-	  hardcode_direct_CXX=unsupported
-	  # It fails to find uninstalled libraries when the uninstalled
-	  # path is not listed in the libpath.  Setting hardcode_minus_L
-	  # to unsupported forces relinking
-	  hardcode_minus_L_CXX=yes
-	  hardcode_libdir_flag_spec_CXX='-L$libdir'
-	  hardcode_libdir_separator_CXX=
-	fi
-	;;
-      esac
-      shared_flag='-shared'
-      if test "$aix_use_runtimelinking" = yes; then
-	shared_flag="$shared_flag "'${wl}-G'
-      fi
-    else
-      # not using gcc
-      if test "$host_cpu" = ia64; then
-	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
-	# chokes on -Wl,-G. The following line is correct:
-	shared_flag='-G'
-      else
-	if test "$aix_use_runtimelinking" = yes; then
-	  shared_flag='${wl}-G'
-	else
-	  shared_flag='${wl}-bM:SRE'
-	fi
-      fi
-    fi
 
-    # It seems that -bexpall does not export symbols beginning with
-    # underscore (_), so it is better to generate a list of symbols to export.
-    always_export_symbols_CXX=yes
-    if test "$aix_use_runtimelinking" = yes; then
-      # Warning - without using the other runtime loading flags (-brtl),
-      # -berok will link without error, but may produce a broken library.
-      allow_undefined_flag_CXX='-berok'
-      # Determine the default libpath from the value encoded in an empty executable.
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-int
-main ()
-{
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  lt_cv_prog_compiler_c_o=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
 
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
-      hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
-
-      archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
-     else
-      if test "$host_cpu" = ia64; then
-	hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
-	allow_undefined_flag_CXX="-z nodefs"
-	archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
-      else
-	# Determine the default libpath from the value encoded in an empty executable.
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-int
-main ()
-{
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_cxx_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
+  fi
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  need_locks=no
+fi
 
 
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
-	hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
-	# Warning - without using the other run time loading flags,
-	# -berok will link without error, but may produce a broken library.
-	no_undefined_flag_CXX=' ${wl}-bernotok'
-	allow_undefined_flag_CXX=' ${wl}-berok'
-	# Exported symbols can be pulled into shared objects from archives
-	whole_archive_flag_spec_CXX='$convenience'
-	archive_cmds_need_lc_CXX=yes
-	# This is similar to how AIX traditionally builds its shared libraries.
-	archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
-      fi
-    fi
-    ;;
 
-  beos*)
-    if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-      allow_undefined_flag_CXX=unsupported
-      # Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
-      # support --undefined.  This deserves some investigation.  FIXME
-      archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-    else
-      ld_shlibs_CXX=no
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+  runpath_var=
+  allow_undefined_flag=
+  always_export_symbols=no
+  archive_cmds=
+  archive_expsym_cmds=
+  compiler_needs_object=no
+  enable_shared_with_static_runtimes=no
+  export_dynamic_flag_spec=
+  export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  hardcode_automatic=no
+  hardcode_direct=no
+  hardcode_direct_absolute=no
+  hardcode_libdir_flag_spec=
+  hardcode_libdir_flag_spec_ld=
+  hardcode_libdir_separator=
+  hardcode_minus_L=no
+  hardcode_shlibpath_var=unsupported
+  inherit_rpath=no
+  link_all_deplibs=unknown
+  module_cmds=
+  module_expsym_cmds=
+  old_archive_from_new_cmds=
+  old_archive_from_expsyms_cmds=
+  thread_safe_flag_spec=
+  whole_archive_flag_spec=
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  include_expsyms=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
     fi
     ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  linux* | k*bsd*-gnu | gnu*)
+    link_all_deplibs=no
+    ;;
+  esac
 
-  chorus*)
-    case $cc_basename in
+  ld_shlibs=yes
+
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
+  if test "$with_gnu_ld" = yes; then
+    case $host_os in
+      aix*)
+	# The AIX port of GNU ld has always aspired to compatibility
+	# with the native linker.  However, as the warning in the GNU ld
+	# block says, versions before 2.19.5* couldn't really create working
+	# shared libraries, regardless of the interface used.
+	case `$LD -v 2>&1` in
+	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+	  *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;;
+	  *\ \(GNU\ Binutils\)\ [3-9]*) ;;
+	  *)
+	    lt_use_gnu_ld_interface=yes
+	    ;;
+	esac
+	;;
       *)
-	# FIXME: insert proper C++ library support
-	ld_shlibs_CXX=no
+	lt_use_gnu_ld_interface=yes
 	;;
     esac
-    ;;
+  fi
 
-  cygwin* | mingw* | pw32*)
-    # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
-    # as there is no search path for DLLs.
-    hardcode_libdir_flag_spec_CXX='-L$libdir'
-    allow_undefined_flag_CXX=unsupported
-    always_export_symbols_CXX=no
-    enable_shared_with_static_runtimes_CXX=yes
-
-    if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
-      archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-      # If the export-symbols file already is a .def file (1st line
-      # is EXPORTS), use it as is; otherwise, prepend...
-      archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	cp $export_symbols $output_objdir/$soname.def;
-      else
-	echo EXPORTS > $output_objdir/$soname.def;
-	cat $export_symbols >> $output_objdir/$soname.def;
-      fi~
-      $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+  if test "$lt_use_gnu_ld_interface" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+    export_dynamic_flag_spec='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+      whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
     else
-      ld_shlibs_CXX=no
+      whole_archive_flag_spec=
     fi
-  ;;
-      darwin* | rhapsody*)
-      archive_cmds_need_lc_CXX=no
-      hardcode_direct_CXX=no
-      hardcode_automatic_CXX=yes
-      hardcode_shlibpath_var_CXX=unsupported
-      whole_archive_flag_spec_CXX=''
-      link_all_deplibs_CXX=yes
-      allow_undefined_flag_CXX="$_lt_dar_allow_undefined"
-      if test "$GXX" = yes ; then
-      output_verbose_link_cmd='echo'
-      archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
-      module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-      archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
-      module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
-      if test "$lt_cv_apple_cc_single_mod" != "yes"; then
-        archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
-        archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+    supports_anon_versioning=no
+    case `$LD -v 2>&1` in
+      *GNU\ gold*) supports_anon_versioning=yes ;;
+      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix[3-9]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	ld_shlibs=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
       fi
-      else
-      case $cc_basename in
-        xlc*)
-         output_verbose_link_cmd='echo'
-          archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
-          module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
-          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
-          archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-          module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-          ;;
-       *)
-         ld_shlibs_CXX=no
-          ;;
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            archive_expsym_cmds=''
+        ;;
+      m68k)
+            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_minus_L=yes
+        ;;
       esac
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	allow_undefined_flag=unsupported
+	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	ld_shlibs=no
       fi
-        ;;
+      ;;
 
-  dgux*)
-    case $cc_basename in
-      ec++*)
-	# FIXME: insert proper C++ library support
-	ld_shlibs_CXX=no
-	;;
-      ghcx*)
-	# Green Hills C++ Compiler
-	# FIXME: insert proper C++ library support
-	ld_shlibs_CXX=no
-	;;
-      *)
-	# FIXME: insert proper C++ library support
-	ld_shlibs_CXX=no
-	;;
-    esac
-    ;;
-  freebsd[12]*)
-    # C++ shared libraries reported to be fairly broken before switch to ELF
-    ld_shlibs_CXX=no
-    ;;
-  freebsd-elf*)
-    archive_cmds_need_lc_CXX=no
-    ;;
-  freebsd* | dragonfly*)
-    # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
-    # conventions
-    ld_shlibs_CXX=yes
-    ;;
-  gnu*)
-    ;;
-  hpux9*)
-    hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
-    hardcode_libdir_separator_CXX=:
-    export_dynamic_flag_spec_CXX='${wl}-E'
-    hardcode_direct_CXX=yes
-    hardcode_minus_L_CXX=yes # Not in the search PATH,
-				# but as the default
-				# location of the library.
+    cygwin* | mingw* | pw32* | cegcc*)
+      # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+      # as there is no search path for DLLs.
+      hardcode_libdir_flag_spec='-L$libdir'
+      export_dynamic_flag_spec='${wl}--export-all-symbols'
+      allow_undefined_flag=unsupported
+      always_export_symbols=no
+      enable_shared_with_static_runtimes=yes
+      export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+      exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
 
-    case $cc_basename in
-    CC*)
-      # FIXME: insert proper C++ library support
-      ld_shlibs_CXX=no
-      ;;
-    aCC*)
-      archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      # Commands to make compiler produce verbose output that lists
-      # what "hidden" libraries, object files and flags are used when
-      # linking a shared library.
-      #
-      # There doesn't appear to be a way to prevent this compiler from
-      # explicitly linking system object files so we need to strip them
-      # from the output so that they don't get included in the library
-      # dependencies.
-      output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
-      ;;
-    *)
-      if test "$GXX" = yes; then
-        archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+        archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
       else
-        # FIXME: insert proper C++ library support
-        ld_shlibs_CXX=no
+	ld_shlibs=no
       fi
       ;;
-    esac
-    ;;
-  hpux10*|hpux11*)
-    if test $with_gnu_ld = no; then
-      hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
-      hardcode_libdir_separator_CXX=:
 
-      case $host_cpu in
-      hppa*64*|ia64*) ;;
-      *)
-	export_dynamic_flag_spec_CXX='${wl}-E'
-        ;;
-      esac
-    fi
-    case $host_cpu in
-    hppa*64*|ia64*)
-      hardcode_direct_CXX=no
-      hardcode_shlibpath_var_CXX=no
+    haiku*)
+      archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      link_all_deplibs=yes
       ;;
-    *)
-      hardcode_direct_CXX=yes
-      hardcode_minus_L_CXX=yes # Not in the search PATH,
-					      # but as the default
-					      # location of the library.
+
+    interix[3-9]*)
+      hardcode_direct=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      export_dynamic_flag_spec='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
       ;;
-    esac
 
-    case $cc_basename in
-      CC*)
-	# FIXME: insert proper C++ library support
-	ld_shlibs_CXX=no
-	;;
-      aCC*)
-	case $host_cpu in
-	hppa*64*)
-	  archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+      tmp_diet=no
+      if test "$host_os" = linux-dietlibc; then
+	case $cc_basename in
+	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
+	esac
+      fi
+      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+	 && test "$tmp_diet" = no
+      then
+	tmp_addflag=' $pic_flag'
+	tmp_sharedflag='-shared'
+	case $cc_basename,$host_cpu in
+        pgcc*)				# Portland Group C compiler
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
 	  ;;
-	ia64*)
-	  archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	pgf77* | pgf90* | pgf95* | pgfortran*)
+					# Portland Group f77 and f90 compilers
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	lf95*)				# Lahey Fortran 8.1
+	  whole_archive_flag_spec=
+	  tmp_sharedflag='--shared' ;;
+	xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+	  tmp_sharedflag='-qmkshrobj'
+	  tmp_addflag= ;;
+	nvcc*)	# Cuda Compiler Driver 2.2
+	  whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  compiler_needs_object=yes
 	  ;;
-	*)
-	  archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  compiler_needs_object=yes
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	esac
+	archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+        if test "x$supports_anon_versioning" = xyes; then
+          archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+	    cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	    echo "local: *; };" >> $output_objdir/$libname.ver~
+	    $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+        fi
+
+	case $cc_basename in
+	xlf* | bgf* | bgxlf* | mpixlf*)
+	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+	  whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
+	  hardcode_libdir_flag_spec=
+	  hardcode_libdir_flag_spec_ld='-rpath $libdir'
+	  archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+	  if test "x$supports_anon_versioning" = xyes; then
+	    archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	      echo "local: *; };" >> $output_objdir/$libname.ver~
+	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	  fi
 	  ;;
 	esac
-	# Commands to make compiler produce verbose output that lists
-	# what "hidden" libraries, object files and flags are used when
-	# linking a shared library.
-	#
-	# There doesn't appear to be a way to prevent this compiler from
-	# explicitly linking system object files so we need to strip them
-	# from the output so that they don't get included in the library
-	# dependencies.
-	output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
-	;;
-      *)
-	if test "$GXX" = yes; then
-	  if test $with_gnu_ld = no; then
-	    case $host_cpu in
-	    hppa*64*)
-	      archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	      ;;
-	    ia64*)
-	      archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	      ;;
-	    *)
-	      archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	      ;;
-	    esac
-	  fi
-	else
-	  # FIXME: insert proper C++ library support
-	  ld_shlibs_CXX=no
-	fi
-	;;
-    esac
-    ;;
-  interix[3-9]*)
-    hardcode_direct_CXX=no
-    hardcode_shlibpath_var_CXX=no
-    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
-    export_dynamic_flag_spec_CXX='${wl}-E'
-    # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
-    # Instead, shared libraries are loaded at an image base (0x10000000 by
-    # default) and relocated if they conflict, which is a slow very memory
-    # consuming and fragmenting process.  To avoid this, we pick a random,
-    # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
-    # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
-    archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-    archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-    ;;
-  irix5* | irix6*)
-    case $cc_basename in
-      CC*)
-	# SGI C++
-	archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-
-	# Archives containing C++ object files must be created using
-	# "CC -ar", where "CC" is the IRIX C++ compiler.  This is
-	# necessary to make sure instantiated templates are included
-	# in the archive.
-	old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'
-	;;
-      *)
-	if test "$GXX" = yes; then
-	  if test "$with_gnu_ld" = no; then
-	    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	  else
-	    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
-	  fi
-	fi
-	link_all_deplibs_CXX=yes
-	;;
-    esac
-    hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
-    hardcode_libdir_separator_CXX=:
-    ;;
-  linux* | k*bsd*-gnu)
-    case $cc_basename in
-      KCC*)
-	# Kuck and Associates, Inc. (KAI) C++ Compiler
-
-	# KCC will only create a shared library if the output file
-	# ends with ".so" (or ".sl" for HP-UX), so rename the library
-	# to its proper name (with version) after linking.
-	archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
-	archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
-	# Commands to make compiler produce verbose output that lists
-	# what "hidden" libraries, object files and flags are used when
-	# linking a shared library.
-	#
-	# There doesn't appear to be a way to prevent this compiler from
-	# explicitly linking system object files so we need to strip them
-	# from the output so that they don't get included in the library
-	# dependencies.
-	output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
-
-	hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir'
-	export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
-
-	# Archives containing C++ object files must be created using
-	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
-	old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
-	;;
-      icpc*)
-	# Intel C++
-	with_gnu_ld=yes
-	# version 8.0 and above of icpc choke on multiply defined symbols
-	# if we add $predep_objects and $postdep_objects, however 7.1 and
-	# earlier do not add the objects themselves.
-	case `$CC -V 2>&1` in
-	*"Version 7."*)
-  	  archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-  	  archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-	  ;;
-	*)  # Version 8.0 or newer
-	  tmp_idyn=
-	  case $host_cpu in
-	    ia64*) tmp_idyn=' -i_dynamic';;
-	  esac
-  	  archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	  archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-	  ;;
-	esac
-	archive_cmds_need_lc_CXX=no
-	hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
-	export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
-	whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
-	;;
-      pgCC* | pgcpp*)
-        # Portland Group C++ compiler
-	archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
-  	archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
-
-	hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
-	export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
-	whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-        ;;
-      cxx*)
-	# Compaq C++
-	archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
-
-	runpath_var=LD_RUN_PATH
-	hardcode_libdir_flag_spec_CXX='-rpath $libdir'
-	hardcode_libdir_separator_CXX=:
-
-	# Commands to make compiler produce verbose output that lists
-	# what "hidden" libraries, object files and flags are used when
-	# linking a shared library.
-	#
-	# There doesn't appear to be a way to prevent this compiler from
-	# explicitly linking system object files so we need to strip them
-	# from the output so that they don't get included in the library
-	# dependencies.
-	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
-	;;
-      *)
-	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)
-	  # Sun C++ 5.9
-	  no_undefined_flag_CXX=' -zdefs'
-	  archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	  archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
-	  hardcode_libdir_flag_spec_CXX='-R$libdir'
-	  whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-
-	  # Not sure whether something based on
-	  # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
-	  # would be better.
-	  output_verbose_link_cmd='echo'
-
-	  # Archives containing C++ object files must be created using
-	  # "CC -xar", where "CC" is the Sun C++ compiler.  This is
-	  # necessary to make sure instantiated templates are included
-	  # in the archive.
-	  old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
-	  ;;
-	esac
-	;;
-    esac
-    ;;
-  lynxos*)
-    # FIXME: insert proper C++ library support
-    ld_shlibs_CXX=no
-    ;;
-  m88k*)
-    # FIXME: insert proper C++ library support
-    ld_shlibs_CXX=no
-    ;;
-  mvs*)
-    case $cc_basename in
-      cxx*)
-	# FIXME: insert proper C++ library support
-	ld_shlibs_CXX=no
-	;;
-      *)
-	# FIXME: insert proper C++ library support
-	ld_shlibs_CXX=no
-	;;
-    esac
-    ;;
-  netbsd* | netbsdelf*-gnu)
-    if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
-      archive_cmds_CXX='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
-      wlarc=
-      hardcode_libdir_flag_spec_CXX='-R$libdir'
-      hardcode_direct_CXX=yes
-      hardcode_shlibpath_var_CXX=no
-    fi
-    # Workaround some broken pre-1.5 toolchains
-    output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
-    ;;
-  openbsd2*)
-    # C++ shared libraries are fairly broken
-    ld_shlibs_CXX=no
-    ;;
-  openbsd*)
-    if test -f /usr/libexec/ld.so; then
-      hardcode_direct_CXX=yes
-      hardcode_shlibpath_var_CXX=no
-      archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
-      hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
-      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
-	export_dynamic_flag_spec_CXX='${wl}-E'
-	whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+      else
+        ld_shlibs=no
       fi
-      output_verbose_link_cmd='echo'
-    else
-      ld_shlibs_CXX=no
-    fi
-    ;;
-  osf3*)
-    case $cc_basename in
-      KCC*)
-	# Kuck and Associates, Inc. (KAI) C++ Compiler
-
-	# KCC will only create a shared library if the output file
-	# ends with ".so" (or ".sl" for HP-UX), so rename the library
-	# to its proper name (with version) after linking.
-	archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
-
-	hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
-	hardcode_libdir_separator_CXX=:
-
-	# Archives containing C++ object files must be created using
-	# "CC -Bstatic", where "CC" is the KAI C++ compiler.
-	old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+      ;;
 
-	;;
-      RCC*)
-	# Rational C++ 2.4.1
-	# FIXME: insert proper C++ library support
-	ld_shlibs_CXX=no
-	;;
-      cxx*)
-	allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-
-	hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
-	hardcode_libdir_separator_CXX=:
-
-	# Commands to make compiler produce verbose output that lists
-	# what "hidden" libraries, object files and flags are used when
-	# linking a shared library.
-	#
-	# There doesn't appear to be a way to prevent this compiler from
-	# explicitly linking system object files so we need to strip them
-	# from the output so that they don't get included in the library
-	# dependencies.
-	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
-	;;
-      *)
-	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
-	  allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
-	  archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
 
-	  hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
-	  hardcode_libdir_separator_CXX=:
+    solaris*)
+      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+	ld_shlibs=no
+	cat <<_LT_EOF 1>&2
 
-	  # Commands to make compiler produce verbose output that lists
-	  # what "hidden" libraries, object files and flags are used when
-	  # linking a shared library.
-	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
 
-	else
-	  # FIXME: insert proper C++ library support
-	  ld_shlibs_CXX=no
-	fi
-	;;
-    esac
-    ;;
-  osf4* | osf5*)
-    case $cc_basename in
-      KCC*)
-	# Kuck and Associates, Inc. (KAI) C++ Compiler
+_LT_EOF
+      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
 
-	# KCC will only create a shared library if the output file
-	# ends with ".so" (or ".sl" for HP-UX), so rename the library
-	# to its proper name (with version) after linking.
-	archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+	ld_shlibs=no
+	cat <<_LT_EOF 1>&2
 
-	hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
-	hardcode_libdir_separator_CXX=:
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
 
-	# Archives containing C++ object files must be created using
-	# the KAI C++ compiler.
-	old_archive_cmds_CXX='$CC -o $oldlib $oldobjs'
-	;;
-      RCC*)
-	# Rational C++ 2.4.1
-	# FIXME: insert proper C++ library support
-	ld_shlibs_CXX=no
+_LT_EOF
 	;;
-      cxx*)
-	allow_undefined_flag_CXX=' -expect_unresolved \*'
-	archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-	archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
-	  echo "-hidden">> $lib.exp~
-	  $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp  `test -n "$verstring" && echo -set_version	$verstring` -update_registry ${output_objdir}/so_locations -o $lib~
-	  $rm $lib.exp'
-
-	hardcode_libdir_flag_spec_CXX='-rpath $libdir'
-	hardcode_libdir_separator_CXX=:
-
-	# Commands to make compiler produce verbose output that lists
-	# what "hidden" libraries, object files and flags are used when
-	# linking a shared library.
-	#
-	# There doesn't appear to be a way to prevent this compiler from
-	# explicitly linking system object files so we need to strip them
-	# from the output so that they don't get included in the library
-	# dependencies.
-	output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+	*)
+	  # For security reasons, it is highly recommended that you always
+	  # use absolute paths for naming shared libraries, and exclude the
+	  # DT_RUNPATH tag from executables and libraries.  But doing so
+	  # requires that you compile everything twice, which is a pain.
+	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	    hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+	    archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  else
+	    ld_shlibs=no
+	  fi
 	;;
-      *)
-	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
-	  allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
-	 archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      esac
+      ;;
 
-	  hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
-	  hardcode_libdir_separator_CXX=:
+    sunos4*)
+      archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	ld_shlibs=no
+      fi
+      ;;
+    esac
 
-	  # Commands to make compiler produce verbose output that lists
-	  # what "hidden" libraries, object files and flags are used when
-	  # linking a shared library.
-	  output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+    if test "$ld_shlibs" = no; then
+      runpath_var=
+      hardcode_libdir_flag_spec=
+      export_dynamic_flag_spec=
+      whole_archive_flag_spec=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      allow_undefined_flag=unsupported
+      always_export_symbols=yes
+      archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	hardcode_direct=unsupported
+      fi
+      ;;
 
+    aix[4-9]*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	# Also, AIX nm treats weak defined symbols like other global
+	# defined symbols, whereas GNU nm marks them as "W".
+	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+	  export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	else
-	  # FIXME: insert proper C++ library support
-	  ld_shlibs_CXX=no
+	  export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
 	fi
-	;;
-    esac
-    ;;
-  psos*)
-    # FIXME: insert proper C++ library support
-    ld_shlibs_CXX=no
-    ;;
-  sunos4*)
-    case $cc_basename in
-      CC*)
-	# Sun C++ 4.x
-	# FIXME: insert proper C++ library support
-	ld_shlibs_CXX=no
-	;;
-      lcc*)
-	# Lucid
-	# FIXME: insert proper C++ library support
-	ld_shlibs_CXX=no
-	;;
-      *)
-	# FIXME: insert proper C++ library support
-	ld_shlibs_CXX=no
-	;;
-    esac
-    ;;
-  solaris*)
-    case $cc_basename in
-      CC*)
-	# Sun C++ 4.2, 5.x and Centerline C++
-        archive_cmds_need_lc_CXX=yes
-	no_undefined_flag_CXX=' -zdefs'
-	archive_cmds_CXX='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
-	archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-	$CC -G${allow_undefined_flag}  ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
-
-	hardcode_libdir_flag_spec_CXX='-R$libdir'
-	hardcode_shlibpath_var_CXX=no
-	case $host_os in
-	  solaris2.[0-5] | solaris2.[0-5].*) ;;
-	  *)
-	    # The compiler driver will combine and reorder linker options,
-	    # but understands `-z linker_flag'.
-	    # Supported since Solaris 2.6 (maybe 2.5.1?)
-	    whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract'
-	    ;;
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+	  for ld_flag in $LDFLAGS; do
+	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+	    aix_use_runtimelinking=yes
+	    break
+	  fi
+	  done
+	  ;;
 	esac
-	link_all_deplibs_CXX=yes
 
-	output_verbose_link_cmd='echo'
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
 
-	# Archives containing C++ object files must be created using
-	# "CC -xar", where "CC" is the Sun C++ compiler.  This is
-	# necessary to make sure instantiated templates are included
-	# in the archive.
-	old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
-	;;
-      gcx*)
-	# Green Hills C++ Compiler
-	archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
 
-	# The C++ compiler must be used to create the archive.
-	old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
-	;;
-      *)
-	# GNU C++ compiler with Solaris linker
-	if test "$GXX" = yes && test "$with_gnu_ld" = no; then
-	  no_undefined_flag_CXX=' ${wl}-z ${wl}defs'
-	  if $CC --version | grep -v '^2\.7' > /dev/null; then
-	    archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
-	    archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-		$CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+      archive_cmds=''
+      hardcode_direct=yes
+      hardcode_direct_absolute=yes
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+      file_list_spec='${wl}-f,'
 
-	    # Commands to make compiler produce verbose output that lists
-	    # what "hidden" libraries, object files and flags are used when
-	    # linking a shared library.
-	    output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[012]|aix4.[012].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	   strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	  # We have reworked collect2
+	  :
 	  else
-	    # g++ 2.7 appears to require `-G' NOT `-shared' on this
-	    # platform.
-	    archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
-	    archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-		$CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
-
-	    # Commands to make compiler produce verbose output that lists
-	    # what "hidden" libraries, object files and flags are used when
-	    # linking a shared library.
-	    output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+	  # We have old collect2
+	  hardcode_direct=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  hardcode_minus_L=yes
+	  hardcode_libdir_flag_spec='-L$libdir'
+	  hardcode_libdir_separator=
 	  fi
-
-	  hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'
-	  case $host_os in
-	  solaris2.[0-5] | solaris2.[0-5].*) ;;
-	  *)
-	    whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
-	    ;;
-	  esac
+	  ;;
+	esac
+	shared_flag='-shared'
+	if test "$aix_use_runtimelinking" = yes; then
+	  shared_flag="$shared_flag "'${wl}-G'
 	fi
-	;;
-    esac
-    ;;
-  sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
-    no_undefined_flag_CXX='${wl}-z,text'
-    archive_cmds_need_lc_CXX=no
-    hardcode_shlibpath_var_CXX=no
-    runpath_var='LD_RUN_PATH'
-
-    case $cc_basename in
-      CC*)
-	archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	;;
-      *)
-	archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	;;
-    esac
-    ;;
-  sysv5* | sco3.2v5* | sco5v6*)
-    # Note: We can NOT use -z defs as we might desire, because we do not
-    # link with -lc, and that would cause any symbols used from libc to
-    # always be unresolved, which means just about no library would
-    # ever link correctly.  If we're not using GNU ld we use -z text
-    # though, which does catch some bad symbols but isn't as heavy-handed
-    # as -z defs.
-    # For security reasons, it is highly recommended that you always
-    # use absolute paths for naming shared libraries, and exclude the
-    # DT_RUNPATH tag from executables and libraries.  But doing so
-    # requires that you compile everything twice, which is a pain.
-    # So that behaviour is only enabled if SCOABSPATH is set to a
-    # non-empty value in the environment.  Most likely only useful for
-    # creating official distributions of packages.
-    # This is a hack until libtool officially supports absolute path
-    # names for shared libraries.
-    no_undefined_flag_CXX='${wl}-z,text'
-    allow_undefined_flag_CXX='${wl}-z,nodefs'
-    archive_cmds_need_lc_CXX=no
-    hardcode_shlibpath_var_CXX=no
-    hardcode_libdir_flag_spec_CXX='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
-    hardcode_libdir_separator_CXX=':'
-    link_all_deplibs_CXX=yes
-    export_dynamic_flag_spec_CXX='${wl}-Bexport'
-    runpath_var='LD_RUN_PATH'
-
-    case $cc_basename in
-      CC*)
-	archive_cmds_CXX='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	;;
-      *)
-	archive_cmds_CXX='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	;;
-    esac
-    ;;
-  tandem*)
-    case $cc_basename in
-      NCC*)
-	# NonStop-UX NCC 3.20
-	# FIXME: insert proper C++ library support
-	ld_shlibs_CXX=no
-	;;
-      *)
-	# FIXME: insert proper C++ library support
-	ld_shlibs_CXX=no
-	;;
-    esac
-    ;;
-  vxworks*)
-    # FIXME: insert proper C++ library support
-    ld_shlibs_CXX=no
-    ;;
-  *)
-    # FIXME: insert proper C++ library support
-    ld_shlibs_CXX=no
-    ;;
-esac
-{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
-echo "${ECHO_T}$ld_shlibs_CXX" >&6; }
-test "$ld_shlibs_CXX" = no && can_build_shared=no
+	link_all_deplibs=no
+      else
+	# not using gcc
+	if test "$host_cpu" = ia64; then
+	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
 
-GCC_CXX="$GXX"
-LD_CXX="$LD"
+      export_dynamic_flag_spec='${wl}-bexpall'
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      always_export_symbols=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	allow_undefined_flag='-berok'
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath_+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-cat > conftest.$ac_ext <<EOF
-class Foo
+int
+main ()
 {
-public:
-  Foo (void) { a = 0; }
-private:
-  int a;
-};
-EOF
-
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-  # Parse the compiler output and extract the necessary
-  # objects, libraries and library flags.
-
-  # Sentinel used to keep track of whether or not we are before
-  # the conftest object file.
-  pre_test_object_deps_done=no
-
-  # The `*' in the case matches for architectures that use `case' in
-  # $output_verbose_cmd can trigger glob expansion during the loop
-  # eval without this substitution.
-  output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
 
-  for p in `eval $output_verbose_link_cmd`; do
-    case $p in
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
 
-    -L* | -R* | -l*)
-       # Some compilers place space between "-{L,R}" and the path.
-       # Remove the space.
-       if test $p = "-L" \
-	  || test $p = "-R"; then
-	 prev=$p
-	 continue
-       else
-	 prev=
-       fi
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_="/usr/lib:/lib"
+  fi
 
-       if test "$pre_test_object_deps_done" = no; then
-	 case $p in
-	 -L* | -R*)
-	   # Internal compiler library paths should come after those
-	   # provided the user.  The postdeps already come after the
-	   # user supplied libs so there is no need to process them.
-	   if test -z "$compiler_lib_search_path_CXX"; then
-	     compiler_lib_search_path_CXX="${prev}${p}"
-	   else
-	     compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}"
-	   fi
-	   ;;
-	 # The "-l" case would never come before the object being
-	 # linked, so don't bother handling this case.
-	 esac
-       else
-	 if test -z "$postdeps_CXX"; then
-	   postdeps_CXX="${prev}${p}"
-	 else
-	   postdeps_CXX="${postdeps_CXX} ${prev}${p}"
-	 fi
-       fi
-       ;;
+fi
 
-    *.$objext)
-       # This assumes that the test object file only shows up
-       # once in the compiler output.
-       if test "$p" = "conftest.$objext"; then
-	 pre_test_object_deps_done=yes
-	 continue
-       fi
+  aix_libpath=$lt_cv_aix_libpath_
+fi
 
-       if test "$pre_test_object_deps_done" = no; then
-	 if test -z "$predep_objects_CXX"; then
-	   predep_objects_CXX="$p"
-	 else
-	   predep_objects_CXX="$predep_objects_CXX $p"
-	 fi
-       else
-	 if test -z "$postdep_objects_CXX"; then
-	   postdep_objects_CXX="$p"
-	 else
-	   postdep_objects_CXX="$postdep_objects_CXX $p"
-	 fi
-       fi
-       ;;
+        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+        archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+      else
+	if test "$host_cpu" = ia64; then
+	  hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+	  allow_undefined_flag="-z nodefs"
+	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an
+	 # empty executable.
+	 if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath_+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-    *) ;; # Ignore the rest.
+int
+main ()
+{
 
-    esac
-  done
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
 
-  # Clean up.
-  rm -f a.out a.exe
-else
-  echo "libtool.m4: error: problem compiling CXX test program"
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  if test -z "$lt_cv_aix_libpath_"; then
+    lt_cv_aix_libpath_="/usr/lib:/lib"
+  fi
 
-$rm -f confest.$objext
+fi
 
-compiler_lib_search_dirs_CXX=
-if test -n "$compiler_lib_search_path_CXX"; then
-  compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+  aix_libpath=$lt_cv_aix_libpath_
 fi
 
-# PORTME: override above test on systems where it is broken
-case $host_os in
-interix[3-9]*)
-  # Interix 3.5 installs completely hosed .la files for C++, so rather than
-  # hack all around it, let's just trust "g++" to DTRT.
-  predep_objects_CXX=
-  postdep_objects_CXX=
-  postdeps_CXX=
-  ;;
+	 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  no_undefined_flag=' ${wl}-bernotok'
+	  allow_undefined_flag=' ${wl}-berok'
+	  if test "$with_gnu_ld" = yes; then
+	    # We only use this code for GNU lds that support --whole-archive.
+	    whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	  else
+	    # Exported symbols can be pulled into shared objects from archives
+	    whole_archive_flag_spec='$convenience'
+	  fi
+	  archive_cmds_need_lc=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
 
-linux*)
-  case `$CC -V 2>&1 | sed 5q` in
-  *Sun\ C*)
-    # Sun C++ 5.9
-    #
-    # The more standards-conforming stlport4 library is
-    # incompatible with the Cstd library. Avoid specifying
-    # it if it's in CXXFLAGS. Ignore libCrun as
-    # -library=stlport4 depends on it.
-    case " $CXX $CXXFLAGS " in
-    *" -library=stlport4 "*)
-      solaris_use_stlport4=yes
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            archive_expsym_cmds=''
+        ;;
+      m68k)
+            archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_minus_L=yes
+        ;;
+      esac
       ;;
-    esac
-    if test "$solaris_use_stlport4" != yes; then
-      postdeps_CXX='-library=Cstd -library=Crun'
-    fi
-    ;;
-  esac
-  ;;
 
-solaris*)
-  case $cc_basename in
-  CC*)
-    # The more standards-conforming stlport4 library is
-    # incompatible with the Cstd library. Avoid specifying
-    # it if it's in CXXFLAGS. Ignore libCrun as
-    # -library=stlport4 depends on it.
-    case " $CXX $CXXFLAGS " in
-    *" -library=stlport4 "*)
-      solaris_use_stlport4=yes
+    bsdi[45]*)
+      export_dynamic_flag_spec=-rdynamic
       ;;
-    esac
 
-    # Adding this requires a known-good setup of shared libraries for
-    # Sun compiler versions before 5.6, else PIC objects from an old
-    # archive will be linked into the output, leading to subtle bugs.
-    if test "$solaris_use_stlport4" != yes; then
-      postdeps_CXX='-library=Cstd -library=Crun'
-    fi
-    ;;
-  esac
-  ;;
-esac
+    cygwin* | mingw* | pw32* | cegcc*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      case $cc_basename in
+      cl*)
+	# Native MSVC
+	hardcode_libdir_flag_spec=' '
+	allow_undefined_flag=unsupported
+	always_export_symbols=yes
+	file_list_spec='@'
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	  else
+	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	  fi~
+	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	  linknames='
+	# The linker will not automatically build a static lib if we build a DLL.
+	# _LT_TAGVAR(old_archive_from_new_cmds, )='true'
+	enable_shared_with_static_runtimes=yes
+	export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+	# Don't use ranlib
+	old_postinstall_cmds='chmod 644 $oldlib'
+	postlink_cmds='lt_outputfile="@OUTPUT@"~
+	  lt_tool_outputfile="@TOOL_OUTPUT@"~
+	  case $lt_outputfile in
+	    *.exe|*.EXE) ;;
+	    *)
+	      lt_outputfile="$lt_outputfile.exe"
+	      lt_tool_outputfile="$lt_tool_outputfile.exe"
+	      ;;
+	  esac~
+	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	    $RM "$lt_outputfile.manifest";
+	  fi'
+	;;
+      *)
+	# Assume MSVC wrapper
+	hardcode_libdir_flag_spec=' '
+	allow_undefined_flag=unsupported
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+	# The linker will automatically build a .lib file if we build a DLL.
+	old_archive_from_new_cmds='true'
+	# FIXME: Should let the user specify the lib program.
+	old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+	enable_shared_with_static_runtimes=yes
+	;;
+      esac
+      ;;
 
-case " $postdeps_CXX " in
-*" -lc "*) archive_cmds_need_lc_CXX=no ;;
-esac
+    darwin* | rhapsody*)
 
-lt_prog_compiler_wl_CXX=
-lt_prog_compiler_pic_CXX=
-lt_prog_compiler_static_CXX=
 
-{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
-echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+  archive_cmds_need_lc=no
+  hardcode_direct=no
+  hardcode_automatic=yes
+  hardcode_shlibpath_var=unsupported
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    whole_archive_flag_spec='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+  else
+    whole_archive_flag_spec=''
+  fi
+  link_all_deplibs=yes
+  allow_undefined_flag="$_lt_dar_allow_undefined"
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
+    output_verbose_link_cmd=func_echo_all
+    archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+    archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+    module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
 
-  # C++ specific cases for pic, static, wl, etc.
-  if test "$GXX" = yes; then
-    lt_prog_compiler_wl_CXX='-Wl,'
-    lt_prog_compiler_static_CXX='-static'
+  else
+  ld_shlibs=no
+  fi
 
-    case $host_os in
-    aix*)
-      # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	lt_prog_compiler_static_CXX='-Bstatic'
-      fi
-      ;;
-    amigaos*)
-      # FIXME: we need at least 68020 code to build shared libraries, but
-      # adding the `-m68020' flag to GCC prevents building anything better,
-      # like `-m68040'.
-      lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4'
       ;;
-    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
-      # PIC is the default for these OSes.
+
+    dgux*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
       ;;
-    mingw* | cygwin* | os2* | pw32*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      # Although the cygwin gcc ignores -fPIC, still need this for old-style
-      # (--disable-auto-import) libraries
-      lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
+
+    freebsd1*)
+      ld_shlibs=no
       ;;
-    darwin* | rhapsody*)
-      # PIC is the default on this platform
-      # Common symbols not allowed in MH_DYLIB files
-      lt_prog_compiler_pic_CXX='-fno-common'
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
       ;;
-    *djgpp*)
-      # DJGPP does not support shared libraries at all
-      lt_prog_compiler_pic_CXX=
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
       ;;
-    interix[3-9]*)
-      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
-      # Instead, we relocate shared libraries at runtime.
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
       ;;
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	lt_prog_compiler_pic_CXX=-Kconform_pic
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
       fi
+      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_direct=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L=yes
+      export_dynamic_flag_spec='${wl}-E'
       ;;
-    hpux*)
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
-      case $host_cpu in
-      hppa*64*|ia64*)
-	;;
-      *)
-	lt_prog_compiler_pic_CXX='-fPIC'
-	;;
-      esac
-      ;;
-    *)
-      lt_prog_compiler_pic_CXX='-fPIC'
+
+    hpux10*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+	hardcode_libdir_flag_spec_ld='+b $libdir'
+	hardcode_libdir_separator=:
+	hardcode_direct=yes
+	hardcode_direct_absolute=yes
+	export_dynamic_flag_spec='${wl}-E'
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	hardcode_minus_L=yes
+      fi
       ;;
-    esac
-  else
-    case $host_os in
-      aix[4-9]*)
-	# All AIX code is PIC.
-	if test "$host_cpu" = ia64; then
-	  # AIX 5 now supports IA64 processor
-	  lt_prog_compiler_static_CXX='-Bstatic'
-	else
-	  lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp'
-	fi
-	;;
-      chorus*)
-	case $cc_basename in
-	cxch68*)
-	  # Green Hills C++ Compiler
-	  # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+
+    hpux11*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
 	  ;;
 	esac
-	;;
-       darwin*)
-         # PIC is the default on this platform
-         # Common symbols not allowed in MH_DYLIB files
-         case $cc_basename in
-           xlc*)
-           lt_prog_compiler_pic_CXX='-qnocommon'
-           lt_prog_compiler_wl_CXX='-Wl,'
-           ;;
-         esac
-       ;;
-      dgux*)
-	case $cc_basename in
-	  ec++*)
-	    lt_prog_compiler_pic_CXX='-KPIC'
-	    ;;
-	  ghcx*)
-	    # Green Hills C++ Compiler
-	    lt_prog_compiler_pic_CXX='-pic'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      freebsd* | dragonfly*)
-	# FreeBSD uses GNU C++
-	;;
-      hpux9* | hpux10* | hpux11*)
-	case $cc_basename in
-	  CC*)
-	    lt_prog_compiler_wl_CXX='-Wl,'
-	    lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
-	    if test "$host_cpu" != ia64; then
-	      lt_prog_compiler_pic_CXX='+Z'
-	    fi
-	    ;;
-	  aCC*)
-	    lt_prog_compiler_wl_CXX='-Wl,'
-	    lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
-	    case $host_cpu in
-	    hppa*64*|ia64*)
-	      # +Z the default
-	      ;;
-	    *)
-	      lt_prog_compiler_pic_CXX='+Z'
-	      ;;
-	    esac
-	    ;;
-	  *)
-	    ;;
+      else
+	case $host_cpu in
+	hppa*64*)
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+
+	  # Older versions of the 11.00 compiler do not understand -b yet
+	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+	  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
+$as_echo_n "checking if $CC understands -b... " >&6; }
+if ${lt_cv_prog_compiler__b+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler__b=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS -b"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler__b=yes
+       fi
+     else
+       lt_cv_prog_compiler__b=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
+$as_echo "$lt_cv_prog_compiler__b" >&6; }
+
+if test x"$lt_cv_prog_compiler__b" = xyes; then
+    archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+else
+    archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+fi
+
+	  ;;
 	esac
-	;;
-      interix*)
-	# This is c89, which is MS Visual C++ (no shared libs)
-	# Anyone wants to do a port?
-	;;
-      irix5* | irix6* | nonstopux*)
-	case $cc_basename in
-	  CC*)
-	    lt_prog_compiler_wl_CXX='-Wl,'
-	    lt_prog_compiler_static_CXX='-non_shared'
-	    # CC pic flag -KPIC is the default.
-	    ;;
-	  *)
-	    ;;
+      fi
+      if test "$with_gnu_ld" = no; then
+	hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+	hardcode_libdir_separator=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  hardcode_direct=no
+	  hardcode_shlibpath_var=no
+	  ;;
+	*)
+	  hardcode_direct=yes
+	  hardcode_direct_absolute=yes
+	  export_dynamic_flag_spec='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  hardcode_minus_L=yes
+	  ;;
 	esac
-	;;
-      linux* | k*bsd*-gnu)
-	case $cc_basename in
-	  KCC*)
-	    # KAI C++ Compiler
-	    lt_prog_compiler_wl_CXX='--backend -Wl,'
-	    lt_prog_compiler_pic_CXX='-fPIC'
-	    ;;
-	  icpc* | ecpc*)
-	    # Intel C++
-	    lt_prog_compiler_wl_CXX='-Wl,'
-	    lt_prog_compiler_pic_CXX='-KPIC'
-	    lt_prog_compiler_static_CXX='-static'
-	    ;;
-	  pgCC* | pgcpp*)
-	    # Portland Group C++ compiler.
-	    lt_prog_compiler_wl_CXX='-Wl,'
-	    lt_prog_compiler_pic_CXX='-fpic'
-	    lt_prog_compiler_static_CXX='-Bstatic'
-	    ;;
-	  cxx*)
-	    # Compaq C++
-	    # Make sure the PIC flag is empty.  It appears that all Alpha
-	    # Linux and Compaq Tru64 Unix objects are PIC.
-	    lt_prog_compiler_pic_CXX=
-	    lt_prog_compiler_static_CXX='-non_shared'
-	    ;;
-	  *)
-	    case `$CC -V 2>&1 | sed 5q` in
-	    *Sun\ C*)
-	      # Sun C++ 5.9
-	      lt_prog_compiler_pic_CXX='-KPIC'
-	      lt_prog_compiler_static_CXX='-Bstatic'
-	      lt_prog_compiler_wl_CXX='-Qoption ld '
-	      ;;
-	    esac
-	    ;;
-	esac
-	;;
-      lynxos*)
-	;;
-      m88k*)
-	;;
-      mvs*)
-	case $cc_basename in
-	  cxx*)
-	    lt_prog_compiler_pic_CXX='-W c,exportall'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      netbsd* | netbsdelf*-gnu)
-	;;
-      osf3* | osf4* | osf5*)
-	case $cc_basename in
-	  KCC*)
-	    lt_prog_compiler_wl_CXX='--backend -Wl,'
-	    ;;
-	  RCC*)
-	    # Rational C++ 2.4.1
-	    lt_prog_compiler_pic_CXX='-pic'
-	    ;;
-	  cxx*)
-	    # Digital/Compaq C++
-	    lt_prog_compiler_wl_CXX='-Wl,'
-	    # Make sure the PIC flag is empty.  It appears that all Alpha
-	    # Linux and Compaq Tru64 Unix objects are PIC.
-	    lt_prog_compiler_pic_CXX=
-	    lt_prog_compiler_static_CXX='-non_shared'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      psos*)
-	;;
-      solaris*)
-	case $cc_basename in
-	  CC*)
-	    # Sun C++ 4.2, 5.x and Centerline C++
-	    lt_prog_compiler_pic_CXX='-KPIC'
-	    lt_prog_compiler_static_CXX='-Bstatic'
-	    lt_prog_compiler_wl_CXX='-Qoption ld '
-	    ;;
-	  gcx*)
-	    # Green Hills C++ Compiler
-	    lt_prog_compiler_pic_CXX='-PIC'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      sunos4*)
-	case $cc_basename in
-	  CC*)
-	    # Sun C++ 4.x
-	    lt_prog_compiler_pic_CXX='-pic'
-	    lt_prog_compiler_static_CXX='-Bstatic'
-	    ;;
-	  lcc*)
-	    # Lucid
-	    lt_prog_compiler_pic_CXX='-pic'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      tandem*)
-	case $cc_basename in
-	  NCC*)
-	    # NonStop-UX NCC 3.20
-	    lt_prog_compiler_pic_CXX='-KPIC'
-	    ;;
-	  *)
-	    ;;
-	esac
-	;;
-      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
-	case $cc_basename in
-	  CC*)
-	    lt_prog_compiler_wl_CXX='-Wl,'
-	    lt_prog_compiler_pic_CXX='-KPIC'
-	    lt_prog_compiler_static_CXX='-Bstatic'
-	    ;;
-	esac
-	;;
-      vxworks*)
-	;;
-      *)
-	lt_prog_compiler_can_build_shared_CXX=no
-	;;
-    esac
-  fi
-
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6; }
-
-#
-# Check to make sure the PIC flag actually works.
-#
-if test -n "$lt_prog_compiler_pic_CXX"; then
-
-{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
-echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6; }
-if test "${lt_cv_prog_compiler_pic_works_CXX+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  lt_cv_prog_compiler_pic_works_CXX=no
-  ac_outfile=conftest.$ac_objext
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-   lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   # The option is referenced via a variable to avoid confusing sed.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:12425: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>conftest.err)
-   ac_status=$?
-   cat conftest.err >&5
-   echo "$as_me:12429: \$? = $ac_status" >&5
-   if (exit $ac_status) && test -s "$ac_outfile"; then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings other than the usual output.
-     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
-     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_pic_works_CXX=yes
-     fi
-   fi
-   $rm conftest*
-
-fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_CXX" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_pic_works_CXX" >&6; }
+      fi
+      ;;
 
-if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then
-    case $lt_prog_compiler_pic_CXX in
-     "" | " "*) ;;
-     *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;;
-     esac
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	# Try to use the -exported_symbol ld option, if it does not
+	# work, assume that -exports_file does not work either and
+	# implicitly export all symbols.
+	# This should be the same for all languages, so no per-tag cache variable.
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5
+$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; }
+if ${lt_cv_irix_exported_symbol+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  save_LDFLAGS="$LDFLAGS"
+	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+	   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+int foo (void) { return 0; }
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  lt_cv_irix_exported_symbol=yes
 else
-    lt_prog_compiler_pic_CXX=
-     lt_prog_compiler_can_build_shared_CXX=no
+  lt_cv_irix_exported_symbol=no
 fi
-
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+           LDFLAGS="$save_LDFLAGS"
 fi
-case $host_os in
-  # For platforms which do not support PIC, -DPIC is meaningless:
-  *djgpp*)
-    lt_prog_compiler_pic_CXX=
-    ;;
-  *)
-    lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
-    ;;
-esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5
+$as_echo "$lt_cv_irix_exported_symbol" >&6; }
+	if test "$lt_cv_irix_exported_symbol" = yes; then
+          archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+	fi
+      else
+	archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      inherit_rpath=yes
+      link_all_deplibs=yes
+      ;;
 
-#
-# Check to make sure the static flag actually works.
-#
-wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\"
-{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
-echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
-if test "${lt_cv_prog_compiler_static_works_CXX+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  lt_cv_prog_compiler_static_works_CXX=no
-   save_LDFLAGS="$LDFLAGS"
-   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
-   echo "$lt_simple_link_test_code" > conftest.$ac_ext
-   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
-     # The linker can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     if test -s conftest.err; then
-       # Append any errors to the config.log.
-       cat conftest.err 1>&5
-       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
-       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-       if diff conftest.exp conftest.er2 >/dev/null; then
-         lt_cv_prog_compiler_static_works_CXX=yes
-       fi
-     else
-       lt_cv_prog_compiler_static_works_CXX=yes
-     fi
-   fi
-   $rm -r conftest*
-   LDFLAGS="$save_LDFLAGS"
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
+      else
+	archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      hardcode_shlibpath_var=no
+      ;;
 
-fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_CXX" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_static_works_CXX" >&6; }
+    newsos6)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_direct=yes
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_shlibpath_var=no
+      ;;
 
-if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then
-    :
-else
-    lt_prog_compiler_static_CXX=
-fi
+    *nto* | *qnx*)
+      ;;
 
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	hardcode_direct=yes
+	hardcode_shlibpath_var=no
+	hardcode_direct_absolute=yes
+	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+	  export_dynamic_flag_spec='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+	     archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     hardcode_libdir_flag_spec='-R$libdir'
+	     ;;
+	   *)
+	     archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+	fi
+      else
+	ld_shlibs=no
+      fi
+      ;;
 
-{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
-if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  lt_cv_prog_compiler_c_o_CXX=no
-   $rm -r conftest 2>/dev/null
-   mkdir conftest
-   cd conftest
-   mkdir out
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      allow_undefined_flag=unsupported
+      archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
 
-   lt_compiler_flag="-o out/conftest2.$ac_objext"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:12529: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>out/conftest.err)
-   ac_status=$?
-   cat out/conftest.err >&5
-   echo "$as_me:12533: \$? = $ac_status" >&5
-   if (exit $ac_status) && test -s out/conftest2.$ac_objext
-   then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
-     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
-     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_c_o_CXX=yes
-     fi
-   fi
-   chmod u+w . 2>&5
-   $rm conftest*
-   # SGI C++ compiler will create directory out/ii_files/ for
-   # template instantiation
-   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
-   $rm out/* && rmdir out
-   cd ..
-   rmdir conftest
-   $rm conftest*
+    osf3*)
+      if test "$GCC" = yes; then
+	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	allow_undefined_flag=' -expect_unresolved \*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
 
-fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6; }
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      else
+	allow_undefined_flag=' -expect_unresolved \*'
+	archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
 
+	# Both c and cxx compiler support -rpath directly
+	hardcode_libdir_flag_spec='-rpath $libdir'
+      fi
+      archive_cmds_need_lc='no'
+      hardcode_libdir_separator=:
+      ;;
 
-hard_links="nottested"
-if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then
-  # do not overwrite the value of need_locks provided by the user
-  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
-echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
-  hard_links=yes
-  $rm conftest*
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  touch conftest.a
-  ln conftest.a conftest.b 2>&5 || hard_links=no
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  { echo "$as_me:$LINENO: result: $hard_links" >&5
-echo "${ECHO_T}$hard_links" >&6; }
-  if test "$hard_links" = no; then
-    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
-echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
-    need_locks=warn
-  fi
-else
-  need_locks=no
-fi
+    solaris*)
+      no_undefined_flag=' -z defs'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+      else
+	case `$CC -V 2>&1` in
+	*"Compilers 5.0"*)
+	  wlarc=''
+	  archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+	  ;;
+	*)
+	  wlarc='${wl}'
+	  archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  ;;
+	esac
+      fi
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_shlibpath_var=no
+      case $host_os in
+      solaris2.[0-5] | solaris2.[0-5].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      link_all_deplibs=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      hardcode_shlibpath_var=no
+      ;;
 
-{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+    sysv4)
+      case $host_vendor in
+	sni)
+	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  reload_cmds='$CC -r -o $output$reload_objs'
+	  hardcode_direct=no
+        ;;
+	motorola)
+	  archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      hardcode_shlibpath_var=no
+      ;;
 
-  export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  case $host_os in
-  aix[4-9]*)
-    # If we're using GNU nm, then we don't want the "-C" option.
-    # -C means demangle to AIX nm, but means don't demangle with GNU nm
-    if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
-      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
-    else
-      export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+    sysv4.3*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_shlibpath_var=no
+      export_dynamic_flag_spec='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	hardcode_shlibpath_var=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	ld_shlibs=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag='${wl}-z,text'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      no_undefined_flag='${wl}-z,text'
+      allow_undefined_flag='${wl}-z,nodefs'
+      archive_cmds_need_lc=no
+      hardcode_shlibpath_var=no
+      hardcode_libdir_flag_spec='${wl}-R,$libdir'
+      hardcode_libdir_separator=':'
+      link_all_deplibs=yes
+      export_dynamic_flag_spec='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_shlibpath_var=no
+      ;;
+
+    *)
+      ld_shlibs=no
+      ;;
+    esac
+
+    if test x$host_vendor = xsni; then
+      case $host in
+      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+	export_dynamic_flag_spec='${wl}-Blargedynsym'
+	;;
+      esac
     fi
-    ;;
-  pw32*)
-    export_symbols_cmds_CXX="$ltdll_cmds"
-  ;;
-  cygwin* | mingw*)
-    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
-  ;;
-  linux* | k*bsd*-gnu)
-    link_all_deplibs_CXX=no
-  ;;
-  *)
-    export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  ;;
-  esac
-  exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+  fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
+$as_echo "$ld_shlibs" >&6; }
+test "$ld_shlibs" = no && can_build_shared=no
+
+with_gnu_ld=$with_gnu_ld
+
+
+
+
+
+
+
+
+
+
+
+
+
 
-{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
-echo "${ECHO_T}$ld_shlibs_CXX" >&6; }
-test "$ld_shlibs_CXX" = no && can_build_shared=no
 
 #
 # Do we need to explicitly link libc?
 #
-case "x$archive_cmds_need_lc_CXX" in
+case "x$archive_cmds_need_lc" in
 x|xyes)
   # Assume -lc should be added
-  archive_cmds_need_lc_CXX=yes
+  archive_cmds_need_lc=yes
 
   if test "$enable_shared" = yes && test "$GCC" = yes; then
-    case $archive_cmds_CXX in
+    case $archive_cmds in
     *'~'*)
       # FIXME: we may have to deal with multi-command sequences.
       ;;
@@ -12628,68 +10243,294 @@ x|xyes)
       # Test whether the compiler implicitly links with -lc since on some
       # systems, -lgcc has to come before -lc. If gcc already passes -lc
       # to ld, don't add -lc before -lgcc.
-      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
-echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
-      $rm conftest*
-      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+if ${lt_cv_archive_cmds_need_lc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  $RM conftest*
+	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
-      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+	if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } 2>conftest.err; then
-        soname=conftest
-        lib=conftest
-        libobjs=conftest.$ac_objext
-        deplibs=
-        wl=$lt_prog_compiler_wl_CXX
-	pic_flag=$lt_prog_compiler_pic_CXX
-        compiler_flags=-v
-        linker_flags=-v
-        verstring=
-        output_objdir=.
-        libname=conftest
-        lt_save_allow_undefined_flag=$allow_undefined_flag_CXX
-        allow_undefined_flag_CXX=
-        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
-  (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } 2>conftest.err; then
+	  soname=conftest
+	  lib=conftest
+	  libobjs=conftest.$ac_objext
+	  deplibs=
+	  wl=$lt_prog_compiler_wl
+	  pic_flag=$lt_prog_compiler_pic
+	  compiler_flags=-v
+	  linker_flags=-v
+	  verstring=
+	  output_objdir=.
+	  libname=conftest
+	  lt_save_allow_undefined_flag=$allow_undefined_flag
+	  allow_undefined_flag=
+	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+  (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
   ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-        then
-	  archive_cmds_need_lc_CXX=no
-        else
-	  archive_cmds_need_lc_CXX=yes
-        fi
-        allow_undefined_flag_CXX=$lt_save_allow_undefined_flag
-      else
-        cat conftest.err 1>&5
-      fi
-      $rm conftest*
-      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5
-echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6; }
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+	  then
+	    lt_cv_archive_cmds_need_lc=no
+	  else
+	    lt_cv_archive_cmds_need_lc=yes
+	  fi
+	  allow_undefined_flag=$lt_save_allow_undefined_flag
+	else
+	  cat conftest.err 1>&5
+	fi
+	$RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc" >&6; }
+      archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc
       ;;
     esac
   fi
   ;;
 esac
 
-{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
-echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
-library_names_spec=
-libname_spec='lib$name'
-soname_spec=
-shrext_cmds=".so"
-postinstall_cmds=
-postuninstall_cmds=
-finish_cmds=
-finish_eval=
-shlibpath_var=
-shlibpath_overrides_runpath=unknown
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+
+if test "$GCC" = yes; then
+  case $host_os in
+    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+    *) lt_awk_arg="/^libraries:/" ;;
+  esac
+  case $host_os in
+    mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
+    *) lt_sed_strip_eq="s,=/,/,g" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+  case $lt_search_path_spec in
+  *\;*)
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+    ;;
+  *)
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+    ;;
+  esac
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary.
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+    else
+      test -d "$lt_sys_path" && \
+	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+  lt_foo="";
+  lt_count=0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo="/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[lt_foo]++; }
+  if (lt_freq[lt_foo] == 1) { print lt_foo; }
+}'`
+  # AWK program above erroneously prepends '/' to C:/dos/paths
+  # for these hosts.
+  case $host_os in
+    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+      $SED 's,/\([A-Za-z]:\),\1,g'` ;;
+  esac
+  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
 version_type=none
 dynamic_linker="$host_os ld.so"
 sys_lib_dlsearch_path_spec="/lib /usr/lib"
-
 need_lib_prefix=unknown
 hardcode_into_libs=no
 
@@ -12726,7 +10567,7 @@ aix[4-9]*)
       aix4 | aix4.[01] | aix4.[01].*)
       if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
 	   echo ' yes '
-	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
+	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
 	:
       else
 	can_build_shared=no
@@ -12752,9 +10593,18 @@ aix[4-9]*)
   ;;
 
 amigaos*)
-  library_names_spec='$libname.ixlibrary $libname.a'
-  # Create ${libname}_ixlibrary.a entries in /sys/libs.
-  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+  case $host_cpu in
+  powerpc)
+    # Since July 2007 AmigaOS4 officially supports .so libraries.
+    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    ;;
+  m68k)
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    ;;
+  esac
   ;;
 
 beos*)
@@ -12777,61 +10627,112 @@ bsdi[45]*)
   # libtool to hard-code these into programs
   ;;
 
-cygwin* | mingw* | pw32*)
+cygwin* | mingw* | pw32* | cegcc*)
   version_type=windows
   shrext_cmds=".dll"
   need_version=no
   need_lib_prefix=no
 
-  case $GCC,$host_os in
-  yes,cygwin* | yes,mingw* | yes,pw32*)
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
     library_names_spec='$libname.dll.a'
     # DLL is installed to $(libdir)/../bin by postinstall_cmds
     postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
       dldir=$destdir/`dirname \$dlpath`~
       test -d \$dldir || mkdir -p \$dldir~
       $install_prog $dir/$dlname \$dldir/$dlname~
-      chmod a+x \$dldir/$dlname'
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
     postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
       dlpath=$dir/\$dldll~
-       $rm \$dlpath'
+       $RM \$dlpath'
     shlibpath_overrides_runpath=yes
 
     case $host_os in
     cygwin*)
       # Cygwin DLLs use 'cyg' prefix rather than 'lib'
       soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+
+      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
       ;;
-    mingw*)
+    mingw* | cegcc*)
       # MinGW DLLs use traditional 'lib' prefix
       soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
-        # It is most probably a Windows format PATH printed by
-        # mingw gcc, but we are running on Cygwin. Gcc prints its search
-        # path with ; separators, and with drive letters. We can handle the
-        # drive letters (cygwin fileutils understands them), so leave them,
-        # especially as we might pass files found there to a mingw objdump,
-        # which wouldn't understand a cygwinified path. Ahh.
-        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-      else
-        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-      fi
       ;;
     pw32*)
       # pw32 DLLs use 'pw' prefix rather than 'lib'
       library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
       ;;
     esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
     ;;
 
   *)
+    # Assume MSVC wrapper
     library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    dynamic_linker='Win32 ld.exe'
     ;;
   esac
-  dynamic_linker='Win32 ld.exe'
   # FIXME: first we should search . and the directory the executable is in
   shlibpath_var=PATH
   ;;
@@ -12841,12 +10742,13 @@ darwin* | rhapsody*)
   version_type=darwin
   need_lib_prefix=no
   need_version=no
-  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
   soname_spec='${libname}${release}${major}$shared_ext'
   shlibpath_overrides_runpath=yes
   shlibpath_var=DYLD_LIBRARY_PATH
   shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
 
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
   sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
   ;;
 
@@ -12914,13 +10816,27 @@ 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
   ;;
 
-hpux9* | hpux10* | hpux11*)
-  # Give a soname corresponding to the major version so that dld.sl refuses to
-  # link against other versions.
-  version_type=sunos
+haiku*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  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=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
   need_lib_prefix=no
   need_version=no
   case $host_cpu in
@@ -12939,18 +10855,18 @@ hpux9* | hpux10* | hpux11*)
     fi
     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
     ;;
-   hppa*64*)
-     shrext_cmds='.sl'
-     hardcode_into_libs=yes
-     dynamic_linker="$host_os dld.sl"
-     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
-     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-     soname_spec='${libname}${release}${shared_ext}$major'
-     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
-     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
-     ;;
-   *)
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
     shrext_cmds='.sl'
     dynamic_linker="$host_os dld.sl"
     shlibpath_var=SHLIB_PATH
@@ -12959,8 +10875,10 @@ hpux9* | hpux10* | hpux11*)
     soname_spec='${libname}${release}${shared_ext}$major'
     ;;
   esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555.
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
   postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
   ;;
 
 interix[3-9]*)
@@ -13018,7 +10936,7 @@ linux*oldld* | linux*aout* | linux*coff*)
   ;;
 
 # This must be Linux ELF.
-linux* | k*bsd*-gnu)
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
   version_type=linux
   need_lib_prefix=no
   need_version=no
@@ -13027,6 +10945,41 @@ linux* | k*bsd*-gnu)
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
   shlibpath_var=LD_LIBRARY_PATH
   shlibpath_overrides_runpath=no
+
+  # Some binutils ld are patched to set DT_RUNPATH
+  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+	 LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+  lt_cv_shlibpath_overrides_runpath=yes
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+
+fi
+
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
   # This implies no fast_install, which is unacceptable.
   # Some rework will be needed to allow for fast_install
   # before this can be enabled.
@@ -13034,7 +10987,7 @@ linux* | k*bsd*-gnu)
 
   # Append ld.so.conf contents to the search path
   if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
     sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
   fi
 
@@ -13063,7 +11016,7 @@ netbsd*)
   version_type=sunos
   need_lib_prefix=no
   need_version=no
-  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
     finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
     dynamic_linker='NetBSD (a.out) ld.so'
@@ -13084,14 +11037,16 @@ newsos6)
   shlibpath_overrides_runpath=yes
   ;;
 
-nto-qnx*)
-  version_type=linux
+*nto* | *qnx*)
+  version_type=qnx
   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=yes
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  dynamic_linker='ldqnx.so'
   ;;
 
 openbsd*)
@@ -13100,13 +11055,13 @@ openbsd*)
   need_lib_prefix=no
   # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
   case $host_os in
-    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
-    *)                         need_version=no  ;;
+    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
+    *)				need_version=no  ;;
   esac
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
   shlibpath_var=LD_LIBRARY_PATH
-  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
     case $host_os in
       openbsd2.[89] | openbsd2.[89].*)
 	shlibpath_overrides_runpath=no
@@ -13178,7 +11133,6 @@ sysv4 | sysv4.3*)
     sni)
       shlibpath_overrides_runpath=no
       need_lib_prefix=no
-      export_dynamic_flag_spec='${wl}-Blargedynsym'
       runpath_var=LD_RUN_PATH
       ;;
     siemens)
@@ -13209,13 +11163,12 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
   soname_spec='${libname}${release}${shared_ext}$major'
   shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
   hardcode_into_libs=yes
   if test "$with_gnu_ld" = yes; then
     sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
-    shlibpath_overrides_runpath=no
   else
     sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
-    shlibpath_overrides_runpath=yes
     case $host_os in
       sco3.2v5*)
         sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
@@ -13225,6 +11178,17 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
   sys_lib_dlsearch_path_spec='/usr/lib'
   ;;
 
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  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}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
 uts4*)
   version_type=linux
   library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -13236,10507 +11200,9076 @@ uts4*)
   dynamic_linker=no
   ;;
 esac
-{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
-echo "${ECHO_T}$dynamic_linker" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
 test "$dynamic_linker" = no && can_build_shared=no
 
-if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"
-fi
-
-sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
-if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"
-fi
-
-sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
-
 variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
 if test "$GCC" = yes; then
   variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
 fi
 
-{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
-echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
-hardcode_action_CXX=
-if test -n "$hardcode_libdir_flag_spec_CXX" || \
-   test -n "$runpath_var_CXX" || \
-   test "X$hardcode_automatic_CXX" = "Xyes" ; then
-
-  # We can hardcode non-existant directories.
-  if test "$hardcode_direct_CXX" != no &&
-     # If the only mechanism to avoid hardcoding is shlibpath_var, we
-     # have to relink, otherwise we might link with an installed library
-     # when we should be linking with a yet-to-be-installed one
-     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no &&
-     test "$hardcode_minus_L_CXX" != no; then
-    # Linking always hardcodes the temporary library directory.
-    hardcode_action_CXX=relink
-  else
-    # We can link without hardcoding, and we can hardcode nonexisting dirs.
-    hardcode_action_CXX=immediate
-  fi
-else
-  # We cannot hardcode anything, or else we can only hardcode existing
-  # directories.
-  hardcode_action_CXX=unsupported
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
 fi
-{ echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5
-echo "${ECHO_T}$hardcode_action_CXX" >&6; }
-
-if test "$hardcode_action_CXX" = relink; then
-  # Fast installation is not supported
-  enable_fast_install=no
-elif test "$shlibpath_overrides_runpath" = yes ||
-     test "$enable_shared" = no; then
-  # Fast installation is not necessary
-  enable_fast_install=needless
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
 fi
 
 
-# The else clause should only fire when bootstrapping the
-# libtool distribution, otherwise you forgot to ship ltmain.sh
-# with your package, and you will get complaints that there are
-# no rules to generate ltmain.sh.
-if test -f "$ltmain"; then
-  # See if we are running on zsh, and set the options which allow our commands through
-  # without removal of \ escapes.
-  if test -n "${ZSH_VERSION+set}" ; then
-    setopt NO_GLOB_SUBST
-  fi
-  # Now quote all the things that may contain metacharacters while being
-  # careful not to overquote the AC_SUBSTed values.  We take copies of the
-  # variables and quote the copies for generation of the libtool script.
-  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
-    SED SHELL STRIP \
-    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
-    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
-    deplibs_check_method reload_flag reload_cmds need_locks \
-    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
-    lt_cv_sys_global_symbol_to_c_name_address \
-    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
-    old_postinstall_cmds old_postuninstall_cmds \
-    compiler_CXX \
-    CC_CXX \
-    LD_CXX \
-    lt_prog_compiler_wl_CXX \
-    lt_prog_compiler_pic_CXX \
-    lt_prog_compiler_static_CXX \
-    lt_prog_compiler_no_builtin_flag_CXX \
-    export_dynamic_flag_spec_CXX \
-    thread_safe_flag_spec_CXX \
-    whole_archive_flag_spec_CXX \
-    enable_shared_with_static_runtimes_CXX \
-    old_archive_cmds_CXX \
-    old_archive_from_new_cmds_CXX \
-    predep_objects_CXX \
-    postdep_objects_CXX \
-    predeps_CXX \
-    postdeps_CXX \
-    compiler_lib_search_path_CXX \
-    compiler_lib_search_dirs_CXX \
-    archive_cmds_CXX \
-    archive_expsym_cmds_CXX \
-    postinstall_cmds_CXX \
-    postuninstall_cmds_CXX \
-    old_archive_from_expsyms_cmds_CXX \
-    allow_undefined_flag_CXX \
-    no_undefined_flag_CXX \
-    export_symbols_cmds_CXX \
-    hardcode_libdir_flag_spec_CXX \
-    hardcode_libdir_flag_spec_ld_CXX \
-    hardcode_libdir_separator_CXX \
-    hardcode_automatic_CXX \
-    module_cmds_CXX \
-    module_expsym_cmds_CXX \
-    lt_cv_prog_compiler_c_o_CXX \
-    fix_srcfile_path_CXX \
-    exclude_expsyms_CXX \
-    include_expsyms_CXX; do
-
-    case $var in
-    old_archive_cmds_CXX | \
-    old_archive_from_new_cmds_CXX | \
-    archive_cmds_CXX | \
-    archive_expsym_cmds_CXX | \
-    module_cmds_CXX | \
-    module_expsym_cmds_CXX | \
-    old_archive_from_expsyms_cmds_CXX | \
-    export_symbols_cmds_CXX | \
-    extract_expsyms_cmds | reload_cmds | finish_cmds | \
-    postinstall_cmds | postuninstall_cmds | \
-    old_postinstall_cmds | old_postuninstall_cmds | \
-    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
-      # Double-quote double-evaled strings.
-      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
-      ;;
-    *)
-      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
-      ;;
-    esac
-  done
-
-  case $lt_echo in
-  *'\$0 --fallback-echo"')
-    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
-    ;;
-  esac
-
-cfgfile="$ofile"
-
-  cat <<__EOF__ >> "$cfgfile"
-# ### BEGIN LIBTOOL TAG CONFIG: $tagname
-
-# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
 
-# Shell to use when invoking shell scripts.
-SHELL=$lt_SHELL
 
-# Whether or not to build shared libraries.
-build_libtool_libs=$enable_shared
 
-# Whether or not to build static libraries.
-build_old_libs=$enable_static
 
-# Whether or not to add -lc for building shared libraries.
-build_libtool_need_lc=$archive_cmds_need_lc_CXX
 
-# Whether or not to disallow shared libs when runtime libs are static
-allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
 
-# Whether or not to optimize for fast installation.
-fast_install=$enable_fast_install
 
-# The host system.
-host_alias=$host_alias
-host=$host
-host_os=$host_os
 
-# The build system.
-build_alias=$build_alias
-build=$build
-build_os=$build_os
 
-# An echo program that does not interpret backslashes.
-echo=$lt_echo
 
-# The archiver.
-AR=$lt_AR
-AR_FLAGS=$lt_AR_FLAGS
 
-# A C compiler.
-LTCC=$lt_LTCC
 
-# LTCC compiler flags.
-LTCFLAGS=$lt_LTCFLAGS
 
-# A language-specific compiler.
-CC=$lt_compiler_CXX
 
-# Is the compiler the GNU C compiler?
-with_gcc=$GCC_CXX
 
-# An ERE matcher.
-EGREP=$lt_EGREP
 
-# The linker used to build libraries.
-LD=$lt_LD_CXX
 
-# Whether we need hard or soft links.
-LN_S=$lt_LN_S
 
-# A BSD-compatible nm program.
-NM=$lt_NM
 
-# A symbol stripping program
-STRIP=$lt_STRIP
 
-# Used to examine libraries when file_magic_cmd begins "file"
-MAGIC_CMD=$MAGIC_CMD
 
-# Used on cygwin: DLL creation program.
-DLLTOOL="$DLLTOOL"
 
-# Used on cygwin: object dumper.
-OBJDUMP="$OBJDUMP"
 
-# Used on cygwin: assembler.
-AS="$AS"
 
-# The name of the directory that contains temporary libtool files.
-objdir=$objdir
 
-# How to create reloadable object files.
-reload_flag=$lt_reload_flag
-reload_cmds=$lt_reload_cmds
 
-# How to pass a linker flag through the compiler.
-wl=$lt_lt_prog_compiler_wl_CXX
 
-# Object file suffix (normally "o").
-objext="$ac_objext"
 
-# Old archive suffix (normally "a").
-libext="$libext"
 
-# Shared library suffix (normally ".so").
-shrext_cmds='$shrext_cmds'
 
-# Executable file suffix (normally "").
-exeext="$exeext"
 
-# Additional compiler flags for building library objects.
-pic_flag=$lt_lt_prog_compiler_pic_CXX
-pic_mode=$pic_mode
 
-# What is the maximum length of a command?
-max_cmd_len=$lt_cv_sys_max_cmd_len
 
-# Does compiler simultaneously support -c and -o options?
-compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
 
-# Must we lock files when doing compilation?
-need_locks=$lt_need_locks
 
-# Do we need the lib prefix for modules?
-need_lib_prefix=$need_lib_prefix
 
-# Do we need a version for libraries?
-need_version=$need_version
 
-# Whether dlopen is supported.
-dlopen_support=$enable_dlopen
 
-# Whether dlopen of programs is supported.
-dlopen_self=$enable_dlopen_self
 
-# Whether dlopen of statically linked programs is supported.
-dlopen_self_static=$enable_dlopen_self_static
 
-# Compiler flag to prevent dynamic linking.
-link_static_flag=$lt_lt_prog_compiler_static_CXX
 
-# Compiler flag to turn off builtin functions.
-no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
 
-# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
 
-# Compiler flag to generate shared objects directly from archives.
-whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
 
-# Compiler flag to generate thread-safe objects.
-thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX
 
-# Library versioning type.
-version_type=$version_type
 
-# Format of library name prefix.
-libname_spec=$lt_libname_spec
 
-# List of archive names.  First name is the real one, the rest are links.
-# The last name is the one that the linker finds with -lNAME.
-library_names_spec=$lt_library_names_spec
 
-# The coded name of the library, if different from the real name.
-soname_spec=$lt_soname_spec
 
-# Commands used to build and install an old-style archive.
-RANLIB=$lt_RANLIB
-old_archive_cmds=$lt_old_archive_cmds_CXX
-old_postinstall_cmds=$lt_old_postinstall_cmds
-old_postuninstall_cmds=$lt_old_postuninstall_cmds
 
-# Create an old-style archive from a shared archive.
-old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
 
-# Create a temporary old-style archive to link instead of a shared archive.
-old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
 
-# Commands used to build and install a shared archive.
-archive_cmds=$lt_archive_cmds_CXX
-archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
-postinstall_cmds=$lt_postinstall_cmds
-postuninstall_cmds=$lt_postuninstall_cmds
 
-# Commands used to build a loadable module (assumed same as above if empty)
-module_cmds=$lt_module_cmds_CXX
-module_expsym_cmds=$lt_module_expsym_cmds_CXX
 
-# Commands to strip libraries.
-old_striplib=$lt_old_striplib
-striplib=$lt_striplib
 
-# Dependencies to place before the objects being linked to create a
-# shared library.
-predep_objects=$lt_predep_objects_CXX
 
-# Dependencies to place after the objects being linked to create a
-# shared library.
-postdep_objects=$lt_postdep_objects_CXX
 
-# Dependencies to place before the objects being linked to create a
-# shared library.
-predeps=$lt_predeps_CXX
 
-# Dependencies to place after the objects being linked to create a
-# shared library.
-postdeps=$lt_postdeps_CXX
 
-# The directories searched by this compiler when creating a shared
-# library
-compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX
 
-# The library search path used internally by the compiler when linking
-# a shared library.
-compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
 
-# Method to check whether dependent libraries are shared objects.
-deplibs_check_method=$lt_deplibs_check_method
 
-# Command to use when deplibs_check_method == file_magic.
-file_magic_cmd=$lt_file_magic_cmd
 
-# Flag that allows shared libraries with undefined symbols to be built.
-allow_undefined_flag=$lt_allow_undefined_flag_CXX
 
-# Flag that forces no undefined symbols.
-no_undefined_flag=$lt_no_undefined_flag_CXX
 
-# Commands used to finish a libtool library installation in a directory.
-finish_cmds=$lt_finish_cmds
 
-# Same as above, but a single script fragment to be evaled but not shown.
-finish_eval=$lt_finish_eval
 
-# Take the output of nm and produce a listing of raw symbols and C names.
-global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
 
-# Transform the output of nm in a proper C declaration
-global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
 
-# Transform the output of nm in a C name address pair
-global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
 
-# This is the shared library runtime path variable.
-runpath_var=$runpath_var
 
-# This is the shared library path variable.
-shlibpath_var=$shlibpath_var
 
-# Is shlibpath searched before the hard-coded library search path?
-shlibpath_overrides_runpath=$shlibpath_overrides_runpath
 
-# How to hardcode a shared library path into an executable.
-hardcode_action=$hardcode_action_CXX
 
-# Whether we should hardcode library paths into libraries.
-hardcode_into_libs=$hardcode_into_libs
 
-# Flag to hardcode \$libdir into a binary during linking.
-# This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
 
-# If ld is used when linking, flag to hardcode \$libdir into
-# a binary during linking. This must work even if \$libdir does
-# not exist.
-hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX
 
-# Whether we need a single -rpath flag with a separated argument.
-hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
 
-# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
-# resulting binary.
-hardcode_direct=$hardcode_direct_CXX
 
-# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
-# resulting binary.
-hardcode_minus_L=$hardcode_minus_L_CXX
 
-# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
-# the resulting binary.
-hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
 
-# Set to yes if building a shared library automatically hardcodes DIR into the library
-# and all subsequent libraries and executables linked against it.
-hardcode_automatic=$hardcode_automatic_CXX
 
-# Variables whose values should be saved in libtool wrapper scripts and
-# restored at relink time.
-variables_saved_for_relink="$variables_saved_for_relink"
 
-# Whether libtool must link a program against all its dependency libraries.
-link_all_deplibs=$link_all_deplibs_CXX
 
-# Compile-time system search path for libraries
-sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
 
-# Run-time system search path for libraries
-sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
 
-# Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path=$lt_fix_srcfile_path
 
-# Set to yes if exported symbols are required.
-always_export_symbols=$always_export_symbols_CXX
 
-# The commands to list exported symbols.
-export_symbols_cmds=$lt_export_symbols_cmds_CXX
 
-# The commands to extract the exported symbol list from a shared archive.
-extract_expsyms_cmds=$lt_extract_expsyms_cmds
 
-# Symbols that should not be listed in the preloaded symbols.
-exclude_expsyms=$lt_exclude_expsyms_CXX
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" ||
+   test -n "$runpath_var" ||
+   test "X$hardcode_automatic" = "Xyes" ; then
 
-# Symbols that must always be exported.
-include_expsyms=$lt_include_expsyms_CXX
+  # We can hardcode non-existent directories.
+  if test "$hardcode_direct" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
+     test "$hardcode_minus_L" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
+$as_echo "$hardcode_action" >&6; }
 
-# ### END LIBTOOL TAG CONFIG: $tagname
+if test "$hardcode_action" = relink ||
+   test "$inherit_rpath" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
 
-__EOF__
 
 
-else
-  # If there is no Makefile yet, we rely on a make rule to execute
-  # `config.status --recheck' to rerun these tests and create the
-  # libtool script then.
-  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
-  if test -f "$ltmain_in"; then
-    test -f Makefile && make "$ltmain"
-  fi
-fi
 
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-CC=$lt_save_CC
-LDCXX=$LD
-LD=$lt_save_LD
-GCC=$lt_save_GCC
-with_gnu_ldcxx=$with_gnu_ld
-with_gnu_ld=$lt_save_with_gnu_ld
-lt_cv_path_LDCXX=$lt_cv_path_LD
-lt_cv_path_LD=$lt_save_path_LD
-lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
-lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+  if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
 
-	else
-	  tagname=""
-	fi
-	;;
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
 
-      F77)
-	if test -n "$F77" && test "X$F77" != "Xno"; then
-
-ac_ext=f
-ac_compile='$F77 -c $FFLAGS conftest.$ac_ext >&5'
-ac_link='$F77 -o conftest$ac_exeext $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_f77_compiler_gnu
-
-
-archive_cmds_need_lc_F77=no
-allow_undefined_flag_F77=
-always_export_symbols_F77=no
-archive_expsym_cmds_F77=
-export_dynamic_flag_spec_F77=
-hardcode_direct_F77=no
-hardcode_libdir_flag_spec_F77=
-hardcode_libdir_flag_spec_ld_F77=
-hardcode_libdir_separator_F77=
-hardcode_minus_L_F77=no
-hardcode_automatic_F77=no
-module_cmds_F77=
-module_expsym_cmds_F77=
-link_all_deplibs_F77=unknown
-old_archive_cmds_F77=$old_archive_cmds
-no_undefined_flag_F77=
-whole_archive_flag_spec_F77=
-enable_shared_with_static_runtimes_F77=no
-
-# Source file extension for f77 test sources.
-ac_ext=f
-
-# Object file extension for compiled f77 test sources.
-objext=o
-objext_F77=$objext
+  mingw* | pw32* | cegcc*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+    ;;
 
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="\
-      subroutine t
-      return
-      end
-"
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+    ;;
 
-# Code to be used in simple link tests
-lt_simple_link_test_code="\
-      program t
-      end
-"
+  darwin*)
+  # if libdl is installed we need to link against it
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dl_dlopen=yes
+else
+  ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
 
-# If no C compiler was specified, use CC.
-LTCC=${LTCC-"$CC"}
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
 
-# If no C compiler flags were specified, use CFLAGS.
-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+fi
 
-# Allow CC to be a program name with arguments.
-compiler=$CC
+    ;;
 
+  *)
+    ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
+if test "x$ac_cv_func_shl_load" = xyes; then :
+  lt_cv_dlopen="shl_load"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
+$as_echo_n "checking for shl_load in -ldld... " >&6; }
+if ${ac_cv_lib_dld_shl_load+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-# save warnings/boilerplate of simple test code
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_compile_test_code" >conftest.$ac_ext
-eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_compiler_boilerplate=`cat conftest.err`
-$rm conftest*
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+int
+main ()
+{
+return shl_load ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dld_shl_load=yes
+else
+  ac_cv_lib_dld_shl_load=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
+$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
+if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
+  lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+else
+  ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
+if test "x$ac_cv_func_dlopen" = xyes; then :
+  lt_cv_dlopen="dlopen"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_link_test_code" >conftest.$ac_ext
-eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_linker_boilerplate=`cat conftest.err`
-$rm -r conftest*
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dl_dlopen=yes
+else
+  ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
+$as_echo_n "checking for dlopen in -lsvld... " >&6; }
+if ${ac_cv_lib_svld_dlopen+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_svld_dlopen=yes
+else
+  ac_cv_lib_svld_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
+$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
+if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
+  lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
+$as_echo_n "checking for dld_link in -ldld... " >&6; }
+if ${ac_cv_lib_dld_dld_link+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-# Allow CC to be a program name with arguments.
-lt_save_CC="$CC"
-CC=${F77-"f77"}
-compiler=$CC
-compiler_F77=$CC
-for cc_temp in $compiler""; do
-  case $cc_temp in
-    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
-    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
-    \-*) ;;
-    *) break;;
-  esac
-done
-cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link ();
+int
+main ()
+{
+return dld_link ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_dld_dld_link=yes
+else
+  ac_cv_lib_dld_dld_link=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
+$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
+if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
+  lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+fi
 
 
-{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
-echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; }
-{ echo "$as_me:$LINENO: result: $can_build_shared" >&5
-echo "${ECHO_T}$can_build_shared" >&6; }
+fi
 
-{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
-echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&6; }
-test "$can_build_shared" = "no" && enable_shared=no
 
-# On AIX, shared libraries and static libraries use the same namespace, and
-# are all built from PIC.
-case $host_os in
-aix3*)
-  test "$enable_shared" = yes && enable_static=no
-  if test -n "$RANLIB"; then
-    archive_cmds="$archive_cmds~\$RANLIB \$lib"
-    postinstall_cmds='$RANLIB $lib'
-  fi
-  ;;
-aix[4-9]*)
-  if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
-    test "$enable_shared" = yes && enable_static=no
-  fi
-  ;;
-esac
-{ echo "$as_me:$LINENO: result: $enable_shared" >&5
-echo "${ECHO_T}$enable_shared" >&6; }
+fi
 
-{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
-echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
-# Make sure either enable_shared or enable_static is yes.
-test "$enable_shared" = yes || enable_static=yes
-{ echo "$as_me:$LINENO: result: $enable_static" >&5
-echo "${ECHO_T}$enable_static" >&6; }
 
-GCC_F77="$G77"
-LD_F77="$LD"
+fi
 
-lt_prog_compiler_wl_F77=
-lt_prog_compiler_pic_F77=
-lt_prog_compiler_static_F77=
 
-{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
-echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+fi
 
-  if test "$GCC" = yes; then
-    lt_prog_compiler_wl_F77='-Wl,'
-    lt_prog_compiler_static_F77='-static'
 
-    case $host_os in
-      aix*)
-      # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	lt_prog_compiler_static_F77='-Bstatic'
-      fi
-      ;;
+fi
 
-    amigaos*)
-      # FIXME: we need at least 68020 code to build shared libraries, but
-      # adding the `-m68020' flag to GCC prevents building anything better,
-      # like `-m68040'.
-      lt_prog_compiler_pic_F77='-m68020 -resident32 -malways-restore-a4'
-      ;;
+    ;;
+  esac
 
-    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
-      # PIC is the default for these OSes.
-      ;;
-
-    mingw* | cygwin* | pw32* | os2*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      # Although the cygwin gcc ignores -fPIC, still need this for old-style
-      # (--disable-auto-import) libraries
-      lt_prog_compiler_pic_F77='-DDLL_EXPORT'
-      ;;
-
-    darwin* | rhapsody*)
-      # PIC is the default on this platform
-      # Common symbols not allowed in MH_DYLIB files
-      lt_prog_compiler_pic_F77='-fno-common'
-      ;;
-
-    interix[3-9]*)
-      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
-      # Instead, we relocate shared libraries at runtime.
-      ;;
-
-    msdosdjgpp*)
-      # Just because we use GCC doesn't mean we suddenly get shared libraries
-      # on systems that don't support them.
-      lt_prog_compiler_can_build_shared_F77=no
-      enable_shared=no
-      ;;
-
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	lt_prog_compiler_pic_F77=-Kconform_pic
-      fi
-      ;;
-
-    hpux*)
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
-      case $host_cpu in
-      hppa*64*|ia64*)
-	# +Z the default
-	;;
-      *)
-	lt_prog_compiler_pic_F77='-fPIC'
-	;;
-      esac
-      ;;
-
-    *)
-      lt_prog_compiler_pic_F77='-fPIC'
-      ;;
-    esac
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
   else
-    # PORTME Check for flag to pass linker flags through the system compiler.
-    case $host_os in
-    aix*)
-      lt_prog_compiler_wl_F77='-Wl,'
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	lt_prog_compiler_static_F77='-Bstatic'
-      else
-	lt_prog_compiler_static_F77='-bnso -bI:/lib/syscalls.exp'
-      fi
-      ;;
-      darwin*)
-        # PIC is the default on this platform
-        # Common symbols not allowed in MH_DYLIB files
-       case $cc_basename in
-         xlc*)
-         lt_prog_compiler_pic_F77='-qnocommon'
-         lt_prog_compiler_wl_F77='-Wl,'
-         ;;
-       esac
-       ;;
-
-    mingw* | cygwin* | pw32* | os2*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      lt_prog_compiler_pic_F77='-DDLL_EXPORT'
-      ;;
-
-    hpux9* | hpux10* | hpux11*)
-      lt_prog_compiler_wl_F77='-Wl,'
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
-      case $host_cpu in
-      hppa*64*|ia64*)
-	# +Z the default
-	;;
-      *)
-	lt_prog_compiler_pic_F77='+Z'
-	;;
-      esac
-      # Is there a better lt_prog_compiler_static that works with the bundled CC?
-      lt_prog_compiler_static_F77='${wl}-a ${wl}archive'
-      ;;
-
-    irix5* | irix6* | nonstopux*)
-      lt_prog_compiler_wl_F77='-Wl,'
-      # PIC (with -KPIC) is the default.
-      lt_prog_compiler_static_F77='-non_shared'
-      ;;
+    enable_dlopen=no
+  fi
 
-    newsos6)
-      lt_prog_compiler_pic_F77='-KPIC'
-      lt_prog_compiler_static_F77='-Bstatic'
-      ;;
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
 
-    linux* | k*bsd*-gnu)
-      case $cc_basename in
-      icc* | ecc*)
-	lt_prog_compiler_wl_F77='-Wl,'
-	lt_prog_compiler_pic_F77='-KPIC'
-	lt_prog_compiler_static_F77='-static'
-        ;;
-      pgcc* | pgf77* | pgf90* | pgf95*)
-        # Portland Group compilers (*not* the Pentium gcc compiler,
-	# which looks to be a dead project)
-	lt_prog_compiler_wl_F77='-Wl,'
-	lt_prog_compiler_pic_F77='-fpic'
-	lt_prog_compiler_static_F77='-Bstatic'
-        ;;
-      ccc*)
-        lt_prog_compiler_wl_F77='-Wl,'
-        # All Alpha code is PIC.
-        lt_prog_compiler_static_F77='-non_shared'
-        ;;
-      *)
-        case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)
-	  # Sun C 5.9
-	  lt_prog_compiler_pic_F77='-KPIC'
-	  lt_prog_compiler_static_F77='-Bstatic'
-	  lt_prog_compiler_wl_F77='-Wl,'
-	  ;;
-	*Sun\ F*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
-	  lt_prog_compiler_pic_F77='-KPIC'
-	  lt_prog_compiler_static_F77='-Bstatic'
-	  lt_prog_compiler_wl_F77=''
-	  ;;
-	esac
-	;;
-      esac
-      ;;
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
 
-    osf3* | osf4* | osf5*)
-      lt_prog_compiler_wl_F77='-Wl,'
-      # All OSF/1 code is PIC.
-      lt_prog_compiler_static_F77='-non_shared'
-      ;;
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
 
-    rdos*)
-      lt_prog_compiler_static_F77='-non_shared'
-      ;;
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
+$as_echo_n "checking whether a program can dlopen itself... " >&6; }
+if ${lt_cv_dlopen_self+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+#line $LINENO "configure"
+#include "confdefs.h"
 
-    solaris*)
-      lt_prog_compiler_pic_F77='-KPIC'
-      lt_prog_compiler_static_F77='-Bstatic'
-      case $cc_basename in
-      f77* | f90* | f95*)
-	lt_prog_compiler_wl_F77='-Qoption ld ';;
-      *)
-	lt_prog_compiler_wl_F77='-Wl,';;
-      esac
-      ;;
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
 
-    sunos4*)
-      lt_prog_compiler_wl_F77='-Qoption ld '
-      lt_prog_compiler_pic_F77='-PIC'
-      lt_prog_compiler_static_F77='-Bstatic'
-      ;;
+#include <stdio.h>
 
-    sysv4 | sysv4.2uw2* | sysv4.3*)
-      lt_prog_compiler_wl_F77='-Wl,'
-      lt_prog_compiler_pic_F77='-KPIC'
-      lt_prog_compiler_static_F77='-Bstatic'
-      ;;
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
 
-    sysv4*MP*)
-      if test -d /usr/nec ;then
-	lt_prog_compiler_pic_F77='-Kconform_pic'
-	lt_prog_compiler_static_F77='-Bstatic'
-      fi
-      ;;
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
 
-    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
-      lt_prog_compiler_wl_F77='-Wl,'
-      lt_prog_compiler_pic_F77='-KPIC'
-      lt_prog_compiler_static_F77='-Bstatic'
-      ;;
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
 
-    unicos*)
-      lt_prog_compiler_wl_F77='-Wl,'
-      lt_prog_compiler_can_build_shared_F77=no
-      ;;
+int fnord () { return 42; }
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
 
-    uts4*)
-      lt_prog_compiler_pic_F77='-pic'
-      lt_prog_compiler_static_F77='-Bstatic'
-      ;;
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
 
-    *)
-      lt_prog_compiler_can_build_shared_F77=no
-      ;;
+  return status;
+}
+_LT_EOF
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
     esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self=no
   fi
+fi
+rm -fr conftest*
 
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6; }
-
-#
-# Check to make sure the PIC flag actually works.
-#
-if test -n "$lt_prog_compiler_pic_F77"; then
-
-{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5
-echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6; }
-if test "${lt_cv_prog_compiler_pic_works_F77+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  lt_cv_prog_compiler_pic_works_F77=no
-  ac_outfile=conftest.$ac_objext
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-   lt_compiler_flag="$lt_prog_compiler_pic_F77"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   # The option is referenced via a variable to avoid confusing sed.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14127: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>conftest.err)
-   ac_status=$?
-   cat conftest.err >&5
-   echo "$as_me:14131: \$? = $ac_status" >&5
-   if (exit $ac_status) && test -s "$ac_outfile"; then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings other than the usual output.
-     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
-     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_pic_works_F77=yes
-     fi
-   fi
-   $rm conftest*
 
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_F77" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_pic_works_F77" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
+$as_echo "$lt_cv_dlopen_self" >&6; }
 
-if test x"$lt_cv_prog_compiler_pic_works_F77" = xyes; then
-    case $lt_prog_compiler_pic_F77 in
-     "" | " "*) ;;
-     *) lt_prog_compiler_pic_F77=" $lt_prog_compiler_pic_F77" ;;
-     esac
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
+$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
+if ${lt_cv_dlopen_self_static+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-    lt_prog_compiler_pic_F77=
-     lt_prog_compiler_can_build_shared_F77=no
-fi
+  	  if test "$cross_compiling" = yes; then :
+  lt_cv_dlopen_self_static=cross
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+#line $LINENO "configure"
+#include "confdefs.h"
 
-fi
-case $host_os in
-  # For platforms which do not support PIC, -DPIC is meaningless:
-  *djgpp*)
-    lt_prog_compiler_pic_F77=
-    ;;
-  *)
-    lt_prog_compiler_pic_F77="$lt_prog_compiler_pic_F77"
-    ;;
-esac
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
 
-#
-# Check to make sure the static flag actually works.
-#
-wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\"
-{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
-echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
-if test "${lt_cv_prog_compiler_static_works_F77+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  lt_cv_prog_compiler_static_works_F77=no
-   save_LDFLAGS="$LDFLAGS"
-   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
-   echo "$lt_simple_link_test_code" > conftest.$ac_ext
-   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
-     # The linker can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     if test -s conftest.err; then
-       # Append any errors to the config.log.
-       cat conftest.err 1>&5
-       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
-       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-       if diff conftest.exp conftest.er2 >/dev/null; then
-         lt_cv_prog_compiler_static_works_F77=yes
-       fi
-     else
-       lt_cv_prog_compiler_static_works_F77=yes
-     fi
-   fi
-   $rm -r conftest*
-   LDFLAGS="$save_LDFLAGS"
+#include <stdio.h>
 
-fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_F77" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_static_works_F77" >&6; }
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
 
-if test x"$lt_cv_prog_compiler_static_works_F77" = xyes; then
-    :
-else
-    lt_prog_compiler_static_F77=
-fi
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
 
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
 
-{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
-if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  lt_cv_prog_compiler_c_o_F77=no
-   $rm -r conftest 2>/dev/null
-   mkdir conftest
-   cd conftest
-   mkdir out
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+int fnord () { return 42; }
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
 
-   lt_compiler_flag="-o out/conftest2.$ac_objext"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14231: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>out/conftest.err)
-   ac_status=$?
-   cat out/conftest.err >&5
-   echo "$as_me:14235: \$? = $ac_status" >&5
-   if (exit $ac_status) && test -s out/conftest2.$ac_objext
-   then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
-     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
-     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_c_o_F77=yes
-     fi
-   fi
-   chmod u+w . 2>&5
-   $rm conftest*
-   # SGI C++ compiler will create directory out/ii_files/ for
-   # template instantiation
-   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
-   $rm out/* && rmdir out
-   cd ..
-   rmdir conftest
-   $rm conftest*
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
 
+  return status;
+}
+_LT_EOF
+  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&5 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+      x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+    esac
+  else :
+    # compilation failed
+    lt_cv_dlopen_self_static=no
+  fi
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6; }
+rm -fr conftest*
 
 
-hard_links="nottested"
-if test "$lt_cv_prog_compiler_c_o_F77" = no && test "$need_locks" != no; then
-  # do not overwrite the value of need_locks provided by the user
-  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
-echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
-  hard_links=yes
-  $rm conftest*
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  touch conftest.a
-  ln conftest.a conftest.b 2>&5 || hard_links=no
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  { echo "$as_me:$LINENO: result: $hard_links" >&5
-echo "${ECHO_T}$hard_links" >&6; }
-  if test "$hard_links" = no; then
-    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
-echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
-    need_locks=warn
-  fi
-else
-  need_locks=no
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
+$as_echo "$lt_cv_dlopen_self_static" >&6; }
+    fi
 
-{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
 
-  runpath_var=
-  allow_undefined_flag_F77=
-  enable_shared_with_static_runtimes_F77=no
-  archive_cmds_F77=
-  archive_expsym_cmds_F77=
-  old_archive_From_new_cmds_F77=
-  old_archive_from_expsyms_cmds_F77=
-  export_dynamic_flag_spec_F77=
-  whole_archive_flag_spec_F77=
-  thread_safe_flag_spec_F77=
-  hardcode_libdir_flag_spec_F77=
-  hardcode_libdir_flag_spec_ld_F77=
-  hardcode_libdir_separator_F77=
-  hardcode_direct_F77=no
-  hardcode_minus_L_F77=no
-  hardcode_shlibpath_var_F77=unsupported
-  link_all_deplibs_F77=unknown
-  hardcode_automatic_F77=no
-  module_cmds_F77=
-  module_expsym_cmds_F77=
-  always_export_symbols_F77=no
-  export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  # include_expsyms should be a list of space-separated symbols to be *always*
-  # included in the symbol list
-  include_expsyms_F77=
-  # exclude_expsyms can be an extended regexp of symbols to exclude
-  # it will be wrapped by ` (' and `)$', so one must not match beginning or
-  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
-  # as well as any symbol that contains `d'.
-  exclude_expsyms_F77='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
-  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
-  # platforms (ab)use it in PIC code, but their linkers get confused if
-  # the symbol is explicitly referenced.  Since portable code cannot
-  # rely on this symbol name, it's probably fine to never include it in
-  # preloaded symbol tables.
-  # Exclude shared library initialization/finalization symbols.
-  extract_expsyms_cmds=
-  # Just being paranoid about ensuring that cc_basename is set.
-  for cc_temp in $compiler""; do
-  case $cc_temp in
-    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
-    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
-    \-*) ;;
-    *) break;;
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
   esac
-done
-cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
 
-  case $host_os in
-  cygwin* | mingw* | pw32*)
-    # FIXME: the MSVC++ port hasn't been tested in a loooong time
-    # When not using gcc, we currently assume that we are using
-    # Microsoft Visual C++.
-    if test "$GCC" != yes; then
-      with_gnu_ld=no
-    fi
-    ;;
-  interix*)
-    # we just hope/assume this is gcc and not c89 (= MSVC++)
-    with_gnu_ld=yes
-    ;;
-  openbsd*)
-    with_gnu_ld=no
-    ;;
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
   esac
+fi
 
-  ld_shlibs_F77=yes
-  if test "$with_gnu_ld" = yes; then
-    # If archive_cmds runs LD, not CC, wlarc should be empty
-    wlarc='${wl}'
 
-    # Set some defaults for GNU ld with shared library support. These
-    # are reset later if shared libraries are not supported. Putting them
-    # here allows them to be overridden if necessary.
-    runpath_var=LD_RUN_PATH
-    hardcode_libdir_flag_spec_F77='${wl}--rpath ${wl}$libdir'
-    export_dynamic_flag_spec_F77='${wl}--export-dynamic'
-    # ancient GNU ld didn't support --whole-archive et. al.
-    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
-	whole_archive_flag_spec_F77="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-      else
-  	whole_archive_flag_spec_F77=
-    fi
-    supports_anon_versioning=no
-    case `$LD -v 2>/dev/null` in
-      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
-      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
-      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
-      *\ 2.11.*) ;; # other 2.11 versions
-      *) supports_anon_versioning=yes ;;
-    esac
 
-    # See if GNU ld supports shared libraries.
-    case $host_os in
-    aix[3-9]*)
-      # On AIX/PPC, the GNU linker is very broken
-      if test "$host_cpu" != ia64; then
-	ld_shlibs_F77=no
-	cat <<EOF 1>&2
 
-*** Warning: the GNU linker, at least up to release 2.9.1, is reported
-*** to be unable to reliably create shared libraries on AIX.
-*** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to modify your PATH
-*** so that a non-GNU linker is found, and then restart.
 
-EOF
-      fi
-      ;;
 
-    amigaos*)
-      archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-      hardcode_libdir_flag_spec_F77='-L$libdir'
-      hardcode_minus_L_F77=yes
-
-      # Samuel A. Falvo II <kc5tja at dolphin.openprojects.net> reports
-      # that the semantics of dynamic libraries on AmigaOS, at least up
-      # to version 4, is to share data among multiple programs linked
-      # with the same dynamic library.  Since this doesn't match the
-      # behavior of shared libraries on other platforms, we can't use
-      # them.
-      ld_shlibs_F77=no
-      ;;
 
-    beos*)
-      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-	allow_undefined_flag_F77=unsupported
-	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
-	# support --undefined.  This deserves some investigation.  FIXME
-	archive_cmds_F77='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-      else
-	ld_shlibs_F77=no
-      fi
-      ;;
 
-    cygwin* | mingw* | pw32*)
-      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless,
-      # as there is no search path for DLLs.
-      hardcode_libdir_flag_spec_F77='-L$libdir'
-      allow_undefined_flag_F77=unsupported
-      always_export_symbols_F77=no
-      enable_shared_with_static_runtimes_F77=yes
-      export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
-
-      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
-        archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	# If the export-symbols file already is a .def file (1st line
-	# is EXPORTS), use it as is; otherwise, prepend...
-	archive_expsym_cmds_F77='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	  cp $export_symbols $output_objdir/$soname.def;
-	else
-	  echo EXPORTS > $output_objdir/$soname.def;
-	  cat $export_symbols >> $output_objdir/$soname.def;
-	fi~
-	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-      else
-	ld_shlibs_F77=no
-      fi
-      ;;
 
-    interix[3-9]*)
-      hardcode_direct_F77=no
-      hardcode_shlibpath_var_F77=no
-      hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
-      export_dynamic_flag_spec_F77='${wl}-E'
-      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
-      # Instead, shared libraries are loaded at an image base (0x10000000 by
-      # default) and relocated if they conflict, which is a slow very memory
-      # consuming and fragmenting process.  To avoid this, we pick a random,
-      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
-      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
-      archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      ;;
 
-    gnu* | linux* | k*bsd*-gnu)
-      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-	tmp_addflag=
-	case $cc_basename,$host_cpu in
-	pgcc*)				# Portland Group C compiler
-	  whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_addflag=' $pic_flag'
-	  ;;
-	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
-	  whole_archive_flag_spec_F77='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_addflag=' $pic_flag -Mnomain' ;;
-	ecc*,ia64* | icc*,ia64*)		# Intel C compiler on ia64
-	  tmp_addflag=' -i_dynamic' ;;
-	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
-	  tmp_addflag=' -i_dynamic -nofor_main' ;;
-	ifc* | ifort*)			# Intel Fortran compiler
-	  tmp_addflag=' -nofor_main' ;;
-	esac
-	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)			# Sun C 5.9
-	  whole_archive_flag_spec_F77='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_sharedflag='-G' ;;
-	*Sun\ F*)			# Sun Fortran 8.3
-	  tmp_sharedflag='-G' ;;
-	*)
-	  tmp_sharedflag='-shared' ;;
-	esac
-	archive_cmds_F77='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
 
-	if test $supports_anon_versioning = yes; then
-	  archive_expsym_cmds_F77='$echo "{ global:" > $output_objdir/$libname.ver~
-  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-  $echo "local: *; };" >> $output_objdir/$libname.ver~
-	  $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
-	fi
-	link_all_deplibs_F77=no
-      else
-	ld_shlibs_F77=no
-      fi
-      ;;
 
-    netbsd* | netbsdelf*-gnu)
-      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
-	archive_cmds_F77='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
-	wlarc=
-      else
-	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      fi
-      ;;
 
-    solaris*)
-      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
-	ld_shlibs_F77=no
-	cat <<EOF 1>&2
 
-*** Warning: The releases 2.8.* of the GNU linker cannot reliably
-*** create shared libraries on Solaris systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.9.1 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
-
-EOF
-      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      else
-	ld_shlibs_F77=no
-      fi
-      ;;
-
-    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
-      case `$LD -v 2>&1` in
-        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
-	ld_shlibs_F77=no
-	cat <<_LT_EOF 1>&2
-
-*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
-*** reliably create shared libraries on SCO systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
-
-_LT_EOF
-	;;
-	*)
-	  if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-	    hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
-	    archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
-	    archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
-	  else
-	    ld_shlibs_F77=no
-	  fi
-	;;
-      esac
-      ;;
 
-    sunos4*)
-      archive_cmds_F77='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      wlarc=
-      hardcode_direct_F77=yes
-      hardcode_shlibpath_var_F77=no
-      ;;
 
-    *)
-      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      else
-	ld_shlibs_F77=no
-      fi
-      ;;
-    esac
 
-    if test "$ld_shlibs_F77" = no; then
-      runpath_var=
-      hardcode_libdir_flag_spec_F77=
-      export_dynamic_flag_spec_F77=
-      whole_archive_flag_spec_F77=
+striplib=
+old_striplib=
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+  darwin*)
+    if test -n "$STRIP" ; then
+      striplib="$STRIP -x"
+      old_striplib="$STRIP -S"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
     fi
-  else
-    # PORTME fill in a description of your system's linker (not GNU ld)
-    case $host_os in
-    aix3*)
-      allow_undefined_flag_F77=unsupported
-      always_export_symbols_F77=yes
-      archive_expsym_cmds_F77='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
-      # Note: this linker hardcodes the directories in LIBPATH if there
-      # are no directories specified by -L.
-      hardcode_minus_L_F77=yes
-      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
-	# Neither direct hardcoding nor static linking is supported with a
-	# broken collect2.
-	hardcode_direct_F77=unsupported
-      fi
-      ;;
-
-    aix[4-9]*)
-      if test "$host_cpu" = ia64; then
-	# On IA64, the linker does run time linking by default, so we don't
-	# have to do anything special.
-	aix_use_runtimelinking=no
-	exp_sym_flag='-Bexport'
-	no_entry_flag=""
-      else
-	# If we're using GNU nm, then we don't want the "-C" option.
-	# -C means demangle to AIX nm, but means don't demangle with GNU nm
-	if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
-	  export_symbols_cmds_F77='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
-	else
-	  export_symbols_cmds_F77='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
-	fi
-	aix_use_runtimelinking=no
+    ;;
+  *)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+    ;;
+  esac
+fi
 
-	# Test if we are trying to use run time linking or normal
-	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
-	# need to do runtime linking.
-	case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
-	  for ld_flag in $LDFLAGS; do
-  	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
-  	    aix_use_runtimelinking=yes
-  	    break
-  	  fi
-	  done
-	  ;;
-	esac
 
-	exp_sym_flag='-bexport'
-	no_entry_flag='-bnoentry'
-      fi
 
-      # When large executables or shared objects are built, AIX ld can
-      # have problems creating the table of contents.  If linking a library
-      # or program results in "error TOC overflow" add -mminimal-toc to
-      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
-      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
 
-      archive_cmds_F77=''
-      hardcode_direct_F77=yes
-      hardcode_libdir_separator_F77=':'
-      link_all_deplibs_F77=yes
 
-      if test "$GCC" = yes; then
-	case $host_os in aix4.[012]|aix4.[012].*)
-	# We only want to do this on AIX 4.2 and lower, the check
-	# below for broken collect2 doesn't work under 4.3+
-	  collect2name=`${CC} -print-prog-name=collect2`
-	  if test -f "$collect2name" && \
-  	   strings "$collect2name" | grep resolve_lib_name >/dev/null
-	  then
-  	  # We have reworked collect2
-  	  :
-	  else
-  	  # We have old collect2
-  	  hardcode_direct_F77=unsupported
-  	  # It fails to find uninstalled libraries when the uninstalled
-  	  # path is not listed in the libpath.  Setting hardcode_minus_L
-  	  # to unsupported forces relinking
-  	  hardcode_minus_L_F77=yes
-  	  hardcode_libdir_flag_spec_F77='-L$libdir'
-  	  hardcode_libdir_separator_F77=
-	  fi
-	  ;;
-	esac
-	shared_flag='-shared'
-	if test "$aix_use_runtimelinking" = yes; then
-	  shared_flag="$shared_flag "'${wl}-G'
-	fi
-      else
-	# not using gcc
-	if test "$host_cpu" = ia64; then
-  	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
-  	# chokes on -Wl,-G. The following line is correct:
-	  shared_flag='-G'
-	else
-	  if test "$aix_use_runtimelinking" = yes; then
-	    shared_flag='${wl}-G'
-	  else
-	    shared_flag='${wl}-bM:SRE'
-	  fi
-	fi
-      fi
 
-      # It seems that -bexpall does not export symbols beginning with
-      # underscore (_), so it is better to generate a list of symbols to export.
-      always_export_symbols_F77=yes
-      if test "$aix_use_runtimelinking" = yes; then
-	# Warning - without using the other runtime loading flags (-brtl),
-	# -berok will link without error, but may produce a broken library.
-	allow_undefined_flag_F77='-berok'
-       # Determine the default libpath from the value encoded in an empty executable.
-       cat >conftest.$ac_ext <<_ACEOF
-      program main
 
-      end
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_f77_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
 
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
-       hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath"
-	archive_expsym_cmds_F77="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
-       else
-	if test "$host_cpu" = ia64; then
-	  hardcode_libdir_flag_spec_F77='${wl}-R $libdir:/usr/lib:/lib'
-	  allow_undefined_flag_F77="-z nodefs"
-	  archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
-	else
-	 # Determine the default libpath from the value encoded in an empty executable.
-	 cat >conftest.$ac_ext <<_ACEOF
-      program main
 
-      end
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_f77_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  # Report which library types will actually be built
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
 
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
+  test "$can_build_shared" = "no" && enable_shared=no
 
-fi
+  # On AIX, shared libraries and static libraries use the same namespace, and
+  # are all built from PIC.
+  case $host_os in
+  aix3*)
+    test "$enable_shared" = yes && enable_static=no
+    if test -n "$RANLIB"; then
+      archive_cmds="$archive_cmds~\$RANLIB \$lib"
+      postinstall_cmds='$RANLIB $lib'
+    fi
+    ;;
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+  aix[4-9]*)
+    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+      test "$enable_shared" = yes && enable_static=no
+    fi
+    ;;
+  esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
 
-	 hardcode_libdir_flag_spec_F77='${wl}-blibpath:$libdir:'"$aix_libpath"
-	  # Warning - without using the other run time loading flags,
-	  # -berok will link without error, but may produce a broken library.
-	  no_undefined_flag_F77=' ${wl}-bernotok'
-	  allow_undefined_flag_F77=' ${wl}-berok'
-	  # Exported symbols can be pulled into shared objects from archives
-	  whole_archive_flag_spec_F77='$convenience'
-	  archive_cmds_need_lc_F77=yes
-	  # This is similar to how AIX traditionally builds its shared libraries.
-	  archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
-	fi
-      fi
-      ;;
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
+  # Make sure either enable_shared or enable_static is yes.
+  test "$enable_shared" = yes || enable_static=yes
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
 
-    amigaos*)
-      archive_cmds_F77='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-      hardcode_libdir_flag_spec_F77='-L$libdir'
-      hardcode_minus_L_F77=yes
-      # see comment about different semantics on the GNU ld section
-      ld_shlibs_F77=no
-      ;;
 
-    bsdi[45]*)
-      export_dynamic_flag_spec_F77=-rdynamic
-      ;;
 
-    cygwin* | mingw* | pw32*)
-      # When not using gcc, we currently assume that we are using
-      # Microsoft Visual C++.
-      # hardcode_libdir_flag_spec is actually meaningless, as there is
-      # no search path for DLLs.
-      hardcode_libdir_flag_spec_F77=' '
-      allow_undefined_flag_F77=unsupported
-      # Tell ltmain to make .lib files, not .a files.
-      libext=lib
-      # Tell ltmain to make .dll files, not .so files.
-      shrext_cmds=".dll"
-      # FIXME: Setting linknames here is a bad hack.
-      archive_cmds_F77='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
-      # The linker will automatically build a .lib file if we build a DLL.
-      old_archive_From_new_cmds_F77='true'
-      # FIXME: Should let the user specify the lib program.
-      old_archive_cmds_F77='lib -OUT:$oldlib$oldobjs$old_deplibs'
-      fix_srcfile_path_F77='`cygpath -w "$srcfile"`'
-      enable_shared_with_static_runtimes_F77=yes
-      ;;
 
-    darwin* | rhapsody*)
-      case $host_os in
-        rhapsody* | darwin1.[012])
-         allow_undefined_flag_F77='${wl}-undefined ${wl}suppress'
-         ;;
-       *) # Darwin 1.3 on
-         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
-           allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
-         else
-           case ${MACOSX_DEPLOYMENT_TARGET} in
-             10.[012])
-               allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
-               ;;
-             10.*)
-               allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup'
-               ;;
-           esac
-         fi
-         ;;
-      esac
-      archive_cmds_need_lc_F77=no
-      hardcode_direct_F77=no
-      hardcode_automatic_F77=yes
-      hardcode_shlibpath_var_F77=unsupported
-      whole_archive_flag_spec_F77=''
-      link_all_deplibs_F77=yes
-    if test "$GCC" = yes ; then
-    	output_verbose_link_cmd='echo'
-        archive_cmds_F77="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
-        module_cmds_F77="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-        archive_expsym_cmds_F77="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
-        module_expsym_cmds_F77="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
-    else
-      case $cc_basename in
-        xlc*)
-         output_verbose_link_cmd='echo'
-         archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
-         module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
-          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
-         archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-          module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-          ;;
-       *)
-         ld_shlibs_F77=no
-          ;;
-      esac
-    fi
-      ;;
+fi
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
-    dgux*)
-      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_libdir_flag_spec_F77='-L$libdir'
-      hardcode_shlibpath_var_F77=no
-      ;;
+CC="$lt_save_CC"
 
-    freebsd1*)
-      ld_shlibs_F77=no
-      ;;
+      if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5
+$as_echo_n "checking how to run the C++ preprocessor... " >&6; }
+if test -z "$CXXCPP"; then
+  if ${ac_cv_prog_CXXCPP+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+      # Double quotes because CXXCPP needs to be expanded
+    for CXXCPP in "$CXX -E" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
 
-    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
-    # support.  Future versions do this automatically, but an explicit c++rt0.o
-    # does not break anything, and helps significantly (at the cost of a little
-    # extra space).
-    freebsd2.2*)
-      archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
-      hardcode_libdir_flag_spec_F77='-R$libdir'
-      hardcode_direct_F77=yes
-      hardcode_shlibpath_var_F77=no
-      ;;
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
 
-    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2*)
-      archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_direct_F77=yes
-      hardcode_minus_L_F77=yes
-      hardcode_shlibpath_var_F77=no
-      ;;
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
 
-    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd* | dragonfly*)
-      archive_cmds_F77='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
-      hardcode_libdir_flag_spec_F77='-R$libdir'
-      hardcode_direct_F77=yes
-      hardcode_shlibpath_var_F77=no
-      ;;
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+  break
+fi
 
-    hpux9*)
-      if test "$GCC" = yes; then
-	archive_cmds_F77='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      else
-	archive_cmds_F77='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      fi
-      hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
-      hardcode_libdir_separator_F77=:
-      hardcode_direct_F77=yes
-
-      # hardcode_minus_L: Not really in the search PATH,
-      # but as the default location of the library.
-      hardcode_minus_L_F77=yes
-      export_dynamic_flag_spec_F77='${wl}-E'
-      ;;
+    done
+    ac_cv_prog_CXXCPP=$CXXCPP
 
-    hpux10*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
-      fi
-      if test "$with_gnu_ld" = no; then
-	hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
-	hardcode_libdir_separator_F77=:
+fi
+  CXXCPP=$ac_cv_prog_CXXCPP
+else
+  ac_cv_prog_CXXCPP=$CXXCPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5
+$as_echo "$CXXCPP" >&6; }
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
 
-	hardcode_direct_F77=yes
-	export_dynamic_flag_spec_F77='${wl}-E'
+else
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
 
-	# hardcode_minus_L: Not really in the search PATH,
-	# but as the default location of the library.
-	hardcode_minus_L_F77=yes
-      fi
-      ;;
+  # OK, works on sane cases.  Now check whether nonexistent headers
+  # can be detected and how.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+  # Broken: success on invalid input.
+continue
+else
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
 
-    hpux11*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	case $host_cpu in
-	hppa*64*)
-	  archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	ia64*)
-	  archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	  archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	esac
-      else
-	case $host_cpu in
-	hppa*64*)
-	  archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	ia64*)
-	  archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	  archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	esac
-      fi
-      if test "$with_gnu_ld" = no; then
-	hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
-	hardcode_libdir_separator_F77=:
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
 
-	case $host_cpu in
-	hppa*64*|ia64*)
-	  hardcode_libdir_flag_spec_ld_F77='+b $libdir'
-	  hardcode_direct_F77=no
-	  hardcode_shlibpath_var_F77=no
-	  ;;
-	*)
-	  hardcode_direct_F77=yes
-	  export_dynamic_flag_spec_F77='${wl}-E'
+else
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
 
-	  # hardcode_minus_L: Not really in the search PATH,
-	  # but as the default location of the library.
-	  hardcode_minus_L_F77=yes
-	  ;;
-	esac
-      fi
-      ;;
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
-    irix5* | irix6* | nonstopux*)
-      if test "$GCC" = yes; then
-	archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-      else
-	archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-	hardcode_libdir_flag_spec_ld_F77='-rpath $libdir'
-      fi
-      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
-      hardcode_libdir_separator_F77=:
-      link_all_deplibs_F77=yes
-      ;;
+else
+  _lt_caught_CXX_error=yes
+fi
 
-    netbsd* | netbsdelf*-gnu)
-      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
-	archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
-      else
-	archive_cmds_F77='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
-      fi
-      hardcode_libdir_flag_spec_F77='-R$libdir'
-      hardcode_direct_F77=yes
-      hardcode_shlibpath_var_F77=no
-      ;;
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
-    newsos6)
-      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_direct_F77=yes
-      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
-      hardcode_libdir_separator_F77=:
-      hardcode_shlibpath_var_F77=no
-      ;;
+archive_cmds_need_lc_CXX=no
+allow_undefined_flag_CXX=
+always_export_symbols_CXX=no
+archive_expsym_cmds_CXX=
+compiler_needs_object_CXX=no
+export_dynamic_flag_spec_CXX=
+hardcode_direct_CXX=no
+hardcode_direct_absolute_CXX=no
+hardcode_libdir_flag_spec_CXX=
+hardcode_libdir_flag_spec_ld_CXX=
+hardcode_libdir_separator_CXX=
+hardcode_minus_L_CXX=no
+hardcode_shlibpath_var_CXX=unsupported
+hardcode_automatic_CXX=no
+inherit_rpath_CXX=no
+module_cmds_CXX=
+module_expsym_cmds_CXX=
+link_all_deplibs_CXX=unknown
+old_archive_cmds_CXX=$old_archive_cmds
+reload_flag_CXX=$reload_flag
+reload_cmds_CXX=$reload_cmds
+no_undefined_flag_CXX=
+whole_archive_flag_spec_CXX=
+enable_shared_with_static_runtimes_CXX=no
 
-    openbsd*)
-      if test -f /usr/libexec/ld.so; then
-	hardcode_direct_F77=yes
-	hardcode_shlibpath_var_F77=no
-	if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	  archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	  archive_expsym_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
-	  hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
-	  export_dynamic_flag_spec_F77='${wl}-E'
-	else
-	  case $host_os in
-	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
-	     archive_cmds_F77='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-	     hardcode_libdir_flag_spec_F77='-R$libdir'
-	     ;;
-	   *)
-	     archive_cmds_F77='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	     hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
-	     ;;
-	  esac
-        fi
-      else
-	ld_shlibs_F77=no
-      fi
-      ;;
+# Source file extension for C++ test sources.
+ac_ext=cpp
 
-    os2*)
-      hardcode_libdir_flag_spec_F77='-L$libdir'
-      hardcode_minus_L_F77=yes
-      allow_undefined_flag_F77=unsupported
-      archive_cmds_F77='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
-      old_archive_From_new_cmds_F77='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
-      ;;
+# Object file extension for compiled C++ test sources.
+objext=o
+objext_CXX=$objext
 
-    osf3*)
-      if test "$GCC" = yes; then
-	allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-      else
-	allow_undefined_flag_F77=' -expect_unresolved \*'
-	archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-      fi
-      hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
-      hardcode_libdir_separator_F77=:
-      ;;
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="int some_variable = 0;"
 
-    osf4* | osf5*)	# as osf3* with the addition of -msym flag
-      if test "$GCC" = yes; then
-	allow_undefined_flag_F77=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds_F77='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
-      else
-	allow_undefined_flag_F77=' -expect_unresolved \*'
-	archive_cmds_F77='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-	archive_expsym_cmds_F77='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
-	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
+  # Code to be used in simple link tests
+  lt_simple_link_test_code='int main(int, char *[]) { return(0); }'
 
-	# Both c and cxx compiler support -rpath directly
-	hardcode_libdir_flag_spec_F77='-rpath $libdir'
-      fi
-      hardcode_libdir_separator_F77=:
-      ;;
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
 
-    solaris*)
-      no_undefined_flag_F77=' -z text'
-      if test "$GCC" = yes; then
-	wlarc='${wl}'
-	archive_cmds_F77='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-	  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
-      else
-	wlarc=''
-	archive_cmds_F77='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	archive_expsym_cmds_F77='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-  	$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
-      fi
-      hardcode_libdir_flag_spec_F77='-R$libdir'
-      hardcode_shlibpath_var_F77=no
-      case $host_os in
-      solaris2.[0-5] | solaris2.[0-5].*) ;;
-      *)
-	# The compiler driver will combine and reorder linker options,
-	# but understands `-z linker_flag'.  GCC discards it without `$wl',
-	# but is careful enough not to reorder.
- 	# Supported since Solaris 2.6 (maybe 2.5.1?)
-	if test "$GCC" = yes; then
-	  whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
-	else
-	  whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract'
-	fi
-	;;
-      esac
-      link_all_deplibs_F77=yes
-      ;;
 
-    sunos4*)
-      if test "x$host_vendor" = xsequent; then
-	# Use $CC to link under sequent, because it throws in some extra .o
-	# files that make .init and .fini sections work.
-	archive_cmds_F77='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	archive_cmds_F77='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
-      fi
-      hardcode_libdir_flag_spec_F77='-L$libdir'
-      hardcode_direct_F77=yes
-      hardcode_minus_L_F77=yes
-      hardcode_shlibpath_var_F77=no
-      ;;
 
-    sysv4)
-      case $host_vendor in
-	sni)
-	  archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  hardcode_direct_F77=yes # is this really true???
-	;;
-	siemens)
-	  ## LD is ld it makes a PLAMLIB
-	  ## CC just makes a GrossModule.
-	  archive_cmds_F77='$LD -G -o $lib $libobjs $deplibs $linker_flags'
-	  reload_cmds_F77='$CC -r -o $output$reload_objs'
-	  hardcode_direct_F77=no
-        ;;
-	motorola)
-	  archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  hardcode_direct_F77=no #Motorola manual says yes, but my tests say they lie
-	;;
-      esac
-      runpath_var='LD_RUN_PATH'
-      hardcode_shlibpath_var_F77=no
-      ;;
 
-    sysv4.3*)
-      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_shlibpath_var_F77=no
-      export_dynamic_flag_spec_F77='-Bexport'
-      ;;
 
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	hardcode_shlibpath_var_F77=no
-	runpath_var=LD_RUN_PATH
-	hardcode_runpath_var=yes
-	ld_shlibs_F77=yes
-      fi
-      ;;
 
-    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
-      no_undefined_flag_F77='${wl}-z,text'
-      archive_cmds_need_lc_F77=no
-      hardcode_shlibpath_var_F77=no
-      runpath_var='LD_RUN_PATH'
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
 
-      if test "$GCC" = yes; then
-	archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      fi
-      ;;
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
 
-    sysv5* | sco3.2v5* | sco5v6*)
-      # Note: We can NOT use -z defs as we might desire, because we do not
-      # link with -lc, and that would cause any symbols used from libc to
-      # always be unresolved, which means just about no library would
-      # ever link correctly.  If we're not using GNU ld we use -z text
-      # though, which does catch some bad symbols but isn't as heavy-handed
-      # as -z defs.
-      no_undefined_flag_F77='${wl}-z,text'
-      allow_undefined_flag_F77='${wl}-z,nodefs'
-      archive_cmds_need_lc_F77=no
-      hardcode_shlibpath_var_F77=no
-      hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
-      hardcode_libdir_separator_F77=':'
-      link_all_deplibs_F77=yes
-      export_dynamic_flag_spec_F77='${wl}-Bexport'
-      runpath_var='LD_RUN_PATH'
+# Allow CC to be a program name with arguments.
+compiler=$CC
 
-      if test "$GCC" = yes; then
-	archive_cmds_F77='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	archive_cmds_F77='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-      fi
-      ;;
 
-    uts4*)
-      archive_cmds_F77='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_libdir_flag_spec_F77='-L$libdir'
-      hardcode_shlibpath_var_F77=no
-      ;;
+  # save warnings/boilerplate of simple test code
+  ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
 
-    *)
-      ld_shlibs_F77=no
-      ;;
-    esac
+  ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC=$CC
+  lt_save_CFLAGS=$CFLAGS
+  lt_save_LD=$LD
+  lt_save_GCC=$GCC
+  GCC=$GXX
+  lt_save_with_gnu_ld=$with_gnu_ld
+  lt_save_path_LD=$lt_cv_path_LD
+  if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+  else
+    $as_unset lt_cv_prog_gnu_ld
+  fi
+  if test -n "${lt_cv_path_LDCXX+set}"; then
+    lt_cv_path_LD=$lt_cv_path_LDCXX
+  else
+    $as_unset lt_cv_path_LD
   fi
+  test -z "${LDCXX+set}" || LD=$LDCXX
+  CC=${CXX-"c++"}
+  CFLAGS=$CXXFLAGS
+  compiler=$CC
+  compiler_CXX=$CC
+  for cc_temp in $compiler""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
 
-{ echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5
-echo "${ECHO_T}$ld_shlibs_F77" >&6; }
-test "$ld_shlibs_F77" = no && can_build_shared=no
 
-#
-# Do we need to explicitly link libc?
-#
-case "x$archive_cmds_need_lc_F77" in
-x|xyes)
-  # Assume -lc should be added
-  archive_cmds_need_lc_F77=yes
+  if test -n "$compiler"; then
+    # We don't want -fno-exception when compiling C++ code, so set the
+    # no_builtin_flag separately
+    if test "$GXX" = yes; then
+      lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
+    else
+      lt_prog_compiler_no_builtin_flag_CXX=
+    fi
 
-  if test "$enable_shared" = yes && test "$GCC" = yes; then
-    case $archive_cmds_F77 in
-    *'~'*)
-      # FIXME: we may have to deal with multi-command sequences.
-      ;;
-    '$CC '*)
-      # Test whether the compiler implicitly links with -lc since on some
-      # systems, -lgcc has to come before -lc. If gcc already passes -lc
-      # to ld, don't add -lc before -lgcc.
-      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
-echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
-      $rm conftest*
-      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+    if test "$GXX" = yes; then
+      # Set up default GNU C++ configuration
 
-      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } 2>conftest.err; then
-        soname=conftest
-        lib=conftest
-        libobjs=conftest.$ac_objext
-        deplibs=
-        wl=$lt_prog_compiler_wl_F77
-	pic_flag=$lt_prog_compiler_pic_F77
-        compiler_flags=-v
-        linker_flags=-v
-        verstring=
-        output_objdir=.
-        libname=conftest
-        lt_save_allow_undefined_flag=$allow_undefined_flag_F77
-        allow_undefined_flag_F77=
-        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
-  (eval $archive_cmds_F77 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-        then
-	  archive_cmds_need_lc_F77=no
-        else
-	  archive_cmds_need_lc_F77=yes
-        fi
-        allow_undefined_flag_F77=$lt_save_allow_undefined_flag
-      else
-        cat conftest.err 1>&5
-      fi
-      $rm conftest*
-      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5
-echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6; }
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+  withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+  with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [\\/]* | ?:[\\/]*)
+      re_direlt='/[^/][^/]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
       ;;
-    esac
-  fi
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if ${lt_cv_path_LD+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if ${lt_cv_prog_gnu_ld+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
   ;;
 esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
 
-{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
-echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
-library_names_spec=
-libname_spec='lib$name'
-soname_spec=
-shrext_cmds=".so"
-postinstall_cmds=
-postuninstall_cmds=
-finish_cmds=
-finish_eval=
-shlibpath_var=
-shlibpath_overrides_runpath=unknown
-version_type=none
-dynamic_linker="$host_os ld.so"
-sys_lib_dlsearch_path_spec="/lib /usr/lib"
 
-need_lib_prefix=unknown
-hardcode_into_libs=no
 
-# when you set need_version to no, make sure it does not cause -set_version
-# flags to be left without arguments
-need_version=unknown
 
-case $host_os in
-aix3*)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
-  shlibpath_var=LIBPATH
 
-  # AIX 3 has no versioning support, so we append a major version to the name.
-  soname_spec='${libname}${release}${shared_ext}$major'
-  ;;
 
-aix[4-9]*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  hardcode_into_libs=yes
-  if test "$host_cpu" = ia64; then
-    # AIX 5 supports IA64
-    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
-    shlibpath_var=LD_LIBRARY_PATH
-  else
-    # With GCC up to 2.95.x, collect2 would create an import file
-    # for dependence libraries.  The import file would start with
-    # the line `#! .'.  This would cause the generated library to
-    # depend on `.', always an invalid library.  This was fixed in
-    # development snapshots of GCC prior to 3.0.
-    case $host_os in
-      aix4 | aix4.[01] | aix4.[01].*)
-      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
-	   echo ' yes '
-	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
-	:
+
+      # Check if GNU C++ uses GNU ld as the underlying linker, since the
+      # archiving commands below assume that GNU ld is being used.
+      if test "$with_gnu_ld" = yes; then
+        archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+        export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+        # If archive_cmds runs LD, not CC, wlarc should be empty
+        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+        #     investigate it a little bit more. (MM)
+        wlarc='${wl}'
+
+        # ancient GNU ld didn't support --whole-archive et. al.
+        if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+	  $GREP 'no-whole-archive' > /dev/null; then
+          whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+        else
+          whole_archive_flag_spec_CXX=
+        fi
       else
-	can_build_shared=no
+        with_gnu_ld=no
+        wlarc=
+
+        # A generic and very simple default shared library creation
+        # command for GNU C++ for the case where it uses the native
+        # linker, instead of GNU ld.  If possible, this setting should
+        # overridden to take advantage of the native linker features on
+        # the platform it is being used on.
+        archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
       fi
-      ;;
-    esac
-    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
-    # soname into executable. Probably we can add versioning support to
-    # collect2, so additional links can be useful in future.
-    if test "$aix_use_runtimelinking" = yes; then
-      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
-      # instead of lib<name>.a to let people know that these are not
-      # typical AIX shared libraries.
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
     else
-      # We preserve .a as extension for shared libraries through AIX4.2
-      # and later when we are not doing run time linking.
-      library_names_spec='${libname}${release}.a $libname.a'
-      soname_spec='${libname}${release}${shared_ext}$major'
+      GXX=no
+      with_gnu_ld=no
+      wlarc=
     fi
-    shlibpath_var=LIBPATH
-  fi
-  ;;
-
-amigaos*)
-  library_names_spec='$libname.ixlibrary $libname.a'
-  # Create ${libname}_ixlibrary.a entries in /sys/libs.
-  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
-  ;;
 
-beos*)
-  library_names_spec='${libname}${shared_ext}'
-  dynamic_linker="$host_os ld.so"
-  shlibpath_var=LIBRARY_PATH
-  ;;
+    # PORTME: fill in a description of your system's C++ link characteristics
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+    ld_shlibs_CXX=yes
+    case $host_os in
+      aix3*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+      aix[4-9]*)
+        if test "$host_cpu" = ia64; then
+          # On IA64, the linker does run time linking by default, so we don't
+          # have to do anything special.
+          aix_use_runtimelinking=no
+          exp_sym_flag='-Bexport'
+          no_entry_flag=""
+        else
+          aix_use_runtimelinking=no
+
+          # Test if we are trying to use run time linking or normal
+          # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+          # need to do runtime linking.
+          case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+	    for ld_flag in $LDFLAGS; do
+	      case $ld_flag in
+	      *-brtl*)
+	        aix_use_runtimelinking=yes
+	        break
+	        ;;
+	      esac
+	    done
+	    ;;
+          esac
 
-bsdi[45]*)
-  version_type=linux
-  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'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
-  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
-  # the default ld.so.conf also contains /usr/contrib/lib and
-  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
-  # libtool to hard-code these into programs
-  ;;
+          exp_sym_flag='-bexport'
+          no_entry_flag='-bnoentry'
+        fi
 
-cygwin* | mingw* | pw32*)
-  version_type=windows
-  shrext_cmds=".dll"
-  need_version=no
-  need_lib_prefix=no
+        # When large executables or shared objects are built, AIX ld can
+        # have problems creating the table of contents.  If linking a library
+        # or program results in "error TOC overflow" add -mminimal-toc to
+        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+        archive_cmds_CXX=''
+        hardcode_direct_CXX=yes
+        hardcode_direct_absolute_CXX=yes
+        hardcode_libdir_separator_CXX=':'
+        link_all_deplibs_CXX=yes
+        file_list_spec_CXX='${wl}-f,'
+
+        if test "$GXX" = yes; then
+          case $host_os in aix4.[012]|aix4.[012].*)
+          # We only want to do this on AIX 4.2 and lower, the check
+          # below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	     strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	    # We have reworked collect2
+	    :
+	  else
+	    # We have old collect2
+	    hardcode_direct_CXX=unsupported
+	    # It fails to find uninstalled libraries when the uninstalled
+	    # path is not listed in the libpath.  Setting hardcode_minus_L
+	    # to unsupported forces relinking
+	    hardcode_minus_L_CXX=yes
+	    hardcode_libdir_flag_spec_CXX='-L$libdir'
+	    hardcode_libdir_separator_CXX=
+	  fi
+          esac
+          shared_flag='-shared'
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag="$shared_flag "'${wl}-G'
+	  fi
+        else
+          # not using gcc
+          if test "$host_cpu" = ia64; then
+	  # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	  # chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+          else
+	    if test "$aix_use_runtimelinking" = yes; then
+	      shared_flag='${wl}-G'
+	    else
+	      shared_flag='${wl}-bM:SRE'
+	    fi
+          fi
+        fi
 
-  case $GCC,$host_os in
-  yes,cygwin* | yes,mingw* | yes,pw32*)
-    library_names_spec='$libname.dll.a'
-    # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
-      dldir=$destdir/`dirname \$dlpath`~
-      test -d \$dldir || mkdir -p \$dldir~
-      $install_prog $dir/$dlname \$dldir/$dlname~
-      chmod a+x \$dldir/$dlname'
-    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
-      dlpath=$dir/\$dldll~
-       $rm \$dlpath'
-    shlibpath_overrides_runpath=yes
+        export_dynamic_flag_spec_CXX='${wl}-bexpall'
+        # It seems that -bexpall does not export symbols beginning with
+        # underscore (_), so it is better to generate a list of symbols to
+	# export.
+        always_export_symbols_CXX=yes
+        if test "$aix_use_runtimelinking" = yes; then
+          # Warning - without using the other runtime loading flags (-brtl),
+          # -berok will link without error, but may produce a broken library.
+          allow_undefined_flag_CXX='-berok'
+          # Determine the default libpath from the value encoded in an empty
+          # executable.
+          if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath__CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-    case $host_os in
-    cygwin*)
-      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
-      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
-      ;;
-    mingw*)
-      # MinGW DLLs use traditional 'lib' prefix
-      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
-        # It is most probably a Windows format PATH printed by
-        # mingw gcc, but we are running on Cygwin. Gcc prints its search
-        # path with ; separators, and with drive letters. We can handle the
-        # drive letters (cygwin fileutils understands them), so leave them,
-        # especially as we might pass files found there to a mingw objdump,
-        # which wouldn't understand a cygwinified path. Ahh.
-        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-      else
-        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-      fi
-      ;;
-    pw32*)
-      # pw32 DLLs use 'pw' prefix rather than 'lib'
-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    esac
-    ;;
+int
+main ()
+{
 
-  *)
-    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
-    ;;
-  esac
-  dynamic_linker='Win32 ld.exe'
-  # FIXME: first we should search . and the directory the executable is in
-  shlibpath_var=PATH
-  ;;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
 
-darwin* | rhapsody*)
-  dynamic_linker="$host_os dyld"
-  version_type=darwin
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
-  soname_spec='${libname}${release}${major}$shared_ext'
-  shlibpath_overrides_runpath=yes
-  shlibpath_var=DYLD_LIBRARY_PATH
-  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath__CXX"; then
+    lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  if test -z "$lt_cv_aix_libpath__CXX"; then
+    lt_cv_aix_libpath__CXX="/usr/lib:/lib"
+  fi
 
-  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
-  ;;
+fi
 
-dgux*)
-  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
-  ;;
+  aix_libpath=$lt_cv_aix_libpath__CXX
+fi
 
-freebsd1*)
-  dynamic_linker=no
-  ;;
+          hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
 
-freebsd* | dragonfly*)
-  # DragonFly does not have aout.  When/if they implement a new
-  # versioning mechanism, adjust this.
-  if test -x /usr/bin/objformat; then
-    objformat=`/usr/bin/objformat`
-  else
-    case $host_os in
-    freebsd[123]*) objformat=aout ;;
-    *) objformat=elf ;;
-    esac
+          archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        else
+          if test "$host_cpu" = ia64; then
+	    hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib'
+	    allow_undefined_flag_CXX="-z nodefs"
+	    archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+          else
+	    # Determine the default libpath from the value encoded in an
+	    # empty executable.
+	    if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  if ${lt_cv_aix_libpath__CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+
+  lt_aix_libpath_sed='
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }'
+  lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$lt_cv_aix_libpath__CXX"; then
+    lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  if test -z "$lt_cv_aix_libpath__CXX"; then
+    lt_cv_aix_libpath__CXX="/usr/lib:/lib"
   fi
-  version_type=freebsd-$objformat
-  case $version_type in
-    freebsd-elf*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-      need_version=no
-      need_lib_prefix=no
-      ;;
-    freebsd-*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
-      need_version=yes
-      ;;
-  esac
-  shlibpath_var=LD_LIBRARY_PATH
-  case $host_os in
-  freebsd2*)
-    shlibpath_overrides_runpath=yes
-    ;;
-  freebsd3.[01]* | freebsdelf3.[01]*)
-    shlibpath_overrides_runpath=yes
-    hardcode_into_libs=yes
-    ;;
-  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
-  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
-    shlibpath_overrides_runpath=no
-    hardcode_into_libs=yes
-    ;;
-  *) # from 4.6 on, and DragonFly
-    shlibpath_overrides_runpath=yes
-    hardcode_into_libs=yes
-    ;;
-  esac
-  ;;
 
-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
-  hardcode_into_libs=yes
-  ;;
+fi
 
-hpux9* | hpux10* | hpux11*)
-  # Give a soname corresponding to the major version so that dld.sl refuses to
-  # link against other versions.
-  version_type=sunos
-  need_lib_prefix=no
-  need_version=no
-  case $host_cpu in
-  ia64*)
-    shrext_cmds='.so'
-    hardcode_into_libs=yes
-    dynamic_linker="$host_os dld.so"
-    shlibpath_var=LD_LIBRARY_PATH
-    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    if test "X$HPUX_IA64_MODE" = X32; then
-      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
-    else
-      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
-    fi
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
-    ;;
-   hppa*64*)
-     shrext_cmds='.sl'
-     hardcode_into_libs=yes
-     dynamic_linker="$host_os dld.sl"
-     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
-     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-     soname_spec='${libname}${release}${shared_ext}$major'
-     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
-     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
-     ;;
-   *)
-    shrext_cmds='.sl'
-    dynamic_linker="$host_os dld.sl"
-    shlibpath_var=SHLIB_PATH
-    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    ;;
-  esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555.
-  postinstall_cmds='chmod 555 $lib'
-  ;;
+  aix_libpath=$lt_cv_aix_libpath__CXX
+fi
 
-interix[3-9]*)
-  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'
-  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
+	    hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+	    # Warning - without using the other run time loading flags,
+	    # -berok will link without error, but may produce a broken library.
+	    no_undefined_flag_CXX=' ${wl}-bernotok'
+	    allow_undefined_flag_CXX=' ${wl}-berok'
+	    if test "$with_gnu_ld" = yes; then
+	      # We only use this code for GNU lds that support --whole-archive.
+	      whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    else
+	      # Exported symbols can be pulled into shared objects from archives
+	      whole_archive_flag_spec_CXX='$convenience'
+	    fi
+	    archive_cmds_need_lc_CXX=yes
+	    # This is similar to how AIX traditionally builds its shared
+	    # libraries.
+	    archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+          fi
+        fi
+        ;;
 
-irix5* | irix6* | nonstopux*)
-  case $host_os in
-    nonstopux*) version_type=nonstopux ;;
-    *)
-	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux
+      beos*)
+	if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	  allow_undefined_flag_CXX=unsupported
+	  # Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
+	  # support --undefined.  This deserves some investigation.  FIXME
+	  archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
 	else
-		version_type=irix
-	fi ;;
-  esac
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
-  case $host_os in
-  irix5* | nonstopux*)
-    libsuff= shlibsuff=
-    ;;
-  *)
-    case $LD in # libtool.m4 will add one of these switches to LD
-    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
-      libsuff= shlibsuff= libmagic=32-bit;;
-    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
-      libsuff=32 shlibsuff=N32 libmagic=N32;;
-    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
-      libsuff=64 shlibsuff=64 libmagic=64-bit;;
-    *) libsuff= shlibsuff= libmagic=never-match;;
-    esac
-    ;;
-  esac
-  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
-  shlibpath_overrides_runpath=no
-  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
-  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
-  hardcode_into_libs=yes
-  ;;
+	  ld_shlibs_CXX=no
+	fi
+	;;
 
-# No shared lib support for Linux oldld, aout, or coff.
-linux*oldld* | linux*aout* | linux*coff*)
-  dynamic_linker=no
-  ;;
+      chorus*)
+        case $cc_basename in
+          *)
+	  # FIXME: insert proper C++ library support
+	  ld_shlibs_CXX=no
+	  ;;
+        esac
+        ;;
 
-# This must be Linux ELF.
-linux* | k*bsd*-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'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  # This implies no fast_install, which is unacceptable.
-  # Some rework will be needed to allow for fast_install
-  # before this can be enabled.
-  hardcode_into_libs=yes
+      cygwin* | mingw* | pw32* | cegcc*)
+	case $GXX,$cc_basename in
+	,cl* | no,cl*)
+	  # Native MSVC
+	  # hardcode_libdir_flag_spec is actually meaningless, as there is
+	  # no search path for DLLs.
+	  hardcode_libdir_flag_spec_CXX=' '
+	  allow_undefined_flag_CXX=unsupported
+	  always_export_symbols_CXX=yes
+	  file_list_spec_CXX='@'
+	  # Tell ltmain to make .lib files, not .a files.
+	  libext=lib
+	  # Tell ltmain to make .dll files, not .so files.
+	  shrext_cmds=".dll"
+	  # FIXME: Setting linknames here is a bad hack.
+	  archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	  archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	      $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	    else
+	      $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	    fi~
+	    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	    linknames='
+	  # The linker will not automatically build a static lib if we build a DLL.
+	  # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true'
+	  enable_shared_with_static_runtimes_CXX=yes
+	  # Don't use ranlib
+	  old_postinstall_cmds_CXX='chmod 644 $oldlib'
+	  postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~
+	    lt_tool_outputfile="@TOOL_OUTPUT@"~
+	    case $lt_outputfile in
+	      *.exe|*.EXE) ;;
+	      *)
+		lt_outputfile="$lt_outputfile.exe"
+		lt_tool_outputfile="$lt_tool_outputfile.exe"
+		;;
+	    esac~
+	    func_to_tool_file "$lt_outputfile"~
+	    if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	      $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	      $RM "$lt_outputfile.manifest";
+	    fi'
+	  ;;
+	*)
+	  # g++
+	  # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
+	  # as there is no search path for DLLs.
+	  hardcode_libdir_flag_spec_CXX='-L$libdir'
+	  export_dynamic_flag_spec_CXX='${wl}--export-all-symbols'
+	  allow_undefined_flag_CXX=unsupported
+	  always_export_symbols_CXX=no
+	  enable_shared_with_static_runtimes_CXX=yes
+
+	  if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+	    archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	    # If the export-symbols file already is a .def file (1st line
+	    # is EXPORTS), use it as is; otherwise, prepend...
+	    archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	      cp $export_symbols $output_objdir/$soname.def;
+	    else
+	      echo EXPORTS > $output_objdir/$soname.def;
+	      cat $export_symbols >> $output_objdir/$soname.def;
+	    fi~
+	    $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	  else
+	    ld_shlibs_CXX=no
+	  fi
+	  ;;
+	esac
+	;;
+      darwin* | rhapsody*)
 
-  # Append ld.so.conf contents to the search path
-  if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+
+  archive_cmds_need_lc_CXX=no
+  hardcode_direct_CXX=no
+  hardcode_automatic_CXX=yes
+  hardcode_shlibpath_var_CXX=unsupported
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+  else
+    whole_archive_flag_spec_CXX=''
+  fi
+  link_all_deplibs_CXX=yes
+  allow_undefined_flag_CXX="$_lt_dar_allow_undefined"
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
+    output_verbose_link_cmd=func_echo_all
+    archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+    archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+    module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+       if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+      archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+      archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+    fi
+
+  else
+  ld_shlibs_CXX=no
   fi
 
-  # We used to test for /lib/ld.so.1 and disable shared libraries on
-  # powerpc, because MkLinux only supported shared libraries with the
-  # GNU dynamic linker.  Since this was broken with cross compilers,
-  # most powerpc-linux boxes support dynamic linking these days and
-  # people can always --disable-shared, the test was removed, and we
-  # assume the GNU/Linux dynamic linker is in use.
-  dynamic_linker='GNU/Linux ld.so'
-  ;;
+	;;
+
+      dgux*)
+        case $cc_basename in
+          ec++*)
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+          ghcx*)
+	    # Green Hills C++ Compiler
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+        esac
+        ;;
+
+      freebsd[12]*)
+        # C++ shared libraries reported to be fairly broken before
+	# switch to ELF
+        ld_shlibs_CXX=no
+        ;;
+
+      freebsd-elf*)
+        archive_cmds_need_lc_CXX=no
+        ;;
+
+      freebsd* | dragonfly*)
+        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+        # conventions
+        ld_shlibs_CXX=yes
+        ;;
+
+      gnu*)
+        ;;
+
+      haiku*)
+        archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        link_all_deplibs_CXX=yes
+        ;;
+
+      hpux9*)
+        hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+        hardcode_libdir_separator_CXX=:
+        export_dynamic_flag_spec_CXX='${wl}-E'
+        hardcode_direct_CXX=yes
+        hardcode_minus_L_CXX=yes # Not in the search PATH,
+				             # but as the default
+				             # location of the library.
+
+        case $cc_basename in
+          CC*)
+            # FIXME: insert proper C++ library support
+            ld_shlibs_CXX=no
+            ;;
+          aCC*)
+            archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            # Commands to make compiler produce verbose output that lists
+            # what "hidden" libraries, object files and flags are used when
+            # linking a shared library.
+            #
+            # There doesn't appear to be a way to prevent this compiler from
+            # explicitly linking system object files so we need to strip them
+            # from the output so that they don't get included in the library
+            # dependencies.
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+            ;;
+          *)
+            if test "$GXX" = yes; then
+              archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            else
+              # FIXME: insert proper C++ library support
+              ld_shlibs_CXX=no
+            fi
+            ;;
+        esac
+        ;;
+
+      hpux10*|hpux11*)
+        if test $with_gnu_ld = no; then
+	  hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+	  hardcode_libdir_separator_CXX=:
+
+          case $host_cpu in
+            hppa*64*|ia64*)
+              ;;
+            *)
+	      export_dynamic_flag_spec_CXX='${wl}-E'
+              ;;
+          esac
+        fi
+        case $host_cpu in
+          hppa*64*|ia64*)
+            hardcode_direct_CXX=no
+            hardcode_shlibpath_var_CXX=no
+            ;;
+          *)
+            hardcode_direct_CXX=yes
+            hardcode_direct_absolute_CXX=yes
+            hardcode_minus_L_CXX=yes # Not in the search PATH,
+					         # but as the default
+					         # location of the library.
+            ;;
+        esac
+
+        case $cc_basename in
+          CC*)
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+          aCC*)
+	    case $host_cpu in
+	      hppa*64*)
+	        archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	      ia64*)
+	        archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	      *)
+	        archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	    esac
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    ;;
+          *)
+	    if test "$GXX" = yes; then
+	      if test $with_gnu_ld = no; then
+	        case $host_cpu in
+	          hppa*64*)
+	            archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	          ia64*)
+	            archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	          *)
+	            archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	        esac
+	      fi
+	    else
+	      # FIXME: insert proper C++ library support
+	      ld_shlibs_CXX=no
+	    fi
+	    ;;
+        esac
+        ;;
+
+      interix[3-9]*)
+	hardcode_direct_CXX=no
+	hardcode_shlibpath_var_CXX=no
+	hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	export_dynamic_flag_spec_CXX='${wl}-E'
+	# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+	# Instead, shared libraries are loaded at an image base (0x10000000 by
+	# default) and relocated if they conflict, which is a slow very memory
+	# consuming and fragmenting process.  To avoid this, we pick a random,
+	# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+	# time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+	archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	;;
+      irix5* | irix6*)
+        case $cc_basename in
+          CC*)
+	    # SGI C++
+	    archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+	    # necessary to make sure instantiated templates are included
+	    # in the archive.
+	    old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'
+	    ;;
+          *)
+	    if test "$GXX" = yes; then
+	      if test "$with_gnu_ld" = no; then
+	        archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	      else
+	        archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
+	      fi
+	    fi
+	    link_all_deplibs_CXX=yes
+	    ;;
+        esac
+        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+        hardcode_libdir_separator_CXX=:
+        inherit_rpath_CXX=yes
+        ;;
+
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+        case $cc_basename in
+          KCC*)
+	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	    # KCC will only create a shared library if the output file
+	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+	    # to its proper name (with version) after linking.
+	    archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+	    archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+
+	    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	    old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+	    ;;
+	  icpc* | ecpc* )
+	    # Intel C++
+	    with_gnu_ld=yes
+	    # version 8.0 and above of icpc choke on multiply defined symbols
+	    # if we add $predep_objects and $postdep_objects, however 7.1 and
+	    # earlier do not add the objects themselves.
+	    case `$CC -V 2>&1` in
+	      *"Version 7."*)
+	        archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	      *)  # Version 8.0 or newer
+	        tmp_idyn=
+	        case $host_cpu in
+		  ia64*) tmp_idyn=' -i_dynamic';;
+		esac
+	        archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	    esac
+	    archive_cmds_need_lc_CXX=no
+	    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+	    whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    ;;
+          pgCC* | pgcpp*)
+            # Portland Group C++ compiler
+	    case `$CC -V` in
+	    *pgCC\ [1-5].* | *pgcpp\ [1-5].*)
+	      prelink_cmds_CXX='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+	      old_archive_cmds_CXX='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+		$RANLIB $oldlib'
+	      archive_cmds_CXX='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+	      archive_expsym_cmds_CXX='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+	      ;;
+	    *) # Version 6 and above use weak symbols
+	      archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+	      archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+	      ;;
+	    esac
+
+	    hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+	    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+	    whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+            ;;
+	  cxx*)
+	    # Compaq C++
+	    archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+	    runpath_var=LD_RUN_PATH
+	    hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+	    hardcode_libdir_separator_CXX=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
+	    ;;
+	  xl* | mpixl* | bgxl*)
+	    # IBM XL 8.0 on PPC, with GNU ld
+	    hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+	    export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+	    archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    if test "x$supports_anon_versioning" = xyes; then
+	      archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~
+		cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+		echo "local: *; };" >> $output_objdir/$libname.ver~
+		$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	    fi
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      no_undefined_flag_CXX=' -zdefs'
+	      archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+	      hardcode_libdir_flag_spec_CXX='-R$libdir'
+	      whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	      compiler_needs_object_CXX=yes
+
+	      # Not sure whether something based on
+	      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+	      # would be better.
+	      output_verbose_link_cmd='func_echo_all'
+
+	      # Archives containing C++ object files must be created using
+	      # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	      # necessary to make sure instantiated templates are included
+	      # in the archive.
+	      old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+
+      lynxos*)
+        # FIXME: insert proper C++ library support
+	ld_shlibs_CXX=no
+	;;
+
+      m88k*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+	;;
+
+      mvs*)
+        case $cc_basename in
+          cxx*)
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+	  *)
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+	esac
+	;;
+
+      netbsd*)
+        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	  archive_cmds_CXX='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+	  wlarc=
+	  hardcode_libdir_flag_spec_CXX='-R$libdir'
+	  hardcode_direct_CXX=yes
+	  hardcode_shlibpath_var_CXX=no
+	fi
+	# Workaround some broken pre-1.5 toolchains
+	output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+	;;
+
+      *nto* | *qnx*)
+        ld_shlibs_CXX=yes
+	;;
+
+      openbsd2*)
+        # C++ shared libraries are fairly broken
+	ld_shlibs_CXX=no
+	;;
+
+      openbsd*)
+	if test -f /usr/libexec/ld.so; then
+	  hardcode_direct_CXX=yes
+	  hardcode_shlibpath_var_CXX=no
+	  hardcode_direct_absolute_CXX=yes
+	  archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+	  hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	    archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+	    export_dynamic_flag_spec_CXX='${wl}-E'
+	    whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+	  fi
+	  output_verbose_link_cmd=func_echo_all
+	else
+	  ld_shlibs_CXX=no
+	fi
+	;;
+
+      osf3* | osf4* | osf5*)
+        case $cc_basename in
+          KCC*)
+	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	    # KCC will only create a shared library if the output file
+	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+	    # to its proper name (with version) after linking.
+	    archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	    hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+	    hardcode_libdir_separator_CXX=:
+
+	    # Archives containing C++ object files must be created using
+	    # the KAI C++ compiler.
+	    case $host in
+	      osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;;
+	      *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;;
+	    esac
+	    ;;
+          RCC*)
+	    # Rational C++ 2.4.1
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+          cxx*)
+	    case $host in
+	      osf3*)
+	        allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+	        archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	        hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+		;;
+	      *)
+	        allow_undefined_flag_CXX=' -expect_unresolved \*'
+	        archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	        archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+	          echo "-hidden">> $lib.exp~
+	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
+	          $RM $lib.exp'
+	        hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+		;;
+	    esac
+
+	    hardcode_libdir_separator_CXX=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    ;;
+	  *)
+	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	      allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+	      case $host in
+	        osf3*)
+	          archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	        *)
+	          archive_cmds_CXX='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	      esac
+
+	      hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+	      hardcode_libdir_separator_CXX=:
+
+	      # Commands to make compiler produce verbose output that lists
+	      # what "hidden" libraries, object files and flags are used when
+	      # linking a shared library.
+	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+	    else
+	      # FIXME: insert proper C++ library support
+	      ld_shlibs_CXX=no
+	    fi
+	    ;;
+        esac
+        ;;
+
+      psos*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+
+      sunos4*)
+        case $cc_basename in
+          CC*)
+	    # Sun C++ 4.x
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+          lcc*)
+	    # Lucid
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+        esac
+        ;;
+
+      solaris*)
+        case $cc_basename in
+          CC* | sunCC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+            archive_cmds_need_lc_CXX=yes
+	    no_undefined_flag_CXX=' -zdefs'
+	    archive_cmds_CXX='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	    archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	      $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	    hardcode_libdir_flag_spec_CXX='-R$libdir'
+	    hardcode_shlibpath_var_CXX=no
+	    case $host_os in
+	      solaris2.[0-5] | solaris2.[0-5].*) ;;
+	      *)
+		# The compiler driver will combine and reorder linker options,
+		# but understands `-z linker_flag'.
+	        # Supported since Solaris 2.6 (maybe 2.5.1?)
+		whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract'
+	        ;;
+	    esac
+	    link_all_deplibs_CXX=yes
+
+	    output_verbose_link_cmd='func_echo_all'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	    # necessary to make sure instantiated templates are included
+	    # in the archive.
+	    old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+	    ;;
+          gcx*)
+	    # Green Hills C++ Compiler
+	    archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+	    # The C++ compiler must be used to create the archive.
+	    old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+	    ;;
+          *)
+	    # GNU C++ compiler with Solaris linker
+	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	      no_undefined_flag_CXX=' ${wl}-z ${wl}defs'
+	      if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+	        archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+		  $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	        # Commands to make compiler produce verbose output that lists
+	        # what "hidden" libraries, object files and flags are used when
+	        # linking a shared library.
+	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	      else
+	        # g++ 2.7 appears to require `-G' NOT `-shared' on this
+	        # platform.
+	        archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+		  $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	        # Commands to make compiler produce verbose output that lists
+	        # what "hidden" libraries, object files and flags are used when
+	        # linking a shared library.
+	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	      fi
+
+	      hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'
+	      case $host_os in
+		solaris2.[0-5] | solaris2.[0-5].*) ;;
+		*)
+		  whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+		  ;;
+	      esac
+	    fi
+	    ;;
+        esac
+        ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      no_undefined_flag_CXX='${wl}-z,text'
+      archive_cmds_need_lc_CXX=no
+      hardcode_shlibpath_var_CXX=no
+      runpath_var='LD_RUN_PATH'
+
+      case $cc_basename in
+        CC*)
+	  archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+      esac
+      ;;
+
+      sysv5* | sco3.2v5* | sco5v6*)
+	# Note: We can NOT use -z defs as we might desire, because we do not
+	# link with -lc, and that would cause any symbols used from libc to
+	# always be unresolved, which means just about no library would
+	# ever link correctly.  If we're not using GNU ld we use -z text
+	# though, which does catch some bad symbols but isn't as heavy-handed
+	# as -z defs.
+	no_undefined_flag_CXX='${wl}-z,text'
+	allow_undefined_flag_CXX='${wl}-z,nodefs'
+	archive_cmds_need_lc_CXX=no
+	hardcode_shlibpath_var_CXX=no
+	hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir'
+	hardcode_libdir_separator_CXX=':'
+	link_all_deplibs_CXX=yes
+	export_dynamic_flag_spec_CXX='${wl}-Bexport'
+	runpath_var='LD_RUN_PATH'
+
+	case $cc_basename in
+          CC*)
+	    archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~
+	      '"$old_archive_cmds_CXX"
+	    reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~
+	      '"$reload_cmds_CXX"
+	    ;;
+	  *)
+	    archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    ;;
+	esac
+      ;;
+
+      tandem*)
+        case $cc_basename in
+          NCC*)
+	    # NonStop-UX NCC 3.20
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    ld_shlibs_CXX=no
+	    ;;
+        esac
+        ;;
+
+      vxworks*)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+
+      *)
+        # FIXME: insert proper C++ library support
+        ld_shlibs_CXX=no
+        ;;
+    esac
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
+$as_echo "$ld_shlibs_CXX" >&6; }
+    test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+    GCC_CXX="$GXX"
+    LD_CXX="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    # Dependencies to place before and after the object being linked:
+predep_objects_CXX=
+postdep_objects_CXX=
+predeps_CXX=
+postdeps_CXX=
+compiler_lib_search_path_CXX=
+
+cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+_LT_EOF
+
+
+_lt_libdeps_save_CFLAGS=$CFLAGS
+case "$CC $CFLAGS " in #(
+*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
+*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+esac
+
+if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  for p in `eval "$output_verbose_link_cmd"`; do
+    case ${prev}${p} in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" ||
+          test $p = "-R"; then
+	 prev=$p
+	 continue
+       fi
+
+       # Expand the sysroot to ease extracting the directories later.
+       if test -z "$prev"; then
+         case $p in
+         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
+         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
+         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
+         esac
+       fi
+       case $p in
+       =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
+       esac
+       if test "$pre_test_object_deps_done" = no; then
+	 case ${prev} in
+	 -L | -R)
+	   # Internal compiler library paths should come after those
+	   # provided the user.  The postdeps already come after the
+	   # user supplied libs so there is no need to process them.
+	   if test -z "$compiler_lib_search_path_CXX"; then
+	     compiler_lib_search_path_CXX="${prev}${p}"
+	   else
+	     compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}"
+	   fi
+	   ;;
+	 # The "-l" case would never come before the object being
+	 # linked, so don't bother handling this case.
+	 esac
+       else
+	 if test -z "$postdeps_CXX"; then
+	   postdeps_CXX="${prev}${p}"
+	 else
+	   postdeps_CXX="${postdeps_CXX} ${prev}${p}"
+	 fi
+       fi
+       prev=
+       ;;
+
+    *.lto.$objext) ;; # Ignore GCC LTO objects
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+	 pre_test_object_deps_done=yes
+	 continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 if test -z "$predep_objects_CXX"; then
+	   predep_objects_CXX="$p"
+	 else
+	   predep_objects_CXX="$predep_objects_CXX $p"
+	 fi
+       else
+	 if test -z "$postdep_objects_CXX"; then
+	   postdep_objects_CXX="$p"
+	 else
+	   postdep_objects_CXX="$postdep_objects_CXX $p"
+	 fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling CXX test program"
+fi
+
+$RM -f confest.$objext
+CFLAGS=$_lt_libdeps_save_CFLAGS
+
+# PORTME: override above test on systems where it is broken
+case $host_os in
+interix[3-9]*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  predep_objects_CXX=
+  postdep_objects_CXX=
+  postdeps_CXX=
+  ;;
+
+linux*)
+  case `$CC -V 2>&1 | sed 5q` in
+  *Sun\ C*)
+    # Sun C++ 5.9
+
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    if test "$solaris_use_stlport4" != yes; then
+      postdeps_CXX='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC* | sunCC*)
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    if test "$solaris_use_stlport4" != yes; then
+      postdeps_CXX='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+esac
+
+
+case " $postdeps_CXX " in
+*" -lc "*) archive_cmds_need_lc_CXX=no ;;
+esac
+ compiler_lib_search_dirs_CXX=
+if test -n "${compiler_lib_search_path_CXX}"; then
+ compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+    lt_prog_compiler_wl_CXX=
+lt_prog_compiler_pic_CXX=
+lt_prog_compiler_static_CXX=
+
+
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    lt_prog_compiler_wl_CXX='-Wl,'
+    lt_prog_compiler_static_CXX='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	lt_prog_compiler_static_CXX='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            lt_prog_compiler_pic_CXX='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | cygwin* | os2* | pw32* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      lt_prog_compiler_pic_CXX='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      lt_prog_compiler_pic_CXX=
+      ;;
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      lt_prog_compiler_static_CXX=
+      ;;
+    interix[3-9]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	lt_prog_compiler_pic_CXX=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	;;
+      *)
+	lt_prog_compiler_pic_CXX='-fPIC'
+	;;
+      esac
+      ;;
+    *qnx* | *nto*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      lt_prog_compiler_pic_CXX='-fPIC -shared'
+      ;;
+    *)
+      lt_prog_compiler_pic_CXX='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix[4-9]*)
+	# All AIX code is PIC.
+	if test "$host_cpu" = ia64; then
+	  # AIX 5 now supports IA64 processor
+	  lt_prog_compiler_static_CXX='-Bstatic'
+	else
+	  lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp'
+	fi
+	;;
+      chorus*)
+	case $cc_basename in
+	cxch68*)
+	  # Green Hills C++ Compiler
+	  # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+	  ;;
+	esac
+	;;
+      mingw* | cygwin* | os2* | pw32* | cegcc*)
+	# This hack is so that the source file can tell whether it is being
+	# built for inclusion in a dll (and should export symbols for example).
+	lt_prog_compiler_pic_CXX='-DDLL_EXPORT'
+	;;
+      dgux*)
+	case $cc_basename in
+	  ec++*)
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    ;;
+	  ghcx*)
+	    # Green Hills C++ Compiler
+	    lt_prog_compiler_pic_CXX='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      freebsd* | dragonfly*)
+	# FreeBSD uses GNU C++
+	;;
+      hpux9* | hpux10* | hpux11*)
+	case $cc_basename in
+	  CC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+	    if test "$host_cpu" != ia64; then
+	      lt_prog_compiler_pic_CXX='+Z'
+	    fi
+	    ;;
+	  aCC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_static_CXX='${wl}-a ${wl}archive'
+	    case $host_cpu in
+	    hppa*64*|ia64*)
+	      # +Z the default
+	      ;;
+	    *)
+	      lt_prog_compiler_pic_CXX='+Z'
+	      ;;
+	    esac
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      interix*)
+	# This is c89, which is MS Visual C++ (no shared libs)
+	# Anyone wants to do a port?
+	;;
+      irix5* | irix6* | nonstopux*)
+	case $cc_basename in
+	  CC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_static_CXX='-non_shared'
+	    # CC pic flag -KPIC is the default.
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+	case $cc_basename in
+	  KCC*)
+	    # KAI C++ Compiler
+	    lt_prog_compiler_wl_CXX='--backend -Wl,'
+	    lt_prog_compiler_pic_CXX='-fPIC'
+	    ;;
+	  ecpc* )
+	    # old Intel C++ for x86_64 which still supported -KPIC.
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    lt_prog_compiler_static_CXX='-static'
+	    ;;
+	  icpc* )
+	    # Intel C++, used to be incompatible with GCC.
+	    # ICC 10 doesn't accept -KPIC any more.
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-fPIC'
+	    lt_prog_compiler_static_CXX='-static'
+	    ;;
+	  pgCC* | pgcpp*)
+	    # Portland Group C++ compiler
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-fpic'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    ;;
+	  cxx*)
+	    # Compaq C++
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    lt_prog_compiler_pic_CXX=
+	    lt_prog_compiler_static_CXX='-non_shared'
+	    ;;
+	  xlc* | xlC* | bgxl[cC]* | mpixl[cC]*)
+	    # IBM XL 8.0, 9.0 on PPC and BlueGene
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-qpic'
+	    lt_prog_compiler_static_CXX='-qstaticlink'
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      lt_prog_compiler_pic_CXX='-KPIC'
+	      lt_prog_compiler_static_CXX='-Bstatic'
+	      lt_prog_compiler_wl_CXX='-Qoption ld '
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+      lynxos*)
+	;;
+      m88k*)
+	;;
+      mvs*)
+	case $cc_basename in
+	  cxx*)
+	    lt_prog_compiler_pic_CXX='-W c,exportall'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      netbsd* | netbsdelf*-gnu)
+	;;
+      *qnx* | *nto*)
+        # QNX uses GNU C++, but need to define -shared option too, otherwise
+        # it will coredump.
+        lt_prog_compiler_pic_CXX='-fPIC -shared'
+        ;;
+      osf3* | osf4* | osf5*)
+	case $cc_basename in
+	  KCC*)
+	    lt_prog_compiler_wl_CXX='--backend -Wl,'
+	    ;;
+	  RCC*)
+	    # Rational C++ 2.4.1
+	    lt_prog_compiler_pic_CXX='-pic'
+	    ;;
+	  cxx*)
+	    # Digital/Compaq C++
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    lt_prog_compiler_pic_CXX=
+	    lt_prog_compiler_static_CXX='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      psos*)
+	;;
+      solaris*)
+	case $cc_basename in
+	  CC* | sunCC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    lt_prog_compiler_wl_CXX='-Qoption ld '
+	    ;;
+	  gcx*)
+	    # Green Hills C++ Compiler
+	    lt_prog_compiler_pic_CXX='-PIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sunos4*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.x
+	    lt_prog_compiler_pic_CXX='-pic'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    ;;
+	  lcc*)
+	    # Lucid
+	    lt_prog_compiler_pic_CXX='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+	case $cc_basename in
+	  CC*)
+	    lt_prog_compiler_wl_CXX='-Wl,'
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    lt_prog_compiler_static_CXX='-Bstatic'
+	    ;;
+	esac
+	;;
+      tandem*)
+	case $cc_basename in
+	  NCC*)
+	    # NonStop-UX NCC 3.20
+	    lt_prog_compiler_pic_CXX='-KPIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      vxworks*)
+	;;
+      *)
+	lt_prog_compiler_can_build_shared_CXX=no
+	;;
+    esac
+  fi
+
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    lt_prog_compiler_pic_CXX=
+    ;;
+  *)
+    lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
+    ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+if ${lt_cv_prog_compiler_pic_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; }
+lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_CXX"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; }
+if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_pic_works_CXX=no
+   ac_outfile=conftest.$ac_objext
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_pic_works_CXX=yes
+     fi
+   fi
+   $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then
+    case $lt_prog_compiler_pic_CXX in
+     "" | " "*) ;;
+     *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;;
+     esac
+else
+    lt_prog_compiler_pic_CXX=
+     lt_prog_compiler_can_build_shared_CXX=no
+fi
+
+fi
 
-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
-  need_version=no
-  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-    dynamic_linker='NetBSD (a.out) ld.so'
-  else
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    dynamic_linker='NetBSD ld.elf_so'
-  fi
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  ;;
 
-newsos6)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  ;;
 
-nto-qnx*)
-  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=yes
-  ;;
 
-openbsd*)
-  version_type=sunos
-  sys_lib_dlsearch_path_spec="/usr/lib"
-  need_lib_prefix=no
-  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
-  case $host_os in
-    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
-    *)                         need_version=no  ;;
-  esac
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    case $host_os in
-      openbsd2.[89] | openbsd2.[89].*)
-	shlibpath_overrides_runpath=no
-	;;
-      *)
-	shlibpath_overrides_runpath=yes
-	;;
-      esac
-  else
-    shlibpath_overrides_runpath=yes
-  fi
-  ;;
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if ${lt_cv_prog_compiler_static_works_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_static_works_CXX=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&5
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         lt_cv_prog_compiler_static_works_CXX=yes
+       fi
+     else
+       lt_cv_prog_compiler_static_works_CXX=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
 
-os2*)
-  libname_spec='$name'
-  shrext_cmds=".dll"
-  need_lib_prefix=no
-  library_names_spec='$libname${shared_ext} $libname.a'
-  dynamic_linker='OS/2 ld.exe'
-  shlibpath_var=LIBPATH
-  ;;
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; }
 
-osf3* | osf4* | osf5*)
-  version_type=osf
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
-  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
-  ;;
+if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then
+    :
+else
+    lt_prog_compiler_static_CXX=
+fi
 
-rdos*)
-  dynamic_linker=no
-  ;;
 
-solaris*)
-  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=yes
-  hardcode_into_libs=yes
-  # ldd complains unless libraries are executable
-  postinstall_cmds='chmod +x $lib'
-  ;;
 
-sunos4*)
-  version_type=sunos
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  if test "$with_gnu_ld" = yes; then
-    need_lib_prefix=no
-  fi
-  need_version=yes
-  ;;
 
-sysv4 | sysv4.3*)
-  version_type=linux
-  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
-  case $host_vendor in
-    sni)
-      shlibpath_overrides_runpath=no
-      need_lib_prefix=no
-      export_dynamic_flag_spec='${wl}-Blargedynsym'
-      runpath_var=LD_RUN_PATH
-      ;;
-    siemens)
-      need_lib_prefix=no
-      ;;
-    motorola)
-      need_lib_prefix=no
-      need_version=no
-      shlibpath_overrides_runpath=no
-      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
-      ;;
-  esac
-  ;;
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  lt_cv_prog_compiler_c_o_CXX=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
-sysv4*MP*)
-  if test -d /usr/nec ;then
-    version_type=linux
-    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
-    soname_spec='$libname${shared_ext}.$major'
-    shlibpath_var=LD_LIBRARY_PATH
-  fi
-  ;;
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_CXX=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
 
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  version_type=freebsd-elf
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  hardcode_into_libs=yes
-  if test "$with_gnu_ld" = yes; then
-    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
-    shlibpath_overrides_runpath=no
-  else
-    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
-    shlibpath_overrides_runpath=yes
-    case $host_os in
-      sco3.2v5*)
-        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
-	;;
-    esac
-  fi
-  sys_lib_dlsearch_path_spec='/usr/lib'
-  ;;
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; }
 
-uts4*)
-  version_type=linux
-  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
-  ;;
 
-*)
-  dynamic_linker=no
-  ;;
-esac
-{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
-echo "${ECHO_T}$dynamic_linker" >&6; }
-test "$dynamic_linker" = no && can_build_shared=no
 
-if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if ${lt_cv_prog_compiler_c_o_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"
-fi
+  lt_cv_prog_compiler_c_o_CXX=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&5
+   echo "$as_me:$LINENO: \$? = $ac_status" >&5
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       lt_cv_prog_compiler_c_o_CXX=yes
+     fi
+   fi
+   chmod u+w . 2>&5
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
 
-sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
-if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; }
 
-sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
 
-variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
-if test "$GCC" = yes; then
-  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
-fi
 
-{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
-echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
-hardcode_action_F77=
-if test -n "$hardcode_libdir_flag_spec_F77" || \
-   test -n "$runpath_var_F77" || \
-   test "X$hardcode_automatic_F77" = "Xyes" ; then
 
-  # We can hardcode non-existant directories.
-  if test "$hardcode_direct_F77" != no &&
-     # If the only mechanism to avoid hardcoding is shlibpath_var, we
-     # have to relink, otherwise we might link with an installed library
-     # when we should be linking with a yet-to-be-installed one
-     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, F77)" != no &&
-     test "$hardcode_minus_L_F77" != no; then
-    # Linking always hardcodes the temporary library directory.
-    hardcode_action_F77=relink
-  else
-    # We can link without hardcoding, and we can hardcode nonexisting dirs.
-    hardcode_action_F77=immediate
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+  if test "$hard_links" = no; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+    need_locks=warn
   fi
 else
-  # We cannot hardcode anything, or else we can only hardcode existing
-  # directories.
-  hardcode_action_F77=unsupported
+  need_locks=no
 fi
-{ echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5
-echo "${ECHO_T}$hardcode_action_F77" >&6; }
 
-if test "$hardcode_action_F77" = relink; then
-  # Fast installation is not supported
-  enable_fast_install=no
-elif test "$shlibpath_overrides_runpath" = yes ||
-     test "$enable_shared" = no; then
-  # Fast installation is not necessary
-  enable_fast_install=needless
-fi
 
 
-# The else clause should only fire when bootstrapping the
-# libtool distribution, otherwise you forgot to ship ltmain.sh
-# with your package, and you will get complaints that there are
-# no rules to generate ltmain.sh.
-if test -f "$ltmain"; then
-  # See if we are running on zsh, and set the options which allow our commands through
-  # without removal of \ escapes.
-  if test -n "${ZSH_VERSION+set}" ; then
-    setopt NO_GLOB_SUBST
-  fi
-  # Now quote all the things that may contain metacharacters while being
-  # careful not to overquote the AC_SUBSTed values.  We take copies of the
-  # variables and quote the copies for generation of the libtool script.
-  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
-    SED SHELL STRIP \
-    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
-    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
-    deplibs_check_method reload_flag reload_cmds need_locks \
-    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
-    lt_cv_sys_global_symbol_to_c_name_address \
-    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
-    old_postinstall_cmds old_postuninstall_cmds \
-    compiler_F77 \
-    CC_F77 \
-    LD_F77 \
-    lt_prog_compiler_wl_F77 \
-    lt_prog_compiler_pic_F77 \
-    lt_prog_compiler_static_F77 \
-    lt_prog_compiler_no_builtin_flag_F77 \
-    export_dynamic_flag_spec_F77 \
-    thread_safe_flag_spec_F77 \
-    whole_archive_flag_spec_F77 \
-    enable_shared_with_static_runtimes_F77 \
-    old_archive_cmds_F77 \
-    old_archive_from_new_cmds_F77 \
-    predep_objects_F77 \
-    postdep_objects_F77 \
-    predeps_F77 \
-    postdeps_F77 \
-    compiler_lib_search_path_F77 \
-    compiler_lib_search_dirs_F77 \
-    archive_cmds_F77 \
-    archive_expsym_cmds_F77 \
-    postinstall_cmds_F77 \
-    postuninstall_cmds_F77 \
-    old_archive_from_expsyms_cmds_F77 \
-    allow_undefined_flag_F77 \
-    no_undefined_flag_F77 \
-    export_symbols_cmds_F77 \
-    hardcode_libdir_flag_spec_F77 \
-    hardcode_libdir_flag_spec_ld_F77 \
-    hardcode_libdir_separator_F77 \
-    hardcode_automatic_F77 \
-    module_cmds_F77 \
-    module_expsym_cmds_F77 \
-    lt_cv_prog_compiler_c_o_F77 \
-    fix_srcfile_path_F77 \
-    exclude_expsyms_F77 \
-    include_expsyms_F77; do
-
-    case $var in
-    old_archive_cmds_F77 | \
-    old_archive_from_new_cmds_F77 | \
-    archive_cmds_F77 | \
-    archive_expsym_cmds_F77 | \
-    module_cmds_F77 | \
-    module_expsym_cmds_F77 | \
-    old_archive_from_expsyms_cmds_F77 | \
-    export_symbols_cmds_F77 | \
-    extract_expsyms_cmds | reload_cmds | finish_cmds | \
-    postinstall_cmds | postuninstall_cmds | \
-    old_postinstall_cmds | old_postuninstall_cmds | \
-    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
-      # Double-quote double-evaled strings.
-      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
-      ;;
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+  export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+  case $host_os in
+  aix[4-9]*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    # Also, AIX nm treats weak defined symbols like other global defined
+    # symbols, whereas GNU nm marks them as "W".
+    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+      export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    else
+      export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    export_symbols_cmds_CXX="$ltdll_cmds"
+    ;;
+  cygwin* | mingw* | cegcc*)
+    case $cc_basename in
+    cl*) ;;
     *)
-      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+      export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols'
+      exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
       ;;
     esac
-  done
-
-  case $lt_echo in
-  *'\$0 --fallback-echo"')
-    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+    ;;
+  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'
     ;;
   esac
 
-cfgfile="$ofile"
-
-  cat <<__EOF__ >> "$cfgfile"
-# ### BEGIN LIBTOOL TAG CONFIG: $tagname
-
-# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-
-# Shell to use when invoking shell scripts.
-SHELL=$lt_SHELL
-
-# Whether or not to build shared libraries.
-build_libtool_libs=$enable_shared
-
-# Whether or not to build static libraries.
-build_old_libs=$enable_static
-
-# Whether or not to add -lc for building shared libraries.
-build_libtool_need_lc=$archive_cmds_need_lc_F77
-
-# Whether or not to disallow shared libs when runtime libs are static
-allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_F77
-
-# Whether or not to optimize for fast installation.
-fast_install=$enable_fast_install
-
-# The host system.
-host_alias=$host_alias
-host=$host
-host_os=$host_os
-
-# The build system.
-build_alias=$build_alias
-build=$build
-build_os=$build_os
-
-# An echo program that does not interpret backslashes.
-echo=$lt_echo
-
-# The archiver.
-AR=$lt_AR
-AR_FLAGS=$lt_AR_FLAGS
-
-# A C compiler.
-LTCC=$lt_LTCC
-
-# LTCC compiler flags.
-LTCFLAGS=$lt_LTCFLAGS
-
-# A language-specific compiler.
-CC=$lt_compiler_F77
-
-# Is the compiler the GNU C compiler?
-with_gcc=$GCC_F77
-
-# An ERE matcher.
-EGREP=$lt_EGREP
-
-# The linker used to build libraries.
-LD=$lt_LD_F77
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
+$as_echo "$ld_shlibs_CXX" >&6; }
+test "$ld_shlibs_CXX" = no && can_build_shared=no
 
-# Whether we need hard or soft links.
-LN_S=$lt_LN_S
+with_gnu_ld_CXX=$with_gnu_ld
 
-# A BSD-compatible nm program.
-NM=$lt_NM
 
-# A symbol stripping program
-STRIP=$lt_STRIP
 
-# Used to examine libraries when file_magic_cmd begins "file"
-MAGIC_CMD=$MAGIC_CMD
 
-# Used on cygwin: DLL creation program.
-DLLTOOL="$DLLTOOL"
 
-# Used on cygwin: object dumper.
-OBJDUMP="$OBJDUMP"
 
-# Used on cygwin: assembler.
-AS="$AS"
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_CXX" in
+x|xyes)
+  # Assume -lc should be added
+  archive_cmds_need_lc_CXX=yes
 
-# The name of the directory that contains temporary libtool files.
-objdir=$objdir
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $archive_cmds_CXX in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  $RM conftest*
+	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
-# How to create reloadable object files.
-reload_flag=$lt_reload_flag
-reload_cmds=$lt_reload_cmds
+	if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } 2>conftest.err; then
+	  soname=conftest
+	  lib=conftest
+	  libobjs=conftest.$ac_objext
+	  deplibs=
+	  wl=$lt_prog_compiler_wl_CXX
+	  pic_flag=$lt_prog_compiler_pic_CXX
+	  compiler_flags=-v
+	  linker_flags=-v
+	  verstring=
+	  output_objdir=.
+	  libname=conftest
+	  lt_save_allow_undefined_flag=$allow_undefined_flag_CXX
+	  allow_undefined_flag_CXX=
+	  if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
+  (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }
+	  then
+	    lt_cv_archive_cmds_need_lc_CXX=no
+	  else
+	    lt_cv_archive_cmds_need_lc_CXX=yes
+	  fi
+	  allow_undefined_flag_CXX=$lt_save_allow_undefined_flag
+	else
+	  cat conftest.err 1>&5
+	fi
+	$RM conftest*
 
-# How to pass a linker flag through the compiler.
-wl=$lt_lt_prog_compiler_wl_F77
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5
+$as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; }
+      archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX
+      ;;
+    esac
+  fi
+  ;;
+esac
 
-# Object file suffix (normally "o").
-objext="$ac_objext"
 
-# Old archive suffix (normally "a").
-libext="$libext"
 
-# Shared library suffix (normally ".so").
-shrext_cmds='$shrext_cmds'
 
-# Executable file suffix (normally "").
-exeext="$exeext"
 
-# Additional compiler flags for building library objects.
-pic_flag=$lt_lt_prog_compiler_pic_F77
-pic_mode=$pic_mode
 
-# What is the maximum length of a command?
-max_cmd_len=$lt_cv_sys_max_cmd_len
 
-# Does compiler simultaneously support -c and -o options?
-compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77
 
-# Must we lock files when doing compilation?
-need_locks=$lt_need_locks
 
-# Do we need the lib prefix for modules?
-need_lib_prefix=$need_lib_prefix
 
-# Do we need a version for libraries?
-need_version=$need_version
 
-# Whether dlopen is supported.
-dlopen_support=$enable_dlopen
 
-# Whether dlopen of programs is supported.
-dlopen_self=$enable_dlopen_self
 
-# Whether dlopen of statically linked programs is supported.
-dlopen_self_static=$enable_dlopen_self_static
 
-# Compiler flag to prevent dynamic linking.
-link_static_flag=$lt_lt_prog_compiler_static_F77
 
-# Compiler flag to turn off builtin functions.
-no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_F77
 
-# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_F77
 
-# Compiler flag to generate shared objects directly from archives.
-whole_archive_flag_spec=$lt_whole_archive_flag_spec_F77
 
-# Compiler flag to generate thread-safe objects.
-thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77
 
-# Library versioning type.
-version_type=$version_type
 
-# Format of library name prefix.
-libname_spec=$lt_libname_spec
 
-# List of archive names.  First name is the real one, the rest are links.
-# The last name is the one that the linker finds with -lNAME.
-library_names_spec=$lt_library_names_spec
 
-# The coded name of the library, if different from the real name.
-soname_spec=$lt_soname_spec
 
-# Commands used to build and install an old-style archive.
-RANLIB=$lt_RANLIB
-old_archive_cmds=$lt_old_archive_cmds_F77
-old_postinstall_cmds=$lt_old_postinstall_cmds
-old_postuninstall_cmds=$lt_old_postuninstall_cmds
 
-# Create an old-style archive from a shared archive.
-old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_F77
 
-# Create a temporary old-style archive to link instead of a shared archive.
-old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_F77
 
-# Commands used to build and install a shared archive.
-archive_cmds=$lt_archive_cmds_F77
-archive_expsym_cmds=$lt_archive_expsym_cmds_F77
-postinstall_cmds=$lt_postinstall_cmds
-postuninstall_cmds=$lt_postuninstall_cmds
 
-# Commands used to build a loadable module (assumed same as above if empty)
-module_cmds=$lt_module_cmds_F77
-module_expsym_cmds=$lt_module_expsym_cmds_F77
 
-# Commands to strip libraries.
-old_striplib=$lt_old_striplib
-striplib=$lt_striplib
 
-# Dependencies to place before the objects being linked to create a
-# shared library.
-predep_objects=$lt_predep_objects_F77
 
-# Dependencies to place after the objects being linked to create a
-# shared library.
-postdep_objects=$lt_postdep_objects_F77
 
-# Dependencies to place before the objects being linked to create a
-# shared library.
-predeps=$lt_predeps_F77
 
-# Dependencies to place after the objects being linked to create a
-# shared library.
-postdeps=$lt_postdeps_F77
 
-# The directories searched by this compiler when creating a shared
-# library
-compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_F77
 
-# The library search path used internally by the compiler when linking
-# a shared library.
-compiler_lib_search_path=$lt_compiler_lib_search_path_F77
 
-# Method to check whether dependent libraries are shared objects.
-deplibs_check_method=$lt_deplibs_check_method
 
-# Command to use when deplibs_check_method == file_magic.
-file_magic_cmd=$lt_file_magic_cmd
 
-# Flag that allows shared libraries with undefined symbols to be built.
-allow_undefined_flag=$lt_allow_undefined_flag_F77
 
-# Flag that forces no undefined symbols.
-no_undefined_flag=$lt_no_undefined_flag_F77
 
-# Commands used to finish a libtool library installation in a directory.
-finish_cmds=$lt_finish_cmds
 
-# Same as above, but a single script fragment to be evaled but not shown.
-finish_eval=$lt_finish_eval
 
-# Take the output of nm and produce a listing of raw symbols and C names.
-global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
 
-# Transform the output of nm in a proper C declaration
-global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
 
-# Transform the output of nm in a C name address pair
-global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
 
-# This is the shared library runtime path variable.
-runpath_var=$runpath_var
 
-# This is the shared library path variable.
-shlibpath_var=$shlibpath_var
 
-# Is shlibpath searched before the hard-coded library search path?
-shlibpath_overrides_runpath=$shlibpath_overrides_runpath
 
-# How to hardcode a shared library path into an executable.
-hardcode_action=$hardcode_action_F77
 
-# Whether we should hardcode library paths into libraries.
-hardcode_into_libs=$hardcode_into_libs
 
-# Flag to hardcode \$libdir into a binary during linking.
-# This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_F77
 
-# If ld is used when linking, flag to hardcode \$libdir into
-# a binary during linking. This must work even if \$libdir does
-# not exist.
-hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_F77
 
-# Whether we need a single -rpath flag with a separated argument.
-hardcode_libdir_separator=$lt_hardcode_libdir_separator_F77
 
-# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
-# resulting binary.
-hardcode_direct=$hardcode_direct_F77
 
-# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
-# resulting binary.
-hardcode_minus_L=$hardcode_minus_L_F77
 
-# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
-# the resulting binary.
-hardcode_shlibpath_var=$hardcode_shlibpath_var_F77
 
-# Set to yes if building a shared library automatically hardcodes DIR into the library
-# and all subsequent libraries and executables linked against it.
-hardcode_automatic=$hardcode_automatic_F77
 
-# Variables whose values should be saved in libtool wrapper scripts and
-# restored at relink time.
-variables_saved_for_relink="$variables_saved_for_relink"
 
-# Whether libtool must link a program against all its dependency libraries.
-link_all_deplibs=$link_all_deplibs_F77
 
-# Compile-time system search path for libraries
-sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
 
-# Run-time system search path for libraries
-sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
 
-# Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path=$lt_fix_srcfile_path
 
-# Set to yes if exported symbols are required.
-always_export_symbols=$always_export_symbols_F77
 
-# The commands to list exported symbols.
-export_symbols_cmds=$lt_export_symbols_cmds_F77
 
-# The commands to extract the exported symbol list from a shared archive.
-extract_expsyms_cmds=$lt_extract_expsyms_cmds
 
-# Symbols that should not be listed in the preloaded symbols.
-exclude_expsyms=$lt_exclude_expsyms_F77
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
 
-# Symbols that must always be exported.
-include_expsyms=$lt_include_expsyms_F77
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
 
-# ### END LIBTOOL TAG CONFIG: $tagname
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
 
-__EOF__
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
 
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
 
-else
-  # If there is no Makefile yet, we rely on a make rule to execute
-  # `config.status --recheck' to rerun these tests and create the
-  # libtool script then.
-  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
-  if test -f "$ltmain_in"; then
-    test -f Makefile && make "$ltmain"
+aix[4-9]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[01] | aix4.[01].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
   fi
-fi
+  ;;
 
+amigaos*)
+  case $host_cpu in
+  powerpc)
+    # Since July 2007 AmigaOS4 officially supports .so libraries.
+    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    ;;
+  m68k)
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    ;;
+  esac
+  ;;
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
 
-CC="$lt_save_CC"
+bsdi[45]*)
+  version_type=linux
+  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'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
 
-	else
-	  tagname=""
-	fi
-	;;
+cygwin* | mingw* | pw32* | cegcc*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
 
-      GCJ)
-	if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
 
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
 
-# Source file extension for Java test sources.
-ac_ext=java
+      ;;
+    mingw* | cegcc*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
 
-# Object file extension for compiled Java test sources.
-objext=o
-objext_GCJ=$objext
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}.dll.lib'
 
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="class foo {}"
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
 
-# Code to be used in simple link tests
-lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
+    ;;
 
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  *)
+    # Assume MSVC wrapper
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    dynamic_linker='Win32 ld.exe'
+    ;;
+  esac
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
 
-# If no C compiler was specified, use CC.
-LTCC=${LTCC-"$CC"}
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
 
-# If no C compiler flags were specified, use CFLAGS.
-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
 
-# Allow CC to be a program name with arguments.
-compiler=$CC
+dgux*)
+  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
+  ;;
 
+freebsd1*)
+  dynamic_linker=no
+  ;;
 
-# save warnings/boilerplate of simple test code
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_compile_test_code" >conftest.$ac_ext
-eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_compiler_boilerplate=`cat conftest.err`
-$rm conftest*
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[123]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[01]* | freebsdelf3.[01]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
 
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_link_test_code" >conftest.$ac_ext
-eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_linker_boilerplate=`cat conftest.err`
-$rm -r conftest*
+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
+  ;;
 
+haiku*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  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=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+  hardcode_into_libs=yes
+  ;;
 
-# Allow CC to be a program name with arguments.
-lt_save_CC="$CC"
-CC=${GCJ-"gcj"}
-compiler=$CC
-compiler_GCJ=$CC
-for cc_temp in $compiler""; do
-  case $cc_temp in
-    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
-    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
-    \-*) ;;
-    *) break;;
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
   esac
-done
-cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
-
-
-# GCJ did not exist at the time GCC didn't implicitly link libc in.
-archive_cmds_need_lc_GCJ=no
-
-old_archive_cmds_GCJ=$old_archive_cmds
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+  postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
+  ;;
 
+interix[3-9]*)
+  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'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
 
-lt_prog_compiler_no_builtin_flag_GCJ=
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
 
-if test "$GCC" = yes; then
-  lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin'
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
 
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-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'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
 
-{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
-echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
-if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+  # Some binutils ld are patched to set DT_RUNPATH
+  if ${lt_cv_shlibpath_overrides_runpath+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  lt_cv_prog_compiler_rtti_exceptions=no
-  ac_outfile=conftest.$ac_objext
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-   lt_compiler_flag="-fno-rtti -fno-exceptions"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   # The option is referenced via a variable to avoid confusing sed.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16451: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>conftest.err)
-   ac_status=$?
-   cat conftest.err >&5
-   echo "$as_me:16455: \$? = $ac_status" >&5
-   if (exit $ac_status) && test -s "$ac_outfile"; then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings other than the usual output.
-     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
-     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_rtti_exceptions=yes
-     fi
-   fi
-   $rm conftest*
+  lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \
+	 LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\""
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+int
+main ()
+{
 
-if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
-    lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions"
-else
-    :
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  if  ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+  lt_cv_shlibpath_overrides_runpath=yes
 fi
-
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
 
-lt_prog_compiler_wl_GCJ=
-lt_prog_compiler_pic_GCJ=
-lt_prog_compiler_static_GCJ=
-
-{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
-echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
-
-  if test "$GCC" = yes; then
-    lt_prog_compiler_wl_GCJ='-Wl,'
-    lt_prog_compiler_static_GCJ='-static'
-
-    case $host_os in
-      aix*)
-      # All AIX code is PIC.
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	lt_prog_compiler_static_GCJ='-Bstatic'
-      fi
-      ;;
-
-    amigaos*)
-      # FIXME: we need at least 68020 code to build shared libraries, but
-      # adding the `-m68020' flag to GCC prevents building anything better,
-      # like `-m68040'.
-      lt_prog_compiler_pic_GCJ='-m68020 -resident32 -malways-restore-a4'
-      ;;
-
-    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
-      # PIC is the default for these OSes.
-      ;;
-
-    mingw* | cygwin* | pw32* | os2*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-      # Although the cygwin gcc ignores -fPIC, still need this for old-style
-      # (--disable-auto-import) libraries
-
-      ;;
+fi
 
-    darwin* | rhapsody*)
-      # PIC is the default on this platform
-      # Common symbols not allowed in MH_DYLIB files
-      lt_prog_compiler_pic_GCJ='-fno-common'
-      ;;
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
 
-    interix[3-9]*)
-      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
-      # Instead, we relocate shared libraries at runtime.
-      ;;
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
 
-    msdosdjgpp*)
-      # Just because we use GCC doesn't mean we suddenly get shared libraries
-      # on systems that don't support them.
-      lt_prog_compiler_can_build_shared_GCJ=no
-      enable_shared=no
-      ;;
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
 
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	lt_prog_compiler_pic_GCJ=-Kconform_pic
-      fi
-      ;;
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  dynamic_linker='GNU/Linux ld.so'
+  ;;
 
-    hpux*)
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
-      case $host_cpu in
-      hppa*64*|ia64*)
-	# +Z the default
-	;;
-      *)
-	lt_prog_compiler_pic_GCJ='-fPIC'
-	;;
-      esac
-      ;;
+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'
+  ;;
 
-    *)
-      lt_prog_compiler_pic_GCJ='-fPIC'
-      ;;
-    esac
+netbsd*)
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
   else
-    # PORTME Check for flag to pass linker flags through the system compiler.
-    case $host_os in
-    aix*)
-      lt_prog_compiler_wl_GCJ='-Wl,'
-      if test "$host_cpu" = ia64; then
-	# AIX 5 now supports IA64 processor
-	lt_prog_compiler_static_GCJ='-Bstatic'
-      else
-	lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp'
-      fi
-      ;;
-      darwin*)
-        # PIC is the default on this platform
-        # Common symbols not allowed in MH_DYLIB files
-       case $cc_basename in
-         xlc*)
-         lt_prog_compiler_pic_GCJ='-qnocommon'
-         lt_prog_compiler_wl_GCJ='-Wl,'
-         ;;
-       esac
-       ;;
-
-    mingw* | cygwin* | pw32* | os2*)
-      # This hack is so that the source file can tell whether it is being
-      # built for inclusion in a dll (and should export symbols for example).
-
-      ;;
-
-    hpux9* | hpux10* | hpux11*)
-      lt_prog_compiler_wl_GCJ='-Wl,'
-      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
-      # not for PA HP-UX.
-      case $host_cpu in
-      hppa*64*|ia64*)
-	# +Z the default
-	;;
-      *)
-	lt_prog_compiler_pic_GCJ='+Z'
-	;;
-      esac
-      # Is there a better lt_prog_compiler_static that works with the bundled CC?
-      lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive'
-      ;;
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
 
-    irix5* | irix6* | nonstopux*)
-      lt_prog_compiler_wl_GCJ='-Wl,'
-      # PIC (with -KPIC) is the default.
-      lt_prog_compiler_static_GCJ='-non_shared'
-      ;;
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
 
-    newsos6)
-      lt_prog_compiler_pic_GCJ='-KPIC'
-      lt_prog_compiler_static_GCJ='-Bstatic'
-      ;;
+*nto* | *qnx*)
+  version_type=qnx
+  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='ldqnx.so'
+  ;;
 
-    linux* | k*bsd*-gnu)
-      case $cc_basename in
-      icc* | ecc*)
-	lt_prog_compiler_wl_GCJ='-Wl,'
-	lt_prog_compiler_pic_GCJ='-KPIC'
-	lt_prog_compiler_static_GCJ='-static'
-        ;;
-      pgcc* | pgf77* | pgf90* | pgf95*)
-        # Portland Group compilers (*not* the Pentium gcc compiler,
-	# which looks to be a dead project)
-	lt_prog_compiler_wl_GCJ='-Wl,'
-	lt_prog_compiler_pic_GCJ='-fpic'
-	lt_prog_compiler_static_GCJ='-Bstatic'
-        ;;
-      ccc*)
-        lt_prog_compiler_wl_GCJ='-Wl,'
-        # All Alpha code is PIC.
-        lt_prog_compiler_static_GCJ='-non_shared'
-        ;;
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
+    *)				need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[89] | openbsd2.[89].*)
+	shlibpath_overrides_runpath=no
+	;;
       *)
-        case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)
-	  # Sun C 5.9
-	  lt_prog_compiler_pic_GCJ='-KPIC'
-	  lt_prog_compiler_static_GCJ='-Bstatic'
-	  lt_prog_compiler_wl_GCJ='-Wl,'
-	  ;;
-	*Sun\ F*)
-	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
-	  lt_prog_compiler_pic_GCJ='-KPIC'
-	  lt_prog_compiler_static_GCJ='-Bstatic'
-	  lt_prog_compiler_wl_GCJ=''
-	  ;;
-	esac
+	shlibpath_overrides_runpath=yes
 	;;
       esac
-      ;;
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
 
-    osf3* | osf4* | osf5*)
-      lt_prog_compiler_wl_GCJ='-Wl,'
-      # All OSF/1 code is PIC.
-      lt_prog_compiler_static_GCJ='-non_shared'
-      ;;
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
 
-    rdos*)
-      lt_prog_compiler_static_GCJ='-non_shared'
-      ;;
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
 
-    solaris*)
-      lt_prog_compiler_pic_GCJ='-KPIC'
-      lt_prog_compiler_static_GCJ='-Bstatic'
-      case $cc_basename in
-      f77* | f90* | f95*)
-	lt_prog_compiler_wl_GCJ='-Qoption ld ';;
-      *)
-	lt_prog_compiler_wl_GCJ='-Wl,';;
-      esac
-      ;;
+rdos*)
+  dynamic_linker=no
+  ;;
 
-    sunos4*)
-      lt_prog_compiler_wl_GCJ='-Qoption ld '
-      lt_prog_compiler_pic_GCJ='-PIC'
-      lt_prog_compiler_static_GCJ='-Bstatic'
-      ;;
+solaris*)
+  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=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
 
-    sysv4 | sysv4.2uw2* | sysv4.3*)
-      lt_prog_compiler_wl_GCJ='-Wl,'
-      lt_prog_compiler_pic_GCJ='-KPIC'
-      lt_prog_compiler_static_GCJ='-Bstatic'
-      ;;
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
 
-    sysv4*MP*)
-      if test -d /usr/nec ;then
-	lt_prog_compiler_pic_GCJ='-Kconform_pic'
-	lt_prog_compiler_static_GCJ='-Bstatic'
-      fi
+sysv4 | sysv4.3*)
+  version_type=linux
+  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
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
       ;;
-
-    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
-      lt_prog_compiler_wl_GCJ='-Wl,'
-      lt_prog_compiler_pic_GCJ='-KPIC'
-      lt_prog_compiler_static_GCJ='-Bstatic'
+    siemens)
+      need_lib_prefix=no
       ;;
-
-    unicos*)
-      lt_prog_compiler_wl_GCJ='-Wl,'
-      lt_prog_compiler_can_build_shared_GCJ=no
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
       ;;
+  esac
+  ;;
 
-    uts4*)
-      lt_prog_compiler_pic_GCJ='-pic'
-      lt_prog_compiler_static_GCJ='-Bstatic'
-      ;;
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
 
-    *)
-      lt_prog_compiler_can_build_shared_GCJ=no
-      ;;
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
     esac
   fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
 
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6; }
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  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}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
 
-#
-# Check to make sure the PIC flag actually works.
-#
-if test -n "$lt_prog_compiler_pic_GCJ"; then
+uts4*)
+  version_type=linux
+  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
+  ;;
 
-{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5
-echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6; }
-if test "${lt_cv_prog_compiler_pic_works_GCJ+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  lt_cv_prog_compiler_pic_works_GCJ=no
-  ac_outfile=conftest.$ac_objext
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-   lt_compiler_flag="$lt_prog_compiler_pic_GCJ"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   # The option is referenced via a variable to avoid confusing sed.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16741: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>conftest.err)
-   ac_status=$?
-   cat conftest.err >&5
-   echo "$as_me:16745: \$? = $ac_status" >&5
-   if (exit $ac_status) && test -s "$ac_outfile"; then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings other than the usual output.
-     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
-     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_pic_works_GCJ=yes
-     fi
-   fi
-   $rm conftest*
+*)
+  dynamic_linker=no
+  ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
 
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
 fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_GCJ" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_pic_works_GCJ" >&6; }
 
-if test x"$lt_cv_prog_compiler_pic_works_GCJ" = xyes; then
-    case $lt_prog_compiler_pic_GCJ in
-     "" | " "*) ;;
-     *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;;
-     esac
-else
-    lt_prog_compiler_pic_GCJ=
-     lt_prog_compiler_can_build_shared_GCJ=no
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
 fi
-
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
 fi
-case $host_os in
-  # For platforms which do not support PIC, -DPIC is meaningless:
-  *djgpp*)
-    lt_prog_compiler_pic_GCJ=
-    ;;
-  *)
-    lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ"
-    ;;
-esac
 
-#
-# Check to make sure the static flag actually works.
-#
-wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\"
-{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
-echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
-if test "${lt_cv_prog_compiler_static_works_GCJ+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  lt_cv_prog_compiler_static_works_GCJ=no
-   save_LDFLAGS="$LDFLAGS"
-   LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
-   echo "$lt_simple_link_test_code" > conftest.$ac_ext
-   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
-     # The linker can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     if test -s conftest.err; then
-       # Append any errors to the config.log.
-       cat conftest.err 1>&5
-       $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
-       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
-       if diff conftest.exp conftest.er2 >/dev/null; then
-         lt_cv_prog_compiler_static_works_GCJ=yes
-       fi
-     else
-       lt_cv_prog_compiler_static_works_GCJ=yes
-     fi
-   fi
-   $rm -r conftest*
-   LDFLAGS="$save_LDFLAGS"
 
-fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_GCJ" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_static_works_GCJ" >&6; }
 
-if test x"$lt_cv_prog_compiler_static_works_GCJ" = xyes; then
-    :
-else
-    lt_prog_compiler_static_GCJ=
-fi
 
 
-{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
-echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
-if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  lt_cv_prog_compiler_c_o_GCJ=no
-   $rm -r conftest 2>/dev/null
-   mkdir conftest
-   cd conftest
-   mkdir out
-   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
-   lt_compiler_flag="-o out/conftest2.$ac_objext"
-   # Insert the option either (1) after the last *FLAGS variable, or
-   # (2) before a word containing "conftest.", or (3) at the end.
-   # Note that $ac_compile itself does not contain backslashes and begins
-   # with a dollar sign (not a hyphen), so the echo should work correctly.
-   lt_compile=`echo "$ac_compile" | $SED \
-   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-   -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-   -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16845: $lt_compile\"" >&5)
-   (eval "$lt_compile" 2>out/conftest.err)
-   ac_status=$?
-   cat out/conftest.err >&5
-   echo "$as_me:16849: \$? = $ac_status" >&5
-   if (exit $ac_status) && test -s out/conftest2.$ac_objext
-   then
-     # The compiler can only warn and ignore the option if not recognized
-     # So say no if there are warnings
-     $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
-     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
-     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
-       lt_cv_prog_compiler_c_o_GCJ=yes
-     fi
-   fi
-   chmod u+w . 2>&5
-   $rm conftest*
-   # SGI C++ compiler will create directory out/ii_files/ for
-   # template instantiation
-   test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
-   $rm out/* && rmdir out
-   cd ..
-   rmdir conftest
-   $rm conftest*
 
-fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6; }
 
 
-hard_links="nottested"
-if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then
-  # do not overwrite the value of need_locks provided by the user
-  { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
-echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
-  hard_links=yes
-  $rm conftest*
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  touch conftest.a
-  ln conftest.a conftest.b 2>&5 || hard_links=no
-  ln conftest.a conftest.b 2>/dev/null && hard_links=no
-  { echo "$as_me:$LINENO: result: $hard_links" >&5
-echo "${ECHO_T}$hard_links" >&6; }
-  if test "$hard_links" = no; then
-    { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
-echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
-    need_locks=warn
-  fi
-else
-  need_locks=no
-fi
 
-{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
-echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
 
-  runpath_var=
-  allow_undefined_flag_GCJ=
-  enable_shared_with_static_runtimes_GCJ=no
-  archive_cmds_GCJ=
-  archive_expsym_cmds_GCJ=
-  old_archive_From_new_cmds_GCJ=
-  old_archive_from_expsyms_cmds_GCJ=
-  export_dynamic_flag_spec_GCJ=
-  whole_archive_flag_spec_GCJ=
-  thread_safe_flag_spec_GCJ=
-  hardcode_libdir_flag_spec_GCJ=
-  hardcode_libdir_flag_spec_ld_GCJ=
-  hardcode_libdir_separator_GCJ=
-  hardcode_direct_GCJ=no
-  hardcode_minus_L_GCJ=no
-  hardcode_shlibpath_var_GCJ=unsupported
-  link_all_deplibs_GCJ=unknown
-  hardcode_automatic_GCJ=no
-  module_cmds_GCJ=
-  module_expsym_cmds_GCJ=
-  always_export_symbols_GCJ=no
-  export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
-  # include_expsyms should be a list of space-separated symbols to be *always*
-  # included in the symbol list
-  include_expsyms_GCJ=
-  # exclude_expsyms can be an extended regexp of symbols to exclude
-  # it will be wrapped by ` (' and `)$', so one must not match beginning or
-  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
-  # as well as any symbol that contains `d'.
-  exclude_expsyms_GCJ='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
-  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
-  # platforms (ab)use it in PIC code, but their linkers get confused if
-  # the symbol is explicitly referenced.  Since portable code cannot
-  # rely on this symbol name, it's probably fine to never include it in
-  # preloaded symbol tables.
-  # Exclude shared library initialization/finalization symbols.
-  extract_expsyms_cmds=
-  # Just being paranoid about ensuring that cc_basename is set.
-  for cc_temp in $compiler""; do
-  case $cc_temp in
-    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
-    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
-    \-*) ;;
-    *) break;;
-  esac
-done
-cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
 
-  case $host_os in
-  cygwin* | mingw* | pw32*)
-    # FIXME: the MSVC++ port hasn't been tested in a loooong time
-    # When not using gcc, we currently assume that we are using
-    # Microsoft Visual C++.
-    if test "$GCC" != yes; then
-      with_gnu_ld=no
-    fi
-    ;;
-  interix*)
-    # we just hope/assume this is gcc and not c89 (= MSVC++)
-    with_gnu_ld=yes
-    ;;
-  openbsd*)
-    with_gnu_ld=no
-    ;;
-  esac
 
-  ld_shlibs_GCJ=yes
-  if test "$with_gnu_ld" = yes; then
-    # If archive_cmds runs LD, not CC, wlarc should be empty
-    wlarc='${wl}'
 
-    # Set some defaults for GNU ld with shared library support. These
-    # are reset later if shared libraries are not supported. Putting them
-    # here allows them to be overridden if necessary.
-    runpath_var=LD_RUN_PATH
-    hardcode_libdir_flag_spec_GCJ='${wl}--rpath ${wl}$libdir'
-    export_dynamic_flag_spec_GCJ='${wl}--export-dynamic'
-    # ancient GNU ld didn't support --whole-archive et. al.
-    if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
-	whole_archive_flag_spec_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
-      else
-  	whole_archive_flag_spec_GCJ=
-    fi
-    supports_anon_versioning=no
-    case `$LD -v 2>/dev/null` in
-      *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
-      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
-      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
-      *\ 2.11.*) ;; # other 2.11 versions
-      *) supports_anon_versioning=yes ;;
-    esac
 
-    # See if GNU ld supports shared libraries.
-    case $host_os in
-    aix[3-9]*)
-      # On AIX/PPC, the GNU linker is very broken
-      if test "$host_cpu" != ia64; then
-	ld_shlibs_GCJ=no
-	cat <<EOF 1>&2
 
-*** Warning: the GNU linker, at least up to release 2.9.1, is reported
-*** to be unable to reliably create shared libraries on AIX.
-*** Therefore, libtool is disabling shared libraries support.  If you
-*** really care for shared libraries, you may want to modify your PATH
-*** so that a non-GNU linker is found, and then restart.
 
-EOF
-      fi
-      ;;
 
-    amigaos*)
-      archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-      hardcode_libdir_flag_spec_GCJ='-L$libdir'
-      hardcode_minus_L_GCJ=yes
-
-      # Samuel A. Falvo II <kc5tja at dolphin.openprojects.net> reports
-      # that the semantics of dynamic libraries on AmigaOS, at least up
-      # to version 4, is to share data among multiple programs linked
-      # with the same dynamic library.  Since this doesn't match the
-      # behavior of shared libraries on other platforms, we can't use
-      # them.
-      ld_shlibs_GCJ=no
-      ;;
 
-    beos*)
-      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-	allow_undefined_flag_GCJ=unsupported
-	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
-	# support --undefined.  This deserves some investigation.  FIXME
-	archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-      else
-	ld_shlibs_GCJ=no
-      fi
-      ;;
 
-    cygwin* | mingw* | pw32*)
-      # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless,
-      # as there is no search path for DLLs.
-      hardcode_libdir_flag_spec_GCJ='-L$libdir'
-      allow_undefined_flag_GCJ=unsupported
-      always_export_symbols_GCJ=no
-      enable_shared_with_static_runtimes_GCJ=yes
-      export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
-
-      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
-        archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-	# If the export-symbols file already is a .def file (1st line
-	# is EXPORTS), use it as is; otherwise, prepend...
-	archive_expsym_cmds_GCJ='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
-	  cp $export_symbols $output_objdir/$soname.def;
-	else
-	  echo EXPORTS > $output_objdir/$soname.def;
-	  cat $export_symbols >> $output_objdir/$soname.def;
-	fi~
-	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
-      else
-	ld_shlibs_GCJ=no
-      fi
-      ;;
 
-    interix[3-9]*)
-      hardcode_direct_GCJ=no
-      hardcode_shlibpath_var_GCJ=no
-      hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
-      export_dynamic_flag_spec_GCJ='${wl}-E'
-      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
-      # Instead, shared libraries are loaded at an image base (0x10000000 by
-      # default) and relocated if they conflict, which is a slow very memory
-      # consuming and fragmenting process.  To avoid this, we pick a random,
-      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
-      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
-      archive_cmds_GCJ='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
-      ;;
 
-    gnu* | linux* | k*bsd*-gnu)
-      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-	tmp_addflag=
-	case $cc_basename,$host_cpu in
-	pgcc*)				# Portland Group C compiler
-	  whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_addflag=' $pic_flag'
-	  ;;
-	pgf77* | pgf90* | pgf95*)	# Portland Group f77 and f90 compilers
-	  whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_addflag=' $pic_flag -Mnomain' ;;
-	ecc*,ia64* | icc*,ia64*)		# Intel C compiler on ia64
-	  tmp_addflag=' -i_dynamic' ;;
-	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
-	  tmp_addflag=' -i_dynamic -nofor_main' ;;
-	ifc* | ifort*)			# Intel Fortran compiler
-	  tmp_addflag=' -nofor_main' ;;
-	esac
-	case `$CC -V 2>&1 | sed 5q` in
-	*Sun\ C*)			# Sun C 5.9
-	  whole_archive_flag_spec_GCJ='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-	  tmp_sharedflag='-G' ;;
-	*Sun\ F*)			# Sun Fortran 8.3
-	  tmp_sharedflag='-G' ;;
-	*)
-	  tmp_sharedflag='-shared' ;;
-	esac
-	archive_cmds_GCJ='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
 
-	if test $supports_anon_versioning = yes; then
-	  archive_expsym_cmds_GCJ='$echo "{ global:" > $output_objdir/$libname.ver~
-  cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
-  $echo "local: *; };" >> $output_objdir/$libname.ver~
-	  $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
-	fi
-	link_all_deplibs_GCJ=no
-      else
-	ld_shlibs_GCJ=no
-      fi
-      ;;
 
-    netbsd* | netbsdelf*-gnu)
-      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
-	archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
-	wlarc=
-      else
-	archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      fi
-      ;;
 
-    solaris*)
-      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
-	ld_shlibs_GCJ=no
-	cat <<EOF 1>&2
 
-*** Warning: The releases 2.8.* of the GNU linker cannot reliably
-*** create shared libraries on Solaris systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.9.1 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
 
-EOF
-      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-	archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      else
-	ld_shlibs_GCJ=no
-      fi
-      ;;
 
-    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
-      case `$LD -v 2>&1` in
-        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
-	ld_shlibs_GCJ=no
-	cat <<_LT_EOF 1>&2
 
-*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
-*** reliably create shared libraries on SCO systems.  Therefore, libtool
-*** is disabling shared libraries support.  We urge you to upgrade GNU
-*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
 
-_LT_EOF
-	;;
-	*)
-	  if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-	    hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
-	    archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
-	    archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
-	  else
-	    ld_shlibs_GCJ=no
-	  fi
-	;;
-      esac
-      ;;
 
-    sunos4*)
-      archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      wlarc=
-      hardcode_direct_GCJ=yes
-      hardcode_shlibpath_var_GCJ=no
-      ;;
 
-    *)
-      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
-	archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-	archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-      else
-	ld_shlibs_GCJ=no
-      fi
-      ;;
-    esac
 
-    if test "$ld_shlibs_GCJ" = no; then
-      runpath_var=
-      hardcode_libdir_flag_spec_GCJ=
-      export_dynamic_flag_spec_GCJ=
-      whole_archive_flag_spec_GCJ=
-    fi
-  else
-    # PORTME fill in a description of your system's linker (not GNU ld)
-    case $host_os in
-    aix3*)
-      allow_undefined_flag_GCJ=unsupported
-      always_export_symbols_GCJ=yes
-      archive_expsym_cmds_GCJ='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
-      # Note: this linker hardcodes the directories in LIBPATH if there
-      # are no directories specified by -L.
-      hardcode_minus_L_GCJ=yes
-      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
-	# Neither direct hardcoding nor static linking is supported with a
-	# broken collect2.
-	hardcode_direct_GCJ=unsupported
-      fi
-      ;;
 
-    aix[4-9]*)
-      if test "$host_cpu" = ia64; then
-	# On IA64, the linker does run time linking by default, so we don't
-	# have to do anything special.
-	aix_use_runtimelinking=no
-	exp_sym_flag='-Bexport'
-	no_entry_flag=""
-      else
-	# If we're using GNU nm, then we don't want the "-C" option.
-	# -C means demangle to AIX nm, but means don't demangle with GNU nm
-	if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
-	  export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
-	else
-	  export_symbols_cmds_GCJ='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
-	fi
-	aix_use_runtimelinking=no
 
-	# Test if we are trying to use run time linking or normal
-	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
-	# need to do runtime linking.
-	case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
-	  for ld_flag in $LDFLAGS; do
-  	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
-  	    aix_use_runtimelinking=yes
-  	    break
-  	  fi
-	  done
-	  ;;
-	esac
 
-	exp_sym_flag='-bexport'
-	no_entry_flag='-bnoentry'
-      fi
 
-      # When large executables or shared objects are built, AIX ld can
-      # have problems creating the table of contents.  If linking a library
-      # or program results in "error TOC overflow" add -mminimal-toc to
-      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
-      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
 
-      archive_cmds_GCJ=''
-      hardcode_direct_GCJ=yes
-      hardcode_libdir_separator_GCJ=':'
-      link_all_deplibs_GCJ=yes
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action_CXX=
+if test -n "$hardcode_libdir_flag_spec_CXX" ||
+   test -n "$runpath_var_CXX" ||
+   test "X$hardcode_automatic_CXX" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$hardcode_direct_CXX" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" != no &&
+     test "$hardcode_minus_L_CXX" != no; then
+    # Linking always hardcodes the temporary library directory.
+    hardcode_action_CXX=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    hardcode_action_CXX=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  hardcode_action_CXX=unsupported
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5
+$as_echo "$hardcode_action_CXX" >&6; }
+
+if test "$hardcode_action_CXX" = relink ||
+   test "$inherit_rpath_CXX" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+
+
 
-      if test "$GCC" = yes; then
-	case $host_os in aix4.[012]|aix4.[012].*)
-	# We only want to do this on AIX 4.2 and lower, the check
-	# below for broken collect2 doesn't work under 4.3+
-	  collect2name=`${CC} -print-prog-name=collect2`
-	  if test -f "$collect2name" && \
-  	   strings "$collect2name" | grep resolve_lib_name >/dev/null
-	  then
-  	  # We have reworked collect2
-  	  :
-	  else
-  	  # We have old collect2
-  	  hardcode_direct_GCJ=unsupported
-  	  # It fails to find uninstalled libraries when the uninstalled
-  	  # path is not listed in the libpath.  Setting hardcode_minus_L
-  	  # to unsupported forces relinking
-  	  hardcode_minus_L_GCJ=yes
-  	  hardcode_libdir_flag_spec_GCJ='-L$libdir'
-  	  hardcode_libdir_separator_GCJ=
-	  fi
-	  ;;
-	esac
-	shared_flag='-shared'
-	if test "$aix_use_runtimelinking" = yes; then
-	  shared_flag="$shared_flag "'${wl}-G'
-	fi
-      else
-	# not using gcc
-	if test "$host_cpu" = ia64; then
-  	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
-  	# chokes on -Wl,-G. The following line is correct:
-	  shared_flag='-G'
-	else
-	  if test "$aix_use_runtimelinking" = yes; then
-	    shared_flag='${wl}-G'
-	  else
-	    shared_flag='${wl}-bM:SRE'
-	  fi
-	fi
-      fi
 
-      # It seems that -bexpall does not export symbols beginning with
-      # underscore (_), so it is better to generate a list of symbols to export.
-      always_export_symbols_GCJ=yes
-      if test "$aix_use_runtimelinking" = yes; then
-	# Warning - without using the other runtime loading flags (-brtl),
-	# -berok will link without error, but may produce a broken library.
-	allow_undefined_flag_GCJ='-berok'
-       # Determine the default libpath from the value encoded in an empty executable.
-       cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-int
-main ()
-{
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
+  fi # test -n "$compiler"
 
-fi
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+  LDCXX=$LD
+  LD=$lt_save_LD
+  GCC=$lt_save_GCC
+  with_gnu_ld=$lt_save_with_gnu_ld
+  lt_cv_path_LDCXX=$lt_cv_path_LD
+  lt_cv_path_LD=$lt_save_path_LD
+  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+fi # test "$_lt_caught_CXX_error" != yes
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
-       hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath"
-	archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
-       else
-	if test "$host_cpu" = ia64; then
-	  hardcode_libdir_flag_spec_GCJ='${wl}-R $libdir:/usr/lib:/lib'
-	  allow_undefined_flag_GCJ="-z nodefs"
-	  archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
-	else
-	 # Determine the default libpath from the value encoded in an empty executable.
-	 cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-int
-main ()
-{
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest$ac_exeext &&
-       $as_test_x conftest$ac_exeext; then
-
-lt_aix_libpath_sed='
-    /Import File Strings/,/^$/ {
-	/^0/ {
-	    s/^0  *\(.*\)$/\1/
-	    p
-	}
-    }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# Check for a 64-bit object if we didn't find anything.
-if test -z "$aix_libpath"; then
-  aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-fi
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
 
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
-      conftest$ac_exeext conftest.$ac_ext
-if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
 
-	 hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath"
-	  # Warning - without using the other run time loading flags,
-	  # -berok will link without error, but may produce a broken library.
-	  no_undefined_flag_GCJ=' ${wl}-bernotok'
-	  allow_undefined_flag_GCJ=' ${wl}-berok'
-	  # Exported symbols can be pulled into shared objects from archives
-	  whole_archive_flag_spec_GCJ='$convenience'
-	  archive_cmds_need_lc_GCJ=yes
-	  # This is similar to how AIX traditionally builds its shared libraries.
-	  archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
-	fi
-      fi
-      ;;
 
-    amigaos*)
-      archive_cmds_GCJ='$rm $output_objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
-      hardcode_libdir_flag_spec_GCJ='-L$libdir'
-      hardcode_minus_L_GCJ=yes
-      # see comment about different semantics on the GNU ld section
-      ld_shlibs_GCJ=no
-      ;;
 
-    bsdi[45]*)
-      export_dynamic_flag_spec_GCJ=-rdynamic
-      ;;
 
-    cygwin* | mingw* | pw32*)
-      # When not using gcc, we currently assume that we are using
-      # Microsoft Visual C++.
-      # hardcode_libdir_flag_spec is actually meaningless, as there is
-      # no search path for DLLs.
-      hardcode_libdir_flag_spec_GCJ=' '
-      allow_undefined_flag_GCJ=unsupported
-      # Tell ltmain to make .lib files, not .a files.
-      libext=lib
-      # Tell ltmain to make .dll files, not .so files.
-      shrext_cmds=".dll"
-      # FIXME: Setting linknames here is a bad hack.
-      archive_cmds_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
-      # The linker will automatically build a .lib file if we build a DLL.
-      old_archive_From_new_cmds_GCJ='true'
-      # FIXME: Should let the user specify the lib program.
-      old_archive_cmds_GCJ='lib -OUT:$oldlib$oldobjs$old_deplibs'
-      fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`'
-      enable_shared_with_static_runtimes_GCJ=yes
-      ;;
 
-    darwin* | rhapsody*)
-      case $host_os in
-        rhapsody* | darwin1.[012])
-         allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress'
-         ;;
-       *) # Darwin 1.3 on
-         if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
-           allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
-         else
-           case ${MACOSX_DEPLOYMENT_TARGET} in
-             10.[012])
-               allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
-               ;;
-             10.*)
-               allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup'
-               ;;
-           esac
-         fi
-         ;;
-      esac
-      archive_cmds_need_lc_GCJ=no
-      hardcode_direct_GCJ=no
-      hardcode_automatic_GCJ=yes
-      hardcode_shlibpath_var_GCJ=unsupported
-      whole_archive_flag_spec_GCJ=''
-      link_all_deplibs_GCJ=yes
-    if test "$GCC" = yes ; then
-    	output_verbose_link_cmd='echo'
-        archive_cmds_GCJ="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
-        module_cmds_GCJ="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
-        archive_expsym_cmds_GCJ="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
-        module_expsym_cmds_GCJ="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
-    else
-      case $cc_basename in
-        xlc*)
-         output_verbose_link_cmd='echo'
-         archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
-         module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
-          # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
-         archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-          module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[    ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag  -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
-          ;;
-       *)
-         ld_shlibs_GCJ=no
-          ;;
-      esac
-    fi
-      ;;
 
-    dgux*)
-      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_libdir_flag_spec_GCJ='-L$libdir'
-      hardcode_shlibpath_var_GCJ=no
-      ;;
 
-    freebsd1*)
-      ld_shlibs_GCJ=no
-      ;;
+        ac_config_commands="$ac_config_commands libtool"
 
-    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
-    # support.  Future versions do this automatically, but an explicit c++rt0.o
-    # does not break anything, and helps significantly (at the cost of a little
-    # extra space).
-    freebsd2.2*)
-      archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
-      hardcode_libdir_flag_spec_GCJ='-R$libdir'
-      hardcode_direct_GCJ=yes
-      hardcode_shlibpath_var_GCJ=no
-      ;;
 
-    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
-    freebsd2*)
-      archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_direct_GCJ=yes
-      hardcode_minus_L_GCJ=yes
-      hardcode_shlibpath_var_GCJ=no
-      ;;
 
-    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
-    freebsd* | dragonfly*)
-      archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
-      hardcode_libdir_flag_spec_GCJ='-R$libdir'
-      hardcode_direct_GCJ=yes
-      hardcode_shlibpath_var_GCJ=no
-      ;;
 
-    hpux9*)
-      if test "$GCC" = yes; then
-	archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      else
-	archive_cmds_GCJ='$rm $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
-      fi
-      hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
-      hardcode_libdir_separator_GCJ=:
-      hardcode_direct_GCJ=yes
+# Only expand once:
 
-      # hardcode_minus_L: Not really in the search PATH,
-      # but as the default location of the library.
-      hardcode_minus_L_GCJ=yes
-      export_dynamic_flag_spec_GCJ='${wl}-E'
-      ;;
 
-    hpux10*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
-      fi
-      if test "$with_gnu_ld" = no; then
-	hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
-	hardcode_libdir_separator_GCJ=:
 
-	hardcode_direct_GCJ=yes
-	export_dynamic_flag_spec_GCJ='${wl}-E'
+# newer libtool...
 
-	# hardcode_minus_L: Not really in the search PATH,
-	# but as the default location of the library.
-	hardcode_minus_L_GCJ=yes
-      fi
-      ;;
 
-    hpux11*)
-      if test "$GCC" = yes -a "$with_gnu_ld" = no; then
-	case $host_cpu in
-	hppa*64*)
-	  archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	ia64*)
-	  archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	  archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	esac
-      else
-	case $host_cpu in
-	hppa*64*)
-	  archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	ia64*)
-	  archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	*)
-	  archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-	  ;;
-	esac
-      fi
-      if test "$with_gnu_ld" = no; then
-	hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
-	hardcode_libdir_separator_GCJ=:
 
-	case $host_cpu in
-	hppa*64*|ia64*)
-	  hardcode_libdir_flag_spec_ld_GCJ='+b $libdir'
-	  hardcode_direct_GCJ=no
-	  hardcode_shlibpath_var_GCJ=no
-	  ;;
-	*)
-	  hardcode_direct_GCJ=yes
-	  export_dynamic_flag_spec_GCJ='${wl}-E'
 
-	  # hardcode_minus_L: Not really in the search PATH,
-	  # but as the default location of the library.
-	  hardcode_minus_L_GCJ=yes
-	  ;;
-	esac
-      fi
-      ;;
 
-    irix5* | irix6* | nonstopux*)
-      if test "$GCC" = yes; then
-	archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-      else
-	archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-	hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir'
-      fi
-      hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
-      hardcode_libdir_separator_GCJ=:
-      link_all_deplibs_GCJ=yes
-      ;;
 
-    netbsd* | netbsdelf*-gnu)
-      if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
-	archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'  # a.out
-      else
-	archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
-      fi
-      hardcode_libdir_flag_spec_GCJ='-R$libdir'
-      hardcode_direct_GCJ=yes
-      hardcode_shlibpath_var_GCJ=no
-      ;;
+# Machine characteristics
 
-    newsos6)
-      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_direct_GCJ=yes
-      hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
-      hardcode_libdir_separator_GCJ=:
-      hardcode_shlibpath_var_GCJ=no
-      ;;
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of char" >&5
+$as_echo_n "checking size of char... " >&6; }
+if ${ac_cv_sizeof_char+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (char))" "ac_cv_sizeof_char"        "$ac_includes_default"; then :
 
-    openbsd*)
-      if test -f /usr/libexec/ld.so; then
-	hardcode_direct_GCJ=yes
-	hardcode_shlibpath_var_GCJ=no
-	if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-	  archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	  archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
-	  hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
-	  export_dynamic_flag_spec_GCJ='${wl}-E'
-	else
-	  case $host_os in
-	   openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
-	     archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
-	     hardcode_libdir_flag_spec_GCJ='-R$libdir'
-	     ;;
-	   *)
-	     archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
-	     hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
-	     ;;
-	  esac
-        fi
-      else
-	ld_shlibs_GCJ=no
-      fi
-      ;;
+else
+  if test "$ac_cv_type_char" = 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 77 "cannot compute sizeof (char)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_char=0
+   fi
+fi
 
-    os2*)
-      hardcode_libdir_flag_spec_GCJ='-L$libdir'
-      hardcode_minus_L_GCJ=yes
-      allow_undefined_flag_GCJ=unsupported
-      archive_cmds_GCJ='$echo "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$echo DATA >> $output_objdir/$libname.def~$echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~$echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
-      old_archive_From_new_cmds_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
-      ;;
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_char" >&5
+$as_echo "$ac_cv_sizeof_char" >&6; }
 
-    osf3*)
-      if test "$GCC" = yes; then
-	allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-      else
-	allow_undefined_flag_GCJ=' -expect_unresolved \*'
-	archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-      fi
-      hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
-      hardcode_libdir_separator_GCJ=:
-      ;;
 
-    osf4* | osf5*)	# as osf3* with the addition of -msym flag
-      if test "$GCC" = yes; then
-	allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*'
-	archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
-	hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
-      else
-	allow_undefined_flag_GCJ=' -expect_unresolved \*'
-	archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
-	archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
-	$LD -shared${allow_undefined_flag} -input $lib.exp $linker_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~$rm $lib.exp'
 
-	# Both c and cxx compiler support -rpath directly
-	hardcode_libdir_flag_spec_GCJ='-rpath $libdir'
-      fi
-      hardcode_libdir_separator_GCJ=:
-      ;;
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_CHAR $ac_cv_sizeof_char
+_ACEOF
 
-    solaris*)
-      no_undefined_flag_GCJ=' -z text'
-      if test "$GCC" = yes; then
-	wlarc='${wl}'
-	archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-	  $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
-      else
-	wlarc=''
-	archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
-  	$LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$rm $lib.exp'
-      fi
-      hardcode_libdir_flag_spec_GCJ='-R$libdir'
-      hardcode_shlibpath_var_GCJ=no
-      case $host_os in
-      solaris2.[0-5] | solaris2.[0-5].*) ;;
-      *)
-	# The compiler driver will combine and reorder linker options,
-	# but understands `-z linker_flag'.  GCC discards it without `$wl',
-	# but is careful enough not to reorder.
- 	# Supported since Solaris 2.6 (maybe 2.5.1?)
-	if test "$GCC" = yes; then
-	  whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
-	else
-	  whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract'
-	fi
-	;;
-      esac
-      link_all_deplibs_GCJ=yes
-      ;;
 
-    sunos4*)
-      if test "x$host_vendor" = xsequent; then
-	# Use $CC to link under sequent, because it throws in some extra .o
-	# files that make .init and .fini sections work.
-	archive_cmds_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
-      fi
-      hardcode_libdir_flag_spec_GCJ='-L$libdir'
-      hardcode_direct_GCJ=yes
-      hardcode_minus_L_GCJ=yes
-      hardcode_shlibpath_var_GCJ=no
-      ;;
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5
+$as_echo_n "checking size of short... " >&6; }
+if ${ac_cv_sizeof_short+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_short" = 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 77 "cannot compute sizeof (short)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_short=0
+   fi
+fi
 
-    sysv4)
-      case $host_vendor in
-	sni)
-	  archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  hardcode_direct_GCJ=yes # is this really true???
-	;;
-	siemens)
-	  ## LD is ld it makes a PLAMLIB
-	  ## CC just makes a GrossModule.
-	  archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags'
-	  reload_cmds_GCJ='$CC -r -o $output$reload_objs'
-	  hardcode_direct_GCJ=no
-        ;;
-	motorola)
-	  archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	  hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie
-	;;
-      esac
-      runpath_var='LD_RUN_PATH'
-      hardcode_shlibpath_var_GCJ=no
-      ;;
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5
+$as_echo "$ac_cv_sizeof_short" >&6; }
 
-    sysv4.3*)
-      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_shlibpath_var_GCJ=no
-      export_dynamic_flag_spec_GCJ='-Bexport'
-      ;;
 
-    sysv4*MP*)
-      if test -d /usr/nec; then
-	archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-	hardcode_shlibpath_var_GCJ=no
-	runpath_var=LD_RUN_PATH
-	hardcode_runpath_var=yes
-	ld_shlibs_GCJ=yes
-      fi
-      ;;
 
-    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
-      no_undefined_flag_GCJ='${wl}-z,text'
-      archive_cmds_need_lc_GCJ=no
-      hardcode_shlibpath_var_GCJ=no
-      runpath_var='LD_RUN_PATH'
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_SHORT $ac_cv_sizeof_short
+_ACEOF
 
-      if test "$GCC" = yes; then
-	archive_cmds_GCJ='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	archive_cmds_GCJ='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
-      fi
-      ;;
 
-    sysv5* | sco3.2v5* | sco5v6*)
-      # Note: We can NOT use -z defs as we might desire, because we do not
-      # link with -lc, and that would cause any symbols used from libc to
-      # always be unresolved, which means just about no library would
-      # ever link correctly.  If we're not using GNU ld we use -z text
-      # though, which does catch some bad symbols but isn't as heavy-handed
-      # as -z defs.
-      no_undefined_flag_GCJ='${wl}-z,text'
-      allow_undefined_flag_GCJ='${wl}-z,nodefs'
-      archive_cmds_need_lc_GCJ=no
-      hardcode_shlibpath_var_GCJ=no
-      hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
-      hardcode_libdir_separator_GCJ=':'
-      link_all_deplibs_GCJ=yes
-      export_dynamic_flag_spec_GCJ='${wl}-Bexport'
-      runpath_var='LD_RUN_PATH'
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5
+$as_echo_n "checking size of int... " >&6; }
+if ${ac_cv_sizeof_int+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int"        "$ac_includes_default"; then :
 
-      if test "$GCC" = yes; then
-	archive_cmds_GCJ='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-      else
-	archive_cmds_GCJ='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-	archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
-      fi
-      ;;
+else
+  if test "$ac_cv_type_int" = 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 77 "cannot compute sizeof (int)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_int=0
+   fi
+fi
 
-    uts4*)
-      archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
-      hardcode_libdir_flag_spec_GCJ='-L$libdir'
-      hardcode_shlibpath_var_GCJ=no
-      ;;
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5
+$as_echo "$ac_cv_sizeof_int" >&6; }
 
-    *)
-      ld_shlibs_GCJ=no
-      ;;
-    esac
-  fi
 
-{ echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5
-echo "${ECHO_T}$ld_shlibs_GCJ" >&6; }
-test "$ld_shlibs_GCJ" = no && can_build_shared=no
 
-#
-# Do we need to explicitly link libc?
-#
-case "x$archive_cmds_need_lc_GCJ" in
-x|xyes)
-  # Assume -lc should be added
-  archive_cmds_need_lc_GCJ=yes
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_INT $ac_cv_sizeof_int
+_ACEOF
 
-  if test "$enable_shared" = yes && test "$GCC" = yes; then
-    case $archive_cmds_GCJ in
-    *'~'*)
-      # FIXME: we may have to deal with multi-command sequences.
-      ;;
-    '$CC '*)
-      # Test whether the compiler implicitly links with -lc since on some
-      # systems, -lgcc has to come before -lc. If gcc already passes -lc
-      # to ld, don't add -lc before -lgcc.
-      { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
-echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
-      $rm conftest*
-      echo "$lt_simple_compile_test_code" > conftest.$ac_ext
 
-      if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } 2>conftest.err; then
-        soname=conftest
-        lib=conftest
-        libobjs=conftest.$ac_objext
-        deplibs=
-        wl=$lt_prog_compiler_wl_GCJ
-	pic_flag=$lt_prog_compiler_pic_GCJ
-        compiler_flags=-v
-        linker_flags=-v
-        verstring=
-        output_objdir=.
-        libname=conftest
-        lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ
-        allow_undefined_flag_GCJ=
-        if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
-  (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-        then
-	  archive_cmds_need_lc_GCJ=no
-        else
-	  archive_cmds_need_lc_GCJ=yes
-        fi
-        allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag
-      else
-        cat conftest.err 1>&5
-      fi
-      $rm conftest*
-      { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5
-echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6; }
-      ;;
-    esac
-  fi
-  ;;
-esac
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5
+$as_echo_n "checking size of long... " >&6; }
+if ${ac_cv_sizeof_long+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long"        "$ac_includes_default"; then :
 
-{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
-echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
-library_names_spec=
-libname_spec='lib$name'
-soname_spec=
-shrext_cmds=".so"
-postinstall_cmds=
-postuninstall_cmds=
-finish_cmds=
-finish_eval=
-shlibpath_var=
-shlibpath_overrides_runpath=unknown
-version_type=none
-dynamic_linker="$host_os ld.so"
-sys_lib_dlsearch_path_spec="/lib /usr/lib"
+else
+  if test "$ac_cv_type_long" = 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 77 "cannot compute sizeof (long)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_long=0
+   fi
+fi
 
-need_lib_prefix=unknown
-hardcode_into_libs=no
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5
+$as_echo "$ac_cv_sizeof_long" >&6; }
 
-# when you set need_version to no, make sure it does not cause -set_version
-# flags to be left without arguments
-need_version=unknown
 
-case $host_os in
-aix3*)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
-  shlibpath_var=LIBPATH
 
-  # AIX 3 has no versioning support, so we append a major version to the name.
-  soname_spec='${libname}${release}${shared_ext}$major'
-  ;;
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+_ACEOF
 
-aix[4-9]*)
-  version_type=linux
-  need_lib_prefix=no
-  need_version=no
-  hardcode_into_libs=yes
-  if test "$host_cpu" = ia64; then
-    # AIX 5 supports IA64
-    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
-    shlibpath_var=LD_LIBRARY_PATH
-  else
-    # With GCC up to 2.95.x, collect2 would create an import file
-    # for dependence libraries.  The import file would start with
-    # the line `#! .'.  This would cause the generated library to
-    # depend on `.', always an invalid library.  This was fixed in
-    # development snapshots of GCC prior to 3.0.
-    case $host_os in
-      aix4 | aix4.[01] | aix4.[01].*)
-      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
-	   echo ' yes '
-	   echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
-	:
-      else
-	can_build_shared=no
-      fi
-      ;;
-    esac
-    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
-    # soname into executable. Probably we can add versioning support to
-    # collect2, so additional links can be useful in future.
-    if test "$aix_use_runtimelinking" = yes; then
-      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
-      # instead of lib<name>.a to let people know that these are not
-      # typical AIX shared libraries.
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    else
-      # We preserve .a as extension for shared libraries through AIX4.2
-      # and later when we are not doing run time linking.
-      library_names_spec='${libname}${release}.a $libname.a'
-      soname_spec='${libname}${release}${shared_ext}$major'
-    fi
-    shlibpath_var=LIBPATH
-  fi
-  ;;
 
-amigaos*)
-  library_names_spec='$libname.ixlibrary $libname.a'
-  # Create ${libname}_ixlibrary.a entries in /sys/libs.
-  finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
-  ;;
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
+$as_echo_n "checking size of long long... " >&6; }
+if ${ac_cv_sizeof_long_long+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long"        "$ac_includes_default"; then :
 
-beos*)
-  library_names_spec='${libname}${shared_ext}'
-  dynamic_linker="$host_os ld.so"
-  shlibpath_var=LIBRARY_PATH
-  ;;
+else
+  if test "$ac_cv_type_long_long" = 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 77 "cannot compute sizeof (long long)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_long_long=0
+   fi
+fi
 
-bsdi[45]*)
-  version_type=linux
-  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'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
-  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
-  # the default ld.so.conf also contains /usr/contrib/lib and
-  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
-  # libtool to hard-code these into programs
-  ;;
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5
+$as_echo "$ac_cv_sizeof_long_long" >&6; }
 
-cygwin* | mingw* | pw32*)
-  version_type=windows
-  shrext_cmds=".dll"
-  need_version=no
-  need_lib_prefix=no
 
-  case $GCC,$host_os in
-  yes,cygwin* | yes,mingw* | yes,pw32*)
-    library_names_spec='$libname.dll.a'
-    # DLL is installed to $(libdir)/../bin by postinstall_cmds
-    postinstall_cmds='base_file=`basename \${file}`~
-      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
-      dldir=$destdir/`dirname \$dlpath`~
-      test -d \$dldir || mkdir -p \$dldir~
-      $install_prog $dir/$dlname \$dldir/$dlname~
-      chmod a+x \$dldir/$dlname'
-    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
-      dlpath=$dir/\$dldll~
-       $rm \$dlpath'
-    shlibpath_overrides_runpath=yes
 
-    case $host_os in
-    cygwin*)
-      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
-      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
-      ;;
-    mingw*)
-      # MinGW DLLs use traditional 'lib' prefix
-      soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
-      if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
-        # It is most probably a Windows format PATH printed by
-        # mingw gcc, but we are running on Cygwin. Gcc prints its search
-        # path with ; separators, and with drive letters. We can handle the
-        # drive letters (cygwin fileutils understands them), so leave them,
-        # especially as we might pass files found there to a mingw objdump,
-        # which wouldn't understand a cygwinified path. Ahh.
-        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
-      else
-        sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | $SED  -e "s/$PATH_SEPARATOR/ /g"`
-      fi
-      ;;
-    pw32*)
-      # pw32 DLLs use 'pw' prefix rather than 'lib'
-      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
-      ;;
-    esac
-    ;;
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
+_ACEOF
+
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of __int64" >&5
+$as_echo_n "checking size of __int64... " >&6; }
+if ${ac_cv_sizeof___int64+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_cxx_compute_int "$LINENO" "(long int) (sizeof (__int64))" "ac_cv_sizeof___int64"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type___int64" = 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 77 "cannot compute sizeof (__int64)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof___int64=0
+   fi
+fi
 
-  *)
-    library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
-    ;;
-  esac
-  dynamic_linker='Win32 ld.exe'
-  # FIXME: first we should search . and the directory the executable is in
-  shlibpath_var=PATH
-  ;;
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof___int64" >&5
+$as_echo "$ac_cv_sizeof___int64" >&6; }
 
-darwin* | rhapsody*)
-  dynamic_linker="$host_os dyld"
-  version_type=darwin
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
-  soname_spec='${libname}${release}${major}$shared_ext'
-  shlibpath_overrides_runpath=yes
-  shlibpath_var=DYLD_LIBRARY_PATH
-  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
 
-  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
-  ;;
 
-dgux*)
-  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
-  ;;
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF___INT64 $ac_cv_sizeof___int64
+_ACEOF
 
-freebsd1*)
-  dynamic_linker=no
-  ;;
 
-freebsd* | dragonfly*)
-  # DragonFly does not have aout.  When/if they implement a new
-  # versioning mechanism, adjust this.
-  if test -x /usr/bin/objformat; then
-    objformat=`/usr/bin/objformat`
-  else
-    case $host_os in
-    freebsd[123]*) objformat=aout ;;
-    *) objformat=elf ;;
-    esac
-  fi
-  version_type=freebsd-$objformat
-  case $version_type in
-    freebsd-elf*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-      need_version=no
-      need_lib_prefix=no
-      ;;
-    freebsd-*)
-      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
-      need_version=yes
-      ;;
-  esac
-  shlibpath_var=LD_LIBRARY_PATH
-  case $host_os in
-  freebsd2*)
-    shlibpath_overrides_runpath=yes
-    ;;
-  freebsd3.[01]* | freebsdelf3.[01]*)
-    shlibpath_overrides_runpath=yes
-    hardcode_into_libs=yes
-    ;;
-  freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
-  freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
-    shlibpath_overrides_runpath=no
-    hardcode_into_libs=yes
-    ;;
-  *) # from 4.6 on, and DragonFly
-    shlibpath_overrides_runpath=yes
-    hardcode_into_libs=yes
-    ;;
-  esac
-  ;;
 
-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
-  hardcode_into_libs=yes
-  ;;
+# Checks for header files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
 
-hpux9* | hpux10* | hpux11*)
-  # Give a soname corresponding to the major version so that dld.sl refuses to
-  # link against other versions.
-  version_type=sunos
-  need_lib_prefix=no
-  need_version=no
-  case $host_cpu in
-  ia64*)
-    shrext_cmds='.so'
-    hardcode_into_libs=yes
-    dynamic_linker="$host_os dld.so"
-    shlibpath_var=LD_LIBRARY_PATH
-    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    if test "X$HPUX_IA64_MODE" = X32; then
-      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
-    else
-      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
-    fi
-    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
-    ;;
-   hppa*64*)
-     shrext_cmds='.sl'
-     hardcode_into_libs=yes
-     dynamic_linker="$host_os dld.sl"
-     shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
-     shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
-     library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-     soname_spec='${libname}${release}${shared_ext}$major'
-     sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
-     sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
-     ;;
-   *)
-    shrext_cmds='.sl'
-    dynamic_linker="$host_os dld.sl"
-    shlibpath_var=SHLIB_PATH
-    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    ;;
-  esac
-  # HP-UX runs *really* slowly unless shared libraries are mode 555.
-  postinstall_cmds='chmod 555 $lib'
-  ;;
+int
+main ()
+{
 
-interix[3-9]*)
-  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'
-  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  hardcode_into_libs=yes
-  ;;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_header_stdc=yes
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
-irix5* | irix6* | nonstopux*)
-  case $host_os in
-    nonstopux*) version_type=nonstopux ;;
-    *)
-	if test "$lt_cv_prog_gnu_ld" = yes; then
-		version_type=linux
-	else
-		version_type=irix
-	fi ;;
-  esac
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
-  case $host_os in
-  irix5* | nonstopux*)
-    libsuff= shlibsuff=
-    ;;
-  *)
-    case $LD in # libtool.m4 will add one of these switches to LD
-    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
-      libsuff= shlibsuff= libmagic=32-bit;;
-    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
-      libsuff=32 shlibsuff=N32 libmagic=N32;;
-    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
-      libsuff=64 shlibsuff=64 libmagic=64-bit;;
-    *) libsuff= shlibsuff= libmagic=never-match;;
-    esac
-    ;;
-  esac
-  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
-  shlibpath_overrides_runpath=no
-  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
-  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
-  hardcode_into_libs=yes
-  ;;
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <string.h>
 
-# No shared lib support for Linux oldld, aout, or coff.
-linux*oldld* | linux*aout* | linux*coff*)
-  dynamic_linker=no
-  ;;
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then :
 
-# This must be Linux ELF.
-linux* | k*bsd*-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'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=no
-  # This implies no fast_install, which is unacceptable.
-  # Some rework will be needed to allow for fast_install
-  # before this can be enabled.
-  hardcode_into_libs=yes
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then :
+
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then :
+  :
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_run "$LINENO"; then :
 
-  # Append ld.so.conf contents to the search path
-  if test -f /etc/ld.so.conf; then
-    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ 	]*hwcap[ 	]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
-    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
-  fi
+else
+  ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
 
-  # We used to test for /lib/ld.so.1 and disable shared libraries on
-  # powerpc, because MkLinux only supported shared libraries with the
-  # GNU dynamic linker.  Since this was broken with cross compilers,
-  # most powerpc-linux boxes support dynamic linking these days and
-  # people can always --disable-shared, the test was removed, and we
-  # assume the GNU/Linux dynamic linker is in use.
-  dynamic_linker='GNU/Linux ld.so'
-  ;;
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
 
-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'
-  ;;
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
 
-netbsd*)
-  version_type=sunos
-  need_lib_prefix=no
-  need_version=no
-  if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-    dynamic_linker='NetBSD (a.out) ld.so'
-  else
-    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
-    soname_spec='${libname}${release}${shared_ext}$major'
-    dynamic_linker='NetBSD ld.elf_so'
-  fi
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  hardcode_into_libs=yes
-  ;;
+fi
 
-newsos6)
-  version_type=linux
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  ;;
+for ac_header in float.h limits.h stddef.h stdlib.h string.h sys/time.h stdint.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
 
-nto-qnx*)
-  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=yes
-  ;;
+fi
 
-openbsd*)
-  version_type=sunos
-  sys_lib_dlsearch_path_spec="/usr/lib"
-  need_lib_prefix=no
-  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
-  case $host_os in
-    openbsd3.3 | openbsd3.3.*) need_version=yes ;;
-    *)                         need_version=no  ;;
-  esac
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
-    case $host_os in
-      openbsd2.[89] | openbsd2.[89].*)
-	shlibpath_overrides_runpath=no
-	;;
-      *)
-	shlibpath_overrides_runpath=yes
-	;;
-      esac
-  else
-    shlibpath_overrides_runpath=yes
-  fi
-  ;;
+done
 
-os2*)
-  libname_spec='$name'
-  shrext_cmds=".dll"
-  need_lib_prefix=no
-  library_names_spec='$libname${shared_ext} $libname.a'
-  dynamic_linker='OS/2 ld.exe'
-  shlibpath_var=LIBPATH
-  ;;
 
-osf3* | osf4* | osf5*)
-  version_type=osf
-  need_lib_prefix=no
-  need_version=no
-  soname_spec='${libname}${release}${shared_ext}$major'
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
-  shlibpath_var=LD_LIBRARY_PATH
-  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
-  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
-  ;;
 
-rdos*)
-  dynamic_linker=no
-  ;;
+# check endianness of the architecture
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
+$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
+if ${ac_cv_c_bigendian+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_c_bigendian=unknown
+    # See if we're dealing with a universal compiler.
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#ifndef __APPLE_CC__
+	       not a universal capable compiler
+	     #endif
+	     typedef int dummy;
 
-solaris*)
-  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=yes
-  hardcode_into_libs=yes
-  # ldd complains unless libraries are executable
-  postinstall_cmds='chmod +x $lib'
-  ;;
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+	# Check for potential -arch flags.  It is not universal unless
+	# there are at least two -arch flags with different values.
+	ac_arch=
+	ac_prev=
+	for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
+	 if test -n "$ac_prev"; then
+	   case $ac_word in
+	     i?86 | x86_64 | ppc | ppc64)
+	       if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
+		 ac_arch=$ac_word
+	       else
+		 ac_cv_c_bigendian=universal
+		 break
+	       fi
+	       ;;
+	   esac
+	   ac_prev=
+	 elif test "x$ac_word" = "x-arch"; then
+	   ac_prev=arch
+	 fi
+       done
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    if test $ac_cv_c_bigendian = unknown; then
+      # See if sys/param.h defines the BYTE_ORDER macro.
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+	     #include <sys/param.h>
 
-sunos4*)
-  version_type=sunos
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
-  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
-  shlibpath_var=LD_LIBRARY_PATH
-  shlibpath_overrides_runpath=yes
-  if test "$with_gnu_ld" = yes; then
-    need_lib_prefix=no
-  fi
-  need_version=yes
-  ;;
+int
+main ()
+{
+#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
+		     && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
+		     && LITTLE_ENDIAN)
+	      bogus endian macros
+	     #endif
 
-sysv4 | sysv4.3*)
-  version_type=linux
-  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
-  case $host_vendor in
-    sni)
-      shlibpath_overrides_runpath=no
-      need_lib_prefix=no
-      export_dynamic_flag_spec='${wl}-Blargedynsym'
-      runpath_var=LD_RUN_PATH
-      ;;
-    siemens)
-      need_lib_prefix=no
-      ;;
-    motorola)
-      need_lib_prefix=no
-      need_version=no
-      shlibpath_overrides_runpath=no
-      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
-      ;;
-  esac
-  ;;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  # It does; now see whether it defined to BIG_ENDIAN or not.
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+		#include <sys/param.h>
 
-sysv4*MP*)
-  if test -d /usr/nec ;then
-    version_type=linux
-    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
-    soname_spec='$libname${shared_ext}.$major'
-    shlibpath_var=LD_LIBRARY_PATH
-  fi
-  ;;
+int
+main ()
+{
+#if BYTE_ORDER != BIG_ENDIAN
+		 not big endian
+		#endif
 
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
-  version_type=freebsd-elf
-  need_lib_prefix=no
-  need_version=no
-  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
-  soname_spec='${libname}${release}${shared_ext}$major'
-  shlibpath_var=LD_LIBRARY_PATH
-  hardcode_into_libs=yes
-  if test "$with_gnu_ld" = yes; then
-    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
-    shlibpath_overrides_runpath=no
-  else
-    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
-    shlibpath_overrides_runpath=yes
-    case $host_os in
-      sco3.2v5*)
-        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
-	;;
-    esac
-  fi
-  sys_lib_dlsearch_path_spec='/usr/lib'
-  ;;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_c_bigendian=yes
+else
+  ac_cv_c_bigendian=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    fi
+    if test $ac_cv_c_bigendian = unknown; then
+      # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <limits.h>
 
-uts4*)
-  version_type=linux
-  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
-  ;;
+int
+main ()
+{
+#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
+	      bogus endian macros
+	     #endif
 
-*)
-  dynamic_linker=no
-  ;;
-esac
-{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
-echo "${ECHO_T}$dynamic_linker" >&6; }
-test "$dynamic_linker" = no && can_build_shared=no
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  # It does; now see whether it defined to _BIG_ENDIAN or not.
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <limits.h>
 
-if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+int
+main ()
+{
+#ifndef _BIG_ENDIAN
+		 not big endian
+		#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  ac_cv_c_bigendian=yes
 else
-  lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"
+  ac_cv_c_bigendian=no
 fi
-
-sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
-if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+    fi
+    if test $ac_cv_c_bigendian = unknown; then
+      # Compile a test program.
+      if test "$cross_compiling" = yes; then :
+  # Try to guess by grepping values from an object file.
+	 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+short int ascii_mm[] =
+		  { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+		short int ascii_ii[] =
+		  { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+		int use_ascii (int i) {
+		  return ascii_mm[i] + ascii_ii[i];
+		}
+		short int ebcdic_ii[] =
+		  { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+		short int ebcdic_mm[] =
+		  { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+		int use_ebcdic (int i) {
+		  return ebcdic_mm[i] + ebcdic_ii[i];
+		}
+		extern int foo;
 
-sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
-
-variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
-if test "$GCC" = yes; then
-  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+int
+main ()
+{
+return use_ascii (foo) == use_ebcdic (foo);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+  if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
+	      ac_cv_c_bigendian=yes
+	    fi
+	    if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+	      if test "$ac_cv_c_bigendian" = unknown; then
+		ac_cv_c_bigendian=no
+	      else
+		# finding both strings is unlikely to happen, but who knows?
+		ac_cv_c_bigendian=unknown
+	      fi
+	    fi
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
 
-{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
-echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
-hardcode_action_GCJ=
-if test -n "$hardcode_libdir_flag_spec_GCJ" || \
-   test -n "$runpath_var_GCJ" || \
-   test "X$hardcode_automatic_GCJ" = "Xyes" ; then
+	     /* Are we little or big endian?  From Harbison&Steele.  */
+	     union
+	     {
+	       long int l;
+	       char c[sizeof (long int)];
+	     } u;
+	     u.l = 1;
+	     return u.c[sizeof (long int) - 1] == 1;
 
-  # We can hardcode non-existant directories.
-  if test "$hardcode_direct_GCJ" != no &&
-     # If the only mechanism to avoid hardcoding is shlibpath_var, we
-     # have to relink, otherwise we might link with an installed library
-     # when we should be linking with a yet-to-be-installed one
-     ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no &&
-     test "$hardcode_minus_L_GCJ" != no; then
-    # Linking always hardcodes the temporary library directory.
-    hardcode_action_GCJ=relink
-  else
-    # We can link without hardcoding, and we can hardcode nonexisting dirs.
-    hardcode_action_GCJ=immediate
-  fi
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_run "$LINENO"; then :
+  ac_cv_c_bigendian=no
 else
-  # We cannot hardcode anything, or else we can only hardcode existing
-  # directories.
-  hardcode_action_GCJ=unsupported
+  ac_cv_c_bigendian=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5
-echo "${ECHO_T}$hardcode_action_GCJ" >&6; }
 
-if test "$hardcode_action_GCJ" = relink; then
-  # Fast installation is not supported
-  enable_fast_install=no
-elif test "$shlibpath_overrides_runpath" = yes ||
-     test "$enable_shared" = no; then
-  # Fast installation is not necessary
-  enable_fast_install=needless
+    fi
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5
+$as_echo "$ac_cv_c_bigendian" >&6; }
+ case $ac_cv_c_bigendian in #(
+   yes)
 
+$as_echo "#define HAVE_BIG_ENDIAN 1" >>confdefs.h
+;; #(
+   no)
 
-# The else clause should only fire when bootstrapping the
-# libtool distribution, otherwise you forgot to ship ltmain.sh
-# with your package, and you will get complaints that there are
-# no rules to generate ltmain.sh.
-if test -f "$ltmain"; then
-  # See if we are running on zsh, and set the options which allow our commands through
-  # without removal of \ escapes.
-  if test -n "${ZSH_VERSION+set}" ; then
-    setopt NO_GLOB_SUBST
-  fi
-  # Now quote all the things that may contain metacharacters while being
-  # careful not to overquote the AC_SUBSTed values.  We take copies of the
-  # variables and quote the copies for generation of the libtool script.
-  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
-    SED SHELL STRIP \
-    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
-    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
-    deplibs_check_method reload_flag reload_cmds need_locks \
-    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
-    lt_cv_sys_global_symbol_to_c_name_address \
-    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
-    old_postinstall_cmds old_postuninstall_cmds \
-    compiler_GCJ \
-    CC_GCJ \
-    LD_GCJ \
-    lt_prog_compiler_wl_GCJ \
-    lt_prog_compiler_pic_GCJ \
-    lt_prog_compiler_static_GCJ \
-    lt_prog_compiler_no_builtin_flag_GCJ \
-    export_dynamic_flag_spec_GCJ \
-    thread_safe_flag_spec_GCJ \
-    whole_archive_flag_spec_GCJ \
-    enable_shared_with_static_runtimes_GCJ \
-    old_archive_cmds_GCJ \
-    old_archive_from_new_cmds_GCJ \
-    predep_objects_GCJ \
-    postdep_objects_GCJ \
-    predeps_GCJ \
-    postdeps_GCJ \
-    compiler_lib_search_path_GCJ \
-    compiler_lib_search_dirs_GCJ \
-    archive_cmds_GCJ \
-    archive_expsym_cmds_GCJ \
-    postinstall_cmds_GCJ \
-    postuninstall_cmds_GCJ \
-    old_archive_from_expsyms_cmds_GCJ \
-    allow_undefined_flag_GCJ \
-    no_undefined_flag_GCJ \
-    export_symbols_cmds_GCJ \
-    hardcode_libdir_flag_spec_GCJ \
-    hardcode_libdir_flag_spec_ld_GCJ \
-    hardcode_libdir_separator_GCJ \
-    hardcode_automatic_GCJ \
-    module_cmds_GCJ \
-    module_expsym_cmds_GCJ \
-    lt_cv_prog_compiler_c_o_GCJ \
-    fix_srcfile_path_GCJ \
-    exclude_expsyms_GCJ \
-    include_expsyms_GCJ; do
-
-    case $var in
-    old_archive_cmds_GCJ | \
-    old_archive_from_new_cmds_GCJ | \
-    archive_cmds_GCJ | \
-    archive_expsym_cmds_GCJ | \
-    module_cmds_GCJ | \
-    module_expsym_cmds_GCJ | \
-    old_archive_from_expsyms_cmds_GCJ | \
-    export_symbols_cmds_GCJ | \
-    extract_expsyms_cmds | reload_cmds | finish_cmds | \
-    postinstall_cmds | postuninstall_cmds | \
-    old_postinstall_cmds | old_postuninstall_cmds | \
-    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
-      # Double-quote double-evaled strings.
-      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
-      ;;
-    *)
-      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
-      ;;
-    esac
-  done
+$as_echo "#define HAVE_LITTLE_ENDIAN 1" >>confdefs.h
+ ;; #(
+   universal)
 
-  case $lt_echo in
-  *'\$0 --fallback-echo"')
-    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
-    ;;
-  esac
+$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
 
-cfgfile="$ofile"
+     ;; #(
+   *)
+     as_fn_error $? "unknown endianness
+ presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
+ esac
 
-  cat <<__EOF__ >> "$cfgfile"
-# ### BEGIN LIBTOOL TAG CONFIG: $tagname
 
-# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# Create some useful data types of fixed, known lengths
 
-# Shell to use when invoking shell scripts.
-SHELL=$lt_SHELL
+# We hereby assume that a character is always one byte
+LINBOX_INT8="char";
 
-# Whether or not to build shared libraries.
-build_libtool_libs=$enable_shared
+case $ac_cv_sizeof_char in
+  1)
+     TWO_BYTES=2;
+     FOUR_BYTES=4;
+     EIGHT_BYTES=8;
+     ;;
+  8)
+     TWO_BYTES=16;
+     FOUR_BYTES=32;
+     EIGHT_BYTES=64;
+esac
 
-# Whether or not to build static libraries.
-build_old_libs=$enable_static
+case $TWO_BYTES in
+  $ac_cv_sizeof_short)
+     LINBOX_INT16="short";
+     ;;
+  $ac_cv_sizeof_int)
+     LINBOX_INT16="int";
+     ;;
+esac
 
-# Whether or not to add -lc for building shared libraries.
-build_libtool_need_lc=$archive_cmds_need_lc_GCJ
+case $FOUR_BYTES in
+  $ac_cv_sizeof_short)
+     LINBOX_INT32="short";
+     ;;
+  $ac_cv_sizeof_int)
+     LINBOX_INT32="int";
+     ;;
+  $ac_cv_sizeof_long)
+     LINBOX_INT32="long";
+     ;;
+esac
 
-# Whether or not to disallow shared libs when runtime libs are static
-allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ
+case $EIGHT_BYTES in
+  $ac_cv_sizeof_short)
+     LINBOX_INT64="short";
+     ;;
+  $ac_cv_sizeof_int)
+     LINBOX_INT64="int";
+     ;;
+  $ac_cv_sizeof_long)
+     LINBOX_INT64="long";
+     ;;
+  $ac_cv_sizeof_long_long)
+     LINBOX_INT64="long long";
+     ;;
+  $ac_cv_sizeof___int64)
+     LINBOX_INT64="__int64";
+     ;;
+esac
 
-# Whether or not to optimize for fast installation.
-fast_install=$enable_fast_install
 
-# The host system.
-host_alias=$host_alias
-host=$host
-host_os=$host_os
+cat >>confdefs.h <<_ACEOF
+#define INT8 $LINBOX_INT8
+_ACEOF
 
-# The build system.
-build_alias=$build_alias
-build=$build
-build_os=$build_os
 
-# An echo program that does not interpret backslashes.
-echo=$lt_echo
+cat >>confdefs.h <<_ACEOF
+#define INT16 $LINBOX_INT16
+_ACEOF
 
-# The archiver.
-AR=$lt_AR
-AR_FLAGS=$lt_AR_FLAGS
 
-# A C compiler.
-LTCC=$lt_LTCC
+cat >>confdefs.h <<_ACEOF
+#define INT32 $LINBOX_INT32
+_ACEOF
 
-# LTCC compiler flags.
-LTCFLAGS=$lt_LTCFLAGS
 
-# A language-specific compiler.
-CC=$lt_compiler_GCJ
+cat >>confdefs.h <<_ACEOF
+#define INT64 $LINBOX_INT64
+_ACEOF
 
-# Is the compiler the GNU C compiler?
-with_gcc=$GCC_GCJ
 
-# An ERE matcher.
-EGREP=$lt_EGREP
+# Feature checks
 
-# The linker used to build libraries.
-LD=$lt_LD_GCJ
 
-# Whether we need hard or soft links.
-LN_S=$lt_LN_S
 
-# A BSD-compatible nm program.
-NM=$lt_NM
+# Check whether --with-default was given.
+if test "${with_default+set}" = set; then :
+  withval=$with_default; if test "$withval" = yes ; then
+			echo "Default path = /usr /usr/local "
+			DEFAULT_CHECKING_PATH="/usr /usr/local "
+	      else
+			echo "Default path = $withval /usr /usr/local "
+			DEFAULT_CHECKING_PATH="$withval /usr /usr/local "
+	     fi
 
-# A symbol stripping program
-STRIP=$lt_STRIP
+else
 
-# Used to examine libraries when file_magic_cmd begins "file"
-MAGIC_CMD=$MAGIC_CMD
+		echo "Default path = /usr /usr/local "
+		DEFAULT_CHECKING_PATH="/usr /usr/local "
 
-# Used on cygwin: DLL creation program.
-DLLTOOL="$DLLTOOL"
+fi
 
-# Used on cygwin: object dumper.
-OBJDUMP="$OBJDUMP"
 
-# Used on cygwin: assembler.
-AS="$AS"
 
-# The name of the directory that contains temporary libtool files.
-objdir=$objdir
 
-# How to create reloadable object files.
-reload_flag=$lt_reload_flag
-reload_cmds=$lt_reload_cmds
+# Check whether --with-all was given.
+if test "${with_all+set}" = set; then :
+  withval=$with_all; if test "$withval" = yes ; then
+			check_all="yes"
+			echo "Checking all external packages in ${DEFAULT_CHECKING_PATH}"
 
-# How to pass a linker flag through the compiler.
-wl=$lt_lt_prog_compiler_wl_GCJ
+	      elif test "$withval" != no ; then
+			check_all="yes"
+			DEFAULT_CHECKING_PATH="$withval ${DEFAULT_CHECKING_PATH}"
+			echo "Checking all external packages in ${DEFAULT_CHECKING_PATH}"
+	     fi
 
-# Object file suffix (normally "o").
-objext="$ac_objext"
+fi
 
-# Old archive suffix (normally "a").
-libext="$libext"
 
-# Shared library suffix (normally ".so").
-shrext_cmds='$shrext_cmds'
+if test -n "$check_all"; then
 
-# Executable file suffix (normally "").
-exeext="$exeext"
+	GMP_HOME_PATH="${DEFAULT_CHECKING_PATH}"
+	GIVARO_HOME_PATH="${DEFAULT_CHECKING_PATH}"
+	NTL_HOME_PATH="${DEFAULT_CHECKING_PATH}"
+	LIDIA_HOME_PATH="${DEFAULT_CHECKING_PATH}"
+	SACLIB_HOME_PATH="${DEFAULT_CHECKING_PATH}"
+	MAPLE_HOME_PATH="${DEFAULT_CHECKING_PATH} unknown"
+#	EXPAT_HOME_PATH="${DEFAULT_CHECKING_PATH}"
+	BLAS_HOME_PATH="${DEFAULT_CHECKING_PATH}"
+fi
 
-# Additional compiler flags for building library objects.
-pic_flag=$lt_lt_prog_compiler_pic_GCJ
-pic_mode=$pic_mode
 
-# What is the maximum length of a command?
-max_cmd_len=$lt_cv_sys_max_cmd_len
 
-# Does compiler simultaneously support -c and -o options?
-compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ
 
-# Must we lock files when doing compilation?
-need_locks=$lt_need_locks
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to compile the drivers" >&5
+$as_echo_n "checking whether to compile the drivers... " >&6; }
 
-# Do we need the lib prefix for modules?
-need_lib_prefix=$need_lib_prefix
+# Check whether --enable-drivers was given.
+if test "${enable_drivers+set}" = set; then :
+  enableval=$enable_drivers;
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+compile_drivers="yes"
 
-# Do we need a version for libraries?
-need_version=$need_version
+else
 
-# Whether dlopen is supported.
-dlopen_support=$enable_dlopen
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+compile_drivers="no"
 
-# Whether dlopen of programs is supported.
-dlopen_self=$enable_dlopen_self
+fi
 
-# Whether dlopen of statically linked programs is supported.
-dlopen_self_static=$enable_dlopen_self_static
+ if test "x$compile_drivers" = "xyes"; then
+  LINBOX_COMPILE_DRIVERS_TRUE=
+  LINBOX_COMPILE_DRIVERS_FALSE='#'
+else
+  LINBOX_COMPILE_DRIVERS_TRUE='#'
+  LINBOX_COMPILE_DRIVERS_FALSE=
+fi
 
-# Compiler flag to prevent dynamic linking.
-link_static_flag=$lt_lt_prog_compiler_static_GCJ
 
-# Compiler flag to turn off builtin functions.
-no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ
 
-# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
-# Compiler flag to generate shared objects directly from archives.
-whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ
 
-# Compiler flag to generate thread-safe objects.
-thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ
 
-# Library versioning type.
-version_type=$version_type
 
-# Format of library name prefix.
-libname_spec=$lt_libname_spec
 
-# List of archive names.  First name is the real one, the rest are links.
-# The last name is the one that the linker finds with -lNAME.
-library_names_spec=$lt_library_names_spec
+# Check whether --with-gmp was given.
+if test "${with_gmp+set}" = set; then :
+  withval=$with_gmp; if test "$withval" = yes ; then
+			GMP_HOME_PATH="${DEFAULT_CHECKING_PATH}"
+	         elif test "$withval" != no ; then
+			GMP_HOME_PATH="$withval ${DEFAULT_CHECKING_PATH}"
+	        fi
+else
+  GMP_HOME_PATH="${DEFAULT_CHECKING_PATH}"
+fi
 
-# The coded name of the library, if different from the real name.
-soname_spec=$lt_soname_spec
 
-# Commands used to build and install an old-style archive.
-RANLIB=$lt_RANLIB
-old_archive_cmds=$lt_old_archive_cmds_GCJ
-old_postinstall_cmds=$lt_old_postinstall_cmds
-old_postuninstall_cmds=$lt_old_postuninstall_cmds
+min_gmp_version=3.1.1
 
-# Create an old-style archive from a shared archive.
-old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ
+BACKUP_CXXFLAGS=${CXXFLAGS}
+BACKUP_LIBS=${LIBS}
 
-# Create a temporary old-style archive to link instead of a shared archive.
-old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GMP >= $min_gmp_version" >&5
+$as_echo_n "checking for GMP >= $min_gmp_version... " >&6; }
 
-# Commands used to build and install a shared archive.
-archive_cmds=$lt_archive_cmds_GCJ
-archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ
-postinstall_cmds=$lt_postinstall_cmds
-postuninstall_cmds=$lt_postuninstall_cmds
+for GMP_HOME in ${GMP_HOME_PATH}
+  do
+	if test -r "$GMP_HOME/include/gmp.h"; then
 
-# Commands used to build a loadable module (assumed same as above if empty)
-module_cmds=$lt_module_cmds_GCJ
-module_expsym_cmds=$lt_module_expsym_cmds_GCJ
+		if test "x$GMP_HOME" != "x/usr" -a "x$GMP_HOME" != "x/usr/local"; then
+			GMP_CFLAGS="-I${GMP_HOME}/include"
+			GMP_LIBS="-L${GMP_HOME}/lib -lgmpxx -lgmp"
+		else
+			GMP_CFLAGS=
+			GMP_LIBS="-lgmpxx -lgmp"
+		fi
 
-# Commands to strip libraries.
-old_striplib=$lt_old_striplib
-striplib=$lt_striplib
+		CXXFLAGS="${CXXFLAGS} ${GMP_CFLAGS}"
+		LIBS="${LIBS} ${GMP_LIBS}"
+
+		cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <gmp.h>
+int
+main ()
+{
+mpz_t a; mpz_init (a);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
 
-# Dependencies to place before the objects being linked to create a
-# shared library.
-predep_objects=$lt_predep_objects_GCJ
+        		if test "$cross_compiling" = yes; then :
 
-# Dependencies to place after the objects being linked to create a
-# shared library.
-postdep_objects=$lt_postdep_objects_GCJ
+				{ $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5
+$as_echo "unknown" >&6; }
+				echo "WARNING: You appear to be cross compiling, so there is no way to determine"
+				echo "whether your GMP version is new enough. I am assuming it is."
 
-# Dependencies to place before the objects being linked to create a
-# shared library.
-predeps=$lt_predeps_GCJ
 
-# Dependencies to place after the objects being linked to create a
-# shared library.
-postdeps=$lt_postdeps_GCJ
 
-# The directories searched by this compiler when creating a shared
-# library
-compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_GCJ
+$as_echo "#define HAVE_GMP 1" >>confdefs.h
 
-# The library search path used internally by the compiler when linking
-# a shared library.
-compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ
+				:
+				break
 
-# Method to check whether dependent libraries are shared objects.
-deplibs_check_method=$lt_deplibs_check_method
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <gmp.h>
+			 int main () {  if (__GNU_MP_VERSION < 3) return -1; else return 0; }
 
-# Command to use when deplibs_check_method == file_magic.
-file_magic_cmd=$lt_file_magic_cmd
+_ACEOF
+if ac_fn_cxx_try_run "$LINENO"; then :
 
-# Flag that allows shared libraries with undefined symbols to be built.
-allow_undefined_flag=$lt_allow_undefined_flag_GCJ
+				{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+$as_echo "found" >&6; }
 
-# Flag that forces no undefined symbols.
-no_undefined_flag=$lt_no_undefined_flag_GCJ
 
-# Commands used to finish a libtool library installation in a directory.
-finish_cmds=$lt_finish_cmds
 
-# Same as above, but a single script fragment to be evaled but not shown.
-finish_eval=$lt_finish_eval
+$as_echo "#define HAVE_GMP 1" >>confdefs.h
+
+				# See if we are running GMP 4.0
+	   			{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether GMP is 4.0 or greater" >&5
+$as_echo_n "checking whether GMP is 4.0 or greater... " >&6; }
+		   		if test "$cross_compiling" = yes; then :
+
+										{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <gmp.h>
+	    			int main () { if (__GNU_MP_VERSION < 4) return -1; else return 0; }
+
+_ACEOF
+if ac_fn_cxx_try_run "$LINENO"; then :
+
+					gmp_found="yes"
+					{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+					# See if GMP was compiled with --enable-cxx
+					{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether GMP was compiled with --enable-cxx" >&5
+$as_echo_n "checking whether GMP was compiled with --enable-cxx... " >&6; }
+					if test "$cross_compiling" = yes; then :
+
+												{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <gmpxx.h>
+					int main () { mpz_class a(2),b(3),c(5); if ( a+b == c ) return 0; else return -1; }
+
+_ACEOF
+if ac_fn_cxx_try_run "$LINENO"; then :
+
+						{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+						GMP_VERSION=""
+
 
-# Take the output of nm and produce a listing of raw symbols and C names.
-global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+else
 
-# Transform the output of nm in a proper C declaration
-global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+						gmp_found="no"
+						{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
-# Transform the output of nm in a C name address pair
-global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
 
-# This is the shared library runtime path variable.
-runpath_var=$runpath_var
 
-# This is the shared library path variable.
-shlibpath_var=$shlibpath_var
+else
 
-# Is shlibpath searched before the hard-coded library search path?
-shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+					{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 
-# How to hardcode a shared library path into an executable.
-hardcode_action=$hardcode_action_GCJ
+$as_echo "#define GMP_VERSION_3 1" >>confdefs.h
 
-# Whether we should hardcode library paths into libraries.
-hardcode_into_libs=$hardcode_into_libs
+					GMP_VERSION="-DGMP_VERSION_3"
 
-# Flag to hardcode \$libdir into a binary during linking.
-# This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_GCJ
 
-# If ld is used when linking, flag to hardcode \$libdir into
-# a binary during linking. This must work even if \$libdir does
-# not exist.
-hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
 
-# Whether we need a single -rpath flag with a separated argument.
-hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ
+				:
+				break
 
-# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
-# resulting binary.
-hardcode_direct=$hardcode_direct_GCJ
+else
 
-# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
-# resulting binary.
-hardcode_minus_L=$hardcode_minus_L_GCJ
+				gmp_problem="$gmp_problem $GMP_HOME"
+				unset GMP_CFLAGS
+				unset GMP_LIBS
 
-# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
-# the resulting binary.
-hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
 
-# Set to yes if building a shared library automatically hardcodes DIR into the library
-# and all subsequent libraries and executables linked against it.
-hardcode_automatic=$hardcode_automatic_GCJ
 
-# Variables whose values should be saved in libtool wrapper scripts and
-# restored at relink time.
-variables_saved_for_relink="$variables_saved_for_relink"
+else
 
-# Whether libtool must link a program against all its dependency libraries.
-link_all_deplibs=$link_all_deplibs_GCJ
+		gmp_found="no"
+		unset GMP_CFLAGS
+		unset GMP_LIBS
 
-# Compile-time system search path for libraries
-sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-# Run-time system search path for libraries
-sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+	else
+		gmp_found="no"
+	fi
+done
 
-# Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path=$lt_fix_srcfile_path
+if test "x$gmp_found" != "xyes"; then
+	if test -n "$gmp_problem"; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: problem" >&5
+$as_echo "problem" >&6; }
+		echo "Sorry, your GMP version is too old. Disabling."
+	elif test "x$gmp_found" != "xno"; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+	fi
+	echo '*******************************************************************************'
+echo ' ERROR: GMP not found!'
+echo
+echo ' GMP version 3.1.1 or greater with --enable-cxx is required for this library to compile. Please'
+echo ' make sure GMP is installed and specify its location with the option'
+echo ' --with-gmp=<prefix> when running configure.'
+echo '*******************************************************************************'
+exit 1
 
-# Set to yes if exported symbols are required.
-always_export_symbols=$always_export_symbols_GCJ
+fi
 
-# The commands to list exported symbols.
-export_symbols_cmds=$lt_export_symbols_cmds_GCJ
 
-# The commands to extract the exported symbol list from a shared archive.
-extract_expsyms_cmds=$lt_extract_expsyms_cmds
+CXXFLAGS=${BACKUP_CXXFLAGS}
+LIBS=${BACKUP_LIBS}
+#unset LD_LIBRARY_PATH
 
-# Symbols that should not be listed in the preloaded symbols.
-exclude_expsyms=$lt_exclude_expsyms_GCJ
 
-# Symbols that must always be exported.
-include_expsyms=$lt_include_expsyms_GCJ
 
-# ### END LIBTOOL TAG CONFIG: $tagname
 
-__EOF__
 
 
+# Check whether --with-iml was given.
+if test "${with_iml+set}" = set; then :
+  withval=$with_iml; if test "$withval" = yes ; then
+        IML_HOME_PATH="${DEFAULT_CHECKING_PATH}"
+        elif test "$withval" != no ; then
+        IML_HOME_PATH="$withval ${DEFAULT_CHECKING_PATH}"
+        fi
 else
-  # If there is no Makefile yet, we rely on a make rule to execute
-  # `config.status --recheck' to rerun these tests and create the
-  # libtool script then.
-  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
-  if test -f "$ltmain_in"; then
-    test -f Makefile && make "$ltmain"
-  fi
+  IML_HOME_PATH="${DEFAULT_CHECKING_PATH}"
 fi
 
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-CC="$lt_save_CC"
 
-	else
-	  tagname=""
-	fi
-	;;
+BACKUP_CXXFLAGS=${CXXFLAGS}
+BACKUP_LIBS=${LIBS}
 
-      RC)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for IML" >&5
+$as_echo_n "checking for IML... " >&6; }
 
+for IML_HOME in ${IML_HOME_PATH}
+  do
+    if test -r "$IML_HOME/include/iml.h"; then
 
-# Source file extension for RC test sources.
-ac_ext=rc
+       if test "x$IML_HOME" != "x/usr" -a "x$IML_HOME" != "x/usr/local"; then
+           IML_CFLAGS="-I${IML_HOME}/include"
+           IML_LIBS="-L${IML_HOME}/lib -liml"
+       else
+           IML_CFLAGS=
+           IML_LIBS="-liml"
+       fi
 
-# Object file extension for compiled RC test sources.
-objext=o
-objext_RC=$objext
+       CXXFLAGS="${BACKUP_CXXFLAGS} ${IML_CFLAGS} ${GMP_CFLAGS}"
+       LIBS="${BACKUP_LIBS} ${IML_LIBS} ${GMP_LIBS}"
 
-# Code to be used in simple compile tests
-lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <gmp.h>
+	   extern "C" {
+	   #include <iml.h>
+	   }
+int
+main ()
+{
+Double a;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
 
-# Code to be used in simple link tests
-lt_simple_link_test_code="$lt_simple_compile_test_code"
+	   if test "$cross_compiling" = yes; then :
 
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+	   iml_found="yes"
+	   iml_cross="yes"
+	   break
 
-# If no C compiler was specified, use CC.
-LTCC=${LTCC-"$CC"}
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-# If no C compiler flags were specified, use CFLAGS.
-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+	   int main () { return 0; /* not possible to check version */ }
 
-# Allow CC to be a program name with arguments.
-compiler=$CC
+_ACEOF
+if ac_fn_cxx_try_run "$LINENO"; then :
 
+	   iml_found="yes"
+	   break
 
-# save warnings/boilerplate of simple test code
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_compile_test_code" >conftest.$ac_ext
-eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_compiler_boilerplate=`cat conftest.err`
-$rm conftest*
+else
 
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_link_test_code" >conftest.$ac_ext
-eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_linker_boilerplate=`cat conftest.err`
-$rm -r conftest*
+	   iml_problem="$problem $IML_HOME"
+	   unset IML_CFLAGS
+	   unset IML_LIBS
 
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
 
-# Allow CC to be a program name with arguments.
-lt_save_CC="$CC"
-CC=${RC-"windres"}
-compiler=$CC
-compiler_RC=$CC
-for cc_temp in $compiler""; do
-  case $cc_temp in
-    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
-    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
-    \-*) ;;
-    *) break;;
-  esac
+
+else
+
+       iml_found="no"
+       iml_checked="$checked $IML_HOME"
+       unset IML_CFLAGS
+       unset IML_LIBS
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+	       else
+       iml_found="no"
+	       fi
 done
-cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
-
-lt_cv_prog_compiler_c_o_RC=yes
-
-# The else clause should only fire when bootstrapping the
-# libtool distribution, otherwise you forgot to ship ltmain.sh
-# with your package, and you will get complaints that there are
-# no rules to generate ltmain.sh.
-if test -f "$ltmain"; then
-  # See if we are running on zsh, and set the options which allow our commands through
-  # without removal of \ escapes.
-  if test -n "${ZSH_VERSION+set}" ; then
-    setopt NO_GLOB_SUBST
-  fi
-  # Now quote all the things that may contain metacharacters while being
-  # careful not to overquote the AC_SUBSTed values.  We take copies of the
-  # variables and quote the copies for generation of the libtool script.
-  for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
-    SED SHELL STRIP \
-    libname_spec library_names_spec soname_spec extract_expsyms_cmds \
-    old_striplib striplib file_magic_cmd finish_cmds finish_eval \
-    deplibs_check_method reload_flag reload_cmds need_locks \
-    lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
-    lt_cv_sys_global_symbol_to_c_name_address \
-    sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
-    old_postinstall_cmds old_postuninstall_cmds \
-    compiler_RC \
-    CC_RC \
-    LD_RC \
-    lt_prog_compiler_wl_RC \
-    lt_prog_compiler_pic_RC \
-    lt_prog_compiler_static_RC \
-    lt_prog_compiler_no_builtin_flag_RC \
-    export_dynamic_flag_spec_RC \
-    thread_safe_flag_spec_RC \
-    whole_archive_flag_spec_RC \
-    enable_shared_with_static_runtimes_RC \
-    old_archive_cmds_RC \
-    old_archive_from_new_cmds_RC \
-    predep_objects_RC \
-    postdep_objects_RC \
-    predeps_RC \
-    postdeps_RC \
-    compiler_lib_search_path_RC \
-    compiler_lib_search_dirs_RC \
-    archive_cmds_RC \
-    archive_expsym_cmds_RC \
-    postinstall_cmds_RC \
-    postuninstall_cmds_RC \
-    old_archive_from_expsyms_cmds_RC \
-    allow_undefined_flag_RC \
-    no_undefined_flag_RC \
-    export_symbols_cmds_RC \
-    hardcode_libdir_flag_spec_RC \
-    hardcode_libdir_flag_spec_ld_RC \
-    hardcode_libdir_separator_RC \
-    hardcode_automatic_RC \
-    module_cmds_RC \
-    module_expsym_cmds_RC \
-    lt_cv_prog_compiler_c_o_RC \
-    fix_srcfile_path_RC \
-    exclude_expsyms_RC \
-    include_expsyms_RC; do
-
-    case $var in
-    old_archive_cmds_RC | \
-    old_archive_from_new_cmds_RC | \
-    archive_cmds_RC | \
-    archive_expsym_cmds_RC | \
-    module_cmds_RC | \
-    module_expsym_cmds_RC | \
-    old_archive_from_expsyms_cmds_RC | \
-    export_symbols_cmds_RC | \
-    extract_expsyms_cmds | reload_cmds | finish_cmds | \
-    postinstall_cmds | postuninstall_cmds | \
-    old_postinstall_cmds | old_postuninstall_cmds | \
-    sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
-      # Double-quote double-evaled strings.
-      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
-      ;;
-    *)
-      eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
-      ;;
-    esac
-  done
 
-  case $lt_echo in
-  *'\$0 --fallback-echo"')
-    lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
-    ;;
-  esac
+if test "x$iml_found" = "xyes" ; then
 
-cfgfile="$ofile"
 
-  cat <<__EOF__ >> "$cfgfile"
-# ### BEGIN LIBTOOL TAG CONFIG: $tagname
 
-# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+$as_echo "#define HAVE_IML 1" >>confdefs.h
 
-# Shell to use when invoking shell scripts.
-SHELL=$lt_SHELL
+    HAVE_IML=yes
+    if test "x$iml_cross" != "xyes"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+$as_echo "found" >&6; }
+    else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5
+$as_echo "unknown" >&6; }
+        echo "WARNING: You appear to be cross compiling, so there is no way to determine"
+        echo "whether your IML version is new enough. I am assuming it is."
+    fi
+    :
+elif test -n "$iml_problem"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: problem" >&5
+$as_echo "problem" >&6; }
+    echo "Sorry, your IML version is too old. Disabling."
+    :
+elif test "x$iml_found" = "xno" ; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+    :
+fi
 
-# Whether or not to build shared libraries.
-build_libtool_libs=$enable_shared
+ if test "x$HAVE_IML" = "xyes"; then
+  LINBOX_HAVE_IML_TRUE=
+  LINBOX_HAVE_IML_FALSE='#'
+else
+  LINBOX_HAVE_IML_TRUE='#'
+  LINBOX_HAVE_IML_FALSE=
+fi
 
-# Whether or not to build static libraries.
-build_old_libs=$enable_static
 
-# Whether or not to add -lc for building shared libraries.
-build_libtool_need_lc=$archive_cmds_need_lc_RC
+CXXFLAGS=${BACKUP_CXXFLAGS}
+LIBS=${BACKUP_LIBS}
+#unset LD_LIBRARY_PATH
 
-# Whether or not to disallow shared libs when runtime libs are static
-allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC
 
-# Whether or not to optimize for fast installation.
-fast_install=$enable_fast_install
 
-# The host system.
-host_alias=$host_alias
-host=$host
-host_os=$host_os
 
-# The build system.
-build_alias=$build_alias
-build=$build
-build_os=$build_os
 
-# An echo program that does not interpret backslashes.
-echo=$lt_echo
 
-# The archiver.
-AR=$lt_AR
-AR_FLAGS=$lt_AR_FLAGS
+# Check whether --with-ntl was given.
+if test "${with_ntl+set}" = set; then :
+  withval=$with_ntl; if test "$withval" = yes ; then
+			NTL_HOME_PATH="${DEFAULT_CHECKING_PATH}"
+	      elif test "$withval" != no ; then
+			NTL_HOME_PATH="$withval"
+	     fi
+fi
 
-# A C compiler.
-LTCC=$lt_LTCC
 
-# LTCC compiler flags.
-LTCFLAGS=$lt_LTCFLAGS
+min_ntl_version=5.0
 
-# A language-specific compiler.
-CC=$lt_compiler_RC
 
-# Is the compiler the GNU C compiler?
-with_gcc=$GCC_RC
+BACKUP_CXXFLAGS=${CXXFLAGS}
+BACKUP_LIBS=${LIBS}
 
-# An ERE matcher.
-EGREP=$lt_EGREP
+if test -n "$NTL_HOME_PATH"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for NTL >= $min_ntl_version" >&5
+$as_echo_n "checking for NTL >= $min_ntl_version... " >&6; }
+fi
 
-# The linker used to build libraries.
-LD=$lt_LD_RC
+for NTL_HOME in ${NTL_HOME_PATH}
+ do
+if test -r "$NTL_HOME/include/NTL/ZZ.h"; then
 
-# Whether we need hard or soft links.
-LN_S=$lt_LN_S
+	if test "x$NTL_HOME" != "x/usr" -a "x$NTL_HOME" != "x/usr/local"; then
+		NTL_CFLAGS="-I${NTL_HOME}/include"
+		NTL_LIBS="-L${NTL_HOME}/lib -lntl"
+	else
+		NTL_CFLAGS=
+		NTL_LIBS="-lntl"
+	fi
+	CXXFLAGS="${BACKUP_CXXFLAGS} ${NTL_CFLAGS} ${GMP_CFLAGS}"
+	LIBS="${BACKUP_LIBS} ${NTL_LIBS} ${GMP_LIBS}"
 
-# A BSD-compatible nm program.
-NM=$lt_NM
+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <NTL/ZZ.h>
+int
+main ()
+{
+NTL::ZZ a;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
 
-# A symbol stripping program
-STRIP=$lt_STRIP
+	if test "$cross_compiling" = yes; then :
 
-# Used to examine libraries when file_magic_cmd begins "file"
-MAGIC_CMD=$MAGIC_CMD
+	ntl_found="yes"
+	ntl_cross="yes"
+	break
 
-# Used on cygwin: DLL creation program.
-DLLTOOL="$DLLTOOL"
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <NTL/version.h>
+	int main () { if (NTL_MAJOR_VERSION < 5) return -1; else return 0; }
 
-# Used on cygwin: object dumper.
-OBJDUMP="$OBJDUMP"
+_ACEOF
+if ac_fn_cxx_try_run "$LINENO"; then :
 
-# Used on cygwin: assembler.
-AS="$AS"
+	ntl_found="yes"
+	break
 
-# The name of the directory that contains temporary libtool files.
-objdir=$objdir
+else
 
-# How to create reloadable object files.
-reload_flag=$lt_reload_flag
-reload_cmds=$lt_reload_cmds
+	ntl_problem="$problem $NTL_HOME"
+	unset NTL_CFLAGS
+	unset NTL_LIBS
 
-# How to pass a linker flag through the compiler.
-wl=$lt_lt_prog_compiler_wl_RC
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
 
-# Object file suffix (normally "o").
-objext="$ac_objext"
 
-# Old archive suffix (normally "a").
-libext="$libext"
+else
 
-# Shared library suffix (normally ".so").
-shrext_cmds='$shrext_cmds'
+	ntl_found="no"
+	ntl_checked="$checked $NTL_HOME"
+	unset NTL_CFLAGS
+	unset NTL_LIBS
 
-# Executable file suffix (normally "").
-exeext="$exeext"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+else
+	ntl_found="no"
+fi
+done
 
-# Additional compiler flags for building library objects.
-pic_flag=$lt_lt_prog_compiler_pic_RC
-pic_mode=$pic_mode
+if test "x$ntl_found" = "xyes" ; then
 
-# What is the maximum length of a command?
-max_cmd_len=$lt_cv_sys_max_cmd_len
 
-# Does compiler simultaneously support -c and -o options?
-compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC
 
-# Must we lock files when doing compilation?
-need_locks=$lt_need_locks
+$as_echo "#define HAVE_NTL 1" >>confdefs.h
 
-# Do we need the lib prefix for modules?
-need_lib_prefix=$need_lib_prefix
+	HAVE_NTL=yes
+	if test "x$ntl_cross" != "xyes"; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+$as_echo "found" >&6; }
+	else
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5
+$as_echo "unknown" >&6; }
+		echo "WARNING: You appear to be cross compiling, so there is no way to determine"
+		echo "whether your NTL version is new enough. I am assuming it is."
+	fi
+	:
+elif test -n "$ntl_problem"; then
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: problem" >&5
+$as_echo "problem" >&6; }
+	echo "Sorry, your NTL version is too old. Disabling."
+	:
+elif test   "x$ntl_found" = "xno";  then
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+	if test "x$NTL_HOME" != "x/usr" -a "x$NTL_HOME" != "x/usr/local" ; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: NTL >= $min_ntl_version was not found. LinBox also requires the NTL namespace to be enabled.  Please make sure NTL is compiled correctly." >&5
+$as_echo "$as_me: WARNING: NTL >= $min_ntl_version was not found. LinBox also requires the NTL namespace to be enabled.  Please make sure NTL is compiled correctly." >&2;}
+	fi
+	:
+fi
 
-# Do we need a version for libraries?
-need_version=$need_version
 
-# Whether dlopen is supported.
-dlopen_support=$enable_dlopen
 
-# Whether dlopen of programs is supported.
-dlopen_self=$enable_dlopen_self
+ if test "x$HAVE_NTL" = "xyes"; then
+  LINBOX_HAVE_NTL_TRUE=
+  LINBOX_HAVE_NTL_FALSE='#'
+else
+  LINBOX_HAVE_NTL_TRUE='#'
+  LINBOX_HAVE_NTL_FALSE=
+fi
 
-# Whether dlopen of statically linked programs is supported.
-dlopen_self_static=$enable_dlopen_self_static
 
-# Compiler flag to prevent dynamic linking.
-link_static_flag=$lt_lt_prog_compiler_static_RC
+CXXFLAGS=${BACKUP_CXXFLAGS}
+LIBS=${BACKUP_LIBS}
+#unset LD_LIBRARY_PATH
 
-# Compiler flag to turn off builtin functions.
-no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC
 
-# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC
 
-# Compiler flag to generate shared objects directly from archives.
-whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC
 
-# Compiler flag to generate thread-safe objects.
-thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC
 
-# Library versioning type.
-version_type=$version_type
+# Check whether --with-givaro was given.
+if test "${with_givaro+set}" = set; then :
+  withval=$with_givaro; if test "$withval" = yes ; then
+			GIVARO_HOME_PATH="${DEFAULT_CHECKING_PATH}"
+	      elif test "$withval" != no ; then
+			GIVARO_HOME_PATH="$withval ${DEFAULT_CHECKING_PATH}"
+	     fi
+else
+  GIVARO_HOME_PATH="${DEFAULT_CHECKING_PATH}"
+fi
 
-# Format of library name prefix.
-libname_spec=$lt_libname_spec
 
-# List of archive names.  First name is the real one, the rest are links.
-# The last name is the one that the linker finds with -lNAME.
-library_names_spec=$lt_library_names_spec
 
-# The coded name of the library, if different from the real name.
-soname_spec=$lt_soname_spec
+version_min=30400
+min_givaro_version=3.4.0
+max_givaro_version=3.5.0
 
-# Commands used to build and install an old-style archive.
-RANLIB=$lt_RANLIB
-old_archive_cmds=$lt_old_archive_cmds_RC
-old_postinstall_cmds=$lt_old_postinstall_cmds
-old_postuninstall_cmds=$lt_old_postuninstall_cmds
 
-# Create an old-style archive from a shared archive.
-old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC
+BACKUP_CXXFLAGS=${CXXFLAGS}
+BACKUP_LIBS=${LIBS}
 
-# Create a temporary old-style archive to link instead of a shared archive.
-old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GIVARO >= $min_givaro_version and < $max_givaro_version" >&5
+$as_echo_n "checking for GIVARO >= $min_givaro_version and < $max_givaro_version... " >&6; }
 
-# Commands used to build and install a shared archive.
-archive_cmds=$lt_archive_cmds_RC
-archive_expsym_cmds=$lt_archive_expsym_cmds_RC
-postinstall_cmds=$lt_postinstall_cmds
-postuninstall_cmds=$lt_postuninstall_cmds
+for GIVARO_HOME in ${GIVARO_HOME_PATH}
+ do
+if test -r "$GIVARO_HOME/include/givaro/givconfig.h"; then
 
-# Commands used to build a loadable module (assumed same as above if empty)
-module_cmds=$lt_module_cmds_RC
-module_expsym_cmds=$lt_module_expsym_cmds_RC
+	if test "x$GIVARO_HOME" != "x/usr" -a "x$GIVARO_HOME" != "x/usr/local"; then
+		GIVARO_CFLAGS="-I${GIVARO_HOME}/include"
+		GIVARO_LIBS="-L${GIVARO_HOME}/lib -lgivaro ${GIVARO_HOME}/lib/libgivaro.so"
+	else
+		GIVARO_CFLAGS=
+		GIVARO_LIBS="-lgivaro"
+	fi
+	CXXFLAGS="${BACKUP_CXXFLAGS} ${GIVARO_CFLAGS} ${GMP_CFLAGS}"
+	LIBS="${BACKUP_LIBS} ${GIVARO_LIBS} ${GMP_LIBS}"
 
-# Commands to strip libraries.
-old_striplib=$lt_old_striplib
-striplib=$lt_striplib
+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <givaro/givinteger.h>
+int
+main ()
+{
+Givaro::Integer a;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
 
-# Dependencies to place before the objects being linked to create a
-# shared library.
-predep_objects=$lt_predep_objects_RC
+	if test "$cross_compiling" = yes; then :
 
-# Dependencies to place after the objects being linked to create a
-# shared library.
-postdep_objects=$lt_postdep_objects_RC
+	givaro_found="yes"
+	givaro_cross="yes"
 
-# Dependencies to place before the objects being linked to create a
-# shared library.
-predeps=$lt_predeps_RC
+	break
 
-# Dependencies to place after the objects being linked to create a
-# shared library.
-postdeps=$lt_postdeps_RC
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <givaro/givconfig.h>
+	 int main () { if (GIVARO_VERSION < $version_min || GIVARO_VERSION >= (($version_min/100+1)*100) || GIVARO_VERSION>0x030000) return -1; else return 0; /* old version of Givaro are defined as hexa 0x03yyzz*/ }
 
-# The directories searched by this compiler when creating a shared
-# library
-compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_RC
+_ACEOF
+if ac_fn_cxx_try_run "$LINENO"; then :
 
-# The library search path used internally by the compiler when linking
-# a shared library.
-compiler_lib_search_path=$lt_compiler_lib_search_path_RC
+	givaro_found="yes"
+	break
+
+else
+
+	givaro_problem="$problem $GIVARO_HOME"
+	unset GIVARO_CFLAGS
+	unset GIVARO_LIBS
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
 
-# Method to check whether dependent libraries are shared objects.
-deplibs_check_method=$lt_deplibs_check_method
 
-# Command to use when deplibs_check_method == file_magic.
-file_magic_cmd=$lt_file_magic_cmd
+else
 
-# Flag that allows shared libraries with undefined symbols to be built.
-allow_undefined_flag=$lt_allow_undefined_flag_RC
+	givaro_found="no"
+	givaro_checked="$checked $GIVARO_HOME"
+	unset GIVARO_CFLAGS
+	unset GIVARO_LIBS
 
-# Flag that forces no undefined symbols.
-no_undefined_flag=$lt_no_undefined_flag_RC
 
-# Commands used to finish a libtool library installation in a directory.
-finish_cmds=$lt_finish_cmds
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+else
+	givaro_found="no"
+fi
+done
 
-# Same as above, but a single script fragment to be evaled but not shown.
-finish_eval=$lt_finish_eval
+if test "x$givaro_found" = "xyes" ; then
 
-# Take the output of nm and produce a listing of raw symbols and C names.
-global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
 
-# Transform the output of nm in a proper C declaration
-global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
 
-# Transform the output of nm in a C name address pair
-global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+$as_echo "#define HAVE_GIVARO 1" >>confdefs.h
 
-# This is the shared library runtime path variable.
-runpath_var=$runpath_var
+	HAVE_GIVARO=yes
+	if test "x$givaro_cross" != "xyes"; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+$as_echo "found" >&6; }
+	else
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5
+$as_echo "unknown" >&6; }
+		echo "WARNING: You appear to be cross compiling, so there is no way to determine"
+		echo "whether your GIVARO version is new enough. I am assuming it is."
+	fi
+	:
+elif test -n "$givaro_problem"; then
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: problem" >&5
+$as_echo "problem" >&6; }
+	echo "Sorry, your GIVARO version is too old. Disabling."
 
-# This is the shared library path variable.
-shlibpath_var=$shlibpath_var
+echo '*******************************************************************************'
+echo ' ERROR: GIVARO not found!'
+echo
+echo ' GIVARO version 3.4.0 or greater (<3.5) is required for this library to compile.'
+echo ' Please make sure GIVARO is installed and specify its location with the'
+echo ' option --with-givaro=<prefix> when running configure.'
+echo '*******************************************************************************'
+exit 1
 
-# Is shlibpath searched before the hard-coded library search path?
-shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+elif test "x$givaro_found" = "xno" ; then
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
 
-# How to hardcode a shared library path into an executable.
-hardcode_action=$hardcode_action_RC
+echo '*******************************************************************************'
+echo ' ERROR: GIVARO not found!'
+echo
+echo ' GIVARO version 3.4.0 or greater (<3.5) is required for this library to compile.'
+echo ' Please make sure GIVARO is installed and specify its location with the'
+echo ' option --with-givaro=<prefix> when running configure.'
+echo '*******************************************************************************'
+exit 1
 
-# Whether we should hardcode library paths into libraries.
-hardcode_into_libs=$hardcode_into_libs
+fi
 
-# Flag to hardcode \$libdir into a binary during linking.
-# This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_RC
+ if test "x$HAVE_GIVARO" = "xyes"; then
+  LINBOX_HAVE_GIVARO_TRUE=
+  LINBOX_HAVE_GIVARO_FALSE='#'
+else
+  LINBOX_HAVE_GIVARO_TRUE='#'
+  LINBOX_HAVE_GIVARO_FALSE=
+fi
 
-# If ld is used when linking, flag to hardcode \$libdir into
-# a binary during linking. This must work even if \$libdir does
-# not exist.
-hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC
 
-# Whether we need a single -rpath flag with a separated argument.
-hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC
+CXXFLAGS=${BACKUP_CXXFLAGS}
+LIBS=${BACKUP_LIBS}
+#unset LD_LIBRARY_PATH
 
-# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
-# resulting binary.
-hardcode_direct=$hardcode_direct_RC
 
-# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
-# resulting binary.
-hardcode_minus_L=$hardcode_minus_L_RC
 
-# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
-# the resulting binary.
-hardcode_shlibpath_var=$hardcode_shlibpath_var_RC
 
-# Set to yes if building a shared library automatically hardcodes DIR into the library
-# and all subsequent libraries and executables linked against it.
-hardcode_automatic=$hardcode_automatic_RC
 
-# Variables whose values should be saved in libtool wrapper scripts and
-# restored at relink time.
-variables_saved_for_relink="$variables_saved_for_relink"
+# Check whether --with-saclib was given.
+if test "${with_saclib+set}" = set; then :
+  withval=$with_saclib; if test "$withval" = yes ; then
+			SACLIB_HOME_PATH="${DEFAULT_CHECKING_PATH}"
+	      elif test "$withval" != no ; then
+			SACLIB_HOME_PATH="$withval"
+	     fi
+fi
 
-# Whether libtool must link a program against all its dependency libraries.
-link_all_deplibs=$link_all_deplibs_RC
 
-# Compile-time system search path for libraries
-sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+min_saclib_version=2.0
 
-# Run-time system search path for libraries
-sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
 
-# Fix the shell variable \$srcfile for the compiler.
-fix_srcfile_path=$lt_fix_srcfile_path
 
-# Set to yes if exported symbols are required.
-always_export_symbols=$always_export_symbols_RC
+BACKUP_CXXFLAGS=${CXXFLAGS}
+BACKUP_LIBS=${LIBS}
 
-# The commands to list exported symbols.
-export_symbols_cmds=$lt_export_symbols_cmds_RC
+if test -n  "$SACLIB_HOME_PATH"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SACLIB >= $min_saclib_version" >&5
+$as_echo_n "checking for SACLIB >= $min_saclib_version... " >&6; }
+fi
 
-# The commands to extract the exported symbol list from a shared archive.
-extract_expsyms_cmds=$lt_extract_expsyms_cmds
+for SACLIB_HOME in ${SACLIB_HOME_PATH}
+ do
+if test -r "$SACLIB_HOME/include/saclib.h"; then
 
-# Symbols that should not be listed in the preloaded symbols.
-exclude_expsyms=$lt_exclude_expsyms_RC
+	if test "x$SACLIB_HOME" != "x/usr" -a "x$SACLIB_HOME" != "x/usr/local"; then
+		SACLIB_CFLAGS="-I${SACLIB_HOME}/include"
+		SACLIB_LIBS="-L${SACLIB_HOME}/lib -lsaclib"
+	else
+		SACLIB_CFLAGS=
+		SACLIB_LIBS="-lsaclib"
+	fi
 
-# Symbols that must always be exported.
-include_expsyms=$lt_include_expsyms_RC
+	CXXFLAGS="${BACKUP_CXXFLAGS} ${SACLIB_CFLAGS} ${GMP_CFLAGS}" 	LIBS="${BACKUP_LIBS} ${SACLIB_LIBS} ${GMP_LIBS}"
 
-# ### END LIBTOOL TAG CONFIG: $tagname
+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <saclib.h>
+int
+main ()
+{
+BDigit a;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
 
-__EOF__
+	if test "$cross_compiling" = yes; then :
 
+	saclib_found="yes"
+	saclib_cross="yes"
+	break
 
 else
-  # If there is no Makefile yet, we rely on a make rule to execute
-  # `config.status --recheck' to rerun these tests and create the
-  # libtool script then.
-  ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
-  if test -f "$ltmain_in"; then
-    test -f Makefile && make "$ltmain"
-  fi
-fi
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <saclib.h>
+	int main () {  if ( __GNU_MP_VERSION < 3) return -1; else return 0; }
 
+_ACEOF
+if ac_fn_cxx_try_run "$LINENO"; then :
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+	saclib_found="yes"
+	break
 
-CC="$lt_save_CC"
+else
 
-	;;
+	saclib_problem="$problem $SACLIB_HOME"
+	unset SACLIB_CFLAGS
+	unset SACLIB_LIBS
 
-      *)
-	{ { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5
-echo "$as_me: error: Unsupported tag name: $tagname" >&2;}
-   { (exit 1); exit 1; }; }
-	;;
-      esac
 
-      # Append the new tag name to the list of available tags.
-      if test -n "$tagname" ; then
-      available_tags="$available_tags $tagname"
-    fi
-    fi
-  done
-  IFS="$lt_save_ifs"
 
-  # Now substitute the updated list of available tags.
-  if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
-    mv "${ofile}T" "$ofile"
-    chmod +x "$ofile"
-  else
-    rm -f "${ofile}T"
-    { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5
-echo "$as_me: error: unable to update list of available tagged configurations." >&2;}
-   { (exit 1); exit 1; }; }
-  fi
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
 
+else
 
-# This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+	saclib_found="no"
+	saclib_checked="$saclib_checked $SACLIB_HOME"
+	unset SACLIB_CFLAGS
+	unset SACLIB_LIBS
 
-# Always use our own libtool.
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+else
+	saclib_found="no"
+
+fi
+done
+
+
+if test "x$saclib_found" = "xyes" ; then
 
-# Prevent multiple expansion
 
 
+$as_echo "#define HAVE_SACLIB 1" >>confdefs.h
 
+	HAVE_SACLIB=yes
 
+	if test "x$saclib_cross" != "xyes"; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+$as_echo "found" >&6; }
+	else
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5
+$as_echo "unknown" >&6; }
+		echo "WARNING: You appear to be cross compiling, so there is no way to determine"
+		echo "whether your SACLIB version is new enough. I am assuming it is."
+	fi
+	:
+elif test -n "$saclib_problem"; then
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: problem" >&5
+$as_echo "problem" >&6; }
+	echo "Sorry, your SACLIB version is too old. Disabling."
+	:
+elif test "x$saclib_found" = "xno" ; then
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+	:
+fi
 
 
 
+ if test "x$HAVE_SACLIB" = "xyes"; then
+  LINBOX_HAVE_SACLIB_TRUE=
+  LINBOX_HAVE_SACLIB_FALSE='#'
+else
+  LINBOX_HAVE_SACLIB_TRUE='#'
+  LINBOX_HAVE_SACLIB_FALSE=
+fi
 
 
+CXXFLAGS=${BACKUP_CXXFLAGS}
+LIBS=${BACKUP_LIBS}
+#unset LD_LIBRARY_PATH
 
 
 
 
 
+# Check whether --with-lidia was given.
+if test "${with_lidia+set}" = set; then :
+  withval=$with_lidia; if test "$withval" = yes ; then
+			LIDIA_HOME_PATH="${DEFAULT_CHECKING_PATH}"
+	      elif test "$withval" != no ; then
+			LIDIA_HOME_PATH="$withval"
+	     fi
+fi
 
 
+min_lidia_version=2.1
 
 
 
+BACKUP_CXXFLAGS=${CXXFLAGS}
+BACKUP_LIBS=${LIBS}
 
+if test -n "$LIDIA_HOME_PATH" ; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIDIA >= $min_lidia_version" >&5
+$as_echo_n "checking for LIDIA >= $min_lidia_version... " >&6; }
+fi
 
-# Machine characteristics
+for LIDIA_HOME in ${LIDIA_HOME_PATH}
+ do
+if test -r "$LIDIA_HOME/include/LiDIA/LiDIA.h"; then
+	if test "x$LIDIA_HOME" != "x/usr" -a "x$LIDIA_HOME" != "x/usr/local"; then
+		LIDIA_CFLAGS="-I${LIDIA_HOME}/include"
+		LIDIA_LIBS="-L${LIDIA_HOME}/lib -lLiDIA"
+	else
+		LIDIA_CFLAGS=
+		LIDIA_LIBS="-lLiDIA"
+	fi
+	CXXFLAGS="${BACKUP_CXXFLAGS} ${LIDIA_CFLAGS} ${GMP_CFLAGS}"
+	LIBS="${BACKUP_LIBS} ${LIDIA_LIBS} ${GMP_LIBS}"
 
-{ echo "$as_me:$LINENO: checking for char" >&5
-echo $ECHO_N "checking for char... $ECHO_C" >&6; }
-if test "${ac_cv_type_char+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-typedef char ac__type_new_;
+#include <LiDIA/bigint.h>
 int
 main ()
 {
-if ((ac__type_new_ *) 0)
-  return 0;
-if (sizeof (ac__type_new_))
-  return 0;
+LiDIA::bigint a;
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_type_char=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_cxx_try_link "$LINENO"; then :
 
-	ac_cv_type_char=no
-fi
+	if test "$cross_compiling" = yes; then :
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_char" >&5
-echo "${ECHO_T}$ac_cv_type_char" >&6; }
+	lidia_found="yes"
+	lidia_cross="yes"
+	break
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ echo "$as_me:$LINENO: checking size of char" >&5
-echo $ECHO_N "checking size of char... $ECHO_C" >&6; }
-if test "${ac_cv_sizeof_char+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-   typedef char ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
-test_array [0] = 0
+#include <LiDIA/LiDIA.h>
+	int main () {  if (LIDIA_MAJOR_VERSION < 2) return -1; else return 0; }
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef char ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
-test_array [0] = 0
+if ac_fn_cxx_try_run "$LINENO"; then :
+
+	lidia_found="yes"
+	break
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid; break
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
+	lidia_problem="$problem $LIDIA_HOME"
+	unset LIDIA_CFLAGS
+	unset LIDIA_LIBS
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
+
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef char ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
-test_array [0] = 0
+	lidia_found="no"
+	lidia_checked="$checked $LIDIA_HOME"
+	unset LIDIA_CFLAGS
+	unset LIDIA_LIBS
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef char ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
-test_array [0] = 0
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+else
+	lidia_found="no"
+fi
+done
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=$ac_mid; break
+if test "x$lidia_found" = "xyes" ; then
+
+
+
+$as_echo "#define HAVE_LIDIA 1" >>confdefs.h
+
+	HAVE_LIDIA=yes
+	if test "x$lidia_cross" != "xyes"; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+$as_echo "found" >&6; }
+	else
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5
+$as_echo "unknown" >&6; }
+		echo "WARNING: You appear to be cross compiling, so there is no way to determine"
+		echo "whether your LIDIA version is new enough. I am assuming it is."
+	fi
+	:
+elif test -n "$lidia_problem"; then
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: problem" >&5
+$as_echo "problem" >&6; }
+	echo "Sorry, your LIDIA version is too old. Disabling."
+	:
+elif test "x$lidia_found" = "xno" ; then
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+	:
+fi
+
+
+ if test "x$HAVE_LIDIA" = "xyes"; then
+  LINBOX_HAVE_LIDIA_TRUE=
+  LINBOX_HAVE_LIDIA_FALSE='#'
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  LINBOX_HAVE_LIDIA_TRUE='#'
+  LINBOX_HAVE_LIDIA_FALSE=
+fi
 
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
+
+CXXFLAGS=${BACKUP_CXXFLAGS}
+LIBS=${BACKUP_LIBS}
+#unset LD_LIBRARY_PATH
+
+
+
+
+
+# Check whether --with-maple was given.
+if test "${with_maple+set}" = set; then :
+  withval=$with_maple; if test "$withval" = yes ; then
+		MAPLE_HOME_PATH="${DEFAULT_CHECKING_PATH} unknown"
+	      elif test "$withval" != no ; then
+		MAPLE_HOME_PATH="$withval ${DEFAULT_CHECKING_PATH} unknown"
+	     fi
+fi
+
+
+# Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then :
+  enableval=$enable_shared; have_shared="$enableval"
+else
+  have_shared="no"
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo= ac_hi=
+if test -n "$MAPLE_HOME_PATH" ; then
+min_maple_version=9.0
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAPLE >= $min_maple_version" >&5
+$as_echo_n "checking for MAPLE >= $min_maple_version... " >&6; }
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+eval LIB_DIR=${libdir}
+if test ${LIB_DIR} = "NONE/lib" ; then
+	eval LIB_DIR="${prefix}/lib"
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef char ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
+for MAPLE_HOME in ${MAPLE_HOME_PATH}
+do
+		if test "x$MAPLE_HOME" != "xunknown"; then
+			if test -r "${MAPLE_HOME}/bin/maple.system.type" && test -r "${MAPLE_HOME}/extern/include/maplec.h" ; then
+				MAPLE_BIN=${MAPLE_HOME}/`${MAPLE_HOME}/bin/maple.system.type`
+			else
+				MAPLE_BIN=""
+			fi
+		else
+			if test -r "/usr/local/bin/xmaple" && test -r "/usr/local/bin/maple.system.type"; then
+					MAPLE_HOME=`sed -ne "s/MAPLE='\(.*\)'/\\1/p" /usr/local/bin/xmaple`
+					MAPLE_BIN="${MAPLE_HOME}/"`${MAPLE_HOME}/bin/maple.system.type`
+			elif test -r "/usr/bin/xmaple" ; then
+					MAPLE_HOME=`sed -ne "s/MAPLE='\(.*\)'/\\1/p" /usr/bin/xmaple`
+					MAPLE_BIN="${MAPLE_HOME}/"`${MAPLE_HOME}/bin/maple.system.type`
+			else
+					MAPLE_BIN=""
+			fi
+		fi
+
+		if test -z "${MAPLE_BIN}" ; then
+			maple_found="no"
+		else
+			maple_found="yes"
+			if test $have_shared = "yes"; then
+				${MAPLE_HOME}/bin/maple macros/maple-check-version.mpl > /dev/null
+				MAPLE_VERSION=`cat maple_version.txt`
+
+				if test ${MAPLE_VERSION} -lt 9; then
+					{ $as_echo "$as_me:${as_lineno-$LINENO}: result: problem" >&5
+$as_echo "problem" >&6; }
+					echo " your version of Maple is too old, at least version 9 is recquired. Disabling."
+					break
+				else
+					{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+$as_echo "found" >&6; }
+					LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${MAPLE_BIN}:${LIB_DIR}"
+					LD_RUN_PATH="${LD_RUN_PATH}:${MAPLE_BIN}:${LIB_DIR}"
+					export LD_LIBRARY_PATH
+					export LD_RUN_PATH
+					MAPLE_LIBS="-L${MAPLE_BIN} -lmaplec -lstdc++"
+					MAPLE_CFLAGS="-I${MAPLE_HOME}/extern/include"
+
+
+
+
+					if test ${MAPLE_VERSION} -ge 10 	; then
+
+cat >>confdefs.h <<_ACEOF
+#define MAPLE_GMP_ACCESS /**/
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid
+
+					fi
+
+$as_echo "#define HAVE_MAPLE 1" >>confdefs.h
+
+					HAVE_MAPLE=yes
+					break
+				fi
+			else
+				{ $as_echo "$as_me:${as_lineno-$LINENO}: result: problem" >&5
+$as_echo "problem" >&6; }
+				echo " you need to give option --enable-shared to allow Maple interfacing. Disabling."
+				break
+			fi
+		fi
+done
+
+if test "x$maple_found" = "xno" ; then
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+	$as_echo "#define HAVE_MAPLE 0" >>confdefs.h
+
+fi
+
+ if test "x$HAVE_MAPLE" = "xyes"; then
+  LINBOX_HAVE_MAPLE_TRUE=
+  LINBOX_HAVE_MAPLE_FALSE='#'
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  LINBOX_HAVE_MAPLE_TRUE='#'
+  LINBOX_HAVE_MAPLE_FALSE=
+fi
 
-	ac_lo=`expr '(' $ac_mid ')' + 1`
+ if test "x$compile_drivers" = "xyes" -o "x$HAVE_MAPLE" = "xyes" ; then
+  LINBOX_COMPILE_DRIVERS_TRUE=
+  LINBOX_COMPILE_DRIVERS_FALSE='#'
+else
+  LINBOX_COMPILE_DRIVERS_TRUE='#'
+  LINBOX_COMPILE_DRIVERS_FALSE=
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_char=$ac_lo;;
-'') if test "$ac_cv_type_char" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (char)
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (char)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
-   else
-     ac_cv_sizeof_char=0
-   fi ;;
-esac
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to compile the sage interface" >&5
+$as_echo_n "checking whether to compile the sage interface... " >&6; }
+
+# Check whether --enable-sage was given.
+if test "${enable_sage+set}" = set; then :
+  enableval=$enable_sage;
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+sage_interface="yes"
+
+if test "x$HAVE_NTL" = "xyes" ; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NTL was built with -fPIC" >&5
+$as_echo_n "checking whether NTL was built with -fPIC... " >&6; }
+res=yes;
+$OBJDUMP --reloc $NTL_HOME/lib/libntl.a | $EGREP '(GOT|PLT|JU?MP_SLOT)' >/dev/null || res=no
+if test "x$res" = "xno" ; then
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+	echo
+	echo "You must have NTL compiled with -fPIC for Sage interface  "
+    exit 1
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef char ac__type_sizeof_;
-static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
-static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+fi
 
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
-	return 1;
-      fprintf (f, "%ld\n", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
-	return 1;
-      fprintf (f, "%lu\n", i);
-    }
-  return ferror (f) || fclose (f) != 0;
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_char=`cat conftest.val`
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-( exit $ac_status )
-if test "$ac_cv_type_char" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (char)
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (char)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
-   else
-     ac_cv_sizeof_char=0
-   fi
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+sage_interface="no"
+
 fi
-rm -f conftest.val
+
+ if test "x$sage_interface" = "xyes"; then
+  LINBOX_HAVE_SAGE_TRUE=
+  LINBOX_HAVE_SAGE_FALSE='#'
+else
+  LINBOX_HAVE_SAGE_TRUE='#'
+  LINBOX_HAVE_SAGE_FALSE=
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_char" >&5
-echo "${ECHO_T}$ac_cv_sizeof_char" >&6; }
 
 
+#LB_CHECK_ATLAS
 
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_CHAR $ac_cv_sizeof_char
-_ACEOF
+# LB_CHECK_BLAS(,,[
+# echo ''
+# echo '*******************************************************************************'
+# echo ' ERROR: BLAS not found!'
+# echo
+# echo ' BLAS routines are required for this library to compile. Please'
+# echo ' make sure BLAS are installed and specify its location with the option'
+# echo ' --with-blas=<lib> when running configure.'
+# echo '*******************************************************************************'
+# exit 1
+# ])
 
 
-{ echo "$as_me:$LINENO: checking for short" >&5
-echo $ECHO_N "checking for short... $ECHO_C" >&6; }
-if test "${ac_cv_type_short+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+
+
+
+# Check whether --with-fflas-ffpack was given.
+if test "${with_fflas_ffpack+set}" = set; then :
+  withval=$with_fflas_ffpack; if test "$withval" = yes ; then
+        FFLAFLAS_HOME_PATH="${DEFAULT_CHECKING_PATH}"
+        elif test "$withval" != no ; then
+        FFLAFLAS_HOME_PATH="$withval ${DEFAULT_CHECKING_PATH}"
+        fi
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+  FFLAFLAS_HOME_PATH="${DEFAULT_CHECKING_PATH}"
+fi
+
+
+
+
+BACKUP_CXXFLAGS=${CXXFLAGS}
+BACKUP_LIBS=${LIBS}
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FFLAFLAS" >&5
+$as_echo_n "checking for FFLAFLAS... " >&6; }
+
+for FFLAFLAS_HOME in ${FFLAFLAS_HOME_PATH}
+  do
+    if test -r "$FFLAFLAS_HOME/include/fflas-ffpack/fflas-ffpack.h"; then
+
+		BLAS_LIBS=`$FFLAFLAS_HOME/bin/fflasffpack-config --blas-libs`
+
+
+       if test "x$FFLAFLAS_HOME" != "x/usr" -a "x$FFLAFLAS_HOME" != "x/usr/local"; then
+           FFLAFLAS_CFLAGS="-I${FFLAFLAS_HOME}/include"
+       else
+           FFLAFLAS_CFLAGS=
+       fi
+
+       CXXFLAGS="${BACKUP_CXXFLAGS} ${FFLAFLAS_CFLAGS} ${BLAS_CFLAGS}"
+       LIBS="${BACKUP_LIBS} ${BLAS_LIBS}"
+
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-typedef short ac__type_new_;
+#include "fflas-ffpack/fflas-ffpack.h"
 int
 main ()
 {
-if ((ac__type_new_ *) 0)
-  return 0;
-if (sizeof (ac__type_new_))
-  return 0;
+FFLAS::FFLAS_TRANSPOSE a;
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_type_short=yes
+if ac_fn_cxx_try_link "$LINENO"; then :
+
+	   fflaflas_found="yes"
+	   FFLAFLAS_LOC="$FFLAFLAS_HOME"
+
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_type_short=no
-fi
+       fflaflas_found="no"
+       fflaflas_checked="$checked $FFLAFLAS_HOME"
+       unset FFLAFLAS_CFLAGS
+	   unset FFLAFLAS_LOC
+	   unset BLAS_LIBS
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_short" >&5
-echo "${ECHO_T}$ac_cv_type_short" >&6; }
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+	       else
+       fflasflas_found="no"
+	       fi
+done
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ echo "$as_me:$LINENO: checking size of short" >&5
-echo $ECHO_N "checking size of short... $ECHO_C" >&6; }
-if test "${ac_cv_sizeof_short+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef short ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
-test_array [0] = 0
+if test "x$fflaflas_found" = "xyes" ; then
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef short ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid; break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
+
+
+$as_echo "#define HAVE_FFLAFLAS 1" >>confdefs.h
+
+    HAVE_FFLAFLAS=yes
+    if test "x$fflasflas_cross" != "xyes"; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+$as_echo "found" >&6; }
+    else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5
+$as_echo "unknown" >&6; }
+        echo "WARNING: You appear to be cross compiling, so there is no way to determine"
+        echo "whether your FFLAFLAS version is new enough. I am assuming it is."
+    fi
+    :
+elif test -n "$fflasflas_problem"; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: problem" >&5
+$as_echo "problem" >&6; }
+    echo "Sorry, your FFLAFLAS version is too old. Disabling."
+
+echo ''
+echo '*******************************************************************************'
+echo ' ERROR: Fflas-Ffpack not found!'
+echo
+echo ' Fflas-Ffpack routines are required for this library to compile. Please'
+echo ' make sure they are installed and specify its location with the option'
+echo ' --with-fflas-ffpack=<lib> when running configure.'
+echo '*******************************************************************************'
+exit 1
+
+elif test "x$fflasflas_found" = "xno" ; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+
+echo ''
+echo '*******************************************************************************'
+echo ' ERROR: Fflas-Ffpack not found!'
+echo
+echo ' Fflas-Ffpack routines are required for this library to compile. Please'
+echo ' make sure they are installed and specify its location with the option'
+echo ' --with-fflas-ffpack=<lib> when running configure.'
+echo '*******************************************************************************'
+exit 1
+
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
+ if test "x$HAVE_FFLAFLAS" = "xyes"; then
+  LINBOX_HAVE_FFLAFLAS_TRUE=
+  LINBOX_HAVE_FFLAFLAS_FALSE='#'
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  LINBOX_HAVE_FFLAFLAS_TRUE='#'
+  LINBOX_HAVE_FFLAFLAS_FALSE=
+fi
 
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef short ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+CXXFLAGS=${BACKUP_CXXFLAGS}
+LIBS=${BACKUP_LIBS}
+#unset LD_LIBRARY_PATH
+
+
+
+
+# AC_MSG_RESULT($BLAS_LIBS)
+# AC_MSG_RESULT($BLAS_CFLAGS)
+
+
+
+
+
+# Check whether --with-expat was given.
+if test "${with_expat+set}" = set; then :
+  withval=$with_expat; if test "$withval" = yes ; then
+			EXPAT_HOME_PATH="${DEFAULT_CHECKING_PATH}"
+	      elif test "$withval" != no ; then
+			EXPAT_HOME_PATH="$withval"
+	     fi
+fi
+
+
+min_expat_version=1.95
+
+
+
+BACKUP_CXXFLAGS=${CXXFLAGS}
+BACKUP_LIBS=${LIBS}
+
+if test -n "$EXPAT_HOME_PATH"; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for EXPAT >= $min_expat_version" >&5
+$as_echo_n "checking for EXPAT >= $min_expat_version... " >&6; }
+fi
+
+for EXPAT_HOME in ${EXPAT_HOME_PATH}
+ do
+if test -r "$EXPAT_HOME/include/expat.h"; then
+
+	if test "x$EXPAT_HOME" != "x/usr" -a "x$EXPAT_HOME" != "x/usr/local"; then
+		EXPAT_CFLAGS="-I${EXPAT_HOME}/include"
+		EXPAT_LIBS="-L${EXPAT_HOME}/lib -lexpat"
+	else
+		EXPAT_CFLAGS=
+		EXPAT_LIBS="-lexpat"
+	fi
+
+	CXXFLAGS="${BACKUP_CXXFLAGS} ${EXPAT_CFLAGS} ${GMP_CFLAGS}"
+	LIBS="${BACKUP_LIBS} ${EXPAT_LIBS} ${GMP_LIBS}"
+	cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-   typedef short ac__type_sizeof_;
+#include <expat.h>
 int
 main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
-test_array [0] = 0
-
+XML_Content_Type a;
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=$ac_mid; break
+if ac_fn_cxx_try_link "$LINENO"; then :
+
+	if test "$cross_compiling" = yes; then :
+
+	expat_found="yes"
+	expat_cross="yes"
+	break
+
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <expat.h>
+	 int main () {  if(XML_MAJOR_VERSION < 1  || (XML_MAJOR_VERSION == 1 && XML_MINOR_VERSION < 95)) return -1;  else return 0; }
 
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
+_ACEOF
+if ac_fn_cxx_try_run "$LINENO"; then :
+
+	expat_found="yes"
+	break
+
+else
+
+	expat_problem="$problem $EXPAT_HOME"
+	unset EXPAT_CFLAGS
+	unset EXPAT_LIBS
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
+
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo= ac_hi=
+	expat_found="no"
+	expat_checked="$checked $EXPAT_HOME"
+	unset EXPAT_CFLAGS
+	unset EXPAT_LIBS
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+else
+	expat_found="no"
 fi
+done
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+if test "x$expat_found" = "xyes" ; then
+
+
+
+$as_echo "#define XMLENABLED 1" >>confdefs.h
+
+	HAVE_EXPAT=yes
+	if test "x$expat_cross" != "xyes"; then
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5
+$as_echo "found" >&6; }
+	else
+		{ $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5
+$as_echo "unknown" >&6; }
+		echo "WARNING: You appear to be cross compiling, so there is no way to determine"
+		echo "whether your EXPAT version is new enough. I am assuming it is."
+	fi
+	:
+elif test -n "$expat_problem"; then
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: problem" >&5
+$as_echo "problem" >&6; }
+	echo "Sorry, your EXPAT version is too old. Disabling."
+	:
+elif test "x$expat_found" = "xno" ; then
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5
+$as_echo "not found" >&6; }
+	:
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef short ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
-test_array [0] = 0
+ if test "x$HAVE_EXPAT" = "xyes"; then
+  LINBOX_HAVE_EXPAT_TRUE=
+  LINBOX_HAVE_EXPAT_FALSE='#'
+else
+  LINBOX_HAVE_EXPAT_TRUE='#'
+  LINBOX_HAVE_EXPAT_FALSE=
+fi
 
-  ;
-  return 0;
+
+CXXFLAGS=${BACKUP_CXXFLAGS}
+LIBS=${BACKUP_LIBS}
+#unset LD_LIBRARY_PATH
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use run time optimization" >&5
+$as_echo_n "checking whether to use run time optimization... " >&6; }
+
+# Check whether --enable-optimization was given.
+if test "${enable_optimization+set}" = set; then :
+  enableval=$enable_optimization;
+
+
+BACKUP_CXXFLAGS=${CXXFLAGS}
+BACKUP_LIBS=${LIBS}
+
+CXXFLAGS=${FFLAFLAS_CFLAGS}
+
+if test "$cross_compiling" = yes; then :
+   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: cross compilation" >&5
+$as_echo "cross compilation" >&6; }
+	strassen_opti="no"
+
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+ #include "fflasffpack-config.h"
+   int main() {
+#ifdef __FFLAFLAS_STRASSEN_OPTIMIZATION
+return 0;
+#else
+pas bon !
+#endif
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid
+if ac_fn_cxx_try_run "$LINENO"; then :
+  	strassen_opti="yes"
+
+$as_echo "#define STRASSEN_OPTIMIZATION /**/" >>confdefs.h
+
+    WINO="`grep "define.*__FFLAFLAS_WINOTHRESHOLD" ${FFLAFLAS_LOC}/include/fflasffpack-config.h  | awk '{print $NF}'`"
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ok : $WINO" >&5
+$as_echo "ok : $WINO" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define WINOTHRESHOLD $WINO
+_ACEOF
+
+
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not enabled. Please optimise Strassen threshold in Fflas-Ffpack" >&5
+$as_echo "not enabled. Please optimise Strassen threshold in Fflas-Ffpack" >&6; }
+	strassen_opti="no"
 
-	ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_short=$ac_lo;;
-'') if test "$ac_cv_type_short" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (short)
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (short)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
-   else
-     ac_cv_sizeof_short=0
-   fi ;;
-esac
+
+
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef short ac__type_sizeof_;
-static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
-static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
 
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
-	return 1;
-      fprintf (f, "%ld\n", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
-	return 1;
-      fprintf (f, "%lu\n", i);
-    }
-  return ferror (f) || fclose (f) != 0;
 
-  ;
-  return 0;
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build documentation" >&5
+$as_echo_n "checking whether to build documentation... " >&6; }
+
+
+
+# Check whether --with-docdir was given.
+if test "${with_docdir+set}" = set; then :
+  withval=$with_docdir;
+		LINBOX_DOC_PATH="$withval"
+
+else
+
+		eval LINBOX_DOC_PATH="${prefix}/doc"
+
+fi
+
+
+
+
+
+# Check whether --with-doxygen was given.
+if test "${with_doxygen+set}" = set; then :
+  withval=$with_doxygen;
+		DOXYGEN_PATH="$PATH $withval"
+
+else
+
+		DOXYGEN_PATH="$PATH"
+
+fi
+
+
+# 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
+$as_echo_n "checking whether doxygen works... " >&6; }
+export PATH=$DOXYGEN_PATH
+(doxygen --version) < /dev/null > /dev/null 2>&1 || {
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+	echo
+	echo "You must have doxygen installed to create documentation for"
+	echo "LinBox. This error only happens if you use --enable-doc."
+	echo "Download the appropriate package for your distribution, or get"
+	echo "the source tarball from http://www.stack.nl/~dimitri/doxygen/"
+	exit -1
 }
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_short=`cat conftest.val`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ if true; then
+  LINBOX_BUILD_DOC_TRUE=
+  LINBOX_BUILD_DOC_FALSE='#'
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  LINBOX_BUILD_DOC_TRUE='#'
+  LINBOX_BUILD_DOC_FALSE=
+fi
 
-( exit $ac_status )
-if test "$ac_cv_type_short" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (short)
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (short)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
-   else
-     ac_cv_sizeof_short=0
-   fi
+
+else
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ if false; then
+  LINBOX_BUILD_DOC_TRUE=
+  LINBOX_BUILD_DOC_FALSE='#'
+else
+  LINBOX_BUILD_DOC_TRUE='#'
+  LINBOX_BUILD_DOC_FALSE=
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+
+
 fi
-rm -f conftest.val
+
+
+
+
+# this is bogus so far as I can tell.  -bds
+#CXXFLAGS="${GMP_CFLAGS} ${NTL_CFLAGS} ${GIVARO_CFLAGS} ${SACLIB_CFLAGS} ${CXXFLAGS}"
+#AC_SUBST(CXXFLAGS)
+
+CXXFLAGS="${GMP_CFLAGS} ${CXXFLAGS}"
+
+
+
+ac_config_files="$ac_config_files Makefile linbox-config examples/Makefile examples/fields/Makefile examples/Readme-make doc/Makefile linbox/Makefile linbox/algorithms/Makefile linbox/blackbox/Makefile linbox/element/Makefile linbox/field/Makefile linbox/matrix/Makefile linbox/randiter/Makefile linbox/ring/Makefile linbox/solutions/Makefile linbox/switch/Makefile linbox/util/Makefile linbox/util/formats/Makefile linbox/vector/Makefile tests/Makefile tests/data/Makefile tests/matrix/Makefile interfaces/Makefile interfaces/driver/Makefile interfaces/maple/Makefile interfaces/kaapi/Makefile interfaces/sage/Makefile macros/Makefile"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+  for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+      *) { eval $ac_var=; unset $ac_var;} ;;
+      esac ;;
+    esac
+  done
+
+  (set) 2>&1 |
+    case $as_nl`(ac_space=' '; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      # `set' does not quote correctly, so add quotes: double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \.
+      sed -n \
+	"s/'/'\\\\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;; #(
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+) |
+  sed '
+     /^ac_cv_env_/b end
+     t clear
+     :clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+  if test -w "$cache_file"; then
+    if test "x$cache_file" != "x/dev/null"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+      if test ! -f "$cache_file" || test -h "$cache_file"; then
+	cat confcache >"$cache_file"
+      else
+        case $cache_file in #(
+        */* | ?:*)
+	  mv -f confcache "$cache_file"$$ &&
+	  mv -f "$cache_file"$$ "$cache_file" ;; #(
+        *)
+	  mv -f confcache "$cache_file" ;;
+	esac
+      fi
+    fi
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+  fi
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5
-echo "${ECHO_T}$ac_cv_sizeof_short" >&6; }
+rm -f confcache
 
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
 
+DEFS=-DHAVE_CONFIG_H
 
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_SHORT $ac_cv_sizeof_short
-_ACEOF
+ac_libobjs=
+ac_ltlibobjs=
+U=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+  ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
+  #    will be set to the directory where LIBOBJS objects are built.
+  as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
 
+LTLIBOBJS=$ac_ltlibobjs
 
-{ echo "$as_me:$LINENO: checking for int" >&5
-echo $ECHO_N "checking for int... $ECHO_C" >&6; }
-if test "${ac_cv_type_int+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-typedef int ac__type_new_;
-int
-main ()
-{
-if ((ac__type_new_ *) 0)
-  return 0;
-if (sizeof (ac__type_new_))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_type_int=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_type_int=no
+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
+fi
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+  as_fn_error $? "conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${INSIDE_GNOME_COMMON_TRUE}" && test -z "${INSIDE_GNOME_COMMON_FALSE}"; then
+  as_fn_error $? "conditional \"INSIDE_GNOME_COMMON\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+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.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+if test -z "${LINBOX_COMPILE_DRIVERS_TRUE}" && test -z "${LINBOX_COMPILE_DRIVERS_FALSE}"; then
+  as_fn_error $? "conditional \"LINBOX_COMPILE_DRIVERS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LINBOX_HAVE_IML_TRUE}" && test -z "${LINBOX_HAVE_IML_FALSE}"; then
+  as_fn_error $? "conditional \"LINBOX_HAVE_IML\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LINBOX_HAVE_NTL_TRUE}" && test -z "${LINBOX_HAVE_NTL_FALSE}"; then
+  as_fn_error $? "conditional \"LINBOX_HAVE_NTL\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LINBOX_HAVE_GIVARO_TRUE}" && test -z "${LINBOX_HAVE_GIVARO_FALSE}"; then
+  as_fn_error $? "conditional \"LINBOX_HAVE_GIVARO\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LINBOX_HAVE_SACLIB_TRUE}" && test -z "${LINBOX_HAVE_SACLIB_FALSE}"; then
+  as_fn_error $? "conditional \"LINBOX_HAVE_SACLIB\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LINBOX_HAVE_LIDIA_TRUE}" && test -z "${LINBOX_HAVE_LIDIA_FALSE}"; then
+  as_fn_error $? "conditional \"LINBOX_HAVE_LIDIA\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LINBOX_HAVE_MAPLE_TRUE}" && test -z "${LINBOX_HAVE_MAPLE_FALSE}"; then
+  as_fn_error $? "conditional \"LINBOX_HAVE_MAPLE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LINBOX_COMPILE_DRIVERS_TRUE}" && test -z "${LINBOX_COMPILE_DRIVERS_FALSE}"; then
+  as_fn_error $? "conditional \"LINBOX_COMPILE_DRIVERS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LINBOX_HAVE_SAGE_TRUE}" && test -z "${LINBOX_HAVE_SAGE_FALSE}"; then
+  as_fn_error $? "conditional \"LINBOX_HAVE_SAGE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LINBOX_HAVE_FFLAFLAS_TRUE}" && test -z "${LINBOX_HAVE_FFLAFLAS_FALSE}"; then
+  as_fn_error $? "conditional \"LINBOX_HAVE_FFLAFLAS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LINBOX_HAVE_EXPAT_TRUE}" && test -z "${LINBOX_HAVE_EXPAT_FALSE}"; then
+  as_fn_error $? "conditional \"LINBOX_HAVE_EXPAT\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LINBOX_BUILD_DOC_TRUE}" && test -z "${LINBOX_BUILD_DOC_FALSE}"; then
+  as_fn_error $? "conditional \"LINBOX_BUILD_DOC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${LINBOX_BUILD_DOC_TRUE}" && test -z "${LINBOX_BUILD_DOC_FALSE}"; then
+  as_fn_error $? "conditional \"LINBOX_BUILD_DOC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5
-echo "${ECHO_T}$ac_cv_type_int" >&6; }
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ echo "$as_me:$LINENO: checking size of int" >&5
-echo $ECHO_N "checking size of int... $ECHO_C" >&6; }
-if test "${ac_cv_sizeof_int+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef int ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
-test_array [0] = 0
+: "${CONFIG_STATUS=./config.status}"
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef int ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
-test_array [0] = 0
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid; break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
 
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
+esac
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef int ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
-test_array [0] = 0
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='printf %s\n'
+  as_echo_n='printf %s'
+else
+  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+    as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+    as_echo_n='/usr/ucb/echo -n'
+  else
+    as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+    as_echo_n_body='eval
+      arg=$1;
+      case $arg in #(
+      *"$as_nl"*)
+	expr "X$arg" : "X\\(.*\\)$as_nl";
+	arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+      esac;
+      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+    '
+    export as_echo_n_body
+    as_echo_n='sh -c $as_echo_n_body as_echo'
+  fi
+  export as_echo_body
+  as_echo='sh -c $as_echo_body as_echo'
+fi
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef int ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
-test_array [0] = 0
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+      PATH_SEPARATOR=';'
+  }
+fi
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=$ac_mid; break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
-fi
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" ""	$as_nl"
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Find who we are.  Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
   done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+IFS=$as_save_IFS
 
-	ac_lo= ac_hi=
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
 fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+if test ! -f "$as_myself"; then
+  $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  exit 1
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef int ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
-test_array [0] = 0
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh).  But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there.  '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+  && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
 
-	ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_int=$ac_lo;;
-'') if test "$ac_cv_type_int" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (int)
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (int)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
-   else
-     ac_cv_sizeof_int=0
-   fi ;;
-esac
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef int ac__type_sizeof_;
-static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
-static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
 {
+  as_status=$1; test $as_status -eq 0 && as_status=1
+  if test "$4"; then
+    as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+    $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+  fi
+  $as_echo "$as_me: error: $2" >&2
+  as_fn_exit $as_status
+} # as_fn_error
 
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
-	return 1;
-      fprintf (f, "%ld\n", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
-	return 1;
-      fprintf (f, "%lu\n", i);
-    }
-  return ferror (f) || fclose (f) != 0;
 
-  ;
-  return 0;
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+  return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+  set +e
+  as_fn_set_status $1
+  exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+  { eval $1=; unset $1;}
 }
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_int=`cat conftest.val`
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+  eval 'as_fn_append ()
+  {
+    eval $1+=\$2
+  }'
 else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  as_fn_append ()
+  {
+    eval $1=\$$1\$2
+  }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+  eval 'as_fn_arith ()
+  {
+    as_val=$(( $* ))
+  }'
+else
+  as_fn_arith ()
+  {
+    as_val=`expr "$@" || test $? -eq 1`
+  }
+fi # as_fn_arith
 
-( exit $ac_status )
-if test "$ac_cv_type_int" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (int)
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (int)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
-   else
-     ac_cv_sizeof_int=0
-   fi
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
 fi
-rm -f conftest.val
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5
-echo "${ECHO_T}$ac_cv_sizeof_int" >&6; }
 
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
 
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\/\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
 
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_INT $ac_cv_sizeof_int
-_ACEOF
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
 
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+  case `echo 'xy\c'` in
+  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
+  xy)  ECHO_C='\c';;
+  *)   echo `echo ksh88 bug on AIX 6.1` > /dev/null
+       ECHO_T='	';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
 
-{ echo "$as_me:$LINENO: checking for long" >&5
-echo $ECHO_N "checking for long... $ECHO_C" >&6; }
-if test "${ac_cv_type_long+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-typedef long ac__type_new_;
-int
-main ()
-{
-if ((ac__type_new_ *) 0)
-  return 0;
-if (sizeof (ac__type_new_))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_type_long=yes
+  rm -f conf$$.dir
+  mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s='ln -s'
+    # ... 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'.
+    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+      as_ln_s='cp -p'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    as_ln_s=ln
+  else
+    as_ln_s='cp -p'
+  fi
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_cv_type_long=no
+  as_ln_s='cp -p'
 fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5
-echo "${ECHO_T}$ac_cv_type_long" >&6; }
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ echo "$as_me:$LINENO: checking size of long" >&5
-echo $ECHO_N "checking size of long... $ECHO_C" >&6; }
-if test "${ac_cv_sizeof_long+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef long ac__type_sizeof_;
-int
-main ()
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef long ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
-test_array [0] = 0
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || eval $as_mkdir_p || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid; break
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p='mkdir -p "$as_dir"'
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  test -d ./-p && rmdir ./-p
+  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
+
+# 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'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
 
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef long ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
-test_array [0] = 0
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by LinBox $as_me 1.2.0, which was
+generated by GNU Autoconf 2.68.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
 
-  ;
-  return 0;
-}
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
 esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef long ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
 esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=$ac_mid; break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
 
-	ac_lo= ac_hi=
-fi
+_ACEOF
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration.  Unless the files
+and actions are specified as TAGs, all are instantiated by default.
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef long ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
-test_array [0] = 0
+Usage: $0 [OPTION]... [TAG]...
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  -h, --help       print this help, then exit
+  -V, --version    print version number and configuration settings, then exit
+      --config     print configuration, then exit
+  -q, --quiet, --silent
+                   do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+      --file=FILE[:TEMPLATE]
+                   instantiate the configuration file FILE
+      --header=FILE[:TEMPLATE]
+                   instantiate the configuration header FILE
 
-	ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
+Configuration files:
+$config_files
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_long=$ac_lo;;
-'') if test "$ac_cv_type_long" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
-   else
-     ac_cv_sizeof_long=0
-   fi ;;
-esac
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef long ac__type_sizeof_;
-static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
-static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
+Configuration headers:
+$config_headers
 
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
-	return 1;
-      fprintf (f, "%ld\n", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
-	return 1;
-      fprintf (f, "%lu\n", i);
-    }
-  return ferror (f) || fclose (f) != 0;
+Configuration commands:
+$config_commands
+
+Report bugs to <linbox-use at googlegroups.com>.
+LinBox home page: <http://www.linalg.org/>."
 
-  ;
-  return 0;
-}
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_long=`cat conftest.val`
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
+ac_cs_version="\\
+LinBox config.status 1.2.0
+configured by $0, generated by GNU Autoconf 2.68,
+  with options \\"\$ac_cs_config\\"
 
-( exit $ac_status )
-if test "$ac_cv_type_long" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (long)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
-   else
-     ac_cv_sizeof_long=0
-   fi
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
-echo "${ECHO_T}$ac_cv_sizeof_long" >&6; }
+Copyright (C) 2010 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
+_ACEOF
 
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=?*)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  --*=)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=
+    ac_shift=:
+    ;;
+  *)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  esac
 
+  case $ac_option in
+  # Handling of the options.
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+    $as_echo "$ac_cs_version"; exit ;;
+  --config | --confi | --conf | --con | --co | --c )
+    $as_echo "$ac_cs_config"; exit ;;
+  --debug | --debu | --deb | --de | --d | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    case $ac_optarg in
+    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    '') as_fn_error $? "missing file argument" ;;
+    esac
+    as_fn_append CONFIG_FILES " '$ac_optarg'"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    case $ac_optarg in
+    *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    as_fn_append CONFIG_HEADERS " '$ac_optarg'"
+    ac_need_defaults=false;;
+  --he | --h)
+    # Conflict between --help and --header
+    as_fn_error $? "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
+  --help | --hel | -h )
+    $as_echo "$ac_cs_usage"; exit ;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
 
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG $ac_cv_sizeof_long
-_ACEOF
+  # This is an error.
+  -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
 
+  *) as_fn_append ac_config_targets " $1"
+     ac_need_defaults=false ;;
 
-{ echo "$as_me:$LINENO: checking for long long" >&5
-echo $ECHO_N "checking for long long... $ECHO_C" >&6; }
-if test "${ac_cv_type_long_long+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-typedef long long ac__type_new_;
-int
-main ()
-{
-if ((ac__type_new_ *) 0)
-  return 0;
-if (sizeof (ac__type_new_))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_type_long_long=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  esac
+  shift
+done
 
-	ac_cv_type_long_long=no
-fi
+ac_configure_extra_args=
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5
-echo "${ECHO_T}$ac_cv_type_long_long" >&6; }
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ echo "$as_me:$LINENO: checking size of long long" >&5
-echo $ECHO_N "checking size of long long... $ECHO_C" >&6; }
-if test "${ac_cv_sizeof_long_long+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef long long ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
-test_array [0] = 0
+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
+  shift
+  \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+  CONFIG_SHELL='$SHELL'
+  export CONFIG_SHELL
+  exec "\$@"
+fi
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef long long ac__type_sizeof_;
-int
-main ()
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
-test_array [0] = 0
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+  $as_echo "$ac_log"
+} >&5
 
-  ;
-  return 0;
-}
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid; break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#
+# INIT-COMMANDS
+#
+PACKAGE="$PACKAGE"
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
 
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef long long ac__type_sizeof_;
-int
-main ()
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
+enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
+SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
+ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
+host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
+host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
+host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
+build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
+build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
+build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
+SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
+Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
+GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
+EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
+FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
+LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
+NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
+LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
+exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
+lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
+file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
+want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
+DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
+sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
+AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
+archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
+STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
+lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
+CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
+compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
+GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
+nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
+lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
+objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
+need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
+MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
+LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
+libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
+postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
+need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
+version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
+install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
+striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`'
+predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`'
+postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`'
+predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`'
+postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`'
+LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`'
+reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`'
+reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`'
+GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`'
+lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`'
+archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`'
+export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
+whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`'
+old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`'
+allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
+no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld_CXX='`$ECHO "$hardcode_libdir_flag_spec_ld_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`'
+inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`'
+link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`'
+always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`'
+export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
+include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
+prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
+file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`'
+hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`'
+predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`'
+postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`'
+predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`'
+postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`'
+compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`'
+
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
-test_array [0] = 0
-
-  ;
-  return 0;
+  eval 'cat <<_LTECHO_EOF
+\$1
+_LTECHO_EOF'
 }
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef long long ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=$ac_mid; break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+# Quote evaled strings.
+for var in SHELL \
+ECHO \
+SED \
+GREP \
+EGREP \
+FGREP \
+LD \
+NM \
+LN_S \
+lt_SP2NL \
+lt_NL2SP \
+reload_flag \
+OBJDUMP \
+deplibs_check_method \
+file_magic_cmd \
+file_magic_glob \
+want_nocaseglob \
+DLLTOOL \
+sharedlib_from_linklib_cmd \
+AR \
+AR_FLAGS \
+archiver_list_spec \
+STRIP \
+RANLIB \
+CC \
+CFLAGS \
+compiler \
+lt_cv_sys_global_symbol_pipe \
+lt_cv_sys_global_symbol_to_cdecl \
+lt_cv_sys_global_symbol_to_c_name_address \
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
+nm_file_list_spec \
+lt_prog_compiler_no_builtin_flag \
+lt_prog_compiler_pic \
+lt_prog_compiler_wl \
+lt_prog_compiler_static \
+lt_cv_prog_compiler_c_o \
+need_locks \
+MANIFEST_TOOL \
+DSYMUTIL \
+NMEDIT \
+LIPO \
+OTOOL \
+OTOOL64 \
+shrext_cmds \
+export_dynamic_flag_spec \
+whole_archive_flag_spec \
+compiler_needs_object \
+with_gnu_ld \
+allow_undefined_flag \
+no_undefined_flag \
+hardcode_libdir_flag_spec \
+hardcode_libdir_flag_spec_ld \
+hardcode_libdir_separator \
+exclude_expsyms \
+include_expsyms \
+file_list_spec \
+variables_saved_for_relink \
+libname_spec \
+library_names_spec \
+soname_spec \
+install_override_mode \
+finish_eval \
+old_striplib \
+striplib \
+compiler_lib_search_dirs \
+predep_objects \
+postdep_objects \
+predeps \
+postdeps \
+compiler_lib_search_path \
+LD_CXX \
+reload_flag_CXX \
+compiler_CXX \
+lt_prog_compiler_no_builtin_flag_CXX \
+lt_prog_compiler_pic_CXX \
+lt_prog_compiler_wl_CXX \
+lt_prog_compiler_static_CXX \
+lt_cv_prog_compiler_c_o_CXX \
+export_dynamic_flag_spec_CXX \
+whole_archive_flag_spec_CXX \
+compiler_needs_object_CXX \
+with_gnu_ld_CXX \
+allow_undefined_flag_CXX \
+no_undefined_flag_CXX \
+hardcode_libdir_flag_spec_CXX \
+hardcode_libdir_flag_spec_ld_CXX \
+hardcode_libdir_separator_CXX \
+exclude_expsyms_CXX \
+include_expsyms_CXX \
+file_list_spec_CXX \
+compiler_lib_search_dirs_CXX \
+predep_objects_CXX \
+postdep_objects_CXX \
+predeps_CXX \
+postdeps_CXX \
+compiler_lib_search_path_CXX; do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[\\\\\\\`\\"\\\$]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
 
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
-fi
+# Double-quote double-evaled strings.
+for var in reload_cmds \
+old_postinstall_cmds \
+old_postuninstall_cmds \
+old_archive_cmds \
+extract_expsyms_cmds \
+old_archive_from_new_cmds \
+old_archive_from_expsyms_cmds \
+archive_cmds \
+archive_expsym_cmds \
+module_cmds \
+module_expsym_cmds \
+export_symbols_cmds \
+prelink_cmds \
+postlink_cmds \
+postinstall_cmds \
+postuninstall_cmds \
+finish_cmds \
+sys_lib_search_path_spec \
+sys_lib_dlsearch_path_spec \
+reload_cmds_CXX \
+old_archive_cmds_CXX \
+old_archive_from_new_cmds_CXX \
+old_archive_from_expsyms_cmds_CXX \
+archive_cmds_CXX \
+archive_expsym_cmds_CXX \
+module_cmds_CXX \
+module_expsym_cmds_CXX \
+export_symbols_cmds_CXX \
+prelink_cmds_CXX \
+postlink_cmds_CXX; do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[\\\\\\\`\\"\\\$]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+ac_aux_dir='$ac_aux_dir'
+xsi_shell='$xsi_shell'
+lt_shell_append='$lt_shell_append'
 
-	ac_lo= ac_hi=
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef long long ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
-test_array [0] = 0
+    PACKAGE='$PACKAGE'
+    VERSION='$VERSION'
+    TIMESTAMP='$TIMESTAMP'
+    RM='$RM'
+    ofile='$ofile'
+
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof_long_long=$ac_lo;;
-'') if test "$ac_cv_type_long_long" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long)
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (long long)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
-   else
-     ac_cv_sizeof_long_long=0
-   fi ;;
-esac
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef long long ac__type_sizeof_;
-static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
-static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
 
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
-    {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
-	return 1;
-      fprintf (f, "%ld\n", i);
-    }
-  else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
-	return 1;
-      fprintf (f, "%lu\n", i);
-    }
-  return ferror (f) || fclose (f) != 0;
 
-  ;
-  return 0;
-}
 _ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof_long_long=`cat conftest.val`
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-( exit $ac_status )
-if test "$ac_cv_type_long_long" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long)
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (long long)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
-   else
-     ac_cv_sizeof_long_long=0
-   fi
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+  case $ac_config_target in
+    "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+    "linbox/linbox-config.h") CONFIG_COMMANDS="$CONFIG_COMMANDS linbox/linbox-config.h" ;;
+    "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
+    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+    "linbox-config") CONFIG_FILES="$CONFIG_FILES linbox-config" ;;
+    "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
+    "examples/fields/Makefile") CONFIG_FILES="$CONFIG_FILES examples/fields/Makefile" ;;
+    "examples/Readme-make") CONFIG_FILES="$CONFIG_FILES examples/Readme-make" ;;
+    "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
+    "linbox/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/Makefile" ;;
+    "linbox/algorithms/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/algorithms/Makefile" ;;
+    "linbox/blackbox/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/blackbox/Makefile" ;;
+    "linbox/element/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/element/Makefile" ;;
+    "linbox/field/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/field/Makefile" ;;
+    "linbox/matrix/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/matrix/Makefile" ;;
+    "linbox/randiter/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/randiter/Makefile" ;;
+    "linbox/ring/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/ring/Makefile" ;;
+    "linbox/solutions/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/solutions/Makefile" ;;
+    "linbox/switch/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/switch/Makefile" ;;
+    "linbox/util/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/util/Makefile" ;;
+    "linbox/util/formats/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/util/formats/Makefile" ;;
+    "linbox/vector/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/vector/Makefile" ;;
+    "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
+    "tests/data/Makefile") CONFIG_FILES="$CONFIG_FILES tests/data/Makefile" ;;
+    "tests/matrix/Makefile") CONFIG_FILES="$CONFIG_FILES tests/matrix/Makefile" ;;
+    "interfaces/Makefile") CONFIG_FILES="$CONFIG_FILES interfaces/Makefile" ;;
+    "interfaces/driver/Makefile") CONFIG_FILES="$CONFIG_FILES interfaces/driver/Makefile" ;;
+    "interfaces/maple/Makefile") CONFIG_FILES="$CONFIG_FILES interfaces/maple/Makefile" ;;
+    "interfaces/kaapi/Makefile") CONFIG_FILES="$CONFIG_FILES interfaces/kaapi/Makefile" ;;
+    "interfaces/sage/Makefile") CONFIG_FILES="$CONFIG_FILES interfaces/sage/Makefile" ;;
+    "macros/Makefile") CONFIG_FILES="$CONFIG_FILES macros/Makefile" ;;
+
+  *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+  esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
 fi
-{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5
-echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6; }
 
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+  tmp= ac_tmp=
+  trap 'exit_status=$?
+  : "${ac_tmp:=$tmp}"
+  { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+' 0
+  trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
 
+{
+  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+  test -d "$tmp"
+}  ||
+{
+  tmp=./conf$$-$RANDOM
+  (umask 077 && mkdir "$tmp")
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
 
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
-_ACEOF
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
 
 
-{ echo "$as_me:$LINENO: checking for __int64" >&5
-echo $ECHO_N "checking for __int64... $ECHO_C" >&6; }
-if test "${ac_cv_type___int64+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+  eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+  ac_cs_awk_cr='\\r'
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-typedef __int64 ac__type_new_;
-int
-main ()
-{
-if ((ac__type_new_ *) 0)
-  return 0;
-if (sizeof (ac__type_new_))
-  return 0;
-  ;
-  return 0;
-}
+  ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_type___int64=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-	ac_cv_type___int64=no
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type___int64" >&5
-echo "${ECHO_T}$ac_cv_type___int64" >&6; }
+{
+  echo "cat >conf$$subs.awk <<_ACEOF" &&
+  echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+  echo "_ACEOF"
+} >conf$$subs.sh ||
+  as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  . ./conf$$subs.sh ||
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
 
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ echo "$as_me:$LINENO: checking size of __int64" >&5
-echo $ECHO_N "checking size of __int64... $ECHO_C" >&6; }
-if test "${ac_cv_sizeof___int64+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test "$cross_compiling" = yes; then
-  # Depending upon the size, compute the lo and hi bounds.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+  ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+  if test $ac_delim_n = $ac_delim_num; then
+    break
+  elif $ac_last_try; then
+    as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef __int64 ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
-test_array [0] = 0
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+  N
+  s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+  for (key in S) S_is_set[key] = 1
+  FS = ""
 
-  ;
-  return 0;
 }
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=0 ac_mid=0
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef __int64 ac__type_sizeof_;
-int
-main ()
 {
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
-test_array [0] = 0
+  line = $ 0
+  nfields = split(line, field, "@")
+  substed = 0
+  len = length(field[1])
+  for (i = 2; i < nfields; i++) {
+    key = field[i]
+    keylen = length(key)
+    if (S_is_set[key]) {
+      value = S[key]
+      line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+      len += length(value) + length(field[++i])
+      substed = 1
+    } else
+      len += 1 + keylen
+  }
 
-  ;
-  return 0;
+  print line
 }
+
+_ACAWK
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid; break
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+  sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+  cat
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+  || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
+_ACEOF
 
-	ac_lo=`expr $ac_mid + 1`
-			if test $ac_lo -le $ac_mid; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid + 1`
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[	 ]*VPATH[	 ]*=[	 ]*/{
+h
+s///
+s/^/:/
+s/[	 ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
+s/:*$//
+x
+s/\(=[	 ]*\).*/\1/
+G
+s/\n//
+s/^[^=]*=[	 ]*$//
+}'
 fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
 
-	cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef __int64 ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
-test_array [0] = 0
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=-1 ac_mid=-1
-  while :; do
-    cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef __int64 ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
-test_array [0] = 0
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
 
-  ;
-  return 0;
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+  ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+  if test -z "$ac_tt"; then
+    break
+  elif $ac_last_try; then
+    as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any.  Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[	 ]*#[	 ]*define[	 ][	 ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[	 ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[	 ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[	 ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[	 ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+  for (key in D) D_is_set[key] = 1
+  FS = ""
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+  line = \$ 0
+  split(line, arg, " ")
+  if (arg[1] == "#") {
+    defundef = arg[2]
+    mac1 = arg[3]
+  } else {
+    defundef = substr(arg[1], 2)
+    mac1 = arg[2]
+  }
+  split(mac1, mac2, "(") #)
+  macro = mac2[1]
+  prefix = substr(line, 1, index(line, defundef) - 1)
+  if (D_is_set[macro]) {
+    # Preserve the white space surrounding the "#".
+    print prefix "define", macro P[macro] D[macro]
+    next
+  } else {
+    # Replace #undef with comments.  This is necessary, for example,
+    # in the case of _POSIX_SOURCE, which is predefined and required
+    # on some systems where configure will not decide to define it.
+    if (defundef == "undef") {
+      print "/*", prefix defundef, macro, "*/"
+      next
+    }
+  }
 }
+{ print }
+_ACAWK
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_lo=$ac_mid; break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+  as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
+fi # test -n "$CONFIG_HEADERS"
 
-	ac_hi=`expr '(' $ac_mid ')' - 1`
-			if test $ac_mid -le $ac_hi; then
-			  ac_lo= ac_hi=
-			  break
-			fi
-			ac_mid=`expr 2 '*' $ac_mid`
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+eval set X "  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS"
+shift
+for ac_tag
+do
+  case $ac_tag in
+  :[FHLC]) ac_mode=$ac_tag; continue;;
+  esac
+  case $ac_mode$ac_tag in
+  :[FHL]*:*);;
+  :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+  :[FH]-) ac_tag=-:-;;
+  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+  esac
+  ac_save_IFS=$IFS
+  IFS=:
+  set x $ac_tag
+  IFS=$ac_save_IFS
+  shift
+  ac_file=$1
+  shift
+
+  case $ac_mode in
+  :L) ac_source=$1;;
+  :[FH])
+    ac_file_inputs=
+    for ac_f
+    do
+      case $ac_f in
+      -) ac_f="$ac_tmp/stdin";;
+      *) # Look for the file first in the build tree, then in the source tree
+	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
+	 # because $ac_f cannot contain `:'.
+	 test -f "$ac_f" ||
+	   case $ac_f in
+	   [\\/$]*) false;;
+	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+	   esac ||
+	   as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+      esac
+      case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+      as_fn_append ac_file_inputs " '$ac_f'"
+    done
+
+    # Let's still pretend it is `configure' which instantiates (i.e., don't
+    # use $as_me), people would be surprised to read:
+    #    /* config.h.  Generated by config.status.  */
+    configure_input='Generated from '`
+	  $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+	`' by configure.'
+    if test x"$ac_file" != x-; then
+      configure_input="$ac_file.  $configure_input"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+    fi
+    # Neutralize special characters interpreted by sed in replacement strings.
+    case $configure_input in #(
+    *\&* | *\|* | *\\* )
+       ac_sed_conf_input=`$as_echo "$configure_input" |
+       sed 's/[\\\\&|]/\\\\&/g'`;; #(
+    *) ac_sed_conf_input=$configure_input;;
+    esac
+
+    case $ac_tag in
+    *:-:* | *:-) cat >"$ac_tmp/stdin" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+    esac
+    ;;
+  esac
+
+  ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$ac_file" : 'X\(//\)[^/]' \| \
+	 X"$ac_file" : 'X\(//\)$' \| \
+	 X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+  as_dir="$ac_dir"; as_fn_mkdir_p
+  ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
 
-	ac_lo= ac_hi=
-fi
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
-  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+  case $ac_mode in
+  :F)
+  #
+  # CONFIG_FILE
+  #
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+  esac
+  ac_MKDIR_P=$MKDIR_P
+  case $MKDIR_P in
+  [\\/$]* | ?:[\\/]* ) ;;
+  */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+  esac
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef __int64 ac__type_sizeof_;
-int
-main ()
-{
-static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
-test_array [0] = 0
 
-  ;
-  return 0;
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+  p
+  q
 }
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
 _ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+  ac_datarootdir_hack='
+  s&@datadir@&$datadir&g
+  s&@docdir@&$docdir&g
+  s&@infodir@&$infodir&g
+  s&@localedir@&$localedir&g
+  s&@mandir@&$mandir&g
+  s&\\\${datarootdir}&$datarootdir&g' ;;
 esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_hi=$ac_mid
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-	ac_lo=`expr '(' $ac_mid ')' + 1`
-fi
+_ACEOF
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in
-?*) ac_cv_sizeof___int64=$ac_lo;;
-'') if test "$ac_cv_type___int64" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (__int64)
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (__int64)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
-   else
-     ac_cv_sizeof___int64=0
-   fi ;;
-esac
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
 _ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-   typedef __int64 ac__type_sizeof_;
-static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
-static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+  >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
 
-  FILE *f = fopen ("conftest.val", "w");
-  if (! f)
-    return 1;
-  if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' \
+      "$ac_tmp/out"`; test -z "$ac_out"; } &&
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined" >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined" >&2;}
+
+  rm -f "$ac_tmp/stdin"
+  case $ac_file in
+  -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+  *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+  esac \
+  || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
+  :H)
+  #
+  # CONFIG_HEADER
+  #
+  if test x"$ac_file" != x-; then
     {
-      long int i = longval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
-	return 1;
-      fprintf (f, "%ld\n", i);
-    }
+      $as_echo "/* $configure_input  */" \
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+    } >"$ac_tmp/config.h" \
+      || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+    if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
+    else
+      rm -f "$ac_file"
+      mv "$ac_tmp/config.h" "$ac_file" \
+	|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
+    fi
   else
-    {
-      unsigned long int i = ulongval ();
-      if (i != ((long int) (sizeof (ac__type_sizeof_))))
-	return 1;
-      fprintf (f, "%lu\n", i);
-    }
-  return ferror (f) || fclose (f) != 0;
+    $as_echo "/* $configure_input  */" \
+      && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+      || as_fn_error $? "could not create -" "$LINENO" 5
+  fi
+# Compute "$ac_file"'s index in $config_headers.
+_am_arg="$ac_file"
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $_am_arg | $_am_arg:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
+$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$_am_arg" : 'X\(//\)[^/]' \| \
+	 X"$_am_arg" : 'X\(//\)$' \| \
+	 X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$_am_arg" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
 
-  ;
-  return 0;
+  :C)  { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+  esac
+
+
+  case $ac_file$ac_mode in
+    "linbox/linbox-config.h":C) ac_prefix_conf_OUT=`echo linbox/linbox-config.h`
+ac_prefix_conf_DEF=`echo _$ac_prefix_conf_OUT | sed -e "y:abcdefghijklmnopqrstuvwxyz:ABCDEFGHIJKLMNOPQRSTUVWXYZ:" -e "s/[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g"`
+ac_prefix_conf_PKG=`echo __LINBOX`
+ac_prefix_conf_LOW=`echo _$ac_prefix_conf_PKG | sed -e "y:ABCDEFGHIJKLMNOPQRSTUVWXYZ-:abcdefghijklmnopqrstuvwxyz_:"`
+ac_prefix_conf_UPP=`echo $ac_prefix_conf_PKG | sed -e "y:abcdefghijklmnopqrstuvwxyz-:ABCDEFGHIJKLMNOPQRSTUVWXYZ_:"  -e "/^[0123456789]/s/^/_/"`
+ac_prefix_conf_INP=`echo "" | sed -e 's/ *//'`
+if test ".$ac_prefix_conf_INP" = "."; then
+   for ac_file in : $CONFIG_HEADERS; do test "_$ac_file" = _: && continue
+     case "$ac_file" in
+        *.h) ac_prefix_conf_INP=$ac_file ;;
+        *)
+     esac
+     test ".$ac_prefix_conf_INP" != "." && break
+   done
+fi
+if test ".$ac_prefix_conf_INP" = "."; then
+   case "$ac_prefix_conf_OUT" in
+      */*) ac_prefix_conf_INP=`basename "$ac_prefix_conf_OUT"`
+      ;;
+      *-*) ac_prefix_conf_INP=`echo "$ac_prefix_conf_OUT" | sed -e "s/[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*-//"`
+      ;;
+      *) ac_prefix_conf_INP=config.h
+      ;;
+   esac
+fi
+if test -z "$ac_prefix_conf_PKG" ; then
+   as_fn_error $? "no prefix for _PREFIX_PKG_CONFIG_H" "$LINENO" 5
+else
+  if test ! -f "$ac_prefix_conf_INP" ; then if test -f "$srcdir/$ac_prefix_conf_INP" ; then
+     ac_prefix_conf_INP="$srcdir/$ac_prefix_conf_INP"
+  fi fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_prefix_conf_OUT - prefix $ac_prefix_conf_UPP for $ac_prefix_conf_INP defines" >&5
+$as_echo "$as_me: creating $ac_prefix_conf_OUT - prefix $ac_prefix_conf_UPP for $ac_prefix_conf_INP defines" >&6;}
+  if test -f $ac_prefix_conf_INP ; then
+    echo "s/#undef  *\\([ABCDEFGHIJKLMNOPQRSTUVWXYZ_]\\)/#undef $ac_prefix_conf_UPP""_\\1/" > conftest.prefix
+    echo "s/#undef  *\\([abcdefghijklmnopqrstuvwxyz]\\)/#undef $ac_prefix_conf_LOW""_\\1/" >> conftest.prefix
+    echo "s/#define  *\\([ABCDEFGHIJKLMNOPQRSTUVWXYZ_][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*\\)\\(.*\\)/#ifndef $ac_prefix_conf_UPP""_\\1 \\" >> conftest.prefix
+    echo "#define $ac_prefix_conf_UPP""_\\1 \\2 \\" >> conftest.prefix
+    echo "#endif/" >>conftest.prefix
+    echo "s/#define  *\\([abcdefghijklmnopqrstuvwxyz][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_]*\\)\\(.*\\)/#ifndef $ac_prefix_conf_LOW""_\\1 \\" >> conftest.prefix
+    echo "#define $ac_prefix_conf_LOW""_\\1 \\2 \\" >> conftest.prefix
+    echo "#endif/" >> conftest.prefix
+    # now executing _script on _DEF input to create _OUT output file
+    echo "#ifndef $ac_prefix_conf_DEF"      >$tmp/pconfig.h
+    echo "#define $ac_prefix_conf_DEF 1" >>$tmp/pconfig.h
+    echo ' ' >>$tmp/pconfig.h
+    echo /'*' $ac_prefix_conf_OUT. Generated automatically at end of configure. '*'/ >>$tmp/pconfig.h
+
+    sed -f conftest.prefix $ac_prefix_conf_INP >>$tmp/pconfig.h
+    echo ' ' >>$tmp/pconfig.h
+    echo '/* once:' $ac_prefix_conf_DEF '*/' >>$tmp/pconfig.h
+    echo "#endif" >>$tmp/pconfig.h
+    if cmp -s $ac_prefix_conf_OUT $tmp/pconfig.h 2>/dev/null; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_prefix_conf_OUT is unchanged" >&5
+$as_echo "$as_me: $ac_prefix_conf_OUT is unchanged" >&6;}
+    else
+      ac_dir=`$as_dirname -- "$ac_prefix_conf_OUT" ||
+$as_expr X"$ac_prefix_conf_OUT" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$ac_prefix_conf_OUT" : 'X\(//\)[^/]' \| \
+	 X"$ac_prefix_conf_OUT" : 'X\(//\)$' \| \
+	 X"$ac_prefix_conf_OUT" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_prefix_conf_OUT" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      as_dir="$ac_dir"; as_fn_mkdir_p
+      rm -f "$ac_prefix_conf_OUT"
+      mv $tmp/pconfig.h "$ac_prefix_conf_OUT"
+    fi
+    cp conftest.prefix _configs.sed
+  else
+    as_fn_error $? "input file $ac_prefix_conf_INP does not exist - skip generating $ac_prefix_conf_OUT" "$LINENO" 5
+  fi
+  rm -f conftest.*
+fi
+ ;;
+    "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
+  # Autoconf 2.62 quotes --file arguments for eval, but not when files
+  # are listed without --file.  Let's play safe and only enable the eval
+  # if we detect the quoting.
+  case $CONFIG_FILES in
+  *\'*) eval set x "$CONFIG_FILES" ;;
+  *)   set x $CONFIG_FILES ;;
+  esac
+  shift
+  for mf
+  do
+    # Strip MF so we end up with the name of the file.
+    mf=`echo "$mf" | sed -e 's/:.*$//'`
+    # Check whether this is an Automake generated Makefile or not.
+    # We used to match only the files named `Makefile.in', but
+    # some people rename them; so instead we look at the file content.
+    # Grep'ing the first line is not enough: some people post-process
+    # each Makefile.in and add a new line on top of each file to say so.
+    # Grep'ing the whole file is not good either: AIX grep has a line
+    # limit of 2048, but all sed's we know have understand at least 4000.
+    if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+      dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$mf" : 'X\(//\)[^/]' \| \
+	 X"$mf" : 'X\(//\)$' \| \
+	 X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$mf" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+    else
+      continue
+    fi
+    # Extract the definition of DEPDIR, am__include, and am__quote
+    # from the Makefile without running `make'.
+    DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+    test -z "$DEPDIR" && continue
+    am__include=`sed -n 's/^am__include = //p' < "$mf"`
+    test -z "am__include" && continue
+    am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+    # When using ansi2knr, U may be empty or an underscore; expand it
+    U=`sed -n 's/^U = //p' < "$mf"`
+    # Find all dependency output files, they are included files with
+    # $(DEPDIR) in their names.  We invoke sed twice because it is the
+    # simplest approach to changing $(DEPDIR) to its actual value in the
+    # expansion.
+    for file in `sed -n "
+      s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+	 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+      # Make sure the directory exists.
+      test -f "$dirpart/$file" && continue
+      fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$file" : 'X\(//\)[^/]' \| \
+	 X"$file" : 'X\(//\)$' \| \
+	 X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)[^/].*/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\/\)$/{
+	    s//\1/
+	    q
+	  }
+	  /^X\(\/\).*/{
+	    s//\1/
+	    q
+	  }
+	  s/.*/./; q'`
+      as_dir=$dirpart/$fdir; as_fn_mkdir_p
+      # echo "creating $dirpart/$file"
+      echo '# dummy' > "$dirpart/$file"
+    done
+  done
 }
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_sizeof___int64=`cat conftest.val`
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+ ;;
+    "libtool":C)
 
-( exit $ac_status )
-if test "$ac_cv_type___int64" = yes; then
-     { { echo "$as_me:$LINENO: error: cannot compute sizeof (__int64)
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute sizeof (__int64)
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
-   else
-     ac_cv_sizeof___int64=0
-   fi
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f conftest.val
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_sizeof___int64" >&5
-echo "${ECHO_T}$ac_cv_sizeof___int64" >&6; }
+    # See if we are running on zsh, and set the options which allow our
+    # commands through without removal of \ escapes.
+    if test -n "${ZSH_VERSION+set}" ; then
+      setopt NO_GLOB_SUBST
+    fi
 
+    cfgfile="${ofile}T"
+    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+    $RM "$cfgfile"
 
+    cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
 
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF___INT64 $ac_cv_sizeof___int64
-_ACEOF
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
+#                 Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
 
+# The names of the tagged configurations supported by this script.
+available_tags="CXX "
 
-# check endianness of the architecture
-{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
-echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; }
-if test "${ac_cv_c_bigendian+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  # See if sys/param.h defines the BYTE_ORDER macro.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <sys/param.h>
+# ### BEGIN LIBTOOL CONFIG
 
-int
-main ()
-{
-#if  ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \
-	&& BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN)
- bogus endian macros
-#endif
+# Which release of libtool.m4 was used?
+macro_version=$macro_version
+macro_revision=$macro_revision
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  # It does; now see whether it defined to BIG_ENDIAN or not.
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <sys/types.h>
-#include <sys/param.h>
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
 
-int
-main ()
-{
-#if BYTE_ORDER != BIG_ENDIAN
- not big endian
-#endif
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  ac_cv_c_bigendian=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+# What type of objects to build.
+pic_mode=$pic_mode
 
-	ac_cv_c_bigendian=no
-fi
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
 
-	# It does not; compile a test program.
-if test "$cross_compiling" = yes; then
-  # try to guess the endianness by grepping values into an object file
-  ac_cv_c_bigendian=unknown
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
-short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
-void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
-short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
-short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
-void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
-int
-main ()
-{
- _ascii (); _ebcdic ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && {
-	 test -z "$ac_c_werror_flag" ||
-	 test ! -s conftest.err
-       } && test -s conftest.$ac_objext; then
-  if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
-  ac_cv_c_bigendian=yes
-fi
-if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
-  if test "$ac_cv_c_bigendian" = unknown; then
-    ac_cv_c_bigendian=no
-  else
-    # finding both strings is unlikely to happen, but who knows?
-    ac_cv_c_bigendian=unknown
-  fi
-fi
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+# An echo program that protects backslashes.
+ECHO=$lt_ECHO
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
 
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
 
-fi
+# A sed program that does not truncate output.
+SED=$lt_SED
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="\$SED -e 1s/^X//"
 
-  /* Are we little or big endian?  From Harbison&Steele.  */
-  union
-  {
-    long int l;
-    char c[sizeof (long int)];
-  } u;
-  u.l = 1;
-  return u.c[sizeof (long int) - 1] == 1;
+# A grep program that handles long lines.
+GREP=$lt_GREP
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_c_bigendian=no
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+# An ERE matcher.
+EGREP=$lt_EGREP
 
-( exit $ac_status )
-ac_cv_c_bigendian=yes
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
+# A literal string matcher.
+FGREP=$lt_FGREP
 
+# A BSD- or MS-compatible name lister.
+NM=$lt_NM
 
-fi
+# Whether we need soft or hard links.
+LN_S=$lt_LN_S
 
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
-echo "${ECHO_T}$ac_cv_c_bigendian" >&6; }
-case $ac_cv_c_bigendian in
-  yes)
+# What is the maximum length of a command?
+max_cmd_len=$max_cmd_len
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_BIG_ENDIAN 1
-_ACEOF
- ;;
-  no)
+# Object file suffix (normally "o").
+objext=$ac_objext
 
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_LITTLE_ENDIAN 1
-_ACEOF
- ;;
-  *)
-    { { echo "$as_me:$LINENO: error: unknown endianness
-presetting ac_cv_c_bigendian=no (or yes) will help" >&5
-echo "$as_me: error: unknown endianness
-presetting ac_cv_c_bigendian=no (or yes) will help" >&2;}
-   { (exit 1); exit 1; }; } ;;
-esac
+# Executable file suffix (normally "").
+exeext=$exeext
 
+# whether the shell understands "unset".
+lt_unset=$lt_unset
 
-# Create some useful data types of fixed, known lengths
+# turn spaces into newlines.
+SP2NL=$lt_lt_SP2NL
 
-# We hereby assume that a character is always one byte
-LINBOX_INT8="char";
+# turn newlines into spaces.
+NL2SP=$lt_lt_NL2SP
 
-case $ac_cv_sizeof_char in
-  1)
-     TWO_BYTES=2;
-     FOUR_BYTES=4;
-     EIGHT_BYTES=8;
-     ;;
-  8)
-     TWO_BYTES=16;
-     FOUR_BYTES=32;
-     EIGHT_BYTES=64;
-esac
+# convert \$build file names to \$host format.
+to_host_file_cmd=$lt_cv_to_host_file_cmd
 
-case $TWO_BYTES in
-  $ac_cv_sizeof_short)
-     LINBOX_INT16="short";
-     ;;
-  $ac_cv_sizeof_int)
-     LINBOX_INT16="int";
-     ;;
-esac
+# convert \$build files to toolchain format.
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
 
-case $FOUR_BYTES in
-  $ac_cv_sizeof_short)
-     LINBOX_INT32="short";
-     ;;
-  $ac_cv_sizeof_int)
-     LINBOX_INT32="int";
-     ;;
-  $ac_cv_sizeof_long)
-     LINBOX_INT32="long";
-     ;;
-esac
+# An object symbol dumper.
+OBJDUMP=$lt_OBJDUMP
 
-case $EIGHT_BYTES in
-  $ac_cv_sizeof_short)
-     LINBOX_INT64="short";
-     ;;
-  $ac_cv_sizeof_int)
-     LINBOX_INT64="int";
-     ;;
-  $ac_cv_sizeof_long)
-     LINBOX_INT64="long";
-     ;;
-  $ac_cv_sizeof_long_long)
-     LINBOX_INT64="long long";
-     ;;
-  $ac_cv_sizeof___int64)
-     LINBOX_INT64="__int64";
-     ;;
-esac
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
 
+# Command to use when deplibs_check_method = "file_magic".
+file_magic_cmd=$lt_file_magic_cmd
 
-cat >>confdefs.h <<_ACEOF
-#define INT8 $LINBOX_INT8
-_ACEOF
+# How to find potential files when deplibs_check_method = "file_magic".
+file_magic_glob=$lt_file_magic_glob
 
+# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
+want_nocaseglob=$lt_want_nocaseglob
 
-cat >>confdefs.h <<_ACEOF
-#define INT16 $LINBOX_INT16
-_ACEOF
+# DLL creation program.
+DLLTOOL=$lt_DLLTOOL
 
+# Command to associate shared and link libraries.
+sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
 
-cat >>confdefs.h <<_ACEOF
-#define INT32 $LINBOX_INT32
-_ACEOF
+# The archiver.
+AR=$lt_AR
 
+# Flags to create an archive.
+AR_FLAGS=$lt_AR_FLAGS
 
-cat >>confdefs.h <<_ACEOF
-#define INT64 $LINBOX_INT64
-_ACEOF
+# How to feed a file listing to the archiver.
+archiver_list_spec=$lt_archiver_list_spec
+
+# A symbol stripping program.
+STRIP=$lt_STRIP
+
+# Commands used to install an old-style archive.
+RANLIB=$lt_RANLIB
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
 
+# Whether to use a lock for old archive extraction.
+lock_old_archive_extraction=$lock_old_archive_extraction
 
-# Feature checks
-LB_MISC
-LB_DRIVER
+# A C compiler.
+LTCC=$lt_CC
 
-ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+# LTCC compiler flags.
+LTCFLAGS=$lt_CFLAGS
 
-LB_CHECK_GMP(,,
-echo '*******************************************************************************'
-echo ' ERROR: GMP not found!'
-echo
-echo ' GMP version 3.1.1 or greater with --enable-cxx is required for this library to compile. Please'
-echo ' make sure GMP is installed and specify its location with the option'
-echo ' --with-gmp=<prefix> when running configure.'
-echo '*******************************************************************************'
-exit 1
-)
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
 
-LB_CHECK_NTL
-LB_CHECK_GIVARO(,,
-echo '*******************************************************************************'
-echo ' ERROR: GIVARO not found!'
-echo
-echo ' GIVARO version 3.2.10 or greater is required for this library to compile.'
-echo ' Please make sure GIVARO is installed and specify its location with the'
-echo ' option --with-givaro=<prefix> when running configure.'
-echo '*******************************************************************************'
-exit 1
-exit 1
-)
-LB_CHECK_SACLIB
-LB_CHECK_LIDIA
-LB_CHECK_MAPLE
-LB_CHECK_SAGE
-#LB_CHECK_ATLAS
-LB_CHECK_BLAS(,,
-echo ''
-echo '*******************************************************************************'
-echo ' ERROR: BLAS not found!'
-echo
-echo ' BLAS routines are required for this library to compile. Please'
-echo ' make sure BLAS are installed and specify its location with the option'
-echo ' --with-blas=<lib> when running configure.'
-echo '*******************************************************************************'
-exit 1
-)
-LB_CHECK_EXPAT
+# Transform the output of nm in a proper C declaration.
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
 
-LB_OPT
-LB_DOC
+# Transform the output of nm in a C name address pair.
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
 
+# Transform the output of nm in a C name address pair when lib prefix is needed.
+global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
 
-# this is bogus so far as I can tell.  -bds
-#CXXFLAGS="${GMP_CFLAGS} ${NTL_CFLAGS} ${GIVARO_CFLAGS} ${SACLIB_CFLAGS} ${CXXFLAGS}"
-#AC_SUBST(CXXFLAGS)
+# Specify filename containing input files for \$NM.
+nm_file_list_spec=$lt_nm_file_list_spec
 
-ac_config_files="$ac_config_files Makefile linbox-config examples/Makefile examples/fields/Makefile examples/Readme-make doc/Makefile linbox/Makefile linbox/algorithms/Makefile linbox/fflas/Makefile linbox/ffpack/Makefile linbox/blackbox/Makefile linbox/element/Makefile linbox/field/Makefile linbox/matrix/Makefile linbox/randiter/Makefile linbox/ring/Makefile linbox/solutions/Makefile linbox/switch/Makefile linbox/util/Makefile linbox/util/formats/Makefile linbox/vector/Makefile tests/Makefile tests/data/Makefile interfaces/Makefile interfaces/driver/Makefile interfaces/maple/Makefile interfaces/kaapi/Makefile interfaces/sage/Makefile macros/Makefile"
+# The root where to search for dependent libraries,and in which our libraries should be installed.
+lt_sysroot=$lt_sysroot
 
-cat >confcache <<\_ACEOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs, see configure's option --config-cache.
-# It is not useful on other systems.  If it contains results you don't
-# want to keep, you may remove or edit it.
-#
-# config.status only pays attention to the cache file if you give it
-# the --recheck option to rerun configure.
-#
-# `ac_cv_env_foo' variables (set or unset) will be overridden when
-# loading this file, other *unset* `ac_cv_foo' will be assigned the
-# following values.
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
 
-_ACEOF
+# Used to examine libraries when file_magic_cmd begins with "file".
+MAGIC_CMD=$MAGIC_CMD
 
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, we kill variables containing newlines.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-(
-  for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
-    eval ac_val=\$$ac_var
-    case $ac_val in #(
-    *${as_nl}*)
-      case $ac_var in #(
-      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
-      esac
-      case $ac_var in #(
-      _ | IFS | as_nl) ;; #(
-      *) $as_unset $ac_var ;;
-      esac ;;
-    esac
-  done
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
 
-  (set) 2>&1 |
-    case $as_nl`(ac_space=' '; set) 2>&1` in #(
-    *${as_nl}ac_space=\ *)
-      # `set' does not quote correctly, so add quotes (double-quote
-      # substitution turns \\\\ into \\, and sed turns \\ into \).
-      sed -n \
-	"s/'/'\\\\''/g;
-	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
-      ;; #(
-    *)
-      # `set' quotes correctly as required by POSIX, so do not add quotes.
-      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
-      ;;
-    esac |
-    sort
-) |
-  sed '
-     /^ac_cv_env_/b end
-     t clear
-     :clear
-     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
-     t end
-     s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
-     :end' >>confcache
-if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
-  if test -w "$cache_file"; then
-    test "x$cache_file" != "x/dev/null" &&
-      { echo "$as_me:$LINENO: updating cache $cache_file" >&5
-echo "$as_me: updating cache $cache_file" >&6;}
-    cat confcache >$cache_file
-  else
-    { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
-echo "$as_me: not updating unwritable cache $cache_file" >&6;}
-  fi
-fi
-rm -f confcache
+# Manifest tool.
+MANIFEST_TOOL=$lt_MANIFEST_TOOL
 
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
+DSYMUTIL=$lt_DSYMUTIL
 
-DEFS=-DHAVE_CONFIG_H
+# Tool to change global to local symbols on Mac OS X.
+NMEDIT=$lt_NMEDIT
 
-ac_libobjs=
-ac_ltlibobjs=
-for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
-  # 1. Remove the extension, and $U if already installed.
-  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
-  ac_i=`echo "$ac_i" | sed "$ac_script"`
-  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
-  #    will be set to the directory where LIBOBJS objects are built.
-  ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
-  ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
-done
-LIBOBJS=$ac_libobjs
+# Tool to manipulate fat objects and archives on Mac OS X.
+LIPO=$lt_LIPO
 
-LTLIBOBJS=$ac_ltlibobjs
+# ldd/readelf like tool for Mach-O binaries on Mac OS X.
+OTOOL=$lt_OTOOL
 
+# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
+OTOOL64=$lt_OTOOL64
 
-if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"AMDEP\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
+# Old archive suffix (normally "a").
+libext=$libext
 
-: ${CONFIG_STATUS=./config.status}
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
-echo "$as_me: creating $CONFIG_STATUS" >&6;}
-cat >$CONFIG_STATUS <<_ACEOF
-#! $SHELL
-# Generated by $as_me.
-# Run this file to recreate the current configuration.
-# Compiler output produced by configure, useful for debugging
-# configure, is in config.log if it exists.
+# Shared library suffix (normally ".so").
+shrext_cmds=$lt_shrext_cmds
 
-debug=false
-ac_cs_recheck=false
-ac_cs_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_ACEOF
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
 
-cat >>$CONFIG_STATUS <<\_ACEOF
-## --------------------- ##
-## M4sh Initialization.  ##
-## --------------------- ##
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at link time.
+variables_saved_for_relink=$lt_variables_saved_for_relink
 
-# Be more Bourne compatible
-DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
-esac
+# Do we need the "lib" prefix for modules?
+need_lib_prefix=$need_lib_prefix
 
-fi
+# Do we need a version for libraries?
+need_version=$need_version
 
+# Library versioning type.
+version_type=$version_type
 
+# Shared library runtime path variable.
+runpath_var=$runpath_var
 
+# Shared library path variable.
+shlibpath_var=$shlibpath_var
 
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
 
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
-  else
-    PATH_SEPARATOR=:
-  fi
-  rm -f conf$$.sh
-fi
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
 
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  as_unset=unset
-else
-  as_unset=false
-fi
+# List of archive names.  First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME
+library_names_spec=$lt_library_names_spec
 
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
 
-# IFS
-# We need space, tab and new line, in precisely that order.  Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-as_nl='
-'
-IFS=" ""	$as_nl"
+# Permission mode override for installation of shared libraries.
+install_override_mode=$lt_install_override_mode
 
-# Find who we are.  Look in the path if we contain no directory separator.
-case $0 in
-  *[\\/]* ) as_myself=$0 ;;
-  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-IFS=$as_save_IFS
+# Command to use after installation of a shared archive.
+postinstall_cmds=$lt_postinstall_cmds
 
-     ;;
-esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
-# in which case we are not to be found in the path.
-if test "x$as_myself" = x; then
-  as_myself=$0
-fi
-if test ! -f "$as_myself"; then
-  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  { (exit 1); exit 1; }
-fi
+# Command to use after uninstallation of a shared archive.
+postuninstall_cmds=$lt_postuninstall_cmds
 
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-done
-PS1='$ '
-PS2='> '
-PS4='+ '
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
 
-# NLS nuisances.
-for as_var in \
-  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
-  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
-  LC_TELEPHONE LC_TIME
-do
-  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
-    eval $as_var=C; export $as_var
-  else
-    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-  fi
-done
+# As "finish_cmds", except a single script fragment to be evaled but
+# not shown.
+finish_eval=$lt_finish_eval
 
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
 
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
-  as_basename=basename
-else
-  as_basename=false
-fi
+# Compile-time system search path for libraries.
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
 
+# Run-time system search path for libraries.
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
 
-# Name of the executable.
-as_me=`$as_basename -- "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
-	 X"$0" : 'X\(//\)$' \| \
-	 X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\/\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\/\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
 
-# CDPATH.
-$as_unset CDPATH
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
 
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
 
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
 
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
 
-  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
-  # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line after each line using $LINENO; the second 'sed'
-  # does the real work.  The second script uses 'N' to pair each
-  # line-number line with the line containing $LINENO, and appends
-  # trailing '-' during substitution so that $LINENO is not a special
-  # case at line end.
-  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # scripts with optimization help from Paolo Bonzini.  Blame Lee
-  # E. McMahon (1931-1989) for sed's syntax.  :-)
-  sed -n '
-    p
-    /[$]LINENO/=
-  ' <$as_myself |
-    sed '
-      s/[$]LINENO.*/&-/
-      t lineno
-      b
-      :lineno
-      N
-      :loop
-      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
-      t loop
-      s/-\n.*//
-    ' >$as_me.lineno &&
-  chmod +x "$as_me.lineno" ||
-    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
-   { (exit 1); exit 1; }; }
+# The linker used to build libraries.
+LD=$lt_LD
 
-  # 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).
-  . "./$as_me.lineno"
-  # Exit status is that of the last command.
-  exit
-}
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
 
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds
 
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-  as_dirname=dirname
-else
-  as_dirname=false
-fi
+# A language specific compiler.
+CC=$lt_compiler
 
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
--n*)
-  case `echo 'x\c'` in
-  *c*) ECHO_T='	';;	# ECHO_T is single tab character.
-  *)   ECHO_C='\c';;
-  esac;;
-*)
-  ECHO_N='-n';;
-esac
+# Is the compiler the GNU compiler?
+with_gcc=$GCC
 
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
 
-rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
-  rm -f conf$$.dir/conf$$.file
-else
-  rm -f conf$$.dir
-  mkdir conf$$.dir
-fi
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s='ln -s'
-  # ... 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'.
-  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-    as_ln_s='cp -p'
-elif ln conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s=ln
-else
-  as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
 
-if mkdir -p . 2>/dev/null; then
-  as_mkdir_p=:
-else
-  test -d ./-p && rmdir ./-p
-  as_mkdir_p=false
-fi
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
 
-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
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
 
-# 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'"
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
 
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
 
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
 
-exec 6>&1
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
 
-# Save the log message, to keep $[0] and so on meaningful, and to
-# report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling.
-ac_log="
-This file was extended by linbox $as_me 1.1.6rc0, which was
-generated by GNU Autoconf 2.61.  Invocation command line was
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
 
-  CONFIG_FILES    = $CONFIG_FILES
-  CONFIG_HEADERS  = $CONFIG_HEADERS
-  CONFIG_LINKS    = $CONFIG_LINKS
-  CONFIG_COMMANDS = $CONFIG_COMMANDS
-  $ $0 $@
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object
 
-on `(hostname || uname -n) 2>/dev/null | sed 1q`
-"
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
 
-_ACEOF
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
 
-cat >>$CONFIG_STATUS <<_ACEOF
-# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
 
-_ACEOF
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
 
-cat >>$CONFIG_STATUS <<\_ACEOF
-ac_cs_usage="\
-\`$as_me' instantiates files from templates according to the
-current configuration.
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld
 
-Usage: $0 [OPTIONS] [FILE]...
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
 
-  -h, --help       print this help, then exit
-  -V, --version    print version number and configuration settings, then exit
-  -q, --quiet      do not print progress messages
-  -d, --debug      don't remove temporary files
-      --recheck    update $as_me by reconfiguring in the same conditions
-  --file=FILE[:TEMPLATE]
-		   instantiate the configuration file FILE
-  --header=FILE[:TEMPLATE]
-		   instantiate the configuration header FILE
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
 
-Configuration files:
-$config_files
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
 
-Configuration headers:
-$config_headers
+# If ld is used when linking, flag to hardcode \$libdir into a binary
+# during linking.  This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
 
-Configuration commands:
-$config_commands
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
 
-Report bugs to <bug-autoconf at gnu.org>."
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct
 
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
-ac_cs_version="\\
-linbox config.status 1.1.6rc0
-configured by $0, generated by GNU Autoconf 2.61,
-  with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute
 
-Copyright (C) 2006 Free Software Foundation, Inc.
-This config.status script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it."
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L
 
-ac_pwd='$ac_pwd'
-srcdir='$srcdir'
-INSTALL='$INSTALL'
-MKDIR_P='$MKDIR_P'
-_ACEOF
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
 
-cat >>$CONFIG_STATUS <<\_ACEOF
-# If no file are specified by the user, then we need to provide default
-# value.  By we need to know if files were specified by the user.
-ac_need_defaults=:
-while test $# != 0
-do
-  case $1 in
-  --*=*)
-    ac_option=`expr "X$1" : 'X\([^=]*\)='`
-    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
-    ac_shift=:
-    ;;
-  *)
-    ac_option=$1
-    ac_optarg=$2
-    ac_shift=shift
-    ;;
-  esac
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic
 
-  case $ac_option in
-  # Handling of the options.
-  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
-    ac_cs_recheck=: ;;
-  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
-    echo "$ac_cs_version"; exit ;;
-  --debug | --debu | --deb | --de | --d | -d )
-    debug=: ;;
-  --file | --fil | --fi | --f )
-    $ac_shift
-    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
-    ac_need_defaults=false;;
-  --header | --heade | --head | --hea )
-    $ac_shift
-    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
-    ac_need_defaults=false;;
-  --he | --h)
-    # Conflict between --help and --header
-    { echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; };;
-  --help | --hel | -h )
-    echo "$ac_cs_usage"; exit ;;
-  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-  | -silent | --silent | --silen | --sile | --sil | --si | --s)
-    ac_cs_silent=: ;;
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath
 
-  # This is an error.
-  -*) { echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; } ;;
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
 
-  *) ac_config_targets="$ac_config_targets $1"
-     ac_need_defaults=false ;;
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols
 
-  esac
-  shift
-done
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
 
-ac_configure_extra_args=
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
 
-if $ac_cs_silent; then
-  exec 6>/dev/null
-  ac_configure_extra_args="$ac_configure_extra_args --silent"
-fi
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
 
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
-if \$ac_cs_recheck; then
-  echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
-  CONFIG_SHELL=$SHELL
-  export CONFIG_SHELL
-  exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
-fi
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds
 
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-exec 5>>config.log
-{
-  echo
-  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
-  echo "$ac_log"
-} >&5
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds
 
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
-#
-# INIT-COMMANDS
-#
-AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec
 
-_ACEOF
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# The directories searched by this compiler when creating a shared library.
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs
+
+# Dependencies to place before and after the objects being linked to
+# create a shared library.
+predep_objects=$lt_predep_objects
+postdep_objects=$lt_postdep_objects
+predeps=$lt_predeps
+postdeps=$lt_postdeps
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path
+
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+  case $host_os in
+  aix3*)
+    cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+_LT_EOF
+    ;;
+  esac
 
-cat >>$CONFIG_STATUS <<\_ACEOF
 
-# Handling of arguments.
-for ac_config_target in $ac_config_targets
-do
-  case $ac_config_target in
-    "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
-    "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
-    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-    "linbox-config") CONFIG_FILES="$CONFIG_FILES linbox-config" ;;
-    "examples/Makefile") CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
-    "examples/fields/Makefile") CONFIG_FILES="$CONFIG_FILES examples/fields/Makefile" ;;
-    "examples/Readme-make") CONFIG_FILES="$CONFIG_FILES examples/Readme-make" ;;
-    "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
-    "linbox/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/Makefile" ;;
-    "linbox/algorithms/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/algorithms/Makefile" ;;
-    "linbox/fflas/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/fflas/Makefile" ;;
-    "linbox/ffpack/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/ffpack/Makefile" ;;
-    "linbox/blackbox/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/blackbox/Makefile" ;;
-    "linbox/element/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/element/Makefile" ;;
-    "linbox/field/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/field/Makefile" ;;
-    "linbox/matrix/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/matrix/Makefile" ;;
-    "linbox/randiter/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/randiter/Makefile" ;;
-    "linbox/ring/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/ring/Makefile" ;;
-    "linbox/solutions/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/solutions/Makefile" ;;
-    "linbox/switch/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/switch/Makefile" ;;
-    "linbox/util/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/util/Makefile" ;;
-    "linbox/util/formats/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/util/formats/Makefile" ;;
-    "linbox/vector/Makefile") CONFIG_FILES="$CONFIG_FILES linbox/vector/Makefile" ;;
-    "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
-    "tests/data/Makefile") CONFIG_FILES="$CONFIG_FILES tests/data/Makefile" ;;
-    "interfaces/Makefile") CONFIG_FILES="$CONFIG_FILES interfaces/Makefile" ;;
-    "interfaces/driver/Makefile") CONFIG_FILES="$CONFIG_FILES interfaces/driver/Makefile" ;;
-    "interfaces/maple/Makefile") CONFIG_FILES="$CONFIG_FILES interfaces/maple/Makefile" ;;
-    "interfaces/kaapi/Makefile") CONFIG_FILES="$CONFIG_FILES interfaces/kaapi/Makefile" ;;
-    "interfaces/sage/Makefile") CONFIG_FILES="$CONFIG_FILES interfaces/sage/Makefile" ;;
-    "macros/Makefile") CONFIG_FILES="$CONFIG_FILES macros/Makefile" ;;
+ltmain="$ac_aux_dir/ltmain.sh"
 
-  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
-   { (exit 1); exit 1; }; };;
-  esac
-done
 
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" \
+     || (rm -f "$cfgfile"; exit 1)
+
+  if test x"$xsi_shell" = xyes; then
+  sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
+func_dirname ()\
+{\
+\    case ${1} in\
+\      */*) func_dirname_result="${1%/*}${2}" ;;\
+\      *  ) func_dirname_result="${3}" ;;\
+\    esac\
+} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_basename ()$/,/^} # func_basename /c\
+func_basename ()\
+{\
+\    func_basename_result="${1##*/}"\
+} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
+func_dirname_and_basename ()\
+{\
+\    case ${1} in\
+\      */*) func_dirname_result="${1%/*}${2}" ;;\
+\      *  ) func_dirname_result="${3}" ;;\
+\    esac\
+\    func_basename_result="${1##*/}"\
+} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
+func_stripname ()\
+{\
+\    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
+\    # positional parameters, so assign one to ordinary parameter first.\
+\    func_stripname_result=${3}\
+\    func_stripname_result=${func_stripname_result#"${1}"}\
+\    func_stripname_result=${func_stripname_result%"${2}"}\
+} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
+func_split_long_opt ()\
+{\
+\    func_split_long_opt_name=${1%%=*}\
+\    func_split_long_opt_arg=${1#*=}\
+} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
+func_split_short_opt ()\
+{\
+\    func_split_short_opt_arg=${1#??}\
+\    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
+} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
+func_lo2o ()\
+{\
+\    case ${1} in\
+\      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
+\      *)    func_lo2o_result=${1} ;;\
+\    esac\
+} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_xform ()$/,/^} # func_xform /c\
+func_xform ()\
+{\
+    func_xform_result=${1%.*}.lo\
+} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_arith ()$/,/^} # func_arith /c\
+func_arith ()\
+{\
+    func_arith_result=$(( $* ))\
+} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_len ()$/,/^} # func_len /c\
+func_len ()\
+{\
+    func_len_result=${#1}\
+} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+fi
+
+if test x"$lt_shell_append" = xyes; then
+  sed -e '/^func_append ()$/,/^} # func_append /c\
+func_append ()\
+{\
+    eval "${1}+=\\${2}"\
+} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
+func_append_quoted ()\
+{\
+\    func_quote_for_eval "${2}"\
+\    eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
+} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+
+
+  # Save a `func_append' function call where possible by direct use of '+='
+  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+else
+  # Save a `func_append' function call even when '+=' is not available
+  sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
+$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
+fi
+
+
+   mv -f "$cfgfile" "$ofile" ||
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
 
-# If the user did not use the arguments to specify the items to instantiate,
-# then the envvar interface is used.  Set only those that are not.
-# We use the long form for the default assignment because of an extremely
-# bizarre bug on SunOS 4.1.3.
-if $ac_need_defaults; then
-  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
-  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
-  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
-fi
 
-# Have a temporary directory for convenience.  Make it in the build tree
-# simply because there is no reason against having it here, and in addition,
-# creating and moving files from /tmp can sometimes cause problems.
-# Hook for its removal unless debugging.
-# Note that there is a small window in which the directory will not be cleaned:
-# after its creation but before its name has been assigned to `$tmp'.
-$debug ||
-{
-  tmp=
-  trap 'exit_status=$?
-  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
-' 0
-  trap '{ (exit 1); exit 1; }' 1 2 13 15
-}
-# Create a (secure) tmp directory for tmp files.
+    cat <<_LT_EOF >> "$ofile"
 
-{
-  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
-  test -n "$tmp" && test -d "$tmp"
-}  ||
-{
-  tmp=./conf$$-$RANDOM
-  (umask 077 && mkdir "$tmp")
-} ||
-{
-   echo "$me: cannot create a temporary directory in ." >&2
-   { (exit 1); exit 1; }
-}
+# ### BEGIN LIBTOOL TAG CONFIG: CXX
 
-#
-# Set up the sed scripts for CONFIG_FILES section.
-#
+# The linker used to build libraries.
+LD=$lt_LD_CXX
 
-# No need to generate the scripts if there are no CONFIG_FILES.
-# This happens for instance when ./config.status config.h
-if test -n "$CONFIG_FILES"; then
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag_CXX
+reload_cmds=$lt_reload_cmds_CXX
 
-_ACEOF
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds_CXX
 
+# A language specific compiler.
+CC=$lt_compiler_CXX
 
+# Is the compiler the GNU compiler?
+with_gcc=$GCC_CXX
 
-ac_delim='%!_!# '
-for ac_last_try in false false false false false :; do
-  cat >conf$$subs.sed <<_ACEOF
-SHELL!$SHELL$ac_delim
-PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
-PACKAGE_NAME!$PACKAGE_NAME$ac_delim
-PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
-PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
-PACKAGE_STRING!$PACKAGE_STRING$ac_delim
-PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
-exec_prefix!$exec_prefix$ac_delim
-prefix!$prefix$ac_delim
-program_transform_name!$program_transform_name$ac_delim
-bindir!$bindir$ac_delim
-sbindir!$sbindir$ac_delim
-libexecdir!$libexecdir$ac_delim
-datarootdir!$datarootdir$ac_delim
-datadir!$datadir$ac_delim
-sysconfdir!$sysconfdir$ac_delim
-sharedstatedir!$sharedstatedir$ac_delim
-localstatedir!$localstatedir$ac_delim
-includedir!$includedir$ac_delim
-oldincludedir!$oldincludedir$ac_delim
-docdir!$docdir$ac_delim
-infodir!$infodir$ac_delim
-htmldir!$htmldir$ac_delim
-dvidir!$dvidir$ac_delim
-pdfdir!$pdfdir$ac_delim
-psdir!$psdir$ac_delim
-libdir!$libdir$ac_delim
-localedir!$localedir$ac_delim
-mandir!$mandir$ac_delim
-DEFS!$DEFS$ac_delim
-ECHO_C!$ECHO_C$ac_delim
-ECHO_N!$ECHO_N$ac_delim
-ECHO_T!$ECHO_T$ac_delim
-LIBS!$LIBS$ac_delim
-build_alias!$build_alias$ac_delim
-host_alias!$host_alias$ac_delim
-target_alias!$target_alias$ac_delim
-INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
-INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
-INSTALL_DATA!$INSTALL_DATA$ac_delim
-am__isrc!$am__isrc$ac_delim
-CYGPATH_W!$CYGPATH_W$ac_delim
-PACKAGE!$PACKAGE$ac_delim
-VERSION!$VERSION$ac_delim
-ACLOCAL!$ACLOCAL$ac_delim
-AUTOCONF!$AUTOCONF$ac_delim
-AUTOMAKE!$AUTOMAKE$ac_delim
-AUTOHEADER!$AUTOHEADER$ac_delim
-MAKEINFO!$MAKEINFO$ac_delim
-install_sh!$install_sh$ac_delim
-STRIP!$STRIP$ac_delim
-INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim
-mkdir_p!$mkdir_p$ac_delim
-AWK!$AWK$ac_delim
-SET_MAKE!$SET_MAKE$ac_delim
-am__leading_dot!$am__leading_dot$ac_delim
-AMTAR!$AMTAR$ac_delim
-am__tar!$am__tar$ac_delim
-am__untar!$am__untar$ac_delim
-MAINTAINER_MODE_TRUE!$MAINTAINER_MODE_TRUE$ac_delim
-MAINTAINER_MODE_FALSE!$MAINTAINER_MODE_FALSE$ac_delim
-MAINT!$MAINT$ac_delim
-AMDEP_TRUE!$AMDEP_TRUE$ac_delim
-AMDEP_FALSE!$AMDEP_FALSE$ac_delim
-AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim
-MKDIR_P!$MKDIR_P$ac_delim
-CC!$CC$ac_delim
-CFLAGS!$CFLAGS$ac_delim
-LDFLAGS!$LDFLAGS$ac_delim
-CPPFLAGS!$CPPFLAGS$ac_delim
-ac_ct_CC!$ac_ct_CC$ac_delim
-EXEEXT!$EXEEXT$ac_delim
-OBJEXT!$OBJEXT$ac_delim
-CXX!$CXX$ac_delim
-CXXFLAGS!$CXXFLAGS$ac_delim
-ac_ct_CXX!$ac_ct_CXX$ac_delim
-CPP!$CPP$ac_delim
-GREP!$GREP$ac_delim
-EGREP!$EGREP$ac_delim
-build!$build$ac_delim
-build_cpu!$build_cpu$ac_delim
-build_vendor!$build_vendor$ac_delim
-build_os!$build_os$ac_delim
-host!$host$ac_delim
-host_cpu!$host_cpu$ac_delim
-host_vendor!$host_vendor$ac_delim
-host_os!$host_os$ac_delim
-SED!$SED$ac_delim
-LN_S!$LN_S$ac_delim
-ECHO!$ECHO$ac_delim
-AR!$AR$ac_delim
-RANLIB!$RANLIB$ac_delim
-DSYMUTIL!$DSYMUTIL$ac_delim
-NMEDIT!$NMEDIT$ac_delim
-CXXCPP!$CXXCPP$ac_delim
-F77!$F77$ac_delim
-FFLAGS!$FFLAGS$ac_delim
-_ACEOF
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
-    break
-  elif $ac_last_try; then
-    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
-  else
-    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
-  fi
-done
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_CXX
 
-ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
-if test -n "$ac_eof"; then
-  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
-  ac_eof=`expr $ac_eof + 1`
-fi
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_CXX
 
-cat >>$CONFIG_STATUS <<_ACEOF
-cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-_ACEOF
-sed '
-s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
-s/^/s,@/; s/!/@,|#_!!_#|/
-:n
-t n
-s/'"$ac_delim"'$/,g/; t
-s/$/\\/; p
-N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
-' >>$CONFIG_STATUS <conf$$subs.sed
-rm -f conf$$subs.sed
-cat >>$CONFIG_STATUS <<_ACEOF
-CEOF$ac_eof
-_ACEOF
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_CXX
 
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
 
-ac_delim='%!_!# '
-for ac_last_try in false false false false false :; do
-  cat >conf$$subs.sed <<_ACEOF
-ac_ct_F77!$ac_ct_F77$ac_delim
-LIBTOOL!$LIBTOOL$ac_delim
-LIBOBJS!$LIBOBJS$ac_delim
-LTLIBOBJS!$LTLIBOBJS$ac_delim
-_ACEOF
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_CXX
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 4; then
-    break
-  elif $ac_last_try; then
-    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
-  else
-    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
-  fi
-done
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
 
-ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
-if test -n "$ac_eof"; then
-  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
-  ac_eof=`expr $ac_eof + 1`
-fi
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
 
-cat >>$CONFIG_STATUS <<_ACEOF
-cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
-_ACEOF
-sed '
-s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
-s/^/s,@/; s/!/@,|#_!!_#|/
-:n
-t n
-s/'"$ac_delim"'$/,g/; t
-s/$/\\/; p
-N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
-' >>$CONFIG_STATUS <conf$$subs.sed
-rm -f conf$$subs.sed
-cat >>$CONFIG_STATUS <<_ACEOF
-:end
-s/|#_!!_#|//g
-CEOF$ac_eof
-_ACEOF
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
 
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object_CXX
 
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
-# trailing colons and then remove the whole line if VPATH becomes empty
-# (actually we leave an empty line to preserve line numbers).
-if test "x$srcdir" = x.; then
-  ac_vpsub='/^[	 ]*VPATH[	 ]*=/{
-s/:*\$(srcdir):*/:/
-s/:*\${srcdir}:*/:/
-s/:*@srcdir@:*/:/
-s/^\([^=]*=[	 ]*\):*/\1/
-s/:*$//
-s/^[^=]*=[	 ]*$//
-}'
-fi
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
 
-cat >>$CONFIG_STATUS <<\_ACEOF
-fi # test -n "$CONFIG_FILES"
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
 
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds_CXX
+archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
 
-for ac_tag in  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS
-do
-  case $ac_tag in
-  :[FHLC]) ac_mode=$ac_tag; continue;;
-  esac
-  case $ac_mode$ac_tag in
-  :[FHL]*:*);;
-  :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
-echo "$as_me: error: Invalid tag $ac_tag." >&2;}
-   { (exit 1); exit 1; }; };;
-  :[FH]-) ac_tag=-:-;;
-  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
-  esac
-  ac_save_IFS=$IFS
-  IFS=:
-  set x $ac_tag
-  IFS=$ac_save_IFS
-  shift
-  ac_file=$1
-  shift
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds_CXX
+module_expsym_cmds=$lt_module_expsym_cmds_CXX
 
-  case $ac_mode in
-  :L) ac_source=$1;;
-  :[FH])
-    ac_file_inputs=
-    for ac_f
-    do
-      case $ac_f in
-      -) ac_f="$tmp/stdin";;
-      *) # Look for the file first in the build tree, then in the source tree
-	 # (if the path is not absolute).  The absolute path cannot be DOS-style,
-	 # because $ac_f cannot contain `:'.
-	 test -f "$ac_f" ||
-	   case $ac_f in
-	   [\\/$]*) false;;
-	   *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
-	   esac ||
-	   { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
-echo "$as_me: error: cannot find input file: $ac_f" >&2;}
-   { (exit 1); exit 1; }; };;
-      esac
-      ac_file_inputs="$ac_file_inputs $ac_f"
-    done
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld_CXX
 
-    # Let's still pretend it is `configure' which instantiates (i.e., don't
-    # use $as_me), people would be surprised to read:
-    #    /* config.h.  Generated by config.status.  */
-    configure_input="Generated from "`IFS=:
-	  echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
-    if test x"$ac_file" != x-; then
-      configure_input="$ac_file.  $configure_input"
-      { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
-    fi
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_CXX
 
-    case $ac_tag in
-    *:-:* | *:-) cat >"$tmp/stdin";;
-    esac
-    ;;
-  esac
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_CXX
 
-  ac_dir=`$as_dirname -- "$ac_file" ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$ac_file" : 'X\(//\)[^/]' \| \
-	 X"$ac_file" : 'X\(//\)$' \| \
-	 X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$ac_file" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-  { as_dir="$ac_dir"
-  case $as_dir in #(
-  -*) as_dir=./$as_dir;;
-  esac
-  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
-    as_dirs=
-    while :; do
-      case $as_dir in #(
-      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
-      *) as_qdir=$as_dir;;
-      esac
-      as_dirs="'$as_qdir' $as_dirs"
-      as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$as_dir" : 'X\(//\)[^/]' \| \
-	 X"$as_dir" : 'X\(//\)$' \| \
-	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-      test -d "$as_dir" && break
-    done
-    test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-echo "$as_me: error: cannot create directory $as_dir" >&2;}
-   { (exit 1); exit 1; }; }; }
-  ac_builddir=.
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX
 
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
-  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
-  # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
-  case $ac_top_builddir_sub in
-  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
-  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
-  esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
+# If ld is used when linking, flag to hardcode \$libdir into a binary
+# during linking.  This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX
 
-case $srcdir in
-  .)  # We are building in place.
-    ac_srcdir=.
-    ac_top_srcdir=$ac_top_builddir_sub
-    ac_abs_top_srcdir=$ac_pwd ;;
-  [\\/]* | ?:[\\/]* )  # Absolute name.
-    ac_srcdir=$srcdir$ac_dir_suffix;
-    ac_top_srcdir=$srcdir
-    ac_abs_top_srcdir=$srcdir ;;
-  *) # Relative name.
-    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_build_prefix$srcdir
-    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
-esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
 
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct_CXX
 
-  case $ac_mode in
-  :F)
-  #
-  # CONFIG_FILE
-  #
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute_CXX
 
-  case $INSTALL in
-  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
-  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
-  esac
-  ac_MKDIR_P=$MKDIR_P
-  case $MKDIR_P in
-  [\\/$]* | ?:[\\/]* ) ;;
-  */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
-  esac
-_ACEOF
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L_CXX
 
-cat >>$CONFIG_STATUS <<\_ACEOF
-# If the template does not know about datarootdir, expand it.
-# FIXME: This hack should be removed a few years after 2.60.
-ac_datarootdir_hack=; ac_datarootdir_seen=
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
 
-case `sed -n '/datarootdir/ {
-  p
-  q
-}
-/@datadir@/p
-/@docdir@/p
-/@infodir@/p
-/@localedir@/p
-/@mandir@/p
-' $ac_file_inputs` in
-*datarootdir*) ac_datarootdir_seen=yes;;
-*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
-  { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
-echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
-  ac_datarootdir_hack='
-  s&@datadir@&$datadir&g
-  s&@docdir@&$docdir&g
-  s&@infodir@&$infodir&g
-  s&@localedir@&$localedir&g
-  s&@mandir@&$mandir&g
-    s&\\\${datarootdir}&$datarootdir&g' ;;
-esac
-_ACEOF
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic_CXX
 
-# Neutralize VPATH when `$srcdir' = `.'.
-# Shell code in configure.ac might set extrasub.
-# FIXME: do we really want to maintain this feature?
-cat >>$CONFIG_STATUS <<_ACEOF
-  sed "$ac_vpsub
-$extrasub
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-:t
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s&@configure_input@&$configure_input&;t t
-s&@top_builddir@&$ac_top_builddir_sub&;t t
-s&@srcdir@&$ac_srcdir&;t t
-s&@abs_srcdir@&$ac_abs_srcdir&;t t
-s&@top_srcdir@&$ac_top_srcdir&;t t
-s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
-s&@builddir@&$ac_builddir&;t t
-s&@abs_builddir@&$ac_abs_builddir&;t t
-s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
-s&@INSTALL@&$ac_INSTALL&;t t
-s&@MKDIR_P@&$ac_MKDIR_P&;t t
-$ac_datarootdir_hack
-" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath_CXX
 
-test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
-  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
-  { ac_out=`sed -n '/^[	 ]*datarootdir[	 ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
-  { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined.  Please make sure it is defined." >&5
-echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined.  Please make sure it is defined." >&2;}
-
-  rm -f "$tmp/stdin"
-  case $ac_file in
-  -) cat "$tmp/out"; rm -f "$tmp/out";;
-  *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
-  esac
- ;;
-  :H)
-  #
-  # CONFIG_HEADER
-  #
-_ACEOF
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_CXX
 
-# Transform confdefs.h into a sed script `conftest.defines', that
-# substitutes the proper values into config.h.in to produce config.h.
-rm -f conftest.defines conftest.tail
-# First, append a space to every undef/define line, to ease matching.
-echo 's/$/ /' >conftest.defines
-# Then, protect against being on the right side of a sed subst, or in
-# an unquoted here document, in config.status.  If some macros were
-# called several times there might be several #defines for the same
-# symbol, which is useless.  But do not sort them, since the last
-# AC_DEFINE must be honored.
-ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
-# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where
-# NAME is the cpp macro being defined, VALUE is the value it is being given.
-# PARAMS is the parameter list in the macro definition--in most cases, it's
-# just an empty string.
-ac_dA='s,^\\([	 #]*\\)[^	 ]*\\([	 ]*'
-ac_dB='\\)[	 (].*,\\1define\\2'
-ac_dC=' '
-ac_dD=' ,'
-
-uniq confdefs.h |
-  sed -n '
-	t rset
-	:rset
-	s/^[	 ]*#[	 ]*define[	 ][	 ]*//
-	t ok
-	d
-	:ok
-	s/[\\&,]/\\&/g
-	s/^\('"$ac_word_re"'\)\(([^()]*)\)[	 ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p
-	s/^\('"$ac_word_re"'\)[	 ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p
-  ' >>conftest.defines
-
-# Remove the space that was appended to ease matching.
-# Then replace #undef with comments.  This is necessary, for
-# example, in the case of _POSIX_SOURCE, which is predefined and required
-# on some systems where configure will not decide to define it.
-# (The regexp can be short, since the line contains either #define or #undef.)
-echo 's/ $//
-s,^[	 #]*u.*,/* & */,' >>conftest.defines
-
-# Break up conftest.defines:
-ac_max_sed_lines=50
-
-# First sed command is:	 sed -f defines.sed $ac_file_inputs >"$tmp/out1"
-# Second one is:	 sed -f defines.sed "$tmp/out1" >"$tmp/out2"
-# Third one will be:	 sed -f defines.sed "$tmp/out2" >"$tmp/out1"
-# et cetera.
-ac_in='$ac_file_inputs'
-ac_out='"$tmp/out1"'
-ac_nxt='"$tmp/out2"'
-
-while :
-do
-  # Write a here document:
-    cat >>$CONFIG_STATUS <<_ACEOF
-    # First, check the format of the line:
-    cat >"\$tmp/defines.sed" <<\\CEOF
-/^[	 ]*#[	 ]*undef[	 ][	 ]*$ac_word_re[	 ]*\$/b def
-/^[	 ]*#[	 ]*define[	 ][	 ]*$ac_word_re[(	 ]/b def
-b
-:def
-_ACEOF
-  sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS
-  echo 'CEOF
-    sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS
-  ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in
-  sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail
-  grep . conftest.tail >/dev/null || break
-  rm -f conftest.defines
-  mv conftest.tail conftest.defines
-done
-rm -f conftest.defines conftest.tail
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols_CXX
 
-echo "ac_result=$ac_in" >>$CONFIG_STATUS
-cat >>$CONFIG_STATUS <<\_ACEOF
-  if test x"$ac_file" != x-; then
-    echo "/* $configure_input  */" >"$tmp/config.h"
-    cat "$ac_result" >>"$tmp/config.h"
-    if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then
-      { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
-echo "$as_me: $ac_file is unchanged" >&6;}
-    else
-      rm -f $ac_file
-      mv "$tmp/config.h" $ac_file
-    fi
-  else
-    echo "/* $configure_input  */"
-    cat "$ac_result"
-  fi
-  rm -f "$tmp/out12"
-# Compute $ac_file's index in $config_headers.
-_am_arg=$ac_file
-_am_stamp_count=1
-for _am_header in $config_headers :; do
-  case $_am_header in
-    $_am_arg | $_am_arg:* )
-      break ;;
-    * )
-      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
-  esac
-done
-echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
-$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$_am_arg" : 'X\(//\)[^/]' \| \
-	 X"$_am_arg" : 'X\(//\)$' \| \
-	 X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$_am_arg" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`/stamp-h$_am_stamp_count
- ;;
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_CXX
 
-  :C)  { echo "$as_me:$LINENO: executing $ac_file commands" >&5
-echo "$as_me: executing $ac_file commands" >&6;}
- ;;
-  esac
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_CXX
 
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_CXX
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds_CXX
+
+# Commands necessary for finishing linking programs.
+postlink_cmds=$lt_postlink_cmds_CXX
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec_CXX
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_CXX
+
+# The directories searched by this compiler when creating a shared library.
+compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX
+
+# Dependencies to place before and after the objects being linked to
+# create a shared library.
+predep_objects=$lt_predep_objects_CXX
+postdep_objects=$lt_postdep_objects_CXX
+predeps=$lt_predeps_CXX
+postdeps=$lt_postdeps_CXX
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
+
+# ### END LIBTOOL TAG CONFIG: CXX
+_LT_EOF
 
-  case $ac_file$ac_mode in
-    "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
-  # Strip MF so we end up with the name of the file.
-  mf=`echo "$mf" | sed -e 's/:.*$//'`
-  # Check whether this is an Automake generated Makefile or not.
-  # We used to match only the files named `Makefile.in', but
-  # some people rename them; so instead we look at the file content.
-  # Grep'ing the first line is not enough: some people post-process
-  # each Makefile.in and add a new line on top of each file to say so.
-  # Grep'ing the whole file is not good either: AIX grep has a line
-  # limit of 2048, but all sed's we know have understand at least 4000.
-  if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
-    dirpart=`$as_dirname -- "$mf" ||
-$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$mf" : 'X\(//\)[^/]' \| \
-	 X"$mf" : 'X\(//\)$' \| \
-	 X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$mf" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-  else
-    continue
-  fi
-  # Extract the definition of DEPDIR, am__include, and am__quote
-  # from the Makefile without running `make'.
-  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
-  test -z "$DEPDIR" && continue
-  am__include=`sed -n 's/^am__include = //p' < "$mf"`
-  test -z "am__include" && continue
-  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-  # When using ansi2knr, U may be empty or an underscore; expand it
-  U=`sed -n 's/^U = //p' < "$mf"`
-  # Find all dependency output files, they are included files with
-  # $(DEPDIR) in their names.  We invoke sed twice because it is the
-  # simplest approach to changing $(DEPDIR) to its actual value in the
-  # expansion.
-  for file in `sed -n "
-    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
-    # Make sure the directory exists.
-    test -f "$dirpart/$file" && continue
-    fdir=`$as_dirname -- "$file" ||
-$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$file" : 'X\(//\)[^/]' \| \
-	 X"$file" : 'X\(//\)$' \| \
-	 X"$file" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$file" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-    { as_dir=$dirpart/$fdir
-  case $as_dir in #(
-  -*) as_dir=./$as_dir;;
-  esac
-  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
-    as_dirs=
-    while :; do
-      case $as_dir in #(
-      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
-      *) as_qdir=$as_dir;;
-      esac
-      as_dirs="'$as_qdir' $as_dirs"
-      as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	 X"$as_dir" : 'X\(//\)[^/]' \| \
-	 X"$as_dir" : 'X\(//\)$' \| \
-	 X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)[^/].*/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\/\)$/{
-	    s//\1/
-	    q
-	  }
-	  /^X\(\/\).*/{
-	    s//\1/
-	    q
-	  }
-	  s/.*/./; q'`
-      test -d "$as_dir" && break
-    done
-    test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-echo "$as_me: error: cannot create directory $as_dir" >&2;}
-   { (exit 1); exit 1; }; }; }
-    # echo "creating $dirpart/$file"
-    echo '# dummy' > "$dirpart/$file"
-  done
-done
  ;;
 
   esac
 done # for ac_tag
 
 
-{ (exit 0); exit 0; }
+as_fn_exit 0
 _ACEOF
-chmod +x $CONFIG_STATUS
 ac_clean_files=$ac_clean_files_save
 
+test $ac_write_fail = 0 ||
+  as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
 
 # configure is writing to config.log, and then calls config.status.
 # config.status does its own redirection, appending to config.log.
@@ -23756,7 +20289,10 @@ if test "$no_create" != yes; then
   exec 5>>config.log
   # Use ||, not &&, to avoid exiting from the if with $? = 1, which
   # would make configure fail if this is the last instruction.
-  $ac_cs_success || { (exit 1); exit 1; }
+  $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
-
 
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..eefea8c
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,292 @@
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox (and probably stolen here and there)
+# see COPYING for licence
+AC_PREREQ(2.61)
+
+AC_INIT([LinBox], [1.2.0],[linbox-use at googlegroups.com],[linbox],
+		[http://www.linalg.org/])
+AC_CONFIG_MACRO_DIR([macros])
+AC_CONFIG_AUX_DIR([build-aux])
+AM_INIT_AUTOMAKE([1.8 gnu no-dependencies -Wall -Wno-portability])
+AM_CONFIG_HEADER([config.h])
+AX_PREFIX_CONFIG_H(linbox/linbox-config.h, __LINBOX)
+AC_PATH_PROG(RM, rm, $FALSE)
+RM="$RM -f"
+
+
+AM_MAINTAINER_MODE
+AM_DEP_TRACK
+AM_OUTPUT_DEPENDENCY_COMMANDS
+
+AM_ACLOCAL_INCLUDE(macros)
+
+# work around to fix the backward compatibility issue of automake 1.10 with 1.9 (pb with MKDIR_P)
+AC_SUBST([MKDIR_P])
+
+AC_LANG([C++])
+
+AC_DEBUG
+# AC_FULL_DEBUG
+AC_WARNINGS
+
+# CFLAGS=${CFLAGS:-$DEFAULT_CFLAGS}
+# CXXFLAGS=${CXXFLAGS:-$DEFAULT_CXXFLAGS}
+
+######################################################
+# Try and pass different flags according to compiler #
+######################################################
+
+
+# disable default -g -O2 CXXFLAGS
+: ${CXXFLAGS=""}
+
+#set CXX
+AC_PROG_CXX
+
+AC_COMPILER_NAME
+
+AC_SUBST([DEFAULT_CFLAGS])
+AC_SUBST([DEBUG_CFLAGS])
+AC_SUBST([TESTS_CFLAGS])
+
+TESTS_CFLAGS="-O0 -g"
+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 -D_LB_DEBUG"
+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"
+		else
+			echo
+			echo "*******************************************************"
+			echo "unsupported compiler ($CCNAM). Please file a bug."
+			echo "*******************************************************"
+			echo
+			WARN_CFLAGS="${WARN_CFLAGS}"
+		fi
+	fi
+fi
+
+
+DEFAULT_CFLAGS="${DEFAULT_CFLAGS} ${WARN_CFLAGS} ${DEBUG_CFLAGS}"
+TESTS_CFLAGS="${TESTS_CFLAGS} ${WARN_CFLAGS} ${DEBUG_CFLAGS}"
+
+
+AC_HEADER_STDC
+AC_PROG_LIBTOOL
+
+# newer libtool...
+LT_PREREQ([2.2])
+LT_INIT
+
+
+
+
+# Machine characteristics
+
+AC_CHECK_SIZEOF(char, 8)
+AC_CHECK_SIZEOF(short, 16)
+AC_CHECK_SIZEOF(int, 32)
+AC_CHECK_SIZEOF(long, 32)
+AC_CHECK_SIZEOF(long long, 64)
+AC_CHECK_SIZEOF(__int64, 64)
+
+# Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([float.h limits.h stddef.h stdlib.h string.h sys/time.h stdint.h])
+
+
+# check endianness of the architecture
+AC_C_BIGENDIAN(
+  [AC_DEFINE(HAVE_BIG_ENDIAN, 1, [Define that architecture uses big endian storage])],
+  [AC_DEFINE(HAVE_LITTLE_ENDIAN, 1, [Define that architecture uses little endian storage])],
+  [])
+
+# Create some useful data types of fixed, known lengths
+
+# We hereby assume that a character is always one byte
+LINBOX_INT8="char";
+
+case $ac_cv_sizeof_char in
+  1)
+     TWO_BYTES=2;
+     FOUR_BYTES=4;
+     EIGHT_BYTES=8;
+     ;;
+  8)
+     TWO_BYTES=16;
+     FOUR_BYTES=32;
+     EIGHT_BYTES=64;
+esac
+
+case $TWO_BYTES in
+  $ac_cv_sizeof_short)
+     LINBOX_INT16="short";
+     ;;
+  $ac_cv_sizeof_int)
+     LINBOX_INT16="int";
+     ;;
+esac
+
+case $FOUR_BYTES in
+  $ac_cv_sizeof_short)
+     LINBOX_INT32="short";
+     ;;
+  $ac_cv_sizeof_int)
+     LINBOX_INT32="int";
+     ;;
+  $ac_cv_sizeof_long)
+     LINBOX_INT32="long";
+     ;;
+esac
+
+case $EIGHT_BYTES in
+  $ac_cv_sizeof_short)
+     LINBOX_INT64="short";
+     ;;
+  $ac_cv_sizeof_int)
+     LINBOX_INT64="int";
+     ;;
+  $ac_cv_sizeof_long)
+     LINBOX_INT64="long";
+     ;;
+  $ac_cv_sizeof_long_long)
+     LINBOX_INT64="long long";
+     ;;
+  $ac_cv_sizeof___int64)
+     LINBOX_INT64="__int64";
+     ;;
+esac
+
+AC_DEFINE_UNQUOTED(INT8, $LINBOX_INT8, Canonical 8-bit data type)
+AC_DEFINE_UNQUOTED(INT16, $LINBOX_INT16, Canonical 16-bit data type)
+AC_DEFINE_UNQUOTED(INT32, $LINBOX_INT32, Canonical 32-bit data type)
+AC_DEFINE_UNQUOTED(INT64, $LINBOX_INT64, Canonical 64-bit data type)
+
+# Feature checks
+LB_MISC
+LB_DRIVER
+
+AC_LANG_CPLUSPLUS
+
+
+LB_CHECK_GMP(,,[
+echo '*******************************************************************************'
+echo ' ERROR: GMP not found!'
+echo
+echo ' GMP version 3.1.1 or greater with --enable-cxx is required for this library to compile. Please'
+echo ' make sure GMP is installed and specify its location with the option'
+echo ' --with-gmp=<prefix> when running configure.'
+echo '*******************************************************************************'
+exit 1
+])
+
+LB_CHECK_IML
+
+LB_CHECK_NTL
+LB_CHECK_GIVARO(,,[
+echo '*******************************************************************************'
+echo ' ERROR: GIVARO not found!'
+echo
+echo ' GIVARO version 3.4.0 or greater (<3.5) is required for this library to compile.'
+echo ' Please make sure GIVARO is installed and specify its location with the'
+echo ' option --with-givaro=<prefix> when running configure.'
+echo '*******************************************************************************'
+exit 1
+])
+LB_CHECK_SACLIB
+LB_CHECK_LIDIA
+LB_CHECK_MAPLE
+LB_CHECK_SAGE
+#LB_CHECK_ATLAS
+
+# LB_CHECK_BLAS(,,[
+# echo ''
+# echo '*******************************************************************************'
+# echo ' ERROR: BLAS not found!'
+# echo
+# echo ' BLAS routines are required for this library to compile. Please'
+# echo ' make sure BLAS are installed and specify its location with the option'
+# echo ' --with-blas=<lib> when running configure.'
+# echo '*******************************************************************************'
+# exit 1
+# ])
+
+
+LB_CHECK_FFLAFLAS(,,[
+echo ''
+echo '*******************************************************************************'
+echo ' ERROR: Fflas-Ffpack not found!'
+echo
+echo ' Fflas-Ffpack routines are required for this library to compile. Please'
+echo ' make sure they are installed and specify its location with the option'
+echo ' --with-fflas-ffpack=<lib> when running configure.'
+echo '*******************************************************************************'
+exit 1
+])
+
+
+# AC_MSG_RESULT($BLAS_LIBS)
+# AC_MSG_RESULT($BLAS_CFLAGS)
+
+
+LB_CHECK_EXPAT
+
+LB_OPT
+LB_DOC
+
+
+# this is bogus so far as I can tell.  -bds
+#CXXFLAGS="${GMP_CFLAGS} ${NTL_CFLAGS} ${GIVARO_CFLAGS} ${SACLIB_CFLAGS} ${CXXFLAGS}"
+#AC_SUBST(CXXFLAGS)
+
+CXXFLAGS="${GMP_CFLAGS} ${CXXFLAGS}"
+AC_SUBST(CXXFLAGS)
+
+
+AC_CONFIG_FILES([
+Makefile
+linbox-config
+examples/Makefile
+examples/fields/Makefile
+examples/Readme-make
+doc/Makefile
+linbox/Makefile
+linbox/algorithms/Makefile
+linbox/blackbox/Makefile
+linbox/element/Makefile
+linbox/field/Makefile
+linbox/matrix/Makefile
+linbox/randiter/Makefile
+linbox/ring/Makefile
+linbox/solutions/Makefile
+linbox/switch/Makefile
+linbox/util/Makefile
+linbox/util/formats/Makefile
+linbox/vector/Makefile
+tests/Makefile
+tests/data/Makefile
+tests/matrix/Makefile
+interfaces/Makefile
+interfaces/driver/Makefile
+interfaces/maple/Makefile
+interfaces/kaapi/Makefile
+interfaces/sage/Makefile
+macros/Makefile
+])
+AC_OUTPUT
diff --git a/configure.in b/configure.in
deleted file mode 100644
index eee9884..0000000
--- a/configure.in
+++ /dev/null
@@ -1,193 +0,0 @@
-AC_PREREQ(2.50)
-#AC_INIT(linbox/linbox.doxy)
-AC_INIT(linbox, 1.1.6rc0,linbox-use at googlegroups.com) 
-AM_INIT_AUTOMAKE([1.8 gnu no-dependencies])
-AM_CONFIG_HEADER([config.h])
-AX_PREFIX_CONFIG_H(linbox/linbox-config.h, __LINBOX)
-
-AM_MAINTAINER_MODE
-AM_DEP_TRACK
-AM_OUTPUT_DEPENDENCY_COMMANDS 
-
-# Give a sane default for CFLAGS and CXXFLAGS
-# The sane thing is to define the flags differenly in tests, examples, interfaces, etc.  -bds
-#DEFAULT_CFLAGS="-O2 -Wall"
-
-CFLAGS=${CFLAGS:-$DEFAULT_CFLAGS}
-CXXFLAGS=${CXXFLAGS:-$DEFAULT_CFLAGS}
-
-AM_ACLOCAL_INCLUDE(macros)
-
-# work around to fix the backward compatibility issue of automake 1.10 with 1.9 (pb with MKDIR_P)
-AC_SUBST([MKDIR_P])
-AC_PROG_CC
-AC_PROG_CXX
-AC_STDC_HEADERS
-#AC_DISABLE_SHARED
-#AC_DISABLE_STATIC
-#AM_PROG_LIBTOOL
-# JGD 08.06.2004 : new name
-AC_PROG_LIBTOOL
-
-# Machine characteristics
-
-AC_CHECK_SIZEOF(char, 8)
-AC_CHECK_SIZEOF(short, 16)
-AC_CHECK_SIZEOF(int, 32)
-AC_CHECK_SIZEOF(long, 32)
-AC_CHECK_SIZEOF(long long, 64)
-AC_CHECK_SIZEOF(__int64, 64)
-
-# check endianness of the architecture
-AC_C_BIGENDIAN(
-  [AC_DEFINE(HAVE_BIG_ENDIAN, 1, [Define that architecture uses big endian storage])],
-  [AC_DEFINE(HAVE_LITTLE_ENDIAN, 1, [Define that architecture uses little endian storage])],
-  [])
-
-# Create some useful data types of fixed, known lengths
-
-# We hereby assume that a character is always one byte
-LINBOX_INT8="char";
-
-case $ac_cv_sizeof_char in
-  1)
-     TWO_BYTES=2;
-     FOUR_BYTES=4;
-     EIGHT_BYTES=8;
-     ;;
-  8)
-     TWO_BYTES=16;
-     FOUR_BYTES=32;
-     EIGHT_BYTES=64;
-esac
-
-case $TWO_BYTES in
-  $ac_cv_sizeof_short)
-     LINBOX_INT16="short";
-     ;;
-  $ac_cv_sizeof_int)
-     LINBOX_INT16="int";
-     ;;
-esac
-
-case $FOUR_BYTES in
-  $ac_cv_sizeof_short)
-     LINBOX_INT32="short";
-     ;;
-  $ac_cv_sizeof_int)
-     LINBOX_INT32="int";
-     ;;
-  $ac_cv_sizeof_long)
-     LINBOX_INT32="long";
-     ;;
-esac
-
-case $EIGHT_BYTES in
-  $ac_cv_sizeof_short)
-     LINBOX_INT64="short";
-     ;;
-  $ac_cv_sizeof_int)
-     LINBOX_INT64="int";
-     ;;
-  $ac_cv_sizeof_long)
-     LINBOX_INT64="long";
-     ;;
-  $ac_cv_sizeof_long_long)
-     LINBOX_INT64="long long";
-     ;;
-  $ac_cv_sizeof___int64)
-     LINBOX_INT64="__int64";
-     ;;
-esac
-
-AC_DEFINE_UNQUOTED(INT8, $LINBOX_INT8, Canonical 8-bit data type)
-AC_DEFINE_UNQUOTED(INT16, $LINBOX_INT16, Canonical 16-bit data type)
-AC_DEFINE_UNQUOTED(INT32, $LINBOX_INT32, Canonical 32-bit data type)
-AC_DEFINE_UNQUOTED(INT64, $LINBOX_INT64, Canonical 64-bit data type)
-
-# Feature checks
-LB_MISC
-LB_DRIVER
-
-AC_LANG_CPLUSPLUS
-LB_CHECK_GMP(,,[
-echo '*******************************************************************************'
-echo ' ERROR: GMP not found!'
-echo
-echo ' GMP version 3.1.1 or greater with --enable-cxx is required for this library to compile. Please'
-echo ' make sure GMP is installed and specify its location with the option'
-echo ' --with-gmp=<prefix> when running configure.'
-echo '*******************************************************************************'
-exit 1
-])
-
-LB_CHECK_NTL
-LB_CHECK_GIVARO(,,[
-echo '*******************************************************************************'
-echo ' ERROR: GIVARO not found!'
-echo
-echo ' GIVARO version 3.2.10 or greater is required for this library to compile.'
-echo ' Please make sure GIVARO is installed and specify its location with the'
-echo ' option --with-givaro=<prefix> when running configure.'
-echo '*******************************************************************************'
-exit 1
-exit 1
-])
-LB_CHECK_SACLIB
-LB_CHECK_LIDIA
-LB_CHECK_MAPLE
-LB_CHECK_SAGE
-#LB_CHECK_ATLAS
-LB_CHECK_BLAS(,,[
-echo ''
-echo '*******************************************************************************'
-echo ' ERROR: BLAS not found!'
-echo
-echo ' BLAS routines are required for this library to compile. Please'
-echo ' make sure BLAS are installed and specify its location with the option'
-echo ' --with-blas=<lib> when running configure.'
-echo '*******************************************************************************'
-exit 1
-])
-LB_CHECK_EXPAT
-
-LB_OPT
-LB_DOC
-
-
-# this is bogus so far as I can tell.  -bds
-#CXXFLAGS="${GMP_CFLAGS} ${NTL_CFLAGS} ${GIVARO_CFLAGS} ${SACLIB_CFLAGS} ${CXXFLAGS}"
-#AC_SUBST(CXXFLAGS)
-
-AC_OUTPUT([
-Makefile
-linbox-config
-examples/Makefile
-examples/fields/Makefile
-examples/Readme-make
-doc/Makefile
-linbox/Makefile
-linbox/algorithms/Makefile
-linbox/fflas/Makefile
-linbox/ffpack/Makefile
-linbox/blackbox/Makefile
-linbox/element/Makefile
-linbox/field/Makefile
-linbox/matrix/Makefile
-linbox/randiter/Makefile
-linbox/ring/Makefile
-linbox/solutions/Makefile
-linbox/switch/Makefile
-linbox/util/Makefile
-linbox/util/formats/Makefile
-linbox/vector/Makefile
-tests/Makefile
-tests/data/Makefile
-interfaces/Makefile
-interfaces/driver/Makefile
-interfaces/maple/Makefile
-interfaces/kaapi/Makefile
-interfaces/sage/Makefile
-macros/Makefile
-])
-
diff --git a/doc/Doxyfile b/doc/Doxyfile
index 6525361..6013315 100644
--- a/doc/Doxyfile
+++ b/doc/Doxyfile
@@ -1,16 +1,102 @@
-# Doxyfile 1.4.2
+# Doxyfile 1.7.3
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project.
+#
+# 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 (" ").
 
 #---------------------------------------------------------------------------
 # Project related configuration options
 #---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+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.
+
 PROJECT_NAME           = linbox
-PROJECT_NUMBER         = 1
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+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
+# where doxygen was started. If left blank the current directory will be used.
+
 OUTPUT_DIRECTORY       = .
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
 CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# 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-Cyrillic, Slovak,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
 OUTPUT_LANGUAGE        = English
-USE_WINDOWS_ENCODING   = NO
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
 BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
 REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
 ABBREVIATE_BRIEF       = "The $name class" \
                          "The $name widget" \
                          "The $name file" \
@@ -22,282 +108,1600 @@ ABBREVIATE_BRIEF       = "The $name class" \
                          a \
                          an \
                          the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
 ALWAYS_DETAILED_SEC    = NO
-INLINE_INHERITED_MEMB  = NO
-FULL_PATH_NAMES        = YES
-STRIP_FROM_PATH        = 
-STRIP_FROM_INC_PATH    = 
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH        =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+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 if your file system
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
 SHORT_NAMES            = NO
-JAVADOC_AUTOBRIEF      = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF      = YES
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF           = YES
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
 MULTILINE_CPP_IS_BRIEF = NO
-DETAILS_AT_TOP         = YES
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
 INHERIT_DOCS           = YES
-DISTRIBUTE_GROUP_DOC   = NO
 
-# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
 # Doxygen uses this value to replace tabs by spaces in code fragments.
 
 TAB_SIZE               = 4
 
-# This tag can be used to specify a number of aliases that acts 
-# as commands in the documentation. An alias has the form "name=value". 
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
-# put the command \sideeffect (or @sideeffect) in the documentation, which 
-# will result in a user-defined paragraph with heading "Side Effects:". 
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
 # You can put \n's in the value part of an alias to insert newlines.
 
-ALIASES                = 
-OPTIMIZE_OUTPUT_FOR_C  = NO
+ALIASES                = "bib=\xrefitem bib \"Bibliography\" \"Bibliography\""
+
+# 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
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
 OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this
+# tag. The format is ext=language, where ext is a file extension, and language
+# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,
+# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
+# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
+# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING      =
+
+# 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 makes the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT    = YES
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+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 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.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = YES
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
 SUBGROUPING            = YES
+
+# 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
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# 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 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 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
+
+SYMBOL_CACHE_SIZE      = 0
+
 #---------------------------------------------------------------------------
 # Build related configuration options
 #---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
 EXTRACT_ALL            = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
 EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
 EXTRACT_STATIC         = NO
 
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
-# defined locally in source files will be included in the documentation. 
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
 # If set to NO only classes defined in header files are included.
 
-EXTRACT_LOCAL_CLASSES  = NO
+EXTRACT_LOCAL_CLASSES  = YES
 
-# This flag is only useful for Objective-C code. When set to YES local 
-# methods, which are defined in the implementation section but not in 
-# the interface are included in the documentation. 
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
 # If set to NO (the default) only methods in the interface are included.
 
 EXTRACT_LOCAL_METHODS  = NO
 
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
-# undocumented members of documented classes, files or namespaces. 
-# If set to NO (the default) these members will be included in the 
-# various overviews, but no documentation section is generated. 
+# If this flag is set to YES, the members of anonymous namespaces will be
+# 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 namespaces are hidden.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
 # This option has no effect if EXTRACT_ALL is enabled.
 
 HIDE_UNDOC_MEMBERS     = YES
 
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
-# undocumented classes that are normally visible in the class hierarchy. 
-# If set to NO (the default) these classes will be included in the various 
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
 # overviews. This option has no effect if EXTRACT_ALL is enabled.
 
 HIDE_UNDOC_CLASSES     = YES
 
-# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 
-# friend (class|struct|union) declarations. 
-# If set to NO (the default) these declarations will be included in the 
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
 # documentation.
 
 HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
 HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
 INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
 CASE_SENSE_NAMES       = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
 HIDE_SCOPE_NAMES       = YES
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
 SHOW_INCLUDE_FILES     = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES   = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
 INLINE_INFO            = YES
 
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
-# will sort the (detailed) documentation of file and class members 
-# alphabetically by member name. If set to NO the members will appear in 
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
 # declaration order.
 
 SORT_MEMBER_DOCS       = NO
 
-# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the 
-# brief documentation of file, namespace and class members alphabetically 
-# by member name. If set to NO (the default) the members will appear in 
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
 # declaration order.
 
 SORT_BRIEF_DOCS        = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
+# will sort the (brief and detailed) documentation of class members so that
+# constructors and destructors are listed first. If set to NO (the default)
+# the constructors will appear in the respective orders defined by
+# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
+# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
+# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
 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.
+
 GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
 GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
 GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
 GENERATE_DEPRECATEDLIST= YES
-ENABLED_SECTIONS       = 
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# 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 macros in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
 MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
 SHOW_USED_FILES        = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
 SHOW_DIRECTORIES       = YES
-FILE_VERSION_FILTER    = 
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. The create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option.
+# You can optionally specify a file name after the option, if omitted
+# DoxygenLayout.xml will be used as the name of the layout file.
+
+LAYOUT_FILE            =
+
 #---------------------------------------------------------------------------
 # configuration options related to warning and progress messages
 #---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
 QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
 WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
 WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
 WARN_IF_DOC_ERROR      = YES
+
+# 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
+# documentation.
+
 WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
 WARN_FORMAT            = "$file:$line: $text"
-WARN_LOGFILE           = 
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE           = doxy.debug
+
 #---------------------------------------------------------------------------
 # configuration options related to the input files
 #---------------------------------------------------------------------------
 
-# The INPUT tag can be used to specify the files and/or directories that contain 
-# documented source files. You may enter file names like "myfile.cpp" or 
-# directories like "/usr/src/myproject". Separate the files or directories 
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
 # with spaces.
 
-INPUT                  =  ../linbox ../doc ../examples ../tests
+INPUT                  = ../linbox \
+                         ../doc \
+                         ../examples \
+                         ../tests \
+                         ../benchmarks
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
 
-# If the value of the INPUT tag contains directories, you can use the 
-# 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
+INPUT_ENCODING         = UTF-8
 
-FILE_PATTERNS          = *.cc *.cpp *.C *.h *.doxy
+# If the value of the INPUT tag contains directories, you can use the
+# 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++ *.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
 
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
-# should be searched for input files as well. Possible values are YES and NO. 
+FILE_PATTERNS          = *.cc \
+                         *.cpp \
+                         *.C \
+                         *.h \
+                         *.inl \
+                         *.doxy
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
 # If left blank NO is used.
 
 RECURSIVE              = YES
-EXCLUDE                = 
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# 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.
+
+EXCLUDE                = *_src.inl \
+                         Attic
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix file system feature) are excluded
+# from the input.
+
 EXCLUDE_SYMLINKS       = NO
-EXCLUDE_PATTERNS       = 
-EXAMPLE_PATH           = 
-EXAMPLE_PATTERNS       = *
-EXAMPLE_RECURSIVE      = NO
-IMAGE_PATH             = 
-INPUT_FILTER           = 
-FILTER_PATTERNS        = 
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       = *_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
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS        =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH           = ..
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_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 all files are included.
+
+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
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = YES
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH             =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER           =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# 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 or if
+# non of the patterns match the file name, INPUT_FILTER is applied.
+
+FILTER_PATTERNS        =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
 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
 #---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
 SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
 INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
 STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
 REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
 REFERENCES_RELATION    = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
 VERBATIM_HEADERS       = NO
+
 #---------------------------------------------------------------------------
 # configuration options related to the alphabetical class index
 #---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
 ALPHABETICAL_INDEX     = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
 COLS_IN_ALPHA_INDEX    = 5
-IGNORE_PREFIX          = 
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          =
+
 #---------------------------------------------------------------------------
 # configuration options related to the HTML output
 #---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
 GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
 HTML_OUTPUT            = linbox-html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
 HTML_FILE_EXTENSION    = .html
-HTML_HEADER            = 
-HTML_FOOTER            = 
-HTML_STYLESHEET        = 
+
+# 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.
+
+HTML_HEADER            =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER            =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# 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!
+
+HTML_STYLESHEET        =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
+# Doxygen will adjust the colors in the stylesheet 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,
+# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
+# The allowed range is 0 to 359.
+
+HTML_COLORSTYLE_HUE    = 220
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
+# the colors in the HTML output. For a value of 0 the output will use
+# grayscales only. A value of 255 will produce the most vivid colors.
+
+HTML_COLORSTYLE_SAT    = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
+# the luminance component of the colors in the HTML output. Values below
+# 100 gradually make the output lighter, whereas values above 100 make
+# the output darker. The value divided by 100 is the actual gamma applied,
+# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
+# and 100 does not change the gamma.
+
+HTML_COLORSTYLE_GAMMA  = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP         = YES
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
 HTML_ALIGN_MEMBERS     = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS  = YES
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+
+GENERATE_DOCSET        = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+
+# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
+
+DOCSET_PUBLISHER_NAME  = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
 GENERATE_HTMLHELP      = NO
-CHM_FILE               = 
-HHC_LOCATION           = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE               =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
 GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING     =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
 BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
 TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
+# that can be used as input for Qt's qhelpgenerator to generate a
+# Qt Compressed Help (.qch) of the generated HTML documentation.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE               =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE          = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
+# add. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME   =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
+# Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS  =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">
+# Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS  =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION           =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+#  will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
+# the help appears.
+
+GENERATE_ECLIPSEHELP   = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+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.
+
 DISABLE_INDEX          = NO
+
+# This 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
+
+# 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
+# containing a tree-like index structure (just like the one that
+# 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.
+
 GENERATE_TREEVIEW      = NO
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES       = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
 TREEVIEW_WIDTH         = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
+# links to external symbols imported via tag files in a separate window.
+
+EXT_LINKS_IN_WINDOW    = NO
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE       = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are
+# not supported properly for IE 6.0, but are supported on all modern browsers.
+# Note that when changing this option you need to delete any form_*.png files
+# in the HTML output before the changes have effect.
+
+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 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.org site, so you can quickly see the result without installing
+# MathJax, but it is strongly recommended to install a local copy of MathJax
+# before deployment.
+
+MATHJAX_RELPATH        = http://www.mathjax.org/mathjax
+
+# 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
+# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
+# (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE           = NO
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a PHP enabled web server instead of at the web client
+# 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 disadvantages are that it is more difficult to setup
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH    = NO
+
 #---------------------------------------------------------------------------
 # configuration options related to the LaTeX output
 #---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
 GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
 LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
 LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
 MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
 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, letter, legal and
+# executive. If left blank a4wide will be used.
+
 PAPER_TYPE             = a4wide
-EXTRA_PACKAGES         = 
-LATEX_HEADER           = 
+
+# 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
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           =
+
+# 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
+# This makes the output suitable for online browsing using a pdf viewer.
+
 PDF_HYPERLINKS         = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
 USE_PDFLATEX           = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
 LATEX_BATCHMODE        = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
 LATEX_HIDE_INDICES     = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include
+# source code with syntax highlighting in the LaTeX output.
+# Note that which sources are shown also depends on other settings
+# such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE      = NO
+
 #---------------------------------------------------------------------------
 # configuration options related to the RTF output
 #---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
 GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
 RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
 COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
 RTF_HYPERLINKS         = NO
-RTF_STYLESHEET_FILE    = 
-RTF_EXTENSIONS_FILE    = 
+
+# Load stylesheet 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.
+
+RTF_STYLESHEET_FILE    =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    =
+
 #---------------------------------------------------------------------------
 # configuration options related to the man page output
 #---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
 GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
 MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
 MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
 MAN_LINKS              = NO
+
 #---------------------------------------------------------------------------
 # configuration options related to the XML output
 #---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
 GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
 XML_OUTPUT             = xml
-XML_SCHEMA             = 
-XML_DTD                = 
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA             =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD                =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
 XML_PROGRAMLISTING     = YES
+
 #---------------------------------------------------------------------------
 # configuration options for the AutoGen Definitions output
 #---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
 GENERATE_AUTOGEN_DEF   = NO
+
 #---------------------------------------------------------------------------
 # configuration options related to the Perl module output
 #---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
 GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
 PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
 PERLMOD_PRETTY         = YES
-PERLMOD_MAKEVAR_PREFIX = 
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
 #---------------------------------------------------------------------------
-# Configuration options related to the preprocessor   
+# Configuration options related to the preprocessor
 #---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
 ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
 MACRO_EXPANSION        = NO
+
+# 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
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
 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.
+
 SEARCH_INCLUDES        = YES
-INCLUDE_PATH           = 
-INCLUDE_FILE_PATTERNS  = 
-PREDEFINED             = 
-EXPAND_AS_DEFINED      = 
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH           =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS  =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED             =
+
+# 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 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 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
+
 #---------------------------------------------------------------------------
-# Configuration::additions related to external references   
+# Configuration::additions related to external references
 #---------------------------------------------------------------------------
-TAGFILES               = 
-GENERATE_TAGFILE       = 
+
+# 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:
+#
+# 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.
+
+TAGFILES               =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
 ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
 EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
 PERL_PATH              = /usr/bin/perl
+
 #---------------------------------------------------------------------------
-# Configuration options related to the dot tool   
+# Configuration options related to the dot tool
 #---------------------------------------------------------------------------
+
+# 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 also works with HAVE_DOT disabled, but it is recommended to
+# install and use dot, since it yields more powerful graphs.
+
 CLASS_DIAGRAMS         = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH            =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
 HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
 HAVE_DOT               = NO
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
+# allowed to run in parallel. When set to 0 (the default) doxygen will
+# base this on the number of processors available in the system. You can set it
+# explicitly to a value larger than 0 to get control over the balance
+# between CPU load and processing speed.
+
+DOT_NUM_THREADS        = 0
+
+# By default doxygen will write a font called Helvetica to the output
+# directory and reference it in 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
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+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.
+
+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_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
 COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
 GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
 UML_LOOK               = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
 TEMPLATE_RELATIONS     = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
 INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
 INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
 CALL_GRAPH             = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+CALLER_GRAPH           = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will generate a graphical hierarchy of all classes instead of a textual one.
+
 GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
 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, svg, gif or svg.
+# If left blank png will be used.
+
 DOT_IMAGE_FORMAT       = png
-DOT_PATH               = 
-DOTFILE_DIRS           = 
-MAX_DOT_GRAPH_WIDTH    = 1024
-MAX_DOT_GRAPH_HEIGHT   = 1024
+
+# 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.
+
+DOT_PATH               =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+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
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
 MAX_DOT_GRAPH_DEPTH    = 1000
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
 DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
 DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
 GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
 DOT_CLEANUP            = YES
-#---------------------------------------------------------------------------
-# Configuration::additions related to the search engine   
-#---------------------------------------------------------------------------
-SEARCHENGINE           = NO
diff --git a/doc/DoxyfileDev b/doc/DoxyfileDev
new file mode 100644
index 0000000..19b2282
--- /dev/null
+++ b/doc/DoxyfileDev
@@ -0,0 +1,1650 @@
+# Doxyfile 1.7.1
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# 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 (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# This tag specifies the encoding used for all characters in the config file
+# that follow. The default is UTF-8 which is also the encoding used for all
+# text before the first occurrence of this tag. Doxygen uses libiconv (or the
+# iconv built into libc) for the transcoding. See
+# http://www.gnu.org/software/libiconv for the list of possible encodings.
+
+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.
+
+PROJECT_NAME           = linbox
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER         =
+
+# 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
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = .
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
+# 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,
+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
+
+OUTPUT_LANGUAGE        = English
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       = "The $name class" \
+                         "The $name widget" \
+                         "The $name file" \
+                         is \
+                         provides \
+                         specifies \
+                         contains \
+                         represents \
+                         a \
+                         an \
+                         the
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH        =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+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
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like regular Qt-style comments
+# (thus requiring an explicit @brief command for a brief description.)
+
+JAVADOC_AUTOBRIEF      = YES
+
+# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
+# interpret the first line (until the first dot) of a Qt-style
+# comment as the brief description. If set to NO, the comments
+# will behave just like regular Qt-style comments (thus requiring
+# an explicit \brief command for a brief description.)
+
+QT_AUTOBRIEF           = YES
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 4
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                = "bib=\xrefitem bib \"Bibliography\" \"Bibliography\""
+
+# 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
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = YES
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for
+# Java. For instance, namespaces will be presented as packages, qualified
+# scopes will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
+# sources only. Doxygen will then generate output that is more tailored for
+# Fortran.
+
+OPTIMIZE_FOR_FORTRAN   = NO
+
+# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
+# sources. Doxygen will then generate output that is tailored for
+# VHDL.
+
+OPTIMIZE_OUTPUT_VHDL   = NO
+
+# Doxygen selects the parser to use depending on the extension of the files it
+# parses. With this tag you can assign which parser to use for a given extension.
+# Doxygen has a built-in mapping, but you can override or extend it using this
+# tag. The format is ext=language, where ext is a file extension, and language
+# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,
+# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make
+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
+# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
+# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
+
+EXTENSION_MAPPING      =
+
+# 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
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT    = YES
+
+# If you use Microsoft's C++/CLI language, you should set this option to YES to
+# enable parsing support.
+
+CPP_CLI_SUPPORT        = NO
+
+# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
+# Doxygen will parse them like normal C++ but will assume all classes use public
+# instead of private inheritance when no explicit protection keyword is present.
+
+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
+# 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.
+
+IDL_PROPERTY_SUPPORT   = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = YES
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+# 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
+# with name TypeT. When disabled the typedef will appear as a member of a file,
+# namespace, or class. And the struct will be named TypeS. This can typically
+# be useful for C code in case the coding convention dictates that all compound
+# types are typedef'ed and only the typedef is referenced, never the tag name.
+
+TYPEDEF_HIDES_STRUCT   = NO
+
+# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
+# determine which symbols to keep in memory and which to flush to disk.
+# When the cache is full, less often used symbols will be written to disk.
+# 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.
+# 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
+# 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
+
+SYMBOL_CACHE_SIZE      = 0
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC         = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If this flag is set to YES, the members of anonymous namespaces will be
+# 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.
+
+EXTRACT_ANON_NSPACES   = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = YES
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = YES
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = YES
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = NO
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = YES
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
+# will list include files with double quotes in the documentation
+# rather than with sharp brackets.
+
+FORCE_LOCAL_INCLUDES   = NO
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS       = NO
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS        = NO
+
+# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
+# will sort the (brief and detailed) documentation of class members so that
+# constructors and destructors are listed first. If set to NO (the default)
+# the constructors will appear in the respective orders defined by
+# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
+# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
+# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
+
+SORT_MEMBERS_CTORS_1ST = NO
+
+# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
+# hierarchy of group names into alphabetical order. If set to NO (the default)
+# the group names will appear in their defined order.
+
+SORT_GROUP_NAMES       = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = 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.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+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 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
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES       = YES
+
+# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
+# This will remove the Files entry from the Quick Index and from the
+# Folder Tree View (if specified). The default is YES.
+
+SHOW_FILES             = YES
+
+# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
+# Namespaces page.
+# This will remove the Namespaces entry from the Quick Index
+# and from the Folder Tree View (if specified). The default is YES.
+
+SHOW_NAMESPACES        = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from
+# the version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    =
+
+# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
+# by doxygen. The layout file controls the global structure of the generated
+# output files in an output format independent way. The create the layout file
+# that represents doxygen's defaults, run doxygen with the -l option.
+# You can optionally specify a file name after the option, if omitted
+# DoxygenLayout.xml will be used as the name of the layout file.
+
+LAYOUT_FILE            =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be abled 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
+# documentation.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE           = doxydev.debug
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT                  = ../linbox   \
+                         ../doc      \
+                         ../examples \
+                         ../tests    \
+                         ../benchmarks
+
+
+# This tag can be used to specify the character encoding of the source files
+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
+# also the default input encoding. Doxygen uses libiconv (or the iconv built
+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
+# the list of possible encodings.
+
+INPUT_ENCODING         = UTF-8
+
+# If the value of the INPUT tag contains directories, you can use the
+# 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
+
+FILE_PATTERNS          = *.cc \
+                         *.cpp \
+                         *.C \
+                         *.h \
+						 *.inl \
+                         *.doxy
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE              = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# 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.
+
+EXCLUDE                = *_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
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       = *_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
+# output. The symbol name can be a fully qualified name, a word, or if the
+# wildcard * is used, a substring. Examples: ANamespace, AClass,
+# AClass::ANamespace, ANamespace::*Test
+
+EXCLUDE_SYMBOLS        = *__LINBOX_*
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH           = ..
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_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 all files are included.
+
+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
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = YES
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH             =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+# If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER           =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis.
+# Doxygen will compare the file name with each pattern and apply the
+# 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.
+
+FILTER_PATTERNS        =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER         = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = NO
+
+# If the REFERENCES_RELATION tag is set to YES
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = NO
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code.
+# Otherwise they will link to the documentation.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = linbox-dev-html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+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.
+
+HTML_HEADER            =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER            =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# 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!
+
+HTML_STYLESHEET        =
+
+# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
+# Doxygen will adjust the colors in the stylesheet 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,
+# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
+# The allowed range is 0 to 359.
+
+HTML_COLORSTYLE_HUE    = 110
+
+# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
+# the colors in the HTML output. For a value of 0 the output will use
+# grayscales only. A value of 255 will produce the most vivid colors.
+
+HTML_COLORSTYLE_SAT    = 100
+
+# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
+# the luminance component of the colors in the HTML output. Values below
+# 100 gradually make the output lighter, whereas values above 100 make
+# the output darker. The value divided by 100 is the actual gamma applied,
+# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
+# and 100 does not change the gamma.
+
+HTML_COLORSTYLE_GAMMA  = 80
+
+# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
+# page will contain the date and time when the page was generated. Setting
+# this to NO can help when comparing the output of multiple runs.
+
+HTML_TIMESTAMP         = YES
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
+# documentation will contain sections that can be hidden and shown after the
+# page has loaded. For this to work a browser that supports
+# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
+# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+
+HTML_DYNAMIC_SECTIONS  = YES
+
+# If the GENERATE_DOCSET tag is set to YES, additional index files
+# will be generated that can be used as input for Apple's Xcode 3
+# integrated development environment, introduced with OSX 10.5 (Leopard).
+# To create a documentation set, doxygen will generate a Makefile in the
+# HTML output directory. Running make will produce the docset in that
+# directory and running "make install" will install the docset in
+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
+# it at startup.
+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
+# for more information.
+
+GENERATE_DOCSET        = NO
+
+# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
+# feed. A documentation feed provides an umbrella under which multiple
+# documentation sets from a single provider (such as a company or product suite)
+# can be grouped.
+
+DOCSET_FEEDNAME        = "Doxygen generated docs"
+
+# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
+# should uniquely identify the documentation set bundle. This should be a
+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
+# will append .docset to the name.
+
+DOCSET_BUNDLE_ID       = org.doxygen.Project
+
+# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify
+# the documentation publisher. This should be a reverse domain-name style
+# string, e.g. com.mycompany.MyDocSet.documentation.
+
+DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
+
+# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
+
+DOCSET_PUBLISHER_NAME  = Publisher
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE               =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
+# is used to encode HtmlHelp index (hhk), content (hhc) and project file
+# content.
+
+CHM_INDEX_ENCODING     =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
+# that can be used as input for Qt's qhelpgenerator to generate a
+# Qt Compressed Help (.qch) of the generated HTML documentation.
+
+GENERATE_QHP           = NO
+
+# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
+# be used to specify the file name of the resulting .qch file.
+# The path specified is relative to the HTML output folder.
+
+QCH_FILE               =
+
+# The QHP_NAMESPACE tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#namespace
+
+QHP_NAMESPACE          = org.doxygen.Project
+
+# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
+# Qt Help Project output. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#virtual-folders
+
+QHP_VIRTUAL_FOLDER     = doc
+
+# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
+# add. For more information please see
+# http://doc.trolltech.com/qthelpproject.html#custom-filters
+
+QHP_CUST_FILTER_NAME   =
+
+# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
+# custom filter to add. For more information please see
+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">
+# Qt Help Project / Custom Filters</a>.
+
+QHP_CUST_FILTER_ATTRS  =
+
+# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
+# project's
+# filter section matches.
+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">
+# Qt Help Project / Filter Attributes</a>.
+
+QHP_SECT_FILTER_ATTRS  =
+
+# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
+# be used to specify the location of Qt's qhelpgenerator.
+# If non-empty doxygen will try to run qhelpgenerator on the generated
+# .qhp file.
+
+QHG_LOCATION           =
+
+# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
+#  will be generated, which together with the HTML files, form an Eclipse help
+# plugin. To install this plugin and make it available under the help contents
+# menu in Eclipse, the contents of the directory containing the HTML and XML
+# files needs to be copied into the plugins directory of eclipse. The name of
+# the directory within the plugins directory should be the same as
+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
+# the help appears.
+
+GENERATE_ECLIPSEHELP   = NO
+
+# A unique identifier for the eclipse help plugin. When installing the plugin
+# the directory name containing the HTML and XML files should also have
+# this name.
+
+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.
+
+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
+# containing a tree-like index structure (just like the one that
+# 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.
+
+GENERATE_TREEVIEW      = NO
+
+# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
+# and Class Hierarchy pages using a tree view instead of an ordered list.
+
+USE_INLINE_TREES       = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
+# links to external symbols imported via tag files in a separate window.
+
+EXT_LINKS_IN_WINDOW    = NO
+
+# Use this tag to change the font size of Latex formulas included
+# as images in the HTML documentation. The default is 10. Note that
+# when you change the font size after a successful doxygen run you need
+# to manually remove any form_*.png images from the HTML output directory
+# to force them to be regenerated.
+
+FORMULA_FONTSIZE       = 10
+
+# Use the FORMULA_TRANPARENT tag to determine whether or not the images
+# generated for formulas are transparent PNGs. Transparent PNGs are
+# not supported properly for IE 6.0, but are supported on all modern browsers.
+# Note that when changing this option you need to delete any form_*.png files
+# in the HTML output before the changes have effect.
+
+FORMULA_TRANSPARENT    = YES
+
+# 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
+# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
+# (GENERATE_DOCSET) there is already a search function so this one should
+# typically be disabled. For large projects the javascript based search engine
+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
+
+SEARCHENGINE           = NO
+
+# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
+# implemented using a PHP enabled web server instead of at the web client
+# 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
+# and does not have live searching capabilities.
+
+SERVER_BASED_SEARCH    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+# Note that when enabling USE_PDFLATEX this option is only used for
+# generating bitmaps for formulas in the HTML output, but not in the
+# Makefile that is written to the output directory.
+
+LATEX_CMD_NAME         = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME     = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+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
+# executive. If left blank a4wide will be used.
+
+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
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           =
+
+# 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
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+# If LATEX_SOURCE_CODE is set to YES then doxygen will include
+# source code with syntax highlighting in the LaTeX output.
+# Note that which sources are shown also depends on other settings
+# such as SOURCE_BROWSER.
+
+LATEX_SOURCE_CODE      = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet 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.
+
+RTF_STYLESHEET_FILE    =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA             =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD                =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader.
+# This is useful
+# if you want to understand what is going on.
+# On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = NO
+
+# 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
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+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.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH           =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS  =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED             =
+
+# 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.
+
+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.
+
+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:
+#
+# 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.
+
+TAGFILES               =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS           = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# 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.
+
+CLASS_DIAGRAMS         = YES
+
+# You can define message sequence charts within doxygen comments using the \msc
+# command. Doxygen will then run the mscgen tool (see
+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
+# documentation. The MSCGEN_PATH tag allows you to specify the directory where
+# the mscgen tool resides. If left empty the tool is assumed to be found in the
+# default search path.
+
+MSCGEN_PATH            =
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = NO
+
+# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
+# allowed to run in parallel. When set to 0 (the default) doxygen will
+# base this on the number of processors available in the system. You can set it
+# explicitly to a value larger than 0 to get control over the balance
+# between CPU load and processing speed.
+
+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.
+
+DOT_FONTNAME           = FreeSans.ttf
+
+# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
+# The default size is 10pt.
+
+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.
+
+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_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK               = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT options are set to YES then
+# doxygen will generate a call dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable call graphs
+# for selected functions only using the \callgraph command.
+
+CALL_GRAPH             = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
+# doxygen will generate a caller dependency graph for every global function
+# or class method. Note that enabling this option will significantly increase
+# the time of a run. So in most cases it will be better to enable caller
+# graphs for selected functions only using the \callergraph command.
+
+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.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+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.
+
+DOT_IMAGE_FORMAT       = png
+
+# 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.
+
+DOT_PATH               =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_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
+# visualized by representing a node as a red box. Note that doxygen if the
+# number of direct children of the root node in a graph is already larger than
+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
+
+DOT_GRAPH_MAX_NODES    = 50
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that the size of a graph can be further restricted by
+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
+
+MAX_DOT_GRAPH_DEPTH    = 1000
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, because dot on Windows does not
+# seem to support this out of the box. Warning: Depending on the platform used,
+# enabling this option may lead to badly anti-aliased labels on the edges of
+# a graph (i.e. they become hard to read).
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS      = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP            = YES
diff --git a/doc/Makefile.am b/doc/Makefile.am
index b84b835..cda3548 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -4,38 +4,59 @@ INSTALL_TARGETS = install-doc
 endif
 docdir=$(LINBOX_DOC_PATH)
 
-man1_MANS = linbox-config.1 
+man1_MANS = linbox-config.1
 
 all all-local: $(USE_TARGETS)
 
 install install-data-local: $(INSTALL_TARGETS)
 
-docs: 
-	doxygen 
-	cp tutorial.html linbox-html
-	cp install-dist.html linbox-html
-	cp install-dev.html linbox-html
-	cp ../INSTALL linbox-html
-	cp ../COPYING linbox-html
-	cp ../AUTHORS linbox-html
+docs :
+	sed -i 's/\\version\s1.*/\\version\ $(VERSION)/' mainpage.doxy
+	if test -d linbox-html ; then echo exists; else mkdir linbox-html ; fi
+	if test -d linbox-dev-html ; then echo exists; else mkdir linbox-dev-html ; fi
+	cp index-dev.html linbox-dev-html/index.html
+	cp tutorial.html linbox-html/
+	cp install-dist.html linbox-html/
+	cp install-dev.html linbox-html/
+	cp ../INSTALL linbox-html/
+	cp ../COPYING linbox-html/
+	cp ../AUTHORS linbox-html/
+	doxygen Doxyfile
+
+docs_dev :
+	make docs
+	cp tutorial.html linbox-dev-html/
+	cp install-dist.html linbox-dev-html/
+	cp install-dev.html linbox-dev-html/
+	cp ../INSTALL linbox-dev-html/
+	cp ../COPYING linbox-dev-html/
+	cp ../AUTHORS linbox-dev-html/
+	doxygen DoxyfileDev
+
+
 
 install-doc :
 	mkdir $(docdir)
 	cp -r linbox-html $(docdir)/linbox-html
+	cp -r linbox-dev-html $(docdir)/linbox-dev-html
 	cp linbox.html $(docdir)/linbox.html
 
-EXTRA_DIST=\
-	linbox.html		\
-	tutorial.html		\
-	install-dev.html	\
-	install-dist.html	\
-	Doxyfile		\
-	doc.doxy		\
-	mainpage.doxy		\
-	linbox-config.1 
-
-
-clean-local:
+EXTRA_DIST=             \
+    linbox.html         \
+    tutorial.html       \
+    install-dev.html    \
+    index-dev.html      \
+    install-dist.html   \
+    Doxyfile            \
+    DoxyfileDev         \
+    doc.doxy            \
+    mainpage.doxy       \
+    tutorial.doxy       \
+    linbox-config.1
+
+
+clean-local :
 	rm -rf linbox-html
+	rm -rf linbox-dev-html
 
 
diff --git a/doc/Makefile.in b/doc/Makefile.in
index c0386eb..6ec8a3a 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -35,19 +36,26 @@ subdir = doc
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
-	$(top_srcdir)/macros/blas-check.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
 	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
 	$(top_srcdir)/macros/givaro-check.m4 \
 	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
 	$(top_srcdir)/macros/lidia-check.m4 \
 	$(top_srcdir)/macros/linbox-doc.m4 \
 	$(top_srcdir)/macros/linbox-misc.m4 \
 	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
 	$(top_srcdir)/macros/maple-check.m4 \
 	$(top_srcdir)/macros/ntl-check.m4 \
 	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -70,18 +78,21 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
 CC = @CC@
+CCNAM = @CCNAM@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
 DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -89,19 +100,24 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
 GIVARO_CFLAGS = @GIVARO_CFLAGS@
 GIVARO_LIBS = @GIVARO_LIBS@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
 GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
@@ -109,41 +125,52 @@ LIBTOOL = @LIBTOOL@
 LIDIA_CFLAGS = @LIDIA_CFLAGS@
 LIDIA_LIBS = @LIDIA_LIBS@
 LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MAPLE_CFLAGS = @MAPLE_CFLAGS@
 MAPLE_HOME = @MAPLE_HOME@
 MAPLE_LIBS = @MAPLE_LIBS@
 MAPLE_VERSION = @MAPLE_VERSION@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
 NTL_CFLAGS = @NTL_CFLAGS@
 NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RM = @RM@
 SACLIB_CFLAGS = @SACLIB_CFLAGS@
 SACLIB_LIBS = @SACLIB_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+TESTS_CFLAGS = @TESTS_CFLAGS@
 VERSION = @VERSION@
+WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -184,20 +211,24 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 @LINBOX_BUILD_DOC_TRUE at USE_TARGETS = docs
 @LINBOX_BUILD_DOC_TRUE at INSTALL_TARGETS = install-doc
-man1_MANS = linbox-config.1 
+man1_MANS = linbox-config.1
 EXTRA_DIST = \
-	linbox.html		\
-	tutorial.html		\
-	install-dev.html	\
-	install-dist.html	\
-	Doxyfile		\
-	doc.doxy		\
-	mainpage.doxy		\
-	linbox-config.1 
+    linbox.html         \
+    tutorial.html       \
+    install-dev.html    \
+    index-dev.html      \
+    install-dist.html   \
+    Doxyfile            \
+    DoxyfileDev         \
+    doc.doxy            \
+    mainpage.doxy       \
+    tutorial.doxy       \
+    linbox-config.1
 
 all: all-am
 
@@ -206,8 +237,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
 	      exit 1;; \
 	  esac; \
 	done; \
@@ -248,8 +279,8 @@ install-man1: $(man1_MANS) $(man_MANS)
 	  esac; \
 	done; \
 	for i in $$list; do \
-	  if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
-	  else file=$$i; fi; \
+	  if test -f $$i; then file=$$i; \
+	  else file=$(srcdir)/$$i; fi; \
 	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
 	  case "$$ext" in \
 	    1*) ;; \
@@ -290,6 +321,19 @@ CTAGS:
 
 
 distdir: $(DISTFILES)
+	@list='$(MANS)'; if test -n "$$list"; then \
+	  list=`for p in $$list; do \
+	    if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+	    if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
+	  if test -n "$$list" && \
+	    grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
+	    echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
+	    grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/         /' >&2; \
+	    echo "       to fix them, install help2man, remove and regenerate the man pages;" >&2; \
+	    echo "       typically \`make maintainer-clean' will remove them" >&2; \
+	    exit 1; \
+	  else :; fi; \
+	else :; fi
 	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
 	list='$(DISTFILES)'; \
@@ -360,6 +404,8 @@ dvi-am:
 
 html: html-am
 
+html-am:
+
 info: info-am
 
 info-am:
@@ -368,18 +414,28 @@ install-data-am: install-man
 
 install-dvi: install-dvi-am
 
+install-dvi-am:
+
 install-exec-am:
 
 install-html: install-html-am
 
+install-html-am:
+
 install-info: install-info-am
 
+install-info-am:
+
 install-man: install-man1
 
 install-pdf: install-pdf-am
 
+install-pdf-am:
+
 install-ps: install-ps-am
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
@@ -421,22 +477,38 @@ all all-local: $(USE_TARGETS)
 
 install install-data-local: $(INSTALL_TARGETS)
 
-docs: 
-	doxygen 
-	cp tutorial.html linbox-html
-	cp install-dist.html linbox-html
-	cp install-dev.html linbox-html
-	cp ../INSTALL linbox-html
-	cp ../COPYING linbox-html
-	cp ../AUTHORS linbox-html
+docs :
+	sed -i 's/\\version\s1.*/\\version\ $(VERSION)/' mainpage.doxy
+	if test -d linbox-html ; then echo exists; else mkdir linbox-html ; fi
+	if test -d linbox-dev-html ; then echo exists; else mkdir linbox-dev-html ; fi
+	cp index-dev.html linbox-dev-html/index.html
+	cp tutorial.html linbox-html/
+	cp install-dist.html linbox-html/
+	cp install-dev.html linbox-html/
+	cp ../INSTALL linbox-html/
+	cp ../COPYING linbox-html/
+	cp ../AUTHORS linbox-html/
+	doxygen Doxyfile
+
+docs_dev :
+	make docs
+	cp tutorial.html linbox-dev-html/
+	cp install-dist.html linbox-dev-html/
+	cp install-dev.html linbox-dev-html/
+	cp ../INSTALL linbox-dev-html/
+	cp ../COPYING linbox-dev-html/
+	cp ../AUTHORS linbox-dev-html/
+	doxygen DoxyfileDev
 
 install-doc :
 	mkdir $(docdir)
 	cp -r linbox-html $(docdir)/linbox-html
+	cp -r linbox-dev-html $(docdir)/linbox-dev-html
 	cp linbox.html $(docdir)/linbox.html
 
-clean-local:
+clean-local :
 	rm -rf linbox-html
+	rm -rf linbox-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/doc/doc.doxy b/doc/doc.doxy
index eab3106..54b5303 100644
--- a/doc/doc.doxy
+++ b/doc/doc.doxy
@@ -1,14 +1,15 @@
 // Copyright (C) 2005 David Saunders, part of LinBox, GNU LGPL, see COPYING
-/** \brief This is a discussion of the form and organization of %LinBox documentation.
+/** \ingroup linbox
 \defgroup doc doc
 
+\brief This is a discussion of the form and organization of %LinBox documentation.
 
-The doc directory contains 
-- in subdirectory linbox-html/ the html documentation, it it has been built using Doxygen.  Start at 
+The doc directory contains
+- in subdirectory linbox-html/ the html documentation, it has been built using <a href=http://www.stack.nl/~dimitri/doxygen/>Doxygen</a>.  Start at
   <a href="index.html">linbox-html/index.html</a>.
   <!--
-- in subdirectory latex/ the latex reference manual, built using Doxygen. This amounts to 
-everything in the html documentation written out sequentially.  
+- in subdirectory latex/ the latex reference manual, built using Doxygen. This amounts to
+everything in the html documentation written out sequentially.
 -->
 - Doxyfile, which specifies parameters for Doxygen to use when building the docs.
 - %doc.doxy, which is the source of this page.
@@ -16,68 +17,77 @@ everything in the html documentation written out sequentially.
 - <a href="install-dist.html">install-dist.html</a> and <a href="install-dev.html">install-dev.html</a>, some basic installation information.
 - linbox.html, which can be a handy way to get to linbox-html/index.html.
 
-There is a documentation page for each directory (see Modules)
+There is a documentation page for each directory (see <a
+href="modules.html">Modules</a>)
 and each class of the %LinBox distribution.
-A directory (Module) page discusses the primary concepts supported by codes in 
-the directory and lists the classes declared in the directory's files. 
-A class page discusses properties of the class beyond the 
-primary concept(s) that it implements and lists it's documented members.  
+A directory (Module) page discusses the primary concepts supported by codes in
+the directory and lists the classes declared in the directory's files.
+A class page discusses properties of the class beyond the
+primary concept(s) that it implements and lists it's documented members.
 
-Files containing a <tt>main()</tt>, such as in the examples directory,
+<!-- Files containing a <code>main()</code>, such as in the examples directory,
 have a file documentation and show up in the "File List" of the
-documentation giving easy access to the source code.
+documentation giving easy access to the source code. -->
+
+Files containing a <code>\\file my_dir/my_file.h</code> documentation show up in
+the <a href=files.html>files</a> list.
 
 <!-- todo discuss the properties of the various doxygen listings. -->
 
 Each documented object (directory, class, member function, ...) has a one line memo
 that appears with it's name or signature in a parent object listing and at the top of
-it's own page if it has one (directory, class, top-level function).  
+it's own page if it has one (directory, class, top-level function).
 The memo also reappears as the first line of the fuller documentation.
 
-Some attempt is made to indicate which parts are most relevant to the user.  
-{\small HOW?? }
+Some attempt is made to indicate which parts are most relevant to the user.
+<small>HOW??</small>
 
-<h4> Developers: </h4>  
+<h4> Developers: </h4>
 Here are some rules of thumb about the documentation.
 
 Each directory dir/ has a dir/dir.doxy file listing its most user oriented contents and explaining the general nature of them.
-All other documentation is in the header files, a doc comment for each class and for 
+All other documentation is in the header files, a doc comment for each class and for
 each documented member function.
 In tests/ and examples/ there is also some documentation in .C files.
 
-Each documentation comment begins with a <tt>\\brief</tt> memo.
-Keep in mind that the <tt>\\brief</tt> text appears with the name/signature line of the object
+Each documentation comment begins with a <code>\\brief</code> memo.
+Keep in mind that the <code>\\brief</code> text appears with the name/signature line of the object
 right above it.  Thus there is no need to restate information that is plain from the signature
 such as the C++ type of a parameter.  Try to make the brief memo succinctly state what the object
 is for.  The user, looking at the signature and brief memo, will be trying to decide whether,
-at this moment in her study of things, she needs to click on this item for the fuller 
+at this moment in her study of things, she needs to click on this item for the fuller
 documentation of it.  Try to help.
 
-The brief memo should not contain links to other pages.  
-Put desired links in the fuller 
-documentation, sometimes explicitly in "see also" section (using "\see"). 
+The brief memo should not contain links to other pages.
+Put desired links in the fuller
+documentation<!--, sometimes explicitly in "see also" section (using "<code>\\see</code>")-->.
 Most particularly the brief memo should not
 contain links to the object of which this item is a member.  Such links
 become links to the current page and are a distraction and annoyance to the reader.
 
-Use documented parameter listings, with <tt>\\param arg - ...</tt>, when you have something significant to 
-say about all or most of the parameters.  When you use \c \param for one parameter of a function,
-use it for all of them.  However, it is sometimes better to skip the <tt>\\param</tt> listing format 
-and just discuss in sentences the parameters, their requirements on input, relation to each other, 
+Use documented parameter listings, with <code>\\param arg - ...</code>, when you have something significant to
+say about all or most of the parameters.  When you use <code>\\param</code> for one parameter of a function,
+use it for all of them.  However, it is sometimes better to skip the <code>\\param</code> listing format
+and just discuss in sentences the parameters, their requirements on input, relation to each other,
 and properties on output.  Use your judgement about this on a case by case basis.
 
-Members of archetypes should be thoroughly documented in the archetype and then 
-not documented at all in classes adhering to the archetype.  Just a reference to the 
-archetype documentation suffices.  See <tt>???</tt> for an example of this.
+Members of archetypes should be thoroughly documented in the archetype and then
+not documented at all in classes adhering to the archetype.  Just a reference to the
+archetype documentation suffices.  See <code>???</code> for an example of this.
 However, if the archetype function has a particular property concerning it's performance
 or use in this particular class, then document that special property.
 See Butterfly for an example of this.
 In many functions the return value is a reference to the first parameter, the primary output paramater.
-parameter and is rarely used in practice.  
-In this case, don't use both the <tt>\\param</tt> and the <tt>\\return</tt>.  Earlier I proposed not to use \c \return 
-at all in these situations.  Perhaps we should use <tt> \\return arg1 - ...</tt> in place of 
-<tt>\\param arg1 - ... </tt>.
-See <tt>???</tt> for an example of this.
+parameter and is rarely used in practice.
+In this case, don't use both the <code>\\param</code> and the <code>\\return</code>.  Earlier I proposed not to use <code>\\return</code>
+at all in these situations.  Perhaps we should use <code> \\return arg1 - ...</code> in place of
+<code>\\param arg1 - ... </code>.
+See <code>???</code> for an example of this.
 
+<h4>References</h4>
+References to papers/book can be documented for classes, functions, groups,... and referenced in a <a href="bib.html">Bibliography</a> page
+using :  \n
+<code>\\ref</code> - [Authors] [<i>Title</i>] [journal,conference,book,...] [<a href="">doi</a>].
 */
 
+// vim:syn=doxygen
diff --git a/doc/index-dev.html b/doc/index-dev.html
new file mode 100644
index 0000000..9195f1d
--- /dev/null
+++ b/doc/index-dev.html
@@ -0,0 +1,23 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<!--  Copyright (C) 2010 LinBox, Brice Boyer, GNU LGPL, see COPYING for licence information.
+-->
+<html>
+	<head>
+		<title> LinBox documentation for Developers</title>
+		<link href="doxygen.css" rel="stylesheet" type="text/css">
+		<meta http-equiv="Refresh" content="5; URL=../linbox-dev-html/index.html">
+	</head>
+	<body>
+		<h4> Dead link </h4>
+		<p>
+		If you reached and see this page, then you need to compile the documentation first
+		with <pre>
+			<tt>> make docs_dev</tt>.
+		</pre>
+		</p>
+
+		<p>
+		You may also want to return to <a href=../linbox-html/index.html style="color:blue ; font-weight:bold">users documentation</a> or wait till the docs are built (auto refreshing page).
+		</p>
+	</body>
+</html>
diff --git a/doc/install-dev.html b/doc/install-dev.html
index 1055420..1492e2c 100644
--- a/doc/install-dev.html
+++ b/doc/install-dev.html
@@ -5,6 +5,8 @@
 <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="GENERATOR" content="Mozilla/4.76 [en] (X11; U; SunOS 5.8 sun4u) [Netscape]">
+   <link href="doxygen.css" rel="stylesheet" type="text/css">
+   <title>linbox: Installation (for developers)</title>
 </head>
 <body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#551A8B" alink="#FF0000">
  
@@ -18,23 +20,23 @@ module has been checked out using cvs,
 and <tt>libtool </tt>are in your path.<b> </b>Depending on your system
 installation (see <a href="HACKING">HACKING</a>), you may also need
 to set the environment variable <tt>ACLOCAL_FLAGS</tt> to <tt>"-I <automake,
-libtool prefix>/share/aclocal"</tt>.</blockquote>
+libtool prefix>/share/aclocal"</tt>.</blockquote>
 
 <blockquote>
 <b>2.</b> Go to the newly-created linbox directory and
 run the script
 <b>autogen.sh,</b> optionally you may specify the LinBox
 installation directory or an optional package directory using prefixes:
-<blockquote><tt>> cd linbox</tt>
-<br><tt>> ./autogen.sh [--prefix=<inst. dir.> --with-package=<location> --enable-feature]</tt></blockquote>
+<blockquote><tt>> cd linbox</tt>
+<br><tt>> ./autogen.sh [--prefix=<inst. dir.> --with-package=<location> --enable-feature]</tt></blockquote>
 <a href="http://swox.com/gmp">Gmp</a> is required and its location
-must be specified <gmp location> is not a standard location such as
+must be specified <gmp location> is not a standard location such as
 <tt>/usr</tt> or <tt>/usr/loca</tt>l:
-<blockquote><tt>> ./autogen.sh --with-gmp= <gmp location>
+<blockquote><tt>> ./autogen.sh --with-gmp= <gmp location>
 [...]</tt></blockquote>
 <a href="http://math-atlas.sourceforge.net/">Atlas</a>, or other source of BLAS, is also required and its location
 must be specified if not standard.
-<blockquote><tt>> ./autogen.sh --with-atlas= <atlas location>
+<blockquote><tt>> ./autogen.sh --with-atlas= <atlas location>
 [...]</tt></blockquote>
 This sets up the library and runs  .<tt>/configure</tt>
 
@@ -42,17 +44,17 @@ This sets up the library and runs  .<tt>/configure</tt>
 
 <blockquote> 
 <b> 3.1.</b> Where to put the <tt>include/</tt> and <tt>lib/</tt> directories:
-<blockquote><tt>--prefix= <chosen installation directory></tt>
+<blockquote><tt>--prefix= <chosen installation directory></tt>
 <br>Ex:  <tt>--prefix= `pwd` </tt>will put the files within the current
 directory</blockquote>
 
 <p><b> 3.2.</b> The use of an optional package is switched on by specifying the directory
 where it can be found:
 <blockquote>
---with-package=<package_directory> 
+--with-package=<package_directory>
 <br>
 <br>
-<package_directory> can be left blank if the package is installed in a standard directory (<tt>/usr</tt> or <tt>/usr/local</tt>)
+<package_directory> can be left blank if the package is installed in a standard directory (<tt>/usr</tt> or <tt>/usr/local</tt>)
 <br>
 Ex: <tt> --with-givaro</tt> will enable the use of Givaro library and assume it is installed in a standard directory
 <br>
@@ -63,32 +65,32 @@ Ex: <tt> --with-givaro</tt> will enable the use of Givaro library and assume it
 	  <table  border="3" style="text-align: left; margin-left: 30pt;" cellpadding="5" cellspacing="5">
 	    <tr>
 	      <td> <a href="http://ljk.imag.fr/CASYS/LOGICIELS/givaro"> Givaro </a> </td>
-	      <td> <tt> --with-givaro= <givaro_directory></tt> </td>
+	      <td> <tt> --with-givaro= <givaro_directory></tt> </td>
 	      <td> used for finite field arithmetic.</td>
 	    </tr>
 	    <tr>
 	      <td> <a href="http://www.informatik.tu-darmstadt.de/TI/LiDIA/"> Lidia </a></td>
-	      <td> <tt> --with-lidia= <lidia_directory></tt> </td>
+	      <td> <tt> --with-lidia= <lidia_directory></tt> </td>
 	      <td> used for finite field arithmetic.</td>
 	    </tr>
 	    <tr>
 	      <td> <a href="http://shoup.net/ntl/">NTL</a></td>
-	      <td> <tt> --with-ntl= <ntl_directory></tt></td>
+	      <td> <tt> --with-ntl= <ntl_directory></tt></td>
 	      <td> used for finite field, polynomial arithmetic.</td>
 	    </tr>
 	    <tr>
 	      <td> <a href="ftp://ftp.risc.uni-linz.ac.at/pub/saclib/"> Saclib </a></td>
-	      <td> <tt> --with-saclib= <saclib_directory></td>
+	      <td> <tt> --with-saclib= <saclib_directory></td>
 	      <td> not yet used </td>
 	    </tr>
 	    <tr>
 	      <td> <a href="http://www.maplesoft.com/"> Maple </a></td>
-	      <td> <tt> --with-maple= <maple-directory>  </tt></td>
+	      <td> <tt> --with-maple= <maple-directory>  </tt></td>
 	      <td> used to create an interface with Maple.</td>
 	    </tr>
 	    <tr>
 	      <td> <a href="http://www.doxygen.org/"> Doxygen </a></td>
-	      <td> <tt> --with-doxygen= <doxygen-path>  </tt></td>
+	      <td> <tt> --with-doxygen= <doxygen-path>  </tt></td>
 	      <td>used to create the html reference manual.</td>
 	    </tr>
 	  </table>
@@ -96,7 +98,7 @@ Ex: <tt> --with-givaro</tt> will enable the use of Givaro library and assume it
 	  <br>
 	  Note: 
 	  <blockquote>
-	    <p> the use of <tt> --with-default= <default_directory></tt> can add a special directory to the default location of library
+	    <p> the use of <tt> --with-default= <default_directory></tt> can add a special directory to the default location of library
 	    <p> the use of <tt> --with-all</tt> specifies that all packages will be used
 	  </blockquote>
 	</blockquote>
@@ -126,7 +128,7 @@ Ex: <tt> --enable-shared</tt>  will turn on the build of shared library
 </blockquote>
 </blockquote>
 <b>4.  </b>Install the library:
-<blockquote><tt>>  make install</tt></blockquote>
+<blockquote><tt>>  make install</tt></blockquote>
 </blockquote>
 
 <hr WIDTH="100%">
diff --git a/doc/install-dist.html b/doc/install-dist.html
index ac576b0..aac8cf8 100644
--- a/doc/install-dist.html
+++ b/doc/install-dist.html
@@ -5,6 +5,8 @@
 <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="GENERATOR" content="Mozilla/4.76 [en] (X11; U; SunOS 5.8 sun4u) [Netscape]">
+   <link href="doxygen.css" rel="stylesheet" type="text/css">
+   <title>linbox: Installation</title>
 </head>
   <body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#551A8B" alink="#FF0000">
      
@@ -32,19 +34,19 @@
       run the script
       <b>configure,</b> optionally you may specify the LinBox
       installation directory or an optional package directory using prefixes:
-      <blockquote><tt>> cd linbox</tt>
-	<br><tt>> ./configure [--prefix=<inst. dir.> --with-package=<location> --enable-feature]</tt></blockquote>
+      <blockquote><tt>> cd linbox</tt>
+	<br><tt>> ./configure [--prefix=<inst. dir.> --with-package=<location> --enable-feature]</tt></blockquote>
       <a href="http://swox.com/gmp">Gmp</a> is required (preferably compiled with the "--enable-cxx" option) and its location
-      must be specified <gmp location> if not at a standard location such as
+      must be specified <gmp location> if not at a standard location such as
       <tt>/usr</tt> or <tt>/usr/local</tt>:
-      <blockquote><tt>> ./configure --with-gmp= <gmp location>
+      <blockquote><tt>> ./configure --with-gmp= <gmp location>
 	  [...]</tt></blockquote>
       A source of BLAS (e.g. Fortran <a href="http://www.tacc.utexas.edu/resources/software">Goto</a> or C <a href="http://math-atlas.sourceforge.net/">Atlas</a>) 
 is also required and its location
       must be specified if not standard.
-      <blockquote><tt>> ./configure --with-blas=-L<gotoblas location> -lgoto -lpthread
+      <blockquote><tt>> ./configure --with-blas=-L<gotoblas location> -lgoto -lpthread
 	  [...]</tt></blockquote>
-      <blockquote><tt>> ./configure --with-blas= <atlas location>
+      <blockquote><tt>> ./configure --with-blas= <atlas location>
 	  [...]</tt></blockquote>
       This sets up the library and runs  .<tt>/configure</tt>
       
@@ -59,10 +61,10 @@ is also required and its location
 	<p><b> 3.2.</b> The use of an optional package is switched on by specifying the directory
 	  where it can be found:
 	<blockquote>
-	  --with-package=<package_directory> 
+	  --with-package=<package_directory>
 	  <br>
 	  <br>
-	  <package_directory> can be left blank if the package is installed in a standard directory (<tt>/usr</tt> or <tt>/usr/local</tt>)
+	  <package_directory> can be left blank if the package is installed in a standard directory (<tt>/usr</tt> or <tt>/usr/local</tt>)
 	  <br>
 	  Ex: <tt> ./configure --with-givaro</tt> will enable the use of Givaro library and assume it is installed in a standard directory
 	  <br>
@@ -73,32 +75,32 @@ is also required and its location
 	  <table  border="3" style="text-align: left; margin-left: 30pt;" cellpadding="5" cellspacing="5">
 	    <tr>
 	      <td> <a href="http://ljk.imag.fr/CASYS/LOGICIELS/givaro/givaro-3.2.tar.gz"> Givaro (v3.2.6)</a> </td>
-	      <td> <tt> --with-givaro= <givaro_directory></tt> </td>
+	      <td> <tt> --with-givaro= <givaro_directory></tt> </td>
 	      <td> used for finite field arithmetic.</td>
 	    </tr>
 	    <tr>
 	      <td> <a href="http://shoup.net/ntl/">NTL</a></td>
-	      <td> <tt> --with-ntl= <ntl_directory></tt></td>
+	      <td> <tt> --with-ntl= <ntl_directory></tt></td>
 	      <td> used for finite field, polynomial arithmetic.</td>
 	    </tr>
 	    <tr>
 	      <td> <a href="http://www.informatik.tu-darmstadt.de/TI/LiDIA/"> Lidia </a></td>
-	      <td> <tt> --with-lidia= <lidia_directory></tt> </td>
+	      <td> <tt> --with-lidia= <lidia_directory></tt> </td>
 	      <td> used for finite field arithmetic.</td>
 	    </tr>
 	    <tr>
 	      <td> <a href="ftp://ftp.risc.uni-linz.ac.at/pub/saclib/"> Saclib </a></td>
-	      <td> <tt> --with-saclib= <saclib_directory></td>
+	      <td> <tt> --with-saclib= <saclib_directory></td>
 	      <td> not yet used </td>
 	    </tr>
 	    <tr>
 	      <td> <a href="http://www.maplesoft.com/"> Maple (> v9) </a></td>
-	      <td> <tt> --enable-shared --with-maple= <maple-directory>  </tt></td>
+	      <td> <tt> --enable-shared --with-maple= <maple-directory>  </tt></td>
 	      <td> used to create an interface with Maple.</td>
 	    </tr>
 	    <tr>
 	      <td> <a href="http://www.doxygen.org/"> Doxygen </a></td>
-	      <td> <tt> --with-doxygen= <doxygen-path>  </tt></td>
+	      <td> <tt> --with-doxygen= <doxygen-path>  </tt></td>
 	      <td>used to create the html reference manual.</td>
 	    </tr>
 	  </table>
@@ -106,7 +108,7 @@ is also required and its location
 	  <br>
 	  Note: 
 	  <blockquote>
-	    <p> the use of <tt> --with-default= <default_directory></tt> can add a special directory to the default location of library
+	    <p> the use of <tt> --with-default= <default_directory></tt> can add a special directory to the default location of library
 	    <p> the use of <tt> --with-all</tt> specifies that all packages will be used
 	  </blockquote>
 	</blockquote>
@@ -140,7 +142,7 @@ is also required and its location
     
 
       <b>4.  </b>Install the library:
-      <blockquote><tt>>  make install</tt></blockquote>
+      <blockquote><tt>>  make install</tt></blockquote>
     <hr WIDTH="100%">
     <div align=right><font size=-1>Copyright 1999-2007 The Linbox Group.</font></div>
     
diff --git a/doc/mainpage.doxy b/doc/mainpage.doxy
index afc239d..1f768b9 100644
--- a/doc/mainpage.doxy
+++ b/doc/mainpage.doxy
@@ -1,96 +1,180 @@
-// Copyright (C) 2005 David Saunders, part of LinBox, GNU LGPL, see COPYING 
-/** \mainpage LinBox Symbolic Linear Algebra Software Library
+// Copyright (C) 2005 David Saunders, 2010 LinBox. This file is part of LinBox,
+// GNU LGPL, see COPYING for lincene information.
+/** \mainpage LinBox Symbolic Linear Algebra Software Library.
+ *
+ * \section intro Introduction
+ *
+ * %LinBox is a C++ template library of routines for solution of linear algebra
+ * problems including linear system solution, rank, determinant, minimal
+ * polynomial, characteristic polynomial, and Smith normal form.
+ *
+ * Algorithms are provided for matrices with integer entries or entries in a
+ * finite field.  In support of the algorithms, a good collection of finite
+ * field and ring implementations is available.  Also there is provided a
+ * number of matrix storage types, especially for blackbox representation of
+ * sparse or structured matrix classes.  A few algorithms for rational matrices
+ * are available.  More for integer and rational matrices is planned for future
+ * releases.
+ *
+ * \section goals Goals
+ *
+ * Project %LinBox (http://linalg.org) is a collaborative effort among
+ * researchers at a number of locations around the world. Some of the most
+ * active participants are listed \subpage AUTHORS "here".  The goals are to
+ * produce algorithms and software for symbolic linear algebra, particularly
+ * using \ref blackbox matrix methods, i.e. iterative methods requiring only
+ * the linear transform property of the matrix (that, given A and x,  one can
+ * compute \f$y \gets Ax\f$).  Such methods are especially effective with
+ * sparse or structured matrices for which the matrix-vector product can be
+ * computed cheaply.  Increasingly, %LinBox also provides elimination based
+ * methods for dense matrices exploiting the numeric BLAS routines.
+ *
+ * A good collection of finite field implementations is available.  Some
+ * algorithms are probabilistic, but their results are extremely reliable
+ * except over very small fields (less than 1000 elements, say).
+ *
+ * \section desig Design
+ *
+ * %LinBox depends on other packages for some of its functionality.  It is a
+ * design goal of %LinBox to be a kind of \e middleware, providing a common
+ * interface for use in projects needing linear algebra and providing access to
+ * other systems and programs through wrappers whenever their capabilities may
+ * contribute to the linear algebra.  Thus, to gain full advangage of %LinBox
+ * it will be desirable to have certain other packages installed.  In
+ * particular GMP and a BLAS implementation are required.  GMP provides the
+ * basic large integer system used throughout.  We have been using ATLAS for
+ * the BLAS implementation.  The remaining dependencies are optional, but two
+ * packages stand out as contributing substantially to %LinBox.  They are %NTL
+ * and Givaro.  %NTL is used for some finite field and ring representations,
+ * particularly in the case of \c GF(q), where \c q is a prime power or a prime
+ * greater than word size.  %NTL is also used by algorithms that need
+ * polynomial operations such as factorization.  Givaro is another source of
+ * field representations and polynomial operations.  Importantly, Givaro
+ * provides our best representation of small non-prime fields, say <code>q =
+ * p<sup>e</sup> < 10<sup>6</sup></code>.  Functionality from some other
+ * systems has been wrapped also but is currently less widely used in %LinBox.
+ *
+ * \e Genericity and \e high \e performance are the twin goals of %LinBox.  The
+ * genericity is achieved by use of a small set of interfaces.  Algorithms are
+ * implemented with C++ template parameters which may be instantiated with any
+ * class adhering to the specified interface.  High performance is achieved by
+ * judicious specializations of the generic algorithms.  It is entirely within
+ * the spirit of the project to introduce new implementations.  Thus a user of
+ * the library may invoke a %LinBox algorithm, say for determinant or rank of a
+ * matrix, but providing a blackbox class of her own design and perhaps even
+ * providing the underlying field (or commutative ring) representation.
+ * Conversely, the %LinBox field and ring interfaces and the many specific
+ * representations can be used for purposes other than linear algebra
+ * computation or with algorithms not provided by %LinBox.
+ *
+ * \section using Using LinBox
+ *
+ * - \subpage copy.
+ * - \subpage tuto. This is a brief introduction to %LinBox capabilities.
+ * - \subpage inst. Explains how to install from sources or from the latest svn
+ * version.
+ * - \subpage arch. Describes how %LinBox is organized
+ * - <a href="../linbox-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="../linbox-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 LinBox, getting assistance.
+ * We warmly welcome contributors ! Contributing can rhyme with providing
+ * documentation, pointing out bugs, requesting more features, giving
+ * test-cases, making comments about the code,...\br
+ * You can contact the LinBox team at \f$\mathtt{linbox}\!-\!\mathtt{use}
+ * \mathtt{@} \mathtt{googlegroups}\!\cdot\!\mathtt{com}\f$ (user oriented
+ * discussions) or \f$\mathtt{linbox}\!-\!\mathtt{use} \mathtt{@}
+ * \mathtt{googlegroups}\!\cdot\!\mathtt{com}\f$ (development oriented
+ * discussions).
+ *
+ * \authors Members of the \link AUTHORS %LinBox group\endlink.  The most
+ * prolific documenters have been first William J Turner, then Bradford
+ * Hovinen, and David Saunders.
+ *
+ * \version 1.1.7
+ *
+ * \par Support.
+ * The project is supported by the National Science Foundation
+ * (http://www.nsf.gov/) in the USA and by CNRS in France.
+ */
 
-%LinBox is a C++ template library of routines 
-for solution of linear algebra
-problems including linear system solution, rank, determinant, minimal polynomial,
-characteristic polynomial, and Smith normal form.
-Algorithms are provided for 
-matrices with integer entries or entries in a finite field. 
-In support of the algorithms,
-a good collection of finite field and ring implementations is available.
-Also there is provided a number of matrix storage types, especially for 
-blackbox representation of sparse or structured matrix classes. 
-A few algorithms for rational matrices are available.  More for integer and rational
-matrices is planned for future releases.
+ /*! \page copy Copyright and Licencing
+  * The copyright and licensing (GNU LGPL) info of %LinBox is in \c COPYING
+  * \verbinclude "COPYING".
+  */
 
-There is a <a href="tutorial.html">brief tutorial</a>.
+/*!  \page inst Installing LinBox
+ * To install from a distribution, the usual <em> configure, make</em> sequence
+ * applies.  See \subpage dist "configuring and installing" for more details.
+ * To install a development version from the SVN repository see the \subpage
+ * dev "developer info".  The generic Free Software Foundation \subpage INSTALL
+ * "INSTALL" may also be of use.
+ */
 
-The copyright and licensing (GNU LGPL)info of %LinBox is in <a href="COPYING">COPYING</a>.
+/*!  \page arch Architecture of the library
+ *
+ *  The distribution contains subdirectories (documented as `modules' <a
+ *  href=modules.html>here</a>)
+ *
+ *  - <a href="group__linbox.html">linbox</a>. This contains the library
+ *  sources.  The defined objects are in the namespace LinBox.
+ *       - linbox/<a href="group__field.html">field</a>, linbox/<a
+ *       href="group__ring.html">ring</a>, field and ring representations.
+ *       - linbox/<a href="group__randiter.html">randiter</a>, random element
+ *       generation for fields and rings.
+ *       - linbox/<a href="group__blackbox.html">blackbox</a>, generally
+ *       immutable matrix representations for blackbox methods (based on
+ *       matrix-vector products).
+ *       - linbox/<a href="group__matrix.html">matrix</a>, mutable sparse and
+ *       dense matrices.
+ *       - linbox/<a href="group__algorithms.html">algorithms</a>,  the core
+ *       algorithms of %LinBox
+ *       - linbox/<a href="group__solutions.html">solutions</a>, convenience
+ *       wrappers of algorithms
+ *       - linbox/<a href="group__element.html">element</a>, details of field
+ *       and ring element representation.
+ *       - linbox/<a href="group__fflas.html">fflas</a>, wrapper of BLAS for
+ *       exact finite prime field linear algebra.
+ *       - linbox/<a href="group__ffpack.html">ffpack</a>, .
+ *       - linbox/<a href="group__util.html">util</a>, basic integers, timing
+ *       clocks, commentator.
+ *       .
+ *  - <a href="group__examples.html">examples</a>, programs meant to be
+ *  directly useful or be guides
+ *  for the progammer using %LinBox.
+ *  - <a href="group__doc.html">doc</a>, the browsable \c html documentation is
+ *  generated with Doxygen,
+ *  - <a href="group__interfaces.html">interfaces</a>, interfaces to other
+ *  systems, such as Maple, gap, web servers,
+ *  - <a href="group__tests.html">tests</a>, primarily correctness tests to aid
+ *  development.
+ *  - <a href="group__benchmarks.html">benchmarks</a>, where you can benchmark
+ *  and compare your LinBox installation.
+ *  .
+ */
 
-To install from a distribution, the usual <em> configure, make</em> sequence applies.
-See <a href="install-dist.html">configuring and installing</a> for more details.  
-To install a development version from the SVN repository see the <a href="install-dev.html">developer info</a>.
-The generic Free Software Foundation <a href="INSTALL">INSTALL</a> may also be of use.
+/*!  \page AUTHORS LinBox Authors
+ * \verbinclude "AUTHORS"
+ */
 
-Project %LinBox (http://linalg.org)
-is a collaborative effort among researchers at a number of locations around the 
-world. Some of the most active participants are listed <a href="AUTHORS">here</a>. 
-The goals are to produce algorithms and software 
-for symbolic linear algebra, particularly using black box matrix methods, 
-i.e. iterative methods requiring only the linear transform property of the 
-matrix (that, given A and x,  one can compute y <-- Ax).  Such methods are especially
-effective with sparse or structured matrices for which the matrix-vector product can
-be computed cheaply.  Increasingly, linbox also provides elimination based methods for 
-dense matrices exploiting the numeric BLAS routines. 
+/*!  \page INSTALL The INSTALL in LinBox
+ * \verbinclude "INSTALL"
+ */
 
-%A good collection of finite field implementations is available.
-%Some algorithms are probabilistic, but their results are extremely reliable
-%except over very small fields (less than 1000 elements, say).
+/*!  \page dist Configuring and Installing LinBox
+ * \htmlinclude "doc/install-dist.html"
+ */
 
-%LinBox depends on other packages for some of its functionality.  It is a design goal 
-of %LinBox to be a kind of middleware, providing a common interface for use in projects needing 
-linear algebra and providing access to other systems and programs thru wrappers whenever their 
-capabilities may contribute to the linear algebra.  Thus, to gain full advangage of %LinBox it 
-will be desirable to have certain other packages installed.  In particular GMP and a BLAS implementation are required.  GMP provides the basic large integer system used throughout.  We have been
-using ATLAS for the the BLAS implementation.  The remaining dependencies are optional, but two
-packages stand out as contributing substantially to %LinBox.  They are %NTL and Givaro.
-%NTL is used for some finite field and ring representations, particularly in the case of GF(q),
-where q is a prime power or a prime greater than word size.  %NTL is also used by algorithms 
-that need polynomial operations such as factorization. 
-Givaro is another source of field representations and polynomial operations.  Importantly,
-Givaro provides our best representation of small non-prime fields, 
-say q = p<sup>e</sup> < 10<sup>6</sup>.
-Functionality from some other systems has been wrapped also but is currently less 
-widely used in %LinBox.
+/*!  \page dev Developer info for LinBox
+ * \htmlinclude "doc/install-dev.html"
+ *
+ *  \par HACKING LinBox.
+ *  \verbinclude "HACKING"
+ */
 
-Genericity and high performance are the twin goals of %LinBox.  The genericity is achieved 
-by use of a small set of interfaces.  Algorithms are implemented with C++ template 
-parameters which may be instantiated with any class adhering to the specified interface.
-High performance is achieved by judicious specializations of the generic algorithms.
-It is entirely within the spirit of the project to introduce new implementations. 
-Thus a user of the library may invoke a linbox algorithm, say for determinant or rank
-of a matrix, but providing a blackbox class of her own design and perhaps even providing
-the underlying field (or commutative ring) representation.
-Conversely, the %LinBox field and ring interfaces and the many specific representations can 
-be used for purposes other than linear algebra computation or with algorithms not provided
-by %LinBox.
-
-The distribution contains subdirectories (documented as `modules')
- - <a href="group__linbox.html">linbox</a>. This contains the library sources.  The defined objects are in 
-   the namespace LinBox.
-   - linbox/<a href="group__field.html">field</a>, linbox/<a href="group__ring.html">ring</a>, field and ring representations.
-   - linbox/<a href="group__randiter.html">randiter</a>, random element generation for fields and rings.
-   - linbox/<a href="group__blackbox.html">blackbox</a>, generally immutable matrix representations for blackbox methods (based on matrix-vector products).
-   - linbox/<a href="group__matrix.html">matrix</a>, mutable sparse and dense matrices.
-   - linbox/<a href="group__algorithms.html">algorithms</a>,  the core algorithms of %LinBox
-   - linbox/<a href="group__solutions.html">solutions</a>, convenience wrappers of algorithms
-   - linbox/<a href="group__element.html">element</a>, details of field and ring element representation.
-   - linbox/<a href="group__fflas.html">fflas</a>, wrapper of BLAS for exact finite prime field linear algebra.
-   - linbox/<a href="group__ffpack.html">ffpack</a>, .
-   - linbox/<a href="group__util.html">util</a>, basic integers, timing clocks, commentator. 
- - <a href="group__examples.html">examples</a>, programs meant to be directly useful or be guides 
-   for the progammer using %LinBox.
- - <a href="group__doc.html">doc</a>, the browsable html documentation is generated with doxygen,
- - <a href="group__interfaces.html">interfaces</a>, interfaces to other systems, such as Maple, gap, web servers,
- - <a href="group__tests.html">tests</a>, primarily correctness tests to aid development. 
-
-\authors Members of the %LinBox group.  The most prolific documenters 
-have been first William J Turner, then Bradford Hovinen, and recently
-David Saunders.
-
-The project is supported by 
-the National Science Foundation (http://www.nsf.gov/) in the USA 
-and by CNRS in France. 
- 
-*/
+// vim:syn=doxygen
diff --git a/doc/tutorial.doxy b/doc/tutorial.doxy
new file mode 100644
index 0000000..c1eaf7b
--- /dev/null
+++ b/doc/tutorial.doxy
@@ -0,0 +1,206 @@
+// Copyright (C) 2005 David Saunders, 2010 LinBox.
+// This file is part of LinBox, see COPYING for licence information.
+/*!  \page tuto LinBox tutorial
+
+The person requiring some exact linear algebra computation may exploit LinBox
+at any of four general levels.  In order from least involved with the details
+to most involved, they are:
+
+<ol>
+<li>
+Access using a LinBox web server.
+</li>
+
+The user at this level must attend to preparation of a matrix in a suitable
+file format and invoking the webservice.  The server itself should provide
+adequate documentation for this.  Servers are generally available at <a
+href="http://www.linalg.org" target="_blank">linalg.org</a>.
+
+<li>
+Access using compiled codes.  Full programs exist in the examples directory and
+can be used through an interface to LinBox in a general purposes system such as
+Maple or <a href="http://www.sagemath.org"  target="_blank">SAGE</a>.
+</li>
+
+The user at this level must see to installation, and then attend to preparation
+of her matrix in a suitable file format and to the form of the program or
+procedure invocation.  A number of programs are available in the examples
+directory distributed with LinBox providing for rank, determinant, linear
+system solution, etc.  The documentation of the examples module should serve
+for this level of access.
+
+<!-- what about interfaces maple and gap - can they be documented now? -->
+
+<li>
+Use of LinBox as a programmers library for exact linear algebra functions.
+</li>
+
+At this level a user must do at least the following:
+<ol type="a">
+<li>
+Choose a field or ring representation and construct a specific field or ring
+object \c R.
+</li>
+<li>
+Choose a blackbox or matrix representation suitable to your data and construct
+specific matrix \c A over \c R.
+</li>
+<li>
+Call needed algorithm.  The solutions directory is designed to support this by
+providing functions with simple problem oriented interfaces (\c rank(), \c
+det(), \c solve()), yet allowing some user control of algorithm details.  The
+programmer may be providing some of the parts such as an application specific
+blackbox matrix class.
+</li>
+</ol>
+
+<li>
+Power development.
+</li>
+
+Again, this is use of LinBox as a library, but with hands fully on the details.
+The programmer at this level apparently needs the best opportunities for high
+performance and is willing to use the more complicated internal interfaces to
+get it.  Direct calls to functions in the algorithms directory and perhaps to
+related packages such as \c FFLAS, \c FFPACK, or other components are being
+used.  The programmer working at this level of intimacy with LinBox is likely
+to develop some components that ought to be included in future releases of
+LinBox.  Such contributions are warmly welcomed.  The online documentation
+system is intended primarily for the programmer at level 3.  Thus documentation
+is not generated to the last internal detail.  It is supposed that the level 4
+(and 3) programmer, when studying internal details, will be best served by
+reading the code.  It is possible, if you wish, to set <a
+href="http://www.doxygen.org/" target="_blank">doxygen</a> parameters so as to
+have a documentation listing for every class and function.  Good luck
+separating wheat from chaff in that case.
+
+</ol>
+
+
+In this tutorial we will discuss a simple application at level 3,  the design
+of a program to compute the determinant of a sparse matrix over
+\f$\mathbf{GF}(101)\f$.  The programmer has 3 major issues: field, matrix,
+algorithm.
+
+The basic algorithm choice is between blackbox and elimination algorithms.
+If our matrix is \c A, then the algorithm call may look like
+\code
+det(d, A, Method::Blackbox());
+//or
+det(d, A, Method::Elimination());
+\endcode
+To have access to this determinant function just <code>\#include <linbox/solutions/det.h></code>.
+
+The larger and sparser the matrix the more likely that the blackbox algorithm
+is fastest.  Hybrids are under development to help make this choice, and even
+to make it at run time adaptively.  The last argument to the solutions
+functions is a method object which specifies the algorithm to be used.  In each
+case there is a default, so this argument is optional.  Also, some method
+objects may be constructed so as to convey more detail about the algorithm to
+use.  For example it may help to promise that the matrix is nonsingular or
+symmetric or to request a particular algorithm variant.  The blackbox algorithm
+based fundamentally on Wiedemann's approach is specified by
+\c Method::Wiedemann, see \c solutions/methods.h for more details.  Specification of
+a blocked blackbox algorithm may be advantageous (in the future).   Elimination
+is likely fastest if the matrix is not extremely sparse or not large or not
+subject to rapid fill-in.
+
+Of course, first we must construct the matrix and field.  For the field, you
+must first choose the class (representation type) of field and then instantiate
+your specific field.
+
+\code
+#include <linbox/field/modular.h>
+
+
+typedef Modular<short> Field;
+Field F(101);
+\endcode
+
+It is a good idea to use a \p typedef, making it easy to change representations
+later.  The \ref modular field representations are LinBox's own and contain
+some useful optimizations.  Another possibility is use of <a
+href="http://shoup.net/ntl/" target="_blank">NTL</a>'s \c NTL::ZZ_p class.  The
+LinBox wrapper of that, called \p LinBox::NTL_ZZ_p is found in \c
+field/ntl-ZZ_p.h.  Or use a <a
+href="http://ljk.imag.fr/CASYS/LOGICIELS/givaro/" target="_blank">Givaro</a>
+table based representation, \c LinBox::GivaroGfq in \c field/givaro-gfq.h
+...and there are many other options.  The program \c tests/test-fields.C will
+provide some timing data on the basic functions of each representation.  In
+%LinBox, a \p Field class and the class representing the field entries are
+distinct types.  The field object owns the arithmetic operations, whereas the
+entry objects may be of a primitive type such as \c short, \c int, \c double.
+Each field class \p Fld has the embedded class \c Fld::Element for it's
+elements.
+
+\code
+Field::Element a, b, c;
+F.init(a, 2); F.init(b, 3);
+F.mul(c, a, b); // c <- a*b
+F.write(cout, c);
+\endcode
+
+<!-- put here a diatribe on field and element representations -->
+
+You have seen that the field representations are in subdirectory
+\c linbox/field.  Similarly the matrix representations are in
+\c linbox/blackbox.  All of these are are suitable for blackbox
+algorithms.  Only those deriving from representations in \c linbox/matrix
+are suitable for elimination.  For a sparse matrix, \c LinBox::TriplesBB is a
+good representation choice if a blackbox algorithm is to be used.  For a
+\f$\{0,1\}-\f$incidence matrix, the class \c LinBox::ZeroOne will be more economical of
+space and time.  On the other hand, if elimination is to be used, those will
+not serve at all, but \c LinBox::SparseMatrix, which allows internal
+modification, will do the trick.  The ordinary matrix representation is
+\c LinBox::DenseMatrix.  If your matrix structure allows you to compute
+matrix-vector products in a way faster than these classes provide, you can gain
+by defining your own matrix class adhering to the \ref blackbox interface.  The main
+components of the blackbox interface are member functions \c apply() and
+\c applyTranspose() functions. \c A.apply(y, x) performs \f$y \gets Ax\f$.
+
+Then there is the question of initializing matrix
+entries.  Two basic approaches are illustrated here.
+
+\code
+TriplesBB A;
+A.read("triples-file"); // initialize A from data in file (including shape).
+\endcode
+
+Or a program can add entries to a sparse or dense matrix one by one using the \c setEntry
+function.
+
+\code
+SparseMatrix B(100, 200); // 100 by 200 zero matrix (so far).
+for ( ... )
+{
+   Field::Element v;
+   F.init(v, ...);
+   B.setEntry(i, j, v);  // put nonzero v in i,j position.
+}
+\endcode
+
+Putting it all together, we may have a program looking like this.
+\code
+#include <linbox/field/modular.h>
+#include <linbox/blackbox/dense.h>
+#include <linbox/solutions/det.h>
+
+using namespace LinBox;
+
+main()
+{
+    typedef Modular<double> Field;
+    typedef DenseMatrix<Field> Matrix;
+    Field F(65521);
+    Matrix A; A.read("datafile");
+    Field::Element d;
+    det(d, A, blasElimination);
+    F.write(cout << "the determinant is ", d) << endl;
+}
+\endcode
+
+This tutorial should continue with a discussion of compilation issues, but it
+doesn't.  Something useful may be learned from examining the Makefile.am in the examples directory.
+*/
+
+// vim:syntax=doxygen
diff --git a/doc/tutorial.html b/doc/tutorial.html
index 7bfdbfc..1e8f697 100644
--- a/doc/tutorial.html
+++ b/doc/tutorial.html
@@ -16,14 +16,14 @@ In order from least involved with the details to most involved, they are:
 Access using a linbox web server. 
 <p>
 The user at this level must attend to preparation of a matrix in 
-a suitable file format and invoking the service.  The server itself should provide adequate 
+a suitable file format and invoking the webservice.  The server itself should provide adequate 
 documentation for this.  
-These <a href="linalg.org/servers">servers</a> are generally available.
+Servers are generally available at <a href="linalg.org">linalg.org</a>.
 
 <li>
 Access using compiled codes.  Full programs exist in the examples directory and
 can be used through an interface to linbox 
-in a general purposes system such as Maple or GAP.  
+in a general purposes system such as Maple or SAGE.  
 <p>
 The user at this level must see to installation, and then attend to preparation of her
 matrix in a suitable file format and to the form of the program or procedure invocation.
diff --git a/examples/Makefile.am b/examples/Makefile.am
index 518adc4..caabb87 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -1,25 +1,35 @@
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 
 #INCLUDES=-I$(top_srcdir)
-INCLUDES=-I$(top_srcdir) -I$(top_srcdir)/linbox
+AM_CPPFLAGS=-I$(top_srcdir) -I$(top_srcdir)/linbox
 
 #if LinBoxSrcOnly
-#AM_CPPFLAGS=-g -DLinBoxSrcOnly $(GMP_CFLAGS) $(NTL_CFLAGS) $(GIVARO_CFLAGS) $(LIDIA_CFLAGS) 
-#LINBOX_LIBS= 
+#AM_CPPFLAGS=-g -DLinBoxSrcOnly $(GMP_CFLAGS) $(NTL_CFLAGS) $(GIVARO_CFLAGS) $(LIDIA_CFLAGS)
+#LINBOX_LIBS=
 #else
-#AM_CPPFLAGS=-g $(GMP_CFLAGS) $(NTL_CFLAGS) $(GIVARO_CFLAGS) $(LIDIA_CFLAGS) 
-#LINBOX_LIBS= $(top_builddir)/linbox/liblinbox.la 
+#AM_CPPFLAGS=-g $(GMP_CFLAGS) $(NTL_CFLAGS) $(GIVARO_CFLAGS) $(LIDIA_CFLAGS)
+#LINBOX_LIBS= $(top_builddir)/linbox/liblinbox.la
 #endif
 
-AM_CXXFLAGS = -g -DLinBoxSrcOnly -Wall -O2 
-AM_CPPFLAGS= $(GMP_CFLAGS) $(NTL_CFLAGS) $(GIVARO_CFLAGS) $(LIDIA_CFLAGS)
-LDADD = $(BLAS_LIBS) $(NTL_LIBS) $(GMP_LIBS) $(GIVARO_LIBS) $(LIDIA_LIBS)
+# SAFER_FLAGS=--std=c++98 -g -Wall -Wextra -Wno-ignored-qualifiers -Wno-unused-parameter
+#  SAFER_FLAGS=-g -Wall -Wextra -Wno-unused-parameter
 
-#EX_LDADD = $(NTL_LIBS) $(GMP_LIBS) $(GIVARO_LIBS) $(LIDIA_LIBS) $(BLAS_LIBS) 
+# AM_CXXFLAGS = $(SAFER_FLAGS) -DLinBoxSrcOnly -DDEBUG -O0
+AM_CXXFLAGS = @DEFAULT_CFLAGS@ -DLinBoxSrcOnly
+AM_CPPFLAGS += $(GMP_CFLAGS) $(NTL_CFLAGS) $(FFLAFLAS_CFLAGS) $(GIVARO_CFLAGS) $(LIDIA_CFLAGS)
+#LDADD = $(NTL_LIBS) $(GIVARO_LIBS) $(LIDIA_LIBS) $(BLAS_LIBS) $(GMP_LIBS)  "-Wl,-enable-auto-import"
+LDADD = $(NTL_LIBS) $(GIVARO_LIBS) $(LIDIA_LIBS) $(BLAS_LIBS) $(GMP_LIBS)
+#  AM_LDFLAGS=-static
+
+#EX_LDADD = $(NTL_LIBS) $(GMP_LIBS) $(GIVARO_LIBS) $(LIDIA_LIBS) $(BLAS_LIBS)
 #LDADD = $(LINBOX_LIBS) $(EX_LDADD)
 
-SUBDIRS=fields 
+SUBDIRS=fields
 
-EXAMPLES=rank det minpoly valence solve dot-product echelon sparseelimdet sparseelimrank checksolve doubledet
+EXAMPLES=rank det minpoly valence solve dot-product echelon sparseelimdet sparseelimrank checksolve doubledet smithvalence
+# EXAMPLES+=nulp yabla
 GIVARONTL_EXAMPLES=smith charpoly graph-charpoly
 if LINBOX_HAVE_NTL
 if LINBOX_HAVE_GIVARO
@@ -28,36 +38,41 @@ endif
 endif
 
 
-EXTRA_PROGRAMS= $(EXAMPLES) $(USE_GIVARONTL_EXAMPLES) 
+EXTRA_PROGRAMS= $(EXAMPLES) $(USE_GIVARONTL_EXAMPLES)
 
-examples: ${EXTRA_PROGRAMS}
+CLEANFILES=$(EXTRA_PROGRAMS)
 
-dot_product_SOURCES = \
-	dot-product.C
+EXTRA_DIST = examples.doxy
+
+examples: ${EXTRA_PROGRAMS}
 
-doubledet_SOURCES= doubledet.C
+dot_product_SOURCES    = dot-product.C
+doubledet_SOURCES      = doubledet.C
 #linbox_program_SOURCES = \
 #	linbox-program.C
-
-
-checksolve_SOURCES = checksolve.C
-charpoly_SOURCES = charpoly.C Matio.h
-graph_charpoly_SOURCES = graph-charpoly.C Matio.h
-det_SOURCES = det.C
-rank_SOURCES = rank.C
-smith_SOURCES = smith.C
-minpoly_SOURCES = minpoly.C
-valence_SOURCES = valence.C
-solve_SOURCES = solve.C
-echelon_SOURCES=echelon.C
-sparseelimdet_SOURCES=sparseelimdet.C
-sparseelimrank_SOURCES=sparseelimrank.C
+checksolve_SOURCES     = checksolve.C
+charpoly_SOURCES       = charpoly.C
+graph_charpoly_SOURCES = graph-charpoly.C
+det_SOURCES            = det.C
+rank_SOURCES           = rank.C
+smith_SOURCES          = smith.C
+minpoly_SOURCES        = minpoly.C
+valence_SOURCES        = valence.C
+solve_SOURCES          = solve.C
+echelon_SOURCES        = echelon.C
+smithvalence_SOURCES   = smithvalence.C
+sparseelimdet_SOURCES  = sparseelimdet.C
+sparseelimrank_SOURCES = sparseelimrank.C
 LINBOX=@prefix@
 
 # no /bin if LinBox is uncompiled
 #LINBOX_BIN=$(LINBOX)/bin
 LINBOX_BIN=@bindir@
 
+
 # for compilation of new examples
-%:%.C 
-	$(CXX) $(CXXFLAGS) $(OPTFLAGS) ${INCLUDES} $(AM_CPPFLAGS) $(LDADD) $*.C -o $@
+%:%.C
+	$(CXX) $(CXXFLAGS) $(AM_CXXFLAGS) $(OPTFLAGS) ${INCLUDES} $(AM_CPPFLAGS) $*.C -o $@ $(LDFLAGS) $(LDADD) $(LOADLIBES) $(top_srcdir)/linbox/.libs/liblinbox.a
+
+%:%.cpp
+	$(CXX)  $(CXXFLAGS) $(AM_CXXFLAGS) $(OPTFLAGS) ${INCLUDES} $(AM_CPPFLAGS) $*.cpp -o $@ $(LDFLAGS) $(LDADD) $(LOADLIBES) $(top_srcdir)/linbox/.libs/liblinbox.a
diff --git a/examples/Makefile.in b/examples/Makefile.in
index 301774f..f2ae58d 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -13,6 +14,10 @@
 # PARTICULAR PURPOSE.
 
 @SET_MAKE@
+
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -37,19 +42,26 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
 	$(srcdir)/Readme-make.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
-	$(top_srcdir)/macros/blas-check.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
 	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
 	$(top_srcdir)/macros/givaro-check.m4 \
 	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
 	$(top_srcdir)/macros/lidia-check.m4 \
 	$(top_srcdir)/macros/linbox-doc.m4 \
 	$(top_srcdir)/macros/linbox-misc.m4 \
 	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
 	$(top_srcdir)/macros/maple-check.m4 \
 	$(top_srcdir)/macros/ntl-check.m4 \
 	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -58,7 +70,8 @@ CONFIG_CLEAN_FILES = Readme-make
 am__EXEEXT_1 = rank$(EXEEXT) det$(EXEEXT) minpoly$(EXEEXT) \
 	valence$(EXEEXT) solve$(EXEEXT) dot-product$(EXEEXT) \
 	echelon$(EXEEXT) sparseelimdet$(EXEEXT) \
-	sparseelimrank$(EXEEXT) checksolve$(EXEEXT) doubledet$(EXEEXT)
+	sparseelimrank$(EXEEXT) checksolve$(EXEEXT) doubledet$(EXEEXT) \
+	smithvalence$(EXEEXT)
 am__EXEEXT_2 = smith$(EXEEXT) charpoly$(EXEEXT) \
 	graph-charpoly$(EXEEXT)
 @LINBOX_HAVE_GIVARO_TRUE@@LINBOX_HAVE_NTL_TRUE at am__EXEEXT_3 = $(am__EXEEXT_2)
@@ -123,6 +136,12 @@ smith_LDADD = $(LDADD)
 smith_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1)
+am_smithvalence_OBJECTS = smithvalence.$(OBJEXT)
+smithvalence_OBJECTS = $(am_smithvalence_OBJECTS)
+smithvalence_LDADD = $(LDADD)
+smithvalence_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_solve_OBJECTS = solve.$(OBJEXT)
 solve_OBJECTS = $(am_solve_OBJECTS)
 solve_LDADD = $(LDADD)
@@ -159,26 +178,19 @@ CXXLD = $(CXX)
 CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
-	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
-	$(LDFLAGS) -o $@
 SOURCES = $(charpoly_SOURCES) $(checksolve_SOURCES) $(det_SOURCES) \
 	$(dot_product_SOURCES) $(doubledet_SOURCES) $(echelon_SOURCES) \
 	$(graph_charpoly_SOURCES) $(minpoly_SOURCES) $(rank_SOURCES) \
-	$(smith_SOURCES) $(solve_SOURCES) $(sparseelimdet_SOURCES) \
-	$(sparseelimrank_SOURCES) $(valence_SOURCES)
+	$(smith_SOURCES) $(smithvalence_SOURCES) $(solve_SOURCES) \
+	$(sparseelimdet_SOURCES) $(sparseelimrank_SOURCES) \
+	$(valence_SOURCES)
 DIST_SOURCES = $(charpoly_SOURCES) $(checksolve_SOURCES) \
 	$(det_SOURCES) $(dot_product_SOURCES) $(doubledet_SOURCES) \
 	$(echelon_SOURCES) $(graph_charpoly_SOURCES) \
 	$(minpoly_SOURCES) $(rank_SOURCES) $(smith_SOURCES) \
-	$(solve_SOURCES) $(sparseelimdet_SOURCES) \
-	$(sparseelimrank_SOURCES) $(valence_SOURCES)
+	$(smithvalence_SOURCES) $(solve_SOURCES) \
+	$(sparseelimdet_SOURCES) $(sparseelimrank_SOURCES) \
+	$(valence_SOURCES)
 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	html-recursive info-recursive install-data-recursive \
 	install-dvi-recursive install-exec-recursive \
@@ -200,18 +212,21 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
 CC = @CC@
+CCNAM = @CCNAM@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
 DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -219,19 +234,24 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
 GIVARO_CFLAGS = @GIVARO_CFLAGS@
 GIVARO_LIBS = @GIVARO_LIBS@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
 GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
@@ -239,41 +259,52 @@ LIBTOOL = @LIBTOOL@
 LIDIA_CFLAGS = @LIDIA_CFLAGS@
 LIDIA_LIBS = @LIDIA_LIBS@
 LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MAPLE_CFLAGS = @MAPLE_CFLAGS@
 MAPLE_HOME = @MAPLE_HOME@
 MAPLE_LIBS = @MAPLE_LIBS@
 MAPLE_VERSION = @MAPLE_VERSION@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
 NTL_CFLAGS = @NTL_CFLAGS@
 NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RM = @RM@
 SACLIB_CFLAGS = @SACLIB_CFLAGS@
 SACLIB_LIBS = @SACLIB_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+TESTS_CFLAGS = @TESTS_CFLAGS@
 VERSION = @VERSION@
+WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -314,38 +345,48 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 
 #INCLUDES=-I$(top_srcdir)
-INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/linbox
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/linbox $(GMP_CFLAGS) \
+	$(NTL_CFLAGS) $(FFLAFLAS_CFLAGS) $(GIVARO_CFLAGS) \
+	$(LIDIA_CFLAGS)
 
 #if LinBoxSrcOnly
-#AM_CPPFLAGS=-g -DLinBoxSrcOnly $(GMP_CFLAGS) $(NTL_CFLAGS) $(GIVARO_CFLAGS) $(LIDIA_CFLAGS) 
-#LINBOX_LIBS= 
+#AM_CPPFLAGS=-g -DLinBoxSrcOnly $(GMP_CFLAGS) $(NTL_CFLAGS) $(GIVARO_CFLAGS) $(LIDIA_CFLAGS)
+#LINBOX_LIBS=
 #else
-#AM_CPPFLAGS=-g $(GMP_CFLAGS) $(NTL_CFLAGS) $(GIVARO_CFLAGS) $(LIDIA_CFLAGS) 
-#LINBOX_LIBS= $(top_builddir)/linbox/liblinbox.la 
+#AM_CPPFLAGS=-g $(GMP_CFLAGS) $(NTL_CFLAGS) $(GIVARO_CFLAGS) $(LIDIA_CFLAGS)
+#LINBOX_LIBS= $(top_builddir)/linbox/liblinbox.la
 #endif
-AM_CXXFLAGS = -g -DLinBoxSrcOnly -Wall -O2 
-AM_CPPFLAGS = $(GMP_CFLAGS) $(NTL_CFLAGS) $(GIVARO_CFLAGS) $(LIDIA_CFLAGS)
-LDADD = $(BLAS_LIBS) $(NTL_LIBS) $(GMP_LIBS) $(GIVARO_LIBS) $(LIDIA_LIBS)
 
-#EX_LDADD = $(NTL_LIBS) $(GMP_LIBS) $(GIVARO_LIBS) $(LIDIA_LIBS) $(BLAS_LIBS) 
+# SAFER_FLAGS=--std=c++98 -g -Wall -Wextra -Wno-ignored-qualifiers -Wno-unused-parameter
+#  SAFER_FLAGS=-g -Wall -Wextra -Wno-unused-parameter
+
+# AM_CXXFLAGS = $(SAFER_FLAGS) -DLinBoxSrcOnly -DDEBUG -O0
+AM_CXXFLAGS = @DEFAULT_CFLAGS@ -DLinBoxSrcOnly
+#LDADD = $(NTL_LIBS) $(GIVARO_LIBS) $(LIDIA_LIBS) $(BLAS_LIBS) $(GMP_LIBS)  "-Wl,-enable-auto-import"
+LDADD = $(NTL_LIBS) $(GIVARO_LIBS) $(LIDIA_LIBS) $(BLAS_LIBS) $(GMP_LIBS)
+#  AM_LDFLAGS=-static
+
+#EX_LDADD = $(NTL_LIBS) $(GMP_LIBS) $(GIVARO_LIBS) $(LIDIA_LIBS) $(BLAS_LIBS)
 #LDADD = $(LINBOX_LIBS) $(EX_LDADD)
-SUBDIRS = fields 
-EXAMPLES = rank det minpoly valence solve dot-product echelon sparseelimdet sparseelimrank checksolve doubledet
+SUBDIRS = fields
+EXAMPLES = rank det minpoly valence solve dot-product echelon sparseelimdet sparseelimrank checksolve doubledet smithvalence
+# EXAMPLES+=nulp yabla
 GIVARONTL_EXAMPLES = smith charpoly graph-charpoly
 @LINBOX_HAVE_GIVARO_TRUE@@LINBOX_HAVE_NTL_TRUE at USE_GIVARONTL_EXAMPLES = $(GIVARONTL_EXAMPLES)
-dot_product_SOURCES = \
-	dot-product.C
-
+CLEANFILES = $(EXTRA_PROGRAMS)
+EXTRA_DIST = examples.doxy
+dot_product_SOURCES = dot-product.C
 doubledet_SOURCES = doubledet.C
 #linbox_program_SOURCES = \
 #	linbox-program.C
 checksolve_SOURCES = checksolve.C
-charpoly_SOURCES = charpoly.C Matio.h
-graph_charpoly_SOURCES = graph-charpoly.C Matio.h
+charpoly_SOURCES = charpoly.C
+graph_charpoly_SOURCES = graph-charpoly.C
 det_SOURCES = det.C
 rank_SOURCES = rank.C
 smith_SOURCES = smith.C
@@ -353,6 +394,7 @@ minpoly_SOURCES = minpoly.C
 valence_SOURCES = valence.C
 solve_SOURCES = solve.C
 echelon_SOURCES = echelon.C
+smithvalence_SOURCES = smithvalence.C
 sparseelimdet_SOURCES = sparseelimdet.C
 sparseelimrank_SOURCES = sparseelimrank.C
 LINBOX = @prefix@
@@ -368,8 +410,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
 	      exit 1;; \
 	  esac; \
 	done; \
@@ -425,6 +467,9 @@ rank$(EXEEXT): $(rank_OBJECTS) $(rank_DEPENDENCIES)
 smith$(EXEEXT): $(smith_OBJECTS) $(smith_DEPENDENCIES) 
 	@rm -f smith$(EXEEXT)
 	$(CXXLINK) $(smith_OBJECTS) $(smith_LDADD) $(LIBS)
+smithvalence$(EXEEXT): $(smithvalence_OBJECTS) $(smithvalence_DEPENDENCIES) 
+	@rm -f smithvalence$(EXEEXT)
+	$(CXXLINK) $(smithvalence_OBJECTS) $(smithvalence_LDADD) $(LIBS)
 solve$(EXEEXT): $(solve_OBJECTS) $(solve_DEPENDENCIES) 
 	@rm -f solve$(EXEEXT)
 	$(CXXLINK) $(solve_OBJECTS) $(solve_LDADD) $(LIBS)
@@ -466,7 +511,7 @@ clean-libtool:
 #     (which will cause the Makefiles to be regenerated when you run `make');
 # (2) otherwise, pass the desired values on the `make' command line.
 $(RECURSIVE_TARGETS):
-	@failcom='exit 1'; \
+	@fail= failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
 	    *=* | --[!k]*);; \
@@ -491,7 +536,7 @@ $(RECURSIVE_TARGETS):
 	fi; test -z "$$fail"
 
 $(RECURSIVE_CLEAN_TARGETS):
-	@failcom='exit 1'; \
+	@fail= failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
 	    *=* | --[!k]*);; \
@@ -534,7 +579,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
@@ -654,6 +699,7 @@ install-strip:
 mostlyclean-generic:
 
 clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
 
 distclean-generic:
 	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -676,6 +722,8 @@ dvi-am:
 
 html: html-recursive
 
+html-am:
+
 info: info-recursive
 
 info-am:
@@ -684,18 +732,28 @@ install-data-am:
 
 install-dvi: install-dvi-recursive
 
+install-dvi-am:
+
 install-exec-am:
 
 install-html: install-html-recursive
 
+install-html-am:
+
 install-info: install-info-recursive
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-recursive
 
+install-pdf-am:
+
 install-ps: install-ps-recursive
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-recursive
@@ -738,8 +796,11 @@ uninstall-am:
 examples: ${EXTRA_PROGRAMS}
 
 # for compilation of new examples
-%:%.C 
-	$(CXX) $(CXXFLAGS) $(OPTFLAGS) ${INCLUDES} $(AM_CPPFLAGS) $(LDADD) $*.C -o $@
+%:%.C
+	$(CXX) $(CXXFLAGS) $(AM_CXXFLAGS) $(OPTFLAGS) ${INCLUDES} $(AM_CPPFLAGS) $*.C -o $@ $(LDFLAGS) $(LDADD) $(LOADLIBES) $(top_srcdir)/linbox/.libs/liblinbox.a
+
+%:%.cpp
+	$(CXX)  $(CXXFLAGS) $(AM_CXXFLAGS) $(OPTFLAGS) ${INCLUDES} $(AM_CPPFLAGS) $*.cpp -o $@ $(LDFLAGS) $(LDADD) $(LOADLIBES) $(top_srcdir)/linbox/.libs/liblinbox.a
 # 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/Matio.h b/examples/Matio.h
deleted file mode 100644
index 0380cec..0000000
--- a/examples/Matio.h
+++ /dev/null
@@ -1,199 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-// Reading and writing matrices over double
-
-// Reading a matrice from a (eventually zipped) file
-/* double * read_dbl(char * mat_file,int* tni,int* tnj) { */
-/*   char *UT, * File_Name; */
-/*   int is_gzipped = 0; */
-/*   size_t s = strlen(mat_file); */
-/*   double* X; */
-/*   if ((mat_file[--s] == 'z') &&  */
-/*       (mat_file[--s] == 'g') &&  */
-/*       (mat_file[--s] == '.')) { */
-/*     is_gzipped = 1; */
-/*     File_Name = "/tmp/bbXXXXXX_"; */
-/*     mkstemp(File_Name); */
-/*     UT = new char[s+34+strlen(File_Name)]; */
-/*     sprintf(UT,"gunzip -c %s > %s", mat_file, File_Name); */
-/*     system(UT); */
-/*     sprintf(UT,"\\rm %s", File_Name); */
-/*   } else */
-/*     File_Name = mat_file; */
-  
-/*   FILE* FileDes = fopen(File_Name, "r"); */
-/*   if (FileDes != NULL) { */
-/*     char * tmp = new char[200];// usigned long tni, tnj; */
-/*     fscanf(FileDes,"%d %d %s\n",tni, tnj, &tmp) ; */
-/*     int n=*tni; */
-/*     int p=*tnj; */
-/*     X = new double[n*p]; */
-/*     for (int i=0;i<n*p;++i) */
-/*       X[i] = (double) 0; */
-/*     long i,j; long val; */
-/*     fscanf(FileDes,"%ld %ld %ld\n",&i, &j, &val) ; */
-/*     while(i && j) { */
-/*       X[p*(i-1)+j-1] = (double) val; */
-/*       fscanf(FileDes,"%ld %ld %ld\n",&i, &j, &val) ; */
-/*     } */
-/*   } */
-  
-/*   fclose(FileDes); */
-/*   if (is_gzipped) system(UT);         */
-/*   return X; */
-/* } */
-
-/* // Displays a matrix  */
-/* std::ostream& write_dbl(std::ostream& c,  */
-/* 		   double* E, */
-/* 		   int n, int m, int id){ */
-  
-/*   for (int i = 0; i<n;++i){ */
-/*     for (int j=0; j<m;++j) */
-/*       c << *(E+j+id*i) << " "; */
-/*     c << std::endl; */
-/*   } */
-/*   return c << std::endl; */
-/* } */
-
-// Reading and writing matrices over field
-
-// Reading a matrice from a (eventually zipped) file
-template<class Field>
-typename Field::Element * read_field(const Field& F,char * mat_file,int* tni,int* tnj)
-{
-  char *UT, *File_Name;
-  int is_gzipped = 0;
-  size_t s = strlen(mat_file);
-  typename Field::Element zero;
-  F.init(zero,0);
-  typename Field::Element * X;
-  if ((mat_file[--s] == 'z') && 
-      (mat_file[--s] == 'g') && 
-      (mat_file[--s] == '.')) {
-    is_gzipped = 1;
-    File_Name = "/tmp/bbXXXXXX_";
-    mkstemp(File_Name);
-    UT = new char[s+34+strlen(File_Name)];
-    sprintf(UT,"gunzip -c %s > %s", mat_file, File_Name);
-    system(UT);
-    sprintf(UT,"\\rm %s", File_Name);
-  } else
-    File_Name = mat_file;
-  FILE* FileDes = fopen(File_Name, "r");
-  if (FileDes != NULL) {
-    char * tmp = new char[200];// usigned long tni, tnj;
-    fscanf(FileDes,"%d %d %s\n",tni, tnj, &tmp) ;
-    int n=*tni;
-    int p=*tnj;
-    X = new typename Field::Element[n*p];
-    for (int i=0;i<n*p;++i)
-      X[i] = zero;
-    long i,j; long val;
-    fscanf(FileDes,"%ld %ld %ld\n",&i, &j, &val) ;
-    while(i && j) {
-      F.init(X[p*(i-1)+j-1],val);
-      fscanf(FileDes,"%ld %ld %ld\n",&i, &j, &val) ;
-    }
-  }
-  
-  fclose(FileDes);
-  if (is_gzipped) system(UT);        
-  return X;
-}
-template<class Field>
-void read_field4(const Field& F,char * mat_file,int* tni,int* tnj,
-		 typename Field::Element *& NW,typename Field::Element *& NE, 
-		 typename Field::Element *& SW,typename Field::Element *& SE)
-{
-  char *UT, *File_Name;
-  int is_gzipped = 0;
-  size_t s = strlen(mat_file);
-  typename Field::Element zero;
-  F.init(zero,0);
-  typename Field::Element * X;
-  if ((mat_file[--s] == 'z') && 
-      (mat_file[--s] == 'g') && 
-      (mat_file[--s] == '.')) {
-    is_gzipped = 1;
-    File_Name = "/tmp/bbXXXXXX_";
-    mkstemp(File_Name);
-    UT = new char[s+34+strlen(File_Name)];
-    sprintf(UT,"gunzip -c %s > %s", mat_file, File_Name);
-    system(UT);
-    sprintf(UT,"\\rm %s", File_Name);
-  } else
-    File_Name = mat_file;
-  FILE* FileDes = fopen(File_Name, "r");
-  if (FileDes != NULL) {
-    char * tmp = new char[200];// usigned long tni, tnj;
-    fscanf(FileDes,"%d %d %s\n",tni, tnj, &tmp) ;
-    int n=*tni;
-    int p=*tnj;
-    int no2= n>>1;
-    int po2 = p>>1;
-    NW = new typename Field::Element[no2*po2];
-    NE = new typename Field::Element[no2*(p-po2)];
-    SW = new typename Field::Element[(n-no2)*po2];
-    SE = new typename Field::Element[(n-no2)*(p-po2)];
-    
-    for (int i=0;i<no2*po2;++i)
-      NW[i] = zero;
-    for (int i=0;i<no2*(p-po2);++i)
-      NE[i] = zero;
-    for (int i=0;i<(n-no2)*po2;++i)
-      SW[i] = zero;
-    for (int i=0;i<(n-no2)*(p-po2);++i)
-      SE[i] = zero;
-    long i,j; long val;
-    fscanf(FileDes,"%ld %ld %ld\n",&i, &j, &val) ;
-    while(i && j) {
-      if (i<=no2){
-	if (j<=po2){
-	  F.init(NW[po2*(i-1)+j-1],val);
-	  fscanf(FileDes,"%ld %ld %ld\n",&i, &j, &val) ;
-	}
-	else{
-	  F.init(NE[po2*(i-1)+j-1-po2],val);
-	  fscanf(FileDes,"%ld %ld %ld\n",&i, &j, &val) ;
-	}
-      }
-      else{
-	if (j<=po2){
-	  F.init(SW[(p-po2)*(i-1-no2)+j-1],val);
-	  fscanf(FileDes,"%ld %ld %ld\n",&i, &j, &val) ;
-	}
-	else{
-	  F.init(SE[(p-po2)*(i-1-no2)+j-1-po2],val);
-	  fscanf(FileDes,"%ld %ld %ld\n",&i, &j, &val) ;
-	}
-      }
-    }
-    //  *A1 = NW;
-    //	*A2 = NE;
-    //	*A3 = SW;
-    //	*A4 = SE;
-
-  }
-  
-  fclose(FileDes);
-  if (is_gzipped) system(UT);        
-}
-
-// Displays a matrix
-template<class Field>
-std::ostream& write_field(const Field& F,std::ostream& c, 
-		     const typename Field::Element* E,
-		     int n, int m, int id){
-  
-  double tmp;
-  //#if DEBUG
-  for (int i = 0; i<n;++i){
-    for (int j=0; j<m;++j){
-      F.convert(tmp,*(E+j+id*i));
-      c << tmp << " ";}
-    c << std::endl;
-  }
-  return c << std::endl;
-  //#endif
-}
diff --git a/examples/charpoly.C b/examples/charpoly.C
index 2fa8b05..e6d088f 100644
--- a/examples/charpoly.C
+++ b/examples/charpoly.C
@@ -1,15 +1,36 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/** \file examples/charpoly.C
-\brief Characteristic polynomial of matrix over Z or Zp.
- \ingroup examples
-*/
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/*
+ * examples/charpoly.C
+ *
+ * Copyright (C) 2005, 2010 D. Saunders, C. Pernet, J-G. Dumas
+ *
+ * This file is part of LinBox.
+ *
+ *   LinBox is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU Lesser General Public License as
+ *   published by the Free Software Foundation, either version 2 of
+ *   the License, or (at your option) any later version.
+ *
+ *   LinBox is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Lesser General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Lesser General Public
+ *   License along with LinBox.  If not, see
+ *   <http://www.gnu.org/licenses/>.
+ */
 
-// Warning : example under development.
-// integer computation must be completed
+/** \file examples/charpoly.C
+ * @example  examples/charpoly.C
+  \brief Characteristic polynomial of matrix over Z or Zp.
+  \ingroup examples
+  */
 #include <iostream>
 #include <iomanip>
-#include "Matio.h"
 
+#include "linbox/util/timer.h"
 #include "linbox/field/modular-double.h"
 #include "linbox/field/unparametric.h"
 #include "linbox/blackbox/sparse.h"
@@ -18,11 +39,10 @@ using namespace std;
 
 #include "linbox/solutions/charpoly.h"
 #include "linbox/ring/givaro-polynomial.h"
-#include "linbox/element/givaro-polynomial.h"
 using namespace LinBox;
 
 template <class Field, class Polynomial>
-std::ostream& printPolynomial (std::ostream& out, const Field &F, const Polynomial &v) 
+std::ostream& printPolynomial (std::ostream& out, const Field &F, const Polynomial &v)
 {
 	for (int i = v.size () - 1; i >= 0; i--) {
 		F.write (out, v[i]);
@@ -32,47 +52,52 @@ std::ostream& printPolynomial (std::ostream& out, const Field &F, const Polynomi
 	return out;
 }
 template <class Field, class Polynomial>
-std::ostream& prettyprintIntegerPolynomial (std::ostream& out, const Field &F, const Polynomial &v) 
+std::ostream& prettyprintIntegerPolynomial (std::ostream& out, const Field &F, const Polynomial &v)
 {
-  size_t n = v.size()-1;
-  if (n == 0) {
-    F.write(out, v[0]);
-  } else {
-    if(v[n] != 0) {
-      if (v[n] != 1) F.write(out, v[n]) << '*';
-      out << 'X';
-      if (n > 1) out << '^' << n;
-      for (int i = n - 1; i > 0; i--) {
-	  if (v[i] != 0) {
-	    if (v[i] >0) out << " + ";
-	    if (v[i] != 1) F.write (out, v[i]) << '*';
-	    out << 'X';
-	    if (i > 1) out << '^' << i;
-	  }
-      }
-      if (v[0] != 0) {
-	if (v[0] >0) out << " + ";
-	F.write(out, v[0]);
-      }
-    }
-  }
-  return out;
+	size_t n = v.size()-1;
+	if (n == 0) {
+		F.write(out, v[0]);
+	}
+	else {
+		if(v[n] != 0) {
+			if (v[n] != 1) F.write(out, v[n]) << '*';
+			out << 'X';
+			if (n > 1) out << '^' << n;
+			for (int i = n - 1; i > 0; i--) {
+				if (v[i] != 0) {
+					if (v[i] >0) out << " + ";
+					if (v[i] != 1) F.write (out, v[i]) << '*';
+					out << 'X';
+					if (i > 1) out << '^' << i;
+				}
+			}
+			if (v[0] != 0) {
+				if (v[0] >0) out << " + ";
+				F.write(out, v[0]);
+			}
+		}
+	}
+	return out;
 }
 template <class Field, class Factors, class Exponents>
-std::ostream& printFactorization (std::ostream& out, const Field &F, const Factors &f, const Exponents& exp) 
+std::ostream& printFactorization (std::ostream& out, const Field &F, const Factors &f, const Exponents& exp)
 {
-  typename Factors::const_iterator itf = f.begin();
-  typename Exponents::const_iterator ite = exp.begin();
-  for ( ; itf != f.end(); ++itf, ++ite) {
-    prettyprintIntegerPolynomial(out << '(', F, *(*itf)) << ')';
-    if (*ite > 1) out << '^' << *ite;
-    out << endl;
-  }
-  return out;
+	typename Factors::const_iterator itf = f.begin();
+	typename Exponents::const_iterator ite = exp.begin();
+	for ( ; itf != f.end(); ++itf, ++ite) {
+		prettyprintIntegerPolynomial(out << '(', F, *(*itf)) << ')';
+		if (*ite > 1) out << '^' << *ite;
+		out << endl;
+	}
+	return out;
 }
 
 int main (int argc, char **argv)
 {
+	commentator.setMaxDetailLevel (2);
+	commentator.setMaxDepth (2);
+	commentator.setReportStream (std::cerr);
+
 	cout<<setprecision(8);
 	cerr<<setprecision(8);
 	if (argc < 2 || argc > 3) {
@@ -84,34 +109,45 @@ int main (int argc, char **argv)
 	if (!input) { cerr << "Error opening matrix file " << argv[1] << endl; return -1; }
 
 	if (argc == 2) {
-		
+
 		PID_integer ZZ;
 		DenseMatrix<PID_integer > A (ZZ);
 		A.read (input);
-		typedef GivPolynomialRing<PID_integer,Dense> IntPolRing;
+		typedef GivPolynomialRing<PID_integer,::Givaro::Dense> IntPolRing;
 		IntPolRing::Element c_A;
-		charpoly (c_A, A);
 
+		Timer tim; tim.clear();tim.start();
+		charpoly (c_A, A, Method::Blackbox());
+		tim.stop();
 
 		cout << "Characteristic Polynomial is ";
-		printPolynomial (cout, ZZ, c_A) << endl;
+		//printPolynomial (cout, ZZ, c_A) << endl;
+		cout << tim << endl;
 
 #ifdef __LINBOX_HAVE_NTL
 		cout << "Do you want a factorization (y/n) ? ";
 		char tmp;
 		cin >> tmp;
 		if (tmp == 'y' || tmp == 'Y') {
-                  commentator.start("Integer Polynomial factorization by NTL", "NTLfac");
-		  vector<IntPolRing::Element*> intFactors;    
-		  vector<unsigned long> exp;
-		  IntPolRing IPD(ZZ);
-		  IPD.factor (intFactors, exp, c_A);
-                  commentator.stop("done", NULL, "NTLfac");
-		  printFactorization(cout << intFactors.size() << " integer polynomial factors:" << endl, ZZ, intFactors, exp) << endl;
+			commentator.start("Integer Polynomial factorization by NTL", "NTLfac");
+			vector<IntPolRing::Element*> intFactors;
+			vector<unsigned long> exp;
+			IntPolRing IPD(ZZ);
+			tim.start();
+			IPD.factor (intFactors, exp, c_A);
+			tim.stop();
+			commentator.stop("done", NULL, "NTLfac");
+			printFactorization(cout << intFactors.size() << " integer polynomial factors:" << endl, ZZ, intFactors, exp) << endl;
+			vector<IntPolRing::Element*>::const_iterator itf = intFactors.begin();
+			for ( ; itf != intFactors.end(); ++itf)
+				delete *itf;
+
+			cout << tim << endl;
+
 		}
 #endif
 	}
-	if (argc == 3) { 
+	if (argc == 3) {
 
 		typedef Modular<double> Field;
 		double q = atof(argv[2]);
@@ -119,10 +155,14 @@ int main (int argc, char **argv)
 		DenseMatrix<Field> B (F);
 		B.read (input);
 		cout << "B is " << B.rowdim() << " by " << B.coldim() << endl;
-		GivPolynomial<Field::Element> c_B;
+		GivPolynomialRing<Field,::Givaro::Dense>::Element c_B;
+		Timer tim; tim.clear();tim.start();
 		charpoly (c_B, B);
+		tim.stop();
+
 		cout << "Characteristic Polynomial is ";
-		printPolynomial (cout, F, c_B) << endl;
+		//printPolynomial (cout, F, c_B) << endl;
+		cout << tim << endl;
 	}
 
 	return 0;
diff --git a/examples/checksolve.C b/examples/checksolve.C
index 55f6a48..a683ccf 100644
--- a/examples/checksolve.C
+++ b/examples/checksolve.C
@@ -1,8 +1,31 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/**\file examples/solve.C
-\brief Solving of sparse matrix over Z or Zp.
-\ingroup examples
-*/
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/*
+ * examples/checksolve.C
+ *
+ * Copyright (C) 2007 C. Pernet
+ *
+ * This file is part of LinBox.
+ *
+ *   LinBox is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU Lesser General Public License as
+ *   published by the Free Software Foundation, either version 2 of
+ *   the License, or (at your option) any later version.
+ *
+ *   LinBox is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Lesser General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Lesser General Public
+ *   License along with LinBox.  If not, see
+ *   <http://www.gnu.org/licenses/>.
+ */
+/**\file examples/checksolve.C
+ * @example  examples/checksolve.C
+  \brief Solving of sparse matrix over Z or Zp.
+  \ingroup examples
+  */
 //#include "linbox-config.h"
 #include <iostream>
 
@@ -15,66 +38,58 @@
 using namespace LinBox;
 using namespace std;
 
-template<class T, template <class ,class> class Container, template <class> class Alloc>
-std::ostream& operator<< (std::ostream& o, const Container<T, Alloc<T> >& C) {
-		for(typename Container<T, Alloc<T> >::const_iterator refs =  C.begin();
-	    refs != C.end() ;
-	    ++refs )
-		o << (*refs) << " " ;
-	return o;
-}
 
 int main (int argc, char **argv)
 {
 
-// 	commentator.setMaxDetailLevel (-1);
-// 	commentator.setMaxDepth (-1);
-// 	commentator.setReportStream (std::cerr);
-
-
-    if (argc < 2 || argc > 4) {
-        cerr << "Usage: checksolve <matrix-file-in-supported-format> <dense-vector-file> <p>" << endl;
-        return 0;
-    }
-
-    
-    std::ifstream input (argv[1]);
-    if (!input) { cerr << "Error opening matrix file " << argv[1] << endl; return -1; }
-
-    std::ifstream invect(argv[2]);
-    if (!input) { cerr << "Error opening vector file " << argv[2] << endl; return -1; }
-
-    
-    typedef Modular<double> Field;
-    double q = atof(argv[3]);
-    Field F(q);
-    MatrixStream< Field > ms ( F, input );
-    BlasBlackbox<Field> A (ms); // A.write(std::cout);
-    cout << "A is " << A.rowdim() << " by " << A.coldim() << endl;
-    
-    std::vector<Field::Element> X( A.coldim()),B(A.rowdim());
-	
-    for(std::vector<Field::Element>::iterator it=B.begin();
+	// 	commentator.setMaxDetailLevel (-1);
+	// 	commentator.setMaxDepth (-1);
+	// 	commentator.setReportStream (std::cerr);
+
+
+	if (argc < 2 || argc > 4) {
+		cerr << "Usage: checksolve <matrix-file-in-supported-format> <dense-vector-file> <p>" << endl;
+		return 0;
+	}
+
+
+	std::ifstream input (argv[1]);
+	if (!input) { cerr << "Error opening matrix file " << argv[1] << endl; return -1; }
+
+	std::ifstream invect(argv[2]);
+	if (!input) { cerr << "Error opening vector file " << argv[2] << endl; return -1; }
+
+
+	typedef Modular<double> Field;
+	double q = atof(argv[3]);
+	Field F(q);
+	MatrixStream< Field > ms ( F, input );
+	BlasBlackbox<Field> A (ms); // A.write(std::cout);
+	cout << "A is " << A.rowdim() << " by " << A.coldim() << endl;
+
+	std::vector<Field::Element> X( A.coldim()),B(A.rowdim());
+
+	for(std::vector<Field::Element>::iterator it=B.begin();
 	    it != B.end(); ++it)
-	    invect >> *it;
-    
-    std::cout << "B is [ "<<B<< "]" << std::endl;
-    
-    solve (X, A, B, Method::BlasElimination());
-    
-    std::cout << "(BlasElimination) Solution is [ "<<X<< "]" << std::endl;		
-    std::vector<Field::Element> r(A.rowdim());
-    BlasMatrixDomain<Field> BMD(F);
-    BMD.mul(r, static_cast<BlasMatrix<Field::Element>& >(A), X);
-    //A.apply (r,X);
-    VectorDomain<Field> VD(F);
-    if (VD.areEqual (r,B))
-	    std::cout<<"CHECK"<<endl;
-    else{
-	    std::cout<<"FAIL"<<endl;
-	    cout<<"r = "<<r<<endl;
-	    cout<<"B = "<<B<<endl;
-    }
-
-    return 0;
+		invect >> *it;
+
+	std::cout << "B is [ "<<B<< "]" << std::endl;
+
+	solve (X, A, B, Method::BlasElimination());
+
+	std::cout << "(BlasElimination) Solution is [ "<<X<< "]" << std::endl;
+	std::vector<Field::Element> r(A.rowdim());
+	BlasMatrixDomain<Field> BMD(F);
+	BMD.mul(r, static_cast<BlasMatrix<Field::Element>& >(A), X);
+	//A.apply (r,X);
+	VectorDomain<Field> VD(F);
+	if (VD.areEqual (r,B))
+		std::cout<<"CHECK"<<endl;
+	else{
+		std::cout<<"FAIL"<<endl;
+		cout<<"r = "<<r<<endl;
+		cout<<"B = "<<B<<endl;
+	}
+
+	return 0;
 }
diff --git a/examples/det.C b/examples/det.C
index 7200324..b94efac 100644
--- a/examples/det.C
+++ b/examples/det.C
@@ -1,10 +1,32 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/**  * Time-stamp: <09 Mar 07 17:05:49 Jean-Guillaume.Dumas at imag.fr>
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/*
+ * examples/det.C
+ *
+ * Copyright (C) 2005, 2010 D. Saunders,  J-G. Dumas
+ *
+ * This file is part of LinBox.
+ *
+ *   LinBox is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU Lesser General Public License as
+ *   published by the Free Software Foundation, either version 2 of
+ *   the License, or (at your option) any later version.
+ *
+ *   LinBox is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Lesser General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Lesser General Public
+ *   License along with LinBox.  If not, see
+ *   <http://www.gnu.org/licenses/>.
  */
+
 /**\file examples/det.C examples/det.C
-\brief Determinant of sparse matrix over Z or Zp.
-\ingroup examples
-*/
+ * @example  examples/det.C
+  \brief Determinant of sparse matrix over Z or Zp.
+  \ingroup examples
+  */
 
 //#include "linbox-config.h"
 #include <iostream>
@@ -20,10 +42,9 @@ using namespace std;
 
 int main (int argc, char **argv)
 {
-    commentator.setMaxDetailLevel (-1);
-    commentator.setMaxDepth (-1);
-    commentator.setReportStream (std::cerr);
-
+	commentator.setMaxDetailLevel (-1);
+	commentator.setMaxDepth (-1);
+	commentator.setReportStream (std::cerr);
 
 	if (argc <= 1 || argc > 3) {
 		cerr << "Usage: det <matrix-file-in-supported-format> [<p>]" << endl;
@@ -31,17 +52,17 @@ int main (int argc, char **argv)
 	}
 
 	if (argc == 2 ) {
-	
-		// For a small integer matrix test, do "det data/mat2.txt". 
+
+		// For a small integer matrix test, do "det data/mat2S".
 		// It is a 2 by 2 matrix with determinant = -2.
 
-		typedef PID_integer Integers;		
+		typedef PID_integer Integers;
 		Integers ZZ;
 
 		ifstream input (argv[1]);
-		if (!input) 
-		{ cerr << "Error opening matrix file " << argv[1] << endl; 
-			return -1; 
+		if (!input)
+		{ cerr << "Error opening matrix file " << argv[1] << endl;
+			return -1;
 		}
 		MatrixStream< Integers> ms ( ZZ, input );
 		BlasBlackbox<Integers> A(ms);
@@ -53,16 +74,16 @@ int main (int argc, char **argv)
 		cout << "Determinant is ";
 		ZZ.write(cout, det_A) << endl;
 	}
-	if (argc == 3) { 
+	if (argc == 3) {
 
 		typedef Modular<double> Field;
 		double q = atof(argv[2]);
 		Field F(q);
 
 		ifstream input (argv[1]);
-		if (!input) 
-		{ cerr << "Error opening matrix file " << argv[1] << endl; 
-		  return -1; 
+		if (!input)
+		{ cerr << "Error opening matrix file " << argv[1] << endl;
+			return -1;
 		}
 		MatrixStream< Field > ms ( F, input );
 		SparseMatrix<Field> B (ms);
@@ -76,4 +97,4 @@ int main (int argc, char **argv)
 	}
 
 	return 0;
-} 
+}
diff --git a/examples/dot-product.C b/examples/dot-product.C
index 638903f..faf1866 100644
--- a/examples/dot-product.C
+++ b/examples/dot-product.C
@@ -1,7 +1,32 @@
+/* -*- 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++; style: linux -*- */
+/*
+ * examples/dot-product.C
+ *
+ * Copyright (C) 2002, 2010 Bradford Hovinen <hovinen at cis.udel.edu>
+ *
+ * This file is part of LinBox.
+ *
+ *   LinBox is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU Lesser General Public License as
+ *   published by the Free Software Foundation, either version 2 of
+ *   the License, or (at your option) any later version.
+ *
+ *   LinBox is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Lesser General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Lesser General Public
+ *   License along with LinBox.  If not, see
+ *   <http://www.gnu.org/licenses/>.
+ */
+
 /** \file examples/dot-product.C
-\brief Timings on dot products of random vectors.
-\ingroup examples
+ * @example  examples/dot-product.C
+ * \brief Timings on dot products of random vectors.
+ * \ingroup examples
  *
  * \author Bradford Hovinen <hovinen at cis.udel.edu>
  *
@@ -12,8 +37,6 @@
  * required time.
  */
 
-// Copyright (C) 2002 Bradford Hovinen
-// See COPYING for license information.
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -25,7 +48,7 @@
 
 using namespace LinBox;
 
-typedef Modular<uint32> Field;
+typedef Modular<uint32_t> Field;
 
 // Constants: we are working with an n x n matrix over GF(q)
 const int n = 10000000;
diff --git a/examples/doubledet.C b/examples/doubledet.C
index af32eb0..6e65a37 100644
--- a/examples/doubledet.C
+++ b/examples/doubledet.C
@@ -1,4 +1,34 @@
 /* -*- 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
+
+/*
+ * examples/doubledet.C
+ *
+ * Copyright (C) 2008, 2010 C. Pernet
+ *
+ * This file is part of LinBox.
+ *
+ *   LinBox is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU Lesser General Public License as
+ *   published by the Free Software Foundation, either version 2 of
+ *   the License, or (at your option) any later version.
+ *
+ *   LinBox is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Lesser General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Lesser General Public
+ *   License along with LinBox.  If not, see
+ *   <http://www.gnu.org/licenses/>.
+ */
+
+/*! @file examples/doubledet.C
+ * @example  examples/doubledet.C
+ * @ingroup examples
+ * @brief computes doubleDet.
+ */
+
 #include <iostream>
 
 #include "linbox/linbox-config.h"
@@ -19,12 +49,12 @@ int main (int argc, char **argv)
 	//     commentator.setReportStream (std::cerr);
 
 	PID_integer ZZ;
-    
+
 	ifstream input (argv[1]);
-	if (!input) 
-		{ cerr << "Error opening matrix file " << argv[1] << endl; 
-			return -1; 
-		}
+	if (!input)
+	{ cerr << "Error opening matrix file " << argv[1] << endl;
+		return -1;
+	}
 	MatrixStream <PID_integer> ms (ZZ, input);
 	BlasBlackbox <PID_integer> A (ms);
 	cout << "Matrix is " << A.rowdim() << " by " << A.coldim() << endl;
@@ -33,7 +63,7 @@ int main (int argc, char **argv)
 		cerr<<"Wrong dimensions: A must be (n+1) x n"<<endl;
 		exit (-1);
 	}
- 
+
 	integer det1, det2;
 	Timer tim; tim.clear();
 	tim.start();
@@ -44,7 +74,7 @@ int main (int argc, char **argv)
 	//doubleDet (det1, det2, A, true);
 	doubleDet (det1, det2, A, proof);
 	tim.stop();
-     
+
 	// Check solution
 	size_t n = A.coldim();
 	BlasBlackbox<PID_integer> B (ZZ, n, n);
@@ -58,10 +88,20 @@ int main (int argc, char **argv)
 	det (db, B);
 	for (size_t j=0; j<n; ++j)
 		B.setEntry(n-1,j,A.getEntry(n,j));
+	Timer tim2;
+	tim2.clear();
+	tim2.start();
 	det(dc, B);
- 
+	tim2.stop();
+
 	if ((det1 != db) || (det2 != dc))
 		std::cerr<<"Check FAIL"<<endl;
 
-	cerr << "Double Det: "<<tim.usertime() << "s" << endl;
+	cout<< "Det 1 = " << det1 << endl;
+	cout<< "Det 2 = " << det2 << endl;
+
+	cerr << "Double Det: "     << tim.usertime() << "s" << endl;
+	cerr << "Each single Det: "<<tim2.usertime() << "s" << endl;
+
+	return 0 ;
 }
diff --git a/examples/echelon.C b/examples/echelon.C
index 77b2908..645091d 100644
--- a/examples/echelon.C
+++ b/examples/echelon.C
@@ -1,8 +1,33 @@
 /* -*- 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
+
+/*
+ * examples/echelon.C
+ *
+ * Copyright (C) 2007, 2010 C. Pernet
+ *
+ * This file is part of LinBox.
+ *
+ *   LinBox is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU Lesser General Public License as
+ *   published by the Free Software Foundation, either version 2 of
+ *   the License, or (at your option) any later version.
+ *
+ *   LinBox is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Lesser General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Lesser General Public
+ *   License along with LinBox.  If not, see
+ *   <http://www.gnu.org/licenses/>.
+ */
+
 /** \file examples/echelon.C
-\brief Echelon form of matrix over  Zp.
- \ingroup examples
-*/
+ * @example examples/echelon.C
+  \brief Echelon form of matrix over  Zp.
+  \ingroup examples
+  */
 
 #include <iostream>
 
@@ -21,7 +46,7 @@ int main (int argc, char **argv)
 	}
 	ifstream input (argv[1]);
 	if (!input) { cerr << "Error opening matrix file " << argv[1] << endl; return -1; }
-	
+
 	typedef Modular<double> Field;
 	double q = atof(argv[2]);
 	Field F(q);
diff --git a/examples/examples.doxy b/examples/examples.doxy
new file mode 100644
index 0000000..619009d
--- /dev/null
+++ b/examples/examples.doxy
@@ -0,0 +1,15 @@
+//Copyright (C) 2005 David Saunders, part of LinBox. GNU LGPL, see COPYING.
+
+/** \ingroup linbox
+  \defgroup examples examples
+
+  \brief Ilustrations of the LinBox library in use.
+
+  Some of these examples serve a particular purpose such as computing
+  a linear algebra function on an integer matrix stored in a file.
+  Some were written expressly to illustrate writing code that uses LinBox.
+ */
+
+
+
+// vim:syn=doxygen
diff --git a/examples/fields/Makefile.am b/examples/fields/Makefile.am
index 0ca41e5..4da83e7 100644
--- a/examples/fields/Makefile.am
+++ b/examples/fields/Makefile.am
@@ -1,4 +1,7 @@
-INCLUDES=-I$(top_srcdir)
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+AM_CPPFLAGS=-I$(top_srcdir)
 
 EXTRA_PROGRAMS =		\
 	ex-fields 		\
@@ -6,10 +9,12 @@ EXTRA_PROGRAMS =		\
 	modular-int
 
 #AM_CPPFLAGS=$(GMP_CFLAGS) $(NTL_CFLAGS) -DEXAMPLE_DATADIR=\"$(srcdir)/data\"
-#LDADD = $(top_builddir)/linbox/liblinbox.a $(GMP_LIBS) $(NTL_LIBS) 
-AM_CPPFLAGS= -DLinBoxSrcOnly $(GMP_CFLAGS) $(NTL_CFLAGS) -DEXAMPLE_DATADIR=\"$(srcdir)/data\"
+#LDADD = $(top_builddir)/linbox/liblinbox.a $(GMP_LIBS) $(NTL_LIBS)
+AM_CXXFLAGS = @DEFAULT_CFLAGS@ -DLinBoxSrcOnly
+AM_CPPFLAGS+= -DLinBoxSrcOnly $(GMP_CFLAGS) $(NTL_CFLAGS) \
+			 -DEXAMPLE_DATADIR=\"$(srcdir)/data\"
 LDADD = $(GMP_LIBS) $(NTL_LIBS) -lgivaro -lclapack -lcblas -latlas
 
-ex_fields_SOURCES           = ex-fields.C 
+ex_fields_SOURCES           = ex-fields.C
 ex_fields_archetype_SOURCES = ex-fields-archetype.C
 modular_int_SOURCES = modular-int.C
diff --git a/examples/fields/Makefile.in b/examples/fields/Makefile.in
index 333db83..23f6e32 100644
--- a/examples/fields/Makefile.in
+++ b/examples/fields/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -37,19 +38,26 @@ subdir = examples/fields
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
-	$(top_srcdir)/macros/blas-check.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
 	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
 	$(top_srcdir)/macros/givaro-check.m4 \
 	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
 	$(top_srcdir)/macros/lidia-check.m4 \
 	$(top_srcdir)/macros/linbox-doc.m4 \
 	$(top_srcdir)/macros/linbox-misc.m4 \
 	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
 	$(top_srcdir)/macros/maple-check.m4 \
 	$(top_srcdir)/macros/ntl-check.m4 \
 	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -96,18 +104,21 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
 CC = @CC@
+CCNAM = @CCNAM@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
 DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -115,19 +126,24 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
 GIVARO_CFLAGS = @GIVARO_CFLAGS@
 GIVARO_LIBS = @GIVARO_LIBS@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
 GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
@@ -135,41 +151,52 @@ LIBTOOL = @LIBTOOL@
 LIDIA_CFLAGS = @LIDIA_CFLAGS@
 LIDIA_LIBS = @LIDIA_LIBS@
 LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MAPLE_CFLAGS = @MAPLE_CFLAGS@
 MAPLE_HOME = @MAPLE_HOME@
 MAPLE_LIBS = @MAPLE_LIBS@
 MAPLE_VERSION = @MAPLE_VERSION@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
 NTL_CFLAGS = @NTL_CFLAGS@
 NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RM = @RM@
 SACLIB_CFLAGS = @SACLIB_CFLAGS@
 SACLIB_LIBS = @SACLIB_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+TESTS_CFLAGS = @TESTS_CFLAGS@
 VERSION = @VERSION@
+WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -210,15 +237,21 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-INCLUDES = -I$(top_srcdir)
+
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+AM_CPPFLAGS = -I$(top_srcdir) -DLinBoxSrcOnly $(GMP_CFLAGS) \
+	$(NTL_CFLAGS) -DEXAMPLE_DATADIR=\"$(srcdir)/data\"
 
 #AM_CPPFLAGS=$(GMP_CFLAGS) $(NTL_CFLAGS) -DEXAMPLE_DATADIR=\"$(srcdir)/data\"
-#LDADD = $(top_builddir)/linbox/liblinbox.a $(GMP_LIBS) $(NTL_LIBS) 
-AM_CPPFLAGS = -DLinBoxSrcOnly $(GMP_CFLAGS) $(NTL_CFLAGS) -DEXAMPLE_DATADIR=\"$(srcdir)/data\"
+#LDADD = $(top_builddir)/linbox/liblinbox.a $(GMP_LIBS) $(NTL_LIBS)
+AM_CXXFLAGS = @DEFAULT_CFLAGS@ -DLinBoxSrcOnly
 LDADD = $(GMP_LIBS) $(NTL_LIBS) -lgivaro -lclapack -lcblas -latlas
-ex_fields_SOURCES = ex-fields.C 
+ex_fields_SOURCES = ex-fields.C
 ex_fields_archetype_SOURCES = ex-fields-archetype.C
 modular_int_SOURCES = modular-int.C
 all: all-am
@@ -229,8 +262,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
 	      exit 1;; \
 	  esac; \
 	done; \
@@ -290,7 +323,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
@@ -401,6 +434,8 @@ dvi-am:
 
 html: html-am
 
+html-am:
+
 info: info-am
 
 info-am:
@@ -409,18 +444,28 @@ install-data-am:
 
 install-dvi: install-dvi-am
 
+install-dvi-am:
+
 install-exec-am:
 
 install-html: install-html-am
 
+install-html-am:
+
 install-info: install-info-am
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-am
 
+install-pdf-am:
+
 install-ps: install-ps-am
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
diff --git a/examples/fields/ex-fields-archetype.C b/examples/fields/ex-fields-archetype.C
index 323eb1c..da904c8 100644
--- a/examples/fields/ex-fields-archetype.C
+++ b/examples/fields/ex-fields-archetype.C
@@ -1,16 +1,34 @@
-/** \file examples/fields/ex-field-archetype.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
+/*
+ * examples/fields/ex-fields-archetype.C
+ *
+ * Copyright (C) 2002, 2010 G. Villard
+ *
+ * This file is part of LinBox.
+ *
+ *   LinBox is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU Lesser General Public License as
+ *   published by the Free Software Foundation, either version 2 of
+ *   the License, or (at your option) any later version.
+ *
+ *   LinBox is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Lesser General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Lesser General Public
+ *   License along with LinBox.  If not, see
+ *   <http://www.gnu.org/licenses/>.
+ */
+
+/** \file examples/fields/ex-fields-archetype.C
  * \author Gilles Villard
  * \brief On using the field archetype to avoid code bloat.
- * \doc
-  Use of a function compiled with the field archetype but called
-  with two distinct field types.
-  */
-// =========================================================
-// (C) The Linbox Group 1999
-// Examples for using fields 
-// Fri Feb  8 16:25:22 MET 2002 
-// Wed Apr 17 17:37:12 MEST 2002/ Gilles Villard
-// =========================================================
+ *
+ * Use of a function compiled with the field archetype but called
+ * with two distinct field types.
+ */
 
 // ---------------------------------------------
 #include <stdio.h>
@@ -27,24 +45,24 @@
 #include "linbox/field/archetype.h"
 
 using namespace LinBox;
- 
+
 // ---------------------------------------------
-/*  The template function "fct" reads two elements "a" and "b" of the 
- *  field "K" from the standard input and writes a/b on the standard output */ 
+/*  The template function "fct" reads two elements "a" and "b" of the
+ *  field "K" from the standard input and writes a/b on the standard output */
 
-template <class Field> 
+template <class Field>
 int fct(const Field& K) {
- 
-  typedef typename Field::Element K_elt;
 
-  K_elt a,b,r; 
+	typedef typename Field::Element K_elt;
+
+	K_elt a,b,r;
 
-  K.init(a); K.init(b); K.init(r);
-  K.read(std::cin,a);
-  K.read(std::cin,b);
-  K.div(r,a,b);
-  K.write(std::cout,r) << "\n";
-  return 0;
+	K.init(a); K.init(b); K.init(r);
+	K.read(std::cin,a);
+	K.read(std::cin,b);
+	K.div(r,a,b);
+	K.write(std::cout,r) << "\n";
+	return 0;
 }
 
 // ---------------------------------------------
@@ -52,30 +70,30 @@ int fct(const Field& K) {
 /// no command line args
 int main() {
 
-  /* The field objects "K_o" and "Q_o" are constructed as in previous examples 
-   */ 
+	/* The field objects "K_o" and "Q_o" are constructed as in previous examples
+	*/
 
-  UnparametricField<NTL::RR> Q_o;
-  NTL::RR::SetPrecision(400);
-  NTL::RR::SetOutputPrecision(50);
+	UnparametricField<NTL::RR> Q_o;
+	NTL::RR::SetPrecision(400);
+	NTL::RR::SetOutputPrecision(50);
 
-  UnparametricField<NTL::zz_p> K_o;   
-  NTL::zz_p::init(553);
+	UnparametricField<NTL::zz_p> K_o;
+	NTL::zz_p::init(553);
 
-  /* These field objects "K_o" and "Q_o" of different types can be converted to 
-   * objects Q and K of a unique type "Field_archetype" for instance using 
-   * a constructor: */ 
+	/* These field objects "K_o" and "Q_o" of different types can be converted to
+	 * objects Q and K of a unique type "Field_archetype" for instance using
+	 * a constructor: */
 
 
-  FieldArchetype Q( & Q_o );
-  FieldArchetype K( & K_o );
+	FieldArchetype Q( & Q_o );
+	FieldArchetype K( & K_o );
 
-  /* The template function "fct" is called with two different fields but the 
-   * template is instantiated only once since it is called with a unique 
-   * template parameter "Field_archetype" */
+	/* The template function "fct" is called with two different fields but the
+	 * template is instantiated only once since it is called with a unique
+	 * template parameter "Field_archetype" */
 
-  fct(Q);
-  fct(K);
+	fct(Q);
+	fct(K);
 
-  return 0;
+	return 0;
 };
diff --git a/examples/fields/ex-fields.C b/examples/fields/ex-fields.C
index f825458..03eec7c 100644
--- a/examples/fields/ex-fields.C
+++ b/examples/fields/ex-fields.C
@@ -1,14 +1,32 @@
+/* -*- 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
+/*
+ * examples/fields/ex-fields.C
+ *
+ * Copyright (C) 2001, 2002, 2010 G. Villard
+ *
+ * This file is part of LinBox.
+ *
+ *   LinBox is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU Lesser General Public License as
+ *   published by the Free Software Foundation, either version 2 of
+ *   the License, or (at your option) any later version.
+ *
+ *   LinBox is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Lesser General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Lesser General Public
+ *   License along with LinBox.  If not, see
+ *   <http://www.gnu.org/licenses/>.
+ */
+
 /** \file examples/fields/ex-fields.C
  * \author Gilles Villard
- * \brief Using a template function with two distinct fields. 
+ * \brief Using a template function with two distinct fields.
  */
 
-// =========================================================
-// (C) The Linbox Group 1999   Examples for using fields
-// Thu Sep 27 11:33:58 MEST 2001 / Gilles Villard
-// Fri Feb  8 14:24:31 MET 2002
-// =========================================================
-
 // ---------------------------------------------
 
 #include "linbox/linbox-config.h"
@@ -21,55 +39,57 @@
 
 using namespace LinBox;
 using namespace std;
- 
-/**  The template function "fct" reads two elements "a" and "b" of the 
- *  field "K" from the standard input and writes a/b on the standard output */ 
 
-template <class Field> 
-void divide_ex(const Field&  K) {
- 
-  /* "K" is a field domain (a C++ object) of type "Field" (here the template 
-   *  parameter). The type of the elements of "K" is obtained through 
-   * "Field" by typename Field::Element */
+/**  The template function "fct" reads two elements "a" and "b" of the
+ *  field "K" from the standard input and writes a/b on the standard output */
+
+template <class Field>
+void divide_ex(const Field&  K)
+{
+
+	/* "K" is a field domain (a C++ object) of type "Field" (here the template
+	 *  parameter). The type of the elements of "K" is obtained through
+	 * "Field" by typename Field::Element */
 
-  typedef typename Field::Element K_elt;
+	typedef typename Field::Element K_elt;
 
-  K_elt a,b,r; 
+	K_elt a,b,r;
 
-  K.init(a); K.init(b); K.init(r);
-  cout << "division example: enter two numbers: ";
-  K.read(cin,a);  K.read(cin,b);
-  K.div(r,a,b);
-  K.write( K.write(cout<< "the quotient in ") << " is ", 
-           r) << endl;
+	K.init(a); K.init(b); K.init(r);
+	cout << "division example: enter two numbers: ";
+	K.read(cin,a);  K.read(cin,b);
+	K.div(r,a,b);
+	K.write( K.write(cout<< "the quotient in ") << " is ",
+		 r) << endl;
 
 }
 
 // ---------------------------------------------
 /// no command line args
-int main() {
+int main()
+{
 
-  /* Using the parameterized domain capabilities, several domains 
-   * representing integers modulo may be used simultaneously. */
+	/* Using the parameterized domain capabilities, several domains
+	 * representing integers modulo may be used simultaneously. */
 
-  Modular<uint32> D(3), K(7);
+	Modular<uint32_t> D(3), K(7);
 
-  divide_ex(D);  divide_ex(K);
+	divide_ex(D);  divide_ex(K);
 
-  // NTL arbitrary precision real field
-  // (Could be parameterized by the precision)  
+	// NTL arbitrary precision real field
+	// (Could be parameterized by the precision)
 
-  UnparametricField<NTL::RR> K2;
-  NTL::RR::SetPrecision(500);
-  NTL::RR::SetOutputPrecision(50);
+	UnparametricField<NTL::RR> K2;
+	NTL::RR::SetPrecision(500);
+	NTL::RR::SetOutputPrecision(50);
 
-  // NTL modulo p field 
+	// NTL modulo p field
 
-  //UnparametricField<NTL::zz_p> K2;   
-  //NTL::zz_p::init(553);
+	//UnparametricField<NTL::zz_p> K2;
+	//NTL::zz_p::init(553);
 
-  divide_ex(K2);
+	divide_ex(K2);
 
-  return 0;
+	return 0;
 };
 
diff --git a/examples/fields/modular-int.C b/examples/fields/modular-int.C
index 2c4cf53..6941e10 100644
--- a/examples/fields/modular-int.C
+++ b/examples/fields/modular-int.C
@@ -1,7 +1,31 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/** \file examples/fields/modular-int.C
-\brief  Example of arithmetic in the Modular<int> finite field.
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+
+/*
+ * examples/modular-int.C
+ *
+ * Copyright (C) 2005, 2010 D. Saunders, Z. Wang
+ *
+ * This file is part of LinBox.
+ *
+ *   LinBox is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU Lesser General Public License as
+ *   published by the Free Software Foundation, either version 2 of
+ *   the License, or (at your option) any later version.
+ *
+ *   LinBox is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Lesser General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Lesser General Public
+ *   License along with LinBox.  If not, see
+ *   <http://www.gnu.org/licenses/>.
  */
+
+/** \file examples/fields/modular-int.C
+  \brief  Example of arithmetic in the Modular<int> finite field.
+  */
 //by  Zhendong wan wan at udel.edu
 
 
@@ -32,15 +56,15 @@ int main (int argc, char **argv)
 	/* +, -, *, / arithmetic operation */
 	//compute c <- a + b  mod 101;
 	F.add(c,a,b);
-        //output value of a
-        F.write(std::cout,a);
-        std::cout << " + ";
-        //output value of b
-        F.write(std::cout,b);
-        std::cout << " = ";
-        //output value of c
-        F.write(std::cout,c);
-        std::cout << " mod 101" << "\n";
+	//output value of a
+	F.write(std::cout,a);
+	std::cout << " + ";
+	//output value of b
+	F.write(std::cout,b);
+	std::cout << " = ";
+	//output value of c
+	F.write(std::cout,c);
+	std::cout << " mod 101" << "\n";
 
 	//compute c <- a - b mod 101;
 	F.sub(c,a,b);
@@ -56,39 +80,39 @@ int main (int argc, char **argv)
 
 	//compute c <- a * b mod 101;
 	F.mul(c,a,b);
-        //output value of a
-        F.write(std::cout,a);
-        std::cout << " * ";
-        //output value of b
-        F.write(std::cout,b);
-        std::cout << " = ";
-        //output value of c
-        F.write(std::cout,c);
-        std::cout << " mod 101" << "\n";
+	//output value of a
+	F.write(std::cout,a);
+	std::cout << " * ";
+	//output value of b
+	F.write(std::cout,b);
+	std::cout << " = ";
+	//output value of c
+	F.write(std::cout,c);
+	std::cout << " mod 101" << "\n";
 
 	//compute c <- a / b mod 101;
 	F.div(c,a,b);
-        //output value of a
-        F.write(std::cout,a);
-        std::cout << " / ";
-        //output value of b
-        F.write(std::cout,b);
-        std::cout << " = ";
-        //output value of c
-        F.write(std::cout,c);
-        std::cout << " mod 101" << "\n";
+	//output value of a
+	F.write(std::cout,a);
+	std::cout << " / ";
+	//output value of b
+	F.write(std::cout,b);
+	std::cout << " = ";
+	//output value of c
+	F.write(std::cout,c);
+	std::cout << " mod 101" << "\n";
 
 	//compute c = 1 /a mod 101;
 	F.inv(c,a);
 	std::cout << "1 / " << a << " = ";
 	//output value of c
-        F.write(std::cout,c);
-        std::cout << " mod 101" << "\n";
+	F.write(std::cout,c);
+	std::cout << " mod 101" << "\n";
 
-	/* Inplace operation */ 
+	/* Inplace operation */
 	//compute a *= b;
 	F.mulin(a,b);
-	
+
 	//compute a /= b;
 	F.divin(a,b);
 
@@ -103,24 +127,24 @@ int main (int argc, char **argv)
 	F.axpyin(c,a,x);
 
 	/* compare operation */
-	// test if a == 1 mod 101; 
+	// test if a == 1 mod 101;
 	//output value of a
 	F.write(std::cout,a);
 	std::cout << " == 1 mod 101 " << (F.isOne(a) ? "true" : "false") << "\n";
 
 	//test if a == 0 mod 101;
-        //output value of a
-        F.write(std::cout,a);
+	//output value of a
+	F.write(std::cout,a);
 	std::cout << " == 0 mod 101 " << (F.isZero(a) ? "true" : "false") << "\n" ;
 
 	// test if a == b mod 101;
 	//output value of a
-        F.write(std::cout,a);
+	F.write(std::cout,a);
 	std::cout << " == ";
-	//output value of b 
-        F.write(std::cout,b);
+	//output value of b
+	F.write(std::cout,b);
 	std::cout << " mod 101 " << (F.areEqual(a,b) ? "true" : "false") << "\n";
-	
+
 	//For performance, we recommend to use all possible operation, for example, using axpy, instead of mul, then addin.
 
 	return 0;
diff --git a/examples/graph-charpoly.C b/examples/graph-charpoly.C
index 6e412eb..85bd51f 100644
--- a/examples/graph-charpoly.C
+++ b/examples/graph-charpoly.C
@@ -1,10 +1,34 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/** 
-    Example for Mr G. Royle :
-    Compute the integer characteristic polynomial of symetric matrices with 
-    0,1 coefficients
-*/
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
 
+/*
+ * examples/graph-charpoly.C
+ *
+ * Copyright (C) 2005, 2007, 2010 C. Pernet
+ *
+ * This file is part of LinBox.
+ *
+ *   LinBox is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU Lesser General Public License as
+ *   published by the Free Software Foundation, either version 2 of
+ *   the License, or (at your option) any later version.
+ *
+ *   LinBox is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Lesser General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Lesser General Public
+ *   License along with LinBox.  If not, see
+ *   <http://www.gnu.org/licenses/>.
+ */
+
+/*! @file examples/graph-charpoly.C
+  * @example examples/graph-charpoly.C
+ * @ingroup examples
+ * @brief Compute the integer characteristic polynomial of symetric matrices with (0,1) coefficients.
+ * Example for Pr G. Royle.
+ */
 
 #include <iostream>
 
@@ -18,7 +42,8 @@ using namespace std;
 using namespace LinBox;
 
 template <class Field, class Polynomial>
-void printPolynomial(const Field& F, const Polynomial& P){
+void printPolynomial(const Field& F, const Polynomial& P)
+{
 	int n= P.size()-1;
 	for (int i=0;i<n;++i)
 		cout<<P[i]<<" ";
@@ -42,13 +67,13 @@ void printPolynomial(const Field& F, const Polynomial& P){
 
 
 typedef ZeroOne<PID_integer> Matrix;
-typedef GivPolynomialRing<PID_integer,Dense> IntPolRing;
+typedef GivPolynomialRing<PID_integer,::Givaro::Dense> IntPolRing;
 
 int main (int argc, char **argv)
 {
 	commentator.getMessageClass (BRIEF_REPORT).setMaxDepth (2);
 	commentator.getMessageClass (BRIEF_REPORT).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
-	
+
 
 	if (argc != 2) {
 		cerr << "Usage: graph-charpoly <matrix-file-in-SMS-format>" <<endl;
@@ -56,23 +81,23 @@ int main (int argc, char **argv)
 	}
 
 	ifstream input (argv[1]);
-	if (!input) { 
-	  cerr << "Error opening matrix file " << argv[1] << endl; 
-	  return -1; 
+	if (!input) {
+		cerr << "Error opening matrix file " << argv[1] << endl;
+		return -1;
 	}
-	
+
 	//UnparametricField<integer> ZZ;
 	PID_integer ZZ;
-	Matrix A;
+	Matrix A(ZZ);
 	A.read (input);
 	commentator.report(1, BRIEF_REPORT)<< "A is " << A.rowdim() << " by " << A.coldim() << endl;
-	
+
 	IntPolRing::Element c_A;
 
 	charpoly (c_A, A, Method::Blackbox(Method::Wiedemann( Specifier::SYMMETRIC)));
-	
+
 	cout<< "Characteristic Polynomial is ";
 	printPolynomial (ZZ, c_A);
-	
+
 	return 0;
 }
diff --git a/examples/minpoly.C b/examples/minpoly.C
index 1de3322..49b57e4 100644
--- a/examples/minpoly.C
+++ b/examples/minpoly.C
@@ -1,9 +1,44 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/** \file examples/minpoly.C examples/minpoly.C 
-\brief Minimal polynomial of a sparse matrix.
-\ingroup examples
-*/
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+
+/*
+ * examples/minpoly.C
+ *
+ * Copyright (C) 2005, 2010 D Saunders, J-G Dumas
+ *
+ * This file is part of LinBox.
+ *
+ *   LinBox is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU Lesser General Public License as
+ *   published by the Free Software Foundation, either version 2 of
+ *   the License, or (at your option) any later version.
+ *
+ *   LinBox is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Lesser General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Lesser General Public
+ *   License along with LinBox.  If not, see
+ *   <http://www.gnu.org/licenses/>.
+ */
+
+/** \file examples/minpoly.C
+ * @example  examples/minpoly.C
+  \brief Minimal polynomial of a sparse matrix.
+  \ingroup examples
+  */
 #include <iostream>
+template <class Field, class Polynomial>
+void printPolynomial (const Field &F, const Polynomial &v)
+{
+	for (int i = v.size () - 1; i >= 0; i--) {
+		F.write (std::cout, v[i]);
+		if (i > 0)
+			std::cout << " x^" << i << " + ";
+	}
+	std::cout << std::endl;
+}
 
 #include "linbox/field/modular-double.h"
 #include "linbox/blackbox/sparse.h"
@@ -12,21 +47,18 @@
 using namespace LinBox;
 using namespace std;
 
-template <class Field, class Polynomial>
-void printPolynomial (const Field &F, const Polynomial &v) 
-{
-	for (int i = v.size () - 1; i >= 0; i--) {
-		F.write (cout, v[i]);
-		if (i > 0)
-			cout << " x^" << i << " + ";
-	}
-	cout << endl;
-}
 
 int main (int argc, char **argv)
 {
+	commentator.setMaxDetailLevel (-1);
+	commentator.setMaxDepth (-1);
+	commentator.setReportStream (std::cerr);
 
-	if (argc < 2 || argc > 3) {
+	int a = argc;
+	while(a--){
+		cerr << "argv[" << a << "] = " << argv[a] << endl;
+	}
+	if (argc < 2) {
 		cerr << "Usage: minpoly <matrix-file-in-SMS-format> [<p>]" << endl;
 		return -1;
 	}
@@ -34,35 +66,40 @@ int main (int argc, char **argv)
 	ifstream input (argv[1]);
 	if (!input) { cerr << "Error opening matrix file " << argv[1] << endl; return -1; }
 
-	if (argc == 2) {
-	   int process = 0;
-	   
-           Method::Blackbox M;
+	if (argc != 3) {
+		int process = 0;
+
+		Method::Blackbox M;
 #ifdef __LINBOX_HAVE_MPI
-           Communicator C(&argc, &argv);
-           process = C.rank();
-           M.communicatorp(&C);
+		Communicator C(&argc, &argv);
+		process = C.rank();
+		M.communicatorp(&C);
 #endif
-           
-           PID_integer ZZ;
-           SparseMatrix<PID_integer> A (ZZ);
-           A.read (input);
-           
-           if(process == 0)
-               cout << "A is " << A.rowdim() << " by " << A.coldim() << endl;
-           
-           vector<PID_integer::Element> m_A;
-           minpoly (m_A, A, M); 
-           
-           
-           
-           if(process == 0){
-               cout << "Minimal Polynomial is ";
-               printPolynomial (ZZ, m_A);
-           }
-	}
-	if (argc == 3) { 
 
+		PID_integer ZZ;
+		SparseMatrix<PID_integer> A (ZZ);
+		A.read (input);
+
+		if(process == 0)
+			cout << "A is " << A.rowdim() << " by " << A.coldim() << endl;
+
+		vector<PID_integer::Element> m_A;
+		minpoly (m_A, A, M);
+
+		if(process == 0){
+			cout << "Minimal Polynomial is ";
+			printPolynomial (ZZ, m_A);
+		}
+
+		//            minpoly (m_A, A, Method::BlasElimination() );
+
+		//            if(process == 0){
+		//                cout << "Minimal Polynomial is ";
+		//                printPolynomial (ZZ, m_A);
+		//            }
+
+	}
+	else{
 		typedef Modular<double> Field;
 		double q = atof(argv[2]);
 		Field F(q);
@@ -75,6 +112,11 @@ int main (int argc, char **argv)
 
 		cout << "Minimal Polynomial is ";
 		printPolynomial (F, m_B);
+
+		//                 minpoly (m_A, A, Method::BlasElimination() );
+		//  		cout << "Minimal Polynomial is ";
+		// 		printPolynomial (F, m_B);
+
 	}
 
 	return 0;
diff --git a/examples/rank.C b/examples/rank.C
index df3a78d..a5ed0fb 100644
--- a/examples/rank.C
+++ b/examples/rank.C
@@ -1,11 +1,35 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/** \file examples/rank.C
-\brief Rank of sparse matrix over Z or Zp.
-\ingroup examples
-*/
-//#include "linbox-config.h"
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/*
+ * examples/rank.C
+ *
+ * Copyright (C) 2005, 2010 D. Saunders, J-G Dumas
+ *
+ * This file is part of LinBox.
+ *
+ *   LinBox is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU Lesser General Public License as
+ *   published by the Free Software Foundation, either version 2 of
+ *   the License, or (at your option) any later version.
+ *
+ *   LinBox is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Lesser General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Lesser General Public
+ *   License along with LinBox.  If not, see
+ *   <http://www.gnu.org/licenses/>.
+ */
+
+/**\file examples/rank.C
+ * @example  examples/rank.C
+  \brief Rank of sparse matrix over Z or Zp.
+  \ingroup examples
+  */
 
 #include <iostream>
+#include <sstream>
 
 //#include "linbox/field/modular.h"
 #include "linbox/field/modular-double.h"
@@ -14,6 +38,7 @@
 #include "linbox/blackbox/zero-one.h"
 #include "linbox/solutions/rank.h"
 #include "linbox/util/matrix-stream.h"
+#include "linbox/field/givaro-rational.h"
 
 using namespace LinBox;
 using namespace std;
@@ -21,11 +46,11 @@ using namespace std;
 /// rank or rank mod p
 int main (int argc, char **argv)
 {
-    commentator.setMaxDetailLevel (-1);
-    commentator.setMaxDepth (-1);
-    commentator.setReportStream (std::cerr);
+	commentator.setMaxDetailLevel (-1);
+	commentator.setMaxDepth (-1);
+	commentator.setReportStream (std::cerr);
 
-	if (argc < 2 || argc > 3) 
+	if (argc < 2 || argc > 3)
 	{	cerr << "Usage: rank <matrix-file-in-supported-format> [<p>]" << endl; return -1; }
 
 	ifstream input (argv[1]);
@@ -33,25 +58,37 @@ int main (int argc, char **argv)
 
 	long unsigned int r;
 
-	if (argc == 2) { // rank over the integers.
+	if (argc == 2) { // rank over the rational numbers.
 
-	   /* We could pick a random prime and work mod that prime, But the point here 
-	   is that the rank function in solutions/ handles that issue.  Our matrix here 
-	   is an integer matrix and our concept is that we are getting the rank of that 
-	   matrix by some blackbox magic inside linbox.
-	   */
-		PID_integer ZZ;
-		MatrixStream<PID_integer> ms( ZZ, input );
-		SparseMatrix<PID_integer> A ( ms );
+		/* We could pick a random prime and work mod that prime, But the point here
+		   is that the rank function in solutions/ handles that issue.  Our matrix here
+		   is an integer or rational matrix and our concept is that we are getting the rank of that
+		   matrix by some blackbox magic inside linbox.
+		   */
+		LinBox::GivaroRational ZZ;
+		MatrixStream<GivaroRational> ms( ZZ, input );
+		SparseMatrix<GivaroRational> A ( ms );
 		cout << "A is " << A.rowdim() << " by " << A.coldim() << endl;
 
 		rank (r, A);
 	}
-	if (argc == 3) { 
-		int q = atoi(argv[2]);
-		//double q = atof(argv[2]);
-		typedef Modular<int> Field;
-		//typedef Modular<double> Field;
+	if (argc == 3) { // rank mod a prime
+		/*
+		//for prime greater than wordsize:
+		stringstream qstr(argv[2]);
+		integer q;
+		qstr >> q;
+		typedef Modular<integer> Field;
+		*/
+		/*
+		//to use doubles, prime < 2^{23}
+		double q = atof(argv[2]);
+		typedef Modular<double> Field;
+		*/
+		//to use ints, prime < 2^{31}
+		int32_t q = atoi(argv[2]);
+		typedef Modular<int32_t> Field;
+
 		Field F(q);
 		MatrixStream<Field> ms( F, input );
 		SparseMatrix<Field, Vector<Field>::SparseSeq > B (ms);
@@ -60,22 +97,22 @@ int main (int argc, char **argv)
 
 		// Using the adaptive LinBox Solution
 		rank(r,B);
-                    
+
 		// using BlackBoxes
 		/*
-		Method::Blackbox MBB;
-		MBB.certificate(true);
-		rank(r, B, MBB);
-		*/
+		   Method::Blackbox MBB;
+		   MBB.certificate(true);
+		   rank(r, B, MBB);
+		   */
 
 		// using in place Sparse Elimination with linear pivoting
-		
+
 		/*
-		Method::SparseElimination SE;
-		SE.strategy(Specifier::PIVOT_LINEAR);
-		rankin (r, B, SE);                    
-		if (B.rowdim() <= 20 && B.coldim() <= 20) B.write(cout) << endl;
-		*/
+		   Method::SparseElimination SE;
+		   SE.strategy(Specifier::PIVOT_LINEAR);
+		   rankin (r, B, SE);
+		   if (B.rowdim() <= 20 && B.coldim() <= 20) B.write(cout) << endl;
+		   */
 
 
 	}
diff --git a/examples/smith.C b/examples/smith.C
index 87af4b9..1a1e8d6 100644
--- a/examples/smith.C
+++ b/examples/smith.C
@@ -1,27 +1,53 @@
+/* -*- 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
+/*
+ * examples/smith.C
+ *
+ * Copyright (C) 2005, 2010  D. Saunders, Z. Wang, J-G Dumas
+ *
+ * This file is part of LinBox.
+ *
+ *   LinBox is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU Lesser General Public License as
+ *   published by the Free Software Foundation, either version 2 of
+ *   the License, or (at your option) any later version.
+ *
+ *   LinBox is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Lesser General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Lesser General Public
+ *   License along with LinBox.  If not, see
+ *   <http://www.gnu.org/licenses/>.
+ */
+
 /** \file examples/smith.C
-\brief mod m Smith form by elmination
-\ingroup examples
+ * @example  examples/smith.C
+  \brief mod m Smith form by elmination
+  \ingroup examples
+
+  \author bds & zw
 
- \author bds & zw
+  Various Smith form algorithms may be used for matrices over the
+  integers or over Z_m.  Moduli greater than 2^32 are not supported.
+  Several types of example matrices may be constructed or matrix read from file.
+  Run the program with no arguments for a synopsis of the
+  command line parameters.
 
-Various Smith form algorithms may be used for matrices over the 
-integers or over Z_m.  If the modulus is greater than 2^32, the "-DBIG"
-compilation option must be used.
-Several types of example matrices may be constructed or matrix read from file.
-Run the program with no arguments for a synopsis of the 
-command line parameters.
+  For the "adaptive" method, the matrix must be over the integers.
+  This is expected to work best for large matrices.
 
-For the "adaptive" method, the matrix must be over the NTL_ZZ representation of 
-the integers.  
+  For the "2local" method, the computaattion is done mod 2^32.
 
-For the "2local" method, the computation is done mod 2^32.
+  For the "local" method, the modulus must be a prime power.
 
-For the "local" method, the modulus must be a prime power.
+  For the "ilio" method, the modulus may be arbitrary composite.
+  If the modulus is a multiple of the integer determinant, the intege Smith form is obtained.  Determinant plus ilio may be best for smaller matrices.
 
-For the "ilio" method, the modulus may be arbitrary composite.
+  This example was used during the design process of the adaptive algorithm.
+  */
 
-This example was used during the design process of the adaptive algorithm.
-*/
 #include <iostream>
 #include <string>
 #include <vector>
@@ -38,56 +64,48 @@ using namespace std;
 
 #include "linbox/field/unparametric.h"
 #include "linbox/field/local2_32.h"
-#include "linbox/field/ntl-ZZ.h"
-//#include "linbox/field/PIR-modular-int32.h"
-//#include "linbox/algorithms/2local-smith.h"
+#include "linbox/field/PIR-modular-int32.h"
 #include "linbox/algorithms/smith-form-local.h"
 #include "linbox/algorithms/smith-form-local2.h"
-//#include "linbox/algorithms/local-smith.h"
 #include <linbox/algorithms/smith-form-iliopoulos.h>
-//#include "linbox/algorithms/iliopoulos-elimination.h"
 #include "linbox/algorithms/smith-form-adaptive.h"
 #include "linbox/blackbox/dense.h"
 
 using namespace LinBox;
-#ifndef BIG
-#include "linbox/field/PIR-modular-int32.h"
-typedef PIRModular<LinBox::int32> PIR;
-#else
-#include "linbox/field/PIR-ntl-ZZ_p.h"
-typedef PIR_ntl_ZZ_p PIR;
-#endif
 
+// #ifndef BIG
 
 
 template<class PIR>
-void Mat(DenseMatrix<PIR>& M, PIR& R, int n, 
-		 string src, string file, string format);
+void Mat(DenseMatrix<PIR>& M, PIR& R, int n,
+	 string src, string file, string format);
 
 template<class I1, class Lp> void distinct (I1 a, I1 b, Lp& c);
 template <class I> void display(I b, I e);
 
-int main(int argc, char* argv[]) {
+int main(int argc, char* argv[])
+{
+	typedef PIRModular<int32_t> PIR;
 
 	if (argc < 5) {
-	
+
 		cout << "usage: " << argv[0] << " alg m n source format \n"  << endl;
 
-	    cout << "alg = `adaptive', `ilio', `local', or `2local', \n"
-		     << "m is modulus (ignored by 2local, adaptive), "
-			 << "n is matrix order, \n" 
-			 << "source is `random', `random-rough', `fib', `tref', or a filename \n"
-			 << "format is `dense' or `sparse' (if matrix from a file)\n"
-			 << "compile with -DBIG if you want big integers used.\n";
+		cout << "alg = `adaptive', `ilio', `local', or `2local', \n"
+		<< "m is modulus (ignored by 2local, adaptive), "
+		<< "n is matrix order, \n"
+		<< "source is `random', `random-rough', `fib', `tref', or a filename \n"
+		<< "format is `dense' or `sparse' (if matrix from a file)\n"
+		<< "compile with -DBIG if you want big integers used.\n";
 
-	     return 0;
+		return 0;
 	}
 
 	string algo = argv[1];
 
 	int m = atoi(argv[2]);
 
-    int n = atoi(argv[3]);
+	int n = atoi(argv[3]);
 
 	string src = argv[4];
 
@@ -98,157 +116,172 @@ int main(int argc, char* argv[]) {
 	UserTimer T;
 
 	if (algo == "adaptive")
-	{   
-		typedef NTL_ZZ Ints;
+	{
+		typedef PID_integer Ints;
 		Ints Z;
-	    DenseMatrix<Ints> M(Z);
-	    Mat(M, Z, n, src, file, format);
+		DenseMatrix<Ints> M(Z);
+		Mat(M, Z, n, src, file, format);
 		vector<integer> v(n);
-	    T.start();
+		T.start();
 		SmithFormAdaptive::smithForm(v, M);
-	    T.stop();
-	    list<pair<integer, size_t> > p;
+		T.stop();
+		list<pair<integer, size_t> > p;
 
-	    distinct(v.begin(), v.end(), p);
+		distinct(v.begin(), v.end(), p);
 
-	    cout << "#";
+		cout << "#";
 
-	    display(p.begin(), p.end());
+		display(p.begin(), p.end());
 
-	    cout << "# adaptive, Ints, n = " << n << endl;
+		cout << "# adaptive, Ints, n = " << n << endl;
 
-	    cout << "T" << n << "adaptive" << m << " := ";
+		cout << "T" << n << "adaptive" << m << " := ";
 
 	}
-	else if (algo == "ilio") { 
+	else if (algo == "ilio") {
 
 		PIR R(m);
 
-	    DenseMatrix<PIR> M(R);
+		DenseMatrix<PIR> M(R);
 
-	    Mat(M, R, n, src, file, format);
+		Mat(M, R, n, src, file, format);
 
-	    T.start();
+		T.start();
 
-	    SmithFormIliopoulos::smithFormIn (M);
+		SmithFormIliopoulos::smithFormIn (M);
 
-	    T.stop();
+		T.stop();
 
-	    typedef list< PIR::Element > List;
+		typedef list< PIR::Element > List;
 
-	    List L;
+		List L;
 
-	    for (size_t i = 0; i < M.rowdim(); ++i) L.push_back(M[i][i]);
+		for (size_t i = 0; i < M.rowdim(); ++i) L.push_back(M[i][i]);
 
-	    list<pair<PIR::Element, size_t> > p;
+		list<pair<PIR::Element, size_t> > p;
 
-	    distinct(L.begin(), L.end(), p);
+		distinct(L.begin(), L.end(), p);
 
-	    cout << "#";
+		cout << "#";
 
-	    display(p.begin(), p.end());
+		display(p.begin(), p.end());
 
-	    cout << "# ilio, PIR-Modular-int32(" << m << "), n = " << n << endl;
+		cout << "# ilio, PIR-Modular-int32_t(" << m << "), n = " << n << endl;
 
-	    cout << "T" << n << "ilio" << m << " := ";
-	} 
+		cout << "T" << n << "ilio" << m << " := ";
+	}
 
 	else if (algo == "local") { // m must be a prime power
-	
-           if (format == "sparse" ) {
-                typedef Modular<LinBox::int32> Field;
-                Field F(m);
-                std::ifstream input (argv[4]);
-                if (!input) { std::cerr << "Error opening matrix file: " << argv[1] << std::endl; return -1; }
-
-                MatrixStream<Field> ms( F, input );
-                SparseMatrix<Field, Vector<Field>::SparseSeq > B (ms);
-                std::cout << "B is " << B.rowdim() << " by " << B.coldim() << std::endl;
-                if (B.rowdim() <= 20 && B.coldim() <= 20) B.write(std::cout) << std::endl;
-
-
-                
-                Integer p(m), im(m);
-                    // Should better ask user to give the prime !!!
-                for(unsigned int k = 2; ( ( ! ::probab_prime(p) ) && (p > 1) ); ++k)
-                    ::root( p, im, k );
-
-                    // using Sparse Elimination
-                LinBox::PowerGaussDomain< Field > PGD( F );
-                std::vector<std::pair<size_t,size_t> > local;
-
-                PGD(local, B, m, (int)p);    
-
-                
-                std::cout << "#";
-                
-                display(local.begin(), local.end());
-            } else {
-
-                PIR R(m);
-		
-                DenseMatrix<PIR> M(R);
-		
-                Mat(M, R, n, src, file, format);
-                
-                typedef list< PIR::Element > List;
-                
-                List L;
-                
-                SmithFormLocal<PIR> SmithForm;
-                
-                T.start();
-                
-                SmithForm( L, M, R );
-                
-                T.stop();
-                
-                list<pair<PIR::Element, size_t> > p;
-                
-                distinct(L.begin(), L.end(), p);
-                
-                cout << "#";
-                
-                display(p.begin(), p.end());
-            }
-           
-                
-           cout << "# local, PIR-Modular-int32(" << m << "), n = " << n << endl;
-           
-           cout << "T" << n << "local" << m << " := ";
+
+		if (format == "sparse" ) {
+			typedef Modular<int32_t> Field;
+			Field F(m);
+			std::ifstream input (argv[4]);
+			if (!input) { std::cerr << "Error opening matrix file: " << argv[1] << std::endl; return -1; }
+
+			MatrixStream<Field> ms( F, input );
+			SparseMatrix<Field, Vector<Field>::SparseSeq > B (ms);
+			std::cout << "B is " << B.rowdim() << " by " << B.coldim() << std::endl;
+			if (B.rowdim() <= 20 && B.coldim() <= 20) B.write(std::cout) << std::endl;
+
+
+
+			Integer p(m), im(m);
+			// Should better ask user to give the prime !!!
+			for(unsigned int k = 2; ( ( ! ::Givaro::probab_prime(p) ) && (p > 1) ); ++k)
+				::Givaro::root( p, im, k );
+
+			// using Sparse Elimination
+			LinBox::PowerGaussDomain< Field > PGD( F );
+			std::vector<std::pair<size_t,size_t> > local;
+
+			PGD(local, B, m, (int)p);
+
+			typedef list< Field::Element > List;
+			List L;
+			for ( std::vector<std::pair<size_t,size_t> >::iterator
+			      p = local.begin(); p != local.end(); ++p) {
+				for(size_t i = 0; i < p->first; ++i) L.push_back(p->second);
+			}
+			size_t m = (B.rowdim() > B.coldim() ? B.coldim() : B.rowdim());
+			for (size_t i = L.size(); i < m; ++i) L.push_back(0);
+
+			list<pair<Field::Element, size_t> > pl;
+
+			distinct(L.begin(), L.end(), pl);
+
+			std::cout << "#";
+
+			//display(local.begin(), local.end());
+			display(pl.begin(), pl.end());
+			cout << "# local, PowerGaussDomain<int32_t>(" << m << "), n = " << n << endl;
+
+		}
+		else {
+
+			PIR R(m);
+
+			DenseMatrix<PIR> M(R);
+
+			Mat(M, R, n, src, file, format);
+
+			typedef list< PIR::Element > List;
+
+			List L;
+
+			SmithFormLocal<PIR> SmithForm;
+
+			T.start();
+
+			SmithForm( L, M, R );
+
+			T.stop();
+
+			list<pair<PIR::Element, size_t> > p;
+
+			distinct(L.begin(), L.end(), p);
+
+			cout << "#";
+
+			display(p.begin(), p.end());
+
+			cout << "# local, PIR-Modular-int32_t(" << m << "), n = " << n << endl;
+
+		}
+		cout << "T" << n << "local" << m << " := ";
 	}
 
-	else if (algo == "2local") { 
+	else if (algo == "2local") {
 
 		Local2_32 R;
 
-	    DenseMatrix<Local2_32> M(R);
+		DenseMatrix<Local2_32> M(R);
 
-	    Mat(M, R, n, src, file, format);
+		Mat(M, R, n, src, file, format);
 
-	    typedef list< Local2_32::Element > List;
+		typedef list< Local2_32::Element > List;
 
-	    List L;
+		List L;
 
-	    SmithFormLocal<Local2_32> SmithForm;
+		SmithFormLocal<Local2_32> SmithForm;
 
-	    T.start();
+		T.start();
 
-	    SmithForm( L, M, R );
+		SmithForm( L, M, R );
 
-	    T.stop();
+		T.stop();
 
-	    list<pair<Local2_32::Element, size_t> > p;
+		list<pair<Local2_32::Element, size_t> > p;
 
-	    distinct(L.begin(), L.end(), p);
+		distinct(L.begin(), L.end(), p);
 
-	    cout << "#";
+		cout << "#";
 
-	    display(p.begin(), p.end());
+		display(p.begin(), p.end());
 
-	    cout << "# 2local, Local2_32, n = " << n << endl;
+		cout << "# 2local, Local2_32, n = " << n << endl;
 
-	    cout << "T" << n << "local2_32 := ";
+		cout << "T" << n << "local2_32 := ";
 	}
 
 	else {
@@ -261,41 +294,41 @@ int main(int argc, char* argv[]) {
 
 	T.print(cout); cout << ";" << endl;
 
+	return 0 ;
 }
 
 /** Output matrix is determined by src which may be:
   "random-rough"
-   This mat will have s, near sqrt(n), distinct invariant factors, 
-   each repeated twice), involving the s primes 101, 103, ...
+  This mat will have s, near sqrt(n), distinct invariant factors,
+  each repeated twice), involving the s primes 101, 103, ...
   "random"
-   This mat will have the same nontrivial invariant factors as
-   diag(1,2,3,5,8, ... 999, 0, 1, 2, ...).
+  This mat will have the same nontrivial invariant factors as
+  diag(1,2,3,5,8, ... 999, 0, 1, 2, ...).
   "fib"
-   This mat will have the same nontrivial invariant factors as
-   diag(1,2,3,5,8, ... fib(k)), where k is about sqrt(n). 
-   The basic matrix is block diagonal with i-th block of order i and
-   being a tridiagonal {-1,0,1} matrix whose snf = diag(i-1 1's, fib(i)),
-   where fib(1) = 1, fib(2) = 2.  But note that, depending on n, 
-   the last block may be truncated, thus repeating an earlier fibonacci number.
+  This mat will have the same nontrivial invariant factors as
+  diag(1,2,3,5,8, ... fib(k)), where k is about sqrt(n).
+  The basic matrix is block diagonal with i-th block of order i and
+  being a tridiagonal {-1,0,1} matrix whose snf = diag(i-1 1's, fib(i)),
+  where fib(1) = 1, fib(2) = 2.  But note that, depending on n,
+  the last block may be truncated, thus repeating an earlier fibonacci number.
   "file" (or any other string)
-   mat read from named file with format "sparse" or "dense".
+  mat read from named file with format "sparse" or "dense".
   Also "tref" and file with format "kdense"
-*/
+  */
 template <class PIR>
-
-void Mat(DenseMatrix<PIR>& M, PIR& R, int n, 
-			string src, string file, string format) {
+void Mat(DenseMatrix<PIR>& M, PIR& R, int n,
+	 string src, string file, string format) {
 
 	typename PIR::Element zero; R.init(zero, 0);
-    if (src == "random-rough") RandomRoughMat(M, R, n);
+	if (src == "random-rough") RandomRoughMat(M, R, n);
 
-    else if (src == "random") RandomFromDiagMat(M, R, n);
+	else if (src == "random") RandomFromDiagMat(M, R, n);
 
-    else if (src == "fib") RandomFibMat(M, R, n);
+	else if (src == "fib") RandomFibMat(M, R, n);
 
-    else if (src == "tref") TrefMat(M, R, n);
+	else if (src == "tref") TrefMat(M, R, n);
 
-    else // from file
+	else // from file
 	{
 
 		int rdim, cdim;
@@ -305,9 +338,7 @@ void Mat(DenseMatrix<PIR>& M, PIR& R, int n,
 
 		in >> rdim >> cdim;
 
-cout << "about to resize" << endl;
 		M. resize (rdim, cdim);
-cout << "resized" << endl;
 
 		integer val;
 
@@ -331,7 +362,6 @@ cout << "resized" << endl;
 			char mark;
 
 			in >> mark;
-cout << "got into sparse" << endl;
 
 			LinBox::integer val;
 
@@ -346,10 +376,9 @@ cout << "got into sparse" << endl;
 				R. init (M[i-1][j-1], val);
 
 			} while (true);
-cout << "got through sparse input" << endl;
 
 		}
-		  //Krattenthaler's q^e matrices, given by exponent
+		//Krattenthaler's q^e matrices, given by exponent
 		else if (format == "kdense") KratMat(M, R, n, in);
 
 		else {
@@ -361,42 +390,42 @@ cout << "got through sparse input" << endl;
 		}
 	}
 
-    /*show some entries
-	for (int k = 0; k < 10; ++k)
-	cout << M.getEntry(0,k) <<  " " << M.getEntry(M.rowdim()-1, M.coldim()-1 - k) << endl;
-	cout << endl << M.rowdim() << " " << M.coldim() << endl;
-	*/
+	/*show some entries
+	  for (int k = 0; k < 10; ++k)
+	  cout << M.getEntry(0,k) <<  " " << M.getEntry(M.rowdim()-1, M.coldim()-1 - k) << endl;
+	  cout << endl << M.rowdim() << " " << M.coldim() << endl;
+	  */
 
 	/* some row ops and some col ops */
 } // Mat
 
-// This mat will have s, near sqrt(n), distinct invariant factors, 
+// This mat will have s, near sqrt(n), distinct invariant factors,
 // each repeated twice), involving the s primes 101, 103, ...
 template <class PIR>
 void RandomRoughMat(DenseMatrix<PIR>& M, PIR& R, int n) {
 	typename PIR::Element zero; R.init(zero, 0);
 	M.resize(n, n, zero);
-    if (n > 10000) {cerr << "n too big" << endl; exit(-1);}
-    int jth_factor[130] = 
+	if (n > 10000) {cerr << "n too big" << endl; exit(-1);}
+	int jth_factor[130] =
 	{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};
-
-	for (int j= 0, i = 0 ; i < n; ++j) 
-	{   
-        typename PIR::Element v; R.init(v, jth_factor[25+j]);
-	    for (int k = j ; k > 0 && i < n ; --k) 
+		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};
+
+	for (int j= 0, i = 0 ; i < n; ++j)
+	{
+		typename PIR::Element v; R.init(v, jth_factor[25+j]);
+		for (int k = j ; k > 0 && i < n ; --k)
 		{   M[i][i] = v; ++i;
-		    if (i < n) {M[i][i] = v; ++i;}
+			if (i < n) {M[i][i] = v; ++i;}
 		}
 	}
-    scramble(M);
+	scramble(M);
 }
 
 // This mat will have the same nontrivial invariant factors as
@@ -406,18 +435,18 @@ void RandomFromDiagMat(DenseMatrix<PIR>& M, PIR& R, int n) {
 	typename PIR::Element zero; R.init(zero, 0);
 	M.resize(n, n, zero);
 
-	for (int i= 0 ; i < n; ++i) 
-	
+	for (int i= 0 ; i < n; ++i)
+
 		R.init(M[i][i], i % 1000 + 1);
-    scramble(M);
+	scramble(M);
 
 }
-	
+
 // This mat will have the same nontrivial invariant factors as
-// diag(1,2,3,5,8, ... fib(k)), where k is about sqrt(n). 
+// diag(1,2,3,5,8, ... fib(k)), where k is about sqrt(n).
 // The basic matrix is block diagonal with i-th block of order i and
 // being a tridiagonal {-1,0,1} matrix whose snf = diag(i-1 1's, fib(i)),
-// where fib(1) = 1, fib(2) = 2.  But note that, depending on n, 
+// where fib(1) = 1, fib(2) = 2.  But note that, depending on n,
 // the last block may be truncated, thus repeating an earlier fibonacci number.
 template <class PIR>
 void RandomFibMat(DenseMatrix<PIR>& M, PIR& R, int n) {
@@ -430,94 +459,92 @@ void RandomFibMat(DenseMatrix<PIR>& M, PIR& R, int n) {
 
 	int j = 1, k = 0;
 
-	for (int i= 0 ; i < n-1; ++i) { 
+	for (int i= 0 ; i < n-1; ++i) {
 
 		if ( i == k) {
-		
+
 			M[i][i+1] = zero;
-			
+
 			k += ++j;
 		}
 
-    	else { 
-		
-			M[i][i+1] = one; 
-			
+		else {
+
+			M[i][i+1] = one;
+
 			R.negin(one);
 		}
-    	R.neg(M[i+1][i], M[i][i+1]);
+		R.neg(M[i+1][i], M[i][i+1]);
 	}
-    scramble(M);
+	scramble(M);
 }
-	
+
 template < class Ring >
 void scramble(DenseMatrix<Ring>& M)
 {
-	
-	    Ring R = M.field();
-
-		int N,n = M.rowdim(); // number of random basic row and col ops.
-		N = n;
-	
-		for (int k = 0; k < N; ++k) {
 
-	    	int i = rand()%M.rowdim(); 
-			
-	    	int j = rand()%M.coldim(); 
-			
-	    	if (i == j) continue;
+	Ring R = M.field();
 
-		    // M*i += alpha M*j and Mi* += beta Mj
+	int N,n = M.rowdim(); // number of random basic row and col ops.
+	N = n;
 
-	   		//int a = rand()%2;
-			int a = 0;
+	for (int k = 0; k < N; ++k) {
 
-	   	 	for (size_t l = 0; l < M.rowdim(); ++l) {
+		int i = rand()%M.rowdim();
 
-				if (a)
+		int j = rand()%M.coldim();
 
-					R.subin(M[l][i], M[l][j]);
+		if (i == j) continue;
 
-				else 
+		// M*i += alpha M*j and Mi* += beta Mj
 
-					R.addin(M[l][i], M[l][j]);
+		//int a = rand()%2;
+		int a = 0;
 
-				//K.axpy(c, M.getEntry(l, i), x, M.getEntry(l, j));
-				//M.setEntry(l, i, c);
-   	    	}
+		for (size_t l = 0; l < M.rowdim(); ++l) {
 
-	    	//a = rand()%2;
+			if (a)
 
-	    	for (size_t l = 0; l < M.coldim(); ++l) {
+				R.subin(M[l][i], M[l][j]);
 
-				if (a)
+			else
 
-					R.subin(M[i][l], M[j][l]);
-				else 
+				R.addin(M[l][i], M[l][j]);
 
-					R.addin(M[i][l], M[j][l]);
-   	    	}
+			//K.axpy(c, M.getEntry(l, i), x, M.getEntry(l, j));
+			//M.setEntry(l, i, c);
 		}
 
-		std::ofstream out("matrix", std::ios::out);
+		//a = rand()%2;
 
-		//M. write(std::cout);
+		for (size_t l = 0; l < M.coldim(); ++l) {
 
-		out << n << " " << n << "\n";
+			if (a)
 
-		for (int i = 0; i < n; ++ i) {
+				R.subin(M[i][l], M[j][l]);
+			else
 
-			for ( int j = 0; j < n; ++ j) {
+				R.addin(M[i][l], M[j][l]);
+		}
+	}
 
-				R. write(out, M[i][j]);
+	std::ofstream out("matrix", std::ios::out);
 
-				out << " ";
-			}
+	out << n << " " << n << "\n";
+
+	for (int i = 0; i < n; ++ i) {
 
-			out << "\n";
+		for ( int j = 0; j < n; ++ j) {
 
+			R. write(out, M[i][j]);
+
+			out << " ";
 		}
 
+		out << "\n";
+
+	}
+
 	//}
 }
 
@@ -562,14 +589,14 @@ void TrefMat(DenseMatrix<PIR>& M, PIR& R, int n) {
 //// end tref ///////  begin krat /////////////////////////////
 
 struct pwrlist
-{  
-   vector<integer> m;
-   pwrlist(integer q) 
-   { m.push_back(1); m.push_back(q); //cout << "pwrlist " << m[0] << " " << m[1] << endl; 
-   } 
-   integer operator[](int e)
-   {	
-        for (int i = m.size(); i <= e; ++i) m.push_back(m[1]*m[i-1]);
+{
+	vector<integer> m;
+	pwrlist(integer q)
+	{ m.push_back(1); m.push_back(q); //cout << "pwrlist " << m[0] << " " << m[1] << endl;
+	}
+	integer operator[](int e)
+	{
+		for (int i = m.size(); i <= e; ++i) m.push_back(m[1]*m[i-1]);
 		return m[e];
 	}
 };
@@ -578,28 +605,28 @@ struct pwrlist
 // Return value of the power of q at q = _q.
 template <class num>
 num& qread(num& val, pwrlist& M, istream& in)
-{	
+{
 	char c;
 	in >> c; // next nonwhitespace
 	if (c == '0') return val = 0;
 	if (c == '1') return val = 1;
 	if (c != 'p' && c != 'q') { cout << "exiting due to unknown char " << c << endl; exit(-1);}
-	in.get(c); 
+	in.get(c);
 	if (c !='^') {in.putback(c); return val = M[1];}
-	else 
-	{ int expt; in >> expt; 
-	  return val = M[expt];
+	else
+	{ int expt; in >> expt;
+		return val = M[expt];
 	};
-}	
+}
 
 template <class PIR>
-void KratMat(DenseMatrix<PIR>& M, PIR& R, int q, istream& in) 
+void KratMat(DenseMatrix<PIR>& M, PIR& R, int q, istream& in)
 {
-	pwrlist pwrs(q); 
+	pwrlist pwrs(q);
 	for (unsigned int i = 0; i < M.rowdim(); ++ i)
 
 		for ( unsigned int j = 0; j < M.coldim(); ++ j) {
-			int val; 
+			int val;
 			qread(val, pwrs, in);
 			R. init (M[i][j], val);
 		}
@@ -609,24 +636,25 @@ void KratMat(DenseMatrix<PIR>& M, PIR& R, int q, istream& in)
 template<class I1, class Lp>
 void distinct (I1 a, I1 b, Lp& c)
 { typename I1::value_type e;
-  size_t count = 0;
-  if (a != b) {e = *a; ++a; count = 1;} 
-  else return;
-  while (a != b)
-  {  if (*a == e) ++count; 
-     else 
-     { c.push_back(typename Lp::value_type(e, count)); 
-       e = *a; count = 1; 
-     }
-     ++a;
-  }
-  c.push_back(typename Lp::value_type(e, count)); 
-  return;
+	size_t count = 0;
+	if (a != b) {e = *a; ++a; count = 1;}
+	else return;
+	while (a != b)
+	{  if (*a == e) ++count;
+		else
+		{ c.push_back(typename Lp::value_type(e, count));
+			e = *a; count = 1;
+		}
+		++a;
+	}
+	c.push_back(typename Lp::value_type(e, count));
+	return;
 }
+
 template <class I>
 void display(I b, I e)
-{ cout << "("; 
-  for (I p = b; p != e; ++p) cout << p->first << " " << p->second << ", "; 
-  cout << ")" << endl; 
+{ cout << "(";
+	for (I p = b; p != e; ++p) cout << p->first << " " << p->second << ", ";
+	cout << ")" << endl;
 }
 //@}
diff --git a/examples/smithvalence.C b/examples/smithvalence.C
new file mode 100644
index 0000000..908e97c
--- /dev/null
+++ b/examples/smithvalence.C
@@ -0,0 +1,310 @@
+/* -*- 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
+/*
+ * examples/smithvalence.C
+ *
+ * Copyright (C) 2010  J-G Dumas
+ *
+ * This file is part of LinBox.
+ *
+ *   LinBox is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU Lesser General Public License as
+ *   published by the Free Software Foundation, either version 2 of
+ *   the License, or (at your option) any later version.
+ *
+ *   LinBox is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Lesser General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Lesser General Public
+ *   License along with LinBox.  If not, see
+ *   <http://www.gnu.org/licenses/>.
+ */
+
+/**\file examples/smithvalence.C
+ * @example  examples/smithvalence.C
+  \brief Valence of sparse matrix over Z or Zp.
+  \ingroup examples
+  */
+//#include "linbox-config.h"
+#include <iostream>
+
+#include "linbox/field/gf2.h"
+#include "linbox/field/modular-double.h"
+#include "linbox/field/givaro-zpz.h"
+#include "linbox/field/field-traits.h"
+#include "linbox/blackbox/transpose.h"
+#include "linbox/blackbox/compose.h"
+#include "linbox/blackbox/sparse.h"
+#include "linbox/solutions/rank.h"
+#include "linbox/solutions/valence.h"
+#include "linbox/algorithms/smith-form-sparseelim-local.h"
+#include "linbox/util/matrix-stream.h"
+#include "linbox/integer.h"
+
+#include <givaro/givintnumtheo.h>
+
+using LinBox::integer;
+
+template<class Field>
+unsigned long& TempLRank(unsigned long& r, char * filename, const Field& F)
+{
+	std::ifstream input(filename);
+	LinBox::MatrixStream< Field > msf( F, input );
+	LinBox::SparseMatrix<Field,typename LinBox::Vector<Field>::SparseSeq> FA(msf);
+	input.close();
+	::Givaro::Timer tim; tim.start();
+	LinBox::rankin(r, FA);
+	tim.stop();
+	F.write(std::cout << "Rank over ") << " is " << r << ' ' << tim << std::endl;
+	return r;
+}
+
+unsigned long& TempLRank(unsigned long& r, char * filename, const LinBox::GF2& F2)
+{
+	std::ifstream input(filename);
+	LinBox::ZeroOne<LinBox::GF2> A;
+	A.read(input);
+	input.close();
+	::Givaro::Timer tim; tim.start();
+	LinBox::rankin(r, A, LinBox::Method::SparseElimination() );
+	tim.stop();
+	F2.write(std::cout << "Rank over ") << " is " << r << ' ' << tim << std::endl;
+	return r;
+}
+
+
+
+unsigned long& LRank(unsigned long& r, char * filename, integer p)
+{
+
+	integer maxmod16; LinBox::FieldTraits<LinBox::GivaroZpz< ::Givaro::Std16> >::maxModulus(maxmod16);
+	integer maxmod32; LinBox::FieldTraits<LinBox::GivaroZpz< ::Givaro::Std32> >::maxModulus(maxmod32);
+	integer maxmod53; LinBox::FieldTraits<LinBox::Modular<double> >::maxModulus(maxmod53);
+	integer maxmod64; LinBox::FieldTraits<LinBox::GivaroZpz< ::Givaro::Std64> >::maxModulus(maxmod64);
+	if (p == 2) {
+		LinBox::GF2 F2;
+		return TempLRank(r, filename, F2);
+	}
+	else if (p <= maxmod16) {
+		typedef LinBox::GivaroZpz< ::Givaro::Std16> Field;
+		Field F(p);
+		return TempLRank(r, filename, F);
+	}
+	else if (p <= maxmod32) {
+		typedef LinBox::GivaroZpz< ::Givaro::Std32> Field;
+		Field F(p);
+		return TempLRank(r, filename, F);
+	}
+	else if (p <= maxmod53) {
+		typedef LinBox::Modular<double> Field;
+		Field F(p);
+		return TempLRank(r, filename, F);
+	}
+	else if (p <= maxmod64) {
+		typedef LinBox::GivaroZpz< ::Givaro::Std64> Field;
+		Field F(p);
+		return TempLRank(r, filename, F);
+	}
+	else {
+		typedef LinBox::GivaroZpz<integer> Field;
+		Field F(p);
+		return TempLRank(r, filename, F);
+	}
+	return r;
+}
+
+std::vector<size_t>& PRank(std::vector<size_t>& ranks, char * filename, integer p, size_t e, size_t intr)
+{
+	integer maxmod;
+	LinBox::FieldTraits<LinBox::GivaroZpz< ::Givaro::Std64> >::maxModulus(maxmod);
+	if (p <= maxmod) {
+		typedef LinBox::GivaroZpz< ::Givaro::Std64> Ring;
+		int64_t lp(p);
+		integer q = pow(p,e); int64_t lq(q);
+		if (q > integer(lq)) {
+			std::cerr << "Sorry power rank mod large composite not yet implemented" << std::endl;
+			q = p;
+			do {
+				q *= p; lq = (int64_t)q;
+			} while (q == integer(lq));
+			q/=p; lq = (int64_t)q;
+			std::cerr << "Trying: " << lq << std::endl;
+		}
+		Ring F(lq);
+		std::ifstream input(filename);
+		LinBox::MatrixStream<Ring> ms( F, input );
+		LinBox::SparseMatrix<Ring, LinBox::Vector<Ring>::SparseSeq > A (ms);
+		input.close();
+		LinBox::PowerGaussDomain< Ring > PGD( F );
+
+		PGD.prime_power_rankin( lq, lp, ranks, A, A.rowdim(), A.coldim(), std::vector<size_t>());
+		F.write(std::cout << "Ranks over ") << " are " ;
+		for(std::vector<size_t>::const_iterator rit=ranks.begin(); rit != ranks.end(); ++rit)
+			std::cout << *rit << ' ';
+		std::cout << std::endl;
+	}
+	else {
+		std::cerr << "Sorry power rank mod large composite not yet implemented" << std::endl;
+		std::cerr << "Assuming integer rank" << std::endl;
+		ranks.resize(0); ranks.push_back(intr);
+	}
+	return ranks;
+}
+
+
+
+
+using namespace LinBox;
+
+int main (int argc, char **argv)
+{
+	//     commentator.setMaxDetailLevel (-1);
+	//     commentator.setMaxDepth (-1);
+	//     commentator.setReportStream (std::cerr);
+
+
+	if (argc < 2 || argc > 4) {
+		std::cerr << "Usage: valence <matrix-file-in-supported-format> [-ata|-aat|valence] [coprime]" << std::endl;
+		return -1;
+	}
+
+	std::ifstream input (argv[1]);
+	if (!input) { std::cerr << "Error opening matrix file " << argv[1] << std::endl; return -1; }
+
+	PID_integer ZZ;
+	MatrixStream< PID_integer > ms( ZZ, input );
+	typedef SparseMatrix<PID_integer>  Blackbox;
+	Blackbox A (ms);
+	input.close();
+
+	std::cout << "A is " << A.rowdim() << " by " << A.coldim() << std::endl;
+
+	PID_integer::Element val_A;
+
+	::Givaro::Timer chrono; chrono.start();
+	if (argc >= 3) {
+		Transpose<Blackbox> T(&A);
+		if (strcmp(argv[2],"-ata") == 0) {
+			Compose< Transpose<Blackbox>, Blackbox > C (&T, &A);
+			std::cout << "A^T A is " << C.rowdim() << " by " << C.coldim() << std::endl;
+			valence(val_A, C);
+		}
+		else if (strcmp(argv[2],"-aat") == 0) {
+			Compose< Blackbox, Transpose<Blackbox> > C (&A, &T);
+			std::cout << "A A^T is " << C.rowdim() << " by " << C.coldim() << std::endl;
+			valence(val_A, C);
+		}
+		else {
+			std::cout << "Suppose primes are contained in " << argv[2] << std::endl;
+			val_A = integer(argv[2]);
+		}
+	}
+	else {
+		if (A.rowdim() != A.coldim()) {
+			std::cerr << "Valence works only on square matrices, try either to change the dimension in the matrix file, or to compute the valence of A A^T or A^T A, via the -aat or -ata options."  << std::endl;
+			exit(0);
+		}
+		else
+			valence (val_A, A);
+	}
+
+	std::cout << "Valence is " << val_A << std::endl;
+
+	std::vector<integer> Moduli;
+	std::vector<size_t> exponents;
+	::Givaro::IntFactorDom<> FTD;
+
+	typedef std::pair<integer,unsigned long> PairIntRk;
+	std::vector< PairIntRk > smith;
+
+
+	integer coprimeV=2;
+	if (argc >= 4) {
+		coprimeV = integer(argv[3]);
+	}
+	while ( gcd(val_A,coprimeV) > 1 ) {
+		FTD.nextprimein(coprimeV);
+	}
+
+	if (argc >= 4) {
+		std::cout << "Suppose " << argv[3] << " is coprime with Smith form" << std::endl;
+	}
+
+	std::cout << "integer rank: " << std::endl;
+
+	unsigned long coprimeR; LRank(coprimeR, argv[1], coprimeV);
+	smith.push_back(PairIntRk(coprimeV, coprimeR));
+	//         std::cerr << "Rank mod " << coprimeV << " is " << coprimeR << std::endl;
+
+	std::cout << "Some factors (5000 factoring loop bound): ";
+	FTD.set(Moduli, exponents, val_A, 5000);
+	std::vector<size_t>::const_iterator eit=exponents.begin();
+	for(std::vector<integer>::const_iterator mit=Moduli.begin();
+	    mit != Moduli.end(); ++mit,++eit)
+		std::cout << *mit << '^' << *eit << ' ';
+	std::cout << std::endl;
+
+	std::vector<integer> SmithDiagonal(coprimeR,integer(1));
+
+
+	for(std::vector<integer>::const_iterator mit=Moduli.begin();
+	    mit != Moduli.end(); ++mit) {
+		unsigned long r; LRank(r, argv[1], *mit);
+		//             std::cerr << "Rank mod " << *mit << " is " << r << std::endl;
+		smith.push_back(PairIntRk(*mit, r));
+		for(size_t i=r; i < coprimeR; ++i)
+			SmithDiagonal[i] *= *mit;
+	}
+
+
+	eit=exponents.begin();
+	std::vector<PairIntRk>::const_iterator sit=smith.begin();
+	for( ++sit; sit != smith.end(); ++sit, ++eit) {
+		if (sit->second != coprimeR) {
+			std::vector<size_t> ranks;
+			ranks.push_back(sit->second);
+			if (*eit > 1) {
+				PRank(ranks, argv[1], sit->first, *eit, coprimeR);
+			}
+			else {
+				PRank(ranks, argv[1], sit->first, 2, coprimeR);
+			}
+			if (ranks.size() == 1) ranks.push_back(coprimeR);
+			for(size_t expo = (*eit)<<1; ranks.back() < coprimeR; expo<<=1) {
+				PRank(ranks, argv[1], sit->first, expo, coprimeR);
+				if (ranks.size() < expo) {
+					std::cerr << "Larger prime power not yet implemented" << std::endl;
+					break;
+				}
+			}
+			std::vector<size_t>::const_iterator rit=ranks.begin();
+			unsigned long modrank = *rit;
+			for(++rit; rit!= ranks.end(); ++rit) {
+				if ((*rit)>= coprimeR) break;
+				for(size_t i=(*rit); i < coprimeR; ++i)
+					SmithDiagonal[i] *= sit->first;
+				modrank = *rit;
+			}
+		}
+	}
+
+	integer si=1;
+	size_t num=0;
+	for( std::vector<integer>::const_iterator dit=SmithDiagonal.begin();
+	     dit != SmithDiagonal.end(); ++dit) {
+		if (*dit == si) ++num;
+		else {
+			std::cerr << '[' << si << ',' << num << "] ";
+			num=1;
+			si = *dit;
+		}
+	}
+	std::cerr << '[' << si << ',' << num << "] " << std::endl;
+	chrono.stop();
+	std::cerr << chrono << std::endl;
+
+
+	return 0;
+}
diff --git a/examples/solve.C b/examples/solve.C
index 561862c..6ceb476 100644
--- a/examples/solve.C
+++ b/examples/solve.C
@@ -1,10 +1,34 @@
-// contains temp mods not to be checked in.
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/**\file examples/solve.C
-\brief Solving of sparse matrix over Z or Zp.
-\ingroup examples
-*/
-//#include "linbox-config.h"
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/*
+ * examples/solve.C
+ *
+ * Copyright (C) 2005, 2010 J-G Dumas, D. Saunders, P. Giorgi
+ *
+ * This file is part of LinBox.
+ *
+ *   LinBox is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU Lesser General Public License as
+ *   published by the Free Software Foundation, either version 2 of
+ *   the License, or (at your option) any later version.
+ *
+ *   LinBox is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Lesser General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Lesser General Public
+ *   License along with LinBox.  If not, see
+ *   <http://www.gnu.org/licenses/>.
+ */
+
+/** @file examples/solve.C
+ * @ingroup examples
+ * @brief Blackbox solvers.
+ * @warning some are commented out...
+ * @example  examples/solve.C
+ */
+
 #include <iostream>
 
 #include "linbox/field/modular-double.h"
@@ -19,216 +43,250 @@ using namespace std;
 int main (int argc, char **argv)
 {
 
-// 	commentator.setMaxDetailLevel (-1);
-// 	commentator.setMaxDepth (-1);
-// 	commentator.setReportStream (std::cerr);
-
-
-    if (argc < 2 || argc > 4) {
-        cerr << "Usage: solve <matrix-file-in-supported-format> [<dense-vector-file>] [<p>]" << endl;
-        return 0;
-    }
-    srand48( BaseTimer::seed() );
-
-    std::ifstream input (argv[1]);
-    if (!input) { cerr << "Error opening matrix file " << argv[1] << endl; return -1; }
-    std::ifstream invect;
-
-    bool createB = false;
-    int ModComp = 0;
-    if (argc == 2) {
-        createB = true;
-        ModComp = 0;
-    }
-
-    if (argc == 3) {
-        invect.open (argv[2], std::ifstream::in);
-        if (!invect) { 
-            cerr << "Creating a random {-1,1} vector " << endl;
-            createB = true;
-            ModComp = 2;
-        } else {
-            createB = false;
-            ModComp = 0;
-        }
-    }       
-
-    if (argc == 4) {
-        ModComp = 3;
-        invect.open (argv[2], std::ifstream::in);
-        if (!invect) { 
-            cerr << "Creating a random {-1,1} vector " << endl;
-            createB = true;
-        } else
-            createB = false;
-    }
-            
-
-    if (ModComp) {
-            
-        typedef Modular<double> Field;
-        double q = atof(argv[ModComp]);
-        Field F(q);
-        MatrixStream< Field > ms ( F, input );
-        SparseMatrix<Field> A (ms);  A.write(std::cout);
-        cout << "A is " << A.rowdim() << " by " << A.coldim() << endl;
-            
-        std::vector<Field::Element> X( A.coldim()),B(A.rowdim());
-        if (createB) {
-            for(std::vector<Field::Element>::iterator it=B.begin();
-                it != B.end(); ++it)
-                if (drand48() <0.5)
-                    *it = -1;
-                else
-                    *it = 1;
-        } else {
-            for(std::vector<Field::Element>::iterator it=B.begin();
-                it != B.end(); ++it)
-                invect >> *it;
-        }
-
-        std::cout << "B is [";
-        for(std::vector<Field::Element>::const_iterator it=B.begin();it != B.end(); ++it)
-            F.write(cout, *it) << " ";
-        std::cout << "]" << std::endl;
-                
-        Timer chrono; 
-
-            // Wiedemann 
-        chrono.clear();
-        chrono.start();		
-        solve (X, A, B, Method::Blackbox());
-        chrono.stop();
-		
-        std::cout << "(Wiedemann) Solution is [";
-        for(std::vector<Field::Element>::const_iterator it=X.begin();it != X.end(); ++it)
-            F.write(cout, *it) << " ";
-        std::cout << "]" << std::endl;		
-        std::cout << "CPU time (seconds): " << chrono.usertime() << std::endl<<std::endl;;
-		
-            // BlasElimination
-        chrono.start();		
-        solve (X, A, B, Method::BlasElimination());
-        chrono.stop();
-		
-        std::cout << "(BlasElimination) Solution is [";
-        for(std::vector<Field::Element>::const_iterator it=X.begin();it != X.end(); ++it)
-            F.write(cout, *it) << " ";
-        std::cout << "]" << std::endl;		
-        std::cout << "CPU time (seconds): " << chrono.usertime() << std::endl<< std::endl;
-		
-//             // Lanczos
-//         chrono.clear();
-//         chrono.start();		
-//         solve (X, A, B, Method::Lanczos());
-//         chrono.stop();
-		
-//         std::cout << "(Lanczos) Solution is [";
-//         for(std::vector<Field::Element>::const_iterator it=X.begin();it != X.end(); ++it)
-//             F.write(cout, *it) << " ";
-//         std::cout << "]" << std::endl;		
-//         std::cout << "CPU time (seconds): " << chrono.usertime() << std::endl<< std::endl;
-
-
-//             // Block Lanczos
-//         Method::BlockLanczos MBL;
-//         MBL.preconditioner(Specifier::FULL_DIAGONAL);
-//         chrono.clear();
-//         chrono.start();		
-//         solve (X, A, B, MBL);
-//         chrono.stop();
-		
-//         std::cout << "(Block Lanczos) Solution is [";
-//         for(std::vector<Field::Element>::const_iterator it=X.begin();it != X.end(); ++it)
-//             F.write(cout, *it) << " ";
-//         std::cout << "]" << std::endl;		
-//         std::cout << "CPU time (seconds): " << chrono.usertime() << std::endl<< std::endl;
-		
-    } else { 
-
-        PID_integer ZZ;
-        MatrixStream< PID_integer > ms( ZZ, input );
-        SparseMatrix<PID_integer> A (ms);
-        PID_integer::Element d;
-        std::cout << "A is " << A.rowdim() << " by " << A.coldim() << std::endl;
-
-        std::vector<PID_integer::Element> X( A.coldim()),B(A.rowdim());
-
-        if (createB) {
-            for(std::vector<PID_integer::Element>::iterator it=B.begin();
-                it != B.end(); ++it)
-                if (drand48() <0.5)
-                    *it = -1;
-                else
-                    *it = 1;
-        } else {
-            for(std::vector<PID_integer::Element>::iterator it=B.begin();
-                it != B.end(); ++it)
-                invect >> *it;
-        }
-
-
-        std::cout << "B is [";
-        for(std::vector<PID_integer::Element>::const_iterator it=B.begin();
-            it != B.end(); ++it)
-            ZZ.write(cout, *it) << " ";
-        std::cout << "]" << std::endl;
-                
-	
-        Timer chrono; 
-		
-            // Wiedemann
-        chrono.start();
-        solve (X, d, A, B, Method::Wiedemann());
-        chrono.stop();
-		
-        std::cout << "(Wiedemann) Solution is [";
-        for(std::vector<PID_integer::Element>::const_iterator it=X.begin();it != X.end(); ++it)
-            ZZ.write(cout, *it) << " ";
-        std::cout << "] / ";
-        ZZ.write(std::cout, d) << std::endl;		
-        std::cout << "CPU time (seconds): " << chrono.usertime() << std::endl;
-
-            // BlasElimination
-        chrono.start();
-        solve (X, d, A, B, Method::BlasElimination());
-        chrono.stop();
-
-        std::cout << "(BlasElimination) Solution is [";
-        for(std::vector<PID_integer::Element>::const_iterator it=X.begin();it != X.end(); ++it)
-            ZZ.write(cout, *it) << " ";
-        std::cout << "] / ";
-        ZZ.write(std::cout, d)<< std::endl;		
-        std::cout << "CPU time (seconds): " << chrono.usertime() << std::endl;
-
-
-//             // Lanczos
-//         chrono.start();
-//         solve (X, d, A, B, Method::Lanczos());
-//         chrono.stop();
-
-//         std::cout << "(Lanczos) Solution is [";
-//         for(std::vector<PID_integer::Element>::const_iterator it=X.begin();it != X.end(); ++it)
-//             ZZ.write(cout, *it) << " ";
-//         std::cout << "] / ";
-//         ZZ.write(std::cout, d) << std::endl;		
-//         std::cout << "CPU time (seconds): " << chrono.usertime() << std::endl;
-		
-
-//             // Block Lanczos
-//         chrono.clear();
-//         chrono.start();
-//         solve (X, d, A, B, Method::BlockLanczos());
-//         chrono.stop();
-
-//         std::cout << "(Block Lanczos) Solution is [";
-//         for(std::vector<PID_integer::Element>::const_iterator it=X.begin();it != X.end(); ++it)
-//             ZZ.write(cout, *it) << " ";
-//         std::cout << "] / ";
-//         ZZ.write(std::cout, d) << std::endl;		
-//         std::cout << "CPU time (seconds): " << chrono.usertime() << std::endl;
-
-    }
-
-    return 0;
+	commentator.setMaxDetailLevel (-1);
+	commentator.setMaxDepth (-1);
+	commentator.setReportStream (std::cerr);
+
+
+	if (argc < 2 || argc > 4) {
+		cerr << "Usage: solve <matrix-file-in-supported-format> [<dense-vector-file>] [<p>]" << endl;
+		return 0;
+	}
+	srand48( BaseTimer::seed() );
+
+	std::ifstream input (argv[1]);
+	if (!input) { cerr << "Error opening matrix file " << argv[1] << endl; return -1; }
+	std::ifstream invect;
+
+	bool createB = false;
+	int ModComp = 0;
+	if (argc == 2) {
+		createB = true;
+		ModComp = 0;
+	}
+
+	if (argc == 3) {
+		invect.open (argv[2], std::ifstream::in);
+		if (!invect) {
+			createB = true;
+			ModComp = 2;
+		}
+		else {
+			createB = false;
+			ModComp = 0;
+		}
+	}
+
+	if (argc == 4) {
+		ModComp = 3;
+		invect.open (argv[2], std::ifstream::in);
+		if (!invect) {
+			createB = true;
+		}
+		else
+			createB = false;
+	}
+
+
+	if (ModComp) {
+
+		typedef Modular<double> Field;
+		double q = atof(argv[ModComp]);
+		Field F(q);
+		MatrixStream< Field > ms ( F, input );
+		SparseMatrix<Field> A (ms);  // A.write(std::cout);
+		cout << "A is " << A.rowdim() << " by " << A.coldim() << endl;
+
+		std::vector<Field::Element> X( A.coldim()),B(A.rowdim());
+		if (createB) {
+			cerr << "Creating a random {-1,1} vector " << endl;
+			std::vector<Field::Element> U( A.coldim() );
+			for(std::vector<Field::Element>::iterator it=U.begin();
+			    it != U.end(); ++it)
+				if (drand48() <0.5)
+					F.init(*it,-1);
+				else
+					F.init(*it,1);
+			A.apply(B,U);
+		}
+		else {
+			for(std::vector<Field::Element>::iterator it=B.begin();
+			    it != B.end(); ++it)
+				invect >> *it;
+		}
+
+		//         A.write(std::cout << "A: ") << std::endl;
+
+		std::cout << "B is [";
+		for(std::vector<Field::Element>::const_iterator it=B.begin();it != B.end(); ++it)
+			F.write(cout, *it) << " ";
+		std::cout << "]" << std::endl;
+
+		Timer chrono;
+
+		// Sparse Elimination
+		chrono.clear();
+		chrono.start();
+		solve (X, A, B, Method::SparseElimination());
+		chrono.stop();
+
+		std::cout << "(Sparse Gauss) Solution is [";
+		for(std::vector<Field::Element>::const_iterator it=X.begin();it != X.end(); ++it)
+			F.write(cout, *it) << " ";
+		std::cout << "]" << std::endl;
+		std::cout << "CPU time (seconds): " << chrono.usertime() << std::endl<<std::endl;;
+
+		// BlasElimination
+		chrono.start();
+		solve (X, A, B, Method::BlasElimination());
+		chrono.stop();
+
+		std::cout << "(BlasElimination) Solution is [";
+		for(std::vector<Field::Element>::const_iterator it=X.begin();it != X.end(); ++it)
+			F.write(cout, *it) << " ";
+		std::cout << "]" << std::endl;
+		std::cout << "CPU time (seconds): " << chrono.usertime() << std::endl<< std::endl;
+
+		// Wiedemann
+		chrono.clear();
+		chrono.start();
+		solve (X, A, B, Method::Blackbox());
+		chrono.stop();
+
+		std::cout << "(Wiedemann) Solution is [";
+		for(std::vector<Field::Element>::const_iterator it=X.begin();it != X.end(); ++it)
+			F.write(cout, *it) << " ";
+		std::cout << "]" << std::endl;
+		std::cout << "CPU time (seconds): " << chrono.usertime() << std::endl<<std::endl;;
+#if 0
+		// Lanczos
+		chrono.clear();
+		chrono.start();
+		solve (X, A, B, Method::Lanczos());
+		chrono.stop();
+
+		std::cout << "(Lanczos) Solution is [";
+		for(std::vector<Field::Element>::const_iterator it=X.begin();it != X.end(); ++it)
+			F.write(cout, *it) << " ";
+		std::cout << "]" << std::endl;
+		std::cout << "CPU time (seconds): " << chrono.usertime() << std::endl<< std::endl;
+
+
+		// Block Lanczos
+		Method::BlockLanczos MBL;
+		MBL.preconditioner(Specifier::FULL_DIAGONAL);
+		chrono.clear();
+		chrono.start();
+		solve (X, A, B, MBL);
+		chrono.stop();
+
+		std::cout << "(Block Lanczos) Solution is [";
+		for(std::vector<Field::Element>::const_iterator it=X.begin();it != X.end(); ++it)
+			F.write(cout, *it) << " ";
+		std::cout << "]" << std::endl;
+		std::cout << "CPU time (seconds): " << chrono.usertime() << std::endl<< std::endl;
+#endif
+
+	}
+	else {
+
+		PID_integer ZZ;
+		MatrixStream< PID_integer > ms( ZZ, input );
+		SparseMatrix<PID_integer> A (ms);
+		PID_integer::Element d;
+		std::cout << "A is " << A.rowdim() << " by " << A.coldim() << std::endl;
+
+		std::vector<PID_integer::Element> X( A.coldim()),B(A.rowdim());
+
+		if (createB) {
+			cerr << "Creating a random {-1,1} vector " << endl;
+			for(std::vector<PID_integer::Element>::iterator it=B.begin();
+			    it != B.end(); ++it)
+				if (drand48() <0.5)
+					*it = -1;
+				else
+					*it = 1;
+		}
+		else {
+			for(std::vector<PID_integer::Element>::iterator it=B.begin();
+			    it != B.end(); ++it)
+				invect >> *it;
+		}
+
+
+		std::cout << "B is [";
+		for(std::vector<PID_integer::Element>::const_iterator it=B.begin();
+		    it != B.end(); ++it)
+			ZZ.write(cout, *it) << " ";
+		std::cout << "]" << std::endl;
+
+
+		Timer chrono;
+
+		// Wiedemann
+		chrono.start();
+		solve (X, d, A, B, Method::Wiedemann());
+		chrono.stop();
+
+		std::cout << "(Wiedemann) Solution is [";
+		for(std::vector<PID_integer::Element>::const_iterator it=X.begin();it != X.end(); ++it)
+			ZZ.write(cout, *it) << " ";
+		std::cout << "] / ";
+		ZZ.write(std::cout, d) << std::endl;
+		std::cout << "CPU time (seconds): " << chrono.usertime() << std::endl;
+
+		// BlasElimination
+		chrono.start();
+		solve (X, d, A, B, Method::BlasElimination());
+		chrono.stop();
+
+		std::cout << "(BlasElimination) Solution is [";
+		for(std::vector<PID_integer::Element>::const_iterator it=X.begin();it != X.end(); ++it)
+			ZZ.write(cout, *it) << " ";
+		std::cout << "] / ";
+		ZZ.write(std::cout, d)<< std::endl;
+		std::cout << "CPU time (seconds): " << chrono.usertime() << std::endl;
+
+		// Sparse Elimination
+		chrono.start();
+		solve (X, d, A, B, Method::SparseElimination());
+		chrono.stop();
+
+		std::cout << "(SparseElimination) Solution is [";
+		for(std::vector<PID_integer::Element>::const_iterator it=X.begin();it != X.end(); ++it)
+			ZZ.write(cout, *it) << " ";
+		std::cout << "] / ";
+		ZZ.write(std::cout, d)<< std::endl;
+		std::cout << "CPU time (seconds): " << chrono.usertime() << std::endl;
+
+#if 0
+		// Lanczos
+		chrono.start();
+		solve (X, d, A, B, Method::Lanczos());
+		chrono.stop();
+
+		std::cout << "(Lanczos) Solution is [";
+		for(std::vector<PID_integer::Element>::const_iterator it=X.begin();it != X.end(); ++it)
+			ZZ.write(cout, *it) << " ";
+		std::cout << "] / ";
+		ZZ.write(std::cout, d) << std::endl;
+		std::cout << "CPU time (seconds): " << chrono.usertime() << std::endl;
+
+
+		// Block Lanczos
+		chrono.clear();
+		chrono.start();
+		solve (X, d, A, B, Method::BlockLanczos());
+		chrono.stop();
+
+		std::cout << "(Block Lanczos) Solution is [";
+		for(std::vector<PID_integer::Element>::const_iterator it=X.begin();it != X.end(); ++it)
+			ZZ.write(cout, *it) << " ";
+		std::cout << "] / ";
+		ZZ.write(std::cout, d) << std::endl;
+		std::cout << "CPU time (seconds): " << chrono.usertime() << std::endl;
+#endif
+	}
+
+	return 0;
 }
diff --git a/examples/sparseelimdet.C b/examples/sparseelimdet.C
index ee05070..40cfd63 100644
--- a/examples/sparseelimdet.C
+++ b/examples/sparseelimdet.C
@@ -1,24 +1,38 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/** \file examples/rank.C
-\brief Rank of sparse matrix over Z or Zp.
-\ingroup examples
-*/
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/*
+ * examples/sparseelimdet.C
+ *
+ * Copyright (C) 2006, 2010  J-G Dumas
+ *
+ * This file is part of LinBox.
+ *
+ *   LinBox is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU Lesser General Public License as
+ *   published by the Free Software Foundation, either version 2 of
+ *   the License, or (at your option) any later version.
+ *
+ *   LinBox is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Lesser General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Lesser General Public
+ *   License along with LinBox.  If not, see
+ *   <http://www.gnu.org/licenses/>.
+ */
+
+/** \file examples/sparseelimdet.C
+ * @example  examples/sparseelimdet.C
+ \brief Gaussian elimination determinant of sparse matrix over Z or Zp.
+ \ingroup examples
+ */
 //#include "linbox-config.h"
 
 #include <iostream>
 #include <vector>
 #include <utility>
 
-template<class T>
-std::ostream& operator<< (std::ostream& o, const std::vector<std::pair<size_t, T> >& C) {
-          for(typename std::vector<std::pair<size_t, T> >::const_iterator refs =  C.begin();
-                                refs != C.end() ;
-                                      ++refs )
-		  o << '(' << refs->first << ';' << refs->second << ')';
-            return o << std::endl;
-}
-
-
 #include "linbox/field/modular-double.h"
 #include "linbox/field/gf2.h"
 #include "linbox/blackbox/sparse.h"
@@ -32,16 +46,16 @@ using namespace std;
 
 int main (int argc, char **argv)
 {
-    commentator.setMaxDetailLevel (-1);
-    commentator.setMaxDepth (-1);
-    commentator.setReportStream (std::cerr);
+	commentator.setMaxDetailLevel (-1);
+	commentator.setMaxDepth (-1);
+	commentator.setReportStream (std::cerr);
 
-	if (argc < 2 || argc > 3) 
+	if (argc < 2 || argc > 3)
 	{	cerr << "Usage: sparseelimdet <matrix-file-in-supported-format> [<p>]" << endl; return -1; }
 
 	ifstream input (argv[1]);
 	if (!input) { cerr << "Error opening matrix file: " << argv[1] << endl; return -1; }
-	
+
 	Method::SparseElimination SE;
 
 	if (argc == 2) { // determinant over the integers.
@@ -57,28 +71,28 @@ int main (int argc, char **argv)
 
 		ZZ.write(cout << "Determinant is ", d) << endl;
 	}
-	if (argc == 3) { 
+	if (argc == 3) {
 		double q = atof(argv[2]);
-                    typedef Modular<double> Field;
-		    Field::Element d;
-                    Field F(q);
-		    MatrixStream<Field> ms( F, input );
-                    SparseMatrix<Field, Vector<Field>::SparseSeq > B (ms);
-                    cout << "B is " << B.rowdim() << " by " << B.coldim() << endl;
-                    if (B.rowdim() <= 20 && B.coldim() <= 20) B.write(cout) << endl;
-
-
-		    SE.strategy(Specifier::PIVOT_NONE);
-			// using Sparse Elimination
-                    det (d, B, SE);                    
-                    if (B.rowdim() <= 20 && B.coldim() <= 20) B.write(cout) << endl;
-                    F.write(cout << "Determinant is ", d) << endl;
-
-		    SE.strategy(Specifier::PIVOT_LINEAR);
-			// using Sparse Elimination with reordering
-                    detin (d, B, SE);                    
-                    if (B.rowdim() <= 20 && B.coldim() <= 20) B.write(cout) << endl;
-                    F.write(cout << "Determinant is ", d) << endl;
+		typedef Modular<double> Field;
+		Field::Element d;
+		Field F(q);
+		MatrixStream<Field> ms( F, input );
+		SparseMatrix<Field, Vector<Field>::SparseSeq > B (ms);
+		cout << "B is " << B.rowdim() << " by " << B.coldim() << endl;
+		if (B.rowdim() <= 20 && B.coldim() <= 20) B.write(cout) << endl;
+
+
+		SE.strategy(Specifier::PIVOT_NONE);
+		// using Sparse Elimination
+		det (d, B, SE);
+		if (B.rowdim() <= 20 && B.coldim() <= 20) B.write(cout) << endl;
+		F.write(cout << "Determinant is ", d) << endl;
+
+		SE.strategy(Specifier::PIVOT_LINEAR);
+		// using Sparse Elimination with reordering
+		detin (d, B, SE);
+		if (B.rowdim() <= 20 && B.coldim() <= 20) B.write(cout) << endl;
+		F.write(cout << "Determinant is ", d) << endl;
 
 
 	}
diff --git a/examples/sparseelimrank.C b/examples/sparseelimrank.C
index 5549a41..4a5f3ff 100644
--- a/examples/sparseelimrank.C
+++ b/examples/sparseelimrank.C
@@ -1,41 +1,56 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/** \file examples/rank.C
-\brief Rank of sparse matrix over Z or Zp.
-\ingroup examples
-*/
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/*
+ * examples/sparseelimrank.C
+ *
+ * Copyright (C) 2006, 2010  J-G Dumas
+ *
+ * This file is part of LinBox.
+ *
+ *   LinBox is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU Lesser General Public License as
+ *   published by the Free Software Foundation, either version 2 of
+ *   the License, or (at your option) any later version.
+ *
+ *   LinBox is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Lesser General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Lesser General Public
+ *   License along with LinBox.  If not, see
+ *   <http://www.gnu.org/licenses/>.
+ */
+
+/** \file examples/sparseelimrank.C
+ * @example  examples/sparseelimrank.C
+ \brief Gaussian elimination Rank of sparse matrix over Z or Zp.
+ \ingroup examples
+ */
 //#include "linbox-config.h"
 
 #include <iostream>
 #include <vector>
 #include <utility>
 
-template<class T>
-std::ostream& operator<< (std::ostream& o, const std::vector<std::pair<size_t, T> >& C) {
-          for(typename std::vector<std::pair<size_t, T> >::const_iterator refs =  C.begin();
-                                refs != C.end() ;
-                                      ++refs )
-		  o << '(' << refs->first << ';' << refs->second << ')';
-            return o << std::endl;
-}
-
-
 #include "linbox/field/modular-double.h"
 #include "linbox/field/gf2.h"
 #include "linbox/blackbox/sparse.h"
 #include "linbox/blackbox/zero-one.h"
 #include "linbox/solutions/rank.h"
 #include "linbox/util/matrix-stream.h"
+#include "linbox/field/givaro-rational.h"
 
 using namespace LinBox;
 using namespace std;
 
 int main (int argc, char **argv)
 {
-    commentator.setMaxDetailLevel (-1);
-    commentator.setMaxDepth (-1);
-    commentator.setReportStream (std::cerr);
+	commentator.setMaxDetailLevel (-1);
+	commentator.setMaxDepth (-1);
+	commentator.setReportStream (std::cerr);
 
-	if (argc < 2 || argc > 3) 
+	if (argc < 2 || argc > 3)
 	{	cerr << "Usage: rank <matrix-file-in-supported-format> [<p>]" << endl; return -1; }
 
 	ifstream input (argv[1]);
@@ -45,42 +60,42 @@ int main (int argc, char **argv)
 
 	if (argc == 2) { // rank over the integers.
 
-	   /* We could pick a random prime and work mod that prime, But the point here 
-	   is that the rank function in solutions/ handles that issue.  Our matrix here 
-	   is an integer matrix and our concept is that we are getting the rank of that 
-	   matrix by some blackbox magic inside linbox.
-	   */
-		PID_integer ZZ;
-		MatrixStream<PID_integer> ms( ZZ, input );
-		SparseMatrix<PID_integer> A ( ms );
+		/* We could pick a random prime and work mod that prime, But the point here
+		   is that the rank function in solutions/ handles that issue.  Our matrix here
+		   is an integer matrix and our concept is that we are getting the rank of that
+		   matrix by some blackbox magic inside linbox.
+		   */
+		LinBox::GivaroRational ZZ;
+		MatrixStream<GivaroRational> ms( ZZ, input );
+		SparseMatrix<GivaroRational> A ( ms );
 		cout << "A is " << A.rowdim() << " by " << A.coldim() << endl;
 
-		rank (r, A);
+		rank (r, A, Method::SparseElimination() );
 
 		cout << "Rank is " << r << endl;
 	}
-	if (argc == 3) { 
+	if (argc == 3) {
 		double q = atof(argv[2]);
-                    typedef Modular<double> Field;
-                    Field F(q);
-		    MatrixStream<Field> ms( F, input );
-                    SparseMatrix<Field, Vector<Field>::SparseSeq > B (ms);
-                    cout << "B is " << B.rowdim() << " by " << B.coldim() << endl;
-                    if (B.rowdim() <= 20 && B.coldim() <= 20) B.write(cout) << endl;
-
-
-		    Method::SparseElimination SE;
-		    SE.strategy(Specifier::PIVOT_NONE);
-			// using Sparse Elimination
-                    rank (r, B, SE);                    
-                    if (B.rowdim() <= 20 && B.coldim() <= 20) B.write(cout) << endl;
-                    cout << "Rank is " << r << endl;
-
-		    SE.strategy(Specifier::PIVOT_LINEAR);
-			// using Sparse Elimination
-                    rank (r, B, SE);                    
-                    if (B.rowdim() <= 20 && B.coldim() <= 20) B.write(cout) << endl;
-                    cout << "Rank is " << r << endl;
+		typedef Modular<double> Field;
+		Field F(q);
+		MatrixStream<Field> ms( F, input );
+		SparseMatrix<Field, Vector<Field>::SparseSeq > B (ms);
+		cout << "B is " << B.rowdim() << " by " << B.coldim() << endl;
+		if (B.rowdim() <= 20 && B.coldim() <= 20) B.write(cout) << endl;
+
+
+		Method::SparseElimination SE;
+		SE.strategy(Specifier::PIVOT_NONE);
+		// using Sparse Elimination
+		rank (r, B, SE);
+		if (B.rowdim() <= 20 && B.coldim() <= 20) B.write(cout) << endl;
+		cout << "Rank is " << r << endl;
+
+		SE.strategy(Specifier::PIVOT_LINEAR);
+		// using Sparse Elimination
+		rank (r, B, SE);
+		if (B.rowdim() <= 20 && B.coldim() <= 20) B.write(cout) << endl;
+		cout << "Rank is " << r << endl;
 
 
 	}
diff --git a/examples/valence.C b/examples/valence.C
index bc21ca8..3a53eda 100644
--- a/examples/valence.C
+++ b/examples/valence.C
@@ -1,8 +1,32 @@
 /* -*- 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
+/*
+ * examples/valence.C
+ *
+ * Copyright (C) 2005, 2010  J-G Dumas
+ *
+ * This file is part of LinBox.
+ *
+ *   LinBox is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU Lesser General Public License as
+ *   published by the Free Software Foundation, either version 2 of
+ *   the License, or (at your option) any later version.
+ *
+ *   LinBox is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU Lesser General Public License for more details.
+ *
+ *   You should have received a copy of the GNU Lesser General Public
+ *   License along with LinBox.  If not, see
+ *   <http://www.gnu.org/licenses/>.
+ */
+
 /**\file examples/valence.C
-\brief Valence of sparse matrix over Z or Zp.
-\ingroup examples
-*/
+ * \brief Valence of sparse matrix over Z or Zp.
+ * \ingroup examples
+ * @example  examples/valence.C
+ */
 //#include "linbox-config.h"
 #include <iostream>
 
@@ -17,6 +41,10 @@ using namespace LinBox;
 
 int main (int argc, char **argv)
 {
+	commentator.setMaxDetailLevel (-1);
+	commentator.setMaxDepth (-1);
+	commentator.setReportStream (std::cerr);
+
 
 	if (argc < 2 || argc > 3) {
 		std::cerr << "Usage: valence <matrix-file-in-supported-format> [-ata|-aat]" << std::endl;
@@ -26,36 +54,39 @@ int main (int argc, char **argv)
 	std::ifstream input (argv[1]);
 	if (!input) { std::cerr << "Error opening matrix file " << argv[1] << std::endl; return -1; }
 
-        PID_integer ZZ;
-        MatrixStream< PID_integer > ms( ZZ, input );
-        typedef SparseMatrix<PID_integer>  Blackbox;
-        Blackbox A (ms);
-        
-        std::cout << "A is " << A.rowdim() << " by " << A.coldim() << std::endl;
-        
-        PID_integer::Element val_A;
-
-
-        if (argc == 3) {
-            Transpose<Blackbox> T(&A);
-            if (strcmp(argv[2],"-aat")) {
-                Compose< Transpose<Blackbox>, Blackbox > C (&T, &A);
-                std::cout << "A^T A is " << C.rowdim() << " by " << C.coldim() << std::endl;
-                valence(val_A, C);
-            } else {
-                Compose< Blackbox, Transpose<Blackbox> > C (&A, &T);
-                std::cout << "A A^T is " << C.rowdim() << " by " << C.coldim() << std::endl;
-                valence(val_A, C);                
-            }
-        } else {
-            if (A.rowdim() != A.coldim()) {
-                std::cerr << "Valence works only on square matrices, try either to change the dimension in the matrix file, or to compute the valence of A A^T or A^T A, via the -aat or -ata options."  << std::endl;
-                exit(0);
-            } else
-                valence (val_A, A);
-        }
-        
-        std::cout << "Valence is " << val_A << std::endl;
-        
+	PID_integer ZZ;
+	MatrixStream< PID_integer > ms( ZZ, input );
+	typedef SparseMatrix<PID_integer>  Blackbox;
+	Blackbox A (ms);
+
+	std::cout << "A is " << A.rowdim() << " by " << A.coldim() << std::endl;
+
+	PID_integer::Element val_A;
+
+
+	if (argc == 3) {
+		Transpose<Blackbox> T(&A);
+		if (strcmp(argv[2],"-aat")) {
+			Compose< Transpose<Blackbox>, Blackbox > C (&T, &A);
+			std::cout << "A^T A is " << C.rowdim() << " by " << C.coldim() << std::endl;
+			valence(val_A, C);
+		}
+		else {
+			Compose< Blackbox, Transpose<Blackbox> > C (&A, &T);
+			std::cout << "A A^T is " << C.rowdim() << " by " << C.coldim() << std::endl;
+			valence(val_A, C);
+		}
+	}
+	else {
+		if (A.rowdim() != A.coldim()) {
+			std::cerr << "Valence works only on square matrices, try either to change the dimension in the matrix file, or to compute the valence of A A^T or A^T A, via the -aat or -ata options."  << std::endl;
+			exit(0);
+		}
+		else
+			valence (val_A, A);
+	}
+
+	std::cout << "Valence is " << val_A << std::endl;
+
 	return 0;
 }
diff --git a/install-sh b/install-sh
deleted file mode 100755
index a5897de..0000000
--- a/install-sh
+++ /dev/null
@@ -1,519 +0,0 @@
-#!/bin/sh
-# install - install a program, script, or datafile
-
-scriptversion=2006-12-25.00
-
-# This originates from X11R5 (mit/util/scripts/install.sh), which was
-# later released in X11R6 (xc/config/util/install.sh) with the
-# following copyright and license.
-#
-# Copyright (C) 1994 X Consortium
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to
-# deal in the Software without restriction, including without limitation the
-# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-# sell copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
-# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# Except as contained in this notice, the name of the X Consortium shall not
-# be used in advertising or otherwise to promote the sale, use or other deal-
-# ings in this Software without prior written authorization from the X Consor-
-# tium.
-#
-#
-# FSF changes to this file are in the public domain.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.
-
-nl='
-'
-IFS=" ""	$nl"
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit=${DOITPROG-}
-if test -z "$doit"; then
-  doit_exec=exec
-else
-  doit_exec=$doit
-fi
-
-# Put in absolute file names if you don't have them in your path;
-# or use environment vars.
-
-chgrpprog=${CHGRPPROG-chgrp}
-chmodprog=${CHMODPROG-chmod}
-chownprog=${CHOWNPROG-chown}
-cmpprog=${CMPPROG-cmp}
-cpprog=${CPPROG-cp}
-mkdirprog=${MKDIRPROG-mkdir}
-mvprog=${MVPROG-mv}
-rmprog=${RMPROG-rm}
-stripprog=${STRIPPROG-strip}
-
-posix_glob='?'
-initialize_posix_glob='
-  test "$posix_glob" != "?" || {
-    if (set -f) 2>/dev/null; then
-      posix_glob=
-    else
-      posix_glob=:
-    fi
-  }
-'
-
-posix_mkdir=
-
-# Desired mode of installed file.
-mode=0755
-
-chgrpcmd=
-chmodcmd=$chmodprog
-chowncmd=
-mvcmd=$mvprog
-rmcmd="$rmprog -f"
-stripcmd=
-
-src=
-dst=
-dir_arg=
-dst_arg=
-
-copy_on_change=false
-no_target_directory=
-
-usage="\
-Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
-   or: $0 [OPTION]... SRCFILES... DIRECTORY
-   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
-   or: $0 [OPTION]... -d DIRECTORIES...
-
-In the 1st form, copy SRCFILE to DSTFILE.
-In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
-In the 4th, create DIRECTORIES.
-
-Options:
-     --help     display this help and exit.
-     --version  display version info and exit.
-
-  -c            (ignored)
-  -C            install only if different (preserve the last data modification time)
-  -d            create directories instead of installing files.
-  -g GROUP      $chgrpprog installed files to GROUP.
-  -m MODE       $chmodprog installed files to MODE.
-  -o USER       $chownprog installed files to USER.
-  -s            $stripprog installed files.
-  -t DIRECTORY  install into DIRECTORY.
-  -T            report an error if DSTFILE is a directory.
-
-Environment variables override the default commands:
-  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
-  RMPROG STRIPPROG
-"
-
-while test $# -ne 0; do
-  case $1 in
-    -c) ;;
-
-    -C) copy_on_change=true;;
-
-    -d) dir_arg=true;;
-
-    -g) chgrpcmd="$chgrpprog $2"
-	shift;;
-
-    --help) echo "$usage"; exit $?;;
-
-    -m) mode=$2
-	case $mode in
-	  *' '* | *'	'* | *'
-'*	  | *'*'* | *'?'* | *'['*)
-	    echo "$0: invalid mode: $mode" >&2
-	    exit 1;;
-	esac
-	shift;;
-
-    -o) chowncmd="$chownprog $2"
-	shift;;
-
-    -s) stripcmd=$stripprog;;
-
-    -t) dst_arg=$2
-	shift;;
-
-    -T) no_target_directory=true;;
-
-    --version) echo "$0 $scriptversion"; exit $?;;
-
-    --)	shift
-	break;;
-
-    -*)	echo "$0: invalid option: $1" >&2
-	exit 1;;
-
-    *)  break;;
-  esac
-  shift
-done
-
-if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
-  # When -d is used, all remaining arguments are directories to create.
-  # When -t is used, the destination is already specified.
-  # Otherwise, the last argument is the destination.  Remove it from $@.
-  for arg
-  do
-    if test -n "$dst_arg"; then
-      # $@ is not empty: it contains at least $arg.
-      set fnord "$@" "$dst_arg"
-      shift # fnord
-    fi
-    shift # arg
-    dst_arg=$arg
-  done
-fi
-
-if test $# -eq 0; then
-  if test -z "$dir_arg"; then
-    echo "$0: no input file specified." >&2
-    exit 1
-  fi
-  # It's OK to call `install-sh -d' without argument.
-  # This can happen when creating conditional directories.
-  exit 0
-fi
-
-if test -z "$dir_arg"; then
-  trap '(exit $?); exit' 1 2 13 15
-
-  # Set umask so as not to create temps with too-generous modes.
-  # However, 'strip' requires both read and write access to temps.
-  case $mode in
-    # Optimize common cases.
-    *644) cp_umask=133;;
-    *755) cp_umask=22;;
-
-    *[0-7])
-      if test -z "$stripcmd"; then
-	u_plus_rw=
-      else
-	u_plus_rw='% 200'
-      fi
-      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
-    *)
-      if test -z "$stripcmd"; then
-	u_plus_rw=
-      else
-	u_plus_rw=,u+rw
-      fi
-      cp_umask=$mode$u_plus_rw;;
-  esac
-fi
-
-for src
-do
-  # Protect names starting with `-'.
-  case $src in
-    -*) src=./$src;;
-  esac
-
-  if test -n "$dir_arg"; then
-    dst=$src
-    dstdir=$dst
-    test -d "$dstdir"
-    dstdir_status=$?
-  else
-
-    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
-    # might cause directories to be created, which would be especially bad
-    # if $src (and thus $dsttmp) contains '*'.
-    if test ! -f "$src" && test ! -d "$src"; then
-      echo "$0: $src does not exist." >&2
-      exit 1
-    fi
-
-    if test -z "$dst_arg"; then
-      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.
-    if test -d "$dst"; then
-      if test -n "$no_target_directory"; then
-	echo "$0: $dst_arg: Is a directory" >&2
-	exit 1
-      fi
-      dstdir=$dst
-      dst=$dstdir/`basename "$src"`
-      dstdir_status=0
-    else
-      # Prefer dirname, but fall back on a substitute if dirname fails.
-      dstdir=`
-	(dirname "$dst") 2>/dev/null ||
-	expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-	     X"$dst" : 'X\(//\)[^/]' \| \
-	     X"$dst" : 'X\(//\)$' \| \
-	     X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
-	echo X"$dst" |
-	    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\/\)[^/].*/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\/\)$/{
-		   s//\1/
-		   q
-		 }
-		 /^X\(\/\).*/{
-		   s//\1/
-		   q
-		 }
-		 s/.*/./; q'
-      `
-
-      test -d "$dstdir"
-      dstdir_status=$?
-    fi
-  fi
-
-  obsolete_mkdir_used=false
-
-  if test $dstdir_status != 0; then
-    case $posix_mkdir in
-      '')
-	# Create intermediate dirs using mode 755 as modified by the umask.
-	# This is like FreeBSD 'install' as of 1997-10-28.
-	umask=`umask`
-	case $stripcmd.$umask in
-	  # Optimize common cases.
-	  *[2367][2367]) mkdir_umask=$umask;;
-	  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
-
-	  *[0-7])
-	    mkdir_umask=`expr $umask + 22 \
-	      - $umask % 100 % 40 + $umask % 20 \
-	      - $umask % 10 % 4 + $umask % 2
-	    `;;
-	  *) mkdir_umask=$umask,go-w;;
-	esac
-
-	# With -d, create the new directory with the user-specified mode.
-	# Otherwise, rely on $mkdir_umask.
-	if test -n "$dir_arg"; then
-	  mkdir_mode=-m$mode
-	else
-	  mkdir_mode=
-	fi
-
-	posix_mkdir=false
-	case $umask in
-	  *[123567][0-7][0-7])
-	    # POSIX mkdir -p sets u+wx bits regardless of umask, which
-	    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
-	    ;;
-	  *)
-	    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
-	    trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
-
-	    if (umask $mkdir_umask &&
-		exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
-	    then
-	      if test -z "$dir_arg" || {
-		   # Check for POSIX incompatibilities with -m.
-		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
-		   # other-writeable bit of parent directory when it shouldn't.
-		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
-		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
-		   case $ls_ld_tmpdir in
-		     d????-?r-*) different_mode=700;;
-		     d????-?--*) different_mode=755;;
-		     *) false;;
-		   esac &&
-		   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
-		     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
-		     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
-		   }
-		 }
-	      then posix_mkdir=:
-	      fi
-	      rmdir "$tmpdir/d" "$tmpdir"
-	    else
-	      # Remove any dirs left behind by ancient mkdir implementations.
-	      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
-	    fi
-	    trap '' 0;;
-	esac;;
-    esac
-
-    if
-      $posix_mkdir && (
-	umask $mkdir_umask &&
-	$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
-      )
-    then :
-    else
-
-      # The umask is ridiculous, or mkdir does not conform to POSIX,
-      # or it failed possibly due to a race condition.  Create the
-      # directory the slow way, step by step, checking for races as we go.
-
-      case $dstdir in
-	/*) prefix='/';;
-	-*) prefix='./';;
-	*)  prefix='';;
-      esac
-
-      eval "$initialize_posix_glob"
-
-      oIFS=$IFS
-      IFS=/
-      $posix_glob set -f
-      set fnord $dstdir
-      shift
-      $posix_glob set +f
-      IFS=$oIFS
-
-      prefixes=
-
-      for d
-      do
-	test -z "$d" && continue
-
-	prefix=$prefix$d
-	if test -d "$prefix"; then
-	  prefixes=
-	else
-	  if $posix_mkdir; then
-	    (umask=$mkdir_umask &&
-	     $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
-	    # Don't fail if two instances are running concurrently.
-	    test -d "$prefix" || exit 1
-	  else
-	    case $prefix in
-	      *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
-	      *) qprefix=$prefix;;
-	    esac
-	    prefixes="$prefixes '$qprefix'"
-	  fi
-	fi
-	prefix=$prefix/
-      done
-
-      if test -n "$prefixes"; then
-	# Don't fail if two instances are running concurrently.
-	(umask $mkdir_umask &&
-	 eval "\$doit_exec \$mkdirprog $prefixes") ||
-	  test -d "$dstdir" || exit 1
-	obsolete_mkdir_used=true
-      fi
-    fi
-  fi
-
-  if test -n "$dir_arg"; then
-    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
-    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
-    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
-      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
-  else
-
-    # Make a couple of temp file names in the proper directory.
-    dsttmp=$dstdir/_inst.$$_
-    rmtmp=$dstdir/_rm.$$_
-
-    # Trap to clean up those temp files at exit.
-    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
-
-    # Copy the file name to the temp name.
-    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
-
-    # and set any options; do chmod last to preserve setuid bits.
-    #
-    # If any of these fail, we abort the whole thing.  If we want to
-    # ignore errors from any of these, just make sure not to ignore
-    # errors from the above "$doit $cpprog $src $dsttmp" command.
-    #
-    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
-    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
-    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
-    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
-
-    # If -C, don't bother to copy if it wouldn't change the file.
-    if $copy_on_change &&
-       old=`LC_ALL=C ls -dlL "$dst"	2>/dev/null` &&
-       new=`LC_ALL=C ls -dlL "$dsttmp"	2>/dev/null` &&
-
-       eval "$initialize_posix_glob" &&
-       $posix_glob set -f &&
-       set X $old && old=:$2:$4:$5:$6 &&
-       set X $new && new=:$2:$4:$5:$6 &&
-       $posix_glob set +f &&
-
-       test "$old" = "$new" &&
-       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
-    then
-      rm -f "$dsttmp"
-    else
-      # Rename the file to the real destination.
-      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
-
-      # The rename failed, perhaps because mv can't rename something else
-      # to itself, or perhaps because mv is so ancient that it does not
-      # support -f.
-      {
-	# Now remove or move aside any old file at destination location.
-	# We try this two ways since rm can't unlink itself on some
-	# systems and the destination file might be busy for other
-	# reasons.  In this case, the final cleanup might fail but the new
-	# file should still install successfully.
-	{
-	  test ! -f "$dst" ||
-	  $doit $rmcmd -f "$dst" 2>/dev/null ||
-	  { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
-	    { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
-	  } ||
-	  { echo "$0: cannot unlink or rename $dst" >&2
-	    (exit 1); exit 1
-	  }
-	} &&
-
-	# Now rename the file to the real destination.
-	$doit $mvcmd "$dsttmp" "$dst"
-      }
-    fi || exit 1
-
-    trap '' 0
-  fi
-done
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
diff --git a/interfaces/Makefile.am b/interfaces/Makefile.am
index ec71e59..d16a9cc 100644
--- a/interfaces/Makefile.am
+++ b/interfaces/Makefile.am
@@ -1,3 +1,6 @@
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 SUBDIRS=driver kaapi maple sage
 
 
diff --git a/interfaces/Makefile.in b/interfaces/Makefile.in
index d1224b4..08fd668 100644
--- a/interfaces/Makefile.in
+++ b/interfaces/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -35,19 +36,26 @@ subdir = interfaces
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
-	$(top_srcdir)/macros/blas-check.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
 	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
 	$(top_srcdir)/macros/givaro-check.m4 \
 	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
 	$(top_srcdir)/macros/lidia-check.m4 \
 	$(top_srcdir)/macros/linbox-doc.m4 \
 	$(top_srcdir)/macros/linbox-misc.m4 \
 	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
 	$(top_srcdir)/macros/maple-check.m4 \
 	$(top_srcdir)/macros/ntl-check.m4 \
 	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -78,18 +86,21 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
 CC = @CC@
+CCNAM = @CCNAM@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
 DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -97,19 +108,24 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
 GIVARO_CFLAGS = @GIVARO_CFLAGS@
 GIVARO_LIBS = @GIVARO_LIBS@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
 GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
@@ -117,41 +133,52 @@ LIBTOOL = @LIBTOOL@
 LIDIA_CFLAGS = @LIDIA_CFLAGS@
 LIDIA_LIBS = @LIDIA_LIBS@
 LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MAPLE_CFLAGS = @MAPLE_CFLAGS@
 MAPLE_HOME = @MAPLE_HOME@
 MAPLE_LIBS = @MAPLE_LIBS@
 MAPLE_VERSION = @MAPLE_VERSION@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
 NTL_CFLAGS = @NTL_CFLAGS@
 NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RM = @RM@
 SACLIB_CFLAGS = @SACLIB_CFLAGS@
 SACLIB_LIBS = @SACLIB_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+TESTS_CFLAGS = @TESTS_CFLAGS@
 VERSION = @VERSION@
+WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -192,8 +219,13 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 SUBDIRS = driver kaapi maple sage
 all: all-recursive
 
@@ -202,8 +234,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
 	      exit 1;; \
 	  esac; \
 	done; \
@@ -241,7 +273,7 @@ clean-libtool:
 #     (which will cause the Makefiles to be regenerated when you run `make');
 # (2) otherwise, pass the desired values on the `make' command line.
 $(RECURSIVE_TARGETS):
-	@failcom='exit 1'; \
+	@fail= failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
 	    *=* | --[!k]*);; \
@@ -266,7 +298,7 @@ $(RECURSIVE_TARGETS):
 	fi; test -z "$$fail"
 
 $(RECURSIVE_CLEAN_TARGETS):
-	@failcom='exit 1'; \
+	@fail= failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
 	    *=* | --[!k]*);; \
@@ -309,7 +341,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
@@ -450,6 +482,8 @@ dvi-am:
 
 html: html-recursive
 
+html-am:
+
 info: info-recursive
 
 info-am:
@@ -458,18 +492,28 @@ install-data-am:
 
 install-dvi: install-dvi-recursive
 
+install-dvi-am:
+
 install-exec-am:
 
 install-html: install-html-recursive
 
+install-html-am:
+
 install-info: install-info-recursive
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-recursive
 
+install-pdf-am:
+
 install-ps: install-ps-recursive
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-recursive
diff --git a/interfaces/driver/Makefile.am b/interfaces/driver/Makefile.am
index 70b26d9..7bf29fd 100644
--- a/interfaces/driver/Makefile.am
+++ b/interfaces/driver/Makefile.am
@@ -1,9 +1,12 @@
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 if LINBOX_COMPILE_DRIVERS
 pkgincludesubdir=$(includedir)/interfaces/driver
 
-INCLUDES=-I$(top_srcdir) -I. -I../../linbox
+AM_CPPFLAGS=-I$(top_srcdir) -I. -I../../linbox
 
-AM_CXXFLAGS = -O2 -DDISABLE_COMMENTATOR $(GMP_CFLAGS) $(BLAS_CFLAGS) $(GIVARO_CFLAGS)
+AM_CXXFLAGS = @DEFAULT_CFLAGS@ -DDISABLE_COMMENTATOR $(GMP_CFLAGS) $(FFLAFLAS_CFLAGS) $(BLAS_CFLAGS) $(GIVARO_CFLAGS)
 
 #ifdef HAVE_NTL
 AM_CXXFLAGS +=$(NTL_CFLAGS)
@@ -11,58 +14,58 @@ AM_CXXFLAGS +=$(NTL_CFLAGS)
 
 #LDADD= $(GMP_LIBS) $(NTL_LIBS) $(BLAS_LIBS) $(MAPLE_LIBS) $(GIVARO_LIBS) "../../linbox/liblinbox.la -z muldefs"
 
-lib_LTLIBRARIES=liblbdriver.la 
+lib_LTLIBRARIES=liblbdriver.la
 
 
 liblbdriver_la_SOURCES= lb-element.C 	\
-			lb-domain.C 	\
-			lb-blackbox.C 	\
-			lb-vector.C	\
-			lb-polynomial.C	\
-			lb-garbage.C	\
-			lb-det.C		\
-			lb-rank.C 	\
-			lb-minpoly.C 	\
-			lb-charpoly.C 	\
-			lb-solve.C 	
+			lb-domain.C     \
+			lb-blackbox.C   \
+			lb-vector.C     \
+			lb-polynomial.C \
+			lb-garbage.C    \
+			lb-det.C        \
+			lb-rank.C       \
+			lb-minpoly.C    \
+			lb-charpoly.C   \
+			lb-solve.C
 
-liblbdriver_la_LDFLAGS=$(GMP_LIBS) $(NTL_LIBS) $(BLAS_LIBS) $(GIVARO_LIBS) $(top_srcdir)/linbox/liblinbox.la -Wl,-zmuldefs
+liblbdriver_la_LDFLAGS=$(GIVARO_LIBS) $(GMP_LIBS) $(NTL_LIBS) $(BLAS_LIBS) $(top_srcdir)/linbox/liblinbox.la -Wl,-zmuldefs
 
 pkginclude_HEADERS=\
-		lb-driver.h	\
-		lb-blackbox-abstract.h		\
-		lb-blackbox-type.h  		\
-		lb-domain-function.h   		\
-		lb-element-collection.h  	\
-		lb-polynomial.h         	\
-		lb-vector-data.h		\
-		lb-blackbox-collection.h 	\
-		lb-charpoly.h			\
-	        lb-domain-functor.h		\
-		lb-element-data.h		\
-		lb-rank.h			\
-		lb-vector-function.h	 	\
-		lb-blackbox-data.h      	\
-		lb-det.h                	\
-		lb-domain.h 			\
-		lb-element.h			\
-		lb-solve.h			\
-		lb-vector-functor.h		\
-		lb-blackbox-function.h		\
-		lb-domain-abstract.h		\
-		lb-domain-type.h		\
-		lb-garbage.h			\
-		lb-utilities.h          	\
-		lb-vector.h			\
-		lb-blackbox-functor.h		\
-		lb-domain-collection.h		\
-		lb-driver.h			\
-		lb-interface.h			\
-		lb-vector-abstract.h		\
-		lb-vector-type.h		\
-		lb-blackbox.h			\
-		lb-domain-data.h		\
-		lb-element-abstract.h		\
-		lb-minpoly.h			\
-		lb-vector-collection.h			
-endif
\ No newline at end of file
+		lb-driver.h              \
+		lb-blackbox-abstract.h   \
+		lb-blackbox-type.h       \
+		lb-domain-function.h     \
+		lb-element-collection.h  \
+		lb-polynomial.h          \
+		lb-vector-data.h         \
+		lb-blackbox-collection.h \
+		lb-charpoly.h            \
+		lb-domain-functor.h      \
+		lb-element-data.h        \
+		lb-rank.h                \
+		lb-vector-function.h     \
+		lb-blackbox-data.h       \
+		lb-det.h                 \
+		lb-domain.h              \
+		lb-element.h             \
+		lb-solve.h               \
+		lb-vector-functor.h      \
+		lb-blackbox-function.h   \
+		lb-domain-abstract.h     \
+		lb-domain-type.h         \
+		lb-garbage.h             \
+		lb-utilities.h           \
+		lb-vector.h              \
+		lb-blackbox-functor.h    \
+		lb-domain-collection.h   \
+		lb-driver.h              \
+		lb-interface.h           \
+		lb-vector-abstract.h     \
+		lb-vector-type.h         \
+		lb-blackbox.h            \
+		lb-domain-data.h         \
+		lb-element-abstract.h    \
+		lb-minpoly.h             \
+		lb-vector-collection.h
+endif
diff --git a/interfaces/driver/Makefile.in b/interfaces/driver/Makefile.in
index cd299e4..3585f95 100644
--- a/interfaces/driver/Makefile.in
+++ b/interfaces/driver/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -38,19 +39,26 @@ DIST_COMMON = $(am__pkginclude_HEADERS_DIST) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
-	$(top_srcdir)/macros/blas-check.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
 	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
 	$(top_srcdir)/macros/givaro-check.m4 \
 	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
 	$(top_srcdir)/macros/lidia-check.m4 \
 	$(top_srcdir)/macros/linbox-doc.m4 \
 	$(top_srcdir)/macros/linbox-misc.m4 \
 	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
 	$(top_srcdir)/macros/maple-check.m4 \
 	$(top_srcdir)/macros/ntl-check.m4 \
 	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -121,18 +129,21 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
 CC = @CC@
+CCNAM = @CCNAM@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
 DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -140,19 +151,24 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
 GIVARO_CFLAGS = @GIVARO_CFLAGS@
 GIVARO_LIBS = @GIVARO_LIBS@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
 GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
@@ -160,41 +176,52 @@ LIBTOOL = @LIBTOOL@
 LIDIA_CFLAGS = @LIDIA_CFLAGS@
 LIDIA_LIBS = @LIDIA_LIBS@
 LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MAPLE_CFLAGS = @MAPLE_CFLAGS@
 MAPLE_HOME = @MAPLE_HOME@
 MAPLE_LIBS = @MAPLE_LIBS@
 MAPLE_VERSION = @MAPLE_VERSION@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
 NTL_CFLAGS = @NTL_CFLAGS@
 NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RM = @RM@
 SACLIB_CFLAGS = @SACLIB_CFLAGS@
 SACLIB_LIBS = @SACLIB_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+TESTS_CFLAGS = @TESTS_CFLAGS@
 VERSION = @VERSION@
+WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -235,69 +262,76 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 @LINBOX_COMPILE_DRIVERS_TRUE at pkgincludesubdir = $(includedir)/interfaces/driver
- at LINBOX_COMPILE_DRIVERS_TRUE@INCLUDES = -I$(top_srcdir) -I. -I../../linbox
+ at LINBOX_COMPILE_DRIVERS_TRUE@AM_CPPFLAGS = -I$(top_srcdir) -I. -I../../linbox
 
 #ifdef HAVE_NTL
- at LINBOX_COMPILE_DRIVERS_TRUE@AM_CXXFLAGS = -O2 -DDISABLE_COMMENTATOR \
- at LINBOX_COMPILE_DRIVERS_TRUE@	$(GMP_CFLAGS) $(BLAS_CFLAGS) \
- at LINBOX_COMPILE_DRIVERS_TRUE@	$(GIVARO_CFLAGS) $(NTL_CFLAGS)
+ at LINBOX_COMPILE_DRIVERS_TRUE@AM_CXXFLAGS = @DEFAULT_CFLAGS@ \
+ at LINBOX_COMPILE_DRIVERS_TRUE@	-DDISABLE_COMMENTATOR \
+ at LINBOX_COMPILE_DRIVERS_TRUE@	$(GMP_CFLAGS) $(FFLAFLAS_CFLAGS) \
+ at LINBOX_COMPILE_DRIVERS_TRUE@	$(BLAS_CFLAGS) $(GIVARO_CFLAGS) \
+ at LINBOX_COMPILE_DRIVERS_TRUE@	$(NTL_CFLAGS)
 #endif
 
 #LDADD= $(GMP_LIBS) $(NTL_LIBS) $(BLAS_LIBS) $(MAPLE_LIBS) $(GIVARO_LIBS) "../../linbox/liblinbox.la -z muldefs"
- at LINBOX_COMPILE_DRIVERS_TRUE@lib_LTLIBRARIES = liblbdriver.la 
+ at LINBOX_COMPILE_DRIVERS_TRUE@lib_LTLIBRARIES = liblbdriver.la
 @LINBOX_COMPILE_DRIVERS_TRUE at liblbdriver_la_SOURCES = lb-element.C 	\
- at LINBOX_COMPILE_DRIVERS_TRUE@			lb-domain.C 	\
- at LINBOX_COMPILE_DRIVERS_TRUE@			lb-blackbox.C 	\
- at LINBOX_COMPILE_DRIVERS_TRUE@			lb-vector.C	\
- at LINBOX_COMPILE_DRIVERS_TRUE@			lb-polynomial.C	\
- at LINBOX_COMPILE_DRIVERS_TRUE@			lb-garbage.C	\
- at LINBOX_COMPILE_DRIVERS_TRUE@			lb-det.C		\
- at LINBOX_COMPILE_DRIVERS_TRUE@			lb-rank.C 	\
- at LINBOX_COMPILE_DRIVERS_TRUE@			lb-minpoly.C 	\
- at LINBOX_COMPILE_DRIVERS_TRUE@			lb-charpoly.C 	\
- at LINBOX_COMPILE_DRIVERS_TRUE@			lb-solve.C 	
-
- at LINBOX_COMPILE_DRIVERS_TRUE@liblbdriver_la_LDFLAGS = $(GMP_LIBS) $(NTL_LIBS) $(BLAS_LIBS) $(GIVARO_LIBS) $(top_srcdir)/linbox/liblinbox.la -Wl,-zmuldefs
+ at LINBOX_COMPILE_DRIVERS_TRUE@			lb-domain.C     \
+ at LINBOX_COMPILE_DRIVERS_TRUE@			lb-blackbox.C   \
+ at LINBOX_COMPILE_DRIVERS_TRUE@			lb-vector.C     \
+ at LINBOX_COMPILE_DRIVERS_TRUE@			lb-polynomial.C \
+ at LINBOX_COMPILE_DRIVERS_TRUE@			lb-garbage.C    \
+ at LINBOX_COMPILE_DRIVERS_TRUE@			lb-det.C        \
+ at LINBOX_COMPILE_DRIVERS_TRUE@			lb-rank.C       \
+ at LINBOX_COMPILE_DRIVERS_TRUE@			lb-minpoly.C    \
+ at LINBOX_COMPILE_DRIVERS_TRUE@			lb-charpoly.C   \
+ at LINBOX_COMPILE_DRIVERS_TRUE@			lb-solve.C
+
+ at LINBOX_COMPILE_DRIVERS_TRUE@liblbdriver_la_LDFLAGS = $(GIVARO_LIBS) $(GMP_LIBS) $(NTL_LIBS) $(BLAS_LIBS) $(top_srcdir)/linbox/liblinbox.la -Wl,-zmuldefs
 @LINBOX_COMPILE_DRIVERS_TRUE at pkginclude_HEADERS = \
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-driver.h	\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-blackbox-abstract.h		\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-blackbox-type.h  		\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-domain-function.h   		\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-element-collection.h  	\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-polynomial.h         	\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-vector-data.h		\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-blackbox-collection.h 	\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-charpoly.h			\
- at LINBOX_COMPILE_DRIVERS_TRUE@	        lb-domain-functor.h		\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-element-data.h		\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-rank.h			\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-vector-function.h	 	\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-blackbox-data.h      	\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-det.h                	\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-domain.h 			\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-element.h			\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-solve.h			\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-vector-functor.h		\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-blackbox-function.h		\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-domain-abstract.h		\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-domain-type.h		\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-garbage.h			\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-utilities.h          	\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-vector.h			\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-blackbox-functor.h		\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-domain-collection.h		\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-driver.h			\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-interface.h			\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-vector-abstract.h		\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-vector-type.h		\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-blackbox.h			\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-domain-data.h		\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-element-abstract.h		\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-minpoly.h			\
- at LINBOX_COMPILE_DRIVERS_TRUE@		lb-vector-collection.h			
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-driver.h              \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-blackbox-abstract.h   \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-blackbox-type.h       \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-domain-function.h     \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-element-collection.h  \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-polynomial.h          \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-vector-data.h         \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-blackbox-collection.h \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-charpoly.h            \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-domain-functor.h      \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-element-data.h        \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-rank.h                \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-vector-function.h     \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-blackbox-data.h       \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-det.h                 \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-domain.h              \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-element.h             \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-solve.h               \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-vector-functor.h      \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-blackbox-function.h   \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-domain-abstract.h     \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-domain-type.h         \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-garbage.h             \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-utilities.h           \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-vector.h              \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-blackbox-functor.h    \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-domain-collection.h   \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-driver.h              \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-interface.h           \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-vector-abstract.h     \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-vector-type.h         \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-blackbox.h            \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-domain-data.h         \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-element-abstract.h    \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-minpoly.h             \
+ at LINBOX_COMPILE_DRIVERS_TRUE@		lb-vector-collection.h
 
 all: all-am
 
@@ -307,8 +341,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
 	      exit 1;; \
 	  esac; \
 	done; \
@@ -405,7 +439,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
@@ -520,6 +554,8 @@ dvi-am:
 
 html: html-am
 
+html-am:
+
 info: info-am
 
 info-am:
@@ -528,18 +564,28 @@ install-data-am: install-pkgincludeHEADERS
 
 install-dvi: install-dvi-am
 
+install-dvi-am:
+
 install-exec-am: install-libLTLIBRARIES
 
 install-html: install-html-am
 
+install-html-am:
+
 install-info: install-info-am
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-am
 
+install-pdf-am:
+
 install-ps: install-ps-am
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
diff --git a/interfaces/driver/lb-blackbox-abstract.h b/interfaces/driver/lb-blackbox-abstract.h
old mode 100755
new mode 100644
index 39f00fb..0027bf4
--- a/interfaces/driver/lb-blackbox-abstract.h
+++ b/interfaces/driver/lb-blackbox-abstract.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-blackbox-abstract.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_BLACKBOX_ABSTRACT_H
-#define __LINBOX_LB_BLACKBOX_ABSTRACT_H
+#ifndef __LINBOX_lb_blackbox_abstract_H
+#define __LINBOX_lb_blackbox_abstract_H
 
 #include <lb-utilities.h>
 #include <lb-domain-collection.h>
diff --git a/interfaces/driver/lb-blackbox-collection.h b/interfaces/driver/lb-blackbox-collection.h
old mode 100755
new mode 100644
index a05e56d..098dbdb
--- a/interfaces/driver/lb-blackbox-collection.h
+++ b/interfaces/driver/lb-blackbox-collection.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-blackbox-collection.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_BLACKBOX_COLLECTION_H
-#define __LINBOX_LB_BLACKBOX_COLLECTION_H
+#ifndef __LINBOX_lb_blackbox_collection_H
+#define __LINBOX_lb_blackbox_collection_H
 
 #include <map>
 #include <lb-blackbox-abstract.h>
@@ -31,7 +32,7 @@
  * Collection of Blackbox *
  **************************/
 
-// definition of a key 
+// definition of a key
 typedef size_t  BlackboxKey;
 
 // comparison functor on key
@@ -43,6 +44,6 @@ typedef std::map<BlackboxKey, BlackboxAbstract*, BlackboxKeyLessThan>   Blackbox
 
 
 
- 
+
 
 #endif
diff --git a/interfaces/driver/lb-blackbox-data.h b/interfaces/driver/lb-blackbox-data.h
old mode 100755
new mode 100644
index e108ee7..b418503
--- a/interfaces/driver/lb-blackbox-data.h
+++ b/interfaces/driver/lb-blackbox-data.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-blackbox-data.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_BLACKBOX_DATA_H
-#define __LINBOX_LB_BLACKBOX_DATA_H
+#ifndef __LINBOX_lb_blackbox_data_H
+#define __LINBOX_lb_blackbox_data_H
 
 #include <linbox/blackbox/sparse.h>
 #include <linbox/blackbox/blas-blackbox.h>
@@ -50,7 +51,7 @@ class BlackboxSpecFunctor{
 	void *ptr;
 public:
 	BlackboxSpecFunctor(const Functor &f, void *p) : fct(f), ptr(p) {}
-	
+
 	template<class Domain, class Result>
 	void  operator()(Result &res, Domain *d) const{
 		Blackbox<Domain> * b= static_cast<Blackbox<Domain>*> (ptr);
@@ -68,13 +69,13 @@ public:
 	typedef BlackboxAbstract* (*createBlackbox_1_CallBack)(const DomainKey &, size_t, size_t, const char*);
 	typedef BlackboxAbstract* (*createBlackbox_2_CallBack)(const DomainKey &, std::istream&, const char*);
 	typedef std::map<const char*, std::pair<createBlackbox_1_CallBack, createBlackbox_2_CallBack > , ltstr> CallBackMap;
-	
+
 	bool add(const char *name, std::pair<createBlackbox_1_CallBack, createBlackbox_2_CallBack> createD){
 		return _callback.insert(CallBackMap::value_type(name, createD)).second;
 	}
-	
+
 	bool remove(const char *name){return _callback.erase(name) == 1;}
-			
+
 	BlackboxAbstract* create(const char *name, const DomainKey &k, size_t m, size_t n){
 		CallBackMap::iterator it = _callback.find(name);
 		if (it != _callback.end()){
@@ -96,13 +97,13 @@ public:
 			mes+= std::string(name);
 			mes+= std::string(" >>\n");
 			throw lb_runtime_error(mes.c_str());// throw an exception
-		}		
-		
+		}
+
 	}
 
 	size_t size() { return _callback.size(); }
 
-private:	
+private:
 	CallBackMap _callback;
 };
 
@@ -133,17 +134,17 @@ public:
 	RebindBlackboxFunctor(void *&p) : ptr(p) {}
 
 	template<class Domain>
-	void operator()(const DomainKey &key, Domain *D) const {		
+	void operator()(const DomainKey &key, Domain *D) const {
 		RebindBlackboxFunctor fct(ptr);
 		DomainFunction::call(*D, key, fct);
 	}
 
-	
+
 	template<class DomainSource, class DomainTarget>
 	void operator()(DomainSource &res, DomainTarget *D) const {
-		Blackbox<DomainSource> *B_source= static_cast<Blackbox<DomainSource> * >  (ptr);				
+		Blackbox<DomainSource> *B_source= static_cast<Blackbox<DomainSource> * >  (ptr);
 		Blackbox<DomainTarget> *B_target;
-		typename Blackbox<DomainSource>::template rebind<DomainTarget>()(B_target, *B_source, *D);					
+		typename Blackbox<DomainSource>::template rebind<DomainTarget>()(*B_target, *B_source, *D);
 		delete B_source;
 		ptr = B_target;
 	}
@@ -173,11 +174,11 @@ public:
 	}
 
 	void * getPtr() const { return ptr;}
-	
+
 	virtual const DomainKey& getDomainKey() const {return key;}
 
 	LINBOX_VISITABLE();
-	
+
 	template<class Functor, class Result>
 	void  launch (Result &res, const Functor &fct) const {
 		BlackboxSpecFunctor<Blackbox, Functor> bbs(fct, ptr);
@@ -196,11 +197,11 @@ public:
 	}
 
 	void rebind(const DomainKey &k) {
-		RebindBlackboxFunctor<Blackbox> Fct(ptr);		
-		DomainFunction::call(k, key, Fct);	
+		RebindBlackboxFunctor<Blackbox> Fct(ptr);
+		DomainFunction::call(k, key, Fct);
 		key = k;
 		key.set_autogc();
-	}	
+	}
 
 };
 
@@ -219,12 +220,12 @@ public:
 
 	template<class Domain>
 	void operator()(void *&res, Domain *D) const {
-		res = new Blackbox<Domain>(*D, _row, _col);	
+		res = new Blackbox<Domain>(*D, _row, _col);
 	}
 };
 
 template<template<class T> class Blackbox>
-class CreateBlackboxFromStreamFunctor{	
+class CreateBlackboxFromStreamFunctor{
 	std::istream ∈
 public:
 	CreateBlackboxFromStreamFunctor(std::istream &i) : in(i) {}
@@ -265,7 +266,7 @@ BlackboxAbstract* constructBlackbox_from_stream (const DomainKey &k, std::istrea
  * Function to add an abstract blackbox in linbox hashtable *
  ************************************************************/
 const BlackboxKey& addBlackbox(BlackboxAbstract * v){
-	
+
 	std::pair<BlackboxTable::const_iterator, bool> status;
 	status = blackbox_hashtable.insert(std::pair<BlackboxKey, BlackboxAbstract*> (BlackboxKey(v), v));
 	if (status.second)
diff --git a/interfaces/driver/lb-blackbox-function.h b/interfaces/driver/lb-blackbox-function.h
old mode 100755
new mode 100644
index c517a1d..7c2b18a
--- a/interfaces/driver/lb-blackbox-function.h
+++ b/interfaces/driver/lb-blackbox-function.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-blackbox-function.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,12 +21,12 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_BLACKBOX_FUNCTION_H
-#define __LINBOX_LB_BLACKBOX_FUNCTION_H
+#ifndef __LINBOX_lb_blackbox_function_H
+#define __LINBOX_lb_blackbox_function_H
 
 
 #include <lb-blackbox-abstract.h>
-#include <lb-blackbox-functor.h> 
+#include <lb-blackbox-functor.h>
 
 
 /***********************************************************
@@ -33,35 +34,35 @@
  **********************************************************/
 
 class BlackboxFunction {
-public:	
+public:
 	// call a functor over a blackbox from the hashtable, result is given through 1st parameter
 	template<class Functor, class Result>
 	static void call(Result &res, const std::pair<const BlackboxKey, BlackboxAbstract*> &blackbox, const Functor &functor){
 		ApplyBlackboxFunctor<Functor, Result> Ap(res, functor);
-		(blackbox.second)->Accept(Ap);	
+		(blackbox.second)->Accept(Ap);
 	}
-	
-	// call a functor over a blackbox from the hashtable, no result 
+
+	// call a functor over a blackbox from the hashtable, no result
 	template<class Functor>
-	static void call(const std::pair<const BlackboxKey, BlackboxAbstract*> &v, const Functor &f){ 
+	static void call(const std::pair<const BlackboxKey, BlackboxAbstract*> &v, const Functor &f){
 		void *dumbresult;
 		call(dumbresult,v,f);
 	}
-	
+
 	// call a functor over a blackbox from its key, result is given through 1st parameter
 	template<class Functor, class Result>
 	static void call(Result &res, const BlackboxKey &key, const Functor &functor){
-		BlackboxTable::const_iterator it = blackbox_hashtable.find(key);  
+		BlackboxTable::const_iterator it = blackbox_hashtable.find(key);
 		if (it != blackbox_hashtable.end())
 			BlackboxFunction::call(res, *it, functor);
 		else
 			throw lb_runtime_error("LinBox ERROR: use of a non allocated blackbox \n");// throw an exception
 	}
-	
+
 	// call a functor over a blackbox from its key, no result
 	template<class Functor>
 	static void call(const BlackboxKey &k, const Functor &f) {
-		void *dumbresult; 
+		void *dumbresult;
 		call(dumbresult,k,f);
 	}
 };
diff --git a/interfaces/driver/lb-blackbox-functor.h b/interfaces/driver/lb-blackbox-functor.h
old mode 100755
new mode 100644
index b1c9261..e968b7e
--- a/interfaces/driver/lb-blackbox-functor.h
+++ b/interfaces/driver/lb-blackbox-functor.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-blackbox-functor.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_BLACKBOX_FUNCTOR_H
-#define __LINBOX_LB_BLACKBOX_FUNCTOR_H
+#ifndef __LINBOX_lb_blackbox_functor_H
+#define __LINBOX_lb_blackbox_functor_H
 
 #include <lb-utilities.h>
 #include <lb-blackbox-data.h>
@@ -39,7 +40,7 @@ protected:
 
 public:
 	ApplyBlackboxFunctorBase(){}
-	
+
 	template<class Blackbox>
 	void apply(const Blackbox &b){
 		b.launch(*res, *fct);
@@ -51,7 +52,7 @@ public:
  * Macro for automatic code generation *
  ***************************************/
 #define LB_BLACKBOX_VISIT(B)				\
-	void visit(const B &d){apply(d);}
+void visit(const B &d){apply(d);}
 
 
 /**********************************************************************************
@@ -62,19 +63,19 @@ template <class BList, class Functor, class Result> class LinBoxBlackboxVisitor;
 
 template <class Functor, class Result> class LinBoxBlackboxVisitor<LinBoxDumbType, Functor, Result>{};
 
-template <class T, class Functor, class Result> 
-class LinBoxBlackboxVisitor<LinBoxTypelist<T, LinBoxDumbType>, Functor, Result> 
-	: public LinBoxVisitor <T>, 
-	  public ApplyBlackboxFunctorBase<Functor, Result> {
+template <class T, class Functor, class Result>
+class LinBoxBlackboxVisitor<LinBoxTypelist<T, LinBoxDumbType>, Functor, Result>
+: public LinBoxVisitor <T>,
+public ApplyBlackboxFunctorBase<Functor, Result> {
 public:
 	LB_BLACKBOX_VISIT(T);
 };
 
 template <class Head, class Tail, class Functor, class Result>
-class LinBoxBlackboxVisitor<LinBoxTypelist<Head, Tail>, Functor, Result > 
-	: public LinBoxVisitor <Head> ,
-	  public LinBoxBlackboxVisitor<Tail, Functor, Result> {
-	public:
+class LinBoxBlackboxVisitor<LinBoxTypelist<Head, Tail>, Functor, Result >
+: public LinBoxVisitor <Head> ,
+public LinBoxBlackboxVisitor<Tail, Functor, Result> {
+public:
 	LB_BLACKBOX_VISIT(Head);
 };
 
@@ -85,8 +86,7 @@ class LinBoxBlackboxVisitor<LinBoxTypelist<Head, Tail>, Functor, Result >
 
 template<class Functor, class Result>
 class ApplyBlackboxFunctor : public LinBoxBlackboxVisitor<BlackboxList, Functor, Result> {
-public:
-	ApplyBlackboxFunctor(Result &r, const Functor &f) { 
+public: ApplyBlackboxFunctor(Result &r, const Functor &f) {
 		this->res = &r;
 		this->fct = &f;
 	}
diff --git a/interfaces/driver/lb-blackbox-type.h b/interfaces/driver/lb-blackbox-type.h
old mode 100755
new mode 100644
index 0474abf..c63a34e
--- a/interfaces/driver/lb-blackbox-type.h
+++ b/interfaces/driver/lb-blackbox-type.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-blackbox-type.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_BLACKBOX_TYPE_H
-#define __LINBOX_LB_BLACKBOX_TYPE_H
+#ifndef __LINBOX_lb_blackbox_type_H
+#define __LINBOX_lb_blackbox_type_H
 
 
 /****************************************
@@ -30,7 +31,7 @@
 
 // (NEED TO USE ENVELOPE TO DEFINE A CONCRETE TYPE)
 typedef LinBoxTypelist < BlackboxEnvelope< LinBox::BlasBlackbox > , LinBoxDumbType> BL1;
-//typedef LinBoxTypelist < BlackboxEnvelope< LinBox::SparseMatrix > , BL1> BL2; 
+//typedef LinBoxTypelist < BlackboxEnvelope< LinBox::SparseMatrix > , BL1> BL2;
 
 // define the blackbox typelist
 typedef BL1 BlackboxList;
@@ -44,11 +45,11 @@ extern Blackbox_Factory linbox_blackbox;
 
 void UpdateBlackbox() {
 	// linbox_blackbox.add("linbox_sparse",
-	// Blackbox_Factory::CallBackMap::value_type::second_type( 
+	// Blackbox_Factory::CallBackMap::value_type::second_type(
 	// constructBlackbox_from_size<LinBox::SparseMatrix>, constructBlackbox_from_stream<LinBox::SparseMatrix> ));
 	linbox_blackbox.add("linbox_dense",
-			    Blackbox_Factory::CallBackMap::value_type::second_type( constructBlackbox_from_size<LinBox::BlasBlackbox>, 
-										    constructBlackbox_from_stream<LinBox::BlasBlackbox> ));			    
+			    Blackbox_Factory::CallBackMap::value_type::second_type( constructBlackbox_from_size<LinBox::BlasBlackbox>,
+										    constructBlackbox_from_stream<LinBox::BlasBlackbox> ));
 }
 
 
diff --git a/interfaces/driver/lb-blackbox.C b/interfaces/driver/lb-blackbox.C
old mode 100755
new mode 100644
index 072f08f..fe41917
--- a/interfaces/driver/lb-blackbox.C
+++ b/interfaces/driver/lb-blackbox.C
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-blackbox.C
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_BLACKBOX_C
-#define __LINBOX_LB_BLACKBOX_C
+#ifndef __LINBOX_lb_blackbox_C
+#define __LINBOX_lb_blackbox_C
 
 #include <linbox-config.h>
 
@@ -47,13 +48,13 @@ const char* current_blackbox  = default_blackbox;
 
 
 /*******************************************************
- * API to contruct a m x n zero blackbox over a domain * 
+ * API to contruct a m x n zero blackbox over a domain *
  *******************************************************/
 const BlackboxKey& createBlackbox(const DomainKey &k, size_t m, size_t n, const char* name){
 	const char* type = name;
 	if (type == NULL)
 		type = current_blackbox;
-	       
+
 	BlackboxAbstract* bb = linbox_blackbox.create(type, k, m , n);
 	return addBlackbox(bb);
 }
@@ -74,13 +75,13 @@ const BlackboxKey& createBlackbox(const DomainKey &k, std::istream &in, const ch
  * API to copy an existing blackbox *
  ************************************/
 const BlackboxKey& copyBlackbox(const BlackboxKey &k){
-	
+
 	BlackboxTable::iterator it = blackbox_hashtable.find(k);
 	if (it == blackbox_hashtable.end())
 		throw lb_runtime_error("LinBox ERROR: blackbox does not exist (copying impossible)\n");
-	
+
 	BlackboxAbstract *v = it->second->clone();
-	return addBlackbox(v);       
+	return addBlackbox(v);
 }
 
 /********************************************
@@ -130,7 +131,7 @@ public:
 	template<class Blackbox, class Domain>
 	void operator()(Blackbox *B, Domain *D) {
 		typename Domain::RandIter G(*D);
-		for (size_t i=0; i< B->coldim();++i) 
+		for (size_t i=0; i< B->coldim();++i)
 			for (size_t j=0;j< B->coldim();++j)
 				G.random(B->refEntry(i,j));
 	}
@@ -142,8 +143,8 @@ protected:
 	Blackbox *vect;
 public:
 	BlackboxAtRandomFunctorSpec(Blackbox *V) : vect(V) {}
-	
-	template<class Domain> 
+
+	template<class Domain>
 	void operator()(void *, Domain *D) const {
 		RandomBlackbox<typename Blackbox::Field::Element, typename Domain::Element, typename LinBox::MatrixContainerTrait<Blackbox>::Type>()(vect, D);
 	}
@@ -154,13 +155,13 @@ protected:
 	const BlackboxKey key;
 public:
 	BlackboxAtRandomFunctor(const BlackboxKey &k) : key(k) {}
-	
+
 	template<class Blackbox>
 	void operator()(void*, Blackbox *V) const {
 		BlackboxTable::iterator it = blackbox_hashtable.find(key);
 		if ( it == blackbox_hashtable.end())
 			throw lb_runtime_error("LinBox ERROR: invalid blackbox (set random value impossible)");
-		
+
 		BlackboxAtRandomFunctorSpec<Blackbox> Fct(V);
 		DomainFunction::call(it->second->getDomainKey(), Fct);
 	}
@@ -189,18 +190,18 @@ void rebindBlackbox(const BlackboxKey &Vkey, const DomainKey &Dkey){
  *************************************************/
 class WriteBlackboxFunctor{
 	std::ostream &os;
-public:	
+public:
 	WriteBlackboxFunctor(std::ostream &o) : os(o) {}
-	
+
 	template<class Blackbox>
 	void operator() (void*, Blackbox *B) const {
-		B->write(os);	
+		B->write(os);
 	}
 };
 
 void writeBlackbox (const BlackboxKey &key,  std::ostream &os){
 	WriteBlackboxFunctor Fct(os);
-	BlackboxFunction::call(key, Fct);	
+	BlackboxFunction::call(key, Fct);
 }
 
 
diff --git a/interfaces/driver/lb-blackbox.h b/interfaces/driver/lb-blackbox.h
old mode 100755
new mode 100644
index d6eca94..19bb528
--- a/interfaces/driver/lb-blackbox.h
+++ b/interfaces/driver/lb-blackbox.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-blackbox.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_BLACKBOX_H
-#define __LINBOX_LB_BLACKBOX_H
+#ifndef __LINBOX_lb_blackbox_H
+#define __LINBOX_lb_blackbox_H
 
 #include <lb-domain-collection.h>
 #include <lb-blackbox-collection.h>
@@ -33,7 +34,7 @@ void UpdateBlackbox();
 
 
 /*******************************************************
- * API to contruct a m x n zero blackbox over a domain * 
+ * API to contruct a m x n zero blackbox over a domain *
  *******************************************************/
 const BlackboxKey& createBlackbox(const DomainKey &k, size_t m, size_t n, const char* name=NULL);
 
@@ -48,7 +49,7 @@ const BlackboxKey& createBlackbox(const DomainKey &k, std::istream &is, const ch
  * API to copy an existing blackbox *
  ************************************/
 const BlackboxKey& copyBlackbox(const BlackboxKey &k);
-	
+
 
 /********************************************
  * API to get the dimensions of  a blackbox *
diff --git a/interfaces/driver/lb-charpoly.C b/interfaces/driver/lb-charpoly.C
old mode 100755
new mode 100644
index 0e19ecd..5f70437
--- a/interfaces/driver/lb-charpoly.C
+++ b/interfaces/driver/lb-charpoly.C
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-charpoly.C
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_CHARPOLY_C
-#define __LINBOX_LB_CHARPOLY_C
+#ifndef __LINBOX_lb_charpoly_C
+#define __LINBOX_lb_charpoly_C
 
 
 #include <linbox/solutions/charpoly.h>
@@ -55,9 +56,9 @@ public:
 		typedef typename Field::Element Element;
 #ifdef __LINBOX_HAVE_GIVARO
 		// use givpolynomial du to non genericity of charpoly over integer
-		typename LinBox::GivPolynomialRing<Field, Dense>::Element pol;
+		typename LinBox::GivPolynomialRing<Field, ::Givaro::Dense>::Element pol;
 		LinBox::charpoly(pol, *B, meth);
-		
+
 		// convert back the result to std::vector
 		std::vector<Element> *phi = static_cast<std::vector<Element>*> (res);
 		phi->resize(pol.size());
@@ -66,7 +67,7 @@ public:
 #else
 		throw lb_runtime_error("LinBox ERROR: charpoly computation requires Givaro library, computation impossible)\n");
 #endif
-		
+
 	}
 };
 
@@ -95,7 +96,7 @@ const VectorKey& lb_charpoly(const BlackboxKey& key) {
 	BlackboxTable::iterator it = blackbox_hashtable.find(key);
 	if ( it == blackbox_hashtable.end())
 		throw lb_runtime_error("LinBox ERROR: blackbox is not defined (charpoly computation impossible)");
-		
+
 	const VectorKey *res = & createVector(it->second->getDomainKey(), 0, "linbox_dense");
 	lb_charpoly(*res, key);
 	return *res;
diff --git a/interfaces/driver/lb-charpoly.h b/interfaces/driver/lb-charpoly.h
old mode 100755
new mode 100644
index a4f6e10..23b30c3
--- a/interfaces/driver/lb-charpoly.h
+++ b/interfaces/driver/lb-charpoly.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-charpoly.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_CHARPOLY_H
-#define __LINBOX_LB_CHARPOLY_H
+#ifndef __LINBOX_lb_charpoly_H
+#define __LINBOX_lb_charpoly_H
 
 #include <lb-vector-collection.h>
 #include <lb-blackbox-collection.h>
diff --git a/interfaces/driver/lb-det.C b/interfaces/driver/lb-det.C
old mode 100755
new mode 100644
index c358a88..0240983
--- a/interfaces/driver/lb-det.C
+++ b/interfaces/driver/lb-det.C
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-det.C
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_DET_C
-#define __LINBOX_LB_DET_C
+#ifndef __LINBOX_lb_det_C
+#define __LINBOX_lb_det_C
 
 #include <linbox-config.h>
 #include <linbox/solutions/det.h>
@@ -49,16 +50,16 @@ class DeterminantFunctor{
 private:
 	Method meth;
 public:
-	
+
 	DeterminantFunctor(Method m = Method()) : meth(m) {}
 
 	template<class Blackbox>
 	void operator() (EltAbstract *&res, Blackbox *B) const {
-		typedef typename Blackbox::Field::Element Element;		
-		if (Element *d = (dynamic_cast<EltEnvelope<Element>*>(res))->getElement()) 
-			LinBox::det(*d, *B, meth);		
+		typedef typename Blackbox::Field::Element Element;
+		if (Element *d = (dynamic_cast<EltEnvelope<Element>*>(res))->getElement())
+			LinBox::det(*d, *B, meth);
 		else
-			throw lb_runtime_error("LinBox ERROR: incompatible blackbox and element type (determinant computation impossible)");			       
+			throw lb_runtime_error("LinBox ERROR: incompatible blackbox and element type (determinant computation impossible)");
 	}
 };
 
@@ -71,7 +72,7 @@ void lb_determinant(const EltKey& Ekey, const BlackboxKey& Bkey, const char* met
 	EltTable::iterator it = element_hashtable.find(Ekey);
 	if ( it == element_hashtable.end())
 		throw lb_runtime_error("LinBox ERROR: invalid element (determinant computation impossible)");
-	
+
 	DeterminantFunctor<> fct;
 	BlackboxFunction::call(it->second, Bkey, fct);
 }
@@ -86,7 +87,7 @@ const EltKey& lb_determinant(const BlackboxKey& key, const char *method) {
 	BlackboxTable::iterator it = blackbox_hashtable.find(key);
 	if (it == blackbox_hashtable.end())
 		throw lb_runtime_error("LinBox ERROR: blackbox does not exist (determinant computation impossible)\n");
-	
+
 	const DomainKey *d = &(it->second->getDomainKey());
 	const EltKey *e = &createElement(*d);
 	lb_determinant(*e, key, method);
diff --git a/interfaces/driver/lb-det.h b/interfaces/driver/lb-det.h
old mode 100755
new mode 100644
index f171e57..c6983c9
--- a/interfaces/driver/lb-det.h
+++ b/interfaces/driver/lb-det.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-det.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_DET_H
-#define __LINBOX_LB_DET_H
+#ifndef __LINBOX_lb_det_H
+#define __LINBOX_lb_det_H
 
 #include <lb-element-collection.h>
 #include <lb-blackbox-collection.h>
diff --git a/interfaces/driver/lb-domain-abstract.h b/interfaces/driver/lb-domain-abstract.h
old mode 100755
new mode 100644
index 199ee36..15d6b6b
--- a/interfaces/driver/lb-domain-abstract.h
+++ b/interfaces/driver/lb-domain-abstract.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-domain-abstract.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_DOMAIN_ABSTRACT_H
-#define __LINBOX_LB_DOMAIN_ABSTRACT_H
+#ifndef __LINBOX_lb_domain_abstract_H
+#define __LINBOX_lb_domain_abstract_H
 
 #include <lb-utilities.h>
 
diff --git a/interfaces/driver/lb-domain-collection.h b/interfaces/driver/lb-domain-collection.h
old mode 100755
new mode 100644
index 5db71f4..c574786
--- a/interfaces/driver/lb-domain-collection.h
+++ b/interfaces/driver/lb-domain-collection.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-domain-collection.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_DOMAIN_COLLECTION_H
-#define __LINBOX_LB_DOMAIN_COLLECTION_H
+#ifndef __LINBOX_lb_domain_collection_H
+#define __LINBOX_lb_domain_collection_H
 
 #include <linbox/integer.h>
 
@@ -43,42 +44,42 @@ private:
 
 
 public:
-	DomainKey(const LinBox::integer &p, const char* name) 
-		: pfirst(new LinBox::integer(p)), psecond(new const char*(name)), counter(new size_t(0)), autogc(false) 
+	DomainKey(const LinBox::integer &p, const char* name)
+		: pfirst(new LinBox::integer(p)), psecond(new const char*(name)), counter(new size_t(0)), autogc(false)
 	{}
 
-	DomainKey(const DomainKey &k, bool gc = false) 
+	DomainKey(const DomainKey &k, bool gc = false)
 		: pfirst(k.pfirst), psecond(k.psecond), counter(k.counter), autogc(gc) {(*counter)++;}
 
 	~DomainKey() {
 		if (autogc){
 			extern void deleteDomain(const DomainKey &key);
-			if ((*counter) == 0) 
+			if ((*counter) == 0)
 				deleteDomain(*this);
-			else 
-				(*counter)--;	
-			
+			else
+				(*counter)--;
+
 		}
-		else{ 		
+		else{
 			if ((*counter) == 0) { delete counter; delete pfirst; delete psecond;}
-			else (*counter)--;	
+			else (*counter)--;
 		}
-	}	
-	
+	}
+
 	const DomainKey& operator= (const DomainKey &k) {
 		if (autogc){
 			extern void deleteDomain(const DomainKey &key);
-			if ((*counter) == 0) 
+			if ((*counter) == 0)
 				deleteDomain(*this);
-			else 
-				(*counter)--;	
-			
+			else
+				(*counter)--;
+
 		}
-		else{ 		
+		else{
 			if ((*counter) == 0) {  delete counter; delete pfirst; delete psecond;}
-			else (*counter)--;	
+			else (*counter)--;
 		}
-		 
+
 		pfirst  = k.pfirst;
 		psecond = k.psecond;
 		counter = k.counter;
@@ -88,7 +89,7 @@ public:
 	}
 
 	bool free() const {return ((*counter) == 0);}
-	
+
 	void dispose() const { (*counter)--; }
 
 	void copy() const { (*counter)++; }
@@ -107,10 +108,10 @@ public:
 };
 
 
- 
+
 // comparison functor on key
 struct DomainKeyLessThan{
-	bool operator()(const DomainKey& k1, const DomainKey &k2) 
+	bool operator()(const DomainKey& k1, const DomainKey &k2)
 	{ return k1.lessThan(k2);}
 };
 
diff --git a/interfaces/driver/lb-domain-data.h b/interfaces/driver/lb-domain-data.h
old mode 100755
new mode 100644
index cda6825..3ec2bd1
--- a/interfaces/driver/lb-domain-data.h
+++ b/interfaces/driver/lb-domain-data.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-domain-data.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_DOMAIN_DATA_H
-#define __LINBOX_LB_DOMAIN_DATA_H
+#ifndef __LINBOX_lb_domain_data_H
+#define __LINBOX_lb_domain_data_H
 
 
 #include <linbox-config.h>
@@ -54,12 +55,12 @@ public:
 	bool add(const char *name, createDomainCallBack createD){
 		return _callback.insert(CallBackMap::value_type(name, createD)).second;
 	}
-	
+
 	bool remove(const char *name){
 		return _callback.erase(name) == 1;
 	}
-	
-	DomainAbstract* create(const char *name, const LinBox::integer &p){		
+
+	DomainAbstract* create(const char *name, const LinBox::integer &p){
 		CallBackMap::iterator it = _callback.find(name);
 		if (it != _callback.end()){
 			return it->second(p);
@@ -125,13 +126,13 @@ class DomainEnvelope :  public DomainAbstract {
 public:
 	typedef Domain Self_t;
 	typedef typename LinBox::FieldTraits<Domain>::categoryTag categoryTag;
-	
+
 	DomainEnvelope() {}
 
 	DomainEnvelope(const LinBox::integer &p) {
 		ptr = constructDomainFunctor<Domain, categoryTag> ()(p, categoryTag());
 	}
-	
+
 	~DomainEnvelope() {delete ptr;}
 
 	DomainAbstract* clone() const {
@@ -140,7 +141,7 @@ public:
 
 	LINBOX_VISITABLE();
 
-	Domain *getDomain() const  {return ptr;}			
+	Domain *getDomain() const  {return ptr;}
 };
 
 
diff --git a/interfaces/driver/lb-domain-function.h b/interfaces/driver/lb-domain-function.h
old mode 100755
new mode 100644
index eef662b..7b995cb
--- a/interfaces/driver/lb-domain-function.h
+++ b/interfaces/driver/lb-domain-function.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-domain-function.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,12 +21,12 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_DOMAIN_FUNCTION_H
-#define __LINBOX_LB_DOMAIN_FUNCTION_H
+#ifndef __LINBOX_lb_domain_function_H
+#define __LINBOX_lb_domain_function_H
 
 
 #include <lb-domain-abstract.h>
-#include <lb-domain-functor.h> 
+#include <lb-domain-functor.h>
 
 
 /*********************************************************
@@ -42,28 +43,28 @@ public:
 		ApplyDomainFunctor<Functor, Result> Ap(res, functor);
 		(domain.second)->Accept(Ap);
 	}
-	
-	// call a functor over a domain from the hashtable, no result 
+
+	// call a functor over a domain from the hashtable, no result
 	template <class Functor>
 	static void call (const std::pair<const DomainKey, DomainAbstract*>& k, const Functor& f){
-		void *dumbresult; 
+		void *dumbresult;
 		call(dumbresult, k, f);
 	}
 
 	// call a functor over a domain from its key, result is given through 1st parameter
 	template <class Functor, class Result>
 	static void call (Result &res, const DomainKey &key, const Functor &functor){
-		DomainTable::iterator it = domain_hashtable.find(key);  
+		DomainTable::iterator it = domain_hashtable.find(key);
 		if (it != domain_hashtable.end())
-			DomainFunction::call(res, *it, functor);  
+			DomainFunction::call(res, *it, functor);
 		else
 			throw lb_runtime_error("LinBox ERROR: use of a non allocated domain\n");// throw an exception
 	}
-	
-	// call a functor over a domain from its key, no result 
+
+	// call a functor over a domain from its key, no result
 	template <class Functor>
 	static void call (const DomainKey &k, const Functor &f){
-		void *dumbresult; 
+		void *dumbresult;
 		call(dumbresult, k, f);
 	}
 
diff --git a/interfaces/driver/lb-domain-functor.h b/interfaces/driver/lb-domain-functor.h
old mode 100755
new mode 100644
index cfd3ea6..4b5a4bb
--- a/interfaces/driver/lb-domain-functor.h
+++ b/interfaces/driver/lb-domain-functor.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-domain-functor.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_DOMAIN_FUNCTOR_H
-#define __LINBOX_LB_DOMAIN_FUNCTOR_H
+#ifndef __LINBOX_lb_domain_functor_H
+#define __LINBOX_lb_domain_functor_H
 
 #include <lb-utilities.h>
 #include <lb-domain-data.h>
@@ -50,7 +51,7 @@ public:
  * Macro for automatic code generation *
  ***************************************/
 #define LB_DOMAIN_VISIT(D)				\
-	void visit(const DomainEnvelope<D> &d){apply(d);}
+void visit(const DomainEnvelope<D> &d){apply(d);}
 
 
 /*******************************************************************************
@@ -61,19 +62,19 @@ template <class DList, class Functor, class Result> class LinBoxDomainVisitor;
 
 template <class Functor, class Result> class LinBoxDomainVisitor<LinBoxDumbType, Functor, Result>{};
 
-template <class T, class Functor, class Result> 
-class LinBoxDomainVisitor<LinBoxTypelist<T, LinBoxDumbType>, Functor, Result> 
-	: public LinBoxVisitor <DomainEnvelope<T> >, 
-	  public ApplyDomainFunctorBase<Functor, Result> {
+template <class T, class Functor, class Result>
+class LinBoxDomainVisitor<LinBoxTypelist<T, LinBoxDumbType>, Functor, Result>
+: public LinBoxVisitor <DomainEnvelope<T> >,
+public ApplyDomainFunctorBase<Functor, Result> {
 public:
 	LB_DOMAIN_VISIT(T);
 };
 
 template <class Head, class Tail, class Functor, class Result>
-class LinBoxDomainVisitor<LinBoxTypelist<Head, Tail>, Functor, Result > 
-	: public LinBoxVisitor <DomainEnvelope<Head> > ,
-	  public LinBoxDomainVisitor<Tail, Functor, Result> {
-	public:
+class LinBoxDomainVisitor<LinBoxTypelist<Head, Tail>, Functor, Result >
+: public LinBoxVisitor <DomainEnvelope<Head> > ,
+public LinBoxDomainVisitor<Tail, Functor, Result> {
+public:
 	LB_DOMAIN_VISIT(Head);
 };
 
@@ -86,9 +87,9 @@ template <class Functor, class Result>
 class ApplyDomainFunctor : public LinBoxDomainVisitor<DomainList, Functor, Result> {
 public:
 	ApplyDomainFunctor(Result &r, const Functor &f) {
-		this->res=&r; 
+		this->res=&r;
 		this->fct=&f;
-	}	
+	}
 };
 
 #endif
diff --git a/interfaces/driver/lb-domain-type.h b/interfaces/driver/lb-domain-type.h
old mode 100755
new mode 100644
index b414e7b..75bee77
--- a/interfaces/driver/lb-domain-type.h
+++ b/interfaces/driver/lb-domain-type.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-domain-type.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_DOMAIN_TYPE_H
-#define __LINBOX_LB_DOMAIN_TYPE_H
+#ifndef __LINBOX_lb_domain_type_H
+#define __LINBOX_lb_domain_type_H
 
 #include <linbox/field/modular.h>
 #include <linbox/field/PID-integer.h>
@@ -48,8 +49,8 @@
 typedef LinBoxTypelist < LinBox::Modular<double>          , LinBoxDumbType> DL1;
 typedef LinBoxTypelist < LinBox::PID_integer              , DL1> DL2;
 typedef LinBoxTypelist < LinBox::GMPRationalField         , DL2> DL3;
-typedef LinBoxTypelist < LinBox::Modular<LinBox::int32>   , DL3> DL4; 
-typedef LinBoxTypelist < LinBox::Modular<LinBox::int64>   , DL4> DL5;
+typedef LinBoxTypelist < LinBox::Modular<int32_t>         , DL3> DL4;
+typedef LinBoxTypelist < LinBox::Modular<int64_t>         , DL4> DL5;
 typedef LinBoxTypelist < LinBox::Modular<LinBox::integer> , DL5> DL6;
 
 #ifdef __LINBOX_MINIMIZE_DOMAIN
@@ -74,7 +75,7 @@ typedef LinBoxDumbType ntl_domain_list;
 
 #ifdef __LINBOX_HAVE_GIVARO
 typedef LinBoxTypelist < LinBox::GivaroGfq, LinBoxDumbType> DG1;
-typedef LinBoxTypelist < LinBox::GivaroZpz<Std32>, DG1> DG2;
+typedef LinBoxTypelist < LinBox::GivaroZpz< ::Givaro::Std32>, DG1> DG2;
 #ifdef __LINBOX_MINIMIZE_DOMAIN
 typedef DG1 givaro_domain_list;
 #else
@@ -82,13 +83,13 @@ typedef DG2 givaro_domain_list;
 #endif
 #else
 typedef LinBoxDumbType givaro_domain_list;
-#endif		
+#endif
 
 // define DomainList to be the list of all domains
 #ifdef __LINBOX_DOMAIN_ONLY
 typedef linbox_domain_list DomainList;
 #else
-typedef LinBoxTL::Append< linbox_domain_list, LinBoxTL::Append< ntl_domain_list, givaro_domain_list>::Result>::Result DomainList; 
+typedef LinBoxTL::Append< linbox_domain_list, LinBoxTL::Append< ntl_domain_list, givaro_domain_list>::Result>::Result DomainList;
 #endif
 
 
@@ -104,14 +105,14 @@ void UpdateDomain(){
 	linbox_domain.add("linbox_field_dbl"      , constructDomain<LinBox::Modular<double> >);
 	linbox_domain.add("linbox_field_rational" , constructDomain<LinBox::GMPRationalField>);
 	linbox_domain.add("linbox_ring_integer"   , constructDomain<LinBox::PID_integer>);
-#ifndef __LINBOX_MINIMIZE_DOMAIN	
-	linbox_domain.add("linbox_field_32"       , constructDomain<LinBox::Modular<LinBox::int32> >);
-	linbox_domain.add("linbox_field_64"       , constructDomain<LinBox::Modular<LinBox::int64> >);
+#ifndef __LINBOX_MINIMIZE_DOMAIN
+	linbox_domain.add("linbox_field_32"       , constructDomain<LinBox::Modular<int32_t> >);
+	linbox_domain.add("linbox_field_64"       , constructDomain<LinBox::Modular<int64_t> >);
 	linbox_domain.add("linbox_field_mp"       , constructDomain<LinBox::Modular<LinBox::integer> >);
 #endif
 #ifdef __LINBOX_HAVE_NTL
 	linbox_domain.add("ntl_field_ZZ_p"      , constructDomain<LinBox::NTL_ZZ_p>);
-#ifndef __LINBOX_MINIMIZE_DOMAIN	
+#ifndef __LINBOX_MINIMIZE_DOMAIN
 	linbox_domain.add("ntl_field_zz_p"      , constructDomain<LinBox::NTL_zz_p >);
 	linbox_domain.add("ntl_ring_integer"    , constructDomain<LinBox::NTL_ZZ>);
 #endif
@@ -119,7 +120,7 @@ void UpdateDomain(){
 #ifdef __LINBOX_HAVE_GIVARO
 	linbox_domain.add("givaro_field_gfq"    , constructDomain<LinBox::GivaroGfq>);
 #ifndef  __LINBOX_MINIMIZE_DOMAIN
-	linbox_domain.add("givaro_field_32"     , constructDomain<LinBox::GivaroZpz<Std32> >);
+	linbox_domain.add("givaro_field_32"     , constructDomain<LinBox::GivaroZpz< ::Givaro::Std32> >);
 #endif
 #endif
 }
@@ -136,7 +137,7 @@ void UpdateDomain(){
 #define default_rational_field "linbox_field_rational"
 
 // definition of the default type for integer ring
-#define default_integer_ring "linbox_ring_integer"  
+#define default_integer_ring "linbox_ring_integer"
 
 
 
diff --git a/interfaces/driver/lb-domain.C b/interfaces/driver/lb-domain.C
old mode 100755
new mode 100644
index b76e961..0312ca9
--- a/interfaces/driver/lb-domain.C
+++ b/interfaces/driver/lb-domain.C
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-domain.C
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,13 +21,13 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_DOMAIN_C
-#define __LINBOX_LB_DOMAIN_C
+#ifndef __LINBOX_lb_domain_C
+#define __LINBOX_lb_domain_C
 
 #include <lb-domain.h>
 #include <lb-domain-function.h>
 
-	
+
 /****************************
  * Allocate global variable *
  ****************************/
@@ -36,7 +37,7 @@ DomainTable domain_hashtable;
 
 // global variable for the factory
 Domain_Factory linbox_domain;
-	
+
 // global variable for current prime field type
 const char* current_prime_field  = default_prime_field;
 
@@ -47,9 +48,9 @@ const char* current_rational_field  = default_rational_field;
 const char* current_integer_ring = default_integer_ring;
 
 
-				  
+
 /****************************
- * API to contruct domains  * 
+ * API to contruct domains  *
  ****************************/
 
 const DomainKey& createDomain( const LinBox::integer characteristic, const char *name){
@@ -62,7 +63,7 @@ const DomainKey& createDomain( const LinBox::integer characteristic, const char
 	}
 
 	DomainKey key(characteristic, type);
-	
+
 	// check if the domain is already constructed in domain hashtable
 	// if so return the pointer to the domain
 	DomainTable::const_iterator it= domain_hashtable.find(key) ;
@@ -70,10 +71,10 @@ const DomainKey& createDomain( const LinBox::integer characteristic, const char
 		it->first.copy();
 		return it->first;
 	}
-	
+
 	// need to create a new field
 	DomainAbstract *domain = linbox_domain.create(type, characteristic);
-	
+
 
 	std::pair<DomainTable::const_iterator, bool> status= domain_hashtable.insert(std::pair<DomainKey, DomainAbstract*> (key, domain));
 
@@ -85,7 +86,7 @@ const DomainKey& createDomain( const LinBox::integer characteristic, const char
 
 
 /************************
- * API to copy domains  * 
+ * API to copy domains  *
  ************************/
 const DomainKey copyDomain( const DomainKey &k){
 	return k;
diff --git a/interfaces/driver/lb-domain.h b/interfaces/driver/lb-domain.h
old mode 100755
new mode 100644
index ffb8d91..57faeb4
--- a/interfaces/driver/lb-domain.h
+++ b/interfaces/driver/lb-domain.h
@@ -1,5 +1,5 @@
-
 /* -*- 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
 /* lb-domain.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -21,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_DOMAIN_H
-#define __LINBOX_LB_DOMAIN_H
+#ifndef __LINBOX_lb_domain_H
+#define __LINBOX_lb_domain_H
 
 #include <lb-domain-collection.h>
 #include <linbox/integer.h>
@@ -31,14 +31,14 @@
  * Initializer of Domain *
  *************************/
 void UpdateDomain();
-				  
+
 /****************************
- * API to contruct domains  * 
+ * API to contruct domains  *
  ****************************/
 const DomainKey& createDomain( const LinBox::integer characteristic, const char *name=NULL);
 
-/************************ 
- * API to copy domains  * 
+/************************
+ * API to copy domains  *
  ************************/
 const DomainKey copyDomain( const DomainKey &k);
 
diff --git a/interfaces/driver/lb-driver.h b/interfaces/driver/lb-driver.h
old mode 100755
new mode 100644
index f1519cf..f824327
--- a/interfaces/driver/lb-driver.h
+++ b/interfaces/driver/lb-driver.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-driver.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_DRIVER_H
-#define __LINBOX_LB_DRIVER_H
+#ifndef __LINBOX_lb_driver_H
+#define __LINBOX_lb_driver_H
 
 #include <lb-domain.h>
 #include <lb-element.h>
@@ -35,7 +36,7 @@
 #include <lb-det.h>
 #include <lb-rank.h> //problem with givaro-extension (UTT type is not always consistent) disabled in the code
 #include <lb-minpoly.h>
-#include <lb-charpoly.h> 
+#include <lb-charpoly.h>
 #include <lb-solve.h>
 
 // overload PreconditionFailed to be a real exception
@@ -75,13 +76,13 @@ void LinBoxDataInfo(std::ostringstream &out){
 	extern VectorTable        vector_hashtable;
 	extern EltTable          element_hashtable;
 
-	
+
 	out<<"LinBox Driver active Data:\n"
 	   <<"   - Domain    : "<<domain_hashtable.size()<<"\n"
 	   <<"   - Element   : "<<element_hashtable.size()<<"\n"
 	   <<"   - Blackbox  : "<<blackbox_hashtable.size()<<"\n"
 	   <<"   - Vector    : "<<vector_hashtable.size()<<"\n"
-	   <<"\n";	
+	   <<"\n";
 }
 
 
diff --git a/interfaces/driver/lb-element-abstract.h b/interfaces/driver/lb-element-abstract.h
old mode 100755
new mode 100644
index 4505b0d..79c30c0
--- a/interfaces/driver/lb-element-abstract.h
+++ b/interfaces/driver/lb-element-abstract.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-element-abstract.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_ELEMENT_ABSTRACT_H
-#define __LINBOX_LB_ELEMENT_ABSTRACT_H
+#ifndef __LINBOX_lb_element_abstract_H
+#define __LINBOX_lb_element_abstract_H
 
 #include <lb-utilities.h>
 #include <lb-domain-collection.h>
diff --git a/interfaces/driver/lb-element-collection.h b/interfaces/driver/lb-element-collection.h
old mode 100755
new mode 100644
index 72b4514..58835ef
--- a/interfaces/driver/lb-element-collection.h
+++ b/interfaces/driver/lb-element-collection.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-element-collection.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_COLLECTION_H
-#define __LINBOX_LB_COLLECTION_H
+#ifndef __LINBOX_lb_collection_H
+#define __LINBOX_lb_collection_H
 
 #include <map>
 #include <lb-element-abstract.h>
@@ -31,12 +32,12 @@
  * Collection of Elements *
  **************************/
 
-// definition of a unique key 
+// definition of a unique key
 typedef size_t EltKey;
 
 // comparison functor on key
 struct EltKeyLessThan{
-	bool operator()(const EltKey& k1, const EltKey &k2) 
+	bool operator()(const EltKey& k1, const EltKey &k2)
 	{ return (k1 < k2);}
 };
 
diff --git a/interfaces/driver/lb-element-data.h b/interfaces/driver/lb-element-data.h
old mode 100755
new mode 100644
index 1e337b6..a249a07
--- a/interfaces/driver/lb-element-data.h
+++ b/interfaces/driver/lb-element-data.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-element.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -21,8 +22,8 @@
  */
 
 
-#ifndef __LINBOX_LB_ELEMENT_DATA_H
-#define __LINBOX_LB_ELEMENT_DATA_H
+#ifndef __LINBOX_lb_element_data_H
+#define __LINBOX_lb_element_data_H
 
 #include <lb-domain-data.h>
 
@@ -40,15 +41,15 @@ class EltEnvelope :  public EltAbstract {
 	DomainKey key;
 	Element  *ptr;
 public:
-	
+
 	EltEnvelope(const DomainKey &k, Element* e) : key(k, true), ptr(e) {}
-	
+
 	~EltEnvelope() {delete ptr;}
 
-	Element *getElement() const  {return ptr;}			
-	
+	Element *getElement() const  {return ptr;}
+
 	const DomainKey& getDomainKey() const {	return key;}
-	
+
 	EltAbstract* clone() const { return new EltEnvelope<Element>(key, new Element(*ptr));}
 };
 
diff --git a/interfaces/driver/lb-element.C b/interfaces/driver/lb-element.C
old mode 100755
new mode 100644
index 6134be1..23deaff
--- a/interfaces/driver/lb-element.C
+++ b/interfaces/driver/lb-element.C
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-element.C
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -21,8 +22,8 @@
  */
 
 
-#ifndef __LINBOX_LB_ELEMENT_C
-#define __LINBOX_LB_ELEMENT_C
+#ifndef __LINBOX_lb_element_C
+#define __LINBOX_lb_element_C
 
 #include <lb-element.h>
 #include <lb-element-data.h>
@@ -36,7 +37,7 @@ EltTable element_hashtable;
 
 
 /*******************************************
- * API to contruct a element over a domain * 
+ * API to contruct a element over a domain *
  *******************************************/
 const EltKey& createElement(const DomainKey &key) {
 	EltAbstract *e = constructElt(key);
@@ -50,17 +51,17 @@ const EltKey& createElement(const DomainKey &key) {
 
 
 /*********************************************
- * API to write an a element over its domain * 
+ * API to write an a element over its domain *
  *********************************************/
 class WriteElementFunctor{
 protected:
 	std::ostream     &os;
 	EltAbstract  *elt;
-public:	
+public:
 	WriteElementFunctor(std::ostream &o, EltAbstract* e) : os(o), elt(e) {}
 
 	template<class Domain>
-	void operator() (void*, Domain *D) const {	
+	void operator() (void*, Domain *D) const {
 		if (EltEnvelope<typename Domain::Element> *ptr = dynamic_cast<EltEnvelope<typename Domain::Element>*>(elt))
 			D->write(os, *(ptr->getElement()))<<"\n";
 		else
@@ -75,7 +76,7 @@ void writeElement (const EltKey &key, std::ostream &os){
 		throw lb_runtime_error("LinBox ERROR: invalid element (writing impossible)");
 
 	WriteElementFunctor Fct(os, it->second);
-	DomainFunction::call(it->second->getDomainKey(), Fct);	
+	DomainFunction::call(it->second->getDomainKey(), Fct);
 }
 
 
@@ -116,13 +117,13 @@ public:
 	}
 };
 
-void  SerializeElement (SerialElement &s, const EltKey &key) {       
+void  SerializeElement (SerialElement &s, const EltKey &key) {
 	EltTable::iterator it = element_hashtable.find(key);
 	if ( it == element_hashtable.end())
 		throw lb_runtime_error("LinBox ERROR: invalid element (serializing impossible)");
 
 	SerializeElementFunctor Fct(it->second);
-	DomainFunction::call(s, it->second->getDomainKey(), Fct);	
+	DomainFunction::call(s, it->second->getDomainKey(), Fct);
 }
 
 #endif
diff --git a/interfaces/driver/lb-element.h b/interfaces/driver/lb-element.h
old mode 100755
new mode 100644
index d4ca0dd..729a293
--- a/interfaces/driver/lb-element.h
+++ b/interfaces/driver/lb-element.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-element.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -21,8 +22,8 @@
  */
 
 
-#ifndef __LINBOX_LB_ELEMENT_H
-#define __LINBOX_LB_ELEMENT_H
+#ifndef __LINBOX_lb_element_H
+#define __LINBOX_lb_element_H
 
 
 #include <lb-domain-collection.h>
@@ -30,13 +31,13 @@
 
 
 /*******************************************
- * API to contruct a element over a domain * 
+ * API to contruct a element over a domain *
  *******************************************/
 const EltKey& createElement(const DomainKey &key);
 
 
 /*********************************************
- * API to write an a element over its domain * 
+ * API to write an a element over its domain *
  *********************************************/
 void writeElement (const EltKey &key, std::ostream &os);
 
diff --git a/interfaces/driver/lb-garbage.C b/interfaces/driver/lb-garbage.C
old mode 100755
new mode 100644
index d7edd78..d11d735
--- a/interfaces/driver/lb-garbage.C
+++ b/interfaces/driver/lb-garbage.C
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-garbage.C
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_GARBAGE_C
-#define __LINBOX_LB_GARBAGE_C
+#ifndef __LINBOX_lb_garbage_C
+#define __LINBOX_lb_garbage_C
 
 #include <lb-garbage.h>
 #include <lb-domain-function.h>
@@ -38,7 +39,7 @@
 class DeleteElementFunctor{
 protected:
 	EltAbstract  *elt;
-public:	
+public:
 	DeleteElementFunctor(EltAbstract *e) : elt(e) {}
 
 	template<class Domain>
@@ -62,7 +63,7 @@ void deleteElement(const EltKey &key){
 #ifdef __LINBOX_NO_GC_EXCEPTION
 		try {
 #endif
-		DomainFunction::call(it->second->getDomainKey(), Fct);	
+		DomainFunction::call(it->second->getDomainKey(), Fct);
 #ifdef __LINBOX_NO_GC_EXCEPTION
 		} catch(lb_runtime_error &t){std::cout<<"LinBox exception catched\n"; exit(0);}
 #endif
@@ -91,7 +92,7 @@ void deleteDomain(const DomainKey &key) {
 	if (key.free()){
 		DomainTable::iterator it= domain_hashtable.find(key);
 		delete it->second;
-		domain_hashtable.erase(it);	
+		domain_hashtable.erase(it);
 	}
 	else{
 		key.dispose();
@@ -114,16 +115,16 @@ void collectDomain(){
  * API to delete a blackbox from its key *
  *****************************************/
 class DeleteBlackboxFunctor{
-public:	
+public:
 	template<class Blackbox>
 	void operator() (void *, Blackbox *B) const {
-		delete B;		
+		delete B;
 	}
 };
 
 void deleteBlackbox (const BlackboxKey &key){
 	BlackboxTable::iterator it = blackbox_hashtable.find(key);
-	
+
 	if ( it == blackbox_hashtable.end()){
 #ifndef __LINBOX_NO_GC_EXCEPTION
 		throw lb_runtime_error("LinBox ERROR: invalid blackbox (freeing impossible)\n");
@@ -137,11 +138,11 @@ void deleteBlackbox (const BlackboxKey &key){
 		try {
 #endif
 			BlackboxFunction::call(key, Fct);
-#ifdef __LINBOX_NO_GC_EXCEPTION	
+#ifdef __LINBOX_NO_GC_EXCEPTION
 		} catch (lb_runtime_error &t) {std::cout<<"LinBox exception catched: "<<t<<"\n"; exit(0);}
 #endif
-		delete it->second;	
-		blackbox_hashtable.erase(it);		
+		delete it->second;
+		blackbox_hashtable.erase(it);
 	}
 }
 
@@ -171,10 +172,10 @@ void collectBlackbox(){
  ***************************************/
 
 class DeleteVectorFunctor{
-public:	
+public:
 	template<class Vector>
 	void operator() (void*, Vector *V) const {
-		delete V;		
+		delete V;
 	}
 };
 
@@ -191,12 +192,12 @@ void deleteVector (const VectorKey &key){
 #ifdef __LINBOX_NO_GC_EXCEPTION
 		try{
 #endif
-			VectorFunction::call(key, Fct);	
+			VectorFunction::call(key, Fct);
 #ifdef __LINBOX_NO_GC_EXCEPTION
 		} catch(lb_runtime_error &t) {exit(0);}
 #endif
 		delete it->second;
-		vector_hashtable.erase(it);	
+		vector_hashtable.erase(it);
 	}
 }
 
@@ -211,7 +212,7 @@ void collectVector(){
 #ifdef __LINBOX_NO_GC_EXCEPTION
 		try{
 #endif
-			VectorFunction::call(*it, Fct);		
+			VectorFunction::call(*it, Fct);
 #ifdef __LINBOX_NO_GC_EXCEPTION
 		} catch (lb_runtime_error &t) {std::cout<<"LinBox exception catched\n"; exit(0);}
 #endif
@@ -225,11 +226,11 @@ void collectVector(){
  * API to collect all data allocated by LinBox *
  **********************************************/
 void LinBoxCollect(){
-	collectVector();   
-	collectBlackbox();  
-	collectElement();   
-	collectDomain();    
-} 
+	collectVector();
+	collectBlackbox();
+	collectElement();
+	collectDomain();
+}
 
 
 #endif
diff --git a/interfaces/driver/lb-garbage.h b/interfaces/driver/lb-garbage.h
old mode 100755
new mode 100644
index 1a46136..c51a252
--- a/interfaces/driver/lb-garbage.h
+++ b/interfaces/driver/lb-garbage.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-garbage.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_GARBAGE_H
-#define __LINBOX_LB_GARBAGE_H
+#ifndef __LINBOX_lb_garbage_H
+#define __LINBOX_lb_garbage_H
 
 
 #include <lb-domain-collection.h>
diff --git a/interfaces/driver/lb-interface.h b/interfaces/driver/lb-interface.h
old mode 100755
new mode 100644
index 4aa80a8..2e7ebd1
--- a/interfaces/driver/lb-interface.h
+++ b/interfaces/driver/lb-interface.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-interface.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -33,7 +34,7 @@
 #include <lb-det.h>
 #include <lb-rank.h> //problem with givaro-extension (UTT type is not always consistent) disabled in the code
 #include <lb-minpoly.h>
-#include <lb-charpoly.h> 
+#include <lb-charpoly.h>
 #include <lb-solve.h>
 
 // overload PreconditionFailed to be a real exception
diff --git a/interfaces/driver/lb-minpoly.C b/interfaces/driver/lb-minpoly.C
old mode 100755
new mode 100644
index cce1bcd..6be6a82
--- a/interfaces/driver/lb-minpoly.C
+++ b/interfaces/driver/lb-minpoly.C
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-minpoly.C
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_MINPOLY_C
-#define __LINBOX_LB_MINPOLY_C
+#ifndef __LINBOX_lb_minpoly_C
+#define __LINBOX_lb_minpoly_C
 
 
 #include <linbox/solutions/minpoly.h>
@@ -48,7 +49,7 @@ public:
 	void operator() (Result &res, Blackbox *B) const {
 		typedef typename Blackbox::Field::Element Element;
 		std::vector<Element> * phi = static_cast<std::vector<Element>*>(res);
-		LinBox::minpoly(*phi, *B, meth);	
+		LinBox::minpoly(*phi, *B, meth);
 		res = phi;
 	}
 };
@@ -78,7 +79,7 @@ const VectorKey& lb_minpoly(const BlackboxKey& key) {
 	BlackboxTable::iterator it = blackbox_hashtable.find(key);
 	if ( it == blackbox_hashtable.end())
 		throw lb_runtime_error("LinBox ERROR: blackbox is not defined (minpoly computation impossible)");
-		
+
 	const VectorKey *res = & createVector(it->second->getDomainKey(), 0, "linbox_dense");
 	lb_minpoly(*res, key);
 	return *res;
diff --git a/interfaces/driver/lb-minpoly.h b/interfaces/driver/lb-minpoly.h
old mode 100755
new mode 100644
index ec1c3d4..88ee819
--- a/interfaces/driver/lb-minpoly.h
+++ b/interfaces/driver/lb-minpoly.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-minpoly.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_MINPOLY_H
-#define __LINBOX_LB_MINPOLY_H
+#ifndef __LINBOX_lb_minpoly_H
+#define __LINBOX_lb_minpoly_H
 
 #include <lb-vector-collection.h>
 #include <lb-blackbox-collection.h>
diff --git a/interfaces/driver/lb-polynomial.C b/interfaces/driver/lb-polynomial.C
old mode 100755
new mode 100644
index f275c6b..530f4b9
--- a/interfaces/driver/lb-polynomial.C
+++ b/interfaces/driver/lb-polynomial.C
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-polynomial.C
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_POLYNOMIAL_C
-#define __LINBOX_LB_POLYNOMIAL_C
+#ifndef __LINBOX_lb_polynomial_C
+#define __LINBOX_lb_polynomial_C
 
 #include <lb-domain-collection.h>
 #include <lb-domain-function.h>
@@ -59,8 +60,8 @@ public:
 		D->write(os,(*poly)[deg])<<".x^"<<deg;
 		for (int i= (int)deg-1; i > 1 ; --i) {
 			if (!D->isZero((*poly)[i])){os<<" + ";D->write(os, (*poly)[i])<<".x^"<<i;}
-		} 
-		if (deg > 1) 
+		}
+		if (deg > 1)
 			if (!D->isZero((*poly)[1])){os<<" + ";D->write(os,(*poly)[1])<<".x";}
 		if (deg > 0)
 			if (!D->isZero((*poly)[0])){os<<" + ";D->write(os,(*poly)[0]);}
@@ -87,12 +88,12 @@ class WritePolynomialFunctor{
 protected:
 	std::ostream     &os;
 	const PolynomialKey &key;
-public:	
+public:
 	WritePolynomialFunctor(std::ostream &o, const PolynomialKey &k) : os(o), key(k) {}
 
 	template<class Polynomial>
 	void operator() (void*, Polynomial *P) const {
-	
+
 		VectorTable::iterator it = vector_hashtable.find(key);
 		if ( it == vector_hashtable.end())
 			throw lb_runtime_error("LinBox ERROR: invalid polynomial (writing impossible)");
@@ -105,7 +106,7 @@ public:
 
 void writePolynomial (const PolynomialKey &key, std::ostream &os){
 	WritePolynomialFunctor Fct(os, key);
-	VectorFunction::call(key, Fct);	
+	VectorFunction::call(key, Fct);
 }
 
 
@@ -153,12 +154,12 @@ public:
 class SerializePolynomialFunctor{
 protected:
 	const PolynomialKey &key;
-public:	
+public:
 	SerializePolynomialFunctor(const PolynomialKey &k) :  key(k) {}
 
 	template<class Polynomial>
 	void operator() (SerialPolynomial& s, Polynomial *P) const {
-	
+
 		VectorTable::iterator it = vector_hashtable.find(key);
 		if ( it == vector_hashtable.end())
 			throw lb_runtime_error("LinBox ERROR: invalid polynomial (serializing impossible)");
@@ -169,9 +170,9 @@ public:
 };
 
 
-void  SerializePolynomial (SerialPolynomial &s, const PolynomialKey &key) {       
+void  SerializePolynomial (SerialPolynomial &s, const PolynomialKey &key) {
 	SerializePolynomialFunctor Fct(key);
-	VectorFunction::call(s, key, Fct);	
+	VectorFunction::call(s, key, Fct);
 }
 
 
diff --git a/interfaces/driver/lb-polynomial.h b/interfaces/driver/lb-polynomial.h
old mode 100755
new mode 100644
index 19dbfdb..5c61109
--- a/interfaces/driver/lb-polynomial.h
+++ b/interfaces/driver/lb-polynomial.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-polynomial.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_POLYNOMIAL_H
-#define __LINBOX_LB_POLYNOMIAL_H
+#ifndef __LINBOX_lb_polynomial_H
+#define __LINBOX_lb_polynomial_H
 
 #include <lb-vector-collection.h>
 
diff --git a/interfaces/driver/lb-rank.C b/interfaces/driver/lb-rank.C
old mode 100755
new mode 100644
index 1871eed..f51dc81
--- a/interfaces/driver/lb-rank.C
+++ b/interfaces/driver/lb-rank.C
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-rank.C
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_RANK_C
-#define __LINBOX_LB_RANK_C
+#ifndef __LINBOX_lb_rank_C
+#define __LINBOX_lb_rank_C
 
 
 #include <linbox/solutions/rank.h>
@@ -40,13 +41,13 @@ class RankFunctor{
 private:
 	Method meth;
 public:
-	
+
 	RankFunctor(Method m = Method()) : meth(m) {}
 
 	template<class Blackbox>
 	void operator() (unsigned long &res, Blackbox *B) const {
-		LinBox::rank(res, *B, meth);		
-	}	
+		LinBox::rank(res, *B, meth);
+	}
 };
 
 /**********************************************************
@@ -62,7 +63,7 @@ void lb_rank(unsigned long &res, const BlackboxKey& key){
  * API for rank computation                          *
  * rank is returned through an unsigned long integer *
  *****************************************************/
-unsigned long lb_rank(const BlackboxKey& key){	
+unsigned long lb_rank(const BlackboxKey& key){
 	unsigned long r;
 	lb_rank(r, key);
 	return r;
diff --git a/interfaces/driver/lb-rank.h b/interfaces/driver/lb-rank.h
old mode 100755
new mode 100644
index fe27cbe..bfe8e05
--- a/interfaces/driver/lb-rank.h
+++ b/interfaces/driver/lb-rank.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-rank.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_RANK_H
-#define __LINBOX_LB_RANK_H
+#ifndef __LINBOX_lb_rank_H
+#define __LINBOX_lb_rank_H
 
 
 #include <lb-blackbox-collection.h>
diff --git a/interfaces/driver/lb-solve.C b/interfaces/driver/lb-solve.C
old mode 100755
new mode 100644
index b27691e..00c93ab
--- a/interfaces/driver/lb-solve.C
+++ b/interfaces/driver/lb-solve.C
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-solve.C
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_SOLVE_C
-#define __LINBOX_LB_SOLVE_C
+#ifndef __LINBOX_lb_solve_C
+#define __LINBOX_lb_solve_C
 
 #include <linbox/solutions/solve.h>
 
@@ -59,7 +60,7 @@ class LaunchSolveFunctor<Element, Element, Element, DomainCategory>{
 public:
 	template<class Result, class Blackbox, class Vector, class Method>
 	inline void  operator()(Result &s, Blackbox *B, Vector *v, const Method &m) const {
-		LinBox::solve(s, *B, *v, m);		
+		LinBox::solve(s, *B, *v, m);
 	}
 };
 
@@ -70,7 +71,7 @@ class LaunchSolveFunctor<Element, Element, Element, LinBox::RingCategories::Inte
 public:
 	template<class Result, class Blackbox, class Vector, class Method>
 	inline void  operator()(Result &s, Blackbox *B, Vector *v, const Method &m) const {
-		//LinBox::solve(s, *B, *v, m);		
+		//LinBox::solve(s, *B, *v, m);
 		//not yet handled
 		throw lb_runtime_error("LinBox ERROR: integer system solving with same vector type is not yet handled");
 	}
@@ -82,8 +83,8 @@ template<class Element>
 class LaunchSolveFunctor<LinBox::GMPRationalElement, Element, Element, LinBox::RingCategories::IntegerTag >{
 public:
 	template<class Result, class Blackbox, class Vector, class Method>
-	inline void  operator()(Result &s, Blackbox *B, Vector *v, const Method &m) const {	
-		LinBox::solve(s, *B, *v, m);		
+	inline void  operator()(Result &s, Blackbox *B, Vector *v, const Method &m) const {
+		LinBox::solve(s, *B, *v, m);
 	}
 };
 
@@ -98,17 +99,17 @@ protected:
 	Blackbox         *_BB;
 	const Method   &meth;
 public:
-	
+
 	SolvePartialFunctor (Blackbox *B, const Method &m) : _BB(B), meth(m) {}
-	
+
 	template<class Vector>
 	void operator()(const VectorKey& Vkey, Vector *res) const {
 		VectorTable::iterator it = vector_hashtable.find(Vkey);
 		if (it == vector_hashtable.end())
 			throw lb_runtime_error("LinBox ERROR: right hand side vector does not exist (solving impossible)\n");
-		
+
 		SolvePartialFunctor<Blackbox, Method> fct(_BB, meth);
-		VectorFunction::call(*res, Vkey, fct);		
+		VectorFunction::call(*res, Vkey, fct);
 	}
 
       	template<class Vector, class Result>
@@ -140,7 +141,7 @@ public:
 		const DomainKey *k= &createDomain(0, current_rational_field);
 		v->rebind(*k);
 		deleteDomain(*k);
-	}	
+	}
 };
 
 
@@ -157,7 +158,7 @@ void modifyResultVector(const VectorKey &key){
 	VectorTable::iterator it = vector_hashtable.find(key);
 	if (it == vector_hashtable.end())
 			throw lb_runtime_error("LinBox ERROR: result vector does not exist (solving impossible)\n");
-	
+
 	const DomainKey *Dkey = &(it->second->getDomainKey());
 	MutateVectorFunctor Fct;
 	DomainFunction::call(it->second, *Dkey, Fct);
@@ -189,7 +190,7 @@ public:
  * vector solution  is returned through a given vector key *
  ***********************************************************/
 
-void lb_solve(const VectorKey &res, const BlackboxKey &Bkey, const VectorKey &Vkey) {		
+void lb_solve(const VectorKey &res, const BlackboxKey &Bkey, const VectorKey &Vkey) {
 	SolveFunctor<> fct(res);
 	modifyResultVector(res);
 	BlackboxFunction::call(Vkey, Bkey, fct);
@@ -200,11 +201,11 @@ void lb_solve(const VectorKey &res, const BlackboxKey &Bkey, const VectorKey &Vk
  * vector solution  is returned through a vector key *
  *****************************************************/
 
-const VectorKey&  lb_solve(const BlackboxKey &Bkey, const VectorKey &Vkey) {	
+const VectorKey&  lb_solve(const BlackboxKey &Bkey, const VectorKey &Vkey) {
 
 	BlackboxTable::iterator it = blackbox_hashtable.find(Bkey);
 	if (it == blackbox_hashtable.end())
-		throw lb_runtime_error("LinBox ERROR: blackbox does not exist (solving impossible)\n");	
+		throw lb_runtime_error("LinBox ERROR: blackbox does not exist (solving impossible)\n");
 	const DomainKey *Dkey = &it->second->getDomainKey();
 
 	std::pair<size_t,size_t> dim;
diff --git a/interfaces/driver/lb-solve.h b/interfaces/driver/lb-solve.h
old mode 100755
new mode 100644
index ef6d438..00678e2
--- a/interfaces/driver/lb-solve.h
+++ b/interfaces/driver/lb-solve.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-solve.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_SOLVE_H
-#define __LINBOX_LB_SOLVE_H
+#ifndef __LINBOX_lb_solve_H
+#define __LINBOX_lb_solve_H
 
 #include <lb-blackbox-collection.h>
 #include <lb-vector-collection.h>
diff --git a/interfaces/driver/lb-utilities.h b/interfaces/driver/lb-utilities.h
old mode 100755
new mode 100644
index 2b934f6..b0caab9
--- a/interfaces/driver/lb-utilities.h
+++ b/interfaces/driver/lb-utilities.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-utilities.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_UTILITIES_H
-#define __LINBOX_LB_UTILITIES_H
+#ifndef __LINBOX_lb_utilities_H
+#define __LINBOX_lb_utilities_H
 
 
 #include <linbox/util/error.h>
@@ -105,22 +106,22 @@ namespace LinBoxTL{
 
 	template <class List1, class List2>
 	struct Append;
-	
+
 	template <>
 	struct Append <LinBoxDumbType, LinBoxDumbType>{
-		typedef LinBoxDumbType Result; 
+		typedef LinBoxDumbType Result;
 	};
-	
-	template <class T> 
+
+	template <class T>
 	struct Append <LinBoxDumbType, T> {
 		typedef LinBoxTypelist<T, LinBoxDumbType> Result;
 	};
-	
+
 	template <class T, class U>
 	struct Append <LinBoxDumbType, LinBoxTypelist<T, U> > {
 		typedef LinBoxTypelist<T,U> Result;
 	};
-	
+
 	template <class Head, class Tail, class T>
 	struct Append <LinBoxTypelist<Head, Tail>, T > {
 		typedef LinBoxTypelist<Head, typename Append<Tail, T>::Result> Result;
diff --git a/interfaces/driver/lb-vector-abstract.h b/interfaces/driver/lb-vector-abstract.h
old mode 100755
new mode 100644
index c437552..37c9052
--- a/interfaces/driver/lb-vector-abstract.h
+++ b/interfaces/driver/lb-vector-abstract.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-vector-abstract.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_VECTOR_ABSTRACT_H
-#define __LINBOX_LB_VECTOR_ABSTRACT_H
+#ifndef __LINBOX_lb_vector_abstract_H
+#define __LINBOX_lb_vector_abstract_H
 
 #include <lb-utilities.h>
 #include <lb-domain-collection.h>
diff --git a/interfaces/driver/lb-vector-collection.h b/interfaces/driver/lb-vector-collection.h
old mode 100755
new mode 100644
index d26b186..702784f
--- a/interfaces/driver/lb-vector-collection.h
+++ b/interfaces/driver/lb-vector-collection.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-vector-collection.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_VECTOR_COLLECTION_H
-#define __LINBOX_LB_VECTOR_COLLECTION_H
+#ifndef __LINBOX_lb_vector_collection_H
+#define __LINBOX_lb_vector_collection_H
 
 #include <map>
 #include <lb-vector-abstract.h>
@@ -31,7 +32,7 @@
  * Collection of Vectors *
  *************************/
 
-// definition of a key 
+// definition of a key
 typedef size_t VectorKey;
 
 // comparison functor on key
diff --git a/interfaces/driver/lb-vector-data.h b/interfaces/driver/lb-vector-data.h
old mode 100755
new mode 100644
index da719ad..5c3aac3
--- a/interfaces/driver/lb-vector-data.h
+++ b/interfaces/driver/lb-vector-data.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-vector-data.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_VECTOR_DATA_H
-#define __LINBOX_LB_VECTOR_DATA_H
+#ifndef __LINBOX_lb_vector_data_H
+#define __LINBOX_lb_vector_data_H
 
 #include <vector>
 #include <linbox/field/hom.h>
@@ -45,11 +46,11 @@ class VectorSpecFunctor{
 	void *ptr;
 public:
 	VectorSpecFunctor(const Functor &f, void *p) : fct(f), ptr(p) {}
-	
+
 	template<class Domain, class Result>
 	void  operator() (Result& res, Domain *d) const {
 		fct(res, static_cast<Vector<typename Domain::Element, Alloc<typename Domain::Element> >*> (ptr));
-	} 
+	}
 };
 
 /*****************************************
@@ -62,15 +63,15 @@ public:
 	typedef VectorAbstract* (*createVector_2_CallBack)(const DomainKey &, std::istream&, const char*);
 
 	typedef std::map<const char*, std::pair<createVector_1_CallBack, createVector_2_CallBack > , ltstr> CallBackMap;
-	
+
 	bool add(const char *name, std::pair<createVector_1_CallBack, createVector_2_CallBack> createD){
 		return _callback.insert(CallBackMap::value_type(name, createD)).second;
 	}
-	
+
 	bool remove(const char *name){
 		return _callback.erase(name) == 1;
 	}
-	
+
 	VectorAbstract* create(const char *name, const DomainKey &k, size_t n){
 		CallBackMap::iterator it = _callback.find(name);
 		if (it != _callback.end()){
@@ -92,13 +93,13 @@ public:
 			mes+= std::string(name);
 			mes+= std::string(" >>\n");
 			throw lb_runtime_error(mes.c_str());// throw an exception
-		}		
-		
-	}		
+		}
+
+	}
 
 	size_t size() { return _callback.size(); }
 
-private:	
+private:
 	CallBackMap _callback;
 };
 
@@ -127,21 +128,21 @@ public:
 	RebindVectorFunctor(void *&p) : ptr(p) {}
 
 	template<class Domain>
-	void operator()(const DomainKey &key, Domain *D) const {		
+	void operator()(const DomainKey &key, Domain *D) const {
 		RebindVectorFunctor fct(ptr);
 		DomainFunction::call(*D, key, fct);
 	}
 
-	
+
 	template<class DomainSource, class DomainTarget>
 	void operator()(DomainSource &res, DomainTarget *D) const {
-		Vector<typename DomainSource::Element,Alloc<typename DomainSource::Element> > *v_source= static_cast<Vector<typename DomainSource::Element,Alloc<typename DomainSource::Element> > * >  (ptr);				
+		Vector<typename DomainSource::Element,Alloc<typename DomainSource::Element> > *v_source= static_cast<Vector<typename DomainSource::Element,Alloc<typename DomainSource::Element> > * >  (ptr);
 	Vector<typename DomainTarget::Element,Alloc<typename DomainTarget::Element> > *v_target= new Vector<typename DomainTarget::Element,Alloc<typename DomainTarget::Element> >(v_source->size());
 
 		LinBox::Hom<DomainSource, DomainTarget> hom(res, *D);
 		for (size_t i=0;i<v_source->size();++i)
 			hom.image((*v_target)[i], (*v_source)[i]);
-		
+
 		delete v_source;
 		ptr = v_target;
 	}
@@ -151,17 +152,17 @@ public:
  * Vector Envelope to be compliant with Vector Abstract *
  ********************************************************/
 
-template<template<class Element, class Alloc=std::allocator<Element> > class Vector> 
+template<template<class Element, class Alloc=std::allocator<Element> > class Vector>
 class VectorEnvelope : public VectorAbstract {
 protected:
 	void         *ptr;
 	DomainKey     key;
 	const char* _info;
 public:
-	VectorEnvelope(void* p, const DomainKey &k, const char* info) : ptr(p), key(k, true), _info(info) {}	
+	VectorEnvelope(void* p, const DomainKey &k, const char* info) : ptr(p), key(k, true), _info(info) {}
 
 	~VectorEnvelope() {}
-	
+
 	LINBOX_VISITABLE();
 
 	template<class Functor, class Result>
@@ -169,7 +170,7 @@ public:
 		VectorSpecFunctor<Vector, Functor> vs(fct, ptr);
 		DomainFunction::call(res, key, vs);
 	}
-	
+
 	VectorAbstract* clone() const {
 		CopyVectorFunctor Fct;
 		void *v;
@@ -180,7 +181,7 @@ public:
 	void * getPtr() const { return ptr;}
 
 	const DomainKey& getDomainKey() const {return key;}
-	
+
 	const char* info() const {
 		std::string msg= "[ LinBox Vector (storage = ";
 		msg+= std::string(_info);
@@ -193,11 +194,11 @@ public:
 	}
 
 	void rebind(const DomainKey &k) {
-		RebindVectorFunctor<Vector> Fct(ptr);		
-		DomainFunction::call(k, key, Fct);	
+		RebindVectorFunctor<Vector> Fct(ptr);
+		DomainFunction::call(k, key, Fct);
 		key = k;
 		key.set_autogc();
-	}	
+	}
 };
 
 
@@ -213,15 +214,15 @@ public:
 	CreateVectorFunctor( size_t &n) : _dim(n) {}
 
 	template<class Domain>
-	void operator()(void *&res, Domain *D) const {		
+	void operator()(void *&res, Domain *D) const {
 		typename Domain::Element zero;
 		D->init(zero, 0UL);
-		res = new Vector<typename Domain::Element, Alloc<typename Domain::Element> >(_dim, zero);	
+		res = new Vector<typename Domain::Element, Alloc<typename Domain::Element> >(_dim, zero);
 	}
 };
 
 template<template<class,class> class Vector, template <class> class Alloc=std::allocator>
-class CreateVectorFromStreamFunctor{	
+class CreateVectorFromStreamFunctor{
 	std::istream ∈
 public:
 	CreateVectorFromStreamFunctor(std::istream &i) : in(i) {}
diff --git a/interfaces/driver/lb-vector-function.h b/interfaces/driver/lb-vector-function.h
old mode 100755
new mode 100644
index f3bb419..854ab14
--- a/interfaces/driver/lb-vector-function.h
+++ b/interfaces/driver/lb-vector-function.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-vector-function.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,12 +21,12 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_VECTOR_FUNCTION_H
-#define __LINBOX_LB_VECTOR_FUNCTION_H
+#ifndef __LINBOX_lb_vector_function_H
+#define __LINBOX_lb_vector_function_H
 
 
 #include <lb-vector-abstract.h>
-#include <lb-vector-functor.h> 
+#include <lb-vector-functor.h>
 
 
 /*********************************************************
@@ -38,32 +39,32 @@ public:
 	template<class Functor, class Result>
 	static void call(Result &res, const std::pair<const VectorKey, VectorAbstract*> &vector, const Functor &functor){
 		ApplyVectorFunctor<Functor, Result> Ap(res, functor);
-		(vector.second)->Accept(Ap);	
+		(vector.second)->Accept(Ap);
 	}
 
 	// call a functor over a vector from the hashtable, no result
 	template<class Functor>
 	static void call(const std::pair<const VectorKey, VectorAbstract*> &v, const Functor &f){
-		void *dumbresult; 
+		void *dumbresult;
 		call(dumbresult,v,f);
 	}
-	
+
 	// call a functor over a vector from its key, result is given through 1st parameter
 	template<class Functor, class Result>
 	static void call(Result &res, const VectorKey &key, const Functor &functor){
-		VectorTable::const_iterator it = vector_hashtable.find(key);  
+		VectorTable::const_iterator it = vector_hashtable.find(key);
 		if (it != vector_hashtable.end())
 			VectorFunction::call(res, *it, functor);
 		else
 			throw lb_runtime_error("LinBox ERROR: use of a non allocated vector\n");// throw an exception
 	}
-	
+
 	// call a functor over a vector from its key, no result
 	template<class Functor>
-	static void call(const VectorKey &k, const Functor &f) { 
-		void *dumbresult; 
+	static void call(const VectorKey &k, const Functor &f) {
+		void *dumbresult;
 		call(dumbresult,k,f);
 	}
 };
-	
+
 #endif
diff --git a/interfaces/driver/lb-vector-functor.h b/interfaces/driver/lb-vector-functor.h
old mode 100755
new mode 100644
index ca70af2..bb9eb7f
--- a/interfaces/driver/lb-vector-functor.h
+++ b/interfaces/driver/lb-vector-functor.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-vector-functor.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_VECTOR_FUNCTOR_H
-#define __LINBOX_LB_VECTOR_FUNCTOR_H
+#ifndef __LINBOX_lb_vector_functor_H
+#define __LINBOX_lb_vector_functor_H
 
 #include <lb-utilities.h>
 #include <lb-vector-data.h>
@@ -40,7 +41,7 @@ protected:
 
 public:
 	ApplyVectorFunctorBase(){}
-	
+
 	template<class Vector>
 	void apply(const Vector &b){
 		b.launch(*res, *fct);
@@ -63,16 +64,16 @@ template <class BList, class Functor, class Result> class LinBoxVectorVisitor;
 
 template <class Functor, class Result> class LinBoxVectorVisitor<LinBoxDumbType, Functor, Result>{};
 
-template <class T, class Functor, class Result> 
-class LinBoxVectorVisitor<LinBoxTypelist<T, LinBoxDumbType>, Functor, Result> 
-	: public LinBoxVisitor <T>, 
+template <class T, class Functor, class Result>
+class LinBoxVectorVisitor<LinBoxTypelist<T, LinBoxDumbType>, Functor, Result>
+	: public LinBoxVisitor <T>,
 	  public ApplyVectorFunctorBase<Functor, Result> {
 public:
 	LB_VECTOR_VISIT(T);
 };
 
 template <class Head, class Tail, class Functor, class Result>
-class LinBoxVectorVisitor<LinBoxTypelist<Head, Tail>, Functor, Result > 
+class LinBoxVectorVisitor<LinBoxTypelist<Head, Tail>, Functor, Result >
 	: public LinBoxVisitor <Head> ,
 	  public LinBoxVectorVisitor<Tail, Functor, Result> {
 	public:
@@ -87,7 +88,7 @@ class LinBoxVectorVisitor<LinBoxTypelist<Head, Tail>, Functor, Result >
 template<class Functor, class Result>
 class ApplyVectorFunctor : public LinBoxVectorVisitor<VectorList, Functor, Result> {
 public:
-	ApplyVectorFunctor(Result &r, const Functor &f) { 
+	ApplyVectorFunctor(Result &r, const Functor &f) {
 		this->res = &r;
 		this->fct = &f;
 	}
diff --git a/interfaces/driver/lb-vector-type.h b/interfaces/driver/lb-vector-type.h
old mode 100755
new mode 100644
index ed6cf7f..5c393e4
--- a/interfaces/driver/lb-vector-type.h
+++ b/interfaces/driver/lb-vector-type.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-vector-type.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_VECTOR_TYPE_H
-#define __LINBOX_LB_VECTOR_TYPE_H
+#ifndef __LINBOX_lb_vector_type_H
+#define __LINBOX_lb_vector_type_H
 
 
 /**************************************
@@ -42,7 +43,7 @@ typedef VL1 VectorList;
 extern Vector_Factory linbox_vector;
 
 void UpdateVector() {
-	linbox_vector.add("linbox_dense", Vector_Factory::CallBackMap::value_type::second_type( constructVector_from_size<std::vector>, 
+	linbox_vector.add("linbox_dense", Vector_Factory::CallBackMap::value_type::second_type( constructVector_from_size<std::vector>,
 												constructVector_from_stream<std::vector> ));
 }
 
diff --git a/interfaces/driver/lb-vector.C b/interfaces/driver/lb-vector.C
old mode 100755
new mode 100644
index d8348a1..9735ad9
--- a/interfaces/driver/lb-vector.C
+++ b/interfaces/driver/lb-vector.C
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-vector.C
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_VECTOR_C
-#define __LINBOX_LB_VECTOR_C
+#ifndef __LINBOX_lb_vector_C
+#define __LINBOX_lb_vector_C
 
 #include <linbox-config.h>
 
@@ -35,7 +36,7 @@
  * Allocate global variable *
  ****************************/
 
-// global hash table for allocated vector 
+// global hash table for allocated vector
 VectorTable vector_hashtable;
 
 // global variable for the factory
@@ -50,7 +51,7 @@ const char* current_vector  = default_vector;
  * function to add an abstract vector in linbox hashtable *
  **********************************************************/
 const VectorKey& addVector(VectorAbstract * v){
-	
+
 	std::pair<VectorTable::const_iterator, bool> status;
 	status = vector_hashtable.insert(std::pair<VectorKey, VectorAbstract*> (VectorKey(v), v));
 	if (status.second)
@@ -68,7 +69,7 @@ const VectorKey& createVector(const DomainKey &k, size_t n, const char *name){
 	if (type == NULL)
 		type= current_vector;
 
-	VectorAbstract *v = linbox_vector.create(type, k, n); 
+	VectorAbstract *v = linbox_vector.create(type, k, n);
 	return addVector(v);
 }
 
@@ -81,8 +82,8 @@ const VectorKey& createVector(const DomainKey &k, std::istream &in, const char *
 	const char *type=name;
 	if (type == NULL)
 		type= current_vector;
-	
-	VectorAbstract *v = linbox_vector.create(type, k, in); 
+
+	VectorAbstract *v = linbox_vector.create(type, k, in);
 	return addVector(v);
 }
 
@@ -91,13 +92,13 @@ const VectorKey& createVector(const DomainKey &k, std::istream &in, const char *
  * API to copy an existing vector *
  **********************************/
 const VectorKey& copyVector(const VectorKey &k){
-	
+
 	VectorTable::iterator it = vector_hashtable.find(k);
 	if (it == vector_hashtable.end())
 		throw lb_runtime_error("LinBox ERROR: vector does not exist (copying impossible)\n");
-	
+
 	VectorAbstract *v = it->second->clone();
-	return addVector(v);       
+	return addVector(v);
 }
 
 
@@ -138,7 +139,7 @@ public:
 	template<class Vector, class Domain>
 	void operator()(Vector *V, Domain *D) {
 		typename Domain::RandIter G(*D);
-		for (size_t i=0; i< V->size();++i) 
+		for (size_t i=0; i< V->size();++i)
 			G.random((*V)[i]);
 	}
 };
@@ -149,8 +150,8 @@ protected:
 	Vector *vect;
 public:
 	VectorAtRandomFunctorSpec(Vector *V) : vect(V) {}
-	
-	template<class Domain> 
+
+	template<class Domain>
 	void operator()(void *, Domain *D) const {
 		RandomVector<typename Vector::value_type, typename Domain::Element>()(vect, D);
 	}
@@ -161,13 +162,13 @@ protected:
 	const VectorKey key;
 public:
 	VectorAtRandomFunctor(const VectorKey &k) : key(k) {}
-	
+
 	template<class Vector>
 	void operator()(void*, Vector *V) const {
 		VectorTable::iterator it = vector_hashtable.find(key);
 		if ( it == vector_hashtable.end())
 			throw lb_runtime_error("LinBox ERROR: invalid vector (set random value impossible)");
-		
+
 		VectorAtRandomFunctorSpec<Vector> Fct(V);
 		DomainFunction::call(it->second->getDomainKey(), Fct);
 	}
@@ -209,7 +210,7 @@ class PrintVector<Element, Element> {
 public:
 	template< class Domain, class Vector, class Out>
 	void operator()(Domain *D, Vector *vect, Out &os){
-		os<<" [ "; 
+		os<<" [ ";
 		for (size_t i=0; i<vect->size()-1; ++i){
 			D->write(os, (*vect)[i])<<" , ";
 		}
@@ -236,12 +237,12 @@ class WriteVectorFunctor{
 protected:
 	std::ostream     &os;
 	const VectorKey &key;
-public:	
+public:
 	WriteVectorFunctor(std::ostream &o, const VectorKey &k) : os(o), key(k) {}
 
 	template<class Vector>
 	void operator() (void*, Vector *V) const {
-	
+
 		VectorTable::iterator it = vector_hashtable.find(key);
 		if ( it == vector_hashtable.end())
 			throw lb_runtime_error("LinBox ERROR: invalid vector (writing impossible)");
@@ -254,7 +255,7 @@ public:
 
 void writeVector (const VectorKey &key, std::ostream &os){
 	WriteVectorFunctor Fct(os, key);
-	VectorFunction::call(key, Fct);	
+	VectorFunction::call(key, Fct);
 }
 
 
@@ -314,7 +315,7 @@ public:
 	inline void operator()(SerialVector &s, Domain *D, Vector *poly){
 		s.type = "rational";
 		s.list.resize(2*poly->size());
-	
+
 		typename Vector::const_iterator    it_P= poly->begin();
 		std::vector<LinBox::integer>::iterator it_s= s.list.begin();
 		for (; it_P != poly->end(); ++it_P, ++it_s){
@@ -343,12 +344,12 @@ public:
 class SerializeVectorFunctor{
 protected:
 	const VectorKey &key;
-public:	
+public:
 	SerializeVectorFunctor(const VectorKey &k) :  key(k) {}
 
 	template<class Vector>
 	void operator() (SerialVector& s, Vector *P) const {
-	
+
 		VectorTable::iterator it = vector_hashtable.find(key);
 		if ( it == vector_hashtable.end())
 			throw lb_runtime_error("LinBox ERROR: invalid vector (serializing impossible)");
@@ -359,9 +360,9 @@ public:
 };
 
 
-void  SerializeVector (SerialVector &s, const VectorKey &key) {       
+void  SerializeVector (SerialVector &s, const VectorKey &key) {
 	SerializeVectorFunctor Fct(key);
-	VectorFunction::call(s, key, Fct);	
+	VectorFunction::call(s, key, Fct);
 }
 
 
diff --git a/interfaces/driver/lb-vector.h b/interfaces/driver/lb-vector.h
old mode 100755
new mode 100644
index bfbb6c7..5c80346
--- a/interfaces/driver/lb-vector.h
+++ b/interfaces/driver/lb-vector.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-vector.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_LB_VECTOR_H
-#define __LINBOX_LB_VECTOR_H
+#ifndef __LINBOX_lb_vector_H
+#define __LINBOX_lb_vector_H
 
 #include <lb-domain-collection.h>
 #include <lb-vector-collection.h>
diff --git a/interfaces/kaapi/Makefile.am b/interfaces/kaapi/Makefile.am
index 661fe0d..de8ecee 100644
--- a/interfaces/kaapi/Makefile.am
+++ b/interfaces/kaapi/Makefile.am
@@ -1,3 +1,6 @@
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 pkgincludesubdir=$(pkgincludedir)/kaapi
 
 pkgincludesub_HEADERS = \
diff --git a/interfaces/kaapi/Makefile.in b/interfaces/kaapi/Makefile.in
index fdfbd64..e4ef772 100644
--- a/interfaces/kaapi/Makefile.in
+++ b/interfaces/kaapi/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -37,19 +38,26 @@ DIST_COMMON = $(pkgincludesub_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
-	$(top_srcdir)/macros/blas-check.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
 	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
 	$(top_srcdir)/macros/givaro-check.m4 \
 	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
 	$(top_srcdir)/macros/lidia-check.m4 \
 	$(top_srcdir)/macros/linbox-doc.m4 \
 	$(top_srcdir)/macros/linbox-misc.m4 \
 	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
 	$(top_srcdir)/macros/maple-check.m4 \
 	$(top_srcdir)/macros/ntl-check.m4 \
 	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -79,18 +87,21 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
 CC = @CC@
+CCNAM = @CCNAM@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
 DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -98,19 +109,24 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
 GIVARO_CFLAGS = @GIVARO_CFLAGS@
 GIVARO_LIBS = @GIVARO_LIBS@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
 GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
@@ -118,41 +134,52 @@ LIBTOOL = @LIBTOOL@
 LIDIA_CFLAGS = @LIDIA_CFLAGS@
 LIDIA_LIBS = @LIDIA_LIBS@
 LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MAPLE_CFLAGS = @MAPLE_CFLAGS@
 MAPLE_HOME = @MAPLE_HOME@
 MAPLE_LIBS = @MAPLE_LIBS@
 MAPLE_VERSION = @MAPLE_VERSION@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
 NTL_CFLAGS = @NTL_CFLAGS@
 NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RM = @RM@
 SACLIB_CFLAGS = @SACLIB_CFLAGS@
 SACLIB_LIBS = @SACLIB_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+TESTS_CFLAGS = @TESTS_CFLAGS@
 VERSION = @VERSION@
+WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -193,8 +220,13 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 pkgincludesubdir = $(pkgincludedir)/kaapi
 pkgincludesub_HEADERS = \
 communicate.h
@@ -206,8 +238,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
 	      exit 1;; \
 	  esac; \
 	done; \
@@ -260,7 +292,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
@@ -373,6 +405,8 @@ dvi-am:
 
 html: html-am
 
+html-am:
+
 info: info-am
 
 info-am:
@@ -381,18 +415,28 @@ install-data-am: install-pkgincludesubHEADERS
 
 install-dvi: install-dvi-am
 
+install-dvi-am:
+
 install-exec-am:
 
 install-html: install-html-am
 
+install-html-am:
+
 install-info: install-info-am
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-am
 
+install-pdf-am:
+
 install-ps: install-ps-am
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
diff --git a/interfaces/kaapi/communicate.h b/interfaces/kaapi/communicate.h
index fe8a948..87b748e 100644
--- a/interfaces/kaapi/communicate.h
+++ b/interfaces/kaapi/communicate.h
@@ -1,5 +1,29 @@
-#ifndef _KAAPI_COMMUNICATE_H
-#define _KAAPI_COMMUNICATE_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
+/* Copyright (C) LinBox
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+
+#ifndef __LINBOX_kaapi_communicate_H
+#define __LINBOX_kaapi_communicate_H
 
 #include <athapascan-1>
 #include "linbox/integer.h"
@@ -17,12 +41,12 @@ a1::OStream& operator<<( a1::OStream& out, const Integer& x ) {
 }
 
 a1::IStream& operator>>( a1::IStream& in, Integer& x ) {
-    std::string is;
-    in >> is;
+	std::string is;
+	in >> is;
 
 	std::istringstream iss(is);
 	iss >> x;
-    return in;
+	return in;
 }
 
 /*
@@ -30,34 +54,36 @@ a1::IStream& operator>>( a1::IStream& in, Integer& x ) {
  * we first inherit from them to access protected memebers
  */
 
-namespace kaapi {
+/// limited doc so far.
+namespace kaapi
+{
 
-template <class T> struct Modular;
+	template <class T> struct Modular;
 
-/*
- * double specialization
- */
-template <>
-struct Modular<double> : LinBox::Modular<double>
-{
-    const double& get_modulus() const { return this->modulus; }
-    const unsigned long& get_lmodulus() const { return this->lmodulus; }
-    double& get_modulus() { return this->modulus; }
-    unsigned long& get_lmodulus() { return this->lmodulus; }
-};
+	/*
+	 * double specialization
+	 */
+	template <>
+	struct Modular<double> : LinBox::Modular<double>
+	{
+		const double& get_modulus() const { return this->modulus; }
+		const unsigned long& get_lmodulus() const { return this->lmodulus; }
+		double& get_modulus() { return this->modulus; }
+		unsigned long& get_lmodulus() { return this->lmodulus; }
+	};
 
 } //namespace
 
 a1::OStream& operator<<( a1::OStream& out, const LinBox::Modular<double>& m)
 {
-    const kaapi::Modular<double>* m_tmp = static_cast<const kaapi::Modular<double>*>(&m);
-    return out << m_tmp->get_modulus() << m_tmp->get_lmodulus() ;
+	const kaapi::Modular<double>* m_tmp = static_cast<const kaapi::Modular<double>*>(&m);
+	return out << m_tmp->get_modulus() << m_tmp->get_lmodulus() ;
 }
 
 a1::IStream& operator>>( a1::IStream& in, LinBox::Modular<double>& m)
 {
-    kaapi::Modular<double>* m_tmp = static_cast<kaapi::Modular<double>*>(&m);
-    return in >> m_tmp->get_modulus() >> m_tmp->get_lmodulus() ;
+	kaapi::Modular<double>* m_tmp = static_cast<kaapi::Modular<double>*>(&m);
+	return in >> m_tmp->get_modulus() >> m_tmp->get_lmodulus() ;
 }
 
-#endif
+#endif //__LINBOX_kaapi_communicate_H
diff --git a/interfaces/maple/Makefile.am b/interfaces/maple/Makefile.am
index 988a7bc..72b1deb 100644
--- a/interfaces/maple/Makefile.am
+++ b/interfaces/maple/Makefile.am
@@ -1,24 +1,27 @@
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 if LINBOX_HAVE_MAPLE
 pkgincludesubdir=$(includedir)/interfaces/maple/new
 
-INCLUDES=-I$(top_srcdir) -I. -I../../linbox
+AM_CPPFLAGS =-I$(top_srcdir) -I. -I../../linbox
 
-AM_CXXFLAGS = -O2 -DDISABLE_COMMENTATOR -I../driver $(GMP_CFLAGS) $(NTL_CFLAGS) $(ATLAS_CFLAGS) $(MAPLE_CFLAGS) $(GIVARO_CFLAGS)
+AM_CXXFLAGS = @DEFAULT_CFLAGS@ -DDISABLE_COMMENTATOR -I../driver $(GMP_CFLAGS) $(NTL_CFLAGS) $(ATLAS_CFLAGS) $(FFLAFLAS_CFLAGS) $(MAPLE_CFLAGS) $(GIVARO_CFLAGS)
 
-lib_LTLIBRARIES=liblbmaple.la 
+lib_LTLIBRARIES=liblbmaple.la
 
 liblbmaple_la_SOURCES= lb-maple.C
 
-liblbmaple_la_LDFLAGS=$(GMP_LIBS) $(NTL_LIBS) $(BLAS_LIBS) $(MAPLE_LIBS) $(GIVARO_LIBS) $(top_srcdir)/interfaces/driver/liblbdriver.la -Wl,-zmuldefs
+liblbmaple_la_LDFLAGS=$(GIVARO_LIBS) $(GMP_LIBS) $(NTL_LIBS) $(BLAS_LIBS) $(MAPLE_LIBS) $(top_srcdir)/interfaces/driver/liblbdriver.la -Wl,-zmuldefs
 
 pkginclude_HEADERS =lb-maple.h lb-maple-utilities.h
 
 
-install-data-local: 
+install-data-local:
 	sh lb-maple-path.sh "$(libdir)/liblbmaple.so"
 	$(INSTALL_DATA) lb-maple.mpl $(libdir)/lb-maple.mpl
 
 install-data-hook:
 	cd $(libdir) && \
 	$(MAPLE_HOME)/bin/maple lb-maple.mpl 2>&1 > /dev/null
-endif
\ No newline at end of file
+endif
diff --git a/interfaces/maple/Makefile.in b/interfaces/maple/Makefile.in
index ccbda9b..bbf904b 100644
--- a/interfaces/maple/Makefile.in
+++ b/interfaces/maple/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -38,19 +39,26 @@ DIST_COMMON = $(am__pkginclude_HEADERS_DIST) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
-	$(top_srcdir)/macros/blas-check.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
 	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
 	$(top_srcdir)/macros/givaro-check.m4 \
 	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
 	$(top_srcdir)/macros/lidia-check.m4 \
 	$(top_srcdir)/macros/linbox-doc.m4 \
 	$(top_srcdir)/macros/linbox-misc.m4 \
 	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
 	$(top_srcdir)/macros/maple-check.m4 \
 	$(top_srcdir)/macros/ntl-check.m4 \
 	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -101,18 +109,21 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
 CC = @CC@
+CCNAM = @CCNAM@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
 DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -120,19 +131,24 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
 GIVARO_CFLAGS = @GIVARO_CFLAGS@
 GIVARO_LIBS = @GIVARO_LIBS@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
 GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
@@ -140,41 +156,52 @@ LIBTOOL = @LIBTOOL@
 LIDIA_CFLAGS = @LIDIA_CFLAGS@
 LIDIA_LIBS = @LIDIA_LIBS@
 LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MAPLE_CFLAGS = @MAPLE_CFLAGS@
 MAPLE_HOME = @MAPLE_HOME@
 MAPLE_LIBS = @MAPLE_LIBS@
 MAPLE_VERSION = @MAPLE_VERSION@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
 NTL_CFLAGS = @NTL_CFLAGS@
 NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RM = @RM@
 SACLIB_CFLAGS = @SACLIB_CFLAGS@
 SACLIB_LIBS = @SACLIB_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+TESTS_CFLAGS = @TESTS_CFLAGS@
 VERSION = @VERSION@
+WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -215,14 +242,19 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 @LINBOX_HAVE_MAPLE_TRUE at pkgincludesubdir = $(includedir)/interfaces/maple/new
- at LINBOX_HAVE_MAPLE_TRUE@INCLUDES = -I$(top_srcdir) -I. -I../../linbox
- at LINBOX_HAVE_MAPLE_TRUE@AM_CXXFLAGS = -O2 -DDISABLE_COMMENTATOR -I../driver $(GMP_CFLAGS) $(NTL_CFLAGS) $(ATLAS_CFLAGS) $(MAPLE_CFLAGS) $(GIVARO_CFLAGS)
- at LINBOX_HAVE_MAPLE_TRUE@lib_LTLIBRARIES = liblbmaple.la 
+ at LINBOX_HAVE_MAPLE_TRUE@AM_CPPFLAGS = -I$(top_srcdir) -I. -I../../linbox
+ at LINBOX_HAVE_MAPLE_TRUE@AM_CXXFLAGS = @DEFAULT_CFLAGS@ -DDISABLE_COMMENTATOR -I../driver $(GMP_CFLAGS) $(NTL_CFLAGS) $(ATLAS_CFLAGS) $(FFLAFLAS_CFLAGS) $(MAPLE_CFLAGS) $(GIVARO_CFLAGS)
+ at LINBOX_HAVE_MAPLE_TRUE@lib_LTLIBRARIES = liblbmaple.la
 @LINBOX_HAVE_MAPLE_TRUE at liblbmaple_la_SOURCES = lb-maple.C
- at LINBOX_HAVE_MAPLE_TRUE@liblbmaple_la_LDFLAGS = $(GMP_LIBS) $(NTL_LIBS) $(BLAS_LIBS) $(MAPLE_LIBS) $(GIVARO_LIBS) $(top_srcdir)/interfaces/driver/liblbdriver.la -Wl,-zmuldefs
+ at LINBOX_HAVE_MAPLE_TRUE@liblbmaple_la_LDFLAGS = $(GIVARO_LIBS) $(GMP_LIBS) $(NTL_LIBS) $(BLAS_LIBS) $(MAPLE_LIBS) $(top_srcdir)/interfaces/driver/liblbdriver.la -Wl,-zmuldefs
 @LINBOX_HAVE_MAPLE_TRUE at pkginclude_HEADERS = lb-maple.h lb-maple-utilities.h
 all: all-am
 
@@ -232,8 +264,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
 	      exit 1;; \
 	  esac; \
 	done; \
@@ -330,7 +362,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
@@ -447,6 +479,8 @@ dvi-am:
 
 html: html-am
 
+html-am:
+
 info: info-am
 
 info-am:
@@ -457,18 +491,28 @@ install-data-am: install-data-local install-pkgincludeHEADERS
 
 install-dvi: install-dvi-am
 
+install-dvi-am:
+
 install-exec-am: install-libLTLIBRARIES
 
 install-html: install-html-am
 
+install-html-am:
+
 install-info: install-info-am
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-am
 
+install-pdf-am:
+
 install-ps: install-ps-am
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
@@ -509,7 +553,7 @@ uninstall-am: uninstall-libLTLIBRARIES uninstall-pkgincludeHEADERS
 	uninstall-libLTLIBRARIES uninstall-pkgincludeHEADERS
 
 
- at LINBOX_HAVE_MAPLE_TRUE@install-data-local: 
+ at LINBOX_HAVE_MAPLE_TRUE@install-data-local:
 @LINBOX_HAVE_MAPLE_TRUE@	sh lb-maple-path.sh "$(libdir)/liblbmaple.so"
 @LINBOX_HAVE_MAPLE_TRUE@	$(INSTALL_DATA) lb-maple.mpl $(libdir)/lb-maple.mpl
 
diff --git a/interfaces/maple/lb-maple-utilities.h b/interfaces/maple/lb-maple-utilities.h
old mode 100755
new mode 100644
index 6ea7146..c49d3d8
--- a/interfaces/maple/lb-maple-utilities.h
+++ b/interfaces/maple/lb-maple-utilities.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-maple-utilities.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -21,8 +22,8 @@
  */
 
 
-#ifndef __LINBOX_LB_MAPLE_UTILITIES_H
-#define __LINBOX_LB_MAPLE_UTILITIES_H
+#ifndef __LINBOX_lb_maple_utilities_H
+#define __LINBOX_lb_maple_utilities_H
 
 #include <linbox-config.h>
 #include <lb-driver.h>
@@ -36,7 +37,7 @@ extern "C" {
 #define __LINBOX_GC
 
 
- 
+
 extern "C" {
 
 #ifdef __LINBOX_MAPLE_GMP_ACCESS
@@ -70,7 +71,7 @@ extern "C" {
 		out<<t;
 		size_t l=out.str().length();
 		char* msg = new char[l];
-		strncpy(msg, out.str().c_str(), l); 
+		strncpy(msg, out.str().c_str(), l);
 		MapleRaiseError(kv, msg);
 		delete msg;
 	}
@@ -85,7 +86,7 @@ extern "C" {
 	/*********************************
 	 * Domain Key Handling           *
 	 * use maple garbage collection  *
-	 *********************************/	
+	 *********************************/
 
 	/*************************************************
 	 * functions for garbage collection and printing *
@@ -96,14 +97,14 @@ extern "C" {
 		MaplePrintf(lb_kv, "Maple Garbage marked a LinBox Domain\n");
 #endif
 	}
-	 
+
 	static void M_DECL DisposeDomainKey   (ALGEB key){
 #ifdef __LB_PRINT_GC
 		MaplePrintf(lb_kv, "Maple Garbage collected a LinBox Domain\n");
 #endif
-#ifdef __LINBOX_GC	
-		const DomainKey* k = (const DomainKey*) MapleToPointer(lb_kv, key);	
-		try { 
+#ifdef __LINBOX_GC
+		const DomainKey* k = (const DomainKey*) MapleToPointer(lb_kv, key);
+		try {
 			LB_GMP_SET();
 			deleteDomain(*k);
 			LB_GMP_RESTORE();
@@ -164,18 +165,18 @@ extern "C" {
 	static void M_DECL MarkBlackboxKey      (ALGEB key){
 #ifdef __LB_PRINT_GC
 		MaplePrintf(lb_kv, "Maple Garbage marked a LinBox Blackbox\n");
-#endif		
+#endif
 	}
 
 	static void M_DECL DisposeBlackboxKey   (ALGEB key){
 #ifdef __LB_PRINT_GC
 		MaplePrintf(lb_kv, "Maple Garbage collected a LinBox Blackbox\n");
 #endif
-#ifdef __LINBOX_GC	
+#ifdef __LINBOX_GC
 		//printf("collect blackbox");
 		const BlackboxKey* k = (const BlackboxKey*) MapleToPointer(lb_kv, key);
 		//printf("  %d\n",*k);
-		try { 
+		try {
 			LB_GMP_SET();
 			deleteBlackbox(*k);
 			LB_GMP_RESTORE();
@@ -195,7 +196,7 @@ extern "C" {
 			catch (lb_runtime_error &t)
 				{lbRaiseError(lb_kv, t);}
 		}
-		else 
+		else
 			writeBlackboxInfo(*k, out);
 		char msg[out.str().length()];
 		strcpy(msg, out.str().c_str());
@@ -250,7 +251,7 @@ extern "C" {
 #ifdef __LB_PRINT_GC
 		MaplePrintf(lb_kv, "Maple Garbage collected a LinBox Vector\n");
 #endif
-#ifdef __LINBOX_GC	
+#ifdef __LINBOX_GC
 		const VectorKey* k = (const VectorKey*) MapleToPointer(lb_kv, key);
 		try {
 			LB_GMP_SET();
@@ -324,7 +325,7 @@ extern "C" {
 #ifdef __LB_PRINT_GC
 		MaplePrintf(lb_kv, "Maple Garbage collected a LinBox Polynomial\n");
 #endif
-#ifdef __LINBOX_GC		
+#ifdef __LINBOX_GC
 		const VectorKey* k = (const VectorKey*) MapleToPointer(lb_kv, key);
 		try {
 			LB_GMP_SET();
@@ -353,7 +354,7 @@ extern "C" {
 	/*******************************************************************
 	 * conversion between PolynomialKey and corresponding Maple object *
 	 *******************************************************************/
-		
+
 	bool IsMaplePolynomialKey(MKernelVector kv, ALGEB k){
 		return (IsMaplePointer(kv, k) && (MaplePointerType(kv, k) == (M_INT)&DisposePolynomialKey));
 	}
@@ -385,20 +386,20 @@ extern "C" {
 	 *************************************************/
 
 	static void M_DECL MarkElementKey      (ALGEB key){
-#ifdef __LB_PRINT_GC	
+#ifdef __LB_PRINT_GC
 		MaplePrintf(lb_kv, "Maple Garbage marked a LinBox Element\n");
 #endif
 	}
 
-	static void M_DECL DisposeElementKey   (ALGEB key){	
+	static void M_DECL DisposeElementKey   (ALGEB key){
 #ifdef __LB_PRINT_GC
 		MaplePrintf(lb_kv, "Maple Garbage collected a LinBox Element\n");
 #endif
-#ifdef __LINBOX_GC	
+#ifdef __LINBOX_GC
 		const EltKey* k = (const EltKey*) MapleToPointer(lb_kv, key);
 		try {
 			LB_GMP_SET();
-			deleteElement(*k);		
+			deleteElement(*k);
 			LB_GMP_RESTORE();
 		}
 		catch (lb_runtime_error &t)
@@ -448,33 +449,33 @@ extern "C" {
 	/*********************************
 	 * Miscleannous functionnalities *
 	 *********************************/
-	  
+
 	/*************************************************************
 	 * Conversion between Maple GMP integers and LinBox integers *
 	 *************************************************************/
 
 	void GMPMapleToLinBox(LinBox::integer& x, MKernelVector kv, ALGEB p){
 #ifdef  __LINBOX_MAPLE_GMP_ACCESS
-		mpz_ptr ptr = MapleToGMPInteger(kv, p);	
-		//LB_GMP_SET();		
+		mpz_ptr ptr = MapleToGMPInteger(kv, p);
+		//LB_GMP_SET();
 		mpz_set(LinBox::SpyInteger::get_mpz(x), ptr);
 		//LB_GMP_RESTORE();
-	
+
 #else
  		// convert integer to string in order to convert to gmp integer
 		ALGEB f  = EvalMapleStatement(kv,"proc(n) return convert(n,string);end proc;");
 		ALGEB pp = EvalMapleProc(kv, f, 1, p);
-		char *ptr = MapleToString(kv, pp);		
+		char *ptr = MapleToString(kv, pp);
 		mpz_set_str(LinBox::SpyInteger::get_mpz(x), ptr, 10);
 #endif
 	}
 
 
 
-	ALGEB LinBoxToGMPMaple(MKernelVector kv, const LinBox::integer &p){	
+	ALGEB LinBoxToGMPMaple(MKernelVector kv, const LinBox::integer &p){
 #ifdef __LINBOX_MAPLE_GMP_ACCESS
 		return GMPIntegerToMaple(kv, LinBox::SpyInteger::get_mpz(p));
-#else	
+#else
 		std::string tp(p);
 		char *ptr = new char[tp.size()+1];
 		std::strcpy(ptr, tp.c_str());
@@ -493,27 +494,27 @@ extern "C" {
 	inline size_t idx_fortran (size_t i, size_t j, size_t stride) {  return j*stride+i;}
 	inline size_t idx_c      (size_t i, size_t j, size_t stride) {  return i*stride+j;}
 
-	
+
 	void DenseMatrixToBuffer (MKernelVector kv, ALGEB A, std::ostream& buffer, size_t m, size_t n, RTableSettings &setting) {
-		 
-		//RTableData tmp;	
-		
+
+		//RTableData tmp;
+
 		buffer<<m<<" "<<n;
 		M_INT index[2];
 		if (setting.data_type == RTABLE_INTEGER8){buffer<<"\n";
 			INTEGER8 *data = (INTEGER8*) RTableDataBlock(kv,A);
-			if (setting.order == RTABLE_FORTRAN)			
+			if (setting.order == RTABLE_FORTRAN)
 				for (size_t i=0;i<m; ++i)
 					for (size_t j=0;j<n;++j)
 						buffer<<data[idx_fortran(i,j,m)]<<"\n";
 			else
 				for (size_t i=0;i<m; ++i)
 					for (size_t j=0;j<n;++j)
-						buffer<<data[idx_c(i,j,n)]<<"\n";											
+						buffer<<data[idx_c(i,j,n)]<<"\n";
 		}
 		if (setting.data_type == RTABLE_INTEGER16){buffer<<"\n";
 			INTEGER16 *data = (INTEGER16*) RTableDataBlock(kv,A);
-			if (setting.order == RTABLE_FORTRAN)			
+			if (setting.order == RTABLE_FORTRAN)
 				for (size_t i=0;i<m; ++i)
 					for (size_t j=0;j<n;++j)
 						buffer<<data[idx_fortran(i,j,m)]<<"\n";
@@ -523,8 +524,8 @@ extern "C" {
 						buffer<<data[idx_c(i,j,n)]<<"\n";
 		}
 		if (setting.data_type == RTABLE_INTEGER32){buffer<<"\n";
-			INTEGER32 *data = (INTEGER32*) RTableDataBlock(kv,A);		
-			if (setting.order == RTABLE_FORTRAN)			
+			INTEGER32 *data = (INTEGER32*) RTableDataBlock(kv,A);
+			if (setting.order == RTABLE_FORTRAN)
 				for (size_t i=0;i<m; ++i)
 					for (size_t j=0;j<n;++j)
 						buffer<<data[idx_fortran(i,j,m)]<<"\n";
@@ -536,7 +537,7 @@ extern "C" {
 		}
 		if (setting.data_type == RTABLE_INTEGER64){buffer<<"\n";
 			INTEGER64 *data = (INTEGER64*) RTableDataBlock(kv,A);
-			if (setting.order == RTABLE_FORTRAN)			
+			if (setting.order == RTABLE_FORTRAN)
 				for (size_t i=0;i<m; ++i)
 					for (size_t j=0;j<n;++j)
 						buffer<<data[idx_fortran(i,j,m)]<<"\n";
@@ -547,7 +548,7 @@ extern "C" {
 		}
 		if (setting.data_type == RTABLE_FLOAT32){buffer<<"\n";
 			FLOAT32 *data = (FLOAT32*) RTableDataBlock(kv,A);
-			if (setting.order == RTABLE_FORTRAN)			
+			if (setting.order == RTABLE_FORTRAN)
 				for (size_t i=0;i<m; ++i)
 					for (size_t j=0;j<n;++j)
 						buffer<<data[idx_fortran(i,j,m)]<<"\n";
@@ -558,7 +559,7 @@ extern "C" {
 		}
 		if (setting.data_type == RTABLE_FLOAT64){buffer<<"\n";
 			FLOAT64 *data = (FLOAT64*) RTableDataBlock(kv,A);
-			if (setting.order == RTABLE_FORTRAN)			
+			if (setting.order == RTABLE_FORTRAN)
 				for (size_t i=0;i<m; ++i)
 					for (size_t j=0;j<n;++j)
 						buffer<<data[idx_fortran(i,j,m)]<<"\n";
@@ -567,13 +568,13 @@ extern "C" {
 					for (size_t j=0;j<n;++j)
 						buffer<<data[idx_c(i,j,n)]<<"\n";
 		}
-		if (setting.data_type == RTABLE_DAG){	buffer<<" \n";		
-			RTableData tmp;	
+		if (setting.data_type == RTABLE_DAG){	buffer<<" \n";
+			RTableData tmp;
 			LinBox::integer ibuf;
 			for (size_t i=1;i<m+1; ++i){index[0]=(M_INT)i;
 				for (size_t j=1;j<n+1;++j){index[1]=(M_INT)j;
 				//buffer<<i<<" "<<j<<" ";
-					tmp=RTableSelect(kv, A, index);				
+					tmp=RTableSelect(kv, A, index);
 					GMPMapleToLinBox(ibuf, kv,tmp.dag);
 					buffer<<ibuf<<"\n";
 				}
@@ -583,26 +584,26 @@ extern "C" {
 
 		if ((setting.data_type == RTABLE_COMPLEX)|| (setting.data_type == RTABLE_CXDAG))
 			MapleRaiseError(kv, "data type format in the matrix is not yet recognized by LinBox ");
-		
+
 	}
 
 	void SparseMatrixToBuffer (MKernelVector kv, ALGEB A, std::ostream &buffer, size_t m, size_t n, RTableSettings &setting) {
-		
+
 		buffer<<m<<" "<<n<<" M \n";
-		
+
 		// special case for DAG data type
 		if (setting.data_type == RTABLE_DAG){
-			LinBox::integer ibuf;	
+			LinBox::integer ibuf;
 			M_INT index[2];
 			for (size_t i=1;i<m+1; ++i){index[0]=(M_INT)i;
 				for (size_t j=1;j<n+1;++j){
 					index[1]=(M_INT)j;
-					RTableData tmp=RTableSelect(kv, A, index);				
+					RTableData tmp=RTableSelect(kv, A, index);
 					GMPMapleToLinBox(ibuf, kv,tmp.dag);
 					if (ibuf != 0)
 						buffer<<i<<" "<<j<<" "<<ibuf<<"\n";
 				}
-			}		
+			}
 		}
 		else {
 			M_INT numelem;
@@ -646,13 +647,13 @@ extern "C" {
 				for (M_INT i=0;i<numelem;++i){
 					buffer<<row[i]<<" "<<col[i]<<" "<<data[i]<<"\n";
 				}
-			}	
+			}
 			if ((setting.data_type == RTABLE_COMPLEX)|| (setting.data_type == RTABLE_CXDAG))
 				MapleRaiseError(kv, "data type format in the matrix is not yet recognized by LinBox ");
 		}
 		buffer<<" 0 0 0 \n";
 	}
-	
+
 
 } // end of extern "C"
 
diff --git a/interfaces/maple/lb-maple.C b/interfaces/maple/lb-maple.C
old mode 100755
new mode 100644
index ce7548a..d200fb1
--- a/interfaces/maple/lb-maple.C
+++ b/interfaces/maple/lb-maple.C
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-maple.C
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -21,8 +22,8 @@
  */
 
 
-#ifndef __LINBOX_LB_MAPLE_C
-#define __LINBOX_LB_MAPLE_C
+#ifndef __LINBOX_lb_maple_C
+#define __LINBOX_lb_maple_C
 
 #include <fstream>
 #include <iostream>
@@ -36,24 +37,24 @@ extern "C"{
 
 
 extern "C" {
- 
+
 	/***********************************
 	 * Initializer of LinBox interface *
 	 ***********************************/
-	
-	ALGEB lbStart (MKernelVector kv, ALGEB *argv){		
-		//MaplePrintf(kv, "LinBox driver initialization...\n");	
-		try {LinBoxInit();} 
-		catch(lb_runtime_error &t){lbRaiseError(kv, t);}	
+
+	ALGEB lbStart (MKernelVector kv, ALGEB *argv){
+		//MaplePrintf(kv, "LinBox driver initialization...\n");
+		try {LinBoxInit();}
+		catch(lb_runtime_error &t){lbRaiseError(kv, t);}
 		lb_kv = kv;
 		return ToMapleNULL(kv);
 	}
-	
+
 	ALGEB lbStop (MKernelVector kv, ALGEB *argv){
-		//MaplePrintf(kv, "LinBox driver termination...");	
+		//MaplePrintf(kv, "LinBox driver termination...");
 		std::cout<<"terminating LinBox...";
 		//try{LinBoxEnd();}
-		//catch(lb_runtime_error &t){lbRaiseError(kv, t);}	
+		//catch(lb_runtime_error &t){lbRaiseError(kv, t);}
 		std::cout<<"done\n";
 		return ToMapleNULL(kv);
 	}
@@ -67,11 +68,11 @@ extern "C" {
 		LinBoxDataInfo(out);
 		size_t l=out.str().length();
 		char* msg = new char[l];
-		strncpy(msg, out.str().c_str(), l); 
+		strncpy(msg, out.str().c_str(), l);
 		MaplePrintf(kv, msg);
 		delete  msg;
 		return ToMapleNULL(kv);
-	}	
+	}
 
 
 	/******************************************
@@ -79,7 +80,7 @@ extern "C" {
 	 *** Function to create LinBox's object ***
 	 ******************************************
 	 ******************************************/
-	
+
 	/**********************************
 	 * Interface to create an element *
 	 **********************************/
@@ -88,29 +89,29 @@ extern "C" {
 		if (argc != 1){
 			MapleRaiseError(kv, "wrong number of arguments");
 			return ToMapleNULL(kv);
-		}		
-		const DomainKey *key = &MapleToDomainKey(kv, argv[1]);	       
-		try { 
-			LB_GMP_SET();	
+		}
+		const DomainKey *key = &MapleToDomainKey(kv, argv[1]);
+		try {
+			LB_GMP_SET();
 			const EltKey *k = &createElement(*key);
-			LB_GMP_RESTORE();	
-			return ElementKeyToMaple(kv, *k); 
-		} 
-		catch ( lb_runtime_error &t ) 
-			{ lbRaiseError(kv, t); return ToMapleNULL(kv); }				
+			LB_GMP_RESTORE();
+			return ElementKeyToMaple(kv, *k);
+		}
+		catch ( lb_runtime_error &t )
+			{ lbRaiseError(kv, t); return ToMapleNULL(kv); }
 	}
 
 	/********************************
 	 * Interface to create a domain *
 	 ********************************/
 	ALGEB lbCreateDomain (MKernelVector kv, ALGEB *argv){
-		M_INT argc = MapleNumArgs(kv, (ALGEB) argv);		
+		M_INT argc = MapleNumArgs(kv, (ALGEB) argv);
 		const DomainKey *key;
 		try {
 			if (argc < 1){
-				LB_GMP_SET();	
+				LB_GMP_SET();
 				key = &createDomain(0);
-				LB_GMP_RESTORE();	
+				LB_GMP_RESTORE();
 				return DomainKeyToMaple(kv, *key);
 			}
 			//LinBox::integer *p = GMPMapleToLinBox(kv, argv[1]);
@@ -118,24 +119,24 @@ extern "C" {
 			GMPMapleToLinBox(p, kv, argv[1]);
 
 			if (argc == 1){
-				LB_GMP_SET();	
+				LB_GMP_SET();
 				key = &createDomain(p);
-				LB_GMP_RESTORE();	
+				LB_GMP_RESTORE();
 				return DomainKeyToMaple(kv, *key);
-			}			
+			}
 			if (argc == 2){
-				LB_GMP_SET();	
+				LB_GMP_SET();
 				key = &createDomain(p, MapleToString(kv, argv[2]));
-				LB_GMP_RESTORE();	
-				return DomainKeyToMaple(kv, *key); 
+				LB_GMP_RESTORE();
+				return DomainKeyToMaple(kv, *key);
 			}
 			if (argc > 2){
 				MapleRaiseError(kv, "wrong number of argument");
 				return ToMapleNULL(kv);
 			}
 		}
-		catch ( lb_runtime_error &t ) 
-			{ lbRaiseError(kv, t); return ToMapleNULL(kv);}	
+		catch ( lb_runtime_error &t )
+			{ lbRaiseError(kv, t); return ToMapleNULL(kv);}
 		return ToMapleNULL(kv);
 	}
 
@@ -143,25 +144,25 @@ extern "C" {
 	 * Interface to create a blackbox *
 	 **********************************/
 	ALGEB lbCreateBlackboxFromMatrix(MKernelVector kv, ALGEB A, const LinBox::integer &p){
-		
-	
-		
+
+
+
 		RTableSettings setting;
 		RTableGetSettings(kv,&setting,A);
 		size_t m,n;
-		m = RTableUpperBound(kv, A, 1);	
+		m = RTableUpperBound(kv, A, 1);
 		n = RTableUpperBound(kv, A, 2);
 
-	
+
 		std::stringstream *buffer= new std::stringstream();//std::string(buffer_data, m*n));
 
-		//LinBox::Timer chrono;
+		//Timer chrono;
 		//chrono.start();
 		if (setting.storage == RTABLE_RECT)
 			DenseMatrixToBuffer(kv, A, *buffer, m, n, setting);
 		else
 			if (setting.storage == RTABLE_SPARSE)
-				SparseMatrixToBuffer(kv, A, *buffer, m, n, setting);	
+				SparseMatrixToBuffer(kv, A, *buffer, m, n, setting);
 			else
 				MapleRaiseError(kv, "Matrix storage must be either dense or sparse");
 		//chrono.stop();
@@ -173,19 +174,19 @@ extern "C" {
 		//std::cout<<"buffering in <- : "<<chrono;
 		//chrono.clear();
 		//chrono.start();
-		LB_GMP_SET();	
+		LB_GMP_SET();
 		const DomainKey   *Dkey = &createDomain(p);
-		const BlackboxKey *Bkey = &createBlackbox(*Dkey, *buffer); 
+		const BlackboxKey *Bkey = &createBlackbox(*Dkey, *buffer);
 		deleteDomain (*Dkey);
 		LB_GMP_RESTORE();
 		//chrono.stop();
 		//std::cout<<"buffering out -> : "<<chrono;
 		delete buffer;
-		
-	
+
+
 		return BlackboxKeyToMaple(kv, *Bkey);
 	}
-	
+
 
 
 	ALGEB lbCreateBlackbox (MKernelVector kv, ALGEB *argv){
@@ -195,23 +196,23 @@ extern "C" {
 			MapleRaiseError(kv, "wrong number of arguments");
 			return ToMapleNULL(kv);
 		}
-		try {		
+		try {
 			if (argc == 1){
 				if (IsMapleRTable(kv, argv[1]))
 					return lbCreateBlackboxFromMatrix(kv, argv[1], LinBox::integer(0));
-				
-			}			
+
+			}
 			if (argc == 2){
 				if (IsMapleInteger(kv, argv[1]) && IsMapleRTable(kv, argv[2])){
 					//LinBox::integer *p = GMPMapleToLinBox(kv, argv[1]);
 					LinBox::integer p;
 					GMPMapleToLinBox(p, kv, argv[1]);
 					LB_GMP_SET();
-					ALGEB ret = lbCreateBlackboxFromMatrix(kv, argv[2], p); 
+					ALGEB ret = lbCreateBlackboxFromMatrix(kv, argv[2], p);
 					LB_GMP_RESTORE();
-					return ret; 
+					return ret;
 				}
-				    
+
 				if (IsMapleDomainKey(kv, argv[1]) && IsMapleString(kv, argv[2])) {
 					const DomainKey *k = &MapleToDomainKey(kv, argv[1]);
 					std::ifstream in(MapleToString(kv, argv[2]));
@@ -219,15 +220,15 @@ extern "C" {
 					key = &createBlackbox(*k, in);
 					LB_GMP_RESTORE();
 					return BlackboxKeyToMaple(kv, *key);
-			
-				}				
-			}						
+
+				}
+			}
 			if (argc == 3){
 				if (IsMapleDomainKey(kv, argv[1])){
 					const DomainKey *k = &MapleToDomainKey(kv, argv[1]);
 					if (IsMapleInteger(kv, argv[2])){
 						LB_GMP_SET();
-						key = &createBlackbox(*k, MapleToInteger32(kv, argv[2]), MapleToInteger32(kv, argv[3]));	
+						key = &createBlackbox(*k, MapleToInteger32(kv, argv[2]), MapleToInteger32(kv, argv[3]));
 						LB_GMP_RESTORE();
 					}
 					else {
@@ -238,7 +239,7 @@ extern "C" {
 					}
 					return BlackboxKeyToMaple(kv, *key);
 				}
-			}			
+			}
 			if (argc == 4){
 				if (IsMapleDomainKey(kv, argv[1])) {
 					const DomainKey *k = &MapleToDomainKey(kv, argv[1]);
@@ -250,33 +251,33 @@ extern "C" {
 			}
 			MapleRaiseError(kv, "wrong types of arguments");
 		}
-		catch ( lb_runtime_error &t ) 
+		catch ( lb_runtime_error &t )
 			{ lbRaiseError(kv, t); }
 		return ToMapleNULL(kv);
 	}
-	
+
 	/********************************
 	 * Interface to create a vector *
 	 ********************************/
 
 	ALGEB lbCreateVectorFromVector(MKernelVector kv, ALGEB V, const LinBox::integer &p){
-		
+
 		LB_GMP_SET();
 		const DomainKey *Dkey = &createDomain(p);
 		LB_GMP_RESTORE();
 		std::stringstream buffer;
-		RTableSettings setting; 
-		RTableData tmp;	
+		RTableSettings setting;
+		RTableData tmp;
 		RTableGetSettings(kv,&setting,V);
 		size_t n;
-		n = RTableUpperBound(kv, V, 1);		
+		n = RTableUpperBound(kv, V, 1);
 		buffer<<n<<"\n";
 		M_INT index[1];
 		if (setting.data_type == RTABLE_INTEGER8)
 			for (size_t i=1;i<n+1; ++i){index[0]=(M_INT)i;
 				tmp=RTableSelect(kv, V, index);
 				buffer<<tmp.int8<<"\n";
-			}		
+			}
 		if (setting.data_type == RTABLE_INTEGER16)
 			for (size_t i=1;i<n+1; ++i){index[0]=(M_INT)i;
 				tmp=RTableSelect(kv, V, index);
@@ -314,25 +315,25 @@ extern "C" {
 			MapleRaiseError(kv, "data type format in the matrix is not yet recognized by LinBox ");
 
 		LB_GMP_SET();
-		const VectorKey *Vkey = &createVector(*Dkey, buffer);	
-		deleteDomain (*Dkey);	
+		const VectorKey *Vkey = &createVector(*Dkey, buffer);
+		deleteDomain (*Dkey);
 		LB_GMP_RESTORE();
-		
-		return VectorKeyToMaple(kv, *Vkey);		       
+
+		return VectorKeyToMaple(kv, *Vkey);
 	}
-	
+
 	ALGEB lbCreateVector (MKernelVector kv, ALGEB *argv){
 		M_INT argc = MapleNumArgs(kv, (ALGEB) argv);
 		const VectorKey *key;
 		if ((argc < 1) || (argc > 4)){
 			MapleRaiseError(kv, "wrong number of arguments");
 			return ToMapleNULL(kv);
-		} 
-		try {  
+		}
+		try {
 			if (argc == 1){
 				if (IsMapleRTable(kv, argv[1]))
 					return lbCreateVectorFromVector(kv, argv[1], LinBox::integer(0));
-			}					
+			}
 			if (argc == 2){
 				if (IsMapleInteger(kv, argv[1]) && IsMapleRTable(kv, argv[2])){
 					//LinBox::integer *p = GMPMapleToLinBox(kv, argv[1]);
@@ -343,27 +344,27 @@ extern "C" {
 					LB_GMP_RESTORE();
 					return ret;
 				}
-				
+
 				if ( IsMapleDomainKey(kv, argv[1]) && IsMapleInteger(kv, argv[2])) {
 					const DomainKey *k = &MapleToDomainKey(kv, argv[1]);
 					LB_GMP_SET();
-					key = &createVector(*k, MapleToInteger32(kv, argv[2]));	
+					key = &createVector(*k, MapleToInteger32(kv, argv[2]));
 					LB_GMP_RESTORE();
 					return VectorKeyToMaple(kv, *key);
 				}
-			}						
+			}
 			if (argc == 3){
 				if ( IsMapleDomainKey(kv, argv[1]) && IsMapleInteger(kv, argv[2]) && IsMapleString(kv, argv[3])){
 					const DomainKey *k = &MapleToDomainKey(kv, argv[1]);
 					LB_GMP_SET();
-					key = &createVector(*k, MapleToInteger32(kv, argv[2]), MapleToString(kv, argv[3]));	
+					key = &createVector(*k, MapleToInteger32(kv, argv[2]), MapleToString(kv, argv[3]));
 					LB_GMP_RESTORE();
 					return VectorKeyToMaple(kv, *key);
 				}
 			}
 			MapleRaiseError(kv, "wrong types of arguments");
 		}
-		catch ( lb_runtime_error &t ) 
+		catch ( lb_runtime_error &t )
 			{ lbRaiseError(kv, t); }
 		return ToMapleNULL(kv);
 	}
@@ -374,7 +375,7 @@ extern "C" {
 	 ***************************
 	 *** Domain's Functions ****
 	 ***************************
-	 ***************************/	
+	 ***************************/
 
 	/******************************
 	 * Interface to copy a Domain *
@@ -388,7 +389,7 @@ extern "C" {
 			{ lbRaiseError(kv, t);}
 		return ToMapleNULL(kv);
 	}
-	
+
 	/*****************************************************
 	 * Interface to change globally the prime field type *
 	 *****************************************************/
@@ -403,9 +404,9 @@ extern "C" {
 			return ToMapleNULL(kv);
 		}
 		setPrimeField(MapleToString(kv, argv[1]));
-		return ToMapleNULL(kv);		    
+		return ToMapleNULL(kv);
 	}
-	
+
 	/********************************************************
 	 * Interface to change globally the rational field type *
 	 ********************************************************/
@@ -420,7 +421,7 @@ extern "C" {
 			return ToMapleNULL(kv);
 		}
 		setRationalField(MapleToString(kv, argv[1]));
-		return ToMapleNULL(kv);		    
+		return ToMapleNULL(kv);
 	}
 
 	/******************************************************
@@ -437,17 +438,17 @@ extern "C" {
 			return ToMapleNULL(kv);
 		}
 		setIntegerRing(MapleToString(kv, argv[1]));
-		return ToMapleNULL(kv);		    
+		return ToMapleNULL(kv);
 	}
-	
 
-	
+
+
 	/*****************************
 	 *****************************
 	 *** Blackbox's Functions ****
 	 *****************************
-	 *****************************/	
-		
+	 *****************************/
+
 	/********************************
 	 * Interface to copy a blackbox *
 	 ********************************/
@@ -457,7 +458,7 @@ extern "C" {
 			return BlackboxKeyToMaple(kv, copyBlackbox(*key));
 		}
 		catch (lb_runtime_error &t)
-			{ lbRaiseError(kv, t);}	
+			{ lbRaiseError(kv, t);}
 		return ToMapleNULL(kv);
 	}
 
@@ -473,14 +474,14 @@ extern "C" {
 	 * Interface to write a blackbox in a file *
 	 *******************************************/
 	ALGEB lbWriteBlackbox (MKernelVector kv, ALGEB *argv){
-		try {		
+		try {
 			std::ofstream os(MapleToString(kv, argv[2]));
 			const BlackboxKey *key = &MapleToBlackboxKey(kv, argv[1]);
 			writeBlackbox(*key, os);
-			return ToMapleNULL(kv);			
+			return ToMapleNULL(kv);
 		}
 		catch (lb_runtime_error &t)
-			{ lbRaiseError(kv, t);}	
+			{ lbRaiseError(kv, t);}
 		return ToMapleNULL(kv);
 	}
 
@@ -489,29 +490,29 @@ extern "C" {
 	 * Interface to fill a blackbox with random value *
 	 **************************************************/
 	ALGEB lbSetBlackboxAtRandom (MKernelVector kv, ALGEB *argv){
-		try {			
+		try {
 			const BlackboxKey *key = &MapleToBlackboxKey(kv, argv[1]);
 			setBlackboxAtRandom(*key);
 			return argv[1];
-		}	
+		}
 		catch (lb_runtime_error &t)
-			{ lbRaiseError(kv, t);}	
+			{ lbRaiseError(kv, t);}
 		return ToMapleNULL(kv);
 	}
-	
+
 
 	/******************************************************
 	 * Interface to rebind a blackbox over another domain *
 	 ******************************************************/
-	ALGEB lbRebindBlackbox (MKernelVector kv, ALGEB *argv){		
-		try {		
+	ALGEB lbRebindBlackbox (MKernelVector kv, ALGEB *argv){
+		try {
 			const DomainKey   *Dkey = &MapleToDomainKey(kv, argv[1]);;
-			const BlackboxKey *Bkey = &MapleToBlackboxKey(kv, argv[2]);			
+			const BlackboxKey *Bkey = &MapleToBlackboxKey(kv, argv[2]);
 			rebindBlackbox(*Bkey, *Dkey);
 			return ToMapleNULL(kv);
 		}
 		catch (lb_runtime_error &t)
-			{ lbRaiseError(kv, t);}	
+			{ lbRaiseError(kv, t);}
 		return ToMapleNULL(kv);
 	}
 
@@ -530,7 +531,7 @@ extern "C" {
 			return ToMapleNULL(kv);
 		}
 		setBlackbox(MapleToString(kv, argv[1]));
-		return ToMapleNULL(kv);		    
+		return ToMapleNULL(kv);
 	}
 
 
@@ -540,7 +541,7 @@ extern "C" {
 	 *** Vector's Functions ****
 	 ***************************
 	 ***************************/
-	
+
 	/******************************
 	 * Interface to copy a vector *
 	 ******************************/
@@ -550,7 +551,7 @@ extern "C" {
 			return VectorKeyToMaple(kv, copyVector(*key));
 		}
 		catch (lb_runtime_error &t)
-			{ lbRaiseError(kv, t);}	
+			{ lbRaiseError(kv, t);}
 		return ToMapleNULL(kv);
 	}
 
@@ -572,14 +573,14 @@ extern "C" {
 	 * Interface to write a vector in a file *
 	 *****************************************/
 	ALGEB lbWriteVector (MKernelVector kv, ALGEB *argv){
-		try {		
+		try {
 			std::ofstream os(MapleToString(kv, argv[2]));
 			const VectorKey *key = &MapleToVectorKey(kv, argv[1]);
 			writeVector(*key, os);
 			return ToMapleNULL(kv);
 		}
 		catch (lb_runtime_error &t)
-			{ lbRaiseError(kv, t);}	
+			{ lbRaiseError(kv, t);}
 		return ToMapleNULL(kv);
 	}
 
@@ -587,28 +588,28 @@ extern "C" {
 	 * Interface to fill a vector with random value *
 	 ************************************************/
 	ALGEB lbSetVectorAtRandom (MKernelVector kv, ALGEB *argv){
-		try {			
+		try {
 			const VectorKey *key = &MapleToVectorKey(kv, argv[1]);
 			setVectorAtRandom(*key);
 			return argv[1];
-		}	
+		}
 		catch (lb_runtime_error &t)
-			{ lbRaiseError(kv, t);}	
-		return ToMapleNULL(kv);	
+			{ lbRaiseError(kv, t);}
+		return ToMapleNULL(kv);
 	}
 
 	/******************************************************
 	 * Interface to rebind a vector over another domain *
 	 ******************************************************/
 	ALGEB lbRebindVector (MKernelVector kv, ALGEB *argv){
-		try {		
+		try {
 			const DomainKey   *Dkey = &MapleToDomainKey(kv, argv[1]);;
-			const VectorKey *Bkey = &MapleToVectorKey(kv, argv[2]);			
+			const VectorKey *Bkey = &MapleToVectorKey(kv, argv[2]);
 			rebindVector(*Bkey, *Dkey);
 			return argv[2];
 		}
 		catch (lb_runtime_error &t)
-			{ lbRaiseError(kv, t);}	
+			{ lbRaiseError(kv, t);}
 		return ToMapleNULL(kv);
 	}
 
@@ -626,7 +627,7 @@ extern "C" {
 			return ToMapleNULL(kv);
 		}
 		setVector(MapleToString(kv, argv[1]));
-		return ToMapleNULL(kv);		    
+		return ToMapleNULL(kv);
 	}
 
 
@@ -641,14 +642,14 @@ extern "C" {
 	 * Interface to write a polynomial *
 	 ***********************************/
 	ALGEB lbWritePolynomial (MKernelVector kv, ALGEB *argv){
-		try {	
+		try {
 			std::ofstream os(MapleToString(kv, argv[2]));
 			const VectorKey *key = &MapleToVectorKey(kv, argv[1]);
 			writePolynomial(*key, os);
 			return ToMapleNULL(kv);
 		}
        		catch (lb_runtime_error &t)
-			{ lbRaiseError(kv, t);}	
+			{ lbRaiseError(kv, t);}
 		return ToMapleNULL(kv);
 	}
 
@@ -664,7 +665,7 @@ extern "C" {
 	 ******************************************************/
 	ALGEB lbDeterminant (MKernelVector kv, ALGEB *argv){
 		M_INT argc = MapleNumArgs(kv, (ALGEB) argv);
-		try{				
+		try{
 			if (argc == 1){
 				LB_GMP_SET();
 				const BlackboxKey *key = &MapleToBlackboxKey(kv, argv[1]);
@@ -672,7 +673,7 @@ extern "C" {
 				LB_GMP_RESTORE();
 				return ElementKeyToMaple(kv, *k);
 			}
-			if (argc == 2){	
+			if (argc == 2){
 				LB_GMP_SET();
 				const EltKey      *k   = &MapleToElementKey(kv, argv[1]);
 				const BlackboxKey *key = &MapleToBlackboxKey(kv, argv[2]);
@@ -682,7 +683,7 @@ extern "C" {
 			}
 		}
 		catch (lb_runtime_error &t)
-			{ lbRaiseError(kv, t);}	
+			{ lbRaiseError(kv, t);}
 		return ToMapleNULL(kv);
 	}
 
@@ -691,7 +692,7 @@ extern "C" {
 	 ***********************************************/
 	ALGEB lbRank (MKernelVector kv, ALGEB *argv){
 		M_INT argc = MapleNumArgs(kv, (ALGEB) argv);
-		try{			
+		try{
 			if (argc == 1){
 				LB_GMP_SET();
 				const BlackboxKey *key = &MapleToBlackboxKey(kv, argv[1]);
@@ -699,7 +700,7 @@ extern "C" {
 				LB_GMP_RESTORE();
 				return ToMapleInteger(kv, r);
 			}
-			if (argc == 2){	
+			if (argc == 2){
 				LB_GMP_SET();
 				size_t *r = (size_t*) MapleToPointer(kv, argv[1]);
 				const BlackboxKey *key = &MapleToBlackboxKey(kv, argv[2]);
@@ -709,7 +710,7 @@ extern "C" {
 			}
 		}
 		catch (lb_runtime_error &t)
-			{ lbRaiseError(kv, t);}	
+			{ lbRaiseError(kv, t);}
 		return ToMapleNULL(kv);
 	}
 
@@ -720,7 +721,7 @@ extern "C" {
 	 *************************************************************/
 	ALGEB lbMinpoly (MKernelVector kv, ALGEB *argv){
 		M_INT argc = MapleNumArgs(kv, (ALGEB) argv);
-		try{		
+		try{
 			if (argc == 1){
 				LB_GMP_SET();
 				const BlackboxKey    *key = &MapleToBlackboxKey(kv, argv[1]);
@@ -728,8 +729,8 @@ extern "C" {
 				LB_GMP_RESTORE();
 				return PolynomialKeyToMaple(kv, *k);
 			}
-			if (argc == 2){	
-				LB_GMP_SET();	
+			if (argc == 2){
+				LB_GMP_SET();
 				const PolynomialKey  *k   = &MapleToPolynomialKey(kv, argv[1]);
 				const BlackboxKey    *key = &MapleToBlackboxKey(kv, argv[2]);
 				lb_minpoly(*k, *key);
@@ -738,7 +739,7 @@ extern "C" {
 			}
 		}
 		catch (lb_runtime_error &t)
-			{ lbRaiseError(kv, t);}	
+			{ lbRaiseError(kv, t);}
 		return ToMapleNULL(kv);
 	}
 
@@ -748,7 +749,7 @@ extern "C" {
 	 ********************************************************************/
 	ALGEB lbCharpoly (MKernelVector kv, ALGEB *argv){
 		M_INT argc = MapleNumArgs(kv, (ALGEB) argv);
-		try{		
+		try{
 			if (argc == 1){
 				LB_GMP_SET();
 				const BlackboxKey    *key = &MapleToBlackboxKey(kv, argv[1]);
@@ -756,17 +757,17 @@ extern "C" {
 				LB_GMP_RESTORE();
 				return PolynomialKeyToMaple(kv, *k);
 			}
-			if (argc == 2){	
-				LB_GMP_SET();			
+			if (argc == 2){
+				LB_GMP_SET();
 				const PolynomialKey  *k   = &MapleToPolynomialKey(kv, argv[1]);
 				const BlackboxKey    *key = &MapleToBlackboxKey(kv, argv[2]);
-				lb_charpoly(*k, *key);	
+				lb_charpoly(*k, *key);
 				LB_GMP_RESTORE();
 				return ToMapleNULL(kv);
 			}
 		}
 		catch (lb_runtime_error &t)
-			{ lbRaiseError(kv, t);}	
+			{ lbRaiseError(kv, t);}
 		return ToMapleNULL(kv);
 	}
 
@@ -776,8 +777,8 @@ extern "C" {
 	 **************************************/
 	ALGEB lbSolve (MKernelVector kv, ALGEB *argv){
 		M_INT argc = MapleNumArgs(kv, (ALGEB) argv);
-		try{		
-			if (argc == 2){	
+		try{
+			if (argc == 2){
 				LB_GMP_SET();
 				const BlackboxKey *Bkey = &MapleToBlackboxKey(kv, argv[1]);
 				const VectorKey   *Vkey = &MapleToVectorKey(kv, argv[2]);
@@ -785,22 +786,22 @@ extern "C" {
 				LB_GMP_RESTORE();
 				return VectorKeyToMaple(kv, *Rkey);
 			}
-			if (argc == 3){	
+			if (argc == 3){
 				LB_GMP_SET();
 				const VectorKey   *Rkey = &MapleToVectorKey(kv, argv[1]);
 				const BlackboxKey *Bkey = &MapleToBlackboxKey(kv, argv[2]);
-				const VectorKey   *Vkey = &MapleToVectorKey(kv, argv[3]);				
-				lb_solve(*Rkey, *Bkey, *Vkey);	
+				const VectorKey   *Vkey = &MapleToVectorKey(kv, argv[3]);
+				lb_solve(*Rkey, *Bkey, *Vkey);
 				LB_GMP_RESTORE();
 				return ToMapleNULL(kv);
 			}
 		}
 		catch (lb_runtime_error &t)
-			{ lbRaiseError(kv, t);}	
+			{ lbRaiseError(kv, t);}
 		return ToMapleNULL(kv);
 	}
 
-	
+
 
 	/*******************************************
 	 *******************************************
@@ -819,7 +820,7 @@ extern "C" {
 
 			if (strcmp(s.type, "integer")==0)
 				return LinBoxToGMPMaple(kv, s.list.front());
-			else 
+			else
 				if (strcmp(s.type,"rational")==0){
 					ALGEB n,d,f;
 					n = LinBoxToGMPMaple(kv, s.list.front());
@@ -851,7 +852,7 @@ extern "C" {
 			const VectorKey *k = &MapleToVectorKey(kv, argv[1]);
 			SerialVector s;
 			SerializeVector(s, *k);
-						
+
 			if (strcmp(s.type, "integer")==0){
 				size_t n = s.list.size();
 				RTableSettings setting;
@@ -860,7 +861,7 @@ extern "C" {
 				setting.num_dimensions=1;
 				setting.subtype=RTABLE_COLUMN;
 				setting.data_type=RTABLE_DAG;
-				
+
 				ALGEB vector = RTableCreate(kv, &setting, NULL, bounds);
 				M_INT index[1];
 				RTableData tmp;
@@ -881,20 +882,20 @@ extern "C" {
 				setting.num_dimensions=1;
 				setting.subtype=RTABLE_COLUMN;
 				setting.data_type=RTABLE_DAG;
-			
+
 				ALGEB vector = RTableCreate(kv, &setting, NULL, bounds);
-				ALGEB f = EvalMapleStatement(kv,"Fraction:");				
+				ALGEB f = EvalMapleStatement(kv,"Fraction:");
 				M_INT index[1];
 				RTableData tmp;
 				for (size_t i=1; i<n+1; ++i){
 					index[0]=i;
 					tmp.dag =  EvalMapleProc(kv, f, 2, LinBoxToGMPMaple(kv, s.list[(i<<1)-2]) , LinBoxToGMPMaple(kv, s.list[(i<<1)-1]));
-					RTableAssign(kv, vector, index, tmp);						    
+					RTableAssign(kv, vector, index, tmp);
 				}
 				return vector;
 			}
-			
-			else 			
+
+			else
 				MapleRaiseError(kv, "LinBox internal error (serializing vector problem)");
 		}
 		catch (lb_runtime_error &t)
@@ -910,7 +911,7 @@ extern "C" {
 			const PolynomialKey *k = &MapleToPolynomialKey(kv, argv[1]);
 			SerialPolynomial s;
 			SerializePolynomial(s, *k);
-						
+
 			if (strcmp(s.type, "integer")==0){
 				size_t n = s.list.size();
 				ALGEB f, listcoeff;
@@ -921,7 +922,7 @@ extern "C" {
 				f = EvalMapleStatement(kv,"proc(l, name) local i, p; p:=0; for  i from 1 to nops(l) do  p:=p+ l[i]*name^(i-1); end do; return p; end proc;");
 				return EvalMapleProc(kv, f, 2, listcoeff, argv[2]);
 			}
-			else 			
+			else
 				MapleRaiseError(kv, "LinBox internal error (serializing polynomial problem)");
 		}
 		catch (lb_runtime_error &t)
@@ -930,7 +931,7 @@ extern "C" {
 	}
 
 
-	
+
 	/*******************************************
 	 *******************************************
 	 **** Higher level API on LinBox object ****
@@ -946,12 +947,12 @@ extern "C" {
 			MapleRaiseError(kv, "wrong number of arguments");
 		}
 		if (IsMapleDomainKey(kv, argv[1]))
-			return lbCopyDomain(kv, argv);		
+			return lbCopyDomain(kv, argv);
 		if (IsMapleBlackboxKey(kv, argv[1]))
 			return lbCopyBlackbox(kv, argv);
 		if (IsMapleVectorKey(kv, argv[1]))
 			return lbCopyVector(kv, argv);
-	
+
 		MapleRaiseError(kv, "LinBox object (lbDomain, lbBlackbox, lbVector) expected for 1st argument");
 		return ToMapleNULL(kv);
 	}
@@ -966,7 +967,7 @@ extern "C" {
 		}
 		if (!IsMapleString(kv, argv[2]))
 			MapleRaiseError(kv, "Filename expected for 2nd argument");
-		
+
 		if (IsMapleBlackboxKey(kv, argv[1]))
 			return lbWriteBlackbox(kv, argv);
 		if (IsMapleVectorKey(kv, argv[1]))
@@ -990,7 +991,7 @@ extern "C" {
 			return lbGetBlackboxDimension(kv, argv);
 		if (IsMapleVectorKey(kv, argv[1]))
 			return lbGetVectorDimension(kv, argv);
-		
+
 		MapleRaiseError(kv, "LinBox object (lbBlackbox, lbVector) expected for 1st argument");
 		return ToMapleNULL(kv);
 	}
@@ -1005,7 +1006,7 @@ extern "C" {
 		}
 		if (!IsMapleDomainKey(kv, argv[1]))
 			MapleRaiseError(kv, "LinBox object (lbDomain) expected for 1st argument");
-		
+
 		if (IsMapleBlackboxKey(kv, argv[2]))
 			return lbRebindBlackbox(kv, argv);
 		if (IsMapleVectorKey(kv, argv[2]))
diff --git a/interfaces/maple/lb-maple.h b/interfaces/maple/lb-maple.h
old mode 100755
new mode 100644
index 492bbd6..3371cd9
--- a/interfaces/maple/lb-maple.h
+++ b/interfaces/maple/lb-maple.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* lb-maple.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -21,8 +22,8 @@
  */
 
 
-#ifndef __LINBOX_LB_MAPLE_H
-#define __LINBOX_LB_MAPLE_H
+#ifndef __LINBOX_lb_maple_H
+#define __LINBOX_lb_maple_H
 
 
 #include <lb-driver.h>
@@ -64,7 +65,7 @@ extern "C" {
  ************************/
 	ALGEB lbCopyBlackbox          (MKernelVector kv, ALGEB *argv);
 	ALGEB lbGetBlackboxDimension  (MKernelVector kv, ALGEB *argv);
-	ALGEB lbSetBlackboxAtRandom   (MKernelVector kv, ALGEB *argv);	
+	ALGEB lbSetBlackboxAtRandom   (MKernelVector kv, ALGEB *argv);
 	ALGEB lbRebindBlackbox        (MKernelVector kv, ALGEB *argv);
 	ALGEB lbWriteBlackbox         (MKernelVector kv, ALGEB *argv);
 	ALGEB lbSetBlackbox           (MKernelVector kv, ALGEB *argv);
diff --git a/interfaces/sage/Makefile.am b/interfaces/sage/Makefile.am
index a30bf5a..a247163 100644
--- a/interfaces/sage/Makefile.am
+++ b/interfaces/sage/Makefile.am
@@ -1,8 +1,11 @@
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 if LINBOX_HAVE_SAGE
 
-INCLUDES=-I$(top_srcdir) -I. -I../../linbox
+AM_CPPFLAGS=-I$(top_srcdir) -I. -I../../linbox
 
-AM_CXXFLAGS = -O2 -DDISABLE_COMMENTATOR $(GMP_CFLAGS) $(NTL_CFLAGS) $(ATLAS_CFLAGS) $(GIVARO_CFLAGS)
+AM_CXXFLAGS = @DEFAULT_CFLAGS@ -DDISABLE_COMMENTATOR $(GMP_CFLAGS) $(NTL_CFLAGS) $(ATLAS_CFLAGS) $(FFLAFLAS_CFLAGS) $(GIVARO_CFLAGS)
 
 lib_LTLIBRARIES = liblinboxsage.la
 
@@ -12,5 +15,5 @@ pkginclude_HEADERS = linbox-sage.h
 
 #liblinboxsage_la_LIBADD = -llinbox $(BLAS_LIBS)
 
-liblinboxsage_la_LDFLAGS = $(GMP_LIBS) $(NTL_LIBS) $(BLAS_LIBS) $(MAPLE_LIBS) $(GIVARO_LIBS)  -version-info 0:0:0 #-Wl,-zmuldefs
-endif
\ No newline at end of file
+liblinboxsage_la_LDFLAGS =  $(GIVARO_LIBS) $(GMP_LIBS) $(NTL_LIBS) $(BLAS_LIBS) $(MAPLE_LIBS)  -version-info 0:0:0 #-Wl,-zmuldefs
+endif
diff --git a/interfaces/sage/Makefile.in b/interfaces/sage/Makefile.in
index 6544dca..c9375ad 100644
--- a/interfaces/sage/Makefile.in
+++ b/interfaces/sage/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -38,19 +39,26 @@ DIST_COMMON = $(am__pkginclude_HEADERS_DIST) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
-	$(top_srcdir)/macros/blas-check.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
 	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
 	$(top_srcdir)/macros/givaro-check.m4 \
 	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
 	$(top_srcdir)/macros/lidia-check.m4 \
 	$(top_srcdir)/macros/linbox-doc.m4 \
 	$(top_srcdir)/macros/linbox-misc.m4 \
 	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
 	$(top_srcdir)/macros/maple-check.m4 \
 	$(top_srcdir)/macros/ntl-check.m4 \
 	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -101,18 +109,21 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
 CC = @CC@
+CCNAM = @CCNAM@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
 DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -120,19 +131,24 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
 GIVARO_CFLAGS = @GIVARO_CFLAGS@
 GIVARO_LIBS = @GIVARO_LIBS@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
 GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
@@ -140,41 +156,52 @@ LIBTOOL = @LIBTOOL@
 LIDIA_CFLAGS = @LIDIA_CFLAGS@
 LIDIA_LIBS = @LIDIA_LIBS@
 LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MAPLE_CFLAGS = @MAPLE_CFLAGS@
 MAPLE_HOME = @MAPLE_HOME@
 MAPLE_LIBS = @MAPLE_LIBS@
 MAPLE_VERSION = @MAPLE_VERSION@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
 NTL_CFLAGS = @NTL_CFLAGS@
 NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RM = @RM@
 SACLIB_CFLAGS = @SACLIB_CFLAGS@
 SACLIB_LIBS = @SACLIB_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+TESTS_CFLAGS = @TESTS_CFLAGS@
 VERSION = @VERSION@
+WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -215,16 +242,21 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
- at LINBOX_HAVE_SAGE_TRUE@INCLUDES = -I$(top_srcdir) -I. -I../../linbox
- at LINBOX_HAVE_SAGE_TRUE@AM_CXXFLAGS = -O2 -DDISABLE_COMMENTATOR $(GMP_CFLAGS) $(NTL_CFLAGS) $(ATLAS_CFLAGS) $(GIVARO_CFLAGS)
+
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+ at LINBOX_HAVE_SAGE_TRUE@AM_CPPFLAGS = -I$(top_srcdir) -I. -I../../linbox
+ at LINBOX_HAVE_SAGE_TRUE@AM_CXXFLAGS = @DEFAULT_CFLAGS@ -DDISABLE_COMMENTATOR $(GMP_CFLAGS) $(NTL_CFLAGS) $(ATLAS_CFLAGS) $(FFLAFLAS_CFLAGS) $(GIVARO_CFLAGS)
 @LINBOX_HAVE_SAGE_TRUE at lib_LTLIBRARIES = liblinboxsage.la
 @LINBOX_HAVE_SAGE_TRUE at liblinboxsage_la_SOURCES = linbox-sage.C
 @LINBOX_HAVE_SAGE_TRUE at pkginclude_HEADERS = linbox-sage.h
 
 #liblinboxsage_la_LIBADD = -llinbox $(BLAS_LIBS)
- at LINBOX_HAVE_SAGE_TRUE@liblinboxsage_la_LDFLAGS = $(GMP_LIBS) $(NTL_LIBS) $(BLAS_LIBS) $(MAPLE_LIBS) $(GIVARO_LIBS)  -version-info 0:0:0 #-Wl,-zmuldefs
+ at LINBOX_HAVE_SAGE_TRUE@liblinboxsage_la_LDFLAGS = $(GIVARO_LIBS) $(GMP_LIBS) $(NTL_LIBS) $(BLAS_LIBS) $(MAPLE_LIBS)  -version-info 0:0:0 #-Wl,-zmuldefs
 all: all-am
 
 .SUFFIXES:
@@ -233,8 +265,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
 	      exit 1;; \
 	  esac; \
 	done; \
@@ -331,7 +363,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
@@ -446,6 +478,8 @@ dvi-am:
 
 html: html-am
 
+html-am:
+
 info: info-am
 
 info-am:
@@ -454,18 +488,28 @@ install-data-am: install-pkgincludeHEADERS
 
 install-dvi: install-dvi-am
 
+install-dvi-am:
+
 install-exec-am: install-libLTLIBRARIES
 
 install-html: install-html-am
 
+install-html-am:
+
 install-info: install-info-am
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-am
 
+install-pdf-am:
+
 install-ps: install-ps-am
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
diff --git a/interfaces/sage/linbox-sage.C b/interfaces/sage/linbox-sage.C
index ff55e4a..d42f99f 100644
--- a/interfaces/sage/linbox-sage.C
+++ b/interfaces/sage/linbox-sage.C
@@ -1,4 +1,5 @@
 /* -*- 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
 /* linbox-sage.C
  * Copyright (C) 2007 Martin Albrecht
  *               2008 Clement Pernet
@@ -27,6 +28,7 @@
 
 #include <cstdlib>
 #include <vector>
+#include <list>
 
 #include "linbox-sage.h"
 
@@ -34,7 +36,7 @@
 
 #include <linbox/blackbox/sparse.h>
 
-#include "linbox/element/givaro-polynomial.h"
+//#include "linbox/element/givaro-polynomial.h"
 
 #include <linbox/matrix/blas-matrix.h>
 #include <linbox/matrix/sparse.h>
@@ -44,8 +46,8 @@
 #include <linbox/algorithms/echelon-form.h>
 #include "linbox/algorithms/gauss.h"
 #include "linbox/algorithms/smith-form-adaptive.h"
-#include "linbox/ffpack/ffpack.h"
-#include <linbox/solutions/rank.h>          
+#include "fflas-ffpack/ffpack/ffpack.h"
+#include <linbox/solutions/rank.h>
 #include <linbox/solutions/det.h>
 #include <linbox/solutions/solve.h>
 #include "linbox/solutions/methods.h"
@@ -58,567 +60,674 @@
 #include <linbox/field/modular.h>
 
 using namespace LinBox;
-using namespace std;
 
 /*************************************************************************
-   dense modulo Z/nZ
-*************************************************************************/
+  dense modulo Z/nZ
+ *************************************************************************/
 
 //we are using Modular<double> here as it seems to be best supported
-typedef Modular<double> ModInt;
-typedef GivPolynomialRing<ModInt::Element,Dense> ModIntPolRing;
-
-static DenseMatrix<ModInt> linbox_new_modn_matrix(mod_int modulus, mod_int** matrix, size_t nrows, size_t ncols);
-static void linbox_set_modn_matrix(mod_int** matrix, DenseMatrix<ModInt>& A, size_t nrows, size_t ncols);
-
 
 /* NOTE: There are many echelon form functions, possible base rings, etc.  Strangely,
    most don't build.  This combination below does though.
-*/
-int linbox_modn_dense_echelonize(mod_int modulus,  
-				 mod_int** matrix, size_t nrows, size_t ncols) {
-
-
-    //this is the way Clement suggested, need to figure out if it is way faster for very
-    //large inputs (approx. 2 seconds slower for 5000x5000 on my system) (malb)
-    //     typedef Modular<double> Field;
-    //     Field F((double)modulus);
-    //     BlasMatrix<Field::Element> A(nrows, ncols);
-    //     BlasMatrix<Field::Element> E(A.rowdim(),A.coldim());
-    //     EchelonFormDomain<Modular<double> > EF (F);
-
-    ModInt F((double)modulus);
-    EchelonFormDomain< ModInt > EF(F);
-    BlasMatrix<ModInt::Element> A( nrows, ncols);
-    BlasMatrix<ModInt::Element> E( nrows, ncols);
-
-    mod_int* row;
-    for (size_t i=0; i < nrows; i++) {
-	row = matrix[i];
-	for (size_t j=0; j < ncols; j++)
-	    A.setEntry(i, j, (double)row[j]);
-	}
-    int rank = EF.rowReducedEchelon(E, A); 
-    for (size_t i=0; i < nrows; i++) {
-	row = matrix[i];
-	for (size_t j=0; j < ncols; j++)
-	    row[j] = (mod_int)E.getEntry(i, j);
+   */
+
+void linbox_modn_dense_delete_array_double(double * f) {delete[] f;
+}
+void linbox_modn_dense_delete_array_float(float * f) {delete[] f;
+}
+
+template <class Element>
+unsigned long int linbox_modn_dense_echelonize (Element modulus, Element* matrix,
+						size_t nrows, size_t ncols)
+{
+	Modular<Element> F(modulus);
+
+	size_t * P=new size_t[ncols];
+	size_t * Q=new size_t[nrows];
+	size_t r = FFPACK::ReducedRowEchelonForm(F, nrows, ncols, matrix, ncols, P,Q);
+
+	for (size_t i=0; i<nrows;++i){
+		for (size_t j=0; j<r; ++j){
+			*(matrix+i*ncols+j) = 0;
+		}
+		if (i<r)
+			*(matrix + i*(ncols+1)) = 1;
 	}
-    return rank;
+	FFPACK::applyP (F, FFLAS::FflasRight, FFLAS::FflasNoTrans, nrows, 0,r, matrix, ncols, Q);
+	delete[] P;
+	delete[] Q;
+	return r;
 }
 
-int linbox_modn_dense_rank(mod_int modulus,  
-			   mod_int** matrix, size_t nrows, size_t ncols) {
+EXTERN unsigned long int linbox_modn_dense_echelonize_double (double modulus, double*matrix, size_t nrows, size_t ncols)
+{
+	return linbox_modn_dense_echelonize<double>(modulus, matrix, nrows, ncols);
+}
 
-  Modular<double> F ((double) modulus);
-  double * Ad = new double [nrows*ncols];
-  for (size_t i=0; i< nrows; ++i)
-    for (size_t j = 0; j < ncols; ++j)
-      *(Ad + i * ncols + j) = matrix[i][j];
+EXTERN unsigned long int linbox_modn_dense_echelonize_float (float modulus, float * matrix, size_t nrows, size_t ncols)
+{
+	return linbox_modn_dense_echelonize<float>(modulus,matrix,nrows,ncols);
+}
+
+template<class Element>
+unsigned long int linbox_modn_dense_rank (Element modulus,  Element* matrix, size_t nrows, size_t ncols)
+{
+
+	Modular<Element> F (modulus);
+	Element * Ad = new Element [nrows*ncols];
+	for (size_t i=0; i< nrows; ++i)
+		for (size_t j = 0; j < ncols; ++j)
+			*(Ad + i * ncols + j) = *(matrix + i*ncols + j);
 
-  size_t r = FFPACK::Rank (F, nrows, ncols, Ad, ncols);
-  delete[] Ad;
-  return r;
+	size_t r = FFPACK::Rank (F, nrows, ncols, Ad, ncols);
+	delete[] Ad;
+	return r;
+}
+
+EXTERN unsigned long int linbox_modn_dense_rank_double (double modulus, double* matrix, size_t nrows, size_t ncols)
+{
+	return linbox_modn_dense_rank<double>(modulus,matrix,nrows,ncols);
+}
+EXTERN unsigned long int linbox_modn_dense_rank_float (float modulus, float* matrix, size_t nrows, size_t ncols)
+{
+	return linbox_modn_dense_rank<float>(modulus,matrix,nrows,ncols);
 }
 
-mod_int linbox_modn_dense_det(mod_int modulus,  
-			      mod_int** matrix, size_t nrows, size_t ncols) {
+template<class Element>
+Element linbox_modn_dense_det(Element modulus,Element*matrix,size_t nrows,size_t ncols)
+{
 
-    Modular<double> F ((double) modulus);
-    double * Ad = new double [nrows*ncols];
-    for (size_t i=0; i< nrows; ++i)
-      for (size_t j = 0; j < nrows; ++j)
-	*(Ad + i * ncols + j) = matrix[i][j];
-    double dd = FFPACK::Det (F, nrows, ncols, Ad, ncols);
-    delete[] Ad;
-    return (mod_int) dd;
+	Modular<Element> F (modulus);
+	Element * Ad = new Element [nrows*ncols];
+	for (size_t i=0; i< nrows; ++i)
+		for (size_t j = 0; j < ncols; ++j)
+			*(Ad + i * ncols + j) = *(matrix+i*ncols+j);
+	Element dd = FFPACK::Det (F, nrows, ncols, Ad, ncols);
+	delete[] Ad;
+	return  dd;
 }
 
-void linbox_modn_dense_minpoly(mod_int modulus, mod_int **mp, size_t* degree, size_t n, mod_int **matrix, int do_minpoly) {
+EXTERN double linbox_modn_dense_det_double (double modulus, double* matrix, size_t nrows, size_t ncols)
+{
+	return linbox_modn_dense_det<double>(modulus,matrix,nrows,ncols);
+}
+EXTERN float linbox_modn_dense_det_float (float modulus, float* matrix, size_t nrows, size_t ncols)
+{
+	return linbox_modn_dense_det<float>(modulus,matrix,nrows,ncols);
+}
 
-    ModInt F((double)modulus);
+template<class Element>
+Element* linbox_modn_dense_minpoly (Element modulus, Element ** mp, size_t* degree,
+				    size_t n, Element *matrix)
+{
+	typedef  Modular<Element> Field;
+	typedef  std::vector<Element> Polynomial;
+
+	Modular<Element> F(modulus);
+	// Warning: super sketchy memory alloc here!!!!
+	std::vector<Element> *minP=new std::vector<Element>(n);
+	Element * X = new Element[n*(n+1)];
+	size_t * P = new size_t[n];
+
+	// FIXME: check the memory management: better to allocate mp in sage
+	// FFPACK::MinPoly<Field,Polynomial> (F, *minP, n, matrix, n, X, n, P);
+	FFPACK::MinPoly<Field,Polynomial> (F, *minP, n, matrix, n, X, n, P);
+	*degree=minP->size()-1;
+
+	*mp = &(*minP)[0];
+	delete[] P;
+	delete[] X;
+	return *mp;
+}
 
-    size_t m = n;
+EXTERN double* linbox_modn_dense_minpoly_double (double modulus, double ** mp, size_t* degree, size_t n, double*matrix)
+{
+	return linbox_modn_dense_minpoly<double> (modulus, mp, degree, n, matrix);
+}
+EXTERN float* linbox_modn_dense_minpoly_float (float modulus, float ** mp, size_t* degree, size_t n, float *matrix)
+{
+	return linbox_modn_dense_minpoly<float> (modulus, mp, degree, n, matrix);
+}
 
-    DenseMatrix<ModInt> A(linbox_new_modn_matrix( modulus, matrix, m, m));
 
-    GivPolynomial<ModInt::Element> m_A;
+template<class Polynomial, class Field>
+Polynomial & mulpoly(const Field& F, Polynomial &res, const Polynomial & P1, const Polynomial & P2)
+{
+	size_t i,j;
+	// Warning: assumes that res is allocated to the size of the product
+	//res.resize(P1.size()+P2.size()-1);
+	for (i=0;i<res.size();i++)
+		F.assign(res[i], 0.0);
+	for ( i=0;i<P1.size();i++)
+		for ( j=0;j<P2.size();j++)
+			F.axpyin(res[i+j],P1[i],P2[j]);
+	return res;
 
-    if (do_minpoly) 
-	minpoly(m_A, A);
-    else
-        charpoly(m_A, A);
-      
-    (*mp) = new mod_int[m_A.size()];
-    *degree = m_A.size() - 1;
-    for (size_t i=0; i <= *degree; i++) {
-	(*mp)[i] = (mod_int)m_A[i]; 
-    }
-
-}
-EXTERN int linbox_modn_dense_col_rankprofile_submatrix_indices (mod_int modulus,
-								mod_int** matrix,
-								size_t ** row_idx,
-								size_t ** col_idx,
-								size_t * rank,
-								size_t nrows,
-								size_t ncols){
-  Modular<double> F ((double) modulus);
-  double * Ad = new double [nrows*ncols];
-  for (size_t i=0; i< nrows; ++i)
-    for (size_t j = 0; j < nrows; ++j)
-      *(Ad + i * ncols + j) = matrix[i][j];
-  
-  size_t R;
-  double * X;
-  size_t *rowindices;
-  size_t *colindices;
-  FFPACK::ColRankProfileSubmatrixIndices (F, nrows, ncols, Ad, ncols,
-					  rowindices, colindices, R);
-  rank[0] = R;
-  col_idx[0] = colindices; 
-  row_idx[0] = rowindices; 
-  delete[] Ad;
-  return R;
-}
-
-
-
-int linbox_modn_dense_col_rankprofile_submatrix (mod_int modulus,
-						 mod_int** matrix,
-						 double** ans,
-						 size_t* rank,
-						 size_t nrows, size_t ncols){
-  Modular<double> F ((double) modulus);
-  double * Ad = new double [nrows*ncols];
-  for (size_t i=0; i< nrows; ++i)
-    for (size_t j = 0; j < nrows; ++j)
-      *(Ad + i * ncols + j) = matrix[i][j];
-  
-  size_t R;
-  double * X;
-  FFPACK::ColRankProfileSubmatrix (F, nrows, ncols, Ad, ncols, X, R);
-  rank[0] = R;
-  ans[0] = X;
-  delete[] Ad;
-  return R;
-}
-
-void linbox_modn_dense_delete_array(mod_int *f) {
-    delete[] f;
-}
-
-void linbox_modn_dense_delete_dbl_array(double *f) {
-    delete[] f;
-}
-
-static DenseMatrix<ModInt> linbox_new_modn_matrix(mod_int modulus, mod_int** matrix, size_t nrows, size_t ncols) {
-
-    ModInt F((double)modulus);
-
-    DenseMatrix<ModInt> A ( F, nrows, ncols);
-
-    size_t i, j, k;
-    for (i=0; i < nrows; i++) {
-	for (j=0; j < ncols; j++) {
-	    A.setEntry(i, j, (double)matrix[i][j]);
-	}
-    }
-    return A;
-};
+}
+
+template<class Element>
+Element* linbox_modn_dense_charpoly (Element modulus, Element *& cp, size_t n, Element *matrix)
+{
 
-static void linbox_set_modn_matrix(mod_int** matrix, BlasMatrix<ModInt::Element>& A, size_t nrows, size_t ncols) {
-    size_t i, j, k;
-    for (i=0; i < nrows; i++) {
-	for (j=0; j < ncols; j++) {
-	    matrix[i][j] = (mod_int)A.getEntry(i,j);
+	Modular<Element> F(modulus);
+
+	// FIXME: check the memory management: better to allocate mp in sage
+	std::list<std::vector<Element> > P_list;
+
+
+	FFPACK::CharPoly (F, P_list, n, matrix, n);
+
+	std::vector<Element>* tmp = new std::vector<Element> (n+1);
+	std::vector<Element> P;
+
+
+	typename std::list<std::vector<Element> >::const_iterator it;
+	it = P_list.begin();
+	P = *(it++);
+	while( it!=P_list.end() ){
+		::mulpoly (F,*tmp, P, *it);
+		P = *tmp;
+		//	delete &(*it);
+		++it;
 	}
-    }
-};
+	return cp = &(*tmp)[0];
+
+}
 
-int linbox_modn_dense_matrix_matrix_multiply(mod_int modulus, mod_int **ans, mod_int **A, mod_int **B,
-					     size_t A_nr, size_t A_nc, size_t B_nr, size_t B_nc) 
+EXTERN double* linbox_modn_dense_charpoly_double (double modulus, double ** cp, size_t n, double * matrix)
+{
+	return linbox_modn_dense_charpoly<double>(modulus,*cp,n,matrix);
+}
+EXTERN float* linbox_modn_dense_charpoly_float (float modulus, float ** cp, size_t n, float * matrix)
 {
+	return linbox_modn_dense_charpoly<float>(modulus,*cp,n,matrix);
+}
 
-    ModInt F((double)modulus);
+template<class Element>
+unsigned long linbox_modn_dense_col_rankprofile_submatrix_indices (Element modulus,
+								   Element* matrix,
+								   size_t ** row_idx,
+								   size_t ** col_idx,
+								   size_t* rank,
+								   size_t nrows,
+								   size_t ncols)
+{
+	Modular<Element> F (modulus);
+	Element * Ad = new Element [nrows*ncols];
+	for (size_t i=0; i< nrows; ++i)
+		for (size_t j = 0; j < ncols; ++j)
+			*(Ad + i * ncols + j) = *(matrix +i*ncols + j);
+
+	FFPACK::ColRankProfileSubmatrixIndices (F, nrows, ncols, Ad, ncols,
+						*row_idx, *col_idx, *rank);
+	delete[] Ad;
+	return *rank;
+}
+EXTERN unsigned long linbox_modn_dense_col_rankprofile_submatrix_indices_double (double modulus, double* matrix, size_t ** row_idx, size_t ** col_idx, size_t * rank, size_t nrows, size_t ncols)
+{
+	return linbox_modn_dense_col_rankprofile_submatrix_indices<double>(modulus,matrix,row_idx,col_idx,rank,nrows,ncols);
+}
+EXTERN unsigned long linbox_modn_dense_col_rankprofile_submatrix_indices_float (float modulus, float* matrix, size_t ** row_idx, size_t ** col_idx, size_t * rank, size_t nrows,size_t ncols)
+{
+	return linbox_modn_dense_col_rankprofile_submatrix_indices<float>(modulus,matrix,row_idx,col_idx,rank,nrows,ncols);
+}
 
-    BlasMatrix<ModInt::Element> AA(linbox_new_modn_matrix(modulus, A, A_nr, A_nc));
-    BlasMatrix<ModInt::Element> BB(linbox_new_modn_matrix(modulus, B, B_nr, B_nc));
-    if (A_nc != B_nr)
-	return -1;   // error
-    BlasMatrix<ModInt::Element> CC( A_nr, B_nc);
+template<class Element>
+unsigned long linbox_modn_dense_col_rankprofile_submatrix (Element modulus,
+							   Element* matrix,
+							   Element* ans,
+							   size_t& rank,
+							   size_t nrows, size_t ncols)
+{
+	Modular<Element> F (modulus);
+	//FIXME: check the memory managmenent
+	Element * Ad = new Element [nrows*ncols];
+	for (size_t i=0; i< nrows; ++i)
+		for (size_t j = 0; j < ncols; ++j)
+			*(Ad + i * ncols + j) = *(matrix + i*ncols + j);
+
+	size_t R = FFPACK::ColRankProfileSubmatrix (F, nrows, ncols, ans, ncols, ans, rank);
+	delete[] Ad;
+	return R;
+}
+EXTERN unsigned long linbox_modn_dense_col_rankprofile_submatrix_double (double modulus, double* matrix, double* out, size_t* rank, size_t nrows, size_t ncols)
+{
+	return linbox_modn_dense_col_rankprofile_submatrix<double>(modulus,matrix,out,*rank, nrows,ncols);
+}
+EXTERN unsigned long linbox_modn_dense_col_rankprofile_submatrix_float (float modulus, float* matrix, float* out, size_t* rank, size_t nrows, size_t ncols)
+{
+	return linbox_modn_dense_col_rankprofile_submatrix<float>(modulus,matrix,out,*rank,nrows,ncols);
+}
 
-    BlasMatrixDomain<ModInt> MD(F);
+template<class Element>
+Element* linbox_modn_dense_matrix_matrix_multiply (Element modulus, Element *ans,
+						   Element *A, Element *B,
+						   size_t m, size_t n, size_t k)
+{
+
+	Modular<Element> F(modulus);
 
-    MD.mul(CC, AA, BB);
+	FFLAS::fgemm (F, FFLAS::FflasNoTrans, FFLAS::FflasNoTrans, m,n,k, 1.0,
+		      A, k, B, n, 0.0, ans, n);
+
+	return ans;
+}
 
-    linbox_set_modn_matrix(ans, CC, A_nr, B_nc);
-    
-    return 0;
+EXTERN double* linbox_modn_dense_matrix_matrix_multiply_double(double modulus, double * ans, double *A, double *B, size_t m,size_t n,size_t k)
+{
+	return linbox_modn_dense_matrix_matrix_multiply<double>(modulus,ans,A,B,m,n,k);
+}
+EXTERN float* linbox_modn_dense_matrix_matrix_multiply_float(float modulus, float * ans, float *A, float *B, size_t m,size_t n,size_t k)
+{
+	return linbox_modn_dense_matrix_matrix_multiply<float>(modulus,ans,A,B,m,n,k);
+}
+
+template<class Element>
+Element *  linbox_modn_dense_matrix_matrix_general_multiply(Element modulus,
+							    Element *ans,
+							    Element alpha, Element beta,
+							    Element *A, Element *B,
+							    size_t m, size_t n, size_t k)
+{
+	Modular<Element> F(modulus);
+	FFLAS::fgemm (F, FFLAS::FflasNoTrans, FFLAS::FflasNoTrans, m,n,k, alpha,
+		      A, k, B, n, beta,ans, n);
+	return ans;
+
+}
+EXTERN double* linbox_modn_dense_matrix_matrix_general_multiply_double (double modulus, double * ans, double alpha, double beta, double *A, double *B, size_t m, size_t n, size_t k)
+{
+	return linbox_modn_dense_matrix_matrix_general_multiply<double>(modulus,ans,alpha,beta,A,B,m,n,k);
+}
+EXTERN float* linbox_modn_dense_matrix_matrix_general_multiply_float (float modulus, float * ans, float alpha, float beta, float *A, float *B, size_t m, size_t n, size_t k)
+{
+	return linbox_modn_dense_matrix_matrix_general_multiply<float>(modulus,ans,alpha,beta,A,B,m,n,k);
 }
 
 /*************************************************************************
-    dense over ZZ
-*************************************************************************/
+  dense over ZZ
+ *************************************************************************/
 
 typedef PID_integer Integers;
 
 template <class Field, class Polynomial>
-void printPolynomial (const Field &F, const Polynomial &v) 
+void printPolynomial (const Field &F, const Polynomial &v)
 {
-        for (int i = v.size () - 1; i >= 0; i--) {
-                F.write (cout, v[i]);
-                if (i > 0)
-                        cout << " x^" << i << " + ";
-        }
-        cout << endl;
+	for (int i = v.size () - 1; i >= 0; i--) {
+		F.write (std::cout, v[i]);
+		if (i > 0)
+			std::cout << " x^" << i << " + ";
+	}
+	std::cout << std::endl;
 }
 
 Integers ZZ;
 SpyInteger spy;
-typedef GivPolynomialRing<Integers,Dense> IntPolRing;
+typedef GivPolynomialRing<Integers,::Givaro::Dense> IntPolRing;
 
-DenseMatrix<Integers> new_matrix(mpz_t** matrix, size_t nrows, size_t ncols) {
-  DenseMatrix<Integers> A ( ZZ, nrows, ncols);
+DenseMatrix<Integers> new_matrix(mpz_t** matrix, size_t nrows, size_t ncols)
+{
+	DenseMatrix<Integers> A ( ZZ, nrows, ncols);
+
+	size_t i, j;
+	for (i=0; i < nrows; i++) {
+		for (j=0; j < ncols; j++) {
+			Integers::Element t;
+			mpz_set(spy.get_mpz(t), matrix[i][j]);
+			A.setEntry(i, j, t);
+		}
+	}
+	return A;
+}
 
-     size_t i, j, k;
-     for (i=0; i < nrows; i++) {
-	 for (j=0; j < ncols; j++) {
-	     Integers::Element t;
-	     mpz_set(spy.get_mpz(t), matrix[i][j]);
-	     A.setEntry(i, j, t);
-	 }
-     }
-     return A;
+DenseMatrix<Integers> new_matrix_integers(mpz_t** matrix, size_t nrows, size_t ncols)
+{
+	Integers ZZ;
+	DenseMatrix<Integers> A ( ZZ,nrows, ncols);
+
+	size_t i, j;
+	for (i=0; i < nrows; i++) {
+		for (j=0; j < ncols; j++) {
+			Integers::Element t;
+			mpz_set(spy.get_mpz(t), matrix[i][j]);
+			A.setEntry(i, j, t);
+		}
+	}
+	return A;
 }
 
-DenseMatrix<Integers> new_matrix_integers(mpz_t** matrix, size_t nrows, size_t ncols) {
-     Integers ZZ;
-     DenseMatrix<Integers> A ( ZZ,nrows, ncols);
+template<class Element>
+void set_matrix(mpz_t** matrix, BlasMatrix<Element>& A, size_t nrows, size_t ncols)
+{
+	size_t i, j;
+	for (i=0; i < nrows; i++) {
+		for (j=0; j < ncols; j++) {
+			mpz_set(matrix[i][j], spy.get_mpz(A.getEntry(i,j)));
+		}
+	}
+}
+
+void linbox_integer_dense_minpoly_hacked(mpz_t* *mp, size_t* degree, size_t n, mpz_t** matrix, int do_minpoly)
+{
+	/* We program around a bizarre bug in linbox, where minpoly doesn't work
+	   on matrices that are n x n with n divisible by 4!
+	   */
+	size_t m;
+	if (n % 4 == 0 || !do_minpoly) {
+		m = n + 1;
+	}
+	else {
+		m = n;
+	}
+
+	DenseMatrix<Integers> A( ZZ, m, m);
+
+	size_t i, j;
+	Integers::Element t;
+	for (i=0; i < n; i++) {
+		for (j=0; j < n; j++) {
+			mpz_set(spy.get_mpz(t), matrix[i][j]);
+			A.setEntry(i, j, t);
+		}
+	}
+
+	//    vector<Integers::Element> m_A;
+	IntPolRing::Element m_A;
+
+	if (do_minpoly)
+		minpoly(m_A, A);
+	else
+		charpoly(m_A, A);
+
+	if (n%4 == 0 || !do_minpoly) {
+		/* Program around the bug.
+		   It is OK that this code is crappy and redundant, since it will get replaced
+		   when linbox gets fixed. */
+		int divide_by_x;
+
+		if (!do_minpoly)
+			divide_by_x = 1;
+		else {
+			long unsigned int r;
+			rank(r, A);
+			divide_by_x = (r==n);
+		}
+		if (divide_by_x) {
+			/* x was not a factor of the charpoly after all. */
+			(*mp) = new mpz_t[m_A.size()-1];
+			*degree = m_A.size() - 2;
+			for (size_t i=0; i <= *degree; i++) {
+				mpz_init((*mp)[i]);
+				mpz_set((*mp)[i], spy.get_mpz(m_A[i+1]));
+			}
+			return;
+		}
+	}
+
+	(*mp) = new mpz_t[m_A.size()];
+	*degree = m_A.size() - 1;
+	for (size_t i=0; i <= *degree; i++) {
+		mpz_init((*mp)[i]);
+		mpz_set((*mp)[i], spy.get_mpz(m_A[i]));
+	}
 
-     size_t i, j, k;
-     for (i=0; i < nrows; i++) {
-	 for (j=0; j < ncols; j++) {
-	     Integers::Element t;
-	     mpz_set(spy.get_mpz(t), matrix[i][j]);
-	     A.setEntry(i, j, t);
-	 }
-     }
-     return A;
 }
 
-template<class Element>
-void set_matrix(mpz_t** matrix, BlasMatrix<Element>& A, size_t nrows, size_t ncols) {
-     size_t i, j, k;
-     for (i=0; i < nrows; i++) {
-	 for (j=0; j < ncols; j++) {
-	     mpz_set(matrix[i][j], spy.get_mpz(A.getEntry(i,j)));
-	 }
-     }
-}
-
-void linbox_integer_dense_minpoly_hacked(mpz_t* *mp, size_t* degree, size_t n, mpz_t** matrix, int do_minpoly) {
-     /* We program around a bizarre bug in linbox, where minpoly doesn't work
-	on matrices that are n x n with n divisible by 4!
-     */
-     size_t m;
-     if (n % 4 == 0 || !do_minpoly) {
-	 m = n + 1;
-     } else {
-	 m = n;
-     }
-
-     DenseMatrix<Integers> A( ZZ, m, m);
-
-     size_t i, j;
-     Integers::Element t;
-     for (i=0; i < n; i++) {
-	 for (j=0; j < n; j++) {
-	     mpz_set(spy.get_mpz(t), matrix[i][j]);
-	     A.setEntry(i, j, t);
-	 }
-     }
-
- //    vector<Integers::Element> m_A;
-     IntPolRing::Element m_A;
-
-     if (do_minpoly) 
-	 minpoly(m_A, A);
-     else
-	 charpoly(m_A, A);
-
-     if (n%4 == 0 || !do_minpoly) {
-	 /* Program around the bug. 
-	    It is OK that this code is crappy and redundant, since it will get replaced
-	    when linbox gets fixed. */
-	 int divide_by_x;
-
-	 if (!do_minpoly)
-	     divide_by_x = 1;
-	 else {
-	     long unsigned int r;
-	     rank(r, A);
-	     divide_by_x = (r==n);
-	 }
-	 if (divide_by_x) {
-	     /* x was not a factor of the charpoly after all. */
-	     (*mp) = new mpz_t[m_A.size()-1];
-	     *degree = m_A.size() - 2;
-	     for (size_t i=0; i <= *degree; i++) {
-		 mpz_init((*mp)[i]);
-		 mpz_set((*mp)[i], spy.get_mpz(m_A[i+1])); 
-	     }
-	     return;
-	 }
-     }
-
-     (*mp) = new mpz_t[m_A.size()];
-     *degree = m_A.size() - 1;
-     for (size_t i=0; i <= *degree; i++) {
-	 mpz_init((*mp)[i]);
-	 mpz_set((*mp)[i], spy.get_mpz(m_A[i])); 
-     }
-
-}
-
- void linbox_integer_dense_charpoly(mpz_t* *mp, size_t* degree, size_t n, mpz_t** matrix) {
-     /* THIS IS Broken when n % 4 == 0!!!!  Use above function instead. */
-   /*    linbox_integer_dense_minpoly(mp, degree, n, matrix, 0); */
-
-     DenseMatrix<Integers> A(new_matrix(matrix, n, n));
-     IntPolRing::Element m_A;
-     charpoly(m_A, A);
-
-     (*mp) = new mpz_t[m_A.size()];
-     *degree = m_A.size() - 1;
-     for (size_t i=0; i <= *degree; i++) {
-	 mpz_init((*mp)[i]);
-	 mpz_set((*mp)[i], spy.get_mpz(m_A[i])); 
-     }
-
- }
-
- void linbox_integer_dense_minpoly(mpz_t* *mp, size_t* degree, size_t n, mpz_t** matrix) {
-     /* THIS IS Broken when n % 4 == 0!!!!  Use above function instead. */
-   /*    linbox_integer_dense_minpoly(mp, degree, n, matrix, 0); */
-
-   DenseMatrix<Integers> A(new_matrix(matrix, n, n));
-     IntPolRing::Element m_A;
-     minpoly(m_A, A);
-
-     (*mp) = new mpz_t[m_A.size()];
-     *degree = m_A.size() - 1;
-     for (size_t i=0; i <= *degree; i++) {
-	 mpz_init((*mp)[i]);
-	 mpz_set((*mp)[i], spy.get_mpz(m_A[i])); 
-     }
-
- }
-
- void linbox_integer_dense_delete_array(mpz_t* f) {
-     delete[] f;
- }
-
- int linbox_integer_dense_matrix_matrix_multiply(mpz_t** ans, mpz_t **A, mpz_t **B,
-				   size_t A_nr, size_t A_nc, size_t B_nr, size_t B_nc) 
- {
-   typedef PID_integer Integers;
-   Integers ZZ;
-
-     BlasMatrix<Integers::Element> AA(new_matrix_integers(A, A_nr, A_nc));
-     BlasMatrix<Integers::Element> BB(new_matrix_integers(B, B_nr, B_nc));
-     if (A_nc != B_nr)
-	 return -1;   // error
-     BlasMatrix<Integers::Element> CC( A_nr, B_nc);
-
-     MatrixDomain<Integers> MD(ZZ);
-
-     MD.mul(CC, AA, BB);
-
-     set_matrix(ans, CC, A_nr, B_nc);
-
-     return 0;
- }
-
- unsigned long linbox_integer_dense_rank(mpz_t** matrix, size_t nrows,
-					 size_t ncols) {
-     DenseMatrix<Integers> A(new_matrix(matrix, nrows, ncols));
-     unsigned long r;
-     rank(r, A);
-     return r;
- }
-
- void linbox_integer_dense_det(mpz_t ans, mpz_t** matrix, size_t nrows,
-			       size_t ncols) {
-   commentator.setMaxDetailLevel(0);
-   commentator.setMaxDepth (0);
-
-   DenseMatrix<Integers> A(new_matrix_integers(matrix, nrows, ncols));
-   Integers::Element d;
-   det(d, A);
-   mpz_set(ans, spy.get_mpz(d));
-}
-
-
-DenseMatrix<NTL_ZZ> new_matrix_integer_dense_ntl(mpz_t** matrix, size_t nrows, size_t ncols) {
-     NTL_ZZ ZZ;
-     DenseMatrix<NTL_ZZ> A (ZZ,nrows, ncols);
-     size_t i, j, k;
-     for (i=0; i < nrows; i++) {
-	 for (j=0; j < ncols; j++) {
-	   NTL_ZZ::Element t;
-	   PID_integer::Element s;
-	   mpz_set(spy.get_mpz(s), matrix[i][j]);
-	   ZZ.init(t, s);
-	   A.setEntry(i, j, t);
-	 }
-     }
-     return A;
+void linbox_integer_dense_charpoly(mpz_t* *mp, size_t* degree, size_t n, mpz_t** matrix)
+{
+	/* THIS IS Broken when n % 4 == 0!!!!  Use above function instead. */
+	/*    linbox_integer_dense_minpoly(mp, degree, n, matrix, 0); */
+
+	DenseMatrix<Integers> A(new_matrix(matrix, n, n));
+	IntPolRing::Element m_A;
+	charpoly(m_A, A);
+
+	(*mp) = new mpz_t[m_A.size()];
+	*degree = m_A.size() - 1;
+	for (size_t i=0; i <= *degree; i++) {
+		mpz_init((*mp)[i]);
+		mpz_set((*mp)[i], spy.get_mpz(m_A[i]));
+	}
+
+}
+
+void linbox_integer_dense_minpoly(mpz_t* *mp, size_t* degree, size_t n, mpz_t** matrix)
+{
+	/* THIS IS Broken when n % 4 == 0!!!!  Use above function instead. */
+	/*    linbox_integer_dense_minpoly(mp, degree, n, matrix, 0); */
+
+	DenseMatrix<Integers> A(new_matrix(matrix, n, n));
+	IntPolRing::Element m_A;
+	minpoly(m_A, A);
+
+	(*mp) = new mpz_t[m_A.size()];
+	*degree = m_A.size() - 1;
+	for (size_t i=0; i <= *degree; i++) {
+		mpz_init((*mp)[i]);
+		mpz_set((*mp)[i], spy.get_mpz(m_A[i]));
+	}
+
+}
+
+void linbox_integer_dense_delete_array(mpz_t* f)
+{
+	delete[] f;
+}
+
+int linbox_integer_dense_matrix_matrix_multiply(mpz_t** ans, mpz_t **A, mpz_t **B,
+						size_t A_nr, size_t A_nc, size_t B_nr, size_t B_nc)
+{
+	typedef PID_integer Integers;
+	Integers ZZ;
+
+	BlasMatrix<Integers::Element> AA(new_matrix_integers(A, A_nr, A_nc));
+	BlasMatrix<Integers::Element> BB(new_matrix_integers(B, B_nr, B_nc));
+	if (A_nc != B_nr)
+		return -1;   // error
+	BlasMatrix<Integers::Element> CC( A_nr, B_nc);
+
+	MatrixDomain<Integers> MD(ZZ);
+
+	MD.mul(CC, AA, BB);
+
+	set_matrix(ans, CC, A_nr, B_nc);
+
+	return 0;
 }
 
+unsigned long linbox_integer_dense_rank(mpz_t** matrix, size_t nrows,
+					size_t ncols)
+{
+	DenseMatrix<Integers> A(new_matrix(matrix, nrows, ncols));
+	unsigned long r;
+	rank(r, A);
+	return r;
+}
+
+void linbox_integer_dense_det(mpz_t ans, mpz_t** matrix, size_t nrows,
+			      size_t ncols)
+{
+	commentator.setMaxDetailLevel(0);
+	commentator.setMaxDepth (0);
+
+	DenseMatrix<Integers> A(new_matrix_integers(matrix, nrows, ncols));
+	Integers::Element d;
+	det(d, A);
+	mpz_set(ans, spy.get_mpz(d));
+}
+
+#ifdef __LINBOX_HAVE_NTL
+DenseMatrix<NTL_ZZ> new_matrix_integer_dense_ntl(mpz_t** matrix, size_t nrows, size_t ncols)
+{
+	NTL_ZZ ZZ;
+	DenseMatrix<NTL_ZZ> A (ZZ,nrows, ncols);
+	size_t i, j;
+	for (i=0; i < nrows; i++) {
+		for (j=0; j < ncols; j++) {
+			NTL_ZZ::Element t;
+			PID_integer::Element s;
+			mpz_set(spy.get_mpz(s), matrix[i][j]);
+			ZZ.init(t, s);
+			A.setEntry(i, j, t);
+		}
+	}
+	return A;
+}
+#endif
+
 void linbox_integer_dense_double_det (mpz_t  ans1, mpz_t ans2, mpz_t **a, mpz_t ** b, mpz_t **c,
-				      size_t n, int proof) {
-
-  PID_integer ZZ;
-  BlasBlackbox <PID_integer> A (ZZ, n+1, n);
-  size_t i, j, k;
-  for (i=0; i < n-1; i++) {
-    for (j=0; j < n; j++) {
-      PID_integer::Element t;
-      mpz_set(spy.get_mpz(t), a[i][j]);
-      A.setEntry(i, j, t);
-    }
-  }
-  for (j=0; j < n; j++) {
-    PID_integer::Element t;
-    mpz_set(spy.get_mpz(t), b[0][j]);
-    A.setEntry (n-1, j, t);
-    mpz_set (spy.get_mpz(t), c[0][j]);
-    A.setEntry (n, j, t);
-  }
-  PID_integer::Element d1,d2;
-  doubleDet (d1, d2, A, proof);
-  mpz_set(ans1, spy.get_mpz(d1));
-  mpz_set(ans2, spy.get_mpz(d2));
-}
-
-/*
-This won't build on OS X PPC.
-
-void linbox_integer_dense_smithform(mpz_t **v, 
-                                    mpz_t **matrix, size_t nrows, size_t ncols) {
-  typedef NTL_ZZ Ints;
-  Ints Z;
-  DenseMatrix<Ints> M(new_matrix_integer_dense_ntl(matrix, nrows, ncols));
-  vector<integer> w(ncols);
-  SmithFormAdaptive::smithForm(w, M);
-
-  (*v) = new mpz_t[ncols];
-  for (size_t i=0; i < ncols; i++) {
-    mpz_init((*v)[i]);
-    mpz_set((*v)[i], spy.get_mpz(w[i]));
-  }
-}
-*/
+				      size_t n, int proof)
+{
+
+	PID_integer ZZ;
+	BlasBlackbox <PID_integer> A (ZZ, n+1, n);
+	size_t i, j;
+	for (i=0; i < n-1; i++) {
+		for (j=0; j < n; j++) {
+			PID_integer::Element t;
+			mpz_set(spy.get_mpz(t), a[i][j]);
+			A.setEntry(i, j, t);
+		}
+	}
+	for (j=0; j < n; j++) {
+		PID_integer::Element t;
+		mpz_set(spy.get_mpz(t), b[0][j]);
+		A.setEntry (n-1, j, t);
+		mpz_set (spy.get_mpz(t), c[0][j]);
+		A.setEntry (n, j, t);
+	}
+	PID_integer::Element d1,d2;
+	doubleDet (d1, d2, A, proof);
+	mpz_set(ans1, spy.get_mpz(d1));
+	mpz_set(ans2, spy.get_mpz(d2));
+}
+
+#if 0 /* This won't build on OS X PPC. */
+
+#ifdef __LINBOX_HAVE_NTL
+void linbox_integer_dense_smithform(mpz_t **v,
+				    mpz_t **matrix, size_t nrows, size_t ncols)
+{
+	typedef NTL_ZZ Ints;
+	Ints Z;
+	DenseMatrix<Ints> M(new_matrix_integer_dense_ntl(matrix, nrows, ncols));
+	std::vector<integer> w(ncols);
+	SmithFormAdaptive::smithForm(w, M);
+
+	(*v) = new mpz_t[ncols];
+	for (size_t i=0; i < ncols; i++) {
+		mpz_init((*v)[i]);
+		mpz_set((*v)[i], spy.get_mpz(w[i]));
+	}
+}
+#endif
+#endif
 
 /*************************************************************************
-   sparse modulo Z/nZ
-*************************************************************************/
+  sparse modulo Z/nZ
+ *************************************************************************/
 
 struct c_vector_modint_linbox {
-  // copy of the declaration in vector_modn_sparse.pxi
-  int *entries;
-  int p;
-  size_t *positions;
-  size_t degree;
-  size_t num_nonzero;
+	// copy of the declaration in vector_modn_sparse.pxi
+	int *entries;
+	int p;
+	size_t *positions;
+	size_t degree;
+	size_t num_nonzero;
 };
 
+typedef unsigned int mod_int;
 typedef Modular<unsigned int> GFp;
 typedef GFp::Element  Element;
-typedef std::vector <pair <size_t, Element> > SparseSeqVectorGFp;
+typedef std::vector <std::pair <size_t, Element> > SparseSeqVectorGFp;
 typedef SparseMatrix<GFp, SparseSeqVectorGFp> SparseMatrixGFp;
 
-static SparseMatrixGFp linbox_new_modn_sparse_matrix(mod_int modulus, size_t numrows, size_t numcols, void *rows) {
-  GFp F(modulus);
-  SparseMatrixGFp M(F, numrows, numcols);
-  
-  struct c_vector_modint_linbox *A = static_cast<struct c_vector_modint_linbox *>(rows);
-  
-  for(int i = 0; i < numrows; i++) {
-    for(int j = 0; j < A[i].num_nonzero; j++) {
-      M.setEntry(i, A[i].positions[j], A[i].entries[j]);
-    } 
-  }
-  return M;
+static SparseMatrixGFp linbox_new_modn_sparse_matrix(mod_int modulus, size_t numrows, size_t numcols, void *rows)
+{
+	GFp F(modulus);
+	SparseMatrixGFp M(F, numrows, numcols);
+
+	struct c_vector_modint_linbox *A = static_cast<struct c_vector_modint_linbox *>(rows);
+
+	for(size_t i = 0; i < numrows; i++) {
+		for(size_t j = 0; j < A[i].num_nonzero; j++) {
+			M.setEntry(i, A[i].positions[j], A[i].entries[j]);
+		}
+	}
+	return M;
 }
 
-static vector<Element> linbox_new_modn_sparse_vector(mod_int modulus, size_t len, void *_vec) {
-  GFp F(modulus);
+static std::vector<Element> linbox_new_modn_sparse_vector(mod_int modulus, size_t len, void *_vec)
+{
+	GFp F(modulus);
+
+	std::vector<GFp::Element> A(len);
 
-  vector<GFp::Element> A(len);
-  
-  if (_vec==NULL) {
-    return A;
-  }
+	if (_vec==NULL) {
+		return A;
+	}
 
-  struct c_vector_modint_linbox *vec = static_cast<struct c_vector_modint_linbox*>(_vec);
-  for(int i = 0; i < vec->num_nonzero; i++) {
-    A[vec->positions[i]] = vec->entries[i];
-  }
-  return A;
+	struct c_vector_modint_linbox *vec = static_cast<struct c_vector_modint_linbox*>(_vec);
+	for(size_t i = 0; i < vec->num_nonzero; i++) {
+		A[vec->positions[i]] = vec->entries[i];
+	}
+	return A;
 }
 
+unsigned long linbox_modn_sparse_matrix_rank(mod_int modulus,
+					     size_t numrows, size_t numcols,
+					     void *rows, int gauss)
+{
+	GFp F(modulus);
+	unsigned long M_rank;
+	Element M_det;
+	GaussDomain<GFp> dom(F);
 
-unsigned long linbox_modn_sparse_matrix_rank(mod_int modulus, size_t numrows, size_t numcols,  void *rows, int gauss) {
-  GFp F(modulus);
-  unsigned long M_rank;
-  Element M_det;
-  GaussDomain<GFp> dom(F);
-
-  SparseMatrixGFp M( linbox_new_modn_sparse_matrix(modulus, numrows, numcols, rows) );
+	SparseMatrixGFp M( linbox_new_modn_sparse_matrix(modulus, numrows, numcols, rows) );
 
-  if(!gauss) {
-    dom.InPlaceLinearPivoting(M_rank, M_det, M, numrows, numcols);
-  } else {
-    dom.NoReordering(M_rank, M_det, M, numrows, numcols);
-  }
+	if(!gauss) {
+		dom.InPlaceLinearPivoting(M_rank, M_det, M, numrows, numcols);
+	}
+	else {
+		dom.NoReordering(M_rank, M_det, M, numrows, numcols);
+	}
 
-  //*pivots = (int*)calloc(sizeof(int), dom.pivots.size());
+	//*pivots = (int*)calloc(sizeof(int), dom.pivots.size());
 
-//   int j=0;
-//   for(vector<int>::const_iterator i= dom.pivots.begin(); i!= dom.pivots.end(); i++, j++){
-//     (*pivots)[j] = *i;
-//   }
+	//   int j=0;
+	//   for(std::vector<int>::const_iterator i= dom.pivots.begin(); i!= dom.pivots.end(); i++, j++){
+	//     (*pivots)[j] = *i;
+	//   }
 
-  return M_rank;
+	return M_rank;
 }
 
+std::vector<mod_int> linbox_modn_sparse_matrix_solve(mod_int p, size_t numrows, size_t numcols,
+						     void *_a, void *b, int method)
+{
+	// solve ax = b, for x, a matrix, b vector, x vector
+	GFp F(p);
 
-vector<unsigned int> linbox_modn_sparse_matrix_solve(mod_int p, size_t numrows, size_t numcols, void *_a, void *b, int method) {
-  // solve ax = b, for x, a matrix, b vector, x vector
-  GFp F(p);
-
-  vector<Element> X( numrows);
-  vector<Element> B( linbox_new_modn_sparse_vector(p, numcols, b));
+	std::vector<mod_int> X( numrows);
+	std::vector<mod_int> B( linbox_new_modn_sparse_vector(p, numcols, b));
 
-  SparseMatrixGFp A(linbox_new_modn_sparse_matrix(p, numrows, numcols, _a));
+	SparseMatrixGFp A(linbox_new_modn_sparse_matrix(p, numrows, numcols, _a));
 
-  switch(method) {
-  case 1:
-    solve(X, A, B, Method::BlasElimination());
-    break;
+	switch(method) {
+	case 1:
+		solve(X, A, B, Method::BlasElimination());
+		break;
 
-  case 2:
-    solve(X, A, B, Method::Blackbox());
-    break;
+	case 2:
+		solve(X, A, B, Method::Blackbox());
+		break;
 
-  case 3:
-    solve(X, A, B, Method::Wiedemann());
-    break;
+	case 3:
+		solve(X, A, B, Method::Wiedemann());
+		break;
 
-  default:
-    solve(X, A, B);
-  }
-  return X;
+	default:
+		solve(X, A, B);
+	}
+	return X;
 }
diff --git a/interfaces/sage/linbox-sage.h b/interfaces/sage/linbox-sage.h
index fb05d94..04eef53 100644
--- a/interfaces/sage/linbox-sage.h
+++ b/interfaces/sage/linbox-sage.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* linbox-sage.h
  * Copyright (C) 2007 Martin Albrecht
  *               2008 Clement Pernet
@@ -22,109 +23,120 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_SAGE_H
-#define __LINBOX_SAGE_H
-#ifdef __cplusplus
-#define EXTERN extern "C"
-#else 
-#define EXTERN
-#endif
+#ifndef __LINBOX_sage_H
+#define __LINBOX_sagE_H
 
 #include<stddef.h>
-typedef size_t mod_int; 
 
 #include <cstdlib>
 #include <vector>
 
+#ifdef __cplusplus
+#define EXTERN extern "C"
+#else
+#define EXTERN
+#endif
+
 /*****************************************************************
 
   Dense over Z/nZ.
- 
+
 *****************************************************************/
 
-EXTERN int linbox_modn_dense_echelonize(mod_int modulus,  
-					mod_int** matrix, size_t nrows, size_t ncols);
+// Element could be either double or float
+
+EXTERN void linbox_modn_dense_delete_array_double (double *f);
+EXTERN void linbox_modn_dense_delete_array_float (float *f);
+
+
+EXTERN unsigned long int linbox_modn_dense_echelonize_double (double modulus, double*matrix, size_t nrows, size_t ncols);
+EXTERN unsigned long int linbox_modn_dense_echelonize_float (float modulus, float * matrix,size_t nrows, size_t ncols);
+
+EXTERN unsigned long int linbox_modn_dense_rank_double (double modulus, double* matrix, size_t nrows, size_t ncols);
+EXTERN unsigned long int linbox_modn_dense_rank_float (float modulus, float* matrix, size_t nrows, size_t ncols);
 
+template<class Element>
+Element linbox_modn_dense_det(Element modulus,Element*matrix,size_t nrows,size_t ncols);
+EXTERN double linbox_modn_dense_det_double (double modulus, double* matrix, size_t nrows, size_t ncols);
+EXTERN float linbox_modn_dense_det_float (float modulus, float* matrix, size_t nrows, size_t ncols);
 
-EXTERN void linbox_modn_dense_minpoly(mod_int modulus, mod_int **mp, size_t* degree, 
-				      size_t n, mod_int **matrix, int do_minpoly);
 
-EXTERN void linbox_modn_dense_delete_array(mod_int *f);
+template<class Element>
+Element * linbox_modn_dense_minpoly (Element modulus, Element ** mp, size_t* degree, size_t n, Element *matrix);
+EXTERN double* linbox_modn_dense_minpoly_double (double modulus, double ** mp, size_t* degree, size_t n, double*matrix);
+EXTERN float* linbox_modn_dense_minpoly_float (float modulus, float ** mp, size_t* degree, size_t n, float *matrix);
 
-EXTERN void linbox_modn_dense_delete_dbl_array(double *f);
 
-EXTERN int linbox_modn_dense_matrix_matrix_multiply(mod_int modulus, mod_int **ans,
-						    mod_int **A, mod_int **B,
-						    size_t A_nr, size_t A_nc, size_t B_nr, size_t B_nc); 
+template <class Element>
+Element* linbox_modn_dense_charpoly (Element modulus, Element *& cp, size_t n, Element * matrix);
+EXTERN double* linbox_modn_dense_charpoly_double (double modulus, double ** cp, size_t n, double * matrix);
+EXTERN float* linbox_modn_dense_charpoly_float (float modulus, float ** cp, size_t n, float * matrix);
 
-EXTERN int linbox_modn_dense_rank(mod_int modulus,  
-				  mod_int** matrix, size_t nrows, size_t ncols);
 
-EXTERN mod_int linbox_modn_dense_det(mod_int modulus,  
-				     mod_int** matrix, size_t nrows, size_t ncols);
+template <class Element>
+Element*linbox_modn_dense_matrix_matrix_multiply(Element modulus, Element * ans, Element *A, Element *B, size_t m,size_t n,size_t k);
+EXTERN double* linbox_modn_dense_matrix_matrix_multiply_double(double modulus, double * ans, double *A, double *B, size_t m,size_t n,size_t k);
+EXTERN float* linbox_modn_dense_matrix_matrix_multiply_float(float modulus, float * ans, float *A, float *B, size_t m,size_t n,size_t k);
+
+template<class Element>
+Element * linbox_modn_dense_matrix_matrix_general_multiply (Element modulus, Element * ans,Element alpha, Element beta,Element *A, Element *B,size_t m, size_t n, size_t k);
+EXTERN double* linbox_modn_dense_matrix_matrix_general_multiply_double (double modulus, double * ans, double alpha, double beta, double *A, double *B, size_t m, size_t n, size_t k);
+EXTERN float* linbox_modn_dense_matrix_matrix_general_multiply_float (float modulus, float * ans, float alpha, float beta, float *A, float *B, size_t m, size_t n, size_t k);
+
+
+
+template <class Element>
+unsigned long linbox_modn_dense_col_rankprofile_submatrix (Element modulus,Element* matrix, Element*out, size_t& rank, size_t nrows, size_t ncols);
+EXTERN unsigned long linbox_modn_dense_col_rankprofile_submatrix_double (double modulus, double* matrix, double* out, size_t* rank, size_t nrows, size_t ncols);
+EXTERN unsigned long linbox_modn_dense_col_rankprofile_submatrix_float (float modulus, float* matrix, float* out, size_t* rank, size_t nrows, size_t ncols);
+
+
+template <class Element>
+unsigned long linbox_modn_dense_col_rankprofile_submatrix_indices(Element modulus,Element* matrix,size_t** row_idx, size_t** col_idx, size_t* rank, size_t nrows,size_t ncols);
+EXTERN unsigned long linbox_modn_dense_col_rankprofile_submatrix_indices_double (double modulus, double* matrix, size_t ** row_idx, size_t ** col_idx, size_t * rank, size_t nrows, size_t ncols);
+EXTERN unsigned long linbox_modn_dense_col_rankprofile_submatrix_indices_float (float modulus, float* matrix, size_t ** row_idx, size_t ** col_idx, size_t * rank, size_t nrows,size_t ncols);
 
-EXTERN int linbox_modn_dense_col_rankprofile_submatrix (mod_int modulus,
-							mod_int** matrix,
-							double ** outmatrix,
-							size_t* rank,
-							size_t nrows, size_t ncols);
-EXTERN int linbox_modn_dense_col_rankprofile_submatrix_indices (mod_int modulus,
-								mod_int** matrix,
-								size_t ** row_idx,
-								size_t ** col_idx,
-								size_t * rank,
-								size_t nrows,
-								size_t ncols);
 /*****************************************************************
 
   Dense over ZZ
- 
+
 *****************************************************************/
- 
+
 /* linbox_minpoly allocates space for minpoly, so you have to call linbox_delete_array
    to free it up afterwards. */
-EXTERN void linbox_integer_dense_minpoly_hacked(mpz_t** minpoly, size_t* degree, 
-                  size_t n, mpz_t** matrix, int do_minpoly);
-EXTERN void linbox_integer_dense_minpoly(mpz_t** minpoly, size_t* degree, 
-                  size_t n, mpz_t** matrix);
-EXTERN void linbox_integer_dense_charpoly(mpz_t** charpoly, size_t* degree, 
-                  size_t n, mpz_t** matrix);
-EXTERN void linbox_integer_dense_delete_array(mpz_t* f);
+
+void linbox_integer_dense_minpoly (mpz_t*& minpoly, size_t& degree, size_t n, mpz_t* matrix);
+
+void linbox_integer_dense_charpoly (mpz_t*& minpoly, size_t& degree, size_t n, mpz_t* matrix);
+
+void linbox_integer_dense_delete_array (mpz_t* f);
 
 /* ans must be a pre-allocated and pre-initialized array of GMP ints. */
-EXTERN int linbox_integer_dense_matrix_matrix_multiply(mpz_t** ans, mpz_t **A, mpz_t **B,
-			      size_t A_nr, size_t A_nc, size_t B_nr, size_t B_nc);
+int linbox_integer_dense_matrix_matrix_multiply (mpz_t* ans, mpz_t *A, mpz_t *B, size_t m, size_t n, size_t k);
+
+unsigned long linbox_integer_dense_rank(mpz_t* matrix, size_t nrows, size_t ncols);
 
-EXTERN unsigned long linbox_integer_dense_rank(mpz_t** matrix, size_t nrows,
-					       size_t ncols);
+void linbox_integer_dense_det(mpz_t ans, mpz_t* matrix, size_t nrows, size_t ncols);
 
-EXTERN  void linbox_integer_dense_det(mpz_t ans, mpz_t** matrix, size_t nrows,
-				      size_t ncols);
+void linbox_integer_dense_smithform(mpz_t *&v, mpz_t *matrix, size_t nrows, size_t ncols);
 
-EXTERN void linbox_integer_dense_smithform(mpz_t **v, 
-					   mpz_t **matrix, 
-					   size_t nrows, size_t ncols);
+void linbox_integer_dense_double_det (mpz_t ans1, mpz_t ans2, mpz_t **a, mpz_t ** b, mpz_t **c, size_t n, int proof);
 
-EXTERN void linbox_integer_dense_double_det (mpz_t ans1, mpz_t ans2, mpz_t **a,
-					     mpz_t ** b, mpz_t **c, size_t n, int proof);
 /*****************************************************************
 
   Sparse over Z/nZ
- 
+
 *****************************************************************/
 
 
-EXTERN unsigned long linbox_modn_sparse_matrix_rank(mod_int modulus, 
-						    size_t numrows, 
-						    size_t numcols, 
-						    void *rows,
-						    int reorder);
+unsigned long linbox_modn_sparse_matrix_rank(unsigned int modulus,
+					     size_t numrows,
+					     size_t numcols,
+					     void *rows,
+					     int reorder);
 
-EXTERN std::vector<unsigned int> linbox_modn_sparse_matrix_solve(mod_int modulus, 
-								 size_t numrows, 
-								 size_t numcols,  
-								 void *a, 
-								 void *b,
-								 int method);
+std::vector<unsigned int> linbox_modn_sparse_matrix_solve (unsigned int modulus, size_t numrows,
+						     size_t numcols, void *a, void *b,
+						     int method);
 
 #endif // __LINBOX_SAGE_H
diff --git a/linbox-config.in b/linbox-config.in
index d5cdcd2..e962137 100644
--- a/linbox-config.in
+++ b/linbox-config.in
@@ -1,5 +1,9 @@
 #! /bin/sh
 
+# Copyright (c) the LinBox group
+# This file is part of LinBox (and probably stolen here and there)
+# see COPYING for licence
+
 prefix=@prefix@
 exec_prefix=@exec_prefix@
 includedir=@includedir@
@@ -55,12 +59,12 @@ while test $# -gt 0; do
 	;;
 
     --cflags)
-       	echo -I${includedir} @GMP_CFLAGS@ @NTL_CFLAGS@ @GIVARO_CFLAGS@ @SACLIB_CFLAGS@ @LIDIA_CFLAGS@ 
-       	;;
+       	echo -n " -I${includedir} @GMP_CFLAGS@ @NTL_CFLAGS@ @GIVARO_CFLAGS@ @SACLIB_CFLAGS@ @LIDIA_CFLAGS@"
+	;;
 
     --libs)
-       	echo -L${libdir} -llinbox @LIDIA_LIBS@  @NTL_LIBS@ @GIVARO_LIBS@ @SACLIB_LIBS@ @GMP_LIBS@ @BLAS_LIBS@
-       	;;
+	echo -n " -L${libdir} -llinbox @LIDIA_LIBS@  @NTL_LIBS@ @GIVARO_LIBS@ @SACLIB_LIBS@ @GMP_LIBS@ @BLAS_LIBS@"
+	;;
 
     *)
 	usage
@@ -69,5 +73,6 @@ while test $# -gt 0; do
     esac
     shift
 done
+echo
 
 exit 0
diff --git a/linbox/Makefile.am b/linbox/Makefile.am
index 4777e9c..aeed4e5 100644
--- a/linbox/Makefile.am
+++ b/linbox/Makefile.am
@@ -1,10 +1,13 @@
-INCLUDES=-I$(top_srcdir)
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+AM_CPPFLAGS=-I$(top_srcdir)
 
-SUBDIRS=util element field randiter vector matrix blackbox switch algorithms solutions fflas ffpack ring
+SUBDIRS=util element field randiter vector matrix blackbox switch algorithms solutions ring
 
-BASIC_HDRS =				\
-	integer.h	integer.inl	\
-	config-blas.h	linbox-config.h
+BASIC_HDRS =    \
+    integer.h   \
+    config-blas.h   linbox-config.h
 
 NTL_HDRS =
 
@@ -24,23 +27,24 @@ if LINBOX_HAVE_LIDIA
 USE_LIDIA_HDRS = $(LIDIA_HDRS)
 endif
 
-pkginclude_HEADERS =			\
-	$(BASIC_HDRS)			\
-	$(USE_NTL_HDRS)			\
-	$(USE_GIVARO_HDRS)		\
-	$(USE_LIDIA_HDRS)
+pkginclude_HEADERS =        \
+    $(BASIC_HDRS)           \
+    $(USE_NTL_HDRS)         \
+    $(USE_GIVARO_HDRS)      \
+    $(USE_LIDIA_HDRS)
 
-EXTRA_DIST =				\
-	$(NTL_HDRS)			\
-	$(GIVARO_HDRS)			\
-	$(LIDIA_HDRS)			\
-	linbox.doxy			\
-	archetypes.doxy
+EXTRA_DIST =            \
+    $(NTL_HDRS)         \
+    $(GIVARO_HDRS)      \
+    $(LIDIA_HDRS)       \
+    linbox.doxy         \
+    archetypes.doxy
 
 lib_LTLIBRARIES=liblinbox.la
 
 liblinbox_la_SOURCES = dummy.C
 
-liblinbox_la_LIBADD = \
-	util/libutil.la		\
-	randiter/libranditer.la
+liblinbox_la_LIBADD =           \
+    util/libutil.la             \
+    randiter/libranditer.la     \
+    algorithms/libalgorithms.la
diff --git a/linbox/Makefile.in b/linbox/Makefile.in
index d5b927c..23eff1d 100644
--- a/linbox/Makefile.in
+++ b/linbox/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -38,19 +39,26 @@ DIST_COMMON = $(pkginclude_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
-	$(top_srcdir)/macros/blas-check.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
 	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
 	$(top_srcdir)/macros/givaro-check.m4 \
 	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
 	$(top_srcdir)/macros/lidia-check.m4 \
 	$(top_srcdir)/macros/linbox-doc.m4 \
 	$(top_srcdir)/macros/linbox-misc.m4 \
 	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
 	$(top_srcdir)/macros/maple-check.m4 \
 	$(top_srcdir)/macros/ntl-check.m4 \
 	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -65,7 +73,8 @@ am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
 am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(pkgincludedir)"
 libLTLIBRARIES_INSTALL = $(INSTALL)
 LTLIBRARIES = $(lib_LTLIBRARIES)
-liblinbox_la_DEPENDENCIES = util/libutil.la randiter/libranditer.la
+liblinbox_la_DEPENDENCIES = util/libutil.la randiter/libranditer.la \
+	algorithms/libalgorithms.la
 am_liblinbox_la_OBJECTS = dummy.lo
 liblinbox_la_OBJECTS = $(am_liblinbox_la_OBJECTS)
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
@@ -105,18 +114,21 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
 CC = @CC@
+CCNAM = @CCNAM@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
 DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -124,19 +136,24 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
 GIVARO_CFLAGS = @GIVARO_CFLAGS@
 GIVARO_LIBS = @GIVARO_LIBS@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
 GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
@@ -144,41 +161,52 @@ LIBTOOL = @LIBTOOL@
 LIDIA_CFLAGS = @LIDIA_CFLAGS@
 LIDIA_LIBS = @LIDIA_LIBS@
 LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MAPLE_CFLAGS = @MAPLE_CFLAGS@
 MAPLE_HOME = @MAPLE_HOME@
 MAPLE_LIBS = @MAPLE_LIBS@
 MAPLE_VERSION = @MAPLE_VERSION@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
 NTL_CFLAGS = @NTL_CFLAGS@
 NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RM = @RM@
 SACLIB_CFLAGS = @SACLIB_CFLAGS@
 SACLIB_LIBS = @SACLIB_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+TESTS_CFLAGS = @TESTS_CFLAGS@
 VERSION = @VERSION@
+WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -219,13 +247,18 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-INCLUDES = -I$(top_srcdir)
-SUBDIRS = util element field randiter vector matrix blackbox switch algorithms solutions fflas ffpack ring
+
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+AM_CPPFLAGS = -I$(top_srcdir)
+SUBDIRS = util element field randiter vector matrix blackbox switch algorithms solutions ring
 BASIC_HDRS = \
-	integer.h	integer.inl	\
-	config-blas.h	linbox-config.h
+    integer.h   \
+    config-blas.h   linbox-config.h
 
 NTL_HDRS = 
 GIVARO_HDRS = 
@@ -234,23 +267,24 @@ LIDIA_HDRS =
 @LINBOX_HAVE_GIVARO_TRUE at USE_GIVARO_HDRS = $(GIVARO_HDRS)
 @LINBOX_HAVE_LIDIA_TRUE at USE_LIDIA_HDRS = $(LIDIA_HDRS)
 pkginclude_HEADERS = \
-	$(BASIC_HDRS)			\
-	$(USE_NTL_HDRS)			\
-	$(USE_GIVARO_HDRS)		\
-	$(USE_LIDIA_HDRS)
+    $(BASIC_HDRS)           \
+    $(USE_NTL_HDRS)         \
+    $(USE_GIVARO_HDRS)      \
+    $(USE_LIDIA_HDRS)
 
 EXTRA_DIST = \
-	$(NTL_HDRS)			\
-	$(GIVARO_HDRS)			\
-	$(LIDIA_HDRS)			\
-	linbox.doxy			\
-	archetypes.doxy
+    $(NTL_HDRS)         \
+    $(GIVARO_HDRS)      \
+    $(LIDIA_HDRS)       \
+    linbox.doxy         \
+    archetypes.doxy
 
 lib_LTLIBRARIES = liblinbox.la
 liblinbox_la_SOURCES = dummy.C
 liblinbox_la_LIBADD = \
-	util/libutil.la		\
-	randiter/libranditer.la
+    util/libutil.la             \
+    randiter/libranditer.la     \
+    algorithms/libalgorithms.la
 
 all: all-recursive
 
@@ -260,8 +294,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
 	      exit 1;; \
 	  esac; \
 	done; \
@@ -360,7 +394,7 @@ uninstall-pkgincludeHEADERS:
 #     (which will cause the Makefiles to be regenerated when you run `make');
 # (2) otherwise, pass the desired values on the `make' command line.
 $(RECURSIVE_TARGETS):
-	@failcom='exit 1'; \
+	@fail= failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
 	    *=* | --[!k]*);; \
@@ -385,7 +419,7 @@ $(RECURSIVE_TARGETS):
 	fi; test -z "$$fail"
 
 $(RECURSIVE_CLEAN_TARGETS):
-	@failcom='exit 1'; \
+	@fail= failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
 	    *=* | --[!k]*);; \
@@ -428,7 +462,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
@@ -574,6 +608,8 @@ dvi-am:
 
 html: html-recursive
 
+html-am:
+
 info: info-recursive
 
 info-am:
@@ -582,18 +618,28 @@ install-data-am: install-pkgincludeHEADERS
 
 install-dvi: install-dvi-recursive
 
+install-dvi-am:
+
 install-exec-am: install-libLTLIBRARIES
 
 install-html: install-html-recursive
 
+install-html-am:
+
 install-info: install-info-recursive
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-recursive
 
+install-pdf-am:
+
 install-ps: install-ps-recursive
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-recursive
diff --git a/linbox/algorithms/Makefile.am b/linbox/algorithms/Makefile.am
index 83517dc..310472e 100644
--- a/linbox/algorithms/Makefile.am
+++ b/linbox/algorithms/Makefile.am
@@ -1,70 +1,126 @@
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 pkgincludesubdir=$(pkgincludedir)/algorithms
 
-pkgincludesub_HEADERS = \
-	blackbox-container.h			\
-	blackbox-container-symmetric.h		\
-	blackbox-container-symmetrize.h		\
-	blackbox-container-base.h		\
-	bbsolve.h				\
-	double-det.h				\
-	massey-domain.h				\
-	wiedemann.h	wiedemann.inl		\
-	lanczos.h	lanczos.inl		\
-	block-lanczos.h	block-lanczos.inl	\
-	mg-block-lanczos.h mg-block-lanczos.inl	\
-	la-block-lanczos.h la-block-lanczos.inl	\
-	eliminator.h	eliminator.inl		\
-	gauss.h					\
-	gauss.inl				\
-	dense-container.h			\
-	cra-mpi.h				\
-	cra-kaapi.h				\
-	cra-domain.h				\
-	cra-early-multip.h			\
-	cra-early-single.h			\
-	cra-full-multip.h			\
-	lazy-product.h				\
-	rational-cra.h				\
-	rational-cra-early-multip.h		\
-	rational-cra-early-single.h		\
-	rational-cra-full-multip.h		\
-	blas-domain.h				\
-	blas-domain.inl				\
-	bitonic-sort.h				\
-	blackbox-block-container-base.h		\
-	blackbox-block-container.h		\
-	block-massey-domain.h			\
-	block-wiedemann.h			\
-	default.h				\
-	signature.h				\
-	smith-form-iliopoulos.h		\
-	one-invariant-factor.h			\
-	last-invariant-factor.h			\
-	hybrid-det.h				\
-	lifting-container.h			\
-	smith-form-local.h				\
-	smith-form-local2.h				\
-	matrix-inverse.h			\
-	matrix-hom.h				\
-	matrix-rank.h				\
-	rational-reconstruction.h		\
-	rational-solver.h			\
-	rational-solver.inl			\
-	diophantine-solver.h			\
-	diophantine-solver.inl			\
-	smith-form-binary.h				\
-	smith-form-adaptive.h			\
-	smith-form-adaptive.inl			\
-	smith-form-sparseelim-local.h		\
-	rational-reconstruction2.h		\
-	rational-solver-adaptive.h		\
-	vector-fraction.h	\
-	cia.h			\
-	bbcharpoly.h		\
-	minpoly-integer.h	\
-	sigma-basis.h		\
-	matpoly-mult.h		\
-	echelon-form.h		\
-	toeplitz-det.h
+noinst_LTLIBRARIES=libalgorithms.la
+
+libalgorithms_la_SOURCES= diophantine-solver.C
+
+#  AM_CPPFLAGS= $(CBLAS_FLAG) $(GMP_CFLAGS) $(NTL_CFLAGS) $(GIVARO_CFLAGS) $(LIDIA_CFLAGS)
+
+AM_CXXFLAGS = @DEFAULT_CFLAGS@ -DDISABLE_COMMENTATOR $(CBLAS_FLAG) $(FFLAFLAS_CFLAGS) $(GMP_CFLAGS) $(NTL_CFLAGS) $(ATLAS_CFLAGS) $(GIVARO_CFLAGS) $(LIDIA_CFLAGS)
+
+pkgincludesub_HEADERS =         \
+    blackbox-container.h        \
+    blackbox-container-symmetric.h          \
+    blackbox-container-symmetrize.h         \
+    blackbox-container-base.h   \
+    bbsolve.h                   \
+    double-det.h                \
+    det-rational.h              \
+    massey-domain.h             \
+    wiedemann.h wiedemann.inl   \
+    lanczos.h   lanczos.inl     \
+    block-lanczos.h block-lanczos.inl       \
+    mg-block-lanczos.h mg-block-lanczos.inl \
+    la-block-lanczos.h la-block-lanczos.inl \
+    eliminator.h    eliminator.inl          \
+    gauss.h                                 \
+    gauss.inl                   \
+    gauss-det.inl               \
+    gauss-rank.inl              \
+    gauss-solve.inl             \
+    gauss-nullspace.inl         \
+    gauss-elim.inl              \
+    gauss-pivot.inl             \
+    triangular-solve.h          \
+    gauss-gf2.h                 \
+    gauss-gf2.inl               \
+    gauss-elim-gf2.inl          \
+    gauss-rank-gf2.inl          \
+    gauss-pivot-gf2.inl         \
+    gauss-solve-gf2.inl         \
+    triangular-solve-gf2.h      \
+    dense-container.h           \
+    cra-mpi.h                   \
+    cra-kaapi.h                 \
+    cra-domain.h                \
+    cra-domain-seq.h            \
+    cra-domain-omp.h            \
+    cra-early-multip.h          \
+    cra-early-single.h          \
+    cra-full-multip.h           \
+	cra-full-multip-fixed.h     \
+	cra-givrnsfixed.h           \
+    lazy-product.h              \
+    rational-cra.h              \
+    rational-cra2.h             \
+    rational-cra-early-multip.h \
+    rational-cra-early-single.h \
+    rational-cra-full-multip.h  \
+    blas-domain.h               \
+    blas-domain.inl             \
+    bitonic-sort.h              \
+    blackbox-block-container-base.h         \
+    blackbox-block-container.h  \
+    block-massey-domain.h       \
+    block-wiedemann.h           \
+    default.h                   \
+    signature.h                 \
+    smith-form-iliopoulos.h     \
+    one-invariant-factor.h      \
+    last-invariant-factor.h     \
+    hybrid-det.h                \
+    lifting-container.h         \
+    smith-form-local.h          \
+    smith-form-local2.h         \
+    matrix-inverse.h            \
+    matrix-hom.h                \
+    matrix-rank.h               \
+	numeric-solver-lapack.h     \
+	rational-solver-sn.h        \
+	rational-solver-sn.inl      \
+	dyadic-to-rational.h        \
+    rational-reconstruction.h   \
+    rational-reconstruction-base.h          \
+    classic-rational-reconstruction.h       \
+	fast-rational-reconstruction.h          \
+    rational-solver.h           \
+    rational-solver2.h          \
+    rational-solver.inl         \
+    diophantine-solver.h        \
+    diophantine-solver.inl      \
+    smith-form-binary.h         \
+    smith-form-adaptive.h       \
+    smith-form-adaptive.inl     \
+    smith-form-sparseelim-local.h           \
+    rational-reconstruction2.h  \
+    rational-solver-adaptive.h  \
+    varprec-cra-early-single.h  \
+    varprec-cra-early-multip.h  \
+    vector-fraction.h           \
+    whisart_trace.h             \
+    cia.h                       \
+    bbcharpoly.h                \
+    charpoly-rational.h         \
+    minpoly-integer.h           \
+    minpoly-rational.h          \
+    sigma-basis.h               \
+    matpoly-mult.h              \
+    echelon-form.h              \
+    toeplitz-det.h              \
+    dense-nullspace.h dense-nullspace.inl   \
+	linbox-tags.h               \
+	rns.h rns.inl
+
+EXTRA_DIST =                    \
+             algorithms.doxy    \
+             cra.doxy           \
+             wiedemann.doxy     \
+             lanczos.doxy       \
+             sigmabasis.doxy    \
+             elimination.doxy   \
+             diophantine.doxy
+
 
-EXTRA_DIST = algorithms.doxy
diff --git a/linbox/algorithms/Makefile.in b/linbox/algorithms/Makefile.in
index d180319..b608bea 100644
--- a/linbox/algorithms/Makefile.in
+++ b/linbox/algorithms/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -14,6 +15,7 @@
 
 @SET_MAKE@
 
+
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -37,28 +39,49 @@ DIST_COMMON = $(pkgincludesub_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
-	$(top_srcdir)/macros/blas-check.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
 	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
 	$(top_srcdir)/macros/givaro-check.m4 \
 	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
 	$(top_srcdir)/macros/lidia-check.m4 \
 	$(top_srcdir)/macros/linbox-doc.m4 \
 	$(top_srcdir)/macros/linbox-misc.m4 \
 	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
 	$(top_srcdir)/macros/maple-check.m4 \
 	$(top_srcdir)/macros/ntl-check.m4 \
 	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
 CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libalgorithms_la_LIBADD =
+am_libalgorithms_la_OBJECTS = diophantine-solver.lo
+libalgorithms_la_OBJECTS = $(am_libalgorithms_la_OBJECTS)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp =
 am__depfiles_maybe =
-SOURCES =
-DIST_SOURCES =
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(libalgorithms_la_SOURCES)
+DIST_SOURCES = $(libalgorithms_la_SOURCES)
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -79,18 +102,21 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
 CC = @CC@
+CCNAM = @CCNAM@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
 DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -98,19 +124,24 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
 GIVARO_CFLAGS = @GIVARO_CFLAGS@
 GIVARO_LIBS = @GIVARO_LIBS@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
 GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
@@ -118,41 +149,52 @@ LIBTOOL = @LIBTOOL@
 LIDIA_CFLAGS = @LIDIA_CFLAGS@
 LIDIA_LIBS = @LIDIA_LIBS@
 LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MAPLE_CFLAGS = @MAPLE_CFLAGS@
 MAPLE_HOME = @MAPLE_HOME@
 MAPLE_LIBS = @MAPLE_LIBS@
 MAPLE_VERSION = @MAPLE_VERSION@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
 NTL_CFLAGS = @NTL_CFLAGS@
 NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RM = @RM@
 SACLIB_CFLAGS = @SACLIB_CFLAGS@
 SACLIB_LIBS = @SACLIB_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+TESTS_CFLAGS = @TESTS_CFLAGS@
 VERSION = @VERSION@
+WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -193,86 +235,141 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 pkgincludesubdir = $(pkgincludedir)/algorithms
+noinst_LTLIBRARIES = libalgorithms.la
+libalgorithms_la_SOURCES = diophantine-solver.C
+
+#  AM_CPPFLAGS= $(CBLAS_FLAG) $(GMP_CFLAGS) $(NTL_CFLAGS) $(GIVARO_CFLAGS) $(LIDIA_CFLAGS)
+AM_CXXFLAGS = @DEFAULT_CFLAGS@ -DDISABLE_COMMENTATOR $(CBLAS_FLAG) $(FFLAFLAS_CFLAGS) $(GMP_CFLAGS) $(NTL_CFLAGS) $(ATLAS_CFLAGS) $(GIVARO_CFLAGS) $(LIDIA_CFLAGS)
 pkgincludesub_HEADERS = \
-	blackbox-container.h			\
-	blackbox-container-symmetric.h		\
-	blackbox-container-symmetrize.h		\
-	blackbox-container-base.h		\
-	bbsolve.h				\
-	double-det.h				\
-	massey-domain.h				\
-	wiedemann.h	wiedemann.inl		\
-	lanczos.h	lanczos.inl		\
-	block-lanczos.h	block-lanczos.inl	\
-	mg-block-lanczos.h mg-block-lanczos.inl	\
-	la-block-lanczos.h la-block-lanczos.inl	\
-	eliminator.h	eliminator.inl		\
-	gauss.h					\
-	gauss.inl				\
-	dense-container.h			\
-	cra-mpi.h				\
-	cra-kaapi.h				\
-	cra-domain.h				\
-	cra-early-multip.h			\
-	cra-early-single.h			\
-	cra-full-multip.h			\
-	lazy-product.h				\
-	rational-cra.h				\
-	rational-cra-early-multip.h		\
-	rational-cra-early-single.h		\
-	rational-cra-full-multip.h		\
-	blas-domain.h				\
-	blas-domain.inl				\
-	bitonic-sort.h				\
-	blackbox-block-container-base.h		\
-	blackbox-block-container.h		\
-	block-massey-domain.h			\
-	block-wiedemann.h			\
-	default.h				\
-	signature.h				\
-	smith-form-iliopoulos.h		\
-	one-invariant-factor.h			\
-	last-invariant-factor.h			\
-	hybrid-det.h				\
-	lifting-container.h			\
-	smith-form-local.h				\
-	smith-form-local2.h				\
-	matrix-inverse.h			\
-	matrix-hom.h				\
-	matrix-rank.h				\
-	rational-reconstruction.h		\
-	rational-solver.h			\
-	rational-solver.inl			\
-	diophantine-solver.h			\
-	diophantine-solver.inl			\
-	smith-form-binary.h				\
-	smith-form-adaptive.h			\
-	smith-form-adaptive.inl			\
-	smith-form-sparseelim-local.h		\
-	rational-reconstruction2.h		\
-	rational-solver-adaptive.h		\
-	vector-fraction.h	\
-	cia.h			\
-	bbcharpoly.h		\
-	minpoly-integer.h	\
-	sigma-basis.h		\
-	matpoly-mult.h		\
-	echelon-form.h		\
-	toeplitz-det.h
-
-EXTRA_DIST = algorithms.doxy
+    blackbox-container.h        \
+    blackbox-container-symmetric.h          \
+    blackbox-container-symmetrize.h         \
+    blackbox-container-base.h   \
+    bbsolve.h                   \
+    double-det.h                \
+    det-rational.h              \
+    massey-domain.h             \
+    wiedemann.h wiedemann.inl   \
+    lanczos.h   lanczos.inl     \
+    block-lanczos.h block-lanczos.inl       \
+    mg-block-lanczos.h mg-block-lanczos.inl \
+    la-block-lanczos.h la-block-lanczos.inl \
+    eliminator.h    eliminator.inl          \
+    gauss.h                                 \
+    gauss.inl                   \
+    gauss-det.inl               \
+    gauss-rank.inl              \
+    gauss-solve.inl             \
+    gauss-nullspace.inl         \
+    gauss-elim.inl              \
+    gauss-pivot.inl             \
+    triangular-solve.h          \
+    gauss-gf2.h                 \
+    gauss-gf2.inl               \
+    gauss-elim-gf2.inl          \
+    gauss-rank-gf2.inl          \
+    gauss-pivot-gf2.inl         \
+    gauss-solve-gf2.inl         \
+    triangular-solve-gf2.h      \
+    dense-container.h           \
+    cra-mpi.h                   \
+    cra-kaapi.h                 \
+    cra-domain.h                \
+    cra-domain-seq.h            \
+    cra-domain-omp.h            \
+    cra-early-multip.h          \
+    cra-early-single.h          \
+    cra-full-multip.h           \
+	cra-full-multip-fixed.h     \
+	cra-givrnsfixed.h           \
+    lazy-product.h              \
+    rational-cra.h              \
+    rational-cra2.h             \
+    rational-cra-early-multip.h \
+    rational-cra-early-single.h \
+    rational-cra-full-multip.h  \
+    blas-domain.h               \
+    blas-domain.inl             \
+    bitonic-sort.h              \
+    blackbox-block-container-base.h         \
+    blackbox-block-container.h  \
+    block-massey-domain.h       \
+    block-wiedemann.h           \
+    default.h                   \
+    signature.h                 \
+    smith-form-iliopoulos.h     \
+    one-invariant-factor.h      \
+    last-invariant-factor.h     \
+    hybrid-det.h                \
+    lifting-container.h         \
+    smith-form-local.h          \
+    smith-form-local2.h         \
+    matrix-inverse.h            \
+    matrix-hom.h                \
+    matrix-rank.h               \
+	numeric-solver-lapack.h     \
+	rational-solver-sn.h        \
+	rational-solver-sn.inl      \
+	dyadic-to-rational.h        \
+    rational-reconstruction.h   \
+    rational-reconstruction-base.h          \
+    classic-rational-reconstruction.h       \
+	fast-rational-reconstruction.h          \
+    rational-solver.h           \
+    rational-solver2.h          \
+    rational-solver.inl         \
+    diophantine-solver.h        \
+    diophantine-solver.inl      \
+    smith-form-binary.h         \
+    smith-form-adaptive.h       \
+    smith-form-adaptive.inl     \
+    smith-form-sparseelim-local.h           \
+    rational-reconstruction2.h  \
+    rational-solver-adaptive.h  \
+    varprec-cra-early-single.h  \
+    varprec-cra-early-multip.h  \
+    vector-fraction.h           \
+    whisart_trace.h             \
+    cia.h                       \
+    bbcharpoly.h                \
+    charpoly-rational.h         \
+    minpoly-integer.h           \
+    minpoly-rational.h          \
+    sigma-basis.h               \
+    matpoly-mult.h              \
+    echelon-form.h              \
+    toeplitz-det.h              \
+    dense-nullspace.h dense-nullspace.inl   \
+	linbox-tags.h               \
+	rns.h rns.inl
+
+EXTRA_DIST = \
+             algorithms.doxy    \
+             cra.doxy           \
+             wiedemann.doxy     \
+             lanczos.doxy       \
+             sigmabasis.doxy    \
+             elimination.doxy   \
+             diophantine.doxy
+
 all: all-am
 
 .SUFFIXES:
+.SUFFIXES: .C .lo .o .obj
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
 	      exit 1;; \
 	  esac; \
 	done; \
@@ -297,6 +394,32 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
 	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 
+clean-noinstLTLIBRARIES:
+	-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+	@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+	  dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+	  test "$$dir" != "$$p" || dir=.; \
+	  echo "rm -f \"$${dir}/so_locations\""; \
+	  rm -f "$${dir}/so_locations"; \
+	done
+libalgorithms.la: $(libalgorithms_la_OBJECTS) $(libalgorithms_la_DEPENDENCIES) 
+	$(CXXLINK)  $(libalgorithms_la_OBJECTS) $(libalgorithms_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+.C.o:
+	$(CXXCOMPILE) -c -o $@ $<
+
+.C.obj:
+	$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.C.lo:
+	$(LTCXXCOMPILE) -c -o $@ $<
+
 mostlyclean-libtool:
 	-rm -f *.lo
 
@@ -325,7 +448,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
@@ -395,7 +518,7 @@ distdir: $(DISTFILES)
 	done
 check-am: all-am
 check: check-am
-all-am: Makefile $(HEADERS)
+all-am: Makefile $(LTLIBRARIES) $(HEADERS)
 installdirs:
 	for dir in "$(DESTDIR)$(pkgincludesubdir)"; do \
 	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
@@ -426,11 +549,13 @@ maintainer-clean-generic:
 	@echo "it deletes files that may require special tools to rebuild."
 clean: clean-am
 
-clean-am: clean-generic clean-libtool mostlyclean-am
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+	mostlyclean-am
 
 distclean: distclean-am
 	-rm -f Makefile
-distclean-am: clean-am distclean-generic distclean-tags
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
 
 dvi: dvi-am
 
@@ -438,6 +563,8 @@ dvi-am:
 
 html: html-am
 
+html-am:
+
 info: info-am
 
 info-am:
@@ -446,18 +573,28 @@ install-data-am: install-pkgincludesubHEADERS
 
 install-dvi: install-dvi-am
 
+install-dvi-am:
+
 install-exec-am:
 
 install-html: install-html-am
 
+install-html-am:
+
 install-info: install-info-am
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-am
 
+install-pdf-am:
+
 install-ps: install-ps-am
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
@@ -466,7 +603,8 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
 
 mostlyclean: mostlyclean-am
 
-mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
 
 pdf: pdf-am
 
@@ -481,15 +619,16 @@ uninstall-am: uninstall-pkgincludesubHEADERS
 .MAKE: install-am install-strip
 
 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
-	clean-libtool ctags distclean distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-pkgincludesubHEADERS install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
+	clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+	distclean-compile distclean-generic distclean-libtool \
+	distclean-tags distdir dvi dvi-am html html-am info info-am \
+	install install-am install-data install-data-am install-dvi \
+	install-dvi-am install-exec install-exec-am install-html \
+	install-html-am install-info install-info-am install-man \
+	install-pdf install-pdf-am install-pkgincludesubHEADERS \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
 	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
 	tags uninstall uninstall-am uninstall-pkgincludesubHEADERS
 
diff --git a/linbox/algorithms/algorithms.doxy b/linbox/algorithms/algorithms.doxy
index 30cc414..8e8a17a 100644
--- a/linbox/algorithms/algorithms.doxy
+++ b/linbox/algorithms/algorithms.doxy
@@ -1,18 +1,19 @@
-/** \defgroup algorithms linbox/algorithms
+/** \ingroup linbox
+    \defgroup algorithms algorithms
 
-The core linear algebra algorithms of LinBox
+\brief The core linear algebra algorithms of LinBox.
 
 The codes here implement algorithms for linear algebra problems.  The names often
-reflect the authorship of the central algorithm (Lanczos, Wiedemann, ...).  
-In contrast, the "drivers" in the 
-\ref solutions directory are named for the problem solved (rank, det, ...).  
+reflect the authorship of the central algorithm (Lanczos, Wiedemann, ...).
+In contrast, the "drivers" in the
+\ref solutions directory are named for the problem solved (rank, det, ...).
 Those are generally wrappers of
-algorithms from this directory.  Their purpose is to give a simple and direct user interface 
+algorithms from this directory.  Their purpose is to give a simple and direct user interface
 and sometimes to provide a solution strategy which is a hybrid of algorithms from this directory.
 
-%Algorithm classes and functions generally have the field class as a template parameter. 
-Blackbox algorithms may have a BlackboxMatrix parameter or allow a Blackbox class as 
-template parameter.  
+%Algorithm classes and functions generally have the field class as a template parameter.
+Blackbox algorithms may have a BlackboxMatrix parameter or allow a Blackbox class as
+template parameter.
 Elimination codes work over DenseMatrix or SparseMatrix types with varying degrees of
 substitution among the types possible.
 
@@ -79,3 +80,4 @@ substitution among the types possible.
 //@}
 
 
+// vim:syn=doxygen
diff --git a/linbox/algorithms/bbcharpoly.h b/linbox/algorithms/bbcharpoly.h
index cca180d..a7b829e 100644
--- a/linbox/algorithms/bbcharpoly.h
+++ b/linbox/algorithms/bbcharpoly.h
@@ -1,16 +1,23 @@
 /* -*- 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
 /* linbox/algorithms/bbchapoly.h
- * 
+ * Copyright(C) LinBox
+ * Written
  *  by Clement Pernet <clement.pernet at imag.fr>
  *
  * See COPYING for license information.
  */
 
-#ifndef __BBCHARPOLY_H
-#define __BBCHARPOLY_H
+/*! @file algorithms/bbcharpoly.h
+ * @ingroup algorithms
+ * @brief no doc.
+ *
+ */
 
-#define __MAXITER 5
+#ifndef __LINBOX_bbcharpoly_H
+#define __LINBOX_bbcharpoly_H
+
+#define _LB_MAXITER 5
 #include <vector>
 #include <map>
 
@@ -26,455 +33,486 @@
 #include "linbox/algorithms/matrix-hom.h"
 #include "linbox/blackbox/polynomial.h"
 
-namespace LinBox 
-{	
-	template<class FieldPoly, class IntPoly=FieldPoly>
-	class FactorMult ;
-
-	template < class Blackbox, class Polynomial, class Categorytag >
-	Polynomial&
-	blackboxcharpoly (Polynomial & P, 
-			  const Blackbox                   & A,
-			  const Categorytag                & tag,
-			  const Method::Blackbox           & M);
-	
-	/* Algorithm computing the integer characteristic polynomial
-	 * of a blackbox.
-	 */
-	template < class Blackbox >
-	GivPolynomial<typename Blackbox::Field::Element>&
-	blackboxcharpoly (GivPolynomial<typename Blackbox::Field::Element> & P, 
-			  const Blackbox                   & A,
-			  const RingCategories::IntegerTag & tag,
-			  const Method::Blackbox           & M)
-	{
-		commentator.start ("Integer Blackbox Charpoly ", "IbbCharpoly");
-
- 		typename Blackbox::Field intRing = A.field();
- 		typedef Modular<uint32> Field;
- 		typedef typename Blackbox::template rebind<Field>::other FieldBlackbox;
- 		typedef GivPolynomialRing<typename Blackbox::Field, Dense> IntPolyDom;
- 		typedef GivPolynomial<typename Blackbox::Field::Element> IntPoly;
- 		typedef GivPolynomial<typename Field::Element> FieldPoly;
- 		// Set of factors-multiplicities sorted by degree
- 		typedef FactorMult<FieldPoly,IntPoly> FM;
- 		typedef multimap<unsigned long,FM*> FactPoly;
-		typedef typename FactPoly::iterator FactPolyIterator;
-		multimap<FM*,bool> leadingBlocks;
-		//typename multimap<FM*,bool>::iterator lead_it; 
- 		FactPoly factCharPoly;
- 		size_t n = A.coldim();
-
- 		IntPolyDom IPD(intRing);
-		
- 		/* Computation of the integer minimal polynomial */
- 		IntPoly intMinPoly;
-		minpoly (intMinPoly, A, M);
-		if (intMinPoly.size() == n+1){
-			commentator.stop ("done", NULL, "IbbCharpoly");
- 			return P = intMinPoly;
-		}
- 		/* Factorization over the integers */
- 		vector<IntPoly*> intFactors;    
- 		vector<unsigned long> exp;
- 		IPD.factor (intFactors, exp, intMinPoly);
-		size_t factnum = intFactors.size();
-
- 		/* Choose a modular prime field */
- 		RandomPrimeIterator primeg (28);
-		++primeg;
- 		Field F(*primeg);
-
-		/* Building the structure of factors */
-		int goal = n;
-
-		for (size_t i = 0; i < intFactors.size(); ++i) {
-			unsigned long deg =  (intFactors[i]->size()-1);
-			FactorMult<FieldPoly,IntPoly>* FFM=NULL;
-			if (exp[i] > 1) {
-				IntPoly *tmp = new IntPoly(*intFactors[i]);
-				FM* depend = NULL;
-				for (size_t j = 1; j <= exp[i]; ++j){
-					IntPoly * tmp2 = new IntPoly(*tmp);
-					FieldPoly * tmp2p;
-					typename IntPoly::template rebind<Field>() (tmp2p, *tmp2, F);
-
-					FFM = new FM (tmp2p, tmp2, 0, depend);
-					factCharPoly.insert (pair<size_t, FM*> (deg, FFM));
-					factnum++;
-					depend = FFM;
-					deg += intFactors[i]->size()-1;
-					if (j < exp[i])
-						IPD.mul (*tmp, *tmp2, *intFactors[i]);
+namespace LinBox
+{
+	class BBcharpoly {
+		template<class FieldPoly, class IntPoly=FieldPoly>
+		class FactorMult ;
+
+		/*! @brief No doc
+		*/
+		template<class FieldPoly, class IntPoly>
+		class FactorMult {
+		public:
+			FactorMult() :
+				multiplicity(0),dep(NULL)
+			{}
+			FactorMult( FieldPoly* FP, IntPoly* IP, unsigned long m, FactorMult<FieldPoly,IntPoly>*d) :
+				fieldP(FP), intP(IP), multiplicity(m), dep(d)
+			{}
+
+			FactorMult (const FactorMult<FieldPoly>& FM) :
+				fieldP(FM.fieldP), intP(FM.intP), multiplicity(FM.multiplicity), dep(FM.dep)
+			{}
+
+			int update (const size_t n, int * goal)
+			{
+				if (dep->dep != NULL){
+					FactorMult<FieldPoly,IntPoly>*curr = dep;
+					int k = dep->update (n,goal)+1;
+					int d = (dep->fieldP->size()-1)/k;
+					int tmp = (n-dep->multiplicity) / d;
+					int i = k-1;
+					while (curr->dep!=NULL){
+						curr = curr->dep;
+						tmp-=i*curr->multiplicity;
+						--i;
+					}
+					tmp = tmp/k + (multiplicity - dep->multiplicity) / d;
+					dep->multiplicity = tmp ;
+					//std::cerr<<"Updating "<<*dep->fieldP<<" --> mul = "<<tmp<<std::endl;
+
+					*goal -= tmp * (dep->fieldP->size()-1);
+					return k;
 				}
-				delete tmp;
-				factnum--;
-				FFM->multiplicity = 1; // The last factor is present in minpoly
-				goal -= deg-intFactors[i]->size()+1;
-				leadingBlocks.insert (pair<FM*,bool>(FFM,false));
-			} else {
-				FieldPoly * fp;
-				typename IntPoly::template rebind<Field>() (fp, *intFactors[i], F);
-				FFM = new FM (fp,intFactors[i],1,NULL);
-				factCharPoly.insert (pair<size_t, FM* > (intFactors[i]->size()-1, FFM));
-				leadingBlocks.insert (pair<FM*,bool>(FFM,false));
-				goal -= deg;
-			}
-		}
-		 
- 		FieldBlackbox * Ap;
- 		MatrixHom::map(Ap, A, F);
-		
-		findMultiplicities (*Ap, factCharPoly, leadingBlocks, goal, M);
-
- 		// Building the integer charpoly
-		IntPoly intCharPoly (n+1);
-		IntPoly tmpP;
-		intRing.init (intCharPoly[0], 1);
-		for (FactPolyIterator it_f = factCharPoly.begin(); it_f != factCharPoly.end(); it_f++){
-			IPD.pow (tmpP, *it_f->second->intP, it_f->second->multiplicity);
-			IPD.mulin (intCharPoly, tmpP);
-			delete it_f->second->intP;
-			delete it_f->second->fieldP;
-			delete it_f->second;
-		}
-		commentator.stop ("done", NULL, "IbbCharpoly");
-
-		return P = intCharPoly;
-	}
-	/* Algorithm computing the  characteristic polynomial
-	 * of a blackbox over a prime field.
-	 */
-	template < class Blackbox >
-	GivPolynomial<typename Blackbox::Field::Element>& 
-	blackboxcharpoly (GivPolynomial<typename Blackbox::Field::Element> & P, 
-			  const Blackbox                                   & A,
-			  const RingCategories::ModularTag                 & tag,
-			  const Method::Blackbox           & M)
-	{
-		commentator.start ("Modular Blackbox Charpoly ", "MbbCharpoly");
-		typedef typename Blackbox::Field Field;
-		typedef GivPolynomialRing<Field, Dense> PolyDom;
-		typedef typename PolyDom::Element Polynomial;
-		// Set of factors-multiplicities sorted by degree
-		typedef std::multimap<unsigned long,FactorMult<Polynomial>* > FactPoly;
-		typedef typename FactPoly::iterator FactPolyIterator;
-		multimap<FactorMult<Polynomial>*,bool> leadingBlocks;
-		//typename multimap<FactorMult<Polynomial>*,bool>::iterator lead_it; 
-
-		Field F = A.field();
-		PolyDom PD (F);
-		FactPoly factCharPoly;
-		size_t n = A.coldim();
-
-		/* Computation of the minimal polynomial */
-		Polynomial minPoly;
-		minpoly (minPoly, A, M);
-		//std::cerr<<"Minpoly = "<<minPoly;
-		if (minPoly.size() == n+1){
-			commentator.stop ("done", NULL, "MbbCharpoly");
-			return P = minPoly;
-		}
-		 
-		/* Factorization over the field */
-		std::vector<Polynomial*> factors;    
-		std::vector<unsigned long> exp;
-		PD.factor (factors, exp, minPoly);
-		size_t factnum = factors.size();
-
-		/* Building the structure of factors */
-		int goal = n;
-
-		for (size_t i = 0; i < factors.size(); ++i) {
-			unsigned long deg =  (factors[i]->size()-1);
-			FactorMult<Polynomial>* FFM=NULL;
-			if (exp[i] > 1) {
-				Polynomial* tmp = new Polynomial(*factors[i]);
-				FactorMult<Polynomial>* depend = NULL;
-				for (size_t j = 1; j <= exp[i]; ++j){
-					Polynomial * tmp2 = new Polynomial(*tmp);
-					FFM = new FactorMult<Polynomial> (tmp2, tmp2, 0, depend);
-					//	std::cerr<<"Inserting new factor (exp>1) : "<<(*tmp2)<<std::endl;
-
-					factCharPoly.insert (pair<size_t, FactorMult<Polynomial>*> (deg, FFM));
-					factnum++;
-					depend = FFM;
-					deg += factors[i]->size()-1;
-					if (j < exp[i])
-						PD.mul (*tmp, *tmp2, *factors[i]);
+				else{
+					int tmp =  (n - 2 * dep->multiplicity + multiplicity) / (dep->fieldP->size()-1);
+					*goal -= tmp * (dep->fieldP->size()-1);
+					//std::cerr<<"Updating (leaf)"<<*dep->fieldP<<" --> mul = "<<tmp<<std::endl;
+					dep->multiplicity = tmp;
+					return 1;
 				}
-				delete tmp;
-				factnum--;
-				FFM->multiplicity = 1; // The last factor is present in minpoly
-				goal -= deg-factors[i]->size()+1;
-				leadingBlocks.insert (pair<FactorMult<Polynomial>*,bool>(FFM,false));
-			} else {
-				FFM = new FactorMult<Polynomial> (factors[i],factors[i],1,NULL);
-				//std::cerr<<"Inserting new factor : "<<*factors[i]<<std::endl;
-				factCharPoly.insert (pair<size_t, FactorMult<Polynomial>* > (factors[i]->size()-1, FFM));
-				leadingBlocks.insert (pair<FactorMult<Polynomial>*,bool>(FFM,false));
-				goal -= deg;
 			}
-		}
-		 
-		findMultiplicities ( A, factCharPoly, leadingBlocks, goal, M);
-		 
-		// Building the product 
-		Polynomial charPoly (n+1);
-		Polynomial tmpP;
-		F.init (charPoly[0], 1);
-		for (FactPolyIterator it_f = factCharPoly.begin(); it_f != factCharPoly.end(); it_f++){
-			PD.pow (tmpP, *it_f->second->fieldP, it_f->second->multiplicity);
-			PD.mulin (charPoly, tmpP);
-			delete it_f->second->fieldP;
-			delete it_f->second;
 
-		}
 
+			FieldPoly                       *fieldP;
+			IntPoly                         *intP;
+			unsigned long                   multiplicity;
+			FactorMult<FieldPoly, IntPoly>  *dep;
 
-		commentator.stop ("done", NULL, "MbbCharpoly");
-
-		return P = charPoly;
-	}
-	
-	template<class FieldPoly, class IntPoly>
-	class FactorMult {
-	public:
-		FactorMult():multiplicity(0),dep(NULL){}
-		FactorMult( FieldPoly* FP, IntPoly* IP, unsigned long m, FactorMult<FieldPoly,IntPoly>*d)
-			: fieldP(FP), intP(IP), multiplicity(m), dep(d) {}
-		FactorMult (const FactorMult<FieldPoly>& FM) 
-			: fieldP(FM.fieldP), intP(FM.intP), multiplicity(FM.multiplicity), dep(FM.dep) {}
-	
-		int update (const size_t n, int * goal)
+			std::ostream& write(std::ostream& os)
+			{
+				return os<<"  FieldPoly --> "<<fieldP
+				<<"  IntPoly --> "<<intP
+				<<"  multiplicity --> "<<multiplicity<<std::endl
+				<<"  dep --> "<<dep<<std::endl;
+
+			}
+		};
+
+	public :
+
+		BBcharpoly() {} ;
+		/** Algorithm computing the characteristic polynomial
+		 * of a blackbox.
+		 * @warning not implemented in general cases.
+		 */
+		template < class Blackbox, class Polynomial, class Categorytag >
+		static Polynomial&
+		blackboxcharpoly (Polynomial & P,
+				  const Blackbox                   & A,
+				  const Categorytag                & tag,
+				  const Method::Blackbox           & M);
+
+		/** Algorithm computing the integer characteristic polynomial
+		 * of a blackbox.
+		 */
+		template < class Blackbox >
+		static typename GivPolynomialRing<typename Blackbox::Field>::Element&
+		blackboxcharpoly (typename GivPolynomialRing<typename Blackbox::Field>::Element & P,
+				  const Blackbox                   & A,
+				  const RingCategories::IntegerTag & tag,
+				  const Method::Blackbox           & M)
 		{
-			if (dep->dep != NULL){ 
-				FactorMult<FieldPoly,IntPoly>*curr = dep;
-				int k = dep->update (n,goal)+1;
-				int d = (dep->fieldP->size()-1)/k;
-				int tmp = (n-dep->multiplicity) / d;
-				int i = k-1;
-				while (curr->dep!=NULL){
-					curr = curr->dep;
-					tmp-=i*curr->multiplicity;
-					i--;
+			commentator.start ("Integer Blackbox Charpoly ", "IbbCharpoly");
+
+			typename Blackbox::Field intRing = A.field();
+			typedef Modular<uint32_t> Field;
+			typedef typename Blackbox::template rebind<Field>::other FieldBlackbox;
+			typedef GivPolynomialRing<typename Blackbox::Field, ::Givaro::Dense> IntPolyDom;
+			typedef typename IntPolyDom::Element IntPoly;
+			typedef GivPolynomialRing<Field>::Element FieldPoly;
+			// Set of factors-multiplicities sorted by degree
+			typedef FactorMult<FieldPoly,IntPoly> FM;
+			typedef std::multimap<unsigned long,FM*> FactPoly;
+			typedef typename FactPoly::iterator FactPolyIterator;
+			std::multimap<FM*,bool> leadingBlocks;
+			//typename std::multimap<FM*,bool>::iterator lead_it;
+			FactPoly factCharPoly;
+			size_t n = A.coldim();
+
+			IntPolyDom IPD(intRing);
+
+			/* Computation of the integer minimal polynomial */
+			IntPoly intMinPoly;
+			minpoly (intMinPoly, A, M);
+			if (intMinPoly.size() == n+1){
+				commentator.stop ("done", NULL, "IbbCharpoly");
+				return P = intMinPoly;
+			}
+			/* Factorization over the integers */
+			std::vector<IntPoly*> intFactors;
+			std::vector<unsigned long> exp;
+			IPD.factor (intFactors, exp, intMinPoly);
+			size_t factnum = intFactors.size();
+
+			/* Choose a modular prime field */
+			RandomPrimeIterator primeg (28);
+			++primeg;
+			Field F(*primeg);
+
+			/* Building the structure of factors */
+			int goal = n;
+
+			for (size_t i = 0; i < intFactors.size(); ++i) {
+				unsigned long deg =  (intFactors[i]->size()-1);
+				FactorMult<FieldPoly,IntPoly>* FFM=NULL;
+				if (exp[i] > 1) {
+					IntPoly *tmp = new IntPoly(*intFactors[i]);
+					FM* depend = NULL;
+					for (size_t j = 1; j <= exp[i]; ++j){
+						IntPoly * tmp2 = new IntPoly(*tmp);
+						FieldPoly *tmp2p = new FieldPoly(tmp2->size());
+						typename IntPoly::template rebind<Field>() (*tmp2p, *tmp2, F);
+
+						FFM = new FM (tmp2p, tmp2, 0, depend);
+						factCharPoly.insert (std::pair<size_t, FM*> (deg, FFM));
+						++factnum;
+						depend = FFM;
+						deg += intFactors[i]->size()-1;
+						if (j < exp[i])
+							IPD.mul (*tmp, *tmp2, *intFactors[i]);
+					}
+					delete tmp;
+					--factnum;
+					FFM->multiplicity = 1; // The last factor is present in minpoly
+					goal -= deg-intFactors[i]->size()+1;
+					leadingBlocks.insert (std::pair<FM*,bool>(FFM,false));
+				}
+				else {
+					FieldPoly* fp=new FieldPoly(intFactors[i]->size());
+					typename IntPoly::template rebind<Field>() (*fp, *(intFactors[i]), F);
+					FFM = new FM (fp,intFactors[i],1,NULL);
+					factCharPoly.insert (std::pair<size_t, FM* > (intFactors[i]->size()-1, FFM));
+					leadingBlocks.insert (std::pair<FM*,bool>(FFM,false));
+					goal -= deg;
 				}
-				tmp = tmp/k + (multiplicity - dep->multiplicity) / d;
-				dep->multiplicity = tmp ;
-				//std::cerr<<"Updating "<<*dep->fieldP<<" --> mul = "<<tmp<<std::endl;
-
-				*goal -= tmp * (dep->fieldP->size()-1);
-				return k;
 			}
-			else{
-				int tmp =  (n - 2 * dep->multiplicity + multiplicity) / (dep->fieldP->size()-1);
-				*goal -= tmp * (dep->fieldP->size()-1);
-				//std::cerr<<"Updating (leaf)"<<*dep->fieldP<<" --> mul = "<<tmp<<std::endl;
-				dep->multiplicity = tmp;
-				return 1;
+
+			FieldBlackbox Ap(A, F);
+
+			findMultiplicities (Ap, factCharPoly, leadingBlocks, goal, M);
+
+			// Building the integer charpoly
+			IntPoly intCharPoly (n+1);
+			IntPoly tmpP;
+			intRing.init (intCharPoly[0], 1);
+			for (FactPolyIterator it_f = factCharPoly.begin(); it_f != factCharPoly.end(); ++it_f){
+				IPD.pow (tmpP, *it_f->second->intP, it_f->second->multiplicity);
+				IPD.mulin (intCharPoly, tmpP);
+				delete it_f->second->intP;
+				delete it_f->second->fieldP;
+				delete it_f->second;
 			}
+			commentator.stop ("done", NULL, "IbbCharpoly");
+
+			return P = intCharPoly;
 		}
 
+		/** Algorithm computing the  characteristic polynomial
+		 * of a blackbox over a prime field.
+		 */
+		template < class Blackbox >
+		static typename GivPolynomialRing<typename Blackbox::Field>::Element&
+		blackboxcharpoly (typename GivPolynomialRing<typename Blackbox::Field>::Element & P,
+				  const Blackbox                                                & A,
+				  const RingCategories::ModularTag                              & tag,
+				  const Method::Blackbox                                        & M)
+		{
+			commentator.start ("Modular Blackbox Charpoly ", "MbbCharpoly");
+			typedef typename Blackbox::Field Field;
+			typedef GivPolynomialRing<Field, ::Givaro::Dense> PolyDom;
+			typedef typename PolyDom::Element Polynomial;
+			// Set of factors-multiplicities sorted by degree
+			typedef std::multimap<unsigned long,FactorMult<Polynomial>* > FactPoly;
+			typedef typename FactPoly::iterator FactPolyIterator;
+			std::multimap<FactorMult<Polynomial>*,bool> leadingBlocks;
+			//typename std::multimap<FactorMult<Polynomial>*,bool>::iterator lead_it;
+
+			Field F = A.field();
+			PolyDom PD (F);
+			FactPoly factCharPoly;
+			const size_t n = A.coldim();
+
+			/* Computation of the minimal polynomial */
+			Polynomial minPoly;
+			minpoly (minPoly, A, M);
+			//std::cerr<<"Minpoly = "<<minPoly;
+			if (minPoly.size() == n+1){
+				commentator.stop ("done", NULL, "MbbCharpoly");
+				return P = minPoly;
+			}
 
-		FieldPoly                       *fieldP;
-		IntPoly                         *intP;
-		unsigned long                   multiplicity;
-		FactorMult<FieldPoly, IntPoly>  *dep;
 
-		std::ostream& write(std::ostream& os){
-			return os<<"  FieldPoly --> "<<fieldP
-				 <<"  IntPoly --> "<<intP
-				 <<"  multiplicity --> "<<multiplicity<<std::endl
-				 <<"  dep --> "<<dep<<std::endl;
-		
-		}
-	};
+			Polynomial charPoly (n+1);
+
+			{	/* Factorization over the field */
+				std::vector<Polynomial*> factors;
+				std::vector<unsigned long> exp;
+
+				PD.factor (factors, exp, minPoly);
+				size_t factnum = factors.size();
+
+				/* Building the structure of factors */
+				int goal = n;
+
+				for (size_t i = 0; i < factors.size(); ++i) {
+					unsigned long deg =  (factors[i]->size()-1);
+					FactorMult<Polynomial>* FFM=NULL;
+					if (exp[i] > 1) {
+						Polynomial* tmp = new Polynomial(*factors[i]);
+						FactorMult<Polynomial>* depend = NULL;
+						for (size_t j = 1; j <= exp[i]; ++j){
+							Polynomial * tmp2 = new Polynomial(*tmp);
+							FFM = new FactorMult<Polynomial> (tmp2, tmp2, 0, depend);
+							//	std::cerr<<"Inserting new factor (exp>1): "<<(*tmp2)<<std::endl;
+
+							factCharPoly.insert (std::pair<size_t, FactorMult<Polynomial>* > (deg, FFM));
+							++factnum;
+							depend = FFM;
+							deg += factors[i]->size()-1;
+							if (j < exp[i])
+								PD.mul (*tmp, *tmp2, *factors[i]);
+						}
+						delete tmp;
+						--factnum;
+						FFM->multiplicity = 1; // The last factor is present in minpoly
+						goal -= deg-factors[i]->size()+1;
+						leadingBlocks.insert (std::pair<FactorMult<Polynomial>*,bool>(FFM,false));
+						delete factors[i] ;
+					}
+					else {
+						FFM = new FactorMult<Polynomial> (factors[i],factors[i],1,NULL);
+						//std::cerr<<"Inserting new factor : "<<*factors[i]<<std::endl;
+						factCharPoly.insert (std::pair<size_t, FactorMult<Polynomial>* > (factors[i]->size()-1, FFM));
+						leadingBlocks.insert (std::pair<FactorMult<Polynomial>*,bool>(FFM,false));
+						goal -= deg;
+					}
+				}
+				findMultiplicities ( A, factCharPoly, leadingBlocks, goal, M);
+
+				// Building the product
+				Polynomial tmpP;
+				F.init (charPoly[0], 1);
+				for (FactPolyIterator it_f = factCharPoly.begin(); it_f != factCharPoly.end(); ++it_f){
+					PD.pow (tmpP, *it_f->second->fieldP, it_f->second->multiplicity);
+					PD.mulin (charPoly, tmpP);
+					delete it_f->second->fieldP;
+					delete it_f->second;
 
-	template < class FieldPoly,class IntPoly>
-	void trials( list<vector<FactorMult<FieldPoly,IntPoly> > >& sols, const int goal,
-		     vector<FactorMult<FieldPoly,IntPoly> >& ufv, const int i0 )
-	{
-		if ( !goal ){
-			sols.push_back( ufv);
+				}
+			}
+
+			commentator.stop ("done", NULL, "MbbCharpoly");
+
+			return P = charPoly;
 		}
-		else if ( goal > 0 ){
-			for (size_t i=i0; i<ufv.size(); ++i){
-				ufv[i].multiplicity++;
-				trials( sols, goal - ufv[i].fieldP->size()+1, ufv, i );
-				ufv[i].multiplicity--;
+
+
+		template < class FieldPoly,class IntPoly>
+		static void trials( std::list<std::vector<FactorMult<FieldPoly,IntPoly> > >& sols,
+			     const int goal,
+			     std::vector<FactorMult<FieldPoly,IntPoly> >& ufv,
+			     const int i0 )
+		{
+			if ( !goal ){
+				sols.push_back( ufv);
+			}
+			else if ( goal > 0 ){
+				for (size_t i=i0; i<ufv.size(); ++i){
+					ufv[i].multiplicity++;
+					trials( sols, goal - ufv[i].fieldP->size()+1, ufv, i );
+					ufv[i].multiplicity--;
+				}
 			}
 		}
-	}	
-	template <class Blackbox, class FieldPoly, class IntPoly>
-	void findMultiplicities( const Blackbox& A, 
-				 std::multimap<unsigned long, FactorMult<FieldPoly,IntPoly>* >& factCharPoly,
-				 std::multimap<FactorMult<FieldPoly,IntPoly>*,bool>& leadingBlocks,
-				 int goal,
-				 const Method::Blackbox &M)
-	{
-		typedef multimap<unsigned long, FactorMult<FieldPoly,IntPoly>* > FactPoly;
-		typedef typename Blackbox::Field Field;
-		typedef GivPolynomialRing<Field, Dense> PolyDom;
-		typename FactPoly::iterator itf = factCharPoly.begin();
-		typename multimap<FactorMult<FieldPoly,IntPoly>*,bool>::iterator lead_it; 
-		Field F = A.field();
-		PolyDom PD(F);
-		size_t factnum = factCharPoly.size();
-		size_t n = A.coldim();
-		
-		/* Rank for the linear factors */
-		while ( ( factnum > 1 ) && ( itf->first == 1) ){
-			
-			lead_it = leadingBlocks.find(itf->second);
-			if ( lead_it != leadingBlocks.end())
-				lead_it->second = true;
-			long unsigned int r;
-			
-			/* The matrix Pi (A) */
-			if (F.isZero (itf->second->fieldP->operator[](0))){
-				rank (r, A, M) ;
-			} else {
+
+		template <class Blackbox, class FieldPoly, class IntPoly>
+		static void findMultiplicities( const Blackbox& A,
+					 std::multimap<unsigned long, FactorMult<FieldPoly,IntPoly>* >& factCharPoly,
+					 std::multimap<FactorMult<FieldPoly,IntPoly>*,bool>& leadingBlocks,
+					 int goal,
+					 const Method::Blackbox &M)
+		{
+			typedef std::multimap<unsigned long, FactorMult<FieldPoly,IntPoly>* > FactPoly;
+			typedef typename Blackbox::Field Field;
+			typedef GivPolynomialRing<Field, ::Givaro::Dense> PolyDom;
+			typename FactPoly::iterator itf = factCharPoly.begin();
+			typename std::multimap<FactorMult<FieldPoly,IntPoly>*,bool>::iterator lead_it;
+			Field F = A.field();
+			PolyDom PD(F);
+			size_t factnum = factCharPoly.size();
+			size_t n = A.coldim();
+
+			/* Rank for the linear factors */
+			while ( ( factnum > 1 ) && ( itf->first == 1) ){
+
+				lead_it = leadingBlocks.find(itf->second);
+				if ( lead_it != leadingBlocks.end())
+					lead_it->second = true;
+				long unsigned int r;
+
+				/* The matrix Pi (A) */
+				if (F.isZero (itf->second->fieldP->operator[](0))){
+					rank (r, A, M) ;
+				}
+				else {
+					PolynomialBB<Blackbox, FieldPoly > PA (A, *itf->second->fieldP);
+					rank (r, PA,  M) ;
+				}
+				itf->second->multiplicity = r;
+
+				//std::cerr<<"Rank 1 : "<<*itf->second->fieldP<<" --> "<<r<<std::endl;
+				--factnum;
+				++itf;
+			}
+
+			size_t maxIter = _LB_MAXITER;//MAX( _LB_MAXITER, sqrt(IspBB.mnz() ) );
+			// Rank for the other factorspair
+			while ( factnum > maxIter ){
+				lead_it = leadingBlocks.find (itf->second);
+				if ( lead_it != leadingBlocks.end())
+					lead_it->second = true;
+
 				PolynomialBB<Blackbox, FieldPoly > PA (A, *itf->second->fieldP);
-				rank (r, PA,  M) ;
+				long unsigned int r;
+				rank (r, PA,  M);
+
+				itf->second->multiplicity =r;
+				//std::cerr<<"Rank > 1 : "<<*itf->second->intP<<" --> "<<r<<std::endl;
+
+				--factnum;
+				++itf;
 			}
-			itf->second->multiplicity = r;
 
-			//std::cerr<<"Rank 1 : "<<*itf->second->fieldP<<" --> "<<r<<std::endl;
-			factnum--;
-			itf++;
-		}
-		
-		size_t maxIter = __MAXITER;//MAX( __MAXITER, sqrt(IspBB.mnz() ) );
-		// Rank for the other factorspair
-		while ( factnum > maxIter ){
-			lead_it = leadingBlocks.find (itf->second);
-			if ( lead_it != leadingBlocks.end())
-				lead_it->second = true;
-			
-			PolynomialBB<Blackbox, FieldPoly > PA (A, *itf->second->fieldP);
-			long unsigned int r;
-			rank (r, PA,  M);
-						
-			itf->second->multiplicity =r;
-			//std::cerr<<"Rank > 1 : "<<*itf->second->fieldP<<" --> "<<r<<std::endl;
-
-			factnum--;
-			itf++;
-		}
-		
-		// update the multiplicities
-		for (lead_it = leadingBlocks.begin(); lead_it != leadingBlocks.end(); lead_it++){
-			
-			FactorMult<FieldPoly,IntPoly>* currFFM = lead_it->first;
-			//std::cerr<<"Updating multiplicities of "<<*lead_it->first->fieldP<<std::endl;
-						
-			if (!lead_it->second){ // the leading block has not been computed
-				
-				// go to the last computed multiplicity of the sequence
-				while (currFFM->dep!=NULL){
-					if (currFFM->dep->multiplicity != 0)
-						break;
-					currFFM = currFFM->dep;
-				}
-				if (currFFM->dep != NULL){
-					
-					// Need one more computation:
-					PolynomialBB<Blackbox, FieldPoly > PA (A, *currFFM->fieldP);
-					long unsigned int r;
-					rank (r, PA, M) ;
-					//std::cerr<<"extra factor : "<<*currFFM->fieldP<<" --> "<<r<<std::endl;
-
-					int tmp = currFFM->multiplicity;
-					currFFM->multiplicity = r;
-					currFFM->update (n,&goal);
-					currFFM->multiplicity = tmp;
+			// update the multiplicities
+			for (lead_it = leadingBlocks.begin(); lead_it != leadingBlocks.end(); ++lead_it){
+
+				FactorMult<FieldPoly,IntPoly>* currFFM = lead_it->first;
+				//std::cerr<<"Updating multiplicities of "<<*lead_it->first->fieldP<<std::endl;
+
+				if (!lead_it->second){ // the leading block has not been computed
+
+					// go to the last computed multiplicity of the sequence
+					while (currFFM->dep!=NULL){
+						if (currFFM->dep->multiplicity != 0)
+							break;
+						currFFM = currFFM->dep;
+					}
+					if (currFFM->dep != NULL){
+
+						// Need one more computation:
+						PolynomialBB<Blackbox, FieldPoly > PA (A, *currFFM->fieldP);
+						long unsigned int r;
+						rank (r, PA, M) ;
+						//std::cerr<<"extra factor : "<<*currFFM->fieldP<<" --> "<<r<<std::endl;
+
+						int tmp = currFFM->multiplicity;
+						currFFM->multiplicity = r;
+						currFFM->update (n,&goal);
+						currFFM->multiplicity = tmp;
+					}
 				}
-			} else {
-				int lbm;
-				if (currFFM->dep != NULL){
-					
-					int k = currFFM->update (n,&goal)+1;
-					int d = (lead_it->first->fieldP->size()-1) / k;
-					
-					lbm = (n-lead_it->first->multiplicity) / d;
-					currFFM = currFFM->dep;
-					do{
-						lbm -= currFFM->multiplicity * (currFFM->fieldP->size()-1); 
+				else {
+					int lbm;
+					if (currFFM->dep != NULL){
+
+						int k = currFFM->update (n,&goal)+1;
+						int d = (lead_it->first->fieldP->size()-1) / k;
+
+						lbm = (n-lead_it->first->multiplicity) / d;
 						currFFM = currFFM->dep;
-					} while (currFFM!=NULL);
-					lbm /= k;
-					goal -= (lbm-1)*(lead_it->first->fieldP->size()-1);
-				}else {
-					lbm = (n-lead_it->first->multiplicity) / (lead_it->first->fieldP->size()-1);
-					goal -=  (lbm-1)*(lead_it->first->fieldP->size()-1); 
+						do{
+							lbm -= currFFM->multiplicity * (currFFM->fieldP->size()-1);
+							currFFM = currFFM->dep;
+						} while (currFFM!=NULL);
+						lbm /= k;
+						goal -= (lbm-1)*(lead_it->first->fieldP->size()-1);
+					}
+					else {
+						lbm = (n-lead_it->first->multiplicity) / (lead_it->first->fieldP->size()-1);
+						goal -=  (lbm-1)*(lead_it->first->fieldP->size()-1);
+					}
+					lead_it->first->multiplicity = lbm;
 				}
-				lead_it->first->multiplicity = lbm;
-			}
-		}
-		
-		// Recursive search 
-		typename FactPoly::iterator firstUnknowFactor = itf;
-		if ( factnum <= __MAXITER ){
-			std::vector<FactorMult<FieldPoly,IntPoly> > unknownFact (factnum);
-			for (size_t  i = 0; i < factnum; ++i, itf++){
-				unknownFact[i] = *itf->second;
 			}
-			std::list<vector<FactorMult<FieldPoly,IntPoly> > > sols;
-			trials (sols, goal,unknownFact, 0);
-			typename list<vector<FactorMult<FieldPoly,IntPoly> > >::iterator uf_it = sols.begin();
-
-			if (sols.size()>1){
-				// Evaluation of P in random gamma
-				typename Field::Element d, gamma, mgamma, d2;
-				typename Field::RandIter g(F);
-				do
-					g.random(gamma);
-				while (F.isZero(gamma));
-				
-
-				//Building the matrix A + gamma.Id mod p
-				F.neg( mgamma, gamma );
-				ScalarMatrix<Field> gammaId( F, n, gamma ); 
-				Sum<Blackbox,ScalarMatrix<Field> > Agamma(A, gammaId);
-
-				// Compute det (A+gamma.Id)
-				det (d, Agamma, M);
-				if (A.rowdim()%2)
-					F.negin(d);
-				
-				// Compute Prod(Pi(-gamma)^mi)
-				typename Field::Element tmp, e;
-				F.init (d2,1);
-				typename FactPoly::iterator it_f=factCharPoly.begin();
-				PolyDom PD (F);
-				for (size_t i = 0; i < factCharPoly.size()-factnum; ++i, it_f++){
-					PD.eval (tmp, *it_f->second->fieldP, mgamma);
-					for (size_t j=0; j < it_f->second->multiplicity; ++j)
-						F.mulin (d2, tmp);
+
+			// Recursive search
+			typename FactPoly::iterator firstUnknowFactor = itf;
+			if ( factnum <= _LB_MAXITER ){
+				std::vector<FactorMult<FieldPoly,IntPoly> > unknownFact (factnum);
+				for (size_t  i = 0; i < factnum; ++i, ++itf){
+					unknownFact[i] = *itf->second;
 				}
-				while ( uf_it != sols.end() ){
-					F.init (e,1);
-					for (size_t i = 0; i < uf_it->size(); ++i){
-						PD.eval( tmp, *(*uf_it)[i].fieldP, mgamma );
-						for (size_t  j=0; j < (*uf_it)[i].multiplicity; ++j)
-							F.mulin( e, tmp );
+				std::list<std::vector<FactorMult<FieldPoly,IntPoly> > > sols;
+				trials (sols, goal,unknownFact, 0);
+				typename std::list<std::vector<FactorMult<FieldPoly,IntPoly> > >::iterator uf_it = sols.begin();
+
+				if (sols.size()>1){
+					// Evaluation of P in random gamma
+					typename Field::Element d, gamma, mgamma, d2;
+					typename Field::RandIter g(F);
+					do
+						g.random(gamma);
+					while (F.isZero(gamma));
+
+
+					//Building the matrix A + gamma.Id mod p
+					F.neg( mgamma, gamma );
+					ScalarMatrix<Field> gammaId( F, n, gamma );
+					Sum<Blackbox,ScalarMatrix<Field> > Agamma(A, gammaId);
+
+					// Compute det (A+gamma.Id)
+					det (d, Agamma, M);
+					if (A.rowdim()%2)
+						F.negin(d);
+
+					// Compute Prod(Pi(-gamma)^mi)
+					typename Field::Element tmp, e;
+					F.init (d2,1);
+					typename FactPoly::iterator it_f=factCharPoly.begin();
+					PolyDom PD (F);
+					for (size_t i = 0; i < factCharPoly.size()-factnum; ++i, ++it_f){
+						PD.eval (tmp, *it_f->second->fieldP, mgamma);
+						for (size_t j=0; j < it_f->second->multiplicity; ++j)
+							F.mulin (d2, tmp);
 					}
-					F.mulin( e, d2);
-					if (F.areEqual(e,d))
-						break;
-					uf_it++;
-				}
-				if (uf_it == sols.end())
-					std::cerr<<"FAIL:: No solutions found in recursive seach"<<endl;
-			} // At this point, uf_it points on the good solution
-			// update with the good multiplicities
-			typename FactPoly::iterator it_f = firstUnknowFactor;
-			typename std::vector<FactorMult<FieldPoly,IntPoly> >::iterator it_fm = (*uf_it).begin();
-			for (; it_f != factCharPoly.end(); it_f++, it_fm++)
-				it_f->second->multiplicity = it_fm->multiplicity;
+					while ( uf_it != sols.end() ){
+						F.init (e,1);
+						for (size_t i = 0; i < uf_it->size(); ++i){
+							PD.eval( tmp, *(*uf_it)[i].fieldP, mgamma );
+							for (size_t  j=0; j < (*uf_it)[i].multiplicity; ++j)
+								F.mulin( e, tmp );
+						}
+						F.mulin( e, d2);
+						if (F.areEqual(e,d))
+							break;
+						++uf_it;
+					}
+					if (uf_it == sols.end())
+						std::cerr<<"FAIL:: No solutions found in recursive seach"<<std::endl;
+				} // At this point, uf_it points on the good solution
+				// update with the good multiplicities
+				typename FactPoly::iterator it_f = firstUnknowFactor;
+				typename std::vector<FactorMult<FieldPoly,IntPoly> >::iterator it_fm = (*uf_it).begin();
+				for (; it_f != factCharPoly.end(); ++it_f, ++it_fm)
+					it_f->second->multiplicity = it_fm->multiplicity;
+			}
 		}
-	}
 
+	};
 }
 
+#undef _LB_MAXITER
 #endif // __BBCHARPOLY_H
+
diff --git a/linbox/algorithms/bbsolve.h b/linbox/algorithms/bbsolve.h
index d4adfbe..176964f 100644
--- a/linbox/algorithms/bbsolve.h
+++ b/linbox/algorithms/bbsolve.h
@@ -1,14 +1,16 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* linbox/algorithms/bbsolve.h
- * (was linbox/sollutions/solve.h)
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (c) LinBox
+ * linbox/algorithms/bbsolve.h
+ * (was linbox/solutions/solve.h)
+ * written
  *  by Bradford Hovinen <hovinen at cis.udel.edu>
  *
  * See COPYING for license information.
  */
 
-#ifndef __BBSOLVE_H
-#define __BBSOLVE_H
+#ifndef __LINBOX_bbsolve_H
+#define __LINBOX_bbsolve_H
 
 #include <vector>
 #include <algorithm>
@@ -22,36 +24,38 @@
 #include "linbox/vector/vector-domain.h"
 #include "linbox/solutions/methods.h"
 
-namespace LinBox 
+namespace LinBox
 {
 
-//	/** @name Solvers
-//	 * @brief Solving linear system Ax = b over the field F.
-//	 */
-//	//@{
+#if 0
+	/** @name Solvers
+	 * @brief Solving linear system Ax = b over the field F.
+	 */
+	@{
+#endif
 
-	/*
+#if 0
 	// for specialization on method.
 	template <class Field, class Vector, class Blackbox, class MyMethod>
 	Vector& solve (const Blackbox&A,
-	Vector                          &x,		       
-	const Vector                    &b,
-	const Field                     &F,
-	const MyMethod & m );
-	*/
+		       Vector                          &x,
+		       const Vector                    &b,
+		       const Field                     &F,
+		       const MyMethod & m );
+#endif
 
 	/** Solve Ax=b over field F using Wiedemann's method, with inconsistency certificate.
-	 * 
+	 *
 	 * This is a general interface for the linear system solving
 	 * capabilities of LinBox. If the system is nonsingular, it returns
 	 * the unique solution, storing it in the vector x. If the system is
 	 * consistent and singular, it returns a random solution. Repeated
 	 * calls to this function can give a complete description of the
 	 * solution manifold. If the system is inconsistent and the
-	 * \Ref{SolverTraits} structure supplied requests certification of
+	 * \ref SolverTraits structure supplied requests certification of
 	 * inconsistency, it fills in the certificate of
 	 * inconsistency. Otherwise, it runs through the number of iterations
-	 * specified in @code{traits} and throws a \Ref{SolveFailed} exception
+	 * specified in \c traits and throws a \ref SolveFailed exception
 	 * if it cannot find a solution.
 	 *
 	 * This specialization uses Wiedemann's algorithm and is the default.
@@ -61,14 +65,14 @@ namespace LinBox
 	 * @param b Right-hand side
 	 * @param u Vector in which to store certificate of inconsistency, if required
 	 * @param F Field over which to perform computations
-	 * @param traits \Ref{SolverTraits} structure with user-specified parameters
+	 * @param traits \ref SolverTraits structure with user-specified parameters
 	 * @return Reference to solution vector
 	 */
 
 	template <class Field, class Vector, class Blackbox>
-	typename WiedemannSolver<Field>::ReturnStatus 
+	typename WiedemannSolver<Field>::ReturnStatus
 	solve (const Blackbox                  &A,
-	       Vector                          &x,		       
+	       Vector                          &x,
 	       const Vector                    &b,
 	       Vector                          &u,
 	       const Field                     &F,
@@ -88,7 +92,7 @@ namespace LinBox
 
 	template <class Field, class Vector, class Blackbox>
 	Vector &solve (const Blackbox                  &A,
-		       Vector                          &x,		       
+		       Vector                          &x,
 		       const Vector                    &b,
 		       const Field                     &F,
 		       const WiedemannTraits &traits = WiedemannTraits ())
@@ -117,15 +121,15 @@ namespace LinBox
 	}
 
 	/** Solve Ax=b over field F using the Lanczos method.
-	 * 
+	 *
 	 * This is a general interface for the linear system solving capabilities of
 	 * LinBox. If the system is nonsingular, it returns the unique solution, storing
 	 * it in the vector x. If the system is consistent and singular, it returns a
 	 * random solution. Repeated calls to this function can give a complete
 	 * description of the solution manifold. If the system is inconsistent and the
-	 * \Ref{SolverTraits} structure has result checking turned on, it runs through
-	 * the number of iterations specified in @code{traits} and throws a
-	 * \Ref{SolveFailed} exception if it cannot find a solution.
+	 * \ref SolverTraits  structure has result checking turned on, it runs through
+	 * the number of iterations specified in \c traits and throws a
+	 * \ref SolveFailed  exception if it cannot find a solution.
 	 *
 	 * This specialization uses the Lanczos algorithm.
 	 *
@@ -133,13 +137,13 @@ namespace LinBox
 	 * @param x Place to store solution vector
 	 * @param b Right-hand side
 	 * @param F Field over which to perform computations
-	 * @param traits \Ref{SolverTraits} structure with user-specified parameters
+	 * @param traits \ref SolverTraits  structure with user-specified parameters
 	 * @return Reference to solution vector
 	 */
 
 	template <class Field, class Vector, class Blackbox>
 	Vector &solve (const Blackbox                  &A,
-		       Vector                          &x,		       
+		       Vector                          &x,
 		       const Vector                    &b,
 		       const Field                     &F,
 		       const LanczosTraits        &traits)
@@ -149,15 +153,15 @@ namespace LinBox
 	}
 
 	/** Solve Ax=b over field F using the block Lanczos method.
-	 * 
+	 *
 	 * This is a general interface for the linear system solving capabilities of
 	 * LinBox. If the system is nonsingular, it returns the unique solution, storing
 	 * it in the vector x. If the system is consistent and singular, it returns a
 	 * random solution. Repeated calls to this function can give a complete
 	 * description of the solution manifold. If the system is inconsistent and the
-	 * \Ref{SolverTraits} structure has result checking turned on, it runs through
-	 * the number of iterations specified in @code{traits} and throws a
-	 * \Ref{SolveFailed} exception if it cannot find a solution.
+	 * \ref SolverTraits structure has result checking turned on, it runs through
+	 * the number of iterations specified in \c traits and throws a
+	 * \ref SolveFailed exception if it cannot find a solution.
 	 *
 	 * This specialization uses the block Lanczos algorithm.
 	 *
@@ -165,13 +169,13 @@ namespace LinBox
 	 * @param x Place to store solution vector
 	 * @param b Right-hand side
 	 * @param F Field over which to perform computations
-	 * @param traits \Ref{SolverTraits} structure with user-specified parameters
+	 * @param traits \ref SolverTraits structure with user-specified parameters
 	 * @return Reference to solution vector
 	 */
 
 	template <class Field, class Vector, class Blackbox>
 	Vector &solve (const Blackbox                &A,
-		       Vector                        &x,		       
+		       Vector                        &x,
 		       const Vector                  &b,
 		       const Field                   &F,
 		       const BlockLanczosTraits &traits)
@@ -182,29 +186,29 @@ namespace LinBox
 	}
 
 	/** Solve Ax=b over field F using Gaussian elimination.
-	 * 
+	 *
 	 * This is a general interface for the linear system solving capabilities of
 	 * LinBox. If the system is nonsingular, it returns the unique solution, storing
 	 * it in the vector x. If the system is consistent and singular, it returns a
 	 * random solution. Repeated calls to this function can give a complete
 	 * description of the solution manifold. If the system is inconsistent and the
-	 * \Ref{SolverTraits} structure supplied requests certification of
-	 * inconsistency, it throws an \Ref{InconsistentSystem} exception, which
+	 * \ref SolverTraits  structure supplied requests certification of
+	 * inconsistency, it throws an \ref InconsistentSystem exception, which
 	 * includes a certificate of inconsistency. Otherwise, it runs through the
-	 * number of iterations specified in @code{traits} and throws a
-	 * \Ref{SolveFailed} exception if it cannot find a solution.
+	 * number of iterations specified in \p traits and throws a
+	 * \ref SolveFailed  exception if it cannot find a solution.
 	 *
 	 * @param A Black box matrix of the system
 	 * @param x Place to store solution vector
 	 * @param b Right-hand side
 	 * @param F Field over which to perform computations
-	 * @param traits \Ref{SolverTraits} structure with user-specified parameters
+	 * @param traits \ref SolverTraits  structure with user-specified parameters
 	 * @return Reference to solution vector
 	 */
 
 	template <class Field, class Matrix, class Vector>
 	Vector &solve (const Matrix                     &A,
-		       Vector                           &x,		       
+		       Vector                           &x,
 		       const Vector                     &b,
 		       const Field                      &F,
 		       const BlasEliminationTraits &traits)
@@ -216,13 +220,13 @@ namespace LinBox
 
 	/** Enumeration for results of next solver.
 	 *
-	 * SOLVE_SUCCESSFUL - System solution was succesful, @code{x} holds the solution
-	 * vector 
-	 * SOLVE_INCONSISTENT - System was inconsistent, @code{u} holds the certificate
-	 * of inconsistency and @code{x} is untouched
+	 * SOLVE_SUCCESSFUL - System solution was succesful, \c x holds the solution
+	 * vector
+	 * SOLVE_INCONSISTENT - System was inconsistent, \c u holds the certificate
+	 * of inconsistency and \c x is untouched
 	 * SOLVE_FAILED - Neither a system solution nor a certificate of inconsistency
-	 * could be obtained before the maximum number of trials elapsed. Both @code{x}
-	 * and @code{u} are untouched.
+	 * could be obtained before the maximum number of trials elapsed. Both \c x
+	 * and \c u are untouched.
 	 */
 
 	enum SolveResult {
@@ -231,8 +235,8 @@ namespace LinBox
 
 	/** Solve Ax=b over field F, returning consistency indicator
 	 *
-	 * This is a variant of @code{solve} that does not throw any exceptions unless
-	 * the user makes an error. It returns a \Ref{SolveResult} enum indicating
+	 * This is a variant of \c solve that does not throw any exceptions unless
+	 * the user makes an error. It returns a \ref SolveResult  enum indicating
 	 * whether the solve operation was successful, the system was inconsistent, or
 	 * the solve operation failed. The certificate of inconsistency, if requested,
 	 * is stored in a reference parameter supplied to this variant.
@@ -242,14 +246,14 @@ namespace LinBox
 	 * @param b Right-hand side
 	 * @param u Place to store certificate of inconsistency
 	 * @param F Field over which to perform computations
-	 * @param traits \Ref{SolverTraits} structure with user-specified parameters
-	 * @return \Ref{SolveResult} indicating whether the solve operation was
+	 * @param traits \ref SolverTraits  structure with user-specified parameters
+	 * @return \ref SolveResult indicating whether the solve operation was
 	 * successful
 	 */
 
 	template <class Field, class Blackbox, class Vector, class MethodTraits>
 	SolveResult solve (const Blackbox     &A,
-			   Vector             &x,		       
+			   Vector             &x,
 			   const Vector       &b,
 			   const Field        &F,
 			   Vector             &u,
@@ -269,8 +273,11 @@ namespace LinBox
 
 		return SOLVE_SUCCESSFUL;
 	}
-//	//@}
+#if 0
+	@}
+#endif
 
 }
 
-#endif // __BBSOLVE_H
+#endif // __LINBOX_bbsolve_H
+
diff --git a/linbox/algorithms/bitonic-sort.h b/linbox/algorithms/bitonic-sort.h
index 572e3c9..982ca71 100644
--- a/linbox/algorithms/bitonic-sort.h
+++ b/linbox/algorithms/bitonic-sort.h
@@ -1,56 +1,82 @@
-/* -*-mode:C++ -*- */
-/* Written by Zhendong Wan */
-/* Implement bitonic sorting network */
+/* -*- 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
+/* Copyright (C) LinBox
+ * Written by Zhendong Wan
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
 
+#ifndef __LINBOX_bitonic_sort_H
+#define __LINBOX_bitonic_sort_H
+
+/*! @file algorithms/bitonic-sort.h
+ * Implement bitonic sorting network
+ */
 
-#ifndef BITONIC_SORT_H__
-#define BITONIC_SORT_H__
 #include <algorithm>
 
-namespace LinBox{
+namespace LinBox
+{
 
 
 	/* end - begin must be a power of 2*/
 	template <class Iterator, class Comparator>
-		void bitonicSort(Iterator begin, Iterator end, const Comparator& comparator = Comparator());
+	void bitonicSort(Iterator begin, Iterator end, const Comparator& comparator = Comparator());
 
 	/* end - begin must be a power of 2*/
 	template <class Iterator, class Comparator>
-		void bitonicMerge(Iterator begin, Iterator end, const Comparator& comparator = Comparator());
+	void bitonicMerge(Iterator begin, Iterator end, const Comparator& comparator = Comparator());
 
 	///
 	template<class Iterator, class Comparator>
-		void bitonicSort(Iterator begin, Iterator end, const Comparator& comparator){
+	void bitonicSort(Iterator begin, Iterator end, const Comparator& comparator)
+	{
 
 		if (end - begin >= 2) {
 			Iterator mid = begin + (end - begin) / 2;
-			
+
 			// Sort the first half
 			bitonicSort(begin, mid, comparator);
-			
+
 			// Sort the second half
 			bitonicSort(mid, end, comparator);
-			
+
 			// reverse the order of second half
 			std::reverse(mid, end);
-			
+
 			// Bitonic merge two halves
 			bitonicMerge(begin, end, comparator);
 		}
-		
+
 	}
-	
+
 	template<class Iterator, class Comparator>
-		void bitonicMerge(Iterator begin, Iterator end, const Comparator& comparator){
-		
+	void bitonicMerge(Iterator begin, Iterator end, const Comparator& comparator)
+	{
+
 		if (end - begin >= 2) {
-			
+
 			Iterator mid = begin + (end - begin) / 2;
-			
+
 			Iterator p1 = begin;
-			
+
 			Iterator p2 = mid;
-			
+
 			// Compare network
 			for (p1 = begin, p2 = mid; p2 != end; ++ p1, ++ p2)
 				comparator(*p1, *p2);
@@ -62,7 +88,7 @@ namespace LinBox{
 			bitonicMerge(mid, end, comparator);
 		}
 	}
-	
+
 }
 
-#endif
+#endif //__LINBOX_bitonic_sort_H
diff --git a/linbox/algorithms/blackbox-block-container-base.h b/linbox/algorithms/blackbox-block-container-base.h
old mode 100755
new mode 100644
index c789448..73bfedb
--- a/linbox/algorithms/blackbox-block-container-base.h
+++ b/linbox/algorithms/blackbox-block-container-base.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/algorithms/blackbox-block-container-base.h
  * Copyright (C) 2002 Pascal Giorgi
  *
@@ -21,12 +21,18 @@
  * Boston, MA 02111-1307, USA.
  */
 
+/*! @file algorithms/blackbox-block-container-base.h
+ * @ingroup algorithms
+ * @brief NO DOC
+ */
+
+
 
-#ifndef __BLACKBOX_BLOCK_CONTAINER_BASE_H
-#define __BLACKBOX_BLOCK_CONTAINER_BASE_H
+#ifndef __LINBOX_blackbox_block_container_base_H
+#define __LINBOX_blackbox_block_container_base_H
 
 
-#include "time.h"
+#include <time.h> // for seeding
 
 #include <linbox/blackbox/archetype.h>
 #include <linbox/matrix/blas-matrix.h>
@@ -38,7 +44,7 @@
 #undef _V
 #undef _F
 
-namespace LinBox 
+namespace LinBox
 {
 
 #ifndef MIN
@@ -46,16 +52,16 @@ namespace LinBox
 #endif
 
 	/** \brief A base class for BlackboxBlockContainer.
-	 * The primary member function is begin().
+	 * The primary member function is \c begin().
 
-	 * It returns an iterator which after i increments (++) dereferences to 
-	 * $U A^i V$, for $U$ and $V$ determined by the init function.
-	 * It is designed to be used with implementations of Block Berlekamp-Massey 
-	 * such as BlockMasseyDomain.
+	 * It returns an iterator which after i increments (++) dereferences to
+	 * \f$U A^i V\f$, for \f$U\f$ and \f$V\f$ determined by the init
+	 * function.  It is designed to be used with implementations of Block
+	 * Berlekamp-Massey such as BlockMasseyDomain.
 	 *
-	 * Subclasses complete the implementation by defining _launch() and _wait().
+	 * Subclasses complete the implementation by defining \c _launch() and
+	 * \c _wait().
 	 */
-
 	template<class _Field, class _Blackbox>
 	class BlackboxBlockContainerBase {
 	public:
@@ -66,78 +72,81 @@ namespace LinBox
 		typedef BlasMatrix<Element>            Value;
 
 		// Default constructors
-		BlackboxBlockContainerBase () {} 
+		BlackboxBlockContainerBase () {}
 
 		// Sequence constructor from a blackbox and a field
 		// cs set the size of the sequence
-		BlackboxBlockContainerBase (const Blackbox *BD, const Field &F, size_t m, size_t n, size_t seed=time(NULL))
-			: _F(F)  , _BB(BD), _size(BD->rowdim()/m + BD->coldim()/n +2) , _row(BD->rowdim()),  _col(BD->coldim()), _m(m), _n(n),  _value(m,n), _seed(seed) {}
-  
-	
+		BlackboxBlockContainerBase (const Blackbox *BD, const Field &F, size_t m, size_t n, size_t seed=time(NULL)) :
+			_F(F)  , _BB(BD), _size(BD->rowdim()/m + BD->coldim()/n +2) , _row(BD->rowdim()),  _col(BD->coldim()), _m(m), _n(n),  _value(m,n), _seed(seed)
+		{}
+
+
 		virtual ~BlackboxBlockContainerBase(){}
 
 		// iterator of the sequence
 		class const_iterator {
-			
+
 		protected:
 			BlackboxBlockContainerBase<Field, Blackbox> &_c;
 
 		public:
 			const_iterator () {}
-			
-			const_iterator (BlackboxBlockContainerBase<Field, Blackbox> &C) : _c (C) {}
-			
+
+			const_iterator (BlackboxBlockContainerBase<Field, Blackbox> &C) :
+				_c (C)
+			{}
+
 			const_iterator &operator ++ () { _c._launch (); return *this; }
-			
-			const Value    &operator * ()  { _c._wait (); return _c.getvalue();}			
+
+			const Value    &operator * ()  { _c._wait (); return _c.getvalue();}
 		};
-		
+
 		// begin of the sequence iterator
 		const_iterator begin ()        { return const_iterator (*this); }
-		
+
 		// end of the sequence iterator
 		const_iterator end ()          { return const_iterator (); }
 
 		// size of the sequence
-		size_t size() const            { return _size; }		
+		size_t size() const            { return _size; }
 
 		// field of the sequence
 		const Field &getField () const { return _F; }
 
 		// blackbox of the sequence
-		const Blackbox *getBB () const { return _BB; }		
+		const Blackbox *getBB () const { return _BB; }
 
 		// row dimension of the sequence element
 		size_t rowdim() const          { return _m; }
-		
+
 		// column dimension of the sequence element
 		size_t coldim() const          { return _n; }
 
-		// row dimension of the matrix 
+		// row dimension of the matrix
 		size_t getrow() const { return _BB->rowdim();}
 
-		// col dimension of the matrix 
+		// col dimension of the matrix
 		size_t getcol() const { return _BB->rowcol();}
 
 
 	protected:
 
 		friend class const_iterator;
-    
-		/** Launches a process to do the computation of the next sequence 
-		 *  value: $U A^{i+1} V$.  ...or just does it.
+
+		/** Launches a process to do the computation of the next sequence
+		 *  value: \f$U A^{i+1} V\f$.  ...or just does it.
 		 */
 		virtual void _launch() = 0;
 
-		/** If a separate process is computing the next value of $U A^{i+1} V$,
-		 * _wait() blocks until the value is ready.
+		/** If a separate process is computing the next value of \f$U
+		 * A^{i+1} V\f$, \c _wait() blocks until the value is ready.
 		 */
 		virtual void _wait() = 0;
 
-		//-------------- 
+		//--------------
 		/// Members
-		//--------------  
- 
+		//--------------
+
 		Field                        _F;
 		const Blackbox             *_BB;
 		size_t                    _size;
@@ -145,8 +154,8 @@ namespace LinBox
 		size_t                     _col;
 		size_t                       _m;
 		size_t                       _n;
-		
-                // BDS 22.03.03
+
+		// BDS 22.03.03
 		long                 casenumber;
 		Block                        _U;
 		Block                        _V;
@@ -156,52 +165,55 @@ namespace LinBox
 
 		const Value &getvalue() {return _value;}
 
-		//-------------- 
+		//--------------
 		/// Initializers
-		//--------------  
+		//--------------
 
-		// Blackbox multiplication using apply function 
-		void Mul(Block &M1, const Blackbox &M2 , const Block& M3) {
+		// Blackbox multiplication using apply function
+		void Mul(Block &M1, const Blackbox &M2 , const Block& M3)
+		{
 			linbox_check( M1.rowdim() == M2.rowdim());
 			linbox_check( M2.coldim() == M3.rowdim());
 			linbox_check( M1.coldim() == M3.coldim());
-			
+
 			typename Block::ColIterator        p1 = M1.colBegin();
 			typename Block::ConstColIterator   p3 = M3.colBegin();
-			
+
 			for (; p3 != M3.colEnd(); ++p1,++p3) {
 				M2.apply(*p1,*p3);
 			}
 		}
-	    
-	
+
+
 		/// User Left and Right blocks
-		void init (const Block& U, const Block& V) {
-			
+		void init (const Block& U, const Block& V)
+		{
+
 			linbox_check ( U.coldim() == _row);
 			linbox_check ( V.rowdim() == _col);
 			casenumber = 1;
-			_U = U;  
-			_V = V;  
+			_U = U;
+			_V = V;
 			_value = Value(_m,_n);
 			BlasMatrixDomain<Field> BMD(_F);
 			BMD.mul(_value, _U, _V);
 		}
 
-		// Random Left Matrix and Right Matrix       
-		void init (size_t m, size_t n) {
+		// Random Left Matrix and Right Matrix
+		void init (size_t m, size_t n)
+		{
 			casenumber = 1;
-								
+
 			typename Field::RandIter G(_F,0,_seed);
 			Block U (m, _BB->rowdim());
-			_U =U;			
+			_U =U;
 			Block V(_BB->coldim(), n);
 			_V =V;
-			
+
 			typename Block::RawIterator iter_U = _U.rawBegin();
 			for (; iter_U != _U.rawEnd();++iter_U)
 				G.random(*iter_U);
-			
+
 			typename Block::RawIterator iter_V = _V.rawBegin();
 			for (; iter_V != _V.rawEnd();++iter_V)
 				G.random(*iter_V);
@@ -211,7 +223,8 @@ namespace LinBox
 			BMD.mul(_value, _U, _V);
 		}
 	};
- 
+
 }
 
-#endif // __BLACKBOX_BLOCK_CONTAINER_BASE_H
+#endif // __LINBOX_blackbox_block_container_base_H
+
diff --git a/linbox/algorithms/blackbox-block-container.h b/linbox/algorithms/blackbox-block-container.h
old mode 100755
new mode 100644
index e1e7343..4334dfd
--- a/linbox/algorithms/blackbox-block-container.h
+++ b/linbox/algorithms/blackbox-block-container.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/algorithms/blackbox-block-container.h
  * Copyright (C) 2002 Pascal Giorgi
  *
@@ -21,21 +21,31 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __BLACKBOX_BLOCK_CONTAINER_H
-#define __BLACKBOX_BLOCK_CONTAINER_H
+/*! @file algorithms/blackbox-block-container.h
+ * @ingroup algorithms
+ * @brief no doc.
+ */
+
+#ifndef __LINBOX_blackbox_block_container_H
+#define __LINBOX_blackbox_block_container_H
 
-#include "time.h"
 
 #include <linbox/algorithms/blackbox-block-container-base.h>
 #include <linbox/matrix/blas-matrix.h>
 #include <linbox/algorithms/blas-domain.h>
-#include <linbox/util/timer.h>
 
-#define _BBC_TIMING 
+#define _BBC_TIMING
 
-namespace LinBox 
+#ifdef _BBC_TIMING
+#include <time.h>
+#include <linbox/util/timer.h>
+#endif
+
+namespace LinBox
 {
 
+	/*! @brief no doc.
+	 */
 	template<class _Field, class _Blackbox>
 	class BlackboxBlockContainer : public BlackboxBlockContainerBase<_Field,_Blackbox> {
 	public:
@@ -46,58 +56,58 @@ namespace LinBox
 		typedef BlasMatrix<Element>           Value;
 
 		// Default constructor
-		BlackboxBlockContainer () {} 
+		BlackboxBlockContainer () {}
 
 		// constructor of the sequence from a blackbox, a field and one block projection
-		BlackboxBlockContainer(const _Blackbox *D, const Field &F, const Block  &U0) 
-			: BlackboxBlockContainerBase<Field,_Blackbox> (D, F, U0.rowdim(), U0.coldim()) , _W(D->rowdim(), U0.coldim()), _BMD(F)
-		{ 
+		BlackboxBlockContainer(const _Blackbox *D, const Field &F, const Block  &U0) :
+			BlackboxBlockContainerBase<Field,_Blackbox> (D, F, U0.rowdim(), U0.coldim()) , _W(D->rowdim(), U0.coldim()), _BMD(F)
+		{
 #ifdef _BBC_TIMING
 			clearTimer();
 			tSequence.clear();
 			tSequence.start();
 #endif
-			this->init (U0, U0); 
+			this->init (U0, U0);
 #ifdef _BBC_TIMING
 			tSequence.stop();
 			ttSequence += tSequence;
 #endif
 		}
-    
+
 		// constructor of the sequence from a blackbox, a field and two blocks projection
-		BlackboxBlockContainer(const _Blackbox *D, const Field &F, const Block &U0, const Block& V0) 
-			: BlackboxBlockContainerBase<Field,_Blackbox> (D, F,U0.rowdim(), V0.coldim()) , _W(D->rowdim(), V0.coldim()), _BMD(F)
-		{ 
+		BlackboxBlockContainer(const _Blackbox *D, const Field &F, const Block &U0, const Block& V0) :
+			BlackboxBlockContainerBase<Field,_Blackbox> (D, F,U0.rowdim(), V0.coldim()) , _W(D->rowdim(), V0.coldim()), _BMD(F)
+		{
 #ifdef _BBC_TIMING
 			clearTimer();
 			tSequence.clear();
 			tSequence.start();
 #endif
-			this->init (U0, U0); 
+			this->init (U0, U0);
 #ifdef _BBC_TIMING
 			tSequence.stop();
 			ttSequence += tSequence;
-#endif		
+#endif
 		}
-    
+
 		//  constructor of the sequence from a blackbox, a field and two blocks random projection
-		BlackboxBlockContainer(const _Blackbox *D, const Field &F, size_t m, size_t n, size_t seed= time(NULL)) 
-			: BlackboxBlockContainerBase<Field, _Blackbox> (D, F, m, n,seed) , _W(D->rowdim(), n), _BMD(F)
+		BlackboxBlockContainer(const _Blackbox *D, const Field &F, size_t m, size_t n, size_t seed= time(NULL)) :
+			BlackboxBlockContainerBase<Field, _Blackbox> (D, F, m, n,seed) , _W(D->rowdim(), n), _BMD(F)
 		{
 #ifdef _BBC_TIMING
 			clearTimer();
 			tSequence.clear();
 			tSequence.start();
 #endif
-			this->init (m, n); 
+			this->init (m, n);
 #ifdef _BBC_TIMING
 			tSequence.stop();
 			ttSequence += tSequence;
-#endif		
+#endif
 		}
-    
 
-#ifdef _BBC_TIMING		
+
+#ifdef _BBC_TIMING
 		void clearTimer() {
 			ttSequence.clear();
 		}
@@ -105,16 +115,16 @@ namespace LinBox
 		void printTimer() {
 			std::cout<<"Sequence Computation "<<ttSequence<<std::endl<<std::endl;
 		}
-#endif	
+#endif
 
 
-	protected: 
+	protected:
 		Block                        _W;
 		BlasMatrixDomain<Field>    _BMD;
 
-#ifdef _BBC_TIMING		
+#ifdef _BBC_TIMING
 		Timer     ttSequence, tSequence;
-#endif		
+#endif
 
 
 		// launcher of the next sequence element computation
@@ -123,15 +133,16 @@ namespace LinBox
 			tSequence.clear();
 			tSequence.start();
 #endif
-			if (this->casenumber) {	
+			if (this->casenumber) {
 				Mul(_W,*this->_BB,this->_V);
 				_BMD.mul(this->_value, this->_U, _W);
 				this->casenumber = 0;
-			} else { 
+			}
+			else {
 				Mul(this->_V,*this->_BB,_W);
 				_BMD.mul(this->_value, this->_U, this->_V);
 				this->casenumber = 1;
-			}  
+			}
 #ifdef _BBC_TIMING
 			tSequence.stop();
 			ttSequence +=tSequence;
@@ -141,6 +152,8 @@ namespace LinBox
 		void _wait () {}
 	};
 
+	/*! @brief no doc.
+	 */
 	template<class _Field, class _Blackbox>
 	class BlackboxBlockContainerRecord : public BlackboxBlockContainerBase<_Field,_Blackbox> {
 
@@ -152,30 +165,30 @@ namespace LinBox
 		typedef BlasMatrix<Element>           Value;
 
 		enum Launcher {RowUpdate=0, ColUpdate=1, Nothing=2};
-	
+
 		// Default constructor
-		BlackboxBlockContainerRecord () {} 
+		BlackboxBlockContainerRecord () {}
 
 		// constructor of the sequence from a blackbox, a field and one block projection
-		BlackboxBlockContainerRecord(const _Blackbox *D, const Field &F, const Block  &U0) 
-			: BlackboxBlockContainerBase<Field,_Blackbox> (D, F, U0.rowdim(), U0.coldim()),
-			  _W(D->rowdim(), U0.coldim()), _BMD(F), _launcher(Nothing), _iter(1)
-		{ 
-			this->init (U0, U0); 
+		BlackboxBlockContainerRecord(const _Blackbox *D, const Field &F, const Block  &U0) :
+			BlackboxBlockContainerBase<Field,_Blackbox> (D, F, U0.rowdim(), U0.coldim()),
+			_W(D->rowdim(), U0.coldim()), _BMD(F), _launcher(Nothing), _iter(1)
+		{
+			this->init (U0, U0);
 			_rep = std::vector<Value> (this->_size);
-			_Vcopy = this->_V;		
+			_Vcopy = this->_V;
 			for (size_t i=0;i< this->_size;++i){
 				_rep[i] = this->_value;
-				_launch_record();				
+				_launch_record();
 			}
 			this->_value=_rep[0];
 		}
-    
+
 		// constructor of the sequence from a blackbox, a field and two blocks projection
-		BlackboxBlockContainerRecord(const _Blackbox *D, const Field &F, const Block &U0, const Block& V0, bool denseblock= true) 
-			: BlackboxBlockContainerBase<Field,_Blackbox> (D, F,U0.rowdim(), V0.coldim()),
-			  _W(D->rowdim(), V0.coldim()), _BMD(F),  _launcher(Nothing), _iter(1)
-		{ 
+		BlackboxBlockContainerRecord(const _Blackbox *D, const Field &F, const Block &U0, const Block& V0, bool denseblock= true) :
+			BlackboxBlockContainerBase<Field,_Blackbox> (D, F,U0.rowdim(), V0.coldim()),
+			_W(D->rowdim(), V0.coldim()), _BMD(F),  _launcher(Nothing), _iter(1)
+		{
 #ifdef _BBC_TIMING
 			clearTimer();
 			tSequence.clear();
@@ -183,9 +196,9 @@ namespace LinBox
 #endif
 			this->init (U0, V0);
 
-			
+
 			_rep = std::vector<Value> (this->_size);
-			_Vcopy = this->_V;		
+			_Vcopy = this->_V;
 			if (denseblock) {
 				for (size_t i=0;i< this->_size;++i){
 					_rep[i] = this->_value;
@@ -201,35 +214,35 @@ namespace LinBox
 				for (size_t i=0;i<block;++i)
 					for (size_t j=0;j<N;++j)
 						F.assign(_Special_U[i][j], U0.getEntry(0, i*N+j));
-				
+
 				for (size_t i=0;i< this->_size-3;++i){
 					_launch_record_notdense();
-					_rep[i] = this->_value;					
+					_rep[i] = this->_value;
 				}
-				
+
 			}
 
-			this->_value=_rep[0];		
+			this->_value=_rep[0];
 #ifdef _BBC_TIMING
 			tSequence.stop();
 			ttSequence += tSequence;
-#endif			
+#endif
 		}
-    
+
 		//  constructor of the sequence from a blackbox, a field and two blocks random projection
-		BlackboxBlockContainerRecord(const _Blackbox *D, const Field &F, size_t m, size_t n, size_t seed= time(NULL)) 
-			: BlackboxBlockContainerBase<Field, _Blackbox> (D, F, m, n,seed),
-			  _W(D->rowdim(), n), _BMD(F), _launcher(Nothing), _iter(1)
-		{ 
+		BlackboxBlockContainerRecord(const _Blackbox *D, const Field &F, size_t m, size_t n, size_t seed= time(NULL)) :
+			BlackboxBlockContainerBase<Field, _Blackbox> (D, F, m, n,seed),
+			_W(D->rowdim(), n), _BMD(F), _launcher(Nothing), _iter(1)
+		{
 #ifdef _BBC_TIMING
 			clearTimer();
 			tSequence.clear();
 			tSequence.start();
-#endif	
+#endif
 			this->init (m,n);
 			_rep = std::vector<Value> (this->_size);
-			_Vcopy = this->_V;	
-			for (size_t i=0;i< this->_size;++i){	
+			_Vcopy = this->_V;
+			for (size_t i=0;i< this->_size;++i){
 				_rep[i] = this->_value;
 				_launch_record();
 			}
@@ -240,21 +253,22 @@ namespace LinBox
 #endif
 		}
 
-    
-		void setU (const std::vector<Element> &b, size_t k){
+
+		void setU (const std::vector<Element> &b, size_t k)
+		{
 			linbox_check( b.size() == this->_row);
-			_launcher = RowUpdate; 
+			_launcher = RowUpdate;
 			_upd_idx  = k;
 			_u        = b;
 			_w.resize(this->_row);
 			_iter     = 1;
 			_case     = 1;
-#ifdef _BBC_TIMING			
+#ifdef _BBC_TIMING
 			tSequence.clear();
 			tSequence.start();
 #endif
 			std::vector<Element> _row_value(this->_n);
-			_BMD.mul(_row_value, b, _Vcopy);						
+			_BMD.mul(_row_value, b, _Vcopy);
 			this->_value  = _rep[0];
 			for (size_t j=0; j< this->_n; ++j)
 				this->_value.setEntry(_upd_idx, j, _row_value[j]);
@@ -262,18 +276,19 @@ namespace LinBox
 			tSequence.stop();
 			ttSequence += tSequence;
 #endif
-}
+		}
 
-		void setV (const std::vector<Element> &b, size_t k){
+		void setV (const std::vector<Element> &b, size_t k)
+		{
 
 			linbox_check( b.size() == this->_col);
-			_launcher = ColUpdate; 
+			_launcher = ColUpdate;
 			_upd_idx  = k;
 			_u        = b;
 			_w.resize(this->_col);
 			_iter     = 1;
 			_case     = 1;
-#ifdef _BBC_TIMING			
+#ifdef _BBC_TIMING
 			tSequence.clear();
 			tSequence.start();
 #endif
@@ -281,24 +296,25 @@ namespace LinBox
 			_BMD.mul(_col_value, this->_U, b);
 			this->_value  = _rep[0];
 			for (size_t j=0; j< this->_m; ++j)
-				this->_value.setEntry(j, _upd_idx, _col_value[j]);			
+				this->_value.setEntry(j, _upd_idx, _col_value[j]);
 #ifdef __BBC_TIMING
 			tSequence.stop();
 			ttSequence += tSequence;
-#endif	
-	}
+#endif
+		}
 
 
-		void recompute() {
+		void recompute()
+		{
 			switch(_launcher) {
 			case Nothing:
 				this->_value=_rep[0];
 				_iter=1;
 				break;
 			case RowUpdate:
-#ifdef _BBC_TIMING			
-			tSequence.clear();
-			tSequence.start();
+#ifdef _BBC_TIMING
+				tSequence.clear();
+				tSequence.start();
 #endif
 				for (size_t i=0;i< this->_size;++i){
 					_rep[i]=this->_value;
@@ -308,16 +324,16 @@ namespace LinBox
 				this->_value=_rep[0];
 				_iter=1;
 #ifdef _BBC_TIMING
-			tSequence.stop();
-			ttSequence += tSequence;
-#endif	
+				tSequence.stop();
+				ttSequence += tSequence;
+#endif
 				break;
 			case ColUpdate:
-#ifdef _BBC_TIMING			
-			tSequence.clear();
-			tSequence.start();
-#endif	
-			for (size_t i=0;i< this->_size;++i){
+#ifdef _BBC_TIMING
+				tSequence.clear();
+				tSequence.start();
+#endif
+				for (size_t i=0;i< this->_size;++i){
 					_rep[i]=this->_value;
 					_launch_record_col();
 				}
@@ -326,31 +342,33 @@ namespace LinBox
 				_iter=1;
 				break;
 #ifdef _BBC_TIMING
-			tSequence.stop();
-			ttSequence += tSequence;
+				tSequence.stop();
+				ttSequence += tSequence;
 #endif
 			default :
 				throw LinboxError ("Bad argument in BlackboxBlockContainerRecord, _launch() function\n");
 				break;
-			}				
+			}
 		}
 
 
-#ifdef _BBC_TIMING		
-		void clearTimer() {
+#ifdef _BBC_TIMING
+		void clearTimer()
+		{
 			ttSequence.clear();
 		}
 
-		void printTimer() {
+		void printTimer()
+		{
 			std::cout<<"Sequence Computation "<<ttSequence<<std::endl<<std::endl;
 		}
-#endif	
-		
+#endif
+
 		const std::vector<Value>& getRep() const { return _rep;}
-		
 
-	protected: 	
-		
+
+	protected:
+
 		Block                           _W;
 		Block                       _Vcopy;
 		BlasMatrixDomain<Field>       _BMD;
@@ -360,62 +378,67 @@ namespace LinBox
 		std::vector<Element>            _w;
 		Launcher                 _launcher;
 		size_t                       _iter;
-		size_t                       _case; 
-		std::vector<std::vector<Element> > _Special_U; 
-#ifdef _BBC_TIMING		
+		size_t                       _case;
+		std::vector<std::vector<Element> > _Special_U;
+#ifdef _BBC_TIMING
 		Timer        ttSequence, tSequence;
-#endif	
-		
-		// launcher of computation of sequence element 
-		void _launch_record () {
-			if (this->casenumber) {	
+#endif
+
+		// launcher of computation of sequence element
+		void _launch_record ()
+		{
+			if (this->casenumber) {
 				Mul(_W,*this->_BB,this->_V);
 				_BMD.mul(this->_value, this->_U, _W);
 				this->casenumber = 0;
-			} else { 
+			}
+			else {
 				Mul(this->_V,*this->_BB,_W);
 				_BMD.mul(this->_value, this->_U, this->_V);
 				this->casenumber = 1;
-			}  
+			}
 		}
 
 
-		// launcher of computation of sequence element 
-		void _launch_record_notdense () {
+		// launcher of computation of sequence element
+		void _launch_record_notdense ()
+		{
 			size_t block= this->_V.coldim();
 			size_t numblock=_Special_U[0].size();
-			if (this->casenumber) {	
+			if (this->casenumber) {
 				Mul(_W,*this->_BB,this->_V);
-			
+
 				std::vector<Element> tmp(block);
 				for (size_t i=0; i<block; ++i){
-					BlasMatrix<Element> T(_W, i*numblock, 0, numblock, block); 
+					BlasMatrix<Element> T(_W, i*numblock, 0, numblock, block);
 					_BMD.mul(tmp, _Special_U[i], T);
 					for (size_t j=0;j<block;++j){
 						this->_F.assign(this->_value.refEntry(i,j), tmp[j]);
 					}
 				}
-			
+
 				this->casenumber = 0;
-			} else { 
+			}
+			else {
 				Mul(this->_V,*this->_BB,_W);
-			
+
 				std::vector<Element> tmp(block);
 				for (size_t i=0; i< block; ++i){
 					BlasMatrix<Element> T(this->_V, i*numblock, 0, numblock, block);
 					_BMD.mul(tmp, _Special_U[i], T);
 					for (size_t j=0;j<block;++j)
-						this->_F.assign(this->_value.refEntry(i,j), tmp[j]);					
-				}			
-			
+						this->_F.assign(this->_value.refEntry(i,j), tmp[j]);
+				}
+
 				this->casenumber = 1;
-			}  
+			}
 		}
 
 
 		// launcher of computation of sequence element
 		// just update one row in the sequence element
-		void _launch_record_row() {
+		void _launch_record_row()
+		{
 			if ( _iter < this->_size) {
 				if ( _case == 1) {
 					this->_BB->applyTranspose(_w,_u);
@@ -423,7 +446,7 @@ namespace LinBox
 					_BMD.mul(_row_value, _w, _Vcopy);
 					this->_value  = _rep[_iter];
 					for (size_t j=0; j< this->_n; ++j)
-						this->_value.setEntry(_upd_idx, j, _row_value[j]);						
+						this->_value.setEntry(_upd_idx, j, _row_value[j]);
 					++_iter;
 					_case =0;
 				}
@@ -437,12 +460,13 @@ namespace LinBox
 					++_iter;
 					_case =1;
 				}
-			}			
+			}
 		}
 
 		// launcher of computation of sequence element
 		// just update one col in the sequence element
-		void _launch_record_col() {
+		void _launch_record_col()
+		{
 			if ( _iter < this->_size) {
 				if ( _case == 1) {
 					this->_BB->apply(_w,_u);
@@ -460,19 +484,20 @@ namespace LinBox
 					_BMD.mul(_col_value, this->_U, _u);
 					this->_value  = _rep[_iter];
 					for (size_t j=0; j< this->_m; ++j)
-						this->_value.setEntry(j, _upd_idx, _col_value[j]);					
+						this->_value.setEntry(j, _upd_idx, _col_value[j]);
 					++_iter;
 					_case =1;
 				}
-			}			
+			}
 		}
 
 		// launcher which be used as iterator on the sequence
-		void _launch()  { 
+		void _launch()
+		{
 			switch (_launcher) {
 			case Nothing:
 				if (_iter < this->_size)
-					this->_value = _rep[_iter];				
+					this->_value = _rep[_iter];
 				++_iter;
 				break;
 			case RowUpdate:
@@ -489,8 +514,9 @@ namespace LinBox
 
 		void _wait () {}
 	};
- 
+
 }
 
-#endif // __BLACKBOX_BLOCK_CONTAINER_H
+#undef _BBC_TIMING
 
+#endif // __LINBOX_blackbox_block_container_H
diff --git a/linbox/algorithms/blackbox-container-base.h b/linbox/algorithms/blackbox-container-base.h
index bf72c62..fc33908 100644
--- a/linbox/algorithms/blackbox-container-base.h
+++ b/linbox/algorithms/blackbox-container-base.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/algorithms/blackbox-container.h
  * Copyright (C) 1999, 2001 Jean-Guillaume Dumas
  *
@@ -21,145 +21,151 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#ifndef __LINBOX_blackbox_container_base_H
+#define __LINBOX_blackbox_container_base_H
+
 // ================================================================
-// LinBox Project 1999
 // Base ForwardIterator wrapper for BlackBoxes
 // Have to be provided :
 // - launch : launches the following computation
 // - wait   : waits for the end of the current computation
-// Time-stamp: <26 May 00 17:38:58 Jean-Guillaume.Dumas at imag.fr> 
 // ================================================================
 
-#ifndef __BLACKBOX_CONTAINER_BASE_H
-#define __BLACKBOX_CONTAINER_BASE_H
 
 #include "linbox/vector/vector-domain.h"
 
-namespace LinBox 
+namespace LinBox
 {
 
 #ifndef MIN
 #  define MIN(a,b) ((a)<(b)?(a):(b))
 #endif
 
-/** \brief A base class for BlackboxContainer.
-  * The primary member function is begin().
-
-  * It returns an iterator which after i increments (++) dereferences to 
-  * $v^T A^i u$, for $v$ and $u$ determined by the form of construction.
-  * It is designed to be used with implementations of Berlekamp-Massey
-  * such as MasseyDom.
-  *
-  * Subclasses complete the implementation by defining _launch() and _wait().
-  */
-
-template<class Field, class Blackbox>
-class BlackboxContainerBase {
-    public:
-	typedef typename Field::Element Element;      
-
-        //-- Constructors
-	BlackboxContainerBase () {} 
-
-	BlackboxContainerBase (const Blackbox *BB, const Field &F)
-		: _F (F), _VD (F), _BB (BB), _size (MIN (BB->rowdim (), BB->coldim ())) { _size <<= 1; }
-	
-	// Pascal Giorgi 16.02.2004
-	BlackboxContainerBase (const Blackbox *BB, const Field &F, unsigned long size)
-		: _F (F), _VD (F), _BB (BB), _size (size) {}
-
-	virtual ~BlackboxContainerBase ()
-	{ }//delete _BB; }
-
-	class const_iterator {
-		BlackboxContainerBase<Field, Blackbox> &_c;
-	public:
-		const_iterator () {}
-		const_iterator (BlackboxContainerBase<Field, Blackbox> &C) : _c (C) {}
-		const_iterator &operator ++ () { _c._launch (); return *this; }
-		const Element  &operator *  () { _c._wait ();   return _c.getvalue (); }
-	};
-
-	const_iterator begin () { return const_iterator (*this); }
-	const_iterator end   () { return const_iterator (); }
-
-	long         size     () const { return _size; }
-	const Field &getField () const { return _F; }
-	Blackbox    *getBB    () const { return _BB; }
+	/** \brief A base class for BlackboxContainer.
+	 * The primary member function is begin().
 
-    protected:
-
-	friend class const_iterator;
-    
-	/** Launches a process to do the computation of the next sequence 
-	 *  value: $v^T A^{i+1} u$.  ...or just does it.
+	 * It returns an iterator which after i increments (++) dereferences to
+	 * $v^T A^i u$, for $v$ and $u$ determined by the form of construction.
+	 * It is designed to be used with implementations of Berlekamp-Massey
+	 * such as MasseyDom.
+	 *
+	 * Subclasses complete the implementation by defining _launch() and _wait().
 	 */
-	virtual void _launch() = 0;
 
-	/** If a separate process is computing the next value of $v^T A^{i+1} u$,
-	 * _wait() blocks until the value is ready.
-	 */
-	virtual void _wait() = 0;
-
-	//-------------- 
-	/// Members
-	//--------------  
-
-	Field                _F;
-	VectorDomain<Field>  _VD;
-	const Blackbox            *_BB;
-    
-	long                 _size;
-
-        // BDS 22.03.03
-	long                 casenumber;
-	std::vector<Element>    u, v;
-	Element              _value;
-
-	const Element &getvalue() { return _value; }
-
-	//-------------- 
-	/// Initializers
-	//--------------  
-
-        /// User Left and Right vectors 
-	template<class Vector1, class Vector2>
-	Element &init (const Vector1& uu, const Vector2& vv) {
-		casenumber = 1;
-		u.resize(uu.size());
-		std::copy(uu.begin(),uu.end(),u.begin());
-		//u = uu;
-		v.resize(vv.size());
-		std::copy(vv.begin(),vv.end(),v.begin());
-		//v = vv;
-                    // JGD 22.03.03
-// 		return _VD.dot (_value, u, u);
-		return _VD.dot (_value, u, v);
-	}
-
-        /// Random Left vectors, Zero Right vector
-	template<class RandIter>
-	Element &init (RandIter& g)
-	{
-		casenumber = 1;
-		u.resize (_BB->coldim ());
-		for (long i = u.size (); i--;)
-			g.random (u[i]);
-		v.resize (_BB->rowdim ());
-		return _VD.dot (_value, u, u);
-	}
-
-        /// User Left vectors, Zero Right vector
-	template<class Vector>
-	Element &init (const Vector& uu) {
-		casenumber = 1;
-		u.resize(uu.size());
-		std::copy(uu.begin,uu.end(),u.begin());
-		v.resize (_BB->rowdim ());
-		return _VD.dot (_value, u, u);
-	}
-};
- 
+	template<class Field, class Blackbox>
+	class BlackboxContainerBase {
+	public:
+		typedef typename Field::Element Element;
+
+		//-- Constructors
+		BlackboxContainerBase () {}
+
+		BlackboxContainerBase (const Blackbox *BB, const Field &F) :
+			_F (F), _VD (F), _BB (BB), _size (MIN (BB->rowdim (), BB->coldim ()))
+		{ _size <<= 1; }
+
+		// Pascal Giorgi 16.02.2004
+		BlackboxContainerBase (const Blackbox *BB, const Field &F, unsigned long size) :
+			_F (F), _VD (F), _BB (BB), _size (size)
+		{}
+
+		virtual ~BlackboxContainerBase ()
+		{
+			//delete _BB;
+		}
+
+		class const_iterator {
+			BlackboxContainerBase<Field, Blackbox> &_c;
+		public:
+			//const_iterator () {} // BB ??
+			const_iterator (BlackboxContainerBase<Field, Blackbox> &C) :
+				_c (C)
+			{}
+			const_iterator &operator ++ () { _c._launch (); return *this; }
+			const Element  &operator *  () { _c._wait ();   return _c.getvalue (); }
+		};
+
+		const_iterator begin () { return const_iterator (*this); }
+		const_iterator end   () { return const_iterator (); }
+
+		long         size     () const { return _size; }
+		const Field &getField () const { return _F; }
+		Blackbox    *getBB    () const { return _BB; }
+
+	protected:
+
+		friend class const_iterator;
+
+		/** Launches a process to do the computation of the next sequence
+		 *  value: $v^T A^{i+1} u$.  ...or just does it.
+		 */
+		virtual void _launch() = 0;
+
+		/** If a separate process is computing the next value of $v^T A^{i+1} u$,
+		 * _wait() blocks until the value is ready.
+		 */
+		virtual void _wait() = 0;
+
+		//--------------
+		/// Members
+		//--------------
+
+		Field                _F;
+		VectorDomain<Field>  _VD;
+		const Blackbox            *_BB;
+
+		long                 _size;
+
+		// BDS 22.03.03
+		long                 casenumber;
+		std::vector<Element>    u, v;
+		Element              _value;
+
+		const Element &getvalue() { return _value; }
+
+		//--------------
+		/// Initializers
+		//--------------
+
+		/// User Left and Right vectors
+		template<class Vector1, class Vector2>
+		Element &init (const Vector1& uu, const Vector2& vv) {
+			casenumber = 1;
+			u.resize(uu.size());
+			std::copy(uu.begin(),uu.end(),u.begin());
+			//u = uu;
+			v.resize(vv.size());
+			std::copy(vv.begin(),vv.end(),v.begin());
+			//v = vv;
+			// JGD 22.03.03
+			// 		return _VD.dot (_value, u, u);
+			return _VD.dot (_value, u, v);
+		}
+
+		/// Random Left vectors, Zero Right vector
+		template<class RandIter>
+		Element &init (RandIter& g)
+		{
+			casenumber = 1;
+			u.resize (_BB->coldim ());
+			for (long i = u.size (); i--;)
+				g.random (u[i]);
+			v.resize (_BB->rowdim ());
+			return _VD.dot (_value, u, u);
+		}
+
+		/// User Left vectors, Zero Right vector
+		template<class Vector>
+		Element &init (const Vector& uu) {
+			casenumber = 1;
+			u.resize(uu.size());
+			std::copy(uu.begin,uu.end(),u.begin());
+			v.resize (_BB->rowdim ());
+			return _VD.dot (_value, u, u);
+		}
+	};
+
 }
 
-#endif // __BLACKBOX_CONTAINER_BASE_H
+#endif // __LINBOX_blackbox_container_base_H
+
diff --git a/linbox/algorithms/blackbox-container-symmetric.h b/linbox/algorithms/blackbox-container-symmetric.h
index 1394fe8..f17a3b5 100644
--- a/linbox/algorithms/blackbox-container-symmetric.h
+++ b/linbox/algorithms/blackbox-container-symmetric.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/algorithms/blackbox-container.h
  * Copyright (C) 1999, 2001 Jean-Guillaume Dumas, Bradford Hovinen
  *
@@ -16,14 +16,14 @@
 
 // ================================================================
 // LinBox Project 1999
-// Black Box iterator and container 
+// Black Box iterator and container
 // For symmetric matrix with same left and right vector
-// the sequence is this->u^t this->v, this->u^t A this->v, ...,  this->u^t A^n this->v,  
-// Time-stamp: <25 Jan 02 16:04:24 Jean-Guillaume.Dumas at imag.fr> 
+// the sequence is this->u^t this->v, this->u^t A this->v, ...,  this->u^t A^n this->v,
+// Time-stamp: <25 Jan 02 16:04:24 Jean-Guillaume.Dumas at imag.fr>
 // ================================================================
 
-#ifndef __BLACKBOX_CONTAINER_SYMMETRIC_H
-#define __BLACKBOX_CONTAINER_SYMMETRIC_H
+#ifndef __LINBOX_blackbox_container_symmetric_H
+#define __LINBOX_blackbox_container_symmetric_H
 
 #include "linbox/randiter/archetype.h"
 
@@ -32,50 +32,53 @@
 namespace LinBox
 {
 
-/// \brief See base class for doc.
-template<class Field, class _Blackbox, class RandIter = typename Field::RandIter>
-class BlackboxContainerSymmetric : public BlackboxContainerBase<Field, _Blackbox>
-{
-    public:
-	typedef _Blackbox Blackbox;
+	/// \brief See base class for doc.
+	template<class Field, class _Blackbox, class RandIter = typename Field::RandIter>
+	class BlackboxContainerSymmetric : public BlackboxContainerBase<Field, _Blackbox> {
+	public:
+		typedef _Blackbox Blackbox;
+
+		BlackboxContainerSymmetric () {}
 
-	BlackboxContainerSymmetric () {}
-	
-	template<class Vector>
-	BlackboxContainerSymmetric (const Blackbox *D, const Field &F, const Vector &u0)
-		: BlackboxContainerBase<Field, _Blackbox> (D, F)
+		template<class Vector>
+		BlackboxContainerSymmetric (const Blackbox *D, const Field &F, const Vector &u0) :
+			BlackboxContainerBase<Field, _Blackbox> (D, F)
 		{ init (u0, u0); }
-	BlackboxContainerSymmetric (const Blackbox *D, const Field &F, RandIter &g)
-		: BlackboxContainerBase<Field, _Blackbox> (D, F)
+		BlackboxContainerSymmetric (const Blackbox *D, const Field &F, RandIter &g) :
+			BlackboxContainerBase<Field, _Blackbox> (D, F)
 		{ init (g); }
 
-    protected:
+	protected:
 
-	void _launch () {
-		if (this->casenumber > 0) {
-			if (this->casenumber == 1) {
-				this->casenumber = 2;
-				this->_BB->apply (this->v, this->u);          // this->v <- B(B^i u_0) = B^(i+1) u_0
-				this->_VD.dot (this->_value, this->u, this->v);     // t <- this->u^t this->v = u_0^t B^(2i+1) u_0
-			} else {
-				this->casenumber = -1;
-				this->_VD.dot (this->_value, this->v, this->v);     // t <- this->v^t this->v = u_0^t B^(2i+2) u_0
+		void _launch ()
+		{
+			if (this->casenumber > 0) {
+				if (this->casenumber == 1) {
+					this->casenumber = 2;
+					this->_BB->apply (this->v, this->u);                // this->v <- B(B^i u_0) = B^(i+1) u_0
+					this->_VD.dot (this->_value, this->u, this->v);     // t <- this->u^t this->v = u_0^t B^(2i+1) u_0
+				}
+				else {
+					this->casenumber = -1;
+					this->_VD.dot (this->_value, this->v, this->v);     // t <- this->v^t this->v = u_0^t B^(2i+2) u_0
+				}
+			}
+			else {
+				if (this->casenumber == 0) {
+					this->casenumber = 1;
+					this->_VD.dot (this->_value, this->u, this->u);     // t <- this->u^t this->u = u_0^t B^(2i+4) u_0
+				}
+				else {
+					this->casenumber = 0;
+					this->_BB->apply (this->u, this->v);                // this->u <- B(B^(i+1) u_0) = B^(i+2) u_0
+					this->_VD.dot (this->_value, this->v, this->u);     // t <- this->v^t this->u = u_0^t B^(2i+3) u_0
+				}
 			}
-		} else {
-			if (this->casenumber == 0) {
-				this->casenumber = 1;
-				this->_VD.dot (this->_value, this->u, this->u);     // t <- this->u^t this->u = u_0^t B^(2i+4) u_0
-			} else {
-				this->casenumber = 0;
-				this->_BB->apply (this->u, this->v);          // this->u <- B(B^(i+1) u_0) = B^(i+2) u_0
-				this->_VD.dot (this->_value, this->v, this->u);     // t <- this->v^t this->u = u_0^t B^(2i+3) u_0
-			}   
 		}
-	}
-    
-	void _wait () {}
-};
- 
+
+		void _wait () {}
+	};
+
 }
 
-#endif // __BLACKBOX_CONTAINER_SYMMETRIC_H
+#endif // __LINBOX_blackbox_container_symmetric_H
diff --git a/linbox/algorithms/blackbox-container-symmetrize.h b/linbox/algorithms/blackbox-container-symmetrize.h
index 8a0f30d..8898668 100644
--- a/linbox/algorithms/blackbox-container-symmetrize.h
+++ b/linbox/algorithms/blackbox-container-symmetrize.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/algorithms/blackbox-container-symmetrize.h
  * Copyright (C) 1999, 2001 Jean-Guillaume Dumas
  *
@@ -15,61 +15,76 @@
  * See COPYING for license information.
  */
 
-#ifndef __BLACKBOX_CONTAINER_SYMMETRIZE_H
-#define __BLACKBOX_CONTAINER_SYMMETRIZE_H
+/*! @internal
+ * @file algorithms/blackbox-containter-symetrize.h
+ * @ingroup algorithms
+ * @brief Symmetrizing iterator for rank computations
+ */
+
+#ifndef __LINBOX_blackbox_container_symmetrize_H
+#define __LINBOX_blackbox_container_symmetrize_H
 
 #include <linbox/algorithms/blackbox-container-base.h>
 
-namespace LinBox 
+namespace LinBox
 {
 
-/** \brief Symmetrizing iterator (for rank computations).
-
- #
-//================================================================
-// LinBox Project 1999
-// Symmetrizing iterator (for rank computations)
-// Same left and right vector
-// A is supposed to have tranpose-vector product
-// the sequence is this->u^t this->u, (A this->u)^t (A this->u) = this->u^t (A^t A) this->u, 
-// (A^t (A this->u))^t (A^t (A this->u)) = this->u^t (A^t A)^2 this->u , etc.
-// Time-stamp: <13 Jun 02 18:16:43 Jean-Guillaume.Dumas at imag.fr> 
-// ================================================================
- #
- */
+	/** \brief Symmetrizing iterator (for rank computations).
+	 * @ingroup algorithms
+	 *
+	 * Symmetrizing iterator (for rank computations)
+	 * Same left and right vector
+	 * A is supposed to have tranpose-vector product
+	 * the sequence is
+	 *
+	 \code
+	 this->u^t this->u
+	 (A this->u)^t (A this->u) = this->u^t (A^t A) this->u
+	 (A^t (A this->u))^t (A^t (A this->u)) = this->u^t (A^t A)^2 this->u
+	 etc.
+	 \endcode
+	 */
 
 	template<class Field, class _Blackbox, class RandIter = typename Field::RandIter>
 	class BlackboxContainerSymmetrize : public BlackboxContainerBase<Field, _Blackbox> {
-	    public:
+	public:
 
-                typedef _Blackbox Blackbox;
+		typedef _Blackbox Blackbox;
 
-		BlackboxContainerSymmetrize () {} 
+		BlackboxContainerSymmetrize () {}
 
 		template<class Vector>
-		BlackboxContainerSymmetrize (const Blackbox *D, const Field &F, const Vector &u0) 
-			: BlackboxContainerBase<Field, Blackbox> (D, F) { init (u0); }
-    
-		//BlackboxContainerSymmetrize (const Blackbox *D, const Field &F, RandIter &g = typename Field::RandIter(_F) ) 
-		BlackboxContainerSymmetrize (const Blackbox *D, const Field &F, RandIter &g = typename Field::RandIter() ) 
-			: BlackboxContainerBase<Field, Blackbox> (D, F) { init (g); }
+		BlackboxContainerSymmetrize (const Blackbox *D, const Field &F, const Vector &u0) :
+			BlackboxContainerBase<Field, Blackbox> (D, F)
+		{
+		       	init (u0);
+	       	}
+
+		//BlackboxContainerSymmetrize (const Blackbox *D, const Field &F, RandIter &g = typename Field::RandIter(_F) )
+		BlackboxContainerSymmetrize (const Blackbox *D, const Field &F, RandIter &g = typename Field::RandIter() ) :
+			BlackboxContainerBase<Field, Blackbox> (D, F)
+		{
+		       	init (g);
+	       	}
 
-	    private:
-		void _launch () {
+	private:
+		void _launch ()
+		{
 			if (this->casenumber) {
 				this->casenumber = 0;
 				this->_BB->apply (this->v, this->u);
-				this->_VD.dot (this->_value, this->v, this->v); 
-			} else {
+				this->_VD.dot (this->_value, this->v, this->v);
+			}
+			else {
 				this->casenumber = 1;
-				this->_BB->applyTranspose (this->u, this->v); 
+				this->_BB->applyTranspose (this->u, this->v);
 				this->_VD.dot (this->_value, this->u, this->u);
 			}
 		}
 
 		void _wait () {}
 	};
- 
-};
 
-#endif // __BLACKBOX_CONTAINER_SYMMETRIZE_H
+}
+
+#endif // __LINBOX_blackbox_container_symmetrize_H
diff --git a/linbox/algorithms/blackbox-container.h b/linbox/algorithms/blackbox-container.h
index 9713357..8432399 100644
--- a/linbox/algorithms/blackbox-container.h
+++ b/linbox/algorithms/blackbox-container.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/algorithms/blackbox-container.h
  * Copyright (C) 1999, 2001 Jean-Guillaume Dumas, Bradford Hovinen
  *
@@ -11,127 +11,136 @@
  * See COPYING for license information.
  */
 
-#ifndef __BLACKBOX_CONTAINER_H
-#define __BLACKBOX_CONTAINER_H
+#ifndef __LINBOX_blackbox_container_H
+#define __LINBOX_blackbox_container_H
 
 #include <linbox/randiter/archetype.h>
 #include <linbox/algorithms/blackbox-container-base.h>
 #include <linbox/util/timer.h>
 
-namespace LinBox 
+namespace LinBox
 {
 
-/// \brief Limited doc so far.
-template<class Field, class _Blackbox, class RandIter = typename Field::RandIter>
-class BlackboxContainer : public BlackboxContainerBase<Field, _Blackbox> {
-    public:
-	typedef _Blackbox Blackbox;
+	/// \brief Limited doc so far.
+	template<class Field, class _Blackbox, class RandIter = typename Field::RandIter>
+	class BlackboxContainer : public BlackboxContainerBase<Field, _Blackbox> {
+	public:
+		typedef _Blackbox Blackbox;
 
-	BlackboxContainer () {} 
+		BlackboxContainer () {}
 
-	template<class Vector>
+		template<class Vector>
 
-	BlackboxContainer(const Blackbox * D, const Field &F, const Vector &u0) 
-		: BlackboxContainerBase<Field, Blackbox> (D, F)
-	{
-		init (u0, u0); w = this->u;
+		BlackboxContainer(const Blackbox * D, const Field &F, const Vector &u0) :
+			BlackboxContainerBase<Field, Blackbox> (D, F)
+		{
+			init (u0, u0); w = this->u;
 #ifdef INCLUDE_TIMING
-		_applyTime = _dotTime = 0.0;
+			_applyTime = _dotTime = 0.0;
 #endif
-	}
-
-	// Pascal Giorgi 16.02.2004
-	template<class Vector>
-	BlackboxContainer(const Blackbox * D, const Field &F, const Vector &u0, unsigned long size) 
-		: BlackboxContainerBase<Field, Blackbox> (D, F,size)
-	{
-		init (u0, u0); w = this->u;
+		}
+
+		// Pascal Giorgi 16.02.2004
+		template<class Vector>
+		BlackboxContainer(const Blackbox * D, const Field &F, const Vector &u0, unsigned long size) :
+			BlackboxContainerBase<Field, Blackbox> (D, F,size)
+		{
+			init (u0, u0); w = this->u;
 #ifdef INCLUDE_TIMING
-		_applyTime = _dotTime = 0.0;
+			_applyTime = _dotTime = 0.0;
 #endif
-	}
-
-    
-	template<class Vector1, class Vector2>
-	BlackboxContainer(const Blackbox * D, const Field &F, const Vector1 &u0, const Vector2& v0) 
-		: BlackboxContainerBase<Field, Blackbox> (D, F)
-	{
-		init (u0, v0); w = this->v;
+		}
+
+
+		template<class Vector1, class Vector2>
+		BlackboxContainer(const Blackbox * D, const Field &F, const Vector1 &u0, const Vector2& v0) :
+			BlackboxContainerBase<Field, Blackbox> (D, F)
+		{
+			init (u0, v0); w = this->v;
 #ifdef INCLUDE_TIMING
-		_applyTime = _dotTime = 0.0;
+			_applyTime = _dotTime = 0.0;
 #endif
-	}
-    
-	BlackboxContainer(const Blackbox * D, const Field &F, RandIter &g) 
-		: BlackboxContainerBase<Field, Blackbox> (D, F)
-	{
-		init (g); w = this->u;
+		}
+
+		BlackboxContainer(const Blackbox * D, const Field &F, RandIter &g) :
+			BlackboxContainerBase<Field, Blackbox> (D, F)
+		{
+			this->casenumber = 1;
+			this->u.resize (this->_BB->coldim ());
+			for (long i = this->u.size (); i--;)
+				g.random (this->u[i]);
+			this->w.resize (this->_BB->coldim ());
+			for (long i = this->w.size (); i--;)
+				g.random (this->w[i]);
+			this->v.resize (this->_BB->rowdim ());
+			this->_VD.dot (this->_value, this->u, this->w);
 #ifdef INCLUDE_TIMING
-		_applyTime = _dotTime = 0.0;
+			_applyTime = _dotTime = 0.0;
 #endif
-	}
+		}
 
 #ifdef INCLUDE_TIMING
-	double applyTime () const { return _applyTime; }
-	double dotTime   () const { return _dotTime; }
+		double applyTime () const { return _applyTime; }
+		double dotTime   () const { return _dotTime; }
 #endif // INCLUDE_TIMING
 
-    protected:
-	std::vector<typename Field::Element> w;
+	protected:
+		std::vector<typename Field::Element> w;
 
 #ifdef INCLUDE_TIMING
-	Timer _timer;
-	double _applyTime, _dotTime;
+		Timer _timer;
+		double _applyTime, _dotTime;
 #endif // INCLUDE_TIMING
 
-	void _launch () {
-		if (this->casenumber) {
+		void _launch () {
+			if (this->casenumber) {
 #ifdef INCLUDE_TIMING
-			_timer.start ();
+				_timer.start ();
 #endif // INCLUDE_TIMING
-			this->_BB->apply (this->v, w);  // GV
+				this->_BB->apply (this->v, w);  // GV
 
 #ifdef INCLUDE_TIMING
-			_timer.stop ();
-			_applyTime += _timer.realtime ();
-			_timer.start ();
+				_timer.stop ();
+				_applyTime += _timer.realtime ();
+				_timer.start ();
 #endif // INCLUDE_TIMING
 
-			this->_VD.dot (this->_value, this->u, this->v);  // GV 
+				this->_VD.dot (this->_value, this->u, this->v);  // GV
 
 #ifdef INCLUDE_TIMING
-			_timer.stop ();
-			_dotTime += _timer.realtime ();
+				_timer.stop ();
+				_dotTime += _timer.realtime ();
 #endif // INCLUDE_TIMING
 
-			this->casenumber = 0;
-		} else {
+				this->casenumber = 0;
+			}
+			else {
 #ifdef INCLUDE_TIMING
-			_timer.start ();
+				_timer.start ();
 #endif // INCLUDE_TIMING
-			this->_BB->apply (w, this->v);  // GV
+				this->_BB->apply (w, this->v);  // GV
 
 #ifdef INCLUDE_TIMING
-			_timer.stop ();
-			_applyTime += _timer.realtime ();
-			_timer.start ();
+				_timer.stop ();
+				_applyTime += _timer.realtime ();
+				_timer.start ();
 #endif // INCLUDE_TIMING
 
-			this->_VD.dot (this->_value, this->u, w);  // GV
+				this->_VD.dot (this->_value, this->u, w);  // GV
 
 #ifdef INCLUDE_TIMING
-			_timer.stop ();
-			_dotTime += _timer.realtime ();
+				_timer.stop ();
+				_dotTime += _timer.realtime ();
 #endif // INCLUDE_TIMING
 
-			this->casenumber = 1;
-		}  
-	}
+				this->casenumber = 1;
+			}
+		}
+
+		void _wait () {}
+	};
 
-	void _wait () {}
-};
- 
 }
 
-#endif // __BLACKBOX_CONTAINER_H
+#endif // __LINBOX_blackbox_container_H
 
diff --git a/linbox/algorithms/blas-domain.h b/linbox/algorithms/blas-domain.h
index 80288bd..2716ca8 100644
--- a/linbox/algorithms/blas-domain.h
+++ b/linbox/algorithms/blas-domain.h
@@ -1,10 +1,11 @@
 /* -*- 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
 /* linbox/algorithms/blas-domain.h
- * Copyright (C) 2004 Pascal Giorgi, Clément Pernet
+ * Copyright (C) 2004 Pascal Giorgi, Clément Pernet
  *
  * Written by :
  *               Pascal Giorgi  pascal.giorgi at ens-lyon.fr
- *               Clément Pernet clement.pernet at imag.fr
+ *               Clément Pernet clement.pernet at imag.fr
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -22,36 +23,45 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __BLAS_MATRIX_DOMAIN_H
-#define __BLAS_MATRIX_DOMAIN_H
+/*! @file algorithms/blas-domain.h
+ * @ingroup algorithms
+ * @brief NO DOC
+ * @warning A <code>BlasMatrixDomain<Field></code> should be templated by a
+ * \link LinBox::Modular Modular\endlink field. In particular, this domain
+ * is not suitable for integers.
+ * @warning A \e Field does mean here a \e Field and not a general \f$\mathbf{Z}/m\mathbf{Z}\f$ \e ring. You'll be warned...
+ */
+
+#ifndef __LINBOX_blas_matrix_domain_H
+#define __LINBOX_blas_matrix_domain_H
 
 #include <iostream>
 #include <vector>
-#include <linbox/ffpack/ffpack.h>
-#include <linbox/fflas/fflas.h>
+#include <fflas-ffpack/ffpack/ffpack.h>
+#include <fflas-ffpack/fflas/fflas.h>
 //#include <linbox/blackbox/permutation.h>
 #include <linbox/matrix/blas-matrix.h>
+#include <linbox/matrix/matrix-permutation.h>
 #include <linbox/util/debug.h>
 
 
+namespace LinBox
+{
 
+	const int BlasBound = 1 << 26;
 
-
-namespace LinBox {
-    
-    const int BlasBound = 1 << 26;
-
-	/**  Class handling multiplication of a Matrix by an Operand with accumulation and scaling.
+	/** @internal
+	 * Class handling multiplication of a Matrix by an Operand with accumulation and scaling.
 	 *  Operand can be either a matrix or a vector.
-	 *  
+	 *
 	 *  The only function:  operator () is defined :
-	 *       D = beta.C + alpha. A*B 
-	 *       C = beta.C + alpha. A*B  
+	 *     -  D = beta.C + alpha. A*B
+	 *     -  C = beta.C + alpha. A*B
 	 */
 	template< class Field, class Operand1, class Operand2, class Operand3>
 	class BlasMatrixDomainMulAdd {
 	public:
-		Operand1 &operator() (const Field &F, 
+		Operand1 &operator() (const Field &F,
 				      Operand1 &D,
 				      const typename Field::Element &beta, const Operand1 &C,
 				      const typename Field::Element &alpha, const Operand2 &A, const Operand3 &B) const;
@@ -62,7 +72,7 @@ namespace LinBox {
 
 
 		// allowing disymetry of Operand2 and Operand3 (only if different type)
-		Operand1 &operator() (const Field &F, 
+		Operand1 &operator() (const Field &F,
 				      Operand1 &D,
 				      const typename Field::Element &beta, const Operand1 &C,
 				      const typename Field::Element &alpha, const Operand3 &A, const Operand2 &B) const;
@@ -72,23 +82,66 @@ namespace LinBox {
 				      const typename Field::Element &alpha, const Operand3 &A, const Operand2 &B) const;
 
 
-		
+
 	};
-	
-	/*  Class handling in-place multiplication of a Matrix by an Operand 
-	 *  Operand can be either a matrix a permutation or a vector 
-	 *  
-	 *  only  function:  operator () are defined :
-	 *       A = A*B
-	 *       B = A*B
-	 * Note that in-place multiplications are proposed for the specialization 
-	 * with a matrix and a permutation.
-	 * Using mulin with two matrices is still defined but is non-sense
+
+	/*!@internal
+	 * Adding two matrices
+	 */
+	template< class Field, class Operand1, class Operand2, class Operand3>
+	class BlasMatrixDomainAdd {
+	public:
+		Operand1 &operator() (const Field &F,
+				      Operand1 &C, const Operand2 &A, const Operand3 &B) const;
+
+	};
+
+	/*!@internal
+	 * Substracting two matrices
+	 */
+	template< class Field, class Operand1, class Operand2, class Operand3>
+	class BlasMatrixDomainSub {
+	public:
+		Operand1 &operator() (const Field &F,
+				      Operand1 &C, const Operand2 &A, const Operand3 &B) const;
+
+	};
+	//! C -= A
+	template< class Field, class Operand1, class Operand2>
+	class BlasMatrixDomainSubin {
+	public:
+		Operand1 &operator() (const Field &F,
+				      Operand1 &C, const Operand2 &A) const;
+
+	};
+	//! C += A
+	template< class Field, class Operand1, class Operand2>
+	class BlasMatrixDomainAddin {
+	public:
+		Operand1 &operator() (const Field &F,
+				      Operand1 &C, const Operand2 &A) const;
+
+	};
+
+
+	/*!@internal
+	 * Copying a matrix
+	 */
+	template< class Field, class Operand1, class Operand2>
+	class BlasMatrixDomainCopy {
+	public:
+		Operand1 &operator() (const Field &F,
+				      Operand1 &B, const Operand2 &A) const;
+
+	};
+
+	/*!@internal
+	 * multiplying two matrices.
 	 */
 	template< class Field, class Operand1, class Operand2, class Operand3>
 	class BlasMatrixDomainMul {
 	public:
-		Operand1 &operator() (const Field &F, 
+		Operand1 &operator() (const Field &F,
 				      Operand1 &C, const Operand2 &A, const Operand3 &B) const
 		{
 			typename Field::Element zero, one;
@@ -97,6 +150,20 @@ namespace LinBox {
 			return BlasMatrixDomainMulAdd<Field,Operand1,Operand2,Operand3>()( F, zero, C, one, A, B );
 		}
 	};
+
+	/*! @internal
+	 * Class handling in-place multiplication of a Matrix by an Operand.
+	 *  Operand can be either a matrix a permutation or a vector
+	 *
+	 *  only  function:  operator () are defined :
+	 *     -  A = A*B
+	 *     -  B = A*B
+	 *     .
+	 * @note In-place multiplications are proposed for the specialization
+	 * with a matrix and a permutation.
+	 * @warning Using mulin with two matrices is still defined but is
+	 * non-sense
+	 */
 	// Operand 2 is always the type of the matrix which is not modified
 	// ( for example: BlasPermutation TriangularBlasMatrix )
 	template< class Field, class Operand1, class Operand2>
@@ -116,8 +183,8 @@ namespace LinBox {
 			delete tmp;
 			return A;
 		}
-		
-		Operand1 &operator() (const Field &F, 
+
+		Operand1 &operator() (const Field &F,
 				      const Operand2 &A, Operand1 &B ) const
 		{
 			typename Field::Element zero, one;
@@ -131,16 +198,18 @@ namespace LinBox {
 			return B;
 		}
 	};
-	
-	/*  Class handling inversion of a Matrix 
-	 *  
+
+	/*! @internal
+	 * Class handling inversion of a Matrix.
+	 *
 	 *  only  function:  operator () are defined :
-	 *       Ainv = A^(-1)
+	 *    -   Ainv = A^(-1)
+	 *
+	 *  Returns nullity of matrix (0 iff inversion was ok)
 	 *
-	 *  Beware, if A is not const this allows an inplace computation
+	 * @warning Beware, if A is not const this allows an inplace computation
 	 *  and so A will be modified
 	 *
-	 *  Returns nullity of matrix (0 iff inversion was ok)
 	 */
 	template< class Field, class Matrix>
 	class BlasMatrixDomainInv {
@@ -148,15 +217,14 @@ namespace LinBox {
 		int &operator() (const Field &F, Matrix &Ainv, const Matrix &A) const;
 		int &operator() (const Field &F, Matrix &Ainv, Matrix &A) const;
 	};
-	
-	
-	
-	/*  Class handling rank computation of a Matrix 
-	 *  
+
+	/*! @internal
+	 * Class handling rank computation of a Matrix.
+	 *
 	 *  only  function:  operator () are defined :
-	 *       return the rank of A 
-	 * 
-	 *  Beware, if A is not const this allows an inplace computation
+	 *    -  return the rank of A
+	 *
+	 *  @warning Beware, if A is not const this allows an inplace computation
 	 *  and so A will be modified
 	 */
 	template< class Field, class Matrix>
@@ -166,12 +234,13 @@ namespace LinBox {
 		unsigned int &operator() (const Field &F, Matrix& A) const;
 	};
 
-	/*  Class handling determinant computation of a Matrix 
-	 *  
+	/*! @internal
+	 * Class handling determinant computation of a Matrix.
+	 *
 	 *  only  function:  operator () are defined :
-	 *       return the determinant of A 
-	 * 
-	 *  Beware, if A is not const this allows an inplace computation
+	 *     -  return the determinant of A
+	 *
+	 * @warning Beware, if A is not const this allows an inplace computation
 	 *  and so A will be modified
 	 */
 	template< class Field, class Matrix>
@@ -181,13 +250,13 @@ namespace LinBox {
 		typename Field::Element operator() (const Field &F, Matrix& A) const;
 	};
 
-
-	/*  Class handling resolution of linear system of a Matrix 
+	/*! @internal
+	 * Class handling resolution of linear system of a Matrix.
 	 *  with Operand as right or left and side
-	 *  
+	 *
 	 *  only  function:  operator () are defined :
-	 *      X = A^(-1).B
-	 *      B = A^(-1).B
+	 *    -  X = A^(-1).B
+	 *    -  B = A^(-1).B
 	 */
 	template< class Field, class Operand, class Matrix>
 	class BlasMatrixDomainLeftSolve {
@@ -196,12 +265,13 @@ namespace LinBox {
 		Operand &operator() (const Field &F, const Matrix &A, Operand &B) const;
 	};
 
-	/*  Class handling resolution of linear system of a Matrix 
+	/*! @internal
+	 * Class handling resolution of linear system of a Matrix.
 	 *  with Operand as right or left and side
-	 *  
+	 *
 	 *  only  function:  operator () are defined :
-	 *      X = B.A^(-1)
-	 *      B = B.A^(-1)
+	 *   -   X = B.A^(-1)
+	 *   -   B = B.A^(-1)
 	 */
 	template< class Field, class Operand, class Matrix>
 	class BlasMatrixDomainRightSolve {
@@ -209,38 +279,42 @@ namespace LinBox {
 		Operand &operator() (const Field &F, Operand &X, const Matrix &A, const Operand &B) const;
 		Operand &operator() (const Field &F, const Matrix &A, Operand &B) const;
 	};
-	
 
+	/*! @internal
+	 * Class handling the minimal polynomial  of a Matrix.
+	 */
 	template< class Field, class Polynomial, class Matrix>
 	class BlasMatrixDomainMinpoly {
 	public:
 		Polynomial&  operator() (const Field &F, Polynomial& P, const Matrix& A) const;
 	};
 
+	/*! @internal
+	 * Class handling the characteristic polynomial  of a Matrix.
+	 */
 	template< class Field, class ContPol, class Matrix>
 	class BlasMatrixDomainCharpoly {
 	public:
-//		typedef Container<Polynomial> ContPol;
-		
+		//		typedef Container<Polynomial> ContPol;
+
 		ContPol&  operator() (const Field &F, ContPol& P, const Matrix& A) const;
 	};
 
-
-	/* 
-	 *  Interface for all functionnalities provided 
-	 *  for BlasMatrix through specialization of all  
+	/**
+	 *  Interface for all functionnalities provided
+	 *  for BlasMatrix.
+	 *  @internal
+	 *  Done through specialization of all
 	 *  classes defined above.
 	 */
-
-
 	template <class Field>
 	class BlasMatrixDomain {
 
 	public:
 		typedef typename Field::Element         Element;
-		
+
 	protected:
-    
+
 		const Field  & _F;
 		Element _One;
 		Element _Zero;
@@ -248,202 +322,317 @@ namespace LinBox {
 
 	public:
 
-		// Constructor of BlasDomain.
+		//! Constructor of BlasDomain.
 
-		BlasMatrixDomain (const Field& F ): _F(F) {  F.init(_One,1UL); F.init(_Zero,0UL);F.init(_MOne,-1);}
-	    
-		// Copy constructor
-		BlasMatrixDomain (const BlasMatrixDomain<Field> & BMD) : _F(BMD._F), _One(BMD._One), _Zero(BMD._Zero), _MOne(BMD._MOne) {}
+		BlasMatrixDomain (const Field& F ) :
+			_F(F)
+		{
+			F.init(_One,1UL);
+			F.init(_Zero,0UL);
+			F.init(_MOne,-1);
+		}
 
+		//! Copy constructor
+		BlasMatrixDomain (const BlasMatrixDomain<Field> & BMD) :
+			_F(BMD._F), _One(BMD._One), _Zero(BMD._Zero), _MOne(BMD._MOne)
+		{}
+
+
+		//! Field accessor
+		const Field& field() const
+		{
+			return _F;
+		}
 
-		// Field accessor
-		Field& field() {return _F;}
 
-			
 		/*
 		 * Basics operation available matrix respecting BlasMatrix interface
 		 */
- 
-		// multiplication
-		// C = A*B
+
+		//! multiplication.
+		//! C = A*B
 		template <class Operand1, class Operand2, class Operand3>
-		Operand1& mul(Operand1& C, const Operand2& A, const Operand3& B) const {
+		Operand1& mul(Operand1& C, const Operand2& A, const Operand3& B) const
+		{
 			return BlasMatrixDomainMul<Field,Operand1,Operand2,Operand3>()(_F,C,A,B);
 		}
 
-		
+		//! addition.
+		//! C = A+B
+		template <class Operand1, class Operand2, class Operand3>
+		Operand1& add(Operand1& C, const Operand2& A, const Operand3& B) const
+		{
+			return BlasMatrixDomainAdd<Field,Operand1,Operand2,Operand3>()(_F,C,A,B);
+		}
 
-		// multiplication with scaling
-		// C = alpha.A*B
+		//! copy.
+		//! B = A
+		template <class Operand1, class Operand2>
+		Operand1& copy(Operand1& B, const Operand2& A) const
+		{
+			return BlasMatrixDomainCopy<Field,Operand1,Operand2>()(_F,B,A);
+		}
+
+		//! substraction
+		//! C = A-B
 		template <class Operand1, class Operand2, class Operand3>
-		Operand1& mul(Operand1& C, const Element& alpha, const Operand2& A, const Operand3& B) const {
+		Operand1& sub(Operand1& C, const Operand2& A, const Operand3& B) const
+		{
+			return BlasMatrixDomainSub<Field,Operand1,Operand2,Operand3>()(_F,C,A,B);
+		}
+
+		//! substraction (in place)
+		//! C -= B
+		template <class Operand1, class Operand3>
+		Operand1& subin(Operand1& C, const Operand3& B) const
+		{
+			return BlasMatrixDomainSubin<Field,Operand1,Operand3>()(_F,C,B);
+		}
+
+		//! addition (in place)
+		//! C += B
+		template <class Operand1, class Operand3>
+		Operand1& addin(Operand1& C, const Operand3& B) const
+		{
+			return BlasMatrixDomainAddin<Field,Operand1,Operand3>()(_F,C,B);
+		}
+
+
+		//! multiplication with scaling.
+		//! C = alpha.A*B
+		template <class Operand1, class Operand2, class Operand3>
+		Operand1& mul(Operand1& C, const Element& alpha, const Operand2& A, const Operand3& B) const
+		{
 			return muladdin(_Zero,C,alpha,A,B);
 		}
 
-	
-		// In place multiplication
-		// A = A*B 
+
+		//! In place multiplication.
+		//! A = A*B
 		template <class Operand1, class Operand2>
-		Operand1& mulin_left(Operand1& A, const Operand2& B ) const { 
+		Operand1& mulin_left(Operand1& A, const Operand2& B ) const
+		{
 			return BlasMatrixDomainMulin<Field,Operand1,Operand2>()(_F,A,B);
 		}
-		
-		// In place multiplication
-		// B = A*B 
+
+		//! In place multiplication.
+		//! B = A*B
 		template <class Operand1, class Operand2>
-		Operand2& mulin_right(const Operand1& A, Operand2& B ) const { 
+		Operand2& mulin_right(const Operand1& A, Operand2& B ) const
+		{
 			return BlasMatrixDomainMulin<Field,Operand2,Operand1>()(_F,A,B);
 		}
 
-		// axpy
-		// D = A*B + C
+		//! axpy.
+		//! D = A*B + C
 		template <class Operand1, class Operand2, class Operand3>
-		Operand1& axpy(Operand1& D, const Operand2& A, const Operand3& B, const Operand1& C) const {
+		Operand1& axpy(Operand1& D, const Operand2& A, const Operand3& B, const Operand1& C) const
+		{
 			return muladd(D,_One,C,_One,A,B);
 		}
 
-		// axpyin
-		// C += A*B
+		//! axpyin.
+		//! C += A*B
 		template <class Operand1, class Operand2, class Operand3>
-		Operand1& axpyin(Operand1& C, const Operand2& A, const Operand3& B) const {
+		Operand1& axpyin(Operand1& C, const Operand2& A, const Operand3& B) const
+		{
 			return muladdin(_One,C,_One,A,B);
 		}
- 
-		// axmy
-		// D= A*B - C
+
+		//! maxpy.
+		//! D = C - A*B
+		template <class Operand1, class Operand2, class Operand3>
+		Operand1& maxpy(Operand1& D, const Operand2& A, const Operand3& B, const Operand1& C)const
+		{
+			return muladd(D,_One,C,_MOne,A,B);
+		}
+
+		//! maxpyin.
+		//! C -= A*B
+		template <class Operand1, class Operand2, class Operand3>
+		Operand1& maxpyin(Operand1& C, const Operand2& A, const Operand3& B) const
+		{
+			return muladdin(_One,C,_MOne,A,B);
+		}
+
+		//! axmy.
+		//! D= A*B - C
 		template <class Operand1, class Operand2, class Operand3>
-		Operand1& axmy(Operand1& D, const Operand2& A, const Operand3& B, const Operand1& C) const {
+		Operand1& axmy(Operand1& D, const Operand2& A, const Operand3& B, const Operand1& C) const
+		{
 			return muladd(D,_MOne,C,_One,A,B);
 		}
 
-		// axmyin
-		// C = A*B - C
+		//! axmyin.
+		//! C = A*B - C
 		template <class Operand1, class Operand2, class Operand3>
-		Operand1& axmyin(Operand1& C, const Operand2& A, const Operand3& B) const {
+		Operand1& axmyin(Operand1& C, const Operand2& A, const Operand3& B) const
+		{
 			return muladdin(_MOne,C,_One,A,B);
 		}
-		
-		//  general matrix-matrix multiplication and addition with scaling
-		// D= beta.C + alpha.A*B
+
+		//!  general matrix-matrix multiplication and addition with scaling.
+		//! D= beta.C + alpha.A*B
 		template <class Operand1, class Operand2, class Operand3>
 		Operand1& muladd(Operand1& D, const Element& beta, const Operand1& C,
-				const Element& alpha, const Operand2& A, const Operand3& B) const {
+				 const Element& alpha, const Operand2& A, const Operand3& B) const
+		{
 			return BlasMatrixDomainMulAdd<Field,Operand1,Operand2,Operand3>()(_F,D,beta,C,alpha,A,B);
 		}
-		
-		// C= beta.C + alpha.A*B
+
+		//! muladdin.
+		//! C= beta.C + alpha.A*B.
 		template <class Operand1, class Operand2, class Operand3>
 		Operand1& muladdin(const Element& beta, Operand1& C,
-				   const Element& alpha, const Operand2& A, const Operand3& B) const {
+				   const Element& alpha, const Operand2& A, const Operand3& B) const
+		{
 			return BlasMatrixDomainMulAdd<Field,Operand1,Operand2,Operand3>()(_F,beta,C,alpha,A,B);
 		}
 
 
-		/*
-		 * Solutions available for matrix respecting BlasMatrix interface
-		 */	
+		/*!
+		 * @name Solutions available for matrix respecting BlasMatrix interface
+		 */
+		//@{
 
-		// Inversion
+		//! Inversion
 		template <class Matrix>
-		Matrix& inv( Matrix &Ainv, const Matrix &A) const { 
+		Matrix& inv( Matrix &Ainv, const Matrix &A) const
+		{
 			BlasMatrixDomainInv<Field,Matrix>()(_F,Ainv,A);
 			return Ainv;
 		}
-		
-		// Inversion (the matrix A is modified)
+
+		//! Inversion (in place)
 		template <class Matrix>
-		Matrix& invin( Matrix &Ainv, Matrix &A) const { 
+		Matrix& invin( Matrix &Ainv, Matrix &A) const
+		{
 			BlasMatrixDomainInv<Field,Matrix>()(_F,Ainv,A);
 			return Ainv;
 		}
 
-		// Inversion w singular check
+		//! Inversion (the matrix A is modified)
+		template <class Matrix>
+		Matrix& invin(Matrix &A) const
+		{
+			Matrix tmp(A.rowdim(), A.coldim());
+			tmp = A;
+			BlasMatrixDomainInv<Field,Matrix>()(_F,A,tmp);
+			return A;
+		}
+
+
+		/*! Division.
+		 * C = A B^{-1}  ==>  C . B = A
+		 */
+		template <class Matrix>
+		Matrix& div( Matrix &C, const Matrix &A, const Matrix &B) const
+		{
+			return this->right_solve(C,B,A);
+		}
+
+
+		//! Inversion w singular check
 		template <class Matrix>
-		Matrix& inv( Matrix &Ainv, const Matrix &A, int& nullity) const { 
+		Matrix& inv( Matrix &Ainv, const Matrix &A, int& nullity) const
+		{
 			nullity = BlasMatrixDomainInv<Field,Matrix>()(_F,Ainv,A);
 			return Ainv;
 		}
-		
-		// Inversion (the matrix A is modified) w singular check
+
+		//! Inversion (the matrix A is modified) w singular check
 		template <class Matrix>
-		Matrix& invin( Matrix &Ainv, Matrix &A, int& nullity) const { 
+		Matrix& invin( Matrix &Ainv, Matrix &A, int& nullity) const
+		{
 			nullity = BlasMatrixDomainInv<Field,Matrix>()(_F,Ainv,A);
 			return Ainv;
 		}
 
-		// Rank
+		//! Rank
 		template <class Matrix>
-		unsigned int rank(const Matrix &A) const {
+		unsigned int rank(const Matrix &A) const
+		{
 			return BlasMatrixDomainRank<Field,Matrix>()(_F,A);
 		}
 
-		// in-place Rank (the matrix is modified)
+		//! in-place Rank (the matrix is modified)
 		template <class Matrix>
-		unsigned int rankin(Matrix &A) const {
+		unsigned int rankin(Matrix &A) const
+		{
 			return BlasMatrixDomainRank<Field, Matrix>()(_F,A);
 		}
 
-		// determinant
+		//! determinant
 		template <class Matrix>
-		Element det(const Matrix &A) const {
+		Element det(const Matrix &A) const
+		{
 			return BlasMatrixDomainDet<Field, Matrix>()(_F,A);
 		}
 
-		//in-place Determinant (the matrix is modified)
+		//! in-place Determinant (the matrix is modified)
 		template <class Matrix>
-		Element detin(Matrix &A) const {
+		Element detin(Matrix &A) const
+		{
 			return BlasMatrixDomainDet<Field, Matrix>()(_F,A);
 		}
-		
-		/*
-		 * Solvers for Matrix (respecting BlasMatrix interface) 
-		 * with Operand as right or left hand side
-		 */ 
+		//@}
 
-		// inear solve with matrix right hand side 
-		// AX=B
+		/*!
+		 * @name Solvers for Matrix (respecting BlasMatrix interface)
+		 * with Operand as right or left hand side
+		 */
+		//@{
+		//! linear solve with matrix right hand side.
+		//! AX=B
 		template <class Operand, class Matrix>
-		Operand& left_solve (Operand& X, const Matrix& A, const Operand& B) const {
+		Operand& left_solve (Operand& X, const Matrix& A, const Operand& B) const
+		{
 			return BlasMatrixDomainLeftSolve<Field,Operand,Matrix>()(_F,X,A,B);
 		}
-		
-		// linear solve with matrix right hand side, the result is stored in-place in B
-		// A must be square
-		// AX=B , (B<-X)
+
+		//! linear solve with matrix right hand side, the result is stored in-place in B.
+		//! @pre A must be square
+		//! AX=B , (B<-X)
 		template <class Operand,class Matrix>
-		Operand& left_solve (const Matrix& A, Operand& B) const {
+		Operand& left_solve (const Matrix& A, Operand& B) const
+		{
 			return BlasMatrixDomainLeftSolve<Field,Operand,Matrix>()(_F,A,B);
 		}
-		
-		// linear solve with matrix right hand side 
-		// XA=B
+
+		//! linear solve with matrix right hand side.
+		//! XA=B
 		template <class Operand, class Matrix>
-		Operand& right_solve (Operand& X, const Matrix& A, const Operand& B) const {
+		Operand& right_solve (Operand& X, const Matrix& A, const Operand& B) const
+		{
 			return BlasMatrixDomainRightSolve<Field,Operand,Matrix>()(_F,X,A,B);
 		}
-		
-		// linear solve with matrix right hand side, the result is stored in-place in B
-		// A must be square
-		// XA=B , (B<-X)
+
+		//! linear solve with matrix right hand side, the result is stored in-place in B.
+		//! @pre A must be square
+		//! XA=B , (B<-X)
 		template <class Operand, class Matrix>
-		Operand& right_solve (const Matrix& A, Operand& B) const {
+		Operand& right_solve (const Matrix& A, Operand& B) const
+		{
 			return BlasMatrixDomainRightSolve<Field,Operand,Matrix>()(_F,A,B);
 		}
 
-		// minimal polynomial computation
+		//! minimal polynomial computation.
 		template <class Polynomial, class Matrix>
-		Polynomial& minpoly( Polynomial& P, const Matrix& A ) const{
+		Polynomial& minpoly( Polynomial& P, const Matrix& A ) const
+		{
 			return BlasMatrixDomainMinpoly<Field, Polynomial, Matrix>()(_F,P,A);
 		}
 
+		//! characteristic polynomial computation.
 		template <class Polynomial,  class Matrix >
-		Polynomial& charpoly( Polynomial& P, const Matrix& A ) const{
+		Polynomial& charpoly( Polynomial& P, const Matrix& A ) const
+		{
 
 			commentator.start ("Modular Dense Charpoly ", "MDCharpoly");
 			std::list<Polynomial> P_list;
 			P_list.clear();
 			BlasMatrixDomainCharpoly<Field, std::list<Polynomial>, Matrix >()(_F,P_list,A);
-			
+
 
 			Polynomial tmp(A.rowdim()+1);
 			typename std::list<Polynomial>::iterator it = P_list.begin();
@@ -459,18 +648,21 @@ namespace LinBox {
 
 			return P;
 		}
-		
- 		template <class Polynomial, class Matrix >
- 		std::list<Polynomial>& charpoly( std::list<Polynomial>& P, const Matrix& A ) const{
- 			return BlasMatrixDomainCharpoly<Field, std::list<Polynomial>, Matrix >()(_F,P,A);
- 		}
-		
-	
+
+		//! characteristic polynomial computation.
+		template <class Polynomial, class Matrix >
+		std::list<Polynomial>& charpoly( std::list<Polynomial>& P, const Matrix& A ) const
+		{
+			return BlasMatrixDomainCharpoly<Field, std::list<Polynomial>, Matrix >()(_F,P,A);
+		}
+
+
 		//private:
-		// Temporary: waiting for an implementation of a domain of polynomial
+		//! @todo Temporary: waiting for an implementation of a domain of polynomial
 		template<class Polynomial>
 		Polynomial &
-		mulpoly(Polynomial &res, const Polynomial & P1, const Polynomial & P2)const{
+		mulpoly(Polynomial &res, const Polynomial & P1, const Polynomial & P2)const
+		{
 			size_t i,j;
 			res.resize(P1.size()+P2.size()-1);
 			for (i=0;i<res.size();i++)
@@ -479,10 +671,40 @@ namespace LinBox {
 				for ( j=0;j<P2.size();j++)
 					_F.axpyin(res[i+j],P1[i],P2[j]);
 			return res;
-			
+
+		}
+		//@}
+
+	public:
+
+		/** Print matrix.
+		 * @param  os  Output stream to which matrix is written.
+		 * @param  A   Matrix.
+		 * @returns reference to os.
+		 */
+		template <class Matrix>
+		inline std::ostream &write (std::ostream &os, const Matrix &A) const
+		{
+			return A.write (os, _F);
+		}
+
+		template <class Matrix>
+		inline std::ostream &write (std::ostream &os, const Matrix &A, bool maple_format) const
+		{
+			return A.write (os, _F, maple_format);
+		}
+
+		/** Read matrix
+		 * @param  is  Input stream from which matrix is read.
+		 * @param  A   Matrix.
+		 * @returns reference to is.
+		 */
+		template <class Matrix>
+		inline std::istream &read (std::istream &is, Matrix &A) const
+		{
+			return A.read (is, _F);
 		}
 
-		
 	}; /* end of class BlasMatrixDomain */
 
 
@@ -490,5 +712,5 @@ namespace LinBox {
 
 #include <linbox/algorithms/blas-domain.inl>
 
-#endif /* __BLAS_DOMAIN_H*/
+#endif /* __LINBOX_blas_matrix_domain_H */
 
diff --git a/linbox/algorithms/blas-domain.inl b/linbox/algorithms/blas-domain.inl
index cb9b935..0ae756e 100644
--- a/linbox/algorithms/blas-domain.inl
+++ b/linbox/algorithms/blas-domain.inl
@@ -1,10 +1,11 @@
 /* -*- 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
 /* linbox/algorithms/blas-domain.inl
- * Copyright (C) 2004 Pascal Giorgi, Clément Pernet
+ * Copyright (C) 2004 Pascal Giorgi, Clément Pernet
  *
  * Written by :
  *               Pascal Giorgi  pascal.giorgi at ens-lyon.fr
- *               Clément Pernet clement.pernet at imag.fr
+ *               Clément Pernet clement.pernet at imag.fr
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -24,85 +25,92 @@
 
 
 
-#ifndef __BLAS_MATRIX_DOMAIN_INL
-#define __BLAS_MATRIX_DOMAIN_INL
+#ifndef __LINBOX_blas_matrix_domain_INL
+#define __LINBOX_blas_matrix_domain_INL
 
 #include <linbox/blackbox/blas-blackbox.h>
 #include <linbox/matrix/blas-matrix.h>
 #include <linbox/matrix/factorized-matrix.h>
 
-namespace LinBox {
+namespace LinBox
+{
 
 	/*
 	 * **********************************************
 	 * *** Specialization for BlasBlackbox<Field> ***
 	 * **********************************************
-	 */	
+	 */
 
 
 	// Inversion
 	// dpritcha: now returns nullity. (2004-07-19)
 	// previously returned Ainv but this is passed back anyway.
-	template <class Field>	
+	template <class Field>
 	class BlasMatrixDomainInv<Field,BlasBlackbox<Field> > {
 	public:
-		int operator() (const Field                   &F, 
+		int operator() (const Field                   &F,
 				BlasBlackbox<Field>        &Ainv,
-				const BlasBlackbox<Field>     &A) const{
+				const BlasBlackbox<Field>     &A) const
+		{
 
 			linbox_check( A.rowdim() == A.coldim());
 			linbox_check( A.rowdim() == Ainv.rowdim());
 			linbox_check( A.coldim() == Ainv.coldim());
-			BlasBlackbox<Field> tmp(A);			
+			BlasBlackbox<Field> tmp(A);
 			return (*this)(F,Ainv,tmp);
 		}
 
-		int operator() (const Field                &F, 
+		int operator() (const Field                &F,
 				BlasBlackbox<Field>     &Ainv,
-				BlasBlackbox<Field>        &A) const{
-			
+				BlasBlackbox<Field>        &A) const
+		{
+
 			linbox_check( A.rowdim() == A.coldim());
 			linbox_check( A.rowdim() == Ainv.rowdim());
-			linbox_check( A.coldim() == Ainv.coldim());			
+			linbox_check( A.coldim() == Ainv.coldim());
 			int nullity;
 			FFPACK::Invert(F,A.rowdim(),A.getPointer(),A.getStride(),
 				       Ainv.getPointer(),Ainv.getStride(),nullity);
 			return nullity;
 		}
-		
+
 	};
 
-	template <>	
+#ifndef __INTEL_COMPILER
+	template <>
+#endif
 	class BlasMatrixDomainInv<MultiModDouble,BlasBlackbox<MultiModDouble> > {
 	public:
-		int operator() (const MultiModDouble                   &F, 
+		int operator() (const MultiModDouble                   &F,
 				BlasBlackbox<MultiModDouble>        &Ainv,
-				const BlasBlackbox<MultiModDouble>     &A) const{
-			
+				const BlasBlackbox<MultiModDouble>     &A) const
+		{
+
 			linbox_check( A.rowdim() == A.coldim());
 			linbox_check( A.rowdim() == Ainv.rowdim());
 			linbox_check( A.coldim() == Ainv.coldim());
-			BlasBlackbox<MultiModDouble> tmp(A);			
+			BlasBlackbox<MultiModDouble> tmp(A);
 			return (*this)(F,Ainv,tmp);
 		}
 
-		int operator() (const MultiModDouble                &F, 
+		int operator() (const MultiModDouble                &F,
 				BlasBlackbox<MultiModDouble>     &Ainv,
-				BlasBlackbox<MultiModDouble>        &A) const{
-			
+				BlasBlackbox<MultiModDouble>        &A) const
+		{
+
 			linbox_check( A.rowdim() == A.coldim());
 			linbox_check( A.rowdim() == Ainv.rowdim());
-			linbox_check( A.coldim() == Ainv.coldim());			
+			linbox_check( A.coldim() == Ainv.coldim());
 			int nullity, defrank=0;
-			
+
 			for (size_t i=0;i<F.size();++i){
 				FFPACK::Invert(F.getBase(i),A.rowdim(), A.getMatrix(i)->getPointer(),A.getMatrix(i)->getStride(),
-						Ainv.getMatrix(i)->getPointer(),Ainv.getMatrix(i)->getStride(),nullity);
+					       Ainv.getMatrix(i)->getPointer(),Ainv.getMatrix(i)->getStride(),nullity);
 				defrank+=nullity;
 			}
 			return defrank;
 		}
-		
+
 	};
 
 
@@ -112,15 +120,17 @@ namespace LinBox {
 	class 	BlasMatrixDomainRank<Field,BlasBlackbox<Field> > {
 	public:
 		inline unsigned int operator() (const Field                &F,
-						const BlasBlackbox<Field>  &A) const{
+						const BlasBlackbox<Field>  &A) const
+		{
 
 			BlasBlackbox<Field> tmp(A);
 			return (*this)(F,tmp);
-		}	
+		}
+
+		inline unsigned int operator() (const Field                &F,
+						BlasBlackbox<Field>        &A) const
+		{
 
-		inline unsigned int operator() (const Field                &F, 
-						BlasBlackbox<Field>        &A) const{
-			
 			return FFPACK::Rank(F, A.rowdim(), A.coldim(),A.getPointer(), A.getStride());
 		}
 	};
@@ -130,14 +140,16 @@ namespace LinBox {
 	class BlasMatrixDomainDet<Field,BlasBlackbox<Field> > {
 	public:
 		inline typename Field::Element operator()(const Field                 &F,
-							  const BlasBlackbox<Field>   &A) const{
-			
+							  const BlasBlackbox<Field>   &A) const
+		{
+
 			BlasBlackbox<Field> tmp(A);
 			return  (*this)(F,tmp);
 		}
 
 		inline typename Field::Element operator() (const Field                &F,
-							   BlasBlackbox<Field>        &A) const{
+							   BlasBlackbox<Field>        &A) const
+		{
 
 			return FFPACK::Det(F, A.rowdim(), A.coldim(),A.getPointer(), A.getStride());
 		}
@@ -149,39 +161,41 @@ namespace LinBox {
 	 * **********************************************
 	 * *** Specialization for BlasMatrix<Element> ***
 	 * **********************************************
-	 */	
+	 */
 
 
 	// Inversion
 	// dpritcha: now returns nullity. (2004-07-19)
 	// previously returned Ainv but this is passed back anyway.
-	template <class Field>	
+	template <class Field>
 	class BlasMatrixDomainInv<Field,BlasMatrix<typename Field::Element> > {
 	public:
-		int operator() (const Field                                   &F, 
+		int operator() (const Field                                   &F,
 				BlasMatrix<typename Field::Element>        &Ainv,
-				const BlasMatrix<typename Field::Element>     &A) const{
+				const BlasMatrix<typename Field::Element>     &A) const
+		{
 
 			linbox_check( A.rowdim() == A.coldim());
 			linbox_check( A.rowdim() == Ainv.rowdim());
-			linbox_check( A.coldim() == Ainv.coldim());			
-			BlasMatrix<typename Field::Element> tmp(A);			
+			linbox_check( A.coldim() == Ainv.coldim());
+			BlasMatrix<typename Field::Element> tmp(A);
 			return (*this)(F,Ainv,tmp);
 		}
 
-		int operator() (const Field                                  &F, 
+		int operator() (const Field                                  &F,
 				BlasMatrix<typename Field::Element>       &Ainv,
-				BlasMatrix<typename Field::Element>          &A) const{
+				BlasMatrix<typename Field::Element>          &A) const
+		{
 
 			linbox_check( A.rowdim() == A.coldim());
 			linbox_check( A.rowdim() == Ainv.rowdim());
-			linbox_check( A.coldim() == Ainv.coldim());			
+			linbox_check( A.coldim() == Ainv.coldim());
 			int nullity;
 			FFPACK::Invert (F, A.rowdim(), A.getPointer(), A.getStride(),
-				       Ainv.getPointer(),Ainv.getStride(),nullity);
+					Ainv.getPointer(),Ainv.getStride(),nullity);
 			return nullity;
 		}
-		
+
 	};
 
 	// Rank
@@ -189,16 +203,18 @@ namespace LinBox {
 	class 	BlasMatrixDomainRank<Field,BlasMatrix<typename Field::Element> > {
 	public:
 		inline unsigned int operator() (const Field                                &F,
-						const BlasMatrix<typename Field::Element>  &A) const{
+						const BlasMatrix<typename Field::Element>  &A) const
+		{
 
 			BlasMatrix<typename Field::Element> tmp(A);
 			return (*this)(F,tmp);
-		}	
- 
-		inline unsigned int 
+		}
+
+		inline unsigned int
 		operator() (const Field                           &F,
-			    BlasMatrix<typename Field::Element>   &A) const{
-		
+			    BlasMatrix<typename Field::Element>   &A) const
+		{
+
 			return FFPACK::Rank(F, A.rowdim(), A.coldim(),A.getPointer(), A.getStride());
 		}
 	};
@@ -208,15 +224,17 @@ namespace LinBox {
 	class BlasMatrixDomainDet<Field,BlasMatrix<typename Field::Element> > {
 	public:
 		inline typename Field::Element operator()(const Field                                &F,
-							  const BlasMatrix<typename Field::Element>  &A) const{
+							  const BlasMatrix<typename Field::Element>  &A) const
+		{
 
 			BlasMatrix<typename Field::Element> tmp(A);
 			return  (*this)(F,tmp);
 		}
 
 		inline typename Field::Element operator() (const Field                             &F,
-							   BlasMatrix<typename Field::Element>     &A) const{
-			
+							   BlasMatrix<typename Field::Element>     &A) const
+		{
+
 			return FFPACK::Det(F, A.rowdim(), A.coldim(),A.getPointer(), A.getStride());
 		}
 	};
@@ -225,27 +243,124 @@ namespace LinBox {
 	/*
 	 * specialization for Operand1, Operand2 and Operand3  of type BlasMatrix<Element>
 	 */
-	
+
+	template<class Field>
+	class 	BlasMatrixDomainAdd<Field,BlasMatrix<typename Field::Element>,BlasMatrix<typename Field::Element>, BlasMatrix<typename Field::Element> > {
+	public:
+		BlasMatrix<typename Field::Element>& operator()(const Field& F,
+								BlasMatrix<typename Field::Element>& C,
+								const BlasMatrix<typename Field::Element>& A,
+								const BlasMatrix<typename Field::Element>& B) const
+		{
+			linbox_check( A.rowdim() == B.rowdim());
+			linbox_check( C.rowdim() == A.rowdim());
+			linbox_check( A.coldim() == B.coldim());
+			linbox_check( C.coldim() == A.coldim());
+			FFLAS::fadd (F, C.rowdim(), C.coldim(),
+				     A.getPointer(), A.getStride(),
+				     B.getPointer(), B.getStride(),
+				     C.getPointer(), C.getStride());
+			return C;
+		}
+	};
+
+	template<class Field>
+	class 	BlasMatrixDomainCopy<Field,BlasMatrix<typename Field::Element>, BlasMatrix<typename Field::Element> > {
+	public:
+		BlasMatrix<typename Field::Element>& operator()(const Field& F,
+								BlasMatrix<typename Field::Element>& B,
+								const BlasMatrix<typename Field::Element>& A) const
+		{
+			linbox_check( A.rowdim() == B.rowdim());
+			linbox_check( A.coldim() == B.coldim());
+			for (size_t i=0; i<A.rowdim(); i++)
+				FFLAS::fcopy (F, A.coldim(),
+					      B.getPointer() + i*B.getStride(), 1,
+					      A.getPointer() + i*A.getStride(), 1);
+			return B;
+		}
+	};
+
+	template<class Field>
+	class 	BlasMatrixDomainSub<Field,BlasMatrix<typename Field::Element>,BlasMatrix<typename Field::Element>, BlasMatrix<typename Field::Element> > {
+	public:
+		BlasMatrix<typename Field::Element>& operator()(const Field& F,
+								BlasMatrix<typename Field::Element>& C,
+								const BlasMatrix<typename Field::Element>& A,
+								const BlasMatrix<typename Field::Element>& B) const
+		{
+			linbox_check( A.rowdim() == B.rowdim());
+			linbox_check( C.rowdim() == A.rowdim());
+			linbox_check( A.coldim() == B.coldim());
+			linbox_check( C.coldim() == A.coldim());
+			FFLAS::fsub (F, C.rowdim(), C.coldim(),
+				     A.getPointer(), A.getStride(),
+				     B.getPointer(), B.getStride(),
+				     C.getPointer(), C.getStride());
+			return C;
+		}
+	};
+
+	template<class Field>
+	class 	BlasMatrixDomainSubin<Field,BlasMatrix<typename Field::Element>,BlasMatrix<typename Field::Element> > {
+	public:
+		BlasMatrix<typename Field::Element>& operator()(const Field& F,
+								BlasMatrix<typename Field::Element>& C,
+								const BlasMatrix<typename Field::Element>& B) const
+		{
+			linbox_check( C.rowdim() == B.rowdim());
+			linbox_check( C.coldim() == B.coldim());
+			FFLAS::fsubin (F, C.rowdim(), C.coldim(),
+				     B.getPointer(), B.getStride(),
+				     C.getPointer(), C.getStride());
+			return C;
+		}
+	};
+
+	template<class Field>
+	class 	BlasMatrixDomainAddin<Field,BlasMatrix<typename Field::Element>,BlasMatrix<typename Field::Element> > {
+	public:
+		BlasMatrix<typename Field::Element>& operator()(const Field& F,
+								BlasMatrix<typename Field::Element>& C,
+								const BlasMatrix<typename Field::Element>& B) const
+		{
+			linbox_check( C.rowdim() == B.rowdim());
+			linbox_check( C.coldim() == B.coldim());
+			FFLAS::faddin (F, C.rowdim(), C.coldim(),
+				     B.getPointer(), B.getStride(),
+				     C.getPointer(), C.getStride());
+			return C;
+		}
+	};
+
 	//  general matrix-matrix multiplication and addition with scaling
 	// D= beta.C + alpha.A*B
 	template<class Field>
 	class 	BlasMatrixDomainMulAdd<Field,BlasMatrix<typename Field::Element>,BlasMatrix<typename Field::Element>, BlasMatrix<typename Field::Element> > {
 	public:
-		BlasMatrix<typename Field::Element>& operator()(const Field& F,
-								BlasMatrix<typename Field::Element>& D, 
-								const typename Field::Element& beta, 
-								const BlasMatrix<typename Field::Element>& C,
-								const typename Field::Element& alpha, 
-								const BlasMatrix<typename Field::Element>& A, 
-								const BlasMatrix<typename Field::Element>& B) const{
+		BlasMatrix<typename Field::Element>&
+		operator()(const Field                              & F,
+			   BlasMatrix<typename Field::Element>      & D,
+			   const typename Field::Element            & beta,
+			   const BlasMatrix<typename Field::Element>& C,
+			   const typename Field::Element            & alpha,
+			   const BlasMatrix<typename Field::Element>& A,
+			   const BlasMatrix<typename Field::Element>& B) const
+		{
 			linbox_check( A.coldim() == B.rowdim());
 			linbox_check( C.rowdim() == A.rowdim());
 			linbox_check( C.coldim() == B.coldim());
 			linbox_check( D.rowdim() == C.rowdim());
 			linbox_check( D.coldim() == C.coldim());
-			
+
 			D=C;
-			
+			// linbox_check(D.getPointer() != C.getPointer());
+
+			// std::cout << "alpha :" << alpha << std::endl;
+			// std::cout << "beta  :" << beta  << std::endl;
+			// D.write(std::cout << "Dfgem :=" ) <<','<< std::endl;
+			// A.write(std::cout << "Afgem :=" ) <<','<< std::endl;
+			// B.write(std::cout << "Bfgem :=" ) <<','<< std::endl;
 			FFLAS::fgemm( F, FFLAS::FflasNoTrans, FFLAS::FflasNoTrans,
 				      C.rowdim(), C.coldim(), A.coldim(),
 				      alpha,
@@ -253,20 +368,26 @@ namespace LinBox {
 				      B.getPointer(), B.getStride(),
 				      beta,
 				      D.getPointer(), D.getStride());
+			// D.write(std::cout << "Dfgem :=" ) <<','<< std::endl;
+			// std::cout << A.getStride() << "," << A.coldim() << std::endl;
+			// std::cout << B.getStride() << "," << B.coldim() << std::endl;
+			// std::cout << D.getStride() << "," << D.coldim() << std::endl;
 			return D;
 		}
 
-		
-		BlasMatrix<typename Field::Element>&operator() (const Field& F,
-								const typename Field::Element& beta,
-								BlasMatrix<typename Field::Element>& C,
-								const typename Field::Element& alpha, 
-								const BlasMatrix<typename Field::Element>& A, 
-								const BlasMatrix<typename Field::Element>& B) const{
+
+		BlasMatrix<typename Field::Element>&
+		operator() (const Field                              & F,
+			    const typename Field::Element            & beta,
+			    BlasMatrix<typename Field::Element>      & C,
+			    const typename Field::Element            & alpha,
+			    const BlasMatrix<typename Field::Element>& A,
+			    const BlasMatrix<typename Field::Element>& B) const
+		{
 			linbox_check( A.coldim() == B.rowdim());
 			linbox_check( C.rowdim() == A.rowdim());
 			linbox_check( C.coldim() == B.coldim());
-			
+
 			FFLAS::fgemm( F, FFLAS::FflasNoTrans, FFLAS::FflasNoTrans,
 				      C.rowdim(), C.coldim(), A.coldim(),
 				      alpha,
@@ -279,6 +400,177 @@ namespace LinBox {
 	};
 
 
+	template<class Field>
+	class 	BlasMatrixDomainMulAdd<Field,
+		BlasMatrix<typename Field::Element>,
+		TransposedBlasMatrix<BlasMatrix<typename Field::Element> >,
+		BlasMatrix<typename Field::Element> > {
+	public:
+		BlasMatrix<typename Field::Element>&
+		operator()(const Field                              & F,
+			   BlasMatrix<typename Field::Element>      & D,
+			   const typename Field::Element            & beta,
+			   const BlasMatrix<typename Field::Element>& C,
+			   const typename Field::Element            & alpha,
+			   const TransposedBlasMatrix<BlasMatrix<typename Field::Element> >& A,
+			   const BlasMatrix<typename Field::Element>& B) const
+		{
+			linbox_check( A.getMatrix().rowdim() == B.rowdim());
+			linbox_check( C.rowdim() == A.getMatrix().coldim());
+			linbox_check( C.coldim() == B.coldim());
+			linbox_check( D.rowdim() == C.rowdim());
+			linbox_check( D.coldim() == C.coldim());
+
+			D=C;
+
+			FFLAS::fgemm( F, FFLAS::FflasTrans, FFLAS::FflasNoTrans,
+				      C.rowdim(), C.coldim(), B.rowdim(),
+				      alpha,
+				      A.getMatrix().getPointer(), A.getMatrix().getStride(),
+				      B.getPointer(), B.getStride(),
+				      beta,
+				      D.getPointer(), D.getStride());
+
+			return D;
+		}
+
+
+		BlasMatrix<typename Field::Element>&
+		operator() (const Field                              & F,
+			    const typename Field::Element            & beta,
+			    BlasMatrix<typename Field::Element>      & C,
+			    const typename Field::Element            & alpha,
+			    const TransposedBlasMatrix<BlasMatrix<typename Field::Element> >& A,
+			    const BlasMatrix<typename Field::Element>& B) const
+		{
+			linbox_check( A.getMatrix().rowdim() == B.rowdim());
+			linbox_check( C.rowdim() == A.getMatrix().coldim());
+			linbox_check( C.coldim() == B.coldim());
+
+			FFLAS::fgemm( F, FFLAS::FflasTrans, FFLAS::FflasNoTrans,
+				      C.rowdim(), C.coldim(), B.rowdim(),
+				      alpha,
+				      A.getMatrix().getPointer(), A.getMatrix().getStride(),
+				      B.getPointer(), B.getStride(),
+				      beta,
+				      C.getPointer(), C.getStride());
+			return C;
+		}
+	};
+
+	template<class Field>
+	class 	BlasMatrixDomainMulAdd<Field,
+		BlasMatrix<typename Field::Element>,
+		TransposedBlasMatrix<BlasMatrix<typename Field::Element> >,
+		TransposedBlasMatrix<BlasMatrix<typename Field::Element> > > {
+	public:
+		BlasMatrix<typename Field::Element>&
+		operator()(const Field                              & F,
+			   BlasMatrix<typename Field::Element>      & D,
+			   const typename Field::Element            & beta,
+			   const BlasMatrix<typename Field::Element>& C,
+			   const typename Field::Element            & alpha,
+			   const TransposedBlasMatrix<BlasMatrix<typename Field::Element> >& A,
+			   const TransposedBlasMatrix<BlasMatrix<typename Field::Element> >& B) const
+		{
+			linbox_check( A.getMatrix().rowdim() == B.getMatrix().coldim());
+			linbox_check( C.rowdim() == A.getMatrix().coldim());
+			linbox_check( C.coldim() == B.getMatrix().rowdim());
+			linbox_check( D.rowdim() == C.rowdim());
+			linbox_check( D.coldim() == C.coldim());
+
+			D=C;
+			// linbox_check(D.getPointer() != C.getPointer());
+
+			FFLAS::fgemm( F, FFLAS::FflasTrans, FFLAS::FflasTrans,
+				      C.rowdim(), C.coldim(), A.getMatrix().rowdim(),
+				      alpha,
+				      A.getMatrix().getPointer(), A.getMatrix().getStride(),
+				      B.getMatrix().getPointer(), B.getMatrix().getStride(),
+				      beta,
+				      D.getPointer(), D.getStride());
+			return D;
+		}
+
+
+		BlasMatrix<typename Field::Element>&
+		operator() (const Field                              & F,
+			    const typename Field::Element            & beta,
+			    BlasMatrix<typename Field::Element>      & C,
+			    const typename Field::Element            & alpha,
+			    const TransposedBlasMatrix<BlasMatrix<typename Field::Element> >& A,
+			    const TransposedBlasMatrix<BlasMatrix<typename Field::Element> >& B) const
+		{
+			linbox_check( A.getMatrix().rowdim() == B.getMatrix().coldim());
+			linbox_check( C.rowdim() == A.getMatrix().coldim());
+			linbox_check( C.coldim() == B.getMatrix().rowdim());
+
+			FFLAS::fgemm( F, FFLAS::FflasTrans, FFLAS::FflasTrans,
+				      C.rowdim(), C.coldim(), A.getMatrix().rowdim(),
+				      alpha,
+				      A.getMatrix().getPointer(), A.getMatrix().getStride(),
+				      B.getMatrix().getPointer(), B.getMatrix().getStride(),
+				      beta,
+				      C.getPointer(), C.getStride());
+			return C;
+		}
+	};
+
+	template<class Field>
+	class 	BlasMatrixDomainMulAdd<Field,
+		BlasMatrix<typename Field::Element>,
+		BlasMatrix<typename Field::Element>,
+		TransposedBlasMatrix<BlasMatrix<typename Field::Element> > > {
+	public:
+		BlasMatrix<typename Field::Element>&
+		operator()(const Field                              & F,
+			   BlasMatrix<typename Field::Element>      & D,
+			   const typename Field::Element            & beta,
+			   const BlasMatrix<typename Field::Element>& C,
+			   const typename Field::Element            & alpha,
+			   const BlasMatrix<typename Field::Element>& A,
+			   const TransposedBlasMatrix<BlasMatrix<typename Field::Element> >& B) const
+		{
+			linbox_check( A.coldim() == B.getMatrix().coldim());
+			linbox_check( C.rowdim() == A.rowdim());
+			linbox_check( C.coldim() == B.getMatrix().rowdim());
+			linbox_check( D.rowdim() == C.rowdim());
+			linbox_check( D.coldim() == C.coldim());
+
+			D=C;
+			FFLAS::fgemm( F, FFLAS::FflasNoTrans, FFLAS::FflasTrans,
+				      C.rowdim(), C.coldim(), A.coldim(),
+				      alpha,
+				      A.getPointer(), A.getStride(),
+				      B.getMatrix().getPointer(), B.getMatrix().getStride(),
+				      beta,
+				      D.getPointer(), D.getStride());
+			return D;
+		}
+
+
+		BlasMatrix<typename Field::Element>&
+		operator() (const Field                              & F,
+			    const typename Field::Element            & beta,
+			    BlasMatrix<typename Field::Element>      & C,
+			    const typename Field::Element            & alpha,
+			    const BlasMatrix<typename Field::Element>& A,
+			    const TransposedBlasMatrix<BlasMatrix<typename Field::Element> >& B) const
+		{
+			linbox_check( A.coldim() == B.getMatrix().coldim());
+			linbox_check( C.rowdim() == A.rowdim());
+			linbox_check( C.coldim() == B.getMatrix().rowdim());
+
+			FFLAS::fgemm( F, FFLAS::FflasNoTrans, FFLAS::FflasTrans,
+				      C.rowdim(), C.coldim(), A.coldim(),
+				      alpha,
+				      A.getPointer(), A.getStride(),
+				      B.getMatrix().getPointer(), B.getMatrix().getStride(),
+				      beta,
+				      C.getPointer(), C.getStride());
+			return C;
+		}
+	};
 
 	/*
 	 * specialization for Operand1 and Operand3 of type std::vector<Element>
@@ -286,23 +578,24 @@ namespace LinBox {
 	 */
 
 	//  general matrix-vector multiplication and addition with scaling
-	// d = beta.c + alpha.A*b 
+	// d = beta.c + alpha.A*b
 	template<class Field>
 	class BlasMatrixDomainMulAdd<Field,std::vector<typename Field::Element>,BlasMatrix<typename Field::Element>,std::vector<typename Field::Element> > {
 	public:
 		std::vector<typename Field::Element>& operator() (const Field& F,
-								  std::vector<typename Field::Element>& d, 
-								  const typename Field::Element& beta, 
+								  std::vector<typename Field::Element>& d,
+								  const typename Field::Element& beta,
 								  const std::vector<typename Field::Element>& c,
-								  const typename Field::Element& alpha, 
-								  const BlasMatrix<typename Field::Element>& A, 
-								  const std::vector<typename Field::Element>& b) const{
+								  const typename Field::Element& alpha,
+								  const BlasMatrix<typename Field::Element>& A,
+								  const std::vector<typename Field::Element>& b) const
+		{
 			linbox_check( A.coldim() == b.size());
 			linbox_check( c.size()   == b.size());
 			linbox_check( d.size()   == c.size());
 			d=c;
-			
-			FFLAS::fgemv( F, FFLAS::FflasNoTrans, 
+
+			FFLAS::fgemv( F, FFLAS::FflasNoTrans,
 				      A.rowdim(), A.coldim(),
 				      alpha,
 				      A.getPointer(), A.getStride(),
@@ -311,18 +604,19 @@ namespace LinBox {
 				      &d[0],1);
 			return d;
 		}
-		
+
 
 		std::vector<typename Field::Element>& operator() (const Field& F,
 								  const typename Field::Element& beta,
 								  std::vector<typename Field::Element>& c,
-								  const typename Field::Element& alpha, 
-								  const BlasMatrix<typename Field::Element>& A, 
-								  const std::vector<typename Field::Element>& b) const{
+								  const typename Field::Element& alpha,
+								  const BlasMatrix<typename Field::Element>& A,
+								  const std::vector<typename Field::Element>& b) const
+		{
 			linbox_check( A.coldim() == b.size());
 			linbox_check( A.rowdim() == c.size()); //fixed: dpritcha
-			
-			FFLAS::fgemv( F, FFLAS::FflasNoTrans, 
+
+			FFLAS::fgemv( F, FFLAS::FflasNoTrans,
 				      A.rowdim(), A.coldim(),
 				      alpha,
 				      A.getPointer(), A.getStride(),
@@ -339,18 +633,19 @@ namespace LinBox {
 	class BlasMatrixDomainMulAdd<Field,std::vector<typename Field::Element>,std::vector<typename Field::Element>,BlasMatrix<typename Field::Element> > {
 	public:
 		std::vector<typename Field::Element>& operator() (const Field& F,
-								  std::vector<typename Field::Element>& d, 
-								  const typename Field::Element& beta, 
+								  std::vector<typename Field::Element>& d,
+								  const typename Field::Element& beta,
 								  const std::vector<typename Field::Element>& c,
-								  const typename Field::Element& alpha, 
-								  const std::vector<typename Field::Element>& a, 
-								  const BlasMatrix<typename Field::Element>& B) const{
+								  const typename Field::Element& alpha,
+								  const std::vector<typename Field::Element>& a,
+								  const BlasMatrix<typename Field::Element>& B) const
+		{
 			linbox_check( B.rowdim() == a.size());
 			linbox_check( B.coldim() == c.size());
 			linbox_check( d.size()   == c.size());
 			d=c;
-			
-			FFLAS::fgemv( F, FFLAS::FflasTrans, 
+
+			FFLAS::fgemv( F, FFLAS::FflasTrans,
 				      B.rowdim(), B.coldim(),
 				      alpha,
 				      B.getPointer(), B.getStride(),
@@ -359,18 +654,19 @@ namespace LinBox {
 				      &d[0],1);
 			return d;
 		}
-		
+
 
 		std::vector<typename Field::Element>& operator() (const Field& F,
 								  const typename Field::Element& beta,
 								  std::vector<typename Field::Element>& c,
-								  const typename Field::Element& alpha, 
-								  const std::vector<typename Field::Element>& a, 
-								  const BlasMatrix<typename Field::Element>& B) const{
+								  const typename Field::Element& alpha,
+								  const std::vector<typename Field::Element>& a,
+								  const BlasMatrix<typename Field::Element>& B) const
+		{
 			linbox_check( B.rowdim() == a.size());
 			linbox_check( B.coldim() == c.size());
-			
-			FFLAS::fgemv( F, FFLAS::FflasTrans, 
+
+			FFLAS::fgemv( F, FFLAS::FflasTrans,
 				      B.rowdim(), B.coldim(),
 				      alpha,
 				      B.getPointer(), B.getStride(),
@@ -384,102 +680,117 @@ namespace LinBox {
 
 
 	/*
-	 * specialization for Operand1, Operand2  of type BlasMatrix<Element> and Operand3 of type BlasPermutation
+	 * Specialization for Operand1, Operand2  of type BlasMatrix<Element>
+	 * and Operand3 of type BlasPermutation
 	 */
-	
-	// Matrix permutation product C = A*B 
+
+	// Matrix permutation product C = A*B
 	template<class Field>
-	class BlasMatrixDomainMul<Field,BlasMatrix<typename Field::Element>,BlasMatrix<typename Field::Element>, BlasPermutation > {
+	class BlasMatrixDomainMul<Field,BlasMatrix<typename Field::Element>,BlasMatrix<typename Field::Element>, BlasPermutation<size_t> > {
 	public:
 		BlasMatrix<typename Field::Element>& operator()(const Field& F,
-								BlasMatrix<typename Field::Element>& C, 
-								const BlasMatrix<typename Field::Element>& A, 
-								const BlasPermutation& B) const{
+								BlasMatrix<typename Field::Element>& C,
+								const BlasMatrix<typename Field::Element>& A,
+								const BlasPermutation<size_t>& B) const
+		{
 			C = A;
-			return BlasMatrixDomainMulin<Field,BlasMatrix<typename Field::Element>,BlasPermutation>()( F, C, B);
+			return BlasMatrixDomainMulin<Field,BlasMatrix<typename Field::Element>,BlasPermutation<size_t> >()( F, C, B);
 		}
 	};
+
 	template<class Field>
-	class BlasMatrixDomainMul<Field,BlasMatrix<typename Field::Element>, BlasPermutation,BlasMatrix<typename Field::Element> > {
+	class BlasMatrixDomainMul<Field,BlasMatrix<typename Field::Element>, BlasPermutation<size_t>,BlasMatrix<typename Field::Element> > {
 	public:
 		BlasMatrix<typename Field::Element>& operator()(const Field& F,
-								BlasMatrix<typename Field::Element>& C, 
-								const BlasPermutation& B,
-								const BlasMatrix<typename Field::Element>& A) const{
+								BlasMatrix<typename Field::Element>& C,
+								const BlasPermutation<size_t>& B,
+								const BlasMatrix<typename Field::Element>& A) const
+		{
 			C = A;
-			return BlasMatrixDomainMulin<Field,BlasMatrix<typename Field::Element>,BlasPermutation >()( F, B, C);
+			return BlasMatrixDomainMulin<Field,BlasMatrix<typename Field::Element>,BlasPermutation<size_t> >()( F, B, C);
 		}
 	};
 
 	/*
-	 * specialization for Operand1, Operand2  of type BlasMatrix<Element> and Operand3 of type TransposedBlasMatrix<BlasPermutation>
+	 * specialization for Operand1, Operand2  of type BlasMatrix<Element> and Operand3 of type TransposedBlasMatrix<BlasPermutation<size_t> >
 	 */
-	
-	// Matrix permutation product C = A*B 
+
+	// Matrix permutation product C = A*B
 	template<class Field>
-	class BlasMatrixDomainMul<Field,BlasMatrix<typename Field::Element>,BlasMatrix<typename Field::Element>, TransposedBlasMatrix<BlasPermutation> > {
+	class BlasMatrixDomainMul<Field,BlasMatrix<typename Field::Element>,BlasMatrix<typename Field::Element>, TransposedBlasMatrix<BlasPermutation<size_t> > > {
 	public:
 		BlasMatrix<typename Field::Element>& operator()(const Field& F,
-								BlasMatrix<typename Field::Element>& C, 
-								const BlasMatrix<typename Field::Element>& A, 
-								const TransposedBlasMatrix<BlasPermutation>& B) const{
+								BlasMatrix<typename Field::Element>& C,
+								const BlasMatrix<typename Field::Element>& A,
+								const TransposedBlasMatrix<BlasPermutation<size_t> >& B) const
+		{
 			C = A;
-			return BlasMatrixDomainMulin<Field,BlasMatrix<typename Field::Element>,TransposedBlasMatrix<BlasPermutation> >()( F, C, B);
+			return BlasMatrixDomainMulin<Field,BlasMatrix<typename Field::Element>,TransposedBlasMatrix<BlasPermutation<size_t> > >()( F, C, B);
 		}
 	};
+
 	template<class Field>
-	class BlasMatrixDomainMul<Field,BlasMatrix<typename Field::Element>, TransposedBlasMatrix<BlasPermutation>,BlasMatrix<typename Field::Element> > {
+	class BlasMatrixDomainMul<Field,BlasMatrix<typename Field::Element>, TransposedBlasMatrix<BlasPermutation<size_t> >,BlasMatrix<typename Field::Element> > {
 	public:
 		BlasMatrix<typename Field::Element>& operator()(const Field& F,
-								BlasMatrix<typename Field::Element>& C, 
-								const TransposedBlasMatrix<BlasPermutation>& B,
-								const BlasMatrix<typename Field::Element>& A) const{
+								BlasMatrix<typename Field::Element>& C,
+								const TransposedBlasMatrix<BlasPermutation<size_t> >& B,
+								const BlasMatrix<typename Field::Element>& A) const
+		{
 			C = A;
-			return BlasMatrixDomainMulin<Field,BlasMatrix<typename Field::Element>,TransposedBlasMatrix<BlasPermutation> >()( F, B, C);
+			return BlasMatrixDomainMulin<Field,BlasMatrix<typename Field::Element>,TransposedBlasMatrix<BlasPermutation<size_t> > >()( F, B, C);
 		}
 	};
 
 	/*
 	 * specialization for Operand1 of type BlasMatrix<Element> and Operand2 of type BlasPermutation
 	 */
-	
+
 	// In-place matrix permutation product
 	template<class Field>
-	class BlasMatrixDomainMulin<Field,BlasMatrix<typename Field::Element>, BlasPermutation > {
+	class BlasMatrixDomainMulin<Field,BlasMatrix<typename Field::Element>, BlasPermutation<size_t> > {
 	public:
 		BlasMatrix<typename Field::Element>& operator()( const Field& F,
-								 BlasMatrix<typename Field::Element>& A, 
-								 const BlasPermutation& B) const{
-			linbox_check( A.coldim() == B.getOrder() );
-			FFPACK::applyP( F, FFLAS::FflasRight, FFLAS::FflasNoTrans, A.rowdim(), 0, A.coldim(), A.getPointer(), A.getStride(), B.getPointer() );
+								 BlasMatrix<typename Field::Element>& A,
+								 const BlasPermutation<size_t>& B) const
+		{
+			if (B.isIdentity()) return A ;
+			linbox_check( A.coldim() >= B.getSize() );
+			FFPACK::applyP( F, FFLAS::FflasRight, FFLAS::FflasNoTrans, A.rowdim(), 0, B.getOrder(), A.getPointer(), A.getStride(), B.getPointer() );
 			return A;
 		}
 
 		BlasMatrix<typename Field::Element>& operator()( const Field& F,
-								 const BlasPermutation& B,
-								 BlasMatrix<typename Field::Element>& A) const{
-			linbox_check( A.rowdim() == B.getOrder() );
-			FFPACK::applyP( F, FFLAS::FflasLeft, FFLAS::FflasNoTrans, A.coldim(), 0, A.rowdim(), A.getPointer(), A.getStride(), B.getPointer() );
+								 const BlasPermutation<size_t>& B,
+								 BlasMatrix<typename Field::Element>& A) const
+		{
+			if (B.isIdentity()) return A ;
+			linbox_check( A.rowdim() >= B.getSize() );
+			FFPACK::applyP( F, FFLAS::FflasLeft, FFLAS::FflasNoTrans, A.coldim(), 0, B.getOrder(), A.getPointer(), A.getStride(), B.getPointer() );
 			return A;
 		}
 
 	};
-	
+
 	template<class Field>
-	class BlasMatrixDomainMulin<Field,BlasMatrix<typename Field::Element>, TransposedBlasMatrix<BlasPermutation> > {
+	class BlasMatrixDomainMulin<Field,BlasMatrix<typename Field::Element>, TransposedBlasMatrix<BlasPermutation<size_t> > > {
 	public:
 		BlasMatrix<typename Field::Element>& operator()( const Field& F,
-								 BlasMatrix<typename Field::Element>& A, 
-								 const TransposedBlasMatrix<BlasPermutation>& B) const{
-			linbox_check( A.coldim() == B.getMatrix().getOrder() );
-			FFPACK::applyP( F, FFLAS::FflasRight, FFLAS::FflasTrans, A.rowdim(), 0, A.coldim(), A.getPointer(), A.getStride(), B.getMatrix().getPointer() );
+								 BlasMatrix<typename Field::Element>& A,
+								 const TransposedBlasMatrix<BlasPermutation<size_t> >& B) const
+		{
+			if (B.getMatrix().isIdentity()) return A ;
+			linbox_check( A.coldim() >= B.getMatrix().getSize() );
+			FFPACK::applyP( F, FFLAS::FflasRight, FFLAS::FflasTrans, A.rowdim(), 0, B.getMatrix().getOrder(), A.getPointer(), A.getStride(), B.getMatrix().getPointer() );
 			return A;
 		}
 		BlasMatrix<typename Field::Element>& operator()(  const Field& F,
-								  const TransposedBlasMatrix<BlasPermutation>& B,
-								  BlasMatrix<typename Field::Element>& A) const{
-			linbox_check( A.rowdim() == B.getMatrix().getOrder() );
-			FFPACK::applyP( F, FFLAS::FflasLeft, FFLAS::FflasTrans, A.coldim(), 0, A.rowdim(), A.getPointer(), A.getStride(), B.getMatrix().getPointer() );
+								  const TransposedBlasMatrix<BlasPermutation<size_t> >& B,
+								  BlasMatrix<typename Field::Element>& A) const
+		{
+			if (B.getMatrix().isIdentity()) return A ;
+			linbox_check( A.rowdim() >= B.getMatrix().getSize() );
+			FFPACK::applyP( F, FFLAS::FflasLeft, FFLAS::FflasTrans, A.coldim(), 0, B.getMatrix().getOrder(), A.getPointer(), A.getStride(), B.getMatrix().getPointer() );
 			return A;
 		}
 	};
@@ -489,127 +800,145 @@ namespace LinBox {
 	/*
 	 * specialization for Operand1, Operand2  of type std::vector<Element> and Operand3 of type BlasPermutation
 	 */
-	
-	// Matrix permutation product C = A*B 
+
+	// Matrix permutation product C = A*B
 	template<class Field>
-	class BlasMatrixDomainMul<Field,std::vector< typename Field::Element>,std::vector< typename Field::Element>, BlasPermutation > {
+	class BlasMatrixDomainMul<Field,std::vector< typename Field::Element>,std::vector< typename Field::Element>, BlasPermutation<size_t> > {
 	public:
 		std::vector< typename Field::Element>& operator()(const Field& F,
-								std::vector< typename Field::Element>& C, 
-								const std::vector< typename Field::Element>& A, 
-								const BlasPermutation& B) const{
+								  std::vector< typename Field::Element>& C,
+								  const std::vector< typename Field::Element>& A,
+								  const BlasPermutation<size_t>& B) const
+		{
 			C = A;
-			return BlasMatrixDomainMulin<Field,std::vector< typename Field::Element>,BlasPermutation>()( F, C, B);
+			return BlasMatrixDomainMulin<Field,std::vector< typename Field::Element>,BlasPermutation<size_t> >()( F, C, B);
 		}
 	};
+
 	template<class Field>
-	class BlasMatrixDomainMul<Field,std::vector< typename Field::Element>, BlasPermutation,std::vector< typename Field::Element> > {
+	class BlasMatrixDomainMul<Field,std::vector< typename Field::Element>, BlasPermutation<size_t>,std::vector< typename Field::Element> > {
 	public:
 		std::vector< typename Field::Element>& operator()(const Field& F,
-								std::vector< typename Field::Element>& C, 
-								const BlasPermutation& B,
-								const std::vector< typename Field::Element>& A) const{
+								  std::vector< typename Field::Element>& C,
+								  const BlasPermutation<size_t>& B,
+								  const std::vector< typename Field::Element>& A) const
+		{
 			C = A;
-			return BlasMatrixDomainMulin<Field,std::vector< typename Field::Element>,BlasPermutation >()( F, B, C);
+			return BlasMatrixDomainMulin<Field,std::vector< typename Field::Element>,BlasPermutation<size_t> >()( F, B, C);
 		}
 	};
 
 	/*
-	 * specialization for Operand1, Operand2  of type std::vector<Element> and Operand3 of type TransposedBlasMatrix<BlasPermutation>
+	 * specialization for Operand1, Operand2  of type std::vector<Element> and Operand3 of type TransposedBlasMatrix<BlasPermutation<size_t> >
 	 */
-	
-	// Matrix permutation product C = A*B 
+
+	// Matrix permutation product C = A*B
 	template<class Field>
-	class BlasMatrixDomainMul<Field,std::vector< typename Field::Element>,std::vector< typename Field::Element>, TransposedBlasMatrix<BlasPermutation> > {
+	class BlasMatrixDomainMul<Field,std::vector< typename Field::Element>,std::vector< typename Field::Element>, TransposedBlasMatrix<BlasPermutation<size_t> > > {
 	public:
 		std::vector< typename Field::Element>& operator()(const Field& F,
-								std::vector< typename Field::Element>& C, 
-								const std::vector< typename Field::Element>& A, 
-								const TransposedBlasMatrix<BlasPermutation>& B) const{
+								  std::vector< typename Field::Element>& C,
+								  const std::vector< typename Field::Element>& A,
+								  const TransposedBlasMatrix<BlasPermutation<size_t> >& B) const
+		{
 			C = A;
-			return BlasMatrixDomainMulin<Field,std::vector< typename Field::Element>,TransposedBlasMatrix<BlasPermutation> >()( F, C, B);
+			return BlasMatrixDomainMulin<Field,std::vector< typename Field::Element>,TransposedBlasMatrix<BlasPermutation<size_t> > >()( F, C, B);
 		}
 	};
+
 	template<class Field>
-	class BlasMatrixDomainMul<Field,std::vector< typename Field::Element>, TransposedBlasMatrix<BlasPermutation>,std::vector< typename Field::Element> > {
+	class BlasMatrixDomainMul<Field,std::vector< typename Field::Element>, TransposedBlasMatrix<BlasPermutation<size_t> >,std::vector< typename Field::Element> > {
 	public:
 		std::vector< typename Field::Element>& operator()(const Field& F,
-								std::vector< typename Field::Element>& C, 
-								const TransposedBlasMatrix<BlasPermutation>& B,
-								const std::vector< typename Field::Element>& A) const{
+								  std::vector< typename Field::Element>& C,
+								  const TransposedBlasMatrix<BlasPermutation<size_t> >& B,
+								  const std::vector< typename Field::Element>& A) const
+		{
 			C = A;
-			return BlasMatrixDomainMulin<Field,std::vector< typename Field::Element>,TransposedBlasMatrix<BlasPermutation> >()( F, B, C);
+			return BlasMatrixDomainMulin<Field,std::vector< typename Field::Element>,TransposedBlasMatrix<BlasPermutation<size_t> > >()( F, B, C);
 		}
 	};
 
 	/*
 	 * specialization for Operand1 of type std::vector<Element> and Operand2 of type BlasPermutation
 	 */
-	
+
 	// In-place matrix permutation product
 	template<class Field>
-	class BlasMatrixDomainMulin<Field,std::vector< typename Field::Element>, BlasPermutation > {
+	class BlasMatrixDomainMulin<Field,std::vector< typename Field::Element>, BlasPermutation<size_t> > {
 	public:
 		std::vector< typename Field::Element>& operator()( const Field& F,
-								 std::vector< typename Field::Element>& A, 
-								 const BlasPermutation& B) const{
-			linbox_check( A.size() == B.getOrder() );
-			FFPACK::applyP( F, FFLAS::FflasRight, FFLAS::FflasNoTrans, 1, 0, A.size(), &A[0], 1, B.getPointer() );
+								   std::vector< typename Field::Element>& A,
+								   const BlasPermutation<size_t>& B) const
+		{
+			if (B.isIdentity()) return A ;
+			linbox_check( A.size() == B.getSize() );
+			FFPACK::applyP( F, FFLAS::FflasRight, FFLAS::FflasNoTrans, 1, 0, B.getOrder(), &A[0], 1, B.getPointer() );
 			return A;
 		}
 
 		std::vector< typename Field::Element>& operator()( const Field& F,
-								 const BlasPermutation& B,
-								 std::vector< typename Field::Element>& A) const{
-			linbox_check( A.size() == B.getOrder() );
-			FFPACK::applyP( F, FFLAS::FflasLeft, FFLAS::FflasNoTrans, 1, 0, A.size(), &A[0], 1, B.getPointer() );
+								   const BlasPermutation<size_t>& B,
+								   std::vector< typename Field::Element>& A) const
+		{
+			if (B.isIdentity()) return A ;
+			linbox_check( A.size() >= B.getSize() );
+			FFPACK::applyP( F, FFLAS::FflasLeft, FFLAS::FflasNoTrans, 1, 0, B.getOrder(), &A[0], 1, B.getPointer() );
 			return A;
 		}
 
 	};
-	
+
 	template<class Field>
-	class BlasMatrixDomainMulin<Field,std::vector< typename Field::Element>, TransposedBlasMatrix<BlasPermutation> > {
+	class BlasMatrixDomainMulin<Field,std::vector< typename Field::Element>, TransposedBlasMatrix<BlasPermutation<size_t> > > {
 	public:
 		std::vector< typename Field::Element>& operator()( const Field& F,
-								 std::vector< typename Field::Element>& A, 
-								 const TransposedBlasMatrix<BlasPermutation>& B) const{
-			linbox_check( A.size() == B.getMatrix().getOrder() );
-			FFPACK::applyP( F, FFLAS::FflasRight, FFLAS::FflasTrans, 1, 0, A.size(), &A[0], 1, B.getMatrix().getPointer() );
+								   std::vector< typename Field::Element>& A,
+								   const TransposedBlasMatrix<BlasPermutation<size_t> >& B) const
+		{
+			if (B.getMatrix().isIdentity()) return A ;
+			linbox_check( A.size() >= B.getMatrix().getSize() );
+			FFPACK::applyP( F, FFLAS::FflasRight, FFLAS::FflasTrans, 1, 0, B.getMatrix().getOrder(), &A[0], 1, B.getMatrix().getPointer() );
 			return A;
 		}
 		std::vector< typename Field::Element>& operator()(  const Field& F,
-								    const TransposedBlasMatrix<BlasPermutation>& B,
-								    std::vector< typename Field::Element>& A) const{
-			linbox_check( A.size() == B.getMatrix().getOrder() );
-			FFPACK::applyP( F, FFLAS::FflasLeft, FFLAS::FflasTrans, 1, 0, A.size(), &A[0], 1, B.getMatrix().getPointer() );
+								    const TransposedBlasMatrix<BlasPermutation<size_t> >& B,
+								    std::vector< typename Field::Element>& A) const
+		{
+			if (B.getMatrix().isIdentity()) return A ;
+			linbox_check( A.size() >= B.getMatrix().getSize() );
+			FFPACK::applyP( F, FFLAS::FflasLeft, FFLAS::FflasTrans, 1, 0, B.getMatrix().getOrder(), &A[0], 1, B.getMatrix().getPointer() );
 			return A;
 		}
 	};
-	
+
 	/*
-	 * specialization for Operand1 of type BlasMatrix<Element> and Operand2 of type TriangularBlasMatrix<Element>
+	 * specialization for Operand1 of type BlasMatrix<Element> and Operand2
+	 * of type TriangularBlasMatrix<Element>
 	 */
-	
-	// Matrix permutation product C = A*B 
+
+	// Matrix/Triangular product C = A*B
 	template<class Field>
 	class BlasMatrixDomainMul<Field,BlasMatrix<typename Field::Element>,BlasMatrix<typename Field::Element>, TriangularBlasMatrix<typename Field::Element> > {
 	public:
 		BlasMatrix<typename Field::Element>& operator()(const Field& F,
-								BlasMatrix<typename Field::Element>& C, 
-								const BlasMatrix<typename Field::Element>& A, 
-								const TriangularBlasMatrix<typename Field::Element>& B) const{
+								BlasMatrix<typename Field::Element>& C,
+								const BlasMatrix<typename Field::Element>& A,
+								const TriangularBlasMatrix<typename Field::Element>& B) const
+		{
 			C = A;
 			return BlasMatrixDomainMulin<Field,BlasMatrix<typename Field::Element>,TriangularBlasMatrix<typename Field::Element> >()( F, C, B);
 		}
 	};
+
 	template<class Field>
 	class BlasMatrixDomainMul<Field,BlasMatrix<typename Field::Element>, TriangularBlasMatrix<typename Field::Element>,BlasMatrix<typename Field::Element> > {
 	public:
 		BlasMatrix<typename Field::Element>& operator()(const Field& F,
-								BlasMatrix<typename Field::Element>& C, 
+								BlasMatrix<typename Field::Element>& C,
 								const TriangularBlasMatrix<typename Field::Element>& B,
-								const BlasMatrix<typename Field::Element>& A) const{
+								const BlasMatrix<typename Field::Element>& A) const
+		{
 			C = A;
 			return BlasMatrixDomainMulin<Field,BlasMatrix<typename Field::Element>,TriangularBlasMatrix<typename Field::Element> >()( F, B, C);
 		}
@@ -618,18 +947,20 @@ namespace LinBox {
 	/*
 	 * specialization for Operand1 of type BlasMatrix<Element> and Operand2 of type TriangularBlasMatrix<Element>
 	 */
-	
+
 	// In-place matrix*triangular matrix product
 	template<class Field>
-	class BlasMatrixDomainMulin<Field,BlasMatrix<typename Field::Element>, TriangularBlasMatrix<typename Field::Element> >{
+	class BlasMatrixDomainMulin<Field,BlasMatrix<typename Field::Element>,
+	      TriangularBlasMatrix<typename Field::Element> >{
 	public:
 		BlasMatrix<typename Field::Element>& operator()( const Field& F,
-								 BlasMatrix<typename Field::Element>& A, 
-								 const TriangularBlasMatrix<typename Field::Element>& B) const{
+								 BlasMatrix<typename Field::Element>& A,
+								 const TriangularBlasMatrix<typename Field::Element>& B) const
+		{
 			typename Field::Element one;
 			F.init(one, 1UL);
 			linbox_check( A.coldim() == B.rowdim() );
-			
+
 			FFLAS::ftrmm( F, FFLAS::FflasRight, (B.getUpLo()==BlasTag::up)?FFLAS::FflasUpper:FFLAS::FflasLower,
 				      FFLAS::FflasNoTrans,(B.getDiag()==BlasTag::unit)?FFLAS::FflasUnit:FFLAS::FflasNonUnit,
 				      A.rowdim(), A.coldim(), one, B.getPointer(), B.getStride(), A.getPointer(), A.getStride() );
@@ -638,7 +969,8 @@ namespace LinBox {
 
 		BlasMatrix<typename Field::Element>& operator()( const Field& F,
 								 const TriangularBlasMatrix<typename Field::Element>& B,
-								 BlasMatrix<typename Field::Element>& A) const{
+								 BlasMatrix<typename Field::Element>& A) const
+		{
 			linbox_check( B.coldim() == A.rowdim() );
 			typename Field::Element one;
 			F.init(one, 1UL);
@@ -648,33 +980,84 @@ namespace LinBox {
 			return A;
 		}
 	};
+
+
+	/*! @internal In-place matrix*triangular matrix product with transpose.
+	 */
+	template<class Field>
+	class BlasMatrixDomainMulin<Field,BlasMatrix<typename Field::Element>,
+	      TransposedBlasMatrix<TriangularBlasMatrix<typename Field::Element> > >{
+	public:
+		BlasMatrix<typename Field::Element>& operator()( const Field& F,
+								 BlasMatrix<typename Field::Element>& A,
+								 const TransposedBlasMatrix< TriangularBlasMatrix<typename Field::Element> >& B) const
+		{
+			typename Field::Element one;
+			F.init(one, 1UL);
+			linbox_check( B.getMatrix().coldim() == A.coldim() );
+
+			FFLAS::ftrmm( F, FFLAS::FflasRight,
+				      (B.getMatrix().getUpLo()==BlasTag::up)?FFLAS::FflasUpper:FFLAS::FflasLower,
+				      FFLAS::FflasTrans,
+				      (B.getMatrix().getDiag()==BlasTag::unit)?FFLAS::FflasUnit:FFLAS::FflasNonUnit,
+				      A.rowdim(), A.coldim(),
+				      one,
+				      B.getMatrix().getPointer(), B.getMatrix().getStride(),
+				      A.getPointer(), A.getStride() );
+			return A;
+		}
+
+		BlasMatrix<typename Field::Element>& operator()( const Field& F,
+								 const TransposedBlasMatrix< TriangularBlasMatrix< typename Field::Element> >& B,
+								 BlasMatrix<typename Field::Element>& A) const
+		{
+			linbox_check( B.getMatrix().coldim() == A.rowdim() );
+			typename Field::Element one;
+			F.init(one, 1UL);
+			FFLAS::ftrmm( F, FFLAS::FflasLeft,
+				      (B.getMatrix().getUpLo()==BlasTag::up)?FFLAS::FflasUpper:FFLAS::FflasLower,
+				      FFLAS::FflasTrans,
+				      (B.getMatrix().getDiag()==BlasTag::unit)?FFLAS::FflasUnit:FFLAS::FflasNonUnit,
+				      A.rowdim(), A.coldim(), one,
+				      B.getMatrix().getPointer(), B.getMatrix().getStride(),
+				      A.getPointer(), A.getStride() );
+			return A;
+		}
+	};
+
+
+
 	/*
 	 * specialization for Operand1 of type TriangularBlasMatrix<Element> and Operand2 of type BlasPermutation
 	 */
-	
-	// Matrix permutation product C = A*B 
+
+	// Matrix permutation product C = A*B
 	template<class Field>
-	class BlasMatrixDomainMul<Field,BlasMatrix<typename Field::Element>,TriangularBlasMatrix<typename Field::Element>, BlasPermutation > {
+	class BlasMatrixDomainMul<Field,BlasMatrix<typename Field::Element>,TriangularBlasMatrix<typename Field::Element>, BlasPermutation<size_t> > {
 	public:
 		BlasMatrix<typename Field::Element>& operator()(const Field& F,
-								BlasMatrix<typename Field::Element>& C, 
-								const TriangularBlasMatrix<typename Field::Element>& A, 
-								const BlasPermutation& B) const{
+								BlasMatrix<typename Field::Element>& C,
+								const TriangularBlasMatrix<typename Field::Element>& A,
+								const BlasPermutation<size_t>& B) const
+		{
 			C = A;
-			return BlasMatrixDomainMulin<Field,BlasMatrix<typename Field::Element>,BlasPermutation >()( F, C, B);
+			return BlasMatrixDomainMulin<Field,BlasMatrix<typename Field::Element>,BlasPermutation<size_t> >()( F, C, B);
 		}
 	};
+
 	template<class Field>
-	class BlasMatrixDomainMul<Field,BlasMatrix<typename Field::Element>, BlasPermutation,TriangularBlasMatrix<typename Field::Element> > {
+	class BlasMatrixDomainMul<Field,BlasMatrix<typename Field::Element>, BlasPermutation<size_t>,TriangularBlasMatrix<typename Field::Element> > {
 	public:
 		BlasMatrix<typename Field::Element>& operator()(const Field& F,
-								BlasMatrix<typename Field::Element>& C, 
-								const BlasPermutation& B,
-								const TriangularBlasMatrix<typename Field::Element>& A) const{
+								BlasMatrix<typename Field::Element>& C,
+								const BlasPermutation<size_t>& B,
+								const TriangularBlasMatrix<typename Field::Element>& A) const
+		{
 			C = A;
-			return BlasMatrixDomainMulin<Field,BlasMatrix<typename Field::Element>,BlasPermutation >()( F, B, C);
+			return BlasMatrixDomainMulin<Field,BlasMatrix<typename Field::Element>,BlasPermutation<size_t> >()( F, B, C);
 		}
 	};
+
 	/*
 	 * Specialization for Operand of type BlasMatrix<Element>
 	 */
@@ -685,16 +1068,18 @@ namespace LinBox {
 		BlasMatrix<typename Field::Element>& operator() (const Field& F,
 								 BlasMatrix<typename Field::Element>& X,
 								 const BlasMatrix<typename Field::Element>& A,
-								 const BlasMatrix<typename Field::Element>& B) const {
+								 const BlasMatrix<typename Field::Element>& B) const
+		{
 			LQUPMatrix<Field> LQUP(F,A);
 			LQUP.left_solve(X,B);
 			return X;
 		}
-	
+
 
 		BlasMatrix<typename Field::Element>& operator() (const Field& F,
-								 const BlasMatrix<typename Field::Element>& A, 
-								 BlasMatrix<typename Field::Element>& B) const{
+								 const BlasMatrix<typename Field::Element>& A,
+								 BlasMatrix<typename Field::Element>& B) const
+		{
 			LQUPMatrix<Field> LQUP(F,A);
 			LQUP.left_solve(B);
 			return B;
@@ -707,21 +1092,23 @@ namespace LinBox {
 		BlasMatrix<typename Field::Element>& operator() (const Field& F,
 								 BlasMatrix<typename Field::Element>& X,
 								 const BlasMatrix<typename Field::Element>& A,
-								 const BlasMatrix<typename Field::Element>& B) const{
+								 const BlasMatrix<typename Field::Element>& B) const
+		{
 			LQUPMatrix<Field> LQUP(F,A);
 			LQUP.right_solve(X,B);
 			return X;
 		}
-	
-	
+
+
 		BlasMatrix<typename Field::Element>& operator() (const Field& F,
-								 const BlasMatrix<typename Field::Element>& A, 
-								 BlasMatrix<typename Field::Element>& B) const{
+								 const BlasMatrix<typename Field::Element>& A,
+								 BlasMatrix<typename Field::Element>& B) const
+		{
 			LQUPMatrix<Field> LQUP(F,A);
 			LQUP.right_solve(B);
 			return B;
 		}
-	
+
 	};
 
 	/*
@@ -734,42 +1121,46 @@ namespace LinBox {
 		std::vector<typename Field::Element>& operator() (const Field& F,
 								  std::vector<typename Field::Element>& X,
 								  const BlasMatrix<typename Field::Element>& A,
-								  const std::vector<typename Field::Element>& B) const {
+								  const std::vector<typename Field::Element>& B) const
+		{
 			LQUPMatrix<Field> LQUP(F,A);
 			LQUP.left_solve(X,B);
 			return X;
 		}
-	
+
 		std::vector<typename Field::Element>& operator()(const Field& F,
-								 const BlasMatrix<typename Field::Element>& A, 
-								 std::vector<typename Field::Element>& B) const{
+								 const BlasMatrix<typename Field::Element>& A,
+								 std::vector<typename Field::Element>& B) const
+		{
 			LQUPMatrix<Field> LQUP(F,A);
 			LQUP.left_solve(B);
-			return B;	
+			return B;
 		}
-		
+
 	};
-	
+
 	template <class Field>
 	class BlasMatrixDomainRightSolve<Field, std::vector<typename Field::Element>, BlasMatrix<typename Field::Element> > {
 	public:
 		std::vector<typename Field::Element>& operator() (const Field& F,
 								  std::vector<typename Field::Element>& X,
 								  const BlasMatrix<typename Field::Element>& A,
-								  const std::vector<typename Field::Element>& B) const{
+								  const std::vector<typename Field::Element>& B) const
+		{
 			LQUPMatrix<Field> LQUP(F,A);
 			LQUP.right_solve(X,B);
 			return X;
 		}
-		
+
 		std::vector<typename Field::Element>& operator() (const Field& F,
-								  const BlasMatrix<typename Field::Element>& A, 
-								  std::vector<typename Field::Element>& B) const{
+								  const BlasMatrix<typename Field::Element>& A,
+								  std::vector<typename Field::Element>& B) const
+		{
 			LQUPMatrix<Field> LQUP(F,A);
 			LQUP.right_solve(B);
 			return B;
 		}
-		
+
 	};
 
 
@@ -777,94 +1168,94 @@ namespace LinBox {
 	 * ********************************************************
 	 * *** Specialization for TriangularBlasMatrix<Element> ***
 	 * ********************************************************
-	 */ 
+	 */
 
 
 	/*
 	 * specialization for Operand of type BlasMatrix<Element>
 	 */
-		
+
 	template <class Field>
 	class BlasMatrixDomainLeftSolve<Field, BlasMatrix<typename Field::Element>,TriangularBlasMatrix<typename Field::Element> > {
 	public:
 		BlasMatrix<typename Field::Element>& operator() (const Field& F,
 								 BlasMatrix<typename Field::Element>& X,
 								 const TriangularBlasMatrix<typename Field::Element>& A,
-								 const BlasMatrix<typename Field::Element>& B) const{
-			
+								 const BlasMatrix<typename Field::Element>& B) const
+		{
+
 			linbox_check( X.rowdim() == B.rowdim());
 			linbox_check( X.coldim() == B.coldim());
-			
+
 			typename BlasMatrix<typename Field::Element>::ConstRawIterator  Biter =   B.rawBegin();
 			typename BlasMatrix<typename Field::Element>::RawIterator       Xiter =   X.rawBegin();
-			
+
 			for (; Biter != B.rawEnd(); ++Biter,++Xiter)
-				F.assign(*Xiter,*Biter);		
+				F.assign(*Xiter,*Biter);
 
 			return (*this)(F,A,X);
-		
-	}
+
+		}
 
 		BlasMatrix<typename Field::Element>& operator() (const Field& F,
-								 const TriangularBlasMatrix<typename Field::Element>& A, 
-								 BlasMatrix<typename Field::Element>& B) const{
-			
+								 const TriangularBlasMatrix<typename Field::Element>& A,
+								 BlasMatrix<typename Field::Element>& B) const
+		{
+
 			linbox_check( A.rowdim() == A.coldim());
-			linbox_check( A.coldim() == B.rowdim());	
+			linbox_check( A.coldim() == B.rowdim());
 			typename Field::Element _One;
 			F.init(_One,1UL);
-			
+
 			switch (A.getUpLo()) {
 			case BlasTag::up:
 				switch(A.getDiag()) {
 				case BlasTag::unit:
-					FFLAS::ftrsm( F, 
+					FFLAS::ftrsm( F,
 						      FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasUnit,
 						      A.rowdim(), B.coldim(),_One,A.getPointer(),A.getStride(),B.getPointer(),B.getStride());
 					break;
 
 				case BlasTag::nonunit: {
-					//TriangularBlasMatrix<typename Field::Element> Acopy(A);
-					FFLAS::ftrsm( F, 
-						      FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit,
-						      A.rowdim(), B.coldim(),_One,A.getPointer(),A.getStride(),B.getPointer(),B.getStride());
-					break; }
-					
+							       //TriangularBlasMatrix<typename Field::Element> Acopy(A);
+							       FFLAS::ftrsm( F,
+									     FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit,
+									     A.rowdim(), B.coldim(),_One,A.getPointer(),A.getStride(),B.getPointer(),B.getStride());
+							       break; }
+
 				default:
-					throw LinboxError ("Error in BlasMatrixDomain (triangular matrix not well defined)");
+							       throw LinboxError ("Error in BlasMatrixDomain (triangular matrix not well defined)");
 				}
 				break;
 
 			case BlasTag::low:
 				switch(A.getDiag()) {
 				case BlasTag::unit:
-					FFLAS::ftrsm( F, 
+					FFLAS::ftrsm( F,
 						      FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasUnit,
 						      A.rowdim(), B.coldim(),_One,A.getPointer(),A.getStride(),B.getPointer(),B.getStride());
 					break;
 
 				case BlasTag::nonunit:
 					{//TriangularBlasMatrix<typename Field::Element> Acopy(A);
-					FFLAS::ftrsm( F, 
-						      FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit,
-						      A.rowdim(), B.coldim(),_One,A.getPointer(),A.getStride(),B.getPointer(),B.getStride());
-					break;}
+						FFLAS::ftrsm( F,
+							      FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit,
+							      A.rowdim(), B.coldim(),_One,A.getPointer(),A.getStride(),B.getPointer(),B.getStride());
+						break;}
 
 				default:
-					throw LinboxError ("Error in BlasMatrixDomain (triangular matrix not well defined)");
+						throw LinboxError ("Error in BlasMatrixDomain (triangular matrix not well defined)");
 				}
 				break;
 
 			default:
 				throw LinboxError ("Error in BlasMatrixDomain (triangular matrix not well defined)");
-				
-			}			
-			
+
+			}
+
 			return B;
 		}
 	};
-		
-
 
 	template <class Field>
 	class BlasMatrixDomainRightSolve<Field,BlasMatrix<typename Field::Element>, TriangularBlasMatrix<typename Field::Element> > {
@@ -872,26 +1263,28 @@ namespace LinBox {
 		BlasMatrix<typename Field::Element>& operator() (const Field& F,
 								 BlasMatrix<typename Field::Element>& X,
 								 const TriangularBlasMatrix<typename Field::Element>& A,
-								 const BlasMatrix<typename Field::Element>& B) const{
-			
+								 const BlasMatrix<typename Field::Element>& B) const
+		{
+
 			linbox_check( X.rowdim() == B.rowdim());
 			linbox_check( X.coldim() == B.coldim());
 
 			typename BlasMatrix<typename Field::Element>::ConstRawIterator  Biter =   B.rawBegin();
 			typename BlasMatrix<typename Field::Element>::RawIterator       Xiter =   X.rawBegin();
-			
+
 			for (; Biter != B.rawEnd(); ++Biter,++Xiter)
-				F.assign(*Xiter,*Biter);		
-			
+				F.assign(*Xiter,*Biter);
+
 			return (*this)(F,A,X);
 		}
 
 		BlasMatrix<typename Field::Element>& operator() (const Field& F,
-								 const TriangularBlasMatrix<typename Field::Element>& A, 
-								 BlasMatrix<typename Field::Element>& B) const{
-			
+								 const TriangularBlasMatrix<typename Field::Element>& A,
+								 BlasMatrix<typename Field::Element>& B) const
+		{
+
 			linbox_check( A.rowdim() == A.coldim());
-			linbox_check( B.coldim() == A.rowdim());		
+			linbox_check( B.coldim() == A.rowdim());
 			typename Field::Element _One;
 			F.init(_One,1UL);
 
@@ -899,12 +1292,12 @@ namespace LinBox {
 			case BlasTag::up:
 				switch(A.getDiag()) {
 				case BlasTag::unit:
-					FFLAS::ftrsm( F, 
+					FFLAS::ftrsm( F,
 						      FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasUnit,
 						      B.rowdim(), A.coldim(),_One,A.getPointer(),A.getStride(),B.getPointer(),B.getStride());
 					break;
 				case BlasTag::nonunit:
-					FFLAS::ftrsm( F, 
+					FFLAS::ftrsm( F,
 						      FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit,
 						      B.rowdim(), A.coldim(),_One,A.getPointer(),A.getStride(),B.getPointer(),B.getStride());
 					break;
@@ -915,12 +1308,12 @@ namespace LinBox {
 			case BlasTag::low:
 				switch(A.getDiag()) {
 				case BlasTag::unit:
-					FFLAS::ftrsm( F, 
+					FFLAS::ftrsm( F,
 						      FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasUnit,
 						      B.rowdim(), A.coldim(),_One,A.getPointer(),A.getStride(),B.getPointer(),B.getStride());
 					break;
 				case BlasTag::nonunit:
-					FFLAS::ftrsm( F, 
+					FFLAS::ftrsm( F,
 						      FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit,
 						      B.rowdim(), A.coldim(),_One,A.getPointer(),A.getStride(),B.getPointer(),B.getStride());
 					break;
@@ -930,14 +1323,12 @@ namespace LinBox {
 				break;
 			default:
 				throw LinboxError ("Error in BlasMatrixDomain (triangular matrix not well defined)");
-				
+
 			}
 			return B;
 		}
 	};
 
-
-
 	/*
 	 * specialization for Operand of type std::vector<Element>
 	 */
@@ -947,38 +1338,40 @@ namespace LinBox {
 	public:
 		std::vector<typename Field::Element>& operator() (const Field& F,
 								  std::vector<typename Field::Element>& x,
-								  const TriangularBlasMatrix<typename Field::Element>& A, 
-								  const std::vector<typename Field::Element>& b) const{
-			
+								  const TriangularBlasMatrix<typename Field::Element>& A,
+								  const std::vector<typename Field::Element>& b) const
+		{
+
 			linbox_check (x.size() == b.size());
 			typename std::vector<typename Field::Element>::const_iterator biter = b.begin();
-			typename std::vector<typename Field::Element>::iterator       xiter = x.begin();   
+			typename std::vector<typename Field::Element>::iterator       xiter = x.begin();
 			for (;biter!=b.end();++biter,++xiter)
 				F.assign(*xiter,*biter);
-			
+
 			return (*this)(F,A,x);
 		}
 
 		std::vector<typename Field::Element>& operator() (const Field& F,
 								  const TriangularBlasMatrix<typename Field::Element>& A,
-								  std::vector<typename Field::Element>& b) const{
-			
+								  std::vector<typename Field::Element>& b) const
+		{
+
 			linbox_check( A.rowdim() == A.coldim());
 			linbox_check( A.rowdim() == b.size());
-					
+
 			switch (A.getUpLo()) {
 			case BlasTag::up:
 				switch(A.getDiag()) {
 				case BlasTag::unit:
-					FFLAS::ftrsv( F, 
+					FFLAS::ftrsv( F,
 						      FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasUnit,
 						      b.size(),A.getPointer(),A.getStride(),&b[0],1);
 					break;
 				case BlasTag::nonunit:
-					FFLAS::ftrsv( F, 
+					FFLAS::ftrsv( F,
 						      FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit,
 						      b.size(),A.getPointer(),A.getStride(),&b[0],1);
-					break;	
+					break;
 				default:
 					throw LinboxError ("Error in BlasMatrixDomain (triangular matrix not well defined)");
 				}
@@ -986,12 +1379,12 @@ namespace LinBox {
 			case BlasTag::low:
 				switch(A.getDiag()) {
 				case BlasTag::unit:
-					FFLAS::ftrsv( F, 
+					FFLAS::ftrsv( F,
 						      FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasUnit,
 						      b.size(),A.getPointer(),A.getStride(),&b[0],1);
 					break;
 				case BlasTag::nonunit:
-					FFLAS::ftrsv( F, 
+					FFLAS::ftrsv( F,
 						      FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit,
 						      b.size(),A.getPointer(),A.getStride(),&b[0],1);
 					break;
@@ -1001,47 +1394,49 @@ namespace LinBox {
 				break;
 			default:
 				throw LinboxError ("Error in BlasMatrixDomain (triangular matrix not well defined)");
-				
+
 			}
 			return b;
 		}
 	};
-	
+
 	template <class Field>
 	class BlasMatrixDomainRightSolve<Field, std::vector<typename Field::Element>, TriangularBlasMatrix<typename Field::Element> > {
 	public:
 		std::vector<typename Field::Element>& operator() (const Field& F,
 								  std::vector<typename Field::Element>& x,
 								  const TriangularBlasMatrix<typename Field::Element>& A,
-								  const std::vector<typename Field::Element>& b) const{
-			
+								  const std::vector<typename Field::Element>& b) const
+		{
+
 			linbox_check (x.size() == b.size());
 			typename std::vector<typename Field::Element>::const_iterator biter = b.begin();
-			typename std::vector<typename Field::Element>::iterator       xiter = x.begin();   
+			typename std::vector<typename Field::Element>::iterator       xiter = x.begin();
 			for (;biter!=b.end();++biter,++xiter)
 				F.assign(*xiter,*biter);
-			
+
 			return (*this)(F,A,x);
 		}
-		
+
 		std::vector<typename Field::Element>& operator() (const Field& F,
-								  const TriangularBlasMatrix<typename Field::Element>& A, 
-								  std::vector<typename Field::Element>& b) const{
-			
+								  const TriangularBlasMatrix<typename Field::Element>& A,
+								  std::vector<typename Field::Element>& b) const
+		{
+
 			linbox_check( A.rowdim() == A.coldim());
 			linbox_check( A.coldim() == b.size());
-			
-			
+
+
 			switch (A.getUpLo()) {
 			case BlasTag::up:
 				switch(A.getDiag()) {
 				case BlasTag::unit:
-					FFLAS::ftrsv( F, 
+					FFLAS::ftrsv( F,
 						      FFLAS::FflasUpper,FFLAS::FflasTrans,FFLAS::FflasUnit,
 						      b.size(),A.getPointer(),A.getStride(),&b[0],1);
-					break;	
+					break;
 				case BlasTag::nonunit:
-					FFLAS::ftrsv( F, 
+					FFLAS::ftrsv( F,
 						      FFLAS::FflasUpper,FFLAS::FflasTrans,FFLAS::FflasNonUnit,
 						      b.size(),A.getPointer(),A.getStride(),&b[0],1);
 					break;
@@ -1052,12 +1447,12 @@ namespace LinBox {
 			case BlasTag::low:
 				switch(A.getDiag()) {
 				case BlasTag::unit:
-					FFLAS::ftrsv( F, 
+					FFLAS::ftrsv( F,
 						      FFLAS::FflasLower,FFLAS::FflasTrans,FFLAS::FflasUnit,
 						      b.size(),A.getPointer(),A.getStride(),&b[0],1);
-					break;	
+					break;
 				case BlasTag::nonunit:
-					FFLAS::ftrsv( F, 
+					FFLAS::ftrsv( F,
 						      FFLAS::FflasLower,FFLAS::FflasTrans,FFLAS::FflasNonUnit,
 						      b.size(),A.getPointer(),A.getStride(),&b[0],1);
 					break;
@@ -1067,16 +1462,18 @@ namespace LinBox {
 				break;
 			default:
 				throw LinboxError ("Error in BlasMatrixDomain (triangular matrix not well defined)");
-				
+
 			}
 			return b;
 		}
 	};
-	
+
 	template< class Field, class Polynomial>
 	class BlasMatrixDomainMinpoly< Field, Polynomial, BlasMatrix<typename Field::Element > > {
 	public:
-		Polynomial& operator() (const Field &F, Polynomial& P, const BlasMatrix<typename Field::Element >& A) const{
+		Polynomial& operator() (const Field &F, Polynomial& P, const BlasMatrix<typename Field::Element >& A) const
+		{
+			commentator.start ("Modular Dense Minpoly ", "MDMinpoly");
 
 			size_t n = A.coldim();
 			linbox_check( n == A.rowdim());
@@ -1084,20 +1481,26 @@ namespace LinBox {
 			size_t *Perm = new size_t[n];
 			for ( size_t i=0; i<n; ++i)
 				Perm[i] = 0;
-			FFPACK::MinPoly( F, P, n, A.getPointer(), A.getStride(), X, n, Perm);
+			FFPACK::MinPoly<Field,Polynomial>( F, P, n, A.getPointer(), A.getStride(), X, n, Perm);
+			commentator.report(Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION) << "minpoly with " << P.size() << " coefficients" << std::endl;
+
 			delete[] Perm;
 			delete[] X;
+			commentator.stop ("done",NULL,"MDMinpoly");
 			return P;
 		}
 	};
 
-	template<>
+#if !defined(__INTEL_COMPILER) && !defined(__CUDACC__)
+	template <>
+#endif
 	template< class Field,  class ContPol >
 	class BlasMatrixDomainCharpoly< Field,  ContPol, BlasMatrix<typename Field::Element > > {
 	public:
-            ContPol& operator() ( const Field                                	&F,
-                                  ContPol                     			&P,
-                                  const BlasMatrix<typename Field::Element > 	&A) const{
+		ContPol& operator() ( const Field                                	&F,
+				      ContPol                     			&P,
+				      const BlasMatrix<typename Field::Element > 	&A) const
+		{
 
 			size_t n = A.coldim();
 			P.clear();
@@ -1108,5 +1511,6 @@ namespace LinBox {
 	};
 
 } //end of namespace LinBox
-	
-#endif
+
+#endif // __LINBOX_blas_matrix_domain_INL
+
diff --git a/linbox/algorithms/block-lanczos.h b/linbox/algorithms/block-lanczos.h
index addb46c..0306e7e 100644
--- a/linbox/algorithms/block-lanczos.h
+++ b/linbox/algorithms/block-lanczos.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* block-lanczos.h
  * Copyright (C) 2002 Bradford Hovinen
  *
@@ -13,8 +13,8 @@
  * Class definitions for block Lanczos iteration
  */
 
-#ifndef __BLOCK_LANCZOS_H
-#define __BLOCK_LANCZOS_H
+#ifndef __LINBOX_block_lanczos_H
+#define __LINBOX_block_lanczos_H
 
 #include "linbox/linbox-config.h"
 
@@ -35,233 +35,233 @@
 #undef _M
 #undef _N
 
-namespace LinBox 
-{
-
-/** @brief Block Lanczos iteration
- *
- * This is a blocked version of the iteration given in @ref{LanczosSolver}. The
- * essential difference is that, rather than applying the black box $A$ to a
- * single vector $v$ during each iteration, the block box $A$ is applied to an
- * $n\times N$ matrix $V$ or, equivalently, to $N$ vectors
- * $v_1, \ldots, v_N$ Scalars in the original iteration become $N\times N$
- * matrices in the blocked version. The resulting iteration is a natural
- * extension of the basic theory of the original Lanczos iteration,
- * c.f. (Montgomery 1995). This has the advantage of more flexible
- * parallelization, and does not break down as often when used over small
- * fields.
- *
- * Currently, only dense vectors are supported for this iteration, and it is
- * unlikely any other vector archetypes will be supported in the future.
- */
-template <class Field, class Matrix = DenseMatrixBase<typename Field::Element> >
-class BlockLanczosSolver
+namespace LinBox
 {
-    public:
-
-	typedef typename Field::Element Element;
 
-	/** Constructor
-	 * @param F Field over which to operate
-	 * @param traits @ref{SolverTraits} structure describing user
-	 *               options for the solver 
-	 */
-	BlockLanczosSolver (const Field &F, const BlockLanczosTraits &traits)
-		: _traits (traits), _F (F), _VD (F), _MD (F), _randiter (F), _N (traits.blockingFactor ())
-	{
-		init_temps ();
-		_F.init (_one, 1);
-	}
-
-	/** Constructor with a random iterator
-	 * @param F Field over which to operate
-	 * @param traits @ref{SolverTraits} structure describing user
-	 *               options for the solver 
-	 * @param r Random iterator to use for randomization
-	 */
-	BlockLanczosSolver (const Field &F, const BlockLanczosTraits &traits, typename Field::RandIter r)
-		: _traits (traits), _F (F), _VD (F), _MD (F), _randiter (r), _N (traits.blockingFactor ())
-	{
-		init_temps ();
-		_F.init (_one, 1);
-	}
-
-	/** Solve the linear system Ax = b.
-	 *
-	 * If the system is nonsingular, this method computes the unique
-	 * solution to the system Ax = b. If the system is singular, it computes
-	 * a random solution.
+	/** @brief Block Lanczos iteration
 	 *
-	 * If the matrix A is nonsymmetric, this method preconditions the matrix
-	 * A with the preconditioner D_1 A^T D_2 A D_1, where D_1 and D_2 are
-	 * random nonsingular diagonal matrices. If the matrix A is symmetric,
-	 * this method preconditions the system with A D, where D is a random
-	 * diagonal matrix.
+	 * This is a blocked version of the iteration given in @ref LanczosSolver. The
+	 * essential difference is that, rather than applying the black box \f$A\f$ to a
+	 * single vector $v$ during each iteration, the block box \f$A\f$ is applied to an
+	 * \f$n\times N\f$ matrix \f$V\f$ or, equivalently, to \f$N\f$ vectors
+	 * \f$v_1, \ldots, v_N\f$ Scalars in the original iteration become \f$N\times N\f$
+	 * matrices in the blocked version. The resulting iteration is a natural
+	 * extension of the basic theory of the original Lanczos iteration,
+	 * c.f. (see Montgomery 1995 ). This has the advantage of more flexible
+	 * parallelization, and does not break down as often when used over small
+	 * fields.
 	 *
-	 * @param A Black box for the matrix A
-	 * @param x Vector in which to store solution
-	 * @param b Right-hand side of system
-	 * @return Reference to solution vector
+	 * Currently, only dense vectors are supported for this iteration, and it is
+	 * unlikely any other vector archetypes will be supported in the future.
+	 * @bib [Montgomery '95]
 	 */
-	template <class Blackbox, class Vector>
-	Vector &solve (const Blackbox &A, Vector &x, const Vector &b);
-
-    private:
-
-	// S_i is represented here as a vector of booleans, where the entry at
-	// index j is true if and only if the corresponding column of V_i is to
-	// be included in W_i
-
-	// All references to Winv are actually -Winv
-
-	// Run the block Lanczos iteration and return the result. Return false
-	// if the method breaks down. Do not check that Ax = b in the end
-	template <class Blackbox, class Vector>
-	bool iterate (const Blackbox &A, Vector &x, const Vector &b);
-
-	// Compute W_i^inv and S_i given V_i^T A V_i
-	int compute_Winv_S (Matrix            &Winv,
-			    std::vector<bool> &S,
-			    const Matrix      &T);
-
-	// Given B with N columns and S_i, compute B S_i S_i^T
-	template <class Matrix1, class Matrix2>
-	Matrix1 &mul_SST (Matrix1                 &BSST,
-			  const Matrix2           &B,
-			  const std::vector<bool> &S) const;
-
-	// Matrix-matrix multiply
-	// C = A * B * S_i * S_i^T
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1 &mul (Matrix1                 &C,
-		      const Matrix2           &A,
-		      const Matrix3           &B,
-		      const std::vector<bool> &S) const;
-
-	// In-place matrix-matrix multiply on the right
-	// A = A * B * S_i * S_i^T
-	// This is a version of the above optimized to use as little additional
-	// memory as possible
-	template <class Matrix1, class Matrix2>
-	Matrix1 &mulin (Matrix1                 &A,
-			const Matrix2           &B,
-			const std::vector<bool> &S) const;
-
-	// Matrix-vector multiply
-	// w = A * S_i * S_i^T * v
-	template <class Vector1, class Matrix1, class Vector2>
-	Vector1 &vectorMul (Vector1                 &w,
-			    const Matrix1           &A,
-			    const Vector2           &v,
-			    const std::vector<bool> &S) const;
-
-	// Matrix-vector transpose multiply
-	// w = (A * S_i * S_i^T)^T * v
-	template <class Vector1, class Matrix1, class Vector2>
-	Vector1 &vectorMulTranspose (Vector1                 &w,
-				     const Matrix1           &A,
-				     const Vector2           &v,
-				     const std::vector<bool> &S) const;
-
-	// Matrix-matrix addition
-	// A = A + B * S_i * S_i^T
-	template <class Matrix1, class Matrix2>
-	Matrix1 &addin (Matrix1                 &A,
-			const Matrix2           &B,
-			const std::vector<bool> &S) const;
-
-	// Add I_N to the given N x N matrix
-	// A = A + I_N
-	template <class Matrix1>
-	Matrix1 &addIN (Matrix1 &A) const;
-
-	// Given a vector S of bools, write an array of array indices in which
-	// the true values of S are last
-	void permute (std::vector<size_t>     &indices,
-		      const std::vector<bool> &S) const;
-
-	// Set the given matrix to the identity
-	template <class Matrix1>
-	Matrix1 &setIN (Matrix1 &A) const;
-
-	// Find a suitable pivot row for a column and exchange it with the given
-	// row
-	bool find_pivot_row (Matrix                    &A,
-			     size_t                     row,
-			     int                        col_offset,
-			     const std::vector<size_t> &indices);
-
-	// Eliminate all entries in a column except the pivot row, using row
-	// operations from the pivot row
-	void eliminate_col (Matrix                    &A,
-			    size_t                     pivot,
-			    int                        col_offset,
-			    const std::vector<size_t> &indices,
-			    const Element             &Ajj_inv);
-
-	// Initialize the temporaries used in computation
-	void init_temps ();
-
-	// Private variables
-
-	const BlockLanczosTraits _traits;
-	const Field              &_F;
-	VectorDomain<Field>       _VD;
-	MatrixDomain<Field>       _MD;
-	typename Field::RandIter  _randiter;
-
-	// Temporaries used in the computation
-
-	Matrix  _V[3];             // n x N
-	Matrix  _AV;               // n x N
-	Matrix  _VTAV;             // N x N
-	Matrix  _Winv[2];          // N x N
-	Matrix  _AVTAVSST_VTAV;    // N x N
-	Matrix  _T;                // N x N
-	Matrix  _DEF;              // N x N
-	std::vector<bool>         _S;                // N-vector of bools
-
-	mutable typename Vector<Field>::Dense _tmp;  // N
-
-	typename Field::Element   _one;
-
-	std::vector<size_t>       _indices;          // N
-
-	mutable Matrix _M;         // N x 2N
-
-	// Blocking factor
-
-	size_t                    _N;
-
-	// Construct a transpose matrix on the fly
-	template <class Matrix1>
-	TransposeMatrix<Matrix1> transpose (Matrix1 &M) const
+	template <class Field, class Matrix = DenseMatrixBase<typename Field::Element> >
+	class BlockLanczosSolver {
+	public:
+
+		typedef typename Field::Element Element;
+
+		/** @brief Constructor.
+		 * @param F Field over which to operate
+		 * @param traits @ref SolverTraits  structure describing user
+		 *               options for the solver
+		 */
+		BlockLanczosSolver (const Field &F, const BlockLanczosTraits &traits) :
+			_traits (traits), _F (F), _VD (F), _MD (F), _randiter (F), _N (traits.blockingFactor ())
+		{
+			init_temps ();
+			_F.init (_one, 1);
+		}
+
+		/** Constructor with a random iterator.
+		 * @param F Field over which to operate
+		 * @param traits @ref SolverTraits structure describing user
+		 *               options for the solver
+		 * @param r Random iterator to use for randomization
+		 */
+		BlockLanczosSolver (const Field &F, const BlockLanczosTraits &traits, typename Field::RandIter r) :
+			_traits (traits), _F (F), _VD (F), _MD (F), _randiter (r), _N (traits.blockingFactor ())
+		{
+			init_temps ();
+			_F.init (_one, 1);
+		}
+
+		/** Solve the linear system Ax = b.
+		 *
+		 * If the system is nonsingular, this method computes the unique
+		 * solution to the system Ax = b. If the system is singular, it computes
+		 * a random solution.
+		 *
+		 * If the matrix A is nonsymmetric, this method preconditions the matrix
+		 * A with the preconditioner D_1 A^T D_2 A D_1, where D_1 and D_2 are
+		 * random nonsingular diagonal matrices. If the matrix A is symmetric,
+		 * this method preconditions the system with A D, where D is a random
+		 * diagonal matrix.
+		 *
+		 * @param A Black box for the matrix A
+		 * @param x Vector in which to store solution
+		 * @param b Right-hand side of system
+		 * @return Reference to solution vector
+		 */
+		template <class Blackbox, class Vector>
+		Vector &solve (const Blackbox &A, Vector &x, const Vector &b);
+
+	private:
+
+		// S_i is represented here as a vector of booleans, where the entry at
+		// index j is true if and only if the corresponding column of V_i is to
+		// be included in W_i
+
+		// All references to Winv are actually -Winv
+
+		// Run the block Lanczos iteration and return the result. Return false
+		// if the method breaks down. Do not check that Ax = b in the end
+		template <class Blackbox, class Vector>
+		bool iterate (const Blackbox &A, Vector &x, const Vector &b);
+
+		// Compute W_i^inv and S_i given V_i^T A V_i
+		int compute_Winv_S (Matrix            &Winv,
+				    std::vector<bool> &S,
+				    const Matrix      &T);
+
+		// Given B with N columns and S_i, compute B S_i S_i^T
+		template <class Matrix1, class Matrix2>
+		Matrix1 &mul_SST (Matrix1                 &BSST,
+				  const Matrix2           &B,
+				  const std::vector<bool> &S) const;
+
+		// Matrix-matrix multiply
+		// C = A * B * S_i * S_i^T
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1 &mul (Matrix1                 &C,
+			      const Matrix2           &A,
+			      const Matrix3           &B,
+			      const std::vector<bool> &S) const;
+
+		// In-place matrix-matrix multiply on the right
+		// A = A * B * S_i * S_i^T
+		// This is a version of the above optimized to use as little additional
+		// memory as possible
+		template <class Matrix1, class Matrix2>
+		Matrix1 &mulin (Matrix1                 &A,
+				const Matrix2           &B,
+				const std::vector<bool> &S) const;
+
+		// Matrix-vector multiply
+		// w = A * S_i * S_i^T * v
+		template <class Vector1, class Matrix1, class Vector2>
+		Vector1 &vectorMul (Vector1                 &w,
+				    const Matrix1           &A,
+				    const Vector2           &v,
+				    const std::vector<bool> &S) const;
+
+		// Matrix-vector transpose multiply
+		// w = (A * S_i * S_i^T)^T * v
+		template <class Vector1, class Matrix1, class Vector2>
+		Vector1 &vectorMulTranspose (Vector1                 &w,
+					     const Matrix1           &A,
+					     const Vector2           &v,
+					     const std::vector<bool> &S) const;
+
+		// Matrix-matrix addition
+		// A = A + B * S_i * S_i^T
+		template <class Matrix1, class Matrix2>
+		Matrix1 &addin (Matrix1                 &A,
+				const Matrix2           &B,
+				const std::vector<bool> &S) const;
+
+		// Add I_N to the given N x N matrix
+		// A = A + I_N
+		template <class Matrix1>
+		Matrix1 &addIN (Matrix1 &A) const;
+
+		// Given a vector S of bools, write an array of array indices in which
+		// the true values of S are last
+		void permute (std::vector<size_t>     &indices,
+			      const std::vector<bool> &S) const;
+
+		// Set the given matrix to the identity
+		template <class Matrix1>
+		Matrix1 &setIN (Matrix1 &A) const;
+
+		// Find a suitable pivot row for a column and exchange it with the given
+		// row
+		bool find_pivot_row (Matrix                    &A,
+				     size_t                     row,
+				     int                        col_offset,
+				     const std::vector<size_t> &indices);
+
+		// Eliminate all entries in a column except the pivot row, using row
+		// operations from the pivot row
+		void eliminate_col (Matrix                    &A,
+				    size_t                     pivot,
+				    int                        col_offset,
+				    const std::vector<size_t> &indices,
+				    const Element             &Ajj_inv);
+
+		// Initialize the temporaries used in computation
+		void init_temps ();
+
+		// Private variables
+
+		const BlockLanczosTraits _traits;
+		const Field              &_F;
+		VectorDomain<Field>       _VD;
+		MatrixDomain<Field>       _MD;
+		typename Field::RandIter  _randiter;
+
+		// Temporaries used in the computation
+
+		Matrix  _V[3];             // n x N
+		Matrix  _AV;               // n x N
+		Matrix  _VTAV;             // N x N
+		Matrix  _Winv[2];          // N x N
+		Matrix  _AVTAVSST_VTAV;    // N x N
+		Matrix  _T;                // N x N
+		Matrix  _DEF;              // N x N
+		std::vector<bool>         _S;                // N-vector of bools
+
+		mutable typename Vector<Field>::Dense _tmp;  // N
+
+		typename Field::Element   _one;
+
+		std::vector<size_t>       _indices;          // N
+
+		mutable Matrix _M;         // N x 2N
+
+		// Blocking factor
+
+		size_t                    _N;
+
+		// Construct a transpose matrix on the fly
+		template <class Matrix1>
+		TransposeMatrix<Matrix1> transpose (Matrix1 &M) const
 		{ return TransposeMatrix<Matrix1> (M); }
 
 
-    protected:
+	protected:
 
-	template <class Matrix1>
-	bool isAlmostIdentity (const Matrix1 &M) const;
+		template <class Matrix1>
+		bool isAlmostIdentity (const Matrix1 &M) const;
 
-	// Test suite for the above functions
+		// Test suite for the above functions
 
-	bool test_compute_Winv_S_mul (int n) const;
-	bool test_compute_Winv_S_mulin (int n) const;
-	bool test_mul_SST (int n) const;
-	bool test_mul_ABSST (int n) const;
-	bool test_mulTranspose (int m, int n) const;
-	bool test_mulTranspose_ABSST (int n) const;
-	bool test_mulin_ABSST (int n) const;
-	bool test_addin_ABSST (int n) const;
+		bool test_compute_Winv_S_mul (int n) const;
+		bool test_compute_Winv_S_mulin (int n) const;
+		bool test_mul_SST (int n) const;
+		bool test_mul_ABSST (int n) const;
+		bool test_mulTranspose (int m, int n) const;
+		bool test_mulTranspose_ABSST (int n) const;
+		bool test_mulin_ABSST (int n) const;
+		bool test_addin_ABSST (int n) const;
 
-    public:
+	public:
 
-	bool runSelfCheck () const;
-};
+		bool runSelfCheck () const;
+	};
 
 } // namespace LinBox
 
 #include "block-lanczos.inl"
 
-#endif // __BLOCK_LANCZOS_H
+#endif // __LINBOX_block_lanczos_H
diff --git a/linbox/algorithms/block-lanczos.inl b/linbox/algorithms/block-lanczos.inl
index b34b9ba..733b7bd 100644
--- a/linbox/algorithms/block-lanczos.inl
+++ b/linbox/algorithms/block-lanczos.inl
@@ -1,7 +1,7 @@
 /* -*- 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
 /* block-lanczos.inl
- * Copyright (C) 2002 Bradford Hovinen
+ * Copyright (C) 2002  LinBox
  *
  * Written by Bradford Hovinen <bghovinen at math.waterloo.ca>
  *
@@ -13,8 +13,8 @@
  * Function definitions for block Lanczos iteration
  */
 
-#ifndef __BLOCK_LANCZOS_INL
-#define __BLOCK_LANCZOS_INL
+#ifndef __LINBOX_block_lanczos_INL
+#define __LINBOX_block_lanczos_INL
 
 #include "linbox/linbox-config.h"
 
@@ -40,78 +40,65 @@
 #undef _M
 #undef _N
 
-namespace LinBox 
+namespace LinBox
 {
 
 #ifdef DETAILED_TRACE
 
-std::ostream &operator << (std::ostream &out, const std::vector<bool> &S) 
-{
-	std::vector<bool>::const_iterator i;
-
-	for (i = S.begin (); i != S.end (); ++i) {
-		out << ((*i) ? "1" : "0");
-		if (i != S.end () - 1)
-			out << ", ";
+	template <class Field, class Matrix>
+	void BLTraceReport (std::ostream &out, MatrixDomain<Field> &MD, const char *text, size_t iter, const Matrix &M)
+	{
+		out << text << " [" << iter << "]:" << std::endl;
+		MD.write (out, M);
 	}
 
-	return out;
-}
-
-template <class Field, class Matrix>
-void BLTraceReport (std::ostream &out, MatrixDomain<Field> &MD, const char *text, size_t iter, const Matrix &M)
-{
-	out << text << " [" << iter << "]:" << std::endl;
-	MD.write (out, M);
-}
-
-template <class Field, class Vector>
-void BLTraceReport (std::ostream &out, VectorDomain<Field> &VD, const char *text, size_t iter, const Vector &v)
-{
-	out << text << " [" << iter << "]: ";
-	VD.write (out, v) << std::endl;
-}
+	template <class Field, class Vector>
+	void BLTraceReport (std::ostream &out, VectorDomain<Field> &VD, const char *text, size_t iter, const Vector &v)
+	{
+		out << text << " [" << iter << "]: ";
+		VD.write (out, v) << std::endl;
+	}
 
-void reportS (std::ostream &out, const std::vector<bool> &S, size_t iter) 
-{
-	out << "S_" << iter << ": [" << S << "]" << std::endl;
-}
+	void reportS (std::ostream &out, const std::vector<bool> &S, size_t iter)
+	{
+		out << "S_" << iter << ": [" << S << "]" << std::endl;
+	}
 
-template <class Field, class Matrix>
-void checkAConjugacy (const MatrixDomain<Field> &MD, const Matrix &AV, Matrix &V, Matrix &T,
-		      size_t AV_iter, size_t V_iter) 
-{
-	std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+	template <class Field, class Matrix>
+	void checkAConjugacy (const MatrixDomain<Field> &MD, const Matrix &AV, Matrix &V, Matrix &T,
+			      size_t AV_iter, size_t V_iter)
+	{
+		std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
 
-	report << "Checking whether V_" << V_iter << " is A-conjugate to V_" << AV_iter << "...";
+		report << "Checking whether V_" << V_iter << " is A-conjugate to V_" << AV_iter << "...";
 
-	MD.mul (T, TransposeMatrix<Matrix> (V), AV);
+		MD.mul (T, TransposeMatrix<Matrix> (V), AV);
 
-	if (MD.isZero (T))
-		report << "yes" << std::endl;
-	else {
-		report << "no" << std::endl;
+		if (MD.isZero (T))
+			report << "yes" << std::endl;
+		else {
+			report << "no" << std::endl;
 
-		std::ostream &err_report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR);
-		err_report << "ERROR: V_" << V_iter << " is not A-conjugate to V_" << AV_iter << std::endl;
-		err_report << "Computed V_" << V_iter << "^T AV_" << AV_iter << ":" << std::endl;
-		MD.write (report, T);
+			std::ostream &err_report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR);
+			err_report << "ERROR: V_" << V_iter << " is not A-conjugate to V_" << AV_iter << std::endl;
+			err_report << "Computed V_" << V_iter << "^T AV_" << AV_iter << ":" << std::endl;
+			MD.write (report, T);
+		}
 	}
-}
 
 #else
 
-template <class Domain, class Object>
-inline void BLTraceReport (std::ostream &out, Domain &D, const char *text, size_t iter, const Object &obj)
-{}
+	template <class Domain, class Object>
+	inline void BLTraceReport (std::ostream &out, Domain &D, const char *text, size_t iter, const Object &obj)
+	{}
 
-void reportS (std::ostream &out, const std::vector<bool> &S, size_t iter) 
-{}
+	void reportS (std::ostream &out, const std::vector<bool> &S, size_t iter)
+	{}
 
-template <class Field, class Matrix>
-inline void checkAConjugacy (const MatrixDomain<Field> &MD, const Matrix &AV, const Matrix &V, Matrix &T,
-			     size_t AV_iter, size_t V_iter) 
-{}
+	template <class Field, class Matrix>
+	inline void checkAConjugacy (const MatrixDomain<Field> &MD, const Matrix &AV, const Matrix &V, Matrix &T,
+				     size_t AV_iter, size_t V_iter)
+	{}
 
 #endif
 
@@ -121,7 +108,7 @@ inline void checkAConjugacy (const MatrixDomain<Field> &MD, const Matrix &AV, co
 #  define TIMER_STOP(part) part##_timer.stop (); part##_time += part##_timer.time ()
 #  define TIMER_REPORT(part) \
 	commentator.report (Commentator::LEVEL_NORMAL, TIMING_MEASURE) \
-		<< "Total " #part " time: " << part##_time << "s" << std::endl;
+	<< "Total " #part " time: " << part##_time << "s" << std::endl;
 #else
 #  define TIMER_DECLARE(part)
 #  define TIMER_START(part)
@@ -129,1280 +116,1289 @@ inline void checkAConjugacy (const MatrixDomain<Field> &MD, const Matrix &AV, co
 #  define TIMER_REPORT(part)
 #endif
 
-// N.B. This code was lifted from the Lanczos iteration in LinBox
-
-template <class Field, class Matrix>
-template <class Blackbox, class Vector>
-Vector &BlockLanczosSolver<Field, Matrix>::solve (const Blackbox &A, Vector &x, const Vector &b) 
-{
-	linbox_check ((x.size () == A.coldim ()) &&
-		      (b.size () == A.rowdim ()));
-
-	commentator.start ("Solving linear system (Block Lanczos)", "BlockLanczosSolver::solve");
-
-	bool success = false;
-	Vector d1, d2, b1, b2, bp, y, Ax, ATAx, ATb;
-
-	// Get the temporaries into the right sizes
-	_V[0].resize (A.coldim (), _N);
-	_V[1].resize (A.coldim (), _N);
-	_V[2].resize (A.coldim (), _N);
-	_AV.resize (A.coldim (), _N);
-
-	NonzeroRandIter<Field> real_ri (_F, _randiter);
-	RandomDenseStream<Field, Vector, NonzeroRandIter<Field> > stream (_F, real_ri, A.coldim ());
+	// N.B. This code was lifted from the Lanczos iteration in LinBox
 
-	for (unsigned int i = 0; !success && i < _traits.maxTries (); ++i) {
-		std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-
-		switch (_traits.preconditioner ()) {
-		    case BlockLanczosTraits::NO_PRECONDITIONER:
-			success = iterate (A, x, b);
-			break;
+	template <class Field, class Matrix>
+	template <class Blackbox, class Vector>
+	Vector &BlockLanczosSolver<Field, Matrix>::solve (const Blackbox &A, Vector &x, const Vector &b)
+	{
+		linbox_check ((x.size () == A.coldim ()) &&
+			      (b.size () == A.rowdim ()));
 
-		    case BlockLanczosTraits::SYMMETRIZE:
-		    {
-			VectorWrapper::ensureDim (bp, A.coldim ());
+		commentator.start ("Solving linear system (Block Lanczos)", "BlockLanczosSolver::solve");
 
-			Transpose<Blackbox> AT (&A);
-			Compose< Transpose< Blackbox>, Blackbox> B (&AT, &A);
+		bool success = false;
+		Vector d1, d2, b1, b2, bp, y, Ax, ATAx, ATb;
 
-			AT.apply (bp, b);
+		// Get the temporaries into the right sizes
+		_V[0].resize (A.coldim (), _N);
+		_V[1].resize (A.coldim (), _N);
+		_V[2].resize (A.coldim (), _N);
+		_AV.resize (A.coldim (), _N);
 
-			success = iterate (B, x, bp);
+		NonzeroRandIter<Field> real_ri (_F, _randiter);
+		RandomDenseStream<Field, Vector, NonzeroRandIter<Field> > stream (_F, real_ri, A.coldim ());
 
-			break;
-		    }
+		for (unsigned int i = 0; !success && i < _traits.maxTries (); ++i) {
+			std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
 
-		    case BlockLanczosTraits::PARTIAL_DIAGONAL:
-		    {
-			VectorWrapper::ensureDim (d1, A.coldim ());
-			VectorWrapper::ensureDim (y, A.coldim ());
+			switch (_traits.preconditioner ()) {
+			case BlockLanczosTraits::NO_PRECONDITIONER:
+				success = iterate (A, x, b);
+				break;
 
-			stream >> d1;
-			Diagonal<Field> D (_F, d1);
-			Compose<Blackbox, Diagonal<Field> > B (&A, &D);
+			case BlockLanczosTraits::SYMMETRIZE:
+				{
+					VectorWrapper::ensureDim (bp, A.coldim ());
 
-			report << "Random D: ";
-			_VD.write (report, d1) << std::endl;
+					Transpose<Blackbox> AT (&A);
+					Compose< Transpose< Blackbox>, Blackbox> B (&AT, &A);
 
-			success = iterate (B, y, b);
+					AT.apply (bp, b);
 
-			D.apply (x, y);
+					success = iterate (B, x, bp);
 
-			break;
-		    }
+					break;
+				}
 
-		    case BlockLanczosTraits::PARTIAL_DIAGONAL_SYMMETRIZE:
-		    {
-			VectorWrapper::ensureDim (d1, A.rowdim ());
-			VectorWrapper::ensureDim (b1, A.rowdim ());
-			VectorWrapper::ensureDim (bp, A.coldim ());
+			case BlockLanczosTraits::PARTIAL_DIAGONAL:
+				{
+					VectorWrapper::ensureDim (d1, A.coldim ());
+					VectorWrapper::ensureDim (y, A.coldim ());
 
-			typedef Diagonal<Field> PC1;
-			typedef Transpose<Blackbox> PC2;
-			typedef Compose<PC1, Blackbox> CO1;
-			typedef Compose<PC2, CO1> CO2;
+					stream >> d1;
+					Diagonal<Field> D (_F, d1);
+					Compose<Blackbox, Diagonal<Field> > B (&A, &D);
 
-			stream >> d1;
-			PC1 D (_F, d1);
-			PC2 AT (&A);
-			CO1 B1 (&D, &A);
-			CO2 B (&AT, &B1);
+					report << "Random D: ";
+					_VD.write (report, d1) << std::endl;
 
-			report << "Random D: ";
-			_VD.write (report, d1) << std::endl;
+					success = iterate (B, y, b);
 
-			D.apply (b1, b);
-			AT.apply (bp, b1);
+					D.apply (x, y);
 
-			success = iterate (B, x, bp);
+					break;
+				}
 
-			break;
-		    }
+			case BlockLanczosTraits::PARTIAL_DIAGONAL_SYMMETRIZE:
+				{
+					VectorWrapper::ensureDim (d1, A.rowdim ());
+					VectorWrapper::ensureDim (b1, A.rowdim ());
+					VectorWrapper::ensureDim (bp, A.coldim ());
 
-		    case BlockLanczosTraits::FULL_DIAGONAL:
-		    {
-			VectorWrapper::ensureDim (d1, A.coldim ());
-			VectorWrapper::ensureDim (d2, A.rowdim ());
-			VectorWrapper::ensureDim (b1, A.rowdim ());
-			VectorWrapper::ensureDim (b2, A.coldim ());
-			VectorWrapper::ensureDim (bp, A.coldim ());
-			VectorWrapper::ensureDim (y, A.coldim ());
+					typedef Diagonal<Field> PC1;
+					typedef Transpose<Blackbox> PC2;
+					typedef Compose<PC1, Blackbox> CO1;
+					typedef Compose<PC2, CO1> CO2;
 
-			typedef Diagonal<Field> PC1;
-			typedef Transpose<Blackbox> PC2;
-			typedef Compose<Blackbox, PC1> CO1;
-			typedef Compose<PC1, CO1> CO2;
-			typedef Compose<PC2, CO2> CO3;
-			typedef Compose<PC1, CO3> CO4;
+					stream >> d1;
+					PC1 D (_F, d1);
+					PC2 AT (&A);
+					CO1 B1 (&D, &A);
+					CO2 B (&AT, &B1);
 
-			stream >> d1 >> d2;
-			PC1 D1 (_F, d1);
-			PC1 D2 (_F, d2);
-			PC2 AT (&A);
-			CO1 B1 (&A, &D1);
-			CO2 B2 (&D2, &B1);
- 			CO3 B3 (&AT, &B2);
-			CO4 B (&D1, &B3);
+					report << "Random D: ";
+					_VD.write (report, d1) << std::endl;
 
-			report << "Random D_1: ";
-			_VD.write (report, d1) << std::endl;
+					D.apply (b1, b);
+					AT.apply (bp, b1);
 
-			report << "Random D_2: ";
-			_VD.write (report, d2) << std::endl;
+					success = iterate (B, x, bp);
 
-			D2.apply (b1, b);
-			AT.apply (b2, b1);
-			D1.apply (bp, b2);
+					break;
+				}
 
-			success = iterate (B, y, bp);
-			D1.apply (x, y);
+			case BlockLanczosTraits::FULL_DIAGONAL:
+				{
+					VectorWrapper::ensureDim (d1, A.coldim ());
+					VectorWrapper::ensureDim (d2, A.rowdim ());
+					VectorWrapper::ensureDim (b1, A.rowdim ());
+					VectorWrapper::ensureDim (b2, A.coldim ());
+					VectorWrapper::ensureDim (bp, A.coldim ());
+					VectorWrapper::ensureDim (y, A.coldim ());
+
+					typedef Diagonal<Field> PC1;
+					typedef Transpose<Blackbox> PC2;
+					typedef Compose<Blackbox, PC1> CO1;
+					typedef Compose<PC1, CO1> CO2;
+					typedef Compose<PC2, CO2> CO3;
+					typedef Compose<PC1, CO3> CO4;
+
+					stream >> d1 >> d2;
+					PC1 D1 (_F, d1);
+					PC1 D2 (_F, d2);
+					PC2 AT (&A);
+					CO1 B1 (&A, &D1);
+					CO2 B2 (&D2, &B1);
+					CO3 B3 (&AT, &B2);
+					CO4 B (&D1, &B3);
+
+					report << "Random D_1: ";
+					_VD.write (report, d1) << std::endl;
+
+					report << "Random D_2: ";
+					_VD.write (report, d2) << std::endl;
+
+					D2.apply (b1, b);
+					AT.apply (b2, b1);
+					D1.apply (bp, b2);
+
+					success = iterate (B, y, bp);
+					D1.apply (x, y);
+
+					break;
+				}
 
-			break;
-		    }
+			default:
+				throw PreconditionFailed (__func__, __LINE__,
+							  "preconditioner is NO_PRECONDITIONER, SYMMETRIZE, PARTIAL_DIAGONAL_SYMMETRIZE, "
+							  "PARTIAL_DIAGONAL, or FULL_DIAGONAL");
+			}
 
-		    default:
-			throw PreconditionFailed (__FUNCTION__, __LINE__,
-						  "preconditioner is NO_PRECONDITIONER, SYMMETRIZE, PARTIAL_DIAGONAL_SYMMETRIZE, "
-						  "PARTIAL_DIAGONAL, or FULL_DIAGONAL");
-		}
 
 
-                
-                    // JGD  11.07.2005
-                    // I DON'T KNOW WHY IT IS WORKING BUT IT DOES WORK
-                    // Without this negin the results is minus the correct solution
-                    // I have seen this sentence in mg-bla which comforts my choice:
-                    // "Because we set Winv to -Winv, we have -x at the end of the
-                    //  iteration. So negate the result and return it"
-                    // I don't know when to negate it, so I check first,
-                    // if the result is not correct I try to negate !!!
-                VectorWrapper::ensureDim (Ax, A.rowdim ());
-                        
-                if ((_traits.preconditioner () == BlockLanczosTraits::SYMMETRIZE) ||
-                    (_traits.preconditioner () == BlockLanczosTraits::PARTIAL_DIAGONAL_SYMMETRIZE) ||
-                    (_traits.preconditioner () == BlockLanczosTraits::FULL_DIAGONAL))
-			{
-                            VectorWrapper::ensureDim (ATAx, A.coldim ());
-                            VectorWrapper::ensureDim (ATb, A.coldim ());
-                            
-                            
-                            A.apply (Ax, x);
-                            A.applyTranspose (ATAx, Ax);
-                            A.applyTranspose (ATb, b);
-                            
-                            if (_VD.areEqual (ATAx, ATb)) {
-                                success = true;
-                            } else {
-                                success = false;
-                            }
-			}
-                else {                    
-                    A.apply (Ax, x);
-                    
-                    if (_VD.areEqual (Ax, b)) {
-                        success = true;
-                    } else {
-                        success = false;
-                    }
-                }
-                if(! success) _VD.negin(x);
-                    // End of JGD INFAMOUS HACK
-
-
-		if (_traits.checkResult ()) {
+			// JGD  11.07.2005
+			// I DON'T KNOW WHY IT IS WORKING BUT IT DOES WORK
+			// Without this negin the results is minus the correct solution
+			// I have seen this sentence in mg-bla which comforts my choice:
+			// "Because we set Winv to -Winv, we have -x at the end of the
+			//  iteration. So negate the result and return it"
+			// I don't know when to negate it, so I check first,
+			// if the result is not correct I try to negate !!!
 			VectorWrapper::ensureDim (Ax, A.rowdim ());
 
-			if (_traits.checkResult () &&
-			    ((_traits.preconditioner () == BlockLanczosTraits::SYMMETRIZE) ||
-			     (_traits.preconditioner () == BlockLanczosTraits::PARTIAL_DIAGONAL_SYMMETRIZE) ||
-			     (_traits.preconditioner () == BlockLanczosTraits::FULL_DIAGONAL)))
+			if ((_traits.preconditioner () == BlockLanczosTraits::SYMMETRIZE) ||
+			    (_traits.preconditioner () == BlockLanczosTraits::PARTIAL_DIAGONAL_SYMMETRIZE) ||
+			    (_traits.preconditioner () == BlockLanczosTraits::FULL_DIAGONAL))
 			{
 				VectorWrapper::ensureDim (ATAx, A.coldim ());
 				VectorWrapper::ensureDim (ATb, A.coldim ());
 
-				commentator.start ("Checking whether A^T Ax = A^T b");
 
 				A.apply (Ax, x);
 				A.applyTranspose (ATAx, Ax);
 				A.applyTranspose (ATb, b);
 
 				if (_VD.areEqual (ATAx, ATb)) {
-					commentator.stop ("passed");
 					success = true;
-				} else {
-					commentator.stop ("FAILED");
+				}
+				else {
 					success = false;
 				}
 			}
-			else if (_traits.checkResult ()) {
-				commentator.start ("Checking whether Ax=b");
-
+			else {
 				A.apply (Ax, x);
 
 				if (_VD.areEqual (Ax, b)) {
-					commentator.stop ("passed");
 					success = true;
-				} else {
-					commentator.stop ("FAILED");
+				}
+				else {
 					success = false;
 				}
 			}
+			if(! success) _VD.negin(x);
+			// End of JGD INFAMOUS HACK
+
+
+			if (_traits.checkResult ()) {
+				VectorWrapper::ensureDim (Ax, A.rowdim ());
+
+				if (_traits.checkResult () &&
+				    ((_traits.preconditioner () == BlockLanczosTraits::SYMMETRIZE) ||
+				     (_traits.preconditioner () == BlockLanczosTraits::PARTIAL_DIAGONAL_SYMMETRIZE) ||
+				     (_traits.preconditioner () == BlockLanczosTraits::FULL_DIAGONAL)))
+				{
+					VectorWrapper::ensureDim (ATAx, A.coldim ());
+					VectorWrapper::ensureDim (ATb, A.coldim ());
+
+					commentator.start ("Checking whether A^T Ax = A^T b");
+
+					A.apply (Ax, x);
+					A.applyTranspose (ATAx, Ax);
+					A.applyTranspose (ATb, b);
+
+					if (_VD.areEqual (ATAx, ATb)) {
+						commentator.stop ("passed");
+						success = true;
+					}
+					else {
+						commentator.stop ("FAILED");
+						success = false;
+					}
+				}
+				else if (_traits.checkResult ()) {
+					commentator.start ("Checking whether Ax=b");
+
+					A.apply (Ax, x);
+
+					if (_VD.areEqual (Ax, b)) {
+						commentator.stop ("passed");
+						success = true;
+					}
+					else {
+						commentator.stop ("FAILED");
+						success = false;
+					}
+				}
+			}
 		}
-	}
 
-	if (success) {
-		commentator.stop ("done", "Solve successful", "BlockLanczosSolver::solve");
-		return x;
-	} else {
-		commentator.stop ("done", "Solve failed", "BlockLanczosSolver::solve");
-		throw SolveFailed ();
+		if (success) {
+			commentator.stop ("done", "Solve successful", "BlockLanczosSolver::solve");
+			return x;
+		}
+		else {
+			commentator.stop ("done", "Solve failed", "BlockLanczosSolver::solve");
+			throw SolveFailed ();
+		}
 	}
-}
 
-template <class Field, class Matrix>
-template <class Blackbox, class Vector>
-bool BlockLanczosSolver<Field, Matrix>::iterate (const Blackbox &A, Vector &x, const Vector &b)
-{
-	linbox_check (_V[0].rowdim () == A.rowdim ());
-	linbox_check (_V[1].rowdim () == A.rowdim ());
-	linbox_check (_V[2].rowdim () == A.rowdim ());
-	linbox_check (_V[0].coldim () == _V[1].coldim ());
-	linbox_check (_V[0].coldim () == _V[2].coldim ());
+	template <class Field, class Matrix>
+	template <class Blackbox, class Vector>
+	bool BlockLanczosSolver<Field, Matrix>::iterate (const Blackbox &A, Vector &x, const Vector &b)
+	{
+		linbox_check (_V[0].rowdim () == A.rowdim ());
+		linbox_check (_V[1].rowdim () == A.rowdim ());
+		linbox_check (_V[2].rowdim () == A.rowdim ());
+		linbox_check (_V[0].coldim () == _V[1].coldim ());
+		linbox_check (_V[0].coldim () == _V[2].coldim ());
 
-	commentator.start ("Block Lanczos iteration", "BlockLanczosSolver::iterate", A.rowdim ());
+		commentator.start ("Block Lanczos iteration", "BlockLanczosSolver::iterate", A.rowdim ());
 
-	size_t    Ni;
-	size_t    total_dim = 0;
+		size_t    Ni;
+		size_t    total_dim = 0;
 
-	Vector    tmp, tmp1, tmp2;
+		Vector    tmp, tmp1, tmp2;
 
-	bool      ret = true;
+		bool      ret = true;
 
-	VectorWrapper::ensureDim (tmp, _traits.blockingFactor ());
-	VectorWrapper::ensureDim (tmp1, _traits.blockingFactor ());
-	VectorWrapper::ensureDim (tmp2, A.rowdim ());
+		VectorWrapper::ensureDim (tmp, _traits.blockingFactor ());
+		VectorWrapper::ensureDim (tmp1, _traits.blockingFactor ());
+		VectorWrapper::ensureDim (tmp2, A.rowdim ());
 
-	// How many iterations between each progress update
-	unsigned int progress_interval = A.rowdim () / _traits.blockingFactor () / 100;
+		// How many iterations between each progress update
+		unsigned int progress_interval = A.rowdim () / _traits.blockingFactor () / 100;
 
-	// Make sure there are a minimum of ten
-	if (progress_interval == 0)
-		progress_interval = 1;
+		// Make sure there are a minimum of ten
+		if (progress_interval == 0)
+			progress_interval = 1;
 
-	// i is the index for temporaries where we need to go back to i - 1
-	// j is the index for temporaries where we need to go back to j - 2
-	int i = 0, j = 2, next_j, prev_j = 1, iter = 2;
-	typename Matrix::ColIterator k;
+		// i is the index for temporaries where we need to go back to i - 1
+		// j is the index for temporaries where we need to go back to j - 2
+		int i = 0, j = 2, next_j, prev_j = 1, iter = 2;
+		typename Matrix::ColIterator k;
 
-	TIMER_DECLARE(AV);
-	TIMER_DECLARE(Winv);
-	TIMER_DECLARE(solution);
-	TIMER_DECLARE(orthogonalization)
+		TIMER_DECLARE(AV);
+		TIMER_DECLARE(Winv);
+		TIMER_DECLARE(solution);
+		TIMER_DECLARE(orthogonalization)
 
-	// Get a random fat vector _V[0]
-	RandomDenseStream<Field, typename Matrix::Col> stream (_F, _randiter, A.coldim ());
+		// Get a random fat vector _V[0]
+		RandomDenseStream<Field, typename Matrix::Col> stream (_F, _randiter, A.coldim ());
 
-	for (k = _V[0].colBegin (); k != _V[0].colEnd (); ++k)
-		stream >> *k;
+		for (k = _V[0].colBegin (); k != _V[0].colEnd (); ++k)
+			stream >> *k;
 
-	TIMER_START(AV);
-	_MD.blackboxMulLeft (_AV, A, _V[0]);
-	TIMER_STOP(AV);
+		TIMER_START(AV);
+		_MD.blackboxMulLeft (_AV, A, _V[0]);
+		TIMER_STOP(AV);
 
-	std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+		std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
 
-	// Initialize S_-1 to IN
-	std::fill (_S.begin (), _S.end (), true);
+		// Initialize S_-1 to IN
+		std::fill (_S.begin (), _S.end (), true);
 
-	// Iteration 1
-	TIMER_START(Winv);
-	_MD.mul (_VTAV, transpose (_V[0]), _AV);
-	Ni = compute_Winv_S (_Winv[0], _S, _VTAV);
-	TIMER_STOP(Winv);
+		// Iteration 1
+		TIMER_START(Winv);
+		_MD.mul (_VTAV, transpose (_V[0]), _AV);
+		Ni = compute_Winv_S (_Winv[0], _S, _VTAV);
+		TIMER_STOP(Winv);
 
-	// Check for catastrophic breakdown
-	if (Ni == 0) {
-		commentator.stop ("breakdown", NULL, "BlockLanczosSolver::iterate");
-		return false;
-	}
+		// Check for catastrophic breakdown
+		if (Ni == 0) {
+			commentator.stop ("breakdown", NULL, "BlockLanczosSolver::iterate");
+			return false;
+		}
 
-	total_dim += Ni;
+		total_dim += Ni;
 
 #ifdef DETAILED_TRACE
-	report << "Iteration " << iter << ": N_i = " << Ni << std::endl;
-	report << "Iteration " << iter << ": Total dimension is " << total_dim << std::endl;
+		report << "Iteration " << iter << ": N_i = " << Ni << std::endl;
+		report << "Iteration " << iter << ": Total dimension is " << total_dim << std::endl;
 #endif
 
-	TIMER_START(solution);
-	vectorMulTranspose (tmp, _V[0], b, _S);
-	_MD.vectorMul (tmp1, _Winv[0], tmp);
-	vectorMul (x, _V[0], tmp1, _S);
-	TIMER_STOP(solution);
+		TIMER_START(solution);
+		vectorMulTranspose (tmp, _V[0], b, _S);
+		_MD.vectorMul (tmp1, _Winv[0], tmp);
+		vectorMul (x, _V[0], tmp1, _S);
+		TIMER_STOP(solution);
 
-	mul_SST (_V[1], _AV, _S);
+		mul_SST (_V[1], _AV, _S);
 
-	TIMER_START(orthogonalization);
-	mul (_AVTAVSST_VTAV, transpose (_AV), _AV, _S);
+		TIMER_START(orthogonalization);
+		mul (_AVTAVSST_VTAV, transpose (_AV), _AV, _S);
 
-	BLTraceReport (report, _MD, "V", 0, _V[0]);
-	BLTraceReport (report, _MD, "AV", 0, _AV);
-	BLTraceReport (report, _MD, "V^T A V", 0, _VTAV);
-	BLTraceReport (report, _MD, "Winv", 0, _Winv[0]);
-	reportS (report, _S, 0);
-	BLTraceReport (report, _VD, "x", 0, x);
-	BLTraceReport (report, _MD, "AVSS^T", 0, _V[1]);
-	BLTraceReport (report, _MD, "V^T A^2 V", 0, _AVTAVSST_VTAV);
+		BLTraceReport (report, _MD, "V", 0, _V[0]);
+		BLTraceReport (report, _MD, "AV", 0, _AV);
+		BLTraceReport (report, _MD, "V^T A V", 0, _VTAV);
+		BLTraceReport (report, _MD, "Winv", 0, _Winv[0]);
+		reportS (report, _S, 0);
+		BLTraceReport (report, _VD, "x", 0, x);
+		BLTraceReport (report, _MD, "AVSS^T", 0, _V[1]);
+		BLTraceReport (report, _MD, "V^T A^2 V", 0, _AVTAVSST_VTAV);
 
-	_MD.addin (_AVTAVSST_VTAV, _VTAV);
-	_MD.mul (_DEF, _Winv[0], _AVTAVSST_VTAV);
-	addIN (_DEF);
+		_MD.addin (_AVTAVSST_VTAV, _VTAV);
+		_MD.mul (_DEF, _Winv[0], _AVTAVSST_VTAV);
+		addIN (_DEF);
 
-	_MD.axpyin (_V[1], _V[0], _DEF);
-	TIMER_START(orthogonalization);
+		_MD.axpyin (_V[1], _V[0], _DEF);
+		TIMER_START(orthogonalization);
 
-	BLTraceReport (report, _MD, "D", 1, _DEF);
+		BLTraceReport (report, _MD, "D", 1, _DEF);
 
-	BLTraceReport (report, _MD, "V", 1, _V[1]);
-	checkAConjugacy (_MD, _AV, _V[1], _DEF, 0, 1);
+		BLTraceReport (report, _MD, "V", 1, _V[1]);
+		checkAConjugacy (_MD, _AV, _V[1], _DEF, 0, 1);
 
-	if (_MD.isZero (_V[1])) {
-		commentator.stop ("done", NULL, "BlockLanczosSolver::iterate");
-		return true;
-	}
+		if (_MD.isZero (_V[1])) {
+			commentator.stop ("done", NULL, "BlockLanczosSolver::iterate");
+			return true;
+		}
 
-	// Iteration 2
-	TIMER_START(AV);
-	_MD.blackboxMulLeft (_AV, A, _V[1]);
-	TIMER_STOP(AV);
+		// Iteration 2
+		TIMER_START(AV);
+		_MD.blackboxMulLeft (_AV, A, _V[1]);
+		TIMER_STOP(AV);
 
 #ifdef DETAILED_TRACE
- 	// DEBUG: Save a copy of AV_1 for use later
-	Matrix AV1_backup (_AV.rowdim (), _AV.coldim ());
-	_MD.copy (AV1_backup, _AV);
+		// DEBUG: Save a copy of AV_1 for use later
+		Matrix AV1_backup (_AV.rowdim (), _AV.coldim ());
+		_MD.copy (AV1_backup, _AV);
 #endif
 
-	TIMER_START(Winv);
-	_MD.mul (_VTAV, transpose (_V[1]), _AV);
-	Ni = compute_Winv_S (_Winv[1], _S, _VTAV);
-	TIMER_STOP(Winv);
+		TIMER_START(Winv);
+		_MD.mul (_VTAV, transpose (_V[1]), _AV);
+		Ni = compute_Winv_S (_Winv[1], _S, _VTAV);
+		TIMER_STOP(Winv);
 
-	// Check for catastrophic breakdown
-	if (Ni == 0) {
-		commentator.stop ("breakdown", NULL, "BlockLanczosSolver::iterate");
-		return false;
-	}
+		// Check for catastrophic breakdown
+		if (Ni == 0) {
+			commentator.stop ("breakdown", NULL, "BlockLanczosSolver::iterate");
+			return false;
+		}
 
-	total_dim += Ni;
+		total_dim += Ni;
 
 #ifdef DETAILED_TRACE
-	report << "Iteration " << iter << ": N_i = " << Ni << std::endl;
-	report << "Iteration " << iter << ": Total dimension is " << total_dim << std::endl;
+		report << "Iteration " << iter << ": N_i = " << Ni << std::endl;
+		report << "Iteration " << iter << ": Total dimension is " << total_dim << std::endl;
 #endif
 
-	TIMER_START(solution);
-	vectorMulTranspose (tmp, _V[1], b, _S);
-	_MD.vectorMul (tmp1, _Winv[1], tmp);
-	vectorMul (tmp2, _V[1], tmp1, _S);
-	_VD.addin (x, tmp2);
-	TIMER_STOP(solution);
-
-	mul_SST (_V[2], _AV, _S);
-
-	TIMER_START(orthogonalization);
-	mul (_AVTAVSST_VTAV, transpose (_AV), _AV, _S);
-
-	BLTraceReport (report, _MD, "AV", 1, _AV);
-	BLTraceReport (report, _MD, "V^T A V", 1, _VTAV);
-	BLTraceReport (report, _MD, "Winv", 1, _Winv[1]);
-	reportS (report, _S, 1);
-	BLTraceReport (report, _VD, "x", 1, x);
-	BLTraceReport (report, _MD, "V^T A^2 V", 1, _AVTAVSST_VTAV);
-
-	_MD.addin (_AVTAVSST_VTAV, _VTAV);
-	_MD.mul (_DEF, _Winv[1], _AVTAVSST_VTAV);
-	addIN (_DEF);
-	_MD.axpyin (_V[2], _V[1], _DEF);
-
-	BLTraceReport (report, _MD, "D", 2, _DEF);
-
-	mul (_DEF, _Winv[0], _VTAV, _S);
-	_MD.axpyin (_V[2], _V[0], _DEF);
-	TIMER_STOP(orthogonalization);
+		TIMER_START(solution);
+		vectorMulTranspose (tmp, _V[1], b, _S);
+		_MD.vectorMul (tmp1, _Winv[1], tmp);
+		vectorMul (tmp2, _V[1], tmp1, _S);
+		_VD.addin (x, tmp2);
+		TIMER_STOP(solution);
 
-	BLTraceReport (report, _MD, "E", 2, _DEF);
-	BLTraceReport (report, _MD, "V", 2, _V[2]);
+		mul_SST (_V[2], _AV, _S);
 
-	checkAConjugacy (_MD, _AV, _V[2], _DEF, 1, 2);
+		TIMER_START(orthogonalization);
+		mul (_AVTAVSST_VTAV, transpose (_AV), _AV, _S);
 
-	// Now we're ready to begin the real iteration
-	while (!_MD.isZero (_V[j])) {
-		next_j = j + 1;
-		if (next_j > 2) next_j = 0;
+		BLTraceReport (report, _MD, "AV", 1, _AV);
+		BLTraceReport (report, _MD, "V^T A V", 1, _VTAV);
+		BLTraceReport (report, _MD, "Winv", 1, _Winv[1]);
+		reportS (report, _S, 1);
+		BLTraceReport (report, _VD, "x", 1, x);
+		BLTraceReport (report, _MD, "V^T A^2 V", 1, _AVTAVSST_VTAV);
 
-		TIMER_START(AV);
-		_MD.blackboxMulLeft (_AV, A, _V[j]);
-		TIMER_STOP(AV);
+		_MD.addin (_AVTAVSST_VTAV, _VTAV);
+		_MD.mul (_DEF, _Winv[1], _AVTAVSST_VTAV);
+		addIN (_DEF);
+		_MD.axpyin (_V[2], _V[1], _DEF);
 
-		// First compute F_i+1, where we use Winv_i-2; then Winv_i and
-		// Winv_i-2 can share storage, and we don't need the old _VTAV
-		// and _AVTAVSST_VTAV any more. After this, F_i+1 is stored in
-		// _DEF
+		BLTraceReport (report, _MD, "D", 2, _DEF);
 
-		TIMER_START(orthogonalization);
-		_MD.mul (_T, _VTAV, _Winv[1 - i]);
-		addIN (_T);
-		_MD.mul (_DEF, _Winv[i], _T);
-		_MD.mulin (_DEF, _AVTAVSST_VTAV);
+		mul (_DEF, _Winv[0], _VTAV, _S);
+		_MD.axpyin (_V[2], _V[0], _DEF);
 		TIMER_STOP(orthogonalization);
 
-		// Now get the next VTAV, Winv, and S_i
-		TIMER_START(Winv);
-		_MD.mul (_VTAV, transpose (_V[j]), _AV);
-		Ni = compute_Winv_S (_Winv[i], _S, _VTAV);
-		TIMER_STOP(Winv);
-
-		// Check for catastrophic breakdown
-		if (Ni == 0) {
-			ret = false;
-			break;
-		}
+		BLTraceReport (report, _MD, "E", 2, _DEF);
+		BLTraceReport (report, _MD, "V", 2, _V[2]);
+
+		checkAConjugacy (_MD, _AV, _V[2], _DEF, 1, 2);
+
+		// Now we're ready to begin the real iteration
+		while (!_MD.isZero (_V[j])) {
+			next_j = j + 1;
+			if (next_j > 2) next_j = 0;
+
+			TIMER_START(AV);
+			_MD.blackboxMulLeft (_AV, A, _V[j]);
+			TIMER_STOP(AV);
+
+			// First compute F_i+1, where we use Winv_i-2; then Winv_i and
+			// Winv_i-2 can share storage, and we don't need the old _VTAV
+			// and _AVTAVSST_VTAV any more. After this, F_i+1 is stored in
+			// _DEF
+
+			TIMER_START(orthogonalization);
+			_MD.mul (_T, _VTAV, _Winv[1 - i]);
+			addIN (_T);
+			_MD.mul (_DEF, _Winv[i], _T);
+			_MD.mulin (_DEF, _AVTAVSST_VTAV);
+			TIMER_STOP(orthogonalization);
+
+			// Now get the next VTAV, Winv, and S_i
+			TIMER_START(Winv);
+			_MD.mul (_VTAV, transpose (_V[j]), _AV);
+			Ni = compute_Winv_S (_Winv[i], _S, _VTAV);
+			TIMER_STOP(Winv);
+
+			// Check for catastrophic breakdown
+			if (Ni == 0) {
+				ret = false;
+				break;
+			}
 
-		total_dim += Ni;
+			total_dim += Ni;
 
 #ifdef DETAILED_TRACE
-		report << "Iteration " << iter << ": N_i = " << Ni << std::endl;
-		report << "Iteration " << iter << ": Total dimension is " << total_dim << std::endl;
+			report << "Iteration " << iter << ": N_i = " << Ni << std::endl;
+			report << "Iteration " << iter << ": Total dimension is " << total_dim << std::endl;
 #endif
 
-		BLTraceReport (report, _MD, "AV", iter, _AV);
-		BLTraceReport (report, _MD, "F", iter + 1, _DEF);
-		BLTraceReport (report, _MD, "V^T AV", iter, _VTAV);
-		BLTraceReport (report, _MD, "Winv", iter, _Winv[i]);
-		reportS (report, _S, iter);
+			BLTraceReport (report, _MD, "AV", iter, _AV);
+			BLTraceReport (report, _MD, "F", iter + 1, _DEF);
+			BLTraceReport (report, _MD, "V^T AV", iter, _VTAV);
+			BLTraceReport (report, _MD, "Winv", iter, _Winv[i]);
+			reportS (report, _S, iter);
 
-		// Now that we have S_i, finish off with F_i+1
-		TIMER_START(orthogonalization);
-		mulin (_V[next_j], _DEF, _S);
-		TIMER_STOP(orthogonalization);
+			// Now that we have S_i, finish off with F_i+1
+			TIMER_START(orthogonalization);
+			mulin (_V[next_j], _DEF, _S);
+			TIMER_STOP(orthogonalization);
 
-		// Update x
-		TIMER_START(solution);
-		vectorMulTranspose (tmp, _V[j], b, _S);
-		_MD.vectorMul (tmp1, _Winv[i], tmp);
-		vectorMul (tmp2, _V[j], tmp1, _S);
-		_VD.addin (x, tmp2);
-		TIMER_STOP(solution);
+			// Update x
+			TIMER_START(solution);
+			vectorMulTranspose (tmp, _V[j], b, _S);
+			_MD.vectorMul (tmp1, _Winv[i], tmp);
+			vectorMul (tmp2, _V[j], tmp1, _S);
+			_VD.addin (x, tmp2);
+			TIMER_STOP(solution);
 
-		BLTraceReport (report, _VD, "x", iter, x);
+			BLTraceReport (report, _VD, "x", iter, x);
 
-		// Compute the next _AVTAVSST_VTAV
-		TIMER_START(orthogonalization);
-		mul (_AVTAVSST_VTAV, transpose (_AV), _AV, _S);
+			// Compute the next _AVTAVSST_VTAV
+			TIMER_START(orthogonalization);
+			mul (_AVTAVSST_VTAV, transpose (_AV), _AV, _S);
 
-		BLTraceReport (report, _MD, "V^T A^2 V", iter, _AVTAVSST_VTAV);
+			BLTraceReport (report, _MD, "V^T A^2 V", iter, _AVTAVSST_VTAV);
 
-		_MD.addin (_AVTAVSST_VTAV, _VTAV);
+			_MD.addin (_AVTAVSST_VTAV, _VTAV);
 
-		// Compute D and update V_i+1
-		_MD.mul (_DEF, _Winv[i], _AVTAVSST_VTAV);
-		addIN (_DEF);
-		_MD.axpyin (_V[next_j], _V[j], _DEF);
+			// Compute D and update V_i+1
+			_MD.mul (_DEF, _Winv[i], _AVTAVSST_VTAV);
+			addIN (_DEF);
+			_MD.axpyin (_V[next_j], _V[j], _DEF);
 
-		BLTraceReport (report, _MD, "D", iter + 1, _DEF);
+			BLTraceReport (report, _MD, "D", iter + 1, _DEF);
 
-		// Compute E and update V_i+1
-		mul (_DEF, _Winv[1 - i], _VTAV, _S);
-		_MD.axpyin (_V[next_j], _V[prev_j], _DEF);
+			// Compute E and update V_i+1
+			mul (_DEF, _Winv[1 - i], _VTAV, _S);
+			_MD.axpyin (_V[next_j], _V[prev_j], _DEF);
 
-		BLTraceReport (report, _MD, "E", iter + 1, _DEF);
+			BLTraceReport (report, _MD, "E", iter + 1, _DEF);
 
-		// Add AV_i S_i S_i^T
-		addin (_V[next_j], _AV, _S);
-		TIMER_STOP(orthogonalization);
+			// Add AV_i S_i S_i^T
+			addin (_V[next_j], _AV, _S);
+			TIMER_STOP(orthogonalization);
 
-		BLTraceReport (report, _MD, "V", iter + 1, _V[next_j]);
-		checkAConjugacy (_MD, _AV, _V[next_j], _DEF, iter, iter + 1);
+			BLTraceReport (report, _MD, "V", iter + 1, _V[next_j]);
+			checkAConjugacy (_MD, _AV, _V[next_j], _DEF, iter, iter + 1);
 
 #ifdef DETAILED_TRACE
-		checkAConjugacy (_MD, AV1_backup, _V[next_j], _DEF, 1, iter + 1);
+			checkAConjugacy (_MD, AV1_backup, _V[next_j], _DEF, 1, iter + 1);
 #endif
 
-		i = 1 - i;
-		prev_j = j;
-		j = next_j;
-		++iter;
+			i = 1 - i;
+			prev_j = j;
+			j = next_j;
+			++iter;
 
-		if (!(iter % progress_interval))
-			commentator.progress (total_dim);
+			if (!(iter % progress_interval))
+				commentator.progress (total_dim);
 
-		if (total_dim > A.rowdim ()) {
-			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+			if (total_dim > A.rowdim ()) {
+				commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
 				<< "Maximum number of iterations passed without termination" << std::endl;
-			commentator.stop ("ERROR", NULL, "BlockLanczosSolver::iterate");
-			return false;
+				commentator.stop ("ERROR", NULL, "BlockLanczosSolver::iterate");
+				return false;
+			}
 		}
-	}
 
-	// Because we set Winv to -Winv, we have -x at the end of the
-	// iteration. So negate the result and return it
-	_VD.negin (x);
+		// Because we set Winv to -Winv, we have -x at the end of the
+		// iteration. So negate the result and return it
+		_VD.negin (x);
 
-	BLTraceReport (report, _VD, "x", iter, x);
+		BLTraceReport (report, _VD, "x", iter, x);
 
-	TIMER_REPORT(AV);
-	TIMER_REPORT(Winv);
-	TIMER_REPORT(solution);
-	TIMER_REPORT(orthogonalization)
+		TIMER_REPORT(AV);
+		TIMER_REPORT(Winv);
+		TIMER_REPORT(solution);
+		TIMER_REPORT(orthogonalization)
 
-	commentator.stop (ret ? "done" : "breakdown", NULL, "BlockLanczosSolver::iterate");
+		commentator.stop (ret ? "done" : "breakdown", NULL, "BlockLanczosSolver::iterate");
 
-	return ret;
-}
+		return ret;
+	}
 
-template <class Field, class Matrix>
-int BlockLanczosSolver<Field, Matrix>::compute_Winv_S
+	template <class Field, class Matrix>
+	int BlockLanczosSolver<Field, Matrix>::compute_Winv_S
 	(Matrix        &Winv,
 	 std::vector<bool>                               &S,
 	 const Matrix  &T)
-{
-	linbox_check (S.size () == Winv.rowdim ());
-	linbox_check (S.size () == Winv.coldim ());
-	linbox_check (S.size () == T.rowdim ());
-	linbox_check (S.size () == T.coldim ());
-	linbox_check (S.size () == _M.rowdim ());
-	linbox_check (S.size () * 2 == _M.coldim ());
+	{
+		linbox_check (S.size () == Winv.rowdim ());
+		linbox_check (S.size () == Winv.coldim ());
+		linbox_check (S.size () == T.rowdim ());
+		linbox_check (S.size () == T.coldim ());
+		linbox_check (S.size () == _M.rowdim ());
+		linbox_check (S.size () * 2 == _M.coldim ());
 
 #ifdef DETAILED_TRACE
-	commentator.start ("Computing Winv and S", "BlockLanczosSolver::compute_Winv_S", S.size ());
+		commentator.start ("Computing Winv and S", "BlockLanczosSolver::compute_Winv_S", S.size ());
 
-	std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-	report << "Input T:" << std::endl;
-	_MD.write (report, T);
+		std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+		report << "Input T:" << std::endl;
+		_MD.write (report, T);
 #endif
 
-	DenseSubmatrix<Element> M1 (_M, 0, 0, T.rowdim (), T.coldim ());
-	DenseSubmatrix<Element> M2 (_M, 0, T.coldim (), T.rowdim (), T.coldim ());
+		DenseSubmatrix<Element> M1 (_M, 0, 0, T.rowdim (), T.coldim ());
+		DenseSubmatrix<Element> M2 (_M, 0, T.coldim (), T.rowdim (), T.coldim ());
 
-	_MD.copy (M1, T);
-	setIN (M2);
+		_MD.copy (M1, T);
+		setIN (M2);
 
-	permute (_indices, S);
+		permute (_indices, S);
 
-	typename Field::Element Mjj_inv;
+		typename Field::Element Mjj_inv;
 
-	size_t row;
-	size_t Ni = 0;
+		size_t row;
+		size_t Ni = 0;
 
-	for (row = 0; row < S.size (); ++row) {
+		for (row = 0; row < S.size (); ++row) {
 #ifdef DETAILED_TRACE
-		if (!(row & ((1 << 10) - 1)))
-			commentator.progress (row);
+			if (!(row & ((1 << 10) - 1)))
+				commentator.progress (row);
 
-		std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-		report << "Iteration " << row << ": Matrix M = " << std::endl;
-		_MD.write (report, _M);
+			std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+			report << "Iteration " << row << ": Matrix M = " << std::endl;
+			_MD.write (report, _M);
 #endif
 
-		if (find_pivot_row (_M, row, 0, _indices)) {
+			if (find_pivot_row (_M, row, 0, _indices)) {
 #ifdef DETAILED_TRACE
-			commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION)
+				commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION)
 				<< "Pivot found for column " << _indices[row] << std::endl;
 #endif
 
-			// Pivot element was found for (j, j)
+				// Pivot element was found for (j, j)
 
-			S[_indices[row]] = true;  // Use column j of V_i in W_i
+				S[_indices[row]] = true;  // Use column j of V_i in W_i
 
-			// Give the (j, j) entry unity
-			_F.inv (Mjj_inv, _M.getEntry (_indices[row], _indices[row]));
-			_VD.mulin (*(_M.rowBegin () + _indices[row]), Mjj_inv);
+				// Give the (j, j) entry unity
+				_F.inv (Mjj_inv, _M.getEntry (_indices[row], _indices[row]));
+				_VD.mulin (*(_M.rowBegin () + _indices[row]), Mjj_inv);
 
-			// Zero the rest of the column j
-			eliminate_col (_M, row, 0, _indices, Mjj_inv);
+				// Zero the rest of the column j
+				eliminate_col (_M, row, 0, _indices, Mjj_inv);
 
-			++Ni;
-		} else {
+				++Ni;
+			}
+			else {
 #ifdef DETAILED_TRACE
-			commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+				commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
 				<< "No pivot found for column " << _indices[row] << std::endl;
 #endif
 
-			// No pivot element found
+				// No pivot element found
 
-			S[_indices[row]] = false;  // Skip column j
+				S[_indices[row]] = false;  // Skip column j
 
-			find_pivot_row (_M, row, _N, _indices);
+				find_pivot_row (_M, row, _N, _indices);
 
-			const typename Field::Element &Mjj = _M.refEntry (_indices[row], _indices[row] + _N);
+				const typename Field::Element &Mjj = _M.refEntry (_indices[row], _indices[row] + _N);
 
-			linbox_check (!_F.isZero (Mjj));
+				linbox_check (!_F.isZero (Mjj));
 
-			// Zero the rest of the column j + N
-			eliminate_col (_M, row, _N, _indices, _F.inv (Mjj_inv, Mjj));
+				// Zero the rest of the column j + N
+				eliminate_col (_M, row, _N, _indices, _F.inv (Mjj_inv, Mjj));
 
-			// Zero row j
-			_VD.subin (*(_M.rowBegin () + _indices[row]), *(_M.rowBegin () + _indices[row]));
+				// Zero row j
+				_VD.subin (*(_M.rowBegin () + _indices[row]), *(_M.rowBegin () + _indices[row]));
+			}
 		}
-	}
 
-	_MD.neg (Winv, M2);
+		_MD.neg (Winv, M2);
 
 #ifdef DETAILED_TRACE
-	report << "Computed Winv:" << std::endl;
-	_MD.write (report, Winv);
+		report << "Computed Winv:" << std::endl;
+		_MD.write (report, Winv);
 
-	commentator.stop ("done", NULL, "BlockLanczosSolver::compute_Winv_S");
+		commentator.stop ("done", NULL, "BlockLanczosSolver::compute_Winv_S");
 #endif
 
-	return Ni;
-}
+		return Ni;
+	}
 
-template <class Field, class Matrix>
-template <class Matrix1, class Matrix2>
-Matrix1 &BlockLanczosSolver<Field, Matrix>::mul_SST
+	template <class Field, class Matrix>
+	template <class Matrix1, class Matrix2>
+	Matrix1 &BlockLanczosSolver<Field, Matrix>::mul_SST
 	(Matrix1                 &BSST,
 	 const Matrix2           &B,
 	 const std::vector<bool> &S) const
-{
-	linbox_check (B.rowdim () == BSST.rowdim ());
-	linbox_check (B.coldim () == BSST.coldim ());
-	linbox_check (B.coldim () == S.size ());
+	{
+		linbox_check (B.rowdim () == BSST.rowdim ());
+		linbox_check (B.coldim () == BSST.coldim ());
+		linbox_check (B.coldim () == S.size ());
 
-	typename Matrix2::ConstColIterator i;
-	typename Matrix1::ColIterator j;
-	std::vector<bool>::const_iterator k;
+		typename Matrix2::ConstColIterator i;
+		typename Matrix1::ColIterator j;
+		std::vector<bool>::const_iterator k;
 
-	for (i = B.colBegin (), j = BSST.colBegin (), k = S.begin ();
-	     i != B.colEnd ();
-	     ++i, ++j, ++k)
-	{
-		if (*k)
-			_VD.copy (*j, *i);
-		else
-			_VD.subin (*j, *j);
-	}
+		for (i = B.colBegin (), j = BSST.colBegin (), k = S.begin ();
+		     i != B.colEnd ();
+		     ++i, ++j, ++k)
+		{
+			if (*k)
+				_VD.copy (*j, *i);
+			else
+				_VD.subin (*j, *j);
+		}
 
-	return BSST;
-}
+		return BSST;
+	}
 
-template <class Field, class Matrix>
-template <class Matrix1, class Matrix2, class Matrix3>
-Matrix1 &BlockLanczosSolver<Field, Matrix>::mul
+	template <class Field, class Matrix>
+	template <class Matrix1, class Matrix2, class Matrix3>
+	Matrix1 &BlockLanczosSolver<Field, Matrix>::mul
 	(Matrix1                 &C,
 	 const Matrix2           &A,
 	 const Matrix3           &B,
 	 const std::vector<bool> &S) const
-{
-	linbox_check (A.coldim () == B.rowdim ());
-	linbox_check (A.rowdim () == C.rowdim ());
-	linbox_check (B.coldim () == C.coldim ());
-
-	typename Matrix2::ConstRowIterator i;
-	typename Matrix3::ConstColIterator j;
-	typename Matrix1::ColIterator k1;
-	typename Matrix1::Col::iterator k2;
-	std::vector<bool>::const_iterator l;
-
-	for (j = B.colBegin (), l = S.begin (), k1 = C.colBegin ();
-	     j != B.colEnd ();
-	     ++j, ++l, ++k1)
 	{
-		if (*l) {
-			for (i = A.rowBegin (), k2 = k1->begin (); i != A.rowEnd (); ++i, ++k2)
-				_VD.dot (*k2, *i, *j);
-		} else
-			_VD.subin (*k1, *k1);
-	}
+		linbox_check (A.coldim () == B.rowdim ());
+		linbox_check (A.rowdim () == C.rowdim ());
+		linbox_check (B.coldim () == C.coldim ());
 
-	return C;
-}
+		typename Matrix2::ConstRowIterator i;
+		typename Matrix3::ConstColIterator j;
+		typename Matrix1::ColIterator k1;
+		typename Matrix1::Col::iterator k2;
+		std::vector<bool>::const_iterator l;
 
-template <class Field, class Matrix>
-template <class Matrix1, class Matrix2>
-Matrix1 &BlockLanczosSolver<Field, Matrix>::mulin
-	(Matrix1                 &A,
-	 const Matrix2           &B,
-	 const std::vector<bool> &S) const
-{
-	linbox_check (A.coldim () == B.rowdim ());
-	linbox_check (B.rowdim () == B.coldim ());
-	linbox_check (A.coldim () == S.size ());
-
-	typename Matrix1::RowIterator i;
-	typename Matrix2::ConstColIterator j;
-	typename Vector<Field>::Dense::iterator k;
-	std::vector<bool>::const_iterator l;
-
-	for (i = A.rowBegin (); i != A.rowEnd (); ++i) {
-		for (j = B.colBegin (), k = _tmp.begin (), l = S.begin ();
+		for (j = B.colBegin (), l = S.begin (), k1 = C.colBegin ();
 		     j != B.colEnd ();
-		     ++j, ++k, ++l)
+		     ++j, ++l, ++k1)
 		{
-			if (*l)
-				_VD.dot (*k, *i, *j);
+			if (*l) {
+				for (i = A.rowBegin (), k2 = k1->begin (); i != A.rowEnd (); ++i, ++k2)
+					_VD.dot (*k2, *i, *j);
+			}
 			else
-				_F.subin (*k, *k);
+				_VD.subin (*k1, *k1);
 		}
 
-		_VD.copy (*i, _tmp);
+		return C;
 	}
 
-	return A;
-}
+	template <class Field, class Matrix>
+	template <class Matrix1, class Matrix2>
+	Matrix1 &BlockLanczosSolver<Field, Matrix>::mulin
+	(Matrix1                 &A,
+	 const Matrix2           &B,
+	 const std::vector<bool> &S) const
+	{
+		linbox_check (A.coldim () == B.rowdim ());
+		linbox_check (B.rowdim () == B.coldim ());
+		linbox_check (A.coldim () == S.size ());
+
+		typename Matrix1::RowIterator i;
+		typename Matrix2::ConstColIterator j;
+		typename Vector<Field>::Dense::iterator k;
+		std::vector<bool>::const_iterator l;
+
+		for (i = A.rowBegin (); i != A.rowEnd (); ++i) {
+			for (j = B.colBegin (), k = _tmp.begin (), l = S.begin ();
+			     j != B.colEnd ();
+			     ++j, ++k, ++l)
+			{
+				if (*l)
+					_VD.dot (*k, *i, *j);
+				else
+					_F.subin (*k, *k);
+			}
+
+			_VD.copy (*i, _tmp);
+		}
+
+		return A;
+	}
 
-template <class Field, class Matrix>
-template <class Vector1, class Matrix1, class Vector2>
-Vector1 &BlockLanczosSolver<Field, Matrix>::vectorMul
+	template <class Field, class Matrix>
+	template <class Vector1, class Matrix1, class Vector2>
+	Vector1 &BlockLanczosSolver<Field, Matrix>::vectorMul
 	(Vector1                 &w,
 	 const Matrix1           &A,
 	 const Vector2           &v,
 	 const std::vector<bool> &S) const
-{
-	linbox_check (A.coldim () == v.size ());
-	linbox_check (A.rowdim () == w.size ());
+	{
+		linbox_check (A.coldim () == v.size ());
+		linbox_check (A.rowdim () == w.size ());
 
-	typename Matrix1::ConstColIterator i = A.colBegin ();
-	typename Vector2::const_iterator j = v.begin ();
-	typename std::vector<bool>::const_iterator k = S.begin ();
+		typename Matrix1::ConstColIterator i = A.colBegin ();
+		typename Vector2::const_iterator j = v.begin ();
+		typename std::vector<bool>::const_iterator k = S.begin ();
 
-	_VD.subin (w, w);
+		_VD.subin (w, w);
 
-	for (; j != v.end (); ++j, ++i, ++k)
-		if (*k)
-			_VD.axpyin (w, *j, *i);
+		for (; j != v.end (); ++j, ++i, ++k)
+			if (*k)
+				_VD.axpyin (w, *j, *i);
 
-	return w;
-}
+		return w;
+	}
 
-template <class Field, class Matrix>
-template <class Vector1, class Matrix1, class Vector2>
-Vector1 &BlockLanczosSolver<Field, Matrix>::vectorMulTranspose
+	template <class Field, class Matrix>
+	template <class Vector1, class Matrix1, class Vector2>
+	Vector1 &BlockLanczosSolver<Field, Matrix>::vectorMulTranspose
 	(Vector1                 &w,
 	 const Matrix1           &A,
 	 const Vector2           &v,
 	 const std::vector<bool> &S) const
-{
-	linbox_check (A.rowdim () == v.size ());
-	linbox_check (A.coldim () == w.size ());
+	{
+		linbox_check (A.rowdim () == v.size ());
+		linbox_check (A.coldim () == w.size ());
 
-	typename Matrix1::ConstColIterator i = A.colBegin ();
-	typename Vector1::iterator j = w.begin ();
-	typename std::vector<bool>::const_iterator k = S.begin ();
+		typename Matrix1::ConstColIterator i = A.colBegin ();
+		typename Vector1::iterator j = w.begin ();
+		typename std::vector<bool>::const_iterator k = S.begin ();
 
-	for (; j != w.end (); ++j, ++i, ++k)
-		if (*k)
-			_VD.dot (*j, *i, v);
+		for (; j != w.end (); ++j, ++i, ++k)
+			if (*k)
+				_VD.dot (*j, *i, v);
 
-	return w;
-}
+		return w;
+	}
 
-template <class Field, class Matrix>
-template <class Matrix1>
-Matrix1 &BlockLanczosSolver<Field, Matrix>::addIN (Matrix1 &A) const
-{
-	linbox_check (A.coldim () == A.rowdim ());
+	template <class Field, class Matrix>
+	template <class Matrix1>
+	Matrix1 &BlockLanczosSolver<Field, Matrix>::addIN (Matrix1 &A) const
+	{
+		linbox_check (A.coldim () == A.rowdim ());
 
-	typename Matrix1::RowIterator i;
-	size_t idx = 0;
+		typename Matrix1::RowIterator i;
+		size_t idx = 0;
 
-	for (i = A.rowBegin (); i != A.rowEnd (); ++i, ++idx)
-		_F.addin ((*i)[idx], _one);
+		for (i = A.rowBegin (); i != A.rowEnd (); ++i, ++idx)
+			_F.addin ((*i)[idx], _one);
 
-	return A;
-}
+		return A;
+	}
 
-template <class Field, class Matrix>
-template <class Matrix1, class Matrix2>
-Matrix1 &BlockLanczosSolver<Field, Matrix>::addin
+	template <class Field, class Matrix>
+	template <class Matrix1, class Matrix2>
+	Matrix1 &BlockLanczosSolver<Field, Matrix>::addin
 	(Matrix1                 &A,
 	 const Matrix2           &B,
 	 const std::vector<bool> &S) const
-{
-	linbox_check (A.rowdim () == B.rowdim ());
-	linbox_check (A.coldim () == B.coldim ());
+	{
+		linbox_check (A.rowdim () == B.rowdim ());
+		linbox_check (A.coldim () == B.coldim ());
 
-	typename Matrix1::ColIterator i = A.colBegin ();
-	typename Matrix2::ConstColIterator j = B.colBegin ();
-	std::vector<bool>::const_iterator k = S.begin ();
+		typename Matrix1::ColIterator i = A.colBegin ();
+		typename Matrix2::ConstColIterator j = B.colBegin ();
+		std::vector<bool>::const_iterator k = S.begin ();
 
-	for (; i != A.colEnd (); ++i, ++j, ++k)
-		if (*k) _VD.addin (*i, *j);
+		for (; i != A.colEnd (); ++i, ++j, ++k)
+			if (*k) _VD.addin (*i, *j);
 
-	return A;
-}
+		return A;
+	}
 
-template <class Field, class Matrix>
-void BlockLanczosSolver<Field, Matrix>::permute (std::vector<size_t>     &indices,
-						 const std::vector<bool> &S) const
-{
-	size_t idx;
+	template <class Field, class Matrix>
+	void BlockLanczosSolver<Field, Matrix>::permute (std::vector<size_t>     &indices,
+							 const std::vector<bool> &S) const
+	{
+		size_t idx;
 
-	std::vector<size_t>::iterator i = indices.begin ();
-	std::vector<bool>::const_iterator k;
+		std::vector<size_t>::iterator i = indices.begin ();
+		std::vector<bool>::const_iterator k;
 
-	for (k = S.begin (), idx = 0; k != S.end (); ++k, ++idx) {
-		if (!*k) {
-			*i = idx;
-			++i;
+		for (k = S.begin (), idx = 0; k != S.end (); ++k, ++idx) {
+			if (!*k) {
+				*i = idx;
+				++i;
+			}
 		}
-	}
 
-	for (k = S.begin (), idx = 0; k != S.end (); ++k, ++idx) {
-		if (*k) {
-			*i = idx;
-			++i;
+		for (k = S.begin (), idx = 0; k != S.end (); ++k, ++idx) {
+			if (*k) {
+				*i = idx;
+				++i;
+			}
 		}
 	}
-}
 
-template <class Field, class Matrix>
-template <class Matrix1>
-Matrix1 &BlockLanczosSolver<Field, Matrix>::setIN (Matrix1 &A) const 
-{
-	linbox_check (A.coldim () == A.rowdim ());
+	template <class Field, class Matrix>
+	template <class Matrix1>
+	Matrix1 &BlockLanczosSolver<Field, Matrix>::setIN (Matrix1 &A) const
+	{
+		linbox_check (A.coldim () == A.rowdim ());
 
-	typename Matrix1::RowIterator i;
-	size_t i_idx;
+		typename Matrix1::RowIterator i;
+		size_t i_idx;
 
-	for (i = A.rowBegin (), i_idx = 0; i != A.rowEnd (); ++i, ++i_idx) {
-		_VD.subin (*i, *i);
-		_F.assign ((*i)[i_idx], _one);
-	}
+		for (i = A.rowBegin (), i_idx = 0; i != A.rowEnd (); ++i, ++i_idx) {
+			_VD.subin (*i, *i);
+			_F.assign ((*i)[i_idx], _one);
+		}
 
-	return A;
-}
+		return A;
+	}
 
-/* Find a row suitable for pivoting in column col and exchange that row with row
- * A - Matrix on which to operate
- * idx - Index of the row with which to exchange
- * Returns true if a pivot could be found; false otherwise
- */
+	/* Find a row suitable for pivoting in column col and exchange that row with row
+	 * A - Matrix on which to operate
+	 * idx - Index of the row with which to exchange
+	 * Returns true if a pivot could be found; false otherwise
+	 */
 
-template <class Field, class Matrix>
-bool BlockLanczosSolver<Field, Matrix>::find_pivot_row
+	template <class Field, class Matrix>
+	bool BlockLanczosSolver<Field, Matrix>::find_pivot_row
 	(Matrix                    &A,
 	 size_t                     row,
 	 int                        col_offset,
 	 const std::vector<size_t> &indices)
-{
-	size_t idx;
+	{
+		size_t idx;
 
-	typename Matrix::Col col_vec;
-	typename Matrix::Row row_vec;
+		typename Matrix::Col col_vec;
+		typename Matrix::Row row_vec;
 
-	col_vec = *(_M.colBegin () + indices[row] + col_offset);
-	row_vec = *(_M.rowBegin () + indices[row]);
+		col_vec = *(_M.colBegin () + indices[row] + col_offset);
+		row_vec = *(_M.rowBegin () + indices[row]);
 
-	for (idx = row; idx < A.rowdim (); ++idx) {
-		if (!_F.isZero (A.getEntry (indices[idx], indices[row] + col_offset))) {
-			if (idx != row) {
-				typename Matrix::Row row1 = *(A.rowBegin () + indices[idx]);
-				std::swap_ranges (row_vec.begin (), row_vec.end (), row1.begin ());
-			}
+		for (idx = row; idx < A.rowdim (); ++idx) {
+			if (!_F.isZero (A.getEntry (indices[idx], indices[row] + col_offset))) {
+				if (idx != row) {
+					typename Matrix::Row row1 = *(A.rowBegin () + indices[idx]);
+					std::swap_ranges (row_vec.begin (), row_vec.end (), row1.begin ());
+				}
 
-			return true;
+				return true;
+			}
 		}
-	}
 
-	return false;
-}
+		return false;
+	}
 
-template <class Field, class Matrix>
-void BlockLanczosSolver<Field, Matrix>::eliminate_col
+	template <class Field, class Matrix>
+	void BlockLanczosSolver<Field, Matrix>::eliminate_col
 	(Matrix                        &A,
 	 size_t                         pivot,
 	 int                            col_offset,
 	 const std::vector<size_t>     &indices,
 	 const typename Field::Element &Ajj_inv)
-{
-	// I'm assuming everything left of the column with the index of the pivot row is 0
-	size_t row;
+	{
+		// I'm assuming everything left of the column with the index of the pivot row is 0
+		size_t row;
 
-	typename DenseSubmatrix<Element>::Row pivot_row;
-	typename Field::Element p;
+		typename DenseSubmatrix<Element>::Row pivot_row;
+		typename Field::Element p;
 
-	pivot_row = *(A.rowBegin () + indices[pivot]);
+		pivot_row = *(A.rowBegin () + indices[pivot]);
 
-	for (row = 0; row < pivot; ++row) {
-		const typename Field::Element &Aij = A.getEntry (indices[row], indices[pivot] + col_offset);
+		for (row = 0; row < pivot; ++row) {
+			const typename Field::Element &Aij = A.getEntry (indices[row], indices[pivot] + col_offset);
 
-		if (!_F.isZero (Aij))
-			_VD.axpyin (*(A.rowBegin () + indices[row]), _F.neg (p, Aij), pivot_row);
-	}
+			if (!_F.isZero (Aij))
+				_VD.axpyin (*(A.rowBegin () + indices[row]), _F.neg (p, Aij), pivot_row);
+		}
 
-	for (++row; row < A.rowdim (); ++row) {
-		const typename Field::Element &Aij = A.getEntry (indices[row], indices[pivot] + col_offset);
+		for (++row; row < A.rowdim (); ++row) {
+			const typename Field::Element &Aij = A.getEntry (indices[row], indices[pivot] + col_offset);
 
-		if (!_F.isZero (Aij))
-			_VD.axpyin (*(A.rowBegin () + indices[row]), _F.neg (p, Aij), pivot_row);
+			if (!_F.isZero (Aij))
+				_VD.axpyin (*(A.rowBegin () + indices[row]), _F.neg (p, Aij), pivot_row);
+		}
 	}
-}
-
-template <class Field, class Matrix>
-void BlockLanczosSolver<Field, Matrix>::init_temps () 
-{
-	_VTAV.resize (_N, _N);
-	_Winv[0].resize (_N, _N);
-	_Winv[1].resize (_N, _N);
-	_AVTAVSST_VTAV.resize (_N, _N);
-	_T.resize (_N, _N);
-	_DEF.resize (_N, _N);
-	_S.resize (_N);
-	_M.resize (_N, 2 * _N);
-	_tmp.resize (_N);
-	_indices.resize (_N);
-}
-
-// Check whether the given matrix is "almost" the identity, i.e. the identity
-// with some zeros on the diagonal
-
-template <class Field, class Matrix>
-template <class Matrix1>
-bool BlockLanczosSolver<Field, Matrix>::isAlmostIdentity (const Matrix1 &M) const 
-{
-	linbox_check (M.rowdim () == M.coldim ());
 
-	typename Field::Element neg_one;
-
-	_F.init (neg_one, -1);
+	template <class Field, class Matrix>
+	void BlockLanczosSolver<Field, Matrix>::init_temps ()
+	{
+		_VTAV.resize (_N, _N);
+		_Winv[0].resize (_N, _N);
+		_Winv[1].resize (_N, _N);
+		_AVTAVSST_VTAV.resize (_N, _N);
+		_T.resize (_N, _N);
+		_DEF.resize (_N, _N);
+		_S.resize (_N);
+		_M.resize (_N, 2 * _N);
+		_tmp.resize (_N);
+		_indices.resize (_N);
+	}
 
-	size_t i, j;
+	// Check whether the given matrix is "almost" the identity, i.e. the identity
+	// with some zeros on the diagonal
 
-	for (i = 0; i < M.rowdim (); ++i) {
-		for (j = 0; j < M.coldim (); ++j) {
-			if (i != j && !_F.isZero (M.getEntry (i, j))) {
-				if (!_F.isZero (M.getEntry (i, i))) {
-					typename Matrix::ConstRowIterator row = M.rowBegin () + j;
-					if (!_VD.isZero (*row))
+	template <class Field, class Matrix>
+	template <class Matrix1>
+	bool BlockLanczosSolver<Field, Matrix>::isAlmostIdentity (const Matrix1 &M) const
+	{
+		linbox_check (M.rowdim () == M.coldim ());
+
+		typename Field::Element neg_one;
+
+		_F.init (neg_one, -1);
+
+		size_t i, j;
+
+		for (i = 0; i < M.rowdim (); ++i) {
+			for (j = 0; j < M.coldim (); ++j) {
+				if (i != j && !_F.isZero (M.getEntry (i, j))) {
+					if (!_F.isZero (M.getEntry (i, i))) {
+						typename Matrix::ConstRowIterator row = M.rowBegin () + j;
+						if (!_VD.isZero (*row))
+							return false;
+					}
+					else if (!_F.isZero (M.getEntry (j, j))) {
+						typename Matrix::ConstColIterator col = M.colBegin () + i;
+						if (!_VD.isZero (*col))
+							return false;
+					}
+					else
 						return false;
 				}
-				else if (!_F.isZero (M.getEntry (j, j))) {
-					typename Matrix::ConstColIterator col = M.colBegin () + i;
-					if (!_VD.isZero (*col))
-						return false;
-				} else
+				else if (!_F.isZero (M.getEntry (i, j)) && !_F.areEqual (M.getEntry (i, j), neg_one))
 					return false;
 			}
-			else if (!_F.isZero (M.getEntry (i, j)) && !_F.areEqual (M.getEntry (i, j), neg_one))
-				return false;
 		}
+
+		return true;
 	}
 
-	return true;
-}
+	// Test suite for BlockLanczosSolver
+	// All tests below return true on success and false on failure. They take a
+	// single argument: n for the row and column dimension of the matrices on which
+	// to operate
 
-// Test suite for BlockLanczosSolver
-// All tests below return true on success and false on failure. They take a
-// single argument: n for the row and column dimension of the matrices on which
-// to operate
+	// Compute a random dense matrix and run compute_Winv_S on it. Check that the
+	// resulting S vector is all 'true' and then multiply the original matrix by the
+	// output. Add 1 to the result with addIN and check the the result is zero with
+	// isZero
 
-// Compute a random dense matrix and run compute_Winv_S on it. Check that the
-// resulting S vector is all 'true' and then multiply the original matrix by the
-// output. Add 1 to the result with addIN and check the the result is zero with
-// isZero
+	template <class Field, class Matrix>
+	bool BlockLanczosSolver<Field, Matrix>::test_compute_Winv_S_mul (int n) const
+	{
+		commentator.start ("Testing compute_Winv_S, mul, addIN, and isZero", "test_compute_Winv_S_mul");
 
-template <class Field, class Matrix>
-bool BlockLanczosSolver<Field, Matrix>::test_compute_Winv_S_mul (int n) const
-{
-	commentator.start ("Testing compute_Winv_S, mul, addIN, and isZero", "test_compute_Winv_S_mul");
-
-	Matrix A (n, n);
-	Matrix AT (n, n);
-	Matrix ATA (n, n);
-	Matrix W (n, n);
-	Matrix WA (n, n);
-	std::vector<bool> S (n);
-
-	bool ret = true;
-
-	RandomDenseStream<Field, typename Matrix::Row> stream (_F, _randiter, n);
-	typename Matrix::RowIterator i = A.rowBegin ();
-	typename Matrix::ColIterator j = AT.colBegin ();
-
-	// With very, very, very, very high probability, this will be
-	// nonsingular
-	for (; i != A.rowEnd (); ++i, ++j) {
-		stream >> *i;
-		_VD.copy (*j, *i);
-	}
+		Matrix A (n, n);
+		Matrix AT (n, n);
+		Matrix ATA (n, n);
+		Matrix W (n, n);
+		Matrix WA (n, n);
+		std::vector<bool> S (n);
 
-	_MD.mul (ATA, AT, A);
+		bool ret = true;
 
-	std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-	report << "Computed A^T A:" << std::endl;
-	_MD.write (report, ATA);
+		RandomDenseStream<Field, typename Matrix::Row> stream (_F, _randiter, n);
+		typename Matrix::RowIterator i = A.rowBegin ();
+		typename Matrix::ColIterator j = AT.colBegin ();
 
-	compute_Winv_S (W, S, ATA);
+		// With very, very, very, very high probability, this will be
+		// nonsingular
+		for (; i != A.rowEnd (); ++i, ++j) {
+			stream >> *i;
+			_VD.copy (*j, *i);
+		}
+
+		_MD.mul (ATA, AT, A);
+
+		std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+		report << "Computed A^T A:" << std::endl;
+		_MD.write (report, ATA);
+
+		compute_Winv_S (W, S, ATA);
 
-	report << "Computed W:" << std::endl;
-	_MD.write (report, W);
+		report << "Computed W:" << std::endl;
+		_MD.write (report, W);
 
-	// Now W should be -A^-1
-	_MD.mul (WA, W, ATA);
+		// Now W should be -A^-1
+		_MD.mul (WA, W, ATA);
 
-	report << "Computed WA^T A:" << std::endl;
-	_MD.write (report, WA);
+		report << "Computed WA^T A:" << std::endl;
+		_MD.write (report, WA);
 
-	if (!isAlmostIdentity (WA)) {
-		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+		if (!isAlmostIdentity (WA)) {
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
 			<< "ERROR: WA^T A != I" << std::endl;
-		ret = false;
-	}
+			ret = false;
+		}
 
-	// Now, just for kicks, do the same on the other side
+		// Now, just for kicks, do the same on the other side
 
-	_MD.mul (WA, ATA, W);
+		_MD.mul (WA, ATA, W);
 
-	report << "Computed A^T A W:" << std::endl;
-	_MD.write (report, WA);
+		report << "Computed A^T A W:" << std::endl;
+		_MD.write (report, WA);
 
-	if (!isAlmostIdentity (WA)) {
-		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+		if (!isAlmostIdentity (WA)) {
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
 			<< "ERROR: A^T AW != I" << std::endl;
-		ret = false;
+			ret = false;
+		}
+
+		commentator.stop (MSG_STATUS (ret), NULL, "test_compute_Winv_S_mul");
+
+		return ret;
 	}
 
-	commentator.stop (MSG_STATUS (ret), NULL, "test_compute_Winv_S_mul");
+	// Same as above, but use mulin rather than mul
 
-	return ret;
-}
+	template <class Field, class Matrix>
+	bool BlockLanczosSolver<Field, Matrix>::test_compute_Winv_S_mulin (int n) const
+	{
+		commentator.start ("Testing compute_Winv_S, copy, mulin, addIN, and isZero", "test_compute_Winv_S_mulin");
 
-// Same as above, but use mulin rather than mul
+		Matrix A (n, n);
+		Matrix AT (n, n);
+		Matrix ATA (n, n);
+		Matrix W (n, n);
+		Matrix WA (n, n);
+		std::vector<bool> S (n);
 
-template <class Field, class Matrix>
-bool BlockLanczosSolver<Field, Matrix>::test_compute_Winv_S_mulin (int n) const
-{
-	commentator.start ("Testing compute_Winv_S, copy, mulin, addIN, and isZero", "test_compute_Winv_S_mulin");
-
-	Matrix A (n, n);
-	Matrix AT (n, n);
-	Matrix ATA (n, n);
-	Matrix W (n, n);
-	Matrix WA (n, n);
-	std::vector<bool> S (n);
-
-	bool ret = true;
-
-	RandomDenseStream<Field, typename Matrix::Row> stream (_F, _randiter, n);
-	typename Matrix::RowIterator i = A.rowBegin ();
-	typename Matrix::ColIterator j = AT.colBegin ();
-
-	// With very, very, very, very high probability, this will be
-	// nonsingular
-	for (; i != A.rowEnd (); ++i, ++j) {
-		stream >> *i;
-		_VD.copy (*j, *i);
-	}
+		bool ret = true;
+
+		RandomDenseStream<Field, typename Matrix::Row> stream (_F, _randiter, n);
+		typename Matrix::RowIterator i = A.rowBegin ();
+		typename Matrix::ColIterator j = AT.colBegin ();
+
+		// With very, very, very, very high probability, this will be
+		// nonsingular
+		for (; i != A.rowEnd (); ++i, ++j) {
+			stream >> *i;
+			_VD.copy (*j, *i);
+		}
 
-	_MD.mul (ATA, AT, A);
+		_MD.mul (ATA, AT, A);
 
-	std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-	report << "Computed A^T A:" << std::endl;
-	_MD.write (report, ATA);
+		std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+		report << "Computed A^T A:" << std::endl;
+		_MD.write (report, ATA);
 
-	compute_Winv_S (W, S, ATA);
+		compute_Winv_S (W, S, ATA);
 
-	_MD.copy (WA, W);
+		_MD.copy (WA, W);
 
-	report << "Computed W:" << std::endl;
-	_MD.write (report, W);
+		report << "Computed W:" << std::endl;
+		_MD.write (report, W);
 
-	// Now W should be -A^-1
-	_MD.mulin (WA, ATA);
+		// Now W should be -A^-1
+		_MD.mulin (WA, ATA);
 
-	report << "Computed WA^T A:" << std::endl;
-	_MD.write (report, WA);
+		report << "Computed WA^T A:" << std::endl;
+		_MD.write (report, WA);
 
-	if (!isAlmostIdentity (WA)) {
-		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+		if (!isAlmostIdentity (WA)) {
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
 			<< "ERROR: WA^T A != I" << std::endl;
-		ret = false;
-	}
+			ret = false;
+		}
 
-	// Now, just for kicks, do the same on the other side
+		// Now, just for kicks, do the same on the other side
 
-	_MD.copy (WA, ATA);
+		_MD.copy (WA, ATA);
 
-	_MD.mulin (WA, W);
+		_MD.mulin (WA, W);
 
-	report << "Computed A^T AW:" << std::endl;
-	_MD.write (report, WA);
+		report << "Computed A^T AW:" << std::endl;
+		_MD.write (report, WA);
 
-	if (!isAlmostIdentity (WA)) {
-		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+		if (!isAlmostIdentity (WA)) {
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
 			<< "ERROR: A^T AW != I" << std::endl;
-		ret = false;
-	}
+			ret = false;
+		}
 
-	commentator.stop (MSG_STATUS (ret), NULL, "test_compute_Winv_S_mulin");
+		commentator.stop (MSG_STATUS (ret), NULL, "test_compute_Winv_S_mulin");
 
-	return ret;
-}
+		return ret;
+	}
 
-// Compute a random nonsingular diagonal matrix and set an S vector so that
-// every other entry is true and the rest are false. Call mul_SST and check that
-// the entries on the resulting diagonal are correct.
+	// Compute a random nonsingular diagonal matrix and set an S vector so that
+	// every other entry is true and the rest are false. Call mul_SST and check that
+	// the entries on the resulting diagonal are correct.
 
-template <class Field, class Matrix>
-bool BlockLanczosSolver<Field, Matrix>::test_mul_SST (int n) const
-{
-	commentator.start ("Testing addin", "test_mulTranspose");
+	template <class Field, class Matrix>
+	bool BlockLanczosSolver<Field, Matrix>::test_mul_SST (int n) const
+	{
+		commentator.start ("Testing addin", "test_mulTranspose");
 
-	bool ret = true;
+		bool ret = true;
 
-	commentator.stop (MSG_STATUS (ret), NULL, "test_mulTranspose");
+		commentator.stop (MSG_STATUS (ret), NULL, "test_mulTranspose");
 
-	return ret;
-}
+		return ret;
+	}
 
-// Same as test_compute_Winv_S_mul above, but zero out every other column using
-// the method for test_mul_SST
+	// Same as test_compute_Winv_S_mul above, but zero out every other column using
+	// the method for test_mul_SST
 
-template <class Field, class Matrix>
-bool BlockLanczosSolver<Field, Matrix>::test_mul_ABSST (int n) const
-{
-	commentator.start ("Testing addin", "test_mulTranspose");
+	template <class Field, class Matrix>
+	bool BlockLanczosSolver<Field, Matrix>::test_mul_ABSST (int n) const
+	{
+		commentator.start ("Testing addin", "test_mulTranspose");
 
-	bool ret = true;
+		bool ret = true;
 
-	commentator.stop (MSG_STATUS (ret), NULL, "test_mulTranspose");
+		commentator.stop (MSG_STATUS (ret), NULL, "test_mulTranspose");
 
-	return ret;
-}
+		return ret;
+	}
 
-// Compute a random dense matrix and two random vectors, and check that <A^T x,
-// y> = <x, Ay>
+	// Compute a random dense matrix and two random vectors, and check that <A^T x,
+	// y> = <x, Ay>
 
-template <class Field, class Matrix>
-bool BlockLanczosSolver<Field, Matrix>::test_mulTranspose (int m, int n) const
-{
-	commentator.start ("Testing mulTranspose, m-v mul", "test_mulTranspose");
+	template <class Field, class Matrix>
+	bool BlockLanczosSolver<Field, Matrix>::test_mulTranspose (int m, int n) const
+	{
+		commentator.start ("Testing mulTranspose, m-v mul", "test_mulTranspose");
 
-	Matrix A (m, n);
-	typename Vector<Field>::Dense x (m), y (n);
-	typename Vector<Field>::Dense ATx (n), Ay (m);
-	Element ATxy, xAy;
+		Matrix A (m, n);
+		typename Vector<Field>::Dense x (m), y (n);
+		typename Vector<Field>::Dense ATx (n), Ay (m);
+		Element ATxy, xAy;
 
-	bool ret = true;
+		bool ret = true;
 
-	RandomDenseStream<Field, typename Matrix::Row> stream (_F, _randiter, n);
-	typename Matrix::RowIterator i = A.rowBegin ();
+		RandomDenseStream<Field, typename Matrix::Row> stream (_F, _randiter, n);
+		typename Matrix::RowIterator i = A.rowBegin ();
 
-	for (; i != A.rowEnd (); ++i)
-		stream >> *i;
+		for (; i != A.rowEnd (); ++i)
+			stream >> *i;
 
-	std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-	report << "Computed A:" << std::endl;
-	_MD.write (report, A);
+		std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+		report << "Computed A:" << std::endl;
+		_MD.write (report, A);
 
-	RandomDenseStream<Field, Matrix> stream1 (_F, _randiter, m);
-	stream1 >> x;
+		RandomDenseStream<Field, Matrix> stream1 (_F, _randiter, m);
+		stream1 >> x;
 
-	RandomDenseStream<Field, Matrix> stream2 (_F, _randiter, n);
-	stream1 >> y;
+		RandomDenseStream<Field, Matrix> stream2 (_F, _randiter, n);
+		stream1 >> y;
 
-	report << "Computed     x: ";
-	_VD.write (report, x) << std::endl;
+		report << "Computed     x: ";
+		_VD.write (report, x) << std::endl;
 
-	report << "Computed     y: ";
-	_VD.write (report, y) << std::endl;
+		report << "Computed     y: ";
+		_VD.write (report, y) << std::endl;
 
-	_MD.vectorMul (ATx, transpose (A), x);
+		_MD.vectorMul (ATx, transpose (A), x);
 
-	report << "Computed A^T x: ";
-	_VD.write (report, ATx) << std::endl;
+		report << "Computed A^T x: ";
+		_VD.write (report, ATx) << std::endl;
 
-	_MD.vectorMul (Ay, A, y);
+		_MD.vectorMul (Ay, A, y);
 
-	report << "Computed    Ay: ";
-	_VD.write (report, Ay) << std::endl;
+		report << "Computed    Ay: ";
+		_VD.write (report, Ay) << std::endl;
 
-	_VD.dot (ATxy, ATx, y);
+		_VD.dot (ATxy, ATx, y);
 
-	report << "Computed  ATxy: ";
-	_F.write (report, ATxy) << std::endl;
+		report << "Computed  ATxy: ";
+		_F.write (report, ATxy) << std::endl;
 
-	_VD.dot (xAy, x, Ay);
+		_VD.dot (xAy, x, Ay);
 
-	report << "Computed   xAy: ";
-	_F.write (report, xAy) << std::endl;
+		report << "Computed   xAy: ";
+		_F.write (report, xAy) << std::endl;
 
-	if (!_F.areEqual (ATxy, xAy)) {
-		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+		if (!_F.areEqual (ATxy, xAy)) {
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
 			<< "ERROR: <A^T x, y> != <x, Ay>" << std::endl;
-		ret = false;
-	}
+			ret = false;
+		}
 
-	commentator.stop (MSG_STATUS (ret), NULL, "test_mulTranspose");
+		commentator.stop (MSG_STATUS (ret), NULL, "test_mulTranspose");
 
-	return ret;
-}
+		return ret;
+	}
 
-// Same as test_mul_SST, but using mulTranspose
+	// Same as test_mul_SST, but using mulTranspose
 
-template <class Field, class Matrix>
-bool BlockLanczosSolver<Field, Matrix>::test_mulTranspose_ABSST (int n) const
-{
-	commentator.start ("Testing addin_ABSST", "test_mulTranspose_ABSST");
+	template <class Field, class Matrix>
+	bool BlockLanczosSolver<Field, Matrix>::test_mulTranspose_ABSST (int n) const
+	{
+		commentator.start ("Testing addin_ABSST", "test_mulTranspose_ABSST");
 
-	bool ret = true;
+		bool ret = true;
 
-	commentator.stop (MSG_STATUS (ret), NULL, "test_mulTranspose_ABSST");
+		commentator.stop (MSG_STATUS (ret), NULL, "test_mulTranspose_ABSST");
 
-	return ret;
-}
+		return ret;
+	}
 
-// Same as test_mul_ABSST, but using mulin_ABSST
+	// Same as test_mul_ABSST, but using mulin_ABSST
 
-template <class Field, class Matrix>
-bool BlockLanczosSolver<Field, Matrix>::test_mulin_ABSST (int n) const
-{
-	commentator.start ("Testing addin_ABSST", "test_mulin_ABSST");
+	template <class Field, class Matrix>
+	bool BlockLanczosSolver<Field, Matrix>::test_mulin_ABSST (int n) const
+	{
+		commentator.start ("Testing addin_ABSST", "test_mulin_ABSST");
 
-	bool ret = true;
+		bool ret = true;
 
-	commentator.stop (MSG_STATUS (ret), NULL, "test_mulin_ABSST");
+		commentator.stop (MSG_STATUS (ret), NULL, "test_mulin_ABSST");
 
-	return ret;
-}
+		return ret;
+	}
 
-// Same as test_addin, but using test_addin_ABSST
+	// Same as test_addin, but using test_addin_ABSST
 
-template <class Field, class Matrix>
-bool BlockLanczosSolver<Field, Matrix>::test_addin_ABSST (int n) const
-{
-	commentator.start ("Testing addin_ABSST", "test_addin_ABSST");
+	template <class Field, class Matrix>
+	bool BlockLanczosSolver<Field, Matrix>::test_addin_ABSST (int n) const
+	{
+		commentator.start ("Testing addin_ABSST", "test_addin_ABSST");
 
-	bool ret = true;
+		bool ret = true;
 
-	commentator.stop (MSG_STATUS (ret), NULL, "test_addin_ABSST");
+		commentator.stop (MSG_STATUS (ret), NULL, "test_addin_ABSST");
 
-	return ret;
-}
+		return ret;
+	}
 
-template <class Field, class Matrix>
-bool BlockLanczosSolver<Field, Matrix>::runSelfCheck () const
-{
-	bool ret = true;
+	template <class Field, class Matrix>
+	bool BlockLanczosSolver<Field, Matrix>::runSelfCheck () const
+	{
+		bool ret = true;
 
-	commentator.start ("Running self check", "runSelfCheck", 10);
+		commentator.start ("Running self check", "runSelfCheck", 10);
 
-	if (!test_compute_Winv_S_mul (_N)) ret = false;
-	if (!test_compute_Winv_S_mulin (_N)) ret = false;
-	if (!test_mul_SST (_N)) ret = false;
-	if (!test_mul_ABSST (_N)) ret = false;
-	if (!test_mulTranspose (_N * 10, _N)) ret = false;
-	if (!test_mulTranspose_ABSST (_N)) ret = false;
-	if (!test_mulin_ABSST (_N)) ret = false;
-	if (!test_addin_ABSST (_N)) ret = false;
+		if (!test_compute_Winv_S_mul (_N)) ret = false;
+		if (!test_compute_Winv_S_mulin (_N)) ret = false;
+		if (!test_mul_SST (_N)) ret = false;
+		if (!test_mul_ABSST (_N)) ret = false;
+		if (!test_mulTranspose (_N * 10, _N)) ret = false;
+		if (!test_mulTranspose_ABSST (_N)) ret = false;
+		if (!test_mulin_ABSST (_N)) ret = false;
+		if (!test_addin_ABSST (_N)) ret = false;
 
-	commentator.stop (MSG_STATUS (ret), NULL, "runSelfCheck");
+		commentator.stop (MSG_STATUS (ret), NULL, "runSelfCheck");
 
-	return ret;
-}
+		return ret;
+	}
 
 } // namespace LinBox
 
-#endif // __BLOCK_LANCZOS_INL
+#endif // __LINBOX_block_lanczos_INL
+
diff --git a/linbox/algorithms/block-massey-domain.h b/linbox/algorithms/block-massey-domain.h
index a5e3ed4..5301f94 100644
--- a/linbox/algorithms/block-massey-domain.h
+++ b/linbox/algorithms/block-massey-domain.h
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* linbox/algorithms/block-massey-domain.h
  * Copyright (C) 2002 Pascal Giorgi
@@ -23,8 +24,8 @@
 
 
 
-#ifndef __MASSEY_BLOCK_DOMAIN_H
-#define __MASSEY_BLOCK_DOMAIN_H
+#ifndef __LINBOX_massey_block_domain_H
+#define __LINBOX_massey_block_domain_H
 
 #include <vector>
 #include <iostream>
@@ -51,20 +52,20 @@
 //#define __PRINT_SEQUENCE
 #define _BM_TIMING
 
-namespace LinBox 
+namespace LinBox
 {
 
 
 #define DEFAULT_EARLY_TERM_THRESHOLD 20
 
 
-	/** 
-	    \brief Compute the linear generator of a sequence of matrices
-
-	    * Giorgi, Jeannerod Villard algorithm from ISSAC'03
-	    * This class encapsulates the functionality required for computing 
-	    * the block minimal polynomial of a matrix.
-	    */
+	/** Compute the linear generator of a sequence of matrices.
+	 *
+	 * This class encapsulates the functionality required for computing
+	 * the block minimal polynomial of a matrix.
+	 * @bib
+	 * Giorgi, Jeannerod Villard algorithm from ISSAC'03
+	 */
 	template<class _Field, class _Sequence>
 	class BlockMasseyDomain {
 
@@ -73,70 +74,72 @@ namespace LinBox
 		typedef typename Field::Element        Element;
 		typedef _Sequence                     Sequence;
 		typedef BlasMatrix<Element>        Coefficient;
-		
-		
+
+
 	private:
 		Sequence                          *_container;
 		Field                                      _F;
 		BlasMatrixDomain<Field>                  _BMD;
 		MatrixDomain<Field>                       _MD;
 		unsigned long            EARLY_TERM_THRESHOLD;
-		
+
 
 	public:
 
 #ifdef _BM_TIMING
-		mutable Timer   
-		        ttGetMinPoly,      tGetMinPoly,
-		        ttNewDiscrepancy,  tNewDiscrepancy,
-			ttShiftSigma,      tShiftSigma,
-			ttApplyPerm,       tApplyPerm, 
-			ttUpdateSigma,     tUpdateSigma,
-			ttInverseL,        tInverseL,
-			ttGetPermutation,  tGetPermutation,
-			ttLQUP,            tLQUP,
-			ttDiscrepancy,     tDiscrepancy,
-			ttGetCoeff,        tGetCoeff,
-			ttCheckSequence,   tCheckSequence,
-			ttSetup,           tSetup,
-			ttMBasis,          tMBasis,
-			ttUpdateSerie,     tUpdateSerie,
-			ttBasisMultiplication, tBasisMultiplication,
-			ttCopyingData,     tCopyingData,
-			Total;
-
-		void clearTimer() {
-			 ttGetMinPoly.clear();     
-			 ttNewDiscrepancy.clear(); 
-			 ttShiftSigma.clear();     
-			 ttApplyPerm.clear();      
-			 ttUpdateSigma.clear();    
-			 ttInverseL.clear();       
-			 ttGetPermutation.clear(); 
-			 ttLQUP.clear();           
-			 ttDiscrepancy.clear();    
-			 ttGetCoeff.clear();       
-			 ttCheckSequence.clear();  
-			 ttSetup.clear();   
-			 ttMBasis.clear();
-			 ttUpdateSerie.clear();
-			 ttBasisMultiplication.clear();
-			 ttCopyingData.clear(),
-			 Total.clear();
+		mutable Timer   ttGetMinPoly;			mutable Timer tGetMinPoly;
+		mutable Timer	ttNewDiscrepancy;		mutable Timer tNewDiscrepancy;
+		mutable Timer	ttShiftSigma;			mutable Timer tShiftSigma;
+		mutable Timer   ttApplyPerm;			mutable Timer tApplyPerm;
+		mutable Timer   ttUpdateSigma;			mutable Timer tUpdateSigma;
+		mutable Timer   ttInverseL;			mutable Timer tInverseL;
+		mutable Timer   ttGetPermutation;		mutable Timer tGetPermutation;
+		mutable Timer   ttLQUP;				mutable Timer tLQUP;
+		mutable Timer   ttDiscrepancy;			mutable Timer tDiscrepancy;
+		mutable Timer   ttGetCoeff;			mutable Timer tGetCoeff;
+		mutable Timer   ttCheckSequence;		mutable Timer tCheckSequence;
+		mutable Timer   ttSetup;			mutable Timer tSetup;
+		mutable Timer   ttMBasis;			mutable Timer tMBasis;
+		mutable Timer   ttUpdateSerie;			mutable Timer tUpdateSerie;
+		mutable Timer   ttBasisMultiplication;	        mutable Timer tBasisMultiplication;
+		mutable Timer   ttCopyingData;			mutable Timer tCopyingData;
+		mutable Timer   Total;
+
+		void clearTimer()
+		{
+			ttGetMinPoly.clear();
+			ttNewDiscrepancy.clear();
+			ttShiftSigma.clear();
+			ttApplyPerm.clear();
+			ttUpdateSigma.clear();
+			ttInverseL.clear();
+			ttGetPermutation.clear();
+			ttLQUP.clear();
+			ttDiscrepancy.clear();
+			ttGetCoeff.clear();
+			ttCheckSequence.clear();
+			ttSetup.clear();
+			ttMBasis.clear();
+			ttUpdateSerie.clear();
+			ttBasisMultiplication.clear();
+			ttCopyingData.clear(),
+			Total.clear();
 		}
-		
-		void print(Timer& T, const  char* timer, const char* title) {
+
+		void print(Timer& T, const  char* timer, const char* title)
+		{
 			if (&T != &Total)
 				Total+=T;
 			if (T.count() > 0) {
 				std::cout<<title<<": "<<timer;
-				for (int i=strlen(timer); i<28; i++) 
+				for (int i=strlen(timer); i<28; i++)
 					std::cout << ' ';
 				std::cout<<T<<std::endl;
 			}
 		}
 
-		void printTimer() {
+		void printTimer()
+		{
 			print(ttSetup, "Setup", "direct");
 			print(ttCheckSequence, "Rank of Seq[0]", "direct");
 			print(ttGetCoeff, "Compute sequence", "direct");
@@ -156,57 +159,66 @@ namespace LinBox
 			std::cout<<std::endl<<std::endl;
 		}
 #endif
-	
 
-		BlockMasseyDomain (const BlockMasseyDomain<Field, Sequence> &M, unsigned long ett_default = DEFAULT_EARLY_TERM_THRESHOLD) 
-			: _container(M._container), _F(M._F), _BMD(M._F), _MD(M._F),  EARLY_TERM_THRESHOLD (ett_default) {
+
+		BlockMasseyDomain (const BlockMasseyDomain<Field, Sequence> &M, unsigned long ett_default = DEFAULT_EARLY_TERM_THRESHOLD) :
+			_container(M._container), _F(M._F), _BMD(M._F), _MD(M._F),  EARLY_TERM_THRESHOLD (ett_default)
+		{
 #ifdef _BM_TIMING
 			clearTimer();
-#endif			
+#endif
 		}
 
-		BlockMasseyDomain (Sequence *D, unsigned long ett_default = DEFAULT_EARLY_TERM_THRESHOLD) 
-			: _container(D), _F(D->getField ()), _BMD(D->getField ()), _MD(D->getField ()), EARLY_TERM_THRESHOLD (ett_default) {
+		BlockMasseyDomain (Sequence *D, unsigned long ett_default = DEFAULT_EARLY_TERM_THRESHOLD) :
+			_container(D), _F(D->getField ()), _BMD(D->getField ()), _MD(D->getField ()), EARLY_TERM_THRESHOLD (ett_default)
+		{
 #ifdef _BM_TIMING
 			clearTimer();
 #endif
 		}
-  
-			
+
+
 		// field of the domain
-		const Field &getField    () const { return _F; }
-		
+		const Field &getField    () const
+		{ return _F; }
+
 		// sequence of the domain
-		Sequence *getSequence () const { return _container; }
+		Sequence *getSequence () const
+		{ return _container; }
 
 		// left minimal generating polynomial of the sequence
-		void left_minpoly  (std::vector<Coefficient> &P) { 
+		void left_minpoly  (std::vector<Coefficient> &P)
+		{
 			masseyblock_left(P);
 		}
-		
-		void left_minpoly_rec  (std::vector<Coefficient> &P) { 
+
+		void left_minpoly_rec  (std::vector<Coefficient> &P)
+		{
 			masseyblock_left_rec(P);
 		}
 
 
 		// left minimal generating polynomial  of the sequence, keep track on degree
-		void left_minpoly (std::vector<Coefficient> &phi, std::vector<size_t> &degree) {
+		void left_minpoly (std::vector<Coefficient> &phi, std::vector<size_t> &degree)
+		{
 			degree = masseyblock_left(phi);
-		}		
-		
-		void left_minpoly_rec  (std::vector<Coefficient> &P, std::vector<size_t> &degree) { 
+		}
+
+		void left_minpoly_rec  (std::vector<Coefficient> &P, std::vector<size_t> &degree)
+		{
 			degree = masseyblock_left_rec(P);
 		}
 
 
 		// right minimal generating polynomial of the sequence
 		void right_minpoly (std::vector<Coefficient> &P) { masseyblock_right(P);}
-		
-		
+
+
 	private:
-		
+
 		template<class Field>
-		void write_maple(const Field& F, const std::vector<Coefficient> & P) {
+		void write_maple(const Field& F, const std::vector<Coefficient> & P)
+		{
 			std::cout<<"Matrix([";
 			for (size_t i=0;i< P[0].rowdim();++i){
 				std::cout<<"[";
@@ -222,56 +234,57 @@ namespace LinBox
 				if (i != P[0].rowdim()-1)
 					std::cout<<"],";
 				else
-					std::cout<<"]";						
+					std::cout<<"]";
 			}
 			std::cout<<"]);\n";
 		}
 
 
-		std::vector<size_t> masseyblock_left (std::vector<Coefficient> &P) {
-			
+		std::vector<size_t> masseyblock_left (std::vector<Coefficient> &P)
+		{
+
 #ifdef _BM_TIMING
 			tSetup.clear();
 			tSetup.start();
-#endif			
+#endif
 			const size_t length = _container->size ();
-		
+
 			const size_t m = _container->rowdim();
 			const size_t n = _container->coldim();
-		
+
 			// ====================================================
 			// Sequence and iterator initialization
 			// ====================================================
-		
+
 			// Initialization of the sequence iterator
 			typename Sequence::const_iterator _iter (_container->begin ());
 
 			// Reservation of memory for the entire sequence
 			std::vector<Coefficient> S (length); //,Coefficient(m,n));
-					
+
 			Coefficient Unit(m+n,m);
 			const Coefficient Zero(m+n,m);
 			Element one,zero,mone;
 			_F.init(one,1L);
 			_F.init(zero,0L);
 			_F.init(mone,-1L);
-			for (size_t i=0;i<m;i++) 			
-				Unit.setEntry(i,i,one);							
+			for (size_t i=0;i<m;i++)
+				Unit.setEntry(i,i,one);
 			size_t min_mn=(m <n)? m :n;
-	
-			
+
+
 
 			// initialization of discrepancy
 			Coefficient Discrepancy(m+n,n);
 			for (size_t i=0;i<n;i++)
 				Discrepancy.setEntry(i+m,i,one);
 
-			
+
 			// initialization of sigma base
 			std::vector<Coefficient> SigmaBase(length);
 			SigmaBase.resize(1);
 			SigmaBase[0]=Unit;
-								
+
 			// initialization of order of sigma base's rows
 			std::vector<long> order(m+n,1);
 			for (size_t i=0;i<m;++i)
@@ -286,23 +299,24 @@ namespace LinBox
 			ttSetup += tSetup;
 			tCheckSequence.clear();
 			tCheckSequence.start();
-#endif		
+#endif
 
 
 
 			// The first sequence element should be of full rank
-			// this is due to the strategy which say that we can compute 
+			// this is due to the strategy which say that we can compute
 			// only the first column of the approximation of [ S(x) Id]^T
-			// since the other colums have always lower degree.			
-			if (_BMD.rank(*_iter)< min_mn) 
-				throw PreconditionFailed (__FUNCTION__, __LINE__, "Bad random Blocks, abort\n");
-			//	cerr<<"\n**************************************************\n";
-			//	cerr<<"*** THE FIRST ELEMENT OF SEQUENCE IS SINGULAR  ***\n";
-			//	cerr<<"***            ALGORTIHM ABORTED               ***\n";
-			//	cerr<<"**************************************************\n";
-			//}
-			
-		
+			// since the other colums have always lower degree.
+			if (_BMD.rank(*_iter)< min_mn)
+				throw PreconditionFailed (__func__, __LINE__, "Bad random Blocks, abort\n");
+#if 0
+			cerr<<"\n**************************************************\n";
+			cerr<<"*** THE FIRST ELEMENT OF SEQUENCE IS SINGULAR  ***\n";
+			cerr<<"***            ALGORTIHM ABORTED               ***\n";
+			cerr<<"**************************************************\n";
+#endif
+
+
 #ifdef _BM_TIMING
 			tCheckSequence.stop();
 			ttCheckSequence += tCheckSequence;
@@ -310,12 +324,12 @@ namespace LinBox
 
 			unsigned long early_stop=0;
 			long N;
-		
+
 			for (N = 0; (N < (long)length) && (early_stop < EARLY_TERM_THRESHOLD) ; ++N, ++_iter) {
-									
+
 				// Get the next coefficient in the sequence
-				S[N]=*_iter;													
-			
+				S[N]=*_iter;
+
 #ifdef  _BM_TIMING
 				if (N != 0){
 					tGetCoeff.stop();
@@ -324,33 +338,33 @@ namespace LinBox
 
 				tDiscrepancy.clear();
 				tDiscrepancy.start();
-#endif				
+#endif
 
-				/*	
-				 * Compute the new discrepancy (just updating the first m rows)					
-				 */				
+				/*
+				 * Compute the new discrepancy (just updating the first m rows)
+				 */
 				// view of m first rows of SigmaBasis[0]
 				Coefficient Sigma(SigmaBase[0],0,0,m,m);
-				
+
 				// view of m first rows of Discrepancy
 				Coefficient Discr(Discrepancy,0,0,m,n);
-								
+
 				_BMD.mul(Discr,Sigma,S[N]);
 				for (size_t i=1;i<SigmaBase.size();i++){
 					Coefficient  Sigmaview(SigmaBase[i],0,0,m,m);
 					_BMD.axpyin(Discr,Sigmaview,S[N-i]);
 				}
-					
+
 #ifdef _BM_TIMING
 				tDiscrepancy.stop();
-				ttDiscrepancy += tDiscrepancy;				
-#endif	
-				
+				ttDiscrepancy += tDiscrepancy;
+#endif
+
 				typename Coefficient::RawIterator _iter_Discr = Discr.rawBegin();
 
 				while ((_F.isZero(*_iter_Discr) && _iter_Discr != Discr.rawEnd()))
 					++_iter_Discr;
-					
+
 				// maybe there is something to do here
 				// increase the last n rows of orders
 				// multiply by X the last n rows of SigmaBase
@@ -359,97 +373,100 @@ namespace LinBox
 				else {
 					early_stop++;
 				}
-					
-			
+
+
 #ifdef _BM_TIMING
 				tGetPermutation.clear();
 				tGetPermutation.start();
-#endif						 			
+#endif
 				// Computation of the permutation BPerm1 such that BPerm1.order is in increasing order.
-				// order=Perm.order			   			
-				std::vector<size_t> Perm1(m+n);			
+				// order=Perm.order
+				//! @todo factorize this in \c BlasPermutation.
+				std::vector<size_t> Perm1(m+n);
 				for (size_t i=0;i<m+n;++i)
-					Perm1[i]=i;	
+					Perm1[i]=i;
 				if (N>=2) {
 					for (size_t i=0;i<m+n;++i) {
 						size_t idx_min=i;
-						for (size_t j=i+1;j<m+n;++j) 
-							if (order[j]< order[idx_min]) 
-								idx_min=j;												
-						std::swap(order[i],order[idx_min]);				
+						for (size_t j=i+1;j<m+n;++j)
+							if (order[j]< order[idx_min])
+								idx_min=j;
+						std::swap(order[i],order[idx_min]);
 						Perm1[i]=idx_min;
-					}	
+					}
 				}
-				BlasPermutation BPerm1(Perm1);
-					
+				BlasPermutation<size_t> BPerm1(Perm1);
+
 #ifdef _BM_TIMING
 				tGetPermutation.stop();
 				ttGetPermutation += tGetPermutation;
 				tApplyPerm.clear();
-				tApplyPerm.start();				
-				
-#endif		
-				// Discrepancy= BPerm1.Discrepancy						
+				tApplyPerm.start();
+
+#endif
+				// Discrepancy= BPerm1.Discrepancy
 				_BMD.mulin_right(BPerm1,Discrepancy);
 
 #ifdef _BM_TIMING
 				tApplyPerm.stop();
 				ttApplyPerm += tApplyPerm;
 				tLQUP.clear();
-				tLQUP.start();				
+				tLQUP.start();
 #endif
 
 #ifdef __CHECK_DISCREPANCY
 				std::cout<<"Discrepancy"<<N<<":=Matrix(";
 				Discrepancy.write(std::cout,_F,true)<<");"<<std::endl;
 #endif
-			
 
-				
+
+
 				// Computation of the LQUP decomposition of the discrepancy
 				Coefficient CopyDiscr;
 				CopyDiscr=Discrepancy;
-				LQUPMatrix<Field> LQUP(_F, CopyDiscr);
-				
+				BlasPermutation<size_t> P (CopyDiscr.coldim());
+				BlasPermutation<size_t> Qt (CopyDiscr.rowdim());
+				LQUPMatrix<Field> LQUP(_F, CopyDiscr,P,Qt);
+
 #ifdef _BM_TIMING
-				tLQUP.stop();	
+				tLQUP.stop();
 				ttLQUP += tLQUP;
 
 #endif
 				// Get the matrix L of LQUP decomposition
 				TriangularBlasMatrix<Element> L(m+n,m+n, BlasTag::low, BlasTag::unit );
 				LQUP.getL(L);
-				
+
 				// Get the tranposed  permutation of Q from LQUP
-				BlasPermutation Qt=LQUP.getQ();
-			
+				// BlasPermutation<size_t> Qt=LQUP.getQ();
+
 
 #ifdef _BM_TIMING
 				tGetPermutation.clear();
 				tGetPermutation.start();
 #endif
 				// Computation of permutations BPerm2 such that the last n rows of BPerm2.Qt.Discrepancy are non zero.
-				std::vector<size_t> Perm2(m+n);	
+				std::vector<size_t> Perm2(m+n);
 				for (size_t i=0;i<n;++i)
 					Perm2[i]=m+i;
 				for (size_t i=n;i<m+n;++i)
-					Perm2[i]=i;					
-				BlasPermutation BPerm2(Perm2);			
-				
+					Perm2[i]=i;
+				BlasPermutation<size_t> BPerm2(Perm2);
+
 #ifdef _BM_TIMING
 				tGetPermutation.stop();
 				ttGetPermutation += tGetPermutation;
 				tInverseL.clear();
 				tInverseL.start();
-#endif			
+#endif
 				// compute the inverse of L
-				TriangularBlasMatrix<Element> invL (m+n,m+n, BlasTag::low,BlasTag::unit); 
+				TriangularBlasMatrix<Element> invL (m+n,m+n, BlasTag::low,BlasTag::unit);
 				FFPACK::trinv_left(_F,m+n,L.getPointer(),L.getStride(),invL.getWritePointer(),invL.getStride());
 
 #ifdef _BM_TIMING
 				tInverseL.stop();
 				ttInverseL += tInverseL;
-#endif					
+#endif
 
 #ifdef 	__CHECK_TRANSFORMATION
 				std::cout<<"invL"<<N<<":=Matrix(";
@@ -460,34 +477,34 @@ namespace LinBox
 				for (size_t i=0;i<SigmaBase.size();i++) {
 #ifdef _BM_TIMING
 					tApplyPerm.clear();
-					tApplyPerm.start();					
+					tApplyPerm.start();
 #endif
 					_BMD.mulin_right(BPerm1,SigmaBase[i]);
 
 #ifdef _BM_TIMING
-					tApplyPerm.stop();					
+					tApplyPerm.stop();
 					ttApplyPerm +=tApplyPerm;
 
 					tUpdateSigma.clear();
-					tUpdateSigma.start();					
+					tUpdateSigma.start();
 #endif
 					_BMD.mulin_right(invL,SigmaBase[i]);
 #ifdef _BM_TIMING
 					tUpdateSigma.stop();
 					ttUpdateSigma += tUpdateSigma;
 					tApplyPerm.clear();
-					tApplyPerm.start(); 										
+					tApplyPerm.start();
 #endif
 					_BMD.mulin_right(Qt,SigmaBase[i]);
 					_BMD.mulin_right(BPerm2,SigmaBase[i]);
 #ifdef _BM_TIMING
-					tApplyPerm.stop(); 
+					tApplyPerm.stop();
 					ttApplyPerm +=tApplyPerm;
 #endif
-				}							
-		
+				}
 
-#ifdef _BM_TIMING				
+
+#ifdef _BM_TIMING
 				tApplyPerm.clear();
 				tApplyPerm.start();
 #endif
@@ -499,9 +516,9 @@ namespace LinBox
 				BMDUF.mulin_right(BPerm2,order);
 				BMDUF.mulin_right(BPerm1,degree);
 				BMDUF.mulin_right(Qt,degree);
-				BMDUF.mulin_right(BPerm2,degree);				
+				BMDUF.mulin_right(BPerm2,degree);
 				for (size_t i=m;i<m+n;++i){
-					order[i]++;		
+					order[i]++;
 					degree[i]++;
 				}
 
@@ -516,17 +533,17 @@ namespace LinBox
 				for (size_t i=m+1;i<m+n;++i) {
 					if (degree[i]>max_degree)
 						max_degree=degree[i];
-				}			
-				size_t size=SigmaBase.size();			
+				}
+				size_t size=SigmaBase.size();
 				if (SigmaBase.size()<= (size_t)max_degree)
-					{			
-						SigmaBase.resize(size+1,Zero);					
-						size++;
-					}		
+				{
+					SigmaBase.resize(size+1,Zero);
+					size++;
+				}
 				for (int i= (int)size-2;i>=0;i--)
 					for (size_t j=0;j<n;j++)
 						for (size_t k=0;k<n;++k)
-							_F.assign(SigmaBase[i+1].refEntry(m+j,k), SigmaBase[i].getEntry(m+j,k));			
+							_F.assign(SigmaBase[i+1].refEntry(m+j,k), SigmaBase[i].getEntry(m+j,k));
 
 				for (size_t j=0;j<n;j++)
 					for (size_t k=0;k<n;++k)
@@ -539,25 +556,25 @@ namespace LinBox
 #endif
 
 
-#ifdef __DEBUG_MAPLE	
+#ifdef __DEBUG_MAPLE
 				std::cout<<"\n\nSigmaBase"<<N<<":= ";
 				write_maple(_F,SigmaBase);
-				
+
 				std::cout<<"order"<<N<<":=<";
 				for (size_t i=0;i<m+n;++i){
 					std::cout<<order[i];
-					if (i!=m+n-1) std::cout<<",";					
+					if (i!=m+n-1) std::cout<<",";
 				}
 				std::cout<<">;"<<std::endl;
 				std::cout<<"degree"<<N<<":=<";
 				for (size_t i=0;i<m+n;++i){
 					std::cout<<degree[i];
-					if (i!=m+n-1) std::cout<<",";					
+					if (i!=m+n-1) std::cout<<",";
 				}
 				std::cout<<">;"<<std::endl;
-				
+
 #endif
-			
+
 #ifdef __CHECK_LOOP
 				std::cout<<"\nCheck validity of current SigmaBase\n";
 				std::cout<<"SigmaBase size: "<<SigmaBase.size()<<std::endl;
@@ -569,20 +586,20 @@ namespace LinBox
 					for (size_t j=1;j<min_t -1;++j)
 						_BMD.axpyin(Disc,SigmaBase[j],S[i-j]);
 					Disc.write(std::cout,_F)<<std::endl;
-				}				
+				}
 #endif
 
 
 #ifdef _BM_TIMING
 				tNewDiscrepancy.clear();
 				tNewDiscrepancy.start();
-#endif		
+#endif
 				// Discrepancy= BPerm2.U.P from LQUP
 				Coefficient U(m+n,n);
 				TriangularBlasMatrix<Element> trU(U,BlasTag::up,BlasTag::nonunit);
-				LQUP.getU(trU);	 
+				LQUP.getU(trU);
 				Discrepancy=U;
-				BlasPermutation P= LQUP.getP();
+				// BlasPermutation<size_t> P= LQUP.getP();
 				_BMD.mulin_left(Discrepancy,P);
 				_BMD.mulin_right(BPerm2,Discrepancy);
 
@@ -590,21 +607,21 @@ namespace LinBox
 				tNewDiscrepancy.stop();
 				ttNewDiscrepancy+=tNewDiscrepancy;
 
-				// timer in the loop 
-				tGetCoeff.clear();	
+				// timer in the loop
+				tGetCoeff.clear();
 				tGetCoeff.start();
-#endif	
+#endif
 
 			}
 			if ( early_stop == EARLY_TERM_THRESHOLD)
 				std::cout<<"Early termination is used: stop at "<<N<<" from "<<length<<" iterations\n\n";
-			
-#ifdef __PRINT_SEQUENCE	
+
+#ifdef __PRINT_SEQUENCE
 			std::cout<<"\n\nSequence:= ";
 			write_maple(_F,S);
 #endif
 
-		
+
 
 #ifdef __CHECK_SIGMA_RESULT
 			std::cout<<"Check SigmaBase application\n";
@@ -632,10 +649,10 @@ namespace LinBox
 			Coefficient tmp(m,m);
 			for (long i=0;i< max+1;++i)
 				P[i]=tmp;
-			
-			for (size_t i=0;i<m;i++) 
-				for (long j=0;j<=degree[i];j++) 
-					for (size_t k=0;k<m;k++) 
+
+			for (size_t i=0;i<m;i++)
+				for (long j=0;j<=degree[i];j++)
+					for (size_t k=0;k<m;k++)
 						_F.assign(P[degree[i]-j].refEntry(i,k), SigmaBase[j].getEntry(i,k));
 #ifdef _BM_TIMING
 			tGetMinPoly.stop();
@@ -654,7 +671,7 @@ namespace LinBox
 				for (size_t j=0;j<m*n;++j)
 					if (!_F.isZero(*(res.getPointer()+j)))
 						valid= false;
-				//res.write(std::cout,_F)<<std::endl;				
+				//res.write(std::cout,_F)<<std::endl;
 			}
 			if (valid)
 				std::cout<<"minpoly is correct\n";
@@ -665,10 +682,12 @@ namespace LinBox
 #ifdef __PRINT_MINPOLY
 			std::cout<<"MinPoly:=";
 			write_maple(_F,P);
-			//Coefficient Mat(*_container->getBB());
-			//std::cout<<"A:=Matrix(";
-			//Mat.write(std::cout,_F,true);
-#endif	       
+#if 0
+			Coefficient Mat(*_container->getBB());
+			std::cout<<"A:=Matrix(";
+			Mat.write(std::cout,_F,true);
+#endif
+#endif
 
 			std::vector<size_t> deg(m);
 			for (size_t i=0;i<m;++i)
@@ -678,7 +697,8 @@ namespace LinBox
 		}
 
 
-		std::vector<size_t> masseyblock_left_rec (std::vector<Coefficient> &P) {
+		std::vector<size_t> masseyblock_left_rec (std::vector<Coefficient> &P)
+		{
 
 			// Get information of the Sequence (U.A^i.V)
 			size_t length = _container->size();
@@ -697,74 +717,75 @@ namespace LinBox
 			typename Sequence::const_iterator _iter (_container->begin ());
 			for (size_t i=0;i< length; ++i, ++_iter){
 				Coefficient value(2*m,n);
-				PowerSerie[i] = value;	
+				PowerSerie[i] = value;
 				for (size_t j=0;j<m;++j)
 					for (size_t k=0;k<n;++k)
 						PowerSerie[i].setEntry(j,k, (*_iter).getEntry(j,k));
 			}
 			for (size_t j=0;j<n;++j)
 				PowerSerie[0].setEntry(m+j, j, one);
-#ifdef __PRINT_SEQUENCE	
+#ifdef __PRINT_SEQUENCE
 			std::cout<<"PowerSerie:=";
-			write_maple(_F,PowerSerie);		
+			write_maple(_F,PowerSerie);
 #endif
 
-			
+
 			// Set the defect to [0 ... 0 1 ... 1]^T
 			std::vector<size_t> defect(2*m,0);
 			for (size_t i=m;i< 2*m;++i)
 				defect[i]=1;
-									
+
 			// Prepare SigmaBase
 			std::vector<Coefficient> SigmaBase(length,Zero);
-			
+
 			// Compute Sigma Base up to the order length - 1
 			PM_Basis(SigmaBase, PowerSerie, length-1, defect);
-		
+
 			// take the m rows which have lowest defect
-			// compute permutation such that first m rows have lowest defect						
-			std::vector<size_t> Perm(2*m);			
+			// compute permutation such that first m rows have lowest defect
+			std::vector<size_t> Perm(2*m);
 			for (size_t i=0;i<2*m;++i)
-				Perm[i]=i;			
+				Perm[i]=i;
 			for (size_t i=0;i<2*m;++i) {
 				size_t idx_min=i;
-				for (size_t j=i+1;j<2*m;++j) 
-					if (defect[j]< defect[idx_min]) 
-						idx_min=j;												
-				std::swap(defect[i],defect[idx_min]);				
+				for (size_t j=i+1;j<2*m;++j)
+					if (defect[j]< defect[idx_min])
+						idx_min=j;
+				std::swap(defect[i],defect[idx_min]);
 				Perm[i]=idx_min;
-			}	
-			BlasPermutation BPerm(Perm);
-			
+			}
+			BlasPermutation<size_t> BPerm(Perm);
+
 			// Apply BPerm to the Sigma Base
 			for (size_t i=0;i<SigmaBase.size();++i)
 				_BMD.mulin_right(BPerm,SigmaBase[i]);
-			
-			//std::cout<<"SigmaBase:=";
-			//write_maple(_F,SigmaBase);
-						
+
+#if 0
+			std::cout<<"SigmaBase:=";
+			write_maple(_F,SigmaBase);
+#endif
 			// Compute the reverse polynomial of SigmaBase according to defect of each row
 			size_t max=defect[0];
 			for (size_t i=0;i<m;++i)
 				if (defect[i] > max)
 					max=defect[i];
-			
+
 			P = std::vector<Coefficient> (max+1);
 			Coefficient tmp(m,m);
 			for (size_t i=0;i< max+1;++i)
 				P[i]=tmp;
-			for (size_t i=0;i<m;i++) 
-				for (size_t j=0;j<=defect[i];j++) 
-					for (size_t k=0;k<m;k++) 
+			for (size_t i=0;i<m;i++)
+				for (size_t j=0;j<=defect[i];j++)
+					for (size_t k=0;k<m;k++)
 						_F.assign(P[defect[i]-j].refEntry(i,k), SigmaBase[j].getEntry(i,k));
 
 #ifdef __CHECK_RESULT
 			std::cout<<"Check minimal polynomial application\n";
 			_container->recompute();
 			typename Sequence::const_iterator _ptr (_container->begin ());
-			for (size_t i=0;i< length; ++i, ++_ptr){				
-				PowerSerie[i] = *_ptr;	
-			}			
+			for (size_t i=0;i< length; ++i, ++_ptr){
+				PowerSerie[i] = *_ptr;
+			}
 			bool valid=true;
 			for (size_t i=0;i< length - P.size();++i){
 				Coefficient res(m,n);
@@ -777,7 +798,7 @@ namespace LinBox
 				for (size_t j=0;j<m*n;++j)
 					if (!_F.isZero(*(res.getPointer()+j)))
 						valid= false;
-				//res.write(std::cout,_F)<<std::endl;				
+				//res.write(std::cout,_F)<<std::endl;
 			}
 			if (valid)
 				std::cout<<"minpoly is correct\n";
@@ -791,25 +812,26 @@ namespace LinBox
 			//Coefficient Mat(*_container->getBB());
 			//std::cout<<"A:=Matrix(";
 			//Mat.write(std::cout,_F,true);
-#endif		
+#endif
 			std::vector<size_t> degree(m);
 			for (size_t i=0;i<m;++i)
 				degree[i] = defect[i];
 			return degree;
 		}
 
-		
+
 		// Computation of a minimal Sigma Base of a Power Serie up to a degree
 		// according to a vector of defect.
 		// algorithm is from Giorgi, Jeannerod and Villard  ISSAC'03
 		//
 		// SigmaBase must be already allocated with degree+1 elements
-		
+
 		void PM_Basis(std::vector<Coefficient>     &SigmaBase,
-			      std::vector<Coefficient>    &PowerSerie, 
-			      size_t                           degree, 
-			      std::vector<size_t>             &defect) {
-						
+			      std::vector<Coefficient>    &PowerSerie,
+			      size_t                           degree,
+			      std::vector<size_t>             &defect)
+		{
+
 			size_t m,n;
 			m = PowerSerie[0].rowdim();
 			n = PowerSerie[0].coldim();
@@ -826,7 +848,7 @@ namespace LinBox
 			}
 			else {
 				if (degree == 1) {
-#ifdef _BM_TIMING				
+#ifdef _BM_TIMING
 					tMBasis.clear();
 					tMBasis.start();
 #endif
@@ -834,12 +856,12 @@ namespace LinBox
 #ifdef _BM_TIMING
 					tMBasis.stop();
 					ttMBasis += tMBasis;
-#endif			
+#endif
 				}
 				else {
 					size_t degree1,degree2;
 					degree1 = (degree >> 1) + (degree & 1);
-					degree2 = degree - degree1;									
+					degree2 = degree - degree1;
 
 					// Compute Sigma Base of half degree
 					std::vector<Coefficient> Sigma1(degree1+1,ZeroSigma);
@@ -847,29 +869,29 @@ namespace LinBox
 					for (size_t i=0;i< degree1+1;++i)
 						Serie1[i] = PowerSerie[i];
 					PM_Basis(Sigma1, Serie1, degree1, defect);
-#ifdef _BM_TIMING				
+#ifdef _BM_TIMING
 					tUpdateSerie.clear();
 					tUpdateSerie.start();
 #endif
 					// Compute Serie2 = x^(-degree1).Sigma.PowerSerie mod x^degree2
-					std::vector<Coefficient> Serie2(degree1+1,ZeroSerie);										
+					std::vector<Coefficient> Serie2(degree1+1,ZeroSerie);
 					ComputeNewSerie(Serie2,Sigma1,PowerSerie, degree1, degree2);
-#ifdef _BM_TIMING				
+#ifdef _BM_TIMING
 					tUpdateSerie.stop();
 					ttUpdateSerie += tUpdateSerie;
 #endif
-					// Compute Sigma Base of half degree from updated Power Serie					
+					// Compute Sigma Base of half degree from updated Power Serie
 					std::vector<Coefficient> Sigma2(degree2+1,ZeroSigma);
 					PM_Basis(Sigma2, Serie2, degree2, defect);
-						
-#ifdef _BM_TIMING				
+
+#ifdef _BM_TIMING
 					tBasisMultiplication.clear();
 					tBasisMultiplication.start();
 #endif
-					// Compute the whole Sigma Base through the product 
-					// of the Sigma Basis Sigma1 x Sigma2										
-					MulSigmaBasis(SigmaBase,Sigma2,Sigma1);						
-#ifdef _BM_TIMING				
+					// Compute the whole Sigma Base through the product
+					// of the Sigma Basis Sigma1 x Sigma2
+					MulSigmaBasis(SigmaBase,Sigma2,Sigma1);
+#ifdef _BM_TIMING
 					tBasisMultiplication.stop();
 					ttBasisMultiplication += tBasisMultiplication;
 #endif
@@ -880,13 +902,14 @@ namespace LinBox
 
 
 		// Computation of a minimal Sigma Base of a Power Serie up to length
-		// algorithm is from Giorgi, Jeannerod and Villard  ISSAC'03		
+		// algorithm is from Giorgi, Jeannerod and Villard  ISSAC'03
 		void M_Basis(std::vector<Coefficient>     &SigmaBase,
-			     std::vector<Coefficient>    &PowerSerie, 
-			     size_t                           length, 
-			     std::vector<size_t>             &defect) {
+			     std::vector<Coefficient>    &PowerSerie,
+			     size_t                           length,
+			     std::vector<size_t>             &defect)
+		{
 
-			// Get the dimension of matrices inside 
+			// Get the dimension of matrices inside
 			// the Matrix Power Serie
 			size_t m,n;
 			m = PowerSerie[0].rowdim();
@@ -897,7 +920,7 @@ namespace LinBox
 			Element one, zero;
 			_F.init(one,1UL);
 			_F.init(zero,0UL);
-			
+
 			// Reserve memory for the Sigma Base and set SigmaBase[0] to Identity
 			SigmaBase.reserve(length+1);
 			SigmaBase.resize(1);
@@ -905,50 +928,53 @@ namespace LinBox
 			for (size_t i=0;i< m;++i)
 				Identity.setEntry(i,i,one);
 			SigmaBase[0]=Identity;
-			
+
 			// Keep track on Sigma Base's row degree
 			std::vector<size_t> degree(m,0);
 			for (size_t i=0;i<n;++i)
 				degree[i]=0;
-			
+
 
 			// Compute the minimal Sigma Base of the PowerSerie up to length
 			for (size_t k=0; k< length; ++k) {
 
 				// compute BPerm1 such that BPerm1.defect is in increasing order
-				std::vector<size_t> Perm1(m);			
+				std::vector<size_t> Perm1(m);
 				for (size_t i=0;i<m;++i)
-					Perm1[i]=i;			
+					Perm1[i]=i;
 				for (size_t i=0;i<m;++i) {
 					size_t idx_min=i;
-					for (size_t j=i+1;j<m;++j) 
-						if (defect[j]< defect[idx_min]) 
-							idx_min=j;												
-					std::swap(defect[i], defect[idx_min]);				
+					for (size_t j=i+1;j<m;++j)
+						if (defect[j]< defect[idx_min])
+							idx_min=j;
+					std::swap(defect[i], defect[idx_min]);
 					Perm1[i]=idx_min;
-				}					
-				BlasPermutation BPerm1(Perm1);
+				}
+				BlasPermutation<size_t> BPerm1(Perm1);
 
 				// Apply Bperm1 to the current SigmaBase
 				for (size_t i=0;i<SigmaBase.size();++i)
 					_BMD.mulin_right(BPerm1,SigmaBase[i]);
 
 				// Compute Discrepancy
-				Coefficient Discrepancy(m,n);								
+				Coefficient Discrepancy(m,n);
 				_BMD.mul(Discrepancy,SigmaBase[0],PowerSerie[k]);
 				for (size_t i=1;i<SigmaBase.size();i++){
 					_BMD.axpyin(Discrepancy,SigmaBase[i],PowerSerie[k-i]);
 				}
-				
+
 				// Compute LQUP of Discrepancy
-				LQUPMatrix<Field> LQUP(_F,Discrepancy);
+				BlasPermutation<size_t> P (Discrepancy.coldim());
+				BlasPermutation<size_t> Qt (Discrepancy.rowdim());
+
+				LQUPMatrix<Field> LQUP(_F,Discrepancy,P,Qt);
 
 				// Get L from LQUP
 				TriangularBlasMatrix<Element> L(m, m, BlasTag::low, BlasTag::unit);
 				LQUP.getL(L);
 
 				// get the transposed permutation of Q from LQUP
-				BlasPermutation Qt =LQUP.getQ();
+				// BlasPermutation<size_t> Qt =LQUP.getQ();
 
 				// Compute the inverse of L
 				TriangularBlasMatrix<Element> invL(m, m, BlasTag::low, BlasTag::unit);
@@ -956,36 +982,37 @@ namespace LinBox
 
 				// Update Sigma by L^(-1)
 				// Sigma = L^(-1) . Sigma
-				for (size_t i=0;i<SigmaBase.size();++i) 
+				for (size_t i=0;i<SigmaBase.size();++i)
 					_BMD.mulin_right(invL,SigmaBase[i]);
-
-				//std::cout<<"BaseBis"<<k<<":=";
-				//write_maple(_F,SigmaBase);
+#if 0
+				std::cout<<"BaseBis"<<k<<":=";
+				write_maple(_F,SigmaBase);
+#endif
 				// Increase by degree and defect according to row choosen as pivot in LQUP
 				for (size_t i=0;i<n;++i){
 					defect[*(Qt.getPointer()+i)]++;
 					degree[*(Qt.getPointer()+i)]++;
 				}
-								
+
 				size_t max_degree=degree[*(Qt.getPointer())];
 				for (size_t i=0;i<n;++i) {
 					if (degree[*(Qt.getPointer()+i)]>max_degree)
 						max_degree=degree[*(Qt.getPointer()+i)];
-				}	
-			
-		
+				}
+
+
 				size_t size=SigmaBase.size();
 				if (SigmaBase.size()<= max_degree+1)
-					{					
-						SigmaBase.resize(size+1,Zero);					
-						size++;
-					}				
+				{
+					SigmaBase.resize(size+1,Zero);
+					size++;
+				}
 				// Mulitply by x the rows of Sigma involved as pivot in LQUP
 				for (size_t i=0;i<n;++i){
-					for (int j= (int) size-2;j>=0; --j){						
+					for (int j= (int) size-2;j>=0; --j){
 						for (size_t l=0;l<m;++l)
 							_F.assign(SigmaBase[j+1].refEntry(*(Qt.getPointer()+i),l),
-								  SigmaBase[j].getEntry(*(Qt.getPointer()+i),l));			
+								  SigmaBase[j].getEntry(*(Qt.getPointer()+i),l));
 					}
 					for (size_t l=0;l<m;++l)
 						_F.assign(SigmaBase[0].refEntry(*(Qt.getPointer()+i),l),zero);
@@ -994,14 +1021,15 @@ namespace LinBox
 				//std::cout<<"Base"<<k<<":=";
 				//write_maple(_F,SigmaBase);
 			}
-			//std::cout<<"defect: ";
-			//for (size_t i=0;i<m;++i)
-			//	std::cout<<defect[i]<<" ";
-			//std::cout<<std::endl;
-			
-			//std::cout<<"SigmaBase"<<length<<":=";
-			//write_maple(_F,SigmaBase);
+#if 0
+			std::cout<<"defect: ";
+			for (size_t i=0;i<m;++i)
+				std::cout<<defect[i]<<" ";
+			std::cout<<std::endl;
 
+			std::cout<<"SigmaBase"<<length<<":=";
+			write_maple(_F,SigmaBase);
+#endif
 		}
 
 
@@ -1009,11 +1037,12 @@ namespace LinBox
 		// using Karatsuba multiplication
 		// algorithm is that of Hanrot, Quercia and Zimmermann 2002
 
-		void MP_Karatsuba(std::vector<Coefficient> &C, const std::vector<Coefficient> &A, const std::vector<Coefficient> &B){
-		
+		void MP_Karatsuba(std::vector<Coefficient> &C, const std::vector<Coefficient> &A, const std::vector<Coefficient> &B)
+		{
+
 			if (A.size() == 1)
 				_BMD.mul(C[0],A[0],B[0]);
-			else {				
+			else {
 				size_t k0= A.size()>>1;
 				size_t k1= A.size()-k0;
 
@@ -1023,7 +1052,7 @@ namespace LinBox
 				const Coefficient Zero(m,n);
 				std::vector<Coefficient> alpha(k1,Zero), beta(k1,Zero), gamma(k0,Zero);
 				std::vector<Coefficient> A_low(k0), A_high(k1), B1(2*k1-1), B2(2*k1-1);
-				
+
 				for (size_t i=0;i<k0;++i)
 					A_low[i] = A[i];
 
@@ -1034,32 +1063,32 @@ namespace LinBox
 					B1[i] = B[i];
 					B2[i] = B[i+k1];
 					_MD.addin(B1[i],B2[i]);
-				}		
-				MP_Karatsuba(alpha, A_high, B1);			
+				}
+				MP_Karatsuba(alpha, A_high, B1);
 
 				if (k0 == k1) {
 					for (size_t i=0;i<k1;++i)
 						_MD.subin(A_high[i],A_low[i]);
-					MP_Karatsuba(beta, A_high, B2);					
+					MP_Karatsuba(beta, A_high, B2);
 				}
 				else {
 					for (size_t i=1;i<k1;++i)
 						_MD.subin(A_high[i],A_low[i-1]);
 					MP_Karatsuba(beta, A_high, B2);
-				}				
-				
+				}
+
 				std::vector<Coefficient> B3(2*k0-1,Zero);
 				for (size_t i=0;i<2*k0-1;++i)
 					_MD.add(B3[i],B[i+2*k1],B[i+k1]);
-				
+
 				MP_Karatsuba(gamma, A_low, B3);
 
 				for (size_t i=0;i<k1;++i)
 					_MD.sub(C[i],alpha[i],beta[i]);
-				
+
 				for (size_t i=0;i<k0;++i){
 					C[k1+i]=gamma[i];
-					_MD.addin(C[k1+i],beta[i]);								
+					_MD.addin(C[k1+i],beta[i]);
 				}
 			}
 		}
@@ -1067,16 +1096,17 @@ namespace LinBox
 
 		// Multiply a Power Serie by a Sigma Base.
 		// only affect coefficients of the Power Serie between degree1 and degree2
-		void ComputeNewSerie(std::vector<Coefficient>          &NewSerie, 
-				     const std::vector<Coefficient>   &SigmaBase, 
+		void ComputeNewSerie(std::vector<Coefficient>          &NewSerie,
+				     const std::vector<Coefficient>   &SigmaBase,
 				     const std::vector<Coefficient>    &OldSerie,
 				     size_t                              degree1,
-				     size_t                              degree2){						
-			
+				     size_t                              degree2)
+		{
+
 
 			// degree1 >= degree2
 			//size_t size = 2*degree1 + 1;
-					
+
 			const Coefficient ZeroSerie (OldSerie[0].rowdim(), OldSerie[0].coldim());
 			const Coefficient ZeroBase  (SigmaBase[0].rowdim(), SigmaBase[0].coldim());
 
@@ -1085,42 +1115,43 @@ namespace LinBox
 			for (size_t i=0;i< OldSerie.size();++i)
 				Serie[i] = OldSerie[i];
 
-			// Work on a copy of the Sigma Base 
+			// Work on a copy of the Sigma Base
 			std::vector<Coefficient> Sigma(SigmaBase.size());
 			for (size_t i=0;i<SigmaBase.size();++i){
 				Sigma[i] = SigmaBase[i];
 			}
 
 			MP_Karatsuba(NewSerie, Sigma, Serie);
+#if 0
+			std::vector<Coefficient> NewPowerSerie(SigmaBase.size()+OldSerie.size(), Zero);
+			MulSigmaBasis(NewPowerSerie, Sigma, Serie);
+			for (size_t i=0;i<degree2;++i)
+				NewSerie[i] = NewPowerSerie[i+degree1];
+#endif
 
-			//std::vector<Coefficient> NewPowerSerie(SigmaBase.size()+OldSerie.size(), Zero);
-			//MulSigmaBasis(NewPowerSerie, Sigma, Serie);		       
-			//for (size_t i=0;i<degree2;++i)
-			//	NewSerie[i] = NewPowerSerie[i+degree1];	
-
-			
 		}
-		
+
 
 		// matrix polynomial multiplication
-		// using Karatsuba's algorithm		
+		// using Karatsuba's algorithm
 		void MulPolyMatrix(std::vector<Coefficient> &C, size_t shiftC,
 				   std::vector<Coefficient> &A, size_t shiftA, size_t degA,
-				   std::vector<Coefficient> &B, size_t shiftB, size_t degB){
-			
+				   std::vector<Coefficient> &B, size_t shiftB, size_t degB)
+		{
+
 			const Coefficient ZeroC(C[0].rowdim(), C[0].coldim());
 			const Coefficient ZeroA(A[0].rowdim(), A[0].coldim());
 			const Coefficient ZeroB(B[0].rowdim(), B[0].coldim());
-			
+
 			if ((degA == 1) || (degB == 1)) {
-				
+
 				if ((degA == 1) && (degB == 1))
-					_BMD.mul(C[shiftC],A[shiftA],B[shiftB]); 
-				else 
-					if (degA == 1) 
+					_BMD.mul(C[shiftC],A[shiftA],B[shiftB]);
+				else
+					if (degA == 1)
 						for (size_t i=0;i< degB;++i)
 							_BMD.mul(C[shiftC+i],A[shiftA],B[shiftB+i]);
-					else 
+					else
 						for (size_t i=0;i< degA;++i)
 							_BMD.mul(C[shiftC+i],A[shiftA+i],B[shiftB]);
 			}
@@ -1129,75 +1160,77 @@ namespace LinBox
 				half_degA= (degA & 1) + degA >>1;
 				half_degB= (degB & 1) + degB >>1;
 				degSplit= (half_degA > half_degB) ? half_degA : half_degB;
-				
+
 				degB_low = (degB < degSplit) ? degB : degSplit;
 				degA_low = (degA < degSplit) ? degA : degSplit;
 				degA_high= degA - degA_low;
 				degB_high= degB - degB_low;
-				
+
 				// multiply low degrees
-				MulPolyMatrix(C, shiftC, A, shiftA, degA_low, B, shiftB, degB_low);   
-				
+				MulPolyMatrix(C, shiftC, A, shiftA, degA_low, B, shiftB, degB_low);
+
 				// multiply high degrees (only if they are both different from zero)
-				if ((degA_high !=0) && (degB_high != 0)) {	
+				if ((degA_high !=0) && (degB_high != 0)) {
 					MulPolyMatrix(C, shiftC+(degSplit << 1), A, shiftA+degSplit, degA_high, B, shiftB+degSplit, degB_high);
 				}
-				
+
 				// allocate space for summation of low and high degrees
 				std::vector<Coefficient> A_tmp(degA_low,ZeroA);
 				std::vector<Coefficient> B_tmp(degB_low,ZeroB);
 				std::vector<Coefficient> C_tmp(degA_low+degB_low-1,ZeroC);
-				
+
 				// add low and high degrees of A
 				for (size_t i=0;i<degA_low;++i)
 					A_tmp[i]=A[shiftA+i];
-				if ( degA_high != 0) 
+				if ( degA_high != 0)
 					for (size_t i=0;i<degA_high;++i)
-						_MD.addin(A_tmp[i],A[shiftA+degSplit+i]);	
-				
+						_MD.addin(A_tmp[i],A[shiftA+degSplit+i]);
+
 				// add low and high degrees of B
 				for (size_t i=0;i<degB_low;++i)
 					B_tmp[i]=B[shiftA+i];
 				if ( degB_high != 0)
 					for (size_t i=0;i<degB_high;++i)
 						_MD.addin(B_tmp[i],B[shiftB+degSplit+i]);
-				
+
 				//  multiply the sums
 				MulPolyMatrix(C_tmp, 0, A_tmp, 0, degA_low, B_tmp, 0, degB_low);
-				
+
 				// subtract the low product from the product of sums
 				for (size_t i=0;i< C_tmp.size();++i)
-					_MD.subin(C_tmp[i], C[shiftC+i]);	
-				
+					_MD.subin(C_tmp[i], C[shiftC+i]);
+
 				// subtract the high product from the product of sums
 				if ((degA_high !=0) && (degB_high != 0))
 					for (size_t i=0;i< degA_high+degB_high-1; ++i)
 						_MD.subin(C_tmp[i], C[shiftC+(degSplit << 1)+i]);
-				
+
 				// add the middle term of the product
 				size_t mid= (degA_low+degB_high > degB_low+degA_high)? degA_low+degB_high :degB_low+degA_high;
 				for (size_t i=0;i< mid-1; ++i)
-					_MD.addin(C[shiftC+degSplit+i], C_tmp[i]);											
-			}		    
-		}				
-			
+					_MD.addin(C[shiftC+degSplit+i], C_tmp[i]);
+			}
+		}
+
 		// Multiply two Sigma Basis
 		// in fact this is matrix polynomial multiplication
-		// we assume that we can modify each operand 
+		// we assume that we can modify each operand
 		// since only result will be used
-		void MulSigmaBasis(std::vector<Coefficient> &C, 
+		void MulSigmaBasis(std::vector<Coefficient> &C,
 				   std::vector<Coefficient> &A,
-				   std::vector<Coefficient> &B){
+				   std::vector<Coefficient> &B)
+		{
 			//std::cout<<"C=A*B: "<<C.size()<<" "<<A.size()<<" "<<B.size()<<std::endl;
 			MulPolyMatrix(C, 0, A, 0, A.size(), B, 0, B.size());
-			
-			//for (size_t i=0;i<A.size();++i)
-			//	for (size_t j=0;j<B.size();++j)
-			//		_BMD.axpyin(C[i+j],A[i],B[j]);
+#if 0
+			for (size_t i=0;i<A.size();++i)
+				for (size_t j=0;j<B.size();++j)
+					_BMD.axpyin(C[i+j],A[i],B[j]);
+#endif
 		}
-					
+
 	}; //end of class BlockMasseyDomain
-	
+
 } // end of namespace LinBox
-	
-#endif // __MASSEY_DOMAIN_H
+
+#endif // __LINBOX_massey_block_domain_H
diff --git a/linbox/algorithms/block-wiedemann.h b/linbox/algorithms/block-wiedemann.h
index 7ebdcd4..619a296 100644
--- a/linbox/algorithms/block-wiedemann.h
+++ b/linbox/algorithms/block-wiedemann.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/algorithms/block-wiedemann.h
  * Copyright (C) 2004 Pascal Giorgi
  *
@@ -22,8 +22,8 @@
  */
 
 
-#ifndef __BLOCK_WIEDEMANN_H
-#define __BLOCK_WIEDEMANN_H
+#ifndef __LINBOX_block_wiedemann_H
+#define __LINBOX_block_wiedemann_H
 
 #include <vector>
 
@@ -38,7 +38,8 @@
 #include <linbox/util/error.h>
 #include <linbox/util/debug.h>
 
-namespace LinBox {
+namespace LinBox
+{
 
 	template <class _Field>
 	class BlockWiedemannSolver{
@@ -57,15 +58,20 @@ namespace LinBox {
 		RandIter                   _rand;
 
 	public:
-		BlockWiedemannSolver (const Field &F) : _F(F), _BMD(F), _VDF(F), _rand(F) {}
+		BlockWiedemannSolver (const Field &F) :
+			_F(F), _BMD(F), _VDF(F), _rand(F)
+		{}
 
-		BlockWiedemannSolver (const Field &F, const RandIter &rand) : _F(F), _BMD(F), _VDF(F), _rand(rand) {}
+		BlockWiedemannSolver (const Field &F, const RandIter &rand) :
+			_F(F), _BMD(F), _VDF(F), _rand(rand)
+		{}
 
 
 		template <class Blackbox>
-		Vector &solveNonSingular (Vector &x, const Blackbox &B, const Vector &y) const {
+		Vector &solveNonSingular (Vector &x, const Blackbox &B, const Vector &y) const
+		{
+
 
-			
 			Transpose<Blackbox> A(B);
 
 			size_t m,n;
@@ -85,31 +91,31 @@ namespace LinBox {
 
 
 			Block U(p,m), UA(p-1,m), V(n,q);
-			
+
 			for (size_t i=0;i<n;++i)
 				for (size_t j=0;j<q;++j)
 					_rand.random(V.refEntry(i,j));
-			
+
 			for (size_t i=0;i<p-1;++i)
 				for (size_t j=0;j<m;++j)
 					_rand.random(UA.refEntry(i,j));
-			
+
 			Block::RowIterator        iter_U  = U.rowBegin();
 			Block::ConstRowIterator   iter_UA = UA.rowBegin();
 			++iter_U;
-			for (; iter_UA != UA.rowEnd(); ++iter_UA, ++iter_U) 
+			for (; iter_UA != UA.rowEnd(); ++iter_UA, ++iter_U)
 				A.applyTranspose( *iter_U , *iter_UA );
-				
+
 			for (size_t i=0;i<m;++i)
 				U.setEntry(0,i,y[i]);
 
-			BlackboxBlockContainer<Field,Transpose<Blackbox> > Sequence (&A,_F,U,V);			
+			BlackboxBlockContainer<Field,Transpose<Blackbox> > Sequence (&A,_F,U,V);
 			BlockMasseyDomain <Field,BlackboxBlockContainer<Field,Transpose<Blackbox> > > MBD(&Sequence);
-			
+
 			std::vector<Block> minpoly;
 			std::vector<size_t> degree;
 			MBD.left_minpoly(minpoly,degree);
-			
+
 
 			size_t idx=0;
 			if ( _F.isZero(minpoly[0].getEntry(0,0))) {
@@ -119,10 +125,10 @@ namespace LinBox {
 					++i;
 				if (i == m)
 					throw LinboxError(" block minpoly: matrix seems to be singular - abort");
-				else 
-					idx=i	;			
+				else
+					idx=i	;
 			}
-			
+
 
 			bool classic = false;
 			if ( classic) {
@@ -132,44 +138,44 @@ namespace LinBox {
 				 * the first element in this row is non zero.
 				 * we use y and UA as projection (UA= U.A)
 				 */
-				size_t deg = degree[idx];		
+				size_t deg = degree[idx];
 				std::vector<Vector> combi(p,Vector(deg+1));
-				for (size_t i=0;i<p;++i) 
+				for (size_t i=0;i<p;++i)
 					for (size_t k=0;k<deg+1;++k)
 						combi[i][k]=minpoly[k].getEntry(idx,i);
-					
-				Vector lhs(n);			
+
+				Vector lhs(n);
 				A.applyTranspose(lhs,y);
 				_VDF.mulin(lhs,combi[0][deg]);
 				Vector lhsbis(lhs);
 				for (int i = deg-1 ; i > 0;--i) {
 					_VDF.axpy (lhs, combi[0][i], y, lhsbis);
-					A.applyTranspose (lhsbis, lhs);			
-				}   
-		
+					A.applyTranspose (lhsbis, lhs);
+				}
+
 				Vector accu (lhs);
-				for (size_t k=1;k<p;++k){			
+				for (size_t k=1;k<p;++k){
 					Vector row(m);
 					for (size_t j=0;j<m;++j)
-						row[j]=UA.getEntry(k-1,j);				
-					A.applyTranspose(lhs,row);			
+						row[j]=UA.getEntry(k-1,j);
+					A.applyTranspose(lhs,row);
 					_VDF.mulin(lhs,combi[k][deg]);
 					Vector lhsbis(lhs);
-					for (int i = deg-1 ; i >= 0;--i) {												
+					for (int i = deg-1 ; i >= 0;--i) {
 						_VDF.axpy (lhs, combi[k][i], row, lhsbis);
 						A.applyTranspose (lhsbis, lhs);
-					}   
-				
-				
+					}
+
+
 					_VDF.addin(accu,lhs);
 				}
-			
+
 				Element scaling;
 				_F.init(scaling);
 				_F.neg(scaling,combi[0][0]);
 				_F.invin(scaling);
 				_VDF.mul(x,accu,scaling);
-				
+
 			}
 			else {
 				/*
@@ -177,40 +183,40 @@ namespace LinBox {
 				 * given by the product of the idx-th row of MinPoly and UA.
 				 * this should decrease the number of sparse apply but increase memory requirement.
 				 */
-				size_t deg = degree[idx];		
+				size_t deg = degree[idx];
 				BlasMatrix<Element> idx_poly(deg+1,p-1);
-				for (size_t i=0;i<deg+1;++i) 
+				for (size_t i=0;i<deg+1;++i)
 					for (size_t j=0;j<p-1;++j)
 						idx_poly.setEntry(i,j,minpoly[i].getEntry(idx,j+1));
 
 				BlasMatrix<Element> Combi(deg+1,m);
 				_BMD.mul(Combi,idx_poly,UA);
-					
 
-				Vector lhs(n),row(m);	
+
+				Vector lhs(n),row(m);
 				for (size_t i=0;i<m;++i)
 					row[i]= Combi.getEntry(deg,i);
-					
-				A.applyTranspose(lhs,row);					
+
+				A.applyTranspose(lhs,row);
 				Vector lhsbis(lhs);
 				for (int i = deg-1 ; i >= 0;--i) {
 					for (size_t j=0;j<m;++j)
 						row[j]= Combi.getEntry(i,j);
 					_VDF.add (lhs,row,lhsbis);
-					A.applyTranspose (lhsbis, lhs);			
-				}   
-					
+					A.applyTranspose (lhsbis, lhs);
+				}
+
 				Vector accu (lhs);
-					
-					
+
+
 				A.applyTranspose(lhs,y);
 				_VDF.mulin(lhs,minpoly[deg].getEntry(idx,0));
 				lhsbis=lhs;
 				for (size_t i = deg-1 ; i > 0;--i) {
 					_VDF.axpy (lhs,minpoly[i].getEntry(idx,0) , y, lhsbis);
-					A.applyTranspose (lhsbis, lhs);			
-				}  
-					
+					A.applyTranspose (lhsbis, lhs);
+				}
+
 				_VDF.addin(accu,lhs);
 				Element scaling;
 				_F.init(scaling);
@@ -218,16 +224,16 @@ namespace LinBox {
 				_F.invin(scaling);
 				_VDF.mul(x,accu,scaling);
 			}
-	
-			return x;	
+
+			return x;
 		}
 
 
 
 	}; // end of class BlockWiedemannSolver
-    
 
-    
+
+
 }// end of namespace LinBox
 
-#endif
+#endif //__LINBOX_block_wiedemann_H
diff --git a/linbox/algorithms/charpoly-rational.h b/linbox/algorithms/charpoly-rational.h
new file mode 100644
index 0000000..16ffa2a
--- /dev/null
+++ b/linbox/algorithms/charpoly-rational.h
@@ -0,0 +1,334 @@
+/* -*- 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
+/* linbox/blackbox/rational-reconstruction-base.h
+ * Copyright (C) 2009 Anna Marszalek
+ *
+ * Written by Anna Marszalek <aniau at astronet.pl>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_charpoly_rational_H
+#define __LINBOX_charpoly_rational_H
+
+#include "linbox/util/commentator.h"
+#include "linbox/util/timer.h"
+#include "linbox/field/modular-double.h"
+
+//#include "linbox/field/gmp-rational.h"
+#include "linbox/field/PID-integer.h"
+#include "linbox/blackbox/rational-matrix-factory.h"
+#include "linbox/blackbox/dense.h"
+#include "linbox/algorithms/cra-early-multip.h"
+#include "linbox/algorithms/cra-domain.h"
+//#include "linbox/algorithms/rational-cra.h"
+#include "linbox/algorithms/rational-reconstruction-base.h"
+#include "linbox/algorithms/classic-rational-reconstruction.h"
+#include "linbox/solutions/charpoly.h"
+#include "linbox/blackbox/compose.h"
+#include "linbox/blackbox/diagonal.h"
+
+namespace LinBox
+{
+	//typedef GMPRationalField Rationals;
+	//typedef Rationals::Element Quotient;
+
+	/*
+	 * Computes the characteristic polynomial of a rational dense matrix
+	 */
+
+	template<class T1, class T2>
+	struct MyModularCharpoly{
+		T1* t1;
+		T2* t2;
+
+		int switcher;
+
+		MyModularCharpoly(T1* s1, T2* s2, int s = 1)  {t1=s1; t2=s2;switcher = s;}
+
+		int setSwitcher(int s) {return switcher = s;}
+
+		template<typename Polynomial, typename Field>
+		Polynomial& operator()(Polynomial& P, const Field& F) const
+		{
+			if (switcher ==1) {
+				t1->operator()(P,F);
+			}
+			else {
+				t2->operator()(P,F);
+			}
+			return P;
+		}
+	};
+
+	template <class Blackbox, class MyMethod>
+	struct MyRationalModularCharpoly {
+		const Blackbox &A;
+		const MyMethod &M;
+		const std::vector<Integer> &mul;//multiplicative prec;
+
+		MyRationalModularCharpoly(const Blackbox& b, const MyMethod& n,
+					  const std::vector<Integer >& p) :
+			A(b), M(n), mul(p)
+		{}
+		MyRationalModularCharpoly(MyRationalModularCharpoly& C) :
+			MyRationalModularCharpoly(C.A,C.M,C.mul)
+		{}
+
+		template<typename Polynomial, typename Field>
+		Polynomial& operator()(Polynomial& P, const Field& F) const
+		{
+			typedef typename Blackbox::template rebind<Field>::other FBlackbox;
+			FBlackbox * Ap;
+			MatrixHom::map(Ap, A, F);
+			charpoly( P, *Ap, typename FieldTraits<Field>::categoryTag(), M);
+			typename std::vector<Integer >::const_iterator it = mul.begin();
+			typename Polynomial::iterator it_p = P.begin();
+			for (;it_p !=P.end(); ++it, ++it_p) {
+				typename Field::Element e;
+				F.init(e, *it);
+				F.mulin(*it_p,e);
+			}
+
+			delete Ap;
+			return P;
+		}
+	};
+
+	template <class Blackbox, class MyMethod>
+	struct MyIntegerModularCharpoly {
+		const Blackbox &A;
+		const MyMethod &M;
+		const std::vector<typename Blackbox::Field::Element> &vD;//diagonal div. prec;
+		const std::vector<typename Blackbox::Field::Element > &mul;//multiplicative prec;
+
+		MyIntegerModularCharpoly(const Blackbox& b, const MyMethod& n,
+					 const std::vector<typename Blackbox::Field::Element>& ve,
+					 const std::vector<typename Blackbox::Field::Element >& p) :
+			A(b), M(n), vD(ve), mul(p) {}
+
+		MyIntegerModularCharpoly(MyIntegerModularCharpoly& C) :
+			MyIntegerModularCharpoly(C.A,C.M,C.vD,C.mul)
+		{}
+
+		template<typename Polynomial, typename Field>
+		Polynomial& operator()(Polynomial& P, const Field& F) const
+		{
+			typedef typename Blackbox::template rebind<Field>::other FBlackbox;
+			FBlackbox * Ap;
+			MatrixHom::map(Ap, A, F);
+
+			typename std::vector<typename Blackbox::Field::Element>::const_iterator it;
+
+			int i=0;
+			for (it = vD.begin(); it != vD.end(); ++it,++i) {
+				typename Field::Element t,tt;
+				F.init(t,*it);
+				F.invin(t);
+				for (int j=0; j < A.coldim(); ++j) {
+					F.mulin(Ap->refEntry(i,j),t);
+				}
+			}
+
+			charpoly( P, *Ap, typename FieldTraits<Field>::categoryTag(), M);
+			typename std::vector<typename Blackbox::Field::Element >::const_iterator it2 = mul.begin();
+			typename Polynomial::iterator it_p = P.begin();
+			for (;it_p !=P.end(); ++it2, ++it_p) {
+				typename Field::Element e;
+				F.init(e, *it2);
+				F.mulin(*it_p,e);
+			}
+
+			delete Ap;
+			return P;
+		}
+	};
+
+	template <class Rationals, template <class> class Vector, class MyMethod >
+	Vector<typename Rationals::Element>& rational_charpoly (Vector<typename Rationals::Element> &p,
+								const DenseMatrix<Rationals > &A,
+								const MyMethod &Met=  Method::Hybrid())
+	{
+
+		typedef Modular<double> myModular;
+		typedef typename Rationals::Element Quotient;
+
+		commentator.start ("Rational Charpoly", "Rminpoly");
+
+		RandomPrimeIterator genprime( 26-(int)ceil(log((double)A.rowdim())*0.7213475205));
+
+		std::vector<Integer> F(A.rowdim()+1,1);
+		std::vector<Integer> M(A.rowdim()+1,1);
+		std::vector<Integer> Di(A.rowdim());
+
+		//DenseMatrixBase<Quotient> ABase(A);
+		RationalMatrixFactory<PID_integer,Rationals,DenseMatrix<Rationals > > FA(&A);
+		Integer da=1, di=1; Integer D=1;
+		FA.denominator(da);
+
+		for (int i=M.size()-2; i >= 0 ; --i) {
+			//c[m]=1, c[0]=det(A);
+			FA.denominator(di,i);
+			D *=di;
+			Di[i]=di;
+			M[i] = M[i+1]*da;
+		}
+		for (int i=0; i < M.size() ; ++i ) {
+			gcd(M[i],M[i],D);
+		}
+
+		PID_integer Z;
+		DenseMatrix<PID_integer> Atilde(Z,A.rowdim(), A.coldim());
+		FA.makeAtilde(Atilde);
+
+		ChineseRemainder< EarlyMultipCRA<Modular<double> > > cra(4UL);
+		MyRationalModularCharpoly<DenseMatrix<Rationals > , MyMethod> iteration1(A, Met, M);
+		MyIntegerModularCharpoly<DenseMatrix<PID_integer>, MyMethod> iteration2(Atilde, Met, Di, M);
+		MyModularCharpoly<MyRationalModularCharpoly<DenseMatrix<Rationals > , MyMethod>,
+		MyIntegerModularCharpoly<DenseMatrix<PID_integer>, MyMethod> >  iteration(&iteration1,&iteration2);
+
+		RReconstruction<PID_integer, ClassicMaxQRationalReconstruction<PID_integer> > RR;
+
+		std::vector<Integer> PP; // use of integer due to non genericity of cra. PG 2005-08-04
+		UserTimer t1,t2;
+		t1.clear();
+		t2.clear();
+		t1.start();
+		cra(2,PP,iteration1,genprime);
+		t1.stop();
+		t2.start();
+		cra(2,PP,iteration2,genprime);
+		t2.stop();
+
+
+
+		if (t1.time() < t2.time()) {
+			//cout << "ratim";
+			iteration.setSwitcher(1);
+		}
+		else {
+			//cout << "intim";
+			iteration.setSwitcher(2);
+		}
+
+		int k=4;
+		while (! cra(k,PP, iteration, genprime)) {
+			k *=2;
+			Integer m; //Integer r; Integer a,b;
+			cra.getModulus(m);
+			cra.result(PP);//need to divide
+			for (int i=0; i < PP.size(); ++i) {
+				Integer D_1;
+				inv(D_1,M[i],m);
+				PP[i] = (PP[i]*D_1) % m;
+			}
+			Integer den,den1;
+			std::vector<Integer> num(A.rowdim()+1);
+			std::vector<Integer> num1(A.rowdim()+1);
+			if (RR.reconstructRational(num,den,PP,m,-1)) {//performs reconstruction strating form c[m], use c[i] as prec for c[i-1]
+				cra(1,PP,iteration,genprime);
+				cra.getModulus(m);
+				for (int i=0; i < PP.size(); ++i) {
+					Integer D_1;
+					inv(D_1,M[i],m);
+					PP[i] = (PP[i]*D_1) % m;
+				}
+				bool terminated = true;
+				if (RR.reconstructRational(num1,den1,PP,m,-1)) {
+					if (den==den1) {
+						for (int i=0; i < num.size(); ++i) {
+							if (num[i] != num1[i]) {
+								terminated =false;
+								break;
+							}
+						}
+					}
+					else {
+						terminated = false;
+					}
+					//set p
+					if (terminated) {
+						size_t i =0;
+						integer t,tt,ttt;
+						integer err;
+						size_t max_err = 0;
+						Quotient qerr;
+						p.resize(PP.size());
+						typename Vector <typename Rationals::Element>::iterator it;
+						Rationals Q;
+						for (it= p.begin(); it != p.end(); ++it, ++i) {
+							A.field().init(*it, num[i],den);
+							Q.get_den(t,*it);
+							if (it != p.begin()) Q.get_den(tt,*(it-1));
+							else tt = 1;
+							Q.init(qerr,t,tt);
+
+						}
+						return p;
+						break;
+					}
+				}
+			}
+		}
+
+		cra.result(PP);
+
+		size_t i =0;
+		integer t,tt;
+		integer err;
+		size_t max_res=0;int max_i; double rel;
+		size_t max_resu=0; int max_iu;
+		size_t max_err = 0;
+		Quotient qerr;
+		p.resize(PP.size());
+
+		typename Vector <typename Rationals::Element>::iterator it;
+
+		Rationals Q;
+		for (it= p.begin(); it != p.end(); ++it, ++i) {
+			A.field().init(*it, PP[i],M[i]);
+			Q.get_den(t, *it);
+			Q.get_num(tt,*it);
+			err = M[i]/t;
+			size_t resi = err.bitsize() + tt.bitsize() -1;
+			size_t resu = t.bitsize() + tt.bitsize() -1;
+			if (resi > max_res) {max_res = resi; max_i=i;}
+			if (resu > max_resu) {max_resu = resu; max_iu =i;}
+			//size_t resu = t.bitsize() + tt.bitsize() -1;
+			//if (err.bitsize() > max_err) max_err = err.bitsize();
+		}
+
+		max_res=0;
+		for (it= p.begin()+1; it != p.end(); ++it) {
+			//A.field().init(*it, PP[i],M[i]);
+			Q.get_den(t, *it);
+			Q.get_den(tt, *(it-1));
+			Q.init(qerr,t,tt);
+			Q.get_num(tt, *it);
+			size_t resi = Q.bitsize(t,qerr) + tt.bitsize() -2;
+			if (resi > max_res) {max_res = resi; max_i=i;}
+			//if (err.bitsize() > max_err) max_err = err.bitsize();
+		}
+
+		commentator.stop ("done", NULL, "Iminpoly");
+
+		return p;
+
+	}
+
+}
+
+#endif //__LINBOX_charpoly_rational_H
diff --git a/linbox/algorithms/cia.h b/linbox/algorithms/cia.h
index 764aa0d..c7cd943 100644
--- a/linbox/algorithms/cia.h
+++ b/linbox/algorithms/cia.h
@@ -1,14 +1,15 @@
 /* -*- 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
 /* linbox/algorithms/cia.h
- * 
+ * Copyright(C) LinBox
+ *
  *  Written by Clement Pernet <clement.pernet at imag.fr>
  *
  * See COPYING for license information.
  */
 
-#ifndef __CIA_H
-#define __CIA_H
+#ifndef __LINBOX_cia_H
+#define __LINBOX_cia_H
 
 #include "linbox/ring/givaro-polynomial.h"
 #include "linbox/field/modular.h"
@@ -17,40 +18,41 @@
 #include "linbox/algorithms/blas-domain.h"
 #include "linbox/solutions/minpoly.h"
 
-namespace LinBox 
+namespace LinBox
 {
-	
-	/* Algorithm computing the integer characteristic polynomial
+
+	/*! @ingroup algorithms
+	 * Algorithm computing the integer characteristic polynomial
 	 * of a dense matrix.
-	 * See [Dumas-Pernet-Wan ISSAC05]
+	 *
+	 * @bib [Dumas-Pernet-Wan ISSAC05]
 	 *
 	 *
 	 */
 	template < class Polynomial, class Blackbox >
 	Polynomial& cia (Polynomial & P, const Blackbox & A,
-			 const Method::BlasElimination  & M) 
-
+			 const Method::BlasElimination  & M)
 	{
-		commentator.start ("Integer Dense Charpoly ", "CIA");
+		commentator.start ("Integer ::Givaro::Dense Charpoly ", "CIA");
 
 		typename Blackbox::Field intRing = A.field();
 		typedef Modular<double> Field;
-		typedef BlasBlackbox<Field> FBlackbox;
-		typedef GivPolynomialRing<typename Blackbox::Field, Dense> IntPolyDom;
-		typedef GivPolynomialRing<Field, Dense> FieldPolyDom;
-		typedef typename GivPolynomialRing<typename Blackbox::Field, Dense>::Element IntPoly;
-		typedef typename GivPolynomialRing<Field, Dense>::Element FieldPoly;
+		typedef typename Blackbox::template rebind<Field>::other FBlackbox;
+		typedef GivPolynomialRing<typename Blackbox::Field, ::Givaro::Dense> IntPolyDom;
+		typedef GivPolynomialRing<Field, ::Givaro::Dense> FieldPolyDom;
+		typedef typename IntPolyDom::Element IntPoly;
+		typedef typename FieldPolyDom::Element FieldPoly;
 
 		IntPolyDom IPD(intRing);
-		
+
 		FieldPoly fieldCharPoly(A.coldim());
 		/* Computation of the integer minimal polynomial */
 		IntPoly intMinPoly;
 		minpoly (intMinPoly, A, RingCategories::IntegerTag(), M);
-		
+
 		/* Factorization over the integers */
-		vector<IntPoly*> intFactors;    
-		vector<unsigned long> mult;
+		std::vector<IntPoly*> intFactors;
+		std::vector<unsigned long> mult;
 		IPD.factor (intFactors, mult, intMinPoly);
 		size_t nf = intFactors.size();
 
@@ -58,10 +60,9 @@ namespace LinBox
 		RandomPrimeIterator primeg (22);
 		++primeg;
 		Field F(*primeg);
-		FBlackbox * fbb;
-		MatrixHom::map<Field,Blackbox> (fbb, A, F);
-		charpoly (fieldCharPoly, *fbb, M);
-		delete fbb;
+		FBlackbox fbb(F, A.rowdim(), A.coldim());
+		MatrixHom::map(fbb, A, F);
+		charpoly (fieldCharPoly, fbb, M);
 		/* Determination of the multiplicities */
 		FieldPolyDom FPD (F);
 		std::vector<FieldPoly> fieldFactors (nf);
@@ -73,7 +74,7 @@ namespace LinBox
 				//F.init ((fieldFactors[i])[j], (*intFactors[i])[j]);
 				F.init ((fieldFactors[i])[j], intRing.convert(tmp_convert,(*intFactors[i])[j]));// PG 2005-08-04
 		}
-		
+
 		FieldPoly currPol = fieldCharPoly;
 		FieldPoly r,tmp,q;
 		std::vector<long> multip (nf);
@@ -89,7 +90,7 @@ namespace LinBox
 			} while (FPD.isZero (r));
 			multip[i] = m-1;
 		}
-		
+
 		IntPoly intCharPoly (A.coldim());
 		intRing.init (intCharPoly[0], 1);
 		for (size_t i = 0; i < nf; ++i){
@@ -104,4 +105,5 @@ namespace LinBox
 	}
 }
 
-#endif // __CIA_H
+#endif // __LINBOX_cia_H
+
diff --git a/linbox/algorithms/classic-rational-reconstruction.h b/linbox/algorithms/classic-rational-reconstruction.h
new file mode 100644
index 0000000..ad996d7
--- /dev/null
+++ b/linbox/algorithms/classic-rational-reconstruction.h
@@ -0,0 +1,320 @@
+/* -*- 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
+/* linbox/blackbox/classic-rational-reconstruction.h
+ * Copyright (C) 2009 Anna Marszalek
+ *
+ * Written by Anna Marszalek <aniau at astronet.pl>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __LINBOX_classic_reconstruction_H
+#define __LINBOX_classic_reconstruction_H
+
+#include <iostream>
+
+#include "linbox/algorithms/rational-reconstruction-base.h"
+
+namespace LinBox
+{
+
+	/*
+	 * implements classic rational reconstruction by extended euclidean algorithm,
+	 * Wang's bounds [Wang 1981] are used as default
+	 */
+
+	template <class Ring>
+	class ClassicRationalReconstruction: public RReconstructionBase<Ring> {
+	protected:
+		const bool _reduce;
+		const bool _recursive;
+	public:
+		const Ring _Z;
+		typedef typename Ring::Element Element;
+
+		ClassicRationalReconstruction(const Ring& Z, const bool reduce = true, const bool recursive = false) :
+			RReconstructionBase<Ring>(Z),
+			_reduce(reduce), _recursive (recursive), _Z(Z)
+		{}
+
+		ClassicRationalReconstruction<Ring> (const ClassicRationalReconstruction<Ring>& RR):
+			RReconstructionBase<Ring>(RR._Z),
+			_reduce(RR._reduce), _recursive(RR._recursive), _Z(RR._Z)
+		{}
+
+		~ClassicRationalReconstruction() {}
+
+		//Wang method
+		bool reconstructRational(Element& a, Element& b, const Element& x, const Element& m) const
+		{
+			Element a_bound; _Z.sqrt(a_bound, m/2);
+			bool res = reconstructRational(a,b,x,m,a_bound);
+			res = res && (b <= a_bound);
+			return res;
+		}
+
+		bool reconstructRational(Element& a, Element& b, const Element& x, const Element& m, const Element& a_bound) const{
+			bool res=false;
+
+			if (x == 0) {
+				a = 0;
+				b = 1;
+			}
+			else {
+				res = ratrecon(a,b,x,m,a_bound);
+				if (_recursive) {
+					for(Element newbound = a_bound + 1; (!res) && (newbound<x) ; ++newbound)
+						res = ratrecon(a,b,x,m,newbound);
+				}
+			}
+			if (!res) {
+				a = x> m/2? x-m: x;
+				b = 1;
+				if (a > 0) res = (a < a_bound);
+				else res = (-a < a_bound);
+			}
+
+			return res;
+		}
+
+
+	protected:
+
+		bool ratrecon(Element& a,Element& b,const Element& x,const Element& m,const Element& a_bound) const
+		{
+
+			Element  r0, t0, q, u;
+			r0=m;
+			t0=0;
+			a=x;
+			b=1;
+			//Element s0,s1; s0=1,s1=0;//test time gcdex;
+			while(a>=a_bound)
+				//while (t0 <= b_bound)
+			{
+
+				q = r0;
+				_Z.divin(q,a);        // r0/num
+				//++this->C.div_counter;
+
+				u = a;
+				a = r0;
+				r0 = u;	// r0 <-- num
+
+				_Z.maxpyin(a,u,q); // num <-- r0-q*num
+				//++this->C.mul_counter;
+				//if (a == 0) return false;
+
+				u = b;
+				b = t0;
+				t0 = u;	// t0 <-- den
+
+				_Z.maxpyin(b,u,q); // den <-- t0-q*den
+				//++this->C.mul_counter;
+
+				//u = s1;
+				//s1 = s0;
+				//s0 = u;
+
+				//_Z.maxpyin(s0,u,q);
+				//++this->C.mul_counter;
+
+			}
+
+			//if (den < 0) {
+			//	_Z.negin(num);
+			//      _Z.negin(den);
+			//}
+
+			if ((a>0) && (_reduce)) {
+
+				// [GG, MCA, 1999] Theorem 5.26
+				// (ii)
+				Element gg;
+				//++this->C.gcd_counter;
+				if (_Z.gcd(gg,a,b) != 1) {
+
+					Element ganum, gar2;
+					for( q = 1, ganum = r0-a, gar2 = r0 ; (ganum >= a_bound) || (gar2<a_bound); ++q ) {
+						ganum -= a;
+						gar2 -= a;
+					}
+
+					//_Z.maxpyin(r0,q,a);
+					r0 = ganum;
+					_Z.maxpyin(t0,q,b);
+					//++this->C.mul_counter;++this->C.mul_counter;
+					if (t0 < 0) {
+						a = -r0;
+						b = -t0;
+					}
+					else {
+						a = r0;
+						b = t0;
+					}
+
+					//                                if (t0 > m/k) {
+					if (abs((double)b) > (double)m/(double)a_bound) {
+						if (!_recursive) {
+							std::cerr
+							<< "*** Error *** No rational reconstruction of "
+							<< x
+							<< " modulo "
+							<< m
+							<< " with denominator <= "
+							<< (m/a_bound)
+							<< std::endl;
+						}
+						return false;
+					}
+					if (_Z.gcd(gg,a,b) != 1) {
+						if (!_recursive)
+							std::cerr
+							<< "*** Error *** There exists no rational reconstruction of "
+							<< x
+							<< " modulo "
+							<< m
+							<< " with |numerator| < "
+							<< a_bound
+							<< std::endl
+							<< "*** Error *** But "
+							<< a
+							<< " = "
+							<< b
+							<< " * "
+							<< x
+							<< " modulo "
+							<< m
+							<< std::endl;
+						return false;
+					}
+				}
+				}
+				// (i)
+				if (b < 0) {
+					_Z.negin(a);
+					_Z.negin(b);
+				}
+
+				// std::cerr << "RatRecon End " << num << "/" << den << std::endl;
+				return true;
+			}
+		};
+
+		/*
+		 * implements classic rational reconstruction by extended euclidean algorithm,
+		 * reconstructed pair corresponds to the maximal (or large enough) quotient, see MQRR Alg. of Monagan [Monagan2004] is used
+		 */
+
+		template <class Ring>
+		class ClassicMaxQRationalReconstruction:public ClassicRationalReconstruction<Ring> {
+		public:
+			const Ring _Z;
+			typedef typename Ring::Element Element;
+
+			ClassicMaxQRationalReconstruction(const Ring& Z, const bool reduce = true, const bool recursive = false) :
+				ClassicRationalReconstruction<Ring>(Z,reduce,recursive), _Z(Z)
+		       	{}
+
+			ClassicMaxQRationalReconstruction(const ClassicMaxQRationalReconstruction<Ring>& RR) :
+				ClassicRationalReconstruction<Ring>(RR), _Z(RR._Z)
+			{}
+
+			~ClassicMaxQRationalReconstruction() {}
+
+			bool reconstructRational(Element& a, Element& b, const Element& x, const Element& m) const
+			{
+				bool res = maxEEA(a,b,x,m);
+				return res;
+			}
+
+			bool reconstructRational(Element& a, Element& b, const Element& x, const Element& m, const Element& a_bound) const{
+				bool res= false;
+				return res = ClassicRationalReconstruction<Ring>::reconstructRational(a,b,x,m,a_bound);
+			}
+
+		protected:
+			bool maxEEA(Element& a, Element& b, const Element& x, const Element& m) const{
+
+				Element qmax = 0, amax=x, bmax =1;
+
+				Element  r0, t0, q, u;
+				r0=m;
+				t0=0;
+				a=x;
+				b=1;
+				//Element s0,s; s0=1,s=0;//test time gcdex;
+
+				Element T = m.bitsize();
+				int c = 5;	//should be changed here to enhance probability of correctness
+
+				while((a>0) && (r0.bitsize() > T.bitsize() + c))
+				{
+					q = r0;
+					_Z.divin(q,a);        // r0/num
+					//++this->C.div_counter;
+					if (q > qmax) {
+						amax = a;
+						bmax = b;
+						qmax = q;
+						if (qmax.bitsize() > T.bitsize() + c) break;
+					}
+
+					u = a;
+					a = r0;
+					r0 = u;	// r0 <-- num
+
+					_Z.maxpyin(a,u,q); // num <-- r0-q*num
+					//++this->C.mul_counter;
+					//if (a == 0) return false;
+
+					u = b;
+					b = t0;
+					t0 = u;	// t0 <-- den
+
+					_Z.maxpyin(b,u,q); // den <-- t0-q*den
+					//++this->C.mul_counter;
+				}
+
+				a = amax;
+				b = bmax;
+
+				if (b < 0) {
+					_Z.negin(a);
+					_Z.negin(b);
+				}
+
+				Element gg;
+				_Z.gcd(gg,a,b);
+				//++this->C.gcd_counter;
+
+				//if (q > T)
+				//Element T = m.bitsize();
+				//int c = 20;
+				//T=0;c=0;
+				if (qmax.bitsize() > T.bitsize() + c) {
+					return true;
+				}
+				else return false;
+
+				//if (gg > 1) return false;
+				//else return true;
+			}
+		};
+
+	}
+#endif //__LINBOX_classic_reconstruction_H
diff --git a/linbox/algorithms/cra-domain-omp.h b/linbox/algorithms/cra-domain-omp.h
new file mode 100644
index 0000000..611c62b
--- /dev/null
+++ b/linbox/algorithms/cra-domain-omp.h
@@ -0,0 +1,242 @@
+/* -*- 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
+/* linbox/algorithms/cra-domain-omp.h
+ * Copyright (C) 1999-2010 The LinBox group
+ *
+ * Naive parallel chinese remaindering
+ * Launch NN iterations in parallel, where NN=omp_get_max_threads()
+ * Then synchronization and termintation test.
+ * Time-stamp: <16 Jul 10 16:59:17 Jean-Guillaume.Dumas at imag.fr>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifndef __LINBOX_omp_cra_H
+#define __LINBOX_omp_cra_H
+// commentator is not thread safe
+#define DISABLE_COMMENTATOR
+#include "linbox/algorithms/cra-domain-seq.h"
+#include <set>
+#include <vector>
+
+namespace LinBox
+{
+
+	template<class CRABase>
+	struct ChineseRemainderOMP : public ChineseRemainderSeq<CRABase> {
+		typedef typename CRABase::Domain	Domain;
+		typedef typename CRABase::DomainElement	DomainElement;
+		typedef ChineseRemainderSeq<CRABase>    Father_t;
+
+		template<class Param>
+		ChineseRemainderOMP(const Param& b) :
+			Father_t(b)
+		{}
+
+		ChineseRemainderOMP(const CRABase& b) :
+			Father_t(b)
+		{}
+
+		template<class Function, class PrimeIterator>
+		Integer& operator() (Integer& res, Function& Iteration, PrimeIterator& primeiter)
+		{
+			size_t NN = omp_get_max_threads();
+			//std::cerr << "Blocs: " << NN << " iterations." << std::endl;
+			// commentator.start ("Parallel OMP Modular iteration", "mmcrait");
+			if (NN == 1) return Father_t::operator()(res,Iteration,primeiter);
+
+			int coprime =0;
+			int maxnoncoprime = 1000;
+
+			if (this->IterCounter==0) {
+				std::set<Integer> coprimeset;
+				while(coprimeset.size() < NN) {
+					++primeiter;
+					while(this->Builder_.noncoprime(*primeiter) ) {
+						++primeiter;
+						++coprime;
+						if (coprime > maxnoncoprime) {
+							std::cout << "you are running out of primes. " << maxnoncoprime << " coprime primes found";
+							return this->Builder_.result(res);
+						}
+					}
+					coprime =0;
+					coprimeset.insert(*primeiter);
+				}
+				std::vector<Domain> ROUNDdomains; ROUNDdomains.reserve(NN);
+				std::vector<DomainElement> ROUNDresidues(NN);
+				typename std::vector<DomainElement>::iterator resit=ROUNDresidues.begin();
+				for(std::set<Integer>::const_iterator coprimesetiter = coprimeset.begin(); coprimesetiter != coprimeset.end(); ++coprimesetiter,++resit) {
+					// std::cerr << "With prime: " << *coprimesetiter << std::endl;
+					ROUNDdomains.push_back( Domain(*coprimesetiter) );
+					ROUNDdomains.back().init( *resit );
+				}
+
+#pragma omp parallel for
+				for(long i=0;i<NN;++i) {
+					Iteration(ROUNDresidues[i], ROUNDdomains[i]);
+				}
+#pragma omp barrier
+				++this->IterCounter;
+				this->Builder_.initialize( ROUNDdomains[0],ROUNDresidues[0]);
+				for(size_t i=1;i<NN;++i) {
+					++this->IterCounter;
+					this->Builder_.progress( ROUNDdomains[i],ROUNDresidues[i]);
+				}
+				// commentator.report(Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION) << "With prime " << *primeiter << std::endl;
+			}
+
+			while( ! this->Builder_.terminated() ) {
+				//std::cerr << "Computed: " << this->IterCounter << " primes." << std::endl;
+				size_t NN = omp_get_max_threads();
+				std::set<Integer> coprimeset;
+				while(coprimeset.size() < NN) {
+					++primeiter;
+					while(this->Builder_.noncoprime(*primeiter) ) {
+						++primeiter;
+						++coprime;
+						if (coprime > maxnoncoprime) {
+							std::cout << "you are running out of primes. " << maxnoncoprime << " coprime primes found";
+							return this->Builder_.result(res);
+						}
+					}
+					coprime =0;
+					coprimeset.insert(*primeiter);
+				}
+				std::vector<Domain> ROUNDdomains; ROUNDdomains.reserve(NN);
+				std::vector<DomainElement> ROUNDresidues(NN);
+				typename std::vector<DomainElement>::iterator resit=ROUNDresidues.begin();
+				for(std::set<Integer>::const_iterator coprimesetiter = coprimeset.begin(); coprimesetiter != coprimeset.end(); ++coprimesetiter,++resit) {
+					// std::cerr << "With prime: " << *coprimesetiter << std::endl;
+					ROUNDdomains.push_back( Domain(*coprimesetiter) );
+					ROUNDdomains.back().init( *resit );
+				}
+
+#pragma omp parallel for
+				for(long i=0;i<NN;++i) {
+					Iteration(ROUNDresidues[i], ROUNDdomains[i]);
+				}
+#pragma omp barrier
+				for(size_t i=0;i<NN;++i) {
+					++this->IterCounter;
+					this->Builder_.progress( ROUNDdomains[i],ROUNDresidues[i]);
+				}
+			}
+			// commentator.stop ("done", NULL, "mmcrait");
+			//std::cerr << "Used: " << this->IterCounter << " primes." << std::endl;
+			return this->Builder_.result(res);
+		}
+
+		template<class Container, class Function, class PrimeIterator>
+		Container& operator() (Container& res, Function& Iteration, PrimeIterator& primeiter)
+		{
+			typedef typename CRATemporaryVectorTrait<Function, DomainElement>::Type_t ElementContainer;
+			size_t NN = omp_get_max_threads();
+			//std::cerr << "Blocs: " << NN << " iterations." << std::endl;
+			// commentator.start ("Parallel OMP Modular iteration", "mmcrait");
+			if (NN == 1) return Father_t::operator()(res,Iteration,primeiter);
+
+			int coprime =0;
+			int maxnoncoprime = 1000;
+
+			if (this->IterCounter==0) {
+				std::set<Integer> coprimeset;
+				while(coprimeset.size() < NN) {
+					++primeiter;
+					while(this->Builder_.noncoprime(*primeiter) ) {
+						++primeiter;
+						++coprime;
+						if (coprime > maxnoncoprime) {
+							std::cout << "you are running out of primes. " << maxnoncoprime << " coprime primes found";
+							return this->Builder_.result(res);
+						}
+					}
+					coprime =0;
+					coprimeset.insert(*primeiter);
+				}
+				std::vector<Domain> ROUNDdomains; ROUNDdomains.reserve(NN);
+				std::vector<ElementContainer> ROUNDresidues(NN);
+				typename std::vector<ElementContainer>::iterator resit=ROUNDresidues.begin();
+				for(std::set<Integer>::const_iterator coprimesetiter = coprimeset.begin(); coprimesetiter != coprimeset.end(); ++coprimesetiter,++resit) {
+					// std::cerr << "With prime: " << *coprimesetiter << std::endl;
+					ROUNDdomains.push_back( Domain(*coprimesetiter) );
+					//                     for(typename ElementContainer::iterator reselit = resit->begin();
+					//                         reselit != resit->end(); ++reselit)
+					//                         ROUNDdomains.back().init( *reselit );
+				}
+
+#pragma omp parallel for
+				for(size_t i=0;i<NN;++i) {
+					Iteration(ROUNDresidues[i], ROUNDdomains[i]);
+				}
+#pragma omp barrier
+				++this->IterCounter;
+				this->Builder_.initialize( ROUNDdomains[0],ROUNDresidues[0]);
+				for(size_t i=1;i<NN;++i) {
+					++this->IterCounter;
+					this->Builder_.progress( ROUNDdomains[i],ROUNDresidues[i]);
+				}
+				// commentator.report(Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION) << "With prime " << *primeiter << std::endl;
+			}
+
+			while( ! this->Builder_.terminated() ) {
+				//std::cerr << "Computed: " << this->IterCounter << " primes." << std::endl;
+				size_t NN = omp_get_max_threads();
+				std::set<Integer> coprimeset;
+				while(coprimeset.size() < NN) {
+					++primeiter;
+					while(this->Builder_.noncoprime(*primeiter) ) {
+						++primeiter;
+						++coprime;
+						if (coprime > maxnoncoprime) {
+							std::cout << "you are running out of primes. " << maxnoncoprime << " coprime primes found";
+							return this->Builder_.result(res);
+						}
+					}
+					coprime =0;
+					coprimeset.insert(*primeiter);
+				}
+				std::vector<Domain> ROUNDdomains; ROUNDdomains.reserve(NN);
+				std::vector<ElementContainer> ROUNDresidues(NN);
+				typename std::vector<ElementContainer>::iterator resit=ROUNDresidues.begin();
+				for(std::set<Integer>::const_iterator coprimesetiter = coprimeset.begin(); coprimesetiter != coprimeset.end(); ++coprimesetiter,++resit) {
+					// std::cerr << "With prime: " << *coprimesetiter << std::endl;
+					ROUNDdomains.push_back( Domain(*coprimesetiter) );
+					//                     for(typename ElementContainer::iterator reselit = resit->begin();
+					//                         reselit != resit->end(); ++reselit)
+					//                         ROUNDdomains.back().init( *reselit );
+				}
+
+#pragma omp parallel for
+				for(size_t i=0;i<NN;++i) {
+					Iteration(ROUNDresidues[i], ROUNDdomains[i]);
+				}
+#pragma omp barrier
+				for(size_t i=0;i<NN;++i) {
+					++this->IterCounter;
+					this->Builder_.progress( ROUNDdomains[i],ROUNDresidues[i]);
+				}
+			}
+			// commentator.stop ("done", NULL, "mmcrait");
+			//std::cerr << "Used: " << this->IterCounter << " primes." << std::endl;
+			return this->Builder_.result(res);
+		}
+
+
+
+	};
+}
+
+#endif //__LINBOX_omp_cra_H
diff --git a/linbox/algorithms/cra-domain-seq.h b/linbox/algorithms/cra-domain-seq.h
new file mode 100644
index 0000000..527c5cd
--- /dev/null
+++ b/linbox/algorithms/cra-domain-seq.h
@@ -0,0 +1,334 @@
+/* -*- 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
+/* linbox/algorithms/cra-domain-seq.h
+ * Copyright (C) 1999-2010 The LinBox group
+ *
+ * Time-stamp: <01 Apr 11 15:47:48 Jean-Guillaume.Dumas at imag.fr>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*! @file algorithms/cra-domain-seq.h
+ * @brief Sequencial version of \ref CRA
+ * @ingroup CRA
+ */
+
+#ifndef __LINBOX_sequential_cra_H
+#define __LINBOX_sequential_cra_H
+#include "linbox/util/timer.h"
+#include <stdlib.h>
+#include "linbox/integer.h"
+#include "linbox/solutions/methods.h"
+#include <vector>
+#include <utility>
+
+//$define _LB_CRATIMING
+
+namespace LinBox
+{
+
+	template<class Function, class Element> struct CRATemporaryVectorTrait {
+		typedef std::vector<Element> Type_t;
+	};
+
+
+	/// No doc.
+	/// @ingroup CRA
+	template<class CRABase>
+	struct ChineseRemainderSeq {
+		typedef typename CRABase::Domain	Domain;
+		typedef typename CRABase::DomainElement	DomainElement;
+	protected:
+		CRABase Builder_;
+
+	public:
+		int IterCounter;
+
+		template<class Param>
+		ChineseRemainderSeq(const Param& b) :
+			Builder_(b)
+		{
+			IterCounter=0;
+		}
+		ChineseRemainderSeq(const CRABase& b) :
+			Builder_(b)
+		{
+			IterCounter=0;
+		}
+
+		/** \brief The \ref CRA loop
+		 *
+		 * Given a function to generate residues \c mod a single prime,
+		 * this loop produces the residues resulting from the Chinese
+		 * remainder process on sufficiently many primes to meet the
+		 * termination condition.
+		 *
+		 * \param Iteration  Function object of two arguments, \c
+		 * Iteration(r, F), given prime field \p F it outputs
+		 * residue(s) \p r. This loop may be parallelized.  \p
+		 * Iteration  must be reentrant, thread safe. For example, \p
+		 * Iteration may be returning the coefficients of the minimal
+		 * polynomial of a matrix \c mod \p F.
+		 *
+		 * @warning  We won't detect bad primes.
+		 *
+		 * \param primeiter  iterator for generating primes.
+		 *
+		 * \param[out] res  an integer
+		 */
+		template<class Function, class PrimeIterator>
+		Integer& operator() (Integer& res, Function& Iteration, PrimeIterator& primeiter)
+		{
+			commentator.start ("Modular iteration", "mmcrait");
+			if (IterCounter==0) {
+				++IterCounter;
+				Domain D(*primeiter);
+				commentator.report(Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION) << "With prime " << *primeiter << std::endl;
+				++primeiter;
+				DomainElement r; D.init(r);
+				Builder_.initialize( D, Iteration(r, D) );
+			}
+
+			int coprime =0;
+			int maxnoncoprime = 1000;
+
+			while( ! Builder_.terminated() ) {
+				++IterCounter;
+				while(Builder_.noncoprime(*primeiter) ) {
+					++primeiter;
+					++coprime;
+					if (coprime > maxnoncoprime) {
+						std::cout << "you are running out of primes. " << maxnoncoprime << " coprime primes found";
+						return Builder_.result(res);
+					}
+				}
+				coprime =0;
+				Domain D(*primeiter);
+				commentator.report(Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION) << "With prime " << *primeiter << std::endl;
+                                ++primeiter; 
+				DomainElement r; D.init(r);
+				Builder_.progress( D, Iteration(r, D) );
+			}
+			commentator.stop ("done", NULL, "mmcrait");
+			//std::cerr << "Used: " << IterCounter << " primes." << std::endl;
+			return Builder_.result(res);
+		}
+
+		/*
+		 * progress for k>=0 iterations
+		 * run until terminated if k < 0
+		 */
+		template<class Function, class PrimeIterator>
+		bool operator() (const int k, Integer& res, Function& Iteration, PrimeIterator& primeiter)
+		{
+
+			int i=0;
+			if ((IterCounter ==0) && (k !=0)) {
+				++i;
+				++IterCounter;
+				Domain D(*primeiter);
+				commentator.report(Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION) << "With prime " << *primeiter << std::endl;
+				++primeiter;
+				DomainElement r; D.init(r);
+				Builder_.initialize( D, Iteration(r, D) );
+			}
+
+			int coprime =0;
+			int maxnoncoprime = 1000;
+
+			while ((k <0) || (i < k)) {
+				if (Builder_.terminated()) break;
+				++i;
+				while(Builder_.noncoprime(*primeiter)) {
+					++primeiter;
+					++coprime;
+					if (coprime > maxnoncoprime) {
+						std::cout << "you are running out of primes. " << maxnoncoprime << " coprime primes found";
+						return true ;//term
+					}
+				}
+				coprime =0;
+
+				Domain D(*primeiter);
+				commentator.report(Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION) << "With prime " << *primeiter << std::endl;
+				++primeiter;
+				DomainElement r; D.init(r);
+				Builder_.progress( D, Iteration(r, D) );
+			}
+			Builder_.result(res);
+			if (Builder_.terminated() ) return true;
+			else return false;
+		}
+
+
+		template<class Iterator, class Function, class PrimeIterator>
+		Iterator& operator() (Iterator& res, Function& Iteration, PrimeIterator& primeiter)
+		{
+			commentator.start ("Modular vectorized iteration", "mmcravit");
+
+			if (IterCounter==0) {
+				Domain D(*primeiter);
+				commentator.report(Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION) << "With prime " << *primeiter << std::endl;
+				++primeiter;
+				typename CRATemporaryVectorTrait<Function, DomainElement>::Type_t r;
+				Builder_.initialize( D, Iteration(r, D) );
+			}
+
+			int coprime =0;
+			int maxnoncoprime = 1000;
+
+			while( ! Builder_.terminated() ) {
+				++IterCounter;
+				while(Builder_.noncoprime(*primeiter) ) {
+					++primeiter;
+					++coprime;
+					if (coprime > maxnoncoprime) {
+						std::cout << "you are running out of primes. " << maxnoncoprime << " coprime primes found";
+						return Builder_.result(res);
+					}
+				}
+
+                                Domain D(*primeiter);
+				commentator.report(Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION) << "With prime " << *primeiter << std::endl;
+                                ++primeiter; 
+				typename CRATemporaryVectorTrait<Function, DomainElement>::Type_t r;
+				Builder_.progress( D, Iteration(r, D) );
+			}
+			commentator.stop ("done", NULL, "mmcravit");
+			return Builder_.result(res);
+		}
+
+		/*
+		 *progress for k iterations
+		 */
+
+		template<class Iterator, class Function, class PrimeIterator>
+		bool operator() (const int k, Iterator& res, Function& Iteration, PrimeIterator& primeiter)
+		{
+
+			int i=0;
+			if ((IterCounter ==0) && (k !=0)) {
+				++i;
+				++IterCounter;
+				Domain D(*primeiter);
+				commentator.report(Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION) << "With prime " << *primeiter << std::endl;
+				++primeiter;
+				typename CRATemporaryVectorTrait<Function, DomainElement>::Type_t r;
+				Builder_.initialize( D, Iteration(r, D) );
+			}
+
+			int coprime =0;
+			int maxnoncoprime = 1000;
+
+			while( (k <0 ) || (i < k)) {
+				if (Builder_.terminated()) break;
+				++i;
+				++IterCounter;
+
+				while(Builder_.noncoprime(*primeiter) ) {
+					++primeiter;
+					++coprime;
+					if (coprime > maxnoncoprime) {
+						std::cout << "you are runnig out of primes. " << maxnoncoprime << " coprime primes found";
+						return true;//term
+					}
+				}
+
+				coprime =0;
+				Domain D(*primeiter);
+				++primeiter;
+
+				typename CRATemporaryVectorTrait<Function, DomainElement>::Type_t r;
+				Builder_.progress( D, Iteration(r, D) );
+			}
+			Builder_.result(res);
+			if (Builder_.terminated()) return true;
+			else return false;
+		}
+
+		template<class Param>
+		bool changeFactor(const Param& p)
+		{
+			return Builder_.changeFactor(p);
+		}
+
+		template<class Param>
+		Param& getFactor(Param& p)
+		{
+			return Builder_.getFactor(p);
+		}
+
+		bool changePreconditioner(const Integer& f, const Integer& m=Integer(1))
+		{
+			return Builder_.changePreconditioner(f,m);
+		}
+
+		Integer& getModulus(Integer& m)
+		{
+			Builder_.getModulus(m);
+			return m;
+		}
+
+		Integer& getResidue(Integer& m)
+		{
+			Builder_.getResidue(m);
+			return m;
+		}
+
+		Integer& result(Integer& m)
+		{
+			Builder_.result(m);
+			return m;
+		}
+
+		template<class Int, template <class, class> class Vect, template <class> class Alloc >
+		Vect<Int, Alloc<Int> >& result(Vect<Int, Alloc<Int> >& m)
+		{
+			Builder_.result(m);
+			return m;
+		}
+
+#ifdef _LB_CRATIMING
+		inline std::ostream& reportTimes(std::ostream& os)
+		{
+			os <<  "Iterations:" << IterCounter << "\n";
+			Builder_.reportTimes(os);
+			return os;
+		}
+#endif
+
+	};
+
+#ifdef _LB_CRATIMING
+	class CRATimer {
+	public:
+		mutable Timer ttInit, ttIRecon, /* ttImaging, ttIteration,*/ ttOther;
+		void clear() const
+		{
+			ttInit.clear();
+			ttIRecon.clear();
+			//ttImaging.clear();
+			//ttIteration.clear();
+			ttOther.clear();
+		}
+	};
+#endif
+
+}
+
+#undef _LB_CRATIMING
+
+#endif //__LINBOX_sequential_cra_H
diff --git a/linbox/algorithms/cra-domain.h b/linbox/algorithms/cra-domain.h
index 421c374..84e5575 100644
--- a/linbox/algorithms/cra-domain.h
+++ b/linbox/algorithms/cra-domain.h
@@ -1,83 +1,100 @@
-// ======================================================================= //
-// Time-stamp: <09 Mar 07 18:45:55 Jean-Guillaume.Dumas at imag.fr> 
-// ======================================================================= //
-#ifndef __LINBOX_CRA_H
-#define __LINBOX_CRA_H
-#include "linbox/util/timer.h"
-#include <stdlib.h>
-#include "linbox/integer.h"
-#include "linbox/solutions/methods.h"
-#include <vector>
-#include <utility>
+/* -*- 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
+/* linbox/algorithms/cra-domain.h
+ * Copyright (C) 1999-2010 The LinBox group
+ *
+ * Selector for ChineseRemainder
+ * Parallel versions are transparent to the user
+ * Time-stamp: <30 Mar 10 15:11:42 Jean-Guillaume.Dumas at imag.fr>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifndef __LINBOX_cra_domain_H
+#define __LINBOX_cra_domain_H
 
-namespace LinBox {
-    
-    template<class CRABase>
-    struct ChineseRemainder {
-        typedef typename CRABase::Domain	Domain;
-        typedef typename CRABase::DomainElement	DomainElement;
-    protected:
-        CRABase Builder_;
-        
-    public:
-        template<class Param>
-        ChineseRemainder(const Param& b) : Builder_(b) {}
+/*! @file algorithms/cra-domain.h
+ * @brief Wrapper around OMP/SEQ version of ChineseRemainder.
+ * @ingroup algorithms
+ * @ingroup CRA
+ *
+ * If _OPENMP is defined, the we use ChineseRemainderOMP, else
+ * we fall back to ChineseRemainderSeq
+ */
 
-            /** \brief The CRA loop
-             *
-             * Given a function to generate residues mod a single prime, 
-             * this loop produces the residues resulting from the Chinese 
-             * remainder process on sufficiently many primes to meet the 
-             * termination condition.
-             *
-             * \param Iteration - Function object of two arguments, F(r, p), 
-             * given prime p it outputs residue(s) r. This loop may be 
-             * parallelized.  F must be reentrant, thread safe. For example, 
-             * F may be returning the coefficients of the minimal polynomial 
-             * of a matrix mod p.
-             *
-             * Warning - we won't detect bad primes.
-             *
-             * \param PrimeIterator - iterator for generating primes.
-             * 
-             * \result res - an integer
-             */
-        template<class Int, class Function, class PrimeIterator>
-        Int& operator() (Int& res, Function& Iteration, PrimeIterator& primeiter) {
-            ++primeiter; 
-            Domain D(*primeiter); 
-            DomainElement r; D.init(r);
-            Builder_.initialize( D, Iteration(r, D) );
+#ifdef _OPENMP
 
-            while( ! Builder_.terminated() ) {
-                ++primeiter; while(Builder_.noncoprime(*primeiter) ) ++primeiter; 
-                Domain D(*primeiter); 
-                DomainElement r; D.init(r);
-                Builder_.progress( D, Iteration(r, D) );
-            }
-            return Builder_.result(res);
-        }
+#include "linbox/algorithms/cra-domain-omp.h"
+namespace LinBox
+{
+	/*! @brief Wrapper around OMP/SEQ version of ChineseRemainderXXX<CRABase>.
+	 * \ingroup CRA
+	 *
+	 * If _OPENMP is defined, the we use ChineseRemainderOMP, else
+	 * we fall back to ChineseRemainderSeq
+	 *
+	 * This is the OMP version
+	 */
 
-        
-      template<class Int, template <class, class> class Vect, template <class> class Alloc, class Function, class PrimeIterator>
-	  Vect<Int,Alloc<Int> > & operator() (Vect<Int,Alloc<Int> >& res, Function& Iteration, PrimeIterator& primeiter) {
-            
-            ++primeiter; 
-            Domain D(*primeiter); 
-            Vect<DomainElement, Alloc<DomainElement> > r; 
-            Builder_.initialize( D, Iteration(r, D) );
+	template<class CRABase>
+	struct ChineseRemainder : public ChineseRemainderOMP<CRABase> {
+		typedef typename CRABase::Domain	Domain;
+		typedef typename CRABase::DomainElement	DomainElement;
 
-            while( ! Builder_.terminated() ) {
-                ++primeiter; while(Builder_.noncoprime(*primeiter) ) ++primeiter; 
-                Domain D(*primeiter); 
-                Vect<DomainElement, Alloc<DomainElement> > r; 
-                Builder_.progress( D, Iteration(r, D) );
-            }
-            return Builder_.result(res);
-        }
+		template<class Param>
+		ChineseRemainder(const Param& b) :
+			ChineseRemainderOMP<CRABase>(b)
+		{}
 
-    };
+		ChineseRemainder(const CRABase& b) :
+			ChineseRemainderOMP<CRABase>(b)
+		{}
+	};
+}
+
+#else
+
+#include "linbox/algorithms/cra-domain-seq.h"
+namespace LinBox
+{
+	/*! @brief Wrapper around OMP/SEQ version of ChineseRemainderXXX<CRABase>.
+	 * \ingroup CRA
+	 *
+	 * If _OPENMP is defined, the we use ChineseRemainderOMP, else
+	 * we fall back to ChineseRemainderSeq
+	 *
+	 * This is the SEQ version
+	 */
+
+	template<class CRABase>
+	struct ChineseRemainder : public ChineseRemainderSeq<CRABase> {
+		typedef typename CRABase::Domain	Domain;
+		typedef typename CRABase::DomainElement	DomainElement;
 
+		template<class Param>
+		ChineseRemainder(const Param& b) :
+			ChineseRemainderSeq<CRABase>(b)
+		{}
+
+		ChineseRemainder(const CRABase& b) :
+			ChineseRemainderSeq<CRABase>(b)
+		{}
+	};
 }
 
 #endif
+
+
+#endif
diff --git a/linbox/algorithms/cra-early-multip.h b/linbox/algorithms/cra-early-multip.h
index a68b48d..3f6b821 100644
--- a/linbox/algorithms/cra-early-multip.h
+++ b/linbox/algorithms/cra-early-multip.h
@@ -1,9 +1,32 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-// ======================================================================= //
-// Time-stamp: <12 Mar 07 19:38:54 Jean-Guillaume.Dumas at imag.fr> 
-// ======================================================================= //
-#ifndef __LINBOX_CRA_EARLY_MULTIP_H
-#define __LINBOX_CRA_EARLY_MULTIP_H
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) 2007 LinBox
+ * Written by JG Dumas
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*! @file algorithms/cra-early-multip.h
+ * @ingroup algorithms
+ * @brief NO DOC
+ */
+
+#ifndef __LINBOX_cra_early_multip_H
+#define __LINBOX_cra_early_multip_H
 
 #include "linbox/util/timer.h"
 #include <stdlib.h>
@@ -16,9 +39,14 @@
 #include "linbox/algorithms/cra-full-multip.h"
 
 
+namespace LinBox
+{
+
+	/*!  @brief NO DOC
+	 * @ingroup CRA
+	 *
+	 */
 
-namespace LinBox {
-    
 	template<class Domain_Type>
 	struct EarlyMultipCRA : public EarlySingleCRA<Domain_Type>, public FullMultipCRA<Domain_Type> {
 		typedef Domain_Type			Domain;
@@ -26,28 +54,56 @@ namespace LinBox {
 		typedef EarlyMultipCRA<Domain> 		Self_t;
 
 	protected:
-		// Random coefficients for a linear combination 
+		// Random coefficients for a linear combination
 		// of the elements to be reconstructed
 		std::vector< unsigned long >      	randv;
 
-
 	public:
-	
-		EarlyMultipCRA(const unsigned long EARLY=DEFAULT_EARLY_TERM_THRESHOLD)
-			: EarlySingleCRA<Domain>(EARLY), FullMultipCRA<Domain>() {}
 
+		EarlyMultipCRA(const unsigned long EARLY=DEFAULT_EARLY_TERM_THRESHOLD) :
+			EarlySingleCRA<Domain>(EARLY), FullMultipCRA<Domain>()
+		{}
+
+		Integer& getModulus(Integer& m)
+		{
+			EarlySingleCRA<Domain>::getModulus(m);
+			return m;
+		}
+		Integer& getResidue(Integer& m)
+		{
+			EarlySingleCRA<Domain>::getResidue(m);
+			return m;
+		}
+		template<template<class T> class Vect>
+		Vect<Integer>& getResidue(Vect<Integer>& m)
+		{
+			FullMultipCRA<Domain>::getResidue(m);
+			return m;
+		}
+
+		template<template<class T> class Vect>
+		void initialize (const Integer& D, const Vect<Integer>& e)
+		{
+			srand48(BaseTimer::seed());
+			randv. resize ( e.size() );
+			for ( std::vector<unsigned long>::iterator int_p = randv. begin(); int_p != randv. end(); ++ int_p)
+				*int_p = ((unsigned long)lrand48()) % 20000;
+			Integer z;
+			dot(z, D, e, randv);
+			EarlySingleCRA<Domain>::initialize(D, z);
+			FullMultipCRA<Domain>::initialize(D, e);
+		}
 
-     
 		template<template <class> class Alloc, template<class, class> class Vect>
-		void initialize (const Domain& D, const Vect<DomainElement, Alloc<DomainElement> >& e) {
-			// Random coefficients for a linear combination 
+		void initialize (const Domain& D, const Vect<DomainElement, Alloc<DomainElement> >& e)
+		{
+			// Random coefficients for a linear combination
 			// of the elements to be reconstructed
 			srand48(BaseTimer::seed());
 			randv. resize ( e.size() );
-			for ( std::vector<unsigned long>::iterator int_p = randv. begin(); 
-			      int_p != randv. end(); ++ int_p) 
-				*int_p = ((unsigned long)lrand48()) % 20000;        
-
+			for ( std::vector<unsigned long>::iterator int_p = randv. begin();
+			      int_p != randv. end(); ++ int_p)
+				*int_p = ((unsigned long)lrand48()) % 20000;
 			DomainElement z;
 			// Could be much faster
 			// - do not compute twice the product of moduli
@@ -57,8 +113,18 @@ namespace LinBox {
 			FullMultipCRA<Domain>::initialize(D, e);
 		}
 
+		template<template<class T> class Vect>
+		void progress (const Integer& D, const Vect<Integer>& e)
+		{
+
+			Integer z;
+			EarlySingleCRA<Domain>::progress(D, dot(z, D, e, randv));
+			FullMultipCRA<Domain>::progress(D, e);
+		}
+
 		template<template <class> class Alloc, template<class, class> class Vect>
-		void progress (const Domain& D, const Vect<DomainElement, Alloc<DomainElement> >& e) {
+		void progress (const Domain& D, const Vect<DomainElement, Alloc<DomainElement> >& e)
+		{
 			DomainElement z;
 			// Could be much faster
 			// - do not compute twice the product of moduli
@@ -69,40 +135,96 @@ namespace LinBox {
 		}
 
 		template<template <class> class Alloc, template<class, class> class Vect>
-		Vect<Integer, Alloc<Integer> >& result(Vect<Integer, Alloc<Integer> >& d) {
+		Vect<Integer, Alloc<Integer> >& result(Vect<Integer, Alloc<Integer> >& d)
+		{
 			return FullMultipCRA<Domain>::result(d);
 		}
 
-		bool terminated() {
+		bool terminated()
+		{
 			return EarlySingleCRA<Domain>::terminated();
 		}
-        
-		bool noncoprime(const Integer& i) const {
+
+		bool noncoprime(const Integer& i) const
+		{
 			return EarlySingleCRA<Domain>::noncoprime(i);
 		}
-      
-        
+
+		bool changeVector()
+		{
+			for ( std::vector<unsigned long>::iterator int_p = randv. begin();int_p != randv. end(); ++ int_p)
+				*int_p = ((unsigned long)lrand48()) % 20000;
+
+			std::vector<Integer> e(randv.size());
+			/* clear CRAEarlySingle; */
+			EarlySingleCRA<Domain>::occurency_ = 0;
+			EarlySingleCRA<Domain>::nextM_ = 1UL;
+			EarlySingleCRA<Domain>::primeProd_ = 1UL;
+			EarlySingleCRA<Domain>::residue_ = 0;
+
+			/* Computation of residue_ */
+			std::vector< LazyProduct >::iterator _mod_it = FullMultipCRA<Domain>::RadixPrimeProd_.begin();// list of prime products
+			std::vector< std::vector<Integer> >::iterator _tab_it = FullMultipCRA<Domain>::RadixResidues_.begin();// list of residues as vectors of size 1
+			std::vector< bool >::iterator    _occ_it = FullMultipCRA<Domain>::RadixOccupancy_.begin();//flags of occupied fields
+			int prev_shelf=0, shelf = 0;
+			for (;_occ_it != FullMultipCRA<Domain>::RadixOccupancy_.end(); ++_mod_it, ++_tab_it, ++_occ_it ) {
+				++shelf;
+				if (*_occ_it) {
+					Integer D = _mod_it->operator()();
+					std::vector<Integer> e(randv.size());
+					e = *_tab_it;
+					Integer z;
+					dot(z,D, e, randv);
+					Integer prev_residue_ = EarlySingleCRA<Domain>::residue_;
+					EarlySingleCRA<Domain>::progress(D,z);
+					if (prev_residue_ == EarlySingleCRA<Domain>::residue_ )
+						EarlySingleCRA<Domain>::occurency_ = EarlySingleCRA<Domain>::occurency_ +  (shelf - prev_shelf);
+					if ( EarlySingleCRA<Domain>::terminated() ) {
+						return true;
+					}
+					prev_shelf = shelf;
+				}
+			}
+			return false;
+		}
 
 	protected:
-        
+
+		/*! @bug why a dot product here ?
+		 */
+		template <template<class T> class Vect1, class Vect2>
+		Integer& dot (Integer& z, const Integer& D, const Vect1<Integer>& v1, const Vect2& v2)
+		{
+			z = 0;
+			typename Vect1<Integer>::const_iterator v1_p;
+			typename Vect2::const_iterator v2_p;
+			for (v1_p  = v1. begin(), v2_p = v2. begin(); v1_p != v1. end(); ++ v1_p, ++ v2_p) {
+				z = (z + (*v1_p)*(*v2_p))%D;
+			}
+			return z;
+		}
+
+		/*! @bug why a dot product here ?
+		 */
 		template <template <class> class Alloc, template<class, class> class Vect1, class Vect2>
-		DomainElement& dot (DomainElement& z, const Domain& D, 
+		DomainElement& dot (DomainElement& z, const Domain& D,
 				    const Vect1<DomainElement, Alloc<DomainElement> >& v1,
-				    const Vect2& v2) {
-            
+				    const Vect2& v2)
+		{
+
 			D.init(z,0); DomainElement tmp;
 			typename Vect1<DomainElement, Alloc<DomainElement> >::const_iterator v1_p;
 			typename Vect2::const_iterator v2_p;
-			for (v1_p  = v1. begin(), v2_p = v2. begin(); 
-			     v1_p != v1. end(); 
-			     ++ v1_p, ++ v2_p)       
+			for (v1_p  = v1. begin(), v2_p = v2. begin();
+			     v1_p != v1. end();
+			     ++ v1_p, ++ v2_p)
 				D.axpyin(z, (*v1_p), D.init(tmp, (*v2_p)));
-            
+
 			//             commentator.report(Commentator::LEVEL_ALWAYS, INTERNAL_DESCRIPTION) << "v: " << v2 << std::endl;
 			//             commentator.report(Commentator::LEVEL_ALWAYS, INTERNAL_DESCRIPTION) << "z: " << z << std::endl;
 			return z;
 		}
 	};
 }
-#endif
+#endif //__LINBOX_cra_early_multip_H
 
diff --git a/linbox/algorithms/cra-early-single.h b/linbox/algorithms/cra-early-single.h
index e78705c..c8e15d7 100644
--- a/linbox/algorithms/cra-early-single.h
+++ b/linbox/algorithms/cra-early-single.h
@@ -1,109 +1,290 @@
-// ======================================================================= //
-// Time-stamp: <15 Mar 07 17:04:48 Jean-Guillaume.Dumas at imag.fr> 
-// ======================================================================= //
-#ifndef __LINBOX_CRA_EARLY_SINGLE_H
-#define __LINBOX_CRA_EARLY_SINGLE_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
+/* Copyright (C) 2007 LinBox
+ * written by JG Dumas
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*! @file algorithms/cra-early-single.h
+ * @ingroup algorithms
+ * @brief NO DOC
+ */
+
+
+#ifndef __LINBOX_cra_early_single_H
+#define __LINBOX_cra_early_single_H
 
 #include "linbox/util/timer.h"
 #include <stdlib.h>
 #include "linbox/integer.h"
 #include "linbox/solutions/methods.h"
+#include "linbox/algorithms/cra-domain.h"
 #include <vector>
 #include <utility>
 
-namespace LinBox {
-    
-    template<class Domain_Type>
-    struct EarlySingleCRA {
-        typedef Domain_Type			Domain;
-        typedef typename Domain::Element DomainElement;
-        typedef EarlySingleCRA<Domain> Self_t;
-
-    protected:
-            // PrimeProd*nextM_ is the modulus
-        Integer 	primeProd_;
-        Integer		nextM_;
-        Integer 	residue_; 	// remainder to be reconstructed
-        unsigned int    occurency_;	// number of equalities
-        
-        const unsigned int    EARLY_TERM_THRESHOLD;
-      
-
-    public:
-
-        EarlySingleCRA(const unsigned long EARLY=DEFAULT_EARLY_TERM_THRESHOLD)
-                : primeProd_(1UL), nextM_(1UL), occurency_(0), EARLY_TERM_THRESHOLD(EARLY-1) {
-        }
-
-//         EarlySingleCRA(const Self_t& c) 
-//                 : primeProd_(c.primeProd_),
-//                   nextM_(c.nextM_),
-//                   residue_(c.residue_),
-//                   occurency_(c.occurency_), 
-//                   EARLY_TERM_THRESHOLD(c.EARLY_TERM_THRESHOLD) {}
-        
-
-        virtual void initialize (const Domain& D, const DomainElement& e) {
-            D.characteristic( primeProd_ );
-            nextM_ = 1UL;
-            D.convert( residue_, e);
-            occurency_ = 1;
-        }
-
-        virtual Integer& result(Integer& d) {
-            return d=residue_;
-        }
-        
-        virtual bool terminated() {            
-            return occurency_>EARLY_TERM_THRESHOLD;
-        }
-
-        virtual void progress (const Domain& D, const DomainElement& e) {
-                // Precondition : initialize has been called once before
-            primeProd_ *= nextM_; 
-            D.characteristic( nextM_ );
-            
-            DomainElement u0;
-            if (D.areEqual( D.init(u0, residue_), e)) {
-                ++occurency_;
-            } else {
-                occurency_ = 1;
-                
-                D.negin(u0);       	// u0  <-- -u0
-                D.addin(u0, e);    	// u0  <-- e-u0
-                
-                DomainElement m0; 
-                D.init(m0, primeProd_);
-                D.invin(m0);       	// m0  <-- m0^{-1} mod nextM_
-                D.mulin(u0, m0);   	// u0  <-- (e-u0)( m0^{-1} mod nextM_ )
-                
-                Integer res;
-                D.convert(res, u0);	// res <-- (e-u0)( m0^{-1} mod nextM_ )		
-                    			// and res < nextM_ 
-                
-                Integer tmp(res);
-                tmp -= nextM_;
-                if (absCompare(res,tmp)>0) res = tmp; // Normalize
-                
-                res *= primeProd_;	// res <-- (e-u0)( m0^{-1} mod nextM_ ) m0	
-                    			// and res <= (m0.nextM_-m0)
-                
-                residue_ += res;	// <-- u0 + (e-u0)( m0^{-1} mod nextM_ ) m0
-					// and res <  m0.nextM_
-            }
-        }
-
-        virtual bool noncoprime(const Integer& i) const {
-            Integer g;
-            return ( (gcd(g, i, nextM_) != 1) || (gcd(g, i, primeProd_) != 1) );
-        }
-
-
-        virtual ~EarlySingleCRA() {}
-
-    };
-
-    
-}
+namespace LinBox
+{
+
+	/*!  @brief NO DOC
+	 * @ingroup CRA
+	 *
+	 */
+	template<class Domain_Type>
+	struct EarlySingleCRA {
+		typedef Domain_Type			Domain;
+		typedef typename Domain::Element DomainElement;
+		typedef EarlySingleCRA<Domain> Self_t;
+
+	protected:
+		// PrimeProd*nextM_ is the modulus
+		Integer 	primeProd_;
+		Integer		nextM_;
+		Integer 	residue_; 	// remainder to be reconstructed
+		unsigned int    occurency_;	// number of equalities
+
+		const unsigned int    EARLY_TERM_THRESHOLD;
+
+#ifdef CRATIMING
+		mutable Timer tInit, tIteration, tImaging, tIRecon, tOther;
+		mutable CRATimer totalTime;
+#endif
+
+	public:
+
+		EarlySingleCRA(const unsigned long EARLY=DEFAULT_EARLY_TERM_THRESHOLD) :
+			primeProd_(1UL), nextM_(1UL), occurency_(0), EARLY_TERM_THRESHOLD(EARLY-1)
+		{
+#ifdef CRATIMING
+			clearTimers();
+			totalTime.clear();
+#endif
+		}
+
+#if 0
+		EarlySingleCRA(const Self_t& c) :
+			primeProd_(c.primeProd_),
+			nextM_(c.nextM_),
+			residue_(c.residue_),
+			occurency_(c.occurency_),
+			EARLY_TERM_THRESHOLD(c.EARLY_TERM_THRESHOLD)
+		{}
+#endif
+
+		virtual void initialize (const Integer& D, const Integer& e)
+		{
+#ifdef CRATIMING
+			tInit.clear();
+			tInit.start();
+#endif
+			primeProd_ = D;
+			nextM_ = 1UL;
+			residue_ = e;
+			occurency_ = 1;
+#ifdef CRATIMING
+			tInit.stop();
+			totalTime.ttInit += tInit;
+#endif
+		}
+
+		virtual void initialize (const Domain& D, const DomainElement& e)
+		{
+#ifdef CRATIMING
+			tInit.clear();
+			tInit.start();
+#endif
+			D.characteristic( primeProd_ );
+			nextM_ = 1UL;
+			D.convert( residue_, e);
+			occurency_ = 1;
+#ifdef CRATIMING
+			tInit.stop();
+			totalTime.ttInit += tInit;
+#endif
+		}
+
+		virtual Integer& result(Integer& d)
+		{
+			return d=residue_;
+		}
+
+		// virtual Integer& result(Integer& n, Integer& d) = 0 ; // rational pure virtual
+
+		virtual Integer& getResidue(Integer& r )
+		{
+			return r= residue_;
+		}
+
+		virtual Integer& getModulus(Integer& m)
+		{
+
+#ifdef CRATIMING
+			tOther.clear();
+			tOther.start();
+#endif
+			m = primeProd_ * nextM_;
+#ifdef CRATIMING
+			tOther.stop();
+			totalTime.ttOther += tOther;
 #endif
+			return m;
+		}
+
+		virtual bool terminated()
+		{
+			return occurency_>EARLY_TERM_THRESHOLD;
+		}
+
+		virtual void progress (const Integer& D, const Integer& e)
+		{
+			// Precondition : initialize has been called once before
+			// linbox_check(occurency_ > 0);
+#ifdef CRATIMING
+			tIRecon.clear();
+			tIRecon.start();
+#endif
+			primeProd_ *= nextM_;
+			nextM_ =D;
+			Integer u0 = residue_ % D;//0
+			Integer u1 = e % D;//e
+			Integer m0 = primeProd_;//1
+			if (u0 == u1) {
+				++occurency_;
+			}
+			else {
+				occurency_ = 1;
+				inv(m0, m0, D); // res <-- m0^{-1} mod m1//1
+				u0 = u1 - u0;           // tmp <-- (u1-u0)//e
+				u0 *= m0;       // res <-- (u1-u0)( m0^{-1} mod m1 )//e
+				u0 %= D;
+				Integer tmp(u0);//e
+				if (u0 < 0)
+					tmp += D;//e+D
+				else
+					tmp -= D;//e-D
+				if (absCompare(u0,tmp) > 0) u0 = tmp;
+				u0 *= primeProd_;          // res <-- (u1-u0)( m0^{-1} mod m1 ) m0       and res <= (m0m1-m0)
+				residue_ += u0;   // res <-- u0 + (u1-u0)( m0^{-1} mod m1 ) m0  and res <  m0m1
+			}
+#ifdef CRATIMING
+			tIRecon.stop();
+			totalTime.ttIRecon += tIRecon;
+#endif
+		}
+
+		virtual void progress (const Domain& D, const DomainElement& e)
+		{
+			// Precondition : initialize has been called once before
+			// linbox_check(occurency_ > 0);
+#ifdef CRATIMING
+			tIRecon.clear();
+			tIRecon.start();
+#endif
+			primeProd_ *= nextM_;
+			D.characteristic( nextM_ );
+
+			DomainElement u0;
+			if (D.areEqual( D.init(u0, residue_), e)) {
+				++occurency_;
+			}
+			else {
+				occurency_ = 1;
+
+				D.negin(u0);       	// u0  <-- -u0
+				D.addin(u0, e);    	// u0  <-- e-u0
+
+				DomainElement m0;
+				D.init(m0, primeProd_);
+				D.invin(m0);       	// m0  <-- m0^{-1} mod nextM_
+				D.mulin(u0, m0);   	// u0  <-- (e-u0)( m0^{-1} mod nextM_ )
+
+				Integer res;
+				D.convert(res, u0);	// res <-- (e-u0)( m0^{-1} mod nextM_ )
+				// and res < nextM_
+
+				Integer tmp(res);
+				tmp -= nextM_;
+				if (absCompare(res,tmp)>0) res = tmp; // Normalize
+
+				res *= primeProd_;	// res <-- (e-u0)( m0^{-1} mod nextM_ ) m0
+				// and res <= (m0.nextM_-m0)
+
+				residue_ += res;	// <-- u0 + (e-u0)( m0^{-1} mod nextM_ ) m0
+				// and res <  m0.nextM_
+			}
+#ifdef CRATIMING
+			tIRecon.stop();
+			totalTime.ttIRecon += tIRecon;
+#endif
+		}
+
+		virtual bool noncoprime(const Integer& i) const
+		{
+			Integer g;
+			return ( (gcd(g, i, nextM_) != 1) || (gcd(g, i, primeProd_) != 1) );
+		}
+
+
+		virtual ~EarlySingleCRA() {}
+
+#ifdef CRATIMING
+		void clearTimers() const
+		{
+			tInit.clear();
+			//tIteration.clear();
+			//tImaging.clear();
+			tIRecon.clear();
+			tOther.clear();
+		}
+	public:
+		virtual inline std::ostream& printTime(const Timer& timer, const char* title, std::ostream& os, const char* pref = "") const
+		{
+			if (timer.count() > 0) {
+				os << pref << title;
+				for (int i=strlen(title)+strlen(pref); i<28; i++)
+					os << ' ';
+				return os << timer << std::endl;
+			}
+			else
+				return os;
+		}
+
+		virtual inline std::ostream& printCRATime(const CRATimer& timer, const char* title, std::ostream& os) const
+		{
+			printTime(timer.ttInit, "Init", os, title);
+			//printTime(timer.ttImaging, "Imaging", os, title);
+			//printTime(timer.ttIteration, "Iteration", os, title);
+			printTime(timer.ttIRecon, "Integer reconstruction", os, title);
+			printTime(timer.ttOther, "Other", os, title);
+			return os;
+		}
+
+		virtual std::ostream& reportTimes(std::ostream& os) const
+		{
+			printCRATime(totalTime, "CRA Time", os);
+			return os;
+		}
+#endif
+
+	};
+
+
+}
+
+#endif //__LINBOX_cra_early_single_H
 
diff --git a/linbox/algorithms/cra-full-multip-fixed.h b/linbox/algorithms/cra-full-multip-fixed.h
new file mode 100644
index 0000000..3d33ea3
--- /dev/null
+++ b/linbox/algorithms/cra-full-multip-fixed.h
@@ -0,0 +1,545 @@
+/* -*- 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
+/* Copyright (C) 2010 LinBox
+ * Written by <Jean-Guillaume.Dumas at imag.fr>
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*! @file algorithms/cra-full-multip-fixed.h
+ * @ingroup algorithms
+ * @brief CRA for multi-residues.
+ *
+ * An upper bound is given on the size of the data to reconstruct.
+ */
+
+#ifndef __LINBOX_cra_full_multip_fixed_H
+#define __LINBOX_cra_full_multip_fixed_H
+
+#include "linbox/util/timer.h"
+#include <stdlib.h>
+#include "linbox/integer.h"
+#include "linbox/solutions/methods.h"
+#include <vector>
+#include <utility>
+
+#include "linbox/algorithms/lazy-product.h"
+#include "linbox/algorithms/cra-full-multip.h"
+
+
+namespace LinBox
+{
+
+
+
+	/*! @ingroup CRA
+	 * @brief Chinese Remaindering Algorithm for multiple residues.
+	 * An upper bound is given on the size of the data to reconstruct.
+	 */
+	template<class Domain_Type>
+	struct FullMultipFixedCRA : FullMultipCRA<Domain_Type> {
+		typedef Domain_Type			Domain;
+		typedef typename Domain::Element 	DomainElement;
+		typedef FullMultipFixedCRA<Domain> 	Self_t;
+
+		typedef std::vector<double>::iterator        DoubleVect_Iterator ;
+		typedef std::vector< bool >::iterator          BoolVect_Iterator ;
+		typedef std::vector< LazyProduct >::iterator   LazyVect_Iterator ;
+		typedef std::vector< Integer >                           IntVect ;
+		typedef IntVect::iterator                       IntVect_Iterator ;
+		typedef std::vector< IntVect >::iterator    IntVectVect_Iterator ;
+		typedef IntVect::const_iterator            IntVect_ConstIterator ;
+
+	protected:
+		const size_t				size;
+
+	private :
+		/*! \internal
+		 *  Intialize the Radix ladder.
+		 */
+		void _initialize ()
+		{
+			this->RadixSizes_.resize(1);
+			this->RadixPrimeProd_.resize(1);
+			this->RadixResidues_.resize(1);
+			this->RadixOccupancy_.resize(1);
+			this->RadixOccupancy_.front() = false;
+		}
+
+	public:
+		/*! Constructor.
+		 * @param p is a pair such that
+		 * - \c p.first is the size of a residue (ie. it would be 1 for \"FullSingle\")
+		 * - \c p.second is the theoretical upperbound (natural logarithm) on the size of the integers to reconstruct.
+		 * .
+		 */
+		FullMultipFixedCRA(const std::pair<size_t,double>& p ) :
+		       	FullMultipCRA<Domain>(p.second), size(p.first)
+	       	{
+		       	this->_initialize();
+		}
+
+		/*! Intialize to the first residue/prime.
+		 * @param D domain
+		 * @param e iterator on the first residue
+		 * @pre any CRA should first call \c initialize before \c progress
+		 */
+		template<class Iterator>
+		void initialize (const Domain& D, Iterator& e)
+		{
+			this->_initialize();
+			this->progress(D, e);
+		}
+
+		/*! Add a new residue (ie take into account a new prime).
+		 * @param D domain
+		 * @param e iterator for the new residue, for instance, a
+		 * <code>std::vector<T>::iterator</code>.
+		 */
+		template<class Iterator>
+		void progress (const Domain& D, Iterator& e)
+		{
+			// Radix shelves
+			DoubleVect_Iterator  _dsz_it = this->RadixSizes_.begin();
+			LazyVect_Iterator    _mod_it = this->RadixPrimeProd_.begin();
+			IntVectVect_Iterator _tab_it = this->RadixResidues_.begin();
+			BoolVect_Iterator    _occ_it = this->RadixOccupancy_.begin();
+
+			IntVect ri(this->size);
+			LazyProduct mi;
+			double di;
+			if (*_occ_it) {
+				// If lower shelf is occupied
+				// Combine it with the new residue
+				// The for loop will transmit the resulting
+				// combination to the upper shelf
+				Iterator e_it = e;
+				IntVect_Iterator       ri_it = ri.begin();
+				IntVect_ConstIterator  t0_it = _tab_it->begin();
+
+				DomainElement invP0;
+				this->precomputeInvP0(invP0, D, _mod_it->operator()() );
+
+				for( ; ri_it != ri.end(); ++e_it, ++ri_it, ++ t0_it){
+					this->fieldreconstruct(*ri_it, D, *e_it, *t0_it, invP0,
+							       (*_mod_it).operator()() );
+				}
+				Integer tmp;
+				D.characteristic(tmp);
+				double ltp = ::Givaro::naturallog(tmp);
+				di = *_dsz_it + ltp;
+				this->totalsize += ltp;
+				mi.mulin(tmp);
+				mi.mulin(*_mod_it);
+				*_occ_it = false;
+			}
+			else {
+				// Lower shelf is free
+				// Put the new residue here and exit
+				Integer tmp;
+				D.characteristic(tmp);
+				double ltp = ::Givaro::naturallog(tmp);
+				_mod_it->initialize(tmp);
+				*_dsz_it = ltp;
+				this->totalsize += ltp;
+				Iterator e_it = e;
+				_tab_it->resize(this->size);
+				IntVect_Iterator t0_it= _tab_it->begin();
+				for( ; t0_it != _tab_it->end(); ++e_it, ++ t0_it){
+					D.convert(*t0_it, *e_it);
+				}
+				*_occ_it = true;
+				return;
+			}
+
+			// We have a combination to put in the upper shelf
+			for(++_dsz_it, ++_mod_it, ++_tab_it, ++_occ_it ;
+			    _occ_it != this->RadixOccupancy_.end() ;
+			    ++_dsz_it, ++_mod_it, ++_tab_it, ++_occ_it) {
+				if (*_occ_it) {
+					// This shelf is occupied
+					// Combine it with the new combination
+					// The loop will try to put it on the upper shelf
+					IntVect_Iterator      ri_it = ri.begin();
+					IntVect_ConstIterator t_it  = _tab_it->begin();
+
+					Integer invprod;
+					this->precomputeInvProd(invprod, mi(), _mod_it->operator()());
+
+					for( ; ri_it != ri.end(); ++ri_it, ++ t_it)
+						this->smallbigreconstruct(*ri_it, *t_it, invprod);
+
+					// Product (lazy) computation
+					mi.mulin(*_mod_it);
+
+					// Moding out
+					for(ri_it = ri.begin() ; ri_it != ri.end(); ++ri_it) {
+						*ri_it %= mi();
+					}
+
+					di += *_dsz_it;
+					*_occ_it = false;
+				}
+				else {
+					// This shelf is free
+					// Put the new combination here and exit
+					*_dsz_it = di;
+					*_mod_it = mi;
+					*_tab_it = ri;
+					*_occ_it = true;
+					return;
+				}
+			}
+			// All the shelfves were occupied
+			// We create a new top shelf
+			// And put the new combination there
+			this->RadixSizes_.push_back( di );
+			this->RadixResidues_.push_back( ri );
+			this->RadixPrimeProd_.push_back( mi );
+			this->RadixOccupancy_.push_back ( true );
+		}
+
+		/*! Compute the result.
+		 * moves low occupied shelves up.
+		 * @param[out] d an iterator for the result.
+		 */
+		template<class Iterator>
+		Iterator& result (Iterator &d)
+		{
+			LazyVect_Iterator     _mod_it = this->RadixPrimeProd_.begin();
+			IntVectVect_Iterator  _tab_it = this->RadixResidues_.begin();
+			BoolVect_Iterator     _occ_it = this->RadixOccupancy_.begin();
+			LazyProduct Product;
+			// We have to find to lowest occupied shelf
+			for( ; _occ_it != this->RadixOccupancy_.end() ; ++_mod_it, ++_tab_it, ++_occ_it) {
+				if (*_occ_it) {
+					// Found the lowest occupied shelf
+					Product = *_mod_it;
+					Iterator t0_it = d;
+					IntVect_Iterator t_it = _tab_it->begin();
+					if (++_occ_it == this->RadixOccupancy_.end()) {
+						// It is the only shelf of the radix
+						// We normalize the result and output it
+						for( ; t_it != _tab_it->end(); ++t0_it, ++t_it)
+							normalize(*t0_it = *t_it, *t_it,
+								  _mod_it->operator()());
+						this->RadixPrimeProd_.resize(1);
+						return d;
+					}
+					else {
+						// There are other shelves
+						// The result is initialized with this shelf
+						// The for loop will combine the other shelves m with the actual one
+						for( ; t_it != _tab_it->end(); ++t0_it, ++t_it)
+							*t0_it  = *t_it;
+						++_mod_it; ++_tab_it;
+						break;
+					}
+				}
+			}
+			for( ; _occ_it != this->RadixOccupancy_.end() ; ++_mod_it, ++_tab_it, ++_occ_it) {
+				if (*_occ_it) {
+					// This shelf is occupied
+					// We need to combine it with the actual value of the result
+					Iterator t0_it = d;
+					IntVect_ConstIterator t_it = _tab_it->begin();
+
+					Integer invprod;
+					this->precomputeInvProd(invprod, Product(), _mod_it->operator()() );
+
+					for( ; t_it != _tab_it->end(); ++t0_it, ++t_it)
+						this->smallbigreconstruct(*t0_it, *t_it, invprod);
+
+					// Overall product computation
+					Product.mulin(*_mod_it);
+
+					// Moding out and normalization
+					t0_it = d;
+					for(size_t i=0;i<this->size; ++i, ++t0_it) {
+						*t0_it %= Product();
+						Integer tmp(*t0_it);
+						this->normalize(*t0_it, tmp, Product());
+					}
+
+				}
+			}
+
+			// We put it also the final prime product in the first shelf of products
+			// JGD : should we also put the result
+			//       in the first shelf of residues and resize it to 1
+			//       and set to true the first occupancy and resize it to 1
+			//       in case result is not the last call (more progress to go) ?
+			this->RadixPrimeProd_.resize(1);
+			this->RadixPrimeProd_.front() = Product;
+			return d;
+		}
+
+	};
+
+}
+
+namespace LinBox
+{
+	/*! NO DOC..
+	 * @ingroup CRA
+	 * Version of LinBox::FullMultipCRA for matrices.
+	 */
+	template<class Domain_Type>
+	struct FullMultipBlasMatCRA : FullMultipCRA<Domain_Type> {
+		typedef Domain_Type			Domain;
+		typedef typename Domain::Element 	DomainElement;
+		typedef FullMultipBlasMatCRA<Domain> 	Self_t;
+
+		typedef std::vector<double>::iterator        DoubleVect_Iterator ;
+		typedef std::vector< bool >::iterator          BoolVect_Iterator ;
+		typedef std::vector< LazyProduct >::iterator   LazyVect_Iterator ;
+		typedef std::vector< Integer >                           IntVect ;
+		typedef IntVect::iterator                       IntVect_Iterator ;
+		typedef std::vector< IntVect >::iterator    IntVectVect_Iterator ;
+		typedef IntVect::const_iterator            IntVect_ConstIterator ;
+
+	protected:
+		const size_t				size;
+
+	private :
+		/*! \internal
+		 *  Intialize the Radix ladder.
+		 */
+		void _initialize ()
+		{
+			this->RadixSizes_.resize(1);
+			this->RadixPrimeProd_.resize(1);
+			this->RadixResidues_.resize(1);
+			this->RadixOccupancy_.resize(1);
+			this->RadixOccupancy_.front() = false;
+		}
+
+	public:
+		/*! Constructor.
+		 * @param p is a pair such that
+		 * - \c p.first is the size of a residue, it would be 1 for \"FullSingle\"
+		 * - \c p.second is the theoretical upperbound (natural logarithm) on the size of the integers to reconstruct.
+		 * .
+		 */
+		FullMultipBlasMatCRA(const std::pair<size_t,double>& p ) :
+		       	FullMultipCRA<Domain>(p.second), size(p.first)
+		{ }
+
+		/*! Intialize to the first residue/prime.
+		 * @param D domain
+		 * @param e
+		 * @pre any CRA should first call \c initialize before \c progress
+		 */
+		template<class Matrix>
+		void initialize (const Domain& D, Matrix& e)
+		{
+			this->_initialize();
+			this->progress(D, e);
+		}
+
+		/*! Add a new residue (ie take into account a new prime).
+		 * @param D domain
+		 * @param e
+		 */
+		template<class Matrix>
+		void progress (const Domain& D, Matrix& e)
+		{
+			// Radix shelves
+			DoubleVect_Iterator  _dsz_it = this->RadixSizes_.begin();
+			LazyVect_Iterator    _mod_it = this->RadixPrimeProd_.begin();
+			IntVectVect_Iterator _tab_it = this->RadixResidues_.begin();
+			BoolVect_Iterator    _occ_it = this->RadixOccupancy_.begin();
+
+			IntVect ri(this->size);
+			LazyProduct mi;
+			double di;
+			if (*_occ_it) {
+				// If lower shelf is occupied
+				// Combine it with the new residue
+				// The for loop will transmit the resulting
+				// combination to the upper shelf
+				typename Matrix::RawIterator e_it = e.rawBegin();
+				IntVect_Iterator            ri_it = ri.begin();
+				IntVect_ConstIterator       t0_it = _tab_it->begin();
+
+				DomainElement invP0;
+			       	this->precomputeInvP0(invP0, D, _mod_it->operator()() );
+
+				for( ; ri_it != ri.end(); ++e_it, ++ri_it, ++ t0_it){
+					this->fieldreconstruct(*ri_it, D, *e_it, *t0_it, invP0,
+							       (*_mod_it).operator()() );
+				}
+				Integer tmp;
+				D.characteristic(tmp);
+				double ltp = ::Givaro::naturallog(tmp);
+				di = *_dsz_it + ltp;
+				this->totalsize += ltp;
+				mi.mulin(tmp);
+				mi.mulin(*_mod_it);
+				*_occ_it = false;
+			}
+			else {
+				// Lower shelf is free
+				// Put the new residue here and exit
+				Integer tmp;
+				D.characteristic(tmp);
+				double ltp = ::Givaro::naturallog(tmp);
+				_mod_it->initialize(tmp);
+				*_dsz_it = ltp;
+				this->totalsize += ltp;
+				typename Matrix::RawIterator e_it = e.rawBegin();
+				_tab_it->resize(this->size);
+				IntVect_Iterator t0_it= _tab_it->begin();
+				for( ; t0_it != _tab_it->end(); ++e_it, ++ t0_it){
+					D.convert(*t0_it, *e_it);
+				}
+				*_occ_it = true;
+				return;
+			}
+
+			// We have a combination to put in the upper shelf
+			for(++_dsz_it, ++_mod_it, ++_tab_it, ++_occ_it ;
+			    _occ_it != this->RadixOccupancy_.end() ;
+			    ++_dsz_it, ++_mod_it, ++_tab_it, ++_occ_it) {
+				if (*_occ_it) {
+					// This shelf is occupied
+					// Combine it with the new combination
+					// The loop will try to put it on the upper shelf
+					IntVect_Iterator      ri_it = ri.begin();
+					IntVect_ConstIterator t_it  = _tab_it->begin();
+
+					Integer invprod;
+					this->precomputeInvProd(invprod, mi(), _mod_it->operator()());
+
+					for( ; ri_it != ri.end(); ++ri_it, ++ t_it)
+						this->smallbigreconstruct(*ri_it, *t_it, invprod);
+
+					// Product (lazy) computation
+					mi.mulin(*_mod_it);
+
+					// Moding out
+					for(ri_it = ri.begin() ; ri_it != ri.end(); ++ri_it) {
+						*ri_it %= mi();
+					}
+
+					di += *_dsz_it;
+					*_occ_it = false;
+				}
+				else {
+					// This shelf is free
+					// Put the new combination here and exit
+					*_dsz_it = di;
+					*_mod_it = mi;
+					*_tab_it = ri;
+					*_occ_it = true;
+					return;
+				}
+			}
+			// All the shelfves were occupied
+			// We create a new top shelf
+			// And put the new combination there
+			this->RadixSizes_.push_back( di );
+			this->RadixResidues_.push_back( ri );
+			this->RadixPrimeProd_.push_back( mi );
+			this->RadixOccupancy_.push_back ( true );
+		}
+
+		/*! Compute the result.
+		 * moves low occupied shelves up.
+		 * @param[out] d
+		 */
+		template<class Matrix>
+		Matrix& result (Matrix &d)
+		{
+			LazyVect_Iterator     _mod_it = this->RadixPrimeProd_.begin();
+			IntVectVect_Iterator  _tab_it = this->RadixResidues_.begin();
+			BoolVect_Iterator     _occ_it = this->RadixOccupancy_.begin();
+			LazyProduct Product;
+			size_t _j=0;
+			// We have to find to lowest occupied shelf
+			for( ; _occ_it != this->RadixOccupancy_.end() ; ++_mod_it, ++_tab_it, ++_occ_it) {
+				++_j;
+				if (*_occ_it) {
+					// Found the lowest occupied shelf
+					Product = *_mod_it;
+					typename Matrix::RawIterator t0_it = d.rawBegin();
+					IntVect_Iterator t_it = _tab_it->begin();
+					if (++_occ_it == this->RadixOccupancy_.end()) {
+						// It is the only shelf of the radix
+						// We normalize the result and output it
+						for( ; t_it != _tab_it->end(); ++t0_it, ++t_it)
+							normalize(*t0_it = *t_it, *t_it,
+								  _mod_it->operator()());
+						this->RadixPrimeProd_.resize(1);
+						return d;
+					}
+					else {
+						// There are other shelves
+						// The result is initialized with this shelf
+						// The for loop will combine the other shelves m with the actual one
+						for( ; t_it != _tab_it->end(); ++t0_it, ++t_it)
+							*t0_it  = *t_it;
+						++_mod_it; ++_tab_it;
+						break;
+					}
+				}
+			}
+			for( ; _occ_it != this->RadixOccupancy_.end() ; ++_mod_it, ++_tab_it, ++_occ_it) {
+				++_j;
+				if (*_occ_it) {
+					// This shelf is occupied
+					// We need to combine it with the actual value of the result
+					typename Matrix::RawIterator t0_it = d.rawBegin();
+					IntVect_ConstIterator t_it = _tab_it->begin();
+
+					Integer invprod;
+					this->precomputeInvProd(invprod, Product(), _mod_it->operator()() );
+
+					for( ; t_it != _tab_it->end(); ++t0_it, ++t_it)
+						this->smallbigreconstruct(*t0_it, *t_it, invprod);
+
+					// Overall product computation
+					Product.mulin(*_mod_it);
+
+					// Moding out and normalization
+					t0_it = d.rawBegin();
+					for(size_t i=0;i<this->size; ++i, ++t0_it) {
+						*t0_it %= Product();
+						Integer tmp(*t0_it);
+						this->normalize(*t0_it, tmp, Product());
+					}
+
+				}
+			}
+
+			// We put it also the final prime product in the first shelf of products
+			// JGD : should we also put the result
+			//       in the first shelf of residues and resize it to 1
+			//       and set to true the first occupancy and resize it to 1
+			//       in case result is not the last call (more progress to go) ?
+			this->RadixPrimeProd_.resize(1);
+			this->RadixPrimeProd_.front() = Product;
+			return d;
+		}
+
+	};
+
+}
+
+#endif //__LINBOX_cra_full_multip_fixed_H
+
diff --git a/linbox/algorithms/cra-full-multip.h b/linbox/algorithms/cra-full-multip.h
index 4aca328..7c99a2b 100644
--- a/linbox/algorithms/cra-full-multip.h
+++ b/linbox/algorithms/cra-full-multip.h
@@ -1,9 +1,33 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-// ======================================================================= //
-// Time-stamp: <23 Apr 08 19:28:37 Jean-Guillaume.Dumas at imag.fr> 
-// ======================================================================= //
-#ifndef __LINBOX_CRA_FULL_MULTIP_H
-#define __LINBOX_CRA_FULL_MULTIP_H
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* linbox/algorithms/cra-full-multip.h
+ * Copyright (C) 1999-2010 The LinBox group
+ *
+ * Time-stamp: <15 Dec 10 15:54:00 Jean-Guillaume.Dumas at imag.fr>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*!@file algorithms/cra-full-multip.h
+ * @ingroup algorithms
+ * @brief NO DOC
+ */
+
+#ifndef __LINBOX_cra_full_multip_H
+#define __LINBOX_cra_full_multip_H
 
 #include "linbox/util/timer.h"
 #include <stdlib.h>
@@ -14,260 +38,384 @@
 
 #include "linbox/algorithms/lazy-product.h"
 
-namespace LinBox {
-    
-template<class Domain_Type>
-struct FullMultipCRA {
-	typedef Domain_Type			Domain;
-	typedef typename Domain::Element DomainElement;
-	typedef FullMultipCRA<Domain> 		Self_t;
-	
-protected:
-	std::vector< double >           	RadixSizes_;
-	std::vector< LazyProduct >      	RadixPrimeProd_;
-	std::vector< std::vector<Integer> >    	RadixResidues_;
-	std::vector< bool >             	RadixOccupancy_;
-	double                			LOGARITHMIC_UPPER_BOUND;
-	
-	
-public:
-	FullMultipCRA(const double b=0.0) : LOGARITHMIC_UPPER_BOUND(b) {}
-        
-	template< template<class, class> class Vect, template <class> class Alloc>
-	void initialize (const Domain& D, const Vect<DomainElement, Alloc<DomainElement> >& e) {
-		RadixSizes_.resize(1);
-		RadixPrimeProd_.resize(1);
-		RadixResidues_.resize(1);
-		RadixOccupancy_.resize(1); RadixOccupancy_.front() = false;
-		progress(D, e);
-	}
-        
-	template< template<class, class> class Vect, template <class> class Alloc>
-	void progress (const Domain& D, const Vect<DomainElement, Alloc<DomainElement> >& e) {
-		// Radix shelves
-		std::vector< double >::iterator  _dsz_it = RadixSizes_.begin();
-		std::vector< LazyProduct >::iterator _mod_it = RadixPrimeProd_.begin();
-		std::vector< std::vector<Integer> >::iterator _tab_it = RadixResidues_.begin();
-		std::vector< bool >::iterator    _occ_it = RadixOccupancy_.begin();
-		std::vector<Integer> ri(e.size()); LazyProduct mi; double di;
-		if (*_occ_it) {
-			// If lower shelf is occupied
-			// Combine it with the new residue
-			// The for loop will try to put the resulting combination on the upper shelf
-			typename Vect<DomainElement, Alloc<DomainElement> >::const_iterator  e_it = e.begin();
-			std::vector<Integer>::iterator       ri_it = ri.begin();
-			std::vector<Integer>::const_iterator t0_it = _tab_it->begin();
-			for( ; e_it != e.end(); ++e_it, ++ri_it, ++ t0_it)
-				fieldreconstruct(*ri_it, D, *e_it, *t0_it, (*_mod_it).operator()() );
-			Integer tmp; D.characteristic(tmp);
-			di = *_dsz_it + log(double(tmp)); 
-			mi.mulin(tmp);
-			mi.mulin(*_mod_it);
-			*_occ_it = false;
-		} else {
-			// Lower shelf is free
-			// Put the new residue here and exit
-			Integer tmp; D.characteristic(tmp);
-			_mod_it->initialize(tmp);
-			*_dsz_it = log(double(tmp));
-			typename Vect<DomainElement, Alloc<DomainElement> >::const_iterator e_it = e.begin();
+namespace LinBox
+{
+
+	/*! NO DOC...
+	 * @ingroup CRA
+	 * @bib
+	 * - Jean-Guillaume Dumas, Thierry Gautier et Jean-Louis Roch.  <i>Generic design
+	 * of Chinese remaindering schemes</i>  PASCO 2010, pp 26-34, 21-23 juillet,
+	 * Grenoble, France.
+	 */
+	template<class Domain_Type>
+	struct FullMultipCRA {
+		typedef Domain_Type			Domain;
+		typedef typename Domain::Element DomainElement;
+		typedef FullMultipCRA<Domain> 		Self_t;
+
+	protected:
+		std::vector< double >           	RadixSizes_;
+		std::vector< LazyProduct >      	RadixPrimeProd_;
+		std::vector< std::vector<Integer> >    	RadixResidues_;
+		std::vector< bool >             	RadixOccupancy_;
+		const double				LOGARITHMIC_UPPER_BOUND;
+		double					totalsize;
+
+	public:
+		// LOGARITHMIC_UPPER_BOUND is the natural logarithm
+		// of an upper bound on the resulting integers
+		FullMultipCRA(const double b=0.0) :
+			LOGARITHMIC_UPPER_BOUND(b), totalsize(0.0)
+		{}
+
+		Integer& getModulus(Integer& m)
+		{
+			std::vector<Integer> r; result(r);
+			return m=RadixPrimeProd_.back()();
+		}
+
+		template<template<class> class Vect>
+		Vect<Integer>& getResidue(Vect<Integer>& r)
+		{
+			result(r);
+			return r;
+		}
+
+		template<class Vect>
+		void initialize (const Integer& D, const Vect& e)
+		{
+			RadixSizes_.resize(1);
+			RadixPrimeProd_.resize(1);
+			RadixResidues_.resize(1);
+			RadixOccupancy_.resize(1); RadixOccupancy_.front() = false;
+			progress( D, e);
+#if 0
+			std::vector< double >::iterator  _dsz_it = RadixSizes_.begin();
+			std::vector< LazyProduct >::iterator _mod_it = RadixPrimeProd_.begin();
+			std::vector< std::vector<Integer> >::iterator _tab_it = RadixResidues_.begin();
+			std::vector< bool >::iterator    _occ_it = RadixOccupancy_.begin();
+			_mod_it->initialize(D);
+			*_dsz_it =  ::Givaro::naturallog(D);
+
+			typename Vect::const_iterator e_it = e.begin();
 			_tab_it->resize(e.size());
 			std::vector<Integer>::iterator t0_it= _tab_it->begin();
 			for( ; e_it != e.end(); ++e_it, ++ t0_it)
-				D.convert(*t0_it, *e_it);
+				*t0_it = *e_it;
 			*_occ_it = true;
+#endif
 			return;
 		}
-		
-		// We have a combination to put in the upper shelf
-		for(++_dsz_it, ++_mod_it, ++_tab_it, ++_occ_it ; _occ_it != RadixOccupancy_.end() ; ++_dsz_it, ++_mod_it, ++_tab_it, ++_occ_it) {
+
+		template< template<class, class> class Vect, template <class> class Alloc>
+		void initialize (const Domain& D, const Vect<DomainElement, Alloc<DomainElement> >& e)
+		{
+			RadixSizes_.resize(1);
+			RadixPrimeProd_.resize(1);
+			RadixResidues_.resize(1);
+			RadixOccupancy_.resize(1); RadixOccupancy_.front() = false;
+			progress(D, e);
+		}
+
+		/* Used in the case where D is a big Integer and Domain cannot be constructed */
+		// template<template<class T> class Vect>
+		template< template<class, class> class Vect, template <class> class Alloc>
+		void progress (const Integer& D, const Vect<Integer, Alloc<Integer> >& e)
+		{
+			std::vector< double >::iterator  _dsz_it = RadixSizes_.begin();
+			std::vector< LazyProduct >::iterator _mod_it = RadixPrimeProd_.begin();
+			std::vector< std::vector<Integer> >::iterator _tab_it = RadixResidues_.begin();
+			std::vector< bool >::iterator    _occ_it = RadixOccupancy_.begin();
+			std::vector<Integer> ri(e.size()); LazyProduct mi; double di;
 			if (*_occ_it) {
-				// This shelf is occupied
-				// Combine it with the new combination
-				// The loop will try to put it on the upper shelf
-				std::vector<Integer>::iterator      ri_it = ri.begin();
-				std::vector<Integer>::const_iterator t_it= _tab_it->begin();
-                                
-                                Integer invprod; precomputeInvProd(invprod, mi(), _mod_it->operator()());
-				for( ; ri_it != ri.end(); ++ri_it, ++ t_it) 
-                                    smallbigreconstruct(*ri_it, *t_it, invprod); 
-
-                                    // Product (lazy) computation
+				typename Vect<Integer,Alloc<Integer> >::const_iterator  e_it = e.begin();
+				std::vector<Integer>::iterator       ri_it = ri.begin();
+				std::vector<Integer>::const_iterator t0_it = _tab_it->begin();
+				Integer invprod; precomputeInvProd(invprod, D, _mod_it->operator()());
+				for( ; e_it != e.end(); ++e_it, ++ri_it, ++ t0_it) {
+					*ri_it =* e_it;
+					smallbigreconstruct(*ri_it,  *t0_it, invprod );
+				}
+				Integer tmp = D;
+				di = *_dsz_it + ::Givaro::naturallog(tmp);
+				mi.mulin(tmp);
 				mi.mulin(*_mod_it);
+				*_occ_it = false;
+			}
+			else {
+				Integer tmp = D;
+				_mod_it->initialize(tmp);
+				*_dsz_it = ::Givaro::naturallog(tmp);
+				typename Vect<Integer, Alloc<Integer> >::const_iterator e_it = e.begin();
+				_tab_it->resize(e.size());
+				std::vector<Integer>::iterator t0_it= _tab_it->begin();
+				for( ; e_it != e.end(); ++e_it, ++ t0_it)
+					*t0_it = *e_it;
+				*_occ_it = true;
+				return;
+			}
+			for(++_dsz_it, ++_mod_it, ++_tab_it, ++_occ_it ; _occ_it != RadixOccupancy_.end() ; ++_dsz_it, ++_mod_it, ++_tab_it, ++_occ_it) {
+				if (*_occ_it) {
+					std::vector<Integer>::iterator      ri_it = ri.begin();
+					std::vector<Integer>::const_iterator t_it= _tab_it->begin();
+					Integer invprod; precomputeInvProd(invprod, mi(), _mod_it->operator()());
+					for( ; ri_it != ri.end(); ++ri_it, ++ t_it)
+						smallbigreconstruct(*ri_it, *t_it, invprod);
+					mi.mulin(*_mod_it);
+					di += *_dsz_it;
+					*_occ_it = false;
+				}
+				else {
+					*_dsz_it = di;
+					*_mod_it = mi;
+					*_tab_it = ri;
+					*_occ_it = true;
+					return;
+				}
+			}
 
-                                    // Moding out
-                                for(ri_it = ri.begin() ; ri_it != ri.end(); ++ri_it) {
-                                    *ri_it %= mi();
-                                }
+			RadixSizes_.push_back( di );
+			RadixResidues_.push_back( ri );
+			RadixPrimeProd_.push_back( mi );
+			RadixOccupancy_.push_back ( true );
+		}
 
-				di += *_dsz_it;
+		template< template<class, class> class Vect, template <class> class Alloc>
+		void progress (const Domain& D, const Vect<DomainElement, Alloc<DomainElement> >& e)
+		{
+			// Radix shelves
+			std::vector< double >::iterator  _dsz_it = RadixSizes_.begin();
+			std::vector< LazyProduct >::iterator _mod_it = RadixPrimeProd_.begin();
+			std::vector< std::vector<Integer> >::iterator _tab_it = RadixResidues_.begin();
+			std::vector< bool >::iterator    _occ_it = RadixOccupancy_.begin();
+			std::vector<Integer> ri(e.size()); LazyProduct mi; double di;
+			if (*_occ_it) {
+				// If lower shelf is occupied
+				// Combine it with the new residue
+				// The for loop will try to put the resulting combination on the upper shelf
+				typename Vect<DomainElement, Alloc<DomainElement> >::const_iterator  e_it = e.begin();
+				std::vector<Integer>::iterator       ri_it = ri.begin();
+				std::vector<Integer>::const_iterator t0_it = _tab_it->begin();
+				DomainElement invP0; precomputeInvP0(invP0, D, _mod_it->operator()() );
+				for( ; ri_it != ri.end(); ++e_it, ++ri_it, ++ t0_it)
+					fieldreconstruct(*ri_it, D, *e_it, *t0_it, invP0, (*_mod_it).operator()() );
+				Integer tmp; D.characteristic(tmp);
+				double ltp = ::Givaro::naturallog(tmp);
+				di = *_dsz_it + ltp;
+				totalsize += ltp;
+				mi.mulin(tmp);
+				mi.mulin(*_mod_it);
 				*_occ_it = false;
-			} else {
-				// This shelf is free
-				// Put the new combination here and exit
-				*_dsz_it = di;
-				*_mod_it = mi;
-				*_tab_it = ri;
+			}
+			else {
+				// Lower shelf is free
+				// Put the new residue here and exit
+				Integer tmp; D.characteristic(tmp);
+				double ltp =  ::Givaro::naturallog(tmp);
+				_mod_it->initialize(tmp);
+				*_dsz_it = ltp;
+				totalsize += ltp;
+				typename Vect<DomainElement, Alloc<DomainElement> >::const_iterator e_it = e.begin();
+				_tab_it->resize(e.size());
+				std::vector<Integer>::iterator t0_it= _tab_it->begin();
+				for( ; e_it != e.end(); ++e_it, ++ t0_it)
+					D.convert(*t0_it, *e_it);
 				*_occ_it = true;
 				return;
 			}
+
+			// We have a combination to put in the upper shelf
+			for(++_dsz_it, ++_mod_it, ++_tab_it, ++_occ_it ; _occ_it != RadixOccupancy_.end() ; ++_dsz_it, ++_mod_it, ++_tab_it, ++_occ_it) {
+				if (*_occ_it) {
+					// This shelf is occupied
+					// Combine it with the new combination
+					// The loop will try to put it on the upper shelf
+					std::vector<Integer>::iterator      ri_it = ri.begin();
+					std::vector<Integer>::const_iterator t_it= _tab_it->begin();
+
+					Integer invprod; precomputeInvProd(invprod, mi(), _mod_it->operator()());
+					for( ; ri_it != ri.end(); ++ri_it, ++ t_it)
+						smallbigreconstruct(*ri_it, *t_it, invprod);
+
+					// Product (lazy) computation
+					mi.mulin(*_mod_it);
+
+					// Moding out
+					for(ri_it = ri.begin() ; ri_it != ri.end(); ++ri_it) {
+						*ri_it %= mi();
+					}
+
+					di += *_dsz_it;
+					*_occ_it = false;
+				}
+				else {
+					// This shelf is free
+					// Put the new combination here and exit
+					*_dsz_it = di;
+					*_mod_it = mi;
+					*_tab_it = ri;
+					*_occ_it = true;
+					return;
+				}
+			}
+			// All the shelfves were occupied
+			// We create a new top shelf
+			// And put the new combination there
+			RadixSizes_.push_back( di );
+			RadixResidues_.push_back( ri );
+			RadixPrimeProd_.push_back( mi );
+			RadixOccupancy_.push_back ( true );
 		}
-		// All the shelfves were occupied
-		// We create a new top shelf 
-		// And put the new combination there
-		RadixSizes_.push_back( di );
-		RadixResidues_.push_back( ri );
-		RadixPrimeProd_.push_back( mi );
-		RadixOccupancy_.push_back ( true );
-	}
-	
-        
-	
-	template<template<class, class> class Vect, template <class> class Alloc>
-	Vect<Integer, Alloc<Integer> >& result (Vect<Integer, Alloc<Integer> > &d){
-		d.resize( (RadixResidues_.front()).size() );
-		std::vector< LazyProduct >::iterator          _mod_it = RadixPrimeProd_.begin();
-		std::vector< std::vector< Integer > >::iterator _tab_it = RadixResidues_.begin();
-		std::vector< bool >::iterator                _occ_it = RadixOccupancy_.begin();
-		LazyProduct Product;
-		// We have to find to lowest occupied shelf
-		for( ; _occ_it != RadixOccupancy_.end() ; ++_mod_it, ++_tab_it, ++_occ_it) {
-			if (*_occ_it) {
-				// Found the lowest occupied shelf
-				Product = *_mod_it;
-				std::vector<Integer>::iterator t0_it = d.begin();
-				std::vector<Integer>::iterator t_it = _tab_it->begin();
-				if (++_occ_it == RadixOccupancy_.end()) {
-					// It is the only shelf of the radix 
-					// We normalize the result and output it
-					for( ; t0_it != d.end(); ++t0_it, ++t_it)
-						normalize(*t0_it = *t_it, *t_it, _mod_it->operator()());
-					RadixPrimeProd_.resize(1);
-					return d;
-				} else {
-					// There are other shelves
-					// The result is initialized with this shelf
-					// The for loop will combine the other shelves m with the actual one
+
+		template<template<class, class> class Vect, template <class> class Alloc>
+		Vect<Integer, Alloc<Integer> >& result (Vect<Integer, Alloc<Integer> > &d)
+		{
+			d.resize( (RadixResidues_.front()).size() );
+			std::vector< LazyProduct >::iterator          _mod_it = RadixPrimeProd_.begin();
+			std::vector< std::vector< Integer > >::iterator _tab_it = RadixResidues_.begin();
+			std::vector< bool >::iterator                _occ_it = RadixOccupancy_.begin();
+			LazyProduct Product;
+			// We have to find to lowest occupied shelf
+			for( ; _occ_it != RadixOccupancy_.end() ; ++_mod_it, ++_tab_it, ++_occ_it) {
+				if (*_occ_it) {
+					// Found the lowest occupied shelf
+					Product = *_mod_it;
+					std::vector<Integer>::iterator t0_it = d.begin();
+					std::vector<Integer>::iterator t_it = _tab_it->begin();
+					if (++_occ_it == RadixOccupancy_.end()) {
+						// It is the only shelf of the radix
+						// We normalize the result and output it
+						for( ; t0_it != d.end(); ++t0_it, ++t_it)
+							normalize(*t0_it = *t_it, *t_it, _mod_it->operator()());
+						//RadixPrimeProd_.resize(1);
+						return d;
+					}
+					else {
+						// There are other shelves
+						// The result is initialized with this shelf
+						// The for loop will combine the other shelves m with the actual one
+						for( ; t0_it != d.end(); ++t0_it, ++t_it)
+							*t0_it  = *t_it;
+						++_mod_it; ++_tab_it;
+						break;
+					}
+				}
+			}
+			for( ; _occ_it != RadixOccupancy_.end() ; ++_mod_it, ++_tab_it, ++_occ_it) {
+				if (*_occ_it) {
+					// This shelf is occupied
+					// We need to combine it with the actual value of the result
+					std::vector<Integer>::iterator t0_it = d.begin();
+					std::vector<Integer>::const_iterator t_it = _tab_it->begin();
+					Integer invprod;
+					precomputeInvProd(invprod, Product(), _mod_it->operator()() );
+
 					for( ; t0_it != d.end(); ++t0_it, ++t_it)
-						*t0_it  = *t_it;
-					++_mod_it; ++_tab_it; 
-					break;
+						smallbigreconstruct(*t0_it, *t_it, invprod);
+
+					// Overall product computation
+					Product.mulin(*_mod_it);
+
+					// Moding out and normalization
+					for(t0_it = d.begin();t0_it != d.end(); ++t0_it) {
+						*t0_it %= Product();
+						Integer tmp(*t0_it);
+						normalize(*t0_it, tmp, Product());
+					}
+
 				}
 			}
+
+			// We put it also the final prime product in the first shelf of products
+			// JGD : should we also put the result
+			//       in the first shelf of residues and resize it to 1
+			//       and set to true the first occupancy and resize it to 1
+			//       in case result is not the last call (more progress to go) ?
+			RadixPrimeProd_.resize(1);
+			RadixPrimeProd_.front() = Product;
+			RadixSizes_.resize(1);
+			RadixSizes_.front() =  ::Givaro::naturallog(Product());
+			RadixResidues_.resize(1);
+			RadixResidues_.front() = d;
+			RadixOccupancy_.resize(1);
+			RadixOccupancy_.front() = true;
+
+			return d;
 		}
-		for( ; _occ_it != RadixOccupancy_.end() ; ++_mod_it, ++_tab_it, ++_occ_it) {
-			if (*_occ_it) {
-				// This shelf is occupied
-				// We need to combine it with the actual value of the result
-				std::vector<Integer>::iterator t0_it = d.begin();
-				std::vector<Integer>::const_iterator t_it = _tab_it->begin();
-                                Integer invprod; 
-                                precomputeInvProd(invprod, Product(), _mod_it->operator()() );
-
-				for( ; t0_it != d.end(); ++t0_it, ++t_it)
-                                    smallbigreconstruct(*t0_it, *t_it, invprod);
-                                
-                                    // Overall product computation
-				Product.mulin(*_mod_it);
-
-                                    // Moding out and normalization
-                                for(t0_it = d.begin();t0_it != d.end(); ++t0_it) {
-                                    *t0_it %= Product();
-                                    Integer tmp(*t0_it);
-                                    normalize(*t0_it, tmp, Product());
-                                }
-                                
-			}
+
+		bool terminated()
+		{
+			return totalsize > LOGARITHMIC_UPPER_BOUND;
 		}
 
-		// We put it also the final prime product in the first shelf of products
-		// JGD : should we also put the result 
-		//       in the first shelf of residues and resize it to 1
-		//       and set to true the first occupancy and resize it to 1
-		//       in case result is not the last call (more progress to go) ?
-		RadixPrimeProd_.resize(1);
-		RadixPrimeProd_.front() = Product;
-		return d;
-	}
-	
-	bool terminated() {
-		double logm(0.0);
-		std::vector< double >::iterator _dsz_it = RadixSizes_.begin();
-		std::vector< bool >::iterator _occ_it = RadixOccupancy_.begin();
-		for( ; _occ_it != RadixOccupancy_.end() ; ++_dsz_it, ++_occ_it) {
-			if (*_occ_it) {
-				logm = *_dsz_it;
-				++_dsz_it; ++_occ_it;
-				break;
-			}
+		bool noncoprime(const Integer& i) const
+		{
+			std::vector< LazyProduct >::const_iterator _mod_it = RadixPrimeProd_.begin();
+			std::vector< bool >::const_iterator    _occ_it = RadixOccupancy_.begin();
+			for( ; _occ_it != RadixOccupancy_.end() ; ++_mod_it, ++_occ_it)
+				if ((*_occ_it) && (_mod_it->noncoprime(i))) return true;
+			return false;
 		}
-		for( ; _occ_it != RadixOccupancy_.end() ; ++_dsz_it, ++_occ_it) {
-			if (*_occ_it) {
-				logm += *_dsz_it;
-			}
+
+
+
+	protected:
+
+		Integer& precomputeInvProd(Integer& res, const Integer& m1, const Integer& m0)
+		{
+			inv(res, m0, m1);
+			return res *= m0; // res <-- (m0^{-1} mod m1)*m0
+		}
+
+		DomainElement& precomputeInvP0(DomainElement& invP0, const Domain& D1, const Integer& P0)
+		{
+			return D1.invin( D1.init(invP0, P0) ); // res <-- (P0^{-1} mod m1)
+		}
+
+
+		Integer& smallbigreconstruct(Integer& u1, const Integer& u0, const Integer& invprod)
+		{
+			u1 -= u0;	  // u1 <-- (u1-u0)
+			u1 *= invprod;    // u1 <-- (u1-u0)( m0^{-1} mod m1 ) m0
+			return u1 += u0;  // u1 <-- u0 + (u1-u0)( m0^{-1} mod m1 ) m0
+		}
+
+
+		Integer& normalize(Integer& u1, Integer& tmp, const Integer& m1)
+		{
+			if (u1 < 0)
+				tmp += m1;
+			else
+				tmp -= m1;
+			return ((absCompare(u1,tmp) > 0)? u1 = tmp : u1 );
 		}
-		return logm > LOGARITHMIC_UPPER_BOUND;
-	}
-	
-	
-	
-	bool noncoprime(const Integer& i) const {
-		std::vector< LazyProduct >::const_iterator _mod_it = RadixPrimeProd_.begin();
-		std::vector< bool >::const_iterator    _occ_it = RadixOccupancy_.begin();
-		for( ; _occ_it != RadixOccupancy_.end() ; ++_mod_it, ++_occ_it)
-			if ((*_occ_it) && (_mod_it->noncoprime(i))) return true;
-		return false;
-	}
-	
-	
-
-	
-protected:
-	
-    Integer& precomputeInvProd(Integer& res, const Integer& m1, const Integer& m0) {
-        inv(res, m0, m1);
-        return res *= m0; // res <-- (m0^{-1} mod m1) m0
-    }
-
-    Integer& smallbigreconstruct(Integer& u1, const Integer& u0, const Integer& invprod) {
-        u1 -= u0;	  // u1 <-- (u1-u0)
-        u1 *= invprod;    // u1 <-- (u1-u0)( m0^{-1} mod m1 ) m0 
-        return u1 += u0;  // u1 <-- u0 + (u1-u0)( m0^{-1} mod m1 ) m0
-    }
-    
-        
-	Integer& normalize(Integer& u1, Integer& tmp, const Integer& m1) {
-		if (u1 < 0)
-			tmp += m1;
-		else
-			tmp -= m1;
-		return ((absCompare(u1,tmp) > 0)? u1 = tmp : u1 );
-	}
-	
-	
-	Integer& fieldreconstruct(Integer& res, const Domain& D1, const DomainElement& u1, const Integer& r0, const Integer& P0) {
-		DomainElement u0, m0; D1.init(u0, r0);
-		if (D1.areEqual(u1, u0))
-			return res=r0;
-		else
-			return fieldreconstruct(res, D1, u1, u0, D1.init(m0, P0), r0, P0);
-	}
-	
-	Integer& fieldreconstruct(Integer& res, const Domain& D1, const DomainElement& u1, DomainElement& u0, DomainElement& m0, const Integer& r0, const Integer& P0) {
-		// u0 and m0 are modified
-		D1.negin(u0);   	// u0 <-- -u0
-		D1.addin(u0,u1);   	// u0 <-- u1-u0
-		D1.invin(m0);   	// m0 <-- m0^{-1} mod m1
-		D1.mulin(u0, m0);   // u0 <-- (u1-u0)( m0^{-1} mod m1 )
-		D1.convert(res, u0);// res <-- (u1-u0)( m0^{-1} mod m1 )         and res <  m1
-		res *= P0;      	// res <-- (u1-u0)( m0^{-1} mod m1 ) m0      and res <= (m0m1-m0)
-		return res += r0;	// res <-- u0 + (u1-u0)( m0^{-1} mod m1 ) m0 and res <  m0m1
-	}
-	
-	
-};
-	
+
+
+		Integer& fieldreconstruct(Integer& res, const Domain& D1, const DomainElement& u1, const Integer& r0, const DomainElement& invP0, const Integer& P0)
+		{
+                    	// u0 = r0 mod m1
+			DomainElement u0; D1.init(u0, r0);
+			if (D1.areEqual(u1, u0))
+				return res=r0;
+			else
+				return fieldreconstruct(res, D1, u1, u0, r0, invP0, P0);
+		}
+
+		Integer& fieldreconstruct(Integer& res, const Domain& D1, const DomainElement& u1, DomainElement& u0, const Integer& r0, const DomainElement& invP0, const Integer& P0)
+		{
+			// u0 and m0 are modified
+			D1.negin(u0);   	// u0 <-- -u0
+			D1.addin(u0,u1);   	// u0 <-- u1-u0
+			D1.mulin(u0, invP0);    // u0 <-- (u1-u0)( m0^{-1} mod m1 )
+			D1.convert(res, u0);    // res <-- (u1-u0)( m0^{-1} mod m1 )         and res <  m1
+			res *= P0;      	// res <-- (u1-u0)( m0^{-1} mod m1 ) m0      and res <= (m0m1-m0)
+			return res += r0;	// res <-- u0 + (u1-u0)( m0^{-1} mod m1 ) m0 and res <  m0m1
+		}
+
+	};
+
 }
 
 
-#endif
+#endif //__LINBOX_cra_full_multip_H
diff --git a/linbox/algorithms/cra-givrnsfixed.h b/linbox/algorithms/cra-givrnsfixed.h
new file mode 100644
index 0000000..701f350
--- /dev/null
+++ b/linbox/algorithms/cra-givrnsfixed.h
@@ -0,0 +1,137 @@
+/* -*- 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
+/* linbox/algorithms/cra-full-multip.h
+ * Copyright (C) 1999-2010 The LinBox group
+ *
+ * Time-stamp: <05 Apr 11 10:49:43 Jean-Guillaume.Dumas at imag.fr>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*!@file algorithms/cra-givrnsfixed.h
+ * @ingroup algorithms
+ * @brief NO DOC
+ */
+
+#ifndef __LINBOX_cra_givrnsfix_H
+#define __LINBOX_cra_givrnsfix_H
+
+#include <stdlib.h>
+#include <givaro/givrnsfixed.h>
+
+namespace LinBox
+{
+
+	/*! NO DOC...
+	 * @ingroup CRA
+	 * @bib
+	 */
+	template<class Domain_Type>
+	struct GivaroRnsFixedCRA : public ::Givaro::RNSsystemFixed<integer> {
+		typedef Domain_Type			                      Domain;
+		typedef typename Domain::Element           DomainElement;
+
+		typedef ::Givaro::RNSsystemFixed<integer>			Father_t;
+		typedef GivaroRnsFixedCRA<Domain> 		          Self_t;
+
+		const size_t				nbloops;
+		size_t					iterationnumber;
+
+		std::vector< std::vector< integer > > 	residues;
+		integer _product;
+		integer _midprod;
+
+	public:
+		GivaroRnsFixedCRA(const std::vector<integer>& primes)
+				: Father_t(primes),
+				  nbloops(primes.size()),
+				  iterationnumber(0),
+				  _product(1)
+		{
+			for(size_t i=0; i<primes.size(); ++i)
+				_product *= primes[i];
+			::Givaro::Integer::div(_midprod,_product,2);
+		}
+
+		Integer& getModulus(Integer& m)
+		{
+			return m=_product;
+		}
+
+		template<template<class> class Vect>
+		Vect<Integer>& getResidue(Vect<Integer>& r)
+		{
+			return result(r);
+		}
+
+		template< template<class, class> class Vect, template <class> class Alloc>
+		void initialize (const Domain& D, const Vect<DomainElement, Alloc<DomainElement> >& e)
+		{
+			residues.resize(e.size());
+			this->progress(D,e);
+		}
+
+		template< template<class, class> class Vect, template <class> class Alloc>
+		void progress (const Domain& D, const Vect<DomainElement, Alloc<DomainElement> >& e)
+		{
+			++iterationnumber;
+			typename Vect<DomainElement, Alloc<DomainElement> >::const_iterator eit=e.begin();
+			std::vector<std::vector< Integer > >::iterator rit = residues.begin();
+
+			for( ; eit != e.end(); ++eit, ++rit) {
+				Integer tmp;
+				D.convert(tmp, *eit);
+				rit->push_back(tmp);
+			}
+
+		}
+
+		template<template<class, class> class Vect, template <class> class Alloc>
+		Vect<Integer, Alloc<Integer> >& result (Vect<Integer, Alloc<Integer> > &d)
+		{
+			d.resize(0);
+			for(std::vector<std::vector< Integer > >::const_iterator rit = residues.begin(); rit != residues.end(); ++rit) {
+				Integer tmp;
+				RnsToRing(tmp, *rit);
+				linbox_check(tmp>=0);
+				linbox_check(tmp<_product);
+				if (tmp>_midprod)
+					tmp -= _product ;
+				linbox_check(tmp<=_midprod);
+				d.push_back(tmp);
+			}
+			return d;
+		}
+
+		bool terminated()
+		{
+			return iterationnumber >= nbloops;
+		}
+
+		bool noncoprime(const Integer& i) const
+		{
+			return false;
+		}
+
+
+
+
+	};
+
+}
+
+
+#endif //__LINBOX_cra_givrnsfix_H
diff --git a/linbox/algorithms/cra-kaapi.h b/linbox/algorithms/cra-kaapi.h
index c15ce82..06eca65 100644
--- a/linbox/algorithms/cra-kaapi.h
+++ b/linbox/algorithms/cra-kaapi.h
@@ -1,11 +1,35 @@
-/* -*- mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/* author: B. David Saunders and Zhendong Wan*/
-// parallelized for BOINC computing by Bryan Youse
-// ======================================================================= //
-// Time-stamp: <09 Feb 07 17:10:21 Jean-Guillaume.Dumas at imag.fr> 
-// ======================================================================= //
-#ifndef __LINBOX_CRA_KAAPI_H
-#define __LINBOX_CRA_KAAPI_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
+/* Copyright (C)  LinBox
+ * author: B. David Saunders and Zhendong Wan
+ * parallelized for BOINC computing by Bryan Youse
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*! @file algorithms/cra-kaapi.h
+ * @ingroup algorithms
+ * @ingroup CRA
+ * @brief NO DOC
+ */
+
+#ifndef __LINBOX_cra_kaapi_H
+#define __LINBOX_cra_kaapi_H
 
 #include <vector>
 #include <cstdlib>
@@ -17,129 +41,147 @@
 
 #include "linbox/kaapi/communicate.h"
 
-namespace LinBox {
-
-    /**************************************************************************************************
-     * CRA loop subroutine
-     * given a function and a prime, this returns the residue by applying given function
-     * this must be thread safe and communicable
-     * \param p Prime Integer
-     * \param f function used to compute residue
-     * \return the residue
-     */
-    template<class Function, class Domain >
-    struct Residue {
-
-        Function *_f;
-        Residue(): _f(0) {}
-        Residue(Function& ff): _f(&ff) {}
-        Residue(const Residue<Function,Domain>&r ) : _f(r._f) {}
-    
-        typename Domain::Element operator()(Domain D) {
-            typename Domain::Element d;
-            D.init(d);
-            return (*_f)(d,D);
-        }
-    };
-
-    template<class CRABase>
-    struct ChineseRemainder {
-
-        typedef typename CRABase::Domain	Domain;
-        typedef typename CRABase::DomainElement	DomainElement;
-    protected:
-        CRABase Builder_;
-        
-    public:
-        template<class Param>
-        ChineseRemainder(const Param& b) : Builder_(b) {}
-
-
-        template<class Int, class Function, class PrimeIterator>
-        Int& operator() (Int& res, Function& Iteration, PrimeIterator& primeiter) {
-
-            double start = Util::WallTimer::gettime();
-
-            ++primeiter; 
-            Domain D(*primeiter); 
-            DomainElement r; D.init(r);
-            Builder_.initialize( D, Iteration(r, D) );
-
-            // the task used to extract residue
-            Residue<Function,Domain> residue(Iteration);
-
-            size_t nb_primes = 4;
-            size_t nb_done=0;
-
-            while( ! Builder_.terminated() )
-            {
-                Domain domains [nb_primes];
-                DomainElement domainelements[nb_primes];
-
-                // generate the array of domain
-                for (size_t i=0;i < nb_primes;i++) {
-                    do {
-                        ++primeiter;
-                    } while( Builder_.noncoprime(*primeiter) ) ;
-                    domains[i]=Domain(*primeiter);
-                }
-
-                // recursively call the send function
-                a1::transform(
-                    domains,
-                    domains+nb_primes,
-                    domainelements,
-                    residue
-                );
-
-                // when it's done, analyze the result
-                for(size_t i=0;i<nb_primes;++i) {
-                    Builder_.progress(domains[i], domainelements[i]);
-                }
-
-                nb_done+=nb_primes;
-                nb_primes=nb_done/2;
-            }
-
-            std::cout << "TIME=" << Util::WallTimer::gettime()-start << std::endl;
-            return Builder_.result(res);
-        }
-
-        template<class Int, template <class T> class Vect, class Function, class PrimeIterator>
-        Vect<Int> & operator() (Vect<Int>& res, Function& Iteration, PrimeIterator& primeiter) {
-            
-            ++primeiter; 
-            Domain D(*primeiter); 
-            Vect<DomainElement> r; 
-            Builder_.initialize( D, Iteration(r, D) );
-
-            while( ! Builder_.terminated() ) {
-                ++primeiter; while(Builder_.noncoprime(*primeiter) ) ++primeiter; 
-                Domain D(*primeiter); 
-                Vect<DomainElement> r; 
-                Builder_.progress( D, Iteration(r, D) );
-            }
-            return Builder_.result(res);
-        }
-
-    };
+namespace LinBox
+{
+
+	template<class Function, class Domain >
+	struct Residue {
+
+		Function *_f;
+		Residue() :
+			_f(0)
+		{}
+		Residue(Function& ff) :
+			_f(&ff)
+		{}
+		Residue(const Residue<Function,Domain>&r ) :
+			_f(r._f)
+		{}
+
+		typename Domain::Element operator()(Domain D)
+		{
+			typename Domain::Element d;
+			D.init(d);
+			return (*_f)(d,D);
+		}
+	};
+
+	/*! No doc.
+	 * @ingroup CRA
+	 */
+	template<class CRABase>
+	struct ChineseRemainder {
+
+		typedef typename CRABase::Domain	Domain;
+		typedef typename CRABase::DomainElement	DomainElement;
+	protected:
+		CRABase Builder_;
+
+	public:
+		template<class Param>
+		ChineseRemainder(const Param& b) :
+			Builder_(b)
+		{}
+
+		/**
+		 * CRA loop subroutine.
+		 * @ingroup CRA
+		 * given a function and a prime, this returns the residue by applying given function
+		 * this must be thread safe and communicable
+		 * \param primeiter Prime Integer
+		 * \param Iteration function used to compute residue
+		 * \param[out] res the residue
+		 * \return the residue
+		 */
+		template<class Int, class Function, class PrimeIterator>
+		Int& operator() (Int& res, Function& Iteration, PrimeIterator& primeiter)
+		{
+
+			double start = Util::WallTimer::gettime();
+
+			++primeiter;
+			Domain D(*primeiter);
+			DomainElement r; D.init(r);
+			Builder_.initialize( D, Iteration(r, D) );
+
+			// the task used to extract residue
+			Residue<Function,Domain> residue(Iteration);
+
+			size_t nb_primes = 4;
+			size_t nb_done=0;
+
+			while( ! Builder_.terminated() )
+			{
+				Domain domains [nb_primes];
+				DomainElement domainelements[nb_primes];
+
+				// generate the array of domain
+				for (size_t i=0;i < nb_primes;i++) {
+					do {
+						++primeiter;
+					} while( Builder_.noncoprime(*primeiter) ) ;
+					domains[i]=Domain(*primeiter);
+				}
+
+				// recursively call the send function
+				a1::transform(
+					      domains,
+					      domains+nb_primes,
+					      domainelements,
+					      residue
+					     );
+
+				// when it's done, analyze the result
+				for(size_t i=0;i<nb_primes;++i) {
+					Builder_.progress(domains[i], domainelements[i]);
+				}
+
+				nb_done+=nb_primes;
+				nb_primes=nb_done/2;
+			}
+
+			std::cout << "TIME=" << Util::WallTimer::gettime()-start << std::endl;
+			return Builder_.result(res);
+		}
+
+		template<class Int, template <class T> class Vect, class Function, class PrimeIterator>
+		Vect<Int> & operator() (Vect<Int>& res, Function& Iteration, PrimeIterator& primeiter)
+		{
+
+			++primeiter;
+			Domain D(*primeiter);
+			Vect<DomainElement> r;
+			Builder_.initialize( D, Iteration(r, D) );
+
+			while( ! Builder_.terminated() ) {
+				++primeiter; while(Builder_.noncoprime(*primeiter) ) ++primeiter;
+				Domain D(*primeiter);
+				Vect<DomainElement> r;
+				Builder_.progress( D, Iteration(r, D) );
+			}
+			return Builder_.result(res);
+		}
+
+	};
 
 }
 
 /*
- * marshalling operator, 
+ * marshalling operator,
  * WARNING: those are dummy ones, the real ones are *really* hard to implement because of BlackBoxes
  * whose interface is hidden and does not make it easy to be communicable
  */
 
-template<class Function, class Domain > 
-a1::OStream& operator<<( a1::OStream& out, const LinBox::Residue<Function, Domain>&  ) {
+template<class Function, class Domain >
+a1::OStream& operator<<( a1::OStream& out, const LinBox::Residue<Function, Domain>&  )
+{
 	return out ;
 }
 
-template<class Function, class Domain > 
+template<class Function, class Domain >
 a1::IStream& operator>>( a1::IStream& in,  LinBox::Residue<Function, Domain>&  )
 {
-    return in;
+	return in;
 }
-#endif
+#endif //__LINBOX_cra_kaapi_H
+
diff --git a/linbox/algorithms/cra-mpi.h b/linbox/algorithms/cra-mpi.h
index 6ac45b3..e8e8a6d 100644
--- a/linbox/algorithms/cra-mpi.h
+++ b/linbox/algorithms/cra-mpi.h
@@ -1,13 +1,33 @@
-/* -*- mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/* author: B. David Saunders and Zhendong Wan*/
-// parallelized for BOINC computing by Bryan Youse
-// ======================================================================= //
-// Time-stamp: <15 Mar 07 17:41:24 Jean-Guillaume.Dumas at imag.fr> 
-// ======================================================================= //
-#ifndef __LINBOX_CRA_MPI_H
-#define __LINBOX_CRA_MPI_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
+/* Copyright (C) 2007 LinBox
+ * Written by bds and zw
+ *
+ * author: B. David Saunders and Zhendong Wan
+ * parallelized for BOINC computing by Bryan Youse
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
 
-#define MPICH_IGNORE_CXX_SEEK
+
+#ifndef __LINBOX_cra_mpi_H
+#define __LINBOX_cra_mpi_H
+
+#define MPICH_IGNORE_CXX_SEEK //BB: ???
 #include "linbox/util/timer.h"
 #include <stdlib.h>
 #include "linbox/integer.h"
@@ -17,178 +37,188 @@
 #include "linbox/algorithms/cra-domain.h"
 #include "linbox/util/mpicpp.h"
 
-namespace LinBox {
-    
-    template<class CRABase>
-    struct MPIChineseRemainder {
-        typedef typename CRABase::Domain	Domain;
-        typedef typename CRABase::DomainElement	DomainElement;
-    protected:
-        CRABase Builder_;
-        Communicator               *commPtr;
-        unsigned int               numprocs;
-        
-    public:
-        template<class Param>
-        MPIChineseRemainder(const Param& b, Communicator *c = NULL) : Builder_(b), commPtr(c), numprocs(c->size()) {}
+namespace LinBox
+{
 
-            /** \brief The CRA loop
-            
-            termination condition.
-         
-            \param F - Function object of two arguments, F(r, p), given prime p it outputs residue(s) r.
-            This loop may be parallelized.  F must be reentrant, thread safe.
-            For example, F may be returning the coefficients of the minimal polynomial of a matrix mod p.
-            Warning - we won't detect bad primes.
-         
-            \param genprime - RandIter object for generating primes.
-				\param Comm - Pointer to Communicator object to delegate parallelism using MPI
-            \result res - an integer
-            */
-        template<class Function, class PrimeIterator>
-        Integer & operator() (Integer& res, Function& Iteration, PrimeIterator& primeg, Communicator *Comm) {
-                //  defer to standard CRA loop if no parallel usage is desired
-            if(Comm == 0 || Comm->size() == 1) {
-                ChineseRemainder< CRABase > sequential(Builder_);
-                return sequential(res, Iteration, primeg);
-            }
-            
-            int procs = Comm->size();
-            int process = Comm->rank();
-            
-                //  parent process
-            if(process == 0 ){
-                    //  create an array to store primes
-                int primes[procs - 1];
-                DomainElement r; 
-                    //  send each child process a new prime to work on
-                for(int i=1; i<procs; i++){
-                    ++primeg; while(Builder_.noncoprime(*primeg) ) ++primeg;
-                    primes[i - 1] = *primeg;
-                    Comm->send(primes[i - 1], i);
-                }
-                int idle_process = 0;
-                bool first_time = true;
-                int poison_pills_left = procs - 1;
-                    //  loop until all execution is complete
-                while( poison_pills_left > 0 ){
-                        //  receive sub-answers from child procs
-                    Comm->recv(r, MPI_ANY_SOURCE);
-                    idle_process = (Comm->get_stat()).MPI_SOURCE;
-                    Domain D(primes[idle_process - 1]); 
-                        //  assimilate results
-                    if(first_time){
-                        Builder_.initialize(D, r);
-                        first_time = false;
-                    } else
-                        Builder_.progress( D, r );
-                        //  queue a new prime if applicable
-                    if(! Builder_.terminated()){
-                        ++primeg;
-                        primes[idle_process - 1] = *primeg;
-                    }
-                        //  otherwise, queue a poison pill
-                    else{
-                        primes[idle_process - 1] = 0;
-                        poison_pills_left--;
-                    }
-                        //  send the prime or poison pill
-                    Comm->send(primes[idle_process - 1], idle_process);
-                }  // end while
-                return Builder_.result(res);
-            }  // end if(parent process)
-                //  child processes
-            else{
-                int pp;
-                while(true){ 
-                        //  receive the prime to work on, stop
-                        //  if signaled a zero
-                    Comm->recv(pp, 0);
-                    if(pp == 0)
-                        break;
-                    Domain D(pp);
-                    DomainElement r; D.init(r);
-                    Iteration(r, D);
-                        //Comm->buffer_attach(rr);
-                        // send the results
-                    Comm->send(r, 0);
-                }
-                return res;
-            }
-        }
+	template<class CRABase>
+	struct MPIChineseRemainder {
+		typedef typename CRABase::Domain	Domain;
+		typedef typename CRABase::DomainElement	DomainElement;
+	protected:
+		CRABase Builder_;
+		Communicator* _commPtr;
+		unsigned int _numprocs;
 
-        
-        template<template <class T> class Vect, class Function, class PrimeIterator>
-        Vect<Integer> & operator() (Vect<Integer>& res, Function& Iteration, PrimeIterator& primeg, Communicator *Comm) {
-                //  if there is no communicator or if there is only one process,
-                //  then proceed normally (without parallel)
-            if(Comm == 0 || Comm->size() == 1) {
-                ChineseRemainder< CRABase > sequential(Builder_);
-                return sequential(res, Iteration, primeg);
-            }
-            
-            int procs = Comm->size();
-            int process = Comm->rank();
-            Vect<DomainElement> r;
-            
-                //  parent propcess
-            if(process == 0){
-                int primes[procs - 1];
-                Domain D(*primeg);
-                    //  for each slave process...
-                for(int i=1; i<procs; i++){
-                        //  generate a new prime
-                    ++primeg; while(Builder_.noncoprime(*primeg) ) ++primeg;
-                        //  fix the array of currently sent primes
-                    primes[i - 1] = *primeg;	
-                        //  send the prime to a slave process
-                    Comm->send(primes[i - 1], i);
-                }
-                Builder_.initialize( D, Iteration(r, D) ); 
-                int idle_process = 0;
-                int poison_pills_left = procs - 1;
-                while(poison_pills_left > 0 ){
-                        //  receive the beginnin and end of a vector in heapspace
-                    Comm->recv(r.begin(), r.end(), MPI_ANY_SOURCE, 0);
-                        //  determine which process sent answer 
-                        //  and give them a new prime
-                    idle_process = (Comm->get_stat()).MPI_SOURCE;
-                    Domain D(primes[idle_process - 1]);
-                    Builder_.progress(D, r);
-                        //  if still working, queue a prime
-                    if(! Builder_.terminated()){
-                        ++primeg;
-                        primes[idle_process - 1] = *primeg;
-                    }
-                        //  otherwise, queue a poison pill
-                    else{
-                        primes[idle_process - 1] = 0;
-                        poison_pills_left--;
-                    }
-                        //  send the prime or poison
-                    Comm->send(primes[idle_process - 1], idle_process);
-                }  // while
-                return Builder_.result(res);	
-            }
-                //  child process
-            else{
-                int pp;
-                    //  get a prime, compute, send back start and end
-                    //  of heap addresses 
-                while(true){
-                    Comm->recv(pp, 0);
-                    if(pp == 0)
-                        break;
-                    Domain D(pp);
-                    Iteration(r, D);
-                    Comm->send(r.begin(), r.end(), 0, 0);
-                }
-                return res;
-            }
-        }
+	public:
+		template<class Param>
+		MPIChineseRemainder(const Param& b, Communicator *c) :
+			Builder_(b), _commPtr(c), _numprocs(c->size())
+		{}
 
-    };
+		/** \brief The CRA loop.
+		 *
+		 * termination condition.
+		 *
+		 * \param Iteration  Function object of two arguments, \c
+		 * Iteration(r, p), given prime \c p it outputs residue(s) \c
+		 * r.  This loop may be parallelized.  \p Iteration must be
+		 * reentrant, thread safe.  For example, \p Iteration may be
+		 * returning the coefficients of the minimal polynomial of a
+		 * matrix \c mod \p p.
+		 @warning  we won't detect bad primes.
+		 *
+		 * \param primeg  RandIter object for generating primes.
+		 * \param[out] res an integer
+		 */
+		template<class Function, class PrimeIterator>
+		Integer & operator() (Integer& res, Function& Iteration, PrimeIterator& primeg)
+		{
+			//  defer to standard CRA loop if no parallel usage is desired
+			if(_commPtr == 0 || _commPtr->size() == 1) {
+				ChineseRemainder< CRABase > sequential(Builder_);
+				return sequential(res, Iteration, primeg);
+			}
 
-}
+			int procs = _commPtr->size();
+			int process = _commPtr->rank();
+
+			//  parent process
+			if(process == 0 ){
+				//  create an array to store primes
+				int primes[procs - 1];
+				DomainElement r;
+				//  send each child process a new prime to work on
+				for(int i=1; i<procs; i++){
+					++primeg; while(Builder_.noncoprime(*primeg) ) ++primeg;
+					primes[i - 1] = *primeg;
+					_commPtr->send(primes[i - 1], i);
+				}
+				int idle_process = 0;
+				bool first_time = true;
+				int poison_pills_left = procs - 1;
+				//  loop until all execution is complete
+				while( poison_pills_left > 0 ){
+					//  receive sub-answers from child procs
+					_commPtr->recv(r, MPI_ANY_SOURCE);
+					idle_process = (_commPtr->get_stat()).MPI_SOURCE;
+					Domain D(primes[idle_process - 1]);
+					//  assimilate results
+					if(first_time){
+						Builder_.initialize(D, r);
+						first_time = false;
+					}
+					else
+						Builder_.progress( D, r );
+					//  queue a new prime if applicable
+					if(! Builder_.terminated()){
+						++primeg;
+						primes[idle_process - 1] = *primeg;
+					}
+					//  otherwise, queue a poison pill
+					else{
+						primes[idle_process - 1] = 0;
+						poison_pills_left--;
+					}
+					//  send the prime or poison pill
+					_commPtr->send(primes[idle_process - 1], idle_process);
+				}  // end while
+				return Builder_.result(res);
+			}  // end if(parent process)
+			//  child processes
+			else{
+				int pp;
+				while(true){
+					//  receive the prime to work on, stop
+					//  if signaled a zero
+					_commPtr->recv(pp, 0);
+					if(pp == 0)
+						break;
+					Domain D(pp);
+					DomainElement r; D.init(r);
+					Iteration(r, D);
+					//Comm->buffer_attach(rr);
+					// send the results
+					_commPtr->send(r, 0);
+				}
+				return res;
+			}
+		}
 
+#if 0
+		template<class V, class F, class P>
+		V & operator() (V& res, F& it, P&primeg){ return res; }
 #endif
+		template<class Vect, class Function, class PrimeIterator>
+		Vect & operator() (Vect& res, Function& Iteration, PrimeIterator& primeg)
+		{
+			//  if there is no communicator or if there is only one process,
+			//  then proceed normally (without parallel)
+			if(_commPtr == 0 || _commPtr->size() == 1) {
+				ChineseRemainder< CRABase > sequential(Builder_);
+				return sequential(res, Iteration, primeg);
+			}
+
+			int procs = _commPtr->size();
+			int process = _commPtr->rank();
+			std::vector<DomainElement> r;
+
+			//  parent propcess
+			if(process == 0){
+				int primes[procs - 1];
+				Domain D(*primeg);
+				//  for each slave process...
+				for(int i=1; i<procs; i++){
+					//  generate a new prime
+					++primeg; while(Builder_.noncoprime(*primeg) ) ++primeg;
+					//  fix the array of currently sent primes
+					primes[i - 1] = *primeg;
+					//  send the prime to a slave process
+					_commPtr->send(primes[i - 1], i);
+				}
+				Builder_.initialize( D, Iteration(r, D) );
+				int idle_process = 0;
+				int poison_pills_left = procs - 1;
+				while(poison_pills_left > 0 ){
+					//  receive the beginnin and end of a vector in heapspace
+					_commPtr->recv(r.begin(), r.end(), MPI_ANY_SOURCE, 0);
+					//  determine which process sent answer
+					//  and give them a new prime
+					idle_process = (_commPtr->get_stat()).MPI_SOURCE;
+					Domain D(primes[idle_process - 1]);
+					Builder_.progress(D, r);
+					//  if still working, queue a prime
+					if(! Builder_.terminated()){
+						++primeg;
+						primes[idle_process - 1] = *primeg;
+					}
+					//  otherwise, queue a poison pill
+					else{
+						primes[idle_process - 1] = 0;
+						poison_pills_left--;
+					}
+					//  send the prime or poison
+					_commPtr->send(primes[idle_process - 1], idle_process);
+				}  // while
+				return Builder_.result(res);
+			}
+			//  child process
+			else{
+				int pp;
+				//  get a prime, compute, send back start and end
+				//  of heap addresses
+				while(true){
+					_commPtr->recv(pp, 0);
+					if(pp == 0)
+						break;
+					Domain D(pp);
+					Iteration(r, D);
+					_commPtr->send(r.begin(), r.end(), 0, 0);
+				}
+				return res;
+			}
+		}
+	};
+}
+
+#undef MPICH_IGNORE_CXX_SEEK
+#endif // __LINBOX_cra_mpi_H
diff --git a/linbox/algorithms/cra.doxy b/linbox/algorithms/cra.doxy
new file mode 100644
index 0000000..e3ab13e
--- /dev/null
+++ b/linbox/algorithms/cra.doxy
@@ -0,0 +1,17 @@
+// Copyright (C) 2010 Brice Boyer, part of LinBox, GNU LGPL, see COPYING
+/*!
+\ingroup algorithms
+\defgroup CRA Chinese Remaindering Algorithm
+
+ at brief Chinese Remaindering (\c cra) in LinBox.
+
+NO DOC
+
+- Integer CRA
+ at see algorithms/cra-domain.h 
+
+- Rational CRA
+
+*/
+
+// vim:syntax=doxygen
diff --git a/linbox/algorithms/default.h b/linbox/algorithms/default.h
index f51f151..4ae9507 100644
--- a/linbox/algorithms/default.h
+++ b/linbox/algorithms/default.h
@@ -1,18 +1,39 @@
-/* -*- mode:C++ -*- */
-
-/* File: default.h
- *  Author: Zhendong Wan
+/* -*- 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
+/* Copyright (C)  LinBox
+ * Written by Zhendong Wan
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
-/* define some const 
+
+#ifndef __LINBOX_default_H
+#define	__LINBOX_default_H
+
+/*! @file algorithms/default.h
+ * define some const
  */
 
-#ifndef __LINBOX_DEFALT_H__
-#define	__LINBOX_DEFALT_H__
 
-namespace LinBox {
-static const int DEFAULTLIFTHRESHOLD = 5;	
-static const int DEFAULTOIFTHRESHOLD = 30;
-static const double CROSSOVER = 0.6;
+namespace LinBox
+{
+	static const int DEFAULTLIFTHRESHOLD = 5;
+	static const int DEFAULTOIFTHRESHOLD = 30;
+	static const double CROSSOVER = 0.6;
 }
 
-#endif
+#endif //__LINBOX_default_H
diff --git a/linbox/algorithms/dense-container.h b/linbox/algorithms/dense-container.h
index f647ed4..addafcf 100644
--- a/linbox/algorithms/dense-container.h
+++ b/linbox/algorithms/dense-container.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/algorithms/blackbox-container.h
  * Copyright (C) 1999, 2001 Jean-Guillaume Dumas, Bradford Hovinen
  *
@@ -11,149 +11,151 @@
  * See COPYING for license information.
  */
 
-#ifndef __BLACKBOX_CONTAINER_H
-#define __BLACKBOX_CONTAINER_H
+#ifndef __LINBOX_blackbox_container_H
+#define __LINBOX_blackbox_container_H
 
 #include <linbox/randiter/archetype.h>
 #include <linbox/algorithms/blackbox-container-base.h>
 #include <linbox/util/timer.h>
 
-namespace LinBox 
+namespace LinBox
 {
 
-/// \brief Limited doc so far.
-template<class Field, class Vector, class RandIter = typename Field::RandIter>
-class DenseContainer : public BlackboxContainerBase<Field, Vector> {
-    public:
-	typedef typename BlackboxContainerBase<Field, Vector>::Blackbox Blackbox;
-
-	DenseContainer () {} 
-
-	DenseContainer(const Blackbox * D, typename Field::Element * U, size_t ldu, 
-		       const Field &F, const Vector &u0) 
-		: BlackboxContainerBase<Field, Vector> (D, F)
-	{
-		init (u0, u0); w = u;
-		Up = U;
-		_ldu = ldu;
+	/// \brief Limited doc so far.
+	template<class Field, class Vector, class RandIter = typename Field::RandIter>
+	class DenseContainer : public BlackboxContainerBase<Field, Vector> {
+	public:
+		typedef typename BlackboxContainerBase<Field, Vector>::Blackbox Blackbox;
+
+		DenseContainer () {}
+
+		DenseContainer(const Blackbox * D, typename Field::Element * U, size_t ldu,
+			       const Field &F, const Vector &u0) :
+			BlackboxContainerBase<Field, Vector> (D, F)
+		{
+			init (u0, u0); w = u;
+			Up = U;
+			_ldu = ldu;
 #ifdef INCLUDE_TIMING
-		_applyTime = _dotTime = 0.0;
+			_applyTime = _dotTime = 0.0;
 #endif
-	}
-    
-	DenseContainer(const Blackbox * D, typename Field::Element * U, size_t ldu,
-		       const Field &F, const Vector &u0, const Vector& v0) 
-		: BlackboxContainerBase<Field, Vector> (D, F)
-	{
-                // JGD 22.03.03
-// 		init (u0, v0); w = u;
-		init (u0, v0); w = v;
-		Up = U;
-		_ldu = ldu;
+		}
+
+		DenseContainer(const Blackbox * D, typename Field::Element * U, size_t ldu,
+			       const Field &F, const Vector &u0, const Vector& v0) :
+			BlackboxContainerBase<Field, Vector> (D, F)
+		{
+			// JGD 22.03.03
+			// 		init (u0, v0); w = u;
+			init (u0, v0); w = v;
+			Up = U;
+			_ldu = ldu;
 #ifdef INCLUDE_TIMING
-		_applyTime = _dotTime = 0.0;
+			_applyTime = _dotTime = 0.0;
 #endif
-	}
-    
-	DenseContainer(const Blackbox * D, typename Field::Element * U, size_t ldu, 
-		       const Field &F, RandIter &g) 
-		: BlackboxContainerBase<Field, Vector> (D, F)
-	{
-		init (g); w = u;
-		Up = U;
-		_ldu = ldu;
+		}
+
+		DenseContainer(const Blackbox * D, typename Field::Element * U, size_t ldu,
+			       const Field &F, RandIter &g) :
+			BlackboxContainerBase<Field, Vector> (D, F)
+		{
+			init (g); w = u;
+			Up = U;
+			_ldu = ldu;
 #ifdef INCLUDE_TIMING
-		_applyTime = _dotTime = 0.0;
+			_applyTime = _dotTime = 0.0;
 #endif
-	}
+		}
 
 #ifdef INCLUDE_TIMING
-	double applyTime () const { return _applyTime; }
-	double dotTime   () const { return _dotTime; }
+		double applyTime () const { return _applyTime; }
+		double dotTime   () const { return _dotTime; }
 #endif // INCLUDE_TIMING
 
-    protected:
-	Vector w;
-	typename Field::Element * Up;
+	protected:
+		Vector w;
+		typename Field::Element * Up;
 
-	size_t _ldu;
+		size_t _ldu;
 
 #ifdef INCLUDE_TIMING
-	Timer _timer;
-	double _applyTime, _dotTime;
+		Timer _timer;
+		double _applyTime, _dotTime;
 #endif // INCLUDE_TIMING
 
-	void _launch () {
-		typename Vector::iterator it;
-		Integer tmp;
-		size_t i;
-		if (casenumber) {
+		void _launch ()
+		{
+			typename Vector::iterator it;
+			Integer tmp;
+			size_t i;
+			if (casenumber) {
 #ifdef INCLUDE_TIMING
-			_timer.start ();
+				_timer.start ();
 #endif // INCLUDE_TIMING
-			_BB->apply (v, w);  // GV
+				_BB->apply (v, w);  // GV
 
 #ifdef INCLUDE_TIMING
-			_timer.stop ();
-			_applyTime += _timer.realtime ();
-			_timer.start ();
+				_timer.stop ();
+				_applyTime += _timer.realtime ();
+				_timer.start ();
 #endif // INCLUDE_TIMING
 
-			// Copy of v into a row of U
-			it = v.begin();
-			i=0;
-			for (; it!=v.end(); it++, i++){
-				*(Up+i) = *it;
-				_F.convert(tmp,*it);
-				cerr<<" copie of "<<tmp;
-			}
-			cerr<<endl;
-			Up += _ldu;
-			_VD.dot (_value, u, v);  // GV 
+				// Copy of v into a row of U
+				it = v.begin();
+				i=0;
+				for (; it!=v.end(); it++, i++){
+					*(Up+i) = *it;
+					_F.convert(tmp,*it);
+					cerr<<" copie of "<<tmp;
+				}
+				cerr<<endl;
+				Up += _ldu;
+				_VD.dot (_value, u, v);  // GV
 
 #ifdef INCLUDE_TIMING
-			_timer.stop ();
-			_dotTime += _timer.realtime ();
+				_timer.stop ();
+				_dotTime += _timer.realtime ();
 #endif // INCLUDE_TIMING
 
-			casenumber = 0;
-		} else {
+				casenumber = 0;
+			}
+			else {
 #ifdef INCLUDE_TIMING
-			_timer.start ();
+				_timer.start ();
 #endif // INCLUDE_TIMING
-			_BB->apply (w, v);  // GV
-
-			// Copy of v into a row of U
-			it = w.begin();
-  			i=0;
-  			for (; it!=w.end(); it++, i++){
- 				_F.convert(tmp,*it);
-  				cerr<<" copie of "<<tmp;
-  				*(Up+i) = *it;
-  			}
-  			cerr<<endl;
-  			Up += _ldu;
+				_BB->apply (w, v);  // GV
+
+				// Copy of v into a row of U
+				it = w.begin();
+				i=0;
+				for (; it!=w.end(); it++, i++){
+					_F.convert(tmp,*it);
+					cerr<<" copie of "<<tmp;
+					*(Up+i) = *it;
+				}
+				cerr<<endl;
+				Up += _ldu;
 #ifdef INCLUDE_TIMING
-			_timer.stop ();
-			_applyTime += _timer.realtime ();
-			_timer.start ();
+				_timer.stop ();
+				_applyTime += _timer.realtime ();
+				_timer.start ();
 #endif // INCLUDE_TIMING
 
-			_VD.dot (_value, u, w);  // GV
+				_VD.dot (_value, u, w);  // GV
 
 #ifdef INCLUDE_TIMING
-			_timer.stop ();
-			_dotTime += _timer.realtime ();
+				_timer.stop ();
+				_dotTime += _timer.realtime ();
 #endif // INCLUDE_TIMING
 
-			casenumber = 1;
-		}  
-	}
+				casenumber = 1;
+			}
+		}
+
+		void _wait () {}
+	};
 
-	void _wait () {}
-};
- 
 }
 
-#endif // __BLACKBOX_CONTAINER_H
+#endif // __LINBOX_blackbox_container_H
 
diff --git a/linbox/algorithms/dense-nullspace.h b/linbox/algorithms/dense-nullspace.h
new file mode 100644
index 0000000..18e6a19
--- /dev/null
+++ b/linbox/algorithms/dense-nullspace.h
@@ -0,0 +1,113 @@
+/* -*- 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
+/* Copyright (C) 2010 LinBox
+ * Written by <brice.boyer at imag.fr>
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/** \file linbox/algorithm/dense-nullspace.h
+ * @ingroup algorithm
+ *
+ * @brief We provide the right or left nullspace (kernel or cokernel) of a dense matrix.
+ * @details Provides :
+ *	- the nullspace of a matrix \p A
+ *	- (soon) a random vector within the nullspace of \p A
+ * @todo random nullspace vector
+ */
+
+#ifndef __LINBOX_dense_nullspace_H
+#define __LINBOX_dense_nullspace_H
+
+
+#include "linbox/algorithms/linbox-tags.h"
+#include "linbox/matrix/blas-matrix.h"
+
+namespace LinBox
+{
+
+	/** Computes the kernel of a dense matrix using \c LQUP.
+	 *
+	 * Acccording to the dimensions of the input matrix, we chose different methods.
+	 * @warning timings may vary and these choices were made on an experimental basis.
+	 *
+	 * @param F  Field
+	 * @param Side  left or right from \c LinBox::SideTag
+	 * @param m rows
+	 * @param n cols
+	 * @param A input matrix
+	 * @param lda leading dimension of A
+	 * @param Ker Kernel. \c NULL if \c kerdim==0
+	 * @param ldk leading dimension of the kernel.
+	 * @param kerdim dimension of the kernel.
+	 * @return dimension of the kernel.
+	 *
+	 * @warning A is modified.
+	 */
+	template<class Field>
+	size_t
+	NullSpaceBasis (const Field& F, const LinBoxTag::Side Side,
+			const size_t & m, const size_t & n,
+			typename Field::Element * A, const size_t & lda,
+			typename Field::Element *& Ker, size_t& ldk,
+			size_t & kerdim) ;
+
+	/*! Nullspace of a dense matrix on a finite field.
+	 * A is modified.
+	 * @param         F field
+	 * @param         Side \c SideTag::Left or \c SideTag::Right nullspace.
+	 * @param[in,out] A Input matrix
+	 * @param[out]    Ker Nullspace of the matrix (Allocated in the routine)
+	 * @param[out]    kerdim rank of the kernel
+	 * @return \p kerdim
+	 */
+	template<class Field>
+	size_t&
+	NullSpaceBasis (const Field& F, const LinBoxTag::Side Side,
+			BlasMatrix<typename Field::Element> & A,
+			BlasMatrix<typename Field::Element> & Ker,
+			size_t & kerdim) ;
+
+	/*! Nullspace of a dense matrix on a finite field.
+	 * A is preserved.
+	 * @param      F field
+	 * @param      Side \c SideTag::Left or \c SideTag::Right nullspace.
+	 * @param[in]  A Input matrix
+	 * @param[out] Ker Nullspace of the matrix (Allocated in the routine)
+	 * @param[out] kerdim rank of the kernel
+	 * @return \p kerdim
+	 */
+	template<class Field>
+	size_t&
+	NullSpaceBasis (const Field& F, const LinBoxTag::Side Side,
+			const BlasMatrix<typename Field::Element> & A,
+			BlasMatrix<typename Field::Element> & Ker,
+			size_t & kerdim)
+	{
+		BlasMatrix<typename Field::Element> B (A);
+		return NullSpaceBasis<Field>(F,Side,B,Ker,kerdim);
+
+	}
+
+
+} // LinBox
+
+#include "dense-nullspace.inl"
+
+#endif // __LINBOX_dense_nullspace_H
+
diff --git a/linbox/algorithms/dense-nullspace.inl b/linbox/algorithms/dense-nullspace.inl
new file mode 100644
index 0000000..a137198
--- /dev/null
+++ b/linbox/algorithms/dense-nullspace.inl
@@ -0,0 +1,500 @@
+/* -*- 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
+/* Copyright (C) 2010 LinBox
+ * Written by <brice.boyer at imag.fr>
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_dense_nullspace_INL
+#define __LINBOX_dense_nullspace_INL
+
+#include "linbox/matrix/blas-matrix.h"
+
+#include "fflas-ffpack/ffpack/ffpack.h" // LU
+#include "fflas-ffpack/fflas/fflas.h" // trsm
+
+//#include "Matio.h" // write_field ;
+#include <iostream>
+#include <cassert>
+
+namespace LinBox
+{
+
+	/**
+	 * @brief
+	 *
+	 * @param F
+	 * @param Z
+	 * @param ldZ
+	 * @param lig1
+	 * @param col1
+	 * @param lig2
+	 * @param col2
+	 */
+	template <class Field >
+	void Zero(const Field & F,
+		  typename Field::Element * Z, const size_t ldZ,
+		  const size_t lig1, const size_t col1,
+		  const size_t lig2, const size_t col2)
+	{
+		assert(lig1<lig2);
+		assert(col1<col2);
+		assert(col2<=ldZ);
+		typename Field::Element zero;
+		F.init(zero,0UL);
+
+		for (size_t i = lig1 ; i < lig2 ; ++i)
+			for (size_t j = col1; j < col2 ; ++j) // F.assign(*(Id+i*ldI+j),zero)
+				*(Z+i*ldZ+j) = zero ;
+		return;
+	}
+
+
+	/*! Creates identity matrix in \p F of size \p dim1 \p x \p dim2.
+	 * @warning diag_num peut être < 0 !
+	 * @bug     long et size_t ne cohabitent pas bien.
+	 */
+	template <class Field >
+	void Identity(const Field & F,
+		      typename Field::Element * Id, const size_t ldI,
+		      const size_t lig1, const size_t col1,
+		      const size_t lig2, const size_t col2)
+	{
+		assert(lig1<lig2);
+		assert(col1<col2);
+		assert(col2<=ldI);
+		typename Field::Element one,zero;
+		F.init(one,1UL);
+		F.init(zero,0UL);
+		for (size_t i = lig1 ; i < lig2 ; ++i)
+			for (size_t j = col1; j < col2 ; ++j) // F.assign(*(Id+i*ldI+j),zero)
+				*(Id+i*ldI+j) = zero ;
+		// Zero(F,Id,ldI,lig1,col1,lig2,col2);
+		size_t nb_un = std::min(col2-col1,lig2-lig1)-1;
+
+		typename Field::Element * Un_ici = Id+lig1*ldI+col1 ;
+		for (size_t i = 0 ; i < nb_un ; ++i){
+			*(Un_ici) = one ;
+			Un_ici += ldI ;
+			++Un_ici;
+		}
+		*(Un_ici) = one ;
+		return;
+	}
+
+
+	/*!
+	 * @brief The right or left nullspace (kernel or cokernel) of a matrix A
+	 * We use the LU decomposition
+	 * @param F the field in which \p A lives
+	 * @param A is a matrix whose nullspace we look for.
+	 * @param M number of lines in \p A
+	 * @param N number of column of \p A
+	 * @param lda the leading dimension of matrix \p A
+	 * @param ker_dim the dimension of the kernel
+	 * @tparam Field -
+	 * @return a matrix of leading dimension ker_dim whose column vectors span the nullspace of A. Returns \p NULL (and not \f$\mathbf{0}\f$) if <code> ker_dim == 0 </code>.
+	 */
+	template<class Field>
+	typename Field::Element *
+	RightNullspaceDirect ( const Field & F,		// in place
+			       typename Field::Element * A,
+			       const size_t & M, // rows
+			       const size_t & N, // colm
+			       const size_t & lda, // leading dimension
+			       //typename  Field::Element &* V ,
+			       size_t & ker_dim )
+	{
+		size_t *P = new size_t[N];
+		size_t *Qt = new size_t[M];
+		size_t R = FFPACK::LUdivine (F, FFLAS::FflasNonUnit, FFLAS::FflasNoTrans,
+					     M, N, A, lda, P, Qt, FFPACK::FfpackLQUP);
+		delete[] Qt;
+
+		ker_dim = N-R ;								// dimension of kernel
+		if (ker_dim == 0) {
+			delete[] P ;
+			return NULL ;							// only 0 in kernel
+		}
+		typename Field::Element * V = new typename Field::Element[ker_dim*N];	// Result here.
+		size_t ldV = ker_dim ;
+		if (R == 0) {
+			delete[] P ;
+			Identity(F,V,ldV,0,0,N,ker_dim);
+			return V ;
+		}
+
+		for (size_t i = 0 ; i < R ; ++i)					// V <- U2
+			FFLAS::fcopy (F, ker_dim, V + i * ldV, 1, A + R + i*lda, 1);
+		typename Field::Element one ;
+		F.init(one,1UL);
+		FFLAS::ftrsm(F, FFLAS::FflasLeft, FFLAS::FflasUpper,
+			     FFLAS::FflasNoTrans, FFLAS::FflasNonUnit,
+			     R, ker_dim, one,  A, lda , V, ldV) ;			// (V = U2, A = U1) : U2 <- inv(U1)*U2 ;
+
+		typename Field::Element minus_one, zero;
+		F.init(zero,0UL);
+		F.neg(minus_one, one);
+		for ( size_t i = R ; i < N; ++i){					// filling the rest of V with -Id
+			for (size_t j = 0 ; j < ker_dim ; ++j)
+				*(V+ker_dim*i+j) = zero ;
+			*(V+ker_dim*i+i-R) = minus_one ;
+			/* // FIXME : faster ?
+			   for (size_t j = 0 ; j < ker_dim ; ++j) {
+
+			   if (i-R == j)
+			 *(V+ker_dim*i+j) = minus_one ;
+			 else
+			 *(V+ker_dim*i+j) = zero ;
+			 }
+			 */
+
+		}
+		FFPACK::applyP(F, FFLAS::FflasLeft, FFLAS::FflasTrans,
+			       ker_dim, 0, R, V, ldV , P);				//  X = P^{-1}V
+		delete[] P;
+		return V;
+
+	}
+
+	template<class Field>
+	typename Field::Element *
+	RightNullspaceIndirect ( const Field & F,		// in place
+				 typename Field::Element * A,
+				 const size_t & M, // rows
+				 const size_t & N, // colm
+				 const size_t & lda, // leading dimension
+				 //typename  Field::Element &* V ,
+				 size_t & ker_dim )
+	{
+		size_t *P = new size_t[M];
+		size_t *Qt = new size_t[N];
+		size_t R = FFPACK::LUdivine (F, FFLAS::FflasNonUnit, FFLAS::FflasTrans,
+					     M, N, A, lda, P, Qt, FFPACK::FfpackLQUP);
+
+
+		// write_field (F, std::cout<<"ALU :="<<std::endl, A, M, N, N, true);
+		// PrintLQUP (F,FFLAS::FflasNonUnit,FFLAS::FflasTrans,M,N,A,R,std::cout<<"L.Q.U.P"<<std::endl,Qt,P,true);
+
+		// std::cout << "ker_dim = " << ker_dim << std::endl;
+
+		delete[] P;
+
+		ker_dim = N-R ;								// dimension of kernel
+		if (ker_dim == 0) {
+			delete[] Qt ;
+			return NULL ;							// only 0 in kernel
+		}
+		size_t ldV = ker_dim ;
+		typename Field::Element * V = new typename Field::Element[ker_dim*N];	// Result here.
+		if (R == 0) {
+			delete[] Qt ;
+			Identity(F,V,ker_dim,0,0,N,ker_dim);
+			return V ;
+		}
+
+		//////////////////////////
+
+		Zero    (F,V,ldV,0,0,R,ker_dim);
+		Identity(F,V,ldV,R,0,N,ker_dim);
+		// write_field (F, std::cout<<"V init   ="<<std::endl, V, N, ker_dim, ker_dim,true);
+		FFPACK::applyP(F, FFLAS::FflasLeft, FFLAS::FflasNoTrans,
+			       ker_dim, 0, R, V, ldV, Qt);			//  V = Q V
+
+		// write_field (F, std::cout<<"V reordered   ="<<std::endl, V, N,ker_dim, ker_dim,true);
+
+		// actually we just select a line in the inverse of L.
+		//size_t wda = M ;
+
+		typename Field::Element one, zero;
+		F.init(zero,0UL);
+		F.init(one,1UL);
+		// F.neg(minus_one, one);
+
+		if (N <= M) { // on a de la place...
+			for ( size_t i=0; i< M; ++i ) {
+				size_t j = 0 ;
+				for ( ; j<std::min(i,N); ++j )
+					*(A+i*N+j) = zero;
+				if (i==j)
+					*(A+i*N+j) = zero;
+			}
+
+			//FFPACK::applyP( F, FFLAS::FflasRight, FFLAS::FflasNoTrans, M,0,M, A, N, Q );
+			FFPACK::applyP( F, FFLAS::FflasLeft, FFLAS::FflasNoTrans, N,0,N, A, N, Qt );
+			for ( size_t i=0; i< N; ++i )
+				*(A+N*i+i) = one ;
+
+			//write_field (F, std::cout<<"A avant trsm   ="<<std::endl, A, M, N, N,true);
+			FFLAS::ftrsm(F, FFLAS::FflasLeft, FFLAS::FflasUpper,
+				     FFLAS::FflasNoTrans, FFLAS::FflasUnit,
+				     N, ker_dim, one,  A, lda , V, ldV) ; // V = inv(Lower) V ;
+			//write_field (F, std::cout<<"V if after trsm  ="<<std::endl, V, N,ker_dim, ker_dim,true);
+		}
+		else { // N > M we can't ftrsm because we can't add 0's to the lower part...
+			typename Field::Element * L = new typename Field::Element[N*N];					// L_inf
+			// début de L
+			size_t i = 0 ;
+			for ( ; i< M; ++i ){
+				size_t j=0;
+				for (; j< std::min(i,N) ; ++j )
+					*(L+i*N+j) = zero ;
+				if (i==j) {
+					*(L+i*N+j) = zero ;
+					j++;
+					for (; j<N; ++j )
+						*(L+i*N+j) = *(A+N*i+j);
+				}
+			}
+			for ( ; i< N; ++i )
+				for (size_t j = 0 ; j<N; ++j )
+					*(L+i*N+j) = zero ;
+
+			FFPACK::applyP( F, FFLAS::FflasLeft, FFLAS::FflasNoTrans,
+					N,0,R, L, N, Qt );
+			for ( size_t i=0; i< N; ++i )
+				*(L+N*i+i) = one ;
+			// fin de L.
+			//write_field (F, std::cout<<"U_1="<<std::endl, L, M, M, M,true);
+			FFLAS::ftrsm(F, FFLAS::FflasLeft, FFLAS::FflasUpper,
+				     FFLAS::FflasNoTrans, FFLAS::FflasUnit,
+				     N, ker_dim, one,  L, N , V, ldV); 	// V = inv(Lower) V ;
+
+			// write_field (F, std::cout<<"V else after trsm   ="<<std::endl, V, N,ker_dim, ker_dim,true);
+
+			delete[] L;
+		}
+		//write_field (F, std::cout<<"V final   ="<<std::endl, V, ker_dim, M, M,true);
+		delete[] Qt ;
+		return V;
+
+	}
+
+	template<class Field>
+	typename Field::Element *
+	LeftNullspaceIndirect ( const Field & F,		// in place
+				typename Field::Element * A,
+				const size_t & M, // rows
+				const size_t & N, // colm
+				const size_t & lda, // leading dimension
+				//typename  Field::Element &* V ,
+				size_t & coker_dim )
+	{
+		size_t *P = new size_t[M];
+		size_t *Qt = new size_t[N];
+		size_t R = FFPACK::LUdivine (F, FFLAS::FflasNonUnit, FFLAS::FflasTrans,
+					     M, N, A, lda, P, Qt, FFPACK::FfpackLQUP);
+		delete[] Qt;
+
+		coker_dim = M-R ;			// dimension of kernel
+		if (coker_dim == 0) {
+			delete[] P ;
+			return NULL ;			// only 0 in kernel
+		}
+		size_t ldV = M ;
+		typename Field::Element * V = new typename Field::Element[coker_dim*M];	// Result here.
+		if (R == 0) {
+			delete[] P ;
+			Identity(F,V,ldV,0,0,coker_dim,M);
+			return V ;
+		}
+
+		for (size_t i = 0 ; i < coker_dim ; ++i)	// copy U2 to result V before updating with U1
+			FFLAS::fcopy (F, R, V + i * ldV, 1, A + (R + i)*lda, 1);
+		typename Field::Element one, minus_one ;
+		F.init(one,1UL);
+		F.neg(minus_one, one);
+		FFLAS::ftrsm(F, FFLAS::FflasRight, FFLAS::FflasLower,
+			     FFLAS::FflasNoTrans, FFLAS::FflasNonUnit,
+			     coker_dim, R, minus_one,  A, lda , V, ldV) ;	// V = U2  ; A = U1 ; U2 <- inv(U1)*U2 ;
+
+		typename Field::Element zero;
+		F.init(zero,0UL);
+		Identity(F,V,ldV,0,R,coker_dim,M);
+#if 0
+		for ( size_t i = 0 ; i < coker_dim ; ++i){	/* filling the rest of V with minus identity */
+			for (size_t j = R ; j < M ; ++j)
+				*(V+i*M+j) = zero ;
+			*(V+i*M+i+R) = one ;
+#if 0 /* FIXME : faster ? */
+			for (size_t j = R ; j < M ; ++j) {
+				if (j == i+R)
+					*(V+M*i+j) = one ;
+				else
+					*(V+M*i+j) = zero ;
+			}
+#endif
+		}
+#endif
+
+		FFPACK::applyP(F, FFLAS::FflasRight, FFLAS::FflasNoTrans,
+			       coker_dim, 0, R, V, ldV , P);		// X = P^{-1}V
+		delete[] P;
+		return V;
+
+	}
+
+	// directement à gauche (X LQUP noyau de U puis invQ invL...)
+	template<class Field>
+	typename Field::Element *
+	LeftNullspaceDirect ( const Field & F,		// in place
+			      typename Field::Element * A,
+			      const size_t & M, // rows
+			      const size_t & N, // colm
+			      const size_t & lda, // leading dimension
+			      size_t & coker_dim)
+	{
+
+		size_t *P = new size_t[N];
+		size_t *Q = new size_t[M];
+
+		//write_field (F, std::cout<<"A avant LU   ="<<std::endl, A, M, N, N, true);
+		size_t R = FFPACK::LUdivine (F, FFLAS::FflasNonUnit, FFLAS::FflasNoTrans,
+					     M, N, A, lda, P, Q, FFPACK::FfpackLQUP);
+		assert(R<=std::min(M,N));
+
+		//write_field (F, std::cout<<"ALU :="<<std::endl, A, M, N, N, true);
+		//PrintLapackPermutation(P,N,std::cout<<"Permutation P := ");
+		//PrintPermutation(F , FFLAS::FflasNoTrans, P, N, 0, N, std::cout, true);
+		//PrintLapackPermutation(Q,M,std::cout<<"Permutation Q := ");
+		//PrintPermutation(F , FFLAS::FflasTrans, Q, M, 0, M, std::cout, true);
+		//PrintLQUP (F,FFLAS::FflasUnit,FFLAS::FflasNoTrans,M,N,A,R,std::cout<<"L.Q.U.P"<<std::endl,Q,P,true);
+		coker_dim = M -R ; // dimension of co-kernel.
+		//std::cout << "coker_dim = " << coker_dim << std::endl;
+		delete[] P; // on s'en fout de P !
+		if (coker_dim == 0){
+			delete[] Q ;
+			return NULL;	// CoKernel is \f$\{\mathbf{0}_n\}\f$
+		}
+
+		typename Field::Element one, zero ; // 1,0 dans le corps
+		F.init(one,1UL);
+		F.init(zero,0UL);
+
+		size_t ldV = M ;
+		typename Field::Element * V = new typename Field::Element[coker_dim * M]; // le résultat sera ici.
+		if (R == 0) {
+			delete[] Q ;
+			Identity(F,V,ldV,0,0,coker_dim,M);
+			return V ;
+		}
+		Zero    (F,V,ldV,0,0,coker_dim,R);
+		Identity(F,V,ldV,0,R,coker_dim,M);
+		// write_field (F, std::cout<<"V init   ="<<std::endl, V, coker_dim, M, M,true);
+		FFPACK::applyP(F, FFLAS::FflasRight, FFLAS::FflasNoTrans,
+			       coker_dim, 0, R, V, ldV, Q); // V = V  tQ
+
+		//write_field (F, std::cout<<"V reordered   ="<<std::endl, V, coker_dim, M, M,true);
+
+		// actually we just select a line in the inverse of L.
+		//size_t wda = M ;
+		if (M <= N) {
+			for ( size_t i=0; i< M; ++i )
+				for (size_t j = i ; j<N; ++j )
+					*(A+i*N+j) = zero;
+
+			FFPACK::applyP( F, FFLAS::FflasRight, FFLAS::FflasNoTrans, M,0,M, A, N, Q );
+			for ( size_t i=0; i< M; ++i )
+				*(A+N*i+i) = one ;
+
+			//write_field (F, std::cout<<"A avant trsm   ="<<std::endl, A, M, N, N,true);
+			FFLAS::ftrsm(F, FFLAS::FflasRight, FFLAS::FflasLower,
+				     FFLAS::FflasNoTrans, FFLAS::FflasUnit,
+				     coker_dim , M , one,  A, lda , V, ldV) ; // V = V inv(Lower) ;
+		}
+		else { // M > N we can't ftrsm because we can't add 0's to the lower part...
+			typename Field::Element * L = new typename Field::Element[M*M]; // L_inf
+
+			for ( size_t i=0; i< M; ++i ){ // copying A_inf to L
+				size_t j=0;
+				for (; j< std::min(i,N) ; ++j )
+					*(L+i*M+j) = *(A+N*i+j);
+				for (; j<M; ++j )
+					*(L+i*M+j) = zero;
+			}
+			FFPACK::applyP( F, FFLAS::FflasRight, FFLAS::FflasNoTrans, M,0,R, L, M, Q );
+			for ( size_t i=0; i< M; ++i )
+				*(L+M*i+i) = one ;
+
+			//write_field (F, std::cout<<"U_1="<<std::endl, L, M, M, M,true);
+			FFLAS::ftrsm(F, FFLAS::FflasRight, FFLAS::FflasLower,
+				     FFLAS::FflasNoTrans, FFLAS::FflasUnit,
+				     coker_dim , M , one,  L, M , V, ldV) ; // V = V inv(Lower) ;
+
+			delete[] L;
+		}
+		//write_field (F, std::cout<<"V final   ="<<std::endl, V, coker_dim, M, M,true);
+		delete[] Q ;
+		return V;
+	}
+
+	template<class Field>
+	size_t
+	NullSpaceBasis (const Field& F, const LinBoxTag::Side Side,
+			const size_t & m, const size_t & n,
+			typename Field::Element * A, const size_t & lda,
+			typename Field::Element *& Ker, size_t& ldk,
+			size_t & kerdim)
+	{
+		if (Side == LinBoxTag::Right){
+			if (m < n)
+				Ker = RightNullspaceDirect(F,A,m,n,lda,kerdim) ;
+			else
+				Ker = RightNullspaceIndirect(F,A,m,n,lda,kerdim) ;
+			ldk = kerdim;
+
+		}
+		else {
+			if (m < n)
+				Ker = LeftNullspaceDirect(F,A,m,n,lda,kerdim) ;
+			else
+				Ker = LeftNullspaceIndirect(F,A,m,n,lda,kerdim) ;
+			ldk = m;
+		}
+		return kerdim;
+	}
+
+	template<class Field>
+	size_t&
+	NullSpaceBasis (const Field& F, const LinBoxTag::Side Side,
+			BlasMatrix<typename Field::Element> & A,
+			BlasMatrix<typename Field::Element> & Ker,
+			size_t & kerdim)
+	{
+
+		typename Field::Element * Ker_ptr;
+		size_t ldk;
+		NullSpaceBasis(F,Side,A.rowdim(),A.coldim(), A.getWritePointer(),A.getStride(), Ker_ptr,ldk,kerdim);
+		if (Side == LinBoxTag::Right){
+			Ker = BlasMatrix<typename Field::Element>(A.rowdim(),kerdim);
+		}
+		else {
+			Ker = BlasMatrix<typename Field::Element>(kerdim,A.coldim());
+		}
+		//! @todo this is slow : use a constructor from Ker ?
+		for(typename BlasMatrix<typename Field::Element>::RawIterator it=Ker.rawBegin(); it!= Ker.rawEnd(); ++it,++Ker_ptr)
+			*it=*Ker_ptr;
+		delete[] Ker_ptr ;
+		return kerdim;
+	}
+
+
+} // LinBox
+
+#endif // __LINBOX_dense_nullspace_INL
diff --git a/linbox/algorithms/det-rational.h b/linbox/algorithms/det-rational.h
new file mode 100644
index 0000000..185769f
--- /dev/null
+++ b/linbox/algorithms/det-rational.h
@@ -0,0 +1,332 @@
+/* -*- 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
+/* linbox/blackbox/rational-reconstruction-base.h
+ * Copyright (C) 2009 Anna Marszalek
+ *
+ * Written by Anna Marszalek <aniau at astronet.pl>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_det_rational_H
+#define __LINBOX_det_rational_H
+
+#include "linbox/util/commentator.h"
+#include "linbox/util/timer.h"
+#include "linbox/field/modular-double.h"
+
+//#include "linbox/field/gmp-rational.h"
+#include "linbox/field/PID-integer.h"
+#include "linbox/blackbox/rational-matrix-factory.h"
+#include "linbox/blackbox/dense.h"
+#include "linbox/algorithms/varprec-cra-early-single.h"
+#include "linbox/algorithms/cra-domain.h"
+#include "linbox/algorithms/rational-reconstruction-base.h"
+#include "linbox/algorithms/classic-rational-reconstruction.h"
+#include "linbox/solutions/det.h"
+//#include "linbox/blackbox/apply.h"
+#include "linbox/algorithms/last-invariant-factor.h"
+#include "linbox/algorithms/rational-solver.h"
+#include <vector>
+
+namespace LinBox
+{
+	/*
+	 * Computes the determinant of a rational dense matrix
+	 */
+
+	/* looks for the same integer value by 2 methods */
+	template<class T1, class T2>
+	struct MyModularDet{
+		T1* t1;
+		T2* t2;
+
+		int switcher;
+
+		MyModularDet(T1* s1, T2* s2, int s = 1)  {t1=s1; t2=s2;switcher = s;}
+
+		int setSwitcher(int s) {return switcher = s;}
+
+		template<typename Int, typename Field>
+		Int& operator()(Int& P, const Field& F) const
+		{
+			if (switcher ==1) {
+				t1->operator()(P,F);
+			}
+			else {
+				t2->operator()(P,F);
+			}
+			return P;
+		}
+	};
+
+	/* PrecDet variant of algorithm
+	 * mul is D, and div is d>1 if corrections are run
+	 * */
+	template <class Blackbox, class MyMethod>
+	struct MyRationalModularDet {
+		const Blackbox &A;
+		const MyMethod &M;
+		const Integer &mul;//multiplicative prec;
+		const Integer ÷
+
+		MyRationalModularDet(const Blackbox& b, const MyMethod& n,
+				     const Integer & p1, const Integer & p2) :
+			A(b), M(n), mul(p1), div(p2)
+		{}
+		MyRationalModularDet(MyRationalModularDet& C) :
+			MyRationalModularDet(C.A,C.M,C.mul)
+		{}
+
+		void setDiv (const Integer& d) {div = d;}
+		void detMul (const Integer& m) {mul = m;}
+
+		template<typename Int, typename Field>
+		Int& operator()(Int& P, const Field& F) const
+		{
+			typedef typename Blackbox::template rebind<Field>::other FBlackbox;
+			FBlackbox Ap(A, F);
+			det (P, Ap, typename FieldTraits<Field>::categoryTag(), M);
+			typename Field::Element e;
+			F.init(e, mul);
+			F.mulin(P,e);
+			F.init(e, div);
+			return F.divin(P,e);
+		}
+	};
+
+	/* PrecMat variant of algorithm
+	 * no multiple. no divisor
+	 */
+	template <class Blackbox, class MyMethod>
+	struct MyIntegerModularDet {
+		const Blackbox &A;
+		const MyMethod &M;
+
+		MyIntegerModularDet(const Blackbox& b, const MyMethod& n) :
+			A(b), M(n)
+		{}
+
+		MyIntegerModularDet(MyIntegerModularDet& C) :
+			MyIntegerModularDet(C.A,C.M)
+		{}
+
+		template<typename Int, typename Field>
+		Int& operator()(Int& P, const Field& F) const
+		{
+			typedef typename Blackbox::template rebind<Field>::other FBlackbox;
+			FBlackbox Ap(A, F);
+			return det( P, Ap, typename FieldTraits<Field>::categoryTag(), M);
+		}
+	};
+
+	/*
+	 * Corrects the matrix by removing gcd of columns
+	 */
+
+	template <class Blackbox>
+	typename Blackbox::Field::Element& corrections(Blackbox& IntBB, typename Blackbox::Field::Element& f)
+	{
+		f = 1;
+		for (size_t j=0; j < IntBB.coldim(); ++j) {
+			Integer g = 0;
+			for (size_t i=0; i < IntBB.rowdim(); ++i) {
+				gcd(g,g,IntBB.getEntry(i,j));
+			}
+			f*=g;
+			for (size_t i=0; i < IntBB.rowdim(); ++i) {
+				Integer x = IntBB.getEntry(i,j);
+				IntBB.setEntry(i,j,x/g);
+			}
+		}
+		return f;
+	}
+
+	template <class Rationals, class MyMethod >
+	typename Rationals::Element& rational_det (typename Rationals::Element &d,
+						   const DenseMatrix<Rationals > &A,
+						   const MyMethod &Met=  Method::Hybrid())
+	{
+
+		typedef Modular<double> myModular;
+		typedef typename Rationals::Element Quotient;
+
+		commentator.start ("Rational Det", "Rdeterminant");
+
+		RandomPrimeIterator genprime( 26-(int)ceil(log((double)A.rowdim())*0.7213475205));
+
+		Integer F = 1;
+		Integer M = 1;
+
+		//DenseMatrixBase<Quotient> ABase(A);
+		RationalMatrixFactory<PID_integer,Rationals, DenseMatrix<Rationals > > FA(&A);
+		Integer di=1;
+
+		for (int i=A.rowdim()-1; i >= 0 ; --i) {
+			FA.denominator(di,i);
+			M *=di;
+		}
+
+		PID_integer Z;
+		DenseMatrix<PID_integer> Atilde(Z,A.rowdim(), A.coldim());
+		FA.makeAtilde(Atilde);
+
+		UserTimer t0, t1,t2;bool term = false;
+		t0.clear();
+		t0.start();
+
+		corrections(Atilde,F);
+
+		ChineseRemainder< VarPrecEarlySingleCRA<Modular<double> > > cra(3UL);
+		MyRationalModularDet<DenseMatrix<Rationals > , MyMethod> iteration1(A, Met, M, F);
+		MyIntegerModularDet<DenseMatrix<PID_integer>, MyMethod> iteration2(Atilde, Met);
+		MyModularDet<MyRationalModularDet<DenseMatrix<Rationals > , MyMethod>,
+		MyIntegerModularDet<DenseMatrix<PID_integer>, MyMethod> >  iteration(&iteration1,&iteration2);
+
+		RReconstruction<PID_integer, ClassicMaxQRationalReconstruction<PID_integer> > RR;
+
+		Integer dd; // use of integer due to non genericity of cra. PG 2005-08-04
+		size_t k = 4;
+		t1.clear();
+		t2.clear();
+		t1.start();
+		term = cra(k,dd,iteration1,genprime);
+		t1.stop();
+		t2.start();
+		term = cra(k,dd,iteration2,genprime);
+		t2.stop();
+
+		double s1 = t1.time(), s2 = t2.time();
+
+		if (t1.time() < t2.time()) {
+			//cout << "ratim " << std::flush;
+			iteration.setSwitcher(1);
+		}
+		else {
+			//cout << "intim " << std::flush;
+			iteration.setSwitcher(2);
+			s1 = s2;
+		}
+
+		//switch: LIF
+		std::vector<typename PID_integer::Element> v(A.rowdim()), r(A.rowdim());
+		++genprime;
+		for(size_t i=0; i < v.size(); ++i) {
+			v[i] = rand() % (*genprime) ;
+		}
+		t2.clear();
+		t2.start();
+		for (size_t i=0; i < k; ++i)
+			Atilde.apply(r,v);
+		t2.stop();
+		s2 = t2.time();
+
+		Integer lif = 1;
+		if ((s1 > 4*s2) && (!term)){
+			//cout << "lif " << std::flush;
+			RationalSolver < PID_integer , Modular<double>, RandomPrimeIterator, DixonTraits > RSolver;
+			LastInvariantFactor < PID_integer ,RationalSolver < PID_integer, Modular<double>, RandomPrimeIterator, DixonTraits > >  LIF(RSolver);
+			std::vector<Integer> r_num2 (Atilde. coldim());
+			t1.clear();
+			t1.start();
+			if (LIF.lastInvariantFactor1(lif, r_num2, Atilde)==0) {
+				std::cerr << "error in LIF\n" << std::flush;
+				dd = 0;
+			}
+			t1.stop();
+			cra.changePreconditioner(lif,1);
+		}
+
+		k *= 2;
+		t1.clear();t2.clear();
+		while (! cra(k,dd, iteration, genprime)) {
+			k *=2;
+			Integer m,res,res1; //Integer r; Integer a,b;
+			cra.getModulus(m);
+			cra.getResidue(res);//no need to divide
+			Integer D_1;
+			inv(D_1,M,m);
+			res = (res*D_1) % m;
+			res1 = (res*lif) % m;
+
+			Integer den;
+			Integer num;
+
+			bool rrterm = false;
+
+			t1.start();
+			if ((rrterm = RR.reconstructRational(num,den,res1,m))) {
+				t1.stop();
+				cra.changePreconditioner(num*M,den*F);
+				if (cra(5,dd,iteration,genprime) ) {
+					cra.getResidue(dd);
+					num *=dd;
+					//cout << "without lif " << std::flush;
+				}
+				else rrterm = false;
+			}
+			else 	{//we use num approx by lif
+				t1.stop();
+				t2.start();
+				if ((rrterm = RR.reconstructRational(num,den,res,m))) {
+					t2.stop();
+					cra.changePreconditioner(num*M,den*F*lif);
+					if (cra(5,dd,iteration,genprime) ) {
+						cra.getResidue(dd);
+						num *=dd;
+						den *=lif;
+						//cout << "with lif " << std::flush;
+					}
+					else rrterm = false;
+				}
+				else t2.stop();
+			}
+			if (rrterm) {
+				integer t,tt;
+				Rationals Q;
+				Q.init(d, num, den);
+				Q.get_den(t,d);Q.get_num(tt,d);
+				//cout << "terminated by RR at step "<< (int)(log(k)/log(2)) << " in " << std::flush;
+				t0.stop();
+				return d;
+			}
+			else {
+				//cout << "rollback" << std::flush;
+				cra.changePreconditioner(lif,1);
+			}
+		}
+		cra.result(dd);
+
+		integer t;
+
+		Rationals Q;
+		dd *=F;
+		Q.init(d, dd,M);
+		Q.get_den(t, d);
+		//err = M/t;
+		//cout << "terminated by ET at step "<< (int)(log(k)/log(2)) << "in " << std::flush;
+
+		commentator.stop ("done", NULL, "Iminpoly");
+
+		t0.stop();
+		return d;
+
+	}
+
+}
+
+#endif //__LINBOX_det_rational_H
+
diff --git a/linbox/algorithms/diophantine-solver.C b/linbox/algorithms/diophantine-solver.C
new file mode 100644
index 0000000..b07cbe5
--- /dev/null
+++ b/linbox/algorithms/diophantine-solver.C
@@ -0,0 +1,32 @@
+/* -*- 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
+/* Copyright (C) LinBox
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#include <linbox/algorithms/diophantine-solver.h>
+
+namespace LinBox
+{
+
+	const char* solverReturnString[6]
+	= {"OK", "FAILED", "SINGULAR", "INCONSISTENT", "BAD_PRECONDITIONER", "BAD_PRIME"};
+
+}
diff --git a/linbox/algorithms/diophantine-solver.h b/linbox/algorithms/diophantine-solver.h
index 1a42dd6..bfde0e0 100644
--- a/linbox/algorithms/diophantine-solver.h
+++ b/linbox/algorithms/diophantine-solver.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* linbox/algorithms/diophantine-solver.h
  * Copyright (C) 2004 David Pritchard
  *
@@ -21,8 +22,8 @@
  */
 
 
-#ifndef __LINBOX_DIOPHANTINE_SOLVER_H
-#define __LINBOX_DIOPHANTINE_SOLVER_H
+#ifndef __LINBOX_diophantine_solver_H
+#define __LINBOX_diophantine_solver_H
 
 #include <linbox/algorithms/rational-solver.h>
 #include <linbox/solutions/methods.h>
@@ -30,12 +31,12 @@
 #include <linbox/blackbox/lambda-sparse.h>
 #include <linbox/blackbox/compose.h>
 
-namespace LinBox {
-	
-	const char* solverReturnString[] 
-	= {"OK", "FAILED", "SINGULAR", "INCONSISTENT", "BAD_PRECONDITIONER", "BAD_PRIME"};
+namespace LinBox
+{
 
-	/** 
+	extern const char* solverReturnString[6] ;
+
+	/**
 	 * \brief DiophantineSolver<QSolver> creates a diophantine solver using a QSolver to generate rational solutions
 
 	 * Methods solve, randomSolve just expose functions from underlying rational solver.
@@ -45,7 +46,7 @@ namespace LinBox {
 	 */
 	template<class QSolver>
 	class DiophantineSolver {
-		
+
 	protected:
 
 		typedef typename QSolver::RingType    Ring;
@@ -62,71 +63,75 @@ namespace LinBox {
 
 		VectorFraction<Ring>                  lastCertificate;
 
-		/* Constructor from a rationalSolver
-		 * @param rs  , a rationalSolver
+		/*! Constructor from a rationalSolver
+		 * @param rs  a rationalSolver
 		 */
 		DiophantineSolver (QSolver& rs) :
 			_rationalSolver(rs), _R(rs.getRing()), lastCertificate(_R, 0) {
-			_R.init(_rone, 1);
-		};
-
-		/** Solve a linear system Ax=b over quotient field of a ring
-		 * 
-		 * @param A        , Matrix of linear system
-		 * @param x        , Vector in which to store solution
-		 * @param b        , Right-hand side of system
-		 * @param maxPrimes, maximum number of moduli to try
-		 * @param level    , level of certification to be used
+				_R.init(_rone, 1);
+			};
+
+		/** Solve a linear system \c Ax=b over quotient field of a ring.
+		 *
+		 * @param A        Matrix of linear system
+		 * @param x        Vector in which to store solution
+		 * @param b        Right-hand side of system
+		 * @param maxPrimes maximum number of moduli to try
+		 * @param level    level of certification to be used
+		 * @param den
 		 *
-		 * @return status of solution. if (return != SS_FAILED), and (level >= SL_LASVEGAS), solution is guaranteed correct.
-		 *   SS_FAILED - all primes used were bad
-		 *   SS_OK - solution found. 
-		 *   SS_INCONSISTENT - system appreared inconsistent. certificate is in lastCertificate if (level >= SL_CERTIFIED)
+		 * @return status of solution. if \c (return != SS_FAILED), and \c (level >= SL_LASVEGAS), solution is guaranteed correct.
+		 *   \c SS_FAILED - all primes used were bad
+		 *   \c SS_OK - solution found.
+		 *   \c SS_INCONSISTENT - system appreared inconsistent. certificate is in \p lastCertificate if \c (level >= SL_CERTIFIED)
 		 */
 		template<class IMatrix, class Vector1, class Vector2>
-		SolverReturnStatus solve(Vector1& x, Integer& den, const IMatrix& A, const Vector2& b, const int maxPrimes = DEFAULT_MAXPRIMES, 
+		SolverReturnStatus solve(Vector1& x, Integer& den, const IMatrix& A, const Vector2& b, const int maxPrimes = DEFAULT_MAXPRIMES,
 					 const SolverLevel level = SL_DEFAULT);
 
-		/** Find a random solution of the general linear system Ax=b over quotient field of a ring.
-		 * 
-		 * @param A        , Matrix of linear system
-		 * @param x        , Vector in which to store solution
-		 * @param b        , Right-hand side of system
-		 * @param maxPrimes, maximum number of moduli to try
-		 * @param level    , level of certification to be used
+		/** Find a random solution of the general linear system \c Ax=b over quotient field of a ring.
 		 *
-		 * @return status of solution. if (return != SS_FAILED), and (level >= SL_LASVEGAS), solution is guaranteed correct.
-		 *   SS_FAILED - all primes used were bad
-		 *   SS_OK - solution found. 
-		 *   SS_INCONSISTENT - system appreared inconsistent. certificate is in lastCertificate if (level >= SL_CERTIFIED)
+		 * @param A        Matrix of linear system
+		 * @param x        Vector in which to store solution
+		 * @param b        Right-hand side of system
+		 * @param maxPrimes maximum number of moduli to try
+		 * @param level    level of certification to be used
+		 * @param den
+		 *
+		 * @return status of solution. if \c (return != SS_FAILED), and \c (level >= SL_LASVEGAS), solution is guaranteed correct.
+		 *  \c  SS_FAILED - all primes used were bad
+		 *  \c  SS_OK - solution found.
+		 *  \c  SS_INCONSISTENT - system appreared inconsistent. certificate is in \p lastCertificate if \c (level >= SL_CERTIFIED)
 		 */
 		template<class IMatrix, class Vector1, class Vector2>
-		SolverReturnStatus randomSolve(Vector1& x, Integer& den, const IMatrix& A, const Vector2& b, const int maxPrimes = DEFAULT_MAXPRIMES, 
+		SolverReturnStatus randomSolve(Vector1& x, Integer& den, const IMatrix& A, const Vector2& b, const int maxPrimes = DEFAULT_MAXPRIMES,
 					       const SolverLevel level = SL_DEFAULT);
- 
-		/** 
-		 * Find a solution of the linear system Ax=b whose denominator (when written as an integer vector over a single denom) is minimal.
+
+		/**
+		 * Find a solution of the linear system \c Ax=b whose denominator (when written as an integer vector over a single denom) is minimal.
 		 *
-		 * @param A        , Matrix of linear system
-		 * @param x        , Vector in which to store solution
-		 * @param b        , Right-hand side of system
-		 * @param maxPrimes, maximum number of moduli to try
-		 * @param level    , level of certification to be used
+		 * @param A        Matrix of linear system
+		 * @param x        Vector in which to store solution
+		 * @param b        Right-hand side of system
+		 * @param maxPrimes maximum number of moduli to try
+		 * @param level     level of certification to be used
+		 * @param den
 		 *
-		 * @return status of solution. if (return != SS_FAILED) and (level >= SL_LASVEGAS), solution is guaranteed correct
-		 *                             if (return == SS_OK) and (level >= SL_LASVEGAS), solution is guaranteed minimal.
-		 *   SS_FAILED - all primes used were bad
-		 *   SS_OK - solution found. certificate of minimality is in lastCertificate if (level >= SL_CERTIFIED)
-		 *   SS_INCONSISTENT - system appreared inconsistent. certificate of inconsistency is in lastCertificate if (level >= SL_CERTIFIED)
+		 * @return status of solution. if \c (return != SS_FAILED) and \c  (level >= SL_LASVEGAS), solution is guaranteed correct
+		 *                             if \c (return == SS_OK) and \c (level >= SL_LASVEGAS), solution is guaranteed minimal.
+		 *   \c SS_FAILED - all primes used were bad
+		 *   \c SS_OK - solution found. certificate of minimality is in lastCertificate if \c (level >= SL_CERTIFIED)
+		 *  \c SS_INCONSISTENT - system appreared inconsistent. certificate of inconsistency is in \p lastCertificate if \c (level >= SL_CERTIFIED)
 		 *
 		 * @return status of solution - OK, FAILED, SINGULAR, INCONSISTENT, BAD_PRECONDITIONER
-		 */	
+		 */
 		template<class IMatrix, class Vector1, class Vector2>
-		SolverReturnStatus diophantineSolve(Vector1& x, Integer& den, const IMatrix& A, const Vector2& b, const int maxPrimes = DEFAULT_MAXPRIMES, 
+		SolverReturnStatus diophantineSolve(Vector1& x, Integer& den, const IMatrix& A, const Vector2& b, const int maxPrimes = DEFAULT_MAXPRIMES,
 						    const SolverLevel level = SL_DEFAULT);
 	};
 
 }
 #include <linbox/algorithms/diophantine-solver.inl>
 
-#endif
+#endif //__LINBOX_diophantine_solver_H
+
diff --git a/linbox/algorithms/diophantine-solver.inl b/linbox/algorithms/diophantine-solver.inl
index 711c55e..1765df0 100644
--- a/linbox/algorithms/diophantine-solver.inl
+++ b/linbox/algorithms/diophantine-solver.inl
@@ -1,4 +1,5 @@
 /* -*- 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
 /* linbox/algorithms/diophantine-solver.inl
  * Copyright (C) 2004 David Pritchard
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_DIOPHANTINE_SOLVER_INL
-#define __LINBOX_DIOPHANTINE_SOLVER_INL
+#ifndef __LINBOX_diophantine_solver_INL
+#define __LINBOX_diophantine_solver_INL
 
 #include <linbox/blackbox/dense.h>
 #include <linbox/blackbox/sparse.h>
@@ -38,45 +39,49 @@
 
 #define MONTE_CARLO_BOREDOM 21
 
-namespace LinBox {
+namespace LinBox
+{
 
 
 	template<class QSolver>
 	template<class IMatrix, class Vector1, class Vector2>
-	SolverReturnStatus DiophantineSolver<QSolver>::solve 
-	(Vector1& x, Integer& den, const IMatrix& A, const Vector2& b, const int maxPrimes, const SolverLevel level) {
-		
+	SolverReturnStatus DiophantineSolver<QSolver>::solve
+	(Vector1& x, Integer& den, const IMatrix& A, const Vector2& b, const int maxPrimes, const SolverLevel level)
+	{
+
 		SolverReturnStatus result = _rationalSolver.solve(x, den, A, b, false, maxPrimes, level);
-		if (result == SS_INCONSISTENT && level >= SL_CERTIFIED) 
+		if (result == SS_INCONSISTENT && level >= SL_CERTIFIED)
 			lastCertificate.copy(_rationalSolver.lastCertificate);
 		return result;
 	}
-	
+
 	template<class QSolver>
-	template<class IMatrix, class Vector1, class Vector2>	
-	SolverReturnStatus DiophantineSolver<QSolver>::randomSolve 
-	(Vector1& x, Integer& den, const IMatrix& A, const Vector2& b, const int maxPrimes, const SolverLevel level) {
-		
+	template<class IMatrix, class Vector1, class Vector2>
+	SolverReturnStatus DiophantineSolver<QSolver>::randomSolve
+	(Vector1& x, Integer& den, const IMatrix& A, const Vector2& b, const int maxPrimes, const SolverLevel level)
+	{
+
 		SolverReturnStatus result = _rationalSolver.findRandomSolution(x, den, A, b, maxPrimes, level);
-		if (result == SS_INCONSISTENT && level >= SL_CERTIFIED) 
+		if (result == SS_INCONSISTENT && level >= SL_CERTIFIED)
 			lastCertificate.copy(_rationalSolver.lastCertificate);
 		return result;
 	}
-	
+
 	template<class QSolver>
-	template<class IMatrix, class Vector1, class Vector2>	
-	SolverReturnStatus DiophantineSolver<QSolver>::diophantineSolve 
-	(Vector1& x, Integer& den, const IMatrix& A, const Vector2& b, const int maxPrimes, const SolverLevel level) {
+	template<class IMatrix, class Vector1, class Vector2>
+	SolverReturnStatus DiophantineSolver<QSolver>::diophantineSolve
+	(Vector1& x, Integer& den, const IMatrix& A, const Vector2& b, const int maxPrimes, const SolverLevel level)
+	{
 
 		//here maxPrimes is only used to bound trials of initial solution
 		SolverReturnStatus status;
-		
+
 		//this should eliminate all inconsistent systems; when level == SL_MONTECARLO maybe not.
 		status = _rationalSolver.monolithicSolve(x, den, A, b, (level >= SL_LASVEGAS), true, maxPrimes, level);
 		if (status != SS_OK) {
-			if (status == SS_FAILED && maxPrimes > 2) 
+			if (status == SS_FAILED && maxPrimes > 2)
 				std::cout << "ERROR, failed to find original solution and maxPrimes is not too small!" << std::endl;
-			if (status == SS_INCONSISTENT && level >= SL_CERTIFIED) 
+			if (status == SS_INCONSISTENT && level >= SL_CERTIFIED)
 				lastCertificate.copy(_rationalSolver.lastCertificate);
 			return status;
 		}
@@ -86,7 +91,7 @@ namespace LinBox {
 		y. denom = den;
 		VectorFraction<Ring> y0(y);
 
-		Integer ODB = y0.denom, n1; //ODB -- original denominator bound. equal to g(y0) from Muld+Storj. 
+		Integer ODB = y0.denom, n1; //ODB -- original denominator bound. equal to g(y0) from Muld+Storj.
 		if (level >= SL_CERTIFIED) {
 			lastCertificate.copy(_rationalSolver.lastCertificate);
 			_R.assign(n1, _rationalSolver.lastZBNumer);
@@ -94,11 +99,11 @@ namespace LinBox {
 
 		Integer upperDenBound = ODB;
 		Integer lowerDenBound;
-		if (level >= SL_LASVEGAS) 
+		if (level >= SL_LASVEGAS)
 			lowerDenBound = _rationalSolver.lastCertifiedDenFactor;
 		else
 			_R.init(lowerDenBound, 1);
-#ifdef DEBUG_DIO	       
+#ifdef DEBUG_DIO
 		std::cout << "lower bound on denominator: " << lowerDenBound << std::endl;
 		std::cout << "upper bound on denominator: " << upperDenBound << std::endl;
 #endif
@@ -110,7 +115,7 @@ namespace LinBox {
 			_rationalSolver.chooseNewPrime();
 			status = _rationalSolver.monolithicSolve(x, den, A, b, (level >= SL_LASVEGAS), true, 1, level);
 			numSolutionsNeeded++;
-#ifdef DEBUG_DIO	       
+#ifdef DEBUG_DIO
 			std::cout << '.' ;
 #endif
 			if (status != SS_OK) {
@@ -121,7 +126,7 @@ namespace LinBox {
 			yhat. numer = x;
 			yhat. denom = den;
 			// goodCombination first represents whether a decrease in upperDenBound is achieved
-			bool goodCombination = y.boundedCombineSolution(yhat, ODB, upperDenBound); 
+			bool goodCombination = y.boundedCombineSolution(yhat, ODB, upperDenBound);
 
 			if (goodCombination) {
 				numRevelantSolutions++;
@@ -130,50 +135,54 @@ namespace LinBox {
 #endif
 			}
 			// now, goodCombination will be updated as to whether there is an increase in lowerDenBound
-			if (level == SL_MONTECARLO) { 
+			if (level == SL_MONTECARLO) {
 				if (goodCombination)
 					boredom = 0;
-				else 
+				else
 					boredom++;
-				if (boredom > MONTE_CARLO_BOREDOM) 
+				if (boredom > MONTE_CARLO_BOREDOM)
 					break; //exit while loop
 				goodCombination = false;          //since we dont update lowerDenBound, no increase happens
 			}
 			else if (level == SL_LASVEGAS) {
 #ifdef DEBUG_DIO
 				goodCombination =
-					!_R.isDivisor(lowerDenBound, _rationalSolver.lastCertifiedDenFactor);
+				!_R.isDivisor(lowerDenBound, _rationalSolver.lastCertifiedDenFactor);
 #endif
 				_R.lcmin(lowerDenBound, _rationalSolver.lastCertifiedDenFactor);
 			}
 			else { //level == SL_CERTIFIED
 
-// 				paranoid check
-// 				if (_R.isZero(_rationalSolver.lastCertifiedDenFactor)) {
-// 					std::cout << "ERROR: got a 0 den factor" << std::endl;
-// 					return SS_FAILED;
-// 				}
+				// 				paranoid check
+				// 				if (_R.isZero(_rationalSolver.lastCertifiedDenFactor)) {
+				// 					std::cout << "ERROR: got a 0 den factor" << std::endl;
+				// 					return SS_FAILED;
+				// 				}
 
 				goodCombination = lastCertificate.combineCertificate
-					(_rationalSolver.lastCertificate, n1, lowerDenBound,
-					 _rationalSolver.lastZBNumer, 
-					 _rationalSolver.lastCertifiedDenFactor);
+				(_rationalSolver.lastCertificate, n1, lowerDenBound,
+				 _rationalSolver.lastZBNumer,
+				 _rationalSolver.lastCertifiedDenFactor);
 			}
 #ifdef DEBUG_DIO
-			if (goodCombination) 
+			if (goodCombination)
 				std::cout << "new certified denom factor: " << lowerDenBound << std::endl;
 #endif
 		}
 #ifdef INFO_DIO
 		std::cout << "number of solutions needed in total: " << numSolutionsNeeded << std::endl;
 		std::cout << "number of failed calls to solver: " << numFailedCallsToSolver << std::endl;
-#endif		
+#endif
 		y.combineSolution(y0);
 		//y.toFVector(x);
 		x   = y.numer;
 		den = y.denom;
 		return SS_OK;
 	}
-	
+
 } //end of namespace LinBox
-#endif
+
+#undef MONTE_CARLO_BOREDOM
+
+#endif //__LINBOX_diophantine_solver_INL
+
diff --git a/linbox/algorithms/diophantine.doxy b/linbox/algorithms/diophantine.doxy
new file mode 100644
index 0000000..a1dcf69
--- /dev/null
+++ b/linbox/algorithms/diophantine.doxy
@@ -0,0 +1,10 @@
+// Copyright (C) 2010 LinBox, GNU LGPL, see COPYING for licence information
+
+/** @ingroup algorithms
+  @defgroup diophant Diophantine solvers
+  @brief NO DOC YET
+
+
+ */
+
+// vim:syntax=doxygen
diff --git a/linbox/algorithms/double-det.h b/linbox/algorithms/double-det.h
index 309ff81..a021c77 100644
--- a/linbox/algorithms/double-det.h
+++ b/linbox/algorithms/double-det.h
@@ -1,33 +1,35 @@
 /* -*- 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
 /* linbox/algorithms/doubledet.h
- * 
+ * Copyright (C) LinBox
+ *
  *  Written by Clement Pernet <clement.pernet at gmail.com>
  *
  * See COPYING for license information.
  */
 
-#ifndef __DOUBLEDET_H
-#define __DOUBLEDET_H
+#ifndef __LINBOX_doubledet_H
+#define __LINBOX_doubledet_H
 
-#include "linbox/ffpack/ffpack.h"
-#include "linbox/algorithms/matrix-hom.h"	
+#include "fflas-ffpack/ffpack/ffpack.h"
+#include "linbox/algorithms/matrix-hom.h"
 #include "linbox/algorithms/cra-domain.h"
 #include "linbox/algorithms/cra-full-multip.h"
 #include "linbox/algorithms/cra-early-multip.h"
-#include "linbox/randiter/random-prime.h"	
+#include "linbox/randiter/random-prime.h"
 #include "linbox/solutions/solve.h"
 #include "linbox/solutions/methods.h"
 #include <vector>
-namespace LinBox 
+
+namespace LinBox
 {
-	
+
 	/* Given a (n-1) x n full rank matrix A and 2 vectors b,c mod p,
 	 * compute
 	 * d1 = det( [ A ] ) mod p and d2 = det ( [ A ]) mod p
 	 *           [ b ]                        [ c ]
 	 *
-	 * 
+	 *
 	 * A, b, c will be overwritten.
 	 */
 	template <class Field>
@@ -40,7 +42,7 @@ namespace LinBox
 
 		size_t* P = new size_t[N];
 		size_t* Qt = new size_t[N-1];
-		
+
 		FFPACK::LUdivine (F, FFLAS::FflasUnit, FFLAS::FflasNoTrans, N-1, N,
 				  A, lda, P, Qt);
 		typename Field::Element d;
@@ -69,7 +71,7 @@ namespace LinBox
 
 		F.mul (d1, d, *(b + (N-1) * incb));
 		F.mul (d2, d, *(c + (N-1) * incc));
-		
+
 		delete[] P;
 		delete[] Qt;
 	}
@@ -83,57 +85,58 @@ namespace LinBox
 		const typename BlackBox::Field::Element _s2;
 		IntegerDoubleDetIteration(const BlackBox& A,
 					  const typename BlackBox::Field::Element& s1,
-					  const typename BlackBox::Field::Element& s2)
-			: _A(A), _s1(s1), _s2(s2) {}
+					  const typename BlackBox::Field::Element& s2) :
+			_A(A), _s1(s1), _s2(s2)
+		{}
 
 		template<class Field>
 		std::vector<typename Field::Element>&
 		operator () (std::vector<typename Field::Element>& dd,
-			     const Field& F) const {
+			     const Field& F) const
+		{
 
 			typedef typename BlackBox::template rebind<Field>::other FBlackbox;
-			FBlackbox * Ap;
 			typename Field::Element s1p, s2p;
 			dd.resize(2);
 			F.init(s1p, _s1);
 			F.init(s2p, _s2);
-			MatrixHom::map(Ap, _A, F);
+			FBlackbox Ap(_A, F);
 			const size_t N = _A.coldim();
 			//Timer tim;
 			//tim.clear();
 			//tim.start();
 			doubleDetModp (F,  N, dd[0], dd[1],
-				       Ap->getPointer(), Ap->getStride(),
-				       Ap->getPointer() + (N-1) * Ap->getStride(), 1,
-				       Ap->getPointer() + N * Ap->getStride(), 1);
+				       Ap.getPointer(), Ap.getStride(),
+				       Ap.getPointer() + (N-1) * Ap.getStride(), 1,
+				       Ap.getPointer() + N * Ap.getStride(), 1);
 
 			F.divin (dd[0], s1p);
 			F.divin (dd[1], s2p);
 			//tim.stop();
 			//std::cerr<<"doubleDetModp took "<<tim.usertime()<<std::endl;
-			delete Ap;
 			return dd;
 		}
 	};
 
-	/* Computes the actual Hadamard bound of the matrix A by taking the minimum 
+	/* Computes the actual Hadamard bound of the matrix A by taking the minimum
 	 * of the column-wise and the row-wise euclidean norm.
-	 * 
+	 *
 	 * A is supposed to be over integers.
 	 *
 	 */
 	// should use multiprec floating pt arith, wait, maybe not!
 	template<class BlackBox>
-	integer& HadamardBound (integer& hadamarBound, const BlackBox& A){
-		
-		
+	integer& HadamardBound (integer& hadamarBound, const BlackBox& A)
+	{
+
+
 		integer res1 = 1;
 		integer res2 = 1;
 		integer temp;
-		
+
 		typename BlackBox::ConstRowIterator rowIt;
 		typename BlackBox::ConstRow::const_iterator col;
-		
+
 		for( rowIt = A.rowBegin(); rowIt != A.rowEnd(); ++rowIt ) {
 			temp = 0;
 			for( col = rowIt->begin(); col != rowIt->end(); ++col )
@@ -144,7 +147,7 @@ namespace LinBox
 
 		typename BlackBox::ConstColIterator colIt;
 		typename BlackBox::ConstCol::const_iterator row;
-		
+
 		for( colIt = A.colBegin(); colIt != A.colEnd(); ++colIt ) {
 			temp = 0;
 			for( row = colIt->begin(); row != colIt->end(); ++row )
@@ -152,41 +155,45 @@ namespace LinBox
 			res2 *= temp;
 		}
 		res2 = sqrt(res2);
-		
+
+		return hadamarBound = MIN(res1, res2);
+	}
+
+#if 0
+	template<class BlackBox>
+	double& HadamardBound (double& hadamarBound, const BlackBox& A)
+	{
+
+
+		double res1 = 0;
+		double res2 = 0;
+		integer temp;
+
+		typename BlackBox::ConstRowIterator rowIt;
+		typename BlackBox::ConstRow::const_iterator col;
+
+		for( rowIt = A.rowBegin(); rowIt != A.rowEnd(); ++rowIt ) {
+			temp = 0;
+			for( col = rowIt->begin(); col != rowIt->end(); ++col )
+				temp += static_cast<integer>((*col)) * (*col);
+			res1 += log ((double)temp);
+		}
+		res1 = res1/2;
+
+		typename BlackBox::ConstColIterator colIt;
+		typename BlackBox::ConstCol::const_iterator row;
+
+		for( colIt = A.colBegin(); colIt != A.colEnd(); ++colIt ) {
+			temp = 0;
+			for( row = colIt->begin(); row != colIt->end(); ++row )
+				temp += static_cast<integer>((*row)) * (*row);
+			res2 += log((double)temp);
+		}
+		res2 = res2/2;
+
 		return hadamarBound = MIN(res1, res2);
 	}
-// 	template<class BlackBox>
-// 	double& HadamardBound (double& hadamarBound, const BlackBox& A){
-		
-		
-// 		double res1 = 0;
-// 		double res2 = 0;
-// 		integer temp;
-		
-// 		typename BlackBox::ConstRowIterator rowIt;
-// 		typename BlackBox::ConstRow::const_iterator col;
-		
-// 		for( rowIt = A.rowBegin(); rowIt != A.rowEnd(); ++rowIt ) {
-// 			temp = 0;
-// 			for( col = rowIt->begin(); col != rowIt->end(); ++col )
-// 				temp += static_cast<integer>((*col)) * (*col);
-// 			res1 += log ((double)temp);
-// 		}
-// 		res1 = res1/2;
-
-// 		typename BlackBox::ConstColIterator colIt;
-// 		typename BlackBox::ConstCol::const_iterator row;
-		
-// 		for( colIt = A.colBegin(); colIt != A.colEnd(); ++colIt ) {
-// 			temp = 0;
-// 			for( row = colIt->begin(); row != colIt->end(); ++row )
-// 				temp += static_cast<integer>((*row)) * (*row);
-// 			res2 += log((double)temp);
-// 		}
-// 		res2 = res2/2;
-		
-// 		return hadamarBound = MIN(res1, res2);
-// 	}
+#endif
 
 	/* Given a (N+1) x N full rank matrix
 	 * [ A ]
@@ -209,13 +216,14 @@ namespace LinBox
 				     typename BlackBox::Field::Element& d2,
 				     const typename BlackBox::Field::Element& s1,
 				     const typename BlackBox::Field::Element& s2,
-				     const bool proof){
+				     const bool proof)
+	{
 
 		typename BlackBox::Field F = A.field();
 		IntegerDoubleDetIteration<BlackBox> iteration(A, s1, s2);
 		// 0.7213475205 is an upper approximation of 1/(2log(2))
-		RandomPrimeIterator genprime( 25-(int)ceil(log((double)A.rowdim())*0.7213475205)); 
-		
+		RandomPrimeIterator genprime( 25-(int)ceil(log((double)A.rowdim())*0.7213475205));
+
 		std::vector<typename BlackBox::Field::Element> dd;
 		if (proof) {
 			integer bound;
@@ -236,7 +244,8 @@ namespace LinBox
 			//t_cra.stop();
 			//std::cerr<<"CRA : "<<t_cra.usertime()<<"s"<<std::endl;
 
-		} else {
+		}
+		else {
 			ChineseRemainder <EarlyMultipCRA <Modular<double> > > cra(4UL);
 			cra (dd, iteration, genprime);
 		}
@@ -252,17 +261,18 @@ namespace LinBox
 	 * d1 = det( [ A ] ) and d2 = det ( [ A ])
 	 *           [ b ]                  [ c ]
 	 */
-	
+
 	template <class BlackBox>
 	void doubleDet (typename BlackBox::Field::Element& d1,
 			typename BlackBox::Field::Element& d2,
 			const BlackBox& A,
 			//const vector<typename BlackBox::Field::Element>& b,
 			//const vector<typename BlackBox::Field::Element>& c,
-			bool proof){
+			bool proof)
+	{
 
 		linbox_check (A.coldim() == A.rowdim()+1);
-		
+
 		const size_t N = A.coldim();
 		//		BlasBlackbox<typename BlackBox::Field> B (A,0,0,N,N);
 		BlasBlackbox<typename BlackBox::Field> B (A.field(),N,N);
@@ -285,10 +295,10 @@ namespace LinBox
 		solve (x1, den1, B, c);
 		//tim.stop();
 		//std::cerr<<"Solve took "<<tim.usertime()<<std::endl;
-		
+
 		den1 = den1;
 		// Should work:
-		// den (y[n]) = den (-den1/x[n]) = x[n] 
+		// den (y[n]) = den (-den1/x[n]) = x[n]
 		den2 = -x1[N-1];
 		//tim.clear();
 		//tim.start();
@@ -300,4 +310,5 @@ namespace LinBox
 }
 
 
-#endif // __DOUBLEDET_H
+#endif // __LINBOX_doubledet_H
+
diff --git a/linbox/algorithms/dyadic-to-rational.h b/linbox/algorithms/dyadic-to-rational.h
new file mode 100644
index 0000000..2d637d4
--- /dev/null
+++ b/linbox/algorithms/dyadic-to-rational.h
@@ -0,0 +1,436 @@
+#ifndef __DYADICTORATIONAL_H
+#define __DYADICTORATIONAL_H
+/* dyadic-to-rational.h
+ *
+ * dyadicToRational reconstructs a rational a/b from dyadic approximation n/2^k.
+ *
+ * It is used in rational-solver-sn
+ *
+ * "Rational reconstruction" starts from a p-adic approximation.
+ * This is different though very similar
+ *
+ *  Evolved by bds from rational-reconstruction2.h by Z. Wan.
+ *
+ *  standard linbox copyright/license applies.  See COPYING.
+ */
+
+#include <stack>
+#include <assert.h>
+#include <vector>
+
+//#include <linbox/integer.h>
+
+namespace LinBox{
+
+/** Rational reconstruction of a/b from n/d with denominator bound B.
+ * We give a/b, the continued fraction approximant of n/d that
+ * satisfies |a/b - n/d| < 1/2d (well approximated) and 0 < b <= B.
+ * Return value is 0, if no such approximant exists.
+ * Return value is 1, if either
+ *   (i) a second well approximated rational with denominator bounded by B may exist, or
+ *   (ii) the well approximated condition is not met for a/b.
+ *   In these cases, a/b may be used speculatively.
+ * Return value is 2, if the approximant is guaranteed (because bB <= d).
+
+ * If no fraction is well approximated the last b <= B in the remainder sequence of n,d is given.
+ *
+ * If d = 2^k and n = sum_i=l to k n_i 2^i, then * n/d = sum_{i=l down to 0} n_i/2^{k-i}
+ * is a {\em dyadic rational}.  Numbers of this form are produced for example by
+ * numeric-symbolic iterations.
+ *
+ * If it is known that n/d is the most accurate approximation with denominator d
+ * to a/b, and that the denominator b is bounded by B, i.e. b <= B, then such a/b is
+ * uniquely determined, provided d >= bB.
+ * ...in that case, such a/b is returned by dyadicToRational().
+ * This follows from two facts:
+ * First, by definition, n/d is an accurate approximation to a/b
+ * with b <= d when |n/d - a/b| < 1/2d.
+ * Otherwise (n-1)/d or (n+1)/d would be a better approximation.
+ * Second, if a/b and a'/b' are distinct rationals, then |a/b - a'/b'| >= 1/bb'.
+ * Thus if a'/b' is another rational accurately approximated by n/d,
+ * we have 1/bb' <= |a/b - a'/b'| <= |a/b - n/d| + |n/d - a'/b'| <= 1/2d + 1/2d = 1/d.
+ * So bb' > d >= bB, thus b' > B.
+ *
+ * In summary: If it exists, the unique a/b is given such that n/d approximates a/b
+ * to within 1/2d and b <= B.  Otherwise a plausible a/b is given or failure is signaled.
+ *
+ * "Symbolic-Numeric Exact Rational Linear System Solver" by Saunders, Wood, Youse.
+ * describes the construction.
+ */
+template<class Ring>
+int dyadicToRational (
+	const Ring& Z,
+	typename Ring::Element& a, typename Ring::Element& b,
+	const typename Ring::Element& n, const typename Ring::Element& d,
+	const typename Ring::Element& B)
+{
+	typedef typename Ring::Element Int;
+	Int e; Z.init(e);// error term
+
+	Int an; Z.init(an); Z.abs(an, n/*q*/);
+
+	// Partial_hegcd is defined below.
+	bool found = partial_hegcd(Z, e, b, an, d/*q*/, B); // e = b*an - ?*d and |b| <= B
+	Z.axmyin(e, b, an); 
+	Z.div(a, e, d); //a = (e - b*an)/d, div is exact.
+//std::cout << "Z.axmyin(e, b, an); " << e << " " << b << " " << an << ", a = e/d exact " << a << " " << d << std::endl;
+	// now a/b is solution but signs may be wrong
+	Z.abs(a,a);
+	Z.abs(b,b);
+	Int zero; Z.init(zero, 0);
+	if (Z.compare(n, zero) < 0)  Z.negin(a); // a = -a;
+
+//std::cout << "DtR in n, d " << n << " "<< d << ", bound " << B << ", out a, b " << a << " " << b << std::endl; 
+	bool guarantee = b*B < d;
+	if (found && guarantee) return 2;
+	if (b == 0) return 0;
+	return 1; //if ((!found && b > 0) || (found && ! guarantee)) return 1;
+}
+
+/** partial_hegcd() sets e, b from the remainder sequence of n,d.
+ * It requires positive n and d.
+ * It sets e to the first r_i (remainder) and
+ * b to the corresponding q_i (coefficient of n)
+ * such that 2r_i < |q_i| and |q_i| <= B (the given denominator bound).
+ * True is returned iff such e, b exist.
+ *
+ * If not, b is the largest q_i such that |q_i| <= B,
+ * and e is the corresponding remainder.  In this case b is the denominator
+ * of a plausibly approximated but not well approximated rational.
+ * It can be used speculatively.
+ */
+// later reintroduce swapping trick
+template<class Ring>
+bool partial_hegcd(Ring& Z, typename Ring::Element& e, typename Ring::Element& b, const typename Ring::Element& n, const typename Ring::Element& d, const typename Ring::Element& denBound){
+	typedef typename Ring::Element Int;
+	Int quo, r, tmp;  Z.init(quo); Z.init(r); Z.init(tmp);
+	bool withinbound, wellapproximated;
+
+	Int b0; Z.init(b0, 1); // and a0 = -0
+	Int r0; Z.init(r0, n); // so that r0 = b0*n - a0*d
+	Int b1; Z.init(b1, -0); // and a1 = 1
+	Int r1; Z.init(r1, d); // so that r1 = b1*n - a1*d
+//std::cout << "init 1 -0: " << b0 << " " << b1 << std::endl;
+
+	do {
+//std::cout << "quorem from " << r0 << " " << b0 << " and " << r1 << " " << b1 << std::endl;
+		Z.quoRem(quo, e, r0, r1);
+		//integer::divmod (quo, e, r0, r1);
+		b = b0;
+		Z.axmyin(b, quo, b1);
+		Z.negin(b); // b = b0 - quo*b1;
+//std::cout << "Z.axmyin(b, quo, b1);// b = b0 - quo*b1;" << b << " " << b0 << " " << quo << " " << b1 << std::endl;
+		r0 = r1; b0 = b1;
+		r1 = e; b1 = b;
+		//assert(r1 >= 0);
+		Z.abs(tmp, b);
+		withinbound = (Z.compare(tmp, denBound) <= 0);
+	    wellapproximated = (Z.compare(2*e , tmp) <= 0);
+	}
+	while ( ! wellapproximated && withinbound );
+	if (! withinbound) {e = r0; b = b0;} // make available for speculation
+//std::cout << "withinbound " << withinbound << " e b " << e << " " << b << ", n/d " << n << "/" << d << ", denBound " << denBound << std::endl;
+	return withinbound;
+	// returning with first well approximated (small remainder e) or last within bound denom b.
+
+} // partial_hegcd
+
+// vector rational reconstruction building num, den from numx, denx
+template<class Ring>
+int dyadicToRational(
+	const Ring& Z,
+	std::vector<typename Ring::Element>& num, typename Ring::Element& den,
+	std::vector<typename Ring::Element>& numx, typename Ring::Element& denx,
+	typename Ring::Element& denBound)
+{
+	typedef typename Ring::Element Int;
+	Int q, rem, tmp_den, nx;
+	Z.init(q); Z.init(rem); Z.init(tmp_den); Z.init(nx);
+	Int one; Z.init(one, 1);
+	Int two; Z.init(two, 2);
+	Int denx2;
+	Z.init(denx2, denx); Z.divin(denx2, two);// denx2 = denx/2, for balancing remainders.
+	std::stack<std::pair<size_t, Int> > S;
+	Int tmp; Z.init(tmp);
+
+	Int den_lcm; Z.init(den_lcm, 1);
+	den = den_lcm; // = 1.
+
+	S.push(std::pair<int, Int>(0, 1));
+	Int e; Z.init(e);// e for error
+	int ret = 2; // 2 means guaranteed, 1 possible, 0 fail.
+	for (size_t i = 0; i < num.size(); ++i) {
+		Z.abs(nx, numx[i]);
+		Z.mul(tmp, nx, den);
+		Z.quoRem(num[i], e, tmp, denx); //nx*den - num[i]*denx = e, with num[i] and e nonneg.
+		// we need |nx/denx - num[i]/den| == e/den*denx <= 1/2denx, so 2e <= den.
+		// adjust to balanced remainder e.
+		if (Z.compare(e, denx2) >= 0) {Z.subin(e, denx), Z.addin(num[i], one); }
+		//nx*den = num[i]*denx + e , thus |nx/denx - num[i]/den| = e/denx*den
+
+	// can try e < den && 2*e < den for speed
+		Z.mul(tmp, two, Z.abs(e));
+		if ( Z.compare(tmp, den) > 0)// 2|e| > den
+		{   // we failed, so need another reconstruction
+			int oneret = dyadicToRational (Z, tmp, tmp_den, nx, denx, denBound);
+			if (oneret == 1) ret = 1;
+			if ( oneret == 0 ) return oneret;
+			//std::cerr << i << " tmp " << tmp << " num[i] " << num[i] << std::endl;
+			num[i] = tmp;
+
+			Z.lcm (den_lcm, tmp_den, den);
+			Z.div( tmp, den_lcm, tmp_den ); // exact
+			Z.mulin( num[i], tmp ); // num[i]/den_lcm = prev num[i]/tmp_den.
+
+			Z.div(tmp, den_lcm, den); // exact
+			// must multiply all prior num[i] by this tmp.
+			S.push(std::pair<size_t, Int>(i, tmp));
+			den = den_lcm;
+			//assert(Z.compare(den, denBound)<=0);
+			if (Z.compare(den, denBound)>0) return false; // den > denBound
+		}
+
+		Int zero; Z.init(zero);
+		if (Z.compare(numx[i], zero) < 0) Z.negin(num[i]); // numx[i] < 0
+
+	}
+	// now fix shorties
+	Int t; Z.init(t, 1);
+	while ( S.size() > 1 ) {
+		Z.mulin(t, S.top().second);
+		int k = S.top().first; S.pop();
+		int j = S.top().first;
+		for (int i = k-1; i >= j; --i) {
+			Z.mulin(num[i], t);
+		}
+	}
+	S.pop();
+	return ret;
+
+} // vector dyadicToRational
+
+/* ****
+// vector rational reconstruction building num, den from numx, denx
+// This one -- very inefficient -- just reconstructs each one, then goes thru to fix for lcm.
+void rational_reconstruction(std::vector<integer>& num, integer& den, std::vector<integer>& numx, integer& denx, integer& denBound) {
+	integer den_tmp, missing_factor;
+	den = 1;
+	for (size_t i = 0; i < numx.size(); ++i) {
+		rational_reconstruction(num[i], den_tmp, numx[i], denx, denBound);
+		lcm(missing_factor, den_tmp, den);
+		den = missing_factor;
+	}
+	for (size_t i = 0; i < numx.size(); ++i) {
+		rational_reconstruction(num[i], den_tmp, numx[i], denx, denBound);
+		integer::divexact (missing_factor, den, den_tmp);
+		num[i] *= missing_factor;
+	}
+} // vector rational_reconstruction
+**** */
+
+}// LinBox
+#endif // __DYADICTORATIONAL_H
+
+#ifdef TestingDyadicToRational
+using namespace LinBox;
+
+#include <vector>
+#include <cmath>
+#include <linbox/field/PID-integer.h>
+#include "linbox/util/timer.h"
+#include <linbox/util/commentator.h>
+
+int test1(size_t k, size_t dxa, size_t denBs) {
+
+/* Check reconstruction of i/k when it is well approximated
+by something over dxa and when the denominator bound (for k) is denBs.
+Values of numerator i from -k-2 to k+2 are checked.
+When dxa^2 <= denBs, 2 should be returned.
+*/
+	typedef PID_integer Ring; Ring Z;
+	typedef Ring::Element Int;
+
+//std::cout << "test1(k " << k << ", dxa " << dxa << ", denBs " << denBs << ")" << std::endl;
+	// k is our denominator
+	Int denB = denBs; // denominator bound
+	// approximate(i*k^2)/k for i = 0..k-1
+	size_t kp = k+2;
+	size_t kp2 = 2*kp;
+	std::vector<Int> nx(kp2);
+	for (size_t i = 0; i < kp2 ; ++i) Z.init(nx[i],floor(((double(i)-double(kp))*dxa)/k + 0.5));
+	// |nx[i]/dxa - (i-kp)/k| <= 1/2dxa
+	std::vector<Int> n(kp2);
+	Int d;
+	bool pass = true;
+	bool claim;
+	int ret = 2;
+
+	// check of individual reconstructions
+	Int dx; Z.init(dx, dxa);
+	int c;
+	// individual reconstructions
+	for (size_t i = 0; i < kp2 ; ++i) {
+	    bool loopclaim = true;
+//std::cout << nx[i] << " " << dx << " " << denB << std::endl;
+		c = dyadicToRational(Z, n[i], d, nx[i], dx, denB);
+//std::cout << " c " << c << " n " << n[i] << " d " << d << " nx " << nx[i] << " dx " << dx << " denB " << denB << std::endl;
+		loopclaim = ((c > 0)  && (n[i]*k == ((int(i)-int(kp))*d)));
+		if ( c == 2 ) loopclaim = loopclaim && d*denB < dx;
+		if (c < ret) ret = c;
+		if (! loopclaim) ret = 0;
+//if (! claim) std::cout << "F " << pass << claim << ret << std::endl;
+		//if (! loopclaim) 
+//std::cout << "F2 " << loopclaim << " i " << i << " nx/dx " << nx[i] << "/" << dx << ", n/d " << n[i] << "/" << d << std::endl;
+		pass = pass && loopclaim;
+	}
+//std::cout << "result, pass " << pass << " ret " << ret << std::endl;
+
+#if 1
+	// check vector reconstruction
+	c = dyadicToRational(Z, n, d, nx, dx, denB);
+	commentator.report() << "In test1 dyadicToRational returns " << c << std::endl;
+	claim = 0 < c;
+	if (claim) {
+		for (size_t i = 0; i < k ; ++i) claim = claim && (n[i] == (int(i)-int(kp)));
+	}
+	pass = pass && claim;
+	if (!claim) {
+		commentator.report() << "first example fails" << std::endl;
+		commentator.report() << "data for first example" << std::endl;
+		for (size_t i = 0; i < 10 ; ++i)
+			commentator.report() << nx[i] << std::endl;
+		commentator.report() << dx << " den in" << std::endl;
+		commentator.report() << "results for first example" << std::endl;
+		for (size_t i = 0; i < 10 ; ++i)
+			commentator.report() << n[i] << std::endl;
+		commentator.report() << d << " den out" << std::endl;
+	}
+
+	if (c < ret) ret = c;
+	if (! claim) ret = 0;
+	pass = pass && claim;
+//std::cout << "v " << pass << claim << ret << std::endl;
+#endif
+
+	//return pass;
+	return ret;
+}
+
+bool testDyadicToRational(size_t k = 10, bool benchmarking = false) {
+	typedef PID_integer Ring; Ring Z;
+	typedef Ring::Element Int;
+	bool pass = true;
+	bool claim = false;
+	size_t pow2 = 1; // upperbound for k.
+	for (size_t i = k; i > 0; i >>= 1) pow2 *= 2;
+
+	UserTimer clock;
+	double totaltime = 0;
+
+	clock.clear(); clock.start();
+	claim = 1 <= test1(k, pow2*pow2, k); // some 1's and some 2's
+	if (!claim) commentator.report() << "failure: 1 !=test1(k, k*k, k)" << std::endl;
+	pass = pass && claim;
+	claim = 1 == test1(k, k*k, k*k); // all 1's
+	if (!claim) commentator.report() << "failure: 1 !=test1(k, k*k, k*k)" << std::endl;
+	pass = pass && claim;
+	claim = 2 == test1(k, k*k+2*k + 1, k+1); // all 2's
+	if (!claim) commentator.report() << "failure: 2 !=test1(k, (k + 1)^2, k+1)" << std::endl;
+	pass = pass && claim;
+	clock.stop(); totaltime += clock.time();
+
+#if 1
+// special case 1
+	Int B; Z.init(B, 1000000000);
+	Int B2; Z.init(B2); B2 = B*B;
+	Int denB = 4*B+294967296; // 2^32
+
+	Int d;
+	Int dxs = denB*denB; // 2^64
+	size_t k2 = 10;
+	std::vector<Int> nx;
+	std::vector<Int> n;
+	nx.resize(k2);
+	n.resize(k2);
+
+	nx[0] =-143*B2-298423624*B-962150784;
+	nx[1] = 239*B2+120348615*B+509085366;
+	nx[2] =  -4*B2-959983787*B-562075119;
+	nx[3] =  27*B2+  8864641*B+551149627;
+	nx[4] =  62*B2+971469325*B+838237476;
+	nx[5] = 190*B2+559070838*B+297135961;
+	nx[6] = 176*B2+172593329*B+811309753;
+	nx[7] = -70*B2-861003759*B-845628342;
+	nx[8] =-228*B2-416339507*B-338896853;
+	nx[9] = -14*B2-398832745*B-762391791;
+
+	claim = 0 < dyadicToRational(Z, n, d, nx, dxs, denB);
+
+	if (!claim) commentator.report() << "in special case 1 failure claimed" << std::endl;
+
+	pass = pass && claim;
+
+	std::vector<Int> ntrue(k2);
+	Int dentrue = 691617936;
+    ntrue[0] = -5*B-372642434;
+	ntrue[1] =  8*B+965263534;
+	ntrue[2] =  -185963102;
+	ntrue[3] =  1*B+ 12634812;
+	ntrue[4] =  2*B+360969365;
+	ntrue[5] =  7*B+144570919;
+	ntrue[6] =  6*B+605183272;
+	ntrue[7] = -2*B-656769182;
+	ntrue[8] = -8*B-563941509;
+	ntrue[9] =     -539850878;
+	claim = (d == dentrue);
+	for (size_t i = 0; i < k2 ; ++i) claim = claim && (n[i] == ntrue[i]);
+	pass = pass && claim;
+
+	if (!claim)
+	{
+	commentator.report() << "data for failing special case 1" << std::endl;
+	for (size_t i = 0; i < k2 ; ++i)
+		commentator.report() << nx[i] << std::endl;
+	commentator.report() << dxs << " den in" << std::endl;
+	commentator.report() << "results for failing special case 1" << std::endl;
+	for (size_t i = 0; i < k2 ; ++i)
+		commentator.report() << n[i] << std::endl;
+	commentator.report() << d << " den out" << std::endl;
+	}
+
+#endif
+#if 1
+// case where false should be returned.
+	denB = 1023*B+948656640;
+
+	dxs = 4*B2+611686018*B+427387904;
+	size_t k3 = 10;
+	nx.resize(k3);
+	n.resize(k3);
+
+	nx[0] =  -4*B2-474720817*B-626139615;
+	nx[1] =  -9*B2-632772311*B-132715070;
+	nx[2] = -19*B2-805041562*B-739831073;
+	nx[3] =  35*B2+521355378*B+297487606;
+    nx[4] =  27*B2+922294617*B+624925795;
+    nx[5] =   1*B2+494454325*B+592253092;
+    nx[6] = -27*B2-985233904*B-197462327;
+    nx[7] = -20*B2-336729946*B-917106131;
+    nx[8] = -42*B2-807924857*B-450940124;
+    nx[9] = -27*B2-863559911*B-142533799;
+
+
+	// this should fail
+	claim = 2 > dyadicToRational(Z, n, d, nx, dxs, denB);
+//std::cout << "d " << d << " dxs " << dxs << " denB " << denB << std::endl;
+
+    pass = pass && claim;
+	if (claim) commentator.report() << "third ratrecon falsely claims success" << std::endl;
+#endif
+
+// done
+	if (benchmarking) commentator.report() << "vec size" << k << ", rat recon time: " << clock << " totaltime " << totaltime << std::endl;
+	return pass;
+}
+#endif // TestingRationalReconstructionSN
+
diff --git a/linbox/algorithms/echelon-form.h b/linbox/algorithms/echelon-form.h
index bcf8182..dc18029 100644
--- a/linbox/algorithms/echelon-form.h
+++ b/linbox/algorithms/echelon-form.h
@@ -1,6 +1,6 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* linbox/algorithms/sigma-basis.h
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* linbox/algorithms/echelon-form.h
  * Copyright (C) 2006 Pascal Giorgi
  *
  * Written by Pascal Giorgi pascal.giorgi at univ-perp.fr
@@ -23,8 +23,8 @@
 
 
 
-#ifndef __ECHELON_FORM_H
-#define __ECHELON_FORM_H
+#ifndef __LINBOX_echelon_form_H
+#define __LINBOX_echelon_form_H
 
 #include <linbox/matrix/blas-matrix.h>
 #include <linbox/algorithms/blas-domain.h>
@@ -32,49 +32,49 @@
 #include <linbox/matrix/matrix-domain.h>
 #include <linbox/matrix/factorized-matrix.h>
 
- 
-
-namespace LinBox {
-
-
+namespace LinBox
+{
 
 	template<class Field>
 	class EchelonFormDomain{
-	
+
 	private:
-	
+
 		Field                      _F;
 		BlasMatrixDomain<Field>  _BMD;
 		MatrixDomain<Field>       _MD;
-	
+
 	public:
 		typedef typename Field::Element Element;
 
 		// constructor
-		EchelonFormDomain(const Field &F) : _F(F), _BMD(F), _MD(F) {}
-		
+		EchelonFormDomain(const Field &F) :
+			_F(F), _BMD(F), _MD(F)
+		{}
+
 
-		//  row echelon form 
+		//  row echelon form
 		// E is supposed to be the zero matrix
 		template<class Matrix>
-		int rowEchelon(Matrix &E, const Matrix& A){
+		int rowEchelon(Matrix &E, const Matrix& A)
+		{
 
 			size_t m,n, rank;
 			m = A.rowdim();
 			n = A.coldim();
-			
+
 			// get the transposed of A
-			BlasMatrix<Element> At(n, m);			
+			BlasMatrix<Element> At(n, m);
 			for (size_t i=0;i<m;++i)
 				for (size_t j=0;j<n;++j)
 					At.setEntry(j,i,A.getEntry(i,j));
 
 
 			rank = columnEchelon(At);
-					
+
 			// read the transpose of the echelon form from the rank 1st column of L
 			for (size_t i=0; i<rank;++i)
-				for (size_t j=0;j<n;++j){					
+				for (size_t j=0;j<n;++j){
 					E.setEntry(i,j, At.getEntry(j,i));
 				}
 			return rank;
@@ -85,18 +85,19 @@ namespace LinBox {
 
 		// row reduced echelon form (using copy)
 		template<class Matrix>
-		int rowReducedEchelon(Matrix &E, const Matrix& A){
+		int rowReducedEchelon(Matrix &E, const Matrix& A)
+		{
 
 			size_t m,n, rank;
 			m = A.rowdim();
 			n = A.coldim();
-					
+
 			// get the transposed of A
-			BlasMatrix<Element> At(n, m);			
+			BlasMatrix<Element> At(n, m);
 			for (size_t i=0;i<m;++i)
 				for (size_t j=0;j<n;++j)
 					At.setEntry(j,i,A.getEntry(i,j));
-	
+
 			rank = columnReducedEchelon(At);
 
 			// read the transpose of the echelon form from the rank 1st column of At
@@ -105,16 +106,17 @@ namespace LinBox {
 					E.setEntry(i,j, At.getEntry(j,i));
 			return rank;
 		}
-			
+
 
 		//  column echelon form (using copy)
 		template<class Matrix>
-		int columnEchelon(Matrix &E, const Matrix& A){
+		int columnEchelon(Matrix &E, const Matrix& A)
+		{
 
 			size_t m,n;
 			m = A.rowdim();
 			n = A.coldim();
-	       
+
 			// copy  A in E
 			for (size_t i=0;i<m;++i)
 				for (size_t j=0;j<n;++j)
@@ -126,10 +128,11 @@ namespace LinBox {
 
 		// column reduced echelon form (using copy)
 		template<class Matrix>
-		int columnReducedEchelon(Matrix &E, const Matrix& A){
+		int columnReducedEchelon(Matrix &E, const Matrix& A)
+		{
 
 			size_t m,n;
-		
+
 			m = A.rowdim();
 			n = A.coldim();
 
@@ -140,10 +143,11 @@ namespace LinBox {
 
 			return columnReducedEchelon(E);
 		}
-		
+
 		// column echelon form (IN-PLACE VERSION)
 		template<class Matrix>
-		int columnEchelon(Matrix &E){
+		int columnEchelon(Matrix &E)
+		{
 
 			size_t m,n, rank;
 			m = E.rowdim();
@@ -151,16 +155,18 @@ namespace LinBox {
 			Element zero, one;
 			_F.init(zero,0);
 			_F.init(one,1);
-		
+
+			BlasPermutation<size_t> P(E.coldim());
+			BlasPermutation<size_t> Qt(E.rowdim());
 			// compute the LQUP of E
-			LQUPMatrix<Field> LQUP(_F, E);		
+			LQUPMatrix<Field> LQUP(_F, E,P,Qt);
 
 			// get the rank
 			rank = LQUP.getrank();
-					
+
 			// get permutation Qt
-			BlasPermutation Qt = LQUP.getQ();				
-		
+			// BlasPermutation<size_t> Qt = LQUP.getQ();
+
 			// Zero out upper triangular part of E
 			for (size_t i=0;i<m;++i)
 				for (size_t j=i;j<n;++j)
@@ -170,15 +176,16 @@ namespace LinBox {
 			for (size_t i=0;i<rank;++i){
 				E.setEntry(*(Qt.getPointer()+i),i,one);
 			}
-			
+
 			return rank;
 		}
 
 		// column reduced echelon form (IN-PLACE VERSION)
 		template<class Matrix>
-		int columnReducedEchelon(Matrix &E){
+		int columnReducedEchelon(Matrix &E)
+		{
 			size_t m,n, rank;
-		
+
 			m = E.rowdim();
 			n = E.coldim();
 			Element zero, one;
@@ -186,14 +193,17 @@ namespace LinBox {
 			_F.init(one,1);
 
 			// compute the LQUP of E
-			LQUPMatrix<Field> LQUP(_F, E);
+			BlasPermutation<size_t> P(E.coldim());
+			BlasPermutation<size_t> Qt(E.rowdim());
+
+			LQUPMatrix<Field> LQUP(_F, E, P, Qt);
 
 			// get the rank
 			rank = LQUP.getrank();
-		
-			BlasPermutation Qt = LQUP.getQ();		
-			TransposedBlasMatrix<BlasPermutation> Q(Qt);
-					
+
+			// BlasPermutation<size_t> Qt = LQUP.getQ();
+			TransposedBlasMatrix<BlasPermutation<size_t> > Q(Qt);
+
 			// Zero out upper triangular part of E
 			for (size_t i=0;i<m;++i)
 				for (size_t j=i;j<n;++j)
@@ -204,8 +214,8 @@ namespace LinBox {
 
 			// put one inplace of pivot
 			for (size_t i=0;i<rank;++i)
-				E.setEntry(i,i, one);//*(Qt.getPointer()+i),one);						
-			
+				E.setEntry(i,i, one);//*(Qt.getPointer()+i),one);
+
 			// Update the first r columns of E by Err^(-1)
 			BlasMatrix<Element> Er(E,0,0,rank,rank);
 			TriangularBlasMatrix<Element> Err(Er, BlasTag::low, BlasTag::unit);
@@ -217,7 +227,7 @@ namespace LinBox {
 				for (size_t j=0;j<i;++j)
 					E.setEntry(i,j,zero);
 			}
-			
+
 			// permute L such that L<-Q.E
 			_BMD.mulin_right(Q,E);
 
@@ -225,27 +235,28 @@ namespace LinBox {
 		}
 
 		template<class Matrix>
-		void write_maple(const char* name, const Matrix& A) {
-			
+		void write_maple(const char* name, const Matrix& A)
+		{
+
 			size_t m,n;
 			m = A.rowdim();
 			n = A.coldim();
 			std::cout<<name<<":= Matrix([";
 
 			for (size_t i=0;i<m-1;++i){
-					std::cout<<"[";
-					for (size_t j=0;j<n-1;++j)
-						_F.write(std::cout,A.getEntry(i,j))<<",";
-					_F.write(std::cout, A.getEntry(i,n-1))<<"] , ";
-				}
 				std::cout<<"[";
 				for (size_t j=0;j<n-1;++j)
-					_F.write(std::cout,A.getEntry(m-1,j))<<",";				
-				_F.write(std::cout, A.getEntry(m-1,n-1))<<"]]);\n ";
+					_F.write(std::cout,A.getEntry(i,j))<<",";
+				_F.write(std::cout, A.getEntry(i,n-1))<<"] , ";
+			}
+			std::cout<<"[";
+			for (size_t j=0;j<n-1;++j)
+				_F.write(std::cout,A.getEntry(m-1,j))<<",";
+			_F.write(std::cout, A.getEntry(m-1,n-1))<<"]]);\n ";
 		}
 
 	};
- 
+
 }
 
 #endif
diff --git a/linbox/algorithms/elimination.doxy b/linbox/algorithms/elimination.doxy
new file mode 100644
index 0000000..4fdd9f4
--- /dev/null
+++ b/linbox/algorithms/elimination.doxy
@@ -0,0 +1,10 @@
+// Copyright (C) 2010 LinBox, GNU LGPL, see COPYING for licence information
+
+/** @ingroup algorithms
+  @defgroup elim Elimination
+  @brief NO DOC YET
+
+
+ */
+
+// vim:syntax=doxygen
diff --git a/linbox/algorithms/eliminator.h b/linbox/algorithms/eliminator.h
index 9f4be12..7662388 100644
--- a/linbox/algorithms/eliminator.h
+++ b/linbox/algorithms/eliminator.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* elim.h
  * Copyright (C) 2002 Bradford Hovinen
  *
@@ -13,8 +13,8 @@
  * Elimination code for lookahead block Lanczos
  */
 
-#ifndef __ELIMINATOR_H
-#define __ELIMINATOR_H
+#ifndef __LINBOX_eliminator_H
+#define __LINBOX_eliminator_H
 
 #include "linbox/linbox-config.h"
 
@@ -35,213 +35,223 @@
 #undef _U
 #undef _T
 
-namespace LinBox 
-{
-
-/** Elimination system
- *
- * This is the supporting elimination system for a lookahead-based
- * variant of block Lanczos.
- */
-template <class Field, class Matrix = DenseMatrixBase<typename Field::Element> >
-class Eliminator
+namespace LinBox
 {
-    public:
-
-	typedef typename Field::Element Element;
-
-	/** Permutation
-	 *
-	 * A permutation is represented as a vector of pairs, each
-	 * pair representing a transposition. Thus a permutation
-	 * requires O(n log n) storage and O(n log n) application
-	 * time, as opposed to the lower bound of O(n) for
-	 * both. However, this allows us to decompose a permutation
-	 * easily into its factors, thus eliminating the need for
-	 * additional auxillary storage in each level of the
-	 * Gauss-Jordan transform recursion. Additionally, we expect
-	 * to use this with dense matrices that are "close to
-	 * generic", meaning that the rank should be high and there
-	 * should be relatively little need for transpositions. In
-	 * practice, we therefore expect this to beat the vector
-	 * representation. The use of this representation does not
-	 * affect the analysis of the Gauss-Jordan transform, since
-	 * each step where a permutation is applied also requires
-	 * matrix multiplication, which is strictly more expensive.
-	 */
-	typedef std::pair<unsigned int, unsigned int> Transposition;
-	typedef std::vector<Transposition> Permutation;
-
-	/** Constructor
-	 * @param F Field over which to operate
-	 * @param traits @ref{SolverTraits} structure describing user
-	 *               options for the solver 
-	 */
-	Eliminator (const Field &F, unsigned int N);
-
-	/** Destructor
-	 */
-	~Eliminator ();
 
-	/** Two-sided Gauss-Jordan transform
-	 *
-	 * @param Ainv Inverse of nonsingular part of A
-	 * @param Tu Row dependencies
-	 * @param Tv Column dependencies
-	 * @param P Row permutation
-	 * @param Q Column permutation
-	 * @param A Input matrix
-	 * @param rank Rank of A
-	 */
-	template <class Matrix1, class Matrix2, class Matrix3, class Matrix4>
-	void twoSidedGaussJordan (Matrix1       &Ainv,
-				  Permutation   &P,
-				  Matrix2       &Tu,
-				  Permutation   &Q,
-				  Matrix3       &Tv,
-				  const Matrix4 &A,
-				  unsigned int  &rank);
-
-	/** Permute the input and invert it
-	 *
-	 * Compute the pseudoinverse of the input matrix A and return
-	 * it. First apply the permutation given by the lists leftPriorityIdx
-	 * and rightPriorityIdx to the input matrix so that independent
-	 * columns and rows are more likely to be found on the first indices
-	 * in those lists. Zero out the rows and columns of the inverse
-	 * corresponding to dependent rows and columns of the input. Set S and
-	 * T to boolean vectors such that S^T A T is invertible and of maximal
-	 * size.
-	 *
-	 * @param W Output inverse
-	 * @param S Output vector S
-	 * @param T Output vector T
-	 * @param leftPriorityIdx Priority indices on the left
-	 * @param Rightpriorityidx Priority indices on the right
-	 * @param A Input matrix A
-	 * @return Reference to inverse matrix
-	 */
-	Matrix &permuteAndInvert (Matrix                  &W,
-				  std::vector<bool>       &S,
-				  std::vector<bool>       &T,
-				  std::list<unsigned int> &rightPriorityIdx,
-				  Permutation             &Qp,
-				  unsigned int            &rank,
-				  const Matrix            &A);
-
-	/** Perform a Gauss-Jordan transform using a recursive algorithm
+	/** Elimination system
 	 *
-	 * Upon completion, we have UPA = R, where R is of reduced row
-	 * echelon form
-	 *
-	 * @param U Output matrix U
-	 * @param P Output permutation P
-	 * @param A Input matrix A
-	 * @return Reference to U
-	 */
-	template <class Matrix1, class Matrix2, class Matrix3, class Matrix4>
-	Matrix1 &gaussJordan (Matrix1                   &U,
-			      std::vector<unsigned int> &profile,
-			      Permutation               &P,
-			      Matrix2                   &Tu,
-			      Permutation               &Q,
-			      Matrix3                   &Tv,
-			      unsigned int              &rank,
-			      typename Field::Element   &det,
-			      const Matrix4             &A);
-
-	/** Retrieve the total user time spent permuting and inverting
-	 */
-	double getTotalTime () const { return _total_time; }
-
-	/** Retrieve the total user time spent inverting only
-	 */
-	double getInvertTime () const { return _invert_time; }
-
-	/** Write the filter vector to the given output stream
+	 * This is the supporting elimination system for a lookahead-based
+	 * variant of block Lanczos.
 	 */
-	std::ostream &writeFilter (std::ostream &out, const std::vector<bool> &v) const;
-
-	/** Write the given permutation to the output stream
-	 */
-	std::ostream &writePermutation (std::ostream &out, const Permutation &P) const;
-
-    private:
-	// Compute the kth indexed Gauss-Jordan transform of the input
-	Matrix &kthGaussJordan (unsigned int                  &r,
-				typename Field::Element       &d,
-				unsigned int                   k,
-				unsigned int                   s,
-				unsigned int                   m,
-				const typename Field::Element &d0);
-
-	// Set the given matrix to the identity
-	template <class Matrix1>
-	Matrix1 &setIN (Matrix1 &A) const;
-
-	// Add d * I_N to A
-	template <class Matrix1>
-	Matrix1 &adddIN (Matrix1                       &A,
-			 const typename Field::Element &d) const;
-
-	// Clean out the given priority index list and add new elements as needed
-	void cleanPriorityIndexList (std::list<unsigned int> &list,
-				     std::vector<bool>       &S,
-				     std::vector<bool>       &old_S) const;
-
-	// Permute the given bit vector
-	template <class Iterator>
-	std::vector<bool> &permute (std::vector<bool>  &v,
-				    Iterator            P_start,
-				    Iterator            P_end) const;
-
-	// Construct a permutation from the given priority list
-	Permutation &buildPermutation (Permutation &P, const std::list<unsigned int> &pidx) const;
-
-	// Prepare a minimal permutation based on the given permutation
-	Permutation &buildMinimalPermutation (Permutation &P, unsigned int rank,
-					      unsigned int dim, const Permutation &Pold);
-
-	Permutation &buildMinimalPermutationFromProfile (Permutation &P, unsigned int rank,
-							 unsigned int dim, const std::vector<unsigned int> &profile);
-
-	// Private variables
-
-	const Field                      &_F;
-	VectorDomain<Field>               _VD;
-	MatrixDomain<Field>               _MD;
-	unsigned int                      _N;
-
-	typename Field::Element           _one;
-
-	// Temporaries used in the computation
-
-	mutable Permutation               _P;
-
-	mutable DenseMatrixBase<Element>  _A;         // Variable
-	mutable DenseMatrixBase<Element>  _U;         // Variable
-	mutable DenseMatrixBase<Element>  _tmp;
-
-	// These record the independent rows and columns found during the
-	// elimination process
-
-	mutable std::vector<bool>         _S;         // Independent rows
-	mutable std::vector<bool>         _T;         // Independent columns
-
-	std::vector<unsigned int>         _profile;
-	unsigned int                      _profile_idx;
-
-	// Timer information
-
-	double                            _total_time;
-	double                            _invert_time;
-
-	// Priority indices for rows
-	std::vector<unsigned int>         _indices;
-};
+	template <class Field, class Matrix = DenseMatrixBase<typename Field::Element> >
+	class Eliminator {
+	public:
+
+		typedef typename Field::Element Element;
+
+		/** Permutation.
+		 *
+		 * A permutation is represented as a vector of pairs, each
+		 * pair representing a transposition. Thus a permutation
+		 * requires \p O(n log n) storage and \p O(n log n) application
+		 * time, as opposed to the lower bound of \p O(n) for
+		 * both. However, this allows us to decompose a permutation
+		 * easily into its factors, thus eliminating the need for
+		 * additional auxillary storage in each level of the
+		 * Gauss-Jordan transform recursion. Additionally, we expect
+		 * to use this with dense matrices that are "close to
+		 * generic", meaning that the rank should be high and there
+		 * should be relatively little need for transpositions. In
+		 * practice, we therefore expect this to beat the vector
+		 * representation. The use of this representation does not
+		 * affect the analysis of the Gauss-Jordan transform, since
+		 * each step where a permutation is applied also requires
+		 * matrix multiplication, which is strictly more expensive.
+		 */
+		typedef std::pair<unsigned int, unsigned int> Transposition;
+		typedef std::vector<Transposition> Permutation;
+
+		/** Constructor
+		 * @param F Field over which to operate
+		 * @param N
+		 */
+		Eliminator (const Field &F, unsigned int N);
+
+		/** Destructor
+		*/
+		~Eliminator ();
+
+		/** Two-sided Gauss-Jordan transform
+		 *
+		 * @param Ainv Inverse of nonsingular part of A
+		 * @param Tu Row dependencies
+		 * @param Tv Column dependencies
+		 * @param P Row permutation
+		 * @param Q Column permutation
+		 * @param A Input matrix
+		 * @param rank Rank of A
+		 */
+		template <class Matrix1, class Matrix2, class Matrix3, class Matrix4>
+		void twoSidedGaussJordan (Matrix1       &Ainv,
+					  Permutation   &P,
+					  Matrix2       &Tu,
+					  Permutation   &Q,
+					  Matrix3       &Tv,
+					  const Matrix4 &A,
+					  unsigned int  &rank);
+
+		/** Permute the input and invert it.
+		 *
+		 * Compute the pseudoinverse of the input matrix A and return
+		 * it. First apply the permutation given by the lists leftPriorityIdx
+		 * and rightPriorityIdx to the input matrix so that independent
+		 * columns and rows are more likely to be found on the first indices
+		 * in those lists. Zero out the rows and columns of the inverse
+		 * corresponding to dependent rows and columns of the input. Set S and
+		 * T to boolean vectors such that S^T A T is invertible and of maximal
+		 * size.
+		 *
+		 * @param W Output inverse
+		 * @param S Output vector S
+		 * @param T Output vector T
+		 * @param rightPriorityIdx Priority indices on the right
+		 * @param Qp
+		 * @param rank
+		 * @param A Input matrix A
+		 * @return Reference to inverse matrix
+		 */
+		Matrix &permuteAndInvert (Matrix                  &W,
+					  std::vector<bool>       &S,
+					  std::vector<bool>       &T,
+					  std::list<unsigned int> &rightPriorityIdx,
+					  Permutation             &Qp,
+					  unsigned int            &rank,
+					  const Matrix            &A);
+
+		/** Perform a Gauss-Jordan transform using a recursive algorithm.
+		 *
+		 * Upon completion, we have UPA = R, where R is of reduced row
+		 * echelon form
+		 *
+		 * @param U Output matrix U
+		 * @param P Output permutation P
+		 * @param A Input matrix A
+		 * @param profile
+		 * @param Tu
+		 * @param Q
+		 * @param Tv
+		 * @param rank
+		 * @param det
+		 * @return Reference to U
+		 */
+		template <class Matrix1, class Matrix2, class Matrix3, class Matrix4>
+		Matrix1 &gaussJordan (Matrix1                   &U,
+				      std::vector<unsigned int> &profile,
+				      Permutation               &P,
+				      Matrix2                   &Tu,
+				      Permutation               &Q,
+				      Matrix3                   &Tv,
+				      unsigned int              &rank,
+				      typename Field::Element   &det,
+				      const Matrix4             &A);
+
+		/**
+		 * Retrieve the total user time spent permuting and inverting.
+		 */
+		double getTotalTime () const { return _total_time; }
+
+		/**
+		 * Retrieve the total user time spent inverting only.
+		*/
+		double getInvertTime () const { return _invert_time; }
+
+		/**
+		 * Write the filter vector to the given output stream
+		*/
+		std::ostream &writeFilter (std::ostream &out, const std::vector<bool> &v) const;
+
+		/**
+		 * Write the given permutation to the output stream
+		*/
+		std::ostream &writePermutation (std::ostream &out, const Permutation &P) const;
+
+	private:
+		// Compute the kth indexed Gauss-Jordan transform of the input
+		Matrix &kthGaussJordan (unsigned int                  &r,
+					typename Field::Element       &d,
+					unsigned int                   k,
+					unsigned int                   s,
+					unsigned int                   m,
+					const typename Field::Element &d0);
+
+		// Set the given matrix to the identity
+		template <class Matrix1>
+		Matrix1 &setIN (Matrix1 &A) const;
+
+		// Add d * I_N to A
+		template <class Matrix1>
+		Matrix1 &adddIN (Matrix1                       &A,
+				 const typename Field::Element &d) const;
+
+		// Clean out the given priority index list and add new elements as needed
+		void cleanPriorityIndexList (std::list<unsigned int> &list,
+					     std::vector<bool>       &S,
+					     std::vector<bool>       &old_S) const;
+
+		// Permute the given bit vector
+		template <class Iterator>
+		std::vector<bool> &permute (std::vector<bool>  &v,
+					    Iterator            P_start,
+					    Iterator            P_end) const;
+
+		// Construct a permutation from the given priority list
+		Permutation &buildPermutation (Permutation &P, const std::list<unsigned int> &pidx) const;
+
+		// Prepare a minimal permutation based on the given permutation
+		Permutation &buildMinimalPermutation (Permutation &P, unsigned int rank,
+						      unsigned int dim, const Permutation &Pold);
+
+		Permutation &buildMinimalPermutationFromProfile (Permutation &P, unsigned int rank,
+								 unsigned int dim, const std::vector<unsigned int> &profile);
+
+		// Private variables
+
+		const Field                      &_F;
+		VectorDomain<Field>               _VD;
+		MatrixDomain<Field>               _MD;
+		unsigned int                      _N;
+
+		typename Field::Element           _one;
+
+		// Temporaries used in the computation
+
+		mutable Permutation               _P;
+
+		mutable DenseMatrixBase<Element>  _A;         // Variable
+		mutable DenseMatrixBase<Element>  _U;         // Variable
+		mutable DenseMatrixBase<Element>  _tmp;
+
+		// These record the independent rows and columns found during the
+		// elimination process
+
+		mutable std::vector<bool>         _S;         // Independent rows
+		mutable std::vector<bool>         _T;         // Independent columns
+
+		std::vector<unsigned int>         _profile;
+		unsigned int                      _profile_idx;
+
+		// Timer information
+
+		double                            _total_time;
+		double                            _invert_time;
+
+		// Priority indices for rows
+		std::vector<unsigned int>         _indices;
+	};
 
 } // namespace LinBox
 
 #include "eliminator.inl"
 
-#endif // __ELIMINATOR_H
+#endif // __LINBOX_eliminator_H
+
diff --git a/linbox/algorithms/eliminator.inl b/linbox/algorithms/eliminator.inl
index 93de783..75a0134 100644
--- a/linbox/algorithms/eliminator.inl
+++ b/linbox/algorithms/eliminator.inl
@@ -1,7 +1,7 @@
 /* -*- 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
 /* eliminator.inl
- * Copyright (C) 2002, 2003 Bradford Hovinen
+ * Copyright (C) 2002, 2003 LinBox, Bradford Hovinen
  *
  * Written by Bradford Hovinen <bghovinen at math.waterloo.ca>
  *
@@ -13,8 +13,8 @@
  * Elimination code for lookahead block Lanczos
  */
 
-#ifndef __ELIMINATOR_INL 
-#define __ELIMINATOR_INL
+#ifndef __LINBOX_eliminator_INL
+#define __LINBOX_eliminator_INL
 
 #include "linbox/linbox-config.h"
 
@@ -37,40 +37,39 @@
 #undef _S
 #undef _T
 
-namespace LinBox 
+namespace LinBox
 {
 
-std::ostream &reportPermutation
-	(std::ostream &out,
-	 const std::vector<std::pair<unsigned int, unsigned int> > &P) 
-{
-	std::vector<std::pair<unsigned int, unsigned int> >::const_iterator i;
+	std::ostream &reportPermutation (std::ostream &out,
+					 const std::vector<std::pair<unsigned int, unsigned int> > &P)
+	{
+		std::vector<std::pair<unsigned int, unsigned int> >::const_iterator i;
 
-	out << "  ";
+		out << "  ";
 
-	for (i = P.begin (); i != P.end (); ++i)
-		out << "(" << i->first << " " << i->second << ")";
+		for (i = P.begin (); i != P.end (); ++i)
+			out << "(" << i->first << " " << i->second << ")";
 
-	out << std::endl;
+		out << std::endl;
 
-	return out;
-}
+		return out;
+	}
 
-template <class Field, class Matrix>
-Eliminator<Field, Matrix>::Eliminator (const Field &F, unsigned int N) 
-	: _F (F), _VD (F), _MD (F), _N (N), _S (N), _T (N)
-{
-	_F.init (_one, 1);
-}
+	template <class Field, class Matrix>
+	Eliminator<Field, Matrix>::Eliminator (const Field &F, unsigned int N) :
+		_F (F), _VD (F), _MD (F), _N (N), _S (N), _T (N)
+	{
+		_F.init (_one, 1);
+	}
 
-template <class Field, class Matrix>
-Eliminator<Field, Matrix>::~Eliminator () 
-{
-}
+	template <class Field, class Matrix>
+	Eliminator<Field, Matrix>::~Eliminator ()
+	{
+	}
 
-template <class Field, class Matrix>
-template <class Matrix1, class Matrix2, class Matrix3, class Matrix4>
-void Eliminator<Field, Matrix>::twoSidedGaussJordan
+	template <class Field, class Matrix>
+	template <class Matrix1, class Matrix2, class Matrix3, class Matrix4>
+	void Eliminator<Field, Matrix>::twoSidedGaussJordan
 	(Matrix1       &Ainv,
 	 Permutation   &P,
 	 Matrix2       &Tu,
@@ -78,70 +77,70 @@ void Eliminator<Field, Matrix>::twoSidedGaussJordan
 	 Matrix3       &Tv,
 	 const Matrix4 &A,
 	 unsigned int  &rank)
-{
-	typename Field::Element d, dinv;
-	std::vector<unsigned int>::iterator i;
-	unsigned int idx;
-
-	_A.resize (A.rowdim (), A.coldim ());
-	_U.resize (A.rowdim (), A.rowdim ());
-	_tmp.resize (A.rowdim (), A.coldim ());
-	_profile.resize (A.coldim ());
-	_indices.resize (A.rowdim ());
-
-	for (i = _indices.begin (), idx = 0; i != _indices.end (); ++i, ++idx)
-		*i = idx;
-
-	_MD.subin (_A, _A);
-
-	DenseSubmatrix<Element> A1 (_A, 0, 0, A.rowdim (), A.coldim ());
-	_MD.copy (A1, A);
-
-	setIN (_U);
-	_P.clear ();
-	_profile_idx = 0;
-
-	kthGaussJordan (rank, d, 0, 0, A.coldim (), _one);
-
-	buildMinimalPermutation (P, rank, A.rowdim (), _P);
-	buildMinimalPermutationFromProfile (Q, rank, A.coldim (), _profile);
-
-	_MD.permuteColumns (_U, _P.rbegin (), _P.rend ());
-	_MD.permuteColumns (_U, P.begin (), P.end ());
-
-	DenseSubmatrix<Element> Tu1 (Tu, rank, 0, A.rowdim () - rank, rank);
-	DenseSubmatrix<Element> U2 (_U, rank, 0, A.rowdim () - rank, rank);
-	_MD.copy (Tu1, U2);
-
-	DenseSubmatrix<Element> Ainv1 (Ainv, 0, 0, rank, rank);
-	DenseSubmatrix<Element> U1 (_U, 0, 0, rank, rank);
-	_F.inv (dinv, d);
-	_MD.mul (Ainv1, U1, dinv);
-
-	DenseSubmatrix<Element> Tv1 (Tv, 0, rank, rank, A.coldim () - rank);
-	DenseSubmatrix<Element> U3 (_U, 0, 0, rank, A.rowdim ());
-	DenseSubmatrix<Element> A2 (_A, 0, rank, A.rowdim (), A.coldim () - rank);
-	_MD.copy (A1, A);
-	_MD.permuteColumns (A1, Q.begin (), Q.end ());
-	_MD.permuteRows (A2, P.begin (), P.end ());
-	_MD.mul (Tv1, U3, A2);
-	_MD.negin (Tv1);
-}
-
-/* permuteAndInvert
- *
- * Compute the pseudoinverse of the input matrix A and return
- * it. First apply the permutation given by the lists leftPriorityIdx
- * and rightPriorityIdx to the input matrix so that independent
- * columns and rows are more likely to be found on the first indices
- * in those lists. Zero out the rows and columns of the inverse
- * corresponding to dependent rows and columns of the input. Set S and
- * T to boolean vectors such that S^T A T is invertible and of maximal
- * size.
- */
+	{
+		typename Field::Element d, dinv;
+		std::vector<unsigned int>::iterator i;
+		unsigned int idx;
+
+		_A.resize (A.rowdim (), A.coldim ());
+		_U.resize (A.rowdim (), A.rowdim ());
+		_tmp.resize (A.rowdim (), A.coldim ());
+		_profile.resize (A.coldim ());
+		_indices.resize (A.rowdim ());
+
+		for (i = _indices.begin (), idx = 0; i != _indices.end (); ++i, ++idx)
+			*i = idx;
+
+		_MD.subin (_A, _A);
+
+		DenseSubmatrix<Element> A1 (_A, 0, 0, A.rowdim (), A.coldim ());
+		_MD.copy (A1, A);
+
+		setIN (_U);
+		_P.clear ();
+		_profile_idx = 0;
+
+		kthGaussJordan (rank, d, 0, 0, A.coldim (), _one);
+
+		buildMinimalPermutation (P, rank, A.rowdim (), _P);
+		buildMinimalPermutationFromProfile (Q, rank, A.coldim (), _profile);
+
+		_MD.permuteColumns (_U, _P.rbegin (), _P.rend ());
+		_MD.permuteColumns (_U, P.begin (), P.end ());
+
+		DenseSubmatrix<Element> Tu1 (Tu, rank, 0, A.rowdim () - rank, rank);
+		DenseSubmatrix<Element> U2 (_U, rank, 0, A.rowdim () - rank, rank);
+		_MD.copy (Tu1, U2);
+
+		DenseSubmatrix<Element> Ainv1 (Ainv, 0, 0, rank, rank);
+		DenseSubmatrix<Element> U1 (_U, 0, 0, rank, rank);
+		_F.inv (dinv, d);
+		_MD.mul (Ainv1, U1, dinv);
+
+		DenseSubmatrix<Element> Tv1 (Tv, 0, rank, rank, A.coldim () - rank);
+		DenseSubmatrix<Element> U3 (_U, 0, 0, rank, A.rowdim ());
+		DenseSubmatrix<Element> A2 (_A, 0, rank, A.rowdim (), A.coldim () - rank);
+		_MD.copy (A1, A);
+		_MD.permuteColumns (A1, Q.begin (), Q.end ());
+		_MD.permuteRows (A2, P.begin (), P.end ());
+		_MD.mul (Tv1, U3, A2);
+		_MD.negin (Tv1);
+	}
 
-template <class Field, class Matrix>
-Matrix &Eliminator<Field, Matrix>::permuteAndInvert
+	/* permuteAndInvert
+	 *
+	 * Compute the pseudoinverse of the input matrix A and return
+	 * it. First apply the permutation given by the lists leftPriorityIdx
+	 * and rightPriorityIdx to the input matrix so that independent
+	 * columns and rows are more likely to be found on the first indices
+	 * in those lists. Zero out the rows and columns of the inverse
+	 * corresponding to dependent rows and columns of the input. Set S and
+	 * T to boolean vectors such that S^T A T is invertible and of maximal
+	 * size.
+	 */
+
+	template <class Field, class Matrix>
+	Matrix &Eliminator<Field, Matrix>::permuteAndInvert
 	(Matrix                    &W,
 	 std::vector<bool>         &S,
 	 std::vector<bool>         &T,
@@ -149,118 +148,118 @@ Matrix &Eliminator<Field, Matrix>::permuteAndInvert
 	 Permutation               &Qp,
 	 unsigned int              &rank,
 	 const Matrix              &A)
-{
-	typename Field::Element d;     // Determinant of input A, up to sign
+	{
+		typename Field::Element d;     // Determinant of input A, up to sign
 
-	typename Matrix::ConstRowIterator ai;
-	typename Matrix::RowIterator _ai, wi, ui;
+		typename Matrix::ConstRowIterator ai;
+		typename Matrix::RowIterator _ai, wi, ui;
 
-	std::vector<unsigned int>::iterator i;
-	unsigned int idx;
+		std::vector<unsigned int>::iterator i;
+		unsigned int idx;
 
- 	Timer timer;
+		Timer timer;
 
- 	timer.start ();
+		timer.start ();
 
-	linbox_check (_N == S.size ());
-	linbox_check (_N == T.size ());
-	linbox_check (_N == W.rowdim ());
-	linbox_check (_N == W.coldim ());
-	linbox_check (_N == A.rowdim ());
-	linbox_check (_N == A.coldim ());
+		linbox_check (_N == S.size ());
+		linbox_check (_N == T.size ());
+		linbox_check (_N == W.rowdim ());
+		linbox_check (_N == W.coldim ());
+		linbox_check (_N == A.rowdim ());
+		linbox_check (_N == A.coldim ());
 
 #ifdef ELIM_DETAILED_TRACE
-	commentator.start ("Computing W, S, T", "Eliminator::permuteAndInvert", _N);
+		commentator.start ("Computing W, S, T", "Eliminator::permuteAndInvert", _N);
 
-	std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-	report << "Input matrix:" << std::endl;
-	_MD.write (report, A);
+		std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+		report << "Input matrix:" << std::endl;
+		_MD.write (report, A);
 #endif
 
-	/* Apply initial permutations to A, copying to _A */
+		/* Apply initial permutations to A, copying to _A */
 
-	buildPermutation (Qp, rightPriorityIdx); // Column permutation
+		buildPermutation (Qp, rightPriorityIdx); // Column permutation
 
 #ifdef ELIM_DETAILED_TRACE
-	report << "Column permutation: ";
-	reportPermutation (report, Qp) << endl;
+		report << "Column permutation: ";
+		reportPermutation (report, Qp) << endl;
 #endif
 
-	_A.resize (A.rowdim (), A.coldim ());
-	_U.resize (A.rowdim (), A.rowdim ());
-	_tmp.resize (A.rowdim (), A.coldim ());
-	_indices.resize (A.rowdim ());
+		_A.resize (A.rowdim (), A.coldim ());
+		_U.resize (A.rowdim (), A.rowdim ());
+		_tmp.resize (A.rowdim (), A.coldim ());
+		_indices.resize (A.rowdim ());
+
+		for (i = _indices.begin (), idx = 0; i != _indices.end (); ++i, ++idx)
+			*i = idx;
 
-	for (i = _indices.begin (), idx = 0; i != _indices.end (); ++i, ++idx)
-		*i = idx;
+		_MD.copy (_A, A);
 
-	_MD.copy (_A, A);
+		_MD.permuteColumns (_A, Qp.begin (), Qp.end ());
 
-	_MD.permuteColumns (_A, Qp.begin (), Qp.end ());
+		/* Initialise temporaries for the computation */
 
-	/* Initialise temporaries for the computation */
+		setIN (_U);
+		_P.clear ();
+		_profile.resize (A.coldim ());
+		_profile_idx = 0;
+		std::fill (_T.begin (), _T.end (), false);
 
-	setIN (_U);
-	_P.clear ();
-	_profile.resize (A.coldim ());
-	_profile_idx = 0;
-	std::fill (_T.begin (), _T.end (), false);
+		/* Run the computation */
 
-	/* Run the computation */
+		kthGaussJordan (rank, d, 0, 0, _A.coldim (), _one);
 
-	kthGaussJordan (rank, d, 0, 0, _A.coldim (), _one);
-	
-	/* Set _S based on the permutation */
-	std::fill (_S.begin (), _S.begin () + rank, true);
-	std::fill (_S.begin () + rank, _S.end (), false);
-	permute (_S, _P.rbegin (), _P.rend ());
+		/* Set _S based on the permutation */
+		std::fill (_S.begin (), _S.begin () + rank, true);
+		std::fill (_S.begin () + rank, _S.end (), false);
+		permute (_S, _P.rbegin (), _P.rend ());
 
-	permute (_T, Qp.rbegin (), Qp.rend ());
+		permute (_T, Qp.rbegin (), Qp.rend ());
 
-	/* Apply final permutations to _U, copying to W */
-	DenseSubmatrix<Element> U1 (_U, rank, 0, _U.rowdim () - rank, _U.coldim ());
-	_MD.subin (U1, U1);
+		/* Apply final permutations to _U, copying to W */
+		DenseSubmatrix<Element> U1 (_U, rank, 0, _U.rowdim () - rank, _U.coldim ());
+		_MD.subin (U1, U1);
 
-	_MD.permuteColumns (_U, _P.rbegin (), _P.rend ());
+		_MD.permuteColumns (_U, _P.rbegin (), _P.rend ());
 
-	/* Divide _U by the determinant and copy to W */
-	_F.invin (d);
-	_MD.mulin (_U, d);
+		/* Divide _U by the determinant and copy to W */
+		_F.invin (d);
+		_MD.mulin (_U, d);
 
-	_MD.subin (W, W);
+		_MD.subin (W, W);
 
-	typename std::vector<unsigned int>::iterator pi;
+		typename std::vector<unsigned int>::iterator pi;
 
-	for (pi = _profile.begin (), ui = _U.rowBegin (); pi != _profile.begin () + rank; ++ui, ++pi)
-		_VD.copy (*(W.rowBegin () + *pi), *ui);
+		for (pi = _profile.begin (), ui = _U.rowBegin (); pi != _profile.begin () + rank; ++ui, ++pi)
+			_VD.copy (*(W.rowBegin () + *pi), *ui);
 
-//	_MD.permuteRows (W, Qp.rbegin (), Qp.rend ());
+		//	_MD.permuteRows (W, Qp.rbegin (), Qp.rend ());
 
-	/* Rebuild leftPriorityIdx and rightPriorityIdx */
-	cleanPriorityIndexList (rightPriorityIdx, _T, T);
+		/* Rebuild leftPriorityIdx and rightPriorityIdx */
+		cleanPriorityIndexList (rightPriorityIdx, _T, T);
 
-	/* Reverse the row priority index list */
-	std::reverse (_indices.begin (), _indices.end ());
+		/* Reverse the row priority index list */
+		std::reverse (_indices.begin (), _indices.end ());
 
-	S = _S;
-	T = _T;
+		S = _S;
+		T = _T;
 
 #ifdef ELIM_DETAILED_TRACE
-	report << "Computed W:" << std::endl;
-	_MD.write (report, W);
+		report << "Computed W:" << std::endl;
+		_MD.write (report, W);
 
-	commentator.stop ("done", NULL, "Eliminator::permuteAndInvert");
+		commentator.stop ("done", NULL, "Eliminator::permuteAndInvert");
 #endif
 
- 	timer.stop ();
- 	_total_time += timer.usertime ();
+		timer.stop ();
+		_total_time += timer.usertime ();
 
-	return W;
-}
+		return W;
+	}
 
-template <class Field, class Matrix>
-template <class Matrix1, class Matrix2, class Matrix3, class Matrix4>
-Matrix1 &Eliminator<Field, Matrix>::gaussJordan
+	template <class Field, class Matrix>
+	template <class Matrix1, class Matrix2, class Matrix3, class Matrix4>
+	Matrix1 &Eliminator<Field, Matrix>::gaussJordan
 	(Matrix1                   &U,
 	 std::vector<unsigned int> &profile,
 	 Permutation               &P,
@@ -270,452 +269,453 @@ Matrix1 &Eliminator<Field, Matrix>::gaussJordan
 	 unsigned int              &rank,
 	 typename Field::Element   &det,
 	 const Matrix4             &A)
-{
-	typename Field::Element dinv;
-	std::vector<unsigned int>::iterator i;
-	unsigned int idx;
-
-	_A.resize (A.rowdim (), A.coldim ());
-	_U.resize (A.rowdim (), A.rowdim ());
-	_tmp.resize (A.rowdim (), A.coldim ());
-	_profile.resize (A.coldim ());
-	_indices.resize (A.rowdim ());
-
-	for (i = _indices.begin (), idx = 0; i != _indices.end (); ++i, ++idx)
-		*i = idx;
-
-	setIN (_U);
-	_P.clear ();
-	_MD.copy (_A, A);
-	_profile_idx = 0;
-	kthGaussJordan (rank, det, 0, 0, A.coldim (), _one);
-
-	buildMinimalPermutation (P, rank, A.rowdim (), _P);
-	buildMinimalPermutationFromProfile (Q, rank, A.coldim (), _profile);
-
-	_MD.permuteColumns (_U, _P.rbegin (), _P.rend ());
-	_MD.permuteColumns (_U, P.begin (), P.end ());
-
-	DenseSubmatrix<Element> Tu1 (Tu, rank, 0, A.rowdim () - rank, rank);
-	DenseSubmatrix<Element> U2 (_U, rank, 0, A.rowdim () - rank, rank);
-	_MD.copy (Tu1, U2);
-
-	DenseSubmatrix<Element> Ainv1 (U, 0, 0, rank, rank);
-	DenseSubmatrix<Element> U1 (_U, 0, 0, rank, rank);
-	_F.inv (dinv, det);
-	_MD.mul (Ainv1, U1, dinv);
-
-	DenseSubmatrix<Element> Tv1 (Tv, 0, rank, rank, A.coldim () - rank);
-	DenseSubmatrix<Element> U3 (_U, 0, 0, rank, A.rowdim ());
-	DenseSubmatrix<Element> A2 (_A, 0, rank, A.rowdim (), A.coldim () - rank);
-	_MD.copy (_A, A);
-	_MD.permuteColumns (_A, Q.begin (), Q.end ());
-	_MD.permuteRows (A2, P.begin (), P.end ());
-	_MD.mul (Tv1, U3, A2);
-	_MD.negin (Tv1);
-
-	profile.resize (rank);
-	std::copy (_profile.begin (), _profile.begin () + rank, profile.begin ());
-
-	return U;
-}
-
-template <class Field, class Matrix>
-std::ostream &Eliminator<Field, Matrix>::writeFilter (std::ostream &out, const std::vector<bool> &v) const
-{
-	std::vector<bool>::const_iterator i;
-
-	for (i = v.begin (); i != v.end (); ++i) {
-		if (*i)
-			out << "1 ";
-		else
-			out << "0 ";
+	{
+		typename Field::Element dinv;
+		std::vector<unsigned int>::iterator i;
+		unsigned int idx;
+
+		_A.resize (A.rowdim (), A.coldim ());
+		_U.resize (A.rowdim (), A.rowdim ());
+		_tmp.resize (A.rowdim (), A.coldim ());
+		_profile.resize (A.coldim ());
+		_indices.resize (A.rowdim ());
+
+		for (i = _indices.begin (), idx = 0; i != _indices.end (); ++i, ++idx)
+			*i = idx;
+
+		setIN (_U);
+		_P.clear ();
+		_MD.copy (_A, A);
+		_profile_idx = 0;
+		kthGaussJordan (rank, det, 0, 0, A.coldim (), _one);
+
+		buildMinimalPermutation (P, rank, A.rowdim (), _P);
+		buildMinimalPermutationFromProfile (Q, rank, A.coldim (), _profile);
+
+		_MD.permuteColumns (_U, _P.rbegin (), _P.rend ());
+		_MD.permuteColumns (_U, P.begin (), P.end ());
+
+		DenseSubmatrix<Element> Tu1 (Tu, rank, 0, A.rowdim () - rank, rank);
+		DenseSubmatrix<Element> U2 (_U, rank, 0, A.rowdim () - rank, rank);
+		_MD.copy (Tu1, U2);
+
+		DenseSubmatrix<Element> Ainv1 (U, 0, 0, rank, rank);
+		DenseSubmatrix<Element> U1 (_U, 0, 0, rank, rank);
+		_F.inv (dinv, det);
+		_MD.mul (Ainv1, U1, dinv);
+
+		DenseSubmatrix<Element> Tv1 (Tv, 0, rank, rank, A.coldim () - rank);
+		DenseSubmatrix<Element> U3 (_U, 0, 0, rank, A.rowdim ());
+		DenseSubmatrix<Element> A2 (_A, 0, rank, A.rowdim (), A.coldim () - rank);
+		_MD.copy (_A, A);
+		_MD.permuteColumns (_A, Q.begin (), Q.end ());
+		_MD.permuteRows (A2, P.begin (), P.end ());
+		_MD.mul (Tv1, U3, A2);
+		_MD.negin (Tv1);
+
+		profile.resize (rank);
+		std::copy (_profile.begin (), _profile.begin () + rank, profile.begin ());
+
+		return U;
 	}
 
-	return out;
-}
+	template <class Field, class Matrix>
+	std::ostream &Eliminator<Field, Matrix>::writeFilter (std::ostream &out, const std::vector<bool> &v) const
+	{
+		std::vector<bool>::const_iterator i;
 
-template <class Field, class Matrix>
-std::ostream &Eliminator<Field, Matrix>::writePermutation (std::ostream &out, const Permutation &P) const
-{
-	Permutation::const_iterator i;
+		for (i = v.begin (); i != v.end (); ++i) {
+			if (*i)
+				out << "1 ";
+			else
+				out << "0 ";
+		}
 
-	for (i = P.begin (); i != P.end (); ++i)
-		out << '(' << i->first << ' ' << i->second << ')';
+		return out;
+	}
 
-	return out;
-}
+	template <class Field, class Matrix>
+	std::ostream &Eliminator<Field, Matrix>::writePermutation (std::ostream &out, const Permutation &P) const
+	{
+		Permutation::const_iterator i;
 
-/* Perform the kth indexed Gauss-Jordan transform on _A, storing the
- * transformation matrix in _U and the permutation in _P. The caller is
- * responsible for ensuring that _U and _P are the identity and that _A is set
- * to a copy of the input on the initial call.
- */
+		for (i = P.begin (); i != P.end (); ++i)
+			out << '(' << i->first << ' ' << i->second << ')';
+
+		return out;
+	}
 
-template <class Field, class Matrix>
-Matrix &Eliminator<Field, Matrix>::kthGaussJordan
+	/* Perform the kth indexed Gauss-Jordan transform on _A, storing the
+	 * transformation matrix in _U and the permutation in _P. The caller is
+	 * responsible for ensuring that _U and _P are the identity and that _A is set
+	 * to a copy of the input on the initial call.
+	 */
+
+	template <class Field, class Matrix>
+	Matrix &Eliminator<Field, Matrix>::kthGaussJordan
 	(unsigned int                  &r,
 	 typename Field::Element       &d,
 	 unsigned int                   k,
 	 unsigned int                   s,
 	 unsigned int                   m,
 	 const typename Field::Element &d0)
-{
-	unsigned int i;
+	{
+		unsigned int i;
 
 #ifdef ELIM_DETAILED_TRACE
-	commentator.start ("kth indexed Gauss-Jordan transform", "Eliminator::kthGaussJordan");
+		commentator.start ("kth indexed Gauss-Jordan transform", "Eliminator::kthGaussJordan");
 
-	std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-	report << "k = " << k << std::endl;
-	report << "Starting column: " << s << std::endl;
-	report << "Column dimension: " << m << std::endl;
+		std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+		report << "k = " << k << std::endl;
+		report << "Starting column: " << s << std::endl;
+		report << "Column dimension: " << m << std::endl;
 
-	DenseMatrixBase<Element> Acopy (_A);
+		DenseMatrixBase<Element> Acopy (_A);
 
-	unsigned int P_start = _P.size ();
+		unsigned int P_start = _P.size ();
 #endif
 
-	DenseSubmatrix<Element> Ap (_A, k, s, _A.rowdim () - k, m);
+		DenseSubmatrix<Element> Ap (_A, k, s, _A.rowdim () - k, m);
 
-	if (_MD.isZero (Ap)) {
-		r = 0;
-		_F.assign (d, d0);
-	}
-	else if (m == 1) {
-		// Find minimal index i > k with _A[i, 1] != 0
-		for (i = 0; i < _A.rowdim (); ++i)
-			if (_indices[i] >= k && !_F.isZero (_A.getEntry (_indices[i], s)))
-				break;
+		if (_MD.isZero (Ap)) {
+			r = 0;
+			_F.assign (d, d0);
+		}
+		else if (m == 1) {
+			// Find minimal index i > k with _A[i, 1] != 0
+			for (i = 0; i < _A.rowdim (); ++i)
+				if (_indices[i] >= k && !_F.isZero (_A.getEntry (_indices[i], s)))
+					break;
 
-		linbox_check (i < _A.rowdim ());
+			linbox_check (i < _A.rowdim ());
 
-		_T[s] = true;  // This column is independent
+			_T[s] = true;  // This column is independent
 
-		if (_indices[i] != k) _P.push_back (Transposition (_indices[i], k));
+			if (_indices[i] != k) _P.push_back (Transposition (_indices[i], k));
 
-		r = 1;
-		_A.getEntry (d, _indices[i], s);
+			r = 1;
+			_A.getEntry (d, _indices[i], s);
 
-		typename Matrix::ColIterator Uk = _U.colBegin () + k;
-		typename Matrix::ColIterator A1 = _A.colBegin () + s;
+			typename Matrix::ColIterator Uk = _U.colBegin () + k;
+			typename Matrix::ColIterator A1 = _A.colBegin () + s;
 
-		_VD.neg (*Uk, *A1);
-		_F.assign ((*Uk)[_indices[i]], (*Uk)[k]);
-		_F.assign ((*Uk)[k], d0);
+			_VD.neg (*Uk, *A1);
+			_F.assign ((*Uk)[_indices[i]], (*Uk)[k]);
+			_F.assign ((*Uk)[k], d0);
 
-		std::swap (_indices[i], _indices[k]);
+			std::swap (_indices[i], _indices[k]);
 
-		for (i = k + 1; i < _U.rowdim (); ++i)
-			_U.setEntry (i, i, d);
+			for (i = k + 1; i < _U.rowdim (); ++i)
+				_U.setEntry (i, i, d);
 
-		_profile[_profile_idx++] = s;
-	}
-	else {
-		unsigned int m1 = m / 2;
-		unsigned int m2 = m - m1;
-		unsigned int r1, r2;
-		typename Field::Element d1, d0inv, d1inv, d1neg;
+			_profile[_profile_idx++] = s;
+		}
+		else {
+			unsigned int m1 = m / 2;
+			unsigned int m2 = m - m1;
+			unsigned int r1, r2;
+			typename Field::Element d1, d0inv, d1inv, d1neg;
 
-		DenseSubmatrix<Element> B (_A, 0, s + m1, _A.rowdim (), m2);
+			DenseSubmatrix<Element> B (_A, 0, s + m1, _A.rowdim (), m2);
 
-		unsigned int P_start = _P.size ();
+			unsigned int P_start = _P.size ();
 
-		kthGaussJordan (r1, d1, k, s, m1, d0);
+			kthGaussJordan (r1, d1, k, s, m1, d0);
 
-		unsigned int P_end = _P.size ();
+			unsigned int P_end = _P.size ();
 
-		_MD.permuteRows (B, _P.begin () + P_start, _P.end ());
+			_MD.permuteRows (B, _P.begin () + P_start, _P.end ());
 
-		unsigned int l1 = _U.rowdim () - (k + r1);
+			unsigned int l1 = _U.rowdim () - (k + r1);
 
-		DenseSubmatrix<Element> a (_U,    0,      k,      k,  r1);
-		DenseSubmatrix<Element> u (_U,    k,      k,      r1, r1);
-		DenseSubmatrix<Element> c (_U,    k + r1, k,      l1, r1);
+			DenseSubmatrix<Element> a (_U,    0,      k,      k,  r1);
+			DenseSubmatrix<Element> u (_U,    k,      k,      r1, r1);
+			DenseSubmatrix<Element> c (_U,    k + r1, k,      l1, r1);
 
-		DenseSubmatrix<Element> et (_tmp, 0,      0,      k,  m2);
-		DenseSubmatrix<Element> gt (_tmp, 0,      0,      l1, m2);
+			DenseSubmatrix<Element> et (_tmp, 0,      0,      k,  m2);
+			DenseSubmatrix<Element> gt (_tmp, 0,      0,      l1, m2);
 
-		DenseSubmatrix<Element> e (_A,    0,      s + m1, k,  m2);
-		DenseSubmatrix<Element> f (_A,    k,      s + m1, r1, m2);
-		DenseSubmatrix<Element> g (_A,    k + r1, s + m1, l1, m2);
+			DenseSubmatrix<Element> e (_A,    0,      s + m1, k,  m2);
+			DenseSubmatrix<Element> f (_A,    k,      s + m1, r1, m2);
+			DenseSubmatrix<Element> g (_A,    k + r1, s + m1, l1, m2);
 
-		_F.inv (d0inv, d0);
+			_F.inv (d0inv, d0);
 
-		_MD.mul (et, a, f);
-		_MD.mulin (e, d1);
-		_MD.addin (e, et);
-		_MD.mulin (e, d0inv);
+			_MD.mul (et, a, f);
+			_MD.mulin (e, d1);
+			_MD.addin (e, et);
+			_MD.mulin (e, d0inv);
 
-		_MD.mul (gt, c, f);
-		_MD.mulin (g, d1);
-		_MD.addin (g, gt);
-		_MD.mulin (g, d0inv);
+			_MD.mul (gt, c, f);
+			_MD.mulin (g, d1);
+			_MD.addin (g, gt);
+			_MD.mulin (g, d0inv);
 
-		_MD.leftMulin (u, f);
-		_MD.mulin (f, d0inv);
+			_MD.leftMulin (u, f);
+			_MD.mulin (f, d0inv);
 
 #ifdef ELIM_DETAILED_TRACE
-		report << "(" << k << ") Matrix A prepared for second recursive call: " << std::endl;
-		_MD.write (report, _A);
+			report << "(" << k << ") Matrix A prepared for second recursive call: " << std::endl;
+			_MD.write (report, _A);
 #endif
 
-		kthGaussJordan (r2, d, k + r1, s + m1, m2, d1);
+			kthGaussJordan (r2, d, k + r1, s + m1, m2, d1);
 
 #ifdef ELIM_DETAILED_TRACE
-		report << "(" << k << ") Transform U after recursive calls: " << std::endl;
-		_MD.write (report, _U);
+			report << "(" << k << ") Transform U after recursive calls: " << std::endl;
+			_MD.write (report, _U);
 #endif
 
-		DenseSubmatrix<Element> U1 (_U, 0, k, _U.rowdim (), r1);
+			DenseSubmatrix<Element> U1 (_U, 0, k, _U.rowdim (), r1);
 
-		_F.neg (d1neg, d1);
-		adddIN (_U, d1neg);
-		_MD.permuteRows (U1, _P.begin () + P_end, _P.end ());
-		adddIN (_U, d1);
+			_F.neg (d1neg, d1);
+			adddIN (_U, d1neg);
+			_MD.permuteRows (U1, _P.begin () + P_end, _P.end ());
+			adddIN (_U, d1);
 
 #ifdef ELIM_DETAILED_TRACE
-		report << "(" << k << ") P2 U P2^-1: " << std::endl;
-		_MD.write (report, _U);
+			report << "(" << k << ") P2 U P2^-1: " << std::endl;
+			_MD.write (report, _U);
 #endif
 
-		r = r1 + r2;
+			r = r1 + r2;
 
-		unsigned int l2 = _U.rowdim () - (k + r);
+			unsigned int l2 = _U.rowdim () - (k + r);
 
-		DenseSubmatrix<Element> a1    (_U, 0,      k,      k,  r1);
-		DenseSubmatrix<Element> u1    (_U, k,      k,      r1, r1);
-		DenseSubmatrix<Element> c1    (_U, k + r1, k,      r2, r1);
-		DenseSubmatrix<Element> c1bar (_U, k + r,  k,      l2, r1);
+			DenseSubmatrix<Element> a1    (_U, 0,      k,      k,  r1);
+			DenseSubmatrix<Element> u1    (_U, k,      k,      r1, r1);
+			DenseSubmatrix<Element> c1    (_U, k + r1, k,      r2, r1);
+			DenseSubmatrix<Element> c1bar (_U, k + r,  k,      l2, r1);
 
-		DenseSubmatrix<Element> &a11 = a1;
-		DenseSubmatrix<Element> &u11 = u1;
-		DenseSubmatrix<Element> &u21 = c1;
-		DenseSubmatrix<Element> &c11 = c1bar;
+			DenseSubmatrix<Element> &a11 = a1;
+			DenseSubmatrix<Element> &u11 = u1;
+			DenseSubmatrix<Element> &u21 = c1;
+			DenseSubmatrix<Element> &c11 = c1bar;
 
-		DenseSubmatrix<Element> a11t  (_tmp, 0,    0,      k,  r1);
-		DenseSubmatrix<Element> u11t  (_tmp, 0,    0,      r1, r1);
-		DenseSubmatrix<Element> c11t  (_tmp, 0,    0,      l2, r1);
+			DenseSubmatrix<Element> a11t  (_tmp, 0,    0,      k,  r1);
+			DenseSubmatrix<Element> u11t  (_tmp, 0,    0,      r1, r1);
+			DenseSubmatrix<Element> c11t  (_tmp, 0,    0,      l2, r1);
 
-		DenseSubmatrix<Element> a2    (_U, 0,      k + r1, k,  r2);
-		DenseSubmatrix<Element> a2bar (_U, k,      k + r1, r1, r2);
-		DenseSubmatrix<Element> u2    (_U, k + r1, k + r1, r2, r2);
-		DenseSubmatrix<Element> c2    (_U, k + r,  k + r1, l2, r2);
+			DenseSubmatrix<Element> a2    (_U, 0,      k + r1, k,  r2);
+			DenseSubmatrix<Element> a2bar (_U, k,      k + r1, r1, r2);
+			DenseSubmatrix<Element> u2    (_U, k + r1, k + r1, r2, r2);
+			DenseSubmatrix<Element> c2    (_U, k + r,  k + r1, l2, r2);
 
-		_F.inv (d1inv, d1);
+			_F.inv (d1inv, d1);
 
-		_MD.mul (a11t, a2, c1);
-		_MD.mulin (a1, d);
-		_MD.addin (a11, a11t);   // a11 <- d * a1 + a2 * c1
-		_MD.mulin (a11, d1inv);
+			_MD.mul (a11t, a2, c1);
+			_MD.mulin (a1, d);
+			_MD.addin (a11, a11t);   // a11 <- d * a1 + a2 * c1
+			_MD.mulin (a11, d1inv);
 
-		_MD.mul (u11t, a2bar, c1);
-		_MD.mulin (u1, d);
-		_MD.addin (u11, u11t);   // u11 <- d * u1 + a2bar * c1
-		_MD.mulin (u11, d1inv);
+			_MD.mul (u11t, a2bar, c1);
+			_MD.mulin (u1, d);
+			_MD.addin (u11, u11t);   // u11 <- d * u1 + a2bar * c1
+			_MD.mulin (u11, d1inv);
 
-		_MD.mul (c11t, c2, c1);
-		_MD.mulin (c1bar, d);
-		_MD.addin (c11, c11t);   // c11 <- d * c1bar + c2 * c1
-		_MD.mulin (c11, d1inv);
+			_MD.mul (c11t, c2, c1);
+			_MD.mulin (c1bar, d);
+			_MD.addin (c11, c11t);   // c11 <- d * c1bar + c2 * c1
+			_MD.mulin (c11, d1inv);
 
-		_MD.leftMulin (u2, c1);  // u21 <- u2 * c1
-		_MD.mulin (u21, d1inv);
-	}
+			_MD.leftMulin (u2, c1);  // u21 <- u2 * c1
+			_MD.mulin (u21, d1inv);
+		}
 
 #ifdef ELIM_DETAILED_TRACE
-	report << "(" << k << ") Finished U: " << std::endl;
-	_MD.write (report, _U);
+		report << "(" << k << ") Finished U: " << std::endl;
+		_MD.write (report, _U);
 
-	report << "(" << k << ") Finished P: " << std::endl;
-	reportPermutation (report, _P);
+		report << "(" << k << ") Finished P: " << std::endl;
+		reportPermutation (report, _P);
 
-	typename Field::Element dinv, d0inv;
+		typename Field::Element dinv, d0inv;
 
-	_F.inv (dinv, d);
-	_F.inv (d0inv, d0);
+		_F.inv (dinv, d);
+		_F.inv (d0inv, d0);
 
-	DenseMatrixBase<Element> R (_A.rowdim () - k, _A.coldim () - s);
-	DenseSubmatrix<Element> Atest (Acopy, k, s, _A.rowdim () - k, _A.coldim () - s);
-	DenseSubmatrix<Element> Utest (_U, k, k, _U.rowdim () - k, _U.coldim () - k);
-	_MD.permuteRows (Acopy, _P.begin () + P_start, _P.end ());
+		DenseMatrixBase<Element> R (_A.rowdim () - k, _A.coldim () - s);
+		DenseSubmatrix<Element> Atest (Acopy, k, s, _A.rowdim () - k, _A.coldim () - s);
+		DenseSubmatrix<Element> Utest (_U, k, k, _U.rowdim () - k, _U.coldim () - k);
+		_MD.permuteRows (Acopy, _P.begin () + P_start, _P.end ());
 
-	report << "(" << k << ") PA: " << std::endl;
-	_MD.write (report, Acopy);
+		report << "(" << k << ") PA: " << std::endl;
+		_MD.write (report, Acopy);
 
-	_MD.mul (R, Utest, Atest);
-	_MD.mulin (R, dinv);
-	_MD.mulin (R, d0inv);
+		_MD.mul (R, Utest, Atest);
+		_MD.mulin (R, dinv);
+		_MD.mulin (R, d0inv);
 
-	report << "(" << k << ") R:=1/d U 1/d0 PA: " << std::endl;
-	_MD.write (report, R);
+		report << "(" << k << ") R:=1/d U 1/d0 PA: " << std::endl;
+		_MD.write (report, R);
 
-	commentator.stop ("done", NULL, "Eliminator::kthGaussJordan");
+		commentator.stop ("done", NULL, "Eliminator::kthGaussJordan");
 #endif
 
-	return _U;
-}
+		return _U;
+	}
 
-template <class Field, class Matrix>
-template <class Matrix1>
-Matrix1 &Eliminator<Field, Matrix>::adddIN
+	template <class Field, class Matrix>
+	template <class Matrix1>
+	Matrix1 &Eliminator<Field, Matrix>::adddIN
 	(Matrix1                       &A,
 	 const typename Field::Element &d) const
-{
-	typename Matrix1::RowIterator i;
-	unsigned int idx;
+	{
+		typename Matrix1::RowIterator i;
+		unsigned int idx;
 
-	for (i = A.rowBegin (), idx = 0; i != A.rowEnd (); ++i, ++idx)
-		_F.addin ((*i)[idx], d);
+		for (i = A.rowBegin (), idx = 0; i != A.rowEnd (); ++i, ++idx)
+			_F.addin ((*i)[idx], d);
 
-	return A;
-}
+		return A;
+	}
 
-template <class Field, class Matrix>
-template <class Matrix1>
-Matrix1 &Eliminator<Field, Matrix>::setIN (Matrix1 &A) const 
-{
-	linbox_check (A.coldim () == A.rowdim ());
+	template <class Field, class Matrix>
+	template <class Matrix1>
+	Matrix1 &Eliminator<Field, Matrix>::setIN (Matrix1 &A) const
+	{
+		linbox_check (A.coldim () == A.rowdim ());
 
-	typename Matrix1::RowIterator i;
-	size_t i_idx;
+		typename Matrix1::RowIterator i;
+		size_t i_idx;
 
-	for (i = A.rowBegin (), i_idx = 0; i != A.rowEnd (); ++i, ++i_idx) {
-		_VD.subin (*i, *i);
-		_F.assign ((*i)[i_idx], _one);
-	}
+		for (i = A.rowBegin (), i_idx = 0; i != A.rowEnd (); ++i, ++i_idx) {
+			_VD.subin (*i, *i);
+			_F.assign ((*i)[i_idx], _one);
+		}
 
-	return A;
-}
+		return A;
+	}
 
-/* Clean out the given priority index list and add new elements as needed */
+	/* Clean out the given priority index list and add new elements as needed */
 
-template <class Field, class Matrix>
-void Eliminator<Field, Matrix>::cleanPriorityIndexList
+	template <class Field, class Matrix>
+	void Eliminator<Field, Matrix>::cleanPriorityIndexList
 	(std::list<unsigned int> &list,
 	 std::vector<bool>       &S,
 	 std::vector<bool>       &old_S) const
-{
-	std::list<unsigned int>::iterator li;
-	std::vector<bool>::iterator si, old_si;
-	unsigned int idx;
-
-	for (li = list.begin (); li != list.end ();) {
-		if (S[*li])
-			li = list.erase (li);
-		else
-			++li;
-	}
+	{
+		std::list<unsigned int>::iterator li;
+		std::vector<bool>::iterator si, old_si;
+		unsigned int idx;
+
+		for (li = list.begin (); li != list.end ();) {
+			if (S[*li])
+				li = list.erase (li);
+			else
+				++li;
+		}
 
-	for (si = S.begin (), old_si = old_S.begin (), idx = 0; si != S.end (); ++si, ++old_si, ++idx) {
-		if (!*si && *old_si)
-			list.push_back (idx);
+		for (si = S.begin (), old_si = old_S.begin (), idx = 0; si != S.end (); ++si, ++old_si, ++idx) {
+			if (!*si && *old_si)
+				list.push_back (idx);
+		}
 	}
-}
 
-/* Permute the entries given bit vector using the given permutation */
+	/* Permute the entries given bit vector using the given permutation */
 
-template <class Field, class Matrix>
-template <class Iterator>
-std::vector<bool> &Eliminator<Field, Matrix>::permute (std::vector<bool> &v, Iterator P_start, Iterator P_end) const
-{
-	Iterator i;
+	template <class Field, class Matrix>
+	template <class Iterator>
+	std::vector<bool> &Eliminator<Field, Matrix>::permute (std::vector<bool> &v, Iterator P_start, Iterator P_end) const
+	{
+		Iterator i;
 
-	for (i = P_start; i != P_end; ++i) {
-		bool tmp = v[i->first];
-		v[i->first] = v[i->second];
-		v[i->second] = tmp;
-	}
+		for (i = P_start; i != P_end; ++i) {
+			bool tmp = v[i->first];
+			v[i->first] = v[i->second];
+			v[i->second] = tmp;
+		}
 
-	return v;
-}
+		return v;
+	}
 
-template <class Field, class Matrix>
-typename Eliminator<Field, Matrix>::Permutation &
-Eliminator<Field, Matrix>::buildPermutation (Permutation &P, const std::list<unsigned int> &pidx) const
-{
-	unsigned int offset, current;
-	Permutation::iterator i;
-	std::list<unsigned int>::const_iterator li;
+	template <class Field, class Matrix>
+	typename Eliminator<Field, Matrix>::Permutation &
+	Eliminator<Field, Matrix>::buildPermutation (Permutation &P, const std::list<unsigned int> &pidx) const
+	{
+		unsigned int offset, current;
+		Permutation::iterator i;
+		std::list<unsigned int>::const_iterator li;
+
+		P.clear ();
+
+		for (li = pidx.begin (), offset = 0; li != pidx.end (); ++li, ++offset) {
+			if (*li > offset)
+				P.push_back (Transposition (*li, offset));
+			else if (*li < offset) {
+				// We need to figure out to what place the original
+				// bubbled. We'll use a naive algorithm here, since I
+				// don't anticipate this being a problem too much, and
+				// it's O(n) in any case.
+
+				current = *li;
+
+				for (i = P.begin (); i != P.end (); ++i)
+					if (i->second == current)
+						current = i->first;
+
+				if (current != offset)
+					P.push_back (Transposition (current, offset));
+			}
+		}
 
-	P.clear ();
+		return P;
+	}
 
-	for (li = pidx.begin (), offset = 0; li != pidx.end (); ++li, ++offset) {
-		if (*li > offset)
-			P.push_back (Transposition (*li, offset));
-		else if (*li < offset) {
-			// We need to figure out to what place the original
-			// bubbled. We'll use a naive algorithm here, since I
-			// don't anticipate this being a problem too much, and
-			// it's O(n) in any case.
+	template <class Field, class Matrix>
+	typename Eliminator<Field, Matrix>::Permutation &
+	Eliminator<Field, Matrix>::buildMinimalPermutation (Permutation &P, unsigned int rank,
+							    unsigned int dim, const Permutation &Pold)
+	{
+		Permutation::const_reverse_iterator j;
+		unsigned int idx, idx2;
 
-			current = *li;
+		P.clear ();
 
-			for (i = P.begin (); i != P.end (); ++i)
-				if (i->second == current)
-					current = i->first;
+		std::fill (_S.begin (), _S.begin () + rank, true);
+		std::fill (_S.begin () + rank, _S.begin () + dim, false);
 
-			if (current != offset)
-				P.push_back (Transposition (current, offset));
+		for (j = Pold.rbegin (); j != Pold.rend (); ++j) {
+			bool tmp = _S[j->first];
+			_S[j->first] = _S[j->second];
+			_S[j->second] = tmp;
 		}
-	}
 
-	return P;
-}
+		idx = 0;
+		idx2 = dim - 1;
 
-template <class Field, class Matrix>
-typename Eliminator<Field, Matrix>::Permutation &
-Eliminator<Field, Matrix>::buildMinimalPermutation (Permutation &P, unsigned int rank,
-						    unsigned int dim, const Permutation &Pold) 
-{
-	Permutation::const_reverse_iterator j;
-	unsigned int idx, idx2;
+		while (idx < rank && idx2 >= rank) {
+			while (_S[idx] && idx < rank) ++idx;
+			while (!_S[idx2] && idx2 >= rank) --idx2;
 
-	P.clear ();
+			if (idx < rank && idx2 >= rank)
+				P.push_back (Transposition (idx, idx2));
 
-	std::fill (_S.begin (), _S.begin () + rank, true);
-	std::fill (_S.begin () + rank, _S.begin () + dim, false);
+			++idx;
+			--idx2;
+		}
 
-	for (j = Pold.rbegin (); j != Pold.rend (); ++j) {
-		bool tmp = _S[j->first];
-		_S[j->first] = _S[j->second];
-		_S[j->second] = tmp;
+		return P;
 	}
 
-	idx = 0;
-	idx2 = dim - 1;
+	template <class Field, class Matrix>
+	typename Eliminator<Field, Matrix>::Permutation &
+	Eliminator<Field, Matrix>::buildMinimalPermutationFromProfile (Permutation &P, unsigned int rank,
+								       unsigned int dim, const std::vector<unsigned int> &profile)
+	{
+		typename std::vector<unsigned int>::const_iterator j;
+		unsigned int idx = 0;
 
-	while (idx < rank && idx2 >= rank) {
-		while (_S[idx] && idx < rank) ++idx;
-		while (!_S[idx2] && idx2 >= rank) --idx2;
+		P.clear ();
 
-		if (idx < rank && idx2 >= rank)
-			P.push_back (Transposition (idx, idx2));
+		for (j = profile.begin (); j != profile.begin () + rank; ++j, ++idx)
+			if (*j != idx)
+				P.push_back (Transposition (*j, idx));
 
-		++idx;
-		--idx2;
+		return P;
 	}
 
-	return P;
-}
-
-template <class Field, class Matrix>
-typename Eliminator<Field, Matrix>::Permutation &
-Eliminator<Field, Matrix>::buildMinimalPermutationFromProfile (Permutation &P, unsigned int rank,
-							       unsigned int dim, const std::vector<unsigned int> &profile) 
-{
-	typename std::vector<unsigned int>::const_iterator j;
-	unsigned int idx = 0;
-
-	P.clear ();
-
-	for (j = profile.begin (); j != profile.begin () + rank; ++j, ++idx)
-		if (*j != idx)
-			P.push_back (Transposition (*j, idx));
-
-	return P;
-}
-
 } // namespace LinBox
 
-#endif // __ELIMINATOR_INL
+#endif // __LINBOX_eliminator_INL
+
diff --git a/linbox/algorithms/fast-rational-reconstruction.h b/linbox/algorithms/fast-rational-reconstruction.h
new file mode 100644
index 0000000..69ca681
--- /dev/null
+++ b/linbox/algorithms/fast-rational-reconstruction.h
@@ -0,0 +1,1272 @@
+/* -*- 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
+/* linbox/blackbox/classic-rational-reconstruction.h
+ * Copyright (C) 2009 Anna Marszalek
+ *
+ * Written by Anna Marszalek <aniau at astronet.pl>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_fast_reconstruction_H
+#define __LINBOX_fast_reconstruction_H
+
+#define __FASTRR_DEFAULT_THRESHOLD 384
+
+#include <iostream>
+#include "linbox/algorithms/rational-reconstruction-base.h"
+#include "linbox/util/timer.h"
+
+
+namespace LinBox
+{
+
+	/*
+	 * implements fast rational reconstruction by Wan & Pan algorithm [Wan & Pan 2002],
+	 * Wang's bounds [Wang 1981] are used as default
+	 */
+
+	template <class Ring>
+	class FastRationalReconstruction: public RReconstructionBase<Ring> {
+	protected:
+		size_t _threshold;
+	public:
+		const Ring _Z;
+		typedef typename Ring::Element Element;
+
+		FastRationalReconstruction(const Ring& Z) :
+			RReconstructionBase<Ring>(Z), _Z(Z)
+		{
+			_threshold = __FASTRR_DEFAULT_THRESHOLD;
+			if (_threshold < 2) _threshold = 2;
+		}
+
+		~FastRationalReconstruction() {}
+
+		bool reconstructRational(Element& a, Element& b, const Element& x, const Element& m) const
+		{
+			Element a_bound; _Z.sqrt(a_bound, m/2);
+			reconstructRational(a,b,x,m,a_bound);
+			return (a < a_bound);
+		}
+
+		bool reconstructRational(Element& a, Element& b, const Element& x, const Element& m, const Element& a_bound ) const
+		{
+			if (x < a_bound) {
+				//case (i)
+				a=x;
+				b=1;
+				return true;
+			}
+			else if (m-x < a_bound) {
+				a = x-m;
+				b = 1;
+				return true;
+			}
+
+			Element bound = a_bound << 1;
+
+			if (m/bound > 1) {
+				fastReconstructRational(a,b,x,m,m/bound);
+
+				if (_Z.abs(a) < a_bound) {
+					return true;
+				}
+				return false;
+			}
+			else {
+				//either case (i) or false
+				return false;
+			}
+		}
+
+	protected:
+		/*
+		 * using mutable can be messiy, probabily need better solution
+		 */
+		mutable Element cur_ri;
+		mutable Element cur_rinext;
+		mutable Element cur_ainext;
+		mutable Element cur_qinext;
+
+		Element& powtwo(Element& h, const Element& log_h) const
+		{
+			h = 1;
+			if (log_h <= 0) return h;
+			if (log_h < ULONG_MAX) {
+				h<<=log_h;
+				return h;
+			}
+			else {
+				Element n,m;
+				quoRem(n,m,log_h,(Element)(ULONG_MAX-1));
+				for (int i=0; i < n; ++i) {
+					h <<=(long int)(ULONG_MAX-1);
+				}
+				h <= (long int)m;
+				return h;
+			}
+		}
+
+		Element& powtwo(Element& h, const size_t log_h) const
+		{
+			h = 1;
+			if (log_h <= 0) return h;
+			h<<=log_h;
+			return h;
+		}
+
+		bool fastReconstructRational(Element& n, Element& d, const Element& x, const Element& m, const Element& d_bound ) const
+		{
+
+			size_t log_m = m.bitsize()-1;
+			size_t log_bound = d_bound.bitsize()-1;
+			Element ai, bi, ci, di;
+			ai=1;bi=0;ci=0;di=1;
+			Element bound;  _Z.powtwo(bound, log_bound);
+
+			cur_ri = m;
+			cur_rinext = x;
+			_Z.quo(cur_ainext, cur_ri, cur_rinext);
+			cur_qinext = cur_ainext;//  ri/ri_next
+
+			if (!fastEEA (ai,bi,ci,di,m,log_m,x,bound, log_bound)) return false;
+
+			int K=0;
+
+			Element init_ainext = cur_ainext;
+			Element init_qinext = cur_qinext;
+			Element init_rinext = cur_rinext;
+			Element init_ri = cur_ri;
+			/* correction if $K <> bound = 2^log_bound */
+			if (cur_rinext > 0) {
+				while (cur_ainext <= d_bound) {
+					++K;
+					Element tmp;
+					tmp = ai;
+					ai = cur_ainext;
+					bi = tmp;
+					tmp = ci;
+					_Z.axpy(ci, cur_qinext,tmp, di);
+					++this->C.mul_counter;
+					di = tmp;
+
+					tmp = cur_rinext;
+					_Z.axpy(cur_rinext, -cur_qinext, tmp, cur_ri);
+					cur_ri = tmp;
+
+					if (cur_rinext==0 ) {
+						cur_qinext = m+1;
+						cur_ainext = m+1;
+						break;
+					}
+
+					++this->C.mul_counter;
+					_Z.quo(cur_qinext, cur_rinext, cur_ri);
+					++this->C.div_counter;
+					_Z.axpy(cur_ainext, ai, cur_qinext, bi);
+					++this->C.mul_counter;
+				}
+			}
+
+			_Z.mul(n,x, ai);
+			_Z.maxpyin(n,m,ci);
+			//n = x_in*ai-m*ci;
+			d = ai;
+			return true;
+
+		}
+
+		void prevEEA(Element& aprev, Element& bprev, Element& cprev, Element& dprev,
+			     const Element& ai, const Element& bi, const Element& ci, const Element& di) const
+		{
+			aprev = bi;
+			cprev = di;
+			if ((bi==1) && (di==1)) {
+				bprev = 1; dprev = 0;
+				Element tmp = cur_ri;
+				cur_ri = cur_ri+cur_rinext;
+				cur_rinext = tmp;
+				cur_ainext = ai;
+				cur_qinext = 1;
+				return;
+				//before last matrix we know next call to prevEEA is Id
+			}
+			Element qi;
+			_Z.quo(qi, ai, bi);
+			++this->C.div_counter;
+
+			_Z.axpy(bprev, -qi, bi,ai);
+			_Z.axpy(dprev, -qi, di,ci);
+			++this->C.mul_counter;++this->C.mul_counter;
+			Element tmp;
+			tmp = cur_ri;
+			_Z.axpy(cur_ri, tmp, qi, cur_rinext);
+			//cur_ri = cur_ri *qi + cur_rinext;
+			cur_rinext = tmp;
+			cur_ainext = ai;
+			cur_qinext = qi;
+			++this->C.mul_counter;
+
+		}
+
+		/* extended Euclidean Algorithm */
+		bool classicEEA(Element& ai, Element& bi, Element& ci, Element& di, const Element& r0, const Element& r1, const Element& bound, int K =0) const
+		{
+
+			Element ri, rinext;
+			ri = r0; rinext = r1;
+			ai =di = 1;
+			bi =ci = 0;
+
+			Element ainext,cinext;
+			Element qinext;
+			_Z.quo(qinext,ri,rinext);
+			++this->C.div_counter;
+			while (1) {
+				++K;
+				//ainext = ai*qinext + bi;
+				_Z.axpy(ainext, ai,qinext,bi);
+				++this->C.mul_counter;
+				if (bound < ainext) {
+					cur_ri = ri;
+					cur_rinext = rinext;
+					cur_ainext = ainext;
+					cur_qinext = qinext;
+					return true;
+				}
+				else {
+					bi = ai;
+					ai = ainext;
+					Element temp = ci;
+					_Z.axpy(ci, temp,qinext,di);
+					++this->C.mul_counter;
+					di = temp;
+
+					temp = ri;
+					ri=rinext;
+					_Z.axpy(rinext, -qinext,ri,temp);//rinext = ri-qinext*rinext
+					++this->C.mul_counter;
+					if (rinext==0) {
+						//ainext = infinity
+						cur_ri = ri;
+						cur_rinext = rinext;
+						cur_ainext = r0+1;//infinity
+						cur_qinext = cur_ainext;//infinity
+						return true;
+					}
+					_Z.quo(qinext,ri,rinext);
+					++this->C.div_counter;
+				}
+			}
+		}
+
+		/* log(m)-1 <= d < log(m) ; d >=1
+		 * 2^h=powh=bound>=2, h <= d
+		 */
+		bool fastEEA(Element& ai,Element& bi, Element& ci, Element& di, const Element& m, const size_t d, const Element& n, const Element& powh, const size_t& h) const
+		{
+			ai=Element(1);
+			di=Element(1);
+			bi=Element(0);
+			ci=Element(0); //Q(0)=Id
+
+			if (powh > m) std::cerr << "should not happen m < powh" << std::flush;
+			if (m==n) {
+				cur_ri = m;
+				cur_rinext = 0;
+				cur_ainext = m+1;//infinity
+				cur_qinext = m+1;
+				ai=1; bi=1; ci=1; di=0;
+				return true;
+			}
+
+			if (powh < 1) {
+				std::cerr << "wrong powh used"<< std::flush;
+				cur_ri=m, cur_rinext=n;cur_ainext=m+1; cur_qinext = m+1;
+				return false; //should not happen
+			}
+			if (n < 2) {
+				//n==1 -> Q1=(m,1//1,0)
+				//n==0 -> Q1=infinity
+				if (n==0) std::cerr << "should not happen n=0" << std::flush;
+				cur_ri = m;
+				cur_rinext = 1;
+				cur_ainext = m;
+				cur_qinext = m;
+				if (cur_ainext > powh) return true;
+				else {
+					cur_ri = 1;
+					cur_rinext = 0;
+					cur_ainext = m+1;
+					cur_qinext = m+1;
+				}
+				return true;
+			}
+
+			if (h < 1) {
+				//if (qinext==1) { return (1,1,1,0) or (1,0,0,1) }
+				if ((n << 1) > m) {
+					cur_ri = n;
+					cur_rinext = m-n;
+					_Z.quo(cur_qinext, cur_ri, cur_rinext);
+					++this->C.div_counter;
+					cur_ainext = cur_qinext + 1;
+					ai=1; bi=1; ci=1; di=0;
+				}
+				else {
+					cur_ri = m;
+					cur_rinext = n;
+					_Z.quo(cur_ainext,m,n);
+					++this->C.div_counter;
+					cur_qinext = cur_ainext;
+				}
+				return true;
+			}
+
+			if (n.bitsize() < _threshold) {       //what about m?
+				return classicEEA(ai,bi,ci,di,m,n,powh);
+			}
+
+			// size_t log_n = n.bitsize()-1;
+
+			if (2*h+1 < d) {
+				size_t lambda = d-2*h-1;
+				Element aistar, bistar, cistar, distar;
+				aistar=distar=1;
+				bistar=cistar=0;
+
+				Element mstar = m >> (long unsigned int) lambda;
+				Element nstar = n >> (long unsigned int) lambda;
+
+				size_t log_mstar = 2*h+1;
+				if (nstar > 0) if (!fastEEA(aistar, bistar, cistar, distar, mstar, log_mstar,nstar, powh, h)) return false;
+
+				int K=2;//reatreat steps;
+
+				if ((aistar > 1) && (distar > 0)) { //we have to go back 2 steps
+					Element aprev,bprev,cprev,dprev;
+					for (int i=0; i < K; ++i) {
+						prevEEA(aprev,bprev,cprev,dprev,aistar,bistar,cistar,distar);
+						aistar=aprev;bistar=bprev;cistar=cprev;distar=dprev;
+					}
+					ai = aistar; bi =bistar; ci = cistar; di= distar;
+				}
+
+				_Z.mul(cur_ri,m,di);
+				_Z.maxpyin(cur_ri,n,bi);
+				_Z.mul(cur_rinext,n,ai);
+				_Z.maxpyin(cur_rinext,m,ci);
+				this->C.mul_counter+=4;
+
+				if (cur_ri < 0) {
+					cur_ri = -cur_ri;
+					cur_rinext = -cur_rinext;
+				}
+				if (cur_rinext>0) {
+					_Z.quo(cur_qinext,cur_ri,cur_rinext);
+					++this->C.div_counter;
+					_Z.axpy(cur_ainext, ai,cur_qinext,bi);
+					++this->C.mul_counter;
+				}
+				else {
+					cur_ainext = m+1;//infinity
+					cur_qinext = cur_ainext;
+				}
+			}
+			else { //if (h <= d-1)  // modification of Wan&Pan
+				Element a1,a2,b1,b2,c1,c2,d1,d2;
+				a1=a2=d1=d2=1;
+				b1=b2=c1=c2=0;
+
+				Element sqrth;
+				size_t logsqrth;
+				logsqrth = h >> (int) 1;
+				powtwo(sqrth, logsqrth);
+
+				if (!fastEEA(a1,b1,c1,d1,m,d,n,sqrth, logsqrth)) return false;
+
+				Element ri = cur_ri;
+				Element rinext = cur_rinext;
+
+				size_t log_m;
+
+				if ((rinext > 0) && (cur_ainext <= powh)){
+					log_m = rinext.bitsize()-1;
+					Element m2, n2;
+					m2 = rinext;
+					_Z.axpy(n2, -cur_qinext, rinext, ri);
+					++this->C.mul_counter;
+
+					/* compute Q(i+1) */
+					Element tmp = a1;
+					a1 = cur_ainext;
+					b1 = tmp;
+					tmp = c1;
+					_Z.axpy (tmp, cur_qinext, c1, d1);
+					++this->C.mul_counter;
+					d1 = c1;
+					c1 = tmp;
+
+					int k = a1.bitsize()-1 ;
+					int _k;
+					if (h-k > 2) _k = h-k-2;
+					else _k = 0;
+					if (n2 >0) {
+						if (a1 < powh) {
+							if (!fastEEA(a2,b2,c2,d2,m2,log_m,n2, powtwo(sqrth,_k), _k)) return false;
+						}
+						else {
+							ai = a1; bi = b1; ci=c1; di = d1;
+							cur_ri = m2;
+							cur_rinext = n2;
+							_Z.quo(cur_qinext,m2,n2);
+							++this->C.div_counter;
+							_Z.axpy(cur_ainext,a1,cur_qinext,b1);
+							++this->C.mul_counter;
+							return true;
+						}
+					}
+					else {
+						ai = a1; bi = b1; ci=c1; di = d1;
+						cur_ri = m2;
+						cur_rinext = n2;
+						cur_qinext = m+1;
+						cur_ainext = m+1;
+						return true;
+					}
+				}
+				else {//ri_next == 0 || cur_ainext >powh
+					ai = a1; bi = b1; ci=c1; di = d1;
+					if (cur_rinext<=0) {
+						cur_ainext = m +1;
+						cur_qinext = cur_ainext;
+					}
+					return true;
+				}
+
+				_Z.mul(ai,b1,c2);
+				_Z.axpyin(ai,a1,a2);
+				//aistar = a1*a2 + b1*c2;
+				_Z.mul(bi,b1,d2);
+				_Z.axpyin(bi, a1,b2);
+				//bistar = a1*b2 + b1*d2;
+				_Z.mul(ci,d1,c2);
+				_Z.axpyin(ci, c1,a2);
+				//cistar = c1*a2 + d1*c2;
+				_Z.mul(di,d1,d2);
+				_Z.axpyin(di, c1,b2);
+				//distar = c1*b2 + d1*d2;
+				this->C.mul_counter+=8;
+
+				_Z.mul(cur_ri,m,di);
+				_Z.maxpyin(cur_ri,n,bi);
+				_Z.mul(cur_rinext,n,ai);
+				_Z.maxpyin(cur_rinext,m,ci);
+				this->C.mul_counter+=4;
+				//ri = m*di - n*bi;
+				//rinext = -m*ci + n*ai;
+				if (cur_ri < 0) {
+					cur_ri = -cur_ri;
+					cur_rinext = -cur_rinext;
+				}
+				if (cur_rinext>0) {
+					_Z.quo(cur_qinext,cur_ri,cur_rinext);
+					++this->C.div_counter;
+					_Z.axpy(cur_ainext, ai,cur_qinext,bi);
+					++this->C.mul_counter;
+				}
+				else {
+					cur_ainext = m+1;//infinity
+					cur_qinext = cur_ainext;
+					return true;
+				}
+
+
+				Element aprev,bprev,cprev,dprev;
+				aprev=dprev=1;
+				bprev=cprev=0;
+
+				if (ai > powh) {//at most 2 forward steps, at most 2 backward steps
+					//backward loop (max 0 steps)
+					int K=0;
+					while (ai > powh) {//one step back
+						++K;
+						prevEEA(aprev,bprev,cprev,dprev,ai,bi,ci,di);
+						ai=aprev;bi=bprev;ci=cprev;di=dprev;
+					}
+					std::cerr << "Error: " << K << " backward steps in step 2\n";
+					std::cerr << "->End:" << cur_ri << " " << cur_rinext << " " <<ai<<"/"<< cur_ainext << "\n"<< std::flush;
+					return false;
+				}
+				/* //modification of Wan&Pan
+				   }
+				   else {//h=d, h = d+1;
+				   Element hh = powh;
+				   size_t log_hh = h;
+				   hh = powh >> 1;
+				   while (log_hh > d-1) {
+				   --log_hh;
+				   hh >>= 1;
+				   }
+				   if (!fastEEA(ai,bi,ci,di,m,d,n,hh, d-1)) return false;
+
+*/		}
+
+				Element ri = cur_ri;
+				Element rinext = cur_rinext;
+				Element qinext = cur_qinext;
+				if (rinext==0) {
+					cur_ainext = m+1;//infinity
+					cur_qinext = cur_ainext;
+					return true;
+				}
+
+				if (qinext <=0) {
+					std::cout << "ERROR sth went very very wrong:" ;
+					std::cout << "m:" << m << " n:" << n << " h:" << powh << "\n";
+					std::cout << ai << " " << bi << "\n" << ci << " " << di <<"\n"; //getchar();
+					return false;
+				}
+
+				Element ainext, binext, cinext,dinext;
+				ainext=dinext=1;
+				binext=cinext=0;
+				ainext = cur_ainext;
+				int K=-1;
+				while (1) {
+					++K;
+					if (powh < ainext) {
+						cur_ri = ri;
+						cur_rinext = rinext;
+						cur_ainext = ainext;
+						cur_qinext = qinext;
+						return true;
+					}
+					else {
+						bi = ai;
+						ai = ainext;
+						Element temp = ci;
+						//ci = ci*qinext + di;
+						_Z.axpy(ci, ci,qinext,di);
+						++this->C.mul_counter;
+						di = temp;
+
+						temp = ri;
+						ri=rinext;
+						//rinext=qinext*ri+temp;
+						//rinext = temp - qinext*ri;
+						_Z.axpy(rinext, -qinext,ri,temp);
+						++this->C.mul_counter;
+						if (rinext==0) {
+							cur_ri = ri;
+							cur_rinext = rinext;
+							cur_ainext = m+1;
+							cur_qinext = m+1;
+							return true;
+						}
+						_Z.quo(qinext,ri,rinext);
+						++this->C.div_counter;
+						_Z.axpy(ainext, ai,qinext,bi);
+						++this->C.mul_counter;
+					}
+				}
+
+				return false;
+		}
+	};
+
+	/* structures to perform MaxQ Fast Rational Reconstruction,
+	 * stores not confirmed quotients and corresponding matrices
+	 */
+	template <class Ring>
+	class QMatrix {
+	public:
+		Ring _Z;
+		typedef typename Ring::Element Element;
+
+		Element a,b,c,d;
+		Element q;
+
+		QMatrix(const Ring Z) :
+			_Z(Z)
+		{
+			a=1;b=0;c=0;d=1;q=0;
+		}
+
+		QMatrix(const QMatrix& Q) :
+			_Z(Q._Z)
+		{
+			a = Q.a;
+			b = Q.b;
+			c = Q.c;
+			d = Q.d;
+			q = Q.q;
+		}
+
+		QMatrix(Ring Z,const Element& ai, const Element& bi, const Element& ci, const Element& di, const Element& qi=0) :
+			_Z(Z)
+		{
+			a = ai;
+			b = bi;
+			c = ci;
+			d = di;
+			q = qi;
+		}
+
+		QMatrix& operator=(const QMatrix& Q) {
+			a = Q.a;
+			b = Q.b;
+			c = Q.c;
+			d = Q.d;
+			q = Q.q;
+			return *this;
+		}
+
+		void leftmultiply(const QMatrix Q) {
+			leftmultiply(Q.a,Q.b, Q.c,Q.d);
+		}
+
+		void leftmultiply(const Element& ai,const Element& bi,const Element& ci,const Element& di) {
+			Element tmpa,tmpb,tmpc,tmpd;
+			_Z.mul(tmpa,ai,a);
+			_Z.axpyin(tmpa,bi,c);
+
+			_Z.mul(tmpb,ai,b);
+			_Z.axpyin(tmpb,bi,d);
+
+			_Z.mul(tmpc,ci,a);
+			_Z.axpyin(tmpc,di,c);
+
+			_Z.mul(tmpd,ci,b);
+			_Z.axpyin(tmpd,di,d);
+
+			a = tmpa; b = tmpb; c = tmpc; d = tmpd;
+		}
+
+		QMatrix& max(const QMatrix& max1, const QMatrix max2) {
+			if (max1.q >= max2.q) return QMatrix(max1);
+			else return QMatrix(max2);
+		}
+
+		bool maxin(const QMatrix max2) {
+			if (q >= max2.q) return true;
+			else {
+				a = max2.a;
+				b = max2.b;
+				c = max2.c;
+				d = max2.d;
+				q = max2.q;
+				return false;
+			}
+		}
+	};
+
+	template <class Ring>
+	class myQueue: public std::deque<QMatrix<Ring > > {
+	public:
+		typedef typename Ring::Element Element;
+		typedef QMatrix<Ring> QMatrix_;
+
+		size_t _maxSize;
+		size_t _size;
+
+		myQueue(const size_t K=0) {
+			_maxSize = K;
+			_size = 0;
+		}
+
+		bool pushpop(QMatrix_& top, const QMatrix_& bottom) {
+			if (_size+1 < _maxSize) {
+				push_back(bottom);
+				return false;
+				++_size;
+			}
+			else {
+				if (!this->empty()) {
+					top = this->front();
+					this->pop_front();
+					push_back(bottom);
+
+				}
+				else {
+					top=bottom;
+				}
+				return true;
+			}
+		}
+
+		QMatrix_& clearmax(QMatrix_& max1) {
+			while (!this->empty()) {
+				QMatrix_ max2(this->front());
+				if (max2.q > max1.q) return max1=max2;
+				this->pop_front();
+			}
+		}
+	};
+
+	/*
+	 *  implements fast rational reconstruction by Wan & Pan algorithm [Wan & Pan 2002]
+	 *  MQRR Alg. of Monagan [Monagan2004] is used - maximal quotient is found
+	 *  can be changed to large quotient for better performance q > m.bitsize() +c is returned
+	 */
+	template <class Ring>
+	class FastMaxQRationalReconstruction: public FastRationalReconstruction<Ring> {
+	public:
+		const Ring _Z;
+		typedef typename Ring::Element Element;
+
+		FastMaxQRationalReconstruction(const Ring& Z) :
+			FastRationalReconstruction<Ring>(Z), _Z(Z)
+		{}
+
+		bool reconstructRational(Element& a, Element& b, const Element& x, const Element& m) const
+		{
+			bool res = fastQMaxReconstructRational(a,b,x,m);
+			return res;
+		}
+
+		bool reconstructRational(Element& a, Element& b, const Element& x, const Element& m, const Element& a_bound) const
+		{
+			bool res= false;
+			return res = FastRationalReconstruction<Ring>::reconstructRational(a,b,x,m,a_bound);
+		}
+
+	protected:
+		mutable Element cur_ri;
+		mutable Element cur_rinext;
+		mutable Element cur_ainext;
+		mutable Element cur_qinext;
+		mutable Element T;
+		mutable int c;
+
+
+		bool fastQMaxReconstructRational(Element& n, Element& d, const Element& x, const Element& m) const
+		{
+
+			T = m.bitsize();
+			c = 5; //should be changed here to enhance probability of correctness
+
+			size_t log_m = m.bitsize()-1; //true unless m = 2^k
+
+			Element ai, bi, ci, di;
+			ai=1;bi=0;ci=0;di=1;
+
+			cur_ri = m;
+			cur_rinext = x;
+			_Z.quo(cur_ainext, cur_ri, cur_rinext);
+			cur_qinext = cur_ainext;//  ri/ri_next
+
+			Element powh;
+			myQueue<Ring > queueMax(0);
+			QMatrix<Ring > maxQ(_Z);
+
+			if (!fastQMaxEEA (ai,bi,ci,di,m,log_m,x,powtwo(powh,log_m+1), log_m+1,queueMax,maxQ)) {
+				return false;
+			}
+
+#if 0
+			if (cur_rinext != 0) {
+				std::cout << "bad bounds - should not happen\n" << std::flush;
+			}
+			if (!queueMax.empty()) {
+				std::cout << "Queue is not empty\n - sth wrong" << std::flush;
+			}
+#endif
+			_Z.mul(n,x, maxQ.a);
+			_Z.maxpyin(n,m,maxQ.c);
+			//n = x_in*ai-m*ci;
+			d = maxQ.a;
+
+			//Element T = m.bitsize();int c = 5;
+			if (maxQ.q.bitsize() > T.bitsize() + c) return true;
+			else return false;
+		}
+
+		bool classicQMaxEEA(Element& ai, Element& bi, Element& ci, Element& di, const Element& r0, const Element& r1,const Element& powh, myQueue<Ring >&  queueMax, QMatrix<Ring>& maxQ) const
+		{
+			if (maxQ.q.bitsize() > T.bitsize() + c) return true;
+			Element ri, rinext;
+			ri = r0; rinext = r1;
+			ai =di = 1;
+			bi =ci = 0;
+			if (rinext==0) return true;
+			Element ainext,cinext;
+			Element qinext;
+			_Z.quo(qinext,ri,rinext);
+			++this->C.div_counter;
+
+			ainext =qinext;
+			while (ainext <= powh) {
+
+				QMatrix<Ring> newQ(_Z,ai,bi,ci,di,qinext);
+				QMatrix<Ring> top(_Z);
+				if (queueMax.pushpop(top, newQ)) {
+					if (maxQ.q < top.q) {
+						maxQ = top;
+						if (maxQ.q.bitsize() > T.bitsize() + c) return true;
+					}
+				}
+
+				Element tmpbi = bi;
+				Element tmpdi = di;
+				bi = ai;
+				ai = ainext;
+				Element temp = ci;
+				_Z.axpy(ci, temp,qinext,di);
+				++this->C.mul_counter;
+				di = temp;
+
+				temp = ri;
+				ri=rinext;
+				_Z.axpy(rinext, -qinext,ri,temp);//rinext = ri-qinext*rinext
+				++this->C.mul_counter;
+
+				if (rinext==0) {
+					//ainext = infinity
+					cur_ri = ri;
+					cur_rinext = rinext;
+					cur_ainext = r0+1;
+					cur_qinext = cur_ainext;//infinity
+					return true;
+				}
+
+				_Z.quo(qinext,ri,rinext);
+				++this->C.div_counter;
+				_Z.axpy(ainext, ai,qinext,bi);
+				++this->C.mul_counter;
+
+			}
+			cur_ri = ri;
+			cur_rinext = rinext;
+			cur_ainext = ainext;
+			cur_qinext = qinext;
+			return true;
+		}
+
+
+		bool fastQMaxEEA(Element& ai,Element& bi, Element& ci, Element& di,
+				 const Element& m, const size_t d, const Element& n,
+				 const Element& powh, const size_t& h, myQueue<Ring >&  queueMax, QMatrix<Ring>& maxQ) const
+		{
+			if (maxQ.q.bitsize() > T.bitsize() + c) return true;
+			ai=Element(1);
+			di=Element(1);
+			bi=Element(0);
+			ci=Element(0); //Q(0)=Id
+
+			if (m==n) {
+				cur_ri = n;
+				cur_rinext = 0;
+				cur_ainext = m+1;//infinity
+				cur_qinext = m+1;
+				ai=1; bi=1; ci=1; di=0;
+				QMatrix<Ring> newQ(_Z,1,0,0,1,1);
+				QMatrix<Ring> top(_Z);
+				if (queueMax.pushpop(top, newQ)) {
+					if (maxQ.q < top.q) {
+						maxQ = top;
+						if (maxQ.q.bitsize() > T.bitsize() + c) return true;
+					}
+				}
+				return true;
+			}
+
+			if (powh < 1) return false; //should not happen
+			if (n < 2) {
+				//n==1 -> Q1=(m,1//1,0)
+				//n==0 -> Q1=infinity
+				cur_ri = m;
+				cur_rinext = 1;
+				cur_ainext = m;//infinity
+				cur_qinext = m;
+				if (cur_ainext > powh) {
+					//we do not have to treat identity;
+					return true;
+				}
+				else {
+					ai=m; bi=1; ci=1; di=0;
+					cur_ri = 1;
+					cur_rinext = 0;
+					cur_ainext = m+1;
+					cur_qinext = m+1;
+					QMatrix<Ring> newQ(_Z,1,0,0,1,m);
+					QMatrix<Ring> top(_Z);
+					if (queueMax.pushpop(top, newQ)) {
+						if (maxQ.q < top.q) {
+							maxQ = top;
+							if (maxQ.q.bitsize() > T.bitsize() + c) return true;
+						}
+					}
+
+					return true;
+				}
+				return true;
+			}
+
+			if (h < 1) {
+				//if (qinext==1) { return (1,1,1,0) or (1,0,0,1) }
+				if ((n << 1) > m) {
+					cur_ri = n;
+					cur_rinext = m-n;
+					_Z.quo(cur_qinext, cur_ri, cur_rinext);
+					++this->C.div_counter;
+					cur_ainext = cur_qinext + 1;
+					ai=1; bi=1; ci=1; di=0;
+					QMatrix<Ring> newQ(_Z,1,0,0,1,1);
+					QMatrix<Ring> top(_Z);
+					if (queueMax.pushpop(top, newQ)) {
+						if (maxQ.q < top.q) {
+							maxQ = top;
+							if (maxQ.q.bitsize() > T.bitsize() + c) return true;
+						}
+					}
+				}
+				else {
+					//we do not have to treat identity;
+					cur_ri = m;
+					cur_rinext = n;
+					_Z.quo(cur_ainext,m,n);
+					++this->C.div_counter;
+					cur_qinext = cur_ainext;
+				}
+				return true;
+			}
+
+			if (n.bitsize() < FastRationalReconstruction<Ring>::_threshold) {       //what about m?
+				return classicQMaxEEA(ai,bi,ci,di,m,n,powh,queueMax,maxQ);
+			}
+
+			if (2*h+1 < d) {
+				size_t lambda = d-2*h-1;
+
+				Element aistar, bistar, cistar, distar;
+				aistar=distar=1;
+				bistar=cistar=0;
+
+				Element mstar = m >> (long unsigned int) lambda;
+				Element nstar = n >> (long unsigned int) lambda;
+
+				size_t log_mstar = 2*h+1;
+
+				queueMax._maxSize +=2;
+				if (nstar > 0) if (!fastQMaxEEA(aistar, bistar, cistar, distar, mstar, log_mstar,nstar, powh, h, queueMax, maxQ)) return false;
+				if (maxQ.q.bitsize() > T.bitsize() + c) return true;
+				if (queueMax._size > 1) {
+					queueMax.pop_back();
+					QMatrix<Ring> Q_i_2 (queueMax.back());
+					queueMax.pop_back();//pop Q*(i-1) q*(i)
+					--queueMax._size ;
+					--queueMax._size ;
+					ai = Q_i_2.a;
+					bi = Q_i_2.b;
+					ci = Q_i_2.c;
+					di = Q_i_2.d;// Q(i-2)= Q*(i-2) q*(i-1)
+				}
+				else {
+					queueMax.clear();
+				}
+				queueMax._maxSize -=2;
+
+				_Z.mul(cur_ri,m,di);
+				_Z.maxpyin(cur_ri,n,bi);
+				_Z.mul(cur_rinext,n,ai);
+				_Z.maxpyin(cur_rinext,m,ci);
+				this->C.mul_counter+=4;
+
+				if (cur_ri < 0) {
+					cur_ri = -cur_ri;
+					cur_rinext = -cur_rinext;
+				}
+				if (cur_rinext>0) {
+					_Z.quo(cur_qinext,cur_ri,cur_rinext);
+					++this->C.div_counter;
+					_Z.axpy(cur_ainext, ai,cur_qinext,bi);
+					++this->C.mul_counter;
+				}
+				else {//should never happen
+					cur_ainext = m+1;//infinity
+					cur_qinext = cur_ainext;
+				}
+			}
+			else { //if (h <= d-1)  //modificition of Wan&Pan
+				Element a1,a2,b1,b2,c1,c2,d1,d2;
+				a1=a2=d1=d2=1;
+				b1=b2=c1=c2=0;
+
+				Element sqrth;
+				size_t logsqrth;
+				logsqrth = h >> (int) 1;
+				powtwo(sqrth, logsqrth);
+
+				if (!fastQMaxEEA(a1,b1,c1,d1,m,d,n,sqrth, logsqrth, queueMax, maxQ)) return false;
+				if (maxQ.q.bitsize() > T.bitsize() + c) return true;
+
+				ai = a1; bi = b1; ci=c1; di = d1;
+
+				Element ri = cur_ri;
+				Element rinext = cur_rinext;
+
+				size_t log_m;
+
+				myQueue<Ring> queueTmp (queueMax._maxSize);
+				QMatrix<Ring> maxQTmp(_Z);
+				if ((rinext > 0) && (cur_ainext <= powh)){
+
+					QMatrix<Ring> newQ(_Z,ai,bi,ci,di,cur_qinext);
+					QMatrix<Ring> top(_Z);
+					if (queueMax.pushpop(top, newQ)) {
+						if (maxQ.q < top.q) {
+							maxQ = top;
+							if (maxQ.q.bitsize() > T.bitsize() + c) return true;
+						}
+					}
+
+					log_m = rinext.bitsize()-1;
+					Element m2, n2;
+					m2 = rinext;
+					_Z.axpy(n2, -cur_qinext, rinext, ri);
+					++this->C.mul_counter;
+					/* compute Q(i+1) */
+					Element tmp = a1;
+					a1 = cur_ainext;
+					b1 = tmp;
+					tmp = c1;
+					_Z.axpy (tmp, cur_qinext, c1, d1);
+					++this->C.mul_counter;
+					d1 = c1;
+					c1 = tmp;
+
+					size_t k = a1.bitsize()-1 ;
+					int _k;
+					if (h-k>2) _k = h-k-2;
+					else _k = 0;
+
+					if (n2 >0) {
+						if (a1 < powh) {
+							if (!fastQMaxEEA(a2,b2,c2,d2,m2,log_m,n2, powtwo(sqrth,_k), _k, queueTmp,maxQTmp)) return false;
+						}
+						else {
+							ai = a1; bi = b1; ci=c1; di = d1;
+							cur_ri = m2;
+							cur_rinext = n2;
+							_Z.quo(cur_qinext,m2,n2);
+							++this->C.div_counter;
+							_Z.axpy(cur_ainext,a1,cur_qinext,b1);
+							++this->C.mul_counter;
+							return true;
+						}
+					}
+					else {
+						ai = a1; bi = b1; ci=c1; di = d1;
+						cur_ri = m2;
+						cur_rinext = n2;
+						cur_qinext = m+1;
+						cur_ainext = m+1;
+						return true;
+					}
+				}
+				else {//ri_next == 0 || cur_ainext >powh
+					ai = a1; bi = b1; ci=c1; di = d1;
+					if (cur_rinext<=0) {
+						cur_ainext = m +1;
+						cur_qinext = cur_ainext;
+					}
+					//do not add matrix
+					return true;
+				}
+
+				_Z.mul(ai,b1,c2);
+				_Z.axpyin(ai,a1,a2);
+				//aistar = a1*a2 + b1*c2;
+				_Z.mul(bi,b1,d2);
+				_Z.axpyin(bi, a1,b2);
+				//bistar = a1*b2 + b1*d2;
+				_Z.mul(ci,d1,c2);
+				_Z.axpyin(ci, c1,a2);
+				//cistar = c1*a2 + d1*c2;
+				_Z.mul(di,d1,d2);
+				_Z.axpyin(di, c1,b2);
+				//distar = c1*b2 + d1*d2;
+				this->C.mul_counter+=8;
+
+				_Z.mul(cur_ri,m,di);
+				_Z.maxpyin(cur_ri,n,bi);
+				_Z.mul(cur_rinext,n,ai);
+				_Z.maxpyin(cur_rinext,m,ci);
+				this->C.mul_counter+=4;
+
+				if (cur_ri < 0) {
+					cur_ri = -cur_ri;
+					cur_rinext = -cur_rinext;
+				}
+
+				if (cur_rinext>0) {
+					_Z.quo(cur_qinext,cur_ri,cur_rinext);
+					++this->C.div_counter;
+					_Z.axpy(cur_ainext, ai,cur_qinext,bi);
+					++this->C.mul_counter;
+				}
+				else {
+					cur_ainext = m+1;//infinity
+					cur_qinext = cur_ainext;
+				}
+
+				//multiply queueTmp by a1b1c1d1
+				QMatrix<Ring > Q_i(_Z,a1,b1,c1,d1);
+				//update maximum
+				if (maxQ.q < maxQTmp.q) {
+					maxQTmp.leftmultiply(Q_i);
+					maxQ = maxQTmp;
+					if (maxQ.q.bitsize() > T.bitsize() + c) return true;
+				}
+				int K=0;
+				QMatrix<Ring > Q(_Z);
+				while (!queueTmp.empty()) {
+					if (ai > powh) {
+						++K;
+						Q=queueTmp.back();
+						queueTmp.pop_back();
+						--queueTmp._size;
+						Q.leftmultiply(Q_i);
+						cur_ainext = ai;
+						cur_qinext = Q.q;
+						Element tmp = cur_ri;
+						_Z.axpy(cur_ri,tmp,Q.q,rinext);
+						cur_rinext = cur_ri;
+						ai = Q.a;
+						bi = Q.b;
+						ci = Q.c;
+						di = Q.d;
+						//qi = Q.q;
+					}
+					else {
+						//update queue;
+						Q=queueTmp.front();
+						queueTmp.pop_front();
+						--queueTmp._size;
+						if (maxQ.q < Q.q) {
+							Q.leftmultiply(Q_i);
+						}
+						QMatrix<Ring > top(_Z);
+						if (queueMax.pushpop(top, Q)) {
+							if (maxQ.q < top.q) {
+								maxQ = top;
+								if (maxQ.q.bitsize() > T.bitsize() + c) return true;
+							}
+						}
+					}
+				}
+				if (K >0) {
+					std::cout << "Error:" << K << " backward steps - should not happen\n"<< std::flush;
+					return false;
+				}
+				return true;
+#if 0
+				//modification of Wan &Pan
+				else {//h=d, h = d+1;
+					Element hh = powh;
+					size_t log_hh = h;
+					hh = powh >> 1;
+					while (log_hh > d-1) {
+						--log_hh;
+						hh >>= 1;
+					}
+					if (!fastQMaxEEA(ai,bi,ci,di,m,d,n,hh, d-1,queueMax,maxQ)) return false;
+				}
+
+#endif
+			}
+
+			Element ri = cur_ri;
+			Element rinext = cur_rinext;
+			Element qinext = cur_qinext;
+			Element qi;
+			if (rinext==0) {
+				return true;
+			}
+
+			if (qinext <=0) {
+				std::cout << "ERROR sth went very very wrong:"<< std::flush ;
+				std::cout << "m:" << m << " n:" << n << " h:" << powh << "\n"<< std::flush;
+				std::cout << ai << " " << bi << "\n" << ci << " " << di <<"\n"<< std::flush; //getchar();
+				return false;
+			}
+
+			Element ainext, binext, cinext,dinext;
+			ainext=dinext=1;
+			binext=cinext=0;
+			ainext = cur_ainext;
+			int K=-1;
+			while (1) {
+				++K;
+				if (powh < ainext) {
+					cur_ri = ri;
+					cur_rinext = rinext;
+					cur_ainext = ainext;
+					cur_qinext = qinext;
+
+					return true;
+				}
+				else {
+
+					QMatrix<Ring > Q(_Z,ai,bi,ci,di,qinext);
+					QMatrix<Ring > top(_Z);
+					if (queueMax.pushpop(top, Q)) {
+						if (maxQ.q < top.q) {
+							maxQ = top;
+							if (maxQ.q.bitsize() > T.bitsize() + c) return true;
+						}
+					}
+
+					bi = ai;
+					ai = ainext;
+					Element temp = ci;
+					//ci = ci*qinext + di;
+					_Z.axpy(ci, ci,qinext,di);
+					++this->C.mul_counter;
+					di = temp;
+					//qi = qinext;
+
+					temp = ri;
+					ri=rinext;
+					//rinext=qinext*ri+temp;
+					//rinext = temp - qinext*ri;
+					_Z.axpy(rinext, -qinext,ri,temp);
+					++this->C.mul_counter;
+
+					if (rinext==0) {
+						cur_ri = ri;
+						cur_rinext = rinext;
+						cur_ainext = m+1;
+						cur_qinext = m+1;
+						return true;
+					}
+					_Z.quo(qinext,ri,rinext);
+					++this->C.div_counter;
+
+					_Z.axpy(ainext, ai,qinext,bi);
+					++this->C.mul_counter;
+				}
+			}
+
+			return false;
+		}
+	};
+
+}
+
+#endif //__LINBOX_fast_reconstruction_H
diff --git a/linbox/algorithms/gauss-det.inl b/linbox/algorithms/gauss-det.inl
new file mode 100644
index 0000000..7a2084d
--- /dev/null
+++ b/linbox/algorithms/gauss-det.inl
@@ -0,0 +1,69 @@
+/* -*- 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
+/* linbox/algorithms/gauss-det.inl
+ * Copyright (C) 2009 The LinBox group
+ *
+// Time-stamp: <15 Jun 10 17:20:08 Jean-Guillaume.Dumas at imag.fr>
+ *
+ * See COPYING for license information.
+ *
+ * SparseElimination determinant calls
+ */
+#ifndef __LINBOX_gauss_det_INL
+#define __LINBOX_gauss_det_INL
+
+namespace LinBox
+{
+	template <class _Field>
+	template <class Matrix> inline typename GaussDomain<_Field>::Element&
+	GaussDomain<_Field>::detin(Element        &determinant,
+				   Matrix        &A,
+				   unsigned long  Ni,
+				   unsigned long  Nj,
+				   SparseEliminationTraits::PivotStrategy   reord)  const
+	{
+		unsigned long rank;
+		if (reord == SparseEliminationTraits::PIVOT_NONE)
+			NoReordering(rank, determinant, A,  Ni, Nj);
+		else
+			InPlaceLinearPivoting(rank, determinant, A, Ni, Nj);
+		return determinant;
+	}
+
+
+	template <class _Field>
+	template <class Matrix> inline typename GaussDomain<_Field>::Element&
+	GaussDomain<_Field>::detin(Element &determinant,
+				   Matrix  &A,
+				   SparseEliminationTraits::PivotStrategy   reord)  const
+	{
+		return detin(determinant, A,  A.rowdim (), A.coldim (), reord);
+	}
+
+
+
+	template <class _Field>
+	template <class Matrix> inline typename GaussDomain<_Field>::Element&
+	GaussDomain<_Field>::det(Element        &determinant,
+				 const Matrix   &A,
+				 SparseEliminationTraits::PivotStrategy   reord)  const
+	{
+		return det(determinant, A,  A.rowdim (), A.coldim (), reord);
+	}
+
+	template <class _Field>
+	template <class Matrix> inline typename GaussDomain<_Field>::Element&
+	GaussDomain<_Field>::det(Element       &determinant,
+				 const Matrix  &A,
+				 unsigned long  Ni,
+				 unsigned long  Nj,
+				 SparseEliminationTraits::PivotStrategy   reord)  const
+	{
+		Matrix CopyA(Ni);
+		for(unsigned long i = 0; i < Ni; ++i)
+			CopyA[i] = A[i];
+		return detin(determinant, CopyA, Ni, Nj, reord);
+	}
+} // namespace LinBox
+
+#endif // __LINBOX_gauss_det_INL
diff --git a/linbox/algorithms/gauss-elim-gf2.inl b/linbox/algorithms/gauss-elim-gf2.inl
new file mode 100644
index 0000000..8b421f1
--- /dev/null
+++ b/linbox/algorithms/gauss-elim-gf2.inl
@@ -0,0 +1,308 @@
+/* -*- 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
+/* linbox/algorithms/gauss-elim-gf2.inl
+ * Copyright (C) 2009 The LinBox group
+ *
+ * Time-stamp: <21 Jan 10 15:08:59 Jean-Guillaume.Dumas at imag.fr>
+ *
+ * See COPYING for license information.
+ *
+ * SparseElimination elimination routines over GF2
+ */
+#ifndef __LINBOX_gauss_elim_gf2_INL
+#define __LINBOX_gauss_elim_gf2_INL
+
+namespace LinBox
+{
+	template <class Vector> inline void
+	GaussDomain<GF2>::permuteBinary (Vector              &lignecourante,
+					 const unsigned long &indcol,
+					 const long &indpermut) const
+	{
+		const unsigned long k = indcol - 1;
+
+#if 0
+		std::cerr << "B PERMUTE: " << indpermut << " <--> " << k << " of  [";
+		for(typename Vector::const_iterator refs =  lignecourante.begin();
+		    refs != lignecourante.end() ;
+		    ++refs )
+			std::cerr << '(' << refs->first << ';' << refs->second << ')';
+		std::cerr << "]" << std::endl;
+#endif
+
+		// precondition indpermut != k
+		if (lignecourante.size () ) {
+			typename Vector::iterator kin_it=lignecourante.begin();
+			for (; kin_it != lignecourante.end(); ++kin_it)
+				if (*kin_it >= k) break;
+			if (kin_it !=  lignecourante.end()) {
+				typename Vector::iterator pin_it=kin_it;
+				for (; pin_it != lignecourante.end(); ++pin_it)
+					if (static_cast<long>(*pin_it) >= indpermut) break;
+				if ( *kin_it == k) {
+					if (pin_it != lignecourante.end()) {
+						if ( static_cast<long>(*pin_it) != indpermut) {
+							--pin_it;
+							// Only k there
+							*kin_it = indpermut;
+							typename Vector::value_type etmp = *kin_it;
+							typename Vector::iterator current = kin_it;
+							typename Vector::iterator next = kin_it; ++next;
+							for( ; current != pin_it; ++current, ++next)
+								*current = *next;
+							*pin_it = etmp;
+						}
+					}
+					else {
+						--pin_it;
+						// Only k there
+						*kin_it = indpermut;
+						typename Vector::value_type etmp = *kin_it;
+						typename Vector::iterator current = kin_it;
+						typename Vector::iterator next = kin_it; ++next;
+						for( ; current != pin_it; ++current, ++next)
+							*current = *next;
+						*pin_it = etmp;
+					}
+				}
+				else {
+					if (pin_it != lignecourante.end()) {
+						if ( static_cast<long>(*pin_it) == indpermut) {
+							// Only indpermut there
+							*pin_it = k;
+							typename Vector::value_type etmp = *pin_it;
+							typename Vector::iterator current = pin_it;
+							typename Vector::iterator prev = pin_it; --prev;
+							for( ; current != kin_it; --current, --prev)
+								*current = *prev;
+							*kin_it = etmp;
+						} // else Nobody
+					} // else Nobody
+				}
+			} // else rien de supérieur à k dans l
+			// donc rien à permuter
+		}
+
+#if 0
+		std::cerr << "E PERMUTE: " << indpermut << " <--> " << k << " of  [";
+		for(typename Vector::const_iterator refs =  lignecourante.begin();
+		    refs != lignecourante.end() ;
+		    ++refs )
+			std::cerr << '(' << refs->first << ';' << refs->second << ')';
+		std::cerr << "]" << std::endl;
+#endif
+	}
+
+
+	template <class Vector, class D> inline void
+	GaussDomain<GF2>::eliminateBinary (bool             &headpivot,
+					   Vector              &lignecourante,
+					   const Vector        &lignepivot,
+					   const unsigned long indcol,
+					   const long indpermut,
+					   const unsigned long npiv,
+					   D                   &columns) const
+	{
+
+		typedef typename Vector::value_type E;
+
+		unsigned long k = indcol - 1;
+		unsigned long nj = lignecourante.size () ;
+#if 0
+		std::cerr << "BEGIN ELIMINATE, k: " << k << ", nj: " << nj << ", indpermut: " << indpermut << ", indcol: " << indcol << std::endl;
+		std::cerr << "lignepivot: [";
+		for(typename Vector::const_iterator refs =  lignepivot.begin();
+		    refs != lignepivot.end() ;
+		    ++refs )
+			std::cerr << '(' << refs->first << ';' << refs->second << ')';
+		std::cerr << "], lignecour: [";
+		for(typename Vector::const_iterator refs =  lignecourante.begin();
+		    refs != lignecourante.end() ;
+		    ++refs )
+			std::cerr << '(' << refs->first << ';' << refs->second << ')';
+		std::cerr << ']' << std::endl;
+#endif
+		if (nj > 0) {
+			unsigned long j_head = 0;
+
+			for (; j_head < nj; ++j_head) {
+				if (static_cast<long>(lignecourante[j_head]) >= indpermut) break;
+#if 0
+				std::cerr << "ELIMINATE, j_head: " << j_head << std::endl;
+#endif
+			}
+
+			if (j_head < nj) {
+				if (static_cast<long>(lignecourante[j_head]) == indpermut) {
+					// -------------------------------------------
+					// Permutation
+					if ( indpermut != static_cast<long>(k)) {
+						if (lignecourante[0] != k) {
+							// zero <--> non zero
+							E tmp = lignecourante[j_head];
+							--columns[tmp];
+							++columns[k];
+							tmp = k;
+
+							for (long l = j_head; l > 0; l--)
+								lignecourante[l] = lignecourante[l-1];
+
+							lignecourante[0] = tmp;
+						}
+						j_head = 0;
+					}
+					// -------------------------------------------
+					// Elimination
+					Vector construit (nj + npiv);
+
+					// construit : <-- j
+					// courante  : <-- m
+					// pivot     : <-- l
+					unsigned long j = 0;
+					unsigned long m = j_head + 1;
+
+					// A[i,k] <-- - A[i,k] / A[k,k]
+					headpivot = true;
+					--columns[lignecourante[j_head] ];
+
+					// if A[k,j]=0, then A[i,j] <-- A[i,j]
+					while (j < j_head) {
+						construit[j] = lignecourante[j];
+						++j;
+					}
+
+					unsigned long j_piv;
+
+					unsigned long l = 0;
+
+					for (; l < npiv; ++l)
+						if (lignepivot[l] > k) break;
+
+					// for all j such that (j>k) and A[k,j]!=0
+					while (l < npiv) {
+						j_piv = lignepivot[l];
+
+						// if A[k,j]=0, then A[i,j] <-- A[i,j]
+						while ((m < nj) && (lignecourante[m] < j_piv))
+							construit[j++] = lignecourante[m++];
+
+						// if A[i,j]!=0, then A[i,j] <-- A[i,j] - A[i,k]*A[k,j]
+						if ((m < nj) && (lignecourante[m] == j_piv)) {
+							--columns[lignecourante[m++]];
+						}
+						else {
+							++columns[j_piv];
+							construit[j++] = E (j_piv);
+						}
+
+						++l;
+					}
+
+					// if A[k,j]=0, then A[i,j] <-- A[i,j]
+					while (m<nj)
+						construit[j++] = lignecourante[m++];
+
+					construit.resize (j);
+					lignecourante = construit;
+				}
+				else {
+					// -------------------------------------------
+					// j_head < nj but nothing under the pivot
+					// Permutation
+#if 0
+					std::cerr << "----------------------------------------------------------" << std::endl;
+					std::cerr << "j_head < nj" << std::endl;
+					std::cerr << "j_head: " << j_head << ", nj: " << nj << ", k:" << k
+					// << "lignepivot: " << lignepivot
+					// << ", lignecour: " << lignecourante
+					<< std::endl;
+					std::cerr << "----------------------------------------------------------" << std::endl;
+#endif
+					if (indpermut != static_cast<long>(k)) {
+						if (j_head>0) {
+							unsigned long l = 0;
+
+							for (; l < nj; ++l)
+								if (lignecourante[l] >= k) break;
+
+							if ((l < nj) && (lignecourante[l] == k))  {
+								// non zero <--> zero
+								E tmp = lignecourante[l];
+								--columns[k];
+								++columns[indpermut];
+								tmp = indpermut;
+
+								unsigned long bjh = j_head-1;
+								for (; l < bjh; ++l)
+									lignecourante[l] = lignecourante[l + 1];
+
+								lignecourante[bjh] = tmp;
+							} // else // zero <--> zero
+						} // else // zero <--> zero
+					}
+				}
+			}
+			else {
+				// -------------------------------------------
+				// j_head >= nj > 0
+#if 0
+				std::cerr << "----------------------------------------------------------" << std::endl;
+				std::cerr << "j_head >= nj > 0" << std::endl;
+				std::cerr << "j_head: " << j_head << ", nj: " << nj << ", k:" << k
+				// << "lignepivot: " << lignepivot
+				// << ", lignecour: " << lignecourante
+				<< std::endl;
+				std::cerr << "----------------------------------------------------------" << std::endl;
+#endif
+				if (indpermut != static_cast<long>(k)) {
+					unsigned long l = 0;
+
+					for (; l < nj; ++l)
+						if (lignecourante[l] >= k) break;
+
+					if ((l < nj) && (lignecourante[l] == k))  {
+						// non zero <--> zero
+						E tmp = lignecourante[l];
+						--columns[k];
+						++columns[indpermut];
+						tmp = indpermut;
+
+						unsigned long bjh = nj - 1;
+						for (; l < bjh; ++l)
+							lignecourante[l] = lignecourante[l + 1];
+
+						lignecourante[bjh] = tmp;
+					} // else
+					// zero <--> zero
+				}
+
+			}
+		}
+
+
+#if 0
+		std::cerr << "END ELIMINATE, k: " << k << ", nj: " << nj << ", indpermut: " << indpermut << ", indcol: " << indcol << std::endl;
+		std::cerr << "lignepivot: [";
+		for(typename Vector::const_iterator refs =  lignepivot.begin();
+		    refs != lignepivot.end() ;
+		    ++refs )
+			std::cerr << '(' << refs->first << ';' << refs->second << ')';
+		std::cerr << "], lignecour: [";
+		for(typename Vector::const_iterator refs =  lignecourante.begin();
+		    refs != lignecourante.end() ;
+		    ++refs )
+			std::cerr << '(' << refs->first << ';' << refs->second << ')';
+		std::cerr << ']' << std::endl;
+#endif
+
+	}
+
+
+
+
+
+
+} // namespace LinBox
+
+#endif // __LINBOX_gauss_elim_gf2_INL
+
diff --git a/linbox/algorithms/gauss-elim.inl b/linbox/algorithms/gauss-elim.inl
new file mode 100644
index 0000000..e088f90
--- /dev/null
+++ b/linbox/algorithms/gauss-elim.inl
@@ -0,0 +1,820 @@
+/* -*- 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
+/* linbox/algorithms/gauss-elim.inl
+ * Copyright (C) 2009 The LinBox group
+ *
+ * Time-stamp: <21 Jan 10 15:06:11 Jean-Guillaume.Dumas at imag.fr>
+ *
+ * See COPYING for license information.
+ *
+ * SparseElimination elimination routines
+ */
+#ifndef __LINBOX_gauss_elim_INL
+#define __LINBOX_gauss_elim_INL
+
+namespace LinBox
+{
+	template <class _Field>
+	template <class Vector> inline void
+	GaussDomain<_Field>::permute (Vector              &lignecourante,
+				      const unsigned long &indcol,
+				      const long &indpermut) const
+	{
+		const unsigned long k = indcol - 1;
+
+#if 0
+		std::cerr << "B PERMUTE: " << indpermut << " <--> " << k << " of  [";
+		for(typename Vector::const_iterator refs =  lignecourante.begin();
+		    refs != lignecourante.end() ;
+		    ++refs )
+			std::cerr << '(' << refs->first << ';' << refs->second << ')';
+		std::cerr << "]" << std::endl;
+#endif
+
+		// precondition indpermut != k
+		if (lignecourante.size () ) {
+			typename Vector::iterator kin_it=lignecourante.begin();
+			for (; kin_it != lignecourante.end(); ++kin_it)
+				if (kin_it->first >= k) break;
+			if (kin_it !=  lignecourante.end()) {
+				typename Vector::iterator pin_it=kin_it;
+				for (; pin_it != lignecourante.end(); ++pin_it)
+					if (static_cast<long>(pin_it->first) >= indpermut) break;
+				if ( kin_it->first == k) {
+					if (pin_it != lignecourante.end()) {
+						if ( static_cast<long>(pin_it->first) == indpermut) {
+							// Both there
+							std::swap( kin_it->second, pin_it->second);
+						}
+						else {
+							// Only k there
+							kin_it->first = indpermut;
+							typename Vector::value_type etmp = *kin_it;
+							--pin_it;
+							typename Vector::iterator current = kin_it;
+							typename Vector::iterator next = kin_it; ++next;
+							for( ; current != pin_it; ++current, ++next)
+								*current = *next;
+							*pin_it = etmp;
+						}
+					}
+					else {
+						--pin_it;
+						// Only k there
+						kin_it->first = indpermut;
+						typename Vector::value_type etmp = *kin_it;
+						typename Vector::iterator current = kin_it;
+						typename Vector::iterator next = kin_it; ++next;
+						for( ; current != pin_it; ++current, ++next)
+							*current = *next;
+						*pin_it = etmp;
+					}
+				}
+				else {
+					if (pin_it != lignecourante.end()) {
+						if ( static_cast<long>(pin_it->first) == indpermut) {
+							// Only indpermut there
+							pin_it->first = k;
+							typename Vector::value_type etmp = *pin_it;
+							typename Vector::iterator current = pin_it;
+							typename Vector::iterator prev = pin_it; --prev;
+							for( ; current != kin_it; --current, --prev)
+								*current = *prev;
+							*kin_it = etmp;
+						} // else Nobody
+					} // else Nobody
+				}
+			} // else rien de supérieur à k dans l
+			// donc rien à permuter
+		}
+
+#if 0
+		std::cerr << "E PERMUTE: " << indpermut << " <--> " << k << " of  [";
+		for(typename Vector::const_iterator refs =  lignecourante.begin();
+		    refs != lignecourante.end() ;
+		    ++refs )
+			std::cerr << '(' << refs->first << ';' << refs->second << ')';
+		std::cerr << "]" << std::endl;
+#endif
+	}
+
+
+
+
+	template <class _Field>
+	template <class Vector, class D> inline void
+	GaussDomain<_Field>::eliminate (Vector              &lignecourante,
+					const Vector        &lignepivot,
+					const unsigned long &indcol,
+					const long &indpermut,
+					D                   &columns) const
+	{
+
+		typedef typename Vector::value_type E;
+
+		unsigned long k = indcol - 1;
+		unsigned long nj = lignecourante.size () ;
+#if 0
+		std::cerr << "BEGIN ELIMINATE, k: " << k << ", nj: " << nj << ", indpermut: " << indpermut << ", indcol: " << indcol << std::endl;
+		std::cerr << "lignepivot: [";
+		for(typename Vector::const_iterator refs =  lignepivot.begin();
+		    refs != lignepivot.end() ;
+		    ++refs )
+			std::cerr << '(' << refs->first << ';' << refs->second << ')';
+		std::cerr << "], lignecour: [";
+		for(typename Vector::const_iterator refs =  lignecourante.begin();
+		    refs != lignecourante.end() ;
+		    ++refs )
+			std::cerr << '(' << refs->first << ';' << refs->second << ')';
+		std::cerr << ']' << std::endl;
+#endif
+		if (nj > 0) {
+			unsigned long j_head = 0;
+
+			for (; j_head < nj; ++j_head) {
+				if (static_cast<long>(lignecourante[j_head].first) >= indpermut) break;
+#if 0
+				std::cerr << "ELIMINATE, j_head: " << j_head << std::endl;
+#endif
+				}
+
+			if (j_head < nj) {
+				if (static_cast<long>(lignecourante[j_head].first) == indpermut) {
+					// -------------------------------------------
+					// Permutation
+					if ( indpermut != static_cast<long>(k)) {
+						if (lignecourante[0].first == k) {
+							// non zero  <--> non zero
+							std::swap( lignecourante[0].second, lignecourante[j_head].second);
+						}
+						else {
+							// zero <--> non zero
+							E tmp = lignecourante[j_head];
+							--columns[tmp.first];
+							++columns[k];
+							tmp.first = k;
+
+							for (long l = j_head; l > 0; l--)
+								lignecourante[l] = lignecourante[l-1];
+
+							lignecourante[0] = tmp;
+						}
+						j_head = 0;
+					}
+					// -------------------------------------------
+					// Elimination
+					unsigned long npiv = lignepivot.size ();
+					Vector construit (nj + npiv);
+
+					// construit : <-- j
+					// courante  : <-- m
+					// pivot     : <-- l
+					unsigned long j = 0;
+					unsigned long m = j_head + 1;
+
+					// A[i,k] <-- - A[i,k] / A[k,k]
+					Element headcoeff;
+					_F.divin (_F.neg (headcoeff, lignecourante[j_head].second),
+						  lignepivot[0].second);
+
+					--columns[lignecourante[j_head].first];
+
+					// if A[k,j]=0, then A[i,j] <-- A[i,j]
+					while (j < j_head) {
+						construit[j] = lignecourante[j];
+						j++;
+					}
+
+					unsigned long j_piv;
+
+					unsigned long l = 0;
+
+					for (; l < npiv; l++)
+						if (lignepivot[l].first > k) break;
+
+					// for all j such that (j>k) and A[k,j]!=0
+					while (l < npiv) {
+						j_piv = lignepivot[l].first;
+
+						// if A[k,j]=0, then A[i,j] <-- A[i,j]
+						while ((m < nj) && (lignecourante[m].first < j_piv))
+							construit[j++] = lignecourante[m++];
+
+						// if A[i,j]!=0, then A[i,j] <-- A[i,j] - A[i,k]*A[k,j]
+						if ((m < nj) && (lignecourante[m].first == j_piv)) {
+							Element tmp;
+
+							_F.axpy (tmp, headcoeff, lignepivot[l].second,
+								 lignecourante[m].second);
+
+							if (! _F.isZero (tmp)) {
+								_F.assign (lignecourante[m].second, tmp);
+								construit[j++] = lignecourante[m++];
+							}
+							else
+								--columns[lignecourante[m++].first];
+						}
+						else {
+							Element tmp;
+
+							_F.mul (tmp, headcoeff, lignepivot[l].second);
+
+							// if (! _F.isZero (tmp)) {
+							++columns[j_piv];
+							construit[j++] = E (j_piv, tmp);
+							// }
+							// else
+							// std::cerr << "NEVER HAPPENED" << std::endl;
+
+						}
+
+						l++;
+					}
+
+					// if A[k,j]=0, then A[i,j] <-- A[i,j]
+					while (m<nj)
+						construit[j++] = lignecourante[m++];
+
+					construit.resize (j);
+					lignecourante = construit;
+				}
+				else {
+					// -------------------------------------------
+					// j_head < nj but nothing under the pivot
+					// Permutation
+#if 0
+					std::cerr << "----------------------------------------------------------" << std::endl;
+					std::cerr << "j_head < nj" << std::endl;
+					std::cerr << "j_head: " << j_head << ", nj: " << nj << ", k:" << k
+					// << "lignepivot: " << lignepivot
+					// << ", lignecour: " << lignecourante
+					<< std::endl;
+					std::cerr << "----------------------------------------------------------" << std::endl;
+#endif
+					if (indpermut != static_cast<long>(k)) {
+						if (j_head>0) {
+							unsigned long l = 0;
+
+							for (; l < nj; ++l)
+								if (lignecourante[l].first >= k) break;
+
+							if ((l < nj) && (lignecourante[l].first == k))  {
+								// non zero <--> zero
+								E tmp = lignecourante[l];
+								--columns[k];
+								++columns[indpermut];
+								tmp.first = indpermut;
+
+								unsigned long bjh = j_head-1;
+								for (; l < bjh; ++l)
+									lignecourante[l] = lignecourante[l + 1];
+
+								lignecourante[bjh] = tmp;
+							} // else // zero <--> zero
+						} // else // zero <--> zero
+					}
+				}
+			}
+			else {
+				// -------------------------------------------
+				// j_head >= nj > 0
+#if 0
+				std::cerr << "----------------------------------------------------------" << std::endl;
+				std::cerr << "j_head >= nj > 0" << std::endl;
+				std::cerr << "j_head: " << j_head << ", nj: " << nj << ", k:" << k
+				// << "lignepivot: " << lignepivot
+				// << ", lignecour: " << lignecourante
+				<< std::endl;
+				std::cerr << "----------------------------------------------------------" << std::endl;
+#endif
+				if (indpermut != static_cast<long>(k)) {
+					unsigned long l = 0;
+
+					for (; l < nj; ++l)
+						if (lignecourante[l].first >= k) break;
+
+					if ((l < nj) && (lignecourante[l].first == k))  {
+						// non zero <--> zero
+						E tmp = lignecourante[l];
+						--columns[k];
+						++columns[indpermut];
+						tmp.first = indpermut;
+
+						unsigned long bjh = nj - 1;
+						for (; l < bjh; ++l)
+							lignecourante[l] = lignecourante[l + 1];
+
+						lignecourante[bjh] = tmp;
+					} // else
+					// zero <--> zero
+				}
+
+			}
+		}
+
+
+#if 0
+		std::cerr << "END ELIMINATE, k: " << k << ", nj: " << nj << ", indpermut: " << indpermut << ", indcol: " << indcol << std::endl;
+		std::cerr << "lignepivot: [";
+		for(typename Vector::const_iterator refs =  lignepivot.begin();
+		    refs != lignepivot.end() ;
+		    ++refs )
+			std::cerr << '(' << refs->first << ';' << refs->second << ')';
+		std::cerr << "], lignecour: [";
+		for(typename Vector::const_iterator refs =  lignecourante.begin();
+		    refs != lignecourante.end() ;
+		    ++refs )
+			std::cerr << '(' << refs->first << ';' << refs->second << ')';
+		std::cerr << ']' << std::endl;
+#endif
+	}
+
+
+	template <class _Field>
+	template <class Vector, class D> inline void
+	GaussDomain<_Field>::eliminate (Element             &headpivot,
+					Vector              &lignecourante,
+					const Vector        &lignepivot,
+					const unsigned long indcol,
+					const long indpermut,
+					const unsigned long npiv,
+					D                   &columns) const
+	{
+
+		typedef typename Vector::value_type E;
+
+		unsigned long k = indcol - 1;
+		unsigned long nj = lignecourante.size () ;
+#if 0
+		std::cerr << "BEGIN ELIMINATE, k: " << k << ", nj: " << nj << ", indpermut: " << indpermut << ", indcol: " << indcol << std::endl;
+		std::cerr << "lignepivot: [";
+		for(typename Vector::const_iterator refs =  lignepivot.begin();
+		    refs != lignepivot.end() ;
+		    ++refs )
+			std::cerr << '(' << refs->first << ';' << refs->second << ')';
+		std::cerr << "], lignecour: [";
+		for(typename Vector::const_iterator refs =  lignecourante.begin();
+		    refs != lignecourante.end() ;
+		    ++refs )
+			std::cerr << '(' << refs->first << ';' << refs->second << ')';
+		std::cerr << ']' << std::endl;
+#endif
+		if (nj > 0) {
+			unsigned long j_head = 0;
+
+			for (; j_head < nj; ++j_head) {
+				if (static_cast<long>(lignecourante[j_head].first) >= indpermut) break;
+#if 0
+				std::cerr << "ELIMINATE, j_head: " << j_head << std::endl;
+#endif
+				}
+
+			if (j_head < nj) {
+				if (static_cast<long>(lignecourante[j_head].first) == indpermut) {
+					// -------------------------------------------
+					// Permutation
+					if ( indpermut != static_cast<long>(k)) {
+						if (lignecourante[0].first == k) {
+							// non zero  <--> non zero
+							std::swap( lignecourante[0].second, lignecourante[j_head].second);
+						}
+						else {
+							// zero <--> non zero
+							E tmp = lignecourante[j_head];
+							--columns[tmp.first];
+							++columns[k];
+							tmp.first = k;
+
+							for (long l = j_head; l > 0; l--)
+								lignecourante[l] = lignecourante[l-1];
+
+							lignecourante[0] = tmp;
+						}
+						j_head = 0;
+					}
+					// -------------------------------------------
+					// Elimination
+					Vector construit (nj + npiv);
+
+					// construit : <-- j
+					// courante  : <-- m
+					// pivot     : <-- l
+					unsigned long j = 0;
+					unsigned long m = j_head + 1;
+
+					// A[i,k] <-- - A[i,k] / A[k,k]
+					Element headcoeff;
+					_F.div( headpivot, lignecourante[j_head].second,
+						lignepivot[0].second);
+					_F.neg(headcoeff, headpivot);
+					//                     _F.divin (_F.neg (headcoeff, lignecourante[j_head].second),
+					//                               lignepivot[0].second);
+
+					--columns[lignecourante[j_head].first];
+
+					// if A[k,j]=0, then A[i,j] <-- A[i,j]
+					while (j < j_head) {
+						construit[j] = lignecourante[j];
+						j++;
+					}
+
+					unsigned long j_piv;
+
+					unsigned long l = 0;
+
+					for (; l < npiv; l++)
+						if (lignepivot[l].first > k) break;
+
+					// for all j such that (j>k) and A[k,j]!=0
+					while (l < npiv) {
+						j_piv = lignepivot[l].first;
+
+						// if A[k,j]=0, then A[i,j] <-- A[i,j]
+						while ((m < nj) && (lignecourante[m].first < j_piv))
+							construit[j++] = lignecourante[m++];
+
+						// if A[i,j]!=0, then A[i,j] <-- A[i,j] - A[i,k]*A[k,j]
+						if ((m < nj) && (lignecourante[m].first == j_piv)) {
+							Element tmp;
+
+							_F.axpy (tmp, headcoeff, lignepivot[l].second,
+								 lignecourante[m].second);
+
+							if (! _F.isZero (tmp)) {
+								_F.assign (lignecourante[m].second, tmp);
+								construit[j++] = lignecourante[m++];
+							}
+							else
+								--columns[lignecourante[m++].first];
+						}
+						else {
+							Element tmp;
+
+							_F.mul (tmp, headcoeff, lignepivot[l].second);
+
+							// if (! _F.isZero (tmp)) {
+							++columns[j_piv];
+							construit[j++] = E (j_piv, tmp);
+							// }
+							// else
+							// std::cerr << "NEVER HAPPENED" << std::endl;
+
+						}
+
+						l++;
+					}
+
+					// if A[k,j]=0, then A[i,j] <-- A[i,j]
+					while (m<nj)
+						construit[j++] = lignecourante[m++];
+
+					construit.resize (j);
+					lignecourante = construit;
+				}
+				else {
+					// -------------------------------------------
+					// j_head < nj but nothing under the pivot
+					// Permutation
+#if 0
+					std::cerr << "----------------------------------------------------------" << std::endl;
+					std::cerr << "j_head < nj" << std::endl;
+					std::cerr << "j_head: " << j_head << ", nj: " << nj << ", k:" << k
+					// << "lignepivot: " << lignepivot
+					// << ", lignecour: " << lignecourante
+					<< std::endl;
+					std::cerr << "----------------------------------------------------------" << std::endl;
+#endif
+					if (indpermut != static_cast<long>(k)) {
+						if (j_head>0) {
+							unsigned long l = 0;
+
+							for (; l < nj; ++l)
+								if (lignecourante[l].first >= k) break;
+
+							if ((l < nj) && (lignecourante[l].first == k))  {
+								// non zero <--> zero
+								E tmp = lignecourante[l];
+								--columns[k];
+								++columns[indpermut];
+								tmp.first = indpermut;
+
+								unsigned long bjh = j_head-1;
+								for (; l < bjh; ++l)
+									lignecourante[l] = lignecourante[l + 1];
+
+								lignecourante[bjh] = tmp;
+							} // else // zero <--> zero
+						} // else // zero <--> zero
+					}
+				}
+			}
+			else {
+				// -------------------------------------------
+				// j_head >= nj > 0
+#if 0
+				std::cerr << "----------------------------------------------------------" << std::endl;
+				std::cerr << "j_head >= nj > 0" << std::endl;
+				std::cerr << "j_head: " << j_head << ", nj: " << nj << ", k:" << k
+				// << "lignepivot: " << lignepivot
+				// << ", lignecour: " << lignecourante
+				<< std::endl;
+				std::cerr << "----------------------------------------------------------" << std::endl;
+#endif
+				if (indpermut != static_cast<long>(k)) {
+					unsigned long l = 0;
+
+					for (; l < nj; ++l)
+						if (lignecourante[l].first >= k) break;
+
+					if ((l < nj) && (lignecourante[l].first == k))  {
+						// non zero <--> zero
+						E tmp = lignecourante[l];
+						--columns[k];
+						++columns[indpermut];
+						tmp.first = indpermut;
+
+						unsigned long bjh = nj - 1;
+						for (; l < bjh; ++l)
+							lignecourante[l] = lignecourante[l + 1];
+
+						lignecourante[bjh] = tmp;
+					} // else
+					// zero <--> zero
+				}
+
+			}
+		}
+
+#if 0
+		std::cerr << "END ELIMINATE, k: " << k << ", nj: " << nj << ", indpermut: " << indpermut << ", indcol: " << indcol << std::endl;
+		std::cerr << "lignepivot: [";
+		for(typename Vector::const_iterator refs =  lignepivot.begin();
+		    refs != lignepivot.end() ;
+		    ++refs )
+			std::cerr << '(' << refs->first << ';' << refs->second << ')';
+		std::cerr << "], lignecour: [";
+		for(typename Vector::const_iterator refs =  lignecourante.begin();
+		    refs != lignecourante.end() ;
+		    ++refs )
+			std::cerr << '(' << refs->first << ';' << refs->second << ')';
+		std::cerr << ']' << std::endl;
+#endif
+	}
+
+
+
+	template <class _Field>
+	template <class Vector> inline void
+	GaussDomain<_Field>::eliminate (Vector              &lignecourante,
+					const Vector        &lignepivot,
+					const unsigned long &indcol,
+					const long &indpermut) const
+	{
+		typedef typename Vector::value_type E;
+
+		unsigned long k = indcol - 1;
+		unsigned long nj = lignecourante.size () ;
+
+		if (nj > 0) {
+			unsigned long j_head = 0;
+
+			for (; j_head < nj; ++j_head)
+				if (static_cast<long>(lignecourante[j_head].first) >= indpermut) break;
+
+			if (j_head < nj) {
+				if (static_cast<long>(lignecourante[j_head].first) == indpermut) {
+					// -------------------------------------------
+					// Permutation
+					if (indpermut != static_cast<long>(k)) {
+						if (lignecourante[0].first == k) {
+							// non zero  <--> non zero
+							std::swap( lignecourante[0].second, lignecourante[j_head].second);
+						}
+						else {
+							// zero <--> non zero
+							E tmp = lignecourante[j_head];
+							tmp.first = k;
+							for (long l = j_head; l > 0; l--)
+								lignecourante[l] = lignecourante[l-1];
+							lignecourante[0] = tmp;
+						}
+
+						j_head = 0;
+					}
+					// -------------------------------------------
+					// Elimination
+					unsigned long npiv = lignepivot.size ();
+					Vector construit (nj + npiv);
+					// construit : <-- j
+					// courante  : <-- m
+					// pivot     : <-- l
+					unsigned long j = 0;
+					unsigned long m = j_head + 1;
+
+					// A[i,k] <-- - A[i,k] / A[k,k]
+
+					Element headcoeff;
+					_F.divin (_F.neg (headcoeff, lignecourante[j_head].second),
+						  lignepivot[0].second);
+
+					// if A[k,j]=0, then A[i,j] <-- A[i,j]
+					while (j < j_head) {
+						construit[j] = lignecourante[j];
+						j++;
+					}
+
+					unsigned long j_piv;
+					unsigned long l = 0;
+
+					for (; l < npiv; l++)
+						if (lignepivot[l].first > k) break;
+
+					// for all j such that (j>k) and A[k,j]!=0
+					while (l < npiv) {
+						j_piv = lignepivot[l].first;
+
+						// if A[k,j]=0, then A[i,j] <-- A[i,j]
+						while ((m < nj) && (lignecourante[m].first < j_piv))
+							construit[j++] = lignecourante[m++];
+
+						// if A[i,j]!=0, then A[i,j] <-- A[i,j] - A[i,k]*A[k,j]
+						if ((m < nj) && (lignecourante[m].first == j_piv)) {
+							Element tmp;
+							_F.axpy (tmp, headcoeff, lignepivot[l].second,
+								 lignecourante[m].second);
+
+							if (! _F.isZero (tmp)) {
+								_F.assign (lignecourante[m].second, tmp);
+								construit[j++] = lignecourante[m++];
+							}
+							else
+								++m;
+
+						}
+						else {
+							Element tmp;
+							_F.mul (tmp, headcoeff, lignepivot[l].second);
+							// if (! _F.isZero (tmp))
+							construit[j++] = E (j_piv, tmp);
+							// else
+							// std::cerr << "NEVER HAPPENED" << std::endl;
+						}
+						l++;
+					}
+
+					// if A[k,j]=0, then A[i,j] <-- A[i,j]
+					while (m < nj)
+						construit[j++] = lignecourante[m++];
+
+					construit.resize (j);
+					lignecourante = construit;
+				}
+				else {
+					// -------------------------------------------
+					// j_head < nj but nothing under the pivot
+					// Permutation
+					if (indpermut != static_cast<long>(k)) {
+						if (j_head > 0) {
+							unsigned long l = 0;
+
+							for (; l < nj; ++l)
+								if (lignecourante[l].first >= k) break;
+
+							if ((l < nj) && (lignecourante[l].first == k))  {
+								// non zero <--> zero
+								E tmp = lignecourante[l];
+								tmp.first = indpermut;
+
+								unsigned long bjh = j_head -1;
+								for (; l < bjh; l++)
+									lignecourante[l] = lignecourante[l + 1];
+
+								lignecourante[bjh] = tmp;
+							} // else // zero <--> zero
+						} // else // zero <--> zero
+					}
+				}
+			}
+			else {
+				// -------------------------------------------
+				// -------------------------------------------
+				// j_head >= nj > 0
+#if 0
+				std::cerr << "----------------------------------------------------------" << std::endl;
+				std::cerr << "j_head >= nj > 0" << std::endl;
+				std::cerr << "j_head: " << j_head << ", nj: " << nj << ", k:" << k
+				// << "lignepivot: " << lignepivot
+				//  << ", lignecour: " << lignecourante
+				<< std::endl;
+				std::cerr << "----------------------------------------------------------" << std::endl;
+#endif
+				if (indpermut != static_cast<long>(k)) {
+					unsigned long l = 0;
+
+					for (; l < nj; ++l)
+						if (lignecourante[l].first >= k) break;
+
+					if ((l < nj) && (lignecourante[l].first == k))  {
+						// non zero <--> zero
+						E tmp = lignecourante[l];
+						tmp.first = indpermut;
+
+						unsigned long bjh = nj - 1;
+						for (; l < bjh; l++)
+							lignecourante[l] = lignecourante[l + 1];
+
+						lignecourante[bjh] = tmp;
+					} // else
+					// zero <--> zero
+				}
+			}
+		}
+	}
+
+
+} // namespace LinBox
+
+#endif // __LINBOX_gauss_elim_INL
+
+#if 0
+template <class _Field>
+template <class Vector>
+void GaussDomain<_Field>::permute (Vector              &lignecourante,
+				   const unsigned long &indcol,
+				   const long &indpermut)
+{
+	const unsigned long k = indcol - 1;
+#if 0
+	std::cerr << "B PERMUTE: " << indpermut << " <--> " << k << " of  [";
+	for(typename Vector::const_iterator refs =  lignecourante.begin();
+	    refs != lignecourante.end() ;
+	    ++refs )
+		std::cerr << '(' << refs->first << ';' << refs->second << ')';
+	std::cerr << "]" << std::endl;
+#endif
+
+	// precondition indpermut != k
+	unsigned long nj = lignecourante.size () ;
+	if (nj > 0) {
+		Element tmp; _F.init(tmp);
+		unsigned long kin = 0;
+		for (; kin < nj; ++kin)
+			if (static_cast<long>(lignecourante[kin].first) >= k) break;
+		if (kin < nj) {
+			unsigned long pin = kin;
+			for (; pin < nj; ++pin)
+				if (static_cast<long>(lignecourante[pin].first) >= indpermut) break;
+			if ( static_cast<long>(lignecourante[kin].first) == k) {
+				if (pin < nj) {
+					if ( static_cast<long>(lignecourante[pin].first) == indpermut) {
+						// Both there
+						std::swap( lignecourante[kin].second, lignecourante[pin].second);
+					}
+					else {
+						// Only k there
+						lignecourante[kin].first = indpermut;
+						typename Vector::value_type etmp = lignecourante[kin];
+						--pin;
+						for(size_t i=kin; i<pin; ++i)
+							lignecourante[i] = lignecourante[i+1];
+						lignecourante[pin] = etmp;
+					}
+				}
+				else {
+					pin = nj-1;
+					// Only k there
+					lignecourante[kin].first = indpermut;
+					typename Vector::value_type etmp = lignecourante[kin];
+					for(size_t i=kin; i<pin; ++i)
+						lignecourante[i] = lignecourante[i+1];
+					lignecourante[pin] = etmp;
+
+				}
+			}
+			else {
+				if (pin < nj) {
+					if ( static_cast<long>(lignecourante[pin].first) == indpermut) {
+						// Only indpermut there
+						lignecourante[pin].first = k;
+						typename Vector::value_type etmp = lignecourante[pin];
+						for(size_t i = pin; i>kin; --i)
+							lignecourante[i] = lignecourante[i-1];
+						lignecourante[kin] = etmp;
+					} // else Nobody
+				} // else Nobody
+			}
+		} // else rien de supérieur à k dans l
+		// donc rien à permuter
+	}
+#if 0
+	std::cerr << "E PERMUTE: " << indpermut << " <--> " << k << " of  [";
+	for(typename Vector::const_iterator refs =  lignecourante.begin();
+	    refs != lignecourante.end() ;
+	    ++refs )
+		std::cerr << '(' << refs->first << ';' << refs->second << ')';
+	std::cerr << "]" << std::endl;
+#endif
+}
+#endif
+
+
diff --git a/linbox/algorithms/gauss-gf2.h b/linbox/algorithms/gauss-gf2.h
new file mode 100644
index 0000000..903099f
--- /dev/null
+++ b/linbox/algorithms/gauss-gf2.h
@@ -0,0 +1,230 @@
+/* -*- 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
+/* linbox/algorithms/gauss-gf2.h
+ * Copyright (C) 2009 The LinBox group
+ * Written by JG Dumas
+ *
+ * Time-stamp: <14 Jun 10 15:36:56 Jean-Guillaume.Dumas at imag.fr>
+ *
+ * See COPYING for license information.
+ *
+ * SparseSeqMatrix is container< container< size_t > >
+ * as e.g. linbox/blackbox/zo-gf2.h
+ */
+// ========================================================================= //
+
+#ifndef __LINBOX_gauss_gf2_H
+#define __LINBOX_gauss_gf2_H
+
+#include "linbox/util/debug.h"
+#include "linbox/util/commentator.h"
+#include "linbox/field/gf2.h"
+#include "linbox/vector/vector-domain.h"
+#include "linbox/algorithms/gauss.h"
+#include "linbox/blackbox/zo-gf2.h"
+
+/** @file algorithms/gauss-gf2.h
+ * @brief  Gauss elimination and applications for sparse matrices on \f$F_2\f$.
+ * Rank, nullspace, solve...
+ */
+
+
+namespace LinBox
+{
+
+	template <>
+	class GaussDomain<GF2> {
+	public:
+		typedef GF2 Field;
+		typedef Field::Element Element;
+
+		// Preferred Matrix type
+		typedef ZeroOne<GF2> Matrix;
+
+	public:
+
+		/** \brief The field parameter is the domain  over which to perform computations.
+		 */
+		GaussDomain (const Field &) {}
+
+		//Copy constructor
+		///
+		GaussDomain (const GaussDomain &)  {}
+
+		/** accessor for the field of computation.
+		*/
+		const Field &field () const { return *(new GF2()); }
+
+		/** @name rank
+		  Callers of the different rank routines
+		  @li  The "in" suffix indicates in place computation
+		  @li  Without Ni, Nj, the SparseSeqMatrix parameter must be a vector of sparse
+		  row vectors, NOT storing any zero.
+		  @li  Calls @link rankinLinearPivoting at endlink (by default) or @link rankinNoReordering at endlink
+		  */
+		//@{
+		///
+		///
+		template <class SparseSeqMatrix> unsigned long& rankin(unsigned long &rank,
+		SparseSeqMatrix        &A,
+		unsigned long  Ni,
+		unsigned long  Nj,
+		SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR) const ;
+
+		///
+		template <class SparseSeqMatrix> unsigned long& rankin(unsigned long &rank,
+		SparseSeqMatrix        &A,
+		SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR) const;
+
+		///
+		template <class SparseSeqMatrix> unsigned long& rank(unsigned long &rk,
+		const SparseSeqMatrix        &A,
+		unsigned long  Ni,
+		unsigned long  Nj,
+		SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR) const ;
+
+		///
+		template <class SparseSeqMatrix> unsigned long& rank(unsigned long &rk,
+		const SparseSeqMatrix        &A,
+		SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR) const ;
+
+		//@}
+
+		/** @name det
+		  Callers of the different determinant routines\\
+		  -/ The "in" suffix indicates in place computation\\
+		  -/ Without Ni, Nj, the SparseSeqMatrix parameter must be a vector of sparse
+		  row vectors, NOT storing any zero.\\
+		  -/ Calls @link LinearPivoting at endlink (by default) or @link NoReordering at endlink
+		  */
+		//@{
+		///
+		template <class SparseSeqMatrix> Element& detin(Element &determinant,
+		SparseSeqMatrix        &A,
+		SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR) const;
+		///
+		template <class SparseSeqMatrix> Element& detin(Element &determinant,
+		SparseSeqMatrix        &A,
+		unsigned long  Ni,
+		unsigned long  Nj,
+		SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR) const;
+		///
+		template <class SparseSeqMatrix> Element& det(Element &determinant,
+		const SparseSeqMatrix        &A,
+		SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR) const;
+		///
+		template <class SparseSeqMatrix> Element& det(Element &determinant,
+		const SparseSeqMatrix        &A,
+		unsigned long  Ni,
+		unsigned long  Nj,
+		SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR) const;
+		//@}
+
+
+		/** \brief Sparse in place Gaussian elimination with reordering to reduce fill-in.
+		 * pivots are chosen in sparsest column of sparsest row.
+		 * This runs in linear overhead.
+		 * It is similar in spirit but different from Markovitz' approach.
+		 *
+		 * \pre Using : SparseFindPivot(..., density) for sparsest column, and
+		 * eliminate (..., density)
+		 *
+		 * The SparseSeqMatrix parameter must meet the LinBox sparse matrix interface.
+		 * [check details].
+		 * The computedet indicates whether the algorithm must compute the determionant as it goes
+		 *
+		 * @bib
+		 * - Jean-Guillaume Dumas and Gilles Villard,
+		 * <i>Computing the rank of sparse matrices over finite fields.</i>
+		 * In Ganzha et~al. CASC'2002, pages 47--62.
+		 */
+		template <class SparseSeqMatrix, class Perm>
+		unsigned long& QLUPin(unsigned long &rank,
+				      Element& determinant,
+				      Perm          &Q,
+				      SparseSeqMatrix	    &L,
+				      SparseSeqMatrix        &U,
+				      Perm	    &P,
+				      unsigned long Ni,
+				      unsigned long Nj) const;
+
+		template <class SparseSeqMatrix, class Perm, class Vector1, class Vector2>
+		Vector1& solve(Vector1& x, unsigned long rank, const Perm& Q, const SparseSeqMatrix& L, const SparseSeqMatrix& U, const Perm& P, const Vector2& b, bool randomsol=false) const;
+
+
+		template <class SparseSeqMatrix, class Perm, class Vector1, class Vector2>
+		Vector1& solve(Vector1& x, Vector1& w, unsigned long rank, const Perm& Q, const SparseSeqMatrix& L, const SparseSeqMatrix& U, const Perm& P, const Vector2& b) const;
+
+
+		template <class SparseSeqMatrix, class Vector1, class Vector2>
+		Vector1& solvein(Vector1& x,
+				 SparseSeqMatrix        &A,
+				 const Vector2& b, bool randomsol=false) const;
+
+
+		template <class SparseSeqMatrix, class Perm>
+		unsigned long& InPlaceLinearPivoting(unsigned long &rank,
+						     Element& determinant,
+						     SparseSeqMatrix        &A,
+						     Perm                   &P,
+						     unsigned long Ni,
+						     unsigned long Nj) const;
+		template <class SparseSeqMatrix>
+		unsigned long& NoReordering (unsigned long & rank, Element& , SparseSeqMatrix &, unsigned long , unsigned long ) const
+		{
+			std::cerr << "Sparse elimination over GF2 without reordering not implemented" << std::endl;
+			return rank;
+		}
+
+
+	protected:
+
+		//-----------------------------------------
+		// Sparse elimination using a pivot row :
+		// lc <-- lc - lc[k]/lp[0] * lp
+		// D is the number of elements per column
+		//   it is updated and used for reordering
+		// Vector is a vector of Pair (lin_pair.h)
+		//-----------------------------------------
+		template <class Vector, class D>
+		void eliminateBinary (Element             & headpivot,
+				      Vector              &lignecourante,
+				      const Vector        &lignepivot,
+				      const unsigned long indcol,
+				      const long indpermut,
+				      const unsigned long npiv,
+				      D                   &columns) const;
+
+		template <class Vector>
+		void permuteBinary (Vector              &lignecourante,
+				    const unsigned long &indcol,
+				    const long &indpermut) const;
+
+		//------------------------------------------
+		// Looking for a non-zero pivot in a row
+		// Using the column density for reordering
+		// Pivot is chosen as to :
+		// 1. Row density is minimum
+		// 2. Column density is minimum for this row
+		//------------------------------------------
+		template <class Vector, class D>
+		void SparseFindPivotBinary (Vector &lignepivot, unsigned long &indcol, long &indpermut, D &columns, Element& determinant) const;
+
+		//------------------------------------------
+		// Looking for a non-zero pivot in a row
+		// No reordering
+		//------------------------------------------
+		template <class Vector>
+		void SparseFindPivotBinary (Vector &lignepivot, unsigned long &indcol, long &indpermut, Element& determinant) const;
+
+	};
+} // namespace LinBox
+
+#include "linbox/algorithms/gauss-gf2.inl"
+#include "linbox/algorithms/gauss-pivot-gf2.inl"
+#include "linbox/algorithms/gauss-elim-gf2.inl"
+#include "linbox/algorithms/gauss-rank-gf2.inl"
+#include "linbox/algorithms/gauss-solve-gf2.inl"
+
+#endif // __LINBOX_gauss_gf2_H
+
diff --git a/linbox/algorithms/gauss-gf2.inl b/linbox/algorithms/gauss-gf2.inl
new file mode 100644
index 0000000..6090ffa
--- /dev/null
+++ b/linbox/algorithms/gauss-gf2.inl
@@ -0,0 +1,387 @@
+/* -*- 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
+/* linbox/algorithms/gauss-gf2.inl
+ * Copyright (C) 2009 The LinBox group
+ *
+ * Time-stamp: <15 Jun 10 16:20:16 Jean-Guillaume.Dumas at imag.fr>
+ *
+ * See COPYING for license information.
+ */
+#ifndef __LINBOX_gauss_gf2_INL
+#define __LINBOX_gauss_gf2_INL
+// SparseSeqMatrix is container< container< size_t > >
+
+#include "linbox/algorithms/gauss.h"
+#include "linbox/util/commentator.h"
+#include <utility>
+
+#ifdef __LINBOX_ALL__ //BB: ???
+#ifndef __LINBOX_COUNT__
+#define __LINBOX_COUNT__
+#endif
+#ifndef __LINBOX_OFTEN__
+#define __LINBOX_OFTEN__  __LINBOX_ALL__
+#endif
+#ifndef __LINBOX_FILLIN__
+#define __LINBOX_FILLIN__
+#endif
+#endif
+
+namespace LinBox
+{
+	// Specialization over GF2
+	template <class SparseSeqMatrix, class Perm>
+	inline unsigned long&
+	GaussDomain<GF2>::InPlaceLinearPivoting (unsigned long &rank,
+						 bool          &determinant,
+						 SparseSeqMatrix        &LigneA,
+						 Perm           &P,
+						 unsigned long Ni,
+						 unsigned long Nj) const
+	{
+		// Requirements : LigneA is an array of sparse rows
+		// In place (LigneA is modified)
+		// With reordering (D is a density type. Density is allocated here)
+		//    long Ni = LigneA.n_row (), Nj = LigneA.n_col ();
+		commentator.start ("Gaussian elimination with reordering over GF2",
+				   "IPLRGF2", Ni);
+		commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+		<< "Gaussian QLUP elimination on " << Ni << " x " << Nj << " matrix" << std::endl;
+
+#ifdef __LINBOX_COUNT__
+		long long nbelem = 0;
+#endif
+
+		determinant = true;
+		// allocation of the column density
+		std::vector<size_t> col_density (Nj);
+
+
+		// assignment of LigneA with the domain object
+		for (unsigned long jj = 0; jj < Ni; ++jj)
+			for (unsigned long k = 0; k < LigneA[jj].size (); k++)
+				++col_density[LigneA[jj][k]];
+
+		long last = Ni - 1;
+		long c;
+		rank = 0;
+
+#ifdef __LINBOX_OFTEN__
+		long sstep = last/40;
+		if (sstep > __LINBOX_OFTEN__) sstep = __LINBOX_OFTEN__;
+#else
+		long sstep = 1000;
+#endif
+		// Elimination steps with reordering
+
+		typename SparseSeqMatrix::iterator LigneA_k = LigneA.begin();
+		for (long k = 0; k < last; ++k, ++LigneA_k) {
+			long p = k, s = 0;
+
+#ifdef __LINBOX_FILLIN__
+			if ( ! (k % 100) )
+#else
+				if ( ! (k % sstep) )
+#endif
+				{
+					commentator.progress (k);
+#ifdef __LINBOX_FILLIN__
+					long sl(0);
+					for (size_t l = 0; l < Ni; ++l)
+						sl += LigneA[l].size ();
+
+					commentator.report (Commentator::LEVEL_IMPORTANT, PARTIAL_RESULT)
+					<< "Fillin (" << rank << "/" << Ni << ") = "
+					<< sl
+					<< " (" << double(sl)*100.0/double(Ni-k)/double(Nj-k) << "%, "
+					<< double(sl)/double(Ni-k) << " avg)"
+					<< std::endl;
+#endif
+				}
+
+			long l;
+			for(l = k; l < static_cast<long>(Ni); ++l) {
+				if ( (s = LigneA[l].size()) != 0 ) {
+					p = l;
+					break;
+				}
+			}
+
+			if (s) {
+				long sl;
+				// Row permutation for the sparsest row
+				for (; l < static_cast<long>(Ni); ++l)
+					if (((sl = LigneA[l].size ()) < s) && (sl)) {
+						s = sl;
+						p = l;
+					}
+
+				if (p != k) {
+					//                         std::cerr << "Permuting rows: " << k << " <--> " << p << std::endl;
+					std::swap( *LigneA_k, LigneA[p]);
+				}
+
+
+				SparseFindPivotBinary (*LigneA_k, rank, c, col_density, determinant);
+
+				if (c != -1) {
+					long ll;
+					if ( c != (static_cast<long>(rank)-1) ) {
+						P.permute(rank-1,c);
+						for (ll=0      ; ll < k ; ++ll)
+							permuteBinary( LigneA[ll], rank, c);
+					}
+					long npiv=LigneA_k->size();
+					for (ll = k+1; ll < static_cast<long>(Ni); ++ll) {
+						bool elim=false;
+						eliminateBinary (elim, LigneA[ll], *LigneA_k, rank, c, npiv, col_density);
+					}
+				}
+
+				// LigneA.write(std::cerr << "AFT " )<<std::endl;
+#ifdef __LINBOX_COUNT__
+				nbelem += LigneA_k->size ();
+#endif
+			}
+			// LigneA.write(rep << "U:= ", FORMAT_MAPLE) << std::endl;
+		}//for k
+
+		SparseFindPivotBinary ( LigneA[last], rank, c, determinant);
+		if (c != -1) {
+			if ( c != (static_cast<long>(rank)-1) ) {
+				P.permute(rank-1,c);
+				for (long ll=0      ; ll < last ; ++ll)
+					permuteBinary( LigneA[ll], rank, c);
+			}
+		}
+
+#ifdef __LINBOX_COUNT__
+		nbelem += LigneA[last].size ();
+		commentator.report (Commentator::LEVEL_NORMAL, PARTIAL_RESULT)
+		<< "Left elements : " << nbelem << std::endl;
+#endif
+
+#ifdef __LINBOX_FILLIN__
+		long sl(0);
+		for (size_t l=0; l < Ni; ++l)
+			sl += LigneA[l].size ();
+
+		commentator.report (Commentator::LEVEL_IMPORTANT, PARTIAL_RESULT)
+		<< "Fillin (" << rank << "/" << Ni << ") = " << sl
+		<< std::endl;
+#endif
+
+		if ((rank < Ni) || (rank < Nj) || (Ni == 0) || (Nj == 0))
+			determinant = false;
+
+		integer card;
+		commentator.report (Commentator::LEVEL_IMPORTANT, PARTIAL_RESULT)
+		<< "Determinant : " << determinant
+		<< " over GF (2)" << std::endl;
+
+		// LigneA.write(rep << "U:= ", FORMAT_MAPLE) << ':' << std::endl;
+
+		commentator.report (Commentator::LEVEL_IMPORTANT, PARTIAL_RESULT)
+		<< "Rank : " << rank
+		<< " over GF (2)" << std::endl;
+		commentator.stop ("done", 0, "IPLRGF2");
+
+
+
+		return rank;
+	}
+
+	// Specialization over GF2
+	template <class SparseSeqMatrix, class Perm> inline unsigned long&
+	GaussDomain<GF2>::QLUPin (unsigned long &rank,
+				  bool          &determinant,
+				  Perm          &Q,
+				  SparseSeqMatrix        &LigneL,
+				  SparseSeqMatrix        &LigneA,
+				  Perm          &P,
+				  unsigned long Ni,
+				  unsigned long Nj) const
+	{
+		linbox_check( Q.coldim() == Q.rowdim() );
+		linbox_check( P.coldim() == P.rowdim() );
+		linbox_check( Q.coldim() == LigneL.size() );
+
+		typedef typename SparseSeqMatrix::value_type Vector;
+		typedef typename Vector::value_type E;
+
+		// Requirements : LigneA is an array of sparse rows
+		// In place (LigneA is modified)
+		// With reordering (D is a density type. Density is allocated here)
+		//    long Ni = LigneA.n_row (), Nj = LigneA.n_col ();
+		commentator.start ("Gaussian elimination with reordering over GF2",
+				   "IPLRGF2", Ni);
+		commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+		<< "Gaussian QLUP elimination on " << Ni << " x " << Nj << " matrix" << std::endl;
+
+#ifdef __LINBOX_COUNT__
+		long long nbelem = 0;
+#endif
+
+		determinant = true;
+		// allocation of the column density
+		std::vector<size_t> col_density (Nj);
+
+
+		for(typename SparseSeqMatrix::iterator LigneL_it = LigneL.begin() ;
+		    LigneL_it != LigneL.end(); ++LigneL_it)
+			LigneL_it->reserve(16);
+
+		std::deque<std::pair<size_t,size_t> > invQ;
+
+		// assignment of LigneA with the domain object
+		for (unsigned long jj = 0; jj < Ni; ++jj)
+			for (unsigned long k = 0; k < LigneA[jj].size (); k++)
+				++col_density[LigneA[jj][k]];
+
+		long last = Ni - 1;
+		long c;
+		rank = 0;
+
+#ifdef __LINBOX_OFTEN__
+		long sstep = last/40;
+		if (sstep > __LINBOX_OFTEN__) sstep = __LINBOX_OFTEN__;
+#else
+		long sstep = 1000;
+#endif
+		// Elimination steps with reordering
+
+		typename SparseSeqMatrix::iterator LigneA_k = LigneA.begin();
+		for (long k = 0; k < last; ++k, ++LigneA_k) {
+			long p = k, s = 0;
+
+#ifdef __LINBOX_FILLIN__
+			if ( ! (k % 100) )
+#else
+				if ( ! (k % sstep) )
+#endif
+				{
+					commentator.progress (k);
+#ifdef __LINBOX_FILLIN__
+					long sl(0);
+					for (size_t l = 0; l < Ni; ++l)
+						sl += LigneA[l].size ();
+
+					commentator.report (Commentator::LEVEL_IMPORTANT, PARTIAL_RESULT)
+					<< "Fillin (" << rank << "/" << Ni << ") = "
+					<< sl
+					<< " (" << double(sl)*100.0/double(Ni-k)/double(Nj-k) << "%, "
+					<< double(sl)/double(Ni-k) << " avg)"
+					<< std::endl;
+#endif
+				}
+
+			long l;
+			for(l = k; l < static_cast<long>(Ni); ++l) {
+				if ( (s = LigneA[l].size()) ) {
+					p = l;
+					break;
+				}
+			}
+
+			if (s) {
+				long sl;
+				// Row permutation for the sparsest row
+				for (; l < static_cast<long>(Ni); ++l)
+					if (((sl = LigneA[l].size ()) < s) && (sl)) {
+						s = sl;
+						p = l;
+					}
+
+				if (p != k) {
+					//                         std::cerr << "Permuting rows: " << k << " <--> " << p << std::endl;
+					invQ.push_front( std::pair<size_t,size_t>(k,p) );
+					std::swap( *LigneA_k, LigneA[p]);
+					std::swap( LigneL[k], LigneL[p]);
+				}
+
+
+				SparseFindPivotBinary (*LigneA_k, rank, c, col_density, determinant);
+
+				if (c != -1) {
+					long ll;
+					if ( c != (static_cast<long>(rank)-1) ) {
+						P.permute(rank-1,c);
+						for (ll=0      ; ll < k ; ++ll)
+							permuteBinary( LigneA[ll], rank, c);
+					}
+					long npiv=LigneA_k->size();
+					for (ll = k+1; ll < static_cast<long>(Ni); ++ll) {
+						E hc; hc=rank-1; bool elim=false;
+						eliminateBinary (elim, LigneA[ll], *LigneA_k, rank, c, npiv, col_density);
+						if(elim) LigneL[ll].push_back(hc);
+					}
+				}
+
+				// LigneA.write(std::cerr << "AFT " )<<std::endl;
+#ifdef __LINBOX_COUNT__
+				nbelem += LigneA_k->size ();
+#endif
+			}
+			LigneL[k].push_back(k);
+			//  LigneL.write(rep << "L:= ", FORMAT_MAPLE) << std::endl;
+			//  LigneA.write(rep << "U:= ", FORMAT_MAPLE) << std::endl;
+		}//for k
+
+		SparseFindPivotBinary ( LigneA[last], rank, c, determinant);
+		if (c != -1) {
+			if ( c != (static_cast<long>(rank)-1) ) {
+				P.permute(rank-1,c);
+				for (long ll=0      ; ll < last ; ++ll)
+					permuteBinary( LigneA[ll], rank, c);
+			}
+		}
+
+		LigneL[last].push_back(last);
+
+#ifdef __LINBOX_COUNT__
+		nbelem += LigneA[last].size ();
+		commentator.report (Commentator::LEVEL_NORMAL, PARTIAL_RESULT)
+		<< "Left elements : " << nbelem << std::endl;
+#endif
+
+#ifdef __LINBOX_FILLIN__
+		long sl(0);
+		for (size_t l=0; l < Ni; ++l)
+			sl += LigneA[l].size ();
+
+		commentator.report (Commentator::LEVEL_IMPORTANT, PARTIAL_RESULT)
+		<< "Fillin (" << rank << "/" << Ni << ") = " << sl
+		<< std::endl;
+#endif
+
+		if ((rank < Ni) || (rank < Nj) || (Ni == 0) || (Nj == 0))
+			determinant = false;
+
+		integer card;
+		commentator.report (Commentator::LEVEL_IMPORTANT, PARTIAL_RESULT)
+		<< "Determinant : " << determinant
+		<< " over GF (2)" << std::endl;
+
+		for(std::deque<std::pair<size_t,size_t> >::const_iterator it = invQ.begin(); it!=invQ.end();++it)
+			Q.permute( it->first, it->second );
+
+#if 0
+		Q.write(rep << "Q:= ", FORMAT_MAPLE) << ':' << std::endl;
+		LigneL.write(rep << "L:= ", FORMAT_MAPLE) << ':' << std::endl;
+		LigneA.write(rep << "U:= ", FORMAT_MAPLE) << ':' << std::endl;
+		P.write(rep << "P:= ", FORMAT_MAPLE) << ':' << std::endl;
+#endif
+		commentator.report (Commentator::LEVEL_IMPORTANT, PARTIAL_RESULT)
+		<< "Rank : " << rank
+		<< " over GF (2)" << std::endl;
+		commentator.stop ("done", 0, "IPLRGF2");
+
+
+
+		return rank;
+	}
+
+
+} // namespace LinBox
+
+#endif // __LINBOX_gauss_gf2_INL
diff --git a/linbox/algorithms/gauss-nullspace.inl b/linbox/algorithms/gauss-nullspace.inl
new file mode 100644
index 0000000..5c70518
--- /dev/null
+++ b/linbox/algorithms/gauss-nullspace.inl
@@ -0,0 +1,129 @@
+/* -*- 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
+/* linbox/algorithms/gauss-solve.inl
+ * Copyright (C) LinBox 2008
+ *
+ * Written by Jean-Guillaume Dumas <Jean-Guillaume.Dumas at imag.fr>
+ * Time-stamp: <21 Jun 10 14:43:11 Jean-Guillaume.Dumas at imag.fr>
+ *
+ * See COPYING for license information.
+ */
+
+#ifndef __LINBOX_gauss_nullspace_INL
+#define __LINBOX_gauss_nullspace_INL
+
+#include "linbox/blackbox/sparse.h"
+#include "linbox/algorithms/gauss.h"
+#include "linbox/algorithms/triangular-solve.h"
+#include "linbox/blackbox/permutation.h"
+#include "linbox/vector/sparse.h"
+
+namespace LinBox
+{
+
+
+
+	// U is supposed full rank upper triangular
+	template <class _Field>
+	template <class Matrix, class Perm, class Block> inline Block&
+	GaussDomain<_Field>::nullspacebasis(Block& x, unsigned long rank, const Matrix& U, const Perm& P)  const
+	{
+		if (rank == 0) {
+			for(size_t i=0; i<U.coldim(); ++i)
+				x.setEntry(i,i,_F.one);
+		}
+		else {
+			unsigned long nullity = U.coldim()-rank;
+			if (nullity != 0) {
+				// compute U2T s.t. U = [ U1 | -U2T^T ]
+				Matrix U2T(_F,nullity,rank);
+
+				for(typename Matrix::ConstRawIndexedIterator uit=U.rawIndexedBegin();
+				    uit != U.rawIndexedEnd(); ++uit) {
+					if (uit.colIndex() >= rank)
+						U2T.setEntry(uit.colIndex()-rank,uit.rowIndex(),uit.value());
+				}
+				for(typename Matrix::RawIterator u2it=U2T.rawBegin();
+				    u2it != U2T.rawEnd(); ++u2it)
+					_F.negin(*u2it);
+
+
+				// Compute the basis vector by vector
+				typedef Sparse_Vector< typename _Field::Element > SparseVect;
+				for(size_t i=0; i<nullity; ++i) {
+					SparseVect W1Ti;
+					// Solve for upper part of basis
+					upperTriangularSparseSolve(W1Ti, rank, U, U2T[i]);
+					// Add identity for lower part
+					W1Ti.push_back( typename SparseVect::Element(rank+i, _F.one ) );
+
+					for(size_t j=0; j<W1Ti.size(); ++j) {
+						// P.applyTranspose(x[i],W1T[i]);
+						// Transposein(x)
+						x.setEntry( P.getStorage()[ W1Ti[j].first ], i, W1Ti[j].second );
+					}
+				}
+			}
+		}
+		// x.write( std::cerr << "X:=", FORMAT_MAPLE ) << ';' << std::endl;
+		return x;
+	}
+
+	template <class Matrix>
+	inline bool nextnonzero(size_t& k, size_t Ni, const Matrix& A)
+	{
+		for(++k; k<Ni; ++k)
+			if (A[k].size() > 0) return true;
+		return false;
+	}
+
+	// Matrix A is upper triangularized
+	template <class _Field>
+	template <class Matrix, class Block> inline Block&
+	GaussDomain<_Field>::nullspacebasisin(Block& x, Matrix& A)  const
+	{
+		typename Field::Element det;
+		unsigned long rank;
+		size_t Ni(A.rowdim()),Nj(A.coldim());
+
+		Permutation<Field> P(Nj,_F);
+
+		// A.write( std::cerr << "A:=", FORMAT_MAPLE ) << ';' << std::endl;
+		this->InPlaceLinearPivoting(rank, det, A, P, Ni, Nj );
+
+		// P.write( std::cerr << "P:=", FORMAT_MAPLE ) << ';' << std::endl;
+		// A.write( std::cerr << "Ua:=", FORMAT_MAPLE ) << ';' << std::endl;
+
+		for(size_t i=0; i< Ni; ++i) {
+			if (A[i].size() == 0) {
+				size_t j(i);
+				if (nextnonzero(j,Ni,A)) {
+					A[i] = A[j];
+					A[j].resize(0);
+				}
+				else {
+					break;
+				}
+			}
+		}
+
+		// A.write( std::cerr << "Ub:=", FORMAT_MAPLE ) << ';' << std::endl;
+
+		return this->nullspacebasis(x, rank, A, P);
+	}
+
+	template <class _Field>
+	template <class Matrix, class Block> inline Block&
+	GaussDomain<_Field>::nullspacebasis(Block& x, const Matrix& A)  const
+	{
+		SparseMatrix<Field, typename LinBox::Vector<Field>::SparseSeq> A1 (A);
+		return this->nullspacebasisin(x, A1);
+	}
+
+
+
+
+} // namespace LinBox
+
+#endif // __LINBOX_gauss_nullspace_INL
+
diff --git a/linbox/algorithms/gauss-pivot-gf2.inl b/linbox/algorithms/gauss-pivot-gf2.inl
new file mode 100644
index 0000000..22f392c
--- /dev/null
+++ b/linbox/algorithms/gauss-pivot-gf2.inl
@@ -0,0 +1,107 @@
+/* -*- 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
+/* linbox/algorithms/gauss-pivot-gf2.inl
+ * Copyright (C) 2009 The LinBox group
+ *
+ * Time-stamp: <21 Jan 10 15:08:59 Jean-Guillaume.Dumas at imag.fr>
+ *
+ * See COPYING for license information.
+ *
+ * SparseElimination search for pivots over GF2
+ */
+#ifndef __LINBOX_gauss_pivot_gf2_INL
+#define __LINBOX_gauss_pivot_gf2_INL
+
+namespace LinBox
+{
+	template <class Vector, class D> inline void
+	GaussDomain<GF2>::SparseFindPivotBinary (Vector        	&lignepivot,
+						 unsigned long 	&indcol,
+						 long 		&indpermut,
+						 D             	&columns,
+						 bool		&) const //determinant
+	{
+
+#if 0
+		std::cerr << "SFP BEG : lignepivot: [";
+		for(typename Vector::const_iterator refs =  lignepivot.begin();
+		    refs != lignepivot.end() ;
+		    ++refs )
+			std::cerr << '(' << refs->first << ';' << refs->second << ')';
+		std::cerr << "]" << std::endl;
+#endif
+		typedef typename Vector::value_type E;
+
+		long nj =  lignepivot.size ();
+
+		if (nj > 0) {
+			indpermut = lignepivot.front();
+
+			long ds = --columns[indpermut], dl, p = 0;
+
+			for (long j = 1; j < nj; ++j) {
+				if ((dl = --columns[lignepivot[j]]) < ds) {
+					ds = dl;
+					p = j;
+				}
+			}
+
+			if (p != 0) {
+				if (indpermut == static_cast<long>(indcol)) {
+					indpermut = lignepivot[p];
+				}
+				else {
+					E ttm = lignepivot[p];
+					indpermut = ttm;
+
+					for (long m = p; m; --m)
+						lignepivot[m] = lignepivot[m-1];
+
+					lignepivot[0] = ttm;
+				}
+			}
+
+			if (indpermut != static_cast<long>(indcol)) {
+				// std::cerr << "Permuting col: " << indpermut << " <--> " << indcol << std::endl;
+				// no need to decrement/increment, already done during the search
+				lignepivot[0] = indcol;
+			}
+
+			++indcol;
+		}
+		else
+			indpermut = -1;
+#if 0
+		std::cerr << "SFP END : lignepivot: [";
+		for(typename Vector::const_iterator refs =  lignepivot.begin();
+		    refs != lignepivot.end() ;
+		    ++refs )
+			std::cerr << '(' << refs->first << ';' << refs->second << ')';
+		std::cerr << "]" << std::endl;
+#endif
+	}
+
+	template <class Vector> inline void
+	GaussDomain<GF2>::SparseFindPivotBinary (Vector &lignepivot,
+						 unsigned long &indcol,
+						 long &indpermut,
+						 bool& ) const // determinant
+	{
+		long nj = lignepivot.size ();
+
+		if (nj > 0) {
+			indpermut = lignepivot.front();
+			if (indpermut != static_cast<long>(indcol)){
+				lignepivot.front() = indcol;
+			}
+			++indcol;
+		}
+		else
+			indpermut = -1;
+	}
+
+
+} // namespace LinBox
+
+#endif // __LINBOX_gauss_pivot_gf2_INL
+
diff --git a/linbox/algorithms/gauss-pivot.inl b/linbox/algorithms/gauss-pivot.inl
new file mode 100644
index 0000000..ec24d95
--- /dev/null
+++ b/linbox/algorithms/gauss-pivot.inl
@@ -0,0 +1,144 @@
+/* -*- 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
+/* linbox/algorithms/gauss-pivot.inl
+ * Copyright (C) 2009,2010 The LinBox group
+ * Written by JG Dumas <Jean-Guillaume.Dumas at imag.fr>
+ *
+ * See COPYING for license information.
+ *
+ * SparseElimination search for pivots
+ */
+
+#ifndef __LINBOX_gauss_pivot_INL
+#define __LINBOX_gauss_pivot_INL
+
+namespace LinBox
+{
+
+	template <class _Field>
+	template <class Vector, class D> inline void
+	GaussDomain<_Field>::SparseFindPivot (Vector        	&lignepivot,
+					      unsigned long 	&indcol,
+					      long 		&indpermut,
+					      D             	&columns,
+					      Element		&determinant) const
+	{
+
+		//        std::cerr << "SFP BEG : lignepivot: [";
+		//         for(typename Vector::const_iterator refs =  lignepivot.begin();
+		//             refs != lignepivot.end() ;
+		//             ++refs )
+		//             std::cerr << '(' << refs->first << ';' << refs->second << ')';
+		//         std::cerr << "]" << std::endl;
+		typedef typename Vector::value_type E;
+
+		long nj =  lignepivot.size ();
+
+		bool pivoting = false;
+
+		if (nj > 0) {
+			indpermut = lignepivot[0].first;
+
+			long ds = --columns[indpermut], dl, p = 0;
+
+			for (long j = 1; j < nj; ++j) {
+				if ((dl = --columns[lignepivot[j].first]) < ds) {
+					ds = dl;
+					p = j;
+				}
+			}
+
+			if (p != 0) {
+				pivoting = true;
+				if (indpermut == static_cast<long>(indcol)) {
+					indpermut = lignepivot[p].first;
+					std::swap( lignepivot[p].second, lignepivot[0].second);
+				}
+				else {
+					E ttm = lignepivot[p];
+					indpermut = ttm.first;
+
+					for (long m = p; m; --m)
+						lignepivot[m] = lignepivot[m-1];
+
+					lignepivot[0] = ttm;
+				}
+			}
+
+			_F.mulin(determinant, lignepivot[0].second);
+			if (indpermut != static_cast<long>(indcol)) {
+				// std::cerr << "Permuting col: " << indpermut << " <--> " << indcol << std::endl;
+				// no need to decrement/increment, already done during the search
+				lignepivot[0].first = indcol;
+				pivoting = true;
+			}
+
+			if (pivoting) _F.negin(determinant);
+			++indcol;
+		}
+		else
+			indpermut = -1;
+
+		//        std::cerr << "SFP END : lignepivot: [";
+		//         for(typename Vector::const_iterator refs =  lignepivot.begin();
+		//             refs != lignepivot.end() ;
+		//             ++refs )
+		//             std::cerr << '(' << refs->first << ';' << refs->second << ')';
+		//         std::cerr << "]" << std::endl;
+	}
+
+
+	template <class _Field>
+	template <class Vector> inline void
+	GaussDomain<_Field>::SparseFindPivot (Vector &lignepivot,
+					      unsigned long &indcol,
+					      long &indpermut,
+					      Element& determinant) const
+	{
+		long nj = lignepivot.size ();
+
+		if (nj > 0) {
+			indpermut = lignepivot[0].first;
+			_F.mulin(determinant, lignepivot[0].second);
+			if (indpermut != static_cast<long>(indcol)){
+				// std::cerr << "Permuting col: " << lignepivot[0].first << " <--> " << indcol << std::endl;
+				lignepivot[0].first = indcol;
+				_F.negin(determinant);
+			}
+			++indcol;
+		}
+		else
+			indpermut = -1;
+	}
+
+	template <class _Field>
+	template <class Vector> inline void
+	GaussDomain<_Field>::FindPivot (Vector &lignepivot,
+					unsigned long &k,
+					long &indpermut) const
+	{
+		// Dense lignepivot
+		long n = lignepivot.size ();
+		long j = k;
+
+		for (; j < n ; ++j )
+			if (!_F.isZero (lignepivot[j])) break ;
+
+		if (j == n )
+			indpermut = -1 ;
+		else {
+			indpermut = j ;
+			if (indpermut != k) {
+				typename Vector::value_type tmp = lignepivot[k] ;
+				lignepivot[k] = lignepivot[j] ;
+				lignepivot[j] = tmp ;
+			}
+
+			++k;
+		}
+	}
+
+} // namespace LinBox
+
+#endif // __LINBOX_gauss_pivot_INL
+
diff --git a/linbox/algorithms/gauss-rank-gf2.inl b/linbox/algorithms/gauss-rank-gf2.inl
new file mode 100644
index 0000000..c257934
--- /dev/null
+++ b/linbox/algorithms/gauss-rank-gf2.inl
@@ -0,0 +1,70 @@
+/* -*- 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
+/* linbox/algorithms/gauss-rank-gf2.inl
+ * Copyright (C) 2009 The LinBox group
+ *
+ * Time-stamp: <14 Jun 10 15:26:01 Jean-Guillaume.Dumas at imag.fr>
+ *
+ * See COPYING for license information.
+ *
+ * SparseElimination rank calls over GF2
+ */
+
+// =================================================================== //
+// =================================================================== //
+#ifndef __LINBOX_gauss_rank_gf2_INL
+#define __LINBOX_gauss_rank_gf2_INL
+
+namespace LinBox
+{
+	template <class SparseSeqMatrix> unsigned long&
+	GaussDomain<GF2>::rankin(unsigned long &rank,
+				 SparseSeqMatrix        &A,
+				 unsigned long  Ni,
+				 unsigned long  Nj,
+				 SparseEliminationTraits::PivotStrategy   reord)  const
+	{
+		Element determinant;
+		const GF2 F2;
+		Permutation<GF2> P(A.coldim(),F2);
+
+		if (reord == SparseEliminationTraits::PIVOT_NONE)
+			return NoReordering(rank, determinant, A,  Ni, Nj);
+		else
+			return InPlaceLinearPivoting(rank, determinant, A, P, Ni, Nj);
+	}
+
+
+	template <class SparseSeqMatrix> unsigned long&
+	GaussDomain<GF2>::rankin(unsigned long &rank,
+				 SparseSeqMatrix        &A,
+				 SparseEliminationTraits::PivotStrategy   reord)  const
+	{
+		return rankin(rank, A,  A.rowdim (), A.coldim (), reord);
+	}
+
+
+
+	template <class SparseSeqMatrix> unsigned long&
+	GaussDomain<GF2>::rank(unsigned long &rk,
+			       const SparseSeqMatrix        &A,
+			       SparseEliminationTraits::PivotStrategy   reord)  const
+	{
+		return rank(rk, A,  A.rowdim (), A.coldim (), reord);
+	}
+
+	template <class SparseSeqMatrix> unsigned long&
+	GaussDomain<GF2>::rank(unsigned long &rank,
+			       const SparseSeqMatrix        &A,
+			       unsigned long  Ni,
+			       unsigned long  Nj,
+			       SparseEliminationTraits::PivotStrategy   reord)  const
+	{
+		SparseSeqMatrix CopyA(Ni);
+		for(unsigned long i = 0; i < Ni; ++i)
+			CopyA[i] = A[i];
+		return rankin(rank, CopyA, Ni, Nj, reord);
+	}
+} // namespace LinBox
+
+#endif // __LINBOX_gauss_rank_gf2_INL
diff --git a/linbox/algorithms/gauss-rank.inl b/linbox/algorithms/gauss-rank.inl
new file mode 100644
index 0000000..9689397
--- /dev/null
+++ b/linbox/algorithms/gauss-rank.inl
@@ -0,0 +1,68 @@
+/* -*- 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
+/* linbox/algorithms/gauss-rank.inl
+ * Copyright (C) 2009 The LinBox group
+ *
+ * Time-stamp: <15 Jun 10 17:20:20 Jean-Guillaume.Dumas at imag.fr>
+ *
+ * See COPYING for license information.
+ *
+ * SparseElimination rank calls
+ */
+#ifndef __LINBOX_gauss_rank_INL
+#define __LINBOX_gauss_rank_INL
+
+namespace LinBox
+{
+	template <class _Field>
+	template <class Matrix> unsigned long&
+	GaussDomain<_Field>::rankin(unsigned long &rank,
+				    Matrix        &A,
+				    unsigned long  Ni,
+				    unsigned long  Nj,
+				    SparseEliminationTraits::PivotStrategy   reord)  const
+	{
+		Element determinant;
+		if (reord == SparseEliminationTraits::PIVOT_NONE)
+			return NoReordering(rank, determinant, A,  Ni, Nj);
+		else
+			return InPlaceLinearPivoting(rank, determinant, A, Ni, Nj);
+	}
+
+
+	template <class _Field>
+	template <class Matrix> unsigned long&
+	GaussDomain<_Field>::rankin(unsigned long &rank,
+				    Matrix        &A,
+				    SparseEliminationTraits::PivotStrategy   reord)  const
+	{
+		return rankin(rank, A,  A.rowdim (), A.coldim (), reord);
+	}
+
+
+
+	template <class _Field>
+	template <class Matrix> unsigned long&
+	GaussDomain<_Field>::rank(unsigned long &rk,
+				  const Matrix        &A,
+				  SparseEliminationTraits::PivotStrategy   reord)  const
+	{
+		return rank(rk, A,  A.rowdim (), A.coldim (), reord);
+	}
+
+	template <class _Field>
+	template <class Matrix> unsigned long&
+	GaussDomain<_Field>::rank(unsigned long &rank,
+				  const Matrix        &A,
+				  unsigned long  Ni,
+				  unsigned long  Nj,
+				  SparseEliminationTraits::PivotStrategy   reord)  const
+	{
+		Matrix CopyA(Ni);
+		for(unsigned long i = 0; i < Ni; ++i)
+			CopyA[i] = A[i];
+		return rankin(rank, CopyA, Ni, Nj, reord);
+	}
+} // namespace LinBox
+
+#endif // __LINBOX_gauss_rank_INL
diff --git a/linbox/algorithms/gauss-solve-gf2.inl b/linbox/algorithms/gauss-solve-gf2.inl
new file mode 100644
index 0000000..e102adc
--- /dev/null
+++ b/linbox/algorithms/gauss-solve-gf2.inl
@@ -0,0 +1,85 @@
+/* -*- 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
+/* linbox/algorithms/gauss-solve-gf2.inl
+ * Copyright (C) LinBox 2009
+ *
+ * Written by Jean-Guillaume Dumas <Jean-Guillaume.Dumas at imag.fr>
+ * Time-stamp: <21 Jan 10 15:55:07 Jean-Guillaume.Dumas at imag.fr>
+ *
+ * See COPYING for license information.
+ */
+
+#ifndef __LINBOX_gauss_solve_gf2_INL
+#define __LINBOX_gauss_solve_gf2_INL
+
+#include "linbox/algorithms/gauss-gf2.h"
+#include "linbox/algorithms/triangular-solve-gf2.h"
+#include "linbox/blackbox/permutation.h"
+
+namespace LinBox
+{
+
+
+	template <class SparseSeqMatrix, class Perm, class Vector1, class Vector2>
+	Vector1& GaussDomain<GF2>::solve(Vector1& x, Vector1& w, unsigned long rank,
+					 const Perm& Q, const SparseSeqMatrix& L,
+					 const SparseSeqMatrix& U, const Perm& P,
+					 const Vector2& b) const
+	{
+
+		Vector2 y(U.rowdim()), v(U.rowdim());
+
+		Q.applyTranspose(y, b);
+
+		lowerTriangularUnitarySolveBinary(v, L, y);
+
+		upperTriangularSolveBinary(w, U, v);
+
+		return P.applyTranspose(x, w);
+	}
+
+	template <class SparseSeqMatrix, class Perm, class Vector1, class Vector2>
+	Vector1& GaussDomain<GF2>::solve(Vector1& x, unsigned long rank,
+					 const Perm& Q, const SparseSeqMatrix& L,
+					 const SparseSeqMatrix& U, const Perm& P,
+					 const Vector2& b, bool randomsol) const
+	{
+
+		Vector1 w(U.coldim());
+		const GF2 F2;
+		if (randomsol) {
+			typename GF2::RandIter generator(F2);
+			for(typename Vector1::iterator it=w.begin()+rank;it!=w.end();++it)
+				generator.random( *it );
+		}
+		else {
+			for(typename Vector1::iterator it=w.begin()+rank;it!=w.end();++it)
+				F2.init(*it,0);
+		}
+
+		return this->solve(x, w, rank, Q, L, U, P, b);
+	}
+
+	template <class SparseSeqMatrix, class Vector1, class Vector2>
+	Vector1& GaussDomain<GF2>::solvein(Vector1& x,
+					   SparseSeqMatrix        &A,
+					   const Vector2& b, bool randomsol) const
+	{
+
+		typename GF2::Element det;
+		unsigned long rank;
+		const GF2 F2;
+		SparseSeqMatrix L(F2, A.rowdim(), A.rowdim());
+		Permutation<GF2> Q(A.rowdim(),F2);
+		Permutation<GF2> P(A.coldim(),F2);
+
+
+
+		this->QLUPin(rank, det, Q, L, A, P, A.rowdim(), A.coldim() );
+
+		return this->solve(x, rank, Q, L, A, P, b, randomsol);
+	}
+
+} // namespace LinBox
+
+#endif // __LINBOX_gauss_solve_gf2_INL
diff --git a/linbox/algorithms/gauss-solve.inl b/linbox/algorithms/gauss-solve.inl
new file mode 100644
index 0000000..617058f
--- /dev/null
+++ b/linbox/algorithms/gauss-solve.inl
@@ -0,0 +1,96 @@
+/* -*- 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
+/* linbox/algorithms/gauss-solve.inl
+ * Copyright (C) LinBox 2008
+ *
+ * Written by Jean-Guillaume Dumas <Jean-Guillaume.Dumas at imag.fr>
+ * Time-stamp: <21 Jan 10 17:01:22 Jean-Guillaume.Dumas at imag.fr>
+ *
+ * See COPYING for license information.
+ */
+
+#ifndef __LINBOX_gauss_solve_INL
+#define __LINBOX_gauss_solve_INL
+
+#include "linbox/algorithms/gauss.h"
+#include "linbox/algorithms/triangular-solve.h"
+#include "linbox/blackbox/permutation.h"
+
+namespace LinBox
+{
+
+
+	template <class _Field>
+	template <class Matrix, class Perm, class Vector1, class Vector2> inline Vector1&
+	GaussDomain<_Field>::solve(Vector1& x, Vector1& w, unsigned long rank, const Perm& Q, const Matrix& L, const Matrix& U, const Perm& P, const Vector2& b)  const
+	{
+
+		Vector2 y(U.rowdim()), v(U.rowdim());
+
+		Q.applyTranspose(y, b);
+
+		lowerTriangularUnitarySolve(v, L, y);
+
+		upperTriangularSolve(w, U, v);
+
+		return P.applyTranspose(x, w);
+	}
+
+	template <class _Field>
+	template <class Matrix, class Perm, class Vector1, class Vector2> inline Vector1&
+	GaussDomain<_Field>::solve(Vector1& x, unsigned long rank, const Perm& Q, const Matrix& L, const Matrix& U, const Perm& P, const Vector2& b, bool randomsol)  const
+	{
+
+		Vector1 w(U.coldim());
+		if (randomsol) {
+			// Random solution is in output
+			typename _Field::RandIter generator(_F);
+			for(typename Vector1::iterator it=w.begin()+rank;it!=w.end();++it)
+				generator.random( *it );
+		}
+		else {
+			for(typename Vector1::iterator it=w.begin()+rank;it!=w.end();++it)
+				_F.init(*it,0);
+		}
+		return this->solve(x, w, rank, Q, L, U, P, b);
+	}
+
+	template <class _Field>
+	template <class Matrix, class Vector1, class Vector2> inline Vector1&
+	GaussDomain<_Field>::solvein(Vector1& x, Matrix& A, const Vector2& b, bool randomsol)  const
+	{
+
+		typename Field::Element det;
+		unsigned long rank;
+		Matrix L(_F, A.rowdim(), A.rowdim());
+		Permutation<Field> Q(A.rowdim(),_F);
+		Permutation<Field> P(A.coldim(),_F);
+
+		this->QLUPin(rank, det, Q, L, A, P, A.rowdim(), A.coldim() );
+
+		if (! randomsol) {
+			// Sets solution values to 0 for coldim()-rank columns
+			// Therefore, prune unnecessary elements
+			// in those last columns of U
+			for(typename Matrix::RowIterator row=A.rowBegin();
+			    row != A.rowEnd(); ++row) {
+				if (row->size()) {
+					size_t ns=0;
+					for(typename Matrix::Row::iterator it = row->begin();
+					    it != row->end(); ++it, ++ns) {
+						if (it->first >= rank) {
+							row->resize(ns);
+							break;
+						}
+					}
+				}
+			}
+		}
+
+		return this->solve(x, rank, Q, L, A, P, b, randomsol);
+	}
+
+} // namespace LinBox
+
+#endif // __LINBOX_gauss_solve_INL
+
diff --git a/linbox/algorithms/gauss.h b/linbox/algorithms/gauss.h
index 95fa9c0..bb7f907 100644
--- a/linbox/algorithms/gauss.h
+++ b/linbox/algorithms/gauss.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/algorithms/gauss.h
  * Copyright (C) 1999 Jean-Guillaume Dumas
  *
@@ -20,248 +20,326 @@
 // ========================================================================= //
 // (C) The Linbox Group 1999
 // Calcul de rang par la méthode de Gauss pivot par ligne, sur matrice creuse
-// Time-stamp: <03 Nov 00 19:19:06 Jean-Guillaume.Dumas at imag.fr> 
+// Time-stamp: <03 Nov 00 19:19:06 Jean-Guillaume.Dumas at imag.fr>
 // ========================================================================= //
 
-#ifndef __GAUSS_H
-#define __GAUSS_H
+#ifndef __LINBOX_gauss_H
+#define __LINBOX_gauss_H
 
 #include "linbox/util/debug.h"
 #include "linbox/util/commentator.h"
 #include "linbox/field/archetype.h"
+#include "linbox/field/gf2.h"
 #include "linbox/vector/vector-domain.h"
+#include "linbox/matrix/sparse.h"
 #include "linbox/matrix/matrix-domain.h"
 #include "linbox/matrix/archetype.h"
 #include "linbox/solutions/methods.h"
 
-namespace LinBox 
+/** @file algorithms/gauss.h
+ * @brief  Gauss elimination and applications for sparse matrices.
+ * Rank, nullspace, solve...
+ */
+
+namespace LinBox
 {
 
-/** \brief Repository of functions for rank by elimination on sparse matrices.
+	/** \brief Repository of functions for rank by elimination on sparse matrices.
+
+	  Several versions allow for adjustment of the pivoting strategy
+	  and for choosing in-place elimination or for not modifying the input matrix.
+	  Also an LU interface is offered.
+	  */
+	template <class _Field>
+	class GaussDomain {
+	public:
+		typedef _Field Field;
+		typedef typename Field::Element Element;
+
+	private:
+		const Field         &_F;
+
+	public:
+
+		/** \brief The field parameter is the domain
+		 * over which to perform computations
+		 */
+		GaussDomain (const Field &F) :
+			_F (F)
+		{}
+
+		//Copy constructor
+		///
+		GaussDomain (const GaussDomain &M) :
+			_F (M._F)
+		{}
+
+		/** accessor for the field of computation
+		*/
+		const Field &field () const { return _F; }
+
+		/** @name rank
+		  Callers of the different rank routines\\
+		  -/ The "in" suffix indicates in place computation\\
+		  -/ Without Ni, Nj, the Matrix parameter must be a vector of sparse
+		  row vectors, NOT storing any zero.\\
+		  -/ Calls @link rankinLinearPivoting at endlink (by default) or @link rankinNoReordering at endlink
+		  */
+		//@{
+		///
+		template <class Matrix> unsigned long& rankin(unsigned long &rank,
+		Matrix        &A,
+		SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR) const;
+		///
+		template <class Matrix> unsigned long& rankin(unsigned long &rank,
+		Matrix        &A,
+		unsigned long  Ni,
+		unsigned long  Nj,
+		SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR) const;
+		///
+		template <class Matrix> unsigned long& rank(unsigned long &rank,
+		const Matrix        &A,
+		SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR) const;
+		///
+		template <class Matrix> unsigned long& rank(unsigned long &rank,
+		const Matrix        &A,
+		unsigned long  Ni,
+		unsigned long  Nj,
+		SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR) const;
+		//@}
+
+		/** @name det
+		  Callers of the different determinant routines\\
+		  -/ The "in" suffix indicates in place computation\\
+		  -/ Without Ni, Nj, the Matrix parameter must be a vector of sparse
+		  row vectors, NOT storing any zero.\\
+		  -/ Calls @link LinearPivoting at endlink (by default) or @link NoReordering at endlink
+		  */
+		//@{
+		///
+		template <class Matrix> Element& detin(Element &determinant,
+		Matrix        &A,
+		SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR) const;
+		///
+		template <class Matrix> Element& detin(Element &determinant,
+		Matrix        &A,
+		unsigned long  Ni,
+		unsigned long  Nj,
+		SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR) const;
+		///
+		template <class Matrix> Element& det(Element &determinant,
+		const Matrix        &A,
+		SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR) const;
+		///
+		template <class Matrix> Element& det(Element &determinant,
+		const Matrix        &A,
+		unsigned long  Ni,
+		unsigned long  Nj,
+		SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR) const;
+		//@}
+
+
+		/** \brief Sparse in place Gaussian elimination with reordering to reduce fill-in.
+		 * Pivots are chosen in sparsest column of sparsest row.
+		 * This runs in linear overhead.
+		 * It is similar in spirit but different from Markovitz' approach.
+		 *
+		 * \pre Using : SparseFindPivot(..., density) for sparsest column, and
+		 * eliminate (..., density)
+		 *
+		 * The Matrix parameter must meet the LinBox sparse matrix interface.
+		 * [check details].
+		 * The computedet indicates whether the algorithm must compute the determionant as it goes
+		 *
+		 * @bib
+		 * - Jean-Guillaume Dumas and  Gilles Villard,
+		 * <i>Computing the rank of sparse matrices over finite fields</i>.
+		 * In Ganzha et~al. CASC'2002, pages 47--62.
+		 */
+		template <class Matrix, class Perm>
+		unsigned long& QLUPin(unsigned long &rank,
+				      Element& determinant,
+				      Perm          &Q,
+				      Matrix	    &L,
+				      Matrix        &U,
+				      Perm	    &P,
+				      unsigned long Ni,
+				      unsigned long Nj) const;
+
+		template <class Matrix, class Perm, class Vector1, class Vector2>
+		Vector1& solve(Vector1& x, unsigned long rank, const Perm& Q, const Matrix& L, const Matrix& U, const Perm& P, const Vector2& b, bool randomsol=false)  const;
+
+		template <class Matrix, class Perm, class Vector1, class Vector2>
+		Vector1& solve(Vector1& x, Vector1& w, unsigned long rank, const Perm& Q, const Matrix& L, const Matrix& U, const Perm& P, const Vector2& b)  const;
+
+
+		template <class Matrix, class Vector1, class Vector2>
+		Vector1& solvein(Vector1	&x,
+				 Matrix         &A,
+				 const Vector2	&b, bool randomsol=false)  const;
+
+
+		template <class Matrix, class Perm, class Block>
+		Block& nullspacebasis(Block& x,
+				      unsigned long rank,
+				      const Matrix& U,
+				      const Perm& P)  const ;
+
+		template <class Matrix, class Block>
+		Block& nullspacebasisin(Block& x, Matrix& A)  const;
+
+		template <class Matrix, class Block>
+		Block& nullspacebasis(Block& x, const Matrix& A)  const;
+
+
+		// Sparsest method
+		//   erases elements while computing rank/det.
+		template <class Matrix>
+		unsigned long& InPlaceLinearPivoting(unsigned long &rank,
+						     Element& determinant,
+						     Matrix        &A,
+						     unsigned long Ni,
+						     unsigned long Nj) const;
+
+		// Same as the latter but keeps trace
+		//   of column permutations
+		//   of remaining elements in the matrix
+		template <class Matrix,class Perm>
+		unsigned long& InPlaceLinearPivoting(unsigned long &rank,
+						     Element& determinant,
+						     Matrix        &A,
+						     Perm          &P,
+						     unsigned long Ni,
+						     unsigned long Nj) const;
+
+
+		/** \brief Sparse Gaussian elimination without reordering.
+
+		  Gaussian elimination is done on a copy of the matrix.
+Using : SparseFindPivot
+eliminate
+
+Requirements : SLA is an array of sparse rows
+WARNING : NOT IN PLACE, THERE IS A COPY.
+Without reordering (Pivot is first non-zero in row)
+
+*/
+		template <class Matrix>
+		unsigned long& NoReordering (unsigned long &rank, Element& determinant, Matrix &LigneA, unsigned long Ni, unsigned long Nj) const;
+
+		/** \brief Dense in place LU factorization without reordering
 
-    Several versions allow for adjustment of the pivoting strategy
-    and for choosing in-place elimination or for not modifying the input matrix.
-    Also an LU interface is offered.
+Using : FindPivot and LU
 */
-    template <class _Field>
-    class GaussDomain {
-    public:
-	typedef _Field Field;
-	typedef typename Field::Element Element;
-
-    private:
-	const Field         &_F;
-
-    public:
-
-            /** \brief The field parameter is the domain 
-             * over which to perform computations
-             */
-	GaussDomain (const Field &F) : _F (F) {}
-
-            //Copy constructor
-            /// 
-	GaussDomain (const GaussDomain &M) : _F (M._F) {}
-
-            /** accessor for the field of computation
-             */
-        const Field &field () { return _F; }
-
-            /** @name rank
-                Callers of the different rank routines\\
-                -/ The "in" suffix indicates in place computation\\
-                -/ Without Ni, Nj, the Matrix parameter must be a vector of sparse 
-                row vectors, NOT storing any zero.\\
-                -/ Calls {@link rankinLinearPivoting rankinLinearPivoting} (by default) or {@link rankinNoReordering rankinNoReordering}
-            */
-            //@{
-            ///     
-	template <class Matrix> unsigned long& rankin(unsigned long &rank,
-                                                      Matrix        &A,
-                                                      SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR);
-            ///
-        template <class Matrix> unsigned long& rankin(unsigned long &rank,
-                                                      Matrix        &A,
-                                                      unsigned long  Ni,
-                                                      unsigned long  Nj,
-						      SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR);
-            ///        
-	template <class Matrix> unsigned long& rank(unsigned long &rank,
-                                                    const Matrix        &A,
-                                                    SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR);
-            ///        
-        template <class Matrix> unsigned long& rank(unsigned long &rank,
-                                                    const Matrix        &A,
-                                                    unsigned long  Ni,
-                                                    unsigned long  Nj,
-                                                    SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR);
-            //@}
-
-            /** @name det
-                Callers of the different determinant routines\\
-                -/ The "in" suffix indicates in place computation\\
-                -/ Without Ni, Nj, the Matrix parameter must be a vector of sparse 
-                row vectors, NOT storing any zero.\\
-                -/ Calls {@link LinearPivoting } (by default) or {@link NoReordering}
-            */
-            //@{
-            ///     
-	template <class Matrix> Element& detin(Element &determinant,
-                                               Matrix        &A,
-                                               SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR);
-            ///
-        template <class Matrix> Element& detin(Element &determinant,
-                                               Matrix        &A,
-                                               unsigned long  Ni,
-                                               unsigned long  Nj,
-                                               SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR);
-            ///        
-	template <class Matrix> Element& det(Element &determinant,
-                                             const Matrix        &A,
-                                             SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR);
-            ///        
-        template <class Matrix> Element& det(Element &determinant,
-                                             const Matrix        &A,
-                                             unsigned long  Ni,
-                                             unsigned long  Nj,
-                                             SparseEliminationTraits::PivotStrategy   reord = SparseEliminationTraits::PIVOT_LINEAR);
-            //@}
-
-
-            /** \brief Sparse in place Gaussian elimination with reordering to reduce fill-in.
-                pivots are chosen in sparsest column of sparsest row.
-                This runs in linear overhead.
-                It is similar in spirit but different from Markovitz' approach.  
-
-                <pre>
-                Using : SparseFindPivot(..., density) for sparsest column, and 
-                eliminate (..., density)
-                </pre>
-
-                The Matrix parameter must meet the LinBox sparse matrix interface.
-                [check details].
-                The computedet indicates whether the algorithm must compute the determionant as it goes
-
-                @ref [Jean-Guillaume Dumas and Gilles Villard, 
-                Computing the rank of sparse matrices over finite fields.
-                In Ganzha et~al. CASC'2002, pages 47--62.]
-            */
-	template <class Matrix>
-	unsigned long& InPlaceLinearPivoting (unsigned long &rank,
-                                              Element& determinant,
-                                              Matrix        &A,
-                                              unsigned long Ni, 
-                                              unsigned long Nj);
-
-
-            /** \brief Sparse Gaussian elimination without reordering. 
-
-                Gaussian elimination is done on a copy of the matrix.
-                Using : SparseFindPivot
-                eliminate
-
-                Requirements : SLA is an array of sparse rows
-                WARNING : NOT IN PLACE, THERE IS A COPY.
-                Without reordering (Pivot is first non-zero in row)
-
-            */
-	template <class Matrix>
-	unsigned long& NoReordering (unsigned long &rank, Element& determinant, Matrix &LigneA, unsigned long Ni, unsigned long Nj);
-
-            /** \brief Dense in place LU factorization without reordering
-
-                Using : FindPivot and LU
-            */
-	template <class Matrix>
-	unsigned long &LUin (unsigned long &rank, Matrix &A);
-
-
-            /** \brief Dense in place Gaussian elimination without reordering
-
-                Using : FindPivot and LU
-            */
-	template <class Matrix>
-	unsigned long &upperin (unsigned long &rank, Matrix &A);
-        
-
-
-    protected:
-    
-            //-----------------------------------------
-            // Sparse elimination using a pivot row :
-            // lc <-- lc - lc[k]/lp[0] * lp 
-            // D is the number of elements per column
-            //   it is updated and used for reordering
-            // Vector is a vector of Pair (lin_pair.h)
-            //-----------------------------------------
-	template <class Vector, class D>
-	void eliminate (Vector              &lignecourante,
-			const Vector        &lignepivot,
-			const unsigned long &indcol,
-			const long &indpermut,
-			D                   &columns);
-
-            //-----------------------------------------
-            // Sparse elimination using a pivot row :
-            // lc <-- lc - lc[k]/lp[0] * lp 
-            // No density update
-            // Vector is a vector of Pair (lin_pair.h)
-            //-----------------------------------------
-	template <class Vector>
-	void eliminate (Vector              &lignecourante,
-			const Vector        &lignepivot,
-			const unsigned long &indcol,
-			const long &indpermut);
-
-            //-----------------------------------------
-            // Dense elimination using a pivot row :
-            // lc <-- lc - lc[k]/lp[0] * lp 
-            // Computing only for k to n (and not 0 to n in LU)
-            //-----------------------------------------
-	template<class Vector>
-	void Upper (Vector       &lignecur,
-		    const Vector &lignepivot,
-		    unsigned long indcol,
-		    long indpermut);
-
-            //-----------------------------------------
-            // Dense elimination using a pivot row :
-            // lc <-- lc - lc[k]/lp[0] * lp 
-            //-----------------------------------------
-	template <class Vector>
-	void LU (Vector       &lignecur,
-		 const Vector &lignepivot,
-		 unsigned long indcol,
-		 long indpermut);
-
-            //------------------------------------------
-            // Looking for a non-zero pivot in a row 
-            // Using the column density for reordering
-            // Pivot is chosen as to :
-            // 1. Row density is minimum
-            // 2. Column density is minimum for this row
-            //------------------------------------------
-	template <class Vector, class D>
-	void SparseFindPivot (Vector &lignepivot, unsigned long &indcol, long &indpermut, D &columns, Element& determinant);
-
-            //------------------------------------------
-            // Looking for a non-zero pivot in a row 
-            // No reordering
-            //------------------------------------------
-	template <class Vector>
-	void SparseFindPivot (Vector &lignepivot, unsigned long &indcol, long &indpermut, Element& determinant);
-
-            //------------------------------------------
-            // Looking for a non-zero pivot in a row  
-            // Dense search
-            //------------------------------------------
-	template <class Vector>
-	void FindPivot (Vector &lignepivot, unsigned long &k, long &indpermut);
-
-    };
+		template <class Matrix>
+		unsigned long &LUin (unsigned long &rank, Matrix &A) const;
+
+
+		/** \brief Dense in place Gaussian elimination without reordering
+
+Using : FindPivot and LU
+*/
+		template <class Matrix>
+		unsigned long &upperin (unsigned long &rank, Matrix &A) const;
+
+
+
+	protected:
+
+		//-----------------------------------------
+		// Sparse elimination using a pivot row :
+		// lc <-- lc - lc[k]/lp[0] * lp
+		// D is the number of elements per column
+		//   it is updated and used for reordering
+		// Vector is a vector of Pair (lin_pair.h)
+		//-----------------------------------------
+		template <class Vector, class D>
+		void eliminate (Element             & headpivot,
+				Vector              &lignecourante,
+				const Vector        &lignepivot,
+				const unsigned long indcol,
+				const long indpermut,
+				const unsigned long npiv,
+				D                   &columns) const;
+
+		template <class Vector, class D>
+		void eliminate (Vector              &lignecourante,
+				const Vector        &lignepivot,
+				const unsigned long &indcol,
+				const long &indpermut,
+				D                   &columns) const;
+
+		template <class Vector>
+		void permute (Vector              &lignecourante,
+			      const unsigned long &indcol,
+			      const long &indpermut) const;
+		//-----------------------------------------
+		// Sparse elimination using a pivot row :
+		// lc <-- lc - lc[k]/lp[0] * lp
+		// No density update
+		// Vector is a vector of Pair (lin_pair.h)
+		//-----------------------------------------
+		template <class Vector>
+		void eliminate (Vector              &lignecourante,
+				const Vector        &lignepivot,
+				const unsigned long &indcol,
+				const long &indpermut) const;
+
+		//-----------------------------------------
+		// Dense elimination using a pivot row :
+		// lc <-- lc - lc[k]/lp[0] * lp
+		// Computing only for k to n (and not 0 to n in LU)
+		//-----------------------------------------
+		template<class Vector>
+		void Upper (Vector       &lignecur,
+			    const Vector &lignepivot,
+			    unsigned long indcol,
+			    long indpermut) const;
+
+		//-----------------------------------------
+		// Dense elimination using a pivot row :
+		// lc <-- lc - lc[k]/lp[0] * lp
+		//-----------------------------------------
+		template <class Vector>
+		void LU (Vector       &lignecur,
+			 const Vector &lignepivot,
+			 unsigned long indcol,
+			 long indpermut) const;
+
+		//------------------------------------------
+		// Looking for a non-zero pivot in a row
+		// Using the column density for reordering
+		// Pivot is chosen as to :
+		// 1. Row density is minimum
+		// 2. Column density is minimum for this row
+		//------------------------------------------
+		template <class Vector, class D>
+		void SparseFindPivot (Vector &lignepivot, unsigned long &indcol, long &indpermut, D &columns, Element& determinant) const;
+
+		//------------------------------------------
+		// Looking for a non-zero pivot in a row
+		// No reordering
+		//------------------------------------------
+		template <class Vector>
+		void SparseFindPivot (Vector &lignepivot, unsigned long &indcol, long &indpermut, Element& determinant) const;
+
+		//------------------------------------------
+		// Looking for a non-zero pivot in a row
+		// Dense search
+		//------------------------------------------
+		template <class Vector>
+		void FindPivot (Vector &lignepivot, unsigned long &k, long &indpermut) const;
+
+	};
 
 } // namespace LinBox
 
 #include "linbox/algorithms/gauss.inl"
-
-#endif // __GAUSS_H
+#include "linbox/algorithms/gauss-pivot.inl"
+#include "linbox/algorithms/gauss-elim.inl"
+#include "linbox/algorithms/gauss-solve.inl"
+#include "linbox/algorithms/gauss-nullspace.inl"
+#include "linbox/algorithms/gauss-rank.inl"
+#include "linbox/algorithms/gauss-det.inl"
+
+#endif // __LINBOX_gauss_H
diff --git a/linbox/algorithms/gauss.inl b/linbox/algorithms/gauss.inl
index 92c1f69..ab7dc71 100644
--- a/linbox/algorithms/gauss.inl
+++ b/linbox/algorithms/gauss.inl
@@ -1,954 +1,694 @@
 /* -*- 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
 /* linbox/algorithms/gauss.inl
  * Copyright (C) 1999 Jean-Guillaume Dumas
  *
  * Written by Jean-Guillaume Dumas <Jean-Guillaume.Dumas at imag.fr>
- * Time-stamp: <09 Feb 07 11:25:51 Jean-Guillaume.Dumas at imag.fr> 
- *
- * -----------------------------------------------------------
- * 2003-02-02  Bradford Hovinen  <bghovinen at math.uwaterloo.ca>
- *
- * Ported to new matrix archetype; update interface to meet current
- * standards. Rename gauss_foo as foo and gauss_Uin as upperin
- *
- * Move function definitions to gauss.inl
- * -----------------------------------------------------------
+ * Time-stamp: <18 Jun 10 15:48:38 Jean-Guillaume.Dumas at imag.fr>
  *
  * See COPYING for license information.
  */
-
 // ========================================================================= //
 // (C) The Linbox Group 1999
 // Calcul de rang par la méthode de Gauss pivot par ligne, sur matrice creuse
 // ========================================================================= //
 
-#ifndef __GAUSS_INL
-#define __GAUSS_INL
+#ifndef __LINBOX_gauss_INL
+#define __LINBOX_gauss_INL
 
 #include "linbox/algorithms/gauss.h"
 #include "linbox/util/commentator.h"
+#include <utility>
 
 #ifdef __LINBOX_ALL__
 #define __LINBOX_COUNT__
-#define __LINBOX_OFTEN__
+#define __LINBOX_OFTEN__ __LINBOX_ALL__ // BB: ???
 #define __LINBOX_FILLIN__
 #endif
 
-namespace LinBox 
+namespace LinBox
 {
+	template <class _Field>
+	template <class Matrix, class Perm> inline unsigned long&
+	GaussDomain<_Field>::QLUPin (unsigned long &rank,
+				     Element       &determinant,
+				     Perm          &Q,
+				     Matrix        &LigneL,
+				     Matrix        &LigneA,
+				     Perm          &P,
+				     unsigned long Ni,
+				     unsigned long Nj) const
+	{
+		linbox_check( Q.coldim() == Q.rowdim() );
+		linbox_check( P.coldim() == P.rowdim() );
+		linbox_check( LigneL.coldim() == LigneL.rowdim() );
+		linbox_check( Q.coldim() == LigneL.rowdim() );
+		linbox_check( LigneL.coldim() == LigneA.rowdim() );
+		linbox_check( LigneA.coldim() == P.rowdim() );
+
+		typedef typename Matrix::Row        Vector;
+		typedef typename Vector::value_type E;
+
+		// Requirements : LigneA is an array of sparse rows
+		// In place (LigneA is modified)
+		// With reordering (D is a density type. Density is allocated here)
+		//    long Ni = LigneA.n_row (), Nj = LigneA.n_col ();
+		commentator.start ("Gaussian elimination with reordering",
+				   "IPLR", Ni);
+		commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+		<< "Gaussian QLUP elimination on " << Ni << " x " << Nj << " matrix" << std::endl;
+
+#ifdef __LINBOX_COUNT__
+		long long nbelem = 0;
+#endif
+
+		Element Eone; _F.init(Eone,1UL);
+		_F.init(determinant,1UL);
+		// allocation of the column density
+		std::vector<size_t> col_density (Nj);
+
+
+		for(typename Matrix::RowIterator LigneL_it = LigneL.rowBegin() ;
+		    LigneL_it != LigneL.rowEnd(); ++LigneL_it)
+			LigneL_it->reserve(16);
+
+		std::deque<std::pair<size_t,size_t> > invQ;
+
+		// assignment of LigneA with the domain object
+		for (unsigned long jj = 0; jj < Ni; ++jj)
+			for (unsigned long k = 0; k < LigneA[jj].size (); k++)
+				++col_density[LigneA[jj][k].first];
+
+		long last = Ni - 1;
+		long c;
+		rank = 0;
+
+#ifdef __LINBOX_OFTEN__
+		long sstep = last/40;
+		if (sstep > __LINBOX_OFTEN__) sstep = __LINBOX_OFTEN__;
+#else
+		long sstep = 1000;
+#endif
+		// Elimination steps with reordering
+
+		typename Matrix::RowIterator LigneA_k = LigneA.rowBegin(), LigneA_p;
+		for (long k = 0; k < last; ++k, ++LigneA_k) {
+			long p = k, s = 0;
+
+#ifdef __LINBOX_FILLIN__
+			if ( ! (k % 100) ) {
+#else
+				if ( ! (k % sstep) ) {
+#endif
+					commentator.progress (k);
+#ifdef __LINBOX_FILLIN__
+					long sl(0);
+					for (size_t l = 0; l < Ni; ++l)
+						sl += LigneA[l].size ();
+
+					commentator.report (Commentator::LEVEL_IMPORTANT, PARTIAL_RESULT)
+					<< "Fillin (" << rank << "/" << Ni << ") = "
+					<< sl
+					<< " (" << double(sl)*100.0/double(Ni-k)/double(Nj-k) << "%, "
+					<< double(sl)/double(Ni-k) << " avg)"
+					<< std::endl;
+#endif
+				}
+
+				long l;
+				for(l = k; l < static_cast<long>(Ni); ++l) {
+					if ( (s = LigneA[l].size()) ) {
+						p = l;
+						break;
+					}
+				}
+
+				if (s) {
+					long sl;
+					// Row permutation for the sparsest row
+					for (; l < static_cast<long>(Ni); ++l)
+						if (((sl = LigneA[l].size ()) < s) && (sl)) {
+							s = sl;
+							p = l;
+						}
+
+					if (p != k) {
+						//                         std::cerr << "Permuting rows: " << k << " <--> " << p << std::endl;
+						invQ.push_front( std::pair<size_t,size_t>(k,p) );
+						_F.negin(determinant);
+						std::swap( *LigneA_k, LigneA[p]);
+						std::swap( LigneL[k], LigneL[p]);
+					}
+
+
+					SparseFindPivot (*LigneA_k, rank, c, col_density, determinant);
+
+					if (c != -1) {
+						long ll;
+						if ( c != (static_cast<long>(rank)-1) ) {
+							P.permute(rank-1,c);
+							for (ll=0      ; ll < k ; ++ll)
+								permute( LigneA[ll], rank, c);
+						}
+						long npiv=LigneA_k->size();
+						for (ll = k+1; ll < static_cast<long>(Ni); ++ll) {
+							E hc; hc.first=rank-1;
+							eliminate (hc.second, LigneA[ll], *LigneA_k, rank, c, npiv, col_density);
+							if(! _F.isZero(hc.second)) LigneL[ll].push_back(hc);
+						}
+					}
+
+					//                     LigneA.write(std::cerr << "AFT " )<<std::endl;
+#ifdef __LINBOX_COUNT__
+					nbelem += LigneA_k->size ();
+#endif
+				}
+				E one(k,Eone);
+				LigneL[k].push_back(one);
+				//                 LigneL.write(rep << "L:= ", FORMAT_MAPLE) << std::endl;
+				//                 LigneA.write(rep << "U:= ", FORMAT_MAPLE) << std::endl;
+			}//for k
+
+			SparseFindPivot ( LigneA[last], rank, c, determinant);
+			if (c != -1) {
+				if ( c != (static_cast<long>(rank)-1) ) {
+					P.permute(rank-1,c);
+					for (long ll=0      ; ll < last ; ++ll)
+						permute( LigneA[ll], rank, c);
+				}
+			}
+
+			E one(last,Eone);
+			LigneL[last].push_back(one);
+
+#ifdef __LINBOX_COUNT__
+			nbelem += LigneA[last].size ();
+			commentator.report (Commentator::LEVEL_NORMAL, PARTIAL_RESULT)
+			<< "Left elements : " << nbelem << std::endl;
+#endif
+
+#ifdef __LINBOX_FILLIN__
+			long sl(0);
+			for (size_t l=0; l < Ni; ++l)
+				sl += LigneA[l].size ();
+
+			commentator.report (Commentator::LEVEL_IMPORTANT, PARTIAL_RESULT)
+			<< "Fillin (" << rank << "/" << Ni << ") = " << sl
+			<< std::endl;
+#endif
+
+			if ((rank < Ni) || (rank < Nj) || (Ni == 0) || (Nj == 0))
+				_F.init(determinant,0UL);
+
+			integer card;
+			_F.write(commentator.report (Commentator::LEVEL_IMPORTANT, PARTIAL_RESULT)
+				 << "Determinant : ", determinant)
+			<< " over GF (" << _F.cardinality (card) << ")" << std::endl;
+
+			for(std::deque<std::pair<size_t,size_t> >::const_iterator it = invQ.begin(); it!=invQ.end();++it)
+				Q.permute( it->first, it->second );
+
+
+			//             std::ostream& rep = commentator.report (Commentator::LEVEL_IMPORTANT, PARTIAL_RESULT);
+			//             Q.write(rep << "Q:= ", FORMAT_MAPLE) << ':' << std::endl;
+			//             LigneL.write(rep << "L:= ", FORMAT_MAPLE) << ':' << std::endl;
+			//             LigneA.write(rep << "U:= ", FORMAT_MAPLE) << ':' << std::endl;
+			//             P.write(rep << "P:= ", FORMAT_MAPLE) << ':' << std::endl;
+
+			commentator.report (Commentator::LEVEL_IMPORTANT, PARTIAL_RESULT)
+			<< "Rank : " << rank
+			<< " over GF (" << card << ")" << std::endl;
+			commentator.stop ("done", 0, "IPLR");
+
+
+
+			return rank;
+		}
+
+		template <class _Field>
+		template <class Matrix> inline unsigned long&
+		GaussDomain<_Field>::InPlaceLinearPivoting (unsigned long &rank,
+							    Element        &determinant,
+							    Matrix         &LigneA,
+							    unsigned long   Ni,
+							    unsigned long   Nj) const
+		{
+			typedef typename Matrix::Row        Vector;
+			typedef typename Vector::value_type E;
 
-    template <class _Field>
-    template <class Vector, class D>
-    void GaussDomain<_Field>::eliminate (Vector              &lignecourante,
-                                         const Vector        &lignepivot,
-                                         const unsigned long &indcol,
-                                         const long &indpermut,
-                                         D                   &columns)
-    {
-
-	typedef typename Vector::value_type E;
-        
-	unsigned long k = indcol - 1;
-	unsigned long nj = lignecourante.size () ;
-//         std::cerr << "BEGIN ELIMINATE, k: " << k << ", nj: " << nj << ", indpermut: " << indpermut << ", indcol: " << indcol << std::endl;
-//         std::cerr << "lignepivot: [";
-//         for(typename Vector::const_iterator refs =  lignepivot.begin();
-//             refs != lignepivot.end() ;
-//             ++refs )
-//             std::cerr << '(' << refs->first << ';' << refs->second << ')';
-//         std::cerr << "], lignecour: [";
-//         for(typename Vector::const_iterator refs =  lignecourante.begin();
-//             refs != lignecourante.end() ;
-//             ++refs )
-//             std::cerr << '(' << refs->first << ';' << refs->second << ')';
-//         std::cerr << ']' << std::endl;
-	if (nj > 0) {
-            unsigned long j_head = 0;
-
-            for (; j_head < nj; ++j_head)
-                if (static_cast<long>(lignecourante[j_head].first) >= indpermut) break;
-//         std::cerr << "ELIMINATE, j_head: " << j_head << std::endl;
-
-            if (j_head < nj) {
-                if (static_cast<long>(lignecourante[j_head].first) == indpermut) {
-                        // -------------------------------------------
-                        // Permutation
-                    if ( indpermut != static_cast<long>(k)) {
-                        if (lignecourante[0].first == k) {
-                                // non zero  <--> non zero
-                            Element tmp;
-                            _F.assign (tmp, lignecourante[0].second);
-                            _F.assign (lignecourante[0].second,
-                                       lignecourante[j_head].second);
-                            _F.assign (lignecourante[j_head].second, tmp);
-                        } else {
-                                // zero <--> non zero
-                            E tmp = lignecourante[j_head];
-                            --columns[tmp.first];
-                            ++columns[k];
-                            tmp.first = k;
-
-                            for (long l = j_head; l > 0; l--)
-                                lignecourante[l] = lignecourante[l-1];
-
-                            lignecourante[0] = tmp;
-                        } 
-                        j_head = 0;
-                    }
-                        // -------------------------------------------
-                        // Elimination
-                    unsigned long npiv = lignepivot.size ();
-                    Vector construit (nj + npiv);
-
-                        // construit : <-- j
-                        // courante  : <-- m
-                        // pivot     : <-- l
-                    unsigned long j = 0;
-                    unsigned long m = j_head + 1;
-
-                        // A[i,k] <-- - A[i,k] / A[k,k]
-                    Element headcoeff;
-                    _F.divin (_F.neg (headcoeff, lignecourante[j_head].second),
-                              lignepivot[0].second);
-
-                    --columns[lignecourante[j_head].first];
-        
-                        // if A[k,j]=0, then A[i,j] <-- A[i,j]
-                    while (j < j_head) {
-                        construit[j] = lignecourante[j];
-                        j++;
-                    }
-
-                    unsigned long j_piv;
-
-                    unsigned long l = 0;
-
-                    for (; l < npiv; l++)
-                        if (lignepivot[l].first > k) break;
-
-                        // for all j such that (j>k) and A[k,j]!=0
-                    while (l < npiv) {
-                        j_piv = lignepivot[l].first;
-
-                            // if A[k,j]=0, then A[i,j] <-- A[i,j]
-                        while ((m < nj) && (lignecourante[m].first < j_piv))
-                            construit[j++] = lignecourante[m++];
-
-                            // if A[i,j]!=0, then A[i,j] <-- A[i,j] - A[i,k]*A[k,j]
-                        if ((m < nj) && (lignecourante[m].first == j_piv)) {
-                            Element tmp;
-
-                            _F.axpy (tmp, headcoeff, lignepivot[l].second,
-                                     lignecourante[m].second);
-
-                            if (! _F.isZero (tmp)) {
-                                _F.assign (lignecourante[m].second, tmp);
-                                construit[j++] = lignecourante[m++];
-                            } else
-                                --columns[lignecourante[m++].first];
-                        } else {
-                            Element tmp;
-
-                            _F.mul (tmp, headcoeff, lignepivot[l].second);
-
-                            if (! _F.isZero (tmp)) {
-                                ++columns[j_piv];
-                                construit[j++] = E (j_piv, tmp);
-                            }
-                        }
-
-                        l++;
-                    }
-        
-                        // if A[k,j]=0, then A[i,j] <-- A[i,j] 
-                    while (m<nj)
-                        construit[j++] = lignecourante[m++];
-        
-                    construit.resize (j);
-                    lignecourante = construit;
-                } else {
-                        // -------------------------------------------
-                        // j_head < nj but nothing under the pivot
-                        // Permutation
-//                 std::cerr << "----------------------------------------------------------" << std::endl;
-//                 std::cerr << "j_head < nj" << std::endl;
-//                 std::cerr << "j_head: " << j_head << ", nj: " << nj << ", k:" << k 
-// //                         // << "lignepivot: " << lignepivot 
-// //                         // << ", lignecour: " << lignecourante 
-//                           << std::endl;
-//                 std::cerr << "----------------------------------------------------------" << std::endl;
-                    if (indpermut != static_cast<long>(k)) {
-                        if (j_head>0) {
-                            unsigned long l = 0;
-
-                            for (; l < nj; ++l)
-                                if (lignecourante[l].first >= k) break;
-                        
-                            if ((l < nj) && (lignecourante[l].first == k))  {
-                                    // non zero <--> zero
-                                E tmp = lignecourante[l];
-                                --columns[k];
-                                ++columns[indpermut];
-                                tmp.first = indpermut;
-                            
-                                unsigned long bjh = j_head-1;
-                                for (; l < bjh; ++l)
-                                    lignecourante[l] = lignecourante[l + 1];
-                            
-                                lignecourante[bjh] = tmp;
-                            } // else // zero <--> zero
-                        } // else // zero <--> zero
-                    } 
-                }
-            } else {
-                    // -------------------------------------------
-                    // j_head >= nj > 0
-//                 std::cerr << "----------------------------------------------------------" << std::endl;
-//                 std::cerr << "j_head >= nj > 0" << std::endl;
-//                 std::cerr << "j_head: " << j_head << ", nj: " << nj << ", k:" << k 
-// //                         // << "lignepivot: " << lignepivot 
-// //                         // << ", lignecour: " << lignecourante 
-//                           << std::endl;
-//                 std::cerr << "----------------------------------------------------------" << std::endl;
-                if (indpermut != static_cast<long>(k)) {
-                    unsigned long l = 0;
-
-                    for (; l < nj; ++l)
-                        if (lignecourante[l].first >= k) break;
-
-                    if ((l < nj) && (lignecourante[l].first == k))  {
-                            // non zero <--> zero
-                        E tmp = lignecourante[l];
-                        --columns[k];
-                        ++columns[indpermut];
-                        tmp.first = indpermut;
-
-                        unsigned long bjh = nj - 1;
-                        for (; l < bjh; ++l)
-                            lignecourante[l] = lignecourante[l + 1];
-
-                        lignecourante[bjh] = tmp;
-                    } // else
-                        // zero <--> zero
-                }
-            
-            }
-        }
-
-
-//         std::cerr << "END ELIMINATE, k: " << k << ", nj: " << nj << ", indpermut: " << indpermut << ", indcol: " << indcol << std::endl;
-//         std::cerr << "lignepivot: [";
-//         for(typename Vector::const_iterator refs =  lignepivot.begin();
-//             refs != lignepivot.end() ;
-//             ++refs )
-//             std::cerr << '(' << refs->first << ';' << refs->second << ')';
-//         std::cerr << "], lignecour: [";
-//         for(typename Vector::const_iterator refs =  lignecourante.begin();
-//             refs != lignecourante.end() ;
-//             ++refs )
-//             std::cerr << '(' << refs->first << ';' << refs->second << ')';
-//         std::cerr << ']' << std::endl;
-
-    }
-    
-
-    template <class _Field>
-    template <class Vector>
-    void GaussDomain<_Field>::eliminate (Vector              &lignecourante,
-                                         const Vector        &lignepivot,
-                                         const unsigned long &indcol,
-                                         const long &indpermut)
-    {
-	typedef typename Vector::value_type E;
-
-	unsigned long k = indcol - 1;
-	unsigned long nj = lignecourante.size () ;
-
-	if (nj > 0) {
-            unsigned long j_head = 0;
-
-            for (; j_head < nj; ++j_head)
-                if (static_cast<long>(lignecourante[j_head].first) >= indpermut) break;
-
-            if (j_head < nj) {
-                if (static_cast<long>(lignecourante[j_head].first) == indpermut) {
-                        // -------------------------------------------
-                        // Permutation
-                    if (indpermut != static_cast<long>(k)) {
-                        if (lignecourante[0].first == k) {     
-                                // non zero  <--> non zero
-                            Element tmp;
-                            _F.assign (tmp, lignecourante[0].second) ;
-                            _F.assign (lignecourante[0].second,
-                                       lignecourante[j_head].second);
-                            _F.assign (lignecourante[j_head].second, tmp);
-                        } else {
-                                // zero <--> non zero
-                            E tmp = lignecourante[j_head];
-                            tmp.first = k;
-                            for (long l = j_head; l > 0; l--)
-                                lignecourante[l] = lignecourante[l-1];
-                            lignecourante[0] = tmp;
-                        }
-
-                        j_head = 0;
-                    }
-                        // -------------------------------------------
-                        // Elimination
-                    unsigned long npiv = lignepivot.size ();
-                    Vector construit (nj + npiv);
-                        // construit : <-- j
-                        // courante  : <-- m
-                        // pivot     : <-- l
-                    unsigned long j = 0;
-                    unsigned long m = j_head + 1;
-
-                        // A[i,k] <-- - A[i,k] / A[k,k]
-
-                    Element headcoeff;
-                    _F.divin (_F.neg (headcoeff, lignecourante[j_head].second),
-                              lignepivot[0].second);
-
-                        // if A[k,j]=0, then A[i,j] <-- A[i,j]
-                    while (j < j_head) {
-                        construit[j] = lignecourante[j];
-                        j++;
-                    }
-
-                    unsigned long j_piv;
-                    unsigned long l = 0;
-
-                    for (; l < npiv; l++)
-                        if (lignepivot[l].first > k) break;
-
-                        // for all j such that (j>k) and A[k,j]!=0
-                    while (l < npiv) {
-                        j_piv = lignepivot[l].first;
-
-                            // if A[k,j]=0, then A[i,j] <-- A[i,j]
-                        while ((m < nj) && (lignecourante[m].first < j_piv))
-                            construit[j++] = lignecourante[m++];
-
-                            // if A[i,j]!=0, then A[i,j] <-- A[i,j] - A[i,k]*A[k,j]
-                        if ((m < nj) && (lignecourante[m].first == j_piv)) {
-                            Element tmp;
-                            _F.axpy (tmp, headcoeff, lignepivot[l].second,
-                                     lignecourante[m].second);
-
-                            if (! _F.isZero (tmp)) {
-                                _F.assign (lignecourante[m].second, tmp);
-                                construit[j++] = lignecourante[m++];
-                            } else
-                                ++m;
-                    
-                        } else {
-                            Element tmp;
-                            _F.mul (tmp, headcoeff, lignepivot[l].second);
-                            if (! _F.isZero (tmp))
-                                construit[j++] = E (j_piv, tmp);
-                        }
-                        l++;
-                    }
-        
-                        // if A[k,j]=0, then A[i,j] <-- A[i,j] 
-                    while (m < nj)
-                        construit[j++] = lignecourante[m++];
-
-                    construit.resize (j);
-                    lignecourante = construit;
-                } else {
-                        // -------------------------------------------
-                        // j_head < nj but nothing under the pivot
-                        // Permutation
-                    if (indpermut != static_cast<long>(k)) {
-                        if (j_head > 0) {
-                            unsigned long l = 0;
-
-                            for (; l < nj; ++l)
-                                if (lignecourante[l].first >= k) break;
-
-                            if ((l < nj) && (lignecourante[l].first == k))  {
-                                    // non zero <--> zero
-                                E tmp = lignecourante[l];
-                                tmp.first = indpermut;
-
-                                unsigned long bjh = j_head -1;
-                                for (; l < bjh; l++)
-                                    lignecourante[l] = lignecourante[l + 1];
-
-                                lignecourante[bjh] = tmp;
-                            } // else // zero <--> zero
-                        } // else // zero <--> zero
-                    }
-                }
-            } else {
-                    // -------------------------------------------
-                    // -------------------------------------------
-                    // j_head >= nj > 0
-//                 std::cerr << "----------------------------------------------------------" << std::endl;
-//                 std::cerr << "j_head >= nj > 0" << std::endl;
-//                 std::cerr << "j_head: " << j_head << ", nj: " << nj << ", k:" << k 
-//                         // << "lignepivot: " << lignepivot 
-//                         //  << ", lignecour: " << lignecourante 
-//                           << std::endl;
-//                 std::cerr << "----------------------------------------------------------" << std::endl;
-                if (indpermut != static_cast<long>(k)) {
-                    unsigned long l = 0;
-
-                    for (; l < nj; ++l)
-                        if (lignecourante[l].first >= k) break;
-
-                    if ((l < nj) && (lignecourante[l].first == k))  {
-                            // non zero <--> zero
-                        E tmp = lignecourante[l];
-                        tmp.first = indpermut;
-
-                        unsigned long bjh = nj - 1;
-                        for (; l < bjh; l++)
-                            lignecourante[l] = lignecourante[l + 1];
-
-                        lignecourante[bjh] = tmp;
-                    } // else
-                        // zero <--> zero
-                }
-            }
-	}
-    }
-
-    template <class _Field>
-    template<class Vector>
-    void GaussDomain<_Field>::Upper (Vector        &lignecur,
-                                     const Vector  &lignepivot,
-                                     unsigned long  indcol,
-                                     long  indpermut)
-    {
-        static typename _Field::Element zero = _F.init(zero);
-        
-	long n = lignecur.size () ;
-	long k = indcol - 1 ;
-
-            // permutation if one has been performed to compute the pivot
-	if (indpermut != k) {
-            typename Vector::value_type tmp = lignecur[k];
-            lignecur[k] = lignecur[indpermut];
-            lignecur[indpermut] = tmp;
-	}
-
-	typename Vector::value_type headcoeff;
-	_F.divin (_F.neg (headcoeff, lignecur[k]), lignepivot[k]);
-        
-        
-
-            // LU in place
-	_F.assign (lignecur[k], zero);
-	for (long j = k; ++j < n;)
-            _F.axpyin (lignecur[j], headcoeff, lignepivot[j]) ;
-    }
-
-    template <class _Field>
-    template <class Vector>
-    void GaussDomain<_Field>::LU (Vector        &lignecur,
-                                  const Vector  &lignepivot,
-                                  unsigned long  indcol,
-                                  long  indpermut)
-    {
-	long n = lignecur.size ();
-	long k = indcol - 1;
-
-            // permutation if one has been performed to compute the pivot
-	if (indpermut != k) {
-            typename Vector::value_type tmp = lignecur[k];
-            lignecur[k] = lignecur[indpermut];
-            lignecur[indpermut] = tmp;
-	}
-
-	typename Vector::value_type headcoeff;
-            // LU in place
-	_F.div (headcoeff, lignecur[k], lignepivot[k]);
-	_F.assign (lignecur[k], headcoeff);
-	_F.negin (headcoeff);
-	for (long j = k; ++j < n;)
-            _F.axpyin (lignecur[j],headcoeff,lignepivot[j]);
-    }
-
-    template <class _Field>
-    template <class Vector, class D>
-    void GaussDomain<_Field>::SparseFindPivot (Vector        	&lignepivot,
-                                               unsigned long 	&indcol,
-                                               long 		&indpermut,
-                                               D             	&columns,
-                                               Element		&determinant)
-    {
- //        std::cerr << "SFP BEG : lignepivot: [";
-//         for(typename Vector::const_iterator refs =  lignepivot.begin();
-//             refs != lignepivot.end() ;
-//             ++refs )
-//             std::cerr << '(' << refs->first << ';' << refs->second << ')';
-//         std::cerr << "]" << std::endl;
-	typedef typename Vector::value_type E;    
-
-	long nj =  lignepivot.size ();
-        bool pivoting = false;
-
-	if (nj > 0) {
-            indpermut = lignepivot[0].first;
-
-            long ds = --columns[indpermut], dl, p = 0;
-
-            for (long j = 1; j < nj; ++j) {
-                if ((dl = --columns[lignepivot[j].first]) < ds) {
-                    ds = dl;
-                    p = j;
-                }
-            }
-
-            if (p != 0) {
-                pivoting = true;
-                if (indpermut == static_cast<long>(indcol)) {
-                    Element ttm;
-                    _F.assign (ttm, lignepivot[p].second);
-                    indpermut = lignepivot[p].first;
-                    _F.assign (lignepivot[p].second, lignepivot[0].second);
-                    _F.assign (lignepivot[0].second, ttm);
-                } else {
-                    E ttm = lignepivot[p];
-                    indpermut = ttm.first;
-
-                    for (long m = p; m; --m)
-                        lignepivot[m] = lignepivot[m-1];
-
-                    lignepivot[0] = ttm;
-                }
-            }
-
-            _F.mulin(determinant, lignepivot[0].second);
-            if (indpermut != static_cast<long>(indcol)) {
-                    // no need to decrement/increment, already done during the search
-                lignepivot[0].first = indcol;
-                pivoting = true;
-            }
-
-            if (pivoting) _F.negin(determinant);
-            ++indcol;
-	} else
-            indpermut = -1;
-//         std::cerr << "SFP END : lignepivot: [";
-//         for(typename Vector::const_iterator refs =  lignepivot.begin();
-//             refs != lignepivot.end() ;
-//             ++refs )
-//             std::cerr << '(' << refs->first << ';' << refs->second << ')';
-//         std::cerr << "]" << std::endl;
-    }
-
-    template <class _Field>
-    template <class Vector>
-    void GaussDomain<_Field>::SparseFindPivot (Vector &lignepivot, unsigned long &indcol, long &indpermut, Element& determinant)
-    {
-	long nj = lignepivot.size ();
-
-	if (nj > 0) {
-            indpermut = lignepivot[0].first;
-            _F.mulin(determinant, lignepivot[0].second);
-            if (indpermut != static_cast<long>(indcol)){
-                lignepivot[0].first = indcol;
-                _F.negin(determinant);
-            }
-            ++indcol;
-	} else
-            indpermut = -1;
-    }
-
-
-    template <class _Field>
-    template <class Vector>
-    void GaussDomain<_Field>::FindPivot (Vector &lignepivot, unsigned long &k, long &indpermut)
-    { 
-            // Dense lignepivot
-	long n = lignepivot.size ();
-	long j = k;
-
-	for (; j < n ; ++j )
-            if (!_F.isZero (lignepivot[j])) break ;
-
-	if (j == n )
-            indpermut = -1 ;
-	else {
-            indpermut = j ;
-            if (indpermut != k) {
-                typename Vector::value_type tmp = lignepivot[k] ;
-                lignepivot[k] = lignepivot[j] ;
-                lignepivot[j] = tmp ;
-            }
-
-            ++k;
-	}
-    }
-
-    template <class _Field>
-    template <class Matrix>
-    unsigned long& GaussDomain<_Field>::InPlaceLinearPivoting (unsigned long &res,
-                                                              Element        &determinant,
-                                                              Matrix         &LigneA,
-                                                              unsigned long   Ni,
-                                                              unsigned long   Nj)
-    {
-	typedef typename Matrix::Row        Vector;
-	typedef typename Vector::value_type E;    
-
-            // Requirements : LigneA is an array of sparse rows
-            // In place (LigneA is modified)
-            // With reordering (D is a density type. Density is allocated here)
-            //    long Ni = LigneA.n_row (), Nj = LigneA.n_col ();
-	commentator.start ("Gaussian elimination with reordering",
-			   "IPLR", Ni);
-	commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-            << "Gaussian elimination on " << Ni << " x " << Nj << " matrix" << std::endl;
+			// Requirements : LigneA is an array of sparse rows
+			// In place (LigneA is modified)
+			// With reordering (D is a density type. Density is allocated here)
+			//    long Ni = LigneA.n_row (), Nj = LigneA.n_col ();
+			commentator.start ("Gaussian elimination with reordering",
+					   "IPLR", Ni);
+			_F.write( commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+				  << "Gaussian elimination on " << Ni << " x " << Nj << " matrix, over: ") << std::endl;
 
 #ifdef __LINBOX_COUNT__
-	long long nbelem = 0;
+			long long nbelem = 0;
 #endif
 
-        _F.init(determinant,1UL);
-	Vector Vzer (0);
-            // allocation of the column density
-        std::vector<size_t> col_density (Nj);
+			_F.init(determinant,1UL);
+			Vector Vzer (0);
+			// allocation of the column density
+			std::vector<size_t> col_density (Nj);
 
-            // assignment of LigneA with the domain object
-	for (unsigned long jj = 0; jj < Ni; ++jj) 
-            for (unsigned long k = 0; k < LigneA[jj].size (); k++)
-                ++col_density[LigneA[jj][k].first];
+			// assignment of LigneA with the domain object
+			for (unsigned long jj = 0; jj < Ni; ++jj)
+				for (unsigned long k = 0; k < LigneA[jj].size (); k++)
+					++col_density[LigneA[jj][k].first];
 
-	long last = Ni - 1;
-	long c;
-	unsigned long indcol = 0;
+			long last = Ni - 1;
+			long c;
+			rank = 0;
 
 #ifdef __LINBOX_OFTEN__
-	long sstep = last/40;
-	if (sstep > 1000) sstep = 1000;
+			long sstep = last/40;
+			if (sstep > __LINBOX_OFTEN__) sstep = __LINBOX_OFTEN__;
 #else
-	long sstep = 1000;
+			long sstep = 1000;
 #endif
-            // Elimination steps with reordering
-	for (long k = 0; k < last; ++k) {
-            unsigned long l;
-            long p = k, s = LigneA[k].size (), sl;
-
-#ifdef __LINBOX_FILLIN__  
-            if ( ! (k % 100) ) {
-#else          
-                if ( ! (k % sstep) ) {
+			// Elimination steps with reordering
+			for (long k = 0; k < last; ++k) {
+				unsigned long l;
+				long p = k, s = LigneA[k].size (), sl;
+
+#ifdef __LINBOX_FILLIN__
+				if ( ! (k % 100) ) {
+#else
+					if ( ! (k % sstep) ) {
+#endif
+						commentator.progress (k);
+#ifdef __LINBOX_FILLIN__
+						for (sl = 0, l = 0; l < Ni; ++l)
+							sl += LigneA[l].size ();
+
+						commentator.report (Commentator::LEVEL_IMPORTANT, PARTIAL_RESULT)
+						<< "Fillin (" << rank << "/" << Ni << ") = "
+						<< sl
+						<< " (" << double(sl)*100.0/double(Ni-k)/double(Nj-k) << "%, "
+						<< double(sl)/double(Ni-k) << " avg)"
+						<< std::endl;
 #endif
-                    commentator.progress (k);
-#ifdef __LINBOX_FILLIN__            
-                    for (sl = 0, l = 0; l < Ni; ++l)
-                        sl += LigneA[l].size ();
-
-                    commentator.report (Commentator::LEVEL_IMPORTANT, PARTIAL_RESULT)
-                        << "Fillin (" << indcol << "/" << Ni << ") = "
-                        << sl << std::endl;
-#endif 
-                }
-	    
-                if (s) {
-                    for (l = k + 1; l < Ni; ++l)
-                        if (((sl = LigneA[l].size ()) < s) && (sl)) {
-                            s = sl;
-                            p = l;
-                        }
-
-                    if (p != k) {
-                        _F.negin(determinant);
-                        Vector vtm = LigneA[k];
-                        LigneA[k] = LigneA[p];
-                        LigneA[p] = vtm;
-                    }
-		    
-//                     LigneA.write(std::cerr << "BEF, k:" << k << ", indcol:" << indcol << ", c:" << c)<<std::endl;
-                    
-                    SparseFindPivot (LigneA[k], indcol, c, col_density, determinant);
-//                     LigneA.write(std::cerr << "PIV, k:" << k << ", indcol:" << indcol << ", c:" << c)<<std::endl;
-                    if (c != -1)
-                        for (l = k + 1; l < Ni; ++l)
-                            eliminate (LigneA[l], LigneA[k], indcol, c, col_density);
-                    
-//                     LigneA.write(std::cerr << "AFT " )<<std::endl;
+					}
+
+					if (s) {
+						// Row permutation for the sparsest row
+						for (l = k + 1; l < Ni; ++l)
+							if (((sl = LigneA[l].size ()) < s) && (sl)) {
+								s = sl;
+								p = l;
+							}
+
+						if (p != k) {
+							_F.negin(determinant);
+							Vector vtm = LigneA[k];
+							LigneA[k] = LigneA[p];
+							LigneA[p] = vtm;
+						}
+
+						//                     LigneA.write(std::cerr << "BEF, k:" << k << ", rank:" << rank << ", c:" << c)<<std::endl;
+
+						SparseFindPivot (LigneA[k], rank, c, col_density, determinant);
+						//                     LigneA.write(std::cerr << "PIV, k:" << k << ", rank:" << rank << ", c:" << c)<<std::endl;
+						if (c != -1) {
+							for (l = k + 1; l < Ni; ++l)
+								eliminate (LigneA[l], LigneA[k], rank, c, col_density);
+						}
+
+						//                     LigneA.write(std::cerr << "AFT " )<<std::endl;
 #ifdef __LINBOX_COUNT__
-                    nbelem += LigneA[k].size ();
+						nbelem += LigneA[k].size ();
 #endif
-                    LigneA[k] = Vzer;
-                }
-	    	    
-            }//for k
+						LigneA[k] = Vzer;
+					}
+
+				}//for k
+
+				SparseFindPivot (LigneA[last], rank, c, determinant);
 
-            SparseFindPivot (LigneA[last], indcol, c, determinant);
-            
 #ifdef __LINBOX_COUNT__
-            nbelem += LigneA[last].size ();
-            commentator.report (Commentator::LEVEL_NORMAL, PARTIAL_RESULT)
-                << "Left elements : " << nbelem << std::endl;
+				nbelem += LigneA[last].size ();
+				commentator.report (Commentator::LEVEL_NORMAL, PARTIAL_RESULT)
+				<< "Left elements : " << nbelem << std::endl;
 #endif
-            
-#ifdef __LINBOX_FILLIN__  
-            long sl = 0, l = 0;
-            for (; l < Ni; ++l)
-                sl += LigneA[l].size ();
-            
-            commentator.report (Commentator::LEVEL_IMPORTANT, PARTIAL_RESULT)
-                << "Fillin (" << indcol << "/" << Ni << ") = " << sl << std::endl;
+
+#ifdef __LINBOX_FILLIN__
+				long sl(0);
+				for (size_t l=0; l < Ni; ++l)
+					sl += LigneA[l].size ();
+
+				commentator.report (Commentator::LEVEL_IMPORTANT, PARTIAL_RESULT)
+				<< "Fillin (" << rank << "/" << Ni << ") = " << sl
+				<< std::endl;
 #endif
-            
-            res = indcol;
-            
-            integer card;
-            
-            if ((res < Ni) || (res < Nj))
-                _F.init(determinant,0UL);
-            _F.write(commentator.report (Commentator::LEVEL_NORMAL, PARTIAL_RESULT) 
-                     << "Determinant : ", determinant)
-                     << " over GF (" << _F.cardinality (card) << ")" << std::endl;
-            
-            commentator.report (Commentator::LEVEL_NORMAL, PARTIAL_RESULT) 
-		<< "Rank : " << res
-		<< " over GF (" << card << ")" << std::endl;
-            commentator.stop ("done", 0, "IPLR");
-            return res;
-        }
-
-        template <class _Field>
-            template <class Matrix>
-            unsigned long& GaussDomain<_Field>::NoReordering (unsigned long &res,
-                                                              Element       &determinant,
-                                                              Matrix        &LigneA,
-                                                              unsigned long  Ni,
-                                                              unsigned long  Nj)
-            {
-                    // Requirements : SLA is an array of sparse rows
-                    // IN PLACE.
-                    // Without reordering (Pivot is first non-zero in row)
-                    //     long Ni = SLA.n_row (), Nj = SLA.n_col ();
-                    //    long Ni = LigneA.n_row (), Nj = LigneA.n_col ();
-                commentator.start ("Gaussian elimination (no reordering)",
-                                   "NoRe", Ni);
-                commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION) 
-                    << "Gaussian elimination on " << Ni << " x " << Nj << " matrix" << std::endl;
-
-                typedef typename Matrix::Row          Vector;
-                typedef typename Vector::value_type   E;    
-                typedef typename Matrix::Element      Element;    
-    
+
+				integer card;
+
+				if ((rank < Ni) || (rank < Nj) || (Ni == 0) || (Nj == 0))
+					_F.init(determinant,0UL);
+
+				_F.write(commentator.report (Commentator::LEVEL_NORMAL, PARTIAL_RESULT)
+					 << "Determinant : ", determinant)
+				<< " over GF (" << _F.cardinality (card) << ")" << std::endl;
+
+				commentator.report (Commentator::LEVEL_NORMAL, PARTIAL_RESULT)
+				<< "Rank : " << rank
+				<< " over GF (" << card << ")" << std::endl;
+				commentator.stop ("done", 0, "IPLR");
+				return rank;
+			}
+
+			template <class _Field>
+			template <class Matrix, class Perm> inline unsigned long&
+			GaussDomain<_Field>::InPlaceLinearPivoting (unsigned long &rank,
+								    Element        &determinant,
+								    Matrix         &LigneA,
+								    Perm           &P,
+								    unsigned long   Ni,
+								    unsigned long   Nj) const
+			{
+				typedef typename Matrix::Row        Vector;
+				typedef typename Vector::value_type E;
+
+				// Requirements : LigneA is an array of sparse rows
+				// In place (LigneA is modified)
+				// With reordering (D is a density type. Density is allocated here)
+				//    long Ni = LigneA.n_row (), Nj = LigneA.n_col ();
+				commentator.start ("Gaussian elimination with reordering",
+						   "IPLR", Ni);
+				_F.write( commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+					  << "Gaussian elimination on " << Ni << " x " << Nj << " matrix, over: ") << std::endl;
+
 #ifdef __LINBOX_COUNT__
-                long long nbelem = 0;
+				long long nbelem = 0;
 #endif
-                Vector Vzer (0);
- 
-                _F.init(determinant,1UL);
-                long last = Ni - 1;
-                long c;
-                unsigned long indcol (0);
-    
-                for (long k = 0; k < last; ++k) {
-                    if (!(k % 1000))
-			commentator.progress (k);
-
-                    unsigned long l;
-
-                    if (!LigneA[k].empty ()) {
-			SparseFindPivot (LigneA[k], indcol, c, determinant);
-			if (c !=  -1)
-                            for (l = k + 1; l < Ni; ++l)
-                                eliminate (LigneA[l], LigneA[k], indcol, c);
-                        
+
+				_F.init(determinant,1UL);
+				// allocation of the column density
+				std::vector<size_t> col_density (Nj);
+
+				// assignment of LigneA with the domain object
+				for (unsigned long jj = 0; jj < Ni; ++jj)
+					for (unsigned long k = 0; k < LigneA[jj].size (); k++)
+						++col_density[LigneA[jj][k].first];
+
+				long last = Ni - 1;
+				long c;
+				rank = 0;
+
+#ifdef __LINBOX_OFTEN__
+				long sstep = last/40;
+				if (sstep > __LINBOX_OFTEN__) sstep = __LINBOX_OFTEN__;
+#else
+				long sstep = 1000;
+#endif
+				// Elimination steps with reordering
+				for (long k = 0; k < last; ++k) {
+					unsigned long l;
+					long p = k, s = LigneA[k].size (), sl;
+
+#ifdef __LINBOX_FILLIN__
+					if ( ! (k % 100) ) {
+#else
+						if ( ! (k % sstep) ) {
+#endif
+							commentator.progress (k);
+#ifdef __LINBOX_FILLIN__
+							for (sl = 0, l = 0; l < Ni; ++l)
+								sl += LigneA[l].size ();
+
+							commentator.report (Commentator::LEVEL_IMPORTANT, PARTIAL_RESULT)
+							<< "Fillin (" << rank << "/" << Ni << ") = "
+							<< sl
+							<< " (" << double(sl)*100.0/double(Ni-k)/double(Nj-k) << "%, "
+							<< double(sl)/double(Ni-k) << " avg)"
+							<< std::endl;
+#endif
+						}
+
+						if (s) {
+							// Row permutation for the sparsest row
+							for (l = k + 1; l < Ni; ++l)
+								if (((sl = LigneA[l].size ()) < s) && (sl)) {
+									s = sl;
+									p = l;
+								}
+
+							if (p != k) {
+								_F.negin(determinant);
+								Vector vtm = LigneA[k];
+								LigneA[k] = LigneA[p];
+								LigneA[p] = vtm;
+							}
+
+							//                     LigneA.write(std::cerr << "BEF, k:" << k << ", rank:" << rank << ", c:" << c)<<std::endl;
+
+							SparseFindPivot (LigneA[k], rank, c, col_density, determinant);
+							//                     LigneA.write(std::cerr << "PIV, k:" << k << ", rank:" << rank << ", c:" << c)<<std::endl;
+							if (c != -1) {
+								if ( c != (static_cast<long>(rank)-1) )
+									P.permute(rank-1,c);
+								for (long ll=0; ll < k ; ++ll)
+									permute( LigneA[ll], rank, c);
+
+								for (l = k + 1; l < Ni; ++l)
+									eliminate (LigneA[l], LigneA[k], rank, c, col_density);
+							}
+
+							//                     LigneA.write(std::cerr << "AFT " )<<std::endl;
 #ifdef __LINBOX_COUNT__
-			nbelem += LigneA[k].size ();
+							nbelem += LigneA[k].size ();
 #endif
-			LigneA[k] = Vzer;
-                    }
-                }
+						}
+
+					}//for k
 
-                SparseFindPivot ( LigneA[last], indcol, c, determinant);
+					SparseFindPivot (LigneA[last], rank, c, determinant);
+					if ( (c != -1) && (c != (static_cast<long>(rank)-1) ) ) {
+						P.permute(rank-1,c);
+						for (long ll=0; ll < last ; ++ll)
+							permute( LigneA[ll], rank, c);
+					}
+
+
+#ifdef __LINBOX_COUNT__
+					nbelem += LigneA[last].size ();
+					commentator.report (Commentator::LEVEL_NORMAL, PARTIAL_RESULT)
+					<< "Left elements : " << nbelem << std::endl;
+#endif
+
+#ifdef __LINBOX_FILLIN__
+					long sl(0);
+					for (size_t l=0; l < Ni; ++l)
+						sl += LigneA[l].size ();
+
+					commentator.report (Commentator::LEVEL_IMPORTANT, PARTIAL_RESULT)
+					<< "Fillin (" << rank << "/" << Ni << ") = " << sl
+					<< std::endl;
+#endif
+
+					integer card;
+
+					if ((rank < Ni) || (rank < Nj) || (Ni == 0) || (Nj == 0))
+						_F.init(determinant,0UL);
+
+					_F.write(commentator.report (Commentator::LEVEL_NORMAL, PARTIAL_RESULT)
+						 << "Determinant : ", determinant)
+					<< " over GF (" << _F.cardinality (card) << ")" << std::endl;
+
+					commentator.report (Commentator::LEVEL_NORMAL, PARTIAL_RESULT)
+					<< "Rank : " << rank
+					<< " over GF (" << card << ")" << std::endl;
+					commentator.stop ("done", 0, "IPLR");
+					return rank;
+				}
+
+				template <class _Field>
+				template <class Matrix> inline unsigned long&
+				GaussDomain<_Field>::NoReordering (unsigned long &res,
+								   Element       &determinant,
+								   Matrix        &LigneA,
+								   unsigned long  Ni,
+								   unsigned long  Nj) const
+				{
+					// Requirements : SLA is an array of sparse rows
+					// IN PLACE.
+					// Without reordering (Pivot is first non-zero in row)
+					//     long Ni = SLA.n_row (), Nj = SLA.n_col ();
+					//    long Ni = LigneA.n_row (), Nj = LigneA.n_col ();
+					commentator.start ("Gaussian elimination (no reordering)",
+							   "NoRe", Ni);
+					commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+					<< "Gaussian elimination on " << Ni << " x " << Nj << " matrix" << std::endl;
+
+					typedef typename Matrix::Row          Vector;
+					typedef typename Vector::value_type   E;
+					typedef typename Matrix::Element      Element;
+
+#ifdef __LINBOX_COUNT__
+					long long nbelem = 0;
+#endif
+					Vector Vzer (0);
+
+					_F.init(determinant,1UL);
+					long last = Ni - 1;
+					long c;
+					unsigned long indcol (0);
+
+					for (long k = 0; k < last; ++k) {
+						if (!(k % 1000))
+							commentator.progress (k);
+
+						unsigned long l;
+
+						if (!LigneA[k].empty ()) {
+							SparseFindPivot (LigneA[k], indcol, c, determinant);
+							if (c !=  -1)
+								for (l = k + 1; l < Ni; ++l)
+									eliminate (LigneA[l], LigneA[k], indcol, c);
 
 #ifdef __LINBOX_COUNT__
-                nbelem += LigneA[last].size ();
-                commentator.report (Commentator::LEVEL_NORMAL, PARTIAL_RESULT) 
-                    << "Left elements : " << nbelem << std::endl;
+							nbelem += LigneA[k].size ();
 #endif
-    
-                res = indcol;
-
-                if ((res < Ni) || (res < Nj))
-                    _F.init(determinant,0UL);
-
-                integer card;
-
-                _F.write(commentator.report (Commentator::LEVEL_NORMAL, PARTIAL_RESULT) 
-                         << "Determinant : ", determinant)
-                         << " over GF (" << _F.cardinality (card) << ")" << std::endl;
-                
-                commentator.report (Commentator::LEVEL_NORMAL, PARTIAL_RESULT) 
-                    << "Rank : " << res
-                    << " over GF (" << card << ")" << std::endl;
-                commentator.stop ("done", 0, "NoRe");
-                return res;
-            }
-
-        template <class _Field>
-            template <class Matrix>
-            unsigned long &GaussDomain<_Field>::upperin (unsigned long &res, Matrix &A)
-            {
-                    // Requirements : A is an array of rows
-                    // In place (A is modified)
-                    // Without reordering (Pivot is first non-zero in row)
-                long Ni = A.rowdim ();
-                long last = Ni - 1;
-                long c;
-                unsigned long indcol = 0;
-
-                for (long k = 0; k < last; ++k) {
-                    FindPivot (A[k], indcol, c);
-                    if (c != -1)
-			for (long l = k + 1; l < Ni; ++l)
-                            Upper (A[l], A[k], indcol, c);
-                }
-
-                FindPivot (A[last], indcol, c);
-                return res = indcol;
-            }
-
-        template <class _Field>
-            template <class Matrix>
-            unsigned long &GaussDomain<_Field>::LUin (unsigned long &res, Matrix &A)
-            {
-                    // Requirements : A is an array of rows
-                    // In place (A is modified)
-                    // Without reordering (Pivot is first non-zero in row)
-
-                long Ni = A.rowdim ();
-                long last = Ni - 1;
-                long c;
-                unsigned long indcol = 0;
-
-                for (long k = 0; k < last; ++k) {
-                    FindPivot (A[k], indcol, c);
-                    if (c != -1)
-			for (long l = k + 1; l < Ni; ++l)
-                            LU (A[l], A[k], indcol, c);
-                }
-
-                FindPivot (A[last], indcol, c);
-                return res = indcol;
-            }
-
-
-        template <class _Field>
-            template <class Matrix> unsigned long& GaussDomain<_Field>::rankin(unsigned long &rank,
-                                                                               Matrix        &A,
-                                                                               unsigned long  Ni,
-                                                                               unsigned long  Nj,
-                                                                               SparseEliminationTraits::PivotStrategy   reord) 
-            {
-                Element determinant;
-                if (reord == SparseEliminationTraits::PIVOT_NONE)
-                    return NoReordering(rank, determinant, A,  Ni, Nj);
-                else
-                    return InPlaceLinearPivoting(rank, determinant, A,  Ni, Nj);
-            }
-
-   
-        template <class _Field>
-            template <class Matrix> unsigned long& GaussDomain<_Field>::rankin(unsigned long &rank,
-                                                                               Matrix        &A,
-                                                                               SparseEliminationTraits::PivotStrategy   reord) 
-            {
-                return rankin(rank, A,  A.rowdim (), A.coldim (), reord);
-            }
-
-   
-
-        template <class _Field>
-            template <class Matrix> unsigned long& GaussDomain<_Field>::rank(unsigned long &rank,
-                                                                             const Matrix        &A,
-                                                                             SparseEliminationTraits::PivotStrategy   reord) 
-            {
-                return rank(rank, A,  A.rowdim (), A.coldim (), reord);
-            }
-
-        template <class _Field>
-            template <class Matrix> unsigned long& GaussDomain<_Field>::rank(unsigned long &rank,
-                                                                             const Matrix        &A,
-                                                                             unsigned long  Ni,
-                                                                             unsigned long  Nj,
-                                                                             SparseEliminationTraits::PivotStrategy   reord) 
-            {
-                Matrix CopyA(Ni);
-                for(unsigned long i = 0; i < Ni; ++i)
-                    CopyA[i] = A[i];
-                Element determinant;
-                if (reord == SparseEliminationTraits::PIVOT_NONE)
-                    return NoReordering(rank, determinant, CopyA,  Ni, Nj);
-                else {
-                    return InPlaceLinearPivoting(rank, determinant, CopyA,  Ni, Nj);
-                }
-    
-            }
-
-
-        template <class _Field>
-            template <class Matrix> typename GaussDomain<_Field>::Element& GaussDomain<_Field>::detin(Element        &determinant,
-                                                                                                      Matrix        &A,
-                                                                                                      unsigned long  Ni,
-                                                                                                      unsigned long  Nj,
-                                                                                                      SparseEliminationTraits::PivotStrategy   reord) 
-            {
-                unsigned long rank;
-                if (reord == SparseEliminationTraits::PIVOT_NONE)
-                    NoReordering(rank, determinant, A,  Ni, Nj);
-                else
-                    InPlaceLinearPivoting(rank, determinant, A,  Ni, Nj);
-                return determinant;
-            }
-
-   
-        template <class _Field>
-            template <class Matrix> typename GaussDomain<_Field>::Element& GaussDomain<_Field>::detin(Element &determinant,
-                                                                                                      Matrix  &A,
-                                                                                                      SparseEliminationTraits::PivotStrategy   reord) 
-            {
-                return detin(determinant, A,  A.rowdim (), A.coldim (), reord);
-            }
-
-   
-
-        template <class _Field>
-            template <class Matrix> typename GaussDomain<_Field>::Element& GaussDomain<_Field>::det(Element        &determinant,
-                                                                                           const Matrix   &A,
-                                                                                           SparseEliminationTraits::PivotStrategy   reord) 
-            {
-                return det(determinant, A,  A.rowdim (), A.coldim (), reord);
-            }
-
-        template <class _Field>
-            template <class Matrix> typename GaussDomain<_Field>::Element& GaussDomain<_Field>::det(Element       &determinant,
-                                                                                           const Matrix  &A,
-                                                                                           unsigned long  Ni,
-                                                                                           unsigned long  Nj,
-                                                                                           SparseEliminationTraits::PivotStrategy   reord) 
-            {
-                Matrix CopyA(Ni);
-                for(unsigned long i = 0; i < Ni; ++i)
-                    CopyA[i] = A[i];
-                unsigned long rank;
-                if (reord == SparseEliminationTraits::PIVOT_NONE)
-                    NoReordering(rank, determinant, CopyA,  Ni, Nj);
-                else {
-                    InPlaceLinearPivoting(rank, determinant, CopyA,  Ni, Nj);
-                }
-                return determinant;
-            }
-
-
-
-
-    } // namespace LinBox
-
-#endif // __GAUSS_INL
+							LigneA[k] = Vzer;
+						}
+					}
+
+					SparseFindPivot ( LigneA[last], indcol, c, determinant);
+
+#ifdef __LINBOX_COUNT__
+					nbelem += LigneA[last].size ();
+					commentator.report (Commentator::LEVEL_NORMAL, PARTIAL_RESULT)
+					<< "Left elements : " << nbelem << std::endl;
+#endif
+
+					res = indcol;
+
+					if ((res < Ni) || (res < Nj))
+						if ((res < Ni) || (res < Nj) || (Ni == 0) || (Nj == 0))
+							_F.init(determinant,0UL);
+
+					integer card;
+
+					_F.write(commentator.report (Commentator::LEVEL_NORMAL, PARTIAL_RESULT)
+						 << "Determinant : ", determinant)
+					<< " over GF (" << _F.cardinality (card) << ")" << std::endl;
+
+					commentator.report (Commentator::LEVEL_NORMAL, PARTIAL_RESULT)
+					<< "Rank : " << res
+					<< " over GF (" << card << ")" << std::endl;
+					commentator.stop ("done", 0, "NoRe");
+					return res;
+				}
+
+
+				template <class _Field>
+				template<class Vector> inline void
+				GaussDomain<_Field>::Upper (Vector        &lignecur,
+							    const Vector  &lignepivot,
+							    unsigned long  indcol,
+							    long  indpermut) const
+				{
+					static typename _Field::Element zero = _F.init(zero);
+
+					long n = lignecur.size () ;
+					long k = indcol - 1 ;
+
+					// permutation if one has been performed to compute the pivot
+					if (indpermut != k) {
+						typename Vector::value_type tmp = lignecur[k];
+						lignecur[k] = lignecur[indpermut];
+						lignecur[indpermut] = tmp;
+					}
+
+					typename Vector::value_type headcoeff;
+					_F.divin (_F.neg (headcoeff, lignecur[k]), lignepivot[k]);
+
+
+
+					// LU in place
+					_F.assign (lignecur[k], zero);
+					for (long j = k; ++j < n;)
+						_F.axpyin (lignecur[j], headcoeff, lignepivot[j]) ;
+				}
+
+				template <class _Field>
+				template <class Vector> inline void
+				GaussDomain<_Field>::LU (Vector        &lignecur,
+							 const Vector  &lignepivot,
+							 unsigned long  indcol,
+							 long  indpermut) const
+				{
+					long n = lignecur.size ();
+					long k = indcol - 1;
+
+					// permutation if one has been performed to compute the pivot
+					if (indpermut != k) {
+						typename Vector::value_type tmp = lignecur[k];
+						lignecur[k] = lignecur[indpermut];
+						lignecur[indpermut] = tmp;
+					}
+
+					typename Vector::value_type headcoeff;
+					// LU in place
+					_F.div (headcoeff, lignecur[k], lignepivot[k]);
+					_F.assign (lignecur[k], headcoeff);
+					_F.negin (headcoeff);
+					for (long j = k; ++j < n;)
+						_F.axpyin (lignecur[j],headcoeff,lignepivot[j]);
+				}
+
+
+				template <class _Field>
+				template <class Matrix> inline unsigned long &
+				GaussDomain<_Field>::upperin (unsigned long &res, Matrix &A) const
+				{
+					// Requirements : A is an array of rows
+					// In place (A is modified)
+					// Without reordering (Pivot is first non-zero in row)
+					long Ni = A.rowdim ();
+					long last = Ni - 1;
+					long c;
+					unsigned long indcol = 0;
+
+					for (long k = 0; k < last; ++k) {
+						FindPivot (A[k], indcol, c);
+						if (c != -1)
+							for (long l = k + 1; l < Ni; ++l)
+								Upper (A[l], A[k], indcol, c);
+					}
+
+					FindPivot (A[last], indcol, c);
+					return res = indcol;
+				}
+
+				template <class _Field>
+				template <class Matrix> inline unsigned long &
+				GaussDomain<_Field>::LUin (unsigned long &res, Matrix &A) const
+				{
+					// Requirements : A is an array of rows
+					// In place (A is modified)
+					// Without reordering (Pivot is first non-zero in row)
+
+					long Ni = A.rowdim ();
+					long last = Ni - 1;
+					long c;
+					unsigned long indcol = 0;
+
+					for (long k = 0; k < last; ++k) {
+						FindPivot (A[k], indcol, c);
+						if (c != -1)
+							for (long l = k + 1; l < Ni; ++l)
+								LU (A[l], A[k], indcol, c);
+					}
+
+					FindPivot (A[last], indcol, c);
+					return res = indcol;
+				}
+
+
+			} // namespace LinBox
+
+#endif // __LINBOX_gauss_INL
diff --git a/linbox/algorithms/hybrid-det.h b/linbox/algorithms/hybrid-det.h
index 2617975..6dc3057 100644
--- a/linbox/algorithms/hybrid-det.h
+++ b/linbox/algorithms/hybrid-det.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* linbox/algorithms/hybrid-det.h
  * Copyright (C) 2005 Anna Urbanska
  *
@@ -20,8 +21,9 @@
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  */
-#ifndef __HYBRID_DET_H
-#define __HYBRID_DET_H
+
+#ifndef __LINBOX_hybrid_det_H
+#define __LINBOX_hybrid_det_H
 
 //#include "linbox/blackbox/diagonal.h"
 //#include "linbox/blackbox/compose.h"
@@ -61,260 +63,287 @@
 
 #include "linbox/solutions/det.h"
 
-namespace LinBox {
-   
-        template <class Blackbox, class MyMethod>
-        struct IntegerModularDetReduced {      
-        private:
-            
-            const Blackbox &A;
-            const MyMethod &M;
-                /* contains the factor by which to divide det */
-            integer beta;
-
-            size_t factor;
-            size_t iter_count;
-            size_t iter_count2;
-            typename Vector<PID_integer>::Dense moduli;
-
-        public:
-
-            typename Vector<PID_integer>::Dense primes;
-
-            size_t iterations() {
-                return iter_count;
-            }
-            size_t iterations2() {
-                return iter_count2;
-            }
-
-
-
-                //          int iter_count;
-                //          int iter_count2;
-                //          Vector <PID_integer>:: Dense moduli;
-                //          Vector <PID_integer>:: Dense primes;
-
-            IntegerModularDetReduced(const Blackbox& b, const MyMethod& n, const integer& divisor, const size_t& f)
-                    : A(b), M(n), beta(divisor), factor(f) {
-                moduli.resize(factor);
-                primes.resize(factor);
-                iter_count = 0;
-                iter_count2 = 0;
-
-            }
-
-            template<typename Field>
-            typename Field::Element& operator()(typename Field::Element& d, const Field& F) {
-
-                if (beta > 1) {
-                    if (iter_count2 < factor) {
-                        Field D(primes[iter_count2]);
-                        typename Field::Element pbeta;
-                        typename Field::Element kbeta;
-                        typename Field::Element current_moduli;
-                        D.init(pbeta, beta);
-                        D.init(current_moduli, moduli[iter_count2]);
-                        D.div(kbeta, current_moduli,pbeta);
-                        ++this->iter_count2;
-                        return d=kbeta;
-                    }
-                }
-
-                typedef typename Blackbox::template rebind<Field>::other FBlackbox;
-                FBlackbox * Ap;
-                MatrixHom::map(Ap, A, F);
-                detin( d, *Ap, M);
-
-                if (beta > 1) {
-                    typename Field::Element y;
-                    F.init(y,beta);
-                    F.div(d,d,y);
-                }
-
-                delete Ap;
-
-                if (iter_count < factor) {
-                    moduli[iter_count] = d;
-                }
-                ++this->iter_count;
-
-                return d;
-            }
-
-            void Beta(Integer& b) { beta = b; iter_count2=0;}
-
-        };
-
-        /** \brief Compute the determinant of A over the integers
-         *
-         * The determinant of a linear operator A, represented as a
-         * black box, is computed over the integers.
-         *
-         * This variant is a hybrid between Last Invariant Factor and Chinese Remaindering
-         * It performs several determinants mod primes
-         * Then switches to the LIF method, producing a factor of det.
-         * It then comes back to the CRA if necessary to compute
-         * the remaining (usually small) factor of the determinant.
-         *
-         * @param d Field element into which to store the result
-         * @param A Black box of which to compute the determinant
-         * @param tag explicit over the integers
-         * @param M may be a Method::BlasElimination (default) or a Method::Wiedemann.
-         \ingroup solutions
-        */
-        template <class Blackbox, class MyMethod>
-        typename Blackbox::Field::Element & lif_cra_det (typename Blackbox::Field::Element         &d,
-                                                        const Blackbox                            &A,
-                                                        const RingCategories::IntegerTag          &tag,
-                                                        const MyMethod                            &M)
-            {
-                //commentator.setReportStream(std::cout);
-                typedef Modular<double> myModular;
-                typedef typename Blackbox::Field Integers;
-                typedef typename Integers::Element Integer;
-
-                commentator.start ("Integer Determinant - hybrid version ", "det");
-                size_t myfactor=5;
-                size_t early_counter=0;
-
-            	//double a = 0.0;//0.28;//0.0013//if time(lif)/time(10lu) < a * log(lif) then calculate bonus
-
-                Integer lif = 1;
-                Integer bonus = 1;
-                Integer beta = 1;
-                d=1;
-		
+// #define _LB_H_DET_TIMING
+
+namespace LinBox
+{
+
+	template <class Blackbox, class MyMethod>
+	struct IntegerModularDetReduced {
+	private:
+
+		const Blackbox &A;
+		const MyMethod &M;
+		/* contains the factor by which to divide det */
+		integer beta;
+
+		size_t factor;
+		size_t iter_count;
+		size_t iter_count2;
+		typename Vector<PID_integer>::Dense moduli;
+
+	public:
+
+		typename Vector<PID_integer>::Dense primes;
+
+		size_t iterations()
+		{
+			return iter_count;
+		}
+
+		size_t iterations2()
+		{
+			return iter_count2;
+		}
+
+
+#if 0
+		int iter_count;
+		int iter_count2;
+		Vector <PID_integer>:: Dense moduli;
+		Vector <PID_integer>:: Dense primes;
+#endif
+
+		IntegerModularDetReduced(const Blackbox& b, const MyMethod& n, const integer& divisor, const size_t& f) :
+			A(b), M(n), beta(divisor), factor(f)
+		{
+			moduli.resize(factor);
+			primes.resize(factor);
+			iter_count = 0;
+			iter_count2 = 0;
+
+		}
+
+		template<typename Field>
+		typename Field::Element& operator()(typename Field::Element& d, const Field& F)
+		{
+
+			if (beta > 1) {
+				if (iter_count2 < factor) {
+					Field D(primes[iter_count2]);
+					typename Field::Element pbeta;
+					typename Field::Element kbeta;
+					typename Field::Element current_moduli;
+					D.init(pbeta, beta);
+					D.init(current_moduli, moduli[iter_count2]);
+					D.div(kbeta, current_moduli,pbeta);
+					++this->iter_count2;
+					return d=kbeta;
+				}
+			}
+
+			typedef typename Blackbox::template rebind<Field>::other FBlackbox;
+			FBlackbox Ap(A,F);
+			detin( d, Ap, M);
+
+			if (beta > 1) {
+				typename Field::Element y;
+				F.init(y,beta);
+				F.div(d,d,y);
+			}
+
+			if (iter_count < factor) {
+				moduli[iter_count] = d;
+			}
+			++this->iter_count;
+
+			return d;
+		}
+
+		void Beta(Integer& b) { beta = b; iter_count2=0;}
+
+	};
+
+	/** \brief Compute the determinant of A over the integers
+	 *
+	 * The determinant of a linear operator A, represented as a
+	 * black box, is computed over the integers.
+	 *
+	 * This variant is a hybrid between Last Invariant Factor and Chinese Remaindering
+	 * It performs several determinants mod primes
+	 * Then switches to the LIF method, producing a factor of det.
+	 * It then comes back to the CRA if necessary to compute
+	 * the remaining (usually small) factor of the determinant.
+	 *
+	 * @param d Field element into which to store the result
+	 * @param A Black box of which to compute the determinant
+	 * @param tag explicit over the integers
+	 * @param M may be a Method::BlasElimination (default) or a Method::Wiedemann.
+	 \ingroup solutions
+	 */
+	template <class Blackbox, class MyMethod>
+	typename Blackbox::Field::Element & lif_cra_det (typename Blackbox::Field::Element         &d,
+							 const Blackbox                            &A,
+							 const RingCategories::IntegerTag          &tag,
+							 const MyMethod                            &M)
+	{
+		//commentator.setReportStream(std::cout);
+		typedef Modular<double> myModular;
+		typedef typename Blackbox::Field Integers;
+		typedef typename Integers::Element Integer;
+
+		commentator.start ("Integer Determinant - hybrid version ", "det");
+		size_t myfactor=5;
+		size_t early_counter=0;
+
+		//double a = 0.0;//0.28;//0.0013//if time(lif)/time(10lu) < a * log(lif) then calculate bonus
+
+		Integer lif = 1;
+		Integer bonus = 1;
+		Integer beta = 1;
+		d=1;
+
 		double p_size = 26-(int)ceil(log((double)A.rowdim())*0.7213475205);
 
-                RandomPrimeIterator genprime( (Integer)p_size );
+		RandomPrimeIterator genprime( (Integer)p_size );
 		//cout << "prime size: " << p_size << "\n";
-                EarlySingleCRA<myModular> cra(4UL);
-                IntegerModularDetReduced<Blackbox,MyMethod> iteration(A, M, beta,myfactor);
+		EarlySingleCRA<myModular> cra(4UL);
+		IntegerModularDetReduced<Blackbox,MyMethod> iteration(A, M, beta,myfactor);
 
-                //if (A.rowdim() < 200 ) {
-                //    cra(d,iteration,genprime);
-                //    commentator.stop ( "first step", NULL, "det");
-                //    commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-                //        << "Iterations done " << iteration.iterations() << "\n";
-                //} else { 
-                Integer res;
+#if 0
+		if (A.rowdim() < 200 ) {
+			cra(d,iteration,genprime);
+			commentator.stop ( "first step", NULL, "det");
+			commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+			<< "Iterations done " << iteration.iterations() << "\n";
+		}
+		else {}
+#endif
+		Integer res;
 
+#ifdef _LB_H_DET_TIMING
 		Timer BT;
 		double time1, time2;
 		BT.start();
-		
-                while ( early_counter < myfactor && !cra.terminated() ) {
+#endif
+                ++genprime;
+                myModular D(*genprime);
+                iteration.primes[early_counter] = *genprime;
+                myModular::Element r;
+                D.init(r,0);
+                cra.initialize( D, iteration(r, D));
+                ++early_counter;
+
+		while ( early_counter < myfactor && !cra.terminated() ) {
 			++genprime;
 			while (cra.noncoprime(*genprime)) ++genprime;
-                        myModular D(*genprime);
-                        iteration.primes[early_counter] = *genprime;
-                            //		prime(p, early_counter);
-                        myModular::Element r;
-                        D.init(r,0);
-                        cra.progress( D, iteration(r, D));
-                        ++early_counter; 
-                }
-		
+			myModular D(*genprime);
+			iteration.primes[early_counter] = *genprime;
+			// prime(p, early_counter);
+			myModular::Element r;
+			D.init(r,0);
+			cra.progress( D, iteration(r, D));
+			++early_counter;
+		}
+
+#ifdef _LB_H_DET_TIMING
 		BT.stop();
 		time1 = BT.usertime()/myfactor;
 		if (time1 < 0) time1 = 0;
-                cra.result(res);
+#endif
+		cra.result(res);
 
-                if (early_counter < myfactor) {
-                    /* determinant found */
+		if (early_counter < myfactor) {
+			/* determinant found */
 			commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION) << myfactor << "\n";
 			commentator.stop ( "first step", NULL, "det");
-                        commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-                            << "Iterations done " << iteration.iterations()<< "\n";
-                        return d=res;
-                }
+			commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+			<< "Iterations done " << iteration.iterations()<< "\n";
+			return d=res;
+		}
 		commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION) << "no very early termination \n";
-		/* turn to LU when matrix size small - not to be used at the moment */ 
-		//if (A.rowdim() < 50 ) {
-                //while ( !cra.terminated() ) {
-		//	genprime.randomPrime(p);
-                //        myModular D(p);
-                //        iteration.primes[early_counter] = p;
-                            //		prime(p, early_counter);
-                //        myModular::Element r;
-                //        D.init(r,0);
-                //        cra.progress( D, iteration(r, D));
-                //        ++early_counter; 
-                //}
-		//commentator.stop ( "zero step", NULL, "det");
-		//commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-                //        << "Iterations done " << iteration.iterations() << "\n";
-		//return d;
-		//}
-		
-                //RandomPrime genprime1( 26-(int)ceil(log((double)A.rowdim())*0.7213475205));
-                //Integers ZZ;
-                //RationalSolver < Integers , myModular, RandomPrime, DixonTraits > RSolver(A. field(), genprime); 
+		/* turn to LU when matrix size small - not to be used at the moment */
+#if 0
+		if (A.rowdim() < 50 ) {
+			while ( !cra.terminated() ) {
+				genprime.randomPrime(p);
+				myModular D(p);
+				iteration.primes[early_counter] = p;
+				//		prime(p, early_counter);
+				myModular::Element r;
+				D.init(r,0);
+				cra.progress( D, iteration(r, D));
+				++early_counter;
+			}
+			commentator.stop ( "zero step", NULL, "det");
+			commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+			<< "Iterations done " << iteration.iterations() << "\n";
+			return d;
+		}
+
+		RandomPrime genprime1( 26-(int)ceil(log((double)A.rowdim())*0.7213475205));
+		Integers ZZ;
+		RationalSolver < Integers , myModular, RandomPrime, DixonTraits > RSolver(A. field(), genprime);
+#endif
 		RationalSolver < Integers , myModular, RandomPrimeIterator, DixonTraits > RSolver;
-		
+
 		typename Vector<Integers>:: Dense r_num1 (A. coldim());
-		
-                LastInvariantFactor < Integers ,RationalSolver < Integers, myModular, RandomPrimeIterator, DixonTraits > >  LIF(RSolver);
 
+		LastInvariantFactor < Integers ,RationalSolver < Integers, myModular, RandomPrimeIterator, DixonTraits > >  LIF(RSolver);
+#ifdef _LB_H_DET_TIMING
 		BT.start();
+#endif
 		if (LIF.lastInvariantFactor1(lif, r_num1, A)==0) {
-			//if (lif==0) {
+			//if (lif==0)
 			d = 0;
 			commentator.stop ("is 0", NULL, "det");
 			return d;
 		}
+#ifdef _LB_H_DET_TIMING
 		BT.stop();
 		time2 = BT.usertime();
 		if (time2 < 0) time2 =0;
+#endif
 
 		//commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-                //            << "5 LU time: " << time1 << " LIF time: " << time2 << ")\n";
+		//            << "5 LU time: " << time1 << " LIF time: " << time2 << ")\n";
 		commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION) << "lif calculated\n";
-                //LIF.lastInvariantFactor_Bonus(lif, bonus, A);	
-	
-                //if (lif==0) {
-		//	d = 0;
-		//      commentator.stop ("done", NULL, "det");
-                //        return d;
-		//}
- 
-                //if (bonus == 1) {
-		//	d = lif;
-                //        commentator.stop ("done", NULL, "det");
-                //        return d;
-                //}
-                        
-                beta = lif*bonus;
-                iteration.Beta(beta);
-
-                //RandomPrime genprime2( 26-(int)ceil(log((double)A.rowdim())*0.7213475205)); 
-                EarlySingleCRA< Modular<double> > cra2(4UL);
-                Integer k = 1;
-
-                early_counter = 0;
-                while ( early_counter < myfactor && !cra2.terminated() ) {
-                        myModular D(iteration.primes[early_counter]);
-                        myModular::Element r;
-                        D.init(r,0);
-                        cra2.progress( D, iteration(r, D) );
-                        ++early_counter; 
-                }
-
-                if (early_counter < myfactor) {
-                            /* determinant found */
+#if 0
+		LIF.lastInvariantFactor_Bonus(lif, bonus, A);
+
+		if (lif==0) {
+			d = 0;
+			commentator.stop ("done", NULL, "det");
+			return d;
+		}
+
+		if (bonus == 1) {
+			d = lif;
+			commentator.stop ("done", NULL, "det");
+			return d;
+		}
+#endif
+
+		beta = lif*bonus;
+		iteration.Beta(beta);
+
+		//RandomPrime genprime2( 26-(int)ceil(log((double)A.rowdim())*0.7213475205));
+		EarlySingleCRA< Modular<double> > cra2(4UL);
+		Integer k = 1;
+
+		early_counter = 0;
+		while ( early_counter < myfactor && !cra2.terminated() ) {
+			myModular D(iteration.primes[early_counter]);
+			myModular::Element r;
+			D.init(r,0);
+			cra2.progress( D, iteration(r, D) );
+			++early_counter;
+		}
+
+		if (early_counter < myfactor) {
+			/* determinant found */
 			k = cra2.result(res);
 			commentator.stop ("second step ", NULL, "det");
 			commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-                            << "Iterations done " << iteration.iterations()<< "(" << iteration.iterations2() << ")\n";
-			
-                }
-                else  if (0/* time2 < a*log2(lif)*time1/p_size*/) {
+			<< "Iterations done " << iteration.iterations()<< "(" << iteration.iterations2() << ")\n";
+
+		}
+		else  if (0/* time2 < a*log2(lif)*time1/p_size*/) {
 			typename Vector<Integers>:: Dense r_num2 (A. coldim());
 			Integer lif2=1;
 			LIF.lastInvariantFactor1(lif2,r_num2,A);
 			LIF.bonus(bonus,lif, lif2, r_num1,r_num2);
-			
+
 			//lif2 = lif;
 			if ((bonus > 1) || (lif2 != lif)) {
 				//cout << "lif: " <<lif <<",\n     "<< lif2<< "przed\n";
@@ -326,7 +355,7 @@ namespace LinBox {
 				//iteration.Moduli(moduli);
 				//iteration.Primes(primes);
 				k=1;
-			        EarlySingleCRA< Modular<double> > cra3(4UL);
+				EarlySingleCRA< Modular<double> > cra3(4UL);
 
 				early_counter = 0;
 				while ( (early_counter < myfactor) && (!cra3.terminated() )) {
@@ -343,10 +372,11 @@ namespace LinBox {
 					cra3.result(k);
 					commentator.stop ("third step - recalc", NULL, "det");
 					commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-						<< "Iterations done " << iteration.iterations()<<"(" << iteration.iterations2() << ")\n";
-						//<< "bonus size " << log2(bonus) << "\n";
-					
-				} else {
+					<< "Iterations done " << iteration.iterations()<<"(" << iteration.iterations2() << ")\n";
+					//<< "bonus size " << log2(bonus) << "\n";
+
+				}
+				else {
 					/* enter the cra loop */
 					//cra3(k,iteration, genprime);
 					while (!cra3.terminated()) {
@@ -355,15 +385,16 @@ namespace LinBox {
 						myModular D(*genprime);
 						myModular::Element r;
 						D.init(r,0);
-						cra3.progress( D, iteration(r, D));			
+						cra3.progress( D, iteration(r, D));
 					}
 					cra3.result(k);
-				       	commentator.stop ("third step, bonus > 1", NULL, "det");
+					commentator.stop ("third step, bonus > 1", NULL, "det");
 					commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-						<< "Iterations done " << iteration.iterations()<< "(" << iteration.iterations2() << ")\n";
-                                                //<< "bonus size " << log2(bonus) << "\n";
+					<< "Iterations done " << iteration.iterations()<< "(" << iteration.iterations2() << ")\n";
+					//<< "bonus size " << log2(bonus) << "\n";
 				}
-			} else {
+			}
+			else {
 				//cra2(k,iteration, genprime);
 				while (!cra2.terminated()) {
 					++genprime;
@@ -376,302 +407,325 @@ namespace LinBox {
 				cra2.result(k);
 				commentator.stop ("third step, bonus = 1", NULL, "det");
 				commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-					<< "Iterations done " << iteration.iterations()<< "(" << iteration.iterations2() << ")\n";		
+				<< "Iterations done " << iteration.iterations()<< "(" << iteration.iterations2() << ")\n";
+			}
+		}
+		else {
+			while (!cra2.terminated()) {
+				++genprime;
+				while (cra2.noncoprime(*genprime)) ++genprime;
+				myModular D(*genprime);
+				myModular::Element r;
+				D.init(r,0);
+				cra2.progress( D, iteration(r, D));
 			}
-		} else {
+			cra2.result(k);
+			commentator.stop ("second step+", NULL, "det");
+			commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+			<< "Iterations done " << iteration.iterations()<< "(" << iteration.iterations2() << ")\n";
+
+			/* enter the cra loop */
+			//cra2(k,iteration, genprime);
+		}
+
+		//commentator.stop ("second step", NULL, "det");
+		//commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+		//        << "Iterations done " << iteration.iterations() << "("
+		//        << iteration.iterations2() << " )\n";
+		d = k*beta;
+
+		Integer tmp;
+
+#ifdef _LB_H_DET_TIMING
+		commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+		<< "1 LU time: " << time1 << " LIF time: " << time2 << ")\n";
+#endif
+		commentator.report(Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+		<< "det/lif " << k<< "\n";
+		//commentator.report(Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+		//	<< "determinant size " << Integers::log2(tmp,abs(d))<< " lif size "<< Integers::log2(tmp,beta) << "\n";
+
+		return d ;
+
+	}
+
+#if 0
+	template <class Integers, class MyMethod>
+	typename Integers::Element & lif_cra_det (typename Integers::Element                &d,
+						  const SparseMatrix<Integers>              &A,
+						  const RingCategories::IntegerTag          &tag,
+						  const MyMethod                            &M)
+	{
+
+		//commentator.setReportStream(std::cout);
+		typedef Modular<double> myModular;
+		//typedef PID_integer Integers;
+		typedef typename Integers::Element Integer;
+
+		commentator.start ("Integer Determinant - hybrid version for sparse matrices", "det");
+		size_t myfactor=5;
+		size_t early_counter=0;
+
+		//double a = 0.0;//0.28;//0.0013i			//if time(lif)/time(10lu) < a * log(lif) then calculate bonus
+
+		Integer lif = 1;
+		Integer bonus = 1;
+		Integer beta = 1;
+		d=1;
+
+		double p_size = 26-(int)ceil(log((double)A.rowdim())*0.7213475205);
+
+		RandomPrime genprime( (Integer)p_size );
+		commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION) << "prime size: " << p_size << "\n";
+		ChineseRemainder< myModular > cra(3UL);
+		IntegerModularDetReduced<SparseMatrix<Integers >,MyMethod> iteration(A, M, beta,myfactor);
+#if 0
+		if (A.rowdim() < 200 ) {
+			cra(d,iteration,genprime);
+			commentator.stop ( "first step", NULL, "det");
+			commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+			<< "Iterations done " << iteration.iterations() << "\n";
+		}
+		else
+#endif
+			Integer p;
+		Integer res;
+
+		Timer BT;
+		double time1, time2;
+		BT.start();
+
+                genprime.randomPrime(p);
+                myModular D(p);
+                iteration.primes[early_counter] = p;
+                myModular::Element r;
+                D.init(r,0);
+                cra.initialize( D, iteration(r, D));
+                ++early_counter;
+
+		while ( early_counter < myfactor && !cra.terminated() ) {
+			genprime.randomPrime(p);
+			while (cra.noncoprime(p)) genprime.randomPrime(p);
+			myModular D(p);
+			iteration.primes[early_counter] = p;
+			//          prime(p, early_counter);
+			myModular::Element r;
+			D.init(r,0);
+			cra.progress( D, iteration(r, D));
+			++early_counter;
+		}
+
+		BT.stop();
+		time1 = BT.usertime()/myfactor;
+		if (time1 < 0) time1 = 0;
+		cra.result(res);
+
+		if (early_counter < myfactor) {
+			//determinant found
+			commentator.stop ( "first step", NULL, "det");
+			commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+			<< "Iterations done " << iteration.iterations()<< "\n";
+			return d=res;
+		}
+#if 0
+		cout << "no very early termination \n";
+		turn to LU when matrix size small - not to be used at the moment
+		if (A.rowdim() < 50 ) {
+			while ( !cra.terminated() ) {
+				genprime.randomPrime(p);
+				myModular D(p);
+				iteration.primes[early_counter] = p;
+				//          prime(p, early_counter);
+				myModular::Element r;
+				D.init(r,0);
+				cra.progress( D, iteration(r, D));
+				++early_counter;
+			}
+			commentator.stop ( "zero step", NULL, "det");
+			commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+			<< "Iterations done " << iteration.iterations() << "\n";
+			return d;
+		}
+
+		RandomPrime genprime1( 26-(int)ceil(log((double)A.rowdim())*0.7213475205));
+		Integers ZZ;
+#endif
+		typedef RationalSolver < Integers , myModular, RandomPrime, BlockHankelTraits > Solver;
+		Solver RSolver(A. field(), genprime);
+
+		typename Vector<Integers>:: Dense r_num1 (A. coldim());
+
+		LastInvariantFactor < Integers ,Solver >  LIF(RSolver);
+
+		BT.start();
+		if (LIF.lastInvariantFactor1(lif, r_num1, A)==0) {
+			//if (lif==0)
+			d = 0;
+			commentator.stop ("is 0", NULL, "det");
+			return d;
+		}
+		BT.stop();
+		time2 = BT.usertime();
+		if (time2 < 0) time2 =0;
+#if 0
+		commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+		<< "5 LU time: " << time1 << " LIF time: " << time2 << ")\n";
+		cout << "lif calculated\n";
+		LIF.lastInvariantFactor_Bonus(lif, bonus, A);
+
+		if (lif==0) {
+			d = 0;
+			commentator.stop ("done", NULL, "det");
+			return d;
+		}
+
+		if (bonus == 1) {
+			d = lif;
+			commentator.stop ("done", NULL, "det");
+			return d;
+		}
+#endif
+		beta = lif*bonus;
+		iteration.Beta(beta);
+
+		//RandomPrime genprime2( 26-(int)ceil(log((double)A.rowdim())*0.7213475205));
+		ChineseRemainder< Modular<double> > cra2(3UL);
+		Integer k = 1;
+
+		early_counter = 0;
+		while ( early_counter < myfactor && !cra2.terminated() ) {
+			myModular D(iteration.primes[early_counter]);
+			myModular::Element r;
+			D.init(r,0);
+			cra2.progress( D, iteration(r, D));
+			++early_counter;
+		}
+
+		if (early_counter < myfactor) {
+			// determinant found
+			k = cra2.result(res);
+			commentator.stop ("second step ", NULL, "det");
+			commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+			<< "Iterations done " << iteration.iterations()<< "(" << iteration.iterations2() << ")\n";
+
+		}
+		else  if (0) { //time2 < a*log2(lif)*time1/p_size)
+			typename Vector<Integers>:: Dense r_num2 (A. coldim());
+			Integer lif2=1;
+			LIF.lastInvariantFactor1(lif2,r_num2,A);
+			LIF.bonus(bonus,lif, lif2, r_num1,r_num2);
+
+			//lif2 = lif;
+			if ((bonus > 1) || (lif2 != lif)) {
+				//cout << "lif: " <<lif <<",\n     "<< lif2<< "przed\n";
+				lif = lcm(lif, lif2);
+				//cout << "lif: " <<lif << "po";
+				beta=lif*bonus;
+				iteration.Beta(beta);
+				//iteration.Restart2() // included in Beta();
+				//iteration.Moduli(moduli);
+				//iteration.Primes(primes);
+				k=1;
+				ChineseRemainder< Modular<double> > cra3(3UL);
+
+				early_counter = 0;
+				while ( (early_counter < myfactor) && (!cra3.terminated() )) {
+					myModular D(iteration.primes[early_counter]);
+					myModular::Element r;
+					D.init(r,0);
+					cra3.progress( D, iteration(r, D));
+					++early_counter;
+					//iteration.Inc();
+				}
+
+				if (early_counter < myfactor) {
+					// determinant found based on the initial LU
+					cra3.result(k);
+					commentator.stop ("third step - recalc", NULL, "det");
+					commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+					<< "Iterations done " << iteration.iterations()<<"(" << iteration.iterations2() << ")\n";
+					//<< "bonus size " << log2(bonus) << "\n";
+
+				}
+				else {
+					// enter the cra loop
+					//cra3(k,iteration, genprime);
+					while (!cra3.terminated()) {
+						genprime.randomPrime(p);
+						while (cra3.noncoprime(p)) genprime.randomPrime(p);
+						myModular D(p);
+						myModular::Element r;
+						D.init(r,0);
+						cra3.progress( D, iteration(r, D));
+					}
+					cra3.result(k);
+					commentator.stop ("third step, bonus > 1", NULL, "det");
+					commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+					<< "Iterations done " << iteration.iterations()<< "(" << iteration.iterations2() << ")\n";
+					//<< "bonus size " << log2(bonus) << "\n";
+				}
+			}
+			else {
+				//cra2(k,iteration, genprime);
 				while (!cra2.terminated()) {
-					++genprime;
-					while (cra2.noncoprime(*genprime)) ++genprime;
-					myModular D(*genprime);
+					genprime.randomPrime(p);
+					while (cra2.noncoprime(p)) genprime.randomPrime(p);
+					myModular D(p);
 					myModular::Element r;
 					D.init(r,0);
 					cra2.progress( D, iteration(r, D));
 				}
 				cra2.result(k);
-				commentator.stop ("second step+", NULL, "det");
+				commentator.stop ("third step, bonus = 1", NULL, "det");
 				commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-					<< "Iterations done " << iteration.iterations()<< "(" << iteration.iterations2() << ")\n";
+				<< "Iterations done " << iteration.iterations()<< "(" << iteration.iterations2() << ")\n";
+			}
+		}
+		else {
+			while (!cra2.terminated()) {
+				genprime.randomPrime(p);
+				while (cra2.noncoprime(p)) genprime.randomPrime(p);
+				myModular D(p);
+				myModular::Element r;
+				D.init(r,0);
+				cra2.progress( D, iteration(r, D));
+			}
+			cra2.result(k);
+			commentator.stop ("second step+", NULL, "det");
+			commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+			<< "Iterations done " << iteration.iterations()<< "(" << iteration.iterations2() << ")\n";
 
-                           /* enter the cra loop */
-                        //cra2(k,iteration, genprime);
-                }
+			// enter the cra loop
+			//cra2(k,iteration, genprime);
+		}
 
-                //commentator.stop ("second step", NULL, "det");
-                //commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-                //        << "Iterations done " << iteration.iterations() << "(" 
-                //        << iteration.iterations2() << " )\n";
+		//commentator.stop ("second step", NULL, "det");
+		//commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+		//        << "Iterations done " << iteration.iterations() << "("
+		//        << iteration.iterations2() << " )\n";
 		d = k*beta;
-		
+
 		Integer tmp;
-		
-                commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-                            << "1 LU time: " << time1 << " LIF time: " << time2 << ")\n";
+
+		commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+		<< "1 LU time: " << time1 << " LIF time: " << time2 << ")\n";
 		commentator.report(Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-                        << "det/lif " << k<< "\n";
+		<< "det/lif " << k<< "\n";
 		//commentator.report(Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-		//	<< "determinant size " << Integers::log2(tmp,abs(d))<< " lif size "<< Integers::log2(tmp,beta) << "\n";
+		//        << "determinant size " << Integers::log2(tmp,abs(d))<< " lif size "<< Integers::log2(tmp,beta) << "\n";
 
 		return d ;
-	
-	    }
-/*   
-        template <class Integers, class MyMethod>
-        typename Integers::Element & lif_cra_det (typename Integers::Element         &d,
-                                                        const SparseMatrix<Integers >                            &A,
-                                                        const RingCategories::IntegerTag          &tag,
-                                                        const MyMethod                            &M)
-            {
-
-                //commentator.setReportStream(std::cout);
-                typedef Modular<double> myModular;
-                //typedef PID_integer Integers;
-                typedef typename Integers::Element Integer;
-
-                commentator.start ("Integer Determinant - hybrid version for sparse matrices", "det");
-                size_t myfactor=5;
-                size_t early_counter=0;
-
-                //double a = 0.0;//0.28;//0.0013i			//if time(lif)/time(10lu) < a * log(lif) then calculate bonus
-
-                Integer lif = 1;
-                Integer bonus = 1;
-                Integer beta = 1;
-                d=1;
-
-                double p_size = 26-(int)ceil(log((double)A.rowdim())*0.7213475205);
-
-                RandomPrime genprime( (Integer)p_size );
-                commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION) << "prime size: " << p_size << "\n"; 
-                ChineseRemainder< myModular > cra(3UL);
-                IntegerModularDetReduced<SparseMatrix<Integers >,MyMethod> iteration(A, M, beta,myfactor);
-
-                //if (A.rowdim() < 200 ) {
-                //    cra(d,iteration,genprime);
-                //    commentator.stop ( "first step", NULL, "det");
-                //    commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-                //        << "Iterations done " << iteration.iterations() << "\n";
-                //} else {
-                Integer p;
-                Integer res;
-
-                Timer BT;
-                double time1, time2;
-                BT.start();
-
-                while ( early_counter < myfactor && !cra.terminated() ) {
-                        genprime.randomPrime(p);
-                        while (cra.noncoprime(p)) genprime.randomPrime(p);
-                        myModular D(p);
-                        iteration.primes[early_counter] = p;
-                            //          prime(p, early_counter);
-                        myModular::Element r;
-                        D.init(r,0);
-                        cra.progress( D, iteration(r, D));
-                        ++early_counter;
-                }
-
-                BT.stop();
-                time1 = BT.usertime()/myfactor;
-                if (time1 < 0) time1 = 0;
-                cra.result(res);
-
-                if (early_counter < myfactor) {
-                     //determinant found 
-                        commentator.stop ( "first step", NULL, "det");
-                        commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-                            << "Iterations done " << iteration.iterations()<< "\n";
-                        return d=res;
-                }
-                //cout << "no very early termination \n";
-                // turn to LU when matrix size small - not to be used at the moment 
-                //if (A.rowdim() < 50 ) {
-                //while ( !cra.terminated() ) {
-                //      genprime.randomPrime(p);
-                //        myModular D(p);
-                //        iteration.primes[early_counter] = p;
-                            //          prime(p, early_counter);
-                //        myModular::Element r;
-                //        D.init(r,0);
-                //        cra.progress( D, iteration(r, D));
-                //        ++early_counter;
-                //}
-                //commentator.stop ( "zero step", NULL, "det");
-                //commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-                //        << "Iterations done " << iteration.iterations() << "\n";
-                //return d;
-                //}
-
-                //RandomPrime genprime1( 26-(int)ceil(log((double)A.rowdim())*0.7213475205));
-                //Integers ZZ;
-                typedef RationalSolver < Integers , myModular, RandomPrime, BlockHankelTraits > Solver;
-		Solver RSolver(A. field(), genprime);
 
-                typename Vector<Integers>:: Dense r_num1 (A. coldim());
-
-                LastInvariantFactor < Integers ,Solver >  LIF(RSolver);
-
-                BT.start();
-                if (LIF.lastInvariantFactor1(lif, r_num1, A)==0) {
-                        //if (lif==0) {
-                        d = 0;
-                        commentator.stop ("is 0", NULL, "det");
-                        return d;
-                }
-                BT.stop();
-                time2 = BT.usertime();
-                if (time2 < 0) time2 =0;
-
-                //commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-                //            << "5 LU time: " << time1 << " LIF time: " << time2 << ")\n";
-                //cout << "lif calculated\n";
-                //LIF.lastInvariantFactor_Bonus(lif, bonus, A);
-
-                //if (lif==0) {
-                //      d = 0;
-                //      commentator.stop ("done", NULL, "det");
-                //        return d;
-                //}
-
-                //if (bonus == 1) {
-                //      d = lif;
-                //        commentator.stop ("done", NULL, "det");
-                //        return d;
-                //}
-
-                beta = lif*bonus;
-                iteration.Beta(beta);
-
-                //RandomPrime genprime2( 26-(int)ceil(log((double)A.rowdim())*0.7213475205));
-                ChineseRemainder< Modular<double> > cra2(3UL);
-                Integer k = 1;
-
-                early_counter = 0;
-                while ( early_counter < myfactor && !cra2.terminated() ) {
-                        myModular D(iteration.primes[early_counter]);
-                        myModular::Element r;
-                        D.init(r,0);
-                        cra2.progress( D, iteration(r, D));
-                        ++early_counter;
-                }
-
-                if (early_counter < myfactor) {
-                            // determinant found 
-                        k = cra2.result(res);
-                        commentator.stop ("second step ", NULL, "det");
-                        commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-                            << "Iterations done " << iteration.iterations()<< "(" << iteration.iterations2() << ")\n";
-
-                }
-                else  if (0) { //time2 < a*log2(lif)*time1/p_size) {
-                        typename Vector<Integers>:: Dense r_num2 (A. coldim());
-                        Integer lif2=1;
-                        LIF.lastInvariantFactor1(lif2,r_num2,A);
-                        LIF.bonus(bonus,lif, lif2, r_num1,r_num2);
-
-                        //lif2 = lif;
-                        if ((bonus > 1) || (lif2 != lif)) {
-                                //cout << "lif: " <<lif <<",\n     "<< lif2<< "przed\n";
-                                lif = lcm(lif, lif2);
-                                //cout << "lif: " <<lif << "po";
-                                beta=lif*bonus;
-                                iteration.Beta(beta);
-                                //iteration.Restart2() // included in Beta();
-                                //iteration.Moduli(moduli);
-                                //iteration.Primes(primes);
-                                k=1;
-                                ChineseRemainder< Modular<double> > cra3(3UL);
-
-                                early_counter = 0;
-                                while ( (early_counter < myfactor) && (!cra3.terminated() )) {
-                                        myModular D(iteration.primes[early_counter]);
-                                        myModular::Element r;
-                                        D.init(r,0);
-                                        cra3.progress( D, iteration(r, D));
-                                        ++early_counter;
-                                        //iteration.Inc();
-                                }
-
-                                if (early_counter < myfactor) {
-                                        // determinant found based on the initial LU 
-                                        cra3.result(k);
-                                        commentator.stop ("third step - recalc", NULL, "det");
-                                        commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-                                                << "Iterations done " << iteration.iterations()<<"(" << iteration.iterations2() << ")\n";
-                                                //<< "bonus size " << log2(bonus) << "\n";
-
-                                } else {
-                                        // enter the cra loop 
-                                        //cra3(k,iteration, genprime);
-                                        while (!cra3.terminated()) {
-                                                genprime.randomPrime(p);
-                                                while (cra3.noncoprime(p)) genprime.randomPrime(p);
-                                                myModular D(p);
-                                                myModular::Element r;
-                                                D.init(r,0);
-                                                cra3.progress( D, iteration(r, D));
-                                        }
-                                        cra3.result(k);
-                                        commentator.stop ("third step, bonus > 1", NULL, "det");
-                                        commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-                                                << "Iterations done " << iteration.iterations()<< "(" << iteration.iterations2() << ")\n";
-                                                //<< "bonus size " << log2(bonus) << "\n";
-                                }
-                        } else {
-                                //cra2(k,iteration, genprime);
-                                while (!cra2.terminated()) {
-                                        genprime.randomPrime(p);
-                                        while (cra2.noncoprime(p)) genprime.randomPrime(p);
-                                        myModular D(p);
-                                        myModular::Element r;
-                                        D.init(r,0);
-                                        cra2.progress( D, iteration(r, D));
-                                }
-                                cra2.result(k);
-                                commentator.stop ("third step, bonus = 1", NULL, "det");
-                                commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-                                        << "Iterations done " << iteration.iterations()<< "(" << iteration.iterations2() << ")\n";
-                        }
-                } else {
-                                while (!cra2.terminated()) {
-                                        genprime.randomPrime(p);
-                                        while (cra2.noncoprime(p)) genprime.randomPrime(p);
-                                        myModular D(p);
-                                        myModular::Element r;
-                                        D.init(r,0);
-                                        cra2.progress( D, iteration(r, D));
-                                }
-                                cra2.result(k);
-                                commentator.stop ("second step+", NULL, "det");
-                                commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-                                        << "Iterations done " << iteration.iterations()<< "(" << iteration.iterations2() << ")\n";
-
-                           // enter the cra loop 
-                        //cra2(k,iteration, genprime);
-                }
-
-                //commentator.stop ("second step", NULL, "det");
-                //commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-                //        << "Iterations done " << iteration.iterations() << "("
-                //        << iteration.iterations2() << " )\n";
-                d = k*beta;
-
-                Integer tmp;
-
-                commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-                            << "1 LU time: " << time1 << " LIF time: " << time2 << ")\n";
-                commentator.report(Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-                        << "det/lif " << k<< "\n";
-                //commentator.report(Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-                //        << "determinant size " << Integers::log2(tmp,abs(d))<< " lif size "<< Integers::log2(tmp,beta) << "\n";
-
-                return d ;
-
-            }
-*/ 
+	}
+#endif
+
 } // end of LinBox namespace
-#endif // __HYBRID_DET_H
+
+#undef _LB_H_DET_TIMING
+
+#endif // __LINBOX_hybrid_det_H
+
 
 
 
 
-    
diff --git a/linbox/algorithms/la-block-lanczos.h b/linbox/algorithms/la-block-lanczos.h
index da1851a..44ca489 100644
--- a/linbox/algorithms/la-block-lanczos.h
+++ b/linbox/algorithms/la-block-lanczos.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/algorithms/la-block-lanczos.h
  * Copyright 2002-2004 Bradford Hovinen
  *
@@ -13,8 +13,8 @@
  * Class definitions for block Lanczos iteration
  */
 
-#ifndef __LA_BLOCK_LANCZOS_H
-#define __LA_BLOCK_LANCZOS_H
+#ifndef __LINBOX_la_block_lanczos_H
+#define __LINBOX_la_block_lanczos_H
 
 #include "linbox/linbox-config.h"
 
@@ -37,335 +37,336 @@
 #undef _P
 #undef _Q
 
-namespace LinBox 
-{
-
-/** Biorthogonalising block Lanczos iteration
- *
- * This is a biorthogonalising variant of Montgomery's block Lanczos
- * iteration. The goal is to avoid having to symmetrise the input
- * matrix by constructing two sequences of block vectors that have
- * mutual orthogonality properties. This algorithm was proposed by
- * Bradford Hovinen.
- */
-template <class Field, class Matrix = DenseMatrixBase<typename Field::Element> >
-class LABlockLanczosSolver
+namespace LinBox
 {
-    public:
-
-	typedef typename Field::Element Element;
 
-	/** Constructor
-	 * @param F Field over which to operate
-	 * @param traits @ref{SolverTraits} structure describing user
-	 *               options for the solver 
+	/** Biorthogonalising block Lanczos iteration
+	 *
+	 * This is a biorthogonalising variant of Montgomery's block Lanczos
+	 * iteration. The goal is to avoid having to symmetrise the input
+	 * matrix by constructing two sequences of block vectors that have
+	 * mutual orthogonality properties. This algorithm was proposed by
+	 * Bradford Hovinen.
 	 */
-	LABlockLanczosSolver (const Field &F,
-				    const BlockLanczosTraits &traits)
-		: _traits (traits), _F (F), _VD (F), _MD (F), _randiter (F),
-		  _uAv (this), _eliminator (F, _traits.blockingFactor ())
+	template <class Field, class Matrix = DenseMatrixBase<typename Field::Element> >
+	class LABlockLanczosSolver {
+	public:
+
+		typedef typename Field::Element Element;
+
+		/** Constructor
+		 * @param F Field over which to operate
+		 * @param traits @ref SolverTraits structure describing user
+		 *               options for the solver
+		 */
+		LABlockLanczosSolver (const Field &F,
+				      const BlockLanczosTraits &traits) :
+			_traits (traits), _F (F), _VD (F), _MD (F), _randiter (F),
+			_uAv (this), _eliminator (F, _traits.blockingFactor ())
 		{ init_temps (); }
 
-	/** Constructor with a random iterator
-	 * @param F Field over which to operate
-	 * @param traits @ref{SolverTraits} structure describing user
-	 *               options for the solver 
-	 * @param r Random iterator to use for randomization
-	 */
-	LABlockLanczosSolver (const Field &F,
-			      const BlockLanczosTraits &traits,
-			      typename Field::RandIter r)
-		: _traits (traits), _F (F), _VD (F), _MD (F), _randiter (r),
-		  _uAv (this), _eliminator (F, _traits.blockingFactor ())
+		/** Constructor with a random iterator
+		 * @param F Field over which to operate
+		 * @param traits @ref SolverTraits structure describing user
+		 *               options for the solver
+		 * @param r Random iterator to use for randomization
+		 */
+		LABlockLanczosSolver (const Field &F,
+				      const BlockLanczosTraits &traits,
+				      typename Field::RandIter r) :
+			_traits (traits), _F (F), _VD (F), _MD (F), _randiter (r),
+			_uAv (this), _eliminator (F, _traits.blockingFactor ())
 		{ init_temps (); }
 
-	/** Destructor
-	 */
-	~LABlockLanczosSolver ();
+		/** Destructor
+		*/
+		~LABlockLanczosSolver ();
 
-	/** Solve the linear system Ax = b.
-	 *
-	 * If the system is nonsingular, this method computes the unique
-	 * solution to the system Ax = b. If the system is singular, it computes
-	 * a random solution.
-	 *
-	 * @param A Black box for the matrix A
-	 * @param x Vector in which to store solution
-	 * @param b Right-hand side of system
-	 * @return True on success; false on failure
-	 */
-	template <class Blackbox, class Vector>
-	bool solve (const Blackbox &A, Vector &x, const Vector &b);
-
-	/** Sample uniformly from the (right) nullspace of A
-	 *
-	 * @param A Black box for the matrix A
-	 * @param x Matrix into whose columns to store nullspace elements
-	 * @return Number of nullspace vectors found
-	 */
-	template <class Blackbox, class Matrix1>
-	unsigned int sampleNullspace (const Blackbox &A, Matrix1 &x);
-
-	/** Estimate the rank of A
-	 *
-	 * @param A Black box for the matrix A
-	 * @return Lower bound on the rank of A
-	 */
-	template <class Blackbox>
-	unsigned int rank (const Blackbox &A);
-
-    private:
+		/** Solve the linear system Ax = b.
+		 *
+		 * If the system is nonsingular, this method computes the unique
+		 * solution to the system Ax = b. If the system is singular, it computes
+		 * a random solution.
+		 *
+		 * @param A Black box for the matrix A
+		 * @param x Vector in which to store solution
+		 * @param b Right-hand side of system
+		 * @return True on success; false on failure
+		 */
+		template <class Blackbox, class Vector>
+		bool solve (const Blackbox &A, Vector &x, const Vector &b);
 
-	typedef typename MatrixDomain<Field>::Permutation Permutation;
+		/** Sample uniformly from the (right) nullspace of A
+		 *
+		 * @param A Black box for the matrix A
+		 * @param x Matrix into whose columns to store nullspace elements
+		 * @return Number of nullspace vectors found
+		 */
+		template <class Blackbox, class Matrix1>
+		unsigned int sampleNullspace (const Blackbox &A, Matrix1 &x);
 
-	class BasisTransformation
-	{
-		LABlockLanczosSolver      &_solver;
+		/** Estimate the rank of A
+		 *
+		 * @param A Black box for the matrix A
+		 * @return Lower bound on the rank of A
+		 */
+		template <class Blackbox>
+		unsigned int rank (const Blackbox &A);
 
-		std::vector<Permutation>   _P;
-		std::vector<Matrix *>      _T;
-		std::vector<unsigned int>  _rho;
-		std::vector<unsigned int>  _s;
+	private:
 
-		unsigned int _N;
-
-		template <class Matrix1>
-		void applyOne (Matrix1 &M, Permutation &P, Matrix *T, unsigned int rho, unsigned int s, bool left);
+		typedef typename MatrixDomain<Field>::Permutation Permutation;
 
-	    public:
-		template <class Matrix1>
-		Matrix1 &apply (Matrix1 &A, bool left);
+		class BasisTransformation {
+			LABlockLanczosSolver      &_solver;
 
-		template <class Matrix1>
-		Matrix1 &applyPermutation (Matrix1 &A, bool left);
+			std::vector<Permutation>   _P;
+			std::vector<Matrix *>      _T;
+			std::vector<unsigned int>  _rho;
+			std::vector<unsigned int>  _s;
 
-		template <class Matrix1>
-		Matrix1 &applyLast (Matrix1 &A, bool left);
+			unsigned int _N;
 
-		template <class Matrix1>
-		void append (Permutation &P, Matrix1 &T, unsigned int rho);
+			template <class Matrix1>
+			void applyOne (Matrix1 &M, Permutation &P, Matrix *T, unsigned int rho, unsigned int s, bool left);
 
-		void reset ();
+		public:
+			template <class Matrix1>
+			Matrix1 &apply (Matrix1 &A, bool left);
 
-		void reportComplete (std::ostream &out);
-		void report (std::ostream &out);
+			template <class Matrix1>
+			Matrix1 &applyPermutation (Matrix1 &A, bool left);
 
-		BasisTransformation (LABlockLanczosSolver<Field, Matrix> &solver, unsigned int N)
-			: _solver (solver), _N (N) { reset (); }
+			template <class Matrix1>
+			Matrix1 &applyLast (Matrix1 &A, bool left);
 
-		~BasisTransformation ();
-	};
+			template <class Matrix1>
+			void append (Permutation &P, Matrix1 &T, unsigned int rho);
 
-	friend class BasisTransformation;
+			void reset ();
 
-	struct Iterate;
+			void reportComplete (std::ostream &out);
+			void report (std::ostream &out);
 
-	// Structure representing an elimination step
-	struct ElimStep
-	{
-		Matrix *_ujAvkmu;
-		Matrix *_nuukAvj;
+			BasisTransformation (LABlockLanczosSolver<Field, Matrix> &solver, unsigned int N) :
+				_solver (solver), _N (N)
+			{ reset (); }
 
-		unsigned int _rho;
-		unsigned int _rhop;
+			~BasisTransformation ();
+		};
 
-		Iterate *_l;
-		int _l_iter;
-	};
+		friend class BasisTransformation;
 
-	// Structure representing an iterate
-	struct Iterate 
-	{
-		// Record of the pseudoinverse
-		Matrix _udotAvbarinv;       // N x N
-		Matrix _ubarAvdotinv;       // N x N
-
-		// Record of the iterate from this iteration
-		Matrix _u;                  // N x n
-		Matrix _v;                  // N x n
-
-		// Record of the dot iterate from this iteration
-		Matrix _udot;               // N x n
-		Matrix _vdot;               // N x n
-
-		// Record of the basis transformation
-		BasisTransformation _sigma_u;
-		BasisTransformation _sigma_v;
-
-		// Record of udot_j^TAv_j and u_j^TAvdot_j
-		Matrix _udotAv;             // N x N
-		Matrix _uAvdot;             // N x N
-
-		// Record of elimination steps used on _u and _v
-		std::list<ElimStep> _steps;
-
-		int _iter;
-		unsigned int _rho_u, _rho_v;
-		bool _done;
-
-		Iterate (LABlockLanczosSolver &solver, size_t n, size_t N, unsigned int iter)
-			: _udotAvbarinv (N, N), _ubarAvdotinv (N, N),
-			  _u (n, N), _v (n, N), _udot (n, N), _vdot (n, N),
-			  _sigma_u (solver, N), _sigma_v (solver, N),
-			  _udotAv (N, N), _uAvdot (N, N)
-			{ init (iter); }
+		struct Iterate;
 
-		void init (unsigned int iter) 
+		// Structure representing an elimination step
+		struct ElimStep
 		{
-			_iter = iter;
-			_rho_u = _rho_v = 0;
-			_done = false;
-			_sigma_u.reset ();
-			_sigma_v.reset ();
-			_steps.clear ();
-		}
-	};
+			Matrix *_ujAvkmu;
+			Matrix *_nuukAvj;
 
-	// Two-dimensional array of inner products
+			unsigned int _rho;
+			unsigned int _rhop;
 
-	class InnerProductArray 
-	{
-		LABlockLanczosSolver *_solver;
-		std::deque<std::deque<Matrix *> > _blocks;
-		unsigned int _base;
+			Iterate *_l;
+			int _l_iter;
+		};
 
-	    public:
-		InnerProductArray (LABlockLanczosSolver *solver) : _solver (solver), _base (0) {}
-
-		void extend ();
-		void contract ();
-		Matrix *get (int i, int j);
-		void reset ();
-	};
+		// Structure representing an iterate
+		struct Iterate
+		{
+			// Record of the pseudoinverse
+			Matrix _udotAvbarinv;       // N x N
+			Matrix _ubarAvdotinv;       // N x N
+
+			// Record of the iterate from this iteration
+			Matrix _u;                  // N x n
+			Matrix _v;                  // N x n
+
+			// Record of the dot iterate from this iteration
+			Matrix _udot;               // N x n
+			Matrix _vdot;               // N x n
+
+			// Record of the basis transformation
+			BasisTransformation _sigma_u;
+			BasisTransformation _sigma_v;
+
+			// Record of udot_j^TAv_j and u_j^TAvdot_j
+			Matrix _udotAv;             // N x N
+			Matrix _uAvdot;             // N x N
+
+			// Record of elimination steps used on _u and _v
+			std::list<ElimStep> _steps;
+
+			int _iter;
+			unsigned int _rho_u, _rho_v;
+			bool _done;
+
+			Iterate (LABlockLanczosSolver &solver, size_t n, size_t N, unsigned int iter) :
+				_udotAvbarinv (N, N), _ubarAvdotinv (N, N),
+				_u (n, N), _v (n, N), _udot (n, N), _vdot (n, N),
+				_sigma_u (solver, N), _sigma_v (solver, N),
+				_udotAv (N, N), _uAvdot (N, N)
+			{ init (iter); }
 
-	// Run the block Lanczos iteration and return the result. Return false
-	// if the method breaks down. Do not check that Ax = b in the end
-	template <class Blackbox>
-	void iterate (const Blackbox &A);
+			void init (unsigned int iter)
+			{
+				_iter = iter;
+				_rho_u = _rho_v = 0;
+				_done = false;
+				_sigma_u.reset ();
+				_sigma_v.reset ();
+				_steps.clear ();
+			}
+		};
+
+		// Two-dimensional array of inner products
+
+		class InnerProductArray {
+			LABlockLanczosSolver *_solver;
+			std::deque<std::deque<Matrix *> > _blocks;
+			unsigned int _base;
+
+		public:
+			InnerProductArray (LABlockLanczosSolver *solver) :
+				_solver (solver), _base (0)
+			{}
+
+			void extend ();
+			void contract ();
+			Matrix *get (int i, int j);
+			void reset ();
+		};
+
+		// Run the block Lanczos iteration and return the result. Return false
+		// if the method breaks down. Do not check that Ax = b in the end
+		template <class Blackbox>
+		void iterate (const Blackbox &A);
 
-	template <class Matrix1>
-	void fixInnerProducts (typename std::list<Iterate *>::iterator l, const Matrix1 &Cu, const Matrix1 &Cv, unsigned int iter);
+		template <class Matrix1>
+		void fixInnerProducts (typename std::list<Iterate *>::iterator l, const Matrix1 &Cu, const Matrix1 &Cv, unsigned int iter);
 
-	template <class Blackbox>
-	void tailDecomp (typename std::list<Iterate *>::iterator l, Iterate *i, const Blackbox &A);
+		template <class Blackbox>
+		void tailDecomp (typename std::list<Iterate *>::iterator l, Iterate *i, const Blackbox &A);
 
-	// Clean up the queue of iterates and return an Iterate structure to
-	// store the next iterate information
-	void cleanup (bool all);
+		// Clean up the queue of iterates and return an Iterate structure to
+		// store the next iterate information
+		void cleanup (bool all);
 
-	void adjust_uip1Abeta (typename std::list<Iterate *>::iterator j,
-			       ElimStep &step,
-			       unsigned int iter);
-	void compute_uip1Abeta (typename std::list<Iterate *>::iterator j, unsigned int iter);
-	void adjust_alphaAvip1 (typename std::list<Iterate *>::iterator j,
-				ElimStep &step,
-				unsigned int iter);
-	void compute_alphaAvip1 (typename std::list<Iterate *>::iterator j, unsigned int iter);
+		void adjust_uip1Abeta (typename std::list<Iterate *>::iterator j,
+				       ElimStep &step,
+				       unsigned int iter);
+		void compute_uip1Abeta (typename std::list<Iterate *>::iterator j, unsigned int iter);
+		void adjust_alphaAvip1 (typename std::list<Iterate *>::iterator j,
+					ElimStep &step,
+					unsigned int iter);
+		void compute_alphaAvip1 (typename std::list<Iterate *>::iterator j, unsigned int iter);
 
-	void augmentuidotAv (Iterate *i, Iterate *l, unsigned int rho);
-	void augmentuAvidot (Iterate *i, Iterate *l, unsigned int rho);
+		void augmentuidotAv (Iterate *i, Iterate *l, unsigned int rho);
+		void augmentuAvidot (Iterate *i, Iterate *l, unsigned int rho);
 
-	// Augment the inner products in udotAv with information on a new profile
-	void augmentuldotAv (Iterate *l, Iterate *i, std::vector<unsigned int> &profile, unsigned int rho);
+		// Augment the inner products in udotAv with information on a new profile
+		void augmentuldotAv (Iterate *l, Iterate *i, std::vector<unsigned int> &profile, unsigned int rho);
 
-	// Augment the inner products in uAvdot with information on a new profile
-	void augmentuAvldot (Iterate *l, Iterate *i, std::vector<unsigned int> &profile, unsigned int rho);
+		// Augment the inner products in uAvdot with information on a new profile
+		void augmentuAvldot (Iterate *l, Iterate *i, std::vector<unsigned int> &profile, unsigned int rho);
 
-	template <class Matrix1, class Matrix2>
-	void extractMinor (Matrix1 &M, Matrix2 &M1, std::vector<unsigned int> &profile);
+		template <class Matrix1, class Matrix2>
+		void extractMinor (Matrix1 &M, Matrix2 &M1, std::vector<unsigned int> &profile);
 
-	// Retrieve a new iterate structure
-	Iterate *getNextIterate (unsigned int iter);
+		// Retrieve a new iterate structure
+		Iterate *getNextIterate (unsigned int iter);
 
-	// Management of the grid of inner products
-	Matrix *newBlock ();
+		// Management of the grid of inner products
+		Matrix *newBlock ();
 
-	// Initialize the temporaries used in computation
-	void init_temps ();
+		// Initialize the temporaries used in computation
+		void init_temps ();
 
-	template <class Blackbox>
-	void checkInnerProducts (const Blackbox &A);
+		template <class Blackbox>
+		void checkInnerProducts (const Blackbox &A);
 
-	template <class Matrix1, class Matrix2, class Blackbox>
-	void checkAConjugacy (const Matrix1  &u,
-			      const Matrix2  &v,
-			      const Blackbox &A,
-			      size_t          u_iter,
-			      size_t          v_iter,
-			      size_t          rho_u,
-			      size_t          rho_v);
+		template <class Matrix1, class Matrix2, class Blackbox>
+		void checkAConjugacy (const Matrix1  &u,
+				      const Matrix2  &v,
+				      const Blackbox &A,
+				      size_t          u_iter,
+				      size_t          v_iter,
+				      size_t          rho_u,
+				      size_t          rho_v);
 
-	template <class T>
-	inline const T &max (const T &a, const T &b) const
-	{
-		return (a > b) ? a : b;
-	}
+		template <class T>
+		inline const T &max (const T &a, const T &b) const
+		{
+			return (a > b) ? a : b;
+		}
 
-	template <class T>
-	inline const T &min (const T &a, const T &b) const
-	{
-		return (a < b) ? a : b;
-	}
+		template <class T>
+		inline const T &min (const T &a, const T &b) const
+		{
+			return (a < b) ? a : b;
+		}
 
-	// Private variables
+		// Private variables
 
-	const BlockLanczosTraits  _traits;
-	const Field               &_F;
-	VectorDomain<Field>        _VD;
-	MatrixDomain<Field>        _MD;
-	typename Field::RandIter   _randiter;
+		const BlockLanczosTraits  _traits;
+		const Field               &_F;
+		VectorDomain<Field>        _VD;
+		MatrixDomain<Field>        _MD;
+		typename Field::RandIter   _randiter;
 
-	// Temporaries used in the computation
+		// Temporaries used in the computation
 
-	mutable Matrix    _T1;           // N x N
-	mutable Matrix    _T2;           // N x N
-	mutable Matrix    _T3;           // N x N
-	mutable Matrix    _T4;           // N x N
-	mutable Matrix    _T5;           // N x N
-	mutable Matrix    _W;            // N x N
+		mutable Matrix    _T1;           // N x N
+		mutable Matrix    _T2;           // N x N
+		mutable Matrix    _T3;           // N x N
+		mutable Matrix    _T4;           // N x N
+		mutable Matrix    _T5;           // N x N
+		mutable Matrix    _W;            // N x N
 
-	Matrix            _ATu;          // n x N
-	Matrix            _Av;           // n x N
+		Matrix            _ATu;          // n x N
+		Matrix            _Av;           // n x N
 
-	Matrix            _Cu;           // N x N
-	Matrix            _Cv;           // N x N
+		Matrix            _Cu;           // N x N
+		Matrix            _Cv;           // N x N
 
-	Permutation       _P;
-	Permutation       _Q;
+		Permutation       _P;
+		Permutation       _Q;
 
-	Matrix            _v0;           // n x N
-	Matrix            _b;            // n x <=N
-	Matrix            _x;            // n x <=N
-	Matrix            _y;            // n x <=N
+		Matrix            _v0;           // n x N
+		Matrix            _b;            // n x <=N
+		Matrix            _x;            // n x <=N
+		Matrix            _y;            // n x <=N
 
-	Element           _one;
+		Element           _one;
 
-	unsigned int	  _iter;
-	unsigned int	  _total_dim;
-	unsigned int	  _rank;
+		unsigned int	  _iter;
+		unsigned int	  _total_dim;
+		unsigned int	  _rank;
 
-	std::vector<unsigned int> _profile;
+		std::vector<unsigned int> _profile;
 
-	// Records used in managing Ucirc and Vcirc
-	std::map<unsigned int, unsigned int> _gamma;
+		// Records used in managing Ucirc and Vcirc
+		std::map<unsigned int, unsigned int> _gamma;
 
-	InnerProductArray _uAv;  // Array of inner products wrt. original bases
+		InnerProductArray _uAv;  // Array of inner products wrt. original bases
 
-	std::list<Iterate *>  _history;
-	std::stack<Iterate *> _it_trashcan; // Unused Iterate structures go here
-	std::stack<Matrix *>  _ip_trashcan; // Unused inner product matrices
-					    // go here
+		std::list<Iterate *>  _history;
+		std::stack<Iterate *> _it_trashcan; // Unused Iterate structures go here
+		std::stack<Matrix *>  _ip_trashcan; // Unused inner product matrices
+		// go here
 
-	Eliminator<Field, Matrix> _eliminator;
+		Eliminator<Field, Matrix> _eliminator;
 
-	// Construct a transpose matrix on the fly
-	template <class Matrix1>
-	static inline TransposeMatrix<Matrix1> transpose (Matrix1 &M)
+		// Construct a transpose matrix on the fly
+		template <class Matrix1>
+		static inline TransposeMatrix<Matrix1> transpose (Matrix1 &M)
 		{ return TransposeMatrix<Matrix1> (M); }
-};
+	};
 
 } // namespace LinBox
 
 #include "linbox/algorithms/la-block-lanczos.inl"
 
-#endif // __LA_BLOCK_LANCZOS_H
+#endif // __LINBOX_la_block_lanczos_H
+
diff --git a/linbox/algorithms/la-block-lanczos.inl b/linbox/algorithms/la-block-lanczos.inl
index 2488aff..17050c6 100644
--- a/linbox/algorithms/la-block-lanczos.inl
+++ b/linbox/algorithms/la-block-lanczos.inl
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* linbox/algorithms/la-block-lanczos.inl
  * Copyright 2002-2004 Bradford Hovinen
@@ -13,8 +14,8 @@
  * Function definitions for block Lanczos iteration
  */
 
-#ifndef __LA_BLOCK_LANCZOS_INL
-#define __LA_BLOCK_LANCZOS_INL
+#ifndef __LINBOX_la_block_lanczos_INL
+#define __LINBOX_la_block_lanczos_INL
 
 #include "linbox/linbox-config.h"
 
@@ -34,47 +35,47 @@
 #include "linbox/util/timer.h"
 #include "linbox/algorithms/la-block-lanczos.h"
 
-namespace LinBox 
+namespace LinBox
 {
 
 #ifdef LABL_DETAILED_TRACE
 
-template <class Field, class Matrix>
-void LABLTraceReport (std::ostream &out, MatrixDomain<Field> &MD, const char *text, size_t iter, const Matrix &M)
-{
-	out << text << " [" << iter << "]:" << std::endl;
-	MD.write (out, M);
-}
+	template <class Field, class Matrix>
+	void LABLTraceReport (std::ostream &out, MatrixDomain<Field> &MD, const char *text, size_t iter, const Matrix &M)
+	{
+		out << text << " [" << iter << "]:" << std::endl;
+		MD.write (out, M);
+	}
 
-template <class Field, class Vector>
-void LABLTraceReport (std::ostream &out, VectorDomain<Field> &VD, const char *text, size_t iter, const Vector &v)
-{
-	out << text << " [" << iter << "]: ";
-	VD.write (out, v) << std::endl;
-}
+	template <class Field, class Vector>
+	void LABLTraceReport (std::ostream &out, VectorDomain<Field> &VD, const char *text, size_t iter, const Vector &v)
+	{
+		out << text << " [" << iter << "]: ";
+		VD.write (out, v) << std::endl;
+	}
 
-void LABLReportPriorityIndices (std::ostream &out, std::list<size_t> &_priority_indices, const char *which)
-{
-	out << "Priority indices for " << which << ": ";
-	std::list<std::size_t>::iterator pi_it = _priority_indices.begin ();
-	while (pi_it != _priority_indices.end ()) {
-		out << *pi_it;
-		if (++pi_it != _priority_indices.end ())
-			out << ", ";
-		else
-			break;
+	void LABLReportPriorityIndices (std::ostream &out, std::list<size_t> &_priority_indices, const char *which)
+	{
+		out << "Priority indices for " << which << ": ";
+		std::list<std::size_t>::iterator pi_it = _priority_indices.begin ();
+		while (pi_it != _priority_indices.end ()) {
+			out << *pi_it;
+			if (++pi_it != _priority_indices.end ())
+				out << ", ";
+			else
+				break;
+		}
+		out << std::endl;
 	}
-	out << std::endl;
-}
 
 #else
 
-template <class Domain, class Object>
-inline void LABLTraceReport (std::ostream &out, Domain &D, const char *text, size_t iter, const Object &obj)
-{}
+	template <class Domain, class Object>
+	inline void LABLTraceReport (std::ostream &out, Domain &D, const char *text, size_t iter, const Object &obj)
+	{}
 
-void LABLReportPriorityIndices (std::ostream &, std::list<size_t> &, const char *)
-{}
+	void LABLReportPriorityIndices (std::ostream &, std::list<size_t> &, const char *)
+	{}
 
 #endif
 
@@ -84,7 +85,7 @@ void LABLReportPriorityIndices (std::ostream &, std::list<size_t> &, const char
 #  define TIMER_STOP(part) part##_timer.stop (); part##_time += part##_timer.time ()
 #  define TIMER_REPORT(part) \
 	commentator.report (Commentator::LEVEL_NORMAL, TIMING_MEASURE) \
-		<< "Total " #part " time: " << part##_time << "s" << std::endl;
+	<< "Total " #part " time: " << part##_time << "s" << std::endl;
 #else
 #  define TIMER_DECLARE(part)
 #  define TIMER_START(part)
@@ -92,1338 +93,1342 @@ void LABLReportPriorityIndices (std::ostream &, std::list<size_t> &, const char
 #  define TIMER_REPORT(part)
 #endif
 
-
 
-template <class Field, class Matrix>
-LABlockLanczosSolver<Field, Matrix>::~LABlockLanczosSolver ()
-{
-	while (!_it_trashcan.empty ()) {
-		delete _it_trashcan.top ();
-		_it_trashcan.pop ();
-	}
 
-	while (!_ip_trashcan.empty ()) {
-		delete _ip_trashcan.top ();
-		_ip_trashcan.pop ();
-	}
-}
+	template <class Field, class Matrix>
+	LABlockLanczosSolver<Field, Matrix>::~LABlockLanczosSolver ()
+	{
+		while (!_it_trashcan.empty ()) {
+			delete _it_trashcan.top ();
+			_it_trashcan.pop ();
+		}
 
-// N.B. This code was lifted from the Lanczos iteration in LinBox
+		while (!_ip_trashcan.empty ()) {
+			delete _ip_trashcan.top ();
+			_ip_trashcan.pop ();
+		}
+	}
 
-template <class Field, class Matrix>
-template <class Blackbox, class Vector>
-bool LABlockLanczosSolver<Field, Matrix>::solve
-	(const Blackbox &A, Vector &x, const Vector &b) 
-{
-	linbox_check (x.size () == A.coldim ());
-	linbox_check (b.size () == A.rowdim ());
-	linbox_check (A.rowdim () == A.coldim ());
+	// N.B. This code was lifted from the Lanczos iteration in LinBox
 
-	commentator.start ("Solving linear system (Biorthogonalising block Lanczos)",
-			   "LABlockLanczosSolver::solve");
+	template <class Field, class Matrix>
+	template <class Blackbox, class Vector>
+	bool LABlockLanczosSolver<Field, Matrix>::solve
+	(const Blackbox &A, Vector &x, const Vector &b)
+	{
+		linbox_check (x.size () == A.coldim ());
+		linbox_check (b.size () == A.rowdim ());
+		linbox_check (A.rowdim () == A.coldim ());
 
-	std::ostream &reportU = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+		commentator.start ("Solving linear system (Biorthogonalising block Lanczos)",
+				   "LABlockLanczosSolver::solve");
 
-	Vector Ax;
-	bool success = false;
+		std::ostream &reportU = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
 
-	// Get the temporaries into the right sizes
-	_b.resize (b.size (), 1);
-	_x.resize (x.size (), 1);
+		Vector Ax;
+		bool success = false;
 
-	_v0.resize (A.coldim (), _traits.blockingFactor ());
-	_ATu.resize (A.rowdim (), _traits.blockingFactor ());
-	_Av.resize (A.coldim (), _traits.blockingFactor ());
+		// Get the temporaries into the right sizes
+		_b.resize (b.size (), 1);
+		_x.resize (x.size (), 1);
 
-	// Copy the right-hand side to the first column of _b
-	_VD.copy (*(_b.colBegin ()), b);
-	_VD.copy (*(_v0.colBegin ()), b);
+		_v0.resize (A.coldim (), _traits.blockingFactor ());
+		_ATu.resize (A.rowdim (), _traits.blockingFactor ());
+		_Av.resize (A.coldim (), _traits.blockingFactor ());
 
-	// Fill the remaining columns of _v0 with random data
-	RandomDenseStream<Field, typename Matrix::Col> stream (_F, _randiter, A.coldim ());
-	typename Matrix::ColIterator iter = _v0.colBegin ();
+		// Copy the right-hand side to the first column of _b
+		_VD.copy (*(_b.colBegin ()), b);
+		_VD.copy (*(_v0.colBegin ()), b);
 
-	for (++iter; iter != _v0.colEnd (); ++iter)
-		stream >> *iter;
+		// Fill the remaining columns of _v0 with random data
+		RandomDenseStream<Field, typename Matrix::Col> stream (_F, _randiter, A.coldim ());
+		typename Matrix::ColIterator iter = _v0.colBegin ();
 
-	// Run the iteration up to maximum number of tries
-	for (unsigned int i = 0; !success && i < _traits.maxTries (); ++i) {
-		iterate (A);
-		_VD.copy (x, *(_x.colBegin ()));
+		for (++iter; iter != _v0.colEnd (); ++iter)
+			stream >> *iter;
 
-		if (_traits.checkResult ()) {
-			VectorWrapper::ensureDim (Ax, A.rowdim ());
+		// Run the iteration up to maximum number of tries
+		for (unsigned int i = 0; !success && i < _traits.maxTries (); ++i) {
+			iterate (A);
+			_VD.copy (x, *(_x.colBegin ()));
 
 			if (_traits.checkResult ()) {
-				commentator.start ("Checking whether Ax=b");
+				VectorWrapper::ensureDim (Ax, A.rowdim ());
 
-				A.apply (Ax, x);
+				if (_traits.checkResult ()) {
+					commentator.start ("Checking whether Ax=b");
 
-				if (_VD.areEqual (Ax, b)) {
-					commentator.stop ("passed");
-					success = true;
-				} else {
-					commentator.stop ("FAILED");
-					success = false;
+					A.apply (Ax, x);
 
-					reportU << "Ax = ";
-					_VD.write (reportU, x) << std::endl;
+					if (_VD.areEqual (Ax, b)) {
+						commentator.stop ("passed");
+						success = true;
+					}
+					else {
+						commentator.stop ("FAILED");
+						success = false;
 
-					reportU << " b = ";
-					_VD.write (reportU, b) << std::endl;
+						reportU << "Ax = ";
+						_VD.write (reportU, x) << std::endl;
+
+						reportU << " b = ";
+						_VD.write (reportU, b) << std::endl;
+					}
 				}
 			}
 		}
-	}
 
-	// Clear out the collection of iterates
-	while (!_it_trashcan.empty ()) {
-		delete _it_trashcan.top ();
-		_it_trashcan.pop ();
-	}
+		// Clear out the collection of iterates
+		while (!_it_trashcan.empty ()) {
+			delete _it_trashcan.top ();
+			_it_trashcan.pop ();
+		}
 
-	while (!_history.empty ()) {
-		delete _history.front ();
-		_history.pop_front ();
-	}
+		while (!_history.empty ()) {
+			delete _history.front ();
+			_history.pop_front ();
+		}
 
-	_uAv.reset ();
+		_uAv.reset ();
 
-	commentator.stop ("done", (success ? "Solve successful" : "Solve failed"), "LABlockLanczosSolver::solve");
+		commentator.stop ("done", (success ? "Solve successful" : "Solve failed"), "LABlockLanczosSolver::solve");
 
-	return success;
-}
+		return success;
+	}
 
-template <class Field, class Matrix>
-template <class Blackbox, class Matrix1>
-unsigned int LABlockLanczosSolver<Field, Matrix>::sampleNullspace
-	(const Blackbox &A, Matrix1 &x) 
-{
-	linbox_check (x.rowdim () == A.coldim ());
-	linbox_check (x.coldim () == _traits.blockingFactor ());
-	linbox_check (A.rowdim () == A.coldim ());
+	template <class Field, class Matrix>
+	template <class Blackbox, class Matrix1>
+	unsigned int LABlockLanczosSolver<Field, Matrix>::sampleNullspace
+	(const Blackbox &A, Matrix1 &x)
+	{
+		linbox_check (x.rowdim () == A.coldim ());
+		linbox_check (x.coldim () == _traits.blockingFactor ());
+		linbox_check (A.rowdim () == A.coldim ());
 
-	commentator.start ("Sampling from nullspace (Lookahead-based block Lanczos)",
-			   "LABlockLanczosSolver::sampleNullspace");
+		commentator.start ("Sampling from nullspace (Lookahead-based block Lanczos)",
+				   "LABlockLanczosSolver::sampleNullspace");
 
-	// Get the temporaries into the right sizes
-	_b.resize (x.rowdim (), _traits.blockingFactor ());
-	_x.resize (x.rowdim (), _traits.blockingFactor ());
-	_y.resize (x.rowdim (), _traits.blockingFactor ());
+		// Get the temporaries into the right sizes
+		_b.resize (x.rowdim (), _traits.blockingFactor ());
+		_x.resize (x.rowdim (), _traits.blockingFactor ());
+		_y.resize (x.rowdim (), _traits.blockingFactor ());
 
-	_v0.resize (A.coldim (), _traits.blockingFactor ());
-	_ATu.resize (A.rowdim (), _traits.blockingFactor ());
-	_Av.resize (A.coldim (), _traits.blockingFactor ());
+		_v0.resize (A.coldim (), _traits.blockingFactor ());
+		_ATu.resize (A.rowdim (), _traits.blockingFactor ());
+		_Av.resize (A.coldim (), _traits.blockingFactor ());
 
-	// Fill y with random data
-	RandomDenseStream<Field, typename Matrix::Col> stream (_F, _randiter, A.coldim ());
-	typename Matrix::ColIterator iter;
+		// Fill y with random data
+		RandomDenseStream<Field, typename Matrix::Col> stream (_F, _randiter, A.coldim ());
+		typename Matrix::ColIterator iter;
 
-	for (iter = _y.colBegin (); iter != _y.colEnd (); ++iter)
-		stream >> *iter;
+		for (iter = _y.colBegin (); iter != _y.colEnd (); ++iter)
+			stream >> *iter;
 
-	// Fill v0 with random data
-	stream.reset ();
+		// Fill v0 with random data
+		stream.reset ();
 
-	for (iter = _v0.colBegin (); iter != _v0.colEnd (); ++iter)
-		stream >> *iter;
+		for (iter = _v0.colBegin (); iter != _v0.colEnd (); ++iter)
+			stream >> *iter;
 
-	// Find a right-hand side for the linear system
-	_MD.blackboxMulLeft (_b, A, _y);
+		// Find a right-hand side for the linear system
+		_MD.blackboxMulLeft (_b, A, _y);
 
-	// Run the iteration proper
-	iterate (A);
+		// Run the iteration proper
+		iterate (A);
 
-	// Obtain the candidate nullspace vectors
-	_MD.subin (_x, _y);
+		// Obtain the candidate nullspace vectors
+		_MD.subin (_x, _y);
 
-	// Copy vectors of _x that are true nullspace vectors into the solution
-	_MD.blackboxMulLeft (_b, A, _x);
+		// Copy vectors of _x that are true nullspace vectors into the solution
+		_MD.blackboxMulLeft (_b, A, _x);
 
-	typename Matrix::ColIterator bi, xi = x.colBegin (), xip;
-	unsigned int number = 0;
+		typename Matrix::ColIterator bi, xi = x.colBegin (), xip;
+		unsigned int number = 0;
 
-	for (bi = _b.colBegin (), xip = _x.colBegin (); bi != _b.colEnd (); ++bi, ++xip) {
-		if (_VD.isZero (*bi) && !_VD.isZero (*xip)) {
-			_VD.copy (*xi, *xip);
-			++number; ++xi;
+		for (bi = _b.colBegin (), xip = _x.colBegin (); bi != _b.colEnd (); ++bi, ++xip) {
+			if (_VD.isZero (*bi) && !_VD.isZero (*xip)) {
+				_VD.copy (*xi, *xip);
+				++number; ++xi;
+			}
 		}
-	}
 
-	// Clear out the collection of iterates
-	while (!_it_trashcan.empty ()) {
-		delete _it_trashcan.top ();
-		_it_trashcan.pop ();
-	}
+		// Clear out the collection of iterates
+		while (!_it_trashcan.empty ()) {
+			delete _it_trashcan.top ();
+			_it_trashcan.pop ();
+		}
+
+		while (!_history.empty ()) {
+			delete _history.front ();
+			_history.pop_front ();
+		}
+
+		_uAv.reset ();
 
-	while (!_history.empty ()) {
-		delete _history.front ();
-		_history.pop_front ();
+		commentator.stop ("done", NULL, "LABlockLanczosSolver::sampleNullspace");
+		return number;
 	}
 
-	_uAv.reset ();
+	template <class Field, class Matrix>
+	template <class Blackbox>
+	unsigned int LABlockLanczosSolver<Field, Matrix>::rank
+	(const Blackbox &A)
+	{
+		linbox_check (A.rowdim () == A.coldim ());
 
-	commentator.stop ("done", NULL, "LABlockLanczosSolver::sampleNullspace");
-	return number;
-}
+		commentator.start ("Rank (Lookahead-based block Lanczos)",
+				   "LABlockLanczosSolver::rank");
 
-template <class Field, class Matrix>
-template <class Blackbox>
-unsigned int LABlockLanczosSolver<Field, Matrix>::rank
-	(const Blackbox &A) 
-{
-	linbox_check (A.rowdim () == A.coldim ());
+		// Get the temporaries into the right sizes
+		_b.resize (A.rowdim (), 1);
+		_x.resize (A.rowdim (), 1);
+		_y.resize (A.rowdim (), _traits.blockingFactor ());
 
-	commentator.start ("Rank (Lookahead-based block Lanczos)",
-			   "LABlockLanczosSolver::rank");
+		_v0.resize (A.coldim (), _traits.blockingFactor ());
+		_ATu.resize (A.rowdim (), _traits.blockingFactor ());
+		_Av.resize (A.coldim (), _traits.blockingFactor ());
 
-	// Get the temporaries into the right sizes
-	_b.resize (A.rowdim (), 1);
-	_x.resize (A.rowdim (), 1);
-	_y.resize (A.rowdim (), _traits.blockingFactor ());
+		// Fill v0 with random data
+		RandomDenseStream<Field, typename Matrix::Col> stream (_F, _randiter, A.coldim ());
+		typename Matrix::ColIterator iter;
 
-	_v0.resize (A.coldim (), _traits.blockingFactor ());
-	_ATu.resize (A.rowdim (), _traits.blockingFactor ());
-	_Av.resize (A.coldim (), _traits.blockingFactor ());
+		for (iter = _y.colBegin (); iter != _y.colEnd (); ++iter)
+			stream >> *iter;
 
-	// Fill v0 with random data
-	RandomDenseStream<Field, typename Matrix::Col> stream (_F, _randiter, A.coldim ());
-	typename Matrix::ColIterator iter;
+		_MD.blackboxMulLeft (_v0, A, _y);
 
-	for (iter = _y.colBegin (); iter != _y.colEnd (); ++iter)
-		stream >> *iter;
+		// Run the iteration proper
+		iterate (A);
 
-	_MD.blackboxMulLeft (_v0, A, _y);
+		// Clear out the collection of iterates
+		while (!_it_trashcan.empty ()) {
+			delete _it_trashcan.top ();
+			_it_trashcan.pop ();
+		}
 
-	// Run the iteration proper
-	iterate (A);
+		while (!_history.empty ()) {
+			delete _history.front ();
+			_history.pop_front ();
+		}
 
-	// Clear out the collection of iterates
-	while (!_it_trashcan.empty ()) {
-		delete _it_trashcan.top ();
-		_it_trashcan.pop ();
-	}
+		_uAv.reset ();
 
-	while (!_history.empty ()) {
-		delete _history.front ();
-		_history.pop_front ();
+		commentator.stop ("done", NULL, "LABlockLanczosSolver::rank");
+		return _rank;
 	}
 
-	_uAv.reset ();
-
-	commentator.stop ("done", NULL, "LABlockLanczosSolver::rank");
-	return _rank;
-}
 
-
 
-template <class Field, class Matrix>
-template <class Blackbox>
-void LABlockLanczosSolver<Field, Matrix>::iterate (const Blackbox &A)
-{
-	linbox_check (_history.empty ());
+	template <class Field, class Matrix>
+	template <class Blackbox>
+	void LABlockLanczosSolver<Field, Matrix>::iterate (const Blackbox &A)
+	{
+		linbox_check (_history.empty ());
 
-	commentator.start ("Lookahead-based block Lanczos iteration",
-			   "LABlockLanczosSolver::iterate", A.rowdim ());
+		commentator.start ("Lookahead-based block Lanczos iteration",
+				   "LABlockLanczosSolver::iterate", A.rowdim ());
 
-	typename std::list<Iterate *>::iterator j;
+		typename std::list<Iterate *>::iterator j;
 
-	Iterate *iterate, *next_iterate;
+		Iterate *iterate, *next_iterate;
 
-	_iter = 0;
-	_total_dim = 0;
-	_rank = 0;
+		_iter = 0;
+		_total_dim = 0;
+		_rank = 0;
 
-	const unsigned int N = _traits.blockingFactor ();
+		const unsigned int N = _traits.blockingFactor ();
 
-	unsigned int dead_iters = 0;
-	Integer c;
-	_F.characteristic (c);
-	double logc = log (double (c));
-	unsigned int max_dead_iters = (unsigned int) ceil (3 * log (double (A.rowdim ())) / (N * logc)) + 2;
+		unsigned int dead_iters = 0;
+		Integer c;
+		_F.characteristic (c);
+		double logc = log (double (c));
+		unsigned int max_dead_iters = (unsigned int) ceil (3 * log (double (A.rowdim ())) / (N * logc)) + 2;
 
-	bool error = false;
+		bool error = false;
 
-	// FIXME: We need a mechanism to allow other procedures to access this
-	TIMER_DECLARE(AV);
-	TIMER_DECLARE(updateInnerProducts);
-	TIMER_DECLARE(tailDecomp);
-	TIMER_DECLARE(innerProducts);
-	TIMER_DECLARE(projectionCoeff);
-	TIMER_DECLARE(orthogonalization);
-	TIMER_DECLARE(cleanup);
-	TIMER_DECLARE(terminationCheck);
+		// FIXME: We need a mechanism to allow other procedures to access this
+		TIMER_DECLARE(AV);
+		TIMER_DECLARE(updateInnerProducts);
+		TIMER_DECLARE(tailDecomp);
+		TIMER_DECLARE(innerProducts);
+		TIMER_DECLARE(projectionCoeff);
+		TIMER_DECLARE(orthogonalization);
+		TIMER_DECLARE(cleanup);
+		TIMER_DECLARE(terminationCheck);
 
-	_uAv.reset ();
+		_uAv.reset ();
 
-	unsigned int history_total = 0, history_max = 0;
+		unsigned int history_total = 0, history_max = 0;
 
-	// How many iterations between each progress update
-	unsigned int progress_interval = A.rowdim () / _traits.blockingFactor () / 100;
+		// How many iterations between each progress update
+		unsigned int progress_interval = A.rowdim () / _traits.blockingFactor () / 100;
 
-	// Make sure there are a minimum of ten
-	if (progress_interval == 0)
-		progress_interval = 1;
+		// Make sure there are a minimum of ten
+		if (progress_interval == 0)
+			progress_interval = 1;
 
-	std::ostream &reportI = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-	std::ostream &reportU = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+		std::ostream &reportI = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+		std::ostream &reportU = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
 
 #ifdef LABL_DETAILED_TRACE
-	std::ostream &reportN = commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION);
+		std::ostream &reportN = commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION);
 #endif
 
-	// Prepare the first iterate
-	next_iterate = getNextIterate (0);
+		// Prepare the first iterate
+		next_iterate = getNextIterate (0);
 
-	// Get a random fat vectors _V[0] and _U[0]
-	RandomDenseStream<Field, typename Matrix::Col> stream (_F, _randiter, A.coldim ());
-	typename Matrix::ColIterator u_iter;
+		// Get a random fat vectors _V[0] and _U[0]
+		RandomDenseStream<Field, typename Matrix::Col> stream (_F, _randiter, A.coldim ());
+		typename Matrix::ColIterator u_iter;
 
-	for (u_iter = next_iterate->_u.colBegin (); u_iter != next_iterate->_u.colEnd (); ++u_iter)
-		stream >> *u_iter;
+		for (u_iter = next_iterate->_u.colBegin (); u_iter != next_iterate->_u.colEnd (); ++u_iter)
+			stream >> *u_iter;
 
-	_MD.copy (next_iterate->_v, _v0);
+		_MD.copy (next_iterate->_v, _v0);
 
 #ifdef LABL_DETAILED_TRACE
-	Matrix    u0 (A.rowdim (), _traits.blockingFactor ());
-	Matrix    v0 (A.rowdim (), _traits.blockingFactor ());
+		Matrix    u0 (A.rowdim (), _traits.blockingFactor ());
+		Matrix    v0 (A.rowdim (), _traits.blockingFactor ());
 #else  // Give those variables something just to satisfy the compiler
 #  define AU0 iterate->_u
 #  define AV0 iterate->_v
 #endif
 
 #ifdef LABL_DETAILED_TRACE
-	_MD.copy (u0, next_iterate->_u);
-	_MD.copy (v0, next_iterate->_v);
+		_MD.copy (u0, next_iterate->_u);
+		_MD.copy (v0, next_iterate->_v);
 #endif
 
-	_MD.subin (_x, _x);
+		_MD.subin (_x, _x);
 
-	// Set up an initial inner product
-	_uAv.extend ();
-	_history.push_back (next_iterate);
+		// Set up an initial inner product
+		_uAv.extend ();
+		_history.push_back (next_iterate);
 
-	while (dead_iters < max_dead_iters) {
-		TIMER_START(terminationCheck);
-		if (_MD.isZero (next_iterate->_u))
-			break;
-		TIMER_STOP(terminationCheck);
+		while (dead_iters < max_dead_iters) {
+			TIMER_START(terminationCheck);
+			if (_MD.isZero (next_iterate->_u))
+				break;
+			TIMER_STOP(terminationCheck);
 
-		// Step 1: Obtain an iterate structure
-		iterate = next_iterate;
-		next_iterate = getNextIterate (_iter + 1);
-		_uAv.extend ();
+			// Step 1: Obtain an iterate structure
+			iterate = next_iterate;
+			next_iterate = getNextIterate (_iter + 1);
+			_uAv.extend ();
 
-		LABLTraceReport (reportU, _MD, "u", _iter, iterate->_u);
-		LABLTraceReport (reportU, _MD, "v", _iter, iterate->_v);
+			LABLTraceReport (reportU, _MD, "u", _iter, iterate->_u);
+			LABLTraceReport (reportU, _MD, "v", _iter, iterate->_v);
 
-		LABLTraceReport (reportU, _MD, "x", _iter, _x);
+			LABLTraceReport (reportU, _MD, "x", _iter, _x);
 
-		// Step 2: Compute A^T U, AV, and inner products
-		TransposeMatrix<Matrix> uTA (_ATu);
+			// Step 2: Compute A^T U, AV, and inner products
+			TransposeMatrix<Matrix> uTA (_ATu);
 
-		TIMER_START(AV);
-		_MD.blackboxMulRight (uTA, transpose (iterate->_u), A);
-		_MD.blackboxMulLeft (_Av, A, iterate->_v);
-		TIMER_STOP(AV);
+			TIMER_START(AV);
+			_MD.blackboxMulRight (uTA, transpose (iterate->_u), A);
+			_MD.blackboxMulLeft (_Av, A, iterate->_v);
+			TIMER_STOP(AV);
 
-		TIMER_START(innerProducts);
-		_MD.mul (*_uAv.get (_iter, _iter), transpose (iterate->_u), _Av);
-		_MD.mul (*_uAv.get (_iter + 1, _iter), uTA, _Av);
-		TIMER_STOP(innerProducts);
+			TIMER_START(innerProducts);
+			_MD.mul (*_uAv.get (_iter, _iter), transpose (iterate->_u), _Av);
+			_MD.mul (*_uAv.get (_iter + 1, _iter), uTA, _Av);
+			TIMER_STOP(innerProducts);
 
-		if (_MD.isZero (*_uAv.get (_iter, _iter)) && _MD.isZero (*_uAv.get (_iter + 1, _iter)))
-			++dead_iters;
-		else
-			dead_iters = 0;
+			if (_MD.isZero (*_uAv.get (_iter, _iter)) && _MD.isZero (*_uAv.get (_iter + 1, _iter)))
+				++dead_iters;
+			else
+				dead_iters = 0;
 
-		TIMER_START(updateInnerProducts);
-		_MD.copy (*_uAv.get (_iter, _iter + 1), *_uAv.get (_iter + 1, _iter));
+			TIMER_START(updateInnerProducts);
+			_MD.copy (*_uAv.get (_iter, _iter + 1), *_uAv.get (_iter + 1, _iter));
 
-		for (j = _history.begin (); j != _history.end () && *j != iterate; ++j) {
-			_MD.copy (*_uAv.get (_iter + 1, (*j)->_iter), *_uAv.get (_iter, (*j)->_iter + 1));
-			_MD.copy (*_uAv.get ((*j)->_iter, _iter + 1), *_uAv.get ((*j)->_iter + 1, _iter));
-			compute_alphaAvip1 (j, _iter);
-			compute_uip1Abeta (j, _iter);
-		}
-		TIMER_STOP(updateInnerProducts);
+			for (j = _history.begin (); j != _history.end () && *j != iterate; ++j) {
+				_MD.copy (*_uAv.get (_iter + 1, (*j)->_iter), *_uAv.get (_iter, (*j)->_iter + 1));
+				_MD.copy (*_uAv.get ((*j)->_iter, _iter + 1), *_uAv.get ((*j)->_iter + 1, _iter));
+				compute_alphaAvip1 (j, _iter);
+				compute_uip1Abeta (j, _iter);
+			}
+			TIMER_STOP(updateInnerProducts);
 
-		LABLTraceReport (reportU, _MD, "A^T u", _iter, _ATu);
-		LABLTraceReport (reportU, _MD, "Av", _iter, _Av);
+			LABLTraceReport (reportU, _MD, "A^T u", _iter, _ATu);
+			LABLTraceReport (reportU, _MD, "Av", _iter, _Av);
 
-		_MD.copy (next_iterate->_u, _ATu);
-		_MD.copy (next_iterate->_v, _Av);
+			_MD.copy (next_iterate->_u, _ATu);
+			_MD.copy (next_iterate->_v, _Av);
 
-		for (j = _history.begin (); j != _history.end (); ++j) {
-			TIMER_START(tailDecomp);
-			tailDecomp (j, iterate, A);
-			TIMER_STOP(tailDecomp);
+			for (j = _history.begin (); j != _history.end (); ++j) {
+				TIMER_START(tailDecomp);
+				tailDecomp (j, iterate, A);
+				TIMER_STOP(tailDecomp);
 
-			// Step 6: Compute projection coefficients
-			TIMER_START(projectionCoeff);
-			DenseSubmatrix<Element> Cu (_Cu, 0, 0, N, (*j)->_rho_v);
-			DenseSubmatrix<Element> Cv (_Cv, 0, 0, (*j)->_rho_u, N);
+				// Step 6: Compute projection coefficients
+				TIMER_START(projectionCoeff);
+				DenseSubmatrix<Element> Cu (_Cu, 0, 0, N, (*j)->_rho_v);
+				DenseSubmatrix<Element> Cv (_Cv, 0, 0, (*j)->_rho_u, N);
 
-			DenseSubmatrix<Element> udotAvbarinv ((*j)->_udotAvbarinv, 0, 0, (*j)->_rho_v, (*j)->_rho_v);
-			DenseSubmatrix<Element> ubarAvdotinv ((*j)->_ubarAvdotinv, 0, 0, (*j)->_rho_u, (*j)->_rho_u);
+				DenseSubmatrix<Element> udotAvbarinv ((*j)->_udotAvbarinv, 0, 0, (*j)->_rho_v, (*j)->_rho_v);
+				DenseSubmatrix<Element> ubarAvdotinv ((*j)->_ubarAvdotinv, 0, 0, (*j)->_rho_u, (*j)->_rho_u);
 
-			DenseSubmatrix<Element> udot ((*j)->_udot, 0, 0, A.rowdim (), (*j)->_rho_v);
-			DenseSubmatrix<Element> vdot ((*j)->_vdot, 0, 0, A.rowdim (), (*j)->_rho_u);
+				DenseSubmatrix<Element> udot ((*j)->_udot, 0, 0, A.rowdim (), (*j)->_rho_v);
+				DenseSubmatrix<Element> vdot ((*j)->_vdot, 0, 0, A.rowdim (), (*j)->_rho_u);
 
-			_MD.copy (_T1, *_uAv.get (_iter + 1, (*j)->_iter));
-			(*j)->_sigma_v.apply (_T1, false);
+				_MD.copy (_T1, *_uAv.get (_iter + 1, (*j)->_iter));
+				(*j)->_sigma_v.apply (_T1, false);
 
-			DenseSubmatrix<Element> uip1Avbarj (_T1, 0, 0, N, (*j)->_rho_v);
+				DenseSubmatrix<Element> uip1Avbarj (_T1, 0, 0, N, (*j)->_rho_v);
 
-			_MD.mul (Cu, uip1Avbarj, udotAvbarinv);
-			_MD.negin (Cu);
+				_MD.mul (Cu, uip1Avbarj, udotAvbarinv);
+				_MD.negin (Cu);
 
 #ifdef LABL_DETAILED_TRACE
-			reportN << "Elimination step: C^u_(" << _iter + 1 << ", " << (*j)->_iter << "):" << std::endl;
-			_MD.write (reportN, Cu);
+				reportN << "Elimination step: C^u_(" << _iter + 1 << ", " << (*j)->_iter << "):" << std::endl;
+				_MD.write (reportN, Cu);
 
-			reportN << "Elimination step: (udot_" << (*j)->_iter << "^TAvbar_" << (*j)->_iter << ")^{-1}:" << std::endl;
-			_MD.write (reportN, udotAvbarinv);
+				reportN << "Elimination step: (udot_" << (*j)->_iter << "^TAvbar_" << (*j)->_iter << ")^{-1}:" << std::endl;
+				_MD.write (reportN, udotAvbarinv);
 #endif
 
-			_MD.copy (_T1, *_uAv.get ((*j)->_iter, _iter + 1));
-			(*j)->_sigma_u.apply (_T1, true);
+				_MD.copy (_T1, *_uAv.get ((*j)->_iter, _iter + 1));
+				(*j)->_sigma_u.apply (_T1, true);
 
-			DenseSubmatrix<Element> ubarjAvip1 (_T1, 0, 0, (*j)->_rho_u, N);
+				DenseSubmatrix<Element> ubarjAvip1 (_T1, 0, 0, (*j)->_rho_u, N);
 
-			_MD.mul (Cv, ubarAvdotinv, ubarjAvip1);
-			_MD.negin (Cv);
+				_MD.mul (Cv, ubarAvdotinv, ubarjAvip1);
+				_MD.negin (Cv);
 
 #ifdef LABL_DETAILED_TRACE
-			reportN << "Elimination step: C^v_(" << _iter + 1 << ", " << (*j)->_iter << "):" << std::endl;
-			_MD.write (reportN, Cv);
+				reportN << "Elimination step: C^v_(" << _iter + 1 << ", " << (*j)->_iter << "):" << std::endl;
+				_MD.write (reportN, Cv);
 
-			reportN << "Elimination step: (ubar_" << (*j)->_iter << "^TAvdot_" << (*j)->_iter << ")^{-1}:" << std::endl;
-			_MD.write (reportN, ubarAvdotinv);
+				reportN << "Elimination step: (ubar_" << (*j)->_iter << "^TAvdot_" << (*j)->_iter << ")^{-1}:" << std::endl;
+				_MD.write (reportN, ubarAvdotinv);
 #endif
 
-			TIMER_STOP(projectionCoeff);
+				TIMER_STOP(projectionCoeff);
 
-			// Step 7: Eliminate blocks for iterate i + 1
-			TIMER_START(orthogonalization);
-			_MD.axpyin (next_iterate->_u, udot, transpose (Cu));
-			_MD.axpyin (next_iterate->_v, vdot, Cv);
-			TIMER_STOP(orthogonalization);
+				// Step 7: Eliminate blocks for iterate i + 1
+				TIMER_START(orthogonalization);
+				_MD.axpyin (next_iterate->_u, udot, transpose (Cu));
+				_MD.axpyin (next_iterate->_v, vdot, Cv);
+				TIMER_STOP(orthogonalization);
 
-			// Step 8: Fix inner products
-			TIMER_START(updateInnerProducts);
-			fixInnerProducts (j, Cu, Cv, _iter);
-			TIMER_STOP(updateInnerProducts);
-		}
+				// Step 8: Fix inner products
+				TIMER_START(updateInnerProducts);
+				fixInnerProducts (j, Cu, Cv, _iter);
+				TIMER_STOP(updateInnerProducts);
+			}
 
 #ifdef LABL_DETAILED_TRACE
-		unsigned int rho_u_0 = (_history.front ()->_iter == 0) ? _history.front ()->_rho_u : N;
-		unsigned int rho_v_0 = (_history.front ()->_iter == 0) ? _history.front ()->_rho_v : N;
+			unsigned int rho_u_0 = (_history.front ()->_iter == 0) ? _history.front ()->_rho_u : N;
+			unsigned int rho_v_0 = (_history.front ()->_iter == 0) ? _history.front ()->_rho_v : N;
 
-		checkAConjugacy (u0, next_iterate->_v, A, 0, _iter + 1, rho_u_0, N);
-		checkAConjugacy (next_iterate->_u, v0, A, _iter + 1, 0, N, rho_v_0);
-		checkAConjugacy (iterate->_u, next_iterate->_v, A, _iter, _iter + 1, iterate->_rho_u, N);
-		checkAConjugacy (next_iterate->_u, iterate->_v, A, _iter + 1, _iter, N, iterate->_rho_v);
+			checkAConjugacy (u0, next_iterate->_v, A, 0, _iter + 1, rho_u_0, N);
+			checkAConjugacy (next_iterate->_u, v0, A, _iter + 1, 0, N, rho_v_0);
+			checkAConjugacy (iterate->_u, next_iterate->_v, A, _iter, _iter + 1, iterate->_rho_u, N);
+			checkAConjugacy (next_iterate->_u, iterate->_v, A, _iter + 1, _iter, N, iterate->_rho_v);
 #endif
 
-		// Step 9: Throw away unneeded iterates and update solution
-		TIMER_START(cleanup);
-		cleanup (false);
-		TIMER_STOP(cleanup);
+			// Step 9: Throw away unneeded iterates and update solution
+			TIMER_START(cleanup);
+			cleanup (false);
+			TIMER_STOP(cleanup);
 
-		// Step 10: Prepare for the next iteration
-		history_total += _history.size ();
-		history_max = max ((size_t) history_max, _history.size ());
-		_total_dim += iterate->_rho_u;
-		_history.push_back (next_iterate);
-		++_iter;
+			// Step 10: Prepare for the next iteration
+			history_total += _history.size ();
+			history_max = max ((size_t) history_max, _history.size ());
+			_total_dim += iterate->_rho_u;
+			_history.push_back (next_iterate);
+			++_iter;
 
-		checkInnerProducts (A);
+			checkInnerProducts (A);
 
-		if (!(_iter % progress_interval))
-			commentator.progress (_total_dim);
+			if (!(_iter % progress_interval))
+				commentator.progress (_total_dim);
 
-		if (_total_dim > A.rowdim ()) {
-			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+			if (_total_dim > A.rowdim ()) {
+				commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
 				<< "ERROR: Maximum number of iterations passed without termination" << std::endl;
-			error = true;
-			break;
+				error = true;
+				break;
+			}
 		}
-	}
 
-	// Now just take everything off the history and throw it in the trash
-	TIMER_START(cleanup);
-	cleanup (true);
-	TIMER_STOP(cleanup);
+		// Now just take everything off the history and throw it in the trash
+		TIMER_START(cleanup);
+		cleanup (true);
+		TIMER_STOP(cleanup);
 
-	LABLTraceReport (reportU, _MD, "x", _iter, _x);
+		LABLTraceReport (reportU, _MD, "x", _iter, _x);
 
-	TIMER_REPORT(AV);
-	TIMER_REPORT(updateInnerProducts);
-	TIMER_REPORT(tailDecomp);
-	TIMER_REPORT(innerProducts);
-	TIMER_REPORT(projectionCoeff);
-	TIMER_REPORT(orthogonalization);
-	TIMER_REPORT(cleanup);
-	TIMER_REPORT(terminationCheck);
+		TIMER_REPORT(AV);
+		TIMER_REPORT(updateInnerProducts);
+		TIMER_REPORT(tailDecomp);
+		TIMER_REPORT(innerProducts);
+		TIMER_REPORT(projectionCoeff);
+		TIMER_REPORT(orthogonalization);
+		TIMER_REPORT(cleanup);
+		TIMER_REPORT(terminationCheck);
 
-	reportI << "Maximum history length: " << history_max << std::endl
+		reportI << "Maximum history length: " << history_max << std::endl
 		<< "Average history length: " << (double) history_total / (double) _iter << std::endl;
 
-	reportI << "Number of iterations: " << _iter << std::endl;
+		reportI << "Number of iterations: " << _iter << std::endl;
 
-	if (error)
-		commentator.stop ("ERROR", NULL, "LABlockLanczosSolver::iterate");
-	else if (dead_iters >= max_dead_iters)
-		commentator.stop ("breakdown", NULL, "LABlockLanczosSolver::iterate");
-	else
-		commentator.stop ("done", NULL, "LABlockLanczosSolver::iterate");
-}
+		if (error)
+			commentator.stop ("ERROR", NULL, "LABlockLanczosSolver::iterate");
+		else if (dead_iters >= max_dead_iters)
+			commentator.stop ("breakdown", NULL, "LABlockLanczosSolver::iterate");
+		else
+			commentator.stop ("done", NULL, "LABlockLanczosSolver::iterate");
+	}
 
-template <class Field, class Matrix>
-template <class Matrix1>
-void LABlockLanczosSolver<Field, Matrix>::fixInnerProducts
+	template <class Field, class Matrix>
+	template <class Matrix1>
+	void LABlockLanczosSolver<Field, Matrix>::fixInnerProducts
 	(typename std::list<Iterate *>::iterator  l,
 	 const Matrix1                           &Cu,
 	 const Matrix1                           &Cv,
 	 unsigned int                             iter)
-{
-	const unsigned int N = _traits.blockingFactor ();
+	{
+		const unsigned int N = _traits.blockingFactor ();
 
-	DenseSubmatrix<Element> udotAv ((*l)->_udotAv, 0, 0, Cu.coldim (), N);
-	DenseSubmatrix<Element> uAvdot ((*l)->_uAvdot, 0, 0, N, Cv.rowdim ());
-	_MD.axpyin (*_uAv.get (iter + 1, (*l)->_iter), Cu, udotAv);
-	_MD.axpyin (*_uAv.get ((*l)->_iter, iter + 1), uAvdot, Cv);
+		DenseSubmatrix<Element> udotAv ((*l)->_udotAv, 0, 0, Cu.coldim (), N);
+		DenseSubmatrix<Element> uAvdot ((*l)->_uAvdot, 0, 0, N, Cv.rowdim ());
+		_MD.axpyin (*_uAv.get (iter + 1, (*l)->_iter), Cu, udotAv);
+		_MD.axpyin (*_uAv.get ((*l)->_iter, iter + 1), uAvdot, Cv);
 
 #ifdef LABL_DETAILED_TRACE
-	std::ostream &reportN = commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION);
+		std::ostream &reportN = commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION);
 
-	reportN << "fixInnerProducts: udot_" << (*l)->_iter << "^TAv_" << (*l)->_iter << ":" << std::endl;
-	_MD.write (reportN, udotAv);
+		reportN << "fixInnerProducts: udot_" << (*l)->_iter << "^TAv_" << (*l)->_iter << ":" << std::endl;
+		_MD.write (reportN, udotAv);
 
-	reportN << "fixInnerProducts: u_" << (*l)->_iter << "^TAvdot_" << (*l)->_iter << ":" << std::endl;
-	_MD.write (reportN, uAvdot);
+		reportN << "fixInnerProducts: u_" << (*l)->_iter << "^TAvdot_" << (*l)->_iter << ":" << std::endl;
+		_MD.write (reportN, uAvdot);
 #endif
-}
+	}
 
-
 
-template <class Field, class Matrix>
-template <class Blackbox>
-void LABlockLanczosSolver<Field, Matrix>::tailDecomp
+
+	template <class Field, class Matrix>
+	template <class Blackbox>
+	void LABlockLanczosSolver<Field, Matrix>::tailDecomp
 	(typename std::list<Iterate *>::iterator l, Iterate *i, const Blackbox &A)
-{
+	{
 #ifdef LABL_DETAILED_TRACE
-	commentator.start ("Tail decomposition", "LABlockLanczosSolver::tailDecomp");
-	std::ostream &reportI = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-	std::ostream &reportN = commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION);
-	std::ostream &reportU = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+		commentator.start ("Tail decomposition", "LABlockLanczosSolver::tailDecomp");
+		std::ostream &reportI = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+		std::ostream &reportN = commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION);
+		std::ostream &reportU = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
 #endif
 
-	typename std::list<Iterate *>::iterator j;
+		typename std::list<Iterate *>::iterator j;
 
-	const unsigned int N = _traits.blockingFactor ();
+		const unsigned int N = _traits.blockingFactor ();
 
-	unsigned int rho_u = 0, rho_v = 0;
-	typename Field::Element d;
+		unsigned int rho_u = 0, rho_v = 0;
+		typename Field::Element d;
 
-	if ((*l)->_rho_u < N) {
+		if ((*l)->_rho_u < N) {
 #ifdef LABL_DETAILED_TRACE
-		reportI << "Performing tail decomposition using u_" << (*l)->_iter << "^TAv_" << i->_iter << std::endl;
+			reportI << "Performing tail decomposition using u_" << (*l)->_iter << "^TAv_" << i->_iter << std::endl;
 #endif
 
-		// Step 5.1: Do inversion step for the u side
-		_MD.copy (_T1, *_uAv.get ((*l)->_iter, i->_iter));
-		(*l)->_sigma_u.apply (_T1, true);
-		i->_sigma_v.apply (_T1, false);
+			// Step 5.1: Do inversion step for the u side
+			_MD.copy (_T1, *_uAv.get ((*l)->_iter, i->_iter));
+			(*l)->_sigma_u.apply (_T1, true);
+			i->_sigma_v.apply (_T1, false);
 
-		DenseSubmatrix<Element> uhatAvhat (_T1, (*l)->_rho_u, i->_rho_v, N - (*l)->_rho_u, N - i->_rho_v);
-		DenseSubmatrix<Element> uhatAvhatinv (_W, 0, 0, N - (*l)->_rho_u, N - (*l)->_rho_u);
+			DenseSubmatrix<Element> uhatAvhat (_T1, (*l)->_rho_u, i->_rho_v, N - (*l)->_rho_u, N - i->_rho_v);
+			DenseSubmatrix<Element> uhatAvhatinv (_W, 0, 0, N - (*l)->_rho_u, N - (*l)->_rho_u);
 
 #ifdef LABL_DETAILED_TRACE
-		reportN << "ucheck_" << (*l)->_iter << "^TAvcheck_" << i->_iter << ":" << std::endl;
-		_MD.write (reportN, _T1);
+			reportN << "ucheck_" << (*l)->_iter << "^TAvcheck_" << i->_iter << ":" << std::endl;
+			_MD.write (reportN, _T1);
 
-		reportN << "uhat_" << (*l)->_iter << "^TAvhat_" << i->_iter << ":" << std::endl;
-		_MD.write (reportN, uhatAvhat);
+			reportN << "uhat_" << (*l)->_iter << "^TAvhat_" << i->_iter << ":" << std::endl;
+			_MD.write (reportN, uhatAvhat);
 #endif
 
-		_eliminator.gaussJordan (uhatAvhatinv, _profile, _P, _T2, _Q, _T3, rho_u, d, uhatAvhat);
+			_eliminator.gaussJordan (uhatAvhatinv, _profile, _P, _T2, _Q, _T3, rho_u, d, uhatAvhat);
 
-		DenseSubmatrix<Element> mu (uhatAvhatinv, 0, 0, rho_u, rho_u);
-		DenseSubmatrix<Element> Tu (_T2, rho_u, 0, N - (*l)->_rho_u - rho_u, rho_u);
-		DenseSubmatrix<Element> Tv (_T3, 0, rho_u, rho_u, N - i->_rho_v - rho_u);
+			DenseSubmatrix<Element> mu (uhatAvhatinv, 0, 0, rho_u, rho_u);
+			DenseSubmatrix<Element> Tu (_T2, rho_u, 0, N - (*l)->_rho_u - rho_u, rho_u);
+			DenseSubmatrix<Element> Tv (_T3, 0, rho_u, rho_u, N - i->_rho_v - rho_u);
 
-		TransposeMatrix<DenseSubmatrix<Element> > TuT (Tu);
+			TransposeMatrix<DenseSubmatrix<Element> > TuT (Tu);
 
-		(*l)->_sigma_u.append (_P, TuT, rho_u);
-		(*l)->_sigma_u.applyLast ((*l)->_u, false);
+			(*l)->_sigma_u.append (_P, TuT, rho_u);
+			(*l)->_sigma_u.applyLast ((*l)->_u, false);
 
-		i->_sigma_v.append (_Q, Tv, rho_u);
-		i->_sigma_v.applyLast (i->_v, false);
+			i->_sigma_v.append (_Q, Tv, rho_u);
+			i->_sigma_v.applyLast (i->_v, false);
 
-		DenseSubmatrix<Element> utildel ((*l)->_u, 0, (*l)->_rho_u, (*l)->_u.rowdim (), rho_u);
+			DenseSubmatrix<Element> utildel ((*l)->_u, 0, (*l)->_rho_u, (*l)->_u.rowdim (), rho_u);
 
-		for (j = l, ++j; j != _history.end (); ++j) {
+			for (j = l, ++j; j != _history.end (); ++j) {
 #ifdef LABL_DETAILED_TRACE
-			reportN << "u_" << (*j)->_iter << "^TAv_" << i->_iter << " before adjustment:" << std::endl;
-			_MD.write (reportN, *_uAv.get ((*j)->_iter, i->_iter));
-			reportN << "u_" << (*j)->_iter << "^TAv_" << i->_iter + 1 << " before adjustment:" << std::endl;
-			_MD.write (reportN, *_uAv.get ((*j)->_iter, i->_iter + 1));
+				reportN << "u_" << (*j)->_iter << "^TAv_" << i->_iter << " before adjustment:" << std::endl;
+				_MD.write (reportN, *_uAv.get ((*j)->_iter, i->_iter));
+				reportN << "u_" << (*j)->_iter << "^TAv_" << i->_iter + 1 << " before adjustment:" << std::endl;
+				_MD.write (reportN, *_uAv.get ((*j)->_iter, i->_iter + 1));
 #endif
 
-			DenseSubmatrix<Element> uhatj ((*j)->_u, 0, (*j)->_rho_u, (*j)->_u.rowdim (), N - (*j)->_rho_u);
+				DenseSubmatrix<Element> uhatj ((*j)->_u, 0, (*j)->_rho_u, (*j)->_u.rowdim (), N - (*j)->_rho_u);
 
-			_MD.copy (_T2, *_uAv.get ((*j)->_iter, i->_iter));
-			i->_sigma_v.apply (_T2, false);
-			_MD.copy (_T5, _T2);
-			(*j)->_sigma_u.apply (_T2, true);
+				_MD.copy (_T2, *_uAv.get ((*j)->_iter, i->_iter));
+				i->_sigma_v.apply (_T2, false);
+				_MD.copy (_T5, _T2);
+				(*j)->_sigma_u.apply (_T2, true);
 
-			DenseSubmatrix<Element> ujhatAvieta (_T2, (*j)->_rho_u, i->_rho_v, N - (*j)->_rho_u, rho_u);
+				DenseSubmatrix<Element> ujhatAvieta (_T2, (*j)->_rho_u, i->_rho_v, N - (*j)->_rho_u, rho_u);
 
-			if (!_MD.isZero (ujhatAvieta)) {
-				DenseSubmatrix<Element> ujhatAvietamu (_T3, 0, 0, N - (*j)->_rho_u, rho_u);
-				_MD.mul (ujhatAvietamu, ujhatAvieta, mu);
-				_MD.negin (ujhatAvietamu);
-				_MD.axpyin (uhatj, utildel, transpose (ujhatAvietamu));
+				if (!_MD.isZero (ujhatAvieta)) {
+					DenseSubmatrix<Element> ujhatAvietamu (_T3, 0, 0, N - (*j)->_rho_u, rho_u);
+					_MD.mul (ujhatAvietamu, ujhatAvieta, mu);
+					_MD.negin (ujhatAvietamu);
+					_MD.axpyin (uhatj, utildel, transpose (ujhatAvietamu));
+				}
+
+				_MD.copy (_T4, *_uAv.get ((*l)->_iter, i->_iter));
+				(*l)->_sigma_u.apply (_T4, true);
+
+				Matrix *ujAvietamu_block = newBlock ();
+				(*j)->_steps.push_back (ElimStep ());
+				(*j)->_steps.back ()._l = *l;
+				(*j)->_steps.back ()._l_iter = (*l)->_iter;
+				(*j)->_steps.back ()._ujAvkmu = ujAvietamu_block;
+				(*j)->_steps.back ()._rho = (*l)->_rho_u;
+				(*j)->_steps.back ()._rhop = rho_u;
+
+				DenseSubmatrix<Element> ultildeAvi (_T4, (*l)->_rho_u, 0, rho_u, N);
+				DenseSubmatrix<Element> ujAvieta (_T5, 0, i->_rho_v, N, rho_u);
+				DenseSubmatrix<Element> ujAvietamu (*ujAvietamu_block, 0, 0, N, rho_u);
+				_MD.mul (ujAvietamu, ujAvieta, mu);
+				_MD.negin (ujAvietamu);
+				_MD.axpyin (*_uAv.get ((*j)->_iter, i->_iter), ujAvietamu, ultildeAvi);
+
+				adjust_alphaAvip1 (j, (*j)->_steps.back (), i->_iter);
 			}
 
-			_MD.copy (_T4, *_uAv.get ((*l)->_iter, i->_iter));
-			(*l)->_sigma_u.apply (_T4, true);
-
-			Matrix *ujAvietamu_block = newBlock ();
-			(*j)->_steps.push_back (ElimStep ());
-			(*j)->_steps.back ()._l = *l;
-			(*j)->_steps.back ()._l_iter = (*l)->_iter;
-			(*j)->_steps.back ()._ujAvkmu = ujAvietamu_block;
-			(*j)->_steps.back ()._rho = (*l)->_rho_u;
-			(*j)->_steps.back ()._rhop = rho_u;
-
-			DenseSubmatrix<Element> ultildeAvi (_T4, (*l)->_rho_u, 0, rho_u, N);
-			DenseSubmatrix<Element> ujAvieta (_T5, 0, i->_rho_v, N, rho_u);
-			DenseSubmatrix<Element> ujAvietamu (*ujAvietamu_block, 0, 0, N, rho_u);
-			_MD.mul (ujAvietamu, ujAvieta, mu);
-			_MD.negin (ujAvietamu);
-			_MD.axpyin (*_uAv.get ((*j)->_iter, i->_iter), ujAvietamu, ultildeAvi);
-
-			adjust_alphaAvip1 (j, (*j)->_steps.back (), i->_iter);
-		}
+			if (*l != i) {
+				DenseSubmatrix<Element> zeta ((*l)->_vdot, 0, (*l)->_rho_u, (*l)->_vdot.rowdim (), rho_u);
+				DenseSubmatrix<Element> zeta_src (i->_v, 0, i->_rho_v, i->_v.rowdim (), rho_u);
+				DenseSubmatrix<Element> mu_dest ((*l)->_ubarAvdotinv, (*l)->_rho_u, (*l)->_rho_u, rho_u, rho_u);
 
-		if (*l != i) {
-			DenseSubmatrix<Element> zeta ((*l)->_vdot, 0, (*l)->_rho_u, (*l)->_vdot.rowdim (), rho_u);
-			DenseSubmatrix<Element> zeta_src (i->_v, 0, i->_rho_v, i->_v.rowdim (), rho_u);
-			DenseSubmatrix<Element> mu_dest ((*l)->_ubarAvdotinv, (*l)->_rho_u, (*l)->_rho_u, rho_u, rho_u);
+				_MD.copy (zeta, zeta_src);
+				_MD.copy (mu_dest, mu);
 
-			_MD.copy (zeta, zeta_src);
-			_MD.copy (mu_dest, mu);
-
-			augmentuAvldot (*l, i, _profile, rho_u);
-		}
+				augmentuAvldot (*l, i, _profile, rho_u);
+			}
 
-		DenseSubmatrix<Element> utildei ((*l)->_u, 0, (*l)->_rho_u, (*l)->_u.rowdim (), rho_u);
-		DenseSubmatrix<Element> utildei_dest (i->_udot, 0, i->_rho_v, i->_udot.rowdim (), rho_u);
+			DenseSubmatrix<Element> utildei ((*l)->_u, 0, (*l)->_rho_u, (*l)->_u.rowdim (), rho_u);
+			DenseSubmatrix<Element> utildei_dest (i->_udot, 0, i->_rho_v, i->_udot.rowdim (), rho_u);
 
-		_MD.copy (utildei_dest, utildei);
+			_MD.copy (utildei_dest, utildei);
 
-		augmentuidotAv (i, *l, rho_u);
+			augmentuidotAv (i, *l, rho_u);
 
-		DenseSubmatrix<Element> mu_dest (i->_udotAvbarinv, i->_rho_v, i->_rho_v, rho_u, rho_u);
+			DenseSubmatrix<Element> mu_dest (i->_udotAvbarinv, i->_rho_v, i->_rho_v, rho_u, rho_u);
 
-		_MD.copy (mu_dest, mu);
+			_MD.copy (mu_dest, mu);
 
 #ifdef LABL_DETAILED_TRACE
-		reportI << "u-rank of iterate " << (*l)->_iter << " before elimination: " << (*l)->_rho_u << std::endl;
-		reportI << "v-rank of iterate " << i->_iter << " before elimination: " << i->_rho_v << std::endl;
-		reportI << "Additional columns:                     " << rho_u << std::endl;
+			reportI << "u-rank of iterate " << (*l)->_iter << " before elimination: " << (*l)->_rho_u << std::endl;
+			reportI << "v-rank of iterate " << i->_iter << " before elimination: " << i->_rho_v << std::endl;
+			reportI << "Additional columns:                     " << rho_u << std::endl;
 
-		reportU << "sigma^u_" << (*l)->_iter << ":" << std::endl;
-		(*l)->_sigma_u.report (reportU);
+			reportU << "sigma^u_" << (*l)->_iter << ":" << std::endl;
+			(*l)->_sigma_u.report (reportU);
 
-		reportN << "Complete report on sigma^u_" << (*l)->_iter << ":" << std::endl;
-		(*l)->_sigma_u.reportComplete (reportN);
+			reportN << "Complete report on sigma^u_" << (*l)->_iter << ":" << std::endl;
+			(*l)->_sigma_u.reportComplete (reportN);
 
-		reportN << "sigma^v_" << i->_iter << ":" << std::endl;
-		i->_sigma_v.report (reportN);
+			reportN << "sigma^v_" << i->_iter << ":" << std::endl;
+			i->_sigma_v.report (reportN);
 
-		reportU << "Complete report on sigma^v_" << i->_iter << ":" << std::endl;
-		i->_sigma_v.reportComplete (reportU);
+			reportU << "Complete report on sigma^v_" << i->_iter << ":" << std::endl;
+			i->_sigma_v.reportComplete (reportU);
 #endif
-	}
+		}
 
-	if ((*l)->_rho_v < N) {
+		if ((*l)->_rho_v < N) {
 #ifdef LABL_DETAILED_TRACE
-		reportI << "Performing tail decomposition using u_" << i->_iter << "^TAv_" << (*l)->_iter << std::endl;
+			reportI << "Performing tail decomposition using u_" << i->_iter << "^TAv_" << (*l)->_iter << std::endl;
 #endif
 
-		// Step 5.2: Do inversion step for the v side
-		_MD.copy (_T1, *_uAv.get (i->_iter, (*l)->_iter));
-		i->_sigma_u.apply (_T1, true);
-		(*l)->_sigma_v.apply (_T1, false);
+			// Step 5.2: Do inversion step for the v side
+			_MD.copy (_T1, *_uAv.get (i->_iter, (*l)->_iter));
+			i->_sigma_u.apply (_T1, true);
+			(*l)->_sigma_v.apply (_T1, false);
 
-		DenseSubmatrix<Element> uhatAvhat (_T1, i->_rho_u, (*l)->_rho_v, N - i->_rho_u, N - (*l)->_rho_v);
+			DenseSubmatrix<Element> uhatAvhat (_T1, i->_rho_u, (*l)->_rho_v, N - i->_rho_u, N - (*l)->_rho_v);
 
 #ifdef LABL_DETAILED_TRACE
-		reportN << "ucheck_" << i->_iter << "^TAvcheck_" << (*l)->_iter << ":" << std::endl;
-		_MD.write (reportN, _T1);
+			reportN << "ucheck_" << i->_iter << "^TAvcheck_" << (*l)->_iter << ":" << std::endl;
+			_MD.write (reportN, _T1);
 
-		reportN << "uhat_" << i->_iter << "^TAvhat_" << (*l)->_iter << ":" << std::endl;
-		_MD.write (reportN, uhatAvhat);
+			reportN << "uhat_" << i->_iter << "^TAvhat_" << (*l)->_iter << ":" << std::endl;
+			_MD.write (reportN, uhatAvhat);
 #endif
 
-		DenseSubmatrix<Element> uhatAvhatinvT (_W, 0, 0, N - (*l)->_rho_v, N - (*l)->_rho_v);
+			DenseSubmatrix<Element> uhatAvhatinvT (_W, 0, 0, N - (*l)->_rho_v, N - (*l)->_rho_v);
 
-		_eliminator.gaussJordan (uhatAvhatinvT, _profile, _P, _T2, _Q, _T3, rho_v, d, transpose (uhatAvhat));
+			_eliminator.gaussJordan (uhatAvhatinvT, _profile, _P, _T2, _Q, _T3, rho_v, d, transpose (uhatAvhat));
 
-		DenseSubmatrix<Element> nu (uhatAvhatinvT, 0, 0, rho_v, rho_v);
-		DenseSubmatrix<Element> TuT (_T3, 0, rho_v, rho_v, N - i->_rho_u - rho_v);
-		DenseSubmatrix<Element> TvT (_T2, rho_v, 0, N - (*l)->_rho_v - rho_v, rho_v);
+			DenseSubmatrix<Element> nu (uhatAvhatinvT, 0, 0, rho_v, rho_v);
+			DenseSubmatrix<Element> TuT (_T3, 0, rho_v, rho_v, N - i->_rho_u - rho_v);
+			DenseSubmatrix<Element> TvT (_T2, rho_v, 0, N - (*l)->_rho_v - rho_v, rho_v);
 
-		TransposeMatrix<DenseSubmatrix<Element> > Tv (TvT);
+			TransposeMatrix<DenseSubmatrix<Element> > Tv (TvT);
 
-		(*l)->_sigma_v.append (_P, Tv, rho_v);
-		(*l)->_sigma_v.applyLast ((*l)->_v, false);
+			(*l)->_sigma_v.append (_P, Tv, rho_v);
+			(*l)->_sigma_v.applyLast ((*l)->_v, false);
 
-		i->_sigma_u.append (_Q, TuT, rho_v);
-		i->_sigma_u.applyLast (i->_u, false);
+			i->_sigma_u.append (_Q, TuT, rho_v);
+			i->_sigma_u.applyLast (i->_u, false);
 
-		DenseSubmatrix<Element> vtildel ((*l)->_v, 0, (*l)->_rho_v, (*l)->_v.rowdim (), rho_v);
+			DenseSubmatrix<Element> vtildel ((*l)->_v, 0, (*l)->_rho_v, (*l)->_v.rowdim (), rho_v);
 
-		for (j = l, ++j; j != _history.end (); ++j) {
+			for (j = l, ++j; j != _history.end (); ++j) {
 #ifdef LABL_DETAILED_TRACE
-			reportN << "u_" << i->_iter << "^TAv_" << (*j)->_iter << " before adjustment:" << std::endl;
-			_MD.write (reportN, *_uAv.get (i->_iter, (*j)->_iter));
-			reportN << "u_" << i->_iter + 1 << "^TAv_" << (*j)->_iter << " before adjustment:" << std::endl;
-			_MD.write (reportN, *_uAv.get (i->_iter + 1, (*j)->_iter));
+				reportN << "u_" << i->_iter << "^TAv_" << (*j)->_iter << " before adjustment:" << std::endl;
+				_MD.write (reportN, *_uAv.get (i->_iter, (*j)->_iter));
+				reportN << "u_" << i->_iter + 1 << "^TAv_" << (*j)->_iter << " before adjustment:" << std::endl;
+				_MD.write (reportN, *_uAv.get (i->_iter + 1, (*j)->_iter));
 #endif
 
-			DenseSubmatrix<Element> vhatj ((*j)->_v, 0, (*j)->_rho_v, (*j)->_v.rowdim (), N - (*j)->_rho_v);
+				DenseSubmatrix<Element> vhatj ((*j)->_v, 0, (*j)->_rho_v, (*j)->_v.rowdim (), N - (*j)->_rho_v);
 
-			_MD.copy (_T2, *_uAv.get (i->_iter, (*j)->_iter));
-			i->_sigma_u.apply (_T2, true);
-			_MD.copy (_T5, _T2);
-			(*j)->_sigma_v.apply (_T2, false);
+				_MD.copy (_T2, *_uAv.get (i->_iter, (*j)->_iter));
+				i->_sigma_u.apply (_T2, true);
+				_MD.copy (_T5, _T2);
+				(*j)->_sigma_v.apply (_T2, false);
 
-			DenseSubmatrix<Element> uizetaAjhat (_T2, i->_rho_u, (*j)->_rho_v, rho_v, N - (*j)->_rho_v);
+				DenseSubmatrix<Element> uizetaAjhat (_T2, i->_rho_u, (*j)->_rho_v, rho_v, N - (*j)->_rho_v);
 
-			if (!_MD.isZero (uizetaAjhat)) {
-				DenseSubmatrix<Element> nuTuizetaAjhat (_T3, 0, 0, rho_v, N - (*j)->_rho_v);
-				_MD.mul (nuTuizetaAjhat, transpose (nu), uizetaAjhat);
-				_MD.negin (nuTuizetaAjhat);
-				_MD.axpyin (vhatj, vtildel, nuTuizetaAjhat);
-			}
+				if (!_MD.isZero (uizetaAjhat)) {
+					DenseSubmatrix<Element> nuTuizetaAjhat (_T3, 0, 0, rho_v, N - (*j)->_rho_v);
+					_MD.mul (nuTuizetaAjhat, transpose (nu), uizetaAjhat);
+					_MD.negin (nuTuizetaAjhat);
+					_MD.axpyin (vhatj, vtildel, nuTuizetaAjhat);
+				}
 
-			_MD.copy (_T4, *_uAv.get (i->_iter, (*l)->_iter));
-			(*l)->_sigma_v.apply (_T4, false);
-
-			Matrix *nuukAvj_block = newBlock ();
-			(*j)->_steps.push_back (ElimStep ());
-			(*j)->_steps.back ()._l = *l;
-			(*j)->_steps.back ()._l_iter = (*l)->_iter;
-			(*j)->_steps.back ()._nuukAvj = nuukAvj_block;
-			(*j)->_steps.back ()._rho = (*l)->_rho_v;
-			(*j)->_steps.back ()._rhop = rho_v;
-
-			DenseSubmatrix<Element> uiAvltilde (_T4, 0, (*l)->_rho_v, N, rho_v);
-			DenseSubmatrix<Element> uizetaAvj (_T5, i->_rho_u, 0, rho_v, N);
-			DenseSubmatrix<Element> nuTuizetaAvj (*nuukAvj_block, 0, 0, rho_v, N);
-			_MD.mul (nuTuizetaAvj, transpose (nu), uizetaAvj);
-			_MD.negin (nuTuizetaAvj);
-			_MD.axpyin (*_uAv.get (i->_iter, (*j)->_iter), uiAvltilde, nuTuizetaAvj);
-
-			adjust_uip1Abeta (j, (*j)->_steps.back (), i->_iter);
-		}
+				_MD.copy (_T4, *_uAv.get (i->_iter, (*l)->_iter));
+				(*l)->_sigma_v.apply (_T4, false);
+
+				Matrix *nuukAvj_block = newBlock ();
+				(*j)->_steps.push_back (ElimStep ());
+				(*j)->_steps.back ()._l = *l;
+				(*j)->_steps.back ()._l_iter = (*l)->_iter;
+				(*j)->_steps.back ()._nuukAvj = nuukAvj_block;
+				(*j)->_steps.back ()._rho = (*l)->_rho_v;
+				(*j)->_steps.back ()._rhop = rho_v;
+
+				DenseSubmatrix<Element> uiAvltilde (_T4, 0, (*l)->_rho_v, N, rho_v);
+				DenseSubmatrix<Element> uizetaAvj (_T5, i->_rho_u, 0, rho_v, N);
+				DenseSubmatrix<Element> nuTuizetaAvj (*nuukAvj_block, 0, 0, rho_v, N);
+				_MD.mul (nuTuizetaAvj, transpose (nu), uizetaAvj);
+				_MD.negin (nuTuizetaAvj);
+				_MD.axpyin (*_uAv.get (i->_iter, (*j)->_iter), uiAvltilde, nuTuizetaAvj);
+
+				adjust_uip1Abeta (j, (*j)->_steps.back (), i->_iter);
+			}
 
-		if (*l != i) {
-			DenseSubmatrix<Element> eta ((*l)->_udot, 0, (*l)->_rho_v, (*l)->_udot.rowdim (), rho_v);
-			DenseSubmatrix<Element> eta_src (i->_u, 0, i->_rho_u, i->_u.rowdim (), rho_v);
-			DenseSubmatrix<Element> nu_dest ((*l)->_udotAvbarinv, (*l)->_rho_v, (*l)->_rho_v, rho_v, rho_v);
+			if (*l != i) {
+				DenseSubmatrix<Element> eta ((*l)->_udot, 0, (*l)->_rho_v, (*l)->_udot.rowdim (), rho_v);
+				DenseSubmatrix<Element> eta_src (i->_u, 0, i->_rho_u, i->_u.rowdim (), rho_v);
+				DenseSubmatrix<Element> nu_dest ((*l)->_udotAvbarinv, (*l)->_rho_v, (*l)->_rho_v, rho_v, rho_v);
 
-			_MD.copy (eta, eta_src);
-			_MD.copy (nu_dest, transpose (nu));
+				_MD.copy (eta, eta_src);
+				_MD.copy (nu_dest, transpose (nu));
 
-			augmentuldotAv (*l, i, _profile, rho_v);
-		}
+				augmentuldotAv (*l, i, _profile, rho_v);
+			}
 
-		DenseSubmatrix<Element> vtildei ((*l)->_v, 0, (*l)->_rho_v, (*l)->_v.rowdim (), rho_v);
-		DenseSubmatrix<Element> vtildei_dest (i->_vdot, 0, i->_rho_u, i->_vdot.rowdim (), rho_v);
+			DenseSubmatrix<Element> vtildei ((*l)->_v, 0, (*l)->_rho_v, (*l)->_v.rowdim (), rho_v);
+			DenseSubmatrix<Element> vtildei_dest (i->_vdot, 0, i->_rho_u, i->_vdot.rowdim (), rho_v);
 
-		_MD.copy (vtildei_dest, vtildei);
+			_MD.copy (vtildei_dest, vtildei);
 
-		augmentuAvidot (i, *l, rho_v);
+			augmentuAvidot (i, *l, rho_v);
 
-		DenseSubmatrix<Element> nu_dest (i->_ubarAvdotinv, i->_rho_u, i->_rho_u, rho_v, rho_v);
+			DenseSubmatrix<Element> nu_dest (i->_ubarAvdotinv, i->_rho_u, i->_rho_u, rho_v, rho_v);
 
-		_MD.copy (nu_dest, transpose (nu));
+			_MD.copy (nu_dest, transpose (nu));
 
 #ifdef LABL_DETAILED_TRACE
-		reportI << "v-rank of iterate " << (*l)->_iter << " before elimination: " << (*l)->_rho_v << std::endl;
-		reportI << "u-rank of iterate " << i->_iter << " before elimination: " << i->_rho_u << std::endl;
-		reportI << "Additional columns:                     " << rho_v << std::endl;
+			reportI << "v-rank of iterate " << (*l)->_iter << " before elimination: " << (*l)->_rho_v << std::endl;
+			reportI << "u-rank of iterate " << i->_iter << " before elimination: " << i->_rho_u << std::endl;
+			reportI << "Additional columns:                     " << rho_v << std::endl;
 
-		reportN << "sigma^v_" << (*l)->_iter << ":" << std::endl;
-		(*l)->_sigma_v.report (reportN);
+			reportN << "sigma^v_" << (*l)->_iter << ":" << std::endl;
+			(*l)->_sigma_v.report (reportN);
 
-		reportU << "Complete report on sigma^v_" << (*l)->_iter << ":" << std::endl;
-		(*l)->_sigma_v.reportComplete (reportU);
+			reportU << "Complete report on sigma^v_" << (*l)->_iter << ":" << std::endl;
+			(*l)->_sigma_v.reportComplete (reportU);
 
-		reportN << "sigma^u_" << i->_iter << ":" << std::endl;
-		i->_sigma_u.report (reportN);
+			reportN << "sigma^u_" << i->_iter << ":" << std::endl;
+			i->_sigma_u.report (reportN);
 
-		reportU << "Complete report on sigma^u_" << (*l)->_iter << ":" << std::endl;
-		i->_sigma_u.reportComplete (reportU);
+			reportU << "Complete report on sigma^u_" << (*l)->_iter << ":" << std::endl;
+			i->_sigma_u.reportComplete (reportU);
 #endif
-	}
+		}
 
-	if (*l != i) {
-		(*l)->_rho_u += rho_u;
-		(*l)->_rho_v += rho_v;
-	}
+		if (*l != i) {
+			(*l)->_rho_u += rho_u;
+			(*l)->_rho_v += rho_v;
+		}
 
-	i->_rho_v += rho_u;
-	i->_rho_u += rho_v;
+		i->_rho_v += rho_u;
+		i->_rho_u += rho_v;
 
 #ifdef LABL_DETAILED_TRACE
-	commentator.stop ("done", NULL, "LABlockLanczosSolver::tailDecomp");
+		commentator.stop ("done", NULL, "LABlockLanczosSolver::tailDecomp");
 #endif
-}
+	}
 
-
 
-template <class Field, class Matrix>
-void LABlockLanczosSolver<Field, Matrix>::cleanup (bool all)
-{
-	typename std::list<Iterate *>::iterator l = _history.begin (), second;
 
-	const unsigned int N = _traits.blockingFactor ();
+	template <class Field, class Matrix>
+	void LABlockLanczosSolver<Field, Matrix>::cleanup (bool all)
+	{
+		typename std::list<Iterate *>::iterator l = _history.begin (), second;
+
+		const unsigned int N = _traits.blockingFactor ();
 
 #ifdef LABL_DETAILED_TRACE
-	int discard_count = 0;
+		int discard_count = 0;
 
-	std::ostream &reportI = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-//	std::ostream &reportU = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+		std::ostream &reportI = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+		//	std::ostream &reportU = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
 #endif
 
-	if ((*l)->_rho_u < N || (*l)->_rho_v < N)
-		return;
+		if ((*l)->_rho_u < N || (*l)->_rho_v < N)
+			return;
 
-	second = l; ++second;
+		second = l; ++second;
 
-	while ((all && l != _history.end ()) ||
-	       (second != _history.end () && (*second)->_rho_u == N && (*second)->_rho_v == N))
-	{
-		// Step 4: Update solution x
-		DenseSubmatrix<Element> T1 (_T1, 0, 0, N, _b.coldim ());
-		DenseSubmatrix<Element> T2 (_T2, 0, 0, N, _b.coldim ());
+		while ((all && l != _history.end ()) ||
+		       (second != _history.end () && (*second)->_rho_u == N && (*second)->_rho_v == N))
+		{
+			// Step 4: Update solution x
+			DenseSubmatrix<Element> T1 (_T1, 0, 0, N, _b.coldim ());
+			DenseSubmatrix<Element> T2 (_T2, 0, 0, N, _b.coldim ());
 
-		_MD.mul (T1, transpose ((*l)->_u), _b);
-		_MD.mul (T2, (*l)->_ubarAvdotinv, T1);
-		_MD.axpyin (_x, (*l)->_vdot, T2);
+			_MD.mul (T1, transpose ((*l)->_u), _b);
+			_MD.mul (T2, (*l)->_ubarAvdotinv, T1);
+			_MD.axpyin (_x, (*l)->_vdot, T2);
 
-		typename std::list<ElimStep>::iterator it;
+			typename std::list<ElimStep>::iterator it;
 
-		for (it = (*l)->_steps.begin (); it != (*l)->_steps.end (); ++it) {
-			if (it->_ujAvkmu != NULL)
-				_ip_trashcan.push (it->_ujAvkmu);
-			if (it->_nuukAvj != NULL)
-				_ip_trashcan.push (it->_nuukAvj);
-		}
+			for (it = (*l)->_steps.begin (); it != (*l)->_steps.end (); ++it) {
+				if (it->_ujAvkmu != NULL)
+					_ip_trashcan.push (it->_ujAvkmu);
+				if (it->_nuukAvj != NULL)
+					_ip_trashcan.push (it->_nuukAvj);
+			}
 
-		(*l)->_steps.clear ();
+			(*l)->_steps.clear ();
 
-		_uAv.contract ();
+			_uAv.contract ();
 
-		_it_trashcan.push (*l);
+			_it_trashcan.push (*l);
 
-		// Estimate of the rank
-		_rank += (*l)->_rho_v;
+			// Estimate of the rank
+			_rank += (*l)->_rho_v;
 
 #ifdef LABL_DETAILED_TRACE
-		++discard_count;
+			++discard_count;
 #endif
-		++l;
-		if (!all) ++second;
-	}
+			++l;
+			if (!all) ++second;
+		}
 
-	_history.erase (_history.begin (), l);
+		_history.erase (_history.begin (), l);
 
 #ifdef LABL_DETAILED_TRACE
-	reportI << "Finished with cleanup: "
+		reportI << "Finished with cleanup: "
 		<< discard_count << " iterate(s) discarded" << std::endl
 		<< "History contents: ";
 
-	for (l = _history.begin (); l != _history.end (); ++l)
-		reportI << (*l)->_iter << " ";
+		for (l = _history.begin (); l != _history.end (); ++l)
+			reportI << (*l)->_iter << " ";
 
-	reportI << std::endl;
-#endif	
-}
+		reportI << std::endl;
+#endif
+	}
 
-template <class Field, class Matrix>
-typename LABlockLanczosSolver<Field, Matrix>::Iterate *
-LABlockLanczosSolver<Field, Matrix>::getNextIterate (unsigned int iter) 
-{
-	Iterate *ret;
+	template <class Field, class Matrix>
+	typename LABlockLanczosSolver<Field, Matrix>::Iterate *
+	LABlockLanczosSolver<Field, Matrix>::getNextIterate (unsigned int iter)
+	{
+		Iterate *ret;
 
-	if (_it_trashcan.empty ()) {
+		if (_it_trashcan.empty ()) {
 #ifdef LABL_DETAILED_TRACE
-		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION)
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION)
 			<< "Allocating new iterate structure..." << std::endl;
 #endif
-		ret = new Iterate (*this, _x.rowdim (), _traits.blockingFactor (), iter);
-		return ret;
-	} else {
+			ret = new Iterate (*this, _x.rowdim (), _traits.blockingFactor (), iter);
+			return ret;
+		}
+		else {
 #ifdef LABL_DETAILED_TRACE
-		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION)
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION)
 			<< "Taking iterate structure from trash can..." << std::endl;
 #endif
-		ret = _it_trashcan.top ();
-		_it_trashcan.pop ();
-		ret->init (iter);
-		_MD.subin (ret->_udotAvbarinv, ret->_udotAvbarinv);
-		_MD.subin (ret->_ubarAvdotinv, ret->_ubarAvdotinv);
-		return ret;
+			ret = _it_trashcan.top ();
+			_it_trashcan.pop ();
+			ret->init (iter);
+			_MD.subin (ret->_udotAvbarinv, ret->_udotAvbarinv);
+			_MD.subin (ret->_ubarAvdotinv, ret->_ubarAvdotinv);
+			return ret;
+		}
 	}
-}
 
-
 
-template <class Field, class Matrix>
-void LABlockLanczosSolver<Field, Matrix>::adjust_uip1Abeta
+
+	template <class Field, class Matrix>
+	void LABlockLanczosSolver<Field, Matrix>::adjust_uip1Abeta
 	(typename std::list<Iterate *>::iterator j,
 	 ElimStep &step,
 	 unsigned int iter)
-{
-	const unsigned int N = _traits.blockingFactor ();
+	{
+		const unsigned int N = _traits.blockingFactor ();
 
-	if (step._nuukAvj == NULL || step._l_iter < _history.front ()->_iter)
-		return;
+		if (step._nuukAvj == NULL || step._l_iter < _history.front ()->_iter)
+			return;
 
 #ifdef LABL_DETAILED_TRACE
-	std::ostream &report = commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION);
-	report << "Adjustment from iterate " << step._l->_iter << " for iterate " << (*j)->_iter << std::endl;
-	report << "Block is: " << std::endl;
-	_MD.write (report, *step._nuukAvj);
-	report << "Start: " << step._rho << std::endl;
-	report << "Length: " << step._rhop << std::endl;
+		std::ostream &report = commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION);
+		report << "Adjustment from iterate " << step._l->_iter << " for iterate " << (*j)->_iter << std::endl;
+		report << "Block is: " << std::endl;
+		_MD.write (report, *step._nuukAvj);
+		report << "Start: " << step._rho << std::endl;
+		report << "Length: " << step._rhop << std::endl;
 #endif
 
-	DenseSubmatrix<Element> nuukAvj (*step._nuukAvj, 0, 0, step._rhop, N);
+		DenseSubmatrix<Element> nuukAvj (*step._nuukAvj, 0, 0, step._rhop, N);
 
-	_MD.copy (_T1, *_uAv.get (iter + 1, step._l->_iter));
-	step._l->_sigma_v.apply (_T1, false);
+		_MD.copy (_T1, *_uAv.get (iter + 1, step._l->_iter));
+		step._l->_sigma_v.apply (_T1, false);
 
-	DenseSubmatrix<Element> uip1Avltilde (_T1, 0, step._rho, N, step._rhop);
+		DenseSubmatrix<Element> uip1Avltilde (_T1, 0, step._rho, N, step._rhop);
 
-	_MD.axpyin (*_uAv.get (iter + 1, (*j)->_iter), uip1Avltilde, nuukAvj);
-}
+		_MD.axpyin (*_uAv.get (iter + 1, (*j)->_iter), uip1Avltilde, nuukAvj);
+	}
 
-template <class Field, class Matrix>
-void LABlockLanczosSolver<Field, Matrix>::compute_uip1Abeta (typename std::list<Iterate *>::iterator j, unsigned int iter)
-{
+	template <class Field, class Matrix>
+	void LABlockLanczosSolver<Field, Matrix>::compute_uip1Abeta (typename std::list<Iterate *>::iterator j, unsigned int iter)
+	{
 #ifdef LABL_DETAILED_TRACE
-	commentator.start ("Applying history to u_{i+1}^TAv_j", "compute_uip1Abeta");
+		commentator.start ("Applying history to u_{i+1}^TAv_j", "compute_uip1Abeta");
 #endif
 
-	typename std::list<ElimStep>::iterator l;
+		typename std::list<ElimStep>::iterator l;
 
-	for (l = (*j)->_steps.begin (); l != (*j)->_steps.end (); ++l)
-		adjust_uip1Abeta (j, *l, iter);
+		for (l = (*j)->_steps.begin (); l != (*j)->_steps.end (); ++l)
+			adjust_uip1Abeta (j, *l, iter);
 
 #ifdef LABL_DETAILED_TRACE
-	commentator.stop ("done", NULL, "compute_uip1Abeta");
+		commentator.stop ("done", NULL, "compute_uip1Abeta");
 #endif
-}
+	}
 
-template <class Field, class Matrix>
-void LABlockLanczosSolver<Field, Matrix>::adjust_alphaAvip1
+	template <class Field, class Matrix>
+	void LABlockLanczosSolver<Field, Matrix>::adjust_alphaAvip1
 	(typename std::list<Iterate *>::iterator j,
 	 ElimStep &step,
 	 unsigned int iter)
-{
-	const unsigned int N = _traits.blockingFactor ();
+	{
+		const unsigned int N = _traits.blockingFactor ();
 
-	if (step._ujAvkmu == NULL || step._l_iter < _history.front ()->_iter)
-		return;
+		if (step._ujAvkmu == NULL || step._l_iter < _history.front ()->_iter)
+			return;
 
 #ifdef LABL_DETAILED_TRACE
-	std::ostream &report = commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION);
-	report << "Adjustment from iterate " << step._l->_iter << " for iterate " << (*j)->_iter << std::endl;
-	report << "Block is: " << std::endl;
-	_MD.write (report, *step._ujAvkmu);
-	report << "Start: " << step._rho << std::endl;
-	report << "Length: " << step._rhop << std::endl;
+		std::ostream &report = commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION);
+		report << "Adjustment from iterate " << step._l->_iter << " for iterate " << (*j)->_iter << std::endl;
+		report << "Block is: " << std::endl;
+		_MD.write (report, *step._ujAvkmu);
+		report << "Start: " << step._rho << std::endl;
+		report << "Length: " << step._rhop << std::endl;
 #endif
 
-	DenseSubmatrix<Element> ujAvkmu (*step._ujAvkmu, 0, 0, N, step._rhop);
+		DenseSubmatrix<Element> ujAvkmu (*step._ujAvkmu, 0, 0, N, step._rhop);
 
-	_MD.copy (_T1, *_uAv.get (step._l->_iter, iter + 1));
-	step._l->_sigma_u.apply (_T1, true);
+		_MD.copy (_T1, *_uAv.get (step._l->_iter, iter + 1));
+		step._l->_sigma_u.apply (_T1, true);
 
-	DenseSubmatrix<Element> ultildeAvip1 (_T1, step._rho, 0, step._rhop, N);
+		DenseSubmatrix<Element> ultildeAvip1 (_T1, step._rho, 0, step._rhop, N);
 
-	_MD.axpyin (*_uAv.get ((*j)->_iter, iter + 1), ujAvkmu, ultildeAvip1);
-}
+		_MD.axpyin (*_uAv.get ((*j)->_iter, iter + 1), ujAvkmu, ultildeAvip1);
+	}
 
-template <class Field, class Matrix>
-void LABlockLanczosSolver<Field, Matrix>::compute_alphaAvip1 (typename std::list<Iterate *>::iterator j, unsigned int iter)
-{
+	template <class Field, class Matrix>
+	void LABlockLanczosSolver<Field, Matrix>::compute_alphaAvip1 (typename std::list<Iterate *>::iterator j, unsigned int iter)
+	{
 #ifdef LABL_DETAILED_TRACE
-	commentator.start ("Applying history to u_j^TAv_{i+1}", "compute_alphaAvip1");
+		commentator.start ("Applying history to u_j^TAv_{i+1}", "compute_alphaAvip1");
 #endif
 
-	typename std::list<ElimStep>::iterator l;
+		typename std::list<ElimStep>::iterator l;
 
-	for (l = (*j)->_steps.begin (); l != (*j)->_steps.end (); ++l)
-		adjust_alphaAvip1 (j, *l, iter);
+		for (l = (*j)->_steps.begin (); l != (*j)->_steps.end (); ++l)
+			adjust_alphaAvip1 (j, *l, iter);
 
 #ifdef LABL_DETAILED_TRACE
-	commentator.stop ("done", NULL, "compute_alphaAvip1");
+		commentator.stop ("done", NULL, "compute_alphaAvip1");
 #endif
-}
+	}
+
 
-
 
-template <class Field, class Matrix>
-void LABlockLanczosSolver<Field, Matrix>::augmentuidotAv
+	template <class Field, class Matrix>
+	void LABlockLanczosSolver<Field, Matrix>::augmentuidotAv
 	(Iterate      *i,
 	 Iterate      *l,
 	 unsigned int  rho)
-{
-	const unsigned int N = _traits.blockingFactor ();
+	{
+		const unsigned int N = _traits.blockingFactor ();
 
-	_MD.copy (_T1, *_uAv.get (l->_iter, i->_iter));
-	l->_sigma_u.apply (_T1, true);
+		_MD.copy (_T1, *_uAv.get (l->_iter, i->_iter));
+		l->_sigma_u.apply (_T1, true);
 
-	DenseSubmatrix<Element> utildeAv (_T1, l->_rho_u, 0, rho, N);
-	DenseSubmatrix<Element> utildeAv_dest (i->_udotAv, i->_rho_v, 0, rho, N);
+		DenseSubmatrix<Element> utildeAv (_T1, l->_rho_u, 0, rho, N);
+		DenseSubmatrix<Element> utildeAv_dest (i->_udotAv, i->_rho_v, 0, rho, N);
 
-	_MD.copy (utildeAv_dest, utildeAv);
-}
+		_MD.copy (utildeAv_dest, utildeAv);
+	}
 
-template <class Field, class Matrix>
-void LABlockLanczosSolver<Field, Matrix>::augmentuAvidot
+	template <class Field, class Matrix>
+	void LABlockLanczosSolver<Field, Matrix>::augmentuAvidot
 	(Iterate      *i,
 	 Iterate      *l,
 	 unsigned int  rho)
-{
-	const unsigned int N = _traits.blockingFactor ();
+	{
+		const unsigned int N = _traits.blockingFactor ();
 
-	_MD.copy (_T1, *_uAv.get (i->_iter, l->_iter));
-	l->_sigma_v.apply (_T1, false);
+		_MD.copy (_T1, *_uAv.get (i->_iter, l->_iter));
+		l->_sigma_v.apply (_T1, false);
 
-	DenseSubmatrix<Element> uAvtilde (_T1, 0, l->_rho_v, N, rho);
-	DenseSubmatrix<Element> uAvtilde_dest (i->_uAvdot, 0, i->_rho_u, N, rho);
+		DenseSubmatrix<Element> uAvtilde (_T1, 0, l->_rho_v, N, rho);
+		DenseSubmatrix<Element> uAvtilde_dest (i->_uAvdot, 0, i->_rho_u, N, rho);
 
-	_MD.copy (uAvtilde_dest, uAvtilde);
-}
+		_MD.copy (uAvtilde_dest, uAvtilde);
+	}
 
-template <class Field, class Matrix>
-void LABlockLanczosSolver<Field, Matrix>::augmentuldotAv
+	template <class Field, class Matrix>
+	void LABlockLanczosSolver<Field, Matrix>::augmentuldotAv
 	(Iterate                   *l,
 	 Iterate                   *i,
 	 std::vector<unsigned int> &profile,
 	 unsigned int               rho)
-{
-	DenseSubmatrix<Element> zeta (l->_udotAv, l->_rho_v, 0, rho, l->_v.coldim ());
-	_MD.copy (_T1, *_uAv.get (i->_iter, l->_iter));
-	i->_sigma_u.apply (_T1, true);
-	DenseSubmatrix<Element> zeta_src (_T1, i->_rho_u, 0, rho, _T1.coldim ());
-	_MD.copy (zeta, zeta_src);
-}
-
-template <class Field, class Matrix>
-void LABlockLanczosSolver<Field, Matrix>::augmentuAvldot
+	{
+		DenseSubmatrix<Element> zeta (l->_udotAv, l->_rho_v, 0, rho, l->_v.coldim ());
+		_MD.copy (_T1, *_uAv.get (i->_iter, l->_iter));
+		i->_sigma_u.apply (_T1, true);
+		DenseSubmatrix<Element> zeta_src (_T1, i->_rho_u, 0, rho, _T1.coldim ());
+		_MD.copy (zeta, zeta_src);
+	}
+
+	template <class Field, class Matrix>
+	void LABlockLanczosSolver<Field, Matrix>::augmentuAvldot
 	(Iterate                   *l,
 	 Iterate                   *i,
 	 std::vector<unsigned int> &profile,
 	 unsigned int               rho)
-{
-	DenseSubmatrix<Element> zeta (l->_uAvdot, 0, l->_rho_u, l->_u.coldim (), rho);
-	_MD.copy (_T1, *_uAv.get (l->_iter, i->_iter));
-	i->_sigma_v.apply (_T1, false);
-	DenseSubmatrix<Element> zeta_src (_T1, 0, i->_rho_v, _T1.coldim (), rho);
-	_MD.copy (zeta, zeta_src);
-}
-
-template <class Field, class Matrix>
-template <class Matrix1, class Matrix2>
-void LABlockLanczosSolver<Field, Matrix>::extractMinor
+	{
+		DenseSubmatrix<Element> zeta (l->_uAvdot, 0, l->_rho_u, l->_u.coldim (), rho);
+		_MD.copy (_T1, *_uAv.get (l->_iter, i->_iter));
+		i->_sigma_v.apply (_T1, false);
+		DenseSubmatrix<Element> zeta_src (_T1, 0, i->_rho_v, _T1.coldim (), rho);
+		_MD.copy (zeta, zeta_src);
+	}
+
+	template <class Field, class Matrix>
+	template <class Matrix1, class Matrix2>
+	void LABlockLanczosSolver<Field, Matrix>::extractMinor
 	(Matrix1                   &M,
 	 Matrix2                   &M1,
 	 std::vector<unsigned int> &profile)
-{
-	std::vector<unsigned int>::const_iterator i;
-	typename Matrix1::ColIterator ci = M.colBegin ();
+	{
+		std::vector<unsigned int>::const_iterator i;
+		typename Matrix1::ColIterator ci = M.colBegin ();
 
-	for (i = profile.begin (); i != profile.end (); ++i) {
-		typename Matrix2::Column src = *(M1.colBegin () + *i);
-		_VD.copy (*ci, src);
-		++ci;
+		for (i = profile.begin (); i != profile.end (); ++i) {
+			typename Matrix2::Column src = *(M1.colBegin () + *i);
+			_VD.copy (*ci, src);
+			++ci;
+		}
 	}
-}
 
-
 
-template <class Field, class Matrix>
-template <class Matrix1>
-void LABlockLanczosSolver<Field, Matrix>::BasisTransformation::applyOne
-	(Matrix1 &M, Permutation &P, Matrix *T, unsigned int rho, unsigned int s, bool left) 
-{
-	if (left) {
-		DenseSubmatrix<Element> Mcheck (M, s, 0, _N - s, M.coldim ());
 
-		_solver._MD.permuteRows (Mcheck, P.begin (), P.end ());
+	template <class Field, class Matrix>
+	template <class Matrix1>
+	void LABlockLanczosSolver<Field, Matrix>::BasisTransformation::applyOne
+	(Matrix1 &M, Permutation &P, Matrix *T, unsigned int rho, unsigned int s, bool left)
+	{
+		if (left) {
+			DenseSubmatrix<Element> Mcheck (M, s, 0, _N - s, M.coldim ());
 
-		DenseSubmatrix<Element> Mbar (M, s, 0, rho, M.coldim ());
-		DenseSubmatrix<Element> Mhat (M, s + rho, 0, _N - s - rho, M.coldim ());
+			_solver._MD.permuteRows (Mcheck, P.begin (), P.end ());
 
-		DenseSubmatrix<Element> That (*T, _N - rho, s + rho, rho, _N - s - rho);
-	
-		_solver._MD.axpyin (Mhat, transpose (That), Mbar);
-	} else {
-		DenseSubmatrix<Element> Mcheck (M, 0, s, M.rowdim (), _N - s);
+			DenseSubmatrix<Element> Mbar (M, s, 0, rho, M.coldim ());
+			DenseSubmatrix<Element> Mhat (M, s + rho, 0, _N - s - rho, M.coldim ());
 
-		_solver._MD.permuteColumns (Mcheck, P.begin (), P.end ());
+			DenseSubmatrix<Element> That (*T, _N - rho, s + rho, rho, _N - s - rho);
 
-		DenseSubmatrix<Element> Mbar (M, 0, s, M.rowdim (), rho);
-		DenseSubmatrix<Element> Mhat (M, 0, s + rho, M.rowdim (), _N - s - rho);
+			_solver._MD.axpyin (Mhat, transpose (That), Mbar);
+		}
+		else {
+			DenseSubmatrix<Element> Mcheck (M, 0, s, M.rowdim (), _N - s);
 
-		DenseSubmatrix<Element> That (*T, _N - rho, s + rho, rho, _N - s - rho);
-	
-		_solver._MD.axpyin (Mhat, Mbar, That);
-	}
-}
+			_solver._MD.permuteColumns (Mcheck, P.begin (), P.end ());
 
-template <class Field, class Matrix>
-template <class Matrix1>
-Matrix1 &LABlockLanczosSolver<Field, Matrix>::BasisTransformation::apply (Matrix1 &M, bool left)
-{
-	linbox_check (M.coldim () == _N);
+			DenseSubmatrix<Element> Mbar (M, 0, s, M.rowdim (), rho);
+			DenseSubmatrix<Element> Mhat (M, 0, s + rho, M.rowdim (), _N - s - rho);
 
-	typename std::vector<Permutation>::iterator Pi = _P.begin ();
-	typename std::vector<Matrix *>::iterator Ti = _T.begin ();
-	typename std::vector<unsigned int>::iterator rhoi = _rho.begin ();
-	typename std::vector<unsigned int>::iterator si = _s.begin ();
+			DenseSubmatrix<Element> That (*T, _N - rho, s + rho, rho, _N - s - rho);
 
-	while (Ti != _T.end ()) {
-		applyOne (M, *Pi, *Ti, *rhoi, *si, left);
-		++Pi; ++Ti; ++rhoi; ++si;
+			_solver._MD.axpyin (Mhat, Mbar, That);
+		}
 	}
 
-	return M;
-}
+	template <class Field, class Matrix>
+	template <class Matrix1>
+	Matrix1 &LABlockLanczosSolver<Field, Matrix>::BasisTransformation::apply (Matrix1 &M, bool left)
+	{
+		linbox_check (M.coldim () == _N);
 
-template <class Field, class Matrix>
-template <class Matrix1>
-Matrix1 &LABlockLanczosSolver<Field, Matrix>::BasisTransformation::applyPermutation (Matrix1 &M, bool left)
-{
-	linbox_check (M.coldim () == _N);
+		typename std::vector<Permutation>::iterator Pi = _P.begin ();
+		typename std::vector<Matrix *>::iterator Ti = _T.begin ();
+		typename std::vector<unsigned int>::iterator rhoi = _rho.begin ();
+		typename std::vector<unsigned int>::iterator si = _s.begin ();
 
-	typename std::vector<unsigned int>::iterator si;
-	typename std::vector<Permutation>::iterator Pi;
+		while (Ti != _T.end ()) {
+			applyOne (M, *Pi, *Ti, *rhoi, *si, left);
+			++Pi; ++Ti; ++rhoi; ++si;
+		}
 
-	if (left) {
-		for (Pi = _P.begin (), si = _s.begin (); Pi != _P.end (); ++Pi, ++si) {
-			DenseSubmatrix<Element> Mcheck (M, *si, 0, _N - *si, M.coldim ());
-			_solver._MD.permuteRows (Mcheck, Pi->begin (), Pi->end ());
+		return M;
+	}
+
+	template <class Field, class Matrix>
+	template <class Matrix1>
+	Matrix1 &LABlockLanczosSolver<Field, Matrix>::BasisTransformation::applyPermutation (Matrix1 &M, bool left)
+	{
+		linbox_check (M.coldim () == _N);
+
+		typename std::vector<unsigned int>::iterator si;
+		typename std::vector<Permutation>::iterator Pi;
+
+		if (left) {
+			for (Pi = _P.begin (), si = _s.begin (); Pi != _P.end (); ++Pi, ++si) {
+				DenseSubmatrix<Element> Mcheck (M, *si, 0, _N - *si, M.coldim ());
+				_solver._MD.permuteRows (Mcheck, Pi->begin (), Pi->end ());
+			}
 		}
-	} else {
-		for (Pi = _P.begin (), si = _s.begin (); Pi != _P.end (); ++Pi, ++si) {
-			DenseSubmatrix<Element> Mcheck (M, 0, *si, M.rowdim (), _N - *si);
-			_solver._MD.permuteColumns (Mcheck, Pi->begin (), Pi->end ());
+		else {
+			for (Pi = _P.begin (), si = _s.begin (); Pi != _P.end (); ++Pi, ++si) {
+				DenseSubmatrix<Element> Mcheck (M, 0, *si, M.rowdim (), _N - *si);
+				_solver._MD.permuteColumns (Mcheck, Pi->begin (), Pi->end ());
+			}
 		}
-	}
 
-	return M;
-}
+		return M;
+	}
 
-template <class Field, class Matrix>
-template <class Matrix1>
-Matrix1 &LABlockLanczosSolver<Field, Matrix>::BasisTransformation::applyLast (Matrix1 &M, bool left)
-{
-	linbox_check (M.coldim () == _N);
+	template <class Field, class Matrix>
+	template <class Matrix1>
+	Matrix1 &LABlockLanczosSolver<Field, Matrix>::BasisTransformation::applyLast (Matrix1 &M, bool left)
+	{
+		linbox_check (M.coldim () == _N);
 
-	applyOne (M, _P.back (), _T.back (), _rho.back (), _s.back (), left);
-	return M;
-}
+		applyOne (M, _P.back (), _T.back (), _rho.back (), _s.back (), left);
+		return M;
+	}
 
-template <class Field, class Matrix>
-template <class Matrix1>
-void LABlockLanczosSolver<Field, Matrix>::BasisTransformation::append
+	template <class Field, class Matrix>
+	template <class Matrix1>
+	void LABlockLanczosSolver<Field, Matrix>::BasisTransformation::append
 	(Permutation  &P,
 	 Matrix1      &T,
-	 unsigned int  rho) 
-{
-	linbox_check (T.rowdim () <= _N);
-	linbox_check (T.coldim () <= _N);
-	linbox_check (rho + T.coldim () <= _N);
+	 unsigned int  rho)
+	{
+		linbox_check (T.rowdim () <= _N);
+		linbox_check (T.coldim () <= _N);
+		linbox_check (rho + T.coldim () <= _N);
 
-	Matrix *Tnew = _solver.newBlock ();
-	_solver._MD.subin (*Tnew, *Tnew);
+		Matrix *Tnew = _solver.newBlock ();
+		_solver._MD.subin (*Tnew, *Tnew);
 
-	DenseSubmatrix<Element> Tnewhat (*Tnew, _N - T.rowdim (), _N - T.coldim (), T.rowdim (), T.coldim ());
-	_solver._MD.copy (Tnewhat, T);
+		DenseSubmatrix<Element> Tnewhat (*Tnew, _N - T.rowdim (), _N - T.coldim (), T.rowdim (), T.coldim ());
+		_solver._MD.copy (Tnewhat, T);
 
-	_P.push_back (Permutation (P));
-	_T.push_back (Tnew);
-	_rho.push_back (rho);
-	_s.push_back (_N - rho - T.coldim ());
-}
+		_P.push_back (Permutation (P));
+		_T.push_back (Tnew);
+		_rho.push_back (rho);
+		_s.push_back (_N - rho - T.coldim ());
+	}
 
-template <class Field, class Matrix>
-void LABlockLanczosSolver<Field, Matrix>::BasisTransformation::reset ()
-{
-	for (typename std::vector<Matrix *>::iterator i = _T.begin (); i != _T.end (); ++i)
-		_solver._ip_trashcan.push (*i);
+	template <class Field, class Matrix>
+	void LABlockLanczosSolver<Field, Matrix>::BasisTransformation::reset ()
+	{
+		for (typename std::vector<Matrix *>::iterator i = _T.begin (); i != _T.end (); ++i)
+			_solver._ip_trashcan.push (*i);
 
-	_P.clear ();
-	_T.clear ();
-	_rho.clear ();
-	_s.clear ();
-}
+		_P.clear ();
+		_T.clear ();
+		_rho.clear ();
+		_s.clear ();
+	}
 
-template <class Field, class Matrix>
-void LABlockLanczosSolver<Field, Matrix>::BasisTransformation::report (std::ostream &out)
-{
-	typename Matrix::RowIterator i;
-	unsigned int idx;
+	template <class Field, class Matrix>
+	void LABlockLanczosSolver<Field, Matrix>::BasisTransformation::report (std::ostream &out)
+	{
+		typename Matrix::RowIterator i;
+		unsigned int idx;
 
-	Matrix T (_N, _N);
+		Matrix T (_N, _N);
 
-	for (i = T.rowBegin (), idx = 0; i != T.rowEnd (); ++i, ++idx) {
-		_solver._VD.subin (*i, *i);
-		_solver._F.assign ((*i)[idx], _solver._one);
-	}
+		for (i = T.rowBegin (), idx = 0; i != T.rowEnd (); ++i, ++idx) {
+			_solver._VD.subin (*i, *i);
+			_solver._F.assign ((*i)[idx], _solver._one);
+		}
 
-	apply (T, false);
+		apply (T, false);
 
-	_solver._MD.write (out, T);
-}
+		_solver._MD.write (out, T);
+	}
 
-template <class Field, class Matrix>
-void LABlockLanczosSolver<Field, Matrix>::BasisTransformation::reportComplete (std::ostream &out)
-{
-	typename std::vector<Permutation>::iterator Pi = _P.begin ();
-	typename std::vector<Matrix *>::iterator Ti = _T.begin ();
-	typename std::vector<unsigned int>::iterator rhoi = _rho.begin ();
-	typename std::vector<unsigned int>::iterator si = _s.begin ();
+	template <class Field, class Matrix>
+	void LABlockLanczosSolver<Field, Matrix>::BasisTransformation::reportComplete (std::ostream &out)
+	{
+		typename std::vector<Permutation>::iterator Pi = _P.begin ();
+		typename std::vector<Matrix *>::iterator Ti = _T.begin ();
+		typename std::vector<unsigned int>::iterator rhoi = _rho.begin ();
+		typename std::vector<unsigned int>::iterator si = _s.begin ();
 
-	while (Pi != _P.end ()) {
-		out << "Permutation: ";
-		_solver._eliminator.writePermutation (out, *Pi) << std::endl;
+		while (Pi != _P.end ()) {
+			out << "Permutation: ";
+			_solver._eliminator.writePermutation (out, *Pi) << std::endl;
 
-		out << "Transform: " << std::endl;
-		_solver._MD.write (out, **Ti);
+			out << "Transform: " << std::endl;
+			_solver._MD.write (out, **Ti);
 
-		out << "rank:  " << *rhoi << std::endl;
-		out << "start: " << *si << std::endl;
+			out << "rank:  " << *rhoi << std::endl;
+			out << "start: " << *si << std::endl;
 
-		++Pi; ++Ti; ++rhoi; ++si;
+			++Pi; ++Ti; ++rhoi; ++si;
+		}
 	}
-}
 
-template <class Field, class Matrix>
-LABlockLanczosSolver<Field, Matrix>::BasisTransformation::~BasisTransformation () 
-{
-	typename std::vector<Matrix *>::iterator Ti;
+	template <class Field, class Matrix>
+	LABlockLanczosSolver<Field, Matrix>::BasisTransformation::~BasisTransformation ()
+	{
+		typename std::vector<Matrix *>::iterator Ti;
 
-	for (Ti = _T.begin (); Ti != _T.end (); ++Ti) {
-		_solver._ip_trashcan.push (*Ti);
+		for (Ti = _T.begin (); Ti != _T.end (); ++Ti) {
+			_solver._ip_trashcan.push (*Ti);
+		}
 	}
-}
 
-
 
-template <class Field, class Matrix>
-void LABlockLanczosSolver<Field, Matrix>::InnerProductArray::extend ()
-{
-	typename std::deque<std::deque<Matrix *> >::iterator i;
 
-	for (i = _blocks.begin (); i != _blocks.end (); ++i)
-		i->push_back (NULL);
+	template <class Field, class Matrix>
+	void LABlockLanczosSolver<Field, Matrix>::InnerProductArray::extend ()
+	{
+		typename std::deque<std::deque<Matrix *> >::iterator i;
 
-	_blocks.push_back (std::deque<Matrix *> (_blocks.size () + 1, NULL));
-}
+		for (i = _blocks.begin (); i != _blocks.end (); ++i)
+			i->push_back (NULL);
 
-template <class Field, class Matrix>
-void LABlockLanczosSolver<Field, Matrix>::InnerProductArray::contract ()
-{
-	typename std::deque<std::deque<Matrix *> >::iterator i;
-	typename std::deque<Matrix *>::iterator j;
+		_blocks.push_back (std::deque<Matrix *> (_blocks.size () + 1, NULL));
+	}
+
+	template <class Field, class Matrix>
+	void LABlockLanczosSolver<Field, Matrix>::InnerProductArray::contract ()
+	{
+		typename std::deque<std::deque<Matrix *> >::iterator i;
+		typename std::deque<Matrix *>::iterator j;
 
-	++_base;
+		++_base;
 
-	for (j = _blocks.front ().begin (); j != _blocks.front ().end (); ++j)
-		if (*j)
-			_solver->_ip_trashcan.push (*j);
+		for (j = _blocks.front ().begin (); j != _blocks.front ().end (); ++j)
+			if (*j)
+				_solver->_ip_trashcan.push (*j);
 
-	_blocks.pop_front ();
+		_blocks.pop_front ();
 
-	for (i = _blocks.begin (); i != _blocks.end (); ++i) {
-		if (i->front ())
-			_solver->_ip_trashcan.push (i->front ());
+		for (i = _blocks.begin (); i != _blocks.end (); ++i) {
+			if (i->front ())
+				_solver->_ip_trashcan.push (i->front ());
 
-		i->pop_front ();
+			i->pop_front ();
+		}
 	}
-}
 
-template <class Field, class Matrix>
-void LABlockLanczosSolver<Field, Matrix>::InnerProductArray::reset ()
-{
-	_base = 0;
+	template <class Field, class Matrix>
+	void LABlockLanczosSolver<Field, Matrix>::InnerProductArray::reset ()
+	{
+		_base = 0;
 
-	while (!_blocks.empty ())
-		contract ();
-}
+		while (!_blocks.empty ())
+			contract ();
+	}
 
-template <class Field, class Matrix>
-Matrix *LABlockLanczosSolver<Field, Matrix>::InnerProductArray::get (int i, int j)
-{
-	linbox_check ((unsigned int) i >= _base);
-	linbox_check ((unsigned int) j >= _base);
-	linbox_check ((unsigned int) i < _base + _blocks.size ());
-	linbox_check ((unsigned int) j < _base + _blocks.front ().size ());
+	template <class Field, class Matrix>
+	Matrix *LABlockLanczosSolver<Field, Matrix>::InnerProductArray::get (int i, int j)
+	{
+		linbox_check ((unsigned int) i >= _base);
+		linbox_check ((unsigned int) j >= _base);
+		linbox_check ((unsigned int) i < _base + _blocks.size ());
+		linbox_check ((unsigned int) j < _base + _blocks.front ().size ());
 
-	Matrix *ret = _blocks[i - _base][j - _base];
+		Matrix *ret = _blocks[i - _base][j - _base];
 
-	if (ret == NULL)
-		ret = _blocks[i - _base][j - _base] = _solver->newBlock ();
+		if (ret == NULL)
+			ret = _blocks[i - _base][j - _base] = _solver->newBlock ();
 
-	linbox_check (ret != NULL);
+		linbox_check (ret != NULL);
 
-	return ret;
-}
+		return ret;
+	}
 
-
 
-template <class Field, class Matrix>
-Matrix *LABlockLanczosSolver<Field, Matrix>::newBlock () 
-{
-	Matrix *ret;
 
-	if (_ip_trashcan.empty ())
-		ret = new Matrix (_traits.blockingFactor (), _traits.blockingFactor ());
-	else {
-		ret = _ip_trashcan.top ();
-		_ip_trashcan.pop ();
-	}
+	template <class Field, class Matrix>
+	Matrix *LABlockLanczosSolver<Field, Matrix>::newBlock ()
+	{
+		Matrix *ret;
+
+		if (_ip_trashcan.empty ())
+			ret = new Matrix (_traits.blockingFactor (), _traits.blockingFactor ());
+		else {
+			ret = _ip_trashcan.top ();
+			_ip_trashcan.pop ();
+		}
 
-	linbox_check (ret != NULL);
+		linbox_check (ret != NULL);
 
 #ifdef LABL_DETAILED_TRACE
-	_MD.subin (*ret, *ret);
+		_MD.subin (*ret, *ret);
 #endif
 
-	return ret;
-}
+		return ret;
+	}
+
 
-
 
 #ifdef LABL_DETAILED_TRACE
 
-template <class Field, class Matrix>
-template <class Matrix1, class Matrix2, class Blackbox>
-void LABlockLanczosSolver<Field, Matrix>::checkAConjugacy
+	template <class Field, class Matrix>
+	template <class Matrix1, class Matrix2, class Blackbox>
+	void LABlockLanczosSolver<Field, Matrix>::checkAConjugacy
 	(const Matrix1           &u,
 	 const Matrix2           &v,
 	 const Blackbox          &A,
@@ -1431,75 +1436,76 @@ void LABlockLanczosSolver<Field, Matrix>::checkAConjugacy
 	 size_t                   v_iter,
 	 size_t                   rho_u,
 	 size_t                   rho_v)
-{
-	std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+	{
+		std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
 
-	report << "Checking whether u_" << u_iter << " is A-conjugate to v_" << v_iter << "...";
+		report << "Checking whether u_" << u_iter << " is A-conjugate to v_" << v_iter << "...";
 
-	DenseSubmatrix<Element> T1p (_T1, 0, 0, rho_u, rho_v);
+		DenseSubmatrix<Element> T1p (_T1, 0, 0, rho_u, rho_v);
 
-	Matrix Av (A.rowdim (), _traits.blockingFactor ());
+		Matrix Av (A.rowdim (), _traits.blockingFactor ());
 
-	_MD.blackboxMulLeft (Av, A, v);
-	_MD.mul (_T1, transpose (u), Av);
+		_MD.blackboxMulLeft (Av, A, v);
+		_MD.mul (_T1, transpose (u), Av);
 
-	if (_MD.isZero (T1p))
-		report << "yes" << std::endl;
-	else {
-		report << "no" << std::endl;
+		if (_MD.isZero (T1p))
+			report << "yes" << std::endl;
+		else {
+			report << "no" << std::endl;
 
-		std::ostream &err_report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR);
-		err_report << "ERROR: u_" << u_iter << " is not A-conjugate to v_" << v_iter << std::endl;
-		err_report << "Computed u_" << u_iter << "^T Av_" << v_iter << ":" << std::endl;
-		_MD.write (report, _T1);
+			std::ostream &err_report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR);
+			err_report << "ERROR: u_" << u_iter << " is not A-conjugate to v_" << v_iter << std::endl;
+			err_report << "Computed u_" << u_iter << "^T Av_" << v_iter << ":" << std::endl;
+			_MD.write (report, _T1);
+		}
 	}
-}
 
-template <class Field, class Matrix>
-template <class Blackbox>
-void LABlockLanczosSolver<Field, Matrix>::checkInnerProducts (const Blackbox &A)
-{
-	commentator.start ("Checking cached inner products", "LABlockLanczosSolver::checkInnerProducts");
+	template <class Field, class Matrix>
+	template <class Blackbox>
+	void LABlockLanczosSolver<Field, Matrix>::checkInnerProducts (const Blackbox &A)
+	{
+		commentator.start ("Checking cached inner products", "LABlockLanczosSolver::checkInnerProducts");
 
-	std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+		std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
 
-	typename std::list<Iterate *>::const_iterator i, j;
+		typename std::list<Iterate *>::const_iterator i, j;
 
-	Matrix Av (A.rowdim (), _traits.blockingFactor ());
+		Matrix Av (A.rowdim (), _traits.blockingFactor ());
 
-	for (i = _history.begin (); i != _history.end (); ++i) {
-		for (j = _history.begin (); j != _history.end (); ++j) {
-			if (*i == _history.back () && *j == _history.back ())
-				break;
+		for (i = _history.begin (); i != _history.end (); ++i) {
+			for (j = _history.begin (); j != _history.end (); ++j) {
+				if (*i == _history.back () && *j == _history.back ())
+					break;
+
+				report << "Checking u_" << (*i)->_iter << "^TAv_" << (*j)->_iter << ": ";
+				_MD.blackboxMulLeft (Av, A, (*j)->_v);
+				_MD.mul (_T1, transpose ((*i)->_u), Av);
+				_MD.copy (_T2, *_uAv.get ((*i)->_iter, (*j)->_iter));
+				(*i)->_sigma_u.apply (_T2, true);
+				(*j)->_sigma_v.apply (_T2, false);
 
-			report << "Checking u_" << (*i)->_iter << "^TAv_" << (*j)->_iter << ": ";
-			_MD.blackboxMulLeft (Av, A, (*j)->_v);
-			_MD.mul (_T1, transpose ((*i)->_u), Av);
-			_MD.copy (_T2, *_uAv.get ((*i)->_iter, (*j)->_iter));
-			(*i)->_sigma_u.apply (_T2, true);
-			(*j)->_sigma_v.apply (_T2, false);
-
-			if (_MD.areEqual (_T1, _T2)) {
-				report << "okay" << std::endl;
-				report << "Inner product is" << std::endl;
-				_MD.write (report, _T2);
-			} else {
-				report << "ERROR" << std::endl << "Computed: " << std::endl;
-				_MD.write (report, _T1);
-				report << "Cached: " << std::endl;
-				_MD.write (report, _T2);
+				if (_MD.areEqual (_T1, _T2)) {
+					report << "okay" << std::endl;
+					report << "Inner product is" << std::endl;
+					_MD.write (report, _T2);
+				}
+				else {
+					report << "ERROR" << std::endl << "Computed: " << std::endl;
+					_MD.write (report, _T1);
+					report << "Cached: " << std::endl;
+					_MD.write (report, _T2);
+				}
 			}
 		}
-	}
 
-	commentator.stop ("done", NULL, "LABlockLanczosSolver::checkInnerProducts");
-}
+		commentator.stop ("done", NULL, "LABlockLanczosSolver::checkInnerProducts");
+	}
 
 #else // LABL_DETAILED_TRACE
 
-template <class Field, class Matrix>
-template <class Matrix1, class Matrix2, class Blackbox>
-void LABlockLanczosSolver<Field, Matrix>::checkAConjugacy
+	template <class Field, class Matrix>
+	template <class Matrix1, class Matrix2, class Blackbox>
+	void LABlockLanczosSolver<Field, Matrix>::checkAConjugacy
 	(const Matrix1           &u,
 	 const Matrix2           &v,
 	 const Blackbox          &A,
@@ -1507,31 +1513,32 @@ void LABlockLanczosSolver<Field, Matrix>::checkAConjugacy
 	 size_t                   v_iter,
 	 size_t                   rho_u,
 	 size_t                   rho_v)
-{
-}
+	{
+	}
 
-template <class Field, class Matrix>
-template <class Blackbox>
-void LABlockLanczosSolver<Field, Matrix>::checkInnerProducts (const Blackbox &A)
-{
-}
+	template <class Field, class Matrix>
+	template <class Blackbox>
+	void LABlockLanczosSolver<Field, Matrix>::checkInnerProducts (const Blackbox &A)
+	{
+	}
 
 #endif // LABL_DETAILED_TRACE
 
-template <class Field, class Matrix>
-void LABlockLanczosSolver<Field, Matrix>::init_temps () 
-{
-	_T1.resize (_traits.blockingFactor (), _traits.blockingFactor ());
-	_T2.resize (_traits.blockingFactor (), _traits.blockingFactor ());
-	_T3.resize (_traits.blockingFactor (), _traits.blockingFactor ());
-	_T4.resize (_traits.blockingFactor (), _traits.blockingFactor ());
-	_T5.resize (_traits.blockingFactor (), _traits.blockingFactor ());
-	_W.resize (_traits.blockingFactor (), _traits.blockingFactor ());
-	_Cu.resize (_traits.blockingFactor (), _traits.blockingFactor ());
-	_Cv.resize (_traits.blockingFactor (), _traits.blockingFactor ());
-	_F.init (_one, 1);
-}
+	template <class Field, class Matrix>
+	void LABlockLanczosSolver<Field, Matrix>::init_temps ()
+	{
+		_T1.resize (_traits.blockingFactor (), _traits.blockingFactor ());
+		_T2.resize (_traits.blockingFactor (), _traits.blockingFactor ());
+		_T3.resize (_traits.blockingFactor (), _traits.blockingFactor ());
+		_T4.resize (_traits.blockingFactor (), _traits.blockingFactor ());
+		_T5.resize (_traits.blockingFactor (), _traits.blockingFactor ());
+		_W.resize (_traits.blockingFactor (), _traits.blockingFactor ());
+		_Cu.resize (_traits.blockingFactor (), _traits.blockingFactor ());
+		_Cv.resize (_traits.blockingFactor (), _traits.blockingFactor ());
+		_F.init (_one, 1);
+	}
 
 } // namespace LinBox
 
-#endif // __LA_BLOCK_LANCZOS_INL
+#endif // __LINBOX_la_block_lanczos_INL
+
diff --git a/linbox/algorithms/lanczos.doxy b/linbox/algorithms/lanczos.doxy
new file mode 100644
index 0000000..fbf1517
--- /dev/null
+++ b/linbox/algorithms/lanczos.doxy
@@ -0,0 +1,10 @@
+// Copyright (C) 2010 LinBox, GNU LGPL, see COPYING for licence information
+
+/** @ingroup algorithms
+  @defgroup lanczos Lanczos
+  @brief NO DOC YET
+
+
+ */
+
+// vim:syntax=doxygen
diff --git a/linbox/algorithms/lanczos.h b/linbox/algorithms/lanczos.h
index 7e963dc..6c9e145 100644
--- a/linbox/algorithms/lanczos.h
+++ b/linbox/algorithms/lanczos.h
@@ -1,7 +1,7 @@
 /* -*- 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
 /* linbox/algorithms/lanczos.h
- * Copyright (C) 2002 Bradford Hovinen
+ * Copyright (C) 2002 LinBox
  *
  * Written by Bradford Hovinen <hovinen at cis.udel.edu>
  *
@@ -10,8 +10,8 @@
  * See COPYING for license information.
  */
 
-#ifndef __LANCZOS_H
-#define __LANCZOS_H
+#ifndef __LINBOX_lanczos_H
+#define __LINBOX_lanczos_H
 
 #include <vector>
 #include <algorithm>
@@ -21,77 +21,77 @@
 #include "linbox/vector/vector-domain.h"
 #include "linbox/solutions/methods.h"
 
-namespace LinBox 
-{
-
-/** 
- \brief Solve a linear system using the conjugate Lanczos iteration.
- * 
- * Lanczos system solver class.
- * This class encapsulates the functionality required for solving a linear
- * system through the conjugate Lanczos iteration
- */
-template <class Field, class Vector> 
-class LanczosSolver 
+namespace LinBox
 {
-    public:
-
-	/** Constructor
-	 * @param F Field over which to operate
-	 * @param traits @ref{SolverTraits} structure describing user
-	 *               options for the solver 
-	 */
-	LanczosSolver (const Field &F, const LanczosTraits &traits)
-		: _traits (traits), _F (F), _randiter (F), _VD (F)
-	{}
-
-	/** Constructor with a random iterator
-	 * @param F Field over which to operate
-	 * @param traits @ref{SolverTraits} structure describing user
-	 *               options for the solver 
-	 * @param r Random iterator to use for randomization
-	 */
-	LanczosSolver (const Field &F, const LanczosTraits &traits, typename Field::RandIter r)
-		: _traits (traits), _F (F), _randiter (r), _VD (F)
-	{}
 
-	/** Solve the linear system Ax = b.
+	/**
+	  \brief Solve a linear system using the conjugate Lanczos iteration.
 	 *
-	 * If the system is nonsingular, this method computes the unique
-	 * solution to the system Ax = b. If the system is singular, it computes
-	 * a random solution.
-	 *
-	 * If the matrix A is nonsymmetric, this method preconditions the matrix
-	 * A with the preconditioner D_1 A^T D_2 A D_1, where D_1 and D_2 are
-	 * random nonsingular diagonal matrices. If the matrix A is symmetric,
-	 * this method preconditions the system with A D, where D is a random
-	 * diagonal matrix.
-	 *
-	 * @param A Black box for the matrix A
-	 * @param x Vector in which to store solution
-	 * @param b Right-hand side of system
-	 * @return Reference to solution vector
+	 * Lanczos system solver class.
+	 * This class encapsulates the functionality required for solving a linear
+	 * system through the conjugate Lanczos iteration
 	 */
-	template <class Blackbox>
-	Vector &solve (const Blackbox &A, Vector &x, const Vector &b);
-
-    private:
-
-	// Run the Lanczos iteration and return the result. Return false
-	// if the method breaks down. Do not check that Ax = b in the end
-	template<class Blackbox>
-	bool iterate (const Blackbox &A, Vector &x, const Vector &b);
-
-	const LanczosTraits &_traits;
-	const Field                       &_F;
-	typename Field::RandIter           _randiter;
-	VectorDomain<Field>                _VD;
-
-	Vector                    _w[2], _Aw; // Temporaries used in the Lanczos iteration
-};
+	template <class Field, class Vector>
+	class LanczosSolver {
+	public:
+
+		/** @brief Constructor
+		 * @param F Field over which to operate
+		 * @param traits @ref SolverTraits  structure describing user
+		 *               options for the solver
+		 */
+		LanczosSolver (const Field &F, const LanczosTraits &traits) :
+			_traits (traits), _F (F), _randiter (F), _VD (F)
+		{}
+
+		/** @brief Constructor with a random iterator
+		 * @param F Field over which to operate
+		 * @param traits @ref SolverTraits  structure describing user
+		 *               options for the solver
+		 * @param r Random iterator to use for randomization
+		 */
+		LanczosSolver (const Field &F, const LanczosTraits &traits, typename Field::RandIter r) :
+			_traits (traits), _F (F), _randiter (r), _VD (F)
+		{}
+
+		/** Solve the linear system Ax = b.
+		 *
+		 * If the system is nonsingular, this method computes the unique
+		 * solution to the system Ax = b. If the system is singular, it computes
+		 * a random solution.
+		 *
+		 * If the matrix A is nonsymmetric, this method preconditions the matrix
+		 * A with the preconditioner D_1 A^T D_2 A D_1, where D_1 and D_2 are
+		 * random nonsingular diagonal matrices. If the matrix A is symmetric,
+		 * this method preconditions the system with A D, where D is a random
+		 * diagonal matrix.
+		 *
+		 * @param A Black box for the matrix A
+		 * @param x Vector in which to store solution
+		 * @param b Right-hand side of system
+		 * @return Reference to solution vector
+		 */
+		template <class Blackbox>
+		Vector &solve (const Blackbox &A, Vector &x, const Vector &b);
+
+	private:
+
+		// Run the Lanczos iteration and return the result. Return false
+		// if the method breaks down. Do not check that Ax = b in the end
+		template<class Blackbox>
+		bool iterate (const Blackbox &A, Vector &x, const Vector &b);
+
+		const LanczosTraits &_traits;
+		const Field                       &_F;
+		typename Field::RandIter           _randiter;
+		VectorDomain<Field>                _VD;
+
+		Vector                    _w[2], _Aw; // Temporaries used in the Lanczos iteration
+	};
 
 }
 
 #include "linbox/algorithms/lanczos.inl"
 
-#endif // __LANCZOS_H
+#endif // __LINBOX_lanczos_H
+
diff --git a/linbox/algorithms/lanczos.inl b/linbox/algorithms/lanczos.inl
index 7a43eeb..580f6f4 100644
--- a/linbox/algorithms/lanczos.inl
+++ b/linbox/algorithms/lanczos.inl
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/algorithms/lanczos.inl
  * Copyright (C) 2002 Bradford Hovinen
  *
@@ -10,8 +10,8 @@
  * See COPYING for license information.
  */
 
-#ifndef __LANCZOS_INL
-#define __LANCZOS_INL
+#ifndef __LINBOX_lanczos_INL
+#define __LINBOX_lanczos_INL
 
 #include <vector>
 #include <algorithm>
@@ -23,319 +23,320 @@
 #include "linbox/vector/vector-domain.h"
 #include "linbox/solutions/methods.h"
 
-namespace LinBox 
+namespace LinBox
 {
 
 #ifdef DETAILED_TRACE
 
-template <class Field, class Vector>
-void traceReport (std::ostream &out, VectorDomain<Field> &VD, const char *text, size_t iter, const Vector &v)
-{
-	out << text << " [" << iter << "]: ";
-	VD.write (out, v) << std::endl;
-}
+	template <class Field, class LVector>
+	void traceReport (std::ostream &out, VectorDomain<Field> &VD, const char *text, size_t iter, const LVector &v)
+	{
+		out << text << " [" << iter << "]: ";
+		VD.write (out, v) << std::endl;
+	}
 
-template <class Field, class Vector>
-void traceReport (std::ostream &out, const Field &F, const char *text, size_t iter, const typename Field::Element &a)
-{
-	out << text << " [" << iter << "]: ";
-	F.write (out, a) << std::endl;
-}
+	template <class Field, class LVector>
+	void traceReport (std::ostream &out, const Field &F, const char *text, size_t iter, const typename Field::Element &a)
+	{
+		out << text << " [" << iter << "]: ";
+		F.write (out, a) << std::endl;
+	}
 
 #else
 
-template <class Field, class Vector>
-inline void traceReport (std::ostream &out, VectorDomain<Field> &VD, const char *text, size_t iter, const Vector &v)
-{}
+	template <class Field, class LVector>
+	inline void traceReport (std::ostream &out, VectorDomain<Field> &VD, const char *text, size_t iter, const LVector &v)
+	{}
 
-template <class Field, class Vector>
-void traceReport (std::ostream &out, const Field &F, const char *text, size_t iter, const typename Field::Element &a)
-{}
+	template <class Field, class LVector>
+	void traceReport (std::ostream &out, const Field &F, const char *text, size_t iter, const typename Field::Element &a)
+	{}
 
 #endif
 
-template <class Field, class Vector>
-template <class Blackbox>
-Vector &LanczosSolver<Field, Vector>::solve (const Blackbox &A, Vector &x, const Vector &b) 
-{
-	linbox_check ((x.size () == A.coldim ()) &&
-		      (b.size () == A.rowdim ()));
+	template <class Field, class LVector>
+	template <class Blackbox>
+	LVector &LanczosSolver<Field, LVector>::solve (const Blackbox &A, LVector &x, const LVector &b)
+	{
+		linbox_check ((x.size () == A.coldim ()) &&
+			      (b.size () == A.rowdim ()));
 
-	commentator.start ("Solving linear system (Lanczos)", "LanczosSolver::solve");
+		commentator.start ("Solving linear system (Lanczos)", "LanczosSolver::solve");
 
-	bool success = false;
-	Vector d1, d2, b1, b2, bp, y, Ax, ATAx, ATb;
+		bool success = false;
+		LVector d1, d2, b1, b2, bp, y, Ax, ATAx, ATb;
 
-	VectorWrapper::ensureDim (_w[0], A.coldim ());
-	VectorWrapper::ensureDim (_w[1], A.coldim ());
-	VectorWrapper::ensureDim (_Aw, A.coldim ());
+		VectorWrapper::ensureDim (_w[0], A.coldim ());
+		VectorWrapper::ensureDim (_w[1], A.coldim ());
+		VectorWrapper::ensureDim (_Aw, A.coldim ());
 
-	NonzeroRandIter<Field> real_ri (_F, _randiter);
-	RandomDenseStream<Field, Vector, NonzeroRandIter<Field> > stream (_F, real_ri, A.coldim ());
+		NonzeroRandIter<Field> real_ri (_F, _randiter);
+		RandomDenseStream<Field, LVector, NonzeroRandIter<Field> > stream (_F, real_ri, A.coldim ());
 
-	for (unsigned int i = 0; !success && i < _traits.maxTries (); ++i) {
-		std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+		for (unsigned int i = 0; !success && i < _traits.maxTries (); ++i) {
+			std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
 
-		switch (_traits.preconditioner ()) {
-		    case LanczosTraits::NO_PRECONDITIONER:
-			success = iterate (A, x, b);
-			break;
+			switch (_traits.preconditioner ()) {
+			case LanczosTraits::NO_PRECONDITIONER:
+				success = iterate (A, x, b);
+				break;
 
-		    case LanczosTraits::SYMMETRIZE:
-		    {
-			VectorWrapper::ensureDim (bp, A.coldim ());
+			case LanczosTraits::SYMMETRIZE:
+				{
+					VectorWrapper::ensureDim (bp, A.coldim ());
 
-			Transpose<Blackbox> AT (&A);
-			Compose<Transpose<Blackbox>, Blackbox> B (&AT, &A);
-
-			AT.apply (bp, b);
-
-			success = iterate (B, x, bp);
-
-			break;
-		    }
-
-		    case LanczosTraits::PARTIAL_DIAGONAL:
-		    {
-			VectorWrapper::ensureDim (d1, A.coldim ());
-			VectorWrapper::ensureDim (y, A.coldim ());
-
-			stream >> d1;
-			Diagonal<Field, typename VectorTraits<Vector>::VectorCategory> D (_F, d1);
-			Compose<Blackbox, Diagonal<Field, typename VectorTraits<Vector>::VectorCategory> > B (&A, &D);
-
-			report << "Random D: ";
-			_VD.write (report, d1) << std::endl;
-
-			if ((success = iterate (B, y, b)))
-				D.apply (x, y);
-
-			break;
-		    }
-
-		    case LanczosTraits::PARTIAL_DIAGONAL_SYMMETRIZE:
-		    {
-			VectorWrapper::ensureDim (d1, A.rowdim ());
-			VectorWrapper::ensureDim (b1, A.rowdim ());
-			VectorWrapper::ensureDim (bp, A.coldim ());
-
-			stream >> d1;
-			Diagonal<Field, typename VectorTraits<Vector>::VectorCategory> D (_F, d1);
-			Transpose<Blackbox> AT (&A);
-			Compose<Diagonal<Field, typename VectorTraits<Vector>::VectorCategory>, Blackbox> B1 (&D, &A);
-			Compose<Transpose<Blackbox>, Compose<Diagonal<Field, typename VectorTraits<Vector>::VectorCategory>, Blackbox> > B (&AT, &B1);
-
-			report << "Random D: ";
-			_VD.write (report, d1) << std::endl;
-
-			D.apply (b1, b);
-			AT.apply (bp, b1);
-
-			success = iterate (B, x, bp);
-
-			break;
-		    }
-
-		    case LanczosTraits::FULL_DIAGONAL:
-		    {
-			VectorWrapper::ensureDim (d1, A.coldim ());
-			VectorWrapper::ensureDim (d2, A.rowdim ());
-			VectorWrapper::ensureDim (b1, A.rowdim ());
-			VectorWrapper::ensureDim (b2, A.coldim ());
-			VectorWrapper::ensureDim (bp, A.coldim ());
-			VectorWrapper::ensureDim (y, A.coldim ());
-
-			stream >> d1 >> d2;
-			Diagonal<Field, typename VectorTraits<Vector>::VectorCategory> D1 (_F, d1);
-			Diagonal<Field, typename VectorTraits<Vector>::VectorCategory> D2 (_F, d2);
-			Transpose<Blackbox> AT (&A);
-
-			Compose<Blackbox, 
-				    Diagonal<Field, typename VectorTraits<Vector>::VectorCategory> > B1 (&A, &D1);
-
-			Compose<Diagonal<Field, typename VectorTraits<Vector>::VectorCategory>,
-				    Compose<Blackbox, 
-				    Diagonal<Field, typename VectorTraits<Vector>::VectorCategory> > > B2 (&D2, &B1);
-			
-			Compose<Transpose<Blackbox>, 
-				    Compose<Diagonal<Field, typename VectorTraits<Vector>::VectorCategory>, 
-				    Compose<Blackbox, 
-				    Diagonal<Field, typename VectorTraits<Vector>::VectorCategory> > > > B3 (&AT, &B2);
-
-			Compose<Diagonal<Field, typename VectorTraits<Vector>::VectorCategory>, 
-				    Compose<Transpose<Blackbox>, 
-				    Compose<Diagonal<Field, typename VectorTraits<Vector>::VectorCategory>, 
-				    Compose<Blackbox, 
-				    Diagonal<Field, typename VectorTraits<Vector>::VectorCategory> > > > > B (&D1, &B3);
-			    
-			report << "Random D_1: ";
-			_VD.write (report, d1) << std::endl;
-
-			report << "Random D_2: ";
-			_VD.write (report, d2) << std::endl;
-
-			D2.apply (b1, b);
-			AT.apply (b2, b1);
-			D1.apply (bp, b2);
-
-			if ((success = iterate (B, y, bp)))
-				D1.apply (x, y);
-
-			break;
-		    }
-
-		    default:
-			throw PreconditionFailed (__FUNCTION__, __LINE__,
-						  "preconditioner is NO_PRECONDITIONER, SYMMETRIZE, PARTIAL_DIAGONAL_SYMMETRIZE, "
-						  "PARTIAL_DIAGONAL, or FULL_DIAGONAL");
-		}
+					Transpose<Blackbox> AT (&A);
+					Compose<Transpose<Blackbox>, Blackbox> B (&AT, &A);
+
+					AT.apply (bp, b);
+
+					success = iterate (B, x, bp);
+
+					break;
+				}
 
-		if (success && _traits.checkResult ()) {
-			VectorWrapper::ensureDim (Ax, A.rowdim ());
+			case LanczosTraits::PARTIAL_DIAGONAL:
+				{
+					VectorWrapper::ensureDim (d1, A.coldim ());
+					VectorWrapper::ensureDim (y, A.coldim ());
 
-			if (_traits.checkResult () &&
-			    ((_traits.preconditioner () == LanczosTraits::SYMMETRIZE) ||
-			     (_traits.preconditioner () == LanczosTraits::PARTIAL_DIAGONAL_SYMMETRIZE) ||
-			     (_traits.preconditioner () == LanczosTraits::FULL_DIAGONAL)))
-			{
-				VectorWrapper::ensureDim (ATAx, A.coldim ());
-				VectorWrapper::ensureDim (ATb, A.coldim ());
+					stream >> d1;
+					Diagonal<Field, typename VectorTraits<LVector>::VectorCategory> D (_F, d1);
+					Compose<Blackbox, Diagonal<Field, typename VectorTraits<LVector>::VectorCategory> > B (&A, &D);
 
-				commentator.start ("Checking whether A^T Ax = A^T b");
+					report << "Random D: ";
+					_VD.write (report, d1) << std::endl;
 
-				A.apply (Ax, x);
-				A.applyTranspose (ATAx, Ax);
-				A.applyTranspose (ATb, b);
+					if ((success = iterate (B, y, b)))
+						D.apply (x, y);
 
-				if (_VD.areEqual (ATAx, ATb))
-					commentator.stop ("passed");
-				else {
-					commentator.stop ("FAILED");
-					success = false;
+					break;
 				}
+
+			case LanczosTraits::PARTIAL_DIAGONAL_SYMMETRIZE:
+				{
+					VectorWrapper::ensureDim (d1, A.rowdim ());
+					VectorWrapper::ensureDim (b1, A.rowdim ());
+					VectorWrapper::ensureDim (bp, A.coldim ());
+
+					stream >> d1;
+					Diagonal<Field, typename VectorTraits<LVector>::VectorCategory> D (_F, d1);
+					Transpose<Blackbox> AT (&A);
+					Compose<Diagonal<Field, typename VectorTraits<LVector>::VectorCategory>, Blackbox> B1 (&D, &A);
+					Compose<Transpose<Blackbox>, Compose<Diagonal<Field, typename VectorTraits<LVector>::VectorCategory>, Blackbox> > B (&AT, &B1);
+
+					report << "Random D: ";
+					_VD.write (report, d1) << std::endl;
+
+					D.apply (b1, b);
+					AT.apply (bp, b1);
+
+					success = iterate (B, x, bp);
+
+					break;
+				}
+
+			case LanczosTraits::FULL_DIAGONAL:
+				{
+					VectorWrapper::ensureDim (d1, A.coldim ());
+					VectorWrapper::ensureDim (d2, A.rowdim ());
+					VectorWrapper::ensureDim (b1, A.rowdim ());
+					VectorWrapper::ensureDim (b2, A.coldim ());
+					VectorWrapper::ensureDim (bp, A.coldim ());
+					VectorWrapper::ensureDim (y, A.coldim ());
+
+					stream >> d1 >> d2;
+					Diagonal<Field, typename VectorTraits<LVector>::VectorCategory> D1 (_F, d1);
+					Diagonal<Field, typename VectorTraits<LVector>::VectorCategory> D2 (_F, d2);
+					Transpose<Blackbox> AT (&A);
+
+					Compose<Blackbox,
+					Diagonal<Field, typename VectorTraits<LVector>::VectorCategory> > B1 (&A, &D1);
+
+					Compose<Diagonal<Field, typename VectorTraits<LVector>::VectorCategory>,
+					Compose<Blackbox,
+					Diagonal<Field, typename VectorTraits<LVector>::VectorCategory> > > B2 (&D2, &B1);
+
+					Compose<Transpose<Blackbox>,
+					Compose<Diagonal<Field, typename VectorTraits<LVector>::VectorCategory>,
+					Compose<Blackbox,
+					Diagonal<Field, typename VectorTraits<LVector>::VectorCategory> > > > B3 (&AT, &B2);
+
+					Compose<Diagonal<Field, typename VectorTraits<LVector>::VectorCategory>,
+					Compose<Transpose<Blackbox>,
+					Compose<Diagonal<Field, typename VectorTraits<LVector>::VectorCategory>,
+					Compose<Blackbox,
+					Diagonal<Field, typename VectorTraits<LVector>::VectorCategory> > > > > B (&D1, &B3);
+
+					report << "Random D_1: ";
+					_VD.write (report, d1) << std::endl;
+
+					report << "Random D_2: ";
+					_VD.write (report, d2) << std::endl;
+
+					D2.apply (b1, b);
+					AT.apply (b2, b1);
+					D1.apply (bp, b2);
+
+					if ((success = iterate (B, y, bp)))
+						D1.apply (x, y);
+
+					break;
+				}
+
+			default:
+				throw PreconditionFailed (__func__, __LINE__,
+							  "preconditioner is NO_PRECONDITIONER, SYMMETRIZE, PARTIAL_DIAGONAL_SYMMETRIZE, "
+							  "PARTIAL_DIAGONAL, or FULL_DIAGONAL");
 			}
-			else if (_traits.checkResult ()) {
-				commentator.start ("Checking whether Ax=b");
 
-				A.apply (Ax, x);
+			if (success && _traits.checkResult ()) {
+				VectorWrapper::ensureDim (Ax, A.rowdim ());
+
+				if (_traits.checkResult () &&
+				    ((_traits.preconditioner () == LanczosTraits::SYMMETRIZE) ||
+				     (_traits.preconditioner () == LanczosTraits::PARTIAL_DIAGONAL_SYMMETRIZE) ||
+				     (_traits.preconditioner () == LanczosTraits::FULL_DIAGONAL)))
+				{
+					VectorWrapper::ensureDim (ATAx, A.coldim ());
+					VectorWrapper::ensureDim (ATb, A.coldim ());
+
+					commentator.start ("Checking whether A^T Ax = A^T b");
+
+					A.apply (Ax, x);
+					A.applyTranspose (ATAx, Ax);
+					A.applyTranspose (ATb, b);
+
+					if (_VD.areEqual (ATAx, ATb))
+						commentator.stop ("passed");
+					else {
+						commentator.stop ("FAILED");
+						success = false;
+					}
+				}
+				else if (_traits.checkResult ()) {
+					commentator.start ("Checking whether Ax=b");
+
+					A.apply (Ax, x);
 
-				if (_VD.areEqual (Ax, b))
-					commentator.stop ("passed");
-				else {
-					commentator.stop ("FAILED");
-					success = false;
+					if (_VD.areEqual (Ax, b))
+						commentator.stop ("passed");
+					else {
+						commentator.stop ("FAILED");
+						success = false;
+					}
 				}
 			}
 		}
-	}
 
-	if (success) {
-		commentator.stop ("done", "Solve successful", "BlockLanczosSolver::solve");
-		return x;
-	} else {
-		commentator.stop ("done", "Solve failed", "BlockLanczosSolver::solve");
-		throw SolveFailed ();
+		if (success) {
+			commentator.stop ("done", "Solve successful", "BlockLanczosSolver::solve");
+			return x;
+		}
+		else {
+			commentator.stop ("done", "Solve failed", "BlockLanczosSolver::solve");
+			throw SolveFailed ();
+		}
 	}
-}
 
-template <class Field, class Vector>
-template<class Blackbox>
-bool LanczosSolver<Field, Vector>::iterate (const Blackbox &A, Vector &x, const Vector &b) 
-{
-	commentator.start ("Lanczos iteration", "LanczosSolver::iterate", A.coldim ());
+	template <class Field, class LVector>
+	template<class Blackbox>
+	bool LanczosSolver<Field, LVector>::iterate (const Blackbox &A, LVector &x, const LVector &b)
+	{
+		commentator.start ("Lanczos iteration", "LanczosSolver::iterate", A.coldim ());
 
-	// j is really a flip-flop: 0 means "even" and 1 means "odd". So "j" and
-	// "j-2" are accessed with [j], while "j-1" and "j+1" are accessed via
-	// [1-j]
+		// j is really a flip-flop: 0 means "even" and 1 means "odd". So "j" and
+		// "j-2" are accessed with [j], while "j-1" and "j+1" are accessed via
+		// [1-j]
 
-	unsigned int j = 1, prods = 1, iter = 2;
+		unsigned int j = 1, prods = 1, iter = 2;
 
-	// N.B. For purposes of efficiency, I am purposefully making the
-	// definitions of alpha and beta to be the *negatives* of what are given
-	// in the Lambert thesis. This allows me to use stock vector AXPY
-	// without any special modifications.
+		// N.B. For purposes of efficiency, I am purposefully making the
+		// definitions of alpha and beta to be the *negatives* of what are given
+		// in the Lambert thesis. This allows me to use stock vector AXPY
+		// without any special modifications.
 
-	typename Field::Element alpha, beta, delta[2], wb;
+		typename Field::Element alpha, beta, delta[2], wb;
 
-	// Zero out the vector _w[0]
-	_VD.subin (_w[0], _w[0]);
+		// Zero out the vector _w[0]
+		_VD.subin (_w[0], _w[0]);
 
-	// Get a random vector _w[1]
-	RandomDenseStream<Field, Vector> stream (_F, _randiter, A.coldim ());
-	stream >> _w[1];
+		// Get a random vector _w[1]
+		RandomDenseStream<Field, LVector> stream (_F, _randiter, A.coldim ());
+		stream >> _w[1];
 
-	std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+		std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
 
-	traceReport (report, _VD, "w", 1, _w[1]);
+		traceReport (report, _VD, "w", 1, _w[1]);
 
-	A.apply (_Aw, _w[j]);                // Aw_j
-	_VD.dot (delta[j], _w[j], _Aw);      // delta_j <- <w_j, Aw_j>
+		A.apply (_Aw, _w[j]);                // Aw_j
+		_VD.dot (delta[j], _w[j], _Aw);      // delta_j <- <w_j, Aw_j>
 
-	if (_F.isZero (delta[j])) {
-		commentator.stop ("FAILED", "<w_1, Aw_1> = 0", "LanczosSolver::iterate");
-		return false;
-	}
+		if (_F.isZero (delta[j])) {
+			commentator.stop ("FAILED", "<w_1, Aw_1> = 0", "LanczosSolver::iterate");
+			return false;
+		}
+
+		_VD.dot (alpha, _Aw, _Aw);           //   alpha <- -<Aw_j, Aw_j> / delta_j
+		_F.divin (alpha, delta[j]);
+		_F.negin (alpha);
 
-	_VD.dot (alpha, _Aw, _Aw);           //   alpha <- -<Aw_j, Aw_j> / delta_j
-	_F.divin (alpha, delta[j]);
-	_F.negin (alpha);
+		_F.subin (beta, beta);               //    beta <- 0
 
-	_F.subin (beta, beta);               //    beta <- 0
+		_VD.dot (wb, _w[j], b);              //       x <- <w_j, b> / delta_j w_j
+		_F.divin (wb, delta[j]);
+		_VD.mul (x, _w[j], wb);
 
-	_VD.dot (wb, _w[j], b);              //       x <- <w_j, b> / delta_j w_j
-	_F.divin (wb, delta[j]);
-	_VD.mul (x, _w[j], wb);
+		while (!_F.isZero (delta[j])) {
+			commentator.progress ();
 
-	while (!_F.isZero (delta[j])) {
-		commentator.progress ();
+			report << "Total matrix-vector products so far: " << prods << std::endl;
 
-		report << "Total matrix-vector products so far: " << prods << std::endl;
+			// 		traceReport (report, _F, "alpha", iter, alpha);
+			// 		traceReport (report, _F, "beta", iter, alpha);
+			traceReport (report, _VD, "w", iter - 1, _w[1 - j]);
+			traceReport (report, _VD, "w", iter, _w[j]);
 
-// 		traceReport (report, _F, "alpha", iter, alpha);
-// 		traceReport (report, _F, "beta", iter, alpha);
-		traceReport (report, _VD, "w", iter - 1, _w[1 - j]);
-		traceReport (report, _VD, "w", iter, _w[j]);
+			_VD.mulin (_w[1 - j], beta);    //   w_j+1 <- Aw_j + alpha w_j + beta w_j-1
+			_VD.axpyin (_w[1 - j], alpha, _w[j]);
+			_VD.addin (_w[1 - j], _Aw);
 
-		_VD.mulin (_w[1 - j], beta);    //   w_j+1 <- Aw_j + alpha w_j + beta w_j-1
-		_VD.axpyin (_w[1 - j], alpha, _w[j]);
-		_VD.addin (_w[1 - j], _Aw);
+			traceReport (report, _VD, "w", iter + 1, _w[1 - j]);
+			traceReport (report, _VD, "Aw", iter, _Aw);
 
-		traceReport (report, _VD, "w", iter + 1, _w[1 - j]);
-		traceReport (report, _VD, "Aw", iter, _Aw);
+			j = 1 - j;                      //       j <- j + 1
 
-		j = 1 - j;                      //       j <- j + 1
+			A.apply (_Aw, _w[j]);           // Aw_j
 
-		A.apply (_Aw, _w[j]);           // Aw_j
+			_VD.dot (delta[j], _w[j], _Aw); // delta_j <- <w_j, Aw_j>
 
-		_VD.dot (delta[j], _w[j], _Aw); // delta_j <- <w_j, Aw_j>
+			// 		traceReport (report, _F, "delta", iter - 1, delta[1 - j]);
+			// 		traceReport (report, _F, "delta", iter, delta[j]);
 
-// 		traceReport (report, _F, "delta", iter - 1, delta[1 - j]);
-// 		traceReport (report, _F, "delta", iter, delta[j]);
+			if (!_F.isZero (delta[j])) {
+				_VD.dot (alpha, _Aw, _Aw);             // alpha <- -<Aw_j, Aw_j> / delta_j
+				_F.divin (alpha, delta[j]);
+				_F.negin (alpha);
 
-		if (!_F.isZero (delta[j])) {
-			_VD.dot (alpha, _Aw, _Aw);             // alpha <- -<Aw_j, Aw_j> / delta_j
-			_F.divin (alpha, delta[j]);
-			_F.negin (alpha);
+				_F.div (beta, delta[j], delta[1 - j]); //  beta <- -delta_j / delta_j-1
+				_F.negin (beta);
 
-			_F.div (beta, delta[j], delta[1 - j]); //  beta <- -delta_j / delta_j-1
-			_F.negin (beta);
+				_VD.dot (wb, _w[j], b);                //     x <- x + <w_j, b> / delta_j w_j
+				_F.divin (wb, delta[j]);
+				_VD.axpyin (x, wb, _w[j]);
+			}
 
-			_VD.dot (wb, _w[j], b);                //     x <- x + <w_j, b> / delta_j w_j
-			_F.divin (wb, delta[j]);
-			_VD.axpyin (x, wb, _w[j]);
+			++prods;
+			++iter;
 		}
 
-		++prods;
-		++iter;
-	}
+		commentator.indent (report);
+		report << "Total matrix-vector products: " << prods << std::endl;
 
-	commentator.indent (report);
-	report << "Total matrix-vector products: " << prods << std::endl;
+		commentator.stop ("done", "delta_j = 0", "LanczosSolver::iterate");
+		return true;
+	}
 
-	commentator.stop ("done", "delta_j = 0", "LanczosSolver::iterate");
-	return true;
-}
- 
 }  // namespace LinBox
 
-#endif // __LANCZOS_INL
+#endif // __LINBOX_lanczos_INL
diff --git a/linbox/algorithms/last-invariant-factor.h b/linbox/algorithms/last-invariant-factor.h
old mode 100755
new mode 100644
index d167f29..68d78d2
--- a/linbox/algorithms/last-invariant-factor.h
+++ b/linbox/algorithms/last-invariant-factor.h
@@ -1,333 +1,372 @@
-/* File: last-invariant-factor.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
+/* Copyright (C) LinBox
+ *
  *  Author: Zhendong Wan
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX__LAST_INVARIANT_FACTOR_H__
-#define __LINBOX__LAST_INVARIANT_FACTOR_H__
+#ifndef __LINBOX_last_invariant_factor_H
+#define __LINBOX_last_invariant_factor_H
 
 #include <linbox/util/debug.h>
 #include <linbox/algorithms/default.h>
 #include <linbox/algorithms/rational-solver.h>
 #include <utility>
 
-namespace LinBox {
-	
-/** \brief This is used in a Smith Form algorithm.
+namespace LinBox
+{
 
-This computes the last invariant factor of an integer matrix,
-whether zero or not, by rational solving.
-*/
+	/** \brief This is used in a Smith Form algorithm.
+
+	  This computes the last invariant factor of an integer matrix,
+	  whether zero or not, by rational solving.
+	  */
 	template<class _Ring,
 		class _Solver>
-		
-		class LastInvariantFactor {
-			
-		public:
-		
-			typedef _Ring Ring;	
-			typedef _Solver Solver;
-			typedef typename Ring::Element Integer;
-			
-		protected:
-			
-			Ring r;
-			Solver solver;
-			int threshold;
-
-		public:	
-
-	/** _Ring, an integer ring,
-	 *  _Solver, a function which solves Ax = b over the quotient field of _Ring.
-         */
-			LastInvariantFactor(const Solver& _solver = Solver(),
-					    const Ring& _r =Ring(),
-					    int _threshold =DEFAULTLIFTHRESHOLD)
-				:r(_r),solver(_solver), threshold(_threshold) {
-				
-				if ( _threshold <= 1) threshold = DEFAULTLIFTHRESHOLD;
+	class LastInvariantFactor {
+
+	public:
+
+		typedef _Ring                     Ring;
+		typedef _Solver                 Solver;
+		typedef typename Ring::Element Integer;
+
+	protected:
+
+		Ring        r;
+		Solver solver;
+		int threshold;
+
+	public:
+
+		/** _Ring, an integer ring,
+		 *  _Solver, a function which solves Ax = b over the quotient field of _Ring.
+		 */
+		LastInvariantFactor(const Solver& _solver = Solver(),
+				    const Ring& _r =Ring(),
+				    int _threshold =DEFAULTLIFTHRESHOLD) :
+			r(_r),solver(_solver), threshold(_threshold)
+		{
+
+			if ( _threshold <= 1) threshold = DEFAULTLIFTHRESHOLD;
+		}
+
+		void setThreshold (int _threshold)
+		{
+			if (_threshold > 1) {
+				threshold = _threshold;
 			}
+		}
+
+		int getThreshold () const
+		{
+			return threshold;
+		}
+
+		const Solver& getSolver() const
+		{
+			return solver;
+		}
+
+		void setSolver(const Solver& s)
+		{
+			solver = s;
+		}
+
+		/** \brief Compute the last invariant factor of an integer matrix,
+		 * by solving linear system,
+		 * ignoring these factors of primes in list PrimeL
+		 */
+		template<class IMatrix, class Vector>
+		Integer& lastInvariantFactor(Integer& lif, const IMatrix& A,
+					     const Vector& PrimeL) const
+		{
+
+			r.init(lif, 1);
+			int count = 0;
+			SolverReturnStatus tmp;
+			// Storage of rational solution
+			std::vector<Integer> r_num (A. coldim()); Integer r_den;
+			//std::vector<std::pair<Integer, Integer> > result (A.coldim());
+			//typename std::vector<std::pair<Integer, Integer> >::iterator result_p;
+			// vector b, RHS, 32-bit int is good enough
+			std::vector<int> b(A.rowdim());
+			typename std::vector<int>::iterator b_p;
+			typename Vector::const_iterator Prime_p;
 
-			void setThreshold (int _threshold) {
-				if (_threshold > 1) {
-					threshold = _threshold; 
+			Integer pri, quo, rem;
+
+			for (; count < threshold; ++ count) {
+				// assign b to be a random vector
+				for (b_p = b.begin(); b_p != b.end(); ++ b_p) {
+					* b_p = rand() % 268435456 - 134217728; // may need to change to use ring's random gen.
+					// dpritcha, 2004-07-26
 				}
-			}
-			
-			int getThreshold () const {
-				return threshold;
-			}
-			
-			const Solver& getSolver() const {
-				return solver;
-			}
 
-			void setSolver(const Solver& s) {
-				solver = s;
-			}
-			
-			/** \brief Compute the last invariant factor of an integer matrix,
-			 * by solving linear system,
-			 * ignoring these factors of primes in list PrimeL
-			 */
-			template<class IMatrix, class Vector>
-				Integer& lastInvariantFactor(Integer& lif, const IMatrix& A, 
-							     const Vector& PrimeL) const{
-			
-				r.init(lif, 1);
-				int count = 0;
-				SolverReturnStatus tmp;
-				// Storage of rational solution
-				std::vector<Integer> r_num (A. coldim()); Integer r_den;
-				//std::vector<std::pair<Integer, Integer> > result (A.coldim());
-				//typename std::vector<std::pair<Integer, Integer> >::iterator result_p;
-				// vector b, RHS, 32-bit int is good enough
-				std::vector<int> b(A.rowdim());
-				typename std::vector<int>::iterator b_p;
-				typename Vector::const_iterator Prime_p;
-
-				Integer pri, quo, rem;
-				
-				for (; count < threshold; ++ count) {
-					// assign b to be a random vector
-					for (b_p = b.begin(); b_p != b.end(); ++ b_p) {
-						* b_p = rand() % 268435456 - 134217728; // may need to change to use ring's random gen.
-						                // dpritcha, 2004-07-26
-					}
-					
-					// try to solve Ax = b over Ring
-					tmp = solver.solveNonsingular(r_num, r_den, A, b);
-					// If no solution found
-					if (tmp != SS_OK) {
-						r.init (lif, 0);
-						break;
-					}
-					
-					r. lcmin (lif, r_den);
+				// try to solve Ax = b over Ring
+				tmp = solver.solveNonsingular(r_num, r_den, A, b);
+				// If no solution found
+				if (tmp != SS_OK) {
+					r.init (lif, 0);
+					break;
 				}
-				// filter out primes in PRIMEL from lif.					
-				if (!r. isZero (lif))
-					for ( Prime_p = PrimeL.begin(); 
-					      Prime_p != PrimeL.end();
-					      ++ Prime_p) {
-						r.init (pri, *Prime_p);
-						do {
-							r.quoRem(quo,rem,lif,pri);
-							if (r.isZero(rem)) r.assign(lif,quo);
-							else break;
-						}
-						while (true);
-					}
-				
-				return lif;
+
+				r. lcmin (lif, r_den);
 			}
-			
-			/** \brief Compute the last invariant factor of an integer matrix,
-			 * by solving linear system,
-			 * ignoring these factors of primes in list PrimeL
-			 * Implement the bonus in ref{....}
-			 */
-			template<class IMatrix, class Vector>
-				Integer& lastInvariantFactor_Bonus(Integer& lif, Integer& bonus, const IMatrix& A, 
-							     const Vector& PrimeL) const{
-			
-				r. init(lif, 1);
-				r. init (bonus, 1);
-				int count = 0;
-				SolverReturnStatus tmp1, tmp2;
-				// Storage of rational solution
-				std::vector<Integer> r1_num (A. coldim()), r2_num (A. coldim()); Integer r1_den, r2_den;
-				//std::vector<std::pair<Integer, Integer> > result (A.coldim());
-				//typename std::vector<std::pair<Integer, Integer> >::iterator result_p;
-				// vector b, RHS, 32-bit int is good enough
-				std::vector<int> b1(A. rowdim()), b2(A. rowdim());
-				typename std::vector<int>::iterator b_p;
-				typename Vector::const_iterator Prime_p;
-				Integer pri, quo, rem;
-				
-				for (; count < (threshold + 1) / 2; ++ count) {
-					// assign b to be a random vector
-					for (b_p = b1. begin(); b_p != b1. end(); ++ b_p) {
-						* b_p = rand();
-					}
-					for (b_p = b2. begin(); b_p != b2. end(); ++ b_p) {
-						* b_p = rand();
-					}
-					// try to solve Ax = b1, b2 over Ring
-					tmp1 = solver. solveNonsingular(r1_num, r1_den, A, b1);
-					tmp2 = solver. solveNonsingular(r2_num, r2_den, A, b2);
-					// If no solution found
-					if ((tmp1 != SS_OK) || (tmp2 != SS_OK)){
-						r.init (lif, 0);
-						break;
+			// filter out primes in PRIMEL from lif.
+			if (!r. isZero (lif))
+				for ( Prime_p = PrimeL.begin();
+				      Prime_p != PrimeL.end();
+				      ++ Prime_p) {
+					r.init (pri, *Prime_p);
+					do {
+						r.quoRem(quo,rem,lif,pri);
+						if (r.isZero(rem)) r.assign(lif,quo);
+						else break;
 					}
+					while (true);
+				}
 
-					r. lcm (lif, lif, r1_den);
-					r. lcm (lif, lif, r2_den);
-
-					// compute the bonus
-					Integer g, d, a11, a12, a21, a22, l, c_bonus, c_l;
-					typename std::vector<Integer>::iterator num1_p, num2_p;
-					std::vector<Integer> r1 (A. rowdim());
-					std::vector<Integer> r2 (A. rowdim());
-					typename std::vector<Integer>::iterator r1_p, r2_p;
-					r. init (l, 0);
-					int i;
-					for (i = 0; i < 20; ++ i) {
-						for (r1_p = r1. begin(), r2_p = r2. begin(); r1_p != r1. end(); ++ r1_p, ++ r2_p) {
-							r. init (*r1_p, rand());
-							r. init (*r2_p, rand());
-						}
-						r. init (a11, 0); r. init (a12, 0); r. init (a21, 0); r. init (a22, 0);
-						for (r1_p = r1. begin(), num1_p = r1_num. begin(); r1_p != r1. end(); ++ r1_p, ++ num1_p)
-							r. axpyin (a11, *r1_p, *num1_p);
-						for (r1_p = r1. begin(), num2_p = r2_num. begin(); r1_p != r1. end(); ++ r1_p, ++ num2_p)
-							r. axpyin (a12, *r1_p, *num2_p);
-						for (r2_p = r2. begin(), num1_p = r1_num. begin(); r2_p != r2. end(); ++ r2_p, ++ num1_p)
-							r. axpyin (a21, *r2_p, *num1_p);
-						for (r2_p = r2. begin(), num2_p = r2_num. begin(); r2_p != r2. end(); ++ r2_p, ++ num2_p)
-							r. axpyin (a22, *r2_p, *num2_p);
-						// g = gcd (a11, a12, a21, a22)
-						r. gcd (g, a11, a12); r. gcdin (g, a21); r. gcdin (g, a22);
-						// d = a11 a22 - a12 a21
-						r. mul (d, a12, a21); r. negin (d); r. axpyin (d, a11, a22);
-						if (! r. isZero (g)) r. div (c_l, d, g);
-						r. gcdin (l, c_l);
-					}
+			return lif;
+		}
+
+		/** \brief Compute the last invariant factor of an integer matrix,
+		 * by solving linear system,
+		 * ignoring these factors of primes in list PrimeL
+		 * Implement the bonus in ref{....}
+		 */
+		template<class IMatrix, class Vector>
+		Integer& lastInvariantFactor_Bonus(Integer& lif, Integer& bonus, const IMatrix& A,
+						   const Vector& PrimeL) const
+		{
 
-					if (!r. isZero (l) ) {
-						r. gcd (c_bonus, r1_den, r2_den);
-						r. gcdin (l, c_bonus);
-						r. divin (c_bonus, l);
+			r. init(lif, 1);
+			r. init (bonus, 1);
+			int count = 0;
+			SolverReturnStatus tmp1, tmp2;
+			// Storage of rational solution
+			std::vector<Integer> r1_num (A. coldim()), r2_num (A. coldim()); Integer r1_den, r2_den;
+			//std::vector<std::pair<Integer, Integer> > result (A.coldim());
+			//typename std::vector<std::pair<Integer, Integer> >::iterator result_p;
+			// vector b, RHS, 32-bit int is good enough
+			std::vector<int> b1(A. rowdim()), b2(A. rowdim());
+			typename std::vector<int>::iterator b_p;
+			typename Vector::const_iterator Prime_p;
+			Integer pri, quo, rem;
+
+			for (; count < (threshold + 1) / 2; ++ count) {
+				// assign b to be a random vector
+				for (b_p = b1. begin(); b_p != b1. end(); ++ b_p) {
+					* b_p = rand();
+				}
+				for (b_p = b2. begin(); b_p != b2. end(); ++ b_p) {
+					* b_p = rand();
+				}
+				// try to solve Ax = b1, b2 over Ring
+				tmp1 = solver. solveNonsingular(r1_num, r1_den, A, b1);
+				tmp2 = solver. solveNonsingular(r2_num, r2_den, A, b2);
+				// If no solution found
+				if ((tmp1 != SS_OK) || (tmp2 != SS_OK)){
+					r.init (lif, 0);
+					break;
+				}
+
+				r. lcm (lif, lif, r1_den);
+				r. lcm (lif, lif, r2_den);
+
+				// compute the bonus
+				Integer g, d, a11, a12, a21, a22, l, c_bonus, c_l;
+				typename std::vector<Integer>::iterator num1_p, num2_p;
+				std::vector<Integer> r1 (A. rowdim());
+				std::vector<Integer> r2 (A. rowdim());
+				typename std::vector<Integer>::iterator r1_p, r2_p;
+				r. init (l, 0);
+				int i;
+				for (i = 0; i < 20; ++ i) {
+					for (r1_p = r1. begin(), r2_p = r2. begin(); r1_p != r1. end(); ++ r1_p, ++ r2_p) {
+						r. init (*r1_p, rand());
+						r. init (*r2_p, rand());
 					}
+					r. init (a11, 0); r. init (a12, 0); r. init (a21, 0); r. init (a22, 0);
+					for (r1_p = r1. begin(), num1_p = r1_num. begin(); r1_p != r1. end(); ++ r1_p, ++ num1_p)
+						r. axpyin (a11, *r1_p, *num1_p);
+					for (r1_p = r1. begin(), num2_p = r2_num. begin(); r1_p != r1. end(); ++ r1_p, ++ num2_p)
+						r. axpyin (a12, *r1_p, *num2_p);
+					for (r2_p = r2. begin(), num1_p = r1_num. begin(); r2_p != r2. end(); ++ r2_p, ++ num1_p)
+						r. axpyin (a21, *r2_p, *num1_p);
+					for (r2_p = r2. begin(), num2_p = r2_num. begin(); r2_p != r2. end(); ++ r2_p, ++ num2_p)
+						r. axpyin (a22, *r2_p, *num2_p);
+					// g = gcd (a11, a12, a21, a22)
+					r. gcd (g, a11, a12); r. gcdin (g, a21); r. gcdin (g, a22);
+					// d = a11 a22 - a12 a21
+					r. mul (d, a12, a21); r. negin (d); r. axpyin (d, a11, a22);
+					if (! r. isZero (g)) r. div (c_l, d, g);
+					r. gcdin (l, c_l);
+				}
 
-					r. lcmin (bonus, c_bonus);
+				if (!r. isZero (l) ) {
+					r. gcd (c_bonus, r1_den, r2_den);
+					r. gcdin (l, c_bonus);
+					r. divin (c_bonus, l);
 				}
 
-				// filter out primes in PRIMEL from lif.					
-				if (!r. isZero (lif)) 
-					for ( Prime_p = PrimeL.begin(); Prime_p != PrimeL.end(); ++ Prime_p) {
-						r.init (pri, *Prime_p);
-						do {
-							r.quoRem(quo,rem,lif,pri);
-							if (r.isZero(rem)) r.assign(lif,quo);
-							else break;
-						} while (true);
-					} 
-				r. gcdin (bonus, lif);
-				if (!r. isZero (bonus))
-					for ( Prime_p = PrimeL.begin(); Prime_p != PrimeL.end(); ++ Prime_p) {
-						r.init (pri, *Prime_p);
-						do {
-							r.quoRem(quo,rem,bonus,pri);
-							if (r.isZero(rem)) r.assign(lif,quo);
-							else break;
-						} while (true);
-					} 
-
-				
-				return lif;
+				r. lcmin (bonus, c_bonus);
 			}
 
-                        template<class IMatrix, class Vector>
-                        Integer& lastInvariantFactor1(Integer& lif, Vector& r_num, const IMatrix& A) const {
-                                //cout << "enetering lif\n";
-                                SolverReturnStatus tmp;
-
-                                if (r_num.size()!=A. coldim()) return lif=0;
-                                Integer r_den;
-                                std::vector<Integer> b(A.rowdim());
-                                typename std::vector<Integer>::iterator b_p;
-                                //typename Vector::const_iterator Prime_p;
-
-                                Integer pri, quo, rem;
-
-                                // assign b to be a random vector
-                                for (b_p = b.begin(); b_p != b.end(); ++ b_p) {
-                                        * b_p = rand() % 268435456 - 134217728; // may need to change to use ring's random gen.
-                                        // dpritcha, 2004-07-26
-                                }
-                                //report <<"try to solve Ax = b over Ring";
-                                // try to solve Ax = b over Ring
-                                //cout << "trying to solve\n";
-                                tmp = solver.solveNonsingular(r_num, r_den, A, b);
-                                // If no solution found
-                                if (tmp != SS_OK) {
-                                        //r.init (lif, 0);
-                                        //break;
-                                        return lif=0;
-                                }
-                                //report << "r_den: "<< r_den;
-
-                                r. lcmin (lif, r_den);
-
-                                return lif;
-                        }
-
-                        template<class Vector>
-                        Integer& bonus(Integer& bonus, const Integer r1_den,const Integer r2_den, Vector& r1_num, Vector& r2_num) const {
-                                if (bonus==0) bonus=1;
-                                if (r1_num.size() != r2_num.size()) return bonus=0;
-                                Integer g, d, a11, a12, a21, a22, c_bonus, l, c_l;
-                                typename std::vector<Integer>::iterator num1_p, num2_p;
-                                std::vector<Integer> r1 (r1_num. size());
-                                std::vector<Integer> r2 (r2_num. size());
-                                typename std::vector<Integer>::iterator r1_p, r2_p;
-                                r. init (l, 0);
-                                int i;
-                                for (i = 0; i < 20; ++ i) {
-                                        for (r1_p = r1. begin(), r2_p = r2. begin(); r1_p != r1. end(); ++ r1_p, ++ r2_p) {
-                                                r. init (*r1_p, rand());
-                                                r. init (*r2_p, rand());
-                                        }
-                                        r. init (a11, 0); r. init (a12, 0); r. init (a21, 0); r. init (a22, 0);
-                                        for (r1_p = r1. begin(), num1_p = r1_num. begin(); r1_p != r1. end(); ++ r1_p, ++ num1_p)
-                                                r. axpyin (a11, *r1_p, *num1_p);
-                                        for (r1_p = r1. begin(), num2_p = r2_num. begin(); r1_p != r1. end(); ++ r1_p, ++ num2_p)
-                                                r. axpyin (a12, *r1_p, *num2_p);
-                                        for (r2_p = r2. begin(), num1_p = r1_num. begin(); r2_p != r2. end(); ++ r2_p, ++ num1_p)
-                                                r. axpyin (a21, *r2_p, *num1_p);
-                                        for (r2_p = r2. begin(), num2_p = r2_num. begin(); r2_p != r2. end(); ++ r2_p, ++ num2_p)
-                                                r. axpyin (a22, *r2_p, *num2_p);
-                                        // g = gcd (a11, a12, a21, a22)
-                                        r. gcd (g, a11, a12); r. gcdin (g, a21); r. gcdin (g, a22);
-                                        // d = a11 a22 - a12 a21
-                                        r. mul (d, a12, a21); r. negin (d); r. axpyin (d, a11, a22);
-                                        if (! r. isZero (g)) r. div (c_l, d, g);
-                                        r. gcdin (l, c_l);
-                                }
-                                if (!r. isZero (l) ) {
-                                        r. gcd (c_bonus, r1_den, r2_den);
-                                        r. gcdin (l, c_bonus);
-                                        r. divin (c_bonus, l);
-                                }
-
-                                r. lcmin (bonus, c_bonus);
-                                return bonus;
-                        }
-
-			
-			/** \brief Compute the last invariant factor.
-			 */
-			template<class IMatrix>
-			  Integer& lastInvariantFactor(Integer& lif, const IMatrix& A)  const {
-
-				std::vector<Integer> empty_v;
-				lastInvariantFactor (lif, A, empty_v);
-				return lif;
+			// filter out primes in PRIMEL from lif.
+			if (!r. isZero (lif))
+				for ( Prime_p = PrimeL.begin(); Prime_p != PrimeL.end(); ++ Prime_p) {
+					r.init (pri, *Prime_p);
+					do {
+						r.quoRem(quo,rem,lif,pri);
+						if (r.isZero(rem)) r.assign(lif,quo);
+						else break;
+					} while (true);
+				}
+			r. gcdin (bonus, lif);
+			if (!r. isZero (bonus))
+				for ( Prime_p = PrimeL.begin(); Prime_p != PrimeL.end(); ++ Prime_p) {
+					r.init (pri, *Prime_p);
+					do {
+						r.quoRem(quo,rem,bonus,pri);
+						if (r.isZero(rem)) r.assign(lif,quo);
+						else break;
+					} while (true);
+				}
+
+
+			return lif;
+		}
+
+		template<class IMatrix, class Vector>
+		Integer& lastInvariantFactor1(Integer& lif, Vector& r_num, const IMatrix& A, const bool oldMatrix=false) const
+		{
+			//cout << "enetering lif\n";
+			SolverReturnStatus tmp;
+
+			if (r_num.size()!=A. coldim()) return lif=0;
+			Integer r_den;
+			std::vector<Integer> b(A.rowdim());
+			typename std::vector<Integer>::iterator b_p;
+			//typename Vector::const_iterator Prime_p;
+
+			Integer pri, quo, rem;
+
+			// assign b to be a random vector
+			for (b_p = b.begin(); b_p != b.end(); ++ b_p) {
+				* b_p = rand() % 268435456 - 134217728; // may need to change to use ring's random gen.
+				// dpritcha, 2004-07-26
+			}
+			//report <<"try to solve Ax = b over Ring";
+			// try to solve Ax = b over Ring
+			//cout << "trying to solve\n";
+			tmp = solver.solveNonsingular(r_num, r_den, A, b,oldMatrix);
+			// If no solution found
+			if (tmp != SS_OK) {
+				//r.init (lif, 0);
+				//break;
+				return lif=0;
 			}
+			//report << "r_den: "<< r_den;
 
-			/** \brief Compute the last invariant factor with bonus
-			 */
-			template<class IMatrix>
-			  Integer& lastInvariantFactor_Bonus(Integer& lif, Integer& bonus, const IMatrix& A)  const {
+			r. lcmin (lif, r_den);
+			if (r_den != lif) {
+				Integer den,t;
+				r. lcm(den,r_den,lif);
+				r. div(t, den, r_den);
+				typename std::vector<Integer>::iterator num_p = r_num.begin();
+				for (; num_p != r_num. end(); ++num_p) {
+					r. mulin(*num_p, t);
+				}
+			}
+			return lif;
+		}
 
-				std::vector<Integer> empty_v;
-				lastInvariantFactor_Bonus (lif, bonus, A, empty_v);
-				return lif;
+		template<class Vector>
+		Integer& bonus(Integer& bonus, const Integer r1_den,const Integer r2_den, Vector& r1_num, Vector& r2_num) const
+		{
+			if (bonus==0) bonus=1;
+			if (r1_num.size() != r2_num.size()) return bonus=0;
+			Integer g, d, a11, a12, a21, a22, c_bonus, l, c_l;
+			typename std::vector<Integer>::iterator num1_p, num2_p;
+			std::vector<Integer> r1 (r1_num. size());
+			std::vector<Integer> r2 (r2_num. size());
+			typename std::vector<Integer>::iterator r1_p, r2_p;
+			r. init (l, 0);
+			int i;
+			for (i = 0; i < 20; ++ i) {
+				for (r1_p = r1. begin(), r2_p = r2. begin(); r1_p != r1. end(); ++ r1_p, ++ r2_p) {
+					r. init (*r1_p, rand());
+					r. init (*r2_p, rand());
+				}
+				r. init (a11, 0); r. init (a12, 0); r. init (a21, 0); r. init (a22, 0);
+				for (r1_p = r1. begin(), num1_p = r1_num. begin(); r1_p != r1. end(); ++ r1_p, ++ num1_p)
+					r. axpyin (a11, *r1_p, *num1_p);
+				for (r1_p = r1. begin(), num2_p = r2_num. begin(); r1_p != r1. end(); ++ r1_p, ++ num2_p)
+					r. axpyin (a12, *r1_p, *num2_p);
+				for (r2_p = r2. begin(), num1_p = r1_num. begin(); r2_p != r2. end(); ++ r2_p, ++ num1_p)
+					r. axpyin (a21, *r2_p, *num1_p);
+				for (r2_p = r2. begin(), num2_p = r2_num. begin(); r2_p != r2. end(); ++ r2_p, ++ num2_p)
+					r. axpyin (a22, *r2_p, *num2_p);
+				// g = gcd (a11, a12, a21, a22)
+				r. gcd (g, a11, a12); r. gcdin (g, a21); r. gcdin (g, a22);
+				// d = a11 a22 - a12 a21
+				r. mul (d, a12, a21); r. negin (d); r. axpyin (d, a11, a22);
+				if (! r. isZero (g)) r. div (c_l, d, g);
+				r. gcdin (l, c_l);
+			}
+			if (!r. isZero (l) ) {
+				r. gcd (c_bonus, r1_den, r2_den);
+				r. gcdin (l, c_bonus);
+				r. divin (c_bonus, l);
 			}
-	
+
+			r. lcmin (bonus, c_bonus);
+			return bonus;
+		}
+
+
+		/** \brief Compute the last invariant factor.
+		*/
+		template<class IMatrix>
+		Integer& lastInvariantFactor(Integer& lif, const IMatrix& A)  const
+		{
+
+			std::vector<Integer> empty_v;
+			lastInvariantFactor (lif, A, empty_v);
+			return lif;
+		}
+
+		/** \brief Compute the last invariant factor with bonus
+		*/
+		template<class IMatrix>
+		Integer& lastInvariantFactor_Bonus(Integer& lif, Integer& bonus, const IMatrix& A)  const
+		{
+
+			std::vector<Integer> empty_v;
+			lastInvariantFactor_Bonus (lif, bonus, A, empty_v);
+			return lif;
+		}
+
 	};
 }
 
 
-#endif
+#endif //__LINBOX_last_invariant_factor_H
+
diff --git a/linbox/algorithms/lazy-product.h b/linbox/algorithms/lazy-product.h
index b7b085a..77e669e 100644
--- a/linbox/algorithms/lazy-product.h
+++ b/linbox/algorithms/lazy-product.h
@@ -1,78 +1,111 @@
-// ======================================================================= //
-// Time-stamp: <09 Mar 07 17:57:48 Jean-Guillaume.Dumas at imag.fr> 
-// ======================================================================= //
-#ifndef __LAZY_PRODUCT__
-#define __LAZY_PRODUCT__
-
-
-namespace LinBox {
-
-        // Lazy computation of the product of the moduli
-    struct LazyProduct : public std::vector< Integer > {
-        typedef std::vector< Integer > Father_t;
-    protected:
-        bool                _tobecomputed;
-    public:
-
-        LazyProduct() : Father_t(), _tobecomputed(true) {}
-
-        void initialize(const Integer& i) {
-            _tobecomputed = false;
-            this->resize(0);
-            this->push_back(i);
-        }
-            
-        bool mulin(const Integer& i) {
-            if (this->size()) {
-                if (i != this->back()) {
-                    this->push_back( i );
-                    return _tobecomputed = true;
-                } else {
-                    return _tobecomputed;
-                }
-            
-            } else {
-                this->push_back( i );
-                return _tobecomputed = false;
-            }
-        }
-      
-        bool mulin(const LazyProduct& i) {
-            this->insert(this->end(), i.begin(), i.end());
-            return _tobecomputed = (this->size()>1);
-        }
-      
-        Integer & operator() () {
-            if (_tobecomputed) {
-                Father_t::const_iterator iter = this->begin();
-                Father_t::iterator       prod = this->begin();
-                for(++iter; iter != this->end(); ++iter)
-                    *prod *= *iter;
-                this->resize(1);
-                _tobecomputed = false;
-            }
-            return this->back();
-        }
-
-        bool noncoprime(const Integer& i) const {
-            Integer g;
-            for(Father_t::const_iterator iter = this->begin(); iter != this->end(); ++iter)
-                if ( gcd(g,i,*iter) > 1) return true;
-            return false;
-        }   
-       
-        friend std::ostream& operator<< (std::ostream& o, const LazyProduct& C) {
-            o << "{";
-            for(Father_t::const_iterator refs = C.begin();
-                refs != C.end() ;
-                ++refs )
-                o << (*refs) << " " ;
-            return o << "}";
-        }
-        
-    };
-    
+/* -*- 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
+/* Copyright (C) 2007 LinBox
+ * Written by JG Dumas
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __LINBOX_lazy_product_H
+#define __LINBOX_lazy_product_H
+
+
+namespace LinBox
+{
+
+	// Lazy computation of the product of the moduli
+	struct LazyProduct : public std::vector< Integer > {
+		typedef std::vector< Integer > Father_t;
+	protected:
+		bool                _tobecomputed;
+	public:
+
+		LazyProduct() :
+			Father_t(), _tobecomputed(true)
+		{}
+
+		void initialize(const Integer& i)
+		{
+			_tobecomputed = false;
+			this->resize(0);
+			this->push_back(i);
+		}
+
+		bool mulin(const Integer& i)
+		{
+			if (this->size()) {
+				if (i != this->back()) {
+					this->push_back( i );
+					return _tobecomputed = true;
+				}
+				else {
+					return _tobecomputed;
+				}
+
+			}
+			else {
+				this->push_back( i );
+				return _tobecomputed = false;
+			}
+		}
+
+		bool mulin(const LazyProduct& i)
+		{
+			this->insert(this->end(), i.begin(), i.end());
+			return _tobecomputed = (this->size()>1);
+		}
+
+		Integer & operator() ()
+		{
+			if (_tobecomputed) {
+				Father_t::const_iterator iter = this->begin();
+				Father_t::iterator       prod = this->begin();
+				for(++iter; iter != this->end(); ++iter)
+					*prod *= *iter;
+				this->resize(1);
+				_tobecomputed = false;
+			}
+			return this->back();
+		}
+
+		bool noncoprime(const Integer& i) const
+		{
+			Integer g;
+			for(Father_t::const_iterator iter = this->begin(); iter != this->end(); ++iter)
+				if ( gcd(g,i,*iter) > 1) return true;
+			return false;
+		}
+
+		friend std::ostream& operator<< (std::ostream& o, const LazyProduct& C)
+		{
+			o << "{";
+			for(Father_t::const_iterator refs = C.begin();
+			    refs != C.end() ;
+			    ++refs )
+				o << (*refs) << " " ;
+			return o << "}";
+		}
+
+	};
+
 }
 
 
-#endif
+#endif //__LINBOX_lazy_product_H
+
diff --git a/linbox/algorithms/lifting-container.h b/linbox/algorithms/lifting-container.h
old mode 100755
new mode 100644
index 8b60a65..fbb3e3f
--- a/linbox/algorithms/lifting-container.h
+++ b/linbox/algorithms/lifting-container.h
@@ -1,5 +1,6 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* linbox/algorithms/lifting-container-base.h
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* linbox/algorithms/lifting-container.h
  * Copyright (C) 2004 Pascal Giorgi
  *
  * Written by Pascal Giorgi pascal.giorgi at ens-lyon.fr
@@ -20,11 +21,14 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef _LIFTING_CONTAINER_H
-#define _LIFTING_CONTAINER_H
+/*! @file algorithms/lifting-container.h
+ * @ingroup algorithms
+ * @brief Lifting from <code>mod p^n</code> to rationals
+ * NO DOC
+ */
 
-//#define DEBUG_LC
-//#define LC_CHECK_DIVISION
+#ifndef __LINBOX_lifting_container_H
+#define __LINBOX_lifting_container_H
 
 #include <vector>
 
@@ -35,29 +39,33 @@
 #include <linbox/algorithms/massey-domain.h>
 #include <linbox/algorithms/blackbox-block-container.h>
 #include <linbox/algorithms/block-massey-domain.h>
+#include <linbox/algorithms/gauss.h>
 #include <linbox/blackbox/blas-blackbox.h>
 #include <linbox/vector/vector-domain.h>
 #include <linbox/blackbox/compose.h>
 #include <linbox/blackbox/block-hankel-inverse.h>
 #include <linbox/algorithms/blas-domain.h>
 #include <linbox/field/hom.h>
+#include <linbox/matrix/transpose-matrix.h>
+#include <linbox/blackbox/transpose.h>
 //#include <linbox/algorithms/vector-hom.h>
-#undef _U
 
-namespace LinBox {
+namespace LinBox
+{
 
-	/**
+	/** @brief BoundBlackbox.
 	 * BoundBlackbox: Sets
 	 *      H_col_sqr <- H_col(A)^2,   short_col_sqr <- short_col(A)^2
 	 * where H_col(A) is prod_j sqrt(sum_i a_ij^2)     ('Hadamard column bound')
 	 *   short_col(A) is min_j  sqrt(sum_i a_ij^2)     ('shortest column')
 	 *
-	 * note: H_col is not actually a norm! but it is what we need for lifting bound computation
+	 * @note H_col is not actually a norm! but it is what we need for lifting bound computation
 	 */
 	template <class Ring, class ItMatrix>
-	void SpecialBound(const Ring& R, typename Ring::Element& H_col_sqr, 
-			  typename Ring::Element& short_col_sqr, const ItMatrix& A) {
-					
+	void SpecialBound(const Ring& R, typename Ring::Element& H_col_sqr,
+			  typename Ring::Element& short_col_sqr, const ItMatrix& A)
+	{
+
 		typedef typename Ring::Element Integer;
 		//Integer sqsum;
 		//size_t m, n, col=0;
@@ -66,13 +74,13 @@ namespace LinBox {
 		R.init(H_col_sqr, 1);
 		Integer zero;
 		R.init(zero,0UL);
-		
+
 		typename ItMatrix::ConstRowIterator row= A.rowBegin();
 		std::vector<Integer> tmp(A.coldim(), zero);
 		for (; row != A.rowEnd(); row++){
 			typename ItMatrix::ConstRow::const_iterator elm= row->begin();
 			for (size_t i=0; elm != row->end(); elm++, ++i)
-				R.axpyin(tmp[i], *elm, *elm);			
+				R.axpyin(tmp[i], *elm, *elm);
 		}
 
 		for (size_t i=0;i<A.coldim();++i)
@@ -80,45 +88,50 @@ namespace LinBox {
 		short_col_sqr= *(std::min_element(tmp.begin(),tmp.end()));
 
 		/* at this point RowIterator is better than ColIterator
-		typename ItMatrix::ConstColIterator colIter;
-		colIter = A.colBegin();
-
-		for (; colIter != A.colEnd(); colIter++, col++) {
-			typename ItMatrix::ConstCol::const_iterator elm;
-			R.init(sqsum, 0);
-			for (elm = colIter->begin(); elm != colIter->end(); elm++)
-				R.axpyin(sqsum, *elm, *elm);
-			R.mulin(H_col_sqr, sqsum);
-			if (col == 0 || sqsum < short_col_sqr)
-				short_col_sqr = sqsum;
-		}
-		*/
-		
+		   typename ItMatrix::ConstColIterator colIter;
+		   colIter = A.colBegin();
+
+		   for (; colIter != A.colEnd(); colIter++, col++) {
+		   typename ItMatrix::ConstCol::const_iterator elm;
+		   R.init(sqsum, 0);
+		   for (elm = colIter->begin(); elm != colIter->end(); elm++)
+		   R.axpyin(sqsum, *elm, *elm);
+		   R.mulin(H_col_sqr, sqsum);
+		   if (col == 0 || sqsum < short_col_sqr)
+		   short_col_sqr = sqsum;
+		   }
+		   */
+
 	}
 
 	// in solveNonsingular, we may work with something that inherits from DenseMatrixBase
 	template <class Ring>
-	void BoundBlackbox(const Ring& R, typename Ring::Element& H_col_sqr, 
-			   typename Ring::Element& short_col_sqr, const DenseMatrixBase<typename Ring::Element>& A) {
+	void BoundBlackbox(const Ring& R, typename Ring::Element& H_col_sqr,
+			   typename Ring::Element& short_col_sqr, const DenseMatrixBase<typename Ring::Element>& A)
+	{
 		SpecialBound(R, H_col_sqr, short_col_sqr, A);
 	}
-	template <class Ring>
 
-	void BoundBlackbox(const Ring& R, typename Ring::Element& H_col_sqr, 
-			   typename Ring::Element& short_col_sqr, const BlasBlackbox<Ring>& A) {
+	template <class Ring>
+	void BoundBlackbox(const Ring& R, typename Ring::Element& H_col_sqr,
+			   typename Ring::Element& short_col_sqr, const BlasBlackbox<Ring>& A)
+	{
 		SpecialBound(R, H_col_sqr, short_col_sqr, A);
 	}
 
 	// in other solvers we generally use BlasBlackbox which inherits from DenseSubmatrix
 	template <class Ring>
-	void BoundBlackbox(const Ring& R, typename Ring::Element& H_col_sqr, 
-			   typename Ring::Element& short_col_sqr, const DenseSubmatrix<typename Ring::Element>& A) {
+	void BoundBlackbox(const Ring& R, typename Ring::Element& H_col_sqr,
+			   typename Ring::Element& short_col_sqr, const DenseSubmatrix<typename Ring::Element>& A)
+	{
 		SpecialBound(R, H_col_sqr, short_col_sqr, A);
 	}
 
 
 	template < class Ring, class Blackbox>
-	void BoundBlackbox (const Ring& R, typename Ring::Element& H_col_sqr, typename Ring::Element& short_col_sqr, const Blackbox& A) {
+	void BoundBlackbox (const Ring& R, typename Ring::Element& H_col_sqr,
+			    typename Ring::Element& short_col_sqr, const Blackbox& A)
+	{
 
 		typedef typename Ring::Element Integer;
 		Integer one,zero,sqsum;
@@ -130,7 +143,7 @@ namespace LinBox {
 		R.init(H_col_sqr, 1);
 		typename std::vector<Integer>::const_iterator iter;
 		std::vector<Integer> e(n,zero),tmp(m);
-	
+
 		for (size_t i=0;i<n;i++){
 			e[i]=one;
 			A.apply(tmp,e);
@@ -139,14 +152,16 @@ namespace LinBox {
 				sqsum += (*iter)*(*iter);
 			}
 			R.mulin(H_col_sqr, sqsum);
-			if (i==0 || sqsum < short_col_sqr) 
+			if (i==0 || sqsum < short_col_sqr)
 				short_col_sqr = sqsum;
 			e[i]=zero;
 		}
 	}
 
 	template < class Ring, class Matrix1, class Matrix2>
-	void BoundBlackbox (const Ring& R, typename Ring::Element& H_col_sqr, typename Ring::Element& short_col_sqr, const Compose<Matrix1,Matrix2> & A) {
+	void BoundBlackbox (const Ring& R, typename Ring::Element& H_col_sqr,
+			    typename Ring::Element& short_col_sqr, const Compose<Matrix1,Matrix2> & A)
+	{
 		typedef typename Ring::Element Integer;
 		Integer one,zero,sqsum;
 		size_t m,n;
@@ -164,14 +179,16 @@ namespace LinBox {
 			for (iter=tmp.begin();iter!=tmp.end();++iter)
 				sqsum += (*iter)*(*iter);
 			R.mulin(H_col_sqr, sqsum);
-			if (i==0 || sqsum < short_col_sqr) 
+			if (i==0 || sqsum < short_col_sqr)
 				short_col_sqr = sqsum;
 			e[i]=zero;
 		}
 	}
-	
+
 	template < class Ring, class Matrix>
-	void BoundBlackbox (const Ring& R, typename Ring::Element& H_col_sqr, typename Ring::Element& short_col_sqr, const Transpose<Matrix> & A) {
+	void BoundBlackbox (const Ring& R, typename Ring::Element& H_col_sqr,
+			    typename Ring::Element& short_col_sqr, const Transpose<Matrix> & A)
+	{
 		typedef typename Ring::Element Integer;
 		Integer one,zero,sqsum;
 		size_t m,n;
@@ -189,60 +206,63 @@ namespace LinBox {
 			for (iter=tmp.begin();iter!=tmp.end();++iter)
 				sqsum += (*iter)*(*iter);
 			R.mulin(H_col_sqr, sqsum);
-			if (i==0 || sqsum < short_col_sqr) 
+			if (i==0 || sqsum < short_col_sqr)
 				short_col_sqr = sqsum;
 			e[i]=zero;
 		}
 	}
 
 
-	/* 
-	   This should work with blackboxes. However it is much slower if column iterators are available.
-	   Furthermore the compiler always binds to this instead of the above faster version; so some 
-	   trickier kind of specialization may have to be done when BoundBlackBox is to be used with true blackboxes.
-	   (Or is the plural Blackboxen?)
-
+	/*
+	 *  This should work with blackboxes. However it is much slower if
+	 *  column iterators are available.  Furthermore the compiler always
+	 *  binds to this instead of the above faster version; so some trickier
+	 *  kind of specialization may have to be done when BoundBlackBox is to
+	 *  be used with true blackboxes.  (Or is the plural Blackboxen?)
+	 */
+#if 0
 	   template < class Ring, class IMatrix>
-	   void BoundBlackbox 
-	   (const Ring& R, typename Ring::Element& H_col_sqr, typename Ring::Element& short_col_sqr, const IMatrix& A) {
-	   typedef typename Ring::Element Integer;
-	   Integer one,zero,sqsum;
-	   size_t m,n;
-	   n=A.coldim();
-	   m=A.rowdim();
-	   R.init(one,1);
-	   R.init(zero,0);
-	   R.init(H_col_sqr, 1);
-	   typename std::vector<Integer>::const_iterator iter;
-	   std::vector<Integer> e(n,zero),tmp(m);
-	   for (size_t i=0;i<n;i++){
-	   e[i]=one;
-	   A.apply(tmp,e);
-	   sqsum=zero;
-	   for (iter=tmp.begin();iter!=tmp.end();++iter)
-	   sqsum += (*iter)*(*iter);
-	   R.mulin(H_col_sqr, sqsum);
-	   if (i==0 || sqsum < short_col_sqr) 
-	   short_col_sqr = sqsum;
-	   e[i]=zero;
+	   void BoundBlackbox (const Ring& R, typename Ring::Element& H_col_sqr,
+			       typename Ring::Element& short_col_sqr, const IMatrix& A) {
+		   typedef typename Ring::Element Integer;
+		   Integer one,zero,sqsum;
+		   size_t m,n;
+		   n=A.coldim();
+		   m=A.rowdim();
+		   R.init(one,1);
+		   R.init(zero,0);
+		   R.init(H_col_sqr, 1);
+		   typename std::vector<Integer>::const_iterator iter;
+		   std::vector<Integer> e(n,zero),tmp(m);
+		   for (size_t i=0;i<n;i++){
+			   e[i]=one;
+			   A.apply(tmp,e);
+			   sqsum=zero;
+			   for (iter=tmp.begin();iter!=tmp.end();++iter)
+				   sqsum += (*iter)*(*iter);
+			   R.mulin(H_col_sqr, sqsum);
+			   if (i==0 || sqsum < short_col_sqr)
+				   short_col_sqr = sqsum;
+			   e[i]=zero;
+		   }
 	   }
-	   }
-	*/
+#endif
 
-	/**
-	 * ApplyBound: computes
+	/** @brief ApplyBound.
+	 * ApplyBound computes
 	 *         bound_A <- max_i(max(sum_{j|a_ij > 0} a_ij, sum_{j|a_ij < 0} |a_ij|))
 	 * this is useful because for all u, v >= 0:
-	 *     [b has all entries in -u..v] 
-         *       => [each entry of A.b is at most (u+v)*bound_A in absolute value]
+	 *     [b has all entries in -u..v]
+	 *       => [each entry of A.b is at most (u+v)*bound_A in absolute value]
 	 */
 	template <class Ring, class ItMatrix> //iterable matrix
-	void ApplyBound(const Ring& R, typename Ring::Element& bound_A, const ItMatrix& A) {
+	void ApplyBound(const Ring& R, typename Ring::Element& bound_A, const ItMatrix& A)
+	{
 		typedef typename Ring::Element Integer;
 		Integer possum, negsum, zero;
 		R.init(bound_A, 0);
 		R.init(zero, 0);
-		
+
 		typename ItMatrix::ConstRowIterator rowIter;
 		rowIter = A.rowBegin();
 
@@ -250,12 +270,12 @@ namespace LinBox {
 			typename ItMatrix::ConstRow::const_iterator elm;
 			R.init(possum, 0);
 			R.init(negsum, 0);
-			for (elm = rowIter->begin(); elm != rowIter->end(); elm++) 
-				if (*elm > zero) 
+			for (elm = rowIter->begin(); elm != rowIter->end(); elm++)
+				if (*elm > zero)
 					R.addin(possum, *elm);
 				else
 					R.subin(negsum, *elm);
-			
+
 			if (possum > bound_A)
 				R.assign(bound_A, possum);
 			if (negsum > bound_A)
@@ -265,41 +285,40 @@ namespace LinBox {
 
 	template< class _Ring>
 	class LiftingContainer {
-		
 	public:
 		typedef _Ring Ring;
 		typedef typename Ring::Element Integer;
-				
+
 		// return the length of container
-		virtual const size_t length() const =0;
+		virtual size_t length() const =0;
 
 		// return the size of the solution
-		virtual const size_t size() const = 0;
+		virtual size_t size() const = 0;
 
 		// return the ring
 		virtual const Ring& ring() const = 0;
-				
+
 		// return the prime
-		virtual const Integer& prime () const = 0; 		
+		virtual const Integer& prime () const = 0;
 
 		virtual ~LiftingContainer () {}
-		
+
 	};
 
 	template< class _Ring, class _IMatrix>
 	class LiftingContainerBase : public LiftingContainer< _Ring> {
 
-	public:		
+	public:
 		typedef _IMatrix                  IMatrix;
 		typedef _Ring                        Ring;
-		typedef typename _Ring::Element   Integer;		
+		typedef typename _Ring::Element   Integer;
 		typedef std::vector<Integer>      IVector;
 #ifdef RSTIMING
 		mutable Timer ttSetup, tRingApply, tRingOther, ttRingOther, ttRingApply;
 #endif
 
 	protected:
-						
+
 		const IMatrix&            _A;
 		Ring                      _R;
 		Integer                   _p;
@@ -311,28 +330,31 @@ namespace LinBox {
 		MatrixApplyDomain<Ring,IMatrix>    _MAD;
 		//BlasApply<Ring>          _BA;
 
-	
-	
 
-		void convertPrime(Integer& e, const integer& p){
+
+
+		void convertPrime(Integer& e, const integer& p)
+		{
 			_R.init(e,p);
 		}
-		
 
-		void convertPrime(Integer& e, const std::vector<integer>& p){
+
+		void convertPrime(Integer& e, const std::vector<integer>& p)
+		{
 			integer tmp=1;
 			for (size_t i=0;i<p.size();++i)
-				tmp*=integer(p[i]);			
+				tmp*=integer(p[i]);
 			_R.init(e,tmp);
 		}
-	
+
 
 	public:
 
 		template <class Prime_Type, class Vector1>
 		LiftingContainerBase (const Ring& R, const IMatrix& A, const Vector1& b, const Prime_Type& p):
-			_A(A), _R(R), _VDR(R), _MAD(R,A) {
-		
+			_A(A), _R(R), _VDR(R), _MAD(R,A)
+		{
+
 #ifdef RSTIMING
 			ttSetup.start();
 #endif
@@ -347,18 +369,18 @@ namespace LinBox {
 			//this->_R.init(_p,p);
 			this->convertPrime(_p, p);
 			//std::cout<<"padic base= "<<_p<<std::endl;
-			
-			
+
+
 			// initialize res = b
 			_b.resize(b.size());
 			typename Vector1::const_iterator         b_iter    = b.begin();
 			typename std::vector<Integer>::iterator  res_iter  = _b.begin() ;
-			for (; b_iter != b.end(); ++res_iter, ++b_iter) 
+			for (; b_iter != b.end(); ++res_iter, ++b_iter)
 				this->_R.init(*res_iter, *b_iter);
-						
+
 			Integer had_sq, short_sq;
 			BoundBlackbox(this->_R, had_sq, short_sq, A);
-			
+
 			typename std::vector<Integer>::const_iterator iterb = _b.begin();
 			Integer normb_sq;
 			this->_R.init(normb_sq, 0);
@@ -372,24 +394,24 @@ namespace LinBox {
 			this->_R.convert(prime,_p);
 			D = sqrt(had_sqi) + 1;
 			N = sqrt(had_sqi * normb_sqi / short_sqi) + 1;
-			L = N * D * 2; 
+			L = N * D * 2;
 			_length = logp(L,prime) + 1;   // round up instead of down
-#ifdef DEBUG_LC                                   
+#ifdef DEBUG_LC
 			std::cout<<" norms computed, p = "<<_p<<"\n";
 			std::cout<<" N = "<<N<<", D = "<<D<<", length = "<<_length<<"\n";
 			std::cout<<"A:=\n";
-			_A.write(std::cout);
+			//_A.write(std::cout);
 			std::cout<<"b:=\n";
 			for (size_t i=0;i<_b.size();++i) std::cout<<_b[i]<<" , ";
 			std::cout<<std::endl;
 #endif
 			this->_R.init(_numbound,N);
 			this->_R.init(_denbound,D);
-	
-			_MAD.setup( prime );		
-			
-#ifdef DEBUG_LC		
-			std::cout<<"lifting container initialized\n";			
+
+			_MAD.setup( prime );
+
+#ifdef DEBUG_LC
+			std::cout<<"lifting container initialized\n";
 #endif
 #ifdef RSTIMING
 			ttSetup.stop();
@@ -397,7 +419,7 @@ namespace LinBox {
 			ttRingApply.clear();
 #endif
 		}
-		
+
 		virtual IVector& nextdigit (IVector& , const IVector&) const = 0;
 
 		class const_iterator {
@@ -406,16 +428,18 @@ namespace LinBox {
 			const LiftingContainerBase    &_lc;
 			size_t                   _position;
 		public:
-			const_iterator(const LiftingContainerBase& lc,size_t end=0)
-				: _res(lc._b), _lc(lc), _position(end) {}					
-			
+			const_iterator(const LiftingContainerBase& lc,size_t end=0) :
+				_res(lc._b), _lc(lc), _position(end)
+			{}
+
 			/**
 			 * @returns False if the next digit cannot be computed
 			 * (probably indicates modulus is bad)
 			 */
-			bool next (IVector& digit)  {
-				
-				linbox_check (digit.size() == _lc._A.rowdim());	  
+			bool next (IVector& digit)
+			{
+
+				linbox_check (digit.size() == _lc._A.rowdim());
 				// compute next p-adic digit
 				_lc.nextdigit(digit,_res);
 #ifdef RSTIMING
@@ -426,214 +450,257 @@ namespace LinBox {
 				std::cout<<"\n residu "<<_position<<": ";
 				for (size_t i=0;i<digit.size();++i)
 					std::cout<<_res[i]<<",";
-				std::cout<<"\n digit "<<_position<<": ";			
+				std::cout<<"\n digit "<<_position<<": ";
 				for (size_t i=0;i<digit.size();++i)
 					std::cout<<digit[i]<<",";
 				std::cout<<"\n";
-#endif 	
+#endif
 				/*  prepare for updating residu */
 
-				// compute v2 = _A * digit				
+				// compute v2 = _A * digit
 				IVector v2 (_lc._A.coldim());
 				_lc._MAD.applyV(v2,digit, _res);
 
+#ifdef DEBUG_LC
+
+				//_A.write(std::cout<<"\n _A :\n");
+				std::cout<<"\n A * digit "<<_position<<": ";
+				for (size_t i=0;i<v2.size();++i)
+					std::cout<<v2[i]<<",";
+
+#endif
 #ifdef RSTIMING
 				_lc.tRingApply.stop();
 				_lc.ttRingApply += _lc.tRingApply;
 				_lc.tRingOther.start();
 #endif
 
-				// update _res -= v2 
+				// update _res -= v2
 				_lc._VDR.subin (_res, v2);
 				typename std::vector<Integer>::iterator p0;
 				// update _res = _res / p
 				int index=0;
-				for ( p0 = _res.begin(); p0 != _res.end(); ++ p0, ++index){ 
+				for ( p0 = _res.begin(); p0 != _res.end(); ++ p0, ++index){
 #ifdef LC_CHECK_DIVISION
- 					if (! _lc._R.isDivisor(*p0,_lc._p)) {
+					if (! _lc._R.isDivisor(*p0,_lc._p)) {
 						std::cout<<"residue "<<*p0<<" not divisible by modulus "<<_lc._p<<std::endl;
- 						std::cout<<"residue "<<*p0<<" not divisible by modulus "<<_lc._p<<std::endl;
- 						return false;
- 					}
+						std::cout<<"residue "<<*p0<<" not divisible by modulus "<<_lc._p<<std::endl;
+						return false;
+					}
 #endif
 					_lc._R.divin(*p0, _lc._p);
 				}
-				
+
 				// increase position of the iterator
 				_position++;
-#ifdef RSTIMING				
+#ifdef RSTIMING
 				_lc.tRingOther.stop();
 				_lc.ttRingOther += _lc.tRingOther;
 #endif
 				return true;
 			}
 
-			bool operator != (const const_iterator& iterator) const {
-				if ( &_lc != &iterator._lc)
+			bool operator != (const const_iterator& iterator) const
+			{
+				if ( &_lc != &iterator._lc) {
 					;//assert("try to compare differents LiftingContainer::const_iterator , abort\n");
-				return _position != iterator._position;					
+				}
+				return _position != iterator._position;
 			}
-	
-			bool operator == (const const_iterator& iterator) const {
-				if ( &_lc != &iterator._lc)
+
+			bool operator == (const const_iterator& iterator) const
+			{
+				if ( &_lc != &iterator._lc) {
 					;//assert("try to compare differents LiftingContainer::const_iterator , abort\n");
-				return _position == iterator._position;					
+				}
+				return _position == iterator._position;
 			}
 
 		};
 
-		/** Bit manipulation function for possible use in optimization
-		 // efficiently pulls out continuous blocks of bits, from lsb to msb inclusive
-		 // least significant bits start at index 0, so msb >= lsb
-		 // if any bits with index >= 8*numBytes are asked for they will be zeroes
-		 static long long bytesToBits(unsigned char * byteArray, size_t numBytes, size_t lsb, size_t msb) { 
-		 linbox_check(msb >= lsb);
-		 size_t lsbi = lsb >> 3;
-		 size_t msbi = msb >> 3;
-		 if (msbi == lsbi) 
-		 if (msbi >= numBytes) 
-		 return 0;
-		 else
-		 return (byteArray[lsbi] >> (lsb & 7)) & ((1 << (msb - lsb + 1)) - 1);
-
-		 long long result = (msbi < numBytes) ? (byteArray[msbi] & ((1 << ((msb & 7)+1)) - 1)) : 0;
-		 for (size_t i=msbi-1; i>lsbi; i--) {
-		 result <<= 8;
-		 result |= (i < numBytes) ? byteArray[i] : 0;
-		 }
-		 result <<= 8 - (lsb & 7);
-		 result |= (lsbi < numBytes) ? (byteArray[lsbi] >> (lsb & 7)) : 0;
-
-		 return result;
-		 }
-		*/
-
-		const_iterator begin() const {
+		/*- @brief Bit manipulation function for possible use in optimization.
+		 * efficiently pulls out continuous blocks of bits, from lsb to msb inclusive
+		 * least significant bits start at index 0, so msb >= lsb
+		 * if any bits with index >= 8*numBytes are asked for they will be zeroes
+		 */
+#if 0
+		static long long bytesToBits(unsigned char * byteArray, size_t numBytes, size_t lsb, size_t msb) {
+			linbox_check(msb >= lsb);
+			size_t lsbi = lsb >> 3;
+			size_t msbi = msb >> 3;
+			if (msbi == lsbi)
+				if (msbi >= numBytes)
+					return 0;
+				else
+					return (byteArray[lsbi] >> (lsb & 7)) & ((1 << (msb - lsb + 1)) - 1);
+
+			long long result = (msbi < numBytes) ? (byteArray[msbi] & ((1 << ((msb & 7)+1)) - 1)) : 0;
+			for (size_t i=msbi-1; i>lsbi; i--) {
+				result <<= 8;
+				result |= (i < numBytes) ? byteArray[i] : 0;
+			}
+			result <<= 8 - (lsb & 7);
+			result |= (lsbi < numBytes) ? (byteArray[lsbi] >> (lsb & 7)) : 0;
+
+			return result;
+		}
+#endif
+
+		const_iterator begin() const
+		{
 			return const_iterator(*this);
-		}		
+		}
 
-		const_iterator end() const {
+		const_iterator end() const
+		{
 			return const_iterator (*this,_length);
 		}
-	
-		virtual const size_t length() const
-		{ return _length;}
-		
+
+		virtual size_t length() const
+		{
+			return _length;
+		}
+
 		// return the size of the solution
-		virtual const size_t size() const 
-		{ return _A.coldim();}
+		virtual size_t size() const
+		{
+			return _A.coldim();
+		}
 
 		// return the ring
-		virtual const Ring& ring() const 
-		{ return this->_R; }
-		
+		virtual const Ring& ring() const
+		{
+			return this->_R;
+		}
+
 		// return the prime
-		virtual const Integer& prime () const 
-		{ return _p; }
-		
+		virtual const Integer& prime () const
+		{
+			return _p;
+		}
+
 		// return the bound for the numerator
 		const Integer numbound() const
-		{return _numbound;}
-		
+		{
+			return _numbound;
+		}
+
 		// return the bound for the denominator
 		const Integer denbound() const
-		{return _denbound;}
-		
+		{
+			return _denbound;
+		}
+
 		// return the matrix
 		const IMatrix& getMatrix() const
-		{return _A; }
+		{
+			return _A;
+		}
 
 		// return the right hand side
 		const IVector& getVector() const
-		{return _b;}
-		
+		{
+			return _b;
+		}
+
 	};
 
+	/// Dixon Lifting Container
 	template <class _Ring, class _Field, class _IMatrix, class _FMatrix>
 	class DixonLiftingContainer : public LiftingContainerBase< _Ring, _IMatrix> {
 
 	public:
 		typedef _Field                               Field;
 		typedef _Ring                                 Ring;
-		typedef _IMatrix                           IMatrix;		
-		typedef _FMatrix                           FMatrix;	
+		typedef _IMatrix                           IMatrix;
+		typedef _FMatrix                           FMatrix;
 		typedef typename Field::Element            Element;
 		typedef typename IMatrix::Element          Integer;
 		typedef std::vector<Integer>               IVector;
 		typedef std::vector<Element>               FVector;
 
 	protected:
-		
-		const FMatrix&                  _Ap;	
+
+		const FMatrix&                  _Ap;
 		Field                            _F;
 		const VectorDomain<Field>      _VDF;
 		mutable FVector              _res_p;
-		mutable FVector            _digit_p;		
+		mutable FVector            _digit_p;
 		BlasApply<Field>                _BA;
-		
+
 	public:
 #ifdef RSTIMING
 		mutable Timer tGetDigit, ttGetDigit, tGetDigitConvert, ttGetDigitConvert;
 #endif
 
 		template <class Prime_Type, class VectorIn>
-		DixonLiftingContainer (const Ring&       R, 
-				       const Field&      F, 
-				       const IMatrix&    A, 
-				       const FMatrix&   Ap, 
-				       const VectorIn&   b, 
-				       const Prime_Type& p)
-			: LiftingContainerBase<Ring,IMatrix> (R,A,b,p), _Ap(Ap), _F(F), _VDF(F), 
-			  _res_p(b.size()), _digit_p(A.coldim()), _BA(F) 
+		DixonLiftingContainer (const Ring&       R,
+				       const Field&      F,
+				       const IMatrix&    A,
+				       const FMatrix&   Ap,
+				       const VectorIn&   b,
+				       const Prime_Type& p) :
+			LiftingContainerBase<Ring,IMatrix> (R,A,b,p), _Ap(Ap), _F(F), _VDF(F),
+			_res_p(b.size()), _digit_p(A.coldim()), _BA(F)
 		{
 
 			for (size_t i=0; i< _res_p.size(); ++i)
 				_F.init(_res_p[i]);
 			for (size_t i=0; i< _digit_p.size(); ++i)
 				_F.init(_digit_p[i]);
-			
-			//Ap.write(std::cout,F);
+
+			//
 #ifdef RSTIMING
 			ttGetDigit.clear();
 			ttGetDigitConvert.clear();
-#endif	
+#endif
 #ifdef DEBUG_LC
 			std::cout<<"Primes: ";
 			_F.write(std::cout);
+			std::cout<<"\n Matrix: \n";
+			A.write(std::cout);
+			std::cout<<"\n Matrix mod p: \n";
+			Ap.write(std::cout);
+			std::cout<<"\n Matrix LCBASE: \n";
+			LiftingContainerBase<Ring,IMatrix>::_A.write(std::cout);
 #endif
 
 		}
-		
-		
+
+
 		virtual ~DixonLiftingContainer() {}
 
 		// return the field
-		const Field& field() const { return _F; }
+		const Field& field() const
+		{
+			return _F;
+		}
 
 	protected:
-		
-		virtual IVector& nextdigit(IVector& digit, const IVector& residu) const {		
-#ifdef RSTIMING			
+
+		virtual IVector& nextdigit(IVector& digit, const IVector& residu) const
+		{
+#ifdef RSTIMING
 			tGetDigitConvert.start();
 #endif
 			LinBox::integer tmp;
-			
+
 			Hom<Ring, Field> hom(this->_R, _F);
 			// res_p =  residu mod p
-			//VectorHom::map (_res_p, residu, _F, this->_R);			
+			//VectorHom::map (_res_p, residu, _F, this->_R);
 			{
 				typename FVector::iterator iter_p = _res_p.begin();
 				typename IVector::const_iterator iter = residu.begin();
 				for ( ;iter != residu. end(); ++iter, ++iter_p)
 					//_F. init (*iter_p, this->_R.convert(tmp,*iter));
-					hom.image(*iter_p, *iter);//std::cout<<*iter_p<<"= "<< *iter<<" mod "<<this->_p<<"\n";}
-			}			
+					hom.image(*iter_p, *iter);//std::cout<<*iter_p<<"= "<< *iter<<" mod "<<this->_p<<"\n";
+			}
 #ifdef RSTIMING
 			tGetDigitConvert.stop();
 			ttGetDigitConvert += tGetDigitConvert;
 			tGetDigit.start();
-#endif			
-			
+#endif
+
 			// compute the solution by applying the inverse of A mod p
 			//_BA.applyV(_digit_p,_Ap,_res_p);
 			_Ap.apply(_digit_p, _res_p);
@@ -643,34 +710,33 @@ namespace LinBox {
 			tGetDigitConvert.start();
 #endif
 			// digit = digit_p
-			//VectorHom::map(digit, _digit_p, this->_R, _F);			
+			//VectorHom::map(digit, _digit_p, this->_R, _F);
 			{
-				typename FVector::const_iterator iter_p = _digit_p.begin(); 
+				typename FVector::const_iterator iter_p = _digit_p.begin();
 				typename IVector::iterator iter = digit.begin();
-				
+
 				for ( ; iter_p!= _digit_p.end(); ++iter_p, ++iter)
 					//this->_R.init(*iter, _F.convert(tmp,*iter_p));
 					hom.preimage(*iter, *iter_p);
 			}
-			
+
 #ifdef RSTIMING
 			tGetDigitConvert.stop();
 			ttGetDigitConvert += tGetDigitConvert;
-#endif		
+#endif
 			return digit;
 		}
-		
-	}; // end of class DixonLiftingContainerBase
-
 
+	}; // end of class DixonLiftingContainerBase
 
+	/// Wiedemann LiftingContianer.
 	template <class _Ring, class _Field, class _IMatrix, class _FMatrix, class _FPolynomial>
 	class WiedemannLiftingContainer : public LiftingContainerBase<_Ring, _IMatrix> {
 
 	public:
 		typedef _Field                                     Field;
 		typedef _Ring                                       Ring;
-		typedef _IMatrix                                 IMatrix;		
+		typedef _IMatrix                                 IMatrix;
 		typedef _FMatrix                                 FMatrix;
 		typedef typename Field::Element                  Element;
 		typedef typename Ring::Element                   Integer;
@@ -687,22 +753,23 @@ namespace LinBox {
 		const VectorDomain<Field>      _VDF;
 		mutable FVector              _res_p;
 		mutable FVector            _digit_p;
-		typename Field::RandIter      _rand;		
+		typename Field::RandIter      _rand;
 #ifdef RSTIMING
 	public:
 		mutable Timer tGetDigit, ttGetDigit, tGetDigitConvert, ttGetDigitConvert;
-#endif			
+#endif
 	public:
 
 		template <class Prime_Type, class VectorIn>
 		WiedemannLiftingContainer (const Ring& R,
-					   const Field& F, 
-					   const IMatrix& A, 
-					   const FMatrix& Ap, 
+					   const Field& F,
+					   const IMatrix& A,
+					   const FMatrix& Ap,
 					   const FPolynomial& MinPoly,
-					   const VectorIn& b, 
-					   const Prime_Type& p)
-			: LiftingContainerBase<Ring,IMatrix> (R,A,b,p), _Ap(Ap), _MinPoly(MinPoly), _F(F), _VDF(F), _res_p(b.size()), _digit_p(A.coldim()), _rand(F) {
+					   const VectorIn& b,
+					   const Prime_Type& p) :
+			LiftingContainerBase<Ring,IMatrix> (R,A,b,p), _Ap(Ap), _MinPoly(MinPoly), _F(F), _VDF(F), _res_p(b.size()), _digit_p(A.coldim()), _rand(F)
+		{
 
 			// Normalize the minimal polynomial as f(x)=1- a1/a0 x - a2/a0 x^2 - ...
 			FPolyIterator iter=_MinPoly.begin();
@@ -719,14 +786,18 @@ namespace LinBox {
 		virtual ~WiedemannLiftingContainer() {}
 
 		// return the field
-		const Field& field() const { return _F; }
+		const Field& field() const
+		{
+			return _F;
+		}
 
 	protected:
-		
-		virtual IVector& nextdigit(IVector& digit,const IVector& residu) const {
-			
+
+		virtual IVector& nextdigit(IVector& digit,const IVector& residu) const
+		{
+
 			LinBox::integer tmp;
-#ifdef RSTIMING			
+#ifdef RSTIMING
 			tGetDigitConvert.start();
 #endif
 			// res_p =  residu mod p
@@ -736,22 +807,22 @@ namespace LinBox {
 				for ( ;iter != residu. end(); ++iter, ++iter_p)
 					_F. init (*iter_p, this->_R.convert(tmp,*iter));
 			}
-#ifdef RSTIMING			
+#ifdef RSTIMING
 			tGetDigitConvert.stop();
 			ttGetDigitConvert+=tGetDigitConvert;
 			tGetDigit.start();
-#endif		
+#endif
 			// compute the solution of system by Minimal polynomial application
-			_VDF.mul (_digit_p, _res_p, _MinPoly.back ());      
-			FVector z(_Ap.rowdim ());      
-			
-			
-			for (size_t i = _MinPoly.size () - 1; --i > 0;) {												
+			_VDF.mul (_digit_p, _res_p, _MinPoly.back ());
+			FVector z(_Ap.rowdim ());
+
+
+			for (size_t i = _MinPoly.size () - 1; --i ;) {
 				_Ap.apply (z, _digit_p);
 				_VDF.axpy (_digit_p, _MinPoly[i], _res_p, z);
-			}      
+			}
+
 
-			      
 			// check results
 			FVector error(_Ap.coldim());
 			_Ap.apply(error,_digit_p);
@@ -774,21 +845,21 @@ namespace LinBox {
 					std::cout<<" the prime was not good \n, result will be wrong";
 					break;
 				}
-				
+
 				// denormalize the minimal polynomial
 				FPolyIterator iter=_MinPoly.begin();
 				while (++iter != _MinPoly.end()) {
 					_F.mulin (*iter, _MinPoly.front());
 					_F.negin (*iter);
-				}	
-		       	
-				// update the minimal polynomial 
+				}
+
+				// update the minimal polynomial
 				Element zero;
 				_F.init(zero,0);
 				FPolynomial newMinPoly(_MinPoly.size()+Poly.size()-1,zero);
 				for (size_t i=0; i < _MinPoly.size(); i++)
 					for (size_t j=0 ; j < Poly.size(); j++)
-						_F.axpyin(newMinPoly[i+j],_MinPoly[i],Poly[j]);	
+						_F.axpyin(newMinPoly[i+j],_MinPoly[i],Poly[j]);
 				_MinPoly.clear();
 				Poly.clear();
 				_MinPoly=newMinPoly;
@@ -799,15 +870,15 @@ namespace LinBox {
 					_F.divin (*iter, _MinPoly.front ());
 					_F.negin (*iter);
 				}
-				
-				_VDF.mul (_digit_p, _res_p, _MinPoly.back ());      
-				FVector z(_Ap.rowdim ());      
-				for (size_t i = _MinPoly.size () - 1; --i > 0;) {		
+
+				_VDF.mul (_digit_p, _res_p, _MinPoly.back ());
+				FVector z(_Ap.rowdim ());
+				for (size_t i = _MinPoly.size () - 1; --i > 0;) {
 					_Ap.apply (z, _digit_p);
 					_VDF.axpy (_digit_p, _MinPoly[i], _res_p, z);
-				}    
+				}
 
-				_Ap.apply(error,_digit_p);	 
+				_Ap.apply(error,_digit_p);
 				if (_MinPoly.size() > minpoly_degree){
 					minpoly_degree = _MinPoly.size();
 					nst=0;std::cout<<"updating minpoly\n";
@@ -816,7 +887,7 @@ namespace LinBox {
 					if (nst < nosolution_threshold) nst++;
 					else{
 						nosolution=true;
-						throw PreconditionFailed (__FUNCTION__, __LINE__, "system is inconsistent or the choosen prime leads to inconsistent resolution");
+						throw PreconditionFailed (__func__, __LINE__, "system is inconsistent or the choosen prime leads to inconsistent resolution");
 					}
 				}
 			}
@@ -827,12 +898,12 @@ namespace LinBox {
 #endif
 			// digit = digit_p
 			{
-				typename FVector::const_iterator iter_p = _digit_p.begin(); 
+				typename FVector::const_iterator iter_p = _digit_p.begin();
 				typename IVector::iterator iter = digit.begin();
 				for ( ; iter_p!= _digit_p.end(); ++iter_p, ++iter)
 					this->_R.init(*iter, _F.convert(tmp,*iter_p));
 			}
-			
+
 #ifdef RSTIMING
 			tGetDigitConvert.stop();
 			ttGetDigitConvert += tGetDigitConvert;
@@ -844,14 +915,14 @@ namespace LinBox {
 	}; // end of class WiedemannLiftingContainerBase
 
 
-	// Block Wiedemann LiftingContianer
+	/// Block Wiedemann LiftingContianer.
 	template <class _Ring, class _Field, class _IMatrix, class _FMatrix>
 	class BlockWiedemannLiftingContainer : public LiftingContainerBase<_Ring, _IMatrix> {
 
 	public:
 		typedef _Field                                	            Field;
 		typedef _Ring                                 	             Ring;
-		typedef _IMatrix                              	          IMatrix;       
+		typedef _IMatrix                              	          IMatrix;
 		typedef _FMatrix                              	          FMatrix;
 		typedef typename Field::Element               	          Element;
 		typedef typename Ring::Element                            Integer;
@@ -875,78 +946,79 @@ namespace LinBox {
 		size_t                              _col;
 		size_t                                _m;
 		size_t                                _n;
-		Block                                 _U;
+		Block                                 UU;
 		BlasMatrixDomain<Field>             _BMD;
 		Sequence                           *_Seq;
 		BlockMasseyDomain<Field,Sequence>  *_Dom;
 #ifdef RSTIMING
 	public:
 		mutable Timer tGetDigit, ttGetDigit, tGetDigitConvert, ttGetDigitConvert, tMinPoly, ttMinPoly;
-#endif			
+#endif
 	public:
 
 		template <class Prime_Type, class VectorIn>
 		BlockWiedemannLiftingContainer (const Ring                         &R,
-						const Field                        &F, 
-						const IMatrix                      &A, 
-						const FMatrix                     &Ap, 
-						const VectorIn                     &b, 
+						const Field                        &F,
+						const IMatrix                      &A,
+						const FMatrix                     &Ap,
+						const VectorIn                     &b,
 						const Prime_Type                   &p,
 						const size_t                        m,
-						const size_t                        n)
-			: LiftingContainerBase<Ring,IMatrix> (R,A,b,p), _Ap(Ap),
-			  _F(F), 
-			  _VDF(F), 
-			  _res_p(b.size()), 
-			  _digit_p(A.coldim()), 
-			  _rand(F), 
-			  _row(Ap.rowdim()), 
-			  _col(Ap.coldim()), 
-			  _m(m), 
-			  _n(n), 
-			  _U(m-1,Ap.rowdim()), 
-			  _BMD(F) {
-			
-	
-		
-		
+						const size_t                        n) :
+			LiftingContainerBase<Ring,IMatrix> (R,A,b,p), _Ap(Ap),
+			_F(F),
+			_VDF(F),
+			_res_p(b.size()),
+			_digit_p(A.coldim()),
+			_rand(F),
+			_row(Ap.rowdim()),
+			_col(Ap.coldim()),
+			_m(m),
+			_n(n),
+			UU(m-1,Ap.rowdim()),
+			_BMD(F)
+		{
+
+
+
+
 			for (size_t i=0;i<_m-1;++i)
 				for (size_t j=0;j< _row;++j)
-					_rand.random(_U.refEntry(i,j));
-			
+					_rand.random(UU.refEntry(i,j));
+
 			Coefficient V(_col,n);
 			for (size_t i=0;i< _col;++i)
 				for (size_t j=0; j< n;++j)
 					_rand.random(V.refEntry(i,j));
-			
-		       
+
+
 			std::cout<<"U:\n";
-			_U.write(std::cout, _F);
+			UU.write(std::cout, _F);
 
 			std::cout<<"V:\n";
 			V.write(std::cout, _F);
 
 			Block UAp(_m, _row);
 
-			typename Block::ConstRowIterator    iter_U   = _U.rowBegin();
+			typename Block::ConstRowIterator    iter_U   = UU.rowBegin();
 			typename Block::RowIterator         iter_UAp = UAp.rowBegin();
 			++iter_UAp;
-			for (; iter_U != _U.rowEnd(); ++iter_UAp, ++iter_U) 
+			for (; iter_U != UU.rowEnd(); ++iter_UAp, ++iter_U)
 				Ap.applyTranspose( *iter_UAp , *iter_U );
-				
+
 			for (size_t i=0;i<m;++i)
-				_rand.random(UAp.refEntry(0,i));			
-			
-			
+				_rand.random(UAp.refEntry(0,i));
+
+
 			_Seq = new Sequence (&Ap, _F, UAp,V);
 			std::cout<<"Sequence:\n";
 			for (size_t i=0;i<_Seq->getRep().size();++i)
 				_Seq->getRep()[i].write(std::cout,_F)<<"\n";
 			std::cout<<"\n";
 
-			
-			_Dom = new BlockMasseyDomain<Field,Sequence> (_Seq);					      					      
-			
+
+			_Dom = new BlockMasseyDomain<Field,Sequence> (_Seq);
+
 
 #ifdef RSTIMING
 			ttGetDigit.clear();
@@ -955,7 +1027,8 @@ namespace LinBox {
 #endif
 		}
 
-		virtual ~BlockWiedemannLiftingContainer() {
+		virtual ~BlockWiedemannLiftingContainer()
+		{
 #ifdef _BM_TIMING
 			_Dom->printTimer();
 #endif
@@ -970,11 +1043,12 @@ namespace LinBox {
 		const Field& field() const { return _F; }
 
 	protected:
-		
-		virtual IVector& nextdigit(IVector& digit,const IVector& residu) const {
-			
+
+		virtual IVector& nextdigit(IVector& digit,const IVector& residu) const
+		{
+
 			LinBox::integer tmp;
-#ifdef RSTIMING			
+#ifdef RSTIMING
 			tGetDigitConvert.start();
 #endif
 			// res_p =  residu mod p
@@ -984,18 +1058,18 @@ namespace LinBox {
 				for ( ;iter != residu. end(); ++iter, ++iter_p)
 					_F. init (*iter_p, this->_R.convert(tmp,*iter));
 			}
-#ifdef RSTIMING			
+#ifdef RSTIMING
 			tGetDigitConvert.stop();
 			ttGetDigitConvert+=tGetDigitConvert;
 			tGetDigit.start();
-#endif		
+#endif
 
 			std::cout<<"residue:\n";
 			for (size_t i=0;i<_res_p.size();++i)
 				_F.write(std::cout,_res_p[i])<<",";
 			std::cout<<"\n";
 
-			
+
 
 			// compute the Minimal polynomial of the modified Sequence
 			_Seq->setU(_res_p,0);
@@ -1004,7 +1078,7 @@ namespace LinBox {
 			for (size_t i=0;i<_Seq->getRep().size();++i)
 				_Seq->getRep()[i].write(std::cout,_F)<<"\n";
 			std::cout<<"\n";
-			
+
 			FBlockPolynomial minpoly;
 			std::vector<size_t> degree(_m);
 
@@ -1015,10 +1089,10 @@ namespace LinBox {
 #ifdef RSTIMING
 			tMinPoly.stop();
 			ttMinPoly+=tMinPoly;
-#endif		
+#endif
 			std::cout<<"Block Minpoly:\n";
 			for (size_t i=0;i<minpoly.size();++i)
-				minpoly[i].write(std::cout,_F)<<"\n";			
+				minpoly[i].write(std::cout,_F)<<"\n";
 			std::cout<<"\n";
 
 			size_t idx=0;
@@ -1028,72 +1102,72 @@ namespace LinBox {
 					++i;
 				if (i == _m)
 					throw LinboxError(" block minpoly: matrix seems to be singular - abort");
-				else 
-					idx=i	;			
+				else
+					idx=i	;
 			}
 
-			size_t deg = degree[idx];		
+			size_t deg = degree[idx];
 			BlasMatrix<Element> idx_poly(deg+1,_m-1);
-			for (size_t i=0;i<deg+1;++i) 
+			for (size_t i=0;i<deg+1;++i)
 				for (size_t j=0;j<_m-1;++j)
 					idx_poly.setEntry(i,j,minpoly[i].getEntry(idx,j+1));
 
 			BlasMatrix<Element> Combi(deg+1,_row);
-			_BMD.mul(Combi,idx_poly,_U);
-					
+			_BMD.mul(Combi,idx_poly,UU);
+
 
-			FVector lhs(_col),row(_row);	
+			FVector lhs(_col),row(_row);
 			for (size_t i=0;i<_row;++i)
 				row[i]= Combi.getEntry(deg,i);
-					
-			_Ap.applyTranspose(lhs,row);					
+
+			_Ap.applyTranspose(lhs,row);
 			FVector lhsbis(lhs);
 			for (int i = deg-1 ; i >= 0;--i) {
 				for (size_t j=0;j<_row;++j)
 					row[j]= Combi.getEntry(i,j);
 				_VDF.add (lhs,row,lhsbis);
-				_Ap.applyTranspose (lhsbis, lhs);			
-			}   
-					
+				_Ap.applyTranspose (lhsbis, lhs);
+			}
+
 			FVector accu (lhs);
 			_Ap.applyTranspose(lhs,_res_p);
 			_VDF.mulin(lhs,minpoly[deg].getEntry(idx,0));
 			lhsbis=lhs;
 			for (size_t i = deg-1 ; i > 0;--i) {
 				_VDF.axpy (lhs,minpoly[i].getEntry(idx,0) , _res_p, lhsbis);
-				_Ap.applyTranspose (lhsbis, lhs);			
-			}  
-					
+				_Ap.applyTranspose (lhsbis, lhs);
+			}
+
 			_VDF.addin(accu,lhs);
 			Element scaling;
 			_F.init(scaling);
 			_F.neg(scaling,minpoly[0].getEntry(idx,0));
 			_F.invin(scaling);
 			_VDF.mul(_digit_p,accu,scaling);
-			
-			
+
+
 			// check results
 			FVector error(_Ap.coldim());
-			_Ap.apply(error,_digit_p);		
+			_Ap.apply(error,_digit_p);
 			if (!_VDF.areEqual(error,_res_p)){
 				std::cout<<"BlockMinpoly error\n";
 				throw LinboxError("BlockMinpoly error\n");
 			}
-			
-			
-#ifdef RSTIMING			
+
+
+#ifdef RSTIMING
 			tGetDigit.stop();
 			ttGetDigit+=tGetDigit;
 			tGetDigitConvert.start();
 #endif
 			// digit = digit_p
 			{
-				typename FVector::const_iterator iter_p = _digit_p.begin(); 
+				typename FVector::const_iterator iter_p = _digit_p.begin();
 				typename IVector::iterator iter = digit.begin();
 				for ( ; iter_p!= _digit_p.end(); ++iter_p, ++iter)
 					this->_R.init(*iter, _F.convert(tmp,*iter_p));
 			}
-			
+
 #ifdef RSTIMING
 			tGetDigitConvert.stop();
 			ttGetDigitConvert += tGetDigitConvert;
@@ -1105,14 +1179,15 @@ namespace LinBox {
 	}; // end of class WiedemannLiftingContainerBase
 
 
+	/// Block Hankel LiftingContianer.
 	template <class _Ring, class _Field, class _IMatrix, class _FMatrix, class _Block>
 	class BlockHankelLiftingContainer : public LiftingContainerBase< _Ring, _IMatrix> {
 
 	public:
 		typedef _Field                               Field;
 		typedef _Ring                                 Ring;
-		typedef _IMatrix                           IMatrix;		
-		typedef _FMatrix                           FMatrix;	
+		typedef _IMatrix                           IMatrix;
+		typedef _FMatrix                           FMatrix;
 		typedef typename Field::Element            Element;
 		typedef typename IMatrix::Element          Integer;
 		typedef std::vector<Integer>               IVector;
@@ -1120,13 +1195,13 @@ namespace LinBox {
 		typedef _Block                               Block;
 
 	protected:
-		
+
 		const FMatrix&                      _Ap;
 		const Diagonal<Field>               &_D;
 		const BlockHankelInverse<Field>  &_Hinv;
 		Field                                _F;
 		mutable FVector                  _res_p;
-		mutable FVector                _digit_p;		
+		mutable FVector                _digit_p;
 		std::vector<std::vector<Element> >   _u;
 		std::vector<std::vector<Element> >   _v;
 		size_t                           _block;
@@ -1134,7 +1209,7 @@ namespace LinBox {
 		VectorDomain<Field>                 _VD;
 		BlasMatrixDomain<Field>            _BMD;
 		Element                           _zero;
-		
+
 	public:
 #ifdef RSTIMING
 		mutable Timer tGetDigit, ttGetDigit, tGetDigitConvert, ttGetDigitConvert;
@@ -1143,18 +1218,18 @@ namespace LinBox {
 
 
 		template <class Prime_Type, class VectorIn>
-		BlockHankelLiftingContainer (const Ring&        R, 
-					     const Field&       F, 
-					     const IMatrix&     A, 
+		BlockHankelLiftingContainer (const Ring&        R,
+					     const Field&       F,
+					     const IMatrix&     A,
 					     const FMatrix&    Ap,
 					     const Diagonal<Field> &D,
 					     const BlockHankelInverse<Field> &Hinv,
 					     const Block&      U,
 					     const Block&      V,
-					     const VectorIn&   b, 
-					     const Prime_Type& p)
-			: LiftingContainerBase<Ring,IMatrix> (R,A,b,p), _Ap(Ap), _Hinv(Hinv), _F(F),
-			  _res_p(b.size()), _digit_p(A.coldim()),  _block(U.rowdim()), _numblock(A.coldim()/_block) , _VD(F), _BMD(F), _D(D)
+					     const VectorIn&   b,
+					     const Prime_Type& p) :
+			LiftingContainerBase<Ring,IMatrix> (R,A,b,p), _Ap(Ap), _Hinv(Hinv), _F(F),
+			_res_p(b.size()), _digit_p(A.coldim()),  _block(U.rowdim()), _numblock(A.coldim()/_block) , _VD(F), _BMD(F), _D(D)
 		{
 			tApplyU.clear();
 			tApplyH.clear();
@@ -1163,7 +1238,7 @@ namespace LinBox {
 				_F.init(_res_p[i]);
 			for (size_t i=0; i< _digit_p.size(); ++i)
 				_F.init(_digit_p[i]);
-			
+
 			size_t block= U.rowdim();
 
 			_u.resize(_block, std::vector<Element>(_numblock));
@@ -1180,16 +1255,17 @@ namespace LinBox {
 #ifdef RSTIMING
 			ttGetDigit.clear();
 			ttGetDigitConvert.clear();
-#endif	
+#endif
 #ifdef DEBUG_LC
 			std::cout<<"Primes: ";
 			_F.write(std::cout);
 #endif
 
 		}
-		
-		
-		virtual ~BlockHankelLiftingContainer() {
+
+
+		virtual ~BlockHankelLiftingContainer()
+		{
 #ifdef RSTIMING
 			std::cout<<"time apply U: "<<tApplyU<<"\n";
 			std::cout<<"time apply H: "<<tApplyH<<"\n";
@@ -1198,46 +1274,52 @@ namespace LinBox {
 		}
 
 		// return the field
-		const Field& field() const { return _F; }
+		const Field& field() const
+		{
+			return _F;
+		}
 
 	protected:
-		
-		virtual IVector& nextdigit(IVector& digit, const IVector& residu) const {		
-#ifdef RSTIMING			
+
+		virtual IVector& nextdigit(IVector& digit, const IVector& residu) const
+		{
+#ifdef RSTIMING
 			tGetDigitConvert.start();
 #endif
 			//LinBox::integer tmp;
-			
+
 			Hom<Ring, Field> hom(this->_R, _F);
 			// res_p =  residu mod p
-			//VectorHom::map (_res_p, residu, _F, this->_R);			
+			//VectorHom::map (_res_p, residu, _F, this->_R);
 			{
 				typename FVector::iterator iter_p = _res_p.begin();
 				typename IVector::const_iterator iter = residu.begin();
 				for ( ;iter != residu. end(); ++iter, ++iter_p)
 					//_F. init (*iter_p, this->_R.convert(tmp,*iter));
 					hom.image(*iter_p, *iter);
-			}			
+			}
 #ifdef RSTIMING
 			tGetDigitConvert.stop();
 			ttGetDigitConvert += tGetDigitConvert;
 			tGetDigit.start();
-#endif			
-		
-			// compute the solution of _Ap^(-1).residu mod p = [V^T AV^T ... A^k]^T . Hinv . [U^T U^TA ... U^TA^k]^T residue mod p
-			// with k= numblock -1
-#ifdef RSTIMING		
+#endif
+
+			/* compute the solution of :
+			 * _Ap^(-1).residu mod p = [V^T AV^T ... A^k]^T . Hinv
+			 * . [U^T U^TA ... U^TA^k]^T residue mod p
+			 * with k= numblock -1
+			 */
+#ifdef RSTIMING
 			tAcc.clear();
-			tAcc.start();			
+			tAcc.start();
 #endif
-			/*
+
+#if 0
 			std::cout<<"b:=<";
 			for (size_t i=0;i<_res_p.size()-1;++i)
 				_F.write(std::cout,_res_p[i])<<",";
 			_F.write(std::cout,_res_p[_res_p.size()-1])<<">;\n";
-			*/
-
-		
+#endif
 
 			size_t n = _Ap.coldim();
 			// compute z0 = [U^T U^T Ap^T ... U^T Ap^k]^T . residue mod p
@@ -1248,13 +1330,13 @@ namespace LinBox {
 			for (size_t i=0;i<n;++i){
 				_F.assign(Apib.refEntry(i,0), _res_p[i]);
 			}
-		
+
 			int swi=1;
 			for (size_t j=1; j<_numblock; ++j)
 				if (swi){
 					_Ap.apply(b1, b0);
 					for (size_t i=0;i<n;++i)
-						_F.assign(Apib.refEntry(i,j), b1[i]);					
+						_F.assign(Apib.refEntry(i,j), b1[i]);
 					swi=0;
 				}
 				else{
@@ -1263,13 +1345,13 @@ namespace LinBox {
 						_F.assign(Apib.refEntry(i,j), b0[i]);
 					swi=1;
 				}
-		
+
 			FVector tmp(_numblock);
 			for (size_t i=0; i<_block; ++i){
-				BlasMatrix<Element> T(Apib, i*_numblock, 0, _numblock, _numblock); 				
+				BlasMatrix<Element> T(Apib, i*_numblock, 0, _numblock, _numblock);
 				_BMD.mul(tmp, _u[i], T);
 				for (size_t j=0;j<_numblock;++j){
-					this->_F.assign(z0[j*_block+i], tmp[j]);					
+					this->_F.assign(z0[j*_block+i], tmp[j]);
 				}
 			}
 #ifdef RSTIMING
@@ -1287,19 +1369,21 @@ namespace LinBox {
 			tAcc.clear();
 			tAcc.start();
 #endif
-			/*
-			std::cout<<" Hinv U b mod p done\n";
-			std::cout<<"\n y:=<";
-			for (size_t i=0;i<_digit_p.size()-1;++i)
-				_F.write(std::cout,z1[i])<<",";
-			_F.write(std::cout,z1[_digit_p.size()-1])<<">;\n";
-			*/
-			// compute digit_p  = [V^T AV^T ... A^k]^T.z1			
-			FVector b_bar(n), b_hat(_numblock);			
+
+#if 0
+			   std::cout<<" Hinv U b mod p done\n";
+			   std::cout<<"\n y:=<";
+			   for (size_t i=0;i<_digit_p.size()-1;++i)
+			   _F.write(std::cout,z1[i])<<",";
+			   _F.write(std::cout,z1[_digit_p.size()-1])<<">;\n";
+#endif
+
+			// compute digit_p  = [V^T AV^T ... A^k]^T.z1
+			FVector b_bar(n), b_hat(_numblock);
 			for (size_t i=0;i<n;++i)
-				_F.assign(_digit_p[i], _zero);			
-						
-			for (int i= _numblock-1;i>=0; --i){				
+				_F.assign(_digit_p[i], _zero);
+
+			for (int i= _numblock-1;i>=0; --i){
 				_Ap.apply(b1, _digit_p);
 				_digit_p=b1;
 				for (size_t j=0;j<_block;++j){
@@ -1313,13 +1397,14 @@ namespace LinBox {
 			tAcc.stop();
 			tApplyV+=tAcc;
 #endif
-			/*
-			std::cout<<" V Hinv U b mod p done\n";
-			std::cout<<"\n x:=<";
-			for (size_t i=0;i<_digit_p.size()-1;++i)
-				_F.write(std::cout,_digit_p[i])<<",";
-			_F.write(std::cout,_digit_p[_digit_p.size()-1])<<">;\n";
-			*/
+
+#if 0
+			   std::cout<<" V Hinv U b mod p done\n";
+			   std::cout<<"\n x:=<";
+			   for (size_t i=0;i<_digit_p.size()-1;++i)
+			   _F.write(std::cout,_digit_p[i])<<",";
+			   _F.write(std::cout,_digit_p[_digit_p.size()-1])<<">;\n";
+#endif
 
 #ifdef RSTIMING
 			tGetDigit.stop();
@@ -1327,24 +1412,115 @@ namespace LinBox {
 			tGetDigitConvert.start();
 #endif
 			// digit = digit_p
-			//VectorHom::map(digit, _digit_p, this->_R, _F);			
+			//VectorHom::map(digit, _digit_p, this->_R, _F);
 			{
-				typename FVector::const_iterator iter_p = _digit_p.begin(); 
+				typename FVector::const_iterator iter_p = _digit_p.begin();
 				typename IVector::iterator iter = digit.begin();
 				for ( ; iter_p!= _digit_p.end(); ++iter_p, ++iter)
 					//this->_R.init(*iter, _F.convert(tmp,*iter_p));
 					hom.preimage(*iter, *iter_p);
 			}
-			
+
 #ifdef RSTIMING
 			tGetDigitConvert.stop();
 			ttGetDigitConvert += tGetDigitConvert;
-#endif		
+#endif
 			return digit;
 		}
-		
+
 	}; // end of class BlockHankelLiftingContainer
 
 
+	///  SparseLULiftingContainer.
+	template <class _Ring, class _Field, class _IMatrix, class _FMatrix>
+	class SparseLULiftingContainer : public LiftingContainerBase< _Ring, _IMatrix> {
+
+	public:
+		typedef _Field                               Field;
+		typedef _Ring                                 Ring;
+		typedef _IMatrix                           IMatrix;
+		typedef _FMatrix                           FMatrix;
+		typedef typename Field::Element            Element;
+		typedef typename IMatrix::Element          Integer;
+		typedef std::vector<Integer>               IVector;
+		typedef std::vector<Element>               FVector;
+
+	protected:
+
+		const FMatrix&                       LL;
+		const FMatrix&                       UU;
+		const Permutation<_Field>&           QQ;
+		const Permutation<_Field>&           PP;
+		unsigned long                     _rank;
+		Field                                _F;
+		mutable FVector                  _res_p;
+		mutable FVector                _digit_p;
+		GaussDomain<Field>                  _GD;
+
+
+	public:
+
+
+		template <class Prime_Type, class VectorIn>
+		SparseLULiftingContainer (const Ring&        R,
+					  const Field&       F,
+					  const IMatrix&     A,
+					  const FMatrix&     L,
+					  const Permutation<_Field>& Q,
+					  const FMatrix&     U,
+					  const Permutation<_Field>& P,
+					  unsigned long   rank,
+					  const VectorIn&    b,
+					  const Prime_Type&  p) :
+			LiftingContainerBase<Ring,IMatrix> (R,A,b,p), LL(L),QQ(Q),UU(U), PP(P), _rank(rank),
+			_F(F), _res_p(b.size()), _digit_p(A.coldim()), _GD(F)
+		{
+			for (size_t i=0; i< _res_p.size(); ++i)
+				_F.init(_res_p[i]);
+			for (size_t i=0; i< _digit_p.size(); ++i)
+				_F.init(_digit_p[i]);
+		}
+
+
+		virtual ~SparseLULiftingContainer() {}
+
+		// return the field
+		const Field& field() const { return _F; }
+
+	protected:
+
+		virtual IVector& nextdigit(IVector& digit, const IVector& residu) const
+		{
+
+			// compute residu mod p
+			Hom<Ring, Field> hom(this->_R, _F);
+			{
+				typename FVector::iterator iter_p = _res_p.begin();
+				typename IVector::const_iterator iter = residu.begin();
+				for ( ;iter != residu. end(); ++iter, ++iter_p)
+					hom.image(*iter_p, *iter);
+			}
+
+			// solve the system mod p using L.Q.U.P Factorization
+			_GD.solve(_digit_p, _rank, QQ,LL,UU,PP, _res_p);
+
+
+			// promote new solution mod p to integers
+			{
+				typename FVector::const_iterator iter_p = _digit_p.begin();
+				typename IVector::iterator iter = digit.begin();
+				for ( ; iter_p!= _digit_p.end(); ++iter_p, ++iter)
+					//this->_R.init(*iter, _F.convert(tmp,*iter_p));
+					hom.preimage(*iter, *iter_p);
+			}
+
+			return digit;
+		}
+
+	}; // end of class SparseLULiftingContainer
+
+
+
 } // end of namespace LinBox
-#endif
+
+#endif //__LINBOX_lifting_container_H
diff --git a/linbox/algorithms/linbox-tags.h b/linbox/algorithms/linbox-tags.h
new file mode 100644
index 0000000..6df1c80
--- /dev/null
+++ b/linbox/algorithms/linbox-tags.h
@@ -0,0 +1,51 @@
+/* -*- 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
+/* Copyright (C) 2010 LinBox
+ * Written by <brice.boyer at imag.fr>
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_linbox_tags_H
+#define __LINBOX_linbox_tags_H
+
+namespace LinBox
+{
+
+	/*! Structure for tags.
+	 * Tags are simple enums that set a choice in a routine.
+	 * For instance, if the user wants a <i>right</i> nullspace,
+	 * she will use a \c LinBoxTag::Right parameter.
+	 * @note Tags are not Methods.
+	 */
+	struct LinBoxTag {
+		//! Left/Right Tag
+		enum Side {
+			Left  = 1000, //!< Left
+			Right = 1001  //!< Right
+		};
+
+		enum Transpose {
+			Trans   = 1010,
+			NoTrans = 1011
+		};
+	} ;
+
+}
+
+#endif // __LINBOX_linbox_tags_H
diff --git a/linbox/algorithms/massey-domain.h b/linbox/algorithms/massey-domain.h
index 69172c0..dcef1b2 100644
--- a/linbox/algorithms/massey-domain.h
+++ b/linbox/algorithms/massey-domain.h
@@ -1,11 +1,11 @@
 /* -*- 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
 /* linbox/algorithms/massey-domain.h
  * Copyright (C) 1999, 2001 Jean-Guillaume Dumas, Bradford Hovinen
  *
  * Written by Jean-Guillaume Dumas <Jean-Guillaume.Dumas at imag.fr>,
  *            Bradford Hovinen <hovinen at cis.udel.edu>
- *            JGD 12.06.2002 : 
+ *            JGD 12.06.2002 :
  *            			-- Put back domain.zero
  *            			-- Put back domain.one
  *            			-- Put back full_poly
@@ -16,20 +16,20 @@
  *
  * See COPYING for license information.
  */
-#ifndef __MASSEY_DOMAIN_H
-#define __MASSEY_DOMAIN_H
+#ifndef __LINBOX_massey_domain_H
+#define __LINBOX_massey_domain_H
 
-// ======================================================================= 
+// =======================================================================
 // Linbox project 1999
 // Domain Massey
 // - Computation is stopped when the polynomials remain the same
 //   for more than EARLY_TERM_THRESOLD
 // - When minimal polynomial equals characteristic polynomial,
-//   2 additional iterations are needed to compute it 
+//   2 additional iterations are needed to compute it
 //   (parameter DEFAULT_ADDITIONAL_ITERATION), but those
 //   iterations are not needed for the rank
-// Time-stamp: <27 Aug 01 18:18:12 Jean-Guillaume.Dumas at imag.fr> 
-// ======================================================================= 
+// Time-stamp: <27 Aug 01 18:18:12 Jean-Guillaume.Dumas at imag.fr>
+// =======================================================================
 
 #include "linbox/util/commentator.h"
 #include "linbox/vector/reverse.h"
@@ -37,7 +37,7 @@
 #include "linbox/vector/vector-domain.h"
 #include "linbox/util/timer.h"
 
-namespace LinBox 
+namespace LinBox
 {
 
 #ifndef MIN
@@ -45,334 +45,354 @@ namespace LinBox
 #endif
 
 #define DEFAULT_EARLY_TERM_THRESHOLD 20
+#ifndef DEFAULT_ADDITIONAL_ITERATION
 #define DEFAULT_ADDITIONAL_ITERATION 2
+#endif
 
-const long _DEGINFTY_ = -1;
-
-/** \brief Berlekamp/Massey algorithm. 
-
-   Domain Massey
-   - Computation is stopped when the polynomials remain the same
-     for more than EARLY_TERM_THRESOLD
-   - When minimal polynomial equals characteristic polynomial,
-     2 additional iterations are needed to compute it 
-     (parameter DEFAULT_ADDITIONAL_ITERATION), but those
-     iterations are not needed for the rank
-*/
-template<class Field, class Sequence>
-class MasseyDomain {
-    private:
-	Sequence            *_container;
-	Field                _F;
-	VectorDomain<Field>  _VD;
-	unsigned long         EARLY_TERM_THRESHOLD;
+	const long _DEGINFTY_ = -1;
+
+	/** \brief Berlekamp/Massey algorithm.
+
+	  Domain Massey
+	  - Computation is stopped when the polynomials remain the same
+	  for more than EARLY_TERM_THRESOLD
+	  - When minimal polynomial equals characteristic polynomial,
+	  2 additional iterations are needed to compute it
+	  (parameter DEFAULT_ADDITIONAL_ITERATION), but those
+	  iterations are not needed for the rank
+	  */
+	template<class Field, class Sequence>
+	class MasseyDomain {
+	private:
+		Sequence            *_container;
+		Field                _F;
+		VectorDomain<Field>  _VD;
+		unsigned long         EARLY_TERM_THRESHOLD;
 
 #ifdef INCLUDE_TIMING
-	// Timings
-	double                _discrepencyTime;
-	double                _fixTime;
+		// Timings
+		double                _discrepencyTime;
+		double                _fixTime;
 #endif // INCLUDE_TIMING
 
-    public:
-	typedef typename Field::Element Element;
+	public:
+		typedef typename Field::Element Element;
 
-        //-- Constructors
-	MasseyDomain (unsigned long ett_default = DEFAULT_EARLY_TERM_THRESHOLD) 
-		: _container           (), 
-		  _F                   (), 
-		  _VD                  (_F),
-		  EARLY_TERM_THRESHOLD (ett_default)
+		//-- Constructors
+		MasseyDomain (unsigned long ett_default = DEFAULT_EARLY_TERM_THRESHOLD) :
+			_container           (),
+			_F                   (),
+			_VD                  (_F),
+			EARLY_TERM_THRESHOLD (ett_default)
 		{}
 
-	MasseyDomain (const MasseyDomain<Field, Sequence> &M, unsigned long ett_default = DEFAULT_EARLY_TERM_THRESHOLD) 
-		: _container           (M._container), 
-		  _F                   (M._F), 
-		  _VD                  (M._F),
-		  EARLY_TERM_THRESHOLD (ett_default)
+		MasseyDomain (const MasseyDomain<Field, Sequence> &M, unsigned long ett_default = DEFAULT_EARLY_TERM_THRESHOLD) :
+			_container           (M._container),
+			_F                   (M._F),
+			_VD                  (M._F),
+			EARLY_TERM_THRESHOLD (ett_default)
 		{}
 
-	MasseyDomain (Sequence *D, unsigned long ett_default = DEFAULT_EARLY_TERM_THRESHOLD) 
-		: _container           (D), 
-		  _F                   (D->getField ()),
-		  _VD                  (D->getField ()),
-		  EARLY_TERM_THRESHOLD (ett_default)
+		MasseyDomain (Sequence *D, unsigned long ett_default = DEFAULT_EARLY_TERM_THRESHOLD) :
+			_container           (D),
+			_F                   (D->getField ()),
+			_VD                  (D->getField ()),
+			EARLY_TERM_THRESHOLD (ett_default)
 		{}
-  
-	MasseyDomain (Sequence *MD, const Field &F, unsigned long ett_default = DEFAULT_EARLY_TERM_THRESHOLD) 
-		: _container           (MD), 
-		  _F                   (F),
-		  _VD                  (F),
-		  EARLY_TERM_THRESHOLD (ett_default) 
+
+		MasseyDomain (Sequence *MD, const Field &F, unsigned long ett_default = DEFAULT_EARLY_TERM_THRESHOLD) :
+			_container           (MD),
+			_F                   (F),
+			_VD                  (F),
+			EARLY_TERM_THRESHOLD (ett_default)
 		{}
 
-        //-- Principal method
-	template<class Polynomial>
-	void operator () (Polynomial &C, bool full_poly = false) {
-		massey (C, full_poly);
-	}
+		//-- Principal method
+		template<class Polynomial>
+		long operator () (Polynomial &C, bool full_poly = false)
+		{
+			return massey (C, full_poly);
+		}
 
-        //-- Domains access
-	const Field &getField    () const { return _F; }
-	Sequence    *getSequence () const { return _container; }
+		//-- Domains access
+		const Field &getField    () const { return _F; }
+		Sequence    *getSequence () const { return _container; }
 
 #ifdef INCLUDE_TIMING
-	double       discrepencyTime () const { return _discrepencyTime; }
-	double       fixTime         () const { return _fixTime; }
+		double       discrepencyTime () const { return _discrepencyTime; }
+		double       fixTime         () const { return _fixTime; }
 #endif // INCLUDE_TIMING
 
-    private:
-	// -----------------------------------------------
-	// Polynomial emulation
-	// Only container aspects of polynomials
-	// AND degree and valuation are needed !
-	// -----------------------------------------------
-
-	// Degree of v
-	template <class V>
-	long v_degree (V& v) {
-		long i = v.size()-1;
-
-		if (i == _DEGINFTY_)
-			return _DEGINFTY_;
-
-		else if (!_F.isZero (v[i]))
-			return i;
-
-		// We must re-compute the degree :
-		for (long j = i - 1; j >= 0; j--) {
-			if (!_F.isZero (v[j])) {
-				v.resize (j + 1);
-				return j;
+	private:
+		// -----------------------------------------------
+		// Polynomial emulation
+		// Only container aspects of polynomials
+		// AND degree and valuation are needed !
+		// -----------------------------------------------
+
+		// Degree of v
+		template <class V>
+		long v_degree (V& v)
+		{
+			long i = v.size()-1;
+
+			if (i == _DEGINFTY_)
+				return _DEGINFTY_;
+
+			else if (!_F.isZero (v[i]))
+				return i;
+
+			// We must re-compute the degree :
+			for (long j = i - 1; j >= 0; j--) {
+				if (!_F.isZero (v[j])) {
+					v.resize (j + 1);
+					return j;
+				}
 			}
-		}
 
-		return _DEGINFTY_ ;
-	}
+			return _DEGINFTY_ ;
+		}
 
-	// Valuation of v
-	template <class V>
-	long v_val(V& v) {
-		long i = v.size() - 1;
+		// Valuation of v
+		template <class V>
+		long v_val(V& v)
+		{
+			long i = v.size() - 1;
 
-		if (i == _DEGINFTY_)
-			return _DEGINFTY_;
+			if (i == _DEGINFTY_)
+				return _DEGINFTY_;
 
-		else if (!_F.isZero (v[0]))
-			return 0;
+			else if (!_F.isZero (v[0]))
+				return 0;
 
-		// We must compute the valuation :
-		for (long j = 1; j <= i; j++)
-			if (!_F.isZero ((v)[j])) return j ;
+			// We must compute the valuation :
+			for (long j = 1; j <= i; j++)
+				if (!_F.isZero ((v)[j])) return j ;
 
-		return _DEGINFTY_ ;
-	}
+			return _DEGINFTY_ ;
+		}
 
-	// -------------------------------------------------------------------
-	// Berlekamp/Massey algorithm with Massey's Sequence generation
-	// -------------------------------------------------------------------
+		// -------------------------------------------------------------------
+		// Berlekamp/Massey algorithm with Massey's Sequence generation
+		// -------------------------------------------------------------------
 
-	template<class Polynomial>
-	long massey (Polynomial &C, bool full_poly = false) { 
-//              const long ni = _container->n_row (), nj = _container->n_col ();
-//              const long n = MIN(ni,nj);
-		const long END = _container->size () + (full_poly ? DEFAULT_ADDITIONAL_ITERATION:0);
-		const long n = END >> 1;
+		template<class Polynomial>
+		long massey (Polynomial &C, bool full_poly = false)
+		{
+			//              const long ni = _container->n_row (), nj = _container->n_col ();
+			//              const long n = MIN(ni,nj);
+			const long END = _container->size () + (full_poly ? DEFAULT_ADDITIONAL_ITERATION:0);
+			const long n = END >> 1;
 
 #ifdef INCLUDE_TIMING
-		Timer timer;
+			Timer timer;
 
-		_discrepencyTime = _fixTime = 0.0;
+			_discrepencyTime = _fixTime = 0.0;
 #endif // INCLUDE_TIMING
 
-		integer card;
+			integer card;
 
-		commentator.start ("Massey", "masseyd", END);
+			commentator.start ("Massey", "masseyd", END);
 
-		// ====================================================
-		// Sequence and iterator initialization
-		//
-		typename Sequence::const_iterator _iter (_container->begin ());
-		Polynomial S (END + 1);
-		
-		Element Zero, One;
-		_F.init(Zero, 0);
-		_F.init(One, 1);
+			// ====================================================
+			// Sequence and iterator initialization
+			//
+			typename Sequence::const_iterator _iter (_container->begin ());
+			Polynomial S (END + 1);
 
-		// -----------------------------------------------
-		// Preallocation. No further allocation.
-		//
-		C.reserve    (n + 1); C.resize (1); _F.assign (C[0], One);
-		Polynomial B (n + 1); B.resize (1); _F.assign (B[0], One);
+			Element Zero, One;
+			_F.init(Zero, 0);
+			_F.init(One, 1);
 
-		long L = 0;
-		Element b, d, Ds;
-		long x = 1, b_deg = 0, c_deg = 0, l_deg;
-		long COMMOD = (END > 25) ? (END / 25) : 1;
+			// -----------------------------------------------
+			// Preallocation. No further allocation.
+			//
+			C.reserve    (n + 1); C.resize (1); _F.assign (C[0], One);
+			Polynomial B (n + 1); B.resize (1); _F.assign (B[0], One);
 
-		_F.assign (b, One);
+			long L = 0;
+			Element b, d, Ds;
+			long x = 1, b_deg = 0, c_deg = 0, l_deg;
+			long COMMOD = (END > 40) ? (END / 20) : 2;
 
-		for (long N = 0; N < END && x < (long) EARLY_TERM_THRESHOLD; ++N, ++_iter) {
-			if (!(N % COMMOD)) 
-				commentator.progress (N);
+			_F.assign (b, One);
 
-			// ====================================================
-			// Next coefficient in the sequence
-			// Discrepancy computation
-			// 
-			S[N] = *_iter; 
 
+			for (long N = 0; N < END && x < (long) EARLY_TERM_THRESHOLD; ++N, ++_iter) {
+
+				if (!(N % COMMOD))
+					commentator.progress (N);
+
+				// ====================================================
+				// Next coefficient in the sequence
+				// Discrepancy computation
+				//
+				S[N] = *_iter;
+
+				//
 #ifdef INCLUDE_TIMING
-			timer.start ();
+				timer.start ();
 #endif // INCLUDE_TIMING
 
-			long poly_len = MIN (L, c_deg);
-			Subvector<typename Polynomial::iterator> Cp (C.begin () + 1, C.begin () + poly_len + 1);
-			Subvector<typename Polynomial::iterator> Sp (S.begin () + (N - poly_len), S.begin () + N);
-			ReverseVector<Subvector<typename Polynomial::iterator> > Spp (Sp);
-			_VD.dot (d, Cp, Spp);
+				long poly_len = MIN (L, c_deg);
+				Subvector<typename Polynomial::iterator> Cp (C.begin () + 1, C.begin () + poly_len + 1);
+				Subvector<typename Polynomial::iterator> Sp (S.begin () + (N - poly_len), S.begin () + N);
+				ReverseVector<Subvector<typename Polynomial::iterator> > Spp (Sp);
+				_VD.dot (d, Cp, Spp);
 
-			_F.addin (d, S[N]);
+				_F.addin (d, S[N]);
 
 #ifdef INCLUDE_TIMING
-			timer.stop ();
+				timer.stop ();
 
-			_discrepencyTime += timer.realtime ();
+				_discrepencyTime += timer.realtime ();
 
-			timer.start ();
+				timer.start ();
 #endif // INCLUDE_TIMING
 
-			if (_F.isZero (d)) {
-				++x;
-			} else {
-				if (L > (N >> 1)) {
-					// -----------------------------------------------
-					// C = C + (Polynome(X,x,-d/b) * B);
-					// 
-					_F.divin (_F.neg (Ds, d), b);
-					long i = l_deg = (x + b_deg);
-					if (l_deg > c_deg) {
-						C.resize (l_deg + 1);
-						if (x > c_deg) {
-							for (; i >= x; --i)
-								_F.mul (C[i], Ds, B[i-x]);
-							for (; i > c_deg; --i)
-								_F.assign (C[i], Zero);
-						} else {
-							for (; i > c_deg; --i)
-								_F.mul (C[i], Ds, B[i-x]);
+				if (_F.isZero (d)) {
+					++x;
+				}
+				else {
+					if (L > (N >> 1)) {
+						// -----------------------------------------------
+						// C = C + (Polynome(X,x,-d/b) * B);
+						//
+						_F.divin (_F.neg (Ds, d), b);
+						long i = l_deg = (x + b_deg);
+						if (l_deg > c_deg) {
+							C.resize (l_deg + 1);
+							if (x > c_deg) {
+								for (; i >= x; --i)
+									_F.mul (C[i], Ds, B[i-x]);
+								for (; i > c_deg; --i)
+									_F.assign (C[i], Zero);
+							}
+							else {
+								for (; i > c_deg; --i)
+									_F.mul (C[i], Ds, B[i-x]);
+								for (; i >= x; --i)
+									_F.axpyin (C[i], Ds, B[i-x]);
+							}
+						}
+						else {
 							for (; i >= x; --i)
 								_F.axpyin (C[i], Ds, B[i-x]);
 						}
-					} else {
-						for (; i >= x; --i)
-							_F.axpyin (C[i], Ds, B[i-x]);
+						// -----------------------------------------------
+						c_deg = v_degree(C);
+						++x;
 					}
-					// -----------------------------------------------
-					c_deg = v_degree(C);
-					++x;
-				} else {
-					// -----------------------------------------------
-					// C = C + (Polynome(X,x,-d/b) * B); 					// 
-					_F.divin (_F.neg (Ds, d), b);
-					long i = l_deg = x + b_deg;
-					B.resize (C.size ());
-					if (l_deg > c_deg) {
-						C.resize (l_deg+1);
-						if (x > c_deg) {
-							for (; i >= x; --i)
-								_F.mul (C[i], Ds, B[i-x]);
-							for (; i > c_deg; --i)
-								_F.assign (C[i], Zero);
-						} else {
-							for (; i > c_deg; --i)
-								_F.mul (C[i], Ds, B[i-x]);
+					else {
+						// -----------------------------------------------
+						// C = C + (Polynome(X,x,-d/b) * B); 					//
+						_F.divin (_F.neg (Ds, d), b);
+						long i = l_deg = x + b_deg;
+						B.resize (C.size ());
+						if (l_deg > c_deg) {
+							C.resize (l_deg+1);
+							if (x > c_deg) {
+								for (; i >= x; --i)
+									_F.mul (C[i], Ds, B[i-x]);
+								for (; i > c_deg; --i)
+									_F.assign (C[i], Zero);
+							}
+							else {
+								for (; i > c_deg; --i)
+									_F.mul (C[i], Ds, B[i-x]);
+								for (; i >= x; --i)
+									_F.axpy (C[i], Ds, B[i-x], B[i] = C[i]);
+							}
+						}
+						else {
+							for (i = c_deg; i > l_deg; --i)
+								B[i] = C[i];
 							for (; i >= x; --i)
-								_F.axpy (C[i], Ds, B[i-x], B[i] = C[i]);
+								_F.axpy (C[i], Ds, B[i-x], B[i] = C[i] );
 						}
-					} else {
-						for (i = c_deg; i > l_deg; --i)
-							B[i] = C[i];
-						for (; i >= x; --i)
-							_F.axpy (C[i], Ds, B[i-x], B[i] = C[i] );
-					}
 
-					for (; i >= 0; --i) B[i] = C[i];
+						for (; i >= 0; --i) B[i] = C[i];
 
-					// -----------------------------------------------
-					L = N+1-L;
-					b_deg = c_deg;
-					c_deg = v_degree (C);
-					b = d;
-					x = 1;
+						// -----------------------------------------------
+						L = N+1-L;
+						b_deg = c_deg;
+						c_deg = v_degree (C);
+						b = d;
+						x = 1;
+					}
 				}
-			}
-			// ====================================================
+				// ====================================================
 
 #ifdef INCLUDE_TIMING
-			timer.stop ();
+				timer.stop ();
 
-			_fixTime += timer.realtime ();
+				_fixTime += timer.realtime ();
 #endif // INCLUDE_TIMING
+			}
+
+			commentator.stop ("done", NULL, "masseyd");
+			//		commentator.stop ("Done", "Done", "LinBox::MasseyDomain::massey");
+
+			return L;
+		}
+
+	public:
+		// ---------------------------------------------
+		// Massey
+		//
+		void pseudo_rank (unsigned long &rank)
+		{
+			std::vector<Element> phi;
+			massey (phi, 0);
+			rank = v_degree (phi) - v_val (phi);
+		}
+
+		void valence (Element &valence, unsigned long &rank)
+		{
+			commentator.start ("Valence", "LinBox::MasseyDomain::valence");
+
+			std::vector<Element> phi;
+			massey (phi, 1);
+			rank = v_degree (phi) - v_val (phi);
+			valence = phi[v_degree (phi)];
+
+			commentator.stop ("Done", "Done", "LinBox::MasseyDomain::valence");
 		}
 
-                commentator.stop ("done", NULL, "masseyd");
-//		commentator.stop ("Done", "Done", "LinBox::MasseyDomain::massey");
-
-		return L;
-	}
-
-public:
-	// ---------------------------------------------
-	// Massey
-	//
-	void pseudo_rank (unsigned long &rank) {
-		std::vector<Element> phi;
-		massey (phi, 0);
-		rank = v_degree (phi) - v_val (phi);
-	}
- 
-	void valence (Element &valence, unsigned long &rank) {
-		commentator.start ("Valence", "LinBox::MasseyDomain::valence");
-
-		std::vector<Element> phi;
-		massey (phi, 1);
-		rank = v_degree (phi) - v_val (phi);
-		valence = phi[v_degree (phi)];
-
-		commentator.stop ("Done", "Done", "LinBox::MasseyDomain::valence");
-	}
-
-	template<class Polynomial>
-	unsigned long pseudo_minpoly (Polynomial &phi, unsigned long &rank, bool full_poly = true) {
-		unsigned long L = massey (phi, full_poly);
-		long dp = v_degree(phi);
-		rank = dp - v_val (phi);
-        	if (phi.size()) {
-			for(long i = dp >> 1;i > 0; --i) {
-				phi[0] = phi[i];
-				phi[i] = phi[dp-i];
-				phi[dp-i] = phi[0];
+		template<class Polynomial>
+		unsigned long pseudo_minpoly (Polynomial &phi, unsigned long &rank, bool full_poly = true)
+		{
+			unsigned long L = massey (phi, full_poly);
+			long dp = v_degree(phi);
+			rank = dp - v_val (phi);
+			if (phi.size()) {
+				for(long i = dp >> 1;i > 0; --i) {
+					phi[0] = phi[i];
+					phi[i] = phi[dp-i];
+					phi[dp-i] = phi[0];
+				}
+				phi[0] = phi[dp];
+				_F.init (phi[dp], 1UL);
 			}
-			phi[0] = phi[dp];
-			_F.init (phi[dp], 1);
+			return L;
 		}
-                return L;
-	}
-
-	template<class Polynomial>
-	void minpoly (Polynomial &phi, unsigned long &rank, bool full_poly = true) {
-            long dp = massey (phi, full_poly);
-            rank = v_degree(phi) - v_val (phi);
-		if (phi.size () > 0) {
-			phi.resize (dp+1);
-			for (long i = dp >> 1; i > 0; --i)
-				std::swap (phi[i], phi[dp-i]);
-			phi[0] = phi[dp];
-			_F.init (phi[dp], 1);
+
+		template<class Polynomial>
+		void minpoly (Polynomial &phi, unsigned long &rank, bool full_poly = true)
+		{
+			long dp = massey (phi, full_poly);
+			rank = v_degree(phi) - v_val (phi);
+			if (phi.size () > 0) {
+				phi.resize (dp+1);
+				for (long i = dp >> 1; i > 0; --i)
+					std::swap (phi[i], phi[dp-i]);
+				phi[0] = phi[dp];
+				_F.init (phi[dp], 1UL);
+			}
 		}
-	}
-};
- 
+	};
+
 }
-    
-#endif // __MASSEY_DOMAIN_H
+
+#endif // __LINBOX_massey_domain_H
+
diff --git a/linbox/algorithms/matpoly-mult.h b/linbox/algorithms/matpoly-mult.h
index 928115c..9464ad0 100644
--- a/linbox/algorithms/matpoly-mult.h
+++ b/linbox/algorithms/matpoly-mult.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* linbox/algorithms/
  * Copyright (C) 2005  Pascal Giorgi
  *
@@ -21,8 +22,8 @@
  */
 
 
-#ifndef __LINBOX_MATPOLY_MULT
-#define __LINBOX_MATPOLY_MULT
+#ifndef __LINBOX_matpoly_mult_H
+#define __LINBOX_matpoly_mult_H
 
 #include <linbox/randiter/random-fftprime.h>
 #include <linbox/algorithms/blas-domain.h>
@@ -31,67 +32,125 @@
 #include <linbox/util/debug.h>
 #include <linbox/util/timer.h>
 #include <vector>
-
+#ifdef __LINBOX_HAVE_OPENMP
+#include <omp.h>
+#endif
 //#define FFT_TIMING
 
-namespace LinBox {
+namespace LinBox
+{
 
 
-#define FFT_DEG_THRESHOLD   100
-#define KARA_DEG_THRESHOLD   10
+#define FFT_DEG_THRESHOLD   64
+#define KARA_DEG_THRESHOLD  1
+#ifndef FFT_PRIME_SEED
+	// random seed
+#define FFT_PRIME_SEED 0
+#endif
 
 
-	template <class Field, class Polynomial>
+	template <class Field>
 	class KaratsubaMulDomain;
 
-	template <class _Field, class _Polynomial>
+	template <class _Field>
 	class FFTMulDomain;
 
-	template <class Field, class Polynomial>
+	template <class Field>
 	class ClassicMulDomain;
-	
-	template <class Field, class Polynomial>
+
+	template <class Field>
 	class PolynomialMatrixDomain {
 	protected:
-		KaratsubaMulDomain<Field, Polynomial>     _kara;
-		FFTMulDomain<Field, Polynomial>            _fft;
-		ClassicMulDomain<Field, Polynomial>    _classic;
+		KaratsubaMulDomain<Field>     _kara;
+		FFTMulDomain<Field>            _fft;
+		ClassicMulDomain<Field>    _classic;
+
 	public:
-		PolynomialMatrixDomain ( const Field &F) : _kara(F), _fft(F), _classic(F) {}
+		Timer multime;
 
-		void mul (Polynomial &a, const Polynomial &b, const Polynomial &c) {
-			size_t d = b.size()+c.size();
-			size_t n = b[0].coldim();
+		PolynomialMatrixDomain ( const Field &F) :
+			_kara(F), _fft(F), _classic(F)
+		{multime.clear();}
 
+		template< class Polynomial1, class Polynomial2, class Polynomial3>
+		void mul (Polynomial1 &a, const Polynomial2 &b, const Polynomial3 &c)
+		{
+			size_t d = b.size()+c.size();
+			linbox_check(a.size() >= (b.size()+c.size()-1));
+			//Timer mul;
+			//mul.start();
 			if (d > FFT_DEG_THRESHOLD)
 				_fft.mul(a,b,c);
 			else
 				if ( d > KARA_DEG_THRESHOLD)
-					_kara.mul(a,b,c);		
+					_kara.mul(a,b,c);
 				else
 					_classic.mul(a,b,c);
-					
+			/*
+			   mul.stop();multime+=mul;
+			   std::cout.width(30);
+			   std::cout<<"mul "<<b.size()<<"x"<<c.size()<<" : ";
+			   std::cout.precision(3);
+			   std::cout<<mul.usertime()<<std::endl;
+			   */
 		}
 
-		void midproduct (Polynomial &a, const Polynomial &b, const Polynomial &c) {
+		template< class Polynomial1, class Polynomial2, class Polynomial3>
+		void midproduct (Polynomial1 &a, const Polynomial2 &b, const Polynomial3 &c)
+		{
 			linbox_check( 2*a.size() == c.size()+1);
-			linbox_check( 2*b.size() == c.size()+1);			
+			linbox_check( 2*b.size() == c.size()+1);
 
 			size_t d = b.size()+c.size();
-			size_t n = b[0].coldim();
-
+			//std::cout<<"midp "<<a.size()<<" = "<<b.size()<<" x "<<c.size()<<"...\n";
+			//Timer mul;
+			//mul.start();
 			if (d > FFT_DEG_THRESHOLD)
 				_fft.midproduct(a,b,c);
 			else
 				if ( d > KARA_DEG_THRESHOLD)
-					_kara.midproduct(a,b,c);		
+					_kara.midproduct(a,b,c);
 				else
 					_classic.midproduct(a,b,c);
+			//std::cout<<"done\n";
+			/*
+			   mul.stop();multime+=mul;
+			   std::cout.width(30);
+			   std::cout<<"mul "<<b.size()<<"x"<<c.size()<<" : ";
+			   std::cout.precision(3);
+			   std::cout<<mul.usertime()<<std::endl;
+			   */
+		}
+
+		template< class Polynomial1, class Polynomial2, class Polynomial3>
+		void midproductgen (Polynomial1 &a, const Polynomial2 &b, const Polynomial3 &c)
+		{
+			linbox_check( a.size()+b.size() == c.size()+1);
+
+			size_t d = b.size()+c.size();
+			//std::cout<<"midp "<<a.size()<<" = "<<b.size()<<" x "<<c.size()<<"...\n";
+			//Timer mul;
+			//mul.start();
+			if (d > FFT_DEG_THRESHOLD)
+				_fft.midproductgen(a,b,c);
+			else
+				if ( d > KARA_DEG_THRESHOLD)
+					_kara.midproductgen(a,b,c);
+				else
+					_classic.midproductgen(a,b,c);
+			//std::cout<<"done\n";
+			/*
+			   mul.stop();multime+=mul;
+			   std::cout.width(30);
+			   std::cout<<"mul "<<b.size()<<"x"<<c.size()<<" : ";
+			   std::cout.precision(3);
+			   std::cout<<mul.usertime()<<std::endl;
+			   */
 		}
 	};
 
-	
-	template <class Field, class Polynomial>
+
+	template <class Field>
 	class ClassicMulDomain {
 	private:
 		Field                       _F;
@@ -99,48 +158,54 @@ namespace LinBox {
 		MatrixDomain<Field>        _MD;
 
 	public:
-		
-		ClassicMulDomain(const Field &F) : _F(F), _BMD(F), _MD(F) {}
-		
-		void mul(Polynomial &a, const Polynomial &b, const Polynomial &c) {
-			
-			size_t deg =  b.size()+c.size()-1;
-			linbox_check(a.size() >= deg);
 
+		ClassicMulDomain(const Field &F) :
+			_F(F), _BMD(F), _MD(F)
+		{}
+
+		template< class Polynomial1, class Polynomial2, class Polynomial3>
+		void mul(Polynomial1 &a, const Polynomial2 &b, const Polynomial3 &c) {
+
+			linbox_check(a.size() >= (b.size()+c.size()-1));
 			for (size_t i=0;i<b.size();++i){
 				for (size_t j=0;j<c.size();++j)
 					_BMD.axpyin(a[i+j],b[i],c[j]);
 			}
 		}
 
-		
-		void midproduct (Polynomial &a, const Polynomial &b, const Polynomial &c) {
+		template< class Polynomial1, class Polynomial2, class Polynomial3>
+		void midproduct (Polynomial1 &a, const Polynomial2 &b, const Polynomial3 &c) {
 			linbox_check( 2*a.size() == c.size()+1);
 			linbox_check( 2*b.size() == c.size()+1);
 
 			for (size_t i=0;i<b.size();++i){
-				for (size_t j=0;j<c.size();++j){					
+				for (size_t j=0;j<c.size();++j){
 					if ((i+j<2*a.size()-1) && (i+j>=a.size()-1)){
 						_BMD.axpyin(a[i+j - a.size()+1],b[i],c[j]);
 					}
 				}
-			}			
-		}		
-	};
+			}
+		}
 
-	template <class Field, class Polynomial>
-	class KaratsubaMulDomain {
-	public:
-		void mul(Polynomial &a, const Polynomial &b, const Polynomial &c) {
-			throw LinboxError("LinBox Error: no specialization available for Karatsuba multiplication\n");
+		template< class Polynomial1, class Polynomial2, class Polynomial3>
+		void midproductgen (Polynomial1 &a, const Polynomial2 &b, const Polynomial3 &c) {
+			linbox_check(a.size()+b.size() == c.size()+1);
+
+			for (size_t i=0;i<b.size();++i){
+				for (size_t j=0;j<c.size();++j){
+					if ((i+j>=a.size()-1) && (i+j<=c.size()-1)){
+						_BMD.axpyin(a[i+j - a.size()+1],b[i],c[j]);
+					}
+				}
+			}
 		}
 	};
 
-	template<class _Field, class _Matrix>
-	class KaratsubaMulDomain<_Field, std::vector<_Matrix> > {
+
+
+	template<class _Field>
+	class KaratsubaMulDomain {
 	public:
-		typedef std::vector<_Matrix>       Polynomial;
-		typedef _Matrix                  Coefficient;
 		typedef _Field                         Field;
 	private:
 		Field                       _F;
@@ -149,120 +214,130 @@ namespace LinBox {
 		size_t                    _mul;
 	public:
 
-		KaratsubaMulDomain(const Field &F) : _F(F), _BMD(F), _MD(F) {_mul=0;}
+		KaratsubaMulDomain(const Field &F) :
+			_F(F), _BMD(F), _MD(F)
+		{_mul=0;}
 
-		void mul(Polynomial &a, const Polynomial &b, const Polynomial &c) {
+		template< class Polynomial1, class Polynomial2, class Polynomial3>
+		void mul(Polynomial1 &a, const Polynomial2 &b, const Polynomial3 &c) {
+			linbox_check(a.size() >= (b.size()+c.size()-1));
 			Karatsuba_mul(a, 0, b, 0, b.size(), c, 0, c.size());
 		}
-		
 
-		void midproduct(Polynomial &a, const Polynomial &b, const Polynomial &c) {
+		template< class Polynomial1, class Polynomial2, class Polynomial3>
+		void midproduct(Polynomial1 &a, const Polynomial2 &b, const Polynomial3 &c) {
 			linbox_check( 2*a.size() == c.size()+1);
 			linbox_check( 2*b.size() == c.size()+1);
 			midproduct_Karatsuba(a, b, c);
 		}
-		
+
+		template< class Polynomial1, class Polynomial2, class Polynomial3>
+		void midproductgen(Polynomial1 &a, const Polynomial2 &b, const Polynomial3 &c) {
+			linbox_check(a.size()+b.size() == c.size()+1);
+			midproduct_Karatsubagen(a, b, c);
+		}
 
 	protected:
-		void Karatsuba_mul(std::vector<Coefficient> &C, size_t shiftC,
-				   const std::vector<Coefficient> &A, size_t shiftA, size_t degA,
-				   const std::vector<Coefficient> &B, size_t shiftB, size_t degB){
-			
+
+		template< class Polynomial1, class Polynomial2, class Polynomial3>
+		void Karatsuba_mul(Polynomial1 &C, size_t shiftC,
+				   const Polynomial2 &A, size_t shiftA, size_t degA,
+				   const Polynomial3 &B, size_t shiftB, size_t degB){
+
+			typedef  typename Polynomial1::value_type Coefficient;
 			const Coefficient ZeroC(C[0].rowdim(), C[0].coldim());
 			const Coefficient ZeroA(A[0].rowdim(), A[0].coldim());
 			const Coefficient ZeroB(B[0].rowdim(), B[0].coldim());
-			
+
 			if ((degA == 1) || (degB == 1)) {
-				
+
 				if ((degA == 1) && (degB == 1))
-					{_BMD.mul(C[shiftC],A[shiftA],B[shiftB]); _mul++;}
-				else 
-					if (degA == 1) 
+				{_BMD.mul(C[shiftC],A[shiftA],B[shiftB]); _mul++;}
+				else
+					if (degA == 1)
 						for (size_t i=0;i< degB;++i)
-							{_BMD.mul(C[shiftC+i],A[shiftA],B[shiftB+i]);_mul++;}
-					else 
+						{_BMD.mul(C[shiftC+i],A[shiftA],B[shiftB+i]);_mul++;}
+					else
 						for (size_t i=0;i< degA;++i)
-							{_BMD.mul(C[shiftC+i],A[shiftA+i],B[shiftB]);_mul++;}
+						{_BMD.mul(C[shiftC+i],A[shiftA+i],B[shiftB]);_mul++;}
 			}
 			else {
 				size_t degA_low, degA_high, degB_low, degB_high, half_degA, half_degB, degSplit;
-				half_degA= (degA & 1) + degA >>1;
-				half_degB= (degB & 1) + degB >>1;
+				half_degA= (degA & 1) + (degA >>1);
+				half_degB= (degB & 1) + (degB >>1);
 				degSplit= (half_degA > half_degB) ? half_degA : half_degB;
-				
+
 				degB_low = (degB < degSplit) ? degB : degSplit;
 				degA_low = (degA < degSplit) ? degA : degSplit;
 				degA_high= degA - degA_low;
 				degB_high= degB - degB_low;
-				
-			
+
+
 				// multiply low degrees
-				Karatsuba_mul(C, shiftC, A, shiftA, degA_low, B, shiftB, degB_low);   
-				
+				Karatsuba_mul(C, shiftC, A, shiftA, degA_low, B, shiftB, degB_low);
 
 				// multiply high degrees (only if they are both different from zero)
-				if ((degA_high !=0) && (degB_high != 0)) {	
+				if ((degA_high !=0) && (degB_high != 0))
 					Karatsuba_mul(C, shiftC+(degSplit << 1), A, shiftA+degSplit, degA_high, B, shiftB+degSplit, degB_high);
-				}
-				
+
 				// allocate space for summation of low and high degrees
 				std::vector<Coefficient> A_tmp(degA_low,ZeroA);
 				std::vector<Coefficient> B_tmp(degB_low,ZeroB);
 				std::vector<Coefficient> C_tmp(degA_low+degB_low-1,ZeroC);
-				
+
 				// add low and high degrees of A
 				for (size_t i=0;i<degA_low;++i)
 					A_tmp[i]=A[shiftA+i];
-				if ( degA_high != 0) 
+				if ( degA_high != 0)
 					for (size_t i=0;i<degA_high;++i)
-						_MD.addin(A_tmp[i],A[shiftA+degSplit+i]);	
-				
+						_MD.addin(A_tmp[i],A[shiftA+degSplit+i]);
+
 				// add low and high degrees of B
 				for (size_t i=0;i<degB_low;++i)
 					B_tmp[i]=B[shiftA+i];
 				if ( degB_high != 0)
 					for (size_t i=0;i<degB_high;++i)
 						_MD.addin(B_tmp[i],B[shiftB+degSplit+i]);
-				
 
 				//  multiply the sums
 				Karatsuba_mul(C_tmp, 0, A_tmp, 0, degA_low, B_tmp, 0, degB_low);
-				
+
 				// subtract the low product from the product of sums
 				for (size_t i=0;i< C_tmp.size();++i)
-					_MD.subin(C_tmp[i], C[shiftC+i]);	
-				
+					_MD.subin(C_tmp[i], C[shiftC+i]);
+
 				// subtract the high product from the product of sums
 				if ((degA_high !=0) && (degB_high != 0))
 					for (size_t i=0;i< degA_high+degB_high-1; ++i)
 						_MD.subin(C_tmp[i], C[shiftC+(degSplit << 1)+i]);
-				
+
 				// add the middle term of the product
 				size_t mid= (degA_low+degB_high > degB_low+degA_high)? degA_low+degB_high :degB_low+degA_high;
 				for (size_t i=0;i< mid-1; ++i)
-					_MD.addin(C[shiftC+degSplit+i], C_tmp[i]);											
-			}		    
-		}	
-
+					_MD.addin(C[shiftC+degSplit+i], C_tmp[i]);
+			}
+		}
 
 
+		template< class Polynomial1, class Polynomial2, class Polynomial3>
+		void midproduct_Karatsuba(Polynomial1 &C, const Polynomial2 &A, const Polynomial3 &B){
 
-		void midproduct_Karatsuba(std::vector<Coefficient> &C, const std::vector<Coefficient> &A, const std::vector<Coefficient> &B){
-		
 			if (A.size() == 1){
 				_BMD.mul(C[0],A[0],B[0]);
 			}
-			else {				
+			else {
 				size_t k0= A.size()>>1;
 				size_t k1= A.size()-k0;
 
-				size_t m = B[0].rowdim();
-				size_t n = B[0].coldim();
+				typedef  typename Polynomial1::value_type Coefficient;
+				const Coefficient ZeroC(C[0].rowdim(), C[0].coldim());
+				const Coefficient ZeroA(A[0].rowdim(), A[0].coldim());
+				const Coefficient ZeroB(B[0].rowdim(), B[0].coldim());
+
+				std::vector<Coefficient> alpha(k1,ZeroC), beta(k1,ZeroC), gamma(k0,ZeroC);
+				std::vector<Coefficient> A_low(k0, ZeroA), A_high(k1,ZeroA);
+				std::vector<Coefficient> B1(2*k1-1,ZeroB), B2(2*k1-1,ZeroB);
 
-				const Coefficient Zero(m,n);
-				std::vector<Coefficient> alpha(k1,Zero), beta(k1,Zero), gamma(k0,Zero);
-				std::vector<Coefficient> A_low(k0), A_high(k1), B1(2*k1-1), B2(2*k1-1);
-				
 				for (size_t i=0;i<k0;++i)
 					A_low[i] = A[i];
 
@@ -273,29 +348,29 @@ namespace LinBox {
 					B1[i] = B[i];
 					B2[i] = B[i+k1];
 					_MD.addin(B1[i],B2[i]);
-				}		
-				midproduct_Karatsuba(alpha, A_high, B1);			
+				}
+				midproduct_Karatsuba(alpha, A_high, B1);
 
 				if (k0 == k1) {
 					for (size_t i=0;i<k1;++i)
 						_MD.subin(A_high[i],A_low[i]);
-					midproduct_Karatsuba(beta, A_high, B2);					
+					midproduct_Karatsuba(beta, A_high, B2);
 				}
 				else {
 					for (size_t i=1;i<k1;++i)
 						_MD.subin(A_high[i],A_low[i-1]);
 					midproduct_Karatsuba(beta, A_high, B2);
-				}				
-				
-				std::vector<Coefficient> B3(2*k0-1,Zero);
+				}
+
+				std::vector<Coefficient> B3(2*k0-1,ZeroB);
 				for (size_t i=0;i<2*k0-1;++i)
 					_MD.add(B3[i],B[i+2*k1],B[i+k1]);
-				
+
 				midproduct_Karatsuba(gamma, A_low, B3);
 
 				for (size_t i=0;i<k1;++i)
 					_MD.sub(C[i],alpha[i],beta[i]);
-				
+
 				for (size_t i=0;i<k0;++i){
 					C[k1+i]=gamma[i];
 					_MD.addin(C[k1+i],beta[i]);
@@ -303,30 +378,100 @@ namespace LinBox {
 			}
 		}
 
+		template< class Polynomial1, class Polynomial2, class Polynomial3>
+		void midproduct_Karatsubagen(Polynomial1 &C, const Polynomial2 &A, const Polynomial3 &B){
+
+			if (A.size() == 1){
+				for (size_t i=0;i<B.size();i++)
+					_BMD.mul(C[i],A[0],B[i]);
+			}
+			else {
+				size_t dA=A.size();
+				size_t dB=B.size();
+				size_t Ak0= dA>>1;
+				size_t Ak1= dA-Ak0;
+				size_t Bk0= (dB+1-dA)>>1;
+				size_t Bk1= dB+1-dA-Bk0;
+				std::cout<<C.size()<<" "<<A.size()<<" "<<B.size()<<"("<<Bk0<<","<<Bk1<<")\n";
+
+				typedef  typename Polynomial1::value_type Coefficient;
+				const Coefficient ZeroC(C[0].rowdim(), C[0].coldim());
+				const Coefficient ZeroA(A[0].rowdim(), A[0].coldim());
+				const Coefficient ZeroB(B[0].rowdim(), B[0].coldim());
+
+				std::vector<Coefficient> A_low(Ak0,ZeroA), A_high(Ak1,ZeroA);
+				std::vector<Coefficient> alpha(Bk1,ZeroC), beta(Bk1,ZeroC), gamma(Bk0,ZeroC);
+				std::vector<Coefficient> B1(Ak1+Bk1-1,ZeroB), B2(Ak1+Bk1-1,ZeroB), B3(Ak0+Bk0-1, ZeroB);;
+
+
+				for (size_t i=0;i<Ak0;++i)
+					A_low[i] = A[i];
+
+				for (size_t i=Ak0;i<dA;++i)
+					A_high[i-Ak0] = A[i];
+
+				for (size_t i=0;i<Ak1+Bk1-1;++i){
+					B1[i] = B[i];
+					B2[i] = B[i+Ak1];
+					_MD.addin(B1[i],B2[i]);
+				}
+				midproduct_Karatsubagen(alpha, A_high, B1);
+
+				if (Ak0 == Ak1) {
+					for (size_t i=0;i<Ak1;++i)
+						_MD.subin(A_high[i],A_low[i]);
+					midproduct_Karatsubagen(beta, A_high, B2);
+				}
+				else {
+					for (size_t i=1;i<Ak1;++i)
+						_MD.subin(A_high[i],A_low[i-1]);
+					midproduct_Karatsubagen(beta, A_high, B2);
+				}
+
+
+				if (Bk0>0) {
+					for (size_t i=0;i<Ak0+Bk0-1;++i)
+						_MD.add(B3[i],B[i+Ak0+Bk1],B[i+Ak0]);
+					midproduct_Karatsubagen(gamma, A_low, B3);
+				}
+
+
+				for (size_t i=0;i<Bk1;++i)
+					_MD.sub(C[i],alpha[i],beta[i]);
+
+				for (size_t i=0;i<Bk0;++i){
+					C[Bk1+i]=gamma[i];
+					_MD.addin(C[Bk1+i],beta[i]);
+				}
+			}
+		}
+
 	}; // end of class KaratsubaMulDomain<Field, Matrix>
 
-	template <class _Field, class _Polynomial>
+	template <class _Field>
 	class SpecialFFTMulDomain;
 
+
+#ifndef PASCO_EXTENSION
 	// FFT domain for every prime
-	template <class _Field, class _Polynomial>
+	template <class _Field>
 	class FFTMulDomain {
 	public:
-		typedef _Field                                          Field;
-		typedef typename Field::Element                       Element;
-		typedef _Polynomial                                Polynomial;
-		typedef typename Polynomial::value_type           Coefficient;	
-		typedef SpecialFFTMulDomain<Field, Polynomial>  FFTDomainBase;
+		typedef _Field                              Field;
+		typedef typename Field::Element           Element;
+		typedef SpecialFFTMulDomain<Field>  FFTDomainBase;
 
 	private:
-		Field                _F; 
+		Field                _F;
 		integer              _p;
 		size_t         _fftsize;
-			
+
 	public:
 
-		FFTMulDomain (const Field &F) :  _F(F){
-			
+		FFTMulDomain (const Field &F) :
+			_F(F)
+		{
+
 			_F.characteristic(_p);
 
 			_fftsize=0;
@@ -335,65 +480,70 @@ namespace LinBox {
 			if (p&1){
 				p-=1;
 				do { p=p>>1; _fftsize++;} while(!(p&0x0001));
-			}								
+			}
 		}
 
-		void mul(Polynomial &a, const Polynomial &b, const Polynomial &c) {
+		template< class Polynomial1, class Polynomial2, class Polynomial3>
+		void mul(Polynomial1 &a, const Polynomial2 &b, const Polynomial3 &c) {
+			linbox_check(a.size() >= (b.size()+c.size()-1));
 			size_t deg     = b.size()+c.size()-1;
-			size_t lpts = 0; 
+			size_t lpts = 0;
 			size_t pts =1; while (pts < deg) { pts= pts<<1; ++lpts; }
-			
+
+			typedef  typename Polynomial1::value_type Coefficient;
+			const Coefficient ZeroC(c[0].rowdim(), c[0].coldim());
+			const Coefficient ZeroA(a[0].rowdim(), a[0].coldim());
+			const Coefficient ZeroB(b[0].rowdim(), b[0].coldim());
+
 			// check if fft prime and good enough
 			if (lpts < _fftsize){
 				FFTDomainBase fftdomain(_F);
 				fftdomain.mul(a, b, c);
 			}
-			else {				
+			else {
 				// computation done using CRT and few fft primes
-				
+
 				// get number of bits of feasible fft prime
 				int k= b[0].coldim();
 				size_t n=k;
 				size_t ln=0;
 				while ( k>0) {k>>=1; ln++;}
-				
+
 				// taking primes greater than current prime
 				size_t bit = std::max((53-ln)>>1, _p.bitsize());
 
-				// get number of necessary primes				
+				// get number of necessary primes
 				integer ibound = n * _p * _p * std::max(b.size(), c.size());
 				integer primesprod=1; size_t nbrprimes=1;
-				RandomFFTPrime fftprime(bit);
+				RandomFFTPrime fftprime(bit, FFT_PRIME_SEED);
 				std::vector<integer> lprimes(10); lprimes.resize(nbrprimes);
-				lprimes[0] = fftprime.randomPrime();				
+				lprimes[0] = fftprime.randomPrime();
 				primesprod = lprimes[0];
 				while (primesprod < ibound) {
 					++nbrprimes;
-					lprimes.resize(nbrprimes);				
-					do {lprimes[nbrprimes-1] = fftprime.randomPrime();} while (primesprod % lprimes[nbrprimes-1] == 0);					
-					primesprod *= lprimes[nbrprimes-1]; 
+					lprimes.resize(nbrprimes);
+					do {lprimes[nbrprimes-1] = fftprime.randomPrime();} while (primesprod % lprimes[nbrprimes-1] == 0);
+					primesprod *= lprimes[nbrprimes-1];
 				}
 #ifdef FFT_TIMING
 				std::cout<<"num of primes "<<nbrprimes<<"\n";
 #endif
 				// allocate fftprime fields
-				Field f_i[nbrprimes];
+				Field * f_i = new Field[nbrprimes];
 
 				// allocate polynomial matrices for multimodular results
-				Polynomial a_i[nbrprimes];
-				const Coefficient Zero(a[0].rowdim(),a[0].coldim());
-
+				std::vector<Coefficient> * a_i = new std::vector<Coefficient>[nbrprimes];
 
 				// set fftprimes, fftdomains, polynomial matrix results
 				for (size_t i=0; i< nbrprimes; ++i){
 					f_i[i] = Field(lprimes[i]);
-					FFTDomainBase fftdomain(f_i[i]);					
-					a_i[i] = Polynomial(a.size(), Zero);
-					fftdomain.mul(a_i[i], b ,c);				
+					FFTDomainBase fftdomain(f_i[i]);
+					a_i[i] = std::vector<Coefficient>(a.size(), ZeroA);
+					// does not work if original field representation is not Fp seen as integers mod p
+					fftdomain.mul(a_i[i], b ,c);
 				}
-				
-				LinBox::Timer chrono;
-				double trec=0.;
+
+				Timer chrono;
 				chrono.start();
 				// reconstruct the solution modulo the original prime
 				if (nbrprimes < 2) {
@@ -404,22 +554,22 @@ namespace LinBox {
 							}
 				}
 				else {
-					integer crt[nbrprimes];
-					Element crt_inv[nbrprimes], tmp;
-					crt_inv[nbrprimes];
+					integer * crt = new integer[nbrprimes];
+					Element * crt_inv = new Element[nbrprimes];
+					Element tmp;
 					for (size_t i=0;i<nbrprimes; ++i){
 						crt[i]=primesprod/lprimes[i];
 						f_i[i].init(tmp,crt[i]);
 						f_i[i].inv(crt_inv[i], tmp);
 					}
-					
+
 					integer res,acc;
 					for (size_t k=0;k<deg;++k)
 						for (size_t i=0;i<a[0].rowdim();++i)
 							for (size_t j=0;j<a[0].coldim();++j){
 								acc= integer(0);
-								for (size_t l=0;l<nbrprimes; ++l){  							
-									f_i[l].mul(tmp, a_i[l][k].getEntry(i,j), crt_inv[l]);  
+								for (size_t l=0;l<nbrprimes; ++l){
+									f_i[l].mul(tmp, a_i[l][k].getEntry(i,j), crt_inv[l]);
 									res= f_i[l].convert(res,tmp);
 									acc+= res*crt[l];
 									if (acc > primesprod)
@@ -428,13 +578,18 @@ namespace LinBox {
 								_F.init(a[k].refEntry(i,j), acc);
 							}
 #ifdef FFT_TIMING
-				chrono.stop();std::cout<<"reconstruction time: "<<chrono<<"\n";
+					chrono.stop();std::cout<<"reconstruction time: "<<chrono<<"\n";
 #endif
+					delete [] crt;
+					delete [] crt_inv;
 				}
-			}			
+				delete [] f_i;
+				delete [] a_i;
+			}
 		}
 
-		void midproduct(Polynomial &a, const Polynomial &b, const Polynomial &c) {
+		template< class Polynomial1, class Polynomial2, class Polynomial3>
+		void midproduct(Polynomial1 &a, const Polynomial2 &b, const Polynomial3 &c) {
 			linbox_check(2*a.size() == c.size()+1 );
 			linbox_check(2*b.size() == c.size()+1 );
 			linbox_check(b[0].coldim() == c[0].rowdim());
@@ -442,12 +597,14 @@ namespace LinBox {
 			size_t m = b[0].rowdim();
 			size_t k = b[0].coldim();
 			size_t n = c[0].coldim();
-			const Coefficient AZero(m,n), BZero(m,k), CZero(k,n);
+
+			typedef  typename Polynomial1::value_type Coefficient;
+			const Coefficient ZeroA(m,n), ZeroB(m,k), ZeroC(k,n);
 
 			size_t deg  = c.size()+1;
-			size_t lpts = 0; 
+			size_t lpts = 0;
 			size_t pts =1; while (pts < deg) { pts= pts<<1; ++lpts; }
-			
+
 			// check if fft prime and good enough
 			if (lpts < _fftsize){
 				FFTDomainBase fftdomain(_F);
@@ -455,51 +612,302 @@ namespace LinBox {
 			}
 			else {
 				// computation done using CRT and few fft primes
-				
+
 				// get number of bits of feasible fft prime
 				int k= b[0].coldim();
 				size_t n=k;
 				size_t ln=0;
 				while ( k>0) {k>>=1; ln++;}
-				
+
 				// taking primes greater than current prime
 				size_t bit = std::max((53-ln)>>1, _p.bitsize());
 
-				// get number of necessary primes				
+				// get number of necessary primes
 				integer ibound = n * _p * _p * std::max(b.size(), c.size());
 				integer primesprod=1; size_t nbrprimes=1;
-				RandomFFTPrime fftprime(bit);
+				RandomFFTPrime fftprime(bit, FFT_PRIME_SEED);
 				std::vector<integer> lprimes(10); lprimes.resize(nbrprimes);
-				lprimes[0] = fftprime.randomPrime();				
+				lprimes[0] = fftprime.randomPrime();
 				primesprod = lprimes[0];
 				while (primesprod < ibound) {
 					++nbrprimes;
-					lprimes.resize(nbrprimes);				
-					do {lprimes[nbrprimes-1] = fftprime.randomPrime();} while (primesprod % lprimes[nbrprimes-1] == 0);					
-					primesprod *= lprimes[nbrprimes-1]; 
+					lprimes.resize(nbrprimes);
+					do {lprimes[nbrprimes-1] = fftprime.randomPrime();} while (primesprod % lprimes[nbrprimes-1] == 0);
+					primesprod *= lprimes[nbrprimes-1];
 				}
-				
-#ifdef FFT_TIMING			
+
+#ifdef FFT_TIMING
 				std::cout<<"num of primes "<<nbrprimes<<"\n";
-#endif				
+#endif
 
 				// allocate fftprime fields
-				Field f_i[nbrprimes];
+				Field * f_i = new Field[nbrprimes];
 
 				// allocate polynomial matrices for multimodular results
-				Polynomial a_i[nbrprimes];
-				const Coefficient Zero(a[0].rowdim(),a[0].coldim());
+				std::vector<Coefficient> * a_i = new std::vector<Coefficient>[nbrprimes];
+
+				// set fftprimes, fftdomains, polynomial matrix results
+				for (size_t i=0; i< nbrprimes; ++i){
+					f_i[i] = Field(lprimes[i]);
+					FFTDomainBase fftdomain(f_i[i]);
+					a_i[i] = std::vector<Coefficient>(a.size(), ZeroA);
+					// does not work if original field representation is not Fp seen as integers mod p
+					fftdomain.midproduct(a_i[i], b ,c);
+				}
+
+				Timer chrono;
+				chrono.start();
+				// reconstruct the solution modulo the original prime
+				if (nbrprimes < 2) {
+					for (size_t k=0;k<a.size();++k)
+						for (size_t i=0;i<a[0].rowdim();++i)
+							for (size_t j=0;j<a[0].coldim();++j){
+								_F.init(a[k].refEntry(i,j), a_i[0][k].getEntry(i,j));
+							}
+				}
+				else {
+					integer * crt = new integer[nbrprimes];
+					Element * crt_inv = new Element[nbrprimes];
+					Element tmp;
+					for (size_t i=0;i<nbrprimes; ++i){
+						crt[i]=primesprod/lprimes[i];
+						f_i[i].init(tmp,crt[i]);
+						f_i[i].inv(crt_inv[i], tmp);
+					}
+
+					integer res,acc;
+					for (size_t k=0;k<a.size();++k)
+						for (size_t i=0;i<a[0].rowdim();++i)
+							for (size_t j=0;j<a[0].coldim();++j){
+								acc= integer(0);
+								for (size_t l=0;l<nbrprimes; ++l){
+									f_i[l].mul(tmp, a_i[l][k].getEntry(i,j), crt_inv[l]);
+									res= f_i[l].convert(res,tmp);
+									acc+= res*crt[l];
+									if (acc > primesprod)
+										acc-= primesprod;
+								}
+								_F.init(a[k].refEntry(i,j), acc);
+							}
+					delete [] crt;
+					delete [] crt_inv;
+				}
+#ifdef FFT_TIMING
+				chrono.stop();std::cout<<"reconstruction time: "<<chrono<<"\n";
+#endif
+				delete [] f_i;
+				delete [] a_i;
+			}
+		}
+	};
+
+#else
+
+
+	// Specialization for extension field GFqDom
+	template <>
+	class FFTMulDomain<GivaroGfq> {
+	public:
+		typedef GivaroGfq                                   Field;
+		typedef Modular<double>                      ModularField;
+		typedef typename Field::Element                   Element;
+		typedef typename ModularField::Element     ModularElement;
+		typedef SpecialFFTMulDomain<ModularField>   FFTDomainBase;
+
+	private:
+		Field                _F;
+		integer              _p;
+		size_t         _fftsize;
+
+	public:
+
+		FFTMulDomain (const Field &F) :  _F(F){
+
+			_F.characteristic(_p);
+
+			_fftsize=0;
+			//check if field is based on fft prime
+			size_t p = _p;
+			if (p&1){
+				p-=1;
+				do { p=p>>1; _fftsize++;} while(!(p&0x0001));
+			}
+		}
+
+		template< class Polynomial1, class Polynomial2, class Polynomial3>
+		void mul(Polynomial1 &a, const Polynomial2 &b, const Polynomial3 &c) {
+			linbox_check(a.size() >= (b.size()+c.size()-1));
+			size_t deg     = b.size()+c.size()-1;
+			size_t lpts = 0;
+			size_t pts =1; while (pts < deg) { pts= pts<<1; ++lpts; }
+
+			typedef  typename Polynomial1::value_type Coefficient;
+			const Coefficient ZeroC(c[0].rowdim(), c[0].coldim());
+			const Coefficient ZeroA(a[0].rowdim(), a[0].coldim());
+			const Coefficient ZeroB(b[0].rowdim(), b[0].coldim());
+
+
+			// computation done using CRT with few fft primes
+
+			// get number of bits of feasible fft prime
+			int k= b[0].coldim();
+			size_t n=k;
+			size_t ln=0;
+			while ( k>0) {k>>=1; ln++;}
+
+			// max fft prime value according to matrix dimension
+			size_t bit = (53-ln)>>1;
+
+			// get number of necessary primes
+			integer ibound = n * _p * _p * std::max(b.size(), c.size());
+			integer primesprod=1; size_t nbrprimes=1;
+			RandomFFTPrime fftprime(bit, FFT_PRIME_SEED);
+			std::vector<integer> lprimes(10); lprimes.resize(nbrprimes);
+			lprimes[0] = fftprime.randomPrime();
+			primesprod = lprimes[0];
+			while (primesprod < ibound) {
+				++nbrprimes;
+				lprimes.resize(nbrprimes);
+				do {lprimes[nbrprimes-1] = fftprime.randomPrime();} while (primesprod % lprimes[nbrprimes-1] == 0);
+				primesprod *= lprimes[nbrprimes-1];
+			}
+#ifdef FFT_TIMING
+			std::cout<<"num of primes "<<nbrprimes<<"\n";
+#endif
+			// allocate fftprime fields
+			Field * f_i = new Field[nbrprimes];
+
+			// allocate polynomial matrices for multimodular results
+			std::vector<Coefficient> * a_i = new std::vector<Coefficient>[nbrprimes];
+			std::vector<Coefficient> * b_i = new std::vector<Coefficient>[nbrprimes];
+			std::vector<Coefficient> * c_i = new std::vector<Coefficient>[nbrprimes];
+
+
+			// set fftprimes, fftdomains, polynomial matrices
+			for (size_t i=0; i< nbrprimes; ++i){
+				f_i[i] = Field(lprimes[i]);
+				FFTDomainBase fftdomain(f_i[i]);
+				a_i[i] = std::vector<Coefficient>(a.size(), ZeroA);
+				b_i[i] = std::vector<Coefficient>(b.size(), ZeroB);
+				c_i[i] = std::vector<Coefficient>(c.size(), ZeroC);
+
+				// does not work if original field representation is not Fp seen as integers mod p
+				fftdomain.mul(a_i[i], b ,c);
+			}
+
+			Timer chrono;
+			chrono.start();
+			// reconstruct the solution modulo the original prime
+			if (nbrprimes < 2) {
+				for (size_t k=0;k<a.size();++k)
+					for (size_t i=0;i<a[0].rowdim();++i)
+						for (size_t j=0;j<a[0].coldim();++j){
+							_F.init(a[k].refEntry(i,j), a_i[0][k].getEntry(i,j));
+						}
+			}
+			else {
+				integer * crt = new integer[nbrprimes];
+				Element * crt_inv = new Element[nbrprimes];
+				Element tmp;
+				for (size_t i=0;i<nbrprimes; ++i){
+					crt[i]=primesprod/lprimes[i];
+					f_i[i].init(tmp,crt[i]);
+					f_i[i].inv(crt_inv[i], tmp);
+				}
+
+				integer res,acc;
+				for (size_t k=0;k<deg;++k)
+					for (size_t i=0;i<a[0].rowdim();++i)
+						for (size_t j=0;j<a[0].coldim();++j){
+							acc= integer(0);
+							for (size_t l=0;l<nbrprimes; ++l){
+								f_i[l].mul(tmp, a_i[l][k].getEntry(i,j), crt_inv[l]);
+								res= f_i[l].convert(res,tmp);
+								acc+= res*crt[l];
+								if (acc > primesprod)
+									acc-= primesprod;
+							}
+							_F.init(a[k].refEntry(i,j), acc);
+						}
+#ifdef FFT_TIMING
+				chrono.stop();std::cout<<"reconstruction time: "<<chrono<<"\n";
+#endif
+				delete [] crt;
+				delete [] crt_inv;
+			}
+			delete [] f_i;
+			delete [] a_i;
+
+		}
+
+		template< class Polynomial1, class Polynomial2, class Polynomial3>
+		void midproduct(Polynomial1 &a, const Polynomial2 &b, const Polynomial3 &c) {
+			linbox_check(2*a.size() == c.size()+1 );
+			linbox_check(2*b.size() == c.size()+1 );
+			linbox_check(b[0].coldim() == c[0].rowdim());
+
+			size_t m = b[0].rowdim();
+			size_t k = b[0].coldim();
+			size_t n = c[0].coldim();
+
+			typedef  typename Polynomial1::value_type Coefficient;
+			const Coefficient ZeroA(m,n), ZeroB(m,k), ZeroC(k,n);
+
+			size_t deg  = c.size()+1;
+			size_t lpts = 0;
+			size_t pts =1; while (pts < deg) { pts= pts<<1; ++lpts; }
+
+			// check if fft prime and good enough
+			if (lpts < _fftsize){
+				FFTDomainBase fftdomain(_F);
+				fftdomain.midproduct(a, b, c);
+			}
+			else {
+				// computation done using CRT and few fft primes
+
+				// get number of bits of feasible fft prime
+				int k= b[0].coldim();
+				size_t n=k;
+				size_t ln=0;
+				while ( k>0) {k>>=1; ln++;}
+
+				// taking primes greater than current prime
+				size_t bit = std::max((53-ln)>>1, _p.bitsize());
+
+				// get number of necessary primes
+				integer ibound = n * _p * _p * std::max(b.size(), c.size());
+				integer primesprod=1; size_t nbrprimes=1;
+				RandomFFTPrime fftprime(bit, FFT_PRIME_SEED);
+				std::vector<integer> lprimes(10); lprimes.resize(nbrprimes);
+				lprimes[0] = fftprime.randomPrime();
+				primesprod = lprimes[0];
+				while (primesprod < ibound) {
+					++nbrprimes;
+					lprimes.resize(nbrprimes);
+					do {lprimes[nbrprimes-1] = fftprime.randomPrime();} while (primesprod % lprimes[nbrprimes-1] == 0);
+					primesprod *= lprimes[nbrprimes-1];
+				}
 
+#ifdef FFT_TIMING
+				std::cout<<"num of primes "<<nbrprimes<<"\n";
+#endif
+
+				// allocate fftprime fields
+				Field * f_i = new Field[nbrprimes];
+
+				// allocate polynomial matrices for multimodular results
+				std::vector<Coefficient> * a_i = new std::vector<Coefficient>[nbrprimes];
 
 				// set fftprimes, fftdomains, polynomial matrix results
 				for (size_t i=0; i< nbrprimes; ++i){
 					f_i[i] = Field(lprimes[i]);
-					FFTDomainBase fftdomain(f_i[i]);					
-					a_i[i] = Polynomial(a.size(), Zero);
-					fftdomain.midproduct(a_i[i], b ,c);				
+					FFTDomainBase fftdomain(f_i[i]);
+					a_i[i] = std::vector<Coefficient>(a.size(), ZeroA);
+					// does not work if original field representation is not Fp seen as integers mod p
+					fftdomain.midproduct(a_i[i], b ,c);
 				}
-				
-				LinBox::Timer chrono;
+
+				Timer chrono;
 				chrono.start();
 				// reconstruct the solution modulo the original prime
 				if (nbrprimes < 2) {
@@ -510,22 +918,22 @@ namespace LinBox {
 							}
 				}
 				else {
-					integer crt[nbrprimes];
-					Element crt_inv[nbrprimes], tmp;
-					crt_inv[nbrprimes];
+					integer * crt = new integer[nbrprimes];
+					Element * crt_inv = new Element[nbrprimes];
+					Element tmp;
 					for (size_t i=0;i<nbrprimes; ++i){
 						crt[i]=primesprod/lprimes[i];
 						f_i[i].init(tmp,crt[i]);
 						f_i[i].inv(crt_inv[i], tmp);
 					}
-					
+
 					integer res,acc;
 					for (size_t k=0;k<a.size();++k)
 						for (size_t i=0;i<a[0].rowdim();++i)
 							for (size_t j=0;j<a[0].coldim();++j){
 								acc= integer(0);
-								for (size_t l=0;l<nbrprimes; ++l){  							
-									f_i[l].mul(tmp, a_i[l][k].getEntry(i,j), crt_inv[l]);  
+								for (size_t l=0;l<nbrprimes; ++l){
+									f_i[l].mul(tmp, a_i[l][k].getEntry(i,j), crt_inv[l]);
 									res= f_i[l].convert(res,tmp);
 									acc+= res*crt[l];
 									if (acc > primesprod)
@@ -533,24 +941,27 @@ namespace LinBox {
 								}
 								_F.init(a[k].refEntry(i,j), acc);
 							}
+					delete [] crt;
+					delete [] crt_inv;
 				}
-#ifdef FFT_TIMING			
+#ifdef FFT_TIMING
 				chrono.stop();std::cout<<"reconstruction time: "<<chrono<<"\n";
-#endif	
-			}		
+#endif
+				delete [] f_i;
+				delete [] a_i;
+			}
 		}
 	};
 
-	
+
+#endif // END OF NEW CODE
+
 	// FFT Domain when prime is a FFT prime
-	template <class _Field, class _Polynomial>
+	template <class _Field>
 	class SpecialFFTMulDomain {
 	public:
 		typedef _Field                                    Field;
 		typedef typename Field::Element                 Element;
-		typedef _Polynomial                          Polynomial;
-		typedef typename Polynomial::value_type     Coefficient;
-
 
 	private:
 		Field                      _F;
@@ -562,12 +973,14 @@ namespace LinBox {
 		mutable             long _gen;
 	public:
 
-		SpecialFFTMulDomain(const Field &F) : _F(F), _MD(F), _BMD(F) {
+		SpecialFFTMulDomain(const Field &F) :
+			_F(F), _MD(F), _BMD(F)
+		{
 			F.characteristic(_p);
 			_pl = _p;
 			fftadd= fftmul = fftcopy=0.;
-			
-			// find a pseudo primitive element of the multiplicative group _p -1						
+
+			// find a pseudo primitive element of the multiplicative group _p -1
 			long m = _pl - 1;
 			long k = 0;srand(time(NULL));
 			while ((m & 1) == 0) {
@@ -577,24 +990,26 @@ namespace LinBox {
 			long long y,z,j;
 			for (;;) {
 				_gen = rand() % _pl; if (_gen <= 0) continue;
-				
-				z = 1; for (size_t i=0;i<m;++i) z = z*_gen % _pl;
+
+				z = 1; for (long i=0;i<m;++i) z = z*_gen % _pl;
 				if (z == 1) continue;
-				
+
 				//_gen = z;
 				j = 0;
 				do {
 					y = z;
 					z = y*y % _pl;
 					j++;
-				} while (j != k && z != 1);				
-				if (j == k) 
+				} while (j != k && z != 1);
+				if (j == k)
 					break;
 			}
 		}
 
-		void mul(Polynomial &a, const Polynomial &b, const Polynomial &c) {
-#ifdef FFT_TIMING			
+		template< class Polynomial1, class Polynomial2, class Polynomial3>
+		void mul(Polynomial1 &a, const Polynomial2 &b, const Polynomial3 &c)
+		{
+#ifdef FFT_TIMING
 			Timer chrono;
 			chrono.start();
 #endif
@@ -604,30 +1019,26 @@ namespace LinBox {
 			size_t m = b[0].rowdim();
 			size_t k = b[0].coldim();
 			size_t n = c[0].coldim();
-			const Coefficient AZero(m,n), BZero(m,k), CZero(k,n);
+			typedef  typename Polynomial1::value_type Coefficient;
+			const Coefficient ZeroA(m,n), ZeroB(m,k), ZeroC(k,n);
 
 			size_t deg     = b.size()+c.size()-1;
-			size_t lpts = 0; 
+			size_t lpts = 0;
 			size_t pts =1; while (pts < deg) { pts= pts<<1; ++lpts; }
 
-#ifdef FFT_TIMING			
+#ifdef FFT_TIMING
 			std::cout<<"FFT: points "<<pts<<"\n";
-#endif			
-		
+#endif
 			if (_p%pts != 1) {
 				std::cout<<"Error the prime is not a FFTPrime or it has too small power of 2\n";
 				throw LinboxError("LinBox ERROR: bad FFT Prime\n");
 			}
-			
+
 			long w ;
-			long accu;
 			// find a pseudo nth primitive root of unity
 			for (;;) {
-						
 				// compute the nth primitive root
-				w=  (long) ::powmod(_gen, _pl>>lpts, _p);
-				//std::cout<<w<<" : "<<_gen<<"\n"<<(_pl>>lpts)<<"\n";
-
+				w=  (long) ::Givaro::powmod(_gen, _pl>>lpts, _p);
 				if ((w !=1) && (w != _pl-1))
 					break;
 
@@ -641,24 +1052,24 @@ namespace LinBox {
 				long yy,zz,jj;
 				for (;;) {
 					_gen = rand() % _pl; if (_gen <= 0) continue;
-					
-					zz = 1; for (size_t i=0;i<mm;++i) zz = zz*_gen % _pl;
+
+					zz = 1; for (long i=0;i<mm;++i) zz = zz*_gen % _pl;
 					if (zz == 1) continue;
-					
+
 					jj = 0;
 					do {
 						yy = zz;
 						zz = yy*yy % _pl;
 						jj++;
-					} while (jj != kk && zz != 1);				
-					if (jj == kk) 
+					} while (jj != kk && zz != 1);
+					if (jj == kk)
 						break;
 				}
-		 	}
+			}
 
 			long inv_w;
 
-			// compute w^(-1) mod p using extended euclidean algorithm 
+			// compute w^(-1) mod p using extended euclidean algorithm
 			long x_int, y_int, q, tx, ty, temp;
 			x_int = (long) _p;
 			y_int = (long) w;
@@ -669,81 +1080,99 @@ namespace LinBox {
 				x_int = temp;
 				temp = ty; ty = tx - q * ty;
 				tx = temp;
-			}			
-			if (tx < 0) tx += (long) _p;			
+			}
+			if (tx < 0) tx += (long) _p;
 			inv_w = tx;
 
-			
-			Element _w, _inv_w; 
+
+			Element _w, _inv_w;
 			_F.init(_w, w);
-			_F.init(_inv_w, inv_w); 
+			_F.init(_inv_w, inv_w);
 			std::vector<Element> pow_w(pts);
 			std::vector<Element> pow_inv_w(pts);
-			
+
 			//std::cout<<"w: "<<w<<"\n w^-1: "<<inv_w<<"\n";
 			//std::cout<<"degree: "<<pts<<"\n";
 
 			// compute power of w and w^(-1)
 			_F.init(pow_w[0],1);
-			_F.init(pow_inv_w[0],1);		
+			_F.init(pow_inv_w[0],1);
 			for (size_t i=1;i<pts;++i){
 				_F.mul(pow_w[i], pow_w[i-1], _w);
-				_F.mul(pow_inv_w[i], pow_inv_w[i-1], _inv_w);	
-			}			 
+				_F.mul(pow_inv_w[i], pow_inv_w[i-1], _inv_w);
+			}
 
 			// compute reverse bit ordering
 			size_t revbit[pts];
-			for (long i = 0, j = 0; i < pts; i++, j = RevInc(j, lpts))
+			for (long i = 0, j = 0; i < static_cast<long>(pts); i++, j = RevInc(j, lpts))
 				revbit[i]=j;
-			
+
 			// set the data
-			std::vector<Coefficient> fft_a(pts, AZero), fft_b(pts, BZero), fft_c(pts,CZero);
+			std::vector<Coefficient> fft_a(pts, ZeroA), fft_b(pts, ZeroB), fft_c(pts,ZeroC);
 			for (size_t i=0;i<b.size();++i)
 				fft_b[i]=b[i];
-				//fft_b[revbit[i]]=b[i];
+			for (size_t i=b.size();i<pts;++i)
+				fft_b[i]=ZeroB;
 			for (size_t i=0;i<c.size();++i)
 				fft_c[i]=c[i];
-				//fft_c[revbit[i]]=c[i];
-			
+			for (size_t i=c.size();i<pts;++i)
+				fft_c[i]=ZeroC;
+
+
 
-	
-		
-			
 #ifdef FFT_TIMING
 			chrono.stop();
 			std::cout<<"FFT: init                       : "<<chrono.usertime()<<"\n";
 			chrono.clear();
 			chrono.start();
 #endif
-			// compute the DFT of b and c using FFT
-			FFT(fft_b, pts, pow_w);				
-			FFT(fft_c, pts, pow_w);
-			//iterative_FFT(fft_b, pts, lpts, pow_w);
-			//iterative_FFT(fft_c, pts, lpts, pow_w);
-
-
-			
+			// compute the DFT of b and c using FFT (parallel if __LINBOX_HAVE_OPENMP)
+			launch_FFT(fft_b, pts, pow_w);
+			launch_FFT(fft_c, pts, pow_w);
 
 #ifdef FFT_TIMING
-			chrono.stop();		       
-			std::cout<<"FFT: DFT of inputs              : "<<chrono.usertime()<<" = "<<fftcopy<<" (copy), "<<fftadd<<" (add), "<<fftmul<<" (mul)\n";
+			chrono.stop();
+			std::cout<<"FFT: DFT of inputs              : "<<chrono
+			<<" = "<<fftcopy<<" (copy), "<<fftadd<<" (add), "<<fftmul<<" (mul)\n";
 			fftcopy=fftadd=fftmul=0.;
 			chrono.clear();
 			chrono.start();
 #endif
 			// do the multiplication componentwise
-			for (size_t i=0;i<pts;++i)
-				_BMD.mul(fft_a[i], fft_b[i], fft_c[i]);
+#ifdef __LINBOX_HAVE_OPENMP
+#ifdef FFT_TIMING
+			//Timer chrono_mul[omp_get_max_threads()], chrono_mul_t[omp_get_max_threads()];
+#endif
+			//std::cerr << "mul|| th: " << omp_get_max_threads() << ", pts: " << pts << ", n: " << fft_a[0].rowdim() << std::endl;
 
+#pragma omp parallel for shared(fft_a,fft_b,fft_c) private(i) schedule(dynamic)
+#endif
+			for (long i=0;i<static_cast<long>(pts);++i)
+				// #ifdef FFT_TIMING
+				// #ifdef __LINBOX_HAVE_OPENMP
+				// 				{chrono_mul[omp_get_thread_num()].start();
+				// #endif
+				// #endif
+				_BMD.mul(fft_a[i], fft_b[i], fft_c[i]);
 #ifdef FFT_TIMING
 			chrono.stop();
-			std::cout<<"FFT: componentwise mul          : "<<chrono.usertime()<<"\n";
+#ifdef __LINBOX_HAVE_OPENMP
+			//chrono_mul[omp_get_thread_num()].stop();chrono_mul_t[omp_get_thread_num()]+=chrono_mul[omp_get_thread_num()];}
+			//for (size_t i=0;i<omp_get_max_threads();i++)
+			//std::cout<<"FFT: componentwise mul thread["<<i<<"] -> "<<chrono_mul_t[i]<<std::endl;
+#endif
+			std::cout<<"FFT: componentwise mul total      : "<<chrono<<"\n";
 			chrono.clear();
-			chrono.start();	
+			chrono.start();
 #endif
-			
+
 			Element swapping;
+
+
 			// reorder the term in the FFT according to reverse bit ordering
+			// #ifdef __LINBOX_HAVE_OPENMP
+			// #pragma omp parallel for shared(fft_a,revbit) private(Element) schedule(runtime)
+			// #endif
 			for (size_t i=0; i< pts; ++i){
 				if (revbit[i]>i){
 					typename Coefficient::RawIterator it_a1=fft_a[i].rawBegin();
@@ -752,46 +1181,56 @@ namespace LinBox {
 						_F.assign(swapping,*it_a1);
 						_F.assign(*it_a1, *it_a2);
 						_F.assign(*it_a2,swapping);
-					}					
+					}
 				}
 			}
+
+
 #ifdef FFT_TIMING
 			chrono.stop();
-			std::cout<<"FFT: reverse bit ordering       : "<<chrono.usertime()<<"\n";
+			std::cout<<"FFT: reverse bit ordering       : "<<chrono<<"\n";
 			chrono.clear();
-			chrono.start();	
+			chrono.start();
 #endif
-	
+
 
 			// compute the DFT inverse of fft_a
-			FFT(fft_a, pts, pow_inv_w);			
-			//iterative_FFT(fft_a, pts, lpts, pow_inv_w);			
-	
-#ifdef FFT_TIMING	
+			launch_FFT(fft_a, pts, pow_inv_w);
+			//iterative_FFT(fft_a, pts, lpts, pow_inv_w);
+
+#ifdef FFT_TIMING
 			chrono.stop();
-			std::cout<<"FFT: DFT inverse                : "<<chrono.usertime()<<" = "<<fftcopy<<" (copy), "<<fftadd<<" (add), "<<fftmul<<" (mul)\n";
+			std::cout<<"FFT: DFT inverse                : "<<chrono
+			<<" = "<<fftcopy<<" (copy), "<<fftadd<<" (add), "<<fftmul<<" (mul)\n";
 			chrono.clear();
-			chrono.start();	
-#endif			
+			chrono.start();
+#endif
 
 			// set the result according to bitreverse ordering and multiply by 1/pts
 			Element inv_pts;
 			_F.init(inv_pts, pts);
 			_F.invin(inv_pts);
 
-			for (size_t i=0; i< deg; ++i){
-				a[i] = fft_a[revbit[i]];
-				_MD.mulin(a[i], inv_pts);
+			// #ifdef __LINBOX_HAVE_OPENMP
+			// #pragma omp parallel for shared(a,fft_a,revbit,inv_pts) schedule(stati
+			// #endif
+
+			for (long i=0; i< static_cast<long>(deg); ++i){
+				//a[i] = fft_a[revbit[i]];
+				//_MD.mulin(a[i], inv_pts);
+				_MD.mul(a[i],fft_a[revbit[i]],inv_pts);
 			}
 #ifdef FFT_TIMING
 			chrono.stop();
-			std::cout<<"FFT: order and scale the result : "<<chrono.usertime()<<"\n\n";					
+			std::cout<<"FFT: order and scale the result : "<<chrono.usertime()<<"\n\n";
 #endif
+
 		}
 
 		// middle product: a[0..n-1] = (b.c)[n..2n-1]
-		void midproduct (Polynomial &a, const Polynomial &b, const Polynomial &c) {
-			
+		template< class Polynomial1, class Polynomial2, class Polynomial3>
+		void midproduct (Polynomial1 &a, const Polynomial2 &b, const Polynomial3 &c) {
+
 			linbox_check(2*a.size() == c.size()+1 );
 			linbox_check(2*b.size() == c.size()+1 );
 			linbox_check(b[0].coldim() == c[0].rowdim());
@@ -799,25 +1238,24 @@ namespace LinBox {
 			size_t m = b[0].rowdim();
 			size_t k = b[0].coldim();
 			size_t n = c[0].coldim();
-			const Coefficient AZero(m,n), BZero(m,k), CZero(k,n);
+			typedef  typename Polynomial1::value_type Coefficient;
+			const Coefficient ZeroA(m,n), ZeroB(m,k), ZeroC(k,n);
 
 			size_t deg  = c.size()+1;
-			size_t lpts = 0; 
+			size_t lpts = 0;
 			size_t pts =1; while (pts < deg) { pts= pts<<1; ++lpts; }
-			
-			
+
 			if (_p%pts != 1) {
 				std::cout<<"Error the prime is not a FFTPrime or it has too small power of 2\n";
 				throw LinboxError("LinBox ERROR: bad FFT Prime\n");
 			}
-			
+
 			long w ;
-			long accu;
 			// find a pseudo nth primitive root of unity
 			for (;;) {
-						
+
 				// compute the nth primitive root
-				w=  (long) ::powmod(_gen, _pl>>lpts, _p);
+				w=  (long) ::Givaro::powmod(_gen, _pl>>lpts, _p);
 				//std::cout<<w<<" : "<<_gen<<"\n"<<(_pl>>lpts)<<"\n";
 
 				if ((w !=1) && (w != _pl-1))
@@ -833,24 +1271,24 @@ namespace LinBox {
 				long yy,zz,jj;
 				for (;;) {
 					_gen = rand() % _pl; if (_gen <= 0) continue;
-					
-					zz = 1; for (size_t i=0;i<mm;++i) zz = zz*_gen % _pl;
+
+					zz = 1; for (long i=0;i<mm;++i) zz = zz*_gen % _pl;
 					if (zz == 1) continue;
-					
+
 					jj = 0;
 					do {
 						yy = zz;
 						zz = yy*yy % _pl;
 						jj++;
-					} while (jj != kk && zz != 1);				
-					if (jj == kk) 
+					} while (jj != kk && zz != 1);
+					if (jj == kk)
 						break;
 				}
-		 	}
+			}
 
 			long inv_w;
 
-			// compute w^(-1) mod p using extended euclidean algorithm 
+			// compute w^(-1) mod p using extended euclidean algorithm
 			long x_int, y_int, q, tx, ty, temp;
 			x_int = (long) _p;
 			y_int = (long) w;
@@ -861,52 +1299,60 @@ namespace LinBox {
 				x_int = temp;
 				temp = ty; ty = tx - q * ty;
 				tx = temp;
-			}			
-			if (tx < 0) tx += (long) _p;			
+			}
+			if (tx < 0) tx += (long) _p;
 			inv_w = tx;
-	
-			
+
+
 			Element _w, _inv_w;
 			_F.init(_w,w);
-			_F.init(_inv_w, inv_w); 
+			_F.init(_inv_w, inv_w);
 			std::vector<Element> pow_w(pts);
 			std::vector<Element> pow_inv_w(pts);
-			
+
 			// compute power of w and w^(-1)
 			_F.init(pow_w[0],1);
 			_F.init(pow_inv_w[0],1);
 			for (size_t i=1;i<pts;++i){
 				_F.mul(pow_w[i], pow_w[i-1], _w);
-				_F.mul(pow_inv_w[i], pow_inv_w[i-1], _inv_w);				
+				_F.mul(pow_inv_w[i], pow_inv_w[i-1], _inv_w);
 			}
 
 			// compute reverse bit ordering
 			size_t revbit[pts];
-			for (long i = 0, j = 0; i < pts; i++, j = RevInc(j, lpts))
+			for (long i = 0, j = 0; i < static_cast<long>(pts); i++, j = RevInc(j, lpts))
 				revbit[i]=j;
-		
+
 			// set the data
-			std::vector<Coefficient> fft_a(pts, AZero), fft_b(pts, BZero), fft_c(pts,CZero);
-			// reverse b
+			std::vector<Coefficient> fft_a(pts, ZeroA), fft_b(pts, ZeroB), fft_c(pts, ZeroC);
 			for (size_t i=0;i<b.size();++i)
-				fft_b[i]=b[b.size()-i-1];
-						
+				fft_b[i]=b[b.size()-i-1];// reverse b
+			for (size_t i=b.size();i<pts;++i)
+				fft_b[i]=ZeroB;;
 			for (size_t i=0;i<c.size();++i)
 				fft_c[i]=c[i];
-			
+			for (size_t i=c.size();i<pts;++i)
+				fft_c[i]=ZeroC;
 
-			// compute the DFT of b 
-			FFT(fft_b, pts, pow_w);		
-			
-			// compute the DFT^-1 of c
-			FFT(fft_c, pts, pow_inv_w);
+
+			// compute the DFT of b and DFT^-1 of c (parallel if __LINBOX_HAVE_OPENMP)
+			launch_FFT(fft_b, pts, pow_w);
+			launch_FFT(fft_c, pts, pow_inv_w);
 
 			// do the multiplication componentwise
-			for (size_t i=0;i<pts;++i)
+
+#ifdef __LINBOX_HAVE_OPENMP
+			//std::cerr << "midproduct|| th: " << omp_get_max_threads() << ", pts: " << pts << ", n: " << fft_a[0].rowdim() << std::endl;
+#pragma omp parallel for shared(fft_a,fft_b,fft_c) schedule(dynamic)
+#endif
+			for (long i=0;i<static_cast<long>(pts);++i)
 				_BMD.mul(fft_a[i], fft_b[i], fft_c[i]);
-						
+
 			Element swapping;
 			// reorder the term in the FFT according to reverse bit ordering
+			// #ifdef __LINBOX_HAVE_OPENMP
+			// #pragma omp parallel for shared(fft_a,revbit,inv_pts) schedule(runtime)
+			// #endif
 			for (size_t i=0; i< pts; ++i){
 				if (revbit[i]>i){
 					typename Coefficient::RawIterator it_a1=fft_a[i].rawBegin();
@@ -915,33 +1361,192 @@ namespace LinBox {
 						_F.assign(swapping,*it_a1);
 						_F.assign(*it_a1, *it_a2);
 						_F.assign(*it_a2,swapping);
-					}					
+					}
 				}
 			}
-						
-			// compute the DFT of fft_a
-			FFT(fft_a, pts, pow_w);			
-								
+
+			// compute the DFT of fft_a (parallel if __LINBOX_HAVE_OPENMP)
+			launch_FFT(fft_a, pts, pow_w);
+
+
 			// set the result according to bitreverse ordering and multiply by 1/pts
 			Element inv_pts;
 			_F.init(inv_pts, pts);
 			_F.invin(inv_pts);
+			// #ifdef __LINBOX_HAVE_OPENMP
+			// #pragma omp parallel for shared(fft_a,revbit,inv_pts) schedule(static)
+			// #endif
+			for (long i=0; i< static_cast<long>(a.size()); ++i){
+				a[i] = fft_a[revbit[i]];
+				_MD.mulin(a[i], inv_pts);
+			}
+		}
+
+
+		// unbalanced middle product: a[0..n-1] = (b.c)[n..n+m-1]
+		template< class Polynomial1, class Polynomial2, class Polynomial3>
+		void midproductgen (Polynomial1 &a, const Polynomial2 &b, const Polynomial3 &c) {
+
+			linbox_check(a.size()+b.size() == c.size()+1 );
+			linbox_check(b[0].coldim() == c[0].rowdim());
+
+			size_t m = b[0].rowdim();
+			size_t k = b[0].coldim();
+			size_t n = c[0].coldim();
+			typedef  typename Polynomial1::value_type Coefficient;
+			const Coefficient ZeroA(m,n), ZeroB(m,k), ZeroC(k,n);
+
+			size_t deg  = c.size()+1;
+			size_t lpts = 0;
+			size_t pts =1; while (pts < deg) { pts= pts<<1; ++lpts; }
+
+			if (_p%pts != 1) {
+				std::cout<<"Error the prime is not a FFTPrime or it has too small power of 2\n";
+				throw LinboxError("LinBox ERROR: bad FFT Prime\n");
+			}
+
+			long w ;
+			// find a pseudo nth primitive root of unity
+			for (;;) {
 
-			for (size_t i=0; i< a.size(); ++i){
+				// compute the nth primitive root
+				w=  (long) ::Givaro::powmod(_gen, _pl>>lpts, _p);
+				//std::cout<<w<<" : "<<_gen<<"\n"<<(_pl>>lpts)<<"\n";
+
+				if ((w !=1) && (w != _pl-1))
+					break;
+
+				// find a pseudo primitive element of the multiplicative group _p-1
+				long mm = _pl - 1;
+				long kk = 0;srand(time(NULL));
+				while ((mm & 1) == 0) {
+					mm = mm >> 1;
+					kk++;
+				}
+				long yy,zz,jj;
+				for (;;) {
+					_gen = rand() % _pl; if (_gen <= 0) continue;
+
+					zz = 1; for (long i=0;i<mm;++i) zz = zz*_gen % _pl;
+					if (zz == 1) continue;
+
+					jj = 0;
+					do {
+						yy = zz;
+						zz = yy*yy % _pl;
+						jj++;
+					} while (jj != kk && zz != 1);
+					if (jj == kk)
+						break;
+				}
+			}
+
+			long inv_w;
+
+			// compute w^(-1) mod p using extended euclidean algorithm
+			long x_int, y_int, q, tx, ty, temp;
+			x_int = (long) _p;
+			y_int = (long) w;
+			tx = 0; ty = 1;
+			while (y_int != 0) {
+				q = x_int / y_int; // integer quotient
+				temp = y_int; y_int = x_int - q * y_int;
+				x_int = temp;
+				temp = ty; ty = tx - q * ty;
+				tx = temp;
+			}
+			if (tx < 0) tx += (long) _p;
+			inv_w = tx;
+
+
+			Element _w, _inv_w;
+			_F.init(_w,w);
+			_F.init(_inv_w, inv_w);
+			std::vector<Element> pow_w(pts);
+			std::vector<Element> pow_inv_w(pts);
+
+			// compute power of w and w^(-1)
+			_F.init(pow_w[0],1);
+			_F.init(pow_inv_w[0],1);
+			for (size_t i=1;i<pts;++i){
+				_F.mul(pow_w[i], pow_w[i-1], _w);
+				_F.mul(pow_inv_w[i], pow_inv_w[i-1], _inv_w);
+			}
+
+			// compute reverse bit ordering
+			size_t revbit[pts];
+			for (long i = 0, j = 0; i < static_cast<long>(pts); i++, j = RevInc(j, lpts))
+				revbit[i]=j;
+
+			// set the data
+			std::vector<Coefficient> fft_a(pts, ZeroA), fft_b(pts, ZeroB), fft_c(pts, ZeroC);
+			for (size_t i=0;i<b.size();++i)
+				fft_b[i]=b[b.size()-i-1];// reverse b
+			for (size_t i=b.size();i<pts;++i)
+				fft_b[i]=ZeroB;;
+			for (size_t i=0;i<c.size();++i)
+				fft_c[i]=c[i];
+			for (size_t i=c.size();i<pts;++i)
+				fft_c[i]=ZeroC;
+
+
+			// compute the DFT of b and DFT^-1 of c (parallel if __LINBOX_HAVE_OPENMP)
+			launch_FFT(fft_b, pts, pow_w);
+			launch_FFT(fft_c, pts, pow_inv_w);
+
+			// do the multiplication componentwise
+
+#ifdef __LINBOX_HAVE_OPENMP
+			//std::cerr << "midproductgen|| th: " << omp_get_max_threads() << ", pts: " << pts << ", n: " << fft_a[0].rowdim() << std::endl;
+
+#pragma omp parallel for shared(fft_a,fft_b,fft_c) schedule(dynamic)
+#endif
+			for (long i=0;i<pts;++i)
+				_BMD.mul(fft_a[i], fft_b[i], fft_c[i]);
+
+			Element swapping;
+			// reorder the term in the FFT according to reverse bit ordering
+			// #ifdef __LINBOX_HAVE_OPENMP
+			// #pragma omp parallel for shared(fft_a,revbit,inv_pts) schedule(runtime)
+			// #endif
+			for (size_t i=0; i< pts; ++i){
+				if (revbit[i]>i){
+					typename Coefficient::RawIterator it_a1=fft_a[i].rawBegin();
+					typename Coefficient::RawIterator it_a2=fft_a[revbit[i]].rawBegin();
+					for (; it_a1 != fft_a[i].rawEnd(); ++it_a1, ++it_a2){
+						_F.assign(swapping,*it_a1);
+						_F.assign(*it_a1, *it_a2);
+						_F.assign(*it_a2,swapping);
+					}
+				}
+			}
+
+			// compute the DFT of fft_a (parallel if __LINBOX_HAVE_OPENMP)
+			launch_FFT(fft_a, pts, pow_w);
+
+
+			// set the result according to bitreverse ordering and multiply by 1/pts
+			Element inv_pts;
+			_F.init(inv_pts, pts);
+			_F.invin(inv_pts);
+			// #ifdef __LINBOX_HAVE_OPENMP
+			// #pragma omp parallel for shared(fft_a,revbit,inv_pts) schedule(static)
+			// #endif
+			for (long i=0; i< a.size(); ++i){
 				a[i] = fft_a[revbit[i]];
 				_MD.mulin(a[i], inv_pts);
-			}			
+			}
 		}
 
-	protected:
+		//protected:
 
 		inline long RevInc(long a, long k)
 		{
 			long j, m;
-			
-			j = k; 
+
+			j = k;
 			m = 1L << (k-1);
-			
+
 			while (j && (m & a)) {
 				a ^= m;
 				m >>= 1;
@@ -951,11 +1556,11 @@ namespace LinBox {
 			return a;
 		}
 
-
-		void Butterfly (Coefficient &A, Coefficient &B, const Element &alpha) {
-			typename Coefficient::RawIterator it_a= A.rawBegin();
-			typename Coefficient::RawIterator it_b= B.rawBegin();
-			Element tmp;Timer chrono;
+		template<class Coeff>
+		inline void Butterfly (Coeff &A, Coeff &B, const Element &alpha) {
+			typename Coeff::RawIterator it_a= A.rawBegin();
+			typename Coeff::RawIterator it_b= B.rawBegin();
+			Element tmp;
 			for (; it_a != A.rawEnd(); ++it_a, ++it_b){
 				_F.assign(tmp,*it_a);
 				_F.addin(*it_a, *it_b);
@@ -965,7 +1570,7 @@ namespace LinBox {
 		}
 
 
-	       
+		template<class Coefficient>
 		void my(Coefficient &A, const Coefficient &B) {
 			size_t n2 = A.rowdim()*A.coldim();
 			Element       *aptr = A.getPointer();
@@ -975,7 +1580,7 @@ namespace LinBox {
 			}
 		}
 
-			       
+		template<class Coefficient>
 		void myAddSub(Coefficient &A, Coefficient &B) {
 			size_t n2 = A.rowdim()*A.coldim();
 			Element *aptr = A.getPointer();
@@ -988,66 +1593,97 @@ namespace LinBox {
 			}
 		}
 
-		
+
+		template <class Polynomial>
+		void launch_FFT (Polynomial &fft, size_t pts, const std::vector<Element> &pow_w){
+#ifdef __LINBOX_HAVE_OPENMP
+			// do blocking (by row) on the matrix coefficient to perform FFT in parallel on each block 
+			size_t m,n;
+			m=fft[0].rowdim();
+			n=fft[0].coldim();
+			long nump=omp_get_max_threads();
+			long nb_bsize=m%nump;
+			long bsize   =m/nump+(nb_bsize?1:0);
+			long lbsize  =m/nump;
+
+			// std::cerr << "launch_FFT|| th: " << omp_get_max_threads() << ", nump: " << nump << ", n: " << fft.size() << std::endl;
+			// #pragma omp parallel for shared(fft) schedule(dynamic)
+#pragma omp parallel for  schedule(dynamic)
+			for (int i=0;i<nump;i++){
+#ifdef FFT_TIMING
+				Timer chrono1,chrono2;
+				chrono1.start();
+#endif
+				std::vector<DenseSubmatrix<Element> > block(fft.size());
+				int row_idx,row_size;
+				if (i>=nb_bsize) {
+					row_size=lbsize;
+					row_idx = nb_bsize*bsize+  (i-nb_bsize)*lbsize;
+				}
+				else {
+					row_size= bsize;
+					row_idx = i*bsize;
+				}
+
+				for (size_t j=0;j<fft.size();j++)
+					block[j]=DenseSubmatrix<Element>(fft[j],row_idx,0,row_size,n);
+
+#ifdef FFT_TIMING
+				chrono1.stop();
+				chrono2.start();
+#endif
+				FFT(block,pts,pow_w);
+
+#ifdef FFT_TIMING
+				chrono2.stop();
+				std::cout<<"thread["<<omp_get_thread_num()<<"]: "<<chrono2<<"( "<<chrono1<<" )"<<std::endl;
+#endif
+			}
+#else
+			// call directly FFT code
+			FFT(fft,pts,pow_w);
+#endif
+		}
+
+		template <class Polynomial>
 		void FFT (Polynomial &fft, size_t n, const std::vector<Element> &pow_w, size_t idx_w=1, size_t shift=0){
-			
+
 			if (n != 1){
 
 				size_t n2= n>>1;
-				size_t mn= fft[0].rowdim()* fft[0].coldim();
-				Coefficient tmp(fft[0].rowdim(), fft[0].coldim());
-				Timer chrono;
-				
-				
-				chrono.clear();
-				chrono.start();
-				_MD.copy(tmp, fft[shift]);
-				chrono.stop();
-				fftcopy+=chrono.usertime();
-				chrono.clear();
-				chrono.start();
-				_MD.addin(fft[shift],fft[shift+n2]);			
-				_MD.sub(fft[shift+n2], tmp, fft[shift+n2]);
+				//size_t mn= fft[0].rowdim()* fft[0].coldim();
+				//Coefficient tmp(fft[0].rowdim(), fft[0].coldim());
+
+				//_MD.copy(tmp, fft[shift]);
+				//_MD.addin(fft[shift],fft[shift+n2]);
+				//_MD.sub(fft[shift+n2], tmp, fft[shift+n2]);
 				//myAddSub(fft[shift],fft[shift+n2]);
-				chrono.stop();
-				fftadd+=chrono.usertime();
-				
-
-				for (size_t i=1; i< n2; ++i){		
-					//Butterfly(fft[shift+i],fft[shift+i+n2],pow_w[idx_w*i]); 
-					
-					chrono.clear();
-					chrono.start();
-					_MD.copy(tmp, fft[shift+i]);
-					chrono.stop();
-					fftcopy+=chrono.usertime();
-					chrono.clear();
-					chrono.start();
-					_MD.addin(fft[shift+i],fft[shift+i+n2]);					
-					_MD.sub(fft[shift+i+n2], tmp, fft[shift+i+n2]);
+				Element one;_F.init(one,integer(1));
+				Butterfly(fft[shift],fft[shift+n2],one);
+
+				for (size_t i=1; i< n2; ++i){
+					Butterfly(fft[shift+i],fft[shift+i+n2],pow_w[idx_w*i]);
+
+					//_MD.copy(tmp, fft[shift+i]);
+					//_MD.addin(fft[shift+i],fft[shift+i+n2]);
+					//_MD.sub(fft[shift+i+n2], tmp, fft[shift+i+n2]);
 					//myAddSub(fft[shift+i],fft[shift+i+n2]);
-					chrono.stop();
-					fftadd+=chrono.usertime();
-					chrono.clear();
-					chrono.start();					
+
 					//_MD.mulin(fft[shift+i+n2],  pow_w[idx_w*i]);
-					FFLAS::fscal(_F, mn, pow_w[idx_w*i], fft[shift+i+n2].getPointer(), 1);
-					chrono.stop();
-					fftmul+=chrono.usertime();
-					
+					//FFLAS::fscal(_F, mn, pow_w[idx_w*i], fft[shift+i+n2].getPointer(), 1);
 				}
-				
 				FFT(fft, n2, pow_w, idx_w<<1, shift);
-				
-				FFT(fft, n2, pow_w, idx_w<<1, shift+n2);							
+				FFT(fft, n2, pow_w, idx_w<<1, shift+n2);
 			}
 		}
-			
+
 		// fft entries are already in bit reverse order
+		template< class Polynomial>
 		void iterative_FFT (Polynomial &fft, size_t n, size_t ln, const std::vector<Element> &pow_w){
 
+			typedef  typename Polynomial::value_type Coefficient;
 			Coefficient tmp(fft[0].rowdim(), fft[0].coldim());
-			
+
 			if (ln == 0)
 				return;
 			if (ln == 1){
@@ -1063,19 +1699,19 @@ namespace LinBox {
 				_MD.addin(fft[i], fft[i+1]);
 				_MD.sub(fft[i+1], tmp, fft[i+1]);
 			}
-								
+
 			// others levels s = 2..ln-1
 			for (size_t s=2; s< ln; ++s){
 				size_t m  = 1<<s;
 				size_t m2 = 1<<(s-1);
-				size_t m4 = 1<<(s-2);		
+				//size_t m4 = 1<<(s-2);
 
-				size_t w=(ln-s)<<1; 
+				size_t w=(ln-s)<<1;
 
 				for (size_t i=0;i<n; i+=m){
-					
+
 					Coefficient *t, *t1,  *tt, *tt1, *u, *u1, *uu, *uu1;
-					
+
 					t  = &fft[i+m2];
 					u  = &fft[i];
 					t1 = &fft[i+1+m2]; _MD.mulin(*t1, pow_w[w]);
@@ -1086,11 +1722,11 @@ namespace LinBox {
 						uu  = &fft[i+j+2];
 						tt1 = &fft[i+j+3+m2];_MD.mulin(*tt1, pow_w[(j+3)*w]);
 						uu1 = &fft[i+j+3];
-						
+
 						_MD.copy(tmp, *u);
 						_MD.addin(*u, *t);
 						_MD.sub(*t,tmp,*t);
-						
+
 						_MD.copy(tmp,*u1);
 						_MD.addin(*u1, *t1);
 						_MD.sub(*t1,tmp,*t1);
@@ -1104,36 +1740,36 @@ namespace LinBox {
 					_MD.copy(tmp, *u);
 					_MD.addin(*u, *t);
 					_MD.sub(*t,tmp,*t);
-					
+
 					_MD.copy(tmp,*u1);
 					_MD.addin(*u1, *t1);
-					_MD.sub(*t1,tmp,*t1);					
-				}				
+					_MD.sub(*t1,tmp,*t1);
+				}
 			}
 
 
 			// top level s = ln
-			size_t m  = n;
+			//size_t m  = n;
 			size_t m2 = 1<<(ln-1);
-			size_t m4 = 1<<(ln-2);
-				
-			
+			//size_t m4 = 1<<(ln-2);
+
+
 			_MD.copy(tmp, fft[0]);
 			_MD.addin(fft[0], fft[m2]);
 			_MD.sub(fft[m2],tmp,fft[m2]);
-			
+
 			_MD.copy(tmp,fft[1]);
 			_MD.mulin(fft[m2+1], pow_w[1]);
 			_MD.addin(fft[1], fft[m2+1]);
 			_MD.sub(fft[m2+1],tmp,fft[m2+1]);
 
 			for (size_t j=0; j< m2; j+=2){
-				
+
 				_MD.copy(tmp, fft[j]);
 				_MD.mulin(fft[j+m2], pow_w[j>>1]);
 				_MD.addin(fft[j], fft[j+m2]);
 				_MD.sub(fft[j+m2],tmp,fft[j+m2]);
-				
+
 				_MD.copy(tmp,fft[j+1]);
 				_MD.mulin(fft[j+m2+1], pow_w[j>>1]);
 				_MD.addin(fft[j+1], fft[j+m2+1]);
@@ -1146,5 +1782,4 @@ namespace LinBox {
 
 } // end of namespace LinBox
 
-
-#endif
+#endif //__LINBOX_matpoly_mult_H
diff --git a/linbox/algorithms/matrix-hom.h b/linbox/algorithms/matrix-hom.h
index e3345fc..e8a61f2 100644
--- a/linbox/algorithms/matrix-hom.h
+++ b/linbox/algorithms/matrix-hom.h
@@ -1,7 +1,37 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-// Time-stamp: <12 Jul 05 18:26:56 Jean-Guillaume.Dumas at imag.fr> 
-#ifndef __LINBOX_MATRIX_HOM_H__
-#define __LINBOX_MATRIX_HOM_H__
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) 2010 LinBox
+ * Written by JG Dumas
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*! @file algorithms/matrix-hom.h
+ * @ingroup algorithms
+ * @brief Matrix Homomorphism
+ * A map function  converts a matrix on a field/ring
+ * to its natural image in another field/ring.
+ * @sa
+ * \c rebind operator.
+ */
+
+#ifndef __LINBOX_matrix_hom_H
+#define __LINBOX_matrix_hom_H
 
 #include <linbox/blackbox/blas-blackbox.h>
 #include <linbox/blackbox/sparse.h>
@@ -16,29 +46,31 @@
 #include <linbox/matrix/matrix-category.h>
 
 
-namespace LinBox {
+namespace LinBox
+{
 
 	// try to map a blackbox over a homorphic ring
 	// The most suitable type
 	template <class Blackbox, class Field>
-	struct MatrixHomTrait{
+	struct MatrixHomTrait {
 		//typedef ... FBlackbox
 		// donot know
 		typedef Blackbox value_type;
 	};
 
-	/*
+#if 0
 	// Vector<Ring>::Sparse = Vector<Ring>::SparsePar
 	template <class Ring, class Field>
 	struct Convert<SparseMatrix<Ring, typename Vector<Ring>::Sparse>, Field> {
-	typedef SparseMatrix<Field, typename Vector<Field>::Sparse> value_type;
+		typedef SparseMatrix<Field, typename Vector<Field>::Sparse> value_type;
 	};
-	*/
+#endif
 
 	template <class RingElement, class Field>
 	struct MatrixHomTrait<DenseMatrixBase<RingElement>, Field> {
 		typedef DenseMatrixBase<typename Field::Element> value_type;
 	};
+
 	template <class Ring, class Field>
 	struct MatrixHomTrait<SparseMatrix<Ring, typename Vector<Ring>::SparseSeq>, Field> {
 		typedef SparseMatrix<Field, typename Vector<Field>::SparseSeq> value_type;
@@ -65,44 +97,49 @@ namespace LinBox {
 	};
 
 	/// \brief Limited doc so far. Used in RationalSolver.
-	namespace MatrixHom {
-		
+	namespace MatrixHom
+	{
+
 		//public:
-		
+
 		template<class FMatrix, class IMatrix, class Field>
-		void map (FMatrix* & Ap, const IMatrix& A, const Field& F) {
+		void map (FMatrix & Ap, const IMatrix& A, const Field& F)
+		{
 			typename IMatrix::template rebind<Field>()( Ap, A, F);
-                }
-		
-		// construct a dense matrix over finite field, such that *Ap = A mod p, where F = Ring / <p>
+		}
+
+		// construct a dense matrix over finite field, such that Ap = A mod p, where F = Ring / <p>
 		template<class Field, class IMatrix>
-		void map (DenseMatrix<Field>* &Ap, const IMatrix& A, const Field& F);
-		
-		// construct a dense matrix over finite field, such that *Ap = A mod p, where F = Ring / <p>
+		void map (DenseMatrix<Field> &Ap, const IMatrix& A, const Field& F);
+
+		// construct a dense matrix over finite field, such that Ap = A mod p, where F = Ring / <p>
 		template<class Ring, class Field>
-		void map (DenseMatrixBase<typename Field::Element>* &Ap, const DenseMatrixBase<typename Ring::Element>& A, const Field& F){
+		void map (DenseMatrixBase<typename Field::Element> &Ap, const DenseMatrixBase<typename Ring::Element>& A, const Field& F)
+		{
 			typename DenseMatrixBase<typename Ring::Element>::template rebind<Field>()( Ap, A, F);
-                }
-		
-		// construct a sparse matrix over finite field, such that *Ap = A mod p, where F = Ring / <p>
+		}
+
+		// construct a sparse matrix over finite field, such that Ap = A mod p, where F = Ring / <p>
 		template<class Field, class Vect, class IMatrix>
-		void map (SparseMatrix<Field, Vect>* &Ap, const IMatrix& A, const Field &F);
+		void map (SparseMatrix<Field, Vect> &Ap, const IMatrix& A, const Field &F);
 
-		// construct a dense matrix over finite field, such that *Ap = A mod p, where F = Ring / <p>
+		// construct a dense matrix over finite field, such that Ap = A mod p, where F = Ring / <p>
 		template<class Ring, class Field>
-		void map (DenseMatrix<Field>* &Ap, const DenseMatrix<Ring>& A, const Field &F){
+		void map (DenseMatrix<Field> &Ap, const DenseMatrix<Ring>& A, const Field &F)
+		{
 			typename DenseMatrix<Ring>::template rebind<Field>()( Ap, A, F);
-                }
+		}
 
-		// construct a dense matrix over finite field, such that *Ap = A mod p, where F = Ring / <p>
+		// construct a dense matrix over finite field, such that Ap = A mod p, where F = Ring / <p>
 		template<class Ring, class Vect, class Field>
-		void map (DenseMatrix<Field>* &Ap, const SparseMatrix<Ring, Vect>& A, const Field &F);
-		
-		// construct a sparse matrix over finite field, such that *Ap = A mod p, where F = Ring / <p>
+		void map (DenseMatrix<Field> &Ap, const SparseMatrix<Ring, Vect>& A, const Field &F);
+
+		// construct a sparse matrix over finite field, such that Ap = A mod p, where F = Ring / <p>
 		template<class Ring, class Vect1, class Field, class Vect2>
-		void map (SparseMatrix<Field, Vect2>*& Ap, const SparseMatrix<Ring, Vect1>& A, const Field& F) {
+		void map (SparseMatrix<Field, Vect2>& Ap, const SparseMatrix<Ring, Vect1>& A, const Field& F)
+		{
 			typename SparseMatrix<Ring,Vect1>::template rebind<Field,Vect2>()( Ap, A, F);
-                }
+		}
 
 
 
@@ -110,41 +147,46 @@ namespace LinBox {
 		template< class Field, class IMatrix, class Type>
 		class BlasBlackboxMAP {
 		public:
-			void operator() (BlasBlackbox<Field> *&Ap, const IMatrix& A, const Field& F, Type type);	       
+			void operator() (BlasBlackbox<Field> &Ap, const IMatrix& A, const Field& F, Type type);
 		};
-		
-		// construct a BlasBlackbox over finite fiel, such that *Ap - A mod p, where F = Ring / <p>
+
+		// construct a BlasBlackbox over finite fiel, such that Ap - A mod p, where F = Ring / <p>
 
 		template<class Ring, class Field>
-		void map (BlasBlackbox<Field>* &Ap, const BlasBlackbox<Ring>& A, const Field &F){
-                    typename BlasBlackbox<Ring>::template rebind<Field>()( Ap, A, F);
-                }
+		void map (BlasBlackbox<Field> &Ap, const BlasBlackbox<Ring>& A, const Field &F)
+		{
+			typename BlasBlackbox<Ring>::template rebind<Field>()( Ap, A, F);
+		}
 
 
 		template <class Field, class IMatrix>
-		void map (BlasBlackbox<Field> *&Ap, const IMatrix &A, const Field &F) {
+		void map (BlasBlackbox<Field> &Ap, const IMatrix &A, const Field &F)
+		{
 			BlasBlackboxMAP<Field, IMatrix, typename MatrixContainerTrait<IMatrix>::Type> ()(Ap, A, F, typename MatrixContainerTrait<IMatrix>::Type());
-		}	
-	
+		}
+
 		template <class Field, class IPoly, class IMatrix>
-		void map (PolynomialBB< typename IMatrix::template rebind<Field>::other, typename IPoly::template rebind<Field>::other> *&Ap,
-				     const PolynomialBB<IMatrix, IPoly> &A, const Field & F){
+		void map (PolynomialBB< typename IMatrix::template rebind<Field>::other, typename IPoly::template rebind<Field>::other> &Ap,
+			  const PolynomialBB<IMatrix, IPoly> &A, const Field & F)
+		{
 			typename PolynomialBB<IMatrix,IPoly>::template rebind<Field>() (Ap, A, F);
 		}
 
 		template <class Field, class Ring>
-		void map (ScalarMatrix<Field> *&Ap,
-				     const ScalarMatrix<Ring> &A,
-				     const Field & F){
+		void map (ScalarMatrix<Field> &Ap,
+			  const ScalarMatrix<Ring> &A,
+			  const Field & F)
+		{
 			typename ScalarMatrix<Ring>::template rebind<Field>() (Ap, A, F);
 		}
 
-	}		
+	}
 
 	template <class Field, class IMatrix>
-	void MatrixHom::map (DenseMatrix<Field>* &Ap, const IMatrix& A, const Field &F) {
+	void MatrixHom::map (DenseMatrix<Field>&Ap, const IMatrix& A, const Field &F)
+	{
 
-		Ap = new DenseMatrix<Field>(F, A.rowdim(), A.coldim());
+		// 		Ap = new DenseMatrix<Field>(F, A.rowdim(), A.coldim());
 
 		typedef typename IMatrix::Field Ring;
 
@@ -166,11 +208,11 @@ namespace LinBox {
 
 		Hom<Ring, Field> hom(A. field(), F);
 
-		for (col_p = Ap -> colBegin(), e_p = e.begin();
+		for (col_p = Ap.colBegin(), e_p = e.begin();
 		     e_p != e.end(); ++ col_p, ++ e_p) {
-			
+
 			r.assign(*e_p, one);
-			
+
 			A.apply (tmp, e);
 
 			for (tmp_p = tmp.begin(), elt_p = col_p -> begin();
@@ -184,9 +226,10 @@ namespace LinBox {
 
 
 	template <class Field, class Vect, class IMatrix>
-	void MatrixHom::map (SparseMatrix<Field, Vect>* &Ap, const IMatrix& A, const Field &F) {
+	void MatrixHom::map (SparseMatrix<Field, Vect> &Ap, const IMatrix& A, const Field &F)
+	{
 
-		Ap = new SparseMatrix<Field, Vect>(F, A.rowdim(), A.coldim());
+		// 		Ap = new SparseMatrix<Field, Vect>(F, A.rowdim(), A.coldim());
 
 		typedef typename IMatrix::Field Ring;
 
@@ -199,182 +242,209 @@ namespace LinBox {
 		r. init(zero, 0);
 
 		std::vector<typename Ring::Element> e(A.coldim(), zero), tmp(A.rowdim());
-		
+
 		typename std::vector<typename Ring::Element>::iterator iter, e_p;
-		
+
 		typename Field::Element val;
-		
+
 		int i = 0;
 
 		Hom<Ring, Field> hom(A. field(), F);
-		
+
 		for (e_p=e.begin();e_p != e.end(); ++e_p,i++){
 			r.assign(*e_p, one);
 			A.apply(tmp,e);
 			int j;
 			for (iter=tmp.begin(),j=0; iter != tmp.end(); ++iter,j++) {
 				hom. image (val, *iter);
-				if (!F.isZero(val)) 
-					Ap -> setEntry (j,i, val);		
-			
+				if (!F.isZero(val))
+					Ap.setEntry (j,i, val);
+
 			}
 			r.assign(*e_p, zero);
 		}
-		
-	}
 
+	}
 
+	template <class Ring, class Vect, class Field>
+	void MatrixHom::map (DenseMatrix<Field>& Ap, const SparseMatrix<Ring, Vect>& A, const Field &F)
+	{
 
+		// 		Ap = new DenseMatrix<Field>(F, A.rowdim(), A.coldim());
 
-	template <class Ring, class Vect, class Field>
-	void MatrixHom::map (DenseMatrix<Field>*& Ap, const SparseMatrix<Ring, Vect>& A, const Field &F) {
-	
-		Ap = new DenseMatrix<Field>(F, A.rowdim(), A.coldim());
-		
 		typename DenseMatrix<Field>::Element zero; F. init (zero, 0);
 		typename DenseMatrix<Field>::RawIterator raw_p;
-		for (raw_p = Ap -> rawBegin(); raw_p != Ap -> rawEnd(); ++ raw_p)
+		for (raw_p = Ap.rawBegin(); raw_p != Ap.rawEnd(); ++ raw_p)
 			F. assign (*raw_p, zero);
-		
-		typename SparseMatrix<Ring, Vect>::ConstRowIterator row_p;
-	
-		std::vector<size_t>::const_iterator j_p;
-		
-		typename std::vector<typename Ring::Element>::const_iterator e_p;
-		
-		typename Field::Element e;
-		
-		int i = 0;
+
 		Hom<Ring, Field> hom(A. field(), F);
-		
-		for (row_p = A.rowBegin(); row_p != A.rowEnd(); ++ row_p, ++ i)
-			for (j_p = row_p -> first. begin(), e_p = row_p -> second. begin(); 
-			     j_p != row_p -> first. end(); ++ e_p, ++ j_p) {
-				
-				//F.init (e, *e_p);
-				hom. image (e, *e_p);
-				
-				if (!F.isZero(e)) 
-					Ap -> setEntry (i, *j_p, e);		
-				
-			}
-		
-	}	
 
-	namespace MatrixHom {
-		
+		for( typename SparseMatrix<Ring, Vect>::ConstRawIndexedIterator
+		     indices = A.rawIndexedBegin();
+		     (indices != A.rawIndexedEnd()) ;
+		     ++indices ) {
+			typename Field::Element e;
+			hom. image (e, indices.value() );
+			if (!F.isZero(e))
+				Ap.setEntry (indices.rowIndex(),
+					     indices.colIndex(), e);
+		}
+		/*
+		   typename Field::Element e;
+		   typename SparseMatrix<Ring, Vect>::ConstRowIterator row_p;
+		   std::vector<size_t>::const_iterator j_p;
+		   typename std::vector<typename Ring::Element>::const_iterator e_p;
+		   int i = 0;
+
+		   for (row_p = A.rowBegin(); row_p != A.rowEnd(); ++ row_p, ++ i)
+		   for (j_p = row_p -> first. begin(), e_p = row_p -> second. begin();
+		   j_p != row_p -> first. end(); ++ e_p, ++ j_p) {
+
+		//F.init (e, *e_p);
+		hom. image (e, *e_p);
+
+		if (!F.isZero(e))
+		Ap.setEntry (i, *j_p, e);
+
+		}
+		*/
+	}
+
+	namespace MatrixHom
+	{
+
 		template<class Field, class IMatrix>
 		class BlasBlackboxMAP<Field, IMatrix, MatrixContainerCategory::Blackbox> {
 		public:
-			void operator() (BlasBlackbox<Field> *&Ap, const IMatrix &A,  const Field &F, MatrixContainerCategory::Blackbox type) {
+			void operator() (BlasBlackbox<Field> &Ap, const IMatrix &A,  const Field &F, MatrixContainerCategory::Blackbox type)
+			{
 
-				Ap = new BlasBlackbox<Field>(F, A.rowdim(), A.coldim());
+				// 				Ap = new BlasBlackbox<Field>(F, A.rowdim(), A.coldim());
 
 				typedef typename IMatrix::Field Ring;
 				Ring r = A.field();
-			
+
 				typename Ring::Element one, zero;
 				r. init(one, 1);
 				r. init(zero, 0);
-			
+
 				std::vector<typename Ring::Element> e(A.coldim(), zero), tmp(A.rowdim());
-			
+
 				typename BlasBlackbox<Field>::ColIterator col_p;
-			
+
 				typename BlasBlackbox<Field>::Col::iterator elt_p;
-			
+
 				typename std::vector<typename Ring::Element>::iterator e_p, tmp_p;
-			
+
 				Hom<Ring, Field> hom(A. field(), F);
-			
-				for (col_p = Ap -> colBegin(), e_p = e.begin();
+
+				for (col_p = Ap.colBegin(), e_p = e.begin();
 				     e_p != e.end(); ++ col_p, ++ e_p) {
-				
-					r.assign(*e_p, one);			
+
+					r.assign(*e_p, one);
 					A.apply (tmp, e);
-				
+
 					for (tmp_p = tmp.begin(), elt_p = col_p -> begin();
 					     tmp_p != tmp.end(); ++ tmp_p, ++ elt_p)
 						hom.image (*elt_p, *tmp_p);
 					r.assign(*e_p, zero);
-				}		
+				}
 			}
 		};
-	
+
 
 		template<class Field, class IMatrix>
 		class BlasBlackboxMAP<Field, IMatrix, MatrixContainerCategory::Container> {
 		public:
-			void operator() (BlasBlackbox<Field> *&Ap, const IMatrix &A, const Field &F, MatrixContainerCategory::Container type) {
-				Ap = new BlasBlackbox<Field>(F, A.rowdim(), A.coldim());
+			void operator() (BlasBlackbox<Field> &Ap, const IMatrix &A, const Field &F, MatrixContainerCategory::Container type)
+			{
+				// 				Ap = new BlasBlackbox<Field>(F, A.rowdim(), A.coldim());
 				Hom<typename IMatrix::Field , Field> hom(A.field(), F);
 				typename Field::Element e, zero;
 				F.init(zero,0UL);
 				for( typename IMatrix::ConstRawIndexedIterator indices = A.rawIndexedBegin();
-				     (indices != A.rawIndexedEnd()) ; 
+				     (indices != A.rawIndexedEnd()) ;
 				     ++indices ) {
-				
+
 					hom. image (e, A.getEntry(indices.rowIndex(),indices.colIndex()) );
-				
-					if (!F.isZero(e)) 
-						Ap -> setEntry (indices.rowIndex(), 
-								indices.colIndex(), e);
-					else 
-						Ap -> setEntry (indices.rowIndex(), 
-								indices.colIndex(), zero);
+
+					if (!F.isZero(e))
+						Ap.setEntry (indices.rowIndex(),
+							     indices.colIndex(), e);
+					else
+						Ap.setEntry (indices.rowIndex(),
+							     indices.colIndex(), zero);
 				}
 
 			}
 		};
 
-
 		template<class Field, class IMatrix>
 		class BlasBlackboxMAP<Field, IMatrix, MatrixContainerCategory::BlasContainer> {
 		public:
-			void operator() (BlasBlackbox<Field> *&Ap, const IMatrix &A, const Field &F, MatrixContainerCategory::BlasContainer type) {			
-				Ap = new BlasBlackbox<Field>(F, A.rowdim(), A.coldim());
+			void operator() (BlasBlackbox<Field> &Ap, const IMatrix &A, const Field &F, MatrixContainerCategory::BlasContainer type)
+			{
+				//Ap = new BlasBlackbox<Field>(F, A.rowdim(), A.coldim());
 				Hom<typename IMatrix::Field , Field> hom(A.field(), F);
-			
+
 				typename IMatrix::ConstRawIterator        iterA  = A.rawBegin();
-				typename BlasBlackbox<Field>::RawIterator iterAp = Ap->rawBegin();
-			
+				typename BlasBlackbox<Field>::RawIterator iterAp = Ap.rawBegin();
+
 				for(; iterA != A.rawEnd(); iterA++, iterAp++)
 					hom. image (*iterAp, *iterA);
-			}					
+			}
 		};
 
+		template<class Field>
+		class BlasBlackboxMAP<Field, BlasMatrix<integer>, MatrixContainerCategory::BlasContainer> {
+		public:
+			void operator() (BlasBlackbox<Field> &Ap, const BlasMatrix<integer> &A, const Field &F, MatrixContainerCategory::BlasContainer type)
+			{
+				//Ap = new BlasBlackbox<Field>(F, A.rowdim(), A.coldim());
+				PID_integer ZZ ;
+				Hom<PID_integer , Field> hom(ZZ, F);
+
+				typename BlasMatrix<integer>::ConstRawIterator        iterA  = A.rawBegin();
+				typename BlasBlackbox<Field>::RawIterator iterAp = Ap.rawBegin();
+
+				for(; iterA != A.rawEnd(); iterA++, iterAp++)
+					hom. image (*iterAp, *iterA);
+			}
+		};
 
-		
 		template< class IMatrix>
 		class BlasBlackboxMAP<MultiModDouble, IMatrix, MatrixContainerCategory::BlasContainer > {
 		public:
-			void operator() (BlasBlackbox<MultiModDouble> *&Ap, const IMatrix &A, const MultiModDouble &F,  MatrixContainerCategory::BlasContainer type) {
-				Ap = new BlasBlackbox<MultiModDouble>(F, A.rowdim(), A.coldim());
+			void operator() (BlasBlackbox<MultiModDouble> &Ap, const IMatrix &A, const MultiModDouble &F,  MatrixContainerCategory::BlasContainer type)
+			{
+				//Ap = new BlasBlackbox<MultiModDouble>(F, A.rowdim(), A.coldim());
 				for (size_t i=0; i<F.size();++i)
-					MatrixHom::map(Ap->getMatrix(i), A, F.getBase(i));
-			}					
+					MatrixHom::map(Ap.getMatrix(i), A, F.getBase(i));
+			}
 		};
-		
+
 		template< class IMatrix>
 		class BlasBlackboxMAP<MultiModDouble, IMatrix, MatrixContainerCategory::Container > {
 		public:
-			void operator() (BlasBlackbox<MultiModDouble> *&Ap, const IMatrix &A, const MultiModDouble &F,  MatrixContainerCategory::Container type) {
-				Ap = new BlasBlackbox<MultiModDouble>(F, A.rowdim(), A.coldim());
+			void operator() (BlasBlackbox<MultiModDouble> &Ap, const IMatrix &A, const MultiModDouble &F,  MatrixContainerCategory::Container type)
+			{
+				// 				Ap = new BlasBlackbox<MultiModDouble>(F, A.rowdim(), A.coldim());
 				for (size_t i=0; i<F.size();++i)
-					MatrixHom::map(Ap->getMatrix(i), A, F.getBase(i));
-			}					
+					MatrixHom::map(Ap.getMatrix(i), A, F.getBase(i));
+			}
 		};
-		
+
 		template< class IMatrix>
 		class BlasBlackboxMAP<MultiModDouble, IMatrix, MatrixContainerCategory::Blackbox > {
 		public:
-			void operator() (BlasBlackbox<MultiModDouble> *&Ap, const IMatrix &A, const MultiModDouble &F,  MatrixContainerCategory::Blackbox type) {
-				Ap = new BlasBlackbox<MultiModDouble>(F, A.rowdim(), A.coldim());
+			void operator() (BlasBlackbox<MultiModDouble> &Ap, const IMatrix &A, const MultiModDouble &F,  MatrixContainerCategory::Blackbox type)
+			{
+				// 				Ap = new BlasBlackbox<MultiModDouble>(F, A.rowdim(), A.coldim());
 				for (size_t i=0; i<F.size();++i)
-					MatrixHom::map(Ap->getMatrix(i), A, F.getBase(i));
-			}					
+					MatrixHom::map(Ap.getMatrix(i), A, F.getBase(i));
+			}
 		};
 	}
 }
 
-#endif
+#endif //__LINBOX_matrix_hom_H
diff --git a/linbox/algorithms/matrix-inverse.h b/linbox/algorithms/matrix-inverse.h
old mode 100755
new mode 100644
index 00d7fe7..70c3969
--- a/linbox/algorithms/matrix-inverse.h
+++ b/linbox/algorithms/matrix-inverse.h
@@ -1,41 +1,56 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* File: matrix-inverse.h
- *  Author: Zhendong Wan
- * draft date: 09-27-2003
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) 2003 LinBox
+ * Written by Zhendong Wan
  *
  * modified by Pascal Giorgi 1/07/04
- * put the Field as template parameter 
+ * put the Field as template parameter
  * and add Field F as a parameter
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
 
 
-#ifndef __LINBOX__MATRIX_INVERSE_H__
-#define __LINBOX__MATRIX_INVERSE_H__
+#ifndef __LINBOX_matrix_inverse_H
+#define __LINBOX_matrix_inverse_H
 
 #include <linbox/util/debug.h>
 #include <linbox/util/error.h>
 #include <vector>
 #include <algorithm>
 
-namespace LinBox 
-{    
+namespace LinBox
+{
 	class MatrixInverse {
-	
+
 	public:
 
 		/** \brief compute the inverse of a dense matrix, by Gaussian elimination.
 		 *  The matrix should support ColIterator and RowIterator.
-		 *  It returns 0, if an inverse is found, and  
+		 *  It returns 0, if an inverse is found, and
 		 *  returns 1, otherwise.
 		 */
 		template<class Field, class DenseMatrix>
-		static  long matrixInverseIn(const Field& F, DenseMatrix& A) {
-		    
+		static  long matrixInverseIn(const Field& F, DenseMatrix& A)
+		{
+
 			// check if A is a square matrix
 			linbox_check(A.rowdim() == A. coldim());
-	
-			// PG 1/07/04 
+
+			// PG 1/07/04
 			//typedef typename DenseMatrix::Field Field;
 
 			// step1 PLU Inplcae, actually, LPA = U.
@@ -46,21 +61,21 @@ namespace LinBox
 			typename DenseMatrix::ColIterator cur_c, tmp_c;
 			typename DenseMatrix::Row::iterator cur_rp, tmp_rp;
 			typename DenseMatrix::Col::iterator cur_cp, tmp_cp;
-	
+
 			std::vector<typename Field::Element> tmp_v (A.rowdim());
 
 			typename Field::Element tmp_e;
-			
+
 			// PG 1/07/04
 			//const Field F = A. field();
-       
+
 			int offset = 0;
 
-			cur_r = A. rowBegin(); 
+			cur_r = A. rowBegin();
 			cur_c = A. colBegin();
-			for( ; cur_r != A. rowEnd(); ++ cur_r, ++ cur_c, ++ offset) { 
-			//for(cur_r = A. rowBegin(), cur_c = A. colBegin(); cur_r != A. rowEnd(); ++ cur_r, ++ cur_c, ++ offset) {
-	    
+			for( ; cur_r != A. rowEnd(); ++ cur_r, ++ cur_c, ++ offset) {
+				//for(cur_r = A. rowBegin(), cur_c = A. colBegin(); cur_r != A. rowEnd(); ++ cur_r, ++ cur_c, ++ offset)
+
 				//try to find the pivot.
 				tmp_r = cur_r;
 
@@ -74,7 +89,7 @@ namespace LinBox
 				if (tmp_cp == cur_c -> end()) return 1;
 
 				//if swicth two row if nessary. Each row in dense matrix is stored in contiguous space
-				if (tmp_r != cur_r) { 
+				if (tmp_r != cur_r) {
 					P.push_back(std::pair<int,int>(offset, (int)(tmp_cp - cur_c -> begin()) ) );
 
 					std::copy (tmp_r -> begin(), tmp_r -> end(), tmp_v.begin());
@@ -85,17 +100,17 @@ namespace LinBox
 				}
 
 				// continue gauss elimination
-	 
-				for(tmp_r = cur_r + 1; tmp_r != A.rowEnd(); ++ tmp_r) {	   
-		
+
+				for(tmp_r = cur_r + 1; tmp_r != A.rowEnd(); ++ tmp_r) {
+
 					//see if need to update the row
 					if (!F.isZero(*(tmp_r -> begin() + offset ))) {
-		    
+
 						F.div (tmp_e, *(tmp_r -> begin() + offset), *(cur_r -> begin() + offset));
 
-						F.negin(tmp_e);		    
-				
-						for ( cur_rp = cur_r ->begin(),tmp_rp =  tmp_r -> begin(); 
+						F.negin(tmp_e);
+
+						for ( cur_rp = cur_r ->begin(),tmp_rp =  tmp_r -> begin();
 						      tmp_rp != tmp_r -> end(); ++ tmp_rp, ++ cur_rp )
 
 							F.axpyin ( *tmp_rp, *cur_rp, tmp_e);
@@ -103,23 +118,23 @@ namespace LinBox
 						F.assign(*(tmp_r -> begin() + offset), tmp_e);
 					}
 				}
-	    
+
 			}
-	
+
 
 			//second compute inverse of A.
 			DenseMatrix tmp(A);
 
-	
+
 			//2a compute inverse of PA, by solving upper-triangeular system, PA = U^{-1} L.
 			typename Field::Element Zero;
 			typename Field::Element N_one;
 			F.init(Zero,0);
 			F.init(N_one, -1);
-	
+
 			offset = 0;
 			for(cur_c = A.colBegin();cur_c != A. colEnd(); ++ cur_c, ++ offset) {
-	    
+
 				for (cur_cp = cur_c -> begin();
 				     cur_cp != cur_c -> begin() + offset; ++ cur_cp)
 					F.assign (*cur_cp, Zero);
@@ -129,34 +144,34 @@ namespace LinBox
 				for (; cur_cp != cur_c -> end(); ++ cur_cp)
 					F.negin(*cur_cp);
 
-				//matrix is indexed by 0, instead of 1.	
+				//matrix is indexed by 0, instead of 1.
 
 				for (cur_cp = cur_c -> begin() + (A.rowdim() - 1), tmp_r = tmp.rowBegin() + ( A.rowdim() - 1);
 				     cur_cp != cur_c -> begin() - 1; -- cur_cp, -- tmp_r) {
-		
+
 					F.assign (tmp_e, *cur_cp);
-		
+
 					for(tmp_cp = cur_c -> begin() + (A.rowdim() - 1), tmp_rp = tmp_r -> begin() + ( A.rowdim() -1);
-					    tmp_cp != cur_cp; -- tmp_cp, -- tmp_rp) 
+					    tmp_cp != cur_cp; -- tmp_cp, -- tmp_rp)
 						F.axpyin(tmp_e, *tmp_cp, *tmp_rp);
-		
-					F. div(*cur_cp, tmp_e, *tmp_rp);		
+
+					F. div(*cur_cp, tmp_e, *tmp_rp);
 
 					F.negin(*cur_cp);
 
 				}
-	    
+
 			}
-	
 
-	
+
+
 			// 2b, compute inverse of A, A^{-1} = (PA)^{-1} P
 			std::vector<std::pair<int, int> >::reverse_iterator v_p;
 
 			for(v_p = P.rbegin(); v_p != P.rend(); ++ v_p) {
 
 				cur_c = A.colBegin() + v_p -> first;
-	    
+
 				tmp_c = A.colBegin() + v_p -> second;
 
 				std::copy (cur_c -> begin(), cur_c -> end(), tmp_v.begin());
@@ -166,8 +181,8 @@ namespace LinBox
 				std::copy (tmp_v.begin(), tmp_v.end(), tmp_c -> begin());
 
 			}
-         
-	
+
+
 			return 0;
 		}
 	};
@@ -181,4 +196,4 @@ namespace LinBox
 } // namespace LinBox
 
 
-#endif
+#endif //__LINBOX_matrix_inverse_H
diff --git a/linbox/algorithms/matrix-rank.h b/linbox/algorithms/matrix-rank.h
old mode 100755
new mode 100644
index c313c07..8069756
--- a/linbox/algorithms/matrix-rank.h
+++ b/linbox/algorithms/matrix-rank.h
@@ -1,12 +1,28 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* File: matrix-rank.h
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) 2003 LinBox
  *  Author: Zhendong Wan
- * draft date: 09-27-2003
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX__MATRIX_RANK_H__
-#define __LINBOX__MATRIX_RANK_H__
+#ifndef __LINBOX_matrix_rank_H
+#define __LINBOX_matrix_rank_H
 
 #include <linbox/util/debug.h>
 #include <linbox/blackbox/dense.h>
@@ -18,11 +34,11 @@
 #include <algorithm>
 #include <linbox/randiter/random-prime.h>
 
-namespace LinBox 
-{    
+namespace LinBox
+{
 
 	/** Compute the rank of an integer matrix in place over a finite field by Gaussian elimination.
-	 */
+	*/
 	template<class _Ring, class _Field, class _RandomPrime = RandomPrimeIterator>
 	class MatrixRank {
 
@@ -35,44 +51,45 @@ namespace LinBox
 
 		mutable _RandomPrime rp;
 
-		MatrixRank(const Ring& _r = Ring(), const _RandomPrime& _rp = _RandomPrime() ) : r(_r), rp (_rp) {}
+		MatrixRank(const Ring& _r = Ring(), const _RandomPrime& _rp = _RandomPrime() ) :
+			r(_r), rp (_rp)
+		{}
 
 		~MatrixRank() {}
 
 		//compute the integer matrix A by modulo a random prime, Monto-Carlo
 		template<class IMatrix>
-		long rank(const IMatrix& A) const {
+		long rank(const IMatrix& A) const
+		{
 
 			Field F (*rp);
 
-			DenseMatrix<Field>* Ap;
+			DenseMatrix<Field> Ap(F, A.rowdim(), A.coldim());
 
 			MatrixHom::map(Ap, A, F);
 
 			long result;
 
-			result = rankIn(*Ap);
-
-			delete Ap;
+			result = rankIn(Ap);
 
 			return result;
 		}
 
 		template <class Row>
-		long rank(const SparseMatrix<Ring, Row>& A) const {
+		long rank(const SparseMatrix<Ring, Row>& A) const
+		{
 
 			Field F (*rp);
-			typename MatrixHomTrait<SparseMatrix<Ring, Row>, Field>::value_type* Ap;
-			MatrixHom::map (Ap, A, F);
+			typename SparseMatrix<Ring, Row>::template rebind<Field>::other Ap(A, F);
 			long result;
-			result = rankIn (*Ap);
-			delete Ap;
+			result = rankIn (Ap);
 			return result;
 		}
 
 
 		template<class Field, class Row>
-		long rankIn(SparseMatrix<Field, Row>& A) const {
+		long rankIn(SparseMatrix<Field, Row>& A) const
+		{
 
 			unsigned long result;
 
@@ -82,7 +99,8 @@ namespace LinBox
 		}
 
 		// compute rank by Gauss Elimination
-		long rankIn(DenseMatrix<Field>& Ap) const {
+		long rankIn(DenseMatrix<Field>& Ap) const
+		{
 
 			typedef typename Field::Element Element;
 
@@ -123,7 +141,7 @@ namespace LinBox
 				}
 
 				//if swicth two row if nessary. Each row in dense matrix is stored in contiguous space
-				if (tmp_r != cur_r) { 
+				if (tmp_r != cur_r) {
 
 					std::copy (tmp_r -> begin(), tmp_r -> end(), tmp_v.begin());
 
@@ -132,17 +150,17 @@ namespace LinBox
 					std::copy (tmp_v.begin(), tmp_v.end(), cur_r -> begin());
 				}
 
-				// continue gauss elimination	 
-				for(tmp_r = cur_r + 1; tmp_r != Ap.rowEnd(); ++ tmp_r) {	   
+				// continue gauss elimination
+				for(tmp_r = cur_r + 1; tmp_r != Ap.rowEnd(); ++ tmp_r) {
 
 					//see if need to update the row
 					if (!F.isZero(*(tmp_r -> begin() + offset_r ))) {
 
 						F.div (tmp_e, *(tmp_r -> begin() + offset_r), *(cur_r -> begin() + offset_r));
 
-						F.negin(tmp_e);		    
+						F.negin(tmp_e);
 
-						for ( cur_rp = cur_r ->begin() + offset_r,tmp_rp =  tmp_r -> begin() + offset_r; 
+						for ( cur_rp = cur_r ->begin() + offset_r,tmp_rp =  tmp_r -> begin() + offset_r;
 						      tmp_rp != tmp_r -> end(); ++ tmp_rp, ++ cur_rp )
 
 							F.axpyin ( *tmp_rp, *cur_rp, tmp_e);
@@ -166,4 +184,4 @@ namespace LinBox
 } // end namespace LinBox
 
 
-#endif
+#endif //__LINBOX_matrix_rank_H
diff --git a/linbox/algorithms/mg-block-lanczos.h b/linbox/algorithms/mg-block-lanczos.h
index 8bb37c3..b75b094 100644
--- a/linbox/algorithms/mg-block-lanczos.h
+++ b/linbox/algorithms/mg-block-lanczos.h
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* linbox/algorithms/mg-block-lanczos.h
  * Copyright (C) 2002 Bradford Hovinen
@@ -13,8 +14,8 @@
  * Class definitions for block Lanczos iteration
  */
 
-#ifndef __MG_BLOCK_LANCZOS_H
-#define __MG_BLOCK_LANCZOS_H
+#ifndef __LINBOX_mg_block_lanczos_H
+#define __LINBOX_mg_block_lanczos_H
 
 #include "linbox/linbox-config.h"
 #undef _T
@@ -36,246 +37,245 @@
 #undef _M
 #undef _N
 
-namespace LinBox 
+namespace LinBox
 {
 
-/** \brief Block Lanczos iteration
- *
- * This is a blocked version of the iteration given in @ref{LanczosSolver}. The
- * essential difference is that, rather than applying the black box $A$ to a
- * single vector $v$ during each iteration, the block box $A$ is applied to an
- * $n\times N$ matrix $V$ or, equivalently, to $N$ vectors
- * $v_1, \ldots, v_N$ Scalars in the original iteration become $N\times N$
- * matrices in the blocked version. The resulting iteration is a natural
- * extension of the basic theory of the original Lanczos iteration,
- * c.f. (Montgomery 1995). This has the advantage of more flexible
- * parallelization, and does not break down as often when used over small
- * fields.
- *
- * Currently, only dense vectors are supported for this iteration, and it is
- * unlikely any other vector archetypes will be supported in the future.
- */
-template <class Field, class Matrix = DenseMatrixBase<typename Field::Element> >
-class MGBlockLanczosSolver
-{
-    public:
-
-	typedef typename Field::Element Element;
-
-	/** Constructor
-	 * @param F Field over which to operate
-	 * @param traits @ref{SolverTraits} structure describing user
-	 *               options for the solver 
-	 */
-	MGBlockLanczosSolver (const Field &F, const BlockLanczosTraits &traits)
-		: _traits (traits), _F (F), _VD (F), _MD (F), _randiter (F), _N (traits.blockingFactor ())
-	{
-		init_temps ();
-		_F.init (_one, 1);
-	}
-
-	/** Constructor with a random iterator
-	 * @param F Field over which to operate
-	 * @param traits @ref{SolverTraits} structure describing user
-	 *               options for the solver 
-	 * @param r Random iterator to use for randomization
-	 */
-	MGBlockLanczosSolver (const Field &F, const BlockLanczosTraits &traits, typename Field::RandIter r)
-		: _traits (traits), _F (F), _VD (F), _MD (F), _randiter (r), _N (traits.blockingFactor ())
-	{
-		init_temps ();
-		_F.init (_one, 1);
-	}
-
-	/** Solve the linear system Ax = b.
-	 *
-	 * If the system is nonsingular, this method computes the unique
-	 * solution to the system Ax = b. If the system is singular, it computes
-	 * a random solution.
+	/** \brief Block Lanczos iteration
 	 *
-	 * If the matrix A is nonsymmetric, this method preconditions the matrix
-	 * A with the preconditioner D_1 A^T D_2 A D_1, where D_1 and D_2 are
-	 * random nonsingular diagonal matrices. If the matrix A is symmetric,
-	 * this method preconditions the system with A D, where D is a random
-	 * diagonal matrix.
-	 *
-	 * @param A Black box for the matrix A
-	 * @param x Vector in which to store solution
-	 * @param b Right-hand side of system
-	 * @return true on success and false on failure
-	 */
-	template <class Blackbox, class Vector>
-	bool solve (const Blackbox &A, Vector &x, const Vector &b);
-
-	/** Sample uniformly from the (right) nullspace of A
+	 * This is a blocked version of the iteration given in @ref LanczosSolver. The
+	 * essential difference is that, rather than applying the black box $A$ to a
+	 * single vector \f$v\f$ during each iteration, the block box \f$A\f$ is applied to an
+	 * \f$n\times N\f$ matrix \f$V\f$ or, equivalently, to $N$ vectors
+	 * \f$v_1, \ldots, v_N\f$ Scalars in the original iteration become \f$N\times N\f$
+	 * matrices in the blocked version. The resulting iteration is a natural
+	 * extension of the basic theory of the original Lanczos iteration,
+	 * c.f. (Montgomery 1995). This has the advantage of more flexible
+	 * parallelization, and does not break down as often when used over small
+	 * fields.
 	 *
-	 * @param A Black box for the matrix A
-	 * @param x Matrix into whose columns to store nullspace elements
-	 * @return Number of nullspace vectors found
+	 * Currently, only dense vectors are supported for this iteration, and it is
+	 * unlikely any other vector archetypes will be supported in the future.
 	 */
-	template <class Blackbox, class Matrix1>
-	unsigned int sampleNullspace (const Blackbox &A, Matrix1 &x);
-
-    private:
-
-	// S_i is represented here as a vector of booleans, where the entry at
-	// index j is true if and only if the corresponding column of V_i is to
-	// be included in W_i
-
-	// All references to Winv are actually -Winv
-
-	// Run the block Lanczos iteration and return the result. Return false
-	// if the method breaks down. Do not check that Ax = b in the end
-	template <class Blackbox>
-	bool iterate (const Blackbox &A);
-
-	// Compute W_i^inv and S_i given V_i^T A V_i
-	int compute_Winv_S (Matrix            &Winv,
-			    std::vector<bool> &S,
-			    const Matrix      &T);
-
-	// Given B with N columns and S_i, compute B S_i S_i^T
-	template <class Matrix1, class Matrix2>
-	Matrix1 &mul_SST (Matrix1                 &BSST,
-			  const Matrix2           &B,
-			  const std::vector<bool> &S) const;
-
-	// Matrix-matrix multiply
-	// C = A * B * S_i * S_i^T
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1 &mul (Matrix1                 &C,
-		      const Matrix2           &A,
-		      const Matrix3           &B,
-		      const std::vector<bool> &S) const;
-
-	// In-place matrix-matrix multiply on the right
-	// A = A * B * S_i * S_i^T
-	// This is a version of the above optimized to use as little additional
-	// memory as possible
-	template <class Matrix1, class Matrix2>
-	Matrix1 &mulin (Matrix1                 &A,
-			const Matrix2           &B,
-			const std::vector<bool> &S) const;
-
-	// Matrix-vector multiply
-	// w = A * S_i * S_i^T * v
-	template <class Vector1, class Matrix1, class Vector2>
-	Vector1 &vectorMul (Vector1                 &w,
-			    const Matrix1           &A,
-			    const Vector2           &v,
-			    const std::vector<bool> &S) const;
-
-	// Matrix-vector transpose multiply
-	// w = (A * S_i * S_i^T)^T * v
-	template <class Vector1, class Matrix1, class Vector2>
-	Vector1 &vectorMulTranspose (Vector1                 &w,
-				     const Matrix1           &A,
-				     const Vector2           &v,
-				     const std::vector<bool> &S) const;
-
-	// Matrix-matrix addition
-	// A = A + B * S_i * S_i^T
-	template <class Matrix1, class Matrix2>
-	Matrix1 &addin (Matrix1                 &A,
-			const Matrix2           &B,
-			const std::vector<bool> &S) const;
-
-	// Add I_N to the given N x N matrix
-	// A = A + I_N
-	template <class Matrix1>
-	Matrix1 &addIN (Matrix1 &A) const;
-
-	// Given a vector S of bools, write an array of array indices in which
-	// the true values of S are last
-	void permute (std::vector<size_t>     &indices,
-		      const std::vector<bool> &S) const;
-
-	// Set the given matrix to the identity
-	template <class Matrix1>
-	Matrix1 &setIN (Matrix1 &A) const;
-
-	// Find a suitable pivot row for a column and exchange it with the given
-	// row
-	bool find_pivot_row (Matrix                    &A,
-			     size_t                     row,
-			     int                        col_offset,
-			     const std::vector<size_t> &indices);
-
-	// Eliminate all entries in a column except the pivot row, using row
-	// operations from the pivot row
-	void eliminate_col (Matrix                    &A,
-			    size_t                     pivot,
-			    int                        col_offset,
-			    const std::vector<size_t> &indices,
-			    const Element             &Ajj_inv);
-
-	// Initialize the temporaries used in computation
-	void init_temps ();
-
-	// Private variables
-
-	const BlockLanczosTraits _traits;
-	const Field              &_F;
-	VectorDomain<Field>       _VD;
-	MatrixDomain<Field>       _MD;
-	typename Field::RandIter  _randiter;
-
-	// Temporaries used in the computation
-
-	Matrix  _V[3];             // n x N
-	Matrix  _AV;               // n x N
-	Matrix  _VTAV;             // N x N
-	Matrix  _Winv[2];          // N x N
-	Matrix  _AVTAVSST_VTAV;    // N x N
-	Matrix  _T;                // N x N
-	Matrix  _DEF;              // N x N
-	std::vector<bool>         _S;                // N-vector of bools
-
-	Matrix _x;                 // n x <=N
-	Matrix _y;                 // n x <=N
-	Matrix _b;                 // n x <=N
-
-	mutable Matrix _tmp;       // N x <=N
-	mutable Matrix _tmp1;      // N x <=N
-
-	typename Field::Element   _one;
-
-	std::vector<size_t>       _indices;          // N
-
-	mutable Matrix _M;         // N x 2N
-
-	// Blocking factor
-
-	size_t                    _N;
-
-	// Construct a transpose matrix on the fly
-	template <class Matrix1>
-	TransposeMatrix<Matrix1> transpose (Matrix1 &M) const
+	template <class Field, class Matrix = DenseMatrixBase<typename Field::Element> >
+	class MGBlockLanczosSolver {
+	public:
+
+		typedef typename Field::Element Element;
+
+		/** Constructor
+		 * @param F Field over which to operate
+		 * @param traits @ref SolverTraits  structure describing user
+		 *               options for the solver
+		 */
+		MGBlockLanczosSolver (const Field &F, const BlockLanczosTraits &traits) :
+			_traits (traits), _F (F), _VD (F), _MD (F), _randiter (F), _N (traits.blockingFactor ())
+		{
+			init_temps ();
+			_F.init (_one, 1);
+		}
+
+		/** Constructor with a random iterator
+		 * @param F Field over which to operate
+		 * @param traits @ref SolverTraits  structure describing user
+		 *               options for the solver
+		 * @param r Random iterator to use for randomization
+		 */
+		MGBlockLanczosSolver (const Field &F, const BlockLanczosTraits &traits, typename Field::RandIter r) :
+			_traits (traits), _F (F), _VD (F), _MD (F), _randiter (r), _N (traits.blockingFactor ())
+		{
+			init_temps ();
+			_F.init (_one, 1);
+		}
+
+		/** Solve the linear system Ax = b.
+		 *
+		 * If the system is nonsingular, this method computes the unique
+		 * solution to the system Ax = b. If the system is singular, it computes
+		 * a random solution.
+		 *
+		 * If the matrix A is nonsymmetric, this method preconditions the matrix
+		 * A with the preconditioner D_1 A^T D_2 A D_1, where D_1 and D_2 are
+		 * random nonsingular diagonal matrices. If the matrix A is symmetric,
+		 * this method preconditions the system with A D, where D is a random
+		 * diagonal matrix.
+		 *
+		 * @param A Black box for the matrix A
+		 * @param x Vector in which to store solution
+		 * @param b Right-hand side of system
+		 * @return true on success and false on failure
+		 */
+		template <class Blackbox, class Vector>
+		bool solve (const Blackbox &A, Vector &x, const Vector &b);
+
+		/** Sample uniformly from the (right) nullspace of A
+		 *
+		 * @param A Black box for the matrix A
+		 * @param x Matrix into whose columns to store nullspace elements
+		 * @return Number of nullspace vectors found
+		 */
+		template <class Blackbox, class Matrix1>
+		unsigned int sampleNullspace (const Blackbox &A, Matrix1 &x);
+
+	private:
+
+		// S_i is represented here as a vector of booleans, where the entry at
+		// index j is true if and only if the corresponding column of V_i is to
+		// be included in W_i
+
+		// All references to Winv are actually -Winv
+
+		// Run the block Lanczos iteration and return the result. Return false
+		// if the method breaks down. Do not check that Ax = b in the end
+		template <class Blackbox>
+		bool iterate (const Blackbox &A);
+
+		// Compute W_i^inv and S_i given V_i^T A V_i
+		int compute_Winv_S (Matrix            &Winv,
+				    std::vector<bool> &S,
+				    const Matrix      &T);
+
+		// Given B with N columns and S_i, compute B S_i S_i^T
+		template <class Matrix1, class Matrix2>
+		Matrix1 &mul_SST (Matrix1                 &BSST,
+				  const Matrix2           &B,
+				  const std::vector<bool> &S) const;
+
+		// Matrix-matrix multiply
+		// C = A * B * S_i * S_i^T
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1 &mul (Matrix1                 &C,
+			      const Matrix2           &A,
+			      const Matrix3           &B,
+			      const std::vector<bool> &S) const;
+
+		// In-place matrix-matrix multiply on the right
+		// A = A * B * S_i * S_i^T
+		// This is a version of the above optimized to use as little additional
+		// memory as possible
+		template <class Matrix1, class Matrix2>
+		Matrix1 &mulin (Matrix1                 &A,
+				const Matrix2           &B,
+				const std::vector<bool> &S) const;
+
+		// Matrix-vector multiply
+		// w = A * S_i * S_i^T * v
+		template <class Vector1, class Matrix1, class Vector2>
+		Vector1 &vectorMul (Vector1                 &w,
+				    const Matrix1           &A,
+				    const Vector2           &v,
+				    const std::vector<bool> &S) const;
+
+		// Matrix-vector transpose multiply
+		// w = (A * S_i * S_i^T)^T * v
+		template <class Vector1, class Matrix1, class Vector2>
+		Vector1 &vectorMulTranspose (Vector1                 &w,
+					     const Matrix1           &A,
+					     const Vector2           &v,
+					     const std::vector<bool> &S) const;
+
+		// Matrix-matrix addition
+		// A = A + B * S_i * S_i^T
+		template <class Matrix1, class Matrix2>
+		Matrix1 &addin (Matrix1                 &A,
+				const Matrix2           &B,
+				const std::vector<bool> &S) const;
+
+		// Add I_N to the given N x N matrix
+		// A = A + I_N
+		template <class Matrix1>
+		Matrix1 &addIN (Matrix1 &A) const;
+
+		// Given a vector S of bools, write an array of array indices in which
+		// the true values of S are last
+		void permute (std::vector<size_t>     &indices,
+			      const std::vector<bool> &S) const;
+
+		// Set the given matrix to the identity
+		template <class Matrix1>
+		Matrix1 &setIN (Matrix1 &A) const;
+
+		// Find a suitable pivot row for a column and exchange it with the given
+		// row
+		bool find_pivot_row (Matrix                    &A,
+				     size_t                     row,
+				     int                        col_offset,
+				     const std::vector<size_t> &indices);
+
+		// Eliminate all entries in a column except the pivot row, using row
+		// operations from the pivot row
+		void eliminate_col (Matrix                    &A,
+				    size_t                     pivot,
+				    int                        col_offset,
+				    const std::vector<size_t> &indices,
+				    const Element             &Ajj_inv);
+
+		// Initialize the temporaries used in computation
+		void init_temps ();
+
+		// Private variables
+
+		const BlockLanczosTraits _traits;
+		const Field              &_F;
+		VectorDomain<Field>       _VD;
+		MatrixDomain<Field>       _MD;
+		typename Field::RandIter  _randiter;
+
+		// Temporaries used in the computation
+
+		Matrix  _V[3];             // n x N
+		Matrix  _AV;               // n x N
+		Matrix  _VTAV;             // N x N
+		Matrix  _Winv[2];          // N x N
+		Matrix  _AVTAVSST_VTAV;    // N x N
+		Matrix  _T;                // N x N
+		Matrix  _DEF;              // N x N
+		std::vector<bool>         _S;                // N-vector of bools
+
+		Matrix _x;                 // n x <=N
+		Matrix _y;                 // n x <=N
+		Matrix _b;                 // n x <=N
+
+		mutable Matrix _tmp;       // N x <=N
+		mutable Matrix _tmp1;      // N x <=N
+
+		typename Field::Element   _one;
+
+		std::vector<size_t>       _indices;          // N
+
+		mutable Matrix _M;         // N x 2N
+
+		// Blocking factor
+
+		size_t                    _N;
+
+		// Construct a transpose matrix on the fly
+		template <class Matrix1>
+		TransposeMatrix<Matrix1> transpose (Matrix1 &M) const
 		{ return TransposeMatrix<Matrix1> (M); }
 
-    protected:
+	protected:
 
-	template <class Matrix1>
-	bool isAlmostIdentity (const Matrix1 &M) const;
+		template <class Matrix1>
+		bool isAlmostIdentity (const Matrix1 &M) const;
 
-	// Test suite for the above functions
+		// Test suite for the above functions
 
-	bool test_compute_Winv_S_mul (int n) const;
-	bool test_compute_Winv_S_mulin (int n) const;
-	bool test_mul_SST (int n) const;
-	bool test_mul_ABSST (int n) const;
-	bool test_mulTranspose (int m, int n) const;
-	bool test_mulTranspose_ABSST (int n) const;
-	bool test_mulin_ABSST (int n) const;
-	bool test_addin_ABSST (int n) const;
+		bool test_compute_Winv_S_mul (int n) const;
+		bool test_compute_Winv_S_mulin (int n) const;
+		bool test_mul_SST (int n) const;
+		bool test_mul_ABSST (int n) const;
+		bool test_mulTranspose (int m, int n) const;
+		bool test_mulTranspose_ABSST (int n) const;
+		bool test_mulin_ABSST (int n) const;
+		bool test_addin_ABSST (int n) const;
 
-    public:
+	public:
 
-	bool runSelfCheck () const;
-};
+		bool runSelfCheck () const;
+	};
 
 } // namespace LinBox
 
 #include "linbox/algorithms/mg-block-lanczos.inl"
 
-#endif // __MG_BLOCK_LANCZOS_H
+#endif // __LINBOX_mg_block_lanczos_H
diff --git a/linbox/algorithms/mg-block-lanczos.inl b/linbox/algorithms/mg-block-lanczos.inl
index 79d723b..3df6297 100644
--- a/linbox/algorithms/mg-block-lanczos.inl
+++ b/linbox/algorithms/mg-block-lanczos.inl
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* linbox/algorithms/mg-block-lanczos.inl
  * Copyright (C) 2002 Bradford Hovinen
@@ -13,8 +14,8 @@
  * Function definitions for block Lanczos iteration
  */
 
-#ifndef __MG_BLOCK_LANCZOS_INL
-#define __MG_BLOCK_LANCZOS_INL
+#ifndef __LINBOX_mg_block_lanczos_INL
+#define __LINBOX_mg_block_lanczos_INL
 
 #include "linbox/linbox-config.h"
 #undef _T
@@ -35,78 +36,67 @@
 // I'm putting everything inside the LinBox namespace so that I can drop all of
 // this in to LinBox easily at a later date, without any messy porting.
 
-namespace LinBox 
+namespace LinBox
 {
 
 #ifdef MGBL_DETAILED_TRACE
 
-std::ostream &operator << (std::ostream &out, const std::vector<bool> &S) 
-{
-	std::vector<bool>::const_iterator i;
-
-	for (i = S.begin (); i != S.end (); ++i) {
-		out << ((*i) ? "1" : "0");
-		if (i != S.end () - 1)
-			out << ", ";
-	}
 
-	return out;
-}
 
-template <class Field, class Matrix>
-void MGBLTraceReport (std::ostream &out, MatrixDomain<Field> &MD, const char *text, size_t iter, const Matrix &M)
-{
-	out << text << " [" << iter << "]:" << std::endl;
-	MD.write (out, M);
-}
+	template <class Field, class Matrix>
+	void MGBLTraceReport (std::ostream &out, MatrixDomain<Field> &MD, const char *text, size_t iter, const Matrix &M)
+	{
+		out << text << " [" << iter << "]:" << std::endl;
+		MD.write (out, M);
+	}
 
-template <class Field, class Vector>
-void MGBLTraceReport (std::ostream &out, VectorDomain<Field> &VD, const char *text, size_t iter, const Vector &v)
-{
-	out << text << " [" << iter << "]: ";
-	VD.write (out, v) << std::endl;
-}
+	template <class Field, class Vector>
+	void MGBLTraceReport (std::ostream &out, VectorDomain<Field> &VD, const char *text, size_t iter, const Vector &v)
+	{
+		out << text << " [" << iter << "]: ";
+		VD.write (out, v) << std::endl;
+	}
 
-void reportS (std::ostream &out, const std::vector<bool> &S, size_t iter) 
-{
-	out << "S_" << iter << ": [" << S << "]" << std::endl;
-}
+	void reportS (std::ostream &out, const std::vector<bool> &S, size_t iter)
+	{
+		out << "S_" << iter << ": [" << S << "]" << std::endl;
+	}
 
-template <class Field, class Matrix>
-void checkAConjugacy (const MatrixDomain<Field> &MD, const Matrix &AV, const Matrix &V, Matrix &T,
-		      size_t AV_iter, size_t V_iter) 
-{
-	std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+	template <class Field, class Matrix>
+	void checkAConjugacy (const MatrixDomain<Field> &MD, const Matrix &AV, const Matrix &V, Matrix &T,
+			      size_t AV_iter, size_t V_iter)
+	{
+		std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
 
-	report << "Checking whether V_" << V_iter << " is A-conjugate to V_" << AV_iter << "...";
+		report << "Checking whether V_" << V_iter << " is A-conjugate to V_" << AV_iter << "...";
 
-	MD.mul (T, TransposeMatrix<const Matrix> (V), AV);
+		MD.mul (T, TransposeMatrix<const Matrix> (V), AV);
 
-	if (MD.isZero (T))
-		report << "yes" << std::endl;
-	else {
-		report << "no" << std::endl;
+		if (MD.isZero (T))
+			report << "yes" << std::endl;
+		else {
+			report << "no" << std::endl;
 
-		std::ostream &err_report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR);
-		err_report << "ERROR: V_" << V_iter << " is not A-conjugate to V_" << AV_iter << std::endl;
-		err_report << "Computed V_" << V_iter << "^T AV_" << AV_iter << ":" << std::endl;
-		MD.write (report, T);
+			std::ostream &err_report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR);
+			err_report << "ERROR: V_" << V_iter << " is not A-conjugate to V_" << AV_iter << std::endl;
+			err_report << "Computed V_" << V_iter << "^T AV_" << AV_iter << ":" << std::endl;
+			MD.write (report, T);
+		}
 	}
-}
 
 #else
 
-template <class Domain, class Object>
-inline void MGBLTraceReport (std::ostream &out, Domain &D, const char *text, size_t iter, const Object &obj)
-{}
+	template <class Domain, class Object>
+	inline void MGBLTraceReport (std::ostream &out, Domain &D, const char *text, size_t iter, const Object &obj)
+	{}
 
-void reportS (std::ostream &out, const std::vector<bool> &S, size_t iter) 
-{}
+	inline void reportS (std::ostream &out, const std::vector<bool> &S, size_t iter)
+	{}
 
-template <class Field, class Matrix>
-inline void checkAConjugacy (const MatrixDomain<Field> &MD, const Matrix &AV, const Matrix &V, Matrix &T,
-			     size_t AV_iter, size_t V_iter) 
-{}
+	template <class Field, class Matrix>
+	inline void checkAConjugacy (const MatrixDomain<Field> &MD, const Matrix &AV, const Matrix &V, Matrix &T,
+				     size_t AV_iter, size_t V_iter)
+	{}
 
 #endif
 
@@ -116,7 +106,7 @@ inline void checkAConjugacy (const MatrixDomain<Field> &MD, const Matrix &AV, co
 #  define TIMER_STOP(part) part##_timer.stop (); part##_time += part##_timer.time ()
 #  define TIMER_REPORT(part) \
 	commentator.report (Commentator::LEVEL_NORMAL, TIMING_MEASURE) \
-		<< "Total " #part " time: " << part##_time << "s" << std::endl;
+	<< "Total " #part " time: " << part##_time << "s" << std::endl;
 #else
 #  define TIMER_DECLARE(part)
 #  define TIMER_START(part)
@@ -124,1465 +114,1470 @@ inline void checkAConjugacy (const MatrixDomain<Field> &MD, const Matrix &AV, co
 #  define TIMER_REPORT(part)
 #endif
 
-// N.B. This code was lifted from the Lanczos iteration in LinBox
-
-template <class Field, class Matrix>
-template <class Blackbox, class Vector>
-bool MGBlockLanczosSolver<Field, Matrix>::solve (const Blackbox &A, Vector &x, const Vector &b) 
-{
-	linbox_check ((x.size () == A.coldim ()) &&
-		      (b.size () == A.rowdim ()));
-
-	commentator.start ("Solving linear system (Montgomery's block Lanczos)", "MGBlockLanczosSolver::solve");
-
-	bool success = false;
-	Vector d1, d2, b1, b2, bp, y, Ax, ATAx, ATb;
+	// N.B. This code was lifted from the Lanczos iteration in LinBox
 
-	// Get the temporaries into the right sizes
-	_b.resize (b.size (), 1);
-	_x.resize (x.size (), 1);
-
-	_tmp.resize (_N, 1);
-	_tmp1.resize (_N, 1);
-
-	_V[0].resize (A.coldim (), _N);
-	_V[1].resize (A.coldim (), _N);
-	_V[2].resize (A.coldim (), _N);
-	_AV.resize (A.coldim (), _N);
-
-	NonzeroRandIter<Field> real_ri (_F, _randiter);
-	RandomDenseStream<Field, Vector, NonzeroRandIter<Field> > stream (_F, real_ri, A.coldim ());
-
-	for (unsigned int i = 0; !success && i < _traits.maxTries (); ++i) {
-		std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-		report << "In try: " << i << std::endl;
-
-		switch (_traits.preconditioner ()) {
-		    case BlockLanczosTraits::NO_PRECONDITIONER:
-			_VD.copy (*(_b.colBegin ()), b);
-			success = iterate (A);
-			_VD.copy (x, *(_x.colBegin ()));
-			break;
-
-		    case BlockLanczosTraits::SYMMETRIZE:
-		    {
-			VectorWrapper::ensureDim (bp, A.coldim ());
-
-			Transpose<Blackbox> AT (&A);
-			Compose<Transpose<Blackbox>, Blackbox> B (&AT, &A);
-
-			AT.apply (bp, b);
-
-			_VD.copy (*(_b.colBegin ()), bp);
+	template <class Field, class Matrix>
+	template <class Blackbox, class Vector>
+	inline bool MGBlockLanczosSolver<Field, Matrix>::solve (const Blackbox &A, Vector &x, const Vector &b)
+	{
+		linbox_check ((x.size () == A.coldim ()) &&
+			      (b.size () == A.rowdim ()));
 
-			success = iterate (B);
+		commentator.start ("Solving linear system (Montgomery's block Lanczos)", "MGBlockLanczosSolver::solve");
 
-			_VD.copy (x, *(_x.colBegin ()));
+		bool success = false;
+		Vector d1, d2, b1, b2, bp, y, Ax, ATAx, ATb;
 
-			break;
-		    }
+		// Get the temporaries into the right sizes
+		_b.resize (b.size (), 1);
+		_x.resize (x.size (), 1);
 
-		    case BlockLanczosTraits::PARTIAL_DIAGONAL:
-		    {
-			VectorWrapper::ensureDim (d1, A.coldim ());
-			VectorWrapper::ensureDim (y, A.coldim ());
+		_tmp.resize (_N, 1);
+		_tmp1.resize (_N, 1);
 
-			stream >> d1;
-			Diagonal<Field> D (_F, d1);
-			Compose<Blackbox, Diagonal<Field> > B (&A, &D);
+		_V[0].resize (A.coldim (), _N);
+		_V[1].resize (A.coldim (), _N);
+		_V[2].resize (A.coldim (), _N);
+		_AV.resize (A.coldim (), _N);
 
-			report << "Random D: ";
-			_VD.write (report, d1) << std::endl;
+		NonzeroRandIter<Field> real_ri (_F, _randiter);
+		RandomDenseStream<Field, Vector, NonzeroRandIter<Field> > stream (_F, real_ri, A.coldim ());
 
-			_VD.copy (*(_b.colBegin ()), b);
+		for (unsigned int i = 0; !success && i < _traits.maxTries (); ++i) {
+			std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+			report << "In try: " << i << std::endl;
 
-			success = iterate (B);
+			switch (_traits.preconditioner ()) {
+			case BlockLanczosTraits::NO_PRECONDITIONER:
+				_VD.copy (*(_b.colBegin ()), b);
+				success = iterate (A);
+				_VD.copy (x, *(_x.colBegin ()));
+				break;
 
-			D.apply (x, *(_x.colBegin ()));
+			case BlockLanczosTraits::SYMMETRIZE:
+				{
+					VectorWrapper::ensureDim (bp, A.coldim ());
 
-			break;
-		    }
+					Transpose<Blackbox> AT (&A);
+					Compose<Transpose<Blackbox>, Blackbox> B (&AT, &A);
 
-		    case BlockLanczosTraits::PARTIAL_DIAGONAL_SYMMETRIZE:
-		    {
-			VectorWrapper::ensureDim (d1, A.rowdim ());
-			VectorWrapper::ensureDim (b1, A.rowdim ());
-			VectorWrapper::ensureDim (bp, A.coldim ());
+					AT.apply (bp, b);
 
-			typedef Diagonal<Field> PC1;
-			typedef Transpose<Blackbox> PC2;
-			typedef Compose<PC1, Blackbox> CO1;
-			typedef Compose<PC2, CO1> CO2;
+					_VD.copy (*(_b.colBegin ()), bp);
 
-			stream >> d1;
-			PC1 D (_F, d1);
-			PC2 AT (&A);
-			CO1 B1 (&D, &A);
-			CO2 B (&AT, &B1);
+					success = iterate (B);
 
-			report << "Random D: ";
-			_VD.write (report, d1) << std::endl;
+					_VD.copy (x, *(_x.colBegin ()));
 
-			D.apply (b1, b);
-			AT.apply (bp, b1);
+					break;
+				}
 
-			_VD.copy (*(_b.colBegin ()), bp);
-			success = iterate (B);
-			_VD.copy (x, *(_x.colBegin ()));
+			case BlockLanczosTraits::PARTIAL_DIAGONAL:
+				{
+					VectorWrapper::ensureDim (d1, A.coldim ());
+					VectorWrapper::ensureDim (y, A.coldim ());
 
-			break;
-		    }
+					stream >> d1;
+					Diagonal<Field> D (_F, d1);
+					Compose<Blackbox, Diagonal<Field> > B (&A, &D);
 
-		    case BlockLanczosTraits::FULL_DIAGONAL:
-		    {
-			VectorWrapper::ensureDim (d1, A.coldim ());
-			VectorWrapper::ensureDim (d2, A.rowdim ());
-			VectorWrapper::ensureDim (b1, A.rowdim ());
-			VectorWrapper::ensureDim (b2, A.coldim ());
-			VectorWrapper::ensureDim (bp, A.coldim ());
-			VectorWrapper::ensureDim (y, A.coldim ());
+					report << "Random D: ";
+					_VD.write (report, d1) << std::endl;
 
-			typedef Diagonal<Field> PC1;
-			typedef Transpose<Blackbox> PC2;
-			typedef Compose<Blackbox, PC1> CO1;
-			typedef Compose<PC1, CO1> CO2;
-			typedef Compose<PC2, CO2> CO3;
-			typedef Compose<PC1, CO3> CO4;
+					_VD.copy (*(_b.colBegin ()), b);
 
-			stream >> d1 >> d2;
-			PC1 D1 (_F, d1);
-			PC1 D2 (_F, d2);
-			PC2 AT (&A);
-			CO1 B1 (&A, &D1);
-			CO2 B2 (&D2, &B1);
-			CO3 B3 (&AT, &B2);
-			CO4 B (&D1, &B3);
+					success = iterate (B);
 
-			report << "Random D_1: ";
-			_VD.write (report, d1) << std::endl;
+					D.apply (x, *(_x.colBegin ()));
 
-			report << "Random D_2: ";
-			_VD.write (report, d2) << std::endl;
+					break;
+				}
 
-			D2.apply (b1, b);
-			AT.apply (b2, b1);
-			D1.apply (bp, b2);
+			case BlockLanczosTraits::PARTIAL_DIAGONAL_SYMMETRIZE:
+				{
+					VectorWrapper::ensureDim (d1, A.rowdim ());
+					VectorWrapper::ensureDim (b1, A.rowdim ());
+					VectorWrapper::ensureDim (bp, A.coldim ());
 
-			_VD.copy (*(_b.colBegin ()), bp);
-			success = iterate (B);
-			D1.apply (x, *(_x.colBegin ()));
+					typedef Diagonal<Field> PC1;
+					typedef Transpose<Blackbox> PC2;
+					typedef Compose<PC1, Blackbox> CO1;
+					typedef Compose<PC2, CO1> CO2;
 
-			break;
-		    }
+					stream >> d1;
+					PC1 D (_F, d1);
+					PC2 AT (&A);
+					CO1 B1 (&D, &A);
+					CO2 B (&AT, &B1);
 
-		    default:
-			throw PreconditionFailed (__FUNCTION__, __LINE__,
-						  "preconditioner is NO_PRECONDITIONER, SYMMETRIZE, PARTIAL_DIAGONAL_SYMMETRIZE, "
-						  "PARTIAL_DIAGONAL, or FULL_DIAGONAL");
-		}
+					report << "Random D: ";
+					_VD.write (report, d1) << std::endl;
 
-		if (_traits.checkResult ()) {
-			VectorWrapper::ensureDim (Ax, A.rowdim ());
+					D.apply (b1, b);
+					AT.apply (bp, b1);
 
-			if (_traits.checkResult () &&
-			    ((_traits.preconditioner () == BlockLanczosTraits::SYMMETRIZE) ||
-			     (_traits.preconditioner () == BlockLanczosTraits::PARTIAL_DIAGONAL_SYMMETRIZE) ||
-			     (_traits.preconditioner () == BlockLanczosTraits::FULL_DIAGONAL)))
-			{
-				VectorWrapper::ensureDim (ATAx, A.coldim ());
-				VectorWrapper::ensureDim (ATb, A.coldim ());
+					_VD.copy (*(_b.colBegin ()), bp);
+					success = iterate (B);
+					_VD.copy (x, *(_x.colBegin ()));
 
-				commentator.start ("Checking whether A^T Ax = A^T b");
-
-				A.apply (Ax, x);
-				A.applyTranspose (ATAx, Ax);
-				A.applyTranspose (ATb, b);
+					break;
+				}
 
-				if (_VD.areEqual (ATAx, ATb)) {
-					commentator.stop ("passed");
-					success = true;
-				} else {
-					commentator.stop ("FAILED");
-					success = false;
+			case BlockLanczosTraits::FULL_DIAGONAL:
+				{
+					VectorWrapper::ensureDim (d1, A.coldim ());
+					VectorWrapper::ensureDim (d2, A.rowdim ());
+					VectorWrapper::ensureDim (b1, A.rowdim ());
+					VectorWrapper::ensureDim (b2, A.coldim ());
+					VectorWrapper::ensureDim (bp, A.coldim ());
+					VectorWrapper::ensureDim (y, A.coldim ());
+
+					typedef Diagonal<Field> PC1;
+					typedef Transpose<Blackbox> PC2;
+					typedef Compose<Blackbox, PC1> CO1;
+					typedef Compose<PC1, CO1> CO2;
+					typedef Compose<PC2, CO2> CO3;
+					typedef Compose<PC1, CO3> CO4;
+
+					stream >> d1 >> d2;
+					PC1 D1 (_F, d1);
+					PC1 D2 (_F, d2);
+					PC2 AT (&A);
+					CO1 B1 (&A, &D1);
+					CO2 B2 (&D2, &B1);
+					CO3 B3 (&AT, &B2);
+					CO4 B (&D1, &B3);
+
+					report << "Random D_1: ";
+					_VD.write (report, d1) << std::endl;
+
+					report << "Random D_2: ";
+					_VD.write (report, d2) << std::endl;
+
+					D2.apply (b1, b);
+					AT.apply (b2, b1);
+					D1.apply (bp, b2);
+
+					_VD.copy (*(_b.colBegin ()), bp);
+					success = iterate (B);
+					D1.apply (x, *(_x.colBegin ()));
+
+					break;
 				}
-			}
-			else if (_traits.checkResult ()) {
-				commentator.start ("Checking whether Ax=b");
 
-				A.apply (Ax, x);
+			default:
+				throw PreconditionFailed (__func__, __LINE__,
+							  "preconditioner is NO_PRECONDITIONER, SYMMETRIZE, PARTIAL_DIAGONAL_SYMMETRIZE, "
+							  "PARTIAL_DIAGONAL, or FULL_DIAGONAL");
+			}
 
-				if (_VD.areEqual (Ax, b)) {
-					commentator.stop ("passed");
-					success = true;
-				} else {
-					commentator.stop ("FAILED");
-					success = false;
+			if (_traits.checkResult ()) {
+				VectorWrapper::ensureDim (Ax, A.rowdim ());
+
+				if (_traits.checkResult () &&
+				    ((_traits.preconditioner () == BlockLanczosTraits::SYMMETRIZE) ||
+				     (_traits.preconditioner () == BlockLanczosTraits::PARTIAL_DIAGONAL_SYMMETRIZE) ||
+				     (_traits.preconditioner () == BlockLanczosTraits::FULL_DIAGONAL)))
+				{
+					VectorWrapper::ensureDim (ATAx, A.coldim ());
+					VectorWrapper::ensureDim (ATb, A.coldim ());
+
+					commentator.start ("Checking whether A^T Ax = A^T b");
+
+					A.apply (Ax, x);
+					A.applyTranspose (ATAx, Ax);
+					A.applyTranspose (ATb, b);
+
+					if (_VD.areEqual (ATAx, ATb)) {
+						commentator.stop ("passed");
+						success = true;
+					}
+					else {
+						commentator.stop ("FAILED");
+						success = false;
+					}
+				}
+				else if (_traits.checkResult ()) {
+					commentator.start ("Checking whether Ax=b");
+
+					A.apply (Ax, x);
+
+					if (_VD.areEqual (Ax, b)) {
+						commentator.stop ("passed");
+						success = true;
+					}
+					else {
+						commentator.stop ("FAILED");
+						success = false;
+					}
 				}
 			}
 		}
-	}
 
-	commentator.stop ("done", (success ? "Solve successful" : "Solve failed"), "MGBlockLanczosSolver::solve");
+		commentator.stop ("done", (success ? "Solve successful" : "Solve failed"), "MGBlockLanczosSolver::solve");
 
-	return success;
-}
+		return success;
+	}
 
-template <class Field, class Matrix>
-template <class Blackbox, class Matrix1>
-unsigned int MGBlockLanczosSolver<Field, Matrix>::sampleNullspace (const Blackbox &A, Matrix1 &x) 
-{
-	linbox_check (x.rowdim () == A.coldim ());
+	template <class Field, class Matrix>
+	template <class Blackbox, class Matrix1>
+	inline unsigned int MGBlockLanczosSolver<Field, Matrix>::sampleNullspace (const Blackbox &A, Matrix1 &x)
+	{
+		linbox_check (x.rowdim () == A.coldim ());
 
-	commentator.start ("Sampling from nullspace (Montgomery's block Lanczos)", "MGBlockLanczosSolver::sampleNullspace");
+		commentator.start ("Sampling from nullspace (Montgomery's block Lanczos)", "MGBlockLanczosSolver::sampleNullspace");
 
-	unsigned int number = 0;
+		unsigned int number = 0;
 
-	bool success;
+		bool success;
 
-	typename LinBox::Vector<Field>::Dense d1, d2;
+		typename LinBox::Vector<Field>::Dense d1, d2;
 
-	// Get the temporaries into the right sizes
-	_b.resize (x.rowdim (), x.coldim ());
-	_x.resize (x.rowdim (), x.coldim ());
-	_y.resize (x.rowdim (), x.coldim ());
+		// Get the temporaries into the right sizes
+		_b.resize (x.rowdim (), x.coldim ());
+		_x.resize (x.rowdim (), x.coldim ());
+		_y.resize (x.rowdim (), x.coldim ());
 
-	_tmp.resize (_N, x.coldim ());
-	_tmp1.resize (_N, x.coldim ());
+		_tmp.resize (_N, x.coldim ());
+		_tmp1.resize (_N, x.coldim ());
 
-	_V[0].resize (A.coldim (), _N);
-	_V[1].resize (A.coldim (), _N);
-	_V[2].resize (A.coldim (), _N);
-	_AV.resize (A.coldim (), _N);
+		_V[0].resize (A.coldim (), _N);
+		_V[1].resize (A.coldim (), _N);
+		_V[2].resize (A.coldim (), _N);
+		_AV.resize (A.coldim (), _N);
 
-	typename Matrix::ColIterator xi = x.colBegin ();
+		typename Matrix::ColIterator xi = x.colBegin ();
 
-	NonzeroRandIter<Field> real_ri (_F, _randiter);
-	RandomDenseStream<Field, typename LinBox::Vector<Field>::Dense, NonzeroRandIter<Field> > d_stream (_F, real_ri, A.coldim ());
+		NonzeroRandIter<Field> real_ri (_F, _randiter);
+		RandomDenseStream<Field, typename LinBox::Vector<Field>::Dense, NonzeroRandIter<Field> > d_stream (_F, real_ri, A.coldim ());
 
-	TransposeMatrix<Matrix> bT (_b);
-	TransposeMatrix<Matrix> xT (_x);
+		TransposeMatrix<Matrix> bT (_b);
+		TransposeMatrix<Matrix> xT (_x);
 
-	for ( unsigned int i = 0; number < x.coldim () && i < _traits.maxTries (); ++i) {
-		std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-		report << "in try: " << i << std::endl;
+		for ( unsigned int i = 0; number < x.coldim () && i < _traits.maxTries (); ++i) {
+			std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+			report << "in try: " << i << std::endl;
 
-		// Fill y with random data
-		RandomDenseStream<Field, typename Matrix::Col> stream (_F, _randiter, A.coldim ());
-		typename Matrix::ColIterator iter;
+			// Fill y with random data
+			RandomDenseStream<Field, typename Matrix::Col> stream (_F, _randiter, A.coldim ());
+			typename Matrix::ColIterator iter;
 
-		for (iter = _y.colBegin (); iter != _y.colEnd (); ++iter)
-			stream >> *iter;
+			for (iter = _y.colBegin (); iter != _y.colEnd (); ++iter)
+				stream >> *iter;
 
-		// Find a right-hand side for the linear system
-		_MD.blackboxMulLeft (_b, A, _y);
+			// Find a right-hand side for the linear system
+			_MD.blackboxMulLeft (_b, A, _y);
 
-		switch (_traits.preconditioner ()) {
-		    case BlockLanczosTraits::NO_PRECONDITIONER:
-			success = iterate (A);
-			break;
+			switch (_traits.preconditioner ()) {
+			case BlockLanczosTraits::NO_PRECONDITIONER:
+				success = iterate (A);
+				break;
 
-		    case BlockLanczosTraits::SYMMETRIZE:
-		    {
-			Transpose<Blackbox> AT (&A);
-			Compose<Transpose<Blackbox>, Blackbox> B (&AT, &A);
+			case BlockLanczosTraits::SYMMETRIZE:
+				{
+					Transpose<Blackbox> AT (&A);
+					Compose<Transpose<Blackbox>, Blackbox> B (&AT, &A);
 
-			_MD.blackboxMulRight (xT, transpose (_b), A);
-			_MD.copy (_b, _x);
+					_MD.blackboxMulRight (xT, transpose (_b), A);
+					_MD.copy (_b, _x);
 
-			success = iterate (B);
-			break;
-		    }
+					success = iterate (B);
+					break;
+				}
 
-		    case BlockLanczosTraits::PARTIAL_DIAGONAL:
-		    {
-			VectorWrapper::ensureDim (d1, A.coldim ());
+			case BlockLanczosTraits::PARTIAL_DIAGONAL:
+				{
+					VectorWrapper::ensureDim (d1, A.coldim ());
 
-			d_stream >> d1;
-			Diagonal<Field> D (_F, d1);
-			Compose<Blackbox, Diagonal<Field> > B (&A, &D);
+					d_stream >> d1;
+					Diagonal<Field> D (_F, d1);
+					Compose<Blackbox, Diagonal<Field> > B (&A, &D);
 
-			report << "Random D: ";
-			_VD.write (report, d1) << std::endl;
+					report << "Random D: ";
+					_VD.write (report, d1) << std::endl;
 
-			success = iterate (B);
+					success = iterate (B);
 
-			_MD.blackboxMulLeft (_b, D, _x);
-			_MD.copy (_x, _b);
+					_MD.blackboxMulLeft (_b, D, _x);
+					_MD.copy (_x, _b);
 
-			break;
-		    }
+					break;
+				}
 
-		    case BlockLanczosTraits::PARTIAL_DIAGONAL_SYMMETRIZE:
-		    {
-			VectorWrapper::ensureDim (d1, A.rowdim ());
+			case BlockLanczosTraits::PARTIAL_DIAGONAL_SYMMETRIZE:
+				{
+					VectorWrapper::ensureDim (d1, A.rowdim ());
 
-			typedef Diagonal<Field> PC1;
-			typedef Transpose<Blackbox> PC2;
-			typedef Compose<PC1, Blackbox> CO1;
-			typedef Compose<PC2, CO1> CO2;
+					typedef Diagonal<Field> PC1;
+					typedef Transpose<Blackbox> PC2;
+					typedef Compose<PC1, Blackbox> CO1;
+					typedef Compose<PC2, CO1> CO2;
 
-			d_stream >> d1;
-			PC1 D (_F, d1);
-			PC2 AT (&A);
-			CO1 B1 (&D, &A);
-			CO2 B (&AT, &B1);
+					d_stream >> d1;
+					PC1 D (_F, d1);
+					PC2 AT (&A);
+					CO1 B1 (&D, &A);
+					CO2 B (&AT, &B1);
 
-			report << "Random D: ";
-			_VD.write (report, d1) << std::endl;
+					report << "Random D: ";
+					_VD.write (report, d1) << std::endl;
 
-			_MD.blackboxMulLeft (_x, D, _b);
-			_MD.blackboxMulRight (bT, transpose (_x), A);
+					_MD.blackboxMulLeft (_x, D, _b);
+					_MD.blackboxMulRight (bT, transpose (_x), A);
 
-			success = iterate (B);
+					success = iterate (B);
 
-			break;
-		    }
+					break;
+				}
 
-		    case BlockLanczosTraits::FULL_DIAGONAL:
-		    {
-			VectorWrapper::ensureDim (d1, A.coldim ());
-			VectorWrapper::ensureDim (d2, A.rowdim ());
+			case BlockLanczosTraits::FULL_DIAGONAL:
+				{
+					VectorWrapper::ensureDim (d1, A.coldim ());
+					VectorWrapper::ensureDim (d2, A.rowdim ());
 
-			typedef Diagonal<Field> PC1;
-			typedef Transpose<Blackbox> PC2;
-			typedef Compose<Blackbox, PC1> CO1;
-			typedef Compose<PC1, CO1> CO2;
-			typedef Compose<PC2, CO2> CO3;
-			typedef Compose<PC1, CO3> CO4;
+					typedef Diagonal<Field> PC1;
+					typedef Transpose<Blackbox> PC2;
+					typedef Compose<Blackbox, PC1> CO1;
+					typedef Compose<PC1, CO1> CO2;
+					typedef Compose<PC2, CO2> CO3;
+					typedef Compose<PC1, CO3> CO4;
 
-			d_stream >> d1 >> d2;
-			PC1 D1 (_F, d1);
-			PC1 D2 (_F, d2);
-			PC2 AT (&A);
-			CO1 B1 (&A, &D1);
-			CO2 B2 (&D2, &B1);
-			CO3 B3 (&AT, &B2);
-			CO4 B (&D1, &B3);
+					d_stream >> d1 >> d2;
+					PC1 D1 (_F, d1);
+					PC1 D2 (_F, d2);
+					PC2 AT (&A);
+					CO1 B1 (&A, &D1);
+					CO2 B2 (&D2, &B1);
+					CO3 B3 (&AT, &B2);
+					CO4 B (&D1, &B3);
 
-			report << "Random D_1: ";
-			_VD.write (report, d1) << std::endl;
+					report << "Random D_1: ";
+					_VD.write (report, d1) << std::endl;
 
-			report << "Random D_2: ";
-			_VD.write (report, d2) << std::endl;
+					report << "Random D_2: ";
+					_VD.write (report, d2) << std::endl;
 
-			_MD.blackboxMulLeft (_x, D2, _b);
-			_MD.blackboxMulRight (bT, transpose (_x), A);
-			_MD.blackboxMulLeft (_x, D1, _b);
-			_MD.copy (_b, _x);
+					_MD.blackboxMulLeft (_x, D2, _b);
+					_MD.blackboxMulRight (bT, transpose (_x), A);
+					_MD.blackboxMulLeft (_x, D1, _b);
+					_MD.copy (_b, _x);
 
-			success = iterate (B);
+					success = iterate (B);
 
-			_MD.blackboxMulLeft (_b, D1, _x);
-			_MD.copy (_x, _b);
+					_MD.blackboxMulLeft (_b, D1, _x);
+					_MD.copy (_x, _b);
 
-			break;
-		    }
+					break;
+				}
 
-		    default:
-			throw PreconditionFailed (__FUNCTION__, __LINE__,
-						  "preconditioner is NO_PRECONDITIONER, SYMMETRIZE, PARTIAL_DIAGONAL_SYMMETRIZE, "
-						  "PARTIAL_DIAGONAL, or FULL_DIAGONAL");
-		}
+			default:
+				throw PreconditionFailed (__func__, __LINE__,
+							  "preconditioner is NO_PRECONDITIONER, SYMMETRIZE, PARTIAL_DIAGONAL_SYMMETRIZE, "
+							  "PARTIAL_DIAGONAL, or FULL_DIAGONAL");
+			}
 
-		// Obtain the candidate nullspace vectors
-		_MD.subin (_x, _y);
+			// Obtain the candidate nullspace vectors
+			_MD.subin (_x, _y);
 
-		// Copy vectors of _x that are true nullspace vectors into the solution
-		_MD.blackboxMulLeft (_b, A, _x);
+			// Copy vectors of _x that are true nullspace vectors into the solution
+			_MD.blackboxMulLeft (_b, A, _x);
 
-		typename Matrix::ColIterator bi, xip;
+			typename Matrix::ColIterator bi, xip;
 
-		for (bi = _b.colBegin (), xip = _x.colBegin (); bi != _b.colEnd (); ++bi, ++xip) {
-			if (_VD.isZero (*bi) && !_VD.isZero (*xip)) {
-				_VD.copy (*xi, *xip);
-				++number; ++xi;
+			for (bi = _b.colBegin (), xip = _x.colBegin (); bi != _b.colEnd (); ++bi, ++xip) {
+				if (_VD.isZero (*bi) && !_VD.isZero (*xip)) {
+					_VD.copy (*xi, *xip);
+					++number; ++xi;
+				}
 			}
 		}
-	}
 
-	commentator.stop ("done", NULL, "MGBlockLanczosSolver::sampleNullspace");
+		commentator.stop ("done", NULL, "MGBlockLanczosSolver::sampleNullspace");
 
-	return number;
-}
+		return number;
+	}
 
-template <class Field, class Matrix>
-template <class Blackbox>
-bool MGBlockLanczosSolver<Field, Matrix>::iterate (const Blackbox &A)
-{
-	linbox_check (_V[0].rowdim () == A.rowdim ());
-	linbox_check (_V[1].rowdim () == A.rowdim ());
-	linbox_check (_V[2].rowdim () == A.rowdim ());
-	linbox_check (_V[0].coldim () == _V[1].coldim ());
-	linbox_check (_V[0].coldim () == _V[2].coldim ());
+	template <class Field, class Matrix>
+	template <class Blackbox>
+	inline bool MGBlockLanczosSolver<Field, Matrix>::iterate (const Blackbox &A)
+	{
+		linbox_check (_V[0].rowdim () == A.rowdim ());
+		linbox_check (_V[1].rowdim () == A.rowdim ());
+		linbox_check (_V[2].rowdim () == A.rowdim ());
+		linbox_check (_V[0].coldim () == _V[1].coldim ());
+		linbox_check (_V[0].coldim () == _V[2].coldim ());
 
-	commentator.start ("Block Lanczos iteration", "MGBlockLanczosSolver::iterate", A.rowdim ());
+		commentator.start ("Block Lanczos iteration", "MGBlockLanczosSolver::iterate", A.rowdim ());
 
-	size_t    Ni;
-	size_t    total_dim = 0;
+		size_t    Ni;
+		size_t    total_dim = 0;
 
-	bool      ret = true, done = false;
+		bool      ret = true, done = false;
 
-	// How many iterations between each progress update
-	unsigned int progress_interval = A.rowdim () / _traits.blockingFactor () / 100;
+		// How many iterations between each progress update
+		unsigned int progress_interval = A.rowdim () / _traits.blockingFactor () / 100;
 
-	// Make sure there are a minimum of ten
-	if (progress_interval == 0)
-		progress_interval = 1;
+		// Make sure there are a minimum of ten
+		if (progress_interval == 0)
+			progress_interval = 1;
 
-	// i is the index for temporaries where we need to go back to i - 1
-	// j is the index for temporaries where we need to go back to j - 2
-	int i = 0, j = 2, next_j, prev_j = 1, iter = 2;
-	typename Matrix::ColIterator k;
+		// i is the index for temporaries where we need to go back to i - 1
+		// j is the index for temporaries where we need to go back to j - 2
+		int i = 0, j = 2, next_j, prev_j = 1, iter = 2;
+		typename Matrix::ColIterator k;
 
-	TIMER_DECLARE(AV);
-	TIMER_DECLARE(innerProducts);
-	TIMER_DECLARE(Winv);
-	TIMER_DECLARE(Vnext);
-	TIMER_DECLARE(solution);
-	TIMER_DECLARE(orthogonalization);
-	TIMER_DECLARE(terminationCheck);
+		TIMER_DECLARE(AV);
+		TIMER_DECLARE(innerProducts);
+		TIMER_DECLARE(Winv);
+		TIMER_DECLARE(Vnext);
+		TIMER_DECLARE(solution);
+		TIMER_DECLARE(orthogonalization);
+		TIMER_DECLARE(terminationCheck);
 
-	// Get a random fat vector _V[0]
-	RandomDenseStream<Field, typename Matrix::Col> stream (_F, _randiter, A.coldim ());
+		// Get a random fat vector _V[0]
+		RandomDenseStream<Field, typename Matrix::Col> stream (_F, _randiter, A.coldim ());
 
-	for (k = _V[0].colBegin (); k != _V[0].colEnd (); ++k)
-		stream >> *k;
+		for (k = _V[0].colBegin (); k != _V[0].colEnd (); ++k)
+			stream >> *k;
 
-	TIMER_START(AV);
-	_MD.blackboxMulLeft (_AV, A, _V[0]);
-	TIMER_STOP(AV);
+		TIMER_START(AV);
+		_MD.blackboxMulLeft (_AV, A, _V[0]);
+		TIMER_STOP(AV);
 
-	std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+		std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
 
-	// Initialize S_-1 to IN
-	std::fill (_S.begin (), _S.end (), true);
+		// Initialize S_-1 to IN
+		std::fill (_S.begin (), _S.end (), true);
 
-	// Iteration 1
-	TIMER_START(innerProducts);
-	_MD.mul (_VTAV, transpose (_V[0]), _AV);
-	TIMER_STOP(innerProducts);
+		// Iteration 1
+		TIMER_START(innerProducts);
+		_MD.mul (_VTAV, transpose (_V[0]), _AV);
+		TIMER_STOP(innerProducts);
 
-	TIMER_START(Winv);
-	Ni = compute_Winv_S (_Winv[0], _S, _VTAV);
-	TIMER_STOP(Winv);
+		TIMER_START(Winv);
+		Ni = compute_Winv_S (_Winv[0], _S, _VTAV);
+		TIMER_STOP(Winv);
 
-	// Check for catastrophic breakdown
-	if (Ni == 0) {
-		commentator.stop ("breakdown", NULL, "MGBlockLanczosSolver::iterate");
-		return false;
-	}
+		// Check for catastrophic breakdown
+		if (Ni == 0) {
+			commentator.stop ("breakdown", NULL, "MGBlockLanczosSolver::iterate");
+			return false;
+		}
 
-	total_dim += Ni;
+		total_dim += Ni;
 
 #ifdef MGBL_DETAILED_TRACE
-	report << "Iteration " << iter << ": N_i = " << Ni << std::endl;
-	report << "Iteration " << iter << ": Total dimension is " << total_dim << std::endl;
+		report << "Iteration " << iter << ": N_i = " << Ni << std::endl;
+		report << "Iteration " << iter << ": Total dimension is " << total_dim << std::endl;
 #endif
 
-	TransposeMatrix<Matrix> tmpT (_tmp);
-	TransposeMatrix<Matrix> tmp1T (_tmp1);
+		TransposeMatrix<Matrix> tmpT (_tmp);
+		TransposeMatrix<Matrix> tmp1T (_tmp1);
 
-	TIMER_START(solution);
-	mul (tmpT, transpose (_b), _V[0], _S);
-	_MD.mul (_tmp1, _Winv[0], _tmp);
-	mul_SST (tmp1T, tmp1T, _S);
-	_MD.mul (_x, _V[0], _tmp1);
-	TIMER_STOP(solution);
+		TIMER_START(solution);
+		mul (tmpT, transpose (_b), _V[0], _S);
+		_MD.mul (_tmp1, _Winv[0], _tmp);
+		mul_SST (tmp1T, tmp1T, _S);
+		_MD.mul (_x, _V[0], _tmp1);
+		TIMER_STOP(solution);
 
-	TIMER_START(Vnext);
-	mul_SST (_V[1], _AV, _S);
-	TIMER_STOP(Vnext);
+		TIMER_START(Vnext);
+		mul_SST (_V[1], _AV, _S);
+		TIMER_STOP(Vnext);
 
-	TIMER_START(innerProducts);
-	mul (_AVTAVSST_VTAV, transpose (_AV), _AV, _S);
-	TIMER_STOP(innerProducts);
+		TIMER_START(innerProducts);
+		mul (_AVTAVSST_VTAV, transpose (_AV), _AV, _S);
+		TIMER_STOP(innerProducts);
 
-//	MGBLTraceReport (report, _MD, "V", 0, _V[0]);
-//	MGBLTraceReport (report, _MD, "AV", 0, _AV);
-	MGBLTraceReport (report, _MD, "V^T A V", 0, _VTAV);
-	MGBLTraceReport (report, _MD, "Winv", 0, _Winv[0]);
-	reportS (report, _S, 0);
-//	MGBLTraceReport (report, _MD, "x", 0, _x);
-	MGBLTraceReport (report, _MD, "AVSS^T", 0, _V[1]);
-	MGBLTraceReport (report, _MD, "V^T A^2 V", 0, _AVTAVSST_VTAV);
+		//	MGBLTraceReport (report, _MD, "V", 0, _V[0]);
+		//	MGBLTraceReport (report, _MD, "AV", 0, _AV);
+		MGBLTraceReport (report, _MD, "V^T A V", 0, _VTAV);
+		MGBLTraceReport (report, _MD, "Winv", 0, _Winv[0]);
+		reportS (report, _S, 0);
+		//	MGBLTraceReport (report, _MD, "x", 0, _x);
+		MGBLTraceReport (report, _MD, "AVSS^T", 0, _V[1]);
+		MGBLTraceReport (report, _MD, "V^T A^2 V", 0, _AVTAVSST_VTAV);
 
-	TIMER_START(orthogonalization);
-	_MD.addin (_AVTAVSST_VTAV, _VTAV);
-	_MD.mul (_DEF, _Winv[0], _AVTAVSST_VTAV);
-	addIN (_DEF);
+		TIMER_START(orthogonalization);
+		_MD.addin (_AVTAVSST_VTAV, _VTAV);
+		_MD.mul (_DEF, _Winv[0], _AVTAVSST_VTAV);
+		addIN (_DEF);
 
-	_MD.axpyin (_V[1], _V[0], _DEF);
-	TIMER_START(orthogonalization);
+		_MD.axpyin (_V[1], _V[0], _DEF);
+		TIMER_START(orthogonalization);
 
-	MGBLTraceReport (report, _MD, "D", 1, _DEF);
+		MGBLTraceReport (report, _MD, "D", 1, _DEF);
 
-//	MGBLTraceReport (report, _MD, "V", 1, _V[1]);
-	checkAConjugacy (_MD, _AV, _V[1], _DEF, 0, 1);
+		//	MGBLTraceReport (report, _MD, "V", 1, _V[1]);
+		checkAConjugacy (_MD, _AV, _V[1], _DEF, 0, 1);
 
-	TIMER_START(terminationCheck);
-	done = _MD.isZero (_V[1]);
-	TIMER_STOP(terminationCheck);
+		TIMER_START(terminationCheck);
+		done = _MD.isZero (_V[1]);
+		TIMER_STOP(terminationCheck);
 
-	if (done) {
-		commentator.stop ("done", NULL, "MGBlockLanczosSolver::iterate");
-		return true;
-	}
+		if (done) {
+			commentator.stop ("done", NULL, "MGBlockLanczosSolver::iterate");
+			return true;
+		}
 
-	// Iteration 2
-	TIMER_START(AV);
-	_MD.blackboxMulLeft (_AV, A, _V[1]);
-	TIMER_STOP(AV);
+		// Iteration 2
+		TIMER_START(AV);
+		_MD.blackboxMulLeft (_AV, A, _V[1]);
+		TIMER_STOP(AV);
 
 #ifdef MGBL_DETAILED_TRACE
- 	// DEBUG: Save a copy of AV_1 for use later
-	Matrix AV1_backup (_AV.rowdim (), _AV.coldim ());
-	_MD.copy (AV1_backup, _AV);
+		// DEBUG: Save a copy of AV_1 for use later
+		Matrix AV1_backup (_AV.rowdim (), _AV.coldim ());
+		_MD.copy (AV1_backup, _AV);
 #endif
 
-	TIMER_START(innerProducts);
-	_MD.mul (_VTAV, transpose (_V[1]), _AV);
-	TIMER_STOP(innerProducts);
+		TIMER_START(innerProducts);
+		_MD.mul (_VTAV, transpose (_V[1]), _AV);
+		TIMER_STOP(innerProducts);
 
-	TIMER_START(Winv);
-	Ni = compute_Winv_S (_Winv[1], _S, _VTAV);
-	TIMER_STOP(Winv);
+		TIMER_START(Winv);
+		Ni = compute_Winv_S (_Winv[1], _S, _VTAV);
+		TIMER_STOP(Winv);
 
-	// Check for catastrophic breakdown
-	if (Ni == 0) {
-		commentator.stop ("breakdown", NULL, "MGBlockLanczosSolver::iterate");
-		return false;
-	}
+		// Check for catastrophic breakdown
+		if (Ni == 0) {
+			commentator.stop ("breakdown", NULL, "MGBlockLanczosSolver::iterate");
+			return false;
+		}
 
-	total_dim += Ni;
+		total_dim += Ni;
 
 #ifdef MGBL_DETAILED_TRACE
-	report << "Iteration " << iter << ": N_i = " << Ni << std::endl;
-	report << "Iteration " << iter << ": Total dimension is " << total_dim << std::endl;
+		report << "Iteration " << iter << ": N_i = " << Ni << std::endl;
+		report << "Iteration " << iter << ": Total dimension is " << total_dim << std::endl;
 #endif
 
-	TIMER_START(solution);
-	mul (tmpT, transpose (_b), _V[1], _S);
-	_MD.mul (_tmp1, _Winv[1], _tmp);
-	mul_SST (tmp1T, tmp1T, _S);
-	_MD.axpyin (_x, _V[1], _tmp1);
-	TIMER_STOP(solution);
+		TIMER_START(solution);
+		mul (tmpT, transpose (_b), _V[1], _S);
+		_MD.mul (_tmp1, _Winv[1], _tmp);
+		mul_SST (tmp1T, tmp1T, _S);
+		_MD.axpyin (_x, _V[1], _tmp1);
+		TIMER_STOP(solution);
 
-	TIMER_START(Vnext);
-	mul_SST (_V[2], _AV, _S);
-	TIMER_STOP(Vnext);
+		TIMER_START(Vnext);
+		mul_SST (_V[2], _AV, _S);
+		TIMER_STOP(Vnext);
 
-	TIMER_START(innerProducts);
-	mul (_AVTAVSST_VTAV, transpose (_AV), _AV, _S);
-	TIMER_STOP(innerProducts);
+		TIMER_START(innerProducts);
+		mul (_AVTAVSST_VTAV, transpose (_AV), _AV, _S);
+		TIMER_STOP(innerProducts);
 
-//	MGBLTraceReport (report, _MD, "AV", 1, _AV);
-	MGBLTraceReport (report, _MD, "V^T A V", 1, _VTAV);
-	MGBLTraceReport (report, _MD, "Winv", 1, _Winv[1]);
-	reportS (report, _S, 1);
-//	MGBLTraceReport (report, _MD, "x", 1, _x);
-	MGBLTraceReport (report, _MD, "V^T A^2 V", 1, _AVTAVSST_VTAV);
+		//	MGBLTraceReport (report, _MD, "AV", 1, _AV);
+		MGBLTraceReport (report, _MD, "V^T A V", 1, _VTAV);
+		MGBLTraceReport (report, _MD, "Winv", 1, _Winv[1]);
+		reportS (report, _S, 1);
+		//	MGBLTraceReport (report, _MD, "x", 1, _x);
+		MGBLTraceReport (report, _MD, "V^T A^2 V", 1, _AVTAVSST_VTAV);
 
-	TIMER_START(orthogonalization);
-	_MD.addin (_AVTAVSST_VTAV, _VTAV);
-	_MD.mul (_DEF, _Winv[1], _AVTAVSST_VTAV);
-	addIN (_DEF);
-	_MD.axpyin (_V[2], _V[1], _DEF);
+		TIMER_START(orthogonalization);
+		_MD.addin (_AVTAVSST_VTAV, _VTAV);
+		_MD.mul (_DEF, _Winv[1], _AVTAVSST_VTAV);
+		addIN (_DEF);
+		_MD.axpyin (_V[2], _V[1], _DEF);
 
-	MGBLTraceReport (report, _MD, "D", 2, _DEF);
+		MGBLTraceReport (report, _MD, "D", 2, _DEF);
 
-	mul (_DEF, _Winv[0], _VTAV, _S);
-	_MD.axpyin (_V[2], _V[0], _DEF);
-	TIMER_STOP(orthogonalization);
+		mul (_DEF, _Winv[0], _VTAV, _S);
+		_MD.axpyin (_V[2], _V[0], _DEF);
+		TIMER_STOP(orthogonalization);
 
-	MGBLTraceReport (report, _MD, "E", 2, _DEF);
-//	MGBLTraceReport (report, _MD, "V", 2, _V[2]);
+		MGBLTraceReport (report, _MD, "E", 2, _DEF);
+		//	MGBLTraceReport (report, _MD, "V", 2, _V[2]);
 
-	checkAConjugacy (_MD, _AV, _V[2], _DEF, 1, 2);
+		checkAConjugacy (_MD, _AV, _V[2], _DEF, 1, 2);
 
-	// Now we're ready to begin the real iteration
-	while (1) {
-		TIMER_START(terminationCheck);
-		done = _MD.isZero (_V[j]);
-		TIMER_STOP(terminationCheck);
+		// Now we're ready to begin the real iteration
+		while (1) {
+			TIMER_START(terminationCheck);
+			done = _MD.isZero (_V[j]);
+			TIMER_STOP(terminationCheck);
 
-		if (done) break;
+			if (done) break;
 
-		next_j = j + 1;
-		if (next_j > 2) next_j = 0;
+			next_j = j + 1;
+			if (next_j > 2) next_j = 0;
 
-		TIMER_START(AV);
-		_MD.blackboxMulLeft (_AV, A, _V[j]);
-		TIMER_STOP(AV);
+			TIMER_START(AV);
+			_MD.blackboxMulLeft (_AV, A, _V[j]);
+			TIMER_STOP(AV);
 
-		// First compute F_i+1, where we use Winv_i-2; then Winv_i and
-		// Winv_i-2 can share storage, and we don't need the old _VTAV
-		// and _AVTAVSST_VTAV any more. After this, F_i+1 is stored in
-		// _DEF
+			// First compute F_i+1, where we use Winv_i-2; then Winv_i and
+			// Winv_i-2 can share storage, and we don't need the old _VTAV
+			// and _AVTAVSST_VTAV any more. After this, F_i+1 is stored in
+			// _DEF
 
-		TIMER_START(orthogonalization);
-		_MD.mul (_T, _VTAV, _Winv[1 - i]);
-		addIN (_T);
-		_MD.mul (_DEF, _Winv[i], _T);
-		_MD.mulin (_DEF, _AVTAVSST_VTAV);
-		TIMER_STOP(orthogonalization);
+			TIMER_START(orthogonalization);
+			_MD.mul (_T, _VTAV, _Winv[1 - i]);
+			addIN (_T);
+			_MD.mul (_DEF, _Winv[i], _T);
+			_MD.mulin (_DEF, _AVTAVSST_VTAV);
+			TIMER_STOP(orthogonalization);
 
-		// Now get the next VTAV, Winv, and S_i
-		TIMER_START(innerProducts);
-		_MD.mul (_VTAV, transpose (_V[j]), _AV);
-		TIMER_STOP(innerProducts);
+			// Now get the next VTAV, Winv, and S_i
+			TIMER_START(innerProducts);
+			_MD.mul (_VTAV, transpose (_V[j]), _AV);
+			TIMER_STOP(innerProducts);
 
-		TIMER_START(Winv);
-		Ni = compute_Winv_S (_Winv[i], _S, _VTAV);
-		TIMER_STOP(Winv);
+			TIMER_START(Winv);
+			Ni = compute_Winv_S (_Winv[i], _S, _VTAV);
+			TIMER_STOP(Winv);
 
-		// Check for catastrophic breakdown
-		if (Ni == 0) {
-			ret = false;
-			break;
-		}
+			// Check for catastrophic breakdown
+			if (Ni == 0) {
+				ret = false;
+				break;
+			}
 
-		total_dim += Ni;
+			total_dim += Ni;
 
 #ifdef MGBL_DETAILED_TRACE
-		report << "Iteration " << iter << ": N_i = " << Ni << std::endl;
-		report << "Iteration " << iter << ": Total dimension is " << total_dim << std::endl;
+			report << "Iteration " << iter << ": N_i = " << Ni << std::endl;
+			report << "Iteration " << iter << ": Total dimension is " << total_dim << std::endl;
 #endif
 
-//		MGBLTraceReport (report, _MD, "AV", iter, _AV);
-		MGBLTraceReport (report, _MD, "F", iter + 1, _DEF);
-		MGBLTraceReport (report, _MD, "V^T AV", iter, _VTAV);
-		MGBLTraceReport (report, _MD, "Winv", iter, _Winv[i]);
-		reportS (report, _S, iter);
+			//		MGBLTraceReport (report, _MD, "AV", iter, _AV);
+			MGBLTraceReport (report, _MD, "F", iter + 1, _DEF);
+			MGBLTraceReport (report, _MD, "V^T AV", iter, _VTAV);
+			MGBLTraceReport (report, _MD, "Winv", iter, _Winv[i]);
+			reportS (report, _S, iter);
 
-		// Now that we have S_i, finish off with F_i+1
-		TIMER_START(orthogonalization);
-		mulin (_V[next_j], _DEF, _S);
-		TIMER_STOP(orthogonalization);
+			// Now that we have S_i, finish off with F_i+1
+			TIMER_START(orthogonalization);
+			mulin (_V[next_j], _DEF, _S);
+			TIMER_STOP(orthogonalization);
 
-		// Update x
-		TIMER_START(solution);
-		mul (tmpT, transpose (_b), _V[j], _S);
-		_MD.mul (_tmp1, _Winv[i], _tmp);
-		mul_SST (tmp1T, tmp1T, _S);
-		_MD.axpyin (_x, _V[j], _tmp1);
-		TIMER_STOP(solution);
+			// Update x
+			TIMER_START(solution);
+			mul (tmpT, transpose (_b), _V[j], _S);
+			_MD.mul (_tmp1, _Winv[i], _tmp);
+			mul_SST (tmp1T, tmp1T, _S);
+			_MD.axpyin (_x, _V[j], _tmp1);
+			TIMER_STOP(solution);
 
-//		MGBLTraceReport (report, _MD, "x", iter, _x);
+			//		MGBLTraceReport (report, _MD, "x", iter, _x);
 
-		// Compute the next _AVTAVSST_VTAV
-		TIMER_START(innerProducts);
-		mul (_AVTAVSST_VTAV, transpose (_AV), _AV, _S);
-		TIMER_STOP(innerProducts);
+			// Compute the next _AVTAVSST_VTAV
+			TIMER_START(innerProducts);
+			mul (_AVTAVSST_VTAV, transpose (_AV), _AV, _S);
+			TIMER_STOP(innerProducts);
 
-		MGBLTraceReport (report, _MD, "V^T A^2 V", iter, _AVTAVSST_VTAV);
+			MGBLTraceReport (report, _MD, "V^T A^2 V", iter, _AVTAVSST_VTAV);
 
-		TIMER_START(orthogonalization);
-		_MD.addin (_AVTAVSST_VTAV, _VTAV);
+			TIMER_START(orthogonalization);
+			_MD.addin (_AVTAVSST_VTAV, _VTAV);
 
-		// Compute D and update V_i+1
-		_MD.mul (_DEF, _Winv[i], _AVTAVSST_VTAV);
-		addIN (_DEF);
-		_MD.axpyin (_V[next_j], _V[j], _DEF);
+			// Compute D and update V_i+1
+			_MD.mul (_DEF, _Winv[i], _AVTAVSST_VTAV);
+			addIN (_DEF);
+			_MD.axpyin (_V[next_j], _V[j], _DEF);
 
-		MGBLTraceReport (report, _MD, "D", iter + 1, _DEF);
+			MGBLTraceReport (report, _MD, "D", iter + 1, _DEF);
 
-		// Compute E and update V_i+1
-		mul (_DEF, _Winv[1 - i], _VTAV, _S);
-		_MD.axpyin (_V[next_j], _V[prev_j], _DEF);
-		TIMER_STOP(orthogonalization);
+			// Compute E and update V_i+1
+			mul (_DEF, _Winv[1 - i], _VTAV, _S);
+			_MD.axpyin (_V[next_j], _V[prev_j], _DEF);
+			TIMER_STOP(orthogonalization);
 
-		MGBLTraceReport (report, _MD, "E", iter + 1, _DEF);
+			MGBLTraceReport (report, _MD, "E", iter + 1, _DEF);
 
-		// Add AV_i S_i S_i^T
-		TIMER_START(Vnext);
-		addin (_V[next_j], _AV, _S);
-		TIMER_STOP(Vnext);
+			// Add AV_i S_i S_i^T
+			TIMER_START(Vnext);
+			addin (_V[next_j], _AV, _S);
+			TIMER_STOP(Vnext);
 
-//		MGBLTraceReport (report, _MD, "V", iter + 1, _V[next_j]);
-		checkAConjugacy (_MD, _AV, _V[next_j], _DEF, iter, iter + 1);
+			//		MGBLTraceReport (report, _MD, "V", iter + 1, _V[next_j]);
+			checkAConjugacy (_MD, _AV, _V[next_j], _DEF, iter, iter + 1);
 
 #ifdef MGBL_DETAILED_TRACE
-		checkAConjugacy (_MD, AV1_backup, _V[next_j], _DEF, 1, iter + 1);
+			checkAConjugacy (_MD, AV1_backup, _V[next_j], _DEF, 1, iter + 1);
 #endif
 
-		i = 1 - i;
-		prev_j = j;
-		j = next_j;
-		++iter;
+			i = 1 - i;
+			prev_j = j;
+			j = next_j;
+			++iter;
 
-		if (!(iter % progress_interval))
-			commentator.progress (total_dim);
+			if (!(iter % progress_interval))
+				commentator.progress (total_dim);
 
-		if (total_dim > A.rowdim ()) {
-			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+			if (total_dim > A.rowdim ()) {
+				commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
 				<< "Maximum number of iterations passed without termination" << std::endl;
-			commentator.stop ("ERROR", NULL, "MGBlockLanczosSolver::iterate");
-			return false;
+				commentator.stop ("ERROR", NULL, "MGBlockLanczosSolver::iterate");
+				return false;
+			}
 		}
-	}
 
-	// Because we set Winv to -Winv, we have -x at the end of the
-	// iteration. So negate the result and return it
-	_MD.negin (_x);
+		// Because we set Winv to -Winv, we have -x at the end of the
+		// iteration. So negate the result and return it
+		_MD.negin (_x);
 
-//	MGBLTraceReport (report, _MD, "x", iter, _x);
+		//	MGBLTraceReport (report, _MD, "x", iter, _x);
 
-	TIMER_REPORT(AV);
-	TIMER_REPORT(innerProducts);
-	TIMER_REPORT(Winv);
-	TIMER_REPORT(Vnext);
-	TIMER_REPORT(solution);
-	TIMER_REPORT(orthogonalization);
-	TIMER_REPORT(terminationCheck);
+		TIMER_REPORT(AV);
+		TIMER_REPORT(innerProducts);
+		TIMER_REPORT(Winv);
+		TIMER_REPORT(Vnext);
+		TIMER_REPORT(solution);
+		TIMER_REPORT(orthogonalization);
+		TIMER_REPORT(terminationCheck);
 
-	commentator.stop (ret ? "done" : "breakdown", NULL, "MGBlockLanczosSolver::iterate");
+		commentator.stop (ret ? "done" : "breakdown", NULL, "MGBlockLanczosSolver::iterate");
 
-	return ret;
-}
+		return ret;
+	}
 
-template <class Field, class Matrix>
-int MGBlockLanczosSolver<Field, Matrix>::compute_Winv_S
+	template <class Field, class Matrix>
+	inline int MGBlockLanczosSolver<Field, Matrix>::compute_Winv_S
 	(Matrix        &Winv,
 	 std::vector<bool>                               &S,
 	 const Matrix  &T)
-{
-	linbox_check (S.size () == Winv.rowdim ());
-	linbox_check (S.size () == Winv.coldim ());
-	linbox_check (S.size () == T.rowdim ());
-	linbox_check (S.size () == T.coldim ());
-	linbox_check (S.size () == _M.rowdim ());
-	linbox_check (S.size () * 2 == _M.coldim ());
+	{
+		linbox_check (S.size () == Winv.rowdim ());
+		linbox_check (S.size () == Winv.coldim ());
+		linbox_check (S.size () == T.rowdim ());
+		linbox_check (S.size () == T.coldim ());
+		linbox_check (S.size () == _M.rowdim ());
+		linbox_check (S.size () * 2 == _M.coldim ());
 
 #ifdef MGBL_DETAILED_TRACE
-	commentator.start ("Computing Winv and S", "MGBlockLanczosSolver::compute_Winv_S", S.size ());
+		commentator.start ("Computing Winv and S", "MGBlockLanczosSolver::compute_Winv_S", S.size ());
 
-	std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-	report << "Input T:" << std::endl;
-	_MD.write (report, T);
+		std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+		report << "Input T:" << std::endl;
+		_MD.write (report, T);
 #endif
 
-	DenseSubmatrix<Element> M1 (_M, 0, 0, T.rowdim (), T.coldim ());
-	DenseSubmatrix<Element> M2 (_M, 0, T.coldim (), T.rowdim (), T.coldim ());
+		DenseSubmatrix<Element> M1 (_M, 0, 0, T.rowdim (), T.coldim ());
+		DenseSubmatrix<Element> M2 (_M, 0, T.coldim (), T.rowdim (), T.coldim ());
 
-	_MD.copy (M1, T);
-	setIN (M2);
+		_MD.copy (M1, T);
+		setIN (M2);
 
-	permute (_indices, S);
+		permute (_indices, S);
 
-	typename Field::Element Mjj_inv;
+		typename Field::Element Mjj_inv;
 
-	size_t row;
-	size_t Ni = 0;
+		size_t row;
+		size_t Ni = 0;
 
-	for (row = 0; row < S.size (); ++row) {
+		for (row = 0; row < S.size (); ++row) {
 #ifdef MGBL_DETAILED_TRACE
-		if (!(row & ((1 << 10) - 1)))
-			commentator.progress (row);
+			if (!(row & ((1 << 10) - 1)))
+				commentator.progress (row);
 
-		std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-		report << "Iteration " << row << ": Matrix M = " << std::endl;
-		_MD.write (report, _M);
+			std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+			report << "Iteration " << row << ": Matrix M = " << std::endl;
+			_MD.write (report, _M);
 #endif
 
-		if (find_pivot_row (_M, row, 0, _indices)) {
+			if (find_pivot_row (_M, row, 0, _indices)) {
 #ifdef MGBL_DETAILED_TRACE
-			commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION)
+				commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION)
 				<< "Pivot found for column " << _indices[row] << std::endl;
 #endif
 
-			// Pivot element was found for (j, j)
+				// Pivot element was found for (j, j)
 
-			S[_indices[row]] = true;  // Use column j of V_i in W_i
+				S[_indices[row]] = true;  // Use column j of V_i in W_i
 
-			// Give the (j, j) entry unity
-			_F.inv (Mjj_inv, _M.getEntry (_indices[row], _indices[row]));
-			_VD.mulin (*(_M.rowBegin () + _indices[row]), Mjj_inv);
+				// Give the (j, j) entry unity
+				_F.inv (Mjj_inv, _M.getEntry (_indices[row], _indices[row]));
+				_VD.mulin (*(_M.rowBegin () + _indices[row]), Mjj_inv);
 
-			// Zero the rest of the column j
-			eliminate_col (_M, row, 0, _indices, Mjj_inv);
+				// Zero the rest of the column j
+				eliminate_col (_M, row, 0, _indices, Mjj_inv);
 
-			++Ni;
-		} else {
+				++Ni;
+			}
+			else {
 #ifdef MGBL_DETAILED_TRACE
-			commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+				commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
 				<< "No pivot found for column " << _indices[row] << std::endl;
 #endif
 
-			// No pivot element found
+				// No pivot element found
 
-			S[_indices[row]] = false;  // Skip column j
+				S[_indices[row]] = false;  // Skip column j
 
-			find_pivot_row (_M, row, _N, _indices);
+				find_pivot_row (_M, row, _N, _indices);
 
-			const typename Field::Element &Mjj = _M.refEntry (_indices[row], _indices[row] + _N);
+				const typename Field::Element &Mjj = _M.refEntry (_indices[row], _indices[row] + _N);
 
-			linbox_check (!_F.isZero (Mjj));
+				linbox_check (!_F.isZero (Mjj));
 
-			// Zero the rest of the column j + N
-			eliminate_col (_M, row, _N, _indices, _F.inv (Mjj_inv, Mjj));
+				// Zero the rest of the column j + N
+				eliminate_col (_M, row, _N, _indices, _F.inv (Mjj_inv, Mjj));
 
-			// Zero row j
-			_VD.subin (*(_M.rowBegin () + _indices[row]), *(_M.rowBegin () + _indices[row]));
+				// Zero row j
+				_VD.subin (*(_M.rowBegin () + _indices[row]), *(_M.rowBegin () + _indices[row]));
+			}
 		}
-	}
 
-	_MD.neg (Winv, M2);
+		_MD.neg (Winv, M2);
 
 #ifdef MGBL_DETAILED_TRACE
-	report << "Computed Winv:" << std::endl;
-	_MD.write (report, Winv);
+		report << "Computed Winv:" << std::endl;
+		_MD.write (report, Winv);
 
-	commentator.stop ("done", NULL, "MGBlockLanczosSolver::compute_Winv_S");
+		commentator.stop ("done", NULL, "MGBlockLanczosSolver::compute_Winv_S");
 #endif
 
-	return Ni;
-}
+		return Ni;
+	}
 
-template <class Field, class Matrix>
-template <class Matrix1, class Matrix2>
-Matrix1 &MGBlockLanczosSolver<Field, Matrix>::mul_SST
+	template <class Field, class Matrix>
+	template <class Matrix1, class Matrix2>
+	inline Matrix1 &MGBlockLanczosSolver<Field, Matrix>::mul_SST
 	(Matrix1                 &BSST,
 	 const Matrix2           &B,
 	 const std::vector<bool> &S) const
-{
-	linbox_check (B.rowdim () == BSST.rowdim ());
-	linbox_check (B.coldim () == BSST.coldim ());
-	linbox_check (B.coldim () == S.size ());
+	{
+		linbox_check (B.rowdim () == BSST.rowdim ());
+		linbox_check (B.coldim () == BSST.coldim ());
+		linbox_check (B.coldim () == S.size ());
 
-	typename Matrix2::ConstColIterator i;
-	typename Matrix1::ColIterator j;
-	std::vector<bool>::const_iterator k;
+		typename Matrix2::ConstColIterator i;
+		typename Matrix1::ColIterator j;
+		std::vector<bool>::const_iterator k;
 
-	for (i = B.colBegin (), j = BSST.colBegin (), k = S.begin ();
-	     i != B.colEnd ();
-	     ++i, ++j, ++k)
-	{
-		if (*k)
-			_VD.copy (*j, *i);
-		else
-			_VD.subin (*j, *j);
-	}
+		for (i = B.colBegin (), j = BSST.colBegin (), k = S.begin ();
+		     i != B.colEnd ();
+		     ++i, ++j, ++k)
+		{
+			if (*k)
+				_VD.copy (*j, *i);
+			else
+				_VD.subin (*j, *j);
+		}
 
-	return BSST;
-}
+		return BSST;
+	}
 
-template <class Field, class Matrix>
-template <class Matrix1, class Matrix2, class Matrix3>
-Matrix1 &MGBlockLanczosSolver<Field, Matrix>::mul
+	template <class Field, class Matrix>
+	template <class Matrix1, class Matrix2, class Matrix3>
+	inline Matrix1 &MGBlockLanczosSolver<Field, Matrix>::mul
 	(Matrix1                 &C,
 	 const Matrix2           &A,
 	 const Matrix3           &B,
 	 const std::vector<bool> &S) const
-{
-	linbox_check (A.coldim () == B.rowdim ());
-	linbox_check (A.rowdim () == C.rowdim ());
-	linbox_check (B.coldim () == C.coldim ());
-
-	typename Matrix2::ConstRowIterator i;
-	typename Matrix3::ConstColIterator j;
-	typename Matrix1::ColIterator k1;
-	typename Matrix1::Col::iterator k2;
-	std::vector<bool>::const_iterator l;
-
-	for (j = B.colBegin (), l = S.begin (), k1 = C.colBegin ();
-	     j != B.colEnd ();
-	     ++j, ++l, ++k1)
 	{
-		if (*l) {
-			for (i = A.rowBegin (), k2 = k1->begin (); i != A.rowEnd (); ++i, ++k2)
-				_VD.dot (*k2, *i, *j);
-		} else
-			_VD.subin (*k1, *k1);
-	}
+		linbox_check (A.coldim () == B.rowdim ());
+		linbox_check (A.rowdim () == C.rowdim ());
+		linbox_check (B.coldim () == C.coldim ());
 
-	return C;
-}
+		typename Matrix2::ConstRowIterator i;
+		typename Matrix3::ConstColIterator j;
+		typename Matrix1::ColIterator k1;
+		typename Matrix1::Col::iterator k2;
+		std::vector<bool>::const_iterator l;
 
-template <class Field, class Matrix>
-template <class Matrix1, class Matrix2>
-Matrix1 &MGBlockLanczosSolver<Field, Matrix>::mulin
+		for (j = B.colBegin (), l = S.begin (), k1 = C.colBegin ();
+		     j != B.colEnd ();
+		     ++j, ++l, ++k1)
+		{
+			if (*l) {
+				for (i = A.rowBegin (), k2 = k1->begin (); i != A.rowEnd (); ++i, ++k2)
+					_VD.dot (*k2, *i, *j);
+			}
+			else
+				_VD.subin (*k1, *k1);
+		}
+
+		return C;
+	}
+
+	template <class Field, class Matrix>
+	template <class Matrix1, class Matrix2>
+	inline Matrix1 &MGBlockLanczosSolver<Field, Matrix>::mulin
 	(Matrix1                 &A,
 	 const Matrix2           &B,
 	 const std::vector<bool> &S) const
-{
-	linbox_check (A.coldim () == B.rowdim ());
-	linbox_check (B.rowdim () == B.coldim ());
-	linbox_check (A.coldim () == S.size ());
+	{
+		linbox_check (A.coldim () == B.rowdim ());
+		linbox_check (B.rowdim () == B.coldim ());
+		linbox_check (A.coldim () == S.size ());
 
-	typename Matrix1::RowIterator i;
-	typename Matrix2::ConstColIterator j;
-	typename Vector<Field>::Dense::iterator k;
-	std::vector<bool>::const_iterator l;
+		typename Matrix1::RowIterator i;
+		typename Matrix2::ConstColIterator j;
+		typename Vector<Field>::Dense::iterator k;
+		std::vector<bool>::const_iterator l;
 
-	typename LinBox::Vector<Field>::Dense tmp (_traits.blockingFactor ());
+		typename LinBox::Vector<Field>::Dense tmp (_traits.blockingFactor ());
 
-	for (i = A.rowBegin (); i != A.rowEnd (); ++i) {
-		for (j = B.colBegin (), k = tmp.begin (), l = S.begin ();
-		     j != B.colEnd ();
-		     ++j, ++k, ++l)
-		{
-			if (*l)
-				_VD.dot (*k, *i, *j);
-			else
-				_F.subin (*k, *k);
+		for (i = A.rowBegin (); i != A.rowEnd (); ++i) {
+			for (j = B.colBegin (), k = tmp.begin (), l = S.begin ();
+			     j != B.colEnd ();
+			     ++j, ++k, ++l)
+			{
+				if (*l)
+					_VD.dot (*k, *i, *j);
+				else
+					_F.subin (*k, *k);
+			}
+
+			_VD.copy (*i, tmp);
 		}
 
-		_VD.copy (*i, tmp);
+		return A;
 	}
 
-	return A;
-}
-
-template <class Field, class Matrix>
-template <class Vector1, class Matrix1, class Vector2>
-Vector1 &MGBlockLanczosSolver<Field, Matrix>::vectorMul
+	template <class Field, class Matrix>
+	template <class Vector1, class Matrix1, class Vector2>
+	inline Vector1 &MGBlockLanczosSolver<Field, Matrix>::vectorMul
 	(Vector1                 &w,
 	 const Matrix1           &A,
 	 const Vector2           &v,
 	 const std::vector<bool> &S) const
-{
-	linbox_check (A.coldim () == v.size ());
-	linbox_check (A.rowdim () == w.size ());
+	{
+		linbox_check (A.coldim () == v.size ());
+		linbox_check (A.rowdim () == w.size ());
 
-	typename Matrix1::ConstColIterator i = A.colBegin ();
-	typename Vector2::const_iterator j = v.begin ();
-	typename std::vector<bool>::const_iterator k = S.begin ();
+		typename Matrix1::ConstColIterator i = A.colBegin ();
+		typename Vector2::const_iterator j = v.begin ();
+		typename std::vector<bool>::const_iterator k = S.begin ();
 
-	_VD.subin (w, w);
+		_VD.subin (w, w);
 
-	for (; j != v.end (); ++j, ++i, ++k)
-		if (*k)
-			_VD.axpyin (w, *j, *i);
+		for (; j != v.end (); ++j, ++i, ++k)
+			if (*k)
+				_VD.axpyin (w, *j, *i);
 
-	return w;
-}
+		return w;
+	}
 
-template <class Field, class Matrix>
-template <class Vector1, class Matrix1, class Vector2>
-Vector1 &MGBlockLanczosSolver<Field, Matrix>::vectorMulTranspose
+	template <class Field, class Matrix>
+	template <class Vector1, class Matrix1, class Vector2>
+	inline Vector1 &MGBlockLanczosSolver<Field, Matrix>::vectorMulTranspose
 	(Vector1                 &w,
 	 const Matrix1           &A,
 	 const Vector2           &v,
 	 const std::vector<bool> &S) const
-{
-	linbox_check (A.rowdim () == v.size ());
-	linbox_check (A.coldim () == w.size ());
+	{
+		linbox_check (A.rowdim () == v.size ());
+		linbox_check (A.coldim () == w.size ());
 
-	typename Matrix1::ConstColIterator i = A.colBegin ();
-	typename Vector1::iterator j = w.begin ();
-	typename std::vector<bool>::const_iterator k = S.begin ();
+		typename Matrix1::ConstColIterator i = A.colBegin ();
+		typename Vector1::iterator j = w.begin ();
+		typename std::vector<bool>::const_iterator k = S.begin ();
 
-	for (; j != w.end (); ++j, ++i, ++k)
-		if (*k)
-			_VD.dot (*j, *i, v);
+		for (; j != w.end (); ++j, ++i, ++k)
+			if (*k)
+				_VD.dot (*j, *i, v);
 
-	return w;
-}
+		return w;
+	}
 
-template <class Field, class Matrix>
-template <class Matrix1>
-Matrix1 &MGBlockLanczosSolver<Field, Matrix>::addIN (Matrix1 &A) const
-{
-	linbox_check (A.coldim () == A.rowdim ());
+	template <class Field, class Matrix>
+	template <class Matrix1>
+	inline Matrix1 &MGBlockLanczosSolver<Field, Matrix>::addIN (Matrix1 &A) const
+	{
+		linbox_check (A.coldim () == A.rowdim ());
 
-	typename Matrix1::RowIterator i;
-	size_t idx = 0;
+		typename Matrix1::RowIterator i;
+		size_t idx = 0;
 
-	for (i = A.rowBegin (); i != A.rowEnd (); ++i, ++idx)
-		_F.addin ((*i)[idx], _one);
+		for (i = A.rowBegin (); i != A.rowEnd (); ++i, ++idx)
+			_F.addin ((*i)[idx], _one);
 
-	return A;
-}
+		return A;
+	}
 
-template <class Field, class Matrix>
-template <class Matrix1, class Matrix2>
-Matrix1 &MGBlockLanczosSolver<Field, Matrix>::addin
+	template <class Field, class Matrix>
+	template <class Matrix1, class Matrix2>
+	inline Matrix1 &MGBlockLanczosSolver<Field, Matrix>::addin
 	(Matrix1                 &A,
 	 const Matrix2           &B,
 	 const std::vector<bool> &S) const
-{
-	linbox_check (A.rowdim () == B.rowdim ());
-	linbox_check (A.coldim () == B.coldim ());
+	{
+		linbox_check (A.rowdim () == B.rowdim ());
+		linbox_check (A.coldim () == B.coldim ());
 
-	typename Matrix1::ColIterator i = A.colBegin ();
-	typename Matrix2::ConstColIterator j = B.colBegin ();
-	std::vector<bool>::const_iterator k = S.begin ();
+		typename Matrix1::ColIterator i = A.colBegin ();
+		typename Matrix2::ConstColIterator j = B.colBegin ();
+		std::vector<bool>::const_iterator k = S.begin ();
 
-	for (; i != A.colEnd (); ++i, ++j, ++k)
-		if (*k) _VD.addin (*i, *j);
+		for (; i != A.colEnd (); ++i, ++j, ++k)
+			if (*k) _VD.addin (*i, *j);
 
-	return A;
-}
+		return A;
+	}
 
-template <class Field, class Matrix>
-void MGBlockLanczosSolver<Field, Matrix>::permute (std::vector<size_t>     &indices,
-						 const std::vector<bool> &S) const
-{
-	size_t idx;
+	template <class Field, class Matrix>
+	inline void MGBlockLanczosSolver<Field, Matrix>::permute (std::vector<size_t>     &indices,
+								  const std::vector<bool> &S) const
+	{
+		size_t idx;
 
-	std::vector<size_t>::iterator i = indices.begin ();
-	std::vector<bool>::const_iterator k;
+		std::vector<size_t>::iterator i = indices.begin ();
+		std::vector<bool>::const_iterator k;
 
-	for (k = S.begin (), idx = 0; k != S.end (); ++k, ++idx) {
-		if (!*k) {
-			*i = idx;
-			++i;
+		for (k = S.begin (), idx = 0; k != S.end (); ++k, ++idx) {
+			if (!*k) {
+				*i = idx;
+				++i;
+			}
 		}
-	}
 
-	for (k = S.begin (), idx = 0; k != S.end (); ++k, ++idx) {
-		if (*k) {
-			*i = idx;
-			++i;
+		for (k = S.begin (), idx = 0; k != S.end (); ++k, ++idx) {
+			if (*k) {
+				*i = idx;
+				++i;
+			}
 		}
 	}
-}
 
-template <class Field, class Matrix>
-template <class Matrix1>
-Matrix1 &MGBlockLanczosSolver<Field, Matrix>::setIN (Matrix1 &A) const 
-{
-	linbox_check (A.coldim () == A.rowdim ());
+	template <class Field, class Matrix>
+	template <class Matrix1>
+	inline Matrix1 &MGBlockLanczosSolver<Field, Matrix>::setIN (Matrix1 &A) const
+	{
+		linbox_check (A.coldim () == A.rowdim ());
 
-	typename Matrix1::RowIterator i;
-	size_t i_idx;
+		typename Matrix1::RowIterator i;
+		size_t i_idx;
 
-	for (i = A.rowBegin (), i_idx = 0; i != A.rowEnd (); ++i, ++i_idx) {
-		_VD.subin (*i, *i);
-		_F.assign ((*i)[i_idx], _one);
-	}
+		for (i = A.rowBegin (), i_idx = 0; i != A.rowEnd (); ++i, ++i_idx) {
+			_VD.subin (*i, *i);
+			_F.assign ((*i)[i_idx], _one);
+		}
 
-	return A;
-}
+		return A;
+	}
 
-/* Find a row suitable for pivoting in column col and exchange that row with row
- * A - Matrix on which to operate
- * idx - Index of the row with which to exchange
- * Returns true if a pivot could be found; false otherwise
- */
+	/* Find a row suitable for pivoting in column col and exchange that row with row
+	 * A - Matrix on which to operate
+	 * idx - Index of the row with which to exchange
+	 * Returns true if a pivot could be found; false otherwise
+	 */
 
-template <class Field, class Matrix>
-bool MGBlockLanczosSolver<Field, Matrix>::find_pivot_row
+	template <class Field, class Matrix>
+	inline bool MGBlockLanczosSolver<Field, Matrix>::find_pivot_row
 	(Matrix                    &A,
 	 size_t                     row,
 	 int                        col_offset,
 	 const std::vector<size_t> &indices)
-{
-	size_t idx;
+	{
+		size_t idx;
 
-	typename Matrix::Col col_vec;
-	typename Matrix::Row row_vec;
+		typename Matrix::Col col_vec;
+		typename Matrix::Row row_vec;
 
-	col_vec = *(_M.colBegin () + indices[row] + col_offset);
-	row_vec = *(_M.rowBegin () + indices[row]);
+		col_vec = *(_M.colBegin () + indices[row] + col_offset);
+		row_vec = *(_M.rowBegin () + indices[row]);
 
-	for (idx = row; idx < A.rowdim (); ++idx) {
-		if (!_F.isZero (A.getEntry (indices[idx], indices[row] + col_offset))) {
-			if (idx != row) {
-				typename Matrix::Row row1 = *(A.rowBegin () + indices[idx]);
-				std::swap_ranges (row_vec.begin (), row_vec.end (), row1.begin ());
-			}
+		for (idx = row; idx < A.rowdim (); ++idx) {
+			if (!_F.isZero (A.getEntry (indices[idx], indices[row] + col_offset))) {
+				if (idx != row) {
+					typename Matrix::Row row1 = *(A.rowBegin () + indices[idx]);
+					std::swap_ranges (row_vec.begin (), row_vec.end (), row1.begin ());
+				}
 
-			return true;
+				return true;
+			}
 		}
-	}
 
-	return false;
-}
+		return false;
+	}
 
-template <class Field, class Matrix>
-void MGBlockLanczosSolver<Field, Matrix>::eliminate_col
+	template <class Field, class Matrix>
+	inline void MGBlockLanczosSolver<Field, Matrix>::eliminate_col
 	(Matrix                        &A,
 	 size_t                         pivot,
 	 int                            col_offset,
 	 const std::vector<size_t>     &indices,
 	 const typename Field::Element &Ajj_inv)
-{
-	// I'm assuming everything left of the column with the index of the pivot row is 0
-	size_t row;
+	{
+		// I'm assuming everything left of the column with the index of the pivot row is 0
+		size_t row;
 
-	typename DenseSubmatrix<Element>::Row pivot_row;
-	typename Field::Element p;
+		typename DenseSubmatrix<Element>::Row pivot_row;
+		typename Field::Element p;
 
-	pivot_row = *(A.rowBegin () + indices[pivot]);
+		pivot_row = *(A.rowBegin () + indices[pivot]);
 
-	for (row = 0; row < pivot; ++row) {
-		const typename Field::Element &Aij = A.getEntry (indices[row], indices[pivot] + col_offset);
+		for (row = 0; row < pivot; ++row) {
+			const typename Field::Element &Aij = A.getEntry (indices[row], indices[pivot] + col_offset);
 
-		if (!_F.isZero (Aij))
-			_VD.axpyin (*(A.rowBegin () + indices[row]), _F.neg (p, Aij), pivot_row);
-	}
+			if (!_F.isZero (Aij))
+				_VD.axpyin (*(A.rowBegin () + indices[row]), _F.neg (p, Aij), pivot_row);
+		}
 
-	for (++row; row < A.rowdim (); ++row) {
-		const typename Field::Element &Aij = A.getEntry (indices[row], indices[pivot] + col_offset);
+		for (++row; row < A.rowdim (); ++row) {
+			const typename Field::Element &Aij = A.getEntry (indices[row], indices[pivot] + col_offset);
 
-		if (!_F.isZero (Aij))
-			_VD.axpyin (*(A.rowBegin () + indices[row]), _F.neg (p, Aij), pivot_row);
+			if (!_F.isZero (Aij))
+				_VD.axpyin (*(A.rowBegin () + indices[row]), _F.neg (p, Aij), pivot_row);
+		}
 	}
-}
-
-template <class Field, class Matrix>
-void MGBlockLanczosSolver<Field, Matrix>::init_temps () 
-{
-	_VTAV.resize (_N, _N);
-	_Winv[0].resize (_N, _N);
-	_Winv[1].resize (_N, _N);
-	_AVTAVSST_VTAV.resize (_N, _N);
-	_T.resize (_N, _N);
-	_DEF.resize (_N, _N);
-	_S.resize (_N);
-	_M.resize (_N, 2 * _N);
-	_indices.resize (_N);
-}
-
-// Check whether the given matrix is "almost" the identity, i.e. the identity
-// with some zeros on the diagonal
-
-template <class Field, class Matrix>
-template <class Matrix1>
-bool MGBlockLanczosSolver<Field, Matrix>::isAlmostIdentity (const Matrix1 &M) const 
-{
-	linbox_check (M.rowdim () == M.coldim ());
-
-	typename Field::Element neg_one;
 
-	_F.init (neg_one, -1);
+	template <class Field, class Matrix>
+	inline void MGBlockLanczosSolver<Field, Matrix>::init_temps ()
+	{
+		_VTAV.resize (_N, _N);
+		_Winv[0].resize (_N, _N);
+		_Winv[1].resize (_N, _N);
+		_AVTAVSST_VTAV.resize (_N, _N);
+		_T.resize (_N, _N);
+		_DEF.resize (_N, _N);
+		_S.resize (_N);
+		_M.resize (_N, 2 * _N);
+		_indices.resize (_N);
+	}
 
-	size_t i, j;
+	// Check whether the given matrix is "almost" the identity, i.e. the identity
+	// with some zeros on the diagonal
 
-	for (i = 0; i < M.rowdim (); ++i) {
-		for (j = 0; j < M.coldim (); ++j) {
-			if (i != j && !_F.isZero (M.getEntry (i, j))) {
-				if (!_F.isZero (M.getEntry (i, i))) {
-					typename Matrix::ConstRowIterator row = M.rowBegin () + j;
-					if (!_VD.isZero (*row))
+	template <class Field, class Matrix>
+	template <class Matrix1>
+	inline bool MGBlockLanczosSolver<Field, Matrix>::isAlmostIdentity (const Matrix1 &M) const
+	{
+		linbox_check (M.rowdim () == M.coldim ());
+
+		typename Field::Element neg_one;
+
+		_F.init (neg_one, -1);
+
+		size_t i, j;
+
+		for (i = 0; i < M.rowdim (); ++i) {
+			for (j = 0; j < M.coldim (); ++j) {
+				if (i != j && !_F.isZero (M.getEntry (i, j))) {
+					if (!_F.isZero (M.getEntry (i, i))) {
+						typename Matrix::ConstRowIterator row = M.rowBegin () + j;
+						if (!_VD.isZero (*row))
+							return false;
+					}
+					else if (!_F.isZero (M.getEntry (j, j))) {
+						typename Matrix::ConstColIterator col = M.colBegin () + i;
+						if (!_VD.isZero (*col))
+							return false;
+					}
+					else
 						return false;
 				}
-				else if (!_F.isZero (M.getEntry (j, j))) {
-					typename Matrix::ConstColIterator col = M.colBegin () + i;
-					if (!_VD.isZero (*col))
-						return false;
-				} else
+				else if (!_F.isZero (M.getEntry (i, j)) && !_F.areEqual (M.getEntry (i, j), neg_one))
 					return false;
 			}
-			else if (!_F.isZero (M.getEntry (i, j)) && !_F.areEqual (M.getEntry (i, j), neg_one))
-				return false;
 		}
+
+		return true;
 	}
 
-	return true;
-}
+	// Test suite for MGBlockLanczosSolver
+	// All tests below return true on success and false on failure. They take a
+	// single argument: n for the row and column dimension of the matrices on which
+	// to operate
 
-// Test suite for MGBlockLanczosSolver
-// All tests below return true on success and false on failure. They take a
-// single argument: n for the row and column dimension of the matrices on which
-// to operate
+	// Compute a random dense matrix and run compute_Winv_S on it. Check that the
+	// resulting S vector is all 'true' and then multiply the original matrix by the
+	// output. Add 1 to the result with addIN and check the the result is zero with
+	// isZero
 
-// Compute a random dense matrix and run compute_Winv_S on it. Check that the
-// resulting S vector is all 'true' and then multiply the original matrix by the
-// output. Add 1 to the result with addIN and check the the result is zero with
-// isZero
+	template <class Field, class Matrix>
+	inline bool MGBlockLanczosSolver<Field, Matrix>::test_compute_Winv_S_mul (int n) const
+	{
+		commentator.start ("Testing compute_Winv_S, mul, addIN, and isZero", "test_compute_Winv_S_mul");
 
-template <class Field, class Matrix>
-bool MGBlockLanczosSolver<Field, Matrix>::test_compute_Winv_S_mul (int n) const
-{
-	commentator.start ("Testing compute_Winv_S, mul, addIN, and isZero", "test_compute_Winv_S_mul");
-
-	Matrix A (n, n);
-	Matrix AT (n, n);
-	Matrix ATA (n, n);
-	Matrix W (n, n);
-	Matrix WA (n, n);
-	std::vector<bool> S (n);
-
-	bool ret = true;
-
-	RandomDenseStream<Field, typename Matrix::Row> stream (_F, _randiter, n);
-	typename Matrix::RowIterator i = A.rowBegin ();
-	typename Matrix::ColIterator j = AT.colBegin ();
-
-	// With very, very, very, very high probability, this will be
-	// nonsingular
-	for (; i != A.rowEnd (); ++i, ++j) {
-		stream >> *i;
-		_VD.copy (*j, *i);
-	}
+		Matrix A (n, n);
+		Matrix AT (n, n);
+		Matrix ATA (n, n);
+		Matrix W (n, n);
+		Matrix WA (n, n);
+		std::vector<bool> S (n);
+
+		bool ret = true;
+
+		RandomDenseStream<Field, typename Matrix::Row> stream (_F, _randiter, n);
+		typename Matrix::RowIterator i = A.rowBegin ();
+		typename Matrix::ColIterator j = AT.colBegin ();
 
-	_MD.mul (ATA, AT, A);
+		// With very, very, very, very high probability, this will be
+		// nonsingular
+		for (; i != A.rowEnd (); ++i, ++j) {
+			stream >> *i;
+			_VD.copy (*j, *i);
+		}
 
-	std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-	report << "Computed A^T A:" << std::endl;
-	_MD.write (report, ATA);
+		_MD.mul (ATA, AT, A);
 
-	compute_Winv_S (W, S, ATA);
+		std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+		report << "Computed A^T A:" << std::endl;
+		_MD.write (report, ATA);
 
-	report << "Computed W:" << std::endl;
-	_MD.write (report, W);
+		compute_Winv_S (W, S, ATA);
 
-	// Now W should be -A^-1
-	_MD.mul (WA, W, ATA);
+		report << "Computed W:" << std::endl;
+		_MD.write (report, W);
 
-	report << "Computed WA^T A:" << std::endl;
-	_MD.write (report, WA);
+		// Now W should be -A^-1
+		_MD.mul (WA, W, ATA);
 
-	if (!isAlmostIdentity (WA)) {
-		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+		report << "Computed WA^T A:" << std::endl;
+		_MD.write (report, WA);
+
+		if (!isAlmostIdentity (WA)) {
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
 			<< "ERROR: WA^T A != I" << std::endl;
-		ret = false;
-	}
+			ret = false;
+		}
 
-	// Now, just for kicks, do the same on the other side
+		// Now, just for kicks, do the same on the other side
 
-	_MD.mul (WA, ATA, W);
+		_MD.mul (WA, ATA, W);
 
-	report << "Computed A^T A W:" << std::endl;
-	_MD.write (report, WA);
+		report << "Computed A^T A W:" << std::endl;
+		_MD.write (report, WA);
 
-	if (!isAlmostIdentity (WA)) {
-		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+		if (!isAlmostIdentity (WA)) {
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
 			<< "ERROR: A^T AW != I" << std::endl;
-		ret = false;
+			ret = false;
+		}
+
+		commentator.stop (MSG_STATUS (ret), NULL, "test_compute_Winv_S_mul");
+
+		return ret;
 	}
 
-	commentator.stop (MSG_STATUS (ret), NULL, "test_compute_Winv_S_mul");
+	// Same as above, but use mulin rather than mul
 
-	return ret;
-}
+	template <class Field, class Matrix>
+	inline bool MGBlockLanczosSolver<Field, Matrix>::test_compute_Winv_S_mulin (int n) const
+	{
+		commentator.start ("Testing compute_Winv_S, copy, mulin, addIN, and isZero", "test_compute_Winv_S_mulin");
 
-// Same as above, but use mulin rather than mul
+		Matrix A (n, n);
+		Matrix AT (n, n);
+		Matrix ATA (n, n);
+		Matrix W (n, n);
+		Matrix WA (n, n);
+		std::vector<bool> S (n);
 
-template <class Field, class Matrix>
-bool MGBlockLanczosSolver<Field, Matrix>::test_compute_Winv_S_mulin (int n) const
-{
-	commentator.start ("Testing compute_Winv_S, copy, mulin, addIN, and isZero", "test_compute_Winv_S_mulin");
-
-	Matrix A (n, n);
-	Matrix AT (n, n);
-	Matrix ATA (n, n);
-	Matrix W (n, n);
-	Matrix WA (n, n);
-	std::vector<bool> S (n);
-
-	bool ret = true;
-
-	RandomDenseStream<Field, typename Matrix::Row> stream (_F, _randiter, n);
-	typename Matrix::RowIterator i = A.rowBegin ();
-	typename Matrix::ColIterator j = AT.colBegin ();
-
-	// With very, very, very, very high probability, this will be
-	// nonsingular
-	for (; i != A.rowEnd (); ++i, ++j) {
-		stream >> *i;
-		_VD.copy (*j, *i);
-	}
+		bool ret = true;
 
-	_MD.mul (ATA, AT, A);
+		RandomDenseStream<Field, typename Matrix::Row> stream (_F, _randiter, n);
+		typename Matrix::RowIterator i = A.rowBegin ();
+		typename Matrix::ColIterator j = AT.colBegin ();
 
-	std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-	report << "Computed A^T A:" << std::endl;
-	_MD.write (report, ATA);
+		// With very, very, very, very high probability, this will be
+		// nonsingular
+		for (; i != A.rowEnd (); ++i, ++j) {
+			stream >> *i;
+			_VD.copy (*j, *i);
+		}
 
-	compute_Winv_S (W, S, ATA);
+		_MD.mul (ATA, AT, A);
 
-	_MD.copy (WA, W);
+		std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+		report << "Computed A^T A:" << std::endl;
+		_MD.write (report, ATA);
 
-	report << "Computed W:" << std::endl;
-	_MD.write (report, W);
+		compute_Winv_S (W, S, ATA);
 
-	// Now W should be -A^-1
-	_MD.mulin (WA, ATA);
+		_MD.copy (WA, W);
 
-	report << "Computed WA^T A:" << std::endl;
-	_MD.write (report, WA);
+		report << "Computed W:" << std::endl;
+		_MD.write (report, W);
 
-	if (!isAlmostIdentity (WA)) {
-		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+		// Now W should be -A^-1
+		_MD.mulin (WA, ATA);
+
+		report << "Computed WA^T A:" << std::endl;
+		_MD.write (report, WA);
+
+		if (!isAlmostIdentity (WA)) {
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
 			<< "ERROR: WA^T A != I" << std::endl;
-		ret = false;
-	}
+			ret = false;
+		}
 
-	// Now, just for kicks, do the same on the other side
+		// Now, just for kicks, do the same on the other side
 
-	_MD.copy (WA, ATA);
+		_MD.copy (WA, ATA);
 
-	_MD.mulin (WA, W);
+		_MD.mulin (WA, W);
 
-	report << "Computed A^T AW:" << std::endl;
-	_MD.write (report, WA);
+		report << "Computed A^T AW:" << std::endl;
+		_MD.write (report, WA);
 
-	if (!isAlmostIdentity (WA)) {
-		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+		if (!isAlmostIdentity (WA)) {
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
 			<< "ERROR: A^T AW != I" << std::endl;
-		ret = false;
-	}
+			ret = false;
+		}
 
-	commentator.stop (MSG_STATUS (ret), NULL, "test_compute_Winv_S_mulin");
+		commentator.stop (MSG_STATUS (ret), NULL, "test_compute_Winv_S_mulin");
 
-	return ret;
-}
+		return ret;
+	}
 
-// Compute a random nonsingular diagonal matrix and set an S vector so that
-// every other entry is true and the rest are false. Call mul_SST and check that
-// the entries on the resulting diagonal are correct.
+	// Compute a random nonsingular diagonal matrix and set an S vector so that
+	// every other entry is true and the rest are false. Call mul_SST and check that
+	// the entries on the resulting diagonal are correct.
 
-template <class Field, class Matrix>
-bool MGBlockLanczosSolver<Field, Matrix>::test_mul_SST (int n) const
-{
-	commentator.start ("Testing addin", "test_mulTranspose");
+	template <class Field, class Matrix>
+	inline bool MGBlockLanczosSolver<Field, Matrix>::test_mul_SST (int n) const
+	{
+		commentator.start ("Testing addin", "test_mulTranspose");
 
-	bool ret = true;
+		bool ret = true;
 
-	commentator.stop (MSG_STATUS (ret), NULL, "test_mulTranspose");
+		commentator.stop (MSG_STATUS (ret), NULL, "test_mulTranspose");
 
-	return ret;
-}
+		return ret;
+	}
 
-// Same as test_compute_Winv_S_mul above, but zero out every other column using
-// the method for test_mul_SST
+	// Same as test_compute_Winv_S_mul above, but zero out every other column using
+	// the method for test_mul_SST
 
-template <class Field, class Matrix>
-bool MGBlockLanczosSolver<Field, Matrix>::test_mul_ABSST (int n) const
-{
-	commentator.start ("Testing addin", "test_mulTranspose");
+	template <class Field, class Matrix>
+	inline bool MGBlockLanczosSolver<Field, Matrix>::test_mul_ABSST (int n) const
+	{
+		commentator.start ("Testing addin", "test_mulTranspose");
 
-	bool ret = true;
+		bool ret = true;
 
-	commentator.stop (MSG_STATUS (ret), NULL, "test_mulTranspose");
+		commentator.stop (MSG_STATUS (ret), NULL, "test_mulTranspose");
 
-	return ret;
-}
+		return ret;
+	}
 
-// Compute a random dense matrix and two random vectors, and check that <A^T x,
-// y> = <x, Ay>
+	// Compute a random dense matrix and two random vectors, and check that <A^T x,
+	// y> = <x, Ay>
 
-template <class Field, class Matrix>
-bool MGBlockLanczosSolver<Field, Matrix>::test_mulTranspose (int m, int n) const
-{
-	commentator.start ("Testing mulTranspose, m-v mul", "test_mulTranspose");
+	template <class Field, class Matrix>
+	inline bool MGBlockLanczosSolver<Field, Matrix>::test_mulTranspose (int m, int n) const
+	{
+		commentator.start ("Testing mulTranspose, m-v mul", "test_mulTranspose");
 
-	Matrix A (m, n);
-	typename Vector<Field>::Dense x (m), y (n);
-	typename Vector<Field>::Dense ATx (n), Ay (m);
-	Element ATxy, xAy;
+		Matrix A (m, n);
+		typename Vector<Field>::Dense x (m), y (n);
+		typename Vector<Field>::Dense ATx (n), Ay (m);
+		Element ATxy, xAy;
 
-	bool ret = true;
+		bool ret = true;
 
-	RandomDenseStream<Field, typename Matrix::Row> stream (_F, _randiter, n);
-	typename Matrix::RowIterator i = A.rowBegin ();
+		RandomDenseStream<Field, typename Matrix::Row> stream (_F, _randiter, n);
+		typename Matrix::RowIterator i = A.rowBegin ();
 
-	for (; i != A.rowEnd (); ++i)
-		stream >> *i;
+		for (; i != A.rowEnd (); ++i)
+			stream >> *i;
 
-	std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-	report << "Computed A:" << std::endl;
-	_MD.write (report, A);
+		std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+		report << "Computed A:" << std::endl;
+		_MD.write (report, A);
 
-	RandomDenseStream<Field, Matrix> stream1 (_F, _randiter, m);
-	stream1 >> x;
+		RandomDenseStream<Field, Matrix> stream1 (_F, _randiter, m);
+		stream1 >> x;
 
-	RandomDenseStream<Field, Matrix> stream2 (_F, _randiter, n);
-	stream1 >> y;
+		RandomDenseStream<Field, Matrix> stream2 (_F, _randiter, n);
+		stream1 >> y;
 
-	report << "Computed     x: ";
-	_VD.write (report, x) << std::endl;
+		report << "Computed     x: ";
+		_VD.write (report, x) << std::endl;
 
-	report << "Computed     y: ";
-	_VD.write (report, y) << std::endl;
+		report << "Computed     y: ";
+		_VD.write (report, y) << std::endl;
 
-	_MD.vectorMul (ATx, transpose (A), x);
+		_MD.vectorMul (ATx, transpose (A), x);
 
-	report << "Computed A^T x: ";
-	_VD.write (report, ATx) << std::endl;
+		report << "Computed A^T x: ";
+		_VD.write (report, ATx) << std::endl;
 
-	_MD.vectorMul (Ay, A, y);
+		_MD.vectorMul (Ay, A, y);
 
-	report << "Computed    Ay: ";
-	_VD.write (report, Ay) << std::endl;
+		report << "Computed    Ay: ";
+		_VD.write (report, Ay) << std::endl;
 
-	_VD.dot (ATxy, ATx, y);
+		_VD.dot (ATxy, ATx, y);
 
-	report << "Computed  ATxy: ";
-	_F.write (report, ATxy) << std::endl;
+		report << "Computed  ATxy: ";
+		_F.write (report, ATxy) << std::endl;
 
-	_VD.dot (xAy, x, Ay);
+		_VD.dot (xAy, x, Ay);
 
-	report << "Computed   xAy: ";
-	_F.write (report, xAy) << std::endl;
+		report << "Computed   xAy: ";
+		_F.write (report, xAy) << std::endl;
 
-	if (!_F.areEqual (ATxy, xAy)) {
-		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+		if (!_F.areEqual (ATxy, xAy)) {
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
 			<< "ERROR: <A^T x, y> != <x, Ay>" << std::endl;
-		ret = false;
-	}
+			ret = false;
+		}
 
-	commentator.stop (MSG_STATUS (ret), NULL, "test_mulTranspose");
+		commentator.stop (MSG_STATUS (ret), NULL, "test_mulTranspose");
 
-	return ret;
-}
+		return ret;
+	}
 
-// Same as test_mul_SST, but using mulTranspose
+	// Same as test_mul_SST, but using mulTranspose
 
-template <class Field, class Matrix>
-bool MGBlockLanczosSolver<Field, Matrix>::test_mulTranspose_ABSST (int n) const
-{
-	commentator.start ("Testing addin_ABSST", "test_mulTranspose_ABSST");
+	template <class Field, class Matrix>
+	inline bool MGBlockLanczosSolver<Field, Matrix>::test_mulTranspose_ABSST (int n) const
+	{
+		commentator.start ("Testing addin_ABSST", "test_mulTranspose_ABSST");
 
-	bool ret = true;
+		bool ret = true;
 
-	commentator.stop (MSG_STATUS (ret), NULL, "test_mulTranspose_ABSST");
+		commentator.stop (MSG_STATUS (ret), NULL, "test_mulTranspose_ABSST");
 
-	return ret;
-}
+		return ret;
+	}
 
-// Same as test_mul_ABSST, but using mulin_ABSST
+	// Same as test_mul_ABSST, but using mulin_ABSST
 
-template <class Field, class Matrix>
-bool MGBlockLanczosSolver<Field, Matrix>::test_mulin_ABSST (int n) const
-{
-	commentator.start ("Testing addin_ABSST", "test_mulin_ABSST");
+	template <class Field, class Matrix>
+	inline bool MGBlockLanczosSolver<Field, Matrix>::test_mulin_ABSST (int n) const
+	{
+		commentator.start ("Testing addin_ABSST", "test_mulin_ABSST");
 
-	bool ret = true;
+		bool ret = true;
 
-	commentator.stop (MSG_STATUS (ret), NULL, "test_mulin_ABSST");
+		commentator.stop (MSG_STATUS (ret), NULL, "test_mulin_ABSST");
 
-	return ret;
-}
+		return ret;
+	}
 
-// Same as test_addin, but using test_addin_ABSST
+	// Same as test_addin, but using test_addin_ABSST
 
-template <class Field, class Matrix>
-bool MGBlockLanczosSolver<Field, Matrix>::test_addin_ABSST (int n) const
-{
-	commentator.start ("Testing addin_ABSST", "test_addin_ABSST");
+	template <class Field, class Matrix>
+	inline bool MGBlockLanczosSolver<Field, Matrix>::test_addin_ABSST (int n) const
+	{
+		commentator.start ("Testing addin_ABSST", "test_addin_ABSST");
 
-	bool ret = true;
+		bool ret = true;
 
-	commentator.stop (MSG_STATUS (ret), NULL, "test_addin_ABSST");
+		commentator.stop (MSG_STATUS (ret), NULL, "test_addin_ABSST");
 
-	return ret;
-}
+		return ret;
+	}
 
-template <class Field, class Matrix>
-bool MGBlockLanczosSolver<Field, Matrix>::runSelfCheck () const
-{
-	bool ret = true;
+	template <class Field, class Matrix>
+	inline bool MGBlockLanczosSolver<Field, Matrix>::runSelfCheck () const
+	{
+		bool ret = true;
 
-	commentator.start ("Running self check", "runSelfCheck", 10);
+		commentator.start ("Running self check", "runSelfCheck", 10);
 
-	if (!test_compute_Winv_S_mul (_N)) ret = false;
-	if (!test_compute_Winv_S_mulin (_N)) ret = false;
-	if (!test_mul_SST (_N)) ret = false;
-	if (!test_mul_ABSST (_N)) ret = false;
-	if (!test_mulTranspose (_N * 10, _N)) ret = false;
-	if (!test_mulTranspose_ABSST (_N)) ret = false;
-	if (!test_mulin_ABSST (_N)) ret = false;
-	if (!test_addin_ABSST (_N)) ret = false;
+		if (!test_compute_Winv_S_mul (_N)) ret = false;
+		if (!test_compute_Winv_S_mulin (_N)) ret = false;
+		if (!test_mul_SST (_N)) ret = false;
+		if (!test_mul_ABSST (_N)) ret = false;
+		if (!test_mulTranspose (_N * 10, _N)) ret = false;
+		if (!test_mulTranspose_ABSST (_N)) ret = false;
+		if (!test_mulin_ABSST (_N)) ret = false;
+		if (!test_addin_ABSST (_N)) ret = false;
 
-	commentator.stop (MSG_STATUS (ret), NULL, "runSelfCheck");
+		commentator.stop (MSG_STATUS (ret), NULL, "runSelfCheck");
 
-	return ret;
-}
+		return ret;
+	}
 
 } // namespace LinBox
 
-#endif // __MG_BLOCK_LANCZOS_INL
+#endif // __LINBOX_mg_block_lanczos_INL
diff --git a/linbox/algorithms/minpoly-integer.h b/linbox/algorithms/minpoly-integer.h
index b050298..7806c23 100644
--- a/linbox/algorithms/minpoly-integer.h
+++ b/linbox/algorithms/minpoly-integer.h
@@ -1,24 +1,52 @@
-/* -*- mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-/*better filter out repeated primes*/
-/* Compute the minpoly of a matrix over an integer ring using modular arithmetic */
-/* author: Zhendong Wan*/
-
-#ifndef _LINBOX_MINPOLY_INTEGER_H__
-#define _LINBOX_MINPOLY_INTEGER_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
+/* Copyright (C) LinBox
+ *
+ * author: Zhendong Wan
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+
+#ifndef __LINBOX_minpoly_integer_H
+#define __LINBOX_minpoly_integer_H
 
 #include <iostream>
 #include <math.h>
 
+/*! \file algorithms/minpoly-integer.h
+ * Compute the minpoly of a matrix over an integer ring using modular arithmetic
+ * @todo better filter out repeated primes
+ */
+
+
+
 #include <linbox/field/field-traits.h>
 #include <linbox/algorithms/matrix-hom.h>
 #include <linbox/vector/vector-domain.h>
 #include <linbox/randiter/random-prime.h>
 //#include <linbox/solutions/minpoly.h>
 #include <linbox/util/commentator.h>
-#include <linbox/ffpack/ffpack.h>
+#include <fflas-ffpack/ffpack/ffpack.h>
 #include <linbox/algorithms/cra-early-multip.h>
 
-namespace LinBox {
+namespace LinBox
+{
 
 	/* compute the minpoly of a matrix over the Integer ring
 	 * via modular method over Field.
@@ -69,7 +97,8 @@ namespace LinBox {
 
 	template<class _Integer, class _Field>
 	template<class Poly, class IMatrix>
-	Poly& MinPoly<_Integer, _Field>::minPoly(Poly& y, const IMatrix& M) {
+	Poly& MinPoly<_Integer, _Field>::minPoly(Poly& y, const IMatrix& M)
+	{
 		int degree = minPolyDegree (M);
 		minPoly(y, M, degree);
 		return y;
@@ -77,21 +106,21 @@ namespace LinBox {
 
 	template <class _Integer, class _Field>
 	template <class IMatrix>
-	int MinPoly<_Integer, _Field>::minPolyDegree (const IMatrix& M, int n_try) {
+	int MinPoly<_Integer, _Field>::minPolyDegree (const IMatrix& M, int n_try)
+	{
 		int degree = 0;
-                typedef typename IMatrix::template rebind<Field>::other FBlackbox;
+		typedef typename IMatrix::template rebind<Field>::other FBlackbox;
 		typedef std::vector<Element> FPoly;
-		FBlackbox* fbb; FPoly fp;
-		integer mmodulus; 
+		FPoly fp;
+		integer mmodulus;
 		FieldTraits<Field>::maxModulus(mmodulus);
 		long bits = (long) floor (log((double)mmodulus)/M_LN2);
-		RandomPrimeIterator primeg(bits); 
+		RandomPrimeIterator primeg(bits);
 		for (int i = 0; i < n_try; ++ i) {
 			++primeg;
 			Field F(*primeg);
-			MatrixHom::map (fbb, M, F);
-			//LinBox::minpoly (fp, *fbb); delete fbb;
-			minpoly (fp, *fbb); delete fbb;
+			FBlackbox  fbb(M, F);
+			minpoly (fp, fbb);
 			if (degree < ((int) fp.size() - 1)) degree = fp.size() -1;
 		}
 		return degree;
@@ -99,7 +128,8 @@ namespace LinBox {
 
 	template <class _Integer, class _Field>
 	template<class Poly, class IMatrix>
-	Poly& MinPoly<_Integer, _Field>::minPoly(Poly& y, const IMatrix& M, int degree) {
+	Poly& MinPoly<_Integer, _Field>::minPoly(Poly& y, const IMatrix& M, int degree)
+	{
 		if (isSymmetric(M))  {
 			//std::cout << "Symmetric:\n";
 			minPolySymmetric(y, M, degree);
@@ -113,96 +143,97 @@ namespace LinBox {
 
 	template <class _Integer, class _Field>
 	template<class Poly, class IMatrix>
-	Poly& MinPoly<_Integer, _Field>::minPolyNonSymmetric(Poly& y, const IMatrix& M, int degree) {
+	Poly& MinPoly<_Integer, _Field>::minPolyNonSymmetric(Poly& y, const IMatrix& M, int degree)
+	{
 
-                typedef typename IMatrix::template rebind<Field>::other FBlackbox;
+		typedef typename IMatrix::template rebind<Field>::other FBlackbox;
 		typedef std::vector<Element> FPoly;
 
-		integer mmodulus; 
+		integer mmodulus;
 		FieldTraits<Field>::maxModulus(mmodulus);
 		long bits = (long) floor (log((double)mmodulus)/M_LN2);
 
-		RandomPrimeIterator primeg(bits); 
-		FBlackbox* fbb; 
+		RandomPrimeIterator primeg(bits);
 		FPoly fp (degree + 1);
 		typename FPoly::iterator fp_p;
 		y.resize (degree + 1);
 
-                EarlyMultipCRA< _Field > cra(3UL);
-                do {
-                    ++primeg;
-                    Field F(*primeg);
-                    MatrixHom::map (fbb, M, F);
-                    minpoly (fp, *fbb); delete fbb;  
-                    cra.initialize(F, fp);
-                } while( (int)fp.size() - 1 != degree); // Test for Bad primes                
+		EarlyMultipCRA< _Field > cra(3UL);
+		do {
+			++primeg;
+			Field F(*primeg);
+			FBlackbox fbb(M, F);
+			minpoly (fp, fbb);
+			cra.initialize(F, fp);
+		} while( (int)fp.size() - 1 != degree); // Test for Bad primes
 
 		while(! cra.terminated()) {
-                    ++primeg; while(cra.noncoprime(*primeg)) ++primeg;   
-                    Field F(*primeg);
-                    MatrixHom::map (fbb, M, F);
-                    minpoly (fp, *fbb); delete fbb;  
-                    if ((int)fp.size() - 1 != degree) {
-                        commentator.report (Commentator::LEVEL_IMPORTANT,
-                                            INTERNAL_DESCRIPTION) << "Bad prime.\n";
-                        continue;
-                    }
-                    cra.progress(F, fp);
+			++primeg; while(cra.noncoprime(*primeg)) ++primeg;
+			Field F(*primeg);
+			FBlackbox fbb(M, F);
+			minpoly (fp, fbb);
+			if ((int)fp.size() - 1 != degree) {
+				commentator.report (Commentator::LEVEL_IMPORTANT,
+						    INTERNAL_DESCRIPTION) << "Bad prime.\n";
+				continue;
+			}
+			cra.progress(F, fp);
 		}
-                
+
 		cra. result (y);
-                    // commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION) <<  "Number of primes needed: " << cra. steps() << std::endl;
+		// commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION) <<  "Number of primes needed: " << cra. steps() << std::endl;
 		return y;
 	}
 
 	template <class _Integer, class _Field>
 	template<class Poly, class IMatrix>
-	Poly& MinPoly<_Integer, _Field>::minPolySymmetric(Poly& y, const IMatrix& M, int degree) {
+	Poly& MinPoly<_Integer, _Field>::minPolySymmetric(Poly& y, const IMatrix& M, int degree)
+	{
 
-                typedef typename IMatrix::template rebind<Field>::other FBlackbox;
+		typedef typename IMatrix::template rebind<Field>::other FBlackbox;
 		typedef std::vector<Element> FPoly;
 
 
-		integer mmodulus; 
+		integer mmodulus;
 		FieldTraits<Field>::maxModulus(mmodulus);
 		long bits = (long) floor (log((double)mmodulus)/M_LN2);
 
-		RandomPrimeIterator primeg(bits); 
-		FBlackbox* fbb; 
+		RandomPrimeIterator primeg(bits);
 		FPoly fp (degree + 1);
 		typename FPoly::iterator fp_p;
 		y.resize (degree + 1);
 
-                EarlyMultipCRA< _Field > cra(3UL);
-                do {
-                    ++primeg;
-                    Field F(*primeg);
-                    MatrixHom::map (fbb, M, F);
-                    minpolySymmetric (fp, *fbb); delete fbb;  
-                    cra.initialize(F, fp);
-                } while( (int)fp.size() - 1 != degree); // Test for Bad primes                
+		EarlyMultipCRA< _Field > cra(3UL);
+		do {
+			++primeg;
+			Field F(*primeg);
+			FBlackbox fbb(M,F);
+			minpolySymmetric (fp, fbb);
+			cra.initialize(F, fp);
+		} while( (int)fp.size() - 1 != degree); // Test for Bad primes
 
 		while(! cra.terminated()) {
-                    ++primeg; while(cra.noncoprime(*primeg)) ++primeg;   
-                    Field F(*primeg); 
-                    MatrixHom::map (fbb, M, F); 
-                    minpolySymmetric (fp, *fbb); delete fbb;
-                    if ((int)fp.size() - 1 != degree) {
-                        commentator.report (Commentator::LEVEL_IMPORTANT,
-                                            INTERNAL_DESCRIPTION) << "Bad prime.\n";
-                        continue;
-                    }
-                    cra.progress(F, fp);
-		}	
+			++primeg; while(cra.noncoprime(*primeg)) ++primeg;
+			Field F(*primeg);
+			FBlackbox fbb(M,F);
+			minpolySymmetric (fp, fbb);
+			if ((int)fp.size() - 1 != degree) {
+				commentator.report (Commentator::LEVEL_IMPORTANT,
+						    INTERNAL_DESCRIPTION) << "Bad prime.\n";
+				continue;
+			}
+			cra.progress(F, fp);
+		}
 		cra. result (y);
 		//std::cout << "Number of primes needed: " << cra. steps() << std::endl;
 		return y;
 	}
-			
+
 
 	template <class _Integer, class _Field>
 	template <class IMatrix>
-	bool MinPoly<_Integer, _Field>::isSymmetric(const IMatrix& M, int n_try) {
+	bool MinPoly<_Integer, _Field>::isSymmetric(const IMatrix& M, int n_try)
+	{
 		typedef typename IMatrix::Field Ring;
 		typedef typename Ring::Element Element;
 		Ring R(M. field()); int order = M. rowdim();
@@ -223,7 +254,8 @@ namespace LinBox {
 
 	template <class _Integer, class _Field>
 	template <class Poly, class Ring>
-	Poly& MinPolyBlas<_Integer, _Field>::minPolyBlas (Poly& y, const DenseMatrix<Ring>& M) {
+	Poly& MinPolyBlas<_Integer, _Field>::minPolyBlas (Poly& y, const DenseMatrix<Ring>& M)
+	{
 		int degree = minPolyDegreeBlas (M);
 		minPolyBlas (y, M, degree);
 		return y;
@@ -231,11 +263,12 @@ namespace LinBox {
 
 	template <class _Integer, class _Field>
 	template <class Poly, class Ring>
-	Poly& MinPolyBlas<_Integer, _Field>::minPolyBlas (Poly& y, const DenseMatrix<Ring>& M, int degree) {
+	Poly& MinPolyBlas<_Integer, _Field>::minPolyBlas (Poly& y, const DenseMatrix<Ring>& M, int degree)
+	{
 
 		y. resize (degree + 1);
 		size_t n = M. rowdim();
-		integer mmodulus; 
+		integer mmodulus;
 		FieldTraits<Field>::maxModulus(mmodulus);
 		long bit1 = (long) floor (log((double)mmodulus)/M_LN2);
 		long bit2 = (long) floor (log(sqrt(double(4503599627370496LL/n)))/M_LN2);
@@ -248,48 +281,49 @@ namespace LinBox {
 		std::vector<Element> poly (degree + 1);
 		typename std::vector<Element>::iterator poly_ptr;
 
-                EarlyMultipCRA< _Field > cra(3UL);
-                do {
-                    ++primeg; while(cra.noncoprime(*primeg)) ++primeg;   
-                    Field F(*primeg);
-                    for (p = FA, raw_p = M. rawBegin(); 
-                         p != FA + (n*n); ++ p, ++ raw_p)
-                        
-                        F. init (*p, *raw_p);
-                    
-                    FFPACK::MinPoly( F, poly, n, FA, n, X, n, Perm);
+		EarlyMultipCRA< _Field > cra(3UL);
+		do {
+			++primeg; while(cra.noncoprime(*primeg)) ++primeg;
+			Field F(*primeg);
+			for (p = FA, raw_p = M. rawBegin();
+			     p != FA + (n*n); ++ p, ++ raw_p)
+
+				F. init (*p, *raw_p);
+
+			FFPACK::MinPoly( F, poly, n, FA, n, X, n, Perm);
 
-                    cra.initialize(F, poly);
-                } while( poly. size() != degree + 1) ; // Test for Bad primes
+			cra.initialize(F, poly);
+		} while( poly. size() != degree + 1) ; // Test for Bad primes
 
 		while (! cra. terminated()) {
-                    ++primeg; while(cra.noncoprime(*primeg)) ++primeg;   
-                    Field F(*primeg);
-                    for (p = FA, raw_p = M. rawBegin(); 
-                         p != FA + (n*n); ++ p, ++ raw_p)
-                        
-                        F. init (*p, *raw_p);
-                    
-                    FFPACK::MinPoly( F, poly, n, FA, n, X, n, Perm);
-                    
-                    if(poly. size() != degree + 1) {
-                        commentator.report (Commentator::LEVEL_IMPORTANT, 
-                                            INTERNAL_DESCRIPTION) << "Bad prime.\n";
-                        continue;
-                    }
-                    cra.progress(F, poly);
+			++primeg; while(cra.noncoprime(*primeg)) ++primeg;
+			Field F(*primeg);
+			for (p = FA, raw_p = M. rawBegin();
+			     p != FA + (n*n); ++ p, ++ raw_p)
+
+				F. init (*p, *raw_p);
+
+			FFPACK::MinPoly( F, poly, n, FA, n, X, n, Perm);
+
+			if(poly. size() != degree + 1) {
+				commentator.report (Commentator::LEVEL_IMPORTANT,
+						    INTERNAL_DESCRIPTION) << "Bad prime.\n";
+				continue;
+			}
+			cra.progress(F, poly);
 		}
 		cra. result(y);
-                    //std::cout << "Number of primes needed: " << cra. steps() << std::endl;
+		//std::cout << "Number of primes needed: " << cra. steps() << std::endl;
 		delete FA; delete X; delete Perm;
-                
+
 		return y;
 	}
 
 
 	template <class _Integer, class _Field>
 	template <class Ring>
-	int MinPolyBlas<_Integer, _Field>::minPolyDegreeBlas (const DenseMatrix<Ring>& M, int n_try) {
+	int MinPolyBlas<_Integer, _Field>::minPolyDegreeBlas (const DenseMatrix<Ring>& M, int n_try)
+	{
 		size_t n = M. rowdim();
 		int degree = 0;
 		Element* FA = new Element [n*n];
@@ -298,23 +332,23 @@ namespace LinBox {
 		Element* p;
 		std::vector<Element> Poly;
 
-		integer mmodulus; 
+		integer mmodulus;
 		FieldTraits<Field>::maxModulus(mmodulus);
 		long bit1 = (long) floor (log((double)mmodulus)/M_LN2);
 		long bit2 = (long) floor (log(sqrt(double(4503599627370496LL/n)))/M_LN2);
-		RandomPrimeIterator primeg(bit1 < bit2 ? bit1 : bit2); 
-		
+		RandomPrimeIterator primeg(bit1 < bit2 ? bit1 : bit2);
+
 		typename DenseMatrix<Ring>::ConstRawIterator raw_p;
 		for (int i = 0; i < n_try; ++ i) {
 			++primeg;
 			Field F(*primeg);
-			for (p = FA, raw_p = M. rawBegin(); 
-				 p!= FA + (n*n); ++ p, ++ raw_p)
+			for (p = FA, raw_p = M. rawBegin();
+			     p!= FA + (n*n); ++ p, ++ raw_p)
 				F. init (*p, *raw_p);
 
 			FFPACK::MinPoly( F, Poly, n, FA, n, X, n, Perm);
 
-			if (degree < Poly. size() - 1) 
+			if (degree < Poly. size() - 1)
 				degree = Poly. size() -1;
 		}
 		delete FA; delete X; delete Perm;
@@ -323,4 +357,4 @@ namespace LinBox {
 	}
 } // LinBox
 
-#endif
+#endif //__LINBOX_minpoly_integer_H
diff --git a/linbox/algorithms/minpoly-rational.h b/linbox/algorithms/minpoly-rational.h
new file mode 100644
index 0000000..5c18e8b
--- /dev/null
+++ b/linbox/algorithms/minpoly-rational.h
@@ -0,0 +1,328 @@
+/* -*- 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
+/* linbox/blackbox/rational-reconstruction-base.h
+ * Copyright (C) 2009 Anna Marszalek
+ *
+ * Written by Anna Marszalek <aniau at astronet.pl>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_rat_minpoly_H
+#define __LINBOX_rat_minpoly_H
+
+#include "linbox/util/commentator.h"
+#include "linbox/util/timer.h"
+#include "linbox/field/modular-double.h"
+
+//#include "linbox/field/gmp-rational.h"
+#include "linbox/field/PID-integer.h"
+#include "linbox/blackbox/rational-matrix-factory.h"
+#include "linbox/blackbox/dense.h"
+#include "linbox/algorithms/cra-early-multip.h"
+#include "linbox/algorithms/cra-domain.h"
+//#include "linbox/algorithms/rational-cra.h"
+#include "linbox/algorithms/rational-reconstruction-base.h"
+#include "linbox/algorithms/classic-rational-reconstruction.h"
+#include "linbox/solutions/minpoly.h"
+#include "linbox/blackbox/compose.h"
+#include "linbox/blackbox/diagonal.h"
+
+namespace LinBox
+{
+
+	/*
+	 * Computes the minimla polynomial of a rational dense matrix
+	 */
+
+	template<class T1, class T2>
+	struct MyModularMinpoly{
+		T1* t1;
+		T2* t2;
+
+		int switcher;
+
+		MyModularMinpoly(T1* s1, T2* s2, int s = 1)  {t1=s1; t2=s2;switcher = s;}
+
+		int setSwitcher(int s) {return switcher = s;}
+
+		template<typename Polynomial, typename Field>
+		Polynomial& operator()(Polynomial& P, const Field& F) const
+		{
+			if (switcher ==1) {
+				t1->operator()(P,F);
+			}
+			else {
+				t2->operator()(P,F);
+			}
+			return P;
+		}
+	};
+
+	template <class Blackbox, class MyMethod>
+	struct MyRationalModularMinpoly {
+		const Blackbox &A;
+		const MyMethod &M;
+		const std::vector<Integer> &mul;//multiplicative prec;
+
+		MyRationalModularMinpoly(const Blackbox& b, const MyMethod& n,
+					 const std::vector<Integer >& p) :
+			A(b), M(n), mul(p)
+		{}
+		MyRationalModularMinpoly(MyRationalModularMinpoly& C) :
+			MyRationalModularMinpoly(C.A,C.M,C.mul)
+		{}
+
+		template<typename Polynomial, typename Field>
+		Polynomial& operator()(Polynomial& P, const Field& F) const
+		{
+			typedef typename Blackbox::template rebind<Field>::other FBlackbox;
+			FBlackbox * Ap;
+			MatrixHom::map(Ap, A, F);
+			minpoly( P, *Ap, typename FieldTraits<Field>::categoryTag(), M);
+			int s = A.rowdim() +1 - P.size();//shift in preconditioning
+			typename std::vector<Integer >::const_iterator it = mul.begin() + s;
+			typename Polynomial::iterator it_p = P.begin();
+			for (;it_p !=P.end(); ++it, ++it_p) {
+				typename Field::Element e;
+				F.init(e, *it);
+				F.mulin(*it_p,e);
+			}
+
+			delete Ap;
+			return P;
+		}
+	};
+
+	template <class Blackbox, class MyMethod>
+	struct MyIntegerModularMinpoly {
+		const Blackbox &A;
+		const MyMethod &M;
+		const std::vector<typename Blackbox::Field::Element> &vD;//diagonal div. prec;
+		const std::vector<typename Blackbox::Field::Element > &mul;//multiplicative prec;
+
+		MyIntegerModularMinpoly(const Blackbox& b, const MyMethod& n,
+					const std::vector<typename Blackbox::Field::Element>& ve,
+					const std::vector<typename Blackbox::Field::Element >& p) :
+			A(b), M(n), vD(ve), mul(p) {}
+
+		MyIntegerModularMinpoly(MyIntegerModularMinpoly& C) :
+			MyIntegerModularMinpoly(C.A,C.M,C.vD,C.mul)
+		{}
+
+		template<typename Polynomial, typename Field>
+		Polynomial& operator()(Polynomial& P, const Field& F) const
+		{
+			typedef typename Blackbox::template rebind<Field>::other FBlackbox;
+			FBlackbox * Ap;
+			MatrixHom::map(Ap, A, F);
+
+			typename std::vector<typename Blackbox::Field::Element>::const_iterator it;
+
+			int i=0;
+			for (it = vD.begin(); it != vD.end(); ++it,++i) {
+				typename Field::Element t,tt;
+				F.init(t,*it);
+				F.invin(t);
+				for (int j=0; j < A.coldim(); ++j) {
+					F.mulin(Ap->refEntry(i,j),t);
+				}
+			}
+
+			minpoly( P, *Ap, typename FieldTraits<Field>::categoryTag(), M);
+			int s = A.rowdim() +1 - P.size();//shift in preconditioning
+			typename std::vector<typename Blackbox::Field::Element >::const_iterator it2 = mul.begin() + s;
+			typename Polynomial::iterator it_p = P.begin();
+			for (;it_p !=P.end(); ++it2, ++it_p) {
+				typename Field::Element e;
+				F.init(e, *it2);
+				F.mulin(*it_p,e);
+			}
+
+			delete Ap;
+			return P;
+		}
+	};
+
+	template <class Rationals, template <class> class Vector, class MyMethod >
+	Vector<typename Rationals::Element>& rational_minpoly (Vector<typename Rationals::Element> &p,
+							       const DenseMatrix<Rationals > &A,
+							       const MyMethod &Met=  Method::Hybrid())
+	{
+
+		typedef Modular<double> myModular;
+		typedef typename Rationals::Element Quotient;
+
+		commentator.start ("Rational Minpoly", "Rminpoly");
+
+		RandomPrimeIterator genprime( 26-(int)ceil(log((double)A.rowdim())*0.7213475205));
+
+		std::vector<Integer> F(A.rowdim()+1,1);
+		std::vector<Integer> M(A.rowdim()+1,1);
+		std::vector<Integer> Di(A.rowdim());
+
+		RationalMatrixFactory<PID_integer,Rationals, DenseMatrix<Rationals > > FA(&A);
+		Integer da=1, di=1; Integer D=1;
+		FA.denominator(da);
+
+		for (int i=M.size()-2; i >= 0 ; --i) {
+			//c[m]=1, c[0]=det(A);
+			FA.denominator(di,i);
+			D *=di;
+			Di[i]=di;
+			M[i] = M[i+1]*da;
+		}
+		for (int i=0; i < M.size() ; ++i ) {
+			gcd(M[i],M[i],D);
+		}
+
+		PID_integer Z;
+		DenseMatrix<PID_integer> Atilde(Z,A.rowdim(), A.coldim());
+		FA.makeAtilde(Atilde);
+
+		ChineseRemainder< EarlyMultipCRA<Modular<double> > > cra(4UL);
+		MyRationalModularMinpoly<DenseMatrix<Rationals > , MyMethod> iteration1(A, Met, M);
+		MyIntegerModularMinpoly<DenseMatrix<PID_integer>, MyMethod> iteration2(Atilde, Met, Di, M);
+		MyModularMinpoly<MyRationalModularMinpoly<DenseMatrix<Rationals > , MyMethod>,
+		MyIntegerModularMinpoly<DenseMatrix<PID_integer>, MyMethod> >  iteration(&iteration1,&iteration2);
+
+		RReconstruction<PID_integer, ClassicMaxQRationalReconstruction<PID_integer> > RR;
+
+		std::vector<Integer> PP,PP2; // use of integer due to non genericity of cra. PG 2005-08-04
+		UserTimer t1,t2;
+		t1.clear();
+		t2.clear();
+		t1.start();
+		cra(2,PP,iteration1,genprime);
+		t1.stop();
+		t2.start();
+		cra(2,PP,iteration2,genprime);
+		t2.stop();
+
+		if (t1.time() < t2.time()) {
+			//cout << "ratim";
+			iteration.setSwitcher(1);
+		}
+		else {
+			//cout << "intim";
+			iteration.setSwitcher(2);
+		}
+
+		int k=2;
+		while (! cra(k,PP, iteration, genprime)) {
+			k *=2;
+			Integer m; //Integer r; Integer a,b;
+			cra.getModulus(m);
+			cra.result(PP);//need to divide
+			for (int i=0; i < PP.size(); ++i) {
+				Integer D_1;
+				inv(D_1,M[i],m);
+				PP[i] = (PP[i]*D_1) % m;
+			}
+			Integer den,den1;
+			std::vector<Integer> num(A.rowdim()+1);
+			std::vector<Integer> num1(A.rowdim()+1);
+			if (RR.reconstructRational(num,den,PP,m,-1)) {//performs reconstruction strating form c[m], use c[i] as prec for c[i-1]
+				cra(1,PP,iteration,genprime);
+				cra.getModulus(m);
+				for (int i=0; i < PP.size(); ++i) {
+					Integer D_1;
+					inv(D_1,M[i],m);
+					PP[i] = (PP[i]*D_1) % m;
+				}
+				bool terminated = true;
+				if (RR.reconstructRational(num1,den1,PP,m,-1)) {
+					if (den==den1) {
+						for (int i=0; i < num.size(); ++i) {
+							if (num[i] != num1[i]) {
+								terminated =false;
+								break;
+							}
+						}
+					}
+					else {
+						terminated = false;
+					}
+					//set p
+					if (terminated) {
+						size_t i =0;
+						integer t,tt,ttt;
+						integer err;
+						size_t max_err = 0;
+						Quotient qerr;
+						p.resize(PP.size());
+						typename Vector <typename Rationals::Element>::iterator it;
+						Rationals Q;
+						for (it= p.begin(); it != p.end(); ++it, ++i) {
+							A.field().init(*it, num[i],den);
+							Q.get_den(t,*it);
+							if (it != p.begin()) Q.get_den(tt,*(it-1));
+							else tt = 1;
+							Q.init(qerr,t,tt);
+
+						}
+						return p;
+						break;
+					}
+				}
+			}
+		}
+
+		cra.result(PP);
+
+		size_t i =0;
+		integer t,tt;
+		integer err;
+		size_t max_res=0;int max_i; double rel;
+		size_t max_resu=0; int max_iu;
+		size_t max_err = 0;
+		Quotient qerr;
+		p.resize(PP.size());
+
+		typename Vector <typename Rationals::Element>::iterator it;
+
+		Rationals Q;
+		for (it= p.begin(); it != p.end(); ++it, ++i) {
+			A.field().init(*it, PP[i],M[i]);
+			Q.get_den(t, *it);
+			Q.get_num(tt,*it);
+			err = M[i]/t;
+			size_t resi = err.bitsize() + tt.bitsize() -1;
+			size_t resu = t.bitsize() + tt.bitsize() -1;
+			if (resi > max_res) {max_res = resi; max_i=i;}
+			if (resu > max_resu) {max_resu = resu; max_iu =i;}
+		}
+
+		max_res=0;
+		for (it= p.begin()+1; it != p.end(); ++it) {
+			Q.get_den(t, *it);
+			Q.get_den(tt, *(it-1));
+			Q.init(qerr,t,tt);
+			Q.get_num(tt, *it);
+			size_t resi = Q.bitsize(t,qerr) + tt.bitsize() -2;
+			if (resi > max_res) {max_res = resi; max_i=i;}
+		}
+
+		commentator.stop ("done", NULL, "Iminpoly");
+
+		return p;
+
+	}
+
+}
+
+#endif //__LINBOX_rat_minpoly_H
+
diff --git a/linbox/algorithms/numeric-solver-lapack.h b/linbox/algorithms/numeric-solver-lapack.h
new file mode 100644
index 0000000..c20beeb
--- /dev/null
+++ b/linbox/algorithms/numeric-solver-lapack.h
@@ -0,0 +1,84 @@
+/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* numeric-solver-lapack.h
+ *  numeric solver using lapack routines
+ *  to support development of iterative numeric/symbolic solver
+ */
+
+#ifndef __NUMERIC_SOLVER_LAPACK_H
+#define __NUMERIC_SOLVER_LAPACK_H
+
+#include <linbox/blackbox/blas-blackbox.h>
+
+namespace LinBox {
+
+template <class Matrix>
+struct LPS {
+	
+	LPS() : _Ap(NULL), _IM(NULL), _m(0), _n(0) {}
+	~LPS() { delete _IM; } 
+	LPS(Matrix& A) { init(A); }
+	int init(Matrix & A); // set up for solving - expect multiple subsequent calls to solve() and apply().
+
+	template<class Vector> int solve(Vector& x, const Vector& b); // x such that Ax = b (approx)
+	template<class Vector> Vector& apply(Vector& y, const Vector& x); // y = Ax (approx)
+
+protected:	
+	Matrix* _Ap; // for right now, assume this points to the input, double matrix A.
+	double *_IM;
+
+	size_t _m, _n;
+};
+
+template <class Matrix>
+int LPS<Matrix>::init(Matrix& A) { 
+	_Ap = &A; // would need memcpy if *_Ap to get mods.
+	_m = A.rowdim();
+	_n = A.coldim();
+	
+   //  kludgey pointer to beginning of double vals
+   void *thedata = &*(_Ap->rawBegin());
+
+	_IM = new double[_n * _n];
+   memcpy((void *)_IM, thedata, sizeof(double)*_m*_n);
+
+	// time to set up inverse of matrix
+	int lda = _n;
+	int P[_n];
+	//std::cerr << "Bef getrf: M_0,0 " << *_IM << ", M_n-1,n-1 " << *(_IM+_n*_n-1) << std::endl;
+	int ierr = clapack_dgetrf (CblasRowMajor, _n, _n, _IM, lda, P);
+	//std::cerr << "Aft getrf: M_0,0 " << *_IM << ", M_n-1,n-1 " << *(_IM+_n*_n-1) << std::endl;
+	if (ierr != 0) {
+		//std::cerr << "In LPS::init Matrix is not full rank" << std::endl;
+		return -1;
+	}
+	clapack_dgetri (CblasRowMajor, _n, _IM, lda, P);
+
+	return 0;
+} 
+
+template <class Matrix>
+template<class Vector>
+int LPS<Matrix>::solve(Vector& x, const Vector& b) {
+	const double * bdata = &*(b.begin());
+	double * xdata = &*(x.begin());
+	
+	cblas_dgemv(CblasRowMajor, CblasNoTrans, _m, _n, 1, _IM, _n, bdata, 1, 0, xdata, 1);
+
+	return 0;
+}
+
+template <class Matrix>
+template<class Vector>
+Vector& LPS<Matrix>::apply(Vector& y, const Vector& x) { 
+	const double * xdata = &*(x.begin());
+	double * ydata = &*(y.begin());
+   double *thedata = &*(_Ap->rawBegin());
+
+	cblas_dgemv(CblasRowMajor, CblasNoTrans, _m, _n, 1, thedata, _n, xdata, 1, 0, ydata, 1);
+
+	return y;
+}
+
+} // namespace LinBox
+
+#endif // __NUMERIC_SOLVER_LAPACK_H
diff --git a/linbox/algorithms/one-invariant-factor.h b/linbox/algorithms/one-invariant-factor.h
old mode 100755
new mode 100644
index 1a8fe95..455e372
--- a/linbox/algorithms/one-invariant-factor.h
+++ b/linbox/algorithms/one-invariant-factor.h
@@ -1,254 +1,287 @@
-/* File: ith-invaraint-factor.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
+/* Copyright (C) LinBox
+ *
  *  Author: Zhendong Wan
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
-#ifndef __LINBOX__ITH_INVARIANT_FACTOR_H__
-#define __LINBOX__ITH_INVARIANT_FACTOR_H__
+
+#ifndef __LINBOX_ith_invariant_factor_H
+#define __LINBOX_ith_invariant_factor_H
 
 #include <linbox/util/debug.h>
 #include <linbox/algorithms/default.h>
 #include <linbox/blackbox/compose.h>
 #include <linbox/blackbox/random-matrix-traits.h>
 
-namespace LinBox {
-	
-/// \brief Limited doc so far.
+namespace LinBox
+{
+
+	/// \brief Limited doc so far.
 	template<class _Ring,
-		class _LastInvariantFactor,
-		class _Compose,
-		class _RandomMatrix>
-		
-		class OneInvariantFactor {
-
-		public:
-		
+	class _LastInvariantFactor,
+	class _Compose,
+	class _RandomMatrix>
+
+	class OneInvariantFactor {
+
+	public:
+
 		typedef _LastInvariantFactor LastInvariantFactor;
-		
+
 		typedef _Ring Ring;
 
 		typedef _Compose Compose;
 
 		typedef _RandomMatrix RandomMatrix;
-		
+
 		typedef typename Ring::Element Integer;
-		
-		protected:
-	
-			Ring r;
-			
-			LastInvariantFactor lif;
-
-			Compose compose;
-
-			RandomMatrix randomMatrix;
-			
-			int threshold;
-
-			double crossover;
-			
-			public:			
-			
-			OneInvariantFactor(const Ring& _r = Ring(),
-					   const LastInvariantFactor& _lif =LastInvariantFactor(),
-					   const Compose& _compose =Compose(),
-					   const RandomMatrix& _randomMatrix = RandomMatrix(),
-					   int _threshold =DEFAULTOIFTHRESHOLD)
-				:r(_r), lif(_lif), compose(_compose), randomMatrix(_randomMatrix), 
-				threshold(_threshold), crossover(CROSSOVER) {
-				
-				if (_threshold <= 0) threshold = DEFAULTOIFTHRESHOLD;
-			}
-			
-			void setThreshold (int _threshold) {
-				if (_threshold > 0) {
-					threshold = _threshold; 
-				}
-				
-			}
-			
-			int getThreshold () const {
-				return threshold;
-			}
-			
-			void setCrossover(double t) {
-				if(0 <= t <= 1)
-					crossover = t;
 
-			}
+	protected:
 
-			double getCrossover() const {
-				return crossover;
-			}
+		Ring r;
 
-			LastInvariantFactor& getLastInvariantFactor () {
-				return lif;
-			}
-			
-			const LastInvariantFactor& getLastInvariantFactor () const {
-				return lif;
-			}
+		LastInvariantFactor lif;
 
-			/** \brief Compute the i-th invariant factor of A, 
-			 *  ignoring those factors of prime in PrimeL list.
-			 *  It implements EGV++ (by bds), the adaptive algorithm of EGV and EGV+.
-			 */
-			template<class IMatrix, class Vector>
-				Integer& oneInvariantFactor(Integer& oif, const IMatrix& A, 
-							    int i, Vector& PrimeL) const {	
-				
-				// some check
-				linbox_check(0 < i);
-				linbox_check((unsigned int)i <= A.rowdim());
-				linbox_check((unsigned int)i <= A.coldim());
-				
-				
-			
-				// if oif is the last invariant factor of A
-				if ( ((unsigned int)i == A.rowdim()) && (A.rowdim() == A.coldim())) {
-
-					lif.lastInvariantFactor(oif, A, PrimeL);
-					return oif;
-				}				
-					
-				r.init (oif, 0);
-
-				int count;
-
-				Integer prev, tmp_i;
-
-				//typename RandomMatrixTraits<IMatrix>::value_type *L, *U;
-
-				typename RandomMatrixTraits<IMatrix>::value_type *R, *L;
-				
-				typename ComposeTraits<IMatrix>::value_type* LAR;//*AUV; 
-
-
-				// repeat threshold times
-				for (count =0; count < threshold; ++ count) {
-
-					r.assign (prev, oif);
-
-					/*
-					// Use A + UV
-					if ((A.rowdim() == A.coldim()) && (i > crossover * A.rowdim())) {
-						
-						randomMatrix.randomMatrix(U, r, A.rowdim(), A.coldim() - i);
-						
-						randomMatrix.randomMatrix(V, r, A.rowdim() - i, A.coldim());
-						
-						compose.composeBig(AUV, A, *U, *V);
-
-						// compute the last invariant factor of RAL
-						lif.lastInvariantFactor(tmp_i, *AUV, PrimeL);
-					
-						// free memory.
-						delete U;
-						delete V;
-						delete AUV;
-						
-					}
-					else {
-					}
-					*/
-					// Always use LAR please refer ISSAC'04 paper by BDS and ZW
-					randomMatrix.randomMatrix(L, r, i, A.rowdim());
-						
-					randomMatrix.randomMatrix(R, r, A.coldim(), i);
-						
-					compose.compose(LAR, *L, A, *R);
-						
-					lif.lastInvariantFactor(tmp_i, *LAR, PrimeL);
-
-					//free memory
-					delete L;
-					delete R;
-					delete LAR;
-				
-					r.gcd(oif, tmp_i, prev);
-			
-					// if oif reaches one
-					if ( r.isOne(oif) ) break;		
-					
-				}
-					
-				return oif;
+		Compose compose;
+
+		RandomMatrix randomMatrix;
+
+		int threshold;
+
+		double crossover;
+
+	public:
+
+		OneInvariantFactor(const Ring& _r = Ring(),
+				   const LastInvariantFactor& _lif =LastInvariantFactor(),
+				   const Compose& _compose =Compose(),
+				   const RandomMatrix& _randomMatrix = RandomMatrix(),
+				   int _threshold =DEFAULTOIFTHRESHOLD) :
+			r(_r), lif(_lif), compose(_compose), randomMatrix(_randomMatrix),
+			threshold(_threshold), crossover(CROSSOVER)
+		{
+
+			if (_threshold <= 0) threshold = DEFAULTOIFTHRESHOLD;
+		}
+
+		void setThreshold (int _threshold)
+		{
+			if (_threshold > 0) {
+				threshold = _threshold;
 			}
-			
-		 	/** \brief Compute the i-th invariant factor of A.
-			 *  It implements the adaptive algorithm of EGV and EGV+.
-			 */
-			template<class IMatrix>
-				Integer& oneInvariantFactor(Integer& oif, const IMatrix& A, int i) const {   
-				
-				std::vector<Integer> empty_v;
 
-				oneInvariantFactor (oif, A, i, empty_v);
+		}
+
+		int getThreshold () const
+		{
+			return threshold;
+		}
+
+		void setCrossover(double t)
+		{
+			if(0 <= t <= 1)
+				crossover = t;
+
+		}
+
+		double getCrossover() const
+		{
+			return crossover;
+		}
+
+		LastInvariantFactor& getLastInvariantFactor ()
+		{
+			return lif;
+		}
+
+		const LastInvariantFactor& getLastInvariantFactor () const
+		{
+			return lif;
+		}
+
+		/** \brief Compute the i-th invariant factor of A,
+		 *  ignoring those factors of prime in PrimeL list.
+		 *  It implements EGV++ (by bds), the adaptive algorithm of EGV and EGV+.
+		 */
+		template<class IMatrix, class Vector>
+		Integer& oneInvariantFactor(Integer& oif, const IMatrix& A,
+					    int i, Vector& PrimeL) const
+		{
+
+			// some check
+			linbox_check(0 < i);
+			linbox_check((unsigned int)i <= A.rowdim());
+			linbox_check((unsigned int)i <= A.coldim());
+
+
 
+			// if oif is the last invariant factor of A
+			if ( ((unsigned int)i == A.rowdim()) && (A.rowdim() == A.coldim())) {
+
+				lif.lastInvariantFactor(oif, A, PrimeL);
 				return oif;
 			}
 
-			/** \brief Compute the i-th invariant factor of A with bonus, 
-			 *  ignoring those factors of prime in PrimeL list.
-			 *  It implements EGV++ (by bds), the adaptive algorithm of EGV and EGV+.
-			 */
-			template<class IMatrix, class Vector>
-				Integer& oneInvariantFactor_Bonus(Integer& oif, Integer& bonus, const IMatrix& A, 
-							    int i, Vector& PrimeL) const {	
-				// some check
-				linbox_check(0 < i);
-				linbox_check((unsigned int)i <= A.rowdim());
-				linbox_check((unsigned int)i <= A.coldim());
-				
-				// if oif is the last invariant factor of A
-				if ( ((unsigned int)i == A.rowdim()) && (A.rowdim() == A.coldim())) {
-					lif.lastInvariantFactor_Bonus(oif, bonus, A, PrimeL);
-					return oif;
-				}				
-					
-				r.init (oif, 0); r. init (bonus, 0);
-				int count;
-				Integer prev, tmp_i, p_bonus;
-				//typename RandomMatrixTraits<IMatrix>::value_type *L, *U;
-				typename RandomMatrixTraits<IMatrix>::value_type *R, *L;
-				typename ComposeTraits<IMatrix>::value_type* LAR;//*AUV; 
-				// repeat threshold times
-				for (count =0; count < threshold; ++ count) {
-					r.assign (prev, oif); r. assign (p_bonus, bonus);
-					// Always use LAR please refer ISSAC'04 papre by BDS and ZW
-					randomMatrix.randomMatrix(L, r, i, A.rowdim());
-					randomMatrix.randomMatrix(R, r, A.coldim(), i);
-					compose.compose(LAR, *L, A, *R);
-					lif.lastInvariantFactor_Bonus(tmp_i, bonus, *LAR, PrimeL);
-
-					//free memory
-					delete L;
-					delete R;
-					delete LAR;
-					r. gcd(oif, tmp_i, prev);
-					r. gcdin (bonus, p_bonus);
-					// if oif reaches one
-					if ( r.isOne(oif) ) break;		
-					
+			r.init (oif, 0);
+
+			int count;
+
+			Integer prev, tmp_i;
+
+			//typename RandomMatrixTraits<IMatrix>::value_type *L, *U;
+
+			typename RandomMatrixTraits<IMatrix>::value_type *R, *L;
+
+			typename ComposeTraits<IMatrix>::value_type* LAR;//*AUV;
+
+
+			// repeat threshold times
+			for (count =0; count < threshold; ++ count) {
+
+				r.assign (prev, oif);
+
+				/*
+				// Use A + UV
+				if ((A.rowdim() == A.coldim()) && (i > crossover * A.rowdim())) {
+
+				randomMatrix.randomMatrix(U, r, A.rowdim(), A.coldim() - i);
+
+				randomMatrix.randomMatrix(V, r, A.rowdim() - i, A.coldim());
+
+				compose.composeBig(AUV, A, *U, *V);
+
+				// compute the last invariant factor of RAL
+				lif.lastInvariantFactor(tmp_i, *AUV, PrimeL);
+
+				// free memory.
+				delete U;
+				delete V;
+				delete AUV;
+
+				}
+				else {
 				}
-					
+				*/
+				// Always use LAR please refer ISSAC'04 paper by BDS and ZW
+				randomMatrix.randomMatrix(L, r, i, A.rowdim());
+
+				randomMatrix.randomMatrix(R, r, A.coldim(), i);
+
+				compose.compose(LAR, *L, A, *R);
+
+				lif.lastInvariantFactor(tmp_i, *LAR, PrimeL);
+
+				//free memory
+				delete L;
+				delete R;
+				delete LAR;
+
+				r.gcd(oif, tmp_i, prev);
+
+				// if oif reaches one
+				if ( r.isOne(oif) ) break;
+
+			}
+
+			return oif;
+		}
+
+		/** \brief Compute the i-th invariant factor of A.
+		 *  It implements the adaptive algorithm of EGV and EGV+.
+		 */
+		template<class IMatrix>
+		Integer& oneInvariantFactor(Integer& oif, const IMatrix& A, int i) const
+		{
+
+			std::vector<Integer> empty_v;
+
+			oneInvariantFactor (oif, A, i, empty_v);
+
+			return oif;
+		}
+
+		/** \brief Compute the i-th invariant factor of A with bonus,
+		 *  ignoring those factors of prime in PrimeL list.
+		 *  It implements EGV++ (by bds), the adaptive algorithm of EGV and EGV+.
+		 */
+		template<class IMatrix, class Vector>
+		Integer& oneInvariantFactor_Bonus(Integer& oif, Integer& bonus, const IMatrix& A,
+						  int i, Vector& PrimeL) const
+		{
+			// some check
+			linbox_check(0 < i);
+			linbox_check((unsigned int)i <= A.rowdim());
+			linbox_check((unsigned int)i <= A.coldim());
+
+			// if oif is the last invariant factor of A
+			if ( ((unsigned int)i == A.rowdim()) && (A.rowdim() == A.coldim())) {
+				lif.lastInvariantFactor_Bonus(oif, bonus, A, PrimeL);
 				return oif;
 			}
-			
-		 	/** \brief Compute the i-th invariant factor of A.
-			 *  It implements the adaptive algorithm of EGV and EGV+.
-			 */
-			template<class IMatrix>
-				Integer& oneInvariantFactor_Bonus(Integer& oif, Integer& bonus, const IMatrix& A, int i) const {   
-				
-				std::vector<Integer> empty_v;
 
-				oneInvariantFactor_Bonus (oif, bonus, A, i, empty_v);
+			r.init (oif, 0); r. init (bonus, 0);
+			int count;
+			Integer prev, tmp_i, p_bonus;
+			//typename RandomMatrixTraits<IMatrix>::value_type *L, *U;
+			typename RandomMatrixTraits<IMatrix>::value_type *R, *L;
+			typename ComposeTraits<IMatrix>::value_type* LAR;//*AUV;
+			// repeat threshold times
+			for (count =0; count < threshold; ++ count) {
+				r.assign (prev, oif); r. assign (p_bonus, bonus);
+				// Always use LAR please refer ISSAC'04 papre by BDS and ZW
+				randomMatrix.randomMatrix(L, r, i, A.rowdim());
+				randomMatrix.randomMatrix(R, r, A.coldim(), i);
+				compose.compose(LAR, *L, A, *R);
+				lif.lastInvariantFactor_Bonus(tmp_i, bonus, *LAR, PrimeL);
+
+				//free memory
+				delete L;
+				delete R;
+				delete LAR;
+				r. gcd(oif, tmp_i, prev);
+				r. gcdin (bonus, p_bonus);
+				// if oif reaches one
+				if ( r.isOne(oif) ) break;
 
-				return oif;
 			}
 
+			return oif;
+		}
+
+		/** \brief Compute the i-th invariant factor of A.
+		 *  It implements the adaptive algorithm of EGV and EGV+.
+		 */
+		template<class IMatrix>
+		Integer& oneInvariantFactor_Bonus(Integer& oif, Integer& bonus, const IMatrix& A, int i) const
+		{
+
+			std::vector<Integer> empty_v;
+
+			oneInvariantFactor_Bonus (oif, bonus, A, i, empty_v);
+
+			return oif;
+		}
+
 
 	};
 }
 
 
-#endif				
+#endif	//__LINBOX_ith_invariant_factor_H
+
diff --git a/linbox/algorithms/rational-cra-early-multip.h b/linbox/algorithms/rational-cra-early-multip.h
index c28dc4a..6670c90 100644
--- a/linbox/algorithms/rational-cra-early-multip.h
+++ b/linbox/algorithms/rational-cra-early-multip.h
@@ -1,44 +1,65 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-// ======================================================================= //
-// Time-stamp: <12 Mar 07 19:38:56 Jean-Guillaume.Dumas at imag.fr> 
-// ======================================================================= //
-#ifndef __LINBOX_RATIONAL_EARLY_MULTIP_CRA_H
-#define __LINBOX_RATIONAL_EARLY_MULTIP_CRA_H
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) 2010 LinBox
+ * Written by <Jean-Guillaume.Dumas at imag.fr>
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_rational_early_multip_cra_H
+#define __LINBOX_rational_early_multip_cra_H
 
 #include "linbox/field/PID-integer.h"
 #include "linbox/algorithms/rational-cra-early-single.h"
 #include "linbox/algorithms/rational-cra-full-multip.h"
 
-namespace LinBox {
-	
+namespace LinBox
+{
+
 	template<class Domain_Type>
 	struct EarlyMultipRatCRA : public EarlySingleRatCRA<Domain_Type>, public FullMultipRatCRA<Domain_Type> {
 		typedef Domain_Type			Domain;
 		typedef typename Domain_Type::Element 	DomainElement;
 		typedef EarlyMultipRatCRA<Domain>	Self_t;
 	protected:
-		// Random coefficients for a linear combination 
+		// Random coefficients for a linear combination
 		// of the elements to be reconstructed
 		std::vector< unsigned long >      	randv;
-		
+
 	public:
-		
-		
-		EarlyMultipRatCRA(const unsigned long EARLY=DEFAULT_EARLY_TERM_THRESHOLD) 
-			: EarlySingleRatCRA<Domain>(EARLY), FullMultipRatCRA<Domain>() {
-		}
-		
-		
+
+
+		EarlyMultipRatCRA(const unsigned long EARLY=DEFAULT_EARLY_TERM_THRESHOLD) :
+			EarlySingleRatCRA<Domain>(EARLY), FullMultipRatCRA<Domain>()
+		{ }
+
+
 		template<template<class, class> class Vect, template <class> class Alloc>
-		void initialize (const Domain& D, const Vect <DomainElement, Alloc<DomainElement> >& e) {
-			// Random coefficients for a linear combination 
+		void initialize (const Domain& D, const Vect <DomainElement, Alloc<DomainElement> >& e)
+		{
+			// Random coefficients for a linear combination
 			// of the elements to be reconstructed
 			srand48(BaseTimer::seed());
 			randv. resize ( e.size() );
-			for ( std::vector<unsigned long>::iterator int_p = randv. begin(); 
-			      int_p != randv. end(); ++ int_p) 
-				*int_p = ((unsigned long)lrand48()) % 20000;        
-			
+			for ( std::vector<unsigned long>::iterator int_p = randv. begin();
+			      int_p != randv. end(); ++ int_p)
+				*int_p = ((unsigned long)lrand48()) % 20000;
+
 			DomainElement z;
 			// Could be much faster
 			// - do not compute twice the product of moduli
@@ -47,10 +68,11 @@ namespace LinBox {
 			EarlySingleRatCRA<Domain>::initialize(D,dot(z, D, e, randv) );
 			FullMultipRatCRA<Domain>::initialize(D, e);
 		}
-		
-		
-		template<template<class,class> class Vect, template <class> class Alloc> 
-		void progress (const Domain& D, const Vect<DomainElement, Alloc<DomainElement> >& e) {
+
+
+		template<template<class,class> class Vect, template <class> class Alloc>
+		void progress (const Domain& D, const Vect<DomainElement, Alloc<DomainElement> >& e)
+		{
 			DomainElement z;
 			// Could be much faster
 			// - do not compute twice the product of moduli
@@ -59,39 +81,45 @@ namespace LinBox {
 			EarlySingleRatCRA<Domain>::progress(D, dot(z, D, e, randv));
 			FullMultipRatCRA<Domain>::progress(D, e);
 		}
-		
+
 		template<template<class, class> class Vect, template <class> class Alloc>
-		Vect<Integer, Alloc<Integer> >& result(Vect<Integer, Alloc<Integer> >& num, Integer& den) {
+		Vect<Integer, Alloc<Integer> >& result(Vect<Integer, Alloc<Integer> >& num, Integer& den)
+		{
 			return FullMultipRatCRA<Domain>::result(num, den);
 		}
-		
-		bool terminated() {
+
+		bool terminated()
+		{
 			return EarlySingleRatCRA<Domain>::terminated();
 		}
-		
-		bool noncoprime(const Integer& i) const {
+
+		bool noncoprime(const Integer& i) const
+		{
 			return EarlySingleRatCRA<Domain>::noncoprime(i);
 		}
-		
+
 	protected:
-		
+
 		template <template<class, class> class Vect1, template <class> class Alloc, class Vect2>
-		DomainElement& dot (DomainElement& z, const Domain& D, 
-				    const Vect1<DomainElement, Alloc<DomainElement> >& v1, const Vect2& v2) {
-			
+		DomainElement& dot (DomainElement& z, const Domain& D,
+				    const Vect1<DomainElement, Alloc<DomainElement> >& v1, const Vect2& v2)
+		{
+
 			D.init(z,0); DomainElement tmp;
 			typename Vect1<DomainElement, Alloc<DomainElement> >::const_iterator v1_p;
 			typename Vect2::const_iterator v2_p;
-				for (v1_p  = v1. begin(), v2_p = v2. begin(); 
-				     v1_p != v1. end(); 
-				     ++ v1_p, ++ v2_p)       
-					D.axpyin(z, (*v1_p), D.init(tmp, (*v2_p)));
-            
-				//             commentator.report(Commentator::LEVEL_ALWAYS, INTERNAL_DESCRIPTION) << "v: " << v2 << std::endl;
-				//             commentator.report(Commentator::LEVEL_ALWAYS, INTERNAL_DESCRIPTION) << "z: " << z << std::endl;
-				return z;
-			}
-			};
-	}
-		
+			for (v1_p  = v1. begin(), v2_p = v2. begin();
+			     v1_p != v1. end();
+			     ++ v1_p, ++ v2_p)
+				D.axpyin(z, (*v1_p), D.init(tmp, (*v2_p)));
+#if 0
+			commentator.report(Commentator::LEVEL_ALWAYS, INTERNAL_DESCRIPTION) << "v: " << v2 << std::endl;
+			commentator.report(Commentator::LEVEL_ALWAYS, INTERNAL_DESCRIPTION) << "z: " << z << std::endl;
 #endif
+			return z;
+		}
+	};
+}
+
+#endif //__LINBOX_rational_early_multip_cra_H
+
diff --git a/linbox/algorithms/rational-cra-early-single.h b/linbox/algorithms/rational-cra-early-single.h
index cf4397a..a103347 100644
--- a/linbox/algorithms/rational-cra-early-single.h
+++ b/linbox/algorithms/rational-cra-early-single.h
@@ -1,66 +1,143 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-// ======================================================================= //
-// Time-stamp: <12 Mar 07 19:34:19 Jean-Guillaume.Dumas at imag.fr> 
-// ======================================================================= //
-#ifndef __LINBOX_RATIONAL_EARLY_SINGLE_CRA_H
-#define __LINBOX_RATIONAL_EARLY_SINGLE_CRA_H
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) 2007 LinBox
+ * Written by <Jean-Guillaume.Dumas at imag.fr>
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_rational_early_single_cra_H
+#define __LINBOX_rational_early_single_cra_H
 
 #include "linbox/field/PID-integer.h"
 #include "linbox/algorithms/cra-early-single.h"
 
-namespace LinBox {
-
-    template<class Domain_Type>
-    struct EarlySingleRatCRA : public EarlySingleCRA<Domain_Type> {
-        typedef Domain_Type				Domain;
-        typedef EarlySingleCRA<Domain> 			Father_t;
-        typedef typename Father_t::DomainElement 	DomainElement;
-        typedef EarlySingleRatCRA<Domain>		Self_t;
-        PID_integer _ZZ;
-
-        Integer					Numer0;
-        Integer					Denom0;
-
-    public:
-
-	    EarlySingleRatCRA(const unsigned long EARLY=DEFAULT_EARLY_TERM_THRESHOLD) 
-			    : Father_t(EARLY) {}
-	    
-	    void progress (const Domain& D, const DomainElement& e) {
-		    DomainElement u0, m0;
-		    
-		    fieldreconstruct(this->residue_, D, e, D.init(u0,this->residue_), D.init(m0,this->primeProd_), Integer(this->residue_), this->primeProd_);
-		    D.characteristic( this->nextM_ );
-		    this->primeProd_ *= this->nextM_;
-		    Integer a, b;
-		    _ZZ.reconstructRational(a, b, this->residue_, this->primeProd_);
-		    if ((a == Numer0) && (b == Denom0))
-			    ++this->occurency_;
-		    else {
-			    this->occurency_ = 1;
-			    Numer0 = a;
-			    Denom0 = b;
-		    } 
-	    }
-	    
-	    void initialize (const Domain& D, const DomainElement& e) {
-		    Father_t::initialize(D, e);
-		    _ZZ.reconstructRational(Numer0, Denom0, this->residue_, this->primeProd_);
-	    }
-	    
-    protected:
-	    
-        Integer& fieldreconstruct(Integer& res, const Domain& D1, const DomainElement& u1, DomainElement& u0, DomainElement& m0, const Integer& r0, const Integer& P0) {
-                // u0 and m0 are modified
-            D1.negin(u0);   	// u0 <-- -u0
-            D1.addin(u0,u1);	// u0 <-- u1-u0
-            D1.invin(m0);	// m0 <-- m0^{-1} mod m1
-            D1.mulin(u0, m0);   // u0 <-- (u1-u0)( m0^{-1} mod m1 )
-            D1.convert(res, u0);// res <-- (u1-u0)( m0^{-1} mod m1 )         and res <  m1
-            res *= P0;      	// res <-- (u1-u0)( m0^{-1} mod m1 ) m0      and res <= (m0m1-m0)
-            return res += r0;   // res <-- u0 + (u1-u0)( m0^{-1} mod m1 ) m0 and res <  m0m1
-        }
-    };
+namespace LinBox
+{
+
+	template<class Domain_Type>
+	struct EarlySingleRatCRA : public EarlySingleCRA<Domain_Type> {
+		typedef Domain_Type				Domain;
+		typedef EarlySingleCRA<Domain> 			Father_t;
+		typedef typename Father_t::DomainElement 	DomainElement;
+		typedef EarlySingleRatCRA<Domain>		Self_t;
+		PID_integer _ZZ;
+
+		Integer					Numer0;
+		Integer					Denom0;
+
+	public:
+
+		EarlySingleRatCRA(const unsigned long EARLY=DEFAULT_EARLY_TERM_THRESHOLD) :
+			Father_t(EARLY)
+		{}
+
+		void progress (const Domain& D, const DomainElement& e)
+		{
+			DomainElement u0, m0;
+
+			fieldreconstruct(this->residue_, D, e, D.init(u0,this->residue_), D.init(m0,this->primeProd_), Integer(this->residue_), this->primeProd_);
+			D.characteristic( this->nextM_ );
+			this->primeProd_ *= this->nextM_;
+			Integer a, b;
+			_ZZ.reconstructRational(a, b, this->residue_, this->primeProd_);
+			if ((a == Numer0) && (b == Denom0))
+				++this->occurency_;
+			else {
+				this->occurency_ = 1;
+				Numer0 = a;
+				Denom0 = b;
+			}
+		}
+
+		void progress (const Integer & D, const Integer & e)
+		{
+			Integer u0 = this->residue_   %D;
+			Integer	m0 = this->primeProd_ %D;
+
+			fieldreconstruct(this->residue_, D, e, u0, m0, Integer(this->residue_), this->primeProd_);
+			this->primeProd_ *= this->nextM_;
+			Integer a, b;
+			_ZZ.reconstructRational(a, b, this->residue_, this->primeProd_);
+			if ((a == Numer0) && (b == Denom0))
+				++this->occurency_;
+			else {
+				this->occurency_ = 1;
+				Numer0 = a;
+				Denom0 = b;
+			}
+		}
+
+
+		void initialize (const Domain& D, const DomainElement& e)
+		{
+			Father_t::initialize(D, e);
+			_ZZ.reconstructRational(Numer0, Denom0, this->residue_, this->primeProd_);
+		}
+
+		void initialize (const Integer& D, const Integer& e)
+	       	{
+			Father_t::initialize(D, e);
+			_ZZ.reconstructRational(Numer0, Denom0, this->residue_, this->primeProd_);
+		}
+
+		Integer& result(Integer& Num, Integer& Den)
+		{
+			Den = Denom0;
+			return Num=Numer0;
+		}
+
+		Integer& result(Integer& d)
+		{
+			throw "not a good idea calling this function here !!" ;
+		}
+	protected:
+
+		Integer& fieldreconstruct(Integer& res, const Domain& D1,
+					  const DomainElement& u1, DomainElement& u0,
+					  DomainElement& m0, const Integer& r0,
+					  const Integer& P0)
+		{
+			// u0 and m0 are modified
+			D1.negin(u0);   	// u0 <-- -u0
+			D1.addin(u0,u1);	// u0 <-- u1-u0
+			D1.invin(m0);	// m0 <-- m0^{-1} mod m1
+			D1.mulin(u0, m0);   // u0 <-- (u1-u0)( m0^{-1} mod m1 )
+			D1.convert(res, u0);// res <-- (u1-u0)( m0^{-1} mod m1 )         and res <  m1
+			res *= P0;      	// res <-- (u1-u0)( m0^{-1} mod m1 ) m0      and res <= (m0m1-m0)
+			return res += r0;   // res <-- u0 + (u1-u0)( m0^{-1} mod m1 ) m0 and res <  m0m1
+		}
+
+		Integer& fieldreconstruct(Integer& res, const Integer& D,
+					  const Integer & u1, Integer & u0,
+					  Integer & m0, const Integer& r0,
+					  const Integer& P0)
+		{
+			// u0 and m0 are modified
+			inv(m0,m0,D);           // m0 <-- m0^{-1} mod m1
+			u0 = (u1-u0) ;
+			u0 *= m0 ;
+			u0 %= D  ;              // u0 <-- (u1-u0)( m0^{-1} mod m1 )
+			res = u0*P0 ;        	// res <-- (u1-u0)( m0^{-1} mod m1 ) m0      and res <= (m0m1-m0)
+			return res += r0;   // res <-- u0 + (u1-u0)( m0^{-1} mod m1 ) m0 and res <  m0m1
+		}
+	};
 }
 
 #endif
+
diff --git a/linbox/algorithms/rational-cra-full-multip.h b/linbox/algorithms/rational-cra-full-multip.h
index d2d0dad..f8c963c 100644
--- a/linbox/algorithms/rational-cra-full-multip.h
+++ b/linbox/algorithms/rational-cra-full-multip.h
@@ -1,107 +1,143 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-// ======================================================================= //
-// Time-stamp: <12 Mar 07 18:42:58 Jean-Guillaume.Dumas at imag.fr> 
-// ======================================================================= //
-#ifndef __LINBOX_RATIONAL_FULL_MULTIP_CRA_H
-#define __LINBOX_RATIONAL_FULL_MULTIP_CRA_H
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) 2007  LinBox
+ * Written by JG Dumas
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_rational_full_multip_cra_H
+#define __LINBOX_rational_full_multip_cra_H
 
 #include "linbox/field/PID-integer.h"
 #include "linbox/algorithms/cra-full-multip.h"
 
-namespace LinBox {
+namespace LinBox
+{
+
+#if 0
+	template<class T, template <class T> class Container>
+	std::ostream& operator<< (std::ostream& o, const Container<T>& C) {
+		for(typename Container<T>::const_iterator refs =  C.begin();
+		    refs != C.end() ;
+		    ++refs )
+			o << (*refs) << " " ;
+		return o << std::endl;
+	}
+#endif
+
+	template<class Domain_Type>
+	struct FullMultipRatCRA : public virtual FullMultipCRA<Domain_Type> {
+		typedef Domain_Type				Domain;
+		typedef FullMultipCRA<Domain> 			Father_t;
+		typedef typename Father_t::DomainElement 	DomainElement;
+		typedef FullMultipRatCRA<Domain>		Self_t;
+		PID_integer _ZZ;
+	public:
 
-//     template<class T, template <class T> class Container>
-//     std::ostream& operator<< (std::ostream& o, const Container<T>& C) {
-//         for(typename Container<T>::const_iterator refs =  C.begin();
-//             refs != C.end() ;
-//             ++refs )
-//             o << (*refs) << " " ;
-//         return o << std::endl;
-//     }
+		using Father_t::RadixSizes_;
+		using Father_t::RadixResidues_;
+		using Father_t::RadixPrimeProd_;
+		using Father_t::RadixOccupancy_;
 
-    template<class Domain_Type>
-    struct FullMultipRatCRA : public virtual FullMultipCRA<Domain_Type> {
-        typedef Domain_Type				Domain;
-        typedef FullMultipCRA<Domain> 			Father_t;
-        typedef typename Father_t::DomainElement 	DomainElement;
-        typedef FullMultipRatCRA<Domain>		Self_t;
-        PID_integer _ZZ;
-    public:
 
-        using Father_t::RadixSizes_;
-        using Father_t::RadixResidues_; 
-        using Father_t::RadixPrimeProd_;
-        using Father_t::RadixOccupancy_;
-        
+		FullMultipRatCRA(const double BOUND = 0.0) :
+			Father_t(BOUND)
+		{}
 
-        FullMultipRatCRA(const double BOUND = 0.0) : Father_t(BOUND) {}
 
-		
-	    template<template<class, class> class Vect, template <class> class Alloc>
-	    Vect<Integer, Alloc<Integer> >& result (Vect<Integer, Alloc<Integer> > &num, Integer& den){
-            num.resize( (Father_t::RadixResidues_.front()).size() );
-            std::vector< LazyProduct >::iterator 			_mod_it = Father_t::RadixPrimeProd_.begin();
-            std::vector< std::vector< Integer > >::iterator _tab_it = Father_t::RadixResidues_.begin();
-            std::vector< bool >::iterator    				_occ_it = Father_t::RadixOccupancy_.begin();
-            LazyProduct Product;
-            for( ; _occ_it != Father_t::RadixOccupancy_.end() ; ++_mod_it, ++_tab_it, ++_occ_it) {
-                if (*_occ_it) {
-                    Product = *_mod_it;
-                    std::vector<Integer>::iterator t0_it = num.begin();
-                    std::vector<Integer>::iterator t_it = _tab_it->begin();
-                    if (++_occ_it == Father_t::RadixOccupancy_.end()) {
-                        den = 1;
-                        Integer s, nd; _ZZ.sqrt(s, _mod_it->operator()());
-                        for( ; t0_it != num.end(); ++t0_it, ++t_it) {
-                            iterativeratrecon(*t0_it = *t_it, nd, den, _mod_it->operator()(), s);
-                            if (nd > 1) {
-                                std::vector<Integer>::iterator  t02 = num.begin();
-                                for( ; t02 != t0_it ; ++t02)
-                                    *t02 *= nd;
-                                den *= nd;
-                            }
-                        }
-                        return num;
-                    } else {
-                        for( ; t0_it != num.end(); ++t0_it, ++t_it)
-                            *t0_it  = *t_it;
-                        ++_mod_it; ++_tab_it; 
-                        break;
-                    }
-                }
-            }
-            for( ; _occ_it != Father_t::RadixOccupancy_.end() ; ++_mod_it, ++_tab_it, ++_occ_it) {
-                if (*_occ_it) {
-                    std::vector<Integer>::iterator t0_it = num.begin();
-                    std::vector<Integer>::const_iterator t_it = _tab_it->begin();
-                    for( ; t0_it != num.end(); ++t0_it, ++t_it)
-                        this->normalizesmallbigreconstruct(*t0_it, Product(), *t_it, _mod_it->operator()() );
-                    Product.mulin(*_mod_it);
-                }
-            }
-            den = 1;
-            Integer s, nd; _ZZ.sqrt(s, Product.operator()());
-            std::vector<Integer>::iterator t0_it = num.begin();
-            for( ; t0_it != num.end(); ++t0_it) {
-                iterativeratrecon(*t0_it, nd, den, Product.operator()(), s);
-                if (nd > 1) {
-                    std::vector<Integer>::iterator  t02 = num.begin();
-                    for( ; t02 != t0_it ; ++t02)
-                        *t02 *= nd;
-                    den *= nd;
-                }
-            }
-            return num;
-        }
-		
+		template<template<class, class> class Vect, template <class> class Alloc>
+		Vect<Integer, Alloc<Integer> >& result (Vect<Integer, Alloc<Integer> > &num, Integer& den)
+		{
+			num.resize( (Father_t::RadixResidues_.front()).size() );
+			std::vector< LazyProduct >::iterator 			_mod_it = Father_t::RadixPrimeProd_.begin();
+			std::vector< std::vector< Integer > >::iterator _tab_it = Father_t::RadixResidues_.begin();
+			std::vector< bool >::iterator    				_occ_it = Father_t::RadixOccupancy_.begin();
+			LazyProduct Product;
+			for( ; _occ_it != Father_t::RadixOccupancy_.end() ; ++_mod_it, ++_tab_it, ++_occ_it) {
+				if (*_occ_it) {
+					Product = *_mod_it;
+					std::vector<Integer>::iterator t0_it = num.begin();
+					std::vector<Integer>::iterator t_it = _tab_it->begin();
+					if (++_occ_it == Father_t::RadixOccupancy_.end()) {
+						den = 1;
+						Integer s, nd; _ZZ.sqrt(s, _mod_it->operator()());
+						for( ; t0_it != num.end(); ++t0_it, ++t_it) {
+							iterativeratrecon(*t0_it = *t_it, nd, den, _mod_it->operator()(), s);
+							if (nd > 1) {
+								std::vector<Integer>::iterator  t02 = num.begin();
+								for( ; t02 != t0_it ; ++t02)
+									*t02 *= nd;
+								den *= nd;
+							}
+						}
+						return num;
+					}
+					else {
+						for( ; t0_it != num.end(); ++t0_it, ++t_it)
+							*t0_it  = *t_it;
+						++_mod_it; ++_tab_it;
+						break;
+					}
+				}
+			}
+			for( ; _occ_it != Father_t::RadixOccupancy_.end() ; ++_mod_it, ++_tab_it, ++_occ_it) {
+				if (*_occ_it) {
+					std::vector<Integer>::iterator t0_it = num.begin();
+					std::vector<Integer>::const_iterator t_it = _tab_it->begin();
+					Integer invprod;
+					this->precomputeInvProd(invprod, Product(), _mod_it->operator()() );
+					for( ; t0_it != num.end(); ++t0_it, ++t_it)
+						this->smallbigreconstruct(*t0_it, *t_it, invprod );
+					Product.mulin(*_mod_it);
 
-    protected:
-        Integer& iterativeratrecon(Integer& u1, Integer& new_den, const Integer& old_den, const Integer& m1, const Integer& s) {
-            Integer a;
-            _ZZ.reconstructRational(a, new_den, u1*=old_den, m1, s);
-            return u1=a;
-        }
-    };
+					// Moding out and normalization
+					for(t0_it = num.begin();t0_it != num.end(); ++t0_it) {
+						*t0_it %= Product();
+						Integer tmp(*t0_it);
+						this->normalize(*t0_it, tmp, Product());
+					}
+				}
+			}
+			den = 1;
+			Integer s, nd; _ZZ.sqrt(s, Product.operator()());
+			std::vector<Integer>::iterator t0_it = num.begin();
+			for( ; t0_it != num.end(); ++t0_it) {
+				iterativeratrecon(*t0_it, nd, den, Product.operator()(), s);
+				if (nd > 1) {
+					std::vector<Integer>::iterator  t02 = num.begin();
+					for( ; t02 != t0_it ; ++t02)
+						*t02 *= nd;
+					den *= nd;
+				}
+			}
+			return num;
+		}
+
+
+	protected:
+		Integer& iterativeratrecon(Integer& u1, Integer& new_den, const Integer& old_den, const Integer& m1, const Integer& s)
+		{
+			Integer a;
+			_ZZ.reconstructRational(a, new_den, u1*=old_den, m1, s);
+			return u1=a;
+		}
+	};
 }
 
-#endif
+#endif //__LINBOX_rational_full_multip_cra_H
diff --git a/linbox/algorithms/rational-cra.h b/linbox/algorithms/rational-cra.h
index ac75e74..e905185 100644
--- a/linbox/algorithms/rational-cra.h
+++ b/linbox/algorithms/rational-cra.h
@@ -1,22 +1,45 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-// ======================================================================= //
-// Time-stamp: <12 Mar 07 19:40:17 Jean-Guillaume.Dumas at imag.fr> 
-// ======================================================================= //
-#ifndef __LINBOX_RATIONAL_CRA_H
-#define __LINBOX_RATIONAL_CRA_H
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) 2007 LinBox
+ * Written by JG Dumas
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __LINBOX_rational_cra_H
+#define __LINBOX_rational_cra_H
 
 #include "linbox/field/PID-integer.h"
 
-namespace LinBox {
+namespace LinBox
+{
 
-//     template<class T, template <class T> class Container>
-//     std::ostream& operator<< (std::ostream& o, const Container<T>& C) {
-//         for(typename Container<T>::const_iterator refs =  C.begin();
-//             refs != C.end() ;
-//             ++refs )
-//             o << (*refs) << " " ;
-//         return o << std::endl;
-//     }
+#if 0
+	template<class T, template <class T> class Container>
+	std::ostream& operator<< (std::ostream& o, const Container<T>& C) {
+		for(typename Container<T>::const_iterator refs =  C.begin();
+		    refs != C.end() ;
+		    ++refs )
+			o << (*refs) << " " ;
+		return o << std::endl;
+	}
+#endif
 
 
 	/** \brief Chinese remainder of rationals
@@ -25,62 +48,69 @@ namespace LinBox {
 	 * Either by Early Termination see [Dumas, Saunder, Villard, JSC 32 (1/2), pp 71-99, 2001],
 	 * Or via a bound on the size of the integers.
 	 */
-    template<class RatCRABase>
-    struct RationalRemainder {
-        typedef typename RatCRABase::Domain		Domain;
-        typedef typename RatCRABase::DomainElement	DomainElement;
-    protected:
-        RatCRABase Builder_;
-        
-    public:
-        template<class Param>
-        RationalRemainder(const Param& b) : Builder_(b) { }
+	template<class RatCRABase>
+	struct RationalRemainder {
+		typedef typename RatCRABase::Domain		Domain;
+		typedef typename RatCRABase::DomainElement	DomainElement;
+	protected:
+		RatCRABase Builder_;
+
+	public:
+		template<class Param>
+		RationalRemainder(const Param& b) :
+			Builder_(b)
+		{ }
 
-           /** \brief The Rational CRA loop
-				
-            Given a function to generate residues mod a single prime, this loop produces the residues 
-            resulting from the Chinese remainder process on sufficiently many primes to meet the 
-            termination condition.
-			
-            \parameter F - Function object of two arguments, F(r, p), given prime p it outputs residue(s) r.
-            This loop may be parallelized.  F must be reentrant, thread safe.
-            For example, F may be returning the coefficients of the minimal polynomial of a matrix mod p.
-            Warning - we won't detect bad primes.
-			
-            \parameter genprime - RandIter object for generating primes.
-            \result num - the rational numerator
-            \result den - the rational denominator
-            */
-        template<class Function, class RandPrimeIterator>
-        Integer & operator() (Integer& num, Integer& den, Function& Iteration, RandPrimeIterator& genprime) {
-            ++genprime;
-            Domain D(*genprime); 
-            DomainElement r; D.init(r);
-            Builder_.initialize( D, Iteration(r, D) );				
-            while( ! Builder_.terminated() ) {
-                ++genprime; while(Builder_.noncoprime(*genprime) ) ++genprime;
-                Domain D(*genprime); 
-                DomainElement r; D.init(r);
-                Builder_.progress( D, Iteration(r, D) );
-            }
-            return Builder_.result(num, den);
-        }
+		/** \brief The Rational CRA loop.
 
-	    template<template <class, class> class Vect, template <class> class Alloc,  class Function, class RandPrimeIterator>
-	    Vect<Integer, Alloc<Integer> > & operator() (Vect<Integer, Alloc<Integer> >& num, Integer& den, Function& Iteration, RandPrimeIterator& genprime) {
-            ++genprime;
-            Domain D(*genprime); 
-            Vect<DomainElement, Alloc<DomainElement> > r; 
-            Builder_.initialize( D, Iteration(r, D) );				
-            while( ! Builder_.terminated() ) {
-                ++genprime; while(Builder_.noncoprime(*genprime) ) ++genprime;
-                Domain D(*genprime); 
-                Vect<DomainElement, Alloc<DomainElement> > r; 
-                Builder_.progress( D, Iteration(r, D) );
-            }
-            return Builder_.result(num, den);
-        }
-    };
+		  Given a function to generate residues mod a single prime,
+		  this loop produces the residues resulting from the Chinese
+		  remainder process on sufficiently many primes to meet the
+		  termination condition.
+
+		  \param Iteration  Function object of two arguments, \c Iteration(r, p), given
+		  prime \p p it outputs residue(s) \p r.  This loop may be
+		  parallelized.  \p Iteration must be reentrant, thread safe.  For
+		  example, \p Iteration may be returning the coefficients of the minimal
+		  polynomial of a matrix \c mod \p p.  @warning  we won't detect bad
+		  primes.
+
+		  \param genprime  RandIter object for generating primes.
+		  \param[out] num  the rational numerator
+		  \param[out] den  the rational denominator
+		  */
+		template<class Function, class RandPrimeIterator>
+		Integer & operator() (Integer& num, Integer& den, Function& Iteration, RandPrimeIterator& genprime)
+		{
+			++genprime;
+			Domain D(*genprime);
+			DomainElement r; D.init(r);
+			Builder_.initialize( D, Iteration(r, D) );
+			while( ! Builder_.terminated() ) {
+				++genprime; while(Builder_.noncoprime(*genprime) ) ++genprime;
+				Domain D(*genprime);
+				DomainElement r; D.init(r);
+				Builder_.progress( D, Iteration(r, D) );
+			}
+			return Builder_.result(num, den);
+		}
+
+		template<template <class, class> class Vect, template <class> class Alloc,  class Function, class RandPrimeIterator>
+		Vect<Integer, Alloc<Integer> > & operator() (Vect<Integer, Alloc<Integer> >& num, Integer& den, Function& Iteration, RandPrimeIterator& genprime)
+		{
+			++genprime;
+			Domain D(*genprime);
+			Vect<DomainElement, Alloc<DomainElement> > r;
+			Builder_.initialize( D, Iteration(r, D) );
+			while( ! Builder_.terminated() ) {
+				++genprime; while(Builder_.noncoprime(*genprime) ) ++genprime;
+				Domain D(*genprime);
+				Vect<DomainElement, Alloc<DomainElement> > r;
+				Builder_.progress( D, Iteration(r, D) );
+			}
+			return Builder_.result(num, den);
+		}
+	};
 }
 
-#endif
+#endif //__LINBOX_rational_cra_H
diff --git a/linbox/algorithms/rational-cra2.h b/linbox/algorithms/rational-cra2.h
new file mode 100644
index 0000000..c67a181
--- /dev/null
+++ b/linbox/algorithms/rational-cra2.h
@@ -0,0 +1,446 @@
+/* -*- 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
+/* linbox/blackbox/rational-reconstruction-base.h
+ * Copyright (C) 2009 Anna Marszalek
+ *
+ * Written by Anna Marszalek <aniau at astronet.pl>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __LINBOX_rational2_cra_H
+#define __LINBOX_rational2_cra_H
+#define CRATIMING
+
+
+#include "linbox/field/PID-integer.h"
+
+#include <linbox/algorithms/rational-reconstruction-base.h>
+#include <linbox/algorithms/classic-rational-reconstruction.h>
+
+//#define RCRATIMING
+
+namespace LinBox
+{
+
+#if 0
+	template<class T, template <class T> class Container>
+	std::ostream& operator<< (std::ostream& o, const Container<T>& C) {
+		for(typename Container<T>::const_iterator refs =  C.begin();
+		    refs != C.end() ;
+		    ++refs )
+			o << (*refs) << " " ;
+		return o << std::endl;
+	}
+#endif
+
+
+	/** \brief Chinese remainder of rationals
+	 *
+	 * Compute the reconstruction of rational numbers
+	 * Either by Early Termination see [Dumas, Saunder, Villard, JSC 32 (1/2), pp 71-99, 2001],
+	 * Or via a bound on the size of the Integers.
+	 */
+	//typedef PID_Integer Integers;
+	//typedef Integers::Element Integer;
+
+	template<class RatCRABase, class RatRecon = RReconstruction<PID_integer, ClassicMaxQRationalReconstruction<PID_integer> > >
+	struct RationalRemainder2 {
+
+
+		typedef typename RatCRABase::Domain		Domain;
+		typedef typename RatCRABase::DomainElement	DomainElement;
+	protected:
+		RatCRABase Builder_;
+		RatRecon RR_;
+	public:
+
+		int IterCounter;
+
+		template<class Param>
+		RationalRemainder2(const Param& b, const RatRecon& RR = RatRecon()) :
+			Builder_(b), RR_(RR)
+		{
+			IterCounter = 0;
+		}
+
+		RationalRemainder2(RatCRABase b, const RatRecon& RR = RatRecon()) :
+			Builder_(b), RR_()
+		{
+			IterCounter = 0;
+		}
+
+		/** \brief The Rational CRA loop
+
+		  Given a function to generate residues mod a single prime,
+		  this loop produces the residues resulting from the Chinese
+		  remainder process on sufficiently many primes to meet the
+		  termination condition.
+
+		  \param Iteration  Function object of two arguments, <code>Iteration(r,
+		  p)</code>, given prime \p p it outputs residue(s) \p r.  This
+		  loop may be parallelized.  \p Iteration must be reentrant, thread
+		  safe.  For example, \p Iteration may be returning the coefficients of
+		  the minimal polynomial of a matrix \c mod \p p.
+
+		  @warning We won't detect bad primes.
+
+		  \param genprime  RandIter object for generating primes.
+		  \param[out] num  the rational numerator
+		  \param[out] den  the rational denominator
+		  */
+		template<class Function, class RandPrimeIterator>
+		Integer & operator() (Integer& num, Integer& den, Function& Iteration, RandPrimeIterator& genprime)
+		{
+
+			++genprime;
+			Domain D(*genprime);
+			DomainElement r; D.init(r);
+			Builder_.initialize( D, Iteration(r, D) );
+			++IterCounter;
+
+			int coprime =0;
+			int maxnoncoprime = 1000;
+
+			Integer f_in,m_in;
+			Builder_.getPreconditioner(f_in,m_in);
+
+			while( ! Builder_.terminated() ) {
+
+				++genprime;
+				while(Builder_.noncoprime(*genprime) ) {
+					++genprime;
+					++coprime;
+					if (coprime > maxnoncoprime) {
+						std::cout << "you are running out of primes. " << maxnoncoprime << " coprime primes found";
+						Integer res; return Builder_.result(res);
+					}
+				}
+				coprime = 0;
+				Domain D(*genprime);
+				DomainElement r; D.init(r);
+				Builder_.progress( D, Iteration(r, D) );
+				if (RR_.scheduled(IterCounter-1)) {
+					Integer M ; Builder_.getModulus(M);
+					Integer r ; Builder_.getResidue(r);
+					if (RR_.reconstructRational(num,den,r,M)) {
+						Builder_.changePreconditioner(f_in*num,m_in*den);
+						int k ; Builder_.getThreshold(k);
+						if (this->operator()(k,num,den,Iteration,genprime)) break;
+						else {
+							Builder_.changePreconditioner(f_in,m_in);//not optimal, may restore results
+						}
+					}
+				}
+				++IterCounter;
+			}
+			Integer g;
+			Builder_.result(num,den);
+			if (gcd(g,num,den) != 1) { num /=g; den/=g; }
+			return num; //Builder_.result(num, den);
+		}
+
+		/*
+		 * progress for k>=0 iterations
+		 * run until terminated() if k<0
+		 * no rational reconstruction!
+		 */
+
+		template<class Function, class RandPrimeIterator>
+		bool operator() (const int k, Integer& num, Integer& den, Function& Iteration, RandPrimeIterator& genprime)
+		{
+
+			if ((IterCounter==0) && (k != 0)) {
+				++IterCounter;
+				++genprime;
+				Domain D(*genprime);
+				DomainElement r; D.init(r);
+				Builder_.initialize( D, Iteration(r, D) );
+			}
+
+			int coprime =0;
+			int maxnoncoprime = 1000;
+
+			Integer f_in,m_in;
+			Builder_.getPreconditioner(f_in,m_in);
+
+			for ( int i=0; ((k< 0) && ! Builder_.terminated()) || (i<k) ; ++i ) {
+
+				++genprime;
+
+				while(Builder_.noncoprime(*genprime) ) {
+					++genprime;
+					++coprime;
+					if (coprime > maxnoncoprime) {
+						std::cout << "you are running out of primes. " << maxnoncoprime << " coprime primes found";
+						//Integer res; return Builder_.result(res);
+						return false;
+					}
+				}
+				coprime = 0;
+				Domain D(*genprime);
+				DomainElement r; D.init(r);
+				Builder_.progress( D, Iteration(r, D) );
+				//if (RR_.scheduled(IterCounter-1)) {
+				++IterCounter;
+#if 0
+
+				Integer M ; Builder_.getModulus(M);
+
+				Integer r ; Builder_.getResidue(r);
+
+				if (RR_.reconstructRational(num,den,r,M)) {
+
+					if (Builder_.changePreconditioner(f_in*num,m_in*den)) break;
+
+					else Builder_.changePreconditioner(f_in,m_in);//not optimal, may restore results
+
+
+				}
+#endif
+
+				//}
+			}
+
+			if (Builder_.terminated() ) {
+				Integer g;
+				//Builder_.getPreconditioner(p_div,p_mul);
+				Builder_.result(num,den);
+				//num = p_div*res;
+				//den = p_mul;
+				if (gcd(g,num,den) != 1) { num /=g; den/=g; }
+				return true;
+			}
+			else return false;
+		}
+
+		template<template <class, class> class Vect, template<class> class Alloc,  class Function, class RandPrimeIterator>
+		Vect<Integer, Alloc<Integer> > & operator() (Vect<Integer, Alloc<Integer> >& num, Integer& den, Function& Iteration, RandPrimeIterator& genprime)
+		{
+			++IterCounter;
+			++genprime;
+			Domain D(*genprime);
+			Vect<DomainElement, Alloc<DomainElement>  > r;
+			Builder_.initialize( D, Iteration(r, D) );
+
+			int coprime =0;
+			int maxnoncoprime = 1000;
+
+			Vect<Integer, Alloc<Integer> > f_in,m_in;
+			Builder_.getPreconditioner(f_in,m_in);
+
+			//while( ! Builder_.terminated() )
+			while (1) { // in case of terminated() - checks for RR of the whole vector
+				//++IterCounter;
+				++genprime;
+				while(Builder_.noncoprime(*genprime) ) {
+					++genprime;
+					++coprime;
+					if (coprime > maxnoncoprime) {
+						std::cout << "you are running out of primes. " << maxnoncoprime << " coprime primes found";
+						return num;
+					}
+				}
+				coprime = 0;
+
+
+				Domain D(*genprime);
+				Vect<DomainElement, Alloc<DomainElement> > r;
+				Builder_.progress( D, Iteration(r, D) );
+
+				if (RR_.scheduled(IterCounter-1) || Builder_.terminated()) {
+					Integer M ; Builder_.getModulus(M);
+					if ( Builder_.terminated() ) {//early or full termination occurred, check reconstruction of the whole vector
+						//early or full termination
+						Vect<Integer, Alloc<Integer> > r ; Builder_.getResidue(r);
+						if (RR_.reconstructRational(num,den,r,M) ) {
+							Vect<Integer, Alloc<Integer> > vnum(num),vden(m_in.size(),den);
+							for (int i=0; i < (int)vnum.size(); ++ i) {
+								if (vnum[i]==0) vnum[i] = 1; // no prec
+							}
+							Builder_.productin(vnum, f_in); Builder_.productin(vden,m_in);
+							Builder_.changePreconditioner(vnum,vden) ;
+							int k ; Builder_.getThreshold(k);
+							if (this->operator()(k,num,den,Iteration,genprime)) {
+								break;
+							}
+							else {	// back to original preconditioners
+								Builder_.changePreconditioner(f_in,m_in);//not optimal, may restore results
+								Builder_.changeVector();
+							}
+						}
+						else {  //back to original preconditioners
+							Builder_.changePreconditioner(f_in,m_in);
+							Builder_.changeVector();
+						}
+					}
+					else {
+						//heuristics: reconstruction of vector
+						Integer r ; Builder_.getResidue(r);
+						Integer n,d;
+						if (RR_.reconstructRational(n,d,r,M)) {
+							Vect<Integer, Alloc<Integer> > vden(m_in.size(),d);
+							Builder_.productin(vden,m_in);
+							Builder_.changePreconditioner(f_in,vden);
+							int k; Builder_.getThreshold(k);
+							if (this->operator()(k,num,den,Iteration,genprime)) { //prob. certify result of RR
+								m_in = vden;
+							}
+							else {	//false result of RR
+								Builder_.changePreconditioner(f_in,m_in);//not optimal, may restore results
+							}
+
+						}
+					}
+				}
+				++IterCounter;
+			}
+			Builder_.result(num,den);
+
+			return num;
+		}
+
+		/*
+		 * progress for k>=0 iterations
+		 * run until terminated if k <0
+		 */
+		template<template <class, class> class Vect, template<class> class Alloc, class Function, class RandPrimeIterator>
+		bool operator() (const int k, Vect<Integer, Alloc<Integer>  >& num, Integer& den, Function& Iteration, RandPrimeIterator& genprime)
+		{
+			if ((IterCounter==0) && (k != 0)) {
+				++IterCounter;
+				++genprime;
+				Domain D(*genprime);
+				Vect<DomainElement, Alloc<DomainElement>  > r;
+				Builder_.initialize( D, Iteration(r, D) );
+			}
+			int coprime =0;
+			int maxnoncoprime = 1000;
+
+			Vect<Integer, Alloc<Integer>  > f_in,m_in;
+			Builder_.getPreconditioner(f_in,m_in);
+			for (int i=0; ((k<0) && Builder_.terminated()) || (i <k); ++i ) {
+				//++IterCounter;
+				++genprime;
+				while(Builder_.noncoprime(*genprime) ) {
+					++genprime;
+					++coprime;
+					if (coprime > maxnoncoprime) {
+						std::cout << "you are running out of primes. " << maxnoncoprime << " coprime primes found";
+						return false;
+						//return Builder_.result(res);
+					}
+				}
+				coprime = 0;
+				Domain D(*genprime);
+				Vect<DomainElement, Alloc<DomainElement>  > r;
+				Builder_.progress( D, Iteration(r, D) );
+				//if (RR_.scheduled(IterCounter-1))
+				++IterCounter;
+
+#if 0
+				Integer M ; Builder_.getModulus(M);
+				if ( Builder_.terminated() ) {
+					Vect<Integer> r ; Builder_.getResidue(r);
+					if (RR_.reconstructRational(num,den,r,M) ) {
+						Vect<Integer> vnum(num),vden(m_in.size(),den);
+						Builder_.productin(vnum, f_in); Builder_.productin(vden,m_in);
+						if (Builder_.changePreconditioner(vnum,vden)) break;
+						else Builder_.changePreconditioner(f_in,m_in);//not optimal, may restore results
+					}
+				}
+				else {
+					Integer r ; Builder_.getResidue(r);
+					Integer n,d;
+					if (RR_.reconstructRational(n,d,r,M)) {
+						Vect<Integer > vden(m_in.size(),d);
+						Builder_.productin(vden,m_in);
+						if (Builder_.changePreconditioner(f_in,vden)) break;
+						else Builder_.changePreconditioner(f_in,m_in);//not optimal, may restore results
+					}
+				}
+#endif
+			}
+			if (Builder_.terminated()) {
+				//Vect<Integer> p_mul, p_div,res, g;
+				//Builder_.getPreconditioner(p_div,p_mul);
+				Builder_.result(num,den);
+#if 0
+				num = Builder_productin(res,p_div);
+				typename Vect<Integer>::iterator itnum,itden,ittmp;
+				den = 1; Integer denold = 1;
+				for (itnum = num.begin(), itden=p_mul.begin(); itnum != num.end(); ++itnum,++itden) {
+					lcm(den,den,*itden);
+					if (denold != den) {
+						Integer h = den/denold;
+						ittmp = num.begin();
+						for (;itnum != itnum; ++ittmp)  *ittmp *= h;
+					}
+					denold = den;
+				}
+				den = p_mul;
+#endif
+
+				return true;
+			}
+			else return false;
+		}
+
+#ifdef CRATIMING
+		std::ostream& reportTimes(std::ostream& os)
+		{
+			//Builder_.reportTimes(os);
+			return os <<  "Iterations:" << IterCounter << "\n" ;
+		}
+#endif
+	};
+
+#ifdef RCRATIMING
+
+	class RCRATimer {
+	public:
+		mutable Timer ttInit, tt RRecon, ttIRecon, ttImaging, ttIteration, ttOther;
+		void clear() const
+		{
+			ttInit.clear();
+			ttRRecon.clear();
+			ttIRecon.clear();
+			ttImaging.clear();
+			ttIteration.clear();
+			ttother.clear();
+		}
+#if 0
+		template<class RR, class LC>
+		void update(RR& rr, LC& lc) const
+		{
+			ttSetup += lc.ttSetup;
+			ttRecon += rr.ttRecon;
+			ttGetDigit += lc.ttGetDigit;
+			ttGetDigitConvert += lc.ttGetDigitConvert;
+			ttRingOther += lc.ttRingOther;
+			ttRingApply += lc.ttRingApply;
+		}
+#endif
+	};
+#endif
+
+}
+
+#undef RCRATIMING
+#undef CRATIMING
+
+#endif // __LINBOX_rational2_cra_H
diff --git a/linbox/algorithms/rational-reconstruction-base.h b/linbox/algorithms/rational-reconstruction-base.h
new file mode 100644
index 0000000..61175aa
--- /dev/null
+++ b/linbox/algorithms/rational-reconstruction-base.h
@@ -0,0 +1,358 @@
+/* -*- 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
+/* linbox/blackbox/rational-reconstruction-base.h
+ * Copyright (C) 2009 Anna Marszalek
+ *
+ * Written by Anna Marszalek <aniau at astronet.pl>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_reconstruction_base_H
+#define __LINBOX_reconstruction_base_H
+
+#define DEF_RR_THRESH  1
+
+#include <iostream>
+#include <deque>
+#include <math.h>
+
+#include <linbox/field/PID-integer.h>
+
+namespace LinBox
+{
+
+	enum RReconstructionSchedule {
+		INCREMENTAL, QUADRATIC, GEOMETRIC, CERTIFIED
+	};
+
+	template <class Ring=PID_integer>
+	class RReconstructionBase;
+
+	/*
+	 * Class to be used for repeated rational reconstruction in schemes such as Rational CRA and p-adic lifting
+	 * together with method reconstructRational(a,b,x,m)
+	 * implements scheduling INCREMENTAL, QUADRATIC, GEOMETRIC, CERTIFIED
+	 * implements vector reconstruction
+	 * _Z is the integer ring used for reconstruction, default PID_integer
+	 * _RR is the rational reconstruction method, see fast-ratioinal-reconstruction.h, classic-rational-reconstruction.h
+	 * THRESHOLD_ - treshold for INCREMENTAL schedule
+	 * rbound_ - min number of iterations for all schedule
+	 */
+	template <class Ring=PID_integer, class RRBase=RReconstructionBase<PID_integer> >
+	struct RReconstruction {
+	protected:
+		Ring _Z;
+		RRBase _RR;
+		mutable size_t RecCounter;
+		const RReconstructionSchedule  _M;
+		const size_t THRESHOLD_;
+		const size_t rbound_;
+	public:
+		typedef typename Ring::Element Element;
+
+		RReconstruction(const Ring& Z=Ring(), const RReconstructionSchedule M = GEOMETRIC, size_t T=DEF_RR_THRESH, size_t b= 0) :
+			_Z(Z), _RR(Z), _M(M), THRESHOLD_(T), rbound_(b)
+		{
+			RecCounter =0;
+			if (_M == QUADRATIC) {
+				RecCounter = (int)sqrt((double)rbound_);//RecCounter^2 < rbound_ <=(RecCounter+1)^2
+			}
+			else if (_M == GEOMETRIC) {
+				RecCounter = (size_t) log((double)rbound_) ;//2^RecCounter < rbound_ <=2^(RecCounter+1)
+			}
+		}
+
+		RReconstruction(const RRBase& RR, const RReconstructionSchedule M = GEOMETRIC, size_t T=DEF_RR_THRESH, size_t b = 0) :
+			_Z(RR._Z), _RR(RR),_M(M), THRESHOLD_(T), rbound_(b)
+		{
+			RecCounter =0;
+			if (_M == QUADRATIC) {
+				RecCounter = (size_t)sqrt((double)rbound_);//RecCounter^2 < rbound_ <=(RecCounter+1)^2
+			}
+			else if (_M == GEOMETRIC) {
+				RecCounter = (size_t)((double)log((double)rbound_)/log(2));//2^RecCounter < rbound_ <=2^(RecCounter+1)
+			}
+
+		}
+
+		int getCounter()
+		{
+		       	return RecCounter;
+		}
+
+		bool scheduled(const size_t i) const
+		{
+			//if (RecCounter ==0)  return true;
+			if (i < rbound_) return false; //skip first rbound iterations
+			if (_M == INCREMENTAL) {
+				if (RecCounter%THRESHOLD_==0 ) return true;
+				else return false;
+			}
+			else if (_M == QUADRATIC) {
+				if (RecCounter*RecCounter < i) return true;
+				else return false;
+			}
+			else if (_M == GEOMETRIC) {
+				if ((1UL << RecCounter) < i) return true;
+				else return false;
+			}
+			else if (_M == CERTIFIED) {
+				if ( i > rbound_) return true;
+				else return false;
+			}
+			return true;
+		}
+
+		template <class Vect>
+		bool reconstructRational(Vect& a, Element& b, const Vect& x, const Element m, const int inc = 1) const
+		{
+			++RecCounter;
+			b = 1;
+			if (a.size() != x.size()) return false;
+			typename Vect::iterator it_a,it2_a;
+			typename Vect::const_iterator it_x;
+			bool res = true;
+			Element new_den, old_den;
+			old_den = 1;
+			if (inc==1) {
+				for (it_a = a.begin(), it_x = x.begin(); it_a != a.end(); ++it_a, ++it_x) {
+					//use previous modula
+					Element x_in(*it_x);
+					x_in *=old_den;
+					if (x_in <0) {
+						if ((-x_in) > m) x_in %= m;
+						if (x_in < 0) x_in += m;
+					}
+					else {
+						if (x_in > m) x_in %= m;
+					}
+					if (x_in > 0) res = res && _RR.reconstructRational(*it_a, new_den,x_in,m);
+					else {
+						res = true;
+						*it_a = 0;
+						new_den = 1;
+					}
+					if (!res) return res;
+					else {
+						if (new_den > 1) {
+							for (it2_a = a.begin(); it2_a != it_a; ++it2_a) {
+								*it2_a *=new_den;
+							}
+							b *= new_den;
+							old_den *= new_den;
+						}
+					}
+
+				}
+			}
+			else {//if (inc == -1)
+				int i = x.size()-1;
+				for (; i >=0; --i ) {
+					Element x_in(x[i]);
+					x_in *=old_den;
+					if (x_in <0) {
+						if ((-(x_in)) > m) x_in %= m;
+						if (x_in < 0) x_in += m;
+					}
+					else {
+						if (x_in > m) x_in %= m;
+					}
+					if (x_in > 0) res = res && _RR.reconstructRational(a[i], new_den,x_in,m);
+					else {
+						res = true;
+						*it_a = 0;
+						new_den = 1;
+					}
+					if (!res) return res;
+					else {
+						//std::cout << a[i] << "/" << b*new_den << "\n";
+						if (new_den > 1) {
+							for (int j = a.size()-1; j > i ; --j) {
+								a[j] *=new_den;
+							}
+							b *= new_den;
+							old_den *= new_den;
+						}
+					}
+				}
+			}
+#if 0
+			else if (inc==0) {//no prec
+			}
+#endif
+			return res;
+
+		}
+
+		bool reconstructRational(Element& a, Element& b, const Element& x, const Element& m) const
+		{
+			++RecCounter;
+			Element x_in(x);
+			if (x<0) {
+				if ((-x)>m)
+					x_in %= m;
+				if (x<0)
+					x_in += m;
+			}
+			else {
+				if (x>m)
+					x_in %= m;
+			}
+
+			bool res;
+			if (x_in >0) res = _RR.reconstructRational(a,b,x_in,m);
+			else { a = 0; b =1; res = true;}
+			//_RR.write(std::cout);
+			return res;
+		}
+
+		bool reconstructRational(Element& a, Element& b, const Element& x, const Element& m, const Element& a_bound) const
+		{
+			++RecCounter;
+			Element x_in(x);
+			if (x<0) {
+				if ((-x)>m)
+					x_in %= m;
+				if (x<0)
+					x_in += m;
+			}
+			else {
+				if (x>m)
+					x_in %= m;
+			}
+			bool res;
+			if (x_in >0) res = _RR.reconstructRational(a,b,x_in,m,a_bound);
+			else { a = 0; b =1; res = true;}
+			//_RR.write(std::cout);
+			return res;
+		}
+
+		bool reconstructRational(Element& a, Element& b, const Element& x, const Element& m, const Element& a_bound, const Element& b_bound) const
+		{
+			++RecCounter;
+			Element x_in(x);
+			if (x<0) {
+				if ((-x)>m)
+					x_in %= m;
+				if (x<0)
+					x_in += m;
+			}
+			else {
+				if (x>m)
+					x_in %= m;
+			}
+			Element bound = x_in/b_bound;
+			if (x_in > 0) _RR.reconstructRational(a,b,x_in,m,(bound>a_bound?bound:a_bound));
+			else  { a = 0; b =1; }
+			bool res=  (b > b_bound)? false: true;
+			//_RR.write(std::cout);
+			return res;
+		}
+
+		//fastReconstruction();
+
+		//classicReconstruction();
+
+	};
+
+	class OpCounter {
+	public:
+		size_t div_counter;
+		size_t mul_counter;
+		size_t gcd_counter;
+
+		OpCounter() {
+			div_counter=0; mul_counter=0; gcd_counter=0;
+		}
+
+		void write(std::ostream& is) {
+			is << div_counter << " divisions\n";
+			is << mul_counter << " multiplications\n";
+			is << gcd_counter << " gcds\n";
+		}
+	};
+
+	template <class Ring>
+	class RReconstructionBase {
+	public:
+		Ring _Z;
+		mutable OpCounter C;
+		typedef typename Ring::Element Element;
+
+		RReconstructionBase(const Ring& Z) :
+			_Z(Z)
+		{}
+		RReconstructionBase(const RReconstructionBase<Ring>& RR) :
+			_Z(RR._Z)
+		{}
+
+		virtual bool reconstructRational(Element& a, Element& b, const Element& x, const Element& m) const =0;
+
+		virtual bool reconstructRational(Element& a, Element& b, const Element& x, const Element& m, const Element& a_bound) const =0;
+
+		virtual ~RReconstructionBase() {}
+
+		void write(std::ostream& is) const
+		{
+			C.write(is);
+		}
+	};
+
+	/*
+	 * This is the default RReconstruction, using PID_Integer and ClassicRationalReconstruction of Wang
+	 */
+	template <>
+	class RReconstructionBase<PID_integer> {
+	public:
+		typedef PID_integer Ring;
+		Ring _Z;
+		mutable OpCounter C;
+		typedef Ring::Element Element;
+
+		RReconstructionBase(const Ring& Z) :
+			_Z(Z)
+		{}
+		RReconstructionBase(const RReconstructionBase<Ring>& RR) :
+			_Z(RR._Z)
+		{}
+
+		bool reconstructRational(Element& a, Element& b, const Element& x, const Element& m)
+		{
+			Element a_bound; _Z.sqrt(a_bound,m/2);
+			return _Z.reconstructRational(a,b,x,m,a_bound,a_bound);
+		}
+
+		bool reconstructRational(Element& a, Element& b, const Element& x, const Element& m, const Element& a_bound)
+		{
+			_Z.reconstructRational(a,b,x,m,a_bound);
+			return true;
+		}
+
+		~RReconstructionBase() {}
+#if 0
+		const void write(std::ostream& is) {
+			C.write(is);
+		}
+#endif
+	};
+
+} //namespace LinBox
+
+#undef DEF_RR_THRESH
+#endif
+
+
diff --git a/linbox/algorithms/rational-reconstruction.h b/linbox/algorithms/rational-reconstruction.h
old mode 100755
new mode 100644
index 552c3a5..c8cbbff
--- a/linbox/algorithms/rational-reconstruction.h
+++ b/linbox/algorithms/rational-reconstruction.h
@@ -1,5 +1,6 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* linbox/algorithms/lifting-container-base.h
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/*
  * Copyright (C) 2004 Zhendong Wan, Pascal Giorgi
  *
  * Written by Zhendong Wan <wan at mail.eecis.udel.edu>
@@ -21,8 +22,18 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOXX__RECONSTRUCTION_H__
-#define __LINBOXX__RECONSTRUCTION_H__
+/*! @file algorithms/rational-reconstruction.h
+ * @ingroup algorithms
+ * @brief NO DOC
+ * @bug demander FPLLL comme dépendance optionnelle...
+ */
+
+#ifndef __LINBOX_reconstruction_H
+#define __LINBOX_reconstruction_H
+
+#include <linbox/algorithms/rational-reconstruction-base.h>
+#include <linbox/algorithms/classic-rational-reconstruction.h>
+//#include <linbox/algorithms/fast-rational-reconstruction.h>
 
 #include <linbox/linbox-config.h>
 #include <linbox/util/debug.h>
@@ -39,575 +50,562 @@
 //#define __LINBOX_HAVE_FPLLL
 #ifdef __LINBOX_HAVE_FPLLL
 extern "C" {
-#include </home/pgiorgi/Library/fplll-1.1/myheuristic.h>
-#include </home/pgiorgi/Library/fplll-1.1/myproved.h>
+#include <libfplll/myheuristic.h>
+#include <libfplll/myproved.h>
 }
 #include <linbox/algorithms/short-vector.h>
 #endif
 
+namespace LinBox
+{
 
-namespace LinBox {
-
-	
+	/*! \brief Limited doc so far.
+	 * Used, for instance, after LiftingContainer.
+	 */
+	template< class _LiftingContainer,
+	class RatRecon = RReconstruction<typename _LiftingContainer::Ring, ClassicMaxQRationalReconstruction<typename _LiftingContainer::Ring> >
+	>
+	class RationalReconstruction {
+
+	public:
+		typedef _LiftingContainer                  LiftingContainer;
+		typedef typename LiftingContainer::Ring                Ring;
+		typedef typename Ring::Element                      Integer;
+		typedef typename LiftingContainer::IVector           Vector;
+		typedef typename LiftingContainer::Field              Field;
+		typedef typename Field::Element                     Element;
 
-	/// \brief Limited doc so far.  Used, for instance, after LiftingContainer.
-template< class _LiftingContainer >
-class RationalReconstruction {
-		
-public:
-	typedef _LiftingContainer                  LiftingContainer;
-	typedef typename LiftingContainer::Ring                Ring;
-	typedef typename Ring::Element                      Integer;
-	typedef typename LiftingContainer::IVector           Vector;		
-	typedef typename LiftingContainer::Field              Field;		
-	typedef typename Field::Element                     Element;
-	  
 #ifdef RSTIMING
-	mutable Timer tRecon, ttRecon;	
-	mutable int _num_rec;
-#endif	
-		
-	// data
-protected:
-		
-	// pointer to digit generator
-	const LiftingContainer& _lcontainer;
-		
-	// Ring
-	Ring _r;
-		
-	// store early termination threshold.
-	int _threshold;
-	
-public:
-			
-	/** \brief Constructor 
-	 *  maybe use different ring than the ring in lcontainer
-	 */
-	RationalReconstruction (const LiftingContainer& lcontainer, const Ring& r = Ring(), int THRESHOLD =DEF_THRESH) : 
-		_lcontainer(lcontainer), _r(r), _threshold(THRESHOLD) {
-			
-		//if ( THRESHOLD < DEF_THRESH) _threshold = DEF_THRESH;
-	}
+		mutable Timer tRecon, ttRecon;
+		mutable int _num_rec;
+#endif
+		// data
+	protected:
 
-	/** \brief Get the LiftingContainer
-	 */
-	const LiftingContainer& getContainer() const {
-		return _lcontainer;
-	}
-		
-
-	/** \brief  Handler to switch between different rational reconstruction strategy.
-	 *  Allow  early termination and direct fast method
-	 *  Switch is made by using a threshold as the third argument 
-	 *  (default is set to that of constructor THRESHOLD
-	 * 0    -> direct method
-	 * > 0  -> early termination with 
-	 */ 
-	template <class Vector>
-	bool getRational(Vector& num, Integer& den, int switcher) const { 
-		if ( switcher == 0)
-			return getRational3 (num, den);
+		// pointer to digit generator
+		const LiftingContainer& _lcontainer;
+
+		// Ring
+		Ring _r;
+
+		// store early termination threshold.
+		int _threshold;
+
+	public:
+		RatRecon RR;
+
+		/** \brief Constructor
+		 * @todo maybe use different ring than the ring in lcontainer
+		 *  @param lcontainer NO DOC
+		 *  @param r          NO DOC
+		 *  @param THRESHOLD  NO DOC
+		 */
+		RationalReconstruction (const LiftingContainer& lcontainer, const Ring& r = Ring(), int THRESHOLD =DEF_THRESH) :
+			_lcontainer(lcontainer), _r(r), _threshold(THRESHOLD), RR(_r)
+		{
+
+			//if ( THRESHOLD < DEF_THRESH) _threshold = DEF_THRESH;
+		}
+
+		/** \brief Get the LiftingContainer
+		*/
+		const LiftingContainer& getContainer() const
+		{
+			return _lcontainer;
+		}
+
+		/** Handler to switch between different rational
+		 * reconstruction strategy.
+		 *  Allow  early termination and direct fast method Switch is
+		 *  made by using a threshold as the third argument (default is
+		 *  set to that of constructor THRESHOLD
+		 *  - \f$0\f$   -> direct method
+		 *  - \f$>0\f$  -> early termination with
+		 *  .
+		 */
+		template <class Vector>
+		bool getRational(Vector& num, Integer& den, int switcher) const
+		{
+			if ( switcher == 0)
+				return getRational3 (num, den);
 			//{getRational1(num,den); print (num); std::cout << "Denominator: " << den << "\n";
 			//getRational3(num, den);print (num); std::cout << "Denominator: " << den << "\n";}
-			
-		else
-			//return getRational6(num,den, switcher);
-			return getRational1 (num, den);
+
+			else
+				//return getRational6(num,den, switcher);
+				return getRational1 (num, den);
 			//{getRational1(num,den); print (num); std::cout << "Denominator: " << den << "\n";
 			//getRational3(num, den);print (num); std::cout << "Denominator: " << den << "\n";}
-		return 1;
-	}
+			return 1;
+		}
 
-	template <class Vector>
-	bool getRational(Vector& num, Integer& den) const { 
-		if ( _threshold == 0)
-			return getRational3 (num, den);
+		/*! no doc.
+		*/
+		template <class Vector>
+		bool getRational(Vector& num, Integer& den) const
+		{
+			if ( _threshold == 0)
+				return getRational3 (num, den);
 			//{getRational1(num,den); print (num); std::cout << "Denominator: " << den << "\n";
 			//getRational3(num, den);print (num); std::cout << "Denominator: "  << den << "\n";}
-		else
-			return getRational1 (num, den);
+			else
+				return getRational1 (num, den);
 			//{getRational1(num,den); print (num); std::cout << "Denominator: " << den << "\n";
 			//getRational3(num, den);print (num); std::cout << "Denominator: "  << den << "\n"; }
 
-		return 1;
-	}
-	
-	template <class InVect1, class InVect2>
-	Integer& dot (Integer& d, const InVect1& v1, const InVect2& v2) const {
-		typename InVect1::const_iterator v1_p;
-		typename InVect2::const_iterator v2_p;
-		_r. init (d, 0);
-		for (v1_p = v1. begin(), v2_p = v2. begin(); v1_p != v1. end(); ++ v1_p, ++ v2_p)
-			_r. axpyin (d, *v1_p, *v2_p);
-
-		return d;
-	}
-	/** \brief Reconstruct a vector of rational numbers
-	 *  from p-adic digit vector sequence.
-	 *  An early termination technique is used.
-	 *  Answer is a pair (numerator, common denominator)
-	 *  The trick to reconstruct the raitonal solution (V. Pan) is implemented.
-	 *  Implement the certificate idea, preprint submitted to ISSAC'05
-	 */
-	
-	/*
-	template <class Vector>
-	void print (const Vector& v) const {
-		typename Vector::const_iterator v_p;
-		std::cout << "[";
-		for (v_p = v. begin(); v_p != v. end(); ++ v_p)
-			std::cout << *v_p << ", ";
-		std::cout << "]\n";
-	}
-	*/
-	template<class Vector>
-	bool getRational1(Vector& num, Integer& den) const { 
- 		
+			return 1;
+		}
+
+		/*! No doc.
+		 * @todo WHY a dot product here ?
+		 */
+		template <class InVect1, class InVect2>
+		Integer& dot (Integer& d, const InVect1& v1, const InVect2& v2) const
+		{
+			typename InVect1::const_iterator v1_p;
+			typename InVect2::const_iterator v2_p;
+			_r. init (d, 0);
+			for (v1_p = v1. begin(), v2_p = v2. begin(); v1_p != v1. end(); ++ v1_p, ++ v2_p)
+				_r. axpyin (d, *v1_p, *v2_p);
+
+			return d;
+		}
+
+#if 0
+		template <class Vector>
+		void print (const Vector& v) const
+		{
+			typename Vector::const_iterator v_p;
+			std::cout << "[";
+			for (v_p = v. begin(); v_p != v. end(); ++ v_p)
+				std::cout << *v_p << ", ";
+			std::cout << "]\n";
+		}
+#endif
+
+		/** Reconstruct a vector of rational numbers
+		 *  from p-adic digit vector sequence.
+		 *  An early termination technique is used.
+		 *  Answer is a pair (numerator, common denominator)
+		 *  The trick to reconstruct the rational solution (V. Pan) is implemented.
+		 *  Implement the certificate idea, preprint submitted to ISSAC'05
+		 */
+		template<class Vector>
+		bool getRational1(Vector& num, Integer& den) const
+		{
+
 #ifdef RSTIMING
-		ttRecon.clear();
-		tRecon.start();
-#endif			
-		linbox_check(num. size() == (size_t)_lcontainer.size());
-		typedef Vector IVector;
-		typedef std::vector<IVector> LVector;
-		int n = num. size();
-		int len = _lcontainer. length();
-		Integer prime = _lcontainer.prime();//prime
-		LVector digits; //Store all p-adic digits
-		digits. resize (len); //reserve space for all digits
-		Integer modulus; //store current modulus
-		Integer denbound; // store current bound for den
-		Integer numbound; //store current bound for num
-
-		_r. init (modulus, 1);
-		_r. init (denbound, 1);
-		_r. init (numbound, 1);
-		Integer c1, c2, c1_den, c1_num, c2_den, c2_num;
-		IVector r1(num.size()), r2(num.size());
-		_r. init (c1, 0); _r. init(c1_den, 1); _r. init (c1_num, 0);
-		_r. init (c2, 0); _r. init(c2_den, 1); _r. init (c2_num, 0);
-	
-		typename IVector::iterator r_p;
-		for (r_p = r1. begin(); r_p != r1. end(); ++ r_p)
-			_r. init (*r_p, rand());
-		for (r_p = r2. begin(); r_p != r2. end(); ++ r_p)
-			_r. init (*r_p, rand());
-
-		//std::cout << "Random vecotor1: " ;
-		//print (r1);
-		//std::cout << "Random vecotor2: " ;
-		//print (r2); 
-
-		Integer pmodulus; //store previous modulus
-		Integer tmp; //temprary integer
-			
-		_r. init (den, 1);
-		typename LiftingContainer::const_iterator iter = _lcontainer.begin(); 
-
-		Integer tmp_den, tmp_num, rem1, rem2;
-		// Do until it meets early termination conditions.
-		int step = 0;
-		//std::cout << "length:= " << len << '\n';
-		typename LVector::iterator digits_p = digits. begin();
-
-		
+			ttRecon.clear();
+			tRecon.start();
+#endif
+			linbox_check(num. size() == (size_t)_lcontainer.size());
+			typedef Vector IVector;
+			typedef std::vector<IVector> LVector;
+			int n = num. size();
+			int len = _lcontainer. length();
+			Integer prime = _lcontainer.prime();//prime
+			LVector digits; //Store all p-adic digits
+			digits. resize (len); //reserve space for all digits
+			Integer modulus; //store current modulus
+			Integer denbound; // store current bound for den
+			Integer numbound; //store current bound for num
+
+			_r. init (modulus, 1);
+			_r. init (denbound, 1);
+			_r. init (numbound, 1);
+			Integer c1, c2, c1_den, c1_num, c2_den, c2_num;
+			IVector r1(num.size()), r2(num.size());
+			_r. init (c1, 0); _r. init(c1_den, 1); _r. init (c1_num, 0);
+			_r. init (c2, 0); _r. init(c2_den, 1); _r. init (c2_num, 0);
+
+			typename IVector::iterator r_p;
+			for (r_p = r1. begin(); r_p != r1. end(); ++ r_p)
+				_r. init (*r_p, rand());
+			for (r_p = r2. begin(); r_p != r2. end(); ++ r_p)
+				_r. init (*r_p, rand());
+
+			//std::cout << "Random vecotor1: " ;
+			//print (r1);
+			//std::cout << "Random vecotor2: " ;
+			//print (r2);
+
+			Integer pmodulus; //store previous modulus
+			Integer tmp; //temprary integer
+
+			_r. init (den, 1);
+			typename LiftingContainer::const_iterator iter = _lcontainer.begin();
+
+			Integer tmp_den, tmp_num, rem1, rem2;
+			// Do until it meets early termination conditions.
+			int step = 0;
+			//std::cout << "length:= " << len << '\n';
+			//std::cout << "threshold is: "<< _threshold<<std::endl;
+			typename LVector::iterator digits_p = digits. begin();
+
+
 #ifdef RSTIMING
-		tRecon.stop();
-		ttRecon+=tRecon;
-#endif
-		while (step < len) {
-			
-			//std::cout << "In " << step << "th step:\n";
-			
-			IVector& dig = *digits_p;
-			++step; ++ digits_p;
-
-			dig. resize (n);
-
-			// get next p-adic digit
-			bool nextResult = iter.next(dig);
-			if (!nextResult) {
-				std::cout << "ERROR in lifting container. Are you using <double> ring with large norm?" << std::endl;
-				return false;
-			}
-			//std::cout << "New digits:\n";
-			//print (dig); 
-
-			// preserve the old modulus
-			_r.assign (pmodulus, modulus);
-			// upate _modulus *= _prime
-			_r.mulin (modulus,  prime);
-			// update den and num bound
-			if (( step % 2) == 0) {
-				_r. mulin (denbound, prime);
-				_r. assign (numbound, denbound);
-			}
-			
-			if ((step % _threshold) == 0) {
-
-				//std::cout << "Previous (Current) modulus: " << pmodulus << "( " << modulus << ")\n";
-				dot (tmp, r1, dig); _r. remin (tmp, prime); _r. axpyin (c1, tmp, pmodulus);
-				//std::cout << "r1 * digit: " << tmp << '\n';
-				dot (tmp, r2, dig); _r. remin (tmp, prime); _r. axpyin (c2, tmp, pmodulus);
-				//std::cout << "r2 * digit: " << tmp << '\n';
-				//std::cout << "c1, c2: " << c1 << ", " << c2 << "\n";
-				
-				_r. mul (rem1, c1, c1_den); _r. subin (rem1, c1_num); _r. remin (rem1, modulus);
-				_r. mul (rem2, c2, c2_den); _r. subin (rem2, c2_num); _r. remin (rem2, modulus);
-				
-				//Early termination condition is met.
-				
-				if(_r. isZero (rem1) && _r. isZero (rem2)) {
-					
-					//std::cout << "Early termination happens:\n";
-					
-					break;
+			tRecon.stop();
+			ttRecon+=tRecon;
+#endif
+			while (step < len) {
+
+				//std::cout << "In " << step << "th step:\n";
+
+				IVector& dig = *digits_p;
+				++step; ++ digits_p;
+
+				dig. resize (n);
+
+				// get next p-adic digit
+				bool nextResult = iter.next(dig);
+				if (!nextResult) {
+					std::cout << "ERROR in lifting container. Are you using <double> ring with large norm? (1)" << std::endl;
+					return false;
 				}
-				
-				if (!_r. isZero (rem1)) {
-					int status;
-					status = _r.reconstructRational(tmp_num, tmp_den, c1, modulus, numbound, denbound);
-					if(status) {
-						_r. assign (c1_den, tmp_den); _r. assign (c1_num, tmp_num);
-					}
+				//std::cout << "New digits:\n";
+				//print (dig);
+
+				// preserve the old modulus
+				_r.assign (pmodulus, modulus);
+				// upate _modulus *= _prime
+				_r.mulin (modulus,  prime);
+				// update den and num bound
+				if (( step % 2) == 0) {
+					_r. mulin (denbound, prime);
+					_r. assign (numbound, denbound);
 				}
-				
-				if (!_r. isZero (rem2)) {
-					int status;
-					status = _r.reconstructRational(tmp_num, tmp_den, c2, modulus, numbound, denbound);
-					if(status) {
-						_r. assign (c2_den, tmp_den); _r. assign (c2_num, tmp_num);
+
+				if ((step % _threshold) == 0) {
+
+					//std::cout << "Previous (Current) modulus: " << pmodulus << "( " << modulus << ")\n";
+					dot (tmp, r1, dig); _r. remin (tmp, prime); _r. axpyin (c1, tmp, pmodulus);
+					//std::cout << "r1 * digit: " << tmp << '\n';
+					dot (tmp, r2, dig); _r. remin (tmp, prime); _r. axpyin (c2, tmp, pmodulus);
+					//std::cout << "r2 * digit: " << tmp << '\n';
+					//std::cout << "c1, c2: " << c1 << ", " << c2 << "\n";
+
+					_r. mul (rem1, c1, c1_den); _r. subin (rem1, c1_num); _r. remin (rem1, modulus);
+					_r. mul (rem2, c2, c2_den); _r. subin (rem2, c2_num); _r. remin (rem2, modulus);
+
+					//Early termination condition is met.
+
+					if(_r. isZero (rem1) && _r. isZero (rem2)) {
+						//std::cout << "Early termination happens:\n";
+						break;
+					}
+
+					if (!_r. isZero (rem1)) {
+						int status;
+						status = _r.reconstructRational(tmp_num, tmp_den, c1, modulus, numbound, denbound);
+						if(status) {
+							_r. assign (c1_den, tmp_den); _r. assign (c1_num, tmp_num);
+						}
+					}
+
+					if (!_r. isZero (rem2)) {
+						int status;
+						status = _r.reconstructRational(tmp_num, tmp_den, c2, modulus, numbound, denbound);
+						if(status) {
+							_r. assign (c2_den, tmp_den); _r. assign (c2_num, tmp_num);
+						}
 					}
 				}
 			}
-		}
-		IVector res (n);
-		typename LVector::const_iterator digit_begin = digits. begin();
-		PolEval (res, digit_begin, (size_t)step, prime);
-		if(step < len) _r. lcm (den, c1_den, c2_den);
-		else {
-			_r. sqrt(denbound, modulus);
-			_r. assign (numbound, denbound);
-		}
-		
-		//std::cout << "Numbound (Denbound): " << numbound << ", " << denbound << '\n';
-		//std::cout << "Answer mod(" << modulus << "): "; print (res);
-
-#ifdef RSTIMING	
-		tRecon.start();
-#endif	
-		//std::cout << "Start rational reconstruction:\n";
-		typename Vector::iterator num_p; typename IVector::iterator res_p;
-		Integer tmp_res, neg_res, abs_neg, l, g;
-		_r. init (den, 1);
-		int counter=0;
-		for (num_p = num. begin(), res_p = res. begin(); num_p != num. end(); ++ num_p, ++ res_p) {
-			_r. mul (tmp_res, *res_p, den);
-			_r. remin (tmp_res, modulus);
-			_r. sub (neg_res, tmp_res, modulus);
-			_r. abs (abs_neg, neg_res);
-
-			if (_r. compare(tmp_res, numbound) < 0) 
-				_r. assign (*num_p, tmp_res);
-			else if (_r. compare(abs_neg, numbound) < 0)
-				_r. assign (*num_p, neg_res);
+			IVector res (n);
+			typename LVector::const_iterator digit_begin = digits. begin();
+			PolEval (res, digit_begin, (size_t)step, prime);
+			if(step < len) _r. lcm (den, c1_den, c2_den);
 			else {
-				int status;
-				status = _r. reconstructRational(tmp_num, tmp_den, *res_p, modulus, numbound, denbound);
-				if (!status) {
-					std::cout << "ERROR in reconstruction ?\n" << std::endl;
+				_r. sqrt(denbound, modulus);
+				_r. assign (numbound, denbound);
+			}
+
+			//std::cout << "Numbound (Denbound): " << numbound << ", " << denbound << '\n';
+			//std::cout << "Answer mod(" << modulus << "): ";// print (res);
+
+#ifdef RSTIMING
+			tRecon.start();
+#endif
+			std::cout << "Start rational reconstruction:\n";
+			typename Vector::iterator num_p; typename IVector::iterator res_p;
+			Integer tmp_res, neg_res, abs_neg, l, g;
+			_r. init (den, 1);
+			int counter=0;
+			for (num_p = num. begin(), res_p = res. begin(); num_p != num. end(); ++ num_p, ++ res_p) {
+				_r. mul (tmp_res, *res_p, den);
+				_r. remin (tmp_res, modulus);
+				_r. sub (neg_res, tmp_res, modulus);
+				_r. abs (abs_neg, neg_res);
+
+				if (_r. compare(tmp_res, numbound) < 0)
+					_r. assign (*num_p, tmp_res);
+				else if (_r. compare(abs_neg, numbound) < 0)
+					_r. assign (*num_p, neg_res);
+				else {
+					int status;
+					status = _r. reconstructRational(tmp_num, tmp_den, *res_p, modulus, numbound, denbound);
+					if (!status) {
+						std::cout << "ERROR in reconstruction ? (1)\n" << std::endl;
 #ifdef DEBUG_RR
-					std::cout<<" try to reconstruct :\n";
-					//	std::cout<<"approximation: "<<*iter_approx<<std::endl;
-					std::cout<<"modulus: "<<modulus<<std::endl;
-					std::cout<<"numbound: "<<numbound<<std::endl;
-					std::cout<<"denbound: "<<denbound<<std::endl;
+						std::cout<<" try to reconstruct :\n";
+						//	std::cout<<"approximation: "<<*iter_approx<<std::endl;
+						std::cout<<"modulus: "<<modulus<<std::endl;
+						std::cout<<"numbound: "<<numbound<<std::endl;
+						std::cout<<"denbound: "<<denbound<<std::endl;
 #endif
-					return false;
-				}
-				counter++;								
-				_r. lcm (l, den, tmp_den);
-				_r. div (g, l, den);
-
-				if (!_r. isOne (g)) {
-					typename Vector::iterator num_p1;
-					for (num_p1 = num. begin(); num_p1 != num_p; ++ num_p1)
-						_r. mulin (*num_p1, g);
-				}
+						return false;
+					}
+					counter++;
+					_r. lcm (l, den, tmp_den);
+					_r. div (g, l, den);
+
+					if (!_r. isOne (g)) {
+						typename Vector::iterator num_p1;
+						for (num_p1 = num. begin(); num_p1 != num_p; ++ num_p1)
+							_r. mulin (*num_p1, g);
+					}
 
-				_r. div (g, l, tmp_den);
-				_r. mul(*num_p, g, tmp_num);
-				_r. assign (den, l);
+					_r. div (g, l, tmp_den);
+					_r. mul(*num_p, g, tmp_num);
+					_r. assign (den, l);
+				}
 			}
-		}
-		
+
 #ifdef RSTIMING
-		tRecon.stop();
-		ttRecon+=tRecon;
-		_num_rec=counter;
-#endif
-		return true; //lifted ok
-	}
-	
-	/** \brief Reconstruct a vector of rational numbers
-	 *  from p-adic digit vector sequence.
-	 *  An early termination technique is used.
-	 *  Answer is a vector of pair (num, den)
-	 *
-	 * Note, this may fail.
-	 * Generically, the probability of failure should be 1/p^n where n is the number of elements being constructed
-	 * since p is usually quite large this should be ok
-	 */
-	template<class Vector>
-	bool getRational2(Vector& num, Integer& den) const { 
+			tRecon.stop();
+			ttRecon+=tRecon;
+			_num_rec=counter;
+#endif
+			return true; //lifted ok
+		} // end of getRational1
+
+		/** Reconstruct a vector of rational numbers
+		 *  from p-adic digit vector sequence.
+		 *  An early termination technique is used.
+		 *  Answer is a vector of pair (num, den)
+		 *
+		 * @note this may fail:  generically, the probability of
+		 * failure should be 1/p^n where n is the number of elements
+		 * being constructed since p is usually quite large this should
+		 * be ok.
+		 */
+		template<class Vector>
+		bool getRational2(Vector& num, Integer& den) const
+		{
 #ifdef RSTIMING
-		ttRecon.clear();
-		tRecon.start();
-#endif
-		linbox_check(num.size() == (size_t)_lcontainer.size());
-
-		_r. init (den, 1);
-		Integer prime = _lcontainer.prime(); 		        // prime used for lifting
-		std::vector<size_t> accuracy(_lcontainer.size(), 0); 	// accuracy (in powers of p) of each answer so far
-		Vector digit(_lcontainer.size());  		        // to store next digit
-		Integer modulus;        		                // store modulus (power of prime)
-		Integer prev_modulus;       	                        // store previous modulus
-		Integer numbound, denbound;                             // current num/den bound for early termination
-		size_t numConfirmed;                                       // number of reconstructions which passed twice
-		_r.init(modulus, 0);
-		std::vector<Integer> zz(_lcontainer.size(), modulus);   // stores each truncated p-adic approximation
-		_r.init(modulus, 1);
-
-		size_t len = _lcontainer.length(); // should be ceil(log(2*numbound*denbound)/log(prime))
-
-		// should grow in rough proportion to overall num/denbound, 
-		// but MUST have product less than p^i / 2
-		// The heuristic used here is  
-		// -bound when i=1  : N[0]=D[0]=sqrt(1/2)
-		// -bound when i=len: N[len] = N*sqrt(p^len /2/N/D) , D[len] = D*sqrt(p^len /2/N/D)
-		// -with a geometric series in between
-
-		// 2 different ways to compute growing num bound (den is always picked as p^len/2/num)
-		// when log( prime ^ len) is not too big (< 150 digits) we use logs stored as double; this way for very
-		// small primes we don't accumulate multiplicative losses in precision
-		
-		// when log( prime ^ len) is very big we keep multiplying a factor into the num/den bound
-		// at each level of reconstruction
-
-		// note: currently it is usually the case that numbound > denbound. If it ever
-		// happens that denbound >>> numbound, then denbound should be computed first at each step
-		// and then numbound set to p^i / 2 / denbound, for less accumulated precision loss
-
-		double dtmp;
-		double half_log_p = 0.5 * log(_r.convert(dtmp, prime)); 
-		const double half_log_2 = 0.34657359027997265472;
-		double multy = 0;
-		Integer numFactor;
-
-		bool verybig = half_log_p * len > 75 * log(10.0);
-
-		if (len > 1) {
-			if (!verybig)
-				multy = 0.5 * (log(_r.convert(dtmp, _lcontainer.numbound())) 
-					       -log(_r.convert(dtmp, _lcontainer.denbound()))) / (len - 1);
-			else {
-				LinBox::integer iD, iN, pPower, tmp;
-				_r.convert(iD, _lcontainer.numbound());
-				_r.convert(iN, _lcontainer.denbound());
-				_r.convert(pPower, prime);
-				pPower = pow(pPower, len-1);
-
-				tmp = pPower * iN;
-				tmp /= iD;
-				root(tmp, tmp, 2*len);
-				_r.init(numFactor, tmp);
-
-				// inital numbound is numFactor/sqrt(2)
-				tmp = (tmp * 29) / 41;
-				_r.init(numbound, tmp);
+			ttRecon.clear();
+			tRecon.start();
+#endif
+			linbox_check(num.size() == (size_t)_lcontainer.size());
+
+			_r. init (den, 1);
+			Integer prime = _lcontainer.prime(); 		        // prime used for lifting
+			std::vector<size_t> accuracy(_lcontainer.size(), 0); 	// accuracy (in powers of p) of each answer so far
+			Vector digit(_lcontainer.size());  		        // to store next digit
+			Integer modulus;        		                // store modulus (power of prime)
+			Integer prev_modulus;       	                        // store previous modulus
+			Integer numbound, denbound;                             // current num/den bound for early termination
+			size_t numConfirmed;                                       // number of reconstructions which passed twice
+			_r.init(modulus, 0);
+			std::vector<Integer> zz(_lcontainer.size(), modulus);   // stores each truncated p-adic approximation
+			_r.init(modulus, 1);
+
+			size_t len = _lcontainer.length();
+			/* should be ceil(log(2*numbound*denbound)/log(prime))
+			 *
+			 * should grow in rough proportion to overall
+			 * num/denbound, but MUST have product less than p^i/2
+			 * The heuristic used here is
+			 * - bound when i=1  : N[0]=D[0]=sqrt(1/2)
+			 * - bound when i=len: N[len] = N*sqrt(p^len /2/N/D),
+			 *   D[len] = D*sqrt(p^len /2/N/D)
+			 * - with a geometric series in between
+			 *
+			 * 2 different ways to compute growing num bound (den
+			 * is always picked as p^len/2/num)
+			 * - when log( prime ^ len) is not too big (< 150
+			 *   digits) we use logs stored as double; this way for
+			 *   very small primes we don't accumulate
+			 *   multiplicative losses in precision
+			 *
+			 * - when log( prime ^ len) is very big we keep
+			 *   multiplying a factor into the num/den bound at
+			 *   each level of reconstruction
+			 *
+			 * note: currently it is usually the case that $numbound
+			 * > denbound$. If it ever happens that $denbound >>>
+			 * numbound$, then denbound should be computed first at
+			 * each step and then numbound set to p^i/2/denbound,
+			 * for less accumulated precision loss
+			 */
+			double dtmp;
+			double half_log_p = 0.5 * log(_r.convert(dtmp, prime));
+			const double half_log_2 = 0.34657359027997265472;
+			double multy = 0;
+			Integer numFactor;
+
+			bool verybig = half_log_p * len > 75 * log(10.0);
+
+			if (len > 1) {
+				if (!verybig)
+					multy = 0.5 * (log(_r.convert(dtmp, _lcontainer.numbound()))
+						       -log(_r.convert(dtmp, _lcontainer.denbound()))) / (len - 1);
+				else {
+					LinBox::integer iD, iN, pPower, tmp;
+					_r.convert(iD, _lcontainer.numbound());
+					_r.convert(iN, _lcontainer.denbound());
+					_r.convert(pPower, prime);
+					pPower = pow(pPower, len-1);
+
+					tmp = pPower * iN;
+					tmp /= iD;
+					root(tmp, tmp, 2*len);
+					_r.init(numFactor, tmp);
+
+					// inital numbound is numFactor/sqrt(2)
+					tmp = (tmp * 29) / 41;
+					_r.init(numbound, tmp);
+				}
 			}
-		}
-			
+
 #ifdef DEBUG_RR
-		std::cout << "nbound, dbound:" << _lcontainer.numbound() << ",  " << _lcontainer.denbound() << std::endl;
+			std::cout << "nbound, dbound:" << _lcontainer.numbound() << ",  " << _lcontainer.denbound() << std::endl;
 #endif
 
-		typename Vector::iterator num_p;
-		typename std::vector<Integer>::iterator zz_p;
-		std::vector<size_t>::iterator accuracy_p;
-		typename Vector::iterator digit_p;
-			
-		long tmp;
-		Integer tmp_i;
+			typename Vector::iterator num_p;
+			typename std::vector<Integer>::iterator zz_p;
+			std::vector<size_t>::iterator accuracy_p;
+			typename Vector::iterator digit_p;
+
+			long tmp;
+			Integer tmp_i;
+
+			size_t i = 0;
 
-		size_t i = 0;
-			
-		typename LiftingContainer::const_iterator iter = _lcontainer.begin(); 
+			typename LiftingContainer::const_iterator iter = _lcontainer.begin();
 
-		bool gotAll = false; //set to true if all values are reconstructed on a particular step
+			bool gotAll = false; //set to true if all values are reconstructed on a particular step
 
-		// do until getting all answer
-		do {
-			++ i;		
-#ifdef DEBUG_RR		
-			std::cout<<"i: "<<i<<std::endl;
+			// do until getting all answer
+			do {
+				++ i;
+#ifdef DEBUG_RR
+				std::cout<<"i: "<<i<<std::endl;
 #endif
 #ifdef RSTIMING
-			tRecon.stop();
-			ttRecon += tRecon;
+				tRecon.stop();
+				ttRecon += tRecon;
 #endif
-			// get next p-adic digit
-			bool nextResult = iter.next(digit);
-			if (!nextResult) {
-				std::cout << "ERROR in lifting container. Are you using <double> ring with large norm?" << std::endl;
-				return false;
-			}
+				// get next p-adic digit
+				bool nextResult = iter.next(digit);
+				if (!nextResult) {
+					std::cout << "ERROR in lifting container. Are you using <double> ring with large norm? (2)" << std::endl;
+					return false;
+				}
 #ifdef RSTIMING
-			tRecon.start();
-#endif			
-			// preserve the old modulus
-			_r.assign (prev_modulus, modulus);
+				tRecon.start();
+#endif
+				// preserve the old modulus
+				_r.assign (prev_modulus, modulus);
 
-			// upate _modulus *= _prime
-			_r.mulin (modulus,  prime);
+				// upate _modulus *= _prime
+				_r.mulin (modulus,  prime);
 
-			// update truncated p-adic approximation
-			for ( digit_p = digit.begin(), zz_p = zz.begin(); digit_p != digit.end(); ++ digit_p, ++ zz_p) 
-				_r.axpyin(*zz_p, prev_modulus, *digit_p);
+				// update truncated p-adic approximation
+				for ( digit_p = digit.begin(), zz_p = zz.begin(); digit_p != digit.end(); ++ digit_p, ++ zz_p)
+					_r.axpyin(*zz_p, prev_modulus, *digit_p);
 #ifdef DEBUG_RR
-			std::cout<<"approximation mod p^"<<i<<" : \n";
-			std::cout<<"[";
-			for (size_t j=0;j< zz.size( )-1;j++)
-				std::cout<<zz[j]<<",";
-			std::cout<<zz.back()<<"]\n";
-			std::cout<<"digit:\n";				
-			for (size_t j=0;j< digit.size();++j)
-				std::cout<<digit[j]<<",";
-			std::cout<<std::endl;
-#endif			
-			if (verybig && i>1 && i<len)
-				_r.mulin(numbound, numFactor);
-
-			numConfirmed = 0;
-			if ( !gotAll && (i % _threshold != 0) && (i + _threshold < len)) continue;
-			// change to geometric skips?
-
-			// update den and num bound, see above for details
-			if (i == len) { //in this case we set bound to exact values
-				_r. assign(numbound, _lcontainer.numbound());
-				_r. assign(denbound, _lcontainer.denbound());
-			}
-			else {
-				if (!verybig) 
-					_r.init(numbound, exp(i*half_log_p - half_log_2 + multy * (i - 1)));
+				std::cout<<"approximation mod p^"<<i<<" : \n";
+				std::cout<<"[";
+				for (size_t j=0;j< zz.size( )-1;j++)
+					std::cout<<zz[j]<<",";
+				std::cout<<zz.back()<<"]\n";
+				std::cout<<"digit:\n";
+				for (size_t j=0;j< digit.size();++j)
+					std::cout<<digit[j]<<",";
+				std::cout<<std::endl;
+#endif
+				if (verybig && i>1 && i<len)
+					_r.mulin(numbound, numFactor);
 
-				Integer tmp;
-				_r.init(tmp, 2);
-				_r.mulin(tmp, numbound);
-				_r.quo(denbound, modulus, tmp);
-			}
+				numConfirmed = 0;
+				if ( !gotAll && (i % _threshold != 0) && (i + _threshold < len)) continue;
+				// change to geometric skips?
+
+				// update den and num bound, see above for details
+				if (i == len) { //in this case we set bound to exact values
+					_r. assign(numbound, _lcontainer.numbound());
+					_r. assign(denbound, _lcontainer.denbound());
+				}
+				else {
+					if (!verybig)
+						_r.init(numbound, exp(i*half_log_p - half_log_2 + multy * (i - 1)));
+
+					Integer tmp;
+					_r.init(tmp, 2);
+					_r.mulin(tmp, numbound);
+					_r.quo(denbound, modulus, tmp);
+				}
 #ifdef DEBUG_RR
-			std::cout << "i, N, D bounds: " << i << ", " << numbound << ", " << denbound << std::endl;
-#endif
-			gotAll = true;
-			bool justConfirming = true;
-			int index = 0;
-			// try to construct all unconstructed numbers
-			for ( zz_p = zz.begin(), num_p = num.begin(), accuracy_p = accuracy.begin();
-			      zz_p != zz.end();  ++ zz_p, ++ num_p, ++ accuracy_p, ++index) {
-
-				if ( *accuracy_p == 0) {
-					justConfirming = false;
-					// if no answer yet (or last answer became invalid)
-					// try to reconstruct a rational number
-					// try if co_den if a multiple of the denominator of rational.
-					Integer tmp_num, tmp_den;
-					_r. assign (tmp_den, den);
-					_r. mul (tmp_num, den, *zz_p);
-					_r. remin (tmp_num, modulus);
-
-					// assign tmp_num = one of tmp_num and tmp_num - modulus with smallest absolute value.
-					Integer n_num;
-					_r. sub (n_num, tmp_num, modulus);
-					Integer abs_n, abs_nn;
-					_r. abs (abs_n, tmp_num);
-					_r. abs (abs_nn, n_num);
-					if (_r. compare (abs_n, abs_nn) > 0)
-						_r. assign (tmp_num, n_num);
-				
-					Integer g;
-					_r. gcd (g, tmp_num, tmp_den);
-					if (!_r. isUnit (g)) {
-						_r. divin (tmp_num, g);
-						_r. divin (tmp_den, g);
-					}
-					// check if (tmp_num, tmp_den) is an answer
-					_r. abs (abs_n, tmp_num);
-					_r. abs (abs_nn, tmp_den);
-					// yes
-					if (_r. compare (abs_n, numbound) < 0 && _r. compare (abs_nn, denbound) < 0) {
-						*accuracy_p = i;
-						continue;
-					}
-					//no
-				  	justConfirming = false;
-					// if no answer yet (or last answer became invalid)
-					// try to reconstruct a rational number
-					tmp = _r.reconstructRational(*num_p, tmp_den, *zz_p, modulus, numbound, denbound);
-					// update 'accuracy' according to whether it worked or not
-					if (tmp) {
-						linbox_check (!_r.isZero(tmp_den));
-						if (! _r. areEqual (tmp_den, den)) {
-							Integer lcm, t1, t2;
-							_r. lcm (lcm, tmp_den, den);
-							_r. div (t1, lcm, tmp_den);
-							_r. mulin (*num_p, t1);
-							_r. div (t2, lcm, den);
-							_r. assign (den, lcm);
-							for (typename Vector::iterator tmp_p = num. begin (); tmp_p != num_p; ++ tmp_p)
-								_r. mulin (*tmp_p, t2);
+				std::cout << "i, N, D bounds: " << i << ", " << numbound << ", " << denbound << std::endl;
+#endif
+				gotAll = true;
+				bool justConfirming = true;
+				int index = 0;
+				// try to construct all unconstructed numbers
+				for ( zz_p = zz.begin(), num_p = num.begin(), accuracy_p = accuracy.begin();
+				      zz_p != zz.end();  ++ zz_p, ++ num_p, ++ accuracy_p, ++index) {
+
+					if ( *accuracy_p == 0) {
+						justConfirming = false;
+						// if no answer yet (or last answer became invalid)
+						// try to reconstruct a rational number
+						// try if co_den if a multiple of the denominator of rational.
+						Integer tmp_num, tmp_den;
+						_r. assign (tmp_den, den);
+						_r. mul (tmp_num, den, *zz_p);
+						_r. remin (tmp_num, modulus);
+
+						// assign tmp_num = one of tmp_num and tmp_num - modulus with smallest absolute value.
+						Integer n_num;
+						_r. sub (n_num, tmp_num, modulus);
+						Integer abs_n, abs_nn;
+						_r. abs (abs_n, tmp_num);
+						_r. abs (abs_nn, n_num);
+						if (_r. compare (abs_n, abs_nn) > 0)
+							_r. assign (tmp_num, n_num);
+
+						Integer g;
+						_r. gcd (g, tmp_num, tmp_den);
+						if (!_r. isUnit (g)) {
+							_r. divin (tmp_num, g);
+							_r. divin (tmp_den, g);
 						}
-					*accuracy_p = i;
-					}
-					else {
-						*accuracy_p = 0;
-						gotAll = false;
-					}
-				}
-			}
-
-			// if all were already done, check old approximations and try to reconstruct broken ones
-			// also need to do this when we're on last iteration
-			index = 0;
-			if (justConfirming || i == len)
-			for ( zz_p = zz.begin(), num_p = num.begin(), accuracy_p = accuracy.begin();
-			      gotAll && zz_p != zz.end(); ++ zz_p, ++ num_p, ++ accuracy_p, index++) {
-				
-				if ( *accuracy_p < i ) {
-					// check if the rational number works for _zz_p mod _modulus
-					_r. mul (tmp_i, den, *zz_p);
-					_r. subin (tmp_i, *num_p);
-					_r. remin (tmp_i, modulus);
-					if (_r.isZero (tmp_i)) {
-						*accuracy_p = i;
-						numConfirmed++;
-					}
-					else {
-						// previous result is fake, reconstruct new answer
-						Integer tmp_den;
+						// check if (tmp_num, tmp_den) is an answer
+						_r. abs (abs_n, tmp_num);
+						_r. abs (abs_nn, tmp_den);
+						// yes
+						if (_r. compare (abs_n, numbound) < 0 && _r. compare (abs_nn, denbound) < 0) {
+							*accuracy_p = i;
+							continue;
+						}
+						//no
+						justConfirming = false;
+						// if no answer yet (or last answer became invalid)
+						// try to reconstruct a rational number
 						tmp = _r.reconstructRational(*num_p, tmp_den, *zz_p, modulus, numbound, denbound);
+						// update 'accuracy' according to whether it worked or not
 						if (tmp) {
-							linbox_check (!_r.isZero(den));
+							linbox_check (!_r.isZero(tmp_den));
 							if (! _r. areEqual (tmp_den, den)) {
-							Integer lcm, t1, t2;
-							_r. lcm (lcm, tmp_den, den);
-							_r. div (t1, lcm, tmp_den);
-							_r. mulin (*num_p, t1);
-							_r. div (t2, lcm, den);
-							_r. assign (den, lcm);
-							for (typename Vector::iterator tmp_p = num. begin (); tmp_p != num_p; ++ tmp_p)
-								_r. mulin (*tmp_p, t2);
+								Integer lcm, t1, t2;
+								_r. lcm (lcm, tmp_den, den);
+								_r. div (t1, lcm, tmp_den);
+								_r. mulin (*num_p, t1);
+								_r. div (t2, lcm, den);
+								_r. assign (den, lcm);
+								for (typename Vector::iterator tmp_p = num. begin (); tmp_p != num_p; ++ tmp_p)
+									_r. mulin (*tmp_p, t2);
 							}
 							*accuracy_p = i;
 						}
@@ -617,287 +615,337 @@ public:
 						}
 					}
 				}
+
+				// if all were already done, check old approximations and try to reconstruct broken ones
+				// also need to do this when we're on last iteration
+				index = 0;
+				if (justConfirming || i == len)
+					for ( zz_p = zz.begin(), num_p = num.begin(), accuracy_p = accuracy.begin();
+					      gotAll && zz_p != zz.end(); ++ zz_p, ++ num_p, ++ accuracy_p, index++) {
+
+						if ( *accuracy_p < i ) {
+							// check if the rational number works for _zz_p mod _modulus
+							_r. mul (tmp_i, den, *zz_p);
+							_r. subin (tmp_i, *num_p);
+							_r. remin (tmp_i, modulus);
+							if (_r.isZero (tmp_i)) {
+								*accuracy_p = i;
+								numConfirmed++;
+							}
+							else {
+								// previous result is fake, reconstruct new answer
+								Integer tmp_den;
+								tmp = _r.reconstructRational(*num_p, tmp_den, *zz_p, modulus, numbound, denbound);
+								if (tmp) {
+									linbox_check (!_r.isZero(den));
+									if (! _r. areEqual (tmp_den, den)) {
+										Integer lcm, t1, t2;
+										_r. lcm (lcm, tmp_den, den);
+										_r. div (t1, lcm, tmp_den);
+										_r. mulin (*num_p, t1);
+										_r. div (t2, lcm, den);
+										_r. assign (den, lcm);
+										for (typename Vector::iterator tmp_p = num. begin (); tmp_p != num_p; ++ tmp_p)
+											_r. mulin (*tmp_p, t2);
+									}
+									*accuracy_p = i;
+								}
+								else {
+									*accuracy_p = 0;
+									gotAll = false;
+								}
+							}
+						}
+					}
 			}
-		}
-		while (numConfirmed < _lcontainer.size() && i < len);
-		//still probabilstic, but much less so
+			while (numConfirmed < _lcontainer.size() && i < len);
+			//still probabilstic, but much less so
 #ifdef RSTIMING
-		tRecon.stop();
-		ttRecon += tRecon;
-#endif	
+			tRecon.stop();
+			ttRecon += tRecon;
+#endif
 #ifdef DEBUG_RR_BOUNDACCURACY
-		std::cout << "Computed " << i << " digits out of estimated " << len << std::endl;
+			std::cout << "Computed " << i << " digits out of estimated " << len << std::endl;
 #endif
 
 
-		Integer g;
-		_r. init (g, 0);
-		_r. gcdin (g, den);
-		for (num_p = num. begin(); num_p != num. end(); ++ num_p)
-			_r. gcdin (g, *num_p);
-
-		if (!_r. isOne (g) && !_r. isZero(g)) {
+			Integer g;
+			_r. init (g, 0);
+			_r. gcdin (g, den);
 			for (num_p = num. begin(); num_p != num. end(); ++ num_p)
-				_r. divin (*num_p, g);
-			_r. divin (den, g);
-		}
-		return true; //lifted ok, assuming norm was correct
-	}
+				_r. gcdin (g, *num_p);
 
+			if (!_r. isOne (g) && !_r. isZero(g)) {
+				for (num_p = num. begin(); num_p != num. end(); ++ num_p)
+					_r. divin (*num_p, g);
+				_r. divin (den, g);
+			}
+			return true; //lifted ok, assuming norm was correct
+		} // end of getRational2
+
+		/** @brief NO DOC.
+		 * @param y   ?
+		 * @param Pol ?
+		 * @param deg ?
+		 * @param x   ?
+		 */
+		template <class ConstIterator>
+		void PolEval(Vector& y, ConstIterator& Pol, size_t deg, Integer &x) const
+		{
 
 
-	template <class ConstIterator>
-        void PolEval(Vector& y, ConstIterator& Pol, size_t deg, Integer &x) const {
-		
-		
-		if (deg == 1){
-			for (size_t i=0;i<y.size();++i)
-				_r.assign(y[i],(*Pol)[i]);			
-		}
-		else{
-			size_t deg_low, deg_high;
-			deg_high = deg/2;
-			deg_low  = deg - deg_high;
-			Integer zero;
-			_r.init(zero,0);
-			Vector y1(y.size(),zero), y2(y.size(),zero);
-			Integer x1=x, x2=x;
+			if (deg == 1){
+				for (size_t i=0;i<y.size();++i)
+					_r.assign(y[i],(*Pol)[i]);
+			}
+			else{
+				size_t deg_low, deg_high;
+				deg_high = deg/2;
+				deg_low  = deg - deg_high;
+				Integer zero;
+				_r.init(zero,0);
+				Vector y1(y.size(),zero), y2(y.size(),zero);
+				Integer x1=x, x2=x;
+
+				PolEval(y1, Pol, deg_low, x1);
+
+				ConstIterator Pol_high= Pol+deg_low;
+				PolEval(y2, Pol_high, deg_high, x2);
 
-			PolEval(y1, Pol, deg_low, x1);
 
-			ConstIterator Pol_high= Pol+deg_low;
-			PolEval(y2, Pol_high, deg_high, x2);
-			
+				for (size_t i=0;i< y.size();++i){
+					_r.assign(y[i],y1[i]);
+					_r.axpyin(y[i],x1,y2[i]);
+					//_r.axpy(y[i],x1,y2[i],y1[i]);
+				}
 
-			for (size_t i=0;i< y.size();++i){
-				_r.assign(y[i],y1[i]);
-				_r.axpyin(y[i],x1,y2[i]);
-				//_r.axpy(y[i],x1,y2[i],y1[i]);			
+				_r.mul(x,x1,x2);
 			}
-					
-			_r.mul(x,x1,x2);
 		}
-	}
 
 
-	/** \brief Reconstruct a vector of rational numbers
-	 *  from p-adic digit vector sequence.
-	 *  compute all digits and reconstruct rationals only once
-	 *  Result is a vector of numerators and one common denominator
-	 */
-	template<class Vector1>
-	bool getRational3(Vector1& num, Integer& den) const { 
-		
+		/** Reconstruct a vector of rational numbers
+		 *  from p-adic digit vector sequence.
+		 *  compute all digits and reconstruct rationals only once
+		 *  Result is a vector of numerators and one common denominator
+		 */
+		template<class Vector1>
+		bool getRational3(Vector1& num, Integer& den) const
+		{
+
 #ifdef RSTIMING
-		ttRecon.clear();
-		tRecon.start();
-#endif
-		linbox_check(num.size() == (size_t)_lcontainer.size());
-		
-		// prime 
-		Integer prime = _lcontainer.prime();
-		
-		// length of whole approximation
-		size_t length=_lcontainer.length();
-		
-		// size of solution
-		size_t size= _lcontainer.size();
-		 
-		
-		Integer zero;
-		_r.init(zero,0);
-		Vector zero_digit(_lcontainer.size(),zero);	
-		
-		// store approximation as a polynomial and evaluate by baby step giant step
-		std::vector<Vector>  digit_approximation(length,zero_digit); 
-
-		// store real approximation
-		Vector real_approximation(size,zero);
-
-
-		// store modulus (intially set to 1)
-		Integer modulus;
-		_r.init(modulus, 1);
-		
-		// denominator upper bound
-		Integer denbound;
-		_r.assign(denbound,_lcontainer.denbound());
-		
-		// numerator  upper bound
-		Integer numbound;
-		_r.assign(numbound,_lcontainer.numbound());
-	
+			ttRecon.clear();
+			tRecon.start();
+#endif
+			linbox_check(num.size() == (size_t)_lcontainer.size());
+
+			// prime
+			Integer prime = _lcontainer.prime();
+
+			// length of whole approximation
+			size_t length=_lcontainer.length();
+
+			// size of solution
+			size_t size= _lcontainer.size();
+
+
+			Integer zero;
+			_r.init(zero,0);
+			Vector zero_digit(_lcontainer.size(),zero);
+
+			// store approximation as a polynomial and evaluate by baby step giant step
+			std::vector<Vector>  digit_approximation(length,zero_digit);
+
+			// store real approximation
+			Vector real_approximation(size,zero);
+
+
+			// store modulus (intially set to 1)
+			Integer modulus;
+			_r.init(modulus, 1);
+
+			// denominator upper bound
+			Integer denbound;
+			_r.assign(denbound,_lcontainer.denbound());
+
+			// numerator  upper bound
+			Integer numbound;
+			_r.assign(numbound,_lcontainer.numbound());
+
 #ifdef RSTIMING
-		tRecon.stop();
-		ttRecon += tRecon;
-#endif		
+			tRecon.stop();
+			ttRecon += tRecon;
+#endif
 #ifdef LIFTING_PROGRESS
-		Commentator lifting_commentator;
-		lifting_commentator.start("Padic Lifting","LinBox::LiftingContainer",_lcontainer.length());
-#endif
-	
-		//Timer eval_horner,eval_horn;
-		//eval_horner.clear();
-		// Compute all the approximation using liftingcontainer
-		typename LiftingContainer::const_iterator iter = _lcontainer.begin();
-		for (size_t i=0 ; iter != _lcontainer.end() && iter.next(digit_approximation[i]);++i) {
-
-#ifdef LIFTING_PROGRESS			
-			lifting_commentator.progress(i);
-#endif
-			//eval_horn.start();
-			//for (size_t j=0;j<size;++j)
-			//	_r.axpyin(real_approximation[j],modulus, digit_approximation[i][j]);							
-			//eval_horn.stop();
-			//eval_horner+=eval_horn;
-
-			_r.mulin(modulus,prime); 
-		}
+			Commentator lifting_commentator;
+			lifting_commentator.start("Padic Lifting","LinBox::LiftingContainer",_lcontainer.length());
+#endif
+#if 0
+			Timer eval_horner,eval_horn;
+			eval_horner.clear();
+#endif
+			// Compute all the approximation using liftingcontainer
+			typename LiftingContainer::const_iterator iter = _lcontainer.begin();
+			for (size_t i=0 ; iter != _lcontainer.end() && iter.next(digit_approximation[i]);++i) {
+
+#ifdef LIFTING_PROGRESS
+				lifting_commentator.progress(i);
+#endif
+#if 0
+				eval_horn.start();
+				for (size_t j=0;j<size;++j)
+					_r.axpyin(real_approximation[j],modulus, digit_approximation[i][j]);
+				eval_horn.stop();
+				eval_horner+=eval_horn;
+#endif
+				_r.mulin(modulus,prime);
+			}
 
-#ifdef LIFTING_PROGRESS			
-		lifting_commentator.stop ("Done", "Done", "LinBox::LinBox::LiftingContainer");	 
+#ifdef LIFTING_PROGRESS
+			lifting_commentator.stop ("Done", "Done", "LinBox::LinBox::LiftingContainer");
 #endif
-	
-		// problem occured during lifting
-		if (iter!= _lcontainer.end()){
-			std::cout << "ERROR in lifting container. Are you using <double> ring with large norm?" << std::endl;
-			return false;
-		}
-		
-#ifdef RSTIMING
-		tRecon.start();
-#endif
-	
-		Timer eval_dac;//, eval_bsgs;
-		
-		//eval_bsgs.start();
-		// sqrt of approximation's length
-		//int sqrt_length= (int) sqrt((double) length);				
-		/*
-		 * Baby-Step/ Giant-Step Polynomial evaluation of digit approximation
-		 */
-		/*
-		{
-			// store intermediate baby-step/ giant-step polynomial evaluation of the approximation in prime
-			std::vector<Vector> baby_approx (sqrt_length+1,zero_digit);
-					
-			// perform baby-step
-			int skip=-sqrt_length;
-			for (int k=0;k<sqrt_length;++k){
-				skip+=sqrt_length;
-				for (int i= sqrt_length-1; i>=0; --i) 
-					for (size_t j=0;j<size;++j) {					
-						_r.mulin(baby_approx[k][j] , prime);
-						_r.addin(baby_approx[k][j], digit_approximation[skip+i][j]);	
-					}
+
+			// problem occured during lifting
+			if (iter!= _lcontainer.end()){
+				std::cout << "ERROR in lifting container. Are you using <double> ring with large norm? (3)" << std::endl;
+				return false;
 			}
-			
-			for (int i= length -1; i>= skip+sqrt_length; --i)
-				for (size_t j=0;j<size;++j) {					
-					_r.mulin(baby_approx[sqrt_length][j] , prime);
-					_r.addin(baby_approx[sqrt_length][j], digit_approximation[i][j]);				
-				}
-			
-			LinBox::integer p_to_sqrt, p;
-			_r.convert(p,prime);
-			p_to_sqrt= pow(p,sqrt_length);
-			Integer prime_to_sqrt;
-			_r.init(prime_to_sqrt, p_to_sqrt);
-			
-					
-			// perform giant step
-			for (int i= sqrt_length; i>= 0; --i)
-				for (size_t j=0;j<size;j++) {
-					_r.mulin(real_approximation[j] , prime_to_sqrt );
-					_r.addin(real_approximation[j], baby_approx[i][j]);
-				}
-		}
-		eval_bsgs.stop();
-		*/
 
-		eval_dac.start();
-		Integer xeval=prime;
-		typename std::vector<Vector>::const_iterator poly_digit= digit_approximation.begin();
-		PolEval(real_approximation, poly_digit, length, xeval);
+#ifdef RSTIMING
+			tRecon.start();
+#endif
 
-		//std::std::cout << "Another way get answer mod(" << modulus << "): "; print(real_approximation);
+			Timer eval_dac;//, eval_bsgs;
+#if 0
+			eval_bsgs.start();
+			// sqrt of approximation's length
+			int sqrt_length= (int) sqrt((double) length);
+#endif
+			/*
+			 * Baby-Step/ Giant-Step Polynomial evaluation of digit approximation
+			 */
+#if 0
+			{
+				// store intermediate baby-step/ giant-step polynomial evaluation of the approximation in prime
+				std::vector<Vector> baby_approx (sqrt_length+1,zero_digit);
+
+				// perform baby-step
+				int skip=-sqrt_length;
+				for (int k=0;k<sqrt_length;++k){
+					skip+=sqrt_length;
+					for (int i= sqrt_length-1; i>=0; --i)
+						for (size_t j=0;j<size;++j) {
+							_r.mulin(baby_approx[k][j] , prime);
+							_r.addin(baby_approx[k][j], digit_approximation[skip+i][j]);
+						}
+				}
 
-		eval_dac.stop();
-		
-// 		integer modulus_size;
-// 		_r.convert(modulus_size,modulus);
-// 		std::cout<<"number of bit : "<< modulus_size.bitsize()<<std::endl;
-// 		std::cout<<"length        : "<< length<<std::endl;
-// 		std::cout<<"prime         : "<< prime<<std::endl;
-//		std::cout<<"evaluation divide&conquer  : "<<eval_dac<<std::endl;
-// 		std::cout<<"evaluation baby/giant step : "<<eval_bsgs<<std::endl;
-// 		std::cout<<"evaluation horner method   : "<<eval_horner<<std::endl;
+				for (int i= length -1; i>= skip+sqrt_length; --i)
+					for (size_t j=0;j<size;++j) {
+						_r.mulin(baby_approx[sqrt_length][j] , prime);
+						_r.addin(baby_approx[sqrt_length][j], digit_approximation[i][j]);
+					}
 
+				LinBox::integer p_to_sqrt, p;
+				_r.convert(p,prime);
+				p_to_sqrt= pow(p,sqrt_length);
+				Integer prime_to_sqrt;
+				_r.init(prime_to_sqrt, p_to_sqrt);
 
-		/* 
-		 * dumb rational reconstruction (this is just for timing comparison)
-		 */
-// 		{
-// 			Timer dumb_ratrecon;
-// 			dumb_ratrecon.start();
-// 			Vector den_r(num.size()), num_r(num.size());			
-// 			typename Vector::iterator   iter_a  = real_approximation.begin();
-// 			typename Vector::iterator   iter_n  = num_r.begin();
-// 			typename Vector::iterator   iter_d  = den_r.begin();
-						
-// 			for (size_t i=0; iter_a != real_approximation.end(); ++iter_a, ++ iter_n, ++iter_d, ++i){				
-// 				if (!_r.reconstructRational(*iter_n, *iter_d,
-// 						    *iter_a, modulus, numbound, denbound))
-// 				{					
-// 					std::cout << "ERROR in reconstruction ?\n" << std::endl;
-// 				}
-// 			}
-// 			dumb_ratrecon.stop();
-// 			std::cout<<"full rational reconstruction : "<<dumb_ratrecon.usertime()<<std::endl;
-// 		}
-		
-		
-		/*
-		 * Rational Reconstruction of each coefficient according to a common denominator
-		 */
-		
-		Timer ratrecon;
-		ratrecon.start();
-		Integer common_den, common_den_mod_prod, bound,two,tmp;
-		_r.init(common_den,1);
-		_r.init(common_den_mod_prod,1);
-		_r.init(two,2);		
-		
-		Vector denominator(num.size());
-
-		int counter=0;
-		typename Vector::iterator   iter_approx = real_approximation.begin();
-		typename Vector1::iterator  iter_num    = num.begin();
-		typename Vector::iterator   iter_denom  = denominator.begin();
-		
-		//numbound=denbound;
-		Integer neg_approx, abs_approx;
-		int idx_last_den=0;
-
-		for (size_t i=0; iter_approx != real_approximation.end(); ++iter_approx, ++ iter_num, ++iter_denom, ++i){
-			//_r.mulin( *iter_approx , common_den_mod_prod);
-			_r.mulin( *iter_approx , common_den);
-			_r.remin( *iter_approx , modulus);
-			_r. sub (neg_approx, *iter_approx, modulus);
-			_r. abs (abs_approx, neg_approx);
-
-			if ( _r.compare(*iter_approx, numbound) < 0){
-				_r.assign(*iter_num, *iter_approx);
-				_r.init(*iter_denom, 1);
-			}
-			else if (_r.compare(abs_approx, numbound) <0){
-				_r.assign(*iter_num, neg_approx);
-				_r.init(*iter_denom, 1);
+
+				// perform giant step
+				for (int i= sqrt_length; i>= 0; --i)
+					for (size_t j=0;j<size;j++) {
+						_r.mulin(real_approximation[j] , prime_to_sqrt );
+						_r.addin(real_approximation[j], baby_approx[i][j]);
+					}
 			}
-			else {
-				if  (!_r.reconstructRational(*iter_num, *iter_denom, *iter_approx, modulus, numbound, denbound))
-					{					
+			eval_bsgs.stop();
+#endif
+			eval_dac.start();
+			Integer xeval=prime;
+			typename std::vector<Vector>::const_iterator poly_digit= digit_approximation.begin();
+			PolEval(real_approximation, poly_digit, length, xeval);
+
+			//std::std::cout << "Another way get answer mod(" << modulus << "): "; print(real_approximation);
+
+			eval_dac.stop();
+#if 0
+			integer modulus_size;
+			_r.convert(modulus_size,modulus);
+			std::cout<<"number of bit : "<< modulus_size.bitsize()<<std::endl;
+			std::cout<<"length        : "<< length<<std::endl;
+			std::cout<<"prime         : "<< prime<<std::endl;
+			std::cout<<"evaluation divide&conquer  : "<<eval_dac<<std::endl;
+			std::cout<<"evaluation baby/giant step : "<<eval_bsgs<<std::endl;
+			std::cout<<"evaluation horner method   : "<<eval_horner<<std::endl;
+#endif
+
+			/*
+			 * dumb rational reconstruction (this is just for timing comparison)
+			 */
+#if 0
+			{
+				Timer dumb_ratrecon;
+				dumb_ratrecon.start();
+				Vector den_r(num.size()), num_r(num.size());
+				typename Vector::iterator   iter_a  = real_approximation.begin();
+				typename Vector::iterator   iter_n  = num_r.begin();
+				typename Vector::iterator   iter_d  = den_r.begin();
+
+				for (size_t i=0; iter_a != real_approximation.end(); ++iter_a, ++ iter_n, ++iter_d, ++i){
+					if (!_r.reconstructRational(*iter_n, *iter_d,
+								    *iter_a, modulus, numbound, denbound))
+					{
 						std::cout << "ERROR in reconstruction ?\n" << std::endl;
+					}
+				}
+				dumb_ratrecon.stop();
+				std::cout<<"full rational reconstruction : "<<dumb_ratrecon.usertime()<<std::endl;
+			}
+
+#endif
+			/*
+			 * Rational Reconstruction of each coefficient according to a common denominator
+			 */
+
+			Timer ratrecon;
+			ratrecon.start();
+			Integer common_den, common_den_mod_prod, bound,two,tmp;
+			_r.init(common_den,1);
+			_r.init(common_den_mod_prod,1);
+			_r.init(two,2);
+
+			Vector denominator(num.size());
+
+			int counter=0;
+			typename Vector::iterator   iter_approx = real_approximation.begin();
+			typename Vector1::iterator  iter_num    = num.begin();
+			typename Vector::iterator   iter_denom  = denominator.begin();
+
+			//numbound=denbound;
+			Integer neg_approx, abs_approx;
+			int idx_last_den=0;
+
+			for (size_t i=0; iter_approx != real_approximation.end(); ++iter_approx, ++ iter_num, ++iter_denom, ++i){
+				//_r.mulin( *iter_approx , common_den_mod_prod);
+				_r.mulin( *iter_approx , common_den);
+				_r.remin( *iter_approx , modulus);
+				_r. sub (neg_approx, *iter_approx, modulus);
+				_r. abs (abs_approx, neg_approx);
+
+				if ( _r.compare(*iter_approx, numbound) < 0){
+					_r.assign(*iter_num, *iter_approx);
+					_r.init(*iter_denom, 1);
+				}
+				else if (_r.compare(abs_approx, numbound) <0){
+					_r.assign(*iter_num, neg_approx);
+					_r.init(*iter_denom, 1);
+				}
+				else {
+					if  (!_r.reconstructRational(*iter_num, *iter_denom, *iter_approx, modulus, numbound, denbound))
+					{
+						std::cout << "ERROR in reconstruction ? (3)\n" << std::endl;
 #ifdef DEBUG_RR
 						std::cout<<" try to reconstruct :\n";
 						std::cout<<"approximation: "<<*iter_approx<<std::endl;
@@ -906,1039 +954,1233 @@ public:
 						std::cout<<"denbound: "<<denbound<<std::endl;
 #endif
 						return false;
-					}			
-			
-				_r.mulin(common_den, *iter_denom);
-				idx_last_den=(int)i;
-				counter++;
-				/*
-				if (i != size-1){
-					//if (! _r.isUnit(*iter_denom)) {counter++;
-
-					_r.quoin(denbound , *iter_denom);
-					_r.mul(bound, denbound,numbound);
-					_r.mulin(bound,two);
-					_r.div(tmp,modulus,prime);
-					while(tmp > bound) {
-						_r.assign(modulus,tmp);
+					}
+
+					_r.mulin(common_den, *iter_denom);
+					idx_last_den=(int)i;
+					counter++;
+#if 0
+					if (i != size-1)
+					{
+						//if (! _r.isUnit(*iter_denom))
+						counter++;
+
+						_r.quoin(denbound , *iter_denom);
+						_r.mul(bound, denbound,numbound);
+						_r.mulin(bound,two);
 						_r.div(tmp,modulus,prime);
+						while(tmp > bound) {
+							_r.assign(modulus,tmp);
+							_r.div(tmp,modulus,prime);
+						}
+						_r.rem(tmp , *iter_denom , modulus);
+						_r.remin(common_den_mod_prod , modulus);
+						_r.mulin(common_den_mod_prod , tmp);
+						_r.remin(common_den_mod_prod , modulus);
 					}
-					_r.rem(tmp , *iter_denom , modulus);
-					_r.remin(common_den_mod_prod , modulus);
-					_r.mulin(common_den_mod_prod , tmp);
-					_r.remin(common_den_mod_prod , modulus);
+#endif
+
 				}
-				*/
-				
+
 			}
-			
-		}
-		
-		_r.init(tmp,1);
-		for (int i= idx_last_den ; i>=0;--i){
-			_r.mulin(num[i],tmp);
-			_r.mulin(tmp,denominator[i]);
-		}
-			
-
-		/*
-		typename Vector1::reverse_iterator rev_iter_num   = num.rbegin();
-		typename Vector::reverse_iterator  rev_iter_denom = denominator.rbegin();
-		_r.init(tmp,1);
-		for (; rev_iter_num != num.rend(); ++rev_iter_num, ++rev_iter_denom){
-		
-			_r.mulin(*rev_iter_num,tmp);
-			_r.mulin(tmp, *rev_iter_denom);
-		}
-		*/
-		den = common_den;
-		
-		ratrecon.stop();
-		//std::cout<<"partial rational reconstruction : "<<ratrecon.usertime()<<std::endl;
-#ifdef RSTIMING
-		tRecon.stop();
-		ttRecon += tRecon;
-		_num_rec=counter;
-#endif
-		
-		return true;
 
-	} // end of getRational3
+			_r.init(tmp,1);
+			for (int i= idx_last_den ; i>=0;--i){
+				_r.mulin(num[i],tmp);
+				_r.mulin(tmp,denominator[i]);
+			}
 
 
+#if 0
+			typename Vector1::reverse_iterator rev_iter_num   = num.rbegin();
+			typename Vector::reverse_iterator  rev_iter_denom = denominator.rbegin();
+			_r.init(tmp,1);
+			for (; rev_iter_num != num.rend(); ++rev_iter_num, ++rev_iter_denom){
 
-#ifdef __LINBOX_HAVE_NTL
-	/* 
-	 * Rational reconstruction using Lattice base reduction	 
-	 */
-	template<class Vector1>
-	bool getRational4(Vector1& num, Integer& den, size_t thresh) const { 
+				_r.mulin(*rev_iter_num,tmp);
+				_r.mulin(tmp, *rev_iter_denom);
+			}
+#endif
+			den = common_den;
 
+			ratrecon.stop();
+			//std::cout<<"partial rational reconstruction : "<<ratrecon.usertime()<<std::endl;
 #ifdef RSTIMING
-		ttRecon.clear();
-		tRecon.start();
-#endif
-	
-		linbox_check(num.size() == (size_t)_lcontainer.size());
-		
-		// prime 
-		Integer prime = _lcontainer.prime();
-		
-		// length of whole approximation
-		size_t length=_lcontainer.length();
-		
-		// size of the solution
-		size_t size= _lcontainer.size();
-
-		// numerator  upper bound
-		Integer numbound;
-		_r.assign(numbound,_lcontainer.numbound());
-		 
-		// parameter used for the lattice dimension
-		size_t k = (5> size)? size:5 ;
-
-		// number of padic steps to perform first (use of LinBox::integer)
-		LinBox::integer N,D, bound, mod;
-		_r.convert(N, _lcontainer.numbound());
-		_r.convert(D, _lcontainer.denbound());
-		_r.convert(mod, prime);
-		::root (D, D, k); D+=1;
-		bound=2*N*D;
-		std::cout<<"size in bit of the bound : "<<bound.bitsize()<<std::endl;
-		size_t minsteps = logp(bound, mod)+1;
-
-		Timer magn;
-		magn.start();
-		// magnitude of A and b
-		integer maxValue=0,value, MagnA, Magnb;
-		typename LiftingContainer::IMatrix::ConstRawIterator it = _lcontainer.getMatrix().rawBegin();
-		for (; it != _lcontainer.getMatrix().rawEnd(); ++it) {
-			_r.convert(value,*it);
-			if (value<0) value=-value;
-			if (value> maxValue)
-				maxValue= value;						    
-		}
-		MagnA=maxValue;
-
-		maxValue=0;
-		typename LiftingContainer::IVector::const_iterator it_b = _lcontainer.getVector().begin();
-		for (;it_b!= _lcontainer.getVector().end();++it_b){
-			_r.convert(value,*it_b);
-			if (value<0) value=-value;
-			if (value> maxValue)
-				maxValue= value;	
-		}
-		Magnb=maxValue;
-		magn.stop();
-		std::cout<<"magnitude time:                 "<<magn<<"\n";
-		
-		// some constants
-		Integer zero;
-		_r.init(zero,0);
-		Vector zero_digit(_lcontainer.size(),zero);	
-
-		// store approximation as a polynomial and evaluate by baby step giant step
-		std::vector<Vector>  digit_approximation(length,zero_digit); 
-
-		// store real approximation
-		Vector real_approximation(size,zero); 
-		Vector last_real_approximation;
-
-		// store modulus (intially set to 1)
-		Integer modulus, last_modulus;
-		_r.init(modulus, 1);
-		
-		typename LiftingContainer::const_iterator iter = _lcontainer.begin();
-
-		
-		size_t moresteps    = thresh;
-		size_t startingsteps =0;
-		size_t endingsteps  =minsteps;
-
-		// switchers
-		bool latticeOK=false, numeratorOK=false, domoresteps=true, domorelattice=true;
-			
-		// common denominator
-		Integer common_denom;
-		_r.init(common_denom,1);
-
-		// bad numerator index
-		size_t bad_num_index=0;		
-
-
-		bool neg_denom=false;
+			tRecon.stop();
+			ttRecon += tRecon;
+			_num_rec=counter;
+#endif
 
-#ifdef RSTIMING
-		tRecon.stop();
-		ttRecon += tRecon;	
-		std::cout<<"\ninitialization time :           "<<tRecon<<"\n";
-#endif	
-		
-
-
-
-		do {// main loop
-			
-			// keep track on the last power of the approximation
-			_r.assign(last_modulus,modulus);
-			
-			if (domoresteps){
-			
-				// compute the padic digits
-				for (size_t i = startingsteps ;  (i< endingsteps) && (iter.next(digit_approximation[i]));++i) {
-					_r.mulin(modulus,prime); 
-				}
-					
-			
-#ifdef RSTIMING
-				tRecon.clear();
+			return true;
+
+		} // end of getRational3
+
+		/*!
+		 * early terminated analog of getRational3.
+		 */
+		template<class Vector1>
+		bool getRationalET(Vector1& num, Integer& den, const Integer& den_app =1) const
+		{
+			//cout << "ET p ading lifting using ClassicMaxQRationalReconstruction by default or given RReconstruction\n";
+#ifdef RSTIMING
+			ttRecon.clear();
+			tRecon.start();
+			_num_rec = 0;
+#endif
+
+			linbox_check(num.size() == (size_t)_lcontainer.size());
+
+			Integer init_den = den_app;
+			if (den > 0) lcm(init_den,den,den_app);
+			_r. init (den, 1);
+#ifdef DEBUG_RR
+			cout << "debug: den " << den;
+#endif
+			Integer prime = _lcontainer.prime();                    // prime used for lifting
+			Vector digit(_lcontainer.size());                       // to store next digit
+			Integer modulus;                                        // store modulus (power of prime)
+			Integer prev_modulus;                                   // store previous modulus
+			_r.init(modulus, 0);
+			std::vector<Integer> zz(_lcontainer.size(), modulus);   // stores each truncated p-adic approximation
+			_r.init(modulus, 1);
+
+			size_t len = _lcontainer.length(); // should be ceil(log(2*numbound*denbound)/log(prime))
+#ifdef DEBUG_RR
+			std::cout << "nbound, dbound:" << _lcontainer.numbound() << ",  " << _lcontainer.denbound() << std::endl;
+#endif
+
+			typename Vector::iterator num_p;
+			typename std::vector<Integer>::iterator zz_p;
+			typename Vector::iterator digit_p;
+
+			size_t i = 0;
+			typename LiftingContainer::const_iterator iter = _lcontainer.begin();
+
+			bool gotAll = false; //set to true if all values are reconstructed on a particular step
+			bool terminated = false; // set to true if same values are reconstructed and confirmed (reconstructed twice)
+#ifdef RSTIMING
+			long counter=0;//counts number of RR
+#endif
+			// do until getting all answera
+			while ((i < len) && (!terminated)) {
+				++ i;
+#ifdef DEBUG_RR
+				std::cout<<"i: "<<i<<std::endl;
+#endif
+#ifdef RSTIMING
+				tRecon.stop();
+				ttRecon += tRecon;
+				_num_rec +=counter;
+				counter = 0;
+#endif
+				// get next p-adic digit
+				bool nextResult = iter.next(digit);
+				if (!nextResult) {
+					std::cout << "ERROR in lifting container. Are you using <double> ring with large norm? (ET)" << std::endl;
+					return false;
+				}
+#ifdef RSTIMING
 				tRecon.start();
 #endif
-				// evaluate the padic digit into an integer approximation	
-				Integer xeval=prime;
-				typename std::vector<Vector>::const_iterator poly_digit= digit_approximation.begin()+startingsteps;
-				PolEval(real_approximation, poly_digit, endingsteps - startingsteps, xeval);				
-								
-				if (startingsteps != 0){
-					for (size_t i=0;i<size;++i){
-						_r.axpyin(last_real_approximation[i],real_approximation[i], last_modulus); 
+				// preserve the old modulus
+				_r.assign (prev_modulus, modulus);
+
+				// upate _modulus *= _prime
+				_r.mulin (modulus,  prime);
+
+				// update truncated p-adic approximation
+				for ( digit_p = digit.begin(), zz_p = zz.begin(); digit_p != digit.end(); ++ digit_p, ++ zz_p)
+					_r.axpyin(*zz_p, prev_modulus, *digit_p);
+#ifdef DEBUG_RR
+				std::cout<<"approximation mod p^"<<i<<" : \n";
+				std::cout<<"[";
+				for (size_t j=0;j< zz.size( )-1;j++)
+					std::cout<<zz[j]<<",";
+				std::cout<<zz.back()<<"]\n";
+				std::cout<<"digit:\n";
+				for (size_t j=0;j< digit.size();++j)
+					std::cout<<digit[j]<<",";
+				std::cout<<std::endl;
+#endif
+				if ((!gotAll) && (i % _threshold != 0) && (i + _threshold < len)) continue;
+				if ((!gotAll) && (!RR.scheduled(i-1)) && (i + _threshold < len)) continue;
+
+				if (gotAll) {
+					terminated = true;
+					for ( zz_p = zz.begin(), num_p = num.begin(); zz_p != zz.end();  ++ zz_p, ++ num_p) {
+						Integer a = *num_p;
+						Integer bx= *zz_p; _r. mulin (bx, den); _r. remin(bx, modulus);
+						Integer _bx = bx-modulus;
+						if (!_r.areEqual(a,bx) && !_r.areEqual(a,_bx)) {
+							terminated = false;
+							break;
+						}
 					}
-					real_approximation=last_real_approximation;
+					if (terminated) break;
 				}
-				else 
-					last_real_approximation = real_approximation;	
-#ifdef RSTIMING
-		tRecon.stop();
-		ttRecon += tRecon;		
-		std::cout<<"evaluation time :               "<<tRecon<<"\n";
-#endif	
-			}
+
+				gotAll = true;
+				_r. assign (den, init_den);
+				for ( zz_p = zz.begin(), num_p = num.begin();
+				      zz_p != zz.end();  ++ zz_p, ++ num_p) {
+
+					Integer tmp_den=0;
+					Integer zz_p_den (*zz_p);
+					_r. mulin (zz_p_den,den);
+					_r. remin (zz_p_den,modulus);
+					bool tmp = RR.reconstructRational(*num_p, tmp_den, zz_p_den, modulus);
 #ifdef RSTIMING
-			tRecon.clear();
-			tRecon.start();
-#endif	
-		
-			
-			// construct the lattice
-			NTL::mat_ZZ Lattice;
-			NTL::ZZ m, tmp, det;
-			integer tmp_int;
-			_r.convert(mod, modulus);
-			m=NTL::to_ZZ((std::string(mod)).c_str());
-			
-
-			Lattice.SetDims(k+1, k+1);
-			NTL::clear(Lattice);
-			Lattice[0][0]=1;
-			for (size_t i= bad_num_index+1;i< bad_num_index+k+1;++i){
-				Lattice[i][i]=m;//not working when bad index <> 0
-				_r.convert(tmp_int, real_approximation[i-1]);
-				tmp=NTL::to_ZZ((std::string(tmp_int)).c_str());
-				Lattice[0][i]=tmp;//not working when bad index <> 0
-			}
-		
-			// ratio to check the validity of the denominator compare to the entries in the reduced lattice
-			NTL::ZZ ratio;
-			ratio=NTL::to_ZZ(100L);
-			
-			// reduce the lattice using LLL algorithm
-			Timer chrono;
-			chrono.start();
-			//NTL::LLL(det, Lattice);
-			NTL::LLL_XD(Lattice);
-			chrono.stop();
-			std::cout<<"lattice reduction time :        "<<chrono<<std::endl;
-
-		
-			// check if the 1st row is the short vector
-			latticeOK=true;
-			tmp=abs(Lattice[0][0])*ratio;	
-			for (size_t i=1;i<k+1;++i){
-				for (size_t j=0;j<k+1;++j)
-					if (tmp > abs(Lattice[i][j])){
-						latticeOK=false;
-						break;
+					++counter;
+#endif
+					if (tmp) {
+						linbox_check (!_r.isZero(tmp_den));
+						if (! _r. isOne (tmp_den)) {
+							_r. mulin (den, tmp_den);
+							for (typename Vector::iterator tmp_p = num. begin (); tmp_p != num_p; ++ tmp_p)
+								_r. mulin (*tmp_p, tmp_den);
+						}
 					}
-			}
-		
-			
-			
-
-			if (latticeOK) {// lattice ok
-				Timer  checknum;
-				checknum.start();
-				bool neg=false;
-				// get the denominator from the lattice
-				tmp =Lattice[0][0];
-				if (sign(tmp) <0) neg=true;
-				long b = NumBytes(tmp);
-				unsigned char* byteArray;
-				byteArray = new unsigned char[(size_t)b ];
-				BytesFromZZ(byteArray, tmp, b);
-				integer base(256);
-				integer dd= integer(0);	    
-				for(long i = b - 1; i >= 0; --i) {
-					dd *= base;
-					dd += integer(byteArray[i]);
-				}
-				delete [] byteArray;
-				Integer denom;
-				_r.init(denom,dd);
-				if (neg) _r.negin(denom);							
-
-				neg_denom= neg_denom^neg;
-
-				// compute the lcm of the denomintator and the last denominator
-				_r.lcmin(common_denom, denom);				
-
-				Integer neg_approx, abs_approx;
-				
-				numeratorOK=true;
-				// compute the numerators and check their validity according to the numerator  bound
-				for (size_t i=0;i<size;++i){
-					_r.mulin(real_approximation[i], denom);
-					_r.remin(real_approximation[i], modulus);
-					_r. sub (neg_approx, real_approximation[i], modulus);
-					_r. abs (abs_approx, neg_approx);
-
-					if ( _r.compare(real_approximation[i], numbound) < 0)
-						_r.assign(num[i], real_approximation[i]);									
-					else if (_r.compare(abs_approx, numbound) <0)
-						_r.assign(num[i], neg_approx);		
 					else {
-						bad_num_index= std::min(i, size-k);
-						numeratorOK=false;
+						gotAll = false;
 						break;
 					}
 				}
-				checknum.stop();
-				std::cout<<"checking numerator time :       "<<checknum<<"\n";
-
-				if (numeratorOK) {//numerator ok					
-					Timer checksol;
-					checksol.start();
-					// compute the magnitude of the numerator
-					integer maxnum=0;
-					typename Vector::const_iterator it_num=num.begin();
-					for (; it_num != num.end(); ++it_num) {
-						_r.convert(value,*it_num);
-						if (value<0) value=-value;
-						if (value> maxnum)
-							maxnum= value;						    
+			}
+
+			// if last iteration - reconstruct the result using num and den bounds
+			if (i == len) {
+				den = 1;
+				for ( zz_p = zz.begin(), num_p = num.begin();
+				      zz_p != zz.end(); ++ zz_p, ++ num_p) {
+
+					Integer tmp_den;
+					Integer zz_p_den (*zz_p);
+					_r. mulin (zz_p_den,den);
+					_r. remin (zz_p_den,modulus);
+
+					bool tmp = RR.reconstructRational(*num_p, tmp_den, zz_p_den, modulus, _lcontainer.numbound(), _lcontainer.denbound());
+#ifdef RSTIMING
+					++counter;
+#endif
+					if (tmp) {
+						linbox_check (!_r.isZero(tmp_den));
+						if (! _r. isOne (tmp_den)) {
+							_r. mulin (den, tmp_den);
+							for (typename Vector::iterator tmp_p = num. begin (); tmp_p != num_p; ++ tmp_p)
+								_r. mulin (*tmp_p, tmp_den);
+						}
+					}
+					else {
+						std::cout << "ERROR in reconstruction ? (ET)\n" << std::flush;
 					}
-				
-					// check the validity of the solution according to n.||A||.||num||+ d.||b|| < modulus
-					integer check= size*MagnA*maxnum+dd*Magnb;
-					
-					checksol.stop();
-					std::cout<<"checking solution time :        "<<checksol<<"\n\n";
-					
-					domorelattice=false;
 
-					if (check < mod)
-						domoresteps=false;
-					else
-						domoresteps=true;
-			
-				}
-				else{
-					domorelattice=true;
-					domoresteps=false;
 				}
-				
-			} 
-			else{
-				std::cout<<"lattice failed\n";
-				domoresteps=true;
-				domorelattice=false;
-			}
-			
-			if (domoresteps) std::cout<<"do more steps\n";
-			if (domorelattice) std::cout<<"do more lattice\n";
-
-			startingsteps = endingsteps;
-			if (domoresteps){
-				bad_num_index=0;
-				endingsteps+= moresteps;
-				if (endingsteps>length)
-					endingsteps=length;
 			}
 #ifdef RSTIMING
 			tRecon.stop();
-			ttRecon += tRecon;		
+			ttRecon += tRecon;
+			_num_rec +=counter;
+			counter = 0;
 #endif
-		}
-		while (domoresteps||domorelattice);
-	
-#ifdef RSTIMING
-		tRecon.clear();
-		tRecon.start();
-#endif	
-		_r.assign(den, common_denom);
-		
-		if (neg_denom){
-			for (size_t i=0;i<size;++i)
-				_r.negin(num[i]);			
-		}
+#ifdef DEBUG_RR_BOUNDACCURACY
+			//std::cout << "Computed " << i << " digits out of estimated " << len << std::endl;
+#endif
+			Integer g;
+			Integer abs_num_p(0);
+			_r. init (g, 0);
+			_r. gcdin (g, den);
+			for (num_p = num. begin(); num_p != num. end(); ++ num_p) {
+				_r. gcdin (g, *num_p);
+			}
+
+			if (!_r. isOne (g) && !_r. isZero(g)) {
+				for (num_p = num. begin(); num_p != num. end(); ++ num_p)
+					_r. divin (*num_p, g);
+				_r. divin (den, g);
+			}
+			//std::cerr << "Computed num, den of size " << sizeN << ", " << sizeD << "\n By " << i << " digits out of estimated " << len << std::endl;
+			return true; //lifted ok, assuming size was correct
+
+		} // end of getRationalET
+
+
+#ifdef __LINBOX_HAVE_NTL
+		/*!
+		 * Rational reconstruction using Lattice base reduction
+		 */
+		template<class Vector1>
+		bool getRational4(Vector1& num, Integer& den, size_t thresh) const
+		{
+
 #ifdef RSTIMING
-		tRecon.stop();
-		ttRecon += tRecon;		
-#endif	
-		return true;
+			ttRecon.clear();
+			tRecon.start();
+#endif
+
+			linbox_check(num.size() == (size_t)_lcontainer.size());
+
+			// prime
+			Integer prime = _lcontainer.prime();
+
+			// length of whole approximation
+			size_t length=_lcontainer.length();
+
+			// size of the solution
+			size_t size= _lcontainer.size();
+
+			// numerator  upper bound
+			Integer numbound;
+			_r.assign(numbound,_lcontainer.numbound());
+
+			// parameter used for the lattice dimension
+			size_t k = (5> size)? size:5 ;
+
+			// number of padic steps to perform first (use of LinBox::integer)
+			LinBox::integer N,D, bound, mod;
+			_r.convert(N, _lcontainer.numbound());
+			_r.convert(D, _lcontainer.denbound());
+			_r.convert(mod, prime);
+			::Givaro::root (D, D, k); D+=1;
+			bound=2*N*D;
+			std::cout<<"size in bit of the bound : "<<bound.bitsize()<<std::endl;
+			size_t minsteps = logp(bound, mod)+1;
+
+			Timer magn;
+			magn.start();
+			// magnitude of A and b
+			integer maxValue=0,value, MagnA, Magnb;
+			typename LiftingContainer::IMatrix::ConstRawIterator it = _lcontainer.getMatrix().rawBegin();
+			for (; it != _lcontainer.getMatrix().rawEnd(); ++it) {
+				_r.convert(value,*it);
+				if (value<0) value=-value;
+				if (value> maxValue)
+					maxValue= value;
+			}
+			MagnA=maxValue;
+
+			maxValue=0;
+			typename LiftingContainer::IVector::const_iterator it_b = _lcontainer.getVector().begin();
+			for (;it_b!= _lcontainer.getVector().end();++it_b){
+				_r.convert(value,*it_b);
+				if (value<0) value=-value;
+				if (value> maxValue)
+					maxValue= value;
+			}
+			Magnb=maxValue;
+			magn.stop();
+			std::cout<<"magnitude time:                 "<<magn<<"\n";
+
+			// some constants
+			Integer zero;
+			_r.init(zero,0);
+			Vector zero_digit(_lcontainer.size(),zero);
 
-	} // end of getRational4
+			// store approximation as a polynomial and evaluate by baby step giant step
+			std::vector<Vector>  digit_approximation(length,zero_digit);
 
-#endif // end of __LINBOX_HAVE_NTL	
+			// store real approximation
+			Vector real_approximation(size,zero);
+			Vector last_real_approximation;
 
+			// store modulus (intially set to 1)
+			Integer modulus, last_modulus;
+			_r.init(modulus, 1);
 
+			typename LiftingContainer::const_iterator iter = _lcontainer.begin();
 
 
+			size_t moresteps    = thresh;
+			size_t startingsteps =0;
+			size_t endingsteps  =minsteps;
 
-#ifdef __LINBOX_HAVE_FPLLL
+			// switchers
+			bool latticeOK=false, numeratorOK=false, domoresteps=true, domorelattice=true;
+
+			// common denominator
+			Integer common_denom;
+			_r.init(common_denom,1);
+
+			// bad numerator index
+			size_t bad_num_index=0;
 
-	/* 
-	 * Rational reconstruction using Lattice base reduction	 
-	 */
-	template<class Vector1>
-	bool getRational5(Vector1& num, Integer& den, size_t thresh) const { 
+
+			bool neg_denom=false;
 
 #ifdef RSTIMING
-		ttRecon.clear();
-		tRecon.start();
-#endif
-	
-		linbox_check(num.size() == (size_t)_lcontainer.size());
-		
-		// prime 
-		Integer prime = _lcontainer.prime();
-		
-		// length of whole approximation
-		size_t length=_lcontainer.length();
-		
-		// size of the solution
-		size_t size= _lcontainer.size();
-
-		// numerator  upper bound
-		Integer numbound;
-		_r.assign(numbound,_lcontainer.numbound());
-		 
-		// parameter used for the lattice dimension
-		size_t k = (2> size)? size:2 ;
-
-		// number of padic steps to perform first (use of LinBox::integer)
-		LinBox::integer N,D, bound, mod;
-		_r.convert(N, _lcontainer.numbound());
-		_r.convert(D, _lcontainer.denbound());
-		_r.convert(mod, prime);
-		::root (D, D, k); D+=1;
-		bound=2*N*D;
-		std::cout<<"size in bit of the bound : "<<bound.bitsize()<<std::endl;
-		size_t minsteps = logp(bound, mod)+1;
-
-		Timer magn;
-		magn.start();
-		// magnitude of A and b
-		integer maxValue=0,value, MagnA, Magnb;
-		typename LiftingContainer::IMatrix::ConstRawIterator it = _lcontainer.getMatrix().rawBegin();
-		for (; it != _lcontainer.getMatrix().rawEnd(); ++it) {
-			_r.convert(value,*it);
-			if (value<0) value=-value;
-			if (value> maxValue)
-				maxValue= value;						    
-		}
-		MagnA=maxValue;
-
-		maxValue=0;
-		typename LiftingContainer::IVector::const_iterator it_b = _lcontainer.getVector().begin();
-		for (;it_b!= _lcontainer.getVector().end();++it_b){
-			_r.convert(value,*it_b);
-			if (value<0) value=-value;
-			if (value> maxValue)
-				maxValue= value;	
-		}
-		Magnb=maxValue;
-		magn.stop();
-		std::cout<<"magnitude time:                 "<<magn<<"\n";
-		
-		// some constants
-		Integer zero;
-		_r.init(zero,0);
-		Vector zero_digit(_lcontainer.size(),zero);	
-
-		// store approximation as a polynomial and evaluate by baby step giant step
-		std::vector<Vector>  digit_approximation(length,zero_digit); 
-
-		// store real approximation
-		Vector real_approximation(size,zero); 
-		Vector last_real_approximation;
-
-		// store modulus (intially set to 1)
-		Integer modulus, last_modulus;
-		_r.init(modulus, 1);
-		
-		typename LiftingContainer::const_iterator iter = _lcontainer.begin();
-
-		
-		size_t moresteps    = thresh;
-		size_t startingsteps =0;
-		size_t endingsteps  =minsteps;
-
-		// switchers
-		bool latticeOK=false, numeratorOK=false, domoresteps=true, domorelattice=true;
-			
-		// common denominator
-		Integer common_denom;
-		_r.init(common_denom,1);
-
-		// bad numerator index
-		size_t bad_num_index=0;		
-
-
-		bool neg_denom=false;
+			tRecon.stop();
+			ttRecon += tRecon;
+			std::cout<<"\ninitialization time :           "<<tRecon<<"\n";
+#endif
+
+
+
+
+			do {// main loop
+
+				// keep track on the last power of the approximation
+				_r.assign(last_modulus,modulus);
+
+				if (domoresteps){
 
+					// compute the padic digits
+					for (size_t i = startingsteps ;  (i< endingsteps) && (iter.next(digit_approximation[i]));++i) {
+						_r.mulin(modulus,prime);
+					}
+
+
+#ifdef RSTIMING
+					tRecon.clear();
+					tRecon.start();
+#endif
+					// evaluate the padic digit into an integer approximation
+					Integer xeval=prime;
+					typename std::vector<Vector>::const_iterator poly_digit= digit_approximation.begin()+startingsteps;
+					PolEval(real_approximation, poly_digit, endingsteps - startingsteps, xeval);
+
+					if (startingsteps != 0){
+						for (size_t i=0;i<size;++i){
+							_r.axpyin(last_real_approximation[i],real_approximation[i], last_modulus);
+						}
+						real_approximation=last_real_approximation;
+					}
+					else
+						last_real_approximation = real_approximation;
 #ifdef RSTIMING
-		tRecon.stop();
-		ttRecon += tRecon;	
-		std::cout<<"\ninitialization time :           "<<tRecon<<"\n";
-#endif	
-		
-
-
-
-		do {// main loop
-			
-			// keep track on the last power of the approximation
-			_r.assign(last_modulus,modulus);
-			
-			if (domoresteps){
-			
-				linbox_check(startingsteps != endingsteps);
-				
-				// compute the padic digits
-				for (size_t i = startingsteps ;  (i< endingsteps) && (iter.next(digit_approximation[i]));++i) {
-					_r.mulin(modulus,prime); 
+					tRecon.stop();
+					ttRecon += tRecon;
+					std::cout<<"evaluation time :               "<<tRecon<<"\n";
+#endif
 				}
-					
-			
 #ifdef RSTIMING
 				tRecon.clear();
 				tRecon.start();
 #endif
-				// evaluate the padic digit into an integer approximation	
-				Integer xeval=prime;
-				typename std::vector<Vector>::const_iterator poly_digit= digit_approximation.begin()+startingsteps;
-				PolEval(real_approximation, poly_digit, endingsteps - startingsteps, xeval);				
-								
-				if (startingsteps != 0){
+
+
+				// construct the lattice
+				NTL::mat_ZZ Lattice;
+				NTL::ZZ m, tmp, det;
+				integer tmp_int;
+				_r.convert(mod, modulus);
+				m=NTL::to_ZZ((std::string(mod)).c_str());
+
+
+				Lattice.SetDims(k+1, k+1);
+				NTL::clear(Lattice);
+				Lattice[0][0]=1;
+				for (size_t i= bad_num_index+1;i< bad_num_index+k+1;++i){
+					Lattice[i][i]=m;//not working when bad index <> 0
+					_r.convert(tmp_int, real_approximation[i-1]);
+					tmp=NTL::to_ZZ((std::string(tmp_int)).c_str());
+					Lattice[0][i]=tmp;//not working when bad index <> 0
+				}
+
+				// ratio to check the validity of the denominator compare to the entries in the reduced lattice
+				NTL::ZZ ratio;
+				ratio=NTL::to_ZZ(100L);
+
+				// reduce the lattice using LLL algorithm
+				Timer chrono;
+				chrono.start();
+				//NTL::LLL(det, Lattice);
+				NTL::LLL_XD(Lattice);
+				chrono.stop();
+				std::cout<<"lattice reduction time :        "<<chrono<<std::endl;
+
+
+				// check if the 1st row is the short vector
+				latticeOK=true;
+				tmp=abs(Lattice[0][0])*ratio;
+				for (size_t i=1;i<k+1;++i){
+					for (size_t j=0;j<k+1;++j)
+						if (tmp > abs(Lattice[i][j])){
+							latticeOK=false;
+							break;
+						}
+				}
+
+
+
+
+				if (latticeOK) {// lattice ok
+					Timer  checknum;
+					checknum.start();
+					bool neg=false;
+					// get the denominator from the lattice
+					tmp =Lattice[0][0];
+					if (sign(tmp) <0) neg=true;
+					long b = NumBytes(tmp);
+					unsigned char* byteArray;
+					byteArray = new unsigned char[(size_t)b ];
+					BytesFromZZ(byteArray, tmp, b);
+					integer base(256);
+					integer dd= integer(0);
+					for(long i = b - 1; i >= 0; --i) {
+						dd *= base;
+						dd += integer(byteArray[i]);
+					}
+					delete [] byteArray;
+					Integer denom;
+					_r.init(denom,dd);
+					if (neg) _r.negin(denom);
+
+					neg_denom= neg_denom^neg;
+
+					// compute the lcm of the denomintator and the last denominator
+					_r.lcmin(common_denom, denom);
+
+					Integer neg_approx, abs_approx;
+
+					numeratorOK=true;
+					// compute the numerators and check their validity according to the numerator  bound
 					for (size_t i=0;i<size;++i){
-						_r.axpyin(last_real_approximation[i],real_approximation[i], last_modulus); 
+						_r.mulin(real_approximation[i], denom);
+						_r.remin(real_approximation[i], modulus);
+						_r. sub (neg_approx, real_approximation[i], modulus);
+						_r. abs (abs_approx, neg_approx);
+
+						if ( _r.compare(real_approximation[i], numbound) < 0)
+							_r.assign(num[i], real_approximation[i]);
+						else if (_r.compare(abs_approx, numbound) <0)
+							_r.assign(num[i], neg_approx);
+						else {
+							bad_num_index= std::min(i, size-k);
+							numeratorOK=false;
+							break;
+						}
+					}
+					checknum.stop();
+					std::cout<<"checking numerator time :       "<<checknum<<"\n";
+
+					if (numeratorOK) {//numerator ok
+						Timer checksol;
+						checksol.start();
+						// compute the magnitude of the numerator
+						integer maxnum=0;
+						typename Vector::const_iterator it_num=num.begin();
+						for (; it_num != num.end(); ++it_num) {
+							_r.convert(value,*it_num);
+							if (value<0) value=-value;
+							if (value> maxnum)
+								maxnum= value;
+						}
+
+						// check the validity of the solution according to n.||A||.||num||+ d.||b|| < modulus
+						integer check= size*MagnA*maxnum+dd*Magnb;
+
+						checksol.stop();
+						std::cout<<"checking solution time :        "<<checksol<<"\n\n";
+
+						domorelattice=false;
+
+						if (check < mod)
+							domoresteps=false;
+						else
+							domoresteps=true;
+
 					}
-					real_approximation=last_real_approximation;
+					else{
+						domorelattice=true;
+						domoresteps=false;
+					}
+
+				}
+				else{
+					std::cout<<"lattice failed\n";
+					domoresteps=true;
+					domorelattice=false;
+				}
+
+				if (domoresteps) std::cout<<"do more steps\n";
+				if (domorelattice) std::cout<<"do more lattice\n";
+
+				startingsteps = endingsteps;
+				if (domoresteps){
+					bad_num_index=0;
+					endingsteps+= moresteps;
+					if (endingsteps>length)
+						endingsteps=length;
 				}
-				else 
-					last_real_approximation = real_approximation;	
 #ifdef RSTIMING
-		tRecon.stop();
-		ttRecon += tRecon;		
-		std::cout<<"evaluation time :               "<<tRecon<<"\n";
-#endif	
+				tRecon.stop();
+				ttRecon += tRecon;
+#endif
 			}
+			while (domoresteps||domorelattice);
+
 #ifdef RSTIMING
 			tRecon.clear();
 			tRecon.start();
-#endif	
-		
-			
-			// construct the lattice
-			mpz_t **Lattice;
-			Lattice= new mpz_t*[k+2];
-			for (size_t i=0;i<k+2;++i){
-				Lattice[i]= new mpz_t[k+2];
-				for (size_t j=0;j<k+2;++j)
-					mpz_init(Lattice[i][j]);
-			}
-			
-			integer tmp=1;
-			_r.convert(mod, modulus);
-					       
-			mpz_set(Lattice[1][1], tmp.get_mpz());
-			for (size_t i=2;i< k+2;++i){
-				mpz_set(Lattice[i][i],mod.get_mpz());
-				_r.convert(tmp, real_approximation[bad_num_index+i-2]);
-				mpz_set(Lattice[1][i],tmp.get_mpz());
+#endif
+			_r.assign(den, common_denom);
+
+			if (neg_denom){
+				for (size_t i=0;i<size;++i)
+					_r.negin(num[i]);
 			}
-		
-			// ratio to check the validity of the denominator compare to the entries in the reduced lattice
-			integer ratio;
-			ratio=100L;
-			
-			// reduce the lattice using LLL algorithm
-			Timer chrono;
-			chrono.start();
-			myLLLproved(Lattice, k+1,k+1);
-			chrono.stop();
-			std::cout<<"lattice reduction time :        "<<chrono<<std::endl;
-
-		
-			// check if the 1st row is the short vector
-			latticeOK=true;
-			mpz_mul(tmp.get_mpz(), Lattice[1][1],ratio.get_mpz());	
-			for (size_t i=2;i<k+2;++i){
-				for (size_t j=1;j<k+2;++j)
-					if (mpz_cmpabs(tmp.get_mpz() , Lattice[i][j])> 0){
-						latticeOK=false;
-						break;
-					}
+#ifdef RSTIMING
+			tRecon.stop();
+			ttRecon += tRecon;
+#endif
+			return true;
+
+		} // end of getRational4
+
+#endif // end of __LINBOX_HAVE_NTL
+
+
+
+
+
+#ifdef __LINBOX_HAVE_FPLLL
+
+		/*!
+		 * Rational reconstruction using Lattice base reduction
+		 */
+		template<class Vector1>
+		bool getRational5(Vector1& num, Integer& den, size_t thresh) const
+		{
+
+#ifdef RSTIMING
+			ttRecon.clear();
+			tRecon.start();
+#endif
+
+			linbox_check(num.size() == (size_t)_lcontainer.size());
+
+			// prime
+			Integer prime = _lcontainer.prime();
+
+			// length of whole approximation
+			size_t length=_lcontainer.length();
+
+			// size of the solution
+			size_t size= _lcontainer.size();
+
+			// numerator  upper bound
+			Integer numbound;
+			_r.assign(numbound,_lcontainer.numbound());
+
+			// parameter used for the lattice dimension
+			size_t k = (2> size)? size:2 ;
+
+			// number of padic steps to perform first (use of LinBox::integer)
+			LinBox::integer N,D, bound, mod;
+			_r.convert(N, _lcontainer.numbound());
+			_r.convert(D, _lcontainer.denbound());
+			_r.convert(mod, prime);
+			::Givaro::root (D, D, k); D+=1;
+			bound=2*N*D;
+			std::cout<<"size in bit of the bound : "<<bound.bitsize()<<std::endl;
+			size_t minsteps = logp(bound, mod)+1;
+
+			Timer magn;
+			magn.start();
+			// magnitude of A and b
+			integer maxValue=0,value, MagnA, Magnb;
+			typename LiftingContainer::IMatrix::ConstRawIterator it = _lcontainer.getMatrix().rawBegin();
+			for (; it != _lcontainer.getMatrix().rawEnd(); ++it) {
+				_r.convert(value,*it);
+				if (value<0) value=-value;
+				if (value> maxValue)
+					maxValue= value;
 			}
-		
-			integer dd;
-			// get the denominator from the lattice
-			mpz_set(dd.get_mpz(),Lattice[1][1]);
-			
-			//delete the lattice
-			for (size_t i=0;i<k+2;++i){
-				for (size_t j=0;j<k+2;++j)
-					mpz_clear(Lattice[i][j]);
-				delete[] Lattice[i];
+			MagnA=maxValue;
+
+			maxValue=0;
+			typename LiftingContainer::IVector::const_iterator it_b = _lcontainer.getVector().begin();
+			for (;it_b!= _lcontainer.getVector().end();++it_b){
+				_r.convert(value,*it_b);
+				if (value<0) value=-value;
+				if (value> maxValue)
+					maxValue= value;
 			}
-			delete[] Lattice;
-
-
-			if (latticeOK) {// lattice ok
-				Timer  checknum;
-				checknum.start();
-			
-
-				Integer denom;
-				_r.init(denom,tmp);
-				
-				bool neg=true;
-				if (dd < 0){
-					neg=true;std::cout<<"negative det\n";}
-				
-				neg_denom= neg_denom^neg;
-
-				// compute the lcm of the denomintator and the last denominator
-				_r.lcmin(common_denom, denom);				
-
-				Integer neg_approx, abs_approx;
-				
-				numeratorOK=true;
-				// compute the numerators and check their validity according to the numerator  bound
-				for (size_t i=0;i<size;++i){
-					_r.mulin(real_approximation[i], common_denom);
-					_r.remin(real_approximation[i], modulus);
-					_r. sub (neg_approx, real_approximation[i], modulus);
-					_r. abs (abs_approx, neg_approx);
-
-					if ( _r.compare(real_approximation[i], numbound) < 0)
-						_r.assign(num[i], real_approximation[i]);									
-					else if (_r.compare(abs_approx, numbound) <0)
-						_r.assign(num[i], neg_approx);		
-					else {
-						bad_num_index= std::min(i, size-k);
-						numeratorOK=false;
-						break;
+			Magnb=maxValue;
+			magn.stop();
+			std::cout<<"magnitude time:                 "<<magn<<"\n";
+
+			// some constants
+			Integer zero;
+			_r.init(zero,0);
+			Vector zero_digit(_lcontainer.size(),zero);
+
+			// store approximation as a polynomial and evaluate by baby step giant step
+			std::vector<Vector>  digit_approximation(length,zero_digit);
+
+			// store real approximation
+			Vector real_approximation(size,zero);
+			Vector last_real_approximation;
+
+			// store modulus (intially set to 1)
+			Integer modulus, last_modulus;
+			_r.init(modulus, 1);
+
+			typename LiftingContainer::const_iterator iter = _lcontainer.begin();
+
+
+			size_t moresteps    = thresh;
+			size_t startingsteps =0;
+			size_t endingsteps  =minsteps;
+
+			// switchers
+			bool latticeOK=false, numeratorOK=false, domoresteps=true, domorelattice=true;
+
+			// common denominator
+			Integer common_denom;
+			_r.init(common_denom,1);
+
+			// bad numerator index
+			size_t bad_num_index=0;
+
+
+			bool neg_denom=false;
+
+#ifdef RSTIMING
+			tRecon.stop();
+			ttRecon += tRecon;
+			std::cout<<"\ninitialization time :           "<<tRecon<<"\n";
+#endif
+
+
+
+
+			do {// main loop
+
+				// keep track on the last power of the approximation
+				_r.assign(last_modulus,modulus);
+
+				if (domoresteps){
+
+					linbox_check(startingsteps != endingsteps);
+
+					// compute the padic digits
+					for (size_t i = startingsteps ;  (i< endingsteps) && (iter.next(digit_approximation[i]));++i) {
+						_r.mulin(modulus,prime);
+					}
+
+
+#ifdef RSTIMING
+					tRecon.clear();
+					tRecon.start();
+#endif
+					// evaluate the padic digit into an integer approximation
+					Integer xeval=prime;
+					typename std::vector<Vector>::const_iterator poly_digit= digit_approximation.begin()+startingsteps;
+					PolEval(real_approximation, poly_digit, endingsteps - startingsteps, xeval);
+
+					if (startingsteps != 0){
+						for (size_t i=0;i<size;++i){
+							_r.axpyin(last_real_approximation[i],real_approximation[i], last_modulus);
+						}
+						real_approximation=last_real_approximation;
 					}
+					else
+						last_real_approximation = real_approximation;
+#ifdef RSTIMING
+					tRecon.stop();
+					ttRecon += tRecon;
+					std::cout<<"evaluation time :               "<<tRecon<<"\n";
+#endif
+				}
+#ifdef RSTIMING
+				tRecon.clear();
+				tRecon.start();
+#endif
+
+
+				// construct the lattice
+				mpz_t **Lattice;
+				Lattice= new mpz_t*[k+2];
+				for (size_t i=0;i<k+2;++i){
+					Lattice[i]= new mpz_t[k+2];
+					for (size_t j=0;j<k+2;++j)
+						mpz_init(Lattice[i][j]);
+				}
+
+				integer tmp=1;
+				_r.convert(mod, modulus);
+
+				mpz_set(Lattice[1][1], tmp.get_mpz());
+				for (size_t i=2;i< k+2;++i){
+					mpz_set(Lattice[i][i],mod.get_mpz());
+					_r.convert(tmp, real_approximation[bad_num_index+i-2]);
+					mpz_set(Lattice[1][i],tmp.get_mpz());
 				}
-				checknum.stop();
-				std::cout<<"checking numerator time :       "<<checknum<<"\n";
-
-				if (numeratorOK) {//numerator ok					
-					Timer checksol;
-					checksol.start();
-					// compute the magnitude of the numerator
-					integer maxnum=0;
-					typename Vector::const_iterator it_num=num.begin();
-					for (; it_num != num.end(); ++it_num) {
-						_r.convert(value,*it_num);
-						if (value<0) value=-value;
-						if (value> maxnum)
-							maxnum= value;						    
+
+				// ratio to check the validity of the denominator compare to the entries in the reduced lattice
+				integer ratio;
+				ratio=100L;
+
+				// reduce the lattice using LLL algorithm
+				Timer chrono;
+				chrono.start();
+				myLLLproved(Lattice, k+1,k+1);
+				chrono.stop();
+				std::cout<<"lattice reduction time :        "<<chrono<<std::endl;
+
+
+				// check if the 1st row is the short vector
+				latticeOK=true;
+				mpz_mul(tmp.get_mpz(), Lattice[1][1],ratio.get_mpz());
+				for (size_t i=2;i<k+2;++i){
+					for (size_t j=1;j<k+2;++j)
+						if (mpz_cmpabs(tmp.get_mpz() , Lattice[i][j])> 0){
+							latticeOK=false;
+							break;
+						}
+				}
+
+				integer dd;
+				// get the denominator from the lattice
+				mpz_set(dd.get_mpz(),Lattice[1][1]);
+
+				//delete the lattice
+				for (size_t i=0;i<k+2;++i){
+					for (size_t j=0;j<k+2;++j)
+						mpz_clear(Lattice[i][j]);
+					delete[] Lattice[i];
+				}
+				delete[] Lattice;
+
+
+				if (latticeOK) {// lattice ok
+					Timer  checknum;
+					checknum.start();
+
+
+					Integer denom;
+					_r.init(denom,tmp);
+
+					bool neg=true;
+					if (dd < 0){
+						neg=true;std::cout<<"negative det\n";}
+
+					neg_denom= neg_denom^neg;
+
+					// compute the lcm of the denomintator and the last denominator
+					_r.lcmin(common_denom, denom);
+
+					Integer neg_approx, abs_approx;
+
+					numeratorOK=true;
+					// compute the numerators and check their validity according to the numerator  bound
+					for (size_t i=0;i<size;++i){
+						_r.mulin(real_approximation[i], common_denom);
+						_r.remin(real_approximation[i], modulus);
+						_r. sub (neg_approx, real_approximation[i], modulus);
+						_r. abs (abs_approx, neg_approx);
+
+						if ( _r.compare(real_approximation[i], numbound) < 0)
+							_r.assign(num[i], real_approximation[i]);
+						else if (_r.compare(abs_approx, numbound) <0)
+							_r.assign(num[i], neg_approx);
+						else {
+							bad_num_index= std::min(i, size-k);
+							numeratorOK=false;
+							break;
+						}
 					}
-				
-					// check the validity of the solution according to n.||A||.||num||+ d.||b|| < modulus
-					integer check= size*MagnA*maxnum+dd*Magnb;
-					
-					checksol.stop();
-					std::cout<<"checking solution time :        "<<checksol<<"\n\n";
-					
-					domorelattice=false;
+					checknum.stop();
+					std::cout<<"checking numerator time :       "<<checknum<<"\n";
+
+					if (numeratorOK) {//numerator ok
+						Timer checksol;
+						checksol.start();
+						// compute the magnitude of the numerator
+						integer maxnum=0;
+						typename Vector::const_iterator it_num=num.begin();
+						for (; it_num != num.end(); ++it_num) {
+							_r.convert(value,*it_num);
+							if (value<0) value=-value;
+							if (value> maxnum)
+								maxnum= value;
+						}
+
+						// check the validity of the solution according to n.||A||.||num||+ d.||b|| < modulus
+						integer check= size*MagnA*maxnum+dd*Magnb;
+
+						checksol.stop();
+						std::cout<<"checking solution time :        "<<checksol<<"\n\n";
+
+						domorelattice=false;
 
-					if (check < mod)
+						if (check < mod)
+							domoresteps=false;
+						else
+							domoresteps=true;
+
+					}
+					else{
+						domorelattice=true;
 						domoresteps=false;
-					else
-						domoresteps=true;
-			
+					}
+
 				}
 				else{
-					domorelattice=true;
-					domoresteps=false;
+					std::cout<<"lattice failed\n";
+					domoresteps=true;
+					domorelattice=false;
 				}
-				
-			} 
-			else{
-				std::cout<<"lattice failed\n";
-				domoresteps=true;
-				domorelattice=false;
+
+				if (domoresteps) std::cout<<"do more steps\n";
+				if (domorelattice) std::cout<<"do more lattice\n";
+
+				startingsteps = endingsteps;
+				if (domoresteps){
+					bad_num_index=0;
+					endingsteps+= moresteps;
+					if (endingsteps>length)
+						endingsteps=length;
+				}
+#ifdef RSTIMING
+				tRecon.stop();
+				ttRecon += tRecon;
+#endif
 			}
-			
-			if (domoresteps) std::cout<<"do more steps\n";
-			if (domorelattice) std::cout<<"do more lattice\n";
-
-			startingsteps = endingsteps;
-			if (domoresteps){
-				bad_num_index=0;
-				endingsteps+= moresteps;
-				if (endingsteps>length)
-					endingsteps=length;
+			while (domoresteps||domorelattice);
+
+#ifdef RSTIMING
+			tRecon.clear();
+			tRecon.start();
+#endif
+			_r.assign(den, common_denom);
+
+			if (neg_denom){
+				for (size_t i=0;i<size;++i)
+					_r.negin(num[i]);
 			}
 #ifdef RSTIMING
 			tRecon.stop();
-			ttRecon += tRecon;		
+			ttRecon += tRecon;
 #endif
-		}
-		while (domoresteps||domorelattice);
-	
-#ifdef RSTIMING
-		tRecon.clear();
-		tRecon.start();
-#endif	
-		_r.assign(den, common_denom);
-		
-		if (neg_denom){
-			for (size_t i=0;i<size;++i)
-				_r.negin(num[i]);			
-		}
+			return true;
+
+		} // end of getRational5
+
+
+		/*!
+		 * Rational reconstruction using Lattice base reduction
+		 */
+		template<class Vector1>
+		bool getRational6(Vector1& num, Integer& den, size_t thresh) const
+		{
+
 #ifdef RSTIMING
-		tRecon.stop();
-		ttRecon += tRecon;		
-#endif	
-		return true;
+			ttRecon.clear();
+			tRecon.start();
+#endif
 
-	} // end of getRational4
+			linbox_check(num.size() == (size_t)_lcontainer.size());
+
+			// prime
+			Integer prime = _lcontainer.prime();
+
+			// length of whole approximation
+			size_t length=_lcontainer.length();
+
+			// size of the solution
+			size_t size= _lcontainer.size();
+
+			// numerator  upper bound
+			Integer numbound;
+			_r.assign(numbound,_lcontainer.numbound());
+
+			// parameter used for the lattice dimension
+			size_t k = (2> size)? size:2 ;
+
+			// number of padic steps to perform first (use of LinBox::integer)
+			LinBox::integer N,D, bound, mod;
+			_r.convert(N, _lcontainer.numbound());
+			_r.convert(D, _lcontainer.denbound());
+			_r.convert(mod, prime);
+			::Givaro::root (D, D, k); D+=1;
+			bound=2*N*D;
+			std::cout<<"size in bit of the bound : "<<bound.bitsize()<<std::endl;
+			size_t minsteps = logp(bound, mod)+1;
+
+			Timer magn;
+			magn.start();
+			// magnitude of A and b
+			integer maxValue=0,value, MagnA, Magnb;
+			typename LiftingContainer::IMatrix::ConstRawIterator it = _lcontainer.getMatrix().rawBegin();
+			for (; it != _lcontainer.getMatrix().rawEnd(); ++it) {
+				_r.convert(value,*it);
+				if (value<0) value=-value;
+				if (value> maxValue)
+					maxValue= value;
+			}
+			MagnA=maxValue;
+
+			maxValue=0;
+			typename LiftingContainer::IVector::const_iterator it_b = _lcontainer.getVector().begin();
+			for (;it_b!= _lcontainer.getVector().end();++it_b){
+				_r.convert(value,*it_b);
+				if (value<0) value=-value;
+				if (value> maxValue)
+					maxValue= value;
+			}
+			Magnb=maxValue;
+			magn.stop();
+			std::cout<<"magnitude time:                 "<<magn<<"\n";
 
+			// some constants
+			Integer zero;
+			_r.init(zero,0);
+			Vector zero_digit(_lcontainer.size(),zero);
 
-	/* 
-	 * Rational reconstruction using Lattice base reduction	 
-	 */
-	template<class Vector1>
-	bool getRational6(Vector1& num, Integer& den, size_t thresh) const { 
+			// store approximation as a polynomial and evaluate by baby step giant step
+			std::vector<Vector>  digit_approximation(length,zero_digit);
+
+			// store real approximation
+			Vector real_approximation(size,zero);
+			Vector last_real_approximation;
+
+			// store modulus (intially set to 1)
+			Integer modulus, last_modulus;
+			_r.init(modulus, 1);
+
+			typename LiftingContainer::const_iterator iter = _lcontainer.begin();
+
+
+			size_t moresteps    = thresh;
+			size_t startingsteps =0;
+			size_t endingsteps  =minsteps;
+
+			// switchers
+			bool latticeOK=false, numeratorOK=false, domoresteps=true, domorelattice=true;
+
+			// common denominator
+			Integer common_denom;
+			_r.init(common_denom,1);
+
+			// bad numerator index
+			size_t bad_num_index=0;
+
+
+			bool neg_denom=false;
 
 #ifdef RSTIMING
-		ttRecon.clear();
-		tRecon.start();
-#endif
-	
-		linbox_check(num.size() == (size_t)_lcontainer.size());
-		
-		// prime 
-		Integer prime = _lcontainer.prime();
-		
-		// length of whole approximation
-		size_t length=_lcontainer.length();
-		
-		// size of the solution
-		size_t size= _lcontainer.size();
-
-		// numerator  upper bound
-		Integer numbound;
-		_r.assign(numbound,_lcontainer.numbound());
-		 
-		// parameter used for the lattice dimension
-		size_t k = (2> size)? size:2 ;
-
-		// number of padic steps to perform first (use of LinBox::integer)
-		LinBox::integer N,D, bound, mod;
-		_r.convert(N, _lcontainer.numbound());
-		_r.convert(D, _lcontainer.denbound());
-		_r.convert(mod, prime);
-		::root (D, D, k); D+=1;
-		bound=2*N*D;
-		std::cout<<"size in bit of the bound : "<<bound.bitsize()<<std::endl;
-		size_t minsteps = logp(bound, mod)+1;
-
-		Timer magn;
-		magn.start();
-		// magnitude of A and b
-		integer maxValue=0,value, MagnA, Magnb;
-		typename LiftingContainer::IMatrix::ConstRawIterator it = _lcontainer.getMatrix().rawBegin();
-		for (; it != _lcontainer.getMatrix().rawEnd(); ++it) {
-			_r.convert(value,*it);
-			if (value<0) value=-value;
-			if (value> maxValue)
-				maxValue= value;						    
-		}
-		MagnA=maxValue;
-
-		maxValue=0;
-		typename LiftingContainer::IVector::const_iterator it_b = _lcontainer.getVector().begin();
-		for (;it_b!= _lcontainer.getVector().end();++it_b){
-			_r.convert(value,*it_b);
-			if (value<0) value=-value;
-			if (value> maxValue)
-				maxValue= value;	
-		}
-		Magnb=maxValue;
-		magn.stop();
-		std::cout<<"magnitude time:                 "<<magn<<"\n";
-		
-		// some constants
-		Integer zero;
-		_r.init(zero,0);
-		Vector zero_digit(_lcontainer.size(),zero);	
-
-		// store approximation as a polynomial and evaluate by baby step giant step
-		std::vector<Vector>  digit_approximation(length,zero_digit); 
-
-		// store real approximation
-		Vector real_approximation(size,zero); 
-		Vector last_real_approximation;
-
-		// store modulus (intially set to 1)
-		Integer modulus, last_modulus;
-		_r.init(modulus, 1);
-		
-		typename LiftingContainer::const_iterator iter = _lcontainer.begin();
-
-		
-		size_t moresteps    = thresh;
-		size_t startingsteps =0;
-		size_t endingsteps  =minsteps;
-
-		// switchers
-		bool latticeOK=false, numeratorOK=false, domoresteps=true, domorelattice=true;
- 			
-		// common denominator
-		Integer common_denom;
-		_r.init(common_denom,1);
-
-		// bad numerator index
-		size_t bad_num_index=0;		
-
-
-		bool neg_denom=false;
+			tRecon.stop();
+			ttRecon += tRecon;
+			std::cout<<"\ninitialization time :           "<<tRecon<<"\n";
+#endif
+
+
+
+
+			do {// main loop
+
+				// keep track on the last power of the approximation
+				_r.assign(last_modulus,modulus);
+
+				if (domoresteps){
+
+					linbox_check(startingsteps != endingsteps);
+
+					// compute the padic digits
+					for (size_t i = startingsteps ;  (i< endingsteps) && (iter.next(digit_approximation[i]));++i) {
+						_r.mulin(modulus,prime);
+					}
 
+
+#ifdef RSTIMING
+					tRecon.clear();
+					tRecon.start();
+#endif
+					// evaluate the padic digit into an integer approximation
+					Integer xeval=prime;
+					typename std::vector<Vector>::const_iterator poly_digit= digit_approximation.begin()+startingsteps;
+					PolEval(real_approximation, poly_digit, endingsteps - startingsteps, xeval);
+
+					if (startingsteps != 0){
+						for (size_t i=0;i<size;++i){
+							_r.axpyin(last_real_approximation[i],real_approximation[i], last_modulus);
+						}
+						real_approximation=last_real_approximation;
+					}
+					else
+						last_real_approximation = real_approximation;
 #ifdef RSTIMING
-		tRecon.stop();
-		ttRecon += tRecon;	
-		std::cout<<"\ninitialization time :           "<<tRecon<<"\n";
-#endif	
-		
-
-
-
-		do {// main loop
-			
-			// keep track on the last power of the approximation
-			_r.assign(last_modulus,modulus);
-			
-			if (domoresteps){
-			
-				linbox_check(startingsteps != endingsteps);
-				
-				// compute the padic digits
-				for (size_t i = startingsteps ;  (i< endingsteps) && (iter.next(digit_approximation[i]));++i) {
-					_r.mulin(modulus,prime); 
+					tRecon.stop();
+					ttRecon += tRecon;
+					std::cout<<"evaluation time :               "<<tRecon<<"\n";
+#endif
 				}
-					
-			
 #ifdef RSTIMING
 				tRecon.clear();
 				tRecon.start();
 #endif
-				// evaluate the padic digit into an integer approximation	
-				Integer xeval=prime;
-				typename std::vector<Vector>::const_iterator poly_digit= digit_approximation.begin()+startingsteps;
-				PolEval(real_approximation, poly_digit, endingsteps - startingsteps, xeval);				
-								
-				if (startingsteps != 0){
-					for (size_t i=0;i<size;++i){
-						_r.axpyin(last_real_approximation[i],real_approximation[i], last_modulus); 
-					}
-					real_approximation=last_real_approximation;
+
+
+				// construct the lattice
+				std::vector<integer> Lattice(9);
+
+				integer tmp=1;
+				_r.convert(mod, modulus);
+
+				Lattice[0]=tmp;
+				for (size_t i=1;i< k+1;++i){
+					Lattice[i*(k+1)+i]=mod;
+					_r.convert(tmp, real_approximation[bad_num_index+i-1]);
+					Lattice[i]=tmp;
 				}
-				else 
-					last_real_approximation = real_approximation;	
-#ifdef RSTIMING
-		tRecon.stop();
-		ttRecon += tRecon;		
-		std::cout<<"evaluation time :               "<<tRecon<<"\n";
-#endif	
-			}
-#ifdef RSTIMING
-			tRecon.clear();
-			tRecon.start();
-#endif	
-		
-			
-			// construct the lattice			
-			std::vector<integer> Lattice(9);
-			
-			integer tmp=1;
-			_r.convert(mod, modulus);
-					       
-			Lattice[0]=tmp;
-			for (size_t i=1;i< k+1;++i){
-				Lattice[i*(k+1)+i]=mod;				
-				_r.convert(tmp, real_approximation[bad_num_index+i-1]);
-				Lattice[i]=tmp;
-			}
-			
-			// ratio to check the validity of the denominator compare to the entries in the reduced lattice
-			integer ratio;
-			ratio=100L;
-			
-			// reduce the lattice using LLL algorithm
-			Timer chrono;
-			chrono.start();
-			TernaryLattice L3(Lattice);
-			L3.reduce();
-			chrono.stop();
-			std::cout<<"lattice reduction time :        "<<chrono<<std::endl;
-
-		
-			// check if the 1st row is the short vector
-			latticeOK=true;
-			tmp = ::abs(L3[0][0]*ratio);
-			for (size_t i=1;i<k+1;++i){
-				for (size_t j=0;j<k+1;++j)
-					if (tmp > ::abs(L3[i][j])){
-						latticeOK=false;
-						break;
-					}
-			}
-		
-			integer dd;
-			// get the denominator from the lattice
-			dd= L3[0][0];
-			//L3.print();
-
-			if (latticeOK) {// lattice ok
-				Timer  checknum;
-				checknum.start();
-			
-
-				Integer denom;
-				_r.init(denom,tmp);
-				
-				bool neg=true;
-				if (dd < 0){
-					neg=true;std::cout<<"negative det\n";}
-				
-				neg_denom= neg_denom^neg;
-
-				// compute the lcm of the denominator and the last denominator
-				_r.lcmin(common_denom, denom);				
-
-				Integer neg_approx, abs_approx;
-				
-				numeratorOK=true;
-				// compute the numerators and check their validity according to the numerator  bound
-				for (size_t i=0;i<size;++i){
-					_r.mulin(real_approximation[i], common_denom);
-					_r.remin(real_approximation[i], modulus);
-					_r. sub (neg_approx, real_approximation[i], modulus);
-					_r. abs (abs_approx, neg_approx);
-
-					if ( _r.compare(real_approximation[i], numbound) < 0)
-						_r.assign(num[i], real_approximation[i]);									
-					else if (_r.compare(abs_approx, numbound) <0)
-						_r.assign(num[i], neg_approx);		
-					else {
-						bad_num_index= std::min(i, size-k);
-						numeratorOK=false;
-						break;
-					}
+
+				// ratio to check the validity of the denominator compare to the entries in the reduced lattice
+				integer ratio;
+				ratio=100L;
+
+				// reduce the lattice using LLL algorithm
+				Timer chrono;
+				chrono.start();
+				TernaryLattice L3(Lattice);
+				L3.reduce();
+				chrono.stop();
+				std::cout<<"lattice reduction time :        "<<chrono<<std::endl;
+
+
+				// check if the 1st row is the short vector
+				latticeOK=true;
+				tmp = ::Givaro::abs(L3[0][0]*ratio);
+				for (size_t i=1;i<k+1;++i){
+					for (size_t j=0;j<k+1;++j)
+						if (tmp > ::Givaro::abs(L3[i][j])){
+							latticeOK=false;
+							break;
+						}
 				}
-				checknum.stop();
-				std::cout<<"checking numerator time :       "<<checknum<<"\n";
-
-				if (numeratorOK) {//numerator ok					
-					Timer checksol;
-					checksol.start();
-					// compute the magnitude of the numerator
-					integer maxnum=0;
-					typename Vector::const_iterator it_num=num.begin();
-					for (; it_num != num.end(); ++it_num) {
-						_r.convert(value,*it_num);
-						if (value<0) value=-value;
-						if (value> maxnum)
-							maxnum= value;						    
+
+				integer dd;
+				// get the denominator from the lattice
+				dd= L3[0][0];
+				//L3.print();
+
+				if (latticeOK) {// lattice ok
+					Timer  checknum;
+					checknum.start();
+
+
+					Integer denom;
+					_r.init(denom,tmp);
+
+					bool neg=true;
+					if (dd < 0){
+						neg=true;std::cout<<"negative det\n";}
+
+					neg_denom= neg_denom^neg;
+
+					// compute the lcm of the denominator and the last denominator
+					_r.lcmin(common_denom, denom);
+
+					Integer neg_approx, abs_approx;
+
+					numeratorOK=true;
+					// compute the numerators and check their validity according to the numerator  bound
+					for (size_t i=0;i<size;++i){
+						_r.mulin(real_approximation[i], common_denom);
+						_r.remin(real_approximation[i], modulus);
+						_r. sub (neg_approx, real_approximation[i], modulus);
+						_r. abs (abs_approx, neg_approx);
+
+						if ( _r.compare(real_approximation[i], numbound) < 0)
+							_r.assign(num[i], real_approximation[i]);
+						else if (_r.compare(abs_approx, numbound) <0)
+							_r.assign(num[i], neg_approx);
+						else {
+							bad_num_index= std::min(i, size-k);
+							numeratorOK=false;
+							break;
+						}
 					}
-				
-					// check the validity of the solution according to n.||A||.||num||+ d.||b|| < modulus
-					integer check= size*MagnA*maxnum+dd*Magnb;
-					
-					checksol.stop();
-					std::cout<<"checking solution time :        "<<checksol<<"\n\n";
-					
-					domorelattice=false;
+					checknum.stop();
+					std::cout<<"checking numerator time :       "<<checknum<<"\n";
+
+					if (numeratorOK) {//numerator ok
+						Timer checksol;
+						checksol.start();
+						// compute the magnitude of the numerator
+						integer maxnum=0;
+						typename Vector::const_iterator it_num=num.begin();
+						for (; it_num != num.end(); ++it_num) {
+							_r.convert(value,*it_num);
+							if (value<0) value=-value;
+							if (value> maxnum)
+								maxnum= value;
+						}
 
-					if (check < mod)
+						// check the validity of the solution according to n.||A||.||num||+ d.||b|| < modulus
+						integer check= size*MagnA*maxnum+dd*Magnb;
+
+						checksol.stop();
+						std::cout<<"checking solution time :        "<<checksol<<"\n\n";
+
+						domorelattice=false;
+
+						if (check < mod)
+							domoresteps=false;
+						else
+							domoresteps=true;
+
+					}
+					else{
+						domorelattice=true;
 						domoresteps=false;
-					else
-						domoresteps=true;
-			
+					}
+
 				}
 				else{
-					domorelattice=true;
-					domoresteps=false;
+					std::cout<<"lattice failed\n";
+					domoresteps=true;
+					domorelattice=false;
 				}
-				
-			} 
-			else{
-				std::cout<<"lattice failed\n";
-				domoresteps=true;
-				domorelattice=false;
+
+				if (domoresteps) std::cout<<"do more steps\n";
+				if (domorelattice) std::cout<<"do more lattice\n";
+
+				startingsteps = endingsteps;
+				if (domoresteps){
+					bad_num_index=0;
+					endingsteps+= moresteps;
+					if (endingsteps>length)
+						endingsteps=length;
+				}
+#ifdef RSTIMING
+				tRecon.stop();
+				ttRecon += tRecon;
+#endif
 			}
-			
-			if (domoresteps) std::cout<<"do more steps\n";
-			if (domorelattice) std::cout<<"do more lattice\n";
-
-			startingsteps = endingsteps;
-			if (domoresteps){
-				bad_num_index=0;
-				endingsteps+= moresteps;
-				if (endingsteps>length)
-					endingsteps=length;
+			while (domoresteps||domorelattice);
+
+#ifdef RSTIMING
+			tRecon.clear();
+			tRecon.start();
+#endif
+			_r.assign(den, common_denom);
+
+			if (neg_denom){
+				for (size_t i=0;i<size;++i)
+					_r.negin(num[i]);
 			}
 #ifdef RSTIMING
 			tRecon.stop();
-			ttRecon += tRecon;		
+			ttRecon += tRecon;
 #endif
-		}
-		while (domoresteps||domorelattice);
-	
-#ifdef RSTIMING
-		tRecon.clear();
-		tRecon.start();
-#endif	
-		_r.assign(den, common_denom);
-		
-		if (neg_denom){
-			for (size_t i=0;i<size;++i)
-				_r.negin(num[i]);			
-		}
-#ifdef RSTIMING
-		tRecon.stop();
-		ttRecon += tRecon;		
-#endif	
-		return true;
+			return true;
+
+		} // end of getRational6
 
-	} // end of getRational6
 
 
+#endif // end of __LINBOX_HAVE_FPLLL
 
-#endif // end of __LINBOX_HAVE_FPLLL	
 
 
 
 
 
+	}; // end of RationalReconstruction
 
-};
-	
 }
 
-#endif
+#undef DEF_THRESH
+#endif //__LINBOX_reconstruction_H
+
diff --git a/linbox/algorithms/rational-reconstruction2.h b/linbox/algorithms/rational-reconstruction2.h
index bf0a1cb..3100af1 100644
--- a/linbox/algorithms/rational-reconstruction2.h
+++ b/linbox/algorithms/rational-reconstruction2.h
@@ -1,62 +1,69 @@
-/*  Author Z. Wan
+/* -*- 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
+/*  Copyright (c) LinBox
+ *  Author Z. Wan
  *  Modified to fit in linbox
  *  Using GMP directly
- *  Implement thte idea in the manuscript, available at http://www.cis.udel.edu/~wan/jsc_wan.ps
+ *  Implement the idea in the manuscript, available at http://www.cis.udel.edu/~wan/jsc_wan.ps
+ *  see COPYING for licence details
  */
-#ifndef __RATIONAL_RECONSTRUCTION2_H__
-#define __RATIONAL_RECONSTRUCTION2_H__
+#ifndef __LINBOX_rational_reconstruction2_H__
+#define __LINBOX_rational_reconstruction2_H__
 
 #include <linbox/integer.h>
 
-namespace LinBox{
-int rational_reconstruction (integer& a, integer& b, const integer& n0, const integer& d0, const integer& B) {
+namespace LinBox
+{
+	inline int rational_reconstruction (integer& a, integer& b, const integer& n0, const integer& d0, const integer& B)
+	{
 
-	integer p0, p1, p2; integer q0, q1, q2;
-	integer q, r; integer n, d;
+		integer p0, p1, p2; integer q0, q1, q2;
+		integer q, r; integer n, d;
 
-	p0 = 0; p1 = 1; p2 = 0; q0 = 1; q1 = 0; q2 = 0;
-	n = abs (n0); d = abs (d0);
+		p0 = 0; p1 = 1; p2 = 0; q0 = 1; q1 = 0; q2 = 0;
+		n = abs (n0); d = abs (d0);
 
-	int sgn = sign(n0) * sign(d0);
+		int sgn = sign(n0) * sign(d0);
 
-	if (d0 < B) {
-		if (sgn > 0)
-			 a = n0;
-		else
-			a = -n0;
+		if (d0 < B) {
+			if (sgn > 0)
+				a = n0;
+			else
+				a = -n0;
+
+			b= d0;
+			return 0;
+		}
+
+		do {
+			integer::divmod (q, r, n, d);
+			p2 = p0 + q * p1;
+			q2 = q0 + q * q1;
+			p0 = p1; p1 = p2;
+			q0 = q1; q1 = q2;
+			n = d; d = r;
+
+		} while ((q2 < B) && (sign(d) != 0));
+
+		if (q2 > B) {
+			if (sgn >= 0)
+				a = p0;
+			else
+				a = - p0;
+
+			b = q0;
+		}
+		else {
+			if (sgn >= 0)
+				a = p1;
+			else
+				a = -p1;
+			b = q1;
+		}
 
-		b= d0;
 		return 0;
 	}
-	
-	do {
-		integer::divmod (q, r, n, d);
-		p2 = p0 + q * p1;
-		q2 = q0 + q * q1;
-		p0 = p1; p1 = p2;
-		q0 = q1; q1 = q2;
-		n = d; d = r;
-
-	} while ((q2 < B) && (sign(d) != 0));
-
-	if (q2 > B) {
-		if (sgn >= 0) 
-			a = p0;
-		else
-			a = - p0;
-		
-		b = q0;
-	}
-	else {
-		if (sgn >= 0)
-			a = p1;
-		else
-			a = -p1;
-		b = q1;
-	}
-	
-	return 0;
-}
 }// LinBox
 
-#endif
+#endif //__LINBOX_rational_reconstruction2_H__
+
diff --git a/linbox/algorithms/rational-solver-adaptive.h b/linbox/algorithms/rational-solver-adaptive.h
index 9ac590d..4c20a50 100644
--- a/linbox/algorithms/rational-solver-adaptive.h
+++ b/linbox/algorithms/rational-solver-adaptive.h
@@ -1,70 +1,96 @@
-/*
- * Written by Zhendong Wan  <wan at mail.eecis.udel.edu> 
- * Time-stamp: <12 Mar 07 19:45:32 Jean-Guillaume.Dumas at imag.fr> 
+/* -*- 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
+/* Copyright (C) 2007 LinBox
+ *
+ * Written by Zhendong Wan  <wan at mail.eecis.udel.edu>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_RATIONAL_SOLVER_ADAPTIVE_H
-#define __LINBOX_RATIONAL_SOLVER_ADAPTIVE_H
+
+#ifndef __LINBOX_rational_solver_adaptive_H
+#define __LINBOX_rational_solver_adaptive_H
+
 #include <linbox/field/modular-int32.h>
 #include <linbox/algorithms/rational-solver.h>
 #include <linbox/randiter/random-prime.h>
 #include <linbox/blackbox/dense.h>
 
-namespace LinBox {
+namespace LinBox
+{
+
+	// Generic non-numerical solver requires conversion of the vector
+	template<class IRing, class OutVector, class InVector>
+	struct RationalSolverAdaptiveClass {
+		static SolverReturnStatus solveNonsingular(OutVector& num, typename IRing::Element& den, const DenseMatrix<IRing>& M, const InVector& b)
+		{
+			linbox_check ((M. rowdim() == M. coldim()) && (b.size() == M.rowdim()) && (num. size() ==M.coldim()));
+			typedef Modular<int32_t> Field;
+			// typedef Modular<double> Field;
+			RationalSolver<IRing, Field, RandomPrimeIterator, WanTraits> numerical_solver;
+			//RationalSolver<IRing, Field, RandomPrimeIterator, NumericalTraits> numerical_solver;
+			SolverReturnStatus ret;
+			ret = numerical_solver. solve(num, den, M, b);
 
-        // Generic non-numerical solver requires conversion of the vector
-        template<class IRing, class OutVector, class InVector>
-        struct RationalSolverAdaptiveClass {
-            static SolverReturnStatus solveNonsingular(OutVector& num, typename IRing::Element& den, const DenseMatrix<IRing>& M, const InVector& b) {
-                linbox_check ((M. rowdim() == M. coldim()) && (b.size() == M.rowdim()) && (num. size() ==M.coldim()));
-                typedef Modular<int32> Field;
-                RationalSolver<IRing, Field, RandomPrimeIterator, NumericalTraits> numerical_solver;
-                SolverReturnStatus ret;
-                ret = numerical_solver. solve(num, den, M, b);
-                
-                if (ret != SS_OK) {
-                    RationalSolver<IRing, Field, RandomPrimeIterator> solver;
-                    std::vector<typename IRing::Element> Ib; Ib.reserve(b.size());
-                    typename IRing::Element tmp;
-                    for(typename InVector::const_iterator biter = b.begin();
-                        biter != b.end();
-                        ++biter) 
-                        Ib.push_back( M.field().init(tmp, *biter) );
-                    ret = solver. solve(num, den, M, Ib);
-                }
-                
-                return ret;
-            }
-        };
-    
-        // Specialization when the vector is already over the ring
-        template<class IRing, class OutVector, template<typename T> class Container>
-        struct RationalSolverAdaptiveClass<IRing, OutVector, Container<typename IRing::Element> > {
-            static SolverReturnStatus solveNonsingular(OutVector& num, typename IRing::Element& den, const DenseMatrix<IRing>& M, const Container<typename IRing::Element> & b) {
-                linbox_check ((M. rowdim() == M. coldim()) && (b.size() == M.rowdim()) && (num. size() ==M.coldim()));
-                typedef Modular<int32> Field;
-                RationalSolver<IRing, Field, RandomPrimeIterator, NumericalTraits> numerical_solver;
-                SolverReturnStatus ret;
-                ret = numerical_solver. solve(num, den, M, b);
-                
-                if (ret != SS_OK) {
-                    RationalSolver<IRing, Field, RandomPrimeIterator> solver;
-                    ret = solver. solve(num, den, M, b);
-                }
-                
-                return ret;
-            }
-        };
+			if (ret != SS_OK) {
+				RationalSolver<IRing, Field, RandomPrimeIterator> solver;
+				std::vector<typename IRing::Element> Ib; Ib.reserve(b.size());
+				typename IRing::Element tmp;
+				for(typename InVector::const_iterator biter = b.begin();
+				    biter != b.end();
+				    ++biter) {
+					Ib.push_back( M.field().init(tmp, *biter) );
+				}
+				ret = solver. solve(num, den, M, Ib);
+			}
+
+			return ret;
+		}
+	};
+
+	// Specialization when the vector is already over the ring
+	template<class IRing, class OutVector, template<typename T> class Container>
+	struct RationalSolverAdaptiveClass<IRing, OutVector, Container<typename IRing::Element> > {
+		static SolverReturnStatus solveNonsingular(OutVector& num, typename IRing::Element& den, const DenseMatrix<IRing>& M, const Container<typename IRing::Element> & b) {
+			linbox_check ((M. rowdim() == M. coldim()) && (b.size() == M.rowdim()) && (num. size() ==M.coldim()));
+			typedef Modular<int32_t> Field;
+			// typedef Modular<double> Field;
+			RationalSolver<IRing, Field, RandomPrimeIterator, NumericalTraits> numerical_solver;
+			SolverReturnStatus ret;
+			ret = numerical_solver. solve(num, den, M, b);
+
+			if (ret != SS_OK) {
+				RationalSolver<IRing, Field, RandomPrimeIterator> solver;
+				ret = solver. solve(num, den, M, b);
+			}
+
+			return ret;
+		}
+	};
 
 
 	class RationalSolverAdaptive {
 	public:
-            template<class IRing, class OutVector, class InVector>
-            static SolverReturnStatus solveNonsingular(OutVector& num, typename IRing::Element& den, const DenseMatrix<IRing>& M, const InVector& b) {
-                return RationalSolverAdaptiveClass<IRing,OutVector,InVector>::solveNonsingular(num, den, M, b);
-            }
+		template<class IRing, class OutVector, class InVector>
+		static SolverReturnStatus solveNonsingular(OutVector& num, typename IRing::Element& den, const DenseMatrix<IRing>& M, const InVector& b) {
+			return RationalSolverAdaptiveClass<IRing,OutVector,InVector>::solveNonsingular(num, den, M, b);
+		}
 	};
 
 }
 
-#endif
+#endif //__LINBOX_rational_solver_adaptive_H
diff --git a/linbox/algorithms/rational-solver-sn.h b/linbox/algorithms/rational-solver-sn.h
new file mode 100644
index 0000000..33fcf19
--- /dev/null
+++ b/linbox/algorithms/rational-solver-sn.h
@@ -0,0 +1,308 @@
+/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* sn-rational-solver.h */
+
+#ifndef __RATIONAL_SOLVER_SN_H
+#define __RATIONAL_SOLVER_SN_H
+
+#include <iostream>
+
+#include <linbox/integer.h>
+#include <linbox/field/param-fuzzy.h>
+#include <linbox/solutions/methods.h>
+#include <linbox/blackbox/archetype.h>
+#include <linbox/blackbox/blas-blackbox.h>
+#include <linbox/algorithms/dyadic-to-rational.h>
+#include <linbox/blackbox/compose.h>
+#include <linbox/matrix/blas-matrix.h>
+#include <linbox/algorithms/vector-fraction.h>
+#include <linbox/algorithms/matrix-hom.h>
+#include <linbox/util/timer.h>
+#include <linbox/field/PID-integer.h>
+
+namespace LinBox {
+
+	// bsd and mac problem
+#undef _R
+	
+	/** \brief define the possible return status of the solver's computation. 
+	 */
+	enum SNSolverReturnStatus {
+		SNSS_OK, SNSS_FAILED, SNSS_SINGULAR, SNSS_INCONSISTENT
+	};
+
+	enum ShiftStatus {
+		SHIFT_GROW, SHIFT_SHRINK, SHIFT_PEAK, SHIFT_SEARCH, SHIFT_MAX
+	};
+    
+/* 
+ * A NumericSolver has 
+ * init from a matrix A, 
+ * solve(double* x, double* b)		// x = A^{-1}b
+ * apply(double* y, double * x);		// y = Ax
+ */ 
+	
+template<class Ring, class NumericSolver>
+class RationalSolverSN {
+
+	public:
+		typedef typename Ring::Element Int;
+		typedef std::vector<Int> IVector;
+		// note: the type integer is also used.  For instance, we assume shift operator<< works on integer.
+		typedef ParamFuzzy Field;  
+		typedef typename Field::Element Float;
+		typedef std::vector<Float> FVector; 
+		typedef BlasBlackbox<Field> FMatrix;
+
+	protected:
+		Ring _R;
+	 	VectorDomain<Ring> _VDR;
+		Field _F;
+		VectorDomain<Field> _VDF;
+		NumericSolver _S;
+		//inline static int check (int n, const double* M, integer* numx, integer& denx, double* b) ;
+		//inline void update_r_xs (double* r, double* xs_int, double* xs_frac, 
+		//							int n, const double* M, double* x, int shift);
+		//inline int rat_sol(IVector& numx, Int& denx, NumericSolver& _S, FVector& r, integer Bd);
+		//inline void dyadicToRational(ZIVector& num, Int& den, vector<integer>& numx, integer& denx, integer Bd);
+	private:
+		size_t shift, shift_prev, shift_max, SHIFT_BOUND, HIT, MISS, iterations;
+		ShiftStatus sstatus;
+		bool searchPeak;
+		double mnorm;
+		bool exact_apply;
+	public:
+
+		RationalSolverSN(const Ring& R = Ring(), const NumericSolver& S = NumericSolver(),
+				bool ea=false) 
+			: _R(R), _VDR(R), _F(Field()), _VDF(Field()), _S(S), exact_apply(ea) {}
+
+		/**
+		 * IMatrix is matrix of integer type, eg. BlasBlackbox<PID-integer>
+		 * IVector is linbox Vector of integer, eg. vector<PID-integer::Element>
+		 * M is the matrix, b is rhs.
+		 * num, den are the output  such that M*num = den*b (and den != 0 if successful).
+		 */
+		//  sparse matrix flag at the end, then avoid copying to DM as well ass
+		//  new method to get hadamard bound and matrix norm!
+		template <class IMatrix, class IVector>
+		SNSolverReturnStatus solve(IVector& num, Int& den, 
+				const IMatrix& M, const IVector& b) {
+			Timer timer, solve_timer, rr_timer, tt;
+
+			size_t n = b.size();
+			// check basic feasiblility
+			linbox_check((b.size() == M.rowdim()) && (num. size() == M.coldim()));
+
+			// DM is M as matrix of doubles
+			FMatrix DM(_F, n, n);
+			//  Fix MatrixHom?
+			//FMatrix* DMp = &DM;
+			//MatrixHom::map<FMatrix, IMatrix, Field>(DMp, M, _F);
+
+			if(n != M. rowdim() || n != M. coldim() || n != num.size()) {
+				//std::cerr << "solve fail 1 - dimension mismatch" << std::endl;
+				return SNSS_FAILED;
+			}
+
+			//  this is currently not used to check anything...
+			integer entryBound = 1; entryBound <<= 49;  // nothing should exceed 2^50.
+			SHIFT_BOUND = 52;
+
+			//  why can't i put this in the for loop def???
+			typename FMatrix::RawIterator dm_p = DM.rawBegin();
+			for (typename IMatrix::ConstRawIterator raw_p = M.rawBegin();
+					raw_p != M. rawEnd(); ++ raw_p, ++dm_p) {
+				_F.init(*dm_p, *raw_p);
+			}
+
+			// build a numeric solver from new double matrix
+			_S.init(DM); 
+
+			// r is b as vector of doubles.  (r is initial residual)
+			FVector r(n);
+			IVector bi(n);
+			typename IVector::const_iterator b_p = b.begin();
+			typename IVector::iterator bi_p = bi.begin();
+			typename FVector::iterator r_p = r.begin();
+			for (  ; b_p != b. begin() + n; ++b_p, ++r_p, ++bi_p) {
+				*bi_p = *b_p;  //  copy original RHS
+				_F.init(*r_p, *b_p);
+			}
+
+			//  denBound is the Hadamard bound, loopBound is roughly twice as much
+			integer denBound, loopBound;
+			zw_hbound (denBound, n, n, &*(DM.rawBegin()));
+			loopBound = denBound*denBound;
+
+			mnorm = zw_dOOnorm(&*(DM.rawBegin()), n, n);  //  infinity-norm of matrix
+			//  set max shift to avoid exact applys
+			size_t bits = 0;
+			size_t mn2 = nextPower2((size_t)mnorm);
+			for(;mn2;mn2>>=1, bits++);
+
+			SHIFT_BOUND -= bits;
+			//std::cerr << "BITS" << bits << "MAX" << SHIFT_BOUND << std::endl;
+
+			loopBound *= (2*mnorm + zw_dmax(n, &*(r.begin()), 1));
+
+			std::vector<integer> numx(n), tnum(n); // numerator of binary expansion
+			integer denx = 1, tden; // denominator of binary expansion (denx is a power of 2).
+
+			FVector x(n), xs_int(n), xs_frac(n);
+			FVector lastr(n);
+			IVector lastb(n);
+
+			//set initial shift small.
+			shift = 2;
+			shift_prev = shift;
+			shift_max = 0;
+			searchPeak = false;
+			sstatus = SHIFT_GROW;
+			HIT = 0; MISS = 0;
+			iterations = 0;
+			integer ay, be;
+			PID_integer Z;
+			int ret;
+
+			bool recon_success = false;
+			int recon_status = 0;
+
+			//timer.clear(); timer.start();
+#ifdef SN_EARLY_TERM
+			integer bound = denBound;
+			//double it_cost = 0, rr_cost = 0;
+#else
+			integer bound = loopBound;
+#endif
+			//size_t rr_count = 0;
+			//solve_timer.clear(); rr_timer.clear();
+			do{		
+				//tt.clear(); tt.start();
+				ret = rat_sol(numx, denx, xs_int, xs_frac, bi, lastb, r, lastr, x, bound, M);
+				//tt.stop(); solve_timer += tt;
+
+				if(ret == 1){
+					//std::cerr << "numsym loop failed - likely lack of num accuracy" << std::endl;
+					return SNSS_FAILED;
+				}
+				else if(ret == 2) denBound = denx; // zero residual
+
+				// we're trying to early-term 
+				//std::cerr << bound << " " << loopBound << std::endl;
+				if(bound < loopBound){
+					//  update bound for next iteration (if applicable)
+					/* it_cost = solve_timer.realtime()/(double)iterations;
+					rr_cost = rr_timer.realtime()/(double)rr_count;
+					std::cerr << "iteration cost: " << it_cost << " v. rr cost: " << rr_cost << std::endl; */
+					Z.sqrt(bound, loopBound*bound);	
+					bound <<= 2;
+					int rPos = rand()%n;
+					//std::cerr << "At iteration " << iterations << ", ";
+					if(dyadicToRational(Z, ay, be, numx[rPos], denx, denBound) /*== 2*/){
+                    	//std::cerr << "Random single worked!  ";
+					}
+               else{
+                        //std::cerr << "Random single failed." << std::endl;
+						continue;
+					}
+            }
+				
+				//tt.clear(); tt.start();
+				recon_status = dyadicToRational(Z, num, den, numx, denx, denBound);
+				//tt.stop(); rr_timer += tt; ++rr_count;
+				//std::cerr << "RRT: " << rr_timer << std::endl;
+
+				recon_success = recon_status > 0;
+				//if(!recon_success) std::cerr << "Full failed!" << std::endl;		
+				//else std::cerr << "Full worked!" << std::endl;		
+			} while((bound < loopBound) && !recon_success);
+
+			//timer.stop(); std::cerr << "rat_sol time: " << solve_timer.realtime() << " rr time: " << rr_timer.realtime() << " Total: " << timer << std::endl;
+
+			/*writeVec(numx, "numx", 0, 10);
+			std::cerr << denx << std::endl;
+			writeVec(num, "num");
+			std::cerr << "den: (large)" << std::endl;// << den << endl;
+			*/
+
+			if (recon_success) {
+				/*
+				if(recon_status == 2) std::cerr << "reconstruction guaranteed" << std::endl;
+				else std::cerr << "reconstruction speculative" << std::endl;
+
+				std::cerr << "Solve success. Iterations: " << iterations << std::endl;
+				std::cerr << HIT << " hits, " << MISS << " misses. (";
+				fprintf(stderr,  "%.2f", (float)(HIT)/(float)(HIT+MISS)*100.0);
+				std::cerr << "%) Maximum shift: " << shift_max << std::endl;
+				*/
+			}
+			else{
+				//std::cerr << "rat reconstruction asserts failure" << std::endl;
+				//dumpData(M, b, numx, denx, denBound);
+				return SNSS_FAILED;
+			}
+
+			if (_R.isZero(den)) {
+				//std::cerr << "fail: zero denominator after rat-recons" << std::endl;
+				return SNSS_FAILED;
+			}
+
+			/*
+			//  Answer checking
+			IVector y(n), z(n);
+			M.apply(y, num);
+			_VDR.mul(z, b, den);
+			if ( !_VDR.areEqual(y, z)) {
+				std::cerr << "fail check: A*x != b exactly" << std::endl;
+				dumpData(M, b, numx, denx, denBound);
+				return SNSS_FAILED;
+			}
+			*/
+
+			return SNSS_OK;
+
+	} // solve
+
+#include "rational-solver-sn.inl"
+
+#if 0  
+//embedded definitions now, so no declarations
+	// functions used by solve()  
+	//protected:
+		//print out a vector
+		template <class Elt>
+		inline static int printvec (const Elt* v, int n);
+		/** Compute the OO-norm of a mtrix */ 
+		inline static double zw_dOOnorm(const double* M, int m, int n);
+		/** compute the maximam of absolute value of an array*/
+		inline static double zw_dmax (const int N, const double* a, const int inc);
+		/* apply  y <- Ax */
+		inline static int zw_dapply (int m, int n, const double* A, const double* x, double* y);
+		inline static int zw_mpzapply (int m, int n, const double* A, const integer* x, integer* y);
+		//update the numerator; num = num * 2^shift + d;
+		inline static int update_num (integer* num, int n, const double* d, int shift);
+		//update r = r * shift - M d, where norm (r) < 2^32;
+		inline static int update_r_int (double* r, int n, const double* M, const double* d, int shift);
+		//update r = r * shift - M d, where 2^32 <= norm (r) < 2^53
+		inline static int update_r_ll (double* r, int n, const double* M, const double* d, int shift);
+		// compute  the hadamard bound
+		inline static int zw_hbound (integer& b, int m, int n, const double* M);
+		// compute the inverse of a general matrix
+		inline static int zw_dgeinv(double* M, int n);
+		/* solve Ax = b 
+		 * A, the integer matrix
+		 * b, integer rhs
+		 * Return value
+		 * 0, ok.
+		 * 1, the matrix is not invertible in floating point operations.
+		 * 2, the matrix is not well conditioned.
+		 * 3, incorrect answer, possible ill-conditioned.
+		 */
+		//inline int rsol (Ring& R, int n, const double* M, integer* numx, integer& denx, double* b);
+#endif
+
+}; // class RationalSolverSN
+
+} // namespace LinBox
+
+#endif // __SNRATIONAL_SOLVER_H
diff --git a/linbox/algorithms/rational-solver-sn.inl b/linbox/algorithms/rational-solver-sn.inl
new file mode 100644
index 0000000..77280ac
--- /dev/null
+++ b/linbox/algorithms/rational-solver-sn.inl
@@ -0,0 +1,450 @@
+// rational-solver-sn.inl
+// WARNING: this file is included from INSIDE the definition of class LinBox::RationalSolverSN
+
+#ifdef DEBUGRC
+#define debug(x) std::cerr << x << std::endl
+#define debugneol(x) std::cerr << x
+#define debug2(x, y) debug(x); y
+#else
+#define debug(x)
+#define debug2(x, y)
+#define debugneol(x)
+#endif
+
+#define log_2(x) (log(x)/M_LN2)
+
+int zw_shift(NumericSolver &_S, size_t n, FVector &r, FVector &x){
+	//  ZW method for calculating shift
+	// compute ax
+	FVector ax(n);
+	_S.apply(ax, x);
+	// compute ax = ax -r, the negative of residual
+	for(size_t i=0; i<n; i++)
+		_F.sub(ax[i], ax[i], r[i]);
+	// compute possible shift
+	int zw_shift;
+	double normr1, normr2, normr3, shift1, shift2;
+	normr1 = zw_dmax(n, &*r.begin(), 1);
+	normr2 = zw_dmax(n, &*ax.begin(), 1);
+	normr3 = zw_dmax(n, &*x.begin(), 1);
+
+	//cerr << normr1 << " " << normr2 << " " << normr3 << endl;
+	//try to find a good scalar
+	if (normr2 <.0000000001)
+		zw_shift = 30;
+	else {
+		shift1 = floor(log_2 (normr1 / normr2)) - 2;
+		zw_shift = (int)(30 < shift1 ? 30 : shift1);
+	}
+
+	normr3 = normr3 > 2 ? normr3 : 2;
+	shift2 = floor(53. / log_2 (normr3));
+	zw_shift = (int)(zw_shift < shift2 ? zw_shift : shift2);
+
+	return zw_shift;
+}
+
+template <class IMatrix>
+int rat_sol(IVector& numx, Int& denx, FVector& xs_int, FVector& xs_frac, IVector &b, IVector &lastb, FVector& r, FVector& lastr, FVector& x, integer &loopBound, IMatrix &IM) {
+
+	debug("Matrix norm: " << mnorm);
+	int thresh_expt = 1;  // consider as low as 1 or 2 (at least when n large)
+	double threshold = 1.0/(1 << thresh_expt);
+
+	size_t n = r.size();
+	// xs_int: integer part of scaled x.
+	// xs_frac: fractional part of scaled x.
+	// x * 2^shift = xs_int + xs_frac.
+	FVector nextx(n), quo(n);
+
+	integer denx_i;
+	typename Field::Element one; _F.init(one, 1);
+
+	//  need to save original r for zw_shift calculation
+	//  TODO: I took out the ZWSHIFT, still need last r??
+
+	if(denx == 1){
+		// compute first approximate solution x
+		_S.solve(x, r);
+
+		//writeVec(x, "x from first solve");
+		copy(r.begin(), r.end(), lastr.begin());
+		copy(b.begin(), b.end(), lastb.begin());
+		//-- compute xs_int, xs_frac, r (residue)
+		update_xs(xs_int, xs_frac, x);
+		if(exact_apply) update_r_exact(b, r, xs_int, IM);
+		else update_r(r, xs_int);
+	}
+
+	//std::cerr << "while loopbound " << loopBound << std::endl;
+	while (_R.compare(denx, loopBound) < 0) {
+		++iterations;
+		//  x = DM^{-1}*r
+		_S.solve(nextx, r);
+
+		for(size_t i=0; i<n; i++){
+			// TODO - analyze logic here
+			//  quo[i] = xs_frac[i] / nextx[i] - 1;
+			//_F.div(quo[i], xs_frac[i], nextx[i]);
+			//_F.subin(quo[i], one);
+			_F.sub(quo[i], xs_frac[i], nextx[i]);
+		}
+
+		double q = zw_dmax(n, &*quo.begin(), 1);
+
+		//writeVec(nextx, "nextx from loop");  //  DEBUG PRINTOUTS
+		//writeVec(xs_frac, "xs_frac from loop");
+		//writeVec(quo, "quo");
+		/* fails to write!!
+		_VDF.write(std::cerr << "nextx from loop: ", nextx) << std::endl;
+		_VDF.write(std::cerr << "xs_frac from loop: ", xs_frac) << std::endl;
+		_VDF.write(std::cerr << "quo minus 1: ", quo) << std::endl;
+		if ( 0 == iterations%500) std::cerr << iterations << " MAX DIFFERENCE: " << q << std::endl;
+		*/
+
+		//if (q == 0.0)   (QUIT HERE??)
+		if (q < threshold) {
+			HIT++;
+			// update numx and denx
+			denx <<= shift;
+			update_num (numx, xs_int);
+
+			if(_VDF.isZero(r))
+				return 2;
+
+			// consider increasing the shift for next iteration
+			upshift();
+
+			// make x = nextx, then compute new residual, xs_int, xs_frac
+			swap(x, nextx);
+			copy(r.begin(), r.end(), lastr.begin());
+			copy(b.begin(), b.end(), lastb.begin());
+			update_xs(xs_int, xs_frac, x);
+			if(exact_apply) update_r_exact(b, r, xs_int, IM);
+			else update_r(r, xs_int);
+		}
+		else {  //  q >= threshold, back-off
+			MISS++;
+
+			//  point of no return, quit
+			if (shift < 2){
+				/*
+				std::cerr << "rat_sol failure, no bits in x overlap in nextx." << std::endl;
+				std::cerr << "Iterations: " << iterations << std::endl;
+				writeVec(b, "b", 0, 5); writeVec(r, "r", 0, 5);
+				*/
+				return -1;
+			}
+
+			downshift();
+			//-- compute xs_int, xs_frac, r (residue)
+			// but use last r as input
+			copy(lastr.begin(), lastr.end(), r.begin());
+			copy(lastb.begin(), lastb.end(), b.begin());
+			update_xs(xs_int, xs_frac, x);
+			if(exact_apply) update_r_exact(b, r, xs_int, IM);
+			else update_r(r, xs_int);
+		}
+	}
+	return 0;
+}// rat_sol
+
+inline void upshift(){
+	switch(sstatus){
+		//  exponential increase
+		case SHIFT_GROW:
+			shift_prev = shift;
+			debugneol("G");
+			shift_max = shift<<=1;
+			break;
+		case SHIFT_SEARCH:
+			shift_prev = shift;
+			debugneol("S");
+			shift = (shift + shift_max)>>1;
+			searchPeak = true;
+			break;
+		case SHIFT_PEAK:
+			debugneol("P");
+			//  maybe increase if we have been successful for a while
+			break;
+		case SHIFT_MAX:
+			debugneol("M");
+			//  machine precision-- can go no higher
+			break;
+		case SHIFT_SHRINK:
+			debugneol("H");
+			break;
+	}
+	if(shift > SHIFT_BOUND){
+		shift_max = shift = SHIFT_BOUND;
+		sstatus = SHIFT_MAX;
+	}
+	debug("^shift: "  << shift << "  max: " << shift_max << "  prev: " << shift_prev);
+}
+
+inline void downshift(){
+	/*
+	   shift -= 2;
+	   sstatus = SHIFT_PEAK;
+	   cerr << "peaked at " << shift << endl;
+	 */
+	//  back up
+	switch(sstatus){
+		case SHIFT_GROW:
+			debugneol("G");
+		case SHIFT_MAX:
+			debugneol("M");
+		case SHIFT_SEARCH:
+			//  TODO - previous shift could fail
+			debugneol("S");
+			shift_max = shift;
+			shift = (shift_prev + shift)>>1;
+			sstatus = SHIFT_SEARCH;
+			//  searchPeak true means we were going up but got knocked back
+			if(shift == shift_prev || searchPeak)
+				sstatus = SHIFT_PEAK;
+			break;
+		case SHIFT_SHRINK:
+			debugneol("H");
+			shift >>= 1;
+			break;
+		case SHIFT_PEAK:
+			debugneol("P");
+			shift -= 1;
+			break;
+		default:
+			break;
+	}
+
+	debug("vshift: "  << shift << "  max: " << shift_max << "  prev: " << shift_prev);
+} // downshift
+
+inline void update_xs(FVector& xs_int, FVector& xs_frac, FVector& x){
+	Float scalar, tmp;
+	int64_t shifted = ((int64_t)1 << shift);
+	_F.init(scalar, shifted);
+
+	//  make xs_int and xs_frac such that x*scalar = xs_int + xs_frac.
+	for(size_t i = 0; i < xs_int.size(); ++i){
+		// TODO: tmp can overflow a double
+		tmp = x[i]*scalar;
+		xs_int[i] = floor(tmp + 0.5);  // TODO: ceiling?
+		// TODO: TRY THIS xs_int[i] = ceiling(tmp);
+		xs_frac[i] = tmp - xs_int[i];
+	}
+	return;
+}
+
+inline void update_r(FVector& r, FVector& xs_int){
+	Float scalar;
+	size_t n = r.size();
+	int64_t shifted = ((int64_t)1 << shift);
+	_F.init(scalar, shifted);
+	FVector y(n);
+
+	//update r = r * 2^shift - Mat*xs_int
+	_VDF.mulin(r, scalar);
+	_S.apply(y, xs_int);
+	_VDF.subin(r, y);
+
+	return;
+} // update_r
+
+template <class IMatrix>
+inline void update_r_exact(IVector& r_exact, FVector& r, FVector& xs_int, IMatrix &IM){
+	size_t n = r.size();
+
+	IVector x_i(n), y_i(n);
+
+	typename Ring::Element scalar = ((int64_t)1 << shift);
+
+	// update r = r * 2^shift - Mat*xs_int
+	//  r *= 2 ^shift
+	_VDR.mulin(r_exact, scalar);
+
+	// determine if exact apply is needed
+	double vnorm = zw_dOOnorm(&*xs_int.begin(), n, 1);
+
+	int64_t th = ((int64_t)1 << 52);  // double mantissa
+	Float thresh;
+	_F.init(thresh, th);
+
+	debugneol("vnorm " << vnorm);
+
+	//  r -= Mat * xs_int
+	if(_F.mulin(vnorm, mnorm) < thresh){
+		debugneol("Numeric ");
+		FVector y(n);
+		_S.apply(y, xs_int);
+		for(size_t i = 0; i < n; ++i)
+			_R.init(y_i[i], y[i]);
+	}
+	else{
+		SHIFT_BOUND--; // to less this possibility
+		debugneol("Exact ");
+		for(size_t i = 0; i < n; ++i)
+			_R.init(x_i[i], xs_int[i]);
+		IM.apply(y_i, x_i);
+	}
+
+	_VDR.subin(r_exact, y_i);
+
+	//  convert exactly computed residue back to double (for next solve)
+	typename FVector::iterator rp = r.begin();
+	typename IVector::iterator rep = r_exact.begin();
+	for(; rp!= r.end(); ++rp, ++rep)
+		_F.init(*rp, *rep);
+
+	return;
+} // update_r_exact
+
+// no longer called...
+inline int HadamardBound(integer& B, FMatrix& DM) {
+	size_t n = DM.rowdim();
+	zw_hbound (B, n, n, &*DM.rawBegin()); // compute the Hadamard bound
+	B = B * B;
+	double mnorm = zw_dOOnorm(&*DM.rawBegin(), n, n);
+
+	// [don't know what this comment is about] should be a check for 2 * mnorm + zw_dmax (n, b, 1);
+	// TODO what is "b"? from copied code it is the RHS array of doubles
+	// zw_max just seems to get abs(max value of b)
+	// next line false, just to compile
+	double *b;
+	B *= 2 * mnorm + zw_dmax (n, b, 1); // [don't know what this factor is about]
+	B <<= 1; // [extra factor of 2 for some reason... ]
+	return B;
+}
+
+//update num, *num <- *num * 2^shift + d
+inline IVector& update_num (IVector& num, const FVector& d) {
+	size_t n = d.size();
+	IVector d_i(n);
+	for (size_t i = 0; i < n; ++i) {
+		_R.init(d_i[i], d[i]);
+	}
+	Int scalar; _R.init(scalar, (long long int)1 << shift);
+	//  TODO - analyze GMP shifting capability
+	_VDR.mulin(num, scalar);
+	_VDR.addin(num, d_i);
+	return num;
+}
+
+//update r = r * shift - M d
+inline static int update_r_ll (double* r, int n, const double* M, const double* d, int shift) {
+	long long int tmp;
+	double* p1;
+	const double* p2;
+	const double* pd;
+	for (p1 = r, p2 = M; p1 != r + n; ++ p1) {
+		tmp = (long long int) *p1;
+		tmp <<= shift;
+		for (pd = d; pd != d + n; ++ pd, ++ p2) {
+			tmp -= (long long int)*pd * (long long int) *p2;
+		}
+		*p1 = tmp;
+	}
+	return 0;
+}
+
+inline static size_t nextPower2(size_t n){
+	size_t p = 1;
+	while(p < n) p <<= 1;
+	return p;
+}
+
+inline static double highAbs(FMatrix M){
+	double max = 0;
+	typename FMatrix::RawIterator ri = M.rawBegin();
+	for(; ri != M.rawEnd(); ++ri){
+		double tmp = fabs(*ri);
+		if(max < tmp) max = tmp;
+	}
+	return max;
+}
+
+inline static double zw_dOOnorm(const double* M, int m, int n) {
+	double norm = 0;
+	double old = 0;
+	const double* p;
+	for (p = M; p != M + (m * n); ) {
+		old = norm;
+		norm = cblas_dasum (n, p ,1);
+		if (norm < old) norm = old;
+		p += n;
+	}
+	return norm;
+}
+
+inline static double zw_dmax (const int N, const double* a, const int inc) {
+	return fabs(a[cblas_idamax (N, a, inc)]);
+}
+
+inline static int zw_hbound (integer& b, int m, int n, const double* M){
+	double norm = 0;
+	const  double* p;
+	integer tmp;
+	b = 1;
+	for (p = M; p != M + (m * n); ) {
+		norm = cblas_dnrm2 (n, p ,1);
+		tmp =  norm;
+		integer::mulin (b, tmp);
+		p += n;
+	}
+
+	return 0;
+}
+
+/*  out:  vector to print
+ *  tag:  prepend this to output
+ *  bound:  upper bound on printed value (0 - ignore bound) */
+template<class Vec>
+std::ostream& writeVec(Vec& out, const char *tag="", integer bound=/*40000000*/0,
+		size_t numEntries=5, std::ostream &os=std::cerr){
+	os << tag << ": [";
+
+	size_t n = (out.size() < numEntries ? out.size() : numEntries);
+	for( size_t i=0; i<n; ++i){
+		if(bound && ((integer)(out[i]) > bound || (integer)(out[i]) < -bound)){
+			os << " entry over bound ]"  << std::endl;
+			return os;
+		}
+		else
+			os << " " << out[i];
+	}
+	if(out.size() > numEntries)
+		os << " ...";
+	os << " ]" << std::endl;
+	return os;
+}
+
+template<class Vec>
+void writeVecFile(Vec& out, const char* file){
+	std::ofstream os;
+	os.open(file, std::ios::out);
+
+	typename Vec::const_iterator vi = out.begin();
+
+	for( ; vi != out.end(); ++vi){
+		os << *vi << std::endl;
+	}
+	os.close();
+}
+
+// to write diagnostic info to files for further testing
+template <class Matrix>
+void dumpData(const Matrix &M, const IVector &b, IVector &numx, integer &denx, integer &denBound){
+#ifdef SPITOUT
+	std::ofstream matout;
+	matout.open("debug.mat", std::ios::out);
+	M.write(matout);
+	matout.close();
+	writeVecFile(b, "debug.rhs");
+	writeVecFile(numx, "debug.num");
+	std::ofstream dout;
+	dout.open("debug.den", std::ios::out);
+	dout << denx << std::endl;
+	dout << denBound << std::endl;
+	dout << numx.size() << std::endl;
+	dout.close();
+#endif
+}
diff --git a/linbox/algorithms/rational-solver.h b/linbox/algorithms/rational-solver.h
index c717fca..7f8a583 100644
--- a/linbox/algorithms/rational-solver.h
+++ b/linbox/algorithms/rational-solver.h
@@ -1,8 +1,9 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* linbox/algorithms/lifting-container.h
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* linbox/algorithms/rational-solver.h
  * Copyright (C) 2004 Zhendong Wan, Pascal Giorgi
  *
- * Written by Zhendong Wan  <wan at mail.eecis.udel.edu> 
+ * Written by Zhendong Wan  <wan at mail.eecis.udel.edu>
  *         and Pascal Giorgi <pascal.giorgi at ens-lyon.fr>
  * Modified by David Pritchard  <daveagp at mit.edu>
  *
@@ -22,8 +23,13 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_RATIONAL_SOLVER_H
-#define __LINBOX_RATIONAL_SOLVER_H
+/*! @file algorithms/rational-solver.h
+ * @ingroup algorithms
+ * @brief Rational solving (Dixon, Wiedemann,...)
+ */
+
+#ifndef __LINBOX_rational_solver_H
+#define __LINBOX_rational_solver_H
 
 #include <iostream>
 
@@ -36,139 +42,162 @@
 #include <linbox/util/timer.h>
 
 //#define RSTIMING
-#define DEFAULT_PRIMESIZE 20 
+#define DEFAULT_PRIMESIZE 20
 
-namespace LinBox {// LinBox
+namespace LinBox
+{// LinBox
 
-	// bsd and mac problem
+// bsd and mac problem
 #undef _R
-	
+
 #define SINGULARITY_THRESHOLD 5
 #define BAD_PRECONTITIONER_THRESHOLD 5
 #define DEFAULT_MAXPRIMES 5
 #define SL_DEFAULT SL_LASVEGAS
 
-	 
-	
+
+
 	/** @defgroup padic p-adic lifting for linear system solutions.
 	 *  @brief interface for solving linear system by p-adic lifting technique over the quotient field of a ring.
 	 *  i.e. solution over the rational for an integer linear system.
 	 *
 	 * \par Headers
-	 *  #include<linbox/algorithms/rational-solver.h>
-	 * 
-	 * \par References
+	 *  <code>\#include <linbox/algorithms/rational-solver.h></code>
 	 *
 	 *  See the following reference for details on this algorithm:
-	 *
-	 *  - Robert T. Moenck and John H. Carter: Approximate algorithms to derive exact solutions to system
-	 *  of linear equations. In Proc. EUROSAM'79, volume 72 of Lectures Note in Computer Science, pages 65-72,
-	 *  Berlin-Heidelberger-New York, 1979. Springer-Verlag.
-	 *  .
-	 *
-	 *  - John D. Dixon: Exact Solution of linear equations using p-adic expansions. Numerische Mathematik, 
-	 *  volume 40, pages 137-141, 1982.
+	 * \bib
+	 *    - Robert T. Moenck and John H. Carter <i>Approximate algorithms to
+	 *  derive exact solutions to system of linear equations.</i> In Proc.
+	 *  EUROSAM'79, volume 72 of Lectures Note in Computer Science, pages
+	 *  65-72, Berlin-Heidelberger-New York, 1979. Springer-Verlag.
+	 *    - John D. Dixon <i>Exact Solution of linear equations using p-adic
+	 *  expansions.</i> Numerische Mathematik, volume 40, pages 137-141,
+	 *  1982.
 	 *  .
 	 * \ingroup algorithms
-	 * 
+	 *
 	 */
 
 
-	/** \brief define the different return status of the p-adic based solver's computation. 
-	 * 
+	/** \brief define the different return status of the p-adic based solver's computation.
+	 *
 	 * \ingroup padic
 	 */
 	enum SolverReturnStatus {
-		SS_OK, SS_FAILED, SS_SINGULAR, SS_INCONSISTENT, SS_BAD_PRECONDITIONER
+		SS_OK,
+		SS_FAILED,
+		SS_SINGULAR,
+		SS_INCONSISTENT,
+		SS_BAD_PRECONDITIONER
 	};
-    
-	/** \brief  define the different strategy which can be used in the p-adic based solver.
+
+	/** Define the different strategy which can be used in the p-adic based solver.
 	 *
-	 * used to determine what level of solving should be done:
-	 * - Monte Carlo: Try to solve if possible, but result is not guaranteed. 
+	 * Used to determine what level of solving should be done:
+	 * - Monte Carlo: Try to solve if possible, but result is not guaranteed.
 	 *   In any case a 0 denominator should not be returned.
 	 * - Las Vegas  : Result should be guaranteed correct.
 	 * - Certified  : Additionally, provide certificates that the result returned is correct.
-	 *              - if the return value is SS_INCONSISTENT, this means
-	 *                   lastCertificate satisfies lC.A = 0, lC.b != 0
-	 *              - if diophantine solving was called and the return value is SS_OK, this means
-	 *                   lastCertificate satisfies den(lC.A) = 1, den(lC.b) = den(answer)
+	 *              - if the return value is \p SS_INCONSISTENT, this means
+	 *                   \p lastCertificate satisfies \f$lC \cdot A = 0\f$ and \f$lC \cdot b \neq 0 \f$
+	 *              - if diophantine solving was called and the return value is \p SS_OK, this means
+	 *                   \p lastCertificate satisfies \f$ \mathrm{den}(lC \cdot A) = 1, \mathrm{den}(lC \cdot b) = \mathrm{den}(answer) \f$
+	 *              .
 	 * .
 	 * \ingroup padic
 	 */
 	enum SolverLevel {
-		SL_MONTECARLO, SL_LASVEGAS, SL_CERTIFIED
+		SL_MONTECARLO,
+		SL_LASVEGAS,
+		SL_CERTIFIED
 	};    // note: code may assume that each level is 'stronger' than the previous one
 
+	/*****************/
+	/*** Interface ***/
+	/*****************/
 
-	/** \brief interface for the different specialization of p-adic lifting based solvers.
+	/** \brief Interface for the different specialization of p-adic lifting based solvers.
 	 *
-	 * The following type are abstract in the implementation and can be change during the instanciation of the class:
+	 * The following type are abstract in the implementation and can be
+	 * change during the instanciation of the class:
 	 * -  Ring: ring over which entries are defined
 	 * -  Field: finite field for p-adic lifting
 	 * -  RandomPrime: generator of random primes
 	 * -  MethodTraits: type of subalgorithm to use in p-adic lifting (default is DixonTraits)
+	 * .
 	 *
-	 * \ingroup padic	 
-	 */	
- 	template<class Ring, class Field,class RandomPrime, class MethodTraits = DixonTraits>		
- 	class RationalSolver {
+	 * \ingroup padic
+	 */
+	template<class Ring, class Field, class RandomPrime, class MethodTraits = DixonTraits>
+	class RationalSolver {
 
 	public:
-		/** \brief Solve a linear system Ax=b over quotient field of a ring		 
-		 *         giving a random solution if the system is singular and consistent.
+		/** Solve a linear system \c Ax=b over quotient field of a ring
+		 *         giving a random solution if the system is singular and consistent,
 		 *         giving the unique solution if the system is non-singular.
 		 *
-		 * @param num  , Vector of numerators of the solution
-		 * @param den  , The common denominator. 1/den * num is the rational solution of Ax = b.
-		 * @param A    , Matrix of linear system
-		 * @param b    , Right-hand side of system
-		 * @param maxPrimes , maximum number of moduli to try
+		 * @param num  Vector of numerators of the solution
+		 * @param den  The common denominator. 1/den * num is the rational solution of \c Ax=b.
+		 * @param A    Matrix of linear system
+		 * @param b    Right-hand side of system
+		 * @param maxPrimes maximum number of moduli to try
+		 * @param side
 		 *
 		 * @return status of solution
 		 */
 		template<class IMatrix, class Vector1, class Vector2>
-		SolverReturnStatus solve(Vector1& num, Integer& den, const IMatrix& A, const Vector2& b,const bool, int maxPrimes = DEFAULT_MAXPRIMES) const;
-    
-		
-		/** \brief  Solve a nonsingular linear system Ax=b over quotient field of a ring.
+		SolverReturnStatus solve(Vector1& num, Integer& den,
+					 const IMatrix& A, const Vector2& b,
+					 const bool side, int maxPrimes = DEFAULT_MAXPRIMES) const;
+
+
+		/** Solve a nonsingular linear system \c Ax=b over quotient field of a ring,
 		 *          giving the unique solution of the system.
 		 *
-		 * @param num  , Vector of numerators of the solution
-		 * @param den  , The common denominator. 1/den * num is the rational solution of Ax = b.
-		 * @param A   , Matrix of linear system
-		 * @param b   , Right-hand side of system
-		 * @param maxPrimes , maximum number of moduli to try
+		 * @param num  Vector of numerators of the solution
+		 * @param den  The common denominator. 1/den * num is the rational solution of \c Ax=b.
+		 * @param A   Matrix of linear system
+		 * @param b   Right-hand side of system
+		 * @param maxPrimes maximum number of moduli to try
 		 *
 		 * @return status of solution
 		 */
 		template<class IMatrix, class Vector1, class Vector2>
-		SolverReturnStatus solveNonsingular(Vector1& num, Integer& den, const IMatrix& A, const Vector2& b, int maxPrimes = DEFAULT_MAXPRIMES) const;         
-		
-		/** \brief Solve a singular linear system Ax=b over quotient field of a ring.
+		SolverReturnStatus solveNonsingular(Vector1& num, Integer& den,
+						    const IMatrix& A, const Vector2& b,
+						    // bool toto,
+						    int maxPrimes = DEFAULT_MAXPRIMES) const;
+
+		/** brief Solve a singular linear system \c Ax=b over quotient field of a ring,
 		 *         giving a random solution if the system is singular and consistent.
 		 *
-		 * @param num  , Vector of numerators of the solution
-		 * @param den  , The common denominator. 1/den * num is the rational solution of Ax = b.
-		 * @param A   , Matrix of linear system
-		 * @param b   , Right-hand side of system
-		 * @param maxPrimes , maximum number of moduli to try
+		 * @param num  Vector of numerators of the solution
+		 * @param den  The common denominator. 1/den * num is the rational solution of \c Ax=b.
+		 * @param A   Matrix of linear system
+		 * @param b   Right-hand side of system
+		 * @param maxPrimes maximum number of moduli to try
 		 *
 		 * @return status of solution
-		 */	
+		 */
 		template<class IMatrix, class Vector1, class Vector2>
-		SolverReturnStatus solveSingular(Vector1& num, Integer& den, const IMatrix& A, const Vector2& b, int maxPrimes = DEFAULT_MAXPRIMES) const;	
+		SolverReturnStatus solveSingular(Vector1& num, Integer& den,
+						 const IMatrix& A, const Vector2& b,
+						 int maxPrimes = DEFAULT_MAXPRIMES) const;
+
 
-		
 	};
-	
-	
-	
 
+	/***********************/
+	/*** Specialisations ***/
+	/***********************/
+
+	/*-----------*/
+	/* WIEDEMANN */
+	/*-----------*/
 
 #ifdef RSTIMING
 	class WiedemannTimer {
-	public: 
+	public:
 		mutable Timer ttSetup, ttRecon, ttGetDigit, ttGetDigitConvert, ttRingApply, ttRingOther;
 		void clear() const {
 			ttSetup.clear();
@@ -191,22 +220,23 @@ namespace LinBox {// LinBox
 	};
 #endif
 
-
-	/** \brief partial specialization of p-adic based solver with Wiedemann algorithm
+	/** Partial specialization of p-adic based solver with Wiedemann algorithm.
 	 *
 	 *   See the following reference for details on this algorithm:
-	 *   - Douglas H. Wiedemann: Solving sparse linear equations over finite fields. 
-	 *   IEEE Transaction on Information Theory, 32(1), pages 54-62, 1986.
-	 *
-	 *   - Erich Kaltofen and B. David Saunders: On Wiedemann's method of solving sparse linear systems.
-	 *   In Applied Algebra, Algebraic Algorithms and Error Correcting Codes - AAECC'91, volume 539 of Lecture Notes 
-	 *   in Computer Sciences, pages 29-38, 1991.
+	 * @bib
+	 *   - Douglas H. Wiedemann <i>Solving sparse linear equations over
+	 *   finite fields</i>.  IEEE Transaction on Information Theory, 32(1),
+	 *   pages 54-62, 1986.
+	 *   - Erich Kaltofen and B. David Saunders <i>On Wiedemann's method of
+	 *   solving sparse linear systems</i>.  In Applied Algebra, Algebraic
+	 *   Algorithms and Error Correcting Codes - AAECC'91, volume 539 of
+	 *   Lecture Notes in Computer Sciences, pages 29-38, 1991.
 	 *
 	 */
-	template<class Ring, class Field,class RandomPrime>		
+	template<class Ring, class Field,class RandomPrime>
 	class RationalSolver<Ring, Field, RandomPrime, WiedemannTraits> {
 
-	public: 
+	public:
 		typedef Ring                                 RingType;
 		typedef typename Ring::Element                Integer;
 		typedef typename Field::Element               Element;
@@ -214,94 +244,114 @@ namespace LinBox {// LinBox
 		typedef std::vector<Element>              FPolynomial;
 
 	protected:
-		Ring                    _R;
-		RandomPrime      _genprime;
-		mutable Prime       _prime;
-		WiedemannTraits    _traits;
-	 
+		Ring                       _R;
+		mutable RandomPrime _genprime;
+		mutable Prime          _prime;
+		WiedemannTraits       _traits;
+
 #ifdef RSTIMING
 		mutable Timer  tNonsingularSetup,   ttNonsingularSetup,
 			tNonsingularMinPoly, ttNonsingularMinPoly,
 			totalTimer;
-		
+
 		mutable WiedemannTimer   ttNonsingularSolve;
 #endif
 	public:
 
 		/** Constructor
-		 * @param r   , a Ring, set by default
-		 * @param rp  , a RandomPrime generator, set by default		 
+		 * @param r   a Ring, set by default
+		 * @param rp  a RandomPrime generator, set by default
+		 * @param traits
 		 */
-		RationalSolver (const Ring& r = Ring(), const RandomPrime& rp = RandomPrime(DEFAULT_PRIMESIZE), const WiedemannTraits& traits=WiedemannTraits()) : 
-			_R(r), _genprime(rp), _traits(traits) {
-			
+		RationalSolver (const Ring& r = Ring(),
+				const RandomPrime& rp = RandomPrime(DEFAULT_PRIMESIZE),
+				const WiedemannTraits& traits=WiedemannTraits()) :
+			_R(r), _genprime(rp), _traits(traits)
+		{
+
 			++_genprime; _prime=*_genprime;
 #ifdef RSTIMING
 			clearTimers();
 #endif
 		}
-    
-		/**  Constructor with a prime
-		 * @param p   , a Prime
-		 * @param r   , a Ring, set by default
-		 * @param rp  , a RandomPrime generator, set by default		 
+
+		/**  Constructor with a prime.
+		 * @param p   a Prime
+		 * @param r   a Ring, set by default
+		 * @param rp  a RandomPrime generator, set by default
+		 * @param traits
 		 */
-		RationalSolver (const Prime& p, const Ring& r = Ring(), const RandomPrime& rp = RandomPrime(DEFAULT_PRIMESIZE), 
-				const WiedemannTraits& traits=WiedemannTraits()) : 
-			_R(r), _genprime(rp), _prime(p), _traits(traits){
-			
+		RationalSolver (const Prime& p, const Ring& r = Ring(),
+				const RandomPrime& rp = RandomPrime(DEFAULT_PRIMESIZE),
+				const WiedemannTraits& traits=WiedemannTraits()) :
+			_R(r), _genprime(rp), _prime(p), _traits(traits)
+		{
+
 #ifdef RSTIMING
 			clearTimers();
 #endif
 		}
-    
+
 
 		template<class IMatrix, class Vector1, class Vector2>
-		SolverReturnStatus solve(Vector1& num, Integer& den, const IMatrix& A, const Vector2& b,const bool, int maxPrimes = DEFAULT_MAXPRIMES) const;
-		
-		
+		SolverReturnStatus solve(Vector1& num, Integer& den,
+					 const IMatrix& A, const Vector2& b,
+					 const bool s=false, int maxPrimes = DEFAULT_MAXPRIMES) const;
+
+
 		template<class IMatrix, class Vector1, class Vector2>
-		SolverReturnStatus solveNonsingular(Vector1& num, Integer& den, const IMatrix& A, const Vector2& b, int maxPrimes = DEFAULT_MAXPRIMES) const;         
+		SolverReturnStatus solveNonsingular(Vector1& num, Integer& den,
+						    const IMatrix& A, const Vector2& b,
+						    int maxPrimes = DEFAULT_MAXPRIMES) const;
+
 
-		
 		template<class IMatrix, class Vector1, class Vector2>
-		SolverReturnStatus solveSingular(Vector1& num, Integer& den, const IMatrix& A, const Vector2& b, int maxPrimes = DEFAULT_MAXPRIMES) const;	
+		SolverReturnStatus solveSingular(Vector1& num, Integer& den,
+						 const IMatrix& A, const Vector2& b,
+						 int maxPrimes = DEFAULT_MAXPRIMES) const;
 
 
 		template <class IMatrix, class FMatrix, class IVector>
-		void sparseprecondition (const Field&, const IMatrix* , Compose< LambdaSparseMatrix<Ring>,Compose<IMatrix, LambdaSparseMatrix<Ring> > > *&, const FMatrix*, Compose<LambdaSparseMatrix<Field>,Compose<FMatrix,LambdaSparseMatrix<Field> > > *&, const IVector&, IVector&, LambdaSparseMatrix<Ring> *&, LambdaSparseMatrix<Ring> *&, LambdaSparseMatrix<Field> *&, LambdaSparseMatrix<Field> *&) const;
-
- 
-		/*
-		  template <class IMatrix, class FMatrix, class IVector, class FVector>
-		  void precondition (const Field&,
-		  const IMatrix&,
-		  BlackboxArchetype<IVector>*&,
-		  const FMatrix*,
-		  BlackboxArchetype<FVector>*&,
-		  const IVector&,				   
-		  IVector&,
-		  BlackboxArchetype<IVector>*&,
-		  BlackboxArchetype<IVector>*&) const; 
-		*/
-			
-#ifdef RSTIMING	
+		void sparseprecondition (const Field&, const IMatrix* ,
+					 Compose< LambdaSparseMatrix<Ring>,Compose<IMatrix, LambdaSparseMatrix<Ring> > > *&,
+					 const FMatrix*,
+					 Compose<LambdaSparseMatrix<Field>,Compose<FMatrix,LambdaSparseMatrix<Field> > > *&,
+					 const IVector&, IVector&, LambdaSparseMatrix<Ring> *&,
+					 LambdaSparseMatrix<Ring> *&,
+					 LambdaSparseMatrix<Field> *&,
+					 LambdaSparseMatrix<Field> *&) const;
+
+#if 0
+		   template <class IMatrix, class FMatrix, class IVector, class FVector>
+		   void precondition (const Field&,
+				      const IMatrix&,
+				      BlackboxArchetype<IVector>*&,
+				      const FMatrix*,
+				      BlackboxArchetype<FVector>*&,
+				      const IVector&,
+				      IVector&,
+				      BlackboxArchetype<IVector>*&,
+				      BlackboxArchetype<IVector>*&) const;
+#endif
+
+#ifdef RSTIMING
 		void clearTimers() const
 		{
 			ttNonsingularSetup.clear();
 			ttNonsingularMinPoly.clear();
-   		      
+
 			ttNonsingularSolve.clear();
 		}
 
 	public:
 
-		inline std::ostream& printTime(const Timer& timer, const char* title, std::ostream& os, const char* pref = "") const {
+		inline std::ostream& printTime(const Timer& timer, const char* title, std::ostream& os, const char* pref = "") const
+		{
 			if (&timer != &totalTimer)
 				totalTimer += timer;
 			if (timer.count() > 0) {
 				os << pref << title;
-				for (int i=strlen(title)+strlen(pref); i<28; i++) 
+				for (int i=strlen(title)+strlen(pref); i<28; i++)
 					os << ' ';
 				return os << timer << std::endl;
 			}
@@ -309,7 +359,8 @@ namespace LinBox {// LinBox
 				return os;
 		}
 
-		inline std::ostream& printWiedemannTime(const WiedemannTimer& timer, const char* title, std::ostream& os) const{
+		inline std::ostream& printWiedemannTime(const WiedemannTimer& timer, const char* title, std::ostream& os) const
+		{
 			if (timer.ttSetup.count() > 0) {
 				printTime(timer.ttSetup, "Setup", os, title);
 				printTime(timer.ttGetDigit, "Field Apply", os, title);
@@ -321,7 +372,8 @@ namespace LinBox {// LinBox
 			return os;
 		}
 
-		std::ostream& reportTimes(std::ostream& os) const {
+		std::ostream& reportTimes(std::ostream& os) const
+		{
 			totalTimer.clear();
 			printTime(ttNonsingularSetup, "NonsingularSetup", os);
 			printTime(ttNonsingularMinPoly, "NonsingularMinPoly", os);
@@ -330,14 +382,18 @@ namespace LinBox {// LinBox
 			return os;
 		}
 #endif
-	}; // end of specialization for the class RationalSover with Wiedemann traits
 
+		void chooseNewPrime() const { ++_genprime; _prime = *_genprime; }
 
+	}; // end of specialization for the class RationalSover with Wiedemann traits
 
+	/*-----------------*/
+	/* BLOCK WIEDEMANN */
+	/*-----------------*/
 
 #ifdef RSTIMING
 	class BlockWiedemannTimer {
-	public: 
+	public:
 		mutable Timer ttSetup, ttRecon, ttGetDigit, ttGetDigitConvert, ttRingApply, ttRingOther, ttMinPoly;
 		void clear() const {
 			ttSetup.clear();
@@ -362,27 +418,27 @@ namespace LinBox {// LinBox
 	};
 #endif
 
-
-	/** \brief partial specialization of p-adic based solver with block Wiedemann algorithm
+	/** \brief partial specialization of p-adic based solver with block Wiedemann algorithm.
 	 *
 	 *   See the following reference for details on this algorithm:
-	 *   - Douglas H. Wiedemann: Solving sparse linear equations over finite fields. 
-	 *   IEEE Transaction on Information Theory, 32(1), pages 54-62, 1986.
-	 *
-	 *   - Don Coppersmith: Solving homogeneous linear equations over GF(2) via block Wiedemann algorithm.
-	 *   Mathematic of computation, 62(205), pages 335-350, 1994. 
-	 *
-	 *   - Erich Kaltofen and B. David Saunders: On Wiedemann's method of solving sparse linear systems.
-	 *   In Applied Algebra, Algebraic Algorithms and Error Correcting Codes - AAECC'91, volume 539 of Lecture Notes 
-	 *   in Computer Sciences, pages 29-38, 1991.
+	 *   @bib
+	 *   - Douglas H. Wiedemann <i>Solving sparse linear equations over
+	 *   finite fields</i>.  IEEE Transaction on Information Theory, 32(1),
+	 *   pages 54-62, 1986.
+	 *   - Don Coppersmith  <i>Solving homogeneous linear equations over
+	 *   GF(2) via block Wiedemann algorithm.</i> Mathematic of
+	 *   computation, 62(205), pages 335-350, 1994.
 	 *
+	 *   - Erich Kaltofen and B. David Saunders <i>On Wiedemann's method of
+	 *   solving sparse linear systems</i>.  In Applied Algebra, Algebraic
+	 *   Algorithms and Error Correcting Codes, AAECC'91, volume 539 of
+	 *   Lecture Notes in Computer Sciences, pages 29-38, 1991.
 	 *
 	 */
-
-	template<class Ring, class Field,class RandomPrime>		
+	template<class Ring, class Field,class RandomPrime>
 	class RationalSolver<Ring, Field, RandomPrime, BlockWiedemannTraits> {
 
-	public: 
+	public:
 		typedef Ring                                 RingType;
 		typedef typename Ring::Element                Integer;
 		typedef typename Field::Element               Element;
@@ -396,72 +452,86 @@ namespace LinBox {// LinBox
 		RandomPrime           _genprime;
 		mutable Prime            _prime;
 		BlockWiedemannTraits    _traits;
-	 
+
 #ifdef RSTIMING
 		mutable Timer  tNonsingularSetup,   ttNonsingularSetup,
 			tNonsingularBlockMinPoly, ttNonsingularBlockMinPoly,
 			totalTimer;
-		
+
 		mutable BlockWiedemannTimer   ttNonsingularSolve;
 #endif
 	public:
 
-		/* Constructor
-		 * @param r   , a Ring, set by default
-		 * @param rp  , a RandomPrime generator, set by default		 
+		/*! Constructor.
+		 * @param r   a Ring, set by default
+		 * @param rp  a RandomPrime generator, set by default
+		 * @param traits
 		 */
-		RationalSolver (const Ring& r = Ring(), const RandomPrime& rp = RandomPrime(DEFAULT_PRIMESIZE), const BlockWiedemannTraits& traits=BlockWiedemannTraits()) : 
-			_R(r), _genprime(rp), _traits(traits){
-			
+		RationalSolver (const Ring& r = Ring(),
+				const RandomPrime& rp = RandomPrime(DEFAULT_PRIMESIZE),
+				const BlockWiedemannTraits& traits=BlockWiedemannTraits()) :
+			_R(r), _genprime(rp), _traits(traits)
+		{
+
 			++_genprime; _prime=*_genprime;
 #ifdef RSTIMING
 			clearTimers();
 #endif
 		}
-    
-		/* Constructor with a prime
-		 * @param p   , a Prime
-		 * @param r   , a Ring, set by default
-		 * @param rp  , a RandomPrime generator, set by default		 
+
+		/*! Constructor with a prime.
+		 * @param p   a Prime
+		 * @param r   a Ring, set by default
+		 * @param rp  a RandomPrime generator, set by default
+		 * @param traits
 		 */
-		RationalSolver (const Prime& p, const Ring& r = Ring(), const RandomPrime& rp = RandomPrime(DEFAULT_PRIMESIZE), 
-				const BlockWiedemannTraits& traits=BlockWiedemannTraits()) : 
-			_R(r), _genprime(rp), _prime(p), _traits(traits){
-			
+		RationalSolver (const Prime& p, const Ring& r = Ring(),
+				const RandomPrime& rp = RandomPrime(DEFAULT_PRIMESIZE),
+				const BlockWiedemannTraits& traits=BlockWiedemannTraits()) :
+			_R(r), _genprime(rp), _prime(p), _traits(traits)
+		{
+
 #ifdef RSTIMING
 			clearTimers();
 #endif
 		}
-    
+
 		template<class IMatrix, class Vector1, class Vector2>
-		SolverReturnStatus solve(Vector1& num, Integer& den, const IMatrix& A, const Vector2& b,const bool, int maxPrimes = DEFAULT_MAXPRIMES) const;
-    
+		SolverReturnStatus solve(Vector1& num, Integer& den,
+					 const IMatrix& A, const Vector2& b,
+					 const bool s=false, int maxPrimes = DEFAULT_MAXPRIMES) const;
+
 		template<class IMatrix, class Vector1, class Vector2>
-		SolverReturnStatus solveNonsingular(Vector1& num, Integer& den, const IMatrix& A, const Vector2& b, int maxPrimes = DEFAULT_MAXPRIMES) const;         
+		SolverReturnStatus solveNonsingular(Vector1& num, Integer& den,
+						    const IMatrix& A, const Vector2& b,
+						    int maxPrimes = DEFAULT_MAXPRIMES) const;
 
 
 		template<class IMatrix, class Vector1, class Vector2>
-		SolverReturnStatus solveSingular(Vector1& num, Integer& den, const IMatrix& A, const Vector2& b, int maxPrimes = DEFAULT_MAXPRIMES) const;	
+		SolverReturnStatus solveSingular(Vector1& num, Integer& den,
+						 const IMatrix& A, const Vector2& b,
+						 int maxPrimes = DEFAULT_MAXPRIMES) const;
+
 
 
-			
-#ifdef RSTIMING	
+#ifdef RSTIMING
 		void clearTimers() const
 		{
 			ttNonsingularSetup.clear();
 			ttNonsingularBlockMinPoly.clear();
-   		      
+
 			ttNonsingularSolve.clear();
 		}
 
 	public:
 
-		inline std::ostream& printTime(const Timer& timer, const char* title, std::ostream& os, const char* pref = "") const {
+		inline std::ostream& printTime(const Timer& timer, const char* title, std::ostream& os, const char* pref = "") const
+		{
 			if (&timer != &totalTimer)
 				totalTimer += timer;
 			if (timer.count() > 0) {
 				os << pref << title;
-				for (int i=strlen(title)+strlen(pref); i<28; i++) 
+				for (int i=strlen(title)+strlen(pref); i<28; i++)
 					os << ' ';
 				return os << timer << std::endl;
 			}
@@ -469,7 +539,8 @@ namespace LinBox {// LinBox
 				return os;
 		}
 
-		inline std::ostream& printBlockWiedemannTime(const BlockWiedemannTimer& timer, const char* title, std::ostream& os) const{
+		inline std::ostream& printBlockWiedemannTime(const BlockWiedemannTimer& timer, const char* title, std::ostream& os) const
+		{
 			if (timer.ttSetup.count() > 0) {
 				printTime(timer.ttSetup, "Setup", os, title);
 				printTime(timer.ttGetDigit, "Field Apply", os, title);
@@ -481,7 +552,8 @@ namespace LinBox {// LinBox
 			return os;
 		}
 
-		std::ostream& reportTimes(std::ostream& os) const {
+		std::ostream& reportTimes(std::ostream& os) const
+		{
 			totalTimer.clear();
 			printTime(ttNonsingularSetup, "NonsingularSetup", os);
 			printTime(ttNonsingularBlockMinPoly, "NonsingularMinPoly", os);
@@ -493,17 +565,17 @@ namespace LinBox {// LinBox
 #endif
 	}; // end of specialization for the class RationalSover with BlockWiedemann traits
 
-
-
-
-
+	/*-------*/
+	/* DIXON */
+	/*-------*/
 
 #ifdef RSTIMING
 	class DixonTimer {
-	public: 
+	public:
 		mutable Timer ttSetup, ttRecon, ttGetDigit, ttGetDigitConvert, ttRingApply, ttRingOther;
 		mutable int rec_elt;
-		void clear() const {
+		void clear() const
+		{
 			ttSetup.clear();
 			ttRecon.clear();
 			ttGetDigit.clear();
@@ -514,7 +586,8 @@ namespace LinBox {// LinBox
 		}
 
 		template<class RR, class LC>
-		void update(RR& rr, LC& lc) const {
+		void update(RR& rr, LC& lc) const
+		{
 			ttSetup += lc.ttSetup;
 			ttRecon += rr.ttRecon;
 			rec_elt += rr._num_rec;
@@ -526,21 +599,21 @@ namespace LinBox {// LinBox
 	};
 #endif
 
-
-	/** \brief partial specialization of p-adic based solver with Dixon algorithm
+	/** \brief partial specialization of p-adic based solver with Dixon algorithm.
 	 *
 	 *   See the following reference for details on this algorithm:
-	 * 
-	 *  - John D. Dixon: Exact Solution of linear equations using p-adic expansions. Numerische Mathematik, 
-	 *  volume 40, pages 137-141, 1982.
+	 *   @bib
+	 *  - John D. Dixon <i>Exact Solution of linear equations using p-adic
+	 *  expansions</i>. Numerische Mathematik, volume 40, pages 137-141,
+	 *  1982.
 	 *
 	 */
 
-	template<class Ring, class Field,class RandomPrime>		
+	template<class Ring, class Field,class RandomPrime>
 	class RationalSolver<Ring, Field, RandomPrime, DixonTraits> {
-	
-	public:          
-		
+
+	public:
+
 		typedef Ring                                 RingType;
 		typedef typename Ring::Element               Integer;
 		typedef typename Field::Element              Element;
@@ -549,170 +622,196 @@ namespace LinBox {// LinBox
 		// polymorphic 'certificate' generated when level >= SL_CERTIFIED
 		// certificate of inconsistency when any solving routine returns SS_INCONSISTENT
 		// certificate of minimal denominator when findRandomSolutionAndCertificate is called & return is SS_OK
-		mutable VectorFraction<Ring>                 lastCertificate;     
+		mutable VectorFraction<Ring>                 lastCertificate;
 
 		//next 2 fields generated only by findRandomSolutionAndCertificate, when return is SS_OK
 		mutable Integer                              lastZBNumer;               //filled in if level >= SL_CERTIFIED
 		mutable Integer                              lastCertifiedDenFactor;    //filled in if level >= SL_LASVEGAS
 		//note: lastCertificate * b = lastZBNumer / lastCertifiedDenFactor, in lowest form
-		
+
 	protected:
-		
-		mutable RandomPrime                     _genprime;
+
+		mutable RandomPrime             _genprime;
 		mutable Prime                   _prime;
-		Ring                            _R; 
+		Ring                            _R;
 #ifdef RSTIMING
-		mutable Timer       
+		mutable Timer
 		tSetup,           ttSetup,
-			tLQUP,            ttLQUP,
-			tFastInvert,      ttFastInvert,        //only done in deterministic or inconsistent
-			tCheckConsistency,ttCheckConsistency,        //includes lifting the certificate
-			tMakeConditioner, ttMakeConditioner,
-			tInvertBP,        ttInvertBP,              //only done in random
-			tCheckAnswer,     ttCheckAnswer,
-			tCertSetup,       ttCertSetup,        //remaining 3 only done when makeMinDenomCert = true
-			tCertMaking,      ttCertMaking,
-
-			tNonsingularSetup,ttNonsingularSetup,
-			tNonsingularInv,  ttNonsingularInv,
+		tLQUP,            ttLQUP,
+		tFastInvert,      ttFastInvert,        //only done in deterministic or inconsistent
+		tCheckConsistency,ttCheckConsistency,        //includes lifting the certificate
+		tMakeConditioner, ttMakeConditioner,
+		tInvertBP,        ttInvertBP,              //only done in random
+		tCheckAnswer,     ttCheckAnswer,
+		tCertSetup,       ttCertSetup,        //remaining 3 only done when makeMinDenomCert = true
+		tCertMaking,      ttCertMaking,
+
+		tNonsingularSetup,ttNonsingularSetup,
+		tNonsingularInv,  ttNonsingularInv,
+
+		totalTimer;
 
-			totalTimer;
-		
 		mutable DixonTimer
 		ttConsistencySolve, ttSystemSolve, ttCertSolve, ttNonsingularSolve;
 #endif
-		
+
 	public:
-		
+
 		/** Constructor
-		 * @param r   , a Ring, set by default
-		 * @param rp  , a RandomPrime generator, set by default		 
+		 * @param r   a Ring, set by default
+		 * @param rp  a RandomPrime generator, set by default
 		 */
-		RationalSolver (const Ring& r = Ring(), const RandomPrime& rp = RandomPrime(DEFAULT_PRIMESIZE)) : 
-			lastCertificate(r, 0), _genprime(rp), _R(r) 
+		RationalSolver (const Ring& r = Ring(),
+				const RandomPrime& rp = RandomPrime(DEFAULT_PRIMESIZE)) :
+			lastCertificate(r, 0), _genprime(rp), _R(r)
 		{
-			++_genprime; _prime=*_genprime; 
+			++_genprime; _prime=*_genprime;
 #ifdef RSTIMING
 			clearTimers();
 #endif
 		}
-    
-		
+
+
 		/** Constructor, trying the prime p first
-		 * @param p   , a Prime
-		 * @param r   , a Ring, set by default
-		 * @param rp  , a RandomPrime generator, set by default		 
+		 * @param p a Prime
+		 * @param r a Ring, set by default
+		 * @param rp a RandomPrime generator, set by default
 		 */
-		RationalSolver (const Prime& p, const Ring& r = Ring(), const RandomPrime& rp = RandomPrime(DEFAULT_PRIMESIZE)) : 
-			lastCertificate(r, 0), _genprime(rp), _prime(p), _R(r) 
+		RationalSolver (const Prime& p, const Ring& r = Ring(),
+				const RandomPrime& rp = RandomPrime(DEFAULT_PRIMESIZE)) :
+			lastCertificate(r, 0), _genprime(rp), _prime(p), _R(r)
 		{
 #ifdef RSTIMING
 			clearTimers();
 #endif
 		}
-    
-		
-		/** Solve a linear system Ax=b over quotient field of a ring
-		 * 
-		 * @param num  , Vector of numerators of the solution
-		 * @param den  , The common denominator. 1/den * num is the rational solution of Ax = b.
-		 * @param A        , Matrix of linear system
-		 * @param b        , Right-hand side of system
-		 * @param maxPrimes, maximum number of moduli to try
-		 * @param level    , level of certification to be used
+
+
+		/** Solve a linear system \c Ax=b over quotient field of a ring.
+		 *
+		 * @param num Vector of numerators of the solution
+		 * @param den  The common denominator. 1/den * num is the rational solution of \c Ax=b.
+		 * @param A        Matrix of linear system
+		 * @param b        Right-hand side of system
+		 * @param s
+		 * @param maxPrimes maximum number of moduli to try
+		 * @param level    level of certification to be used
 		 *
-		 * @return status of solution. if (return != SS_FAILED), and (level >= SL_LASVEGAS), solution is guaranteed correct.
-		 *   SS_FAILED - all primes used were bad
-		 *   SS_OK - solution found. 
-		 *   SS_INCONSISTENT - system appreared inconsistent. certificate is in lastCertificate if (level >= SL_CERTIFIED)
+		 * @return status of solution. if \c (return != SS_FAILED), and \c (level >= SL_LASVEGAS), solution is guaranteed correct.
+		 *  \c  SS_FAILED - all primes used were bad
+		 *  \c SS_OK - solution found.
+		 *  \c  SS_INCONSISTENT - system appreared inconsistent. certificate is in \p  lastCertificate if \c (level >= SL_CERTIFIED)
 		 */
 		template<class IMatrix, class Vector1, class Vector2>
-		SolverReturnStatus solve(Vector1& num, Integer& den, const IMatrix& A, const Vector2& b, const bool = false, 
-					 const int maxPrimes = DEFAULT_MAXPRIMES, const SolverLevel level = SL_DEFAULT) const;
-		
+		SolverReturnStatus solve(Vector1& num, Integer& den, const IMatrix& A,
+					 const Vector2& b, const bool s = false,
+					 const int maxPrimes = DEFAULT_MAXPRIMES,
+					 const SolverLevel level = SL_DEFAULT) const;
+
 		/** overload so that the bool 'oldMatrix' argument is not accidentally set to true */
-		template <class IMatrix, class Vector1, class Vector2>	
-		SolverReturnStatus solve(Vector1& num, Integer& den, const IMatrix& A, const Vector2& b, const int maxPrimes, 
-					 const SolverLevel level = SL_DEFAULT) const {
+		template <class IMatrix, class Vector1, class Vector2>
+		SolverReturnStatus solve(Vector1& num, Integer& den,
+					 const IMatrix& A, const Vector2& b, const int maxPrimes,
+					 const SolverLevel level = SL_DEFAULT) const
+		{
 			return solve (num, den, A, b, false, maxPrimes, level);
 		}
 
-		/** Solve a nonsingular, square linear system Ax=b over quotient field of a ring
-		 * 
-		 * @param num  , Vector of numerators of the solution
-		 * @param den  , The common denominator. 1/den * num is the rational solution of Ax = b.
-		 * @param A        , Matrix of linear system (it must be square)
-		 * @param b        , Right-hand side of system
-		 * @param maxPrimes, maximum number of moduli to try
+		/** Solve a nonsingular, square linear system \c Ax=b over quotient field of a ring.
 		 *
-		 * @return status of solution. 
-		 *   SS_FAILED - all primes used were bad
-		 *   SS_OK - solution found, guaranteed correct. 
-		 *   SS_SINGULAR - system appreared singular mod all primes. 
+		 * @param num       Vector of numerators of the solution
+		 * @param den       The common denominator. <code>1/den * num</code> is the rational solution of <code>Ax = b</code>
+		 * @param A         Matrix of linear system (it must be square)
+		 * @param b         Right-hand side of system
+		 * @param s         unused
+		 * @param maxPrimes maximum number of moduli to try
+		 *
+		 * @return status of solution :
+		 *   - \c SS_FAILED   all primes used were bad;
+		 *   - \c SS_OK       solution found, guaranteed correct;
+		 *   - \c SS_SINGULAR system appreared singular mod all primes.
+		 *   .
 		 */
 		template<class IMatrix, class Vector1, class Vector2>
-		SolverReturnStatus solveNonsingular(Vector1& num, Integer& den, const IMatrix& A, const Vector2& b, bool = false, 
+		SolverReturnStatus solveNonsingular(Vector1& num, Integer& den, const IMatrix& A,
+						    const Vector2& b, bool s = false,
 						    int maxPrimes = DEFAULT_MAXPRIMES) const;
 
-		/** Solve a general rectangular linear system Ax=b over quotient field of a ring. 
+		/** Solve a general rectangular linear system \c Ax=b over quotient field of a ring.
 		 *  If A is known to be square and nonsingular, calling solveNonsingular is more efficient.
-		 * 
-		 * @param num  , Vector of numerators of the solution
-		 * @param den  , The common denominator. 1/den * num is the rational solution of Ax = b.
-		 * @param A        , Matrix of linear system
-		 * @param b        , Right-hand side of system
-		 * @param maxPrimes, maximum number of moduli to try
-		 * @param level    , level of certification to be used
 		 *
-		 * @return status of solution. if (return != SS_FAILED), and (level >= SL_LASVEGAS), solution is guaranteed correct.
-		 *   SS_FAILED - all primes used were bad
-		 *   SS_OK - solution found. 
-		 *   SS_INCONSISTENT - system appreared inconsistent. certificate is in lastCertificate if (level >= SL_CERTIFIED)
+		 * @param num       Vector of numerators of the solution
+		 * @param den       The common denominator. <code>1/den * num</code> is the rational solution of <code>Ax = b</code>
+		 * @param A         Matrix of linear system
+		 * @param b         Right-hand side of system
+		 * @param maxPrimes maximum number of moduli to try
+		 * @param level     level of certification to be used
+		 *
+		 * @return status of solution. if <code>(return != SS_FAILED)</code>, and <code>(level >= SL_LASVEGAS)</code>, solution is guaranteed correct.
+		 *   - \c SS_FAILED        all primes used were bad
+		 *   - \c SS_OK            solution found.
+		 *   - \c SS_INCONSISTENT  system appreared inconsistent. certificate is in \p lastCertificate if <code>(level >= SL_CERTIFIED)</code>
 		 */
 		template<class IMatrix, class Vector1, class Vector2>
-		SolverReturnStatus solveSingular(Vector1& num, Integer& den, const IMatrix& A, const Vector2& b, 
+		SolverReturnStatus solveSingular(Vector1& num, Integer& den, const IMatrix& A,
+						 const Vector2& b,
 						 int maxPrimes = DEFAULT_MAXPRIMES, const SolverLevel level = SL_DEFAULT) const;
 
-		/** Find a random solution of the general linear system Ax=b over quotient field of a ring.
-		 * 
-		 * @param num  , Vector of numerators of the solution
-		 * @param den  , The common denominator. 1/den * num is the rational solution of Ax = b.
-		 * @param A        , Matrix of linear system
-		 * @param b        , Right-hand side of system
-		 * @param maxPrimes, maximum number of moduli to try
-		 * @param level    , level of certification to be used
+		/** Find a random solution of the general linear system  \c Ax=b over quotient field of a ring.
 		 *
-		 * @return status of solution. if (return != SS_FAILED), and (level >= SL_LASVEGAS), solution is guaranteed correct.
-		 *   SS_FAILED - all primes used were bad
-		 *   SS_OK - solution found. 
-		 *   SS_INCONSISTENT - system appreared inconsistent. certificate is in lastCertificate if (level >= SL_CERTIFIED)
+		 * @param num   Vector of numerators of the solution
+		 * @param den   The common denominator. <code>1/den * num</code> is the rational solution of <code>Ax = b</code>.
+		 * @param A         Matrix of linear system
+		 * @param b         Right-hand side of system
+		 * @param maxPrimes maximum number of moduli to try
+		 * @param level     level of certification to be used
+		 *
+		 * @return status of solution. if <code>(return != SS_FAILED)</code>, and <code>(level >= SL_LASVEGAS)</code>, solution is guaranteed correct.
+		 *  - \c SS_FAILED  all primes used were bad
+		 *  - \c SS_OK  solution found.
+		 *  - \c SS_INCONSISTENT  system appreared inconsistent. certificate is in lastCertificate if <code>(level >= SL_CERTIFIED)</code>
 		 */
 		template<class IMatrix, class Vector1, class Vector2>
-		SolverReturnStatus findRandomSolution(Vector1& num, Integer& den, const IMatrix& A, const Vector2& b, 
-						      int maxPrimes = DEFAULT_MAXPRIMES, const SolverLevel level = SL_DEFAULT) const;
-		
+		SolverReturnStatus findRandomSolution(Vector1& num, Integer& den, const IMatrix& A,
+						      const Vector2& b,
+						      int maxPrimes = DEFAULT_MAXPRIMES,
+						      const SolverLevel level = SL_DEFAULT) const;
+
 		/** Big solving routine to perform random solving and certificate generation.
 		 * Same arguments and return as findRandomSolution, except
 		 *
-		 * @param num  , Vector of numerators of the solution
-		 * @param den  , The common denominator. 1/den * num is the rational solution of Ax = b.
-		 * @param randomSolution,  parameter to determine whether to randomize or not (since solveSingular calls this function as well)
-		 * @param makeMinDenomCert,  determines whether a partial certificate for the minimal denominator of a rational solution is made
+		 * @param num  Vector of numerators of the solution
+		 * @param den  The common denominator. <code>1/den * num</code> is the rational solution of <code>Ax = b</code>
+		 * @param A
+		 * @param b
+		 * @param randomSolution  parameter to determine whether to randomize or not (since solveSingular calls this function as well)
+		 * @param makeMinDenomCert  determines whether a partial certificate for the minimal denominator of a rational solution is made
+		 * @param maxPrimes
+		 * @param level
 		 *
-		 * When (randomSolution == true && makeMinDenomCert == true), 
-		 *   If (level == SL_MONTECARLO) this function has the same effect as calling findRandomSolution.
-		 *   If (level >= SL_LASVEGAS && return == SS_OK), lastCertifiedDenFactor contains a certified factor of the min-solution's denominator.
-		 *   If (level >= SL_CERTIFIED && return == SS_OK), lastZBNumer and lastCertificate are updated as well.
+		 * When <code>(randomSolution == true && makeMinDenomCert == true)</code>,
+		 *  - If <code>(level == SL_MONTECARLO)</code> this function has the same effect as calling findRandomSolution.
+		 *  - If <code>(level >= SL_LASVEGAS && return == SS_OK)</code>, \c lastCertifiedDenFactor contains a certified factor of the min-solution's denominator.
+		 *  - If <code>(level >= SL_CERTIFIED && return == SS_OK)</code>, \c lastZBNumer and \c lastCertificate are updated as well.
 		 *
 		 */
-		template <class IMatrix, class Vector1, class Vector2>	
-		SolverReturnStatus monolithicSolve (Vector1& num, Integer& den, const IMatrix& A, const Vector2& b, 
+		template <class IMatrix, class Vector1, class Vector2>
+		SolverReturnStatus monolithicSolve (Vector1& num, Integer& den, const IMatrix& A,
+						    const Vector2& b,
 						    bool makeMinDenomCert, bool randomSolution,
-						    int maxPrimes = DEFAULT_MAXPRIMES, const SolverLevel level = SL_DEFAULT) const;
+						    int maxPrimes = DEFAULT_MAXPRIMES,
+						    const SolverLevel level = SL_DEFAULT) const;
 
-		Ring getRing() const {return _R;}
+		Ring getRing() const
+		{
+			return _R;
+		}
 
-		void chooseNewPrime() const { ++_genprime; _prime = *_genprime; }
+		void chooseNewPrime() const
+		{
+			++_genprime;
+			_prime = *_genprime;
+		}
 
 #ifdef RSTIMING
 		void clearTimers() const
@@ -729,7 +828,7 @@ namespace LinBox {// LinBox
 			ttNonsingularSetup.clear();
 			ttNonsingularInv.clear();
 
-   		        ttConsistencySolve.clear();
+			ttConsistencySolve.clear();
 			ttSystemSolve.clear();
 			ttCertSolve.clear();
 			ttNonsingularSolve.clear();
@@ -737,12 +836,14 @@ namespace LinBox {// LinBox
 
 	public:
 
-		inline std::ostream& printTime(const Timer& timer, const char* title, std::ostream& os, const char* pref = "") const {
+		inline std::ostream& printTime(const Timer& timer, const char* title,
+					       std::ostream& os, const char* pref = "") const
+		{
 			if (&timer != &totalTimer)
 				totalTimer += timer;
 			if (timer.count() > 0) {
 				os << pref << title;
-				for (int i=strlen(title)+strlen(pref); i<28; i++) 
+				for (int i=strlen(title)+strlen(pref); i<28; i++)
 					os << ' ';
 				return os << timer << std::endl;
 			}
@@ -750,7 +851,9 @@ namespace LinBox {// LinBox
 				return os;
 		}
 
-		inline std::ostream& printDixonTime(const DixonTimer& timer, const char* title, std::ostream& os) const{
+		inline std::ostream& printDixonTime(const DixonTimer& timer, const char* title,
+						    std::ostream& os) const
+		{
 			if (timer.ttSetup.count() > 0) {
 				printTime(timer.ttSetup, "Setup", os, title);
 				printTime(timer.ttGetDigit, "Field Apply", os, title);
@@ -763,7 +866,8 @@ namespace LinBox {// LinBox
 			return os;
 		}
 
-		std::ostream& reportTimes(std::ostream& os) const {
+		std::ostream& reportTimes(std::ostream& os) const
+		{
 			totalTimer.clear();
 			printTime(ttNonsingularSetup, "NonsingularSetup", os);
 			printTime(ttNonsingularInv, "NonsingularInv", os);
@@ -784,191 +888,150 @@ namespace LinBox {// LinBox
 			return os;
 		}
 #endif
-		
-	}; // end of specialization for the class RationalSover with Dixon traits
+
+	}; // end of specialization for the class RationalSolver with Dixon traits
 
 
+	/*----------------*/
+	/* HYBRID Num/Sym */
+	/*----------------*/
 
+	/** \brief solver using a hybrid Numeric/Symbolic computation.
+		template argument Field and RandomPrime are not used.
+		Keep it just for interface consistency.
+	 */
+	template <class Ring, class Field, class RandomPrime>
+	class RationalSolver<Ring, Field, RandomPrime, NumericalTraits>; 
 
-	/** \brief partial specialization of p-adic based solver with a hybrid Numeric/Symbolic computation
+	/** \brief solver using a hybrid Numeric/Symbolic computation.
+	 *
+	 *   This is the original numerix/symbolic solver, now replaced by an enhanced version.
 	 *
 	 *   See the following reference for details on this implementation:
-	 *   - Zhendong Wan: Exactly solve integer linear systems using numerical methods.
+	 *   @bib
+	 *   - Zhendong Wan <i>Exactly solve integer linear systems using numerical methods.</i>
 	 *   Submitted to Journal of Symbolic Computation, 2004.
+	 *   @warning entries in Matrix must be smaller than \f$2^50\f$.
 	 *
 	 */
-	
 	//template argument Field and RandomPrime are not used.
 	//Keep it just for interface consistency.
 	template <class Ring, class Field, class RandomPrime>
-	class RationalSolver<Ring, Field, RandomPrime, NumericalTraits> {
+	class RationalSolver<Ring, Field, RandomPrime, WanTraits> ;
+
+	/*--------------*/
+	/* BLOCK HANKEL */
+	/*--------------*/
+
+	/*! Block Hankel.
+	 * NO DOC
+	 */
+	template<class Ring, class Field,class RandomPrime>
+	class RationalSolver<Ring, Field, RandomPrime, BlockHankelTraits> {
+	public:
+		typedef Ring                                 RingType;
+		typedef typename Ring::Element               Integer;
+		typedef typename Field::Element              Element;
+		typedef typename RandomPrime::Prime_Type     Prime;
 
 	protected:
-		Ring r;
+		RandomPrime                     _genprime;
+		mutable Prime                   _prime;
+		Ring                            _R;
 
 	public:
-		typedef typename Ring::Element Integer;
-
-		RationalSolver(const Ring& _r = Ring()) : r(_r) {}
-
-
-#if  __LINBOX_HAVE_DGETRF && __LINBOX_HAVE_DGETRI
-		template <class IMatrix, class OutVector, class InVector>
-		SolverReturnStatus solve(OutVector& num, Integer& den, const IMatrix& M, const InVector& b) const {
-
-			if(M. rowdim() != M. coldim()) 
-				return SS_FAILED;
-	
-			linbox_check((b.size() == M.rowdim()) && (num. size() == M.coldim()));
-			int n = M. rowdim();
-			integer mentry, bnorm; mentry = 1; bnorm = 1;
-			typename InVector::const_iterator b_p; 
-			Integer tmp_I; integer tmp;
-			typename IMatrix::ConstRawIterator raw_p;
-			for (raw_p = M. rawBegin(); raw_p != M. rawEnd(); ++ raw_p) {
-				r. convert (tmp, *raw_p);
-				tmp = abs (tmp);
-				if (tmp > mentry) mentry = tmp;
-			}
 
-			for (b_p = b. begin(); b_p != b.  end(); ++ b_p) {
-				r. init (tmp_I, *b_p);
-				r. convert (tmp, tmp_I);
-				tmp = abs (tmp);
-				if (tmp > bnorm) bnorm = tmp;
-			}
-				
-			integer threshold; threshold = 1; threshold <<= 50;
-
-			if ((mentry > threshold) || (bnorm > threshold)) return SS_FAILED;
-			else {
-
-				double* DM = new double [n * n];
-				double* Db = new double [n];
-				double* DM_p, *Db_p;
-				typename IMatrix::ConstRawIterator raw_p;
-				for (raw_p = M. rawBegin(), DM_p = DM; raw_p != M. rawEnd(); ++ raw_p, ++ DM_p) {
-					r. convert (tmp, *raw_p);
-					*DM_p = (double) tmp;
-				}
-
-				for (b_p = b. begin(), Db_p = Db; b_p != b. begin() + n; ++ b_p, ++ Db_p) {
-					r. init (tmp_I, *b_p);
-					r. convert (tmp, tmp_I);
-					*Db_p = (double) tmp;
-				}
-
-				integer* numx = new integer[n];
-				integer denx;
-				int ret;
-				ret = cblas_rsol (n, DM, numx, denx, Db);
-				delete[] DM; delete[] Db; 
-
-				if (ret == 0){
-					r. init (den, denx);
-					typename OutVector::iterator num_p;
-					integer* numx_p = numx;
-					for (num_p = num. begin(); num_p != num. end(); ++ num_p, ++ numx_p)
-						r. init (*num_p, *numx_p);
-				}
-				delete[] numx;
-
-				if (ret == 0) return SS_OK;
-				else return SS_FAILED;
-			}
 
+		/** Constructor.
+		 * @param r   a Ring, set by default
+		 * @param rp  a RandomPrime generator, set by default
+		 */
+		RationalSolver (const Ring& r = Ring(),
+				const RandomPrime& rp = RandomPrime(DEFAULT_PRIMESIZE)) :
+			_genprime(rp), _R(r)
+		{
+			_prime=_genprime.randomPrime();
 		}
-#else
-		template <class IMatrix, class OutVector, class InVector>
-		SolverReturnStatus solve(OutVector& num, Integer& den, const IMatrix& M, const InVector& b) const {
-//                     std::cerr<< "dgetrf or dgetri missing" << std::endl;
-                    return SS_FAILED;
-                }
-#endif
 
-	private:
-		//print out a vector
-		template <class Elt>
-		inline static int printvec (const Elt* v, int n);
-		/** Compute the OO-norm of a mtrix */ 
-		inline static double cblas_dOOnorm(const double* M, int m, int n);
-		/** compute the maximam of absolute value of an array*/
-		inline static double cblas_dmax (const int N, const double* a, const int inc);
-		/* apply  y <- Ax */
-		inline static int cblas_dapply (int m, int n, const double* A, const double* x, double* y);
-		inline static int cblas_mpzapply (int m, int n, const double* A, const integer* x, integer* y);
-		//update the numerator; num = num * 2^shift + d;
-		inline static int update_num (integer* num, int n, const double* d, int shift);
-		//update r = r * shift - M d, where norm (r) < 2^32;
-		inline static int update_r_int (double* r, int n, const double* M, const double* d, int shift);
-		//update r = r * shift - M d, where 2^32 <= norm (r) < 2^53
-		inline static int update_r_ll (double* r, int n, const double* M, const double* d, int shift);
-		/** compute  the hadamard bound*/
-		inline static int cblas_hbound (integer& b, int m, int n, const double* M);
-
-#if __LINBOX_HAVE_DGETRF && __LINBOX_HAVE_DGETRI
-		// compute the inverse of a general matrix
-		inline static int cblas_dgeinv(double* M, int n);
-		/* solve Ax = b 
-		 * A, the integer matrix
-		 * b, integer rhs
-		 * Return value
-		 * 0, ok.
-		 * 1, the matrix is not invertible in floating point operations.
-		 * 2, the matrix is not well conditioned.
-		 * 3, incorrect answer, possible ill-conditioned.
+
+		/** Constructor, trying the prime p first.
+		 * @param p   a Prime
+		 * @param r   a Ring, set by default
+		 * @param rp  a RandomPrime generator, set by default
 		 */
-		inline static int cblas_rsol (int n, const double* M, integer* numx, integer& denx, double* b);
-#endif
+		RationalSolver (const Prime& p, const Ring& r = Ring(),
+				const RandomPrime& rp = RandomPrime(DEFAULT_PRIMESIZE)) :
+			_genprime(rp), _prime(p), _R(r)
+		{}
+
+
+		// solve non singular system
+		template<class IMatrix, class Vector1, class Vector2>
+		SolverReturnStatus solveNonsingular(Vector1& num, Integer& den,
+						    const IMatrix& A, const Vector2& b,
+						    size_t blocksize, int maxPrimes = DEFAULT_MAXPRIMES) const;
 	};
 
 
-	template<class Ring, class Field,class RandomPrime>		
- 	class RationalSolver<Ring, Field, RandomPrime, BlockHankelTraits> 
-	{
+
+	/*-----------*/
+	/* SPARSE LU */
+	/*-----------*/
+
+	/*! Sparse LU.
+	 * NO DOC
+	 */
+	template<class Ring, class Field,class RandomPrime>
+	class RationalSolver<Ring, Field, RandomPrime, SparseEliminationTraits> {
 	public:
 		typedef Ring                                 RingType;
 		typedef typename Ring::Element               Integer;
 		typedef typename Field::Element              Element;
 		typedef typename RandomPrime::Prime_Type     Prime;
-	
+
 	protected:
 		RandomPrime                     _genprime;
 		mutable Prime                   _prime;
-		Ring                            _R; 
+		Ring                            _R;
 
 	public:
-		
 
-		/** Constructor
-		 * @param r   , a Ring, set by default
-		 * @param rp  , a RandomPrime generator, set by default		 
+
+		/** Constructor.
+		 * @param r   a Ring, set by default
+		 * @param rp  a RandomPrime generator, set by default
 		 */
-		RationalSolver (const Ring& r = Ring(), const RandomPrime& rp = RandomPrime(DEFAULT_PRIMESIZE)) : 
-			 _genprime(rp), _R(r) 
+		RationalSolver (const Ring& r = Ring(),
+				const RandomPrime& rp = RandomPrime(DEFAULT_PRIMESIZE)) :
+			_genprime(rp), _R(r)
 		{
-			_prime=_genprime.randomPrime(); 
+			_prime=_genprime.randomPrime();
 		}
-    
-		
-		/** Constructor, trying the prime p first
-		 * @param p   , a Prime
-		 * @param r   , a Ring, set by default
-		 * @param rp  , a RandomPrime generator, set by default		 
+
+
+		/** Constructor, trying the prime p first.
+		 * @param p   a Prime
+		 * @param r   a Ring, set by default
+		 * @param rp  a RandomPrime generator, set by default
 		 */
-		RationalSolver (const Prime& p, const Ring& r = Ring(), const RandomPrime& rp = RandomPrime(DEFAULT_PRIMESIZE)) : 
-			_genprime(rp), _prime(p), _R(r) {}
+		RationalSolver (const Prime& p, const Ring& r = Ring(),
+				const RandomPrime& rp = RandomPrime(DEFAULT_PRIMESIZE)) :
+			_genprime(rp), _prime(p), _R(r)
+		{}
 
 
 		// solve non singular system
 		template<class IMatrix, class Vector1, class Vector2>
-		SolverReturnStatus solveNonsingular(Vector1& num, Integer& den, const IMatrix& A, const Vector2& b, size_t blocksize, int maxPrimes = DEFAULT_MAXPRIMES) const;         				
+		SolverReturnStatus solveNonsingular(Vector1& num, Integer& den,
+						    const IMatrix& A, const Vector2& b,
+						    int maxPrimes = DEFAULT_MAXPRIMES) const;
 	};
 
 }
 
+
 #include <linbox/algorithms/rational-solver.inl>
 
-#endif
+#endif //__LINBOX_rational_solver_H
 
 
diff --git a/linbox/algorithms/rational-solver.inl b/linbox/algorithms/rational-solver.inl
index 17c9740..d4046c3 100644
--- a/linbox/algorithms/rational-solver.inl
+++ b/linbox/algorithms/rational-solver.inl
@@ -1,4 +1,5 @@
 /* -*- 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
 /* linbox/algorithms/rational-solver.inl
  * Copyright (C) 2004 Pascal Giorgi
  *
@@ -21,10 +22,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_RATIONAL_SOLVER_INL
-#define __LINBOX_RATIONAL_SOLVER_INL
-
-
+#ifndef __LINBOX_rational_solver_INL
+#define __LINBOX_rational_solver_INL
 
 #include <linbox/blackbox/dense.h>
 #include <linbox/blackbox/sparse.h>
@@ -37,13 +36,14 @@
 #include <linbox/algorithms/rational-reconstruction.h>
 #include <linbox/algorithms/matrix-inverse.h>
 #include <linbox/algorithms/matrix-hom.h>
+#include <linbox/algorithms/gauss.h>
 #include <linbox/algorithms/blackbox-container.h>
 #include <linbox/algorithms/massey-domain.h>
 #include <linbox/algorithms/blackbox-block-container.h>
 #include <linbox/algorithms/block-massey-domain.h>
 #include <linbox/algorithms/vector-fraction.h>
-#include <linbox/ffpack/ffpack.h>
-#include <linbox/fflas/fflas.h>
+#include <fflas-ffpack/ffpack/ffpack.h>
+#include <fflas-ffpack/fflas/fflas.h>
 #include <linbox/solutions/methods.h>
 #include <linbox/util/debug.h>
 #include <linbox/linbox-config.h>
@@ -61,39 +61,51 @@
 #include <linbox/util/timer.h>
 #endif
 
-//#define DEBUG_DIXON 
+//#define DEBUG_DIXON
 //#define DEBUG_INC
 //#define SKIP_NONSINGULAR
 
-namespace LinBox {
-	
+namespace LinBox
+{
+
+	/*! @brief NO DOC !
+	 * @bug why is this hard coded ?
+	*/
 	template <class Prime>
-	inline bool checkBlasPrime(const Prime p) {
+	inline bool checkBlasPrime(const Prime p)
+	{
 		return p < Prime(67108863);
 	}
 
 	template<>
-	inline bool checkBlasPrime(const std::vector<integer> p){
+	inline bool checkBlasPrime(const std::vector<integer> p)
+	{
 		bool tmp=true;
 		for (size_t i=0;i<p.size();++i)
-			if  (p[i] >= integer(67108863)) {tmp=false;break;}
-		
+			if  (p[i] >= integer(67108863)) {
+				tmp=false;
+				break;
+			}
+
 		return tmp;
 	}
 
 
-	// SPECIALIZATION FOR WIEDEMANN 	
+	// SPECIALIZATION FOR WIEDEMANN
 
 	// note: if Vector1 != Vector2 compilation of solve or solveSingluar will fail (via an invalid call to sparseprecondition)!
 	// maybe they should not be templated separately, or sparseprecondition should be rewritten
 
 	template <class Ring, class Field, class RandomPrime>
-	template <class IMatrix, class Vector1, class Vector2>	
-	SolverReturnStatus RationalSolver<Ring,Field,RandomPrime,WiedemannTraits>::solve (Vector1& num, Integer& den,
-											  const IMatrix& A,
-											  const Vector2& b,
-											  const bool old=false,
-											  int maxPrimes) const {
+	template <class IMatrix, class Vector1, class Vector2>
+	SolverReturnStatus
+	RationalSolver<Ring,Field,RandomPrime,WiedemannTraits>::solve (Vector1& num,
+								       Integer& den,
+								       const IMatrix& A,
+								       const Vector2& b,
+								       const bool old,
+								       int maxPrimes) const
+	{
 		SolverReturnStatus status=SS_FAILED;
 
 		switch (A.rowdim() == A.coldim() ? solveNonsingular(num, den, A,b) : SS_SINGULAR) {
@@ -107,46 +119,49 @@ namespace LinBox {
 			status=solveSingular(num, den,A,b);
 			break;
 
-		case SS_FAILED:			
+		case SS_FAILED:
 			break;
 
 		default:
 			throw LinboxError ("Bad return value from solveNonsingular");
-			
+
 		}
 
 		return status;
 	}
 
 	template <class Ring, class Field, class RandomPrime>
-	template <class IMatrix, class Vector1, class Vector2>	
-	SolverReturnStatus RationalSolver<Ring,Field,RandomPrime,WiedemannTraits>::solveNonsingular (Vector1& num, Integer& den,
-												     const IMatrix& A,
-												     const Vector2& b,
-												     int maxPrimes) const {
+	template <class IMatrix, class Vector1, class Vector2>
+	SolverReturnStatus
+	RationalSolver<Ring, Field, RandomPrime, WiedemannTraits>::solveNonsingular( Vector1& num,
+												      Integer& den,
+												      const IMatrix& A,
+												      const Vector2& b,
+												      int maxPrimes) const
+	{
 		// checking if matrix is square
 		linbox_check(A.rowdim() == A.coldim());
-		
+
 		// checking size of system
 		linbox_check(A.rowdim() == b.size());
 
 
 
-		SparseMatrix<Field> *Ap;		
+		SparseMatrix<Field> *Ap;
 		FPolynomial MinPoly;
 		unsigned long  deg;
-		unsigned long issingular = SINGULARITY_THRESHOLD; 			
-		Field *F=NULL;
+		unsigned long issingular = SINGULARITY_THRESHOLD;
+		static Field *F=NULL;
 		Prime prime = _prime;
 		do {
 #ifdef RSTIMING
 			tNonsingularSetup.clear();
 			tNonsingularSetup.start();
-#endif			
+#endif
 			_prime = prime;
 			if (F != NULL) delete F;
-			F=new Field(prime);				
-			MatrixHom::map (Ap, A, *F);
+			F=new Field(prime);
+			Ap = new SparseMatrix<Field>(A, *F);
 			typename Field::RandIter random(*F);
 			BlackboxContainer<Field,SparseMatrix<Field> > Sequence(Ap,*F,random);
 			MasseyDomain<Field,BlackboxContainer<Field,SparseMatrix<Field> > > MD(&Sequence);
@@ -155,7 +170,7 @@ namespace LinBox {
 			ttNonsingularSetup+=tNonsingularSetup;
 			tNonsingularMinPoly.clear();
 			tNonsingularMinPoly.start();
-#endif			
+#endif
 			MD.minpoly(MinPoly,deg);
 #ifdef RSTIMING
 			tNonsingularMinPoly.stop();
@@ -163,52 +178,57 @@ namespace LinBox {
 #endif
 			prime = _genprime.randomPrime();
 		}
-		while(F->isZero(MinPoly.front()) && --issingular );			
-				
+		while(F->isZero(MinPoly.front()) && --issingular );
+
 
-		if (!issingular){	
+		if (!issingular){
 			std::cerr<<"The Matrix is singular\n";
 			delete Ap;
 			return SS_SINGULAR;
-		}			
+		}
 		else {
- 			//std::cerr<<"A:\n";
-			//A.write(std::cerr);
- 			//std::cerr<<"A mod p:\n";
- 			//Ap->write(std::cerr);
-			//Ring r;
-			//VectorDomain<Ring> VD(r);
-			//std::cerr<<"b:\n";		
-			//VD.write(std::cerr,b)<<std::endl;
-			//std::cerr<<"prime: "<<_prime<<std::endl;
-			
-			//std::cerr<<"non singular\n";
-
-			//CSRSparseMatrix<Field> csr_Ap(*F,*Ap);
-
-			//typedef CSRSparseMatrix<Field> FMatrix;
+#if 0
+			std::cerr<<"A:\n";
+			A.write(std::cerr);
+			std::cerr<<"A mod p:\n";
+			Ap->write(std::cerr);
+			Ring r;
+			VectorDomain<Ring> VD(r);
+			std::cerr<<"b:\n";
+			VD.write(std::cerr,b)<<std::endl;
+			std::cerr<<"prime: "<<_prime<<std::endl;
+
+			std::cerr<<"non singular\n";
+
+			CSRSparseMatrix<Field> csr_Ap(*F,*Ap);
+
+			typedef CSRSparseMatrix<Field> FMatrix;
+#endif
 			typedef SparseMatrix<Field> FMatrix;
 
 			typedef WiedemannLiftingContainer<Ring, Field, IMatrix, FMatrix, FPolynomial> LiftingContainer;
-			
+
 			LiftingContainer lc(_R, *F, A, *Ap, MinPoly, b,_prime);
-			
+
 			RationalReconstruction<LiftingContainer> re(lc);
-			
+
 			re.getRational(num, den, 0);
 #ifdef RSTIMING
 			ttNonsingularSolve.update(re, lc);
 #endif
 			return SS_OK;
 		}
-	}       
+	}
 
 	template <class Ring, class Field, class RandomPrime>
-	template <class IMatrix, class Vector1, class Vector2>	
-	SolverReturnStatus RationalSolver<Ring,Field,RandomPrime,WiedemannTraits>::solveSingular (Vector1& num, Integer& den,
-												  const IMatrix& A,
-												  const Vector2& b, 
-												  int maxPrimes) const {
+	template <class IMatrix, class Vector1, class Vector2>
+	SolverReturnStatus
+	RationalSolver<Ring,Field,RandomPrime,WiedemannTraits>:: solveSingular (Vector1& num,
+										     Integer& den,
+										     const IMatrix& A,
+										     const Vector2& b,
+										     int maxPrimes) const
+	{
 		std::cerr<<"in singular solver\n";
 
 		typedef std::vector<typename Field::Element> FVector;
@@ -216,7 +236,7 @@ namespace LinBox {
 		typedef SparseMatrix<Field>                  FMatrix;
 
 		// checking size of system
-		linbox_check(A.rowdim() == b.size());		
+		linbox_check(A.rowdim() == b.size());
 
 		typedef LambdaSparseMatrix<Ring>  IPreconditioner;
 		typedef LambdaSparseMatrix<Field> FPreconditioner;
@@ -224,17 +244,17 @@ namespace LinBox {
 		typedef Compose<IPreconditioner,Compose<IMatrix,IPreconditioner> > IPrecondMatrix;
 		typedef Compose<FPreconditioner,Compose<FMatrix,FPreconditioner> > FPrecondMatrix;
 
-		FMatrix               *Ap;			
+		FMatrix               *Ap;
 		IPreconditioner *P     =NULL;
 		IPreconditioner *Q     =NULL;
 		FPreconditioner *Pmodp =NULL;
 		FPreconditioner *Qmodp =NULL;
 		IPrecondMatrix  *PAQ   =NULL;
-		FPrecondMatrix  *PApQ  =NULL;				
+		FPrecondMatrix  *PApQ  =NULL;
 		IVector Pb;
 
 
-		FPolynomial MinPoly;		
+		FPolynomial MinPoly;
 		unsigned long  deg;
 		unsigned long badprecondition = BAD_PRECONTITIONER_THRESHOLD;
 		Field *F;
@@ -248,16 +268,16 @@ namespace LinBox {
 				delete PAQ;
 			}
 			_prime = prime;
-			F=new Field(prime);//std::cerr<<"here\n";				
-			MatrixHom::map (Ap, A, *F);//std::cerr<<"after\n";
+			F=new Field(prime);//std::cerr<<"here\n";
+			Ap = new FMatrix(A, *F);
 			sparseprecondition (*F,&A,PAQ,Ap,PApQ,b,Pb,P,Q,Pmodp,Qmodp);
 			typename Field::RandIter random(*F);
 			BlackboxContainer<Field,FPrecondMatrix> Sequence(PApQ,*F,random);
 			MasseyDomain<Field,BlackboxContainer<Field,FPrecondMatrix> > MD(&Sequence);
-			
-			MD.minpoly(MinPoly,deg); 
+
+			MD.minpoly(MinPoly,deg);
 			//MinPoly.resize(3);MinPoly[0]=1;MinPoly[1]=2;MinPoly[2]=1;
-			prime = _genprime.randomPrime();			
+			prime = _genprime.randomPrime();
 			F->add(tmp,MinPoly.at(1),MinPoly.front());
 		}
 		while(((F->isZero(tmp) || MinPoly.size() <=2) && --badprecondition ));
@@ -269,106 +289,111 @@ namespace LinBox {
 		std::cerr<<"prime is: "<<_prime<<std::endl;
 		if (!badprecondition){
 			std::cerr<<"Bad Preconditionner\n";
-		
+
 			delete Ap;
 			if (PAQ  != NULL) delete PAQ;
-			if (PApQ != NULL) delete PApQ;	
+			if (PApQ != NULL) delete PApQ;
 			if (P    != NULL) delete P;
 			if (Q    != NULL) delete Q;
 
 			return SS_BAD_PRECONDITIONER;
-		}				      		      				
-		else {	
-			
+		}
+		else {
+
 			MinPoly.erase(MinPoly.begin());
-			
+
 			typedef WiedemannLiftingContainer<Ring, Field, IPrecondMatrix, FPrecondMatrix, FPolynomial> LiftingContainer;
 			std::cerr<<"before lc\n";
 			LiftingContainer lc(_R, *F, *PAQ, *PApQ, MinPoly, Pb, _prime);
 			std::cerr<<"constructing lifting container of length: "<<lc.length()<<std::endl;
-			
+
 			RationalReconstruction<LiftingContainer> re(lc,_R,2);
-			
-			re.getRational(num, den, 0); 
+
+			re.getRational(num, den, 0);
 
 
 			if (Q    != NULL) {
 
 				/*
-				  typename Ring::Element lden;
-				  _R. init (lden, 1);
-				  typename Vector1::iterator p;		
-				  for (p = answer.begin(); p != answer.end(); ++ p)
-				  _R. lcm (lden, lden, p->second);
+				   typename Ring::Element lden;
+				   _R. init (lden, 1);
+				   typename Vector1::iterator p;
+				   for (p = answer.begin(); p != answer.end(); ++ p)
+				   _R. lcm (lden, lden, p->second);
 
-				*/
+*/
 
 				IVector Qx(num.size());
 
 				/*
-				  typename IVector::iterator p_x;
-						
-				  for (p = answer.begin(), p_x = x. begin(); p != answer.end(); ++ p, ++ p_x) {					
-				  _R. mul (*p_x, p->first, lden);					
-				  _R. divin (*p_x, p->second);					
-				  }
-				*/
+				   typename IVector::iterator p_x;
+
+				   for (p = answer.begin(), p_x = x. begin(); p != answer.end(); ++ p, ++ p_x) {
+				   _R. mul (*p_x, p->first, lden);
+				   _R. divin (*p_x, p->second);
+				   }
+				   */
 
 				Q->apply(Qx, num);
 				/*
-				  for (p=answer.begin(),p_x=Qx.begin(); p != answer.end();++p,++p_x){
-				  p->first=*p_x;
-				  p->second=lden;
-				  }					
-				*/
+				   for (p=answer.begin(),p_x=Qx.begin(); p != answer.end();++p,++p_x){
+				   p->first=*p_x;
+				   p->second=lden;
+				   }
+				   */
 				num = Qx;
 			}
 
 
 			delete Ap;
 			if (PAQ  != NULL) delete PAQ;
-			if (PApQ != NULL) delete PApQ;	
+			if (PApQ != NULL) delete PApQ;
 			if (P    != NULL) delete P;
 			if (Q    != NULL) delete Q;
-			
+
 			return SS_OK;
 		}
-	}       
+	}
 
 
 	template <class Ring, class Field, class RandomPrime>
 	template <class IMatrix, class FMatrix, class IVector>
-	void RationalSolver<Ring,Field,RandomPrime,WiedemannTraits>::sparseprecondition (const Field& F,
-											 const IMatrix *A,
-											 Compose<LambdaSparseMatrix<Ring>,Compose<IMatrix,LambdaSparseMatrix<Ring> > > *&PAQ,
-											 const FMatrix *Ap,
-											 Compose<LambdaSparseMatrix<Field>,Compose<FMatrix,LambdaSparseMatrix<Field> > > *&PApQ,
-											 const IVector& b,
-											 IVector& Pb,
-											 LambdaSparseMatrix<Ring> *&P,
-											 LambdaSparseMatrix<Ring> *&Q,
-											 LambdaSparseMatrix<Field> *&Pmodp,
-											 LambdaSparseMatrix<Field> *&Qmodp) const
+	void
+	RationalSolver<Ring,Field,RandomPrime,WiedemannTraits>::sparseprecondition (const Field& F,
+										     const IMatrix *A,
+										     Compose<LambdaSparseMatrix<Ring>, Compose<IMatrix, LambdaSparseMatrix<Ring> > > *&PAQ,
+										     const FMatrix *Ap,
+										     Compose<LambdaSparseMatrix<Field>, Compose<FMatrix, LambdaSparseMatrix<Field> > > *&PApQ,
+										     const IVector& b,
+										     IVector& Pb,
+										     LambdaSparseMatrix<Ring> *&P,
+										     LambdaSparseMatrix<Ring> *&Q,
+										     LambdaSparseMatrix<Field> *&Pmodp,
+										     LambdaSparseMatrix<Field> *&Qmodp) const
 	{
-		// 		std::cerr<<"A:\n";
-		// 		A->write(std::cerr);
-		// 		std::cerr<<"A mod p:\n";
-		// 		Ap->write(std::cerr);
+#if 0
+		std::cerr<<"A:\n";
+		A->write(std::cerr);
+		std::cerr<<"A mod p:\n";
+		Ap->write(std::cerr);
+#endif
 		VectorDomain<Ring> VD(_R);
-		// 		std::cerr<<"b:\n";		
-		// 		VD.write(std::cerr,b)<<std::endl;
-		
+#if 0
+		std::cerr<<"b:\n";
+		VD.write(std::cerr,b)<<std::endl;
+#endif
+
 
 		commentator.start ("Constructing sparse preconditioner");
 		typedef LambdaSparseMatrix<Ring>  IPreconditioner;
 		typedef LambdaSparseMatrix<Field> FPreconditioner;
 
 		size_t min_dim = A->coldim() < A->rowdim() ? A->coldim() : A->rowdim();
-		
-		P = new  IPreconditioner(_R,min_dim,A->rowdim(),2,3.);       
+
+		P = new  IPreconditioner(_R,min_dim,A->rowdim(),2,3.);
 		// 		std::cerr<<"P:\n";
 		// 		P->write(std::cerr);
-		
+
 		Q = new  IPreconditioner(_R,A->coldim(),min_dim,2,3.);
 		// 		std::cerr<<"Q:\n";
 		// 		Q->write(std::cerr);
@@ -382,237 +407,261 @@ namespace LinBox {
 		// 		std::cerr<<"Pb:\n";
 		// 		VD.write(std::cerr,Pb)<<std::endl;
 
-		Pmodp = new FPreconditioner(F,*P);       
+		Pmodp = new FPreconditioner(F,*P);
 		std::cerr<<"P mod p completed\n";
 		Qmodp = new FPreconditioner(F,*Q);
 		std::cerr<<"Q mod p completed\n";
 
 		Compose<FMatrix,FPreconditioner> *ApQ;
 		ApQ = new Compose<FMatrix,FPreconditioner> (Ap,Qmodp);
-		
+
 		PApQ = new Compose<FPreconditioner, Compose<FMatrix,FPreconditioner> > (Pmodp, ApQ);
 		std::cerr<<"Preconditioning done\n";
 		commentator.stop ("done");
-		
+
 	}
-											  
 
-	/*
-	  template <class Ring, class Field, class RandomPrime>
-	  template <class IMatrix, class FMatrix, class IVector,class FVector>
-	  void RationalSolver<Ring,Field,RandomPrime,WiedemannTraits>::precondition (const Field&                          F,
-	  const IMatrix&                        A,
-	  BlackboxArchetype<IVector>        *&PAQ,
-	  const FMatrix                       *Ap,
-	  BlackboxArchetype<FVector>       *&PApQ,
-	  const IVector                        &b,
-	  IVector                             &Pb,
-	  BlackboxArchetype<IVector>          *&P,
-	  BlackboxArchetype<IVector>          *&Q) const
-	  {
-	  switch (_traits.preconditioner() ) {
-			
-	  case WiedemannTraits::BUTTERFLY:
-	  commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-	  <<"ERROR: Butterfly preconditioner not implemented yet. Sorry." << std::endl;		    
-
-	  case WiedemannTraits::SPARSE:
-	  {
-	  commentator.start ("Constructing sparse preconditioner");
-							
-	  P = new LambdaSparseMatrix<Ring> (_R,Ap->coldim(),Ap->rowdim(),2);
-				
-	  PAQ = new Compose<LambdaSparseMatrix<Ring>, IMatrix> (*P,A);
-				
-	  P->apply(Pb,b);
-				
-	  LambdaSparseMatrix<Field> Pmodp(F,*P);
-				
-	  PApQ = new Compose<LambdaSparseMatrix<Field>, FMatrix> (Pmodp, *Ap);
-				
-	  commentator.stop ("done");
-	  break;
-	  }
-		
-	  case WiedemannTraits::TOEPLITZ:
-	  commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-	  << "ERROR: Toeplitz preconditioner not implemented yet. Sorry." << std::endl;
-
-	  case WiedemannTraits::NONE:
-	  throw PreconditionFailed (__FUNCTION__, __LINE__, "preconditioner is BUTTERFLY, SPARSE, or TOEPLITZ");
-
-	  default:
-	  throw PreconditionFailed (__FUNCTION__, __LINE__, "preconditioner is BUTTERFLY, SPARSE, or TOEPLITZ");
-	  }
-
-
-
-	  }
-	*/
-	
-	
-	// SPECIALIZATION FOR BLOCK WIEDEMANN 	
+
+#if 0
+	template <class Ring, class Field, class RandomPrime>
+	template <class IMatrix, class FMatrix, class IVector,class FVector>
+	void RationalSolver<Ring,Field,RandomPrime,WiedemannTraits>::
+	precondition (const Field&                          F,
+		      const IMatrix&                        A,
+		      BlackboxArchetype<IVector>        *&PAQ,
+		      const FMatrix                       *Ap,
+		      BlackboxArchetype<FVector>       *&PApQ,
+		      const IVector                        &b,
+		      IVector                             &Pb,
+		      BlackboxArchetype<IVector>          *&P,
+		      BlackboxArchetype<IVector>          *&Q) const
+	{
+		switch (_traits.preconditioner() ) {
+
+		case WiedemannTraits::BUTTERFLY:
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+			<<"ERROR: Butterfly preconditioner not implemented yet. Sorry." << std::endl;
+
+		case WiedemannTraits::SPARSE:
+			{
+				commentator.start ("Constructing sparse preconditioner");
+
+				P = new LambdaSparseMatrix<Ring> (_R,Ap->coldim(),Ap->rowdim(),2);
+
+				PAQ = new Compose<LambdaSparseMatrix<Ring>, IMatrix> (*P,A);
+
+				P->apply(Pb,b);
+
+				LambdaSparseMatrix<Field> Pmodp(F,*P);
+
+				PApQ = new Compose<LambdaSparseMatrix<Field>, FMatrix> (Pmodp, *Ap);
+
+				commentator.stop ("done");
+				break;
+			}
+
+		case WiedemannTraits::TOEPLITZ:
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+			<< "ERROR: Toeplitz preconditioner not implemented yet. Sorry." << std::endl;
+
+		case WiedemannTraits::NONE:
+			throw PreconditionFailed (__func__, __LINE__, "preconditioner is BUTTERFLY, SPARSE, or TOEPLITZ");
+
+		default:
+			throw PreconditionFailed (__func__, __LINE__, "preconditioner is BUTTERFLY, SPARSE, or TOEPLITZ");
+		}
+
+
+
+	}
+#endif
+
+
+	// SPECIALIZATION FOR BLOCK WIEDEMANN
 
 	// note: if Vector1 != Vector2 compilation of solve or solveSingluar will fail (via an invalid call to sparseprecondition)!
 	// maybe they should not be templated separately, or sparseprecondition should be rewritten
 
 	template <class Ring, class Field, class RandomPrime>
-	template <class IMatrix, class Vector1, class Vector2>	
-	SolverReturnStatus RationalSolver<Ring,Field,RandomPrime,BlockWiedemannTraits>::solve (Vector1& num, Integer& den,
-											       const IMatrix& A,
-											       const Vector2& b,
-											       const bool old=false,
-											       int maxPrimes) const {
+	template <class IMatrix, class Vector1, class Vector2>
+	SolverReturnStatus
+	RationalSolver<Ring,Field,RandomPrime,BlockWiedemannTraits>::solve (Vector1& num, Integer& den,
+										     const IMatrix& A,
+										     const Vector2& b,
+										     const bool old,
+										     int maxPrimes) const
+	{
 		SolverReturnStatus status=SS_FAILED;
-		
+
 		switch (A.rowdim() == A.coldim() ? solveNonsingular(num, den, A,b) : SS_SINGULAR) {
-			
+
 		case SS_OK:
 			status=SS_OK;
 			break;
-			
+
 		case SS_SINGULAR:
 			std::cerr<<"switching to singular\n";
 			//status=solveSingular(num, den,A,b);
 			break;
 
-		case SS_FAILED:			
+		case SS_FAILED:
 			break;
 
 		default:
 			throw LinboxError ("Bad return value from solveNonsingular");
-			
+
 		}
 
 		return status;
 	}
 
 	template <class Ring, class Field, class RandomPrime>
-	template <class IMatrix, class Vector1, class Vector2>	
-	SolverReturnStatus RationalSolver<Ring,Field,RandomPrime,BlockWiedemannTraits>::solveNonsingular (Vector1& num, Integer& den,
-													  const IMatrix& A,
-													  const Vector2& b,
-													  int maxPrimes) const {
+	template <class IMatrix, class Vector1, class Vector2>
+	SolverReturnStatus
+	RationalSolver<Ring,Field,RandomPrime,BlockWiedemannTraits>::solveNonsingular (Vector1& num,
+												      Integer& den,
+												      const IMatrix& A,
+												      const Vector2& b,
+												      int maxPrimes) const
+	{
 		// checking if matrix is square
 		linbox_check(A.rowdim() == A.coldim());
-	
+
 		// checking size of system
 		linbox_check(A.rowdim() == b.size());
 
 		size_t m,n;
 		integer tmp,tmproot;
 		tmp=A.coldim();
-		//m = n = tmp.bitsize();
-		//m = n = sqrt(tmp);
-		//m = n = root(tmp,3); // wrong # args to root. -bds
+#if 0
+		m = n = tmp.bitsize();
+		m = n = sqrt(tmp);
+		m = n = root(tmp,3); // wrong # args to root. -bds
+#endif
 		m = n = root(tmproot, tmp,3);
 		m = n = tmproot;
-		std::cout<<"block factor= "<<m<<"\n";;
-		typedef SparseMatrix<Field> FMatrix;		
-		FMatrix *Ap;
+		// 		std::cout<<"block factor= "<<m<<"\n";;
+		typedef SparseMatrix<Field> FMatrix;
 
 		Field F(_prime);
-		MatrixHom::map (Ap, A, F);
-		Transpose<FMatrix > Bp(*Ap);
-		std::cout<<"Ap:\n";
-		Ap->write(std::cout);
+		FMatrix Ap(A, F);
+		Transpose<FMatrix > Bp(Ap);
+		// 		std::cout<<"Ap:\n";
+		// 		Ap.write(std::cout);
 		typedef BlockWiedemannLiftingContainer<Ring, Field, Transpose<IMatrix >, Transpose<FMatrix > > LiftingContainer;
-		
+
 		Transpose<IMatrix> B(A);
-		
+
 		LiftingContainer lc(_R, F, B, Bp, b,_prime, m, n);
-	
+
 		RationalReconstruction<LiftingContainer> re(lc);
-		
+
 		re.getRational(num, den, 0);
-#ifdef RSTIMING		
+#ifdef RSTIMING
 		ttNonsingularSolve.update(re, lc);
 #endif
-		delete Ap;		
-		
-		return SS_OK;	
-	}       
+
+		return SS_OK;
+	}
 
 	// END OF SPECIALIZATION FOR BLOCK WIEDEMANN
 
-		   
+
 
 	// SPECIALIZATION FOR DIXON
-	
+
 	template <class Ring, class Field, class RandomPrime>
-	template <class IMatrix, class Vector1, class Vector2>	
-	SolverReturnStatus RationalSolver<Ring,Field,RandomPrime,DixonTraits>::solve 
-	(Vector1& num, Integer& den, const IMatrix& A, const Vector2& b, const bool old, int maxPrimes, const SolverLevel level ) const {
+	template <class IMatrix, class Vector1, class Vector2>
+	SolverReturnStatus
+	RationalSolver<Ring,Field,RandomPrime,DixonTraits>::solve (Vector1& num,
+								   Integer& den,
+								   const IMatrix& A,
+								   const Vector2& b,
+								   const bool old,
+								   int maxP,
+								   const SolverLevel level ) const
+	{
 
-		SolverReturnStatus status;	
-		while (maxPrimes > 0){
+		SolverReturnStatus status;
+		int maxPrimes=maxP;
+		while (maxPrimes > 0)
+		{
 #ifdef SKIP_NONSINGULAR
-			switch (SS_SINGULAR) {
+			switch (SS_SINGULAR)
 #else
-				switch (A.rowdim() == A.coldim() ? solveNonsingular(num, den,A,b,old,maxPrimes) : SS_SINGULAR) {
+				switch (A.rowdim() == A.coldim() ? solveNonsingular(num, den,A,b,old,maxPrimes) : SS_SINGULAR)
 #endif
-					
+				{
+
 				case SS_OK:
 #ifdef DEBUG_DIXON
 					std::cout <<"nonsingular worked\n";
 #endif
 					return SS_OK;
 					break;
-					
+
 				case SS_SINGULAR:
 #ifdef DEBUG_DIXON
 					std::cout<<"switching to singular\n";
 #endif
 					status = solveSingular(num, den,A,b,maxPrimes,level);
-					if (status != SS_FAILED) 
+					if (status != SS_FAILED)
 						return status;
 					break;
-					
+
 				case SS_FAILED:
 					std::cout <<"nonsingular failed\n";
 					break;
-					
+
 				default:
 					throw LinboxError ("Bad return value from solveNonsingular");
-					
+
 				}
-				maxPrimes--;
-				if (maxPrimes > 0) chooseNewPrime();
-			}
-			return SS_FAILED;
+			maxPrimes--;
+			if (maxPrimes > 0) chooseNewPrime();
 		}
-		
+		return SS_FAILED;
+	}
 
 
 	template <class Ring, class Field, class RandomPrime>
-	template <class IMatrix, class Vector1, class Vector2>	
-	SolverReturnStatus RationalSolver<Ring,Field,RandomPrime,DixonTraits>::solveNonsingular 
-	(Vector1& num, Integer& den, const IMatrix& A, const Vector2& b, bool oldMatrix, int maxPrimes) const {
+	template <class IMatrix, class Vector1, class Vector2>
+	SolverReturnStatus
+	RationalSolver<Ring,Field,RandomPrime,DixonTraits>::solveNonsingular(Vector1& num,
+												     Integer& den,
+												     const IMatrix& A,
+												     const Vector2& b,
+												     bool oldMatrix,
+												     int maxPrimes) const
+	{
 
-	
+		// std::cout<<"DIXON\n\n\n\n";
 #ifdef DEBUG_DIXON
 		std::cout << "entering nonsingular solver\n";
 #endif
 		int trials = 0, notfr;
 
 		// history sensitive data for optimal reason
-		static const IMatrix* IMP = 0;
-		
-		static BlasBlackbox<Field>* FMP;
+		static const IMatrix* IMP;
+
+		BlasBlackbox<Field>* FMP = NULL;
 		Field *F=NULL;
 
-		do {
-			if (trials == maxPrimes) return SS_SINGULAR;			
+		do
+		{
+#if 0
+			if (trials == maxPrimes) return SS_SINGULAR;
 			if (trials != 0) chooseNewPrime();
 			trials++;
+#endif
 #ifdef DEBUG_DIXON
 			//std::cout << "_prime: "<<_prime<<"\n";
 			std::cout<<"A:=\n";
 			A.write(std::cout);
 			std::cout<<"b:=\n";
 			for (size_t i=0;i<b.size();++i) std::cout<<b[i]<<" , ";
-			std::cout<<std::endl;			
-#endif		       
+			std::cout<<std::endl;
+#endif
 #ifdef RSTIMING
 			tNonsingularSetup.start();
 #endif
@@ -623,36 +672,42 @@ namespace LinBox {
 			linbox_check(A.rowdim() == A.coldim());
 			linbox_check(A.rowdim() == b.size());
 
-			LinBox::integer tmp;		
-		
+			LinBox::integer tmp;
+
 			// if input matrix A is different one.
 			if (!oldMatrix) {
-				
-				//delete IMP;
-		
+				if (trials == maxPrimes) return SS_SINGULAR;
+				if (trials != 0) chooseNewPrime();
+				trials++;
+
 				// Could delete a non allocated matrix -> segfault
-				//delete FMP;
-		
-				IMP = &A;					
-		
-				F= new Field (_prime);					
-		
-				//FMP = new BlasBlackbox<Field>(*F, A.rowdim(),A.coldim());
-			
-				MatrixHom::map (FMP, A, *F); // use MatrixHom to reduce matrix PG 2005-06-16
-				//typename BlasBlackbox<Field>::RawIterator iter_p  = FMP->rawBegin();
-				//typename IMatrix::ConstRawIterator iter  = A.rawBegin();
-				//for (;iter != A.rawEnd();++iter,++iter_p)
-				//	F->init(*iter_p, _R.convert(tmp,*iter));
+				if (FMP != NULL) delete FMP;
+
+				IMP = &A;
+
+				if (F != NULL) delete F;
+
+				F= new Field (_prime);
+
+				FMP = new BlasBlackbox<Field>(*F, A.rowdim(),A.coldim());
+
+				MatrixHom::map (*FMP, A, *F); // use MatrixHom to reduce matrix PG 2005-06-16
+#if 0
+				typename BlasBlackbox<Field>::RawIterator iter_p  = FMP->rawBegin();
+				typename IMatrix::ConstRawIterator iter  = A.rawBegin();
+				for (;iter != A.rawEnd();++iter,++iter_p)
+					F->init(*iter_p, _R.convert(tmp,*iter));
+#endif
 
 #ifdef DEBUG_DIXON
 				std::cout<< "p = ";
 				F->write(std::cout);
 				std::cout<<" A mod p :=\n";
 				FMP->write(std::cout);
-#endif				
-			
+#endif
+
 				if (!checkBlasPrime(_prime)){
+					if (FMP != NULL) delete FMP;
 					FMP = new BlasBlackbox<Field>(*F, A.rowdim(),A.coldim());
 					notfr = MatrixInverse::matrixInverseIn(*F,*FMP);
 				}
@@ -663,13 +718,15 @@ namespace LinBox {
 					tNonsingularSetup.stop();
 					ttNonsingularSetup += tNonsingularSetup;
 					tNonsingularInv.start();
-#endif				
+#endif
 					BMDF.invin(*invA, *FMP, notfr); //notfr <- nullity
-					delete FMP;
+					if (FMP != NULL) delete FMP;
 					FMP = invA;
-					// 					std::cout << "notfr = " << notfr << std::endl;
-					// 					std::cout << "inverse mod p: " << std::endl;
-					// 					FMP->write(std::cout, *F);
+#if 0
+					std::cout << "notfr = " << notfr << std::endl;
+					std::cout << "inverse mod p: " << std::endl;
+					FMP->write(std::cout, *F);
+#endif
 #ifdef RSTIMING
 					tNonsingularInv.stop();
 					ttNonsingularInv += tNonsingularInv;
@@ -688,56 +745,77 @@ namespace LinBox {
 #ifdef DEBUG_DIXON
 		std::cout<<"A^-1 mod p :=\n";
 		FMP->write(std::cout);
-#endif		
+#endif
 
-		typedef DixonLiftingContainer<Ring,Field,IMatrix,BlasBlackbox<Field> > LiftingContainer;		
+		typedef DixonLiftingContainer<Ring,Field,IMatrix,BlasBlackbox<Field> > LiftingContainer;
 		LiftingContainer lc(_R, *F, A, *FMP, b, _prime);
 		RationalReconstruction<LiftingContainer > re(lc);
-		if (!re.getRational(num, den, 0)){
+		if (!re.getRational(num, den,0)){
 			delete FMP;
 			return SS_FAILED;
 		}
 #ifdef RSTIMING
 		ttNonsingularSolve.update(re, lc);
-#endif	
-		delete FMP;
-
+#endif
 		if (F!=NULL)
 			delete F;
+		if (FMP != NULL)
+			delete FMP;
 		return SS_OK;
 	}
 
 	template <class Ring, class Field, class RandomPrime>
-	template <class IMatrix, class Vector1, class Vector2>	
-	SolverReturnStatus RationalSolver<Ring,Field,RandomPrime,DixonTraits>::solveSingular 
-	(Vector1& num, Integer& den, const IMatrix& A, const Vector2& b, int maxPrimes, const SolverLevel level) const {	
+	template <class IMatrix, class Vector1, class Vector2>
+	SolverReturnStatus
+	RationalSolver<Ring,Field,RandomPrime,DixonTraits>::solveSingular (Vector1& num,
+									   Integer& den,
+									   const IMatrix& A,
+									   const Vector2& b,
+									   int maxPrimes,
+									   const SolverLevel level) const
+	{
 		return monolithicSolve (num, den, A, b, false, false, maxPrimes, level);
 	}
 
 	template <class Ring, class Field, class RandomPrime>
-	template <class IMatrix, class Vector1, class Vector2>	
-	SolverReturnStatus RationalSolver<Ring,Field,RandomPrime,DixonTraits>::findRandomSolution 
-	(Vector1& num, Integer& den, const IMatrix& A, const Vector2& b, int maxPrimes, const SolverLevel level ) const {
-		
+	template <class IMatrix, class Vector1, class Vector2>
+	SolverReturnStatus
+	RationalSolver<Ring,Field,RandomPrime,DixonTraits>::findRandomSolution (Vector1& num,
+										     Integer& den,
+										     const IMatrix& A,
+										     const Vector2& b,
+										     int maxPrimes,
+										     const SolverLevel level ) const
+	{
+
 		return monolithicSolve (num, den, A, b, false, true, maxPrimes, level);
 	}
 
 
 	// Most solving is done by the routine below.
-	// There used to be one for random and one for deterministic, but they have been merged to ease with 
+	// There used to be one for random and one for deterministic, but they have been merged to ease with
 	//  repeated code (certifying inconsistency, optimization are 2 examples)
 
 	template <class Ring, class Field, class RandomPrime>
-	template <class IMatrix, class Vector1, class Vector2>	
-	SolverReturnStatus RationalSolver<Ring,Field,RandomPrime,DixonTraits>::monolithicSolve 
-	(Vector1& num, Integer& den, const IMatrix& A, const Vector2& b, bool makeMinDenomCert, bool randomSolution,
-	 int maxPrimes, const SolverLevel level) const {
+	template <class IMatrix, class Vector1, class Vector2>
+	SolverReturnStatus
+	RationalSolver<Ring,Field,RandomPrime,DixonTraits>::monolithicSolve (Vector1& num,
+										     Integer& den,
+										     const IMatrix& A,
+										     const Vector2& b,
+										     bool makeMinDenomCert,
+										     bool randomSolution,
+										     int maxPrimes,
+										     const SolverLevel level) const
+	{
 
-		if (level == SL_MONTECARLO && maxPrimes > 1) 
+		if (level == SL_MONTECARLO && maxPrimes > 1)
 			std::cout << "WARNING: Even if maxPrimes > 1, SL_MONTECARLO uses just one prime." << std::endl;
-		//if (makeMinDenomCert && !randomSolution) 
-		//	std::cout << "WARNING: Will not compute a certificate of minimal denominator deterministically." << std::endl;
-		if (makeMinDenomCert && level == SL_MONTECARLO) 
+#if 0
+		if (makeMinDenomCert && !randomSolution)
+			std::cout << "WARNING: Will not compute a certificate of minimal denominator deterministically." << std::endl;
+#endif
+		if (makeMinDenomCert && level == SL_MONTECARLO)
 			std::cout << "WARNING: No certificate of min-denominality generated due to  level=SL_MONTECARLO" << std::endl;
 		int trials = 0;
 		while (trials < maxPrimes){
@@ -745,26 +823,25 @@ namespace LinBox {
 			trials++;
 #ifdef DEBUG_DIXON
 			std::cout << "_prime: "<<_prime<<"\n";
-#endif		       
+#endif
 #ifdef RSTIMING
 			tSetup.start();
 #endif
 
 			typedef typename Field::Element Element;
 			typedef typename Ring::Element Integer;
-			typedef DixonLiftingContainer<Ring, Field, 
+			typedef DixonLiftingContainer<Ring, Field,
 				BlasBlackbox<Ring>, BlasBlackbox<Field> > LiftingContainer;
-		
 
 			// checking size of system
 			linbox_check(A.rowdim() == b.size());
-		
+
 			LinBox::integer tmp;
 			Integer _rone,_rzero;
 			_R.init(_rone,1);
 			_R.init(_rzero,0);
-			
-			Field F (_prime);		
+
+			Field F (_prime);
 			BlasMatrixDomain<Ring>  BMDI(_R);
 			BlasMatrixDomain<Field> BMDF(F);
 			BlasApply<Ring> BAR(_R);
@@ -772,32 +849,27 @@ namespace LinBox {
 			VectorDomain<Ring> VDR(_R);
 
 			BlasBlackbox<Ring> A_check(_R, A); // used to check answer later
-			//  			BlasMatrix<Integer> A_jonx(A);
 
 			// TAS_xxx stands for Transpose Augmented System (A|b)t
 			// this provides a factorization (A|b) = TAS_Pt . TAS_Ut . TAS_Qt . TAS_Lt
-			// such that    
+			// such that
 			// - TAS_P . (A|b) . TAS_Q   has nonzero principal minors up to TAS_rank
 			// - TAS_Q permutes b to the (TAS_rank)th column of A iff the system is inconsistent mod p
 
 			BlasBlackbox<Field>* TAS_factors = new BlasBlackbox<Field>(F, A.coldim()+1, A.rowdim());
 			Hom<Ring, Field> Hmap(_R, F);
 
-			BlasBlackbox<Field> *Ap;
+			BlasBlackbox<Field> Ap(F, A.rowdim(), A.coldim());
 			MatrixHom::map(Ap, A, F);
 
 			for (size_t i=0;i<A.rowdim();++i)
 				for (size_t j=0;j<A.coldim();++j)
-					//F.init(TAS_factors->refEntry(j,i),_R.convert(tmp,A.getEntry(i,j)));
-					//Hmap.image(TAS_factors->refEntry(j,i),A.getEntry(i,j));
-					TAS_factors->setEntry(j,i, Ap->getEntry(i,j));
-					
-			delete Ap;
+					TAS_factors->setEntry(j,i, Ap.getEntry(i,j));
+
 
 			for (size_t i=0;i<A.rowdim();++i){
 				typename Field::Element tmpe;
 				F.init(tmpe);
-				//Hmap.image(TAS_factors->refEntry(A.coldim(),i), b[i]);
 				F.init(tmpe,_R.convert(tmp,b[i]));
 				TAS_factors->setEntry(A.coldim(),i, tmpe);
 			}
@@ -806,13 +878,15 @@ namespace LinBox {
 			ttSetup += tSetup;
 			tLQUP.start();
 #endif
-			LQUPMatrix<Field>* TAS_LQUP = new LQUPMatrix<Field>(F, *TAS_factors);
+			BlasPermutation<size_t>  TAS_P(TAS_factors->coldim()) ;
+			BlasPermutation<size_t>  TAS_Qt(TAS_factors->rowdim()) ;
+
+			LQUPMatrix<Field>* TAS_LQUP = new LQUPMatrix<Field>(F, *TAS_factors,TAS_P,TAS_Qt);
 			size_t TAS_rank = TAS_LQUP->getrank();
-			// 			std::cout << "tas-rank: " << TAS_rank << std::endl;
-			
+
 			// check consistency. note, getQ returns Qt.
-			BlasPermutation TAS_P = TAS_LQUP->getP();
-			BlasPermutation TAS_Qt = TAS_LQUP->getQ();
+			// BlasPermutation<size_t>  TAS_P = TAS_LQUP->getP();
+			// BlasPermutation<size_t>  TAS_Qt = TAS_LQUP->getQ();
 			std::vector<size_t> srcRow(A.rowdim()), srcCol(A.coldim()+1);
 			std::vector<size_t>::iterator sri = srcRow.begin(), sci = srcCol.begin();
 			for (size_t i=0; i<A.rowdim(); i++, sri++) *sri = i;
@@ -828,7 +902,7 @@ namespace LinBox {
 			std::cout << "Q takes (0 1 ...) to (";
 			for (size_t i=0; i<A.coldim()+1; i++) std::cout << srcCol[i] << ' '; std::cout << ')' << std::endl;
 #endif
-			
+
 			bool appearsInconsistent = (srcCol[TAS_rank-1] == A.coldim());
 			size_t rank = TAS_rank - (appearsInconsistent ? 1 : 0);
 #ifdef DIXON_DEBUG
@@ -838,7 +912,7 @@ namespace LinBox {
 			tLQUP.stop();
 			ttLQUP += tLQUP;
 #endif
-			if (rank == 0) { 
+			if (rank == 0) {
 				delete TAS_LQUP;
 				delete TAS_factors;
 				//special case when A = 0, mod p. dealt with to avoid crash later
@@ -857,13 +931,13 @@ namespace LinBox {
 							}
 							return SS_INCONSISTENT;
 						}
-					/*
+#if 0
 					// both A and b are all zero.
 					for (size_t i=0; i<answer.size(); i++) {
-					answer[i].first = _rzero;
-					answer[i].second = _rone;
+						answer[i].first = _rzero;
+						answer[i].second = _rone;
 					}
-					*/
+#endif
 					_R. assign (den, _rone);
 					for (typename Vector1::iterator p = num. begin(); p != num. end(); ++ p)
 						_R. assign (*p, _rzero);
@@ -879,20 +953,20 @@ namespace LinBox {
 				// so a was empty mod p but not over Z.
 				continue; //try new prime
 			}
-	
+
 			BlasBlackbox<Field>* Atp_minor_inv = NULL;
 
 			if ((appearsInconsistent && level > SL_MONTECARLO) || randomSolution == false) {
 				// take advantage of the (LQUP)t factorization to compute
-				// an inverse to the leading minor of (TAS_P . (A|b) . TAS_Q) 
+				// an inverse to the leading minor of (TAS_P . (A|b) . TAS_Q)
 #ifdef RSTIMING
 				tFastInvert.start();
 #endif
 				Atp_minor_inv = new BlasBlackbox<Field>(F, rank, rank);
-				
 
-				FFPACK::LQUPtoInverseOfFullRankMinor(F, rank, TAS_factors->getPointer(), A.rowdim(), 
-								     TAS_Qt.getPointer(), 
+
+				FFPACK::LQUPtoInverseOfFullRankMinor(F, rank, TAS_factors->getPointer(), A.rowdim(),
+								     TAS_Qt.getPointer(),
 								     Atp_minor_inv->getPointer(), rank);
 #ifdef RSTIMING
 				tFastInvert.stop();
@@ -909,7 +983,7 @@ namespace LinBox {
 			if (appearsInconsistent) {
 #ifdef RSTIMING
 				tCheckConsistency.start();
-#endif			
+#endif
 				std::vector<Integer> zt(rank);
 				for (size_t i=0; i<rank; i++)
 					_R.assign(zt[i], A.getEntry(srcRow[rank], srcCol[i]));
@@ -919,35 +993,28 @@ namespace LinBox {
 					for (size_t j=0; j<rank; j++)
 						_R.assign(At_minor.refEntry(j, i), A.getEntry(srcRow[i], srcCol[j]));
 #ifdef DEBUG_INC
-				At_minor.write(std::cout << "At_minor:" << std::endl, _R);
-				Atp_minor_inv->write(std::cout << "Atp_minor_inv:" << std::endl, F);
+				At_minor.write(std::cout << "At_minor:" << std::endl);//, _R);
+				Atp_minor_inv->write(std::cout << "Atp_minor_inv:" << std::endl);//, F);
 				std::cout << "zt: "; for (size_t i=0; i<rank; i++) std::cout << zt[i] <<' '; std::cout << std::endl;
 #endif
-				//BlasBlackbox<Ring>  BBAt_minor(_R, At_minor);
-				//BlasBlackbox<Field> BBAtp_minor_inv(F, *Atp_minor_inv);
-				//BlasMatrix<Integer>  BBAt_minor( At_minor);
-				//BlasMatrix<Element>  BBAtp_minor_inv( *Atp_minor_inv);
-
 #ifdef RSTIMING
 				tCheckConsistency.stop();
 				ttCheckConsistency += tCheckConsistency;
-#endif			
+#endif
 
 				LiftingContainer lc(_R, F, At_minor, *Atp_minor_inv, zt, _prime);
-				
+
 				RationalReconstruction<LiftingContainer > re(lc);
-				
+
 				Vector1 short_num(rank); Integer short_den;
-				
-				if (!re.getRational(short_num, short_den,0)) 
+
+				if (!re.getRational(short_num, short_den,0))
 					return SS_FAILED;    // dirty, but should not be called
 				// under normal circumstances
 #ifdef RSTIMING
 				ttConsistencySolve.update(re, lc);
 				tCheckConsistency.start();
 #endif
-				//delete Atp_minor_inv;
-				
 				VectorFraction<Ring> cert(_R, short_num. size());
 				cert. numer = short_num;
 				cert. denom = short_den;
@@ -963,31 +1030,31 @@ namespace LinBox {
 				std::vector<Integer> certnumer_A(A.coldim());
 				BAR.applyVTrans(certnumer_A, A_check, cert.numer);
 				typename std::vector<Integer>::iterator cai = certnumer_A.begin();
-				for (size_t i=0; certifies && i<A.coldim(); i++, cai++) 
-					certifies &= _R.isZero(*cai);				
+				for (size_t i=0; certifies && i<A.coldim(); i++, cai++)
+					certifies &= _R.isZero(*cai);
 #ifdef RSTIMING
 				tCheckConsistency.stop();
 				ttCheckConsistency += tCheckConsistency;
 #endif
-				if (certifies) { 
+				if (certifies) {
 					if (level == SL_CERTIFIED) lastCertificate.copy(cert);
 					return SS_INCONSISTENT;
 				}
 				std::cout<<"system is suspected to be inconsistent but it was only a bad prime\n";
 				continue; // try new prime. analogous to u.A12 != A22 in Muld.+Storj.
 			}
-			
+
 #ifdef RSTIMING
 			tMakeConditioner.start();
 #endif
 			// we now know system is consistent mod p.
 			BlasBlackbox<Ring> A_minor(_R, rank, rank);    // -- will have the full rank minor of A
 			BlasBlackbox<Field> *Ap_minor_inv;          // -- will have inverse mod p of A_minor
-			BlasBlackbox<Ring> *P = NULL, *B = NULL;   // -- only used in random case 
+			BlasBlackbox<Ring> *P = NULL, *B = NULL;   // -- only used in random case
 
 			if (!randomSolution) {
 				// use shortcut - transpose Atp_minor_inv to get Ap_minor_inv
-				Element _rtmp; 
+				Element _rtmp;
 				Ap_minor_inv = Atp_minor_inv;
 				for (size_t i=0; i<rank; i++)
 					for (size_t j=0; j<i; j++) {
@@ -1004,21 +1071,21 @@ namespace LinBox {
 				tMakeConditioner.stop();
 				ttMakeConditioner += tMakeConditioner;
 #endif
-			
+
 				if (makeMinDenomCert && level >= SL_LASVEGAS){
 					B = new BlasBlackbox<Ring>(_R, rank, A.coldim());
 					for (size_t i=0; i<rank; i++)
 						for (size_t j=0; j<A.coldim(); j++)
 							_R.assign(B->refEntry(i, j), A_check.getEntry(srcRow[i],j));
-				}					
+				}
 			}
 			else {
-				P = new BlasBlackbox<Ring>(_R, A.coldim(), rank);	
+				P = new BlasBlackbox<Ring>(_R, A.coldim(), rank);
 				B = new BlasBlackbox<Ring>(_R, rank,A.coldim());
 				BlasBlackbox<Field> Ap_minor(F, rank, rank);
 				Ap_minor_inv = new BlasBlackbox<Field>(F, rank, rank);
 				int nullity;
-				
+
 				LinBox::integer tmp=0;
 				size_t maxBitSize = 0;
 				for (size_t i=0; i<rank; i++)
@@ -1036,7 +1103,7 @@ namespace LinBox {
 
 				do { // O(1) loops of this preconditioner expected
 #ifdef RSTIMING
-					if (firstLoop) 
+					if (firstLoop)
 						firstLoop = false;
 					else
 						tMakeConditioner.start();
@@ -1044,40 +1111,40 @@ namespace LinBox {
 					// compute P a n*r random matrix of entry in [0,1]
 					typename BlasBlackbox<Ring>::RawIterator iter;
 					for (iter = P->rawBegin(); iter != P->rawEnd(); ++iter) {
-						if (rand() > RAND_MAX/2) 
+						if (rand() > RAND_MAX/2)
 							_R.assign(*iter, _rone);
 						else
 							_R.assign(*iter, _rzero);
 					}
 
 					// compute A_minor = B.P
-					/*
-					  if (maxBitSize * log((double)A.coldim()) > 53) 
-					  MD.mul(A_minor, *B, *P);
-					  else {
-					  double *B_dbl= new double[rank*A.coldim()]; 
-					  double *P_dbl= new double[A.coldim()*rank]; 
-					  double *A_minor_dbl = new double[rank*rank];
-					  for (size_t i=0;i<rank;++i)
-					  for (size_t j=0;j<A.coldim(); j++){
-					  _R.convert(B_dbl[j+i*A.coldim()], B->getEntry(i,j));
-					  _R.convert(P_dbl[i+j*rank], P->getEntry(j,i));
-					  }
-					  cblas_dgemm(CblasRowMajor, CblasNoTrans,
-					  CblasNoTrans,
-					  rank, rank, A.coldim(), 1,
-					  B_dbl, A.coldim(), P_dbl, rank, 0,A_minor_dbl, rank);
-
-					  for (size_t i=0;i<rank;++i)
-					  for (size_t j=0;j<rank;++j)
-					  _R.init(A_minor.refEntry(i,j),A_minor_dbl[j+i*rank]);
-
-					  delete[] B_dbl;	
-					  delete[] P_dbl;
-					  delete[] A_minor_dbl;
-					  }
-					*/
-								
+#if 0
+					if (maxBitSize * log((double)A.coldim()) > 53)
+						MD.mul(A_minor, *B, *P);
+					else {
+						double *B_dbl= new double[rank*A.coldim()];
+						double *P_dbl= new double[A.coldim()*rank];
+						double *A_minor_dbl = new double[rank*rank];
+						for (size_t i=0;i<rank;++i)
+							for (size_t j=0;j<A.coldim(); j++){
+								_R.convert(B_dbl[j+i*A.coldim()], B->getEntry(i,j));
+								_R.convert(P_dbl[i+j*rank], P->getEntry(j,i));
+							}
+						cblas_dgemm(CblasRowMajor, CblasNoTrans,
+							    CblasNoTrans,
+							    rank, rank, A.coldim(), 1,
+							    B_dbl, A.coldim(), P_dbl, rank, 0,A_minor_dbl, rank);
+
+						for (size_t i=0;i<rank;++i)
+							for (size_t j=0;j<rank;++j)
+								_R.init(A_minor.refEntry(i,j),A_minor_dbl[j+i*rank]);
+
+						delete[] B_dbl;
+						delete[] P_dbl;
+						delete[] A_minor_dbl;
+					}
+#endif
+
 					MAD.applyM(A_minor,*P);
 
 
@@ -1092,7 +1159,7 @@ namespace LinBox {
 					ttMakeConditioner += tMakeConditioner;
 					tInvertBP.start();
 #endif
-					BMDF.inv(*Ap_minor_inv, Ap_minor, nullity); 
+					BMDF.inv(*Ap_minor_inv, Ap_minor, nullity);
 #ifdef RSTIMING
 					tInvertBP.stop();
 					ttInvertBP += tInvertBP;
@@ -1105,10 +1172,12 @@ namespace LinBox {
 			newb.resize(rank);
 
 			BlasBlackbox<Ring>  BBA_minor(_R,A_minor);
-			//BlasBlackbox<Field> BBA_inv(F,*Ap_minor_inv);
-			//BlasMatrix<Integer>  BBA_minor(A_minor);
-			//BlasMatrix<Element> BBA_inv(*Ap_minor_inv);
-			//LiftingContainer lc(_R, F, BBA_minor, BBA_inv, newb, _prime);
+#if 0
+			BlasBlackbox<Field> BBA_inv(F,*Ap_minor_inv);
+			BlasMatrix<Integer>  BBA_minor(A_minor);
+			BlasMatrix<Element> BBA_inv(*Ap_minor_inv);
+			LiftingContainer lc(_R, F, BBA_minor, BBA_inv, newb, _prime);
+#endif
 			LiftingContainer lc(_R, F, BBA_minor, *Ap_minor_inv, newb, _prime);
 
 #ifdef DEBUG_DIXON
@@ -1117,14 +1186,14 @@ namespace LinBox {
 			RationalReconstruction<LiftingContainer > re(lc);
 
 			Vector1 short_num(rank); Integer short_den;
-			
+
 			if (!re.getRational(short_num, short_den,0))
 				return SS_FAILED;    // dirty, but should not be called
-			// under normal circumstances		
+			// under normal circumstances
 #ifdef RSTIMING
 			ttSystemSolve.update(re, lc);
 			tCheckAnswer.start();
-#endif		
+#endif
 			VectorFraction<Ring> answer_to_vf(_R, short_num. size());
 			answer_to_vf. numer = short_num;
 			answer_to_vf. denom = short_den;
@@ -1140,32 +1209,32 @@ namespace LinBox {
 				typename Vector<Ring>::Dense newNumer(A.coldim());
 				BAR.applyV(newNumer, *P, answer_to_vf.numer);
 				//BAR.applyVspecial(newNumer, *P, answer_to_vf.numer);
-				
+
 				answer_to_vf.numer = newNumer;
 			}
 
 			if (level >= SL_LASVEGAS) { //check consistency
 
 				std::vector<Integer> A_times_xnumer(b.size());
-	
+
 				BAR.applyV(A_times_xnumer, A_check, answer_to_vf.numer);
-				
+
 				Integer tmpi;
-				
+
 				typename Vector2::const_iterator ib = b.begin();
 				typename std::vector<Integer>::iterator iAx = A_times_xnumer.begin();
 				int thisrow = 0;
 				bool needNewPrime = false;
-				
+
 				for (; !needNewPrime && ib != b.end(); iAx++, ib++, thisrow++)
 					if (!_R.areEqual(_R.mul(tmpi, *ib, answer_to_vf.denom), *iAx)) {
 						// should attempt to certify inconsistency now
 						// as in "if [A31 | A32]y != b3" of step (4)
 						needNewPrime = true;
 					}
-				
+
 				if (needNewPrime) {
-					delete Ap_minor_inv;          
+					delete Ap_minor_inv;
 					if (randomSolution) {delete P; delete B;}
 #ifdef RSTIMING
 					tCheckAnswer.stop();
@@ -1174,16 +1243,17 @@ namespace LinBox {
 					continue; //go to start of main loop
 				}
 			}
-			
+
 			//answer_to_vf.toFVector(answer);
 			num = answer_to_vf. numer;
 			den = answer_to_vf. denom;
-#ifdef RSTIMING  
+#ifdef RSTIMING
 			tCheckAnswer.stop();
 			ttCheckAnswer += tCheckAnswer;
-#endif			
-			if (makeMinDenomCert && level >= SL_LASVEGAS){  // && randomSolution) {
-				// To make this certificate we solve with the same matrix as to get the 
+#endif
+			if (makeMinDenomCert && level >= SL_LASVEGAS)  // && randomSolution
+			{
+				// To make this certificate we solve with the same matrix as to get the
 				// solution, except transposed.
 #ifdef RSTIMING
 				tCertSetup.start();
@@ -1216,7 +1286,7 @@ namespace LinBox {
 				// U     | {0, 1}
 				// u     | u
 				// z-hat | lastCertificate
-				
+
 				// we multiply the certificate by TAS_Pt at the end
 				// so it corresponds to b instead of newb
 
@@ -1241,7 +1311,7 @@ namespace LinBox {
 				ttCertSetup += tCertSetup;
 #endif
 				//LiftingContainer lc2(_R, F, BBA_minor, BBA_inv, q, _prime);
-				LiftingContainer lc2(_R, F, BBA_minor, *Ap_minor_inv, q, _prime);
+				LiftingContainer lc2(_R, F, A_minor, *Ap_minor_inv, q, _prime);
 
 				RationalReconstruction<LiftingContainer> re(lc2);
 				Vector1 u_num(rank); Integer u_den;
@@ -1251,18 +1321,20 @@ namespace LinBox {
 				ttCertSolve.update(re, lc2);
 				tCertMaking.start();
 #endif
-				// remainder of code does   z <- denom(partial_cert . Mr) * partial_cert * Qt 
+				// remainder of code does   z <- denom(partial_cert . Mr) * partial_cert * Qt
 				VectorFraction<Ring> u_to_vf(_R, u_num.size());
 				u_to_vf. numer = u_num;
 				u_to_vf. denom = u_den;
 				std::vector<Integer> uB(A.coldim());
 				BAR.applyVTrans(uB, *B, u_to_vf.numer);
 
-				// 				std::cout << "BP: ";
-				// 				A_minor.write(std::cout, _R) << std::endl;
-				// 				std::cout << "q: ";
-				// 				for (size_t i=0; i<rank; i++) std::cout << q[i]; std::cout << std::endl;
-				// 				u_to_vf.write(std::cout  << "u: ") << std::endl;
+#if 0
+				std::cout << "BP: ";
+				A_minor.write(std::cout, _R) << std::endl;
+				std::cout << "q: ";
+				for (size_t i=0; i<rank; i++) std::cout << q[i]; std::cout << std::endl;
+				u_to_vf.write(std::cout  << "u: ") << std::endl;
+#endif
 
 				Integer numergcd = _rzero;
 				vectorGcdIn(numergcd, _R, uB);
@@ -1279,14 +1351,14 @@ namespace LinBox {
 
 				if (level >= SL_CERTIFIED)
 					lastCertificate.copy(z);
-				
+
 				// output new certified denom factor
 				Integer znumer_b, zbgcd;
 				VDR.dotprod(znumer_b, z.numer, b);
 				_R.gcd(zbgcd, znumer_b, z.denom);
 				_R.div(lastCertifiedDenFactor, z.denom, zbgcd);
 
-				if (level >= SL_CERTIFIED) 
+				if (level >= SL_CERTIFIED)
 					_R.div(lastZBNumer, znumer_b, zbgcd);
 #ifdef RSTIMING
 				tCertMaking.stop();
@@ -1294,9 +1366,9 @@ namespace LinBox {
 #endif
 			}
 
-			delete Ap_minor_inv;			
+			delete Ap_minor_inv;
 			delete B;
-			
+
 			if (randomSolution) {delete P;}
 
 			// done making certificate, lets blow this popstand
@@ -1311,54 +1383,59 @@ namespace LinBox {
 	/*
 	 * Specialization for Block Hankel method
 	 */
-	
 	// solve non singular system using block Hankel
 	template <class Ring, class Field, class RandomPrime>
-	template <class IMatrix, class Vector1, class Vector2>	
-	SolverReturnStatus RationalSolver<Ring,Field,RandomPrime,BlockHankelTraits>::solveNonsingular 
-	(Vector1& num, Integer& den, const IMatrix& A, const Vector2& b, size_t blocksize, int maxPrimes) const {
+	template <class IMatrix, class Vector1, class Vector2>
+	SolverReturnStatus
+	RationalSolver<Ring,Field,RandomPrime,BlockHankelTraits>::solveNonsingular(Vector1& num,
+												     Integer& den,
+												     const IMatrix& A,
+												     const Vector2& b,
+												     size_t blocksize,
+												     int maxPrimes) const
+	{
 
 		linbox_check(A.rowdim() == A.coldim());
-		linbox_check(n % blocksize == 0);
-		
+		linbox_check(A.rowdim() % blocksize == 0);
+
 		typedef typename Field::Element Element;
 
-		
+
 
 		// reduce the matrix mod p
 		Field F(_prime);
 		typedef typename IMatrix::template rebind<Field>::other FMatrix;
-		FMatrix *Ap;
+		FMatrix Ap(F, A.rowdim(), A.coldim());
 		typename IMatrix::template rebind<Field>()( Ap, A, F);
 
 		// precondition Ap  with a random diagonal Matrix
 		typename Field::RandIter G(F,0,123456);
-		std::vector<Element> diag(Ap->rowdim());
-		
-		for(size_t i=0;i<Ap->rowdim();++i){
+		std::vector<Element> diag(Ap.rowdim());
+
+		for(size_t i=0;i<Ap.rowdim();++i){
 			do {
 				G.random(diag[i]);
 			} while(F.isZero(diag[i]));
 		}
-	
+
 
 
 		Diagonal<Field> D(F, diag);
-		
-		Compose<Diagonal<Field>, FMatrix> DAp(D,*Ap);
+
+		Compose<Diagonal<Field>, FMatrix> DAp(D,Ap);
 
 		size_t n = A.coldim();
 		size_t numblock = n/blocksize;
 
 		// generate randomly U and V
 		BlasMatrix<Element> U(blocksize,A.rowdim()), V(A.coldim(),blocksize);
-	
+
 		for (size_t j=0;j<blocksize; ++j)
 			for (size_t i=j*numblock;i<(j+1)*numblock;++i){
 				G.random(V.refEntry(i,j));
 			}
 		for (size_t i=0;i<n;++i)
-			G.random(U.refEntry(0,i));			
+			G.random(U.refEntry(0,i));
 
 #ifdef RSTIMING
 		Timer chrono;
@@ -1366,9 +1443,9 @@ namespace LinBox {
 		chrono.start();
 #endif
 
-		// compute the block krylov sequence associated to U.A^i.V	
+		// compute the block krylov sequence associated to U.A^i.V
 		BlackboxBlockContainerRecord<Field, Compose<Diagonal<Field>,FMatrix> >  Seq(&DAp, F, U, V, false);
-	
+
 #ifdef RSTIMING
 		chrono.stop();
 		std::cout<<"sequence generation: "<<chrono<<"\n";
@@ -1385,10 +1462,10 @@ namespace LinBox {
 		std::cout<<"inverse block hankel: "<<chrono<<"\n";
 #endif
 
-		typedef BlockHankelLiftingContainer<Ring,Field,IMatrix,Compose<Diagonal<Field>,FMatrix>, BlasMatrix<Element> > LiftingContainer;		
-		LiftingContainer lc(_R, F, A, DAp, D, Hinv, U, V, b, _prime);		
+		typedef BlockHankelLiftingContainer<Ring,Field,IMatrix,Compose<Diagonal<Field>,FMatrix>, BlasMatrix<Element> > LiftingContainer;
+		LiftingContainer lc(_R, F, A, DAp, D, Hinv, U, V, b, _prime);
 		RationalReconstruction<LiftingContainer > re(lc);
-		
+
 		if (!re.getRational(num, den, 0)) return SS_FAILED;
 
 #ifdef RSTIMING
@@ -1396,391 +1473,87 @@ namespace LinBox {
 		std::cout<<"residue computation       : "<<lc.ttRingApply<<"\n";
 		std::cout<<"rational reconstruction   : "<<re.ttRecon<<"\n";
 #endif
-		
+
 		return SS_OK;
 	}
 
 
 
-
-
-} //end of namespace LinBox
-
-
-
-
-/* Author Z. Wan
- * Modified to fit in linbox
- * Implementation the algorithm in manuscript, available at http://www.cis.udel.edu/~wan/jsc_wan.ps
- */
-
-
-
-#ifndef __RATIONAL_SOLVER2__H__
-#define __RATIONAL_SOLVER2__H__
-
-#include <memory.h>
-#include <iostream>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <linbox/integer.h>
-#include <linbox/algorithms/rational-reconstruction2.h>
-
-namespace LinBox {
-
-#if __LINBOX_HAVE_DGETRF && __LINBOX_HAVE_DGETRI
-	template <class Ring, class Field, class RandomPrime>
-	inline int RationalSolver<Ring, Field, RandomPrime, NumericalTraits>::cblas_dgeinv(double* M, int n) {
-		enum CBLAS_ORDER order = CblasRowMajor;
-		int lda = n;
-		int P[n];
-		int ierr = clapack_dgetrf (order, n, n, M, lda, P);
-		if (ierr != 0) {
-                    std::cerr << "In RationalSolver::cblas_dgeinv Matrix is not full rank" << std::endl;
-                    return -1;
-		}
-		clapack_dgetri (order, n, M, lda, P);
-		return 0;
-	}
-
+	/*
+	 * Specialization for Sparse Elimination method
+	 */
+	// solve non singular system using Sparse LU
+	// max prime is not use. only check with one prime
 	template <class Ring, class Field, class RandomPrime>
-	inline int RationalSolver<Ring, Field, RandomPrime, NumericalTraits>::cblas_rsol (int n, const double* M, integer* numx, integer& denx, double* b) {
-		if (n < 1) return 0;
-		double* IM = new double[n * n];
-		memcpy ((void*)IM, (const void*)M, sizeof(double)*n*n);
-		int ret;
-		//compute the inverse by flops
-		ret = cblas_dgeinv (IM, n); 
-		if (ret != 0) {delete[] IM; return 1;}
-
-		double mnorm = cblas_dOOnorm(M, n, n);
-		// residual
-		double* r = new double [n];
-		// A^{-1}r
-		double* x = new double [n];
-		//ax  = A x
-		double* ax = new double [n];
-		// a digit, d \approx \alpha x
-		double* d = new double [n];
-
-		const double* p2;
-		double* pd;
-		const double T = 1 << 30;
-	
-		integer* num = new integer [n];
-		integer* p_mpz;
-		integer tmp_mpz, den, denB, B;
-
-		den = 1;
-		// compute the hadamard bound
-		cblas_hbound (denB, n, n, M);      
-		B = denB * denB;
-		// shouble be a check for tmp_mpz
-		tmp_mpz = 2 * mnorm + cblas_dmax (n, b, 1);
-		B <<= 1; B *= tmp_mpz; //B *= tmp_mpz;
-	
-		//double log2 = log (2.0);
-		double log2 = M_LN2;
-		// r = b
-		memcpy ((void*) r, (const void*) b, sizeof(double)*n);
-
-		do  {
-			cblas_dapply (n, n, IM, r, x);
-			// compute ax
-			cblas_dapply (n, n, M, x, ax);
-			// compute ax = ax -r, the negative of residual
-			cblas_daxpy (n, -1, r, 1, ax, 1);
-			// compute possible shift
-			double normr1, normr2, normr3, shift1, shift2;
-			normr1 = cblas_dmax(n, r, 1);
-			normr2 = cblas_dmax(n, ax, 1);
-			normr3 = cblas_dmax(n, x, 1);
-			//try to find a good scalar
-			int shift = 30;
-			if (normr2 <.0000000001) 
-				shift = 30;
-			else {
-				shift1 = floor(log (normr1 / normr2) / log2) - 2;
-				shift = (int)(30 < shift1 ? 30 : shift1);
-			}
-
-			normr3 = normr3 > 2 ? normr3 : 2;
-			shift2 = floor(53. * log2 / log (normr3));
-			shift = (int)(shift < shift2 ? shift : shift2);
-
-			if (shift <= 0) {
-#ifdef DEBUGRC
-				printf ("%s", "Bad scalar \n");
-				printf("%f, %f\n", normr1, normr2);
-				printf ("%d, shift = ", shift);
-				printf ("OO-norm of matrix: %f\n", cblas_dOOnorm(M, n, n));
-				printf ("OO-norm of inverse: %f\n", cblas_dOOnorm(IM, n, n));
-				printf ("Error, abort\n"); 
-#endif
-				delete[] IM; delete[] r; delete[] x; delete[] ax; delete[] d; delete[] num; 
-				return 2;
-			}
+	template <class IMatrix, class Vector1, class Vector2>
+	SolverReturnStatus
+	RationalSolver<Ring,Field,RandomPrime,SparseEliminationTraits>::solveNonsingular(Vector1& num,
+												     Integer& den,
+												     const IMatrix& A,
+												     const Vector2& b,
+												     int maxPrimes) const
+	{
 
-			int scalar = ((long long int)1 << shift);
-			for (pd = d, p2 = x; pd != d + n; ++ pd, ++ p2) 
-				//better use round, but sun sparc machine doesnot supprot it
-				*pd = floor (*p2 * scalar);
-
-			// update den
-			den <<= shift; 
-			//update num
-			update_num (num, n, d, shift);
-		
-#ifdef DEBUGRC
-			printf ("in iteration\n");
-			printf ("residual=\n");
-			printvec (r,  n);
-			printf ("A^(-1) r\n");
-			printvec (x,  n);
-			printf ("scalar= ");
-			printf ("%d \n", scalar);
-			printf ("One digit=\n");
-			printvec (d, n);
-			printf ("Current bound= \n");
-			std::cout << B;
-			printf ("den= \n");
-			std::cout << den;
-			printf ("accumulate numerator=\n");
-			printvec (num, n);
-#endif
-			// update r = r * shift - M d
-			double tmp = 2 * mnorm + cblas_dmax (n, r, 1);
-			if (tmp < T) update_r_int (r, n, M, d, shift);
-			else update_r_ll (r, n, M, d, shift);
-			//update_r_ll (r, n, M, d, shift);
-		} while (den < B);
-	
-		integer q, rem, den_lcm, tmp_den;
-		integer* p_x, * p_x1;
-		p_mpz = num;
-		p_x = numx;
-		// construct first answer
-		rational_reconstruction (*p_x, denx, *p_mpz, den, denB);
-		++ p_mpz;
-		++ p_x;
-
-		int sgn;
-		for (; p_mpz != num + n; ++ p_mpz, ++ p_x)  {
-			sgn = sign (*p_mpz);
-			tmp_mpz = denx * (*p_mpz);
-			tmp_mpz = abs (tmp_mpz);
-			integer::divmod (q, rem, tmp_mpz, den);
-		
-			if ( rem < denx)  {
-				if (sgn >= 0)
-					*p_x = q;
-				else 
-					*p_x = -q;
-			}
-			else {
-				rem = den - rem;
-				q += 1;
-				if (rem < denx) {
-					if (sgn >= 0)
-						*p_x = q;
-					else
-						*p_x = -q;
-				}
-				else {
-					rational_reconstruction (*p_x, tmp_den, *p_mpz, den, denB);
-					lcm (den_lcm, tmp_den, denx);
-					integer::divexact (tmp_mpz, den_lcm, tmp_den);
-					integer::mul (*p_x, *p_x, tmp_mpz);
-					integer::divexact (tmp_mpz, den_lcm, denx);
-					denx = den_lcm;
-					for (p_x1 = numx; p_x1 != p_x; ++ p_x1)
-						integer::mul (*p_x1, *p_x1, tmp_mpz);
-				}
-			}	
-		}
-#ifdef DEBUGRC
-		std::cout << "raiotanl answer\nCommon den = ";
-		std::cout << denx;
-		std::cout << "\nNumerator= \n";
-		printvec (numx, n);
-#endif
-	
-		//normalize the answer
-		if (denx != 0) {	
-			integer g; g = denx;
-			for (p_x = numx; p_x != numx + n; ++ p_x)
-				g = gcd (g, *p_x);
-			for (p_x = numx; p_x != numx + n; ++ p_x)
-				integer::divexact (*p_x, *p_x, g);
-			integer::divexact (denx, denx, g);
-		}
-	
-		//check if the answer is correct, not necessary
-		cblas_mpzapply (n, n, M, (const integer*)numx, num);
-		integer* sb = new integer [n];
-		double* p;
-		for (p_mpz = sb, p = b; p_mpz != sb + n; ++ p_mpz, ++ p) {
-			*p_mpz = *p;
-			integer::mulin(*p_mpz, denx);
-		}
-		ret = 0;
-		for (p_mpz = sb, p_x = num; p_mpz != sb + n; ++ p_mpz, ++ p_x) 
-			if (*p_mpz != *p_x) {
-				ret = 3;
-				break;
-			}
-#ifdef DEBUGRC
-		if (ret == 3) {
-	
-			std::cout << "Input matrix:\n";
-			for (int i = 0; i < n; ++ i) {
-				const double* p = M + (i * n);
-				printvec (p, n);
-			}
-			std::cout << "Input rhs:\n";
-			printvec (b, n);
-			std::cout << "Common den: " << denx << '\n';
-			std::cout << "Numerator: ";
-			printvec (numx, n);
-			std::cout << "A num: ";
-			printvec (num, n);
-			std::cout << "denx rhs: ";
-			printvec (sb, n);
-		}
-#endif
+		linbox_check(A.rowdim() == A.coldim());
 
-		// garbage collector
-		delete[] IM; delete[] r; delete[] x; delete[] ax; delete[] d; delete[] num; delete[] sb;
+		typedef typename Field::Element Element;
 
-		return ret;
-	}
+		// reduce the matrix mod p
+		Field F(_prime);
+		typedef typename IMatrix::template rebind<Field>::other FMatrix;
+		FMatrix Ap(F, A.rowdim(), A.coldim());
+		typename IMatrix::template rebind<Field>()( Ap, A, F);
 
+		// compute LQUP Factorization
+		Permutation<Field> P(A.coldim(),F),Q(A.rowdim(),F);
+		FMatrix L(F, A.rowdim(), A.rowdim());
+		unsigned long rank;
+		Element det;
+
+		GaussDomain<Field> GD(F);
+		GD.QLUPin(rank,det,Q,L,*Ap,P,Ap->rowdim(), Ap->coldim());
+		if (rank != A.rowdim()) {
+#if 0
+			throw LinboxError ("ERROR in DIXON SparseLU: singular matrix or bad prime");
 #endif
-
-
-	template <class Ring, class Field, class RandomPrime>
-	/* apply  y <- Ax */
-	inline int RationalSolver<Ring, Field, RandomPrime, NumericalTraits>::cblas_dapply (int m, int n, const double* A, const double* x, double* y) {
-		cblas_dgemv (CblasRowMajor, CblasNoTrans, m, n, 1, A, n, x, 1, 0, y, 1);
-		return 0;
-	}
-
-	template <class Ring, class Field, class RandomPrime>
-	inline int RationalSolver<Ring, Field, RandomPrime, NumericalTraits>::cblas_mpzapply (int m, int n, const double* A, const integer* x, integer* y) {
-		const double* p_A;
-		const integer* p_x;
-		integer* p_y;
-		integer tmp;
-		for (p_A = A, p_y = y; p_y != y + m; ++ p_y) {
-			*p_y = 0;
-			for (p_x = x; p_x != x + n; ++ p_x, ++ p_A) {
-				//mpz_set_d (tmp, *p_A);
-				//mpz_addmul_si (*p_y, *p_x, (int)(*p_A));
-				tmp = *p_x  * (long long int)(*p_A);
-				integer::addin (*p_y, tmp);
+			// Choose a nonrandom solution with smallest entries:
+			// Sets solution values to 0 for coldim()-rank columns
+			// Therefore, prune unnecessary elements
+			// in those last columns of U
+			size_t origNNZ=0,newNNZ=0;
+			for(typename FMatrix::RowIterator row=Ap->rowBegin();
+			    row != Ap->rowEnd(); ++row) {
+				if (row->size()) {
+					origNNZ += row->size();
+					size_t ns=0;
+					for(typename FMatrix::Row::iterator it = row->begin();
+					    it != row->end(); ++it, ++ns) {
+						if (it->first >= rank) {
+							row->resize(ns);
+							break;
+						}
+					}
+					newNNZ += row->size();
+				}
 			}
+			commentator.report (Commentator::LEVEL_IMPORTANT, PARTIAL_RESULT) << "Pruned : " << (origNNZ-newNNZ) << " unnecessary elements in upper triangle" << std::endl;
 		}
-		return 0;
-	}
 
-	template <class Ring, class Field, class RandomPrime>
-	template <class Elt>
-	inline int RationalSolver<Ring, Field, RandomPrime, NumericalTraits>::printvec (const Elt* v, int n) {
-		const Elt* p;
-		std::cout << "\[";
-		for (p = v; p != v + n; ++ p)
-			std::cout << *p << ' ';
-		std::cout << "]\n";
-		return 0;
-	}
 
-	template <class Ring, class Field, class RandomPrime>
-	//update num, *num <- *num * 2^shift + d
-	inline int RationalSolver<Ring, Field, RandomPrime, NumericalTraits>::update_num (integer* num, int n, const double* d, int shift) {
-		integer* p_mpz;
-		integer tmp_mpz;
-		const double* pd;
-		for (p_mpz = num, pd = d; p_mpz != num + n; ++ p_mpz, ++ pd) {
-			(*p_mpz) = (*p_mpz) << shift;
-			tmp_mpz = *pd;
-			integer::add (*p_mpz, *p_mpz, tmp_mpz);
-		} 
-		return 0;
-	}
-
-	template <class Ring, class Field, class RandomPrime>
-	//update r = r * shift - M d
-	inline int RationalSolver<Ring, Field, RandomPrime, NumericalTraits>::update_r_int (double* r, int n, const double* M, const double* d, int shift) {
-		int tmp;
-		double* p1;
-		const double* p2;
-		const double* pd;
-		for (p1 = r, p2 = M; p1 != r + n; ++ p1) {
-			tmp = (int)(long long int) *p1;
-			tmp <<= shift;
-			for (pd = d; pd != d + n; ++ pd, ++ p2) {
-				tmp -= (int)(long long int)*pd * (int)(long long int)*p2;
-			}
-			*p1 = (double)tmp;
-		}
-		return 0;
-	}
-
-	template <class Ring, class Field, class RandomPrime>
-	//update r = r * shift - M d
-	inline int RationalSolver<Ring, Field, RandomPrime, NumericalTraits>::update_r_ll (double* r, int n, const double* M, const double* d, int shift) {
-		long long int tmp;
-		double* p1;
-		const double* p2;
-		const double* pd;
-		for (p1 = r, p2 = M; p1 != r + n; ++ p1) {
-			tmp = (long long int) *p1;
-			tmp <<= shift;
-			for (pd = d; pd != d + n; ++ pd, ++ p2) {
-				tmp -= (long long int)*pd * (long long int) *p2;
-			}
-			*p1 = tmp;
-		}
-		return 0;
-	}
-
-	template <class Ring, class Field, class RandomPrime>
-	inline double RationalSolver<Ring, Field, RandomPrime, NumericalTraits>::cblas_dOOnorm(const double* M, int m, int n) {
-		double norm = 0;
-		double old = 0;
-		const double* p;
-		for (p = M; p != M + (m * n); ) {
-			old = norm;
-			norm = cblas_dasum (n, p ,1);
-			if (norm < old) norm = old;
-			p += n;
-		}	
-		return norm;
-	}
+		typedef SparseLULiftingContainer<Ring,Field,IMatrix,FMatrix> LiftingContainer;
+		LiftingContainer lc(_R, F, A, L, Q, *Ap, P, rank, b, _prime);
+		RationalReconstruction<LiftingContainer > re(lc);
 
-	template <class Ring, class Field, class RandomPrime>
-	inline double RationalSolver<Ring, Field, RandomPrime, NumericalTraits>::cblas_dmax (const int N, const double* a, const int inc) {
-		return fabs(a[cblas_idamax (N, a, inc)]);
+		if (!re.getRational(num, den, 0))
+			return SS_FAILED;
+		else
+			return SS_OK;
 	}
 
-	template <class Ring, class Field, class RandomPrime>
-	inline int RationalSolver<Ring, Field, RandomPrime, NumericalTraits>::cblas_hbound (integer& b, int m, int n, const double* M){
-		double norm = 0;
-		const  double* p;
-		integer tmp;
-		b = 1;
-		for (p = M; p != M + (m * n); ) {
-			norm = cblas_dnrm2 (n, p ,1);
-			tmp =  norm;
-			integer::mulin (b, tmp);
-			p += n;
-		}
+} //end of namespace LinBox
 
-		return 0;
-	}
-}//LinBox
+//BB : moved the following "guarded" code in a new file, verbatim :
+#include "rational-solver2.h"
 
-#endif
+#endif //__LINBOX_rational_solver_INL
 
-#endif
diff --git a/linbox/algorithms/rational-solver2.h b/linbox/algorithms/rational-solver2.h
new file mode 100644
index 0000000..5a11e75
--- /dev/null
+++ b/linbox/algorithms/rational-solver2.h
@@ -0,0 +1,549 @@
+/* -*- 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
+/* linbox/algorithms/rational-solver2.h
+ * Copyright (C) 2010 LinBox
+ * Author Z. Wan
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*! @file algorithms/rational-solver2.h
+ * @brief NO DOC
+ * @bib
+ * Implementation of the algorithm in manuscript, available at
+ * http://www.cis.udel.edu/~wan/jsc_wan.ps
+ */
+
+#ifndef __LINBOX_rational_solver2__H
+#define __LINBOX_rational_solver2__H
+
+#include <memory.h>
+#include <iostream>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <linbox/integer.h>
+#include <linbox/algorithms/rational-reconstruction2.h>
+
+namespace LinBox
+{
+
+	/** \brief solver using a hybrid Numeric/Symbolic computation.
+	 *
+	 *   See the following reference for details on this implementation:
+	 *   @bib
+	 *   - Zhendong Wan <i>Exactly solve integer linear systems using
+	 *   numerical methods.</i> Submitted to Journal of Symbolic
+	 *   Computation, 2004.
+	 *   .
+	 *
+	 */
+	//template argument Field and RandomPrime are not used.
+	//Keep it just for interface consistency.
+	template <class Ring, class Field, class RandomPrime>
+	class RationalSolver<Ring, Field, RandomPrime, WanTraits> {
+
+	protected:
+		Ring r;
+
+	public:
+		typedef typename Ring::Element Integer;
+
+		RationalSolver(const Ring& _r = Ring()) :
+			r(_r)
+		{}
+
+
+#if  __LINBOX_HAVE_LAPACK
+		template <class IMatrix, class OutVector, class InVector>
+		SolverReturnStatus solve(OutVector& num, Integer& den,
+					 const IMatrix& M, const InVector& b) const
+		{
+
+			if(M. rowdim() != M. coldim())
+				return SS_FAILED;
+
+			linbox_check((b.size() == M.rowdim()) && (num. size() == M.coldim()));
+			int n = M. rowdim();
+			integer mentry, bnorm; mentry = 1; bnorm = 1;
+			typename InVector::const_iterator b_p;
+			Integer tmp_I; integer tmp;
+			typename IMatrix::ConstRawIterator raw_p;
+			for (raw_p = M. rawBegin(); raw_p != M. rawEnd(); ++ raw_p) {
+				r. convert (tmp, *raw_p);
+				tmp = abs (tmp);
+				if (tmp > mentry) mentry = tmp;
+			}
+
+			for (b_p = b. begin(); b_p != b.  end(); ++ b_p) {
+				r. init (tmp_I, *b_p);
+				r. convert (tmp, tmp_I);
+				tmp = abs (tmp);
+				if (tmp > bnorm) bnorm = tmp;
+			}
+
+			integer threshold; threshold = 1; threshold <<= 50;
+
+			if ((mentry > threshold) || (bnorm > threshold)) return SS_FAILED;
+			else {
+
+				double* DM = new double [n * n];
+				double* Db = new double [n];
+				double* DM_p, *Db_p;
+				typename IMatrix::ConstRawIterator raw_p;
+				for (raw_p = M. rawBegin(), DM_p = DM; raw_p != M. rawEnd(); ++ raw_p, ++ DM_p) {
+					r. convert (tmp, *raw_p);
+					*DM_p = (double) tmp;
+				}
+
+				for (b_p = b. begin(), Db_p = Db; b_p != b. begin() + n; ++ b_p, ++ Db_p) {
+					r. init (tmp_I, *b_p);
+					r. convert (tmp, tmp_I);
+					*Db_p = (double) tmp;
+				}
+
+				integer* numx = new integer[n];
+				integer denx;
+				int ret;
+				ret = cblas_rsol (n, DM, numx, denx, Db);
+				delete[] DM; delete[] Db;
+
+				if (ret == 0){
+					r. init (den, denx);
+					typename OutVector::iterator num_p;
+					integer* numx_p = numx;
+					for (num_p = num. begin(); num_p != num. end(); ++ num_p, ++ numx_p)
+						r. init (*num_p, *numx_p);
+				}
+				delete[] numx;
+
+				if (ret == 0) return SS_OK;
+				else return SS_FAILED;
+			}
+
+		}
+#else
+		template <class IMatrix, class OutVector, class InVector>
+		SolverReturnStatus solve(OutVector& num, Integer& den,
+					 const IMatrix& M, const InVector& b) const
+		{
+			//                     std::cerr<< "dgetrf or dgetri missing" << std::endl;
+			return SS_FAILED;
+		}
+#endif
+
+	public:
+		//print out a vector
+		template <class Elt>
+		inline static int printvec (const Elt* v, int n);
+		/** Compute the OO-norm of a mtrix */
+		inline static double cblas_dOOnorm(const double* M, int m, int n);
+		/** compute the maximam of absolute value of an array*/
+		inline static double cblas_dmax (const int N, const double* a, const int inc);
+		/* apply  y <- Ax */
+		inline static int cblas_dapply (int m, int n, const double* A, const double* x, double* y);
+		inline static int cblas_mpzapply (int m, int n, const double* A, const integer* x, integer* y);
+		//update the numerator; num = num * 2^shift + d;
+		inline static int update_num (integer* num, int n, const double* d, int shift);
+		//update r = r * shift - M d, where norm (r) < 2^32;
+		inline static int update_r_int (double* r, int n, const double* M, const double* d, int shift);
+		//update r = r * shift - M d, where 2^32 <= norm (r) < 2^53
+		inline static int update_r_ll (double* r, int n, const double* M, const double* d, int shift);
+		/** compute  the hadamard bound*/
+		inline static int cblas_hbound (integer& b, int m, int n, const double* M);
+
+#if __LINBOX_HAVE_LAPACK
+		// compute the inverse of a general matrix
+		inline static int cblas_dgeinv(double* M, int n);
+		/* solve Ax = b
+		 * A, the integer matrix
+		 * b, integer rhs
+		 * Return value
+		 * 0, ok.
+		 * 1, the matrix is not invertible in floating point operations.
+		 * 2, the matrix is not well conditioned.
+		 * 3, incorrect answer, possible ill-conditioned.
+		 */
+		inline static int cblas_rsol (int n, const double* M, integer* numx, integer& denx, double* b);
+#endif
+	};
+#if __LINBOX_HAVE_LAPACK
+	template <class Ring, class Field, class RandomPrime>
+	inline int RationalSolver<Ring, Field, RandomPrime, WanTraits>::cblas_dgeinv(double* M, int n)
+	{
+		enum CBLAS_ORDER order = CblasRowMajor;
+		int lda = n;
+		int P[n];
+		int ierr = clapack_dgetrf (order, n, n, M, lda, P);
+		if (ierr != 0) {
+			std::cerr << "In RationalSolver::cblas_dgeinv Matrix is not full rank" << std::endl;
+			return -1;
+		}
+		clapack_dgetri (order, n, M, lda, P);
+		return 0;
+	}
+
+	template <class Ring, class Field, class RandomPrime>
+	inline int RationalSolver<Ring, Field, RandomPrime, WanTraits>::cblas_rsol (int n, const double* M, integer* numx, integer& denx, double* b)
+	{
+		if (n < 1) return 0;
+		double* IM = new double[n * n];
+		memcpy ((void*)IM, (const void*)M, sizeof(double)*n*n);
+		int ret;
+		//compute the inverse by flops
+		ret = cblas_dgeinv (IM, n);
+		if (ret != 0) {delete[] IM; return 1;}
+
+		double mnorm = cblas_dOOnorm(M, n, n);
+		// residual
+		double* r = new double [n];
+		// A^{-1}r
+		double* x = new double [n];
+		//ax  = A x
+		double* ax = new double [n];
+		// a digit, d \approx \alpha x
+		double* d = new double [n];
+
+		const double* p2;
+		double* pd;
+		const double T = 1 << 30;
+
+		integer* num = new integer [n];
+		integer* p_mpz;
+		integer tmp_mpz, den, denB, B;
+
+		den = 1;
+		// compute the hadamard bound
+		cblas_hbound (denB, n, n, M);
+		B = denB * denB;
+		// shouble be a check for tmp_mpz
+		tmp_mpz = 2 * mnorm + cblas_dmax (n, b, 1);
+		B <<= 1; B *= tmp_mpz; //B *= tmp_mpz;
+
+		//double log2 = log (2.0);
+		double log2 = M_LN2;
+		// r = b
+		memcpy ((void*) r, (const void*) b, sizeof(double)*n);
+
+		do  {
+			cblas_dapply (n, n, IM, r, x);
+			// compute ax
+			cblas_dapply (n, n, M, x, ax);
+			// compute ax = ax -r, the negative of residual
+			cblas_daxpy (n, -1, r, 1, ax, 1);
+			// compute possible shift
+			double normr1, normr2, normr3, shift1, shift2;
+			normr1 = cblas_dmax(n, r, 1);
+			normr2 = cblas_dmax(n, ax, 1);
+			normr3 = cblas_dmax(n, x, 1);
+			//try to find a good scalar
+			int shift = 30;
+			if (normr2 <.0000000001)
+				shift = 30;
+			else {
+				shift1 = floor(log (normr1 / normr2) / log2) - 2;
+				shift = (int)(30 < shift1 ? 30 : shift1);
+			}
+
+			normr3 = normr3 > 2 ? normr3 : 2;
+			shift2 = floor(53. * log2 / log (normr3));
+			shift = (int)(shift < shift2 ? shift : shift2);
+
+			if (shift <= 0) {
+#ifdef DEBUGRC
+				printf ("%s", "Bad scalar \n");
+				printf("%f, %f\n", normr1, normr2);
+				printf ("%d, shift = ", shift);
+				printf ("OO-norm of matrix: %f\n", cblas_dOOnorm(M, n, n));
+				printf ("OO-norm of inverse: %f\n", cblas_dOOnorm(IM, n, n));
+				printf ("Error, abort\n");
+#endif
+				delete[] IM; delete[] r; delete[] x; delete[] ax; delete[] d; delete[] num;
+				return 2;
+			}
+
+			int scalar = ((long long int)1 << shift);
+			for (pd = d, p2 = x; pd != d + n; ++ pd, ++ p2)
+				//better use round, but sun sparc machine doesnot supprot it
+				*pd = floor (*p2 * scalar);
+
+			// update den
+			den <<= shift;
+			//update num
+			update_num (num, n, d, shift);
+
+#ifdef DEBUGRC
+			printf ("in iteration\n");
+			printf ("residual=\n");
+			printvec (r,  n);
+			printf ("A^(-1) r\n");
+			printvec (x,  n);
+			printf ("scalar= ");
+			printf ("%d \n", scalar);
+			printf ("One digit=\n");
+			printvec (d, n);
+			printf ("Current bound= \n");
+			std::cout << B;
+			printf ("den= \n");
+			std::cout << den;
+			printf ("accumulate numerator=\n");
+			printvec (num, n);
+#endif
+			// update r = r * shift - M d
+			double tmp = 2 * mnorm + cblas_dmax (n, r, 1);
+			if (tmp < T) update_r_int (r, n, M, d, shift);
+			else update_r_ll (r, n, M, d, shift);
+			//update_r_ll (r, n, M, d, shift);
+		} while (den < B);
+
+		integer q, rem, den_lcm, tmp_den;
+		integer* p_x, * p_x1;
+		p_mpz = num;
+		p_x = numx;
+		// construct first answer
+		rational_reconstruction (*p_x, denx, *p_mpz, den, denB);
+		++ p_mpz;
+		++ p_x;
+
+		int sgn;
+		for (; p_mpz != num + n; ++ p_mpz, ++ p_x)  {
+			sgn = sign (*p_mpz);
+			tmp_mpz = denx * (*p_mpz);
+			tmp_mpz = abs (tmp_mpz);
+			integer::divmod (q, rem, tmp_mpz, den);
+
+			if ( rem < denx)  {
+				if (sgn >= 0)
+					*p_x = q;
+				else
+					*p_x = -q;
+			}
+			else {
+				rem = den - rem;
+				q += 1;
+				if (rem < denx) {
+					if (sgn >= 0)
+						*p_x = q;
+					else
+						*p_x = -q;
+				}
+				else {
+					rational_reconstruction (*p_x, tmp_den, *p_mpz, den, denB);
+					lcm (den_lcm, tmp_den, denx);
+					integer::divexact (tmp_mpz, den_lcm, tmp_den);
+					integer::mul (*p_x, *p_x, tmp_mpz);
+					integer::divexact (tmp_mpz, den_lcm, denx);
+					denx = den_lcm;
+					for (p_x1 = numx; p_x1 != p_x; ++ p_x1)
+						integer::mul (*p_x1, *p_x1, tmp_mpz);
+				}
+			}
+		}
+#ifdef DEBUGRC
+		std::cout << "rational answer\nCommon den = ";
+		std::cout << denx;
+		std::cout << "\nNumerator= \n";
+		printvec (numx, n);
+#endif
+
+		//normalize the answer
+		if (denx != 0) {
+			integer g; g = denx;
+			for (p_x = numx; p_x != numx + n; ++ p_x)
+				g = gcd (g, *p_x);
+			for (p_x = numx; p_x != numx + n; ++ p_x)
+				integer::divexact (*p_x, *p_x, g);
+			integer::divexact (denx, denx, g);
+		}
+
+		//check if the answer is correct, not necessary
+		cblas_mpzapply (n, n, M, (const integer*)numx, num);
+		integer* sb = new integer [n];
+		double* p;
+		for (p_mpz = sb, p = b; p_mpz != sb + n; ++ p_mpz, ++ p) {
+			*p_mpz = *p;
+			integer::mulin(*p_mpz, denx);
+		}
+		ret = 0;
+		for (p_mpz = sb, p_x = num; p_mpz != sb + n; ++ p_mpz, ++ p_x)
+			if (*p_mpz != *p_x) {
+				ret = 3;
+				break;
+			}
+#ifdef DEBUGRC
+		if (ret == 3) {
+
+			std::cout << "Input matrix:\n";
+			for (int i = 0; i < n; ++ i) {
+				const double* p = M + (i * n);
+				printvec (p, n);
+			}
+			std::cout << "Input rhs:\n";
+			printvec (b, n);
+			std::cout << "Common den: " << denx << '\n';
+			std::cout << "Numerator: ";
+			printvec (numx, n);
+			std::cout << "A num: ";
+			printvec (num, n);
+			std::cout << "denx rhs: ";
+			printvec (sb, n);
+		}
+#endif
+
+		// garbage collector
+		delete[] IM; delete[] r; delete[] x; delete[] ax; delete[] d; delete[] num; delete[] sb;
+
+		return ret;
+	}
+
+#endif
+
+
+	template <class Ring, class Field, class RandomPrime>
+	/* apply  y <- Ax */
+	inline int RationalSolver<Ring, Field, RandomPrime, WanTraits>::cblas_dapply (int m, int n, const double* A, const double* x, double* y)
+	{
+		cblas_dgemv (CblasRowMajor, CblasNoTrans, m, n, 1, A, n, x, 1, 0, y, 1);
+		return 0;
+	}
+
+	template <class Ring, class Field, class RandomPrime>
+	inline int RationalSolver<Ring, Field, RandomPrime, WanTraits>::cblas_mpzapply (int m, int n, const double* A, const integer* x, integer* y)
+	{
+		const double* p_A;
+		const integer* p_x;
+		integer* p_y;
+		integer tmp;
+		for (p_A = A, p_y = y; p_y != y + m; ++ p_y) {
+			*p_y = 0;
+			for (p_x = x; p_x != x + n; ++ p_x, ++ p_A) {
+				//mpz_set_d (tmp, *p_A);
+				//mpz_addmul_si (*p_y, *p_x, (int)(*p_A));
+				tmp = *p_x  * (long long int)(*p_A);
+				integer::addin (*p_y, tmp);
+			}
+		}
+		return 0;
+	}
+
+	template <class Ring, class Field, class RandomPrime>
+	template <class Elt>
+	inline int RationalSolver<Ring, Field, RandomPrime, WanTraits>::printvec (const Elt* v, int n)
+	{
+		const Elt* p;
+		std::cout << '[';
+		for (p = v; p != v + n; ++ p)
+			std::cout << *p << ' ';
+		std::cout << ']';
+		return 0;
+	}
+
+	template <class Ring, class Field, class RandomPrime>
+	//update num, *num <- *num * 2^shift + d
+	inline int RationalSolver<Ring, Field, RandomPrime, WanTraits>::update_num (integer* num, int n, const double* d, int shift)
+	{
+		integer* p_mpz;
+		integer tmp_mpz;
+		const double* pd;
+		for (p_mpz = num, pd = d; p_mpz != num + n; ++ p_mpz, ++ pd) {
+			(*p_mpz) = (*p_mpz) << shift;
+			tmp_mpz = *pd;
+			integer::add (*p_mpz, *p_mpz, tmp_mpz);
+		}
+		return 0;
+	}
+
+	template <class Ring, class Field, class RandomPrime>
+	//update r = r * shift - M d
+	inline int RationalSolver<Ring, Field, RandomPrime, WanTraits>::update_r_int (double* r, int n, const double* M, const double* d, int shift)
+	{
+		int tmp;
+		double* p1;
+		const double* p2;
+		const double* pd;
+		for (p1 = r, p2 = M; p1 != r + n; ++ p1) {
+			tmp = (int)(long long int) *p1;
+			tmp <<= shift;
+			for (pd = d; pd != d + n; ++ pd, ++ p2) {
+				tmp -= (int)(long long int)*pd * (int)(long long int)*p2;
+			}
+			*p1 = (double)tmp;
+		}
+		return 0;
+	}
+
+	template <class Ring, class Field, class RandomPrime>
+	//update r = r * shift - M d
+	inline int RationalSolver<Ring, Field, RandomPrime, WanTraits>::update_r_ll (double* r, int n, const double* M, const double* d, int shift)
+	{
+		long long int tmp;
+		double* p1;
+		const double* p2;
+		const double* pd;
+		for (p1 = r, p2 = M; p1 != r + n; ++ p1) {
+			tmp = (long long int) *p1;
+			tmp <<= shift;
+			for (pd = d; pd != d + n; ++ pd, ++ p2) {
+				tmp -= (long long int)*pd * (long long int) *p2;
+			}
+			*p1 = tmp;
+		}
+		return 0;
+	}
+
+	template <class Ring, class Field, class RandomPrime>
+	inline double RationalSolver<Ring, Field, RandomPrime, WanTraits>::cblas_dOOnorm(const double* M, int m, int n)
+	{
+		double norm = 0;
+		double old = 0;
+		const double* p;
+		for (p = M; p != M + (m * n); ) {
+			old = norm;
+			norm = cblas_dasum (n, p ,1);
+			if (norm < old) norm = old;
+			p += n;
+		}
+		return norm;
+	}
+
+	template <class Ring, class Field, class RandomPrime>
+	inline double RationalSolver<Ring, Field, RandomPrime, WanTraits>::cblas_dmax (const int N, const double* a, const int inc)
+	{
+		return fabs(a[cblas_idamax (N, a, inc)]);
+	}
+
+	template <class Ring, class Field, class RandomPrime>
+	inline int RationalSolver<Ring, Field, RandomPrime, WanTraits>::cblas_hbound (integer& b, int m, int n, const double* M)
+	{
+		double norm = 0;
+		const  double* p;
+		integer tmp;
+		b = 1;
+		for (p = M; p != M + (m * n); ) {
+			norm = cblas_dnrm2 (n, p ,1);
+			tmp =  norm;
+			integer::mulin (b, tmp);
+			p += n;
+		}
+
+		return 0;
+	}
+}//LinBox
+
+#endif //__LINBOX_rational_solver2__H
+
+
diff --git a/linbox/algorithms/rns.h b/linbox/algorithms/rns.h
new file mode 100644
index 0000000..64c4642
--- /dev/null
+++ b/linbox/algorithms/rns.h
@@ -0,0 +1,203 @@
+/* -*- 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
+
+/* Copyright (C) 2011 LinBox
+ * Written by BB <brice.boyer at imag.fr>
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*! @file algorithms/rns.h
+ *  @ingroup algorithms
+ * @brief <b>R</b>esidue <b>N</b>umber <b>S</b>ystem tools.
+ * NO DOC
+ */
+
+#ifndef __LINBOX_algorithms_rns_H
+#define __LINBOX_algorithms_rns_H
+
+#include "linbox/integer.h"
+#include <givaro/givrns.h> // Chinese Remainder of an array of elements
+
+#include <givaro/givrnsfixed.h>    // Chinese Remainder with fixed primes
+
+
+namespace LinBox
+{
+
+	/*! RNS.
+	 * Creates a RNS than can recover any number between \c 0 and \c q-1 if
+	 * \c Unsigned=true or \c -q+1 and \c q-1 otherwise (where \c q=2<up>\c
+	 * _bits_</up>).
+	 * @todo template by field and ring
+	 */
+	template<bool Unsigned>
+	class RNS {
+	private:
+		typedef std::vector<unsigned long>  Fvect ;
+		typedef std::vector<integer>        Ivect ;
+		typedef Modular<double>             Field ;
+
+		Fvect               _primes_; //!< vector of integers, pairwise coprime (or pairwise different primes)
+		unsigned long         _size_; //!< number of primes
+		unsigned long          _bit_; //!< max number of bit reachable. @todo why not max int reachable to save maybe a couple primes ? bof.
+		integer             _maxint_; //!< max reachable integer.
+		integer             _midint_; //!< in signed case, the mid one.
+		unsigned long           _ps_; //!< prime size (minimum)
+
+
+		typedef ::Givaro::RNSsystem<Integer, Field >      CRTSystem;
+		typedef typename CRTSystem::domains               Domains;
+		typedef typename CRTSystem::array                Elements;
+		// typedef typename CRTSystem::ring             Ring;
+
+		CRTSystem     _CRT_ ;
+		Domains _PrimeDoms_ ;
+
+#ifdef __LINBOX_HAVE_IML
+#endif
+	public:
+		/*! Create a RNS able to recover any integer of at most l bits.
+		 * Builds \c ceil(l/ps) different primes for the RNS
+		 * @param l  max recoverable bits
+		 * @param ps bitsize of the primes (defaulting to 21 because...)
+		 */
+		RNS(unsigned long l, unsigned long ps=21) ;
+		/*x Create a RNS with given primes.
+		 * @param primes given basis of primes
+		 * @param l      recoverable bits. If not given or 0, then it is computed. Giving it will reduce initialization time.
+		 * @warning both \c l and \c primes 'integrity' are not checked. Use \c checkRNS() member to perform the check.
+		 *
+		 */
+		// RNS(Ivect & primes, unsigned long l = 0) ;
+
+		// void addPrime( double prime);
+
+		// void addPrime( unsigned long newl);
+
+		// bool checkRNS() ;
+
+		// cra
+		/*! Inits cra.
+		 */
+		void initCRA() ;
+		/*! Computes \c result corresponding to the \c residues.
+		 *
+		 */
+		void cra(integer & result, const std::vector<double> & residues);
+		/*! Computes \c result corresponding to the \c residues.
+		 *
+		 */
+		void cra(std::vector<integer> & result, const std::vector<std::vector<double> > & residues);
+
+		/*! Computes \c result corresponding to the iteration.
+		 *
+		 */
+		template<typename Iteration>
+		void cra(Ivect & result, Iteration & iter) ;
+
+		template<class Tinteger, class Tresidue>
+		void cra(Tinteger & result, Tresidue & residues);
+
+		template<class Tinteger, class Tresidue>
+		void convert(Tinteger & result, Tresidue & residues) ;
+
+		// mixed radix
+	};
+
+
+	template<bool Unsigned>
+	class RNSfixed {
+	private:
+		typedef std::vector<unsigned long>  Fvect ;
+		typedef std::vector<integer>        Ivect ;
+		typedef Modular<double>             Field ;
+
+		Fvect               _primes_; //!< vector of integers, pairwise coprime (or pairwise different primes)
+		unsigned long         _size_; //!< number of primes
+		unsigned long          _bit_; //!< max number of bit reachable. @todo why not max int reachable to save maybe a couple primes ? bof.
+		integer             _maxint_; //!< max reachable integer.
+		integer             _midint_; //!< in signed case, the mid one.
+		unsigned long           _ps_; //!< prime size (minimum)
+
+
+		typedef ::Givaro::RNSsystemFixed<Integer>       CRTSystemFixed;
+		typedef CRTSystemFixed::array                        Prime_t;
+		// typedef typename CRTSystem::domains       Domains;
+		// typedef typename CRTSystem::array        Elements;
+		// typedef typename CRTSystem::ring             Ring;
+
+		CRTSystemFixed     _CRT_ ;
+		Prime_t         _Primes_ ;
+
+#ifdef __LINBOX_HAVE_IML
+#endif
+	public:
+		/*! Create a RNSfixed able to recover any integer of at most l bits.
+		 * Builds \c ceil(l/ps) different primes for the RNSfixed
+		 * @param l  max recoverable bits
+		 * @param ps bitsize of the primes (defaulting to 21 because...)
+		 */
+		RNSfixed(unsigned long l, unsigned long ps=21) ;
+		/*x Create a RNSfixed with given primes.
+		 * @param primes given basis of primes
+		 * @param l      recoverable bits. If not given or 0, then it is computed. Giving it will reduce initialization time.
+		 * @warning both \c l and \c primes 'integrity' are not checked. Use \c checkRNSfixed() member to perform the check.
+		 *
+		 */
+		// RNSfixed(Ivect & primes, unsigned long l = 0) ;
+
+		// void addPrime( double prime);
+
+		// void addPrime( unsigned long newl);
+
+		// bool checkRNSfixed() ;
+
+		// cra
+		/*! Inits cra.
+		 */
+		void initCRA() ;
+		/*! Computes \c result corresponding to the \c residues.
+		 *
+		 */
+		void cra(integer & result, const std::vector<double> & residues);
+		/*! Computes \c result corresponding to the \c residues.
+		 *
+		 */
+		void cra(std::vector<integer> & result, const std::vector<std::vector<double> > & residues);
+
+		/*! Computes \c result corresponding to the iteration.
+		 *
+		 */
+		template<class Iteration>
+		void cra(Ivect & result, Iteration & iter) ;
+
+		template<class Tinteger, class Tresidue>
+		void cra(Tinteger & result, Tresidue & residues);
+
+		template<class Tinteger, class Tresidue>
+		void convert(Tinteger & result, Tresidue & residues) ;
+
+		// mixed radix
+	};
+
+}
+
+#include "rns.inl"
+
+#endif // __LINBOX_algorithms_rns_H
diff --git a/linbox/algorithms/rns.inl b/linbox/algorithms/rns.inl
new file mode 100644
index 0000000..70d1f02
--- /dev/null
+++ b/linbox/algorithms/rns.inl
@@ -0,0 +1,290 @@
+/* -*- 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
+
+/* Copyright (C) 2011 LinBox
+ * Written by BB <brice.boyer at imag.fr>
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*! @file algorithms/rns.inl
+ *  @ingroup algorithms
+ * @brief <b>R</b>esidue <b>N</b>umber <b>S</b>ystem implementation.
+ * NO DOC
+ */
+
+#ifndef __LINBOX_algorithms_rns_INL
+#define __LINBOX_algorithms_rns_INL
+
+#include <set>
+#include "linbox/util/debug.h"
+
+namespace LinBox
+{
+	/* Constructor */
+	template<bool Unsigned>
+	RNS<Unsigned>::RNS(unsigned long l, unsigned long ps) :
+		_bit_(l),  _ps_(ps)
+	{
+		linbox_check(ps<30); // oupa, mais moins qu'un unsigned long
+		unsigned int nb_primes = std::ceil(double(l)/double(ps));
+		// integer maxint = Integer::pow(2,l); XXX je veux faire ça !!!!!!
+		integer maxint = pow((integer)2,(Unsigned?l:l+1));
+		_primes_.resize(nb_primes);
+		std::set<unsigned long> primeset ;
+		size_t lg      = 0 ;
+		int tries      = 0 ;
+		int penalty    = 0 ;
+		integer curint = 1 ;
+		while(true) { // this loop cannot be infinite
+			while(tries < 3) { // if we fail 3 times to insert, we don't have enough primes to sample.
+				if (curint>maxint)
+					break;
+				RandomPrimeIterator genprimes(_ps_+penalty);
+				unsigned long p = genprimes.randomPrime() ;
+				++genprimes;
+				primeset.insert(p);
+				if (lg < primeset.size()) {
+					++lg ;
+					Integer::mulin(curint,p) ;
+				}
+				else { // not inserted
+					++ tries ;
+				}
+				//! @todo if log2(maxint/curint)<ps use smaller genprime.
+			}
+			if (curint>maxint)
+				break;
+			++penalty;  // no try : penalty.
+			tries = 0 ; // restarting
+		}
+		_maxint_ = curint ;
+		if (!Unsigned)
+			Integer::div(_midint_,_maxint_,2);
+		_size_   = lg;
+		_primes_.resize(lg);
+		std::set<unsigned long>::iterator pset = primeset.begin();
+		Fvect::iterator pvec = _primes_.begin();
+		for ( ; pvec != _primes_.end() ; ++pset, ++pvec) { // dumping set to vect
+			*pvec = *pset ;
+		}
+
+		// std::cout << "primes are : " << _primes_ << std::endl;
+
+	}
+
+	template<bool Unsigned>
+	void
+	RNS<Unsigned>::initCRA()
+	{
+		Fvect::iterator pvec = _primes_.begin();
+		_PrimeDoms_.resize( _size_ );
+
+		typename Domains::iterator  i = _PrimeDoms_.begin();
+		for(; i != _PrimeDoms_.end(); ++i, ++pvec ) {
+			*i = Field( (double)*pvec  );
+		}
+		CRTSystem CRT( _PrimeDoms_ );
+		_CRT_ = CRT  ;
+		return ;
+	}
+
+	template<bool Unsigned>
+	void
+	RNS<Unsigned>::cra(integer & result, const std::vector<double> & residues)
+	{
+		Elements Moduli( _size_ );
+		typename Elements::iterator e = Moduli.begin();
+		std::vector<double>::const_iterator r = residues.begin();
+		for (; e != Moduli.end() ; ++e, ++r) {
+			*e = *r ;
+		}
+		_CRT_.RnsToRing( result, Moduli );
+		linbox_check(result >=0);
+		linbox_check(result < _maxint_ );
+		if (!Unsigned)
+			if (result>_midint_) {
+			       	Integer::subin(result,_maxint_);
+				linbox_check(result<=_midint_);
+			}
+		return ;
+	}
+
+	template<bool Unsigned>
+	template<typename Function>
+	void
+	RNS<Unsigned>::cra(Ivect & result, Function & unitCRA)
+	{
+		std::vector<std::vector<double> > residues(_size_);
+		for (size_t i = 0 ; i < _size_ ; ++i) {
+			residues[i].resize(result.size());
+			unitCRA(residues[i],_PrimeDoms_[i]); // creates residue list
+		}
+
+		for (size_t i = 0 ; i < result.size() ; ++i) {
+			Elements Moduli( _size_ );
+			typename Elements::iterator e = Moduli.begin();
+			std::vector<std::vector<double> >::iterator r = residues.begin();
+			for (; e != Moduli.end() ; ++e,++r) {
+				*e = (*r)[i] ;
+			}
+			_CRT_.RnsToRing( result[i], Moduli );
+			// std::cout << result[i] << '<' << _maxint_ << std::endl;
+			linbox_check(result[i] >=0);
+			linbox_check(result [i]< _maxint_ );
+
+			if (!Unsigned)
+				if (result[i]>_midint_) {
+				       	Integer::subin(result[i],_maxint_);
+					linbox_check(result[i]<=_midint_);
+				}
+		}
+		return ;
+	}
+
+}
+
+
+namespace LinBox
+{
+	/* Constructor */
+	template<bool Unsigned>
+	RNSfixed<Unsigned>::RNSfixed(unsigned long l, unsigned long ps) :
+		_bit_(l),  _ps_(ps)
+	{
+		linbox_check(ps<30); // oupa, mais moins qu'un unsigned long
+		unsigned int nb_primes = std::ceil(double(l)/double(ps));
+		// integer maxint = Integer::pow(2,l); XXX je veux faire ça !!!!!!
+		integer maxint = pow((integer)2,(Unsigned?l:l+1));
+		// std::cout << "target max int : " << maxint << std::endl;
+		_primes_.resize(nb_primes);
+		std::set<unsigned long> primeset ;
+		size_t lg      = 0 ;
+		int tries      = 0 ;
+		int penalty    = 0 ;
+		integer curint = 1 ;
+		while(true) { // this loop cannot be infinite
+			while(tries < 3) { // if we fail 3 times to insert, we don't have enough primes to sample.
+				if (curint>maxint)
+					break;
+				RandomPrimeIterator genprimes(_ps_+penalty);
+				unsigned long p = genprimes.randomPrime() ;
+				++genprimes;
+				primeset.insert(p);
+				if (lg < primeset.size()) {
+					++lg ;
+					Integer::mulin(curint,p) ;
+				}
+				else { // not inserted
+					++ tries ;
+				}
+				//! @todo if log2(maxint/curint)<ps use smaller genprime.
+			}
+			if (curint>maxint)
+				break;
+			++penalty;  // no try : penalty.
+			tries = 0 ; // restarting
+		}
+		// std::cout << "got max int : " << curint << std::endl;
+		_maxint_ = curint;
+		if (!Unsigned)
+			Integer::div(_midint_,_maxint_,2);
+		_size_ = lg;
+		_primes_.resize(lg);
+		std::set<unsigned long>::iterator pset = primeset.begin();
+		Fvect::iterator pvec = _primes_.begin();
+		for ( ; pvec != _primes_.end() ; ++pset, ++pvec) { // dumping set to vect
+			*pvec = *pset ;
+		}
+		// std::cout << "primes are : " << _primes_ << std::endl;
+
+
+	}
+
+	template<bool Unsigned>
+	void
+	RNSfixed<Unsigned>::initCRA()
+	{
+		Fvect::iterator pvec = _primes_.begin();
+		_Primes_.resize( _size_ );
+
+		typename Prime_t::iterator  i = _Primes_.begin();
+		for(; i != _Primes_.end(); ++i, ++pvec ) {
+			*i = *pvec ;
+		}
+		CRTSystemFixed CRT(_Primes_);
+		_CRT_ = CRT;
+		return ;
+	}
+
+	template<bool Unsigned>
+	void
+	RNSfixed<Unsigned>::cra(integer & result, const std::vector<double> & residues)
+	{
+		Prime_t Moduli( _size_ );
+		typename Prime_t::iterator e = Moduli.begin();
+		std::vector<double>::const_iterator r = residues.begin();
+		for (; e != Moduli.end() ; ++e, ++r) {
+			*e = *r ;
+		}
+		_CRT_.RnsToRing( result, Moduli );
+	linbox_check(result >=0);
+		linbox_check(result < _maxint_ );
+
+		if (!Unsigned)
+			if (result>_midint_) {
+				Integer::subin(result,_maxint_);
+					linbox_check(result<=_midint_);
+			}
+		return ;
+	}
+
+	template<bool Unsigned>
+	template<class Function>
+	void
+	RNSfixed<Unsigned>::cra(Ivect & result, Function & unitCRA)
+	{
+		std::vector<std::vector<double> > residues(_size_);
+		for (size_t i = 0 ; i < _size_ ; ++i) {
+			residues[i].resize(result.size());
+			unitCRA(residues[i],Modular<double>(_Primes_[i]));
+		}
+
+		for (size_t i = 0 ; i < result.size() ; ++i) {
+			Prime_t Moduli( _size_ );
+			typename Prime_t::iterator e = Moduli.begin();
+			std::vector<std::vector<double > >::iterator r = residues.begin();
+			for (; e != Moduli.end() ; ++e,++r) {
+				*e = (*r)[i] ;
+			}
+			_CRT_.RnsToRing( result[i], Moduli );
+	linbox_check(result [i]>=0);
+		linbox_check(result [i]< _maxint_ );
+
+			if (!Unsigned)
+				if (result[i]>_midint_){
+					Integer::subin(result[i],_maxint_);
+					linbox_check(result[i]<=_midint_);
+				}
+		}
+		return ;
+	}
+
+}
+
+#endif // __LINBOX_algorithms_rns_INL
diff --git a/linbox/algorithms/sigma-basis.h b/linbox/algorithms/sigma-basis.h
index d420d35..571cec7 100644
--- a/linbox/algorithms/sigma-basis.h
+++ b/linbox/algorithms/sigma-basis.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/algorithms/sigma-basis.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -21,10 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-
-
-#ifndef __SIGMA_BASIS_H
-#define __SIGMA_BASIS_H
+#ifndef __LINBOX_sigma_basis_H
+#define __LINBOX_sigma_basis_H
 
 #include <vector>
 #include <iostream>
@@ -41,19 +39,29 @@
 
 #include <linbox/algorithms/matpoly-mult.h>
 #include <linbox/algorithms/echelon-form.h>
-
+#include <linbox/vector/subvector.h>
 #include <linbox/util/timer.h>
 
 
-//#define OPTMIZED_SIGMA_UPDATE 
+//#define OPTMIZED_SIGMA_UPDATE
 
+/*! @file algorithms/sigma-basis.h
+ * @brief \f$\sigma\f$-basis (minimal basis).
+ */
 
-namespace LinBox {
+namespace LinBox
+{
 
 
+	/*!
+	 * @brief implementation of \f$\sigma\f$-basis (minimal basis).
+	 * @bib
+	 * - P. Giorgi, C.P. Jeannerod and G. Villard. <i>On the complexity of polynomial matrix computations.</i>   ISSAC'03 <a href=http://dx.doi.org/10.1145/860854.860889>doi</a>.
+	 *
+	 */
 	template<class _Field>
 	class SigmaBasis {
-		
+
 	public:
 		typedef _Field                           Field;
 		typedef typename Field::Element        Element;
@@ -64,7 +72,8 @@ namespace LinBox {
 		BlasMatrixDomain<Field>         _BMD;
 		MatrixDomain<Field>              _MD;
 		std::vector<Coefficient>     &_Serie;
-		
+		PolynomialMatrixDomain<Field > PM_domain;
+
 #ifdef _BM_TIMING
 		mutable Timer ttMBasis              , tMBasis,
 			ttUpdateSerie         , tUpdateSerie,
@@ -77,53 +86,55 @@ namespace LinBox {
 			ttResidueSh           , tResidueSh,
 			Total;
 
-    
-		void print(Timer& T, const  char* timer, const char* title) {
+		void print(Timer& T, const  char* timer, const char* title)
+		{
 			if (&T != &Total)
 				Total+=T;
 			if (T.count() > 0) {
 				std::cout<<title<<": "<<timer;
-				for (int i=strlen(timer); i<28; i++) 
+				for (int i=strlen(timer); i<28; i++)
 					std::cout << ' ';
 				double tt = (T.usertime()<0.01)? 0.01 : T.usertime();
 				std::cout<<tt<<"s. (cpu)  ["<<T.count()<<"]"<<std::endl;
 			}
 		}
 	public:
-		void printTimer() {
-		
+		void printTimer()
+		{
+
 			print(ttMBasis              , "MBasis computation", "recursive");
 			print(ttUpdateSerie         , "Updating Power Serie", "recursive");
 			print(ttBasisMultiplication , "Basis Multiplication", "recursive");
-			print(ttPermutation         , "Permutation"   , "iterative"); 
+			print(ttPermutation         , "Permutation"   , "iterative");
 			print(ttTransformation      , "Transformation", "iterative");
-			print(ttSigmaUp             , "Sigma Update"  , "iterative");        			
-			print(ttResidueUp           , "Residue Update", "iterative");     
+			print(ttSigmaUp             , "Sigma Update"  , "iterative");
+			print(ttResidueUp           , "Residue Update", "iterative");
 			print(ttSigmaSh             , "Sigma Shifting", "iterative");
 			print(ttResidueSh           , "Residue Shifting","iterative");
 			print(Total, "Total", "");
 			std::cout<<std::endl<<std::endl;
 		}
 
-
-		void clearTimer() {
-			 ttMBasis.clear();
-			 ttUpdateSerie.clear();
-			 ttBasisMultiplication.clear();
-			 ttPermutation.clear();   
-			 ttTransformation.clear(); 
-			 ttSigmaUp.clear();     
-			 ttResidueUp.clear();     
-			 ttSigmaSh.clear();        
-			 ttResidueSh.clear(); 	 
-			 Total.clear();
-		}	
-#endif 
+		void clearTimer()
+		{
+			ttMBasis.clear();
+			ttUpdateSerie.clear();
+			ttBasisMultiplication.clear();
+			ttPermutation.clear();
+			ttTransformation.clear();
+			ttSigmaUp.clear();
+			ttResidueUp.clear();
+			ttSigmaSh.clear();
+			ttResidueSh.clear();
+			Total.clear();
+		}
+#endif
 
 
 	public:
 
-		SigmaBasis(const Field &F, std::vector<Coefficient> &PowerSerie) : _F(F), _BMD(F), _MD(F), _Serie(PowerSerie) 
+		SigmaBasis(const Field &F, std::vector<Coefficient> &PowerSerie) :
+			_F(F), _BMD(F), _MD(F), _Serie(PowerSerie), PM_domain(F)
 		{
 #ifdef  _BM_TIMING
 			clearTimer();
@@ -131,14 +142,15 @@ namespace LinBox {
 		}
 
 		void right_basis(std::vector<Coefficient>     &SigmaBase,
-				size_t                           degree, 
-				std::vector<size_t>             &defect) {
+				 size_t                           degree,
+				 std::vector<size_t>             &defect)
+		{
+
 
-			
 			size_t length=_Serie.size();
 			size_t m = _Serie[0].rowdim();
-			size_t n = _Serie[0].coldim();  
-			
+			size_t n = _Serie[0].coldim();
+
 			const Coefficient TransposedZero(n,m);
 
 			// take the transposed of the Serie and use PM_Basis
@@ -148,38 +160,40 @@ namespace LinBox {
 				for (size_t i=0;i<m;++i)
 					for (size_t j=0;j<n;++j)
 						TransposedSerie[k].setEntry(j,i, _Serie[k].getEntry(i,j));
-			
-			const Coefficient Zero(n, n);	
-		
+
+			const Coefficient Zero(n, n);
+
 			// Prepare SigmaBase
 			SigmaBase.resize(degree+1, Zero);
 
 			// Compute Sigma Base up to the order degree
-			PM_Basis(SigmaBase, TransposedSerie, degree, defect);					
+			PM_Basis(SigmaBase, TransposedSerie, degree, defect);
 		}
 
 		void left_basis(std::vector<Coefficient>      &SigmaBase,
-				 size_t                           degree, 
-				 std::vector<size_t>             &defect) {
+				size_t                           degree,
+				std::vector<size_t>             &defect)
+		{
 
 			const size_t m = _Serie[0].rowdim();
 			const Coefficient Zero(m, m);
 
 			// Prepare SigmaBase
 			SigmaBase.resize(degree+1, Zero);
-			
+
 			// Compute Sigma Base up to the order degree
-			PM_Basis(SigmaBase, _Serie, degree, defect);			
+			PM_Basis(SigmaBase, _Serie, degree, defect);
 		}
 
 
 		void multi_left_basis(std::vector<Coefficient>      &SigmaBase1,
-				      size_t                            degree1, 
+				      size_t                            degree1,
 				      std::vector<size_t>              &defect1,
 				      std::vector<Coefficient>      &SigmaBase2,
-				      size_t                            degree2, 
-				      std::vector<size_t>              &defect2) {
-			
+				      size_t                            degree2,
+				      std::vector<size_t>              &defect2)
+		{
+
 			linbox_check(degree1 < degree2);
 
 			const size_t m = _Serie[0].rowdim();
@@ -187,42 +201,43 @@ namespace LinBox {
 			const Coefficient Zero(m, m);
 			const Coefficient ZeroSerie(m,n);
 
-			
+
 			// Prepare SigmaBases
 			SigmaBase1.resize(degree1+1, Zero);
 			SigmaBase2.resize(degree2+1, Zero);
-			
+
 			// Compute Sigma Base up to degree1
-			PM_Basis(SigmaBase1, _Serie, degree1, defect1);	
+			PM_Basis(SigmaBase1, _Serie, degree1, defect1);
 
 			// copy defect
 			defect2 = defect1;
-						
-			// Update Serie to compute Sigma base up to degree1 - degree2			
-			std::vector<Coefficient> Serie2(degree2-degree1+1,ZeroSerie);	
+
+			// Update Serie to compute Sigma base up to degree1 - degree2
+			std::vector<Coefficient> Serie2(degree2-degree1+1,ZeroSerie);
 			ComputeNewSerieClassic(Serie2,SigmaBase1, _Serie, degree1, degree2-degree1);
-		
-			// Compute Sigma Base up to degree2 
+
+			// Compute Sigma Base up to degree2
 			std::vector<Coefficient> Sigma2(degree2-degree1+1, Zero);
-			PM_Basis(Sigma2, Serie2, degree2-degree1, defect2);	
+			PM_Basis(Sigma2, Serie2, degree2-degree1, defect2);
 
 			// multily SigmaBase1 by Sigma
-			MulSigmaBasis(SigmaBase2,Sigma2,SigmaBase1);		
+			MulSigmaBasis(SigmaBase2,Sigma2,SigmaBase1);
 		}
 
 
 		void multi_right_basis(std::vector<Coefficient>      &SigmaBase1,
-				       size_t                            degree1, 
+				       size_t                            degree1,
 				       std::vector<size_t>              &defect1,
 				       std::vector<Coefficient>      &SigmaBase2,
-				       size_t                            degree2, 
-				       std::vector<size_t>              &defect2) {
-			
+				       size_t                            degree2,
+				       std::vector<size_t>              &defect2)
+		{
+
 			linbox_check(degree1 < degree2);
 
 			size_t length=_Serie.size();
 			size_t m = _Serie[0].rowdim();
-			size_t n = _Serie[0].coldim();  			
+			size_t n = _Serie[0].coldim();
 			const Coefficient TransposedZero(n,m);
 			const Coefficient Zero(n, n);
 
@@ -233,27 +248,27 @@ namespace LinBox {
 				for (size_t i=0;i<m;++i)
 					for (size_t j=0;j<n;++j)
 						TransposedSerie[k].setEntry(j,i, _Serie[k].getEntry(i,j));
-							
+
 			// Prepare SigmaBases
 			SigmaBase1.resize(degree1+1, Zero);
 			SigmaBase2.resize(degree2+1, Zero);
-			
+
 			// Compute Sigma Base up to degree1
 			PM_Basis(SigmaBase1, TransposedSerie, degree1, defect1);
-			
+
 			// copy defect
 			defect2 = defect1;
 
-			// Update Serie to compute Sigma base up to degree1 - degree2			
-			std::vector<Coefficient> Serie2(degree2-degree1+1,TransposedZero);	
+			// Update Serie to compute Sigma base up to degree1 - degree2
+			std::vector<Coefficient> Serie2(degree2-degree1+1,TransposedZero);
 			ComputeNewSerieClassic(Serie2,SigmaBase1, TransposedSerie, degree1, degree2-degree1);
-		
-			// Compute Sigma Base up to degree2 
+
+			// Compute Sigma Base up to degree2
 			std::vector<Coefficient> Sigma2(degree2-degree1+1, Zero);
-			PM_Basis(Sigma2, Serie2, degree2-degree1, defect2);	
+			PM_Basis(Sigma2, Serie2, degree2-degree1, defect2);
 
 			// multily SigmaBase1 by Sigma
-			MulSigmaBasis(SigmaBase2,Sigma2,SigmaBase1);	
+			MulSigmaBasis(SigmaBase2,Sigma2,SigmaBase1);
 		}
 
 
@@ -261,24 +276,23 @@ namespace LinBox {
 		// function to compute the left denominator from Matrix Pade Approximant
 		// compute Q(x) in Q(x).S(x) - R(x) = O(x^degree).
 
-		void left_PadeMatrix (std::vector<Coefficient>            &Approx, 			
-				      size_t                               degree, 
-				      std::vector<size_t>                 &defect) {
+		void left_PadeMatrix (std::vector<Coefficient>            &Approx,
+				      size_t                               degree,
+				      std::vector<size_t>                 &defect)
+		{ PadeApproximant(Approx, _Serie, degree, defect); }
 
-			PadeApproximant(Approx, _Serie, degree, defect);
-		}
-	
 		// function to compute the right denominator from Matrix Pade Approximant
 		// compute Q(x) in S(x).Q(x) - R(x) = O(x^degree).
-		
-		void right_PadeMatrix (std::vector<Coefficient>            &Approx, 
-				       size_t                               degree, 
-				       std::vector<size_t>                 &defect) {
+
+		void right_PadeMatrix (std::vector<Coefficient>            &Approx,
+				       size_t                               degree,
+				       std::vector<size_t>                 &defect)
+		{
 
 			size_t deg = _Serie.size();
 			size_t m   = _Serie[0].rowdim();
 			size_t n   = _Serie[0].coldim();
-			
+
 
 			// transpose the PowerSerie
 			const Coefficient Zero(m,n);
@@ -297,35 +311,37 @@ namespace LinBox {
 			for (size_t k=0;k<d;++k)
 				for (size_t i=0;i<m;++i)
 					for (size_t j=i;j<n;++j)
-						std::swap(Approx[k].refEntry(i,j), Approx[k].refEntry(j,i));				
+						std::swap(Approx[k].refEntry(i,j), Approx[k].refEntry(j,i));
 		}
 
-			
+
 		// function to compute two right denominators from Matrix Pade Approximant at two different degrees
-		// compute Q1(x), Q2(x) such that  Q1(x).S(x) - R1(x) = O(x^degree1) and Q2(x).S(x) - R2(x) = O(x^degree2) 
-		
-		void multi_left_PadeMatrix (std::vector<Coefficient>            &Approx1, 			
+		// compute Q1(x), Q2(x) such that  Q1(x).S(x) - R1(x) = O(x^degree1) and Q2(x).S(x) - R2(x) = O(x^degree2)
+
+		void multi_left_PadeMatrix (std::vector<Coefficient>            &Approx1,
 					    size_t                               degree1,
-					    std::vector<Coefficient>            &Approx2, 			
+					    std::vector<Coefficient>            &Approx2,
 					    size_t                               degree2,
-					    std::vector<size_t>                  &defect) {
-			
+					    std::vector<size_t>                  &defect)
+		{
+
 			MultiPadeApproximant(Approx1, degree1, Approx2, degree2, _Serie, defect);
 		}
-		
+
 		// function to compute two right denominators from Matrix Pade Approximant at two different degrees
-		// compute Q1(x), Q2(x) such that  S(x).Q1(x) - R1(x) = O(x^degree1) and S(x).Q2(x) - R2(x) = O(x^degree2) 
-		
-		void multi_right_PadeMatrix (std::vector<Coefficient>            &Approx1, 			
+		// compute Q1(x), Q2(x) such that  S(x).Q1(x) - R1(x) = O(x^degree1) and S(x).Q2(x) - R2(x) = O(x^degree2)
+
+		void multi_right_PadeMatrix (std::vector<Coefficient>            &Approx1,
 					     size_t                               degree1,
-					     std::vector<Coefficient>            &Approx2, 			
+					     std::vector<Coefficient>            &Approx2,
 					     size_t                               degree2,
-					     std::vector<size_t>                  &defect) {
+					     std::vector<size_t>                  &defect)
+		{
 
 			size_t deg = _Serie.size();
 			size_t m   = _Serie[0].rowdim();
 			size_t n   = _Serie[0].coldim();
-			
+
 
 			// transpose the PowerSerie
 			const Coefficient Zero(m,n);
@@ -345,15 +361,15 @@ namespace LinBox {
 			for (size_t k=0;k<d;++k)
 				for (size_t i=0;i<m;++i)
 					for (size_t j=i;j<n;++j)
-						std::swap(Approx1[k].refEntry(i,j), Approx1[k].refEntry(j,i));				
+						std::swap(Approx1[k].refEntry(i,j), Approx1[k].refEntry(j,i));
 			d = Approx2.size();
 			for (size_t k=0;k<d;++k)
 				for (size_t i=0;i<m;++i)
 					for (size_t j=i;j<n;++j)
-						std::swap(Approx2[k].refEntry(i,j), Approx2[k].refEntry(j,i));				
+						std::swap(Approx2[k].refEntry(i,j), Approx2[k].refEntry(j,i));
 		}
 
-		
+
 	public:
 		//protected:
 
@@ -361,12 +377,17 @@ namespace LinBox {
 		// according to a vector of defect.
 		// algorithm is from Giorgi, Jeannerod and Villard  ISSAC'03
 		//
-		// SigmaBase must be already allocated with degree+1 elements		
-		void PM_Basis(std::vector<Coefficient>     &SigmaBase,
-			      std::vector<Coefficient>    &PowerSerie, 
-			      size_t                           degree, 
-			      std::vector<size_t>             &defect) {
-						
+		// SigmaBase must be already allocated with degree+1 elements
+		// PowerSerie must have at least degree+1 element
+#define MBASIS_THRESHOLD 16
+
+		template <class Polynomial1, class Polynomial2>
+		void PM_Basis(Polynomial1      &SigmaBase,
+			      const Polynomial2     &PowerSerie,
+			      size_t               degree,
+			      std::vector<size_t> &defect)
+		{
+
 			size_t m,n;
 			m = PowerSerie[0].rowdim();
 			n = PowerSerie[0].coldim();
@@ -381,81 +402,98 @@ namespace LinBox {
 					Identity.setEntry(i,i,one);
 				SigmaBase[0]=Identity;
 			}
+
 			else {
-				if (degree == 1) {
-#ifdef _BM_TIMING				
-					tMBasis.clear();
-					tMBasis.start();
+
+				if (degree <= MBASIS_THRESHOLD) {
+#ifdef _BM_TIMING
+					tMBasis.clear();tMBasis.start();
 #endif
 					M_Basis(SigmaBase, PowerSerie, degree, defect);
 #ifdef _BM_TIMING
-					tMBasis.stop();
-					ttMBasis += tMBasis;
-#endif			
+					tMBasis.stop();	ttMBasis += tMBasis;
+#endif
 				}
+
 				else {
-					size_t degree1,degree2;
-					degree1 = (degree >> 1) + (degree & 1);
-					degree2 = degree - degree1;									
+					size_t degree1,degree2,shift;
+					shift=(degree & 0x1);
+					degree1 = (degree >> 1) + shift;
+					degree2 = degree - degree1;
 
 					// Compute Sigma Base of half degree
 					std::vector<Coefficient> Sigma1(degree1+1,ZeroSigma);
-					std::vector<Coefficient> Serie1(degree1+1);
+
+					std::vector<Coefficient> Serie1(degree1+1,ZeroSerie);
 					for (size_t i=0;i< degree1+1;++i)
 						Serie1[i] = PowerSerie[i];
+
+					//Subvector<typename Polynomial2::iterator> Serie1(PowerSerie.begin(),PowerSerie.begin()+degree1);
 					PM_Basis(Sigma1, Serie1, degree1, defect);
-#ifdef _BM_TIMING				
-					tUpdateSerie.clear();
-					tUpdateSerie.start();
+					// !!! NEED TO RESIZE SIGMA1
+					// because MBasis remove all 0 matrix from leading coefficient of SigmaBase
+					// while PM_Basis does not
+					Sigma1.resize(degree1+1,ZeroSigma);
+#ifdef _BM_TIMING
+					tUpdateSerie.clear();tUpdateSerie.start();
 #endif
-					
 					// Compute Serie2 = x^(-degree1).Sigma.PowerSerie mod x^degree2
-					std::vector<Coefficient> Serie2(degree1+1,ZeroSerie);										
+					// degree1 instead degree2 for using middle product computation
+					std::vector<Coefficient> Serie2(degree1+1,ZeroSerie);
+
+					//if (2*Sigma1.size() !=  PowerSerie.size()+1)
+					//std::cerr<<Sigma1.size()<<" "<<PowerSerie.size()<<" marche pas\n";
+
+
+					//PM_domain.midproduct(Serie2,Sigma1,PowerSerie);
 					ComputeNewSerie(Serie2,Sigma1,PowerSerie, degree1, degree2);
-#ifdef _BM_TIMING				
-					tUpdateSerie.stop();
-					ttUpdateSerie += tUpdateSerie;
+					Serie2.resize(degree2+1);
+
+#ifdef _BM_TIMING
+					tUpdateSerie.stop();ttUpdateSerie += tUpdateSerie;
 #endif
-					// Compute Sigma Base of half degree from updated Power Serie					
+					// Compute Sigma Base of half degree from updated Power Serie
 					std::vector<Coefficient> Sigma2(degree2+1,ZeroSigma);
+
 					PM_Basis(Sigma2, Serie2, degree2, defect);
-						
-#ifdef _BM_TIMING				
-					tBasisMultiplication.clear();
-					tBasisMultiplication.start();
+
+#ifdef _BM_TIMING
+					tBasisMultiplication.clear();tBasisMultiplication.start();
 #endif
-					// Compute the whole Sigma Base through the product 
-					// of the Sigma Basis Sigma1 x Sigma2										
-					MulSigmaBasis(SigmaBase,Sigma2,Sigma1);						
-#ifdef _BM_TIMING				
-					tBasisMultiplication.stop();
-					ttBasisMultiplication += tBasisMultiplication;
+					// Compute the whole Sigma Base: SigmaBase= Sigma1 x Sigma2
+					PM_domain.mul(SigmaBase,Sigma2,Sigma1);
+#ifdef _BM_TIMING
+					tBasisMultiplication.stop();ttBasisMultiplication += tBasisMultiplication;
 #endif
-
 				}
 			}
 		}
 
 
+		void print_multime()
+		{std::cout<<"multime: "<<PM_domain.multime<<std::endl;}
+
 		// Computation of a minimal Sigma Base of a Power Serie up to length
-		// algorithm is from Giorgi, Jeannerod and Villard  ISSAC'03		
-		void M_Basis(std::vector<Coefficient>     &SigmaBase,
-			     std::vector<Coefficient>    &PowerSerie, 
-			     size_t                           length, 
-			     std::vector<size_t>             &defect) {
+		// algorithm is from Giorgi, Jeannerod and Villard  ISSAC'03
+		template <class Polynomial1, class Polynomial2>
+		void M_Basis(Polynomial1        &SigmaBase,
+			     Polynomial2        PowerSerie,
+			     size_t                 length,
+			     std::vector<size_t>   &defect)
+		{
 
-			// Get the dimension of matrices inside 
+			// Get the dimension of matrices inside
 			// the Matrix Power Serie
 			size_t m,n;
 			m = PowerSerie[0].rowdim();
 			n = PowerSerie[0].coldim();
 
-			// Set some useful constants 
+			// Set some useful constants
 			const Coefficient Zero(m,m);
 			Element one, zero;
 			_F.init(one,1UL);
 			_F.init(zero,0UL);
-			
+
 			// Reserve memory for the Sigma Base and set SigmaBase[0] to Identity
 			SigmaBase.reserve(length+1);
 			SigmaBase.resize(1);
@@ -463,11 +501,11 @@ namespace LinBox {
 			for (size_t i=0;i< m;++i)
 				Identity.setEntry(i,i,one);
 			SigmaBase[0]=Identity;
-			
+
 			// Keep track on Sigma Base's row degree
 			// I adjust the degree with the maximal difference between defects
 			// this is just to be sure to catch degree increase according to elimination process
-			int min_defect, max_defect;
+			size_t min_defect, max_defect;
 			min_defect = max_defect = defect[0];
 			for (size_t i=0;i<m;++i){
 				if ( defect[i] > max_defect)
@@ -476,38 +514,40 @@ namespace LinBox {
 					min_defect = defect[i];
 			}
 			std::vector<size_t> degree(m,max_defect-min_defect);
-		
-			
+
+
 			// Discrepancy
 			Coefficient Discrepancy(m,n);
 			Timer chrono;
+#ifdef  _BM_TIMING
 			int cptr=0;
+#endif
 
 			// Compute the minimal Sigma Base of the PowerSerie up to length
 			for (size_t k=0; k< length; ++k) {
 
-#ifdef  _BM_TIMING		
+#ifdef  _BM_TIMING
 				chrono.start();
 #endif
 				// compute BPerm1 such that BPerm1.defect is in increasing order
-				std::vector<size_t> Perm1(m);			
+				std::vector<size_t> Perm1(m);
 				for (size_t i=0;i<m;++i)
-					Perm1[i]=i;			
+					Perm1[i]=i;
 				for (size_t i=0;i<m;++i) {
 					size_t idx_min=i;
-					for (size_t j=i+1;j<m;++j) 
-						if (defect[j]< defect[idx_min]) 
-							idx_min=j;												
-					std::swap(defect[i], defect[idx_min]);				
+					for (size_t j=i+1;j<m;++j)
+						if (defect[j]< defect[idx_min])
+							idx_min=j;
+					std::swap(defect[i], defect[idx_min]);
 					Perm1[i]=idx_min;
-				}				
-				BlasPermutation BPerm1(Perm1);
-				
+				}
+				BlasPermutation<size_t> BPerm1(Perm1);
+
 				// permute row degree
 				for (size_t i=0;i<m;++i)
-					std::swap(degree[i], degree[Perm1[i]]);	
-	
-		
+					std::swap(degree[i], degree[Perm1[i]]);
+
+
 #ifdef  _BM_TIMING
 				chrono.stop();
 				ttPermutation+=chrono;
@@ -517,16 +557,16 @@ namespace LinBox {
 				// Apply Bperm1 to the current SigmaBase
 				for (size_t i=0;i<SigmaBase.size();++i)
 					_BMD.mulin_right(BPerm1,SigmaBase[i]);
-		
+
 #ifdef  _BM_TIMING
 				chrono.stop();
 				ttSigmaUp+=chrono;
 				chrono.clear();
 				chrono.start();
-#endif				
-				// Compute Discrepancy			
+#endif
+				// Compute Discrepancy
 				_BMD.mul(Discrepancy,SigmaBase[0],PowerSerie[k]);
-				for (size_t i=1;i<SigmaBase.size();i++){
+				for (size_t i=1;i<SigmaBase.size();++i){
 					_BMD.axpyin(Discrepancy,SigmaBase[i],PowerSerie[k-i]);
 				}
 #ifdef  _BM_TIMING
@@ -537,20 +577,22 @@ namespace LinBox {
 				chrono.start();
 #endif
 
-				//std::cout<<"MBasis: Discrepancy\n";  
+				//std::cout<<"MBasis: Discrepancy\n";
 				//Discrepancy.write(std::cout,_F);
-			
+
 
 				// Compute LQUP of Discrepancy
-				LQUPMatrix<Field> LQUP(_F,Discrepancy);
+				BlasPermutation<size_t> Qt(Discrepancy.rowdim());
+				BlasPermutation<size_t> P(Discrepancy.coldim());
+				LQUPMatrix<Field> LQUP(_F,Discrepancy,P,Qt);
 
 				// Get L from LQUP
 				TriangularBlasMatrix<Element> L(m, m, BlasTag::low, BlasTag::unit);
 				LQUP.getL(L);
 
 				// get the transposed permutation of Q from LQUP
-				BlasPermutation Qt =LQUP.getQ();
-			
+				// BlasPermutation<size_t> Qt =LQUP.getQ();
+
 
 				// Compute the inverse of L
 				TriangularBlasMatrix<Element> invL(m, m, BlasTag::low, BlasTag::unit);
@@ -564,9 +606,9 @@ namespace LinBox {
 #endif
 				// Update Sigma by L^(-1)
 				// Sigma = L^(-1) . Sigma
-				for (size_t i=0;i<SigmaBase.size();++i) 
+				for (size_t i=0;i<SigmaBase.size();++i)
 					_BMD.mulin_right(invL,SigmaBase[i]);
-			
+
 #ifdef  _BM_TIMING
 				chrono.stop();
 				ttSigmaUp+=chrono;
@@ -580,26 +622,27 @@ namespace LinBox {
 					defect[*(Qt.getPointer()+i)]++;
 					degree[*(Qt.getPointer()+i)]++;
 				}
-								
+
 				size_t max_degree=degree[*(Qt.getPointer())];
 				for (size_t i=0;i<n;++i) {
 					if (degree[*(Qt.getPointer()+i)]>max_degree)
 						max_degree=degree[*(Qt.getPointer()+i)];
-				}	
-			
-				
+				}
+
+
 				size_t size=SigmaBase.size();
 				if (SigmaBase.size()<= max_degree)
-					{					
-						SigmaBase.resize(size+1,Zero);					
-						size++;
-					}				
+				{
+					SigmaBase.resize(size+1,Zero);
+					size++;
+				}
 				// Mulitply by x the rows of Sigma involved as pivot in LQUP
 				for (size_t i=0;i<n;++i){
-					for (int j= (int) size-2;j>=0; --j){						
+					for (int j= (int) size-2;j>=0; --j){
 						for (size_t l=0;l<m;++l)
+							//BB: #warning Q[i] pour i>r ne veut rien dire...
 							_F.assign(SigmaBase[j+1].refEntry(*(Qt.getPointer()+i),l),
-								 SigmaBase[j].getEntry(*(Qt.getPointer()+i),l));			
+								  SigmaBase[j].getEntry(*(Qt.getPointer()+i),l));
 					}
 					for (size_t l=0;l<m;++l)
 						_F.assign(SigmaBase[0].refEntry(*(Qt.getPointer()+i),l),zero);
@@ -610,78 +653,82 @@ namespace LinBox {
 				chrono.clear();
 				chrono.start();
 #endif
-				//write_maple("SS1",SigmaBase);			
+				//write_maple("SS1",SigmaBase);
 			}
 		}
 
 
 		// Multiply a Power Serie by a Sigma Base.
 		// only affect coefficients of the Power Serie between degree1 and degree1+degree2
-		void ComputeNewSerie(std::vector<Coefficient>          &NewSerie, 
-				     const std::vector<Coefficient>   &SigmaBase, 
-				     const std::vector<Coefficient>    &OldSerie,
-				     size_t                              degree1,
-				     size_t                              degree2){						
-			
+		template<class Polynomial1, class Polynomial2,class Polynomial3>
+		inline void ComputeNewSerie(Polynomial1          &NewSerie,
+					    const Polynomial2   &SigmaBase,
+					    const Polynomial3    &OldSerie,
+					    size_t                 , //deg1
+					    size_t                 )//deg2
+		{
+
 			// degree1 >= degree2
 			//size_t size = 2*degree1 + 1;
-					
+
 			const Coefficient ZeroSerie (OldSerie[0].rowdim(), OldSerie[0].coldim());
-			const Coefficient ZeroBase  (SigmaBase[0].rowdim(), SigmaBase[0].coldim());
-			
+			//const Coefficient ZeroBase  (SigmaBase[0].rowdim(), SigmaBase[0].coldim());
+
 			// Work on a copy of the old  Serie (increase size by one for computation of middle product)
-			std::vector<Coefficient> Serie(OldSerie.size()+1,ZeroSerie);
+
+			std::vector<Coefficient> Serie(OldSerie.size()+1, ZeroSerie);
 			for (size_t i=0;i< OldSerie.size();++i)
 				Serie[i] = OldSerie[i];
+			Serie[OldSerie.size()]=ZeroSerie;
 
 			//  ** try to not use a Copy **
-			// Work on a copy of the Sigma Base 
-			//std::vector<Coefficient> Sigma(SigmaBase.size());
-			//for (size_t i=0;i<SigmaBase.size();++i){
-			//	Sigma[i] = SigmaBase[i];
-			//}
-		
-
-			PolynomialMatrixDomain<Field, std::vector<Coefficient> > PM_domain(_F);
+			// Work on a copy of the Sigma Base
+#if 0
+			std::vector<Coefficient> Sigma(SigmaBase.size());
+			for (size_t i=0;i<SigmaBase.size();++i){
+				Sigma[i] = SigmaBase[i];
+			}
+#endif
+
+
 			PM_domain.midproduct(NewSerie, SigmaBase, Serie);
 		}
-		
 
-		void ComputeNewSerieClassic(std::vector<Coefficient>          &NewSerie, 
-					    const std::vector<Coefficient>   &SigmaBase, 
+
+		void ComputeNewSerieClassic(std::vector<Coefficient>          &NewSerie,
+					    const std::vector<Coefficient>   &SigmaBase,
 					    const std::vector<Coefficient>    &OldSerie,
 					    size_t                              degree1,
-					    size_t                              degree2){						
-						
+					    size_t                              degree2)
+		{
+
 			for (size_t i=0;i<degree2+1;++i)
 				for (size_t j=0;j<degree1+1;++j)
 					_BMD.axpyin(NewSerie[i],SigmaBase[j],OldSerie[degree1+i-j]);
 		}
 
 
-		
+
 
 
 		// Multiply two Sigma Basis
-		void MulSigmaBasis(std::vector<Coefficient> &C, 
+		void MulSigmaBasis(std::vector<Coefficient> &C,
 				   std::vector<Coefficient> &A,
-				   std::vector<Coefficient> &B){
-
-			PolynomialMatrixDomain<Field, std::vector<Coefficient> > PM_domain(_F);
-			PM_domain.mul(C,A,B);			
-		}			
-		
-		
-		void PadeApproximant (std::vector<Coefficient>            &Approx, 
-				      const std::vector<Coefficient>  &PowerSerie, 
-				      size_t                               length, 
-				      std::vector<size_t>                 &defect) {//pph
-			
+				   std::vector<Coefficient> &B)
+		{PM_domain.mul(C,A,B);}
+
+
+		void PadeApproximant (std::vector<Coefficient>            &Approx,
+				      const std::vector<Coefficient>  &PowerSerie,
+				      size_t                               length,
+				      std::vector<size_t>                 &defect)
+		{//pph
+
 
 			const size_t m = PowerSerie[0].rowdim();
 			const size_t n = PowerSerie[0].coldim();
-		
-				
+
+
 			// Initialization of the Serie iterator
 			typename std::vector<Coefficient>::const_iterator _iter (PowerSerie.begin ());
 
@@ -691,21 +738,21 @@ namespace LinBox {
 			_F.init(one,1L);
 			_F.init(zero,0L);
 			_F.init(mone,-1L);
-			for (size_t i=0;i<m;i++) 			
-				Unit.setEntry(i,i,one);							
+			for (size_t i=0;i<m;i++)
+				Unit.setEntry(i,i,one);
 			size_t min_mn=(m <n)? m :n;
-				
+
 			// initialization of discrepancy
 			Coefficient Discrepancy(m+n,n);
 			for (size_t i=0;i<n;i++)
 				Discrepancy.setEntry(i+m,i,one);
 
-			
-			// initialization of sigma base	
+
+			// initialization of sigma base
 			std::vector<Coefficient> SigmaBase(length);
 			SigmaBase.resize(1);
 			SigmaBase[0]=Unit;
-								
+
 			// initialization of order of sigma base's rows
 			std::vector<long> order(m+n,1);
 			for (size_t i=0;i<m;++i)
@@ -716,42 +763,42 @@ namespace LinBox {
 			for (size_t i=0;i<m;++i)
 				degree[i]=0;
 
-		
+
 			// The first sequence element should be of full rank
-			// this is due to the strategy which say that we can compute 
+			// this is due to the strategy which say that we can compute
 			// only the first column of the approximation of [ S(x) Id]^T
-			// since the other colums have always lower degree.			
+			// since the other colums have always lower degree.
 			if (_BMD.rank(*_iter)< min_mn) {
 				std::cout<<"LinBox ERROR: constant term in the Power Serie is singular\n";
-				throw PreconditionFailed (__FUNCTION__, __LINE__, "Bad random Blocks, abort\n");
+				throw PreconditionFailed (__func__, __LINE__, "Bad random Blocks, abort\n");
 			}
-			
+
 			unsigned long early_stop=0;
 			long N;
-			
+
 			for (N = 0; (N < (long)length) && (early_stop < 20) ; ++N) {
-									
-			
-				/*	
-				 * Compute the new discrepancy (just updating the first m rows)					
-				 */				
+
+
+				/*
+				 * Compute the new discrepancy (just updating the first m rows)
+				 */
 				// view of m first rows of SigmaBasis[0]
 				Coefficient Sigma(SigmaBase[0],0,0,m,m);
-				
+
 				// view of m first rows of Discrepancy
 				Coefficient Discr(Discrepancy,0,0,m,n);
-								
+
 				_BMD.mul(Discr,Sigma, PowerSerie[N]);
 				for (size_t i=1;i<SigmaBase.size();i++){
 					Coefficient  Sigmaview(SigmaBase[i],0,0,m,m);
 					_BMD.axpyin(Discr,Sigmaview,PowerSerie[N-i]);
 				}
-										
+
 				typename Coefficient::RawIterator _iter_Discr = Discr.rawBegin();
 
 				while ((_F.isZero(*_iter_Discr) && _iter_Discr != Discr.rawEnd()))
 					++_iter_Discr;
-					
+
 				// maybe there is something to do here
 				// increase the last n rows of orders
 				// multiply by X the last n rows of SigmaBase
@@ -760,64 +807,67 @@ namespace LinBox {
 				else {
 					early_stop++;
 				}
-					
-					 			
+
+
 				// Computation of the permutation BPerm1 such that BPerm1.order is in increasing order.
-				// order=Perm.order			   			
-				std::vector<size_t> Perm1(m+n);			
+				// order=Perm.order
+				std::vector<size_t> Perm1(m+n);
 				for (size_t i=0;i<m+n;++i)
-					Perm1[i]=i;	
+					Perm1[i]=i;
 				if (N>=1) {
 					for (size_t i=0;i<m+n;++i) {
 						size_t idx_min=i;
-						for (size_t j=i+1;j<m+n;++j) 
-							if (order[j]< order[idx_min]) 
-								idx_min=j;												
-						std::swap(order[i],order[idx_min]);				
+						for (size_t j=i+1;j<m+n;++j)
+							if (order[j]< order[idx_min])
+								idx_min=j;
+						std::swap(order[i],order[idx_min]);
 						Perm1[i]=idx_min;
-					}	
+					}
 				}
-				BlasPermutation BPerm1(Perm1);
-					
+				BlasPermutation<size_t> BPerm1(Perm1);
 
-				// Discrepancy= BPerm1.Discrepancy						
+
+				// Discrepancy= BPerm1.Discrepancy
 				_BMD.mulin_right(BPerm1,Discrepancy);
 
 
 				// Computation of the LQUP decomposition of the discrepancy
 				Coefficient CopyDiscr;
 				CopyDiscr=Discrepancy;
-				LQUPMatrix<Field> LQUP(_F, CopyDiscr);
+				BlasPermutation<size_t> Qt(Discrepancy.rowdim());
+				BlasPermutation<size_t> P(Discrepancy.coldim());
+
+				LQUPMatrix<Field> LQUP(_F, CopyDiscr,P,Qt);
 
 				// Get the matrix L of LQUP decomposition
 				TriangularBlasMatrix<Element> L(m+n,m+n, BlasTag::low, BlasTag::unit );
 				LQUP.getL(L);
-				
+
 				// Get the tranposed  permutation of Q from LQUP
-				BlasPermutation Qt=LQUP.getQ();
-			
+				// BlasPermutation<size_t> Qt=LQUP.getQ();
+
 				// Computation of permutations BPerm2 such that the last n rows of BPerm2.Qt.Discrepancy are non zero.
-				std::vector<size_t> Perm2(m+n);	
+				std::vector<size_t> Perm2(m+n);
 				for (size_t i=0;i<n;++i)
 					Perm2[i]=m+i;
 				for (size_t i=n;i<m+n;++i)
-					Perm2[i]=i;					
-				BlasPermutation BPerm2(Perm2);			
-				
+					Perm2[i]=i;
+				BlasPermutation<size_t> BPerm2(Perm2);
+
 				// compute the inverse of L
-				TriangularBlasMatrix<Element> invL (m+n,m+n, BlasTag::low,BlasTag::unit); 
+				TriangularBlasMatrix<Element> invL (m+n,m+n, BlasTag::low,BlasTag::unit);
 				FFPACK::trinv_left(_F,m+n,L.getPointer(),L.getStride(),invL.getWritePointer(),invL.getStride());
 
-				
+
 				// SigmaBase =  BPerm2.Qt. L^(-1) . BPerm1 . SigmaBase
 				for (size_t i=0;i<SigmaBase.size();i++) {
 					_BMD.mulin_right(BPerm1,SigmaBase[i]);
 					_BMD.mulin_right(invL,SigmaBase[i]);
 					_BMD.mulin_right(Qt,SigmaBase[i]);
 					_BMD.mulin_right(BPerm2,SigmaBase[i]);
-				}							
-		
-				
+				}
+
+
 				// Apply BPerm2 and Qt to the vector of order and increase by 1 the last n rows
 				UnparametricField<long> UF;
 				BlasMatrixDomain<UnparametricField<long> > BMDUF(UF);
@@ -825,9 +875,9 @@ namespace LinBox {
 				BMDUF.mulin_right(BPerm2,order);
 				BMDUF.mulin_right(BPerm1,degree);
 				BMDUF.mulin_right(Qt,degree);
-				BMDUF.mulin_right(BPerm2,degree);				
+				BMDUF.mulin_right(BPerm2,degree);
 				for (size_t i=m;i<m+n;++i){
-					order[i]++;		
+					order[i]++;
 					degree[i]++;
 				}
 
@@ -837,17 +887,17 @@ namespace LinBox {
 				for (size_t i=m+1;i<m+n;++i) {
 					if (degree[i]>max_degree)
 						max_degree=degree[i];
-				}			
-				size_t size=SigmaBase.size();			
+				}
+				size_t size=SigmaBase.size();
 				if (SigmaBase.size()<= (size_t)max_degree)
-					{			
-						SigmaBase.resize(size+1,Zero);					
-						size++;
-					}		
+				{
+					SigmaBase.resize(size+1,Zero);
+					size++;
+				}
 				for (int i= (int)size-2;i>=0;i--)
 					for (size_t j=0;j<n;j++)
 						for (size_t k=0;k<n;++k)
-							_F.assign(SigmaBase[i+1].refEntry(m+j,k), SigmaBase[i].getEntry(m+j,k));			
+							_F.assign(SigmaBase[i+1].refEntry(m+j,k), SigmaBase[i].getEntry(m+j,k));
 
 				for (size_t j=0;j<n;j++)
 					for (size_t k=0;k<n;++k)
@@ -857,16 +907,16 @@ namespace LinBox {
 				// Discrepancy= BPerm2.U.P from LQUP
 				Coefficient U(m+n,n);
 				TriangularBlasMatrix<Element> trU(U,BlasTag::up,BlasTag::nonunit);
-				LQUP.getU(trU);	 
+				LQUP.getU(trU);
 				Discrepancy=U;
-				BlasPermutation P= LQUP.getP();
+				// BlasPermutation<size_t> P= LQUP.getP();
 				_BMD.mulin_left(Discrepancy,P);
 				_BMD.mulin_right(BPerm2,Discrepancy);
-								
+
 			}
 			if ( early_stop == 20)
 				std::cout<<"Early termination is used: stop at "<<N<<" from "<<length<<" iterations\n\n";
-			
+
 			// extract the first m rows of SigmaBase
 			degree=order;
 			long max=degree[0];
@@ -874,16 +924,16 @@ namespace LinBox {
 				if (degree[i]>max)
 					max=degree[i];
 			}
-			
+
 			const Coefficient AZero(m,m);
-			Approx.resize(max+1, AZero);		
-			
-			for (size_t i=0;i<m;i++) 
-				for (long j=0;j<=degree[i];j++) 
-					for (size_t k=0;k<m;k++) 
-						_F.assign(Approx[j].refEntry(i,k), SigmaBase[j].getEntry(i,k));	
-
-			
+			Approx.resize(max+1, AZero);
+
+			for (size_t i=0;i<m;i++)
+				for (long j=0;j<=degree[i];j++)
+					for (size_t k=0;k<m;k++)
+						_F.assign(Approx[j].refEntry(i,k), SigmaBase[j].getEntry(i,k));
+
+
 		}
 
 		void MultiPadeApproximant (std::vector<Coefficient>            &Approx1,
@@ -891,16 +941,17 @@ namespace LinBox {
 					   std::vector<Coefficient>            &Approx2,
 					   size_t                               degree2,
 					   const std::vector<Coefficient>   &PowerSerie,
-					   std::vector<size_t>                  &defect) {
-					   
+					   std::vector<size_t>                  &defect)
+		{
+
 
 			linbox_check(degree1 < degree2);
 
 			size_t length = degree2;
 			const size_t m = PowerSerie[0].rowdim();
 			const size_t n = PowerSerie[0].coldim();
-		
-				
+
+
 			// Initialization of the Serie iterator
 			typename std::vector<Coefficient>::const_iterator _iter (PowerSerie.begin ());
 
@@ -910,21 +961,21 @@ namespace LinBox {
 			_F.init(one,1L);
 			_F.init(zero,0L);
 			_F.init(mone,-1L);
-			for (size_t i=0;i<m;i++) 			
-				Unit.setEntry(i,i,one);							
+			for (size_t i=0;i<m;i++)
+				Unit.setEntry(i,i,one);
 			size_t min_mn=(m <n)? m :n;
-				
+
 			// initialization of discrepancy
 			Coefficient Discrepancy(m+n,n);
 			for (size_t i=0;i<n;i++)
 				Discrepancy.setEntry(i+m,i,one);
 
-			
-			// initialization of sigma base	
+
+			// initialization of sigma base
 			std::vector<Coefficient> SigmaBase(length);
 			SigmaBase.resize(1);
 			SigmaBase[0]=Unit;
-								
+
 			// initialization of order of sigma base's rows
 			std::vector<long> order(m+n,1);
 			for (size_t i=0;i<m;++i)
@@ -935,42 +986,42 @@ namespace LinBox {
 			for (size_t i=0;i<m;++i)
 				degree[i]=0;
 
-		
+
 			// The first sequence element should be of full rank
-			// this is due to the strategy which say that we can compute 
+			// this is due to the strategy which say that we can compute
 			// only the first column of the approximation of [ S(x) Id]^T
-			// since the other colums have always lower degree.			
+			// since the other colums have always lower degree.
 			if (_BMD.rank(*_iter)< min_mn) {
 				std::cout<<"LinBox ERROR: constant term in the Power Serie is singular\n";
-				throw PreconditionFailed (__FUNCTION__, __LINE__, "Bad random Blocks, abort\n");
+				throw PreconditionFailed (__func__, __LINE__, "Bad random Blocks, abort\n");
 			}
-			
+
 			unsigned long early_stop=0;
 			long N;
-			
+
 			for (N = 0; (N < (long)length) && (early_stop < 20) ; ++N) {
-									
-			
-				/*	
-				 * Compute the new discrepancy (just updating the first m rows)					
-				 */				
+
+
+				/*
+				 * Compute the new discrepancy (just updating the first m rows)
+				 */
 				// view of m first rows of SigmaBasis[0]
 				Coefficient Sigma(SigmaBase[0],0,0,m,m);
-				
+
 				// view of m first rows of Discrepancy
 				Coefficient Discr(Discrepancy,0,0,m,n);
-								
+
 				_BMD.mul(Discr,Sigma, PowerSerie[N]);
 				for (size_t i=1;i<SigmaBase.size();i++){
 					Coefficient  Sigmaview(SigmaBase[i],0,0,m,m);
 					_BMD.axpyin(Discr,Sigmaview,PowerSerie[N-i]);
 				}
-										
+
 				typename Coefficient::RawIterator _iter_Discr = Discr.rawBegin();
 
 				while ((_F.isZero(*_iter_Discr) && _iter_Discr != Discr.rawEnd()))
 					++_iter_Discr;
-					
+
 				// maybe there is something to do here
 				// increase the last n rows of orders
 				// multiply by X the last n rows of SigmaBase
@@ -979,64 +1030,67 @@ namespace LinBox {
 				else {
 					early_stop++;
 				}
-					
-					 			
+
+
 				// Computation of the permutation BPerm1 such that BPerm1.order is in increasing order.
-				// order=Perm.order			   			
-				std::vector<size_t> Perm1(m+n);			
+				// order=Perm.order
+				std::vector<size_t> Perm1(m+n);
 				for (size_t i=0;i<m+n;++i)
-					Perm1[i]=i;	
+					Perm1[i]=i;
 				if (N>=1) {
 					for (size_t i=0;i<m+n;++i) {
 						size_t idx_min=i;
-						for (size_t j=i+1;j<m+n;++j) 
-							if (order[j]< order[idx_min]) 
-								idx_min=j;												
-						std::swap(order[i],order[idx_min]);				
+						for (size_t j=i+1;j<m+n;++j)
+							if (order[j]< order[idx_min])
+								idx_min=j;
+						std::swap(order[i],order[idx_min]);
 						Perm1[i]=idx_min;
-					}	
+					}
 				}
-				BlasPermutation BPerm1(Perm1);
-					
+				BlasPermutation<size_t> BPerm1(Perm1);
+
 
-				// Discrepancy= BPerm1.Discrepancy						
+				// Discrepancy= BPerm1.Discrepancy
 				_BMD.mulin_right(BPerm1,Discrepancy);
 
 
 				// Computation of the LQUP decomposition of the discrepancy
 				Coefficient CopyDiscr;
 				CopyDiscr=Discrepancy;
-				LQUPMatrix<Field> LQUP(_F, CopyDiscr);
+				BlasPermutation<size_t> Qt(Discrepancy.rowdim());
+				BlasPermutation<size_t> P(Discrepancy.coldim());
+
+				LQUPMatrix<Field> LQUP(_F, CopyDiscr,P,Qt);
 
 				// Get the matrix L of LQUP decomposition
 				TriangularBlasMatrix<Element> L(m+n,m+n, BlasTag::low, BlasTag::unit );
 				LQUP.getL(L);
-				
+
 				// Get the tranposed  permutation of Q from LQUP
-				BlasPermutation Qt=LQUP.getQ();
-			
+				// BlasPermutation<size_t> Qt=LQUP.getQ();
+
 				// Computation of permutations BPerm2 such that the last n rows of BPerm2.Qt.Discrepancy are non zero.
-				std::vector<size_t> Perm2(m+n);	
+				std::vector<size_t> Perm2(m+n);
 				for (size_t i=0;i<n;++i)
 					Perm2[i]=m+i;
 				for (size_t i=n;i<m+n;++i)
-					Perm2[i]=i;					
-				BlasPermutation BPerm2(Perm2);			
-				
+					Perm2[i]=i;
+				BlasPermutation<size_t> BPerm2(Perm2);
+
 				// compute the inverse of L
-				TriangularBlasMatrix<Element> invL (m+n,m+n, BlasTag::low,BlasTag::unit); 
+				TriangularBlasMatrix<Element> invL (m+n,m+n, BlasTag::low,BlasTag::unit);
 				FFPACK::trinv_left(_F,m+n,L.getPointer(),L.getStride(),invL.getWritePointer(),invL.getStride());
 
-				
+
 				// SigmaBase =  BPerm2.Qt. L^(-1) . BPerm1 . SigmaBase
 				for (size_t i=0;i<SigmaBase.size();i++) {
 					_BMD.mulin_right(BPerm1,SigmaBase[i]);
 					_BMD.mulin_right(invL,SigmaBase[i]);
 					_BMD.mulin_right(Qt,SigmaBase[i]);
 					_BMD.mulin_right(BPerm2,SigmaBase[i]);
-				}							
-		
-				
+				}
+
+
 				// Apply BPerm2 and Qt to the vector of order and increase by 1 the last n rows
 				UnparametricField<long> UF;
 				BlasMatrixDomain<UnparametricField<long> > BMDUF(UF);
@@ -1044,9 +1098,9 @@ namespace LinBox {
 				BMDUF.mulin_right(BPerm2,order);
 				BMDUF.mulin_right(BPerm1,degree);
 				BMDUF.mulin_right(Qt,degree);
-				BMDUF.mulin_right(BPerm2,degree);				
+				BMDUF.mulin_right(BPerm2,degree);
 				for (size_t i=m;i<m+n;++i){
-					order[i]++;		
+					order[i]++;
 					degree[i]++;
 				}
 
@@ -1056,17 +1110,17 @@ namespace LinBox {
 				for (size_t i=m+1;i<m+n;++i) {
 					if (degree[i]>max_degree)
 						max_degree=degree[i];
-				}			
-				size_t size=SigmaBase.size();			
+				}
+				size_t size=SigmaBase.size();
 				if (SigmaBase.size()<= (size_t)max_degree)
-					{			
-						SigmaBase.resize(size+1,Zero);					
-						size++;
-					}		
+				{
+					SigmaBase.resize(size+1,Zero);
+					size++;
+				}
 				for (int i= (int)size-2;i>=0;i--)
 					for (size_t j=0;j<n;j++)
 						for (size_t k=0;k<n;++k)
-							_F.assign(SigmaBase[i+1].refEntry(m+j,k), SigmaBase[i].getEntry(m+j,k));			
+							_F.assign(SigmaBase[i+1].refEntry(m+j,k), SigmaBase[i].getEntry(m+j,k));
 
 				for (size_t j=0;j<n;j++)
 					for (size_t k=0;k<n;++k)
@@ -1076,12 +1130,12 @@ namespace LinBox {
 				// Discrepancy= BPerm2.U.P from LQUP
 				Coefficient U(m+n,n);
 				TriangularBlasMatrix<Element> trU(U,BlasTag::up,BlasTag::nonunit);
-				LQUP.getU(trU);	 
+				LQUP.getU(trU);
 				Discrepancy=U;
-				BlasPermutation P= LQUP.getP();
+				// BlasPermutation<size_t> P= LQUP.getP();
 				_BMD.mulin_left(Discrepancy,P);
 				_BMD.mulin_right(BPerm2,Discrepancy);
-				
+
 				// save the first pade matrix
 				if (N == degree1 -1) {
 					// extract the first m rows of SigmaBase
@@ -1090,21 +1144,21 @@ namespace LinBox {
 						if (order[i]>max)
 							max=order[i];
 					}
-					
+
 					const Coefficient AZero(m,m);
-					Approx1.resize(max+1, AZero);		
-					
-					for (size_t i=0;i<m;i++) 
-						for (long j=0;j<=order[i];j++) 
-							for (size_t k=0;k<m;k++) 
+					Approx1.resize(max+1, AZero);
+
+					for (size_t i=0;i<m;i++)
+						for (long j=0;j<=order[i];j++)
+							for (size_t k=0;k<m;k++)
 								_F.assign(Approx1[j].refEntry(i,k), SigmaBase[j].getEntry(i,k));
 				}
-			
+
 			}
 
 			if ( early_stop == 20)
 				std::cout<<"Early termination is used: stop at "<<N<<" from "<<length<<" iterations\n\n";
-			
+
 			// extract the first m rows of SigmaBase
 			degree=order;
 			long max=degree[0];
@@ -1112,28 +1166,26 @@ namespace LinBox {
 				if (degree[i]>max)
 					max=degree[i];
 			}
-			
-			const Coefficient AZero(m,m);
-			Approx2.resize(max+1, AZero);		
-			
-			for (size_t i=0;i<m;i++) 
-				for (long j=0;j<=degree[i];j++) 
-					for (size_t k=0;k<m;k++) 
-						_F.assign(Approx2[j].refEntry(i,k), SigmaBase[j].getEntry(i,k));				
-		}
-
 
+			const Coefficient AZero(m,m);
+			Approx2.resize(max+1, AZero);
 
+			for (size_t i=0;i<m;i++)
+				for (long j=0;j<=degree[i];j++)
+					for (size_t k=0;k<m;k++)
+						_F.assign(Approx2[j].refEntry(i,k), SigmaBase[j].getEntry(i,k));
+		}
 
 
 		// Computation of a minimal Sigma Base of a Power Serie up to length
-		// algorithm is from Giorgi, Jeannerod and Villard  ISSAC'03		
+		// algorithm is from Giorgi, Jeannerod and Villard  ISSAC'03
 		void new_M_Basis(std::vector<Coefficient>     &SigmaBase,
-				 std::vector<Coefficient>    &PowerSerie, 
-				 size_t                           length, 
-				 std::vector<size_t>             &defect) {
+				 std::vector<Coefficient>    &PowerSerie,
+				 size_t                           length,
+				 std::vector<size_t>             &defect)
+		{
 
-			// Get the dimension of matrices inside 
+			// Get the dimension of matrices inside
 			// the Matrix Power Serie
 			size_t m,n;
 			m = PowerSerie[0].rowdim();
@@ -1145,27 +1197,27 @@ namespace LinBox {
 			Element one, zero;
 			_F.init(one,1UL);
 			_F.init(zero,0UL);
-			
-			// Reserve memory for the Sigma Base  
+
+			// Reserve memory for the Sigma Base
 			SigmaBase.reserve(length+1);
 			SigmaBase.resize(1);
-			
+
 			// set SigmaBase[0] to Identity
 			Coefficient Identity(m,m);
 			for (size_t i=0;i< m;++i)
 				Identity.setEntry(i,i,one);
 			SigmaBase[0]=Identity;
-			
+
 			// Define Truncated Residual
 			std::vector<Coefficient>  Residual(length+1, Zeromn);
-			
+
 			// Set Truncated Residual to PowerSerie mod X^length
 			for (size_t k=0;k<length; ++k)
 				Residual[k] = PowerSerie[k];
 
-			// Define Discrepancy 
+			// Define Discrepancy
 			Coefficient Discrepancy(m,n);
-			
+
 			// Row degree of SigmaBase
 			// Keep track on Sigma Base's row degree
 			// I adjust the degree with the maximal difference between defects
@@ -1180,51 +1232,57 @@ namespace LinBox {
 			}
 			//std::vector<size_t> degree(m,max_defect-min_defect);
 			std::vector<size_t> degree(m);
-			size_t max_diff= max_defect-min_defect;
+			//size_t max_diff= max_defect-min_defect;
 			for (size_t i=0;i<m;++i)
 				degree[i]= defect[i]-min_defect;
 
 
 			std::vector<size_t> row_degree(m,0);
 
-			//write_maple("PowerSerie",PowerSerie);		
+			//write_maple("PowerSerie",PowerSerie);
 
+#ifdef _BM_TIMING
 			Timer chrono;
 			double tSigmaUp, tResidueUp, tSigmaSh, tResidueSh, tLQUP, tPerm;
 			tSigmaUp= tResidueUp= tSigmaSh= tResidueSh= tLQUP= tPerm =0.;
+#endif
 
 			std::vector<size_t> triv_column(m,0);
 			std::vector<size_t> PermPivots(m);
 			for (size_t i=0;i<m;++i)
 				PermPivots[i]=i;
 
-			int optim=0;
+			//int optim=0;
 			int cptr=0;
+#ifdef DISCREPANCY_OPTIM
 			double updis=0.;
+#endif
 
+#if 0
 			bool UseTrivial=true;
 
-			//std::cout<<"defect: ";
-			//for (size_t i=0;i<m;++i)
-			//	std::cout<<defect[i]<<", ";
-			//std::cout<<"\n";
+			std::cout<<"defect: ";
+			for (size_t i=0;i<m;++i)
+				std::cout<<defect[i]<<", ";
+			std::cout<<"\n";
+#endif
 
 			// Compute the minimal Sigma Base of the PowerSerie up to length
 			for (size_t k=0; k< length; ++k) {
-		
-				/*
+
+#if 0
 				std::cout<<"row degree: ";
 				for (size_t i=0;i<m;++i)
 					std::cout<<degree[i]<<", ";
 				std::cout<<"\n";
 				write_maple("Sigma",SigmaBase);
-				*/
-				
+#endif
+
 #ifdef _BM_TIMING
 				chrono.start();
 #endif
 				// Compute the number of trivial column in SigmaBase
-				int nbr_triv=0;			       
+				int nbr_triv=0;
 				for (size_t i=0;i<m;i++) if (triv_column[i]==0) nbr_triv++;
 
 
@@ -1235,14 +1293,14 @@ namespace LinBox {
 				if (nbr_triv > 0) {
 					size_t idx_triv, idx_nontriv;
 					idx_nontriv = 0; idx_triv = m-nbr_triv;
-										
+
 					for (size_t i=0;i<m;++i){
 						if (triv_column[i]!=0){
 							PermTrivial[i]=idx_nontriv;
 							if (i!=idx_nontriv) PTrivial=false;
 							idx_nontriv++;
 						}
-						else {						
+						else {
 							PermTrivial[i]=idx_triv;
 							if (i!=idx_triv) PTrivial=false;
 							idx_triv++;
@@ -1250,50 +1308,50 @@ namespace LinBox {
 					}
 				}
 
-				BlasPermutation PPP (PermTrivial);
-				TransposedBlasMatrix<BlasPermutation> PPPT(PPP);
-				
-				// set Discrepancy to Residual[k] 
+				BlasPermutation<size_t> PPP (PermTrivial);
+				TransposedBlasMatrix<BlasPermutation<size_t> > PPPT(PPP);
+
+				// set Discrepancy to Residual[k]
 				// -> can be optimized by directly using Residual[k]
-				//Discrepancy = Residual[k];					
+				//Discrepancy = Residual[k];
 
 
 				BlasMatrix<Element> Db    (Discrepancy,m-nbr_triv,0,nbr_triv,n);
 				// Compute Discrepancy using convolution
-				if (nbr_triv > m){ 					
+				if (nbr_triv > m){
 					if (k==0){
 						_MD.copy(Discrepancy, PowerSerie[0]);
 					}
-					else {	
-						BlasPermutation PPiv (PermPivots);
-						TransposedBlasMatrix<BlasPermutation> PPivT(PPiv);
-				
+					else {
+						BlasPermutation<size_t> PPiv (PermPivots);
+						TransposedBlasMatrix<BlasPermutation<size_t> > PPivT(PPiv);
+
 						if (!PTrivial){
 							_BMD.mulin_left(SigmaBase[0], PPP);
-							_BMD.mulin_right(PPPT, PowerSerie[k]);					
+							_BMD.mulin_right(PPPT, PowerSerie[k]);
 						}
 						_BMD.mulin_right(PPivT,SigmaBase[0]);
-						
+
 						BlasMatrix<Element> SBl   (SigmaBase[0],0,0,m,m-nbr_triv);
 						BlasMatrix<Element> PSt   (PowerSerie[k],0,0,m-nbr_triv,n);
 						BlasMatrix<Element> PSb   (PowerSerie[k],m-nbr_triv,0,nbr_triv,n);
-					
+
 						Timer Dchrono;
 						Dchrono.start();
 						_BMD.mul (Discrepancy,SBl,PSt);
 						if (k%2 == 0)
-							_MD.addin(Db,PSb);							
+							_MD.addin(Db,PSb);
 						else
-							_MD.subin(Db,PSb);																							
+							_MD.subin(Db,PSb);
 						Dchrono.stop();
 						updis+= Dchrono.usertime();
-						
-						_BMD.mulin_right(PPiv,SigmaBase[0]);				
+
+						_BMD.mulin_right(PPiv,SigmaBase[0]);
 						if (!PTrivial){
 							_BMD.mulin_right(PPP, PowerSerie[k]);
 							_BMD.mulin_left(SigmaBase[0], PPPT);
 						}
-						
+
 						for (size_t i=1;i<SigmaBase.size();i++){
 							if (!PTrivial){
 								_BMD.mulin_left(SigmaBase[i], PPP);
@@ -1305,21 +1363,21 @@ namespace LinBox {
 							BlasMatrix<Element> PSti   (PowerSerie[k-i],0,0,m-nbr_triv,n);
 							BlasMatrix<Element> PSbi   (PowerSerie[k-i],m-nbr_triv,0,nbr_triv,n);
 							Dchrono.clear();
-							Dchrono.start();					       
+							Dchrono.start();
 							_BMD.axpyin  (Discrepancy,SBli,PSti);
 							Dchrono.stop();
 							updis+= Dchrono.usertime();
 							_BMD.mulin_right(PPiv,SigmaBase[i]);
 							if (!PTrivial){
 								_BMD.mulin_right(PPP, PowerSerie[k-i]);
-								_BMD.mulin_left(SigmaBase[i], PPPT);											
+								_BMD.mulin_left(SigmaBase[i], PPPT);
 							}
 						}
 						_BMD.mulin_right(PPiv,Discrepancy);
 					}
 				}
 				else{
-#endif			
+#endif
 					_BMD.mul(Discrepancy,SigmaBase[0],PowerSerie[k]);
 					for (size_t i=1;i<SigmaBase.size();i++){
 						_BMD.axpyin(Discrepancy,SigmaBase[i],PowerSerie[k-i]);
@@ -1327,71 +1385,71 @@ namespace LinBox {
 #ifdef DISCREPANCY_OPTIM
 				}
 #endif
-				
+
 
 #ifdef _BM_TIMING
 				chrono.stop();
 				ttResidueUp+=chrono;
 				chrono.clear();
 				chrono.start();
-#endif			
-			
-				// compute BPerm1 such that BPerm1.defect is in increasing order				
-				std::vector<size_t> Perm1(m);			
+#endif
+
+				// compute BPerm1 such that BPerm1.defect is in increasing order
+				std::vector<size_t> Perm1(m);
 				for (size_t i=0;i<m;++i)
-					Perm1[i]=i;			
+					Perm1[i]=i;
 				for (size_t i=0;i<m;++i) {
 					size_t idx_min=i;
-					for (size_t j=i+1;j<m;++j) 
-						if (defect[j]< defect[idx_min]) 
-							idx_min=j;												
-					std::swap(defect[i], defect[idx_min]);				
+					for (size_t j=i+1;j<m;++j)
+						if (defect[j]< defect[idx_min])
+							idx_min=j;
+					std::swap(defect[i], defect[idx_min]);
 					Perm1[i]=idx_min;
 				}
 
 				// permute degree and row degree
 				for (size_t i=0;i<m;++i)
 					if ( i < Perm1[i]){
-						std::swap(degree[i], degree[Perm1[i]]);	
-						std::swap(row_degree[i], row_degree[Perm1[i]]);	
+						std::swap(degree[i], degree[Perm1[i]]);
+						std::swap(row_degree[i], row_degree[Perm1[i]]);
 						if (k!=0)
 							std::swap(PermPivots[i], PermPivots[Perm1[i]]);
 					}
 
 				if (k==0)
 					for (size_t i=0;i<m;++i)
-						PermPivots[i]=Perm1[i];									
+						PermPivots[i]=Perm1[i];
 
-				BlasPermutation BPerm1(Perm1);
+				BlasPermutation<size_t> BPerm1(Perm1);
 
 				// Apply Bperm1 to the Discrepancy
-				_BMD.mulin_right(BPerm1, Discrepancy);	
-							
-#ifdef _BM_TIMING		
+				_BMD.mulin_right(BPerm1, Discrepancy);
+
+#ifdef _BM_TIMING
 				chrono.stop();
 				ttPermutation+=chrono;
 				chrono.clear();
 				chrono.start();
 #endif
 
-				/* new version : use of columnReducedEchelon */							
-				EchelonFormDomain<Field>  EFD(_F);			
+				/* new version : use of columnReducedEchelon */
+				EchelonFormDomain<Field>  EFD(_F);
 				size_t rank = EFD.columnReducedEchelon(Discrepancy);
-			
-			
+
+
 				// compute permutation such that all pivots are on the principal minor
 				std::vector<size_t> perm(m);
 				for (size_t i=0;i<m;++i)
-					perm[i]=i;				
+					perm[i]=i;
 				size_t idx=0;
 				for (size_t i=0;i<rank;++i){
 					while(_F.isZero(Discrepancy.getEntry(idx,i))) idx++;
 					perm[i]=idx;
 					idx++;
 				}
-			
-				BlasPermutation Qt(perm);						
-				TransposedBlasMatrix<BlasPermutation> Q(Qt);
+
+				BlasPermutation<size_t> Qt(perm);
+				TransposedBlasMatrix<BlasPermutation<size_t> > Q(Qt);
 
 				// detect trivial permutation (Q=Qt=Identity)
 				bool QisTrivial=true;
@@ -1400,22 +1458,22 @@ namespace LinBox {
 					if (perm[Qidx] != Qidx)
 						QisTrivial=false;
 					Qidx++;
-				}				
+				}
 
 				// put all pivots on the principal minor
 				_BMD.mulin_right(Qt, Discrepancy);
 
-				// Get the (m-r)*r left bottom submatrix of Reduced Echelon matrix 
+				// Get the (m-r)*r left bottom submatrix of Reduced Echelon matrix
 				BlasMatrix<Element> G(Discrepancy, rank, 0,m-rank,rank);
-#ifdef _BM_TIMING													
+#ifdef _BM_TIMING
 				chrono.stop();
 				ttTransformation+=chrono;
 				chrono.clear();
 				chrono.start();
 #endif
-	
-			
-								    				
+
+
+
 				// compute size of trivial part of SigmaBase
 				size_t rsize, lsize;
 				rsize=0;
@@ -1426,16 +1484,16 @@ namespace LinBox {
 				//std::cout<<"rsize: "<<rsize<<"\n";
 
 				// compute maximal degree of first rank-th row of SigmaBase
-				
-				size_t maxs=0;  
+
+				size_t maxs=0;
 				for(size_t d=0;d<rank;++d)
-					maxs=std::max(maxs, degree[*(Qt.getPointer()+d)]);				
+					maxs=std::max(maxs, degree[*(Qt.getPointer()+d)]);
 				maxs=std::min(maxs, SigmaBase.size()-1);
-				
+
 				//Discrepancy.write(std::cout,_F);
 
-			
-#ifndef OPTMIZED_SIGMA_UPDATE				
+
+#ifndef OPTMIZED_SIGMA_UPDATE
 				// Compute a Permutation to put all trivial columns of SigmaBase to right part of it
 				std::vector<size_t> PermTrivial(m);
 				bool PTrivial=true;
@@ -1446,14 +1504,14 @@ namespace LinBox {
 				if (nbr_triv > rank) {
 					size_t idx_triv, idx_nontriv;
 					idx_nontriv = 0; idx_triv = m-nbr_triv;
-										
+
 					for (size_t i=0;i<m;++i){
 						if (triv_column[i]!=0){
 							PermTrivial[i]=idx_nontriv;
 							if (i!=idx_nontriv) PTrivial=false;
 							idx_nontriv++;
 						}
-						else {						
+						else {
 							PermTrivial[i]=idx_triv;
 							if (i!=idx_triv) PTrivial=false;
 							idx_triv++;
@@ -1463,98 +1521,104 @@ namespace LinBox {
 				for(int i=m-1;i>=0;--i)
 					if (PermPivots[i]>i)
 						std::swap(triv_column[i], triv_column[PermPivots[i]]);
-				
+
 				// Modify Permutation of trivial columns to incorporate pivot columns
 				if (nbr_triv>rank){
 					for(size_t i=0;i<m;++i)
-						std::swap(PermTrivial[i], PermTrivial[*(Qt.getPointer()+i)]);								
+						std::swap(PermTrivial[i], PermTrivial[*(Qt.getPointer()+i)]);
 				}
-			
-				/*
+
+#if 0
 				std::cout<<"PermTrivial: ";
 				for (size_t i=0;i<m;++i)
 					std::cout<<PermTrivial[i]<<", ";
 				std::cout<<"\n";
-				*/
+#endif
 
-				BlasPermutation PTr (PermTrivial);
-				TransposedBlasMatrix<BlasPermutation> PTrT(PTr);
-				//BlasPermutation PPP (PermTrivial);
-				//TransposedBlasMatrix<BlasPermutation> PPPT(PPP);
-				BlasPermutation PPiv (PermPivots);
-				TransposedBlasMatrix<BlasPermutation> PPivT(PPiv);
+				BlasPermutation<size_t> PTr (PermTrivial);
+				TransposedBlasMatrix<BlasPermutation<size_t> > PTrT(PTr);
+				//BlasPermutation<size_t>  PPP (PermTrivial);
+				//TransposedBlasMatrix<BlasPermutation<size_t> > PPPT(PPP);
+				BlasPermutation<size_t>  PPiv (PermPivots);
+				TransposedBlasMatrix<BlasPermutation<size_t> > PPivT(PPiv);
+
+#if 0
 
 
-				/*
 				std::cout<<"MAXS: "<<maxs<<"\n\n ******************\n";
-				
+
 				std::cout<<"Perm1: ";
 				for (size_t i=0;i<m;++i)
 					std::cout<<Perm1[i]<<", ";
 				std::cout<<"\n";
-				
+
 				write_maple("Sigma",SigmaBase);
 				//Discrepancy.write(std::cout,_F);
 
-			
+
 
 				std::cout<<"trivial: ";
 				for (size_t i=0;i<m;++i)
 					std::cout<<triv_column[i]<<", ";
 				std::cout<<"\n";
-				
+
+				SigmaBase[0].write(std::cout,_F);
+				_BMD.mulin_right(BPerm1, SigmaBase[0]);
 				SigmaBase[0].write(std::cout,_F);
-				_BMD.mulin_right(BPerm1, SigmaBase[0]);			
-				SigmaBase[0].write(std::cout,_F);			
 				_BMD.mulin_left(SigmaBase[0],PPiv);
 				SigmaBase[0].write(std::cout,_F);
-				_BMD.mulin_left(SigmaBase[0], PTr);				
+				_BMD.mulin_left(SigmaBase[0], PTr);
 				SigmaBase[0].write(std::cout,_F);
 				_BMD.mulin_left(SigmaBase[0], PTrT);
 				_BMD.mulin_left(SigmaBase[0],PPivT);
-				TransposedBlasMatrix<BlasPermutation> BPerm1T(BPerm1);
+				TransposedBlasMatrix<BlasPermutation<size_t> > BPerm1T(BPerm1);
 				_BMD.mulin_right(BPerm1T, SigmaBase[0]);
-				*/
+#endif
 
-				// Update SigmaBase 
-				for (size_t i=0;i<maxs+1;++i) {	
+				// Update SigmaBase
+				for (size_t i=0;i<maxs+1;++i) {
 					//SigmaBase[0].write(std::cout,_F);
 					// permute SigmaBase
 					_BMD.mulin_right(BPerm1, SigmaBase[i]);
-													
+
 					if (!QisTrivial){
-						_BMD.mulin_right(Qt, SigmaBase[i]);					
+						_BMD.mulin_right(Qt, SigmaBase[i]);
 					}
-																				
+
 					if (nbr_triv > rank){
 						_BMD.mulin_left(SigmaBase[i],PPivT);
 						_BMD.mulin_left(SigmaBase[i], PTr);
 					}
-												
-					
+
+
 					// apply transformation to SigmaBase
-				 	//BlasMatrix<Element>    S_top(SigmaBase[i], 0,0,rank,m);
-				 	//BlasMatrix<Element> S_bottom(SigmaBase[i], rank,0,m-rank,m);	
-					//_BMD.axmyin(S_bottom, G, S_top); 			
-											
+#if 0
+					BlasMatrix<Element>    S_top(SigmaBase[i], 0,0,rank,m);
+					BlasMatrix<Element> S_bottom(SigmaBase[i], rank,0,m-rank,m);
+					_BMD.axmyin(S_bottom, G, S_top);
+#endif
+
 					BlasMatrix<Element> S_top_left    (SigmaBase[i], 0,0,rank,lsize);
 					BlasMatrix<Element> S_bottom_left (SigmaBase[i], rank,0,m-rank,lsize);
-					//if (i==0){						
-					//	S_bottom_left.write(std::cout,_F);
-					//}
+#if 0
+					if (i==0){
+						S_bottom_left.write(std::cout,_F);
+					}
+#endif
 					// deal with the left part of S_bottom
 					_BMD.axmyin(S_bottom_left, G, S_top_left);
-					//if (i==0){						
-					//	S_bottom_left.write(std::cout,_F);
-					//}
-				
-					
+#if 0
+					if (i==0){
+						S_bottom_left.write(std::cout,_F);
+					}
+#endif
+
 					// deal with the right part of S_bottom
-					if (rsize > 0){	
+					if (rsize > 0){
 						BlasMatrix<Element> S_bottom_right(SigmaBase[i],rank,lsize,m-rank, rsize);
 						_MD.negin(S_bottom_right);
 					}
-					
+
 					// undo the permutation on sigmaBase
 					if (nbr_triv > rank){
 						_BMD.mulin_left(SigmaBase[i], PTrT);
@@ -1562,32 +1626,34 @@ namespace LinBox {
 					}
 
 					if (!QisTrivial)
-					 _BMD.mulin_right(Q, SigmaBase[i]);
-					//if (i==0){						
-					//	S_bottom_left.write(std::cout,_F);
-					//}					
-				} 		
-				
+						_BMD.mulin_right(Q, SigmaBase[i]);
+#if 0
+					if (i==0){
+						S_bottom_left.write(std::cout,_F);
+					}
+#endif
+				}
+
 				for (size_t i=maxs+1;i<SigmaBase.size();++i) {
 					// permute SigmaBase
 					_BMD.mulin_right(BPerm1, SigmaBase[i]);
 					if (!QisTrivial)
-						_BMD.mulin_right(Qt, SigmaBase[i]);					
-					
+						_BMD.mulin_right(Qt, SigmaBase[i]);
+
 					// apply transformation to SigmaBase
-					BlasMatrix<Element> S_bottom(SigmaBase[i], rank,0,m-rank,m);				
-				 	_MD.negin(S_bottom);
+					BlasMatrix<Element> S_bottom(SigmaBase[i], rank,0,m-rank,m);
+					_MD.negin(S_bottom);
 
 					// undo the permutation on sigmaBase
 					if (!QisTrivial)
-					 _BMD.mulin_right(Q, SigmaBase[i]);					
-				} 				
-		
-#else		  
+						_BMD.mulin_right(Q, SigmaBase[i]);
+				}
+
+#else
 				/*********************************/
 				/* OPTIMIZATION Update SigmaBase */
 				/*********************************/
-				
+
 				// Permute SigmaBase
 				for (size_t i=0;i<SigmaBase.size();++i) {
 					_BMD.mulin_right(BPerm1, SigmaBase[i]);
@@ -1596,12 +1662,12 @@ namespace LinBox {
 					if (nbr_triv > rank)
 						_BMD.mulin_left(SigmaBase[i], PTr);
 				}
-		 						
-				// split G into Gk of dimension r x r				
+
+				// split G into Gk of dimension r x r
 				size_t q = (m-rank) / rank;
 				size_t q_last= (m-rank) % rank;
-							
-				for (size_t l=0;l<q;++l){					
+
+				for (size_t l=0;l<q;++l){
 					// get kth part of G
 					BlasMatrix<Element> Gk(G,l*rank,0,rank,rank);
 
@@ -1614,23 +1680,23 @@ namespace LinBox {
 					for (size_t i=0;i<maxs+1;++i){
 						BlasMatrix<Element> S_top_left (SigmaBase[i], 0,0,rank,lsize);
 						BlasMatrix<Element> S_bottom   (SigmaBase[i], rank,0,m-rank,m);
-						
+
 						// deal with the left part of kth slice of S_bottom
-						BlasMatrix<Element> Sbk_left (S_bottom,l*rank,0,rank, lsize);					
-						_BMD.axmyin(Sbk_left, Gk, S_top_left);	
-						
+						BlasMatrix<Element> Sbk_left (S_bottom,l*rank,0,rank, lsize);
+						_BMD.axmyin(Sbk_left, Gk, S_top_left);
+
 						// deal with the right part of kth slice of S_bottom
 						if (rsize > 0){
 							BlasMatrix<Element> Sbk_right(S_bottom,l*rank,lsize,rank, rsize);
 							_MD.negin(Sbk_right);
 						}
-					} 
+					}
 					for (size_t i=maxs+1;i<maxk+1;++i){
 						BlasMatrix<Element> S_bottom(SigmaBase[i], rank,0,m-rank,m);
 						BlasMatrix<Element> Sbk(S_bottom,l*rank,0,rank, m);
 						_MD.negin(Sbk);
-					} 
-				}		
+					}
+				}
 				if( q_last > 0) {
 					// get last part of G
 					BlasMatrix<Element> G_last(G,q*rank,0,q_last,rank);
@@ -1641,84 +1707,84 @@ namespace LinBox {
 					maxk=std::min(maxk,SigmaBase.size()-1);
 					for (size_t i=0;i<maxs+1;++i){
 						BlasMatrix<Element> S_top_left (SigmaBase[i], 0,0,rank,lsize);
-					 	BlasMatrix<Element> S_bottom   (SigmaBase[i], rank,0,m-rank,m);
-						
+						BlasMatrix<Element> S_bottom   (SigmaBase[i], rank,0,m-rank,m);
+
 						// deal with the left part of kth slice of S_bottom
-					 	BlasMatrix<Element> Sb_last_left (S_bottom,q*rank,0,q_last, lsize);					
-					 	_BMD.axmyin(Sb_last_left, G_last, S_top_left);	
-						
+						BlasMatrix<Element> Sb_last_left (S_bottom,q*rank,0,q_last, lsize);
+						_BMD.axmyin(Sb_last_left, G_last, S_top_left);
+
 						// deal with the right part of kth slice of S_bottom
-					 	if (rsize > 0){
+						if (rsize > 0){
 							BlasMatrix<Element> Sb_last_right(S_bottom,q*rank,lsize,q_last, rsize);
-						 	_MD.negin(Sb_last_right);
+							_MD.negin(Sb_last_right);
 						}
-						
-					} 
+
+					}
 					for (size_t i=maxs+1;i<maxk+1;++i){
 						BlasMatrix<Element> S_bottom(SigmaBase[i], rank,0,m-rank,m);
 						BlasMatrix<Element> Sb_last(S_bottom,q*rank,0,q_last, m);
 						_MD.negin(Sb_last);
-					}				
-				} 
-						
+					}
+				}
+
 				// undo Permutation of sigma Base
 				for (size_t i=0;i<SigmaBase.size();++i) {
 					if (nbr_triv > rank)
 						_BMD.mulin_left(SigmaBase[i], PTrT);
 					if (!QisTrivial)
-						_BMD.mulin_right(Q, SigmaBase[i]);				
-				}						
+						_BMD.mulin_right(Q, SigmaBase[i]);
+				}
 #endif
 				// END OF OPTIMIZATION
-			
-	
+
+
 #ifdef _BM_TIMING
 				chrono.stop();
 				ttSigmaUp+=chrono;
 				chrono.clear();
 				chrono.start();
-#endif			
+#endif
 				/*
 				// Update  Residual (only monomials greater than k-1)
 				for (size_t i=k;i<length;++i){
-					_BMD.mulin_right(BPerm1,Residual[i]);
-					//_BMD.mulin_right(invL,Residual[i]);
-
-					// try optimization
-					_BMD.mulin_right(Qt, Residual[i]);
-					 BlasMatrix<Element>    R_top(Residual[i], 0,0,rank,n);
-					 BlasMatrix<Element> R_bottom(Residual[i], rank,0,m-rank,n);
-					 _BMD.axmyin(R_bottom, G, R_top);	
-					 				
-					 _BMD.mulin_right(Q, Residual[i]);
-				}	
+				_BMD.mulin_right(BPerm1,Residual[i]);
+				//_BMD.mulin_right(invL,Residual[i]);
+
+				// try optimization
+				_BMD.mulin_right(Qt, Residual[i]);
+				BlasMatrix<Element>    R_top(Residual[i], 0,0,rank,n);
+				BlasMatrix<Element> R_bottom(Residual[i], rank,0,m-rank,n);
+				_BMD.axmyin(R_bottom, G, R_top);
+
+				_BMD.mulin_right(Q, Residual[i]);
+				}
 				*/
 #ifdef _BM_TIMING
 				chrono.stop();
 				ttResidueUp+=chrono;
 				chrono.clear();
 				chrono.start();
-#endif			
+#endif
 				//  Calculate the new degree of SigmaBase (looking only pivot's row)
 				size_t max_degree=degree[*(Qt.getPointer())];
 				for (size_t i=1;i<rank;++i) {
 					if (degree[*(Qt.getPointer()+i)]>max_degree)
 						max_degree=degree[*(Qt.getPointer()+i)];
-				}					
+				}
 
 				// Resize SigmaBase if necessary
-				size_t size=SigmaBase.size(); 
+				size_t size=SigmaBase.size();
 				if (SigmaBase.size()<= max_degree+1)
-					{					
-						SigmaBase.resize(size+1,Zeromm);					
-						size++;cptr++;
-					}		
-					
-				// Mulitply by x the rows of SigmaBase involved as pivot 
+				{
+					SigmaBase.resize(size+1,Zeromm);
+					size++;cptr++;
+				}
+
+				// Mulitply by x the rows of SigmaBase involved as pivot
 				for (size_t i=0;i<rank;++i){
-					for (int j= (int) size-2;j>=0; --j){						
+					for (int j= (int) size-2;j>=0; --j){
 						for (size_t l=0;l<m;++l)
-							_F.assign(SigmaBase[j+1].refEntry(*(Qt.getPointer()+i),l), SigmaBase[j].getEntry(*(Qt.getPointer()+i),l));			
+							_F.assign(SigmaBase[j+1].refEntry(*(Qt.getPointer()+i),l), SigmaBase[j].getEntry(*(Qt.getPointer()+i),l));
 					}
 					for (size_t l=0;l<m;++l)
 						_F.assign(SigmaBase[0].refEntry(*(Qt.getPointer()+i),l),zero);
@@ -1730,12 +1796,12 @@ namespace LinBox {
 				chrono.start();
 #endif
 				/*
-				// Mulitply by x the rows of Residual involved as pivot 				
+				// Mulitply by x the rows of Residual involved as pivot
 				for (size_t i=0;i<rank;++i){
-					for (int j= (int) length-2;j>= (int) k; j--){
-						for (size_t l=0;l<n;++l) 
-							_F.assign(Residual[j+1].refEntry(*(Qt.getPointer()+i),l), Residual[j].getEntry(*(Qt.getPointer()+i),l));
-					}					
+				for (int j= (int) length-2;j>= (int) k; j--){
+				for (size_t l=0;l<n;++l)
+				_F.assign(Residual[j+1].refEntry(*(Qt.getPointer()+i),l), Residual[j].getEntry(*(Qt.getPointer()+i),l));
+				}
 				}
 				*/
 #ifdef _BM_TIMING
@@ -1743,13 +1809,13 @@ namespace LinBox {
 				ttResidueSh+=chrono;
 				chrono.clear();
 #endif
-				// Increase defect according to row index choosen as pivot 				
+				// Increase defect according to row index choosen as pivot
 				for (size_t i=0;i<rank;++i){
-					defect[*(Qt.getPointer()+i)]++;	
+					defect[*(Qt.getPointer()+i)]++;
 					degree[*(Qt.getPointer()+i)]++;
 					row_degree[*(Qt.getPointer()+i)]++;
-					triv_column[PermPivots[*(Qt.getPointer()+i)]]++;					
-				}											
+					triv_column[PermPivots[*(Qt.getPointer()+i)]]++;
+				}
 			}
 			//std::cout<<"row degree: ";
 			//for (size_t i=0;i<m;++i)
@@ -1758,17 +1824,18 @@ namespace LinBox {
 
 			//write_maple("Sigma",SigmaBase);
 			//std::cout<<"cpt:= "<<cptr<<"\n";
-			//if (length > 2) 
+			//if (length > 2)
 			//	std::cout<<"permformed :"<<optim<<" s x s matrix multiplication\n";
 			//std::cout<<"updsi time: "<<updis<<"s \n";
 		}
 
 
 		void new_PM_Basis(std::vector<Coefficient>     &SigmaBase,
-				  std::vector<Coefficient>    &PowerSerie, 
-				  size_t                           degree, 
-				  std::vector<size_t>             &defect) {
-						
+				  std::vector<Coefficient>    &PowerSerie,
+				  size_t                           degree,
+				  std::vector<size_t>             &defect)
+		{
+
 			size_t m,n;
 			m = PowerSerie[0].rowdim();
 			n = PowerSerie[0].coldim();
@@ -1776,7 +1843,7 @@ namespace LinBox {
 			_F.init(one,1UL);
 			const Coefficient ZeroSigma(m,m);
 			const Coefficient ZeroSerie(m,n);
-			PowerSerie.resize(degree, ZeroSerie);	
+			PowerSerie.resize(degree, ZeroSerie);
 
 			if (degree == 0) {
 				Coefficient Identity(m,m);
@@ -1786,7 +1853,7 @@ namespace LinBox {
 			}
 			else {
 				if (degree == 1) {
-#ifdef _BM_TIMING				
+#ifdef _BM_TIMING
 					tMBasis.clear();
 					tMBasis.start();
 #endif
@@ -1798,107 +1865,105 @@ namespace LinBox {
 #ifdef _BM_TIMING
 					tMBasis.stop();
 					ttMBasis += tMBasis;
-#endif			
+#endif
 				}
 				else {
-					PolynomialMatrixDomain<Field, std::vector<Coefficient> > PM_domain(_F);
-					
 					size_t degree1,degree2;
-					degree1 = (degree >> 1) + (degree & 1);				
-					degree2 = degree - degree1;									
-					
+					degree1 = (degree >> 1) + (degree & 1);
+					degree2 = degree - degree1;
+
 					//write_maple("\n\nPowerSerie", PowerSerie);
 
 					// Compute Sigma Base of half degree
 					std::vector<Coefficient> Sigma1(degree1,ZeroSigma);
-					
+
 
 					std::vector<Coefficient> Serie1(degree1);
 					for (size_t i=0;i< degree1;++i)
 						Serie1[i] = PowerSerie[i];
-					
+
 					//write_maple("Serie1", Serie1);
-				
+
 					new_PM_Basis(Sigma1, Serie1, degree1, defect);
 					//new_PM_Basis(Sigma1, PowerSerie, degree1, defect);
 
 					size_t S1size= Sigma1.size();
 
-#ifdef _BM_TIMING				
+#ifdef _BM_TIMING
 					tUpdateSerie.clear();
 					tUpdateSerie.start();
 #endif
 					/*
-					//write_maple("Sigma1", Sigma1);				
+					//write_maple("Sigma1", Sigma1);
 					Sigma1.resize(degree1+1, ZeroSigma);
-					
+
 					// Compute Serie2 = x^(-degree1).Sigma.PowerSerie mod x^degree2
-					std::vector<Coefficient> Serie2(degree1+1,ZeroSerie);										
-								
-					// Work on a copy of the old  Serie (increase size by one for computation of middle product)					
-					std::vector<Coefficient> Serie(2*degree1+1,ZeroSerie);					
+					std::vector<Coefficient> Serie2(degree1+1,ZeroSerie);
+
+					// Work on a copy of the old  Serie (increase size by one for computation of middle product)
+					std::vector<Coefficient> Serie(2*degree1+1,ZeroSerie);
 					for (size_t i=0;i< PowerSerie.size();++i)
-						Serie[i] = PowerSerie[i];
-					
+					Serie[i] = PowerSerie[i];
+
 					PM_domain.midproduct(Serie2, Sigma1, Serie);
 					//ClassicMulDomain<Field, std::vector<Coefficient> > CM_domain(_F);
-					//CM_domain.midproduct(Serie2, Sigma1, Serie); 
+					//CM_domain.midproduct(Serie2, Sigma1, Serie);
 					Serie2.resize(degree2, ZeroSerie);
 					*/
 					std::vector<Coefficient> Serie2(degree2,ZeroSerie);
 					UpdateSerie(Serie2, Sigma1, PowerSerie, degree1, degree2);
-					
-					
-#ifdef _BM_TIMING				
+
+
+#ifdef _BM_TIMING
 					tUpdateSerie.stop();
 					ttUpdateSerie += tUpdateSerie;
 #endif
 					//write_maple("Serie2", Serie2);
-					
-					// Compute Sigma Base of half degree from updated Power Serie					
+
+					// Compute Sigma Base of half degree from updated Power Serie
 					std::vector<Coefficient> Sigma2(degree2,ZeroSigma);
 					new_PM_Basis(Sigma2, Serie2, degree2, defect);
 
-					//std::cout<<"starting multiplication "<<Sigma2.size()<<" x "<<Sigma1.size()<<"...\n"; 
+					//std::cout<<"starting multiplication "<<Sigma2.size()<<" x "<<Sigma1.size()<<"...\n";
 
 					//write_maple("Sigma2", Sigma2);
-							
-					// Compute the whole Sigma Base through the product 
-					// of the Sigma Basis Sigma1 x Sigma2						
-				
-										
-#ifdef _BM_TIMING				
+
+					// Compute the whole Sigma Base through the product
+					// of the Sigma Basis Sigma1 x Sigma2
+
+
+#ifdef _BM_TIMING
 					tBasisMultiplication.clear();
 					tBasisMultiplication.start();
-#endif	
+#endif
 					// Remove leading Zero coefficient of Sigma1 and Sigma2
 					/*
-					size_t idx1,idx2;
-					idx1=Sigma1.size();
-					idx2=Sigma2.size();
-					while( _MD.isZero(Sigma1[idx1-1]) && idx1 >0) {idx1--;}
-					while( _MD.isZero(Sigma2[idx2-1]) && idx2 >0) {idx2--;}					
-				
+					   size_t idx1,idx2;
+					   idx1=Sigma1.size();
+					   idx2=Sigma2.size();
+					   while( _MD.isZero(Sigma1[idx1-1]) && idx1 >0) {idx1--;}
+					   while( _MD.isZero(Sigma2[idx2-1]) && idx2 >0) {idx2--;}
+
 					//std::cout<<"zero removed: "<<Sigma1.size()-idx1+Sigma2.size()-idx2<<"\n";
 					// resize Sigma1 ad Sigma2
 					Sigma1.resize(idx1);
 					Sigma2.resize(idx2);
 					*/
-					
+
 					//resize SigmaBase
 					SigmaBase.resize(Sigma1.size()+Sigma2.size()-1, ZeroSigma);
-					
-					PM_domain.mul(SigmaBase,Sigma2,Sigma1);	
+
+					PM_domain.mul(SigmaBase,Sigma2,Sigma1);
 
 					// Remove leading Zero coefficient of SigmaBase
 					size_t idx;
 					idx=SigmaBase.size();
 					while( _MD.isZero(SigmaBase[idx-1]) && idx >0) {idx--;}
 					SigmaBase.resize(idx, ZeroSigma);
-					
-					
-					
-#ifdef _BM_TIMING				
+
+
+
+#ifdef _BM_TIMING
 					tBasisMultiplication.stop();
 					ttBasisMultiplication += tBasisMultiplication;
 #endif
@@ -1910,11 +1975,12 @@ namespace LinBox {
 
 		// Multiply a Power Serie by a Sigma Base.
 		// only affect coefficients of the Power Serie between degree1 and degree1+degree2-1
-		void UpdateSerie(std::vector<Coefficient>                &NewSerie, 
-				 std::vector<Coefficient>               &SigmaBase, 
+		void UpdateSerie(std::vector<Coefficient>                &NewSerie,
+				 std::vector<Coefficient>               &SigmaBase,
 				 const std::vector<Coefficient>          &OldSerie,
 				 size_t                                    degree1,
-				 size_t                                    degree2){
+				 size_t                                    degree2)
+		{
 
 			size_t m,n;
 			m = OldSerie[0].rowdim();
@@ -1924,25 +1990,24 @@ namespace LinBox {
 			size_t Ssize = SigmaBase.size();
 
 			if (SigmaBase.size() < 5){
-			
+
 				// do the calculation by hand
 				for (size_t j=degree1;j<degree1+degree2;++j){
 					_BMD.mul(NewSerie[j-degree1], SigmaBase[0], OldSerie[j]);
-					for (size_t i=1;i<Ssize; ++i)				
+					for (size_t i=1;i<Ssize; ++i)
 						_BMD.axpyin(NewSerie[j-degree1], SigmaBase[i], OldSerie[j-i]);
-				}						
+				}
 			}
 			else{
 				//std::cout<<"Sigma size: "<<Ssize<<" -> "<<degree1<<" -> "<<degree2<<"\n";
 				// resize to fit the requirement of middle product algorithm
 				SigmaBase.resize(degree1+1, ZeroSigma);
-				NewSerie.resize (degree1+1, ZeroSerie);				
-				std::vector<Coefficient> Serie(2*degree1+1,ZeroSerie);					
+				NewSerie.resize (degree1+1, ZeroSerie);
+				std::vector<Coefficient> Serie(2*degree1+1,ZeroSerie);
 				for (size_t i=0;i< OldSerie.size();++i)
 					Serie[i] = OldSerie[i];
-				
+
 				// call middle product
-				PolynomialMatrixDomain<Field, std::vector<Coefficient> > PM_domain(_F);
 				PM_domain.midproduct(NewSerie, SigmaBase, Serie);
 
 				// resize results and entries
@@ -1952,13 +2017,14 @@ namespace LinBox {
 		}
 
 
-		void write_maple(const char* name, const Coefficient & C) {
+		void write_maple(const char* name, const Coefficient & C)
+		{
 			size_t m,n;
 			m = C.rowdim();
 			n = C.coldim();
 			std::cout<<"Fx:=proc(P) local i; return eval(sum(x^(i-1)*P[i],i=1..nops(P))); end proc;";
 
-			std::cout<<name<<":=Fx(["; 
+			std::cout<<name<<":=Fx([";
 			std::cout<<"Matrix([";
 			for (size_t i=0;i<m-1;++i){
 				std::cout<<"[";
@@ -1968,18 +2034,19 @@ namespace LinBox {
 			}
 			std::cout<<"[";
 			for (size_t j=0;j<n-1;++j)
-				_F.write(std::cout,C.getEntry(m-1,j))<<",";				
+				_F.write(std::cout,C.getEntry(m-1,j))<<",";
 			_F.write(std::cout, C.getEntry(m-1,n-1))<<"]])]); ";
 
 		}
 
-		void write_maple(const char* name, const std::vector<Coefficient> & P) {
+		void write_maple(const char* name, const std::vector<Coefficient> & P)
+		{
 			size_t m,n;
 			m = P[0].rowdim();
 			n = P[0].coldim();
 			std::cout<<"Fx:=proc(P) local i; return eval(sum(x^(i-1)*P[i],i=1..nops(P))); end proc;";
 
-			std::cout<<name<<":=Fx(["; 
+			std::cout<<name<<":=Fx([";
 			for (size_t k=0;k<P.size()-1;++k){
 				std::cout<<"Matrix([";
 				for (size_t i=0;i<m-1;++i){
@@ -1990,10 +2057,10 @@ namespace LinBox {
 				}
 				std::cout<<"[";
 				for (size_t j=0;j<n-1;++j)
-					_F.write(std::cout,P[k].getEntry(m-1,j))<<",";				
-				_F.write(std::cout, P[k].getEntry(m-1,n-1))<<"]]) , ";	
+					_F.write(std::cout,P[k].getEntry(m-1,j))<<",";
+				_F.write(std::cout, P[k].getEntry(m-1,n-1))<<"]]) , ";
 			}
-			
+
 			std::cout<<"Matrix([";
 			for (size_t i=0;i<m-1;++i){
 				std::cout<<"[";
@@ -2003,25 +2070,16 @@ namespace LinBox {
 			}
 			std::cout<<"[";
 			for (size_t j=0;j<n-1;++j)
-				_F.write(std::cout,P[P.size()-1].getEntry(m-1,j))<<",";				
-			_F.write(std::cout, P[P.size()-1].getEntry(m-1,n-1))<<"]])]); \n\n";	
+				_F.write(std::cout,P[P.size()-1].getEntry(m-1,j))<<",";
+			_F.write(std::cout, P[P.size()-1].getEntry(m-1,n-1))<<"]])]); \n\n";
 		}
 
 
-
-
-
-
-
-
 	}; // end of class SigmaBasis
-	
-
-
 
+} // end of namespace LinBox
 
+#undef OPTMIZED_SIGMA_UPDATE
 
+#endif //__LINBOX_sigma_basis_H
 
-} // end of namespace LinBox
-
-#endif
diff --git a/linbox/algorithms/sigmabasis.doxy b/linbox/algorithms/sigmabasis.doxy
new file mode 100644
index 0000000..cce1083
--- /dev/null
+++ b/linbox/algorithms/sigmabasis.doxy
@@ -0,0 +1,10 @@
+// Copyright (C) 2010 LinBox, GNU LGPL, see COPYING for licence information
+
+/** @ingroup algorithms
+  @defgroup sigmabase Sigma-basis
+  @brief NO DOC YET
+
+
+ */
+
+// vim:syntax=doxygen
diff --git a/linbox/algorithms/signature.h b/linbox/algorithms/signature.h
index bbd189b..cd3bd0b 100644
--- a/linbox/algorithms/signature.h
+++ b/linbox/algorithms/signature.h
@@ -1,389 +1,424 @@
+/* -*- 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
+/* Copyright (C)  LinBox
+ * Written by Zhendong Wan
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_signature_H
+#define __LINBOX_signature_H
 /* Function related to the signature computation of symmetric matrices */
-/* Author: Zhendong Wan */
 
 #include <linbox/field/modular-double.h>
 #include <linbox/field/modular-int32.h>
 #include <linbox/algorithms/cra-early-multip.h>
-#include <linbox/ffpack/ffpack.h>
+#include <fflas-ffpack/ffpack/ffpack.h>
 #include <linbox/randiter/random-prime.h>
 #include <linbox/matrix/blas-matrix.h>
 #include <linbox/algorithms/blas-domain.h>
 #include <linbox/solutions/minpoly.h>
 
-namespace LinBox {
-
-class Signature {
-public:
-
-	class BLAS_LPM_Method {};
-	class Minpoly_Method {};
-	
-	template <class Matrix>
-	bool isPosDef (const Matrix& M);
-
-	template <class Matrix>
-	static bool isPosDef (const Matrix& M, const BLAS_LPM_Method& meth) {
-		RandomPrimeIterator::setSeed(time(0));
-		size_t n = M. rowdim();
-		std::vector<int> P;
-		symmetricLU (P, M);
-		if (P. size () < n) 
-			return false;
-
-		typedef typename Matrix::Field::Element Int;
-		std::vector<Int> D(n);
-		semiD(D, M);
-
-		//std::cout << "All principal minors are: [";
-		//for (int i = 0; i < n; ++ i)
-		//	std::cout << D[i] << ", ";
-		//std::cout << "]\n";
-
-		if (allPos(D)) return true;
-		else return false;
-	}	
-	
-
-	template <class Matrix>
-	static bool isPosDef (const Matrix& M, const Minpoly_Method& meth) {
-
-		typedef typename Matrix::Field::Element Int;
-		typedef std::vector<Int> Poly;
-		Poly p;
-		minpoly (p, M);
-		typename Poly::reverse_iterator p_p;
-		typename Matrix::Field R = M. field();
-		bool flip = false;
-		for (p_p = p .rbegin(); p_p != p. rend(); ++ p_p) {
-			if (flip)
-				R. negin(*p_p);
-			flip = 1 - flip;
-		}
+namespace LinBox
+{
 
-		if(allPos(p)) return true;
-		else return false;
-	}
-
-	
-	template <class Matrix>
-	static bool isPosSemiDef (const Matrix& M, const BLAS_LPM_Method& meth) {
-		RandomPrimeIterator::setSeed(time(0));
-		size_t n = M. rowdim();
-		std::vector<int> P;
-		size_t r = rank_random (M);
-		//std::clog << "Rank:= " << r << std::endl;
-		if (r == 0) 
-			return true;
-		symmetricLU (P, M);
-		if (P. size () < r)
-			return false;
+	class Signature {
+	public:
 
-		typedef typename Matrix::Field::Element Int;
-		std::vector<Int> D(P.size());
+		class BLAS_LPM_Method {};
+		class Minpoly_Method {};
 
-		typename Matrix::Field R = M. field();
+		template <class Matrix>
+		bool isPosDef (const Matrix& M);
 
-		//std::cout << "Begin semiD:\n";
-		if(P. size() == n) 
+		template <class Matrix>
+		static bool isPosDef (const Matrix& M, const BLAS_LPM_Method& meth)
+		{
+			RandomPrimeIterator::setSeed(time(0));
+			size_t n = M. rowdim();
+			std::vector<int> P;
+			symmetricLU (P, M);
+			if (P. size () < n)
+				return false;
+
+			typedef typename Matrix::Field::Element Int;
+			std::vector<Int> D(n);
 			semiD(D, M);
-		else {
-			Matrix PM (R, P.size(), P.size());
-			typename Matrix::RowIterator cur_r; int j = 0;
-			for (cur_r = PM. rowBegin(); cur_r != PM. rowEnd(); ++ cur_r, ++j) {
-				typename Matrix::ConstRowIterator m_r = M. rowBegin() + P[j];
-				for (size_t k = 0; k < P.size(); ++ k) 
-					R. assign (cur_r -> operator[] (k),
-								m_r -> operator[] (P[k]));
+
+			//std::cout << "All principal minors are: [";
+			//for (int i = 0; i < n; ++ i)
+			//	std::cout << D[i] << ", ";
+			//std::cout << "]\n";
+
+			if (allPos(D)) return true;
+			else return false;
+		}
+
+
+		template <class Matrix>
+		static bool isPosDef (const Matrix& M, const Minpoly_Method& meth)
+		{
+
+			typedef typename Matrix::Field::Element Int;
+			typedef std::vector<Int> Poly;
+			Poly p;
+			minpoly (p, M);
+			typename Poly::reverse_iterator p_p;
+			typename Matrix::Field R = M. field();
+			bool flip = false;
+			for (p_p = p .rbegin(); p_p != p. rend(); ++ p_p) {
+				if (flip)
+					R. negin(*p_p);
+				flip = 1 - flip;
 			}
-			semiD (D, PM);
+
+			if(allPos(p)) return true;
+			else return false;
 		}
 
-		//std::cout << "End semiD:\n";
-
-		if (allPos(D)) return true;
-		else return false;
-	}	
-
-	template <class Matrix>
-	static bool isPosSemiDef (const Matrix& M, const Minpoly_Method& meth) {
-
-		typedef typename Matrix::Field::Element Int;
-		typedef std::vector<Int> Poly;
-		Poly p;
-		minpoly (p, M);
-		typename Poly::reverse_iterator p_p;
-		typename Matrix::Field R = M. field();
-		bool flip = false;
-		for (p_p = p .rbegin(); p_p != p. rend(); ++ p_p) {
-			if (flip)
-				R. negin(*p_p);
-			flip = 1 - flip;
+
+		template <class Matrix>
+		static bool isPosSemiDef (const Matrix& M, const BLAS_LPM_Method& meth)
+		{
+			RandomPrimeIterator::setSeed(time(0));
+			size_t n = M. rowdim();
+			std::vector<int> P;
+			size_t r = rank_random (M);
+			//std::clog << "Rank:= " << r << std::endl;
+			if (r == 0)
+				return true;
+			symmetricLU (P, M);
+			if (P. size () < r)
+				return false;
+
+			typedef typename Matrix::Field::Element Int;
+			std::vector<Int> D(P.size());
+
+			typename Matrix::Field R = M. field();
+
+			//std::cout << "Begin semiD:\n";
+			if(P. size() == n)
+				semiD(D, M);
+			else {
+				Matrix PM (R, P.size(), P.size());
+				typename Matrix::RowIterator cur_r; int j = 0;
+				for (cur_r = PM. rowBegin(); cur_r != PM. rowEnd(); ++ cur_r, ++j) {
+					typename Matrix::ConstRowIterator m_r = M. rowBegin() + P[j];
+					for (size_t k = 0; k < P.size(); ++ k)
+						R. assign (cur_r -> operator[] (k),
+							   m_r -> operator[] (P[k]));
+				}
+				semiD (D, PM);
+			}
+
+			//std::cout << "End semiD:\n";
+
+			if (allPos(D)) return true;
+			else return false;
 		}
 
-		if(allNonNeg(p)) return true;
-		else return false;
-	}
+		template <class Matrix>
+		static bool isPosSemiDef (const Matrix& M, const Minpoly_Method& meth)
+		{
+
+			typedef typename Matrix::Field::Element Int;
+			typedef std::vector<Int> Poly;
+			Poly p;
+			minpoly (p, M);
+			typename Poly::reverse_iterator p_p;
+			typename Matrix::Field R = M. field();
+			bool flip = false;
+			for (p_p = p .rbegin(); p_p != p. rend(); ++ p_p) {
+				if (flip)
+					R. negin(*p_p);
+				flip = 1 - flip;
+			}
 
-private:
+			if(allNonNeg(p)) return true;
+			else return false;
+		}
 
-	template <class Vector>
-	static bool allPos (const Vector& v) {
-		
-		typename Vector::const_iterator p;
-		for (p = v. begin(); p != v. end(); ++ p)
-			if (*p <= 0)
-				return false;
+	private:
 
-		return true;
-	}
+		template <class Vector>
+		static bool allPos (const Vector& v)
+		{
 
-	template <class Vector>
-	static bool allNonNeg (const Vector& v) {
-		
-		typename Vector::const_iterator p;
-		for (p = v. begin(); p != v. end(); ++ p)
-			if (*p < 0)
-				return false;
+			typename Vector::const_iterator p;
+			for (p = v. begin(); p != v. end(); ++ p)
+				if (*p <= 0)
+					return false;
 
-		return true;
-	}
-
-	/* Compute the equivalent diagonal matrix
-	 * ie. with the same signature
-	 * Assume M is non-singular and symmetric with generic rank profile
-	 */
-
-	template <class Matrix, class Vector>
-	static Vector& semiD (Vector& out, const Matrix& M) {
-		
-		//std::cout << "Debug begin with input matrix:\n";
-		//M. write (std::cout);
-		typedef typename Matrix::Field Ring;
-		typedef typename Ring::Element Integer;
-		typedef Modular<double> Field;
-		typedef Field::Element Element;
-
-		size_t n = M. rowdim();
-			
-		integer mmodulus;
-		FieldTraits<Field>::maxModulus(mmodulus);
-		long bit1 = (long) floor (log((double)mmodulus)/M_LN2);
-		long bit2 = (long) floor (log(sqrt(double(4503599627370496LL/n)))/M_LN2);
-		RandomPrimeIterator primeg(bit1 < bit2 ? bit1 : bit2); 
-
-		Field::Element* FA = new Field::Element[n*n];
-		size_t* P= new size_t[n], *PQ = new size_t[n];
-		size_t* P_p, * PQ_p;
-
-		Field::Element* p; Field::Element tmp;
-		EarlyMultipCRA< Field > cra(3UL);
-
-		Integer m = 1;
-		std::vector<Field::Element> v(n);
-		size_t j = 0;
-		Field K2;
-		bool faithful = true;
-		typename Matrix::ConstRawIterator raw_p;
-
-		do {
-		// get a prime. 
-		// Compute mod that prime. Accumulate into v with CRA. 
-		++primeg ; while(cra.noncoprime(*primeg)) ++primeg; 
-		Field K1(*primeg); 
-		K2 = K1;
-
-		//clog << "Computing blackbox matrix mod " << prime;
-		for (p = FA, raw_p = M. rawBegin(); p != FA + (n*n); ++ p, ++ raw_p)
-		  K1. init (*p, *raw_p);
-
-		//clog << "\rComputing lup mod " << prime << ". ";
-		FFPACK::LUdivine(K1, FFLAS::FflasNonUnit, FFLAS::FflasNoTrans, n, n, FA, n, P, PQ, FFPACK::FfpackLQUP);
-
-		faithful = true;
-		for ( j = 0, P_p = P, PQ_p = PQ; j < n; ++ j, ++ P_p, ++ PQ_p) 
-		  if ((*P_p != j) || (*PQ_p != j))  {
-		    faithful = false;
-		    break;
-		  }
-
-		} while(! faithful);
-		K2. init (tmp, 1UL);
-
-		typename std::vector<Field::Element>::iterator vp;
-		for (j = 0, vp = v.begin(); vp != v.end(); ++j, ++vp) {
-		  K2.mulin(tmp, *(FA + (j * n + j)));
-		  K2.assign(*vp, tmp);
+			return true;
 		}
-		cra. initialize(K2, v); 
-
-		while (! cra.terminated() ){
-			// get a prime. 
-		   ++primeg; while(cra.noncoprime(*primeg)) ++primeg; 
-		  Field K(*primeg); 
-		  //clog << "Computing blackbox matrix mod " << prime;
-		  for (p = FA, raw_p = M. rawBegin(); p != FA + (n*n); ++ p, ++ raw_p)
-		    K. init (*p, *raw_p);
-		  
-		  //clog << "\rComputing lup mod " << prime << ". ";
-		  FFPACK::LUdivine(K, FFLAS::FflasNonUnit, FFLAS::FflasNoTrans, n, n, FA, n, P, PQ, FFPACK::FfpackLQUP);
-		  
-		  faithful = true;
-		  for ( j = 0, P_p = P, PQ_p = PQ; j < n; ++ j, ++ P_p, ++ PQ_p) 
-		    if ((*P_p != j) || (*PQ_p != j))  {
-		      faithful = false;
-		      break;
-		    }
-		  
-		  if (!faithful) {
-		    //std::cout << "Not a faithful prime\n";
-		    continue;
-		  }
-		  
-		  K. init (tmp, 1UL);
-
-		  for (j = 0, vp = v.begin(); vp != v.end(); ++j, ++vp) {
-		    K.mulin(tmp, *(FA + (j * n + j)));
-		    K.assign(*vp, tmp);
-		  }
-// 		  std::cout << "Faithful image:[";
-// 		  for (int l = 0; l < v. size(); ++ l)
-// 		  std::cout << v[l] << ", ";
-// 		  std::cout << "]\n";
-		  cra. progress(K, v); 
+
+		template <class Vector>
+		static bool allNonNeg (const Vector& v)
+		{
+
+			typename Vector::const_iterator p;
+			for (p = v. begin(); p != v. end(); ++ p)
+				if (*p < 0)
+					return false;
+
+			return true;
 		}
-		
-		delete[] FA;
-		delete[] P;
-		delete[] PQ; 
-		//std::cout << "Compute the final answer.\n";
-		cra.result(out);
-		return out;
-	}
-
-	//only works with symmetric integer matrix
-	// return a permutation matrix which is represented as a vector, such that
-	// all principal of PAP^T are non-zero, up to a maximal.
-	template <class Vector, class Matrix>
-	static Vector& symmetricLU (Vector& v, const Matrix& IM) {
-
-		typedef Modular<int32> Field;
-		typedef Field::Element Element;
-		typedef DenseMatrix<Field> FMatrix;
-		RandomPrimeIterator primeg(20);
-		Field F (*primeg);
-		FMatrix* FM;
-		//std::cout << "Random prime " << p << "\n";
-		
-		Element zero; F. init (zero, 0);
-		MatrixHom::map (FM, IM, F);
-		VectorDomain<Field> VD(F);
-		FMatrix& M = *FM;
-
-		//typename FMatrix::RowIterator cur_r, tmp_r;
-		typedef FMatrix::Row Row;
-		//the index is 0-based.
-		int i = 0;
-		int n = M. rowdim();
-		std::vector<int> P(n);
-
-		for (i = 0; i < n; ++ i)
-			P[i] = i;
-		
-		//M. write(std::cout);
-		for (i = 0; i < n; ++ i) {
-			//std::cout << "i= " << i << "\n";
-			int j;
-			//find a pivot
-			for (j = i; j < n; ++ j) {
-				if (!F. isZero(M[j][j])) break;
+
+		/* Compute the equivalent diagonal matrix
+		 * ie. with the same signature
+		 * Assume M is non-singular and symmetric with generic rank profile
+		 */
+
+		template <class Matrix, class Vector>
+		static Vector& semiD (Vector& out, const Matrix& M)
+		{
+
+			//std::cout << "Debug begin with input matrix:\n";
+			//M. write (std::cout);
+			typedef typename Matrix::Field Ring;
+			typedef typename Ring::Element Integer;
+			typedef Modular<double> Field;
+			typedef Field::Element Element;
+
+			size_t n = M. rowdim();
+
+			integer mmodulus;
+			FieldTraits<Field>::maxModulus(mmodulus);
+			long bit1 = (long) floor (log((double)mmodulus)/M_LN2);
+			long bit2 = (long) floor (log(sqrt(double(4503599627370496LL/n)))/M_LN2);
+			RandomPrimeIterator primeg(bit1 < bit2 ? bit1 : bit2);
+
+			Field::Element* FA = new Field::Element[n*n];
+			size_t* P= new size_t[n], *PQ = new size_t[n];
+			size_t* P_p, * PQ_p;
+
+			Field::Element* p; Field::Element tmp;
+			EarlyMultipCRA< Field > cra(3UL);
+
+			Integer m = 1;
+			std::vector<Field::Element> v(n);
+			size_t j = 0;
+			Field K2;
+			bool faithful = true;
+			typename Matrix::ConstRawIterator raw_p;
+
+			do {
+				// get a prime.
+				// Compute mod that prime. Accumulate into v with CRA.
+				++primeg ; while(cra.noncoprime(*primeg)) ++primeg;
+				Field K1(*primeg);
+				K2 = K1;
+
+				//clog << "Computing blackbox matrix mod " << prime;
+				for (p = FA, raw_p = M. rawBegin(); p != FA + (n*n); ++ p, ++ raw_p)
+					K1. init (*p, *raw_p);
+
+				//clog << "\rComputing lup mod " << prime << ". ";
+				FFPACK::LUdivine(K1, FFLAS::FflasNonUnit, FFLAS::FflasNoTrans, n, n, FA, n, P, PQ, FFPACK::FfpackLQUP);
+
+				faithful = true;
+				for ( j = 0, P_p = P, PQ_p = PQ; j < n; ++ j, ++ P_p, ++ PQ_p)
+					if ((*P_p != j) || (*PQ_p != j))  {
+						faithful = false;
+						break;
+					}
+
+			} while(! faithful);
+			K2. init (tmp, 1UL);
+
+			typename std::vector<Field::Element>::iterator vp;
+			for (j = 0, vp = v.begin(); vp != v.end(); ++j, ++vp) {
+				K2.mulin(tmp, *(FA + (j * n + j)));
+				K2.assign(*vp, tmp);
+			}
+			cra. initialize(K2, v);
+
+			while (! cra.terminated() ){
+				// get a prime.
+				++primeg; while(cra.noncoprime(*primeg)) ++primeg;
+				Field K(*primeg);
+				//clog << "Computing blackbox matrix mod " << prime;
+				for (p = FA, raw_p = M. rawBegin(); p != FA + (n*n); ++ p, ++ raw_p)
+					K. init (*p, *raw_p);
+
+				//clog << "\rComputing lup mod " << prime << ". ";
+				FFPACK::LUdivine(K, FFLAS::FflasNonUnit, FFLAS::FflasNoTrans, n, n, FA, n, P, PQ, FFPACK::FfpackLQUP);
+
+				faithful = true;
+				for ( j = 0, P_p = P, PQ_p = PQ; j < n; ++ j, ++ P_p, ++ PQ_p)
+					if ((*P_p != j) || (*PQ_p != j))  {
+						faithful = false;
+						break;
+					}
+
+				if (!faithful) {
+					//std::cout << "Not a faithful prime\n";
+					continue;
+				}
+
+				K. init (tmp, 1UL);
+
+				for (j = 0, vp = v.begin(); vp != v.end(); ++j, ++vp) {
+					K.mulin(tmp, *(FA + (j * n + j)));
+					K.assign(*vp, tmp);
+				}
+				// 		  std::cout << "Faithful image:[";
+				// 		  for (int l = 0; l < v. size(); ++ l)
+				// 		  std::cout << v[l] << ", ";
+				// 		  std::cout << "]\n";
+				cra. progress(K, v);
 			}
 
-			//no piviot 
-			if (j == n) break;
+			delete[] FA;
+			delete[] P;
+			delete[] PQ;
+			//std::cout << "Compute the final answer.\n";
+			cra.result(out);
+			return out;
+		}
 
-			// a pivot
-			if (j != i) {
-				VD. swap (*(M. colBegin() + j), *(M. colBegin() + i));
-				VD. swap (*(M. rowBegin() + j), *(M. rowBegin() + i));
-			}
-			//std::cout << "Pivot= " << j << '\n';
-			//M. write(std::cout);
+		//only works with symmetric integer matrix
+		// return a permutation matrix which is represented as a vector, such that
+		// all principal of PAP^T are non-zero, up to a maximal.
+		template <class Vector, class Matrix>
+		static Vector& symmetricLU (Vector& v, const Matrix& IM)
+		{
+
+			typedef Modular<int32_t> Field;
+			// typedef Modular<double> Field;
+			typedef Field::Element Element;
+			typedef DenseMatrix<Field> FMatrix;
+			RandomPrimeIterator primeg(20);
+			Field F (*primeg);
+			FMatrix FM(F, IM.rowdim(), IM.coldim());
+			//std::cout << "Random prime " << p << "\n";
+
+			Element zero; F. init (zero, 0);
+			MatrixHom::map (FM, IM, F);
+			VectorDomain<Field> VD(F);
+			FMatrix& M = FM;
+
+			//typename FMatrix::RowIterator cur_r, tmp_r;
+			typedef FMatrix::Row Row;
+			//the index is 0-based.
+			int i = 0;
+			int n = M. rowdim();
+			std::vector<int> P(n);
+
+			for (i = 0; i < n; ++ i)
+				P[i] = i;
 
-			P[i] = j;
-			Element tmp;
-			F. inv (tmp, M[i][i]);
-			F. negin(tmp);
-			VD. mulin(*(M. rowBegin() + i), tmp);
 			//M. write(std::cout);
-			
-			for (j = i + 1; j < n; ++ j) {
-				F. assign (tmp,  M[j][i]);
-				VD. axpyin (*(M. rowBegin() + j), tmp,
-							*(M. rowBegin() + i));
+			for (i = 0; i < n; ++ i) {
+				//std::cout << "i= " << i << "\n";
+				int j;
+				//find a pivot
+				for (j = i; j < n; ++ j) {
+					if (!F. isZero(M[j][j])) break;
+				}
+
+				//no piviot
+				if (j == n) break;
+
+				// a pivot
+				if (j != i) {
+					VD. swap (*(M. colBegin() + j), *(M. colBegin() + i));
+					VD. swap (*(M. rowBegin() + j), *(M. rowBegin() + i));
+				}
+				//std::cout << "Pivot= " << j << '\n';
+				//M. write(std::cout);
+
+				P[i] = j;
+				Element tmp;
+				F. inv (tmp, M[i][i]);
+				F. negin(tmp);
+				VD. mulin(*(M. rowBegin() + i), tmp);
+				//M. write(std::cout);
+
+				for (j = i + 1; j < n; ++ j) {
+					F. assign (tmp,  M[j][i]);
+					VD. axpyin (*(M. rowBegin() + j), tmp,
+						    *(M. rowBegin() + i));
+				}
+
+				//not necessary
+				//M. write(std::cout);
+				for (j = i + 1; j < n; ++ j)
+					F. assign (M[i][j], zero);
 			}
 
-			//not necessary
-			//M. write(std::cout);
-			for (j = i + 1; j < n; ++ j)
-				F. assign (M[i][j], zero);
-		}
+			v. resize (n);
+			std::vector<int>::iterator i_p; int j;
+			for (i_p = v. begin(), j = 0; i_p != v. end(); ++ i_p, ++ j)
+				*i_p = j;
 
-		delete FM;
+			for (j = 0; j < i; ++ j) {
+				if (j != P[j])
+					std::swap (v[j], v[P[j]]);
+			}
 
-		v. resize (n);
-		std::vector<int>::iterator i_p; int j;
-		for (i_p = v. begin(), j = 0; i_p != v. end(); ++ i_p, ++ j)
-			*i_p = j;
+			v. resize (i);
 
-		for (j = 0; j < i; ++ j) {
-			if (j != P[j])
-				std::swap (v[j], v[P[j]]);
-		}
+			//std::cout << "Pseud-rank: " << i << "\n[";
+			//for (i_p = v. begin(); i_p != v. end(); ++ i_p)
+			//	std::cout << *i_p << ", ";
+			//std::cout << "]\n";
 
-		v. resize (i);
-
-		//std::cout << "Pseud-rank: " << i << "\n[";
-		//for (i_p = v. begin(); i_p != v. end(); ++ i_p)
-		//	std::cout << *i_p << ", ";
-		//std::cout << "]\n";
+			return v;
+		}
 
-		return v;
-	}
+		// This assumes Matrix is DenseMatrix
+		// (that it's rawiterator will go thru n^2 values row by row.)
+		template <class Matrix>
+		static long rank_random (const Matrix& M)
+		{
 
-	// This assumes Matrix is DenseMatrix 
-	// (that it's rawiterator will go thru n^2 values row by row.)
-	template <class Matrix>
-	static long rank_random (const Matrix& M) {
+			typedef typename Matrix::Field Ring;
+			typedef typename Ring::Element Integer;
+			typedef Modular<double> Field;
+			typedef Field::Element Element;
 
-		typedef typename Matrix::Field Ring;
-		typedef typename Ring::Element Integer;
-		typedef Modular<double> Field;
-		typedef Field::Element Element;
+			int n = M. rowdim();
 
-		int n = M. rowdim();
-			
-		integer mmodulus;
-		FieldTraits<Field>::maxModulus(mmodulus);
-		long bit1 = (long) floor (log((double)mmodulus)/M_LN2);
-		long bit2 = (long) floor (log(sqrt(double(4503599627370496LL/n)))/M_LN2);
-		RandomPrimeIterator primeg(bit1 < bit2 ? bit1 : bit2); 
+			integer mmodulus;
+			FieldTraits<Field>::maxModulus(mmodulus);
+			long bit1 = (long) floor (log((double)mmodulus)/M_LN2);
+			long bit2 = (long) floor (log(sqrt(double(4503599627370496LL/n)))/M_LN2);
+			RandomPrimeIterator primeg(bit1 < bit2 ? bit1 : bit2);
 
-		Field::Element* FA = new Field::Element[n*n], *p;
+			Field::Element* FA = new Field::Element[n*n], *p;
 
-		// get a prime. 
-		// Compute the rank mod that prime. Accumulate into v with CRA. 
-		Field K(*primeg); 
+			// get a prime.
+			// Compute the rank mod that prime. Accumulate into v with CRA.
+			Field K(*primeg);
 
-		typename Matrix::ConstRawIterator raw_p;
-		for (p = FA, raw_p = M. rawBegin(); p != FA + (n*n); ++ p, ++ raw_p)
-			K. init (*p, *raw_p);
+			typename Matrix::ConstRawIterator raw_p;
+			for (p = FA, raw_p = M. rawBegin(); p != FA + (n*n); ++ p, ++ raw_p)
+				K. init (*p, *raw_p);
 
-		long r = FFPACK::Rank( K, n, n, FA, n);
+			long r = FFPACK::Rank( K, n, n, FA, n);
 
-		delete[] FA;
-		return r;
+			delete[] FA;
+			return r;
 
-	}
-}; // end of class Signature
+		}
+	}; // end of class Signature
 
 } //end of namespace LinBox
+
+#endif //__LINBOX_signature_H
diff --git a/linbox/algorithms/smith-form-adaptive.h b/linbox/algorithms/smith-form-adaptive.h
index 2ff25a8..f32b078 100644
--- a/linbox/algorithms/smith-form-adaptive.h
+++ b/linbox/algorithms/smith-form-adaptive.h
@@ -1,77 +1,103 @@
-/* Implement the adaptive algorithm for Smith form compuation
- * authors: bds and zw
+/* -*- 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
+/* Copyright (C) LinBox
+ * Written by bds and zw
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_smith_form_adaptive_H
+#define __LINBOX_smith_form_adaptive_H
+
+/*! @file algorithms/smith-form-adaptive.h
+ * @ingroup algorithms
+ * Implement the adaptive algorithm for Smith form computation
  */
-#ifndef __LINBOX_SMITH_FORM_ADAPTIVE_H__
-#define __LINBOX_SMITH_FORM_ADAPTIVE_H__
 
 #include <vector>
 #include <linbox/integer.h>
 #include <linbox/blackbox/dense.h>
 
-namespace LinBox {
+namespace LinBox
+{
 
-class SmithFormAdaptive {
+	class SmithFormAdaptive {
 	public:
 
-	static const long prime[];// = {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};
+		static const long prime[];// = {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};
+
+		static const int NPrime;// = 25;
 
-	static const int NPrime;// = 25;
+		/* Compute the local smith form at prime p, when modular (p^e) fits in long
+		 * Should work with SparseMatrix and DenseMatrix
+		 */
+		template <class Matrix>
+		static void compute_local_long (std::vector<integer>& s, const Matrix& A, long p, long e);
 
-	/* Compute the local smith form at prime p, when modular (p^e) fits in long
-	 * Should work with SparseMatrix and DenseMatrix
-	*/
-	template <class Matrix>
-	static void compute_local_long (std::vector<integer>& s, const Matrix& A, long p, long e);
+		/* Compute the local smith form at prime p, when modular (p^e) doesnot fit in long
+		 * Should work with SparseMatrix and DenseMatrix
+		 */
+		template <class Matrix>
+		static void compute_local_big (std::vector<integer>& s, const Matrix& A, long p, long e);
 
-	/* Compute the local smith form at prime p, when modular (p^e) doesnot fit in long
-	 * Should work with SparseMatrix and DenseMatrix
-	*/
-	template <class Matrix>
-	static void compute_local_big (std::vector<integer>& s, const Matrix& A, long p, long e);
+		/* Compute the local smith form at prime p
+		*/
+		template <class Matrix>
+		static void compute_local (std::vector<integer>& s, const Matrix& A, long p, long e);
 
-	/* Compute the local smith form at prime p
-	*/
-	template <class Matrix>
-	static void compute_local (std::vector<integer>& s, const Matrix& A, long p, long e);
+		/* Compute the k-smooth part of the invariant factor, where k = 100.
+		 * @param sev is the exponent part ...
+		 * By local smith form and rank computation
+		 * Should work with SparseMatrix and DenseMatrix
+		 */
+		template <class Matrix>
+		static void smithFormSmooth (std::vector<integer>& s, const Matrix& A, long r, const std::vector<long>& sev);
 
-	/* Compute the k-smooth part of the invariant factor, where k = 100.
-	 * @param sev is the exponent part ...
-	 * By local smith form and rank computation
-	 * Should work with SparseMatrix and DenseMatrix
-	 */
-	template <class Matrix>
-	static void smithFormSmooth (std::vector<integer>& s, const Matrix& A, long r, const std::vector<long>& sev);
-			
-	/* Compute the k-rough part of the invariant factor, where k = 100.
-	 * By EGV+ algorithm or Iliopoulos' algorithm for Smith form.
-	 * Should work with DenseMatrix
-	*/
-	template <class Matrix>
-	static void smithFormRough  (std::vector<integer>& s, const Matrix& A, integer m );
+		/* Compute the k-rough part of the invariant factor, where k = 100.
+		 * By EGV+ algorithm or Iliopoulos' algorithm for Smith form.
+		 * Should work with DenseMatrix
+		 */
+		template <class Matrix>
+		static void smithFormRough  (std::vector<integer>& s, const Matrix& A, integer m );
 
-	/* Compute the Smith form via valence algorithms
-	 * Compute the local Smith form at each possible prime
-	 * r >= 2;
-	 * Should work with SparseMatrix and DenseMatrix
-	 */
-	template <class Matrix>
-	static void smithFormVal (std::vector<integer>&s, const Matrix& A, long r, const std::vector<long>& sev);
+		/* Compute the Smith form via valence algorithms
+		 * Compute the local Smith form at each possible prime
+		 * r >= 2;
+		 * Should work with SparseMatrix and DenseMatrix
+		 */
+		template <class Matrix>
+		static void smithFormVal (std::vector<integer>&s, const Matrix& A, long r, const std::vector<long>& sev);
 
-	/** \brief Smith form of a dense matrix by adaptive algorithm.
-	 *
-	 * Compute the largest invariant factor, then, based on that, 
-	 * compute the rough and smooth part, separately.
-	 * Should work with SparseMatrix and DenseMatrix
-	 */
-	template <class Matrix>
-	static void smithForm (std::vector<integer>& s, const Matrix& A);
-	/** Specialization for dense case*/
-	template <class IRing>
-	static void smithForm (std::vector<integer>& s, const DenseMatrix<IRing>& A);
-};
+		/** \brief Smith form of a dense matrix by adaptive algorithm.
+		 *
+		 * Compute the largest invariant factor, then, based on that,
+		 * compute the rough and smooth part, separately.
+		 * Should work with SparseMatrix and DenseMatrix
+		 */
+		template <class Matrix>
+		static void smithForm (std::vector<integer>& s, const Matrix& A);
+		/** Specialization for dense case*/
+		template <class IRing>
+		static void smithForm (std::vector<integer>& s, const DenseMatrix<IRing>& A);
+	};
 	const long SmithFormAdaptive::prime[] = {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};
 	const int SmithFormAdaptive::NPrime = 25;
 }
 
 #include <linbox/algorithms/smith-form-adaptive.inl>
-#endif
+#endif //__LINBOX_smith_form_adaptive_H
diff --git a/linbox/algorithms/smith-form-adaptive.inl b/linbox/algorithms/smith-form-adaptive.inl
index 84d1667..84a2989 100644
--- a/linbox/algorithms/smith-form-adaptive.inl
+++ b/linbox/algorithms/smith-form-adaptive.inl
@@ -1,8 +1,29 @@
-/* not sure filename
+/* -*- 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
+/* Copyright (C)  LinBox
+ *
  * authors: bds and zw
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
-#ifndef __SMITH_FORM_ADAPTIVE_H__
-#define __SMITH_FORM_ADAPTIVE_H__
+
+
+#ifndef __LINBOX_smith_form_adaptive_INL
+#define __LINBOX_smith_form_adaptive_INL
 
 #include <math.h>
 #include <vector>
@@ -21,7 +42,7 @@
 #include <linbox/algorithms/matrix-hom.h>
 #include <linbox/blackbox/random-matrix.h>
 #include <linbox/blackbox/scompose.h>
-#include <linbox/ffpack/ffpack.h>
+#include <fflas-ffpack/ffpack/ffpack.h>
 #include <linbox/algorithms/smith-form-binary.h>
 #include <linbox/algorithms/smith-form-adaptive.inl>
 #include <linbox/solutions/valence.h>
@@ -32,36 +53,37 @@
 #include <linbox/field/PIR-ntl-ZZ_p.h>
 #endif
 
-namespace LinBox {
+namespace LinBox
+{
 
 	/* Compute the local smith form at prime p, when modular (p^e) fits in long
 	*/
 	template <class Matrix>
-	void SmithFormAdaptive::compute_local_long (std::vector <integer>& s, const Matrix& A, long p, long e) {
+	void SmithFormAdaptive::compute_local_long (std::vector <integer>& s, const Matrix& A, long p, long e)
+	{
 		std::ostream& report = commentator.report (Commentator::LEVEL_IMPORTANT, PROGRESS_REPORT);
-		
+
 		int order = A. rowdim() < A. coldim() ? A. rowdim() : A. coldim();
 		linbox_check ((s. size() >= (unsigned long)order) && (p > 0) && ( e >= 0));
 		if (e == 0) return;
 
 		if (p == 2) {
-			 report << "      Compute local smith at 2^32 using special Local2_32\n";
-			 Local2_32 R;
-			 DenseMatrix <Local2_32>* A_local; 
-			 std::list <Local2_32::Element> l;
-			 SmithFormLocal<Local2_32> SF;
-			 MatrixHom::map (A_local, A, R);
-			 SF (l, *A_local, R);
-			 delete A_local;
-			 std::list <Local2_32::Element>::iterator l_p;
-			 std::vector <integer>::iterator s_p;
-			 for (s_p = s. begin(), l_p = l. begin(); s_p != s. begin() + order; ++ s_p, ++ l_p) 
-			 	*s_p = *l_p;
+			report << "      Compute local smith at 2^32 using special Local2_32\n";
+			Local2_32 R;
+			std::list <Local2_32::Element> l;
+			SmithFormLocal<Local2_32> SF;
+			DenseMatrix <Local2_32> A_local(R, A.rowdim(),A.coldim());
+			MatrixHom::map (A_local, A, R);
+			SF (l, A_local, R);
+			std::list <Local2_32::Element>::iterator l_p;
+			std::vector <integer>::iterator s_p;
+			for (s_p = s. begin(), l_p = l. begin(); s_p != s. begin() + order; ++ s_p, ++ l_p)
+				*s_p = *l_p;
 			report << "     Done\n";
 		}
 		else if (e == 1) {
 			report << "      Compute local smith at prime " << p << ", by rank.\n";
-			/** Meet trouble to call ffpack routine
+#if 0 /*Meet trouble to call ffpack routine*/
 			Modular<double> F (p); Modular<double>::Element elt;
 			int n = A. rowdim(); int m = A. coldim();
 			Modular<double>::Element* A_local = new Modular<double>::Element [n * m];
@@ -72,10 +94,10 @@ namespace LinBox {
 				F. init (*A_local_p, 0);
 			integer tmp;
 			for (rawi_p = A. rawIndexedBegin(), raw_p = A. rawBegin(), A_local_p = A_local; rawi_p != A. rawIndexedEnd(); ++ rawi_p, ++ raw_p, ++ A_local_p) {
-				 //F. init (*A_local_p, *raw_p);
-				 A. field(). convert (tmp, *raw_p); 
-				 F. init (elt, tmp); 
-				 F. assign (*(A_local + (int(rawi_p. rowIndex()) * m + int(rawi_p. colIndex()))), elt);
+				//F. init (*A_local_p, *raw_p);
+				A. field(). convert (tmp, *raw_p);
+				F. init (elt, tmp);
+				F. assign (*(A_local + (int(rawi_p. rowIndex()) * m + int(rawi_p. colIndex()))), elt);
 			}
 
 			std::cout << "Initialize matrix done\n";
@@ -86,14 +108,12 @@ namespace LinBox {
 			unsigned int rank = FFPACK::Rank (F, n, m, A_local, m);
 			std::cout << "Call of ffpack is done\n";
 			delete[] A_local;
-			*/
-			typedef Modular<int32> Field;
+#endif
+			typedef Modular<int32_t> Field;
 			typedef DenseMatrix<Field> FMatrix;
 			MatrixRank<typename Matrix::Field, Field> MR;
-			Field F(p); FMatrix* A_local;
-			MatrixHom::map (A_local, A, F);
-			long rank = MR. rankIn (*A_local);
-			delete A_local;
+			Field F(p); FMatrix A_local(A, F);
+			long rank = MR. rankIn (A_local);
 
 			std::vector <integer>::iterator s_p;
 			for (s_p = s. begin(); s_p != s. begin() + (long) rank; ++ s_p)
@@ -103,45 +123,45 @@ namespace LinBox {
 			report << "      Done\n";
 		}
 		else {
-			report << "      Compute local smith at " << p <<'^' << e << " using PIRModular<int32>\n";
+			report << "      Compute local smith at " << p <<'^' << e << " using PIRModular<int32_t>\n";
 			long m = 1; int i = 0; for (i = 0; i < e; ++ i) m *= p;
-			PIRModular <int32> R(m);
-			DenseMatrix <PIRModular<int32> >* A_local; 
-			SmithFormLocal <PIRModular<int32> > SF;
-			std::list <PIRModular<int32>::Element> l; 
+			typedef PIRModular<int32_t> PIR;
+			PIR R(m);
+			DenseMatrix <PIR> A_local(R, A.rowdim(), A.coldim());
+			SmithFormLocal <PIR> SF;
+			std::list <PIR::Element> l;
 			MatrixHom::map (A_local, A, R);
-			SF (l, *A_local, R);
-			delete A_local;
-			std::list <PIRModular<int32>::Element>::iterator l_p;
+			SF (l, A_local, R);
+			std::list <PIR::Element>::iterator l_p;
 			std::vector <integer>::iterator s_p;
 			for (s_p = s. begin(), l_p = l. begin(); s_p != s. begin() + order; ++ s_p, ++ l_p)
 				*s_p = *l_p;
 			report <<  "      Done\n";
 		}
-	
+
 	}
-	
+
 #ifdef __LINBOX_HAVE_NTL
 	/* Compute the local smith form at prime p, when modular (p^e) doesnot fit in long
 	*/
 	template <class Matrix>
-	void SmithFormAdaptive::compute_local_big (std::vector<integer>& s, const Matrix& A, long p, long e) {
-		
+	void SmithFormAdaptive::compute_local_big (std::vector<integer>& s, const Matrix& A, long p, long e)
+	{
+
 		std::ostream& report = commentator.report (Commentator::LEVEL_IMPORTANT, PROGRESS_REPORT);
 		int order = A. rowdim() < A. coldim() ? A. rowdim() : A. coldim();
 		linbox_check ((s. size() >= (unsigned long) order) && (p > 0) && ( e >= 0));
 		integer T; T = order; T <<= 20; T = pow (T, (int) sqrt((double)order));
 		NTL::ZZ m;  NTL::conv(m, 1); int i = 0; for (i = 0; i < e; ++ i) m *= p;
-		//if (m < T) {
+		//if (m < T)
 		if (1) {
 			report << "      Compute local Smith at " << p << '^' << e << " over PIR-ntl-ZZ_p\n";
 			PIR_ntl_ZZ_p R(m);
-			DenseMatrix <PIR_ntl_ZZ_p>* A_local; 
+			DenseMatrix <PIR_ntl_ZZ_p> A_local(R, A.rowdim(), A.coldim());
 			SmithFormLocal <PIR_ntl_ZZ_p> SF;
-			std::list <PIR_ntl_ZZ_p::Element> l; 
+			std::list <PIR_ntl_ZZ_p::Element> l;
 			MatrixHom::map (A_local, A, R);
-			SF (l, *A_local, R);
-			delete A_local;
+			SF (l, A_local, R);
 			std::list <PIR_ntl_ZZ_p::Element>::iterator l_p;
 			std::vector <integer>::iterator s_p;
 			for (s_p = s. begin(), l_p = l. begin(); s_p != s. begin() + order; ++ s_p, ++ l_p)
@@ -154,21 +174,29 @@ namespace LinBox {
 		}
 		return;
 	}
+#else
+	template <class Matrix>
+	void SmithFormAdaptive::compute_local_big (std::vector<integer>& s, const Matrix& A, long p, long e)
+	{
+		throw(LinBoxError("you need NTL to use SmithFormAdaptive",__func__,__FILE__,__LINE__));
+	}
+
 #endif
 
 	/* Compute the local smith form at prime p
 	*/
 	template <class Matrix>
-	void SmithFormAdaptive::compute_local (std::vector<integer>& s, const Matrix& A, long p, long e) {
+	void SmithFormAdaptive::compute_local (std::vector<integer>& s, const Matrix& A, long p, long e)
+	{
 
 		linbox_check ((p > 0) && ( e >= 0));
 		integer m = 1; int i = 0; for ( i = 0; i < e; ++ i) m *= p;
-		if (((p == 2) && (e <= 32)) || (m <= PIRModular<int32>::getMaxModulus()))
+		if (((p == 2) && (e <= 32)) || (m <= FieldTraits<PIRModular<int32_t> >::maxModulus()))
 			compute_local_long (s, A, p, e);
 		else
 			compute_local_big (s, A, p, e);
 
-		// nomralize the answer
+		// normalize the answer
 		for (std::vector<integer>::iterator p = s. begin(); p != s. end(); ++ p)
 			*p = gcd (*p, m);
 	}
@@ -179,7 +207,8 @@ namespace LinBox {
 	 * r >= 2;
 	 */
 	template <class Matrix>
-	void SmithFormAdaptive::smithFormSmooth (std::vector<integer>& s, const Matrix& A, long r, const std::vector<long>& sev) {
+	void SmithFormAdaptive::smithFormSmooth (std::vector<integer>& s, const Matrix& A, long r, const std::vector<long>& sev)
+	{
 		//....
 		std::ostream& report = commentator.report (Commentator::LEVEL_IMPORTANT, PROGRESS_REPORT);
 		report << "Computation the k-smooth part of the invariant factors starts(via local and rank):" << std::endl;
@@ -197,6 +226,7 @@ namespace LinBox {
 		for (sev_p = sev. begin(), prime_p = prime; sev_p != sev. begin() + NPrime; ++ sev_p, ++ prime_p) {
 			int extra = 1;
 			do {
+
 				if ((*prime_p == 2) && (*sev_p < 32)) extra = 32 - *sev_p;
 				integer m = 1;
 				for (int i = 0; i < *sev_p + extra; ++ i) m *= * prime_p;
@@ -208,38 +238,38 @@ namespace LinBox {
 				report << "no. \n";
 				extra *= 2;
 			} while (true);
-			for (s_p = s. begin(), local_p = local. begin(); s_p != s. begin() + order; ++ s_p, ++ local_p) 
+			for (s_p = s. begin(), local_p = local. begin(); s_p != s. begin() + order; ++ s_p, ++ local_p)
 				*s_p *= *local_p;
 		}
 		report << "Computation of the smooth part is done.\n";
-		
+
 	}
 
 
-#ifdef __LINBOX_HAVE_NTL			
+#ifdef __LINBOX_HAVE_NTL
 	/* Compute the k-rough part of the invariant factor, where k = 100.
 	 * By EGV+ algorithm or Iliopoulos' algorithm for Smith form.
-	*/
+	 */
 	template <class Matrix>
-	void SmithFormAdaptive::smithFormRough  (std::vector<integer>& s, const Matrix& A, integer m) {
+	void SmithFormAdaptive::smithFormRough  (std::vector<integer>& s, const Matrix& A, integer m)
+	{
 
 		std::ostream& report = commentator.report (Commentator::LEVEL_IMPORTANT, PROGRESS_REPORT);
 		report << "Compuation of the k-rough part f the invariant factors starts(via EGV+ or Iliopolous):\n";
 		int order = A. rowdim() < A. coldim() ? A. rowdim() : A. coldim();
 		integer T; T = order; T <<= 20; T = pow (T, (int) sqrt((double)order));
 		linbox_check ((s. size() >= (unsigned long)order) && (m > 0));
-		if (m == 1) 
+		if (m == 1)
 			report << "   Not rough part." << std::endl;
-		else if ( m <=  PIRModular<int32>::getMaxModulus() ) {
+		else if ( m <=  FieldTraits< PIRModular<int32_t> >::maxModulus() ) {
 			report << "    Elimination starts:\n";
-			PIRModular<int32> R (m);
-			DenseMatrix<PIRModular<int32> >* A_ilio;
+			PIRModular<int32_t> R (m);
+			DenseMatrix<PIRModular<int32_t> > A_ilio(R, A.rowdim(), A.coldim());
 			MatrixHom::map (A_ilio, A, R);
-			SmithFormIliopoulos::smithFormIn (*A_ilio);
+			SmithFormIliopoulos::smithFormIn (A_ilio);
 			int i; std::vector<integer>::iterator s_p;
 			for (i = 0, s_p = s. begin(); s_p != s. begin() + order; ++ i, ++ s_p)
-				R. convert(*s_p, (*A_ilio) [i][i]);
-			delete A_ilio;
+				R. convert(*s_p, A_ilio[i][i]);
 			report << "    Elimination ends.\n";
 		}
 		// else if bisection possible
@@ -248,7 +278,7 @@ namespace LinBox {
 			typedef Modular<int> Field;
 			typedef typename Matrix::Field Ring;
 			typedef RationalSolverAdaptive Solver;
-		   	typedef LastInvariantFactor<Ring, Solver> LIF;
+			typedef LastInvariantFactor<Ring, Solver> LIF;
 			typedef OneInvariantFactor<Ring, LIF, SCompose, RandomMatrix>  OIF;
 			SmithFormBinary<Ring, OIF, MatrixRank<Ring, Field > > sf;;
 			sf. setOIFThreshold (2);
@@ -265,17 +295,22 @@ namespace LinBox {
 		else {
 			report << "    Elimination start:\n";
 			PIR_ntl_ZZ_p R (m);
-			DenseMatrix<PIR_ntl_ZZ_p>* A_ilio;
+			DenseMatrix<PIR_ntl_ZZ_p> A_ilio(R, A.rowdim(), A.coldim());
 			MatrixHom::map (A_ilio, A, R);
-			SmithFormIliopoulos::smithFormIn (*A_ilio);
+			SmithFormIliopoulos::smithFormIn (A_ilio);
 			int i; std::vector<integer>::iterator s_p;
 			for (i = 0, s_p = s. begin(); s_p != s. begin() + order; ++ i, ++ s_p)
-				R. convert(*s_p, (*A_ilio) [i][i]);
-			delete A_ilio;
+				R. convert(*s_p, A_ilio[i][i]);
 			report << "    Elimination ends.\n";
 		}
 		report << "Compuation of the k-rough part of the invariant factors finishes.\n";
 	}
+#else
+	template <class Matrix>
+	void SmithFormAdaptive::smithFormRough  (std::vector<integer>& s, const Matrix& A, integer m)
+	{
+		throw(LinBoxError("you need NTL to use SmithFormAdaptive",__func__,__FILE__,__LINE__));
+	}
 #endif
 
 	/* Compute the Smith form via valence algorithms
@@ -283,7 +318,8 @@ namespace LinBox {
 	 * r >= 2;
 	 */
 	template <class Matrix>
-	void SmithFormAdaptive::smithFormVal (std::vector<integer>&s, const Matrix& A, long r, const std::vector<long>& sev){
+	void SmithFormAdaptive::smithFormVal (std::vector<integer>&s, const Matrix& A, long r, const std::vector<long>& sev)
+	{
 		//....
 		std::ostream& report = commentator.report (Commentator::LEVEL_IMPORTANT, PROGRESS_REPORT);
 		report << "Computation the local smith form at each possible prime:\n";
@@ -305,7 +341,8 @@ namespace LinBox {
 			if (*prime_p == 2) extra = 32;
 			else {
 				// cheating here, try to use the max word size modular
-				extra = (int)(floor(log((double)PIRModular<int32>::getMaxModulus() - 1) / log (double(*prime_p))));
+				double log_max_mod = log((double) FieldTraits<PIRModular<int32_t> >:: maxModulus() - 1) ;
+				extra = (int)(floor(log_max_mod / log (double(*prime_p))));
 			}
 			do {
 				integer m = 1;
@@ -318,21 +355,23 @@ namespace LinBox {
 				report << "no. \n";
 				extra *= 2;
 			} while (true);
-			for (s_p = s. begin(), local_p = local. begin(); s_p != s. begin() + order; ++ s_p, ++ local_p) 
+			for (s_p = s. begin(), local_p = local. begin(); s_p != s. begin() + order; ++ s_p, ++ local_p)
 				*s_p *= *local_p;
 		}
 		report << "Computation of the smith form done.\n";
-		
+
 	}
+
 	/* Compute the Smith form of a dense matrix
-	 * By adaptive algorithm. 
-	 * Compute the valence possible, or valence is rough, 
+	 * By adaptive algorithm.
+	 * Compute the valence possible, or valence is rough,
 	 * Otherwise, compute the largest invariant factor,
 	 * then based on that, compute the rough and smooth part, seperately.
 	 */
 	template <class Matrix>
-	void SmithFormAdaptive::smithForm (std::vector<integer>& s, const Matrix& A) {
-	 	//commentator.start ("Smith Form starts", "Smihtform");
+	void SmithFormAdaptive::smithForm (std::vector<integer>& s, const Matrix& A)
+	{
+		//commentator.start ("Smith Form starts", "Smithform");
 
 		std::ostream& report = commentator.report (Commentator::LEVEL_IMPORTANT, PROGRESS_REPORT);
 		report << "Computation of the invariant factors starts (via an adaptive alg):" << std::endl;
@@ -341,7 +380,7 @@ namespace LinBox {
 		int order = A. rowdim() < A. coldim() ? A. rowdim() : A. coldim();
 		report << "Computation of the rank starts:\n";
 		typedef typename Matrix::Field Ring;
-		unsigned long r; 
+		unsigned long r;
 		MatrixRank<Ring, Modular<int> > MR;
 		r = MR. rank (A);
 		report << "   Matrix rank over a random prime field: " << r << '\n';
@@ -352,12 +391,11 @@ namespace LinBox {
 		report <<"   Compute the degree of min poly of AA^T: \n";
 		typedef Modular<int> Field;
 		integer Val; Field::Element v; unsigned long degree;
-		typename MatrixHomTrait<Matrix, Field>::value_type* Ap;
-		RandomPrimeIterator rg ((int)(log( (double)(Field::getMaxModulus()) ) / M_LN2 - 2));
-		Field F (*rg); 
+		RandomPrimeIterator rg ((int)(log( (double)(FieldTraits<Field>::maxModulus()) ) /  M_LN2 - 2));
+		Field F (*rg);
+		typename MatrixHomTrait<Matrix, Field>::value_type Ap(F, A.rowdim(), A.coldim());
 		MatrixHom::map (Ap, A, F);
-		Valence::one_valence (v, degree, *Ap);
-		delete Ap;
+		Valence::one_valence (v, degree, Ap);
 		report <<"   Degree of minimal polynomial of AA^T = " << degree << '\n';
 		// if degree is small
 		if (degree < sqrt(double(order))) {
@@ -379,22 +417,23 @@ namespace LinBox {
 				report << "Computation of the invariant factors ends." << std::endl;
 				return;
 			}
-			else 
+			else
 				report << "   Valence is rough.\n";
 		}
-			
+
 		report << "Computation of the largest invariant factor with bonus starts:\n";
 		typedef RationalSolverAdaptive Solver;
-	    typedef LastInvariantFactor<Ring, Solver> LIF;
+		typedef LastInvariantFactor<Ring, Solver> LIF;
 		typedef OneInvariantFactor<Ring, LIF, SCompose, RandomMatrix>  OIF;
 		OIF oif; oif. setThreshold  (4); oif.getLastInvariantFactor().setThreshold (6);
 		typename Ring::Element _lif, _bonus; integer lif, bonus;
 		//Chnage A to DenseMatrix
-		DenseMatrix<Ring>* DA; Ring R(A. field());
+		Ring R(A. field());
+		DenseMatrix<Ring> DA(R,A.rowdim(),A.coldim());
 		MatrixHom::map (DA, A, R);
 		do {
-			oif. oneInvariantFactor_Bonus (_lif, _bonus, *DA, (int)r);
-		
+			oif. oneInvariantFactor_Bonus (_lif, _bonus, DA, (int)r);
+
 			A. field(). convert (lif, _lif); A. field(). convert (bonus, _bonus);
 			//oif. oneInvariantFactor (bonus, A, (int)r);
 			report << "   The largest invariant factor: " << lif << std::endl;
@@ -413,42 +452,44 @@ namespace LinBox {
 		// bonus assigns to its rough part
 		bonus = gcd (bonus, r_mod);
 		std::vector<integer> smooth (order), rough (order);
-		smithFormRough (rough, *DA, bonus); delete DA;
-		smithFormSmooth (smooth, A, r, e); 
+		smithFormRough (rough, DA, bonus);
+		smithFormSmooth (smooth, A, r, e);
 		//fixed the rough largest invariant factor
 		if (r > 0) rough[r-1] = r_mod;
 
 		std::vector<integer>::iterator s_p, rough_p, smooth_p;
 
 		/*
-		report << "Smooth part\n";
-		for (smooth_p = smooth. begin(); smooth_p != smooth. end(); ++ smooth_p)
-			report<< *smooth_p << ' ';
-		report<< '\n';
-		report<<"Rough part\n";
-		for (rough_p = rough. begin(); rough_p != rough. begin() + r; ++ rough_p)
-			report<< *rough_p << ' ';
-		report<< '\n';
-		*/
+		   report << "Smooth part\n";
+		   for (smooth_p = smooth. begin(); smooth_p != smooth. end(); ++ smooth_p)
+		   report<< *smooth_p << ' ';
+		   report<< '\n';
+		   report<<"Rough part\n";
+		   for (rough_p = rough. begin(); rough_p != rough. begin() + r; ++ rough_p)
+		   report<< *rough_p << ' ';
+		   report<< '\n';
+		   */
 
-		for (rough_p = rough. begin(); rough_p != rough. begin() + r; ++ rough_p) 
+		for (rough_p = rough. begin(); rough_p != rough. begin() + r; ++ rough_p)
 			if (* rough_p == 0) *rough_p = bonus;
 
-		for (s_p = s. begin(), smooth_p = smooth. begin (), rough_p = rough. begin(); s_p != s. begin() + order; ++s_p, ++ smooth_p, ++ rough_p) 
+		for (s_p = s. begin(), smooth_p = smooth. begin (), rough_p = rough. begin(); s_p != s. begin() + order; ++s_p, ++ smooth_p, ++ rough_p)
 			*s_p = *smooth_p * *rough_p;
 
 		report << "Computation of the invariant factors ends." << std::endl;
 		//commentator. stop ("done", NULL, "Smithform");
 	}
+
 	/* Compute the Smith form of a dense matrix
-	 * By adaptive algorithm. 
-	 * Compute the valence possible, or valence is rough, 
+	 * By adaptive algorithm.
+	 * Compute the valence possible, or valence is rough,
 	 * Otherwise, compute the largest invariant factor,
 	 * then based on that, compute the rough and smooth part, seperately.
 	 */
 	template <class IRing>
-	void SmithFormAdaptive::smithForm (std::vector<integer>& s, const DenseMatrix<IRing>& A) {
-	 	//commentator.start ("Smith Form starts", "Smithform");
+	void SmithFormAdaptive::smithForm (std::vector<integer>& s, const DenseMatrix<IRing>& A)
+	{
+		//commentator.start ("Smith Form starts", "Smithform");
 
 		std::ostream& report = commentator.report (Commentator::LEVEL_IMPORTANT, PROGRESS_REPORT);
 		report << "Computation of the invariant factors starts (via an adaptive alg):" << std::endl;
@@ -457,7 +498,7 @@ namespace LinBox {
 		int order = A. rowdim() < A. coldim() ? A. rowdim() : A. coldim();
 		report << "Computation of the rank starts:\n";
 		typedef typename DenseMatrix<IRing>::Field Ring;
-		unsigned long r; 
+		unsigned long r;
 		MatrixRank<Ring, Modular<int> > MR;
 		r = MR. rank (A);
 		report << "   Matrix rank over a random prime field: " << r << '\n';
@@ -468,11 +509,11 @@ namespace LinBox {
 		report <<"   Compute the degree of min poly of AA^T: \n";
 		typedef Modular<int> Field;
 		integer Val; Field::Element v; unsigned long degree;
-		typename MatrixHomTrait<DenseMatrix<IRing>, Field>::value_type* Ap;
-		RandomPrimeIterator rg ((int)(log( (double)(Field::getMaxModulus()) ) / M_LN2 - 2));
-		Field F (*rg); MatrixHom::map (Ap, A, F);
-		Valence::one_valence (v, degree, *Ap);
-		delete Ap;
+		RandomPrimeIterator rg ((int)(log( (double)(FieldTraits<Field>::maxModulus()) ) / M_LN2 - 2));
+		Field F (*rg);
+		typename MatrixHomTrait<DenseMatrix<IRing>, Field>::value_type Ap(F,A.rowdim(),A.coldim());
+		MatrixHom::map (Ap, A, F);
+		Valence::one_valence (v, degree, Ap);
 		report <<"   Degree of minial polynomial of AA^T = " << degree << '\n';
 		// if degree is small
 		if (degree < sqrt(double(order))) {
@@ -494,13 +535,13 @@ namespace LinBox {
 				report << "Computation of the invariant factors ends." << std::endl;
 				return;
 			}
-			else 
+			else
 				report << "   Valence is rough.\n";
 		}
-			
+
 		report << "Computation of the largest invariant factor with bonus starts:\n";
 		typedef RationalSolverAdaptive Solver;
-	    typedef LastInvariantFactor<Ring, Solver> LIF;
+		typedef LastInvariantFactor<Ring, Solver> LIF;
 		typedef OneInvariantFactor<Ring, LIF, SCompose, RandomMatrix>  OIF;
 		OIF oif; oif. setThreshold  (10); oif.getLastInvariantFactor().setThreshold (6);
 		typename Ring::Element _lif, _bonus; integer lif, bonus;
@@ -527,26 +568,26 @@ namespace LinBox {
 		std::vector<integer> smooth (order), rough (order);
 		smithFormSmooth (smooth, A, r, e);
 		smithFormRough (rough, A, bonus);
-		//fixed the rough largest invariant factor
+		// fixed the rough largest invariant factor
 		if (r > 0) rough[r-1] = r_mod;
 
 		std::vector<integer>::iterator s_p, rough_p, smooth_p;
 
 		/*
-		report << "Smooth part\n";
-		for (smooth_p = smooth. begin(); smooth_p != smooth. end(); ++ smooth_p)
-			report<< *smooth_p << ' ';
-		report<< '\n';
-		report<<"Rough part\n";
-		for (rough_p = rough. begin(); rough_p != rough. begin() + r; ++ rough_p)
-			report<< *rough_p << ' ';
-		report<< '\n';
-		*/
+		   report << "Smooth part\n";
+		   for (smooth_p = smooth. begin(); smooth_p != smooth. end(); ++ smooth_p)
+		   report<< *smooth_p << ' ';
+		   report<< '\n';
+		   report<<"Rough part\n";
+		   for (rough_p = rough. begin(); rough_p != rough. begin() + r; ++ rough_p)
+		   report<< *rough_p << ' ';
+		   report<< '\n';
+		   */
 
-		for (rough_p = rough. begin(); rough_p != rough. begin() + r; ++ rough_p) 
+		for (rough_p = rough. begin(); rough_p != rough. begin() + r; ++ rough_p)
 			if (* rough_p == 0) *rough_p = bonus;
 
-		for (s_p = s. begin(), smooth_p = smooth. begin (), rough_p = rough. begin(); s_p != s. begin() + order; ++s_p, ++ smooth_p, ++ rough_p) 
+		for (s_p = s. begin(), smooth_p = smooth. begin (), rough_p = rough. begin(); s_p != s. begin() + order; ++s_p, ++ smooth_p, ++ rough_p)
 			*s_p = *smooth_p * *rough_p;
 
 		report << "Computation of the invariant factors ends." << std::endl;
@@ -554,4 +595,5 @@ namespace LinBox {
 	}
 }
 
-#endif
+#endif //__LINBOX_smith_form_adaptive_INL
+
diff --git a/linbox/algorithms/smith-form-binary.h b/linbox/algorithms/smith-form-binary.h
old mode 100755
new mode 100644
index 2ea2ecc..2279987
--- a/linbox/algorithms/smith-form-binary.h
+++ b/linbox/algorithms/smith-form-binary.h
@@ -1,97 +1,125 @@
-/* File: smith.h
- *  Author: Zhendong Wan
+/* -*- 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
+/* Copyright (C)  LinBox
+ * Written by Zhendong Wan
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_smith_form_binary_H
+#define __LINBOX_smith_form_binary_H
+
+/*! @file algorithms/smith-form-binary.h
  *  Implementation of EGV and EGV+ algorithm
  */
 
-#ifndef __LINBOX__SMITH_FORM_BINARY_H__
-#define __LINBOX__SMITH_FORM_BINARY_H__
 
 #include <linbox/util/debug.h>
 #include <linbox/algorithms/default.h>
 #include <linbox/util/commentator.h>
 
-namespace LinBox {
-	
- /** \brief Compute Smith form.  
-  *
-  * This is an implementation of EGV and EGV+ algorithms
-  * See EGV (FOCS '00) and SW (ISSAC '04) papers.
-  */
-	template <class _Ring,
-		  class _oneInvariantFactor,
-		  class _Rank>
-		
-		class SmithFormBinary {
-			
-		public:
-		
+namespace LinBox
+{
+
+	/** \brief Compute Smith form.
+	 *
+	 * This is an implementation of EGV and EGV+ algorithms
+	 * See EGV (FOCS '00) and SW (ISSAC '04) papers.
+	 */
+	template<class _Ring, class _oneInvariantFactor, class _Rank>
+	class SmithFormBinary {
+
+	public:
+
 		typedef _Ring Ring;
-		
+
 		typedef _oneInvariantFactor oneInvariantFactor;
-		
-		typedef _Rank Rank;		
-		
+
+		typedef _Rank Rank;
+
 		typedef typename Ring::Element Integer;
 
-		protected:
-		
+	protected:
+
 		oneInvariantFactor oif;
 		Rank rank;
 		Ring r;
 
-		public:
-		
+	public:
+
 		/** \brief constructor
-		 */
+		*/
 		SmithFormBinary(const oneInvariantFactor& _oif =oneInvariantFactor(),
-			  const Rank& _rank =Rank(), const Ring& _r = Ring(),
-			  int _oifthreshold =DEFAULTOIFTHRESHOLD, int _lifthreshold =DEFAULTLIFTHRESHOLD)
-			
-			: oif(_oif),rank(_rank),r(_r) { 
-			
+				const Rank& _rank =Rank(),
+				const Ring& _r = Ring(),
+				int _oifthreshold =DEFAULTOIFTHRESHOLD,
+				int _lifthreshold =DEFAULTLIFTHRESHOLD) :
+			oif(_oif),rank(_rank),r(_r)
+		{
+
 			oif.setThreshold(_oifthreshold);
 			oif.getLastInvariantFactor().setThreshold( _lifthreshold);
 		}
-			
-		void setOIFThreshold (int _oifthreshold =DEFAULTOIFTHRESHOLD) {
+
+		void setOIFThreshold (int _oifthreshold =DEFAULTOIFTHRESHOLD)
+		{
 			oif.setThreshold(_oifthreshold);
 		}
-		
-		void setLIFThreshold (int _lifthreshold =DEFAULTLIFTHRESHOLD) {
+
+		void setLIFThreshold (int _lifthreshold =DEFAULTLIFTHRESHOLD)
+		{
 			oif.getLastInvariantFactor().setThreshold(_lifthreshold);
 		}
-		
-		int getOIFThreshold() const {
+
+		int getOIFThreshold() const
+		{
 			return oif.getThreshold();
 		}
-		
-		int getLIFThreshold() const {
+
+		int getLIFThreshold() const
+		{
 			return oif.getLastInvariantFactor().getlIFThreshold();
 		}
-		
-		
+
+
 		/** \brief compute the Smith Form of an integer matrix,
 		 *  ignoring these factors of primes in PrimeL
 		 */
 		template<class IMatrix, class Vector, class VectorP>
-			Vector&  smithForm(Vector& sf, const IMatrix& A, const VectorP& PrimeL) const{
-				
+		Vector&  smithForm(Vector& sf, const IMatrix& A, const VectorP& PrimeL) const
+		{
+
 			// check if there are enough spaces in sf to store all invariant factors of A
 			linbox_check(sf.size() >= (A.rowdim() <= A.coldim() ? A.rowdim() : A.coldim()));
-			
+
 			std::ostream& report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-	
+
 			typename Vector::iterator p;
 
 			Integer zero;
-				
+
 			long Ar = rank.rank(A);
 
 
 			report << "Rank = " << Ar <<'\n';
 
 			r.init (zero,0);
-				
+
 			// set k-th invariant factor to zero for all k > Ar
 			for (p = sf.begin() + Ar; p!= sf.end(); ++p)
 				r.assign(*p,zero);
@@ -110,12 +138,12 @@ namespace LinBox {
 				}
 
 				report <<"]\n";
-					
-					
+
+
 				return sf;
 			}
-				
-			
+
+
 			// compute first invariant factor of A
 			firstInvariantFactor(sf[0], A, PrimeL);
 
@@ -127,7 +155,7 @@ namespace LinBox {
 
 			// if rank(A) == 1
 			if (Ar == 1) {
-				
+
 				report << "Smith Form:[ ";
 
 				for (p = sf.begin(); p != sf.end(); ++ p) {
@@ -138,67 +166,69 @@ namespace LinBox {
 				}
 
 				report <<"]\n" << std::flush;
-				
+
 				return sf;
 			}
 
-				
+
 			oif.oneInvariantFactor(sf[Ar - 1], A, Ar, PrimeL);
-			
+
 			report << "Biggest invariant factor = ";
-			
+
 			r. write (report, sf[Ar - 1]);
 
 			report << '\n' << std::flush;
-				
+
 			// binary search smith form
 			smithFormBinarySearch (sf, A, 1, Ar, PrimeL);
-			
+
 			report << "Smith Form:[ ";
 
 			for (p = sf.begin(); p != sf.end(); ++ p) {
-				
+
 				r. write (report, *p);
-				
+
 				report << ' ';
 			}
-			
+
 			report << "]\n" << std::flush;
-			
+
 			return sf;
 		}
 
-			
+
 		/** \brief compute the Smith Form of an integer matrix
-		 */
+		*/
 		template<class IMatrix, class Vector>
-			Vector&  smithFormBinary(Vector& sf, const IMatrix& A) const{
+		Vector&  smithFormBinary(Vector& sf, const IMatrix& A) const
+		{
 
 			std::vector<Integer> empty_v;
-				
+
 			smithForm (sf, A, empty_v);
 
 			return sf;
 
 		}
 
-		protected:			
+	protected:
 
 		/** \brief compute the 1st invariant factor, = GCD (all element in A),
 		 *  missing these factors of primes in PrimeL
 		 */
 		template<class IMatrix, class Vector>
-			Integer& firstInvariantFactor(Integer& fif, const IMatrix& A, const Vector& PrimeL) const {
+		Integer& firstInvariantFactor(Integer& fif, const IMatrix& A, const Vector& PrimeL) const
+		{
+
+			r.init(fif,0);
 
-			r.init(fif,0);			
-				
 			typename IMatrix::ConstRawIterator A_p;
 
 			for (A_p = A.rawBegin(); A_p != A.rawEnd(); ++ A_p) {
-				
+
 				if (!r.isZero(*A_p)) {
 					r.gcd(fif, fif, *A_p);
-					
+
 					// if tmp == 1, break
 					if (r.isOne(fif)) return fif;
 				}
@@ -210,26 +240,26 @@ namespace LinBox {
 			Integer p, quo, rem;
 
 			typename Vector::const_iterator Prime_p;
-			       
+
 			// filter out primes in PRIME from lif
 			for ( Prime_p = PrimeL.begin(); Prime_p != PrimeL.end(); ++ Prime_p) {
-					
+
 				r.init (p, *Prime_p);
-					
+
 				do {
 					r.quoRem(quo,rem,fif,p);
-							
+
 					if (r.isZero( rem )) r.assign(fif,quo);
 					else break;
 				}
 				while (true);
 
-			}												
-				
+			}
+
 			return fif;
-				
+
 		}
-		
+
 
 		/** \brief Binary search invariant factors between i and j, missing those factors in PrimeL
 		 *  suppose sf[i - 1], sf [j - 1] are ith and jth invariant factor of A
@@ -237,18 +267,19 @@ namespace LinBox {
 		 */
 
 		template<class IMatrix, class Vector, class VectorP>
-			Vector& smithFormBinarySearch (Vector& sf, const IMatrix& A, int i, int j, const VectorP& PrimeL) const {
+		Vector& smithFormBinarySearch (Vector& sf, const IMatrix& A, int i, int j, const VectorP& PrimeL) const
+		{
 
 
 			std::ostream& report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-			
+
 			report << "Binary Search invariant factors [" << i << ", "<< j << "]\n " << std::flush;
-				
+
 			typename Vector::iterator p;
 
 			// if no invariant factor between i and j
 			if (j <= i + 1) return sf;
-			
+
 			// if i-th invariant factor == j-th invariant factor
 			if (r.areEqual(sf[i - 1], sf[j - 1])) {
 				for (p = sf.begin() + i; p != sf.begin() + (j -1); ++ p)
@@ -260,7 +291,7 @@ namespace LinBox {
 
 			report << "Start to compute " << mid << "-th invariant factor:\n" << std::flush;
 
-			
+
 			oif.oneInvariantFactor (sf[mid - 1], A, mid, PrimeL);
 
 
@@ -274,35 +305,36 @@ namespace LinBox {
 
 			// recurseively binary search all k-invariant factors, where mid <= k < j
 			smithFormBinarySearch (sf, A, mid, j, PrimeL);
-			
+
 			return sf;
 		}
 
 
-		public:
+	public:
 		/** \brief compute the Smith Form of an integer matrix,
 		 *  ignoring these factors of primes in PrimeL
 		 *  Using backward search descibed by B. D. Saunders.
 		 */
 		template<class IMatrix, class Vector, class VectorP>
-			Vector&  smithFormBackward(Vector& sf, const IMatrix& A, const VectorP& PrimeL) const{
-				
+		Vector&  smithFormBackward(Vector& sf, const IMatrix& A, const VectorP& PrimeL) const
+		{
+
 			// check if there are enough spaces in sf to store all invariant factors of A
 			linbox_check(sf.size() >= (A.rowdim() <= A.coldim() ? A.rowdim() : A.coldim()));
-			
+
 			std::ostream& report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-	
+
 			typename Vector::iterator p;
 
 			Integer zero;
-				
+
 			long Ar = rank.rank(A);
 
 
 			report << "Rank = " << Ar <<'\n';
 
 			r.init (zero,0);
-				
+
 			// set k-th invariant factor to zero for all k > Ar
 			for (p = sf.begin() + Ar; p!= sf.end(); ++p)
 				r.assign(*p,zero);
@@ -321,12 +353,12 @@ namespace LinBox {
 				}
 
 				report <<"]\n";
-					
-					
+
+
 				return sf;
 			}
-				
-			
+
+
 			// compute first invariant factor of A
 			firstInvariantFactor(sf[0], A, PrimeL);
 
@@ -338,7 +370,7 @@ namespace LinBox {
 
 			// if rank(A) == 1
 			if (Ar == 1) {
-				
+
 				report << "Smith Form:[ ";
 
 				for (p = sf.begin(); p != sf.end(); ++ p) {
@@ -349,52 +381,53 @@ namespace LinBox {
 				}
 
 				report <<"]\n" << std::flush;
-				
+
 				return sf;
 			}
 
-				
+
 			oif.oneInvariantFactor(sf[Ar - 1], A, Ar, PrimeL);
-			
+
 			report << "Biggest invariant factor = ";
-			
+
 			r. write (report, sf[Ar - 1]);
 
 			report << '\n' << std::flush;
-				
+
 			// binary search smith form
 			smithFormBinarySearchBackward (sf, A, 1, Ar, 1, PrimeL);
-			
+
 			report << "Smith Form:[ ";
 
 			for (p = sf.begin(); p != sf.end(); ++ p) {
-				
+
 				r. write (report, *p);
-				
+
 				report << ' ';
 			}
-			
+
 			report << "]\n" << std::flush;
-			
+
 			return sf;
 		}
 
-			
+
 		/** \brief compute the Smith Form of an integer matrix
-		  * Using backward binary search.
+		 * Using backward binary search.
 		 */
 		template<class IMatrix, class Vector>
-			Vector&  smithFormBackward(Vector& sf, const IMatrix& A) const{
+		Vector&  smithFormBackward(Vector& sf, const IMatrix& A) const
+		{
 
 			std::vector<Integer> empty_v;
-				
+
 			smithFormBackward (sf, A, empty_v);
 
 			return sf;
 
 		}
 
-		protected:			
+	protected:
 
 		/** \brief Binary search invariant factors between i and j, missing those factors in PrimeL
 		 *  suppose sf[i - 1], sf [j - 1] are ith and jth invariant factor of A
@@ -402,18 +435,19 @@ namespace LinBox {
 		 */
 
 		template<class IMatrix, class Vector, class VectorP>
-			Vector& smithFormBinarySearchBackward (Vector& sf, const IMatrix& A, int i, int j, int depth, const VectorP& PrimeL) const {
+		Vector& smithFormBinarySearchBackward (Vector& sf, const IMatrix& A, int i, int j, int depth, const VectorP& PrimeL) const
+		{
 
 
 			std::ostream& report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-			
+
 			report << "Binary Search invariant factors [" << i << ", "<< j << "]\n " << std::flush;
-				
+
 			typename Vector::iterator p;
 
 			// if no invariant factor between i and j
 			if (j <= i + 1) return sf;
-			
+
 			// if i-th invariant factor == j-th invariant factor
 			if (r.areEqual(sf[i - 1], sf[j - 1])) {
 				for (p = sf.begin() + i; p != sf.begin() + (j -1); ++ p)
@@ -425,7 +459,7 @@ namespace LinBox {
 
 			report << "Start to compute " << mid << "-th invariant factor:\n" << std::flush;
 
-			
+
 			oif.oneInvariantFactor (sf[mid - 1], A, mid, PrimeL);
 
 
@@ -438,16 +472,16 @@ namespace LinBox {
 
 			if (r. areEqual (sf[mid-1], sf[j-1]))
 				smithFormBinarySearchBackward (sf, A, i, mid, 2 * depth, PrimeL);
-			else 
+			else
 				smithFormBinarySearchBackward (sf, A, i, mid, depth, PrimeL);
 
 			// recurseively binary search all k-invariant factors, where mid <= k < j
 			smithFormBinarySearchBackward (sf, A, mid, j, depth, PrimeL);
-			
+
 			return sf;
 		}
 	};
 
 }
 
-#endif 
+#endif  //__LINBOX_smith_form_binary_H
diff --git a/linbox/algorithms/smith-form-iliopoulos.h b/linbox/algorithms/smith-form-iliopoulos.h
old mode 100755
new mode 100644
index 5590605..7d4791a
--- a/linbox/algorithms/smith-form-iliopoulos.h
+++ b/linbox/algorithms/smith-form-iliopoulos.h
@@ -1,31 +1,50 @@
-/* -*- mode:C++ -*- */
-
-/* File iliopoulos-elimination.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
+/* Copyright (C) 2010 LinBox
+ *
  *  Author: Zhendong Wan
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __SMITH_FORM_ILIOPOULOS_H
-#define __SMITH_FORM_ILIOPOULOS_H
+#ifndef __LINBOX_smith_form_iliopoulos_H
+#define __LINBOX_smith_form_iliopoulos_H
 
 #include <linbox/util/debug.h>
 #include <linbox/vector/vector-domain.h>
 #include <linbox/blackbox/dense.h>
 #include <linbox/blackbox/submatrix-traits.h>
 
-namespace LinBox {
-	
-/** \brief This is Iliopoulos' algorithm do diagonalize.
+namespace LinBox
+{
+
+	/** \brief This is Iliopoulos' algorithm do diagonalize.
 
- * Compute Smith Form by elimination modulo m, for some modulus m such 
- * as S(n), the last invariant factor.  
- * The elimination method is originally described in 
- * "Worst Case Complexity Bounds on Algorithms for computing the Canonical 
- *  Structure of Finite Abelian Groups and the Hermite and Smith Normal 
- * Forms of an Integer Matrix", by Costas Iliopoulos.
-*/
+	 * Compute Smith Form by elimination modulo m, for some modulus m such
+	 * as S(n), the last invariant factor.
+	 * The elimination method is originally described in
+	 * @bib
+	 * <i>Worst Case Complexity Bounds on Algorithms for computing the Canonical
+	 *  Structure of Finite Abelian Groups and the Hermite and Smith Normal
+	 * Forms of an Integer Matrix</i>, by Costas Iliopoulos.
+	 */
 
 	class SmithFormIliopoulos{
-		
+
 
 	protected:
 		/** \brief eliminationRow will make the first row (*, 0, ..., 0)
@@ -33,37 +52,38 @@ namespace LinBox {
 		 *  It is the implementation of Iliopoulos algorithm
 		 */
 		template<class Matrix, class Ring>
-		static Matrix& eliminationRow (Matrix& A, const Ring& r) {
-						      
-			
+		static Matrix& eliminationRow (Matrix& A, const Ring& r)
+		{
+
+
 			if (A. coldim() <= 1 || A. coldim()  == 0) return A;
-			
+
 
 			//typedef typename Matrix::Field Field;
-			
+
 			typedef typename Ring::Element Element;
 
-		
+
 			VectorDomain<Ring> vd (r);
 
 			// some tempory variable
 			typename Matrix::RowIterator cur_r, tmp_r;
-			
+
 			typename Matrix::ColIterator cur_c, tmp_c;
 			typename Matrix::Row::iterator row_p1, row_p2;
 			//typename Matrix::Col::iterator col_p1, col_p2;
-			
+
 			cur_c = A. colBegin();
 
 			cur_r = A. rowBegin();
-			
+
 			row_p1 = cur_r -> begin();
-			
+
 			// if A[0][0] is coprime to d
 			if (r. isUnit( *row_p1)) {
 
 				if (! r. isOne (* row_p1)) {
-					
+
 					Element s;
 
 					r. inv (s, *row_p1);
@@ -71,27 +91,27 @@ namespace LinBox {
 					vd. mulin(*cur_c, s);
 
 				}
-				
+
 			}
-			
+
 			// A[0][0] is not a unit
 			else {
-					
+
 				// make A[0][0] = 0
 				if ( !r.isZero(*row_p1)) {
-					
+
 					row_p2 = row_p1 + 1;
-					
+
 					Element y1, y2;
 
 					Element g, s, t;
-					
+
 					r. dxgcd (g, s, t, y2, y1, *row_p1, *row_p2);
 
 					r. negin (y1);
-					
+
 					tmp_c = cur_c + 1;
-					
+
 					std::vector<Element> tmp1 (A.rowdim()), tmp2 (A.rowdim());
 
 					vd. mul (tmp1, *cur_c, y1);
@@ -113,72 +133,72 @@ namespace LinBox {
 						r. div (q, *(cur_c -> begin()), g);
 
 						r. negin (q);
-							  
+
 						vd. axpyin (*cur_c, q, *tmp_c);
 					}
 				}
-				
+
 				// matrix index is 0-based
 				std::vector<Element> tmp_v(A.coldim());
-				
+
 				typename std::vector<Element>::iterator p1, p2;
 
 				r. init(tmp_v[0], 1);
 
 				p1 = tmp_v.begin() + 1;
 				p2 = tmp_v.begin() + 1;
-				
-				row_p2 = row_p1 + 1; 
-				
+
+				row_p2 = row_p1 + 1;
+
 				Element g, s;
-				
+
 				r.assign(g, *row_p2); ++ row_p2;
-				
+
 				r.init(*p1, 1); ++ p1;
-				
+
 				for (; row_p2 != cur_r -> end(); ++ row_p2, ++ p1) {
-					
+
 					r.xgcd(g, s, *p1, g, *row_p2);
-					
+
 					if (!r.isOne(s))
-						
-						for (p2 = tmp_v.begin() + 1; p2 != p1; ++ p2) 
-							
+
+						for (p2 = tmp_v.begin() + 1; p2 != p1; ++ p2)
+
 							r. mulin (*p2, s);
-					
-						
-					
+
+
+
 				}
-				
+
 				// no pivot found
 				if (r.isZero(g)) return A;
 
-				
-				for (tmp_r = cur_r; tmp_r != A.rowEnd(); ++ tmp_r) 
-					
+
+				for (tmp_r = cur_r; tmp_r != A.rowEnd(); ++ tmp_r)
+
 					vd. dot (*(tmp_r -> begin()), *tmp_r, tmp_v);
-					
-				
+
+
 			}
-				
-			
+
+
 			// after finding the pivot
 			// column operation to make A[p][j] = 0, where k < j
 
 
 			Element g, tmp;
-			
+
 			r. assign (g, *(cur_c -> begin()));
 
 			for (tmp_c = cur_c + 1; tmp_c != A.colEnd(); ++ tmp_c) {
-							       
-				// test if needing to update 
+
+				// test if needing to update
 				if (!r. isZero (*(tmp_c -> begin()))) {
-					
+
 					r.div (tmp, *(tmp_c -> begin()), g);
-					
+
 					r.negin(tmp);
-					
+
 					vd. axpyin (*tmp_c, tmp, *cur_c);
 
 				}
@@ -187,32 +207,33 @@ namespace LinBox {
 
 			return A;
 		}
-		
 
-		
+
+
 		/** \brief eliminationCol will make the first col (*, 0, ..., 0)
 		 *  by elementary row operation.
 		 *  It is the implementation of Iliopoulos algorithm
 		 */
 		template<class Matrix, class Ring>
-		static Matrix& eliminationCol (Matrix& A, const Ring& r) {
+		static Matrix& eliminationCol (Matrix& A, const Ring& r)
+		{
 
 			if((A.rowdim() <= 1) || (A.rowdim() == 0)) return A;
-			
+
 			//typedef typename Matrix::Field Field;
 			typedef typename Ring::Element Element;
-			
+
 			//Field r (A.field());
 
 			VectorDomain<Ring> vd(r);
-			
+
 			typename Matrix::ColIterator cur_c, tmp_c;
 			typename Matrix::RowIterator cur_r, tmp_r;
-			
+
 			//typename Matrix::Row::iterator row_p1, row_p2;
 			typename Matrix::Col::iterator col_p1, col_p2;
-						
-			
+
+
 			cur_c = A.colBegin();
 			cur_r = A.rowBegin();
 
@@ -223,36 +244,36 @@ namespace LinBox {
 			if (r.isUnit (*col_p1) ) {
 
 				if (! r. isOne ( *col_p1)) {
-				
-					
+
+
 					Element s;
 
 					r. inv (s, *col_p1);
-					
+
 					vd. mulin (*cur_r, s);
-					
+
 				}
-				
+
 			}
 			else {
 				// Make A[0][0] = 0;
 				if (!r.isZero(*col_p1)) {
-					
+
 					Element g, s, t, y1, y2;
-					
+
 					std::vector<Element> tmp1(A.coldim()), tmp2(A.coldim());
-					
+
 					col_p2 = col_p1 + 1;
-					
+
 					r.dxgcd(g, s, t, y2, y1, *col_p1, *col_p2);
 
 					r. negin (y1);
-					
+
 
 					tmp_r = cur_r + 1;
-					
+
 					vd. mul (tmp1, *cur_r, y1);
-					
+
 					vd. axpyin (tmp1, y2, *tmp_r);
 
 					vd. mul (tmp2, *cur_r, s);
@@ -279,41 +300,41 @@ namespace LinBox {
 
 				// matrix index is 0-based
 				std::vector<Element> tmp_v (A.rowdim());
-					
+
 				typename std::vector<Element>::iterator p1, p2;
-				
+
 				Element g, s;
-				
+
 				col_p2 = col_p1 + 1;
-				
+
 				r.assign (g, *col_p2); ++ col_p2;
-				
+
 				r. init (tmp_v[0], 1);
-				
+
 				p1 = tmp_v.begin() + 1;
-				
+
 				r.init(*p1,1); ++ p1;
 
 				for(; col_p2 != cur_c -> end(); ++ col_p2, ++ p1) {
-					
+
 					r.xgcd (g, s, *p1, g, *col_p2);
-					
-					if (! r.isOne(s)) 
-						for (p2 = tmp_v.begin() + 1; p2 != p1; ++ p2) 
-							
+
+					if (! r.isOne(s))
+						for (p2 = tmp_v.begin() + 1; p2 != p1; ++ p2)
+
 							r. mulin (*p2, s);
 
-					
+
 				}
-				
+
 				if (r.isZero(g))  return A;
 
 				// no pivot found
-				for (tmp_c = cur_c; tmp_c != A.colEnd(); ++ tmp_c) 
-					
+				for (tmp_c = cur_c; tmp_c != A.colEnd(); ++ tmp_c)
+
 					vd. dot ( *(tmp_c -> begin()), *tmp_c, tmp_v);
-				
-			}			
+
+			}
 
 
 			// A pivot is found
@@ -321,15 +342,15 @@ namespace LinBox {
 			Element g, tmp;
 
 			r. assign (g, *( cur_r -> begin()));
-			
+
 			for (tmp_r = cur_r + 1; tmp_r != A.rowEnd(); ++ tmp_r) {
-					
+
 				if (! r.isZero(*(tmp_r -> begin() ) ) ) {
-					
+
 					r.div (tmp, *(tmp_r -> begin()), g);
-					
+
 					r.negin (tmp);
-					
+
 					vd. axpyin (*tmp_r, tmp, *cur_r);
 
 				}
@@ -341,44 +362,46 @@ namespace LinBox {
 		}
 
 		template<class Matrix, class Ring>
-		static bool check(const Matrix& A, const Ring& r) {
-				
-			
+		static bool check(const Matrix& A, const Ring& r)
+		{
+
+
 			//typedef typename Matrix::Ring Field;
 			typedef typename Ring::Element Element;
-			
+
 			typename Matrix::ConstRowIterator cur_r;
 			typename Matrix::ConstRow::const_iterator row_p;
-			
+
 			Element tmp;
-			
+
 			cur_r = A.rowBegin();
 			row_p = cur_r -> begin();
-				
+
 			tmp = * (A.rowBegin() -> begin());
-			
+
 			if (r.isZero(tmp)) return true;
 
 			for (++ row_p; row_p != cur_r -> end(); ++ row_p ) {
-				
+
 				if (!r. isDivisor (tmp, *row_p))
 
 					return false;
 			}
-			
+
 			return true;
 		}
-				
+
 		/** \brief Diagonalize the matrix A.
-		 */
+		*/
 		template<class Matrix, class Ring>
-		static Matrix& diagonalizationIn(Matrix& A, const Ring& r) {
-			
+		static Matrix& diagonalizationIn(Matrix& A, const Ring& r)
+		{
+
 			if (A.rowdim() == 0 || A.coldim() == 0) return A;
 
-			
+
 			do {
-				
+
 				eliminationRow (A, r);
 
 				eliminationCol (A, r);
@@ -386,9 +409,9 @@ namespace LinBox {
 
 			while (!check(A, r));
 
-			typename SubMatrixTraits<Matrix>::value_type 
-				sub(A, (unsigned int)1, (unsigned int)1, 
-				    A.rowdim() - 1, A.coldim() - 1);
+			typename SubMatrixTraits<Matrix>::value_type
+			sub(A, (unsigned int)1, (unsigned int)1,
+			    A.rowdim() - 1, A.coldim() - 1);
 
 			diagonalizationIn(sub, r);
 
@@ -400,45 +423,45 @@ namespace LinBox {
 
 		template<class Matrix>
 		static  Matrix& smithFormIn(Matrix& A) {
-			
+
 			typedef typename Matrix::Field Ring;
 			typedef typename Ring::Element Element;
-			
+
 			Ring r (A.field());
 
 			typename Matrix::RowIterator row_p;
-			
+
 			Element zero, one;
 
 			r. init (zero, 0);
 
 			r. init (one, 1);
-			
+
 			diagonalizationIn(A, r);
 
-			int min = A.rowdim() <= A.coldim() ? A.rowdim() : A.coldim();			
+			int min = A.rowdim() <= A.coldim() ? A.rowdim() : A.coldim();
 
 			int i, j;
-			
+
 			Element g;
-			
+
 			for (i = 0; i < min; ++ i) {
-				
+
 				for ( j = i + 1; j < min; ++ j) {
-					
+
 					if (r. isUnit(A[i][i]))  break;
-						
+
 					else if (r. isZero (A[j][j])) continue;
-					
+
 					else if (r. isZero (A[i][i])) {
 						std::swap (A[i][i], A[j][j]);
 					}
-					
+
 					else {
 						r. gcd (g, A[j][j], A[i][i]);
-						
+
 						r. divin (A[j][j], g);
-						
+
 						r. mulin (A[j][j], A[i][i]);
 
 						r. assign (A[i][i], g);
@@ -446,14 +469,15 @@ namespace LinBox {
 				}
 				r. normalIn (A[i][i]);
 			}
-			
+
 			return A;
-			
+
 		}
-		
+
 	};
-	
-	
+
+
 }
-				
-#endif	
+
+#endif //__LINBOX_smith_form_iliopoulos_H
+
diff --git a/linbox/algorithms/smith-form-local.h b/linbox/algorithms/smith-form-local.h
index 8896a26..13bb1e9 100644
--- a/linbox/algorithms/smith-form-local.h
+++ b/linbox/algorithms/smith-form-local.h
@@ -1,6 +1,7 @@
-/* -*- mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-
+/* -*- 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
 /* linbox/algorithms/localsmith.h
+ * Copyright(C) LinBox
  *
  * Written by David Saunders
  *
@@ -9,8 +10,8 @@
  * See COPYING for license information.
  */
 
-#ifndef __SMITH_FORM_LOCAL_H
-#define __SMITH_FORM_LOCAL_H
+#ifndef __LINBOX_smith_form_local_H
+#define __LINBOX_smith_form_local_H
 
 #include <vector>
 #include <list>
@@ -18,89 +19,90 @@
 
 #include "linbox/matrix/dense-submatrix.h"
 
-namespace LinBox 
+namespace LinBox
 {
 
-/** 
- \brief Smith normal form (invariant factors) of a matrix over a local ring.
+	/**
+	  \brief Smith normal form (invariant factors) of a matrix over a local ring.
 
-  The matrix must be a DenseMatrix over a LocalPID.
-  A localPID has the standard ring/field arithmetic functions plus gcdin().
+	  The matrix must be a DenseMatrix over a LocalPID.
+	  A localPID has the standard ring/field arithmetic functions plus gcdin().
 
- */
-template <class LocalPID> 
-class SmithFormLocal{
+*/
+	template <class LocalPID>
+	class SmithFormLocal{
+
+	public:
+		typedef typename LocalPID::Element Elt;
+
+		template<class Matrix>
+		std::list<Elt>& operator()(std::list<Elt>& L, Matrix& A, const LocalPID& R)
+		{
+			Elt d; R.init(d, 1);
+			return smithStep(L, d, A, R);
+		}
 
-    public:
-	typedef typename LocalPID::Element Elt;
+		template<class Matrix>
+		std::list<Elt>& smithStep(std::list<Elt>& L, Elt& d, Matrix& A, const LocalPID& R)
+		{
 
-	template<class Matrix>
-	std::list<Elt>& operator()(std::list<Elt>& L, Matrix& A, const LocalPID& R) { 
-		Elt d; R.init(d, 1);
-	    return smithStep(L, d, A, R);
-	}
+			//std::cout << "Dimension: " << A.rowdim() << " " << A.coldim() <<"\n";
+			if ( A.rowdim() == 0 || A.coldim() == 0 ) return L;
 
-	template<class Matrix>
-	std::list<Elt>& smithStep(std::list<Elt>& L, Elt& d, Matrix& A, const LocalPID& R) {
+			Elt g; R.init(g, 0);
+			typename Matrix::RowIterator p;
+			typename Matrix::Row::iterator q, r;
+			for ( p = A.rowBegin(); p != A.rowEnd(); ++p) {
 
-	    //std::cout << "Dimension: " << A.rowdim() << " " << A.coldim() <<"\n";
-	    if ( A.rowdim() == 0 || A.coldim() == 0 ) return L;
+				for (q = p->begin(); q != p->end(); ++q) {
+					R.gcdin(g, *q);
+					if ( R.isUnit(g) ) {R.divin(g, g); break; }
+				}
 
-	    Elt g; R.init(g, 0);
-	    typename Matrix::RowIterator p;
-	    typename Matrix::Row::iterator q, r;
-    	for ( p = A.rowBegin(); p != A.rowEnd(); ++p) {
+				if ( R.isUnit(g) ) break;
+			}
+
+			if ( R.isZero(g) ) {
+				L.insert(L.end(), (A.rowdim() < A.coldim()) ? A.rowdim() : A.coldim(), g);
+				return L;
+			}
 
-        	for (q = p->begin(); q != p->end(); ++q) {
-       	       	R.gcdin(g, *q);
-		    	if ( R.isUnit(g) ) break;
+			if ( p != A.rowEnd() ) // g is a unit and,
+				// because this is a local ring, value at which this first happened
+				// also is a unit.
+				{
+					if ( p != A.rowBegin() )
+						swap_ranges(A.rowBegin()->begin(), A.rowBegin()->end(), p->begin());
+					if ( q != p->begin() )
+						swap_ranges(A.colBegin()->begin(), A.colBegin()->end(), (A.colBegin() + (q - p->begin()))->begin());
+
+					// eliminate step - crude and for dense only - fix later
+					// Want to use a block method or "left looking" elimination.
+					Elt f; R.inv(f, *(A.rowBegin()->begin() ) );
+					R.negin(f);
+					// normalize first row to -1, ...
+					for ( q = A.rowBegin()->begin() /*+ 1*/; q != A.rowBegin()->end(); ++q)
+						R.mulin(*q, f);
+					//
+					// eliminate in subsequent rows
+					for ( p = A.rowBegin() + 1; p != A.rowEnd(); ++p)
+						for ( q = p->begin() + 1, r = A.rowBegin()->begin() + 1, f = *(p -> begin()); q != p->end(); ++q, ++r )
+							R.axpyin( *q, f, *r );
+
+					DenseSubmatrix<Elt> Ap(A, 1, 1, A.rowdim() - 1, A.coldim() - 1);
+					L.push_back(d);
+					return smithStep(L, d, Ap, R);
+				}
+			else  {
+				typename Matrix::RawIterator p;
+				for (p = A.rawBegin(); p != A.rawEnd(); ++p) R.divin(*p, g);
+				return smithStep(L, R.mulin(d, g), A, R);
 			}
+		}
 
-			if ( R.isUnit(g) ) break;
-	    }
-                
-	    if ( R.isZero(g) ) {
-			L.insert(L.end(), (A.rowdim() < A.coldim()) ? A.rowdim() : A.coldim(), g);
-			return L;
-	    }
-
-    	if ( p != A.rowEnd() ) // g is a unit and, 
-	    // because this is a local ring, value at which this first happened 
-	    // also is a unit.
-    	{
-	        if ( p != A.rowBegin() ) 
-		    swap_ranges(A.rowBegin()->begin(), A.rowBegin()->end(), p->begin());
-	        if ( q != p->begin() ) 
-		    swap_ranges(A.colBegin()->begin(), A.colBegin()->end(), (A.colBegin() + (q - p->begin()))->begin());
-
-	        // eliminate step - crude and for dense only - fix later
-			// Want to use a block method or "left looking" elimination.
-			//std::cout << " Value of A[0][0]: " << *(A.rowBegin() -> begin()) <<"\n";
-			Elt f; R.inv(f, *(A.rowBegin()->begin() ) );
-			R.negin(f);
-			// normalize first row to -1, ...
-	        for ( q = A.rowBegin()->begin() /*+ 1*/; q != A.rowBegin()->end(); ++q)
-	            R.mulin(*q, f);
-			//
-			// eliminate in subsequent rows
-	        for ( p = A.rowBegin() + 1; p != A.rowEnd(); ++p)
-	            for ( q = p->begin() + 1, r = A.rowBegin()->begin() + 1, f = *(p -> begin()); q != p->end(); ++q, ++r )
-		        	R.axpyin( *q, f, *r );
-
-	        DenseSubmatrix<Elt> Ap(A, 1, 1, A.rowdim() - 1, A.coldim() - 1);
-			L.push_back(d);
-	        return smithStep(L, d, Ap, R); 
-   		}
-    	else  { 
-			typename Matrix::RawIterator p;
-	        for (p = A.rawBegin(); p != A.rawEnd(); ++p) R.divin(*p, g); 
-	        	return smithStep(L, R.mulin(d, g), A, R);
-    	    }
-    	}
-
-}; // end SmithFormLocal
+	}; // end SmithFormLocal
 
 } // end LinBox
 
 #include <linbox/algorithms/smith-form-local2.h>
-#endif // __SMITH_FORM_LOCAL_H
+#endif // __LINBOX_smith_form_local_H
diff --git a/linbox/algorithms/smith-form-local2.h b/linbox/algorithms/smith-form-local2.h
index 24dd50d..d3701bb 100644
--- a/linbox/algorithms/smith-form-local2.h
+++ b/linbox/algorithms/smith-form-local2.h
@@ -1,6 +1,7 @@
-/* -*- mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-
+/* -*- 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
 /* linbox/algorithms/localsmith.h
+ * Copyright (C) LinBox
  *
  * Written by David Saunders
  *
@@ -9,8 +10,8 @@
  * See COPYING for license information.
  */
 
-#ifndef __SMITH_FORM_LOCAL2_H
-#define __SMITH_FORM_LOCAL2_H
+#ifndef __LINBOX_smith_form_local2_H
+#define __LINBOX_smith_form_local2_H
 
 
 #include <vector>
@@ -20,105 +21,101 @@
 #include "linbox/matrix/dense-submatrix.h"
 #include "linbox/field/local2_32.h"
 
-namespace LinBox 
+namespace LinBox
 {
 
-/** 
- \brief Smith normal form (invariant factors) of a matrix over a local ring.
- */
-template<class LocalRing>
-class SmithFormLocal;
- 
-template <> 
-class SmithFormLocal<Local2_32>
-{
-    public:
-	typedef Local2_32 LocalPID;
-	typedef LocalPID::Element Elt;
-
-	template<class Matrix>
-	std::list<Elt>& operator()(std::list<Elt>& L, Matrix& A, const LocalPID& R)
-	{   Elt d; R.init(d, 1);
-	    return smithStep(L, d, A, R);
-	}
-
-	template<class Matrix>
-	std::list<Elt>& 
-	smithStep(std::list<Elt>& L, Elt& d, Matrix& A, const LocalPID& R)
+	/**
+	  \brief Smith normal form (invariant factors) of a matrix over a local ring.
+	  */
+	template<class LocalRing>
+	class SmithFormLocal;
+
+	template <>
+	class SmithFormLocal<Local2_32>
 	{
-	    //std::cout << "Dimension: " << A.rowdim() << " " << A.coldim() <<"\n";
-	    if ( A.rowdim() == 0 || A.coldim() == 0 ) 
-		return L;
-
-	    //std::cout << "Matrix:\n";
-	    //A.write(std::cout);
-
-	    LocalPID::Exponent g = LocalPID::Exponent(32); //R.init(g, 0); // must change to 2^31 maybe.
-	    typename Matrix::RowIterator p;
-	    typename Matrix::Row::iterator q, r;
-    	    for ( p = A.rowBegin(); p != A.rowEnd(); ++p) 
-	    {
-                for (q = p->begin(); q != p->end(); ++q) 
+	public:
+		typedef Local2_32 LocalPID;
+		typedef LocalPID::Element Elt;
+
+		template<class Matrix>
+		std::list<Elt>& operator()(std::list<Elt>& L, Matrix& A, const LocalPID& R)
+		{   Elt d; R.init(d, 1);
+			return smithStep(L, d, A, R);
+		}
+
+		template<class Matrix>
+		std::list<Elt>&
+		smithStep(std::list<Elt>& L, Elt& d, Matrix& A, const LocalPID& R)
 		{
-       	            R.gcdin(g, *q);
-		    if ( R.isUnit(g) ) break;
+			if ( A.rowdim() == 0 || A.coldim() == 0 )
+				return L;
+
+			LocalPID::Exponent g = LocalPID::Exponent(32); //R.init(g, 0); // must change to 2^31 maybe.
+			typename Matrix::RowIterator p;
+			typename Matrix::Row::iterator q, r;
+			for ( p = A.rowBegin(); p != A.rowEnd(); ++p)
+			{
+				for (q = p->begin(); q != p->end(); ++q)
+				{
+					R.gcdin(g, *q);
+					if ( R.isUnit(g) ) break;
+				}
+				if ( R.isUnit(g) ) break;
+			}
+			//std::cout << "g = " << (int)g <<"\n";
+			if ( R.isZero(g) )
+			{
+				//  std::cout << " R.isZero(g) is used\n";
+				// std::cout << A.rowdim() << " " << A.coldim() << "\n";
+				L.insert(L.end(),
+					 (A.rowdim() < A.coldim()) ? A.rowdim() : A.coldim(),
+					 0
+					);
+				return L;
+			}
+			if ( p != A.rowEnd() ) // g is a unit and,
+				// because this is a local ring, value at which this first happened
+				// also is a unit.
+				{
+					if ( p != A.rowBegin() )
+						swap_ranges(A.rowBegin()->begin(), A.rowBegin()->end(),
+							    p->begin());
+					if ( q != p->begin() )
+						swap_ranges(A.colBegin()->begin(), A.colBegin()->end(),
+							    (A.colBegin() + (q - p->begin()))->begin());
+
+					// eliminate step - crude and for dense only - fix later
+					// Want to use a block method or "left looking" elimination.
+					//std::cout << " Value of A[0][0]: " << *(A.rowBegin() -> begin()) <<"\n";
+					Elt f; R.inv(f, *(A.rowBegin()->begin() ) );
+					R.negin(f);
+					// normalize first row to -1, ...
+					//std::cout << "f = " << f << "\n";
+					//A.write(std::cout);
+
+					for ( q = A.rowBegin()->begin() /*+ 1*/; q != A.rowBegin()->end(); ++q)
+						R.mulin(*q, f);
+					//
+					// eliminate in subsequent rows
+					for ( p = A.rowBegin() + 1; p != A.rowEnd(); ++p)
+						for ( q = p->begin() + 1, r = A.rowBegin()->begin() + 1, f = *(p -> begin());
+						      q != p->end(); ++q, ++r )
+							R.axpyin( *q, f, *r );
+
+					DenseSubmatrix<Elt> Ap(A, 1, 1, A.rowdim() - 1, A.coldim() - 1);
+					L.push_back(d);
+					return smithStep(L, d, Ap, R);
+				}
+			else
+			{
+				typename Matrix::RawIterator p;
+				for (p = A.rawBegin(); p != A.rawEnd(); ++p) R.divin(*p, g);
+				return smithStep(L, R.mulin(d, g), A, R);
+			}
 		}
-		if ( R.isUnit(g) ) break;
-	    }
-	    //std::cout << "g = " << (int)g <<"\n"; 
-	    if ( R.isZero(g) ) 
-	    {
-		  //  std::cout << " R.isZero(g) is used\n";
-		   // std::cout << A.rowdim() << " " << A.coldim() << "\n";
-		L.insert(L.end(), 
-			 (A.rowdim() < A.coldim()) ? A.rowdim() : A.coldim(),
-			 0 
-			 );
-		return L;
-	    }
-    	    if ( p != A.rowEnd() ) // g is a unit and, 
-	    // because this is a local ring, value at which this first happened 
-	    // also is a unit.
-    	    {
-	        if ( p != A.rowBegin() ) 
-		    swap_ranges(A.rowBegin()->begin(), A.rowBegin()->end(),
-				    p->begin());
-	        if ( q != p->begin() ) 
-		    swap_ranges(A.colBegin()->begin(), A.colBegin()->end(),
-				    (A.colBegin() + (q - p->begin()))->begin());
-
-	        // eliminate step - crude and for dense only - fix later
-		// Want to use a block method or "left looking" elimination.
-		//std::cout << " Value of A[0][0]: " << *(A.rowBegin() -> begin()) <<"\n";
-		Elt f; R.inv(f, *(A.rowBegin()->begin() ) );
-		R.negin(f);
-		// normalize first row to -1, ...
-		//std::cout << "f = " << f << "\n";
-		//A.write(std::cout);
-
-	        for ( q = A.rowBegin()->begin() /*+ 1*/; q != A.rowBegin()->end(); ++q) 
-	            R.mulin(*q, f);
-		//
-		// eliminate in subsequent rows
-	        for ( p = A.rowBegin() + 1; p != A.rowEnd(); ++p)
-	            for ( q = p->begin() + 1, r = A.rowBegin()->begin() + 1, f = *(p -> begin()); 
-				    q != p->end(); ++q, ++r )
-		        R.axpyin( *q, f, *r );
-
-	        DenseSubmatrix<Elt> Ap(A, 1, 1, A.rowdim() - 1, A.coldim() - 1);
-		L.push_back(d);
-	        return smithStep(L, d, Ap, R); 
-    	    }
-    	    else  
-    	    { 
-		typename Matrix::RawIterator p;
-	        for (p = A.rawBegin(); p != A.rawEnd(); ++p) R.divin(*p, g); 
-	        return smithStep(L, R.mulin(d, g), A, R);
-    	    }
-    	}
-
-}; // end SmithFormLocal
+
+	}; // end SmithFormLocal
 
 } // end LinBox
 
-#endif // _SMITH_FORM_LOCAL2_H
+#endif // __LINBOX_smith_form_local2_H
diff --git a/linbox/algorithms/smith-form-sparseelim-local.h b/linbox/algorithms/smith-form-sparseelim-local.h
index 30dfb81..a689fef 100644
--- a/linbox/algorithms/smith-form-sparseelim-local.h
+++ b/linbox/algorithms/smith-form-sparseelim-local.h
@@ -1,428 +1,484 @@
-#ifndef __LINBOX_PP_GAUSS_H__
-#define __LINBOX_PP_GAUSS_H__
-// ========================================================================= //
-// (C) Givaro Team 1999
-// Time-stamp: <30 Mar 06 17:47:04 Jean-Guillaume.Dumas at imag.fr> 
-// ========================================================================= //
+/* -*- 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
+/* Copyright (C) Givaro Team 1999
+ * Copyright (C) LinBox
+ * Written by JG Dumas
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __LINBOX_pp_gauss_H
+#define __LINBOX_pp_gauss_H
 
 #include <map>
+#include <givaro/givconfig.h> // for Signed_Trait
 #include <linbox/algorithms/gauss.h>
 
-namespace LinBox 
+namespace LinBox
 {
-  
-//     template<class T, template <class X> class Container>
-//     std::ostream& operator<< (std::ostream& o, const Container<T>& C) {
-//         for(typename Container<T>::const_iterator refs =  C.begin();
-//             refs != C.end() ;
-//             ++refs )
-//             o << (*refs) << " " ;
-//         return o << std::endl;
-//     }
- 
-/** \brief Repository of functions for rank modulo a prime power by elimination 
-    on sparse matrices.
-*/
-    template <class _Field>
-    class PowerGaussDomain : public GaussDomain<_Field> {
-        typedef GaussDomain<_Field> Father_t;
-        typedef _Field Field;
-        typedef typename Field::Element Element;
-    public:
-
-            /** \brief The field parameter is the domain 
-             * over which to perform computations
-             */
-	PowerGaussDomain (const Field &F) : Father_t(F) {}
-
-            //Copy constructor
-            /// 
-	PowerGaussDomain (const PowerGaussDomain &M) : Father_t(M) {}
-
-
-        
-            // --------------------------------------------
-            // Modulo operators
-        template<class Modulu>
-        bool isNZero(const Modulu& a ) { return (bool)a ;}
-        
+
+#if 0
+	template<class T, template <class X> class Container>
+	std::ostream& operator<< (std::ostream& o, const Container<T>& C) {
+		for(typename Container<T>::const_iterator refs =  C.begin();
+		    refs != C.end() ;
+		    ++refs )
+			o << (*refs) << " " ;
+		return o << std::endl;
+	}
+#endif
+
+	/** \brief Repository of functions for rank modulo a prime power by elimination
+	  on sparse matrices.
+	  */
+	template <class _Field>
+	class PowerGaussDomain : public GaussDomain<_Field> {
+		typedef GaussDomain<_Field> Father_t;
+		typedef _Field Field;
+		typedef typename Field::Element Element;
+	public:
+
+		/** \brief The field parameter is the domain
+		 * over which to perform computations
+		 */
+		PowerGaussDomain (const Field &F) :
+			Father_t(F)
+		{}
+
+		//Copy constructor
+		///
+		PowerGaussDomain (const PowerGaussDomain &M) :
+			Father_t(M)
+		{}
+
+
+
+		// --------------------------------------------
+		// Modulo operators
+		template<class Modulu>
+		bool isNZero(const Modulu& a ) { return (bool)a ;}
+
 #ifdef GIVARO_PRANK_OUT
 #ifndef GIVARO_JRANK_OUT
 #define GIVARO_JRANK_OUT
 #endif
 #endif
 
-        
-        template<class Ring>
-        Ring MY_Zpz_bezout(Ring a, Ring b, Ring& u)
-            {
-                Ring u1,u3 ;
-                Ring v1,v3 ;
-                u1 = 1 ; u3 = a ;
-                v1 = 0 ; v3 = b ;
-                while (v3 != 0)
-                {
-                    Ring q , t1 ,t3 ;
-                    q = u3 / v3 ;
-                    t1 = u1 - q * v1 ; t3 = u3 - q * v3 ;
-                    u1 = v1 ; u3 = v3 ; v1 = t1 ; v3 = t3 ;
-                }
-                u = u1 ; 
-                return u3 ;
-            } ;
-        
-        template<class Modulo, class Modulo2>
-        Modulo MY_Zpz_inv (const Modulo a, const Modulo2 pp)
-            {
-                typedef Modulo Ring;
-                if (a == 1) return a;
-                if (a == -1) return a;
-                Ring u, d;
-                d = MY_Zpz_bezout(Ring(a),Ring(pp),u) ;
-                
-                if (d == -1) { u = -u; }
-                if (u <0) u += pp ;
-                return u ;
-            }
-        
-
-        template<class Ring, class Ring2>
-        Ring MY_gcd(Ring a, Ring2 b) {
-            Ring q,r,d;
-            Ring ma=a, mb=b;
-            while (mb != 0) {
-                q = ma / mb;
-                r = ma - q * mb;
-                ma = mb;
-                mb = r;
-            }
-            return ma;
-        };
-
-        template<class Ring1, class Ring2>
-        bool MY_divides(Ring1 a, Ring2 b) {
-            return (!(b%a));
-        };
-
-// ------------------------------------------------
-// Pivot Searchers and column strategy
-// ------------------------------------------------
-        template<class Vecteur>
-        void CherchePivot( Vecteur& lignepivot, unsigned long& indcol , long& indpermut ) {
-            unsigned long nj =  lignepivot.size() ;
-            if (nj) {
-                indpermut= lignepivot[0].first;
-                if (indpermut != indcol)
-                    lignepivot[0].first = (indcol);
-                indcol++ ;
-            } else
-                indpermut = -1;
-        }
-
-
-
-        template<class Modulo, class Vecteur, class D>
-        void CherchePivot(Modulo PRIME, Vecteur& lignepivot, unsigned long& indcol , long& indpermut, D& columns ) {
-            typedef typename Vecteur::value_type E;
-            typedef typename Field::Element F;
-            long nj =  lignepivot.size() ;
-            if (nj) {
-                indpermut = lignepivot[0].first;
-                long pp=0;
-                for(;pp<nj;++pp)
-                    if (! this->MY_divides(PRIME,lignepivot[pp].second) ) break;
-
-                if (pp < nj) {
-           
-                    long ds = columns[ lignepivot[pp].first ],dl,p=pp,j=pp;
-                    for(++j;j<nj;++j)
-                        if ( ( (dl=columns[lignepivot[j].first] ) < ds ) && (! MY_divides(PRIME,lignepivot[j].second) ) ) {
-                            ds = dl;
-                            p = j;
-                        }
-                    if (p != 0) {
-                        if (indpermut == (long)indcol) {
-                            F ttm = lignepivot[p].second;
-                            indpermut = lignepivot[p].first;
-                            lignepivot[p].second = (lignepivot[0].second);
-                            lignepivot[0].second = (ttm);
-                        } else {
-                            E ttm = lignepivot[p];
-                            indpermut = ttm.first;
-                            for(long m=p;m;--m)
-                                lignepivot[m] = lignepivot[m-1];
-                            lignepivot[0] = ttm;
-                        }
-                    } 
-                    if (indpermut != (long)indcol)
-                        lignepivot[0].first = (indcol);
-                    indcol++ ;
-                    for(j=nj;j--;)
-                        --columns[ lignepivot[j].first ];
-                } else
-                    indpermut = -2;
-            } else
-                indpermut = -1;
-        }
-
-
-
-
-        template<class Modulo, class Vecteur, class De>
-        void FaireElimination( Modulo MOD,
-                               Vecteur& lignecourante,
-                               const Vecteur& lignepivot,
-                               const long& indcol,
-                               const long& indpermut,
-                               De& columns) {
-    
-//     typedef typename Vecteur::coefficientSpace F;
-//     typedef typename Vecteur::value_types E;
-            typedef typename Field::Element F;
-            typedef typename Vecteur::value_type E;
-    
-            typedef unsigned long UModulo;
-
-            unsigned long k = indcol - 1;
-            unsigned long nj =  lignecourante.size() ;
-            if (nj) {
-                unsigned long j_head(0);
-                for(; j_head<nj; ++j_head)
-                    if (long(lignecourante[j_head].first) >= indpermut) break;
-                unsigned long bjh(j_head-1);
-                if ((j_head<nj) && (long(lignecourante[j_head].first) == indpermut)) {
-                        // -------------------------------------------
-                        // Permutation
-                    if (indpermut != (long)k) {
-                        if (lignecourante[0].first == k) {     
-                                // non zero  <--> non zero
-                            F tmp = lignecourante[0].second ;
-                            lignecourante[0].second = (lignecourante[j_head].second );
-                            lignecourante[j_head].second = (tmp);
-                        } else {
-                                // zero <--> non zero
-                            E tmp = lignecourante[j_head];
-                            --columns[ tmp.first ];
-                            ++columns[k];
-                            tmp.first = (k);
-                            for(long l=j_head; l>0; l--)
-                                lignecourante[l] = lignecourante[l-1];
-                            lignecourante[0] = tmp;
-                        } 
-                        j_head = 0;
-                    }
-                        // -------------------------------------------
-                        // Elimination
-                    unsigned long npiv = lignepivot.size();
-                    Vecteur construit(nj + npiv);
-                        // construit : <-- ci
-                        // courante  : <-- m
-                        // pivot     : <-- l
-                    typedef typename Vecteur::iterator Viter;
-                    Viter ci = construit.begin();
-                    unsigned long m=1;
-                    unsigned long l(0);
-                        // A[i,k] <-- A[i,k] / A[k,k]
-                    lignecourante[0].second = (  ((UModulo)( ( MOD-(lignecourante[0].second) ) * ( MY_Zpz_inv( lignepivot[0].second, MOD) ) ) ) % (UModulo)MOD ) ;
-                    F headcoeff = lignecourante[0].second ;
-                    --columns[ lignecourante[0].first ];
-           
-                    unsigned long j_piv;
-                    F tmp;
-                    for(;l<npiv;++l)
-                        if (lignepivot[l].first > k) break;
-                        // for all j such that (j>k) and A[k,j]!=0
-                    for(;l<npiv;++l) {
-                        j_piv = lignepivot[l].first;
-                            // if A[k,j]=0, then A[i,j] <-- A[i,j]
-                        for (;(m<nj) && (lignecourante[m].first < j_piv);) 
-                            *ci++ = lignecourante[m++];
-                            // if A[i,j]!=0, then A[i,j] <-- A[i,j] - A[i,k]*A[k,j]
-                        if ((m<nj) && (lignecourante[m].first == j_piv)) {
-                            lignecourante[m].second = ( ((UModulo)( headcoeff  *  lignepivot[l].second  + lignecourante[m].second ) ) % (UModulo)MOD );
-                            if (isNZero(lignecourante[m].second))
-                                *ci++ = lignecourante[m++];
-                            else 
-                                --columns[ lignecourante[m++].first ];
-//                         m++;
-                        } else if (isNZero(tmp = ((UModulo)(headcoeff * lignepivot[l].second)) %(UModulo)MOD)) {
-                            ++columns[j_piv];
-                            *ci++ =  E(j_piv, tmp );
-                        }
-                    }
-                        // if A[k,j]=0, then A[i,j] <-- A[i,j] 
-                    for (;m<nj;)  
-                        *ci++ = lignecourante[m++];        
-        
-                    construit.erase(ci,construit.end());
-                    lignecourante = construit;
-                } else
-                        // -------------------------------------------
-                        // Permutation
-                    if (indpermut != (long)k) {
-                        unsigned long l(0);
-                        for(; l<nj; ++l)
-                            if (lignecourante[l].first >= k) break;
-                        if ((l<nj) && (lignecourante[l].first == k))  {
-                                // non zero <--> zero
-                            E tmp = lignecourante[l];
-                            --columns[tmp.first ];
-                            ++columns[indpermut];
-                            tmp.first = (indpermut);
-                            for(;l<bjh;l++)
-                                lignecourante[l] = lignecourante[l+1];
-                            lignecourante[bjh] = tmp;
-                        } // else
-                            // zero <--> zero
-                    }
-            }
-        }
- 
-// ------------------------------------------------------
-// Rank calculators, defining row strategy
-// ------------------------------------------------------
-
-        template<class Modulo, class BB, class D, template<class X> class Container>
-        void gauss_rankin(Modulo FMOD, Modulo PRIME, Container<size_t>& ranks, BB& LigneA, const size_t Ni, const size_t Nj, const D& density_trait) {
-            ranks.resize(0);
-
-            typedef typename BB::Row Vecteur;
-    
-            Modulo MOD = FMOD;
+
+		template<class Ring>
+		Ring MY_Zpz_bezout(Ring a, Ring b, Ring& u)
+		{
+			Ring u1,u3 ;
+			Ring v1,v3 ;
+			u1 = 1 ; u3 = a ;
+			v1 = 0 ; v3 = b ;
+			while (v3 != 0)
+			{
+				Ring q , t1 ,t3 ;
+				q = u3 / v3 ;
+				t1 = u1 - q * v1 ; t3 = u3 - q * v3 ;
+				u1 = v1 ; u3 = v3 ; v1 = t1 ; v3 = t3 ;
+			}
+			u = u1 ;
+			return u3 ;
+		} ;
+
+		template<class Modulo, class Modulo2>
+		Modulo MY_Zpz_inv (const Modulo a, const Modulo2 pp)
+		{
+			typedef Modulo Ring;
+			if (a == 1) return a;
+			if (a == -1) return a;
+			Ring u, d;
+			d = MY_Zpz_bezout(Ring(a),Ring(pp),u) ;
+
+			if (d == -1) { u = -u; }
+			if (u <0) u += pp ;
+			return u ;
+		}
+
+
+		template<class Ring, class Ring2>
+		Ring MY_gcd(Ring a, Ring2 b)
+		{
+			Ring q,r,d;
+			Ring ma=a, mb=b;
+			while (mb != 0) {
+				q = ma / mb;
+				r = ma - q * mb;
+				ma = mb;
+				mb = r;
+			}
+			return ma;
+		};
+
+		template<class Ring1, class Ring2>
+		bool MY_divides(Ring1 a, Ring2 b)
+		{
+			return (!(b%a));
+		};
+
+		// ------------------------------------------------
+		// Pivot Searchers and column strategy
+		// ------------------------------------------------
+		template<class Vecteur>
+		void CherchePivot( Vecteur& lignepivot, unsigned long& indcol , long& indpermut )
+		{
+			unsigned long nj =  lignepivot.size() ;
+			if (nj) {
+				indpermut= lignepivot[0].first;
+				if (indpermut != indcol)
+					lignepivot[0].first = (indcol);
+				indcol++ ;
+			}
+			else
+				indpermut = -1;
+		}
+
+
+
+		template<class Modulo, class Vecteur, class D>
+		void CherchePivot(Modulo PRIME, Vecteur& lignepivot, unsigned long& indcol , long& indpermut, D& columns )
+		{
+			typedef typename Vecteur::value_type E;
+			typedef typename Field::Element F;
+			long nj =  lignepivot.size() ;
+			if (nj) {
+				indpermut = lignepivot[0].first;
+				long pp=0;
+				for(;pp<nj;++pp)
+					if (! this->MY_divides(PRIME,lignepivot[pp].second) ) break;
+
+				if (pp < nj) {
+
+					long ds = columns[ lignepivot[pp].first ],dl,p=pp,j=pp;
+					for(++j;j<nj;++j)
+						if ( ( (dl=columns[lignepivot[j].first] ) < ds ) && (! MY_divides(PRIME,lignepivot[j].second) ) ) {
+							ds = dl;
+							p = j;
+						}
+					if (p != 0) {
+						if (indpermut == (long)indcol) {
+							F ttm = lignepivot[p].second;
+							indpermut = lignepivot[p].first;
+							lignepivot[p].second = (lignepivot[0].second);
+							lignepivot[0].second = (ttm);
+						}
+						else {
+							E ttm = lignepivot[p];
+							indpermut = ttm.first;
+							for(long m=p;m;--m)
+								lignepivot[m] = lignepivot[m-1];
+							lignepivot[0] = ttm;
+						}
+					}
+					if (indpermut != (long)indcol)
+						lignepivot[0].first = (indcol);
+					indcol++ ;
+					for(j=nj;j--;)
+						--columns[ lignepivot[j].first ];
+				}
+				else
+					indpermut = -2;
+			}
+			else
+				indpermut = -1;
+		}
+
+
+
+
+		template<class Modulo, class Vecteur, class De>
+		void FaireElimination( Modulo MOD,
+				       Vecteur& lignecourante,
+				       const Vecteur& lignepivot,
+				       const long& indcol,
+				       const long& indpermut,
+				       De& columns) {
+
+			//     typedef typename Vecteur::coefficientSpace F;
+			//     typedef typename Vecteur::value_types E;
+			typedef typename Field::Element F;
+			typedef typename Vecteur::value_type E;
+
+			typedef typename Signed_Trait<Modulo>::unsigned_type UModulo;
+
+			unsigned long k = indcol - 1;
+			unsigned long nj =  lignecourante.size() ;
+			if (nj) {
+				unsigned long j_head(0);
+				for(; j_head<nj; ++j_head)
+					if (long(lignecourante[j_head].first) >= indpermut) break;
+				unsigned long bjh(j_head-1);
+				if ((j_head<nj) && (long(lignecourante[j_head].first) == indpermut)) {
+					// -------------------------------------------
+					// Permutation
+					if (indpermut != (long)k) {
+						if (lignecourante[0].first == k) {
+							// non zero  <--> non zero
+							F tmp = lignecourante[0].second ;
+							lignecourante[0].second = (lignecourante[j_head].second );
+							lignecourante[j_head].second = (tmp);
+						}
+						else {
+							// zero <--> non zero
+							E tmp = lignecourante[j_head];
+							--columns[ tmp.first ];
+							++columns[k];
+							tmp.first = (k);
+							for(long l=j_head; l>0; l--)
+								lignecourante[l] = lignecourante[l-1];
+							lignecourante[0] = tmp;
+						}
+						j_head = 0;
+					}
+					// -------------------------------------------
+					// Elimination
+					unsigned long npiv = lignepivot.size();
+					Vecteur construit(nj + npiv);
+					// construit : <-- ci
+					// courante  : <-- m
+					// pivot     : <-- l
+					typedef typename Vecteur::iterator Viter;
+					Viter ci = construit.begin();
+					unsigned long m=1;
+					unsigned long l(0);
+					// A[i,k] <-- A[i,k] / A[k,k]
+					lignecourante[0].second = (  ((UModulo)( ( MOD-(lignecourante[0].second) ) * ( MY_Zpz_inv( lignepivot[0].second, MOD) ) ) ) % (UModulo)MOD ) ;
+					F headcoeff = lignecourante[0].second ;
+					--columns[ lignecourante[0].first ];
+
+					unsigned long j_piv;
+					F tmp;
+					for(;l<npiv;++l)
+						if (lignepivot[l].first > k) break;
+					// for all j such that (j>k) and A[k,j]!=0
+					for(;l<npiv;++l) {
+						j_piv = lignepivot[l].first;
+						// if A[k,j]=0, then A[i,j] <-- A[i,j]
+						for (;(m<nj) && (lignecourante[m].first < j_piv);)
+							*ci++ = lignecourante[m++];
+						// if A[i,j]!=0, then A[i,j] <-- A[i,j] - A[i,k]*A[k,j]
+						if ((m<nj) && (lignecourante[m].first == j_piv)) {
+							lignecourante[m].second = ( ((UModulo)( headcoeff  *  lignepivot[l].second  + lignecourante[m].second ) ) % (UModulo)MOD );
+							if (isNZero(lignecourante[m].second))
+								*ci++ = lignecourante[m++];
+							else
+								--columns[ lignecourante[m++].first ];
+							//                         m++;
+						}
+						else if (isNZero(tmp = ((UModulo)(headcoeff * lignepivot[l].second)) %(UModulo)MOD)) {
+							++columns[j_piv];
+							*ci++ =  E(j_piv, tmp );
+						}
+					}
+					// if A[k,j]=0, then A[i,j] <-- A[i,j]
+					for (;m<nj;)
+						*ci++ = lignecourante[m++];
+
+					construit.erase(ci,construit.end());
+					lignecourante = construit;
+				}
+				else
+					// -------------------------------------------
+					// Permutation
+					if (indpermut != (long)k) {
+						unsigned long l(0);
+						for(; l<nj; ++l)
+							if (lignecourante[l].first >= k) break;
+						if ((l<nj) && (lignecourante[l].first == k))  {
+							// non zero <--> zero
+							E tmp = lignecourante[l];
+							--columns[tmp.first ];
+							++columns[indpermut];
+							tmp.first = (indpermut);
+							for(;l<bjh;l++)
+								lignecourante[l] = lignecourante[l+1];
+							lignecourante[bjh] = tmp;
+						} // else
+						// zero <--> zero
+					}
+			}
+		}
+
+		// ------------------------------------------------------
+		// Rank calculators, defining row strategy
+		// ------------------------------------------------------
+
+		template<class Modulo, class BB, class D, class Container>
+		void gauss_rankin(Modulo FMOD, Modulo PRIME, Container& ranks, BB& LigneA, const size_t Ni, const size_t Nj, const D& density_trait)
+		{
+			commentator.start ("Gaussian elimination with reordering modulo a prime power",
+					   "PRGE", Ni);
+
+			ranks.resize(0);
+
+			typedef typename BB::Row Vecteur;
+
+			Modulo MOD = FMOD;
 #ifdef GIVARO_PRANK_OUT
-            std::cerr << "Elimination mod " << MOD << std::endl;
+			std::cerr << "Elimination mod " << MOD << std::endl;
+#endif
+
+			D col_density(Nj);
+
+			// assignment of LigneA with the domain object
+			size_t jj;
+			for(jj=0; jj<Ni; ++jj) {
+				Vecteur tmp = LigneA[jj];
+				Vecteur toto(tmp.size());
+				unsigned long k=0,rs=0;
+				for(; k<tmp.size(); ++k) {
+					Modulo r = tmp[k].second;
+					if ((r <0) || (r >= MOD)) r = r % MOD ;
+					if (r <0) r = r + MOD ;
+					if (isNZero(r)) {
+						++col_density[ tmp[k].first ];
+						toto[rs] =tmp[k];
+						toto[rs].second = ( r );
+						++rs;
+					}
+				}
+				toto.resize(rs);
+				LigneA[jj] = toto;
+				//                 LigneA[jj].reactualsize(Nj);
+
+			}
+			Vecteur Vzer(0);
+
+			unsigned long last = Ni-1;
+			long c(0);
+			unsigned long indcol(0);
+			unsigned long ind_pow = 1;
+			unsigned long maxout = Ni/100; maxout = (maxout<10 ? 10 : (maxout>1000 ? 1000 : maxout) );
+			unsigned long thres = Ni/maxout; thres = (thres >0 ? thres : 1);
+
+
+			for (unsigned long k=0; k<last;++k) {
+				if ( ! (k % maxout) ) commentator.progress (k);
+
+
+				unsigned long p=k;
+				for(;;) {
+
+
+					std::multimap< long, long > psizes;
+					for(p=k; p<Ni; ++p)
+						psizes.insert( psizes.end(), std::pair<long,long>( LigneA[p].size(), p) );
+
+#if 0
+#ifdef  GIVARO_PRANK_OUT
+					std::cerr << "------------  ordered rows -----------" << std::endl;
+					for( std::multimap< long, long >::const_iterator iter = psizes.begin(); iter != psizes.end(); ++iter)
+					{
+						std::cerr << (*iter).first << " : " <<  (*iter).second << std::endl;
+					}
+					std::cerr << "--------------------------------------" << std::endl;
 #endif
-    
-            D col_density(Nj);
-
-                // assignment of LigneA with the domain object
-            size_t jj;
-            for(jj=0; jj<Ni; ++jj) {
-                Vecteur tmp = LigneA[jj];
-                Vecteur toto(tmp.size());
-                unsigned long k=0,rs=0;
-                for(; k<tmp.size(); ++k) {
-                    Modulo r = tmp[k].second;
-                    if ((r <0) || (r >= MOD)) r = r % MOD ;
-                    if (r <0) r = r + MOD ;
-                    if (isNZero(r)) {
-                        ++col_density[ tmp[k].first ];
-                        toto[rs] =tmp[k];
-                        toto[rs].second = ( r );
-                        ++rs;
-                    } 
-                }
-                toto.resize(rs);
-                LigneA[jj] = toto;
-//                 LigneA[jj].reactualsize(Nj);
-        
-            }
-            Vecteur Vzer(0);
-
-            unsigned long last = Ni-1;
-            long c;
-            unsigned long indcol(0);
-            unsigned long ind_pow = 1;
-            unsigned long maxout = Ni/1000; maxout = (maxout<10 ? 10 : (maxout>100 ? 100 : maxout) );
-            unsigned long thres = Ni/maxout; thres = (thres >0 ? thres : 1);
-
-
-            for (unsigned long k=0; k<last;++k) {
-
-                unsigned long p=k;
-                for(;;) {
-            
-                   
-                    std::multimap< long, long > psizes; 
-                    for(p=k; p<Ni; ++p)
-                        psizes.insert( psizes.end(), std::pair<long,long>( LigneA[p].size(), p) );
-                        /*
-#ifdef  GIVARO_PRANK_OUT   
-                    std::cerr << "------------  ordered rows -----------" << std::endl;
-                    for( std::multimap< long, long >::const_iterator iter = psizes.begin(); iter != psizes.end(); ++iter) {
-                        std::cerr << (*iter).first << " : " <<  (*iter).second << std::endl;
-                    }
-                    std::cerr << "--------------------------------------" << std::endl;
 #endif
-                        */
-
-                    for( typename std::multimap< long, long >::const_iterator iter = psizes.begin(); iter != psizes.end(); ++iter) {
-                        p = (*iter).second;
-                        CherchePivot( PRIME, LigneA[p], indcol, c , col_density) ;
-                        if (c > -2 ) break;
-                    }
-
-                    if (c > -2) break;
-                    for(unsigned long ii=k;ii<Ni;++ii)
-                        for(unsigned long jj=LigneA[ii].size();jj--;)
-                            LigneA[ii][jj].second = ( LigneA[ii][jj].second / PRIME);
-                    MOD = MOD / PRIME;
-                    ranks.push_back( indcol );
-                    ++ind_pow;
+
+
+					for( typename std::multimap< long, long >::const_iterator iter = psizes.begin(); iter != psizes.end(); ++iter) {
+						p = (*iter).second;
+						CherchePivot( PRIME, LigneA[p], indcol, c , col_density) ;
+						if (c > -2 ) break;
+					}
+
+					if (c > -2) break;
+					for(unsigned long ii=k;ii<Ni;++ii)
+						for(unsigned long jj=LigneA[ii].size();jj--;)
+							LigneA[ii][jj].second = ( LigneA[ii][jj].second / PRIME);
+					MOD = MOD / PRIME;
+					ranks.push_back( indcol );
+					++ind_pow;
 #ifdef GIVARO_PRANK_OUT
-                    std::cerr << "Rank mod " << (unsigned long)PRIME << "^" << ind_pow << " : " << indcol << std::endl;
-                    if (MOD == 1) std::cerr << "wattadayada inhere ?" << std::endl;
+					std::cerr << "Rank mod " << (unsigned long)PRIME << "^" << ind_pow << " : " << indcol << std::endl;
+					if (MOD == 1) std::cerr << "wattadayada inhere ?" << std::endl;
 #endif
 
-                }
-                if (p != k) {
-                    Vecteur vtm = LigneA[k];
-                    LigneA[k] = LigneA[p];
-                    LigneA[p] = vtm;
-                }
-                if (c != -1)
-                    for(unsigned long l=k + 1; l < Ni; ++l)
-                        FaireElimination(MOD, LigneA[l], LigneA[k], indcol, c, col_density);
+				}
+				if (p != k) {
+					Vecteur vtm = LigneA[k];
+					LigneA[k] = LigneA[p];
+					LigneA[p] = vtm;
+				}
+				if (c != -1)
+					for(unsigned long l=k + 1; l < Ni; ++l)
+						FaireElimination(MOD, LigneA[l], LigneA[k], indcol, c, col_density);
+
+
+				//                 LigneA.write(cout << "step[" << k << "], pivot: " << c << std::endl) << endl;
+
 #ifndef GIVARO_PRANK_OUT
-                LigneA[k] = Vzer;
+				LigneA[k] = Vzer;
 #endif
-            }
-            CherchePivot( PRIME, LigneA[last], indcol, c, col_density );
-            while( c == -2) {
-                ranks.push_back( indcol );
-                for(long jj=LigneA[last].size();jj--;)
-                    LigneA[last][jj].second = ( LigneA[last][jj].second / PRIME);
-                MOD /= PRIME;
-                CherchePivot( PRIME, LigneA[last], indcol, c, col_density );
-            }
-            while( MOD > 1) {
-                MOD /= PRIME;
-                ranks.push_back( indcol );
-            }
-                
-//             ranks.push_back(indcol);
+			}
+			CherchePivot( PRIME, LigneA[last], indcol, c, col_density );
+			while( c == -2) {
+				ranks.push_back( indcol );
+				for(long jj=LigneA[last].size();jj--;)
+					LigneA[last][jj].second = ( LigneA[last][jj].second / PRIME);
+				MOD /= PRIME;
+				CherchePivot( PRIME, LigneA[last], indcol, c, col_density );
+			}
+			while( MOD > 1) {
+				MOD /= PRIME;
+				ranks.push_back( indcol );
+			}
+
+			//             ranks.push_back(indcol);
 #ifdef GIVARO_JRANK_OUT
-            std::cerr << "Rank mod " << (unsigned long)FMOD << " : " << indcol << std::endl;
+			std::cerr << "Rank mod " << (unsigned long)FMOD << " : " << indcol << std::endl;
 #endif
+			commentator.stop ("done", 0, "PRGE");
+
+		}
+
+		template<class Modulo, class BB, class D, class Container>
+		void prime_power_rankin (Modulo FMOD, Modulo PRIME, Container& ranks, BB& SLA, const size_t Ni, const size_t Nj, const D& density_trait)
+		{
+			gauss_rankin(FMOD,PRIME,ranks, SLA, Ni, Nj, density_trait);
+		}
+
+
+		template<class Modulo, class Matrix, template<class, class> class Container, template<class> class Alloc>
+		Container<std::pair<size_t,size_t>, Alloc<std::pair<size_t,size_t> > >& operator()(Container<std::pair<size_t,size_t>, Alloc<std::pair<size_t,size_t> > >& L, Matrix& A, Modulo FMOD, Modulo PRIME)
+		{
+			Container<size_t, Alloc<size_t> > ranks;
+			prime_power_rankin( FMOD, PRIME, ranks, A, A.rowdim(), A.coldim(), std::vector<size_t>());
+			L.resize( 0 ) ;
+			size_t MOD = 1;
+			size_t num = 0, diff;
+			for( typename Container<size_t, Alloc<size_t> >::const_iterator it = ranks.begin(); it != ranks.end(); ++it) {
+				diff = *it-num;
+				if (diff > 0)
+					L.push_back( std::pair<size_t,size_t>(*it-num,MOD) );
+				MOD *= PRIME;
+				num = *it;
+			}
+			return L;
+		}
+
+	};
 
-        }
-
-        template<class Modulo, class BB, class D, template<class X> class Container>
-        void prime_power_rankin (Modulo FMOD, Modulo PRIME, Container<size_t>& ranks, BB& SLA, const size_t Ni, const size_t Nj, const D& density_trait){
-            gauss_rankin(FMOD,PRIME,ranks, SLA, Ni, Nj, density_trait);
-        }
-
-       template<template<class X> class Container, class Matrix>
-       Container<std::pair<size_t,size_t> >& operator()(Container<std::pair<size_t,size_t> >& L, Matrix& A, size_t FMOD, size_t PRIME) { 
-           Container<size_t> ranks;
-           prime_power_rankin( FMOD, PRIME, ranks, A, A.rowdim(), A.coldim(), std::vector<size_t>());
-           L.resize( 0 ) ;
-           size_t MOD = 1;
-           size_t num = 0, diff;
-           for( typename Container<size_t>::const_iterator it = ranks.begin(); it != ranks.end(); ++it) {
-               diff = *it-num;
-               if (diff > 0)
-                   L.push_back( std::pair<size_t,size_t>(*it-num,MOD) );
-               MOD *= PRIME;
-               num = *it;
-           }
-           return L;
-	}
- 
-    };
-    
 
 
 } // end of LinBox namespace
 
-#endif 
+#endif  //__LINBOX_pp_gauss_H
diff --git a/linbox/algorithms/toeplitz-det.h b/linbox/algorithms/toeplitz-det.h
index a5f4bce..1fe09a8 100644
--- a/linbox/algorithms/toeplitz-det.h
+++ b/linbox/algorithms/toeplitz-det.h
@@ -1,48 +1,76 @@
-namespace LinBox { // namespace in which all LinBox code resides.
-
-/*
-template< class Field >
-void toeplitz_determinant( ZZ_p& res, const Toeplitz<Field>& A );
-*/
-
-template< class PField >
-typename PField::Coeff& toeplitz_determinant
-	( const PField& F, typename PField::Coeff& res, 
-          const typename PField::Element& T, size_t n )
-{
-	short int sign = 1;
-	typename PField::Coeff one, temp;
-	const typename PField::CoeffField& CField = F.getCoeffField();
-	CField.init(one,1);
-	CField.init(res,1);
-	typename PField::Element f1, f2( T ), fi;
-	F.setCoeff( f1, 2*n - 1, one );
-	F.init( fi, one );
-	
-	while( F.deg(f2) >= n ) {
-		F.rem( fi, f1, f2 );
-		CField.mulin
+/* -*- 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
+/* Copyright (C) LinBox
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __LINBOX_toeplitz_det_H
+#define __LINBOX_toeplitz_det_H
+
+namespace LinBox
+{ // namespace in which all LinBox code resides.
+
+#if 0
+	template< class Field >
+	void toeplitz_determinant( ZZ_p& res, const Toeplitz<Field>& A );
+#endif
+
+	template< class PField >
+	typename PField::Coeff& toeplitz_determinant
+	( const PField& F, typename PField::Coeff& res,
+	  const typename PField::Element& T, size_t n )
+	{
+		short int sign = 1;
+		typename PField::Coeff one, temp;
+		const typename PField::CoeffField& CField = F.getCoeffField();
+		CField.init(one,1);
+		CField.init(res,1);
+		typename PField::Element f1, f2( T ), fi;
+		F.setCoeff( f1, 2*n - 1, one );
+		F.init( fi, one );
+
+		while( F.deg(f2) >= n ) {
+			F.rem( fi, f1, f2 );
+			CField.mulin
 			( res, CField.powin( F.leadCoeff( temp, f2 ),
-				             F.deg(f1) - F.deg(fi) ) );
-		if( !((F.deg(f2)-F.deg(f1))%2) && !((F.deg(f1)-n)%2) )
-			sign *= -1;
-		f1 = f2;
-		f2 = fi;
-	}
+					     F.deg(f1) - F.deg(fi) ) );
+			if( !((F.deg(f2)-F.deg(f1))%2) && !((F.deg(f1)-n)%2) )
+				sign *= -1;
+			f1 = f2;
+			f2 = fi;
+		}
 
-	if( F.deg(f2) == (n-1) ) {
-		CField.mulin
+		if( F.deg(f2) == (n-1) ) {
+			CField.mulin
 			( res, CField.powin( F.leadCoeff( temp, f2 ),
-			                     F.deg(f1) - F.deg(f2) ) );
-		if( sign == -1 ) {
-			typename PField::Coeff negOne;
-			CField.init( negOne, -1 );
-			CField.mulin( res, negOne );
+					     F.deg(f1) - F.deg(f2) ) );
+			if( sign == -1 ) {
+				typename PField::Coeff negOne;
+				CField.init( negOne, -1 );
+				CField.mulin( res, negOne );
+			}
 		}
-	}
-	else CField.init( res, 0 );
+		else CField.init( res, 0 );
 
-	return res;
-}
+		return res;
+	}
 
 } // end of namespace LinBox
+
+#endif //__LINBOX_toeplitz_det_H
diff --git a/linbox/algorithms/triangular-solve-gf2.h b/linbox/algorithms/triangular-solve-gf2.h
new file mode 100644
index 0000000..f6ec95e
--- /dev/null
+++ b/linbox/algorithms/triangular-solve-gf2.h
@@ -0,0 +1,126 @@
+/* -*- 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
+/* ===================================================================
+ * Copyright(C) LinBox 2008
+ * Written by Jean-Guillaume Dumas
+ * Triangular Solve
+ * See COPYING for license information.
+ * Time-stamp: <01 Oct 09 15:38:25 Jean-Guillaume.Dumas at imag.fr>
+ * ===================================================================
+ */
+#ifndef __LINBOX_tri_solve_gf2_INL
+#define __LINBOX_tri_solve_gf2_INL
+
+#include "linbox/vector/vector-domain.h"
+#include "linbox/field/gf2.h"
+
+namespace LinBox
+{
+	template <class _Matrix, class Vector1, class Vector2> Vector1&
+	upperTriangularSolveBinary (Vector1& x,
+				    const _Matrix  &U,
+				    const Vector2& b)
+	{
+		//         linbox_check( x.size() == U.coldim() );
+		//         linbox_check( b.size() == U.rowdim() );
+		typedef _Matrix Matrix;
+		typedef GF2 Field;
+		const GF2 F2;
+
+		commentator.start ("Sparse Elimination Upper Triangular Solve over GF(2)", "utrsmGF2");
+
+		typename Vector2::const_iterator vec=b.begin();
+		typename Vector1::iterator res=x.begin();
+		typename Matrix::const_iterator row=U.begin();
+
+		// Find last constrained values of x, U and b
+		//         for( ; (res != x.end()) && (row != U.rowEnd()); ++res, ++row, ++vec) { }
+		size_t last = x.size();
+		if( b.size() < last ) last = b.size();
+		res += last;
+		row += last;
+		vec += last;
+
+		VectorCategories::DenseZeroOneVectorTag  DZOtag;
+		VectorCategories::SparseZeroOneVectorTag SZOtag;
+
+		bool consistant = true;
+		for(typename Vector2::const_iterator bcheck=vec; bcheck != b.end(); ++bcheck) {
+			if( ! F2.isZero(*bcheck) ) {
+				consistant = false;
+				break;
+			}
+		}
+		if (consistant) {
+			--vec; --res; --row;
+
+			VectorDomain<Field> VD(F2);
+			for( ; row != U.begin(); --row, --vec, --res) {
+				F2.init(*res, 0UL);
+				if (row->size()) {
+					typename Field::Element tmp;
+					VD.dotSpecialized(tmp, x, *row, DZOtag, SZOtag);
+					F2.addin(tmp,*vec);
+					F2.assign(*res,tmp);
+				}
+				else {
+					// Consistency check
+					if( ! F2.isZero(*vec) ) {
+						consistant = false;
+						break;
+					}
+				}
+			}
+			F2.init(*res, 0UL);
+			if (row->size()) {
+				typename Field::Element tmp;
+				VD.dotSpecialized(tmp, x, *row, DZOtag, SZOtag);
+				F2.addin(tmp,*vec);
+				F2.assign(*res,tmp);
+			}
+			else {
+				// Consistency check
+				if( ! F2.isZero(*vec) ) consistant = false;
+			}
+		}
+		//         if (! consistant) throw LinboxError ("upperTriangularSolveBinary returned INCONSISTENT");
+		linbox_check( consistant );
+
+		commentator.stop ("done", NULL, "utrsmGF2");
+		return x;
+	}
+
+	template <class _Matrix, class Vector1, class Vector2> Vector1&
+	lowerTriangularUnitarySolveBinary (Vector1& x,
+					   const _Matrix  &L,
+					   const Vector2& b)
+	{
+		linbox_check( b.size() == L.coldim() );
+		typedef _Matrix Matrix;
+		const GF2 F2;
+
+		commentator.start ("Sparse Elimination Lower Triangular Unitary Solve over GF2", "ltrsmGF2");
+
+		typename Vector2::const_iterator vec=b.begin();
+		typename Vector1::iterator res=x.begin();
+		typename Matrix::const_iterator row=L.begin();
+
+		VectorCategories::DenseZeroOneVectorTag  DZOtag;
+		VectorCategories::SparseZeroOneVectorTag SZOtag;
+		VectorDomain<GF2> VD(F2);
+		for( ; row != L.end(); ++row, ++vec, ++res) {
+			F2.init(*res, 0UL);
+			GF2::Element tmp;
+			VD.dotSpecialized(tmp, *row, x, SZOtag, DZOtag);
+			F2.negin(tmp);
+			F2.addin(tmp,*vec);
+			F2.assign(*res,tmp);
+		}
+
+		commentator.stop ("done", NULL, "ltrsmGF2");
+		return x;
+	}
+
+}
+#endif //__LINBOX_tri_solve_gf2_INL
+
diff --git a/linbox/algorithms/triangular-solve.h b/linbox/algorithms/triangular-solve.h
new file mode 100644
index 0000000..0c56fb3
--- /dev/null
+++ b/linbox/algorithms/triangular-solve.h
@@ -0,0 +1,189 @@
+/* -*- 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
+/* ===================================================================
+ * Copyright(C) 2008 LinBox
+ * Triangular Solve
+ * See COPYING for license information.
+ * Time-stamp: <16 Jun 10 14:21:18 Jean-Guillaume.Dumas at imag.fr>
+ * ===================================================================
+ */
+#ifndef __LINBOX_triangular_solve_H
+#define __LINBOX_triangular_solve_H
+
+#include "linbox/vector/vector-domain.h"
+
+namespace LinBox
+{
+	template <class _Matrix, class Vector1, class Vector2> Vector1&
+	upperTriangularSolve (Vector1& x,
+			      const _Matrix  &U,
+			      const Vector2& b)
+	{
+		linbox_check( x.size() == U.coldim() );
+		linbox_check( b.size() == U.rowdim() );
+		typedef _Matrix Matrix;
+		typedef typename Matrix::Field Field;
+		const Field& F = U.field();
+
+		commentator.start ("Sparse Elimination Upper Triangular Solve", "utrsm");
+
+		typename Vector2::const_iterator vec=b.begin();
+		typename Vector1::iterator res=x.begin();
+		typename Matrix::ConstRowIterator row=U.rowBegin();
+
+		// Find last constrained values of x, U and b
+		//         for( ; (res != x.end()) && (row != U.rowEnd()); ++res, ++row, ++vec) { }
+		size_t last = U.coldim();
+		if( b.size() < last ) last = b.size();
+		res += last;
+		row += last;
+		vec += last;
+
+
+		bool consistant = true;
+		for(typename Vector2::const_iterator bcheck=vec; bcheck != b.end(); ++bcheck) {
+			if( ! F.isZero(*bcheck) ) {
+				consistant = false;
+				break;
+			}
+		}
+		if (consistant) {
+			--vec; --res; --row;
+
+			VectorDomain<Field> VD(F);
+			for( ; row != U.rowBegin(); --row, --vec, --res) {
+				F.init(*res, 0UL);
+				if (row->size()) {
+					typename Field::Element tmp;
+					VD.dot(tmp, *row, x);
+					F.negin(tmp);
+					F.addin(tmp,*vec);
+					F.divin(tmp,row->front().second);
+					F.assign(*res,tmp);
+				}
+				else {
+					// Consistency check
+					if( ! F.isZero(*vec) ) {
+						consistant = false;
+						break;
+					}
+				}
+			}
+
+			F.init(*res, 0UL);
+			if (row->size()) {
+				typename Field::Element tmp;
+				VD.dot(tmp, *row, x);
+				F.negin(tmp);
+				F.addin(tmp,*vec);
+				F.divin(tmp,row->front().second);
+				F.assign(*res,tmp);
+			}
+			else {
+				// Consistency check
+				if( ! F.isZero(*vec) ) consistant = false;
+			}
+		}
+		if (! consistant) throw LinboxError ("upperTriangularSolve returned INCONSISTENT");
+
+		commentator.stop ("done", NULL, "utrsm");
+		return x;
+	}
+
+	// Suppose x and b are vectors of pairs <index,value>
+	// first rank rows of U are upper triangular and full rank
+	template <class _Matrix, class Vector1, class Vector2> Vector1&
+	upperTriangularSparseSolve (Vector1& x,
+				    unsigned long rank,
+				    const _Matrix  &U,
+				    const Vector2& b)
+	{
+		commentator.start ("SparseElim UpperTriang Sparse Solve", "uSPt");
+
+		x.resize(0);
+
+		if (b.size() != 0) {
+
+			typedef _Matrix Matrix;
+			typedef typename Matrix::Field Field;
+			const Field& F = U.field();
+
+
+
+			typename Vector2::const_iterator vec=b.begin();
+			vec += b.size(); --vec;
+
+			typename Matrix::ConstRowIterator row=U.rowBegin();
+			row += rank; --row;
+
+			VectorDomain<Field> VD(F);
+
+
+			long i=rank;
+			for(--i; (vec >= b.begin()) && (i>=0); --i,--row) {
+				if (row->size()) {
+					typename Field::Element tmp;
+					VD.dot(tmp, *row, x); // x is sparse also
+					F.negin(tmp);
+					if (static_cast<long>(vec->first) == i) {
+						F.addin(tmp,vec->second);
+						--vec;
+					}
+					if (! F.isZero(tmp)) {
+						F.divin(tmp,row->front().second);
+						x.insert(x.begin(), typename Vector1::value_type(i, tmp));
+					}
+				}
+			}
+			for(; i>=0; --i,--row) {
+				if (row->size()) {
+					typename Field::Element tmp;
+					VD.dot(tmp, *row, x);
+					if (! F.isZero(tmp)) {
+						F.negin(tmp);
+						F.divin(tmp,row->front().second);
+						x.insert(x.begin(), typename Vector1::value_type(i, tmp));
+					}
+				}
+			}
+		}
+		//         if (! consistant) throw LinboxError ("upperTriangularSparseSolve returned INCONSISTENT");
+
+		commentator.stop ("done", NULL, "uSPt");
+
+		return x;
+	}
+
+
+	template <class _Matrix, class Vector1, class Vector2> Vector1&
+	lowerTriangularUnitarySolve (Vector1& x,
+				     const _Matrix  &L,
+				     const Vector2& b)
+	{
+		linbox_check( b.size() == L.coldim() );
+		typedef _Matrix Matrix;
+		typedef typename Matrix::Field Field;
+		const Field& F = L.field();
+
+		commentator.start ("Sparse Elimination Lower Triangular Unitary Solve", "ltrsm");
+
+		typename Vector2::const_iterator vec=b.begin();
+		typename Vector1::iterator res=x.begin();
+		typename Matrix::ConstRowIterator row=L.rowBegin();
+
+		VectorDomain<Field> VD(F);
+		for( ; row != L.rowEnd(); ++row, ++vec, ++res) {
+			F.init(*res, 0UL);
+			typename Field::Element tmp;
+			VD.dot(tmp, *row, x);
+			F.negin(tmp);
+			F.addin(tmp,*vec);
+			F.assign(*res,tmp);
+		}
+
+		commentator.stop ("done", NULL, "ltrsm");
+		return x;
+	}
+}
+#endif //__LINBOX_triangular_solve_H
+
diff --git a/linbox/algorithms/varprec-cra-early-multip.h b/linbox/algorithms/varprec-cra-early-multip.h
new file mode 100644
index 0000000..d89d8d3
--- /dev/null
+++ b/linbox/algorithms/varprec-cra-early-multip.h
@@ -0,0 +1,558 @@
+/* -*- 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
+/* linbox/blackbox/rational-reconstruction-base.h
+ * Copyright (C) 2009 Anna Marszalek
+ *
+ * Written by Anna Marszalek <aniau at astronet.pl>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_varprec_cra_multip_single_H
+#define __LINBOX_varprec_cra_multip_single_H
+
+#include "linbox/util/timer.h"
+#include <stdlib.h>
+#include "linbox/integer.h"
+#include "linbox/field/PID-integer.h"
+#include "linbox/field/gmp-rational.h"
+#include "linbox/solutions/methods.h"
+#include <vector>
+#include <utility>
+#include "linbox/algorithms/cra-early-single.h"
+#include "linbox/algorithms/cra-full-multip.h"
+#include "linbox/algorithms/lazy-product.h"
+
+
+namespace LinBox
+{
+
+	/*
+	 * Implements early terminated CRA with preconditioning of the result
+	 * factor | result should be given
+	 * does not detect bad factors but can run until full termination [for result] in this case
+	 * factor may be changed by changeFactor function, residues stored in FullMultipCRA are recomputed in this case,
+	 * FullMulpitCRA should consist of vectors of size 0, but errors happen.
+	 */
+
+	//typedef PID_Integer Integers;
+	//typedef Integers::Element Integer;
+
+	template<class Domain_Type>
+	struct VarPrecEarlyMultipCRA: public EarlySingleCRA<Domain_Type>, FullMultipCRA<Domain_Type> {
+
+		typedef GMPRationalField Rationals;
+		typedef Rationals::Element Quotient;
+
+		typedef Domain_Type                     Domain;
+		typedef typename Domain::Element DomainElement;
+		typedef VarPrecEarlyMultipCRA<Domain> Self_t;
+
+	protected:
+		std::vector< Integer > vfactor_;
+		std::vector< Integer > vmultip_;
+
+		std::vector< unsigned long > randv;
+	public:
+		VarPrecEarlyMultipCRA(const unsigned long EARLY = DEFAULT_EARLY_TERM_THRESHOLD, const double b=0.0,
+				      const std::vector<Integer>& vf = std::vector<Integer>(0),
+				      const std::vector<Integer>& vm = std::vector<Integer>(0)) :
+			EarlySingleCRA<Domain>(EARLY), FullMultipCRA<Domain>(b), vfactor_(vf), vmultip_(vm)
+		{
+			for (int i=0; i < (int)vfactor_.size(); ++i) {
+				if (vfactor_[i]==0) vfactor_[i]=1;
+			}
+		}
+
+		VarPrecEarlyMultipCRA(VarPrecEarlyMultipCRA& other) :
+			EarlySingleCRA<Domain>(other.EARLY_TERM_THRESHOLD), FullMultipCRA<Domain>(other.LOGARITHMIC_UPPER_BOUND), vfactor_(other.vfactor_), vmultip_(other.vmultip_)
+		{
+			for (int i=0; i < vfactor_.size(); ++i) {
+				if (vfactor_[i]==0) vfactor_[i]=1;
+			}
+		}
+
+		int getThreshold(int& t) {return t = EarlySingleCRA<Domain>::EARLY_TERM_THRESHOLD;}
+
+		Integer& getModulus(Integer& m) {EarlySingleCRA<Domain>::getModulus(m);return m;}
+		Integer& getResidue(Integer& r) {EarlySingleCRA<Domain>::getResidue(r);return r;}
+
+		template<class Vect>
+		Vect& getResidue(Vect& r) {
+			Vect z,vf, vm;
+			FullMultipCRA<Domain>::result(z);
+
+			typename Vect::const_iterator it,itf,itm;
+			Integer M; getModulus(M);
+			getPreconditioner(vf,vm);
+
+			//r.resize(vf.size());//vector of residues
+			inverse(r, vf, M);
+			normproductin(r, z, M);
+			normproductin(r, vm, M);
+
+			//FullMultipCRA<Domain>::getResidue(r);
+			return r;
+		}
+
+		template<class Vect>
+		void initialize (const Integer& D, const Vect& e) {
+			srand48(BaseTimer::seed());
+			vfactor_.resize( e.size(),1 );
+			vmultip_.resize( e.size(),1 );
+			randv. resize ( e.size() );
+
+			for ( std::vector<unsigned long>::iterator int_p = randv. begin(); int_p != randv. end(); ++ int_p)
+				*int_p = ((unsigned long)lrand48()) % 20000 - 10000;
+
+			std::vector<Integer> vz(vfactor_.size());
+			inverse(vz,vfactor_,D);
+			productin(vz,vmultip_,D);
+			productin(vz,e,D);
+
+			Integer z;
+			dot(z,D,vz,randv);
+
+			EarlySingleCRA<Domain>::initialize(D, z);
+			FullMultipCRA<Domain>::initialize(D, e);
+		}
+
+		template<class Vect>
+		void initialize (const Domain& D, Vect& e) {
+			srand48(BaseTimer::seed());
+			vfactor_.resize( e.size(),1 );
+			vmultip_.resize( e.size(),1 );
+			randv. resize ( e.size() );
+
+			for ( std::vector<unsigned long>::iterator int_p = randv. begin(); int_p != randv. end(); ++ int_p)
+				*int_p = ((unsigned long)lrand48()) % 20000 - 10000;
+
+			std::vector<DomainElement> vz(vfactor_.size());
+			inverse(vz,vfactor_,D);
+			productin(vz,vmultip_,D);
+			productin(vz,e,D);
+
+			DomainElement z;
+			dot(z,D,vz,randv);
+
+			EarlySingleCRA<Domain>::initialize(D, z);
+			FullMultipCRA<Domain>::initialize(D, e);
+		}
+
+		template<class Vect>
+		void progress (const Integer& D, const Vect& e) {
+
+			// Could be much faster
+			// - do not compute twice the product of moduli
+			// - reconstruct one element of e until Early Termination,
+			//   then only, try a random linear combination.
+
+			std::vector<Integer> vz(vfactor_.size());
+			inverse(vz,vfactor_,D);
+			productin(vz,vmultip_,D);
+			productin(vz,e,D);
+
+			Integer z;
+			dot(z,D,vz,randv);
+
+			EarlySingleCRA<Domain>::progress(D, z);
+			FullMultipCRA<Domain>::progress(D, e);
+		}
+
+		template<class Vect>
+		void progress (const Domain& D, const Vect& e) {
+			//z = (e/ factor mod D)
+			// Could be much faster
+			// - do not compute twice the product of moduli
+			// - reconstruct one element of e until Early Termination,
+			//   then only, try a random linear combination.
+
+			std::vector<DomainElement> vz(vfactor_.size());
+			inverse(vz,vfactor_,D);
+			productin(vz,vmultip_,D);
+			productin(vz,e,D);
+			DomainElement z;
+			dot(z,D,vz,randv);
+
+			EarlySingleCRA<Domain>::progress(D, z);
+			FullMultipCRA<Domain>::progress(D, e);
+		}
+
+		bool terminated() {
+			bool ET = EarlySingleCRA<Domain>::terminated();
+			if (FullMultipCRA<Domain>::LOGARITHMIC_UPPER_BOUND> 1.0) ET = ET || FullMultipCRA<Domain>::terminated();
+			return ET;
+		}
+
+		bool noncoprime(const Integer& i) const {
+			return EarlySingleCRA<Domain>::noncoprime(i);
+		}
+
+		//Integer& getFactor(Integer& f) {
+		//	return f = EarlySingleCRA<Domain>::factor_;
+		//}
+
+		//Integer& getMultip(Integer& m) {
+		//	return m=EarlySingleCRA<Domain>::multip_;
+		//}
+
+		template<class Vect>
+		Vect& getFactor(Vect& vf) const {
+			//Integer f = getFactor(f);
+			vf.clear();// vf.resize(vfactor_.size());
+			typename Vect::const_iterator it = vfactor_.begin();
+			for (;it != vfactor_.end(); ++it) {
+				vf.push_back((*it));
+			}
+			return vf;// = vfactor_;
+		}
+
+
+		template<class Vect>
+		Vect& getMultip(Vect& vm) const {
+			//Integer m = getMultip(m);
+			vm.clear(); //vm.resize(vmultip_ .size());
+			typename Vect::const_iterator it = vmultip_.begin();
+			for (;it != vmultip_.end(); ++it) {
+				vm.push_back((*it));
+			}
+			return vm;
+		}
+
+		//Integer& getPreconditioner(Integer& f, Integer& m) const {
+		//	getMultip(m);
+		//	return getFactor(f);
+		//}
+
+		template<class Vect>
+		Vect& getPreconditioner(Vect& vf, Vect& vm) const {
+			getMultip(vm);
+			getFactor(vf);
+			return vf;
+		}
+
+		//Quotient& getPreconditioner(Quotient& q) {
+		//	return q = EarlySingleCRA<Domain>::getPreconditioner(q);
+		//}
+
+		template<template<class, class> class Vect, template<class> class Alloc>
+		Vect<Quotient, Alloc<Quotient> >& getPreconditioner(Vect<Quotient, Alloc<Quotient> >& vq) const {
+
+			Vect<Integer, Alloc<Integer> > vf,vm;
+			getPreconditioner(vf,vm);
+			vq.clear();
+
+			typename Vect<Integer, Alloc<Integer> >::const_iterator itf, itm;
+			for (itf = vf.begin(), itm=vm.begin() ; itf != vf.end(); ++itf,++itm) {
+				vq.push_back(Quotient(*itm,*itf));
+			}
+
+			return vq;
+		}
+
+		template<template<class, class> class Vect, template<class> class Alloc>
+		Vect<Integer, Alloc<Integer> >& result(Vect<Integer, Alloc<Integer> >& r) {
+			if ((FullMultipCRA<Domain>::LOGARITHMIC_UPPER_BOUND> 1.0) && ( FullMultipCRA<Domain>::terminated() )) {
+				FullMultipCRA<Domain>::result(r);
+				return r ;
+			}
+			else {
+				//Integer M; getModulus(m);
+				Vect<Integer, Alloc<Integer> > z,vf, vm;
+				FullMultipCRA<Domain>::result(z);
+
+				typename Vect<Integer, Alloc<Integer> >::const_iterator it,itf,itm;
+
+				Integer M; getModulus(M);
+				getPreconditioner(vf,vm);
+
+				Vect<Integer, Alloc<Integer> > residue;
+				getResidue(residue);
+				//vector of residues
+
+				r.clear();
+
+				//getPreconditioner(vf,vm);
+				itf = vf.begin(); itm = vm.begin();it = z.begin();
+
+				for (; it!= z.end(); ++it, ++itf,++itm ) {
+					r.push_back(*itf * (*it) / (*itm) );
+				}
+				return r;
+			}
+		}
+
+		template<template<class,class> class Vect, template<class> class Alloc>
+		Vect<Integer, Alloc<Integer> >& result(Vect<Integer, Alloc<Integer> >& num, Integer& den) {
+			if ((FullMultipCRA<Domain>::LOGARITHMIC_UPPER_BOUND> 1.0) && ( FullMultipCRA<Domain>::terminated() )) {
+				FullMultipCRA<Domain>::result(num);
+				den = 1;
+				return num;
+			}
+			else {
+				Vect<Integer, Alloc<Integer> > z,vf, vm;
+				FullMultipCRA<Domain>::result(z);//vector of non prec results
+
+				typename Vect<Integer, Alloc<Integer> >::const_iterator it,itf,itm;
+				typename Vect<Integer, Alloc<Integer> >::iterator itt;
+
+				Integer M; getModulus(M);
+				getPreconditioner(vf,vm);
+
+				Vect<Integer, Alloc<Integer> > residue;//vector of residues
+				getResidue(residue);
+
+				num.clear();
+
+				//getPreconditioner(vf,vm);
+				itf = vf.begin(); itm = vm.begin();it = residue.begin();
+				den = 1; Integer old_den =1;
+				for (; it!= residue.end(); ++it, ++itf,++itm ) {
+					lcm(den,den,*itm);Integer d = den/old_den;
+
+					num.push_back((*itf) * (*it));
+					if (den != old_den) {
+						for (itt=num.begin(); itt !=num.end()-1 ;++itt) {
+							*itt *= d;
+						}
+						*itt = *itt * (den/ (*itm));
+					}
+					old_den = den;
+				}
+				return num;
+			}
+		}
+
+		template<template<class, class> class Vect, template<class> class Alloc>
+		Vect<Quotient, Alloc<Quotient> >& result(Vect<Quotient, Alloc<Quotient> >& q) {
+			q.clear();
+			if ((FullMultipCRA<Domain>::LOGARITHMIC_UPPER_BOUND> 1.0) && ( FullMultipCRA<Domain>::terminated() )) {
+				std::vector<Integer> vz;
+				FullMultipCRA<Domain>::result(vz);
+
+				typename Vect<Integer, Alloc<Integer> >::const_iterator it = vz.begin();
+				for (; it!= vz.end(); ++it) {
+					q.push_back(Quotient(*it,1UL));
+				}
+				return q;
+			}
+			else {
+				Vect<Integer, Alloc<Integer> > z,vf, vm;
+				FullMultipCRA<Domain>::result(z);
+				typename Vect<Integer, Alloc<Integer> >::const_iterator it = z.begin(),itf,itm;
+
+				Integer M; getModulus(M);
+				getPreconditioner(vf,vm);
+
+				Vect<Integer, Alloc<Integer> > residue;//vector of residues
+				inverse(residue, vf, M);
+				normproductin(residue, z, M);
+				normproductin(residue, vm, M);
+
+				itf = vf.begin(); itm = vm.begin();
+
+				for (; it!= z.end(); ++it, ++itf,++itm ) {
+					q.push_back(Quotient(*itf * (*it) , *itm));
+				}
+				return q;
+			}
+		}
+
+
+		template<class Vect>
+		bool changePreconditioner(const Vect& vf, const Vect& vm) {
+			//Warning does not detect unchanged preconditioners !!!
+			//if ((factor_ == f) && (multip_==m)) return EarlySingleCRA<Domain>::terminated();
+
+			typename Vect::const_iterator itf, itm, itf2, itm2;
+
+			vfactor_ = vf;
+			for (int i=0; i < (int)vfactor_.size(); ++i) {
+				if (vfactor_[i]==0) vfactor_[i]=1;	//if factor ==0 set no factor
+			}
+			vmultip_ = vm;
+
+			Vect e(vfactor_.size());
+
+			//clear CRAEarlySingle;
+			EarlySingleCRA<Domain>::occurency_ = 0;
+			EarlySingleCRA<Domain>::nextM_ = 1UL;
+			EarlySingleCRA<Domain>::primeProd_ = 1UL;
+			EarlySingleCRA<Domain>::residue_ = 0;
+
+			//Computation of residue_
+
+			//std::vector< double >::iterator  _dsz_it = RadixSizes_.begin();
+			std::vector< LazyProduct >::iterator _mod_it = FullMultipCRA<Domain>::RadixPrimeProd_.end();// list of prime products
+			std::vector< std::vector<Integer> >::iterator _tab_it = FullMultipCRA<Domain>::RadixResidues_.end();// list of residues as vectors of size 1
+			std::vector< bool >::iterator    _occ_it = FullMultipCRA<Domain>::RadixOccupancy_.end();//flags of occupied fields
+			int n = FullMultipCRA<Domain>::RadixOccupancy_.size();
+			//std::vector<Integer> ri(1); LazyProduct mi; double di;
+			//could be much faster if max occupandy is stored
+			int prev_shelf=0, shelf = 0; Integer prev_residue_=0;
+			--_occ_it; --_mod_it; --_tab_it;//last elemet
+			for (int i=n; i > 0; --i, --_mod_it, --_tab_it, --_occ_it ) {
+				//--_occ_it; --_mod_it; --_tab_it;
+				++shelf;
+				if (*_occ_it) {
+					Integer D = _mod_it->operator()();
+					Vect e(vfactor_.size());
+					inverse(e,vfactor_,D);
+					productin(e,*_tab_it,D);
+					productin(e,vmultip_,D);
+
+					Integer z;
+					dot(z,D, e, randv);
+
+
+					prev_residue_ = EarlySingleCRA<Domain>::residue_;
+					EarlySingleCRA<Domain>::progress(D,z);
+
+					if (prev_residue_ == EarlySingleCRA<Domain>::residue_ )
+						EarlySingleCRA<Domain>::occurency_ = EarlySingleCRA<Domain>::occurency_ +  (shelf - prev_shelf);
+					if ( EarlySingleCRA<Domain>::terminated() ) {
+						return true;
+					}
+					prev_shelf = shelf;
+				}
+			}
+
+			return EarlySingleCRA<Domain>::terminated();
+
+			//forall results in FullMultipCRA do
+			//	precondition
+			//	progress to  EarlySingleCRA
+			//	check for termination
+			//recompute
+		}
+
+		bool changeVector() {
+			for ( std::vector<unsigned long>::iterator int_p = randv. begin();int_p != randv. end(); ++ int_p)
+				*int_p = ((unsigned long)lrand48()) % 20000;
+			return changePreconditioner(vfactor_,vmultip_);
+		}
+
+	protected:
+		template <template<class> class Alloc, template<class, class> class Vect1, class Vect2>
+		DomainElement& dot (DomainElement& z, const Domain& D,
+				    const Vect1<DomainElement, Alloc<DomainElement> >& v1,
+				    const Vect2& v2) {
+			D.init(z,0); DomainElement tmp;
+			typename Vect1<DomainElement, Alloc<DomainElement> >::const_iterator v1_p;
+			typename Vect2::const_iterator v2_p;
+
+			for (v1_p  = v1. begin(), v2_p = v2. begin();v1_p != v1. end();++ v1_p, ++ v2_p)
+				D.axpyin(z, (*v1_p), D.init(tmp, (*v2_p)));
+			return z;
+		}
+
+		template <template<class> class Alloc, template<class, class> class Vect1, class Vect2>
+		Integer& dot (Integer& z, const Integer& D, const Vect1<Integer, Alloc<Integer> >& v1, const Vect2& v2) {
+			z = 0;
+			typename Vect1<Integer, Alloc<Integer> >::const_iterator v1_p;
+			typename Vect2::const_iterator v2_p;
+			for (v1_p  = v1. begin(), v2_p = v2. begin(); v1_p != v1. end(); ++ v1_p, ++ v2_p) {
+				z = (z + (*v1_p)*(*v2_p))%D;
+			}
+			return z;
+		}
+
+		template<class Vect1, class Vect2>
+		Vect1& inverse(Vect1& vz,const Vect2 vf, const Domain D) {
+			vz.clear();
+			typename Vect2::const_iterator it = vf.begin();
+
+			for (; it != vf.end(); ++it) {
+				DomainElement z,i;
+				D.init(z,1);
+				D.init(i,*it);
+				if (!D.isZero(i)) D.inv(z,i);
+				vz.push_back(z);
+			}
+			return vz;
+
+		}
+
+		template<class Vect1, class Vect2>
+		Vect1& inverse(Vect1& vz,const Vect2& vf, const Integer& D) {
+			vz.clear();
+			typename Vect2::const_iterator it = vf.begin();
+
+			for (; it != vf.end(); ++it) {
+				Integer z=1;
+				if ((*it) != 0) inv(z,*it,D);
+				vz.push_back(z);
+			}
+			return vz;
+		}
+	public:
+		template<class Vect1, class Vect2>
+		Vect1& productin(Vect1& vz, const Vect2 vm, const Domain D) {
+			typename Vect1::iterator v1_p;
+			typename Vect2::const_iterator v2_p;
+
+			for (v1_p  = vz. begin(), v2_p = vm. begin(); v1_p != vz. end(); ++ v1_p, ++ v2_p) {
+				DomainElement i;
+				D.init(i,*v2_p);
+				D.mulin(*v1_p , i);
+			}
+			return vz;
+		}
+
+
+		template<class Vect1, class Vect2>
+		Vect1& productin(Vect1& vz, const Vect2 vm, const Integer& D) {
+			typename Vect1::iterator v1_p;
+			typename Vect2::const_iterator v2_p;
+
+			for (v1_p  = vz. begin(), v2_p = vm. begin(); v1_p != vz. end(); ++ v1_p, ++ v2_p) {
+				*v1_p = (*v1_p) * (*v2_p);
+				*v1_p = (*v1_p) % D;
+			}
+			return vz;
+		}
+
+		template<class Vect1, class Vect2>
+		Vect1& normproductin(Vect1& vz, const Vect2 vm, const Integer& D) {
+			typename Vect1::iterator v1_p;
+			typename Vect2::const_iterator v2_p;
+			for (v1_p  = vz. begin(), v2_p = vm. begin(); v1_p != vz. end(); ++ v1_p, ++ v2_p) {
+				*v1_p = (*v1_p) * (*v2_p);
+				*v1_p = (*v1_p) % D;
+				Integer tmp = (*v1_p >0) ? *v1_p - D : *v1_p + D;
+				if (absCompare(*v1_p,tmp)> 0) *v1_p = tmp;
+			}
+			return vz;
+		}
+
+		template<class Vect1, class Vect2>
+		Vect1& productin(Vect1& vz, const Vect2 vm) {
+			typename Vect1::iterator v1_p;
+			typename Vect2::const_iterator v2_p;
+
+			for (v1_p  = vz. begin(), v2_p = vm. begin(); v1_p != vz. end(); ++ v1_p, ++ v2_p) {
+				*v1_p *= (*v2_p);
+			}
+
+			return vz;
+		}
+
+	};
+
+} //namespace LinBox
+
+#endif //__LINBOX_varprec_cra_multip_single_H
+
diff --git a/linbox/algorithms/varprec-cra-early-single.h b/linbox/algorithms/varprec-cra-early-single.h
new file mode 100644
index 0000000..2490dd1
--- /dev/null
+++ b/linbox/algorithms/varprec-cra-early-single.h
@@ -0,0 +1,328 @@
+/* -*- 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
+/* linbox/blackbox/rational-reconstruction-base.h
+ * Copyright (C) 2009 Anna Marszalek
+ *
+ * Written by Anna Marszalek <aniau at astronet.pl>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_varprec_cra_early_single_H
+#define __LINBOX_varprec_cra_early_single_H
+
+#include "linbox/util/timer.h"
+#include <stdlib.h>
+#include "linbox/integer.h"
+#include "linbox/field/PID-integer.h"
+#include "linbox/field/gmp-rational.h"
+#include "linbox/solutions/methods.h"
+#include <vector>
+#include <utility>
+#include "linbox/algorithms/cra-early-single.h"
+#include "linbox/algorithms/cra-full-multip.h"
+#include "linbox/algorithms/lazy-product.h"
+
+
+namespace LinBox
+{
+
+	/*
+	 * Implements early terminated CRA with preconditioning of the result
+	 * factor | result should be given
+	 * does not detect bad factors but can run until full termination [for result] in this case
+	 * factor may be changed by changeFactor function, residues stored in FullMultipCRA are recomputed in this case,
+	 * FullMulpitCRA should consist of vectors of size 0, but errors happen.
+	 */
+	template<class Domain_Type>
+	struct VarPrecEarlySingleCRA: public EarlySingleCRA<Domain_Type>, FullMultipCRA<Domain_Type> {
+
+		//typedef PID_Integer Integers;
+		//typedef Integers::Element Integer;
+		typedef GMPRationalField Rationals;
+		typedef Rationals::Element Quotient;
+
+		typedef Domain_Type                     Domain;
+		typedef typename Domain::Element DomainElement;
+		typedef VarPrecEarlySingleCRA<Domain> Self_t;
+
+	public:
+		Integer factor_;
+		Integer multip_;
+
+		VarPrecEarlySingleCRA(const unsigned long EARLY = DEFAULT_EARLY_TERM_THRESHOLD
+				      , const double b=0.0
+				      , const Integer& f=Integer(1)
+				      , const Integer& m=Integer(1)) :
+			EarlySingleCRA<Domain>(EARLY)
+			, FullMultipCRA<Domain>(b)
+			, factor_(f)
+			, multip_(m)
+		{
+			if (factor_ == 0 )
+			       	factor_ = 1;
+		}
+
+		VarPrecEarlySingleCRA(const VarPrecEarlySingleCRA& other) :
+			EarlySingleCRA<Domain>(other.EARLY_TERM_THRESHOLD)
+			, FullMultipCRA<Domain>(other.LOGARITHMIC_UPPER_BOUND)
+			, factor_(other.factor_), multip_(other.multip_)
+		{
+			factor_ = 1;
+		}
+
+		int getThreshold(int& t)
+		{
+			return t = EarlySingleCRA<Domain>::EARLY_TERM_THRESHOLD;
+		}
+
+		Integer& getModulus(Integer& m)
+		{
+			EarlySingleCRA<Domain>::getModulus(m);
+			return m;
+		}
+
+		/*
+		 * Residue is Result * M / F - this is the value that we are reconstructing
+		 */
+		Integer& getResidue(Integer& m)
+		{
+			EarlySingleCRA<Domain>::getResidue(m);
+			return m;
+		}
+
+		void initialize (const Integer& D, const Integer& e)
+		{
+			Integer z;
+			inv(z,factor_,D);
+			z*=e;
+			z*=multip_;
+			z%=D;
+
+			EarlySingleCRA<Domain>::initialize(D, z);
+			std::vector<Integer> v;
+			v.push_back(e);
+			FullMultipCRA<Domain>::initialize(D, v);
+		}
+
+		void initialize (const Domain& D, const DomainElement& e)
+		{
+			DomainElement z;
+			D.init(z,factor_);
+			D.invin(z);
+			D.mulin(z,e);
+			DomainElement m; D.init(m, multip_);
+			D.mulin(z,m);
+
+			EarlySingleCRA<Domain>::initialize(D, z);
+			std::vector<DomainElement> v;
+			v.push_back(e);
+			FullMultipCRA<Domain>::initialize(D, v);
+		}
+
+		void progress (const Integer& D,const  Integer& e)
+		{
+
+			Integer z;
+			// Could be much faster
+			// - do not compute twice the product of moduli
+			// - reconstruct one element of e until Early Termination,
+			//   then only, try a random linear combination.
+
+			inv(z,factor_,D);
+			z*=e;
+			z*=multip_;
+			z%=D;
+			//z = e / factor mod D;
+			EarlySingleCRA<Domain>::progress(D, z);
+
+			std::vector<Integer> v;
+			v.push_back(e);
+			FullMultipCRA<Domain>::progress(D, v);
+		}
+
+		void progress (const Domain& D, const DomainElement& e)
+		{
+
+			DomainElement z;
+			D.init(z,factor_);
+			D.invin(z);
+			D.mulin(z,e);
+			DomainElement m; D.init(m, multip_);
+			D.mulin(z,m);
+			//z = (e/ factor mod D)
+
+			// Could be much faster
+			// - do not compute twice the product of moduli
+			// - reconstruct one element of e until Early Termination,
+			//   then only, try a random linear combination.
+
+			EarlySingleCRA<Domain>::progress(D, z);
+
+			std::vector<DomainElement> v;
+			v.push_back(e);
+
+			FullMultipCRA<Domain>::progress(D, v);
+		}
+
+		bool terminated()
+		{
+			bool ET = EarlySingleCRA<Domain>::terminated();
+			if (FullMultipCRA<Domain>::LOGARITHMIC_UPPER_BOUND> 1.0) ET = ET || FullMultipCRA<Domain>::terminated();
+			return ET;
+		}
+
+		bool noncoprime(const Integer& i) const
+		{
+			return EarlySingleCRA<Domain>::noncoprime(i);
+		}
+
+		Integer& getFactor(Integer& f)
+		{
+			return f = factor_;
+		}
+
+		Integer& getMultip(Integer& m)
+		{
+			return m=multip_;
+		}
+
+		Integer& getPreconditioner(Integer& f, Integer& m)
+		{
+			getMultip(m);
+			getFactor(f);
+			return f;
+		}
+
+		Quotient& getPreconditioner(Quotient& q)
+		{
+			Integer m,f;
+			getPreconditioner(f,m);
+			return q=Quotient(m,f);
+		}
+
+		Integer& result(Integer& r)
+		{
+			if ((FullMultipCRA<Domain>::LOGARITHMIC_UPPER_BOUND> 1.0) && ( FullMultipCRA<Domain>::terminated() )) {
+				std::vector<Integer> v;
+				FullMultipCRA<Domain>::result(v);
+				return r = v.front();
+			}
+			else {
+				Integer z;
+				EarlySingleCRA<Domain>::result(z);
+				return (r=factor_*z/multip_);
+			}
+		}
+
+		Quotient& result(Quotient& q)
+		{
+			if ((FullMultipCRA<Domain>::LOGARITHMIC_UPPER_BOUND> 1.0) && ( FullMultipCRA<Domain>::terminated() )) {
+				std::vector<Integer> v;
+				FullMultipCRA<Domain>::result(v);
+				return q = v.front();
+			}
+			else {
+				Integer z;
+				EarlySingleCRA<Domain>::result(z);//residue
+				return (q=Quotient(factor_*z,multip_));
+
+			}
+		}
+
+		Integer& result(Integer& num, Integer& den)
+		{
+			if ((FullMultipCRA<Domain>::LOGARITHMIC_UPPER_BOUND> 1.0) && ( FullMultipCRA<Domain>::terminated() )) {
+				den =1;
+				std::vector<Integer> v;
+				FullMultipCRA<Domain>::result(v);
+				return num = v.front();
+			}
+			else {
+				Integer z;
+				EarlySingleCRA<Domain>::result(z);
+				den = multip_;
+				num = factor_*z;
+				return num;
+			}
+		}
+
+		/*
+		 * changes preconditioners and recomputes the residue
+		 */
+		bool changePreconditioner(const Integer& f, const Integer& m)
+		{
+			if ((factor_ == f) && (multip_==m)) return EarlySingleCRA<Domain>::terminated();
+
+			factor_ = f;
+			multip_ = m;
+			if (factor_==0) {factor_ = 1;}//no factor if factor==0
+
+			Integer e=0;
+
+			//clear CRAEarlySingle;
+			EarlySingleCRA<Domain>::occurency_ = 0;
+			EarlySingleCRA<Domain>::nextM_ = 1UL;
+			EarlySingleCRA<Domain>::primeProd_ = 1UL;
+			EarlySingleCRA<Domain>::residue_ = 0;
+
+			//Computation of residue_
+
+			//std::vector< double >::iterator  _dsz_it = RadixSizes_.begin();//nie wiem
+			std::vector< LazyProduct >::iterator          _mod_it = FullMultipCRA<Domain>::RadixPrimeProd_.end(); // list of prime products
+			std::vector< std::vector<Integer> >::iterator _tab_it = FullMultipCRA<Domain>::RadixResidues_.end();  // list of residues as vectors of size 1
+			std::vector< bool >::iterator                 _occ_it = FullMultipCRA<Domain>::RadixOccupancy_.end(); //flags of occupied fields
+			int n= FullMultipCRA<Domain>::RadixOccupancy_.size();
+			//std::vector<Integer> ri(1); LazyProduct mi; double di;//nie wiem
+			// could be much faster if max occupandy is stored
+			--_mod_it; --_tab_it; --_occ_it;
+			int prev_shelf=0, shelf = 0; Integer prev_residue_ =0;
+			for (int i=n; i > 0 ; --i, --_mod_it, --_tab_it, --_occ_it ) {
+				++shelf;
+				if (*_occ_it) {
+					Integer D = _mod_it->operator()();
+					Integer e;
+
+					inv(e,factor_,D);
+					e *= (_tab_it->front());
+					e *=multip_;
+					e %=D ;
+
+
+					prev_residue_ = EarlySingleCRA<Domain>::residue_;
+					EarlySingleCRA<Domain>::progress(D,e);
+
+					if (prev_residue_ == EarlySingleCRA<Domain>::residue_ )
+						EarlySingleCRA<Domain>::occurency_ = EarlySingleCRA<Domain>::occurency_ +  (shelf - prev_shelf);
+
+
+
+					if ( EarlySingleCRA<Domain>::terminated() ) {
+						return true;
+					}
+					prev_shelf = shelf;
+				}
+			}
+
+			return false;
+		}
+
+	};
+
+} //namespace LinBox
+
+#endif //__LINBOX_varprec_cra_early_single_H
+
diff --git a/linbox/algorithms/vector-fraction.h b/linbox/algorithms/vector-fraction.h
index 04a8e80..255e48e 100644
--- a/linbox/algorithms/vector-fraction.h
+++ b/linbox/algorithms/vector-fraction.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* linbox/algorithms/vector-fraction.h
  * Copyright (C) 2004 David Pritchard
  *
@@ -20,19 +21,21 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_VECTOR_FRACTION_H
-#define __LINBOX_VECTOR_FRACTION_H
+#ifndef __LINBOX_vector_fraction_H
+#define __LINBOX_vector_fraction_H
 
 #include <linbox/linbox-config.h>
 #include <stdio.h>
 #include <linbox/vector/vector-traits.h>
 #undef _D
 
-namespace LinBox {
-	
+namespace LinBox
+{
+
 	/** utility function to reduce a rational pair to lowest form */
 	template<class Domain>
-	void reduceIn(Domain& D, std::pair<typename Domain::Element, typename Domain::Element> &frac){
+	void reduceIn(Domain& D, std::pair<typename Domain::Element, typename Domain::Element> &frac)
+	{
 		linbox_check(!D.isZero(frac.second));
 
 		if (D.isZero(frac.first)){
@@ -50,10 +53,10 @@ namespace LinBox {
 	//this could be replaced by a fancier version that combines elements linearly at random
 	template<class Domain, class Vector>
 	void vectorGcdIn(typename Domain::Element& result, Domain& D, Vector& v) {
-		for (typename Vector::iterator i = v.begin(); i != v.end(); i++) 
+		for (typename Vector::iterator i = v.begin(); i != v.end(); i++)
 			D.gcdin(result, *i);
 	}
-	
+
 	/** utility function, returns gcd of a vector of elements over a domain */
 	// this could be replaced by a fancier version that combines elements linearly at random
 	template<class Domain, class Vector>
@@ -63,52 +66,55 @@ namespace LinBox {
 		vectorGcdIn(result, D, v);
 		return result;
 	}
-	
 
-	/** 
+
+	/**
 	 * \brief VectorFraction<Domain> is a vector of rational elements with common reduced denominator.
 	 * Here Domain is a ring supporting the gcd, eg NTL_ZZ or PID_integer
-	 *	 For compatability with the return type of rationalSolver, it allows conversion from/to 
+	 *	 For compatability with the return type of rationalSolver, it allows conversion from/to
 	 *       std::vector<std::pair<Domain::Element> >.
 	 *       All functions will return the fraction in reduced form, calling reduce() if necessary.
 	 */
 
-	template<class Domain> 
+	template<class Domain>
 	class VectorFraction{
 	public:
 		typedef typename Domain::Element Element;
 		typedef typename std::pair<Element, Element> Fraction;
 		typedef typename std::vector<Fraction> FVector;
 		typedef typename Vector<Domain>::Dense Vector;
-		
+
 		Vector numer;
 		Element denom;
 		const Domain& _D;
 		Element zero;
 
-		/** 
+		/**
 		 * constructor from vector of rational numbers
 		 * reduces individual pairs in-place first unless alreadyReduced=true
 		 */
-		VectorFraction(const Domain& D, FVector& frac) // bool alreadyReduced = false)
-			: _D(D) {
+		VectorFraction(const Domain& D, FVector& frac
+			       //,bool alreadyReduced = false
+			      ) :
+			_D(D)
+		{
 			bool alreadyReduced = false;
 			typename FVector::iterator i;
 
 			D.init(zero, 0);
 			D.init(denom, 1);
-			if (!alreadyReduced) 
-				for (i=frac.begin(); i!=frac.end(); i++) 
+			if (!alreadyReduced)
+				for (i=frac.begin(); i!=frac.end(); i++)
 					reduceIn(D, *i);
 
 			for (i=frac.begin(); i!=frac.end(); i++) {
 				linbox_check(!D.isZero(i->second));
 				D.lcmin(denom, i->second);
 			}
-			
+
 			numer = Vector(frac.size());
 			typename Vector::iterator j;
-			
+
 			for (i=frac.begin(), j=numer.begin(); i!=frac.end(); i++, j++){
 				D.mul(*j, denom, i->first);
 				D.divin(*j, i->second);
@@ -116,37 +122,41 @@ namespace LinBox {
 		}
 
 		/** allocating constructor, returns [0, 0, ... 0]/1 */
-		VectorFraction(const Domain& D, size_t n) 
-			: _D(D) {
+		VectorFraction(const Domain& D, size_t n) :
+			_D(D)
+		{
 			D.init(zero, 0);
 			D.init(denom, 1);
 			numer = Vector(n);
 			typename Vector::iterator j;
-			
+
 			for (j=numer.begin(); j!=numer.end(); j++)
 				D.assign(*j, zero);
 		}
-		
+
 		/** copy constructor */
-		VectorFraction(const VectorFraction<Domain>& VF) 
-			: _D(VF._D) {
+		VectorFraction(const VectorFraction<Domain>& VF) :
+			_D(VF._D)
+		{
 			copy(VF);
 		}
 
 		/** copy without construction */
-		void copy(const VectorFraction<Domain>& VF) {
+		void copy(const VectorFraction<Domain>& VF)
+		{
 			//assumes _D = VF._D
 			denom = VF.denom;
 			numer.resize(VF.numer.size());
 			typename Vector::iterator i;
 			typename Vector::const_iterator j;
-		  
+
 			for (i=numer.begin(), j=VF.numer.begin(); i!=numer.end(); i++, j++)
 				_D.assign(*i, *j);
 		}
-		
+
 		/** clear and resize without construction */
-		void clearAndResize(size_t size) {
+		void clearAndResize(size_t size)
+		{
 			_D.init(denom, 1);
 			typename Vector::iterator i;
 			numer.resize(size);
@@ -154,13 +164,14 @@ namespace LinBox {
 				_D.init(*i, 0);
 		}
 
-		/** 
-		 * Replaces *this with a linear combination of *this and other 
+		/**
+		 * Replaces *this with a linear combination of *this and other
 		 * such that the result has denominator == gcd(this->denom, other.denom)
 		 * see Mulders+Storjohann : 'Certified Dense Linear System Solving' Lemma 2.1
 		 * return value of true means that there was some improvement (ie denom was reduced)
 		 */
-		bool combineSolution(const VectorFraction<Domain>& other) { 
+		bool combineSolution(const VectorFraction<Domain>& other)
+		{
 			if (_D.isDivisor(other.denom, denom)) return false;
 			if (_D.isDivisor(denom, other.denom)) {
 				denom = other.denom;
@@ -183,18 +194,19 @@ namespace LinBox {
 			return false;
 		}
 
-		/** 
-		 * Adds in-place to *this a multiple of other 
+		/**
+		 * Adds in-place to *this a multiple of other
 		 * such that the result has gcd(denominator, denBound) == gcd(this->denom, other.denom, denBound)
 		 * see Mulders+Storjohann : 'Certified Dense Linear System Solving' Lemma 6.1
 		 * return value of true means that there was some improvement (ie gcd(denom, denBound) was reduced)
 		 * g is gcd(denom, denBound), and is updated by this function when there is improvement
 		 */
-		bool boundedCombineSolution(const VectorFraction<Domain>& other, const Element& denBound, Element& g) {
+		bool boundedCombineSolution(const VectorFraction<Domain>& other, const Element& denBound, Element& g)
+		{
 
 			//this means that new solution won't reduce g
 			if (_D.isDivisor(other.denom, g)) return false;
-			
+
 			//short-circuit in case the new solution is completely better than old one
 			Element _dtmp;
 			if (_D.isDivisor(g, _D.gcd(_dtmp, denBound, other.denom))) {
@@ -220,27 +232,28 @@ namespace LinBox {
 				_D.gcd(g2, lincomb, denBound);
 			}
 			while (!_D.areEqual(g, g2));
-			
+
 			_D.assign(denom, lincomb);
 			typename Vector::iterator it=numer.begin();
 			typename Vector::const_iterator io=other.numer.begin();
-			for (; it != numer.end(); it++, io++) 
+			for (; it != numer.end(); it++, io++)
 				_D.axpyin(*it, A, *io);
 			return true;
 		}
 
-		/** 
+		/**
 		 * Adds in-place to *this a multiple of other to create an improved certificate ("z")
 		 * n1/d1 = *this . b, n2/d2 = other . b   in reduced form
 		 * n1/d1 are updated so that new denominator is lcm(d1, d2);
 		 * see Mulders+Storjohann : 'Certified Dense Linear System Solving' Lemma 6.2
 		 * return value of true means that there was some improvement (ie d1 was increased)
 		 */
-		bool combineCertificate(const VectorFraction<Domain>& other, Element& n1, Element& d1, 
-					const Element& n2, const Element d2) {
+		bool combineCertificate(const VectorFraction<Domain>& other, Element& n1, Element& d1,
+					const Element& n2, const Element d2)
+		{
 			//this means that new solution won't reduce g
 			if (_D.isDivisor(d1, d2)) return false;
-			
+
 			//short-circuit in case the new solution is completely better than old one
 			if (_D.isDivisor(d2, d1)) {
 				copy(other);
@@ -254,7 +267,7 @@ namespace LinBox {
 			_D.gcd(g, d1, d2);   //compute gcd
 			_D.mul(l, d1, d2);
 			_D.divin(l, g);      //compute lcm
-			
+
 			_D.div(n1d2_g, d2, g);
 			_D.mulin(n1d2_g, n1);   //compute n1.d2/g
 			_D.div(n2d1_g, d1, g);
@@ -275,7 +288,7 @@ namespace LinBox {
 				_D.gcd(g2, lincomb, l);
 			}
 			while (!_D.areEqual(one, g2));
-			
+
 			this->axpyin(A, other);
 			_D.lcmin(d1, d2);
 
@@ -286,12 +299,13 @@ namespace LinBox {
 		 * this += a * x.   performs a rational axpy with an integer multiplier
 		 * returns (*this)
 		 */
-		VectorFraction<Domain>& axpyin(Element& a, const VectorFraction<Domain>& x) {
+		VectorFraction<Domain>& axpyin(Element& a, const VectorFraction<Domain>& x)
+		{
 			Element a_prime, gcd_a_xdenom, xdenom_prime;
 			_D.gcd(gcd_a_xdenom, a, x.denom);
 			_D.div(a_prime, a, gcd_a_xdenom);
 			_D.div(xdenom_prime, x.denom, gcd_a_xdenom);
-			
+
 			Element cdf; //common denominator factor; multiply both sides by this and divide at end
 			_D.gcd(cdf, denom, xdenom_prime);
 			_D.divin(denom, cdf);
@@ -307,7 +321,7 @@ namespace LinBox {
 				_D.mulin(*i, xdenom_prime);
 				_D.axpyin(*i, a_prime, *j);
 			}
-			
+
 			_D.mulin(denom, cdf);
 			_D.mulin(denom, xdenom_prime);
 			simplify();
@@ -315,7 +329,8 @@ namespace LinBox {
 		}
 
 		/** write to a stream */
-		std::ostream& write(std::ostream& os) const {
+		std::ostream& write(std::ostream& os) const
+		{
 			os << "[";
 			for (typename Vector::const_iterator it=numer.begin(); it != numer.end(); it++) {
 				if (it != numer.begin()) os << " ";
@@ -323,9 +338,10 @@ namespace LinBox {
 			}
 			return os << "]/" << denom;
 		}
-		
+
 		/** convert to 'answer' type of lifting container */
-		FVector& toFVector(FVector& result) const {
+		FVector& toFVector(FVector& result) const
+		{
 			linbox_check(numer.size()==result.size());
 			typename Vector::const_iterator it=numer.begin();
 			typename FVector::iterator ir=result.begin();
@@ -337,18 +353,20 @@ namespace LinBox {
 		}
 
 		/** reduces to simplest form, returns (*this) */
-		VectorFraction<Domain>& simplify() { 
+		VectorFraction<Domain>& simplify()
+		{
 			typename Vector::iterator i;
 			Element gcd;
 			_D.init(gcd, denom);
 			vectorGcdIn(gcd, _D, numer);
-			
+
 			_D.divin(denom, gcd);
-			for (i=numer.begin(); i!=numer.end(); i++) 
+			for (i=numer.begin(); i!=numer.end(); i++)
 				_D.divin(*i, gcd);
 			return (*this);
 		}
 	};
 
 }
-#endif
+
+#endif //__LINBOX_vector_fraction_H
diff --git a/linbox/algorithms/whisart_trace.h b/linbox/algorithms/whisart_trace.h
new file mode 100644
index 0000000..8549a1b
--- /dev/null
+++ b/linbox/algorithms/whisart_trace.h
@@ -0,0 +1,200 @@
+/* -*- 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
+/* linbox/algorithms/cra-domain.h
+ * Copyright (C) 1999-2010 The LinBox group
+ *
+ * Time-stamp: <19 Apr 10 18:35:14 Jean-Guillaume.Dumas at imag.fr>
+ * Computes the trace of D1 B D2 B^T D1 or D1 B^T D2 B D1
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifndef __LINBOX_whisart_trace_H
+#define __LINBOX_whisart_trace_H
+
+#include "linbox/blackbox/compose.h"
+#include "linbox/blackbox/transpose.h"
+#include "linbox/blackbox/dense.h"
+#include "linbox/blackbox/sparse.h"
+#include "linbox/blackbox/lambda-sparse.h"
+// #include "linbox/blackbox/subrowmatrix.h"
+#include "linbox/solutions/trace.h"
+
+namespace LinBox
+{
+
+	// Trait to show whether or not the BB class has a RawIndexed iterator
+	template<class BB> struct RawIndexedCategory;
+
+	/// limited doc so far
+	namespace RawIndexedTags
+	{
+		struct HasRawIndexed{};
+		struct NoRawIndexed{};
+	};
+
+	template<class BB> struct RawIndexedCategory {
+	typedef RawIndexedTags::NoRawIndexed Tag;
+	};
+
+	template<class Field>
+	struct RawIndexedCategory< DenseMatrix<Field> > 	{
+		typedef RawIndexedTags::HasRawIndexed Tag; };
+
+	template<class Field, class Row>
+	struct RawIndexedCategory< LambdaSparseMatrix<Field,Row> > 	{
+		typedef RawIndexedTags::HasRawIndexed Tag; };
+
+	template<class Field, class Row>
+	struct RawIndexedCategory< SparseMatrix<Field,Row> > 	{
+		typedef RawIndexedTags::HasRawIndexed Tag; };
+
+#if 0
+	template<class Matrix, class MatrixCategory>
+	struct RawIndexedCategory< SubRowMatrix<Matrix,MatrixCategory> > 	{
+		typedef RawIndexedTags::HasRawIndexed Tag;
+	};
+#endif
+
+
+
+	template<class Field, class BB>
+	typename Field::Element& WhisartTrace(
+					      typename Field::Element& trace,
+					      const Field& F,
+					      const LinBox::Diagonal<Field>& ExtD,
+					      const BB& A,
+					      const LinBox::Diagonal<Field>& InD)
+	{
+		return WhisartTrace(trace, F, ExtD, A, InD, typename RawIndexedCategory<BB>::Tag() );
+	}
+
+	template<class Field, class BB>
+	typename Field::Element& WhisartTraceTranspose(
+						       typename Field::Element& trace,
+						       const Field& F,
+						       const LinBox::Diagonal<Field>& ExtD,
+						       const BB& A,
+						       const LinBox::Diagonal<Field>& InD)
+	{
+		return WhisartTraceTranspose(trace, F, ExtD, A, InD, typename RawIndexedCategory<BB>::Tag() );
+	}
+
+	template<class Field, class BB>
+	typename Field::Element& WhisartTrace(
+					      typename Field::Element& tr,
+					      const Field& F,
+					      const LinBox::Diagonal<Field>& ExtD,
+					      const BB& A,
+					      const LinBox::Diagonal<Field>& InD, RawIndexedTags::NoRawIndexed t)
+	{
+		// Trace of ExtD B InD B^T ExtD
+		typedef Compose<Diagonal<Field>, BB > C_DB;
+		C_DB	B1 (&ExtD, 	&A); 	// D1 A
+		typedef Compose<C_DB, Diagonal<Field> > C_DBD;
+		C_DBD 	B2 (&B1,   	&InD);	// D1 A D2
+		Transpose<BB> AT (&A);
+		typedef Compose<C_DBD, Transpose<BB> > C_DBDBt;
+		C_DBDBt	B3 (&B2, 	&AT);	// D1 A D2 A^T
+		typedef Compose<C_DBDBt, Diagonal<Field> > C_DBDBtD;
+		C_DBDBtD 	B  (&B3, 	&ExtD);	// D1 A D2 A^T D1
+		return trace(tr, B);
+	}
+
+	template<class Field, class BB>
+	typename Field::Element& WhisartTraceTranspose(
+						       typename Field::Element& tr,
+						       const Field& F,
+						       const LinBox::Diagonal<Field>& ExtD,
+						       const BB& A,
+						       const LinBox::Diagonal<Field>& InD,
+						       RawIndexedTags::NoRawIndexed t)
+	{
+		// Trace of ExtD A^T  InD A ExtD
+		Transpose<BB> AT (&A);
+		typedef Compose<Diagonal<Field>,Transpose<BB> > C_DBt;
+		C_DBt	B1 (&ExtD, 	&AT); 	// D1 A^T
+		typedef Compose<C_DBt, Diagonal<Field> > C_DBtD;
+		C_DBtD 	B2 (&B1,   	&InD);	// D1 A^T D2
+		typedef Compose<C_DBtD, BB> C_DBtDB;
+		C_DBtDB	B3 (&B2, 	&A);	// D1 A^T D2 A
+		typedef Compose<C_DBtDB, Diagonal<Field> > C_DBtDBD;
+		C_DBtDBD 	B  (&B3, 	&ExtD);	// D1 A^T D2 A D1
+		return trace(tr, B);
+	}
+
+
+
+	template<class Field, class BB>
+	typename Field::Element& WhisartTrace(
+					      typename Field::Element& tr,
+					      const Field& F,
+					      const LinBox::Diagonal<Field>& ExtD,
+					      const BB& A,
+					      const LinBox::Diagonal<Field>& InD,
+					      RawIndexedTags::HasRawIndexed )
+	{
+		// Trace of ExtD B InD B^T ExtD
+		// is sum ExtD_i^2 B_{i,j} InD_j
+		F.init(tr, 0);
+		for(typename BB::ConstRawIndexedIterator it = A.rawIndexedBegin();
+		    it != A.rawIndexedEnd(); ++it) {
+			typename Field::Element tmp,e,i; F.init(tmp);F.init(e);F.init(i);
+			F.mul(tmp,it.value(),it.value());
+			ExtD.getEntry(e, it.rowIndex(),it.rowIndex());
+			InD.getEntry(i, it.colIndex(),it.colIndex());
+			F.mulin(tmp,e);
+			F.mulin(tmp,e);
+			F.mulin(tmp,i);
+			F.addin(tr, tmp);
+		}
+		return tr;
+	}
+
+	template<class Field, class BB>
+	typename Field::Element& WhisartTraceTranspose(
+						       typename Field::Element& tr,
+						       const Field& F,
+						       const LinBox::Diagonal<Field>& ExtD,
+						       const BB& A,
+						       const LinBox::Diagonal<Field>& InD,
+						       RawIndexedTags::HasRawIndexed )
+	{
+		// Trace of ExtD B^T  InD B ExtD
+		// is sum ExtD_j^2 B_{i,j} InD_i
+		F.init(tr, 0);
+		for(typename BB::ConstRawIndexedIterator it = A.rawIndexedBegin();
+		    it != A.rawIndexedEnd(); ++it) {
+
+			typename Field::Element tmp,e,i;
+			F.init(tmp);F.init(e);F.init(i);
+
+			F.mul(tmp, it.value(),it.value());
+			ExtD.getEntry(e, it.colIndex(),it.colIndex());
+			InD.getEntry(i, it.rowIndex(),it.rowIndex());
+			F.mulin(tmp,e);
+			F.mulin(tmp,e);
+			F.mulin(tmp,i);
+			F.addin(tr, tmp);
+		}
+
+		return tr;
+	}
+
+
+
+}
+#endif //__LINBOX_whisart_trace_H
+
diff --git a/linbox/algorithms/wiedemann.doxy b/linbox/algorithms/wiedemann.doxy
new file mode 100644
index 0000000..5eb4d13
--- /dev/null
+++ b/linbox/algorithms/wiedemann.doxy
@@ -0,0 +1,10 @@
+// Copyright (C) 2010 LinBox, GNU LGPL, see COPYING for licence information
+
+/** @ingroup algorithms
+  @defgroup wiedemann Wiedemann
+  @brief NO DOC YET
+
+
+ */
+
+// vim:syntax=doxygen
diff --git a/linbox/algorithms/wiedemann.h b/linbox/algorithms/wiedemann.h
index 6ff13c3..9de6628 100644
--- a/linbox/algorithms/wiedemann.h
+++ b/linbox/algorithms/wiedemann.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/algorithms/wiedemann.h
  * Copyright (C) 2002 Zhendong Wan
  * Copyright (C) 2002 Bradford Hovinen
@@ -40,175 +40,319 @@
  * See COPYING for license information.
  */
 
-#ifndef __WIEDEMANN_H
-#define __WIEDEMANN_H
+#ifndef __LINBOX_wiedemann_H
+#define __LINBOX_wiedemann_H
+
+/*! @file algorithms/wiedemann.h
+ * @ingroup algorithms
+ * @brief minpoly computation and Wiedeman solvers.
+ */
 
 #include <vector>
 #include <algorithm>
 
 #include "linbox/blackbox/archetype.h"
+#include "linbox/blackbox/squarize.h"
 #include "linbox/blackbox/sparse.h"
 #include "linbox/util/debug.h"
 #include "linbox/vector/vector-domain.h"
 #include "linbox/solutions/methods.h"
 
-namespace LinBox 
+#include "linbox/algorithms/blackbox-container.h"
+#include "linbox/algorithms/blackbox-container-symmetric.h"
+
+// massey recurring sequence solver
+#include "linbox/algorithms/massey-domain.h"
+
+namespace LinBox
 {
 
-/** \brief Linear system solvers based on Wiedemann's method.
- * 
- * This class encapsulates all of the functionality for linear system
- * solving with Wiedemann's algorithm. It includes the random solution and
- * random nullspace element of Kaltofen and Saunders (1991), as well as the
- * certificate of inconsistency of Giesbrecht, Lobo, and Saunders (1998).
- */
 
-template <class Field>
-class WiedemannSolver 
+	template<class Polynomial, class Blackbox>
+	Polynomial &minpoly (Polynomial& P,
+			     const Blackbox& A,
+			     RingCategories::ModularTag tag,
+			     const Method::Wiedemann& M = Method::Wiedemann ())
+	{
+		typedef typename Blackbox::Field Field;
+		typename Field::RandIter i (A.field());
+		unsigned long            deg;
+
+		commentator.start ("Wiedemann Minimal polynomial", "minpoly");
+
+		if (A.coldim() != A.rowdim()) {
+			commentator.report(Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION) << "Virtually squarize matrix" << std::endl;
+
+			Squarize<Blackbox> B(&A);
+			BlackboxContainer<Field, Squarize<Blackbox> > TF (&B, A.field(), i);
+			MasseyDomain< Field, BlackboxContainer<Field, Squarize<Blackbox> > > WD (&TF, M.earlyTermThreshold ());
+
+			WD.minpoly (P, deg);
+		}
+		else if (M.symmetric ()) {
+			typedef BlackboxContainerSymmetric<Field, Blackbox> BBContainerSym;
+			BBContainerSym TF (&A, A.field(), i);
+			MasseyDomain< Field, BBContainerSym > WD (&TF, M.earlyTermThreshold ());
+
+			WD.minpoly (P, deg);
+		}
+		else {
+			typedef BlackboxContainer<Field, Blackbox> BBContainer;
+			BBContainer TF (&A, A.field(), i);
+			MasseyDomain< Field, BBContainer > WD (&TF, M.earlyTermThreshold ());
+
+			WD.minpoly (P, deg);
+#ifdef INCLUDE_TIMING
+			commentator.report (Commentator::LEVEL_IMPORTANT, TIMING_MEASURE)
+			<< "Time required for applies:      " << TF.applyTime () << std::endl;
+			commentator.report (Commentator::LEVEL_IMPORTANT, TIMING_MEASURE)
+			<< "Time required for dot products: " << TF.dotTime () << std::endl;
+			commentator.report (Commentator::LEVEL_IMPORTANT, TIMING_MEASURE)
+			<< "Time required for discrepency:  " << WD.discrepencyTime () << std::endl;
+			commentator.report (Commentator::LEVEL_IMPORTANT, TIMING_MEASURE)
+			<< "Time required for LSR fix:      " << WD.fixTime () << std::endl;
+#endif // INCLUDE_TIMING
+		}
+
+
+
+		commentator.stop ("done", NULL, "minpoly");
+
+		return P;
+	}
+}
+
+#ifdef __LINBOX_HAVE_GIVARO
+#ifndef LINBOX_EXTENSION_DEGREE_MAX
+#define LINBOX_EXTENSION_DEGREE_MAX 19
+#endif
+
+#include "linbox/blackbox/sparse.h"
+#include "linbox/field/modular.h"
+#include "linbox/algorithms/matrix-hom.h"
+#include "linbox/field/givaro-extension.h"
+#include "linbox/field/map.h"
+
+namespace LinBox
 {
-    public:
+	// The minpoly with BlackBox Method
+	template<class Polynomial, class Blackbox>
+	Polynomial &minpoly (
+			     Polynomial         &P,
+			     const Blackbox                            &A,
+			     const RingCategories::ModularTag          &tag,
+			     const Method::ExtensionWiedemann& M)
+	{
+		typedef typename Blackbox::Field Field;
+		const Field& F = A.field();
+		integer a,c; F.cardinality(a); F.characteristic(c);
+		if (a != c) {
+			unsigned long extend = (unsigned long)FF_EXPONENT_MAX(a,(integer)LINBOX_EXTENSION_DEGREE_MAX);
+			if (extend > 1) {
+				commentator.report (Commentator::LEVEL_ALWAYS,INTERNAL_WARNING) << "Extension of degree " << extend << std::endl;
+				GivaroExtension<Field> EF( F, extend);
 
-	/// { OK, FAILED, SINGULAR, INCONSISTENT, BAD_PRECONDITIONER }
-	enum ReturnStatus {
-		OK, FAILED, SINGULAR, INCONSISTENT, BAD_PRECONDITIONER
-	};
+				typedef typename Blackbox::template rebind< GivaroExtension<Field>  >::other FBlackbox;
 
-	/** Constructor
-	 * @param F Field over which to operate
-	 * @param traits @ref{SolverTraits} structure describing user
-	 *               options for the solver 
-	 */
-	WiedemannSolver (const Field &F, const WiedemannTraits &traits)
-		: _traits (traits), _F (F), _randiter (F), _VD (F)
-	{}
-
-	/** Constructor with a random iterator
-	 * @param F Field over which to operate
-	 * @param traits @ref{SolverTraits} structure describing user
-	 *               options for the solver 
-	 * @param r Random iterator to use for randomization
-	 */
-	WiedemannSolver (const Field &F,
-			 const WiedemannTraits &traits,
-			 typename Field::RandIter r)
-		: _traits (traits), _F (F), _randiter (r), _VD (F)
-	{}
+				FBlackbox Ap(A, EF);
 
-	// @name Solvers
-	// try to make the idea work doxy
-	/// \defgroup Solvers
+				std::vector< typename GivaroExtension<Field>::Element > eP;
+				minpoly(eP, Ap, tag, Method::Wiedemann(M));
 
-	//@{
+				return PreMap<Field, GivaroExtension<Field> >(F,EF)(P, eP);
+			}
+			else
+				return minpoly(P, A, tag, Method::Wiedemann(M));
 
-	/** Solve a system Ax=b, giving a random solution if the system is
-	 * singular and consistent, and a certificate of inconsistency (if
-	 * specified in traits parameter at construction time) otherwise.
-	 *
-	 * @param A Black box of linear system
-	 * @param x Vector in which to store solution
-	 * @param b Right-hand side of system
-	 * @param u Vector in which to store certificate of inconsistency
-	 * @return Reference to solution vector
-	 */
-	template<class Blackbox, class Vector>	
-	ReturnStatus solve (const Blackbox&A, Vector &x, const Vector &b, Vector &u);
+		}
+		else {
+			unsigned long extend = (unsigned long)FF_EXPONENT_MAX(c,(integer)LINBOX_EXTENSION_DEGREE_MAX);
+			if (extend > 1) {
+				commentator.report (Commentator::LEVEL_ALWAYS,INTERNAL_WARNING) << "Word size extension : " << extend << std::endl;
+				GivaroGfq EF( (unsigned long)c, extend);
+				typedef typename Blackbox::template rebind< GivaroGfq >::other FBlackbox;
+				FBlackbox Ap(A, EF);
+				std::vector< typename GivaroGfq::Element > eP;
+				minpoly(eP, Ap, tag, Method::Wiedemann(M));
+				return PreMap<Field, GivaroGfq >(F,EF)(P, eP);
 
-	/** Solve a nonsingular system Ax=b.
-	 *
-	 * This is a "Las Vegas" method, which makes use of randomization. It
-	 * attempts to certify that the system solution is correct. It will only
-	 * make one attempt to solve the system before giving up.
-	 *
-	 * @param A Black box of linear system
-	 * @param x Vector in which to store solution
-	 * @param b Right-hand side of system
-	 * @param useRandIter true if solveNonsingular should use a random
-	 *                    iterator for the Krylov sequence computation;
-	 *                    false if it should use the right-hand side
-	 * @return Reference to solution vector
-	 */
-	template<class Blackbox, class Vector>
-	ReturnStatus solveNonsingular (const Blackbox&A,
-				       Vector &x,
-				       const Vector &b,
-				       bool useRandIter = false);
+			}
+			else
+				return minpoly(P, A, tag, Method::Wiedemann(M));
+		}
+	}
+}
+#else
+namespace LinBox
+{
+	// The minpoly with BlackBox Method
+	template<class Polynomial, class Blackbox>
+	Polynomial &minpoly (
+			     Polynomial         &P,
+			     const Blackbox                            &A,
+			     const RingCategories::ModularTag          &tag,
+			     const Method::ExtensionWiedemann& M)
+	{
+		commentator.report (Commentator::LEVEL_ALWAYS,INTERNAL_WARNING) << " WARNING, no extension available, returning only a factor of the minpoly\n";
+		return minpoly(P, A, tag, Method::Wiedemann (M));
+	}
+}
+#endif
 
-	/** Solve a general singular linear system.
-	 *
-	 * @param A Black box of linear system
-	 * @param x Vector in which to store solution
-	 * @param b Right-hand side of system
-	 * @param u Vector into which certificate of inconsistency will be stored
-	 * @param r Rank of A
-	 * @return Return status
-	 */
-	template<class Blackbox, class Vector>
-	ReturnStatus solveSingular (const Blackbox&A,
-				    Vector &x,
-				    const Vector &b,
-				    Vector &u,
-				    unsigned long r);
-
-	/** Get a random solution to a singular system Ax=b of rank r with
-	 * generic rank profile.
-	 *
-	 * @param A Black box of linear system
-	 * @param x Vector in which to store solution
-	 * @param b Right-hand side of system
-	 * @param r Rank of A
-	 * @param P Left preconditioner (NULL if none needed)
-	 * @param Q Right preconditioner (NULL if none needed)
-	 * @return Return status
-	 */
-	template<class Blackbox, class Vector, class Prec1, class Prec2>
-	ReturnStatus findRandomSolution (const Blackbox          &A,
-					 Vector                  &x,
-					 const Vector            &b,
-					 size_t                   r,
-					 const Prec1             *P,
-					 const Prec2             *Q);
-
-	/** Get a random element of the right nullspace of A.
+namespace LinBox
+{
+	/** \brief Linear system solvers based on Wiedemann's method.
 	 *
-	 * @param x Vector in which to store nullspace element
-	 * @param A Black box of which to find nullspace element
+	 * This class encapsulates all of the functionality for linear system
+	 * solving with Wiedemann's algorithm. It includes the random solution and
+	 * random nullspace element of Kaltofen and Saunders (1991), as well as the
+	 * certificate of inconsistency of Giesbrecht, Lobo, and Saunders (1998).
 	 */
-	template<class Blackbox, class Vector>
-	ReturnStatus findNullspaceElement (Vector                &x,
-					   const Blackbox        &A);
+	template <class Field>
+	class WiedemannSolver {
+	public:
 
-	/** Get a certificate u that the given system Ax=b is
-	 * inconsistent, if one can be found.
-	 *
-	 * @param u Vector in which to store certificate
-	 * @param A Black box for the linear system
-	 * @param b Right-hand side for the linear system
-	 * @param r Rank of A
-	 * @param P Left preconditioner, if applicable
-	 * @return true if a certificate can be found in one iteration; u
-	 *         is filled in with that certificate; and false otherwise
-	 */
-	template<class Blackbox, class Vector>
-	bool certifyInconsistency (Vector                          &u,
-				   const Blackbox                  &A,
-				   const Vector                    &b);
+		/// { OK, FAILED, SINGULAR, INCONSISTENT, BAD_PRECONDITIONER }
+		enum ReturnStatus {
+			OK, FAILED, SINGULAR, INCONSISTENT, BAD_PRECONDITIONER
+		};
 
-	//@}
+		/*! Constructor.
+		 *
+		 * @param F Field over which to operate
+		 * @param traits @ref SolverTraits  structure describing user
+		 *               options for the solver
+		 */
+		WiedemannSolver (const Field &F, const WiedemannTraits &traits) :
+			_traits (traits), _F (F), _randiter (F), _VD (F)
+		{}
 
+		/*! Constructor with a random iterator.
+		 *
+		 * @param F Field over which to operate
+		 * @param traits @ref SolverTraits  structure describing user
+		 *               options for the solver
+		 * @param r Random iterator to use for randomization
+		 */
+		WiedemannSolver (const Field &F,
+				 const WiedemannTraits &traits,
+				 typename Field::RandIter r) :
+			_traits (traits), _F (F), _randiter (r), _VD (F)
+		{}
 
-    private:
+		/// \ingroup algorithms
+		/// \defgroup Solvers Solvers
 
-	// Make an m x m lambda-sparse matrix, c.f. Mulders (2000)
-	SparseMatrix<Field> *makeLambdaSparseMatrix (size_t m);
+		//@{
 
-	const WiedemannTraits &_traits;
-	const Field                         &_F;
-	typename Field::RandIter             _randiter;
-	VectorDomain<Field>                  _VD;
-};
+		/*! Solve a system Ax=b, giving a random solution if the system is
+		 * singular and consistent, and a certificate of inconsistency (if
+		 * specified in traits parameter at construction time) otherwise.
+		 *
+		 * @param A Black box of linear system
+		 * @param x Vector in which to store solution
+		 * @param b Right-hand side of system
+		 * @param u Vector in which to store certificate of inconsistency
+		 * @return Reference to solution vector
+		 */
+		template<class Blackbox, class Vector>
+		ReturnStatus solve (const Blackbox&A, Vector &x, const Vector &b, Vector &u);
+
+		/*! Solve a nonsingular system Ax=b.
+		 *
+		 * This is a "Las Vegas" method, which makes use of randomization. It
+		 * attempts to certify that the system solution is correct. It will only
+		 * make one attempt to solve the system before giving up.
+		 *
+		 * @param A Black box of linear system
+		 * @param x Vector in which to store solution
+		 * @param b Right-hand side of system
+		 * @param useRandIter true if solveNonsingular should use a random
+		 *                    iterator for the Krylov sequence computation;
+		 *                    false if it should use the right-hand side
+		 * @return Reference to solution vector
+		 */
+		template<class Blackbox, class Vector>
+		ReturnStatus solveNonsingular (const Blackbox&A,
+					       Vector &x,
+					       const Vector &b,
+					       bool useRandIter = false);
+
+		/*! Solve a general singular linear system.
+		 *
+		 * @param A Black box of linear system
+		 * @param x Vector in which to store solution
+		 * @param b Right-hand side of system
+		 * @param u Vector into which certificate of inconsistency will be stored
+		 * @param r Rank of A
+		 * @return Return status
+		 */
+		template<class Blackbox, class Vector>
+		ReturnStatus solveSingular (const Blackbox&A,
+					    Vector &x,
+					    const Vector &b,
+					    Vector &u,
+					    unsigned long r);
+
+		/*! Get a random solution to a singular system Ax=b of rank r with
+		 * generic rank profile.
+		 *
+		 * @param A Black box of linear system
+		 * @param x Vector in which to store solution
+		 * @param b Right-hand side of system
+		 * @param r Rank of A
+		 * @param P Left preconditioner (NULL if none needed)
+		 * @param Q Right preconditioner (NULL if none needed)
+		 * @return Return status
+		 */
+		template<class Blackbox, class Vector, class Prec1, class Prec2>
+		ReturnStatus findRandomSolution (const Blackbox          &A,
+						 Vector                  &x,
+						 const Vector            &b,
+						 size_t                   r,
+						 const Prec1             *P,
+						 const Prec2             *Q);
+
+		/*! Get a random element of the right nullspace of A.
+		 *
+		 * @param x Vector in which to store nullspace element
+		 * @param A Black box of which to find nullspace element
+		 */
+		template<class Blackbox, class Vector>
+		ReturnStatus findNullspaceElement (Vector                &x,
+						   const Blackbox        &A);
+
+		/*! Get a certificate \p u that the given system \f$Ax=b\f$ is
+		 * inconsistent, if one can be found.
+		 *
+		 * @param u Vector in which to store certificate
+		 * @param A Blackbox for the linear system
+		 * @param b Right-hand side for the linear system
+		 * @return \p true if a certificate can be found in one iteration; \p u
+		 *         is filled in with that certificate; and \p false otherwise
+		 */
+		template<class Blackbox, class Vector>
+		bool certifyInconsistency (Vector                          &u,
+					   const Blackbox                  &A,
+					   const Vector                    &b);
+
+		//@}
+
+
+	private:
+
+		// Make an m x m lambda-sparse matrix, c.f. Mulders (2000)
+		SparseMatrix<Field> *makeLambdaSparseMatrix (size_t m);
+
+		WiedemannTraits _traits;
+		const Field                         &_F;
+		typename Field::RandIter             _randiter;
+		VectorDomain<Field>                  _VD;
+	};
 
 }
 
 #include "linbox/algorithms/wiedemann.inl"
 
-#endif // __WIEDEMANN_H
+#endif //  __LINBOX_wiedemann_H
+
diff --git a/linbox/algorithms/wiedemann.inl b/linbox/algorithms/wiedemann.inl
index c39edd9..291ea03 100644
--- a/linbox/algorithms/wiedemann.inl
+++ b/linbox/algorithms/wiedemann.inl
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/algorithms/wiedemann.inl
  * Copyright (C) 2002 Zhendong Wan
  * Copyright (C) 2002 Bradford Hovinen
@@ -34,24 +34,26 @@
  * See COPYING for license information.
  */
 
-#ifndef __WIEDEMANN_INL
-#define __WIEDEMANN_INL
+#ifndef __LINBOX_wiedemann_INL
+#define __LINBOX_wiedemann_INL
 
 #include <vector>
 #include <algorithm>
 
+#include "linbox/solutions/minpoly.h"
 #include "linbox/algorithms/wiedemann.h"
 #include "linbox/blackbox/submatrix.h"
 #include "linbox/blackbox/butterfly.h"
 #include "linbox/blackbox/transpose.h"
 #include "linbox/algorithms/blackbox-container.h"
 #include "linbox/algorithms/blackbox-container-symmetric.h"
-#include "linbox/algorithms/massey-domain.h" 
+//#include "linbox/algorithms/blackbox-container-generic.h"
+#include "linbox/algorithms/massey-domain.h"
 #include "linbox/switch/cekstv.h"
 #include "linbox/solutions/rank.h"
 #include "linbox/vector/stream.h"
 
-namespace LinBox 
+namespace LinBox
 {
 
 	template <class Field>
@@ -69,6 +71,7 @@ namespace LinBox
 		commentator.start ("Solving linear system (Wiedemann)", "WiedemannSolver::solve");
 
 		WiedemannTraits::SingularState singular = _traits.singular ();
+		if (A.rowdim() != A.coldim() ) _traits.singular (singular = WiedemannTraits::SINGULAR);
 		ReturnStatus status = FAILED;
 
 		unsigned int tries = _traits.maxTries ();
@@ -93,10 +96,10 @@ namespace LinBox
 
 					case SINGULAR:
 						commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION)
-							<< "System found to be singular. Reverting to nonsingular solver." << std::endl;
+						<< "System found to be singular. Reverting to nonsingular solver." << std::endl;
+						tries = _traits.maxTries ();
 						singular = WiedemannTraits::SINGULAR;
 						break;
-
 					default:
 						throw LinboxError ("Bad return value from solveNonsingular");
 					}
@@ -129,7 +132,7 @@ namespace LinBox
 					if (r == (unsigned long) -1) {
 						rank (r, A);
 						commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION)
-							<< "Rank of A = " << r << std::endl;
+						<< "Rank of A = " << r << std::endl;
 					}
 
 					switch (solveSingular (A, x, b, u, r)) {
@@ -158,7 +161,7 @@ namespace LinBox
 
 		if (status == FAILED)
 			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION)
-				<< "Maximum tries exceeded with no resolution. Giving up." << std::endl;
+			<< "Maximum tries exceeded with no resolution. Giving up." << std::endl;
 
 		commentator.stop ("done", NULL, "WiedemannSolver::solve");
 
@@ -183,46 +186,18 @@ namespace LinBox
 		bool       ret = true;
 
 		{
-			commentator.start ("Computing minimal polynomial");
-
-			unsigned long  deg;
-
-			if (!_traits.symmetric ()) {
-				typedef BlackboxContainer<Field, Blackbox> BBContainer;
-
-				if (useRandIter) {
-					BBContainer                      TF (&A, _F, _randiter);
-					MasseyDomain<Field, BBContainer> WD (&TF);
-
-					WD.minpoly (m_A, deg);
-				} else {
-					BBContainer                      TF (&A, _F, b);
-					MasseyDomain<Field, BBContainer> WD (&TF);
-
-					WD.minpoly (m_A, deg);
-				}
-			} else {
-				typedef BlackboxContainerSymmetric<Field, Blackbox> BBContainer;
-
-				if (useRandIter) {
-					BBContainer                      TF (&A, _F, _randiter);
-					MasseyDomain<Field, BBContainer> WD (&TF);
-
-					WD.minpoly (m_A, deg);
-				} else {
-					BBContainer                      TF (&A, _F, b);
-					MasseyDomain<Field, BBContainer> WD (&TF);
-
-					WD.minpoly (m_A, deg);
-				}
-			}
-
-			commentator.stop ("done");
+			// Make it just Blackbox trait and not wiedemann:
+			// Might need extension field for minpoly
+			// Might also also use better method than Wiedemann ...
+			minpoly(m_A, A,RingCategories::ModularTag(),  Method::Blackbox(_traits) );
 		}
 
 		std::ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-		report << "Minimal polynomial coefficients: ";
-		_VD.write (report, m_A) << std::endl;
+		report << "Minimal polynomial of degree " << (m_A.size()-1) << std::endl;
+		if (m_A.size() < 50) {
+			report << "Minimal polynomial coefficients: ";
+			_VD.write (report, m_A) << std::endl;
+		}
 
 		if (_F.isZero (m_A.front ())) {
 			commentator.stop ("singular", "System found to be singular",
@@ -251,7 +226,7 @@ namespace LinBox
 			VectorWrapper::ensureDim (z, A.rowdim ());
 
 			for (int i = m_A.size () - 1; --i > 0;) {
-				if ((m_A.size () - i) & 0xff == 0)
+				if ((m_A.size () - i) & (0xff == 0))
 					commentator.progress (m_A.size () - i);
 
 				A.apply (z, x);
@@ -267,9 +242,16 @@ namespace LinBox
 
 			if (_VD.areEqual (z, b))
 				ret = true;
-			else
+			else {
+				std::ostream& report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+				_VD.write(report << "x is ", x) << std::endl;
+				_VD.write(report << "b is ", b) << std::endl;
+				_VD.write(report << "Ax is " , z) << std::endl;
+
 				ret = false;
 
+			}
+
 			commentator.stop (MSG_STATUS (ret));
 		}
 
@@ -309,7 +291,7 @@ namespace LinBox
 				Compose< ButterflyP, Compose< Blackbox, ButterflyP > > PAQ(&P, &AQ);
 
 				commentator.stop ("done");
-                    
+
 				sfrs = findRandomSolution (PAQ, x, b, r, &P, &Q);
 				break;
 			}
@@ -335,17 +317,18 @@ namespace LinBox
 
 		case WiedemannTraits::TOEPLITZ:
 			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: Toeplitz preconditioner not implemented yet. Sorry." << std::endl;
+			<< "ERROR: Toeplitz preconditioner not implemented yet. Sorry." << std::endl;
 			break;
-		    
-                    case WiedemannTraits::NO_PRECONDITIONER: 
-                    {
-			SparseMatrix<Field> *P = NULL;
-			sfrs = findRandomSolution (A, x, b, r, P, P);
-                        break;
-                    }
+
+		case WiedemannTraits::NO_PRECONDITIONER:
+			{
+				SparseMatrix<Field> *P = NULL;
+				sfrs = findRandomSolution (A, x, b, r, P, P);
+				delete P;
+				break;
+			}
 		default:
-			throw PreconditionFailed (__FUNCTION__, __LINE__, "preconditioner is BUTTERFLY, SPARSE, or TOEPLITZ");
+			throw PreconditionFailed (__func__, __LINE__, "preconditioner is BUTTERFLY, SPARSE, or TOEPLITZ");
 		}
 
 
@@ -355,7 +338,7 @@ namespace LinBox
 		switch (sfrs) {
 		case BAD_PRECONDITIONER:
 			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION)
-				<< "Preconditioned matrix did not have generic rank profile" << std::endl;
+			<< "Preconditioned matrix did not have generic rank profile" << std::endl;
 
 			status = BAD_PRECONDITIONER;
 			break;
@@ -368,7 +351,8 @@ namespace LinBox
 					status = INCONSISTENT;
 				else
 					status = FAILED;
-			} else
+			}
+			else
 				status = FAILED;
 
 			break;
@@ -397,8 +381,8 @@ namespace LinBox
 
 				if (_traits.certificate ()) {
 					commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION)
-						<< "Computed system solution is not correct. "
-						<< "Attempting to find certificate of inconsistency." << std::endl;
+					<< "Computed system solution is not correct. "
+					<< "Attempting to find certificate of inconsistency." << std::endl;
 
 					VectorWrapper::ensureDim (u, A.rowdim ());
 
@@ -406,7 +390,8 @@ namespace LinBox
 						status = INCONSISTENT;
 					else
 						status = FAILED;
-				} else
+				}
+				else
 					status = FAILED;
 			}
 		}
@@ -442,15 +427,14 @@ namespace LinBox
 			commentator.start ("Preparing right hand side");
 
 			stream >> v;
-
 			A.apply (Avpb, v);
 			_VD.addin (Avpb, b);
-
 			if (P != NULL) {
 				VectorWrapper::ensureDim (PAvpb, A.rowdim ());
 				P->apply (PAvpb, Avpb);
 				_VD.copy (bp, PAvpb, 0, r);
-			} else {
+			}
+			else {
 				_VD.copy (bp, Avpb, 0, r);
 			}
 
@@ -462,7 +446,7 @@ namespace LinBox
 		switch (solveNonsingular (Ap, xp, bp, false)) {
 		case SINGULAR:
 			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION)
-				<< "Leading principal minor was found to be singular." << std::endl;
+			<< "Leading principal minor was found to be singular." << std::endl;
 			commentator.stop ("bad preconditioner", "System was not well-conditioned",
 					  "WiedemannSolver::findRandomSolution");
 			return BAD_PRECONDITIONER;
@@ -478,7 +462,8 @@ namespace LinBox
 			VectorWrapper::ensureDim (Qinvx, A.coldim ());
 			_VD.copy (Qinvx, xp);
 			Q->apply (x, Qinvx);
-		} else {
+		}
+		else {
 			_VD.copy (x, xp);
 		}
 
@@ -531,12 +516,13 @@ namespace LinBox
 			VectorWrapper::ensureDim (xp, r);
 			status = solveNonsingular (Ap, xp, Av, false);
 			_VD.copy (x, xp);
-		} else
+		}
+		else
 			status = solveNonsingular (A, x, Av, false);
 
 		if (status == SINGULAR) {
 			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION)
-				<< "Leading principal minor was found to be singular." << std::endl;
+			<< "Leading principal minor was found to be singular." << std::endl;
 			commentator.stop ("bad preconditioner", "System not well-conditioned",
 					  "WiedemannSolver::findNullspaceElement");
 			return BAD_PRECONDITIONER;
@@ -618,4 +604,5 @@ namespace LinBox
 
 }
 
-#endif // __WIEDEMANN_INL
+#endif // __LINBOX_wiedemann_INL
+
diff --git a/linbox/archetypes.doxy b/linbox/archetypes.doxy
index b113615..a101bf4 100644
--- a/linbox/archetypes.doxy
+++ b/linbox/archetypes.doxy
@@ -1,28 +1,30 @@
-/** \page Archetypes
+/** \page Archetypes Archetypes in LinBox
+
   \brief %LinBox uses common object interfaces and archetypical instantiations.
-  This is done for
-  several key concepts including blackbox matrices, fields, random iterators, and vectors.
-
-  %LinBox objects and algorithms are parameterized by types which must meet the 
-  interface requirements described here.  Parameterization is via C++ templates.
-  The interface concepts are specified in classes called archetypes.
-
-  The archetype classes are similar in spirit to Java interfaces.  
-  However most of them are also instantiable and their instances are concrete objects.
-  Originally archetypes were pure virtual classes and algorithms 
-  with archetype arguments could be written and separately compiled.
-  However virtual classes cannot also provide templated member functions,
-  and %LinBox is moving to greater use of template member functions. 
-In some cases, 
-  we forgo the separate complation and code bloat avoidance mechanism 
-  in favor of speed and flexibility using template members.
+
+  This is done for several key concepts including blackbox matrices, fields,
+  random iterators, and vectors.
+
+  %LinBox objects and algorithms are parameterized by types which must meet the
+  interface requirements described here.  Parameterization is via C++
+  templates.  The interface concepts are specified in classes called archetypes.
+
+  The archetype classes are similar in spirit to Java interfaces.  However most
+  of them are also instantiable and their instances are concrete objects.
+  Originally archetypes were pure virtual classes and algorithms with archetype
+  arguments could be written and separately compiled.  However virtual classes
+  cannot also provide templated member functions, and %LinBox is moving to
+  greater use of template member functions.  In some cases, we forgo the separate
+  complation and code bloat avoidance mechanism in favor of speed and flexibility
+  using template members.
 
   Archetypes exist for fields, field elements, random iterators, vectors,
   blackbox matrices, dense matrices, and sparse matrices.
 
 - Blackbox matrix archetype
-    LinBox::BlackboxArchetype in linbox/blackbox/archetype.h specifies this interface in detail.
-    It is a parent class from which the various blackbox classes inherit.
+	\c LinBox::BlackboxArchetype in \c linbox/blackbox/archetype.h specifies
+	this interface in detail.  It is a parent class from which the various blackbox
+	classes inherit.
 
 - Sparse Matrix interface.  This extends the blackbox interface
     and provides facilities for some direct methods.
@@ -31,50 +33,52 @@ In some cases,
     and provides facilities for some direct methods and block methods
     (dense matrices in lieu of vectors as arguments to black box apply).
 
-- Field archetype.  This provides the basic 
-    arithmetic functionality of a field.  The interface is used
-    more generally for representations of commutative rings with 1.
-    LinBox::FieldArchetype in linbox/field/archetype.h specifies this interface in detail
-    and sets it up in such a way that algorithms can be compiled
-    once against the field archetype.  
-    Alternatively, and with some performance gain,
-    one can compile an algorithm separately against each field class used.
-    For a listing of the field implementations see LinBox::FieldInterface .
+- Field archetype.  This provides the basic
+	arithmetic functionality of a field.  The interface is used more generally
+	for representations of commutative rings with 1.  \c LinBox::FieldArchetype in
+	\c linbox/field/archetype.h specifies this interface in detail and sets it up
+	in such a way that algorithms can be compiled once against the field archetype.
+	Alternatively, and with some performance gain, one can compile an algorithm
+	separately against each field class used.  For a listing of the field
+	implementations see LinBox::FieldInterface .
 
 - Random iterator archetype.  %LinBox fields (and rings) provide a random iterator
-    type.  Objects of this type can be used to generate elements at random.
-    RandIterArchetype in linbox/randiter/archetype.h specifies this interface in detail.
+	type.  Objects of this type can be used to generate elements at random.  \c
+	LinBox::RandIterArchetype in \c linbox/randiter/archetype.h specifies this
+	interface in detail.
 
 - Element archetype.  To allow for high performance, it must
-    be possible to use any C++ type to represent elments of fields and rings.
-    This includes the primitive types such as int and float.  To support 
-    this, our element type requires only: a public default constructor, 
-    a copy constructor, an assignment operator, and a destructor.
-    ElementArchetype in linbox/element/archetype.h specifies this interface in detail.
+	be possible to use any C++ type to represent elments of fields and rings.
+	This includes the primitive types such as int and float.  To support this, our
+	element type requires only: a public default constructor, a copy constructor,
+	an assignment operator, and a destructor.  \c LinBox::ElementArchetype in \c
+	linbox/element/archetype.h specifies this interface in detail.
 
 - Dense vector interface.  This is the interface for vectors to which blackboxes
-    are applied (the vector of a matrix vector product). 
-    This is simply the std::vector<Elt> interface, where Elt is the element type of the field involved.
-    But we do not use the functionality concerning resizing vectors, {\tt resize, push_back}, etc.
-    An example of a class meeting this interface is LinBox::SubVector .
+	are applied (the vector of a matrix vector product).  This is simply the
+	<code>std::vector<Elt></code> interface, where \c Elt is the element type of
+	the field involved.  But we do not use the functionality concerning resizing
+	vectors, \c resize, \c push_back, etc.  An example of a class meeting this
+	interface is \c LinBox::SubVector .
 
 - Sparse vector interfaces.  We are experimenting with two or three
     variant interfaces for manipulation of sparse vectors.
 
+- Random Iterator archetypes. \subpage randomIGA.  \subpage randomFEGW
 
 These additional interfaces are under construction.
 - Target Domain interface.  This extends the field (or ring) interface.
     It has members dealing with the ring as a module over another.
     This interface is designed primarily with three applications in mind.
     - finite field extensions \f$K \subset F\f$.
-    - \f$Z -> Zp\f$.
+    - \f$Z \rightarrow Zp\f$.
     - conversions among isomorphic representations, as used for
         instance in implementing the Toeplitz matrix class.
-  
-- Ring homomorphism interface.  This is used by the 
+
+- Ring homomorphism interface.  This is used by the
     target rings.
 
-- Polynomial interface.  This may become the std::vector
+- Polynomial interface.  This may become the \c std::vector
     interface (including the resizing functionality) together
     with a handful of functions for manipulating polynomials.
     %LinBox' design intentions are to exploit other software for
@@ -83,14 +87,16 @@ These additional interfaces are under construction.
 
 In general, there are three uses for the archetypes classes:
 
-- To define the common object interface of the concept, 
+- To define the common object interface of the concept,
     i.e., specify what an classes must have to meet the interface.
 
-- To allow distribution of compiled code and prototype library components.  Thus it is possible to compile algorithms with the archetypes 
-    as parameters and call the compiled code with objects of other classes 
-    meeting the interface.
+- To allow distribution of compiled code and prototype library components.  Thus
+    it is possible to compile algorithms with the archetypes as parameters and call
+    the compiled code with objects of other classes meeting the interface.
 
 - To control code bloat. (by means of separate compilation as sketched in the item above)
 
-  
+
 */
+
+// vim:syn=doxygen
diff --git a/linbox/blackbox/Makefile.am b/linbox/blackbox/Makefile.am
index 7a1921f..7e5bb3c 100644
--- a/linbox/blackbox/Makefile.am
+++ b/linbox/blackbox/Makefile.am
@@ -1,54 +1,62 @@
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 pkgincludesubdir=$(pkgincludedir)/blackbox
 
 BASIC_HDRS =			\
-	archetype.h		\
-	factory.h		\
-	butterfly.h		\
-	hilbert.h		\
-	compose.h		\
-	permutation.h		\
-	sparse1.h		\
-	sparse.h		\
-	sparse.inl		\
-	scalar-matrix.h		\
-	submatrix.h		\
-	inverse.h		\
-	transpose.h		\
-	sum.h			\
-	diagonal.h		\
-	moore-penrose.h		\
-	dense.h  		\
-	dense.inl		\
-	direct-sum.h		\
-	null-matrix.h		\
-	matrix-blackbox.h	\
-	dif.h			\
-	companion.h		\
-	frobenius.h		\
-	zero-one.h		\
-	zero-one.inl		\
-	triplesbb.h		\
-	apply.h			\
-	submatrix-traits.h	\
-	random-matrix-traits.h	\
-	scompose.h		\
-	blackbox-interface.h	\
-	random-matrix.h		\
-	lambda-sparse.h		\
-	blas-blackbox.h		\
-	polynomial.h		\
-	block-hankel.h		\
-	block-toeplitz.h	\
-	block-hankel-inverse.h	\
-	jit-matrix.h
+	archetype.h               \
+	factory.h                 \
+	butterfly.h               \
+	hilbert.h                 \
+	compose.h                 \
+	permutation.h             \
+	squarize.h                \
+	sparse1.h                 \
+	sparse.h                  \
+	sparse.inl                \
+	scalar-matrix.h           \
+	submatrix.h               \
+	inverse.h                 \
+	transpose.h               \
+	sum.h                     \
+	diagonal.h                \
+	moore-penrose.h           \
+	dense.h                   \
+	dense.inl                 \
+	direct-sum.h              \
+	null-matrix.h             \
+	matrix-blackbox.h         \
+	dif.h                     \
+	companion.h               \
+	frobenius.h               \
+	zero-one.h                \
+	zero-one.inl              \
+	zo.h         zo.inl       \
+	zo-gf2.h     zo-gf2.inl   \
+	quad-matrix.h             \
+	triplesbb.h               \
+	apply.h                   \
+	submatrix-traits.h        \
+	random-matrix-traits.h    \
+	scompose.h                \
+	blackbox-interface.h      \
+	random-matrix.h           \
+	lambda-sparse.h           \
+	blas-blackbox.h           \
+	polynomial.h              \
+	block-hankel.h            \
+	block-toeplitz.h          \
+	block-hankel-inverse.h    \
+	jit-matrix.h              \
+	rational-matrix-factory.h
 
 NTL_HDRS =			\
 	toeplitz.h ntl-hankel.h ntl-sylvester.h \
 	toeplitz.inl ntl-hankel.inl ntl-sylvester.inl
 
-GIVARO_HDRS = 
+GIVARO_HDRS =
 
-LIDIA_HDRS = 
+LIDIA_HDRS =
 
 if LINBOX_HAVE_NTL
 USE_NTL_HDRS = $(NTL_HDRS)
@@ -72,5 +80,5 @@ EXTRA_DIST = 			\
 	$(NTL_HDRS)		\
 	$(GIVARO_HDRS)		\
 	$(LIDIA_HDRS)		\
-	blackbox.doxy		
+	blackbox.doxy
 
diff --git a/linbox/blackbox/Makefile.in b/linbox/blackbox/Makefile.in
index 5874b94..e0005b7 100644
--- a/linbox/blackbox/Makefile.in
+++ b/linbox/blackbox/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -37,19 +38,26 @@ 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 \
-	$(top_srcdir)/macros/blas-check.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
 	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
 	$(top_srcdir)/macros/givaro-check.m4 \
 	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
 	$(top_srcdir)/macros/lidia-check.m4 \
 	$(top_srcdir)/macros/linbox-doc.m4 \
 	$(top_srcdir)/macros/linbox-misc.m4 \
 	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
 	$(top_srcdir)/macros/maple-check.m4 \
 	$(top_srcdir)/macros/ntl-check.m4 \
 	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -60,16 +68,18 @@ am__depfiles_maybe =
 SOURCES =
 DIST_SOURCES =
 am__pkgincludesub_HEADERS_DIST = archetype.h factory.h butterfly.h \
-	hilbert.h compose.h permutation.h sparse1.h sparse.h \
-	sparse.inl scalar-matrix.h submatrix.h inverse.h transpose.h \
-	sum.h diagonal.h moore-penrose.h dense.h dense.inl \
+	hilbert.h compose.h permutation.h squarize.h sparse1.h \
+	sparse.h sparse.inl scalar-matrix.h submatrix.h inverse.h \
+	transpose.h sum.h diagonal.h moore-penrose.h dense.h dense.inl \
 	direct-sum.h null-matrix.h matrix-blackbox.h dif.h companion.h \
-	frobenius.h zero-one.h zero-one.inl triplesbb.h apply.h \
+	frobenius.h zero-one.h zero-one.inl zo.h zo.inl zo-gf2.h \
+	zo-gf2.inl quad-matrix.h triplesbb.h apply.h \
 	submatrix-traits.h random-matrix-traits.h scompose.h \
 	blackbox-interface.h random-matrix.h lambda-sparse.h \
 	blas-blackbox.h polynomial.h block-hankel.h block-toeplitz.h \
-	block-hankel-inverse.h jit-matrix.h toeplitz.h ntl-hankel.h \
-	ntl-sylvester.h toeplitz.inl ntl-hankel.inl ntl-sylvester.inl
+	block-hankel-inverse.h jit-matrix.h rational-matrix-factory.h \
+	toeplitz.h ntl-hankel.h ntl-sylvester.h toeplitz.inl \
+	ntl-hankel.inl ntl-sylvester.inl
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -90,18 +100,21 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
 CC = @CC@
+CCNAM = @CCNAM@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
 DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -109,19 +122,24 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
 GIVARO_CFLAGS = @GIVARO_CFLAGS@
 GIVARO_LIBS = @GIVARO_LIBS@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
 GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
@@ -129,41 +147,52 @@ LIBTOOL = @LIBTOOL@
 LIDIA_CFLAGS = @LIDIA_CFLAGS@
 LIDIA_LIBS = @LIDIA_LIBS@
 LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MAPLE_CFLAGS = @MAPLE_CFLAGS@
 MAPLE_HOME = @MAPLE_HOME@
 MAPLE_LIBS = @MAPLE_LIBS@
 MAPLE_VERSION = @MAPLE_VERSION@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
 NTL_CFLAGS = @NTL_CFLAGS@
 NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RM = @RM@
 SACLIB_CFLAGS = @SACLIB_CFLAGS@
 SACLIB_LIBS = @SACLIB_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+TESTS_CFLAGS = @TESTS_CFLAGS@
 VERSION = @VERSION@
+WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -204,50 +233,60 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 pkgincludesubdir = $(pkgincludedir)/blackbox
 BASIC_HDRS = \
-	archetype.h		\
-	factory.h		\
-	butterfly.h		\
-	hilbert.h		\
-	compose.h		\
-	permutation.h		\
-	sparse1.h		\
-	sparse.h		\
-	sparse.inl		\
-	scalar-matrix.h		\
-	submatrix.h		\
-	inverse.h		\
-	transpose.h		\
-	sum.h			\
-	diagonal.h		\
-	moore-penrose.h		\
-	dense.h  		\
-	dense.inl		\
-	direct-sum.h		\
-	null-matrix.h		\
-	matrix-blackbox.h	\
-	dif.h			\
-	companion.h		\
-	frobenius.h		\
-	zero-one.h		\
-	zero-one.inl		\
-	triplesbb.h		\
-	apply.h			\
-	submatrix-traits.h	\
-	random-matrix-traits.h	\
-	scompose.h		\
-	blackbox-interface.h	\
-	random-matrix.h		\
-	lambda-sparse.h		\
-	blas-blackbox.h		\
-	polynomial.h		\
-	block-hankel.h		\
-	block-toeplitz.h	\
-	block-hankel-inverse.h	\
-	jit-matrix.h
+	archetype.h               \
+	factory.h                 \
+	butterfly.h               \
+	hilbert.h                 \
+	compose.h                 \
+	permutation.h             \
+	squarize.h                \
+	sparse1.h                 \
+	sparse.h                  \
+	sparse.inl                \
+	scalar-matrix.h           \
+	submatrix.h               \
+	inverse.h                 \
+	transpose.h               \
+	sum.h                     \
+	diagonal.h                \
+	moore-penrose.h           \
+	dense.h                   \
+	dense.inl                 \
+	direct-sum.h              \
+	null-matrix.h             \
+	matrix-blackbox.h         \
+	dif.h                     \
+	companion.h               \
+	frobenius.h               \
+	zero-one.h                \
+	zero-one.inl              \
+	zo.h         zo.inl       \
+	zo-gf2.h     zo-gf2.inl   \
+	quad-matrix.h             \
+	triplesbb.h               \
+	apply.h                   \
+	submatrix-traits.h        \
+	random-matrix-traits.h    \
+	scompose.h                \
+	blackbox-interface.h      \
+	random-matrix.h           \
+	lambda-sparse.h           \
+	blas-blackbox.h           \
+	polynomial.h              \
+	block-hankel.h            \
+	block-toeplitz.h          \
+	block-hankel-inverse.h    \
+	jit-matrix.h              \
+	rational-matrix-factory.h
 
 NTL_HDRS = \
 	toeplitz.h ntl-hankel.h ntl-sylvester.h \
@@ -268,7 +307,7 @@ EXTRA_DIST = \
 	$(NTL_HDRS)		\
 	$(GIVARO_HDRS)		\
 	$(LIDIA_HDRS)		\
-	blackbox.doxy		
+	blackbox.doxy
 
 all: all-am
 
@@ -277,8 +316,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
 	      exit 1;; \
 	  esac; \
 	done; \
@@ -331,7 +370,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
@@ -444,6 +483,8 @@ dvi-am:
 
 html: html-am
 
+html-am:
+
 info: info-am
 
 info-am:
@@ -452,18 +493,28 @@ install-data-am: install-pkgincludesubHEADERS
 
 install-dvi: install-dvi-am
 
+install-dvi-am:
+
 install-exec-am:
 
 install-html: install-html-am
 
+install-html-am:
+
 install-info: install-info-am
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-am
 
+install-pdf-am:
+
 install-ps: install-ps-am
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
diff --git a/linbox/blackbox/apply.h b/linbox/blackbox/apply.h
index 749ecb9..d5c1b22 100644
--- a/linbox/blackbox/apply.h
+++ b/linbox/blackbox/apply.h
@@ -1,14 +1,34 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* File: apply.h
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) LinBox
  *  Author: Zhendong Wan
  *  Modified by Pascal Giorgi
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
 
+
+
 /* Reserve for possible optimal.
- */
+*/
 
-#ifndef __LINBOX_APPLY_H__
-#define __LINBOX_APPLY_H__
+#ifndef __LINBOX_apply_H
+#define __LINBOX_apply_H
 
 #include <linbox/linbox-config.h>
 #include <linbox/integer.h>
@@ -28,7 +48,7 @@
 
 
 #ifdef __LINBOX_BLAS_AVAILABLE
-#include <linbox/fflas/fflas.h>
+#include <fflas-ffpack/fflas/fflas.h>
 #endif
 
 //#define DEBUG_CHUNK_SETUP
@@ -37,95 +57,103 @@
 //#define CHECK_APPLY
 #define TIMING_APPLY
 
-namespace LinBox {
-	
+namespace LinBox
+{
+
 	// general case, y = A x
 	template<class OutV, class Matrix, class InV>
-	inline OutV& apply (OutV& y, const Matrix& A, const InV& x) {
-		
+	inline OutV& apply (OutV& y, const Matrix& A, const InV& x)
+	{
+
 		return A. apply (y, x);
 
 	}
 
 	template<class OutV, class Matrix, class InV>
-	inline OutV& applyTranspose (OutV& y, const Matrix& A, const InV& x) {
+	inline OutV& applyTranspose (OutV& y, const Matrix& A, const InV& x)
+	{
 
 		return A. applyTranspose (y, x);
-		
+
 	}
 
-	
+
 	template<class Domain>
 	class BlasApply {
-	  	 
+
 	public:
 		typedef typename Domain::Element    Element;
 		typedef std::vector<Element>         Vector;
 
-		BlasApply(const Domain& D) : _D(D), _MD(D) { 
-			_D.characteristic(_prime); 
-			_D.init(_one,1UL); 
+		BlasApply(const Domain& D) :
+			_D(D), _MD(D)
+		{
+			_D.characteristic(_prime);
+			_D.init(_one,1UL);
 			_D.init(_zero,0UL);
 		}
-	  	  		
+
 
 		//#ifdef __LINBOX_BLAS_AVAILABLE
 		inline Vector& applyV(Vector                        &y,
-				      const BlasMatrix<Element>     &A, 
-				      const Vector                  &x) const {
-	    
+				      const BlasMatrix<Element>     &A,
+				      const Vector                  &x) const
+		{
+
 			if (( _prime > 0) && ( _prime <  67108863)) {
 
-				FFLAS::fgemv( _D, FFLAS::FflasNoTrans, 
+				FFLAS::fgemv( _D, FFLAS::FflasNoTrans,
 					      A.rowdim(), A.coldim(),
 					      _one,
 					      A.getPointer(), A.getStride(),
 					      &x[0],1,
 					      _zero,
-					      &y[0],1);  	      
+					      &y[0],1);
 			}
 			else {
-				_MD.vectorMul (y, A, x);	      
+				_MD.vectorMul (y, A, x);
 			}
 			return y;
 		}
 
 		inline Vector& applyVTrans(Vector                        &y,
 					   BlasMatrix<Element>           &A,
-					   const Vector                  &x) const {
-	    
+					   const Vector                  &x) const
+		{
+
 			if (( _prime > 0) && ( _prime <  67108863)) {
 
-				FFLAS::fgemv( _D, FFLAS::FflasTrans, 
+				FFLAS::fgemv( _D, FFLAS::FflasTrans,
 					      A.rowdim(), A.coldim(),
 					      _one,
 					      A.getPointer(), A.getStride(),
 					      &x[0],1,
 					      _zero,
-					      &y[0],1);  	      
+					      &y[0],1);
 			}
 			else {
-				TransposeMatrix<const BlasMatrix<Element> > B(A); 
+				TransposeMatrix<const BlasMatrix<Element> > B(A);
 				_MD.vectorMul (y, B, x);
 			}
 			return y;
-		}		
+		}
 
 		inline Vector& applyVspecial (Vector                        &y,
 					      BlasMatrix<Element>           &A,
-					      const Vector                  &x) const {//toto
-			
+					      const Vector                  &x) const
+		{//toto
+
 			size_t m,n;
 			m = A.rowdim();
 			n = A.coldim();
 			linbox_check( x.size() == n);
-			
+
 			double * At_dbl = new double[m*n];
-			
+
 			for (size_t i=0;i<m;++i)
 				for (size_t j=0;j<n;++j)
 					_D.convert(*(At_dbl+i+j*m), A.refEntry(i,j));
-			
+
 			integer tmp;
 			bool use_neg=false;
 			size_t maxword=0;
@@ -134,14 +162,14 @@ namespace LinBox {
 				if (tmp <0)
 					use_neg = true;
 				if ( maxword < tmp.size())
-					maxword= tmp.size();				
+					maxword= tmp.size();
 			}
-			
+
 			if (use_neg)
 				maxword++;
 			double *xdbl= new double[n*maxword];
 			memset(xdbl, 0, sizeof(double)*n*maxword);
-			
+
 			for (size_t i=0;i<n;++i){
 				_D.convert(tmp,x[i]);
 				double * ptr= xdbl+i;
@@ -157,21 +185,21 @@ namespace LinBox {
 					else {
 						size_t j=0;
 						for (;j<tmp.size();++j){
-							*ptr= 0xFFFFFFFF^x[i][j];
+							*ptr= double(0xFFFFFFFF^x[i][j]);
 							ptr+= n;
 						}
 						for (;j<maxword-1;++j){
-							*ptr= 0xFFFFFFFF;
+							*ptr= double(0xFFFFFFFF);
 							ptr+= n;
 						}
 						*ptr=1;
 					}
-				}					
+				}
 			}
 
 
 			double *ydbl= new double[maxword*m];
-					
+
 			cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans,
 				    maxword,m,n, 1,
 				    xdbl,n, At_dbl, m, 0, ydbl, m);
@@ -188,31 +216,31 @@ namespace LinBox {
 			for (size_t i=0;i<m;++i){
 				unsigned char *ptr= combined1+i*rclen;
 				for (size_t j=0;j< maxword;j=j+2){
-					if (!use_neg || j< maxword-1){						
+					if (!use_neg || j< maxword-1){
 						long long mask = static_cast<long long>(ydbl[j*m+i]);
-						*((long long*) ptr) |= mask; 
+						*((long long*) ptr) |= mask;
 						ptr+=4;
 					}
 				}
 				ptr= combined2+4+i*rclen;
-				for (size_t j=1;j< maxword;j=j+2){				
-					if (!use_neg || j< maxword-1){						
+				for (size_t j=1;j< maxword;j=j+2){
+					if (!use_neg || j< maxword-1){
 						long long mask = static_cast<long long>(ydbl[j*m+i]);
-						*((long long*) ptr) |= mask; 
+						*((long long*) ptr) |= mask;
 						ptr+=4;
 					}
 				}
 			}
-			
+
 			for (size_t i=0; i<m; i++) {
 				LinBox::integer result, tmp;
 				if (use_neg) {
 					result = -ydbl[(maxword-1)*m+i];
-					result <<= (maxword-1)*32;					
+					result <<= (maxword-1)*32;
 				}
 				else
 					result = 0;
-				
+
 				importWords(tmp, rclen, -1, 1, 0, 0, combined1+i*rclen);
 				result += tmp;
 				importWords(tmp, rclen, -1, 1, 0, 0, combined2+i*rclen);
@@ -227,13 +255,13 @@ namespace LinBox {
 			return y;
 		}// end of applyVspecial
 
-	  
+
 	private:
 		Domain         _D;
 		integer    _prime;
 		Element _one,_zero;
 		MatrixDomain<Domain> _MD;
-	  
+
 
 	};
 
@@ -244,14 +272,18 @@ namespace LinBox {
 	public:
 		typedef typename Domain::Element    Element;
 		typedef std::vector<Element>         Vector;
-		
-		MatrixApplyDomain(const Domain& D, const IMatrix &M) : _D(D), _M(M) {}
+
+		MatrixApplyDomain(const Domain& D, const IMatrix &M) :
+			_D(D), _M(M)
+		{}
 
 		void setup(LinBox::integer prime){}
-				
-		Vector& applyV(Vector& y, Vector& x, Vector& z) const { return _M.apply(y,x);}
 
-		Vector& applyVTrans(Vector& y, Vector& x, Vector&z) const {return _M.applyTranspose(y,x);}
+		Vector& applyV(Vector& y, Vector& x, Vector& z) const
+		{ return _M.apply(y,x);}
+
+		Vector& applyVTrans(Vector& y, Vector& x, Vector&z) const
+		{return _M.applyTranspose(y,x);}
 
 	private:
 		Domain          _D;
@@ -259,14 +291,11 @@ namespace LinBox {
 	};
 
 
-
-
-	
 	// special function to split an integer matrix in q-adic representation in an array of double
 	template <class Domain, class IMatrix>
-	void create_MatrixQadic (const Domain &D, const IMatrix &M, double *chunks, size_t num_chunks, const integer& shift=0);
+	void create_MatrixQadic (const Domain &D, const IMatrix &M, double *chunks, size_t num_chunks, const integer shift=0);
+
 
-		
 	// special function to split an integer vector in q-adic representation in an array of double
 	template <class Domain, class IVector>
 	void create_VectorQadic (const Domain &D, const IVector &V, double *chunks, size_t num_chunks);
@@ -275,109 +304,112 @@ namespace LinBox {
 	template <class Domain, class IMatrix>
 	void create_MatrixRNS (const MultiModDouble& F, const Domain &D, const IMatrix &M, double *chunks);
 
-		
+
 	// special function to split an integer vector in an RNS representation in an array of double
 	template <class Domain, class IVector>
 	void create_VectorRNS (const MultiModDouble& F, const Domain &D, const IVector &V, double *chunks);
 
 
-	
+
 	// \brief optimizations for applying an integer matrix to a bounded integer vector
-	
 	template <class Domain, class IMatrix>
 	class BlasMatrixApplyDomain {
-		
+
 		enum ApplyChoice {Classic, MatrixQadic, VectorQadic, CRT};
 
 	public:
 		typedef typename Domain::Element    Element;
 		typedef std::vector<Element>         Vector;
 		typedef IMatrix                       Matrix;
-		
-		
-	       	BlasMatrixApplyDomain(const Domain& D, const IMatrix &M) : _D(D), _M(M), _MD(D), _m(M.rowdim()), _n(M.coldim()){ _switcher= Classic;_rns=NULL;}
-			
 
-		~BlasMatrixApplyDomain () {
+
+		BlasMatrixApplyDomain(const Domain& D, const IMatrix &M) :
+			_D(D), _M(M), _MD(D), _m(M.rowdim()), _n(M.coldim())
+		{ _switcher= Classic;_rns=NULL;}
+
+
+		~BlasMatrixApplyDomain ()
+		{
 			if (_switcher==MatrixQadic) delete[] chunks;
 			if (_switcher==VectorQadic) {delete[] chunks;delete[] vchunks;}
-			if (_switcher== CRT) delete _rns;		
+			if (_switcher== CRT) delete _rns;
 			//std::cout<<"time convert data = "<<_convert_data<<std::endl;
 			//std::cout<<"time apply   = "<<_apply<<std::endl;
 			//std::cout<<"time convert result = "<<_convert_result<<std::endl;
 		}
 
-		ApplyChoice  setup(LinBox::integer prime){//setup
-			
+		ApplyChoice  setup(LinBox::integer prime)
+		{ //setup
+
 			_D.init(_prime,prime);
 			_apply.clear();
 			_convert_data.clear();
 			_convert_result.clear();
 #ifdef __LINBOX_HAVE_BIG_ENDIAN
-			_switcher= Classic;	
+			_switcher= Classic;
 #else
 			// compute the magnitude in bit of the matrix
 			// check if at least one entry in the matrix is negative
 			LinBox::integer tmp=0, maxValue=0;
-			size_t maxBitSize = 0;				
+			size_t maxBitSize = 0;
 			use_neg = false;
 			typename Matrix::ConstRawIterator it = _M.rawBegin();
 			for (size_t i=0; i<_m*_n; i++, ++it) {
-				_D.convert(tmp, *it);	
+				_D.convert(tmp, *it);
 				if (tmp <0) {
 					use_neg = 1;
 					tmp=-tmp;
 				}
 				if (tmp> maxValue){
-					maxValue= tmp;				
-				}			
+					maxValue= tmp;
+				}
 			}
 			size_t bit, dbit;
 			bit=maxValue.bitsize();
 			dbit= maxValue.size_in_base(4)*2;
 			maxBitSize= ((dbit-bit)>0)? dbit: bit;
-						
-			// Check Qadic matrix reprentation possibility			
+
+			// Check Qadic matrix reprentation possibility
 			LinBox::integer maxChunkVal = 1;
- 			maxChunkVal <<= 53;
- 			maxChunkVal /= (prime-1) * _n;
- 			chunk_size = maxChunkVal.bitsize();	
-			use_chunks = (chunk_size >= 16);		
+			maxChunkVal <<= 53;
+			maxChunkVal /= (prime-1) * _n;
+			chunk_size = maxChunkVal.bitsize();
+			use_chunks = (chunk_size >= 16);
 			//std::cout<<"max bit= "<<maxBitSize<<" "<<maxValue.size_in_base(4)*2<<"\n";std::cout<<"max value= "<<maxValue<<"\n";
 			if (use_chunks){//std::cout<<"Matrix Qadic\n";
 				_switcher= MatrixQadic;
-				
+
 			}
 			else {
 				// Check Qadic vector representation possibility
 				maxChunkVal = 1;
 				maxChunkVal <<= 53;
 				maxChunkVal /= 2*maxValue * _n;
-				chunk_size = maxChunkVal.bitsize();		
+				chunk_size = maxChunkVal.bitsize();
 				use_chunks = (chunk_size >= 16);
-				
+
 				if (use_chunks){//std::cout<<"Vector Qadic\n";
 					_switcher= VectorQadic;
-				
+
 					//std::cout<<"possible chunk size: "<<chunk_size<<std::endl;
 				}
 				else {
 					if (prime.bitsize()> 32){//std::cout<<"CRT\n";
 						_switcher= CRT;
-						
+
 					}
 					else {//std::cout<<"Classic\n";
 						_switcher= Classic;
-						
+
 					}
 				}
 			}
-						
-			// set maximum size of chunk to 16			
+
+			// set maximum size of chunk to 16
 			chunk_size = 16;
-						
+
 			switch (_switcher) {
-				
+
 			case MatrixQadic:
 				if (use_neg){
 					maxValue= maxValue<<1;
@@ -386,23 +418,23 @@ namespace LinBox {
 				// compute the number of chunk
 				if (maxValue*prime*_M.coldim() < integer("9007199254740992")){
 					num_chunks=1;
-					use_neg=false;			
+					use_neg=false;
 				}
 				else num_chunks =(maxBitSize) / chunk_size+ (((maxBitSize % chunk_size) > 0)? 1:0);
 				//num_chunks = 1;
-				if (num_chunks ==1) use_neg= false;				
+				if (num_chunks ==1) use_neg= false;
 
 				//if (use_neg) num_chunks++; //the leading chunk will be negative
-				
+
 				//int n2 = _m*_n;
 				chunks = new double[_m*_n*num_chunks];
 				memset(chunks, 0, sizeof(double)*_m*_n*num_chunks);
-				
+
 				shift= use_neg? maxValue : integer(0);
 
 				create_MatrixQadic(_D, _M, chunks, num_chunks, shift);
 
-#ifdef DEBUG_CHUNK_SETUP			
+#ifdef DEBUG_CHUNK_SETUP
 				std::cout<<std::endl;
 				std::cout<<"max bit= "<<maxBitSize<<std::endl;
 				std::cout << num_chunks << " chunks of "<< chunk_size << " bits each" << std::endl;
@@ -417,16 +449,16 @@ namespace LinBox {
 						if ((j+1)%_n) std::cout << ' '; else std::cout << std::endl;
 					}
 				}
-#endif			       
-			
+#endif
+
 				break;
-				
+
 			case VectorQadic:
-				num_chunks = (prime.bitsize() / chunk_size)+ (((prime.bitsize() % chunk_size) > 0)? 1:0);												
+				num_chunks = (prime.bitsize() / chunk_size)+ (((prime.bitsize() % chunk_size) > 0)? 1:0);
 				// convert integer matrix to double matrix
 				chunks  = new double[_m*_n];
 				memset(chunks, 0, sizeof(double)*_m*_n);
-				create_MatrixQadic (_D, _M, chunks, 1); 
+				create_MatrixQadic (_D, _M, chunks, 1);
 
 				// if the matrix has negative entries
 				if (use_neg){
@@ -435,39 +467,39 @@ namespace LinBox {
 					// shift the value of the entries in the matrix by ||A||=max(A_ij)
 					for (size_t i=0;i<_m*_n;++i)
 						chunks[i]+=sh;
-					
+
 				}
 
 				// allocate memory for the vector chunks
-				vchunks = new double[_n*num_chunks];						
+				vchunks = new double[_n*num_chunks];
 				break;
-					
+
 			case Classic:
 				break;
-				
+
 			case CRT:
 				if (use_neg){
 					maxValue= maxValue<<1;
 					maxBitSize+=1;
 				}
 				integer a_bound= maxValue*_n+1;
-				integer b_bound= sqrt(integer("9007199254740992")/_n);	std::cout<<"max prime: "<<b_bound<<" max rns: "<<a_bound<<std::endl; 		
+				integer b_bound= sqrt(integer("9007199254740992")/_n);	std::cout<<"max prime: "<<b_bound<<" max rns: "<<a_bound<<std::endl;
 				MultiModRandomPrime mmrp;
 				std::vector<integer> rns_basis = mmrp.createPrimes(b_bound, a_bound);
 				_rns = new MultiModDouble(rns_basis);
-				
+
 				std::cout<<" CRT basi length= "<<_rns->size()<<std::endl;
 
 				// convert integer matrix to rns double matrix
 				chunks  = new double[_m*_n*_rns->size()];
 				memset(chunks, 0, sizeof(double)*_m*_n*_rns->size());
 				create_MatrixRNS(*_rns, _D, _M, chunks);
-				
+
 				// allocate memory for the rns vector
 				vchunks = new double[_n*_rns->size()];
 
-				// prepare special CRT 
-				Element g, s, q, zero,one,two;				
+				// prepare special CRT
+				Element g, s, q, zero,one,two;
 				_q= _rns->getCRTmodulo();
 				_D.init(q,_q);_D.init(zero,0UL);_D.init(one,1UL);_D.init(two,2UL);
 				_D.xgcd(g, _inv_q, s, q, _prime);
@@ -477,43 +509,45 @@ namespace LinBox {
 				_D.divin(_h_pq, two);
 
 				break;
-						
+
 			}
-	
-#endif	
-#ifdef DEBUG_CHUNK_APPLY 
+
+#endif
+#ifdef DEBUG_CHUNK_APPLY
 			std::cout<<"A: \n";
 			_M.write(std::cout);
 #endif
 
 			return _switcher;
 		}
-	
 
-//#define DEBUG_CHUNK_APPLY			
-		Vector& applyV(Vector& y, Vector& x, Vector &b) const {//applyV 		
+
+		//#define DEBUG_CHUNK_APPLY
+		Vector& applyV(Vector& y, Vector& x, Vector &b) const
+		{ //applyV
 
 #ifdef DEBUG_CHUNK_APPLY
 			std::cout << "x: ";
-			for (size_t i=0; i<x.size(); i++) 
+			for (size_t i=0; i<x.size(); i++)
 				std::cout << x[i] << ' ';
 			std::cout << std::endl;
-#endif			
+#endif
 			linbox_check( _n == x.size());
 			linbox_check( _m == y.size());
-			
+
 			switch(_switcher) {//switch
-			
-			case Classic:	
-				_MD.vectorMul (y, _M, x);			
+
+			case Classic:
+				_MD.vectorMul (y, _M, x);
 				break;
-				
+
 			case MatrixQadic:
 				{// mqadic
-//temp fix
-//                                _MD.vectorMul (y, _M, x);
-//                                break;
-
+#if 0
+					temp fix
+					_MD.vectorMul (y, _M, x);
+					break;
+#endif
 					double* dx = new double[_n];
 					for (size_t i=0; i<_n; i++) {
 						_D.convert(dx[i], x[i]);
@@ -522,39 +556,39 @@ namespace LinBox {
 						double *ctd = new double[_m];
 						cblas_dgemv(CblasRowMajor, CblasNoTrans, _m, _n,
 							    1, chunks, _n, dx, 1, 0, ctd, 1);
-						
+
 						for (size_t i=0;i<_n;++i)
 							_D.init(y[i],ctd[i]);
 						delete[] ctd;
 						delete[] dx;
 					}
 					else {
-
-						//rc: number of vectors to recombine
-						//(the idea is that to compute a polynomial in the base 2^chunksize
-						// with <= 53 bits in each coefficient, we can instead OR nonoverlapping blocks
-						// of bits and then add them at the end, like this:
-						//      AAAACCCCEEEEGGGG   instead  AAAA << 12 + BBBB << 10 + CCCC << 8 + ...
-						//    +   BBBBDDDDFFFF00      of     
-						// also note that we need separate blocks for positive and negative entries)
-						
-						int rc = (52 / chunk_size) + 1; //constant at 4 for now
-						
-						//rclen: number of bytes in each of these OR-ed vectors
-						// needs room to hold (max long long) << (num_chunks * chunksize) 
-						
+						/*
+						 * rc: number of vectors to recombine
+						 * (the idea is that to compute a polynomial in the base 2^chunksize
+						 * with <= 53 bits in each coefficient, we can instead OR nonoverlapping blocks
+						 * of bits and then add them at the end, like this:
+						 *      AAAACCCCEEEEGGGG   instead  AAAA << 12 + BBBB << 10 + CCCC << 8 + ...
+						 *    +   BBBBDDDDFFFF00      of
+						 * also note that we need separate blocks for positive and negative entries)
+						 */
+						 int rc = (52 / chunk_size) + 1; //constant at 4 for now
+						 /*
+						 * rclen: number of bytes in each of these OR-ed vectors
+						 * needs room to hold (max long long) << (num_chunks * chunksize)
+						 */
 						int rclen = num_chunks*2 + 5;
-						
+
 						unsigned char* combined = new unsigned char[rc*_n*rclen];
 						memset(combined, 0, rc*_n*rclen);
-						
-						//order from major index to minor: combining index, component of sol'n, byte		
+
+						//order from major index to minor: combining index, component of sol'n, byte
 						//compute a product (chunk times x) for each chunk
-						
+
 						double* ctd = new double[_n];
 #ifdef DEBUG_CHUNK_APPLY
-						
-						
+
+
 						std::cout<<"- A chunk --------------------------\n";
 						for (size_t k=0;k<num_chunks;++k){
 							for (size_t i=0;i<_m;i++){
@@ -564,17 +598,17 @@ namespace LinBox {
 							}
 							std::cout<<"\n";
 						}
-						
+
 						std::cout<<"- A.x chunk---------------------\n";
-#endif	
+#endif
 						for (size_t i=0; i<num_chunks; i++) {
 							cblas_dgemv(CblasRowMajor, CblasNoTrans, _m, _n, 1, chunks + (_m*_n*i), _n, dx, 1, 0, ctd, 1);
-#ifdef DEBUG_CHUNK_APPLY				
+#ifdef DEBUG_CHUNK_APPLY
 							for (size_t j=0;j<_n;j++)
 								std::cout<<integer(*(ctd+j))<<",";
-							std::cout<<std::endl;					       
-#endif			
-							
+							std::cout<<std::endl;
+#endif
+
 							//if (!use_neg || i<num_chunks-1)
 							for (size_t j=0; j<_n; j++) {
 								// up to 53 bits will be ored-in, to be summed later
@@ -582,21 +616,21 @@ namespace LinBox {
 								bitDest += rclen*((i % rc)*_n+j);
 								long long mask = static_cast<long long>(ctd[j]);
 								bitDest += 2*i;
-								*((long long*) bitDest) |= mask; 
+								*((long long*) bitDest) |= mask;
 							}
 						}
 						delete[] dx;
 						for (size_t i=0; i<_n; i++) {
 							LinBox::integer result, tmp;
 							/*
-							  if (use_neg) {
-							  result = -ctd[i];
-							  result <<= (num_chunks-1)*16;
-							  }
-							  else
-							*/
+							   if (use_neg) {
+							   result = -ctd[i];
+							   result <<= (num_chunks-1)*16;
+							   }
+							   else
+							   */
 							result = 0;
-							
+
 							for (int j=0; j<rc; j++) {
 								unsigned char* thispos = combined + rclen*(j*_n+i);
 								importWords(tmp, rclen, -1, 1, 0, 0, thispos);
@@ -608,10 +642,10 @@ namespace LinBox {
 						if (use_neg) {
 							Element acc;
 							_D.init(acc,0);
-							for (size_t i=0;i<x.size();++i)					
+							for (size_t i=0;i<x.size();++i)
 								_D.addin(acc,x[i]);
 							_D.mulin(acc,shift);
-							
+
 							for (size_t i=0;i<y.size();++i)
 								_D.subin(y[i], acc);
 						}
@@ -620,34 +654,34 @@ namespace LinBox {
 					}
 				}
 				break;
-						
+
 			case VectorQadic:
 				{
 #ifdef TIMING_APPLY
 					Timer chrono;
 					chrono.clear();
 					chrono.start();
-#endif	
+#endif
 					// fill vector chunks with zero
 					memset(vchunks, 0, sizeof(double)*_n*num_chunks);
-					
+
 					// smallest distance of non-overlaping chunks results
-					size_t rc = (52 / chunk_size) + 1; 
-					
+					size_t rc = (52 / chunk_size) + 1;
+
 					// number of bytes in a chunks
-					size_t chunk_byte= (chunk_size == 32)? 4: 2; 
+					size_t chunk_byte= (chunk_size == 32)? 4: 2;
 
 					// number of byte to store
 					size_t rclen = num_chunks*chunk_byte + 5;
-					
+
 					unsigned char* combined = new unsigned char[rclen];
-					
+
 					double *ctd= new double[_m*num_chunks];
 					if (chunk_size >=32)
 						create_VectorQadic_32 (_D, x, vchunks, num_chunks);
 					else
 						create_VectorQadic (_D, x, vchunks, num_chunks);
-#ifdef TIMING_APPLY					
+#ifdef TIMING_APPLY
 					chrono.stop();
 					_convert_data+=chrono;
 					chrono.clear();
@@ -656,14 +690,14 @@ namespace LinBox {
 					cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, _m, num_chunks, _n, 1.,
 						    chunks, _n, vchunks, num_chunks, 0., ctd, num_chunks);
 
-#ifdef TIMING_APPLY					
+#ifdef TIMING_APPLY
 					chrono.stop();
 					_apply+=chrono;
 					chrono.clear();
 					chrono.start();
 #endif
-					
-#ifdef DEBUG_CHUNK_APPLY				
+
+#ifdef DEBUG_CHUNK_APPLY
 
 					std::cout<<"- A ---------------------------\n";
 					for (size_t i=0;i<_m;i++){
@@ -672,7 +706,7 @@ namespace LinBox {
 						std::cout<<std::endl;
 					}
 
-					
+
 					std::cout<<"- x chunk-----------------------\n";
 					for (size_t i=0;i<_n;i++){
 						for (size_t j=0;j<num_chunks;j++)
@@ -690,43 +724,43 @@ namespace LinBox {
 					for (size_t i=0; i< _m; ++i){
 						integer result=0, val;
 						for (size_t k=0; k< rc;++k){
-							memset(combined, 0, rclen);						
+							memset(combined, 0, rclen);
 							unsigned char* BitDest = combined+chunk_byte*k;
-							for (size_t j=k; j< num_chunks; j+=rc){						
+							for (size_t j=k; j< num_chunks; j+=rc){
 								long long mask = static_cast<long long>(ctd[i*num_chunks+j]);
-								*((long long*) BitDest) |= mask; 
-								BitDest+=rc*chunk_byte;						
+								*((long long*) BitDest) |= mask;
+								BitDest+=rc*chunk_byte;
 							}
 							importWords(val, rclen, -1, 1, 0, 0, combined);
 							result+=val;
 						}
 						_D.init(y[i], result);
 					}
-					
+
 					// shift back the result
 					if (use_neg) {
 						Element acc;
 						_D.init(acc,0);
-						for (size_t i=0;i<x.size();++i)					
+						for (size_t i=0;i<x.size();++i)
 							_D.addin(acc,x[i]);
 						_D.mulin(acc,shift);
-						
+
 						for (size_t i=0;i<y.size();++i)
 							_D.subin(y[i], acc);
 					}
-					
+
 					delete[] combined;
 					delete[] ctd;
-#ifdef TIMING_APPLY					
+#ifdef TIMING_APPLY
 					chrono.stop();
 					_convert_result+=chrono;
-#endif	
+#endif
 
 				}
 				break;
 
 			case CRT:
-				
+
 				{
 #ifdef TIMING_APPLY
 					Timer chrono;
@@ -737,16 +771,16 @@ namespace LinBox {
 					integer mod, hmod;
 					mod  = _rns->getCRTmodulo ();
 					hmod = (mod-1)>>1;
-					
+
 					// fill rns vector with zero
 					//memset(vchunks, 0, sizeof(double)*_n*rns_size);
-					
-					// create rns vector			
+
+					// create rns vector
 					create_VectorRNS (*_rns, _D, x, vchunks);
-					
+
 					// allocate memory for the result
 					double *ctd= new double[_m*rns_size];
-#ifdef TIMING_APPLY					
+#ifdef TIMING_APPLY
 					chrono.stop();
 					_convert_data+=chrono;
 					chrono.clear();
@@ -756,14 +790,14 @@ namespace LinBox {
 					for (size_t i=0;i< rns_size; ++i)
 						cblas_dgemv(CblasRowMajor, CblasNoTrans, _m, _n,
 							    1, chunks+i*_m*_n, _n, vchunks+i*_n, 1, 0, ctd+i*_m, 1);
-#ifdef TIMING_APPLY				
+#ifdef TIMING_APPLY
 					chrono.stop();
 					_apply+=chrono;
 					chrono.clear();
 					chrono.start();
 #endif
 
-#ifdef DEBUG_CHUNK_APPLY		
+#ifdef DEBUG_CHUNK_APPLY
 					_rns->write(std::cout);
 					std::cout<<"- A RNS --------------------------\n";
 					for (size_t k=0;k<rns_size;++k){
@@ -801,19 +835,19 @@ namespace LinBox {
 						//if (y[j] > hmod) y[j]-=mod;
 					}
 					delete[] ctd;
-					
-					/*
-					  std::cout << "y mod q: ";
-					  for (size_t i=0; i<y.size(); i++) 
-					  std::cout << y[i] << ' ';
-					  std::cout << std::endl;
-					  std::cout << "b: ";
-					  for (size_t i=0; i<b.size(); i++) 
-					  std::cout << b[i] << ' ';
-					  std::cout << std::endl;
-					
-					  std::cout<<"p: "<<_prime<<" q: "<<_q<<std::endl;
-					*/
+
+#if 0
+					std::cout << "y mod q: ";
+					for (size_t i=0; i<y.size(); i++)
+						std::cout << y[i] << ' ';
+					std::cout << std::endl;
+					std::cout << "b: ";
+					for (size_t i=0; i<b.size(); i++)
+						std::cout << b[i] << ' ';
+					std::cout << std::endl;
+
+					std::cout<<"p: "<<_prime<<" q: "<<_q<<std::endl;
+#endif
 					Element y_cur, b_cur;
 					// finish crt according to b
 					for (size_t i=0;i<_m;++i){
@@ -825,99 +859,103 @@ namespace LinBox {
 						if ( y[i] > _h_pq) y[i]-=_pq;
 					}
 					/*
-					  std::cout << "y: ";
-					  for (size_t i=0; i<y.size(); i++) 
-					  std::cout << y[i] << ' ';
-					  std::cout << std::endl;
-					*/
-					
+					   std::cout << "y: ";
+					   for (size_t i=0; i<y.size(); i++)
+					   std::cout << y[i] << ' ';
+					   std::cout << std::endl;
+					   */
+
 #ifdef TIMING_APPLY
 					chrono.stop();
 					_convert_result+=chrono;
 #endif
 				}
 				break;
-			}			
-		
+			}
+
 #ifdef DEBUG_CHUNK_APPLY
 			std::cout << "y: ";
-			for (size_t i=0; i<y.size(); i++) 
+			for (size_t i=0; i<y.size(); i++)
 				std::cout << y[i] << ' ';
 			std::cout << std::endl;
 #endif
 
-	
+
 			return y;
 		}
 
 
-		Vector& applyVTrans(Vector& y, Vector& x) const {
-			TransposeMatrix<IMatrix> B(_M); 
+		Vector& applyVTrans(Vector& y, Vector& x) const
+		{
+			TransposeMatrix<IMatrix> B(_M);
 			return _MD.vectorMul (y, B, x);
 		}
 
 
-		IMatrix& applyM (IMatrix &Y, const IMatrix &X) const {
+		IMatrix& applyM (IMatrix &Y, const IMatrix &X) const
+		{
 
 			linbox_check( _n == X.rowdim());
 			linbox_check( _m == Y.rowdim());
-			linbox_check( Y.coldim() == X.coldim()); 
+			linbox_check( Y.coldim() == X.coldim());
 
 			if (!use_chunks){
-				_MD.mul (Y, _M, X);			
+				_MD.mul (Y, _M, X);
 			}
 			else{
 				size_t _k= X.coldim();
 				double* dX = new double[_n*_k];
-				for (size_t i=0; i<_n; i++) 
+				for (size_t i=0; i<_n; i++)
 					for(size_t j=0;j<_k;++j)
 						_D.convert(dX[i*_k+j], X.getEntry(i,j));
-					    
+
 #ifdef DEBUG_CHUNK_APPLYM
 				cout << "X: ";
 				X.write(cout,_D);
 				cout << endl;
 #endif
 
-	
+
 				if (num_chunks == 1) {
 					double *ctd = new double[_m*_k];
 					cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans,
 						    _m,_k,_n, 1,
 						    chunks,_n, dX, _k, 0, ctd, _k);
-					
+
 					for (size_t i=0;i<_m;++i)
-						for (size_t j=0;j<_k;++j)							
+						for (size_t j=0;j<_k;++j)
 							_D.init(Y.refEntry(i,j),ctd[i*_k+j]);
 					delete[] ctd;
 					delete[] dX;
 				}
 				else {
-					//rc: number of vectors to recombine
-					//(the idea is that to compute a polynomial in the base 2^chunksize
-					// with <= 53 bits in each coefficient, we can instead OR nonoverlapping blocks
-					// of bits and then add them at the end, like this:
-					//      AAAACCCCEEEEGGGG   instead  AAAA << 12 + BBBB << 10 + CCCC << 8 + ...
-					//    +   BBBBDDDDFFFF00      of     
-					// also note that we need separate blocks for positive and negative entries)
-		
+					/*
+					 * rc: number of vectors to recombine
+					 *(the idea is that to compute a polynomial in the base 2^chunksize
+					 * with <= 53 bits in each coefficient, we can instead OR nonoverlapping blocks
+					 * of bits and then add them at the end, like this:
+					 *     AAAACCCCEEEEGGGG   instead  AAAA << 12 + BBBB << 10 + CCCC << 8 + ...
+					 *   +   BBBBDDDDFFFF00      of
+					 * also note that we need separate blocks for positive and negative entries)
+					 */
+
 					int rc = (52 / chunk_size) + 1; //constant at 4 for now
-		
+
 					//rclen: number of bytes in each of these OR-ed vectors
-					// needs room to hold (max long long) << (num_chunks * chunksize) 
-		
+					// needs room to hold (max long long) << (num_chunks * chunksize)
+
 					int rclen = num_chunks*2 + 5;
-		
-					// 					cout << "rc= " << rc << ", rclen = " << rclen << endl;
-		
+
+					// cout << "rc= " << rc << ", rclen = " << rclen << endl;
+
 					unsigned char* combined = new unsigned char[rc*_m*_k*rclen];
 					memset(combined, 0, rc*_m*_k*rclen);
 
 					//order from major index to minor: combining index, component of sol'n, byte
-		
+
 					//compute a product (chunk times x) for each chunk
 					double* ctd = new double[_m*_k];
-		
+
 					for (size_t i=0; i<num_chunks; i++) {
 						cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans,
 							    _m,_k,_n, 1,
@@ -930,12 +968,12 @@ namespace LinBox {
 								bitDest += rclen*((i % rc)*_m*_k+j);
 								long long mask = static_cast<long long>(ctd[j]);
 								bitDest += 2*i;
-								*((long long*) bitDest) |= mask; 
+								*((long long*) bitDest) |= mask;
 							}
 					}
-		
+
 					delete[] dX;
-					
+
 					for (size_t i=0; i<_m*_k; i++) {
 						LinBox::integer result, tmp;
 						if (use_neg) {
@@ -947,7 +985,7 @@ namespace LinBox {
 						}
 						else
 							result = 0;
-			
+
 						for (int j=0; j<rc; j++) {
 							unsigned char* thispos = combined + rclen*(j*_m*_k+i);
 							importWords(tmp, rclen, -1, 1, 0, 0, thispos);
@@ -959,7 +997,7 @@ namespace LinBox {
 #ifdef DEBUG_CHUNK_APPLYM
 						cout << "v2[" << i << "]:" << result  << endl;
 #endif
-						
+
 						_D.init(*(Y.getWritePointer()+i), result);
 					}
 					delete[] combined;
@@ -968,8 +1006,8 @@ namespace LinBox {
 			}
 			return Y;
 		}
-	
-		
+
+
 
 	protected:
 		Domain                             _D;
@@ -990,55 +1028,65 @@ namespace LinBox {
 		MultiModDouble      *_rns;
 		Element            _prime, _q, _inv_q, _pq, _h_pq;
 		mutable Timer              _apply, _convert_data, _convert_result;
-		
-		
+
+
 
 
 	};
-	
+
+#ifndef __INTEL_COMPILER
 	template<>
+	#endif
 	template <class Domain>
 	class MatrixApplyDomain<Domain, BlasMatrix<typename Domain::Element> > : public BlasMatrixApplyDomain<Domain, BlasMatrix<typename Domain::Element> > {
 
 	public:
-		MatrixApplyDomain (const Domain &D, const  BlasMatrix<typename Domain::Element> &M)
-			: BlasMatrixApplyDomain<Domain, BlasMatrix<typename Domain::Element> > (D,M) {}
-		
+		MatrixApplyDomain (const Domain &D, const  BlasMatrix<typename Domain::Element> &M) :
+			BlasMatrixApplyDomain<Domain, BlasMatrix<typename Domain::Element> > (D,M)
+		{}
+
 	};
 
+#ifndef __INTEL_COMPILER
 	template<>
+	#endif
 	template <class Domain>
 	class MatrixApplyDomain<Domain, DenseMatrix<Domain> > : public BlasMatrixApplyDomain<Domain, DenseMatrix<Domain> > {
-		
+
 	public:
-		MatrixApplyDomain (const Domain &D, const DenseMatrix<Domain> &M)
-			: BlasMatrixApplyDomain<Domain, DenseMatrix<Domain> > (D,M) {}
+		MatrixApplyDomain (const Domain &D, const DenseMatrix<Domain> &M) :
+			BlasMatrixApplyDomain<Domain, DenseMatrix<Domain> > (D,M)
+		{}
 	};
-	
-	
+
+
+#ifndef __INTEL_COMPILER
 	template<>
+	#endif
 	template <class Domain>
-	class MatrixApplyDomain<Domain, BlasBlackbox<Domain> > : 
-		public BlasMatrixApplyDomain<Domain, BlasBlackbox<Domain> > {
+	class MatrixApplyDomain<Domain, BlasBlackbox<Domain> > :
+	public BlasMatrixApplyDomain<Domain, BlasBlackbox<Domain> > {
 
 	public:
-		MatrixApplyDomain (const Domain &D, const  BlasBlackbox<Domain> &M)
-			: BlasMatrixApplyDomain<Domain, BlasBlackbox<Domain> > (D,M) {}
-		
+		MatrixApplyDomain (const Domain &D, const  BlasBlackbox<Domain> &M) :
+			BlasMatrixApplyDomain<Domain, BlasBlackbox<Domain> > (D,M)
+		{}
+
 	};
 
 
 
 	/** \brief split an integer matrix into a padic chunk representation
 	 *
-	 */	
+	 */
 	template <class Domain, class IMatrix>
 	void create_MatrixQadic (const Domain           &D,
 				 const IMatrix          &M,
-				 double            *chunks, 
+				 double            *chunks,
 				 size_t         num_chunks,
-				 const integer    &shift=0) {
-	
+				 const integer    shift)
+	{
+
 		typename IMatrix::ConstRawIterator it= M.rawBegin();
 
 		size_t m,n,mn;
@@ -1047,140 +1095,143 @@ namespace LinBox {
 		mn = m*n;
 
 		size_t tmpsize, tmpbitsize, j;
-  
+
 
 		if (num_chunks ==1)
-			for (size_t i=0; i<mn; ++i, ++it) 
-				D.convert(*(chunks+i), *it);  
+			for (size_t i=0; i<mn; ++i, ++it)
+				D.convert(*(chunks+i), *it);
 		else
 			for (size_t i=0; i<mn; ++i, ++it) {
 				integer tmp;
 				double* pdbl = chunks + i;
 				D.convert(tmp, *it);
-				tmp=tmp+shift;				
+				tmp=tmp+shift;
 				tmpsize    = tmp.size();
 				tmpbitsize = tmp.bitsize();
 
 				if (tmp ==0) {
 					*pdbl=0;
-				} else  
+				}
+				else
 					if (tmp > 0) {
-					
-//if (sizeof(long)==8 ) {		
+
+						//if (sizeof(long)==8 ) {
 #if __LINBOX_SIZEOF_LONG  == 8
 
 						// specialization for 64bits integer limbs
 						for (j=0; j<tmpsize-1; j++) {
-							*pdbl        =  tmp[j]        & 0xFFFF;
-							*(pdbl+mn)   = (tmp[j] >> 16) & 0xFFFF;	
-							*(pdbl+2*mn) = (tmp[j] >> 32) & 0xFFFF;
-							*(pdbl+3*mn) = (tmp[j] >> 48) & 0xFFFF;
+							*pdbl        = double( tmp[j]        & 0xFFFF);
+							*(pdbl+mn)   = double((tmp[j] >> 16) & 0xFFFF);
+							*(pdbl+2*mn) = double((tmp[j] >> 32) & 0xFFFF);
+							*(pdbl+3*mn) = double((tmp[j] >> 48) & 0xFFFF);
 							pdbl      += 4*mn;
 						}
 						if ((tmpbitsize - j*64) > 0 ) {
-							*pdbl = tmp[tmpsize-1]&0xFFFF; 
+							*pdbl = double(tmp[tmpsize-1]&0xFFFF);
 							pdbl+=mn;
 						}
-						if ((tmpbitsize - j*64) > 16 ) { 
-							*pdbl = (tmp[tmpsize-1] >> 16)& 0xFFFF;
+						if ((tmpbitsize - j*64) > 16 ) {
+							*pdbl = double((tmp[tmpsize-1] >> 16)& 0xFFFF);
 							pdbl+=mn;
 						}
 						if ((tmpbitsize - j*64) > 32 ) {
-							*pdbl = (tmp[tmpsize-1] >> 32)& 0xFFFF;
+							*pdbl = double((tmp[tmpsize-1] >> 32)& 0xFFFF);
 							pdbl+=mn;
 						}
-						if ((tmpbitsize - j*64) > 48 ) 
-							*pdbl = (tmp[tmpsize-1] >> 48)& 0xFFFF;
-//} else {
-#else	     	    						
-						// specialization for 32bits integer limbs	   	    
+						if ((tmpbitsize - j*64) > 48 )
+							*pdbl = double((tmp[tmpsize-1] >> 48)& 0xFFFF);
+						//}
+						// else {
+#else
+						// specialization for 32bits integer limbs
 						for (j=0; j<tmpsize-1; j++) {
-							*pdbl      = tmp[j] &  0xFFFF;
-							*(pdbl+mn) = tmp[j] >> 16;									
+							*pdbl      = double(tmp[j] &  0xFFFF);
+							*(pdbl+mn) = tmp[j] >> 16;
 							pdbl      += 2*mn;
 						}
 						if ((tmpbitsize - j*32) > 16 ) {
-							*pdbl      = tmp[tmpsize-1] &  0xFFFF;
-							*(pdbl+mn) = tmp[tmpsize-1] >> 16;									
+							*pdbl      = double(tmp[tmpsize-1] &  0xFFFF);
+							*(pdbl+mn) = tmp[tmpsize-1] >> 16;
 						}
 						else {
-							*pdbl      = tmp[tmpsize-1] & 0xFFFF;								
-						}						
-//}
-#endif						
+							*pdbl      = double(tmp[tmpsize-1] & 0xFFFF);
+						}
+						//}
+#endif
 					}
 					else {
 						++tmp;
 #if __LINBOX_SIZEOF_LONG == 8
 						// specialization for 64bits integer limbs
 						for (j=0; j<tmpsize-1; j++) {
-							*pdbl        = 0xFFFF ^ ( tmp[j]        & 0xFFFF);
-							*(pdbl+mn)   = 0xFFFF ^ ((tmp[j] >> 16) & 0xFFFF);
-							*(pdbl+2*mn) = 0xFFFF ^ ((tmp[j] >> 32) & 0xFFFF);
-							*(pdbl+3*mn) = 0xFFFF ^ ((tmp[j] >> 48) & 0xFFFF);
+							*pdbl        = double(0xFFFF ^ ( tmp[j]        & 0xFFFF));
+							*(pdbl+mn)   = double(0xFFFF ^ ((tmp[j] >> 16) & 0xFFFF));
+							*(pdbl+2*mn) = double(0xFFFF ^ ((tmp[j] >> 32) & 0xFFFF));
+							*(pdbl+3*mn) = double(0xFFFF ^ ((tmp[j] >> 48) & 0xFFFF));
 							pdbl        += 4*mn;
 						}
-						
+
 						j=j<<2;
 						if ((tmpbitsize - j*64) > 0 ) {
-							*pdbl = 0xFFFF ^ (tmp[tmpsize-1]&0xFFFF); 
+							*pdbl = double(0xFFFF ^ (tmp[tmpsize-1]&0xFFFF));
 							pdbl+=mn;
 							++j;
 						}
-						if ((tmpbitsize - j*64) > 16 ) { 
-							*pdbl = 0xFFFF ^ ((tmp[tmpsize-1] >> 16)& 0xFFFF);
+						if ((tmpbitsize - j*64) > 16 ) {
+							*pdbl = double(0xFFFF ^ ((tmp[tmpsize-1] >> 16)& 0xFFFF));
 							pdbl+=mn;
 							++j;
 						}
 						if ((tmpbitsize - j*64) > 32 ) {
-							*pdbl = 0xFFFF ^ ((tmp[tmpsize-1] >> 32)& 0xFFFF);
+							*pdbl = double(0xFFFF ^ ((tmp[tmpsize-1] >> 32)& 0xFFFF));
 							pdbl+=mn;
 							++j;
 						}
 						if ((tmpbitsize - j*64) > 48 ) {
-							*pdbl = 0xFFFF ^ ((tmp[tmpsize-1] >> 48)& 0xFFFF);
+							*pdbl = double(0xFFFF ^ ((tmp[tmpsize-1] >> 48)& 0xFFFF));
 							++j;
 						}
-						
-						for (; j<num_chunks-1; j++, pdbl += mn) 
-							*pdbl      = 0xFFFF;
-						*pdbl = 1; 
+
+						for (; j<num_chunks-1; j++, pdbl += mn)
+							*pdbl      = double(0xFFFF);
+						*pdbl = 1;
 #else
 						// specialization for 32bits integer limb
 						for (j=0; j<tmpsize-1; j++) {
-							*pdbl      = 0xFFFF ^ (tmp[j] & 0xFFFF);
-							*(pdbl+mn) = 0xFFFF ^ (tmp[j] >> 16);
-							pdbl      += 2*mn;							
+							*pdbl      = double(0xFFFF ^ (tmp[j] & 0xFFFF));
+							*(pdbl+mn) = double(0xFFFF ^ (tmp[j] >> 16));
+							pdbl      += 2*mn;
 						}
 						j=j<<1;
 						if ((tmpbitsize -j*32) > 16) {
-							*pdbl      = 0xFFFF ^ (tmp[tmpsize-1] & 0xFFFF);
-							*(pdbl+mn) = 0xFFFF ^ (tmp[tmpsize-1] >> 16);
+							*pdbl      = double(0xFFFF ^ (tmp[tmpsize-1] & 0xFFFF));
+							*(pdbl+mn) = double(0xFFFF ^ (tmp[tmpsize-1] >> 16));
 							pdbl      += 2*mn;
 							j+=2;
 						}
 						else {
-							*pdbl      = 0xFFFF ^ (tmp[tmpsize-1] & 0xFFFF);
+							*pdbl      = double(0xFFFF ^ (tmp[tmpsize-1] & 0xFFFF));
 							pdbl      += mn;
 							j+=1;
 						}
-						
-						for (; j<num_chunks-1; j++, pdbl += mn) 
-							*pdbl      = 0xFFFF;
-						*pdbl = 1; 
+
+						for (; j<num_chunks-1; j++, pdbl += mn)
+							*pdbl      = double(0xFFFF);
+						*pdbl = 1;
 #endif
 					}
-			}	
+			}
 	}
 
 	/** \brief split an integer vector into a padic chunk representation
 	 *
-	 */	
+	 */
 	template <class Domain, class Vector>
 	void create_VectorQadic (const Domain            &D,
 				 const Vector            &V,
-				 double             *chunks, 
-				 size_t          num_chunks) {
+				 double             *chunks,
+				 size_t          num_chunks)
+	{
 
 
 		typename Vector::const_iterator it= V.begin();
@@ -1191,8 +1242,8 @@ namespace LinBox {
 		size_t tmpsize, tmpbitsize, j;
 
 		if (num_chunks ==1)
-			for (size_t i=0; i<mn; ++i, ++it) 
-				D.convert(*(chunks+i), *it);  
+			for (size_t i=0; i<mn; ++i, ++it)
+				D.convert(*(chunks+i), *it);
 		else
 			for (size_t i=0; i<mn; ++i, ++it) {
 				integer tmp;
@@ -1200,125 +1251,126 @@ namespace LinBox {
 				D.convert(tmp, *it);
 				tmpsize    = tmp.size();
 				tmpbitsize = tmp.bitsize();
-			
+
 				if (tmp ==0)
 					*pdbl=0;
-				else  
+				else
 					if (tmp > 0) {
-					
-		
+
+
 #if __LINBOX_SIZEOF_LONG == 8
 						// specialization for 64bits integer limbs
 						for (j=0; j<tmpsize-1; j++) {
-							*pdbl     =  tmp[j]        & 0xFFFF;
-							*(pdbl+1) = (tmp[j] >> 16) & 0xFFFF;	
-							*(pdbl+2) = (tmp[j] >> 32) & 0xFFFF;
-							*(pdbl+3) = (tmp[j] >> 48) & 0xFFFF;
+							*pdbl     = double( tmp[j]        & 0xFFFF);
+							*(pdbl+1) = double((tmp[j] >> 16) & 0xFFFF);
+							*(pdbl+2) = double((tmp[j] >> 32) & 0xFFFF);
+							*(pdbl+3) = double((tmp[j] >> 48) & 0xFFFF);
 							pdbl     += 4;
 						}
 						if ((tmpbitsize - j*64) > 0 ) {
-							*pdbl = tmp[tmpsize-1]&0xFFFF; 
+							*pdbl = double(tmp[tmpsize-1]&0xFFFF);
 							pdbl++;
 						}
-						if ((tmpbitsize - j*64) > 16 ) { 
-							*pdbl = (tmp[tmpsize-1] >> 16)& 0xFFFF;
+						if ((tmpbitsize - j*64) > 16 ) {
+							*pdbl = double((tmp[tmpsize-1] >> 16)& 0xFFFF);
 							pdbl++;
 						}
 						if ((tmpbitsize - j*64) > 32 ) {
-							*pdbl = (tmp[tmpsize-1] >> 32)& 0xFFFF;
+							*pdbl = double((tmp[tmpsize-1] >> 32)& 0xFFFF);
 							pdbl++;
 						}
-						if ((tmpbitsize - j*64) > 48 ) 
-							*pdbl = (tmp[tmpsize-1] >> 48)& 0xFFFF;
-#else	     	    						
-						// specialization for 32bits integer limbs	   	    
+						if ((tmpbitsize - j*64) > 48 )
+							*pdbl = double((tmp[tmpsize-1] >> 48)& 0xFFFF);
+#else
+						// specialization for 32bits integer limbs
 						for (j=0; j<tmpsize-1; j++) {
-							*pdbl     = tmp[j] &  0xFFFF;
-							*(pdbl+1) = tmp[j] >> 16;									
+							*pdbl     = double(tmp[j] &  0xFFFF);
+							*(pdbl+1) = tmp[j] >> 16;
 							pdbl     += 2;
 						}
 						if ((tmpbitsize - j*32) > 16 ) {
-							*pdbl     = tmp[tmpsize-1] &  0xFFFF;
-							*(pdbl+1) = tmp[tmpsize-1] >> 16;									
+							*pdbl     = double(tmp[tmpsize-1] &  0xFFFF);
+							*(pdbl+1) = tmp[tmpsize-1] >> 16;
 						}
 						else {
-							*pdbl      = tmp[tmpsize-1] & 0xFFFF;								
-						}						
-#endif						
+							*pdbl      = double(tmp[tmpsize-1] & 0xFFFF);
+						}
+#endif
 					}
 					else {
 						++tmp;
 #if __LINBOX_SIZEOF_LONG == 8
 						// specialization for 64bits integer limbs
 						for (j=0; j<tmpsize-1; j++) {
-							*pdbl     = 0xFFFF ^ ( tmp[j]        & 0xFFFF);
-							*(pdbl+1) = 0xFFFF ^ ((tmp[j] >> 16) & 0xFFFF);
-							*(pdbl+2) = 0xFFFF ^ ((tmp[j] >> 32) & 0xFFFF);
-							*(pdbl+3) = 0xFFFF ^ ((tmp[j] >> 48) & 0xFFFF);
+							*pdbl     = (double) (0xFFFF ^ ( tmp[j]        & 0xFFFF));
+							*(pdbl+1) = (double) (0xFFFF ^ ((tmp[j] >> 16) & 0xFFFF));
+							*(pdbl+2) = (double) (0xFFFF ^ ((tmp[j] >> 32) & 0xFFFF));
+							*(pdbl+3) = (double) (0xFFFF ^ ((tmp[j] >> 48) & 0xFFFF));
 							pdbl     += 4   ;
 						}
-						
+
 						j=j<<2;
 						if ((tmpbitsize - j*64) > 0 ) {
-							*pdbl = 0xFFFF ^ (tmp[tmpsize-1]&0xFFFF); 
+							*pdbl = (double) (0xFFFF ^ (tmp[tmpsize-1]&0xFFFF));
 							pdbl++;
 							++j;
 						}
-						if ((tmpbitsize - j*64) > 16 ) { 
-							*pdbl = 0xFFFF ^ ((tmp[tmpsize-1] >> 16)& 0xFFFF);
+						if ((tmpbitsize - j*64) > 16 ) {
+							*pdbl = (double) (0xFFFF ^ ((tmp[tmpsize-1] >> 16)& 0xFFFF));
 							pdbl++;
 							++j;
 						}
 						if ((tmpbitsize - j*64) > 32 ) {
-							*pdbl = 0xFFFF ^ ((tmp[tmpsize-1] >> 32)& 0xFFFF);
+							*pdbl = (double) (0xFFFF ^ ((tmp[tmpsize-1] >> 32)& 0xFFFF));
 							pdbl++;
 							++j;
 						}
 						if ((tmpbitsize - j*64) > 48 ) {
-							*pdbl = 0xFFFF ^ ((tmp[tmpsize-1] >> 48)& 0xFFFF);
+							*pdbl = (double) (0xFFFF ^ ((tmp[tmpsize-1] >> 48)& 0xFFFF));
 							++j;
 						}
-						
-						for (; j<num_chunks-1; j++, pdbl += mn) 
-							*pdbl      = 0xFFFF;
-						*pdbl = 1; 
+
+						for (; j<num_chunks-1; j++, pdbl += mn)
+							*pdbl      = (double) (0xFFFF);
+						*pdbl = 1;
 #else
 						// specialization for 32bits integer limb
 						for (j=0; j<tmpsize-1; j++) {
-							*pdbl      = 0xFFFF ^ (tmp[j] & 0xFFFF);
-							*(pdbl+1) = 0xFFFF ^ (tmp[j] >> 16);
-							pdbl      += 2;							
+							*pdbl      = (double) (0xFFFF ^ (tmp[j] & 0xFFFF));
+							*(pdbl+1)  = (double) (0xFFFF ^ (tmp[j] >> 16));
+							pdbl      += 2;
 						}
 						j=j<<1;
 						if ((tmpbitsize -j*32) > 16) {
-							*pdbl      = 0xFFFF ^ (tmp[tmpsize-1] & 0xFFFF);
-							*(pdbl+1) = 0xFFFF ^ (tmp[tmpsize-1] >> 16);
+							*pdbl      = (double) (0xFFFF ^ (tmp[tmpsize-1] & 0xFFFF));
+							*(pdbl+1)  = (double) (0xFFFF ^ (tmp[tmpsize-1] >> 16));
 							pdbl      += 2;
 							j+=2;
 						}
 						else {
-							*pdbl      = 0xFFFF ^ (tmp[tmpsize-1] & 0xFFFF);
+							*pdbl      = (double) (0xFFFF ^ (tmp[tmpsize-1] & 0xFFFF));
 							pdbl      += 1;
 							j+=1;
 						}
-						
-						for (; j<num_chunks-1; j++, pdbl += mn) 
-							*pdbl      = 0xFFFF;
-						*pdbl = 1; 
+
+						for (; j<num_chunks-1; j++, pdbl += mn)
+							*pdbl      = (double) (0xFFFF);
+						*pdbl = 1;
 #endif
 					}
 			}
-		
+
 	}
 
 	/** \brief split an integer vector into a padic chunk representation
 	 *
-	 */	
+	 */
 	template <class Domain, class Vector>
 	void create_VectorQadic_32 (const Domain            &D,
 				    const Vector            &V,
-				    double             *chunks, 
-				    size_t          num_chunks) {
+				    double             *chunks,
+				    size_t          num_chunks)
+	{
 
 
 		typename Vector::const_iterator it= V.begin();
@@ -1329,8 +1381,8 @@ namespace LinBox {
 		size_t tmpsize, tmpbitsize, j;
 
 		if (num_chunks ==1)
-			for (size_t i=0; i<mn; ++i, ++it) 
-				D.convert(*(chunks+i), *it);  
+			for (size_t i=0; i<mn; ++i, ++it)
+				D.convert(*(chunks+i), *it);
 		else
 			for (size_t i=0; i<mn; ++i, ++it) {
 				integer tmp;
@@ -1338,94 +1390,95 @@ namespace LinBox {
 				D.convert(tmp, *it);
 				tmpsize    = tmp.size();
 				tmpbitsize = tmp.bitsize();
-			
+
 				if (tmp ==0)
 					*pdbl=0;
-				else  
+				else
 					if (tmp > 0) {
-					
-		
+
+
 #if __LINBOX_SIZEOF_LONG == 8
 						// specialization for 64bits integer limbs
 						for (j=0; j<tmpsize-1; j++) {
-							*pdbl     =  tmp[j] & 0xFFFFFFFF;
-							*(pdbl+1) =  tmp[j] >> 32;	
+							*pdbl     =  double(tmp[j] & 0xFFFFFFFF);
+							*(pdbl+1) =  double(tmp[j] >> 32);
 							pdbl     += 2;
 						}
 						if ((tmpbitsize - j*64) > 0 ) {
-							*pdbl = tmp[tmpsize-1]&0xFFFFFFFF; 
+							*pdbl = double(tmp[tmpsize-1]&0xFFFFFFFF);
 							pdbl++;
 						}
-#else	     	    						
-						// specialization for 32bits integer limbs	   	    
+#else
+						// specialization for 32bits integer limbs
 						for (j=0; j<tmpsize; j++) {
 							*pdbl     = tmp[j] ;
 							pdbl     += 1;
 						}
-#endif						
+#endif
 					}
 					else {
 						++tmp;
 #if __LINBOX_SIZEOF_LONG == 8
 						// specialization for 64bits integer limbs
 						for (j=0; j<tmpsize; j++) {
-							*pdbl     = 0xFFFFFFFF ^ ( tmp[j] & 0xFFFFFFFF);
-							*(pdbl+2) = 0xFFFFFFFF ^ ( tmp[j] >> 32);
+							*pdbl     = double(0xFFFFFFFF ^ ( tmp[j] & 0xFFFFFFFF));
+							*(pdbl+2) = double(0xFFFFFFFF ^ ( tmp[j] >> 32));
 							pdbl     += 2   ;
 						}
-						
+
 						j=j<<2;
 						if ((tmpbitsize - j*64) > 0 ) {
-							*pdbl = 0xFFFFFFFF ^ (tmp[tmpsize-1]&0xFFFFFFFF); 
+							*pdbl = double(0xFFFFFFFF ^ (tmp[tmpsize-1]&0xFFFFFFFF));
 							pdbl++;
 							++j;
 						}
 
 						if ((tmpbitsize - j*64) > 32 ) {
-							*pdbl = 0xFFFF ^ (tmp[tmpsize-1] >> 32);
+							*pdbl = double(0xFFFF ^ (tmp[tmpsize-1] >> 32));
 							pdbl++;
 							++j;
 						}
 
-						for (; j<num_chunks-1; j++, pdbl += mn) 
-							*pdbl      = 0xFFFFFFFF;
-						*pdbl = 1; 
+						for (; j<num_chunks-1; j++, pdbl += mn)
+							*pdbl      = double(0xFFFFFFFF);
+						*pdbl = 1;
 #else
 						// specialization for 32bits integer limb
 						for (j=0; j<tmpsize-1; j++) {
-							*pdbl      = 0xFFFFFFFF ^ tmp[j];
-							pdbl      += 1;							
+							*pdbl      = double(0xFFFFFFFF ^ tmp[j]);
+							pdbl      += 1;
 						}
 						j=j<<1;
-						
-						for (; j<num_chunks-1; j++, pdbl += mn) 
-							*pdbl      = 0xFFFF;
-						*pdbl = 1; 
+
+						for (; j<num_chunks-1; j++, pdbl += mn)
+							*pdbl      = double(0xFFFF);
+						*pdbl = 1;
 #endif
-						
+
 					}
 			}
-		
-	}	
-	
+
+	}
+
 
 	template <class Domain, class IMatrix>
 	void create_MatrixRNS (const MultiModDouble    &F,
 			       const Domain            &D,
 			       const IMatrix           &M,
-			       double             *chunks) {
+			       double             *chunks)
+	{
 
 
 		size_t rns_size= F.size();
 		typename IMatrix::ConstRawIterator it = M.rawBegin();
-		size_t mn = M.rowdim()*M.coldim(); 
+		size_t mn = M.rowdim()*M.coldim();
 		integer tmp;
-		
+
 		for (size_t i=0; i< mn; ++i, ++it){
 			D.convert(tmp,*it);
 			for (size_t j=0;j< rns_size; ++j)
 				F.getBase(j).init(chunks[i+j*mn], tmp);
-		}		
+		}
 	}
 
 
@@ -1433,20 +1486,23 @@ namespace LinBox {
 	void create_VectorRNS (const MultiModDouble    &F,
 			       const Domain            &D,
 			       const IVector           &V,
-			       double             *chunks) {
+			       double             *chunks)
+	{
 
 		size_t rns_size= F.size();
 		typename IVector::const_iterator it= V.begin();
-		size_t mn = V.size(); 
+		size_t mn = V.size();
 		integer tmp;
-		
+
 		for (size_t i=0; i< mn; ++i, ++it){
-			D.convert(tmp, *it);	
-			for (size_t j=0;j< rns_size; ++j)				
+			D.convert(tmp, *it);
+			for (size_t j=0;j< rns_size; ++j)
 				F.getBase(j).init(chunks[i+j*mn], tmp);
-		}		
+		}
 	}
 
-		
-} // end of namespace LinBox		
-#endif
+
+} // end of namespace LinBox
+
+#endif // __LINBOX_apply_H
+
diff --git a/linbox/blackbox/archetype.h b/linbox/blackbox/archetype.h
index 5e05c1d..aee00bb 100644
--- a/linbox/blackbox/archetype.h
+++ b/linbox/blackbox/archetype.h
@@ -1,9 +1,5 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-// no file docs except where a main() is defined.
-// /** \file archetype.h linbox/blackbox/archetype.h
-// \brief apply, applytranspose, rowdim, coldim
-// */
-
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
 /* linbox/blackbox/archetype.h
  * Copyright (C) 1999-2005 William J Turner,
  *               2001 Bradford Hovinen
@@ -15,13 +11,19 @@
  * See COPYING for license information.
  */
 
-#ifndef __BLACKBOX_ARCHETYPE_H
-#define __BLACKBOX_ARCHETYPE_H
+/*!@file blackbox/archetype.h
+ * @ingroup blackbox
+ * @brief NO DOC
+ * @see \ref Archetypes
+ */
+
+#ifndef __LINBOX_blackbox_archetype_H
+#define __LINBOX_blackbox_archetype_H
 
 namespace LinBox
 {
 
-	/*-  Note the original archetype concept has been given 
+	/*-  Note the original archetype concept has been given
          * up in favor of supporting template members.
 
 
@@ -29,9 +31,9 @@ namespace LinBox
 	 * Base class from which derived concrete blackbox classes.
 	 * Unlike the LinBox field common object interface,
 	 * the common object interface for LinBox BlackBoxes does not require
-	 * the copy constructor.  All object management routines are given 
+	 * the copy constructor.  All object management routines are given
 	 * through virtual clone and killclone methods.  This allows the base
-	 * object to be the archetype, which is not possible for LinBox fields. 
+	 * object to be the archetype, which is not possible for LinBox fields.
 	 *
 	 * In general, there are three uses of archetypes:
 	 * \begin{enumerate}
@@ -43,52 +45,51 @@ namespace LinBox
 	 *       library components.
 	 * \item To control code bloat.
 	 * \end{enumerate}
-	 * Because of their use of virtual member funtions, these archetypes can be 
+	 * Because of their use of virtual member funtions, these archetypes can be
 	 * inefficient.
 	 *
-	 * @param Vector \ref{LinBox} dense or sparse vector of field elements
+	 * @param Vector \ref LinBox dense or sparse vector of field elements
 	 */
 
-	/*- 
-	@brief BlackBox base class and archetype 
+	/*-
+	@brief BlackBox base class and archetype
 
 	This archetype is an abstract base class for blackbox matrix classes.
-	The key member functions are {\tt apply, applyTranspose, rowdim, coldim}.
-	They are pure virtual, and hence are implemented in each child class.  
-	
+	The key member functions are \c apply, \c applyTranspose, \c rowdim, \c coldim}.
+	They are pure virtual, and hence are implemented in each child class.
+
 	Concrete classes inheriting from the archetype
-	use a variety of representation schemes for matrices internally. 
-	All provide the blackbox interface described here and can be used 
+	use a variety of representation schemes for matrices internally.
+	All provide the blackbox interface described here and can be used
 	interchangably in blackbox algorithms.
 	Some also implement a dense matrix or sparse matrix interface to support elimination
 	techniques.  Each has unique constructor(s) reflecting it's specific scheme for representing
 	a linear operator.
 
-	Algorithms written with a Blackbox template parameter 
+	Algorithms written with a Blackbox template parameter
 	may be compiled against any of these classes specifically or may be separately compiled
 	against the archetype.  Algorithms may also be written with a BlackboxArchetype parameter
-	and then called with an instance of a concrete blackbox class. 
-	In contrast with the situation for \ref{Field}s there is 
+	and then called with an instance of a concrete blackbox class.
+	In contrast with the situation for \ref Field s there is
 	negligible performance cost for separate compilation here.
-	
-	{\bf Template Parameter:} Vector - A type meeting the LinBox \ref{VectorArchetype} interface.
-	Vectors of this type are the normal arguments to {\tt apply} and {\tt applyTranspose}.
-	
-	@see \ref{../archetypes} for general discussion of LinBox archetypes.
+
+	{\bf Template Parameter:} Vector - A type meeting the LinBox \ref VectorArchetype  interface.
+	Vectors of this type are the normal arguments to \c apply and \c applyTranspose.
+
+	@see \ref ../archetypes  for general discussion of LinBox archetypes.
 	*/
 
 	/** \brief showing the member functions provided by all blackbox matrix classes.
 
-	This simple interface is all that is needed for the 
-blackbox algorithms.  Alternatively, the matrix archetype provides individual
-matrix entry access, as needed by some algorithms, such as elimination
-methods.
+	This simple interface is all that is needed for the blackbox
+	algorithms.  Alternatively, the matrix archetype provides individual
+	matrix entry access, as needed by some algorithms, such as elimination
+	methods.
 
-\ingroup blackbox
+	\ingroup blackbox
 	*/
 //	template <class Field>
-	class BlackboxArchetype //: public BlackboxInterface 
-	{
+	class BlackboxArchetype { //: public BlackboxInterface
 	public:
 
 		/*- Serves in place of copy constructor.
@@ -103,14 +104,14 @@ methods.
 
 	// apply variants //
 
-		/** \brief y := Ax, matrix-vector product. 
+		/** \brief y := Ax, matrix-vector product.
 
 		The vector x must be of size A.coldim(), where A is this blackbox.
 		On entry to apply, the vector y must be of size A.rowdim().
 		Neither vector has it's size or capacity modified by apply.  Apply is not
 		responsible for the validity of the sizes, which may or may not be checked.
 		The two vectors may not overlap in memory.
-		@param y it's entries are overwritten and a reference to it is also returned to allow for 
+		@param y it's entries are overwritten and a reference to it is also returned to allow for
 		use in nested expressions.
 		@param x it's entries are the input data.
 		*/
@@ -123,7 +124,7 @@ methods.
 		could allow the blackbox to operate more as a pure container, with the field
 		(or other functionality such as dot product) provided through the handle.
 
-		However, there are no known current uses (2003 june).  
+		However, there are no known current uses (2003 june).
 		*/
 	        template <class InVector, class OutVector>
 		OutVector &apply (OutVector &y, const InVector &x, void *handle) const;
@@ -140,10 +141,10 @@ matrix transpose times vector product. )
 		Neither vector has it's size or capacity modified by applyTranspose.  ApplyTranspose is not
 		responsible for the validity of the sizes, which may or may not be checked.
 		The two vectors may not overlap in memory.
-		@param y it's entries are overwritten and a reference to it is also returned to allow for 
+		@param y it's entries are overwritten and a reference to it is also returned to allow for
 		use in nested expressions.
 		@param x it's entries are the input data.
-		*/  
+		*/
 	        template <class InVector, class OutVector>
 		OutVector &applyTranspose (OutVector &y, const InVector &x) const;
 
@@ -153,7 +154,7 @@ matrix transpose times vector product. )
 		could allow the blackbox to operate more as a pure container, with the field
 		(or other functionality such as dot product) provided through the handle.
 
-		However, there are no known current uses (2003 june).  
+		However, there are no known current uses (2003 june).
 		*/
 	        template <class InVector, class OutVector>
 		OutVector &applyTranspose (OutVector &y, const InVector &x, void *handle) const;
@@ -172,7 +173,7 @@ matrix transpose times vector product. )
 
 #if 0
 		/** \brief default constructor.
-		 * Note: Most blacbbox classes will have a constructor that takes 
+		 * Note: Most blacbbox classes will have a constructor that takes
                  * the field and size as parameters.
 
 		 * Developer: It is expected that each blackbox class will
@@ -185,7 +186,7 @@ matrix transpose times vector product. )
 
 		Subsequent modification of either source or copy does not affect the other.
 		*/
-		BlackboxArchetype (const BlackboxArchetype& B); 
+		BlackboxArchetype (const BlackboxArchetype& B);
 
 		///\brief assignment
                 BlackboxArchetype& operator=(const BlackboxArchetype& B);
@@ -203,14 +204,5 @@ matrix transpose times vector product. )
 
 } // namespace LinBox
 
-#endif // __BLACKBOX_ARCHETYPE_H
-
-
-
-
-
-
-
-
-
+#endif // __LINBOX_blackbox_archetype_H
 
diff --git a/linbox/blackbox/blackbox-interface.h b/linbox/blackbox/blackbox-interface.h
index e8d3f86..750c3a9 100644
--- a/linbox/blackbox/blackbox-interface.h
+++ b/linbox/blackbox/blackbox-interface.h
@@ -1,37 +1,39 @@
 /* -*- 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
 /* linbox/blackbox/blackbox-interface.h
- * Copyright (C) 2002 David Saunders
+ * Copyright (C) 2002 LinBox
+ * Written by David Saunders
  *
  * For licensing information see COPYING
  */
 
-#ifndef __BLACKBOX_INTERFACE_H
-#define __BLACKBOX_INTERFACE_H
+#ifndef __LINBOX_blackbox_interface_H
+#define __LINBOX_blackbox_interface_H
+
 #include "linbox/element/archetype.h"
 
 namespace LinBox
 {
-// LinBox Blackbox Interface
-/*
- * The LinBox {@link BlackboxInterface} common object {@link Interfaces interface}.
- * The blackbox interface includes the public members defined in the archetype.
-*/
-/** 
- * \brief This blackbox base class exists solely to aid documentation organization.
+	// LinBox Blackbox Interface
+	/*
+	 * The LinBox @link BlackboxInterface at endlink common object @link Interfaces interface at endlink.
+	 * The blackbox interface includes the public members defined in the archetype.
+	 */
+	/**
+	 * \brief This blackbox base class exists solely to aid documentation organization.
 
- *  For the general blackbox member function documentation consult the {@link Blackbox Archetype}. For specific properties of individual representations consult the specific blackbox classes.
- */
-class BlackboxInterface 
-{
-/*
-    public:
-	// this just demo's that some declarations could be here.
-	typedef ElementArchetype Element; 
-	virtual Element& mul(Element& c, const Element& a, const Element& b) const = 0;
-*/
-};// empty class so doc++ makes a nice hierarchy.
+	 *  For the general blackbox member function documentation consult the @link blackbox Archetype at endlink. For specific properties of individual representations consult the specific blackbox classes.
+	 */
+	class BlackboxInterface {
+		/*
+		   public:
+		// this just demo's that some declarations could be here.
+		typedef ElementArchetype Element;
+		virtual Element& mul(Element& c, const Element& a, const Element& b) const = 0;
+		*/
+	};// empty class so doc++ makes a nice hierarchy.
 
 } // namespace LinBox
 
-#endif // __BLACKBOX_INTERFACE_H
+#endif //  __LINBOX_blackbox_interface_H
+
diff --git a/linbox/blackbox/blackbox.doxy b/linbox/blackbox/blackbox.doxy
index 8601690..2bec333 100644
--- a/linbox/blackbox/blackbox.doxy
+++ b/linbox/blackbox/blackbox.doxy
@@ -1,37 +1,40 @@
-/** \defgroup blackbox linbox/blackbox 
-\brief These matrix classes adhere to the simple blackbox interface.
-
-Blackbox matrix algorithms require of the matrix only it's 
-property of being a linear operator.  That is, such algorithms exploit only the 
-capacity to apply the matrix to a vector (column vector on right or row vector on left).
-The advantage is efficient generic methods particularly applicable to sparse and
-structured matrix classes in which matrix vector product is fast.  Importantly,
-these methods are also space efficient, typically, for an n by n matrix using only O(n) space 
-beyond the matrix representation itself.
-
-These classes all implement the very simple black box 
-interface as it is defined in the 
-LinBox::BlackboxArchetype  base class.  Thus blackbox matrix algorithms may be used on
-objects of any of these classes.  In contrast, classes representing matrices in such
-a way that elimination and other operations can be performed on them 
-adhere to more extensive interfaces defined in the \ref matrix directory.
-
-Some of the classes are intended for general use, some are designed to support specific 
-needs of algorithms, and some are primarily for testing purposes.  
-
-Users are most likely to be interested in the sparse matrix classes (SparseMatrix, TriplesBB), the class DenseMatrix,
-and structured matrix classes such as Toeplitz.  Consult the constructors and/or read() member
-function documentation to see how to create them.  To use a blackbox of class BB in a code:
-
-Classes designed to be used as preconditioners in algorithms or for testing typically also provide
-functionality to generate random instances of the class.  
-Examples are Diagonal and Butterfly for preconditioners, xxx for testing.
-
-Some of the classes provide a rudimentary basis of blackbox operators for a "blackbox calculus."  
-These include <tt>Compose, Sum, Dif, Submatrix, DirectSum, Inverse, MoorePenrose</tt>.
-
-Developers: All black box matrices should be derived from the 
-\link LinBox::BlackboxArchetype BlackboxArchetype \endlink, so that they may be used as parameters to 
+/** \ingroup linbox
+  \defgroup blackbox blackbox
+  \brief These matrix classes adhere to the simple blackbox interface.
+
+  Blackbox matrix algorithms require of the matrix only it's
+  property of being a linear operator.  That is, such algorithms exploit only the
+  capacity to apply the matrix to a vector (column vector on right or row vector on left).
+  The advantage is efficient generic methods particularly applicable to sparse and
+  structured matrix classes in which matrix vector product is fast.  Importantly,
+  these methods are also space efficient, typically, for an n by n matrix using only O(n) space
+  beyond the matrix representation itself.
+
+  These classes all implement the very simple black box
+  interface as it is defined in the
+  LinBox::BlackboxArchetype  base class.  Thus blackbox matrix algorithms may be used on
+  objects of any of these classes.  In contrast, classes representing matrices in such
+  a way that elimination and other operations can be performed on them
+  adhere to more extensive interfaces defined in the \ref matrix directory.
+
+  Some of the classes are intended for general use, some are designed to support specific
+  needs of algorithms, and some are primarily for testing purposes.
+
+  Users are most likely to be interested in the sparse matrix classes (SparseMatrix, TriplesBB), the class DenseMatrix,
+  and structured matrix classes such as Toeplitz.  Consult the constructors and/or read() member
+  function documentation to see how to create them.  To use a blackbox of class BB in a code:
+
+  Classes designed to be used as preconditioners in algorithms or for testing typically also provide
+  functionality to generate random instances of the class.
+  Examples are Diagonal and Butterfly for preconditioners, xxx for testing.
+
+  Some of the classes provide a rudimentary basis of blackbox operators for a "blackbox calculus."
+  These include <code>Compose, Sum, Dif, Submatrix, DirectSum, Inverse, MoorePenrose</code>.
+
+\note Developers: All black box matrices should be derived from the
+\link LinBox::BlackboxArchetype BlackboxArchetype \endlink, so that they may be used as parameters to
 functions compiled with the blackbox archetype.
 
-*/
+ */
+
+// vim:syn=doxygen
diff --git a/linbox/blackbox/blas-blackbox.h b/linbox/blackbox/blas-blackbox.h
index b0e5737..1c65520 100644
--- a/linbox/blackbox/blas-blackbox.h
+++ b/linbox/blackbox/blas-blackbox.h
@@ -1,10 +1,11 @@
 /* -*- 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
 /* linbox/blackbox/blas-blackbox.h
- * Copyright (C) 2004 Pascal Giorgi 
+ * Copyright (C) 2004 Pascal Giorgi
  *
  * Written by :
  *               Pascal Giorgi  pascal.giorgi at ens-lyon.fr
- *               
+ *
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -23,25 +24,26 @@
  */
 
 
-#ifndef __BLAS_BLACKBOX_H
-#define __BLAS_BLACKBOX_H
+#ifndef __LINBOX_blas_blackbox_H
+#define __LINBOX_blas_blackbox_H
 
 #include <linbox/matrix/blas-matrix.h>
-#include <linbox/fflas/fflas.h>
+#include <fflas-ffpack/fflas/fflas.h>
 #include <linbox/matrix/matrix-domain.h>
 #include <linbox/field/hom.h>
 #include <linbox/field/multimod-field.h>
 #include <linbox/util/matrix-stream.h>
 
-namespace LinBox {
-	
+namespace LinBox
+{
+
 	template <class Field>
 	bool checkBlasApply(const Field &F, size_t n) {
 
 		integer chara, card;
 		F.characteristic(chara);
 		F.cardinality(card);
-		
+
 		if ((chara != card) || chara == 0)
 			return false;
 		else
@@ -52,200 +54,211 @@ namespace LinBox {
 	}
 
 
-	/** \brief dense matrix representation for BLAS based elimination. \ingroup blackbox
+	/** Dense matrix representation for BLAS based elimination.
+	 * \ingroup blackbox
 	 *
 	 *  A BlasBlackbox can be constructed from any blackbox matrix. This costs n blackbox
-	 * matrix vector products in general, but is efficiently done from a DenseMatrix 
+	 * matrix vector products in general, but is efficiently done from a DenseMatrix
 	 * or SparseMatrix.
 	 */
 	template <class _Field>
-	class BlasBlackbox : public BlasMatrix<typename _Field::Element> 
-	{
+	class BlasBlackbox : public BlasMatrix<typename _Field::Element> {
 
 	public:
 
 		typedef _Field Field;
 		typedef typename Field::Element Element;
-                typedef BlasBlackbox<_Field> Self_t;
+		typedef BlasBlackbox<_Field> Self_t;
 
-		BlasBlackbox () {}
-
-		BlasBlackbox (const Field& F) :  _F(F), _MD(F), _VD(F) 
-		{ _F.init(_One,1UL), _F.init(_Zero,0UL);_use_fflas=false;}
+		BlasBlackbox (const Field& F) :
+		      	_F(F), _MD(F), _VD(F)
+		{
+		       	_F.init(_One,1UL) ;
+			_F.init(_Zero,0UL);
+			_use_fflas=false;
+		}
 
-		BlasBlackbox (const Field& F, const size_t m, const size_t n) 
-			: BlasMatrix<Element> (m,n),  _F(F), _MD(F), _VD(F), _row(m) , _col(n) 
-		{ 
-			_F.init(_One,1UL), _F.init(_Zero,0UL);
+		BlasBlackbox (const Field& F, const size_t m, const size_t n) :
+			BlasMatrix<Element> (m,n),  _F(F), _MD(F), _VD(F), _row(m) , _col(n)
+		{
+			_F.init(_One,1UL);
+		       	_F.init(_Zero,0UL);
 			typename BlasMatrix<Element>::RawIterator it = this->rawBegin();
 			for (; it != this->rawEnd(); ++it)
 				_F.init(*it, 0);
 			_use_fflas= checkBlasApply(_F, _col);
 		}
 
-		BlasBlackbox(MatrixStream<Field> &ms)
-			: BlasMatrix<Element> (ms), _F(ms.getField()), _MD(ms.getField()), _VD(ms.getField()) 
+		BlasBlackbox(MatrixStream<Field> &ms) :
+			BlasMatrix<Element> (ms), _F(ms.getField()), _MD(ms.getField()), _VD(ms.getField())
 		{
 			ms.getRows(_row);
 			ms.getColumns(_col);
 			_use_fflas= checkBlasApply(_F, _col);
 		}
-		
-
-
-		BlasBlackbox (const Field& F, BlasMatrix<Element>& M) 
-			: BlasMatrix<Element> (M),  _F(F), _MD(F) , _VD(F),  _row(M.rowdim()), _col(M.coldim()) 
-		{ _F.init(_One,1UL), _F.init(_Zero,0UL); _use_fflas= checkBlasApply(_F, _col); }
 
+		// copy
+		BlasBlackbox (const Field& F, BlasMatrix<Element>& M) :
+			BlasMatrix<Element> (M),  _F(F), _MD(F) , _VD(F),  _row(M.rowdim()), _col(M.coldim())
+		{
+			_F.init(_One,1UL),
+			_F.init(_Zero,0UL);
+			_use_fflas= checkBlasApply(_F, _col);
+	       	}
 
- 		template< class Blackbox >
- 		BlasBlackbox (const Blackbox& M)
- 			: BlasMatrix<Element> (M), _F(M.field()), _MD(M.field()), _VD(M.field()), _row(M.rowdim()), _col(M.coldim()) 
-		{_F.init( _One, 1UL ); _F.init( _Zero, 0UL ); _use_fflas= checkBlasApply(_F, _col);}
-		
+		template< class Blackbox >
+		BlasBlackbox (const Blackbox& M) :
+			BlasMatrix<Element> (M), _F(M.field()), _MD(M.field()), _VD(M.field()), _row(M.rowdim()), _col(M.coldim())
+		{
+			_F.init( _One, 1UL );
+		       	_F.init( _Zero, 0UL );
+		       	_use_fflas= checkBlasApply(_F, _col);
+		}
 
-		BlasBlackbox (const BlasBlackbox<Field>& M)
-			: BlasMatrix< Element> (M), _F(M._F), _MD(M._F), _VD(M._F), 
-			  _row(M._row), _col(M._col), _One(M._One), _Zero(M._Zero) {_use_fflas= checkBlasApply(_F, _col);}
+		BlasBlackbox (const BlasBlackbox<Field>& M) :
+			BlasMatrix< Element> (M), _F(M._F), _MD(M._F), _VD(M._F),
+			_row(M._row), _col(M._col), _One(M._One), _Zero(M._Zero)
+		{
+			_use_fflas= checkBlasApply(_F, _col);
+		}
 
-		BlasBlackbox (const BlasBlackbox<Field>& M, const size_t i0, const size_t j0, const size_t m, const size_t n)
-			: BlasMatrix< Element> (M,i0,j0,m,n), _F(M._F), _MD(M._F), _VD(M._F), 
-			  _row(m), _col(n), _One(M._One), _Zero(M._Zero) {_use_fflas= checkBlasApply(_F, _col);}
-		
+		BlasBlackbox (const BlasBlackbox<Field>& M, const size_t i0, const size_t j0, const size_t m, const size_t n) :
+			BlasMatrix< Element> (M,i0,j0,m,n), _F(M._F), _MD(M._F), _VD(M._F),
+			_row(m), _col(n), _One(M._One), _Zero(M._Zero)
+		{
+			_use_fflas= checkBlasApply(_F, _col);
+		}
 
-		BlasBlackbox (const Field &F, const BlasBlackbox<Field>& M)
-			: BlasMatrix< Element> (M), _F(M._F), _MD(M._F), _VD(F),
-			  _row(M._row), _col(M._col), _One(M._One), _Zero(M._Zero) {_use_fflas= checkBlasApply(_F, _col);}
+		BlasBlackbox (const Field &F, const BlasBlackbox<Field>& M) :
+			BlasMatrix< Element> (M), _F(M._F), _MD(M._F), _VD(F),
+			_row(M._row), _col(M._col), _One(M._One), _Zero(M._Zero)
+		{
+			_use_fflas= checkBlasApply(_F, _col);
+		}
 
-		template <class Vector1, class Vector2> 
-		Vector1&  apply (Vector1& y, const Vector2& x) const 
+		template <class Vector1, class Vector2>
+		Vector1&  apply (Vector1& y, const Vector2& x) const
 		{
-			
+
 			if (_use_fflas){
-       
-				FFLAS::fgemv( _F, FFLAS::FflasNoTrans, 
+
+				FFLAS::fgemv( _F, FFLAS::FflasNoTrans,
 					      this->_row, this->_col,
 					      this->_One,
 					      this->_ptr, this->_stride,
 					      &x[0],1,
 					      this->_Zero,
-					      &y[0],1);  
-			}			
+					      &y[0],1);
+			}
 			else {
 				_MD. vectorMul (y, *this, x);
+#if 0
+				typename BlasMatrix<Element>::ConstRowIterator i = this->rowBegin ();
+				typename Vector1::iterator j = y.begin ();
 
-				//typename BlasMatrix<Element>::ConstRowIterator i = this->rowBegin ();
-				//typename Vector1::iterator j = y.begin ();
-				
-				//for (; j != y.end (); ++j, ++i)
-				//	_VD.dot (*j, *i, x);
+				for (; j != y.end (); ++j, ++i)
+					_VD.dot (*j, *i, x);
+#endif
 			}
 			return y;
 		}
 
 		template <class Vector1, class Vector2>
-		Vector1&  applyTranspose (Vector1& y, const Vector2& x) const  
+		Vector1&  applyTranspose (Vector1& y, const Vector2& x) const
 		{
 
 			if (_use_fflas)
-				FFLAS::fgemv( this->_F, FFLAS::FflasTrans, 
+				FFLAS::fgemv( this->_F, FFLAS::FflasTrans,
 					      this->_row, this->_col,
 					      this->_One,
 					      this->_ptr, this->_stride,
 					      &x[0],1,
 					      this->_Zero,
-					      &y[0],1);  
-			
+					      &y[0],1);
+
 			else {
 				typename BlasMatrix<Element>::ConstColIterator i = this->colBegin ();
 				typename Vector1::iterator j = y.begin ();
-				
+
 				for (; j != y.end (); ++j, ++i)
 					_VD.dot (*j, x, *i);
 			}
-      
+
 			return y;
-		}  
+		}
 
-            
 		template<typename _Tp1>
-		struct rebind
+		struct rebind {
+			typedef BlasBlackbox<_Tp1> other;
+
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F)
+			{
+				typedef typename BlasMatrix<Element>::ConstRawIterator ConstRawIterator ;
+				ConstRawIterator A_p;
+				typename other::RawIterator Ap_p;
+				Hom<Field, _Tp1> hom(A. field(), F);
+				for (A_p = A. rawBegin(), Ap_p = Ap.rawBegin();
+				     A_p != A. rawEnd(); ++ A_p, ++ Ap_p)
+					hom.image (*Ap_p, *A_p);
+			}
+		};
+
+		template<typename _Tp1>
+		BlasBlackbox(const BlasBlackbox<_Tp1>& M, const Field& F) :
+			BlasMatrix<Element>(M.rowdim(),M.coldim()),
+			_F(F),_MD(F),_VD(F),
+			_row(M.rowdim()), _col(M.coldim()),
+			_One(F.one), _Zero(F.zero)
 		{
-                    typedef BlasBlackbox<_Tp1> other; 
-                    
-                    void operator() (other *& Ap, const Self_t& A, const _Tp1& F) {
-                        Ap = new other(F, A.rowdim(), A.coldim());
-                        typename Self_t::ConstRawIterator A_p;
-                        typename other::RawIterator Ap_p;
-                        Hom<Field, _Tp1> hom(A. field(), F);
-                        for (A_p = A. rawBegin(), Ap_p = Ap -> rawBegin();
-                             A_p != A. rawEnd(); ++ A_p, ++ Ap_p) 
-				hom.image (*Ap_p, *A_p);
-                    }
-                };
+			_use_fflas = checkBlasApply(F, M.coldim());
+			typename BlasBlackbox<_Tp1>::template rebind<Field>() (*this, M, F);
+		}
 
 		size_t rowdim() const {return _row;}
 
 		size_t coldim() const {return _col;}
 
-
 		const Field &field() const  {return _F;}
 		Field &field() {return const_cast<Field&>(_F);}
-		
-		/*
-		  std::vector<Element>& apply(std::vector<Element>& y, const std::vector<Element>& x) const {
-   
-		  FFLAS::fgemv( _F, FFLAS::FflasNoTrans, 
-		  this->_row, this->_col,
-		  this->_One,
-		  _ptr, _stride,
-		  &x[0],1,
-		  this->_Zero,
-		  &y[0],1);  
-		  return y;
-		  }
-		*/
-
 
 		/** Read the blackbox from an input stream
 		 * @param file Input stream from which to read
 		 */
-		std::istream &read (std::istream &file){
+		std::istream &read (std::istream &file)
+		{
 			return BlasMatrix<Element>::read(file, _F);
 
 		}
 
 		/** Write the blackbox to an output stream
-		 * @param os Output stream to which to write		 
+		 * @param os Output stream to which to write
 		 */
-		std::ostream &write (std::ostream &os) const {
+		std::ostream &write (std::ostream &os) const
+		{
 			return DenseSubmatrix<Element>::write(os, _F);
 		}
 
-		
 
 	protected:
-		
-		const Field                 & _F;  
-		MatrixDomain<Field>    _MD; 
-		VectorDomain<Field>    _VD;  
-		size_t                _row,_col;
-		Element              _One,_Zero;
+
+		const Field                 & _F;
+		MatrixDomain<Field>          _MD;
+		VectorDomain<Field>          _VD;
+		size_t                 _row,_col;
+		Element               _One,_Zero;
 		bool                  _use_fflas;
 
 
 	}; // end of class BlasBlackbox
 
 	template <class Field>
-	struct MatrixTraits< BlasBlackbox<Field> >
-	{
+	struct MatrixTraits< BlasBlackbox<Field> > {
 		typedef BlasBlackbox<Field> MatrixType;
 		typedef typename MatrixCategories::RowColMatrixTag MatrixCategory;
 	};
 
 	template <class Field>
-	struct MatrixTraits< const BlasBlackbox<Field> >
-	{
+	struct MatrixTraits< const BlasBlackbox<Field> > {
 		typedef const BlasBlackbox<Field> MatrixType;
 		typedef typename MatrixCategories::RowColMatrixTag MatrixCategory;
 	};
@@ -261,10 +274,6 @@ namespace LinBox {
 	public:
 		typedef MatrixContainerCategory::BlasContainer Type;
 	};
-	
-    
-
-
 
 	template<>
 	class BlasBlackbox<MultiModDouble> {
@@ -274,63 +283,67 @@ namespace LinBox {
 
 		typedef MultiModDouble         Field;
 		typedef std::vector<double>  Element;
-                typedef BlasBlackbox<MultiModDouble> Self_t;
+		typedef BlasBlackbox<MultiModDouble> Self_t;
 
 		//BlasBlackbox () {}
-		
-		BlasBlackbox (const MultiModDouble& F) :  _F(F) , _rep(F.size()), _entry(F.size())
+
+		BlasBlackbox (const MultiModDouble& F) :
+		       	_F(F) , _rep(F.size()), _entry(F.size())
 		{}
 
-		BlasBlackbox (const Field& F, size_t m, size_t n, bool alloc=true) 
-			:  _F(F), _row(m) , _col(n) , _rep(F.size()),  _entry(F.size())
-		{ 			
+		BlasBlackbox (const Field& F, size_t m, size_t n, bool alloc=true) :
+			_F(F), _row(m) , _col(n) , _rep(F.size()),  _entry(F.size())
+		{
 			for (size_t i=0;i<_rep.size();++i)
 				if (alloc)_rep[i]       =  new BlasBlackbox<Modular<double> > (F.getBase(i), m, n);
-			}
-		
-		BlasBlackbox (const BlasBlackbox<MultiModDouble> & A): _F(A._F),_row(A._row), _col(A._col), 
-								       _rep(A._rep.size()), _entry(A._entry) {
+		}
+
+		BlasBlackbox (const BlasBlackbox<MultiModDouble> & A):
+		       	_F(A._F),_row(A._row), _col(A._col),
+		_rep(A._rep.size()), _entry(A._entry)
+		{
 
 			for (size_t i=0;i<_rep.size();++i)
 				_rep[i]= new  BlasBlackbox<Modular<double> > (const_cast<BlasBlackbox<Modular<double> >& >( *A._rep[i]));
 		}
 
 
-		const BlasBlackbox<MultiModDouble>& operator=(const BlasBlackbox<MultiModDouble> & A){			
-			//_F   = A._F;		
+		const BlasBlackbox<MultiModDouble>& operator=(const BlasBlackbox<MultiModDouble> & A)
+		{
+			_F   = A._F;
 			_row = A._row;
 			_col = A._col;
-			_rep = std::vector<BlasBlackbox<Modular<double> >* >(A._rep.size());		
+			_rep = std::vector<BlasBlackbox<Modular<double> >* >(A._rep.size());
 			_entry = A._entry;
 			for (size_t i=0;i<_rep.size();++i)
 				_rep[i]= new  BlasBlackbox<Modular<double> > (const_cast<BlasBlackbox<Modular<double> >& >( *A._rep[i]));
 			return *this;
 		}
-  
+
 
 		~BlasBlackbox() {for (size_t i=0; i< _rep.size();++i) {delete _rep[i];} }
 
-		template <class Vector1, class Vector2> 
-		Vector1&  apply (Vector1& y, const Vector2& x) const 
-		{	
-			for (size_t i=0;i<_rep.size();++i) {				
+		template <class Vector1, class Vector2>
+		Vector1&  apply (Vector1& y, const Vector2& x) const
+		{
+			for (size_t i=0;i<_rep.size();++i) {
 				std::vector<double> x_tmp(x.size()), y_tmp(y.size());
 				for (size_t j=0;j<x.size();++j)
-					x_tmp[j]= x[j][i];		
-								
+					x_tmp[j]= x[j][i];
+
 				_rep[i]->apply(y_tmp, x_tmp);
-			
+
 				for (size_t j=0;j<y.size();++j){
-					y[j][i]=y_tmp[j];				
+					y[j][i]=y_tmp[j];
 
 				}
 			}
-			
+
 			return y;
 		}
 
 		template <class Vector1, class Vector2>
-		Vector1&  applyTranspose (Vector1& y, const Vector2& x) const  
+		Vector1&  applyTranspose (Vector1& y, const Vector2& x) const
 		{
 			for (size_t i=0;i<_rep.size();++i) {
 				std::vector<double> x_tmp(x.size()), y_tmp(y.size());
@@ -338,28 +351,28 @@ namespace LinBox {
 					x_tmp[i]= x[j][i];
 
 				_rep[i]->applyTranspose(y_tmp, x_tmp);
-				
+
 				for (size_t j=0;j<y.size();++j)
 					y[j][i]=y_tmp[i];
 			}
-			
+
 			return y;
-		}  
+		}
 
-            /*
+#if 0
 		template<typename _Tp1>
 		struct rebind
 		{
-                    typedef BlasBlackbox<_Tp1> other; 
-                    
-                    void operator() (other *& Ap, const Self_t& A, const _Tp1& F) {
-                        Ap = new other(F, A.rowdim(), A.coldim());
-			Hom<Field, _Tp1> hom(A. field(), F);
-			
-			hom.image (*Ap_p, *A_p);
-                    }
-                };
-	    */
+			typedef BlasBlackbox<_Tp1> other;
+
+			void operator() (other *& Ap, const Self_t& A, const _Tp1& F) {
+				Ap = new other(F, A.rowdim(), A.coldim());
+				Hom<Field, _Tp1> hom(A. field(), F);
+
+				hom.image (*Ap_p, *A_p);
+			}
+		};
+#endif
 
 		size_t rowdim() const {return _row;}
 
@@ -367,43 +380,42 @@ namespace LinBox {
 
 
 		const Field &field() const  {return _F;}
-		
-		
-		std::ostream& write(std::ostream& os) const {
+
+
+		std::ostream& write(std::ostream& os) const
+		{
 			for (size_t i=0;i<_rep.size();++i)
 				_rep[i]->write(os);
 			return os;
 		}
 
 
-		void setEntry (size_t i, size_t j, const Element &a_ij){
+		void setEntry (size_t , size_t j, const Element &a_ij)
+		{
 			for (size_t i=0; i< _rep.size();++i)
 				_rep[i]->setEntry(i,j,a_ij[i]);
 		}
-		
-		
-		const Element& getEntry (size_t i, size_t j){		
+
+
+		const Element& getEntry (size_t , size_t j)
+		{
 			for (size_t i=0; i< _rep.size();++i)
 				_entry[i]=_rep[i]->getEntry(i,j);
 			return _entry;
 		}
-	
+
 		BlasBlackbox<Modular<double> >*& getMatrix(size_t i) {return _rep[i];}
 
 	protected:
-		
-		const MultiModDouble                 &_F;  
-		const std::vector<MatrixDomain<Modular<double> > >   _MD; 
+
+		MultiModDouble                 _F;
+		const std::vector<MatrixDomain<Modular<double> > >   _MD;
 		size_t                  _row,_col;
-		Element                _One,_Zero;		
+		Element                _One,_Zero;
 		std::vector<BlasBlackbox<Modular<double> >* > _rep;
-		std::vector<double>       _entry;     
+		std::vector<double>       _entry;
 	};
 
-		
-		
-	
-
 	template <>
 	class MatrixContainerTrait<BlasBlackbox<MultiModDouble> > {
 	public:
@@ -414,4 +426,5 @@ namespace LinBox {
 
 } // end of namespace LinBox
 
-#endif
+#endif //__LINBOX_blas_blackbox_H
+
diff --git a/linbox/blackbox/block-hankel-inverse.h b/linbox/blackbox/block-hankel-inverse.h
index cec03a0..9742c19 100644
--- a/linbox/blackbox/block-hankel-inverse.h
+++ b/linbox/blackbox/block-hankel-inverse.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/blackbox/block-hankel-inverse.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -22,11 +22,11 @@
  */
 
 
-#ifndef __BLOCK_HANKEL_INVERSE_H
-#define __BLOCK_HANKEL_INVERSE_H
+#ifndef __LINBOX_block_hankel_inverse_H
+#define __LINBOX_block_hankel_inverse_H
 
 //#define  _BM_TIMING
- 
+
 //#define __CHECK_SIGMA_BASIS
 
 #include <linbox/algorithms/sigma-basis.h>
@@ -38,7 +38,8 @@
 //#define PADEMATRIX
 
 
-namespace LinBox {
+namespace LinBox
+{
 
 
 	template<class _Field>
@@ -53,21 +54,21 @@ namespace LinBox {
 		BlockHankel<Field>    *_H1;
 		BlockHankel<Field>    *_T1;
 		BlockHankel<Field>    *_H2;
-		BlockHankel<Field>    *_T2;	
+		BlockHankel<Field>    *_T2;
 		size_t _row, _col;
 		BlasMatrixDomain<Field> _BMD;
 		size_t   _numblock;
 		size_t      _block;
 	public:
 
-		// Constructor from a stl vector of BlasMatrix reprenting 
+		// Constructor from a stl vector of BlasMatrix reprenting
 		// all different elements in the Hankel representation
 		// vector is of odd size and represent the 1st column and last row append together
-		BlockHankelInverse(const Field &F, const std::vector<BlasMatrix<Element> > &P) 
-			: _F(F), _VD(F), _BMD(F)
+		BlockHankelInverse(const Field &F, const std::vector<BlasMatrix<Element> > &P) :
+			_F(F), _VD(F), _BMD(F)
 		{
 			//write_maple("UAV",P);
-			
+
 			size_t block    = P[0].rowdim();
 			size_t deg      = P.size();
 			size_t rowblock = (deg+1)>>1;
@@ -86,8 +87,8 @@ namespace LinBox {
 			// construct the matrix polynomial serie  [ P(x)^T  I ]^T and [ P^T(x) I ]
 			std::vector<Coefficient> RightPowerSerie(deg+2), LeftPowerSerie(deg+2), LPS(deg+2), RPS(deg+2);
 			for (size_t i=0;i< deg+2; ++i){
-				LeftPowerSerie[i]  = Coefficient(2*block, block); LPS[i]= Coefficient(2*block, block);	
-				RightPowerSerie[i] = Coefficient(block, 2*block); RPS[i]= Coefficient(block, 2*block);	
+				LeftPowerSerie[i]  = Coefficient(2*block, block); LPS[i]= Coefficient(2*block, block);
+				RightPowerSerie[i] = Coefficient(block, 2*block); RPS[i]= Coefficient(block, 2*block);
 				if (i <deg) {
 					for (size_t j=0;j<block;++j)
 						for (size_t k=0;k<block;++k){
@@ -100,24 +101,24 @@ namespace LinBox {
 				LeftPowerSerie[0].setEntry(block+j, j , one);	LPS[0].setEntry(block+j, j , one);
 				RightPowerSerie[0].setEntry(j, block+j, one);   RPS[0].setEntry(j, j+block , one);
 			}
-			
+
 			//write_maple("Sx",LeftPowerSerie);
 
 			SigmaBasis<Field> SBL(F, LeftPowerSerie);
 			SigmaBasis<Field> SBR(F, RightPowerSerie);
-			
+
 			std::vector<Coefficient > LP1, RP1, LP2, RP2;
 			size_t two_n= block<<1;
 			std::vector<size_t> dlp1(two_n,0), drp1(two_n,0), dlp2(two_n,0), drp2(two_n,0);
-			
+
 			for (size_t i=block;i<two_n;++i){
 				dlp1[i]=1;
 				drp1[i]=1;
 				dlp2[i]=1;
 				drp2[i]=1;
 			}
-			
-			
+
+
 			// Compute the sigma basis
 			//Timer chrono;
 			//chrono.start();
@@ -126,44 +127,44 @@ namespace LinBox {
 			//chrono.stop();
 			//std::cout<<"SigmaBasis Computation : "<<chrono<<"\n";
 			//SBL.printTimer();
-			
-		 	//SBL.left_basis  (LP1, deg-1, dlp1);		
+
+			//SBL.left_basis  (LP1, deg-1, dlp1);
 			//SBR.right_basis (RP1, deg-1, drp1);
 			//SBL.left_basis  (LP2, deg+1, dlp2);
 			//SBR.right_basis (RP2, deg+1, drp2);
 
 			std::vector<BlasMatrix<Element> > SLP1, SLP2, SRP1, SRP2;
-					
+
 			extractLeftSigma  (SLP1, LP1, dlp1, block);
 			extractLeftSigma  (SLP2, LP2, dlp2, block);
 
 			extractRightSigma (SRP1, RP1, drp1, block);
 			extractRightSigma (SRP2, RP2, drp2, block);
-			
+
 #else
 			size_t two_n= block<<1;
-			std::vector<size_t> dlp(two_n,0), drp(two_n,0);			
+			std::vector<size_t> dlp(two_n,0), drp(two_n,0);
 			for (size_t i=block;i<two_n;++i){
 				dlp[i]=1;
 				drp[i]=1;
 			}
-						
-			Coefficient ZeroSerie(block, block);	
+
+			Coefficient ZeroSerie(block, block);
 			std::vector<Coefficient> Serie(deg+2, ZeroSerie);
-			for (size_t i=0;i<deg;++i)				
+			for (size_t i=0;i<deg;++i)
 				for (size_t j=0;j<block;++j)
 					for (size_t k=0;k<block;++k)
 						Serie[i].setEntry(j,k, P[i].getEntry(j,k));
-						
+
 			SigmaBasis<Field> SBL(F, Serie);
 			SigmaBasis<Field> SBR(F, Serie);
 
 			std::vector<BlasMatrix<Element> > SLP1, SLP2, SRP1, SRP2;
-			SBL.multi_left_PadeMatrix  (SLP1, deg-1, SLP2, deg+1, dlp);		
+			SBL.multi_left_PadeMatrix  (SLP1, deg-1, SLP2, deg+1, dlp);
 			SBR.multi_right_PadeMatrix (SRP1, deg-1, SRP2, deg+1, drp);
 
 #endif
-			
+
 
 			BlasMatrix<Element> Res(block,block), Inv(block, block);
 
@@ -176,7 +177,7 @@ namespace LinBox {
 				Res = SLP2[i];
 				_BMD.mul(SLP2[i], Inv, Res);
 			}
-			
+
 			// Normalization of SRP2 (V)
 			_BMD.inv(Inv, SRP2[0],singular);
 			if (singular)
@@ -186,8 +187,8 @@ namespace LinBox {
 				_BMD.mul(SRP2[i], Res, Inv);
 			}
 
-			
-			// Normalization of SLP1 (Q*)			
+
+			// Normalization of SLP1 (Q*)
 			//_BMD.mul(Res, SLP1[0], LeftPowerSerie[deg-1]);
 			_BMD.mul(Res, SLP1[0], P[deg-1]);
 			for (size_t i=1;i<SLP1.size(); ++i)
@@ -202,14 +203,14 @@ namespace LinBox {
 				_BMD.mul(SLP1[i], Inv, Res);
 			}
 
-			
+
 			// Normalization of SRP1 (Q)
 			//_BMD.mul(Res, RightPowerSerie[deg-1], SRP1[0]);
-			_BMD.mul(Res, P[deg-1], SRP1[0]);			
+			_BMD.mul(Res, P[deg-1], SRP1[0]);
 			for (size_t i=1;i<SRP1.size(); ++i)
 				//_BMD.axpyin(Res, RightPowerSerie[deg-1-i], SRP1[i]);
 				_BMD.axpyin(Res, P[deg-1-i], SRP1[i]);
-			
+
 			_BMD.inv(Inv, Res, singular);
 			if (singular)
 				throw LinboxError("BLock Hankel Inversion failed\n;");
@@ -217,121 +218,124 @@ namespace LinBox {
 				Res=SRP1[i];
 				_BMD.mul(SRP1[i], Res, Inv);
 			}
-			
+
 
 
 			/*
-			write_maple("QStar",SLP1);
-			write_maple("Q",SRP1);
-			write_maple("VStar",SLP2);
-			write_maple("V",SRP2);
-			*/
+			   write_maple("QStar",SLP1);
+			   write_maple("Q",SRP1);
+			   write_maple("VStar",SLP2);
+			   write_maple("V",SRP2);
+			   */
 
 			std::vector<Coefficient> rev_poly(SRP2.size());
 			for (size_t i=0;i<SRP2.size();++i)
 				rev_poly[i]= SRP2[SRP2.size()-1-i];
-			
-			rev_poly.erase(rev_poly.begin());		
 
-			
+			rev_poly.erase(rev_poly.begin());
+
+
 			_H1 = new BlockHankel<Field>  (_F, rev_poly, BlockHankelTag::up); // V
-			
+
 			rev_poly.resize(SRP2.size());
 			const BlasMatrix<Element> Zero(block,block);
 			for (size_t i=0;i<SRP1.size();++i)
 				rev_poly[i]= SRP1[SRP1.size()-1-i];
 			rev_poly[SRP1.size()]= Zero;
-			rev_poly.erase(rev_poly.begin());		
-				
-			
-			
+			rev_poly.erase(rev_poly.begin());
+
+
+
 			_H2 = new BlockHankel<Field>  (_F, rev_poly, BlockHankelTag::up); // Q
-			
+
 			_T1 = new BlockHankel<Field>  (_F, SLP1, BlockHankelTag::up); // Qstar
 
 			SLP2.erase(SLP2.begin());
-			_T2 = new BlockHankel<Field>  (_F, SLP2, BlockHankelTag::up); // Vstar	
+			_T2 = new BlockHankel<Field>  (_F, SLP2, BlockHankelTag::up); // Vstar
 
 		}
-		
 
-		~BlockHankelInverse(){
+
+		~BlockHankelInverse()
+		{
 			delete _H1;
 			delete _T1;
 			delete _H2;
-			delete _T2;	
+			delete _T2;
 
 		}
 
-				
+
 		//template<class Vector1, class Vector2>
-		std::vector<Element>& apply (std::vector<Element> &x, const std::vector<Element> &y) const {
-			
+		std::vector<Element>& apply (std::vector<Element> &x, const std::vector<Element> &y) const
+		{
+
 			std::vector<Element> z1(_row), z2(_row);
 			std::vector<Element> rev_y(_row);
 			// reverse y according to block structure
 			for (size_t i=0; i< _numblock; ++i)
-				for (size_t j=0;j<_block;++j){ 
+				for (size_t j=0;j<_block;++j){
 					_F.assign(rev_y[(_numblock-i-1)*_block+j], y[i*_block+j]);
 				}
-			
-			_T1->apply(z1, rev_y);	
-			_H1->apply(z2, z1);									
+
+			_T1->apply(z1, rev_y);
+			_H1->apply(z2, z1);
 			_T2->apply(z1, rev_y);
 			_H2->apply(rev_y, z1) ;
 			_VD.sub(x, z2, rev_y);
-			
+
 			return x;
 		}
 
 		template<class Vector1, class Vector2>
-		Vector1& applyTranspose (Vector1 &x, const Vector2 &y) const {
+		Vector1& applyTranspose (Vector1 &x, const Vector2 &y) const
+		{
 			// not handled yet
 			return x;
-		}	
+		}
 
 		size_t rowdim() const { return _row;}
-			
+
 		size_t coldim() const { return _col;}
-		
+
 		const Field& field() const { return _F;}
 
 	protected:
 
-		void extractLeftSigma(std::vector<BlasMatrix<Element> >              &S, 
-				      std::vector<BlasMatrix<Element> >      &SigmaBase, 
-				      std::vector<size_t>                       &defect, 
-				      size_t                                      block) const 
-		{							
-			/*
+		void extractLeftSigma(std::vector<BlasMatrix<Element> >              &S,
+				      std::vector<BlasMatrix<Element> >      &SigmaBase,
+				      std::vector<size_t>                       &defect,
+				      size_t                                      block) const
+		{
+#if 0
 			std::cout<<"Pade Approximant:\n defect= ";
 			for (size_t i=0;i<defect.size();++i)
 				std::cout<<defect[i]<<",";
 			std::cout<<"\n";
 			for (size_t i=0;i<SigmaBase.size();++i)
 				SigmaBase[i].write(std::cout,_F);
-			*/
-			
+#endif
+
 			// take the block rows which have lowest defect
-			// compute permutation such that first block rows have lowest defect						
-			std::vector<size_t> Perm(2*block);			
+			// compute permutation such that first block rows have lowest defect
+			std::vector<size_t> Perm(2*block);
 			for (size_t i=0;i<2*block;++i)
-				Perm[i]=i;			
+				Perm[i]=i;
 			for (size_t i=0;i<2*block;++i) {
 				size_t idx_min=i;
 				for (size_t j=i+1;j<2*block;++j)
-					if (defect[j]< defect[idx_min]) 
-						idx_min=j;	
-				std::swap(defect[i],defect[idx_min]);				
+					if (defect[j]< defect[idx_min])
+						idx_min=j;
+				std::swap(defect[i],defect[idx_min]);
 				Perm[i]=idx_min;
-			}	
-			BlasPermutation BPerm(Perm);
-			
+			}
+			BlasPermutation<size_t>  BPerm(Perm);
+
 			// Apply BPerm to the Sigma Base
 			for (size_t i=0;i<SigmaBase.size();++i)
 				_BMD.mulin_right(BPerm,SigmaBase[i]);
-			
-			/*
+
+#if 0
 			// take the  row of SigmaBase s.t. SigmaBase[0] is invertible
 			std::vector<size_t> notnull(block);
 			size_t idx=0;
@@ -343,72 +347,72 @@ namespace LinBox {
 						break;
 					}
 			}
-			*/
+#endif
 			size_t max=defect[0];
 			for (size_t i=0;i<block;++i)
 				if (defect[i] > max)
 					//max=defect[notnull[i]];
 					max=defect[i];
-			
+
 			// prepare S to receive the sigma base
 			const BlasMatrix<Element> Zero(block,block);
 			S.resize(max+1, Zero);
 
-			// extract the sigma base 
+			// extract the sigma base
 			for (size_t k=0;k<S.size();++k){
 				for(size_t i=0;i<block;++i)
 					for (size_t j=0;j<block;++j)
 						//S[k].setEntry(i,j, SigmaBase[k].getEntry(notnull[i],j));
-						S[k].setEntry(i,j, SigmaBase[k].getEntry(i,j));		
+						S[k].setEntry(i,j, SigmaBase[k].getEntry(i,j));
 			}
 		}
 
 
-		void extractRightSigma(std::vector<BlasMatrix<Element> >            &S, 
-				       std::vector<BlasMatrix<Element> >    &SigmaBase, 
-				       std::vector<size_t>                     &defect, 
-				       size_t                                    block) const 
-		{	
-			/*
+		void extractRightSigma(std::vector<BlasMatrix<Element> >            &S,
+				       std::vector<BlasMatrix<Element> >    &SigmaBase,
+				       std::vector<size_t>                     &defect,
+				       size_t                                    block) const
+		{
+#if 0
 			std::cout<<"Pade Approximant:\n defect= ";
 			for (size_t i=0;i<defect.size();++i)
 				std::cout<<defect[i]<<",";
 			std::cout<<"\n";
-			
+
 			for (size_t i=0;i<SigmaBase.size();++i)
 				SigmaBase[i].write(std::cout,_F);
-			*/
-			
+#endif
+
 			// take the m rows which have lowest defect
-			// compute permutation such that first block rows have lowest defect						
-			std::vector<size_t> Perm(2*block);			
+			// compute permutation such that first block rows have lowest defect
+			std::vector<size_t> Perm(2*block);
 			for (size_t i=0;i<2*block;++i)
-				Perm[i]=i;			
+				Perm[i]=i;
 			for (size_t i=0;i<2*block;++i) {
 				size_t idx_min=i;
-				for (size_t j=i+1;j<2*block;++j) 
-					if (defect[j]< defect[idx_min]) 
-						idx_min=j;												
-				std::swap(defect[i],defect[idx_min]);				
+				for (size_t j=i+1;j<2*block;++j)
+					if (defect[j]< defect[idx_min])
+						idx_min=j;
+				std::swap(defect[i],defect[idx_min]);
 				Perm[i]=idx_min;
-			}	
-			BlasPermutation BPerm(Perm);
-			
+			}
+			BlasPermutation<size_t>  BPerm(Perm);
+
 			// Apply BPerm to the Sigma Base
 			for (size_t i=0;i<SigmaBase.size();++i)
 				_BMD.mulin_right(BPerm,SigmaBase[i]);
-			
+
 			/*
 			// take the  row of SigmaBase s.t. SigmaBase[0] is invertible
 			std::vector<size_t> notnull(block);
 			size_t idx=0;
 			for (size_t i=0; i<2*block;++i){
-				for (size_t j=0;j<2*block;++j)
-					if (!_F.isZero(SigmaBase[0].getEntry(i,j))){
-						notnull[idx]=i;
-						++idx;
-						break;
-					}
+			for (size_t j=0;j<2*block;++j)
+			if (!_F.isZero(SigmaBase[0].getEntry(i,j))){
+			notnull[idx]=i;
+			++idx;
+			break;
+			}
 			}
 			*/
 
@@ -421,26 +425,27 @@ namespace LinBox {
 			const BlasMatrix<Element> Zero(block,block);
 			S.resize(max+1, Zero);
 
-			// extract the sigma base 
+			// extract the sigma base
 			for (size_t k=0;k<S.size();++k){
 				for(size_t i=0;i<block;++i)
 					for (size_t j=0;j<block;++j)
 						//S[k].setEntry(i,j, SigmaBase[k].getEntry(notnull[i],j));
-						S[k].setEntry(i,j, SigmaBase[k].getEntry(i,j));	
+						S[k].setEntry(i,j, SigmaBase[k].getEntry(i,j));
 			}
-			
+
 			// transpose the sigma base since it comes from a left sigma basis
 			for (size_t k=0;k<S.size();++k){
 				for (size_t i=0;i<block;++i)
 					for (size_t j=i;j<block;++j)
-						std::swap(S[k].refEntry(i,j), S[k].refEntry(j,i));				
+						std::swap(S[k].refEntry(i,j), S[k].refEntry(j,i));
 			}
 		}
 
 
 	protected:
-		
-		void write_maple(const char* name, const std::vector<Coefficient> & P) {
+
+		void write_maple(const char* name, const std::vector<Coefficient> & P)
+		{
 			size_t m,n;
 			m = P[0].rowdim();
 			n = P[0].coldim();
@@ -455,10 +460,10 @@ namespace LinBox {
 				}
 				std::cout<<"[";
 				for (size_t j=0;j<n-1;++j)
-					_F.write(std::cout,P[k].getEntry(m-1,j))<<",";				
-				_F.write(std::cout, P[k].getEntry(m-1,n-1))<<"]]) , ";	
+					_F.write(std::cout,P[k].getEntry(m-1,j))<<",";
+				_F.write(std::cout, P[k].getEntry(m-1,n-1))<<"]]) , ";
 			}
-			
+
 			std::cout<<"Matrix([";
 			for (size_t i=0;i<m-1;++i){
 				std::cout<<"[";
@@ -468,8 +473,8 @@ namespace LinBox {
 			}
 			std::cout<<"[";
 			for (size_t j=0;j<n-1;++j)
-				_F.write(std::cout,P[P.size()-1].getEntry(m-1,j))<<",";				
-			_F.write(std::cout, P[P.size()-1].getEntry(m-1,n-1))<<"]])]; \n";	
+				_F.write(std::cout,P[P.size()-1].getEntry(m-1,j))<<",";
+			_F.write(std::cout, P[P.size()-1].getEntry(m-1,n-1))<<"]])]; \n";
 		}
 
 
@@ -479,4 +484,7 @@ namespace LinBox {
 
 }// end of namespace LinBox
 
-#endif
+#undef PADEMATRIX
+
+#endif //__LINBOX_block_hankel_inverse_H
+
diff --git a/linbox/blackbox/block-hankel.h b/linbox/blackbox/block-hankel.h
index fb76c01..b68c859 100644
--- a/linbox/blackbox/block-hankel.h
+++ b/linbox/blackbox/block-hankel.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* linbox/blackbox/block-hankel.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,10 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-
-
-#ifndef __BLOCK_HANKEL_H
-#define __BLOCK_HANKEL_H
+#ifndef __LINBOX_bb_block_hankel_H
+#define __LINBOX_bb_block_hankel_H
 
 #include <vector>
 #include <linbox/matrix/blas-matrix.h>
@@ -33,7 +32,8 @@
 
 //#define BHANKEL_TIMER
 
-namespace LinBox {
+namespace LinBox
+{
 
 	class BlockHankelTag {
 	public:
@@ -44,9 +44,9 @@ namespace LinBox {
 	// note that P is done as a mirror
 	// here we compute a^d.P(1/a^d) where d is the degree of P
 	template<class Field>
-	void MatPolyHornerEval (const Field                                               &F, 
-				BlasMatrix<typename Field::Element>                       &R, 
-				const std::vector<BlasMatrix<typename Field::Element> >   &P, 
+	void MatPolyHornerEval (const Field                                               &F,
+				BlasMatrix<typename Field::Element>                       &R,
+				const std::vector<BlasMatrix<typename Field::Element> >   &P,
 				const typename Field::Element                             &a)
 	{
 		R= P[0];
@@ -59,21 +59,21 @@ namespace LinBox {
 				F.mulin(*it_R, a);
 				F.addin(*it_R, *it_P);
 			}
-		}	
+		}
 	}
 
 
 	// P is done normally
 	template<class Field>
-	void VectHornelEval (const Field                                    &F, 
-			     std::vector<typename Field::Element>           &E, 
-			     const std::vector<typename Field::Element>     &P, 
+	void VectHornelEval (const Field                                    &F,
+			     std::vector<typename Field::Element>           &E,
+			     const std::vector<typename Field::Element>     &P,
 			     size_t                                      block,
 			     const typename Field::Element                  &a)
 	{
 		linbox_check((P.size()% block) == 0);
 		E.resize(block);
-		size_t numblock = P.size()/block;	
+		size_t numblock = P.size()/block;
 		size_t idx;
 		for (size_t i=0; i<block;++i)
 			F.assign(E[i], P[P.size()-block+i]);
@@ -83,18 +83,18 @@ namespace LinBox {
 				idx= j%block;
 				F.mulin(E[idx], a);
 				F.addin(E[idx], P[j]);
-			}				
+			}
 	}
 
 	template<class Field>
-	void BlockHankelEvaluation(const Field                                              &F, 
-				   std::vector<BlasMatrix<typename Field::Element> >        &E, 
+	void BlockHankelEvaluation(const Field                                              &F,
+				   std::vector<BlasMatrix<typename Field::Element> >        &E,
 				   const std::vector<BlasMatrix<typename Field::Element> >  &P,
 				   size_t                                                    k)
 	{
-		// do the evaluation of the Block Hankel Matrix using Horner Rules 
+		// do the evaluation of the Block Hankel Matrix using Horner Rules
 		// at k differents points (0,1,2,..,k-1)
-	
+
 		E.resize(k);
 		E[0]=P.back();
 		typename Field::Element a, one;
@@ -117,11 +117,11 @@ namespace LinBox {
 		typename Field::Element a, one;
 		F.init(one,1);
 		F.assign(a,one);
-		
+
 		for (size_t i=1;i<k;++i){
 			VectHornelEval (F, E[i], P, block, a);
 			F.addin(a, one);
-		}	
+		}
 	}
 
 
@@ -130,13 +130,13 @@ namespace LinBox {
 	void BHVectorLagrangeCoeff(const Field                            &F,
 				   std::vector<std::vector<typename Field::Element> >  &P,
 				   size_t                                  k)
-	{	
+	{
 		typename Field::Element one,zero, a;
 		F.init(one,1);F.init(zero,0);
 		F.init(a,0);
-	
+
 		// compute L:= (x)(x-1)(x-2)(x-3)...(x-k+1) = a1x+a2x^2+...+a(k-1)x^(k-1)
-		std::list<typename Field::Element> L(2);	
+		std::list<typename Field::Element> L(2);
 		F.assign(L.front(), zero);
 		F.assign(*(++L.begin()), one);
 		for (size_t i=1;i<k;++i){
@@ -159,9 +159,9 @@ namespace LinBox {
 			F.assign(P[i][deg-2],*rit);
 			++rit;
 			for (int j=deg-3; j>=0;--j, ++rit)
-				F.axpy(P[i][j], a, P[i][j+1], *rit);		
+				F.axpy(P[i][j], a, P[i][j+1], *rit);
 		}
-	
+
 		// compute P[i]= P[i] / Prod((i-j), j<>i)
 		typename Field::Element prod, ui, uj, tmp;
 		F.init(ui,-1);
@@ -179,7 +179,7 @@ namespace LinBox {
 			F.invin(prod);
 			//std::cout<<"coeff: ";F.write(std::cout, prod)<<"\n";
 			for (size_t l=0;l<P[i].size();++l)
-				F.mulin(P[i][l], prod);		
+				F.mulin(P[i][l], prod);
 		}
 	}
 
@@ -199,7 +199,7 @@ namespace LinBox {
 			VD.mul(acc, E[0], P[0][i]);//F.write(std::cout,P[0][i])<<"*",VD.write(std::cout, E[0]);
 			for (size_t j=1;j<E.size();++j){
 				//F.write(std::cout,P[j][i])<<"*",VD.write(std::cout, E[j]);
-				VD.axpyin(acc, P[j][i], E[j]); 
+				VD.axpyin(acc, P[j][i], E[j]);
 			}
 			//VD.write(std::cout,acc)<<"\n";;
 			for (size_t j=0;j<block;++j)
@@ -214,19 +214,19 @@ namespace LinBox {
 	public:
 		typedef _Field Field;
 		typedef typename Field::Element Element;
-	
+
 		BlockHankel() {}
 
-		// Constructor from a stl vector of BlasMatrix reprenting 
+		// Constructor from a stl vector of BlasMatrix reprenting
 		// all different elements in the Hankel representation
 		// order of element will depend on first column and/or  last row
-		// (plain->[column|row];  up -> [column]; low -> [row];) 
-		BlockHankel (Field &F, const std::vector<BlasMatrix<Element> > &H, BlockHankelTag::shape s= BlockHankelTag::plain)
-			: _field(F), _BMD(F)
+		// (plain->[column|row];  up -> [column]; low -> [row];)
+		BlockHankel (Field &F, const std::vector<BlasMatrix<Element> > &H, BlockHankelTag::shape s= BlockHankelTag::plain) :
+			_field(F), _BMD(F)
 		{
 			linbox_check( H.begin()->rowdim() != H.begin()->coldim());
-			
-					
+
+
 			switch (s) {
 			case BlockHankelTag::plain :
 				{
@@ -273,43 +273,43 @@ namespace LinBox {
 				std::cout<<"LinBox ERROR: prime ("<<prime<<") is too small for number of block ("<< _numpoints <<") in block Hankel blackbox\n";
 				throw LinboxError("LinBox ERROR: prime too small in block Hankel blackbox\n");
 			}
-			
+
 			_vecpoly.resize(_numpoints, std::vector<Element>(_block));
 			_veclagrange.resize(_numpoints);
 			BHVectorLagrangeCoeff(_field, _veclagrange, _numpoints);
 
-	
+
 			_vander     = BlasMatrix<Element> (_numpoints,_numpoints);
 			_inv_vander = BlasMatrix<Element> (_numpoints,_numpoints);
-			
+
 			std::vector<Element> points(_numpoints);
 			Element one;
 			F.init(one,1);
 			for (size_t i=0;i<_numpoints;++i){
 				F.init(points[i],i);
-				_vander.setEntry(i,0, one);			
+				_vander.setEntry(i,0, one);
 			}
-		
 
-			for (size_t j=1;j<_numpoints; ++j){				
+
+			for (size_t j=1;j<_numpoints; ++j){
 				for (size_t i=0;i<_numpoints;++i){
 					F.mul(_vander.refEntry(i,j), _vander.refEntry(i,j-1), points[i]);
 				}
 			}
-		
-			
+
+
 			_BMD.inv(_inv_vander, _vander);
-			
+
 			_partial_vander= BlasMatrix<Element> (_vander, 0, 0, _numpoints, _colblock);
 			size_t shift=_colblock-1;
 			if ( _shape == BlockHankelTag::up)
 				shift=0;
 
 			_partial_inv_vander= BlasMatrix<Element> (_inv_vander, shift, 0, _colblock, _numpoints);
-			
+
 			_x = BlasMatrix<Element> (_numpoints, _block);
 			_y = BlasMatrix<Element> (_colblock, _block);
-			
+
 
 			_Tapply.clear();
 			_Teval.clear();
@@ -317,8 +317,10 @@ namespace LinBox {
 		}
 
 		// Copy construtor
-		BlockHankel (const BlockHankel<Field> &H) : _field(H._field()), _matpoly (H._matpoly), _deg(H._deg),
-							    _row(H._row), _col(H._col), _rowblock(H._rowblock), _colblock(H._colblock), _block(H._block), _shape(H._shape) {}
+		BlockHankel (const BlockHankel<Field> &H) :
+			_field(H._field()), _matpoly (H._matpoly), _deg(H._deg),
+			_row(H._row), _col(H._col), _rowblock(H._rowblock), _colblock(H._colblock), _block(H._block), _shape(H._shape)
+		{}
 
 		// get the column dimension
 		size_t coldim() const {return _col;}
@@ -328,32 +330,33 @@ namespace LinBox {
 
 		// get the block dimension
 		size_t blockdim() const {return _block;}
-	
+
 
 		// apply the blackbox to a vector
 		template<class Vector1, class Vector2>
-		Vector1& apply(Vector1 &x, const Vector2 &y) const {
-			linbox_check(_coldim == y.size());
-			linbox_check(_rowdim == x.size());		
+		Vector1& apply(Vector1 &x, const Vector2 &y) const
+		{
+			linbox_check(this->_coldim == y.size());
+			linbox_check(this->_rowdim == x.size());
 			BlasMatrixDomain<Field> BMD(_field);
 #ifdef BHANKEL_TIMER
 			_chrono.clear();
 			_chrono.start();
 #endif
-			// evaluation of the vector seen as a vector polynomial in 
+			// evaluation of the vector seen as a vector polynomial in
 			//BHVectorEvaluation(_field, _vecpoly, y, _block);
-			
+
 			for (size_t i=0;i<_colblock;++i)
 				for (size_t j=0;j<_block;++j)
 					_y.setEntry(i,j, y[i*_block+j]);
-		
+
 			_BMD.mul(_x, _partial_vander, _y);
-			
+
 			for (size_t i=0;i<_numpoints;++i){
 				for (size_t j=0;j<_block; ++j)
 					_field.assign(_vecpoly[i][j], _x.getEntry(i,j));
 			}
-#ifdef BHANKEL_TIMER		
+#ifdef BHANKEL_TIMER
 			_chrono.stop();
 			_Teval+=_chrono;
 			_chrono.clear();
@@ -364,20 +367,21 @@ namespace LinBox {
 			for (size_t i=0;i<_vecpoly.size();++i)
 				BMD.mul(x_vecpoly[i], _matpoly[i], _vecpoly[i]);
 
-#ifdef BHANKEL_TIMER		
+#ifdef BHANKEL_TIMER
 			_chrono.stop();
 			_Tapply+=_chrono;
 			_chrono.clear();
 			_chrono.start();
 #endif
+#if 0
 			// get the result according to the right part of the polynomial
-			//size_t shift=_colblock-1;
-			//if ( _shape == BlockHankelTag::up)
-			//	shift=0;
-		
+			size_t shift=_colblock-1;
+			if ( _shape == BlockHankelTag::up)
+				shift=0;
+
 			// interpolation to get the result vector
-			//BHVectorInterpolation(_field, x, x_vecpoly, _veclagrange, shift);
-			
+			BHVectorInterpolation(_field, x, x_vecpoly, _veclagrange, shift);
+#endif
 			for (size_t i=0;i<_numpoints;++i)
 				for (size_t j=0;j<_block;++j)
 					_x.setEntry(i,j, x_vecpoly[i][j]);
@@ -387,7 +391,7 @@ namespace LinBox {
 			for (size_t i=0;i<_colblock;++i)
 				for (size_t j=0;j<_block;++j)
 					_field.assign( x[x.size() - (i+1)*_block +j], _y.getEntry(i,j));
-			
+
 #ifdef BHANKEL_TIMER
 			_chrono.stop();
 			_Tinterp +=_chrono;
@@ -401,7 +405,8 @@ namespace LinBox {
 
 		// apply the transposed of the blackbox to a vector
 		template<class Vector1, class Vector2>
-		Vector1& applyTranspose(Vector1 &x, const Vector2 &y) const {
+		Vector1& applyTranspose(Vector1 &x, const Vector2 &y) const
+		{
 			return apply(x,y);
 		}
 
@@ -430,4 +435,5 @@ namespace LinBox {
 
 } // end of namespace LinBox
 
-#endif
+#endif //__LINBOX_bb_block_hankel_H
+
diff --git a/linbox/blackbox/block-toeplitz.h b/linbox/blackbox/block-toeplitz.h
index 1e2d198..f13b663 100644
--- a/linbox/blackbox/block-toeplitz.h
+++ b/linbox/blackbox/block-toeplitz.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* linbox/blackbox/block-toeplitz.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -20,10 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-
-
-#ifndef __BLOCK_TOEPLITZ_H
-#define __BLOCK_TOEPLITZ_H
+#ifndef __LINBOX_block_toeplitz_H
+#define __LINBOX_block_toeplitz_H
 
 #include <vector>
 #include <linbox/matrix/blas-matrix.h>
@@ -32,23 +31,25 @@
 #include <linbox/util/debug.h>
 #include <linbox/blackbox/block-hankel.h>
 
-namespace LinBox {
-	
+namespace LinBox
+{
+
 	template<class _Field>
 	class BlockToeplitz : public BlockHankel<_Field> {
 	public:
 		typedef _Field Field;
 		typedef typename Field::Element Element;
-		
+
 		BlockToeplitz(){}
 
-		BlockToeplitz (const Field &F, const std::vector<BlasMatrix<Element> > &P, BlockHankelTag::shape s=BloackHankelTag::plain) 
-			: BlockHankel(F, P, s) {}
+		BlockToeplitz (const Field &F, const std::vector<BlasMatrix<Element> > &P, BlockHankelTag::shape s=BloackHankelTag::plain) :
+			BlockHankel(F, P, s) {}
+
 
 
-		
 	};
 
 } // end of namespace LinBox
 
 #endif
+
diff --git a/linbox/blackbox/butterfly.h b/linbox/blackbox/butterfly.h
index 359b1ef..dd6740c 100644
--- a/linbox/blackbox/butterfly.h
+++ b/linbox/blackbox/butterfly.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/blackbox/butterfly.h
  * Copyright (C) 1999-2001 William J Turner,
  *               2001 Bradford Hovinen
@@ -23,611 +23,673 @@
  * need only be responsible for a single 2x2 block.
  *
  * -----------------------------------------------------------
- * 
+ *
  * See COPYING for license information
  */
 
-#ifndef __BUTTERFLY_H
-#define __BUTTERFLY_H
+#ifndef __LINBOX_butterfly_H
+#define __LINBOX_butterfly_H
 
 #include <vector>
 #include <linbox/blackbox/blackbox-interface.h>
 
+/*! @file blackbox/butterfly.h
+*/
 
 // Namespace in which all LinBox library code resides
 namespace LinBox
 {
 
-/** @name Butterfly 
- * @brief Butterfly preconditioner and supporting function
- */
-//@{
-//
-/** \brief Switching Network based BlackBox Matrix.  A good preconditioner.
-
- * Implements butterfly switching network on a LinBox vector
- * as a black box matrix through the use of a switch object.
- *
- * This is a blackbox matrix object, and it implements all
- * purely virtual methods of the abstract base class.
- * See \ref{BlackboxArchetype} for the specification of these methods.
- *
- * This matrix requires a dense vector to be used.  Sparse vectors must
- * somehow be converted to dense vectors before this matrix may
- * be applied to them.
- *
- * @param Vector LinBox dense vector type
- * @param Switch switch object type
-\ingroup blackbox
- */
-template <class _Field, class Switch>
-class Butterfly : public BlackboxInterface
-{
-    public:
-	typedef _Field Field;
-
-	typedef typename Field::Element Element;
-
-	/** Constructor from an integer and a switch object.
-	 * The switch object is an object that is applied
-	 * to two references to elements to switch them.  It must have both
-	 * an apply and an applyTranspose method.
-	 * It must contain all information needed by the switch other 
-	 * than the elements themselves.  This includes any random
-	 * numbers or sequences of values.  It must also be able to 
-	 * be applied as many times as needed.  In particular, it must be able
-	 * to create new random elements or repeat a stored sequence
-	 * of values.
-	 * This is not required by the abstract base class.
-	 * @param n integer size of vectors to be applied to
-	 * @param S switch predicate object object
+	/** @name Butterfly
+	 * @brief Butterfly preconditioner and supporting function
 	 */
-	Butterfly (const Field &F, size_t n, typename Switch::Factory &factory);
-
-	/* Destructor. */
-	~Butterfly () {}
-
-
-	/*- Application of BlackBox matrix.
-	 * y = A*x.
-	 * Requires one vector conforming to the \ref{LinBox}
-	 * vector {@link Archetypes archetype}.
-	 * Required by abstract base class.
-	 * For this matrix, this involves applying each switch in order to the 
-	 * input vector.
-	 * @return reference to vector y containing output (after switching).
-	 * @param  x constant reference to vector to contain input 
-	 * 			(before switching)       
-	*/
-
-	template<class OutVector, class InVector>
-	OutVector& apply (OutVector& y, const InVector& x) const;
-
-	/*- Application of BlackBox matrix transpose.
-	 * y = transpose (A)*x.
-	 * Requires one vector conforming to the \ref{LinBox}
-	 * vector {@link Archetypes archetype}.
-	 * Required by abstract base class.
-	 * For this matrix, this involves applying the transpose of each switch 
-	 * to the input vector in the reverse order of the apply function.
-	 * @return reference to vector y containing output (after switching).
-	 * @param  x constant reference to vector to contain input 
-	 * 			(before switching)
+	//@{
+	//
+	/** \brief Switching Network based BlackBox Matrix.  A good preconditioner.
+
+	 * Implements butterfly switching network on a LinBox vector
+	 * as a black box matrix through the use of a switch object.
+	 *
+	 * This is a blackbox matrix object, and it implements all
+	 * purely virtual methods of the abstract base class.
+	 * See \ref BlackboxArchetype for the specification of these methods.
+	 *
+	 * This matrix requires a dense vector to be used.  Sparse vectors must
+	 * somehow be converted to dense vectors before this matrix may
+	 * be applied to them.
+	 *
+	 * @param Vector LinBox dense vector type
+	 * @param Switch switch object type
+	 \ingroup blackbox
 	 */
-	template<class OutVector, class InVector>
-	OutVector& applyTranspose (OutVector& y, const InVector& x) const;
+	template <class _Field, class Switch>
+	class Butterfly : public BlackboxInterface {
+	public:
+		typedef _Field Field;
+		typedef Butterfly<_Field, Switch> Self_t;
+		typedef typename Field::Element Element;
+
+		/** No-Op Constructor
+		*/
+		Butterfly (const Field &F, size_t n) :
+			_F (F), _VD (F), _n (n)
+		{}
+
+
+
+		/** Constructor from an integer and a switch object.
+		 * The switch object is an object that is applied
+		 * to two references to elements to switch them.  It must have both
+		 * an apply and an applyTranspose method.
+		 * It must contain all information needed by the switch other
+		 * than the elements themselves.  This includes any random
+		 * numbers or sequences of values.  It must also be able to
+		 * be applied as many times as needed.  In particular, it must be able
+		 * to create new random elements or repeat a stored sequence
+		 * of values.
+		 * This is not required by the abstract base class.
+		 * @param n integer size of vectors to be applied to
+		 * @param F
+		 * @param factory switch predicate object object
+		 */
+		Butterfly (const Field &F, size_t n, typename Switch::Factory &factory);
+
+		/* Destructor. */
+		~Butterfly () {}
+
+
+		/** Application of BlackBox matrix.
+		 * <code>y = A*x</code>.
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
+		 * Required by abstract base class.
+		 * For this matrix, this involves applying each switch in order to the
+		 * input vector.
+		 * @return reference to vector y containing output (after switching).
+		 * @param  x constant reference to vector to contain input
+		 * 			(before switching)
+		 * @param y
+		 */
+
+		template<class OutVector, class InVector>
+		OutVector& apply (OutVector& y, const InVector& x) const;
+
+		/** Application of BlackBox matrix transpose.
+		 * <code>y = transpose (A)*x</code>.
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
+		 * Required by abstract base class.
+		 * For this matrix, this involves applying the transpose of each switch
+		 * to the input vector in the reverse order of the apply function.
+		 * @return reference to vector y containing output (after switching).
+		 * @param  x constant reference to vector to contain input
+		 * 			(before switching)
+		 * @param y
+		 */
+		template<class OutVector, class InVector>
+		OutVector& applyTranspose (OutVector& y, const InVector& x) const;
+
+		template<typename _Tp1, typename _Sw1 = typename Switch::template rebind<_Tp1>::other>
+		struct rebind
+		{
+			typedef Butterfly<_Tp1, _Sw1> other;
+
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F) {
+				//             other LAp(F,A._n);
+				Ap.n_vec() = A.n_vec();
+				Ap.l_vec() = A.l_vec();
+				Ap.indices() = A.indices();
+
+				typename std::vector<Switch>::const_iterator sit = A.switchesBegin();
+
+				for( ; sit != A.switchesEnd(); ++sit) {
+					_Sw1 newsw;
+					typename Switch::template rebind<_Tp1>() (newsw, *sit, F, A._F);
+					Ap.switches().push_back( newsw );
+				}
+				//             Ap = new other(LAp);
+			}
+		};
 
-    template<typename _Tp1, typename _Sw1 = Switch>
-    struct rebind
-    { typedef Butterfly<_Tp1, _Sw1> other; };
+		template<typename _Tp1, typename _Sw1>
+		Butterfly (const Butterfly<_Tp1,_Sw1>& B, const Field &F) :
+			_F (F), _VD (F), _n (B.rowdim())
+		{
+			typename Butterfly<_Tp1,_Sw1>::template rebind<Field>() (*this, B, F);
+		}
 
 
-    
 
-	/*- Retreive row dimensions of BlackBox matrix.
-	 * This may be needed for applying preconditioners.
-	 * Required by abstract base class.
-	 * @return integer number of rows of black box matrix.
-	 */
-	size_t rowdim () const
+		/*- Retreive row dimensions of BlackBox matrix.
+		 * This may be needed for applying preconditioners.
+		 * Required by abstract base class.
+		 * @return integer number of rows of black box matrix.
+		 */
+		size_t rowdim () const
 		{ return _n; }
-    
-	/*- Retreive column dimensions of BlackBox matrix.
-	 * Required by abstract base class.
-	 * @return integer number of columns of black box matrix.
-	 */
-	size_t coldim () const
+
+		/*- Retreive column dimensions of BlackBox matrix.
+		 * Required by abstract base class.
+		 * @return integer number of columns of black box matrix.
+		 */
+		size_t coldim () const
 		{ return _n; }
 
-	const Field& field() const {return _F;}
+		const Field& field() const
+		{return _F;}
 
-    private:
 
-	// Field over which we are working
-	const Field _F;
-	VectorDomain<Field> _VD;
+		// Required for rebind
+		// Don't know how to tell that rebind should be friend ...
+		std::vector<size_t> n_vec() const
+		{ return this->_n_vec; }
+		std::vector<size_t> l_vec() const
+		{ return this->_l_vec; }
+		std::vector< std::pair< size_t, size_t > > indices() const
+		{ return this->_indices; }
+		std::vector<size_t>& n_vec() { return this->_n_vec; }
+		std::vector<size_t>& l_vec() { return this->_l_vec; }
+		std::vector< std::pair< size_t, size_t > >& indices() { return this->_indices; }
+		typename std::vector<Switch>::const_iterator switchesBegin() const
+		{ return this->_switches.begin();}
+		typename std::vector<Switch>::const_iterator switchesEnd() const
+		{ return this->_switches.end(); }
+		std::vector<Switch>& switches() { return _switches; }
 
-	// Number of rows and columns of square matrix.
-	size_t _n;
 
-	// Vectors of sizes of sub-groups and number of levels in each
-	// These may not need to be stored in general.
-	// They may only be used in the constructor
-	std::vector<size_t> _n_vec, _l_vec;
-   
-	// Vector of index pairs.  These are the indices to be switched with
-	// a given switch.
-	std::vector< std::pair< size_t, size_t > > _indices;
+	private:
 
-	// Vector of switches
-	std::vector<Switch> _switches;
 
-	// Build the vector of indices
-	void buildIndices ();
-    
-}; // template <class Field, class Vector> class Butterfly
+		// Field over which we are working
+		const Field _F;
+		VectorDomain<Field> _VD;
 
-// Implementation of methods
+		// Number of rows and columns of square matrix.
+		size_t _n;
 
-template <class Field, class Switch>
-inline Butterfly<Field, Switch>::Butterfly (const Field &F, size_t n, typename Switch::Factory &factory)
-	: _F (F), _VD (F), _n (n)
-{
-	buildIndices ();
-
-	for (unsigned int i = 0; i < _indices.size (); ++i)
-		_switches.push_back (factory.makeSwitch ());
-}
-  
-template <class Field, class Switch>
-template<class OutVector, class InVector>
-inline OutVector& Butterfly<Field, Switch>::apply (OutVector& y, const InVector& x) const
-{
-	std::vector< std::pair<size_t, size_t> >::const_iterator idx_iter = _indices.begin ();
-	typename std::vector<Switch>::const_iterator switch_iter = _switches.begin ();
+		// Vectors of sizes of sub-groups and number of levels in each
+		// These may not need to be stored in general.
+		// They may only be used in the constructor
+		std::vector<size_t> _n_vec, _l_vec;
 
-	_VD.copy (y, x);
+		// Vector of index pairs.  These are the indices to be switched with
+		// a given switch.
+		std::vector< std::pair< size_t, size_t > > _indices;
 
-	for (; idx_iter != _indices.end (); ++idx_iter, ++switch_iter)
-		switch_iter->apply (_F, y[idx_iter->first], y[idx_iter->second]);
+		// Vector of switches
+		std::vector<Switch> _switches;
 
-	return y;
-}
+		// Build the vector of indices
+		void buildIndices ();
 
-template <class Field, class Switch>
-template <class OutVector, class InVector>
-inline OutVector& Butterfly<Field, Switch>::applyTranspose (OutVector& y, const InVector& x) const
-{
-	std::vector< std::pair<size_t, size_t> >::const_reverse_iterator idx_iter = _indices.rbegin ();
-	typename std::vector<Switch>::const_reverse_iterator switch_iter = _switches.rbegin ();
+	}; // template <class Field, class Vector> class Butterfly
 
-	_VD.copy (y, x);
+	// Implementation of methods
 
-	for (; idx_iter != _indices.rend (); ++idx_iter, ++switch_iter)
-		switch_iter->applyTranspose (_F, y[idx_iter->first], y[idx_iter->second]);
+	template <class Field, class Switch>
+	inline Butterfly<Field, Switch>::Butterfly (const Field &F, size_t n, typename Switch::Factory &factory) :
+		_F (F), _VD (F), _n (n)
+	{
+		buildIndices ();
 
-	return y;
-}
+		for (unsigned int i = 0; i < _indices.size (); ++i)
+			_switches.push_back (factory.makeSwitch ());
+	}
 
-template <class Field, class Switch>
-void Butterfly<Field, Switch>::buildIndices () 
-{
-	for (size_t value (_n), l_p (0), n_p (1); 
-	     n_p != 0; 
-	     value >>= 1, l_p++, n_p <<= 1)
+	template <class Field, class Switch>
+	template<class OutVector, class InVector>
+	inline OutVector& Butterfly<Field, Switch>::apply (OutVector& y, const InVector& x) const
 	{
-		if (value & 1) {
-			_l_vec.push_back (l_p);
-			_n_vec.push_back (n_p);      
-		}
+		std::vector< std::pair<size_t, size_t> >::const_iterator idx_iter = _indices.begin ();
+		typename std::vector<Switch>::const_iterator switch_iter = _switches.begin ();
+
+		_VD.copy (y, x);
+
+		for (; idx_iter != _indices.end (); ++idx_iter, ++switch_iter)
+			switch_iter->apply (_F, y[idx_iter->first], y[idx_iter->second]);
+
+		return y;
 	}
 
-	// Create vector of indices to switch
-	size_t n_p, l_p;   	// size of group and number of levels in group
-	size_t level (0), difference (1);	// track levels done for powers of 2
+	template <class Field, class Switch>
+	template <class OutVector, class InVector>
+	inline OutVector& Butterfly<Field, Switch>::applyTranspose (OutVector& y, const InVector& x) const
+	{
+		std::vector< std::pair<size_t, size_t> >::const_reverse_iterator idx_iter = _indices.rbegin ();
+		typename std::vector<Switch>::const_reverse_iterator switch_iter = _switches.rbegin ();
 
-	// Vector containing indices for last level of last power of 2.
-	std::vector< std::pair< size_t, size_t > > p_ind;
+		_VD.copy (y, x);
 
-	// Vector and iterator used for computing p_ind.
-	std::vector< std::pair< size_t, size_t > > temp_ind;
-	std::vector< std::pair< size_t, size_t > >::iterator iter;
+		for (; idx_iter != _indices.rend (); ++idx_iter, ++switch_iter)
+			switch_iter->applyTranspose (_F, y[idx_iter->first], y[idx_iter->second]);
 
-	// Loop over sub-groups of powers of two
-	for (size_t p (0), start_index (0); 
-	     p < _n_vec.size (); 
-	     p++, start_index += n_p)
+		return y;
+	}
+
+	template <class Field, class Switch>
+	void Butterfly<Field, Switch>::buildIndices ()
 	{
-		// update size
-		n_p = _n_vec[p];
-		l_p = _l_vec[p];
+		for (size_t value (_n), l_p (0), n_p (1);
+		     n_p != 0;
+		     value >>= 1, l_p++, n_p <<= 1)
+		{
+			if (value & 1) {
+				_l_vec.push_back (l_p);
+				_n_vec.push_back (n_p);
+			}
+		}
+
+		// Create vector of indices to switch
+		size_t n_p, l_p;   	// size of group and number of levels in group
+		size_t level (0), difference (1);	// track levels done for powers of 2
+
+		// Vector containing indices for last level of last power of 2.
+		std::vector< std::pair< size_t, size_t > > p_ind;
+
+		// Vector and iterator used for computing p_ind.
+		std::vector< std::pair< size_t, size_t > > temp_ind;
+		std::vector< std::pair< size_t, size_t > >::iterator iter;
+
+		// Loop over sub-groups of powers of two
+		for (size_t p (0), start_index (0);
+		     p < _n_vec.size ();
+		     p++, start_index += n_p)
+		{
+			// update size
+			n_p = _n_vec[p];
+			l_p = _l_vec[p];
+
+			// loop over levels of sub-group network
+			for ( ; level < l_p; level++, difference <<= 1) {
+				// Create
+				temp_ind = p_ind;
+
+				// the second sub group is a shift of the first
+				for (iter = temp_ind.begin (); iter != temp_ind.end (); iter++) {
+					iter->first += difference;
+					iter->second += difference;
+				}
+
+				// add the second group to the first
+				p_ind.insert (p_ind.end (), temp_ind.begin (), temp_ind.end ());
+
+				// add switches to mix the two sub groups
+				temp_ind = std::vector< std::pair<size_t, size_t> >
+				(difference, std::pair<size_t, size_t> (0, 0));
+
+				size_t i = 0;
+				for (iter = temp_ind.begin (); iter != temp_ind.end (); i++, iter++) {
+					iter->first += i;
+					iter->second += i + difference;
+				}
 
-		// loop over levels of sub-group network
-		for ( ; level < l_p; level++, difference <<= 1) {
-			// Create 
+				// add the combining group to the first and second
+				p_ind.insert (p_ind.end (), temp_ind.begin (), temp_ind.end ());
+			}
+
+			// Add this level to total list of indices and correct starting point
 			temp_ind = p_ind;
 
-			// the second sub group is a shift of the first
 			for (iter = temp_ind.begin (); iter != temp_ind.end (); iter++) {
-				iter->first += difference;
-				iter->second += difference;
+				iter->first += start_index;
+				iter->second += start_index;
 			}
 
-			// add the second group to the first
-			p_ind.insert (p_ind.end (), temp_ind.begin (), temp_ind.end ());
+			_indices.insert (_indices.end (), temp_ind.begin (), temp_ind.end ());
 
-			// add switches to mix the two sub groups
-			temp_ind = std::vector< std::pair<size_t, size_t> >
-				(difference, std::pair<size_t, size_t> (0, 0));
+			// Combine everything so far
+			temp_ind = std::vector< std::pair<size_t, size_t> > (start_index, std::pair<size_t, size_t> (0, 0));
 
-			size_t i = 0;
-			for (iter = temp_ind.begin (); iter != temp_ind.end (); i++, iter++) {
-				iter->first += i;
-				iter->second += i + difference;
+			iter = temp_ind.begin ();
+			for (size_t index = 0; index < start_index; index++, iter++) {
+				iter->first = index;
+				iter->second += index + n_p;
 			}
 
-			// add the combining group to the first and second
-			p_ind.insert (p_ind.end (), temp_ind.begin (), temp_ind.end ());
+			_indices.insert (_indices.end (), temp_ind.begin (), temp_ind.end ());
 		}
+	}
+
+	/** A function used with Butterfly Blackbox Matrices.
+	 * This function takes an STL vector x of booleans, and returns
+	 * a vector y of booleans such that setting the switches marked
+	 * by true flags in y to be on (or to swap elements) the true
+	 * elements x will be switched to a given contiguous block
+	 * through the use of a Butterfly switching network.
+	 * The integer parameter j marks where this block is to begin.
+	 * If x has r true elements, the Butterfly switching network will place
+	 * these elements in a contiguous block starting at j and ending at
+	 * j + r - 1.
+	 * Wrap around shall be considered to preserve contiguity.
+	 * The value of j is defaulted to be zero, and it is only allowed to
+	 * be non-zero is the size of x is a power of 2.
+	 * @return vector of booleans for setting switches
+	 * @param x vector of booleans marking elements to switch into
+	 *	      contiguous block
+	 * @param j offset of contiguous block
+	 */
+	inline std::vector<bool> setButterfly (const std::vector<bool>& x,
+					       size_t j = 0)
+	{
+		size_t n = x.size ();
 
-		// Add this level to total list of indices and correct starting point
-		temp_ind = p_ind;
+		commentator.start ("Setting butterfly switches", "setButterfly");
 
-		for (iter = temp_ind.begin (); iter != temp_ind.end (); iter++) {
-			iter->first += start_index;
-			iter->second += start_index;
+		std::ostream &report = commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION);
+
+		report << "Called set switches with vector of size " << n
+		<< " and offset " << j << std::endl;
+
+		// return empty vector if zero or one elements in x because
+		// no switching will be done.
+		if (x.size () <= 1) {
+			commentator.indent (report);
+			report << "No switches needed. Returning with empty vector." << std::endl;
+
+			commentator.stop ("done");
+			return std::vector<bool> ();
 		}
 
-		_indices.insert (_indices.end (), temp_ind.begin (), temp_ind.end ());
+		commentator.indent (report);
+		report << "Counting the number of switches that exist." << std::endl;
 
-		// Combine everything so far
-		temp_ind = std::vector< std::pair<size_t, size_t> > (start_index, std::pair<size_t, size_t> (0, 0));
+		// break inputs into groups of size powers of 2.
+		// calculate size of groups, and powers of 2 that give sizes
+		// store these values in vectors n and l, respectively
+		std::vector<size_t> l_vec, n_vec;
 
-		iter = temp_ind.begin ();
-		for (size_t index = 0; index < start_index; index++, iter++) {
-			iter->first = index;
-			iter->second += index + n_p;
+		for (size_t value (n), l_p (0), n_p (1);
+		     n_p != 0;
+		     value >>= 1, l_p++, n_p <<= 1)
+		{
+			commentator.indent (report);
+			report << "  looping at value = " << value
+			<< ", l_p = " << l_p
+			<< ", n_p = " << n_p << std::endl;
+
+			if (value & 1) {
+				l_vec.push_back (l_p);
+				n_vec.push_back (n_p);
+
+				commentator.indent (report);
+				report << "    inserted value = " << value
+				<< ", l_p = " << l_p
+				<< ", n_p = " << n_p << std::endl;
+			}
 		}
 
-		_indices.insert (_indices.end (), temp_ind.begin (), temp_ind.end ());
-	}
-}
-
-/** A function used with Butterfly Blackbox Matrices.
- * This function takes an STL vector x of booleans, and returns
- * a vector y of booleans such that setting the switches marked
- * by true flags in y to be on (or to swap elements) the true
- * elements x will be switched to a given contiguous block
- * through the use of a Butterfly switching network.
- * The integer parameter j marks where this block is to begin.
- * If x has r true elements, the Butterfly switching network will place
- * these elements in a contiguous block starting at j and ending at
- * j + r - 1.
- * Wrap around shall be considered to preserve contiguity.
- * The value of j is defaulted to be zero, and it is only allowed to
- * be non-zero is the size of x is a power of 2.
- * @return vector of booleans for setting switches
- * @param x vector of booleans marking elements to switch into
- *	      contiguous block
- * @param j offset of contiguous block
- * @param log reference to ostream for logging
- */
-std::vector<bool> setButterfly (const std::vector<bool>& x, 
-				size_t j = 0)
-{
-	size_t n = x.size ();
- 
-	commentator.start ("Setting butterfly switches", "setButterfly");
+		// Calculate total number of switches required
+		size_t s (0);
 
-	std::ostream &report = commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION);
+		for (size_t ii = 0; ii < n_vec.size (); ii++)
+			s += n_vec[ii] * l_vec[ii] / 2;
 
-	report << "Called set switches with vector of size " << n
-	       << " and offset " << j << std::endl;
+		for (size_t ii = 0; ii < n_vec.size () - 1; ii++)
+			for (size_t jj = 0; jj <= ii; jj++)
+				s += n_vec[jj];
 
-	// return empty vector if zero or one elements in x because
-	// no switching will be done.
-	if (x.size () <= 1) {
 		commentator.indent (report);
-		report << "No switches needed. Returning with empty vector." << std::endl;
+		report << "There are a total of " << s << " switches" << std::endl;
 
-		commentator.stop ("done");
-		return std::vector<bool> ();
-	}
+		// Set largest power of 2 in decomposition of n = x.size ()
+		size_t n_p (*n_vec.rbegin ());
 
-	commentator.indent (report);
-	report << "Counting the number of switches that exist." << std::endl;
- 
-	// break inputs into groups of size powers of 2.
-	// calculate size of groups, and powers of 2 that give sizes
-	// store these values in vectors n and l, respectively
-	std::vector<size_t> l_vec, n_vec;
-
-	for (size_t value (n), l_p (0), n_p (1);
-	     n_p != 0;
-	     value >>= 1, l_p++, n_p <<= 1)
-	{
 		commentator.indent (report);
-		report << "  looping at value = " << value
-		       << ", l_p = " << l_p
-		       << ", n_p = " << n_p << std::endl;
- 
-		if (value & 1) {
-			l_vec.push_back (l_p);
-			n_vec.push_back (n_p);
+		report << "Found largest power of 2 in decomposition of " << n
+		<< " as n_p = " << n_p << std::endl;
 
+		if ( (n != n_p) && (j != 0) ) {
 			commentator.indent (report);
-			report << "    inserted value = " << value
-			       << ", l_p = " << l_p
-			       << ", n_p = " << n_p << std::endl;
+			report << "Non-zero offset " << j
+			<< " used with non-power size."
+			<< "Offset reset to zero." << std::endl;
+
+			j = 0;
 		}
-	}
- 
-	// Calculate total number of switches required
-	size_t s (0);
- 
-	for (size_t ii = 0; ii < n_vec.size (); ii++)
-		s += n_vec[ii] * l_vec[ii] / 2;
-
-	for (size_t ii = 0; ii < n_vec.size () - 1; ii++)
-		for (size_t jj = 0; jj <= ii; jj++)
-			s += n_vec[jj];
- 
-	commentator.indent (report);
-	report << "There are a total of " << s << " switches" << std::endl;
- 
-	// Set largest power of 2 in decomposition of n = x.size ()
-	size_t n_p (*n_vec.rbegin ());
-
-	commentator.indent (report);
-	report << "Found largest power of 2 in decomposition of " << n
-	       << " as n_p = " << n_p << std::endl;
-
-	if ( (n != n_p) && (j != 0) ) {
-		commentator.indent (report);
-		report << "Non-zero offset " << j
-		       << " used with non-power size."
-		       << "Offset reset to zero." << std::endl;
+		else
+			j %= n;
 
-		j = 0;
-	} else
-		j %= n;
+		if (n == n_p) {
+			n_p /= 2;	  // >> is not portable!
 
-	if (n == n_p) {
-		n_p /= 2;	  // >> is not portable!
+			commentator.indent (report);
+			report << "n = " << n << " is a power of two.  "
+			<< "Resetting n_p to be half of n: n_p = " << n_p << std::endl;
+		}
 
-		commentator.indent (report);
-		report << "n = " << n << " is a power of two.  "
-		       << "Resetting n_p to be half of n: n_p = " << n_p << std::endl;
-	}
+		// count true elements not in largest power of 2 block
+		size_t r_1(0);
 
-	// count true elements not in largest power of 2 block
-	size_t r_1(0);
- 
-	for (std::vector<bool>::const_iterator iter = x.begin ();
-	     iter != x.begin () + (n - n_p);
-	     iter++)
-		if (*iter) r_1++;
-
-	// count total number of true elements in x.
-	size_t r (r_1);
- 
-	for (std::vector<bool>::const_iterator iter = x.begin () + (n - n_p);
-	     iter != x.end ();
-	     iter++)
-		if (*iter) r++;
-
-	commentator.indent (report);
-	report << "The vector x will be broken into two sub-vectors,"
-	       << "x_1 = x[0,...," << n - n_p - 1 << "] and x_2 = x["
-	       << n - n_p << ",...," << n - 1 << "]."
-	       << "There are a total of " << r << " true Elements in x, "
-	       << r_1 << " of which occured in the first sub-vector."
-	       << "The output vector will have " << s << " entries and will"
-	       << "switch the true Elements of x into a contiguous block"
-	       << "[" << j << "," << j + r
-	       << ") = [" << j << "," << j + r - 1<< "]." << std::endl;
-
-	if (r == 0) {
-		commentator.indent (report);
-		report << "There are no true Elements in x, so the recursion is"
-		       << "being broken and a vector of false flags returned." << std::endl;
+		for (std::vector<bool>::const_iterator iter = x.begin ();
+		     iter != x.begin () + (n - n_p);
+		     iter++)
+			if (*iter) r_1++;
 
-		commentator.stop ("done");
-		return std::vector<bool> (s, false);
-	}
-	else if (r == n) {
-		commentator.indent (report);
-		report << "There are no false Elements in x, so the recursion is"
-		       << "being broken and a vector of false flags returned." << std::endl;
+		// count total number of true elements in x.
+		size_t r (r_1);
 
-		commentator.stop ("done");
-		return std::vector<bool> (s, false);
-	}
+		for (std::vector<bool>::const_iterator iter = x.begin () + (n - n_p);
+		     iter != x.end ();
+		     iter++)
+			if (*iter) r++;
 
-	// Calculate where the true elements are supposed to end up
-	// Here, they will be in a contiguous block starting after the
-	// offset.  s_1 are the true elements after the offset and in the first
-	// sub-group, s_2 are the ones in the second sub group, and s_3 are the
-	// elements that wrap around to the beginning.  s_1 and s_3 cannot both
-	// be non-zero unless s_2 == n_p.  (I.e., the second group is full.)
-	// Also, because for n != 2 n_p the offset is zero, in that case
-	// s_3 must be zero.  Any of them may be zero if the corrsponding block
-	// is empty.
-	// s_2 is only used for tracing the program, so it is not always computed.
-
-	size_t s_1;
-
-	if (j < n - n_p) {
-		if (j + r < n - n_p)
-			s_1 = r;
-		else
-			s_1 = n - n_p - j;
-	} else
-		s_1 = 0;
-
-	size_t s_2 = 0;
-
-	if (commentator.isPrinted (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)) {
-		if (j + r < n - n_p)
-			s_2 = 0;
-		else {
-			if (j + r < n)
-				s_2 = j + r;
-			else
-				s_2 = n;
+		commentator.indent (report);
+		report << "The vector x will be broken into two sub-vectors,"
+		<< "x_1 = x[0,...," << n - n_p - 1 << "] and x_2 = x["
+		<< n - n_p << ",...," << n - 1 << "]."
+		<< "There are a total of " << r << " true Elements in x, "
+		<< r_1 << " of which occured in the first sub-vector."
+		<< "The output vector will have " << s << " entries and will"
+		<< "switch the true Elements of x into a contiguous block"
+		<< "[" << j << "," << j + r
+		<< ") = [" << j << "," << j + r - 1<< "]." << std::endl;
+
+		if (r == 0) {
+			commentator.indent (report);
+			report << "There are no true Elements in x, so the recursion is"
+			<< "being broken and a vector of false flags returned." << std::endl;
 
-			if (j < n - n_p)
-				s_2 -= (n - n_p);
-			else
-				s_2 -= j;
+			commentator.stop ("done");
+			return std::vector<bool> (s, false);
 		}
-	}
+		else if (r == n) {
+			commentator.indent (report);
+			report << "There are no false Elements in x, so the recursion is"
+			<< "being broken and a vector of false flags returned." << std::endl;
 
-	size_t s_3 = ((j + r) > n) ? j + r - n : 0;
+			commentator.stop ("done");
+			return std::vector<bool> (s, false);
+		}
 
-	commentator.indent (report);
-	report << "The number of Elements in each of the three blocks of "
-	       << "true Elements in the end result are"
-	       << "s_1 = " << s_1
-	       << ", s_2 = " << s_2
-	       << ", and s_3 = " << s_3 << "." << std::endl;
+		// Calculate where the true elements are supposed to end up
+		// Here, they will be in a contiguous block starting after the
+		// offset.  s_1 are the true elements after the offset and in the first
+		// sub-group, s_2 are the ones in the second sub group, and s_3 are the
+		// elements that wrap around to the beginning.  s_1 and s_3 cannot both
+		// be non-zero unless s_2 == n_p.  (I.e., the second group is full.)
+		// Also, because for n != 2 n_p the offset is zero, in that case
+		// s_3 must be zero.  Any of them may be zero if the corrsponding block
+		// is empty.
+		// s_2 is only used for tracing the program, so it is not always computed.
+
+		size_t s_1;
+
+		if (j < n - n_p) {
+			if (j + r < n - n_p)
+				s_1 = r;
+			else
+				s_1 = n - n_p - j;
+		}
+		else
+			s_1 = 0;
+
+		size_t s_2 = 0;
+
+		if (commentator.isPrinted (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)) {
+			if (j + r < n - n_p)
+				s_2 = 0;
+			else {
+				if (j + r < n)
+					s_2 = j + r;
+				else
+					s_2 = n;
+
+				if (j < n - n_p)
+					s_2 -= (n - n_p);
+				else
+					s_2 -= j;
+			}
+		}
 
-	// Create empty vector for output. y_temp is used to retrieve output
-	// from recursion before inserting into output.
-	std::vector<bool> y_1, y_2, y_3 = std::vector<bool> (n - n_p, false);
+		size_t s_3 = ((j + r) > n) ? j + r - n : 0;
 
-	if ((s_1 + s_3) == r_1) {
 		commentator.indent (report);
-		report << "Case I: s_1 + s_3 == r_1 and s_2 == r - r_1."
-		       << "No Elements are moved between the two sub-vectors." << std::endl;
+		report << "The number of Elements in each of the three blocks of "
+		<< "true Elements in the end result are"
+		<< "s_1 = " << s_1
+		<< ", s_2 = " << s_2
+		<< ", and s_3 = " << s_3 << "." << std::endl;
 
-		if (j < (n - n_p)) {
-			commentator.indent (report);
-			report << "  A: j < (n - n_p).  j_1 = j = " << j << ", j_2 = 0";
+		// Create empty vector for output. y_temp is used to retrieve output
+		// from recursion before inserting into output.
+		std::vector<bool> y_1, y_2, y_3 = std::vector<bool> (n - n_p, false);
 
-			y_1 = setButterfly (std::vector<bool>(x.begin (), x.begin () + (n - n_p)), j);
-			y_2 = setButterfly (std::vector<bool>(x.begin () + (n - n_p), x.end ()), 0);
- 
-		} else {
+		if ((s_1 + s_3) == r_1) {
 			commentator.indent (report);
-			report << "  A: j >= (n - n_p).  j_1 = 0, j_2 = j - (n - n_p) = "
-			       << j - (n - n_p) << std::endl;
+			report << "Case I: s_1 + s_3 == r_1 and s_2 == r - r_1."
+			<< "No Elements are moved between the two sub-vectors." << std::endl;
 
-			// This case cannot occur for n != 2*n_p because j != 0
+			if (j < (n - n_p)) {
+				commentator.indent (report);
+				report << "  A: j < (n - n_p).  j_1 = j = " << j << ", j_2 = 0";
 
-			y_1 = setButterfly (std::vector<bool>(x.begin (), x.begin () + (n - n_p)), 0);
-			y_2 = setButterfly (std::vector<bool>(x.begin () + (n - n_p), x.end ()), j - (n - n_p));
-		}
-	}
-	else if ((s_1 + s_3) > r_1) {
-		commentator.indent (report);
-		report << "Case II: s_1 + s_3 > r_1 and s_2 < r - r_1."
-		       << "Elements are moved from the right sub-vector to the left." << std::endl;
+				y_1 = setButterfly (std::vector<bool>(x.begin (), x.begin () + (n - n_p)), j);
+				y_2 = setButterfly (std::vector<bool>(x.begin () + (n - n_p), x.end ()), 0);
 
-		// This means that s_2 < n_p, so either s_1 = 0 or s_3 = 0 (or both).
- 
-		if (j < (n - n_p)) {
+			}
+			else {
+				commentator.indent (report);
+				report << "  A: j >= (n - n_p).  j_1 = 0, j_2 = j - (n - n_p) = "
+				<< j - (n - n_p) << std::endl;
+
+				// This case cannot occur for n != 2*n_p because j != 0
+
+				y_1 = setButterfly (std::vector<bool>(x.begin (), x.begin () + (n - n_p)), 0);
+				y_2 = setButterfly (std::vector<bool>(x.begin () + (n - n_p), x.end ()), j - (n - n_p));
+			}
+		}
+		else if ((s_1 + s_3) > r_1) {
 			commentator.indent (report);
-			report << "  A: j < (n - n_p).  j_1 = j, j_2 = 2*n_p + j + r_1 - n = "
-			       << 2*n_p + j + r_1 - n << std::endl;
+			report << "Case II: s_1 + s_3 > r_1 and s_2 < r - r_1."
+			<< "Elements are moved from the right sub-vector to the left." << std::endl;
+
+			// This means that s_2 < n_p, so either s_1 = 0 or s_3 = 0 (or both).
+
+			if (j < (n - n_p)) {
+				commentator.indent (report);
+				report << "  A: j < (n - n_p).  j_1 = j, j_2 = 2*n_p + j + r_1 - n = "
+				<< 2*n_p + j + r_1 - n << std::endl;
 
-			// In this case, s_1 > 0, so s_3 = 0, and wrap-around cannot occur.
+				// In this case, s_1 > 0, so s_3 = 0, and wrap-around cannot occur.
 
-			y_1 = setButterfly (std::vector<bool>(x.begin (), x.begin () + (n - n_p)), j);
-			y_2 = setButterfly (std::vector<bool>(x.begin () + (n - n_p), x.end ()), 2*n_p + j + r_1 - n);
+				y_1 = setButterfly (std::vector<bool>(x.begin (), x.begin () + (n - n_p)), j);
+				y_2 = setButterfly (std::vector<bool>(x.begin () + (n - n_p), x.end ()), 2*n_p + j + r_1 - n);
 
-			for (std::vector<bool>::iterator iter = (y_3.begin () + (j + r_1));
-			     iter != (y_3.begin () + (n - n_p));
-			     iter++)
-				*iter = true;
-		} else {
+				for (std::vector<bool>::iterator iter = (y_3.begin () + (j + r_1));
+				     iter != (y_3.begin () + (n - n_p));
+				     iter++)
+					*iter = true;
+			}
+			else {
+				commentator.indent (report);
+				report << "  A: j >= (n - n_p).  j_1 = j + r - n - r_1 = "
+				<< j + r - n - r_1 << ", j_2 = j - (n - n_p) = "
+				<< j - (n - n_p) << std::endl;
+
+				// In this case, s_1 = 0, so s_3 >= 0, and wrap-around may occur.
+				// This case cannot occur for n != 2*n_p because j != 0.
+
+				y_1 = setButterfly (std::vector<bool>(x.begin (), x.begin () + (n - n_p)), j + r - n - r_1);
+				y_2 = setButterfly (std::vector<bool>(x.begin () + (n - n_p), x.end ()), j - (n - n_p));
+
+				for (std::vector<bool>::iterator iter = y_3.begin ();
+				     iter != (y_3.begin () + (j + r - n - r_1));
+				     iter++)
+					*iter = true;
+			}
+		}
+		else if ((s_1 + s_3) < r_1) {
 			commentator.indent (report);
-			report << "  A: j >= (n - n_p).  j_1 = j + r - n - r_1 = "
-			       << j + r - n - r_1 << ", j_2 = j - (n - n_p) = "
-			       << j - (n - n_p) << std::endl;
-
-			// In this case, s_1 = 0, so s_3 >= 0, and wrap-around may occur.
-			// This case cannot occur for n != 2*n_p because j != 0.
-
-			y_1 = setButterfly (std::vector<bool>(x.begin (), x.begin () + (n - n_p)), j + r - n - r_1);
-			y_2 = setButterfly (std::vector<bool>(x.begin () + (n - n_p), x.end ()), j - (n - n_p));
- 
-			for (std::vector<bool>::iterator iter = y_3.begin ();
-			     iter != (y_3.begin () + (j + r - n - r_1));
-			     iter++)
-				*iter = true;
+			report << "Case III: s_1 + s_3 < r_1 and s_2 > r - r_1."
+			<< "Elements are moved from the left sub-vector to the right." << std::endl;
+
+			// This case also means that s_1 + s_3 < n - n_p, or the contiguous
+			// block cannot encompass the entire first sub-vector.  For this
+			// reason, this case is not considered when n != 2*n_p (when j = 0).
+
+			if (j < (n - n_p)) {
+				commentator.indent (report);
+				report << "  A: j < (n - n_p).  j_1 = j = " << j
+				<< ", j_2 = j + r_1 - n + n_p = " << j + r_1 - n + n_p << std::endl;
+				// In this case, s_1 > 0, so s_3 = 0, and wrap-around cannot occur.
+
+				y_1 = setButterfly (std::vector<bool>(x.begin (), x.begin () + (n - n_p)), j);
+				y_2 = setButterfly (std::vector<bool>(x.begin () + (n - n_p), x.end ()), j + r_1 - n + n_p);
+
+				for (std::vector<bool>::iterator iter = (y_3.begin () + s_3);
+				     iter != (y_3.begin () + (j + r_1 - n + n_p));
+				     iter++)
+					*iter = true;
+			}
+			else {
+				commentator.indent (report);
+				report << "  A: j >= (n - n_p).  j_1 = j + r - n_p - r_1 = "
+				<< j + r - n_p - r_1 << ", j_2 = j - (n - n_p) = "
+				<< j - (n - n_p) << std::endl;
+
+				// In this case, s_1 = 0, so s_3 >= 0, and wrap-around may occur.
+				// This case cannot occur for n != 2*n_p because j != 0.
+
+				y_1 = setButterfly (std::vector<bool>(x.begin (), x.begin () + (n - n_p)), j + r - n_p - r_1);
+				y_2 = setButterfly (std::vector<bool>(x.begin () + (n - n_p), x.end ()), j - (n - n_p));
+
+				for (std::vector<bool>::iterator iter (y_3.begin () + (j + r - n_p - r_1));
+				     iter != (y_3.begin () + (n - n_p));
+				     iter++)
+					*iter = true;
+			}
 		}
-	}
-	else if ((s_1 + s_3) < r_1) {
-		commentator.indent (report);
-		report << "Case III: s_1 + s_3 < r_1 and s_2 > r - r_1."
-		       << "Elements are moved from the left sub-vector to the right." << std::endl;
 
-		// This case also means that s_1 + s_3 < n - n_p, or the contiguous 
-		// block cannot encompass the entire first sub-vector.  For this 
-		// reason, this case is not considered when n != 2*n_p (when j = 0).
+		// Create output vector.
+		std::vector<bool> y (y_1);
+		y.insert (y.end (), y_2.begin (), y_2.end ());
+		y.insert (y.end (), y_3.begin (), y_3.end ());
 
-		if (j < (n - n_p)) {
-			commentator.indent (report);
-			report << "  A: j < (n - n_p).  j_1 = j = " << j
-			       << ", j_2 = j + r_1 - n + n_p = " << j + r_1 - n + n_p << std::endl;
-			// In this case, s_1 > 0, so s_3 = 0, and wrap-around cannot occur.
-
-			y_1 = setButterfly (std::vector<bool>(x.begin (), x.begin () + (n - n_p)), j);
-			y_2 = setButterfly (std::vector<bool>(x.begin () + (n - n_p), x.end ()), j + r_1 - n + n_p);
-
-			for (std::vector<bool>::iterator iter = (y_3.begin () + s_3);
-			     iter != (y_3.begin () + (j + r_1 - n + n_p));
-			     iter++)
-				*iter = true;
-		} else {
+		commentator.indent (report);
+		report << "The output vector for n = " << n << " has " << y.size ()
+		<< " entries."
+		<< "  " << y_1.size () << " from the first sub-vector"
+		<< "  " << y_2.size () << " from the second sub-vector"
+		<< "  " << y_3.size () << " from recombining the two"
+		<< "And the output vector y is:"
+		<< "-------------------------- " << std::endl;
+
+		for (size_t i = 0; i < y.size (); i++) {
 			commentator.indent (report);
-			report << "  A: j >= (n - n_p).  j_1 = j + r - n_p - r_1 = "
-			       << j + r - n_p - r_1 << ", j_2 = j - (n - n_p) = "
-			       << j - (n - n_p) << std::endl;
-
-			// In this case, s_1 = 0, so s_3 >= 0, and wrap-around may occur.
-			// This case cannot occur for n != 2*n_p because j != 0.
-
-			y_1 = setButterfly (std::vector<bool>(x.begin (), x.begin () + (n - n_p)), j + r - n_p - r_1);
-			y_2 = setButterfly (std::vector<bool>(x.begin () + (n - n_p), x.end ()), j - (n - n_p));
- 
-			for (std::vector<bool>::iterator iter (y_3.begin () + (j + r - n_p - r_1));
-			     iter != (y_3.begin () + (n - n_p));
-			     iter++)
-				*iter = true;
+			report << "  " << i << ": " << y[i] << std::endl;
 		}
-	}
 
-	// Create output vector.
-	std::vector<bool> y (y_1);
-	y.insert (y.end (), y_2.begin (), y_2.end ());
-	y.insert (y.end (), y_3.begin (), y_3.end ());
-
-	commentator.indent (report);
-	report << "The output vector for n = " << n << " has " << y.size ()
-	       << " entries."
-	       << "  " << y_1.size () << " from the first sub-vector"
-	       << "  " << y_2.size () << " from the second sub-vector"
-	       << "  " << y_3.size () << " from recombining the two"
-	       << "And the output vector y is:"
-	       << "-------------------------- " << std::endl;
-
-	for (size_t i = 0; i < y.size (); i++) {
 		commentator.indent (report);
-		report << "  " << i << ": " << y[i] << std::endl;
-	}
+		report << "-------------------------- " << std::endl;
 
-	commentator.indent (report);
-	report << "-------------------------- " << std::endl;
+		commentator.stop ("done");
 
-	commentator.stop ("done");
- 
-	return y;
+		return y;
 
-} // std::vector<bool> setButterfly (const std::vector<bool>& x, size_t j)
+	} // std::vector<bool> setButterfly (const std::vector<bool>& x, size_t j)
 
-//@}
+	//@}
 } // namespace LinBox
 
-#endif // __BUTTERFLY_H
+#endif // __LINBOX_butterfly_H
+
diff --git a/linbox/blackbox/companion.h b/linbox/blackbox/companion.h
index c6a62a2..8f14d54 100644
--- a/linbox/blackbox/companion.h
+++ b/linbox/blackbox/companion.h
@@ -1,99 +1,107 @@
-/* linbox/blackbox/mapleBB.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
+/* linbox/blackbox/companion.h
+ * Copyright(c) LinBox
  *
  * Written by David Saunders <saunders at cis.udel.edu>
- * See COPYING
+ * See COPYING for licence information
  */
 
-#ifndef __COMPANION_H
-#define __COMPANION_H
+#ifndef __LINBOX_companion_H
+#define __LINBOX_companion_H
 
 #include <linbox/blackbox/blackbox-interface.h>
 #include "linbox/blackbox/triplesbb.h"
 #include <vector>
 
-namespace LinBox {
-
-/** \ingroup blackbox
-\brief %Companion matrix of a monic polynomial.
-*/
-template<class _Field>
-struct Companion: public TriplesBB<_Field> {
-	typedef _Field Field;
-
-	/// This is the n by n companion matrix of a given polynomial of degree n.
-	template<class Polynomial>
-	Companion(const Field& F =Field(), const Polynomial& P =Polynomial(1))
-        : TriplesBB<Field>(F, P.size()-1, P.size()-1)
-	{	size_t n = P.size() - 1;
-		const size_t indexbase = 1;
-		typename Field::Element one; F.init(one, 1);
-	 	for (size_t i = 1; i < n; ++i) addEntry(one, i+indexbase, i-1+indexbase); 
-	 	for (size_t i = 0; i < n; ++i)
-		{	typename Field::Element x;
-			F.init(x, 0);
-			F.neg(x, P[i]); 
-			addEntry(x, i+indexbase, n-1+indexbase); 
-		}
-	}// Companion cstor
- 
-	
-
-
-	/** 
-	 * \brief This constructs a random companion matrix.  
-
-	 Builds n by n matrix from degree n monic poly with other coefficients random.
-	*/
-	Companion(const Field& F, size_t n, 
-		  typename Field::RandIter r )
-	: TriplesBB<Field>(F, n, n)
-	{				
-		std::vector<typename Field::Element> p(n+1);	       
-		for (typename std::vector<typename Field::Element>::iterator i = p.begin(); i != p.end(); ++i)
-			r.random(*i); // we'll pretend p[n] == 1, ok?
-		
-		const size_t indexbase = 1;
-		typename Field::Element one; F.init(one, 1);
-	 	for (size_t i = 1; i < n; ++i) addEntry(one, i+indexbase, i-1+indexbase); 
-	 	for (size_t i = 0; i < n; ++i)
-		{	typename Field::Element x;
-			F.init(x, 0);
-			F.neg(x, p[i]); 
-			addEntry(x, i+indexbase, n-1+indexbase); 
+namespace LinBox
+{
+
+	/** \ingroup blackbox
+	  \brief %Companion matrix of a monic polynomial.
+	  */
+	template<class _Field>
+	struct Companion: public TriplesBB<_Field> {
+		typedef _Field Field;
+
+		/// This is the n by n companion matrix of a given polynomial of degree n.
+		template<class Polynomial>
+		Companion(const Field& F =Field(), const Polynomial& P =Polynomial(1)) :
+			TriplesBB<Field>(F, P.size()-1, P.size()-1)
+		{	size_t n = P.size() - 1;
+			const size_t indexbase = 1;
+			typename Field::Element one; F.init(one, 1);
+			for (size_t i = 1; i < n; ++i) addEntry(one, i+indexbase, i-1+indexbase);
+			for (size_t i = 0; i < n; ++i)
+			{	typename Field::Element x;
+				F.init(x, 0);
+				F.neg(x, P[i]);
+				addEntry(x, i+indexbase, n-1+indexbase);
+			}
+		}// Companion cstor
+
+
+
+
+		/**
+		 * \brief This constructs a random companion matrix.
+
+		 Builds n by n matrix from degree n monic poly with other coefficients random.
+		 */
+		Companion(const Field& F, size_t n,
+			  typename Field::RandIter r ) :
+			TriplesBB<Field>(F, n, n)
+		{
+			std::vector<typename Field::Element> p(n+1);
+			for (typename std::vector<typename Field::Element>::iterator i = p.begin(); i != p.end(); ++i)
+				r.random(*i); // we'll pretend p[n] == 1, ok?
+
+			const size_t indexbase = 1;
+			typename Field::Element one; F.init(one, 1);
+			for (size_t i = 1; i < n; ++i) addEntry(one, i+indexbase, i-1+indexbase);
+			for (size_t i = 0; i < n; ++i)
+			{	typename Field::Element x;
+				F.init(x, 0);
+				F.neg(x, p[i]);
+				addEntry(x, i+indexbase, n-1+indexbase);
+			}
+
 		}
-	
-	}
-
-	Companion(const Field& F, size_t n) :TriplesBB<Field>(F,n,n) 
-	{
-		typename Field::RandIter r(F);
-		std::vector<typename Field::Element> p(n+1);	       
-		for (typename std::vector<typename Field::Element>::iterator i = p.begin(); i != p.end(); ++i)
-			r.random(*i); // we'll pretend p[n] == 1, ok?
-
-		const size_t indexbase = 1;
-		typename Field::Element one; F.init(one, 1);
-	 	for (size_t i = 1; i < n; ++i) addEntry(one, i+indexbase, i-1+indexbase); 
-	 	for (size_t i = 0; i < n; ++i)
-		{	typename Field::Element x;
-			F.init(x, 0);
-			F.neg(x, p[i]); 
-			addEntry(x, i+indexbase, n-1+indexbase); 
+
+		Companion(const Field& F, size_t n) :
+			TriplesBB<Field>(F,n,n)
+		{
+			typename Field::RandIter r(F);
+			std::vector<typename Field::Element> p(n+1);
+			for (typename std::vector<typename Field::Element>::iterator i = p.begin(); i != p.end(); ++i)
+				r.random(*i); // we'll pretend p[n] == 1, ok?
+
+			const size_t indexbase = 1;
+			typename Field::Element one; F.init(one, 1);
+			for (size_t i = 1; i < n; ++i) addEntry(one, i+indexbase, i-1+indexbase);
+			for (size_t i = 0; i < n; ++i)
+			{	typename Field::Element x;
+				F.init(x, 0);
+				F.neg(x, p[i]);
+				addEntry(x, i+indexbase, n-1+indexbase);
+			}
+
 		}
 
-	}
+		template<typename _Tp1>
+		struct rebind {
+			typedef Companion<_Tp1> other;
+		};
 
-    template<typename _Tp1>
-    struct rebind
-    { typedef Companion<_Tp1> other; };
 
 
-	
 
-// companion would be faster if built direct, using one axpy per entry: y_i = x_i-1 + p_i*x_n
+		// companion would be faster if built direct, using one axpy per entry: y_i = x_i-1 + p_i*x_n
 
-}; //Companion class
+	}; //Companion class
 
 } //LinBox
-#endif //__COMPANION_H
+
+#endif //__LINBOX_companion_H
+
 
diff --git a/linbox/blackbox/compose.h b/linbox/blackbox/compose.h
index f45538a..844db65 100644
--- a/linbox/blackbox/compose.h
+++ b/linbox/blackbox/compose.h
@@ -1,5 +1,5 @@
-
-
+/* -*- 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
 /* linbox/blackbox/compose.h
  * Copyright (C) 1999-2001 William J Turner,
  *               2001 Bradford Hovinen
@@ -23,8 +23,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __COMPOSE_H
-#define __COMPOSE_H
+#ifndef __LINBOX_compose_H
+#define __LINBOX_compose_H
 
 
 #include "linbox/util/debug.h"
@@ -33,30 +33,39 @@
 
 namespace LinBox
 {
+	template <class _Blackbox1, class _Blackbox2 = _Blackbox1>
+	class Compose;
+
+	template <class _Blackbox1, class _Blackbox2 = _Blackbox1>
+	class ComposeOwner;
+}
+
+
+namespace LinBox
+{
 
-	/** 
-	 * \brief Blackbox of a product: C := AB, i.e. Cx := A(Bx).
+	/**
+	 * Blackbox of a product: \f$C = AB\f$, i.e \f$Cx \gets A(Bx)\f$.
 
-	 * This is a class that multiplies two matrices by implementing an 
-	 * apply method that calls the apply methods of both of the consituent 
+	 * This is a class that multiplies two matrices by implementing an
+	 * apply method that calls the apply methods of both of the consituent
 	 * matrices, one after the other.
 	 *
-	 * This class, like the Black Box archetype from which it is derived, 
-	 * is templatized by the vector type to which the matrix is applied.  
+	 * This class, like the Black Box archetype from which it is derived,
+	 * is templatized by the vector type to which the matrix is applied.
 	 * Both constituent matrices must also use this same vector type.
-	 * For specification of the blackbox members see \ref{BlackboxArchetype}.
-	 * 
-	 * {\bf Template parameter:} must meet the \ref{Vector} requirement.
-\ingroup blackbox
+	 * For specification of the blackbox members see \ref BlackboxArchetype.
+	 *
+	 * <b> Template parameter:</b> must meet the \ref Vector requirement.
+	 \ingroup blackbox
 	 */
 	//@{
 	/// General case
-	template <class _Blackbox1, class _Blackbox2 = _Blackbox1>
-	class Compose : public BlackboxInterface
-	{
-                typedef Compose<_Blackbox1, _Blackbox2> Self_t;
-	    public:
-		
+	template <class _Blackbox1, class _Blackbox2>
+	class Compose : public BlackboxInterface {
+		typedef Compose<_Blackbox1, _Blackbox2> Self_t;
+	public:
+
 		typedef _Blackbox1 Blackbox1;
 		typedef _Blackbox2 Blackbox2;
 
@@ -65,13 +74,15 @@ namespace LinBox
 
 		/** Constructor of C := A*B from blackbox matrices A and B.
 		 * Build the product A*B of any two black box matrices of compatible dimensions.
-		 * Requires A.coldim() equals B.rowdim().
+		 * @pre <code>A.coldim() == B.rowdim()</code>.
+		 * @param A blackbox
+		 * @param B blackbox
 		 */
-		Compose (const Blackbox1 &A, const Blackbox2 &B)
-			: _A_ptr(&A), _B_ptr(&B) 
+		Compose (const Blackbox1 &A, const Blackbox2 &B) :
+			_A_ptr(&A), _B_ptr(&B)
 		{
 			// Rich Seagraves - "It seems VectorWrapper somehow
-			// became depricated.  Makes the assumption that 
+			// became depricated.  Makes the assumption that
 			// this vector type supports resize"
 			// VectorWrapper::ensureDim (_z, _A_ptr->coldim ());
 			_z.resize(_A_ptr->coldim());
@@ -80,9 +91,11 @@ namespace LinBox
 		/** Constructor of C := (*A_ptr)*(*B_ptr).
 		 * This constructor creates a matrix that is a product of two black box
 		 * matrices: A*B from pointers to them.
+		 * @param A_ptr blackbox
+		 * @param B_ptr blackbox
 		 */
-		Compose (const Blackbox1 *A_ptr, const Blackbox2 *B_ptr)
-			: _A_ptr(A_ptr), _B_ptr(B_ptr)
+		Compose (const Blackbox1 *A_ptr, const Blackbox2 *B_ptr) :
+			_A_ptr(A_ptr), _B_ptr(B_ptr)
 		{
 			linbox_check (A_ptr != (Blackbox1 *) 0);
 			linbox_check (B_ptr != (Blackbox2 *) 0);
@@ -95,11 +108,12 @@ namespace LinBox
 		/** Copy constructor.
 		 * Copies the composed matrix (a small handle).  The underlying two matrices
 		 * are not copied.
+		 * @param[in] M blackbox to copy.
 		 */
-		Compose (const Compose<Blackbox1, Blackbox2>& M) 
-			:_A_ptr ( M._A_ptr), _B_ptr ( M._B_ptr)
+		Compose (const Compose<Blackbox1, Blackbox2>& M) :
+			_A_ptr ( M._A_ptr), _B_ptr ( M._B_ptr)
 			//{ VectorWrapper::ensureDim (_z, _A_ptr->coldim ()); }
-			{ _z.resize(_A_ptr->coldim());}
+		{ _z.resize(_A_ptr->coldim());}
 
 		/// Destructor
 		~Compose () {}
@@ -109,17 +123,19 @@ namespace LinBox
 		 * Make a copy of the BlackboxArchetype object.
 		 * Required by abstract base class.
 		 * @return pointer to new blackbox object
-// 		 */
-// 		BlackboxArchetype<_Vector> *clone () const
-// 			{ return new Compose (*this); }
+		*/
+#if 0
+		 		BlackboxArchetype<_Vector> *clone () const
+		 			{ return new Compose (*this); }
+#endif
 
 		/** Matrix * column vector product.
-		 * y= (A*B)*x.
+		 * \f$ y \gets (A\cdot B)\cdot x\f$
 		 * Applies B, then A.
 		 * @return reference to vector y containing output.
 		 * @param  x constant reference to vector to contain input
+		 * @param[out] y the result.
 		 */
-
 		template <class OutVector, class InVector>
 		inline OutVector& apply (OutVector& y, const InVector& x) const
 		{
@@ -131,11 +147,12 @@ namespace LinBox
 			return y;
 		}
 
-		/** row vector * matrix produc
-		 * y= transpose(A*B)*x.
+		/** row vector * matrix product.
+		 * \f$ y \gets (A\cdot B)^t  \cdot x\f$.
 		 * Applies A^t then B^t.
 		 * @return reference to vector y containing output.
 		 * @param  x constant reference to vector to contain input
+		 * @param[out] y the result.
 		 */
 		template <class OutVector, class InVector>
 		inline OutVector& applyTranspose (OutVector& y, const InVector& x) const
@@ -148,19 +165,20 @@ namespace LinBox
 			return y;
 		}
 
-            template<typename _Tp1, typename _Tp2 = _Tp1>
-            struct rebind
-            { 
-                typedef Compose<typename Blackbox1::template rebind<_Tp1>::other, typename Blackbox2::template rebind<_Tp2>::other> other; 
-    		void operator() (other *& Ap, const Self_t& A, const _Tp1& F) {
-                    typename other::Blackbox1 * A1;
-                    typename Blackbox1::template rebind<_Tp1> () ( A1, *(A._A_ptr), F);
-                    typename other::Blackbox2 * A2;
-                    typename Blackbox2::template rebind<_Tp1> () ( A2, *(A._B_ptr), F);
-                    Ap = new other(*A1, *A2);
-                }
-            
-            };
+		template<typename _Tp1, typename _Tp2 = _Tp1>
+		struct rebind {
+			typedef ComposeOwner<
+			typename Blackbox1::template rebind<_Tp1>::other,
+				 typename Blackbox2::template rebind<_Tp2>::other
+				 > other;
+
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F)
+			{
+				typename Blackbox1::template rebind<_Tp1> () ( Ap.getLeftData(), *(A.getLeftPtr()), F);
+				typename Blackbox2::template rebind<_Tp2> () ( Ap.getRightData(), *(A.getRightPtr()), F);
+			}
+
+		};
 
 
 
@@ -172,34 +190,37 @@ namespace LinBox
 		/// The number of rows
 		size_t rowdim (void) const
 		{
-			if (_A_ptr != 0) 
+			if (_A_ptr != 0)
 				return _A_ptr->rowdim ();
-			else 
+			else
 				return 0;
 		}
-    
+
 		/*- Retreive column dimensions of BlackBox matrix.
 		 * Required by abstract base class.
 		 * @return integer number of columns of black box matrix.
 		 */
 		/// The number of columns
-		size_t coldim(void) const 
+		size_t coldim(void) const
 		{
-			if (_B_ptr != 0) 
+			if (_B_ptr != 0)
 				return _B_ptr->coldim ();
-			else 
+			else
 				return 0;
 		}
-	        /// The field.	
-		const Field& field() const {return _B_ptr->field();}
+		/// The field.
+		const Field& field() const
+		{return _B_ptr->field();}
 
-		// accessors to the blackboxes
+		/// accessor to the blackboxes
+		const Blackbox1* getLeftPtr() const
+		{return  _A_ptr;}
 
-		const Blackbox1* getLeftPtr() const {return  _A_ptr;}
-		
-	        const Blackbox2* getRightPtr() const {return  _B_ptr;}
+		/// accessor to the blackboxes
+		const Blackbox2* getRightPtr() const
+		{return  _B_ptr;}
 
-	    protected:
+	protected:
 
 		// Pointers to A and B matrices
 		const Blackbox1 *_A_ptr;
@@ -208,19 +229,18 @@ namespace LinBox
 		// local intermediate vector
 		mutable std::vector<Element> _z;
 	};
-	
-	/// specialization for _Blackbox1 = _Blackbox2	
+
+	/// specialization for _Blackbox1 = _Blackbox2
 	template <class _Blackbox>
-	class Compose <_Blackbox, _Blackbox> : public BlackboxInterface
-	{
-                typedef Compose<_Blackbox, _Blackbox> Self_t;
+	class Compose <_Blackbox, _Blackbox> : public BlackboxInterface {
+		typedef Compose<_Blackbox, _Blackbox> Self_t;
 	public:
 		typedef _Blackbox Blackbox;
 
 		typedef typename _Blackbox::Field Field;
 		typedef typename _Blackbox::Element Element;
-		
-		
+
+
 		Compose (const Blackbox& A, const Blackbox& B) {
 			_BlackboxL.push_back(&A);
 			_BlackboxL.push_back(&B);
@@ -244,8 +264,8 @@ namespace LinBox
 		 * Requires A.coldim() equals B.rowdim().
 		 */
 		template<class BPVector>
-		Compose (const BPVector& v)
-			:  _BlackboxL(v.begin(), v.end())
+		Compose (const BPVector& v) :
+			_BlackboxL(v.begin(), v.end())
 		{
 
 			linbox_check(v.size() > 0);
@@ -254,39 +274,40 @@ namespace LinBox
 			typename std::vector<std::vector<Element> >::iterator z_p;
 			// it would be good to use just 2 vectors and flip/flop.
 			for ( b_p = _BlackboxL.begin(), z_p = _zl.begin();
-			      z_p != _zl.end(); ++ b_p, ++ z_p) 
+			      z_p != _zl.end(); ++ b_p, ++ z_p)
 				z_p -> resize((*b_p) -> coldim());
 		}
-		
+
 		~Compose () {}
 
 		template <class OutVector, class InVector>
 		inline OutVector& apply (OutVector& y, const InVector& x) const
-		{	
-			
+		{
+
 			typename std::vector<const Blackbox*>::const_reverse_iterator b_p;
 			typename std::vector<std::vector<Element> >::reverse_iterator z_p, pz_p;
 			b_p = _BlackboxL.rbegin();
-			pz_p = z_p = _zl.rbegin();			
-			
+			pz_p = z_p = _zl.rbegin();
+
 			(*b_p) -> apply(*pz_p, x);
-		        ++ b_p;  ++ z_p;
+			++ b_p;  ++ z_p;
 
 			for (; z_p != _zl.rend(); ++ b_p, ++ z_p, ++ pz_p)
 				(*b_p) -> apply (*z_p,*pz_p);
 
 			(*b_p) -> apply(y, *pz_p);
-			
+
 			return y;
 		}
 
-		/*- Application of BlackBox matrix transpose.
-		 * y= transpose(A*B)*x.
-		 * Requires one vector conforming to the \ref{LinBox}
-		 * vector {@link Archetypes archetype}.
+		/*! Application of BlackBox matrix transpose.
+		 * <code>y= transpose(A*B)*x</code>.
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
 		 * Required by abstract base class.
 		 * @return reference to vector y containing output.
 		 * @param  x constant reference to vector to contain input
+		 * \param y result
 		 */
 		template <class OutVector, class InVector>
 		inline OutVector& applyTranspose (OutVector& y, const InVector& x) const
@@ -301,7 +322,7 @@ namespace LinBox
 
 			++ b_p; ++ nz_p;
 
-			for (; nz_p != _zl.rend(); ++ z_p, ++ nz_p, ++ b_p) 
+			for (; nz_p != _zl.rend(); ++ z_p, ++ nz_p, ++ b_p)
 				(*b_p) -> applyTranspose (*nz_p, *z_p);
 
 			(*b_p) -> applyTranspose (y, *z_p);
@@ -309,22 +330,22 @@ namespace LinBox
 			return y;
 		}
 
-            template<typename _Tp1>
-            struct rebind
-            { 
-                typedef Compose<typename Blackbox::template rebind<_Tp1>::other, typename Blackbox::template rebind<_Tp1>::other> other; 
-
-                void operator() (other *& Ap, const Self_t& A, const _Tp1& F) {
-                    std::vector<typename other::Blackbox *> newPtrV;                  
-                    typename std::vector<typename other::Blackbox *>::iterator np;
-                    typename std::vector<const Blackbox* >::const_iterator bp;
-                    for( bp = A._BlackboxL.begin(), np = newPtrV.begin(); 
-                         bp != A._BlackboxL.end(); ++bp, ++np) {
-                        typename Blackbox::template rebind<_Tp1> () (*np, *(*bp), F);
-                    }
-                    Ap = new other(newPtrV);
-                }  
-            };
+		template<typename _Tp1>
+		struct rebind
+		{
+			typedef Compose<typename Blackbox::template rebind<_Tp1>::other, typename Blackbox::template rebind<_Tp1>::other> other;
+
+			void operator() (other *& Ap, const Self_t& A, const _Tp1& F) {
+				std::vector<typename other::Blackbox *> newPtrV;
+				typename std::vector<typename other::Blackbox *>::iterator np;
+				typename std::vector<const Blackbox* >::const_iterator bp;
+				for( bp = A._BlackboxL.begin(), np = newPtrV.begin();
+				     bp != A._BlackboxL.end(); ++bp, ++np) {
+					typename Blackbox::template rebind<_Tp1> () (*np, *(*bp), F);
+				}
+				Ap = new other(newPtrV);
+			}
+		};
 
 		/*- Retreive row dimensions of BlackBox matrix.
 		 * This may be needed for applying preconditioners.
@@ -335,26 +356,29 @@ namespace LinBox
 		{
 			return _BlackboxL.front() -> rowdim();
 		}
-    
+
 		/*- Retreive column dimensions of BlackBox matrix.
 		 * Required by abstract base class.
 		 * @return integer number of columns of black box matrix.
 		 */
-		size_t coldim(void) const 
+		size_t coldim(void) const
 		{
 			return _BlackboxL[_BlackboxL.size() - 1] -> coldim();
 		}
-		
-		const Field& field() const {return _BlackboxL.front() -> field();}
+
+		const Field& field() const
+		{return _BlackboxL.front() -> field();}
 
 		// accessors to the blackboxes
 
-		const Blackbox* getLeftPtr() const {return  _BlackboxL.front();}
-		
-	        const Blackbox* getRightPtr() const {return  _BlackboxL.back();}
+		const Blackbox* getLeftPtr() const
+		{return  _BlackboxL.front();}
+
+		const Blackbox* getRightPtr() const
+		{return  _BlackboxL.back();}
 
-     
-	    protected:
+
+	protected:
 
 		// Pointers to A and B matrices
 		std::vector<const Blackbox*> _BlackboxL;
@@ -363,26 +387,223 @@ namespace LinBox
 		mutable std::vector<std::vector<Element> > _zl;
 	};
 
-//@}
+	//@}
 
 } // namespace LinBox
 
 // was compose-traits.h (by Zhendong Wan)
 #include <linbox/blackbox/dense.h>
-namespace LinBox{
-                                                                                                  
-        /// used in ..., for example
-        template<class IMatrix>
-        class ComposeTraits { public:
-                typedef Compose<IMatrix, IMatrix> value_type;
-        };
-                                                                                                  
-        /// used in smith-binary, for example
-        template<class Field>
-        class ComposeTraits<DenseMatrix<Field> > { public:
-                                                                                                  
-                // define the return value type
-                typedef DenseMatrix<Field> value_type;         };
+namespace LinBox
+{
+
+	/// used in ..., for example
+	template<class IMatrix>
+	class ComposeTraits {
+	public:
+		typedef Compose<IMatrix, IMatrix> value_type;
+	};
+
+	/// used in smith-binary, for example
+	template<class Field>
+	class ComposeTraits<DenseMatrix<Field> > {
+	public:
+
+		// define the return value type
+		typedef DenseMatrix<Field> value_type;         };
+}
+
+
+namespace LinBox
+{
+
+	/**
+	 * Blackbox of a product: \f$C = AB\f$, i.e \f$Cx \gets A(Bx)\f$.
+
+	 * This is a class that multiplies two matrices by implementing an
+	 * apply method that calls the apply methods of both of the consituent
+	 * matrices, one after the other.
+	 *
+	 * This class, like the Black Box archetype from which it is derived,
+	 * is templatized by the vector type to which the matrix is applied.
+	 * Both constituent matrices must also use this same vector type.
+	 * For specification of the blackbox members see \ref BlackboxArchetype.
+	 *
+	 * <b> Template parameter:</b> must meet the \ref Vector requirement.
+	 \ingroup blackbox
+	 */
+	//@{
+	/// General case
+	template <class _Blackbox1, class _Blackbox2>
+	class ComposeOwner : public BlackboxInterface {
+		typedef ComposeOwner<_Blackbox1, _Blackbox2> Self_t;
+	public:
+
+		typedef _Blackbox1 Blackbox1;
+		typedef _Blackbox2 Blackbox2;
+
+		typedef typename Blackbox2::Field Field;
+		typedef typename Field::Element Element;
+
+		/** Constructor of C := A*B from blackbox matrices A and B.
+		 * Build the product A*B of any two black box matrices of compatible dimensions.
+		 * Requires A.coldim() equals B.rowdim().
+		 */
+		ComposeOwner (const Blackbox1 &A, const Blackbox2 &B) :
+			_A_data(A), _B_data(B)
+		{
+			// Rich Seagraves - "It seems VectorWrapper somehow
+			// became depricated.  Makes the assumption that
+			// this vector type supports resize"
+			// VectorWrapper::ensureDim (_z, _A_data.coldim ());
+			_z.resize(_A_data.coldim());
+		}
+
+		/** Constructor of C := (*A_data)*(*B_data).
+		 * This constructor creates a matrix that is a product of two black box
+		 * matrices: A*B from pointers to them.
+		 */
+		ComposeOwner (const Blackbox1 *A_data, const Blackbox2 *B_data) :
+			_A_data(*A_data), _B_data(*B_data)
+		{
+			linbox_check (A_data != (Blackbox1 *) 0);
+			linbox_check (B_data != (Blackbox2 *) 0);
+			linbox_check (A_data.coldim () == B_data.rowdim ());
+
+			// VectorWrapper::ensureDim (_z, _A_data.coldim ());
+			_z.resize(_A_data.coldim());
+		}
+
+		/** Copy constructor.
+		 * Copies the composed matrix (a small handle).  The underlying two matrices
+		 * are not copied.
+		 * \param M matrix to be copied.
+		 */
+		ComposeOwner (const ComposeOwner<Blackbox1, Blackbox2>& M) :
+			_A_data ( M.getLeftData()), _B_data ( M.getRightData())
+		{ _z.resize(_A_data.coldim());}
+
+
+		/// Destructor
+		~ComposeOwner () {}
+
+#if 0
+		/*- Virtual constructor.
+		 * Required because constructors cannot be virtual.
+		 * Make a copy of the BlackboxArchetype object.
+		 * Required by abstract base class.
+		 * @return pointer to new blackbox object
+		*/
+		BlackboxArchetype<_Vector> *clone () const
+		{
+			return new ComposeOwner (*this);
+		}
+#endif
+
+		/** Matrix * column vector product.
+		 * \f$ y= (A\cdot B) \cdot x.\f$
+		 * Applies B, then A.
+		 * @return reference to vector y containing output.
+		 * @param  x constant reference to vector to contain input
+		 * \param y result
+		 */
+		template <class OutVector, class InVector>
+		inline OutVector& apply (OutVector& y, const InVector& x) const
+		{
+			return _A_data.apply (y, _B_data.apply (_z, x));
+		}
+
+		/** row vector * matrix product \f$y= (A \times B)^T \cdot x\f$.
+		 * Applies A^t then B^t.
+		 * @return reference to vector y containing output.
+		 * @param  x constant reference to vector to contain input
+		 * @param y
+		 */
+		template <class OutVector, class InVector>
+		inline OutVector& applyTranspose (OutVector& y, const InVector& x) const
+		{
+			return _B_data.applyTranspose (y, _A_data.applyTranspose (_z, x));
+		}
+
+		template<typename _Tp1, typename _Tp2 = _Tp1>
+		struct rebind {
+			typedef ComposeOwner<
+			typename Blackbox1::template rebind<_Tp1>::other,
+				 typename Blackbox2::template rebind<_Tp2>::other
+				 > other;
+
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F) {
+				typename Blackbox1::template rebind<_Tp1> () ( Ap.getLeftData(), A.getLeftData(), F);
+				typename Blackbox2::template rebind<_Tp2> () ( Ap.getRightData(), A.getRightData(), F);
+			}
+
+		};
+
+
+		template<typename _BBt1, typename _BBt2, typename Field>
+		ComposeOwner (const Compose<_BBt1, _BBt2> &M, const Field& F) :
+			_A_data(*(M.getLeftPtr()), F),
+			_B_data(*(M.getRightPtr()), F),
+			_z(_A_data.coldim())
+		{
+			typename Compose<_BBt1, _BBt2>::template rebind<Field>()(*this,M,F);
+		}
+
+		template<typename _BBt1, typename _BBt2, typename Field>
+		ComposeOwner (const ComposeOwner<_BBt1, _BBt2> &M, const Field& F) :
+			_A_data(M.getLeftData(), F),
+			_B_data(M.getRightData(), F) ,
+			_z(_A_data.coldim())
+		{
+			typename ComposeOwner<_BBt1, _BBt2>::template rebind<Field>()(*this,M,F);
+		}
+
+
+		/*- Retreive row dimensions of BlackBox matrix.
+		 * This may be needed for applying preconditioners.
+		 * Required by abstract base class.
+		 * @return integer number of rows of black box matrix.
+		 */
+		/// The number of rows
+		size_t rowdim (void) const
+		{
+			return _A_data.rowdim ();
+		}
+
+		/*- Retreive column dimensions of BlackBox matrix.
+		 * Required by abstract base class.
+		 * @return integer number of columns of black box matrix.
+		 */
+		/// The number of columns
+		size_t coldim(void) const
+		{
+			return _B_data.coldim ();
+		}
+		/// The field.
+		const Field& field() const
+		{return _B_data.field();}
+
+
+		// accessors to the blackboxes without ownership
+		const Blackbox1& getLeftData() const
+		{return  _A_data;}
+		Blackbox1& getLeftData() {return  _A_data;}
+
+		const Blackbox2& getRightData() const
+		{return  _B_data;}
+		Blackbox2& getRightData() {return  _B_data;}
+
+	protected:
+
+		// A and B matrices
+		Blackbox1 _A_data;
+		Blackbox2 _B_data;
+
+		// local intermediate vector
+		mutable std::vector<Element> _z;
+	};
+
 }
 
-#endif // __COMPOSE_H
+
+#endif // __LINBOX_compose_H
+
diff --git a/linbox/blackbox/dense.h b/linbox/blackbox/dense.h
index 7787b03..cb7ddaa 100644
--- a/linbox/blackbox/dense.h
+++ b/linbox/blackbox/dense.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/blackbox/dense.h
  * Copyright (C) 2001 B. David Saunders,
  *               2001-2002 Bradford Hovinen,
@@ -24,8 +24,13 @@
  * See COPYING for license information
  */
 
-#ifndef __BLACKBOX_DENSE_H
-#define __BLACKBOX_DENSE_H
+/** @file blackbox/dense.h
+ * @ingroup blackbox
+ * @brief NO DOC
+*/
+
+#ifndef __LINBOX_blackbox_dense_H
+#define __LINBOX_blackbox_dense_H
 
 #include <iostream>
 #include <vector>
@@ -46,319 +51,332 @@
 #include <linbox/blackbox/blackbox_parallel.h>
 #endif
 
+
 namespace LinBox
 {
 
-/** \brief Blackbox interface to dense matrix representation. 
-
- * This is a class of dense matrices
- * templatized by the \link LinBox::FieldArchetype field \endlink 
-in which the elements
- * reside. The matrix is stored as a one dimensional STL vector of
- * the elements, in row major order. The interface provides for iteration
- * over rows and over columns.
- *
- * The class conforms to the \link Archetypes archetype \endlink for
-\link LinBox::BlackboxArchetype blackboxes \endlink and for the 
-\link LinBox::DenseMatrixBase dense matrix container \endlink.
- *
- * Currently, only dense vectors are supported when doing matrix-vector
- * applies.
- *
- * @param _Field a LinBox field class
-\ingroup blackbox
- */
-
-template <class _Field>
-class DenseMatrix : public BlackboxInterface, public DenseMatrixBase<typename _Field::Element> 
-{
-    public:
+	/** \brief Blackbox interface to dense matrix representation.
+
+	 * This is a class of dense matrices
+	 * templatized by the \link LinBox::FieldArchetype field \endlink
+	 in which the elements
+	 * reside. The matrix is stored as a one dimensional STL vector of
+	 * the elements, in row major order. The interface provides for iteration
+	 * over rows and over columns.
+	 *
+	 * The class conforms to the \link Archetypes archetype \endlink for
+	 \link LinBox::BlackboxArchetype blackboxes \endlink and for the
+	 \link LinBox::DenseMatrixBase dense matrix container \endlink.
+	 *
+	 * Currently, only dense vectors are supported when doing matrix-vector
+	 * applies.
+	 *
+	 * @param _Field a LinBox field class
+	 \ingroup blackbox
+	 */
+	template <class _Field>
+	class DenseMatrix : public BlackboxInterface, public DenseMatrixBase<typename _Field::Element> {
+	public:
 
 #ifdef __LINBOX_PARALLEL
-	BB_list_list sub_list;
+		BB_list_list sub_list;
 #endif
 
-	typedef _Field Field;
-	typedef typename Field::Element   Element;
-        typedef DenseMatrix<_Field> Self_t;
-	typedef typename DenseMatrixBase<typename _Field::Element>::RawIterator RawIterator;
-	typedef typename DenseMatrixBase<typename _Field::Element>::ConstRawIterator ConstRawIterator;
-	typedef typename DenseMatrixBase<typename _Field::Element>::RawIndexedIterator RawIndexedIterator;
-	typedef typename DenseMatrixBase<typename _Field::Element>::ConstRawIndexedIterator ConstRawIndexedIterator;
-
-	DenseMatrix (const Field& F) :  _F(F) , _MD(F), _AT (*this) {}
-
-	/** Constructor of a m by n matrix with initial entries which are the 
-	 * default constructor value of the field's element type.
-	 * @param  F the field of entries; passed so that arithmetic may be done on elements. 
-	 * @param  m  row dimension
-	 * @param  n  column dimension
-	 */
-	DenseMatrix (const Field &F, size_t m, size_t n)
-		: DenseMatrixBase<Element> (m, n), _F (F), _MD (F), _AT (*this)
-	{}
-
-	/** Constructor of a m by n matrix with entries created by a random iterator.
-	 * @param  F the field of entries; passed so that arithmetic may be done on elements. 
-	 * @param  m  row dimension
-	 * @param  n  column dimension
-	 * @para iter, random iterator
-	 */
-	template<class RandIter>
-	DenseMatrix (const Field &F, size_t m, size_t n, const RandIter &iter)
-		: DenseMatrixBase<Element> (m, n), _F (F), _MD (F), _AT (*this)
-	{
-		for (typename std::vector<typename Field::Element>::iterator p = DenseMatrixBase<Element>::_rep.begin (); p != DenseMatrixBase<Element>::_rep.end (); ++p)
-			iter.random (*p);
-	}
-    
-	/** Constructor using a finite vector stream (stream of the rows).
-	 * @param  F The field of entries; passed so that arithmetic may be done
-	 *           on elements. 
-	 * @param  stream A vector stream to use as a source of vectors for this
-	 *                matrix
-	 */
-	template <class StreamVector>
-	DenseMatrix (const Field &F, VectorStream<StreamVector> &stream)
-		: DenseMatrixBase<Element> (stream.size (), stream.dim ()), _F (F), _MD (F), _AT (*this)
-	{
-		StreamVector tmp;
-		typename DenseMatrixBase<Element>::RowIterator p;
-
-		VectorWrapper::ensureDim (tmp, stream.dim ());
-
-		VectorDomain<Field> _VD(F);
-
-		for (p = DenseMatrixBase<Element>::rowBegin (); p != DenseMatrixBase<Element>::rowEnd (); ++p) {
-			stream >> tmp;
-			_VD.copy (*p, tmp);
+		typedef _Field Field;
+		typedef typename Field::Element   Element;
+		typedef DenseMatrix<_Field> Self_t;
+		typedef typename DenseMatrixBase<typename _Field::Element>::RawIterator RawIterator;
+		typedef typename DenseMatrixBase<typename _Field::Element>::ConstRawIterator ConstRawIterator;
+		typedef typename DenseMatrixBase<typename _Field::Element>::RawIndexedIterator RawIndexedIterator;
+		typedef typename DenseMatrixBase<typename _Field::Element>::ConstRawIndexedIterator ConstRawIndexedIterator;
+
+		DenseMatrix (const Field& F) :
+			_F(F) , _MD(F), _AT (*this)
+		{}
+
+		/** Constructor of a m by n matrix with initial entries which are the
+		 * default constructor value of the field's element type.
+		 * @param  F the field of entries; passed so that arithmetic may be done on elements.
+		 * @param  m  row dimension
+		 * @param  n  column dimension
+		 */
+		DenseMatrix (const Field &F, size_t m, size_t n) :
+			DenseMatrixBase<Element> (m, n), _F (F), _MD (F), _AT (*this)
+		{}
+
+		/** Constructor of a m by n matrix with entries created by a random iterator.
+		 * @param  F the field of entries; passed so that arithmetic may be done on elements.
+		 * @param  m  row dimension
+		 * @param  n  column dimension
+		 * @param iter random iterator
+		 */
+		template<class RandIter>
+		DenseMatrix (const Field &F, size_t m, size_t n, const RandIter &iter) :
+			DenseMatrixBase<Element> (m, n), _F (F), _MD (F), _AT (*this)
+		{
+			for (typename std::vector<typename Field::Element>::iterator p = DenseMatrixBase<Element>::_rep.begin (); p != DenseMatrixBase<Element>::_rep.end (); ++p)
+				iter.random (*p);
 		}
-	}
 
-	/** Constructor from a MatrixStream
-	 * @param ms A matrix stream properly initialized
-	 */
-	DenseMatrix( MatrixStream<Field>& ms )
-		:DenseMatrixBase<Element>(ms), _F( ms.getField() ), _MD( ms.getField() ), _AT(*this)
-	{ }
+		/** Constructor using a finite vector stream (stream of the rows).
+		 * @param  F The field of entries; passed so that arithmetic may be done
+		 *           on elements.
+		 * @param  stream A vector stream to use as a source of vectors for this
+		 *                matrix
+		 */
+		template <class StreamVector>
+		DenseMatrix (const Field &F, VectorStream<StreamVector> &stream) :
+			DenseMatrixBase<Element> (stream.size (), stream.dim ()), _F (F), _MD (F), _AT (*this)
+		{
+			StreamVector tmp;
+			typename DenseMatrixBase<Element>::RowIterator p;
+
+			VectorWrapper::ensureDim (tmp, stream.dim ());
+
+			VectorDomain<Field> _VD(F);
+
+			for (p = DenseMatrixBase<Element>::rowBegin (); p != DenseMatrixBase<Element>::rowEnd (); ++p) {
+				stream >> tmp;
+				_VD.copy (*p, tmp);
+			}
+		}
 
-	/** Constructor from a DenseMatrixBase. Copies all matrix data.
-	 * @param F Field over which this matrix' arithmetic will be.
-	 * @param M This will contain a complete copy of \ref{DenseMatrixBase} M.
-	 */
-	DenseMatrix (const Field &F, DenseMatrixBase<Element> &M)
-		: DenseMatrixBase<Element> (M), _F (F), _MD (F), _AT (*this)
-	{}
+		/** Constructor from a MatrixStream
+		 * @param ms A matrix stream properly initialized
+		 */
+		DenseMatrix( MatrixStream<Field>& ms ) :
+			DenseMatrixBase<Element>(ms), _F( ms.getField() ), _MD( ms.getField() ), _AT(*this)
+		{ }
+
+		/** Constructor from a DenseMatrixBase. Copies all matrix data.
+		 * @param F Field over which this matrix' arithmetic will be.
+		 * @param M This will contain a complete copy of \ref DenseMatrixBase M.
+		 */
+		DenseMatrix (const Field &F, DenseMatrixBase<Element> &M) :
+			DenseMatrixBase<Element> (M), _F (F), _MD (F), _AT (*this)
+		{}
+
+		/// Copies <i>all</i> matrix data.
+		DenseMatrix (const DenseMatrix &M) :
+			DenseMatrixBase<Element> (M), _F (M._F), _MD (M._F), _AT (*this)
+		{}
+
+
+		/** Assignment operator makes a complete copy.
+		*/
+		DenseMatrix<Field>& operator= (const DenseMatrix<Field>& M)
+		{
+			(*this)._rep  = M._rep;
+			(*this)._rows = M._rows;
+			(*this)._cols = M._cols;
+			(*this)._MD   = const_cast<MatrixDomain<Field>&>(M._MD);
+			(*this)._F    = const_cast<Field&>(M._F);
+			return (*this);
+		}
 
-	/// Copies {\it all} matrix data.
-	DenseMatrix (const DenseMatrix &M)
-		: DenseMatrixBase<Element> (M), _F (M._F), _MD (M._F), _AT (*this)
-	{}
 
-	/** Assignment operator makes a complete copy.
-	 */
-	DenseMatrix<Field>& operator= (const DenseMatrix<Field>& M) {
-		(*this)._rep  = M._rep;
-		(*this)._rows = M._rows;
-		(*this)._cols = M._cols;
-		(*this)._MD   = M._MD;
-		const_cast<Field&>((*this)._F)    = M._F;
-		return (*this);
-	}
-
-
-	template<typename _Tp1>
-	struct rebind
-	{ 
-		typedef DenseMatrix<_Tp1> other; 
-		
-		void operator() (other *& Ap, const Self_t& A, const _Tp1& F) {
-			Ap = new other(F, A.rowdim(), A.coldim());
-			typename Self_t::ConstRawIterator A_p;
-			typename other::RawIterator Ap_p;
-			Hom<Field, _Tp1> hom(A. field(), F);
-			for (A_p = A. rawBegin(), Ap_p = Ap -> rawBegin();
-			     A_p != A. rawEnd(); ++ A_p, ++ Ap_p) 
-				hom.image (*Ap_p, *A_p);
+		template<typename _Tp1>
+		struct rebind {
+			typedef DenseMatrix<_Tp1> other;
+
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F)
+			{
+				// 			Ap = new other(F, A.rowdim(), A.coldim());
+				typename Self_t::ConstRawIterator A_p;
+				typename other::RawIterator Ap_p;
+				Hom<Field, _Tp1> hom(A. field(), F);
+				for (A_p = A. rawBegin(), Ap_p = Ap.rawBegin();
+				     A_p != A. rawEnd(); ++ A_p, ++ Ap_p)
+					hom.image (*Ap_p, *A_p);
+			}
+		};
+
+		template<typename _Tp1>
+		DenseMatrix (const DenseMatrix<_Tp1> &M, const Field& F) :
+			DenseMatrixBase<Element> (M.rowdim(),M.coldim()), _F (F), _MD (F), _AT (*this)
+		{
+			typename DenseMatrix<_Tp1>::template rebind<Field>()(*this, M, F);
 		}
-	};
 
 
-	
-	/*- Get the number of rows in the matrix
-	 * @return Number of rows in matrix
-	 */
-	size_t rowdim () const
+
+		/*- Get the number of rows in the matrix
+		 * @return Number of rows in matrix
+		 */
+		size_t rowdim () const
 		{ return DenseMatrixBase<Element>::rowdim (); }
 
-	/*- Get the number of columns in the matrix
-	 * @return Number of columns in matrix
-	 */
-	size_t coldim () const
+		/*- Get the number of columns in the matrix
+		 * @return Number of columns in matrix
+		 */
+		size_t coldim () const
 		{ return DenseMatrixBase<Element>::coldim (); }
 
-	/** Retrieve the field over which this matrix is defined
-	 * @return Reference to the underlying field
-	 */
-	const Field &field () const
+		/** Retrieve the field over which this matrix is defined
+		 * @return Reference to the underlying field
+		 */
+		const Field &field () const
 		{ return _F;}
 
-	Field &field () 
+		Field &field ()
 		{ return _F;}
 
-	/*- @name Input and output
-	 */
+		/*- @name Input and output
+		*/
 
-	//@{
+		//@{
 
-	/** Read the matrix from an input stream
-	 * @param file Input stream from which to read
-	 */
-	std::istream& read (std::istream &is)
-	{ return DenseMatrixBase<Element>::read (is, _F); }
-    
-	/** Write the matrix to an output stream
-	 * @param os Output stream to which to write
-	 */
-	std::ostream &write (std::ostream &os = std::cout) const
-		{ return DenseMatrixBase<Element>::write (os, _F); }
- 
-	//@}
+		/** Read the matrix from an input stream.
+		 * @param is Input stream from which to read
+		 */
+		std::istream& read (std::istream &is)
+		{ return DenseMatrixBase<Element>::read (is, _F); }
 
+		/** Write the matrix to an output stream
+		 * @param os Output stream to which to write
+		 */
+		std::ostream &write (std::ostream &os = std::cout) const
+		{
+			return DenseMatrixBase<Element>::write (os, _F);
+		}
 
-	/*- @name Black box interface
-	 */
+		//@}
+
+
+		/*- @name Black box interface
+		*/
+
+		//@{
+
+		/** Generic matrix-vector apply.
+		 * \f$y = A \cdot  x\f$
+		 * This version of apply allows use of arbitrary input and output vector
+		 * types.
+		 * @param[out] y Output vector
+		 * @param[in] x Input vector
+		 * @return Reference to output vector
+		 */
+		template<class Vect1, class Vect2>
+		Vect1 &apply (Vect1 &y, const Vect2 &x) const;
+
+		/** Generic in-place apply.
+		 * \f$y = A \cdot y\f$.
+		 * This version of in-place apply allows use of an arbitrary vector
+		 * type. Because it performs allocation and copying, it is not
+		 * recommended for general use.
+		 * @param y Input vector
+		 * @return Reference to output vector
+		 */
+		template<class Vect1>
+		Vect1 &applyIn (Vect1 &y) const
+		{
+			std::vector<Element> x (y.begin (),y.end ());
+			apply (y,x);
+			return y;
+		}
 
-	//@{
+		/** Generic matrix-vector transpose apply.
+		 * \f$y = A^T \cdot  x\f$.
+		 * This version of applyTranspose allows use of arbitrary input and
+		 * output vector types
+		 * @param y Output vector
+		 * @param x Input vector
+		 * @return Reference to output vector
+		 */
+		template<class Vect1, class Vect2>
+		Vect1 &applyTranspose (Vect1 &y, const Vect2 &x) const;
+
+		/** Generic in-place transpose apply.
+		 * \f$y = A^T \cdot  y\f$.
+		 * This version of in-place transpose apply allows use of an arbitrary
+		 * vector type. Because it performs allocation and copying, it is not
+		 * recommended for general use.
+		 * @param y Input vector
+		 * @return Reference to output vector
+		 */
+		template<class Vect>
+		Vect &applyTransposeIn (Vect &y) const
+		{
+			std::vector<Element> x (y.begin (), y.end ());
+			applyTranspose (y, x);
+			return y;
+		}
 
-	/** Generic matrix-vector apply
-	 * y = A * x.
-	 * This version of apply allows use of arbitrary input and output vector
-	 * types.
-	 * @param y Output vector
-	 * @param x Input vector
-	 * @return Reference to output vector
-	 */
-	template<class Vect1, class Vect2>
-	Vect1 &apply (Vect1 &y, const Vect2 &x) const;
-
-	/** Generic in-place apply
-	 * y = A * y.
-	 * This version of in-place apply allows use of an arbitrary vector
-	 * type. Because it performs allocation and copying, it is not
-	 * recommended for general use.
-	 * @param y Input vector
-	 * @return Reference to output vector
-	 */
-	template<class Vect1>
-	Vect1 &applyIn (Vect1 &y) const
-	{
-		std::vector<Element> x (y.begin (),y.end ());
-		apply (y,x);
-		return y;
-	}
-
-	/** Generic matrix-vector transpose apply
-	 * y = A^T * x
-	 * This version of applyTranspose allows use of arbitrary input and
-	 * output vector types
-	 * @param y Output vector
-	 * @param x Input vector
-	 * @return Reference to output vector
-	 */
-	template<class Vect1, class Vect2>
-	Vect1 &applyTranspose (Vect1 &y, const Vect2 &x) const;
-    
-	/** Generic in-place transpose apply
-	 * y = A^T * y
-	 * This version of in-place transpose apply allows use of an arbitrary
-	 * vector type. Because it performs allocation and copying, it is not
-	 * recommended for general use.
-	 * @param y Input vector
-	 * @return Reference to output vector
-	 */
-	template<class Vect>
-	Vect &applyTransposeIn (Vect &y) const
-	{
-		std::vector<Element> x (y.begin (), y.end ());
-		applyTranspose (y, x);
-		return y;
-	}
-  
-    
-	// destructor
-	~DenseMatrix ( ) {
+
+		/// destructor
+		~DenseMatrix ( ) {
 
 #ifdef __LINBOX_PARALLEL
 
-                BB_list_list::iterator p;
+			BB_list_list::iterator p;
 
-                BB_list::iterator e_p;
+			BB_list::iterator e_p;
 
-                for (p = sub_list. begin(); p != sub_list. end(); ++ p)
+			for (p = sub_list. begin(); p != sub_list. end(); ++ p)
 
-                        for (e_p = p -> second. begin();
-                             e_p != p -> second. end(); ++ e_p) {
+				for (e_p = p -> second. begin();
+				     e_p != p -> second. end(); ++ e_p) {
 
-                                Thread::terminate_thread (*e_p);
+					Thread::terminate_thread (*e_p);
 
-                                delete (*e_p);
-                          }
+					delete (*e_p);
+				}
 
 #endif
-	}
+		}
 
-	//@}
+		//@}
 
-    protected:
+	protected:
 
-	//const Field          _F;
-	Field          _F;
-	MatrixDomain<Field>   _MD;
-	TransposeMatrix<DenseMatrix<Field> > _AT;
-};
+		//const Field          _F;
+		Field          _F;
+		MatrixDomain<Field>   _MD;
+		TransposeMatrix<DenseMatrix<Field> > _AT;
+	};
 
-template <class Field>
-struct MatrixTraits< DenseMatrix<Field> >
-{
-	typedef DenseMatrix<Field> MatrixType;
-	typedef typename MatrixCategories::RowMatrixTag MatrixCategory;
-};
+	template <class Field>
+	struct MatrixTraits< DenseMatrix<Field> >
+	{
+		typedef DenseMatrix<Field> MatrixType;
+		typedef typename MatrixCategories::RowMatrixTag MatrixCategory;
+	};
 
-template <class Field>
-struct MatrixTraits< const DenseMatrix<Field> >
-{
-	typedef const DenseMatrix<Field> MatrixType;
-	typedef typename MatrixCategories::RowMatrixTag MatrixCategory;
-};
-
-/** Dense matrix factory
-  * This class ingerits \ref{BlackboxFactory} and provides a method for using a
-  * \ref{DenseMatrixBase} object with integer or rational data type as input to
-  * the high-level intger and rational solutions functions.
-  */
-
-template< class Field, class BElement >
-class DenseMatrixFactory : public BlackboxFactory<Field,DenseMatrix<Field> >
-{
-    private:
-    	const DenseMatrixBase<BElement>& _A;
+	template <class Field>
+	struct MatrixTraits< const DenseMatrix<Field> > {
+		typedef const DenseMatrix<Field> MatrixType;
+		typedef typename MatrixCategories::RowMatrixTag MatrixCategory;
+	};
+
+	/** Dense matrix factory.
+	 * This class inherits \ref BlackboxFactory and provides a method for using a
+	 * \ref DenseMatrixBase object with integer or rational data type as input to
+	 * the high-level intger and rational solutions functions.
+	 */
 
-    public:
-    	DenseMatrixFactory( const DenseMatrixBase<BElement> &A ) :_A(A) {}
+	template< class Field, class BElement >
+	class DenseMatrixFactory : public BlackboxFactory<Field,DenseMatrix<Field> > {
+	private:
+		const DenseMatrixBase<BElement>& _A;
 
-	DenseMatrix<Field>* makeBlackbox( const Field& F );
+	public:
+		DenseMatrixFactory( const DenseMatrixBase<BElement> &A ) :
+			_A(A)
+		{}
 
-	integer& maxNorm( integer& res );
+		DenseMatrix<Field>* makeBlackbox( const Field& F );
 
-	integer& hadamardBound( integer& res ) const;
+		integer& maxNorm( integer& res );
 
-	size_t rowdim() { return _A.rowdim(); }
-	size_t coldim() { return _A.coldim(); }
-};
+		integer& hadamardBound( integer& res ) const;
+
+		size_t rowdim() { return _A.rowdim(); }
+		size_t coldim() { return _A.coldim(); }
+	};
 
 }
 
 #include "dense.inl"
 
-#endif // __BLACKBOX_DENSE_H
+#endif // __LINBOX_blackbox_dense_H
+
diff --git a/linbox/blackbox/dense.inl b/linbox/blackbox/dense.inl
index 7965de7..62edcb6 100644
--- a/linbox/blackbox/dense.inl
+++ b/linbox/blackbox/dense.inl
@@ -1,12 +1,12 @@
 /* -*- 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
 /* linbox/blackbox/dense.inl
- * Copyright (C) 2001 B. David Saunders, 
- *               2001-2002 Bradford Hovinen, 
+ * Copyright (C) 2001 B. David Saunders,
+ *               2001-2002 Bradford Hovinen,
  *               2002 Zhendong Wan
  *
- * Written by B. David Saunders <saunders at cis.udel.edu>, 
- *            Bradford Hovinen <hovinen at cis.udel.edu>, 
+ * Written by B. David Saunders <saunders at cis.udel.edu>,
+ *            Bradford Hovinen <hovinen at cis.udel.edu>,
  *            Zhendong Wan <wan at mail.eecis.udel.edu>
  *
  * evolved from dense-matrix.h by -bds, Zhendong Wan
@@ -24,8 +24,8 @@
  * See COPYING for license information
  */
 
-#ifndef __BLACKBOX_DENSE_INL
-#define __BLACKBOX_DENSE_INL
+#ifndef __LINBOX_blackbox_dense_INL
+#define __LINBOX_blackbox_dense_INL
 
 #include <iostream>
 #include <vector>
@@ -37,86 +37,91 @@
 namespace LinBox
 {
 
-template <class Field>
-template<class Vect1, class Vect2>
-Vect1& DenseMatrix<Field>::apply (Vect1& y, const Vect2& x) const {
+	template <class Field>
+	template<class Vect1, class Vect2>
+	Vect1& DenseMatrix<Field>::apply (Vect1& y, const Vect2& x) const
+	{
 
 #ifdef __LINBOX_PARALLEL
 
-	return BlackboxParallel (y, *this, x, BBBase::Apply);
+		return BlackboxParallel (y, *this, x, BBBase::Apply);
 #else
 
-	_MD. vectorMul (y, *this, x);
+		_MD. vectorMul (y, *this, x);
 
 #endif
-	return y;
-}
+		return y;
+	}
+
 
- 
-template <class Field>
-template<class Vect1, class Vect2>
-Vect1& DenseMatrix<Field>::applyTranspose (Vect1& y, const Vect2& x) const {
+	template <class Field>
+	template<class Vect1, class Vect2>
+	Vect1& DenseMatrix<Field>::applyTranspose (Vect1& y, const Vect2& x) const
+	{
 
 #ifdef __LINBOX_PARALLEL
 
-        return BlackboxParallel (y, *this, x, BBBase::ApplyTranspose);
+		return BlackboxParallel (y, *this, x, BBBase::ApplyTranspose);
 #else
 
-	return _MD.vectorMul (y, _AT, x);
+		return _MD.vectorMul (y, _AT, x);
 #endif
-	    
-}
 
-template< class Field, class BElement >
-DenseMatrix<Field>*
+	}
+
+	template< class Field, class BElement >
+	DenseMatrix<Field>*
 	DenseMatrixFactory<Field,BElement>::makeBlackbox( const Field& F )
-{
-	DenseMatrixBase<typename Field::Element> newBase ( rowdim(), coldim() );
-	
-	typename DenseMatrixBase<BElement>::ConstRawIterator i;
-	typename DenseMatrixBase<typename Field::Element>::RawIterator j;
-
-	for( i = _A.rawBegin(), j = newBase.rawBegin();
-	     i != _A.rawEnd(), j != newBase.rawEnd();
-	     ++i, ++j )
-		F.init( *j, *i );
-
-	return new DenseMatrix<Field>( F, newBase );
-}
-
-template< class Field, class BElement >
-integer& DenseMatrixFactory<Field,BElement>::maxNorm( integer& res ) {
-	typename DenseMatrixBase<BElement>::ConstRawIterator i;
-	res = 0L;
-	integer tmp;
-	
-	for( i = _A.rawBegin(); i != _A.rawEnd(); ++i ) {
-		tmp = abs( *i );
-		if( res < tmp ) res = tmp;
+	{
+		DenseMatrixBase<typename Field::Element> newBase ( rowdim(), coldim() );
+
+		typename DenseMatrixBase<BElement>::ConstRawIterator i;
+		typename DenseMatrixBase<typename Field::Element>::RawIterator j;
+
+		for( i = _A.rawBegin(), j = newBase.rawBegin();
+		     i != _A.rawEnd(), j != newBase.rawEnd();
+		     ++i, ++j )
+			F.init( *j, *i );
+
+		return new DenseMatrix<Field>( F, newBase );
 	}
 
-	return res;
-}
-
-template< class Field, class BElement >
-integer& DenseMatrixFactory<Field,BElement>::hadamardBound(integer& res) const {
-	typename DenseMatrixBase<BElement>::ConstRowIterator r;
-	typename DenseMatrixBase<BElement>::ConstRow::const_iterator c;
-
-	res = 1L;
-	integer temp;
-	
-	for( r = _A.rowBegin(); r != _A.rowEnd(); ++r ) {
-		temp = 0;
-		for( c = r->begin(); c != r->end(); ++c )
-			temp += static_cast<integer>((*c)) * (*c);
-		res *= temp;
+	template< class Field, class BElement >
+	integer& DenseMatrixFactory<Field,BElement>::maxNorm( integer& res )
+	{
+		typename DenseMatrixBase<BElement>::ConstRawIterator i;
+		res = 0L;
+		integer tmp;
+
+		for( i = _A.rawBegin(); i != _A.rawEnd(); ++i ) {
+			tmp = abs( *i );
+			if( res < tmp ) res = tmp;
+		}
+
+		return res;
+	}
+
+	template< class Field, class BElement >
+	integer& DenseMatrixFactory<Field,BElement>::hadamardBound(integer& res) const
+	{
+		typename DenseMatrixBase<BElement>::ConstRowIterator r;
+		typename DenseMatrixBase<BElement>::ConstRow::const_iterator c;
+
+		res = 1L;
+		integer temp;
+
+		for( r = _A.rowBegin(); r != _A.rowEnd(); ++r ) {
+			temp = 0;
+			for( c = r->begin(); c != r->end(); ++c )
+				temp += static_cast<integer>((*c)) * (*c);
+			res *= temp;
+		}
+
+		res = sqrt(res);
+		return res;
 	}
 
-	res = sqrt(res);
-	return res;
-}
-  
 } // namespace LinBox
 
-#endif // __BLACKBOX_DENSE_INL
+#endif // __LINBOX_blackbox_dense_INL
+
diff --git a/linbox/blackbox/diagonal.h b/linbox/blackbox/diagonal.h
index a1d8b13..b9c3860 100644
--- a/linbox/blackbox/diagonal.h
+++ b/linbox/blackbox/diagonal.h
@@ -1,5 +1,5 @@
-/* -*- mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-
+/* -*- 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
 /* linbox/blackbox/diagonal.h
  * Copyright (C) 1999-2001 William J Turner,
  *               2001 Bradford Hovinen
@@ -10,15 +10,22 @@
  * ------------------------------------
  * Modified by Dmitriy Morozov <linbox at foxcub.org>. May 28, 2002.
  *
- * Added parametrization of VectorCategory tags by VectorTraits. See 
+ * Added parametrization of VectorCategory tags by VectorTraits. See
  * vector-traits.h for more details.
- * 
+ *
  * ------------------------------------
  *
  * See COPYING for license information.
  */
-#ifndef __DIAGONAL_H
-#define __DIAGONAL_H
+
+/*! @file blackbox/diagonal.h
+ * @ingroup blackbox
+ * @brief Random diagonal matrices and diagonal matrices
+ * Class especially meant for diagonal precondtionners
+ */
+
+#ifndef __LINBOX_diagonal_H
+#define __LINBOX_diagonal_H
 
 #include <vector>
 #include "linbox/vector/vector-traits.h"
@@ -30,58 +37,53 @@
 namespace LinBox
 {
 
-	/** 
+	/**
 	 * \brief Random diagonal matrices are used heavily as preconditioners.
-
-	 * This is a class of n by n diagonal matrices templatized by the 
-	 * field in 
-	 * which the elements reside.  The class conforms to the 
-	 * BlackboxArchetype.
+	 * \ingroup blackbox
+	 * This is a class of \f$n \times n\f$ diagonal matrices templatized by
+	 * the field in which the elements reside.  The class conforms to the
+	 * \ref BlackboxArchetype.
 	 *
-	 * The matrix itself is not stored in memory.  Rather, its <tt>apply</tt>
-	 * methods use a vector of field elements, which are 
-	 * used to "multiply" the matrix to a vector.
-	 * 
-	 * This class has two template parameters.  The first is the field in 
-	 * which the arithmetic is to be done.  
-	 * The second is the vector trait indicating dense or 
-	 * sparse vector interface (dense by default).
+	 * The matrix itself is not stored in memory.  Rather, its \c apply
+	 * methods use a vector of field elements, which are used to "multiply"
+	 * the matrix to a vector.
+	 *
+	 * This class has two template parameters.  The first is the field in
+	 * which the arithmetic is to be done.  The second is the vector trait
+	 * indicating dense or sparse vector interface (dense by default).
 	 * This class is then specialized for dense and sparse vectors.
-	 * 
+	 *
 	 * The default class is not implemented.  It's functions should never
 	 * be called because partial template specialization should always be
 	 * done on the vector traits.
-	 * \ingroup blackbox
-	 * @param Field \ref LinBox field
-	 * @param Trait  Marker whether to use dense or sparse LinBox vector 
-	 *               implementation.  This is chosen by a default parameter 
-	 *               and partial template specialization.
-	 */
-	template <class Field,
-		  class Trait = typename VectorTraits<typename LinBox::Vector<Field>::Dense>::VectorCategory>
-	class Diagonal
-	{
-	    private:
-		Diagonal () {}
-	};
-	
- 
-	/** diagonal.h linbox/blackbox/diagonal.h 
-	\brief Specialization of Diagonal for application to dense vectors
+	 *
+	 *
+	 * @param Field  \c LinBox field.
+	 * @param Trait  Marker whether to use dense or sparse  LinBox vector
+	 * implementation. This is chosen by a default parameter
+	 * and partial template specialization.
 	 */
+	template<class Field, class Trait = typename VectorTraits<typename
+	LinBox::Vector<Field>::Dense>::VectorCategory > class Diagonal {
+	private:
+		/// empty constructor
+		Diagonal () {} };
+
+	/**
+	  \brief Specialization of Diagonal for application to dense vectors
+	  */
 	template <class _Field>
-	class Diagonal<_Field, VectorCategories::DenseVectorTag>
-	{
-            typedef Diagonal<_Field, VectorCategories::DenseVectorTag> Self_t;
-	    public:
+	class Diagonal<_Field, VectorCategories::DenseVectorTag> {
+		typedef Diagonal<_Field, VectorCategories::DenseVectorTag> Self_t;
+	public:
 
 		typedef _Field Field;
 		typedef typename Field::Element    Element;
 
-		/// \brief cstor from vector of elements
+		/// \brief cstor from vector of elements.
 		Diagonal(const Field F, const std::vector<typename Field::Element>& v);
 
-        // construct random nonsingular n by n diagonal matrix.
+		// construct random nonsingular n by n diagonal matrix.
 		Diagonal(const Field F, const size_t n, bool nonsing=true);
 
 		Diagonal(const Field F, const size_t n, typename Field::RandIter& iter);
@@ -92,9 +94,9 @@ namespace LinBox
 		template <class OutVector, class InVector>
 		OutVector &applyTranspose (OutVector &y, const InVector &x) const { return apply (y, x); }
 
-		size_t rowdim(void) const { return _n; } 
+		size_t rowdim(void) const { return _n; }
 
-		size_t coldim(void) const { return _n; } 
+		size_t coldim(void) const { return _n; }
 
 		void random();
 		void randomNonsingular();
@@ -102,46 +104,57 @@ namespace LinBox
 		/// \brief the field of the entries
 		const Field& field() const{ return _F; }
 
-                /** Get an entry and store it in the given value
-                 * This form is more in the Linbox style and is provided for interface
-                 * compatibility with other parts of the library
-                 * @param x Element in which to store result
-                 * @param i Row index
-                 * @param j Column index
-                 * @return Reference to x
-                 */
-            Element &getEntry (Element &x, size_t i, size_t j) const {
-                return (i==j?_F.assign(x,_v[i]):_F.init(x,0));
-            }
-                    
-
-            template<typename _Tp1>
-            struct rebind
-            { typedef Diagonal<_Tp1, VectorCategories::DenseVectorTag> other; 
-
-                void operator() (other *& Ap, const Self_t& A, const _Tp1& F) 
-                    {
-                        
-                        std::vector<typename _Tp1::Element> nv(A._v.size());
-                        Hom<typename Self_t::Field, _Tp1> hom(A.field(), F);
-
-                        typename std::vector<typename _Tp1::Element>::iterator nit = nv.begin();
-                        typename std::vector<Element>::const_iterator oit = A._v.begin();
-                        for( ; nit != nv.end() ; ++nit, ++oit)
-                            hom.image (*nit, *oit);
-                        Ap = new other(F, nv);
-                    }
- 
-            };
-
-		std::ostream& write(std::ostream& out)
-		{	out << "diag(";
-		 	for (typename std::vector<Element>::iterator p = _v.begin(); p != _v.end(); ++p)
+		/** Get an entry and store it in the given value.
+		 * This form is more in the LinBox style and is provided for interface
+		 * compatibility with other parts of the library
+		 * @param x Element in which to store result
+		 * @param i Row index
+		 * @param j Column index
+		 * @return Reference to x
+		 */
+		Element &getEntry (Element &x, size_t i, size_t j) const {
+			return (i==j?_F.assign(x,_v[i]):_F.init(x,0));
+		}
+
+
+		template<typename _Tp1>
+		struct rebind {
+			typedef Diagonal<_Tp1, VectorCategories::DenseVectorTag> other;
+
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F)
+			{
+
+				Hom<typename Self_t::Field, _Tp1> hom(A.field(), F);
+
+				typename std::vector<typename _Tp1::Element>::iterator nit = Ap.getData().begin();
+				typename std::vector<Element>::const_iterator oit = A.getData().begin();
+				for( ; oit != A.getData().end() ; ++nit, ++oit)
+					hom.image (*nit, *oit);
+			}
+
+		};
+
+		template<typename _Tp1, typename _Vc1>
+		Diagonal(const Diagonal<_Tp1,_Vc1>& D, const Field& F) :
+			_F(F), _n(D.rowdim()), _v(D.rowdim())
+		{
+			typename Diagonal<_Tp1,_Vc1>::template rebind<Field>() (*this, D, F);
+		}
+
+
+
+
+		std::ostream& write(std::ostream& out) {
+			out << "diag(";
+			for (typename std::vector<Element>::iterator p = _v.begin(); p != _v.end(); ++p)
 				_F.write(out, *p) << ", ";
 			return out << "\b\b)";
 		}
 
-	    private:
+		const std::vector<Element>& getData() const { return _v; }
+		std::vector<Element>& getData() { return _v; }
+
+	private:
 
 		// Field for arithmetic
 		Field _F;
@@ -151,69 +164,79 @@ namespace LinBox
 
 		// STL vector of field elements used in applying matrix.
 		std::vector<Element> _v;
-    
+
 	}; // template <Field, Vector> class Diagonal<DenseVectorTag>
-   
+
 	// Specialization of diagonal for LinBox sparse sequence vectors
-	/** 
-	\brief Specialization of Diagonal for application to sparse sequence vectors
-	 */
-	template <class Field>
-	class Diagonal<Field, VectorCategories::SparseSequenceVectorTag >
-	{
-            typedef Diagonal<Field, VectorCategories::SparseSequenceVectorTag > Self_t;
-	    public:
+	/**
+	  \brief Specialization of Diagonal for application to sparse sequence vectors
+	  */
+	template <class _Field>
+	class Diagonal<_Field, VectorCategories::SparseSequenceVectorTag > {
+		typedef Diagonal<_Field, VectorCategories::SparseSequenceVectorTag > Self_t;
+	public:
 
+		typedef _Field Field;
 		typedef typename Field::Element    Element;
 
 		Diagonal(const Field F, const std::vector<typename Field::Element>& v);
 
 		Diagonal(const Field F, const size_t n, typename Field::RandIter& iter);
-		
+
 		template<class OutVector, class InVector>
 		OutVector& apply(OutVector& y, const InVector& x) const;
 
 		template<class OutVector, class InVector>
 		OutVector& applyTranspose(OutVector& y, const InVector& x) const { return apply(y, x); }
 
-		size_t rowdim(void) const { return _n; } 
-		size_t coldim(void) const { return _n; } 
+		size_t rowdim(void) const { return _n; }
+		size_t coldim(void) const { return _n; }
 		const Field& field() const {return _F;}
-                /** Get an entry and store it in the given value
-                 * This form is more in the Linbox style and is provided for interface
-                 * compatibility with other parts of the library
-                 * @param x Element in which to store result
-                 * @param i Row index
-                 * @param j Column index
-                 * @return Reference to x
-                 */
-            Element &getEntry (Element &x, size_t i, size_t j) const {
-                return (i==j?_F.assign(x,_v[i]):_F.init(x));
-            }
-                    
-
-
-            template<typename _Tp1>
-            struct rebind
-            { typedef Diagonal<_Tp1, VectorCategories::SparseSequenceVectorTag> other; 
-                void operator() (other *& Ap, const Self_t& A, const _Tp1& F) 
-                    {
-                        
-                        std::vector<typename _Tp1::Element> nv(A._v.size());
-                        Hom<typename Self_t::Field, _Tp1> hom(A.field(), F);
-
-                        typename std::vector<typename _Tp1::Element>::iterator nit = nv.begin();
-                        typename std::vector<Element>::const_iterator oit = A._v.begin();
-                        for( ; nit != nv.end() ; ++nit, ++oit)
-                            hom.image (*nit, *oit);
-                        Ap = new other(F, nv);
-                    }
- 
-            };
-
-
-
-	    private:
+		/** Get an entry and store it in the given value.
+		 * This form is more in the LinBox style and is provided for interface
+		 * compatibility with other parts of the library
+		 * @param x Element in which to store result
+		 * @param i Row index
+		 * @param j Column index
+		 * @return Reference to x
+		 */
+		Element &getEntry (Element &x, size_t i, size_t j) const
+		{
+			return (i==j?_F.assign(x,_v[i]):_F.init(x));
+		}
+
+
+
+		template<typename _Tp1>
+		struct rebind {
+			typedef Diagonal<_Tp1, VectorCategories::SparseSequenceVectorTag> other;
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F)
+			{
+
+				Hom<typename Self_t::Field, _Tp1> hom(A.field(), F);
+
+				typename std::vector<typename _Tp1::Element>::iterator nit = Ap.getData().begin();
+				typename std::vector<Element>::const_iterator oit = A.getData().begin();
+				for( ; oit != A.getData().end() ; ++nit, ++oit)
+					hom.image (*nit, *oit);
+			}
+
+		};
+
+		template<typename _Tp1, typename _Vc1>
+		Diagonal(const Diagonal<_Tp1,_Vc1>& D, const Field& F) :
+			_F(F), _n(D.rowdim()), _v(D.rowdim())
+		{
+			typename Diagonal<_Tp1,_Vc1>::template rebind<Field>() (*this, D, F);
+		}
+
+
+
+		const std::vector<Element>& getData() const { return _v; }
+		std::vector<Element>& getData() { return _v; }
+
+
+	private:
 
 		// Field for arithmetic
 		Field _F;
@@ -223,20 +246,20 @@ namespace LinBox
 
 		// STL vector of field elements used in applying matrix.
 		std::vector<Element> _v;
-    
+
 	}; // template <Field, Vector> class Diagonal<SparseSequenceVectorTag>
 
 	// Specialization of diagonal for LinBox sparse associative vectors
-	/** 
-	\brief Specialization of Diagonal for application to sparse associative vectors
-	 */
-	template <class Field>
-	class Diagonal<Field, VectorCategories::SparseAssociativeVectorTag >
-	{
-            typedef Diagonal<Field, VectorCategories::SparseAssociativeVectorTag > Self_t;
-	    public:
+	/**
+	  \brief Specialization of Diagonal for application to sparse associative vectors.
+	  */
+	template <class _Field>
+	class Diagonal<_Field, VectorCategories::SparseAssociativeVectorTag > {
+		typedef Diagonal<_Field, VectorCategories::SparseAssociativeVectorTag > Self_t;
+	public:
 
 
+		typedef _Field Field;
 		typedef typename Field::Element    Element;
 
 		Diagonal(const Field F, const std::vector<typename Field::Element>& v);
@@ -247,46 +270,56 @@ namespace LinBox
 		OutVector& apply(OutVector& y, const InVector& x) const;
 
 		template<class OutVector, class InVector>
-		OutVector& applyTranspose(OutVector& y, const InVector& x) const { return apply(y, x); } 
+		OutVector& applyTranspose(OutVector& y, const InVector& x) const { return apply(y, x); }
 
 
-		size_t rowdim(void) const { return _n; } 
-		size_t coldim(void) const { return _n; } 
+		size_t rowdim(void) const { return _n; }
+		size_t coldim(void) const { return _n; }
 		const Field field() const { return _F; }
-                /** Get an entry and store it in the given value
-                 * This form is more in the Linbox style and is provided for interface
-                 * compatibility with other parts of the library
-                 * @param x Element in which to store result
-                 * @param i Row index
-                 * @param j Column index
-                 * @return Reference to x
-                 */
-            Element &getEntry (Element &x, size_t i, size_t j) const {
-                return (i==j?_F.assign(x,_v[i]):_F.init(x));
-            }
-                    
-
-
-            template<typename _Tp1>
-            struct rebind
-            { typedef Diagonal<_Tp1, VectorCategories::SparseAssociativeVectorTag> other; 
-                void operator() (other *& Ap, const Self_t& A, const _Tp1& F) 
-                    {
-                        
-                        std::vector<typename _Tp1::Element> nv(A._v.size());
-                        Hom<typename Self_t::Field, _Tp1> hom(A.field(), F);
-
-                        typename std::vector<typename _Tp1::Element>::iterator nit = nv.begin();
-                        typename std::vector<Element>::const_iterator oit = A._v.begin();
-                        for( ; nit != nv.end() ; ++nit, ++oit)
-                            hom.image (*nit, *oit);
-                        Ap = new other(F, nv);
-                    }
- 
-            };
-
-
-	    private:
+
+		/** Get an entry and store it in the given value.
+		 * This form is more in the LinBox style and is provided for interface
+		 * compatibility with other parts of the library
+		 * @param x Element in which to store result
+		 * @param i Row index
+		 * @param j Column index
+		 * @return Reference to x
+		 */
+		Element &getEntry (Element &x, size_t i, size_t j) const
+		{
+			return (i==j?_F.assign(x,_v[i]):_F.init(x));
+		}
+
+
+
+		template<typename _Tp1>
+		struct rebind {
+		       	typedef Diagonal<_Tp1, VectorCategories::SparseAssociativeVectorTag> other;
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F)
+			{
+				Hom<typename Self_t::Field, _Tp1> hom(A.field(), F);
+
+				typename std::vector<typename _Tp1::Element>::iterator nit = Ap.getData().begin();
+				typename std::vector<Element>::const_iterator oit = A.getData().begin();
+				for( ; oit != A.getData().end() ; ++nit, ++oit)
+					hom.image (*nit, *oit);
+			}
+
+		};
+
+		template<typename _Tp1, typename _Vc1>
+		Diagonal(const Diagonal<_Tp1,_Vc1>& D, const Field& F) :
+			_F(F), _n(D.rowdim()), _v(D.rowdim())
+		{
+			typename Diagonal<_Tp1,_Vc1>::template rebind<Field>() (*this, D, F);
+		}
+
+		const std::vector<Element>& getData() const { return _v; }
+		std::vector<Element>& getData() { return _v; }
+
+
+
+	private:
 
 		// Field for arithmetic
 		Field _F;
@@ -296,76 +329,89 @@ namespace LinBox
 
 		// STL vector of field elements used in applying matrix.
 		std::vector<Element> _v;
-    
-	}; // template <Field, Vector> class Diagonal<SparseAssociativeVectorTag>
 
+	}; // template <Field, Vector> class Diagonal<SparseAssociativeVectorTag>
 
 	// Method implementations for dense vectors
- 
+	/// constructor from vector
 	template <class Field>
-	inline Diagonal<Field, VectorCategories::DenseVectorTag >
-		::Diagonal(const Field F, const std::vector<typename Field::Element>& v)
-		: _F(F), _n(v.size()), _v(v)
+	inline Diagonal<Field, VectorCategories::DenseVectorTag >::Diagonal(const Field F,
+									    const std::vector<typename Field::Element>& v) :
+		_F(F), _n(v.size()), _v(v)
 	{}
 
 
+	/*!
+	 * random Diagonal matrix.
+	 * @param F the field
+	 * @param n size
+	 * @param nonsing non-singular matrix ? (no zero on diagonal ?)
+	 */
 	template <class _Field>
-	inline Diagonal<_Field, VectorCategories::DenseVectorTag>
-		::Diagonal(const Field F, const size_t n, bool nonsing)
-	: _F(F), _n(n), _v(n)
-	{   typename Field::RandIter r(F);
+	inline Diagonal<_Field, VectorCategories::DenseVectorTag>::Diagonal(const Field F,
+									    const size_t n,
+									    bool nonsing) :
+		_F(F), _n(n), _v(n)
+	{
+		typename Field::RandIter r(F);
 		typedef typename std::vector<typename Field::Element>::iterator iter;
 		if (nonsing)
-		randomNonsingular();
-		//for (iter i = _v.begin(); i < _v.end(); ++i) 
-		//	while (_F.isZero(r.random(*i)));
+			randomNonsingular();
 		else
-		random();
-		//for (iter i = _v.begin(); i < _v.end(); ++i) 
-		//	r.random(*i);
+			random();
 	}
 
-
+	//! random diagonal matrix of size n
 	template <class Field>
-	inline Diagonal<Field, VectorCategories::DenseVectorTag >
-		::Diagonal(const Field F, const size_t n, typename Field::RandIter& iter)
-		: _F(F), _n(n), _v(n)
-	{	//for (typename std::vector<typename Field::Element>::iterator 
-		//		i = _v.begin(); i != _v.end(); ++i) 
-		//	iter.random(*i); 
+	inline Diagonal<Field, VectorCategories::DenseVectorTag >::Diagonal(const Field F,
+									    const size_t n,
+									    typename Field::RandIter& iter) :
+		_F(F), _n(n), _v(n)
+	{
+#if 0
+		for (typename std::vector<typename Field::Element>::iterator
+		     i = _v.begin(); i != _v.end(); ++i)
+			iter.random(*i);
+#endif
 		random();
 	}
 
+	/// creates a random Diagonal matrix
 	template <class _Field>
-	inline void Diagonal<_Field, VectorCategories::DenseVectorTag>
-		::random()
-	{   typename Field::RandIter r(_F);
+	inline void Diagonal<_Field, VectorCategories::DenseVectorTag>::random()
+	{
+		typename Field::RandIter r(_F);
 		typedef typename std::vector<typename Field::Element>::iterator iter;
-		for (iter i = _v.begin(); i < _v.end(); ++i) 
+		for (iter i = _v.begin(); i < _v.end(); ++i)
 			r.random(*i);
 	}
 
+	/// creates a random non singular Diagonal matrix
 	template <class _Field>
-	inline void Diagonal<_Field, VectorCategories::DenseVectorTag>
-		::randomNonsingular()
-	{   typename Field::RandIter r(_F);
+	inline void Diagonal<_Field, VectorCategories::DenseVectorTag>::randomNonsingular()
+	{
+		typename Field::RandIter r(_F);
 		typedef typename std::vector<typename Field::Element>::iterator iter;
-		for (iter i = _v.begin(); i < _v.end(); ++i) 
-			while (_F.isZero(r.random(*i)));
+		for (iter i = _v.begin(); i < _v.end(); ++i)
+			while (_F.isZero(r.random(*i))) ;
 	}
 
+	/*! generic apply.
+	 * @param y output
+	 * @param x input vector
+	 */
 	template <class Field>
 	template <class OutVector, class InVector>
-	inline OutVector &Diagonal<Field, VectorCategories::DenseVectorTag >
-		::apply (OutVector &y, const InVector &x) const
+	inline OutVector &Diagonal<Field, VectorCategories::DenseVectorTag >::apply (OutVector &y,
+										     const InVector &x) const
 	{
 		linbox_check (_n == x.size ());
- 
+
 		// Create iterators for input, output, and stored vectors
 		typename std::vector<Element>::const_iterator v_iter;
 		typename InVector::const_iterator x_iter;
 		typename OutVector::iterator y_iter;
- 
+
 		// Start at beginning of _v and x vectors
 		v_iter = _v.begin ();
 		x_iter = x.begin ();
@@ -376,22 +422,29 @@ namespace LinBox
 		     y_iter != y.end ();
 		     y_iter++, v_iter++, x_iter++)
 			_F.mul (*y_iter, *v_iter, *x_iter);
- 
+
 		return y;
 	} // Vector& Diagonal<DenseVectorTag>::apply(Vector& y, const Vector&) const
-  
+
 	// Method implementations for sparse sequence vectors
- 
+	/*! Constructor for sparse sequence vectors.
+	 * This is the same constructor as the dense one.
+	 * @param F  field
+	 * @param v  vector
+	 */
 	template <class Field>
-	inline Diagonal<Field, VectorCategories::SparseSequenceVectorTag >
-		::Diagonal(const Field F, const std::vector<typename Field::Element>& v)
-		: _F(F), _n(v.size()), _v(v)
+	inline Diagonal<Field, VectorCategories::SparseSequenceVectorTag >::Diagonal(const Field F,
+										     const std::vector<typename Field::Element>& v) :
+		_F(F), _n(v.size()), _v(v)
 	{}
 
+	/** apply for sparse sequence vectors.
+	 * @param x sparse vector
+	 * @param[out] y sparse vector.
+	 */
 	template <class Field>
 	template<class OutVector, class InVector>
-	inline OutVector &Diagonal<Field, VectorCategories::SparseSequenceVectorTag >
-		::apply(OutVector& y, const InVector& x) const
+	inline OutVector &Diagonal<Field, VectorCategories::SparseSequenceVectorTag >::apply(OutVector& y, const InVector& x) const
 	{
 		linbox_check ((!x.empty ()) && (_n >= x.back ().first));
 
@@ -406,10 +459,10 @@ namespace LinBox
 		// Create iterators for input and stored vectors
 		typename std::vector<Element>::const_iterator v_iter;
 		typename InVector::const_iterator x_iter;
- 
+
 		// Start at beginning of _v vector
 		v_iter = _v.begin ();
- 
+
 		// Iterator over indices of input vector.
 		// For each element, multiply input element with corresponding element
 		// of stored vector and insert non-zero elements into output vector
@@ -417,23 +470,29 @@ namespace LinBox
 			i = (*x_iter).first;
 			_F.mul (entry, *(v_iter + i), (*x_iter).second);
 			if (!_F.isZero (entry)) y.push_back ( std::pair<size_t, Element>(i, entry));
-		} // for (x_iter = x.begin (); x_iter != x.end (); x_iter++)
+		}
 
 		return y;
 	} // Vector& Diagonal<SparseSequenceVectorTag>::apply(Vector& y, const Vector&) const
 
 	// Method implementations for sparse associative vectors
- 
+	/*! Constructor for sparse associative vectors.
+	 * This is the same constructor as the dense one.
+	 * @param F  field
+	 * @param v  vector
+	 */
 	template <class Field>
-	inline Diagonal<Field, VectorCategories::SparseAssociativeVectorTag >
-		::Diagonal(const Field F, const std::vector<typename Field::Element>& v)
-		: _F(F), _n(v.size()), _v(v)
+	inline Diagonal<Field, VectorCategories::SparseAssociativeVectorTag >::Diagonal(const Field F, const std::vector<typename Field::Element>& v) :
+		_F(F), _n(v.size()), _v(v)
 	{}
 
+	/** apply for sparse associative vectors.
+	 * @param x sparse vector
+	 * @param[out] y sparse vector.
+	 */
 	template <class Field>
 	template<class OutVector, class InVector>
-	inline OutVector& Diagonal<Field, VectorCategories::SparseAssociativeVectorTag >
-		::apply(OutVector& y, const InVector& x) const
+	inline OutVector& Diagonal<Field, VectorCategories::SparseAssociativeVectorTag >::apply(OutVector& y, const InVector& x) const
 	{
 		linbox_check ((!x.empty ()) && (_n >= x.rbegin ()->first));
 
@@ -448,10 +507,10 @@ namespace LinBox
 		// Create iterators for input and stored vectors
 		typename std::vector<Element>::const_iterator v_iter;
 		typename InVector::const_iterator x_iter;
- 
+
 		// Start at beginning of _v vector
 		v_iter = _v.begin ();
- 
+
 		// Iterator over indices of input vector.
 		// For each element, multiply input element with corresponding element
 		// of stored vector and insert non-zero elements into output vector
@@ -465,10 +524,7 @@ namespace LinBox
 		return y;
 	} // Vector& Diagonal<SparseAssociativeVectorTag>::apply(...) const
 
-	//@}
-
-
-
 } // namespace LinBox
 
-#endif // __DIAGONAL_H
+#endif // __LINBOX_diagonal_H
+
diff --git a/linbox/blackbox/dif.h b/linbox/blackbox/dif.h
index a0f334f..7781443 100644
--- a/linbox/blackbox/dif.h
+++ b/linbox/blackbox/dif.h
@@ -1,19 +1,21 @@
 /* -*- 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
 /* linbox/blackbox/dif.h
+ * Copyright (c) 2010 LinBox
  * transmuted from linbox/blackbox/sum.h by bds
+ * Modified by JG Dumas
  *
  * It will be desirable to keep sum.h and dif.h in sync.
- * 
- * Time-stamp: <12 Jan 07 10:39:40 Jean-Guillaume.Dumas at imag.fr> 
+ *
+ * Time-stamp: <18 Jun 10 15:28:48 Jean-Guillaume.Dumas at imag.fr>
  *
  * ------------------------------------
  *
  * See COPYING for license information.
  */
 
-#ifndef __DIF_H
-#define __DIF_H
+#ifndef __LINBOX_dif_H
+#define __LINBOX_dif_H
 
 #include "linbox/vector/vector-domain.h"
 #include "linbox/util/debug.h"
@@ -23,21 +25,20 @@
 namespace LinBox
 {
 
-	/** \brief Blackbox of a difference: C := A - B, i.e. Cx = Ax - Bx.
-
-	 * {\bf Template parameters:} 
-	 *     Field is the class of the entry domain, 
+	/** Blackbox of a difference: <code>C := A - B</code>, i.e <code>Cx = Ax - Bx</code>.
+	 *
+	 * <b> Template parameters</b>:
+	 *     Field is the class of the entry domain,
 	 *     Vector is a LinBox dense or sparse vector of field elements class.
-\ingroup blackbox
+	 \ingroup blackbox
 	 */
 	template <class _Blackbox1, class _Blackbox2>
-	class Dif : public BlackboxInterface 
-	{
-                typedef Dif<_Blackbox1, _Blackbox2> Self_t;
-	    public:
+	class Dif : public BlackboxInterface {
+		typedef Dif<_Blackbox1, _Blackbox2> Self_t;
+	public:
 		typedef _Blackbox1 Blackbox1;
 		typedef _Blackbox2 Blackbox2;
-	       
+
 		typedef typename Blackbox1::Field Field;
 		typedef typename Blackbox1::Element Element;
 
@@ -46,7 +47,8 @@ namespace LinBox
 		 * Their data is not copied.  A subsequent change to one of them also changes
 		 * this difference.
 		 */
-		Dif (const Blackbox1 &A, const Blackbox2 &B) : _A_ptr(&A), _B_ptr(&B)		     
+		Dif (const Blackbox1 &A, const Blackbox2 &B) :
+		       	_A_ptr(&A), _B_ptr(&B)
 		{
 			// create new copies of matrices in dynamic memory
 			linbox_check (A.coldim () == B.coldim ());
@@ -58,9 +60,10 @@ namespace LinBox
 
 		/** Build this as A - B from blackbox pointers A_ptr, B_ptr.
 		 * The two matrices must have the same shape and be over the same field.
-		 * Their data {\it is} copied.  I don't know why.
+		 * Their data <i>is</i> copied.  I don't know why.
 		 */
-		Dif (const Blackbox1 *A_ptr, const Blackbox2 *B_ptr) : _A_ptr(A_ptr),_B_ptr(B_ptr)	       
+		Dif (const Blackbox1 *A_ptr, const Blackbox2 *B_ptr) :
+		       	_A_ptr(A_ptr),_B_ptr(B_ptr)
 		{
 			// create new copies of matrices in dynamic memory
 			linbox_check (A_ptr != 0);
@@ -68,8 +71,8 @@ namespace LinBox
 			linbox_check (A_ptr->coldim () == B_ptr->coldim ());
 			linbox_check (A_ptr->rowdim () == B_ptr->rowdim ());
 
-// 			_A_ptr = A_ptr->clone ();
-// 			_B_ptr = B_ptr->clone ();
+			// 			_A_ptr = A_ptr->clone ();
+			// 			_B_ptr = B_ptr->clone ();
 			VectorWrapper::ensureDim (_z1, A_ptr->rowdim ());
 			VectorWrapper::ensureDim (_z2, A_ptr->coldim ());
 		}
@@ -78,8 +81,8 @@ namespace LinBox
 		 * Creates new black box objects in dynamic memory.
 		 * @param M constant reference to compose black box matrix
 		 */
-		Dif (const Dif<Blackbox1, Blackbox2> &M)
-			: _A_ptr (M._A_ptr), _B_ptr (M._B_ptr)
+		Dif (const Dif<Blackbox1, Blackbox2> &M) :
+			_A_ptr (M._A_ptr), _B_ptr (M._B_ptr)
 		{
 			VectorWrapper::ensureDim (_z1, _A_ptr->rowdim ());
 			VectorWrapper::ensureDim (_z2, _A_ptr->coldim ());
@@ -91,12 +94,13 @@ namespace LinBox
 		}
 
 		/** Application of BlackBox matrix.
-		 * y= (A+B)*x.
-		 * Requires one vector conforming to the \ref{LinBox}
-		 * vector {@link Archetypes archetype}.
+		 * <code>y= (A+B)*x</code>.
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
 		 * Required by abstract base class.
 		 * @return reference to vector y containing output.
 		 * @param  x constant reference to vector to contain input
+		 * @param y
 		 */
 		template<class OutVector, class InVector>
 		inline OutVector &apply (OutVector &y, const InVector &x) const
@@ -117,12 +121,13 @@ namespace LinBox
 		}
 
 		/** Application of BlackBox matrix transpose.
-		 * y= transpose(A+B)*x.
-		 * Requires one vector conforming to the \ref{LinBox}
-		 * vector {@link Archetypes archetype}.
+		 * <code>y= transpose(A+B)*x</code>.
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
 		 * Required by abstract base class.
 		 * @return reference to vector y containing output.
 		 * @param  x constant reference to vector to contain input
+		 * @param y
 		 */
 		template<class OutVector, class InVector>
 		inline OutVector &applyTranspose (OutVector &y, const InVector &x) const
@@ -137,19 +142,19 @@ namespace LinBox
 			return y;
 		}
 
-            template<typename _Tp1, typename _Tp2 = _Tp1>
-            struct rebind
-            { typedef Dif<typename Blackbox1::template rebind<_Tp1>::other, typename Blackbox2::template rebind<_Tp2>::other> other;
-                
-    		void operator() (other *& Ap, const Self_t& A, const _Tp1& F) {
-                    typename other::Blackbox1 * A1;
-                    typename Blackbox1::template rebind<_Tp1> () ( A1, *(A._A_ptr), F);
-                    typename other::Blackbox2 * A2;
-                    typename Blackbox2::template rebind<_Tp1> () ( A2, *(A._B_ptr), F);
-                    Ap = new other(*A1, *A2);
-                }
+		template<typename _Tp1, typename _Tp2 = _Tp1>
+		struct rebind {
+			typedef Dif<
+			typename Blackbox1::template rebind<_Tp1>::other,
+				 typename Blackbox2::template rebind<_Tp2>::other
+				 > other;
 
-            };
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F) {
+				typename Blackbox1::template rebind<_Tp1> () ( *(Ap._A_ptr), *(A._A_ptr), F);
+				typename Blackbox2::template rebind<_Tp2> () ( *(Ap._B_ptr), *(A._B_ptr), F);
+			}
+
+		};
 
 
 
@@ -159,18 +164,18 @@ namespace LinBox
 		 * @return integer number of rows of black box matrix.
 		 */
 		size_t rowdim (void) const
-			{ return _A_ptr->rowdim (); }
-    
+		{ return _A_ptr->rowdim (); }
+
 		/** Retreive column dimensions of BlackBox matrix.
 		 * Required by abstract base class.
 		 * @return integer number of columns of black box matrix.
 		 */
-		size_t coldim (void) const 
-			{ return _A_ptr->coldim (); }
+		size_t coldim (void) const
+		{ return _A_ptr->coldim (); }
 
 		const Field& field() const {return _A_ptr->field();}
 
-	    private:
+	private:
 
 		const Blackbox1       *_A_ptr;
 		const Blackbox2       *_B_ptr;
@@ -178,8 +183,9 @@ namespace LinBox
 		mutable std::vector<Element>  _z1;
 		mutable std::vector<Element>  _z2;
 
-	}; 
+	};
 
 } // namespace LinBox
 
-#endif // __DIF_H
+#endif // __LINBOX_dif_H
+
diff --git a/linbox/blackbox/direct-sum.h b/linbox/blackbox/direct-sum.h
index 58fd256..d009e2a 100644
--- a/linbox/blackbox/direct-sum.h
+++ b/linbox/blackbox/direct-sum.h
@@ -1,19 +1,36 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* linbox/blackbox/direct-sum.h
- * David Saunders
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C)  LinBox
+ * Written by
+ *            David Saunders
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
  *
- * See COPYING about license
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __DIRECT_SUM_H
-#define __DIRECT_SUM_H
+#ifndef __LINBOX_direct_sum_H
+#define __LINBOX_direct_sum_H
 
 #include <linbox/blackbox/null-matrix.h>
 #include <linbox/vector/vector-traits.h>
 #include <linbox/blackbox/blackbox-interface.h>
 #include <linbox/vector/subvector.h>
 #include <linbox/matrix/matrix-domain.h>
+#include <linbox/vector/light_container.h>
 
 namespace LinBox
 {
@@ -21,50 +38,59 @@ namespace LinBox
 	template <class Blackbox1, class Blackbox2 = Blackbox1>
 	class DirectSum;
 
+	template <class Blackbox1, class Blackbox2 = Blackbox1>
+	class DirectSumOwner;
+
+}
+
+
+namespace LinBox
+{
+
 	/** \brief If C = DirectSum(A, B) and y = xA and z = wB, then (y,z) = (x,w)C.
 
-	 * And similarly for apply. 
-	\ingroup blackbox
+	 * And similarly for apply.
+	 \ingroup blackbox
 	 */
 	template <class _Blackbox1, class _Blackbox2>
-	class DirectSum : public BlackboxInterface
-	{
-            typedef DirectSum<_Blackbox1, _Blackbox2> Self_t;
-        public:
-            typedef _Blackbox1 Blackbox1;
-            typedef _Blackbox2 Blackbox2;
+	class DirectSum : public BlackboxInterface {
+		typedef DirectSum<_Blackbox1, _Blackbox2> Self_t;
+	public:
+		typedef _Blackbox1 Blackbox1;
+		typedef _Blackbox2 Blackbox2;
 
 		typedef typename Blackbox1::Field Field;
 		typedef typename Blackbox1::Element Element;
 
 		/** Constructor from two black box matrices.
 		 * This becomes direct sum of A and B.
-		 * They may be rectangular.  
-		 * @param A, B:  black box matrices over a common field.
+		 * They may be rectangular.
+		 * @param A  black box matrices over a common field.
+		 * @param B  black box matrices over a common field.
 		 */
-		DirectSum(const	Blackbox1& A, const Blackbox2& B)
-			: _Ap(&A), _Bp(&B)
+		DirectSum(const	Blackbox1& A, const Blackbox2& B) :
+			_Ap(&A), _Bp(&B)
 		{}
 
 		/** Constructor from two black box matrix pointers.
 		 * This becomes direct sum of A and B.
-		 * They may be rectangular.  They must be over the same field (or ring). 
-		 * @param A_ptr pointer to black box matrix A.
-		 * @param B_ptr pointer to black box matrix B.
+		 * They may be rectangular.  They must be over the same field (or ring).
+		 * @param Ap pointer to black box matrix A.
+		 * @param Bp pointer to black box matrix B.
 		 */
-	// 	DirectSum(): _Ap(& DirectSum<Blackbox1, Blackbox2>::_NullMatrix),
-// 			     _Bp(& DirectSum<Blackbox1, Blacbox2>::_NullMatrix) 
-// 		{}
-
-
-
-		DirectSum(const	Blackbox1* Ap, const Blackbox2* Bp)
-			: _Ap(Ap), _Bp(Bp)
+#if 0
+		DirectSum() :
+			_Ap(& DirectSum<Blackbox1, Blackbox2>::_NullMatrix),
+			_Bp(& DirectSum<Blackbox1, Blacbox2>::_NullMatrix)
+		{}
+#endif
+		DirectSum(const	Blackbox1* Ap, const Blackbox2* Bp) :
+			_Ap(Ap), _Bp(Bp)
 		{}
 
 		/// Copy constructor.
-		DirectSum (const DirectSum<Blackbox1, Blackbox2>& M) 
-			: _Ap (M._Ap), _Bp (M._Bp)
+		DirectSum (const DirectSum<Blackbox1, Blackbox2>& M) :
+			_Ap (M._Ap), _Bp (M._Bp)
 		{}
 
 
@@ -77,33 +103,33 @@ namespace LinBox
 		{
 			linbox_check(x.size() == coldim());
 			linbox_check(y.size() == rowdim());
-		// FIXED: I want to use subvectors to avoid copying and memory allocation, but problems with it...
+			// FIXED: I want to use subvectors to avoid copying and memory allocation, but problems with it...
 
 			const Subvector<typename InVector::const_iterator> x1(x.begin(), x.begin() + _Ap->coldim());
 			const Subvector<typename InVector::const_iterator> x2(x.begin() + _Ap->coldim(), x.end());
 			Subvector<typename OutVector::iterator> y1(y.begin(), y.begin() + _Ap->rowdim());
 			Subvector<typename OutVector::iterator> y2(y.begin() + _Ap->rowdim(), y.end());
-			_Ap -> apply(y1,x1);
-			_Bp -> apply(y2,x2);
-		/*
-			if (x.size() == 0) return y;  // Null matrix
-
-			InVector xA(_Ap->coldim());
-			OutVector yA(_Ap->rowdim());
-			std::copy (x.begin(), x.begin() + _Ap->coldim(), xA.begin());
-			_Ap->apply (yA, xA);
-			std::copy (yA.begin(), yA.end(), y.begin());
-
-			InVector xB(_Bp->coldim());
-			OutVector yB(_Bp->rowdim());
-			std::copy (x.begin() + _Ap->coldim(), x.end(), xB.begin());
-			_Bp->apply (yB, xB);
-			std::copy (yB.begin(), yB.end(), y.begin() + _Ap->rowdim());
-
-			y.resize(_Ap->rowdim());
-			x.resize(_Ap->coldim());
-			_Ap->apply(y,x);
-		*/
+			_Ap->apply(y1,x1);
+			_Bp->apply(y2,x2);
+			/*
+			   if (x.size() == 0) return y;  // Null matrix
+
+			   InVector xA(_Ap->coldim());
+			   OutVector yA(_Ap->rowdim());
+			   std::copy (x.begin(), x.begin() + _Ap->coldim(), xA.begin());
+			   _Ap->apply (yA, xA);
+			   std::copy (yA.begin(), yA.end(), y.begin());
+
+			   InVector xB(_Bp->coldim());
+			   OutVector yB(_Bp->rowdim());
+			   std::copy (x.begin() + _Ap->coldim(), x.end(), xB.begin());
+			   _Bp->apply (yB, xB);
+			   std::copy (yB.begin(), yB.end(), y.begin() + _Ap->rowdim());
+
+			   y.resize(_Ap->rowdim());
+			   x.resize(_Ap->coldim());
+			   _Ap->apply(y,x);
+			   */
 			return y;
 		}
 
@@ -113,26 +139,26 @@ namespace LinBox
 		{
 			linbox_check(x.size() == rowdim());
 			linbox_check(y.size() == coldim());
-		// FIXED: I want to use subvectors to avoid copying and memory allocation, but problems with it...
+			// FIXED: I want to use subvectors to avoid copying and memory allocation, but problems with it...
 			const Subvector<typename InVector::const_iterator> x1(x.begin(), x.begin() + _Ap->rowdim());
 			const Subvector<typename InVector::const_iterator> x2(x.begin() + _Ap->rowdim(), x.end());
 			Subvector<typename OutVector::iterator> y1(y.begin(), y.begin() + _Ap->coldim());
 			Subvector<typename OutVector::iterator> y2(y.begin() + _Ap->coldim(), y.end());
-			_Ap -> applyTranspose(y1,x1);
-			_Bp -> applyTranspose(y2,x2);
-
-		/*
-			Vector local_x(x1.size());
-			Vector local_y(y1.size());
-			copy (x1.begin(), x1.end(), local_x.begin());
-			_Ap->applyTranspose (local_y, local_x);
-			copy (local_y.begin(), local_y.end(), y1.begin());
-
-			local_x.resize(x1.size());
-			local_y.resize(y2.size());
-			copy (x2.begin(), x2.end(), local_x.begin());
-			_Bp->applyTranspose (local_y, local_x);
-			copy (local_y.begin(), local_y.end(), y2.begin());
+			_Ap->applyTranspose(y1,x1);
+			_Bp->applyTranspose(y2,x2);
+
+			/*
+			   Vector local_x(x1.size());
+			   Vector local_y(y1.size());
+			   copy (x1.begin(), x1.end(), local_x.begin());
+			   _Ap->applyTranspose (local_y, local_x);
+			   copy (local_y.begin(), local_y.end(), y1.begin());
+
+			   local_x.resize(x1.size());
+			   local_y.resize(y2.size());
+			   copy (x2.begin(), x2.end(), local_x.begin());
+			   _Bp->applyTranspose (local_y, local_x);
+			   copy (local_y.begin(), local_y.end(), y2.begin());
 
 			//_Ap->applyTranspose (y1, x1);
 			//_Bp->applyTranspose (y2, x2);
@@ -149,26 +175,26 @@ namespace LinBox
 			std::copy (x.begin() + _Ap->rowdim(), x.end(), xBT.begin());
 			_Bp->apply (yBT, xBT);
 			std::copy (yBT.begin(), yBT.end(), y.begin() + _Ap->rowdim());
-		*/
+			*/
 
 
 			return y;
 		}
 
-            template<typename _Tp1, typename _Tp2 = _Tp1>
-            struct rebind
-            { 
-                typedef DirectSum<typename Blackbox1::template rebind<_Tp1>::other, typename Blackbox2::template rebind<_Tp2>::other> other; 
-
-		void operator() (other *& Ap, const Self_t& A, const _Tp1& F) {
-                    typename other::Blackbox1 * A1;
-                    typename Blackbox1::template rebind<_Tp1> () ( A1, *(A._Ap), F);
-                    typename other::Blackbox2 * A2;
-                    typename Blackbox2::template rebind<_Tp1> () ( A2, *(A._Bp), F);
-                    Ap = new other(*A1, *A2);
-                }
+		template<typename _Tp1, typename _Tp2 = _Tp1>
+		struct rebind {
+			typedef DirectSumOwner<
+			typename Blackbox1::template rebind<_Tp1>::other,
+				 typename Blackbox2::template rebind<_Tp2>::other
+				 > other;
+
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F)
+			{
+				typename Blackbox1::template rebind<_Tp1> () ( Ap.getLeftData(), *(A.getLeftPtr()), F);
+				typename Blackbox2::template rebind<_Tp2> () ( Ap.getRightData(), *(A.getRightPtr()), F);
+			}
 
-            };
+		};
 
 		inline size_t rowdim (void) const
 		{
@@ -176,159 +202,488 @@ namespace LinBox
 			return _Ap->rowdim () + _Bp->rowdim ();
 
 		}
-    
-		inline size_t coldim(void) const 
+
+		inline size_t coldim(void) const
 		{
 			return _Ap->coldim () + _Bp->coldim ();
 		}
 
 
-		const Field& field() const { return _Ap -> field();}
-	    protected:
+		const Field& field() const { return _Ap->field();}
+
+		// accessors to the blackboxes
+		const Blackbox1* getLeftPtr() const {return  _Ap;}
+		const Blackbox2* getRightPtr() const {return  _Bp;}
+
+	protected:
 		// the direct summands
 		const Blackbox1* _Ap;
-		const Blackbox2* _Bp; 
-		
+		const Blackbox2* _Bp;
+
 
 	}; // template <Vector> class DirectSum
 
-	
 
-        template <class Blackbox>
-        class DirectSum<Blackbox, Blackbox>
-        {
-            public:
-            typedef DirectSum<Blackbox, Blackbox> Self_t;
-            typedef Blackbox Blackbox_t;
 
-                typedef typename Blackbox::Field Field;
-                typedef typename Blackbox::Element Element;
-		DirectSum() : m(0),n(0){}
-                DirectSum(const Blackbox& A, const Blackbox& B) {
-                	_VB.push_back(&A);
+	template <class Blackbox>
+	class DirectSum<Blackbox, Blackbox> {
+	public:
+		typedef DirectSum<Blackbox, Blackbox> Self_t;
+		typedef Blackbox Blackbox_t;
+		typedef std::vector<const Blackbox* > ListBB_t;
+
+
+		typedef typename Blackbox::Field Field;
+		typedef typename Blackbox::Element Element;
+		DirectSum() :
+			m(0),n(0)
+		{}
+		DirectSum(const Blackbox& A, const Blackbox& B)
+		{
+			_VB.push_back(&A);
 			_VB.push_back(&B);
 			m = A.rowdim() + B.rowdim();
 			n = A.coldim() + B.coldim();
 		}
 
-                DirectSum(const Blackbox* Ap, const Blackbox* Bp) {
+		DirectSum(const Blackbox* Ap, const Blackbox* Bp)
+		{
 			_VB.push_back(Ap);
 			_VB.push_back(Bp);
-			m = Ap -> rowdim() + Bp -> rowdim();
-			n = Ap -> coldim() + Bp -> coldim();
+			m = Ap->rowdim() + Bp->rowdim();
+			n = Ap->coldim() + Bp->coldim();
 		}
 		template<class Vector>
-		DirectSum(const Vector& v) :_VB(v.begin(),v.end()) {
+		DirectSum(const Vector& v) :_VB(v.begin(),v.end())
+		{
 			m = 0; n = 0;
 			typename std::vector<const Blackbox* >::iterator bp;
 			for( bp = _VB.begin(); bp != _VB.end(); ++bp) {
-				m += (*bp) -> rowdim();
-				n += (*bp) -> coldim();
+				m += (*bp)->rowdim();
+				n += (*bp)->coldim();
 			}
 		}
-		
-                /// Copy constructor.
-                DirectSum (const DirectSum<Blackbox, Blackbox>& M)
-                        :_VB(M._VB),m(M.m),n(M.n)
-                {}
-
-
-                /// Destructor
-                ~DirectSum (void)
-                {}
-
-            template<typename _Tp1>
-            struct rebind
-            { 
-                typedef DirectSum<typename Blackbox::template rebind<_Tp1>::other, typename Blackbox::template rebind<_Tp1>::other> other; 
-
-                void operator() (other *& Ap, const Self_t& A, const _Tp1& F) {
-                    std::vector<typename other::Blackbox_t *> newPtrV;                  
-                    typename std::vector<typename other::Blackbox_t *>::iterator np;
-                    typename std::vector<const Blackbox_t* >::const_iterator bp;
-                    for( bp = A._VB.begin(), np = newPtrV.begin(); 
-                         bp != A._VB.end(); ++bp, ++np) {
-                        typename Blackbox_t::template rebind<_Tp1> () (*np, *(*bp), F);
-                    }
-                    Ap = new other(newPtrV);
-                }
-            };
-
-               template<class OutVector, class InVector>
-                OutVector& apply (OutVector& y, const InVector& x) const
-                {
-                        linbox_check(y.size() == rowdim());
-                        linbox_check(x.size() == coldim());
+
+		/// Copy constructor.
+		DirectSum (const DirectSum<Blackbox, Blackbox>& M) :
+			_VB(M._VB),m(M.m),n(M.n)
+		{}
+
+
+		/// Destructor
+		~DirectSum (void)
+		{}
+
+		template<typename _Tp1>
+		struct rebind {
+			typedef DirectSumOwner<
+			typename Blackbox::template rebind<_Tp1>::other,
+				 typename Blackbox::template rebind<_Tp1>::other
+				 > other;
+
+
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F) {
+				typename other::ListBB_t::iterator itp = Ap.getDataSum().begin();
+				typename Self_t::ListBB_t::const_iterator it = A.getSum().begin();
+
+				for( ; it != A.getSum().end(); ++itp,++it)
+					typename Blackbox::template rebind<_Tp1>()( *itp, *(*it), F);
+			}
+
+		};
+
+
+		template<class OutVector, class InVector>
+		OutVector& apply (OutVector& y, const InVector& x) const
+		{
+			linbox_check(y.size() == rowdim());
+			linbox_check(x.size() == coldim());
 			int offset_x = 0;
-                        int offset_y = 0;
-                        typename std::vector<const Blackbox* >::const_iterator bp;
-                        for(bp = _VB.begin(); bp != _VB.end(); ++bp){
-                                const Subvector<typename InVector::const_iterator> x1(x.begin() + offset_x, x.begin() + (offset_x + (*bp)->coldim()));
-                                Subvector<typename OutVector::iterator> y1(y.begin() + offset_y, y.begin() + (offset_y + (*bp)->rowdim()));
-                                (*bp) -> apply(y1,x1);
-                                offset_x += (*bp) -> coldim();
-                                offset_y += (*bp) -> rowdim();
-                        }
-                        return y;
-
-                }
-
-
-                template<class OutVector, class InVector>
-                OutVector& applyTranspose (OutVector& y, const InVector& x) const
-                {
-                        linbox_check(y.size() == coldim());
-                        linbox_check(x.size() == rowdim());
+			int offset_y = 0;
+			typename std::vector<const Blackbox* >::const_iterator bp;
+			for(bp = _VB.begin(); bp != _VB.end(); ++bp){
+				const Subvector<typename InVector::const_iterator> x1(x.begin() + offset_x, x.begin() + (offset_x + (*bp)->coldim()));
+				Subvector<typename OutVector::iterator> y1(y.begin() + offset_y, y.begin() + (offset_y + (*bp)->rowdim()));
+				(*bp)->apply(y1,x1);
+				offset_x += (*bp)->coldim();
+				offset_y += (*bp)->rowdim();
+			}
+			return y;
+
+		}
+
+
+		template<class OutVector, class InVector>
+		OutVector& applyTranspose (OutVector& y, const InVector& x) const
+		{
+			linbox_check(y.size() == coldim());
+			linbox_check(x.size() == rowdim());
 			int offset_x = 0;
 			int offset_y = 0;
 			typename std::vector<const Blackbox* >::const_iterator bp;
 			for(bp = _VB.begin(); bp != _VB.end(); ++bp){
-                        	const Subvector<typename InVector::const_iterator> x1(x.begin() + offset_x, x.begin() + (offset_x + (*bp)->rowdim()));
-                        	Subvector<typename OutVector::iterator> y1(y.begin() + offset_y, y.begin() + (offset_y + (*bp)->coldim()));
-                        	(*bp) -> applyTranspose(y1,x1);
-				offset_x += (*bp) -> rowdim();
-				offset_y += (*bp) -> coldim();
+				const Subvector<typename InVector::const_iterator> x1(x.begin() + offset_x, x.begin() + (offset_x + (*bp)->rowdim()));
+				Subvector<typename OutVector::iterator> y1(y.begin() + offset_y, y.begin() + (offset_y + (*bp)->coldim()));
+				(*bp)->applyTranspose(y1,x1);
+				offset_x += (*bp)->rowdim();
+				offset_y += (*bp)->coldim();
 			}
-                        return y;
-                }
+			return y;
+		}
 
-                inline size_t rowdim (void) const
-                {
+		inline size_t rowdim (void) const
+		{
 
-                        return m;
+			return m;
 
-                }
+		}
+
+		inline size_t coldim(void) const
+		{
+			return n;
+		}
 
-                inline size_t coldim(void) const
-                {
-                        return n;
-                }
+		const Field& field() const { return _VB.front()->field();}
 
-                const Field& field() const { return _VB.front() -> field();}
-            protected:
+		std::vector<const Blackbox* >& getSum() { return _VB; }
+		const std::vector<const Blackbox* >& getSum() const { return _VB; }
+
+		size_t size() const {
+			return this->_VB.size();
+		}
+	protected:
 		std::vector<const Blackbox* > _VB;
 		size_t m;
 		size_t n;
-        }; 
+	};
+
+
+
+	template <class Matrix> struct MatrixTraits;
+
+	#ifndef __INTEL_COMPILER
+	template<>
+	#endif
+	template <class BB1, class BB2>
+	struct MatrixTraits< DirectSum<BB1, BB2> > {
+		typedef DirectSum<BB1, BB2> MatrixType;
+		typedef MatrixCategories::BlackboxTag MatrixCategory;
+	};
+
+#ifndef __INTEL_COMPILER
+	template<>
+	#endif
+	template <class BB1, class BB2>
+	struct MatrixTraits< const DirectSum<BB1, BB2> > {
+		typedef const DirectSum<BB1, BB2> MatrixType;
+		typedef MatrixCategories::BlackboxTag MatrixCategory;
+	};
+
+
+}; // namespace LinBox
+
+
+namespace LinBox
+{
+
+	template <class _Blackbox1, class _Blackbox2>
+	class DirectSumOwner : public BlackboxInterface {
+		typedef DirectSumOwner<_Blackbox1, _Blackbox2> Self_t;
+	public:
+		typedef _Blackbox1 Blackbox1;
+		typedef _Blackbox2 Blackbox2;
+
+		typedef typename Blackbox1::Field Field;
+		typedef typename Blackbox1::Element Element;
+
+		/** Constructor from two black box matrices.
+		 * This becomes direct sum of A and B.
+		 * They may be rectangular.
+		 * @param A  black box matrices over a common field.
+		 * @param B  black box matrices over a common field.
+		 */
+		DirectSumOwner(const	Blackbox1& A, const Blackbox2& B) :
+			_A_data(A), _B_data(B)
+		{}
+
+	#if 0
+		DirectSumOwner() :
+			_Ap(& DirectSumOwner<Blackbox1, Blackbox2>::_NullMatrix),
+			_Bp(& DirectSumOwner<Blackbox1, Blacbox2>::_NullMatrix)
+		{}
+#endif
+
+		/** Constructor from two black box matrix pointers.
+		 * This becomes direct sum of A and B.
+		 * They may be rectangular.  They must be over the same field (or ring).
+		 * @param Ap pointer to black box matrix A.
+		 * @param Bp pointer to black box matrix B.
+		 */
+
+		DirectSumOwner(const	Blackbox1* Ap, const Blackbox2* Bp) :
+			_A_data(*Ap), _B_data(*Bp)
+		{}
+
+		/// Copy constructor.
+		DirectSumOwner (const DirectSumOwner<Blackbox1, Blackbox2>& M) :
+			_A_data (M._A_data), _B_data (M._B_data)
+		{}
+
+
+		/// Destructor
+		~DirectSumOwner (void)
+		{}
+
+		template<class OutVector, class InVector>
+		OutVector& apply (OutVector& y, const InVector& x) const
+		{
+			linbox_check(x.size() == coldim());
+			linbox_check(y.size() == rowdim());
+			// FIXED: I want to use subvectors to avoid copying and memory allocation, but problems with it...
+
+			const Subvector<typename InVector::const_iterator> x1(x.begin(), x.begin() + _A_data.coldim());
+			const Subvector<typename InVector::const_iterator> x2(x.begin() + _A_data.coldim(), x.end());
+			Subvector<typename OutVector::iterator> y1(y.begin(), y.begin() + _A_data.rowdim());
+			Subvector<typename OutVector::iterator> y2(y.begin() + _A_data.rowdim(), y.end());
+			_A_data->apply(y1,x1);
+			_B_data->apply(y2,x2);
+			return y;
+		}
+
 
-		template <class Matrix> struct MatrixTraits;
-		template<>
-		template <class BB1, class BB2>
-		struct MatrixTraits< DirectSum<BB1, BB2> >
+		template<class OutVector, class InVector>
+		OutVector& applyTranspose (OutVector& y, const InVector& x) const
+		{
+			linbox_check(x.size() == rowdim());
+			linbox_check(y.size() == coldim());
+			const Subvector<typename InVector::const_iterator> x1(x.begin(), x.begin() + _A_data.rowdim());
+			const Subvector<typename InVector::const_iterator> x2(x.begin() + _A_data.rowdim(), x.end());
+			Subvector<typename OutVector::iterator> y1(y.begin(), y.begin() + _A_data.coldim());
+			Subvector<typename OutVector::iterator> y2(y.begin() + _A_data.coldim(), y.end());
+			_A_data->applyTranspose(y1,x1);
+			_B_data->applyTranspose(y2,x2);
+
+
+			return y;
+		}
+
+		template<typename _Tp1, typename _Tp2 = _Tp1>
+		struct rebind
 		{
-    		typedef DirectSum<BB1, BB2> MatrixType;
-	    	typedef MatrixCategories::BlackboxTag MatrixCategory;
+			typedef DirectSumOwner<
+			typename Blackbox1::template rebind<_Tp1>::other,
+				 typename Blackbox2::template rebind<_Tp2>::other
+				 > other;
+
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F) {
+				typename Blackbox1::template rebind<_Tp1> () ( Ap.getLeftData(), A.getLeftData(), F);
+				typename Blackbox2::template rebind<_Tp2> () ( Ap.getRightData(), A.getRightData(), F);
+			}
+
 		};
-		                                                                                                
-																										template<>
-		template <class BB1, class BB2>
-		struct MatrixTraits< const DirectSum<BB1, BB2> >
+
+
+		template<typename _BBt1, typename _BBt2, typename Field>
+		DirectSumOwner (const DirectSum<_BBt1, _BBt2> &M, const Field& F) :
+			_A_data(*(M.getLeftPtr()), F),
+			_B_data(*(M.getRightPtr()), F)
 		{
-			typedef const DirectSum<BB1, BB2> MatrixType;
-			typedef MatrixCategories::BlackboxTag MatrixCategory;
+			typename DirectSum<_BBt1, _BBt2>::template rebind<Field,Field>()(*this, M, F);
+		}
+
+		template<typename _BBt1, typename _BBt2, typename Field>
+		DirectSumOwner (const DirectSumOwner<_BBt1, _BBt2> &M, const Field& F) :
+			_A_data(M.getLeftData(), F),
+			_B_data(M.getRightData(), F)
+		{
+			typename DirectSumOwner<_BBt1, _BBt2>::template rebind<Field,Field>()(*this, M, F);
+		}
+
+
+
+		inline size_t rowdim (void) const
+		{
+
+			return _A_data.rowdim () + _B_data.rowdim ();
+
+		}
+
+		inline size_t coldim(void) const
+		{
+			return _A_data.coldim () + _B_data.coldim ();
+		}
+
+
+		const Field& field() const { return _A_data->field();}
+
+		// accessors to the blackboxes without ownership
+		const Blackbox1& getLeftData() const {return  _A_data;}
+
+		const Blackbox2& getRightData() const {return  _B_data;}
+
+	protected:
+
+		// the direct summands
+		Blackbox1 _A_data;
+		Blackbox2 _B_data;
+
+	}; // template <Vector> class DirectSumOwner
+
+
+	template <class Blackbox>
+	class DirectSumOwner<Blackbox, Blackbox> {
+	public:
+		typedef DirectSumOwner<Blackbox, Blackbox> Self_t;
+		typedef Blackbox Blackbox_t;
+		typedef LightContainer<Blackbox> ListBB_t;
+
+		typedef typename Blackbox::Field Field;
+		typedef typename Blackbox::Element Element;
+
+		DirectSumOwner() :
+			m(0),n(0)
+		{}
+		DirectSumOwner(const Blackbox& A, const Blackbox& B)
+		{
+			_VB_data.push_back(A);
+			_VB_data.push_back(B);
+			m = A.rowdim() + B.rowdim();
+			n = A.coldim() + B.coldim();
+		}
+
+		DirectSumOwner(const Blackbox* Ap, const Blackbox* Bp)
+		{
+			_VB_data.push_back(*Ap);
+			_VB_data.push_back(*Bp);
+			m = Ap->rowdim() + Bp->rowdim();
+			n = Ap->coldim() + Bp->coldim();
+		}
+		template<class Vector>
+		DirectSumOwner(const Vector& v) :_VB_data(v.begin(),v.end())
+		{
+			m = 0; n = 0;
+			typename ListBB_t::iterator bp;
+			for( bp = _VB_data.begin(); bp != _VB_data.end(); ++bp) {
+				m += bp->rowdim();
+				n += bp->coldim();
+			}
+		}
+
+		/// Copy constructor.
+		DirectSumOwner (const DirectSumOwner<Blackbox, Blackbox>& M) :
+			_VB_data(M._VB_data),m(M.m),n(M.n)
+		{}
+
+
+		/// Destructor
+		~DirectSumOwner (void)
+		{}
+
+		template<typename _Tp1>
+		struct rebind
+		{
+			typedef DirectSumOwner<
+			typename Blackbox::template rebind<_Tp1>::other,
+				 typename Blackbox::template rebind<_Tp1>::other
+				 > other;
+
+
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F) {
+				typename other::ListBB_t::iterator itp = Ap.getDataSum().begin();
+				typename Self_t::ListBB_t::const_iterator it = A.getDataSum().begin();
+
+
+				for( ; it != A.getDataSum().end(); ++itp,++it)
+					typename Blackbox::template rebind<_Tp1>()( *(itp->get()), *(*it), F);
+			}
+
 		};
-																												                                                                                                
+
+		template<typename _BBt, typename Field>
+		DirectSumOwner (const DirectSum<_BBt> &M, const Field& F) :
+			_VB_data( M.size() ), m( M.rowdim() ), n( M.coldim())
+		{
+			typename DirectSum<_BBt>::template rebind<Field>()(*this, M, F);
+		}
+
+		template<typename _BBt, typename Field>
+		DirectSumOwner (const DirectSumOwner<_BBt> &M, const Field& F) :
+			_VB_data( M.size() ), m( M.rowdim() ), n( M.coldim())
+		{
+			typename DirectSumOwner<_BBt>::template rebind<Field>()(*this, M, F);
+		}
+
+
+		template<class OutVector, class InVector>
+		OutVector& apply (OutVector& y, const InVector& x) const
+		{
+			linbox_check(y.size() == rowdim());
+			linbox_check(x.size() == coldim());
+			int offset_x = 0;
+			int offset_y = 0;
+			typename ListBB_t::const_iterator bp;
+			for(bp = _VB_data.begin(); bp != _VB_data.end(); ++bp){
+				const Subvector<typename InVector::const_iterator> x1(x.begin() + offset_x, x.begin() + (offset_x + bp->coldim()));
+				Subvector<typename OutVector::iterator> y1(y.begin() + offset_y, y.begin() + (offset_y + bp->rowdim()));
+				bp->apply(y1,x1);
+				offset_x += bp->coldim();
+				offset_y += bp->rowdim();
+			}
+			return y;
+
+		}
+
+
+		template<class OutVector, class InVector>
+		OutVector& applyTranspose (OutVector& y, const InVector& x) const
+		{
+			linbox_check(y.size() == coldim());
+			linbox_check(x.size() == rowdim());
+			int offset_x = 0;
+			int offset_y = 0;
+			typename ListBB_t::const_iterator bp;
+			for(bp = _VB_data.begin(); bp != _VB_data.end(); ++bp){
+				const Subvector<typename InVector::const_iterator> x1(x.begin() + offset_x, x.begin() + (offset_x + bp->rowdim()));
+				Subvector<typename OutVector::iterator> y1(y.begin() + offset_y, y.begin() + (offset_y + bp->coldim()));
+				bp->applyTranspose(y1,x1);
+				offset_x += bp->rowdim();
+				offset_y += bp->coldim();
+			}
+			return y;
+		}
+
+		inline size_t rowdim (void) const
+		{
+
+			return m;
+
+		}
+
+		inline size_t coldim(void) const
+		{
+			return n;
+		}
+
+		const Field& field() const { return _VB_data.front().field();}
+		ListBB_t& getDataSum() { return _VB_data; }
+		const ListBB_t& getDataSum() const { return _VB_data; }
+
+		size_t size() const {
+			return this->_VB_data.size();
+		}
+
+
+
+	protected:
+		ListBB_t _VB_data;
+		size_t m;
+		size_t n;
+	};
+
+
 
 }; // namespace LinBox
 
-#endif // __DIRECT_SUM_H
+
+#endif // __LINBOX_direct_sum_H
+
diff --git a/linbox/blackbox/factory.h b/linbox/blackbox/factory.h
index a68dd1e..4df465d 100644
--- a/linbox/blackbox/factory.h
+++ b/linbox/blackbox/factory.h
@@ -1,7 +1,7 @@
 /* -*- 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
 /* linbox/blackbox/factory.h
- * Copyright (C) 2002 Bradford Hovinen
+ * Copyright (C) 2002  LinBox
  *
  * Written by Bradford Hovinen <bghovine at math.uwaterloo.ca>
  *
@@ -10,8 +10,8 @@
  * See COPYING for license information
  */
 
-#ifndef __BLACKBOX_FACTORY_H
-#define __BLACKBOX_FACTORY_H
+#ifndef __LINBOX_blackbox_factory_H
+#define __LINBOX_blackbox_factory_H
 
 #include "linbox/util/error.h"
 #include "linbox/vector/vector-traits.h"
@@ -19,61 +19,61 @@
 namespace LinBox
 {
 
-/** @brief A tool for computations with integer and rational matrices.
- * 
- * The blackbox factory provides a facility for performing integer or rational
- * computations by reducing modulo one or more primes and recovering the
- * solution with Chinese Remaindering, lifting, or rational reconstruction. It
- * is an interface that provides one method which, given a field, produces a
- * black box representing a particular matrix over that field. The factory
- * object may be passed to various procedures, such as rank, det, and solve,
- * which will perform the required modular reductions to find integer or
- * rational solutions.
- *
- * In the typical case, the user provides an object whose class inherits from
- * BlackboxFactory and implements the method makeBlackbox. The object represents
- * the original integer or rational version of the black box, whose data might
- * require some modification (e.g. modular reduction) to produce a true black
- * box. Alternatively, the resulting black box might merely be a
- * reinterpretation of the data in the original object, as is the case where
- * matrix entries are all nonnegative and smaller than the modulus.
- */
+	/** @brief A tool for computations with integer and rational matrices.
+	 *
+	 * The blackbox factory provides a facility for performing integer or rational
+	 * computations by reducing modulo one or more primes and recovering the
+	 * solution with Chinese Remaindering, lifting, or rational reconstruction. It
+	 * is an interface that provides one method which, given a field, produces a
+	 * black box representing a particular matrix over that field. The factory
+	 * object may be passed to various procedures, such as rank, det, and solve,
+	 * which will perform the required modular reductions to find integer or
+	 * rational solutions.
+	 *
+	 * In the typical case, the user provides an object whose class inherits from
+	 * BlackboxFactory and implements the method makeBlackbox. The object represents
+	 * the original integer or rational version of the black box, whose data might
+	 * require some modification (e.g. modular reduction) to produce a true black
+	 * box. Alternatively, the resulting black box might merely be a
+	 * reinterpretation of the data in the original object, as is the case where
+	 * matrix entries are all nonnegative and smaller than the modulus.
+	 */
 
-template <class Field, class Blackbox>
-class BlackboxFactory 
-{
-    public:
+	template <class Field, class Blackbox>
+	class BlackboxFactory {
+	public:
 
-	/// Virtual destructor
-	virtual ~BlackboxFactory () {}
+		/// Virtual destructor
+		virtual ~BlackboxFactory () {}
 
-	/** Given a field and vector type, construct a black box for the matrix
-	 * over that field and using that vector type. This should be
-	 * implemented by the user
-	 * @param F Field over which to construct the black box
-	 */
-	virtual Blackbox *makeBlackbox (const Field &F) = 0;
+		/** Given a field and vector type, construct a black box for the matrix
+		 * over that field and using that vector type. This should be
+		 * implemented by the user
+		 * @param F Field over which to construct the black box
+		 */
+		virtual Blackbox *makeBlackbox (const Field &F) = 0;
 
-	/** Compute and return the max-norm of the matrix.
-	 *
-	 * @param res Place to store result
-	 */
-	virtual integer &maxNorm (integer &res) = 0;
+		/** Compute and return the max-norm of the matrix.
+		 *
+		 * @param res Place to store result
+		 */
+		virtual integer &maxNorm (integer &res) = 0;
 
-	/** Compute and return the hadamard bound of the matrxi.
-	*/
-	virtual integer &hadamardBound (integer &res) const = 0;
+		/** Compute and return the hadamard bound of the matrxi.
+		*/
+		virtual integer &hadamardBound (integer &res) const = 0;
 
-	/** Give the row dimension of the matrix
-	 */
-	virtual size_t rowdim () = 0;
+		/** Give the row dimension of the matrix
+		*/
+		virtual size_t rowdim () = 0;
 
-	/** Give the column dimension of the matrix
-	 */
-	virtual size_t coldim () = 0;
+		/** Give the column dimension of the matrix
+		*/
+		virtual size_t coldim () = 0;
 
-}; // BlackboxFactory
+	}; // BlackboxFactory
 
 } // namespace LinBox
 
-#endif // __BLACKBOX_FACTORY_H
+#endif // __LINBOX_blackbox_factory_H
+
diff --git a/linbox/blackbox/frobenius.h b/linbox/blackbox/frobenius.h
index bd32aa1..5d3674f 100644
--- a/linbox/blackbox/frobenius.h
+++ b/linbox/blackbox/frobenius.h
@@ -1,70 +1,85 @@
+/* -*- 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
 /* linobx/blackbox/frobenuis.h
- *
+ * Copyright(c) 2010 LinBox
  * Written by Austin Lobo <alobo at cis.udel.edu> and
  *            B.D. Saunders <saunders at cis.udel.edu>
- * See COPYING
+ * See COPYING for licence information
  */
-#ifndef __FROBENIUS_H
-#define __FROBENIUS_H
+
+/*! @file blackbox/frobenius.h
+ * @ingroup blackbox
+ * @brief NO DESC
+ */
+
+#ifndef __LINBOX_frobenius_H
+#define __LINBOX_frobenius_H
 
 #include <linbox/blackbox/blackbox-interface.h>
 #include "linbox/blackbox/companion.h"
 #include "linbox/blackbox/direct-sum.h"
 #include <vector>
 
-namespace LinBox {
-  /// \ingroup blackbox
-  template <class _Field>
-  class Frobenius: public BlackboxInterface, public DirectSum<Companion<_Field> >
-  {
- public:
-    Frobenius() { }   // default constructor
-
-    /**
-     *    Build a matrix in Frobenius form whose block sizes are
-     *    specified by vlist, generated from random polynomials 
-     *    @param vlist diagonal-block sizes, positive ints in non-increasing order
-     */
-    template <class VDegList>
-      Frobenius( const _Field &F, const VDegList &vlist)
-      {
-      }
-    
-    /**
-     *    Build a square, block-diagonal matrix as a direct sum of the companion
-     *    matrices of the polynomials. The dimension is the sum of the degrees.
-     *    @param pbegin iterator pointing to the start of a list of polynomials
-     *    @param pend   iterator pointing after end   of a list of polynomials
-     */
-    template <class PolyIterator>
-      Frobenius( const _Field &F, PolyIterator pbegin, PolyIterator pend) {
-		this->_VB.resize(pend - pbegin);
-		PolyIterator pp = pbegin;
-		typename std::vector<const Companion<_Field>* >::iterator vp;
-		this->m = 0;
-		this->n = 0;
-		for(vp = this->_VB.begin(); vp != this->_VB.end(); ++vp,++pp)  {
-			*vp = new  Companion<_Field>(F,*pp);
-			this->m += (*vp) -> rowdim();
-			this->n += (*vp) -> coldim();
+namespace LinBox
+{
+	/// \ingroup blackbox
+	template <class _Field>
+	class Frobenius: public BlackboxInterface, public DirectSum<Companion<_Field> > {
+	public:
+		Frobenius() { }   // default constructor
+
+		/** Constructor.
+		 *    Build a matrix in Frobenius form whose block sizes are
+		 *    specified by vlist, generated from random polynomials
+		 *    @param F
+		 *    @param vlist diagonal-block sizes, positive ints in non-increasing order
+		 */
+		template <class VDegList>
+		Frobenius( const _Field &F, const VDegList &vlist)
+		{ }
+
+		/** Constructor.
+		 *    Build a square, block-diagonal matrix as a direct sum of the companion
+		 *    matrices of the polynomials. The dimension is the sum of the degrees.
+		 *    @param pbegin iterator pointing to the start of a list of polynomials
+		 *    @param F
+		 *    @param pend   iterator pointing after end   of a list of polynomials
+		 */
+		template <class PolyIterator>
+		Frobenius( const _Field &F, PolyIterator pbegin, PolyIterator pend)
+		{
+			this->_VB.resize(pend - pbegin);
+			PolyIterator pp = pbegin;
+			typename std::vector<const Companion<_Field>* >::iterator vp;
+			this->m = 0;
+			this->n = 0;
+			for(vp = this->_VB.begin(); vp != this->_VB.end(); ++vp,++pp)  {
+				*vp = new  Companion<_Field>(F,*pp);
+				this->m += (*vp) -> rowdim();
+				this->n += (*vp) -> coldim();
+			}
 		}
-	}
 
 
-	~Frobenius() {
-		typename std::vector< const Companion<_Field>* >::iterator vp;
-		for(vp = this->_VB.begin(); vp != this->_VB.end(); ++vp)
-			delete (*vp);
-	}
+		/// destructor
+		~Frobenius()
+		{
+			typename std::vector< const Companion<_Field>* >::iterator vp;
+			for(vp = this->_VB.begin(); vp != this->_VB.end(); ++vp)
+				delete (*vp);
+		}
+
 
+		template<typename _Tp1>
+		struct rebind {
+			typedef Frobenius<_Tp1> other;
+		};
 
-      template<typename _Tp1>
-      struct rebind
-      { typedef Frobenius<_Tp1> other; };
 
 
+	}; // class Frobenius
 
-  }; // class Frobenius
-  
 }// Namespace LinBox
-#endif
+
+#endif //__LINBOX_frobenius_H
+
diff --git a/linbox/blackbox/hilbert.h b/linbox/blackbox/hilbert.h
index 5e58774..db1b95c 100644
--- a/linbox/blackbox/hilbert.h
+++ b/linbox/blackbox/hilbert.h
@@ -1,3 +1,5 @@
+/* -*- 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
 /* linbox/blackbox/hilbert.h
  * Copyright (C) 2006 John P. May, B. David Saunders
  *
@@ -9,80 +11,90 @@
  * was written by Will Turner.
  *
  * See COPYING for license information.
-*/
+ */
 
+/*! @file blackbox/hilbert.h
+ * @ingroup blackbox
+ * @brief NO DESC
+ */
 
-#ifndef HILBERT_H_
-#define HILBERT_H_
+#ifndef __LINBOX_hilbert_H
+#define __LINBOX_hilbert_H
 
-#include<vector>
-#include<linbox/blackbox/jit-matrix.h>
+#include <vector>
+#include <linbox/blackbox/jit-matrix.h>
 
 
-namespace LinBox {
+namespace LinBox
+{
 
-/// The object needed to build a Hilbert matrix as a JIT matrix 
-template<typename _Field>
-class Hilbert_JIT_Entry {
+	/// The object needed to build a Hilbert matrix as a JIT matrix
+	template<typename _Field>
+	class Hilbert_JIT_Entry {
 
-  public:
-    typedef _Field Field;
-    typedef typename _Field::Element Element;
+	public:
+		typedef _Field Field;
+		typedef typename _Field::Element Element;
 
-/// set up vector of 1/(i+1) 
-    Hilbert_JIT_Entry(Field& F, size_t m, size_t n);
-  
-/// return 1/(i+j+2), zero based indexing.
-    Element& operator()(Element &entry, size_t i, size_t j) const 
-    {	return entry = _H[i+j+1]; }
+		/// set up vector of 1/(i+1)
+		Hilbert_JIT_Entry(Field& F, size_t m, size_t n);
 
-  private:
-    std::vector<Element> _H;
-  
-}; // Hilbert_JIT_Entry
-  
-template<typename _Field>
-Hilbert_JIT_Entry<_Field>::Hilbert_JIT_Entry(_Field& F, size_t m, size_t n) {
+		/// return 1/(i+j+2), zero based indexing.
+		Element& operator()(Element &entry, size_t i, size_t j) const
+		{
+			return entry = _H[i+j+1];
+		}
 
-  Element temp, one;
-  F.init(one, 1);
-  F.init(temp, 0);
-  
-  _H = std::vector<Element>(m+n, temp);
+	private:
+		std::vector<Element> _H;
 
-  typename std::vector<Element>::iterator iter;
+	}; // Hilbert_JIT_Entry
 
-  // the ith entry of _H = 1/(i+1)
-  for (iter=_H.begin(); iter != _H.end(); iter++) {
-    F.addin(temp, one);
-    F.inv(*iter, temp);
-  }
-  
-}//constructor
+	/// constructor
+	template<typename _Field>
+	Hilbert_JIT_Entry<_Field>::Hilbert_JIT_Entry(_Field& F, size_t m, size_t n) {
 
+		Element temp, one;
+		F.init(one, 1);
+		F.init(temp, 0);
 
-/** \brief Example of a blackbox that is space efficient, though not time efficient.
+		_H = std::vector<Element>(m+n, temp);
 
-\ingroup blackbox
+		typename std::vector<Element>::iterator iter;
 
-Blackbox for the matrix whose i,j entry is 1/(i+j), i in 1..n, j in 1..n.
+		// the ith entry of _H = 1/(i+1)
+		for (iter=_H.begin(); iter != _H.end(); iter++) {
+			F.addin(temp, one);
+			F.inv(*iter, temp);
+		}
 
-*/
-template<typename _Field>
-class Hilbert : public JIT_Matrix<_Field, Hilbert_JIT_Entry<_Field> > {
+	}//constructor
 
-  public:
-  /** Constructor from field and size.
-	* @param n size_t integer number of rows and columns of matrix.
-	*/
-    Hilbert(_Field& F, size_t n) : 
-      JIT_Matrix<_Field, Hilbert_JIT_Entry<_Field> >(F, n, n, Hilbert_JIT_Entry<_Field>(F, n, n)) 
-	{};
-  
-};
+
+	/** \brief Example of a blackbox that is space efficient, though not time efficient.
+	 *
+	 *  \ingroup blackbox
+	 *
+	 *  Blackbox for the matrix whose i,j entry is 1/(i+j), i in 1..n, j in 1..n.
+	 *
+	 */
+	template<typename _Field>
+	class Hilbert : public JIT_Matrix<_Field, Hilbert_JIT_Entry<_Field> > {
+
+	public:
+		/** Constructor from field and size.
+		 * @param F the field.
+		 * @param n the size : size_t integer number of rows and columns of matrix.
+		 */
+		Hilbert(_Field& F, size_t n) :
+			JIT_Matrix<_Field, Hilbert_JIT_Entry<_Field> >(F, n, n, Hilbert_JIT_Entry<_Field>(F, n, n))
+		{};
+
+	};
 
 
 
 }//LinBox Namespace
 
-#endif
+#endif //__LINBOX_hilbert_H
+
diff --git a/linbox/blackbox/inverse.h b/linbox/blackbox/inverse.h
index 6f7df5b..a7571c2 100644
--- a/linbox/blackbox/inverse.h
+++ b/linbox/blackbox/inverse.h
@@ -1,5 +1,5 @@
-
-
+/* -*- 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
 /* linbox/blackbox/inverse.h
  * Copyright (C) 2001 Bradford Hovinen
  *
@@ -21,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __INVERSE_H
-#define __INVERSE_H
+#ifndef __LINBOX_inverse_H
+#define __LINBOX_inverse_H
 
 #include <linbox/blackbox/blackbox-interface.h>
 #include "linbox/blackbox/transpose.h"
@@ -38,35 +38,34 @@ namespace LinBox
 	 * \ingroup blackbox
 	 *
 	 * The matrix itself is not stored in memory.  Rather, its apply
-	 * methods use a vector of {@link Fields field} elements, which are 
+	 * methods use a vector of @link Fields field at endlink elements, which are
 	 * used to "multiply" the matrix to a vector.
-	 * 
-	 * This class has three template parameters.  The first is the field in 
-	 * which the arithmetic is to be done.  The second is the type of 
-	 * \ref{LinBox} vector to which to apply the matrix.  The 
-	 * third is chosen be default to be the \ref{LinBox} vector trait
-	 * of the vector.  This class is then specialized for dense and sparse 
+	 *
+	 * This class has three template parameters.  The first is the field in
+	 * which the arithmetic is to be done.  The second is the type of
+	 * \ref LinBox vector to which to apply the matrix.  The
+	 * third is chosen be default to be the \ref LinBox vector trait
+	 * of the vector.  This class is then specialized for dense and sparse
 	 * vectors.
 	 *
-	 * @param Field \ref{LinBox} field
-	 * @param Vector \ref{LinBox} dense or sparse vector of field elements
-	 * @param Trait  Marker whether to use dense or sparse LinBox vector 
-	 *               implementation.  This is chosen by a default parameter 
+	 * @param Field \ref LinBox field
+	 * @param Vector \ref LinBox dense or sparse vector of field elements
+	 * @param Trait  Marker whether to use dense or sparse LinBox vector
+	 *               implementation.  This is chosen by a default parameter
 	 *               and partial template specialization.  */
 	template <class Blackbox>
-	class Inverse : public BlackboxInterface
-	{
-	    public:
+	class Inverse : public BlackboxInterface {
+	public:
 
 		typedef typename Blackbox::Field Field;
 		typedef typename Field::Element   Element;
 		typedef std::vector<Element>      Polynomial;
 
 		/** Constructor from field and dense vector of field elements.
-		 * @param __BB   Black box of which to get the inverse
+		 * @param BB   Black box of which to get the inverse
 		 */
-		Inverse (const Blackbox *BB)
-		    :  _VD (BB->field()), _BB (BB)
+		Inverse (const Blackbox *BB) :
+			_VD (BB->field()), _BB (BB)
 		{
 			linbox_check ((BB->rowdim ()) == (BB->coldim ()));
 
@@ -80,8 +79,8 @@ namespace LinBox
 		 * minimal polynomial every time this black box is used inside
 		 * another black box
 		 */
-		Inverse (const Inverse &BB)
-		    : _VD (BB->field()), _BB (BB._BB), _minpoly (BB._minpoly)
+		Inverse (const Inverse &BB) :
+			_VD (BB->field()), _BB (BB._BB), _minpoly (BB._minpoly)
 		{
 			_z.resize (_BB->coldim ());
 		}
@@ -89,16 +88,16 @@ namespace LinBox
 
 		/** Application of BlackBox matrix.
 		 * y= A*x.
-		 * Requires one vector conforming to the \ref{LinBox}
-		 * vector {@link Archetypes archetype}.
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
 		 * Required by abstract base class.
 		 * @return reference to vector y containing output.
 		 * @param  y reference to vector into which to store the result
 		 * @param  x constant reference to vector to contain input
 		 */
 		template<class OutVector, class InVector>
-	        OutVector& apply (OutVector &y, const InVector& x) const
-	        {
+		OutVector& apply (OutVector &y, const InVector& x) const
+		{
 			int i;
 
 			if (_minpoly.empty ()) {
@@ -126,15 +125,16 @@ namespace LinBox
 			}
 
 			return y;
-	        }
+		}
 
 		/** Application of BlackBox matrix transpose.
-		 * y= transpose(A)*x.
-		 * Requires one vector conforming to the \ref{LinBox}
-		 * vector {@link Archetypes archetype}.
+		 * \f$ y= A^t \cdot  x.\f$
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
 		 * Required by abstract base class.
 		 * @return reference to vector y containing output.
 		 * @param  x constant reference to vector to contain input
+		 * @param y
 		 */
 		template<class OutVector, class InVector>
 		OutVector& applyTranspose (OutVector &y, const InVector& x) const
@@ -170,9 +170,9 @@ namespace LinBox
 			return y;
 		}
 
-            template<typename _Tp1>
-            struct rebind
-            { typedef Inverse<typename Blackbox::template rebind<_Tp1>::other> other; };
+		template<typename _Tp1>
+		struct rebind
+		{ typedef Inverse<typename Blackbox::template rebind<_Tp1>::other> other; };
 
 
 		/** Retreive row dimensions of BlackBox matrix.
@@ -184,7 +184,7 @@ namespace LinBox
 		{
 			return _BB->rowdim ();
 		}
-    
+
 		/** Retreive column dimensions of BlackBox matrix.
 		 * Required by abstract base class.
 		 * @return integer number of columns of black box matrix.
@@ -194,8 +194,9 @@ namespace LinBox
 			return _BB->coldim ();
 		}
 
-		const Field& field() const { return _BB->field();}
-	    private:
+		const Field& field() const
+		{ return _BB->field();}
+	private:
 
 		const VectorDomain<Field>  _VD;
 		const Blackbox             *_BB;
@@ -210,4 +211,5 @@ namespace LinBox
 
 } // namespace LinBox
 
-#endif // __INVERSE_H
+#endif // __LINBOX_inverse_H
+
diff --git a/linbox/blackbox/jit-matrix.h b/linbox/blackbox/jit-matrix.h
index 659213b..7b457e6 100644
--- a/linbox/blackbox/jit-matrix.h
+++ b/linbox/blackbox/jit-matrix.h
@@ -1,69 +1,69 @@
 /* -*- 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
 /* linbox/blackbox/jit-matrix.h
+ * Copyright (c) LinBox
  *
  * bds, jpm
  *
  * See COPYING for license information.
  */
 
-#ifndef __JITMATRIX_H
-#define __JITMATRIX_H
+#ifndef __LINBOX_jitmatrix_H
+#define __LINBOX_jitmatrix_H
 
 #include <linbox/blackbox/blackbox-interface.h>
 
 namespace LinBox
 {
 
-	/** 
+	/**
+
+	  \brief   Example of a blackbox that is space efficient, though not time efficient.
 
-\brief   Example of a blackbox that is space efficient, 
-                   though not time efficient.
+	  \ingroup blackbox
+	  Just In Time Matrix.
 
-\ingroup blackbox
-	 Just In Time Matrix.
-	 
-	 The matrix itself is not stored in memory.  Rather, an EntryGenerator 
-         function is called to provide the entries.  The entry generator is 
-         called once for each entry during an apply or applyTranspose 
-         operation.  
+	  The matrix itself is not stored in memory.  Rather, an EntryGenerator
+	  function is called to provide the entries.  The entry generator is
+	  called once for each entry during an apply or applyTranspose
+	  operation.
 
-	 An toy example of its use is the Hilbert matrix, whose i,j entry is 
-         generated by the formula 1/(i+j+2) in zero based indexing.  
-		 The motivating examples were matrices also defined by formula, the Paley type matrices.  
-		 \cite{MSW07}% ISSAC 07 paper
-		 In that context block structured turned out to be essential and the 
-         JIT_Matrix class is primarily intended for block structured matrices, 
-         the JIT entries being matrix blocks.
+	  An toy example of its use is the Hilbert matrix, whose \f$i,j\f$ entry is
+	  generated by the formula \f$1/(i+j+2)\f$ in zero based indexing.
+	  The motivating examples were matrices also defined by formula, the Paley type matrices.
+	  \sa{MSW07}% ISSAC 07 paper
+	  In that context block structured turned out to be essential and the
+	  JIT_Matrix class is primarily intended for block structured matrices,
+	  the JIT entries being matrix blocks.
 
- at param The _Field only need provide the init() and axpyin() functions.
+	  @param _Field only need provide the \c init() and \c axpyin() functions.
 
- at param The JIT_EntryGenerator gen() is a function object defining the 
-       matrix by  providing gen(e, i, j) which sets field element e to the i,j entry 
-       of the matrix. Indexing is zero based.
+	  @param JIT_EntryGenerator \c gen() is a function object defining the
+	  matrix by  providing <code>gen(e, i, j)</code> which sets field element e to the \c i,j entry
+	  of the matrix. Indexing is zero based.
 
-	 */
+*/
 
 
 	template <class _Field, class JIT_EntryGenerator>
-	class JIT_Matrix
-	{
-	  public:
+	class JIT_Matrix {
+	public:
 
 		typedef _Field Field;
 		typedef typename Field::Element Element;
 		typedef MatrixCategories::BlackboxTag MatrixCategory;
 
-/**
- * m by n matrix is constructed.  
- * JIT(Field::Element& e, size_t i, size_t j) is a function object which 
- * assigns the i,j entry to e (and returns a reference to e) 
- * and must be valid for 0 <= i < m, 0 <= j < n.
- **/
+		/**
+		 * m by n matrix is constructed.
+		 * JIT(Field::Element& e, size_t i, size_t j) is a function object which
+		 * assigns the i,j entry to e (and returns a reference to e)
+		 * and must be valid for 0 <= i < m, 0 <= j < n.
+		 **/
 
-		JIT_Matrix (_Field& F, const size_t m, const size_t n, 
-                            const JIT_EntryGenerator& JIT)
-		: _F(F), _m(m), _n(n), _gen(JIT){};
+		JIT_Matrix (_Field& F, const size_t m, const size_t n,
+			    const JIT_EntryGenerator& JIT) :
+			_F(F), _m(m), _n(n), _gen(JIT)
+		{};
 
 		template<class OutVector, class InVector>
 		OutVector& apply (OutVector& y, const InVector& x) ;
@@ -73,11 +73,11 @@ namespace LinBox
 		template<class OutVector, class InVector>
 		OutVector& applyTranspose (OutVector& y, const InVector& x);
 		//OutVector& applyTranspose (OutVector& y, const InVector& x) const;
-		size_t rowdim (void) const { return _m; } 
-		size_t coldim (void) const { return _n; } 
+		size_t rowdim (void) const { return _m; }
+		size_t coldim (void) const { return _n; }
 		const Field& field() const { return _F; }
 
-      protected:
+	protected:
 
 		// Field for arithmetic
 		Field _F;
@@ -90,36 +90,34 @@ namespace LinBox
 		JIT_EntryGenerator _gen;
 
 	}; // class JIT_Matrix
-   
 
-	// Method implementations 
- 
+
+	// Method implementations
+
 	template <class Field, class JIT_EntryGenerator>
 	template <class OutVector, class InVector>
-	inline OutVector& JIT_Matrix<Field, JIT_EntryGenerator>
-		::apply (OutVector& y, const InVector& x) 
-	{	Element entry;  _F.init(entry); 
+	inline OutVector& JIT_Matrix<Field, JIT_EntryGenerator>::apply (OutVector& y, const InVector& x)
+	{	Element entry;  _F.init(entry);
 		for (size_t i = 0; i < _m; ++i)
 		{   _F.init(y[i], 0);
-		    for (size_t j = 0; j < _n; ++j) 
-			{ 
-			    _gen(entry, i, j); 
+			for (size_t j = 0; j < _n; ++j)
+			{
+				_gen(entry, i, j);
 
-			    _F.axpyin (y[i], entry, x[j]); 
+				_F.axpyin (y[i], entry, x[j]);
 			}
 		}
 		return y;
-	} //apply 
+	} //apply
+
 
- 
 	template <class Field, class JIT_EntryGenerator>
 	template <class OutVector, class InVector>
-	inline OutVector& JIT_Matrix<Field, JIT_EntryGenerator>
-		::applyTranspose (OutVector& y, const InVector& x) 
+	inline OutVector& JIT_Matrix<Field, JIT_EntryGenerator>::applyTranspose (OutVector& y, const InVector& x)
 	{	Element entry;  _F.init(entry);
 		for (size_t i = 0; i < _m; ++i)
 		{   _F.init(y[i], 0);
-		    for (size_t j = 0; j < _n; ++j) 
+			for (size_t j = 0; j < _n; ++j)
 			{ _F.axpyin ( y[i], x[j], _gen(entry, j, i) ); }
 		}
 		return y;
@@ -127,26 +125,28 @@ namespace LinBox
 
 
 
-// Example: Generator to create psuedo-random entries
-// !WARNING! repeated calls will give different values for the same entry
-        
+	// Example: Generator to create psuedo-random entries
+	// !WARNING! repeated calls will give different values for the same entry
+
 	template < class Field >
-	class JIT_RandomEntryGenerator 
-	{
+	class JIT_RandomEntryGenerator {
 		typename Field::RandIter _r;
-                size_t _b;
+		size_t _b;
 
-          public:
-		JIT_RandomEntryGenerator(Field& F, size_t b):_r(F), _b(b) {}
+	public:
+		JIT_RandomEntryGenerator(Field& F, size_t b) :
+			_r(F), _b(b)
+		{}
 
 		typename Field::Element& operator()(typename Field::Element& e,
-                   size_t k,  size_t l) 
+						    size_t k,  size_t l)
 		{
 			return _r.random(e);
 		}
 	};
-  
+
 
 } // namespace LinBox
 
-#endif // _JITMATRIX_H
+#endif // __LINBOX_jitmatrix_H
+
diff --git a/linbox/blackbox/lambda-sparse.h b/linbox/blackbox/lambda-sparse.h
index 8b2e1bb..6f5798d 100644
--- a/linbox/blackbox/lambda-sparse.h
+++ b/linbox/blackbox/lambda-sparse.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* linbox/blackbox/lambda-sparse.h
  * Copyright (C) 2004 Pascal Giorgi
  *
@@ -21,8 +22,8 @@
  */
 
 
-#ifndef __LINBOX_LAMBDA_SPARSE_H
-#define __LINBOX_LAMBDA_SPARSE_H
+#ifndef __LINBOX_lambda_sparse_H
+#define __LINBOX_lambda_sparse_H
 
 #include <linbox/blackbox/sparse.h>
 #include <linbox/blackbox/archetype.h>
@@ -30,90 +31,94 @@
 #include <linbox/vector/vector-traits.h>
 #include <linbox/integer.h>
 
-namespace LinBox {
+namespace LinBox
+{
 
 
-/// \ingroup blackbox
+	/// \ingroup blackbox
 	template< class _Field,
-		  class _Row = typename LinBox::Vector<_Field>::SparseSeq > 
+	class _Row = typename Vector<_Field>::SparseSeq >
 	class LambdaSparseMatrix : public SparseMatrix<_Field,_Row> {
 
 	public:
-		
+
 		typedef _Row Row;
 		typedef _Field Field;
 
-            template<typename _Tp1, typename _Rw1 = _Row>
-            struct rebind
-            { typedef LambdaSparseMatrix<_Tp1, _Rw1> other; };
+		template<typename _Tp1, typename _Rw1 = _Row>
+		struct rebind
+		{ typedef LambdaSparseMatrix<_Tp1, _Rw1> other; };
 
 		// Contructor of a lambda-sparse matrix as defined in Mulder 2003
 		// with non-zero elements choosen from entire Field
-		LambdaSparseMatrix(const Field& F,size_t m, size_t n, double LAMBDA = 3.) 
-			:  SparseMatrix<Field,Row> (F,m,n) {
-			
+		LambdaSparseMatrix(const Field& F,size_t m, size_t n, double LAMBDA = 3.) :
+			SparseMatrix<Field,Row> (F,m,n)
+		{
+
 			integer card;
 			F.cardinality (card);
 			typename Field::RandIter _randiter(F);
 			double                   init_p = 1.0 - 1.0 / (double) card;
 			double                   log_m = LAMBDA * log ((double) m) / M_LN2;
-			double                   new_p;						
-			
-			RandomSparseStream<Field,typename LinBox::Vector<Field>::SparseSeq> stream (F, _randiter, init_p, n, m );
-			
+			double                   new_p;
+
+			RandomSparseStream<Field,typename Vector<Field>::SparseSeq> stream (F, _randiter, init_p, n, m );
+
 			for (unsigned int i = 0; i < m; ++i) {
 				new_p = log_m / double(m - i);
-				
+
 				if (init_p < new_p)
 					stream.setP (init_p);
 				else
 					stream.setP (new_p);
-				
+
 				stream >> this->getRow (i);
 			}
 		}
 
 		// Contructor of a lambda-sparse matrix as defined in Mulder 2003
 		// with non-zero elements choosen from a subset of the Field
-		LambdaSparseMatrix(const Field& F,size_t m, size_t n,const integer size, double LAMBDA = 3.) 
-			: SparseMatrix<Field,Row> (F,m,n)  {
+		LambdaSparseMatrix(const Field& F,size_t m, size_t n,const integer size, double LAMBDA = 3.) :
+			SparseMatrix<Field,Row> (F,m,n)
+		{
 
 			typename Field::RandIter _randiter(F,size,0);
 			double init_p = 1.0 - 1.0 / (double) size;
 			double log_m = LAMBDA * log ((double) m) / M_LN2;
-			double new_p;						
-			
-			RandomSparseStream<Field,typename LinBox::Vector<Field>::SparseSeq> stream (F, _randiter, init_p, n, m );
-			
+			double new_p;
+
+			RandomSparseStream<Field,typename Vector<Field>::SparseSeq> stream (F, _randiter, init_p, n, m );
+
 			for (unsigned int i = 0; i < m; ++i) {
 				new_p = log_m / double(m - i);
-				
+
 				if (init_p < new_p)
 					stream.setP (init_p);
 				else
 					stream.setP (new_p);
-				
+
 				stream >> this->getRow (i);
 			}
 		}
 
 
 		// Copy constructor
-		LambdaSparseMatrix (const LambdaSparseMatrix<Field,Row>& L)
-			: SparseMatrix<Field,Row>(L) {}
+		LambdaSparseMatrix (const LambdaSparseMatrix<Field,Row>& L) :
+			SparseMatrix<Field,Row>(L)
+		{}
 
 
 		// Copy constructor from a LambdaSparseMatrix over a Ring
 		// allow the mod p reduction for all entries.
 		template<class _Ring, class _IRow>
-		LambdaSparseMatrix (const Field& F, const LambdaSparseMatrix<_Ring,_IRow>& L)
-			: SparseMatrix<Field,Row> (F,L.rowdim(),L.coldim())
+		LambdaSparseMatrix (const Field& F, const LambdaSparseMatrix<_Ring,_IRow>& L) :
+			SparseMatrix<Field,Row> (F,L.rowdim(),L.coldim())
 		{
-			
+
 			//typename LambdaSparseMatrix<_Ring,_IRow>::ConstRawIterator Liter = L.rawBegin();
 			typename LambdaSparseMatrix<_Ring,_IRow>::ConstRawIndexedIterator Literindex = L.rawIndexedBegin();
-			
-			integer tmp;			
+
+			integer tmp;
 			_Ring r= L.field();
 			for (;  Literindex!=L.rawIndexedEnd();  ++Literindex) {
 				r.convert(tmp,*Literindex);
@@ -124,24 +129,26 @@ namespace LinBox {
 		}
 
 		// return the norm of the matrix (= the maximum value)
-		integer& Norm(integer& norm) {
+		integer& Norm(integer& norm)
+		{
 			typename Field::Element max;
-	// Dan Roche 7-20-04 added typename here to stop compiler warning
+			// Dan Roche 7-20-04 added typename here to stop compiler warning
 			typename LambdaSparseMatrix<_Field,_Row>::ConstRawIterator iter= this->rawBegin();
 			max = *iter;
 			for (; iter != this->rawEnd(); ++iter)
 				if (*iter > max) max=*iter;
-			
+
 			this->_F.convert(norm,max);
 			return norm;
 		}
-		
-	
-    
-    
-  }; //end of class LambdaSparseMatrix
+
+
+
+
+	}; //end of class LambdaSparseMatrix
 
 } //end of namespace LinBox
 
-#endif
+#endif //__LINBOX_lambda_sparse_H
+
 
diff --git a/linbox/blackbox/matrix-blackbox.h b/linbox/blackbox/matrix-blackbox.h
index 87c3b49..f9d3ade 100644
--- a/linbox/blackbox/matrix-blackbox.h
+++ b/linbox/blackbox/matrix-blackbox.h
@@ -1,17 +1,17 @@
 /* -*- 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
 /* linbox/blackbox/matrix-blackbox.h
  * Copyright (C) 2003 Bradford Hovinen
  *
  * Written by Bradford Hovinen <bghovinen at math.uwaterloo.ca>
  *
  * --------------------------------------------------------
- * 
+ *
  * See COPYING for license information.
  */
 
-#ifndef __MATRIX_BLACKBOX_H
-#define __MATRIX_BLACKBOX_H
+#ifndef __LINBOX_matrix_blackbox_H
+#define __LINBOX_matrix_blackbox_H
 
 #include <linbox/blackbox/blackbox-interface.h>
 #include "linbox/blackbox/archetype.h"
@@ -24,156 +24,165 @@
 namespace LinBox
 {
 
-/** \brief Matrix black box
- *
-\ingroup blackbox
- * This class wraps a matrix meeting the @ref{MatrixArchetype} interface into a
- * black box meeting the @ref{BlackboxArchetype} interface. It uses
- * @ref{MatrixDomain} to implement @code{apply} and @code{applyTranspose}.
- */
-
-template <class _Field, class _Matrix, class _Vector = typename LinBox::Vector<_Field>::Dense>
-class MatrixBlackbox : public BlackboxArchetype
-{
-    public:
-
-	typedef _Vector                 Vector;
-	typedef _Matrix                 Matrix;
-	typedef _Field                  Field;
-	typedef typename Field::Element Element;
-
-	/** Constructor.
-	 *
-	 * Builds a black box for the matrix given by @code{rep} over the field
-	 * @code{F} 
-	 *
-	 * @param  F  Field over which entries exist
-	 * @param  rep  Matrix from which to construct the black box
-	 */
-	MatrixBlackbox (const Field &F, Matrix &rep)
-		: _F (F), _MD (F), _A (rep) {}
-
-	/** Constructor with size
+	/** \brief Matrix black box
 	 *
-	 * Builds a black box with the given dimensions
-	 *
-	 * @param  F  Field over which entries exist
-	 * @param  m  Row dimension
-	 * @param  n  Column dimension
-	 */
-	MatrixBlackbox (const Field &F, size_t m, size_t n)
-		: _F (F), _MD (F), _A (m, n) {}
-
-	/** Constructor
-	 *
-	 * Builds a black box, using the vector stream @code{stream} to fill in
-	 * its entries
-	 *
-	 * @param  F  Field over which entries exist
-	 * @param  stream  Stream with which to generate row vectors
-	 */
-	template <class Row>
-	MatrixBlackbox (const Field &F, VectorStream<Row> &stream)
-		: _F (F), _MD (F), _A (stream) {}
-
-	/** Copy constructor
+	 \ingroup blackbox
+	 * This class wraps a matrix meeting the @ref MatrixArchetype  interface into a
+	 * black box meeting the @ref BlackboxArchetype interface. It uses
+	 * @ref MatrixDomain to implement \c apply and \c applyTranspose.
 	 */
-	MatrixBlackbox (const MatrixBlackbox &B)
-		: _F (B._F), _MD (B._F), _A (B._A) {}
-
-	/** Destructor. */
-	~MatrixBlackbox () {}
-
-
-    template<typename _Tp1, 
-             typename _Mat1 = typename Matrix::template rebind<_Tp1>::other, 
-             typename _Vect1 = typename Rebind<Vector, _Tp1>::other >
-    struct rebind
-    { typedef MatrixBlackbox<_Tp1, _Mat1, _Vect1> other; };
-
 
-
-	/** Create a clone of the matrix
-	 */
-	inline BlackboxArchetype *clone () const
+	template <class _Field, class _Matrix, class _Vector = typename LinBox::Vector<_Field>::Dense>
+	class MatrixBlackbox : public BlackboxArchetype {
+	public:
+
+		typedef _Vector                 Vector;
+		typedef _Matrix                 Matrix;
+		typedef _Field                  Field;
+		typedef typename Field::Element Element;
+
+		/** Constructor.
+		 *
+		 * Builds a black box for the matrix given by \p rep over the field
+		 * \p F
+		 *
+		 * @param  F  Field over which entries exist
+		 * @param  rep  Matrix from which to construct the black box
+		 */
+		MatrixBlackbox (const Field &F, Matrix &rep) :
+			_F (F), _MD (F), _A (rep)
+		{}
+
+		/** Constructor with size
+		 *
+		 * Builds a black box with the given dimensions
+		 *
+		 * @param  F  Field over which entries exist
+		 * @param  m  Row dimension
+		 * @param  n  Column dimension
+		 */
+		MatrixBlackbox (const Field &F, size_t m, size_t n) :
+			_F (F), _MD (F), _A (m, n)
+		{}
+
+		/** Constructor
+		 *
+		 * Builds a black box, using the vector stream \p stream to fill in
+		 * its entries
+		 *
+		 * @param  F  Field over which entries exist
+		 * @param  stream  Stream with which to generate row vectors
+		 */
+		template <class Row>
+		MatrixBlackbox (const Field &F, VectorStream<Row> &stream) :
+			_F (F), _MD (F), _A (stream)
+		{}
+
+		/** Copy constructor
+		*/
+		MatrixBlackbox (const MatrixBlackbox &B) :
+			_F (B._F), _MD (B._F), _A (B._A)
+		{}
+
+		/** Destructor. */
+		~MatrixBlackbox () {}
+
+
+		template<typename _Tp1,
+		typename _Mat1 = typename Matrix::template rebind<_Tp1>::other,
+		typename _Vect1 = typename Rebind<Vector, _Tp1>::other >
+		struct rebind {
+			typedef MatrixBlackbox<_Tp1, _Mat1, _Vect1> other;
+		};
+
+
+
+		/** Create a clone of the matrix
+		*/
+		inline BlackboxArchetype *clone () const
 		{ return new MatrixBlackbox (*this); }
 
-	/** Generic matrix-vector product
-	 * y = A x.
-	 * @return reference to output vector y
-	 * @param  x input vector
-	 */
-	template <class Vector1, class Vector2>
-	inline Vector1 &apply (Vector1 &y, const Vector2 &x) const
+		/** Generic matrix-vector product
+		 * \f$ y = A x\f$.
+		 * @return reference to output vector y
+		 * @param  x input vector
+		 * @param y
+		 */
+		template <class Vector1, class Vector2>
+		inline Vector1 &apply (Vector1 &y, const Vector2 &x) const
 		{ return _MD.vectorMul (y, _A, x); }
 
-	/** Matrix-vector product
-	 * y = A x.
-	 * @return reference to output vector y
-	 * @param  x input vector
-	 */
-	inline Vector &apply (Vector &y, const Vector &x) const
+		/** Matrix-vector product
+		 * \f$y = A x\f$.
+		 * @return reference to output vector y
+		 * @param  x input vector
+		 * @param y
+		 */
+		inline Vector &apply (Vector &y, const Vector &x) const
 		{ return apply<Vector, Vector> (y, x); }
 
-	/** Generic transpose matrix-vector product
-	 * y = A^T x.
-	 * @return reference to output vector y
-	 * @param  x input vector
-	 */
-	template <class Vector1, class Vector2>
-	inline Vector1 &applyTranspose (Vector1 &y, const Vector2 &x) const
+		/** Generic transpose matrix-vector product
+		 * \f$y = A^T x\f$.
+		 * @return reference to output vector y
+		 * @param  x input vector
+		 * @param y
+		 */
+		template <class Vector1, class Vector2>
+		inline Vector1 &applyTranspose (Vector1 &y, const Vector2 &x) const
 		{ return _MD.vectorMul (y, TransposeMatrix<const Matrix> (_A), x); }
 
-	/** Transpose matrix-vector product
-	 * y = A^T x.
-	 * @return reference to output vector y
-	 * @param  x input vector
-	 */
-	inline Vector &applyTranspose (Vector &y, const Vector &x) const
+		/** Transpose matrix-vector product
+		 * \f$y = A^T x\f$.
+		 * @return reference to output vector y
+		 * @param  x input vector
+		 * @param y
+		 */
+		inline Vector &applyTranspose (Vector &y, const Vector &x) const
 		{ return applyTranspose<Vector, Vector> (y, x); }
 
-	/** Retreive row dimensions of Sparsemat matrix.
-	 * @return integer number of rows of SparseMatrix0Base matrix.
-	 */
-	inline size_t rowdim () const
+		/** Retreive row dimensions of Sparsemat matrix.
+		 * @return integer number of rows of SparseMatrix0Base matrix.
+		 */
+		inline size_t rowdim () const
 		{ return _A.rowdim (); }
 
-	/** Retreive column dimensions of Sparsemat matrix.
-	 * @return integer number of columns of SparseMatrix0Base matrix.
-	 */
-	inline size_t coldim () const
+		/** Retreive column dimensions of Sparsemat matrix.
+		 * @return integer number of columns of SparseMatrix0Base matrix.
+		 */
+		inline size_t coldim () const
 		{ return _A.coldim (); }
 
-	/** Read the matrix from a stream
-	 * @param is Input stream from which to read the matrix
-	 * @return Reference to input stream
-	 */
-	inline std::istream &read (std::istream &is)
+		/** Read the matrix from a stream
+		 * @param is Input stream from which to read the matrix
+		 * @return Reference to input stream
+		 */
+		inline std::istream &read (std::istream &is)
 		{ return _MD.read (is, _A); }
 
-	/** Write the matrix to a stream
-	 * @param os Output stream to which to write the matrix
-	 * @return Reference to output stream
-	 */
-	inline std::ostream &write (std::ostream &os) const
+		/** Write the matrix to a stream
+		 * @param os Output stream to which to write the matrix
+		 * @return Reference to output stream
+		 */
+		inline std::ostream &write (std::ostream &os) const
 		{ return _MD.write (os, _A); }
 
-	/** Return a reference to the base field
-	 */
-	inline const Field &field () const { return _F;}
+		/** Return a reference to the base field
+		*/
+		inline const Field &field () const { return _F;}
 
-	/** Return a reference to the underlying representation
-	 */
-	inline Matrix &rep () { return _A; }
+		/** Return a reference to the underlying representation
+		*/
+		inline Matrix &rep () { return _A; }
 
-    private:
+	private:
 
-	const Field         &_F;      // Field used for all arithmetic
-	MatrixDomain<Field>  _MD;     // Matrix domain for matrix-vector
-				      // operations
-	Matrix               _A;      // Underlying matrix representation
-};
+		const Field         &_F;      // Field used for all arithmetic
+		MatrixDomain<Field>  _MD;     // Matrix domain for matrix-vector
+		// operations
+		Matrix               _A;      // Underlying matrix representation
+	};
 
 } // namespace LinBox
 
-#endif // __MATRIX_BLACKBOX_H
+#endif // __LINBOX_matrix_blackbox_H
+
diff --git a/linbox/blackbox/moore-penrose.h b/linbox/blackbox/moore-penrose.h
index 947b2cf..f7848ba 100644
--- a/linbox/blackbox/moore-penrose.h
+++ b/linbox/blackbox/moore-penrose.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/blackbox/moore-penrose.h
  * Copyright (C) 2001 Bradford Hovinen
  *
@@ -21,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __MOORE_PENROSE_H
-#define __MOORE_PENROSE_H
+#ifndef __LINBOX_moore_penrose_H
+#define __LINBOX_moore_penrose_H
 
 #include <linbox/blackbox/blackbox-interface.h>
 #include "linbox/blackbox/submatrix.h"
@@ -39,40 +39,42 @@ namespace LinBox
 
 	/** \brief Generalized inverse of a blackbox.  Efficiency concerns when many applications are used.
 	 *
-\ingroup blackbox
+	 \ingroup blackbox
 	 * Given an arbitrary matrix in black box representation, this black box
 	 * represents the Moore-Penrose inverse of the matrix.
 	 *
 	 * This implementation assumes that A already has a nonsingular
 	 * principal r x r minor. It is the caller's responsibility to ensure
 	 * that that condition holds.
-	 * 
-	 * Given MoorePenrose M(A, r), and vector b, we have that M.apply(u, b) provides 
+	 *
+	 * Given MoorePenrose M(A, r), and vector b, we have that M.apply(u, b) provides
 	 * the least norm, least squares solution x = u to Ax = b.
 	 *
 	 * TODO: remove the requirement that lpm is nonsingular.  Specialize for dense matrices.
 	 */
 	template <class Blackbox>
-	class MoorePenrose : public BlackboxInterface
-	{
-	    public:
+	class MoorePenrose : public BlackboxInterface {
+	public:
 
 		typedef typename Blackbox::Field Field;
 		typedef typename Blackbox::Element Element;
-            template<typename _Tp1>
-            struct rebind
-            { typedef MoorePenrose<typename Blackbox::template rebind<_Tp1>::other> other; };
+		template<typename _Tp1>
+		struct rebind {
+		       	typedef MoorePenrose<typename Blackbox::template rebind<_Tp1>::other> other;
+		};
 
 
 		/** Constructor from field and dense vector of field elements.
-		 * @param BB   Black box from which to extract the submatrix
-		 * @param row  First row of the submatrix to extract (1.._BB->rowdim ())
-		 * @param col  First column of the submatrix to extract (1.._BB->coldim ())
-		 * @param rowdim Row dimension
-		 * @param coldim Column dimension
+		 * -param BB   Black box from which to extract the submatrix
+		 * -param row  First row of the submatrix to extract (1.._BB->rowdim ())
+		 * -param col  First column of the submatrix to extract (1.._BB->coldim ())
+		 * -param rowdim Row dimension
+		 * -param coldim Column dimension
+		 *  @param A
+		 *  @param rank
 		 */
-		MoorePenrose (const Blackbox *A, size_t rank)
-			: _A (A), _rank (rank)
+		MoorePenrose (const Blackbox *A, size_t rank) :
+			_A (A), _rank (rank)
 		{
 			_B1 = new Submatrix<Blackbox> (_A, 0, 0, rank, rank);
 			_F = new Submatrix<Blackbox> (_A, 0, 0, _A->rowdim (), rank);
@@ -86,9 +88,9 @@ namespace LinBox
 		}
 
 		/** Copy constructor
-		 */
-		MoorePenrose (const MoorePenrose &A)
-			: _A (A._A),
+		*/
+		MoorePenrose (const MoorePenrose &A) :
+			_A (A._A),
 			_B1 (A._B1),
 			_F (A._F),
 			_GG (A._GG),
@@ -99,10 +101,10 @@ namespace LinBox
 			_FTFinv (A._FTFinv),
 			_GGTinv (A._GGTinv),
 			_rank (A._rank)
-			{}
+		{}
 
 		/** Destructor
-		 */
+		*/
 		~MoorePenrose ()
 		{
 			delete _GGTinv;
@@ -116,18 +118,19 @@ namespace LinBox
 			delete _B1;
 		}
 
-	
+
 
 		/** Application of BlackBox matrix.
-		 * y= A*x.
-		 * Requires one vector conforming to the \ref{LinBox}
-		 * vector {@link Archetypes archetype}.
+		 * <code>y= A*x</code>.
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
 		 * Required by abstract base class.
 		 * @return reference to vector y containing output.
 		 * @param  x constant reference to vector to contain input
+		 * @param y
 		 */
 		template <class OutVector, class InVector>
-	        OutVector& apply (OutVector &y, const InVector& x) const
+		OutVector& apply (OutVector &y, const InVector& x) const
 		{
 			InVector _z1 (_rank);
 			InVector _z2 (_rank);
@@ -142,12 +145,13 @@ namespace LinBox
 		}
 
 		/** Application of BlackBox matrix transpose.
-		 * y= transpose(A)*x.
-		 * Requires one vector conforming to the \ref{LinBox}
-		 * vector {@link Archetypes archetype}.
+		 * <code>y= transpose(A)*x</code>.
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
 		 * Required by abstract base class.
 		 * @return reference to vector y containing output.
 		 * @param  x constant reference to vector to contain input
+		 * @param y
 		 */
 		template <class OutVector, class InVector>
 		OutVector& applyTranspose (OutVector &y, const InVector& x) const
@@ -170,18 +174,18 @@ namespace LinBox
 		 * @return integer number of _rows of black box matrix.
 		 */
 		size_t rowdim (void) const
-			{ return _A->coldim (); }
-    
+		{ return _A->coldim (); }
+
 		/** Retreive _column dimensions of BlackBox matrix.
 		 * Required by abstract base class.
 		 * @return integer number of _columns of black box matrix.
 		 */
 		size_t coldim (void) const
-			{ return _A->rowdim (); }
+		{ return _A->rowdim (); }
 
 		const Field& field() { return _A -> field(); }
 
-	    private:
+	private:
 
 		const Blackbox  *_A;
 		Submatrix<Blackbox>  *_B1;
@@ -195,8 +199,9 @@ namespace LinBox
 		Inverse<Compose<Submatrix<Blackbox>, Transpose<Submatrix<Blackbox> >  > >  *_GGTinv;
 
 		size_t     _rank;
-	}; 
+	};
 
 } // namespace LinBox
 
-#endif // __MOORE_PENROSE_H
+#endif // __LINBOX_moore_penrose_H
+
diff --git a/linbox/blackbox/ntl-hankel.h b/linbox/blackbox/ntl-hankel.h
index a6c22f5..c85711a 100644
--- a/linbox/blackbox/ntl-hankel.h
+++ b/linbox/blackbox/ntl-hankel.h
@@ -1,15 +1,16 @@
-/* -*- mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-
+/* -*- 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
 /* *******************************************************************
- *    ntl-hankel.h 
+ *    ntl-hankel.h
  * Copyright (C) 2003 Austin Lobo, B. David Saunders
  *    Template for Hankel specification for ntl Arithmetic
- *    Linbox version 2001 and 2002 from a version 
+ *    Linbox version 2001 and 2002 from a version
  *    Designed by A.Lobo and B.D. Saunders in 4/98
+ *    see COPYING for licence information
  *-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+*/
 
-#ifndef NTL_HANKEL_H
-#define NTL_HANKEL_H
+#ifndef __LINBOX_ntl_hankel_H
+#define __LINBOX_ntl_hankel_H
 
 #include <linbox/blackbox/blackbox-interface.h>
 #include "toeplitz.h" // we inherit everything from ntl-toeplitz
@@ -17,57 +18,57 @@
 //#define DBGMSGS 1
 
 /*-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- *   Partial Specialization of Hankel for Dense vectors from 
+ *   Partial Specialization of Hankel for Dense vectors from
  *   an FFT based on Shoup's NTL library. Extends toeplitz matrix
  *-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+*/
 
 namespace LinBox
 {
-/// \ingroup blackbox
-  template <class _Field>
-    class Hankel: public Toeplitz<_Field>
-    {
-    public:
-	typedef _Field Field;
-      typedef typename Field::Element Element;
-      
-        template<typename _Tp1>
-        struct rebind
-        { typedef Hankel<_Tp1> other; };
-
-      //------- CONSTRUCTORS AND DESTRUCTORS
-      
-      ~Hankel();                // Destructor
-      Hankel();                 // Zero Param Constructor
-      Hankel( const Field F,    // Cnstr. with Field and STL vec. of elems
-	      const std::vector<Element>&v);
-      //	  Hankel(char *dataFileName ); // read from a file
-      
-      //------- INHERITED READ-ONLY ACCESSOR, and OBSERVER METHODS 
-      
+	/// \ingroup blackbox
+	template <class _Field>
+	class Hankel: public Toeplitz<_Field> {
+	public:
+		typedef _Field Field;
+		typedef typename Field::Element Element;
+
+		template<typename _Tp1>
+		struct rebind
+		{ typedef Hankel<_Tp1> other; };
+
+		//------- CONSTRUCTORS AND DESTRUCTORS
+
+		~Hankel();                // Destructor
+		Hankel();                 // Zero Param Constructor
+		Hankel( const Field F,    // Cnstr. with Field and STL vec. of elems
+			const std::vector<Element>&v);
+		//	  Hankel(char *dataFileName ); // read from a file
+
+		//------- INHERITED READ-ONLY ACCESSOR, and OBSERVER METHODS
+
 		void   print( std::ostream& os = std::cout) const; // Print to stdout
 		void   print( char *outFileName) const;            // Print to file
-       /*      inline size_t this->rowdim() const;// Number of Rows
-		*      inline size_t this->coldim() const;// Number of Cols
-		*      inline size_t sysdim() const;// Max of rows & columns; 
-		*/
-
-      //------- MUTATOR METHODS
-      
-      void setToUniModUT() ;      // Convert to UTriang matrix with det 1
-      void setToUniModLT() ;      // Convert to LTriang matrix with det 1
-      
-      //------ SERVICE METHODS
+		/*      inline size_t this->rowdim() const;// Number of Rows
+		 *      inline size_t this->coldim() const;// Number of Cols
+		 *      inline size_t sysdim() const;// Max of rows & columns;
+		 */
+
+		//------- MUTATOR METHODS
+
+		void setToUniModUT() ;      // Convert to UTriang matrix with det 1
+		void setToUniModLT() ;      // Convert to LTriang matrix with det 1
+
+		//------ SERVICE METHODS
 		template<class OutVector, class InVector>
 		OutVector& apply( OutVector &v_out, const InVector& v_in) const;
 
 		template<class OutVector, class InVector>
 		OutVector& applyTranspose( OutVector &v_out, const InVector& v_in) const;
-      
-    }; //  class Hankel
-  
+
+	}; //  class Hankel
+
 } // namespace Linbox
 
-#include <linbox/blackbox/ntl-hankel.inl>     
+#include <linbox/blackbox/ntl-hankel.inl>
+
+#endif //__LINBOX_ntl_hankel_H
 
-#endif
diff --git a/linbox/blackbox/ntl-hankel.inl b/linbox/blackbox/ntl-hankel.inl
index d136bca..1a8c76b 100644
--- a/linbox/blackbox/ntl-hankel.inl
+++ b/linbox/blackbox/ntl-hankel.inl
@@ -1,27 +1,32 @@
-/* C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4  */
-
-/*-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
- *    ntl-hankel.inl     NTL_Hankel.cpp file 
+/* -*- 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
+/*-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *    ntl-hankel.inl     NTL_Hankel.cpp file
  *    Copyright (C) 2003 Austin Lobo, B. David Saunders
  *
- *    Author: Austin Lobo 
- *    Linbox version 2001 and 2002 
+ *    Author: Austin Lobo
+ *    Linbox version 2001 and 2002
  *
  *    This file is included in the template description of ntl-Hankel.h
- *    it contains the implementations of templatized member functions in the 
+ *    it contains the implementations of templatized member functions in the
  *    partial template  specialization for hankel matrices that
  *    are manipulated in fields and rings according to the arithmetic
  *    in the ntl package from V. Shoup
  *
+ *    see COPYING for license information
+ *
  *    Everything is in the Linbox namespace by virtue of the #include
  *    in ntl-Hankel.h
  *-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+*/
 
+#ifndef __LINBOX_bb_ntl_hankel_INL
+#define __LINBOX_bb_ntl_hankel_INL
+
 #include <iostream>
 #include <fstream>
 #include <NTL/ZZ_pX.h>
 
-namespace LinBox 
+namespace LinBox
 {
 	/*-----------------------------------------------------------------
 	 *----    Destructor
@@ -31,106 +36,106 @@ namespace LinBox
 	{
 #ifdef DBGMSGS
 		std::cout << "Hankel::~Hankel():\tDestroyed a " << this->rowDim << "x"<< this->colDim<<
-			" Hankel matrix "<< std::endl;
+						 " Hankel matrix "<< std::endl;
 #endif
-	}//---- Destructor ---- 
-	
-	
-	
+	}//---- Destructor ----
+
+
+
 	/*-----------------------------------------------------------------
-	 *----    Default Constructor    
+	 *----    Default Constructor
 	 *----------------------------------------------------------------*/
 	template <class Field>
-	Hankel<Field>::Hankel() 
+	Hankel<Field>::Hankel()
 	{
 		this->shape.shape(BlackboxSpecifier::HANKEL);
 #ifdef DBGMSGS
 		std::cout << "Hankel::Hankel():\tCreated a " << this->rowDim << "x"<< this->colDim<<
-			" Hankel matrix "<< std::endl;
+						" Hankel matrix "<< std::endl;
 #endif
-		
+
 	}//----- Zero Param Constructor ---- [Tested 6/14/02 -- Works]
-	
-	
-	
-	
+
+
+
+
 	/*-----------------------------------------------------------------
 	 *----- Constructor With User-Supplied First Row And Column
 	 *----------------------------------------------------------------*/
 	template <class Field>
 	Hankel<Field>::Hankel( const Field F,
-					   const std::vector<typename Field::Element>&v) 
+			       const std::vector<typename Field::Element>&v)
 	{
 		// Assumes that the input is a vector of ZZ_p else things will FAIL
-		if ( (1 & v.size()) == 0) 
+		if ( (1 & v.size()) == 0)
 		{
 			std::cout << "There must be an ODD number of entries in the input vector " <<
-				"The length given is " << v.size();
+			"The length given is " << v.size();
 		}
 		assert( (1 & v.size()) == 1);
-		
+
 		this->rowDim = (1+v.size())/2; // The vector is 0..2n-2;
 		this->colDim = (1+v.size())/2;
 		this->sysDim = (1+v.size())/2;
-		
+
 		this->pdata.SetMaxLength( v.size());
 		//		rpdata.SetMaxLength( v.size());
-		for (unsigned int i=0; i< v.size(); i++) 
+		for (unsigned int i=0; i< v.size(); i++)
 		{
 			this->P.setCoeff( this->pdata, i, v[i]);
 			//SetCoeff( rpdata, i, v[v.size()-1-i]);
 		}
-		
+
 #ifdef DBGMSGS
 		std::cout << "Hankel::Hankel(F,V):\tCreated a " << this->rowDim << "x"<< this->colDim<<
-			" Hankel matrix "<< std::endl;
+						   " Hankel matrix "<< std::endl;
 #endif
-		
-	}//----- Constructor given a vector---- 
-	
-	
-	
+
+	}//----- Constructor given a vector----
+
+
+
 	/*-----------------------------------------------------------------
 	 *-----    Print The Matrix To Screen
 	 *----------------------------------------------------------------*/
 	template <class Field>
-	void Hankel<Field>::print(std::ostream& os) const 
+	void Hankel<Field>::print(std::ostream& os) const
 	{
 		register size_t i, N, j;
-		
+
 		os<< this->rowDim << " " << this->colDim << " " << this->shape.shape() << std::endl;
 		N = (this->rowDim-1)<<1;
-		
+
 		if ( N < 20 ) {            // Print small matrices in dense format
-                    Element tmp;
+			Element tmp;
 			for (i = N ; i >= this->colDim-1; i--) {
 				for ( j = 0; j < this->colDim ; j++)
 					os << " " << this->P.getCoeff(tmp, this->pdata,i-j) ;
 				os << std::endl;
 			}
-		} 
+		}
 		else {
 			// Print large matrices' first row and col
 			os << "<Hankel<";
 			this->P.write(os, this->pdata) << ">>\n";
 		} //[v(2n-2),....,v(0)]; where v(0) is the top right entry of the matrix
-		
+
 		return;
-	} //---- print()----- 
-	
-	
-	
-	
+	} //---- print()-----
+
+
+
+
 	/*-----------------------------------------------------------------
-	 *----    The infamous clone has been created here 
+	 *----    The infamous clone has been created here
 	 *----------------------------------------------------------------*/
 	//template <class Field, class Vector>
-	//BlackboxArchetype<Vector>* Hankel<Field, Vector>::clone() const 
-	//{ 
-		//return new Hankel(*this); 
-	//}// ------ This is not tested. 
-	
-	
+	//BlackboxArchetype<Vector>* Hankel<Field, Vector>::clone() const
+	//{
+	//return new Hankel(*this);
+	//}// ------ This is not tested.
+
+
 	/*-----------------------------------------------------------------
 	 *----    Save To File, Given Destination Filename
 	 *----------------------------------------------------------------*/
@@ -138,24 +143,24 @@ namespace LinBox
 	void Hankel<Field>::print( char *outFileName) const
 	{
 		int i, j, N;
-		
+
 		std::cout << "Printing hankel matrix to " << outFileName << std::endl;
-		
-		if ( outFileName == NULL ) 
+
+		if ( outFileName == NULL )
 			print();    // Print to stdout if no file is specified
-		else { 
+		else {
 			std::ofstream o_fp(outFileName, std::ios::out);
 			o_fp << this->rowDim << " " << this->colDim << " " << this->shape.shape() << std::endl ;
 			o_fp << "<Hankel<";
 			this->P.write(o_fp, this->pdata) << ">>\n";
-			
+
 			o_fp.close();
 		}
 		return;
-	} // print(char *) 
-	
-	
-	
+	} // print(char *)
+
+
+
 	/*-----------------------------------------------------------------
 	 *    Make the matrix LOWER triangular with determinant 1.
 	 *    i.e. clear the last this->coldim-1 elements in the this->data vector
@@ -163,24 +168,24 @@ namespace LinBox
 	template <class Field>
 	void Hankel<Field>::setToUniModLT()
 	{
-                int L = (this->rowDim-1)<<1;
+		int L = (this->rowDim-1)<<1;
 		this->shape.shape(BlackboxSpecifier::UNIMOD_LT);
 
-                Element one,zero;
-                this->K.init(one,1);
-                this->K.init(zero,0);
+		Element one,zero;
+		this->K.init(one,1);
+		this->K.init(zero,0);
 		for (int i=this->rowDim-1; i <= L; i++ ) {
-			// zero out the below-diagonal entries 
-                    this->P.setCoeff(this->pdata,i,zero);
+			// zero out the below-diagonal entries
+			this->P.setCoeff(this->pdata,i,zero);
 		}
-                    // set the antidiagonal to 1
+		// set the antidiagonal to 1
 		this->P.setCoeff( this->pdata, this->rowDim-1, one);       // update the corresponding coeff of this->pdata
 		//reverse(rpdata,this->pdata);        // no need to construct the transpose
 		return;
-	}// 
-	
-	
-	
+	}//
+
+
+
 	/*-----------------------------------------------------------------
 	 *    Make matrix a unimodular UPPER Triangular with det 1
 	 *    i.e. clear the first N-1 elements in the this->data vector
@@ -190,82 +195,84 @@ namespace LinBox
 	void Hankel<Field>::setToUniModUT()
 	{
 		this->shape.shape(BlackboxSpecifier::UNIMOD_UT);
-		
-                Element one,zero;
-                this->K.init(one,1);
-                this->K.init(zero,0);
+
+		Element one,zero;
+		this->K.init(one,1);
+		this->K.init(zero,0);
 
 		for (size_t i=0; i < this->rowDim-1; i++ ) {
-			// zero out the below-antidiagonal entries 
-                    this->P.setCoeff(this->pdata, i , zero);
+			// zero out the below-antidiagonal entries
+			this->P.setCoeff(this->pdata, i , zero);
 		}
 
-                    // set antidiagonal to 1
+		// set antidiagonal to 1
 		this->P.setCoeff(this->pdata,this->rowDim-1, one);      // update the corresponding coeff of this->pdata
 		//reverse(rpdata,this->pdata);    // no need to construct the transpose
-		
+
 		return;
-	}// 
-	
-	
-	
+	}//
+
+
+
 	/*-----------------------------------------------------------------
-	 *    Apply the matrix to a vector Here the input and output 
-	 *    vectors are both over the SAME prime ZZ_p field as the 
+	 *    Apply the matrix to a vector Here the input and output
+	 *    vectors are both over the SAME prime ZZ_p field as the
 	 *    Hankel matrix itself.
 	 *----------------------------------------------------------------*/
 	template <class Field>
 	template<class OutVector, class InVector>
-	OutVector& Hankel<Field>::apply( OutVector &v_out, 
-										  const InVector& v_in) const
-	{  
+	OutVector& Hankel<Field>::apply( OutVector &v_out,
+					 const InVector& v_in) const
+	{
 		if (v_out.size() != this->rowdim())
 			std::cout << "\tHankel::apply()\t output vector not correct size, at "
-					  << v_out.size() << ". System rowdim is" <<  this->rowdim() << std::endl;
+			<< v_out.size() << ". System rowdim is" <<  this->rowdim() << std::endl;
 		if ( v_out.size() != v_in.size())
-			std::cout << "\tHankel::apply()\t input vector not correct size at " 
-					  << v_in.size() << ". System coldim is" <<  this->coldim() << std::endl;
-		assert((v_out.size() == this->rowdim()) && 
-			   (v_in.size() == this->coldim()))  ;
-		
+			std::cout << "\tHankel::apply()\t input vector not correct size at "
+			<< v_in.size() << ". System coldim is" <<  this->coldim() << std::endl;
+		assert((v_out.size() == this->rowdim()) &&
+		       (v_in.size() == this->coldim()))  ;
+
 		NTL::ZZ_pX pxOut, pxIn;
 		pxIn.SetMaxLength( v_in.size()-1);
 		for (unsigned int i=0; i< v_in.size(); i++)
 			this->P.setCoeff( pxIn, i, v_in[i]);
-		
+
 #ifdef DBGMSGS
 		std::cout << "\npX in is " << pxIn << std::endl;
 		std::cout << "multiplied by " << this->pdata << std::endl;
 #endif
 		mul(pxOut,pxIn,this->pdata);
-		
+
 #ifdef DBGMSGS
 		std::cout <<"pxOut is " << pxOut << std::endl;
 #endif
 		int N = this->rowdim();
-		for ( int i= 0; i < N; i++) 
+		for ( int i= 0; i < N; i++)
 			this->P.getCoeff(v_out[N-1-i], pxOut, N-1+i);
-		
+
 		return v_out;
-		
+
 	}
-	
-	
+
+
 	/*-----------------------------------------------------------------
-	 *    Apply the transposed matrix to a vector Here the input and output 
-	 *    vectors are both over the SAME prime ZZ_p field as the 
+	 *    Apply the transposed matrix to a vector Here the input and output
+	 *    vectors are both over the SAME prime ZZ_p field as the
 	 *    Hankel matrix itself. Calls the multiply from the Toeplitz matrix
 	 *    Since Hankel is symmetric, this is the same as apply
 	 *----------------------------------------------------------------*/
 	template <class Field>
 	template <class OutVector, class InVector>
-	OutVector& Hankel<Field>::applyTranspose( OutVector &v_out, 
-													 const InVector& v_in) const
-	{  
+	OutVector& Hankel<Field>::applyTranspose( OutVector &v_out,
+						  const InVector& v_in) const
+	{
 		return(v_out = apply(v_out,v_in));
 
 	}
-	
-	
-	
+
+
+
 } // namespace LinBox
+
+#endif //__LINBOX_bb_ntl_hankel_INL
diff --git a/linbox/blackbox/ntl-sylvester.h b/linbox/blackbox/ntl-sylvester.h
index ae71c7f..d099765 100644
--- a/linbox/blackbox/ntl-sylvester.h
+++ b/linbox/blackbox/ntl-sylvester.h
@@ -1,4 +1,5 @@
-/* -*- mode: C++; tab-width: 6; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* -*- 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
 /*-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  *    ntl-sylvester.h
  *    Copyright (C) 2003 Austin Lobo, B. David Saunders
@@ -6,10 +7,11 @@
  *    Template for sylvester matrix specification for ntl Arithmetic,
  *    for polynomials in one variable.
  *    Linbox version 2003
+ *    See COPYING for licence information
  *-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+*/
 
-#ifndef NTL_SYLVESTER_H
-#define NTL_SYLVESTER_H
+#ifndef __LINBOX_ntl_sylvester_H
+#define __LINBOX_ntl_sylvester_H
 
 #include <iostream>
 #include <fstream>
@@ -20,65 +22,67 @@
 #include <linbox/blackbox/blackbox-interface.h>
 #include "linbox/vector/vector-traits.h"
 
-namespace LinBox 
+namespace LinBox
 {
-    /// This is a representation of the Sylvester matrix of two polynomials.
-/// \ingroup blackbox
-    template <class _Field>
-    class Sylvester : public  BlackboxInterface
-    {
-    public:
-	  typedef _Field Field;
-	  typedef typename Field::Element element;      // Currently restricted to ZZ_p
-	  ~Sylvester();                                 // Destructor
-	  Sylvester();                                  // Default Constructor
-	  Sylvester( const Field F, 
-			 const std::vector<element> &vpx,
-			 const std::vector<element> &vpy ); // Constructor given 2 polys and Field
-
-      
-	  void   print( std::ostream& os = std::cout ) const; // Print to stream or stdout      
-	  void   print( char *outFileName ) const;            // Print to file or stdout
-	  void   printcp( char *outFileName) const;           // Print to file in sparse format
-
-	  inline size_t rowdim() const { return rowDim; }
-	  inline size_t coldim() const { return colDim; }
-	  inline size_t sysdim() const { return sysDim; }
-	  const Field& field() const { return K; }
-
-        template<typename _Tp1>
-        struct rebind
-        { typedef Sylvester<_Tp1> other; };
-        
-	  template <class OutVector, class InVector>
-	  OutVector& apply( OutVector &v_out, const InVector& v_in ) const;
-
-	  template <class OutVector, class InVector>
-	  OutVector& applyTranspose( OutVector &v_out, const InVector& v_in ) const;
-      
-	  //Sylvester(char *dataFileName ); // read from a file -- not implemented yet
-
-    protected:
-	  Field         K;
-
-	  size_t        rowDim,
-		colDim,
-		sysDim;
-
-	  NTL::ZZ_pX    pxdata,                // "Upper" Polynomial 
+	/*! This is a representation of the Sylvester matrix of two polynomials.
+	 * \ingroup blackbox
+	 */
+	template <class _Field>
+	class Sylvester : public  BlackboxInterface {
+	public:
+		typedef _Field Field;
+		typedef typename Field::Element element;      // Currently restricted to ZZ_p
+		~Sylvester();                                 // Destructor
+		Sylvester();                                  // Default Constructor
+		Sylvester( const Field F,
+			   const std::vector<element> &vpx,
+			   const std::vector<element> &vpy ); // Constructor given 2 polys and Field
+
+
+		void   print( std::ostream& os = std::cout ) const; // Print to stream or stdout
+		void   print( char *outFileName ) const;            // Print to file or stdout
+		void   printcp( char *outFileName) const;           // Print to file in sparse format
+
+		inline size_t rowdim() const { return rowDim; }
+		inline size_t coldim() const { return colDim; }
+		inline size_t sysdim() const { return sysDim; }
+		const Field& field() const { return K; }
+
+		template<typename _Tp1>
+		struct rebind {
+			typedef Sylvester<_Tp1> other;
+		};
+
+		template <class OutVector, class InVector>
+		OutVector& apply( OutVector &v_out, const InVector& v_in ) const;
+
+		template <class OutVector, class InVector>
+		OutVector& applyTranspose( OutVector &v_out, const InVector& v_in ) const;
+
+		//Sylvester(char *dataFileName ); // read from a file -- not implemented yet
+
+	protected:
+		Field         K;
+
+		size_t        rowDim,
+			      colDim,
+			      sysDim;
+
+		NTL::ZZ_pX    pxdata,                // "Upper" Polynomial
 		qxdata;                // "Lower" Polynomial in Sylvester matrix
 
-	  std::vector<NTL::ZZ_p>    pdata,     // Input vector of polynomial coeff
+		std::vector<NTL::ZZ_p>    pdata,     // Input vector of polynomial coeff
 		qdata;     // Input vector of coeffs for second poly
-      
-	  size_t pxdeg() const { return pdata.size() - 1; }
-	  size_t qxdeg() const { return qdata.size() - 1; }
+
+		size_t pxdeg() const { return pdata.size() - 1; }
+		size_t qxdeg() const { return qdata.size() - 1; }
 
 
-      
-    };// End,   template <class Field, class Vector>
+
+	};// End, Sylvester
 }
 
-#include <linbox/blackbox/ntl-sylvester.inl>     
-    
-#endif
+#include <linbox/blackbox/ntl-sylvester.inl>
+
+#endif //__LINBOX_ntl_sylvester_H
+
diff --git a/linbox/blackbox/ntl-sylvester.inl b/linbox/blackbox/ntl-sylvester.inl
index 80fb71a..86b9d1c 100644
--- a/linbox/blackbox/ntl-sylvester.inl
+++ b/linbox/blackbox/ntl-sylvester.inl
@@ -1,354 +1,364 @@
-/* -*- mode: C++; tab-width: 6; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* -*- 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
 /*-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  *    ntl-sylvester.h
  *    Copyright (C) 2003 Austin Lobo, B. David Saunders
-
+ *
  *    Member functions for the sylvester matrix in one variable
  *    for polynomials in one variable.
  *    Linbox version 2003
+ *
+ *    See COPYING for licence information
  *-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+*/
 
+#ifndef __LINBOX_bb_ntl_sylvester_INL
+#define __LINBOX_bb_ntl_sylvester_INL
+
 #include <iostream>
 
 namespace LinBox
 {
 
-    /*----------------------------------------------------------------------
-     *    Destructor
-     *---------------------------------------------------------------------*/
-    template <class Field>
-    inline Sylvester<Field>::~Sylvester() 
-    {
-	  
+	/*----------------------------------------------------------------------
+	 *    Destructor
+	 *---------------------------------------------------------------------*/
+	template <class Field>
+	inline Sylvester<Field>::~Sylvester()
+	{
+
 #ifdef DBGMSGS
-	  std::cout << "Sylvester::~Sylvester():\tDestroyed a " 
-			<< rowDim << "x"<< colDim << " Sylvester matrix "<< std::endl;
+		std::cout << "Sylvester::~Sylvester():\tDestroyed a "
+						       << rowDim << "x"<< colDim << " Sylvester matrix "<< std::endl;
 #endif
-	  
-    }// End, ~Sylvester()
-    
-    
-    
-    /*----------------------------------------------------------------------
-     *    Default constructor.
-     *---------------------------------------------------------------------*/
-    template <class Field>
-    Sylvester<Field>::Sylvester()  
-    {
-	  sysDim =               // Default dimension is 0
-	  rowDim =               // Default row dim is 0
-	  colDim = 0;            // Default col dim is 0
-	  
+
+	}// End, ~Sylvester()
+
+
+
+	/*----------------------------------------------------------------------
+	 *    Default constructor.
+	 *---------------------------------------------------------------------*/
+	template <class Field>
+	Sylvester<Field>::Sylvester()
+	{
+		sysDim =               // Default dimension is 0
+		rowDim =               // Default row dim is 0
+		colDim = 0;            // Default col dim is 0
+
 #ifdef DBGMSGS
-	  std::cout << "Sylvester::Sylvester():\tCreated a " << rowDim << "x"<< colDim<<
-		" Sylvester matrix "<< std::endl;
+		std::cout << "Sylvester::Sylvester():\tCreated a " << rowDim << "x"<< colDim<<
+						      " Sylvester matrix "<< std::endl;
 #endif
 
-    }
-
-
-
-    /*----------------------------------------------------------------------
-     *    Constructor. Builds two rectangular Toeplitz blocks, the top from 
-     *                 px with deg(qx) rows, and the bottom out qx, with deg(px)
-     *                 rows.
-     *---------------------------------------------------------------------*/
-    template <class Field>
-    Sylvester<Field>::Sylvester( 
-		    const Field F,
-		    const std::vector<typename Field::Element> &vp,
-		    const std::vector<typename Field::Element> &vq 
-		    ) :	  pdata(vp), qdata(vq)
-    {
-	  
-	  // Set the row, col, and system dimensions
-	  rowDim = 
-	  colDim =
-	  sysDim = vp.size() + vq.size()-2;  // square system with dimension deg(px)+deg(qx) 
-	  
-	  // Copy the vector to a polynomial representation, for px
-	  pxdata.SetMaxLength( vp.size() );
-	  for (size_t ip=0; ip< vp.size(); ip++ )
-	  SetCoeff( pxdata, ip, vp[ip]);
-	  
-	  // Copy the vector to a polynomial representation, for qx
-	  qxdata.SetMaxLength( vq.size() );
-	  for ( size_t iq=0; iq< vq.size(); iq++ ) 
-	  SetCoeff( qxdata, iq, vq[iq] );
-	  
-	  
+	}
+
+
+
+	/*----------------------------------------------------------------------
+	 *    Constructor. Builds two rectangular Toeplitz blocks, the top from
+	 *                 px with deg(qx) rows, and the bottom out qx, with deg(px)
+	 *                 rows.
+	 *---------------------------------------------------------------------*/
+	template <class Field>
+	Sylvester<Field>::Sylvester(
+				    const Field F,
+				    const std::vector<typename Field::Element> &vp,
+				    const std::vector<typename Field::Element> &vq
+				   ) :
+		pdata(vp), qdata(vq)
+	{
+
+		// Set the row, col, and system dimensions
+		rowDim =
+		colDim =
+		sysDim = vp.size() + vq.size()-2;  // square system with dimension deg(px)+deg(qx)
+
+		// Copy the vector to a polynomial representation, for px
+		pxdata.SetMaxLength( vp.size() );
+		for (size_t ip=0; ip< vp.size(); ip++ )
+			SetCoeff( pxdata, ip, vp[ip]);
+
+		// Copy the vector to a polynomial representation, for qx
+		qxdata.SetMaxLength( vq.size() );
+		for ( size_t iq=0; iq< vq.size(); iq++ )
+			SetCoeff( qxdata, iq, vq[iq] );
+
+
 #ifdef DBGMSGS
-	  std::cout << "Sylvester::Sylvester(F,v,w):\tCreated a " << rowDim << 
-		"x"<< colDim<< " Sylvester matrix "<< std::endl;
+		std::cout << "Sylvester::Sylvester(F,v,w):\tCreated a " << rowDim <<
+							   "x"<< colDim<< " Sylvester matrix "<< std::endl;
 #endif
-	  
-	  /* Inserted for a timing calculation with the gcd
-	   *  double start_time = GetTime();
-	   *	  ZZ_pX gx;
-	   *	  GCD( gx, pxdata, qxdata);
-	   *
-	   *	  double end_time = GetTime();
-	   *	  cout << gx << endl;
-	   *	  std::cout << "Time for gcd = " << end_time-start_time << " sec\n";
-	   */
-    }// Sylvester()
-
-
-
-    /*----------------------------------------------------------------------
-     *    Prints to an ouput stream or to stdout by default -- useful for
-     *    debugging
-     *---------------------------------------------------------------------*/
-    template <class Field>
-    void Sylvester<Field>::print(std::ostream& os) const 
-    {
-	  if ( sysDim < 20 ) 
+
+		/* Inserted for a timing calculation with the gcd
+		 *  double start_time = GetTime();
+		 *	  ZZ_pX gx;
+		 *	  GCD( gx, pxdata, qxdata);
+		 *
+		 *	  double end_time = GetTime();
+		 *	  cout << gx << endl;
+		 *	  std::cout << "Time for gcd = " << end_time-start_time << " sec\n";
+		 */
+	}// Sylvester()
+
+
+
+	/*----------------------------------------------------------------------
+	 *    Prints to an ouput stream or to stdout by default -- useful for
+	 *    debugging
+	 *---------------------------------------------------------------------*/
+	template <class Field>
+	void Sylvester<Field>::print(std::ostream& os) const
+	{
+		if ( sysDim < 20 )
 		{
-		    os << rowDim << " " << colDim << std::endl;
-		    for (size_t irow=0; irow < qxdeg(); irow++ ) 
-			  {
-				os << "[  ";	
-				for (size_t icoeff=0; icoeff < irow; icoeff++ ) 
-				    os << "0  ";
-				
-				for (size_t icoeff = pxdeg(); icoeff > 0; icoeff-- ) 
-				    os << pdata[ icoeff ] << " ";
-				
+			os << rowDim << " " << colDim << std::endl;
+			for (size_t irow=0; irow < qxdeg(); irow++ )
+			{
+				os << "[  ";
+				for (size_t icoeff=0; icoeff < irow; icoeff++ )
+					os << "0  ";
+
+				for (size_t icoeff = pxdeg(); icoeff > 0; icoeff-- )
+					os << pdata[ icoeff ] << " ";
+
 				os << pdata[ 0 ] << " ";
-				
-				for (size_t icoeff = sysDim-1-pxdeg()-irow; icoeff > 0; icoeff-- ) 
-				    os << "0  ";
+
+				for (size_t icoeff = sysDim-1-pxdeg()-irow; icoeff > 0; icoeff-- )
+					os << "0  ";
 				os << " ]\n";
-			  }
-		    for (size_t irow=0; irow < pxdeg(); irow++ ) 
-			  {
-				os << "[ "; 
-				
+			}
+			for (size_t irow=0; irow < pxdeg(); irow++ )
+			{
+				os << "[ ";
+
 				for (size_t icoeff=0; icoeff < irow; icoeff++ )
-				    os << "0  "; 		
-				
+					os << "0  ";
+
 				for (size_t icoeff = qxdeg(); icoeff > 0; icoeff-- )
-				    os << qdata[ icoeff ] << " "; 
+					os << qdata[ icoeff ] << " ";
 				os << qdata[ 0 ] << " ";
-				
-				for (size_t icoeff = sysDim-1-qxdeg()-irow; icoeff > 0; icoeff-- ) 
-				    os << "0  ";
-				
+
+				for (size_t icoeff = sysDim-1-qxdeg()-irow; icoeff > 0; icoeff-- )
+					os << "0  ";
+
 				os << " ]\n";
-			  }
-		} 
-	  else 
+			}
+		}
+		else
 		{
-		    os << rowDim << " " << colDim << std::endl;
-		    os << pxdata;
-		    os << "\n";
-		    os << qxdata;
-		    os << "\n";
+			os << rowDim << " " << colDim << std::endl;
+			os << pxdata;
+			os << "\n";
+			os << qxdata;
+			os << "\n";
+		}
+
+	}// Print()
+
+
+
+
+	/*----------------------------------------------------------------------
+	 *    Print to a file. By default print to stdout
+	 *---------------------------------------------------------------------*/
+
+	template <class Field>
+	void Sylvester<Field>::print(char *outFileName) const
+	{
+		if ( outFileName == NULL )
+			print();
+		else {
+			std::ofstream o_fp(outFileName, std::ios::out);
+			o_fp << rowDim << " " << colDim << std::endl;
+			o_fp << "[";
+			for (size_t icoeff = 0; icoeff <= pxdeg() ; icoeff++ )
+				o_fp << pdata[ icoeff ] << " ";
+			o_fp << "]\n";
+			o_fp << "[";
+			for (size_t icoeff = 0; icoeff <= qxdeg(); icoeff++ )
+				o_fp << qdata[ icoeff ] << " ";
+			o_fp << "]\n";
+			o_fp.close();
 		}
-	  
-    }// Print()
-    
-
-
-
-    /*----------------------------------------------------------------------
-     *    Print to a file. By default print to stdout
-     *---------------------------------------------------------------------*/
-
-    template <class Field>
-    void Sylvester<Field>::print(char *outFileName) const 
-    {
-	  if ( outFileName == NULL )
-		print();
-	  else {
-		std::ofstream o_fp(outFileName, std::ios::out);
-		o_fp << rowDim << " " << colDim << std::endl;
-		o_fp << "[";
-		for (size_t icoeff = 0; icoeff <= pxdeg() ; icoeff++ )
-		    o_fp << pdata[ icoeff ] << " ";
-		o_fp << "]\n";
-		o_fp << "[";
-		for (size_t icoeff = 0; icoeff <= qxdeg(); icoeff++ )
-		    o_fp << qdata[ icoeff ] << " ";
-		o_fp << "]\n";
-		o_fp.close();
-	  }
-
-
-    }// Print
-
-
-
-    /*----------------------------------------------------------------------
-     *    Print to a file in the format specified by the French Linbox group
-     *    for LUDivine. Format is <nrow> <ncol> M
-     *                            <row> <col> <entry>
-     *                              .....
-     *                             0 0 0
-     *--------------------------------------------------------------------- */
-
-    template <class Field>
-    void Sylvester<Field>::printcp(char *outFileName) const 
-    {
-	  if ( outFileName == NULL )
-		print();
-	  else {
-		std::ofstream os(outFileName, std::ios::out);
-		os << rowDim << " " << colDim << " M" << std::endl;
-		size_t irow;
-		size_t icoeff;
-		for (irow=0; irow < qxdeg(); irow++ ) 
-		    {
-			  
-			  for (icoeff = pxdeg(); icoeff > 0; icoeff-- ) 
-				os << (irow+1) << " " << (irow + pxdeg()- icoeff +1) << " " << 
-				    pdata[ icoeff ] << "\n";
-
-			  os << (irow+1) << " " << (irow + pxdeg()+1) << " " << 
-				    pdata[ icoeff ] << "\n";
-
-		    }
-		
-		for (irow=0; irow < pxdeg(); irow++ ) 
-		    {
-
-			  for (icoeff = qxdeg(); icoeff > 0; icoeff-- )
-				os << (irow+qxdeg()+1) << " " << (irow + pxdeg()- icoeff +1) << " " << 
-				    qdata[ icoeff ] << "\n";
-			  
-			  os << (irow+qxdeg()+1) << " " << (irow + pxdeg()+1) << " " << 
+
+
+	}// Print
+
+
+
+	/*----------------------------------------------------------------------
+	 *    Print to a file in the format specified by the French Linbox group
+	 *    for LUDivine. Format is <nrow> <ncol> M
+	 *                            <row> <col> <entry>
+	 *                              .....
+	 *                             0 0 0
+	 *--------------------------------------------------------------------- */
+
+	template <class Field>
+	void Sylvester<Field>::printcp(char *outFileName) const
+	{
+		if ( outFileName == NULL )
+			print();
+		else {
+			std::ofstream os(outFileName, std::ios::out);
+			os << rowDim << " " << colDim << " M" << std::endl;
+			size_t irow;
+			size_t icoeff;
+			for (irow=0; irow < qxdeg(); irow++ )
+			{
+
+				for (icoeff = pxdeg(); icoeff > 0; icoeff-- )
+					os << (irow+1) << " " << (irow + pxdeg()- icoeff +1) << " " <<
+					pdata[ icoeff ] << "\n";
+
+				os << (irow+1) << " " << (irow + pxdeg()+1) << " " <<
+				pdata[ icoeff ] << "\n";
+
+			}
+
+			for (irow=0; irow < pxdeg(); irow++ )
+			{
+
+				for (icoeff = qxdeg(); icoeff > 0; icoeff-- )
+					os << (irow+qxdeg()+1) << " " << (irow + pxdeg()- icoeff +1) << " " <<
+					qdata[ icoeff ] << "\n";
+
+				os << (irow+qxdeg()+1) << " " << (irow + pxdeg()+1) << " " <<
 				qdata[ icoeff ] << "\n";
-		    }
-
-		os << "0 0 0\n";
-
-		os.close();
-	  }
-
-
-    }
-
-
-
-    /* *----------------------------------------------------------------------
-     *    Applytranspose. Does 2 FFT's each of degree (deg(qx)+deg(px))
-     *                    Speed can be improved to 1 FFT in reverse direction
-     *                    by saving pre-computed FFT values
-     *---------------------------------------------------------------------*/
-
-    template <class Field>
-    template <class OutVector, class InVector>
-    OutVector& Sylvester<Field>::apply( OutVector &v_out, 
-							   const InVector& v_in) const
-    {  
-	  /* uncomment the following lines here and in apply() and swap method names
-	   * to swap the apply() for the faster applyTranspose()
-	   *
-	   *	  static int flipper = 1;
-	   *	  if (flipper == 1) 
-	   *		{ cout << "\t sylvester applyTranspose is flipped apply\n"; 
-	   *		  flipper++;
-	   *		}
-	   */
-	  
-	  /*--------------- Check the size of the output vector ----------*/
-	  if ( v_out.size() != sysdim() )
-		std::cout << "\tSylvester::apply()\t output vector not correct size, at "
-			    << v_out.size() << ". System rowdim is" <<  sysdim() << std::endl;
-	  NTL::ZZ_pX txOut, txIn;
-	  
-	  /*--------------- Convert input vector to a polynomial ---------*/
-	  txIn.SetMaxLength( v_in.size() -1 );
-	  for ( size_t i=0; i < v_in.size(); i++ )
-		SetCoeff( txIn, i, v_in[i] );
-
-	  /*--------------  Poly multiply the upper Sylvester poly by input ------*/
-	  mul( txOut, txIn, pxdata);
-	  int Nq = qxdeg();
-	  int m  = pxdeg();
-	  /*--------------  vout[0..deg(q)-1] <--- txout[deg(qx)...2deg(qx)-1] --- */
-	  for ( int i=0; i < Nq; ++i ) 
-		GetCoeff(v_out[i], txOut, m+i);
-
-	  /*--------------  Poly multiply the lower Sylvester poly by input -----*/
-	  mul( txOut, txIn, qxdata);
-
-	  int Np = pxdeg();
-	  int n  = qxdeg();
-
-	  /*--------------  vout[deg(qx)..deg(qx)+deg(px)-1] <--- 
-	   *                              txout[deg(qx)...deg(qx)+deg(px)-1] --- */
-	  for ( int i=0; i < Np; ++i ) 
-		GetCoeff(v_out[Nq+i], txOut, n+i );
-
-
-	  return v_out;
-    }// Apply -- Tested and works 3/17/03
-
-
-    /*----------------------------------------------------------------------
-     *    Apply Transpose: Does 2 polymults of degree deg(qx), and deg(px) 
-     *                     respectively. It takes approx 55% of the time of
-     *                     apply, in apparent violation of Tellegen's theorem
-     *                     Actually, both apply and applyT can be done with
-     *                     just one FFT per call, by saving previous FFTs
-     *                     we use deg(qx) = m; and deg(px) = n; N=m+n below
-     *---------------------------------------------------------------------*/
-    template <class Field>
-    template <class OutVector, class InVector>
-    OutVector& Sylvester<Field>::applyTranspose( OutVector &v_out, 
-									const InVector& v_in) const
-    {  
-	  /* uncomment the following lines here and in apply() and swap method names
-	   * to swap the apply() for the faster applyTranspose()
-	   *
-	   *	  static int flipper=1;
-	   *	  if (flipper == 1) 
-	   *		{ cout << "\tSylvester apply is flipped applyTranspose\n"; flipper++;}
-	   */	  
-
-	  /*--------- Check for size-compatibility of output vectors ------------*/
-	  if ( v_out.size() != sysdim() )
-		std::cout << "\tSylvester::apply()\t output vector not correct size, at "
-			    << v_out.size() << ". System rowdim is" <<  sysdim() << std::endl;
-	  
-	  NTL::ZZ_pX txOut, txIn;
-	  NTL::ZZ_p tval;
-
-	  /*--------- We need to reverse the input vector           -----------*/
-	  /*--------- txIn[0...m-1] <--- vin[m-1...0]               ----------*/
-	  txIn.SetMaxLength( qxdeg()-1 );
-	  for ( size_t i=0; i < qxdeg(); i++ )
-		SetCoeff( txIn, qxdeg()-1-i, v_in[i] );
-	  
-	  mul( txOut, txIn, pxdata);     // Do the poly multiply
-	  
-	  /*--------- We need to reverse the output vector           -----------*/
-	  /*-------  v_out[0..N-1] <--- txOut[N-1...0]                  --------*/
-	  for (size_t i=0; i < v_out.size(); i++) 
-		GetCoeff(v_out[i], txOut, sysdim()-1-i); // Extract the coeffs
-
-	  /*--------- We need to reverse the input vector           -----------*/
-	  /*--------- txIn[m ... m+n-1] <--- vin[m+n-1 ... m]       -----------*/
-	  txIn.SetMaxLength( pxdeg()-1 );
-	  for ( size_t i=0; i < pxdeg(); i++ )
-		SetCoeff( txIn,pxdeg()-1-i, v_in[qxdeg()+i] );
-
-	  mul( txOut, txIn, qxdata);    // do the poly multiply
-
-	  /*--------- We need to reverse the input vector           -----------*/
-	  /*-------  v_out[0..N-1] <--- txOut[N-1...0]                  --------*/
-
-	  for (size_t i=0; i < v_out.size(); i++) {
-		GetCoeff(tval, txOut, sysdim()-1-i);
-		add( v_out[i], v_out[i], tval ); // add to the accumulated output
-	  }
-
-
-
-	  return v_out;
-    }
+			}
+
+			os << "0 0 0\n";
+
+			os.close();
+		}
+
+
+	}
+
+
+
+	/* *----------------------------------------------------------------------
+	 *    Applytranspose. Does 2 FFT's each of degree (deg(qx)+deg(px))
+	 *                    Speed can be improved to 1 FFT in reverse direction
+	 *                    by saving pre-computed FFT values
+	 *---------------------------------------------------------------------*/
+
+	template <class Field>
+	template <class OutVector, class InVector>
+	OutVector& Sylvester<Field>::apply( OutVector &v_out,
+					    const InVector& v_in) const
+	{
+		/* uncomment the following lines here and in apply() and swap method names
+		 * to swap the apply() for the faster applyTranspose()
+		 *
+		 *	  static int flipper = 1;
+		 *	  if (flipper == 1)
+		 *		{ cout << "\t sylvester applyTranspose is flipped apply\n";
+		 *		  flipper++;
+		 *		}
+		 */
+
+		/*--------------- Check the size of the output vector ----------*/
+		if ( v_out.size() != sysdim() )
+			std::cout << "\tSylvester::apply()\t output vector not correct size, at "
+			<< v_out.size() << ". System rowdim is" <<  sysdim() << std::endl;
+		NTL::ZZ_pX txOut, txIn;
+
+		/*--------------- Convert input vector to a polynomial ---------*/
+		txIn.SetMaxLength( v_in.size() -1 );
+		for ( size_t i=0; i < v_in.size(); i++ )
+			SetCoeff( txIn, i, v_in[i] );
+
+		/*--------------  Poly multiply the upper Sylvester poly by input ------*/
+		mul( txOut, txIn, pxdata);
+		int Nq = qxdeg();
+		int m  = pxdeg();
+		/*--------------  vout[0..deg(q)-1] <--- txout[deg(qx)...2deg(qx)-1] --- */
+		for ( int i=0; i < Nq; ++i )
+			GetCoeff(v_out[i], txOut, m+i);
+
+		/*--------------  Poly multiply the lower Sylvester poly by input -----*/
+		mul( txOut, txIn, qxdata);
+
+		int Np = pxdeg();
+		int n  = qxdeg();
+
+		/*--------------  vout[deg(qx)..deg(qx)+deg(px)-1] <---
+		 *                              txout[deg(qx)...deg(qx)+deg(px)-1] --- */
+		for ( int i=0; i < Np; ++i )
+			GetCoeff(v_out[Nq+i], txOut, n+i );
+
+
+		return v_out;
+	}// Apply -- Tested and works 3/17/03
+
+
+	/*----------------------------------------------------------------------
+	 *    Apply Transpose: Does 2 polymults of degree deg(qx), and deg(px)
+	 *                     respectively. It takes approx 55% of the time of
+	 *                     apply, in apparent violation of Tellegen's theorem
+	 *                     Actually, both apply and applyT can be done with
+	 *                     just one FFT per call, by saving previous FFTs
+	 *                     we use deg(qx) = m; and deg(px) = n; N=m+n below
+	 *---------------------------------------------------------------------*/
+	template <class Field>
+	template <class OutVector, class InVector>
+	OutVector& Sylvester<Field>::applyTranspose( OutVector &v_out,
+						     const InVector& v_in) const
+	{
+		/* uncomment the following lines here and in apply() and swap method names
+		 * to swap the apply() for the faster applyTranspose()
+		 *
+		 *	  static int flipper=1;
+		 *	  if (flipper == 1)
+		 *		{ cout << "\tSylvester apply is flipped applyTranspose\n"; flipper++;}
+		 */
+
+		/*--------- Check for size-compatibility of output vectors ------------*/
+		if ( v_out.size() != sysdim() )
+			std::cout << "\tSylvester::apply()\t output vector not correct size, at "
+			<< v_out.size() << ". System rowdim is" <<  sysdim() << std::endl;
+
+		NTL::ZZ_pX txOut, txIn;
+		NTL::ZZ_p tval;
+
+		/*--------- We need to reverse the input vector           -----------*/
+		/*--------- txIn[0...m-1] <--- vin[m-1...0]               ----------*/
+		txIn.SetMaxLength( qxdeg()-1 );
+		for ( size_t i=0; i < qxdeg(); i++ )
+			SetCoeff( txIn, qxdeg()-1-i, v_in[i] );
+
+		mul( txOut, txIn, pxdata);     // Do the poly multiply
+
+		/*--------- We need to reverse the output vector           -----------*/
+		/*-------  v_out[0..N-1] <--- txOut[N-1...0]                  --------*/
+		for (size_t i=0; i < v_out.size(); i++)
+			GetCoeff(v_out[i], txOut, sysdim()-1-i); // Extract the coeffs
+
+		/*--------- We need to reverse the input vector           -----------*/
+		/*--------- txIn[m ... m+n-1] <--- vin[m+n-1 ... m]       -----------*/
+		txIn.SetMaxLength( pxdeg()-1 );
+		for ( size_t i=0; i < pxdeg(); i++ )
+			SetCoeff( txIn,pxdeg()-1-i, v_in[qxdeg()+i] );
+
+		mul( txOut, txIn, qxdata);    // do the poly multiply
+
+		/*--------- We need to reverse the input vector           -----------*/
+		/*-------  v_out[0..N-1] <--- txOut[N-1...0]                  --------*/
+
+		for (size_t i=0; i < v_out.size(); i++) {
+			GetCoeff(tval, txOut, sysdim()-1-i);
+			add( v_out[i], v_out[i], tval ); // add to the accumulated output
+		}
+
+
+
+		return v_out;
+	}
 
 
 
 }//End, namespace LinBox
+
+
+#endif //__LINBOX_bb_ntl_sylvester_INL
diff --git a/linbox/blackbox/null-matrix.h b/linbox/blackbox/null-matrix.h
index add034d..d82d253 100644
--- a/linbox/blackbox/null-matrix.h
+++ b/linbox/blackbox/null-matrix.h
@@ -1,28 +1,52 @@
-/*-* mode:C++;tab-with=8;c-basic-offset:8 -*- */
-/* zhendong wan */
-#ifndef __NULLMATRIX_H
-#define __NULLMATRIX_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
+/* Copyright (C) 2010 LinBox
+ * Written by
+ * zhendong wan
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __LINBOX_bb_nullmatrix_H
+#define __LINBOX_bb_nullmatrix_H
 
 #include <linbox/util/debug.h>
 #include <linbox/blackbox/blackbox-interface.h>
- 
-namespace LinBox{
-  
-  // couldn't a null instance of one of the other classes serve as well?
-
-  /** \brief  This is a representation of the 0 by 0 empty matrix which does not occupy memory.  
-   * It has it's uses!
-   * \ingroup blackbox
-   */
-  
+
+namespace LinBox
+{
+
+	// couldn't a null instance of one of the other classes serve as well?
+
+	/** \brief  This is a representation of the 0 by 0 empty matrix which does not occupy memory.
+	 * It has it's uses!
+	 * \ingroup blackbox
+	 */
+
 	class NullMatrix : public  BlackboxInterface{
 	public:
 		NullMatrix() {}//cout << "NullMatrix default cstor" << endl;}
 		NullMatrix(const NullMatrix& n) {}
-	        virtual ~NullMatrix() {}
-		
-	public:
-		
+		virtual ~NullMatrix() {}
+
+public:
+
 		template<class OutVector, class InVector>
 		inline OutVector& apply(OutVector& y, const InVector& x) const {
 			linbox_check(y.size()==0);
@@ -35,8 +59,8 @@ namespace LinBox{
 		   linbox_check(x.size()==0);
 		   return x;
 		   }
-    */
-		
+		   */
+
 
 		template<class OutVector, class InVector>
 		inline OutVector& applyTranspose(OutVector& y, const InVector& x) const {
@@ -50,19 +74,20 @@ namespace LinBox{
 		   linbox_check(x.size()==0);
 		   return x;
 		   }
-		*/
-		
+		   */
+
 		virtual inline size_t rowdim() const {return 0;}
-		
+
 		virtual inline size_t coldim() const {return 0;}
-	
+
 		template<typename _Tp1>
 		struct rebind
 		{ typedef NullMatrix other; };
 
 
-	};
-	
+};
+
 }
 
-#endif
+#endif //__LINBOX_bb_nullmatrix_H
+
diff --git a/linbox/blackbox/permutation.h b/linbox/blackbox/permutation.h
index b043f4d..bf58db8 100644
--- a/linbox/blackbox/permutation.h
+++ b/linbox/blackbox/permutation.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/blackbox/permutation.h
  * Copyright (C) 2001 Bradford Hovinen
  *
@@ -21,11 +21,16 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __PERMUTATION_H
-#define __PERMUTATION_H
+#ifndef __LINBOX_bb_permutation_H
+#define __LINBOX_bb_permutation_H
 
+#include <utility>
+#ifndef __LINBOX_PERMUTATION_STORAGE
+// #include "linbox/vector/light_container.h"
+// #define __LINBOX_PERMUTATION_STORAGE LightContainer< long >
 #include <vector>
-
+#define __LINBOX_PERMUTATION_STORAGE std::vector< long >
+#endif
 
 #include "linbox/util/debug.h"
 #include "linbox/linbox-config.h"
@@ -39,7 +44,7 @@
 #include <iostream>
 #include <string>
 
-#endif
+#endif //__LINBOX_XMLENABLED
 
 
 // Namespace in which all LinBox library code resides
@@ -48,56 +53,66 @@ namespace LinBox
 
 	/** \brief size is n.
 
-\ingroup blackbox
-	 * @param Storage \ref{LinBox} dense or sparse vector of field elements
+	  \ingroup blackbox
+	 * @param Storage \ref LinBox dense or sparse vector of field elements
 	 */
-    template<class _Field, class Storage = std::vector< long > >
-	class Permutation : public  BlackboxInterface 
-	{
-            const _Field& _F;
-	    public:
-            typedef _Field         Field;
-            typedef typename Field::Element Element;
-		/** Constructor from a vector of indices
+	template<class _Field, class _Storage = __LINBOX_PERMUTATION_STORAGE >
+	class Permutation : public  BlackboxInterface {
+		const _Field& _F;
+	public:
+		typedef Permutation<_Field, _Storage>	Self_t;
+		typedef _Storage 			Storage;
+		typedef _Field				Field;
+		typedef typename Field::Element 	Element;
+
+		/** Constructor from a vector of indices.
 		 * This constructor creates a permutation matrix based on a vector of indices
+		 * @param F
 		 * @param indices Vector of indices representing the permutation
 		 */
-            Permutation (Storage & indices, const Field& F = Field()) : _F(F), _indices (indices)
+		Permutation (Storage & indices, const Field& F = Field()) :
+			_F(F), _indices (indices)
 		{}
 
-		/** Constructor from a dimension
+		/** Constructor from a dimension.
 		 * This constructor creates an n x n permutation matrix, initialized to be the identity
 		 * @param n The dimension of hte matrix to create
+		 * @param F
 		 */
-		Permutation (int n, const Field& F = Field()) : _F(F)
+		Permutation (int n, const Field& F = Field()) :
+			_F(F)
 		{
-			typename Storage::value_type i;
+			identity(n);
+		}
 
-			_indices.resize (n);
 
-			for (i = 0; i < n; i++)
+		void identity(int n)
+		{
+			this->_indices.resize (n);
+			for (typename Storage::value_type i=0; i < n; ++i)
 				_indices[i] = i;
 		}
 
+
 		/* Copy constructor.
 		 * Creates new black box objects in dynamic memory.
 		 * @param M constant reference to compose black box matrix
 		 */
-		Permutation (const Permutation &M)
-			: _F(M._F),_indices (M._indices)
+		Permutation (const Permutation &M) :
+			_F(M._F),_indices (M._indices)
 		{}
 
 #ifdef __LINBOX_XMLENABLED
 		Permutation(LinBox::Reader &R)
 		{
 			if(!R.expectTagName("MatrixOver")) return;
-                        if(!R.expectChildTag()) return;
-                        R.traverseChild();
+			if(!R.expectChildTag()) return;
+			R.traverseChild();
 
-                        if(!R.expectTagName("permutation") || !R.expectTagNumVector(_indices)) return;
+			if(!R.expectTagName("permutation") || !R.expectTagNumVector(_indices)) return;
 
 			R.upToParent();
-                        return;
+			return;
 		}
 #endif
 
@@ -105,15 +120,15 @@ namespace LinBox
 		// Destructor
 		~Permutation (void) {}
 
-		/* Application of BlackBox permutation matrix.
-		 * y= P*x.
-		 * Requires one vector conforming to the \ref{LinBox}
-		 * vector {@link Archetypes archetype}.
+		/** Application of BlackBox permutation matrix.
+		  \f$y \leftarrow Px\f$.
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
 		 * Required by abstract base class.
 		 * @return reference to vector y containing output.
 		 * @param  x constant reference to vector to contain input
+		 * @param y
 		 */
-		/// #y \leftarrow Px#.
 		template<class OutVector, class InVector>
 		inline OutVector &apply (OutVector &y, const InVector &x) const
 		{
@@ -125,20 +140,21 @@ namespace LinBox
 			linbox_check (y.size () == _indices.size ());
 
 			for (i = 0; i < x.size(); ++i)
-				_F.assign(y[_indices[i]], x[i]);
+				_F.assign(y[i], x[_indices[i]]);
 
 			return y;
 		}
 
-		/* Application of BlackBox permutation matrix transpose.
-		 * y= transpose(P)*x, equivalently y= P^-1*x
-		 * Requires one vector conforming to the \ref{LinBox}
-		 * vector {@link Archetypes archetype}.
+		/** Application of BlackBox permutation matrix transpose.
+		 * <code>y= transpose(P)*x</code>, equivalently <code>y= P^-1*x</code>
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
 		 * Required by abstract base class.
 		 * @return reference to vector y containing output.
 		 * @param  x constant reference to vector to contain input
+		 * @param y
 		 */
-		/// #y^T \leftarrow x^T P#.
+		/// \f$y^T \leftarrow x^T P\f$.
 		template<class OutVector, class InVector>
 		inline OutVector &applyTranspose (OutVector &y, const InVector &x) const
 		{
@@ -150,15 +166,20 @@ namespace LinBox
 			linbox_check (y.size () == _indices.size ());
 
 			for (i = 0; i < _indices.size (); ++i)
-				_F.assign(y[i], x[_indices[i]]);
+				_F.assign(y[_indices[i]], x[i]);
 
 			return y;
 		}
 
 
-            template<typename _Tp1>
-            struct rebind
-            { typedef Permutation<_Tp1, Storage> other; };
+
+		template<typename _Tp1>
+		struct rebind {
+			typedef Permutation<_Tp1, Storage> other;
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F) {
+				Ap->setStorage( A.getStorage() );
+			}
+		};
 
 
 
@@ -167,40 +188,43 @@ namespace LinBox
 		 * Required by abstract base class.
 		 * @return integer number of rows of black box matrix.
 		 */
+		/// rowdim
 		size_t rowdim (void) const
 		{
 			return _indices.size ();
 		}
-    
+
 		/* Retreive column dimensions of BlackBox matrix.
 		 * Required by abstract base class.
 		 * @return integer number of columns of black box matrix.
 		 */
-		size_t coldim (void) const 
+		/// coldim
+		size_t coldim (void) const
 		{
 			return _indices.size ();
 		}
 
-		/** Add a transposition to the matrix
-		 */
-		void permute (size_t row1, size_t row2) 
+		/**
+		 * Add a transposition to the matrix
+		*/
+		void permute (size_t row1, size_t row2)
 		{
-			linbox_check (row1 >= 0 && row1 < _indices.size ());
-			linbox_check (row2 >= 0 && row2 < _indices.size ());
+			linbox_check (/*  row1 >= 0 &&*/ row1 < _indices.size ());
+			linbox_check (/*  row2 >= 0 &&*/ row2 < _indices.size ());
+			std::swap (_indices[row1], _indices[row2]);
 
-			_swap (_indices[row1], _indices[row2]);
 		}
 
-            const Field& field() { return _F; }
+		const Field& field() { return _F; }
 
 #ifdef __LINBOX_XMLENABLED
 
 		std::ostream &write(std::ostream &out) const
 		{
 			LinBox::Writer W;
-			if( toTag(W) ) 
+			if( toTag(W) )
 				W.write(out);
-		
+
 			return out;
 		}
 
@@ -211,7 +235,7 @@ namespace LinBox
 			W.setAttribute("rows", LinBox::Writer::numToString(s, _indices.size()));
 			W.setAttribute("cols", LinBox::Writer::numToString(s, _indices.size()));
 			W.setAttribute("implDetail", "permutation");
-			
+
 			W.addTagChild();
 			W.setTagName("permutation");
 			W.addNumericalList(_indices);
@@ -219,18 +243,45 @@ namespace LinBox
 
 			return true;
 		}
-#endif
-
-
-	    private:
-
-		void _swap(typename Storage::value_type &x, typename Storage::value_type &y) const
+#else
+		std::ostream &write(std::ostream &os, FileFormatTag format = FORMAT_MAPLE) const
 		{
-			typename Storage::value_type temp = x;
-			x = y;
-			y = temp;
+			// 		for (typename Storage::const_iterator it=_indices.begin(); it!=_indices.end(); ++it)
+			//                     std::cerr << *it << ' ';
+			typename Field::Element one, zero; _F.init(one,1UL);_F.init(zero,0UL);
+			os << "[";
+			bool firstrow=true;
+			long nmu = _indices.size()-1;
+			for (typename Storage::const_iterator it=_indices.begin(); it!=_indices.end(); ++it) {
+				if (firstrow) {
+					os << "[";
+					firstrow =false;
+				}
+				else
+					os << ", [";
+
+				long i=0;
+				for( ; i< *it ; ++i) {
+					_F.write(os, zero);
+					if (i < nmu) os << ',';
+				}
+				_F.write(os, one);
+				if (i < nmu) os << ',';
+				for(++i ; i< static_cast<long>(_indices.size()) ; ++i) {
+					_F.write(os, zero);
+					if (i < nmu) os << ',';
+				}
+				os << " ]";
+			}
+
+			return os << "]";
 		}
+#endif
 
+		Storage& setStorage(const Storage& s) { return _indices=s; }
+		const Storage& getStorage() const { return _indices; }
+
+	private:
 		// Vector of indices
 		Storage _indices;
 
@@ -238,4 +289,5 @@ namespace LinBox
 
 } // namespace LinBox
 
-#endif // __PERMUTATION_H
+#endif // __LINBOX_bb_permutation_H
+
diff --git a/linbox/blackbox/polynomial.h b/linbox/blackbox/polynomial.h
index 83981ab..634c699 100644
--- a/linbox/blackbox/polynomial.h
+++ b/linbox/blackbox/polynomial.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/blackbox/polynomial.h
  * Copyright (C) 2005 Cl'ement Pernet
  *
@@ -21,43 +21,55 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __POLYNOMIAL_H
-#define __POLYNOMIAL_H
+#ifndef __LINBOX_bb_polynomial_H
+#define __LINBOX_bb_polynomial_H
 
 #include <linbox/blackbox/blackbox-interface.h>
 #include <linbox/vector/vector-domain.h>
 // Namespace in which all LinBox library code resides
 namespace LinBox
 {
+	template <class Blackbox, class Poly>
+	class PolynomialBB ;
+	template <class Blackbox, class Poly>
+	class PolynomialBBOwner ;
+}
+
+
+namespace LinBox
+{
 
 	/** \brief represent the matrix P(A) where A is a blackbox and P a polynomial
-	    
-	\ingroup blackbox
-	
-	*/
+
+	  \ingroup blackbox
+
+*/
 	template <class Blackbox, class Poly>
-	class PolynomialBB : public BlackboxInterface
-	{
+	class PolynomialBB : public BlackboxInterface {
 	public:
-		
+
 		typedef typename Blackbox::Field Field;
 		typedef typename Blackbox::Element Element;
 		typedef Poly Polynomial;
 		typedef PolynomialBB<Blackbox,Polynomial> Self_t;
 
 		/** Constructor from a black box and a polynomial.
-		 */
-		PolynomialBB (const Blackbox& A, const Polynomial& P) : _A_ptr(&A), _P_ptr(&P), _VD(A.field()) {}
-		
-		PolynomialBB (const Blackbox *A_ptr, const Polynomial * P_ptr): _A_ptr(A_ptr), _P_ptr(P_ptr), _VD(A_ptr->field())
+		*/
+		PolynomialBB (const Blackbox& A, const Polynomial& P) :
+			_A_ptr(&A), _P_ptr(&P), _VD(A.field())
+		{}
+
+		PolynomialBB (const Blackbox *A_ptr, const Polynomial * P_ptr)
+		: _A_ptr(A_ptr), _P_ptr(P_ptr), _VD(A_ptr->field())
 		{
 		}
-		
+
 		/** Copy constructor.
 		 * Creates new black box objects in dynamic memory.
 		 * @param M constant reference to compose black box matrix
 		 */
-		PolynomialBB (const PolynomialBB<Blackbox, Polynomial> &M) : _A_ptr(M._A_ptr), _P_ptr(M._P_ptr), _VD(M._VD)
+		PolynomialBB (const PolynomialBB<Blackbox, Polynomial> &M) :
+			_A_ptr(M._A_ptr), _P_ptr(M._P_ptr), _VD(M._VD)
 		{
 		}
 
@@ -68,12 +80,13 @@ namespace LinBox
 
 
 		/** Application of BlackBox matrix.
-		 * y = P(A)x
-		 * Requires one vector conforming to the \ref{LinBox}
-		 * vector {@link Archetypes archetype}.
+		 * <code>y = P(A)x</code>
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
 		 * Required by abstract base class.
 		 * @return reference to vector y containing output.
 		 * @param  x constant reference to vector to contain input
+		 * @param y
 		 */
 		template <class Vector1, class Vector2>
 		inline Vector1 &apply (Vector1 &y, const Vector2 &x) const
@@ -91,12 +104,13 @@ namespace LinBox
 
 
 		/** Application of BlackBox matrix transpose.
-		 * y= transpose(A*B)*x.
-		 * Requires one vector conforming to the \ref{LinBox}
-		 * vector {@link Archetypes archetype}.
+		 * <code>y= transpose(A*B)*x</code>.
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
 		 * Required by abstract base class.
 		 * @return reference to vector y containing output.
 		 * @param  x constant reference to vector to contain input
+		 * @param y
 		 */
 		template <class Vector1, class Vector2>
 		inline Vector1 &applyTranspose (Vector1 &y, const Vector2 &x) const
@@ -112,20 +126,15 @@ namespace LinBox
 			return y;
 		}
 
-		
-		template<typename _Tp1, class Poly1 = typename Polynomial::template rebind<_Tp1>::other> 
-		struct rebind 
-		{ 
-			typedef PolynomialBB<typename Blackbox::template rebind<_Tp1>::other, Poly1> other;
-			
-			void operator() (other *& Ap, const Self_t& A, const _Tp1& F) {
-				typedef typename Blackbox::template rebind<_Tp1>::other FBB;
-				Poly1  * Pp;
-				FBB * BBp;
-				typename Polynomial::template rebind<_Tp1>() (Pp, A.getPolynomial(), F);
-				typename Blackbox::template rebind<_Tp1>() (BBp, A.getBlackbox(),F);
-
-				Ap = new other (*BBp, *Pp);
+
+		template<typename _Tp1, class Poly1 = typename Polynomial::template rebind<_Tp1>::other>
+		struct rebind {
+			typedef PolynomialBBOwner<typename Blackbox::template rebind<_Tp1>::other, Poly1> other;
+
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F) {
+				typename Polynomial::template rebind<_Tp1>() (Ap.getDataPolynomial(), *A.getPolynomial(), F);
+				typename Blackbox::template rebind<_Tp1>() (Ap.getDataBlackbox(), *A.getBlackbox(),F);
+
 			}
 		};
 
@@ -138,29 +147,29 @@ namespace LinBox
 		 */
 		size_t rowdim (void) const
 		{
-			if (_A_ptr != 0) 
+			if (_A_ptr != 0)
 				return _A_ptr->rowdim ();
-			else 
+			else
 				return 0;
 		}
-    
+
 		/** Retreive column dimensions of BlackBox matrix.
 		 * Required by abstract base class.
 		 * @return integer number of columns of black box matrix.
 		 */
-		size_t coldim (void) const 
+		size_t coldim (void) const
 		{
-			if (_A_ptr != 0) 
+			if (_A_ptr != 0)
 				return _A_ptr->coldim ();
-			else 
+			else
 				return 0;
 		}
-	       
 
-		const Polynomial& getPolynomial () const  { return *_P_ptr; }
-		const Blackbox& getBlackbox () const { return *_A_ptr; }
+
+		const Polynomial* getPolynomial () const  { return _P_ptr; }
+		const Blackbox* getBlackbox () const { return _A_ptr; }
 		const Field& field () const {return _A_ptr->field();}
-	    private:
+	private:
 
 		// Pointers to A and P
 		const Blackbox *_A_ptr;
@@ -171,4 +180,163 @@ namespace LinBox
 
 } // namespace LinBox
 
-#endif // __POLYNOMIAL_H
+// Namespace in which all LinBox library code resides
+namespace LinBox
+{
+
+	/** \brief represent the matrix P(A) where A is a blackbox and P a polynomial
+
+	  \ingroup blackbox
+
+*/
+	template <class Blackbox, class Poly>
+	class PolynomialBBOwner : public BlackboxInterface {
+	public:
+
+		typedef typename Blackbox::Field Field;
+		typedef typename Blackbox::Element Element;
+		typedef Poly Polynomial;
+		typedef PolynomialBBOwner<Blackbox,Polynomial> Self_t;
+
+		/** Constructor from a black box and a polynomial.
+		*/
+		PolynomialBBOwner (const Blackbox& A, const Polynomial& P) :
+			_A_data(A), _P_data(P), _VD(A.field())
+		{}
+
+		PolynomialBBOwner (const Blackbox *A_data, const Polynomial * P_data) :
+			_A_data(*A_data), _P_data(*P_data), _VD(A_data.field())
+		{
+		}
+
+		/** Copy constructor.
+		 * Creates new black box objects in dynamic memory.
+		 * @param M constant reference to compose black box matrix
+		 */
+		PolynomialBBOwner (const PolynomialBBOwner<Blackbox, Polynomial> &M) :
+			_A_data(M._A_data), _P_data(M._P_data), _VD(M._VD)
+		{
+		}
+
+		/// Destructor
+		~PolynomialBBOwner (void)
+		{
+		}
+
+
+		/** Application of BlackBox matrix.
+		 * <code>y = P(A)x</code>
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
+		 * Required by abstract base class.
+		 * @return reference to vector y containing output.
+		 * @param  x constant reference to vector to contain input
+		 * @param y
+		 */
+		template <class Vector1, class Vector2>
+		inline Vector1 &apply (Vector1 &y, const Vector2 &x) const
+		{
+			Vector2 u (x);
+			Vector2 v(u.size());
+			_VD.mul( y, x, _P_data[0] );
+			for (size_t i=1; i<_P_data.size(); ++i){
+				_A_data.apply( v, u );
+				_VD.axpyin( y, _P_data[i], v);
+				u=v;
+			}
+			return y;
+		}
+
+
+		/** Application of BlackBox matrix transpose.
+		 * <code>y= transpose(A*B)*x</code>.
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
+		 * Required by abstract base class.
+		 * @return reference to vector y containing output.
+		 * @param  x constant reference to vector to contain input
+		 * @param y
+		 */
+		template <class Vector1, class Vector2>
+		inline Vector1 &applyTranspose (Vector1 &y, const Vector2 &x) const
+		{
+			Vector2 u( x );
+			Vector2 v(u.size());
+			_VD.mul( y, x, _P_data[0]);
+			for (size_t i=1; i<_P_data.size(); ++i){
+				_A_data.applyTranspose( v, u );
+				_VD.axpyin( y, _P_data[i], v);
+				u=v;
+			}
+			return y;
+		}
+
+
+		template<typename _Tp1, class Poly1 = typename Polynomial::template rebind<_Tp1>::other>
+		struct rebind {
+			typedef PolynomialBBOwner<typename Blackbox::template rebind<_Tp1>::other, Poly1> other;
+
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F) {
+				typename Polynomial::template rebind<_Tp1>() (Ap.getDataPolynomial(), A.getDataPolynomial(), F);
+				typename Blackbox::template rebind<_Tp1>() (Ap.getDataBlackbox(), A.getDataPolynomial(),F);
+
+			}
+		};
+
+		template<typename _BBt, typename _Polt, typename Field>
+		PolynomialBBOwner (const PolynomialBB<_BBt, _Polt> &M, const Field& F) :
+			_VD(F),
+			_A_data(*(M.getBlackbox()), F),
+			_P_data(*(M.getPolynomial()), F)
+		{
+			typename _BBt::template rebind<Field>()(_A_data, *(M.getBlackbox()), F);
+			typename _Polt::template rebind<Field>()(_P_data, *(M.getPolynomial()), F);
+		}
+
+		template<typename _BBt, typename _Polt, typename Field>
+		PolynomialBBOwner (const PolynomialBBOwner<_BBt, _Polt> &M, const Field& F) :
+			_A_data(M.getDataBlackbox(), F),
+			_P_data(M.getDataPolynomial(), F)
+		{
+			typename _BBt::template rebind<Field>()(_A_data, M.getDataBlackbox(), F);
+			typename _Polt::template rebind<Field>()(_P_data, M.getDataPolynomial(), F);
+		}
+
+
+
+		/** Retreive row dimensions of BlackBox matrix.
+		 * This may be needed for applying preconditioners.
+		 * Required by abstract base class.
+		 * @return integer number of rows of black box matrix.
+		 */
+		size_t rowdim (void) const
+		{
+			return _A_data.rowdim ();
+		}
+
+		/** Retreive column dimensions of BlackBox matrix.
+		 * Required by abstract base class.
+		 * @return integer number of columns of black box matrix.
+		 */
+		size_t coldim (void) const
+		{
+			return _A_data.coldim ();
+		}
+
+
+		const Polynomial& getDataPolynomial () const  { return _P_data; }
+		const Blackbox& getDataBlackbox () const { return _A_data; }
+		const Field& field () const {return _A_data.field();}
+	private:
+
+		const VectorDomain<Field> _VD;
+		// Matrix A and polynomial P
+		Blackbox _A_data;
+		Polynomial _P_data;
+
+	};
+
+} // namespace LinBox
+
+#endif // __LINBOX_bb_polynomial_H
+
diff --git a/linbox/blackbox/quad-matrix.h b/linbox/blackbox/quad-matrix.h
new file mode 100644
index 0000000..401c750
--- /dev/null
+++ b/linbox/blackbox/quad-matrix.h
@@ -0,0 +1,520 @@
+/* -*- 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
+/* linbox/blackbox/quad-matrix.h
+ * Copyright (C) 2006 LinBox
+ * Written by -bds, hui wang
+ * see COPYING for license information
+ */
+
+#ifndef __LINBOX_quad_matrix_H
+#define __LINBOX_quad_matrix_H
+
+#include <algorithm>
+#include <linbox/field/hom.h>
+#include <vector>
+#include <iterator>
+//#include "linbox/vector/vector-traits.h"
+#include "linbox/util/debug.h"
+#include "linbox/linbox-config.h"
+#include <linbox/blackbox/blackbox-interface.h>
+#include <linbox/blackbox/scalar-matrix.h>
+#include <linbox/blackbox/zo.h>
+//#include <linbox/blackbox/side-by-side.h>
+//#include <linbox/blackbox/over-under.h>
+
+namespace LinBox
+{
+
+	template <typename Field>
+	class ZeroOne;
+
+	template <typename Field>
+	class ScalarMatrix;
+
+	template <typename Field>
+	class SideBySide;
+
+	template <typename Field>
+	class OverUnder;
+
+	/** A class of striped or block-decomposed zero-one matrices.
+
+	  Right now we implement only side-by-side blocks, which is done to improve cache performance.  This class works especially well on quite sparse matrices whose entries are rather randomly positioned.  The idea is that the vector to be multiplied by each block fits in cache.  It is being more or less randomly accessed, so cache misses are avoided for these random accesses.
+
+	  The possibility exists to set the stripe(block) width by a configure-time parameter.  Also this approach should be used on sparse matrices which are not zero-one.
+
+	  This ZOQuad class is like a tagged union of several BB types.
+	  Then SideBySide does not have it's two part types as template parameters.
+	  Instead the parts are always ZOQuads.
+
+	  \ingroup blackbox
+
+*/
+	template <typename _Field>
+	class ZOQuad {
+		//friend class ZeroOne<_Field>;
+		enum BBtype {zo, sbs, ou};
+		const void* _BBp;
+		BBtype _tag;
+		size_t _r, _c;
+		static const unsigned int smallThreshold = 60000;
+
+	protected:
+		_Field _F;
+	public:
+		typedef _Field Field;
+
+		typedef size_t Index;
+		typedef std::vector<Index> IndexVector;
+		typedef std::vector<IndexVector::iterator> PointerVector;
+
+		// constructors
+		ZOQuad() :
+			_BBp(0), _r(0), _c(0)
+		{}
+#if 0
+		ZOQuad(const ScalarMatrix<Field>&  A) :
+			_BBp(&A), _tag(sm), _r(A.rowdim()), _c(A.coldim())
+		{}
+#endif
+		ZOQuad(const SideBySide<Field>& A) :
+			_BBp(&A), _tag(sbs), _r(A.rowdim()), _c(A.coldim())
+		{}
+		ZOQuad(const OverUnder<Field>& A) :
+			_BBp(&A), _tag(ou), _r(A.rowdim()), _c(A.coldim())
+		{}
+		ZOQuad(const ZeroOne<Field>& A) //:
+		// _BBp(&A), _tag(zo), _r(A.rowdim()), _c(A.coldim())
+		{
+			init(A);
+		}
+
+		int init (const ZeroOne<Field>&  A)
+		{
+			const Field& F = A.field();
+			//if ( A.nnz() == 0 )
+			if ( A.coldim() <= smallThreshold )
+			{
+				_BBp = new ZeroOne<Field>(A);
+				_tag = zo;
+				_r = A.rowdim(); _c = A.coldim();
+				const ZeroOne<Field> *B(static_cast< const ZeroOne<Field>* >(_BBp));
+				if( !(B->sorted) )
+				{
+					//		std::cout << " -- init: switch sort " << A.sorted << " " << &(A.sorted) << std::endl;
+					B->switch_sort();
+					//		std::cout << " -- init: switch sort " << A.sorted << std::endl;
+				}
+				//std::cout << " -- quad init: " << A.nnz() << " ( zo: " << &A << ", " << _BBp << ", quad: " << this << ")" << std::endl;
+				return 0;
+			}
+			// if A has more rows than cols, make an OverUnder
+			/*
+			   if ( A.coldim() <= A.rowdim() )
+			   {
+			   if( !A.sorted ) A.switch_sort();
+
+			   IndexVector firstHalf;
+			   PointerVector firstHalfP;
+			   std::back_insert_iterator< IndexVector > first(firstHalf);
+			   std::back_insert_iterator< PointerVector > firstP(firstHalfP);
+			   copy( A._index.begin(), *(A._indexP.begin() + A._indexP.size()/2), first);
+			   copy( A._indexP.begin(), A._indexP.begin() + A._indexP.size()/2 + 1, firstP);
+			   ZeroOne<Field> U(F, firstHalf, firstHalfP, firstHalfP.size()-1, A._coldim, A.sorted);
+			   ZOQuad<Field> *UU = new ZOQuad<Field>(U);
+
+			   IndexVector secondHalf;
+			   PointerVector secondHalfP;
+			   std::back_insert_iterator< IndexVector > second(secondHalf);
+			   std::back_insert_iterator< PointerVector > secondP(secondHalfP);
+			   copy( *(A._indexP.begin() + A._indexP.size()/2), A._index.end(), second);
+			   copy( A._indexP.begin() + A._indexP.size()/2, A._indexP.end(), secondP);
+			   ZeroOne<Field> D(F, secondHalf, secondHalfP, secondHalfP.size()-1, A._coldim, A.sorted);
+			   ZOQuad<Field> *DD = new ZOQuad<Field>(D);
+
+			//Hui works this out!
+
+			_BBp = new OverUnder<Field>(UU, DD);
+
+			_tag = ou;
+			_r = A.rowdim(); _c = A.coldim();
+
+			return 1;
+			}
+			*/
+			// else make an sideBySide
+			///*
+			   else
+			   {
+				   if( A.sorted ) A.switch_sort();
+
+				   IndexVector firstHalf;
+				   PointerVector firstHalfP;
+				   std::back_insert_iterator< IndexVector > first(firstHalf);
+				   std::back_insert_iterator< PointerVector > firstP(firstHalfP);
+				   copy( A._index.begin(), *(A._indexP.begin() + A._indexP.size()/2), first);
+				   copy( A._indexP.begin(), A._indexP.begin() + A._indexP.size()/2 + 1, firstP);
+				   ZeroOne<Field> L(F, firstHalf, firstHalfP, A._rowdim, firstHalfP.size()-1, A.sorted);
+				   ZOQuad<Field> *LL = new ZOQuad<Field>(L);
+
+				   IndexVector secondHalf;
+				   PointerVector secondHalfP;
+				   std::back_insert_iterator< IndexVector > second(secondHalf);
+				   std::back_insert_iterator< PointerVector > secondP(secondHalfP);
+				   copy( *(A._indexP.begin() + A._indexP.size()/2), A._index.end(), second);
+				   copy( A._indexP.begin() + A._indexP.size()/2, A._indexP.end(), secondP);
+				   ZeroOne<Field> R(F, secondHalf, secondHalfP, A._rowdim, secondHalfP.size()-1, A.sorted);
+				   ZOQuad<Field> *RR = new ZOQuad<Field>(R);
+
+				   //Hui works this out!
+
+				   _BBp = new SideBySide<Field>(LL, RR);
+
+				   _tag = sbs;
+				   _r = A.rowdim(); _c = A.coldim();
+
+				   return 2;
+			   }
+			   //*/
+		}
+		std::ostream & write(std::ostream & out) const
+		{
+			switch (_tag)
+			{
+			case zo:
+				{
+					const ZeroOne<Field> *A(static_cast< const ZeroOne<Field>* >(_BBp));
+					out << "zo(" << A->rowdim() << ", " << A->coldim() << ", " << A->nnz() << ") ";
+					break;
+				}
+
+#if 0
+			case sm:
+				{
+					const ScalarMatrix<Field> *A(static_cast< const ScalarMatrix<Field>* >(_BBp));
+					delete A ; break;
+				}
+#endif
+			case sbs:
+				{
+					out << "sidebyside(";
+					const SideBySide<Field> *A(static_cast< const SideBySide<Field>* >(_BBp));
+					(A->_L)->write(out) << ", ";
+					(A->_R)->write(out) << ") ";
+					break;
+				}
+			case ou:
+				{
+					out << "overunder(";
+					const OverUnder<Field> *A(static_cast< const OverUnder<Field>* >(_BBp));
+					(A->_U)->write(out) << ", ";
+					(A->_D)->write(out) << ") ";
+					break;
+				}
+			}
+			return out;
+		}
+
+		~ZOQuad()
+		{
+#if 0
+			switch (_tag)
+			{
+			case zo:
+				{
+					const ZeroOne<Field> *A(static_cast< const ZeroOne<Field>* >(_BBp));
+					delete A ;
+					break;
+				}
+#if 0
+			case sm:
+				{
+					const ScalarMatrix<Field> *A(static_cast< const ScalarMatrix<Field>* >(_BBp));
+					delete A ; break;
+				}
+#endif
+			case sbs:
+				{
+					const SideBySide<Field> *A(static_cast< const SideBySide<Field>* >(_BBp));
+					delete A ; break;
+				}
+			case ou:
+				{
+					const OverUnder<Field> *A(static_cast< const OverUnder<Field>* >(_BBp));
+					delete A ; break;
+				}
+			}
+#endif
+		}
+
+		template <typename InVector, typename OutVector>
+		OutVector& apply(OutVector& y, const InVector& x) const
+		//OutVector& apply(OutVector& y, const InVector& x)
+		{
+			//std::cout << " zo-quad apply size of x: " << x.size() << " " << " size of y: " << y.size() << endl;
+			switch (_tag)
+			{
+			case zo:
+				{
+					const ZeroOne<Field> *A(static_cast< const ZeroOne<Field>* >(_BBp));
+					//ZeroOne<Field> *A(static_cast< ZeroOne<Field>* >(_BBp));
+					//std::cout << "\n apply zo quad -- zo " << "( quad: " << this << ", zo: " << _BBp << "), (" << _r << ", " << _c << "), (" << A->rowdim() << ", " << A->coldim() << ")" << endl;
+					A->apply(y, x);
+					break;
+				}
+
+#if 0
+			case sm:
+				{
+
+					const ScalarMatrix<Field> *A(static_cast< const ScalarMatrix<Field>* >(_BBp));
+					ScalarMatrix<Field> *A(static_cast< ScalarMatrix<Field>* >(_BBp));
+					A->apply(y, x);
+					break;
+				}
+#endif
+			case sbs:
+				{
+					const SideBySide<Field> *A(static_cast< const SideBySide<Field>* >(_BBp));
+					//SideBySide<Field> *A(static_cast< SideBySide<Field>* >(_BBp));
+					//std::cout << "\n apply zo quad -- sbs " << _r << " " << _c << endl;
+					A->apply(y, x);
+					break;
+				}
+			case ou:
+				{
+					const OverUnder<Field> *A(static_cast< const OverUnder<Field>* >(_BBp));
+					//OverUnder<Field> *A(static_cast< OverUnder<Field>* >(_BBp));
+					//std::cout << "\n apply zo quad -- ou " << _r << " " << _c << endl;
+					A->apply(y, x);
+					break;
+				}
+			}
+			return y;
+		}
+
+		// similar applyTranspose
+		template <typename InVector, typename OutVector>
+		OutVector& applyTranspose(OutVector& y, const InVector& x) const
+		//OutVector& applyTranspose(OutVector& y, const InVector& x)
+		{
+			switch (_tag)
+			{
+			case zo:
+				{
+					//const ZeroOne<Field> *A(static_cast< const ZeroOne<Field>* >(_BBp));
+					const ZeroOne<Field> *A(static_cast< const ZeroOne<Field>* >(_BBp));
+					A->applyTranspose(y, x);
+					break;
+				}
+#if 0
+			case sm:
+				{
+					const ScalarMatrix<Field> *A(static_cast< const ScalarMatrix<Field>* >(_BBp));
+					ScalarMatrix<Field> *A(static_cast< ScalarMatrix<Field>* >(_BBp));
+					A->applyTranspose(y, x);
+					break;
+				}
+#endif
+			case sbs:
+				{
+					const SideBySide<Field> *A(static_cast< const SideBySide<Field>* >(_BBp));
+					//SideBySide<Field> *A(static_cast< SideBySide<Field>* >(_BBp));
+					A->applyTranspose(y, x);
+					break;
+				}
+			case ou:
+				{
+					const OverUnder<Field> *A(static_cast< const OverUnder<Field>* >(_BBp));
+					//OverUnder<Field> *A(static_cast< OverUnder<Field>* >(_BBp));
+					A->applyTranspose(y, x);
+					break;
+				}
+			}
+			return y;
+		}
+
+		size_t rowdim() const
+		{
+			switch (_tag)
+			{
+			case zo:
+				{
+					const ZeroOne<Field> *A(static_cast< const ZeroOne<Field>* >(_BBp));
+					return A->rowdim();
+				}
+			case sbs:
+				{
+					const SideBySide<Field> *A(static_cast< const SideBySide<Field>* >(_BBp));
+					return A->rowdim();
+				}
+			case ou:
+				{
+					const OverUnder<Field> *A(static_cast< const OverUnder<Field>* >(_BBp));
+					return A->rowdim();
+				}
+			}
+			return 0;
+		}
+		size_t coldim() const
+		{
+			switch (_tag)
+			{
+			case zo:
+				{
+					const ZeroOne<Field> *A(static_cast< const ZeroOne<Field>* >(_BBp));
+					return A->coldim();
+				}
+			case sbs:
+				{
+					const SideBySide<Field> *A(static_cast< const SideBySide<Field>* >(_BBp));
+					return A->coldim();
+				}
+			case ou:
+				{
+					const OverUnder<Field> *A(static_cast< const OverUnder<Field>* >(_BBp));
+					return A->coldim();
+				}
+			}
+			return 0;
+		}
+		const Field& field() const
+		{
+			switch (_tag)
+			{
+			case zo:
+				{
+					const ZeroOne<Field> *A(static_cast< const ZeroOne<Field>* >(_BBp));
+					return A->field();
+				}
+#if 0
+			case sm:
+				{
+					const ScalarMatrix<Field> *A(static_cast< const ScalarMatrix<Field>* >(_BBp));
+					return A->field();
+				}
+#endif
+			case sbs:
+				{
+					const SideBySide<Field> *A(static_cast< const SideBySide<Field>* >(_BBp));
+					return A->field();
+				}
+			case ou:
+				{
+					const OverUnder<Field> *A(static_cast< const OverUnder<Field>* >(_BBp));
+					return A->field();
+				}
+			}
+			// silly business to avoid a warning ( no return statement warning )
+			const ScalarMatrix<Field> *A(static_cast< const ScalarMatrix<Field>* >(_BBp));
+			return A->field();
+		}
+	}; //ZOQuad
+
+	template <typename Field>
+	class SideBySide {
+		typedef ZOQuad<Field> Quad;
+	public://temp
+		const Quad *_L, *_R;
+	public:
+		SideBySide(const Quad* A, const Quad* B) :
+			_L(A), _R(B)
+		{}
+		//~SideBySide() {delete _L; delete _R;}
+
+		template <typename InVector, typename OutVector>
+		OutVector& apply(OutVector& y, const InVector& x) const
+		//OutVector& apply(OutVector& y, const InVector& x)
+		{
+			std::vector<typename Field::Element> z(y.size());
+			VectorDomain<Field> VD(field());
+			//std::vector<typename Field::Element> x_1( x.begin(), x.begin() + _L->coldim() );
+			//std::vector<typename Field::Element> x_2( x.begin() + _L->coldim(), x.end() );
+			Subvector<typename InVector::const_iterator> x_1(x.begin(), x.begin()+_L->coldim());
+			Subvector<typename InVector::const_iterator> x_2(x.begin()+_L->coldim(), x.end());
+			//std::cout << " side-by-side apply size of x: " << x.size() << " " << " size of y: " << y.size() << endl;
+			//std::cout << " side-by-side apply size of x_1: " << x_1.size() << " " << " size of x_2: " << x_2.size() << endl;
+			_L->apply (y, x_1);
+			_R->apply (z, x_2);
+			VD.addin(y, z);
+
+			return y;
+		}
+
+		template <typename InVector, typename OutVector>
+		OutVector& applyTranspose(OutVector& y, const InVector& x) const
+		//OutVector& applyTranspose(OutVector& y, const InVector& x)
+		{
+			//std::vector<typename Field::Element> y_1( y.begin(), y.begin() + _L->coldim() );
+			//std::vector<typename Field::Element> y_2( y.begin() + _L->coldim(), y.end() );
+			Subvector<typename OutVector::iterator, typename OutVector::const_iterator> y_1(y.begin(), y.begin()+_L->coldim());
+			Subvector<typename OutVector::iterator, typename OutVector::const_iterator> y_2(y.begin()+_L->coldim(), y.end());
+			_L->applyTranspose (y_1, x);
+			_R->applyTranspose (y_2, x);
+			copy(y_1.begin(), y_1.end(), y.begin());
+			copy(y_2.begin(), y_2.end(), y.begin() + y_1.size());
+			return y;
+		}
+
+		size_t rowdim()const{return _L->rowdim();}
+		size_t coldim()const{return _L->coldim() + _R->coldim();}
+		const Field& field()const {return _L->field();}
+	};
+
+	template <typename Field>
+	class OverUnder {
+		typedef ZOQuad<Field> Quad;
+	public://temp
+		const Quad *_U, *_D;
+	public:
+		OverUnder(const Quad* A, const Quad* B) :
+			_U(A), _D(B)
+		{}
+		//~OverUnder() {delete _U; delete _D;}
+
+		template <typename InVector, typename OutVector>
+		OutVector& apply(OutVector& y, const InVector& x) const
+		//OutVector& apply(OutVector& y, const InVector& x)
+		{
+			//std::vector<typename Field::Element> y_1( y.begin(), y.begin() + _U->rowdim() );
+			//std::vector<typename Field::Element> y_2( y.begin() + _U->rowdim(), y.end() );
+			Subvector<typename OutVector::iterator, typename OutVector::const_iterator> y_1(y.begin(), y.begin()+_U->rowdim());
+			Subvector<typename OutVector::iterator, typename OutVector::const_iterator> y_2(y.begin()+_U->rowdim(), y.end());
+			//if ((_A_ptr == 0) || (_B_ptr == 0)) { throw error }
+			//std::cout << " over-under apply size of x: " << x.size() << " " << " size of y: " << y.size() << endl;
+			//std::cout << " over-under apply size of y_1: " << y_1.size() << " " << " size of y_2: " << y_2.size() << endl;
+			_U->apply (y_1, x);
+			_D->apply (y_2, x);
+			//copy(y_1.begin(), y_1.end(), y.begin());
+			//copy(y_2.begin(), y_2.end(), y.begin() + y_1.size());
+
+			return y;
+		}
+
+		template <typename InVector, typename OutVector>
+		OutVector& applyTranspose(OutVector& y, const InVector& x) const
+		//OutVector& applyTranspose(OutVector& y, const InVector& x)
+		{
+			std::vector<typename Field::Element> z(y.size());
+			VectorDomain<Field> VD(field());
+			std::vector<typename Field::Element> x_1( x.begin(), x.begin() + _U->rowdim() );
+			std::vector<typename Field::Element> x_2( x.begin() + _U->rowdim(), x.end() );
+			//Subvector<typename InVector::iterator, typename InVector::const_iterator> x_1(x.begin(), x.begin()+_U->rowdim());
+			//Subvector<typename InVector::iterator, typename InVector::const_iterator> x_2(x.begin()+_U->rowdim(), x.end());
+			_U->applyTranspose (y, x_1);
+			_D->applyTranspose (z, x_2);
+			VD.addin(y, z);
+			return y;
+		}
+
+		size_t coldim() const{return _U->coldim();}
+		size_t rowdim() const{return _U->rowdim() + _D->rowdim();}
+		const Field& field() const {return _U->field();}
+	};
+
+	// similar class OverUnder<Field>
+
+}; //namespace LinBox
+
+#endif // __LINBOX_quad_matrix_H
+
diff --git a/linbox/blackbox/random-matrix-traits.h b/linbox/blackbox/random-matrix-traits.h
index 3f0d757..61dd11b 100644
--- a/linbox/blackbox/random-matrix-traits.h
+++ b/linbox/blackbox/random-matrix-traits.h
@@ -1,18 +1,37 @@
-/* -*- mode:C++ -*- */
-
-/* File: random-matrix-traits.h
- *  Author: Zhendong Wan
+/* -*- 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
+/* Copyright (C) 2010 LinBox
+ * Author: Zhendong Wan
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
-#ifndef __RANDOM_MATRIX_TRAITS_H__
-#define __RANDOM_MATRIX_TRAITS_H__
 
-namespace LinBox {
+#ifndef __LINBOX_random_matrix_traits_H
+#define __LINBOX_random_matrix_traits_H
+
+namespace LinBox
+{
 
 	template<class Matrix>
 	class RandomMatrixTraits{
-		public:
+	public:
 		typedef Matrix value_type;
 	};
 }
 
-#endif
+#endif // __LINBOX_random_matrix_traits_H
+
diff --git a/linbox/blackbox/random-matrix.h b/linbox/blackbox/random-matrix.h
index ccd16a8..11a77fa 100644
--- a/linbox/blackbox/random-matrix.h
+++ b/linbox/blackbox/random-matrix.h
@@ -1,46 +1,68 @@
-/* -*- mode:C++ -*- */
-/* File: random-matrix.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
+/* Copyright (C) 2010 LinBox
  *  Author: Zhendong Wan
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LINBOX_RANDOM_MATRIX_H__
-#define __LINBOX_RANDOM_MATRIX_H__
+
+
+#ifndef __LINBOX_blackbox_random_matrix_H
+#define __LINBOX_blackbox_random_matrix_H
 
 #include <linbox/blackbox/blackbox-interface.h>
 #include <linbox/blackbox/dense.h>
 #include <linbox/blackbox/sparse.h>
 
-namespace LinBox {
-	
+namespace LinBox
+{
+
 	class RandomMatrix : public  BlackboxInterface {
 
 	public:
 
-         /** generates random matrices used in EGV and EGV+ algorithm
+		/** Generates random matrices used in EGV and EGV+ algorithm.
 
-		  * [I, R] or [I, R]^t, where R is a random matrix.
-		 General case.
+		 * [I, R] or [I, R]^t, where R is a random matrix.
+		 * General case.
 		 */
 		template <class Blackbox, class Field>
-			static Blackbox*& randomMatrix (Blackbox* &, const Field& f, 
-							int rowdim, int coldim);
+		static Blackbox*& randomMatrix (Blackbox* &, const Field& f,
+						int rowdim, int coldim);
+
 
-		
 		// constructor a random dense matrix, whose entries are random
 		template<class Field>
-			static DenseMatrix<Field>*& randomMatrix( DenseMatrix<Field>*& Ap,
-								  const Field& f,
-								  int rowdim, int coldim ) {
-			
+		static DenseMatrix<Field>*& randomMatrix( DenseMatrix<Field>*& Ap,
+							  const Field& f,
+							  int rowdim, int coldim )
+		{
+
 			Ap = new DenseMatrix<Field>(f, rowdim, coldim);
 			typename DenseMatrix<Field>::RawIterator Ap_p;
 			typename Field::Element zero, one, elt;
 			f. init (one, 1); f. init (zero, 0);
-			
+
 			for (Ap_p = Ap -> rawBegin(); Ap_p != Ap -> rawEnd(); ++ Ap_p)
 				f. assign (*Ap_p, zero);
 
-			if (rowdim < coldim) 
+			if (rowdim < coldim)
 				for (int i = 0; i < rowdim; ++ i) {
 					Ap -> setEntry (i, i, one);
 					for (int j = rowdim; j < coldim; ++ j){
@@ -48,7 +70,7 @@ namespace LinBox {
 						Ap -> setEntry (i, j, elt);
 					}
 				}
-			else 
+			else
 				for (int i = 0; i < coldim; ++ i) {
 					Ap -> setEntry (i, i, one);
 					for (int j = coldim; j < rowdim; ++ j) {
@@ -62,14 +84,15 @@ namespace LinBox {
 		}
 
 		// constructor a very special random sparse matrix
-		// [I, R] or [I, R}^t, where R is a sparse random matrix.
+		// [I, R] or [I, R]^t, where R is a sparse random matrix.
 		template<class Field>
-			static SparseMatrix<Field>*& randomMatrix( SparseMatrix<Field>*& Ap, 
-								   const Field& f, 
-								   int rowdim, int coldim) {
-			
+		static SparseMatrix<Field>*& randomMatrix( SparseMatrix<Field>*& Ap,
+							   const Field& f,
+							   int rowdim, int coldim)
+		{
+
 			Ap = new SparseMatrix<Field>(f, rowdim, coldim);
-			
+
 			const int m = rowdim < coldim ? rowdim : coldim;
 
 			int i, j, k;
@@ -78,23 +101,23 @@ namespace LinBox {
 
 			f. init (elt, 1);
 
-			for ( i = 0; i < m; ++ i) 
-				
+			for ( i = 0; i < m; ++ i)
+
 				Ap -> setEntry (i, i, elt);
 
 
 			if ( m < rowdim ) {
 
 				const int repeat = (rowdim - m) < 10 ? rowdim - m : 10;
-				
+
 				for ( i = m; i < rowdim; ++ i) {
 
 					for ( k = 0; k < repeat; ++ k) {
-						
+
 						j = rand() % coldim;
-						
+
 						f.init(elt, rand() % 10 + 1);
-						
+
 						Ap -> setEntry (i, j, elt);
 					}
 				}
@@ -105,32 +128,34 @@ namespace LinBox {
 				int offset = coldim - m;
 
 				const int repeat = offset < 10 ? offset : 10;
-				
+
 				for ( i = 0; i < rowdim; ++ i){
-			       
+
 					for ( k = 0; k < repeat; ++ k) {
-						
+
 						j = rand() % offset + m;
-							
+
 						f.init(elt, rand() % 10 + 1);
-						
+
 						Ap -> setEntry (i, j, elt);
 					}
 				}
 			}
 
 			else {}
-			
+
 			return Ap;
 
 		}
-            
-            template<typename _Tp1> 
-            struct rebind 
-            { typedef RandomMatrix other; };
-            
+
+		template<typename _Tp1>
+		struct rebind {
+			typedef RandomMatrix other;
+		};
+
 	};
 }
 
-		
-#endif
+
+#endif //__LINBOX_blabbox_random_matrix_H
+
diff --git a/linbox/blackbox/rational-matrix-factory.h b/linbox/blackbox/rational-matrix-factory.h
new file mode 100644
index 0000000..0dee7d4
--- /dev/null
+++ b/linbox/blackbox/rational-matrix-factory.h
@@ -0,0 +1,324 @@
+/* -*- 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
+/* linbox/blackbox/rational-matrix-factory.h
+ * Copyright (C) 2009 Anna Marszalek
+ *
+ * Written by Anna Marszalek <aniau at astronet.pl>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifndef __LINBOX_rational_dense_factory_H
+#define __LINBOX_rational_dense_factory_H
+
+#include <linbox/blackbox/factory.h>
+#include <linbox/blackbox/dense.h>
+//#include <linbox/matrix/dense.h>
+//#include <linbox/field/gmp-rational.h>
+#include <linbox/field/PID-integer.h>
+#include <linbox/integer.h>
+
+#include <vector>
+
+namespace LinBox
+{
+
+/*
+ * aniau at astronet.pl 06/2009
+ * Given rational matrix _A, computes parameters needed to found best (usually integer) representation:
+ * See: denominator, rationalNorm, normAtilde, normAprim, getOmega
+ * See others: maxNorm, hadamard
+ * Computes the representation
+ * See: makeAtilde, makeAprim
+ * Works with dense matrices, needs sparse spcialization (due to use of row::iterator)
+ */
+
+
+template<class Integers, class Rationals, class QMatrix>
+class RationalMatrixFactory //: public DenseMatrixFactory<Integers,typename Rationals::Element >
+{
+//typedef GMPRationalField Rationals;
+typedef typename Rationals::Element Quotient;
+//typedef PID_integer Integers;
+//typedef typename PID_integer::Element Integer;
+//
+
+    private:
+    	const QMatrix* _A;
+	const Rationals Q;
+
+	mutable size_t rat_omega;
+	mutable size_t omega;
+	mutable Integer denA; //once computed becomes constant
+	mutable std::vector<Integer> denAi; //once computed becomes constant
+
+    public:
+
+    	RationalMatrixFactory(const QMatrix* A) :
+	      	Q(), denAi(A->rowdim(),1)
+	{rat_omega = 0; omega = 0; denA = 1; _A = A;}
+
+	size_t rowdim() { return _A->rowdim(); }
+        size_t coldim() { return _A->coldim(); }
+
+	typedef typename QMatrix::ConstRawIterator ConstRawIterator;
+        typedef typename QMatrix::ConstRowIterator RowIterator;
+
+	double maxNorm(double& res) const {
+		typename QMatrix::ConstRawIterator i;
+	        res = 0.0;
+	        double tmp;
+
+		for( i = _A->rawBegin(); i != _A->rawEnd(); ++i ) {
+			Integer d,n; Q.get_den(d,*i);Q.get_num(n,*i);
+			tmp = abs( (double)(n)/(double)(d) );
+			if( res < tmp ) res = tmp;
+		}
+	        return res;
+	}
+
+	double hadamardBound(double& res) const {
+	        typename QMatrix::ConstRowIterator r;
+	        typename QMatrix::ConstRow::const_iterator c;
+
+	        res = 1.0;
+	        double temp;
+
+		for( r = _A->rowBegin(); r != _A->rowEnd(); ++r ) {
+			temp = 0.0;
+			for( c = r->begin(); c != r->end(); ++c ) {
+				Integer d,n; Q.get_den(d,*c);Q.get_num(n,*c);
+				double a = (double) n / (double) d;
+				temp = temp + (a* a);
+			}
+	                res *= temp;
+	        }
+	        res = sqrt(res);
+	        return res;
+	}
+
+//rational specialization
+
+	/*
+	 * Returns the common denominator denA of _A
+	 */
+        Integer& denominator(Integer& da) const {
+	    if (denA ==1 ) {
+	        ConstRawIterator i;
+	        //denA = 1L;
+	        for (i = _A->rawBegin (); i != _A->rawEnd (); ++i) {
+	 	        Integer d; Q.get_den(d,*i);
+		        lcm(denA,denA,d);
+	        }
+	    }
+	    return da=denA;;
+	}
+
+	/*
+	 * returns common denominator denAi[i] of i-th row
+	 */
+	Integer& denominator(Integer& di, const int i) const {
+	  if (denAi[i]==1) {
+		typedef typename QMatrix::ConstRow::const_iterator EltIterator;
+		for (size_t j=0; j < _A->coldim(); ++j) {
+			Integer d; Q.get_den(d,_A->getEntry(i,j));
+			lcm(denAi[i],denAi[i],d);
+		}
+	  }
+	  return di=denAi[i];
+	}
+
+//returns max of abs(numerators) and denominators of _A
+	Integer& rationalNorm(Integer& res) const {
+	        ConstRawIterator i;
+	        res = 0L;
+	        Integer tmp;
+	        for (i = _A->rawBegin (); i != _A->rawEnd (); ++i) {
+		        Integer n ;Q.get_num(n,*i);
+		        Integer d ;Q.get_den(d,*i);
+			tmp = abs (n);
+			if (tmp < d) tmp = d;
+			if (res < tmp) res = tmp;
+		}
+		return res;
+	}
+
+//returns norm of A'= denA * _A
+	Integer& normAprim(Integer& res) const {
+
+                Integer DA;
+                denominator(DA);
+
+		double norm; maxNorm(norm);
+		res = (Integer) ( (double) DA * norm ) ;
+
+                return res;
+        }
+
+//returns norm of tilde{A} = diag(denAi[i])_A
+        Integer& normAtilde(Integer& res) const {
+	        //typedef typename DenseMatrixBase<Quotient>::ConstRow::const_iterator EltIterator;
+                res = 0L;
+		double dres = 0;
+                //int i=0;
+                Integer tmp;
+		double dtmp;
+                for (int i=0; i < _A->rowdim(); ++i) {
+	                Integer di; denominator(di,i);
+ 	                for (int j=0; j < _A->coldim(); ++j ) {
+	                        Integer n ; Q.get_num(n,_A->getEntry(i,j));
+                                Integer d ; Q.get_den(d,_A->getEntry(i,j));
+				dtmp = (double)di/double(d)*double(n);
+                                //tmp = di/d;
+                                //tmp*=abs(n);
+                                if (dtmp > dres) dres = dtmp;
+                	}
+        	}
+		res = (Integer)dres;
+
+		return res;
+	}
+
+/*
+ * optimization: computes normAprim, normAprim, rationalNormat the same time
+ */
+	Integer getNorms(Integer& ratnorm, Integer& normaprim, Integer& normatilde) const {
+		typedef typename QMatrix::ConstRow::const_iterator EltIterator;
+		ratnorm = 0L; normaprim=0L; normatilde= 0L;
+		Integer da=1L;
+		std::vector<integer> di(_A->rowdim(),1L);
+
+		for (size_t i=0; i < _A->rowdim(); ++i)  {
+		   if (denAi[i]==1) {
+			for (size_t j=0; j < _A->coldim(); ++j ) {
+		        	Integer d ; Q.get_den(d,_A->getEntry(i,j));
+				lcm(denAi[i],denAi[i],d);
+			}
+		   }
+		   di[i] = denAi[i];
+		   lcm(denA,denA,di[i]);
+		}
+		da = denA;
+
+		for (size_t i=0; i < _A->rowdim(); ++i )  {
+			for (size_t j=0; j < _A->coldim(); ++j ) {
+				Integer n ; Q.get_num(n,_A->getEntry(i,j));
+				Integer d ; Q.get_den(d,_A->getEntry(i,j));
+
+				Integer tmp = abs(n);
+				if (tmp > ratnorm) ratnorm = tmp;
+				if (d > ratnorm) ratnorm = d;
+
+				Integer tmp2 = (di[i]) / d;
+				tmp2 *=tmp;
+				if (tmp2 > normatilde) normatilde = tmp2;
+
+				tmp2 = da/d;
+				tmp2 *= tmp;
+				if (tmp2 > normaprim) normaprim = tmp2;
+
+			}
+		}
+		integer minnorm = (ratnorm > normatilde) ? normatilde : ratnorm;
+		return minnorm;
+	}
+/*
+	DenseMatrix< Rationals >& makeA(DenseMatrix<Rationals >& A) {
+	        //DenseMatrix<Rationals > local(Q,_A);
+		//return A = local;
+
+		for( int i=0; i < _A->rowdim(); ++i) {
+	                for (int j=0; j < _A->coldim(); ++j) {
+	                        A.setEntry(i,j, _A->getEntry(i,j));
+			}
+		}
+	}
+*/
+	/*
+	 * Creates Aprim = denA * _A
+	 */
+	template <class Matrix>
+	Matrix& makeAprim(Matrix& Aprim) const {
+		Integer da; denominator(da);
+		Aprim.resize(_A->rowdim(),_A->coldim());
+
+                for( size_t i=0; i < _A->rowdim(); ++i) {
+			for (size_t j=0; j < _A->coldim(); ++j) {
+		                Quotient  q =  _A->getEntry(i,j);
+			        Integer n ; Q.get_num(n,q);
+			        Integer d ; Q.get_den(d,q);
+		        	Integer tmp = da/d;
+			        tmp *=n;
+			        typename Matrix::Field F=Aprim.field();
+			        typename Matrix::Field::Element ftmp; F.init(ftmp,tmp);
+		        	Aprim.setEntry(i,j, ftmp);
+			}
+		}
+		return Aprim;
+	}
+
+	/*
+	 * Creates Atilde = diag(denAi[i]) * _A
+	 */
+	template <class Matrix>
+        Matrix& makeAtilde(Matrix& Atilde) const {
+
+		Atilde.resize(_A->rowdim(),_A->coldim());
+	        std::vector<integer> di(_A->rowdim());
+	        for (size_t i=0; i < _A->rowdim(); ++i) denominator(di[i],i);
+
+		for( size_t i=0; i < _A->rowdim(); ++i) {
+                        for (size_t j=0; j < _A->coldim(); ++j) {
+                        	Quotient  q = _A->getEntry(i,j);
+	                        Integer n ; Q.get_num(n,q);
+        	                Integer d ; Q.get_den(d,q);
+			        Integer tmp = di[i]/d;
+				tmp *=n;
+				typename Matrix::Field F=Atilde.field();
+				typename Matrix::Field::Element ftmp; F.init(ftmp,tmp);
+				Atilde.setEntry(i,j, ftmp);
+			}
+                }
+		return Atilde;
+  	}
+
+	/*
+	 * Counts the number of non-zero and non-integer elements
+	 */
+	size_t getOmega(size_t& o, size_t& ro) const {
+		if (omega ==0 ) {
+		    for( size_t i=0; i < _A->rowdim(); ++i) {
+                        for (size_t j=0; j < _A->coldim(); ++j) {
+				Quotient  q =  _A->getEntry(i,j);
+				Integer n ; Q.get_num(n,q);
+ 		                Integer d ; Q.get_den(d,q);
+				if (n!=0) {
+					++omega;
+					if (d!=1) ++rat_omega;
+				}
+			}
+		    }
+		}
+		ro = rat_omega;
+		return o=omega;
+	}
+};
+
+} // namespace LinBox
+
+#include "dense.inl"
+
+#endif  //__LINBOX_rational_dense_factory_H
+
diff --git a/linbox/blackbox/scalar-matrix.h b/linbox/blackbox/scalar-matrix.h
index 234115f..64acf20 100644
--- a/linbox/blackbox/scalar-matrix.h
+++ b/linbox/blackbox/scalar-matrix.h
@@ -1,8 +1,8 @@
-/* -*- mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-
+/* -*- 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
 /* linbox/blackbox/scalar.h
- * Copyright (C) 2002 by -bds  
- * evolved from diagonal.h written by William J Turner and Bradford Hovinen 
+ * Copyright (C) 2002 by -bds
+ * evolved from diagonal.h written by William J Turner and Bradford Hovinen
  *
  * -------------------------------
  * Modified by Dmitriy Morozov <linbox at foxcub.org>. May 28, 2002.
@@ -10,11 +10,13 @@
  * Added parametrization of VectorCategory tags by VectorTraits. See
  * vector-traits.h for more details.
  *
+ * see COPYING for licence details
+ *
  * -------------------------------
  */
 
-#ifndef __SCALAR_H
-#define __SCALAR_H
+#ifndef __LINBOX_scalar_H
+#define __LINBOX_scalar_H
 
 #include <algorithm>
 #include <linbox/field/hom.h>
@@ -35,42 +37,48 @@ namespace LinBox
 	 * \ingroup blackbox
 	 */
 	template <class _Field>
-	class ScalarMatrix : public  BlackboxInterface 
-	{
-	    public:
-		
+	class ScalarMatrix : public  BlackboxInterface {
+	public:
+
 		typedef _Field Field;
 		typedef typename Field::Element        Element;
 		typedef ScalarMatrix<_Field> Self_t;
 
 		/*  In each specialization, I must define suitable constructor(s) and
-		BlackboxArchetype<Vector> * clone() const;
-		Vector& apply(Vector& y, Vector& x) const;
-		Vector& applyTranspose(Vector& y, Vector& x) const;
-		size_t rowdim(void) const;
-		size_t coldim(void) const;
-		*/
+		    BlackboxArchetype<Vector> * clone() const;
+		    Vector& apply(Vector& y, Vector& x) const;
+		    Vector& applyTranspose(Vector& y, Vector& x) const;
+		    size_t rowdim(void) const;
+		    size_t coldim(void) const;
+		    Field& field() const;
+		    ...rebind...
+		    */
 
 		/// Constructs an initially 0 by 0 matrix.
-		ScalarMatrix ()	:  _n(0) {}
+		ScalarMatrix ()	:
+			_n(0)
+		{}
 
 		/** Scalar matrix Constructor from an element.
 		 * @param F	field in which to do arithmetic.
 		 * @param n	size of the matrix.
 		 * @param s	scalar, a field element, to be used as the diagonal of the matrix.
 		 */
-		ScalarMatrix (const Field &F, const size_t n, const Element &s)
-			: _F(F), _n(n), _v(s) {}
+		ScalarMatrix (const Field &F, const size_t n, const Element &s) :
+			_F(F), _n(n), _v(s)
+		{}
 
 		/** Constructor from a random element.
 		 * @param F    field in which to do arithmetic.
 		 * @param n    size of the matrix.
 		 * @param iter Random iterator from which to get the diagonal scalar element.
 		 */
-		ScalarMatrix (const Field &F, const size_t n, const typename Field::RandIter& iter)
-			: _F(F), _n(n) { iter.random(_v); }
+		ScalarMatrix (const Field &F, const size_t n, const typename Field::RandIter& iter) :
+			_F(F), _n(n)
+		{ iter.random(_v); }
 
-		ScalarMatrix(const ScalarMatrix<Field> &M) : _F(M._F)
+		ScalarMatrix(const ScalarMatrix<Field> &M) :
+			_F(M._F)
 		{
 			_n = M._n;
 			_v = M._v;
@@ -81,8 +89,8 @@ namespace LinBox
 		 * y= A*x.
 		 * Requires time linear in n, the size of the matrix.
 		 */
-                template<class OutVector, class InVector>
-		OutVector& apply(OutVector &y, InVector &x) const 
+		template<class OutVector, class InVector>
+		OutVector& apply(OutVector &y, InVector &x) const
 		{
 			//typename VectorTraits<InVector>::VectorCategory t;
 			//return _app (y, x, t);
@@ -95,44 +103,52 @@ namespace LinBox
 		 */
 		template<class OutVector, class InVector>
 		OutVector& applyTranspose(OutVector &y, InVector &x) const
-			{ return apply(y, x); }  // symmetric matrix.
+		{ return apply(y, x); }  // symmetric matrix.
+
 
+		template<typename _Tp1>
+		struct rebind {
+			typedef ScalarMatrix<_Tp1> other;
 
-		template<typename _Tp1> 
-		struct rebind 
-		{ 
-			typedef ScalarMatrix<_Tp1> other; 
-			
-			void operator() (other *& Ap, const Self_t& A, const _Tp1& F) 
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F)
 			{
-				typename _Tp1::Element e;
 				Hom<typename Self_t::Field, _Tp1> hom(A.field(), F);
+				typename _Tp1::Element e; F.init(e);
 				hom.image (e, A._v);
-				Ap = new other(F, A.coldim(),e);
+				Ap.setScalar(e);
 			}
 		};
 
+		template<typename _Tp1>
+		ScalarMatrix (const ScalarMatrix<_Tp1>& S, const Field &F) :
+			_F(F), _n(S.rowdim())
+		{
+			typename ScalarMatrix<_Tp1>::template rebind<Field>() (*this, S, F);
+		}
+
 
 		size_t rowdim(void) const { return _n; }
-    
+
 		size_t coldim(void) const { return _n; }
 
 		const Field& field() const {return _F;}
 
 		// for a specialization in solutions
 		Element& trace(Element& t) const
-		{	Element n; _F.init(n, _n); 
-		return _F.mul(t, _v, n);  
+		{	Element n; _F.init(n, _n);
+			return _F.mul(t, _v, n);
 		}
 
 		Element& getEntry(Element& x, const size_t i, const size_t j) const
-		{	
-                    return (i==j?_F.assign(x,_v):_F.init(x,0));  
+		{
+			return (i==j?_F.assign(x,_v):_F.init(x,0));
 		}
 
-		
 
-	    protected:
+		Element& getScalar(Element& x) const { return this->_F.assign(x,this->_v); }
+		Element& setScalar(const Element& x) { return this->_F.assign(this->_v,x); }
+
+	protected:
 
 		Field _F;   // Field for arithmetic
 
@@ -147,7 +163,7 @@ namespace LinBox
 
 		// sparse sequence vector _app for apply
 
-		
+
 		template <class OutVector, class InVector>
 		OutVector& _app (OutVector &y, const InVector &x, VectorCategories::SparseSequenceVectorTag) const;
 
@@ -160,32 +176,32 @@ namespace LinBox
 	// dense vector _app
 	template <class Field>
 	template <class OutVector, class InVector>
-	inline OutVector &ScalarMatrix<Field>
-		::_app(OutVector& y, const InVector& x, VectorCategories::DenseVectorTag t) const
-		{   
-		    linbox_check (x.size() >= _n);
-		    linbox_check (y.size() >= _n);
-		    typename OutVector::iterator y_iter = y.begin ();
-
-		    if (_F.isZero(_v)) // just write zeroes
-		        for ( ; y_iter != y.end ();  ++y_iter) *y_iter = _v;
-                    else if (_F.isOne(_v) ) // just copy 
+	inline OutVector &ScalarMatrix<Field>::
+	_app(OutVector& y, const InVector& x, VectorCategories::DenseVectorTag t) const
+	{
+		linbox_check (x.size() >= _n);
+		linbox_check (y.size() >= _n);
+		typename OutVector::iterator y_iter = y.begin ();
+
+		if (_F.isZero(_v)) // just write zeroes
+			for ( ; y_iter != y.end ();  ++y_iter) *y_iter = _v;
+		else if (_F.isOne(_v) ) // just copy
 			copy(x.begin(), x.end(), y.begin());
-		    else // use actual muls
-		    {   typename InVector::const_iterator x_iter = x.begin ();
-		            for (  ; y_iter != y.end () ; ++y_iter, ++x_iter )
-		                _F.mul (*y_iter, _v, *x_iter);
-		    }
-		    return y;
+		else // use actual muls
+		{   typename InVector::const_iterator x_iter = x.begin ();
+			for (  ; y_iter != y.end () ; ++y_iter, ++x_iter )
+				_F.mul (*y_iter, _v, *x_iter);
+		}
+		return y;
+
+	} // dense vector _app
 
-		} // dense vector _app
 
-		
 	// sparse sequence vector _app
 	template <class Field>
 	template <class OutVector, class InVector>
-	inline OutVector &ScalarMatrix<Field>
-		::_app(OutVector& y, const InVector& x, VectorCategories::SparseSequenceVectorTag t) const
+	inline OutVector &ScalarMatrix<Field>::
+	_app(OutVector& y, const InVector& x, VectorCategories::SparseSequenceVectorTag t) const
 	{
 		//linbox_check ((!x.empty ()) && (_n < x.back ().first));
 		// neither is required of x ?
@@ -198,19 +214,19 @@ namespace LinBox
 
 		// For each element, multiply input element with corresponding element
 		// of stored scalar and insert non-zero elements into output vector
-		for ( typename InVector::const_iterator x_iter = x.begin (); x_iter != x.end (); ++x_iter) 
+		for ( typename InVector::const_iterator x_iter = x.begin (); x_iter != x.end (); ++x_iter)
 		{	_F.mul (entry, _v, x_iter->second);
 			if (!_F.isZero (entry)) y.push_back (make_pair (x_iter->first, entry));
-		} 
+		}
 
 		return y;
 	} // sparse sequence vector _app
 
 	// sparse associative vector _app
 	template <class Field>
-		template <class OutVector, class InVector>
-	inline OutVector& ScalarMatrix<Field>
-	::_app(OutVector& y, const InVector& x, VectorCategories::SparseAssociativeVectorTag t) const
+	template <class OutVector, class InVector>
+	inline OutVector& ScalarMatrix<Field> ::
+	_app(OutVector& y, const InVector& x, VectorCategories::SparseAssociativeVectorTag t) const
 	{
 		y.clear (); // we'll overwrite using inserts
 
@@ -219,7 +235,7 @@ namespace LinBox
 		_F.init (entry, 0);
 
 		// Iterator over indices of input vector.
-		// For each element, multiply input element with 
+		// For each element, multiply input element with
 		// stored scalar and insert non-zero elements into output vector
 		for ( typename InVector::const_iterator x_iter = x.begin (); x_iter != x.end (); ++x_iter)
 		{	_F.mul (entry, _v, x_iter->second);
@@ -230,4 +246,6 @@ namespace LinBox
 	} // sparse associative vector _app
 
 } // namespace LinBox
-#endif // __ScalarMatrix
+
+#endif // __LINBOX_scalar_H
+
diff --git a/linbox/blackbox/scompose.h b/linbox/blackbox/scompose.h
index 852c49b..0f393f0 100644
--- a/linbox/blackbox/scompose.h
+++ b/linbox/blackbox/scompose.h
@@ -1,115 +1,135 @@
-/* -*- mode:C++ -*- */
-
-/* File: scompose.h
- *  Author: Zhendong Wan
+/* -*- 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
+/* Copyright (C) 2010 LinBox
+ * Written by Zhendong Wan
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
 
-/* Implemenatation of EGV and EGV+ algorithm.
- *  Compute the perturbation A+UV and LAR
- */
+#ifndef __LINBOX_scompose_H
+#define __LINBOX_scompose_H
 
-#ifndef __LINBOX_SCOMPOSE_H__
-#define __LINBOX_SCOMPOSE_H__
+/*! @file scompose.h
+ * Implemenatation of EGV and EGV+ algorithm.
+ * Compute the perturbation A+UV and LAR
+ */
 
 #include <linbox/util/debug.h>
 #include <linbox/blackbox/blackbox-interface.h>
 #include <linbox/blackbox/dense.h>
 #include <linbox/blackbox/compose.h>
 
-namespace LinBox {
-	
+namespace LinBox
+{
+
 	class SCompose : public  BlackboxInterface {
-		
+
 	public:
-		
+
 		//- general case, composeSmall is the linbox compose
 		template<class Blackbox>
-			
-			//For EGV+ algorithm, using LAR.
-			static Compose<Blackbox, Blackbox>*& compose (Compose<Blackbox, Blackbox>*& LAR,
-								      const Blackbox& L,
-								      const Blackbox& A,
-								      const Blackbox& R) {
-			
+
+		//For EGV+ algorithm, using LAR.
+		static Compose<Blackbox, Blackbox>*& compose (Compose<Blackbox, Blackbox>*& LAR,
+							      const Blackbox& L,
+							      const Blackbox& A,
+							      const Blackbox& R) {
+
 			linbox_check (L.coldim() == A.rowdim());
-			
+
 			linbox_check (A.coldim() == R.rowdim());
-			
+
 			std::vector<const Blackbox*> VB(3);
-			
+
 			VB[0] = &L;
-			
+
 			VB[1] = &A;
-			
+
 			VB[2] = &R;
 
 			LAR = new Compose<Blackbox>(VB);
 
-			return LAR;			
+			return LAR;
 		}
-		
+
 		// specialization for dense matrix case, explicitly compute the LAR by matrix multiplication
-		template <class Field>			
-			static DenseMatrix<Field>*& compose (DenseMatrix<Field>*& LAR, 
-							     const DenseMatrix<Field>& L, 
-							     const DenseMatrix<Field>& A, 
-							     const DenseMatrix<Field>& R) {
-			
+		template <class Field>
+		static DenseMatrix<Field>*& compose (DenseMatrix<Field>*& LAR,
+						     const DenseMatrix<Field>& L,
+						     const DenseMatrix<Field>& A,
+						     const DenseMatrix<Field>& R)
+		{
+
 			linbox_check (L.coldim() == A.rowdim());
-			
+
 			linbox_check (A.coldim() == R.rowdim());
-			
+
 			LAR = new DenseMatrix<Field>(L.field(), L.rowdim(), R.coldim());
-			
+
 			typename DenseMatrix<Field>::ConstRowIterator crow_p;
-			
+
 			typename DenseMatrix<Field>::RowIterator row_p;
-			
+
 			std::vector<typename Field::Element> tmp(R.rowdim());
-			
+
 			for (row_p = LAR -> rowBegin(), crow_p = L.rowBegin();
 			     row_p != LAR -> rowEnd(); ++ row_p, ++ crow_p) {
-				
+
 				A.applyTranspose(tmp, *crow_p);
-				
+
 				R.applyTranspose(*row_p, tmp);
 			}
-			
+
 			return LAR;
-			
+
 		}
-		/*
+#if 0
 		//- Compute A + UV, for EGV algorithm, not be used any more.
-		template <class Blackbox>			
-			static Blackbox*& composeBig (Blackbox*& AUV, 
-						      const Blackbox& A, 
-						      const Blackbox& U,
-						      const Blackbox& V);
-
-			
-
-		// @brief This composeBig creates A + UV for EGV algorithm for the DenseMatrix case. 
-		template <class Field>			
-			static DenseMatrix<Field>*& composeBig (DenseMatrix<Field>*& AUV, 
-							     const DenseMatrix<Field>& A, 
-							     const DenseMatrix<Field>& U, 
-							     const DenseMatrix<Field>& V) {
-			
+		template <class Blackbox>
+		static Blackbox*& composeBig (Blackbox*& AUV,
+					      const Blackbox& A,
+					      const Blackbox& U,
+					      const Blackbox& V);
+
+
+
+		// @brief This composeBig creates A + UV for EGV algorithm for the DenseMatrix case.
+		template <class Field>
+		static DenseMatrix<Field>*& composeBig (DenseMatrix<Field>*& AUV,
+							const DenseMatrix<Field>& A,
+							const DenseMatrix<Field>& U,
+							const DenseMatrix<Field>& V) {
+
 			linbox_check (U.rowdim() == A.rowdim());
-			
+
 			linbox_check (A.coldim() == V.coldim());
-			
+
 			AUV = new DenseMatrix<Field>(A.field(), A.rowdim(), A.coldim());
-			
+
 			typename DenseMatrix<Field>::ConstRowIterator crow_p;
-			
+
 			typename DenseMatrix<Field>::RowIterator row_p;
-			
+
 			for (row_p = AUV -> rowBegin(), crow_p = U.rowBegin();
 			     row_p != AUV -> rowEnd(); ++ row_p, ++ crow_p) {
-				
+
 				V.applyTranspose(*row_p, *crow_p);
-				
+
 			}
 
 			typename DenseMatrix<Field>::ConstRawIterator celt_p;
@@ -117,16 +137,18 @@ namespace LinBox {
 
 			for( elt_p = AUV -> rawBegin(), celt_p = A.rawBegin(); celt_p !=  A.rawEnd(); ++ elt_p, ++ celt_p)
 				A.field().addin(*elt_p,*celt_p);
-			
+
 			return AUV;
-			
+
 		}
-		*/
+#endif
+
+
 
-		
 	};
 }
 
 
-#endif
+#endif //__LINBOX_scompose_H
+
 
diff --git a/linbox/blackbox/sparse.h b/linbox/blackbox/sparse.h
index dcb31d3..7ec081d 100644
--- a/linbox/blackbox/sparse.h
+++ b/linbox/blackbox/sparse.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/blackbox/sparse.h
  * Copyright (C) 1999-2005 William J Turner,
  *               2001-2002 Bradford Hovinen
@@ -29,12 +29,12 @@
  * Modified by W. J. Turner <wjturner at acm.org>
  *	24.06.2005 : Removed using declarations
  * ------------------------------------
- * 
+ *
  * See COPYING for license information.
  */
 
-#ifndef __BLACKBOX_SPARSE_H
-#define __BLACKBOX_SPARSE_H
+#ifndef __LINBOX_blackbox_sparse_H
+#define __LINBOX_blackbox_sparse_H
 
 #include "linbox/linbox-config.h"
 #include "linbox/blackbox/blackbox-interface.h"
@@ -49,363 +49,369 @@
 namespace LinBox
 {
 
-/** \brief vector of sparse rows.
-    
- * This is a generic black box for a sparse matrix. It inherits
- * LinBox::SparseMatrixBase, which implements all of the underlying
- * accessors and iterators.
- * \ingroup blackbox
- */
-template <class _Field,
-	  class _Row    = typename LinBox::Vector<_Field>::Sparse>
-class SparseMatrix : public BlackboxInterface, public SparseMatrixBase<typename _Field::Element, _Row> 
-{
-    public:
-
-	typedef _Field Field;
-	typedef typename Field::Element Element;
-	typedef typename SparseMatrixBase<typename Field::Element, _Row>::Row Row;
-	typedef typename SparseMatrixBase<typename Field::Element, _Row>::Rep Rep;
-        typedef SparseMatrix<_Field, _Row> Self_t;
-    
+	/** \brief vector of sparse rows.
 
-#ifdef __LINBOX_PARALLEL
-	BB_list_list sub_list;
-#endif
-
-	FileFormatTag Format;
+	 * This is a generic black box for a sparse matrix. It inherits
+	 * LinBox::SparseMatrixBase, which implements all of the underlying
+	 * accessors and iterators.
+	 * \ingroup blackbox
+	 */
+	template <class _Field,
+	class _Row    = typename LinBox::Vector<_Field>::Sparse>
+	class SparseMatrix : public BlackboxInterface, public SparseMatrixBase<typename _Field::Element, _Row> {
+	public:
 
-	typedef typename SparseMatrixBase<typename Field::Element, _Row>::RawIterator RawIterator;
-	typedef typename SparseMatrixBase<typename Field::Element, _Row>::RawIndexedIterator RawIndexedIterator;
-	typedef typename SparseMatrixBase<typename Field::Element, _Row>::ConstRawIterator ConstRawIterator;
-	typedef typename SparseMatrixBase<typename Field::Element, _Row>::ConstRawIndexedIterator ConstRawIndexedIterator;
+		typedef _Field Field;
+		typedef typename Field::Element Element;
+		typedef typename SparseMatrixBase<typename Field::Element, _Row>::Row Row;
+		typedef typename SparseMatrixBase<typename Field::Element, _Row>::Rep Rep;
+		typedef SparseMatrix<_Field, _Row> Self_t;
 
-	/** Constructor.
-	 * Builds a zero m x n matrix
-	 * Note: the copy constructor and operator= will work as intended
-	 *       because of STL's container design
-	 * @param  F  Field over which entries exist
-	 * @param  m  Row dimension
-	 * @param  n  Column dimension
-	 */
-// 	SparseMatrix (const Field &F)
-// 		: SparseMatrixBase<Element, _Row> (0,0), _F (F), _VD (F), _MD (F), _AT (*this)
-// 	{            std::cerr << "default cstor" << std::endl;
-// }
-
-// 	SparseMatrix (const Field &F, size_t m, size_t n)
-// 		: SparseMatrixBase<Element, _Row> (m, n), _F (F), _VD (F), _MD (F), _AT (*this)
-// 	{            std::cerr << "default cstor : " <<  m << "x" << n << std::endl;
-// }
-	SparseMatrix (const Field &F, size_t m=0, size_t n=0)
-		: SparseMatrixBase<Element, _Row> (m, n), _F (F), _VD (F), _MD (F), _AT (*this)
-	{ }
-
-	/** Constructor from a vector stream
-	 * @param  F  Field over which entries exist
-	 * @param  stream  Stream with which to generate row vectors
-	 */
-        template<class VectStream>
-	SparseMatrix (const Field &F, VectStream &stream)
-		: SparseMatrixBase<Element, _Row> (stream.size (), stream.dim ()),
-		  _F (F), _VD (F), _MD (F), _AT (*this)
-	{
-		typename SparseMatrixBase<Element, _Row>::RowIterator i;
 
-		for (i = SparseMatrixBase<Element, _Row>::rowBegin (); i != SparseMatrixBase<Element, _Row>::rowEnd (); ++i)
-			stream >> *i;
-	}
+#ifdef __LINBOX_PARALLEL
+		BB_list_list sub_list;
+#endif
 
-	/** Constructor from a MatrixStream
-	 * @param ms A matrix stream properly initialized
-	 */
-	SparseMatrix( MatrixStream<Field>& ms )
-		:SparseMatrixBase<Element,_Row>(ms), _F(ms.getField()), _VD(ms.getField()), _MD(ms.getField()), _AT(*this)
-	{ }
+		FileFormatTag Format;
+
+		typedef typename SparseMatrixBase<typename Field::Element, _Row>::RawIterator RawIterator;
+		typedef typename SparseMatrixBase<typename Field::Element, _Row>::RawIndexedIterator RawIndexedIterator;
+		typedef typename SparseMatrixBase<typename Field::Element, _Row>::ConstRawIterator ConstRawIterator;
+		typedef typename SparseMatrixBase<typename Field::Element, _Row>::ConstRawIndexedIterator ConstRawIndexedIterator;
+
+		/** Constructor.
+		 * Builds a zero m x n matrix
+		 * Note: the copy constructor and operator= will work as intended
+		 *       because of STL's container design
+		 * @param  F  Field over which entries exist
+		 * @param  m  Row dimension
+		 * @param  n  Column dimension
+		 */
+#if 0
+		SparseMatrix (const Field &F) :
+			SparseMatrixBase<Element, _Row> (0,0), _F (F), _VD (F), _MD (F), _AT (*this)
+		{
+			std::cerr << "default cstor" << std::endl;
+		}
 
-	/** Copy constructor
-	 */
-	SparseMatrix (const SparseMatrix<Field, Row> &B)
-		: SparseMatrixBase<Element, _Row> (B), _F (B._F), _VD (B._F), _MD (B._F), _AT (*this)
-	{ }
+		SparseMatrix (const Field &F, size_t m, size_t n) :
+			SparseMatrixBase<Element, _Row> (m, n), _F (F), _VD (F), _MD (F), _AT (*this)
+		{
+			std::cerr << "default cstor : " <<  m << "x" << n << std::endl;
+		}
+#endif
+		SparseMatrix (const Field &F, size_t m=0, size_t n=0) :
+			SparseMatrixBase<Element, _Row> (m, n), _F (F), _VD (F), _MD (F), _AT (*this)
+		{ }
+
+		/** Constructor from a vector stream
+		 * @param  F  Field over which entries exist
+		 * @param  stream  Stream with which to generate row vectors
+		 */
+		template<class VectStream>
+		SparseMatrix (const Field &F, VectStream &stream) :
+			SparseMatrixBase<Element, _Row> (stream.size (), stream.dim ()),
+			_F (F), _VD (F), _MD (F), _AT (*this)
+		{
+			typename SparseMatrixBase<Element, _Row>::RowIterator i;
+
+			for (i = SparseMatrixBase<Element, _Row>::rowBegin (); i != SparseMatrixBase<Element, _Row>::rowEnd (); ++i)
+				stream >> *i;
+		}
 
-	/** Row type Converter constructor
-	 */
-        template<class VectorType>
-	SparseMatrix (const SparseMatrix<Field, VectorType> &B)
-		: SparseMatrixBase<Element, _Row> (B), _F (B._F), _VD (B._F), _MD (B._F), _AT (*this)
-	{ }
 
-	/** Destructor. */
-	~SparseMatrix () {
+		/** Constructor from a MatrixStream
+		 * @param ms A matrix stream properly initialized
+		 */
+		SparseMatrix( MatrixStream<Field>& ms ) :
+			SparseMatrixBase<Element,_Row>(ms), _F(ms.getField()), _VD(ms.getField()), _MD(ms.getField()), _AT(*this)
+		{ }
+
+		/** Copy constructor
+		*/
+		SparseMatrix (const SparseMatrix<Field, Row> &B) :
+			SparseMatrixBase<Element, _Row> (B), _F (B._F), _VD (B._F), _MD (B._F), _AT (*this)
+		{ }
+
+		/** Row type Converter constructor
+		*/
+		template<class VectorType>
+		SparseMatrix (const SparseMatrix<Field, VectorType> &B) :
+			SparseMatrixBase<Element, _Row> (B), _F (B._F), _VD (B._F), _MD (B._F), _AT (*this)
+		{ }
+
+		/** Destructor. */
+		~SparseMatrix () {
 #ifdef __LINBOX_PARALLEL
 
-		BB_list_list::iterator p;
+			BB_list_list::iterator p;
 
-		BB_list::iterator e_p;
+			BB_list::iterator e_p;
 
-		for (p = sub_list. begin(); p != sub_list. end(); ++ p)
-			for (e_p = p -> second. begin(); 
-			     e_p != p -> second. end(); ++ e_p) {
+			for (p = sub_list. begin(); p != sub_list. end(); ++ p)
+				for (e_p = p -> second. begin();
+				     e_p != p -> second. end(); ++ e_p) {
 
-				Thread::terminate_thread (*e_p);
+					Thread::terminate_thread (*e_p);
 
-				delete (*e_p);
-			}
+					delete (*e_p);
+				}
 #endif
-	}
+		}
 
-	/** Matrix-vector product
-	 * y = A x.
-	 * @return reference to output vector y
-	 * @param  x input vector
-	 */
-	template <class OutVector, class InVector>
-	OutVector &apply (OutVector &y, const InVector &x) const {
+		/** Matrix-vector product
+		 * \f$y = A x\f$.
+		 * @return reference to output vector y
+		 * @param  x input vector
+		 * @param y
+		 */
+		template <class OutVector, class InVector>
+		OutVector &apply (OutVector &y, const InVector &x) const
+		{
 #ifdef __LINBOX_PARALLEL
-		return BlackboxParallel (y, *this, x, BBBase::Apply);
+			return BlackboxParallel (y, *this, x, BBBase::Apply);
 #else
-		return _MD.vectorMul (y, *this, x);
+			return _MD.vectorMul (y, *this, x);
 #endif
-	}
+		}
 
-	/** Transpose matrix-vector product
-	 * y = A^T x.
-	 * @return reference to output vector y
-	 * @param  x input vector
-	 */
-	template <class OutVector, class InVector>
-	OutVector &applyTranspose (OutVector& y, const InVector &x) const { 
+		/** Transpose matrix-vector product
+		 * \f$ y = A^T x\f$.
+		 * @return reference to output vector y
+		 * @param  x input vector
+		 * @param y
+		 */
+		template <class OutVector, class InVector>
+		OutVector &applyTranspose (OutVector& y, const InVector &x) const
+		{
 #ifdef __LINBOX_PARALLEL
-		return BlackboxParallel (y, *this, x, BBBase::ApplyTranspose);
+			return BlackboxParallel (y, *this, x, BBBase::ApplyTranspose);
 #else
-		return _MD.vectorMul (y, _AT, x);
+			return _MD.vectorMul (y, _AT, x);
 #endif
-	}
-
-
-	template<typename _Tp1, typename _Rw1 = typename Rebind<_Row, _Tp1>::other> 
-	struct rebind { 
-		typedef SparseMatrix<_Tp1, _Rw1> other;	
-		
-		void operator() (other *& Ap, const Self_t& A, const _Tp1& F) {
-			Ap = new other(F, A.rowdim(), A.coldim());
-	
-// JGD 28.06.2005 
-// With both iterators, it is Segfaulting !!!!		
-// 			typename Self_t::ConstRawIterator values = A.rawBegin();
-// 			typename Self_t::ConstRawIndexedIterator indices = A.rawIndexedBegin();
-// 			typename _Tp1::Element e;		
-// 			Hom<typename Self_t::Field, _Tp1> hom(A.field(), F);		
-// 			for( ; (indices != A.rawIndexedEnd()) 
-// 				     ; ++values, ++indices ) {
-//                             hom. image (e, *values);
-// 				if (!F.isZero(e)) 
-// 					Ap -> setEntry (indices.rowIndex(), 
-// 							indices.colIndex(), e);
-// 			}
-			
-			typename _Tp1::Element e;
-			Hom<typename Self_t::Field, _Tp1> hom(A.field(), F);
-			for( typename Self_t::ConstRawIndexedIterator
-                                 indices = A.rawIndexedBegin();
-                             	 (indices != A.rawIndexedEnd()) ; 
-                                 ++indices ) {
-                            
-                            hom. image (e, A.getEntry(indices.rowIndex(),indices.colIndex()) );
-                            
-                            if (!F.isZero(e)) 
-                                Ap -> setEntry (indices.rowIndex(), 
-                                                indices.colIndex(), e);
-			}
 		}
-	};
 
 
+		template<typename _Tp1, typename _Rw1 = typename Rebind<_Row, _Tp1>::other>
+		struct rebind {
+			typedef SparseMatrix<_Tp1, _Rw1> other;
+
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F) {
+				// 			Ap = new other(F, A.rowdim(), A.coldim());
+
+				typename _Tp1::Element e;
+				Hom<typename Self_t::Field, _Tp1> hom(A.field(), F);
+				for( typename Self_t::ConstRawIndexedIterator
+				     indices = A.rawIndexedBegin();
+				     (indices != A.rawIndexedEnd()) ;
+				     ++indices ) {
+					//                             hom. image (e, A.getEntry(indices.rowIndex(),indices.colIndex()) );
+					hom. image (e, indices.value() );
+					if (!F.isZero(e))
+						Ap.setEntry (indices.rowIndex(),
+							     indices.colIndex(), e);
+				}
+			}
+		};
 
+		template<typename _Tp1, typename _Rw1>
+		SparseMatrix (const SparseMatrix<_Tp1, _Rw1> &M, const Field& F) :
+			SparseMatrixBase<Element, _Row> (M.rowdim(),M.coldim()), _F (F), _VD (F), _MD (F), _AT (*this) {
+				typename SparseMatrix<_Tp1,_Rw1>::template rebind<Field,_Row>()(*this, M, F);
+			}
 
-	/** Retreive row dimensions of Sparsemat matrix.
-	 * @return integer number of rows of SparseMatrix0Base matrix.
-	 */
-	size_t rowdim () const { return SparseMatrixBase<Element, _Row>::_m; }
 
-	/** Retreive column dimensions of Sparsemat matrix.
-	 * @return integer number of columns of SparseMatrix0Base matrix.
-	 */
-	size_t coldim () const { return SparseMatrixBase<Element, _Row>::_n; }
 
-	/** Read the matrix from a stream in the given format
-	 * @param is Input stream from which to read the matrix
-	 * @param format Format of input matrix
-	 * @return Reference to input stream
-	 */
-	std::istream &read (std::istream &is, FileFormatTag format = FORMAT_DETECT)
-	{ return SparseMatrixBase<Element, _Row>::read (is, _F, format); }
 
-	/** Write the matrix to a stream in the given format
-	 * @param os Output stream to which to write the matrix
-	 * @param format Format of output
-	 * @return Reference to output stream
-	 */
-	std::ostream &write (std::ostream &os, FileFormatTag format = FORMAT_PRETTY) const
+		/** Retreive row dimensions of Sparsemat matrix.
+		 * @return integer number of rows of SparseMatrix0Base matrix.
+		 */
+		size_t rowdim () const
+		{ return SparseMatrixBase<Element, _Row>::_m; }
+
+		/** Retreive column dimensions of Sparsemat matrix.
+		 * @return integer number of columns of SparseMatrix0Base matrix.
+		 */
+		size_t coldim () const
+		{ return SparseMatrixBase<Element, _Row>::_n; }
+
+		/** Read the matrix from a stream in the given format
+		 * @param is Input stream from which to read the matrix
+		 * @param format Format of input matrix
+		 * @return Reference to input stream
+		 */
+		std::istream &read (std::istream &is, FileFormatTag format = FORMAT_DETECT)
+		{ return SparseMatrixBase<Element, _Row>::read (is, _F, format); }
+
+		/** Write the matrix to a stream in the given format
+		 * @param os Output stream to which to write the matrix
+		 * @param format Format of output
+		 * @return Reference to output stream
+		 */
+		std::ostream &write (std::ostream &os, FileFormatTag format = FORMAT_PRETTY) const
 		{ return SparseMatrixBase<Element, _Row>::write (os, _F, format); }
 
-	// JGD 28.08.2002
-	/** Access to the base field
+		// JGD 28.08.2002
+		/** Access to the base field
+		*/
+		const Field& field () const
+		{ return _F;}
+
+	protected:
+
+		const Field                             _F;      // Field used for all arithmetic
+		VectorDomain<Field>                     _VD;     // Vector domain for matrix operations
+		MatrixDomain<Field>                     _MD;     // Matrix domain for matrix operations
+
+		TransposeMatrix<SparseMatrix<_Field, _Row> > _AT;
+
+		template<class F, class R> friend class SparseMatrix;
+		};
+
+	/** Sparse matrix factory
+	 * This class inherits \ref BlackboxFactory and provides a method for using a
+	 * \ref SparseMatrixBase object with integer or rational data type as input to
+	 * the high-level integer and rational solutions functions.
 	 */
-	const Field& field () const { return _F;}
 
-    protected:
+	template <class Field,
+	class BElement = typename Field::Element,
+	class Row      = typename LinBox::Vector<Field>::Sparse,
+	class BRow     = typename LinBox::RawVector<BElement>::Sparse>
+	class SparseMatrixFactory : public BlackboxFactory<Field,SparseMatrix<Field,Row> > {//otot
+		const SparseMatrixBase<BElement, BRow> &_A;
 
-	const Field                             _F;      // Field used for all arithmetic
-	VectorDomain<Field>                     _VD;     // Vector domain for matrix operations
-	MatrixDomain<Field>                     _MD;     // Matrix domain for matrix operations
+	public:
 
-	TransposeMatrix<SparseMatrix<_Field, _Row> > _AT;
+		SparseMatrixFactory (const SparseMatrixBase<BElement, BRow> &A) :
+			_A (A)
+		{}
 
-    	template<class F, class R> friend class SparseMatrix;
-};
+		// FIXME: This function assumes basically that the matrix is over the integers
 
-/** Sparse matrix factory
- * This class inherits \ref{BlackboxFactory} and provides a method for using a
- * \ref{SparseMatrixBase} object with integer or rational data type as input to
- * the high-level integer and rational solutions functions.
- */
+		SparseMatrix<Field,Row> *makeBlackbox (const Field &F);
+
+		integer &maxNorm (integer &res)
+		{
+			typename SparseMatrixBase<BElement, BRow>::ConstRawIterator i;
 
-template <class Field,
-	  class BElement = typename Field::Element,
-	  class Row      = typename LinBox::Vector<Field>::Sparse,
-	  class BRow     = typename LinBox::RawVector<BElement>::Sparse>
-class SparseMatrixFactory : public BlackboxFactory<Field,SparseMatrix<Field,Row> > 
-{//otot
-	const SparseMatrixBase<BElement, BRow> &_A;
+			res = 0L;
 
-    public:
+			integer tmp;
 
-	SparseMatrixFactory (const SparseMatrixBase<BElement, BRow> &A)
-		: _A (A) 
-	{}
+			for (i = _A.rawBegin (); i != _A.rawEnd (); ++i) {
+				tmp = abs (*i);
 
-	// FIXME: This function assumes basically that the matrix is over the integers
+				if (res < tmp)
+					res = tmp;
+			}
 
-	SparseMatrix<Field,Row> *makeBlackbox (const Field &F);
+			return res;
+		}
 
-	integer &maxNorm (integer &res)
-	{
-		typename SparseMatrixBase<BElement, BRow>::ConstRawIterator i;
+		size_t rowdim ()
+		{ return _A.rowdim (); }
+		size_t coldim ()
+		{ return _A.coldim (); }
 
-		res = 0L;
+		// A better bound for determinant of an integer sparse matrix, ZW
+		integer &hadamardBound (integer& res) const
+		{
+			return hadamardBound (res, typename VectorTraits<Row>::VectorCategory());
+		}
 
-		integer tmp;
+		integer &hadamardBound (integer& res,  VectorCategories::SparseParallelVectorTag) const
+		{
+			typedef typename SparseMatrixBase<BElement, BRow>::ConstRowIterator RowIterator;
+			typedef typename SparseMatrixBase<BElement, BRow>::ConstRow::second_type::const_iterator EltIterator;
 
-		for (i = _A.rawBegin (); i != _A.rawEnd (); ++i) {
-			tmp = abs (*i);
+			res = 1L;
 
-			if (res < tmp)
-				res = tmp;
+			integer tmp;
+			RowIterator row_p;
+			EltIterator elt_p;
+
+			for (row_p = _A. rowBegin(); row_p != _A. rowEnd(); ++ row_p) {
+				tmp = 0;
+
+				for (elt_p = row_p -> second. begin(); elt_p != row_p -> second. end(); ++ elt_p)
+					tmp += static_cast<integer>(*elt_p) * (*elt_p);
+
+				res *=tmp;
+			}
+
+			res = sqrt (res);
+			return res;
 		}
 
-		return res;
-	}
+		integer &hadamardBound (integer& res,  VectorCategories::SparseSequenceVectorTag) const{
+			typedef typename SparseMatrixBase<BElement, BRow>::ConstRowIterator RowIterator;
+			typedef typename SparseMatrixBase<BElement, BRow>::ConstRow::const_iterator EltIterator;
 
-	size_t rowdim ()
-        	{ return _A.rowdim (); }
-	size_t coldim ()
-		{ return _A.coldim (); }
+			res = 1L;
 
-	// A better bound for determinant of an integer sparse matrix, ZW
-	integer &hadamardBound (integer& res) const {
-		return hadamardBound (res, typename VectorTraits<Row>::VectorCategory());
-	}
+			integer tmp;
+			RowIterator row_p;
+			EltIterator elt_p;
 
-	integer &hadamardBound (integer& res,  VectorCategories::SparseParallelVectorTag) const {
-		typedef typename SparseMatrixBase<BElement, BRow>::ConstRowIterator RowIterator;
-		typedef typename SparseMatrixBase<BElement, BRow>::ConstRow::second_type::const_iterator EltIterator;
+			for ( row_p = _A. rowBegin(); row_p != _A. rowEnd(); ++ row_p) {
+				tmp = 0;
 
-		res = 1L;
+				for (EltIterator elt_p = row_p -> begin(); elt_p != row_p -> end(); ++ elt_p)
+					tmp += static_cast<integer>(elt_p -> second) * (elt_p -> second);
 
-		integer tmp;
-		RowIterator row_p;
-		EltIterator elt_p;
+				res *=tmp;
+			}
+
+			res = sqrt (res);
+			return res;
+		}
 
-		for (row_p = _A. rowBegin(); row_p != _A. rowEnd(); ++ row_p) {
-			tmp = 0;
+		integer &hadamardBound (integer& res,  VectorCategories::SparseAssociativeVectorTag) const
+		{
+			typedef typename SparseMatrixBase<BElement, BRow>::ConstRowIterator RowIterator;
+			typedef typename SparseMatrixBase<BElement, BRow>::ConstRow::const_iterator EltIterator;
 
-			for (elt_p = row_p -> second. begin(); elt_p != row_p -> second. end(); ++ elt_p)
-				tmp += static_cast<integer>(*elt_p) * (*elt_p);
+			res = 1L;
 
-			res *=tmp;
+			integer tmp;
+			RowIterator row_p;
+			EltIterator elt_p;
+
+			for ( row_p = _A. rowBegin(); row_p != _A. rowEnd(); ++ row_p) {
+				tmp = 0;
+
+				for (elt_p = row_p -> begin(); elt_p != row_p -> end(); ++ elt_p)
+					tmp += static_cast<integer>(elt_p -> second) * (elt_p -> second);
+
+				res *=tmp;
+			}
+
+			res = sqrt (res);
+			return res;
 		}
+	};
+
+#if !defined(__INTEL_COMPILER) && !defined(__CUDACC__)
+	template <>
+	#endif
+	template <class Field, class _Row>
+	struct MatrixTraits< SparseMatrix<Field, _Row> >
+	{
+		typedef SparseMatrix<Field, _Row> MatrixType;
+		typedef MatrixCategories::RowMatrixTag MatrixCategory;
+	};
 
-		res = sqrt (res);
-		return res;
-	}
-
-	integer &hadamardBound (integer& res,  VectorCategories::SparseSequenceVectorTag) const{
-		typedef typename SparseMatrixBase<BElement, BRow>::ConstRowIterator RowIterator;
-		typedef typename SparseMatrixBase<BElement, BRow>::ConstRow::const_iterator EltIterator;
-
-		res = 1L;
-		 
-		integer tmp;
-		RowIterator row_p;
-		EltIterator elt_p;
-		 
-		for ( row_p = _A. rowBegin(); row_p != _A. rowEnd(); ++ row_p) {
-			tmp = 0;
-		      
-			for (EltIterator elt_p = row_p -> begin(); elt_p != row_p -> end(); ++ elt_p)
-				tmp += static_cast<integer>(elt_p -> second) * (elt_p -> second);
-		
-			res *=tmp; 
-		} 
-		 
-		res = sqrt (res); 
-		return res; 
-	} 
-
-	integer &hadamardBound (integer& res,  VectorCategories::SparseAssociativeVectorTag) const {
-		typedef typename SparseMatrixBase<BElement, BRow>::ConstRowIterator RowIterator;
-		typedef typename SparseMatrixBase<BElement, BRow>::ConstRow::const_iterator EltIterator;
-
-		res = 1L;
-		 
-		integer tmp;
-		RowIterator row_p;
-		EltIterator elt_p;
-		 
-		for ( row_p = _A. rowBegin(); row_p != _A. rowEnd(); ++ row_p) {
-			tmp = 0;
-
-			for (elt_p = row_p -> begin(); elt_p != row_p -> end(); ++ elt_p)
-				tmp += static_cast<integer>(elt_p -> second) * (elt_p -> second);
-			 
-			res *=tmp; 
-		} 
-		 
-		res = sqrt (res); 
-		return res; 
-	} 
-};
-
-template<>
-template <class Field, class _Row>
-struct MatrixTraits< SparseMatrix<Field, _Row> >
-{ 
-	typedef SparseMatrix<Field, _Row> MatrixType;
-	typedef MatrixCategories::RowMatrixTag MatrixCategory;
-};
-
-template<>
-template <class Field, class _Row>
-struct MatrixTraits< const SparseMatrix<Field, _Row> >
-{ 
-	typedef const SparseMatrix<Field, _Row> MatrixType;
-	typedef MatrixCategories::RowMatrixTag MatrixCategory;
-};
+	template <class Field, class _Row>
+	struct MatrixTraits< const SparseMatrix<Field, _Row> >
+	{
+		typedef const SparseMatrix<Field, _Row> MatrixType;
+		typedef MatrixCategories::RowMatrixTag MatrixCategory;
+	};
 
 } // namespace LinBox
 
 #include "linbox/blackbox/sparse.inl"
 
-#endif // __BLACKBOX_SPARSE_H
+#endif // __LINBOX_blackbox_sparse_H
+
diff --git a/linbox/blackbox/sparse.inl b/linbox/blackbox/sparse.inl
index 764560d..e108ed7 100644
--- a/linbox/blackbox/sparse.inl
+++ b/linbox/blackbox/sparse.inl
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/blackbox/sparse.inl
  * Copyright (C) 1999-2001 William J Turner,
  *               2001-2002 Bradford Hovinen
@@ -20,32 +20,33 @@
  *     RawIndexIterator
  *   - Eliminated operator []; added getEntry; changed put_value to setEntry
  * ------------------------------------
- * 
+ *
  * See COPYING for license information.
  */
 
-#ifndef __BLACKBOX_SPARSE_INL
-#define __BLACKBOX_SPARSE_INL
+#ifndef __LINBOX_blackbox_sparse_INL
+#define __LINBOX_blackbox_sparse_INL
 
 #include "linbox/blackbox/sparse.h"
 
-namespace LinBox 
+namespace LinBox
 {
 
-template <class Field, class BElement,  class _Row, class BRow>
-SparseMatrix<Field,_Row> *SparseMatrixFactory<Field, BElement, _Row, BRow>::makeBlackbox (const Field &F)
-{
-	SparseMatrix<Field, _Row> *A = new SparseMatrix<Field, _Row> (F, rowdim (), coldim ());
+	template <class Field, class BElement,  class _Row, class BRow>
+	SparseMatrix<Field,_Row> *SparseMatrixFactory<Field, BElement, _Row, BRow>::makeBlackbox (const Field &F)
+	{
+		SparseMatrix<Field, _Row> *A = new SparseMatrix<Field, _Row> (F, rowdim (), coldim ());
 
-	typename SparseMatrixBase<BElement, BRow>::ConstRawIterator i;
-	typename SparseMatrixBase<BElement, BRow>::ConstRawIndexedIterator j;
+		typename SparseMatrixBase<BElement, BRow>::ConstRawIterator i;
+		typename SparseMatrixBase<BElement, BRow>::ConstRawIndexedIterator j;
 
-	for (i = _A.rawBegin (), j = _A.rawIndexedBegin (); i != _A.rawEnd (); ++i, ++j)
-		F.init (A->refEntry (j.rowIndex (), j.colIndex ()), *i);
+		for (i = _A.rawBegin (), j = _A.rawIndexedBegin (); i != _A.rawEnd (); ++i, ++j)
+			F.init (A->refEntry (j.rowIndex (), j.colIndex ()), *i);
 
-	return A;
-}
+		return A;
+	}
 
 }
 
-#endif // __BLACKBOX_SPARSE_INL
+#endif // __LINBOX_blackbox_sparse_INL
+
diff --git a/linbox/blackbox/sparse1.h b/linbox/blackbox/sparse1.h
index 72d51a8..7de571d 100644
--- a/linbox/blackbox/sparse1.h
+++ b/linbox/blackbox/sparse1.h
@@ -1,11 +1,30 @@
-// =========================================================
-// (C) The Linbox Group 1999
+/* -*- 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
+/* Copyright (C) 1999,2005 LinBox
+ * Written by  JG Dumas
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_sparse_bb_domain_H
+#define __LINBOX_sparse_bb_domain_H
+
 // Linbox wrapper for sparse vectors
-// file : lin_dom_spv_bb.h
-// Time-stamp: <03 Jun 05 11:39:34 Jean-Guillaume.Dumas at imag.fr> 
-// =========================================================
-#ifndef __SPARSE_B_B_DOMAIN_H__
-#define __SPARSE_B_B_DOMAIN_H__
 
 #include "linbox/vector/sparse.h"
 
@@ -21,403 +40,414 @@
 template <class Domain, class I = unsigned long>
 class SparseBlackBoxDom {
 public:
-    typedef          Domain                                     Domain_t;
-    typedef          Domain                                     Field;
-    typedef typename Domain::Element                            Type_t;
-    typedef          _SP_BB_VECTOR_<Sparse_Vector<Type_t, I> >  Element;
-    typedef          Sparse_Vector<Type_t, I>                   Row_t;
-    typedef          Sparse_Vector<Type_t, I>                   value_type;
-    typedef          SparseBlackBoxDom< Domain, I >             Self_t;
-    typedef          _SP_BB_VECTOR_< Type_t >                   PreferredInMatrix_t;
-    typedef          _SP_BB_VECTOR_< Type_t >                   PreferredOutMatrix_t;
+	typedef          Domain                                     Domain_t;
+	typedef          Domain                                     Field;
+	typedef typename Domain::Element                            Type_t;
+	typedef          _SP_BB_VECTOR_<Sparse_Vector<Type_t, I> >  Element;
+	typedef          Sparse_Vector<Type_t, I>                   Row_t;
+	typedef          Sparse_Vector<Type_t, I>                   value_type;
+	typedef          SparseBlackBoxDom< Domain, I >             Self_t;
+	typedef          _SP_BB_VECTOR_< Type_t >                   PreferredInMatrix_t;
+	typedef          _SP_BB_VECTOR_< Type_t >                   PreferredOutMatrix_t;
 protected:
-    typedef          Sparse_Vector<Type_t, I>                   SV_t;
-    typedef          Element                                    Rep;
-    Domain_t _domain;
-        //- As a BlackBox is a singleton we can store the only representation
-    I _row_dim, _col_dim, _nz_elem;
-    double _lognormdet;
-    Rep _container;
-    
+	typedef          Sparse_Vector<Type_t, I>                   SV_t;
+	typedef          Element                                    Rep;
+	Domain_t _domain;
+	//- As a BlackBox is a singleton we can store the only representation
+	I _row_dim, _col_dim, _nz_elem;
+	double _lognormdet;
+	Rep _container;
+
 public:
-        //--- Default cstors:
-    SparseBlackBoxDom() : _domain(),_nz_elem(0) {};
-    SparseBlackBoxDom(const Domain& D) : _domain(D),_nz_elem(0) { }
-    SparseBlackBoxDom(const Domain& D, char * mat_file) : _domain(D),_nz_elem(0) { read(mat_file) ; }
-    
-        //--- Cstor of recopy: compiler's generated
-    SparseBlackBoxDom(const Self_t& M) : _domain(M._domain),_row_dim(M.n_row()),_col_dim(M.n_col()),_nz_elem(0),_container(M._container) {}
-
-        //--- Usefull to use the same domain to perform other operations
-    const Domain_t& getdomain() const { return _domain; }
-    const Domain_t& field() const { return _domain; }
-
-        //--- BlackBox size
-    size_t n_row(const Rep& a) const { return a.size(); }
-    size_t n_col(const Rep& a) const { if (a.size() ) return a[0].actualsize(); else return 0; }
-    size_t n_elem(const Rep& a) const { 
-        long tot=0;
-        for(long s=a.size();s--;)
-            tot+=a[s].size();
-        return tot;
-    }
-
-    size_t  size() const { return _row_dim; }
-    size_t n_row() const { return _row_dim; }
-    size_t n_col() const { return _col_dim; }
-    size_t rowdim() const { return _row_dim; }
-    size_t coldim() const { return _col_dim; }
-    size_t n_elem() const { return _nz_elem; }
-    double lognorm() const { return _lognormdet; }
-
-
-    template<typename _Tp1> 
-    struct rebind 
-    { typedef SparseBlackBoxDom<_Tp1> other; };
-
-        //--- initializations
-    Rep& init(Rep& a, char * mat_file) const {
-        I ni,nj,ne;  double lognorm;
-        return read(a,ni,nj,ne,lognorm,mat_file); 
-    }
-
-//    Rep& init(Rep& a) const { return a = _container; }
-    void init(Rep& a) { _container = a; _row_dim = n_row(a); _col_dim = n_col(a); _nz_elem = n_elem(a); }
-    Rep& init(char * mat_file) { return read(mat_file); }
-    
-  // ***********************************************************
-  // Access to the sparse matrix representation of the black-box 
-  // Reads to a file in the sparse format if the entries can be 
-  // converted to %ld, otherwise ?
-
-    Rep& read (Rep& ca, I& ni, I& nj, I& ne, double& lognorm, char * mat_file) const { 
-        char *UT, *File_Name;
-        int is_gzipped = 0;
-        size_t s = strlen(mat_file);
-        if ((mat_file[--s] == 'z') && (mat_file[--s] == 'g') && (mat_file[--s] == '.')) {
-            is_gzipped = 1;
-            File_Name = tempnam("/tmp","bbx_");
-            UT = new char[s+34+strlen(File_Name)];
-            sprintf(UT,"gunzip -c %s > %s", mat_file, File_Name);
-            system(UT);
-            sprintf(UT,"\\rm %s", File_Name);
-        } else
-            File_Name = mat_file;
-
-        FILE* FileDes = fopen(File_Name, "r");
-        if (FileDes != NULL) {
- 	    char * tmp = new char[200]; unsigned long tni, tnj;
-            fscanf(FileDes,"%ld %ld %s\n",&tni, &tnj, &tmp) ;
-            ni = tni; nj =tnj;
-	    // delete [] tmp;
-            ca.resize( ni ); ne=0;
-
-            long i,j;
-	    long val;
-            fscanf(FileDes,"%ld %ld %ld\n",&i, &j, &val) ;
-            typename Domain_t::Element cour;
-	
-            lognorm = 0.0;
-            double normrow = 0.0; 
-
-            for(unsigned long ii=0; ii<ni; ++ii) {
-                    // No non-zero element yet
-                normrow = 0.0;
-                ca[ii].resize(0);
-		ca[ii].reactualsize(nj);
-                while (i == (ii+1)) {
-                    _domain.init( cour, val );
-                    if (! _domain.isZero( cour )) {
-                        ca[ii].push_back( SV_t::value_type(j-1, cour ) );
-                        ++ne;
-                        normrow += double(cour) * double(cour);
-                        
-                    }
-                    fscanf(FileDes,"%ld %ld %ld\n",&i, &j, &val) ;
-                }
-                if (normrow > 1.0) lognorm += log( normrow )/2.0;
-            }
-
-            fclose(FileDes);
-            if (is_gzipped) {
-                system(UT);
-            }        
-        }
-
-        return ca;
-    }
-     
-
-    void read (I& ni, I& nj, char * mat_file) const { 
-        char *UT, *File_Name;
-        int is_gzipped = 0;
-        size_t s = strlen(mat_file);
-        if ((mat_file[--s] == 'z') && (mat_file[--s] == 'g') && (mat_file[--s] == '.')) {
-            is_gzipped = 1;
-            File_Name = tempnam("/tmp","bbx_");
-            UT = new char[s+44+strlen(File_Name)];
-            sprintf(UT,"gunzip -c %s | head -1 > %s", mat_file, File_Name);
-            system(UT);
-            sprintf(UT,"\\rm %s", File_Name);
-        } else
-            File_Name = mat_file;
-
-        FILE* FileDes = fopen(File_Name, "r");
-        if (FileDes != NULL) {
- 	    char * tmp = new char[200]; unsigned long tni, tnj;
-            fscanf(FileDes,"%ld %ld %s\n",&tni, &tnj, &tmp) ;
-            ni = tni; nj =tnj;
-        }
-
-        fclose(FileDes);
-        if (is_gzipped) {
-            system(UT);
-        }        
-    }
-     
-    Rep& read (char * mat_file) { return read(_container,_row_dim,_col_dim,_nz_elem, _lognormdet, mat_file); }
-    
-    Rep& read_transpose (Rep& ca, I& ni, I& nj, I& ne, char * mat_file)  {
-        char *UT, *File_Name;
-        int is_gzipped = 0;
-        size_t s = strlen(mat_file);
-        if ((mat_file[--s] == 'z') && (mat_file[--s] == 'g') && (mat_file[--s] == '.')) {
-            is_gzipped = 1;
-            File_Name = tempnam("/tmp","bbx_");
-            UT = new char[s+34+strlen(File_Name)];
-            sprintf(UT,"gunzip -c %s > %s", mat_file, File_Name);
-            system(UT);
-            sprintf(UT,"\\rm %s", File_Name);
-        } else
-            File_Name = mat_file;
-        
-        FILE* FileDes = fopen(File_Name, "r");
-        if (FileDes != NULL) {
- 	    char * tmp = new char[200]; unsigned long tni, tnj;
-            fscanf(FileDes,"%ld %ld %s\n",&tni, &tnj, &tmp) ;
-            ni = tnj; nj =tni;
-            ca.resize(ni); ne = 0;
-            for(long l=0; l<ni; ++l)
-            { ca[l].reactualsize(nj); ca[l].resize(0); }
-            
-            long i,j;
-	    long val;
-            fscanf(FileDes,"%ld %ld %ld\n",&i, &j, &val) ;
-            typename Domain_t::Element cour;
-            
-            for(long ii=0; ii<nj; ++ii)
-                while (i == (ii+1)) {
-                    _domain.init( cour, val );
-                    if (! _domain.isZero( cour )) {
-                        ca[j-1].push_back( SV_t::value_type(I(ii), cour ) );
-                        ++ne;
-                    }
-                    fscanf(FileDes,"%ld %ld %ld\n",&i, &j, &val) ;
-                }     
-        }
-
-        fclose(FileDes);
-        if (is_gzipped) {
-            system(UT);
-        }
-    }
-
-    Rep& read_transpose (char * mat_file) { return read_transpose(_container, _row_dim, _col_dim, _nz_elem, mat_file); }
-    
-
-    void write(char * O_File_Name, const Rep& ca ) const {
-        FILE* FileDes = fopen(O_File_Name, "w");
-        if (FileDes != 0) {
-           I nr=n_row(ca),nc=n_col(ca);
-           fprintf(FileDes,"%ld %ld M\n",nr,nc);      
-           typename SV_t::value_type _entry;
-           for (long i=0; i<nr; i++) 
-             for (long j=0; j< ca[i].size(); j++) {            
-               _entry=ca[i][j];    
-               fprintf(FileDes,"%ld %ld %ld\n",i+1,_entry.getindex() +1,_domain.write( _entry.getvalue() ));
-	     }
-           fprintf(FileDes,"%ld %ld %ld\n",0,0,0);           
-        }
-        fclose(FileDes);
-    }
-    
-    void write(char * O_File_Name) const { write(O_File_Name, _container) ; }
-
-
-  // ***********************************************************
-  // Access to the sparse matrix representation of the black-box 
-  // Reads from a stream in the sparse format if the entries 
-  // read from long 
-  // GV - PG
-
-    Rep& read (std::istream& is, Rep& ca, I& ni, I& nj, I& ne) const { 
-
- 	    char * tmp = new char[200]; 
-
-            is >> ni;
-            is >> nj;
-            is >> tmp;
-
-	    // delete [] tmp;
-            ca.resize( ni ); ne=0;
-//          ca = Rep( ni ); ne=0;
-
-            long i,j;
-	    long val;
-            is >> i >> j >> val ; 
-            typename Domain_t::Element cour;
-	
-            for(unsigned long ii=0; ii<ni; ++ii) {
-                    // No non-zero element yet
-//                ca[ii] = SV_t(0,nj);
-                ca[ii].resize(0);
-		ca[ii].reactualsize(nj);
-                while (i == (ii+1)) {
-                    _domain.init( cour, val );
-                    if (! _domain.isZero( cour )) {
-                        ca[ii].push_back( SV_t::value_type(j-1, cour ) );
-                        ++ne;
-                    }
-                    is >> i >> j >> val ; 
-                }
-            }
-
-        return ca;
-    }
-     
-
-     Rep& read (std::istream& is)
-           { return read(is, _container, _row_dim, _col_dim, _nz_elem); } 
-
-
-
-  // ***********************************************************
-  // Write a sparse matrix to an output stream 
-  // GV - PG
-  // JGD : removed -1
-
-    std::ostream& write(std::ostream& os, const Rep& ca ) const {
-
-           I nr=n_row(ca),nc=n_col(ca);
-           os << nr << " " << nc << "\n";   
-           typename SV_t::value_type _entry;
-           for (long i=0; i<nr; i++) 
-             for (long j=0; j< ca[i].size(); j++) {            
-               _entry=ca[i][j];    
-               os << i+1 << " " << _entry.getindex() +1 << " "; 
-               _domain.write(os, _entry.getvalue() );
-               os << "\n"; 
-	     }
-	   return os << "\n";        
-    }
-    
-    std::ostream& write(std::ostream& os) const { return write(os, _container) ; }
-
-
-
-
-        //-- BlackBox methods
-
-    template<class OutMatrix, class InMatrix>
-    OutMatrix& apply(OutMatrix& res, const InMatrix& vect, const Rep& ca ) const {
-        typename SV_t::value_type toto;
-        I k,i;
-        res.resize(n_row());
-        for(k=n_row(); k-- ; )
-            for( res[k]=_domain.zero, i=ca[k].size(); i-- ; ) {
-                toto = ca[k][i];
-                _domain.axpyin(res[k],toto.getvalue(),vect[toto.getindex()]);
-            }
-        return res;
-    }
-
-    template<class OutMatrix, class InMatrix>
-    OutMatrix& apply(OutMatrix& res, const InMatrix& vect) const {
-        return apply(res, vect, _container);
-    }
-    
-    template<class OutMatrix, class InMatrix>
-    OutMatrix& applyTranspose(OutMatrix& res, const InMatrix& vect, const Rep& ca) const {
-        typename SV_t::value_type toto;
-        I k,i;
-        res.resize(n_col());
-        for(i=res.size(); i-- ; )
-            res[i] = _domain.zero;
-        for(k=ca.size(); k-- ; )
-            for(i=ca[k].size(); i-- ; ) {
-                toto = ca[k][i];
-                _domain.axpyin(res[ toto.getindex() ],toto.getvalue(), vect[k]);
-            }
-        return res;
-    }
-
-    template<class OutMatrix, class InMatrix>
-    OutMatrix& applyTranspose(OutMatrix& res, const InMatrix& vect) const {
-        return applyTranspose(res, vect, _container);
-    }
-
-        //-- Special Methods
-
-  const Row_t& operator[] (const I i)  const { return _container[i]; }
-  Row_t& operator[] (const I i) { return _container[i]; } ;
-
-
-   template<class Left, class Right>
-    Rep& rank_precondition(const Left& l, const Right& r, Rep& ca) const {
-        Type_t tmp;
-        for(long ii=ca.size()-1; ii>=0; --ii)
-            for(long jj=ca[ii].size()-1; jj>=0; --jj)
-                ca[ii][jj].change_value( _domain.mulin( _domain.mul(tmp, l[ii], ca[ii][jj].getvalue()), r[ca[ii][jj].getindex()] ) );
-        return ca;
-    }
-            
-    template<class Left, class Right>
-    Rep& rank_precondition(const Left& l, const Right& r) {
-        return rank_precondition(l, r, _container);
-    }
-            
-    template<class RandGen>
-    void precondition(RandGen& g) {
-        I ll=0;
-        PreferredOutMatrix_t diag_left(_row_dim);
-        for(; ll<_row_dim; ++ll)
-            _domain.nonzerorandom(g, diag_left[ll]);
- 
-        PreferredInMatrix_t diag_right(_col_dim);
-        for(ll=0;ll<_col_dim; ++ll)
-            _domain.nonzerorandom(g, diag_right[ll]);
-
-        rank_precondition(diag_left, diag_right);
-    }
-
-
-    Type_t& trace(Type_t& t, const Rep& ca) {
-        t = _domain.zero;
-        for(long ii=ca.size()-1; ii>=0; --ii) 
-            for(long jj=ca[ii].size()-1; jj>=0; --jj)
-               if (ca[ii][jj].getindex() == (ii))
-                    _domain.addin(t, ca[ii][jj].getvalue());
-        return t;
-    }       
-
-    Type_t& trace(Type_t& t) {
-        return trace(t, _container);
-    }       
-
-    Type_t& trace_ata(Type_t& t, const Rep& ca) {
-        t = _domain.zero;
-        for(long ii=ca.size()-1; ii>=0; --ii)
-            for(long jj=ca[ii].size()-1; jj>=0; --jj)
-                _domain.axpyin(t, ca[ii][jj].getvalue(), ca[ii][jj].getvalue());
-        return t;
-    }       
-
-    Type_t& trace_ata(Type_t& t) {
-        return trace_ata(t, _container);
-    }       
+	//--- Default cstors:
+	SparseBlackBoxDom() :
+		_domain(),_nz_elem(0)
+	{};
+	SparseBlackBoxDom(const Domain& D) :
+		_domain(D),_nz_elem(0)
+	{ }
+	SparseBlackBoxDom(const Domain& D, char * mat_file) :
+		_domain(D),_nz_elem(0)
+	{ read(mat_file) ; }
+
+	//--- Cstor of recopy: compiler's generated
+	SparseBlackBoxDom(const Self_t& M) :
+		_domain(M._domain),_row_dim(M.n_row()),_col_dim(M.n_col()),_nz_elem(0),_container(M._container)
+	{}
+
+	//--- Usefull to use the same domain to perform other operations
+	const Domain_t& getdomain() const { return _domain; }
+	const Domain_t& field() const { return _domain; }
+
+	//--- BlackBox size
+	size_t n_row(const Rep& a) const { return a.size(); }
+	size_t n_col(const Rep& a) const { if (a.size() ) return a[0].actualsize(); else return 0; }
+	size_t n_elem(const Rep& a) const
+	{
+		long tot=0;
+		for(long s=a.size();s--;)
+			tot+=a[s].size();
+		return tot;
+	}
+
+	size_t  size() const { return _row_dim; }
+	size_t n_row() const { return _row_dim; }
+	size_t n_col() const { return _col_dim; }
+	size_t rowdim() const { return _row_dim; }
+	size_t coldim() const { return _col_dim; }
+	size_t n_elem() const { return _nz_elem; }
+	double lognorm() const { return _lognormdet; }
+
+
+	template<typename _Tp1>
+	struct rebind
+	{ typedef SparseBlackBoxDom<_Tp1> other; };
+
+	//--- initializations
+	Rep& init(Rep& a, char * mat_file) const {
+		I ni,nj,ne;  double lognorm;
+		return read(a,ni,nj,ne,lognorm,mat_file);
+	}
+
+	//    Rep& init(Rep& a) const { return a = _container; }
+	void init(Rep& a) { _container = a; _row_dim = n_row(a); _col_dim = n_col(a); _nz_elem = n_elem(a); }
+	Rep& init(char * mat_file) { return read(mat_file); }
+
+	// ***********************************************************
+	// Access to the sparse matrix representation of the black-box
+	// Reads to a file in the sparse format if the entries can be
+	// converted to %ld, otherwise ?
+
+	Rep& read (Rep& ca, I& ni, I& nj, I& ne, double& lognorm, char * mat_file) const {
+		char *UT, *File_Name;
+		int is_gzipped = 0;
+		size_t s = strlen(mat_file);
+		if ((mat_file[--s] == 'z') && (mat_file[--s] == 'g') && (mat_file[--s] == '.')) {
+			is_gzipped = 1;
+			File_Name = tempnam("/tmp","bbx_");
+			UT = new char[s+34+strlen(File_Name)];
+			sprintf(UT,"gunzip -c %s > %s", mat_file, File_Name);
+			system(UT);
+			sprintf(UT,"\\rm %s", File_Name);
+		}
+		else
+			File_Name = mat_file;
+
+		FILE* FileDes = fopen(File_Name, "r");
+		if (FileDes != NULL) {
+			char * tmp = new char[200]; unsigned long tni, tnj;
+			fscanf(FileDes,"%ld %ld %s\n",&tni, &tnj, &tmp) ;
+			ni = tni; nj =tnj;
+			// delete [] tmp;
+			ca.resize( ni ); ne=0;
+
+			long i,j;
+			long val;
+			fscanf(FileDes,"%ld %ld %ld\n",&i, &j, &val) ;
+			typename Domain_t::Element cour;
+
+			lognorm = 0.0;
+			double normrow = 0.0;
+
+			for(unsigned long ii=0; ii<ni; ++ii) {
+				// No non-zero element yet
+				normrow = 0.0;
+				ca[ii].resize(0);
+				ca[ii].reactualsize(nj);
+				while (i == (ii+1)) {
+					_domain.init( cour, val );
+					if (! _domain.isZero( cour )) {
+						ca[ii].push_back( SV_t::value_type(j-1, cour ) );
+						++ne;
+						normrow += double(cour) * double(cour);
+
+					}
+					fscanf(FileDes,"%ld %ld %ld\n",&i, &j, &val) ;
+				}
+				if (normrow > 1.0) lognorm += log( normrow )/2.0;
+			}
+
+			fclose(FileDes);
+			if (is_gzipped) {
+				system(UT);
+			}
+		}
+
+		return ca;
+	}
+
+
+	void read (I& ni, I& nj, char * mat_file) const {
+		char *UT, *File_Name;
+		int is_gzipped = 0;
+		size_t s = strlen(mat_file);
+		if ((mat_file[--s] == 'z') && (mat_file[--s] == 'g') && (mat_file[--s] == '.')) {
+			is_gzipped = 1;
+			File_Name = tempnam("/tmp","bbx_");
+			UT = new char[s+44+strlen(File_Name)];
+			sprintf(UT,"gunzip -c %s | head -1 > %s", mat_file, File_Name);
+			system(UT);
+			sprintf(UT,"\\rm %s", File_Name);
+		}
+		else
+			File_Name = mat_file;
+
+		FILE* FileDes = fopen(File_Name, "r");
+		if (FileDes != NULL) {
+			char * tmp = new char[200]; unsigned long tni, tnj;
+			fscanf(FileDes,"%ld %ld %s\n",&tni, &tnj, &tmp) ;
+			ni = tni; nj =tnj;
+		}
+
+		fclose(FileDes);
+		if (is_gzipped) {
+			system(UT);
+		}
+	}
+
+	Rep& read (char * mat_file) { return read(_container,_row_dim,_col_dim,_nz_elem, _lognormdet, mat_file); }
+
+	Rep& read_transpose (Rep& ca, I& ni, I& nj, I& ne, char * mat_file)  {
+		char *UT, *File_Name;
+		int is_gzipped = 0;
+		size_t s = strlen(mat_file);
+		if ((mat_file[--s] == 'z') && (mat_file[--s] == 'g') && (mat_file[--s] == '.')) {
+			is_gzipped = 1;
+			File_Name = tempnam("/tmp","bbx_");
+			UT = new char[s+34+strlen(File_Name)];
+			sprintf(UT,"gunzip -c %s > %s", mat_file, File_Name);
+			system(UT);
+			sprintf(UT,"\\rm %s", File_Name);
+		}
+		else
+			File_Name = mat_file;
+
+		FILE* FileDes = fopen(File_Name, "r");
+		if (FileDes != NULL) {
+			char * tmp = new char[200]; unsigned long tni, tnj;
+			fscanf(FileDes,"%ld %ld %s\n",&tni, &tnj, &tmp) ;
+			ni = tnj; nj =tni;
+			ca.resize(ni); ne = 0;
+			for(long l=0; l<ni; ++l)
+			{ ca[l].reactualsize(nj); ca[l].resize(0); }
+
+			long i,j;
+			long val;
+			fscanf(FileDes,"%ld %ld %ld\n",&i, &j, &val) ;
+			typename Domain_t::Element cour;
+
+			for(long ii=0; ii<nj; ++ii)
+				while (i == (ii+1)) {
+					_domain.init( cour, val );
+					if (! _domain.isZero( cour )) {
+						ca[j-1].push_back( SV_t::value_type(I(ii), cour ) );
+						++ne;
+					}
+					fscanf(FileDes,"%ld %ld %ld\n",&i, &j, &val) ;
+				}
+		}
+
+		fclose(FileDes);
+		if (is_gzipped) {
+			system(UT);
+		}
+	}
+
+	Rep& read_transpose (char * mat_file) { return read_transpose(_container, _row_dim, _col_dim, _nz_elem, mat_file); }
+
+
+	void write(char * O_File_Name, const Rep& ca ) const {
+		FILE* FileDes = fopen(O_File_Name, "w");
+		if (FileDes != 0) {
+			I nr=n_row(ca),nc=n_col(ca);
+			fprintf(FileDes,"%ld %ld M\n",nr,nc);
+			typename SV_t::value_type _entry;
+			for (long i=0; i<nr; i++)
+				for (long j=0; j< ca[i].size(); j++) {
+					_entry=ca[i][j];
+					fprintf(FileDes,"%ld %ld %ld\n",i+1,_entry.getindex() +1,_domain.write( _entry.getvalue() ));
+				}
+			fprintf(FileDes,"%ld %ld %ld\n",0,0,0);
+		}
+		fclose(FileDes);
+	}
+
+	void write(char * O_File_Name) const { write(O_File_Name, _container) ; }
+
+
+	// ***********************************************************
+	// Access to the sparse matrix representation of the black-box
+	// Reads from a stream in the sparse format if the entries
+	// read from long
+	// GV - PG
+
+	Rep& read (std::istream& is, Rep& ca, I& ni, I& nj, I& ne) const {
+
+		char * tmp = new char[200];
+
+		is >> ni;
+		is >> nj;
+		is >> tmp;
+
+		// delete [] tmp;
+		ca.resize( ni ); ne=0;
+		//          ca = Rep( ni ); ne=0;
+
+		long i,j;
+		long val;
+		is >> i >> j >> val ;
+		typename Domain_t::Element cour;
+
+		for(unsigned long ii=0; ii<ni; ++ii) {
+			// No non-zero element yet
+			//                ca[ii] = SV_t(0,nj);
+			ca[ii].resize(0);
+			ca[ii].reactualsize(nj);
+			while (i == (ii+1)) {
+				_domain.init( cour, val );
+				if (! _domain.isZero( cour )) {
+					ca[ii].push_back( SV_t::value_type(j-1, cour ) );
+					++ne;
+				}
+				is >> i >> j >> val ;
+			}
+		}
+
+		return ca;
+	}
+
+
+	Rep& read (std::istream& is)
+	{ return read(is, _container, _row_dim, _col_dim, _nz_elem); }
+
+
+
+	// ***********************************************************
+	// Write a sparse matrix to an output stream
+	// GV - PG
+	// JGD : removed -1
+
+	std::ostream& write(std::ostream& os, const Rep& ca ) const {
+
+		I nr=n_row(ca),nc=n_col(ca);
+		os << nr << " " << nc << "\n";
+		typename SV_t::value_type _entry;
+		for (long i=0; i<nr; i++)
+			for (long j=0; j< ca[i].size(); j++) {
+				_entry=ca[i][j];
+				os << i+1 << " " << _entry.getindex() +1 << " ";
+				_domain.write(os, _entry.getvalue() );
+				os << "\n";
+			}
+		return os << "\n";
+	}
+
+	std::ostream& write(std::ostream& os) const { return write(os, _container) ; }
+
+
+
+
+	//-- BlackBox methods
+
+	template<class OutMatrix, class InMatrix>
+	OutMatrix& apply(OutMatrix& res, const InMatrix& vect, const Rep& ca ) const {
+		typename SV_t::value_type toto;
+		I k,i;
+		res.resize(n_row());
+		for(k=n_row(); k-- ; )
+			for( res[k]=_domain.zero, i=ca[k].size(); i-- ; ) {
+				toto = ca[k][i];
+				_domain.axpyin(res[k],toto.getvalue(),vect[toto.getindex()]);
+			}
+		return res;
+	}
+
+	template<class OutMatrix, class InMatrix>
+	OutMatrix& apply(OutMatrix& res, const InMatrix& vect) const {
+		return apply(res, vect, _container);
+	}
+
+	template<class OutMatrix, class InMatrix>
+	OutMatrix& applyTranspose(OutMatrix& res, const InMatrix& vect, const Rep& ca) const {
+		typename SV_t::value_type toto;
+		I k,i;
+		res.resize(n_col());
+		for(i=res.size(); i-- ; )
+			res[i] = _domain.zero;
+		for(k=ca.size(); k-- ; )
+			for(i=ca[k].size(); i-- ; ) {
+				toto = ca[k][i];
+				_domain.axpyin(res[ toto.getindex() ],toto.getvalue(), vect[k]);
+			}
+		return res;
+	}
+
+	template<class OutMatrix, class InMatrix>
+	OutMatrix& applyTranspose(OutMatrix& res, const InMatrix& vect) const {
+		return applyTranspose(res, vect, _container);
+	}
+
+	//-- Special Methods
+
+	const Row_t& operator[] (const I i)  const { return _container[i]; }
+	Row_t& operator[] (const I i) { return _container[i]; } ;
+
+
+	template<class Left, class Right>
+	Rep& rank_precondition(const Left& l, const Right& r, Rep& ca) const {
+		Type_t tmp;
+		for(long ii=ca.size()-1; ii>=0; --ii)
+			for(long jj=ca[ii].size()-1; jj>=0; --jj)
+				ca[ii][jj].change_value( _domain.mulin( _domain.mul(tmp, l[ii], ca[ii][jj].getvalue()), r[ca[ii][jj].getindex()] ) );
+		return ca;
+	}
+
+	template<class Left, class Right>
+	Rep& rank_precondition(const Left& l, const Right& r) {
+		return rank_precondition(l, r, _container);
+	}
+
+	template<class RandGen>
+	void precondition(RandGen& g) {
+		I ll=0;
+		PreferredOutMatrix_t diag_left(_row_dim);
+		for(; ll<_row_dim; ++ll)
+			_domain.nonzerorandom(g, diag_left[ll]);
+
+		PreferredInMatrix_t diag_right(_col_dim);
+		for(ll=0;ll<_col_dim; ++ll)
+			_domain.nonzerorandom(g, diag_right[ll]);
+
+		rank_precondition(diag_left, diag_right);
+	}
+
+
+	Type_t& trace(Type_t& t, const Rep& ca) {
+		t = _domain.zero;
+		for(long ii=ca.size()-1; ii>=0; --ii)
+			for(long jj=ca[ii].size()-1; jj>=0; --jj)
+				if (ca[ii][jj].getindex() == (ii))
+					_domain.addin(t, ca[ii][jj].getvalue());
+		return t;
+	}
+
+	Type_t& trace(Type_t& t) {
+		return trace(t, _container);
+	}
+
+	Type_t& trace_ata(Type_t& t, const Rep& ca) {
+		t = _domain.zero;
+		for(long ii=ca.size()-1; ii>=0; --ii)
+			for(long jj=ca[ii].size()-1; jj>=0; --jj)
+				_domain.axpyin(t, ca[ii][jj].getvalue(), ca[ii][jj].getvalue());
+		return t;
+	}
+
+	Type_t& trace_ata(Type_t& t) {
+		return trace_ata(t, _container);
+	}
 
 };
 
+#endif // __LINBOX_sparse_bb_domain_H
 
-
-#endif // __SPARSE_B_B_DOMAIN_H__
diff --git a/linbox/blackbox/squarize.h b/linbox/blackbox/squarize.h
new file mode 100644
index 0000000..bf6bb0c
--- /dev/null
+++ b/linbox/blackbox/squarize.h
@@ -0,0 +1,182 @@
+/* -*- 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
+/* linbox/blackbox/transpose.h
+ * Copyright (C) 2001 Bradford Hovinen
+ *
+ * Written by Bradford Hovinen <hovinen at cis.udel.edu>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_squarize_H
+#define __LINBOX_squarize_H
+
+#include <linbox/blackbox/blackbox-interface.h>
+
+#ifndef GIVMAX
+#define GIVMAX(a,b) ((b)>(a)?(b):(a))
+#endif
+
+// Namespace in which all LinBox library code resides
+namespace LinBox
+{
+
+	/** \brief transpose matrix without copying.
+
+	  \ingroup blackbox
+
+	 * @param Vector \ref LinBox dense or sparse vector of field elements
+	 */
+	template <class Blackbox>
+	class Squarize : public BlackboxInterface {
+
+	public:
+		typedef Blackbox Blackbox_t;
+		typedef Squarize<Blackbox> Self_t;
+
+		typedef typename Blackbox::Field Field;
+		typedef typename Blackbox::Element Element;
+
+		/** Constructor from a black box.
+		 * This constructor creates a matrix that the transpose of a black box
+		 * matrix A
+		 * @param A pointer to black box matrix.
+		 */
+		Squarize (const Blackbox& A) :
+			_A_ptr(&A)
+		{
+			_A_ptr->field().init(_Zero,0UL);
+		}
+
+		Squarize (const Blackbox *A_ptr) :
+			_A_ptr(A_ptr)
+		{
+			_A_ptr->field().init(_Zero,0UL);
+			// create new copies of matrices in dynamic memory
+			//linbox_check (A_ptr != NULL);
+			//_A_ptr = A_ptr->clone ();
+		}
+
+		/** Copy constructor.
+		 * Creates new black box objects in dynamic memory.
+		 * @param M constant reference to compose black box matrix
+		 */
+		Squarize (const Squarize<Blackbox> &M) :
+			_A_ptr(M._A_ptr)
+		{
+			_A_ptr->field().init(_Zero,0UL);
+			// create new copies of matrices in dynamic memory
+			//linbox_check (M._A_ptr != NULL);
+			//_A_ptr = M._A_ptr->clone ();
+		}
+
+		/// Destructor
+		~Squarize (void)
+		{
+		}
+
+		template<typename _Tp1>
+		struct rebind
+		{
+			typedef Squarize<typename Blackbox::template rebind<_Tp1>::other> other;
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F) {
+				typename Blackbox_t::template rebind<_Tp1> () ( *(Ap._A_ptr), *(A._A_ptr), F);
+			}
+		};
+
+		/** Application of BlackBox matrix.
+		 * y= A*x.
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
+		 * Required by abstract base class.
+		 * @return reference to vector y containing output.
+		 * @param  x constant reference to vector to contain input
+		 * @param y
+		 */
+		template <class Vector1, class Vector2>
+		inline Vector1 &apply (Vector1 &y, const Vector2 &x) const
+		{
+			if (_A_ptr != 0) _A_ptr->apply (y, x);
+			if (_A_ptr->rowdim () < y.size()) {
+				for(typename Vector1::iterator yit=y.begin()+_A_ptr->rowdim ();
+				    yit != y.end(); ++yit)
+					*yit = _Zero;
+			}
+			return y;
+		}
+
+
+		/** Application of BlackBox matrix transpose.
+		 * y= transpose(A)*x.
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
+		 * Required by abstract base class.
+		 * @return reference to vector y containing output.
+		 * @param  x constant reference to vector to contain input
+		 * @param y
+		 */
+		template <class Vector1, class Vector2>
+		inline Vector1 &applyTranspose (Vector1 &y, const Vector2 &x) const
+		{
+			if (_A_ptr != 0) _A_ptr->applyTranspose (y, x);
+			if (_A_ptr->coldim () < y.size()) {
+				for(typename Vector1::iterator yit=y.begin()+_A_ptr->rcoldim ();
+				    yit != y.end(); ++yit)
+					*yit = _Zero;
+			}			return y;
+		}
+
+	protected:
+		size_t maxsize() const {
+			if (_A_ptr != 0)
+				return GIVMAX( _A_ptr->rowdim (), _A_ptr->coldim () );
+			else
+				return 0;
+		}
+	public:
+		/** Retreive row dimensions of BlackBox matrix.
+		 * This may be needed for applying preconditioners.
+		 * Required by abstract base class.
+		 * @return integer number of rows of black box matrix.
+		 */
+		size_t rowdim (void) const
+		{
+			return maxsize();
+		}
+
+		/** Retreive column dimensions of BlackBox matrix.
+		 * Required by abstract base class.
+		 * @return integer number of columns of black box matrix.
+		 */
+		size_t coldim (void) const
+		{
+			return maxsize();
+		}
+
+
+
+		const Field& field() const {return _A_ptr->field();}
+	protected:
+		// Pointer to A matrix
+		const Blackbox *_A_ptr;
+		typename Field::Element _Zero;
+
+	}; // template <Vector> class Squarize
+
+} // namespace LinBox
+
+#endif // __LINBOX_squarize_H
+
diff --git a/linbox/blackbox/submatrix-traits.h b/linbox/blackbox/submatrix-traits.h
index ad36cbb..c244c48 100644
--- a/linbox/blackbox/submatrix-traits.h
+++ b/linbox/blackbox/submatrix-traits.h
@@ -1,21 +1,40 @@
-/* -*- mode:C++ -*- */
-
-/* File: submatrix-traits.h
- *  Author: Zhendong Wan
+/* -*- 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
+/* Copyright (C) 2010 LinBox
+ * Written by Zhendong Wan
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
-#ifndef __SUBMATRIX_TRAITS_H__
-#define __SUBMATRIX_TRAITS_H__
+#ifndef __LINBOX_submatrix_traits_H
+#define __LINBOX_submatrix_traits_H
+
 #include <linbox/blackbox/dense.h>
 #include <linbox/blackbox/submatrix.h>
 
-namespace LinBox {
+namespace LinBox
+{
 
 	template<class Matrix>
 	class SubMatrixTraits;
 
 	template<class Field>
 	class SubMatrixTraits<DenseMatrix<Field> > {
-	
+
 	public:
 
 		typedef  Submatrix<DenseMatrix<Field> > value_type;
@@ -24,12 +43,13 @@ namespace LinBox {
 
 	template<class Field>
 	class SubMatrixTraits<Submatrix<DenseMatrix<Field> > > {
-	
+
 	public:
-	
+
 		typedef Submatrix<DenseMatrix<Field> > value_type;
 	};
 
 }
 
-#endif
+#endif //__LINBOX_submatrix_traits_H
+
diff --git a/linbox/blackbox/submatrix.h b/linbox/blackbox/submatrix.h
index ba0454b..600f554 100644
--- a/linbox/blackbox/submatrix.h
+++ b/linbox/blackbox/submatrix.h
@@ -1,6 +1,5 @@
 /* -*- 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
 /* linbox/blackbox/submatrix.h
  * Copyright (C) 2001 Bradford Hovinen
  *
@@ -22,8 +21,8 @@
  * See COPYING for license information.
  */
 
-#ifndef __SUBMATRIX_H
-#define __SUBMATRIX_H
+#ifndef __LINBOX_bb_submatrix_H
+#define __LINBOX_bb_submatrix_H
 
 #include "linbox/vector/vector-traits.h"
 #include "linbox/util/debug.h"
@@ -38,45 +37,56 @@ namespace LinBox
 {
 
 	/** \brief leading principal minor of existing matrix without copying.
-
-\ingroup blackbox
+	 * \ingroup blackbox
 	 * leading principal minor of an existing matrix in a black box fashion.
 	 *
 	 * The matrix itself is not stored in memory.  Rather, its apply
-	 * methods use a vector of {@link Fields field} elements, which are 
+	 * methods use a vector of @link Fields field at endlink elements, which are
 	 * used to "multiply" the matrix to a vector.
-	 * 
-	 * This class has three template parameters.  The first is the field in 
-	 * which the arithmetic is to be done.  The second is the type of 
-	 * \ref{LinBox} vector to which to apply the matrix.  The 
-	 * third is chosen be default to be the \ref{LinBox} vector trait
-	 * of the vector.  This class is then specialized for dense and sparse 
+	 *
+	 * This class has three template parameters.  The first is the field in
+	 * which the arithmetic is to be done.  The second is the type of
+	 * \ref LinBox vector to which to apply the matrix.  The
+	 * third is chosen be default to be the \ref LinBox vector trait
+	 * of the vector.  This class is then specialized for dense and sparse
 	 * vectors.
 	 *
-	 * @param Field \ref{LinBox} field
-	 * @param Vector \ref{LinBox} dense or sparse vector of field elements
-	 * @param Trait  Marker whether to use dense or sparse LinBox vector 
-	 *               implementation.  This is chosen by a default parameter 
-	 *               and partial template specialization.  */
+	 * @param Field \ref LinBox field
+	 * @param Vector \ref LinBox dense or sparse vector of field elements
+	 * @param Trait  Marker whether to use dense or sparse LinBox vector
+	 *               implementation.  This is chosen by a default parameter
+	 *               and partial template specialization.
+	 */
 	//@{
 	// Basic declaration.
 	template <class Blackbox, class Trait = typename VectorTraits<typename LinBox::Vector<typename Blackbox::Field>::Dense >::VectorCategory>
 	class Submatrix : public BlackboxInterface {
 
-		private:
+	private:
 
-			Submatrix() {}
+		Submatrix() {}
 
 	};
 
+	template <class Blackbox, class Trait = typename VectorTraits<typename LinBox::Vector<typename Blackbox::Field>::Dense >::VectorCategory>
+	class SubmatrixOwner;
+
+}
+
+
+// Namespace in which all LinBox library code resides
+namespace LinBox
+{
+
 	/** Specialization for dense vectors */
 	template <class Blackbox>
-	class Submatrix<Blackbox, VectorCategories::DenseVectorTag >
-	: public BlackboxInterface {
-	    public:
-		typedef typename Blackbox::Field Field; 
-
+	class Submatrix<Blackbox, VectorCategories::DenseVectorTag > : public BlackboxInterface {
+	public:
+		typedef typename Blackbox::Field Field;
 		typedef typename Field::Element Element;
+		typedef Blackbox Blackbox_t;
+		typedef Submatrix<Blackbox, VectorCategories::DenseVectorTag > Self_t;
+
 		/** Constructor from field and dense vector of field elements.
 		 * @param BB   Black box from which to extract the submatrix
 		 * @param row  First row of the submatrix to extract (1.._BB->rowdim ())
@@ -88,54 +98,55 @@ namespace LinBox
 			   size_t          row,
 			   size_t          col,
 			   size_t          rowdim,
-			   size_t          coldim)
-			: _BB (BB),
+			   size_t          coldim) :
+			_BB (BB),
 			_row (row), _col (col), _rowdim (rowdim), _coldim (coldim),
-			  _z (_BB->coldim ()), _y (_BB->rowdim ())
+			_z (_BB->coldim ()), _y (_BB->rowdim ())
 		{
 			linbox_check (row + rowdim <= _BB->rowdim ());
 			linbox_check (col + coldim <= _BB->coldim ());
 
-			BB->field().init (_zero, 0);
 		}
 
 		/** Destructor
-		 */
+		*/
 		virtual ~Submatrix () {}
 
 		/** Application of BlackBox matrix.
-		 * y= A*x.
-		 * Requires one vector conforming to the \ref{LinBox}
-		 * vector {@link Archetypes archetype}.
+		 * <code>y= A*x</code>.
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
 		 * Required by abstract base class.
 		 * @return reference to vector y containing output.
 		 * @param  x constant reference to vector to contain input
+		 * @param y
 		 */
 		template<class OutVector, class InVector>
-	        OutVector& apply (OutVector &y, const InVector& x) const
-	        {
-			std::fill (_z.begin (), _z.begin () + _col, _zero);
-			std::fill (_z.begin () + _col + _coldim, _z.end (), _zero);
+		OutVector& apply (OutVector &y, const InVector& x) const
+		{
+			std::fill (_z.begin (), _z.begin () + _col, _BB->field().zero);
+			std::fill (_z.begin () + _col + _coldim, _z.end (), _BB->field().zero);
 
 			copy (x.begin (), x.end (), _z.begin () + _col);  // Copying. Yuck.
 			_BB->apply (_y, _z);
 			copy (_y.begin () + _row, _y.begin () + _row + _rowdim, y.begin ());
 			return y;
-	        }
+		}
 
 		/** Application of BlackBox matrix transpose.
-		 * y= transpose(A)*x.
-		 * Requires one vector conforming to the \ref{LinBox}
-		 * vector {@link Archetypes archetype}.
+		 * <code>y= transpose(A)*x</code>.
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
 		 * Required by abstract base class.
 		 * @return reference to vector y containing output.
 		 * @param  x constant reference to vector to contain input
+		 * @param y
 		 */
 		template<class OutVector, class InVector>
 		OutVector& applyTranspose (OutVector &y, const InVector& x) const
 		{
-			std::fill (_y.begin (), _y.begin () + _row, _zero);
-			std::fill (_y.begin () + _row + _rowdim, _y.end (), _zero);
+			std::fill (_y.begin (), _y.begin () + _row, _BB->field().zero);
+			std::fill (_y.begin () + _row + _rowdim, _y.end (), _BB->field().zero);
 
 			copy (x.begin (), x.end (), _y.begin () + _row);  // Copying. Yuck.
 			_BB->applyTranspose (_z, _y);
@@ -144,10 +155,15 @@ namespace LinBox
 		}
 
 
-            template<typename _Tp1> 
-            struct rebind                           
-            { typedef Submatrix< typename Blackbox::template rebind<_Tp1>::other, VectorCategories::DenseVectorTag> other; };
-
+		template<typename _Tp1>
+		struct rebind
+		{
+			typedef SubmatrixOwner<typename Blackbox_t::template rebind<_Tp1>::other, VectorCategories::DenseVectorTag> other;
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F) {
+				typename Blackbox_t::template rebind<_Tp1> Rebinder;
+				Rebinder( Ap.getData(), *(A.getPtr()), F);
+			}
+		};
 
 
 		/** Retreive _row dimensions of BlackBox matrix.
@@ -156,18 +172,25 @@ namespace LinBox
 		 * @return integer number of _rows of black box matrix.
 		 */
 		size_t rowdim (void) const
-			{ return _rowdim; }
-    
+		{ return _rowdim; }
+
 		/** Retreive _column dimensions of BlackBox matrix.
 		 * Required by abstract base class.
 		 * @return integer number of _columns of black box matrix.
 		 */
 		size_t coldim (void) const
-			{ return _coldim; }
+		{ return _coldim; }
+
+		size_t rowfirst() const { return _row; }
+		size_t colfirst() const { return _col; }
+
+
 
 		const Field& field() const {return _BB->field();}
 
-	    private:
+		const Blackbox * getPtr() const { return _BB; }
+
+	private:
 
 		const Blackbox *_BB;
 		size_t    _row;
@@ -175,39 +198,64 @@ namespace LinBox
 		size_t    _rowdim;
 		size_t    _coldim;
 
-	        // Temporaries for reducing the amount of memory allocation we do
-	        mutable std::vector<Element> _z;
-	        mutable std::vector<Element> _y;
-
-		typename Field::Element _zero;
+		// Temporaries for reducing the amount of memory allocation we do
+		mutable std::vector<Element> _z;
+		mutable std::vector<Element> _y;
 
 	}; // template <Vector> class Submatrix
-	
+
+
+	/** Specialization for dense ZeroOne vectors */
+	template <class Blackbox>
+	class Submatrix<Blackbox, VectorCategories::DenseZeroOneVectorTag > : public Submatrix<Blackbox, VectorCategories::DenseVectorTag> {
+	public:
+		typedef typename Blackbox::Field Field;
+		typedef typename Field::Element Element;
+		typedef Blackbox Blackbox_t;
+		typedef Submatrix<Blackbox, VectorCategories::DenseZeroOneVectorTag > Self_t;
+		typedef Submatrix<Blackbox, VectorCategories::DenseVectorTag > Father_t;
+
+		/** Constructor from field and dense vector of field elements.
+		 * @param BB   Black box from which to extract the submatrix
+		 * @param row  First row of the submatrix to extract (1.._BB->rowdim ())
+		 * @param col  First column of the submatrix to extract (1.._BB->coldim ())
+		 * @param rowdim Row dimension
+		 * @param coldim Column dimension
+		 */
+		Submatrix (const Blackbox *BB,
+			   size_t          row,
+			   size_t          col,
+			   size_t          rowdim,
+			   size_t          coldim) :
+			Father_t(BB,row,col,rowdim,coldim)
+		{}
+	};
 
 	template <class Field>
 	class DenseMatrix;
 
 	/** special case for the submatrix of a dense matrix
-	 */
+	*/
 	template<class _Field>
-	class Submatrix<DenseMatrix<_Field>, VectorCategories::DenseVectorTag>
-		: public DenseSubmatrix<typename _Field::Element> {
+	class Submatrix<DenseMatrix<_Field>, VectorCategories::DenseVectorTag> : public DenseSubmatrix<typename _Field::Element> {
 	public:
 
 		typedef _Field Field;
+		typedef Submatrix<DenseMatrix<_Field>, VectorCategories::DenseVectorTag> Self_t;
+		typedef DenseSubmatrix<typename _Field::Element> Father_t;
 
 	private:
-		
+
 		Field f;
-		
+
 		VectorDomain<Field> vd;
-		
+
 	public:
-	
+
 		typedef typename Field::Element Element;
 
-		/** Constructor from an existing @ref{DenseMatrix} and dimensions
-		 * @param M Pointer to @ref{DenseMatrix} of which to construct submatrix
+		/** Constructor from an existing \ref DenseMatrix  and dimensions
+		 * @param M Pointer to \ref DenseMatrix  of which to construct submatrix
 		 * @param row Starting row
 		 * @param col Starting column
 		 * @param rowdim Row dimension
@@ -218,13 +266,14 @@ namespace LinBox
 			   size_t row,
 			   size_t col,
 			   size_t rowdim,
-			   size_t coldim) 
-			: DenseSubmatrix<Element>(const_cast<DenseMatrix<Field>& >(*M), row, col, rowdim, coldim),
-			  f(M -> field()), vd(M -> field()) {
+			   size_t coldim) :
+			DenseSubmatrix<Element>(const_cast<DenseMatrix<Field>& >(*M), row, col, rowdim, coldim),
+			f(M -> field()), vd(M -> field())
+		{
 		}
-		
-		/** Constructor from an existing @ref{DenseMatrix} and dimensions
-		 * @param M reference to @ref{DenseMatrix} of which to construct submatrix
+
+		/** Constructor from an existing \ref DenseMatrix  and dimensions
+		 * @param M reference to \ref DenseMatrix  of which to construct submatrix
 		 * @param row Starting row
 		 * @param col Starting column
 		 * @param rowdim Row dimension
@@ -234,11 +283,11 @@ namespace LinBox
 			   size_t row,
 			   size_t col,
 			   size_t rowdim,
-			   size_t coldim) 
-			: DenseSubmatrix<Element>(const_cast<DenseMatrix<Field>& >(M), row, col, rowdim, coldim),
-			  f(M.field()), vd(M.field()) {
-		}
-		
+			   size_t coldim) :
+			DenseSubmatrix<Element>(const_cast<DenseMatrix<Field>& >(M), row, col, rowdim, coldim),
+			f(M.field()), vd(M.field()) {
+			}
+
 		/** Constructor from an existing submatrix and dimensions
 		 * @param SM pointer to Submatrix from which to
 		 *           construct submatrix
@@ -248,13 +297,13 @@ namespace LinBox
 		 * @param coldim Column dimension
 		 */
 		Submatrix (const Submatrix<DenseMatrix<Field> > *SM,
-                        size_t row,
-                        size_t col,
-                        size_t rowdim,
-                        size_t coldim )
-			: DenseSubmatrix<Element> (const_cast<Submatrix<DenseMatrix<Field> >&>(*SM), row, col, rowdim, coldim),
-			  f (SM ->  field()), vd(SM -> field()){
-		}
+			   size_t row,
+			   size_t col,
+			   size_t rowdim,
+			   size_t coldim ) :
+			DenseSubmatrix<Element> (const_cast<Submatrix<DenseMatrix<Field> >&>(*SM), row, col, rowdim, coldim),
+			f (SM ->  field()), vd(SM -> field()){
+			}
 
 		/** Constructor from an existing submatrix and dimensions
 		 * @param SM reference to Submatrix from which to
@@ -265,21 +314,21 @@ namespace LinBox
 		 * @param coldim Column dimension
 		 */
 		Submatrix (const Submatrix<DenseMatrix<Field> >& SM,
-                        size_t row,
-                        size_t col,
-                        size_t rowdim,
-                        size_t coldim )
-			: DenseSubmatrix<Element> (const_cast<Submatrix<DenseMatrix<Field> >&>(SM), row, col, rowdim, coldim),
-			  f (SM. field()), vd(SM. field()){
-		}
-		
+			   size_t row,
+			   size_t col,
+			   size_t rowdim,
+			   size_t coldim ) :
+			DenseSubmatrix<Element> (const_cast<Submatrix<DenseMatrix<Field> >&>(SM), row, col, rowdim, coldim),
+			f (SM. field()), vd(SM. field()){
+			}
+
 		const Field& field() const {
 
 			return f;
 		}
 
 		std::istream& read (std::istream& is) {
-			
+
 			DenseSubmatrix<Element>::read (is, f);
 
 			return is;
@@ -291,9 +340,9 @@ namespace LinBox
 
 			return os;
 		}
-		
+
 		/** Generic matrix-vector apply
-		 * y = A * x.
+		 * <code>y = A * x</code>.
 		 * This version of apply allows use of arbitrary input and output vector         * types.
 		 * @param y Output vector
 		 * @param x Input vector
@@ -301,19 +350,19 @@ namespace LinBox
 		 */
 		template<class Vect1, class Vect2>
 		Vect1 &apply (Vect1 &y, const Vect2 &x) const {
-			
-			 typename DenseSubmatrix<Element>::ConstRowIterator p;
-			 
-			 typename Vect1::iterator p_y = y.begin ();
-			 
-			 for (p = this->rowBegin (); p != this->rowEnd (); ++p, ++p_y)
-				 vd.dot (*p_y, *p, x);
-			 
-			 return y;
+
+			typename DenseSubmatrix<Element>::ConstRowIterator p;
+
+			typename Vect1::iterator p_y = y.begin ();
+
+			for (p = this->rowBegin (); p != this->rowEnd (); ++p, ++p_y)
+				vd.dot (*p_y, *p, x);
+
+			return y;
 		}
-		
-	        /** Generic matrix-vector transpose apply
-		 * y = A^T * x
+
+		/** Generic matrix-vector transpose apply
+		 * <code>y = A^T * x</code>
 		 * This version of applyTranspose allows use of arbitrary input and
 		 * output vector types
 		 * @param y Output vector
@@ -322,23 +371,191 @@ namespace LinBox
 		 */
 		template<class Vect1, class Vect2>
 		Vect1 &applyTranspose (Vect1 &y, const Vect2 &x) const {
-			
-			 typename DenseSubmatrix<Element>::ConstColIterator colp;
-			 
-			 typename Vect1::iterator p_y = y.begin ();
-			 
-			 for (colp = this->colBegin (); colp != this->colEnd (); ++colp, ++p_y)
-				 vd. dot (*p_y, *colp, x);
-			 
-			 return y;
+
+			typename DenseSubmatrix<Element>::ConstColIterator colp;
+
+			typename Vect1::iterator p_y = y.begin ();
+
+			for (colp = this->colBegin (); colp != this->colEnd (); ++colp, ++p_y)
+				vd. dot (*p_y, *colp, x);
+
+			return y;
 		}
 
-            template<typename _Tp1> 
-            struct rebind                           
-            { typedef Submatrix<DenseMatrix<_Tp1>, VectorCategories::DenseVectorTag> other; };
+		template<typename _Tp1>
+		struct rebind
+		{
+			typedef SubmatrixOwner<DenseMatrix<_Tp1>, VectorCategories::DenseVectorTag> other;
+
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F) {
+
+				typename other::Father_t A1;
+				typename Father_t::template rebind<_Tp1> () ( A1, static_cast<Father_t>(A), F);
+				Ap = other(A1, A._row, A._col, A._rowdim, A._coldim);
+			}
+
+		};
 	};
 
 	//@}
 } // namespace LinBox
 
-#endif // __SUBMATRIX_H
+
+
+
+// Namespace in which all LinBox library code resides
+namespace LinBox
+{
+
+	/** Specialization for dense vectors */
+	template <class Blackbox>
+	class SubmatrixOwner<Blackbox, VectorCategories::DenseVectorTag > : public BlackboxInterface {
+	public:
+		typedef typename Blackbox::Field Field;
+		typedef typename Field::Element Element;
+		typedef Blackbox Blackbox_t;
+		typedef SubmatrixOwner<Blackbox_t, VectorCategories::DenseVectorTag > Self_t;
+
+		/** Constructor from field and dense vector of field elements.
+		 * @param BB   Black box from which to extract the submatrix
+		 * @param row  First row of the submatrix to extract (1.._BB_data.rowdim ())
+		 * @param col  First column of the submatrix to extract (1.._BB_data.coldim ())
+		 * @param rowdim Row dimension
+		 * @param coldim Column dimension
+		 */
+		SubmatrixOwner (const Blackbox *BB,
+				size_t          row,
+				size_t          col,
+				size_t          rowdim,
+				size_t          coldim) :
+			_BB_data (*BB),
+			_row (row), _col (col), _rowdim (rowdim), _coldim (coldim),
+			_z (_BB_data.coldim ()), _y (_BB_data.rowdim ())
+		{
+			linbox_check (row + rowdim <= _BB_data.rowdim ());
+			linbox_check (col + coldim <= _BB_data.coldim ());
+
+		}
+
+		/** Destructor
+		*/
+		virtual ~SubmatrixOwner () {}
+
+		/** Application of BlackBox matrix.
+		 * <code>y= A*x</code>.
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
+		 * Required by abstract base class.
+		 * @return reference to vector y containing output.
+		 * @param  x constant reference to vector to contain input
+		 * @param y
+		 */
+		template<class OutVector, class InVector>
+		OutVector& apply (OutVector &y, const InVector& x) const
+		{
+			std::fill (_z.begin (), _z.begin () + _col, _BB_data.field().zero);
+			std::fill (_z.begin () + _col + _coldim, _z.end (), _BB_data.field().zero);
+
+			copy (x.begin (), x.end (), _z.begin () + _col);  // Copying. Yuck.
+			_BB_data.apply (_y, _z);
+			copy (_y.begin () + _row, _y.begin () + _row + _rowdim, y.begin ());
+			return y;
+		}
+
+		/** Application of BlackBox matrix transpose.
+		 * <code>y= transpose(A)*x</code>.
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
+		 * Required by abstract base class.
+		 * @return reference to vector y containing output.
+		 * @param  x constant reference to vector to contain input
+		 * @param y
+		 */
+		template<class OutVector, class InVector>
+		OutVector& applyTranspose (OutVector &y, const InVector& x) const
+		{
+			std::fill (_y.begin (), _y.begin () + _row, _BB_data.field().zero);
+			std::fill (_y.begin () + _row + _rowdim, _y.end (), _BB_data.field().zero);
+
+			copy (x.begin (), x.end (), _y.begin () + _row);  // Copying. Yuck.
+			_BB_data.applyTranspose (_z, _y);
+			copy (_z.begin () + _col, _z.begin () + _col + _coldim, y.begin ());
+			return y;
+		}
+
+
+		template<typename _Tp1>
+		struct rebind {
+			typedef SubmatrixOwner< typename Blackbox::template rebind<_Tp1>::other, VectorCategories::DenseVectorTag> other;
+
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F) {
+				typename Blackbox_t::template rebind<_Tp1> () ( Ap.getData(), A.getData(), F);
+
+			}
+
+		};
+
+		template<typename _BB, typename _Vc, class Field>
+		SubmatrixOwner (const Submatrix<_BB, _Vc>& T, const Field& F) :
+			_BB_data(*(T.getPtr()), F),
+			_row(T.rowfirst()), _col(T.colfirst()),
+			_rowdim(T.rowdim()), _coldim(T.coldim()),
+			_z (_BB_data.coldim ()), _y (_BB_data.rowdim ())
+		{
+			typename Submatrix<_BB,_Vc>::template rebind<Field>()(*this,T, F);
+		}
+		template<typename _BB, typename _Vc, class Field>
+		SubmatrixOwner (const SubmatrixOwner<_BB,_Vc>& T, const Field& F) :
+			_BB_data(T.getData(), F),
+			_row(T.rowfirst()), _col(T.colfirst()),
+			_rowdim(T.rowdim()), _coldim(T.coldim()),
+			_z (_BB_data.coldim ()), _y (_BB_data.rowdim ())
+		{
+			typename SubmatrixOwner<_BB,_Vc>::template rebind<Field>()(*this,T, F);
+		}
+
+		/** Retreive _row dimensions of BlackBox matrix.
+		 * This may be needed for applying preconditioners.
+		 * Required by abstract base class.
+		 * @return integer number of _rows of black box matrix.
+		 */
+		size_t rowdim (void) const
+		{ return _rowdim; }
+
+		/** Retreive _column dimensions of BlackBox matrix.
+		 * Required by abstract base class.
+		 * @return integer number of _columns of black box matrix.
+		 */
+		size_t coldim (void) const
+		{ return _coldim; }
+
+		size_t rowfirst() const { return _row; }
+		size_t colfirst() const { return _col; }
+
+		const Field& field() const {return _BB_data.field();}
+
+		const Blackbox& getData() const {return  _BB_data;}
+		Blackbox& getData() {return  _BB_data;}
+
+	private:
+
+		Blackbox _BB_data;
+		size_t    _row;
+		size_t    _col;
+		size_t    _rowdim;
+		size_t    _coldim;
+
+		// Temporaries for reducing the amount of memory allocation we do
+		mutable std::vector<Element> _z;
+		mutable std::vector<Element> _y;
+
+	}; // template <Vector> class SubmatrixOwner
+
+
+	//@}
+} // namespace LinBox
+
+
+
+#endif // __LINBOX_bb_submatrix_H
+
diff --git a/linbox/blackbox/sum.h b/linbox/blackbox/sum.h
index 9a5c0c7..01c5652 100644
--- a/linbox/blackbox/sum.h
+++ b/linbox/blackbox/sum.h
@@ -1,38 +1,48 @@
 /* -*- 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
 /* linbox/blackbox/sum.h
  * Copyright (C) 2002 The LinBox group
  *
- * Time-stamp: <12 Jan 07 10:41:03 Jean-Guillaume.Dumas at imag.fr> 
+ * Time-stamp: <06 Jul 10 18:38:02 Jean-Guillaume.Dumas at imag.fr>
  *
  * ------------------------------------
  *
  * See COPYING for license information.
  */
 
-#ifndef __SUM_H
-#define __SUM_H
+#ifndef __LINBOX_sum_H
+#define __LINBOX_sum_H
 
 #include "linbox/vector/vector-domain.h"
 #include "linbox/util/debug.h"
 #include <linbox/blackbox/blackbox-interface.h>
 
+namespace LinBox
+{
+	template <class _Blackbox1, class _Blackbox2 = _Blackbox1>
+	class Sum;
+
+	template <class _Blackbox1, class _Blackbox2 = _Blackbox1>
+	class SumOwner;
+}
+
+
 // Namespace in which all LinBox library code resides
 namespace LinBox
 {
 
-	/** \brief blackbox of a matrix sum without copying.  
+	/** \brief blackbox of a matrix sum without copying.
 
-\ingroup blackbox
-         * Adds only at apply time.
+	  \ingroup blackbox
+	 * Adds only at apply time.
 	 * Given two black boxes A and B of the same dimensions, form a black
 	 * box representing A+B, i.e., Sum(A,B)x=(A+B)x=Ax+Bx
-	 * @param Vector \ref{LinBox} dense or sparse vector of field elements
+	 * @param Vector \ref LinBox dense or sparse vector of field elements
 	 */
 	template <class _Blackbox1, class _Blackbox2>
-	class Sum : public BlackboxInterface 
-	{
-                typedef Sum<_Blackbox1, _Blackbox2> Self_t;
-	    public:
+	class Sum : public BlackboxInterface {
+		typedef Sum<_Blackbox1, _Blackbox2> Self_t;
+	public:
 		typedef _Blackbox1 Blackbox1;
 		typedef _Blackbox2 Blackbox2;
 
@@ -45,8 +55,8 @@ namespace LinBox
 		 * A + B, of black box matrices.
 		 * @param A, B:  black box matrices.
 		 */
-		Sum (const Blackbox1 &A, const Blackbox2 &B)
-			: _A_ptr(&A), _B_ptr(&B)
+		Sum (const Blackbox1 &A, const Blackbox2 &B) :
+			_A_ptr(&A), _B_ptr(&B), VD( field() )
 		{
 			linbox_check (A.coldim () == B.coldim ());
 			linbox_check (A.rowdim () == B.rowdim ());
@@ -60,8 +70,8 @@ namespace LinBox
 		 * A + B, of black box matrices.
 		 * @param A_ptr, B_ptr:  pointers to black box matrices.
 		 */
-		Sum (const Blackbox1 *A_ptr, const Blackbox2 *B_ptr)
-			: _A_ptr(A_ptr), _B_ptr(B_ptr)
+		Sum (const Blackbox1 *A_ptr, const Blackbox2 *B_ptr) :
+			_A_ptr(A_ptr), _B_ptr(B_ptr), VD( field() )
 		{
 			// create new copies of matrices in dynamic memory
 			linbox_check (A_ptr != 0);
@@ -77,8 +87,8 @@ namespace LinBox
 		 * Creates new black box objects in dynamic memory.
 		 * @param M constant reference to compose black box matrix
 		 */
-		Sum (const Sum<Blackbox1, Blackbox2> &M)
-			: _A_ptr (M._A_ptr), _B_ptr (M._B_ptr)
+		Sum (const Sum<Blackbox1, Blackbox2> &M) :
+			_A_ptr (M._A_ptr), _B_ptr (M._B_ptr), VD(M.VD)
 		{
 			VectorWrapper::ensureDim (_z1, _A_ptr->rowdim ());
 			VectorWrapper::ensureDim (_z2, _A_ptr->coldim ());
@@ -90,87 +100,80 @@ namespace LinBox
 		}
 
 		/** Application of BlackBox matrix.
-		 * y= (A+B)*x.
-		 * Requires one vector conforming to the \ref{LinBox}
-		 * vector {@link Archetypes archetype}.
+		 * \f$y= (A+B)\cdot x\f$.
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
 		 * Required by abstract base class.
 		 * @return reference to vector y containing output.
 		 * @param  x constant reference to vector to contain input
+		 * @param y
 		 */
 		template<class OutVector, class InVector>
 		inline OutVector &apply (OutVector &y, const InVector &x) const
 		{
-			if (_A_ptr != 0 && _B_ptr != 0) {
-				VectorDomain<Field> VD (field());
-				typename Field::Element one;
-
-				field().init (one, 1);
-				_A_ptr->apply (y, x);
-				_B_ptr->apply (_z1, x);
-				VD.axpyin (y, one, _z1);
-			}
+			_A_ptr->apply (y, x);
+			_B_ptr->apply (_z1, x);
+			VD.addin (y, _z1);
 
 			return y;
 		}
 
 		/** Application of BlackBox matrix transpose.
-		 * y= transpose(A+B)*x.
-		 * Requires one vector conforming to the \ref{LinBox}
-		 * vector {@link Archetypes archetype}.
+		 * \f$ y= (A+B)^T\cdot x\f$.
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
 		 * Required by abstract base class.
 		 * @return reference to vector y containing output.
 		 * @param  x constant reference to vector to contain input
+		 * @param y
 		 */
 		template<class OutVector, class InVector>
 		inline OutVector &applyTranspose (OutVector &y, const InVector &x) const
 		{
-			if (_A_ptr != 0 && _B_ptr != 0) {
-				VectorDomain<Field> VD (field());
-				typename Field::Element one;
-
-				field().init (one, 1);
-				_A_ptr->applyTranspose (y, x);
-				_B_ptr->applyTranspose (_z2, x);
-				VD.axpyin (y, one, _z2);
-			}
+			_A_ptr->applyTranspose (y, x);
+			_B_ptr->applyTranspose (_z2, x);
+			VD.addin (y, _z2);
 
 			return y;
 		}
 
-            template<typename _Tp1, typename _Tp2 = _Tp1> 
-            struct rebind                           
-            { typedef Sum<typename Blackbox1::template rebind<_Tp1>::other, typename Blackbox2::template rebind<_Tp2>::other> other; 
-
-    		void operator() (other *& Ap, const Self_t& A, const _Tp1& F) {
-                    typename other::Blackbox1 * A1;
-                    typename Blackbox1::template rebind<_Tp1> () ( A1, *(A._A_ptr), F);
-                    typename other::Blackbox2 * A2;
-                    typename Blackbox2::template rebind<_Tp1> () ( A2, *(A._B_ptr), F);
-                    Ap = new other(*A1, *A2);
-                }
+		template<typename _Tp1, typename _Tp2 = _Tp1>
+		struct rebind
+		{ typedef SumOwner<
+			typename Blackbox1::template rebind<_Tp1>::other,
+				 typename Blackbox2::template rebind<_Tp2>::other
+				 > other;
 
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F) {
+				typename Blackbox1::template rebind<_Tp1> () ( Ap.getLeftData(), *(A.getLeftPtr()), F);
+				typename Blackbox2::template rebind<_Tp2> () ( Ap.getRightData(), *(A.getRightPtr()), F);
+			}
 
-            };
 
+		};
 		/** Retreive row dimensions of BlackBox matrix.
 		 * This may be needed for applying preconditioners.
 		 * Required by abstract base class.
 		 * @return integer number of rows of black box matrix.
 		 */
 		size_t rowdim (void) const
-			{ return _A_ptr->rowdim (); }
-    
+		{ return _A_ptr->rowdim (); }
+
 		/** Retreive column dimensions of BlackBox matrix.
 		 * Required by abstract base class.
 		 * @return integer number of columns of black box matrix.
 		 */
-		size_t coldim (void) const 
-			{ return _A_ptr->coldim (); }
+		size_t coldim (void) const
+		{ return _A_ptr->coldim (); }
 
 
 		const Field& field() const { return _A_ptr -> field(); }
 
-	    protected:
+		const Blackbox1* getLeftPtr() const {return  _A_ptr;}
+
+		const Blackbox2* getRightPtr() const {return  _B_ptr;}
+
+	protected:
 
 		// use a copy of the input field for faster performance (no pointer dereference).
 
@@ -180,8 +183,195 @@ namespace LinBox
 		mutable std::vector<Element>  _z1;
 		mutable std::vector<Element>  _z2;
 
+		VectorDomain<Field> VD;
 	}; // template <Field, Vector> class Sum
 
 } // namespace LinBox
 
-#endif // __SUM_H
+// Namespace in which all LinBox library code resides
+namespace LinBox
+{
+
+	/** \brief blackbox of a matrix sum without copying.
+
+	  \ingroup blackbox
+	 * Adds only at apply time.
+	 * Given two black boxes A and B of the same dimensions, form a black
+	 * box representing A+B, i.e., SumOwner(A,B)x=(A+B)x=Ax+Bx
+	 * @param Vector \ref LinBox dense or sparse vector of field elements
+	 */
+	template <class _Blackbox1, class _Blackbox2>
+	class SumOwner : public BlackboxInterface {
+		typedef SumOwner<_Blackbox1, _Blackbox2> Self_t;
+	public:
+		typedef _Blackbox1 Blackbox1;
+		typedef _Blackbox2 Blackbox2;
+
+		typedef typename Blackbox1::Field Field;
+		typedef typename Blackbox1::Element Element;
+
+
+		/** Constructor from black box matrices.
+		 * This constructor creates a matrix that is the sum,
+		 * A + B, of black box matrices.
+		 * @param A, B:  black box matrices.
+		 */
+		SumOwner (const Blackbox1 &A, const Blackbox2 &B) :
+			_A_data(&A), _B_data(&B), VD( field() )
+		{
+			linbox_check (A.coldim () == B.coldim ());
+			linbox_check (A.rowdim () == B.rowdim ());
+
+			VectorWrapper::ensureDim (_z1, A.rowdim ());
+			VectorWrapper::ensureDim (_z2, A.coldim ());
+		}
+
+		/** Constructor from black box pointers.
+		 * This constructor creates a matrix that is the sum,
+		 * A + B, of black box matrices.
+		 * @param A_data, B_data:  pointers to black box matrices.
+		 */
+		SumOwner (const Blackbox1 *A_data, const Blackbox2 *B_data) :
+			_A_data(A_data), _B_data(B_data), VD( field() )
+		{
+			// create new copies of matrices in dynamic memory
+			linbox_check (A_data != 0);
+			linbox_check (B_data != 0);
+			linbox_check (A_data.coldim () == B_data.coldim ());
+			linbox_check (A_data.rowdim () == B_data.rowdim ());
+
+			VectorWrapper::ensureDim (_z1, A_data.rowdim ());
+			VectorWrapper::ensureDim (_z2, A_data.coldim ());
+		}
+
+		/** Copy constructor.
+		 * Creates new black box objects in dynamic memory.
+		 * @param M constant reference to compose black box matrix
+		 */
+		SumOwner (const SumOwner<Blackbox1, Blackbox2> &M) :
+			_A_data (M._A_data), _B_data (M._B_data), VD(M.VD)
+		{
+			VectorWrapper::ensureDim (_z1, _A_data.rowdim ());
+			VectorWrapper::ensureDim (_z2, _A_data.coldim ());
+		}
+
+		/// Destructor
+		~SumOwner (void)
+		{
+		}
+
+		/** Application of BlackBox matrix.
+		 * \f$ y= (A+B) \cdot x\f$.
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
+		 * Required by abstract base class.
+		 * @return reference to vector y containing output.
+		 * @param  x constant reference to vector to contain input
+		 * @param y
+		 */
+		template<class OutVector, class InVector>
+		inline OutVector &apply (OutVector &y, const InVector &x) const
+		{
+			_A_data.apply (y, x);
+			_B_data.apply (_z1, x);
+			VD.addin (y, _z1);
+			return y;
+		}
+
+		/** Application of BlackBox matrix transpose.
+		 * \f$ y= (A+B)^T \cdot x\f$.
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
+		 * Required by abstract base class.
+		 * @return reference to vector y containing output.
+		 * @param  x constant reference to vector to contain input
+		 * @param y
+		 */
+		template<class OutVector, class InVector>
+		inline OutVector &applyTranspose (OutVector &y, const InVector &x) const
+		{
+			_A_data.applyTranspose (y, x);
+			_B_data.applyTranspose (_z2, x);
+			VD.addin (y, _z2);
+
+			return y;
+		}
+
+		template<typename _Tp1, typename _Tp2 = _Tp1>
+		struct rebind
+		{ typedef SumOwner<typename Blackbox1::template rebind<_Tp1>::other, typename Blackbox2::template rebind<_Tp2>::other> other;
+
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F) {
+				typename Blackbox1::template rebind<_Tp1> () ( Ap.getLeftData(), A.getLeftData(), F);
+				typename Blackbox2::template rebind<_Tp1> () ( Ap.getRightData(), A.getRightData(), F);
+			}
+
+
+		};
+		template<typename _BBt1, typename _BBt2, typename Field>
+		SumOwner (const Sum<_BBt1, _BBt2> &M, const Field& F) :
+			_A_data(*(M.getLeftPtr()), F),
+			_B_data(*(M.getRightPtr()), F),
+			_z1(_A_data.rowdim()),
+			_z2(_A_data.coldim()),
+			VD(F)
+		{
+			typename Sum<_BBt1, _BBt2>::template rebind<Field>()(*this,M,F);
+		}
+
+		template<typename _BBt1, typename _BBt2, typename Field>
+		SumOwner (const SumOwner<_BBt1, _BBt2> &M, const Field& F) :
+			_A_data(M.getLeftData(), F),
+			_B_data(M.getRightData(), F) ,
+			_z1(_A_data.rowdim()),
+			_z2(_A_data.coldim()) ,
+			VD(F)
+		{
+			typename SumOwner<_BBt1, _BBt2>::template rebind<Field>()(*this,M,F);
+		}
+
+
+
+
+		/** Retreive row dimensions of BlackBox matrix.
+		 * This may be needed for applying preconditioners.
+		 * Required by abstract base class.
+		 * @return integer number of rows of black box matrix.
+		 */
+		size_t rowdim (void) const
+		{ return _A_data.rowdim (); }
+
+		/** Retreive column dimensions of BlackBox matrix.
+		 * Required by abstract base class.
+		 * @return integer number of columns of black box matrix.
+		 */
+		size_t coldim (void) const
+		{ return _A_data.coldim (); }
+
+
+		const Field& field() const { return _A_data . field(); }
+
+		// accessors to the blackboxes without ownership
+		const Blackbox1& getLeftData() const {return  _A_data;}
+		Blackbox1& getLeftData() {return  _A_data;}
+
+		const Blackbox2& getRightData() const {return  _B_data;}
+		Blackbox2& getRightData() {return  _B_data;}
+
+	protected:
+
+		// use a copy of the input field for faster performance (no pointer dereference).
+
+		Blackbox1       _A_data;
+		Blackbox2       _B_data;
+
+		mutable std::vector<Element>  _z1;
+		mutable std::vector<Element>  _z2;
+
+		VectorDomain<Field> VD;
+	}; // template <Field, Vector> class SumOwner
+
+} // namespace LinBox
+
+#endif // __LINBOX_sum_H
+
diff --git a/linbox/blackbox/toeplitz.h b/linbox/blackbox/toeplitz.h
index 04cb2ea..ab8164f 100644
--- a/linbox/blackbox/toeplitz.h
+++ b/linbox/blackbox/toeplitz.h
@@ -1,16 +1,18 @@
-/* -*- mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-
+/* -*- 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
 /* *******************************************************************
- *    ntl-toeplitz.h 
+ *    ntl-toeplitz.h
  *    Copyright (C) 2002 Austin Lobo, B. David Saunders
  *
  *    Template for Toeplitz specification for ntl Arithmetic
- *    Linbox version 2001 and 2002 from a version 
+ *    Linbox version 2001 and 2002 from a version
  *    Designed by A.Lobo and B.D. Saunders in 4/98
+ *    see COPYING for licence information
  *-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+*/
 
-#ifndef TOEPLITZ_H
-#define TOEPLITZ_H
+#ifndef __LINBOX_toeplitz_H
+#define __LINBOX_toeplitz_H
+
 #include <iostream>
 #include <vector>
 #include "linbox/vector/vector-traits.h"
@@ -24,29 +26,28 @@
 
 //#define DBGMSGS 1
 
-/*-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- *   Partial Specialization of Toeplitz for Dense vectors from 
- *   an FFT based on Shoup's NTL library.
- *   this file is included at the end of the template specification
+/*! @file blackbox/toeplitz.h
+ *   @brief Partial Specialization of Toeplitz for Dense vectors from  an FFT based on Shoup's NTL library.
+ *
+ *   This file is included at the end of the template specification
  *   for Toeplitz.h
- *-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+*/
+ */
 
 namespace LinBox
 {
 	template <class _Field, class _PField>
-	class ToeplitzBase : public  BlackboxInterface 
-	{
+	class ToeplitzBase : public  BlackboxInterface {
 	protected: // Constructors etc. are protected because instances of this
-	           // class should not be instantiated; use Toeplitz instead.
+		// class should not be instantiated; use Toeplitz instead.
 		typedef _PField PField;
 		typedef typename _PField::Element Poly;
 
 		typedef typename _PField::CoeffField Field;
 
 		typedef typename _PField::Coeff Element;
-		
+
 		//------- CONSTRUCTORS AND DESTRUCTORS
-		
+
 		virtual ~ToeplitzBase();                // Destructor
 		ToeplitzBase();                 // Zero Param Constructor
 		ToeplitzBase( const Field& F);// Field only cstr. JGD 30.09.2003
@@ -55,42 +56,42 @@ namespace LinBox
 		// field representing the matrix, and the matrix dimensions
 		// If no n is given, it will default to the same as m.
 		ToeplitzBase( const PField& PF, const Poly& p,
-		              size_t m, size_t n=0 );
-            
-		
-	public: 
-		//------- READ-ONLY ACCESSOR, and OBSERVER METHODS 
+			      size_t m, size_t n=0 );
+
+
+	public:
+		//------- READ-ONLY ACCESSOR, and OBSERVER METHODS
+
+		template<typename _Tp1, typename _Tp2>
+		struct rebind
+		{ typedef ToeplitzBase<_Tp1,_Tp2> other; };
 
-            template<typename _Tp1, typename _Tp2>
-            struct rebind
-            { typedef ToeplitzBase<_Tp1,_Tp2> other; };
 
 
-		
 		inline size_t rowdim() const { return rowDim; }// Number of Rows
 		inline size_t coldim() const { return colDim; }// Number of Cols
 		inline size_t sysdim() const { return sysDim; }
-			// Max of rows & columns; 
+		// Max of rows & columns;
 		const Field& field() const {return K;}
 		//------- MUTATOR METHODS
-		
+
 		void setToUniModUT() ;      // Convert to UTriang matrix with det 1
 		void setToUniModLT() ;      // Convert to LTriang matrix with det 1
-		
+
 		//------ SERVICE METHODS
 
 		//      void convert(NTL::ZZ_pX &pout, const std::vector<Element> &vin);
-    protected:
+	protected:
 		PField P; 	  // Polynomial field
 		Field K;           // Field parameter (coefficient field)
-		
-		size_t rowDim;             // row dimension 
-		size_t colDim;             // col dimension 
+
+		size_t rowDim;             // row dimension
+		size_t colDim;             // col dimension
 		size_t sysDim;             // max{row,col} dimension
-		
+
 		Poly  pdata;         // Poly rep of the toeplitz matrix
 		Poly  rpdata;        // reverse polynomial
-		
+
 		static const int UnimodUT=1;
 		static const int UnimodLT=2;
 		BlackboxSpecifier shape; // Helps us deduce what our shape is
@@ -98,20 +99,20 @@ namespace LinBox
 
 		/* These were only used by the XML stuff and are more or less
 		 * obsolete with the presence of polynomial fields.
-		 
-		void convert(Poly &pout, const std::vector<Element> &vin);
+
+		 void convert(Poly &pout, const std::vector<Element> &vin);
 		// CONVERTS the input vector of field Elements to a ZZ_pX
-		
+
 		void convert( std::vector<Element> &vout, const Poly &pin);
 		// Converts from polynomial rep to a vector rep
 		// inverse of the convert from Element to ZZ_pX
 		*/
-		
+
 	}; //  class ToeplitzBase
 
 	/** \brief This is the blackbox representation of a Toeplitz matrix.
 
-\ingroup blackbox
+	  \ingroup blackbox
 	 * It stores the 2n-1 values of the first row and column.
 	 * The apply is a call to polynomial multiplication and for large n
 	 * will be FFT based, running in O(lg(n)) time.
@@ -120,11 +121,11 @@ namespace LinBox
 	 */
 #ifdef __LINBOX_HAVE_NTL
 	template< class _CField, class _PField = NTL_ZZ_pX >
-#else
+	#else
 	template< class _CField, class _PField >
-#endif
+	#endif
 	class Toeplitz :public ToeplitzBase<_CField,_PField> {
-	protected: 
+	protected:
 		typedef ToeplitzBase<_CField,_PField> TBase;
 	public:
 		typedef typename TBase::PField PField;
@@ -134,22 +135,27 @@ namespace LinBox
 
 		typedef typename TBase::Element Element;
 
-		Toeplitz() :TBase() {}
-		Toeplitz(const Field& F) :TBase(F) {}
-		Toeplitz( const PField& PF ) :TBase(PF) {}
+		Toeplitz() :
+			TBase()
+		{}
+		Toeplitz(const Field& F) :
+			TBase(F)
+		{}
+		Toeplitz( const PField& PF ) :
+			TBase(PF)
+		{}
 		Toeplitz( const PField& PF, const Poly& p,
-		              size_t m, size_t n=0 )
-			:TBase(PF,p,m,n) {}
-		
+			  size_t m, size_t n=0 ) :
+			TBase(PF,p,m,n)
+		{}
+
 	}; // end of class Toeplitz
-	
+
 	/** Specialization for when the field of matrix elements is the same
-	  * as the coefficient field of the polynomial field.
-	  */
+	 * as the coefficient field of the polynomial field.
+	 */
 	template< class _PField >
-	class Toeplitz< typename _PField::CoeffField, _PField >
-		:public ToeplitzBase< typename _PField::CoeffField, _PField >
-	{
+	class Toeplitz< typename _PField::CoeffField, _PField > : public ToeplitzBase< typename _PField::CoeffField, _PField > {
 	protected:
 		typedef ToeplitzBase< typename _PField::CoeffField, _PField > TBase;
 		using TBase::P;
@@ -169,25 +175,33 @@ namespace LinBox
 		typedef typename TBase::Field Field;
 
 		typedef typename TBase::Element Element;
-		
+
 		//------- CONSTRUCTORS AND DESTRUCTORS
-		Toeplitz() :TBase() {}
-		Toeplitz(const Field& F) :TBase(F) {}
-		Toeplitz( const PField& PF ) :TBase(PF) {}
+		Toeplitz() :
+			TBase()
+		{}
+		Toeplitz(const Field& F) :
+			TBase(F)
+		{}
+		Toeplitz( const PField& PF ) :
+			TBase(PF)
+		{}
 		Toeplitz( const PField& PF, const Poly& p,
-		              size_t m, size_t n=0 )
-			:TBase(PF,p,m,n) {}
-		
+			  size_t m, size_t n=0 ) :
+			TBase(PF,p,m,n)
+		{}
+
 		Toeplitz( const Field& F,    // Cnstr. with Field and STL vec. of elems
-				  const std::vector<Element>& v) :TBase(F) 
+			  const std::vector<Element>& v) :
+			TBase(F)
 		{ init_vector(v); }
-		
+
 
 		void   print( std::ostream& os = std::cout) const;        // Print the contents to the screen
 
-		void   print( char *outFileName) const; 
+		void   print( char *outFileName) const;
 		// Print the contents to a file
-		
+
 		template<class OutVector, class InVector>
 		OutVector& apply( OutVector &v_out, const InVector& v_in) const;
 
@@ -196,17 +210,18 @@ namespace LinBox
 
 		// Get the determinant of the matrix
 		Element& det( Element& res ) const;
-	protected: 
-                // initialization via a vector. Usually called by a constructor
-                // Moved in a separate protected function to enable easier
-                // inherited constructor calls. JGD 30.09.2003
+	protected:
+		// initialization via a vector. Usually called by a constructor
+		// Moved in a separate protected function to enable easier
+		// inherited constructor calls. JGD 30.09.2003
 		void init_vector( const std::vector<Element>& v );
 	}; //  Toeplitz specialization
 
 } // namespace LinBox
 
-#include <linbox/blackbox/toeplitz.inl>     
+#include <linbox/blackbox/toeplitz.inl>
 // Hide the implementation; include it here because
 // older compilers want everything in one template file
 
-#endif
+#endif //__LINBOX_toeplitz_H
+
diff --git a/linbox/blackbox/toeplitz.inl b/linbox/blackbox/toeplitz.inl
index 2ebd7fc..07c4970 100644
--- a/linbox/blackbox/toeplitz.inl
+++ b/linbox/blackbox/toeplitz.inl
@@ -1,14 +1,15 @@
-/* -*- mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-
-/*-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
- *    toeplitz.inl     NTL_Toeplitz.cpp file 
+/* -*- 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
+/*-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+ *    toeplitz.inl     NTL_Toeplitz.cpp file
  *
  *    Copyright (C) 2002 Austin Lobo, B. David Saunders
- *    Author: Austin Lobo 
- *    Linbox version 2001 and 2002 
+ *    Author: Austin Lobo
+ *    LinBox version 2001 and 2002
+ *    see COPYING for license information
  *
  *    This file is included in the template description of ntl-Toeplitz.h
- *    it contains the implementations of templatized member functions in the 
+ *    it contains the implementations of templatized member functions in the
  *    partial template  specialization for toeplitz matrices that
  *    are manipulated in fields and rings according to the arithmetic
  *    in the ntl package from V. Shoup
@@ -17,12 +18,15 @@
  *    in ntl-Toeplitz.h
  *-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+*/
 
+#ifndef __LINBOX_bb_toeplitz_INL
+#define __LINBOX_bb_toeplitz_INL
+
 #include <iostream>
 #include <fstream>
-#include <assert.h> // JGD 26.09.2003
+#include <cassert> // JGD 26.09.2003
 #include <linbox/algorithms/toeplitz-det.h>
 
-namespace LinBox 
+namespace LinBox
 {
 	/*-----------------------------------------------------------------
 	 *----    Destructor
@@ -32,58 +36,58 @@ namespace LinBox
 	{
 #ifdef DBGMSGS
 		std::cout << "Toeplitz::~Toeplitz():\tDestroyed a " << rowDim << "x"<< this->colDim<<
-			" Toeplitz matrix "<< std::endl;
+						     " Toeplitz matrix "<< std::endl;
 #endif
 	}//---- Destructor ---- [Tested 6/14/02 -- Works]
-	
-	
-	
+
+
+
 	/*-----------------------------------------------------------------
-	 *----    Field-only Constructor    
+	 *----    Field-only Constructor
 	 *----------------------------------------------------------------*/
 	template <class _CField, class _PField>
-	ToeplitzBase<_CField, _PField>::ToeplitzBase(const Field& F)
-	:P(F), K(F)
+	ToeplitzBase<_CField, _PField>::ToeplitzBase(const Field& F) :
+		P(F), K(F)
 	{
 		sysDim =               // Default dimension is 0
 		rowDim =               // Default row dim is 0
 		this->colDim = 0;            // Default col dim is 0
-                shape.shape(BlackboxSpecifier::TOEPLITZ);
+		shape.shape(BlackboxSpecifier::TOEPLITZ);
 #ifdef DBGMSGS
 		std::cout << "Toeplitz::Toeplitz():\tCreated a " << rowDim << "x"<< this->colDim<<
-			" Toeplitz matrix "<< std::endl;
+						    " Toeplitz matrix "<< std::endl;
 #endif
-		
+
 	}//----- Field-only Constructor
 
 
 	/*-----------------------------------------------------------------
-	 *----    Zero Parameter Constructor    
+	 *----    Zero Parameter Constructor
 	 *----------------------------------------------------------------*/
 	template <class _CField, class _PField>
-	ToeplitzBase<_CField, _PField>::ToeplitzBase() 
-                : P(0), K(0)
+	ToeplitzBase<_CField, _PField>::ToeplitzBase() :
+		P(0), K(0)
 	{
 		sysDim =               // Default dimension is 0
 		rowDim =               // Default row dim is 0
 		this->colDim = 0;            // Default col dim is 0
-                shape.shape(BlackboxSpecifier::TOEPLITZ);
+		shape.shape(BlackboxSpecifier::TOEPLITZ);
 #ifdef DBGMSGS
 		std::cout << "Toeplitz::Toeplitz():\tCreated a " << rowDim << "x"<< this->colDim<<
-			" Toeplitz matrix "<< std::endl;
+						    " Toeplitz matrix "<< std::endl;
 #endif
-		
+
 	}//----- Zero Param Constructor ---- [Tested 6/14/02 -- Works]
 
 	/*-----------------------------------------------------------------
 	 *------ Polynomial Field constructor
 	 *-----------------------------------------------------------------*/
 	template< class _CField, class _PField >
-	ToeplitzBase<_CField,_PField>::ToeplitzBase( const PField& PF )
-		:P(PF), K(PF.getCoeffField())
+	ToeplitzBase<_CField,_PField>::ToeplitzBase( const PField& PF ) :
+		P(PF), K(PF.getCoeffField())
 	{
 		sysDim = rowDim = this->colDim = 0;
-                shape.shape(BlackboxSpecifier::TOEPLITZ);
+		shape.shape(BlackboxSpecifier::TOEPLITZ);
 
 	}//------ Polynomial Field constructor
 
@@ -92,16 +96,16 @@ namespace LinBox
 	 *-----------------------------------------------------------------*/
 	template< class _CField, class _PField >
 	ToeplitzBase<_CField,_PField>::ToeplitzBase
-		( const PField& PF, const Poly& p, size_t m, size_t n )
-		:P(PF), K(PF.getCoeffField()), rowDim(m), colDim(n), pdata(p)
+	( const PField& PF, const Poly& p, size_t m, size_t n ) :
+		P(PF), K(PF.getCoeffField()), rowDim(m), colDim(n), pdata(p)
 	{
-                shape.shape(BlackboxSpecifier::TOEPLITZ);
+		shape.shape(BlackboxSpecifier::TOEPLITZ);
 		if( n == 0 ) this->colDim = rowDim;
 		if( rowDim >= this->colDim ) sysDim = rowDim;
 		else sysDim = this->colDim;
 
 		assert( P.deg(p) <= rowDim + this->colDim - 2 );
-		
+
 		P.rev(rpdata, pdata);
 
 		// Account for possible trailing zeroes
@@ -121,13 +125,13 @@ namespace LinBox
 	 *----- Constructor With User-Supplied First Row And Column
 	 *----------------------------------------------------------------*/
 	template <class _PField>
-        void Toeplitz<typename _PField::CoeffField, _PField>::init_vector( const std::vector<Element>&v)	
-        {
-		if ( (1 & v.size()) == 0) 
-			{
-				std::cout << "There must be an ODD number of entries in the input vector " <<
-					"The length given is " << v.size();
-			}
+	void Toeplitz<typename _PField::CoeffField, _PField>::init_vector( const std::vector<Element>&v)
+	{
+		if ( (1 & v.size()) == 0)
+		{
+			std::cout << "There must be an ODD number of entries in the input vector " <<
+			"The length given is " << v.size();
+		}
 		assert( (1 & v.size()) == 1);
 
 		this->P.init(this->pdata, v);
@@ -142,66 +146,68 @@ namespace LinBox
 			this->P.setCoeff(x, (v.size() - 1 - this->P.deg(this->pdata)), one);
 			this->P.mulin( this->rpdata, x );
 		}
-		
+
 		this->rowDim = this->colDim = this->sysDim = (v.size()+1)/2;
-		
+
 		//data = v;
-		
+
 #ifdef DBGMSGS
 		std::cout << "Toeplitz::Toeplitz(F,V):\tCreated a " << rowDim << "x"<< this->colDim<<
-			" Toeplitz matrix "<< std::endl;
+						       " Toeplitz matrix "<< std::endl;
 #endif
-		
+
 	}//----- Constructor given a vector---- [Tested 6/14/02 -- Works]
-	
-	
+
+
 
 	/*-----------------------------------------------------------------
 	 *-----    Print The Matrix To Screen
 	 *----------------------------------------------------------------*/
 	template <class _PField>
-	void Toeplitz<typename _PField::CoeffField,_PField>::print(std::ostream& os) const 
+	void Toeplitz<typename _PField::CoeffField,_PField>::print(std::ostream& os) const
 	{
-		
+
 		register int i, N;
 		register unsigned int j;
 		Element temp;
-		
+
 		os<< this->rowDim << " " << this->colDim << " " << this->shape.shape() << std::endl;
 		N = this->rowDim + this->colDim -1;
 
 		if ( N < 20 )             // Print small matrices in dense format
+		{
+			for (i = this->colDim-1; i < N; i++)
 			{
-				for (i = this->colDim-1; i < N; i++) 
-					{
-						for ( j = 0; j < this->colDim ; j++)
-							os << " " ;
-							this->K.write(os,this->P.getCoeff(temp,this->pdata,static_cast<size_t>(i-j))) ;
-						os << std::endl;
-					}
-			} 
-		else 
-			{                    // Print large matrices' first row and col
-				os << "[";
-				for (size_t i = this->rowDim + this->colDim - 2; i> 0;i--)
-					this->K.write(os, this->P.getCoeff(temp,this->pdata,i) ) << " ";
-				this->K.write(os,this->P.getCoeff(temp,this->pdata,0)) << "]\n";
-				this->P.write(os, this->pdata) << std::endl;
-			} //[v(2n-2),....,v(0)]; where v(0) is the top right entry of the matrix
-		
+				for ( j = 0; j < this->colDim ; j++)
+					os << " " ;
+				this->K.write(os,this->P.getCoeff(temp,this->pdata,static_cast<size_t>(i-j))) ;
+				os << std::endl;
+			}
+		}
+		else
+		{                    // Print large matrices' first row and col
+			os << "[";
+			for (size_t i = this->rowDim + this->colDim - 2; i> 0;i--)
+				this->K.write(os, this->P.getCoeff(temp,this->pdata,i) ) << " ";
+			this->K.write(os,this->P.getCoeff(temp,this->pdata,0)) << "]\n";
+			this->P.write(os, this->pdata) << std::endl;
+		} //[v(2n-2),....,v(0)]; where v(0) is the top right entry of the matrix
+
 		return;
 	} //---- print()----- [Tested 6/14/02 -- Works]
-	
-	
-// 	/*-----------------------------------------------------------------
-// 	 *----    The infamous clone has been created here 
-// 	 *----------------------------------------------------------------*/
-// 	template <class Field, class Vector>
-// 	BlackboxArchetype<Vector>* Toeplitz<Field, Vector>::clone() const 
-// 	{ 
-// 		return new Toeplitz(*this); 
-// 	}// ------ This is not tested. 
-	
+
+
+	// 	/*-----------------------------------------------------------------
+	// 	 *----    The infamous clone has been created here
+	// 	 *----------------------------------------------------------------*/
+#if 0
+	template <class Field, class Vector>
+	BlackboxArchetype<Vector>* Toeplitz<Field, Vector>::clone() const
+	{
+		return new Toeplitz(*this);
+	}// ------ This is not tested.
+#endif
+
 	/*-----------------------------------------------------------------
 	 *----    Save To File, Given Destination Filename
 	 *----------------------------------------------------------------*/
@@ -211,25 +217,25 @@ namespace LinBox
 		Element temp;
 
 		std::cout << "Printing toeplitz matrix to " << outFileName << std::endl;
-		
-		if ( outFileName == NULL ) 
+
+		if ( outFileName == NULL )
 			print();    // Print to stdout if no file is specified
-		else 
-			{
-				std::ofstream o_fp(outFileName, std::ios::out);
-				o_fp << this->rowDim << " " << this->colDim << " " << this->shape.shape() << std::endl ;
-				o_fp << "[";
-				for (size_t i = this->rowDim + this->colDim - 2; i>= 0;i--) 
-					this->K.write(o_fp,this->P.getCoeff(temp,this->pdata,i))
-					    << " ";
-				o_fp << "]\n";
-				
-				o_fp.close();
-			}
+		else
+		{
+			std::ofstream o_fp(outFileName, std::ios::out);
+			o_fp << this->rowDim << " " << this->colDim << " " << this->shape.shape() << std::endl ;
+			o_fp << "[";
+			for (size_t i = this->rowDim + this->colDim - 2; i>= 0;i--)
+				this->K.write(o_fp,this->P.getCoeff(temp,this->pdata,i))
+				<< " ";
+			o_fp << "]\n";
+
+			o_fp.close();
+		}
 		return;
 	} // print(char *) [Tested 6/14/02 -- Works]
-	
-	
+
+
 	/*-----------------------------------------------------------------
 	 *    Make the matrix upper triangular with determinant 1.
 	 *    i.e. clear the last N-1 elements in the data vector
@@ -242,7 +248,7 @@ namespace LinBox
 		P.getCoeffField().init(one,1);
 
 		for( size_t i = sysDim; i <= P.deg(pdata); ++i )
-		    	P.setCoeff(pdata,i,zero);
+			P.setCoeff(pdata,i,zero);
 
 		for( size_t i = 0; i < sysDim - 1; ++i )
 			P.setCoeff(rpdata,i,zero);
@@ -253,9 +259,9 @@ namespace LinBox
 		shape.shape(BlackboxSpecifier::UNIMOD_UT);
 		return;
 	}// [UNCOMMENTED PART Tested 6/14/02 -- Works]
-	
-	
-	
+
+
+
 	/*-----------------------------------------------------------------
 	 *    Make matrix a unimodular Lower Triangular with det 1
 	 *    i.e. clear the first N-1 elements in the data vector
@@ -268,7 +274,7 @@ namespace LinBox
 		P.getCoeffField().init(one,1);
 
 		for( size_t i = sysDim; i <= P.deg(rpdata); ++i )
-		    	P.setCoeff(rpdata,i,zero);
+			P.setCoeff(rpdata,i,zero);
 
 		for( size_t i = 0; i < sysDim - 1; ++i )
 			P.setCoeff(pdata,i,zero);
@@ -286,32 +292,32 @@ namespace LinBox
 	 *-----------------------------------------------------------------*/
 	template<class _PField>
 	typename Toeplitz<typename _PField::CoeffField,_PField>::Element&
-		Toeplitz<typename _PField::CoeffField,_PField>::det
-		( Element& res ) const
+	Toeplitz<typename _PField::CoeffField,_PField>::det
+	( Element& res ) const
 	{
 		return toeplitz_determinant( this->P, res, this->pdata, this->sysDim );
 	}
-	
-	
-	
+
+
+
 	/*-----------------------------------------------------------------
-	 *    Apply the matrix to a vector 
+	 *    Apply the matrix to a vector
 	 *----------------------------------------------------------------*/
 	template <class _PField>
 	template <class OutVector, class InVector>
-	OutVector& Toeplitz<typename _PField::CoeffField,_PField>::apply( OutVector &v_out, 
-									   const InVector& v_in) const
-	{  
-		
+	OutVector& Toeplitz<typename _PField::CoeffField,_PField>::apply( OutVector &v_out,
+									  const InVector& v_in) const
+	{
+
 		if (v_out.size() != this->rowdim())
 			std::cout << "\tToeplitz::apply()\t output vector not correct size, at "
-					  << v_out.size() << ". System rowdim is" <<  this->rowdim() << std::endl;
+			<< v_out.size() << ". System rowdim is" <<  this->rowdim() << std::endl;
 		if ( v_in.size() != this->coldim() )
-			std::cout << "\tToeplitz::apply()\t input vector not correct size at " 
-					  << v_in.size() << ". System colDim is" <<  this->coldim() << std::endl;
-		assert((v_out.size() == this->rowdim()) && 
-			   (v_in.size() == this->coldim()))  ;
-		
+			std::cout << "\tToeplitz::apply()\t input vector not correct size at "
+			<< v_in.size() << ". System colDim is" <<  this->coldim() << std::endl;
+		assert((v_out.size() == this->rowdim()) &&
+		       (v_in.size() == this->coldim()))  ;
+
 		Poly pOut, pIn;
 		this->P.init( pIn, v_in );
 
@@ -325,36 +331,36 @@ namespace LinBox
 #ifdef DBGMSGS
 		std::cout <<"pxOut is " << pxOut << std::endl;
 #endif
-		
+
 		size_t N = this->rowdim();
 		for( size_t i = 0; i < N; ++i )
 			this->P.getCoeff(v_out[i], pOut, N-1+i);
-		
+
 		return v_out;
-		
+
 	}
-	
-	
-	
-	
+
+
+
+
 	/*-----------------------------------------------------------------
 	 *    Apply the transposed matrix to a vector
 	 *----------------------------------------------------------------*/
 	template <class _PField>
 	template<class OutVector, class InVector>
-	OutVector& Toeplitz<typename _PField::CoeffField,_PField>::applyTranspose( OutVector &v_out, 
-												const InVector& v_in) const
-	{  
-		
+	OutVector& Toeplitz<typename _PField::CoeffField,_PField>::applyTranspose( OutVector &v_out,
+										   const InVector& v_in) const
+	{
+
 		if (v_out.size() != this->coldim())
 			std::cout << "\tToeplitz::apply()\t output vector not correct size, at "
-					  << v_out.size() << ". System rowDim is" <<  this->coldim() << std::endl;
+			<< v_out.size() << ". System rowDim is" <<  this->coldim() << std::endl;
 		if ( v_in.size() != this->rowdim() )
-			std::cout << "\tToeplitz::apply()\t input vector not correct size at " 
-					  << v_in.size() << ". System colDim is" <<  this->rowdim() << std::endl;
-		assert((v_out.size() == this->coldim()) && 
-			   (v_in.size() == this->rowdim()))  ;
-		
+			std::cout << "\tToeplitz::apply()\t input vector not correct size at "
+			<< v_in.size() << ". System colDim is" <<  this->rowdim() << std::endl;
+		assert((v_out.size() == this->coldim()) &&
+		       (v_in.size() == this->rowdim()))  ;
+
 		Poly pOut, pIn;
 		this->P.init( pIn, v_in );
 
@@ -368,13 +374,15 @@ namespace LinBox
 #ifdef DBGMSGS
 		std::cout <<"pxOut is " << pxOut << std::endl;
 #endif
-		
+
 		size_t N = this->coldim();
 		for( size_t i = 0; i < N; ++i )
 			this->P.getCoeff(v_out[i], pOut, N-1+i);
-		
+
 		return v_out;
-		
+
 	}
-	
+
 } // namespace LinBox
+
+#endif //__LINBOX_bb_toeplitz_INL
diff --git a/linbox/blackbox/transpose.h b/linbox/blackbox/transpose.h
index 75a6779..bb9d61c 100644
--- a/linbox/blackbox/transpose.h
+++ b/linbox/blackbox/transpose.h
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* linbox/blackbox/transpose.h
  * Copyright (C) 2001 Bradford Hovinen
@@ -21,26 +22,38 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __TRANSPOSE_H
-#define __TRANSPOSE_H
+#ifndef __LINBOX_transpose_H
+#define __LINBOX_transpose_H
 
 #include <linbox/blackbox/blackbox-interface.h>
 
+namespace LinBox
+{
+	template <class Blackbox>
+	class Transpose;
+
+
+	template <class Blackbox>
+	class TransposeOwner;
+}
+
+
+
+
 // Namespace in which all LinBox library code resides
 namespace LinBox
 {
 
 	/** \brief transpose matrix without copying.
 
-\ingroup blackbox
+	  \ingroup blackbox
 
-	 * @param Vector \ref{LinBox} dense or sparse vector of field elements
+	 * @param Vector \ref LinBox dense or sparse vector of field elements
 	 */
 	template <class Blackbox>
-	class Transpose : public BlackboxInterface
-	{
+	class Transpose : public BlackboxInterface {
 
-	    public:
+	public:
 		typedef Blackbox Blackbox_t;
 		typedef Transpose<Blackbox> Self_t;
 
@@ -48,24 +61,24 @@ namespace LinBox
 		typedef typename Blackbox::Element Element;
 
 		/** Constructor from a black box.
-		 * This constructor creates a matrix that the transpose of a black box
+		 * This constructor creates a matrix that is the transpose of a black box
 		 * matrix A
-		 * @param A_ptr pointer to black box matrix.
+		 * @param A pointer to black box matrix.
 		 */
-		Transpose (const Blackbox& A) : _A_ptr(&A){}
+		Transpose (const Blackbox& A) :
+			_A_ptr(&A)
+		{}
 
-		Transpose (const Blackbox *A_ptr): _A_ptr(A_ptr)
+		Transpose (const Blackbox *A_ptr) :
+			_A_ptr(A_ptr)
 		{
-			// create new copies of matrices in dynamic memory
-			//linbox_check (A_ptr != NULL);
-			//_A_ptr = A_ptr->clone ();
 		}
 
 		/** Copy constructor.
-		 * Creates new black box objects in dynamic memory.
 		 * @param M constant reference to compose black box matrix
 		 */
-		Transpose (const Transpose<Blackbox> &M) : _A_ptr(M._A_ptr)
+		Transpose (const Transpose<Blackbox> &M) :
+			_A_ptr(M._A_ptr)
 		{
 			// create new copies of matrices in dynamic memory
 			//linbox_check (M._A_ptr != NULL);
@@ -77,25 +90,23 @@ namespace LinBox
 		{
 		}
 
-                    template<typename _Tp1> 
-                    struct rebind 
-                    { 
-                        typedef Transpose<typename Blackbox::template rebind<_Tp1>::other> other; 
-                        void operator() (other *& Ap, const Self_t& A, const _Tp1& F) {
-                            typename other::Blackbox_t * A1;
-                            typename Blackbox_t::template rebind<_Tp1> () ( A1, *(A._A_ptr), F);
-                            Ap = new other(A1);
-                        }
-                    };
-
+		template<typename _Tp1>
+		struct rebind {
+			typedef TransposeOwner<typename Blackbox_t::template rebind<_Tp1>::other> other;
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F)
+			{
+				typename Blackbox_t::template rebind<_Tp1> () ( Ap.getData(), *(A.getPtr()), F);
+			}
+		};
 
 		/** Application of BlackBox matrix.
-		 * y= (A*B)*x.
-		 * Requires one vector conforming to the \ref{LinBox}
-		 * vector {@link Archetypes archetype}.
+		 * <code>y= (A*B)*x</code>.
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
 		 * Required by abstract base class.
 		 * @return reference to vector y containing output.
 		 * @param  x constant reference to vector to contain input
+		 * @param y
 		 */
 		template <class Vector1, class Vector2>
 		inline Vector1 &apply (Vector1 &y, const Vector2 &x) const
@@ -106,12 +117,13 @@ namespace LinBox
 
 
 		/** Application of BlackBox matrix transpose.
-		 * y= transpose(A*B)*x.
-		 * Requires one vector conforming to the \ref{LinBox}
-		 * vector {@link Archetypes archetype}.
+		 * <code>y= transpose(A*B)*x</code>.
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
 		 * Required by abstract base class.
 		 * @return reference to vector y containing output.
 		 * @param  x constant reference to vector to contain input
+		 * @param y
 		 */
 		template <class Vector1, class Vector2>
 		inline Vector1 &applyTranspose (Vector1 &y, const Vector2 &x) const
@@ -127,33 +139,177 @@ namespace LinBox
 		 */
 		size_t rowdim (void) const
 		{
-			if (_A_ptr != 0) 
+			if (_A_ptr != 0)
 				return _A_ptr->coldim ();
-			else 
+			else
 				return 0;
 		}
-    
+
 		/** Retreive column dimensions of BlackBox matrix.
 		 * Required by abstract base class.
 		 * @return integer number of columns of black box matrix.
 		 */
-		size_t coldim (void) const 
+		size_t coldim (void) const
 		{
-			if (_A_ptr != 0) 
+			if (_A_ptr != 0)
 				return _A_ptr->rowdim ();
-			else 
+			else
 				return 0;
 		}
-	       
+
 
 		const Field& field() const {return _A_ptr->field();}
-	    private:
 
-		// Pointers to A and B matrices
+		// accessors to the blackboxes
+		const Blackbox* getPtr() const {return  _A_ptr;}
+	private:
+
+		// Pointers to the matrix
 		const Blackbox *_A_ptr;
 
+
 	}; // template <Vector> class Transpose
 
 } // namespace LinBox
 
-#endif // __TRANSPOSE_H
+
+namespace LinBox
+{
+
+	/** \brief transpose matrix without copying.
+
+	  \ingroup blackbox
+
+	 * @param Vector \ref LinBox dense or sparse vector of field elements
+	 */
+	template <class Blackbox>
+	class TransposeOwner : public BlackboxInterface {
+
+	public:
+		typedef Blackbox Blackbox_t;
+		typedef TransposeOwner<Blackbox> Self_t;
+
+		typedef typename Blackbox::Field Field;
+		typedef typename Blackbox::Element Element;
+
+		/** Constructor from a black box.
+		 * This constructor creates a matrix that is the transpose of a black box
+		 * matrix A
+		 */
+		TransposeOwner (const Blackbox& A) :
+			_A_data(A)
+		{}
+
+		TransposeOwner (const Blackbox *A_data) :
+			_A_data(*A_data)
+		{ }
+
+		/** Copy constructor.
+		 * @param M constant reference to compose black box matrix
+		 */
+		TransposeOwner (const TransposeOwner<Blackbox> &M) :
+			_A_data(M.getData())
+		{
+#if 0
+			create new copies of matrices in dynamic memory
+			linbox_check (M.getData() != NULL);
+			_A_data = M.getData().clone ();
+#endif
+		}
+
+		/// Destructor
+		~TransposeOwner (void)
+		{
+		}
+
+		template<typename _Tp1>
+		struct rebind {
+			typedef TransposeOwner<typename Blackbox::template rebind<_Tp1>::other> other;
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F)
+			{
+				typename Blackbox_t::template rebind<_Tp1> () ( Ap.getData(), A.getData(), F);
+			}
+		};
+
+		template<typename _BB, class Field>
+		TransposeOwner (const Transpose<_BB>& T, const Field& F) :
+			_A_data(*(T.getPtr()), F)
+		{
+			typename Transpose<_BB>::template rebind<Field>()(*this,T, F);
+		}
+		template<typename _BB, class Field>
+		TransposeOwner (const TransposeOwner<_BB>& T, const Field& F) :
+			_A_data(T.getData(), F)
+		{
+			typename TransposeOwner<_BB>::template rebind<Field>()(*this,T, F);
+		}
+
+
+		/** Application of BlackBox matrix.
+		 * <code>y= (A*B)*x</code>.
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
+		 * Required by abstract base class.
+		 * @return reference to vector y containing output.
+		 * @param  x constant reference to vector to contain input
+		 * @param y
+		 */
+		template <class Vector1, class Vector2>
+		inline Vector1 &apply (Vector1 &y, const Vector2 &x) const
+		{
+			return _A_data.applyTranspose (y, x);
+		}
+
+
+		/** Application of BlackBox matrix transpose.
+		 * <code>y= transpose(A*B)*x</code>.
+		 * Requires one vector conforming to the \ref LinBox
+		 * vector @link Archetypes archetype at endlink.
+		 * Required by abstract base class.
+		 * @return reference to vector y containing output.
+		 * @param  x constant reference to vector to contain input
+		 * @param y
+		 */
+		template <class Vector1, class Vector2>
+		inline Vector1 &applyTranspose (Vector1 &y, const Vector2 &x) const
+		{
+			return _A_data.apply (y, x);
+		}
+
+		/** Retreive row dimensions of BlackBox matrix.
+		 * This may be needed for applying preconditioners.
+		 * Required by abstract base class.
+		 * @return integer number of rows of black box matrix.
+		 */
+		size_t rowdim (void) const
+		{
+			return _A_data.coldim ();
+		}
+
+		/** Retreive column dimensions of BlackBox matrix.
+		 * Required by abstract base class.
+		 * @return integer number of columns of black box matrix.
+		 */
+		size_t coldim (void) const
+		{
+			return _A_data.rowdim ();
+		}
+
+
+		const Field& field() const {return _A_data.field();}
+
+		// accessors to the blackboxes without ownership
+		const Blackbox& getData() const {return  _A_data;}
+		Blackbox& getData() {return  _A_data;}
+	private:
+		// Takes ownership of the data
+		Blackbox _A_data;
+
+
+	};
+
+} // namespace LinBox
+
+
+
+#endif // __LINBOX_transpose_H
diff --git a/linbox/blackbox/triplesbb.h b/linbox/blackbox/triplesbb.h
index bd4f7a1..f0dc568 100644
--- a/linbox/blackbox/triplesbb.h
+++ b/linbox/blackbox/triplesbb.h
@@ -1,3 +1,5 @@
+/* -*- 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
 /* linbox/blackbox/triplesbb.h
  * Copyright (C) 2002 Rich Seagraves,  see COPYING for details.
  *
@@ -5,8 +7,13 @@
  * with mods by bds
  */
 
-#ifndef __TRIPLESBB_H
-#define __TRIPLESBB_H
+/** @file blackbox/triplesbb.h
+ * @ingroup blackbox
+ * @brief NO DOC
+ */
+
+#ifndef __LINBOX_triplesbb_H
+#define __LINBOX_triplesbb_H
 
 #include <algorithm>
 using std::max;
@@ -18,37 +25,37 @@ using std::max;
 
 #include <vector>
 
-namespace LinBox {
+namespace LinBox
+{
 
 	/** \brief wrapper for NAG Sparse Matrix format.
 	 *
-\ingroup blackbox
+	 \ingroup blackbox
 	 * This class acts as a wrapper for a pre-existing NAGSparse Matrix.
 	 * To be used for interface between LinBox and computer algebra systems such
 	 * as Maple that can encode sparse matrices in the NAGSparse format
-	 */ 
-
+	 */
 	template<class _Field>
-		class TriplesBB : public BlackboxInterface{	 
-	 
-		public:
+	class TriplesBB : public BlackboxInterface{
+
+	public:
 		typedef _Field Field;
 		typedef typename Field::Element Element;
-	    typedef TriplesBB<Field> Self_t;
+		typedef TriplesBB<Field> Self_t;
 
 
 		// Default constructor.
 		TriplesBB() {}
 
 		// Takes 3 vectors and copies(bad) them.
-		TriplesBB(	Field F, 
-					std::vector<Element> values, 
-					std::vector<size_t> rowP, 
-					std::vector<size_t> colP, 
-					size_t rows, 
-					size_t cols, 
-					bool RowSortFlag = false, 
-					bool ColSortFlag = false);
+		TriplesBB(	Field F,
+				std::vector<Element> values,
+				std::vector<size_t> rowP,
+				std::vector<size_t> colP,
+				size_t rows,
+				size_t cols,
+				bool RowSortFlag = false,
+				bool ColSortFlag = false);
 
 		// Alternate constructor.  Allows for use of addEntry operation.
 		TriplesBB(Field F, size_t rows, size_t cols, size_t reserve = 0);
@@ -70,28 +77,34 @@ namespace LinBox {
 
 		size_t coldim() const { return _cols; }
 
-        template<typename _Tp1> 
-        struct rebind { 
-			typedef TriplesBB<_Tp1> other; 
-			void operator() (other *& Ap, const Self_t& A, const _Tp1& F)
+		template<typename _Tp1>
+		struct rebind {
+			typedef TriplesBB<_Tp1> other;
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F)
 			{
-			  Hom <typename Self_t::Field, _Tp1> hom( A.field(), F);
+				Hom <typename Self_t::Field, _Tp1> hom( A.field(), F);
 
-			  typedef typename _Tp1::Element otherElt;
+				typedef typename _Tp1::Element otherElt;
 				typedef typename std::vector<otherElt> othervec;
 				typedef typename std::vector<Element> selfvec;
 				typedef typename othervec::iterator otheriter;
-				typedef typename selfvec::iterator selfiter;
+				typedef typename selfvec::const_iterator selfiter;
 				otheriter vp_p; selfiter v_p;
 
-				othervec values_mapped(A._values.size());
-				for (v_p = A._values.begin(), vp_p = values_mapped.begin(); 
+				Ap._values.resize(A._values.size());
+				for (v_p = A._values.begin(), vp_p = Ap._values.begin();
 				     v_p != A._values.end(); ++ v_p, ++ vp_p)
 					hom.image (*vp_p, *v_p);
-				Ap = new other(F, values_mapped, A._RowV, A._ColV, A._rows, A._cols, A._RowSortFlag, A._ColSortFlag);
 			}
 		};
 
+		template<typename _Tp1>
+		TriplesBB(const TriplesBB<_Tp1>& T, const Field& F) :
+			_F(F), _values(T.size()), _RowV(T.getRows()), _ColV(T.getCols()), _rows(T.rowdim()), _cols(T.coldim()), _faxpy(max(T.getRows(),T.getCols()), FieldAXPY<Field>(F)), _RowSortFlag(T.isRowSorted()), _ColSortFlag(T.isColSorted())
+		{}
+
+
+
 		/* Returns number of non-zero entries */
 		size_t size() const { return _values.size(); }
 
@@ -101,21 +114,24 @@ namespace LinBox {
 		const Field & field() const { return _F; }
 
 		/* Data accessors.  Used to access the 3 vectors containing Matrix data
-		 */
+		*/
 		const std::vector<Element> & getData() const { return _values; }
 		const std::vector<size_t> & getRows() const { return _RowV; }
 		const std::vector<size_t> & getCols() const { return _ColV; }
+		bool isRowSorted() { return _RowSortFlag; }
+		bool isColSorted() { return _ColSortFlag; }
 
-		protected:
+
+	protected:
 		Field _F; // The field used by this class
 
 		/// _values contains the nonzero elements of the BlackBox
 		std::vector<Element> _values;
 
-		/// _RowV & _ColV are vectors containing the row & column indices 
+		/// _RowV & _ColV are vectors containing the row & column indices
 		std::vector<size_t> _RowV, _ColV;
 
-		/// The number of rows, columns 
+		/// The number of rows, columns
 		size_t _rows, _cols;
 
 		/* _apply is the generic apply utility funtion called by apply() and
@@ -150,16 +166,16 @@ namespace LinBox {
 	 * defaults to 0 (no ordering implied).
 	 */
 	template<class Field>
-		TriplesBB<Field>::TriplesBB(Field F, 
-								    std::vector<Element> values, 
-								    std::vector<size_t> RowV, 
-									std::vector<size_t> ColV, 
-									size_t rows, 
-									size_t cols, 
-									bool RowSortFlag, 
-									bool ColSortFlag) :
+	TriplesBB<Field>::TriplesBB(Field F,
+				    std::vector<Element> values,
+				    std::vector<size_t> RowV,
+				    std::vector<size_t> ColV,
+				    size_t rows,
+				    size_t cols,
+				    bool RowSortFlag,
+				    bool ColSortFlag) :
 		_F(F), _values(values), _RowV(RowV), _ColV(ColV), _rows(rows), _cols(cols), _faxpy(max(rows,cols), FieldAXPY<Field>(F)), _RowSortFlag(RowSortFlag), _ColSortFlag(ColSortFlag)
-		{}
+	{}
 
 	/* Better constructor that only takes the field, m, n and recommended
 	 * reserve (optional arguement) for use with STL vector reserve option
@@ -167,57 +183,57 @@ namespace LinBox {
 	 * conjuction with the addEntry() method
 	 */
 	template<class Field>
-		TriplesBB<Field>::TriplesBB( Field F, size_t rows, size_t cols, size_t res):
+	TriplesBB<Field>::TriplesBB( Field F, size_t rows, size_t cols, size_t res):
 		_F(F), _rows(rows), _cols(cols), _faxpy( max(rows, cols), FieldAXPY<Field>(F)), _RowSortFlag(false), _ColSortFlag(false)
-		{
-			if(res != 0) {
-				_values.reserve(res);
-				_RowV.reserve(res);
-				_ColV.reserve(res);
-			}
+	{
+		if(res != 0) {
+			_values.reserve(res);
+			_RowV.reserve(res);
+			_ColV.reserve(res);
 		}
+	}
 
 
 
 	template<class Field>
-		TriplesBB<Field>::TriplesBB(const TriplesBB<Field> &In) :
+	TriplesBB<Field>::TriplesBB(const TriplesBB<Field> &In) :
 		_faxpy( max(In._rows, In._cols), FieldAXPY<Field>(In._F)),
-			_F ( In._F ),
-			_values ( In._values ),
-			_RowV ( In._RowV ),
-			_ColV ( In._ColV ),
-			_rows ( In._rows ), 
-			_cols ( In._cols ),
-			_RowSortFlag ( In._RowSortFlag ),
-			_ColSortFlag ( In._ColSortFlag )
-		{ }
+		_F ( In._F ),
+		_values ( In._values ),
+		_RowV ( In._RowV ),
+		_ColV ( In._ColV ),
+		_rows ( In._rows ),
+		_cols ( In._cols ),
+		_RowSortFlag ( In._RowSortFlag ),
+		_ColSortFlag ( In._ColSortFlag )
+	{ }
 
 
 	template<class Field>
-		const TriplesBB<Field> & TriplesBB<Field>::operator=(const TriplesBB<Field> & rhs)
-		{
-			_F = rhs._F;
-			_values = rhs._values;
-			_RowV = rhs._RowV;
-			_ColV = rhs._ColV;
-			_rows = rhs._rows; _cols = rhs._cols;
-			_RowSortFlag = rhs._RowSortFlag;
-			_ColSortFlag  = rhs._ColSortFlag;
-
-			_faxpy.resize(rhs._faxpy.size(), FieldAXPY<Field>(_F));
-
-			return *this;
-		}
+	const TriplesBB<Field> & TriplesBB<Field>::operator=(const TriplesBB<Field> & rhs)
+	{
+		_F = rhs._F;
+		_values = rhs._values;
+		_RowV = rhs._RowV;
+		_ColV = rhs._ColV;
+		_rows = rhs._rows; _cols = rhs._cols;
+		_RowSortFlag = rhs._RowSortFlag;
+		_ColSortFlag  = rhs._ColSortFlag;
+
+		_faxpy.resize(rhs._faxpy.size(), FieldAXPY<Field>(_F));
+
+		return *this;
+	}
 
 
 	template<class Field>
-		template<class OutVector, class InVector>
-		OutVector & TriplesBB<Field>::apply(OutVector & y, const InVector & x) const
-		{
+	template<class OutVector, class InVector>
+	OutVector & TriplesBB<Field>::apply(OutVector & y, const InVector & x) const
+	{
 
-			_apply( y, x, _RowV.begin(), _ColV.begin() );
-			return y;
-		}
+		_apply( y, x, _RowV.begin(), _ColV.begin() );
+		return y;
+	}
 
 	/* BlackBoxArchetype applyTranspose function.  Performs the y = ATx, where
 	 * y and x are vectors passed in applyTranspose(y,x), and A is the present
@@ -226,83 +242,83 @@ namespace LinBox {
 	 * by the rows.  Thus, as in apply above, takes advantage of this fact by
 	 * switching on the ordering.
 	 */
-
 	template<class Field>
-		template<class OutVector, class InVector>
-		OutVector & TriplesBB<Field>::applyTranspose(OutVector & y, const InVector & x) const
-		{
-			_apply( y, x, _ColV.begin(), _RowV.begin() );
-			return y;
-		}
+	template<class OutVector, class InVector>
+	OutVector & TriplesBB<Field>::applyTranspose(OutVector & y, const InVector & x) const
+	{
+		_apply( y, x, _ColV.begin(), _RowV.begin() );
+		return y;
+	}
 
 
 	template<class Field>
-		template<class OutVector, class InVector>
-		void TriplesBB<Field>::_apply(OutVector & y, const InVector & x, std::vector<size_t>::const_iterator i, std::vector<size_t>::const_iterator j) const
-		{
-			typename OutVector::iterator yp;
-			typename InVector::const_iterator xp;
-			typename Field::Element zero;
-			typename std::vector<Element>::const_iterator v;
-			typename std::vector<FieldAXPY<Field> >::iterator fa_i;
+	template<class OutVector, class InVector>
+	void TriplesBB<Field>::_apply(OutVector & y, const InVector & x, std::vector<size_t>::const_iterator i, std::vector<size_t>::const_iterator j) const
+	{
+		typename OutVector::iterator yp;
+		typename InVector::const_iterator xp;
+		typename Field::Element zero;
+		typename std::vector<Element>::const_iterator v;
+		typename std::vector<FieldAXPY<Field> >::iterator fa_i;
 
-			_F.init(zero,0);
+		_F.init(zero,0);
 
-			for(fa_i = _faxpy.begin(); fa_i != _faxpy.end(); ++fa_i) 
-				fa_i->assign(zero);
+		for(fa_i = _faxpy.begin(); fa_i != _faxpy.end(); ++fa_i)
+			fa_i->assign(zero);
 
-			for( v = _values.begin(), fa_i = _faxpy.begin() - 1, xp = x.begin() - 1; v != _values.end(); ++i, ++j, ++v) 
-				(fa_i + *i)->mulacc(*v,  *(xp + *j));
+		for( v = _values.begin(), fa_i = _faxpy.begin() - 1, xp = x.begin() - 1; v != _values.end(); ++i, ++j, ++v)
+			(fa_i + *i)->mulacc(*v,  *(xp + *j));
 
 
 
-			for(fa_i = _faxpy.begin(), yp = y.begin(); yp != y.end(); ++yp, ++fa_i) 
-				fa_i->get(*yp);
+		for(fa_i = _faxpy.begin(), yp = y.begin(); yp != y.end(); ++yp, ++fa_i)
+			fa_i->get(*yp);
 
-  
 
-		}
+
+	}
 
 
 	/* addEntry method.  Allows user to add entries on the fly.  Meant to be used
 	 * with the "copyless" constructor above.  Note, will automatically set the
 	 * _sortFlag to false, as you can't be sure the entries are still sorted afterwards
 	 */
-
 	template<class Field>
-		void TriplesBB<Field>::addEntry(const Element &Elem, const size_t i, const size_t j) {
+	void TriplesBB<Field>::addEntry(const Element &Elem, const size_t i, const size_t j)
+	{
 		_RowSortFlag = _ColSortFlag = false;
 		_values.push_back(Elem);
 		_RowV.push_back(i);
 		_ColV.push_back(j);
 	}
 
-	/*
-	  template<class Field, class Vector>
-	  void TriplesBB<Field, Vector>::SortByRow()
-	  {
-	  RowWiseLessThan<Field,Vector> rwlt;
-	  if(_RowSortFlag) return; // If already sorted, bail
+#if 0
+	template<class Field, class Vector>
+	void TriplesBB<Field, Vector>::SortByRow()
+	{
+		RowWiseLessThan<Field,Vector> rwlt;
+		if(_RowSortFlag) return; // If already sorted, bail
 
-	  std::sort( rawIndexedBegin(), rawIndexedEnd(), rwlt  );
-	  _RowSortFlag = true;     // Sets the row sort flag
-	  _ColSortFlag = false;    // Unset the col sort flag
+		std::sort( rawIndexedBegin(), rawIndexedEnd(), rwlt  );
+		_RowSortFlag = true;     // Sets the row sort flag
+		_ColSortFlag = false;    // Unset the col sort flag
 
-	  }
+	}
 
-	  template<class Field, class Vector>
-	  void TriplesBB<Field, Vector>::SortByCol()
-	  {
+	template<class Field, class Vector>
+	void TriplesBB<Field, Vector>::SortByCol()
+	{
 
-	  ColWiseLessThan<Field,Vector> cwlt;
-	  if(_ColSortFlag) return;  // If already sorted, bail
+		ColWiseLessThan<Field,Vector> cwlt;
+		if(_ColSortFlag) return;  // If already sorted, bail
 
-	  std::sort( rawIndexedBegin(), rawIndexedEnd(), cwlt );
-	  _ColSortFlag = true;     // Sets the Col sort flag
-	  _RowSortFlag = false;    // Unset the Row sort flag
-	  }
-	*/
+		std::sort( rawIndexedBegin(), rawIndexedEnd(), cwlt );
+		_ColSortFlag = true;     // Sets the Col sort flag
+		_RowSortFlag = false;    // Unset the Row sort flag
+	}
+#endif
 
 } // namespace LinBox
 
-#endif // ifdef __MAPLEBB_H
+#endif // __LINBOX_triplesbb_H
+
diff --git a/linbox/blackbox/zero-one.h b/linbox/blackbox/zero-one.h
old mode 100755
new mode 100644
index 9d154ba..6e73cda
--- a/linbox/blackbox/zero-one.h
+++ b/linbox/blackbox/zero-one.h
@@ -1,3 +1,5 @@
+/* -*- 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++; style: linux -*- */
 
 /* linbox/blackbox/zero-one.h
@@ -5,14 +7,15 @@
  *
  * Written by Rich Seagraves <seagrave at cis.udel.edu>
  * Modified by Zhendong, -bds
+ * Time-stamp: <22 Jun 10 17:34:01 Jean-Guillaume.Dumas at imag.fr>
  *
  * ------------------------------------
  *
  * See COPYING for license information.
  */
 
-#ifndef __ZERO_ONE_H
-#define __ZERO_ONE_H
+#ifndef __LINBOX_zero_one_H
+#define __LINBOX_zero_one_H
 
 #include "linbox/integer.h"
 #include "linbox/vector/vector-traits.h"
@@ -25,211 +28,250 @@
 #include <vector> // For vectors in _col2row and _row2col
 #include <cstdlib> // For randomness in randomized quicksort
 #include <ctime>
+#include <iostream>
 
 namespace LinBox
 {
-  
-/** \brief Time and space efficient representation of sparse {0,1}-matrices.
-   *  
-   * A 0-1 matrix is a matrix with all 0's and 1's as entries.  
-   * We're using a NAG-sparse format. 
-   * Applies can be performed fast, using only additions.
-   * When initalizing this class, you only need to build 2 arrays of equal length:
-   * an array of the row indices for the non-zero (1's) entries, and an array of the column
-   * indices for the non-zero (1's) entries.
-
-	A {0, 1,-1} matrix can be effecively represented as the \ref Dif of two ZeroOne's.
-\ingroup blackbox
-   */
-  
-  template<class _Field>
-  class ZeroOne : public BlackboxInterface
-  {
-  protected:  
-    typedef size_t Index;
-  public:
-    typedef ZeroOne<_Field> Self_t;
-    typedef _Field Field;
-    typedef typename _Field::Element Element;
-    
-    // Default constructor, do nothing.
-    ZeroOne();
-    // The real constructor /todo give docs here
-    ZeroOne(Field F, Index* rowP, Index* colP, Index rows, Index cols, Index NNz, bool rowSort = false, bool colSort = false);
-    // Destructor, once again do nothing
-    ~ZeroOne();
-   
-    /** \brief
-     *
-     * Uses one of the three
-     * private utility functions. It calls the generalized utility function
-     * _apply if there is no special ordering, _fyapply if there is C_ordering
-     * or _fxapply if there is fortran_ordering
-     */
-    template<class OutVector, class InVector>
-    OutVector& apply(OutVector& y, const InVector& x) const // y = Ax;
-    { return applySpecialization(y,x,getType(_F)); }
-    /** \brief
-     *
-     * Uses one of the three
-     * private utility functions, in the manner described above.  Worthy of
-     * note is the fact that applyTranspose works by passing the column
-     * positions to the _apply functions as if they were rows, and row positions
-     * as if they were columns, as if the matrix had been transposed.
-     */
-    
-    template<class OutVector, class InVector>
-    OutVector& applyTranspose(OutVector& y, const InVector& x) const // y = ATx
-    { return applyTransposeSpecialization(y,x,getType(_F));}
-    
-    size_t rowdim() const { return _rows; }
-    
-    size_t coldim() const { return _cols; }      
-
-
-    template<typename _Tp1>
-    struct rebind 
-    { 
-      typedef ZeroOne<_Tp1> other;
-      void operator() (other *& Ap,
-		       const Self_t& A, 
-		       const _Tp1& F) {
-	Ap = new other(F, A._rowP, A._colP, A._rows, A._cols,
-		       A._nnz, A._rowSort, A._colSort);
-      }
-    };
-
-    
-    /** RawIterator class.  Iterates straight through the values of the matrix
-     */
-    class RawIterator;
-
-    RawIterator rawBegin();
-    RawIterator rawEnd();
-    const RawIterator rawBegin() const;
-    const RawIterator rawEnd() const;
-
-     /** RawIndexIterator - Iterates through the i and j of the current element
-   * and when accessed returns an STL pair containing the coordinates
-   */
-    class RawIndexIterator;
-    RawIndexIterator indexBegin();
-    const RawIndexIterator indexBegin() const;
-    RawIndexIterator indexEnd();
-    const RawIndexIterator indexEnd() const;
-
-    /** Read the matrix from a stream in the JGD's SMS format
-     *  @param is Input stream from which to read the matrix
-     *  @return Reference to input stream 
-     */
-    std::istream &read (std::istream &is){
-      size_t i, j, k, m, n;
-      
-      char buf[80];
-      buf[0]=0;
-      is.getline (buf, 80);
-      std::istringstream str (buf);	
-      str >> m >> n >> k;
-      _rows = m;
-      _cols = n;
-	  std::vector<size_t> rowP, colP;
-      size_t x;
-      while (is >> i >> j >> x) {
-		if (i == 0 || i == (size_t) -1) break;
-		if (x == 1UL) {
-	  		rowP.push_back(i-1);
-	  		colP.push_back(j-1);
+
+	/** \brief Time and space efficient representation of sparse {0,1}-matrices.
+	 *
+	 * A 0-1 matrix is a matrix with all 0's and 1's as entries.
+	 * We're using a NAG-sparse format.
+	 * Applies can be performed fast, using only additions.
+	 * When initalizing this class, you only need to build 2 arrays of equal length:
+	 * an array of the row indices for the non-zero (1's) entries, and an array of the column
+	 * indices for the non-zero (1's) entries.
+
+	 A {0, 1,-1} matrix can be effecively represented as the \ref Dif of two ZeroOne's.
+	 \ingroup blackbox
+	 */
+	template<class _Field>
+	class ZeroOne : public BlackboxInterface {
+	protected:
+		typedef size_t Index;
+	public:
+		typedef ZeroOne<_Field> Self_t;
+		typedef _Field Field;
+		typedef typename _Field::Element Element;
+
+		// Default constructor, do nothing.
+		ZeroOne(const Field& F);
+		// The real constructor /todo give docs here
+		ZeroOne(Field F, Index* rowP, Index* colP, Index rows, Index cols, Index NNz, bool rowSort = false, bool colSort = false);
+		// Destructor, once again do nothing
+		~ZeroOne();
+
+		/** apply.
+		 *
+		 * Uses one of the three
+		 * private utility functions. It calls the generalized utility function
+		 * _apply if there is no special ordering, _fyapply if there is C_ordering
+		 * or _fxapply if there is fortran_ordering
+		 */
+		template<class OutVector, class InVector>
+		OutVector& apply(OutVector& y, const InVector& x) const // y = Ax;
+		{
+			return applySpecialization(y,x,getType(_F));
+		}
+
+		/** applyTranspose.
+		 *
+		 * Uses one of the three
+		 * private utility functions, in the manner described above.  Worthy of
+		 * note is the fact that applyTranspose works by passing the column
+		 * positions to the _apply functions as if they were rows, and row positions
+		 * as if they were columns, as if the matrix had been transposed.
+		 */
+		template<class OutVector, class InVector>
+		OutVector& applyTranspose(OutVector& y, const InVector& x) const // y = ATx
+		{
+			return applyTransposeSpecialization(y,x,getType(_F));
+		}
+
+		size_t rowdim() const
+		{
+			return _rows;
+		}
+
+		size_t coldim() const
+		{
+			return _cols;
+		}
+
+		template<typename _Tp1>
+		struct rebind {
+			typedef ZeroOne<_Tp1> other;
+			void operator() (other & Ap,
+					 const Self_t& A,
+					 const _Tp1& F)
+			{
+				// ZeroOne does not store any field element
+			}
+		};
+
+		template<typename _Tp1>
+		ZeroOne(const ZeroOne<_Tp1>& Z, const Field& F) :
+			_F(F),
+			_rows(Z.rowdim()), _cols(Z.coldim()), _nnz(Z.nnz()),
+			_rowP(new Index[Z.nnz()]), _colP(new Index[Z.nnz()]),
+			_rowSort(Z.isRowSorted()), _colSort(Z.isColSorted()),
+			dynamic(true)
+		{
+
+			Index * rowit = _rowP;
+			Index * colit = _colP;
+
+			for(typename ZeroOne<_Tp1>::RawIndexIterator it = Z.indexBegin();
+			    it != Z.indexEnd(); ++it,++rowit,++colit) {
+				*rowit = (*it).first;
+				*colit = (*it).second;
+			}
+		}
+
+		/** RawIterator class.
+		 * Iterates straight through the values of the matrix
+		 */
+		class RawIterator;
+
+		RawIterator rawBegin();
+		RawIterator rawEnd();
+		const RawIterator rawBegin() const;
+		const RawIterator rawEnd() const;
+
+		/** RawIndexIterator.
+		 * Iterates through the i and j of the current element
+		 * and when accessed returns an STL pair containing the coordinates
+		 */
+		class RawIndexIterator;
+		RawIndexIterator indexBegin();
+		const RawIndexIterator indexBegin() const;
+		RawIndexIterator indexEnd();
+		const RawIndexIterator indexEnd() const;
+
+		/** Read the matrix from a stream in the JGD's SMS format.
+		 *  @param is Input stream from which to read the matrix
+		 *  @return Reference to input stream
+		 */
+		std::istream &read (std::istream &is)
+		{
+			size_t i, j, k, m, n;
+
+			char buf[80];
+			buf[0]=0;
+			is.getline (buf, 80);
+			std::istringstream str (buf);
+			str >> m >> n >> k;
+			_rows = m;
+			_cols = n;
+			std::vector<size_t> rowP, colP;
+			size_t x;
+			while (is >> i >> j >> x) {
+				if (i == 0 || i == (size_t) -1) break;
+				if (x == 1UL) {
+					rowP.push_back(i-1);
+					colP.push_back(j-1);
+				}
+			}
+			_nnz = rowP.size();
+			_rowP = new size_t[_nnz];
+			_colP = new size_t[_nnz];
+			copy(rowP.begin(), rowP.end(), _rowP);
+			copy(colP.begin(), colP.end(), _colP);
+			return is;
 		}
-	  }
-	  _nnz = rowP.size();
-	  _rowP = new size_t[_nnz];
-	  _colP = new size_t[_nnz];
-	  copy(rowP.begin(), rowP.end(), _rowP);
-	  copy(colP.begin(), colP.end(), _colP);
-      return is;
-    }
- 
-    std::ostream& write(std::ostream& out =std::cout)
-    {
-      size_t* i=_rowP;
-      size_t* j=_colP;
-      std::cout<<"Row dim: "<<rowdim()
-	       <<" Col dim: "<<coldim()
-	       <<" Total nnz: "<<nnz()<<"\n";
-      for(;i<_rowP+nnz();++i,++j)
-	std::cout<<*i<<" "<<*j<<"\n";     
-	return out;
-    }
-
-    const Field& field() const { return _F; }
-
-
-  protected:
-   
-
-    Field _F; // The field used by this class
-    
-    /* A temporary element used for initalization for the rawBegin() and
-     * rawEnd() methods of the ZeroOne class.  Is used to initalize a 1
-     * so that the RawIterator returned stores a 1 
-     */
-
-    Element _tmp; 
-    
-    
-    /* _rowP is a pointer to an array of row indexes.  _colP is a pointer
-     * to an array of column indexes. These two are the other arrays of a
-     * NAGSparse format Matrix.  _rows and _cols are the number of rows and
-     * columns of the Matrix if it were in dense format.  _nnz is the Number of
-     * Non-Zero elements in the Matrix.  It also happens to be the length of
-     * the three NAGSparse arrays.
-     */
-    
-    Index _rows, _cols, _nnz;
-    mutable Index* _rowP, *_colP;
-    mutable bool _rowSort, _colSort; // status flags for sorting state          
-    bool dynamic;
-
-     /* Non blackbox function.  Tells the number of nonzero entries
-     */
-    size_t nnz() const { return _nnz; };
-    
-    void rowSort() const;
-    void colSort() const;
-
-    void _qsort(size_t start, size_t endp1, int &mode) const; // QuickSort function for when there is no sorting
-    size_t _part( size_t start, size_t endp1, int &mode) const; // Partition for quicksort
-
-  private:
-
-    class FieldType {};
-    class NormField : public FieldType {};
-    class Mod32Field : public FieldType {}; 
-
-    template<class F>
-    NormField getType(const F &  f) const
-    {
-      return NormField();
-    }
-        
-    Mod32Field getType(const Modular<uint32> &) const
-    {
-      return Mod32Field();
-    }
-
-    template<class OutVector, class InVector>
-    OutVector& applySpecialization(OutVector &, const InVector &,const NormField& ) const;
-    template<class OutVector, class InVector>
-    OutVector& applySpecialization(OutVector &, const InVector &, const Mod32Field& )const;
-    template<class OutVector, class InVector>
-    OutVector& applyTransposeSpecialization(OutVector &, const InVector &,const NormField& ) const;
-    template<class OutVector, class InVector>
-    OutVector& applyTransposeSpecialization(OutVector &, const InVector &, const Mod32Field& )const;
-
-  }; //ZeroOne
+
+		std::ostream& write(std::ostream& out =std::cout)
+		{
+			size_t* i=_rowP;
+			size_t* j=_colP;
+			std::cout<<"Row dim: "<<rowdim()
+			<<" Col dim: "<<coldim()
+			<<" Total nnz: "<<nnz()<<"\n";
+			for(;i<_rowP+nnz();++i,++j)
+				std::cout<<*i<<" "<<*j<<"\n";
+			return out;
+		}
+
+		const Field& field() const
+		{
+			return _F;
+		}
+
+		bool isRowSorted() const
+		{
+			return _rowSort;
+		}
+		bool isColSorted() const
+		{
+			return _colSort;
+		}
+
+		size_t nnz() const
+		{
+			return _nnz;
+		};
+
+
+	protected:
+
+
+		Field _F; //!< @internal The field used by this class
+
+		/*! @internal A temporary element used for initalization for the rawBegin() and
+		 * rawEnd() methods of the ZeroOne class.  Is used to initalize a 1
+		 * so that the RawIterator returned stores a 1
+		 */
+		Element _tmp;
+
+		Index _rows ;          //!<@internal number of rows of the Matrix
+		Index _cols ;          //!<@internal number of columns
+		Index _nnz;            //!<@internal Number of  Non-Zero elements in the Matrix.  It also happens to be the length of  the three NAGSparse arrays.
+		mutable Index* _rowP ; //!<@internal pointer to an array of row indexes.
+		mutable Index* _colP;  //!<@internal pointer to an array of column indexes. (\c _rowP and \c _colP are the other arrays of a  NAGSparse format Matrix.)
+		mutable bool _rowSort ;
+		mutable bool _colSort; //!<@internal status flags for sorting state
+		bool dynamic;          // NO DOC
+
+		/*! Tells the number of nonzero entries.
+		 * Non blackbox function.
+		 */
+		void rowSort() const;
+		void colSort() const;
+
+		void _qsort(size_t start, size_t endp1, int &mode) const;   //!< @internal QuickSort function for when there is no sorting
+		size_t _part( size_t start, size_t endp1, int &mode) const; //!< @internal Partition for quicksort
+
+	private:
+
+		class FieldType {};
+		class NormField : public FieldType {};
+		class Mod32Field : public FieldType {};
+
+		template<class F>
+		NormField getType(const F &  f) const
+		{
+			return NormField();
+		}
+
+		Mod32Field getType(const Modular<uint32_t> &) const
+		{
+			return Mod32Field();
+		}
+
+		template<class OutVector, class InVector>
+		OutVector& applySpecialization(OutVector &, const InVector &,const NormField& ) const;
+		template<class OutVector, class InVector>
+		OutVector& applySpecialization(OutVector &, const InVector &, const Mod32Field& )const;
+		template<class OutVector, class InVector>
+		OutVector& applyTransposeSpecialization(OutVector &, const InVector &,const NormField& ) const;
+		template<class OutVector, class InVector>
+		OutVector& applyTransposeSpecialization(OutVector &, const InVector &, const Mod32Field& )const;
+
+	}; //ZeroOne
 
 } //LinBox
-       
+
 #include "linbox/blackbox/zero-one.inl"
 
-#endif // __ZERO_ONE_H
+#endif // __LINBOX_zero_one_H
+
diff --git a/linbox/blackbox/zero-one.inl b/linbox/blackbox/zero-one.inl
index c7810c7..ed51ea3 100644
--- a/linbox/blackbox/zero-one.inl
+++ b/linbox/blackbox/zero-one.inl
@@ -1,3 +1,5 @@
+/* -*- 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++; style: linux -*- */
 
 /* linbox/blackbox/nag-sparse.h
@@ -10,449 +12,478 @@
  * See COPYING for license information.
  */
 
+/*! @file blackbox/zero-one.inl
+ * @ingroup blackbox
+ * @brief NO DOC
+ */
+
+#ifndef __LINBOX_bb_zero_one_INL
+#define __LINBOX_bb_zero_one_INL
+
 namespace LinBox
 {
-  template<class Field>
-  class ZeroOne<Field>::RawIterator
-  {	
-  public:
-    typedef Element value_type;
-    
-    RawIterator(size_t pos, Element elem) :
-      _pos(pos), _elem(elem) {}
-    
-    RawIterator(const RawIterator &In) :
-      _pos(In._pos), _elem(In._elem) {}
-    
-    const RawIterator& operator=(const RawIterator& rhs) 
-    {
-      _pos = rhs._pos;
-      _elem = rhs._elem;
-      return *this;
-    }
-    
-        
-    bool operator==(const RawIterator &rhs) 
-    {
-      return ( _pos == rhs._pos && _elem == rhs._elem);
-    }
-    
-    bool operator!=(const RawIterator &rhs) 
-    {
-      return ( _pos != rhs._pos || _elem != rhs._elem );
-    }
-    
-    RawIterator & operator++() 
-    {
-      ++_pos;
-      return *this;
-    }
-    
-    RawIterator operator++(int) 
-    {
-      RawIterator tmp = *this;
-      _pos++;
-      return tmp;
-    }
-    
-    value_type operator*() { return _elem; }
-    
-    const value_type operator*() const { return _elem; }
-    
-  private:
-    value_type _elem;
-    size_t _pos;
-  };  
-  
-  /* STL standard Begin and End functions.  Used to get
-   * the beginning and end of the data.  So that RawIterator
-   * can be used in algorithms like a normal STL iterator.
-   */
-  template<class Field> typename
-  ZeroOne<Field>::RawIterator ZeroOne<Field>::rawBegin()
-  { return RawIterator( 0, _F.init(_tmp, 1) ); }
-  
-  template<class Field> typename
-  ZeroOne<Field>::RawIterator ZeroOne<Field>::rawEnd() 
-  { return RawIterator( _nnz, _F.init(_tmp, 1) ); }
-  
-  template<class Field> 
-  const typename ZeroOne<Field>::RawIterator ZeroOne<Field>::rawBegin() const
-  { return RawIterator(0, _F.init(_tmp, 1) ); }
-
-  template<class Field> 
-  const typename ZeroOne<Field>::RawIterator ZeroOne<Field>::rawEnd() const 
-  { return RawIterator(_nnz, _F.init(_tmp, 1) ); } 
-  
-  /* RawIndexIterator - Iterates through the i and j of the current element
-   * and when accessed returns an STL pair containing the coordinates
-   */
-  template<class Field>
-  class ZeroOne<Field>::RawIndexIterator 
-  {
-  public:
-    typedef std::pair<size_t, size_t> value_type;
-    
-    RawIndexIterator() {}
-    
-    RawIndexIterator(size_t* row, size_t* col):
-      _row(row), _col(col) {}
-    
-    RawIndexIterator(const RawIndexIterator &In):
-      _row(In._row), _col(In._col) {}
-    
-    const RawIndexIterator &operator=(const RawIndexIterator &rhs) 
-    {
-      _row = rhs._row;
-      _col = rhs._col;
-      return *this;				
-    }
-    
-    bool operator==(const RawIndexIterator &rhs) 
-    {
-      return _row == rhs._row && _col == rhs._col;     
-    }
-    
-    bool operator!=(const RawIndexIterator &rhs) 
-    {
-      return _row != rhs._row || _col != rhs._col;
-    }
-    
-    const RawIndexIterator& operator++() 
-    {
-      ++_row; ++_col;	
-      return *this;
-    }
-    
-    const RawIndexIterator operator++(int) 
-    {
-      RawIndexIterator tmp = *this;
-      ++_row; ++_col;
-      return tmp;
-    }
-    
-    value_type operator*() 
-    {
-      return std::pair<size_t,size_t>(*_row, *_col);
-    }
-    
-    const value_type operator*() const 
-    {
-      return std::pair<size_t,size_t>(*_row, *_col);
-    }
-  private:
-    size_t* _row, *_col;
-  };
-  
-  template<class Field> typename
-  ZeroOne<Field>::RawIndexIterator ZeroOne<Field>::indexBegin() 
-  {
-    return RawIndexIterator(_rowP, _colP);
-  }
-  
-  template<class Field> 
-  const typename ZeroOne<Field>::RawIndexIterator ZeroOne<Field>::indexBegin() const
-  {
-    return RawIndexIterator(_rowP, _colP);
-  }
-
-  template<class Field> typename
-  ZeroOne<Field>::RawIndexIterator ZeroOne<Field>::indexEnd() 
-  {
-    return RawIndexIterator(_rowP + _nnz, _colP + _nnz);
-  }
-
-  template<class Field> 
-  const typename ZeroOne<Field>::RawIndexIterator ZeroOne<Field>::indexEnd() const 
-  {
-    return RawIndexIterator(_rowP + _nnz, _colP + _nnz);
-  }
- 
-  template<class Field>
-  ZeroOne<Field>::ZeroOne() { srand( time(NULL) ); dynamic = false;}
-    
-  
-  template<class Field>
-  ZeroOne<Field>::ZeroOne(Field F, Index* rowP, Index* colP, Index rows, Index cols, Index NNz, bool rowSort, bool colSort):
-    _F(F), _rows(rows), _cols(cols), _nnz(NNz), _rowP(rowP), _colP(colP), _rowSort(rowSort), _colSort(colSort) , dynamic(false) { srand(time(NULL)); }
-  
-  template<class Field>
-  ZeroOne<Field>::~ZeroOne() 
-  {
-	  if(dynamic) {
-		  delete [] _rowP;
-		  delete [] _colP;
-	  }
-  }
-
-  template<class Field>
-  void ZeroOne<Field>::rowSort() const
-  {
-    int mode = 0;
-    if( _rowSort) return;  // Already sorted, we're done   
-    else _qsort( (size_t) 0, _nnz, mode);
-    _rowSort = true;
-    return;
-  }
-
-  template<class Field>
-  void ZeroOne<Field>::colSort() const
-  {
-    int mode = 1;
-    if( _colSort) return; // Already sorted, good to go  
-    else _qsort( (size_t) 0, _nnz, mode);
-    _colSort = true; _rowSort = false;
-    return;
-  }   
-  
-  template<class Field>
-  void ZeroOne<Field>::_qsort(size_t p, size_t e, int &mode) const
-  {
-    int i;
-    if( (e - p) <= 1) ;
-    else 
-      {
-	i = 1 + _part(p, e, mode);
-	_qsort(p, i, mode);
-	_qsort(i, e, mode);
-      }
-  }
-  
-  template<class Field>
-  size_t ZeroOne<Field>::_part(size_t p, size_t e, int &mode) const
-  {
-    size_t rtemp, ctemp, rowval, colval;
-    int i = p + rand() % (e - p), j = e;
-    rtemp = _rowP[p];
-    ctemp = _colP[p];
-    _rowP[p] = _rowP[i];
-    _colP[p] = _colP[i];
-    _rowP[i] = rtemp;
-    _colP[i] = ctemp;
-    rowval = _rowP[p];
-    colval = _colP[p];
-    i = p - 1;
-    
-    if(mode == 0) 
-      { // Row mode, go by row order, then column
-	while(true) 
-	  {
-	    do j--; while( _rowP[j] > rowval || ( _rowP[j] == rowval && _colP[j] > colval ));
-	    do i++; while( _rowP[i] < rowval || ( _rowP[i] == rowval && _colP[i] < colval ));
-	    if( i < j) 
-	      {
-		rtemp = _rowP[j];
-		ctemp = _colP[j];
-		_rowP[j] = _rowP[i];
-		_colP[j] = _colP[i];
+	/*! Raw iterator.
+	 * @ingroup iterators
+	 */
+	template<class Field>
+	class ZeroOne<Field>::RawIterator {
+	public:
+		typedef Element value_type;
+
+		RawIterator(size_t pos, Element elem) :
+			_pos(pos), _elem(elem) {}
+
+		RawIterator(const RawIterator &In) :
+			_pos(In._pos), _elem(In._elem) {}
+
+		const RawIterator& operator=(const RawIterator& rhs)
+		{
+			_pos = rhs._pos;
+			_elem = rhs._elem;
+			return *this;
+		}
+
+
+		bool operator==(const RawIterator &rhs)
+		{
+			return ( _pos == rhs._pos && _elem == rhs._elem);
+		}
+
+		bool operator!=(const RawIterator &rhs)
+		{
+			return ( _pos != rhs._pos || _elem != rhs._elem );
+		}
+
+		RawIterator & operator++()
+		{
+			++_pos;
+			return *this;
+		}
+
+		RawIterator operator++(int)
+		{
+			RawIterator tmp = *this;
+			_pos++;
+			return tmp;
+		}
+
+		value_type operator*() { return _elem; }
+
+		const value_type operator*() const { return _elem; }
+
+	private:
+		value_type _elem;
+		size_t _pos;
+	};
+
+	/* STL standard Begin and End functions.  Used to get
+	 * the beginning and end of the data.  So that RawIterator
+	 * can be used in algorithms like a normal STL iterator.
+	 */
+	template<class Field> typename
+	ZeroOne<Field>::RawIterator ZeroOne<Field>::rawBegin()
+	{
+	       	return RawIterator( 0, _F.init(_tmp, 1) );
+	}
+
+	template<class Field> typename
+	ZeroOne<Field>::RawIterator ZeroOne<Field>::rawEnd()
+	{
+	       	return RawIterator( _nnz, _F.init(_tmp, 1) );
+	}
+
+	template<class Field>
+	const typename ZeroOne<Field>::RawIterator ZeroOne<Field>::rawBegin() const
+	{
+	       	return RawIterator(0, _F.init(_tmp, 1) );
+	}
+
+	template<class Field>
+	const typename ZeroOne<Field>::RawIterator ZeroOne<Field>::rawEnd() const
+	{
+	       	return RawIterator(_nnz, _F.init(_tmp, 1) );
+	}
+
+	/*! RawIndexIterator.
+	 * @ingroup iterators
+	 * Iterates through the i and j of the current element
+	 * and when accessed returns an STL pair containing the coordinates
+	 */
+	template<class Field>
+	class ZeroOne<Field>::RawIndexIterator {
+	public:
+		typedef std::pair<size_t, size_t> value_type;
+
+		RawIndexIterator() {}
+
+		RawIndexIterator(size_t* row, size_t* col):
+			_row(row), _col(col) {}
+
+		RawIndexIterator(const RawIndexIterator &In):
+			_row(In._row), _col(In._col)
+		{}
+
+		const RawIndexIterator &operator=(const RawIndexIterator &rhs)
+		{
+			_row = rhs._row;
+			_col = rhs._col;
+			return *this;
+		}
+
+		bool operator==(const RawIndexIterator &rhs)
+		{
+			return _row == rhs._row && _col == rhs._col;
+		}
+
+		bool operator!=(const RawIndexIterator &rhs)
+		{
+			return _row != rhs._row || _col != rhs._col;
+		}
+
+		const RawIndexIterator& operator++()
+		{
+			++_row; ++_col;
+			return *this;
+		}
+
+		const RawIndexIterator operator++(int)
+		{
+			RawIndexIterator tmp = *this;
+			++_row; ++_col;
+			return tmp;
+		}
+
+		value_type operator*()
+		{
+			return std::pair<size_t,size_t>(*_row, *_col);
+		}
+
+		const value_type operator*() const
+		{
+			return std::pair<size_t,size_t>(*_row, *_col);
+		}
+	private:
+		size_t* _row, *_col;
+	};
+
+	template<class Field> typename
+	ZeroOne<Field>::RawIndexIterator ZeroOne<Field>::indexBegin()
+	{
+		return RawIndexIterator(_rowP, _colP);
+	}
+
+	template<class Field>
+	const typename ZeroOne<Field>::RawIndexIterator ZeroOne<Field>::indexBegin() const
+	{
+		return RawIndexIterator(_rowP, _colP);
+	}
+
+	template<class Field> typename
+	ZeroOne<Field>::RawIndexIterator ZeroOne<Field>::indexEnd()
+	{
+		return RawIndexIterator(_rowP + _nnz, _colP + _nnz);
+	}
+
+	template<class Field>
+	const typename ZeroOne<Field>::RawIndexIterator ZeroOne<Field>::indexEnd() const
+	{
+		return RawIndexIterator(_rowP + _nnz, _colP + _nnz);
+	}
+
+	template<class Field>
+	ZeroOne<Field>::ZeroOne(const Field& F) :
+	       	_F(F)
+       	{
+		srand( time(NULL) );
+		dynamic = false;
+	}
+
+	template<class Field>
+	ZeroOne<Field>::ZeroOne(Field F, Index* rowP, Index* colP, Index rows, Index cols, Index NNz, bool rowSort, bool colSort):
+		_F(F), _rows(rows), _cols(cols), _nnz(NNz), _rowP(rowP), _colP(colP), _rowSort(rowSort), _colSort(colSort) , dynamic(false)
+	{
+	       	srand(time(NULL));
+	}
+
+	template<class Field>
+	ZeroOne<Field>::~ZeroOne()
+	{
+		if(dynamic) {
+			delete [] _rowP;
+			delete [] _colP;
+		}
+	}
+
+	template<class Field>
+	void ZeroOne<Field>::rowSort() const
+	{
+		int mode = 0;
+		if( _rowSort) return;  // Already sorted, we're done
+		else _qsort( (size_t) 0, _nnz, mode);
+		_rowSort = true;
+		return;
+	}
+
+	template<class Field>
+	void ZeroOne<Field>::colSort() const
+	{
+		int mode = 1;
+		if( _colSort) return; // Already sorted, good to go
+		else _qsort( (size_t) 0, _nnz, mode);
+		_colSort = true; _rowSort = false;
+		return;
+	}
+
+	template<class Field>
+	void ZeroOne<Field>::_qsort(size_t p, size_t e, int &mode) const
+	{
+		int i;
+		if( (e - p) <= 1) ;
+		else
+		{
+			i = 1 + _part(p, e, mode);
+			_qsort(p, i, mode);
+			_qsort(i, e, mode);
+		}
+	}
+
+	template<class Field>
+	size_t ZeroOne<Field>::_part(size_t p, size_t e, int &mode) const
+	{
+		size_t rtemp, ctemp, rowval, colval;
+		int i = p + rand() % (e - p), j = e;
+		rtemp = _rowP[p];
+		ctemp = _colP[p];
+		_rowP[p] = _rowP[i];
+		_colP[p] = _colP[i];
 		_rowP[i] = rtemp;
 		_colP[i] = ctemp;
-	      }
-	    else return j;
-	  }
-      }
-    else 
-      { // Col mode, go by col order, then row
-	while(true) 
-	  {
-	    do j--; while( _colP[j] > colval || ( _colP[j] == colval && _rowP[j] > rowval ));
-	    do i++; while( _colP[i] < colval || ( _colP[i] == colval && _rowP[i] < rowval ));
-	    if( i < j) {
-	      rtemp = _rowP[j];
-	      ctemp = _colP[j];
-	      _rowP[j] = _rowP[i];
-	      _colP[j] = _colP[i];
-	      _rowP[i] = rtemp;
-	      _colP[i] = ctemp;
-	    }
-	    else return j;
-	  }
-      }
-  }
-      
-  template<class Field>
-  template<class OutVector, class InVector>
-  OutVector & ZeroOne<Field>::applySpecialization(OutVector & y, const InVector & x, const NormField& n) const
-  {
-    //std::cout<<"Call general case\n";
-    linbox_check((y.size()==rowdim())&&(x.size()==coldim()));         
-    typename OutVector::iterator yp;
-    typename InVector::const_iterator xp;
-    Index* ip, *jp;
-    
-    // 0 out y.  Note, this implementation assumes a dense vector.
-    for(yp = y.begin(); yp != y.end(); ++yp)
-      _F.init(*yp , 0);
-    
-    rowSort();
-    
-    yp=y.begin();
-    xp=x.begin();
-    ip=_rowP;
-    jp=_colP;
-    size_t rowI =0;
-    
-    for(; ip <_rowP+nnz(); ++ip,++jp) 
-      {       
-	if( *ip == rowI)
-	  _F.addin(*yp,*(xp + *jp));
-	else
-	  {
-	    if((*ip-rowI)==1)
-	      ++yp;
-	    else	      
-	      yp=y.begin()+*ip;
-	    
-	    rowI=*ip;
-	    _F.addin(*yp,*(xp + *jp));
-	  }
-      }  
-    return y;
-  }
-  
-   
-  template<class Field>
-  template<class OutVector, class InVector>
-  OutVector & ZeroOne<Field>::applySpecialization(OutVector & y, const InVector & x, const Mod32Field& m) const
-  {
-    //std::cout<<"Called specialization\n";
-    linbox_check((y.size()==rowdim())&&(x.size()==coldim()));
-    
-    typename OutVector::iterator yp;
-    typename InVector::const_iterator xp;
-    Index* ip, *jp;
-        
-    for(yp = y.begin(); yp != y.end(); ++yp)
-      _F.init(*yp , 0);
-    
-    rowSort();
-    
-    yp=y.begin();
-    xp=x.begin();
-    ip=_rowP;
-    jp=_colP;
-    size_t rowI =0;
-    integer _prime;
-
-    _F.characteristic(_prime);
-    
-    uint32 prime = static_cast<uint32>(_prime);
-    
-    uint64 accum =0;
-    
-    for(; ip <_rowP+nnz(); ++ip,++jp) 
-      {       
-	if( *ip == rowI)
-	  accum=accum+*(xp + *jp);
-	else
-	  {
-	    *yp= accum % prime;
-	    if((*ip-rowI)==1)
-	      ++yp;
-	    else	      
-	      yp=y.begin()+*ip;
-	    
-	    rowI=*ip;	    
-	    accum=*(xp+*jp);
-	  }
-      }
-    if(rowI)
-      *yp=accum % prime;
-    
-    return y;
-  }
- 
-  
-  template<class Field>
-  template<class OutVector, class InVector>
-  OutVector & ZeroOne<Field>::applyTransposeSpecialization(OutVector & y, const InVector & x, const NormField& n) const
-  {
-    //std::cout<<"Call general case\n";
-    linbox_check((y.size()==coldim())&&(x.size()==rowdim()));   
-    typename OutVector::iterator yp;
-    typename InVector::const_iterator xp;
-    Index* ip, *jp;
-    
-    // 0 out y.  Note, this implementation assumes a dense vector.
-    for(yp = y.begin(); yp != y.end(); ++yp)
-      _F.init(*yp , 0);
-    
-    rowSort();
-    
-    yp=y.begin();
-    xp=x.begin();
-    ip=_rowP;
-    jp=_colP;
-    size_t rowI =0;
-    
-    for(; ip <_rowP+nnz(); ++ip,++jp) 
-      {       
-	if( *ip == rowI)
-	  _F.addin(*(yp+*jp),*xp);
-	else
-	  {
-	    if((*ip-rowI)==1)
-	      ++xp;
-	    else	      
-	      xp=x.begin()+*ip;
-	    
-	    rowI=*ip;
-	    _F.addin(*(yp+*jp),*xp);
-	  }
-      }	
-  
-    return y;
-  }
-  
-  
-  template<class Field>
-  template<class OutVector, class InVector>
-  OutVector & ZeroOne<Field>::applyTransposeSpecialization(OutVector & y, const InVector & x, const Mod32Field& m) const
-  {
-    //std::cout<<"Called specialization\n";
-    linbox_check((y.size()==coldim())&&(x.size()==rowdim()));
-    
-    std::vector<uint64> y_c (y.size(),0);
-    
-    typename OutVector::iterator yp;
-    typename InVector::const_iterator xp;
-    Index* ip, *jp;      
-    
-    rowSort();
-     
-    xp=x.begin();
-    ip=_rowP;
-    jp=_colP;
-    size_t rowI =0;
-    std::vector<uint64>::iterator y_cp;
-    y_cp=y_c.begin();
-    
-    for(; ip <_rowP+nnz(); ++ip,++jp) 
-      {       
-	if( *ip == rowI)
-	  *(y_cp+*jp) += *xp;
-	else
-	  {
-	    if((*ip-rowI)==1)
-	      ++xp;
-	    else	      
-	      xp=x.begin()+*ip;
-	    
-	    rowI=*ip;	    
-	    *(y_cp+*jp) += *xp;
-	  }
-      }
-    
-    integer _prime;
-    _F.characteristic(_prime);    
-    uint32 prime = static_cast<uint32>(_prime);
-    
-    yp=y.begin();
-    y_cp=y_c.begin();
-    for(;yp!=y.end();++yp,++y_cp)
-      *yp = (*y_cp) % prime;
-    
-    return y;
-  }
-       
+		rowval = _rowP[p];
+		colval = _colP[p];
+		i = p - 1;
+
+		if(mode == 0)
+		{ // Row mode, go by row order, then column
+			while(true)
+			{
+				do j--; while( _rowP[j] > rowval || ( _rowP[j] == rowval && _colP[j] > colval ));
+				do i++; while( _rowP[i] < rowval || ( _rowP[i] == rowval && _colP[i] < colval ));
+				if( i < j)
+				{
+					rtemp = _rowP[j];
+					ctemp = _colP[j];
+					_rowP[j] = _rowP[i];
+					_colP[j] = _colP[i];
+					_rowP[i] = rtemp;
+					_colP[i] = ctemp;
+				}
+				else return j;
+			}
+		}
+		else
+		{ // Col mode, go by col order, then row
+			while(true)
+			{
+				do j--; while( _colP[j] > colval || ( _colP[j] == colval && _rowP[j] > rowval ));
+				do i++; while( _colP[i] < colval || ( _colP[i] == colval && _rowP[i] < rowval ));
+				if( i < j) {
+					rtemp = _rowP[j];
+					ctemp = _colP[j];
+					_rowP[j] = _rowP[i];
+					_colP[j] = _colP[i];
+					_rowP[i] = rtemp;
+					_colP[i] = ctemp;
+				}
+				else return j;
+			}
+		}
+	}
+
+	template<class Field>
+	template<class OutVector, class InVector>
+	OutVector & ZeroOne<Field>::applySpecialization(OutVector & y, const InVector & x, const NormField& n) const
+	{
+		//std::cout<<"Call general case\n";
+		linbox_check((y.size()==rowdim())&&(x.size()==coldim()));
+		typename OutVector::iterator yp;
+		typename InVector::const_iterator xp;
+		Index* ip, *jp;
+
+		// 0 out y.  Note, this implementation assumes a dense vector.
+		for(yp = y.begin(); yp != y.end(); ++yp)
+			_F.init(*yp , 0);
+
+		rowSort();
+
+		yp=y.begin();
+		xp=x.begin();
+		ip=_rowP;
+		jp=_colP;
+		size_t rowI =0;
+
+		for(; ip <_rowP+nnz(); ++ip,++jp)
+		{
+			if( *ip == rowI)
+				_F.addin(*yp,*(xp + *jp));
+			else
+			{
+				if((*ip-rowI)==1)
+					++yp;
+				else
+					yp=y.begin()+*ip;
+
+				rowI=*ip;
+				_F.addin(*yp,*(xp + *jp));
+			}
+		}
+		return y;
+	}
+
+
+	template<class Field>
+	template<class OutVector, class InVector>
+	OutVector & ZeroOne<Field>::applySpecialization(OutVector & y, const InVector & x, const Mod32Field& m) const
+	{
+		//std::cout<<"Called specialization\n";
+		linbox_check((y.size()==rowdim())&&(x.size()==coldim()));
+
+		typename OutVector::iterator yp;
+		typename InVector::const_iterator xp;
+		Index* ip, *jp;
+
+		for(yp = y.begin(); yp != y.end(); ++yp)
+			_F.init(*yp , 0);
+
+		rowSort();
+
+		yp=y.begin();
+		xp=x.begin();
+		ip=_rowP;
+		jp=_colP;
+		size_t rowI =0;
+		integer _prime;
+
+		_F.characteristic(_prime);
+
+		uint32_t prime = static_cast<uint32_t>(_prime);
+
+		uint64_t accum =0;
+
+		for(; ip <_rowP+nnz(); ++ip,++jp)
+		{
+			if( *ip == rowI)
+				accum=accum+*(xp + *jp);
+			else
+			{
+				*yp= accum % prime;
+				if((*ip-rowI)==1)
+					++yp;
+				else
+					yp=y.begin()+*ip;
+
+				rowI=*ip;
+				accum=*(xp+*jp);
+			}
+		}
+		if(rowI)
+			*yp=accum % prime;
+
+		return y;
+	}
+
+
+	template<class Field>
+	template<class OutVector, class InVector>
+	OutVector & ZeroOne<Field>::applyTransposeSpecialization(OutVector & y, const InVector & x, const NormField& n) const
+	{
+		//std::cout<<"Call general case\n";
+		linbox_check((y.size()==coldim())&&(x.size()==rowdim()));
+		typename OutVector::iterator yp;
+		typename InVector::const_iterator xp;
+		Index* ip, *jp;
+
+		// 0 out y.  Note, this implementation assumes a dense vector.
+		for(yp = y.begin(); yp != y.end(); ++yp)
+			_F.init(*yp , 0);
+
+		rowSort();
+
+		yp=y.begin();
+		xp=x.begin();
+		ip=_rowP;
+		jp=_colP;
+		size_t rowI =0;
+
+		for(; ip <_rowP+nnz(); ++ip,++jp)
+		{
+			if( *ip == rowI)
+				_F.addin(*(yp+*jp),*xp);
+			else
+			{
+				if((*ip-rowI)==1)
+					++xp;
+				else
+					xp=x.begin()+*ip;
+
+				rowI=*ip;
+				_F.addin(*(yp+*jp),*xp);
+			}
+		}
+
+		return y;
+	}
+
+
+	template<class Field>
+	template<class OutVector, class InVector>
+	OutVector & ZeroOne<Field>::applyTransposeSpecialization(OutVector & y, const InVector & x, const Mod32Field& m) const
+	{
+		//std::cout<<"Called specialization\n";
+		linbox_check((y.size()==coldim())&&(x.size()==rowdim()));
+
+		std::vector<uint64_t> y_c (y.size(),0);
+
+		typename OutVector::iterator yp;
+		typename InVector::const_iterator xp;
+		Index* ip, *jp;
+
+		rowSort();
+
+		xp=x.begin();
+		ip=_rowP;
+		jp=_colP;
+		size_t rowI =0;
+		std::vector<uint64_t>::iterator y_cp;
+		y_cp=y_c.begin();
+
+		for(; ip <_rowP+nnz(); ++ip,++jp)
+		{
+			if( *ip == rowI)
+				*(y_cp+*jp) += *xp;
+			else
+			{
+				if((*ip-rowI)==1)
+					++xp;
+				else
+					xp=x.begin()+*ip;
+
+				rowI=*ip;
+				*(y_cp+*jp) += *xp;
+			}
+		}
+
+		integer _prime;
+		_F.characteristic(_prime);
+		uint32_t prime = static_cast<uint32_t>(_prime);
+
+		yp=y.begin();
+		y_cp=y_c.begin();
+		for(;yp!=y.end();++yp,++y_cp)
+			*yp = (*y_cp) % prime;
+
+		return y;
+	}
+
 }//End of LinBox
+
+#endif // __LINBOX_bb_zero_one_INL
diff --git a/linbox/blackbox/zo-gf2.h b/linbox/blackbox/zo-gf2.h
new file mode 100644
index 0000000..98b3fb9
--- /dev/null
+++ b/linbox/blackbox/zo-gf2.h
@@ -0,0 +1,163 @@
+/* -*- 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
+/* linbox/blackbox/zo-gf2.h
+ * Copyright (C) 2009,2010 The LinBox group
+ *
+ * Time-stamp: <23 Jun 10 16:02:02 Jean-Guillaume.Dumas at imag.fr>
+ *
+ * See COPYING for license information.
+ *
+ */
+#ifndef __LINBOX_zo_gf2_H
+#define __LINBOX_zo_gf2_H
+
+#include <algorithm>
+#include "linbox/blackbox/zero-one.h"
+#include "linbox/field/gf2.h"
+#include "linbox/field/unparametric.h"
+#include "linbox/util/matrix-stream.h"
+#include "linbox/vector/stream.h"
+#include "linbox/matrix/sparse.h"
+#include "linbox/vector/light_container.h"
+
+namespace LinBox
+{
+
+	/** \brief Time and space efficient representation of sparse matrices over GF2.
+	 * Representation if a full row array containing vector of non-zero locations
+	 * A 0-1 matrix is a matrix with all 0's and 1's as entries.
+	 \ingroup blackbox
+	 */
+	template<>
+	struct ZeroOne<GF2> : public LightContainer< LightContainer< size_t > >
+	{
+		typedef LightContainer< LightContainer< size_t > > Father_t;
+		typedef LightContainer< size_t > Row_t;
+		typedef GF2::Element Element;
+		typedef size_t Index;
+		typedef ZeroOne<GF2> Self_t;
+		typedef GF2 Field;
+
+		const GF2 _F;
+
+		ZeroOne(const GF2& ) :
+			_nnz(0)
+		{}
+		ZeroOne(const GF2& , const size_t m) :
+			Father_t(m), _rowdim(m), _coldim(m),_nnz(0)
+		{}
+		ZeroOne(const GF2& , const size_t m, const size_t n) :
+			Father_t(m), _rowdim(m), _coldim(n),_nnz(0)
+		{}
+
+		ZeroOne():
+			_nnz(0)
+		{}
+		ZeroOne(const size_t m) :
+			Father_t(m), _rowdim(m), _coldim(m),_nnz(0)
+		{}
+		ZeroOne(const size_t m, const size_t n) :
+			Father_t(m), _rowdim(m), _coldim(n),_nnz(0)
+		{}
+
+		ZeroOne(const GF2& , VectorStream<Row_t>& stream) :
+			Father_t(stream.m()), _rowdim(stream.m()), _coldim(stream.n()), _nnz(0)
+		{
+			for (Father_t::iterator row=begin(); row != end(); ++row) {
+				stream >> *row;
+				_nnz += row->size();
+			}
+		}
+
+		ZeroOne(const Self_t& A) :
+			Father_t(static_cast<const Father_t&>(A)), _rowdim(A._rowdim), _coldim(A._coldim), _nnz(A._nnz)
+		{ }
+
+		ZeroOne(const GF2& , size_t* rowP, size_t* colP, const size_t m, const size_t n, const size_t nnz, const bool ,const bool) :
+			Father_t(m), _rowdim(m), _coldim(n), _nnz(nnz)
+		{
+			for(size_t k=0; k<nnz; ++k)
+				this->operator[](rowP[k]).push_back(colP[k]);
+		}
+
+
+		size_t rowdim() const { return _rowdim; }
+		size_t coldim() const { return _coldim; }
+
+
+		void setEntry(size_t i, size_t j, const Element& v) ;
+		const Element& getEntry(size_t i, size_t j) const ;
+		Element& getEntry(Element&, size_t i, size_t j) const ;
+
+		template<class OutVector, class InVector>
+		OutVector& apply(OutVector& y, const InVector& x) const; // y = A x
+
+		template<class OutVector, class InVector>
+		OutVector& applyTranspose(OutVector& y, const InVector& x) const; // y = A^T x
+
+		/** Read the matrix from a stream in ANY format
+		 *  entries are read as "long int" and set to 1 if they are odd,
+		 *  0 otherwise
+		 *  @param is Input stream from which to read the matrix
+		 *  @return Reference to input stream
+		 */
+		std::istream &read (std::istream &is) ;
+		std::ostream& write (std::ostream& out, FileFormatTag format=FORMAT_GUILLAUME) const ;
+
+		const Field& field() const { return _F; }
+
+		template<typename _Tp1>
+		struct rebind {
+			typedef ZeroOne<_Tp1> other;
+			void operator() (other & Ap,
+					 const Self_t& A,
+					 const _Tp1& F)
+			{
+				// ZeroOne does not store any Field element
+			}
+		};
+
+
+		template<typename _Tp1>
+		ZeroOne(ZeroOne<_Tp1>& A, const GF2 F2) :
+			Father_t(A.rowdim()), _rowdim(A.rowdim()), _coldim(A.coldim()), _nnz(0)
+		{
+			for(typename ZeroOne<_Tp1>::RawIndexIterator it = A.indexBegin();
+			    it != A.indexEnd(); ++it,++_nnz) {
+				this->operator[]( it->first ).push_back( it->second );
+			}
+		}
+
+		size_t nnz() const { return _nnz; }
+		bool isRowSorted() const { return true; }
+		bool isColSorted() const { return true; }
+
+		/** RawIterator class.  Iterates straight through the values of the matrix
+		*/
+		class RawIterator;
+
+		RawIterator rawBegin();
+		RawIterator rawEnd();
+		const RawIterator rawBegin() const;
+		const RawIterator rawEnd() const;
+
+		/** RawIndexIterator - Iterates through the i and j of the current element
+		 * and when accessed returns an STL pair containing the coordinates
+		 */
+		class RawIndexIterator;
+		RawIndexIterator indexBegin();
+		const RawIndexIterator indexBegin() const;
+		RawIndexIterator indexEnd();
+		const RawIndexIterator indexEnd() const;
+
+
+	private:
+		size_t _rowdim, _coldim, _nnz;
+	};
+
+}
+
+#include "linbox/blackbox/zo-gf2.inl"
+
+#endif //__LINBOX_zo_gf2_H
+
diff --git a/linbox/blackbox/zo-gf2.inl b/linbox/blackbox/zo-gf2.inl
new file mode 100644
index 0000000..18289e7
--- /dev/null
+++ b/linbox/blackbox/zo-gf2.inl
@@ -0,0 +1,406 @@
+/* -*- 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
+/* Copyright (C) LinBox
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*! @file blackbox/zo-gf2.inl
+ * @ingroup blackbox
+ * @brief NO DOC
+ */
+
+#ifndef __LINBOX_zo_gf2_INL
+#define __LINBOX_zo_gf2_INL
+
+#include <givaro/givintfactor.h>
+
+namespace LinBox
+{
+	// Dot product structure enabling std::transform call
+	template<class Blackbox, class InVector>
+	struct dotp {
+		const typename Blackbox::Field& _F;
+		const InVector& _x;
+		dotp(const typename Blackbox::Field& F, const InVector& x) :
+			_F(F), _x(x)
+		{}
+
+		bool operator()(const typename Blackbox::Row_t& row) const
+		{
+			bool tmp(false);
+			for(typename Blackbox::Row_t::const_iterator loc = row.begin(); loc != row.end(); ++loc) {
+				_F.addin(tmp,_x[*loc]);
+			}
+			return tmp;
+		}
+	};
+
+#include <algorithm>
+	template<class OutVector, class InVector>
+	inline OutVector & ZeroOne<GF2>::apply(OutVector & y, const InVector & x) const
+	{
+		dotp<Self_t,InVector> mydp(this->_F, x);
+		std::transform(this->begin(), this->end(), y.begin(), mydp );
+		return y;
+	}
+
+#if 0
+	template<class OutVector, class InVector>
+	inline OutVector & ZeroOne<GF2>::apply(OutVector & y, const InVector & x) const
+	{
+		typename OutVector::iterator yit = y.begin();
+		Self_t::const_iterator row = this->begin();
+		for( ; row != this->end(); ++yit, ++row) {
+			bool tmp(false);
+			for(Row_t::const_iterator loc = row->begin();loc != row->end(); ++loc)
+				_F.addin(tmp,x[*loc]);
+			*yit = tmp;
+		}
+		return y;
+	}
+#endif
+
+	template<class OutVector, class InVector>
+	inline OutVector & ZeroOne<GF2>::applyTranspose(OutVector & y, const InVector & x) const
+	{
+		std::fill(y.begin(),y.end(),false);
+		typename InVector::const_iterator xit = x.begin();
+		Self_t::const_iterator row = this->begin();
+		for( ; row != this->end(); ++row, ++xit) {
+			for(typename Self_t::Row_t::const_iterator loc = row->begin(); loc != row->end(); ++loc) {
+				_F.addin(y[*loc],*xit);
+			}
+		}
+		return y;
+	}
+
+
+	inline void ZeroOne<GF2>::setEntry(size_t i, size_t j, const Element& v) {
+		Row_t& rowi = this->operator[](i);
+		Row_t::iterator there = std::lower_bound(rowi.begin(), rowi.end(), j);
+		if (! _F.isZero(v) ) {
+			if ( (there == rowi.end() ) || (*there != j) ) {
+				rowi.insert(there, j);
+				++_nnz;
+			}
+		}
+		else {
+			if ( (there != rowi.end() ) && (*there == j) ) {
+				rowi.erase(there);
+				--_nnz;
+			}
+		}
+	}
+
+	inline ZeroOne<GF2>::Element& ZeroOne<GF2>::getEntry(Element& r, size_t i, size_t j) const
+	{
+		const Row_t& rowi = this->operator[](i);
+		Row_t::const_iterator there = std::lower_bound(rowi.begin(), rowi.end(), j);
+		if (there != rowi.end() )
+			return r=*there;
+		else
+			return r=_F.zero;
+	}
+
+	inline const ZeroOne<GF2>::Element& ZeroOne<GF2>::getEntry(size_t i, size_t j) const
+	{
+		const Row_t& rowi = this->operator[](i);
+		Row_t::const_iterator there = std::lower_bound(rowi.begin(), rowi.end(), j);
+		if (there != rowi.end() )
+			return reinterpret_cast<const ZeroOne<GF2>::Element&>(*there);
+		else
+			return _F.zero;
+	}
+
+	inline std::istream &ZeroOne<GF2>::read (std::istream &is) {
+		// Reads a long int and take it mod 2 afterwards (v&1)
+		UnparametricField<long> Ints;
+		MatrixStream<UnparametricField<long> > S(Ints, is);
+		S.getDimensions( _rowdim, _coldim );
+		this->resize(_rowdim);
+		Index r, c;
+		long v;
+		_nnz = 0;
+		while( S.nextTriple(r, c, v) ) {
+			if (v&1) {
+				this->operator[](r).push_back(c);
+				++_nnz;
+			}
+		}
+		for(Father_t::iterator i=this->begin(); i!=this->end(); ++i)
+			std::sort(i->begin(),i->end());
+		return is;
+	}
+
+	inline std::ostream& ZeroOne<GF2>::write (std::ostream& out, FileFormatTag format) const
+	{
+		if (format == FORMAT_GUILLAUME) {
+			out << _rowdim << ' ' << _coldim << " M\n";
+			for(size_t i=0; i<_rowdim; ++i) {
+				const Row_t& rowi = this->operator[](i);
+				for(Row_t::const_iterator it=rowi.begin(); it != rowi.end(); ++it)
+					out << (i+1) << ' ' << (*it+1) << " 1\n";
+			}
+			return out << "0 0 0" << std::endl;
+		}
+		else if (format == FORMAT_MAPLE) {
+			out << '[';
+			bool firstrow=true;
+			for (const_iterator i = begin (); i != end (); ++i) {
+				if (firstrow) {
+					out << '[';
+					firstrow =false;
+				}
+				else
+					out << ", [";
+
+				Row_t::const_iterator j = i->begin ();
+				for (long j_idx = 0; j_idx < static_cast<long>(_coldim); j_idx++) {
+					if (j == i->end () || j_idx != static_cast<long>(*j) )
+						out << '0';
+					else {
+						out << '1';
+						++j;
+					}
+					if (j_idx < (static_cast<long>(_coldim)-1) )
+						out << ',';
+				}
+
+				out << ']';
+			}
+			return out << ']';
+		}
+		else
+			return out << "ZeroOne over GF(2), format other than SMS or Maple not implemented" << std::endl;
+	}
+
+	/*! Raw iterator.
+	 * @ingroup iterators
+	 */
+	class ZeroOne<GF2>::RawIterator {
+	public:
+		typedef Element value_type;
+
+		RawIterator(size_t pos, Element elem) :
+			_elem(elem),_pos(pos)
+		{}
+
+		RawIterator(const RawIterator &In) :
+			_elem(In._elem),_pos(In._pos)
+		{}
+
+		const RawIterator& operator=(const RawIterator& rhs)
+		{
+			_pos = rhs._pos;
+			_elem = rhs._elem;
+			return *this;
+		}
+
+
+		bool operator==(const RawIterator &rhs)
+		{
+			return ( _pos == rhs._pos && _elem == rhs._elem);
+		}
+
+		bool operator!=(const RawIterator &rhs)
+		{
+			return ( _pos != rhs._pos || _elem != rhs._elem );
+		}
+
+		RawIterator & operator++()
+		{
+			++_pos;
+			return *this;
+		}
+
+		RawIterator operator++(int)
+		{
+			RawIterator tmp = *this;
+			_pos++;
+			return tmp;
+		}
+
+		value_type operator*() { return _elem; }
+
+		value_type operator*() const
+		{
+		       	return _elem;
+		}
+
+	private:
+		value_type _elem;
+		size_t _pos;
+	};
+
+	/* STL standard Begin and End functions.  Used to get
+	 * the beginning and end of the data.  So that RawIterator
+	 * can be used in algorithms like a normal STL iterator.
+	 */
+	inline ZeroOne<GF2>::RawIterator ZeroOne<GF2>::rawBegin()
+	{
+		return RawIterator( 0, _F.one );
+	}
+
+	inline ZeroOne<GF2>::RawIterator ZeroOne<GF2>::rawEnd()
+	{
+		return RawIterator( _nnz, _F.one );
+	}
+
+	inline const ZeroOne<GF2>::RawIterator ZeroOne<GF2>::rawBegin() const
+	{
+		return RawIterator(0, _F.one );
+	}
+
+	inline const ZeroOne<GF2>::RawIterator ZeroOne<GF2>::rawEnd() const
+	{
+		return RawIterator(_nnz, _F.one );
+	}
+
+	/*! RawIndexIterator.
+	 * @ingroup iterators
+	 * Iterates through the i and j of the current element
+	 * and when accessed returns an STL pair containing the coordinates
+	 */
+	class ZeroOne<GF2>::RawIndexIterator {
+	public:
+		typedef std::pair<size_t, size_t> value_type;
+
+		RawIndexIterator() {}
+
+		RawIndexIterator(size_t rowidx,
+				 LightContainer<LightContainer<size_t> >::const_iterator rowbeg,
+				 LightContainer<LightContainer<size_t> >::const_iterator rowend,
+				 size_t colidx,
+				 LightContainer<size_t>::const_iterator colbeg) :
+			_rowbeg( LightContainer<LightContainer<size_t> >::iterator(rowbeg) ),
+			_rowend( LightContainer<LightContainer<size_t> >::iterator(rowend) ),
+			_colbeg( LightContainer<size_t>::iterator(colbeg) ),
+			_row(rowidx),
+			_col(colidx)
+		{
+
+			if( _rowbeg == _rowend ) return;
+
+			while ( _colbeg == _rowbeg->end() ) {
+
+				if (++_rowbeg == _rowend) return;
+
+				_colbeg = _rowbeg->begin();
+
+			}
+
+		}
+
+		RawIndexIterator(const RawIndexIterator &In) :
+			_rowbeg(In._rowbeg), _rowend(In._rowend), _colbeg(In._colbeg), _row(In._row), _col(In._col)
+		{}
+
+		const RawIndexIterator &operator=(const RawIndexIterator &rhs)
+		{
+			_rowbeg = rhs._rowbeg;
+			_rowend = rhs._rowend;
+			_colbeg = rhs._colbeg;
+			_row = rhs._row;
+			_col = rhs._col;
+			return *this;
+		}
+
+		bool operator==(const RawIndexIterator &rhs)
+		{
+			return _rowbeg == rhs._rowbeg && _colbeg == rhs._colbeg;
+		}
+
+		bool operator!=(const RawIndexIterator &rhs)
+		{
+			return _rowbeg != rhs._rowbeg || _colbeg != rhs._colbeg;
+		}
+
+		const RawIndexIterator& operator++() {
+
+
+
+			++_colbeg;
+			while(_colbeg == _rowbeg->end()) {
+				if (++_rowbeg == _rowend) return *this;
+				++_row;
+				_colbeg = _rowbeg->begin();
+			}
+			_col = *_colbeg;
+
+
+			return *this;
+		}
+
+		const RawIndexIterator operator++(int)
+		{
+			RawIndexIterator tmp = *this;
+			this->operator++();
+			return tmp;
+		}
+
+		value_type operator*()
+		{
+			return std::pair<size_t,size_t>(_row, _col);
+		}
+
+		const value_type operator*() const
+		{
+			return std::pair<size_t,size_t>(_row, _col);
+		}
+	private:
+		LightContainer<LightContainer<size_t> >::iterator _rowbeg, _rowend;
+		LightContainer<size_t>::iterator _colbeg;
+		size_t _row, _col;
+	};
+
+	inline ZeroOne<GF2>::RawIndexIterator ZeroOne<GF2>::indexBegin()
+	{
+		return RawIndexIterator(0, this->begin(), this->end(), 0, this->front().begin() );
+	}
+
+	inline const ZeroOne<GF2>::RawIndexIterator ZeroOne<GF2>::indexBegin() const
+	{
+		return RawIndexIterator(0, this->begin(), this->end(), 0, this->front().begin() );
+	}
+
+	inline ZeroOne<GF2>::RawIndexIterator ZeroOne<GF2>::indexEnd()
+	{
+		return RawIndexIterator(_rowdim, this->end(), this->end(), this->back().size(),this->back().end() );
+	}
+
+	inline const ZeroOne<GF2>::RawIndexIterator ZeroOne<GF2>::indexEnd() const
+	{
+		return RawIndexIterator(_rowdim, this->end(), this->end(), this->back().size(),this->back().end() );
+	}
+
+
+
+
+
+}; // end of namespace LinBox
+
+
+// Specialization of getentry
+#include "linbox/solutions/getentry.h"
+namespace LinBox
+{
+	template<> struct GetEntryCategory<ZeroOne<GF2> > { typedef GetEntryTags::Local Tag; };
+	} // end of namespace LinBox
+
+#endif //__LINBOX_zo_gf2_INL
diff --git a/linbox/blackbox/zo.h b/linbox/blackbox/zo.h
new file mode 100644
index 0000000..e1cfef1
--- /dev/null
+++ b/linbox/blackbox/zo.h
@@ -0,0 +1,384 @@
+/* -*- 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
+/* linbox/blackbox/zo.h
+ * Copyright (c) LinBox
+ * by Hui Wang, assisted by bds
+ * ------------------------------------
+ * See COPYING for license information.
+ */
+
+#ifndef __LINBOX_zero_one_H
+#define __LINBOX_zero_one_H
+
+/*! @file blackbox/zo.h
+ * We define a blackbox class of the same name as that in zero-one.h,
+ * hence we use the same name here.
+ * @warning The two cannot be used in the same prog.
+ */
+
+
+#include "linbox/integer.h"
+//#include "linbox/vector/vector-traits.h"
+#include "linbox/util/debug.h"
+#include "linbox/util/matrix-stream.h"
+#include "linbox/field/modular.h"
+#include <linbox/blackbox/blackbox-interface.h>
+#include <linbox/blackbox/quad-matrix.h>
+
+// For STL pair in RawIndexIterator
+#include <utility>
+#include <iterator>
+#include <vector> // For vectors in _col2row and _row2col
+#include <cstdlib> // For randomness in randomized quicksort
+#include <ctime>
+
+namespace LinBox
+{
+	bool revLexLess(const std::pair<size_t,size_t>& a, const std::pair<size_t,size_t> b)
+	{ return a.second < b.second || (b.second == a.second && a.first < b.first); }
+
+	/** \brief Time and space efficient representation of sparse {0,1}-matrices.
+	 *
+	 * A 0-1 matrix is a matrix with all 0's and 1's as entries.
+	 * We're using a comp-col or comp-row format.  That is we have an array of col indices and an array of pointers indicating where the col indices for each row begins within the col index array.  (or vice versa if we have sorted by columns.
+	 *
+	 * Applies can be performed fast, using only additions.
+	 * When initalizing this class, you only need to build 2 arrays of equal length:
+	 * an array of the row indices for the non-zero (1's) entries, and an array of the column
+	 * indices for the non-zero (1's) entries.
+
+	 A {0, 1,-1} matrix can be effecively represented as the \ref Dif of two ZeroOne's.
+	 \ingroup blackbox
+	 */
+
+	template<class _Field>
+	class ZeroOne : public BlackboxInterface {
+	public:
+		//friend class ZOQuad;
+
+		typedef size_t Index;
+		typedef ZeroOne<_Field> Self_t;
+		typedef _Field Field;
+		typedef typename _Field::Element Element;
+		typedef std::vector<Index> IndexVector;
+		typedef std::vector<IndexVector::iterator> PointerVector;
+		//to denote by which way we sort our matrix
+		enum howToSort { sortedByRow, sortedByCol }; //( true / false )
+
+		// DEFAULT CONSTRUCTOR, do nothing. Matrix will be uninitialized.
+		ZeroOne(){};
+
+		// basic constructor, can be used with subsequent read.
+		ZeroOne(const Field& F) :
+		       	_F(F), sorted(true)
+		{}
+
+		// constructor for use by ZOQuad.  Needs work.
+		ZeroOne
+		(const Field& F, IndexVector& index, PointerVector& indexP, Index rowdim, Index coldim, bool sortedBy) :
+			_F(F), _index(index), _indexP(indexP), _rowdim(rowdim), _coldim(coldim), sorted(sortedBy)
+		{
+			ptrdiff_t diff = _index.begin() - index.begin();
+			for (size_t i = 0; i < _indexP.size(); ++i)
+				_indexP[i] += diff;
+
+			/*
+			   _indexP.push_back( _index.begin() );
+			   IndexVector::iterator i = _index.begin();
+			   PointerVector::iterator j = indexP.begin();
+			   for( ++j; j < indexP.end(); ++j )
+			   {
+			   _indexP.push_back( i + ( *j - *(j-1) ) );
+			   i = _indexP.back();
+			   }
+			   */
+		}
+
+		/** The real constructor /todo give docs here
+		  assuming entries are sorted in lexicographic order by (row,col) pair.
+		  */
+		ZeroOne
+		(Field& F, Index* rowP, Index* colP, Index rows, Index cols, Index NNz) :
+			_F(F), _rowdim(rows), _coldim(cols), sorted(true)
+		{
+			std::vector<std::pair<Index, Index> > indexPairs;
+			for (Index i = 0; i < NNz; ++i, ++rowP, ++colP)
+				indexPairs.push_back(std::pair<Index,Index>(static_cast<Index>(*rowP), static_cast<Index>(*colP)));
+			init(indexPairs);
+		}
+		ZeroOne(const ZeroOne<Field>& A) :
+			// better keep the commented out statements below for later debugging  
+			_F(A._F), _index(A._index), _rowdim(A._rowdim), _coldim(A._coldim), sorted(A.sorted)
+		{
+#if 0
+			std::cout << " copy constructor of zero-one matrix: A.rowdim = "  << A._rowdim << " A.coldim = " << A._coldim << std::endl;
+			ZeroOne(A._F, A._index, A._indexP, A._rowdim, A._coldim, A.sorted);
+			std::cout << " copy constructor of zero-one matrix: rowdim = " << _rowdim << " coldim = " << _coldim << std::endl;
+#endif
+			_indexP.push_back( _index.begin() );
+			IndexVector::iterator i = _index.begin();
+			PointerVector::iterator j = A._indexP.begin();
+			for( ++j; j < A._indexP.end(); ++j )
+			{
+				//std::cout << *j - *(j-1) << std::endl;
+				_indexP.push_back( i + ( *j - *(j-1) ) );
+#if 0
+				std::cout << " stupid test here " << (*_indexP.begin()) - _index.begin() << std::endl;
+				std::cout << " the size of _indexP now is " << _indexP.size() << std::endl;
+#endif
+				i = _indexP.back();
+#if 0
+				std::cout << " the last element points to the position " << _indexP.back() - *_indexP.begin() << std::endl;
+#endif
+			}
+#if 0
+			_indexP.push_back(_index.end());
+			std::cout << &_index << " ";
+			std::cout << &(*_index.begin()) << std::endl;
+			std::cout << std::endl;
+#endif
+		}
+
+		//switching the way in which the matrix is sorted
+		void switch_sort() const
+		{
+			//std::cout << " -- switch_sort: " << std::endl;
+			Index dim;
+
+			if( sorted ) dim = _coldim;
+			else dim = _rowdim;
+
+			//std::cout << " -- in switch sort, before allocating temp -- " << std::endl;
+			std::vector< IndexVector > temp(dim);
+			//std::cout << temp.size() << std::endl;
+			//IndexVector temp[dim]; //maybe this needs toooooo much memory space when dim is very large
+			//std::cout << " -- in switch sort, after allocating temp -- " << std::endl;
+
+			for( PointerVector::iterator i = _indexP.begin(); i < _indexP.end() - 1; ++i )
+				for( IndexVector::iterator j = *i; j != *(i+1); ++j )
+					temp[*j].push_back( (Index)(i - _indexP.begin()) );
+
+			_index.clear(); _indexP.clear();
+			std::back_insert_iterator < std::vector<Index> > colend( _index) ;
+			for( size_t k = 0; k < dim; ++k )
+			{
+				_indexP.push_back( _index.end() );
+				copy( temp[k].begin(), temp[k].end(), colend );
+			}
+
+			_indexP.push_back( _index.end() );
+			sorted = !sorted;
+
+			return;
+		}
+
+	protected:
+
+		void init(std::vector<std::pair<Index, Index> >& ip)
+		{
+			Index NNz = ip.size();
+			sort(ip.begin(), ip.end());
+
+			// set up _index
+			for (Index i = 0; i < NNz; ++i)
+				_index.push_back(ip[i].second);
+
+			// set up _indexP
+			IndexVector::iterator p = _index.begin(); //how about if the first row of the matrix is empty
+			_indexP.push_back(p);                     //we haven't met this case up to now
+
+			std::vector<std::pair<Index, Index> >::iterator q = ip.begin();
+			Index i = q->first;
+			p++;q++; //start from the second place
+
+			for (; q != ip.end(); ++q, ++p)
+				if (i != q->first)
+				{
+					//for (Index j = i; j < (q+1)->first; j++)//difference may be more than 1
+					for (Index j = i; j < q->first; j++)//difference may be more than 1
+						_indexP.push_back(p);
+					i = q->first; //we should change i after the for loop, otherwise the
+					//for loop will not run at all
+				}
+			_indexP.push_back(_index.end());
+
+			/* keep another copy is not needed if we can switch sort between row and col
+			// sort by cols first, then do the same as above
+			sort(ip.begin(), ip.end(), revLexLess);
+
+			// set up _row
+			for (Index i = 0; i < NNz; ++i)
+			_row.push_back(ip[i].first);
+
+			// set up _colP
+			p = _row.begin();
+			_colP.push_back(p);
+
+			q =ip.begin();
+			i = q->second;
+			p++;q++;
+
+			for ( ; q != ip.end(); ++q, ++p)
+			if (i != q->second)
+			{
+			for (Index j = i; j < (q+1)->second; j++)
+			_colP.push_back(p);
+			i = q->second;
+			}
+			_colP.push_back(_row.end());
+			*/
+
+		}
+	public:
+
+		// Destructor, once again do nothing
+		~ZeroOne(){};
+
+		/** \brief
+		 *
+		 * Uses one of the three
+		 * private utility functions. It calls the generalized utility function
+		 * _apply if there is no special ordering, _fyapply if there is C_ordering
+		 * or _fxapply if there is fortran_ordering
+		 */
+		template<class OutVector, class InVector>
+		OutVector& apply(OutVector& y, const InVector& x) const; // y = Ax;
+		//OutVector& apply(OutVector& y, const InVector& x); // y = Ax;
+
+		/** \brief
+		 *
+		 * Uses one of the three
+		 * private utility functions, in the manner described above.  Worthy of
+		 * note is the fact that applyTranspose works by passing the column
+		 * positions to the _apply functions as if they were rows, and row positions
+		 * as if they were columns, as if the matrix had been transposed.
+		 */
+
+		template<class OutVector, class InVector>
+		OutVector& applyTranspose(OutVector& y, const InVector& x) const; // y = ATx
+		//OutVector& applyTranspose(OutVector& y, const InVector& x); // y = ATx
+
+		size_t rowdim() const
+		{ return _rowdim; }
+
+		size_t coldim() const
+		{ return _coldim; }
+
+
+		template<typename _Tp1>
+		struct rebind
+		{
+			typedef ZeroOne<_Tp1> other;
+			void operator() (other *& Ap,
+					 const Self_t& A,
+					 const _Tp1& F) {
+				Ap = new other(F, A._index, A._indexP, A._rowdim, A._coldim, A.sorted);
+			}
+		};
+
+		/** Read the matrix from a stream in the JGD's SMS format
+		 *  @param is Input stream from which to read the matrix
+		 *  @return Reference to input stream
+		 */
+		std::istream &read (std::istream &is)
+		{
+			std::vector<std::pair<Index, Index> > indexPairs;
+			Index r, c;
+			Element v;
+			MatrixStream<Field> S(_F, is);
+			long count = 0;
+
+			// /*
+			S.getDimensions( _rowdim, _coldim );
+			std::cout << " -- read: row dimension is " << _rowdim << " and column dimension is " <<_coldim << std::endl;
+			while (S.nextTriple(r, c, v) )
+			{
+				indexPairs.push_back(std::pair<Index,Index>(static_cast<Index>(r), static_cast<Index>(c)));
+				++count;
+			}
+			/*
+			   char v0;
+			   is >> _rowdim >> _coldim >> v0;
+			   std::cout << " -- read: row dimension is " << _rowdim << " and column dimension is " <<_coldim << std::endl;
+			   while (is >> r >> c >> v)
+			   {
+			   if ( r == 0 && c == 0 && v == 0 ) {std::cout << " -- read: reach the end" << std::endl;break;}
+			   indexPairs.push_back(std::pair<Index,Index>(static_cast<Index>(r), static_cast<Index>(c)));
+			   ++count;
+			   }
+			   */
+			std::cout << " -- read: " << count << std::endl;
+
+			//S.getRows(_rowdim); S.getColumns(_coldim);
+			init(indexPairs);
+			return is;
+		}
+		std::ostream& write(std::ostream& out =  std::cout) const
+		{
+			out << "ZeroOne Matrix: _index.size() " << _index.size();
+			out << ", _indexP.size() " << _indexP.size();
+			out << ", _rowdim " << _rowdim;
+			out << ", _coldim " << _coldim;
+			return out;
+		}
+
+		const Field& field() const
+		{ return _F; }
+
+		/* Non blackbox function.  Tells the number of nonzero entries
+		*/
+		size_t nnz() const
+		{ return _index.size(); };
+
+
+		typedef MatrixCategories::BlackboxTag MatrixCategory;
+
+	protected:
+
+		Field _F; // The field used by this class
+
+		/* _indexP is a pointer to an array of row indexes.  _colP is a pointer
+		 * to an array of column indexes. These two are the other arrays of a
+		 * NAGSparse format Matrix.  _rowdim and _coldim are the number of rows and
+		 * columns of the Matrix if it were in dense format.  _nnz is the Number of
+		 * Non-Zero elements in the Matrix.  It also happens to be the length of
+		 * the three NAGSparse arrays.
+		 *
+		 * Note: I changed their names since now how the matrix is sorted is
+		 * decided by the member "sorted" of type howToSort and we no longer
+		 * keep two copies of zo matrix by having (_col, _rowP) and (_row, _colP)
+		 *
+		 * _index stores the real row or column index, and _indexP always points to
+		 * some position in _index which is the beginning or a row or a column, row
+		 * or column depending on how the matrix is sorted
+		 *
+		 *
+		 */
+	public: //temporarily
+		mutable IndexVector _index; // The nnz indices sorted by row or by col
+		mutable PointerVector _indexP; // the pointers to beginning of each row if sorted by row
+		// and to beginning of each col if sorted by col
+
+		//IndexVector _col; // The nnz column indices
+		//PointerVector _rowP; // the _rowdim+1 pointers to beginning of row in _col
+
+		/* Keep another copy of the Matrix for applyTranspose */
+		//IndexVector _row; // The nnz row indices
+		//PointerVector _colP; // the _coldim+1 pointers to beginning of col in _row
+
+		Index _rowdim, _coldim;
+		mutable bool sorted;
+
+	}; //ZeroOne
+
+
+}//End of LinBox
+
+#ifdef _RUNOPENMP
+#include "zoi.inl"
+#else
+#include "zo.inl"
+#endif
+
+#endif // __LINBOX_zero_one_H
+
diff --git a/linbox/blackbox/zo.inl b/linbox/blackbox/zo.inl
new file mode 100644
index 0000000..690d61f
--- /dev/null
+++ b/linbox/blackbox/zo.inl
@@ -0,0 +1,185 @@
+/* -*- 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++; style: linux -*- */
+
+/* linbox/blackbox/nag-sparse.h
+ * Copyright (C) 2002 Rich Seagraves
+ *
+ * Written by Rich Seagraves <seagrave at cis.udel.edu>
+ * Modified by Zhendong Wan, -bds
+ * ------------------------------------
+ *
+ * See COPYING for license information.
+ */
+
+namespace LinBox
+{
+
+	/*
+	// for GF(3^10), apply to packvec will do adds with periodic normalizations
+	template<>
+	template<Field>
+	Packvec<typename Field::Accumulator>& ZeroOne<Field>::apply<Packvec<typename Field::Accumulator>, Packvec<typename Field::Accumulator> >
+	(Pacvec<typename Field::Accumulator>& y,
+	Pacvec<typename Field::Accumulator>& x)
+	{	return y; }
+
+	// more stuff for paley graphs
+	template<class OutVector, class InVector>
+	template<>
+	OutVector & ZeroOne<Special3_10Field>::apply(OutVector & y, const InVector & x) const
+	{
+	typedef Special3_10Field Field;
+	typedef typename Packvec<Field::Accumulator> Vector;
+	Vector xx, yy;
+	field().convert(xx, x);
+	apply(yy, xx);
+	field().convert(y, yy);
+	}
+	*/
+
+	template<class Field>
+	template<class OutVector, class InVector>
+	OutVector & ZeroOne<Field>::apply(OutVector & y, const InVector & x) const
+	//OutVector & ZeroOne<Field>::apply(OutVector & y, const InVector & x)
+	{
+
+		//std::cout << endl;
+		//std::cout << " new apply pass " << endl;
+		//std::cout << this->rowdim() << " " << this->coldim() << endl;
+		//std::cout << " inside apply " << endl;
+		//std::cout << x.size() << " " << y.size() << endl;
+
+		linbox_check((y.size()==rowdim())&&(x.size()==coldim()));
+
+		FieldAXPY<Field> accum (_F);
+
+		typename OutVector::iterator yp;
+		typename InVector::const_iterator xp;
+		PointerVector::const_iterator ip;
+		IndexVector::const_iterator jp;
+
+
+		//std::cout << " before sorting " << endl;
+
+		if( !sorted )
+		{
+			//std::cout << " -- apply: switch sort (" << _rowdim << ", " << _coldim << ", " << nnz() << ", " << sorted << " " << &(this->sorted) << ") -- " << std::endl;
+			switch_sort();
+			//std::cout << " -- apply: switch sort (" << _rowdim << ", " << _coldim << ", " << nnz() << ", " << sorted << ") -- " << std::endl;
+		}
+		//std::cout << " -- zo apply: " << this << "(" << _rowdim << ", " << _coldim << ", " << nnz() << ")" << std::endl;
+
+		xp=x.begin();
+		yp=y.begin();
+		accum.reset();
+
+
+		//std::cout << " before for loop " << endl;
+		//std::cout << _indexP.end() - _indexP.begin() << " ";
+		//std::cout << _index.end() - _index.begin() << endl;
+
+		//std::cout << " stupid test here " << (*_indexP.begin()) - _index.begin() << endl;
+		//cout << &_index << "  of size ";
+		//cout << sizeof(_index) << " ";
+		//cout  << &(*_index.begin()) << endl;
+
+		for(ip = _indexP.begin(); ip !=_indexP.end()-1; ++ip, ++yp)
+			//for(ip = _indexP.begin(); ip < _indexP.end()-2; ++ip, ++yp)  // zigzag way
+		{
+			//std::cout << " inside the outer for loop " << ip - _indexP.begin() << endl;
+			for(jp = *ip; jp !=*(ip + 1); ++jp)
+			{
+				//std::cout << jp - _index.begin() << endl;
+				accum.accumulate_special( *(xp + *jp) );
+			}
+			//std::cout << " accumulate is done for one iteration " << endl;
+			//std::cout << " before accum.get " << yp - y.begin() << endl;
+			accum.get(*yp);
+			//std::cout << " before accum.reset " << endl;
+			accum.reset();
+
+			/* // zigzag way
+			   ++ip;++yp;
+
+			   for(jp = *(ip + 1); jp >*ip; --jp)
+			   accum.accumulate_special( *(xp + *(jp-1)) );
+			   accum.get(*yp);
+			   accum.reset();
+			   */
+
+		}
+
+		return y;
+	}
+
+	/* if you want to keep two copies for the matrix, one of which is sorted by row,
+	 * the other by column, then you want to use this applyTranspose function. In
+	 * this case, un-comment this one and comment out the applyTranspose further down
+	 */
+	/*
+	   template<class Field>
+	   template<class OutVector, class InVector>
+	   OutVector & ZeroOne<Field>::applyTranspose(OutVector & y, const InVector & x) const
+	   {
+	   linbox_check((y.size()==coldim())&&(x.size()==rowdim()));
+
+	   FieldAXPY<Field> accum (_F);
+
+	   typename OutVector::iterator yp;
+	   typename InVector::const_iterator xp;
+	   PointerVector::const_iterator ip;
+	   IndexVector::const_iterator jp;
+
+	   xp=x.begin();
+	   yp=y.begin();
+	   accum.reset();
+
+	   for(ip = _colP.begin(); ip < _colP.end()-1; ++ip, ++yp)
+	   {
+	   for(jp = *ip; jp <*(ip + 1); ++jp)
+	   accum.accumulate_special( *(xp + *jp) );
+	   accum.get(*yp);
+	   accum.reset();
+	   }
+
+	   return y;
+
+	   }
+	   */
+
+	template<class Field>
+	template<class OutVector, class InVector>
+	OutVector & ZeroOne<Field>::applyTranspose(OutVector & y, const InVector & x) const
+	{
+		linbox_check((y.size()==coldim())&&(x.size()==rowdim()));
+
+		FieldAXPY<Field> accum (_F);
+
+		typename OutVector::iterator yp;
+		typename InVector::const_iterator xp;
+		PointerVector::const_iterator ip;
+		IndexVector::const_iterator jp;
+
+		xp=x.begin();
+		yp=y.begin();
+		accum.reset();
+
+		if( sorted )
+			//{
+			//std::cout << " -- in apply transpose, before switch sort -- " << std::endl;
+			switch_sort();
+		//std::cout << " -- in apply transpose, after switch sort -- " << std::endl;
+		//}
+
+		for(ip = _indexP.begin(); ip < _indexP.end()-1; ++ip, ++yp)
+		{
+			for(jp = *ip; jp <*(ip + 1); ++jp)
+				accum.accumulate_special( *(xp + *jp) );
+			accum.get(*yp);
+			accum.reset();
+		}
+		return y;
+	}
+
+}//End of LinBox
diff --git a/linbox/config-blas.h b/linbox/config-blas.h
index 7c3b928..7210005 100644
--- a/linbox/config-blas.h
+++ b/linbox/config-blas.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* config-blas.h
  * Copyright (C) 2005  Pascal Giorgi
  *               2007  Clement Pernet
@@ -21,352 +22,9 @@
  */
 
 
-#ifndef __LINBOX_CONFIG_BLAS
-#define __LINBOX_CONFIG_BLAS
+#ifndef __LINBOX_config_blas_H
+#define __LINBOX_config_blas_H
 
-// #ifndef __LINBOX_CONFIGURATION
-// #include <linbox-config.h>
-// #endif
+#include <fflas-ffpack/config-blas.h>
 
- 
-
-//#define __LINBOX_HAVE_CBLAS
-
-
-#ifndef __LINBOX_HAVE_CBLAS
-
-// CBLAS are not available define our own wrapper
-
-
-// define external link to BLAS function
-extern "C" {
-  
-	// level 1 routines
-	void   daxpy_   (const int*, const double*, const double*, const int*, double*, const int*);
-	double ddot_    (const int*, const double*, const int*, const double*, const int*);
-	double dasum_   (const int*, const double*, const int*);
-	int    idamax_  (const int*, const double*, const int*);
-	double dnrm2_   (const int*, const double*, const int*);
-
-	// level 2 routines
-	void dgemv_ (const char*, const int*, const int*, const double*, const double*, const int*, const double*, const int*, const double*, double*, const int*);
-	void sgemv_ (const char*, const int*, const int*, const float*, const float*, const int*, const float*, const int*, const float*, float*, const int*);
-	void dger_  (const int*, const int*, const double*, const double*, const int*, const double*, const int*, double*, const int*);
-
-	// level 3 routines
-	void dtrsm_ (const char*, const char*, const char*, const char*, const int*, const int*, const double*, const double*, const int*, double*, const int*);
-	void strsm_ (const char*, const char*, const char*, const char*, const int*, const int*, const float*, const float*, const int*, float*, const int*);
-	void dtrmm_ (const char*, const char*, const char*, const char*, const int*, const int*, const double*, const double*, const int*, double*, const int*);
-	void strmm_ (const char*, const char*, const char*, const char*, const int*, const int*, const float*, const float*, const int*, float*, const int*);
-	void sgemm_ (const char*, const char*, const int*, const int*, const int*, const float*, const float*, const int*, const float*, const int*, const float*, float*, const int*);
-	void dgemm_ (const char*, const char*, const int*, const int*, const int*, const double*, const double*, const int*, const double*, const int*, const double*, double*, const int*);
-}
-
-// define external link to LAPACK routines
-extern "C" {
-  
-#ifdef  __LINBOX_HAVE_DGETRF
-        void dgetrf_ (const int *, const int *, double *, const int *, int *, int *);
-#endif
-#ifdef  __LINBOX_HAVE_DGETRI
-        void dgetri_ (const int *, double *, const int *, const int *, double *, const int *, int *);
-#endif
-#ifdef  __LINBOX_HAVE_DTRTRI
-        void dtrtri_ (const char *, const char *, const int *, double *, const int *, int *);
-#endif
-	void dswap_ (const int *, double *, const int *, double *, const int *);
-}
-
-// define C wrappers
-extern "C" {
-
-#define CBLAS_ENUM_DEFINED_H
-	enum CBLAS_ORDER {CblasRowMajor=101, CblasColMajor=102 };
-	enum CBLAS_TRANSPOSE {CblasNoTrans=111, CblasTrans=112, CblasConjTrans=113, AtlasConj=114};
-	enum CBLAS_UPLO  {CblasUpper=121, CblasLower=122};
-	enum CBLAS_DIAG  {CblasNonUnit=131, CblasUnit=132};
-	enum CBLAS_SIDE  {CblasLeft=141, CblasRight=142};
-	
-	static const char* EXT_BLAS_TRANSPOSE    (CBLAS_TRANSPOSE t) { if (t == CblasNoTrans) return "N"; else if (t == CblasTrans) return "T"; else return "";}
-	static const char* EXT_BLAS_TRANSPOSE_tr (CBLAS_TRANSPOSE t) { if (t == CblasNoTrans) return "T"; else if (t == CblasTrans) return "N"; else return "";}
-	
-	static const char* EXT_BLAS_UPLO         (CBLAS_UPLO t)      { if (t == CblasUpper) return "U"; else return "L";}
-	static const char* EXT_BLAS_UPLO_tr      (CBLAS_UPLO t)      { if (t == CblasUpper) return "L"; else return "U";}
-	
-	static const char* EXT_BLAS_DIAG         (CBLAS_DIAG t)      { if (t == CblasUnit)  return "U"; else return "N";}
-	
-	static const char* EXT_BLAS_SIDE         (CBLAS_SIDE t)      { if (t == CblasLeft)  return "L"; else return "R";}
-	static const char* EXT_BLAS_SIDE_tr      (CBLAS_SIDE t)      { if (t == CblasLeft)  return "R"; else return "L";}
-	
-#define CBLAS_INDEX int
-
-	// level 1 routines
-
-	void cblas_daxpy(const int N, const double alpha, const double *X, const int incX, double *Y, const int incY)
-	{
-		daxpy_ (&N,&alpha, X, &incX, Y, &incY);
-	}
-  
-	double cblas_ddot(const int N, const double *X, const int incX, const double *Y, const int incY)
-	{
-		return ddot_ (&N, X, &incX, Y, &incY);
-	}
-  
-	double cblas_dasum(const int N, const double *X, const int incX){
-		return dasum_ (&N, X, &incX);
-	}
-  
-	int cblas_idamax(const int N, const double *X, const int incX){
-		return idamax_ (&N, X, &incX);
-	}
-
-	double cblas_dnrm2(const int N, const double *X, const int incX){
-		return dnrm2_(&N, X, &incX);
-	}
-
-
-	// level 2 routines
-
-	void cblas_dgemv(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const int M, const int N, const double alpha, 
-			 const double *A, const int lda, const double *X, const int incX, const double beta, double *Y, const int incY)
-	{
-		if (Order == CblasRowMajor)
-			dgemv_ ( EXT_BLAS_TRANSPOSE_tr(TransA), &N, &M, &alpha, A, &lda, X, &incX, &beta, Y, &incY);
-		else
-			dgemv_ ( EXT_BLAS_TRANSPOSE(TransA), &M, &N, &alpha, A, &lda, X, &incX, &beta, Y, &incY);
-	}
-	void cblas_sgemv(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const int M, const int N, const float alpha, 
-			 const float *A, const int lda, const float *X, const int incX, const float beta, float *Y, const int incY)
-	{
-		if (Order == CblasRowMajor)
-			sgemv_ ( EXT_BLAS_TRANSPOSE_tr(TransA), &N, &M, &alpha, A, &lda, X, &incX, &beta, Y, &incY);
-		else
-			sgemv_ ( EXT_BLAS_TRANSPOSE(TransA), &M, &N, &alpha, A, &lda, X, &incX, &beta, Y, &incY);
-	}
-  
-	void cblas_dger(const enum CBLAS_ORDER Order, const int M, const int N, const double alpha, const double *X, const int incX,
-			const double *Y, const int incY, double *A, const int lda)
-	{  
-		if (Order == CblasRowMajor)
-			dger_ (&N, &M, &alpha, Y, &incY, X, &incX, A, &lda);
-		else
-			dger_ (&M, &N, &alpha, X, &incX, Y, &incY, A, &lda);
-	}
-
-
-
-	// level 3 routines
-
-	void cblas_dtrsm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA,
-			 const enum CBLAS_DIAG Diag, const int M, const int N, const double alpha, const double *A, const int lda,
-			 double *B, const int ldb)
-	{  
-		if (Order == CblasRowMajor) 
-			dtrsm_ ( EXT_BLAS_SIDE_tr(Side), EXT_BLAS_UPLO_tr(Uplo), EXT_BLAS_TRANSPOSE(TransA), EXT_BLAS_DIAG(Diag), &N, &M, &alpha, A, &lda, B, &ldb); 
-		else
-			dtrsm_ ( EXT_BLAS_SIDE(Side), EXT_BLAS_UPLO(Uplo), EXT_BLAS_TRANSPOSE(TransA), EXT_BLAS_DIAG(Diag), &M, &N, &alpha, A, &lda, B, &ldb);
-	}
-	void cblas_strsm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA,
-			 const enum CBLAS_DIAG Diag, const int M, const int N, const float alpha, const float *A, const int lda,
-			 float *B, const int ldb)
-	{  
-		if (Order == CblasRowMajor) 
-			strsm_ ( EXT_BLAS_SIDE_tr(Side), EXT_BLAS_UPLO_tr(Uplo), EXT_BLAS_TRANSPOSE(TransA), EXT_BLAS_DIAG(Diag), &N, &M, &alpha, A, &lda, B, &ldb); 
-		else
-			strsm_ ( EXT_BLAS_SIDE(Side), EXT_BLAS_UPLO(Uplo), EXT_BLAS_TRANSPOSE(TransA), EXT_BLAS_DIAG(Diag), &M, &N, &alpha, A, &lda, B, &ldb);
-	}
-  
-	void cblas_dtrmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA,
-			 const enum CBLAS_DIAG Diag, const int M, const int N, const double alpha, const double *A, const int lda,
-			 double *B, const int ldb)
-	{  
-		if (Order == CblasRowMajor)
-			dtrmm_ ( EXT_BLAS_SIDE_tr(Side), EXT_BLAS_UPLO_tr(Uplo), EXT_BLAS_TRANSPOSE(TransA), EXT_BLAS_DIAG(Diag), &N, &M, &alpha, A, &lda, B, &ldb);
-		else
-			dtrmm_ ( EXT_BLAS_SIDE(Side), EXT_BLAS_UPLO(Uplo), EXT_BLAS_TRANSPOSE(TransA), EXT_BLAS_DIAG(Diag), &M, &N, &alpha, A, &lda, B, &ldb);
-	}
-	void cblas_strmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA,
-			 const enum CBLAS_DIAG Diag, const int M, const int N, const float alpha, const float *A, const int lda,
-			 float *B, const int ldb)
-	{  
-		if (Order == CblasRowMajor)
-			strmm_ ( EXT_BLAS_SIDE_tr(Side), EXT_BLAS_UPLO_tr(Uplo), EXT_BLAS_TRANSPOSE(TransA), EXT_BLAS_DIAG(Diag), &N, &M, &alpha, A, &lda, B, &ldb);
-		else
-			strmm_ ( EXT_BLAS_SIDE(Side), EXT_BLAS_UPLO(Uplo), EXT_BLAS_TRANSPOSE(TransA), EXT_BLAS_DIAG(Diag), &M, &N, &alpha, A, &lda, B, &ldb);
-	}
-  
-	void cblas_dgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, const int M, const int N,
-			 const int K, const double alpha, const double *A, const int lda, const double *B, const int ldb,
-			 const double beta, double *C, const int ldc) 
-	{   
-		if (Order == CblasRowMajor)
-			dgemm_ ( EXT_BLAS_TRANSPOSE(TransB), EXT_BLAS_TRANSPOSE(TransA), &N, &M, &K, &alpha, B, &ldb, A, &lda, &beta, C, &ldc);
-		else
-			dgemm_ ( EXT_BLAS_TRANSPOSE(TransA), EXT_BLAS_TRANSPOSE(TransB), &M, &N, &K, &alpha, A, &lda, B, &ldb, &beta, C, &ldc);
-	}
-	void cblas_sgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, const int M, const int N,
-			 const int K, const float alpha, const float *A, const int lda, const float *B, const int ldb,
-			 const float beta, float *C, const int ldc) 
-	{   
-		if (Order == CblasRowMajor)
-			sgemm_ ( EXT_BLAS_TRANSPOSE(TransB), EXT_BLAS_TRANSPOSE(TransA), &N, &M, &K, &alpha, B, &ldb, A, &lda, &beta, C, &ldc);
-		else
-			sgemm_ ( EXT_BLAS_TRANSPOSE(TransA), EXT_BLAS_TRANSPOSE(TransB), &M, &N, &K, &alpha, A, &lda, B, &ldb, &beta, C, &ldc);
-	}
-
-	// LAPACK routines
-
-#ifdef  __LINBOX_HAVE_DGETRF
-
-	// return A=P.L.U (L unitary) with ColMajor
-	// return A=L.U.P (U unitary) with RowMajor
-	int clapack_dgetrf(const enum CBLAS_ORDER Order, const int M, const int N,
-			   double *A, const int lda, int *ipiv) 
-        {
-            int info;
-	    dgetrf_ ( &M, &N, A, &lda, ipiv, &info);
-            return info;
-        }
-#endif
-
-#ifdef  __LINBOX_HAVE_DGETRI
-	int clapack_dgetri(const enum CBLAS_ORDER Order, const int N, double *A,
-			   const int lda, const int *ipiv)
-	{
-		int info;
-		double *work;	
-
-#ifndef __LINBOX_AUTOIMPLEMENT_DGETRI
-		// the optimum size of work can be determinted via the 
-		// Lapack function ilaenv. 
-		work= new double[N];
-		dgetri_ (&N, A, &lda, ipiv, work, &N,  &info);
-		delete[] work;
-#else
-		work= new double[N*N];
-		dtrtri_("U","N", &N, A, &lda, &info);
-		if (info > 0) 
-			return 0;
-		
-		for (int i=0;i<N;++i){
-			for(int j=i;j<N;++j){
-				work[i*N+j]=A[i*N+j];
-				if (j>i) A[i*N+j]=0.0;
-			}	      
-			work[i*N+i]=1.;
-		}
-		
-		double cst=1.;
-		dtrsm_ ("R", "L", "N", "U", &N, &N, &cst, work, &N, A, &N);
-		
-		int ip;
-		const int incr=1;
-		for (int i=0; i<N; ++i){
-			ip = ipiv[i]-1;
-			if (ip != i) 
-				dswap_ (&N, &A[i*lda],&incr , &A[ip*lda], &incr);
-		}
-		
-		delete[] work;
-#endif
-		return info;	
-	}
-#endif
-
-#ifdef  __LINBOX_HAVE_DTRTRI
-	int clapack_dtrtri(const enum CBLAS_ORDER Order,const enum CBLAS_UPLO Uplo,
-			   const enum CBLAS_DIAG Diag,const int N, double *A, const int lda)
-	{
-		int info;
-		if (Order == CblasRowMajor)
-			dtrtri_ (EXT_BLAS_UPLO_tr(Uplo), EXT_BLAS_DIAG(Diag), &N, A, &lda, &info);
-		else
-			dtrtri_ (EXT_BLAS_UPLO(Uplo), EXT_BLAS_DIAG(Diag), &N, A, &lda, &info);
-		
-		return info;		
-	}
-#endif
-
-
-} 
-
-#else
-extern "C" {
-	
-
-#define CBLAS_ENUM_DEFINED_H
-	enum CBLAS_ORDER {CblasRowMajor=101, CblasColMajor=102 };
-	enum CBLAS_TRANSPOSE {CblasNoTrans=111, CblasTrans=112, CblasConjTrans=113,
-			      AtlasConj=114};
-	enum CBLAS_UPLO  {CblasUpper=121, CblasLower=122};
-	enum CBLAS_DIAG  {CblasNonUnit=131, CblasUnit=132};
-	enum CBLAS_SIDE  {CblasLeft=141, CblasRight=142};
-
-
-#define CBLAS_INDEX int	
-	
-
-	int cblas_errprn(int ierr, int info, char *form, ...);
-
-	// level 1 routines
-
-	void   cblas_daxpy(const int N, const double alpha, const double *X, const int incX, double *Y, const int incY);
-
-	double cblas_ddot(const int N, const double *X, const int incX, const double *Y, const int incY);
-  
-	double cblas_dasum(const int N, const double *X, const int incX);
-  
-	int    cblas_idamax(const int N, const double *X, const int incX);
-
-	double cblas_dnrm2(const int N, const double *X, const int incX);
-
-
-	// level 2 routines
-
-	void cblas_dgemv(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const int M, const int N, const double alpha, 
-			 const double *A, const int lda, const double *X, const int incX, const double beta, double *Y, const int incY);
-
-	void cblas_sgemv(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const int M, const int N, const float alpha, 
-			 const float *A, const int lda, const float *X, const int incX, const float beta, float *Y, const int incY);
-  
-	void cblas_dger(const enum CBLAS_ORDER Order, const int M, const int N, const double alpha, const double *X, const int incX,
-			const double *Y, const int incY, double *A, const int lda);
-
-
-	// level 3 routines
-
-	void cblas_dtrsm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA,
-			 const enum CBLAS_DIAG Diag, const int M, const int N, const double alpha, const double *A, const int lda,
-			 double *B, const int ldb);
-  
-	void cblas_strsm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA,
-			 const enum CBLAS_DIAG Diag, const int M, const int N, const float alpha, const float *A, const int lda,
-			 float *B, const int ldb);
-  
-	void cblas_dtrmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA,
-			 const enum CBLAS_DIAG Diag, const int M, const int N, const double alpha, const double *A, const int lda,
-			 double *B, const int ldb);
-  
-	void cblas_strmm(const enum CBLAS_ORDER Order, const enum CBLAS_SIDE Side, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE TransA,
-			 const enum CBLAS_DIAG Diag, const int M, const int N, const float alpha, const float *A, const int lda,
-			 float *B, const int ldb);
-  
-	void cblas_dgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, const int M, const int N,
-			 const int K, const double alpha, const double *A, const int lda, const double *B, const int ldb,
-			 const double beta, double *C, const int ldc) ;
-	void cblas_sgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, const int M, const int N,
-			 const int K, const float alpha, const float *A, const int lda, const float *B, const int ldb,
-			 const float beta, float *C, const int ldc) ;
-
-	// LAPACK routines
-
-	int clapack_dgetrf(const enum CBLAS_ORDER Order, const int M, const int N,
-			   double *A, const int lda, int *ipiv);
-	int clapack_dgetri(const enum CBLAS_ORDER Order, const int N, double *A,
-			   const int lda, const int *ipiv);
-	int clapack_dtrtri(const enum CBLAS_ORDER Order,const enum CBLAS_UPLO Uplo,
-			   const enum CBLAS_DIAG Diag,const int N, double *A, const int lda);
-}
-#endif
-
-#endif
+#endif //__LINBOX_config_blas_H
diff --git a/linbox/dummy.C b/linbox/dummy.C
index 7dec272..562ea08 100644
--- a/linbox/dummy.C
+++ b/linbox/dummy.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* linbox/dummy.C
  * Copyright (C) 1994-1997 Givaro Team
diff --git a/linbox/element/Makefile.am b/linbox/element/Makefile.am
index e255b7f..28cf39c 100644
--- a/linbox/element/Makefile.am
+++ b/linbox/element/Makefile.am
@@ -1,3 +1,6 @@
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 pkgincludesubdir=$(pkgincludedir)/element
 
 EXTRA_DIST=				\
@@ -7,5 +10,4 @@ pkgincludesub_HEADERS=			\
 	abstract.h			\
 	archetype.h			\
 	envelope.h			\
-	givaro-polynomial.h		\
 	gmp-rational.h
diff --git a/linbox/element/Makefile.in b/linbox/element/Makefile.in
index e0134ca..51a90ea 100644
--- a/linbox/element/Makefile.in
+++ b/linbox/element/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -37,19 +38,26 @@ DIST_COMMON = $(pkgincludesub_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
-	$(top_srcdir)/macros/blas-check.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
 	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
 	$(top_srcdir)/macros/givaro-check.m4 \
 	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
 	$(top_srcdir)/macros/lidia-check.m4 \
 	$(top_srcdir)/macros/linbox-doc.m4 \
 	$(top_srcdir)/macros/linbox-misc.m4 \
 	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
 	$(top_srcdir)/macros/maple-check.m4 \
 	$(top_srcdir)/macros/ntl-check.m4 \
 	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -79,18 +87,21 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
 CC = @CC@
+CCNAM = @CCNAM@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
 DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -98,19 +109,24 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
 GIVARO_CFLAGS = @GIVARO_CFLAGS@
 GIVARO_LIBS = @GIVARO_LIBS@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
 GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
@@ -118,41 +134,52 @@ LIBTOOL = @LIBTOOL@
 LIDIA_CFLAGS = @LIDIA_CFLAGS@
 LIDIA_LIBS = @LIDIA_LIBS@
 LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MAPLE_CFLAGS = @MAPLE_CFLAGS@
 MAPLE_HOME = @MAPLE_HOME@
 MAPLE_LIBS = @MAPLE_LIBS@
 MAPLE_VERSION = @MAPLE_VERSION@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
 NTL_CFLAGS = @NTL_CFLAGS@
 NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RM = @RM@
 SACLIB_CFLAGS = @SACLIB_CFLAGS@
 SACLIB_LIBS = @SACLIB_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+TESTS_CFLAGS = @TESTS_CFLAGS@
 VERSION = @VERSION@
+WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -193,8 +220,13 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 pkgincludesubdir = $(pkgincludedir)/element
 EXTRA_DIST = \
 	element.doxy
@@ -203,7 +235,6 @@ pkgincludesub_HEADERS = \
 	abstract.h			\
 	archetype.h			\
 	envelope.h			\
-	givaro-polynomial.h		\
 	gmp-rational.h
 
 all: all-am
@@ -213,8 +244,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
 	      exit 1;; \
 	  esac; \
 	done; \
@@ -267,7 +298,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
@@ -380,6 +411,8 @@ dvi-am:
 
 html: html-am
 
+html-am:
+
 info: info-am
 
 info-am:
@@ -388,18 +421,28 @@ install-data-am: install-pkgincludesubHEADERS
 
 install-dvi: install-dvi-am
 
+install-dvi-am:
+
 install-exec-am:
 
 install-html: install-html-am
 
+install-html-am:
+
 install-info: install-info-am
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-am
 
+install-pdf-am:
+
 install-ps: install-ps-am
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
diff --git a/linbox/element/abstract.h b/linbox/element/abstract.h
index bff6ee9..6d17089 100644
--- a/linbox/element/abstract.h
+++ b/linbox/element/abstract.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/element/abstract.h
  * Copyright (C) 1999-2001 William J Turner,
  *               2001 Bradford Hovinen
@@ -23,25 +23,24 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __ELEMENT_ABSTRACT_H
-#define __ELEMENT_ABSTRACT_H
+#ifndef __LINBOX_element_abstract_H
+#define __LINBOX_element_abstract_H
 
-namespace LinBox 
-{ 
+namespace LinBox
+{
 
 	/** \brief Abstract element base class, a technicality.
 
-	 * The element class of \ref{FieldAbstract}.
-	 * This element has no knowledge of the field to which it belongs. 
+	 * The element class of \ref FieldAbstract.
+	 * This element has no knowledge of the field to which it belongs.
 	 * All operations and functions requiring knolwedge of the field,
 	 * such as addition and other arithmetic operations, are supplied
 	 * by the field and not the element class.
 \ingroup element
 	 */
-	class ElementAbstract 
-	{
+	class ElementAbstract {
 	    public:
-    
+
 		/** Virtual copy constructor.
 		 * Required because constructors cannot be virtual.
 		 * Passes construction on to derived classes.
@@ -73,5 +72,6 @@ namespace LinBox
 
 } // namespace LinBox
 
-#endif // __ELEMENT_ABSTRACT_H
+#endif // __LINBOX_element_abstract_H
+
 
diff --git a/linbox/element/archetype.h b/linbox/element/archetype.h
index f1e1628..51a1427 100644
--- a/linbox/element/archetype.h
+++ b/linbox/element/archetype.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/element/archetype.h
  * Copyright (C) 1999-2001 William J Turner,
  *               2001 Bradford Hovinen
@@ -23,8 +23,13 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __ELEMENT_ARCHETYPE_H
-#define __ELEMENT_ARCHETYPE_H
+/*!@file element/archetype.h
+ * @ingroup element
+ * @brief NO DOC
+ * @see \ref Archetypes
+ */
+#ifndef __LINBOX_element_archetype_H
+#define __LINBOX_element_archetype_H
 
 #include "linbox/element/abstract.h"
 
@@ -36,69 +41,68 @@ namespace LinBox
 	class RandIterArchetype;
 
 	/** @brief Field and Ring element interface specification and archetypical instance class.
-\ingroup element
+	  \ingroup element
 
 	 * Element classes must contain public default constructor, copy constructor,
 	 * assignment operator, and destructor.  Note that primitive types
 	 * such as int and double meet this specification.
-	  
-	 * In particular, the copy constructor is used to allow elements to 
+
+	 * In particular, the copy constructor is used to allow elements to
 	 * be passed by value to a function.
-	  
+
 	 * Note that the documentation below of the specific methods, describes
 	 * them as implemented in the archetypic element class.
 
-	 */
-	class ElementArchetype
-	{
-	    public:
+*/
+	class ElementArchetype {
+	public:
 
 		/** @name Common Object Interface for LinBox Field elements.
-		 * These methods are required of all \ref{LinBox} 
-		 * {@link Fields field} elements.
+		 * These methods are required of all \ref LinBox
+		 * @link Fields field at endlink elements.
 		 */
 		//@{
 
 		/** Default constructor.
-		 * This constructor is required to allow 
-		 * {@link Fields field} elements to be primitive C++ types.
-		 * Because constructor does not know what {@link Fields field} 
+		 * This constructor is required to allow
+		 * @link Fields field at endlink elements to be primitive \c C++ types.
+		 * Because constructor does not know what @link Fields field at endlink
 		 * the element belongs to, it cannot actually construct the element.
-		 * In this implementation, the constructor it sets {\tt \_elem\_ptr}
+		 * In this implementation, the constructor it sets \c _elem_ptr
 		 * to the null pointer.  Initialization of the element is done through
 		 * the field function init where the field is known.
 		 */
 		ElementArchetype (void) { _elem_ptr = 0; }
 
 		/** Copy constructor.
-		 * This constructor is required to allow 
-		 * {@link Fields field} elements to be primitive C++ types, 
-		 * and to allow field elements to be passed by value into 
+		 * This constructor is required to allow
+		 * @link Fields field at endlink elements to be primitive C++ types,
+		 * and to allow field elements to be passed by value into
 		 * functions.
-		 * Constructs {@link Fields field} element by copying the 
-		 * {@link Fields field} element.
+		 * Constructs @link Fields field at endlink element by copying the
+		 * @link Fields field at endlink element.
 		 * In this implementation, this means copying the element to
-		 * which {\tt a.\_elem\_ptr} points.
+		 * which \c a._elem_ptr points.
 		 * @param  a field element.
 		 */
-		ElementArchetype (const ElementArchetype &a) 
-		{ 
+		ElementArchetype (const ElementArchetype &a)
+		{
 			if (a._elem_ptr != 0)
-				_elem_ptr = a._elem_ptr->clone (); 
+				_elem_ptr = a._elem_ptr->clone ();
 			else
 				_elem_ptr = 0;
 		}
 
 		/** Destructor.
-		 * In this implementation, this destroys element by deleting field 
-		 * element to which {\tt \_elem\_ptr} points.
+		 * In this implementation, this destroys element by deleting field
+		 * element to which \c _elem_ptr points.
 		 */
 		~ElementArchetype () { if (_elem_ptr != 0) delete _elem_ptr; }
 
 		/** Assignment operator.
-		 * Assigns element a to element.  
-		 * In this implementation, this is done 
-		 * by copying field element to which {\tt \_elem\_ptr} points.
+		 * Assigns element a to element.
+		 * In this implementation, this is done
+		 * by copying field element to which \c _elem_ptr points.
 		 * @param  a field element.
 		 */
 		ElementArchetype &operator=(const ElementArchetype &a)
@@ -120,38 +124,40 @@ namespace LinBox
 		//@{
 
 		/** Constructor.
-		 * Constructs field element from pointer to \ref{ElementAbstract}
+		 * Constructs field element from pointer to \ref ElementAbstract
 		 * Not part of the interface.
 		 * Creates new copy of element object in dynamic memory.
-		 * @param  elem\_ptr  pointer to \ref{ElementAbstract}
+		 * @param  elem_ptr  pointer to \ref ElementAbstract
 		 */
-		ElementArchetype (ElementAbstract *elem_ptr)
-			: _elem_ptr (elem_ptr->clone ()) {}
+		ElementArchetype (ElementAbstract *elem_ptr) :
+			_elem_ptr (elem_ptr->clone ())
+		{}
 
 		//@}
-    
-	    private:
+
+	private:
 
 		friend class RingArchetype;
 		friend class FieldArchetype;
 		friend class RandIterArchetype;
-    
+
 		/** @name Implementation-Specific Data.
 		 * This data is not required of all LinBox field elements
 		 * and is included only for this implementation of the archetype.
 		 */
 		//@{
-    
+
 		/** Pointer to parameterized field element.
-		 * Not part of the common object interface for \ref{LinBox} field elements.
+		 * Not part of the common object interface for \ref LinBox field elements.
 		 * Included to avoid code bloat.
 		 */
 		mutable ElementAbstract *_elem_ptr;
-    
+
 		//@} Non-Interface
 
 	}; // class element
 
 } // namespace LinBox
 
-#endif // __ELEMENT_ARCHETYPE_H
+#endif // __LINBOX_element_archetype_H
+
diff --git a/linbox/element/element.doxy b/linbox/element/element.doxy
index 3c1d32e..85238cb 100644
--- a/linbox/element/element.doxy
+++ b/linbox/element/element.doxy
@@ -1,15 +1,18 @@
-/** \defgroup element linbox/element
+/** \ingroup linbox
+  \defgroup element element
 
-The interface for field and ring element types.
+  \brief The interface for field and ring element types.
 
-The interface requirements are minimal and are specified
-in LinBox::ElementArchetype.
+  The interface requirements are minimal and are specified
+  in LinBox::ElementArchetype.
 
-Developers:
-Your element type may be almost any primitive type or defined class.
-To support the field archetype there is also a LinBox::ElementAbstract
-and LinBox::ElementEnvelope.
+  \note Developers:
+  Your element type may be almost any primitive type or defined class.
+  To support the field archetype there is also a LinBox::ElementAbstract
+  and LinBox::ElementEnvelope.
 
- at see \ref Archetypes
+  @see \ref Archetypes
 
-*/
+ */
+
+// vim:syn=doxygen
diff --git a/linbox/element/envelope.h b/linbox/element/envelope.h
index 4158fcb..5338f63 100644
--- a/linbox/element/envelope.h
+++ b/linbox/element/envelope.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/element/envelope.h
  * Copyright (C) 1999-2001 William J Turner,
  *               2001 Bradford Hovinen
@@ -23,15 +23,15 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __ELEMENT_ENVELOPE_H
-#define __ELEMENT_ENVELOPE_H
+#ifndef __LINBOX_element_envelope_H
+#define __LINBOX_element_envelope_H
 
 #include <iostream>
 
 #include "linbox/element/abstract.h"
 
-namespace LinBox 
-{ 
+namespace LinBox
+{
 	// Forward declarations
 	template <class Field> class RingEnvelope;
 	template <class Field> class FieldEnvelope;
@@ -43,36 +43,38 @@ namespace LinBox
 	 * to be a child class of ElementAbstract.
 	 * A concrete instance of ElementArchetype representing
 	 * the adapted class can then be constructed.
-	 * 
+	 *
 	 * All this is in support of the FieldArchetype system.
-\ingroup element
+	 \ingroup element
 
-	 */
+*/
 	template <class Field>
-	class ElementEnvelope : public ElementAbstract
-	{
-	    public:
+	class ElementEnvelope : public ElementAbstract {
+	public:
 
 		/** Default Constructor.
-		 */
+		*/
 		ElementEnvelope () {}
 
 		/** Constructor from the Field element to be wrapped.
 		 * @param elem Field element object to be wrapped.
 		 */
-		ElementEnvelope (const typename Field::Element &elem) : _elem (elem) {}
+		ElementEnvelope (const typename Field::Element &elem) :
+			_elem (elem)
+		{}
 
 		/** Copy constructor.
 		 * Constructs ElementEnvelope object by copying the element
 		 * it wraps.
 		 * This is required to allow element objects to be passed by value
 		 * into functions.
-		 * In this implementation, this means copying the element {\tt E.\_elem}.
+		 * In this implementation, this means copying the element \c E._elem.
 		 * @param  E FieldEnvelope object.
 		 */
-		ElementEnvelope (const ElementAbstract &E)
-			: _elem (static_cast<const ElementEnvelope&>(E)._elem) {}
-  
+		ElementEnvelope (const ElementAbstract &E) :
+			_elem (static_cast<const ElementEnvelope&>(E)._elem)
+		{}
+
 		/** Virtual copy constructor.
 		 * Required because constructors cannot be virtual.
 		 * Passes construction on to derived classes.
@@ -82,7 +84,7 @@ namespace LinBox
 
 		/** Assignment operator.
 		 * @return reference to self
-		 * @param  x parameterized field base element
+		 * @param  E parameterized field base element
 		 */
 		ElementAbstract &operator= (const ElementAbstract &E)
 		{
@@ -92,10 +94,10 @@ namespace LinBox
 		}
 
 		/** Destructor.
-		 */
+		*/
 		~ElementEnvelope () {}
 
-	    private:
+	private:
 
 		// Friend declarations
 		friend class RingEnvelope<Field>;
@@ -108,4 +110,5 @@ namespace LinBox
 
 } // namespace LinBox
 
-#endif // __ELEMENT_ENVELOPE_H
+#endif // __LINBOX_element_envelope_H
+
diff --git a/linbox/element/givaro-polynomial.h b/linbox/element/givaro-polynomial.h
deleted file mode 100644
index b3d0fb7..0000000
--- a/linbox/element/givaro-polynomial.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* linbox/element/givaro-polynomial.h
- * Written by 
- * Clement Pernet
- *
- * See COPYING for license information.
- */
-
-#ifndef __GIVAROPOLYNOMIAL_ELT_H
-#define __GIVAROPOLYNOMIAL_ELT_H
-
-#include <iostream>
-#include "givaro/givpoly1.h"
-
-// Namespace in which all LinBox code resides
-namespace LinBox 
-{ 
-	
-	/** \brief Polynomials over a domain
-	 *
-	 * @param Type of coefficients
-\ingroup element
-	 */
-template <typename T, class Alloc=std::allocator<T> >
-class GivPolynomial : public givvector<T, Alloc>
-{
-	typedef GivPolynomial<T, Alloc > Self_t;
-public:
-  
-	GivPolynomial () : givvector<T, Alloc>() {}
-	
-	GivPolynomial (size_t s) : givvector<T, Alloc>(s) {}
-	GivPolynomial (const std::vector<T,Alloc>& p) : givvector<T,Alloc >(p, givWithCopy()) {}
-	GivPolynomial (const givvector<T,Alloc>& p) : givvector<T,Alloc >(p, givWithCopy()) {}
-
-	template<typename X>
-	struct rebind
-	{
-		typedef GivPolynomial<typename X::Element> other;
-		
-		void operator() (other *& P2, 
-				 const Self_t& P1, 
-				 const X& F)
-		{
-			P2 = new other(P1.size());
-			typename Self_t::const_iterator it1 = P1.begin();
-			typename other::iterator it2 = P2->begin();
-			for (; it1 != P1.end(); ++it1, ++it2)
-				F.init (*it2, *it1);
-//  			for (size_t i=0; i < P1.size(); ++i)
-//  				F.init ( (*P2)[i], P1[i]);
-		}
-	};
-};
-
-} // namespace LinBox
-
-
-#endif // __GIVAROPOLYNOMIAL_ELT_H
diff --git a/linbox/element/gmp-rational.h b/linbox/element/gmp-rational.h
index 05f2942..2fc8048 100644
--- a/linbox/element/gmp-rational.h
+++ b/linbox/element/gmp-rational.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/element/gmp-rational.h
  * Copyright (C) 2001-2002 Bradford Hovinen
  *
@@ -21,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __ELEMENT_GMP_RATIONAL_H
-#define __ELEMENT_GMP_RATIONAL_H
+#ifndef __LINBOX_element_gmp_rational_H
+#define __LINBOX_element_gmp_rational_H
 
 #include "linbox/integer.h"
 
@@ -31,138 +31,141 @@
 namespace LinBox
 {
 
-// Forward declarations
-class GMPRationalField;
-class GMPRationalRandIter;
+	// Forward declarations
+	class GMPRationalField;
+	class GMPRationalRandIter;
+
+
+	/** \brief elements of GMP_Rationals.
+	  \ingroup element
+	  */
+	class GMPRationalElement {
+	public:
+
+		/** @name Common Object Interface for LinBox Field elements.
+		 * These methods are required of all \ref LinBox
+		 * @link Fields field at endlink elements.
+		 */
+		//@{
+
+		/** Default constructor.
+		 * This constructor is required to allow
+		 * @link Fields field at endlink elements to be primitive C++ types.
+		 * Because constructor does not know what @link Fields field at endlink
+		 * the element belongs to, it cannot actually construct the element.
+		 * In this implementation, the constructor it sets _elem_ptr
+		 * to the null pointer.  Initialization of the element is done through
+		 * the field function init where the field is known.
+		 */
+		GMPRationalElement(void) { mpq_init (rep); }
+
+		/** Copy constructor.
+		 * This constructor is required to allow
+		 * @link Fields field at endlink elements to be primitive C++ types,
+		 * and to allow field elements to be passed by value into
+		 * functions.
+		 * Constructs @link Fields field at endlink element by copying the
+		 * @link Fields field at endlink element.
+		 * In this implementation, this means copying the element to
+		 * which a._elem_ptr points.
+		 * @param  a field element.
+		 */
+		GMPRationalElement(const GMPRationalElement& a)
+		{ mpq_init (rep); mpq_set (rep, a.rep); }
+
+		/** Destructor.
+		 * In this implementation, this destroys element by deleting field
+		 * element to which _elem_ptr points.
+		 */
+		~GMPRationalElement() { mpq_clear (rep); }
+
+		/** Assignment operator.
+		 * Assigns element a to element.
+		 * In this implementation, this is done
+		 * by copying field element to which _elem_ptr points.
+		 * @param  a field element.
+		 */
+		GMPRationalElement& operator=(const GMPRationalElement& a)
+		{
+			if (this != &a) { // guard against self-assignment
+				mpq_set (rep, a.rep);
+			}
+			return *this;
+		}
 
+		//@} Common Object Interface
+
+		/** @name Implementation-Specific Methods.
+		 * These methods are not required of all LinBox field elements
+		 * and are included only for this implementation of the archetype.
+		 */
+		//@{
+
+		/** Constructor.
+		 * Constructs field element from an mpq_t
+		 * Not part of the interface.
+		 * Creates new copy of element object in dynamic memory.
+		 * @param  _rep  pointer to \ref ElementAbstract
+		 */
+		GMPRationalElement (mpq_t _rep) {
+			mpq_init (rep);
+			mpq_set (rep, _rep);
+		}
 
-/** \brief elements of GMP_Rationals.
-\ingroup element
- */
-class GMPRationalElement
-{
-    public:
-
-	/** @name Common Object Interface for LinBox Field elements.
-	 * These methods are required of all \ref{LinBox} 
-	 * {@link Fields field} elements.
-	 */
-	//@{
-
-	/** Default constructor.
-	 * This constructor is required to allow 
-	 * {@link Fields field} elements to be primitive C++ types.
-	 * Because constructor does not know what {@link Fields field} 
-	 * the element belongs to, it cannot actually construct the element.
-	 * In this implementation, the constructor it sets _elem_ptr
-	 * to the null pointer.  Initialization of the element is done through
-	 * the field function init where the field is known.
-	 */
-	GMPRationalElement(void) { mpq_init (rep); }
-
-	/** Copy constructor.
-	 * This constructor is required to allow 
-	 * {@link Fields field} elements to be primitive C++ types, 
-	 * and to allow field elements to be passed by value into 
-	 * functions.
-	 * Constructs {@link Fields field} element by copying the 
-	 * {@link Fields field} element.
-	 * In this implementation, this means copying the element to
-	 * which a._elem_ptr points.
-	 * @param  a field element.
-	 */
-	GMPRationalElement(const GMPRationalElement& a) 
-	{ mpq_init (rep); mpq_set (rep, a.rep); }
-
-	/** Destructor.
-	 * In this implementation, this destroys element by deleting field 
-	 * element to which _elem_ptr points.
-	 */
-	~GMPRationalElement() { mpq_clear (rep); }
-
-	/** Assignment operator.
-	 * Assigns element a to element.  
-	 * In this implementation, this is done 
-	 * by copying field element to which _elem_ptr points.
-	 * @param  a field element.
-	 */
-	GMPRationalElement& operator=(const GMPRationalElement& a)
-	{
-		if (this != &a) { // guard against self-assignment
-			mpq_set (rep, a.rep);
+		/** Constructor.
+		 * Initialize from numerator and denominator
+		 * @param num,den
+		 */
+		GMPRationalElement (const integer &num, const integer &den)
+		{
+			mpq_init (rep);
+			mpz_set (mpq_numref (rep), SpyInteger::get_rep(num));
+			mpz_set (mpq_denref (rep), SpyInteger::get_rep(den));
+		}
+
+		// Added by Rich Seagraves to take care of some headaches
+		/** Constructor.
+		 *  Initalizes from a single integer, (which is assumed to be the
+		 *  numerator, with the denominator being 1)
+		 *  @param num
+		 */
+		GMPRationalElement(const integer &num)
+		{
+			mpq_init (rep);
+			/*
+			//potential error, error occurs when |num| is bigger than largest int
+			mpz_set_si (mpq_numref(rep), num);
+			mpz_set_si (mpq_denref(rep), integer(1));
+			*/
+			mpq_set_z(rep, SpyInteger::get_rep(num));
 		}
-		return *this;
-	}
-
-	//@} Common Object Interface
-
-	/** @name Implementation-Specific Methods.
-	 * These methods are not required of all LinBox field elements
-	 * and are included only for this implementation of the archetype.
-	 */
-	//@{
-
-	/** Constructor.
-	 * Constructs field element from an mpq_t
-	 * Not part of the interface.
-	 * Creates new copy of element object in dynamic memory.
-	 * @param  elem_ptr  pointer to \ref{ElementAbstract}
-	 */
-	GMPRationalElement (mpq_t _rep) {
-		mpq_init (rep);
-		mpq_set (rep, _rep);
-	}
-
-	/** Constructor
-	 * Initialize from numerator and denominator
-	 */
-	GMPRationalElement (const integer &num, const integer &den) 
-	{
-		mpq_init (rep);
-		mpz_set (mpq_numref (rep), SpyInteger::get_rep(num));
-		mpz_set (mpq_denref (rep), SpyInteger::get_rep(den));
-	}
-	
-	// Added by Rich Seagraves to take care of some headaches
-	/** Constructor
-	 *  Initalizes from a single integer, (which is assumed to be the
-	 *  numerator, with the denominator being 1)
-	 */
-	GMPRationalElement(const integer &num)
-	{
-		mpq_init (rep);
-		/*
-		//potential error, error occurs when |num| is bigger than largest int
-		mpz_set_si (mpq_numref(rep), num);
-		mpz_set_si (mpq_denref(rep), integer(1));
-		*/
-		mpq_set_z(rep, SpyInteger::get_rep(num));
-	}
-
-	mpq_ptr get_rep() {return rep;}
-
-	//@}p
-    
-    private:
-
-	friend class GMPRationalField;
-	friend class GMPRationalRandIter;
-
-	/** @name Implementation-Specific Data.
-	 * This data is not required of all LinBox field elements
-	 * and is included only for this implementation of the archetype.
-	 */
-	//@{
-    
-	/** Pointer to parameterized field element.
-	 * Not part of the common object interface for \ref{LinBox} field elements.
-	 * Included to avoid code bloat.
-	 */
-	mutable mpq_t rep;
-    
-	//@} Non-Interface
-};
+
+		/// access representation
+		mpq_ptr get_rep() {return rep;}
+
+		//@}p
+
+	private:
+
+		friend class GMPRationalField;
+		friend class GMPRationalRandIter;
+
+		/** @name Implementation-Specific Data.
+		 * This data is not required of all LinBox field elements
+		 * and is included only for this implementation of the archetype.
+		 */
+		//@{
+
+		/** Pointer to parameterized field element.
+		 * Not part of the common object interface for \ref LinBox field elements.
+		 * Included to avoid code bloat.
+		 */
+		mutable mpq_t rep;
+
+		//@} Non-Interface
+	};
 
 } // namespace LinBox
 
-#endif // __ELEMENT_GMP_RATIONAL_H
+#endif // __LINBOX_element_gmp_rational_H
+
diff --git a/linbox/fflas/Makefile.am b/linbox/fflas/Makefile.am
deleted file mode 100644
index fa976bc..0000000
--- a/linbox/fflas/Makefile.am
+++ /dev/null
@@ -1,19 +0,0 @@
-pkgincludesubdir=$(pkgincludedir)/fflas
-
-pkgincludesub_HEADERS = \
-	fflas.h				\
-	fflas_fgemm.inl			\
-	fflas_fgemv.inl			\
-	fflas_fger.inl			\
-	fflas_faxpy.inl			\
-	fflas_fdot.inl			\
-	fflas_ftrsm.inl			\
-	fflas_ftrsm_src.inl		\
-	fflas_ftrmm.inl			\
-	fflas_ftrmm_src.inl		\
-	fflas_ftrsv.inl			\
-	fflas_fcopy.inl			\
-	fflas_bounds.inl
-
-EXTRA_DIST = fflas.doxy
-
diff --git a/linbox/fflas/Makefile.in b/linbox/fflas/Makefile.in
deleted file mode 100644
index bb584bd..0000000
--- a/linbox/fflas/Makefile.in
+++ /dev/null
@@ -1,446 +0,0 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  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.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
- at SET_MAKE@
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-subdir = linbox/fflas
-DIST_COMMON = $(pkgincludesub_HEADERS) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
-	$(top_srcdir)/macros/blas-check.m4 \
-	$(top_srcdir)/macros/config-header.m4 \
-	$(top_srcdir)/macros/expat-check.m4 \
-	$(top_srcdir)/macros/givaro-check.m4 \
-	$(top_srcdir)/macros/gmp-check.m4 \
-	$(top_srcdir)/macros/lidia-check.m4 \
-	$(top_srcdir)/macros/linbox-doc.m4 \
-	$(top_srcdir)/macros/linbox-misc.m4 \
-	$(top_srcdir)/macros/linbox-opt.m4 \
-	$(top_srcdir)/macros/maple-check.m4 \
-	$(top_srcdir)/macros/ntl-check.m4 \
-	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-	$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-depcomp =
-am__depfiles_maybe =
-SOURCES =
-DIST_SOURCES =
-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__installdirs = "$(DESTDIR)$(pkgincludesubdir)"
-pkgincludesubHEADERS_INSTALL = $(INSTALL_HEADER)
-HEADERS = $(pkgincludesub_HEADERS)
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
-CC = @CC@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXFLAGS = @CXXFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-EXPAT_CFLAGS = @EXPAT_CFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
-GIVARO_CFLAGS = @GIVARO_CFLAGS@
-GIVARO_LIBS = @GIVARO_LIBS@
-GMP_CFLAGS = @GMP_CFLAGS@
-GMP_LIBS = @GMP_LIBS@
-GMP_VERSION = @GMP_VERSION@
-GREP = @GREP@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIDIA_CFLAGS = @LIDIA_CFLAGS@
-LIDIA_LIBS = @LIDIA_LIBS@
-LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MAPLE_CFLAGS = @MAPLE_CFLAGS@
-MAPLE_HOME = @MAPLE_HOME@
-MAPLE_LIBS = @MAPLE_LIBS@
-MAPLE_VERSION = @MAPLE_VERSION@
-MKDIR_P = @MKDIR_P@
-NMEDIT = @NMEDIT@
-NTL_CFLAGS = @NTL_CFLAGS@
-NTL_LIBS = @NTL_LIBS@
-OBJEXT = @OBJEXT@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-RANLIB = @RANLIB@
-SACLIB_CFLAGS = @SACLIB_CFLAGS@
-SACLIB_LIBS = @SACLIB_LIBS@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-VERSION = @VERSION@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
-am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-pkgincludesubdir = $(pkgincludedir)/fflas
-pkgincludesub_HEADERS = \
-	fflas.h				\
-	fflas_fgemm.inl			\
-	fflas_fgemv.inl			\
-	fflas_fger.inl			\
-	fflas_faxpy.inl			\
-	fflas_fdot.inl			\
-	fflas_ftrsm.inl			\
-	fflas_ftrsm_src.inl		\
-	fflas_ftrmm.inl			\
-	fflas_ftrmm_src.inl		\
-	fflas_ftrsv.inl			\
-	fflas_fcopy.inl			\
-	fflas_bounds.inl
-
-EXTRA_DIST = fflas.doxy
-all: all-am
-
-.SUFFIXES:
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
-	@for dep in $?; do \
-	  case '$(am__configure_deps)' in \
-	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
-	      exit 1;; \
-	  esac; \
-	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps linbox/fflas/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  --ignore-deps linbox/fflas/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-	@case '$?' in \
-	  *config.status*) \
-	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-	esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(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
-
-mostlyclean-libtool:
-	-rm -f *.lo
-
-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 \
-	  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"; \
-	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
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	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; nonemtpy = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	tags=; \
-	here=`pwd`; \
-	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; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
-	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" \
-	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
-
-GTAGS:
-	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
-
-distclean-tags:
-	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	list='$(DISTFILES)'; \
-	  dist_files=`for file in $$list; do echo $$file; done | \
-	  sed -e "s|^$$srcdirstrip/||;t" \
-	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-	case $$dist_files in \
-	  */*) $(MKDIR_P) `echo "$$dist_files" | \
-			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-			   sort -u` ;; \
-	esac; \
-	for file in $$dist_files; do \
-	  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 $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
-	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
-	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
-	    || exit 1; \
-	  fi; \
-	done
-check-am: all-am
-check: check-am
-all-am: Makefile $(HEADERS)
-installdirs:
-	for dir in "$(DESTDIR)$(pkgincludesubdir)"; do \
-	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-	done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-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
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
-	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
-	@echo "This command is intended for maintainers to use"
-	@echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool mostlyclean-am
-
-distclean: distclean-am
-	-rm -f Makefile
-distclean-am: clean-am distclean-generic distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-info: info-am
-
-info-am:
-
-install-data-am: install-pkgincludesubHEADERS
-
-install-dvi: install-dvi-am
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-info: install-info-am
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-ps: install-ps-am
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-	-rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-generic mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-pkgincludesubHEADERS
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
-	clean-libtool ctags distclean distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-pkgincludesubHEADERS install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	tags uninstall uninstall-am uninstall-pkgincludesubHEADERS
-
-# 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/linbox/fflas/fflas.doxy b/linbox/fflas/fflas.doxy
deleted file mode 100644
index 6573df5..0000000
--- a/linbox/fflas/fflas.doxy
+++ /dev/null
@@ -1,13 +0,0 @@
-/** \defgroup fflas linbox/fflas
-
-\brief The C-style wrapper of BLAS for finite field linear algebra.
-
-FFLAS, Finite Field Linear Algebra Subroutines, provide basic linear algebra subroutines based on 
-the BLAS interface. Therefore, the specifications are in C style; only the field given as a 
-template parameter requires C++.
-
-As much as possible, these routines use ATLAS/BLAS computations and achieve therefore high 
-efficiency.
-
-
-*/
diff --git a/linbox/fflas/fflas.h b/linbox/fflas/fflas.h
deleted file mode 100644
index a106a61..0000000
--- a/linbox/fflas/fflas.h
+++ /dev/null
@@ -1,706 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* fflas.h
- * Copyright (C) 2005 Clement Pernet
- *
- * Written by Clement Pernet <Clement.Pernet at imag.fr>
- *
- * See COPYING for license information.
- */
-#include <math.h>
-
-#ifndef __FFLAS_H
-#define __FFLAS_H
-#include <math.h>
-
-#ifndef MAX
-#define MAX(a,b) ((a < b)?b:a)
-#endif
-#ifndef MIN
-#define MIN(a,b) ((a > b)?b:a)
-#endif
-
-#ifdef _LINBOX_LINBOX_CONFIG_H 
-#include "linbox/config-blas.h"
-#include "linbox/field/unparametric.h"
-#include "linbox/field/modular-double.h"
-#include "linbox/field/modular-float.h"
-#include "linbox/field/modular-balanced-double.h"
-#include "linbox/field/modular-balanced-float.h"
-namespace LinBox {
-#else
-#include "config-blas.h"
-#include "fflas-ffpack/unparametric.h"
-#include "fflas-ffpack/modular-positive.h"
-#include "fflas-ffpack/modular-balanced.h"
-#endif
-	
-#ifndef __LINBOX_STRASSEN_OPTIMIZATION
-#define WINOTHRESHOLD 1000
-#else
-#define WINOTHRESHOLD __LINBOX_WINOTHRESHOLD
-#endif
-
-// Thresholds determining which floating point representation to use,
-// depending on the cardinality of the finite field. This is only used when
-// the element representation is not a floating point type.
-#define FLOAT_DOUBLE_THRESHOLD_0 430
-#define FLOAT_DOUBLE_THRESHOLD_1 350
-#define FLOAT_DOUBLE_THRESHOLD_2 175
-	
-#define DOUBLE_MANTISSA 53
-#define FLOAT_MANTISSA 24
-	
-class FFLAS {
-
-public:	
-	enum FFLAS_TRANSPOSE { FflasNoTrans=111, FflasTrans=112};
-	enum FFLAS_UPLO      { FflasUpper=121, FflasLower=122 };
-	enum FFLAS_DIAG      { FflasNonUnit=131, FflasUnit=132 };
-	enum FFLAS_SIDE      { FflasLeft=141, FflasRight = 142 };
-
-	/* Determine the type of the element representation for Matrix Mult kernel
-	 * FflasDouble: to use the double precision BLAS
-	 * FflasFloat: to use the single precison BLAS
-	 * FflasGeneric: for any other domain, that can not be converted to floating point integers
-	 */
-	enum FFLAS_BASE      { FflasDouble = 151, FflasFloat = 152, FflasGeneric = 153};
-
-	/* Representations of Z with floating point elements*/
-	typedef UnparametricField<float> FloatDomain;
-	typedef UnparametricField<double> DoubleDomain;
-
-
-	
-	
-//---------------------------------------------------------------------
-// Level 1 routines
-//---------------------------------------------------------------------
-	//---------------------------------------------------------------------
-	// fscal: X <- alpha.X
-	// X is a vector of size n
-	//---------------------------------------------------------------------
-	template<class Field>
-	static void
-	fscal (const Field& F, const size_t n, const typename Field::Element alpha, 
-	       typename Field::Element * X, const size_t incX){
-		
-		typename Field::Element * Xi = X;
-		for (; Xi < X+n*incX; Xi+=incX )
-			F.mulin( *Xi, alpha );
-	}
-	//---------------------------------------------------------------------
-	// fcopy: x <- y
-	// x,y are vectors of size N
-	//---------------------------------------------------------------------
-	template<class Field>
-	static void
-	fcopy (const Field& F, const size_t N, 
-	       typename Field::Element * X, const size_t incX,
-	       const typename Field::Element * Y, const size_t incY );
-
-	//---------------------------------------------------------------------
-	// faxpy: y <- a.x + y
-	// x,y are vectors of size N
-	//---------------------------------------------------------------------
-	template<class Field>
-	static void
-	faxpy (const Field& F, const size_t N, 
-	       const typename Field::Element a,
-	       const typename Field::Element * X, const size_t incX,
-	       typename Field::Element * Y, const size_t incY );
-
-	//---------------------------------------------------------------------
-	// fdot: returns x^T . y
-	// x and y are vectors of size N
-	//---------------------------------------------------------------------
-	template<class Field>
-	static typename Field::Element
-	fdot (const Field& F, const size_t N, 
-	      const typename Field::Element * X, const size_t incX,
-	      const typename Field::Element * Y, const size_t incY );
-
-	//---------------------------------------------------------------------
-	// fswap: X <-> Y
-	// X,Y are vectors of size N
-	//---------------------------------------------------------------------
-	template<class Field>
-	static void
-	fswap (const Field& F, const size_t N, typename Field::Element * X, const size_t incX,
-	       typename Field::Element * Y, const size_t incY ){
-		
-		typename Field::Element tmp;
-		typename Field::Element * Xi = X;
-		typename Field::Element * Yi=Y;
-		for (; Xi < X+N*incX; Xi+=incX, Yi+=incY ){
-			F.assign( tmp, *Xi );
-			F.assign( *Xi, *Yi );
-			F.assign( *Yi, tmp );
-		}
-	}
-		
-//---------------------------------------------------------------------
-// Level 2 routines
-//---------------------------------------------------------------------
-	/**
-	 *  @brief finite prime Field GEneral Matrix Vector multiplication
-	 *
-	 *  Computes  Y <- alpha op(A).X + beta.Y \\
-	 *  A is m*n
-	 */
-	template<class Field>
-	static void
-	fgemv (const Field& F, const FFLAS_TRANSPOSE TransA, 
-	       const size_t M, const size_t N,
-	       const typename Field::Element alpha, 
-	       const typename Field::Element * A, const size_t lda,
-	       const typename Field::Element * X, const size_t incX, 
-	       const  typename Field::Element beta,
-	       typename Field::Element * Y, const size_t incY);
-
-	/**
-	 *  @brief fger: GEneral ?
-	 *
-	 *  Computes  A <- alpha x . y^T + A \\
-	 *  A is m*n, x and y are vectors of size m and n
-	 */
-	template<class Field>
-	static void
-	fger (const Field& F, const size_t M, const size_t N,
-	      const typename Field::Element alpha, 
-	      const typename Field::Element * x, const size_t incx,
-	      const typename Field::Element * y, const size_t incy, 
-	      typename Field::Element * A, const size_t lda);
-
-	/**
-	   @brief ftrsv: TRiangular System solve with Vector
-	   Computes  X <- op(A^-1).X\\
-	   size of X is N
-	*/
-	template<class Field>
-	static void
-	ftrsv (const Field& F, const FFLAS_UPLO Uplo, 
-	       const FFLAS_TRANSPOSE TransA, const FFLAS_DIAG Diag,
-	       const size_t N,const typename Field::Element * A, const size_t lda,
-	       typename Field::Element * X, int incX);
-	
-//---------------------------------------------------------------------
-// Level 3 routines
-//---------------------------------------------------------------------
-
-	//---------------------------------------------------------------------
-	// ftrsm: TRiangular System solve with matrix
-	// Computes  B <- alpha.op(A^-1).B,  B <- alpha.B.op(A^-1)
-	// B is m*n
-	//---------------------------------------------------------------------
-	template<class Field>
-	static void
-	ftrsm (const Field& F, const FFLAS_SIDE Side,
-	       const FFLAS_UPLO Uplo, 
-	       const FFLAS_TRANSPOSE TransA,
-	       const FFLAS_DIAG Diag, 
-	       const size_t M, const size_t N,
-	       const typename Field::Element alpha,
-	       typename Field::Element * A, const size_t lda,
-	       typename Field::Element * B, const size_t ldb);
-	
-	//---------------------------------------------------------------------
-	// ftrmm: TRiangular Matrix Multiply
-	// Computes  B <- alpha.op(A).B,  B <- alpha.B.op(A)
-	// B is m*n
-	//---------------------------------------------------------------------
-	template<class Field>
-	static void
-	ftrmm (const Field& F, const FFLAS_SIDE Side,
-	       const FFLAS_UPLO Uplo, 
-	       const FFLAS_TRANSPOSE TransA,
-	       const FFLAS_DIAG Diag, 
-	       const size_t M, const size_t N,
-	       const typename Field::Element alpha,
-	       typename Field::Element * A, const size_t lda,
-	       typename Field::Element * B, const size_t ldb);
-	
-	/** @brief  Field GEneral Matrix Multiply 
-	 * 
-	 * Computes C = alpha.op(A)*op(B) + beta.C ,
-	 * op(A) = A, A<sup>T</sup>
-	 * wl recursive levels of Winograd's algorithm are used 
-	 */
-	template<class Field>
-	static typename Field::Element* 
-	fgemm( const Field& F,
-	       const FFLAS_TRANSPOSE ta,
-	       const FFLAS_TRANSPOSE tb,
-	       const size_t m,
-	       const size_t n,
-	       const size_t k,
-	       const typename Field::Element alpha,
-	       const typename Field::Element* A, const size_t lda,
-	       const typename Field::Element* B, const size_t ldb, 
-	       const typename Field::Element beta,
-	       typename Field::Element* C, const size_t ldc,
-	       const size_t w){
-
-		if (!(m && n && k)) return C;
-
-		if (F.isZero (alpha)){
-			for (size_t i = 0; i<m; ++i)
-				fscal(F, n, beta, C + i*ldc, 1);
-			return C;
-		}
-		
-		size_t kmax = 0;
-		size_t winolevel = w;
-		FFLAS_BASE base;
-		MatMulParameters (F, MIN(MIN(m,n),k), beta, kmax, base,
-				  winolevel, true);
-		WinoMain (F, ta, tb, m, n, k, alpha, A, lda, B, ldb, beta,
-				 C, ldc, kmax, winolevel, base);
-		return C;
-		};
-	
-	/** @brief  Field GEneral Matrix Multiply 
-	 * 
-	 * Computes C = alpha.op(A)*op(B) + beta.C ,
-	 * op(A) = A, A<sup>T</sup>
-	 * Automitically set Winograd recursion level
-	 */
-	template<class Field>
-	static typename Field::Element*
-	fgemm (const Field& F,
-	       const FFLAS_TRANSPOSE ta,
-	       const FFLAS_TRANSPOSE tb,
-	       const size_t m,
-	       const size_t n,
-	       const size_t k,
-	       const typename Field::Element alpha,
-	       const typename Field::Element* A, const size_t lda,
-	       const typename Field::Element* B, const size_t ldb, 
-	       const typename Field::Element beta,
-	       typename Field::Element* C, const size_t ldc){
-
-		if (!(m && n && k)) return C;
-		if (F.isZero (alpha)){
-			for (size_t i = 0; i<m; ++i)
-				fscal(F, n, beta, C + i*ldc, 1);
-			return C;
-		}
-		
-		size_t w, kmax;
- 		FFLAS_BASE base;
-
-		MatMulParameters (F, MIN(MIN(m,n),k), beta, kmax, base, w);
-
-		WinoMain (F, ta, tb, m, n, k, alpha, A, lda, B, ldb, beta,
-			  C, ldc, kmax, w, base);
-		return C;
-	}
-
-	//---------------------------------------------------------------------
-	// fsquare: 
-	// compute C = alpha. op(A)*op(A) + beta.C over a Field
-	// op(A) =A, A^T
-	// Avoid the conversion of B 
-	//---------------------------------------------------------------------
-	template<class Field>
-	static typename Field::Element* fsquare (const Field& F,
-						 const FFLAS_TRANSPOSE ta,
-						 const size_t n,
-						 const typename Field::Element alpha,
-						 const typename Field::Element* A, 
-						 const size_t lda,
-						 const typename Field::Element beta,
-						 typename Field::Element* C, 
-						 const size_t ldc);
-	/**
-	 * MatCopy
-	 * Makes a copy of the matrix M into a new allocated space.
-	 */
-	template<class Field>
-	static typename Field::Element* MatCopy (const Field& F,
-						 const size_t M, const size_t N,
-						 const typename Field::Element * A,
-						 const size_t lda){
-
-		typename Field::Element * C = new typename Field::Element[M*N];
-		for (size_t i = 0; i < N; ++i)
-			for (size_t j = 0; j < N; ++j)
-				F.assign(*(C + i*N + j),*(A + i*lda + j));
-		return C;
-	}
-	
-protected:
-
-	// Prevents the instantiation of the class
-	FFLAS(){}
-	template <class X,class Y>
-	class AreEqual
-	{
-	public:
-		static const bool value = false;
-	};
-	
-	template <class X>
-	class AreEqual<X,X>
-	{
-	public:
-		static const bool value = true;
-	};
-
-	//-----------------------------------------------------------------------------
-	// Some conversion functions
-	//-----------------------------------------------------------------------------
-	
-	//---------------------------------------------------------------------
-	// Finite Field matrix => double matrix
-	//---------------------------------------------------------------------
-	template<class Field>
-	static void MatF2MatD (const Field& F,
-			       DoubleDomain::Element* S, const size_t lds,
-			       const typename Field::Element* E,
-			       const size_t lde,const size_t m, const size_t n){
-		
-		const typename Field::Element* Ei = E;
-		DoubleDomain::Element *Si=S;
-		size_t j; 
-		for (; Ei < E+lde*m; Ei+=lde, Si += lds)
-			for ( j=0; j<n; ++j){
-				F.convert(*(Si+j),*(Ei+j));
-			}
-		}
-	//---------------------------------------------------------------------
-	// Finite Field matrix => float matrix
-	//---------------------------------------------------------------------
-	template<class Field>
-	static void MatF2MatFl (const Field& F,
-				FloatDomain::Element* S, const size_t lds,
-				const typename Field::Element* E,
-				const size_t lde,const size_t m, const size_t n){
-		
-		const typename Field::Element* Ei = E;
-		FloatDomain::Element *Si=S;
-		size_t j; 
-		for (; Ei < E+lde*m; Ei+=lde, Si += lds)
-			for ( j=0; j<n; ++j){
-				F.convert(*(Si+j),*(Ei+j));
-			}
-		}
-	
-	//---------------------------------------------------------------------
-	// Finite Field matrix => double matrix
-	// Special design for upper-triangular matrices
-	//---------------------------------------------------------------------
-	template<class Field>
-	static void MatF2MatD_Triangular (const Field& F,
-					  typename DoubleDomain::Element* S, const size_t lds,
-					  const typename Field::Element* const E,
-					  const size_t lde,
-					  const size_t m, const size_t n){
-		
-		const typename Field::Element* Ei = E;
-		typename DoubleDomain::Element* Si = S;
-		size_t i=0, j;
-		for ( ; i<m;++i, Ei+=lde, Si+=lds)
-			for ( j=i; j<n;++j)
-				F.convert(*(Si+j),*(Ei+j));
-	}
-
-	//---------------------------------------------------------------------
-	// Finite Field matrix => float matrix
-	// Special design for upper-triangular matrices
-	//---------------------------------------------------------------------
-	template<class Field>
-	static void MatF2MatFl_Triangular (const Field& F,
-					   typename FloatDomain::Element* S, const size_t lds,
-					   const typename Field::Element* const E,
-					   const size_t lde,
-					   const size_t m, const size_t n){
-		
-		const typename Field::Element* Ei = E;
-		typename FloatDomain::Element* Si = S;
-		size_t i=0, j;
-		for ( ; i<m;++i, Ei+=lde, Si+=lds)
-			for ( j=i; j<n;++j)
-				F.convert(*(Si+j),*(Ei+j));
-	}
-	
-	//---------------------------------------------------------------------
-	// double matrix => Finite Field matrix
-	//---------------------------------------------------------------------
-	template<class Field>
-	static void MatD2MatF (const Field& F,
-			       typename Field::Element* S, const size_t lds,
-			       const typename DoubleDomain::Element* E, const size_t lde,
-			       const size_t m, const size_t n){
-		
-		typename Field::Element* Si = S;
-		const DoubleDomain::Element* Ei =E;
-		size_t j;
-		for ( ; Si < S+m*lds; Si += lds, Ei+= lde){
-			for ( j=0; j<n;++j)
-				F.init( *(Si+j), *(Ei+j) );
-		}
-	}
-
-	//---------------------------------------------------------------------
-	// float matrix => Finite Field matrix
-	//---------------------------------------------------------------------
-	template<class Field>
-	static void MatFl2MatF (const Field& F,
-				typename Field::Element* S, const size_t lds,
-				const typename FloatDomain::Element* E, const size_t lde,
-				const size_t m, const size_t n){
-		
-		typename Field::Element* Si = S;
-		const FloatDomain::Element* Ei =E;
-		size_t j;
-		for ( ; Si < S+m*lds; Si += lds, Ei+= lde){
-			for ( j=0; j<n;++j)
-				F.init( *(Si+j), *(Ei+j) );
-		}
-	}
-
-	/**
-	 * MatMulParameters
-	 *
-	 * \brief Computes the threshold parameters for the cascade
-	 *        Matmul algorithm
-	 *
-	 * 
-	 * \param F Finite Field/Ring of the computation.
-	 * \param k Common dimension of A and B, in the product A x B
-	 * \param bet Computing AB + beta C
-	 * \param delayedDim Returns the size of blocks that can be multiplied
-	 *                   over Z with no overflow
-	 * \param base Returns the type of BLAS representation to use
-	 * \param winoRecLevel Returns the number of recursion levels of
-	 *                     Strassen-Winograd's algorithm to perform
-	 * \param winoLevelProvided tells whether the user forced the number of
-	 *                          recursive level of Winograd's algorithm
-	 *
-	 * See [Dumas, Giorgi, Pernet, arXiv cs/0601133]
-	 * http://arxiv.org/abs/cs.SC/0601133
-	 */
-	template <class Field>
-	static void MatMulParameters (const Field& F,
-				      const size_t k,
-				      const typename Field::Element& beta,
-				      size_t& delayedDim,
-				      FFLAS_BASE& base,
-				      size_t& winoRecLevel,
-				      bool winoLevelProvided=false);
-
-	
-	/**
-	 * DotprodBound
-	 *
-	 * \brief  computes the maximal size for delaying the modular reduction
-	 *         in a dotproduct
-	 *
-	 * This is the default version assuming a conversion to a positive modular representation
-	 * 
-	 * \param F Finite Field/Ring of the computation
-	 * \param winoRecLevel Number of recusrive Strassen-Winograd levels (if any, 0 otherwise)
-	 * \param beta Computing AB + beta C
-	 * \param base Type of floating point representation for delayed modular computations
-	 * 
-	 */
-	template <class Field>
-	static size_t DotProdBound (const Field& F,
-			     const size_t w, 
-			     const typename Field::Element& beta,
-			     const FFLAS_BASE base);
-	
-
-	/**
-	 * Internal function for the bound computation
-	 * Generic implementation for positive representations
-	 */
-	template <class Field>
-	static double computeFactor (const Field& F, const size_t w);
-	
-
-	/**
-	 * Winosteps
-	 *
-	 * \brief Computes the number of recursive levels to perform
-	 *
-	 * \param m the common dimension in the product AxB
-	 */
-	static size_t WinoSteps (const size_t m);
-	
-	/**
-	 * BaseCompute
-	 *
-	 * \brief Determines the type of floating point representation to convert to,
-	 *        for BLAS computations
-	 * \param F Finite Field/Ring of the computation
-	 * \param w Number of recursive levels in Winograd's algorithm
-	 */
-	template <class Field>
-	static FFLAS_BASE BaseCompute (const Field& F, const size_t w);
-		
-	/**
-	 * TRSMBound
-	 *
-	 * \brief  computes the maximal size for delaying the modular reduction
-	 *         in a triangular system resolution
-	 *
-	 *  Compute the maximal dimension k, such that a unit diagonal triangular
-	 *  system of dimension k can be solved over Z without overflow of the
-	 *  underlying floating point representation.
-  	 *  See [Dumas, Giorgi, Pernet 06, arXiv:cs/0601133 ]
-	 * 
-	 * \param F Finite Field/Ring of the computation
-	 * 
-	 */
-	template <class Field>
-	static size_t TRSMBound (const Field& F);
-
-	template <class Field>
-	static void DynamicPealing( const Field& F, 
-				    const FFLAS_TRANSPOSE ta,
-				    const FFLAS_TRANSPOSE tb,
-				    const size_t m, const size_t n, const size_t k,
-				    const typename Field::Element alpha, 
-				    const typename Field::Element* A, const size_t lda,
-				    const typename Field::Element* B, const size_t ldb, 
-				    const typename Field::Element beta,
-				    typename Field::Element* C, const size_t ldc, 
-				    const size_t kmax );
-
-	template<class Field>
-	static void MatVectProd (const Field& F, 
-				 const FFLAS_TRANSPOSE TransA, 
-				 const size_t M, const size_t N,
-				 const typename Field::Element alpha, 
-				 const typename Field::Element * A, const size_t lda,
-				 const typename Field::Element * X, const size_t incX, 
-				 const typename Field::Element beta,
-				 typename Field::Element * Y, const size_t incY);
-
-	template <class Field>
-	static void ClassicMatmul(const Field& F,  
-				  const FFLAS_TRANSPOSE ta,
-				  const FFLAS_TRANSPOSE tb,
-				  const size_t m, const size_t n, const size_t k,
-				  const typename Field::Element alpha,
-				  const typename Field::Element * A, const size_t lda,
-				  const typename Field::Element * B, const size_t ldb,
-				  const typename Field::Element beta,
-				  typename Field::Element * C, const size_t ldc, 
-				  const size_t kmax, const FFLAS_BASE base );
-    
-	// Winograd Multiplication  alpha.A(n*k) * B(k*m) + beta . C(n*m)
-	// WinoCalc performs the 22 Winograd operations
-	template<class Field>
-	static void WinoCalc (const Field& F, 
-			      const FFLAS_TRANSPOSE ta,
-			      const FFLAS_TRANSPOSE tb,
-			      const size_t mr, const size_t nr,const size_t kr,
-			      const typename Field::Element alpha,
-			      const typename Field::Element* A,const size_t lda,
-			      const typename Field::Element* B,const size_t ldb,
-			      const typename Field::Element beta,
-			      typename Field::Element * C, const size_t ldc,
-			      const size_t kmax, const size_t w, const FFLAS_BASE base);
-	
-	template<class Field>
-	static void WinoMain (const Field& F, 
-			      const FFLAS_TRANSPOSE ta,
-			      const FFLAS_TRANSPOSE tb,
-			      const size_t m, const size_t n, const size_t k,
-			      const typename Field::Element alpha,
-			      const typename Field::Element* A,const size_t lda,
-			      const typename Field::Element* B,const size_t ldb,
-			      const typename Field::Element beta,
-			      typename Field::Element * C, const size_t ldc,
-			      const size_t kmax, const size_t w, const FFLAS_BASE base);
-
-	// Specialized routines for ftrsm
-	template <class Element>
-	class ftrsmLeftUpperNoTransNonUnit;
-	template <class Element>
-	class ftrsmLeftUpperNoTransUnit;
-	template <class Element>
-	class ftrsmLeftUpperTransNonUnit;
-	template <class Element>
-	class ftrsmLeftUpperTransUnit;
-	template <class Element>
-	class ftrsmLeftLowerNoTransNonUnit;
-	template <class Element>
-	class ftrsmLeftLowerNoTransUnit;
-	template <class Element>
-	class ftrsmLeftLowerTransNonUnit;
-	template <class Element>
-	class ftrsmLeftLowerTransUnit;
-	template <class Element>
-	class ftrsmRightUpperNoTransNonUnit;
-	template <class Element>
-	class ftrsmRightUpperNoTransUnit;
-	template <class Element>
-	class ftrsmRightUpperTransNonUnit;
-	template <class Element>
-	class ftrsmRightUpperTransUnit;
-	template <class Element>
-	class ftrsmRightLowerNoTransNonUnit;
-	template <class Element>
-	class ftrsmRightLowerNoTransUnit;
-	template <class Element>
-	class ftrsmRightLowerTransNonUnit;
-	template <class Element>
-	class ftrsmRightLowerTransUnit;
-
-	// Specialized routines for ftrmm
-	template <class Element>
-	class ftrmmLeftUpperNoTransNonUnit;
-	template <class Element>
-	class ftrmmLeftUpperNoTransUnit;
-	template <class Element>
-	class ftrmmLeftUpperTransNonUnit;
-	template <class Element>
-	class ftrmmLeftUpperTransUnit;
-	template <class Element>
-	class ftrmmLeftLowerNoTransNonUnit;
-	template <class Element>
-	class ftrmmLeftLowerNoTransUnit;
-	template <class Element>
-	class ftrmmLeftLowerTransNonUnit;
-	template <class Element>
-	class ftrmmLeftLowerTransUnit;
-	template <class Element>
-	class ftrmmRightUpperNoTransNonUnit;
-	template <class Element>
-	class ftrmmRightUpperNoTransUnit;
-	template <class Element>
-	class ftrmmRightUpperTransNonUnit;
-	template <class Element>
-	class ftrmmRightUpperTransUnit;
-	template <class Element>
-	class ftrmmRightLowerNoTransNonUnit;
-	template <class Element>
-	class ftrmmRightLowerNoTransUnit;
-	template <class Element>
-	class ftrmmRightLowerTransNonUnit;
-	template <class Element>
-	class ftrmmRightLowerTransUnit;
-
-}; // class FFLAS
-
-#include "fflas_bounds.inl"
-#include "fflas_fgemm.inl"
-#include "fflas_fgemv.inl"
-#include "fflas_fger.inl"
-#include "fflas_ftrsm.inl"
-#include "fflas_ftrmm.inl"
-#include "fflas_ftrsv.inl"
-#include "fflas_faxpy.inl"
-#include "fflas_fdot.inl"
-#include "fflas_fcopy.inl"
-
-#ifdef _LINBOX_LINBOX_CONFIG_H
-}
-#endif
-
-#endif // __FFLAS_H
-
diff --git a/linbox/fflas/fflas_bounds.inl b/linbox/fflas/fflas_bounds.inl
deleted file mode 100644
index c3a7230..0000000
--- a/linbox/fflas/fflas_bounds.inl
+++ /dev/null
@@ -1,315 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* fflas/fflas_bounds.inl
- * Copyright (C) 2008 Clement Pernet
- *
- * Written by Clement Pernet <Clement.Pernet at imag.fr>
- *
- * See COPYING for license information.
- */
-
-#ifdef _LINBOX_LINBOX_CONFIG_H
-#define FFLAS_INT_TYPE Integer
-#else
-#define FFLAS_INT_TYPE long unsigned int
-#endif
-
-/**
- * MatMulParameters
- *
- * \brief Computes the threshold parameters for the cascade
- *        Matmul algorithm
- *
- * 
- * \param F Finite Field/Ring of the computation.
- * \param k Common dimension of A and B, in the product A x B
- * \param bet Computing AB + beta C
- * \param delayedDim Returns the size of blocks that can be multiplied
- *                   over Z with no overflow
- * \param base Returns the type of BLAS representation to use
- * \param winoRecLevel Returns the number of recursion levels of
- *                     Strassen-Winograd's algorithm to perform
- * \param winoLevelProvided tells whether the user forced the number of
- *                          recursive level of Winograd's algorithm
- */
-template <class Field>
-inline void FFLAS::MatMulParameters (const Field& F,
-				     const size_t k,
-				     const typename Field::Element& beta,
-				     size_t& delayedDim,
-				     FFLAS_BASE& base,
-				     size_t& winoRecLevel,
-				     bool winoLevelProvided) {
-
-	// Strategy : determine Winograd's recursion first, then choose appropriate
-	// floating point representation, and finally the blocking dimension.
-	// Can be improved for some cases.
-
-	if (!winoLevelProvided)
-		winoRecLevel = WinoSteps (k);
-	base = BaseCompute (F, winoRecLevel);
-	delayedDim = DotProdBound (F, winoRecLevel, beta, base);
-
-	size_t n = k;
-	size_t winoDel = winoRecLevel;
-
-	// Computes the delayedDim, only depending on the recursive levels
-	// that must be performed over Z
-	while (winoDel > 0 && delayedDim < n) {
-		winoDel--;
-		delayedDim = DotProdBound (F, winoDel, beta, base);
-		n >>= 1;
-	}
-	delayedDim = MIN (n, delayedDim);
-}
-
-/**
- * DotProdBound
- *
- * \brief  computes the maximal size for delaying the modular reduction
- *         in a dotproduct
- *
- * This is the default version assuming a conversion to a positive modular representation
- * 
- * \param F Finite Field/Ring of the computation
- * \param winoRecLevel Number of recusrive Strassen-Winograd levels (if any, 0 otherwise)
- * \param beta Computing AB + beta C
- * \param base Type of floating point representation for delayed modular computations
- * 
- */
-template <class Field>
-inline size_t FFLAS::DotProdBound (const Field& F,
-				   const size_t w, 
-				   const typename Field::Element& beta,
-				   const FFLAS_BASE base) {
-	
-	FFLAS_INT_TYPE p;
-	F.characteristic(p);
-	typename Field::Element mone;
-	F.init (mone, -1.0);
-
-	unsigned long mantissa =
-		(base == FflasDouble) ? DOUBLE_MANTISSA : FLOAT_MANTISSA;
-
-	if (p == 0)
-		return 1;
-	
-	double kmax;
-	if (w > 0) {
-		double c = computeFactor (F,w);
-		double d = (double (1ULL << mantissa) /(c*c) + 1);
-		if (d < 2)
-			return 1;
-		kmax = floor (d * (1ULL << w));
-	} else {
-		////// A fixer: (p-1)/2 si balanced
-
-		double c = p-1;
-		double cplt=0;
-		if (!F.isZero (beta)){
-			if (F.isOne (beta) || F.areEqual (beta, mone)) cplt = c;
-			else cplt = c*c;
-		}
-		kmax = floor ( (double ((1ULL << mantissa) - cplt)) / (c*c));
-		if (kmax  <= 1)
-			return 1;
-		}
-	//kmax--; // we computed a strict upper bound
-	return  (size_t) MIN (kmax, 1ULL << 31);
-}
-
-/**
- * Internal function for the bound computation
- * Generic implementation for positive representations
- */
-template <class Field>
-inline double FFLAS::computeFactor (const Field& F, const size_t w){
-	FFLAS_INT_TYPE p;
-	F.characteristic(p);
-	size_t ex=1;
-	for (size_t i=0; i < w; ++i) 	ex *= 3;
-	return double(p - 1) * (1 + ex) / 2;
-}
-
-/**
- * WinoSteps
- *
- * \brief Computes the number of recursive levels to perform
- *
- * \param m the common dimension in the product AxB
- * 
- */
-inline size_t FFLAS::WinoSteps (const size_t m) {
-	size_t w = 0;
-	size_t mt = m;
-	while (mt >= WINOTHRESHOLD) {w++; mt >>= 1;}
-	return w;
-}
-
-/**
- * BaseCompute
- *
- * \brief Determines the type of floating point representation to convert to,
- *        for BLAS computations
- * \param F Finite Field/Ring of the computation
- * \param w Number of recursive levels in Winograd's algorithm
- * 
- */
-template <class Field>
-inline FFLAS::FFLAS_BASE FFLAS::BaseCompute (const Field& F, const size_t w){
-	
-	FFLAS_INT_TYPE pi;
-	F.characteristic(pi);
-	FFLAS_BASE base;
-	switch (w) {
-	case 0: base = (pi < FLOAT_DOUBLE_THRESHOLD_0)? FflasFloat : FflasDouble;
-		break;
-	case 1:  base = (pi < FLOAT_DOUBLE_THRESHOLD_1)? FflasFloat : FflasDouble;
-		break;
-	case 2:  base = (pi < FLOAT_DOUBLE_THRESHOLD_2)? FflasFloat : FflasDouble;
-		break;
-	default: base = FflasDouble;
-		break;
-	}
-	return base;
-}
-
-
-/*************************************************************************************
- * Specializations for ModularPositive and ModularBalanced over double and float
- *************************************************************************************/
-
-template <class Element>
-inline double computeFactor (const ModularBalanced<Element>& F, const size_t w){
-	FFLAS_INT_TYPE p;
-	F.characteristic(p);
-	size_t ex=1;
-	for (size_t i=0; i < w; ++i) 	ex *= 3;
-	return  (p - 1) * ex / 2; 
-}
-
-template <>
-inline FFLAS::FFLAS_BASE FFLAS::BaseCompute (const Modular<double>& F,
-					     const size_t w){
-	return FflasDouble;
-}
-
-template <>
-inline FFLAS::FFLAS_BASE FFLAS::BaseCompute (const Modular<float>& F,
-					     const size_t w){
-	return FflasFloat;
-}
-
-template <>
-inline FFLAS::FFLAS_BASE FFLAS::BaseCompute (const ModularBalanced<double>& F,
-					     const size_t w){
-	return FflasDouble;
-}
-
-template <>
-inline FFLAS::FFLAS_BASE FFLAS::BaseCompute (const ModularBalanced<float>& F,
-					     const size_t w){
-	return FflasFloat;
-}
-
-/**
- * TRSMBound
- *
- * \brief  computes the maximal size for delaying the modular reduction
- *         in a triangular system resolution
- *
- * This is the default version over an arbitrary field.
- * It is currently never used (the recursive algorithm is run until n=1 in this case)
- * 
- * \param F Finite Field/Ring of the computation
- * 
- */
-template <class Field>
-inline size_t FFLAS::TRSMBound (const Field& F) {
-	return 1;	
-}
-
-/**
- * Specialization for positive modular representation over double
- * Computes nmax s.t. (p-1)/2*(p^{nmax-1} + (p-2)^{nmax-1}) < 2^53
- * See [Dumas Giorgi Pernet 06, arXiv:cs/0601133]
- */
-template<>
-inline size_t FFLAS::TRSMBound (const Modular<double>& F){
-
-	FFLAS_INT_TYPE pi;
-	F.characteristic(pi);
-	unsigned long long p = pi, p1 = 1, p2 = 1;
-	size_t nmax = 0;
-	unsigned long long max = ( (1ULL << (DOUBLE_MANTISSA + 1) ) / (p - 1));
-	while ( (p1 + p2) < max ){
-		p1*=p;
-		p2*=p-2;
-		nmax++;
-	}
-	return nmax;
-}
-
-
-/**
- * Specialization for positive modular representation over float
- * Computes nmax s.t. (p-1)/2*(p^{nmax-1} + (p-2)^{nmax-1}) < 2^24
- * See [Dumas Giorgi Pernet 06, arXiv:cs/0601133]
- */
-template<>
-inline size_t FFLAS::TRSMBound (const Modular<float>& F){
-
-	FFLAS_INT_TYPE pi;
-	F.characteristic(pi);
-	unsigned long long p = pi, p1 = 1, p2 = 1;
-	size_t nmax = 0;
-	unsigned long long max = ( (1ULL << (FLOAT_MANTISSA + 1) ) / (p - 1));
-	while ( (p1 + p2) < max ){
-		p1*=p;
-		p2*=p-2;
-		nmax++;
-	}
-	return nmax;
-}
-
-/**
- * Specialization for balanced modular representation over double
- * Computes nmax s.t. (p-1)/2*(((p+1)/2)^{nmax-1}) < 2^53
- * See [Dumas Giorgi Pernet 06, arXiv:cs/0601133]
- */
-template<>
-inline size_t FFLAS::TRSMBound (const ModularBalanced<double>& F){
-
-	FFLAS_INT_TYPE pi;
-	F.characteristic (pi);
-	unsigned long long p = (pi + 1) / 2, p1 = 1;
-	size_t nmax = 0;
-	unsigned long long max = ((1ULL << (DOUBLE_MANTISSA + 1)) / ((unsigned long long)(p - 1)));
-	while (p1 < max){
-		p1 *= p;
-		nmax++;
-	}
-	return nmax;
-}
-
-/**
- * Specialization for balanced modular representation over float
- * Computes nmax s.t. (p-1)/2*(((p+1)/2)^{nmax-1}) < 2^24
- * See [Dumas Giorgi Pernet 06, arXiv:cs/0601133]
- */
-template<>
-inline size_t FFLAS::TRSMBound (const ModularBalanced<float>& F){
-
-	FFLAS_INT_TYPE pi;
-	F.characteristic (pi);
-	unsigned long long p = (pi + 1) / 2, p1 = 1;
-	size_t nmax = 0;
-	unsigned long long max = ((1ULL << (FLOAT_MANTISSA + 1)) / ((unsigned long long) (pi - 1)));
-	while (p1 < max){
-		p1 *= p;
-		nmax++;
-	}
-	return nmax;
-
-}
-
diff --git a/linbox/fflas/fflas_faxpy.inl b/linbox/fflas/fflas_faxpy.inl
deleted file mode 100644
index d319901..0000000
--- a/linbox/fflas/fflas_faxpy.inl
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* fflas/fflas_fger.inl
- * Copyright (C) 2005 Clement Pernet
- *
- * Written by Clement Pernet <Clement.Pernet at imag.fr>
- *
- * See COPYING for license information.
- */
-template<class Field>
-inline void
-FFLAS::faxpy( const Field& F, const size_t N, 
-		      const typename Field::Element a,
-		      const typename Field::Element * X, const size_t incX,
-		      typename Field::Element * Y, const size_t incY ){
-
-	const typename Field::Element * Xi = X;
-	typename Field::Element * Yi=Y;
-	for (; Xi < X+N*incX; Xi+=incX, Yi+=incY )
-		F.axpyin( *Yi, a, *Xi );
-}
-
-template<>
-inline void
-FFLAS::faxpy( const DoubleDomain& D, const size_t N, 
-		      const DoubleDomain::Element a,
-		      const DoubleDomain::Element * x, const size_t incx,
-		      DoubleDomain::Element * y, const size_t incy ){
-
-	cblas_daxpy( N, a, x, incx, y, incy);
-}
-
diff --git a/linbox/fflas/fflas_fcopy.inl b/linbox/fflas/fflas_fcopy.inl
deleted file mode 100644
index c2b9a88..0000000
--- a/linbox/fflas/fflas_fcopy.inl
+++ /dev/null
@@ -1,22 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* fflas/fflas_fcopy.inl
- * Copyright (C) 2007 Clement Pernet
- *
- * Written by Clement Pernet <Clement.Pernet at imag.fr>
- *
- * See COPYING for license information.
- */
-
-template<class Field>
-inline void
-FFLAS::fcopy (const Field& F, const size_t N, 
-	      typename Field::Element * X, const size_t incX,
-	      const typename Field::Element * Y, const size_t incY ){
-	
-	typename Field::Element * Xi = X;
-	const typename Field::Element * Yi=Y;
-	for (; Xi < X+N*incX; Xi+=incX, Yi+=incY )
-		F.assign(*Xi,*Yi);
-}
-
diff --git a/linbox/fflas/fflas_fdot.inl b/linbox/fflas/fflas_fdot.inl
deleted file mode 100644
index e2c98d6..0000000
--- a/linbox/fflas/fflas_fdot.inl
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* fflas_fdot.inl
- * Copyright (C) 2005 Clement Pernet
- *
- * Written by Clement Pernet <Clement.Pernet at imag.fr>
- *
- * See COPYING for license information.
- */
-// Default implementation
-// Specializations should be written
-// to increase efficiency
-template<class Field>
-inline typename Field::Element
-FFLAS::fdot( const Field& F, const size_t N, 
-		     const typename Field::Element * x, const size_t incx,
-		     const typename Field::Element * y, const size_t incy ){
-	
-	typename Field::Element d;
-	const typename Field::Element* xi = x;
-	const typename Field::Element* yi = y;
-	F.init( d, 0 );
-	for ( ; xi < x+N*incx; xi+=incx, yi+=incy )
-		F.axpyin( d, *xi, *yi );
-	return d;
-}
-
-template<>
-inline FFLAS::DoubleDomain::Element
-FFLAS::fdot( const DoubleDomain& F, const size_t N, 
-	     const DoubleDomain::Element * x, const size_t incx,
-	     const DoubleDomain::Element * y, const size_t incy ){
-	
-	return cblas_ddot( N, x, incx, y, incy );
-}
-
diff --git a/linbox/fflas/fflas_fgemm.inl b/linbox/fflas/fflas_fgemm.inl
deleted file mode 100644
index 75a65c7..0000000
--- a/linbox/fflas/fflas_fgemm.inl
+++ /dev/null
@@ -1,1683 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* fflas/fflas_fgemm.inl
- * Copyright (C) 2005 Clement Pernet
- *
- * Written by Clement Pernet  < Clement.Pernet at imag.fr > 
- *
- * See COPYING for license information.
- */
-
-#ifndef MAX
-#define MAX(a,b) (a < b)?b:a
-#endif
-#ifndef MIN
-#define MIN(a,b) (a > b)?b:a
-#endif
-
-
-
-
-// Note:
-// The domain is supposed to be a field since some divisions are required for efficiency purposes
-// An alternative has to be written for finite rings if necessary
-
-// Classic Multiplication over double
-// Classic multiplication over a finite field
-template  < class Field > 
-inline void FFLAS::ClassicMatmul (const Field& F,  
-				  const FFLAS_TRANSPOSE ta,
-				  const FFLAS_TRANSPOSE tb,
-				  const size_t m, const size_t n,const size_t k,
-				  const typename Field::Element alpha,
-				  const typename Field::Element * A, const size_t lda,
-				  const typename Field::Element * B, const size_t ldb,
-				  const typename Field::Element beta,
-				  typename Field::Element* C, const size_t ldc,
-				  const size_t kmax, const FFLAS_BASE base) {
-	typename Field::Element Mone;
-	typename Field::Element one;
-	typename Field::Element zero;
-	F.init(one, 1.0);
-	F.neg(Mone, one);
-	F.init(zero, 0.0);
-	typename Field::Element tmp;
-	
-	size_t k2 = MIN(k,kmax); // Size of the blocks
-	
-	if (k2 > 1) {
-		if (base == FflasDouble){
-			DoubleDomain::Element alphad, betad;
-			DoubleDomain::Element * Add = new DoubleDomain::Element[m*k2];
-			DoubleDomain::Element * Bdd = new DoubleDomain::Element[k2*n];
-			DoubleDomain::Element * Cd = new DoubleDomain::Element[m*n];
-	
-			size_t nblock = k / kmax;
-			size_t remblock = k % kmax;
-			if (!remblock) {
-				remblock = kmax ;
-				--nblock;
-			}
-			if (F.areEqual (Mone, beta)) betad = -1.0;
-			else F.convert (betad, beta);
-	
-			if (F.areEqual (Mone, alpha)) alphad = -1.0;
-			else {
-				alphad = 1.0;
-				if (! F.areEqual (one, alpha)) {
-					// Compute y = A*x + beta/alpha.y
-					// and after y *= alpha
-					F.div (tmp, beta, alpha);
-					F.convert (betad, tmp);
-				}
-			}
-	
-			size_t dlda, dldb;
-			if (!F.isZero(beta))
-				MatF2MatD (F, Cd, n, C, ldc, m, n); 
-
-			if (ta == FflasTrans) { 
-				dlda = m; 
-				MatF2MatD (F, Add, dlda, A+k2*nblock*lda, lda, remblock, m); 
-			} else { 
-				dlda = k2; 
-				MatF2MatD (F, Add, dlda, A+k2*nblock, lda, m, remblock);	
-			}
-			if (tb == FflasTrans) { 
-				dldb = k2; 
-				MatF2MatD (F, Bdd, k2, B+k2*nblock, ldb, n, remblock); 
-			} else { 
-				dldb = n; 
-				MatF2MatD (F, Bdd, dldb, B+k2*nblock*ldb, ldb, remblock, n); 
-			}
-	
-			ClassicMatmul (DoubleDomain(), ta, tb, m, n, remblock, alphad, Add, dlda,
-				       Bdd, dldb, betad, Cd, n, kmax,base );
-
-			MatD2MatF (F, C, ldc, Cd, n, m, n);
-			MatF2MatD (F, Cd, n, C, ldc, m, n);
-			
-			for (size_t i = 0; i < nblock; ++i) {
-				if (ta == FflasTrans) MatF2MatD (F, Add, dlda, A+k2*i*lda, lda, k2, m); 
-				else MatF2MatD (F, Add, dlda,  A+k2*i, lda, m, k2); 
-				
-				if (tb == FflasTrans) MatF2MatD (F, Bdd, dldb, B+k2*i, ldb, n, k2); 
-				else MatF2MatD (F, Bdd, dldb, B+k2*i*ldb, ldb, k2, n);
-				
-				ClassicMatmul (DoubleDomain(), ta, tb, m, n, k2, alphad, Add, dlda,
-					       Bdd, dldb, 1.0, Cd, n, kmax,base);
-				MatD2MatF (F, C, ldc, Cd, n, m, n);
-				MatF2MatD (F, Cd, n, C, ldc, m, n);
-			}
-			if ((!F.areEqual (one, alpha)) && (!F.areEqual (Mone, alpha))) 
-				for (typename Field::Element * Ci = C; Ci < C+m*ldc; Ci += ldc)
-					for (size_t j = 0; j < n; ++j) 
-						F.mulin (* (Ci + j), alpha);
-			delete[] Add;
-			delete[] Bdd;
-			delete[] Cd;
-		} else {
-			FloatDomain::Element alphad, betad;
-			FloatDomain::Element * Add = new FloatDomain::Element[m*k2];
-			FloatDomain::Element * Bdd = new FloatDomain::Element[k2*n];
-			FloatDomain::Element * Cd = new FloatDomain::Element[m*n];
-	
-			size_t nblock = k / kmax;
-			size_t remblock = k % kmax;
-			if (!remblock) {
-				remblock = kmax;
-				--nblock;
-			}
-			if (F.areEqual (Mone, beta)) betad = -1.0;
-			else F.convert (betad, beta);
-	
-			if (F.areEqual (Mone, alpha)) alphad = -1.0;
-			else {
-				alphad = 1.0;
-				if (! F.areEqual (one, alpha)) {
-					// Compute y = A*x + beta/alpha.y
-					// and after y *= alpha
-					F.div (tmp, beta, alpha);
-					F.convert (betad, tmp);
-				}
-			}
-	
-			size_t dlda, dldb;
-			if (!F.isZero(beta))
-				MatF2MatFl (F, Cd, n, C, ldc, m, n); 
-
-			if (ta == FflasTrans) { 
-				dlda = m; 
-				MatF2MatFl (F, Add, dlda, A+k2*nblock*lda, lda, remblock, m); 
-			} else { 
-				dlda = k2; 
-				MatF2MatFl (F, Add, dlda, A+k2*nblock, lda, m, remblock);	
-			}
-			if (tb == FflasTrans) { 
-				dldb = k2; 
-				MatF2MatFl (F, Bdd, k2, B+k2*nblock, ldb, n, remblock); 
-			} else { 
-				dldb = n; 
-				MatF2MatFl (F, Bdd, dldb, B+k2*nblock*ldb, ldb, remblock, n); 
-			}
-	
-			ClassicMatmul (FloatDomain(), ta, tb, m, n, remblock, alphad, Add, dlda,
-				       Bdd, dldb, betad, Cd, n, kmax,base );
-			MatFl2MatF (F, C, ldc, Cd, n, m, n);
-			MatF2MatFl (F, Cd, n, C, ldc, m, n);
-			for (size_t i = 0; i < nblock; ++i) {
-				if (ta == FflasTrans) MatF2MatFl (F, Add, dlda, A+k2*i*lda, lda, k2, m); 
-				else MatF2MatFl (F, Add, dlda,  A+k2*i, lda, m, k2); 
-				if (tb == FflasTrans) MatF2MatFl (F, Bdd, dldb, B+k2*i, ldb, n, k2); 
-				else MatF2MatFl (F, Bdd, dldb, B+k2*i*ldb, ldb, k2, n);
-				
-				ClassicMatmul (FloatDomain(), ta, tb, m, n, k2, alphad, Add, dlda,
-					       Bdd, dldb, 1.0, Cd, n, kmax,base);
-				MatFl2MatF (F, C, ldc, Cd, n, m, n);
-				MatF2MatFl (F, Cd, n, C, ldc, m, n);
-			}
-			if ((!F.areEqual (one, alpha)) && (!F.areEqual (Mone, alpha))) {
-				for (typename Field::Element * Ci = C; Ci < C+m*ldc; Ci += ldc)
-					for (size_t j = 0; j < n; ++j) 
-						F.mulin (* (Ci + j), alpha);
-			}
-			delete[] Add;
-			delete[] Bdd;
-			delete[] Cd;
-		} 
-	} else { // k2 == 1
-		// Standard algorithm is performed over the Field, without conversion
-		if (F.isZero (beta))
-			for (size_t i = 0; i < m; ++i)
-				for (size_t j = 0; j < n; ++j) 
-					F.assign (*(C+i*ldc+j), zero);
-		else {
-			typename Field::Element betadivalpha;
-			F.div (betadivalpha, beta, alpha); 
-			for (size_t i = 0; i < m; ++i)
-				for (size_t j = 0; j < n; ++j) 
-					F.mulin (*(C+i*ldc+j), betadivalpha);
-		}
-		if (ta == FflasNoTrans) 
-			if (tb == FflasNoTrans)
-				for (size_t i = 0; i < m; ++i)
-					for (size_t l = 0; l < k; ++l)
-						for (size_t j = 0; j < n; ++j) 
-							F.axpyin (*(C+i*ldc+j), *(A+i*lda+l), *(B+l*ldb+j));
-			else 
-				for (size_t i = 0; i < m; ++i)
-					for (size_t j = 0; j < n; ++j) 
-						for (size_t l = 0; l < k; ++l)
-							F.axpyin (*(C+i*ldc+j), *(A+i*lda+l), *(B+j*ldb+l));
-		else
-			if (tb == FflasNoTrans)
-				for (size_t i = 0; i < m; ++i)
-					for (size_t l = 0; l < k; ++l)
-						for (size_t j = 0; j < n; ++j) 
-							F.axpyin (*(C+i*ldc+j), *(A+l*lda+i), *(B+l*ldb+j));
-			else 
-				for (size_t i = 0; i < m; ++i)
-					for (size_t j = 0; j < n; ++j) 
-						for (size_t l = 0; l < k; ++l)
-							F.axpyin (*(C+i*ldc+j), *(A+l*lda+i), *(B+j*ldb+l));
-		if (! F.isOne(alpha))
-			for (size_t i = 0; i < m; ++i)
-				for (size_t j = 0; j < n; ++j) 
-					F.mulin (*(C+i*ldc+j), alpha);
-	}
-}
-
-template  <> 
-inline void FFLAS::ClassicMatmul (const DoubleDomain& F, 
-				  const FFLAS_TRANSPOSE ta,
-				  const FFLAS_TRANSPOSE tb,
-				  const size_t m, const size_t n,const size_t k,
-				  const DoubleDomain::Element alpha,
-				  const DoubleDomain::Element * Ad, const size_t lda,
-				  const DoubleDomain::Element * Bd, const size_t ldb,
-				  const DoubleDomain::Element beta,
-				  DoubleDomain::Element * Cd, const size_t ldc,
-				  const size_t kmax, const FFLAS_BASE base)
-{
-	cblas_dgemm (CblasRowMajor, (CBLAS_TRANSPOSE) ta, (CBLAS_TRANSPOSE) tb,
-		     m, n, k, (DoubleDomain::Element) alpha,
-		     Ad, lda, Bd, ldb, (DoubleDomain::Element) beta,Cd, ldc);
-}
-
-template  <> 
-inline void FFLAS::ClassicMatmul (const FloatDomain& F, 
-				  const FFLAS_TRANSPOSE ta,
-				  const FFLAS_TRANSPOSE tb,
-				  const size_t m, const size_t n,const size_t k,
-				  const FloatDomain::Element alpha,
-				  const FloatDomain::Element * Ad, const size_t lda,
-				  const FloatDomain::Element * Bd, const size_t ldb,
-				  const FloatDomain::Element beta,
-				  FloatDomain::Element * Cd, const size_t ldc,
-				  const size_t kmax, const FFLAS_BASE base)
-{
-	cblas_sgemm (CblasRowMajor, (CBLAS_TRANSPOSE) ta, (CBLAS_TRANSPOSE) tb,
-		     m, n, k, (FloatDomain::Element) alpha,
-		     Ad, lda, Bd, ldb, (FloatDomain::Element) beta,Cd, ldc);
-}
-
-template <>
-inline void FFLAS::ClassicMatmul (const ModularBalanced<double> & F,  
-				  const FFLAS_TRANSPOSE ta,
-				  const FFLAS_TRANSPOSE tb,
-				  const size_t m, const size_t n,const size_t k,
-				  const double alpha, 
-				  const double * A, const size_t lda,
-				  const double * B, const size_t ldb,
-				  const double beta,
-				  double* C, const size_t ldc, 
-				  const size_t kmax, const FFLAS_BASE base) {
-	double Mone, one, _alpha, _beta;
-	F.init(one, 1.0);
-	F.neg(Mone, one);
-	// To ensure the initial computation with beta
-	size_t k2 = MIN(k,kmax);
-	size_t nblock = k / kmax;
-	size_t remblock = k % kmax;
-	if (!remblock) {
-		remblock = kmax;
-		--nblock;
-	}
-	if (F.areEqual (Mone, beta)) _beta = -1.0;
-	else _beta = beta;
-	if (F.areEqual (Mone, alpha)) _alpha = -1.0;
-	else{
-		_alpha = 1.0;
-		if (! F.areEqual (one, alpha)) {
-			// Compute y = A*x + beta/alpha.y
-			// and after y *= alpha
-			F.divin (_beta, alpha);
-		}
-	}
-	size_t shiftA, shiftB;
-	if (ta == FflasTrans) shiftA = k2*lda;
-	else shiftA = k2;
-	if (tb == FflasTrans) shiftB = k2;
-	else shiftB = k2*ldb;
-
-	ClassicMatmul (DoubleDomain(), ta, tb, m, n, remblock, _alpha, A+nblock*shiftA, lda,
-		       B+nblock*shiftB, ldb, _beta, C, ldc, kmax,base );
-	for (double * Ci = C; Ci != C+m*ldc; Ci += ldc)
-		for (size_t j=0; j < n;++j)
-			F.init(*(Ci+j),*(Ci+j));
-	for (size_t i = 0; i < nblock; ++i) {
-		ClassicMatmul (DoubleDomain(), ta, tb, m, n, k2, _alpha, A+i*shiftA, lda,
-			       B+i*shiftB, ldb, one, C, ldc, kmax,base);
-		for (double * Ci = C; Ci != C+m*ldc; Ci += ldc)
-			for (size_t j=0; j < n;++j)
-				F.init(*(Ci+j),*(Ci+j));
-	}
-	if ((!F.areEqual (one, alpha)) && (!F.areEqual (Mone, alpha))) {
-		for (double * Ci = C; Ci < C+m*ldc; Ci += ldc)
-			for (size_t j = 0; j < n; ++j) 
-				F.mulin (* (Ci + j), alpha);
-	}
-}
-
-
-template <>
-inline void FFLAS::ClassicMatmul (const ModularBalanced<float> & F,  
-				  const FFLAS_TRANSPOSE ta,
-				  const FFLAS_TRANSPOSE tb,
-				  const size_t m, const size_t n,const size_t k,
-				  const float alpha, 
-				  const float * A, const size_t lda,
-				  const float * B, const size_t ldb,
-				  const float beta,
-				  float* C, const size_t ldc, 
-				  const size_t kmax, const FFLAS_BASE base) {
-	float Mone, one, _alpha, _beta;
-	F.init(one, 1.0);
-	F.neg(Mone, one);
-	// To ensure the initial computation with beta
-	size_t k2 = MIN(k,kmax);
-	size_t nblock = k / kmax;
-	size_t remblock = k % kmax;
-	if (!remblock) {
-		remblock = kmax;
-		--nblock;
-	}
-	if (F.areEqual (Mone, beta)) _beta = -1.0;
-	else _beta = beta;
-	if (F.areEqual (Mone, alpha)) _alpha = -1.0;
-	else{
-		_alpha = 1.0;
-		if (! F.areEqual (one, alpha)) {
-			// Compute y = A*x + beta/alpha.y
-			// and after y *= alpha
-			F.divin (_beta, alpha);
-		}
-	}
-	size_t shiftA, shiftB;
-	if (ta == FflasTrans) shiftA = k2*lda;
-	else shiftA = k2;
-	if (tb == FflasTrans) shiftB = k2;
-	else shiftB = k2*ldb;
-
-	ClassicMatmul (FloatDomain(), ta, tb, m, n, remblock, _alpha, A+nblock*shiftA, lda,
-		       B+nblock*shiftB, ldb, _beta, C, ldc, kmax,base);
-	for (float * Ci = C; Ci != C+m*ldc; Ci += ldc)
-		for (size_t j=0; j < n;++j)
-			F.init(*(Ci+j),*(Ci+j));
-	for (size_t i = 0; i < nblock; ++i) {
-		ClassicMatmul (FloatDomain(), ta, tb, m, n, k2, _alpha, A+i*shiftA, lda,
-			       B+i*shiftB, ldb, one, C, ldc, kmax,base);
-		for (float * Ci = C; Ci != C+m*ldc; Ci += ldc)
-			for (size_t j=0; j < n;++j)
-				F.init(*(Ci+j),*(Ci+j));
-	}
-	if ((!F.areEqual (one, alpha)) && (!F.areEqual (Mone, alpha))) {
-		for (float * Ci = C; Ci < C+m*ldc; Ci += ldc)
-			for (size_t j = 0; j < n; ++j) 
-				F.mulin (* (Ci + j), alpha);
-	}
-}
-
-
-template <>
-inline void FFLAS::ClassicMatmul (const Modular<double> & F,  
-				  const FFLAS_TRANSPOSE ta,
-				  const FFLAS_TRANSPOSE tb,
-				  const size_t m, const size_t n,const size_t k,
-				  const double alpha, 
-				  const double * A, const size_t lda,
-				  const double * B, const size_t ldb,
-				  const double beta,
-				  double* C, const size_t ldc, 
-				  const size_t kmax, const FFLAS_BASE base) {
-	double Mone, one, _alpha, _beta;
-	F.init(one, 1.0);
-	F.neg(Mone, one);
-	// To ensure the initial computation with beta
-	size_t k2 = MIN(k,kmax);
-	size_t nblock = k / kmax;
-	size_t remblock = k % kmax;
-	if (!remblock) {
-		remblock = kmax;
-		--nblock;
-	}
-	if (F.areEqual (Mone, beta)) _beta = -1.0;
-	else _beta = beta;
-	if (F.areEqual (Mone, alpha)) _alpha = -1.0;
-	else{
-		_alpha = 1.0;
-		if (! F.areEqual (one, alpha)) {
-			// Compute y = A*x + beta/alpha.y
-			// and after y *= alpha
-			F.divin (_beta, alpha);
-		}
-	}
-	size_t shiftA, shiftB;
-	if (ta == FflasTrans) shiftA = k2*lda;
-	else shiftA = k2;
-	if (tb == FflasTrans) shiftB = k2;
-	else shiftB = k2*ldb;
-
-	ClassicMatmul (DoubleDomain(), ta, tb, m, n, remblock, _alpha, A+nblock*shiftA, lda,
-		       B+nblock*shiftB, ldb, _beta, C, ldc, kmax,base );
-	for (double * Ci = C; Ci != C+m*ldc; Ci += ldc)
-		for (size_t j=0; j < n;++j)
-			F.init(*(Ci+j),*(Ci+j));
-	for (size_t i = 0; i < nblock; ++i) {
-		ClassicMatmul (DoubleDomain(), ta, tb, m, n, k2, _alpha, A+i*shiftA, lda,
-			       B+i*shiftB, ldb, one, C, ldc, kmax,base);
-		for (double * Ci = C; Ci != C+m*ldc; Ci += ldc)
-			for (size_t j=0; j < n;++j)
-				F.init(*(Ci+j),*(Ci+j));
-	}
-	if ((!F.areEqual (one, alpha)) && (!F.areEqual (Mone, alpha))) {
-		for (double * Ci = C; Ci < C+m*ldc; Ci += ldc)
-			for (size_t j = 0; j < n; ++j) 
-				F.mulin (* (Ci + j), alpha);
-	}
-}
-
-template <>
-inline void FFLAS::ClassicMatmul (const Modular<float> & F,  
-				  const FFLAS_TRANSPOSE ta,
-				  const FFLAS_TRANSPOSE tb,
-				  const size_t m, const size_t n,const size_t k,
-				  const float alpha, 
-				  const float * A, const size_t lda,
-				  const float * B, const size_t ldb,
-				  const float beta,
-				  float* C, const size_t ldc, 
-				  const size_t kmax, const FFLAS_BASE base) {
-	float Mone, one, _alpha, _beta;
-	F.init(one, 1.0);
-	F.neg(Mone, one);
-	// To ensure the initial computation with beta
-	size_t k2 = MIN(k,kmax);
-	size_t nblock = k / kmax;
-	size_t remblock = k % kmax;
-	if (!remblock) {
-		remblock = kmax;
-		--nblock;
-	}
-	if (F.areEqual (Mone, beta)) _beta = -1.0;
-	else _beta = beta;
-	if (F.areEqual (Mone, alpha)) _alpha = -1.0;
-	else{
-		_alpha = 1.0;
-		if (! F.areEqual (one, alpha)) {
-			// Compute y = A*x + beta/alpha.y
-			// and after y *= alpha
-			F.divin (_beta, alpha);
-		}
-	}
-	size_t shiftA, shiftB;
-	if (ta == FflasTrans) shiftA = k2*lda;
-	else shiftA = k2;
-	if (tb == FflasTrans) shiftB = k2;
-	else shiftB = k2*ldb;
-
-	ClassicMatmul (FloatDomain(), ta, tb, m, n, remblock, _alpha, A+nblock*shiftA, lda,
-		       B+nblock*shiftB, ldb, _beta, C, ldc, kmax,base);
-	for (float * Ci = C; Ci != C+m*ldc; Ci += ldc)
-		for (size_t j=0; j < n;++j)
-			F.init(*(Ci+j),*(Ci+j));
-	for (size_t i = 0; i < nblock; ++i) {
-		ClassicMatmul (FloatDomain(), ta, tb, m, n, k2, _alpha, A+i*shiftA, lda,
-			       B+i*shiftB, ldb, one, C, ldc, kmax,base);
-		for (float * Ci = C; Ci != C+m*ldc; Ci += ldc)
-			for (size_t j=0; j < n;++j)
-				F.init(*(Ci+j),*(Ci+j));
-	}
-	if ((!F.areEqual (one, alpha)) && (!F.areEqual (Mone, alpha))) {
-		for (float * Ci = C; Ci < C+m*ldc; Ci += ldc)
-			for (size_t j = 0; j < n; ++j) 
-				F.mulin (* (Ci + j), alpha);
-	}
-}
-
-
-// Winograd Multiplication  A(n*k) * B(k*m) in C(n*m)
-// Computation of the 22 Winograd's operations
-template < class Field > 
-inline void FFLAS::WinoCalc (const Field& F, 
-			     const FFLAS_TRANSPOSE ta,
-			     const FFLAS_TRANSPOSE tb,
-			     const size_t mr, const size_t nr, const size_t kr,
-			     const typename Field::Element alpha,
-			     const typename Field::Element* A,const size_t lda,
-			     const typename Field::Element* B,const size_t ldb,
-			     const typename Field::Element beta,
-			     typename Field::Element * C, const size_t ldc,
-			     const size_t kmax, const size_t w, const FFLAS_BASE base)
-{
-	typename Field::Element zero, one;
-	F.init  (zero, 0.0);
-	F.init  (one, 1.0);
-
-	typename Field::Element mbeta;
-	F.neg(mbeta,beta);
-	size_t imaxb, jmaxb, imaxa, jmaxa, ldx2, ldx3;
-	size_t x3rd = MAX(mr,kr);
-	const typename Field::Element* d11,*d12,*d21,*d22;
-	typename Field::Element* d11c,*d12c,*d21c,*d22c,*dx1,*dx2,*dx3;
-	const typename Field::Element * A11=A, *A12, *A21, *A22;
-	const typename Field::Element * B11=B, *B12, *B21, *B22;
-	typename Field::Element * C11=C, *C12=C+nr, *C21=C+mr*ldc, *C22=C+nr+mr*ldc;
-	
-
-	if (F.isZero(beta)){
-		size_t x1rd = MAX(nr,kr);
-		size_t ldx1;
-		if (ta == FflasTrans) {
-			A21 = A + mr;
-			A12 = A + kr*lda;
-			A22 = A12 + mr;
-			imaxa = kr;
-			jmaxa = mr;
-			ldx1 = mr;
-		} else {
-			A12 = A + kr;
-			A21 = A + mr*lda;
-			A22 = A21 + kr;
-			imaxa = mr;
-			jmaxa = kr;
-			ldx1  = x1rd;
-		}
-		if (tb == FflasTrans) {
-			B21 = B + kr;
-			B12 = B + nr*ldb;
-			B22 = B12 + kr;
-			imaxb = nr;
-			jmaxb = kr;
-			ldx2 = kr;
-		} else {
-			B12 = B + nr;
-			B21 = B + kr*ldb;
-			B22 = B21 + nr;
-			imaxb = kr;
-			ldx2 = jmaxb = nr;
-		}
-
-			
-		// Two temporary submatrices are required
-
-		typename Field::Element* X2 = new typename Field::Element[kr*nr];
- 		
-		// T3 = B22 - B12 in X2
-		d12 = B12; d22 = B22; dx2 = X2;
-		for (size_t i=0; i < imaxb; ++i, d12+=ldb, d22+=ldb, dx2+=ldx2) {
-			for (size_t j=0;j < jmaxb;++j)
-				F.sub (*(dx2+j), *(d22 + j), *(d12 + j));
-		}
-
-		// S3 = A11 - A21 in X1
-		typename Field::Element* X1 = new typename Field::Element[mr*x1rd];		// S3 = A11 - A21 in X1
-		d11 = A11; d21 = A21; dx1 = X1;
-		for (size_t i = 0; i < imaxa; ++i, d11 += lda, d21 += lda, dx1 += ldx1)
-			for (size_t j = 0; j < jmaxa; ++j)
-				F.sub (*(dx1+j), *(d11 + j), *(d21 + j));
-
-		// P7 = alpha . S3 * T3  in C21
-		WinoMain (F, ta, tb, mr, nr, kr, alpha, X1, ldx1, X2, ldx2, zero, C21, ldc, kmax, w-1, base);
-
-		// T1 = B12 - B11 in X2
-		d11 = B11; d12 = B12; dx2 = X2;
-		for (size_t i = 0; i < imaxb; ++i, d11 += ldb, d12 += ldb, dx2 += ldx2) {
-			for (size_t j = 0; j < jmaxb; ++j)
-				F.sub (*(dx2 + j), *(d12 + j), *(d11 + j));
-		}
-
-		// S1 = A21 + A22 in X1
-
-		d21 = A21; d22 = A22; dx1 = X1;
-		for (size_t i = 0; i < imaxa; ++i, d21+=lda, d22+=lda, dx1+=ldx1) {
-			for (size_t j=0;j < jmaxa;++j)
-				F.add(*(dx1+j),* (d21 + j),*(d22 + j));
-		}
-
-		// P5 = alpha . S1*T1 in C22
-		WinoMain (F, ta, tb, mr, nr, kr, alpha, X1, ldx1, X2, ldx2, zero, C22, ldc, kmax, w-1, base);
-
-		// T2 = B22 - T1 in X2
-		d22 = B22; dx2 = X2;
-		for (size_t i = 0; i < imaxb; ++i, d22+=ldb, dx2+=ldx2) {
-			for (size_t j = 0; j < jmaxb; ++j)
-				F.sub (*(dx2+j), *(d22 + j), *(dx2+j));
-		}
-
-		// S2 = S1 - A11 in X1
-		d11 = A11; dx1 = X1;
-		for (size_t i = 0; i < imaxa; ++i, d11+=lda, dx1+=ldx1) {
-			for (size_t j = 0; j < jmaxa; ++j)
-				F.subin (*(dx1+j), *(d11 + j));
-		}
-
-		// P6 = alpha . S2 * T2 in C12
-		WinoMain (F, ta, tb, mr, nr, kr, alpha, X1, ldx1, X2, ldx2, zero, C12, ldc, kmax, w-1, base);
-
-		// S4 = A12 -S2 in X1
-		d12 = A12; dx1 = X1;
-		for (size_t i = 0; i < imaxa; ++i, d12 += lda, dx1 += ldx1) {
-			for (size_t j = 0; j < jmaxa; ++j)
-				F.sub (*(dx1+j), *(d12 + j), *(dx1+j));
-		}
-
-		// P3 = alpha . S4*B22 in C11
-		WinoMain (F, ta, tb, mr, nr, kr, alpha, X1, ldx1, B22, ldb, zero, C11, ldc, kmax, w-1, base);
-		
-		// P1 = alpha . A11 * B11 in X1
-		WinoMain (F, ta, tb, mr, nr, kr, alpha, A11, lda, B11, ldb, zero, X1, nr, kmax, w-1, base);
-
-	
-
-		// U2 = P1 + P6 in tmpU2  and
-		// U3 = P7 + U2 in tmpU3  and
-		// U7 = P5 + U3 in C22    and
-		// U4 = P5 + U2 in C12    and
-		d12c = C12; dx1=X1; d21c = C21; d22c = C22;
-		for (size_t i = 0; i < mr;
-		     ++i, d12c += ldc, dx1 += nr, d22c+=ldc, d21c += ldc) {
-			for (size_t j=0;j < nr;++j) { 
-				F.addin ( *(d12c + j), *(dx1 + j));    // U2 = P1 + P6
-				F.addin ( *(d21c+j), *(d12c+j));      //  U3 = U2 + P7 
-				F.addin (*(d12c + j), *(d22c+j));   // U4 = P5 + U2 in C12
-				F.addin (*(d22c + j), *(d21c+j));  // U7 = P5 + U3 in C22
-			} 
-		}
-
-		// U5 = P3 + U4 in C12
-		d12c = C12; d11 = C11;
-		for (size_t i = 0; i < mr; ++i, d12c += ldc, d11 += ldc)
-			for (size_t j = 0; j < nr; ++j)
-				F.addin (*(d12c + j), *(d11 + j));                                                                                           
-		// T4 = T2 - B21 in X2
-		d21 = B21;dx2=X2;
-		for (size_t i = 0; i < imaxb; ++i, d21+=ldb, dx2+=ldx2) {
-			for (size_t j = 0; j < jmaxb; ++j)
-				F.subin (*(dx2+j),* (d21 + j));
-		}
-
-		// P4 = alpha . A22 * T4 in C11
-		WinoMain (F, ta, tb, mr, nr, kr, alpha, A22, lda, X2, ldx2, zero, C11, ldc, kmax, w-1, base);
-
-		delete[] X2;		
-		// U6 = U3 - P4 in C21
-		d21c = C21; d11c = C11;
-		for (size_t i = 0; i < mr; ++i, d21c += ldc, d11c += ldc)
-			for (size_t j = 0; j < nr; ++j)
-				F.subin (*(d21c + j), *(d11c + j));
-		
-		// P2 = alpha . A12 * B21  in C11
-		WinoMain (F, ta, tb, mr, nr, kr, alpha, A12, lda, B21, ldb, zero, C11, ldc, kmax,w-1, base);
-
-		//  U1 = P2 + P1 in C11
-		d11c = C11; dx1 = X1;
-		for (size_t i = 0; i < mr; ++i, d11c += ldc, dx1 += nr)
-			for (size_t j = 0; j < nr; ++j)
-				F.addin (*(d11c + j), *(dx1 + j));
-
-		delete[] X1;
-	
-	} else {
-		// Three temporary submatrices are required
-		typename Field::Element* X1 = new typename Field::Element[mr*nr];
-		typename Field::Element* X2 = new typename Field::Element[mr*kr];
-		typename Field::Element* X3 = new typename Field::Element[x3rd*nr];
-
-		if (ta == FflasTrans) {
-			A21 = A + mr;
-			A12 = A + kr*lda;
-			A22 = A12 + mr;
-			imaxa = kr;
-			ldx2 = jmaxa = mr;
-		} else {
-			A12 = A + kr;
-			A21 = A + mr*lda;
-			A22 = A21 + kr;
-			imaxa = mr;
-			ldx2 = jmaxa = kr;
-		}
-		if (tb == FflasTrans) {
-			B21 = B + kr;
-			B12 = B + nr*ldb;
-			B22 = B12 + kr;
-			imaxb = nr;
-			jmaxb = kr;
-			ldx3 = x3rd;
-		} else {
-			B12 = B + nr;
-			B21 = B + kr*ldb;
-			B22 = B21 + nr;
-			imaxb = kr;
-			ldx3 = jmaxb = nr;
-		}
-
-#ifdef NEWWINO
-		//std::cerr<<"New Wino"<<std::endl;
-// 		// C22 = C22 - C12
-// 		d12c = C12;
-// 		d22c = C22;
-// 		for (size_t i = 0; i <  mr; ++i, d12c += ldc, d22c += ldc)
-// 			for (size_t j = 0; j < nr; ++j)
-// 				F.subin (*(d22c + j), *(d12c + j));
-		
-
-		// T1 = B12 - B11 in X3
-		d11 = B11; d12 = B12; dx3 = X3;
-		for (size_t i = 0; i < imaxb; ++i, d11 += ldb, d12 += ldb, dx3 += ldx3) {
-			for (size_t j = 0; j < jmaxb; ++j)
-				F.sub (*(dx3 + j), *(d12 + j), *(d11 + j));
-		}
-
-		// S1 = A21 + A22 in X2
-		d21 = A21; d22 = A22; dx2 = X2;
-		for (size_t i = 0; i < imaxa; ++i, d21+=lda, d22+=lda, dx2+=ldx2) {
-			for (size_t j=0;j < jmaxa;++j)
-				F.add(*(dx2+j),* (d21 + j),*(d22 + j));
-		}
-
-		// P5 = alpha . S1*T1 + beta . C12 in C12
-		//WinoMain (F, ta, tb, mr, nr, kr, alpha, X2, ldx2, X3, ldx3, beta, C12, ldc, kmax, w-1,base);
-		WinoMain (F, ta, tb, mr, nr, kr, alpha, X2, ldx2, X3, ldx3, zero, X1, nr, kmax, w-1,base);
-
-		// C22 = P5 + beta C22 in C22
-		d22c = C22; dx1 = X1;
-		for (size_t i = 0; i < mr; ++i, dx1 += nr, d22c += ldc) 
-			for (size_t j=0;j < nr;++j) {
-				F.mulin (*(d22c + j), beta);
-				F.addin (*(d22c + j), *(dx1 + j));
-			}
-
-		// C12 = P5 + beta C12 in C12
-		dx1 = X1; d12c = C12;
-		for (size_t i = 0; i < mr; ++i, d12c += ldc, dx1 += nr) 
-			for (size_t j=0;j < nr;++j) {
-				F.mulin (*(d12c + j), beta);
-				F.addin (*(d12c + j), *(dx1 + j));
-			}
-		
-		// P1 = alpha . A11 * B11 in X1
-		WinoMain (F, ta, tb, mr, nr, kr, alpha, A11, lda, B11, ldb, zero, X1, nr, kmax, w-1,base);
-
-
-		// P2 = alpha . A12 * B21 + beta . C11  in C11
-		WinoMain (F, ta, tb, mr, nr, kr, alpha, A12, lda, B21, ldb, beta, C11, ldc, kmax,w-1,base);
-	
-		//  U1 = P2 + P1 in C11	
-		d11c = C11; dx1 = X1; 
-		for (size_t i = 0; i < mr; ++i, d11c += ldc, dx1 += nr)
-			for (size_t j = 0; j < nr; ++j)
-				F.addin (*(d11c + j), *(dx1 + j));
-
-		// T2 = B22 - T1 in X3
-		d22 = B22; dx3 = X3;
-		for (size_t i = 0; i < imaxb; ++i, d22+=ldb, dx3+=ldx3) {
-			for (size_t j = 0; j < jmaxb; ++j)
-				F.sub (*(dx3+j), *(d22 + j), *(dx3+j));
-		}
-	
-		// S2 = S1 - A11 in X2
-		d11 = A11; dx2 = X2;
-		for (size_t i = 0; i < imaxa; ++i, d11+=lda, dx2+=ldx2) {
-			for (size_t j = 0; j < jmaxa; ++j)
-				F.subin (*(dx2+j), *(d11 + j));
-		}
-
-		// U2 = P6 + P1 = alpha . S2 * T2 + P1 in X1
-		WinoMain (F, ta, tb, mr, nr, kr, alpha, X2, ldx2, X3, ldx3, one, X1, nr, kmax, w-1,base);
-
-
-		
-
-		// U4 = U2 + P5 in C12
-		d12c = C12; dx1 = X1;
-		for (size_t i = 0; i < mr; ++i, d12c += ldc, dx1 += nr) 
-			for (size_t j=0;j < nr;++j) 
-				F.addin (*(d12c + j), *(dx1 + j));
-		
-		// T4 = T2 - B21 in X3
-		d21 = B21;dx3=X3;
-		for (size_t i = 0; i < imaxb; ++i, d21+=ldb, dx3+=ldx3) {
-			for (size_t j = 0; j < jmaxb; ++j)
-				F.subin (*(dx3+j),* (d21 + j));
-		}
-	
-		// S4 = A12 -S2 in X2 
-		d12 = A12; dx2 = X2;
-		for (size_t i = 0; i < imaxa; ++i, d12 += lda, dx2 += ldx2) {
-			for (size_t j = 0; j < jmaxa; ++j)
-				F.sub (*(dx2+j), *(d12 + j), *(dx2+j));
-		}
-
-		// P4 = alpha . A22 * T4 - beta . C21 in C21
-		WinoMain (F, ta, tb, mr, nr, kr, alpha, A22, lda, X3, ldx3, mbeta, C21, ldc, kmax, w-1,base);
-
-		// U5 = P3 + U4 = alpha . S4*B22 + U4 in C12
-		WinoMain (F, ta, tb, mr, nr, kr, alpha, X2, ldx2, B22, ldb, one, C12, ldc, kmax, w-1,base);
-
-		// T3 = B22 - B12 in X3
-		d12 = B12; d22 = B22; dx3 = X3;
-		for (size_t i=0; i < imaxb; ++i, d12+=ldb, d22+=ldb, dx3+=ldx3) 
-			for (size_t j=0;j < jmaxb;++j)
-				F.sub (*(dx3+j), *(d22 + j), *(d12 + j));
-		
-		// S3 = A11 - A21 in X2 
-		d11 = A11; d21 = A21; dx2 = X2; 
-		for (size_t i = 0; i < imaxa; ++i, d11 += lda, d21 += lda, dx2 += ldx2)
-			for (size_t j = 0; j < jmaxa; ++j)
-				F.sub (*(dx2+j), *(d11 + j), *(d21 + j));
-
-		// U3 = P7 + U2  = alpha . S3 * T3 + U2 in X1
-		WinoMain (F, ta, tb, mr, nr, kr, alpha, X2, ldx2, X3, ldx3, one, X1, nr, kmax, w-1,base);
-		
-		// U7 =  U3 + C22 in C22
-		d22c = C22; dx1 = X1; d12c = C12;
-		for (size_t i = 0; i < mr; ++i, d22c += ldc, dx1 += nr)
-			for (size_t j = 0; j < nr; ++j)
-				F.addin (*(d22c + j), *(dx1 + j));
-				
-		// U6 = U3 - P4 in C21
-		dx1 = X1; d21c = C21; 
-		for (size_t i = 0; i < mr; ++i, dx1 += nr, d21c += ldc) 
-			for (size_t j=0;j < nr;++j) 
-				F.sub  (*(d21c + j), *(dx1 + j),* (d21c + j)); 
-#else
-		// P2 = alpha . A12 * B21 + beta . C11  in C11
-		WinoMain (F, ta, tb, mr, nr, kr, alpha, A12, lda, B21, ldb, beta, C11, ldc, kmax,w-1,base);
-	
-		// T3 = B22 - B12 in X3
-		d12 = B12; d22 = B22; dx3 = X3;
-		for (size_t i=0; i < imaxb; ++i, d12+=ldb, d22+=ldb, dx3+=ldx3) {
-			for (size_t j=0;j < jmaxb;++j)
-				F.sub (*(dx3+j), *(d22 + j), *(d12 + j));
-		
-		}
-
-		// S3 = A11 - A21 in X2 
-		d11 = A11; d21 = A21; dx2 = X2; 
-		for (size_t i = 0; i < imaxa; ++i, d11 += lda, d21 += lda, dx2 += ldx2)
-			for (size_t j = 0; j < jmaxa; ++j)
-				F.sub (*(dx2+j), *(d11 + j), *(d21 + j));
-
-		// C22 = C22 - C12 if beta != 0
-		d12c = C12;
-		d22c = C22;
-		for (size_t i = 0; i <  mr; ++i, d12c += ldc, d22c += ldc)
-			for (size_t j = 0; j < nr; ++j)
-				F.subin (*(d22c + j), *(d12c + j));
-		
-		// C21 = C21 - C22
-		d21c = C21;
-		d22c = C22;
-		for (size_t i = 0; i <  mr; ++i, d22c += ldc, d21c += ldc)
-			for (size_t j = 0; j < nr; ++j)
-				F.subin (*(d21c + j), *(d22c + j));
-
-		// P7 = alpha . S3 * T3 + beta . C22 in C22
-		WinoMain (F, ta, tb, mr, nr, kr, alpha, X2, ldx2, X3, ldx3, beta, C22, ldc, kmax, w-1,base);
-
-		// T1 = B12 - B11 in X3
-		d11 = B11; d12 = B12; dx3 = X3;
-		for (size_t i = 0; i < imaxb; ++i, d11 += ldb, d12 += ldb, dx3 += ldx3) {
-			for (size_t j = 0; j < jmaxb; ++j)
-				F.sub (*(dx3 + j), *(d12 + j), *(d11 + j));
-		}
-
-		// S1 = A21 + A22 in X2
-		d21 = A21; d22 = A22; dx2 = X2;
-		for (size_t i = 0; i < imaxa; ++i, d21+=lda, d22+=lda, dx2+=ldx2) {
-			for (size_t j=0;j < jmaxa;++j)
-				F.add(*(dx2+j),* (d21 + j),*(d22 + j));
-		}
-
-		// P5 = alpha . S1*T1 + beta . C12 in C12
-		WinoMain (F, ta, tb, mr, nr, kr, alpha, X2, ldx2, X3, ldx3, beta, C12, ldc, kmax, w-1,base);
-
-		// T2 = B22 - T1 in X3
-		d22 = B22; dx3 = X3;
-		for (size_t i = 0; i < imaxb; ++i, d22+=ldb, dx3+=ldx3) {
-			for (size_t j = 0; j < jmaxb; ++j)
-				F.sub (*(dx3+j), *(d22 + j), *(dx3+j));
-		}
-	
-		// S2 = S1 - A11 in X2
-		d11 = A11; dx2 = X2;
-		for (size_t i = 0; i < imaxa; ++i, d11+=lda, dx2+=ldx2) {
-			for (size_t j = 0; j < jmaxa; ++j)
-				F.subin (*(dx2+j), *(d11 + j));
-		}
-
-		// P6 = alpha . S2 * T2 in X1
-		WinoMain (F, ta, tb, mr, nr, kr, alpha, X2, ldx2, X3, ldx3, zero, X1, nr, kmax, w-1,base);
-
-		// T4 = T2 - B21 in X3
-		d21 = B21;dx3=X3;
-		for (size_t i = 0; i < imaxb; ++i, d21+=ldb, dx3+=ldx3) {
-			for (size_t j = 0; j < jmaxb; ++j)
-				F.subin (*(dx3+j),* (d21 + j));
-		}
-	
-		// S4 = A12 -S2 in X2 
-		d12 = A12; dx2 = X2;
-		for (size_t i = 0; i < imaxa; ++i, d12 += lda, dx2 += ldx2) {
-			for (size_t j = 0; j < jmaxa; ++j)
-				F.sub (*(dx2+j), *(d12 + j), *(dx2+j));
-		}
-
-		// P4 = alpha . A22 * T4 - beta . C21 in C21
-		WinoMain (F, ta, tb, mr, nr, kr, alpha, A22, lda, X3, ldx3, mbeta, C21, ldc, kmax, w-1,base);
-
-		// P1 = alpha . A11 * B11 in X3
-		WinoMain (F, ta, tb, mr, nr, kr, alpha, A11, lda, B11, ldb, zero, X3, nr, kmax, w-1,base);
-
-		//  U1 = P2 + P1 in C11	
-		d11c = C11; dx3 = X3; 
-		for (size_t i = 0; i < mr; ++i, d11c += ldc, dx3 += nr)
-			for (size_t j = 0; j < nr; ++j)
-				F.addin (*(d11c + j), *(dx3 + j));
-
-		// U2 = P1 + P6 in tmpU2  and
-		// U3 = P7 + U2 in tmpU3  and 
-		// U7 = P5 + U3 in C22    and
-		// U4 = P5 + U2 in C12    and
-		// U6 = U3 - P4 in C21    and
-		typename Field::Element tmpU2, tmpU3;
-		d12c = C12; dx1=X1; dx3=X3; d21c = C21; d22c = C22; 
-		for (size_t i = 0; i < mr; 
-		     ++i, d12c += ldc, dx1 += nr, dx3 += nr, d22c+=ldc, d21c += ldc) {
-			for (size_t j=0;j < nr;++j) {
-				F.add (tmpU2, *(dx3 + j), *(dx1 + j));    // temporary U2 = P1 + P6
-				F.add (tmpU3, tmpU2, *(d22c + j));      // temporary U3 = U2 + P7
-				F.add (*(d22c + j), *(d12c + j), tmpU3);  // U7 = P5 + U3 in C22
-				F.addin (*(d12c + j), tmpU2);             // U4 = P5 + U2 in C12
-				F.sub (*(d21c + j), tmpU3, *(d21c + j)); // U6 = U3 - P4 in C21
-			}
-		}
-		// P3 = alpha . S4*B22 in X1
-		WinoMain (F, ta, tb, mr, nr, kr, alpha, X2, ldx2, B22, ldb, one, C12, ldc, kmax, w-1,base);
-
-		// U5 = P3 + U4 in C12
-// 		d12c = C12; dx1 = X1; 
-// 		for (size_t i = 0; i < mr; ++i, d12c += ldc, dx1 += nr)
-// 			for (size_t j = 0; j < nr; ++j)
-// 				F.addin (*(d12c + j), *(dx1 + j));
-#endif
-		delete[] X1;
-		delete[] X2;
-		delete[] X3;
-	}
-}
-
-
-// Control the switch with classic multiplication
-// Fix-up for odd-sized matrices using dynamic pealing
-// for matrices over double
-template <> 
-inline  void FFLAS::WinoMain (const DoubleDomain& D, 
-			      const FFLAS_TRANSPOSE ta,
-			      const FFLAS_TRANSPOSE tb,
-			      const size_t m, const size_t n, const size_t k,
-			      const DoubleDomain::Element alpha,
-			      const DoubleDomain::Element * A, const size_t lda,
-			      const DoubleDomain::Element * B, const size_t ldb,
-			      const DoubleDomain::Element beta,
-			      DoubleDomain::Element * C, const size_t ldc,
-			      const size_t kmax, const size_t w, const FFLAS_BASE base) {
-
-	if (w <= 0) 
-		ClassicMatmul (D, ta, tb, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc, kmax,base);
-	else{
-		WinoCalc (D, ta, tb, m/2, n/2, k/2, alpha, A, lda, B, ldb, beta, C, ldc, kmax, w,base); 
-		DynamicPealing (D, ta, tb, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc, kmax);
-	}
-}
-template <> 
-inline  void FFLAS::WinoMain (const FloatDomain& F, 
-			      const FFLAS_TRANSPOSE ta,
-			      const FFLAS_TRANSPOSE tb,
-			      const size_t m, const size_t n, const size_t k,
-			      const FloatDomain::Element alpha,
-			      const FloatDomain::Element * A, const size_t lda,
-			      const FloatDomain::Element * B, const size_t ldb,
-			      const FloatDomain::Element beta,
-			      FloatDomain::Element * C, const size_t ldc,
-			      const size_t kmax, const size_t w, const FFLAS_BASE base) {
-	
-	if (w <= 0) {
-		ClassicMatmul (F, ta, tb, m, n, k, alpha, A, lda, B, ldb,
-			       beta, C, ldc, kmax,base);
-	}
-	else{
-		WinoCalc (F, ta, tb, m/2, n/2, k/2, alpha, A, lda, B, ldb,
-			  beta, C, ldc, kmax, w,base); 
-		DynamicPealing (F, ta, tb, m, n, k, alpha, A, lda, B, ldb,
-				beta, C, ldc, kmax);
-	}
-}
-
-template <class Field>
-inline void  FFLAS::WinoMain (const Field& F, 
-			      const FFLAS_TRANSPOSE ta,
-			      const FFLAS_TRANSPOSE tb,
-			      const size_t m, const size_t n, const size_t k,
-			      const typename Field::Element alpha,
-			      const typename Field::Element* A,const size_t lda,
-			      const typename Field::Element* B,const size_t ldb,
-			      const typename Field::Element beta,
-			      typename Field::Element * C, const size_t ldc,
-			      const size_t kmax, const size_t w,
-			      const FFLAS_BASE base) {
-
-	typename Field::Element one,zero,mone;
-	F.init(one, 1.0);
-	F.init(zero, 0.0);
-	F.neg(mone, one);
-	
-	if (w <= 0) // Winograd - >  Classic
-		ClassicMatmul (F, ta, tb, m, n, k, alpha, A, lda, B, ldb,
-			       beta, C, ldc, kmax,base);
-	else {
-		if (k <= kmax) { // switch on floating point
-			if (base == FflasDouble){
-				DoubleDomain::Element alphad, betad;
-				typename Field::Element _betabis;
-			
-				if (F.areEqual (mone, alpha)) {
-					alphad = -1.0;
-					F.convert (betad, beta);
-				} else {
-					if (! F.areEqual (one, alpha)) {
-						// Compute C = A*B + beta/alpha.C
-						// and after C *= alpha
-						F.div (_betabis, beta, alpha);
-						F.convert (betad, _betabis);
-					}
-					else
-						F.convert (betad, beta);
-					alphad = 1.0;
-				}
-				DoubleDomain::Element * Ad = new DoubleDomain::Element[m*k];
-				DoubleDomain::Element * Bd = new DoubleDomain::Element[k*n];
-				DoubleDomain::Element * Cd = new DoubleDomain::Element[m*n];
-				// Conversion GFq = >  double
-				size_t ma, ka, kb, nb; //mb, na
-				if (ta == FflasTrans) { ma = k; ka = m; }
-				else { ma = m; ka = k; }
-				if (tb == FflasTrans) { kb = n; nb = k; }
-				else {  kb = k; nb = n; }
-			
-				MatF2MatD (F, Ad, ka, A, lda, ma, ka);
-				MatF2MatD (F, Bd, nb, B, ldb, kb, nb); 
-				if (!F.isZero(beta))
-					MatF2MatD (F, Cd, n, C, ldc, m, n); 
-				// recursive call
-				WinoMain (DoubleDomain(), ta, tb, m, n, k, alphad,
-					  Ad, ka, Bd, nb, betad, Cd, n, kmax, w,base);
-				// Conversion double = >  GFq
-				MatD2MatF (F, C, ldc, Cd, n, m, n);
-
-				if (!F.areEqual (one, alpha) &&
-				    !F.areEqual (mone, alpha)) {
-					// Fix-up: compute C *= alpha
-					for (typename Field::Element* Ci = C;
-					     Ci < C + m*ldc; Ci+=ldc)
-						for (size_t j=0; j < n; ++j) 
-							F.mulin (*(Ci + j), alpha);
-				}
-				// Temporary double matrices destruction
-				delete[] Ad;
-				delete[] Bd;
-				delete[] Cd;
-			} else {
-				FloatDomain::Element alphad, betad;
-				typename Field::Element _betabis;
-			
-				if (F.areEqual (mone, alpha)) {
-					alphad = -1.0;
-					F.convert (betad, beta);
-				} else {
-					if (! F.areEqual (one, alpha)) {
-						// Compute C = A*B + beta/alpha.C
-						// and after C *= alpha
-						F.div (_betabis, beta, alpha);
-						F.convert (betad, _betabis);
-					}
-					else
-						F.convert (betad, beta);
-					alphad = 1.0;
-				}
-				FloatDomain::Element * Ad = new FloatDomain::Element[m*k];
-				FloatDomain::Element * Bd = new FloatDomain::Element[k*n];
-				FloatDomain::Element * Cd = new FloatDomain::Element[m*n];
-				// Conversion GFq = >  double
-				size_t ma, ka, kb, nb; //mb, na
-				if (ta == FflasTrans) { ma = k; ka = m; }
-				else { ma = m; ka = k; }
-				if (tb == FflasTrans) { kb = n; nb = k; }
-				else {  kb = k; nb = n; }
-			
-				MatF2MatFl (F, Ad, ka, A, lda, ma, ka);
-				MatF2MatFl (F, Bd, nb, B, ldb, kb, nb); 
-				if (!F.isZero(beta))
-					MatF2MatFl (F, Cd, n, C, ldc, m, n); 
-				// recursive call
-				WinoMain (FloatDomain(), ta, tb, m, n, k, alphad,
-					  Ad, ka, Bd, nb, betad, Cd, n, kmax, w,base);
-				// Conversion double = >  GFq
-				MatFl2MatF (F, C, ldc, Cd, n, m, n);
-
-				if (!F.areEqual (one, alpha) &&
-				    !F.areEqual (mone, alpha)) {
-					// Fix-up: compute C *= alpha
-					for (typename Field::Element* Ci=C;
-					     Ci < C+m*ldc; Ci+=ldc)
-						for (size_t j=0; j < n; ++j) 
-							F.mulin (* (Ci + j), alpha);
-				}
-				// Temporary double matrices destruction
-				delete[] Ad;
-				delete[] Bd;
-				delete[] Cd;
-			}
-		} else{
-			WinoCalc (F, ta, tb, m/2, n/2, k/2, alpha, A, lda, B, ldb,
-				  beta, C, ldc, kmax,w,base);
-			DynamicPealing (F, ta, tb, m, n, k, alpha, A, lda, B, ldb,
-					beta, C, ldc, kmax);
-		}
-	}
-}
-
-template <>
-inline void FFLAS::WinoMain (const ModularBalanced<double>& F, 
-			     const FFLAS_TRANSPOSE ta,
-			     const FFLAS_TRANSPOSE tb,
-			     const size_t m, const size_t n, const size_t k,
-			     const double alpha,
-			     const double* A, const size_t lda,
-			     const double* B, const size_t ldb,
-			     const double beta,
-			     double * C, const size_t ldc,
-			     const size_t kmax, const size_t w, const FFLAS_BASE base) {
-	if (w <= 0) 
-		ClassicMatmul (F, ta, tb, m, n, k, alpha, A, lda, B, ldb,
-			       beta, C, ldc, kmax,base);
-	else {
-		if (k <= kmax) { // switch on delayed modulus
-			DoubleDomain::Element _alpha, _beta;
-			_beta = beta;
-			if (F.areEqual (-1.0, alpha)) _alpha = -1.0;
-			else{
-				// Compute C = A*B + beta/alpha.C
-				// and then C *= alpha
-				if (! F.areEqual (1.0, alpha))
-					F.divin (_beta, alpha);
-				_alpha = 1.0;
-			}
-			
-			size_t ma, ka, kb, nb; //mb, na;
-			if (ta == FflasTrans) { ma = k; ka = m; }
-			else { ma = m; ka = k; }
-			if (tb == FflasTrans) { kb = n; nb = k; }
-			else {  kb = k; nb = n; }
-		
-			// recursive call
-			WinoMain (DoubleDomain(), ta, tb, m, n, k, _alpha,
-				  A, lda, B, ldb, _beta, C, ldc, kmax, w,base);
-			// Modular reduction
-			for (double * Ci = C; Ci != C+m*ldc; Ci+=ldc)
-				for (size_t j = 0; j < n; ++j)
-					F.init (*(Ci + j), *(Ci + j));
-			
-			if (!F.areEqual (1.0, alpha) &&
-			    !F.areEqual (-1.0, alpha))
-				// Fix-up: compute C *= alpha
-				for (double* Ci=C; Ci < C+m*ldc; Ci+=ldc)
-					for (size_t j=0; j < n; ++j) 
-						F.mulin (* (Ci + j), alpha);
-		} else {
-			WinoCalc (F, ta, tb, m/2, n/2, k/2, alpha,
-				  A, lda, B, ldb, beta, C, ldc, kmax,w,base);
-			DynamicPealing (F, ta, tb, m, n, k, alpha,
-					A, lda, B, ldb, beta, C, ldc, kmax);
-		}
-	}
-}
-
-
-template <>
-inline void FFLAS::WinoMain (const ModularBalanced<float>& F, 
-			     const FFLAS_TRANSPOSE ta,
-			     const FFLAS_TRANSPOSE tb,
-			     const size_t m, const size_t n, const size_t k,
-			     const float alpha,
-			     const float* A, const size_t lda,
-			     const float* B, const size_t ldb,
-			     const float beta,
-			     float * C, const size_t ldc,
-			     const size_t kmax, const size_t w, const FFLAS_BASE base) {
-	if (w <= 0) 
-		ClassicMatmul (F, ta, tb, m, n, k, alpha, 
-			       A, lda, B, ldb, beta, C, ldc, kmax,base);
-	else {
-		if (k <= kmax) { // switch on float
-			// Temporary float matrices
-			FloatDomain::Element _alpha, _beta;
-			_beta = beta;
-				if (F.areEqual (-1.0, alpha)) _alpha = -1.0;
-				else {
-					// Compute C = A*B + beta/alpha.C
-					// and then C *= alpha
-					if (! F.areEqual (1.0, alpha))
-						F.divin (_beta, alpha);
-					_alpha = 1.0;
-				}
-				size_t ma, ka, kb, nb; //mb, na;
-				if (ta == FflasTrans) { ma = k; ka = m; }
-				else { ma = m; ka = k; }
-				if (tb == FflasTrans) { kb = n; nb = k; }
-				else {  kb = k; nb = n; }
-		
-				// recursive call
-				WinoMain (FloatDomain(), ta, tb, m, n, k, _alpha,
-					  A, lda, B, ldb, _beta, C, ldc, kmax, w,base);
-				// Conversion float = >  GFq
-				for (float * Ci = C; Ci != C+m*ldc; Ci+=ldc)
-					for (size_t j = 0; j < n; ++j)
-						F.init (*(Ci + j), *(Ci + j));
-			
-				if (!F.areEqual (1.0, alpha) &&
-				    !F.areEqual (-1.0, alpha)) 
-					// Fix-up: compute C *= alpha
-					for (float* Ci=C; Ci < C+m*ldc; Ci+=ldc)
-						for (size_t j=0; j < n; ++j) 
-							F.mulin (* (Ci + j), alpha);
-		} else{
-			WinoCalc (F, ta, tb, m/2, n/2, k/2, alpha,
-				  A, lda, B, ldb, beta, C, ldc, kmax,w,base);
-			DynamicPealing (F, ta, tb, m, n, k, alpha,
-					A, lda, B, ldb, beta, C, ldc, kmax);
-		}
-	}
-}
-template <>
-inline void FFLAS::WinoMain (const Modular<double>& F, 
-			     const FFLAS_TRANSPOSE ta,
-			     const FFLAS_TRANSPOSE tb,
-			     const size_t m, const size_t n, const size_t k,
-			     const double alpha,
-			     const double* A, const size_t lda,
-			     const double* B, const size_t ldb,
-			     const double beta,
-			     double * C, const size_t ldc,
-			     const size_t kmax, const size_t w, const FFLAS_BASE base) {
-	if (w <= 0) 
-		ClassicMatmul (F, ta, tb, m, n, k, alpha, A, lda, B, ldb,
-			       beta, C, ldc, kmax,base);
-	else {
-		if (k <= kmax) { // switch on delayed modulus
-			DoubleDomain::Element _alpha, _beta;
-			_beta = beta;
-			if (F.areEqual (-1.0, alpha)) _alpha = -1.0;
-			else{
-				// Compute C = A*B + beta/alpha.C
-				// and then C *= alpha
-				if (! F.areEqual (1.0, alpha))
-					F.divin (_beta, alpha);
-				_alpha = 1.0;
-			}
-			
-			size_t ma, ka, kb, nb; //mb, na;
-			if (ta == FflasTrans) { ma = k; ka = m; }
-			else { ma = m; ka = k; }
-			if (tb == FflasTrans) { kb = n; nb = k; }
-			else {  kb = k; nb = n; }
-		
-			// recursive call
-			WinoMain (DoubleDomain(), ta, tb, m, n, k, _alpha,
-				  A, lda, B, ldb, _beta, C, ldc, kmax, w,base);
-			// Modular reduction
-			for (double * Ci = C; Ci != C+m*ldc; Ci+=ldc)
-				for (size_t j = 0; j < n; ++j)
-					F.init (*(Ci + j), *(Ci + j));
-			
-			if (!F.areEqual (1.0, alpha) &&
-			    !F.areEqual (-1.0, alpha))
-				// Fix-up: compute C *= alpha
-				for (double* Ci=C; Ci < C+m*ldc; Ci+=ldc)
-					for (size_t j=0; j < n; ++j) 
-						F.mulin (* (Ci + j), alpha);
-		} else {
-			WinoCalc (F, ta, tb, m/2, n/2, k/2, alpha,
-				  A, lda, B, ldb, beta, C, ldc, kmax,w,base);
-			DynamicPealing (F, ta, tb, m, n, k, alpha,
-					A, lda, B, ldb, beta, C, ldc, kmax);
-		}
-	}
-}
-
-
-template <>
-inline void FFLAS::WinoMain (const Modular<float>& F, 
-			     const FFLAS_TRANSPOSE ta,
-			     const FFLAS_TRANSPOSE tb,
-			     const size_t m, const size_t n, const size_t k,
-			     const float alpha,
-			     const float* A, const size_t lda,
-			     const float* B, const size_t ldb,
-			     const float beta,
-			     float * C, const size_t ldc,
-			     const size_t kmax, const size_t w, const FFLAS_BASE base) {
-	if (w <= 0) {
-		ClassicMatmul (F, ta, tb, m, n, k, alpha, 
-			       A, lda, B, ldb, beta, C, ldc, kmax,base);
-	}
-	else {
-		if (k <= kmax) { // switch on float
-			FloatDomain::Element _alpha, _beta;
-			_beta = beta;
-			if (F.areEqual (-1.0, alpha)) _alpha = -1.0;
-			else {
-				// Compute C = A*B + beta/alpha.C
-				// and then C *= alpha
-				if (! F.areEqual (1.0, alpha))
-					F.divin (_beta, alpha);
-				_alpha = 1.0;
-			}
-				size_t ma, ka, kb, nb; //mb, na;
-				if (ta == FflasTrans) { ma = k; ka = m; }
-				else { ma = m; ka = k; }
-				if (tb == FflasTrans) { kb = n; nb = k; }
-				else {  kb = k; nb = n; }
-		
-				// recursive call
-				WinoMain (FloatDomain(), ta, tb, m, n, k, _alpha,
-					  A, lda, B, ldb, _beta, C, ldc, kmax, w,base);
-				// Conversion float = >  GFq
-				for (float * Ci = C; Ci != C+m*ldc; Ci+=ldc)
-					for (size_t j = 0; j < n; ++j)
-						F.init (*(Ci + j), *(Ci + j));
-			
-				if (!F.areEqual (1.0, alpha) &&
-				    !F.areEqual (-1.0, alpha)) 
-					// Fix-up: compute C *= alpha
-					for (float* Ci=C; Ci < C+m*ldc; Ci+=ldc)
-						for (size_t j=0; j < n; ++j) 
-							F.mulin (* (Ci + j), alpha);
-		} else{
-			WinoCalc (F, ta, tb, m/2, n/2, k/2, alpha,
-				  A, lda, B, ldb, beta, C, ldc, kmax,w,base);
-			DynamicPealing (F, ta, tb, m, n, k, alpha,
-					A, lda, B, ldb, beta, C, ldc, kmax);
-		}
-	}
-}
-
-template  < class Field > 
-inline void
-FFLAS::DynamicPealing (const Field& F, 
-		       const FFLAS_TRANSPOSE ta,
-		       const FFLAS_TRANSPOSE tb,
-		       const size_t m, const size_t n, const size_t k,
-		       const typename Field::Element alpha, 
-		       const typename Field::Element* A, const size_t lda,
-		       const typename Field::Element* B, const size_t ldb, 
-		       const typename Field::Element beta,
-		       typename Field::Element* C, const size_t ldc, 
-		       const size_t kmax) 
-{
-	const typename Field::Element *a12, *a21, *b12, *b21;
-	size_t inca12, inca21, incb12, incb21, ma, na, mb, nb;
-	size_t mkn = (n & 0x1)+ ((k & 0x1) << 1)+  ((m & 0x1) << 2); 
-
-	if (ta == FflasTrans) {
- 		ma = k;
- 		na = m;
-		a12 = A+(k-1)*lda; 
-		inca12 = 1;
-		a21 = A+m-1;
-		inca21 = lda;
-	} else {
- 		ma = m;
- 		na = k;
-		a12 = A+k-1;
-		inca12 = lda;
-		a21 = A+(m-1)*lda;
-		inca21 = 1;
-	}
-	if (tb == FflasTrans) {
- 		mb = n;
- 		nb = k;
-		b12 = B+(n-1)*ldb; 
-		incb12 = 1;
-		b21 = B+k-1;
-		incb21 = ldb;
-	} else {
- 		mb = k;
- 		nb = n;
-		b12 = B+n-1;
-		incb12 = ldb;
-		b21 = B+(k-1)*ldb;
-		incb21 = 1;
-	}
-	switch (mkn) { 
-	case 1: // n oddsized
-		fgemv (F, ta, ma, na, alpha, A, lda, b12, incb12, beta, C+n-1,ldc);
-		break;
-      
-	case 2: // k oddsized
-		fger (F, m, n, alpha, a12, inca12, b21, incb21, C, ldc);
-		break;
-			
-	case 3: // n, k oddsized
-		fgemv (F, ta, ma, na, alpha, A, lda, b12, incb12, beta, C+n-1,ldc);
-		fger (F, m, n-1, alpha, a12, inca12, b21, incb21, C, ldc);
-		break;
-			
-	case 4: // m oddsized
-		fgemv(F, (tb == FflasTrans)?FflasNoTrans:FflasTrans, mb, nb,
-		      alpha, B, ldb, a21, inca21, beta, C+(m-1)*ldc, 1);
-		break;
-			
-	case 5: // m, n oddsized
-		if (tb == FflasTrans)
-			mb--;
-		else
-			nb--;
-		fgemv (F, ta, ma, na, alpha, A, lda, b12, incb12, beta, C+n-1, ldc);
-		fgemv (F, (tb==FflasTrans)?FflasNoTrans:FflasTrans, mb, nb,
-		       alpha, B, ldb, a21, inca21, beta, C+(m-1)*ldc, 1);
-		break;
-      
-	case 6: // m, k oddsized
-		fger (F, m-1, n, alpha, a12, inca12, b21, incb21, C, ldc);
-		fgemv(F, (tb==FflasTrans)?FflasNoTrans:FflasTrans, mb, nb,
-		      alpha, B, ldb, a21, inca21, beta, C+(m-1)*ldc, 1);
-		break;
-      
-	case 7: // m, k, n oddsized
-		if (tb == FflasTrans)
-			mb--;
-		else
-			nb--;
-		// Block NW
-		fger (F, m-1, n-1, alpha, a12, inca12, b21, incb21, C, ldc);
-		// Block SW
-		fgemv (F, (tb==FflasTrans)?FflasNoTrans:FflasTrans, mb, nb,
-		       alpha, B, ldb, a21, inca21, beta, C+(m-1)*ldc, 1);
-		// Block NE
-		fgemv (F, ta, ma, na, alpha, A, lda, b12, incb12, beta, C+n-1, ldc);
-		break;
-	}
-}
-
-
-	// Unsafe matmul over Z
-	// For internal usage only (or use it with care)
-	template<>
-	inline double* 
-	FFLAS::fgemm<UnparametricField<double> > ( const UnparametricField<double>& F,
-					     const FFLAS_TRANSPOSE ta,
-					     const FFLAS_TRANSPOSE tb,
-					     const size_t m,
-					     const size_t n,
-					     const size_t k,
-					     const double alpha,
-					     const double* A, const size_t lda,
-					     const double* B, const size_t ldb, 
-					     const double beta,
-					     double* C, const size_t ldc,
-					     const size_t w){
-
-		if (!(m && n && k)) return C;
-		
-		WinoMain (F, ta, tb, m, n, k, alpha, A, lda, B, ldb, beta,
-			  C, ldc, k+1, w, FflasDouble);
-		return C;
-	}
-
-	template<>
-	inline float* 
-	FFLAS::fgemm<UnparametricField<float> > ( const UnparametricField<float>& F,
-						  const FFLAS_TRANSPOSE ta,
-						  const FFLAS_TRANSPOSE tb,
-						  const size_t m,
-						  const size_t n,
-						  const size_t k,
-						  const float alpha,
-						  const float* A, const size_t lda,
-						  const float* B, const size_t ldb, 
-						  const float beta,
-						  float* C, const size_t ldc,
-						  const size_t w){
-		
-		if (!(m && n && k)) return C;
-		
-		WinoMain (F, ta, tb, m, n, k, alpha, A, lda, B, ldb, beta,
-			  C, ldc, k+1, w, FflasFloat);
-		return C;
-		}
-	
-	template<>
-	inline double* 
-	FFLAS::fgemm<UnparametricField<double> > (const UnparametricField<double>& F,
-						  const FFLAS_TRANSPOSE ta,
-						  const FFLAS_TRANSPOSE tb,
-						  const size_t m,
-						  const size_t n,
-						  const size_t k,
-						  const double alpha,
-						  const double* A, const size_t lda,
-						  const double* B, const size_t ldb, 
-						  const double beta,
-						  double* C, const size_t ldc){
-		return fgemm (F, ta, tb, m, n ,k, alpha, A, lda, B, ldb, beta, C, ldc, WinoSteps (MIN(m,MIN(k,n))));
-	}
-
-	template<>
-	inline float* 
-	FFLAS::fgemm<UnparametricField<float> > (const UnparametricField<float>& F,
-						 const FFLAS_TRANSPOSE ta,
-						 const FFLAS_TRANSPOSE tb,
-						 const size_t m,
-						 const size_t n,
-						 const size_t k,
-						 const float alpha,
-						 const float* A, const size_t lda,
-						 const float* B, const size_t ldb, 
-						 const float beta,
-						 float* C, const size_t ldc){
-		return fgemm (F, ta, tb, m, n ,k, alpha, A, lda, B, ldb, beta, C, ldc, WinoSteps (MIN(m,MIN(k,n))));
-	}
-	
-	
-template < class Field > 
-inline typename Field::Element*
-FFLAS::fsquare (const Field& F,
-		const FFLAS_TRANSPOSE ta,
-		const size_t n, const typename Field::Element alpha,
-		const typename Field::Element* A, const size_t lda,
-		const typename Field::Element beta,
-		typename Field::Element* C, const size_t ldc) {
-	
-	typename Field::Element mone;
-	F.init (mone, -1.0);
-	double alphad, betad;
-	F.convert (alphad, alpha);
-	if (F.areEqual (beta, mone))
-		betad = -1.0;
-	else
-		F.convert (betad, beta);
-
-	// Double  matrices initialisation
-	DoubleDomain::Element * Ad = new DoubleDomain::Element[n*n];
-	DoubleDomain::Element * Cd = new DoubleDomain::Element[n*n];
-	// Conversion finite Field = >  double
-	MatF2MatD (F, Ad, n, A, lda, n, n);
-	if (!F.isZero(beta)) MatF2MatD (F, Cd, n, C, ldc, n, n); 
-	
-	// Call to the blas Multiplication 
-	cblas_dgemm (CblasRowMajor, (CBLAS_TRANSPOSE)ta,
-		     (CBLAS_TRANSPOSE)ta, n, n, n, 
-		     (DoubleDomain::Element) alphad, Ad, n, Ad, n,
-		     (DoubleDomain::Element) betad, Cd, n);
-	// Conversion double = >  Finite Field
-	delete[] Ad;
-	MatD2MatF (F, C, ldc, Cd, n, n, n);
-	delete[] Cd;
-	return C;
-}
-
-template <>
-inline double* FFLAS::fsquare (const ModularBalanced<double> & F,
-			       const FFLAS_TRANSPOSE ta,
-			       const size_t n, const double alpha,
-			       const double* A, const size_t lda,
-			       const double beta,
-			       double* C, const size_t ldc) {
-	if (C==A) {
-		double * Ad = new double[n*n];
-		for (size_t i=0; i < n; ++i)
-			fcopy (F, n,Ad+i*n, 1, A+i*lda, 1);
-		fgemm (F, ta, ta, n, n, n, alpha, Ad, n, Ad, n, beta, C, ldc);
-		delete[] Ad;
-	} else
-		fgemm (F, ta, ta, n, n, n, alpha, A, lda, A, lda, beta, C, ldc);		
-	// Conversion double = >  Finite Field
-	size_t i;
-	double *Ci;
-	for (i=0, Ci=C ; i < n;++i, Ci+=ldc)
-		for (size_t j=0; j < n;++j)
-			F.init(*(Ci+j),*(Ci+j));
-	return C;
-}
-
-template <>
-inline float * FFLAS::fsquare (const ModularBalanced<float> & F,
-			       const FFLAS_TRANSPOSE ta,
-			       const size_t n, const float alpha,
-			       const float* A, const size_t lda,
-			       const float beta,
-			       float* C, const size_t ldc) {
-	if (C==A) {
-		float * Ad = new float[n*n];
-		for (size_t i=0; i < n; ++i)
-			fcopy (F, n,Ad+i*n, 1, A+i*lda, 1);
-		fgemm (F, ta, ta, n, n, n, alpha, Ad, n, Ad, n, beta, C, ldc);
-		delete[] Ad;
-	} else
-		fgemm (F, ta, ta, n, n, n, alpha, A, lda, A, lda, beta, C, ldc);		
-		// Conversion float = >  Finite Field
-	size_t i;
-	float *Ci;
-	for (i=0, Ci=C ; i < n;++i, Ci+=ldc)
-		for (size_t j=0; j < n;++j)
-			F.init(*(Ci+j),*(Ci+j));
-	return C;
-}
-
-template <>
-inline double* FFLAS::fsquare (const Modular<double> & F,
-			       const FFLAS_TRANSPOSE ta,
-			       const size_t n, const double alpha,
-			       const double* A, const size_t lda,
-			       const double beta,
-			       double* C, const size_t ldc) {
-	if (C==A) {
-		double * Ad = new double[n*n];
-		for (size_t i=0; i < n; ++i)
-			fcopy (F, n,Ad+i*n, 1, A+i*lda, 1);
-		fgemm (F, ta, ta, n, n, n, alpha, Ad, n, Ad, n, beta, C, ldc);
-		delete[] Ad;
-	} else
-		fgemm (F, ta, ta, n, n, n, alpha, A, lda, A, lda, beta, C, ldc);		
-	// Conversion double = >  Finite Field
-	double *Ci = C;
-	for (size_t i=0; i < n;++i, Ci+=ldc)
-		for (size_t j=0; j < n;++j)
-			F.init(*(Ci+j),*(Ci+j));
-	return C;
-}
-
-template <>
-inline float * FFLAS::fsquare (const Modular<float> & F,
-			       const FFLAS_TRANSPOSE ta,
-			       const size_t n, const float alpha,
-			       const float* A, const size_t lda,
-			       const float beta,
-			       float* C, const size_t ldc) {
-	if (C==A) {
-		float * Ad = new float[n*n];
-		for (size_t i=0; i < n; ++i)
-			fcopy (F, n,Ad+i*n, 1, A+i*lda, 1);
-		fgemm (F, ta, ta, n, n, n, alpha, Ad, n, Ad, n, beta, C, ldc);
-		delete[] Ad;
-	} else
-		fgemm (F, ta, ta, n, n, n, alpha, A, lda, A, lda, beta, C, ldc);		
-		// Conversion float = >  Finite Field
-		float *Ci = C;
-		for (size_t i=0; i < n;++i, Ci+=ldc)
-			for (size_t j=0; j < n;++j)
-				F.init(*(Ci+j),*(Ci+j));
-		return C;
-}
diff --git a/linbox/fflas/fflas_fgemv.inl b/linbox/fflas/fflas_fgemv.inl
deleted file mode 100644
index c6ec7f5..0000000
--- a/linbox/fflas/fflas_fgemv.inl
+++ /dev/null
@@ -1,357 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* fflas/fflas_fgemv.inl
- * Copyright (C) 2005 Clement Pernet
- *
- * Written by Clement Pernet <Clement.Pernet at imag.fr>
- *
- * See COPYING for license information.
- */
-
-
-//---------------------------------------------------------------------
-// fgemv: GEneral Matrix Vector Multiplication
-// Computes  Y <- alpha.op(A).X + beta.Y
-// A is M*N, 
-//---------------------------------------------------------------------
-template<class Field>
-inline void 
-FFLAS::fgemv (const Field& F, const FFLAS_TRANSPOSE TransA, 
-	      const size_t M, const size_t N,
-	      const typename Field::Element alpha, 
-	      const typename Field::Element * A, const size_t lda,
-	      const typename Field::Element * X, const size_t incX,
-	      const typename Field::Element beta,
-	      typename Field::Element * Y, const size_t incY)
-{
- 	static typename Field::Element  one, mone, zero;
-	F.init(one,1UL);
- 	F.neg(mone,one);
- 	F.init(zero,0UL);
-
-	if (F.isZero (alpha)){
-		for  (typename Field::Element * Yi = Y; Yi != Y+((TransA == FflasNoTrans)?M:N)*incY; Yi+=incY)
-			F.mulin(*Yi, beta);
-		return;
-	}
-	
-	FFLAS_BASE base = BaseCompute (F, 0);
-	size_t kmax = DotProdBound (F, 0, beta, base);
-
-	if (kmax > 1) {
-		if  (TransA == FflasNoTrans) {
-			size_t nblock = N / kmax;
-			size_t remblock = N % kmax;
-			// To ensure the initial computation with beta
-			if (!remblock){
-				remblock = kmax;
-				--nblock;
-			}
-			
-			MatVectProd (F, FflasNoTrans, M, remblock, alpha, 
-				     A+kmax*nblock, lda, X+kmax*nblock*incX, incX, beta, 
-				     Y, incY);
-			for  (size_t i = 0; i < nblock; ++i){
-				MatVectProd (F, FflasNoTrans, M, kmax, alpha, 
-					     A+i*kmax, lda, X+i*kmax*incX, incX, one, 
-					     Y, incY);
-			}
-		}
-		else{ // FflasTrans
-			size_t nblock = M / kmax;
-			size_t remblock = M % kmax;
-			// To ensure the initial computation with beta
-			if (!remblock){
-				remblock = kmax;
-				--nblock;
-			}
-			
-			MatVectProd (F, FflasTrans, remblock, N, alpha, 
-				     A+kmax*nblock*lda, lda, X+kmax*nblock*incX, incX, beta, 
-				     Y, incY);
-			for  (size_t i = 0; i < nblock; ++i){
-				MatVectProd (F, FflasTrans, kmax, N, alpha, 
-					     A+i*kmax*lda, lda, X+i*kmax*incX, incX, one, 
-					     Y, incY);
-			}
-		
-		}
-	} else {
-		if  (TransA == FflasNoTrans) {
-			if (F.isZero (beta))
-				for (size_t i = 0; i < M; ++i)
-					F.assign( *(Y+i*incY), zero);
-			else {
-				typename Field::Element betadivalpha;
-				F.div (betadivalpha, beta, alpha); 
-				for (size_t i = 0; i < M; ++i)
-					F.mulin( *(Y+i*incY), betadivalpha);
-			}
-			for (size_t i = 0; i < M; ++i)
-				for (size_t j = 0; j < N; ++j)
-					F.axpyin (*(Y+i*incY), *(A+i*lda+j), *(X+j*incX));
-			if (! F.isOne(alpha))
-				for (size_t i = 0; i < M; ++i)
-					F.mulin (*(Y+i*incY), alpha);
-		} else {
-			if (F.isZero (beta))
-				for (size_t i = 0; i < N; ++i)
-					F.assign( *(Y+i*incY), zero);
-			else {
-				typename Field::Element betadivalpha;
-				F.div (betadivalpha, beta, alpha); 
-				for (size_t i = 0; i < N; ++i)
-					F.mulin( *(Y+i*incY), betadivalpha);
-			}
-			
-
-			for (size_t i = 0; i < M; ++i)
-				for (size_t j = 0; j < N; ++j){
-					F.axpyin (*(Y+j*incY), *(A+i*lda+j), *(X+i*incX));
-				}
-			if (! F.isOne(alpha))
-				for (size_t i = 0; i < N; ++i)
-					F.mulin (*(Y+i*incY), alpha);
-		}
-	}
-}
-	
-// MatVectProd: computes y <- alpha.op(A)*x +  beta.y. 
-// Assumes that the condition k(p-1)^2 <2^53 is satisfied
-template<class Field>
-inline void 
-FFLAS::MatVectProd (const Field& F, const FFLAS_TRANSPOSE TransA, 
-		    const size_t M, const size_t N,
-		    const typename Field::Element alpha, 
-		    const typename Field::Element * A, const size_t lda,
-		    const typename Field::Element * X, const size_t incX,
-		    const typename Field::Element beta,
-		    typename Field::Element * Y, const size_t incY){
-	typename Field::Element  one, mone;
-	typename Field::Element tmp;
-	F.init(one,1.0);
-	F.init(mone,-1.0);
-	
-	size_t Xl, Yl;
-	if  (TransA == FflasNoTrans){Xl = N;Yl = M;}
-	else {Xl = M; Yl = N;}
-	double* Ad = new double[M*N];
-	double* Xd = new double[Xl];
-	double* Yd = new double[Yl];
-	double alphad, betad;
-	
-	if (F.areEqual (mone, alpha)){
-		alphad = -1.0;
-		F.convert (betad, beta);
-	} else {
-		if (! F.areEqual (one, alpha)){
-			// Compute C = A*B + beta/alpha.C
-			// and after C *= alpha
-			F.div (tmp, beta, alpha);
-			F.convert (betad, tmp);
-		} else
-			F.convert (betad, beta);
-		alphad = 1.0;
-	}
-	MatF2MatD (F, Ad, N, A, lda, M, N);
-	
-	double *Xdi=Xd;	
-	for (const typename Field::Element* Xi=X; Xi != X+Xl*incX; Xi+=incX, Xdi++)
-		F.convert (*(Xdi), *Xi);
-	double  *Ydi=Yd;
-	if (!F.isZero(beta))
-		for (typename Field::Element* Yi = Y; Yi != Y+Yl*incY; Yi+=incY, Ydi++)
-			F.convert (*(Ydi), *Yi);
-	
-	cblas_dgemv (CblasRowMajor, (CBLAS_TRANSPOSE) TransA, M, N, alphad,
-		     Ad, N, Xd, 1, betad, Yd, 1);
-	
-	Ydi=Yd;
-	for  (typename Field::Element* Yi = Y; Yi != Y+Yl*incY; Yi+=incY, Ydi++)
-		F.init (*Yi, *(Ydi));
-	
-	if  (!F.areEqual (one, alpha) && !F.areEqual (mone, alpha)){
-		// Fix-up: compute Y *= alpha
-		for (typename Field::Element* Yi = Y; Yi != Y+Yl*incY; Yi += incY)
-			F.mulin (*Yi , alpha);
-	}
-	delete[] Ad;
-	delete[] Xd;
-	delete[] Yd;
-}
-
-
-template<>
-inline void FFLAS::MatVectProd (const ModularBalanced<double>& F,
-				const FFLAS_TRANSPOSE TransA, 
-				const size_t M, const size_t N,
-				const double alpha, 
-				const double * A, const size_t lda,
-				const double * X, const size_t incX,
-				const double beta,
-				double * Y, const size_t incY){
-	
-	double Mone, one, _alpha, _beta;
-	F.init(one, 1UL);	
-	F.neg(Mone, one);
-	if (F.areEqual (Mone, beta)) _beta = -1.0;
-	else _beta = beta;
-	
-	if (F.areEqual (Mone, alpha)) _alpha = -1.0;
-	else{
-		_alpha = 1.0;
-		if (! F.areEqual (one, alpha))
-			// Compute y = A*x + beta/alpha.y
-			// and after y *= alpha
-			F.divin (_beta, alpha);
-	}
-	
-	cblas_dgemv (CblasRowMajor, (CBLAS_TRANSPOSE) TransA, M, N, 
-		     _alpha, A, lda, X, incX, _beta, Y, incY);
-	
-	for  (double * Yi = Y; Yi != Y+((TransA == FflasNoTrans)?M:N)*incY; Yi+=incY)
-		F.init (*Yi, *Yi);
-	
-	if ( (!F.areEqual (one, alpha)) && (!F.areEqual (Mone, alpha))){
-		// Fix-up: compute y *= alpha
-		for (double* Yi = Y; Yi != Y+((TransA == FflasNoTrans)?M:N)*incY; Yi += incY)
-			F.mulin (*Yi , alpha);
-	}
-}
-
-template<>
-inline void FFLAS::MatVectProd (const ModularBalanced<float>& F,
-				const FFLAS_TRANSPOSE TransA, 
-				const size_t M, const size_t N,
-				const float alpha, 
-				const float * A, const size_t lda,
-				const float * X, const size_t incX,
-				const float beta,
-				float * Y, const size_t incY){
-	
-	float Mone, one, _alpha, _beta;
-	F.init(one, 1UL);	
-	F.neg(Mone, one);
-	if  (F.areEqual (Mone, beta)) _beta = -1.0;
-	else _beta = beta;
-
-	if (F.areEqual (Mone, alpha)) _alpha = -1.0;
-	else{
-		_alpha = 1.0;
-		if (! F.areEqual (one, alpha)){
-			// Compute y = A*x + beta/alpha.y
-			// and after y *= alpha
-			F.divin (_beta, alpha);
-		}
-	}
-	cblas_sgemv (CblasRowMajor, (CBLAS_TRANSPOSE) TransA, M, N, 
-		     _alpha, A, lda, X, incX, _beta, Y, incY);
-	for  (float * Yi = Y; Yi != Y+((TransA == FflasNoTrans)?M:N)*incY; Yi+=incY)
-		F.init (*Yi, *Yi);
-	if ( (!F.areEqual (one, alpha)) && (!F.areEqual (Mone, alpha))){
-		// Fix-up: compute y *= alpha
-		for (float* Yi = Y; Yi != Y+((TransA == FflasNoTrans)?M:N)*incY; Yi += incY)
-			F.mulin (*Yi , alpha);
-	}
-}
-
-template<>
-inline void FFLAS::MatVectProd (const Modular<double>& F,
-				const FFLAS_TRANSPOSE TransA, 
-				const size_t M, const size_t N,
-				const double alpha, 
-				const double * A, const size_t lda,
-				const double * X, const size_t incX,
-				const double beta,
-				double * Y, const size_t incY){
-	
-	double Mone, one, _alpha, _beta;
-	F.init(one, 1UL);	
-	F.neg(Mone, one);
-	if (F.areEqual (Mone, beta)) _beta = -1.0;
-	else _beta = beta;
-	
-	if (F.areEqual (Mone, alpha)) _alpha = -1.0;
-	else{
-		_alpha = 1.0;
-		if (! F.areEqual (one, alpha))
-			// Compute y = A*x + beta/alpha.y
-			// and after y *= alpha
-			F.divin (_beta, alpha);
-	}
-	
-	cblas_dgemv (CblasRowMajor, (CBLAS_TRANSPOSE) TransA, M, N, 
-		     _alpha, A, lda, X, incX, _beta, Y, incY);
-	
-	for  (double * Yi = Y; Yi != Y+((TransA == FflasNoTrans)?M:N)*incY; Yi+=incY)
-		F.init (*Yi, *Yi);
-	
-	if ( (!F.areEqual (one, alpha)) && (!F.areEqual (Mone, alpha))){
-		// Fix-up: compute y *= alpha
-		for (double* Yi = Y; Yi != Y+((TransA == FflasNoTrans)?M:N)*incY; Yi += incY)
-			F.mulin (*Yi , alpha);
-	}
-}
-
-template<>
-inline void FFLAS::MatVectProd (const Modular<float>& F,
-				const FFLAS_TRANSPOSE TransA, 
-				const size_t M, const size_t N,
-				const float alpha, 
-				const float * A, const size_t lda,
-				const float * X, const size_t incX,
-				const float beta,
-				float * Y, const size_t incY){
-	
-	float Mone, one, _alpha, _beta;
-	F.init(one, 1UL);	
-	F.neg(Mone, one);
-	if  (F.areEqual (Mone, beta)) _beta = -1.0;
-	else _beta = beta;
-
-	if (F.areEqual (Mone, alpha)) _alpha = -1.0;
-	else{
-		_alpha = 1.0;
-		if (! F.areEqual (one, alpha)){
-			// Compute y = A*x + beta/alpha.y
-			// and after y *= alpha
-			F.divin (_beta, alpha);
-		}
-	}
-	cblas_sgemv (CblasRowMajor, (CBLAS_TRANSPOSE) TransA, M, N, 
-		     _alpha, A, lda, X, incX, _beta, Y, incY);
-	for  (float * Yi = Y; Yi != Y+((TransA == FflasNoTrans)?M:N)*incY; Yi+=incY)
-		F.init (*Yi, *Yi);
-	if ( (!F.areEqual (one, alpha)) && (!F.areEqual (Mone, alpha))){
-		// Fix-up: compute y *= alpha
-		for (float* Yi = Y; Yi != Y+((TransA == FflasNoTrans)?M:N)*incY; Yi += incY)
-			F.mulin (*Yi , alpha);
-	}
-}
-
-template<>
-inline void
-FFLAS::fgemv (const DoubleDomain& D, const FFLAS_TRANSPOSE TransA, 
-	      const size_t M, const size_t N,
-	      const DoubleDomain::Element  alpha, 
-	      const DoubleDomain::Element * A, const size_t lda,
-	      const DoubleDomain::Element * X, const size_t incX,
-	      const DoubleDomain::Element beta,
-	      DoubleDomain::Element * Y, const size_t incY) {
-	cblas_dgemv (CblasRowMajor, (CBLAS_TRANSPOSE) TransA, M, N, 
-		     alpha, A, lda, X, incX, beta, Y, incY);
-}
-
-template<>
-inline void
-FFLAS::fgemv (const FloatDomain& F, const FFLAS_TRANSPOSE TransA, 
-	      const size_t M, const size_t N,
-	      const FloatDomain::Element  alpha, 
-	      const FloatDomain::Element * A, const size_t lda,
-	      const FloatDomain::Element * X, const size_t incX,
-	      const FloatDomain::Element beta,
-	      FloatDomain::Element * Y, const size_t incY)
-{
-	cblas_sgemv (CblasRowMajor, (CBLAS_TRANSPOSE) TransA, M, N, 
-		     alpha, A, lda, X, incX, beta, Y, incY);
-}
diff --git a/linbox/fflas/fflas_fger.inl b/linbox/fflas/fflas_fger.inl
deleted file mode 100644
index 6ded070..0000000
--- a/linbox/fflas/fflas_fger.inl
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* fflas/fflas_fger.inl
- * Copyright (C) 2005 Clement Pernet
- *
- * Written by Clement Pernet <Clement.Pernet at imag.fr>
- *
- * See COPYING for license information.
- */
-
-template<class Field>
-inline void
-FFLAS::fger (const Field& F, const size_t M, const size_t N,
-	     const typename Field::Element alpha, 
-	     const typename Field::Element * x, const size_t incx,
-	     const typename Field::Element * y, const size_t incy, 
-	     typename Field::Element * A, const size_t lda){
-	
-	static typename Field::Element one, mone, tmp;
-	F.init( one, 1UL );
-	F.neg (mone, one);
-	const typename Field::Element* xi=x, *yj=y;
-	typename Field::Element* Ai=A;
-	
-	if ( M < N ){
-		if ( F.areEqual( alpha, one ) )
-			for ( ; Ai < A+M*lda; Ai+=lda, xi+=incx ){
-				yj = y;
-				for (size_t j = 0; j < N; ++j, yj+=incy )
-					F.axpyin( *(Ai+j), *xi, *yj );
-			}
-		else if ( F.areEqual( alpha, mone ) )
-			for ( ; Ai < A+M*lda; Ai+=lda, xi+=incx ){
-				F.neg( tmp, *xi );
-				yj = y;
-				for (size_t j = 0; j < N; ++j, yj+=incy )
-					F.axpyin( *(Ai+j), tmp, *yj );
-			}
-		else
-			for ( ; Ai < A+M*lda; Ai+=lda, xi+=incx ){
-				F.mul( tmp, alpha, *xi );
-				yj = y;
-				for (size_t j = 0; j < N; ++j, yj+=incy )
-					F.axpyin( *(Ai+j), tmp, *yj );
-			}
-	} else {
-		if ( F.areEqual( alpha, one ) ){
-			for ( ; Ai < A+N; ++Ai, yj+=incy ){
-				xi = x;
-				for (size_t i = 0; i < M; ++i, xi+=incx )
-					F.axpyin( *(Ai+i*lda), *xi, *yj );
-			}
-		}
-		else if ( F.areEqual( alpha, mone ) )
-			for ( ; Ai < A+N; ++Ai, yj+=incy ){
-				F.neg( tmp, *yj );
-				xi = x;
-				for (size_t i = 0; i < M; ++i, xi+=incx )
-					F.axpyin( *(Ai+i*lda), *xi, tmp );
-			}
-		else
-			for ( ; Ai < A+N; ++Ai, yj+=incy ){
-				F.mul( tmp, alpha, *yj );
-				xi = x;
-				for (size_t i = 0; i < M; ++i, xi+=incx )
-					F.axpyin( *(Ai+i*lda), *xi, tmp );
-			}
-	}
-			
-}
-
-template<>
-inline void
-FFLAS::fger( const DoubleDomain& D, const size_t M, const size_t N,
-		     const DoubleDomain::Element alpha, 
-		     const DoubleDomain::Element * x, const size_t incx,
-		     const DoubleDomain::Element * y, const size_t incy, 
-		     DoubleDomain::Element * A, const size_t lda){
-	
-	cblas_dger( CblasRowMajor, M, N, alpha, x, incx, y, incy, A, lda );
-}
diff --git a/linbox/fflas/fflas_ftrmm.inl b/linbox/fflas/fflas_ftrmm.inl
deleted file mode 100644
index d87de37..0000000
--- a/linbox/fflas/fflas_ftrmm.inl
+++ /dev/null
@@ -1,680 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* fflas/fflas_ftrmm.inl
- * Copyright (C) 2007 Clement Pernet
- *
- * Written by Clement Pernet <Clement.Pernet at imag.fr>
- *
- * See COPYING for license information.
- */
-
-
-//---------------------------------------------------------------------
-// ftrmm: TRiangular Matrix Multiply
-// Computes  B <- alpha.op(A).B,  B <- alpha.B.op(A)
-// B is M*N, A is M*M if Side==FflasLeft, N*N if Side==FflasRight
-// Warning : unsafe with Trans ==  FflasTrans (debugging in progress)
-// //---------------------------------------------------------------------
-template<class Field>
-inline void
-FFLAS::ftrmm (const Field& F, const FFLAS_SIDE Side,
-	      const FFLAS_UPLO Uplo, 
-	      const FFLAS_TRANSPOSE TransA,
-	      const FFLAS_DIAG Diag, 
-	      const size_t M, const size_t N,
-	      const typename Field::Element alpha,
-	      typename Field::Element * A, const size_t lda,
-	      typename Field::Element * B, const size_t ldb) 
-{
-	if (!M || !N ) return; 
-		
-	if ( Side==FflasLeft ){
-		if ( Uplo==FflasUpper){
-			if (TransA == FflasNoTrans){
-				if (Diag == FflasUnit)
-					ftrmmLeftUpperNoTransUnit<typename Field::Element> ()(F,M,N,A,lda,B,ldb);
-				else
-					ftrmmLeftUpperNoTransNonUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-			} else {
-				if (Diag == FflasUnit)
-					ftrmmLeftUpperTransUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-				else
-					ftrmmLeftUpperTransNonUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-			}
-		} else {
-			if (TransA == FflasNoTrans){
-				if (Diag == FflasUnit)
-					ftrmmLeftLowerNoTransUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-				else
-					ftrmmLeftLowerNoTransNonUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-			} else {
-				if (Diag == FflasUnit)
-					ftrmmLeftLowerTransUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-				else
-					ftrmmLeftLowerTransNonUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-			}
-		}
-	} else {
-		if ( Uplo == FflasUpper){
-			if (TransA == FflasNoTrans){
-				if (Diag == FflasUnit)
-					ftrmmRightUpperNoTransUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-				else
-					ftrmmRightUpperNoTransNonUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-			} else {
-				if (Diag == FflasUnit)
-					ftrmmRightUpperTransUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-				else
-					ftrmmRightUpperTransNonUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-			}
-		} else {
-			if (TransA == FflasNoTrans){
-				if (Diag == FflasUnit)
-					ftrmmRightLowerNoTransUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-				else
-					ftrmmRightLowerNoTransNonUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-			} else {
-				if (Diag == FflasUnit)
-					ftrmmRightLowerTransUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-				else
-					ftrmmRightLowerTransNonUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-			}
-		}
-	}
-	if (!F.isOne(alpha))
-		for (size_t i=0; i< M; ++i)
-			for (size_t j=0; j<N; ++j)
-				F.mulin(*(B+i*ldb+j),alpha);
-	
-}
-
-#define __FFLAS__GENERIC
-#define __FFLAS__LEFT
-#define __FFLAS__UP
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__LEFT
-#undef __FFLAS__UP
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__GENERIC
-#define __FFLAS__LEFT
-#define __FFLAS__UP
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__LEFT
-#undef __FFLAS__UP
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__UNIT
-
-#define __FFLAS__GENERIC
-#define __FFLAS__LEFT
-#define __FFLAS__UP
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__LEFT
-#undef __FFLAS__UP
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__GENERIC
-#define __FFLAS__LEFT
-#define __FFLAS__UP
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__LEFT
-#undef __FFLAS__UP
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__UNIT
-
-
-#define __FFLAS__GENERIC
-#define __FFLAS__LEFT
-#define __FFLAS__LOW
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__LEFT
-#undef __FFLAS__LOW
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__GENERIC
-#define __FFLAS__LEFT
-#define __FFLAS__LOW
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__LEFT
-#undef __FFLAS__LOW
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__UNIT
-
-#define __FFLAS__GENERIC
-#define __FFLAS__LEFT
-#define __FFLAS__LOW
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__LEFT
-#undef __FFLAS__LOW
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__GENERIC
-#define __FFLAS__LEFT
-#define __FFLAS__LOW
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__LEFT
-#undef __FFLAS__LOW
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__UNIT
-
-
-
-#define __FFLAS__GENERIC
-#define __FFLAS__RIGHT
-#define __FFLAS__UP
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__RIGHT
-#undef __FFLAS__UP
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__GENERIC
-#define __FFLAS__RIGHT
-#define __FFLAS__UP
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__RIGHT
-#undef __FFLAS__UP
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__UNIT
-
-#define __FFLAS__GENERIC
-#define __FFLAS__RIGHT
-#define __FFLAS__UP
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__RIGHT
-#undef __FFLAS__UP
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__GENERIC
-#define __FFLAS__RIGHT
-#define __FFLAS__UP
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__RIGHT
-#undef __FFLAS__UP
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__UNIT
-
-
-#define __FFLAS__GENERIC
-#define __FFLAS__RIGHT
-#define __FFLAS__LOW
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__RIGHT
-#undef __FFLAS__LOW
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__GENERIC
-#define __FFLAS__RIGHT
-#define __FFLAS__LOW
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__RIGHT
-#undef __FFLAS__LOW
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__UNIT
-
-#define __FFLAS__GENERIC
-#define __FFLAS__RIGHT
-#define __FFLAS__LOW
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__RIGHT
-#undef __FFLAS__LOW
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__GENERIC
-#define __FFLAS__RIGHT
-#define __FFLAS__LOW
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__RIGHT
-#undef __FFLAS__LOW
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__UNIT
-//==
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__LEFT
-#define __FFLAS__UP
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__LEFT
-#undef __FFLAS__UP
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__LEFT
-#define __FFLAS__UP
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__LEFT
-#undef __FFLAS__UP
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__UNIT
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__LEFT
-#define __FFLAS__UP
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__LEFT
-#undef __FFLAS__UP
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__LEFT
-#define __FFLAS__UP
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__LEFT
-#undef __FFLAS__UP
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__UNIT
-
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__LEFT
-#define __FFLAS__LOW
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__LEFT
-#undef __FFLAS__LOW
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__LEFT
-#define __FFLAS__LOW
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__LEFT
-#undef __FFLAS__LOW
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__UNIT
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__LEFT
-#define __FFLAS__LOW
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__LEFT
-#undef __FFLAS__LOW
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__LEFT
-#define __FFLAS__LOW
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__LEFT
-#undef __FFLAS__LOW
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__UNIT
-
-
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__RIGHT
-#define __FFLAS__UP
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__RIGHT
-#undef __FFLAS__UP
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__RIGHT
-#define __FFLAS__UP
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__RIGHT
-#undef __FFLAS__UP
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__UNIT
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__RIGHT
-#define __FFLAS__UP
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__RIGHT
-#undef __FFLAS__UP
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__RIGHT
-#define __FFLAS__UP
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__RIGHT
-#undef __FFLAS__UP
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__UNIT
-
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__RIGHT
-#define __FFLAS__LOW
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__RIGHT
-#undef __FFLAS__LOW
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__RIGHT
-#define __FFLAS__LOW
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__RIGHT
-#undef __FFLAS__LOW
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__UNIT
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__RIGHT
-#define __FFLAS__LOW
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__RIGHT
-#undef __FFLAS__LOW
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__RIGHT
-#define __FFLAS__LOW
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__RIGHT
-#undef __FFLAS__LOW
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__UNIT
-
-
-#define __FFLAS__FLOAT
-#define __FFLAS__LEFT
-#define __FFLAS__UP
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__LEFT
-#undef __FFLAS__UP
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__FLOAT
-#define __FFLAS__LEFT
-#define __FFLAS__UP
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__LEFT
-#undef __FFLAS__UP
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__UNIT
-
-#define __FFLAS__FLOAT
-#define __FFLAS__LEFT
-#define __FFLAS__UP
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__LEFT
-#undef __FFLAS__UP
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__FLOAT
-#define __FFLAS__LEFT
-#define __FFLAS__UP
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__LEFT
-#undef __FFLAS__UP
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__UNIT
-
-
-#define __FFLAS__FLOAT
-#define __FFLAS__LEFT
-#define __FFLAS__LOW
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__LEFT
-#undef __FFLAS__LOW
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__FLOAT
-#define __FFLAS__LEFT
-#define __FFLAS__LOW
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__LEFT
-#undef __FFLAS__LOW
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__UNIT
-
-#define __FFLAS__FLOAT
-#define __FFLAS__LEFT
-#define __FFLAS__LOW
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__LEFT
-#undef __FFLAS__LOW
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__FLOAT
-#define __FFLAS__LEFT
-#define __FFLAS__LOW
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__LEFT
-#undef __FFLAS__LOW
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__UNIT
-
-
-
-#define __FFLAS__FLOAT
-#define __FFLAS__RIGHT
-#define __FFLAS__UP
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__RIGHT
-#undef __FFLAS__UP
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__FLOAT
-#define __FFLAS__RIGHT
-#define __FFLAS__UP
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__RIGHT
-#undef __FFLAS__UP
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__UNIT
-
-#define __FFLAS__FLOAT
-#define __FFLAS__RIGHT
-#define __FFLAS__UP
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__RIGHT
-#undef __FFLAS__UP
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__FLOAT
-#define __FFLAS__RIGHT
-#define __FFLAS__UP
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__RIGHT
-#undef __FFLAS__UP
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__UNIT
-
-
-#define __FFLAS__FLOAT
-#define __FFLAS__RIGHT
-#define __FFLAS__LOW
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__RIGHT
-#undef __FFLAS__LOW
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__FLOAT
-#define __FFLAS__RIGHT
-#define __FFLAS__LOW
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__RIGHT
-#undef __FFLAS__LOW
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__UNIT
-
-#define __FFLAS__FLOAT
-#define __FFLAS__RIGHT
-#define __FFLAS__LOW
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__RIGHT
-#undef __FFLAS__LOW
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__FLOAT
-#define __FFLAS__RIGHT
-#define __FFLAS__LOW
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrmm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__RIGHT
-#undef __FFLAS__LOW
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__UNIT
-
diff --git a/linbox/fflas/fflas_ftrmm_src.inl b/linbox/fflas/fflas_ftrmm_src.inl
deleted file mode 100644
index 350ae44..0000000
--- a/linbox/fflas/fflas_ftrmm_src.inl
+++ /dev/null
@@ -1,269 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-#define Mjoin(pre, nam) my_join(pre, nam)
-#define my_join(pre, nam) pre ## nam
-
-#ifdef __FFLAS__TRANSPOSE
- #define __FFLAS__Acolinc lda
- #define __FFLAS__Arowinc 1
-#else
- #define __FFLAS__Acolinc 1
- #define __FFLAS__Arowinc lda
-#endif
-
-#ifdef __FFLAS__LEFT
- #define __FFLAS__SIDE Left
- #define __FFLAS__Na M
- #define __FFLAS__Nb N
- #define __FFLAS__Mb nsplit
- #define __FFLAS__Nb2 N
- #define __FFLAS__Mb2 M-nsplit
- #define __FFLAS__Mbrest nrestsplit
- #define __FFLAS__Nbrest N
- #define __FFLAS__Mupdate nrestsplit + i * nsplit
- #define __FFLAS__Nupdate N
- #define __FFLAS__Bdim N
- #define __FFLAS__Bnorminc 1
- #ifdef __FFLAS__LOW
-  #define __FFLAS__Atriang  A + (nbblocsplit - (i + 1)) * nsplit * (lda + 1)
-  #define __FFLAS__Aupdate __FFLAS__Atriang + nsplit * __FFLAS__Arowinc
-  #define __FFLAS__Arest A + nbblocsplit * nsplit * (lda+1)
-  #define __FFLAS__Brec B + (nbblocsplit - (i+1)) * nsplit * ldb
-  #define __FFLAS__Bupdate B + (nbblocsplit - i) * nsplit * ldb
-  #define __FFLAS__Brest B + nbblocsplit * nsplit * ldb
-  #define __FFLAS__A1 A + (nsplit) * (lda + 1)
-  #define __FFLAS__A2 A + (nsplit) * __FFLAS__Arowinc
-  #define __FFLAS__A3 A
-  #define __FFLAS__B1 B + (nsplit) * ldb 
-  #define __FFLAS__B2 B 
-#else
-  #define __FFLAS__Atriang A + (nrestsplit + i * nsplit) * (lda + 1)
-  #define __FFLAS__Aupdate A + (nrestsplit + i * nsplit) * __FFLAS__Acolinc
-  #define __FFLAS__Arest A 
-  #define __FFLAS__Brec B + (nrestsplit + i * nsplit) * ldb
-  #define __FFLAS__Bupdate B
-  #define __FFLAS__Brest B
-  #define __FFLAS__A1 A 
-  #define __FFLAS__A2 A + (M-nsplit) * __FFLAS__Acolinc
-  #define __FFLAS__A3 A + (M-nsplit) * (lda + 1)
-  #define __FFLAS__B1 B 
-  #define __FFLAS__B2 B + (M-nsplit) * ldb
- #endif
-#else	
- #define __FFLAS__SIDE Right
- #define __FFLAS__Na N
- #define __FFLAS__Nb nsplit
- #define __FFLAS__Mb M
- #define __FFLAS__Mb2 M
- #define __FFLAS__Nb2 N-nsplit
- #define __FFLAS__Mbrest M
- #define __FFLAS__Nbrest nrestsplit
- #define __FFLAS__Mupdate M
- #define __FFLAS__Nupdate nrestsplit + i * nsplit
- #define __FFLAS__Bdim M
- #define __FFLAS__Bnorminc ldb
- #ifdef __FFLAS__UP
-  #define __FFLAS__Atriang A + (nbblocsplit - (i + 1)) * nsplit * (lda + 1) 
-  #define __FFLAS__Aupdate __FFLAS__Atriang + nsplit * __FFLAS__Acolinc
-  #define __FFLAS__Arest A + nbblocsplit * nsplit * (lda+1)
-  #define __FFLAS__Brec B + (nbblocsplit - (i+1)) * nsplit 
-  #define __FFLAS__Bupdate B + (nbblocsplit - i) * nsplit 
-  #define __FFLAS__Brest B + nbblocsplit * nsplit
-  #define __FFLAS__A1 A + (nsplit) * (lda + 1)
-  #define __FFLAS__A2 A + (nsplit) * __FFLAS__Acolinc
-  #define __FFLAS__A3 A
-  #define __FFLAS__B1 B + nsplit
-  #define __FFLAS__B2 B 
-#else
-  #define __FFLAS__Atriang A + (nrestsplit + i * nsplit) * (lda + 1) 
-  #define __FFLAS__Aupdate A + (nrestsplit + i * nsplit) * __FFLAS__Arowinc 
-  #define __FFLAS__Arest A
-  #define __FFLAS__Brec B + (nrestsplit + i * nsplit) 
-  #define __FFLAS__Bupdate B 
-  #define __FFLAS__Brest B
-  #define __FFLAS__A1 A
-  #define __FFLAS__A2 A + (N-nsplit) * __FFLAS__Arowinc
-  #define __FFLAS__A3 A + (N-nsplit) * (lda + 1)
-  #define __FFLAS__B1 B 
-  #define __FFLAS__B2 B + N-nsplit 
- #endif
-#endif
-
-#ifdef __FFLAS__UP
- #define __FFLAS__UPLO Upper
-#else
- #define __FFLAS__UPLO Lower
-#endif
-
-#ifdef __FFLAS__UNIT
- #define __FFLAS__DIAG Unit
-#else
- #define __FFLAS__DIAG NonUnit
-#endif
-
-#ifdef __FFLAS__TRANSPOSE
- #define __FFLAS__TRANS Trans
-#else
- #define __FFLAS__TRANS NoTrans
-#endif
-
-#ifdef __FFLAS__DOUBLE
- #define __FFLAS__ELEMENT double
- #define __FFLAS__DOMAIN DoubleDomain
- #define __FFLAS__BLAS_PREFIX d
-#endif
-
-#ifdef __FFLAS__FLOAT
- #define __FFLAS__ELEMENT float
- #define __FFLAS__DOMAIN FloatDomain
- #define __FFLAS__BLAS_PREFIX s
-#endif
-
-#ifdef __FFLAS__GENERIC
- #define __FFLAS__ELEMENT Element
-#endif
-
-
-
-#ifndef __FFLAS__GENERIC
-template <>
-class FFLAS::Mjoin(ftrmm, Mjoin(__FFLAS__SIDE, Mjoin(__FFLAS__UPLO, Mjoin(__FFLAS__TRANS, __FFLAS__DIAG))))<__FFLAS__ELEMENT>{
-public:
-
-template <class Field>
-void delayed (const Field& F, const size_t M, const size_t N,
-	      typename Field::Element * A, const size_t lda,
-	      typename Field::Element * B, const size_t ldb) {
-	
-	Mjoin(cblas_,Mjoin(__FFLAS__BLAS_PREFIX,trmm))
-		(CblasRowMajor,
-		 Mjoin (Cblas, __FFLAS__SIDE),
-		 Mjoin (Cblas, __FFLAS__UPLO),
-		 Mjoin (Cblas, __FFLAS__TRANS),
-		 Mjoin (Cblas, __FFLAS__DIAG),
-		 M, N, 1.0, A, lda, B, ldb );
-	for (size_t i = 0; i < M; ++i)
-		for (size_t j = 0; j < N; ++j)
-			F.init (*(B + i*ldb + j), *(B + i*ldb + j));
-}
- 
-template <class Field>
-void operator () (const Field& F, const size_t M, const size_t N,
-		  typename Field::Element * A, const size_t lda,
-		  typename Field::Element * B, const size_t ldb) {
-	
-	if (!M || !N ) return;
-	
-	static typename Field::Element one;
-	F.init(one, 1.0);
-	
-	size_t nsplit = DotProdBound (F, 0, one,
-#ifdef __FFLAS__DOUBLE
-				    FflasDouble
-#else
-                                    FflasFloat
-#endif
-				    );
-
-	size_t nbblocsplit = (__FFLAS__Na-1) / nsplit;
-	size_t nrestsplit = ((__FFLAS__Na-1) % nsplit) +1;
-	
-	if (nrestsplit)
-		this->delayed (F, __FFLAS__Mbrest, __FFLAS__Nbrest,
-			       __FFLAS__Arest, lda, __FFLAS__Brest, ldb);
-	
-	for ( size_t  i = 0; i < nbblocsplit; ++i) {
-		
-#ifdef __FFLAS__RIGHT
-		fgemm (F, FflasNoTrans, Mjoin (Fflas, __FFLAS__TRANS),
-		       __FFLAS__Mupdate, __FFLAS__Nupdate, nsplit, one,
-		       __FFLAS__Brec, ldb, __FFLAS__Aupdate, lda, one, __FFLAS__Bupdate, ldb);
-#else
-		fgemm (F, Mjoin (Fflas, __FFLAS__TRANS),  FflasNoTrans,
-		       __FFLAS__Mupdate, __FFLAS__Nupdate, nsplit, one,
-		       __FFLAS__Aupdate, lda, __FFLAS__Brec, ldb, one, __FFLAS__Bupdate, ldb);
-#endif
-
-		this->delayed (F, __FFLAS__Mb, __FFLAS__Nb,
-			       __FFLAS__Atriang, lda, __FFLAS__Brec, ldb);
-					 
-
-	}
-}
-
-}; //class ftrmm....
-
-#else // __FFLAS__GENERIC
-
-template <class Element>
-class FFLAS::Mjoin(ftrmm, Mjoin(__FFLAS__SIDE, Mjoin(__FFLAS__UPLO, Mjoin(__FFLAS__TRANS, __FFLAS__DIAG)))) {
-public:
-
-template<class Field>
-void operator()	(const Field& F, const size_t M, const size_t N,
-		 typename Field::Element * A, const size_t lda,
-		 typename Field::Element * B, const size_t ldb) {
-	
-	static typename Field::Element one;
-	F.init(one, 1.0);
-	if (__FFLAS__Na == 1)
-#ifdef __FFLAS__NONUNIT
-		fscal(F, __FFLAS__Bdim, *A, B, __FFLAS__Bnorminc);
-#else
-       ;
-#endif
-	
-	 else { // __FFLAS__Na > 1
-		size_t nsplit = __FFLAS__Na >> 1;
-		this->operator() (F, __FFLAS__Mb2, __FFLAS__Nb2, __FFLAS__A1, lda, __FFLAS__B1, ldb);
-		
-#ifdef __FFLAS__RIGHT
-		fgemm (F, FflasNoTrans , Mjoin (Fflas, __FFLAS__TRANS),
-		       __FFLAS__Mb2, __FFLAS__Nb2, nsplit, one,
-		       __FFLAS__B2, ldb, __FFLAS__A2, lda, one, __FFLAS__B1, ldb);
-#else
-		fgemm (F, Mjoin (Fflas, __FFLAS__TRANS), FflasNoTrans,
-		       __FFLAS__Mb2, __FFLAS__Nb2, nsplit, one,
-		       __FFLAS__A2, lda, __FFLAS__B2, ldb, one, __FFLAS__B1, ldb);
-#endif
-		this->operator() (F, __FFLAS__Mb, __FFLAS__Nb, __FFLAS__A3, lda, __FFLAS__B2, ldb);
-	}
-}
-};
-
-#endif // __FFLAS__GENERIC
-
-
-#undef __FFLAS__UPLO
-#undef __FFLAS__DIAG
-#undef __FFLAS__SIDE
-#undef __FFLAS__TRANS
-#undef __FFLAS__Na
-#undef __FFLAS__Mb
-#undef __FFLAS__Nb
-#undef __FFLAS__Mbrest
-#undef __FFLAS__Nbrest 
-#undef __FFLAS__Mupdate 
-#undef __FFLAS__Nupdate
-#undef __FFLAS__Atriang 
-#undef __FFLAS__Aupdate
-#undef __FFLAS__Arest 
-#undef __FFLAS__Bupdate 
-#undef __FFLAS__Brec 
-#undef __FFLAS__Brest
-#undef __FFLAS__ELEMENT
-#undef __FFLAS__BLAS_PREFIX
-#undef __FFLAS__DOMAIN
-#undef __FFLAS__A1
-#undef __FFLAS__A2
-#undef __FFLAS__A3
-#undef __FFLAS__B1
-#undef __FFLAS__B2
-#undef __FFLAS__Nb2
-#undef __FFLAS__Mb2
-#undef __FFLAS__Bdim
-#undef __FFLAS__Acolinc
-#undef __FFLAS__Arowinc
-#undef __FFLAS__Bnorminc
-#undef Mjoin
-#undef my_join
diff --git a/linbox/fflas/fflas_ftrsm.inl b/linbox/fflas/fflas_ftrsm.inl
deleted file mode 100644
index 4c7d250..0000000
--- a/linbox/fflas/fflas_ftrsm.inl
+++ /dev/null
@@ -1,680 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* fflas/fflas_ftrsm.inl
- * Copyright (C) 2005 Clement Pernet
- *
- * Written by Clement Pernet <Clement.Pernet at imag.fr>
- *
- * See COPYING for license information.
- */
-
-
-//---------------------------------------------------------------------
-// ftrsm: TRiangular System solve with matrix
-// Computes  B <- alpha.op(A^-1).B,  B <- alpha.B.op(A^-1)
-// B is M*N, A is M*M if Side==FflasLeft, N*N if Side==FflasRight
-// Warning : unsafe with Trans ==  FflasTrans (debugging in progress)
-//---------------------------------------------------------------------
-template<class Field>
-inline void
-FFLAS::ftrsm (const Field& F, const FFLAS_SIDE Side,
-	      const FFLAS_UPLO Uplo, 
-	      const FFLAS_TRANSPOSE TransA,
-	      const FFLAS_DIAG Diag, 
-	      const size_t M, const size_t N,
-	      const typename Field::Element alpha,
-	      typename Field::Element * A, const size_t lda,
-	      typename Field::Element * B, const size_t ldb) 
-{
-	if (!M || !N ) return; 
-
-		
-	if ( Side==FflasLeft ){
-		if ( Uplo==FflasUpper){
-			if (TransA == FflasNoTrans){
-				if (Diag == FflasUnit)
-					ftrsmLeftUpperNoTransUnit<typename Field::Element> ()(F,M,N,A,lda,B,ldb);
-				else
-					ftrsmLeftUpperNoTransNonUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-			} else {
-				if (Diag == FflasUnit)
-					ftrsmLeftUpperTransUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-				else
-					ftrsmLeftUpperTransNonUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-			}
-		} else {
-			if (TransA == FflasNoTrans){
-				if (Diag == FflasUnit)
-					ftrsmLeftLowerNoTransUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-				else
-					ftrsmLeftLowerNoTransNonUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-			} else {
-				if (Diag == FflasUnit)
-					ftrsmLeftLowerTransUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-				else
-					ftrsmLeftLowerTransNonUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-			}
-		}
-	} else {
-		if ( Uplo == FflasUpper){
-			if (TransA == FflasNoTrans){
-				if (Diag == FflasUnit)
-					ftrsmRightUpperNoTransUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-				else
-					ftrsmRightUpperNoTransNonUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-			} else {
-				if (Diag == FflasUnit)
-					ftrsmRightUpperTransUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-				else
-					ftrsmRightUpperTransNonUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-			}
-		} else {
-			if (TransA == FflasNoTrans){
-				if (Diag == FflasUnit)
-					ftrsmRightLowerNoTransUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-				else
-					ftrsmRightLowerNoTransNonUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-			} else {
-				if (Diag == FflasUnit)
-					ftrsmRightLowerTransUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-				else
-					ftrsmRightLowerTransNonUnit<typename Field::Element>()(F,M,N,A,lda,B,ldb);
-			}
-		}
-	}
-	if (!F.isOne(alpha))
-		for (size_t i=0; i< M; ++i)
-			for (size_t j=0; j<N; ++j)
-				F.mulin(*(B+i*ldb+j),alpha);
-	
-}
-
-#define __FFLAS__GENERIC
-#define __FFLAS__LEFT
-#define __FFLAS__UP
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__LEFT
-#undef __FFLAS__UP
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__GENERIC
-#define __FFLAS__LEFT
-#define __FFLAS__UP
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__LEFT
-#undef __FFLAS__UP
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__UNIT
-
-#define __FFLAS__GENERIC
-#define __FFLAS__LEFT
-#define __FFLAS__UP
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__LEFT
-#undef __FFLAS__UP
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__GENERIC
-#define __FFLAS__LEFT
-#define __FFLAS__UP
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__LEFT
-#undef __FFLAS__UP
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__UNIT
-
-
-#define __FFLAS__GENERIC
-#define __FFLAS__LEFT
-#define __FFLAS__LOW
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__LEFT
-#undef __FFLAS__LOW
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__GENERIC
-#define __FFLAS__LEFT
-#define __FFLAS__LOW
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__LEFT
-#undef __FFLAS__LOW
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__UNIT
-
-#define __FFLAS__GENERIC
-#define __FFLAS__LEFT
-#define __FFLAS__LOW
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__LEFT
-#undef __FFLAS__LOW
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__GENERIC
-#define __FFLAS__LEFT
-#define __FFLAS__LOW
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__LEFT
-#undef __FFLAS__LOW
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__UNIT
-
-
-
-#define __FFLAS__GENERIC
-#define __FFLAS__RIGHT
-#define __FFLAS__UP
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__RIGHT
-#undef __FFLAS__UP
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__GENERIC
-#define __FFLAS__RIGHT
-#define __FFLAS__UP
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__RIGHT
-#undef __FFLAS__UP
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__UNIT
-
-#define __FFLAS__GENERIC
-#define __FFLAS__RIGHT
-#define __FFLAS__UP
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__RIGHT
-#undef __FFLAS__UP
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__GENERIC
-#define __FFLAS__RIGHT
-#define __FFLAS__UP
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__RIGHT
-#undef __FFLAS__UP
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__UNIT
-
-
-#define __FFLAS__GENERIC
-#define __FFLAS__RIGHT
-#define __FFLAS__LOW
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__RIGHT
-#undef __FFLAS__LOW
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__GENERIC
-#define __FFLAS__RIGHT
-#define __FFLAS__LOW
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__RIGHT
-#undef __FFLAS__LOW
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__UNIT
-
-#define __FFLAS__GENERIC
-#define __FFLAS__RIGHT
-#define __FFLAS__LOW
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__RIGHT
-#undef __FFLAS__LOW
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__GENERIC
-#define __FFLAS__RIGHT
-#define __FFLAS__LOW
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__GENERIC
-#undef __FFLAS__RIGHT
-#undef __FFLAS__LOW
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__UNIT
-//==
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__LEFT
-#define __FFLAS__UP
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__LEFT
-#undef __FFLAS__UP
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__LEFT
-#define __FFLAS__UP
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__LEFT
-#undef __FFLAS__UP
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__UNIT
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__LEFT
-#define __FFLAS__UP
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__LEFT
-#undef __FFLAS__UP
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__LEFT
-#define __FFLAS__UP
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__LEFT
-#undef __FFLAS__UP
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__UNIT
-
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__LEFT
-#define __FFLAS__LOW
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__LEFT
-#undef __FFLAS__LOW
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__LEFT
-#define __FFLAS__LOW
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__LEFT
-#undef __FFLAS__LOW
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__UNIT
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__LEFT
-#define __FFLAS__LOW
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__LEFT
-#undef __FFLAS__LOW
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__LEFT
-#define __FFLAS__LOW
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__LEFT
-#undef __FFLAS__LOW
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__UNIT
-
-
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__RIGHT
-#define __FFLAS__UP
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__RIGHT
-#undef __FFLAS__UP
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__RIGHT
-#define __FFLAS__UP
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__RIGHT
-#undef __FFLAS__UP
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__UNIT
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__RIGHT
-#define __FFLAS__UP
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__RIGHT
-#undef __FFLAS__UP
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__RIGHT
-#define __FFLAS__UP
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__RIGHT
-#undef __FFLAS__UP
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__UNIT
-
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__RIGHT
-#define __FFLAS__LOW
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__RIGHT
-#undef __FFLAS__LOW
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__RIGHT
-#define __FFLAS__LOW
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__RIGHT
-#undef __FFLAS__LOW
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__UNIT
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__RIGHT
-#define __FFLAS__LOW
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__RIGHT
-#undef __FFLAS__LOW
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__DOUBLE
-#define __FFLAS__RIGHT
-#define __FFLAS__LOW
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__DOUBLE
-#undef __FFLAS__RIGHT
-#undef __FFLAS__LOW
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__UNIT
-
-
-#define __FFLAS__FLOAT
-#define __FFLAS__LEFT
-#define __FFLAS__UP
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__LEFT
-#undef __FFLAS__UP
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__FLOAT
-#define __FFLAS__LEFT
-#define __FFLAS__UP
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__LEFT
-#undef __FFLAS__UP
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__UNIT
-
-#define __FFLAS__FLOAT
-#define __FFLAS__LEFT
-#define __FFLAS__UP
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__LEFT
-#undef __FFLAS__UP
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__FLOAT
-#define __FFLAS__LEFT
-#define __FFLAS__UP
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__LEFT
-#undef __FFLAS__UP
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__UNIT
-
-
-#define __FFLAS__FLOAT
-#define __FFLAS__LEFT
-#define __FFLAS__LOW
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__LEFT
-#undef __FFLAS__LOW
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__FLOAT
-#define __FFLAS__LEFT
-#define __FFLAS__LOW
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__LEFT
-#undef __FFLAS__LOW
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__UNIT
-
-#define __FFLAS__FLOAT
-#define __FFLAS__LEFT
-#define __FFLAS__LOW
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__LEFT
-#undef __FFLAS__LOW
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__FLOAT
-#define __FFLAS__LEFT
-#define __FFLAS__LOW
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__LEFT
-#undef __FFLAS__LOW
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__UNIT
-
-
-
-#define __FFLAS__FLOAT
-#define __FFLAS__RIGHT
-#define __FFLAS__UP
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__RIGHT
-#undef __FFLAS__UP
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__FLOAT
-#define __FFLAS__RIGHT
-#define __FFLAS__UP
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__RIGHT
-#undef __FFLAS__UP
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__UNIT
-
-#define __FFLAS__FLOAT
-#define __FFLAS__RIGHT
-#define __FFLAS__UP
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__RIGHT
-#undef __FFLAS__UP
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__FLOAT
-#define __FFLAS__RIGHT
-#define __FFLAS__UP
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__RIGHT
-#undef __FFLAS__UP
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__UNIT
-
-
-#define __FFLAS__FLOAT
-#define __FFLAS__RIGHT
-#define __FFLAS__LOW
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__RIGHT
-#undef __FFLAS__LOW
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__FLOAT
-#define __FFLAS__RIGHT
-#define __FFLAS__LOW
-#define __FFLAS__NOTRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__RIGHT
-#undef __FFLAS__LOW
-#undef __FFLAS__NOTRANSPOSE
-#undef __FFLAS__UNIT
-
-#define __FFLAS__FLOAT
-#define __FFLAS__RIGHT
-#define __FFLAS__LOW
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__NONUNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__RIGHT
-#undef __FFLAS__LOW
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__NONUNIT
-
-#define __FFLAS__FLOAT
-#define __FFLAS__RIGHT
-#define __FFLAS__LOW
-#define __FFLAS__TRANSPOSE
-#define __FFLAS__UNIT
-#include "fflas_ftrsm_src.inl"
-#undef __FFLAS__FLOAT
-#undef __FFLAS__RIGHT
-#undef __FFLAS__LOW
-#undef __FFLAS__TRANSPOSE
-#undef __FFLAS__UNIT
diff --git a/linbox/fflas/fflas_ftrsm_src.inl b/linbox/fflas/fflas_ftrsm_src.inl
deleted file mode 100644
index e166774..0000000
--- a/linbox/fflas/fflas_ftrsm_src.inl
+++ /dev/null
@@ -1,359 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-#define Mjoin(pre, nam) my_join(pre, nam)
-#define my_join(pre, nam) pre ## nam
-
-#ifdef __FFLAS__TRANSPOSE
- #define __FFLAS__Acolinc lda
- #define __FFLAS__Arowinc 1
-#else
- #define __FFLAS__Acolinc 1
- #define __FFLAS__Arowinc lda
-#endif
-
-#ifdef __FFLAS__LEFT
- #define __FFLAS__SIDE Left
- #define __FFLAS__Na M
- #define __FFLAS__Nb N
- #define __FFLAS__Mb nsplit
- #define __FFLAS__Nb2 N
- #define __FFLAS__Mb2 M-nsplit
- #define __FFLAS__Mbrest nrestsplit
- #define __FFLAS__Nbrest N
- #define __FFLAS__Mupdate M-(i+1)*nsplit
- #define __FFLAS__Nupdate N
- #define __FFLAS__Anorminc __FFLAS__Acolinc
- #define __FFLAS__Bnorminc 1
- #define __FFLAS__Bnormnext ldb
- #define __FFLAS__Bdim N
- #ifdef __FFLAS__LOW
-  #define __FFLAS__Atriang A + i * nsplit * (lda + 1)			
-  #define __FFLAS__Aupdate A + i * nsplit * (lda + 1) + nsplit*__FFLAS__Arowinc
-  #define __FFLAS__Arest A + (__FFLAS__Na - nrestsplit) * (lda + 1)
-  #define __FFLAS__Anormnext __FFLAS__Arowinc
-  #define __FFLAS__Bupdate B + (i+1)*nsplit*ldb
-  #define __FFLAS__Brec B + i * nsplit * ldb
-  #define __FFLAS__Brest B + (M - nrestsplit) * ldb
-  #define __FFLAS__A1 A
-  #define __FFLAS__A2 A + nsplit * __FFLAS__Arowinc
-  #define __FFLAS__A3 A + nsplit * (lda + 1)
-  #define __FFLAS__B1 B
-  #define __FFLAS__B2 B + nsplit * ldb
-  #define __FFLAS__Normdim i
-#else
-  #define __FFLAS__Atriang A + (__FFLAS__Na - (i + 1) * nsplit) * (lda + 1)
-  #define __FFLAS__Aupdate A + (__FFLAS__Na  - (i + 1) * nsplit) * __FFLAS__Acolinc
-  #define __FFLAS__Arest A 
-  #define __FFLAS__Anormnext lda + 1
-  #define __FFLAS__Bupdate B
-  #define __FFLAS__Brec B + (M - (i + 1) * nsplit) * ldb
-  #define __FFLAS__Brest B
-  #define __FFLAS__A1 A + (__FFLAS__Na - nsplit) * (lda + 1)
-  #define __FFLAS__A2 A + (__FFLAS__Na - nsplit) * __FFLAS__Acolinc
-  #define __FFLAS__A3 A 
-  #define __FFLAS__B1 B + (M - nsplit)*ldb
-  #define __FFLAS__B2 B
-  #define __FFLAS__Normdim __FFLAS__Na-i-1
- #endif
-#else	
- #define __FFLAS__SIDE Right
- #define __FFLAS__Na N
- #define __FFLAS__Nb nsplit
- #define __FFLAS__Mb M
- #define __FFLAS__Mb2 M
- #define __FFLAS__Nb2 N-nsplit
- #define __FFLAS__Mbrest M
- #define __FFLAS__Nbrest nrestsplit
- #define __FFLAS__Mupdate M
- #define __FFLAS__Nupdate N - (i + 1) * nsplit
- #define __FFLAS__Anorminc __FFLAS__Arowinc
- #define __FFLAS__Bnorminc ldb
- #define __FFLAS__Bnormnext 1
- #define __FFLAS__Bdim M
- #ifdef __FFLAS__UP
-  #define __FFLAS__Atriang A + i * nsplit * (lda + 1)
-  #define __FFLAS__Aupdate A + i * nsplit * (lda + 1) + nsplit * __FFLAS__Acolinc
-  #define __FFLAS__Arest A + (__FFLAS__Na - nrestsplit) * (lda + 1)
-  #define __FFLAS__Anormnext __FFLAS__Acolinc
-  #define __FFLAS__Bupdate B + (i + 1) * nsplit
-  #define __FFLAS__Brec B + i * nsplit
-  #define __FFLAS__Brest B + (N - nrestsplit)
-  #define __FFLAS__A1 A
-  #define __FFLAS__A2 A + nsplit * __FFLAS__Acolinc
-  #define __FFLAS__A3 A + nsplit * (lda + 1)
-  #define __FFLAS__B1 B
-  #define __FFLAS__B2 B + nsplit
-  #define __FFLAS__Normdim i
-#else
-  #define __FFLAS__Atriang A + (__FFLAS__Na - (i + 1) * nsplit) * (lda + 1)
-  #define __FFLAS__Aupdate A + (__FFLAS__Na - (i + 1) * nsplit) * __FFLAS__Arowinc
-  #define __FFLAS__Arest A
-  #define __FFLAS__Anormnext lda + 1
-  #define __FFLAS__Bupdate B
-  #define __FFLAS__Brec B + N - (i + 1) * nsplit
-  #define __FFLAS__Brest B
-  #define __FFLAS__A1 A + (__FFLAS__Na - nsplit) * (lda + 1)
-  #define __FFLAS__A2 A + (__FFLAS__Na - nsplit) * __FFLAS__Arowinc
-  #define __FFLAS__A3 A 
-  #define __FFLAS__B1 B + N - nsplit
-  #define __FFLAS__B2 B
-  #define __FFLAS__Normdim __FFLAS__Na - i -1
- #endif
-#endif
-
-#ifdef __FFLAS__UP
- #define __FFLAS__UPLO Upper
-#else
- #define __FFLAS__UPLO Lower
-#endif
-
-#ifdef __FFLAS__UNIT
- #define __FFLAS__DIAG Unit
-#else
- #define __FFLAS__DIAG NonUnit
-#endif
-
-#ifdef __FFLAS__TRANSPOSE
- #define __FFLAS__TRANS Trans
-#else
- #define __FFLAS__TRANS NoTrans
-#endif
-
-#ifdef __FFLAS__DOUBLE
- #define __FFLAS__ELEMENT double
- #define __FFLAS__DOMAIN DoubleDomain
- #define __FFLAS__BLAS_PREFIX d
-#endif
-
-#ifdef __FFLAS__FLOAT
- #define __FFLAS__ELEMENT float
- #define __FFLAS__DOMAIN FloatDomain
- #define __FFLAS__BLAS_PREFIX s
-#endif
-
-#ifdef __FFLAS__GENERIC
- #define __FFLAS__ELEMENT Element
-#endif
-
-
-
-#ifndef __FFLAS__GENERIC
-template <>
-class FFLAS::Mjoin(ftrsm, Mjoin(__FFLAS__SIDE, Mjoin(__FFLAS__UPLO, Mjoin(__FFLAS__TRANS, __FFLAS__DIAG))))<__FFLAS__ELEMENT>{
-public:
-
-// TRSM with delayed updates: assumes input in Zp and ensures output in Zp.
-// The multiple MatMul updates (recursive sequence) are done over Z
-template<class Field>
-void delayed (const Field& F, const size_t M, const size_t N,
-	      typename Field::Element * A, const size_t lda,
-	      typename Field::Element * B, const size_t ldb,
-	      const size_t nblas, size_t nbblocsblas) {
-	
-	static typename Field::Element Mone;
-	static typename Field::Element one;
-
-	static __FFLAS__DOMAIN D;
-
-	F.init(one, 1.0);
-	F.neg(Mone,one);
-
-	if ( __FFLAS__Na <= nblas ){
-		for (size_t i=0; i < M; ++i)
-			for (size_t j = 0; j < N; ++j)
-				F.init( *(B + i*ldb + j), *( B + i*ldb + j));
-#ifndef __FFLAS__UNIT
-		typename Field::Element inv;
-		typename Field::Element *  Ai = A, * Bi = B;
-#ifdef __FFLAS__LEFT
-#ifdef __FFLAS__UP
-		Ai += __FFLAS__Acolinc;
-#endif
-#endif
-#ifdef __FFLAS__RIGHT
-#ifdef __FFLAS__LOW
-		Ai += __FFLAS__Arowinc; 
-#endif
-#endif
-		for (size_t i = 0; i < __FFLAS__Na; ++i){
-			F.inv (inv, *(A + i * (lda+1)));
-			fscal (F, __FFLAS__Normdim, inv, Ai, __FFLAS__Anorminc);
-			fscal (F, __FFLAS__Bdim, inv, Bi, __FFLAS__Bnorminc);
-			Ai += __FFLAS__Anormnext;
-			Bi += __FFLAS__Bnormnext;
-		}
-#endif // __FFLAS__UNIT
-		Mjoin(cblas_,Mjoin(__FFLAS__BLAS_PREFIX,trsm))
-			(CblasRowMajor,
-			 Mjoin (Cblas, __FFLAS__SIDE),
-			 Mjoin (Cblas, __FFLAS__UPLO),
-			 Mjoin (Cblas, __FFLAS__TRANS),
-			 CblasUnit,
-			 M, N, 1.0, A, lda, B, ldb );
-		for (size_t i = 0; i < M; ++i)
-			for (size_t j = 0; j < N; ++j)
-				F.init (*(B + i*ldb + j), *(B + i*ldb + j));
-				
-#ifndef __FFLAS__UNIT
-		Ai = A;
-#ifdef __FFLAS__LEFT
-#ifdef __FFLAS__UP
-		Ai += __FFLAS__Acolinc;
-#endif
-#endif
-#ifdef __FFLAS__RIGHT
-#ifdef __FFLAS__LOW
-		Ai += __FFLAS__Arowinc; 
-#endif
-#endif
-		for (size_t i = 0; i < __FFLAS__Na; ++i){
-			fscal( F, __FFLAS__Normdim, *(A + i * (lda+1)) , Ai, __FFLAS__Anorminc);
-			Ai += __FFLAS__Anormnext;
-		}
-#endif // __FFLAS__UNIT
-	} else { // __FFLAS__Na <= nblas
-		size_t nbblocsup = (nbblocsblas + 1) / 2;
-		size_t nsplit = nbblocsup * nblas;
-
-		this->delayed (F, __FFLAS__Mb, __FFLAS__Nb,
-			       __FFLAS__A1, lda, __FFLAS__B1, ldb, nblas, nbblocsup);
-
-#ifdef __FFLAS__RIGHT
-		fgemm (D, FflasNoTrans, Mjoin (Fflas, __FFLAS__TRANS), __FFLAS__Mb2, __FFLAS__Nb2, nsplit,
-		       -1.0, __FFLAS__B1, ldb, __FFLAS__A2, lda, one, __FFLAS__B2, ldb);
-#else
-		fgemm (D, Mjoin (Fflas, __FFLAS__TRANS), FflasNoTrans, __FFLAS__Mb2, __FFLAS__Nb2, nsplit,
-		       -1.0, __FFLAS__A2, lda, __FFLAS__B1, ldb, one, __FFLAS__B2, ldb);
-#endif
-
-		this->delayed (F, __FFLAS__Mb2, __FFLAS__Nb2,
-			       __FFLAS__A3, lda, __FFLAS__B2, ldb, nblas, nbblocsblas - nbblocsup);
-	}
-}
-template <class Field>
-void operator () (const Field& F, const size_t M, const size_t N,
-		  typename Field::Element * A, const size_t lda,
-		  typename Field::Element * B, const size_t ldb) {
-	
-	if (!M || !N ) return;
-		
-	static typename Field::Element one, Mone;
-	F.init(one, 1.0);
-	F.neg(Mone, one);
-	
-	static __FFLAS__DOMAIN D;
-	size_t nblas = TRSMBound<Field> (F);
-
-	size_t ndel = DotProdBound (F, 0, one,
-#ifdef __FFLAS__DOUBLE
-				    FflasDouble);
-#else
-	                            FflasFloat);
-#endif
-        ndel = (ndel / nblas)*nblas;
-	size_t nsplit = ndel;
-	size_t nbblocsplit = (__FFLAS__Na-1) / nsplit;
-	size_t nrestsplit = ((__FFLAS__Na-1) % nsplit) +1;
-	
-	for ( size_t  i = 0; i < nbblocsplit; ++i) {
-		this->delayed (F, __FFLAS__Mb, __FFLAS__Nb,
-			       __FFLAS__Atriang, lda, __FFLAS__Brec, ldb, nblas, nsplit / nblas);
-					 
-#ifdef __FFLAS__RIGHT
-		fgemm (F, FflasNoTrans, Mjoin (Fflas, __FFLAS__TRANS),
-		       __FFLAS__Mupdate, __FFLAS__Nupdate, nsplit, Mone,
-		       __FFLAS__Brec, ldb, __FFLAS__Aupdate, lda, one, __FFLAS__Bupdate, ldb);
-#else
-		fgemm (F, Mjoin (Fflas, __FFLAS__TRANS),  FflasNoTrans,
-		       __FFLAS__Mupdate, __FFLAS__Nupdate, nsplit, Mone,
-		       __FFLAS__Aupdate, lda, __FFLAS__Brec, ldb, one, __FFLAS__Bupdate, ldb);
-#endif
-	}
-	if (nrestsplit)
-		this->delayed (F, __FFLAS__Mbrest, __FFLAS__Nbrest,
-			       __FFLAS__Arest, lda, __FFLAS__Brest, ldb, nblas, nrestsplit / nblas);
-}
-
-
-}; //class ftrsm....
-
-#else // __FFLAS__GENERIC
-
-template <class Element>
-class FFLAS::Mjoin(ftrsm, Mjoin(__FFLAS__SIDE, Mjoin(__FFLAS__UPLO, Mjoin(__FFLAS__TRANS, __FFLAS__DIAG)))) {
-public:
-
-template<class Field>
-void operator()	(const Field& F, const size_t M, const size_t N,
-		 typename Field::Element * A, const size_t lda,
-		 typename Field::Element * B, const size_t ldb) {
-	
-	static typename Field::Element Mone;
-	static typename Field::Element one;
-	F.init(one, 1.0);
-	F.neg(Mone,one);
-	if (__FFLAS__Na == 1){
-		
-#ifndef __FFLAS__UNIT					
-		typename Field::Element inv;
-		F.inv(inv, *A);
-		FFLAS::fscal(F, __FFLAS__Bdim, inv, B, __FFLAS__Bnorminc);
-#endif //__FFLAS__UNIT
-	} else { // __FFLAS__Na > 1
-		size_t nsplit = __FFLAS__Na >> 1;
-		this->operator() (F, __FFLAS__Mb, __FFLAS__Nb, __FFLAS__A1, lda, __FFLAS__B1, ldb);
-
-#ifdef __FFLAS__RIGHT
-		fgemm (F, FflasNoTrans , Mjoin (Fflas, __FFLAS__TRANS),
-		       __FFLAS__Mb2, __FFLAS__Nb2, nsplit, Mone,
-		       __FFLAS__B1, ldb, __FFLAS__A2, lda, one, __FFLAS__B2, ldb);
-#else
-		fgemm (F, Mjoin (Fflas, __FFLAS__TRANS), FflasNoTrans,
-		       __FFLAS__Mb2, __FFLAS__Nb2, nsplit, Mone,
-		       __FFLAS__A2, lda, __FFLAS__B1, ldb, one, __FFLAS__B2, ldb);
-#endif
-		this->operator() (F, __FFLAS__Mb2, __FFLAS__Nb2, __FFLAS__A3, lda, __FFLAS__B2, ldb);
-	}
-}
-};
-
-#endif // __FFLAS__GENERIC
-
-
-#undef __FFLAS__UPLO
-#undef __FFLAS__DIAG
-#undef __FFLAS__SIDE
-#undef __FFLAS__TRANS
-#undef __FFLAS__Na
-#undef __FFLAS__Mb
-#undef __FFLAS__Nb
-#undef __FFLAS__Mbrest
-#undef __FFLAS__Nbrest 
-#undef __FFLAS__Mupdate 
-#undef __FFLAS__Nupdate
-#undef __FFLAS__Atriang 
-#undef __FFLAS__Aupdate
-#undef __FFLAS__Arest 
-#undef __FFLAS__Bupdate 
-#undef __FFLAS__Brec 
-#undef __FFLAS__Brest
-#undef __FFLAS__Bnorminc
-#undef __FFLAS__Bnormnext
-#undef __FFLAS__Anormnext
-#undef __FFLAS__Anorminc
-#undef __FFLAS__ELEMENT
-#undef __FFLAS__BLAS_PREFIX
-#undef __FFLAS__DOMAIN
-#undef __FFLAS__A1
-#undef __FFLAS__A2
-#undef __FFLAS__A3
-#undef __FFLAS__B1
-#undef __FFLAS__B2
-#undef __FFLAS__Nb2
-#undef __FFLAS__Mb2
-#undef __FFLAS__Bdim
-#undef __FFLAS__Normdim
-#undef __FFLAS__Acolinc
-#undef __FFLAS__Arowinc
-#undef Mjoin
-#undef my_join
diff --git a/linbox/fflas/fflas_ftrsv.inl b/linbox/fflas/fflas_ftrsv.inl
deleted file mode 100644
index 4b1a5ec..0000000
--- a/linbox/fflas/fflas_ftrsv.inl
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* fflas/fflas_ftrsv.inl
- * Copyright (C) 2005 Clement Pernet
- *
- * Written by Clement Pernet <Clement.Pernet at imag.fr>
- *
- * See COPYING for license information.
- */
-
-//---------------------------------------------------------------------
-// ftrsv: TRiangular System solve with vector
-// Computes  X <- op(A^-1).X
-// size of X is m
-//---------------------------------------------------------------------
-template<class Field>
-inline void
-FFLAS::ftrsv (const Field& F, const FFLAS_UPLO Uplo, 
-	      const FFLAS_TRANSPOSE TransA, const FFLAS_DIAG Diag,
-	      const size_t N,const typename Field::Element * A, size_t lda,
-	      typename Field::Element * X, int incX){
-	
-	typename Field::Element * Xi,* Xj, * Ximax;
-	const typename Field::Element * Ai, * Aj;
-	if ( Uplo == FflasLower ){
-		if ( TransA == FflasTrans){
-			Ai = A+(N-1)*(lda+1); // bottom right entry of A
-			Ximax = Xi = X+(N-1)*incX;
-			for( ; Xi>=X; Ai-=lda+1,Xi-=incX ){
-				F.negin( *Xi );
-				for ( Xj = Xi+incX, Aj=Ai+lda; Xj<=Ximax; 
-				      Xj+=incX, Aj+=lda){
-					F.axpyin( *Xi, *Xj, *Aj );
-				}				
-				if ( Diag==FflasNonUnit ){
-					F.divin(*Xi,*Ai);
-				}
-				F.negin( *Xi );
-			}
-		} // FflasTrans
-		else{
-			Ai = A;
-		        Xi = X;
-			for( ; Xi<X+incX*N; Ai+=lda+1,Xi+=incX ){
-				F.negin( *Xi );
-				for ( Xj = Xi-incX, Aj=Ai-1; Xj>=X; 
-				      Xj-=incX, Aj--){
-					F.axpyin( *Xi, *Xj, *Aj );
-				}
-				if ( Diag==FflasNonUnit )
-					F.divin(*Xi,*Ai);
-				F.negin( *Xi );
-			}
-		}
-	} // FflasLower
-	else{
-		if ( TransA == FflasTrans){
-			Ai = A; 
-			Xi = X;
-			for( ; Xi<X+N*incX; Ai+=lda+1,Xi+=incX ){
-				F.negin( *Xi );
-				for ( Xj = Xi-incX, Aj=Ai-lda; Xj>=X;
-				      Xj-=incX, Aj-=lda){
-					F.axpyin( *Xi, *Xj, *Aj );
-				}
-				
-				if ( Diag==FflasNonUnit )
-					F.divin(*Xi,*Ai);
-				F.negin( *Xi );
-			}
-
-		} // FflasTrans
-		else{
-			Ai = A+(lda+1)*(N-1); 
-			Ximax = Xi = X+incX*(N-1);
-			for( ; Xi>=X; Ai-=lda+1,Xi-=incX ){
-				F.negin( *Xi );
-				for ( Xj = Xi+incX, Aj=Ai+1; Xj<=Ximax;
-				      Xj+=incX, Aj++){
-					F.axpyin( *Xi, *Xj, *Aj );
-				}
-				if ( Diag==FflasNonUnit )
-					F.divin(*Xi,*Ai);
-				F.negin( *Xi );
-			}
-		}
-	}
-}
diff --git a/linbox/ffpack/Makefile.am b/linbox/ffpack/Makefile.am
deleted file mode 100644
index e0b7618..0000000
--- a/linbox/ffpack/Makefile.am
+++ /dev/null
@@ -1,16 +0,0 @@
-pkgincludesubdir=$(pkgincludedir)/ffpack
-
-pkgincludesub_HEADERS = \
-	ffpack.h			\
-	ffpack_charpoly.inl		\
-	ffpack_charpoly_kglu.inl	\
-	ffpack_charpoly_kgfast.inl    \
-	ffpack_charpoly_kgfastgeneralized.inl    \
-	ffpack_ludivine.inl		\
-	ffpack_minpoly.inl		\
-	ffpack_minpoly_construct.inl	\
-	ffpack_charpoly_danilevski.inl 	\
-	ffpack_krylovelim.inl		\
-	ffpack_frobenius.inl
-
-EXTRA_DIST = ffpack.doxy
diff --git a/linbox/ffpack/Makefile.in b/linbox/ffpack/Makefile.in
deleted file mode 100644
index 5ab8eea..0000000
--- a/linbox/ffpack/Makefile.in
+++ /dev/null
@@ -1,444 +0,0 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  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.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
- at SET_MAKE@
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-subdir = linbox/ffpack
-DIST_COMMON = $(pkgincludesub_HEADERS) $(srcdir)/Makefile.am \
-	$(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
-	$(top_srcdir)/macros/blas-check.m4 \
-	$(top_srcdir)/macros/config-header.m4 \
-	$(top_srcdir)/macros/expat-check.m4 \
-	$(top_srcdir)/macros/givaro-check.m4 \
-	$(top_srcdir)/macros/gmp-check.m4 \
-	$(top_srcdir)/macros/lidia-check.m4 \
-	$(top_srcdir)/macros/linbox-doc.m4 \
-	$(top_srcdir)/macros/linbox-misc.m4 \
-	$(top_srcdir)/macros/linbox-opt.m4 \
-	$(top_srcdir)/macros/maple-check.m4 \
-	$(top_srcdir)/macros/ntl-check.m4 \
-	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-	$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-depcomp =
-am__depfiles_maybe =
-SOURCES =
-DIST_SOURCES =
-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__installdirs = "$(DESTDIR)$(pkgincludesubdir)"
-pkgincludesubHEADERS_INSTALL = $(INSTALL_HEADER)
-HEADERS = $(pkgincludesub_HEADERS)
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
-CC = @CC@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXFLAGS = @CXXFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-EXPAT_CFLAGS = @EXPAT_CFLAGS@
-EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
-GIVARO_CFLAGS = @GIVARO_CFLAGS@
-GIVARO_LIBS = @GIVARO_LIBS@
-GMP_CFLAGS = @GMP_CFLAGS@
-GMP_LIBS = @GMP_LIBS@
-GMP_VERSION = @GMP_VERSION@
-GREP = @GREP@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIDIA_CFLAGS = @LIDIA_CFLAGS@
-LIDIA_LIBS = @LIDIA_LIBS@
-LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MAPLE_CFLAGS = @MAPLE_CFLAGS@
-MAPLE_HOME = @MAPLE_HOME@
-MAPLE_LIBS = @MAPLE_LIBS@
-MAPLE_VERSION = @MAPLE_VERSION@
-MKDIR_P = @MKDIR_P@
-NMEDIT = @NMEDIT@
-NTL_CFLAGS = @NTL_CFLAGS@
-NTL_LIBS = @NTL_LIBS@
-OBJEXT = @OBJEXT@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-RANLIB = @RANLIB@
-SACLIB_CFLAGS = @SACLIB_CFLAGS@
-SACLIB_LIBS = @SACLIB_LIBS@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-VERSION = @VERSION@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
-am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-pkgincludesubdir = $(pkgincludedir)/ffpack
-pkgincludesub_HEADERS = \
-	ffpack.h			\
-	ffpack_charpoly.inl		\
-	ffpack_charpoly_kglu.inl	\
-	ffpack_charpoly_kgfast.inl    \
-	ffpack_charpoly_kgfastgeneralized.inl    \
-	ffpack_ludivine.inl		\
-	ffpack_minpoly.inl		\
-	ffpack_minpoly_construct.inl	\
-	ffpack_charpoly_danilevski.inl 	\
-	ffpack_krylovelim.inl		\
-	ffpack_frobenius.inl
-
-EXTRA_DIST = ffpack.doxy
-all: all-am
-
-.SUFFIXES:
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
-	@for dep in $?; do \
-	  case '$(am__configure_deps)' in \
-	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
-	      exit 1;; \
-	  esac; \
-	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps linbox/ffpack/Makefile'; \
-	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  --ignore-deps linbox/ffpack/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-	@case '$?' in \
-	  *config.status*) \
-	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-	  *) \
-	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
-	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
-	esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(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
-
-mostlyclean-libtool:
-	-rm -f *.lo
-
-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 \
-	  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"; \
-	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
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-	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; nonemtpy = 1; } \
-	      END { if (nonempty) { for (i in files) print i; }; }'`; \
-	mkid -fID $$unique
-tags: TAGS
-
-TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
-		$(TAGS_FILES) $(LISP)
-	tags=; \
-	here=`pwd`; \
-	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; }; }'`; \
-	if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
-	  test -n "$$unique" || unique=$$empty_fix; \
-	  $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-	    $$tags $$unique; \
-	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" \
-	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-	     $$tags $$unique
-
-GTAGS:
-	here=`$(am__cd) $(top_builddir) && pwd` \
-	  && cd $(top_srcdir) \
-	  && gtags -i $(GTAGS_ARGS) $$here
-
-distclean-tags:
-	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
-	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
-	list='$(DISTFILES)'; \
-	  dist_files=`for file in $$list; do echo $$file; done | \
-	  sed -e "s|^$$srcdirstrip/||;t" \
-	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
-	case $$dist_files in \
-	  */*) $(MKDIR_P) `echo "$$dist_files" | \
-			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
-			   sort -u` ;; \
-	esac; \
-	for file in $$dist_files; do \
-	  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 $(srcdir)/$$file && test $$d != $(srcdir); then \
-	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
-	    fi; \
-	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
-	  else \
-	    test -f $(distdir)/$$file \
-	    || cp -p $$d/$$file $(distdir)/$$file \
-	    || exit 1; \
-	  fi; \
-	done
-check-am: all-am
-check: check-am
-all-am: Makefile $(HEADERS)
-installdirs:
-	for dir in "$(DESTDIR)$(pkgincludesubdir)"; do \
-	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
-	done
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-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
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
-	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
-	@echo "This command is intended for maintainers to use"
-	@echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool mostlyclean-am
-
-distclean: distclean-am
-	-rm -f Makefile
-distclean-am: clean-am distclean-generic distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-info: info-am
-
-info-am:
-
-install-data-am: install-pkgincludesubHEADERS
-
-install-dvi: install-dvi-am
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-info: install-info-am
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-ps: install-ps-am
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-	-rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-generic mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-pkgincludesubHEADERS
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
-	clean-libtool ctags distclean distclean-generic \
-	distclean-libtool distclean-tags distdir dvi dvi-am html \
-	html-am info info-am install install-am install-data \
-	install-data-am install-dvi install-dvi-am install-exec \
-	install-exec-am install-html install-html-am install-info \
-	install-info-am install-man install-pdf install-pdf-am \
-	install-pkgincludesubHEADERS install-ps install-ps-am \
-	install-strip installcheck installcheck-am installdirs \
-	maintainer-clean maintainer-clean-generic mostlyclean \
-	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
-	tags uninstall uninstall-am uninstall-pkgincludesubHEADERS
-
-# 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/linbox/ffpack/ffpack.doxy b/linbox/ffpack/ffpack.doxy
deleted file mode 100644
index eac406b..0000000
--- a/linbox/ffpack/ffpack.doxy
+++ /dev/null
@@ -1,5 +0,0 @@
-/** \defgroup ffpack linbox/ffpack
-
-\brief Class FFPACK provides functions using fflas much as Lapack uses BLAS.
-
-*/
diff --git a/linbox/ffpack/ffpack.h b/linbox/ffpack/ffpack.h
deleted file mode 100644
index 4af6084..0000000
--- a/linbox/ffpack/ffpack.h
+++ /dev/null
@@ -1,1605 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* ffpack.h
- * Copyright (C) 2005 Clement Pernet
- *
- * Written by Clement Pernet <Clement.Pernet at imag.fr>
- *
- * See COPYING for license information.
- */
-
-#ifndef __FFPACK_H
-#define __FFPACK_H
-
-#ifdef _LINBOX_LINBOX_CONFIG_H
-#include "linbox/fflas/fflas.h"
-#else
-#include "fflas.h"
-#endif
-
-#include <list>
-#include <vector>
-
-#ifdef _LINBOX_LINBOX_CONFIG_H
-namespace LinBox{
-#endif
-
-// The use of the small size LQUP is currently disabled:
-// need for a better handling of element base (double, float, generic) combined
-// with different thresholds.
-// TransPosed version has to be implemented too.
-#define __FFPACK_LUDIVINE_CUTOFF 0
-	
-#define __FFPACK_CHARPOLY_THRESHOLD 30
-
-	/**
-	 * \brief Set of elimination based routines for dense linear algebra
-	 * with matrices over finite prime field of characteristic less than 2^26.
-	 *
-	 *  This class only provides a set of static member functions.
-	 *  No instantiation is allowed.
-	 *
-	 * It enlarges the set of BLAS routines of the class FFLAS, with higher 
-	 * level routines based on elimination.
-	 \ingroup ffpack
-	 */
-
-class FFPACK : public FFLAS {
-	
-	
-public:
-	enum FFPACK_LUDIVINE_TAG { FfpackLQUP=1,
-				   FfpackSingular=2};
-	
-	enum FFPACK_CHARPOLY_TAG { FfpackLUK=1,
-				   FfpackKG=2,
-				   FfpackHybrid=3,
-				   FfpackKGFast=4,
-				   FfpackDanilevski=5,
-				   FfpackArithProg=6,
-				   FfpackKGFastG=7};
-	
-	class CharpolyFailed{};
-	
-	enum FFPACK_MINPOLY_TAG { FfpackDense=1,
-				  FfpackKGF=2};
-
-	/** 
-	 * Computes the rank of the given matrix using a LQUP factorization.
-	 * The input matrix is modified.
-	 * @param M row dimension of the matrix
-	 * @param N column dimension of the matrix
-	 * @param A input matrix
-	 * @param lda leading dimension of A
-	 */
-	/// using LQUP factorization.
-	template <class Field>
-	static size_t 
-	Rank( const Field& F, const size_t M, const size_t N,
-	      typename Field::Element * A, const size_t lda)
-	{
-		size_t *P = new size_t[N];
-		size_t *Q = new size_t[M];
-		size_t R = LUdivine (F, FflasNonUnit, FflasNoTrans, M, N,
-				     A, lda, P, Q, FfpackLQUP);
-		delete[] Q;
-		delete[] P;
-		return R;
- 	}
-
-	/**
-	 * Returns true if the given matrix is singular.
-	 * The method is a block elimination with early termination
-	 * The input matrix is modified. 
-	 * @param M row dimension of the matrix
-	 * @param N column dimension of the matrix
-	 * @param A input matrix
-	 * @param lda leading dimension of A
-	 */
-	/// using LQUP factorization  with early termination. 
-	template <class Field>
-	static bool 
-	IsSingular( const Field& F, const size_t M, const size_t N,
-		    typename Field::Element * A, const size_t lda)
-	{
-		size_t *P = new size_t[N];
-		size_t *Q = new size_t[M];
-		bool singular  = !LUdivine (F, FflasNonUnit, FflasNoTrans, M, N,
-					    A, lda, P, Q, FfpackSingular);
-		
-		delete[] P;
-		delete[] Q;
-		return singular;
- 	}
-	
-	/**
-	 * Returns the determinant of the given matrix.
-	 * The method is a block elimination with early termination
-	 * The input matrix is modified. 
-	 * @param M row dimension of the matrix
-	 * @param N column dimension of the matrix
-	 * @param A input matrix
-	 * @param lda leading dimension of A
-	 */
-	///  using LQUP factorization  with early termination. 
-	template <class Field>
-	static typename Field::Element
-	Det( const Field& F, const size_t M, const size_t N,
-	     typename Field::Element * A, const size_t lda){
-		
-		typename Field::Element det;
-		bool singular;
-		size_t *P = new size_t[N];
-		size_t *Q = new size_t[M];
-		singular  = !LUdivine (F, FflasNonUnit, FflasNoTrans,  M, N,
-				       A, lda, P, Q, FfpackSingular);
-		if (singular){
-			F.init(det,0.0);
-			delete[] P;
-			delete[] Q; 
-			return det;
-		}
-		else{
-			F.init(det,1.0);
-			typename Field::Element *Ai=A;
-			for (; Ai < A+ M*lda+N; Ai+=lda+1 )
-				F.mulin( det, *Ai );
-			int count=0;
-			for (size_t i=0;i<N;++i)
-				if (P[i] != i) ++count;
-				
-			if ((count&1) == 1)
-				F.negin(det);
-		}
-		delete[] P; 
-		delete[] Q; 
-		return det;
- 	}
-
-	/**
-	 * Solve the system A X = B or X A = B, using the LQUP decomposition of A
-	 * already computed inplace with LUdivine(FflasNoTrans, FflasNonUnit).
-	 * Version for A square.
-	 * If A is rank deficient, a solution is returned if the system is consistent,
-	 * Otherwise an info is 1
-	 * 
-	 * @param Side Determine wheter the resolution is left or right looking.
-	 * @param M row dimension of B
-	 * @param N col dimension of B
-	 * @param R rank of A
-	 * @param A input matrix
-	 * @param lda leading dimension of A
-	 * @param P column permutation of the LQUP decomposition of A
- 	 * @param Q column permutation of the LQUP decomposition of A
-	 * @param B Right/Left hand side matrix. Initially stores B, finally stores the solution X.
-	 * @param ldb leading dimension of B
-	 * @info Succes of the computation: 0 if successfull, >0 if system is inconsistent
-	 */
-	template <class Field>
-	static void
-	fgetrs (const Field& F,
-		const FFLAS_SIDE Side,
-		const size_t M, const size_t N, const size_t R,
-		typename Field::Element *A, const size_t lda,
-		const size_t *P, const size_t *Q,
-		typename Field::Element *B, const size_t ldb,
-		int * info){
-
-		static typename Field::Element zero, one, mone;
-		F.init (zero, 0.0);
-		F.init (one, 1.0);
-		F.neg(mone, one);
-		*info =0;
-		if (Side == FflasLeft) { // Left looking solve A X = B
-			
-			solveLB2 (F, FflasLeft, M, N, R, A, lda, Q, B, ldb);
-
-			applyP (F, FflasLeft, FflasNoTrans, N, 0, R, B, ldb, Q);
-
-			bool consistent = true;
-			for (size_t i = R; i < M; ++i)
-				for (size_t j = 0; j < N; ++j)
-					if (!F.isZero (*(B + i*ldb + j)))
-						consistent = false;
-			if (!consistent) {
-				std::cerr<<"System is inconsistent"<<std::endl;
-				*info = 1;
-			}
-			// The last rows of B are now supposed to be 0
-			//			for (size_t i = R; i < M; ++i)
-			// 				for (size_t j = 0; j < N; ++j)
-			// 					*(B + i*ldb + j) = zero;
-
-			ftrsm (F, FflasLeft, FflasUpper, FflasNoTrans, FflasNonUnit, 
-			       R, N, one, A, lda , B, ldb);
-			
-			applyP (F, FflasLeft, FflasTrans, N, 0, R, B, ldb, P);
-			
-		} else { // Right Looking X A = B
-
-			applyP (F, FflasRight, FflasTrans, M, 0, R, B, ldb, P);
-			
-			ftrsm (F, FflasRight, FflasUpper, FflasNoTrans, FflasNonUnit, 
-			       M, R, one, A, lda , B, ldb);
-
-			fgemm (F, FflasNoTrans, FflasNoTrans, M, N-R, R, one,
-			       B, ldb, A+R, lda, mone, B+R, ldb);
-
-			bool consistent = true;
-			for (size_t i = 0; i < M; ++i)
-				for (size_t j = R; j < N; ++j)
-					if (!F.isZero (*(B + i*ldb + j)))
-						consistent = false;
-			if (!consistent) {
-				std::cerr<<"System is inconsistent"<<std::endl;
-				*info = 1;
-			}
-			// The last cols of B are now supposed to be 0
-
-			applyP (F, FflasRight, FflasNoTrans, M, 0, R, B, ldb, Q);
-
-			solveLB2 (F, FflasRight, M, N, R, A, lda, Q, B, ldb);
-		}
-	}
-	
-	/**
-	 * Solve the system A X = B or X A = B, using the LQUP decomposition of A
-	 * already computed inplace with LUdivine(FflasNoTrans, FflasNonUnit).
-	 * Version for A rectangular.
-	 * If A is rank deficient, a solution is returned if the system is consistent,
-	 * Otherwise an info is 1
-	 * 
-	 * @param Side Determine wheter the resolution is left or right looking.
-	 * @param M row dimension of A
-	 * @param N col dimension of A
-	 * @param NRHS number of columns (if Side = FflasLeft) or row (if Side = FflasRight) of the matrices X and B
-	 * @param R rank of A
-	 * @param A input matrix
-	 * @param lda leading dimension of A
-	 * @param P column permutation of the LQUP decomposition of A
- 	 * @param Q column permutation of the LQUP decomposition of A
-	 * @param X solution matrix
-	 * @param ldx leading dimension of X
-	 * @param B Right/Left hand side matrix. 
-	 * @param ldb leading dimension of B
-	 * @param info Succes of the computation: 0 if successfull, >0 if system is inconsistent
-	 */
-	template <class Field>
-	static typename Field::Element *
-	fgetrs (const Field& F,
-		const FFLAS_SIDE Side,
-		const size_t M, const size_t N, const size_t NRHS, const size_t R,
-		typename Field::Element *A, const size_t lda,
-		const size_t *P, const size_t *Q,
-		typename Field::Element *X, const size_t ldx,
-		const typename Field::Element *B, const size_t ldb,
-		int * info) {
-
-		static typename Field::Element zero, one, mone;
-		F.init (zero, 0.0);
-		F.init (one, 1.0);
-		F.neg(mone, one);
-		*info =0;
-		
-		typename Field::Element* W;
-		size_t ldw;
-
-		if (Side == FflasLeft) { // Left looking solve A X = B
-
-			// Initializing X to 0 (to be optimized)
-			for (size_t i = 0; i <N; ++i)
-				for (size_t j=0; j< NRHS; ++j)
-					F.assign (*(X+i*ldx+j), zero);
-
-			if (M > N){ // Cannot copy B into X
-				W = new typename Field::Element [M*NRHS];
-				ldw = NRHS;
-				for (size_t i=0; i < M; ++i)
-					fcopy (F, NRHS, W + i*ldw, 1, B + i*ldb, 1);
-			       
-				solveLB2 (F, FflasLeft, M, NRHS, R, A, lda, Q, W, ldw);
-				
-				applyP (F, FflasLeft, FflasNoTrans, NRHS, 0, R, W, ldw, Q);
-
-				bool consistent = true;
-				for (size_t i = R; i < M; ++i)
-					for (size_t j = 0; j < NRHS; ++j)
-						if (!F.isZero (*(W + i*ldw + j)))
-							consistent = false;
-				if (!consistent) {
-					std::cerr<<"System is inconsistent"<<std::endl;
-					*info = 1;
-					delete[] W;
-					return X;
-				}
-				// Here the last rows of W are supposed to be 0
-				
-				ftrsm (F, FflasLeft, FflasUpper, FflasNoTrans, FflasNonUnit, 
-				       R, NRHS, one, A, lda , W, ldw);
-			
-				for (size_t i=0; i < R; ++i)
-					fcopy (F, NRHS, X + i*ldx, 1, W + i*ldw, 1);
-
-				delete[] W;
-				applyP (F, FflasLeft, FflasTrans, NRHS, 0, R, X, ldx, P);
-				
-			} else { // Copy B to X directly
-				for (size_t i=0; i < M; ++i)
-					fcopy (F, NRHS, X + i*ldx, 1, B + i*ldb, 1);
-				
-				solveLB2 (F, FflasLeft, M, NRHS, R, A, lda, Q, X, ldx);
-				
-				applyP (F, FflasLeft, FflasNoTrans, NRHS, 0, R, X, ldx, Q);
-
-				bool consistent = true;
-				for (size_t i = R; i < M; ++i)
-					for (size_t j = 0; j < NRHS; ++j)
-						if (!F.isZero (*(X + i*ldx + j)))
-							consistent = false;
-				if (!consistent) {
-					std::cerr<<"System is inconsistent"<<std::endl;
-					*info = 1;
-					return X;
-				}
-				// Here the last rows of W are supposed to be 0
-								
-				ftrsm (F, FflasLeft, FflasUpper, FflasNoTrans, FflasNonUnit, 
-				       R, NRHS, one, A, lda , X, ldx);
-			
-				applyP (F, FflasLeft, FflasTrans, NRHS, 0, R, X, ldx, P);
-			}
-			return X;
-			
-		} else { // Right Looking X A = B
-
-			for (size_t i = 0; i <NRHS; ++i)
-				for (size_t j=0; j< M; ++j)
-					F.assign (*(X+i*ldx+j), zero);
-
-			if (M < N) {
-				W = new typename Field::Element [NRHS*N];
-				ldw = N;
-				for (size_t i=0; i < NRHS; ++i)
-					fcopy (F, N, W + i*ldw, 1, B + i*ldb, 1);
-
-				applyP (F, FflasRight, FflasTrans, NRHS, 0, R, W, ldw, P);
-			
-				ftrsm (F, FflasRight, FflasUpper, FflasNoTrans, FflasNonUnit, 
-				       NRHS, R, one, A, lda , W, ldw);
-				
-				fgemm (F, FflasNoTrans, FflasNoTrans, NRHS, N-R, R, one,
-				       W, ldw, A+R, lda, mone, W+R, ldw);
-
-				bool consistent = true;
-				for (size_t i = 0; i < NRHS; ++i)
-					for (size_t j = R; j < N; ++j)
-						if (!F.isZero (*(W + i*ldw + j)))
-							consistent = false;
-				if (!consistent) {
-					std::cerr<<"System is inconsistent"<<std::endl;
-					*info = 1;
-					delete[] W;
-					return X;
-				}
-				// The last N-R cols of W are now supposed to be 0
-				for (size_t i=0; i < NRHS; ++i)
-					fcopy (F, R, X + i*ldx, 1, W + i*ldb, 1);
-				delete[] W;
-				applyP (F, FflasRight, FflasNoTrans, NRHS, 0, R, X, ldx, Q);
-
-				solveLB2 (F, FflasRight, NRHS, M, R, A, lda, Q, X, ldx);
-				
-			} else {
-				for (size_t i=0; i < NRHS; ++i)
-					fcopy (F, N, X + i*ldx, 1, B + i*ldb, 1);
-				
-				applyP (F, FflasRight, FflasTrans, NRHS, 0, R, X, ldx, P);
-			
-				ftrsm (F, FflasRight, FflasUpper, FflasNoTrans, FflasNonUnit, 
-				       NRHS, R, one, A, lda , X, ldx);
-				
-				fgemm (F, FflasNoTrans, FflasNoTrans, NRHS, N-R, R, one,
-				       X, ldx, A+R, lda, mone, X+R, ldx);
-
-				bool consistent = true;
-				for (size_t i = 0; i < NRHS; ++i)
-					for (size_t j = R; j < N; ++j)
-						if (!F.isZero (*(X + i*ldx + j)))
-							consistent = false;
-				if (!consistent) {
-					std::cerr<<"System is inconsistent"<<std::endl;
-					*info = 1;
-					return X;
-				}
-				// The last N-R cols of W are now supposed to be 0
-
-				applyP (F, FflasRight, FflasNoTrans, NRHS, 0, R, X, ldx, Q);
-				
-				solveLB2 (F, FflasRight, NRHS, M, R, A, lda, Q, X, ldx);
-				
-			}
-			return X;
-		}
-	}
-	/**
-	 * @brief Square system solver
-	 * @param Field The computation domain
-	 * @param Side Determine wheter the resolution is left or right looking
-	 * @param M row dimension of B
-	 * @param N col dimension of B
-	 * @param A input matrix
-	 * @param lda leading dimension of A
-	 * @param P column permutation of the LQUP decomposition of A
- 	 * @param Q column permutation of the LQUP decomposition of A
-	 * @param B Right/Left hand side matrix. Initially contains B, finally contains the solution X.
-	 * @param ldb leading dimension of B
-	 * @param info Success of the computation: 0 if successfull, >0 if system is inconsistent
- 	 * @return the rank of the system
- 	 * 
-	 * Solve the system A X = B or X A = B.
-	 * Version for A square.
-	 * If A is rank deficient, a solution is returned if the system is consistent,
-	 * Otherwise an info is 1
-	 */
-	template <class Field>
-	static size_t 
-	fgesv (const Field& F,
-	       const FFLAS_SIDE Side,
-	       const size_t M, const size_t N,
-	       typename Field::Element *A, const size_t lda,
-	       typename Field::Element *B, const size_t ldb,
-	       int * info){
-
-		size_t Na;
-		if (Side == FflasLeft)
-			Na = M;
-		else
-			Na = N;
-		
-		size_t* P = new size_t[Na];
-		size_t* Q = new size_t[Na];
-
-		size_t R = LUdivine (F, FflasNonUnit, FflasNoTrans, Na, Na, A, lda, P, Q, FfpackLQUP);
-
-		fgetrs (F, Side, M, N, R, A, lda, P, Q, B, ldb, info);
-		
-		delete[] P;
-		delete[] Q;
-
-		return R;
-	}
-	
-	/**
-	 * @brief Rectangular system solver
-	 * @param Field The computation domain
-	 * @param Side Determine wheter the resolution is left or right looking
-	 * @param M row dimension of A
-	 * @param N col dimension of A
-	 * @param NRHS number of columns (if Side = FflasLeft) or row (if Side = FflasRight) of the matrices X and B
-	 * @param A input matrix
-	 * @param lda leading dimension of A
-	 * @param P column permutation of the LQUP decomposition of A
- 	 * @param Q column permutation of the LQUP decomposition of A
-	 * @param B Right/Left hand side matrix. Initially contains B, finally contains the solution X.
-	 * @param ldb leading dimension of B
-	 * @info Success of the computation: 0 if successfull, >0 if system is inconsistent
- 	 * @return the rank of the system
- 	 * 
-	 * Solve the system A X = B or X A = B.
-	 * Version for A square.
-	 * If A is rank deficient, a solution is returned if the system is consistent,
-	 * Otherwise an info is 1
-	 */
-	template <class Field>
-	static size_t 
-	fgesv (const Field& F,
-	       const FFLAS_SIDE Side,
-	       const size_t M, const size_t N, const size_t NRHS,
-	       typename Field::Element *A, const size_t lda,
-	       typename Field::Element *X, const size_t ldx,
-	       const typename Field::Element *B, const size_t ldb,
-	       int * info){
-
-		size_t Nb,Mb;
-		if (Side == FflasLeft){Nb = NRHS; Mb = N;}
-		else {Nb = M; Mb = NRHS;}
-		
-		size_t* P = new size_t[N];
-		size_t* Q = new size_t[M];
-
-		size_t R = LUdivine (F, FflasNonUnit, FflasNoTrans, M, N, A, lda, P, Q, FfpackLQUP);
-
-		fgetrs (F, Side, M, N, NRHS, R, A, lda, P, Q, X, ldx, B, ldb, info);
-		
-		delete[] P;
-		delete[] Q;
-
-		return R;
-	}
-	
-	/**
-	 * Solve the system Ax=b, using LQUP factorization and
-	 * two triangular system resolutions.
-	 * The input matrix is modified. 
-	 * @param M row dimension of the matrix
-	 * @param A input matrix
-	 * @param lda leading dimension of A
-	 * @param x solution vector
-	 * @param incX increment of x
-	 * @param b right hand side vector
-	 * @param incB increment of b
-	 */
-	/// Solve linear system using LQUP factorization. 
-	template <class Field>
-	static typename Field::Element*
-	Solve( const Field& F, const size_t M,
-	       typename Field::Element * A, const size_t lda,
-	       typename Field::Element * x, const int incx,
-	       const typename Field::Element * b, const int incb ){
-		typename Field::Element one, zero;
-		F.init(one,1.0);
-		F.init(zero,0.0);
-
-		size_t *P = new size_t[M];
-		size_t *rowP = new size_t[M];
-		
-		if (LUdivine( F, FflasNonUnit, FflasNoTrans, M, M, A, lda, P, rowP, FfpackLQUP) < M){
-			std::cerr<<"SINGULAR MATRIX"<<std::endl;
-			delete[] P; 
-			delete[] rowP; 
-			return x;
-		}
-		else{
-			fcopy( F, M, x, incx, b, incb );
-			
-			ftrsv(F,  FflasLower, FflasNoTrans, FflasUnit, M, 
-			      A, lda , x, incx);
-			ftrsv(F,  FflasUpper, FflasNoTrans, FflasNonUnit, M, 
-			      A, lda , x, incx);
-			applyP( F, FflasRight, FflasTrans, M, 0, M, x, incx, P );
-			delete[] rowP; 
-			delete[] P; 
-
-			return x;
-		
-		}
- 	}
-	
-	/**
-	 * Invert the given matrix in place
-	 * or computes its nullity if it is singular.
-	 * An inplace 2n^3 algorithm is used.
-	 * @param M order of the matrix
-	 * @param A input matrix
-	 * @param lda leading dimension of A
-	 * @param nullity dimension of the kernel of A
-	 */
-	/// Invert a matrix or return its nullity
-	template <class Field>
-	static typename Field::Element*
-	Invert (const Field& F, const size_t M,
-		typename Field::Element * A, const size_t lda,
-		int& nullity){
-
-		size_t * P = new size_t[M];
-		size_t * Q = new size_t[M];
-		size_t R =  ReducedColumnEchelonForm (F, M, M, A, lda, P, Q);
-		nullity = M - R;
-		applyP (F, FflasLeft, FflasTrans, M, 0, R, A, lda, P); 
-		delete [] P;
-		delete [] Q;
-		return A;
-	}
-
-	template <class Field>
-	static typename Field::Element*
-	Invert (const Field& F, const size_t M,
-		typename Field::Element * A, const size_t lda,
-		typename Field::Element * X, const size_t ldx,
-		int& nullity){
-		
-		Invert (F,  M, A, lda, nullity);
-		for (size_t i=0; i<M; ++i)
-			fcopy (F, M, X+i*ldx, 1, A+i*lda,1);
-		return X;
-		
-	}
-	/**
-	 * Invert the given matrix or computes its nullity if it is singular.
-	 * An 2n^3 algorithm is used.
-	 * The input matrix is modified. 
-	 * @param M order of the matrix
-	 * @param A input matrix
-	 * @param lda leading dimension of A
-	 * @param X inverse of A
-	 * @param ldx leading dimension of X
-	 * @param nullity dimension of the kernel of A
-	 */
-	/// Invert a matrix or return its nullity
-	template <class Field>
-	static typename Field::Element*
-	Invert2( const Field& F, const size_t M,
-		 typename Field::Element * A, const size_t lda,
-		 typename Field::Element * X, const size_t ldx,
-		 int& nullity){
-		
-		typename Field::Element one, zero;
-		F.init(one,1.0);
-		F.init(zero,0.0);
-
-		size_t *P = new size_t[M];
-		size_t *rowP = new size_t[M];
-		
-		// Timer t1;
-// 		t1.clear();
-// 		t1.start();
-
-		nullity = M - LUdivine( F, FflasNonUnit, FflasNoTrans, M, M, A, lda, P, rowP, FfpackLQUP);
-
-// 		t1.stop();
-		//cerr<<"LU --> "<<t1.usertime()<<endl;
-		
-		if (nullity > 0){
-			delete[] P;
-			delete[] rowP; 
-			return NULL;
-		} else {
-			// Initializing X to 0
-// 			t1.clear();
-// 			t1.start();
-			for (size_t i=0; i<M; ++i)
-				for (size_t j=0; j<M;++j)
-					F.assign(*(X+i*ldx+j), zero);
-
-			// X = L^-1 in n^3/3
- 			ftrtri (F, FflasLower, FflasUnit, M, A, lda);
-			for (size_t i=0; i<M; ++i){
-				for (size_t j=i; j<M; ++j)
-					F.assign(*(X +i*ldx+j),zero);
-				F.assign (*(X+i*(ldx+1)), one);
-			}
-			for (size_t i=1; i<M; ++i)
- 				fcopy (F, i, (X+i*ldx), 1, (A+i*lda), 1);
-// 			t1.stop();
-			//cerr<<"U^-1 --> "<<t1.usertime()<<endl;
-
-			//invL( F, M, A, lda, X, ldx );
-		       // X = Q^-1.X is not necessary since Q = Id
-			
- 			// X = U^-1.X
-// 			t1.clear();
-//			t1.start();
-			ftrsm( F, FflasLeft, FflasUpper, FflasNoTrans, FflasNonUnit, 
-			       M, M, one, A, lda , X, ldx);
-//			t1.stop();
-			//cerr<<"ftrsm --> "<<t1.usertime()<<endl;
-
-			// X = P^-1.X
-			applyP( F, FflasLeft, FflasTrans, M, 0, M, X, ldx, P ); 
-			
-			delete[] P;
-			delete[] rowP;
-			return X;
-		}	
- 	}
-
-	/** RowRankProfile
-	 * Computes the row rank profile of A.
-	 *
-	 * @param A: input matrix of dimension 
-	 * @param rklprofile: return the rank profile as an array of row indexes, of dimension r=rank(A)
-	 *
-	 * rkprofile is allocated during the computation.
-	 * Returns R
-	 */
-	template <class Field>
-	static size_t RowRankProfile (const Field& F, const size_t M, const size_t N,
-				      typename Field::Element* A, const size_t lda, size_t* rkprofile){
-		size_t *P = new size_t[N];
-		size_t *Q = new size_t[M];
-		size_t R;
-
-		R = LUdivine (F, FflasNonUnit, FflasNoTrans, M, N, A, lda, P, Q);
-		rkprofile = new size_t[R];
-
-		for (size_t i=0; i<R; ++i)
-			rkprofile[i] = Q[i];
-		delete[] P;
-		delete[] Q;
-		return R;
-	}
-
-	/** ColumnRankProfile
-	 * Computes the column rank profile of A.
-	 *
-	 * @param A: input matrix of dimension 
-	 * @param rklprofile: return the rank profile as an array of row indexes, of dimension r=rank(A)
-	 *
-	 * A is modified 
-	 * rkprofile is allocated during the computation.
-	 * Returns R
-	 */
-	template <class Field>
-	static size_t ColumnRankProfile (const Field& F, const size_t M, const size_t N,
-					 typename Field::Element* A, const size_t lda, size_t* rkprofile){
-		size_t *P = new size_t[N];
-		size_t *Q = new size_t[M];
-		size_t R;
-
-		R = LUdivine (F, FflasNonUnit, FflasTrans, M, N, A, lda, P, Q);
-		rkprofile = new size_t[R];
-
-		for (size_t i=0; i<R; ++i)
-			rkprofile[i] = Q[i];
-		delete[] P;
-		delete[] Q;
-		return R;
-	}
-
-	/** RowRankProfileSubmatrixIndices
-	 * Computes the indices of the submatrix r*r X of A whose rows correspond to
-	 * the row rank profile of A.
-	 *
-	 * @param A: input matrix of dimension 
-	 * @param rowindices: array of the row indices of X in A
-	 * @param colindices: array of the col indices of X in A
-	 *
-	 * rowindices and colindices are allocated during the computation. 
-	 * A is modified 
-	 * Returns R
-	 */
-	template <class Field>
-	static size_t RowRankProfileSubmatrixIndices (const Field& F,
-						      const size_t M, const size_t N,
-						      typename Field::Element* A,
-						      const size_t lda,
-						      size_t*& rowindices,
-						      size_t*& colindices,
-						      size_t& R){
-		size_t *P = new size_t[N];
-		size_t *Q = new size_t[M];
-
-		R = LUdivine (F, FflasNonUnit, FflasNoTrans, M, N, A, lda, P, Q);
-		rowindices = new size_t[M];
-		colindices = new size_t[N];
-		for (size_t i=0; i<R; ++i){
-			rowindices [i] = Q [i];
-		}
-		for (size_t i=0; i<N; ++i)
-			colindices [i] = i;
-		size_t tmp;
-		for (size_t i=0; i<R; ++i){
-			if (i != P[i]){
-				tmp = colindices[i];
-				colindices[i] = colindices[P[i]];
-				colindices[P[i]] = tmp;
-			}
-		}
-				
-		delete[] P;
-		delete[] Q;
-
-		return R;
-	}
-
-	/** ColRankProfileSubmatrixIndices
-	 * Computes the indices of the submatrix r*r X of A whose columns correspond to
-	 * the column rank profile of A.
-	 *
-	 * @param A: input matrix of dimension 
-	 * @param rowindices: array of the row indices of X in A
-	 * @param colindices: array of the col indices of X in A
-	 *
-	 * rowindices and colindices are allocated during the computation. 
-	 * A is modified 
-	 * Returns R
-	 */
-	template <class Field>
-	static size_t ColRankProfileSubmatrixIndices (const Field& F,
-						      const size_t M, const size_t N,
-						      typename Field::Element* A,
-						      const size_t lda,
-						      size_t*& rowindices,
-						      size_t*& colindices,
-						      size_t& R){
-		size_t *P = new size_t[M];
-		size_t *Q = new size_t[N];
-
-		R = LUdivine (F, FflasNonUnit, FflasTrans, M, N, A, lda, P, Q);
-		rowindices = new size_t[M];
-		colindices = new size_t[N];
-		for (size_t i=0; i<R; ++i)
-			colindices [i] = Q [i];
-
-		for (size_t i=0; i<N; ++i)
-			rowindices [i] = i;
-
-		size_t tmp;
-		for (size_t i=0; i<R; ++i){
-			if (i != P[i]){
-				tmp = rowindices[i];
-				rowindices[i] = rowindices[P[i]];
-				rowindices[P[i]] = tmp;
-			}
-		}
-		delete[] P;
-		delete[] Q;
-
-		return R;
-	}
-
-	/** RowRankProfileSubmatrix
-	 * Compute the r*r submatrix X of A, by picking the row rank profile rows of A
-	 * 
-	 * @param A: input matrix of dimension M x N
-	 * @param X: the output matrix
-	 *
-	 * A is not modified
-	 * X is allocated during the computation.
-	 * Returns R
-	 */
-	template <class Field>
-	static size_t RowRankProfileSubmatrix (const Field& F,
-					       const size_t M, const size_t N,
-					       typename Field::Element* A,
-					       const size_t lda,
-					       typename Field::Element*& X, size_t& R){
-		
-		size_t * rowindices, * colindices;
-
-		typename Field::Element * A2 = MatCopy (F, M, N, A, lda);
-		
-		RowRankProfileSubmatrixIndices (F, M, N, A2, N, rowindices, colindices, R);
-
-		X = new typename Field::Element[R*R];
-		for (size_t i=0; i<R; ++i)
-			for (size_t j=0; j<R; ++j)
-				F.assign (*(X + i*R + j), *(A + rowindices[i]*lda + colindices[j]));
-		delete[] A2;
-		delete[] rowindices;
-		delete[] colindices;
-		return R;
-	}
-
-
-	/** ColRankProfileSubmatrix
-	 * Compute the r*r submatrix X of A, by picking the row rank profile rows of A
-	 * 
-	 * @param A: input matrix of dimension M x N
-	 * @param X: the output matrix
-	 *
-	 * A is not modified
-	 * X is allocated during the computation.
-	 * Returns R
-	 */
-	
-	template <class Field>
-	static size_t ColRankProfileSubmatrix (const Field& F, const size_t M, const size_t N,
-					       typename Field::Element* A, const size_t lda,
-					       typename Field::Element*& X, size_t& R){
-		
-		size_t * rowindices, * colindices;
-		
-		typename Field::Element * A2 = MatCopy (F, M, N, A, lda);
-		
-		ColRankProfileSubmatrixIndices (F, M, N, A2, N, rowindices, colindices, R);
-		
-		X = new typename Field::Element[R*R];
-		for (size_t i=0; i<R; ++i)
-			for (size_t j=0; j<R; ++j)
-				F.assign (*(X + i*R + j), *(A + rowindices[i]*lda + colindices[j]));
-		delete[] A2;
-		delete[] colindices;
-		delete[] rowindices;
-		return R;
-	}
-
-	
-	/** 
-	 * LQUPtoInverseOfFullRankMinor
-	 * Suppose A has been factorized as L.Q.U.P, with rank r.
-	 * Then Qt.A.Pt has an invertible leading principal r x r submatrix
-	 * This procedure efficiently computes the inverse of this minor and puts it into X.
-	 * NOTE: It changes the lower entries of A_factors in the process (NB: unless A was nonsingular and square)
-	 *
-	 * @param rank:       rank of the matrix.
-	 * @param A_factors:  matrix containing the L and U entries of the factorization
-	 * @param QtPointer:  theLQUP->getQ()->getPointer() (note: getQ returns Qt!)
-	 * @param X:          desired location for output
-	 */
-	template <class Field>
-	static typename Field::Element*
-	LQUPtoInverseOfFullRankMinor( const Field& F, const size_t rank,
-				      typename Field::Element * A_factors, const size_t lda,
-				      const size_t* QtPointer,
-				      typename Field::Element * X, const size_t ldx){
-		
-		typename Field::Element one, zero;
-		F.init(one,1.0);
-		F.init(zero,0.0);
-
-		// upper entries are okay, just need to move up bottom ones
-		const size_t* srcRow = QtPointer;
-		for (size_t row=0; row<rank; row++, srcRow++) 
-			if (*srcRow != row) {
-				typename Field::Element* oldRow = A_factors + (*srcRow) * lda;
-				typename Field::Element* newRow = A_factors + row * lda;
-				for (size_t col=0; col<row; col++, oldRow++, newRow++) 
-					F.assign(*newRow, *oldRow); 
-			}
-		
-		// X <- (Qt.L.Q)^(-1)
-		//invL( F, rank, A_factors, lda, X, ldx); 
-		ftrtri (F, FflasLower, FflasUnit, rank, A_factors, lda);
-		for (size_t i=0; i<rank; ++i)
-			fcopy (F, rank, A_factors+i*lda, 1, X+i*ldx,1);
-		
-		// X = U^-1.X
-		ftrsm( F, FflasLeft, FflasUpper, FflasNoTrans, 
-		       FflasNonUnit, rank, rank, one, A_factors, lda, X, ldx); 
-
-		return X;
-		
- 	}
-	
-
-	//---------------------------------------------------------------------
-	// TURBO: rank computation algorithm 
-	//---------------------------------------------------------------------
-	template <class Field>
-	static size_t 
-	TURBO (const Field& F, const size_t M, const size_t N,
-	       typename Field::Element* A, const size_t lda, size_t * P, size_t * Q, const size_t cutoff);
-		
-	/** 
-	 * Compute the LQUP factorization of the given matrix using
-	 * a block agorithm and return its rank. 
-	 * The permutations P and Q are represented
-	 * using LAPACK's convention.
-	 * @param Diag  precise whether U should have a unit diagonal or not
-	 * @param M matrix row dimension
-	 * @param N matrix column dimension
-	 * @param A input matrix
-	 * @param lda leading dimension of A
-	 * @param P the column permutation
-	 * @param Qt the transpose of the row permutation Q
-	 * @param LuTag flag for setting the earling termination if the matrix
-	 * is singular
-	 */
-	/// LQUP factorization.	
-	template <class Field>
-	static size_t 
-	LUdivine (const Field& F, const FFLAS_DIAG Diag,  const FFLAS_TRANSPOSE trans,
-		  const size_t M, const size_t N,
-		  typename Field::Element * A, const size_t lda,
-		  size_t* P, size_t* Qt,
-		  const FFPACK_LUDIVINE_TAG LuTag=FfpackLQUP,
-		  const size_t cutoff=__FFPACK_LUDIVINE_CUTOFF);
-
-	
-	template<class Element>
-	class callLUdivine_small;
-	
-	template <class Field>
-	static size_t 
-	LUdivine_small (const Field& F, const FFLAS_DIAG Diag,  const FFLAS_TRANSPOSE trans,
-			const size_t M, const size_t N,
-			typename Field::Element * A, const size_t lda,
-			size_t* P, size_t* Q, const FFPACK_LUDIVINE_TAG LuTag=FfpackLQUP);
-
-	template <class Field>
-	static size_t
-	LUdivine_gauss (const Field& F, const FFLAS_DIAG Diag,
-			const size_t M, const size_t N,
-			typename Field::Element * A, const size_t lda,
-			size_t* P, size_t* Q, const FFPACK_LUDIVINE_TAG LuTag=FfpackLQUP);
-       	
-
-
-	/**
-	 * Compute the inverse of a triangular matrix.
-	 * @param Uplo whether the matrix is upper of lower triangular
-	 * @param Diag whether the matrix if unit diagonal
-	 * 
-	 */
-	 template<class Field>
-	 static void
-	 ftrtri (const Field& F, const FFLAS_UPLO Uplo, const FFLAS_DIAG Diag,
-		 const size_t N, typename Field::Element * A, const size_t lda){
-
-		 static typename Field::Element one;
-		 static typename Field::Element mone;
-		 F.init(one,1.0);
-		 F.init(mone,-1.0);
-		 if (N == 1){
-			 if (Diag == FflasNonUnit)
-				 F.invin (*A);
-		 } else {
-			 size_t N1 = N/2;
-			 size_t N2 = N - N1;
-			 ftrtri (F, Uplo, Diag, N1, A, lda);
-			 ftrtri (F, Uplo, Diag, N2, A + N1*(lda+1), lda);
-			 if (Uplo == FflasUpper){
-				 ftrmm (F, FflasLeft, Uplo, FflasNoTrans, Diag, N1, N2,
-					one, A, lda, A + N1, lda);
-				 ftrmm (F, FflasRight, Uplo, FflasNoTrans, Diag, N1, N2,
-					mone, A + N1*(lda+1), lda, A + N1, lda);
-			 } else {
-				 ftrmm (F, FflasLeft, Uplo, FflasNoTrans, Diag, N2, N1,
-					one, A + N1*(lda+1), lda, A + N1*lda, lda);
-				 ftrmm (F, FflasRight, Uplo, FflasNoTrans, Diag, N2, N1,
-					mone, A, lda, A + N1*lda, lda);
-			 }
-		 }
-	 }
-
-
-	/**
-	 * Compute the product UL of the upper, resp lower triangular matrices U and L
-	 * stored one above the other in the square matrix A.
-	 * Diag == Unit if the matrix U is unit diagonal
-	 * 
-	 */
-	template<class Field>
-	static void
-	ftrtrm (const Field& F, const FFLAS_DIAG diag, const size_t N,
-		typename Field::Element * A, const size_t lda){
-		
-		typename Field::Element one;
-		F.init(one,1.0);
-		
-		if (N == 1)
-			return;
-		size_t N1 = N/2;
-		size_t N2 = N-N1;
-		
-		ftrtrm (F, diag, N1, A, lda);
-		
-		fgemm (F, FflasNoTrans, FflasNoTrans, N1, N1, N2, one,
-		       A+N1, lda, A+N1*lda, lda, one, A, lda);
-		
-		ftrmm (F, FflasRight, FflasLower, FflasNoTrans, (diag == FflasUnit) ? FflasNonUnit : FflasUnit, N1, N2, one, A + N1*(lda+1), lda, A + N1, lda);
-		
-		ftrmm (F, FflasLeft, FflasUpper, FflasNoTrans, diag, N2, N1, one, A + N1*(lda+1), lda, A + N1*lda, lda);
-		
-		ftrtrm (F, diag, N2, A + N1*(lda+1), lda);
-		
-	}
-
-	/**
-	 * Compute the Column Echelon form of the input matrix in-place.
-	 * 
-	 * After the computation A = [ M \ V ] such that AU = C is a column echelon
-	 * decomposition of A, with U = P^T [ V + Ir ] and C = M //+ Q [ Ir   ]
-	 *                                  [ 0 In-r ]           //    [    0 ]
-	 * Qt = Q^T
-	 */
-	template <class Field>
-	static size_t
-	ColumnEchelonForm (const Field& F, const size_t M, const size_t N,
-			   typename Field::Element * A, const size_t lda,
-			   size_t* P, size_t* Qt){
-
-		typename Field::Element one, mone;
-		F.init (one, 1.0);
-		F.neg (mone, one);
-		size_t r;
-
-		// Timer t1;
-// 		t1.clear();
-// 		t1.start();
-		r = LUdivine (F, FflasUnit, FflasNoTrans, M, N, A, lda, P, Qt);
-		// t1.stop();
-		//cerr<<"LU --> "<<t1.usertime()<<endl;
-		
-		// Timer t2;
-// 		t2.clear();
-// 		t2.start();
-		ftrtri (F, FflasUpper, FflasUnit, r, A, lda);
-
-
-		ftrmm (F, FflasLeft, FflasUpper, FflasNoTrans, FflasUnit, r, N-r,
-		       mone, A, lda, A+r, lda);
-
-		// t2.stop();
-		//cerr<<"U^-1 --> "<<t2.usertime()<<endl;
-
-		return r;
-	}
-
-	/**
-	 * Compute the Row Echelon form of the input matrix in-place.
-	 * 
-	 * After the computation A = [ L \ M ] such that L A = R is a column echelon
-	 * decomposition of A, with L =  [ L+Ir  0   ] P  and R = M
-	 *                               [      In-r ]               
-	 * Qt = Q^T
-	 */
-	template <class Field>
-	static size_t
-	RowEchelonForm (const Field& F, const size_t M, const size_t N,
-			typename Field::Element * A, const size_t lda,
-			size_t* P, size_t* Qt){
-
-		typename Field::Element one, mone;
-		F.init (one, 1.0);
-		F.neg (mone, one);
-		size_t r;
-
-		// Timer t1;
-// 		t1.clear();
-// 		t1.start();
-		r = LUdivine (F, FflasUnit, FflasTrans,  M, N, A, lda, P, Qt);
-		// t1.stop();
-		//cerr<<"LU --> "<<t1.usertime()<<endl;
-		
-		// Timer t2;
-// 		t2.clear();
-// 		t2.start();
-		ftrtri (F, FflasLower, FflasUnit, r, A, lda);
-
-
-		ftrmm (F, FflasRight, FflasLower, FflasNoTrans, FflasUnit, M-r, r,
-		       mone, A, lda, A+r*lda, lda);
-
-		// t2.stop();
-		//cerr<<"U^-1 --> "<<t2.usertime()<<endl;
-
-		return r;
-	}
-
-	/**
-	 * Compute the Reduced Column Echelon form of the input matrix in-place.
-	 * 
-	 * After the computation A = [  V  ] such that AU = R is a reduced column echelon
-	 *                           [ M 0 ]
-	 * decomposition of A, where U = P^T [ V      ] and R = Q [ Ir   ]
-	 *                                   [ 0 In-r ]           [ M  0 ]
-	 * Qt = Q^T
-	 */
-	template <class Field>
-	static size_t
-	ReducedColumnEchelonForm (const Field& F, const size_t M, const size_t N,
-				  typename Field::Element * A, const size_t lda,
-				  size_t* P, size_t* Qt){
-		
-		typename Field::Element one, mone;
-		F.init (one, 1.0);
-		F.neg (mone, one);
-		size_t r;
-
-		r = ColumnEchelonForm (F, M, N, A, lda, P, Qt);
-			
-// 		Timer t1;
-// 		t1.clear();
-// 		t1.start();
-
-		// M = Q^T M 
-		for (size_t i=0; i<r; ++i){
-			if ( Qt[i]> (size_t) i ){
-				fswap( F, i+1, 
-				       A + Qt[i]*lda, 1, 
-				       A + i*lda, 1 );
-			}
-		}
-		
-		ftrtri (F, FflasLower, FflasNonUnit, r, A, lda);
-		
-		ftrmm (F, FflasRight, FflasLower, FflasNoTrans, FflasNonUnit, M-r, r,
-		       one, A, lda, A+r*lda, lda);
-
-		ftrtrm (F, FflasUnit, r, A, lda);
-// 		t1.stop();
-		//cerr<<"U^-1L^-1 --> "<<t1.usertime()<<endl;	   
-		
-		return r;
-
-	}
-
-	/**
-	 * Compute the Reduced Row Echelon form of the input matrix in-place.
-	 * 
-	 * After the computation A = [  V  ] such that L A = R is a reduced row echelon
-	 *                           [ M 0 ]
-	 * decomposition of A, where L =  [ V      ] P^T and R =  [ Ir M  ] Q
-	 *                                [ 0 In-r ]              [ 0     ]
-	 * Qt = Q^T
-	 */
-	template <class Field>
-	static size_t
-	ReducedRowEchelonForm (const Field& F, const size_t M, const size_t N,
-			       typename Field::Element * A, const size_t lda,
-			       size_t* P, size_t* Qt){
-		
-		typename Field::Element one, mone;
-		F.init (one, 1.0);
-		F.neg (mone, one);
-		size_t r;
-
-		r = RowEchelonForm (F, M, N, A, lda, P, Qt);
-			
-// 		Timer t1;
-// 		t1.clear();
-// 		t1.start();
-		// M = M Q^T 
-		for (int i=0; i<r; ++i){
-			if ( Qt[i]> (size_t) i ){
-				fswap( F, i+1, 
-				       A + Qt[i], lda, 
-				       A + i, lda );
-			}
-		}
-		
-		ftrtri (F, FflasUpper, FflasNonUnit, r, A, lda);
-		
-		ftrmm (F, FflasLeft, FflasUpper, FflasNoTrans, FflasNonUnit, r, N-r,
-		       one, A, lda, A+r, lda);
-		
-		ftrtrm (F, FflasNonUnit, r, A, lda);
-		
-// 		t1.stop();
-		//cerr<<"U^-1L^-1 --> "<<t1.usertime()<<endl;	   
-		
-		return r;
-
-	}
-	
-	/** Apply a permutation submatrix of P (between ibeg and iend) to a matrix
-	 * to (iend-ibeg) vectors of size M stored in A (as column for NoTrans 
-	 * and rows for Trans)
-	 * Side==FflasLeft for row permutation Side==FflasRight for a column 
-	 * permutation
-	 * Trans==FflasTrans for the inverse permutation of P
-	 */
-	template<class Field>
-	static void 
-	applyP( const Field& F, 
-		const FFLAS_SIDE Side,
-		const FFLAS_TRANSPOSE Trans,
-		const size_t M, const int ibeg, const int iend,
-		typename Field::Element * A, const size_t lda, const size_t * P ){
-		
-		if ( Side == FflasRight )
-			if ( Trans == FflasTrans ){
-				for ( size_t i=ibeg; i<(size_t) iend; ++i){
-					if ( P[i]> i )
-						fswap( F, M, 
-						       A + P[i]*1, lda, 
-						       A + i*1, lda );
-				}
-			}
-			else{ // Trans == FflasNoTrans
-				for (int i=iend-1; i>=ibeg; --i){
-					if ( P[i]>(size_t)i ){
-						fswap( F, M, 
-						       A + P[i]*1, lda, 
-						       A + i*1, lda );
-					}
-				}
-			}
-		else // Side == FflasLeft
-			if ( Trans == FflasNoTrans ){
-				for (size_t i=ibeg; i<(size_t)iend; ++i){
-					if ( P[i]> (size_t) i )
-						fswap( F, M, 
-						       A + P[i]*lda, 1, 
-						       A + i*lda, 1 );
-				}
-			}
-			else{ // Trans == FflasTrans
-				for (int i=iend-1; i>=ibeg; --i){
-					if ( P[i]> (size_t) i ){
-						fswap( F, M, 
-						       A + P[i]*lda, 1, 
-						       A + i*lda, 1 );
-					}
-				}
-			}
-			
-	}
-	
-	/**
-	 * Compute the characteristic polynomial of A using Krylov
-	 * Method, and LUP factorization of the Krylov matrix
-	 */
-	template <class Field, class Polynomial>
-	static std::list<Polynomial>&
-	CharPoly( const Field& F, std::list<Polynomial>& charp, const size_t N,
-		  typename Field::Element * A, const size_t lda,
-		  const FFPACK_CHARPOLY_TAG CharpTag= FfpackArithProg);
-	
-	/**
-	 * Compute the minimal polynomial of (A,v) using an LUP 
-	 * factorization of the Krylov Base (v, Av, .., A^kv)
-	 * U,X must be (n+1)*n
-	 * U contains the Krylov matrix and X, its LSP factorization
-	 */
-	template <class Field, class Polynomial>
-	static Polynomial&
-	MinPoly( const Field& F, Polynomial& minP, const size_t N,
-		 const typename Field::Element *A, const size_t lda,
-		 typename Field::Element* X, const size_t ldx, size_t* P,
-		 const FFPACK_MINPOLY_TAG MinTag,
-		 const size_t kg_mc, const size_t kg_mb, const size_t kg_j );
-
-
-	// Solve L X = B or X L = B in place
-	// L is M*M if Side == FflasLeft and N*N if Side == FflasRight, B is M*N.
-	// Only the R non trivial column of L are stored in the M*R matrix L
-	// Requirement :  so that L could  be expanded in-place
-	template<class Field>
-	static void
-	solveLB( const Field& F, const FFLAS_SIDE Side,
-		 const size_t M, const size_t N, const size_t R, 
-		 typename Field::Element * L, const size_t ldl, 
-		 const size_t * Q,
-		 typename Field::Element * B, const size_t ldb ){
-		
-		typename Field::Element one, zero;
-		F.init(one, 1.0);
-		F.init(zero, 0.0);
-		size_t LM = (Side == FflasRight)?N:M;
-		for (int i=R-1; i>=0; --i){
-			if (  Q[i] > (size_t) i){
-				//for (size_t j=0; j<=Q[i]; ++j)
-				//F.init( *(L+Q[i]+j*ldl), 0 );
-				//std::cerr<<"1 deplacement "<<i<<"<-->"<<Q[i]<<endl;
-				fcopy( F, LM-Q[i]-1, L+Q[i]*(ldl+1)+ldl,ldl, L+(Q[i]+1)*ldl+i, ldl );
-				for ( size_t j=Q[i]*ldl; j<LM*ldl; j+=ldl)
-					F.assign( *(L+i+j), zero );
-			}
-		}
-		ftrsm( F, Side, FflasLower, FflasNoTrans, FflasUnit, M, N, one, L, ldl , B, ldb);
-		//write_field(F,std::cerr<<"dans solveLB "<<endl,L,N,N,ldl);
-		// Undo the permutation of L
-		for (size_t i=0; i<R; ++i){
-			if ( Q[i] > (size_t) i){
-				//for (size_t j=0; j<=Q[i]; ++j)
-				//F.init( *(L+Q[i]+j*ldl), 0 );
-				fcopy( F, LM-Q[i]-1, L+(Q[i]+1)*ldl+i, ldl, L+Q[i]*(ldl+1)+ldl,ldl );
-				for ( size_t j=Q[i]*ldl; j<LM*ldl; j+=ldl)
-					F.assign( *(L+Q[i]+j), zero );
-			}
-		} 
-	}
-	
-	// Solve L X = B in place
-	// L is M*M or N*N, B is M*N.
-	// Only the R non trivial column of L are stored in the M*R matrix L
-	template<class Field>
-	static void
-	solveLB2( const Field& F, const FFLAS_SIDE Side,
-		  const size_t M, const size_t N, const size_t R, 
-		  typename Field::Element * L, const size_t ldl, 
-		  const size_t * Q,
-		  typename Field::Element * B, const size_t ldb ){
-		
-
-		
-		typename Field::Element Mone, one;
-		F.init( Mone, -1.0 );
-		F.init( one, 1.0 );
-		typename Field::Element * Lcurr,* Rcurr,* Bcurr;
-		size_t ib,  Ldim;
-		int k;
-		if ( Side == FflasLeft ){
-			size_t j = 0;
-			while ( j<R ) {
-				k = ib = Q[j];
-				while ((j<R) && ( (int) Q[j] == k)  ) {k++;j++;}
-				Ldim = k-ib;
-				Lcurr = L + j-Ldim + ib*ldl;
-				Bcurr = B + ib*ldb;
-				Rcurr = Lcurr + Ldim*ldl;
-
-				ftrsm( F, Side, FflasLower, FflasNoTrans, FflasUnit, Ldim, N, one,
-				       Lcurr, ldl , Bcurr, ldb );
-
-				fgemm( F, FflasNoTrans, FflasNoTrans, M-k, N, Ldim, Mone,
-				       Rcurr , ldl, Bcurr, ldb, one, Bcurr+Ldim*ldb, ldb);
-			}
-		}
-		else{ // Side == FflasRight
-			int j=R-1;
-			while ( j >= 0 ) {
-				k = ib = Q[j];
-				while ( (j >= 0) &&  ( (int)Q[j] == k)  ) {--k;--j;}
-				Ldim = ib-k;
-				Lcurr = L + j+1 + (k+1)*ldl;
-				Bcurr = B + ib+1;
-				Rcurr = Lcurr + Ldim*ldl;
-
-				fgemm (F, FflasNoTrans, FflasNoTrans, M,  Ldim, N-ib-1, Mone,
-				       Bcurr, ldb, Rcurr, ldl,  one, Bcurr-Ldim, ldb);
-
-				ftrsm (F, Side, FflasLower, FflasNoTrans, FflasUnit, M, Ldim, one,
-				       Lcurr, ldl , Bcurr-Ldim, ldb );
-			}
-		}
-	}
-
-
-	template<class Field>
-	static void trinv_left( const Field& F, const size_t N, const typename Field::Element * L, const size_t ldl,
-				typename Field::Element * X, const size_t ldx ){
-		for (size_t i=0; i<N; ++i)
-			fcopy (F, N, X+i*ldx, 1, L+i*ldl, 1);
-		ftrtri (F, FflasLower, FflasUnit, N, X, ldx);
-		//invL(F,N,L,ldl,X,ldx);
-	}
-	
-	template <class Field>
-	static size_t KrylovElim( const Field& F, const size_t M, const size_t N,		
-				  typename Field::Element * A, const size_t lda, size_t*P, 
-				  size_t *Q, const size_t deg, size_t *iterates, size_t * inviterates, const size_t maxit,size_t virt);
-
-	template <class Field>
-	static size_t  SpecRankProfile (const Field& F, const size_t M, const size_t N,
-					typename Field::Element * A, const size_t lda, const size_t deg, size_t *rankProfile);
-	template <class Field, class Polynomial>
-	static std::list<Polynomial>&
-	CharpolyArithProg (const Field& F, std::list<Polynomial>& frobeniusForm, 
-			   const size_t N, typename Field::Element * A, const size_t lda, const size_t c);
-
-	template <class Field>
-	static void CompressRows (Field& F, const size_t M,
-				  typename Field::Element * A, const size_t lda,
-				  typename Field::Element * tmp, const size_t ldtmp,
-				  const size_t * d, const size_t nb_blocs);
-
-	template <class Field>
-	static void CompressRowsQK (Field& F, const size_t M,
-				  typename Field::Element * A, const size_t lda,
-				  typename Field::Element * tmp, const size_t ldtmp,
-				  const size_t * d,const size_t deg, const size_t nb_blocs);
-
-	template <class Field>
-	static void DeCompressRows (Field& F, const size_t M, const size_t N,
-					    typename Field::Element * A, const size_t lda,
-					    typename Field::Element * tmp, const size_t ldtmp,
-					    const size_t * d, const size_t nb_blocs);
-	template <class Field>
-	static void DeCompressRowsQK (Field& F, const size_t M, const size_t N,
-					    typename Field::Element * A, const size_t lda,
-					    typename Field::Element * tmp, const size_t ldtmp,
-					    const size_t * d, const size_t deg, const size_t nb_blocs);
-	
-	template <class Field>
-	static void CompressRowsQA (Field& F, const size_t M,
-					    typename Field::Element * A, const size_t lda,
-					    typename Field::Element * tmp, const size_t ldtmp,
-					    const size_t * d, const size_t nb_blocs);
-	template <class Field>
-	static void DeCompressRowsQA (Field& F, const size_t M, const size_t N,
-					      typename Field::Element * A, const size_t lda,
-					      typename Field::Element * tmp, const size_t ldtmp,
-					      const size_t * d, const size_t nb_blocs);
-	
-
-protected:
-	
-	
-	// Subroutine for Keller-Gehrig charpoly algorithm
-	// Compute the new d after a LSP ( d[i] can be zero )
-	template<class Field>
-	static size_t 
-	newD( const Field& F, size_t * d, bool& KeepOn,
-	      const size_t l, const size_t N, 
-	      typename Field::Element * X,
-	      const size_t* Q,
-	      std::vector<std::vector<typename Field::Element> >& minpt);
-
-	template<class Field>
-	static size_t
-	updateD(const Field& F, size_t * d, size_t k,
-		std::vector<std::vector<typename Field::Element> >& minpt );
-	
-	//---------------------------------------------------------------------
-	// RectangleCopyTURBO: Copy A to T, with respect to the row permutation 
-	//                     defined by the lsp factorization of located in 
-	//                     A-dist2pivot
-	//---------------------------------------------------------------------
-	template <class Field>
-	static void
-	RectangleCopyTURBO( const Field& F, const size_t M, const size_t N, 
-		       const size_t dist2pivot, const size_t rank,
-		       typename Field::Element * T, const size_t ldt, 
-		       const typename Field::Element * A, const size_t lda ){
-
-		const typename Field::Element * Ai = A;
-		typename Field::Element * T1i = T, T2i = T + rank*ldt;
-		size_t x = dist2pivot;
-		for (; Ai<A+M*lda; Ai+=lda){
-			while ( F.isZero(*(Ai-x)) ) { // test if the pivot is 0
-				fcopy( F, N, T2i, 1, Ai, 1);
-				Ai += lda;
-				T2i += ldt;
-			}
-			fcopy( F, N, T1i, 1, Ai, 1);
-			T1i += ldt;
-			x--;
-		}
-	}
-
-	
-
-	//---------------------------------------------------------------------
-	// LUdivine_construct: (Specialisation of LUdivine)
-	// LUP factorisation of X, the Krylov base matrix of A^t and v, in A.
-	// X contains the nRowX first vectors v, vA, .., vA^{nRowX-1}
-	// A contains the LUP factorisation of the nUsedRowX first row of X.
-	// When all rows of X have been factorized in A, and rank is full,
-	// then X is updated by the following scheme: X <= ( X; X.B ), where
-	// B = A^2^i.
-	// This enables to make use of Matrix multiplication, and stop computing
-	// Krylov vector, when the rank is not longer full.
-	// P is the permutation matrix stored in an array of indexes
-	//---------------------------------------------------------------------
-	
-	template <class Field>
-	static size_t
-	LUdivine_construct( const Field& F, const FFLAS_DIAG Diag,
-			    const size_t M, const size_t N,
-			    const typename Field::Element * A, const size_t lda,
-			    typename Field::Element * X, const size_t ldx,
-			    typename Field::Element * u, size_t* P,
-			    bool computeX, const FFPACK_MINPOLY_TAG MinTag,
-			    const size_t kg_mc, const size_t kg_mb, const size_t kg_j );
-		
-	template <class Field, class Polynomial>
-	static std::list<Polynomial>&
-	KellerGehrig( const Field& F, std::list<Polynomial>& charp, const size_t N,
-		      const typename Field::Element * A, const size_t lda );
-
-	template <class Field, class Polynomial>
-	static int
-	KGFast ( const Field& F, std::list<Polynomial>& charp, const size_t N,
-		 typename Field::Element * A, const size_t lda, 
-		 size_t * kg_mc, size_t* kg_mb, size_t* kg_j );
-
-	template <class Field, class Polynomial>
-	static std::list<Polynomial>&
-	KGFast_generalized (const Field& F, std::list<Polynomial>& charp, 
-			    const size_t N,
-			    typename Field::Element * A, const size_t lda);
-
-
-	template<class Field>
-	static void 
-	fgemv_kgf( const Field& F,  const size_t N, 
-		   const typename Field::Element * A, const size_t lda,
-		   const typename Field::Element * X, const size_t incX,
-		   typename Field::Element * Y, const size_t incY, 
-		   const size_t kg_mc, const size_t kg_mb, const size_t kg_j );
-
-	template <class Field, class Polynomial>
-	static std::list<Polynomial>& 
-	LUKrylov( const Field& F, std::list<Polynomial>& charp, const size_t N,
-		  typename Field::Element * A, const size_t lda,
-		  typename Field::Element * U, const size_t ldu);
-	
-	template <class Field, class Polynomial>
-	static std::list<Polynomial>&
-	Danilevski (const Field& F, std::list<Polynomial>& charp, 
-		    const size_t N, typename Field::Element * A, const size_t lda);
-		
-	template <class Field, class Polynomial>
-	static std::list<Polynomial>&
-	LUKrylov_KGFast( const Field& F, std::list<Polynomial>& charp, const size_t N,
-			 typename Field::Element * A, const size_t lda,
-			 typename Field::Element * X, const size_t ldx);
-};
-
-#include "ffpack_ludivine.inl"
-#include "ffpack_minpoly.inl"
-#include "ffpack_charpoly_kglu.inl"
-#include "ffpack_charpoly_kgfast.inl"
-#include "ffpack_charpoly_kgfastgeneralized.inl"
-#include "ffpack_charpoly_danilevski.inl"
-#include "ffpack_charpoly.inl"
-#include "ffpack_krylovelim.inl"
-#include "ffpack_frobenius.inl"
-#ifdef _LINBOX_LINBOX_CONFIG_H
-}
-#endif
-#endif // __FFPACK_H
diff --git a/linbox/ffpack/ffpack_charpoly.inl b/linbox/ffpack/ffpack_charpoly.inl
deleted file mode 100644
index e60cdd9..0000000
--- a/linbox/ffpack/ffpack_charpoly.inl
+++ /dev/null
@@ -1,265 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* ffpack/ffpack_charpoly.inl
- * Copyright (C) 2005 Clement Pernet
- *
- * Written by Clement Pernet <Clement.Pernet at imag.fr>
- *
- * See COPYING for license information.
- */
-
-template <class Field, class Polynomial>
-std::list<Polynomial>&
-FFPACK::CharPoly (const Field& F, std::list<Polynomial>& charp, const size_t N,
-		  typename Field::Element * A, const size_t lda,
-		  const FFPACK_CHARPOLY_TAG CharpTag){
-	switch (CharpTag) {
-	case FfpackLUK:{
-		typename Field::Element * X = new typename Field::Element[N*(N+1)];
-		LUKrylov (F, charp, N, A, lda, X, N);
-		delete[] X;
-		return charp;
-	}
-	case FfpackKG:{
-		return KellerGehrig (F, charp, N, A, lda);
-		break;
-	}
-	case FfpackDanilevski:{
-		return Danilevski (F, charp, N, A, lda);
-		break;
-	}
-	case FfpackKGFast:{
-		size_t mc, mb, j;
-		if (KGFast (F, charp, N, A, lda, &mc, &mb, &j)){
-			std::cerr<<"NON GENERIC MATRIX PROVIDED TO KELLER-GEHRIG-FAST"<<std::endl;
-		}
-		return charp;
-		break;
-	}
- 	case FfpackKGFastG:{
- 		return KGFast_generalized (F, charp, N, A, lda);
-	}
-	case FfpackHybrid:{
-		typename Field::Element * X = new typename Field::Element[N*(N+1)];
-		LUKrylov_KGFast (F, charp, N, A, lda, X, N);
-		delete[] X;
-		return charp;
-	}
-	case FfpackArithProg:{
-		size_t attempts=0;
-		bool cont = false;
-		FFLAS_INT_TYPE p;
-		F.characteristic(p);
-		// Heuristic condition (the pessimistic theoretical one being p<2n^2.
-		if ((unsigned long) (p) < N)
-			return CharPoly (F, charp, N, A, lda, FfpackLUK);
-
-		do{
-			try {
-				CharpolyArithProg (F, charp, N, A, lda, __FFPACK_CHARPOLY_THRESHOLD);
-			}
-			catch (CharpolyFailed){
-				if (attempts++ < 2)
-					cont = true;
-				else
-					return CharPoly(F, charp, N, A, lda, FfpackLUK);
-				
-			}
-		} while (cont);
-		return charp;
-	}
-	default:{
-		typename Field::Element * X = new typename Field::Element[N*(N+1)];
-		LUKrylov (F, charp, N, A, lda, X, N);
-		delete[] X;
-		return charp;
-	}
-	}
-}
-
-template <class Field, class Polynomial>
-std::list<Polynomial>&
-FFPACK::LUKrylov (const Field& F, std::list<Polynomial>& charp, const size_t N,
-		 typename Field::Element * A, const size_t lda,
-		 typename Field::Element * X, const size_t ldx){
-	
-	typedef typename Field::Element elt;
-	elt* Ai, *Xi, *X2=X;
-	static elt Mone, one, zero;
-	F.init(zero,0.0);
-	F.init(one, 1.0);
-	F.neg(Mone,one);
-	int Ncurr=N;
-	charp.clear();
-	int nbfac = 0;
-	while (Ncurr > 0){
-		size_t P[Ncurr];
-		Polynomial minP;//=new Polynomial();
-		MinPoly (F, minP, Ncurr, A, lda, X2, ldx, P);
-		int k = minP.size()-1; // degre of minpoly
-		if ((k==1) && F.isZero ((minP)[0])){ // minpoly is X
-			Ai = A;
-			int j = Ncurr*Ncurr;
-			while (j-- && F.isZero(*(Ai++)));
-			if (!j){ // A is 0, CharPoly=X^n
-				minP.resize(Ncurr+1);
-				(minP)[1] = zero;
-				(minP)[Ncurr] = one;
-				k=Ncurr;
-			}
-		}
-		nbfac++;
-		charp.push_front (minP);
-		if (k==Ncurr){
-			return charp;
-		}
-		size_t Nrest = Ncurr-k;
-		elt * X21 = X2 + k*ldx;
-		elt * X22 = X21 + k;
-		// Compute the n-k last rows of A' = PA^tP^t in X2_
-		// A = A . P^t
-		applyP (F, FflasRight, FflasTrans, Ncurr, 0, k, A, lda, P);
-		// Copy X2_ = (A'_2)^t
-		for (Xi = X21, Ai = A+k; Xi != X21 + Nrest*ldx; Ai++, Xi+=ldx-Ncurr)
-			for (size_t jj=0; jj<Ncurr*lda; jj+=lda)
-				*(Xi++) = *(Ai+jj);
-		// A = A . P : Undo the permutation on A
-		applyP (F, FflasRight, FflasNoTrans, Ncurr, 0, k, A, lda, P);
-		// X2_ = X2_ . P^t (=  (P A^t P^t)2_) 
-		applyP (F, FflasRight, FflasTrans, Nrest, 0, k, X21, ldx, P);
-		// X21 = X21 . S1^-1
-		ftrsm(F, FflasRight, FflasUpper, FflasNoTrans, FflasUnit, Nrest, k,
-		      one, X2, ldx, X21, ldx); 
-		// Creation of the matrix A2 for recurise call 
-		for (Xi = X22, Ai = A;
-		     Xi != X22 + Nrest*ldx;
-		     Xi += (ldx-Nrest), Ai += (lda-Nrest))
-			for (size_t jj=0; jj<Nrest; ++jj)
-				*(Ai++) = *(Xi++);
-		fgemm (F, FflasNoTrans, FflasNoTrans, Nrest, Nrest, k, Mone,
-		       X21, ldx, X2+k, ldx, one, A, lda);
-		X2 = X22;
-		Ncurr = Nrest;
-	}
-	return charp;
-}
-
-template <class Field, class Polynomial>
-std::list<Polynomial>&
-FFPACK::LUKrylov_KGFast (const Field& F, std::list<Polynomial>& charp, const size_t N,
-			 typename Field::Element * A, const size_t lda,
-			 typename Field::Element * X, const size_t ldx){
-	
-	typedef typename Field::Element elt;
-	
-	static elt Mone, one, zero;
-	F.init(zero,0.0);
-	F.init(one, 1.0);
-	F.neg(Mone,one);
-	size_t kg_mc, kg_mb, kg_j;
-	
-	if (!KGFast (F, charp, N, A, lda, &kg_mc, &kg_mb, &kg_j))
-		return charp;
-	else{// Matrix A is not generic
-		Polynomial *minP = new Polynomial();
-		const elt* Ai;
-		elt* A2i, *Xi;
-		size_t *P = new size_t[N];
-
-		MinPoly (F, *minP, N, A, lda, X, ldx, P, FfpackKGF, kg_mc, kg_mb, kg_j);
-		size_t k = minP->size()-1; // degre of minpoly
-		if ((k==1) && F.isZero ((*minP)[0])){ // minpoly is X
-			Ai = A;
-			int j = N*N;
-			while (j-- && F.isZero(*(Ai++)));
-			if (!j){ // A is 0, CharPoly=X^n
-				minP->resize(N+1);
-				(*minP)[1] = zero;
-				(*minP)[N] = one;
-				k=N;
-			}
-		}
-		
-		if (k==N){
-			charp.clear();
-			charp.push_front(*minP); // CharPoly = MinPoly
-			delete[] P;
-			return charp;
-		}
-
-		size_t Nrest = N-k;
-		elt * X21 = X + k*ldx;
-		elt * X22 = X21 + k;
-		
-		// Creates the matrix A
-		size_t lambda = MAX(0,N - kg_mc*(kg_j+1) - kg_mb); 
-		size_t imax = kg_mc+kg_mb;
-		// First Id
-		for (size_t j = 0; j < lambda; ++j){
-			for (size_t i=0; i<imax; ++i)
-				F.assign (*(A+j+i*lda), zero);
-			F.assign (*(A+j+imax*lda), one);
-			for (size_t i=imax+1; i<N; ++i)
-				F.assign (*(A+j+i*lda), zero);
-			++imax;
-		}
-		// Column block B
-		for (typename Field::Element* Ai=A; Ai<A+N*lda; Ai+=lda)
-			fcopy (F, kg_mb, Ai+lambda, 1, Ai+N-kg_mc-kg_mb, 1);
-
-		// Second Id block
-		imax = N- kg_j*kg_mc;
-		for (size_t j = 0; j< kg_j*kg_mc; ++j){
-			for (size_t i = 0; i<imax; ++i)
-				F.assign (*(A+lambda+kg_mb+j+i*lda), zero);
-			F.assign (*(A+lambda+kg_mb+j+imax*lda), one);
-			for (size_t i = imax+1; i<N; ++i)
-				F.assign (*(A+lambda+kg_mb+j+i*lda), zero);
-			++imax;
-		}
-		
-		// Compute the n-k last rows of A' = PA^tP^t in X2_
-		
-		// A = P . A 
-		applyP (F, FflasLeft, FflasNoTrans, N, 0, k, 
-			const_cast<typename Field::Element* &>(A), lda, P);
-		
-		// Copy X2_ = (A'2_)
-		for (Xi = X21, Ai = A+k*lda; Xi != X21 + Nrest*ldx; Ai+=lda-N, Xi+=ldx-N){
-			for (size_t jj=0; jj<N; ++jj){
-				*(Xi++) = *(Ai++);
-			}
-		}
-
-		// A = P^t . A : Undo the permutation on A
-		applyP (F, FflasLeft, FflasTrans, N, 0, k, 
-			const_cast<typename Field::Element* &>(A), lda, P);
-	
-		// X2_ = X2_ . P^t (=  (P A P^t)2_) 
-		applyP (F, FflasRight, FflasTrans, Nrest, 0, k, X21, ldx, P);
-
-		// X21 = X21 . S1^-1
-		ftrsm(F, FflasRight, FflasUpper, FflasNoTrans, FflasUnit, Nrest, k,
-		      one, X, ldx, X21, ldx);  
-	
-		// Creation of the matrix A2 for recurise call 
-		elt * A2 = new elt[Nrest*Nrest];
-	
-		for (Xi = X22, A2i = A2;
-		     Xi != X22 + Nrest*ldx;
-		     Xi += (ldx-Nrest)){
-			for (size_t jj=0; jj<Nrest; ++jj){
-				*(A2i++) = *(Xi++);
-			}
-		}
-		fgemm (F, FflasNoTrans, FflasNoTrans, Nrest, Nrest, k, Mone,
-		       X21, ldx, X+k, ldx, one, A2, Nrest);
-	
-		// Recursive call on X22
-		LUKrylov_KGFast (F, charp, Nrest, A2, Nrest, X22, ldx);
-		charp.push_front (*minP);
-		delete[] P;
-		delete[] A2;
-		return charp;
-	}
-}
diff --git a/linbox/ffpack/ffpack_charpoly_danilevski.inl b/linbox/ffpack/ffpack_charpoly_danilevski.inl
deleted file mode 100644
index d9265ee..0000000
--- a/linbox/ffpack/ffpack_charpoly_danilevski.inl
+++ /dev/null
@@ -1,79 +0,0 @@
-//* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* ffpack/ffpack_charpoly_danilevski.inl
- * Copyright (C) 2005 Clement Pernet
- *
- * Written by Clement Pernet <Clement.Pernet at imag.fr>
- *
- * See COPYING for license information.
- */
-
-#ifndef MIN
-#define MIN(a,b) (a<b)?a:b
-#endif
-
-//---------------------------------------------------------------------
-// CharPoly: Compute the characteristic polynomial of A using 
-// Danilevski's algorithm.
-//---------------------------------------------------------------------
-
-template <class Field, class Polynomial>
-std::list<Polynomial>&
-FFPACK::Danilevski (const Field& F, std::list<Polynomial>& charp, 
-			    const size_t N, typename Field::Element * A, 
-			    const size_t lda){	
-	static typename Field::Element one, mone;
-	F.init(one, 1.0);
-	F.neg(mone, one);
-	charp.clear();
-	size_t dtot=0;
-	typename Field::Element *pivot,*e,*u1,invp;
-	for (size_t k=0; k<N; ++k){
-		size_t i = k+1; 
-		size_t d;
-		e = pivot = A + (k+1) * lda + k; // coef
-		while ((i<N) && F.isZero(*e)) { e += lda; i++; }
-		if (i < N){
-			if (i > k + 1) {
-				fswap (F, N-k, e, 1, pivot, 1);
-				fswap (F, N, A+i, lda, A+k+1, lda);
-			}
-			F.inv (invp, *pivot);
-			fscal (F, N-k-1, invp, pivot+1, 1);
-			fscal (F, N-dtot, *pivot, A+dtot*lda+k+1, lda);
-			// X <- X - uw
-			fger (F, k + 1-dtot, N - k -1, mone, 
-			      A + dtot*lda + k, lda, pivot+1, 1, 
-			      A+k+1+dtot*lda, lda);
-			if (k<N-2){
-				
-				// Y <- Y - vw
-				fger (F, N-k-2, N-k-1, mone, pivot+lda, lda, pivot+1, 1, 
-				      pivot+lda+1,lda);
-				//6
-				fgemv (F, FflasNoTrans, N-dtot, N-k-2, 
-				       one, A+dtot*lda+k+2, lda, pivot+lda, lda, one, 
-				       A+dtot*lda+k+1,lda);
-			}
-			//5
-			u1 = A+dtot*lda+k;
-			for (i = dtot; i <= k; ++i){
-				F.addin( *(u1+lda+1), *u1);
-				u1+=lda;
-			}
-		}
-		if (i==N){// completed one companion block
-			d = k+1-dtot;
-			typename Field::Element *Ai = A+k+dtot*lda;
-			Polynomial * P = new Polynomial(d+1);
-			for (i = 0; i < d; ++i){
-				F.neg (P->operator[](i), *(Ai+i*lda));
-			}
-			F.assign( (*P)[d], one);
-			charp.push_front(*P);
-			dtot+=d;
-		} 
-	}
-	return charp;
-}
-
diff --git a/linbox/ffpack/ffpack_charpoly_kgfast.inl b/linbox/ffpack/ffpack_charpoly_kgfast.inl
deleted file mode 100644
index 0f42b07..0000000
--- a/linbox/ffpack/ffpack_charpoly_kgfast.inl
+++ /dev/null
@@ -1,218 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* ffpack/ffpack_charpoly_kgfast.inl
- * Copyright (C) 2004 Clement Pernet
- *
- * Written by Clement Pernet <Clement.Pernet at imag.fr>
- *
- * See COPYING for license information.
- */
-
-#ifndef MIN
-#define MIN(a,b) (a<b)?a:b
-#endif
-
-//---------------------------------------------------------------------
-// CharPoly: Compute the characteristic polynomial of A using 
-// Keller-Gehrig's fast algorithm. A must be generic.
-//---------------------------------------------------------------------
-
-template <class Field, class Polynomial>
-int
-FFPACK::KGFast ( const Field& F, std::list<Polynomial>& charp, 
-			   const size_t N,
-			   typename Field::Element * A, const size_t lda,
-			   size_t * kg_mc, size_t* kg_mb, size_t* kg_j ){
-	
-	//std::cerr<<"Dans KGFast"<<std::endl;
-	static typename Field::Element one, zero, mone;
-	F.init(one, 1.0);
-	F.neg(mone, one);
-	F.init(zero, 0.0);
-	size_t mc=N>>1; // Matrix A is transformed into a mc_Frobenius form
-        size_t mb=N-mc;
-	size_t r;
-	typename Field::Element * C, *B;
-
-	
-	while ( mc > 0 ) {
-// 		std::cerr<<"Boucle1: mc,mb,N="<<mc<<" "<<mb<<" "<<N<<std::endl;
-// 		write_field( F, std::cerr, A, N, N, lda );
-		size_t j=0;
-		C = A + (N-mc);
-		//std::cerr<<std::endl<<"mc="<<mc<<":";
-		while ( (j+1)*mc < N ) {
-			mb = MIN ( mb, N-(j+1)*mc );
-// 			std::cerr<<"Boucle2: j,mb="<<j<<" "<<mb<<std::endl;
-// 			write_field( F, std::cerr, A, N, N, lda );
-			B = A + (N-mc-mb);
-		
-			// B1 <- C1^-1.B1
-			typename Field::Element * LUP = new typename Field::Element[mc*mc];
-			for (size_t i=0; i<mc; ++i)
-				fcopy( F, mc, LUP+i*mc, 1, C+i*lda, 1);
-			size_t * P = new size_t[mc];
-			size_t * Q = new size_t[mc];
-
-			if ( (r = LUdivine( F, FflasNonUnit, FflasNoTrans, mc, mc, 
-					    LUP, mc, P, Q, FfpackLQUP)) < mc ){
-				* kg_mc = mc;
-				* kg_mb = mb;
-				* kg_j = j;
-				delete[] P;
-				delete[] Q;
-				delete[] LUP;
-				return -1;
-
-			}
-// 			std::cerr<<"LUP="<<std::endl;
-// 			write_field( F, std::cerr, LUP, mc, mc, mc );
-                        //std::cerr<<" "<<r;
-			ftrsm(F, FflasLeft, FflasLower, FflasNoTrans, FflasUnit,
-			      mc, mb, one, LUP, mc , B, lda);
-			ftrsm(F, FflasLeft, FflasUpper, FflasNoTrans, FflasNonUnit, 
-			      mc, mb, one, LUP, mc , B, lda);
-			delete[] LUP;
-			applyP( F, FflasLeft, FflasTrans, mb, 0, mc, B, lda, P );
-			
-			delete[] P;
-			delete[] Q;
-// 			std::cerr<<"Apres B1<-C1^-1"<<std::endl;
-// 			write_field( F, std::cerr, A, N, N, lda );
-                        
-			// B2 <- B2 - C2.B1
-			fgemm(F, FflasNoTrans, FflasNoTrans, N-mc, mb, mc, 
-			      mone, C+mc*lda, lda, B, lda, 
-			      one, B+mc*lda, lda);
-
-// 			std::cerr<<"Apres B2<-B2-C2.B1"<<std::endl;
-//                         write_field( F, std::cerr, A, N, N, lda );
-
-			// Shifting B: B1;B2 -> B2;B1
-			typename Field::Element * tmp = new typename Field::Element[mc*mb];
-			for (size_t i=0; i<mc; ++i)
-				fcopy( F, mb, tmp+i*mb, 1, B+i*lda, 1);
-			for (size_t i=mc; i<N; ++i)		
-				fcopy( F, mb, B+(i-mc)*lda, 1, B+i*lda, 1);
-			for (size_t i=0; i<mc; ++i)
-				fcopy( F, mb, B+(i+N-mc)*lda, 1, tmp+i*mb, 1);
-			delete[] tmp;
-// 			std::cerr<<"Apres shift de B"<<std::endl;
-//                         write_field( F, std::cerr, A, N, N, lda );
-
-			
-			// C3 <- B3.C1 + C3
-			fgemm(F, FflasNoTrans, FflasNoTrans, (j+1)*mc, mc, mb, 
-			      one, B+(N-(j+1)*mc)*lda, lda, C+(N-(j+1)*mc-mb)*lda, lda,
-			      one, C+(N-(j+1)*mc)*lda, lda);
-			// std::cerr<<"C3 <- B3.C1 + C3: B3="<<std::endl;
-//                         write_field( F, std::cerr, B+(N-(j+1)*mc)*lda, (j+1)*mc, mb, lda );
-// 			std::cerr<<"C3 <- B3.C1 + C3: C1"<<std::endl;
-//                         write_field( F, std::cerr,  C+(N-(j+1)*mc-mb)*lda, mb, mc, lda );
-// 			std::cerr<<"C3 <- B3.C1 + C3: C3="<<std::endl;
-//                         write_field( F, std::cerr, C+(N-(j+1)*mc)*lda, (j+1)*mc, mc, lda );
-
-			int lambda = N - mb - (j+1)*mc;
-			if ( int(mb) < lambda ){
-
-// 				std::cerr<<"mb<lambda"<<std::endl;
-				typename Field::Element * tmp = new typename Field::Element[lambda*mc];
-
-				// tmp <- C1
-				for (int i=0; i<lambda; ++i)
-					fcopy( F, mc, tmp+i*mc, 1, C+i*lda, 1);	
-				
-				// C1' <- B1.C2
-				fgemm(F, FflasNoTrans, FflasNoTrans, mb, mc, mb, 
-				      one, B, lda, C+lambda*lda, lda,
-				      zero, C, lda);
-
-				// tmp <- B2.C2 + tmp
-				fgemm(F, FflasNoTrans, FflasNoTrans, lambda, mc, mb, 
-				      one, B+mb*lda, lda, C+lambda*lda, lda,
-				      one, tmp, mc);
-				
-				// C2' <- tmp
-				for (int i=0; i<lambda; ++i)
-					fcopy( F, mc, C+mb*lda+i*lda, 1, tmp+i*mc, 1);	
-				delete[] tmp;
-			}
-			else if ( lambda > 0 ){
-// 				std::cerr<<"lambda>0"<<std::endl;
-                                
-				typename Field::Element * tmp = new typename Field::Element[mb*mc];
-				// C1 <- B2.C2 + C1
-				fgemm(F, FflasNoTrans, FflasNoTrans, lambda, mc, mb, 
-				      one, B+mb*lda, lda, C+lambda*lda, lda,
-				      one, C, lda);
-
-				// tmp <-B1.C2
-				fgemm(F, FflasNoTrans, FflasNoTrans, mb, mc, mb, 
-				      one, B, lda, C+lambda*lda, lda,
-				      zero, tmp, mc);
-				
-				// C2' <- C1
-				for (int i=0; i<lambda; ++i)
-					fcopy( F, mc, C+mb*lda+i*lda, 1, C+i*lda, 1);
-
-				// C1' <- tmp
-				for (size_t i=0; i<mb; ++i)
-					fcopy( F, mc, C+i*lda, 1, tmp+i*mc, 1);
-				delete[] tmp;
-			}
-			else{
-// 				std::cerr<<"lambda<0"<<std::endl;
-				mb = N - (j+1)*mc;
-				typename Field::Element * tmp = new typename Field::Element[mb*mc];
-
-				// tmp <-B1.C1
-				fgemm(F, FflasNoTrans, FflasNoTrans, mb, mc, mb, 
-				      one, B, lda, C, lda,
-				      zero, tmp, mc);
-
-				// C1' <- tmp
-				for (size_t i=0; i<mb; ++i)
-					fcopy( F, mc, C+i*lda, 1, tmp+i*mc, 1);
-				delete[] tmp;
-			}
-			
-			j++;
-		}
-		mb = mc;
-	        mc>>=1;
-		mb -= mc;
-	}
-
-	Polynomial *minP = new Polynomial();
-	minP->resize(N+1);
-	minP->operator[](N) = one;
-	typename Polynomial::iterator it = minP->begin();
-	for (size_t j=0; j<N; ++j, it++){
-		F.neg(*it, *(A+N-1+j*lda));
-	}
-	charp.clear();
-	charp.push_front(*minP);
-	return 0;
-}
-
-template<class Field>
-void 
-FFPACK::fgemv_kgf( const Field& F,  const size_t N, 
-			     const typename Field::Element * A, const size_t lda,
-			     const typename Field::Element * X, const size_t incX,
-			     typename Field::Element * Y, const size_t incY, 
-			     const size_t kg_mc, const size_t kg_mb, const size_t kg_j ){
-
-	typename Field::Element one, zero;
-	F.init(one, 1.0);
-	F.init(zero, 0.0);
-	size_t lambda = MAX(N-kg_mb-kg_mc*(kg_j+1),0);
-	// Y1 <- X2
-	fcopy ( F, lambda, Y, incY, X+(kg_mb+kg_mc)*incX, incX );
-	// Y2 <- X.B
-	fgemv( F, FflasTrans, N, kg_mb, one, A+N-kg_mc-kg_mb, lda, X, incX, zero, Y+lambda*incY, incY );
-	// Y3 <- X3
-	fcopy ( F, kg_j*kg_mc, Y+(lambda+kg_mb)*incY, incY, X+(lambda+kg_mb+kg_mc)*incX, incX );
-	// Y4 <- X.C
-	fgemv( F, FflasTrans, N, kg_mc, one, A+N-kg_mc, lda, X, incX, zero, Y+(N-kg_mc)*incY, incY );
-}
diff --git a/linbox/ffpack/ffpack_charpoly_kgfastgeneralized.inl b/linbox/ffpack/ffpack_charpoly_kgfastgeneralized.inl
deleted file mode 100644
index c9c6b25..0000000
--- a/linbox/ffpack/ffpack_charpoly_kgfastgeneralized.inl
+++ /dev/null
@@ -1,595 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* linbox/ffpack/ffpack_charpoly_kgfast.inl
- * Copyright (C) 2004 Clement Pernet
- *
- * Written by Clement Pernet <Clement.Pernet at imag.fr>
- *
- * See COPYING for license information.
- */
-
-#ifndef MIN
-#define MIN(a,b) (a<b)?a:b
-#endif
-
-//#define DEBUG 0
-//---------------------------------------------------------------------
-// CharPoly: Compute the characteristic polynomial of A using 
-// Keller-Gehrig's fast algorithm. 
-//---------------------------------------------------------------------
-
-template <class Field>
-void printA(const Field& F,
-	    std::ostream& os,
-	    const typename Field::Element * E,
-	    const typename Field::Element * C, 
-	    const size_t lda,
-	    const size_t*B, 
-	    const size_t*T, 
-	    const size_t me,const size_t mc, const size_t lambda, const size_t mu){
-	
-	typename Field::Element * A = buildMatrix(F,E,C,lda,B,T,me,mc,lambda,mu);
-	size_t N = mc+me+lambda+mu;
-	write_field(F,os,A,N,N,N);
-	delete[] A;
-}
-
-template <class Field>
-typename Field::Element * buildMatrix (const Field& F,
-				       const typename Field::Element * E,
-				       const typename Field::Element * C, 
-				       const size_t lda,
-				       const size_t*B, 
-				       const size_t*T, 
-				       const size_t me,
-				       const size_t mc, 
-				       const size_t lambda, 
-				       const size_t mu){
-	
-	typename Field::Element zero,one;
-	F.init (zero,0UL);
-	F.init (one,1UL);
-	size_t N = mc+me+lambda+mu;
-	typename Field::Element * A = new typename Field::Element[N*N];
-	for (size_t j=0; j<lambda+me;++j)
-		if (B[j] < N){
-			for (size_t i=0;i<N;++i)
-				F.assign( *(A+i*N+j),zero);
-			F.assign( *(A+B[j]*lda+j), one);
-		} else {
-			FFLAS::fcopy (F, N, A+j, N, E+B[j]-N, lda);
-		}
-	for (size_t j=lambda+me; j<lambda+me+mu; ++j)
-		for (size_t i=0;i<N;++i)
-			F.assign( *(A+i*N+j),zero);
-	for (size_t i=0; i<mu; ++i)
-		F.assign( *(A+(lambda+me+mc+i)*lda+lambda+me+T[i]), one);
-	for (size_t j=0; j<mc; ++j)
-		FFLAS::fcopy(F,N,A+N-mc+j,N,C+j,lda);
-	return A;
-}
-
-template <class Field, class Polynomial>
-std::list<Polynomial>&
-FFPACK::KGFast_generalized (const Field& F, std::list<Polynomial>& charp, 
-			    const size_t N,
-			    typename Field::Element * A, const size_t lda){
-	
-	//std::cerr<<"Dans KGFast"<<std::endl;
-	static typename Field::Element one, zero, mone;
-	F.init(one, 1UL);
-	F.neg(mone, one);
-	F.init(zero, 0UL);
-	size_t mc=N>>1; // Matrix A is transformed into a mc_Frobenius form
-	size_t me=N-mc;
-	// B[i] = j, the row of the 1 if the col Ai is sparse; 
-	// B[i] = n+k, if the col Ai is the kth col of E
-	size_t * B = new size_t[N];
-	bool * allowedRows = new bool[N];
-	for (size_t i=0;i<(N+1)/2;++i) 
-		allowedRows[i]=true;
-	// T[i] = j si T_i,j = 1
-	size_t * T = new size_t[N];
-	for (size_t i=0;i<N;++i) 
-		T[i]=i;
-	size_t lambda=0;
-	
-	typename Field::Element * C, *E = A;
-#if DEBUG
-	std::cerr<<"Debut KGFG"<<std::endl
-	  <<" ----------------------------"<<std::endl;
-#endif
-	while (mc > 0) {
-#if DEBUG
- 		std::cerr<<"Boucle1: mc,me,lambda="<<mc<<" "<<me<<" "<<lambda<<std::endl;
-		// 		write_field (F, std::cerr, A, N, N, lda);
-#endif
-		size_t mu=0;
-		C = A + (N-mc);
-		for (size_t i = 0; i<me;++i)
-			B[lambda+i] = N+i;
-#if DEBUG
-		for (size_t i=0;i<lambda+me;++i)
-			std::cerr<<"B["<<i<<"] = "<<B[i]<<std::endl;
-		//std::cerr<<std::endl<<"mc="<<mc<<":";
-#endif
-		while (mu < N-mc) {
-#if DEBUG
- 			std::cerr<<"Boucle2: mu,me,lambda="<<mu<<" "<<me<<" "<<lambda<<std::endl;
-			printA(F,std::cerr<<"A="<<std::endl,E,C,lda,B,T,me,mc,lambda,mu);
-
-			// B1 <- C1^-1.B1
-			std::cerr<<"Forming LUP";
-#endif
-			size_t ncols = ((mu==0)||(mc<=mu))?mc:mc-mu;
-			typename Field::Element * LUP = new typename Field::Element[(lambda+me)*ncols];
-			for (size_t i=0;i < lambda + me; ++i)
-				if (allowedRows[i])
-					fcopy (F, ncols, LUP+i*ncols, 1, C+i*lda, 1);
-				else
-					for (size_t j = 0; j < ncols; ++j)
-						F.assign (*(LUP+i*ncols+j), zero);
-#if DEBUG
-			std::cerr<<"..done"<<std::endl;
-			write_field (F,std::cerr<<"LUP="<<std::endl,LUP,lambda+me,ncols,ncols);
-			std::cerr<<"LQUP(C1)";
-#endif
-			size_t * P = new size_t[ncols];
-			size_t * Q = new size_t[lambda+me];
-			for (size_t i=0; i<ncols;++i)
-				P[i]=0;
-			for (size_t i=0; i<lambda+me;++i)
-				Q[i]=0;
-
-			size_t r = LUdivine (F, FflasNonUnit, FflasNoTrans, lambda + me, ncols, LUP, ncols, 
-					   P, Q, FfpackLQUP);
-#if DEBUG
-			std::cerr<<"..done"<<std::endl;
-#endif
-
-			if (r==0){
-				if ((lambda == 0) && (ncols == mc)){
-					std::cerr<<"BLOCAGE lambda=0!!!"<<std::endl;
-					//Rec call on the leading block
-					KGFast_generalized (F, charp, me, A, lda);
-					
-					//Rec call on the trailing block
-					typename Field::Element * At = buildMatrix(F,E,C,lda,B,T,me,mc,lambda,mu);
-					KGFast_generalized (F, charp, N-me, At+me*(lda+1), lda);
-					delete[] At;
-					exit(-1);
-
-				} else if (me != 0) {
-					std::cerr<<"BLOCAGE me!=0!!!"<<std::endl;
-					exit(-1);
-								
-				}
-				else {
-					for (int i=mu; i>=0; --i)
-						T[i+lambda] = T[i]+lambda;
-					for (size_t i=0; i< lambda; ++i)
-						T[B[i]-mc-1] = i;
-					mu += lambda;
-					lambda = 0;
-					break;
-				}
-				//std::cerr<<"BLOCAGE !!!"<<std::endl;
-				//exit(-1);
-			}
-
-#if DEBUG
-			std::cerr<<"Forming genreric rank profil C1";
-			// form the generic rank profil block C1 Q^TPAP^TQ
-			for (size_t i=0;i<r;++i)
-				std::cerr<<"P["<<i<<"] = "<<P[i]<<std::endl;
-#endif
-			applyP (F, FflasRight, FflasTrans, N, 0, r, C, lda, P);
-#if DEBUG
-			std::cerr<<".";
-#endif
-			//printA(F,cerr<<"A="<<std::endl,E,C,lda,B,T,me,mc,lambda,mu);
-			// (E, C) <- P(E, C)
-			applyP (F, FflasLeft, FflasNoTrans, me, 0, r, E+(N-mc)*lda, lda, P);
-#if DEBUG
-			std::cerr<<".";
-			//printA(F,std::cerr<<"A="<<std::endl,E,C,lda,B,T,me,mc,lambda,mu);
-#endif
-			applyP (F, FflasLeft, FflasNoTrans, mc, 0, r, C+(N-mc)*lda, lda, P);
-#if DEBUG
-			std::cerr<<".";
-#endif
-			//printA(F,std::cerr<<"A="<<std::endl,E,C,lda,B,T,me,mc,lambda,mu);
-			// T <- P T
-
-			// !!!!!!!Attention -> ajouter le traitement du cas 0<mu<mc
-			for (size_t k = 0; k<r; ++k)
-				if (P[k] > (size_t) k){
-					if ((mu>=mc-k)){
-#if DEBUG
-						std::cerr<<"// on permute LN-mc+k et L_N-mc+P[k]"<<std::endl;
-#endif
-						size_t tmp = T[mu-mc+k];
-						T[mu-mc+k] = T[mu-mc+P[k]];
-						T[mu-mc+P[k]] = tmp;
-					}
-					else if (mu){
-						std::cerr<<"CAS MU < MC - k"<<std::endl;
-						exit(-1);
-					}
-					// Updating B to be improved (tabulated B^-1)
-					for (size_t i=0; i<lambda+me; ++i){
-						if (B[i] == N-mc+k)
-							B[i] = N-mc+P[k];
-						else if (B[i] == N-mc+P[k])
-							B[i] = N-mc+k;
-					}
-					
-				}
-#if DEBUG
-			std::cerr<<".";
-			//printA(F,std::cerr<<"A="<<std::endl,E,C,lda,B,T,me,mc,lambda,mu);
-#endif
-
-			// (E, C) <- Q^T(E, C) 
-			applyP (F, FflasLeft, FflasTrans, me, 0, r, E, lda, Q);
-#if DEBUG
-			std::cerr<<".";
-			//printA(F,std::cerr<<"A="<<std::endl,E,C,lda,B,T,me,mc,lambda,mu);
-#endif
-			applyP (F, FflasLeft, FflasTrans, mc, 0, r, C, lda, Q);
-#if DEBUG
-			std::cerr<<".";
-#endif
-			// F <- Q^T F
-			size_t * tempP = new size_t[lambda+me+mc];
-			for (size_t i=0; i< lambda+me+mc; ++i)
-				tempP[i] = i;
-			for (int i = r-1; i>=0; --i)
-				if (Q[i] > (size_t) i){
-#if DEBUG
-					std::cerr<<"Permutation de tempP["<<i
-					    <<"] et tempP["<<Q[i]<<"]"<<std::endl;
-#endif
-					// on permute LN-mc+k et L_N-mc+P[k]
-					size_t tmp = tempP[i];
-					tempP[i] = tempP[Q[i]];
-					tempP[Q[i]] = tmp;
-				}
-				
-#if DEBUG
-			std::cerr<<".";
-#endif
-			for (size_t i=0; i < lambda+me; ++i)
-				if (B[i] < N)
-					B[i] = tempP[B[i]];
-#if DEBUG
-			std::cerr<<".";
-#endif
-			delete[] tempP;
-
-#if DEBUG
-			std::cerr<<std::endl<<"Avant B<-BQ"<<std::endl;
-			for (size_t i=0; i<lambda+me;++i)
-				std::cerr<<"B["<<i<<"] = "<<B[i]<<std::endl;
-#endif
-			// B <- B Q
-			for (int k = r-1; k>=0; --k)
-				if (Q[k] > (size_t) k){
-					// on permute Ck et C_Q[k]
-					size_t tmp = B[k];
-					B[k] = B[Q[k]];
-					B[Q[k]] = tmp;
-				}
-#if DEBUG
-			std::cerr<<"Apres"<<std::endl;
-			for (size_t i=0; i<lambda+me;++i)
-				std::cerr<<"B["<<i<<"] = "<<B[i]<<std::endl;
-
-			std::cerr<<".";
-#endif
-
-			// grouping the bloc L in LUP
-			for (size_t i=0; i<r; ++i)
-				if (Q[i]>i)
-					fcopy(F, i, LUP+i*mc, 1, LUP+Q[i]*mc,1);
-#if DEBUG
-			std::cerr<<"..done"<<std::endl;
-			
-			printA(F,std::cerr<<"A="<<std::endl,E,C,lda,B,T,me,mc,lambda,mu);
-
-
-// 			std::cerr<<"LUP="<<std::endl;
-// 			write_field (F, std::cerr, LUP, mc, mc, mc);
-            //std::cerr<<" "<<r;
-
-			// E'1 <- C11^-1 E1
-			std::cerr<<"// E'1 <- C11^-1 E1";
-#endif
-
-			ftrsm(F, FflasLeft, FflasLower, FflasNoTrans, FflasUnit,
-			   r, me, one, LUP, mc , E, lda);
-			ftrsm(F, FflasLeft, FflasUpper, FflasNoTrans, FflasNonUnit, 
-			   r, me, one, LUP, mc , E, lda);
-#if DEBUG
-			std::cerr<<"..done"<<std::endl;
-			printA(F,std::cerr<<"A="<<std::endl,E,C,lda,B,T,me,mc,lambda,mu);
-
-			// C'12 <- C11^-1 C12 
-			std::cerr<<"// C'12 <- C11^-1 C12"; 
-#endif
-			ftrsm(F, FflasLeft, FflasLower, FflasNoTrans, FflasUnit,
-			   r, mc-r, one, LUP, mc , C+r, lda);
-			ftrsm(F, FflasLeft, FflasUpper, FflasNoTrans, FflasNonUnit, 
-			   r, mc-r, one, LUP, mc , C+r, lda);
-			delete[] LUP;
-			delete[] P;
-			delete[] Q;
-#if DEBUG
-			std::cerr<<"..done"<<std::endl;
-			printA(F,std::cerr<<"A="<<std::endl,E,C,lda,B,T,me,mc,lambda,mu);
-#endif
-
-// 			std::cerr<<"Apres B1<-C1^-1"<<std::endl;
-// 			write_field (F, std::cerr, A, N, N, lda);
-            
-			// E'2 <- E2 - C21.E'1
-#if DEBUG
-			std::cerr<<"// E'2 <- E2 - C21.E'1";
-#endif
-			fgemm(F, FflasNoTrans, FflasNoTrans, N-r, me, r, 
-			   mone, C+r*lda, lda, E, lda, 
-			   one, E+r*lda, lda);
-#if DEBUG
-			std::cerr<<"..done"<<std::endl;			
-			printA(F,std::cerr<<"A="<<std::endl,E,C,lda,B,T,me,mc,lambda,mu);
-			// C'22 <- C22 - C21.C'12
-			std::cerr<<"// C'22 <- C22 - C21.C'12";
-#endif
-			fgemm(F, FflasNoTrans, FflasNoTrans, N-r, mc-r, r, 
-			   mone, C+r*lda, lda, C+r, lda, 
-			   one, C+r*(lda+1), lda);
-#if DEBUG
-			std::cerr<<"..done"<<std::endl;
-			printA(F,std::cerr<<"A="<<std::endl,E,C,lda,B,T,me,mc,lambda,mu);
-			
-// 			std::cerr<<"Apres B2<-B2-C2.B1"<<std::endl;
-//             write_field (F, std::cerr, A, N, N, lda);
-
-			// Shifting E: E1;E2 -> E2;E1
-			std::cerr<<"// Shifting E: E1;E2 -> E2;E1";
-#endif
-			typename Field::Element * tmp = new typename Field::Element[r*me];
-			for (size_t i=0; i<r; ++i)
-				fcopy (F, me, tmp+i*me, 1, E+i*lda, 1);
-			for (size_t i=r; i< N; ++i)		
-				fcopy (F, me, E+(i-r)*lda, 1, E+i*lda, 1);
-			for (size_t i=0; i<r; ++i)
-				fcopy (F, me, E+(i+N-r)*lda, 1, tmp+i*me, 1);
-			delete[] tmp;
-#if DEBUG
-			std::cerr<<"..done"<<std::endl;
-
-			// Shifting C_{*,2}: C_{1,2};C_{2,2} -> C_{2,2};C_{1,2}
-			std::cerr<<"// Shifting C_{*,2}: C_{1,2};C_{2,2} -> C_{2,2};C_{1,2}";
-#endif
-			tmp = new typename Field::Element[r*(mc-r)];
-			for (size_t i=0; i<r; ++i)
-				fcopy (F, mc-r, tmp+i*(mc-r), 1, C+r+i*lda, 1);
-			for (size_t i=r; i< N; ++i)		
-				fcopy (F, mc-r, C+r+(i-r)*lda, 1, C+r+i*lda, 1);
-			for (size_t i=0; i<r; ++i)
-				fcopy (F, mc-r, C+r+(i+N-r)*lda, 1, tmp+i*(mc-r), 1);
-			delete[] tmp;
-#if DEBUG
-			std::cerr<<"..done"<<std::endl;
-			
-			printA(F,std::cerr<<"A="<<std::endl,E,C,lda,B,T,me,mc,lambda,mu);
-
-// 			std::cerr<<"Apres shift de B"<<std::endl;
-//             write_field (F, std::cerr, A, N, N, lda);
-
-			// C'2 <- T C2
-			std::cerr<<"// C'2 <- T C2";
-#endif
-			// To be improved!!!
-			tmp = new typename Field::Element[mu*r];
-			typename Field::Element * C2 = C+(N-mu-mc)*lda;
-			for (size_t i=0; i<mu; ++i)
-				fcopy (F, r, tmp+i*r, 1, C2+T[i]*lda, 1); 
-			for (size_t i=0; i<mu; ++i)
-				fcopy (F, r, C2+i*lda, 1, tmp+i*r, 1); 
-			delete[] tmp;
-#if DEBUG
-			std::cerr<<"..done"<<std::endl;
-			
-			// [C'2;C'3] += [E2;E3].C 
-			std::cerr<<"// [C'2;C'3] += [E2;E3].C";
-#endif
-			tmp = new typename Field::Element[me*r];
-			for (size_t i=0; i<lambda+me; ++i)
-				if (B[i] >= N){
-					fcopy (F, r, tmp+(B[i]-N)*r, 1, C+i*lda, 1);
-				}
-			fgemm (F, FflasNoTrans, FflasNoTrans, mu + r, r, me, 
-			    one, E+(N-mu-r)*lda, lda, tmp, r,
-			    one, C+(N-mu-mc)*lda, lda);
-
-			delete[] tmp;
-#if DEBUG
-			std::cerr<<"..done"<<std::endl;
-
-			// shifting [C'2;C'3]
-			std::cerr<<"// shifting [C'2;C'3]";
-#endif
-			tmp = new typename Field::Element[(mc-r)*r];
-			typename Field::Element * C4 = C + (N-mc+r)*lda;
-			for (size_t i=0; i < (mc-r); ++i){
-				fcopy (F, r, tmp+i*r, 1, C4 + i*lda, 1);
-			}
-			for (int i = N-1; i >= (int) (N -mu-r); --i)
-				fcopy (F, r, C+i*lda, 1, C+(i-mc+r)*lda, 1);
-#if DEBUG
-			std::cerr<<"..done"<<std::endl;
-
-			printA(F,std::cerr<<"A="<<std::endl,E,C,lda,B,T,me,mc,lambda,mu);
-			
-
-			// tmp2 <- C'1 (the rows corresponding to E)
-			std::cerr<<"// tmp2 <- C'1 (the rows corresponding to E)";
-#endif
-			typename Field::Element * tmp2 = new typename Field::Element[me*r];
-			for (size_t i = 0; i < lambda+me; ++i)
-				if (B[i] >= N){
-#if DEBUG
-					std::cerr<<"saving in row "<<B[i]-N<<std::endl;
-#endif
-					fcopy (F, r, tmp2+(B[i]-N)*r, 1, C+i*lda, 1);
-				}
-#if DEBUG
-			std::cerr<<"..done"<<std::endl;
-
-			// C'_F[i] <- C_i
-			std::cerr<<"// C'_F[i] <- C_i";
-			std::cerr<<"lambda,r,me = "<<lambda<<" "<<r<<" "<<me<<std::endl;
-#endif
-			typename Field::Element * tmp3 = new typename Field::Element[(lambda+me)*r];
-
-			for (size_t i = 0; i < lambda+me; ++i)
-				if (B[i] < N){
-#if DEBUG
-					std::cerr<<"copie de la ligne "<<i<<std::endl;
-#endif
-					fcopy (F, r, tmp3 + i*r, 1, C + i*lda, 1);
-				}
-#if DEBUG
-			std::cerr<<"1"<<std::endl;
-#endif
-			for (size_t i = 0; i < N-mu-r; ++i)
-				for (size_t j = 0; j < r; ++j)
-					F.assign (*(C+i*lda+j), zero);
-#if DEBUG
-			std::cerr<<"2"<<std::endl;
-#endif
-			for (size_t i = 0; i < lambda+me; ++i){
-#if DEBUG
-				std::cerr<<"B["<<i<<"] = "<<B[i]<<std::endl;
-#endif
-				if (B[i] < N)
-					fcopy (F, r, C+(B[i]-r)*lda, 1, tmp3+i*r, 1);
-			}
-#if DEBUG
-			std::cerr<<"3"<<std::endl;
-#endif
-			delete[] tmp3;
-#if DEBUG
-			std::cerr<<"..done"<<std::endl;
- 
-			printA(F,std::cerr<<"A="<<std::endl,E,C,lda,B,T,me,mc,lambda,mu);
-
-			// C'1 += E1 tmp2
-			std::cerr<<"// C'1 += E1 tmp2";
-#endif
-			fgemm(F, FflasNoTrans, FflasNoTrans, N-mu-r, r, me, 
-			   one, E, lda, tmp2, r, one, C, lda);
-			delete[] tmp2;
-#if DEBUG
-			std::cerr<<"..done"<<std::endl;
- 
-			printA(F,std::cerr<<"A="<<std::endl,E,C,lda,B,T,me,mc,lambda,mu);
-
-			// C'_1 += C_2 C4
-			std::cerr<<"// C'_1 += C_2 C4";
-#endif
-			fgemm(F, FflasNoTrans, FflasNoTrans, N, r, mc-r, 
-			   one, C+r, lda, tmp, r, one, C, lda);
-			delete[] tmp;
-#if DEBUG
-			std::cerr<<"..done"<<std::endl;
-
-			printA(F,std::cerr<<"A="<<std::endl,E,C,lda,B,T,me,mc,lambda,mu);
-
-			// switching C_1 <-> C_2
-			std::cerr<<"// switching C_1 <-> C_2";
-#endif
-			tmp = new typename Field::Element[N*r];
-			for (size_t j = 0; j<r; ++j)
-				fcopy (F, N, tmp+j, r, C+j, lda);
-			for (size_t j = r; j<mc; ++j)
-				fcopy (F, N, C+j-r, lda, C+j, lda);
-			for (size_t j = 0; j<r; ++j)
-				fcopy (F, N, C+mc-r+j, lda, tmp+j, r);
-			delete[] tmp;
-#if DEBUG
-			std::cerr<<"..done"<<std::endl;
-
-			
-			printA(F,std::cerr<<"A="<<std::endl,E,C,lda,B,T,me,mc,lambda,mu);
-
-			
-			// update the datastructure:
-			std::cerr<<"// update the datastructure:";
-#endif
-			mu += r;
-			tmp2 = new typename Field::Element[N*me];
-			size_t nlambda= 0, nme=0;
-			for (size_t i=0;i<lambda+me;++i)
-				allowedRows[i]=true;
-			for (size_t j=r; j < lambda + me; ++j){
-				if (B[j] >= N){
-#if DEBUG
-					std::cerr<<"B["<<j-r<<"] = "<<N+nme<<std::endl;
-#endif
-					fcopy (F, N, tmp2+nme, me, E+(B[j]-N), lda);
-					B[j-r] = N + nme;
-					nme++;
-				} else {
-#if DEBUG
-					std::cerr<<"B["<<j-r<<"] = "<<B[j]<<std::endl;
-#endif
-					B[j-r] = B[j]-r;
-					allowedRows[B[j]-r] = false;
-					nlambda++;
-				}
-			}
-			for (size_t j=0; j<nme; ++j)
-				fcopy (F, N, E+j, lda, tmp2+j, me);
-			lambda = nlambda;
-			me = nme;
-#if DEBUG
-			std::cerr<<"..done"<<std::endl;
-#endif
-			delete[] tmp2;
-		}
-		// update the datastructure: F <- T
-		for (size_t i=0; i<mu; ++i){
-#if DEBUG
-			std::cerr<<"B[T["<<i<<"]] = "<<"B["<<T[i]<<"] = "<<mc+i<<std::endl;
-#endif
-
-			B[T[i]] = mc+i;
-			T[i]=i;
-		}
-		E=C;
-		me = mc;
-		mc>>=1;
-		me -= mc;
-		lambda = mu;
-		for (size_t i=0;i<me+mc;++i)
-			allowedRows[i]=true;
-		for (size_t i=me+mc;i<lambda+me+mc;++i)
-			allowedRows[i]=false;
-		
-	}
-
-	Polynomial *minP = new Polynomial();
-	minP->resize(N+1);
-	minP->operator[](N) = one;
-	typename Polynomial::iterator it = minP->begin();
-	for (size_t j=0; j<N; ++j, it++){
-		F.neg(*it, *(A+N-1+j*lda));
-	}
-	charp.clear();
-	charp.push_front(*minP);
-	return charp;
-}
-
diff --git a/linbox/ffpack/ffpack_charpoly_kglu.inl b/linbox/ffpack/ffpack_charpoly_kglu.inl
deleted file mode 100644
index 5d31b47..0000000
--- a/linbox/ffpack/ffpack_charpoly_kglu.inl
+++ /dev/null
@@ -1,248 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* ffpack/ffpack_charpoly_kglu.inl
- * Copyright (C) 2005 Clement Pernet
- *
- * Written by Clement Pernet <Clement.Pernet at imag.fr>
- *
- * See COPYING for license information.
- */
-
-template<class Field>
-size_t FFPACK::updateD(const Field& F, size_t * d, size_t k,
-			       std::vector<std::vector<typename Field::Element> >& minpt){
-	size_t ind=0, i=0;
-	while(i<k){
-		if (d[i]){
-			if (ind<i){
-				d[ind] = d[i];
-				minpt[ind++] = minpt[i];
-			}
-			else ind++;
-		}
-		i++;
-	}
-	for (i=ind; i<k; ++i)
-		minpt[i].resize(0);
-	minpt.resize(ind);
-	return ind;
-}
-
-// Compute the new d after a LSP ( d[i] can be zero )
-template<class Field>
-size_t FFPACK::newD( const Field& F, size_t * d, bool& KeepOn, 
-			       const size_t l, const size_t N, 
-			       typename Field::Element * X,
-			       const size_t * Q,
-			       std::vector<std::vector<typename Field::Element> >& minpt){
-	typedef typename Field::Element elt;
-	//const elt * Xi = X; // Xi points to the begining of each block
-	elt *Li=X, *Xminp=X;
-	KeepOn = false;
-	size_t nr, s, i, j, jtot=0, dtot = 0, nrtot=0;
-	
-	for ( i=0; dtot<N; ++i){ // for each block
-		j = 0;
-		nr = s = ( d[i]==l )? 2*l : d[i];
-		if (s > N-dtot) 
-			s= N-dtot; 
-		nrtot += nr;
-		
-		while ( (Q[j+jtot] <nrtot) && (j+jtot<N) )
-			j++;
-		
-		Xminp = X+Q[j+jtot-1]*N+jtot+j ;
-		d[i] = j;
-		jtot+=j;
-		dtot += j;
-
-		if (j<nr){ 
-			minpt[i].resize(j);
-			ftrsv( F, FflasLower, FflasTrans, FflasUnit, 
-			       j, Li, N, Xminp-j+N,1);
-			elt* Xi = Xminp-j+N;
-			for (size_t ii = 0; ii<j; ++ii, ++Xi)
-				minpt[i][ii] = *Xi;
-		}
-		Li += nr*N+j;
-		if ( j==2*l )
-			KeepOn = true;
-	} // Invariant: sum(d[i],i=0..k-1) = n
-	
-	return i;
-}
-
-//---------------------------------------------------------------------
-// CharPoly: Compute the characteristic polynomial of A using 
-// Keller-Gehrig's algorithm
-//---------------------------------------------------------------------
-template <class Field, class Polynomial>
-std::list<Polynomial>&
-FFPACK::KellerGehrig( const Field& F, std::list<Polynomial>& charp, const size_t N,
-				const typename Field::Element * A, const size_t lda ){
-	
-	
-	typedef typename Field::Element elt;
-	const elt * Ai=A;
-	static elt one, zero;
-	elt * U = new elt[N*N];     // to store A^2^i
-	elt * B = new elt[N*N];     // to store A^2^i
-	elt * V = new elt[N*N];     // to store A^2^i.U
-	elt * X = new elt[2*N*N];   // to compute the LSP factorization
-	elt *Ui, *Uj, *Uk, *Ukp1, *Ukp1new, *Bi, *Vi, *Vk, *Xi=X, *Xj;
-	size_t * P = new size_t[N]; // Column Permutation for LQUP
-	size_t * Q = new size_t[2*N]; // Row Permutation for LQUP
-
-	size_t * d= new size_t[N];   // dimensions of Vect(ei, Aei...)
-	size_t * dv = new size_t[N];
-	size_t * dold = new size_t[N]; // copy of d
-	// vector of the opposite of the coefficient of computed minpolys
-	std::vector< std::vector< elt > > m(N); 
-	typename Polynomial::iterator it;
-	size_t i=0, l=1, j, k=N,  cpt, newRowNb, nrowX, ind;
-	bool  KeepOn;
-	F.init( one, 1.0);
-	F.init( zero, 0.0);
-
-	for ( i=0; i<N; ++i)
-		dv[i] = dold[i] = d[i] = 1;
-	
-	// Computing the first X: (e1; e1A^t; e2; e2A^t;...;en;enA^t)
-	for ( i=0, Ui=U, Vi=V, Bi=B; i<N; ++i, Ai -= N*lda-1  ){
-		for ( Xj=Xi, Uj=Ui; Xj<Xi+N; ++Xj, ++Uj){
-			F.assign(*Xj, zero);
-			F.assign(*Ui, zero);
-		}
-		F.assign(*(Ui+i), one);
-		F.assign(*(Xi+i), one);
-		while ( Xj<Xi+2*N) {
-			*(Bi++) = *(Xj++) = *(Vi++) = *Ai;
-			Ai+=lda;
-		}
-		Xi = Xj;
-		Ui = Uj;
-	}
-	
-	// step form elimination using LQUP factorization
-	for ( i=0;i<N;++i) 
-		P[i]=0;
-	for ( i=0;i<2*N;++i) 
-		Q[i]=0;
-	LUdivine( F, FflasNonUnit, FflasNoTrans, 2*N, N, X, N, P, Q, FfpackLQUP);
-	
-	k = newD( F,d, KeepOn, l, N, X, Q, m);
-	
-	while(KeepOn){ // Main loop, until each subspace dimension has been found
-		// Updating U:
-		Uk = U;
-		// Firstly, removing extra rows
-		for ( i = 0, cpt = 0; i<N; ++i){
-			if (d[i] < dold[i]){
-				Ukp1new = Uk + d[i]*N;  // new position of Uk+1
-				Ukp1 = Uk + dold[i]*N; // first row of Uk+1
-				Ui = Ukp1new;
-				Uj = Ukp1;
-				while ( Uj < U + N*N ){
-					for ( j=N; j; --j)
-						*(Ui++) = *(Uj++);
-				}
-				Uk = Ukp1new;
-				dold[i] = d[i];
-			}
-			else {
-				Uk += dold[i]*N;
-			}
-			cpt += d[i];
-		}
-
-		// Then inserting the duplicated blocks
-		Uk = U;
-		Vk = V;
-		for ( i = 0; i<k; ++i){
-			Ukp1 = Uk + dold[i]*N; // first row of Uk+1
-			newRowNb = d[i] - dold[i];
-			if ( newRowNb > 0){
-				Ui = U+N*N-1; // last row of U
-				Uj = U+(N-newRowNb)*N-1; // last row future pos
-				while ( Uj > Ukp1-1){
-					for ( j=N;j;--j)
-						*(Ui--) = *(Uj--);// moving block
-				}
-				Uj++;
-				Vi = Vk;
-				while ( Uj < Ukp1+N*newRowNb ){
-					for ( j=N;j;--j)
-						*(Uj++) = *(Vi++);
-				}
-			}
-			Uk = Uk + d[i]*N;
-			Vk += dv[i]*N;
-		}
-
-		// max block size of X, U, V is l=2^i
-		l*=2;
-		// B = A^2^i
-		fsquare( F, FflasNoTrans, N, one, B, N, zero, B, N );
-		// V = U.B^t
-		fgemm( F, FflasNoTrans, FflasNoTrans, N, N, N, one, 
-		       U, N, B, N, zero, V, N);		
-		// X = ( U1, V1, U2, V2, ... )
-		Xi = X; Ui = U; Vi = V;
-		ind=0; cpt=0; nrowX = 0;
-		while ( Vi < V + N*N ){
-			// Copying Uk
-			for ( i = d[ind]; i; --i, nrowX++){ 
-				for ( j = N; j; --j )
-					*(Xi++) = *(Ui++);
-			}
-			// Copying Vk
-			if ( d[ind] == l || ind==k-1 ){
-				cpt+=2*d[ind];
-				for ( i=d[ind]; i; i--, nrowX++)
-					for ( j=N; j; j--)
-						*(Xi++) = *(Vi++);
-			}
-			else{
-				cpt += d[ind];
-				Vi = Vi + N*d[ind];
-			}
-			ind++;
-		} 
-		// removes factors of degree 0 in m
-		k = updateD( F, d, k, m);
-		
-		for (i=0;i<k;++i)
-			dv[i] = dold[i] = d[i];
-		
-		// step form elimination of X using LSP
-		for ( i=0;i<N;++i) 
-			P[i]=0;
-		for ( i=0;i<2*N;++i) 
-			Q[i]=0;
-		LUdivine( F, FflasNonUnit, FflasNoTrans, nrowX, N, X, N, P, Q, FfpackLQUP);
-		
-		// Recompute the degrees of the list factors
-		k = newD(F, d, KeepOn, l, N, X,Q, m);
-	}
-	delete[] U;
-	delete[] V;
-	delete[] B;
-	delete[] P;
-	delete[] Q;
-	delete[] dv;
-	delete[] dold;
-	
-	k = updateD( F, d, k, m);
-	// Constructing the CharPoly
-	for ( i=0; i<k; ++i){
-		Polynomial * minP = new Polynomial(d[i]+1);
-		minP->operator[](d[i]) = one;
-		it = minP->begin();
-		for ( j=0; j<d[i]; ++j, it++)
-			F.neg(*it, m[i][j]);
-		charp.push_back( *minP );
-	}
-	delete[] X;
-	delete[] d;
-	return charp;
-}
diff --git a/linbox/ffpack/ffpack_frobenius.inl b/linbox/ffpack/ffpack_frobenius.inl
deleted file mode 100644
index f53b5e0..0000000
--- a/linbox/ffpack/ffpack_frobenius.inl
+++ /dev/null
@@ -1,510 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* linbox/ffpack/ffpack_charpoly_kgfast.inl
- * Copyright (C) 2006 Clement Pernet
- *
- * Written by Clement Pernet <cpernet at uwaterloo.ca>
- *
- * See COPYING for license information.
- */
-
-#ifndef MIN
-#define MIN(a,b) (a<b)?a:b
-#endif
-
-//---------------------------------------------------------------------
-// CharpolyArithProg: Las Vegas algorithm to compute the Charpoly 
-// over a large field (Z/pZ, s.t.  p > 2n^2)
-//---------------------------------------------------------------------
-template <class Field, class Polynomial>
-std::list<Polynomial>&
-FFPACK::CharpolyArithProg (const Field& F, std::list<Polynomial>& frobeniusForm, 
-			   const size_t N, typename Field::Element * A, const size_t lda,
-			   const size_t c){
-	
-	static typename Field::Element one, zero, mone;
-	F.init(one, 1UL);
-	F.neg(mone, one);
-	F.init(zero, 0UL);
-
-	size_t * rp = new size_t[2*N];
-	size_t noc = static_cast<size_t>(ceil(double(N)/double(c)));
-
-	// Building the workplace matrix 
-	typename Field::Element *K = new typename Field::Element[N*(noc*c)];
-	typename Field::Element *K2 = new typename Field::Element[N*(noc*c)];
-	size_t ldk = N;
-
-	size_t *dA = new size_t[N]; //PA
-	size_t *dK = new size_t[noc*c];
-	for (size_t i=0; i<noc; ++i)
-		dK[i]=0;
-
-	// Picking a random noc x N block vector U^T
-	typename Field::RandIter g (F);
-	typename Field::NonZeroRandIter nzg (F,g);
-	for (size_t i = 0; i < noc; ++i)
- 		for (size_t j = 0; j < N; ++j)
- 			g.random( *(K + i*ldk +j) );
-	for (size_t i = 0; i < noc; ++i)
-		nzg.random (*(K + i*ldk +i));
-	
-	// Computing the bloc Krylov matrix [U AU .. A^(c-1) U]^T
-	for (size_t i = 1; i<c; ++i)
-		fgemm( F, FflasNoTrans, FflasTrans,  noc, N, N, one,
-		       K+(i-1)*noc*ldk, ldk, A, lda, zero, K+i*noc*ldk, ldk);
-
-	// K2 <- K (re-ordering)
-	size_t w_idx = 0;
-	for (size_t i=0; i<noc; ++i)
-		for (size_t j=0; j<c; ++j, w_idx++)
-			fcopy(F, N, (K2+(w_idx)*ldk), 1, (K+(i+j*noc)*ldk), 1);
-
-	// Copying K <- K2
-	for (size_t i=0; i<noc*c; ++i)
-		fcopy (F, N, (K+i*ldk), 1, K2+i*ldk, 1);
-	
-	size_t * Pk = new size_t[N];
-	size_t * Qk = new size_t[c*noc];
-	for (size_t i=0; i<c*noc; ++i)
-		Qk[i] = 0;
-	for (size_t i=0; i<N; ++i)
-		Pk[i] = 0;
-	size_t R = LUdivine(F, FflasNonUnit, FflasNoTrans, noc*c, N, K, ldk, Pk, Qk, FfpackLQUP);
-
-	size_t row_idx = 0;
-	size_t i=0;
-	size_t dold = c;
-	size_t nb_full_blocks = 0;
-	size_t Mk = 0;
-	// Determining the degree sequence dK
-	for (size_t k = 0; k<noc; ++k){
-		size_t d = 0;
-		while ( (d<c) && (row_idx<R) && (Qk[row_idx] == i)) {i++; row_idx++; d++;}
-		if (d > dold){
-			// std::cerr << "FAIL in preconditionning phase:"
-			//           << " degree sequence is not monotonically not increasing"
-			// 	     << std::endl;
-			throw CharpolyFailed();
-		}
-		dK[k] = dold = d;
-		Mk++;
-		if (d == c)
-			nb_full_blocks++;
-		if (row_idx < noc*c)
-			i = Qk[row_idx];
-	}
-
-	// Selection of the last iterate of each block
-	size_t bk_idx = 0;
-	for (size_t i = 0; i < Mk; ++i){
-		fcopy (F, N, (K2+i*ldk), 1, (K2 + (bk_idx + dK[i]-1)*ldk), 1);
-		bk_idx += c;
-	}
-	typename Field::Element* K2b = K2+Mk*ldk;
-
-	// K <- K A^T 
-	fgemm( F, FflasNoTrans, FflasTrans, Mk, N, N, one,  K2, ldk, A, lda, zero, K2b, ldk);
-
-	// K <- K P^T
-	applyP (F, FflasRight, FflasTrans, Mk, 0, R, K2b, ldk, Pk);
-
-	// K <- K U^-1
-	ftrsm (F, FflasRight, FflasUpper, FflasNoTrans, FflasNonUnit, Mk, R, one, K, ldk, K2b, ldk);
-
-	// L <-  Q^T L
-	applyP(F, FflasLeft, FflasNoTrans, N, 0, R, K, ldk, Qk);
-
-	// K <- K L^-1
-	ftrsm (F, FflasRight, FflasLower, FflasNoTrans, FflasUnit, Mk, R, one, K, ldk, K2b, ldk);
-
-	//undoing permutation on L
-	applyP(F, FflasLeft, FflasTrans, N, 0, R, K, ldk, Qk);
-
-	// Recovery of the completed invariant factors
-	size_t Ma = Mk;
-	size_t Ncurr = R;
-	size_t offset = Ncurr-1;
-	for (size_t i=Mk-1; i>=nb_full_blocks+1;  --i)
-		if (dK[i] >= 1){ 
-			for (size_t j = offset+1; j<R; ++j)
-				if (!F.isZero(*(K2b + i*ldk + j))){
-					//std::cerr<<"FAIL C != 0 in preconditionning"<<std::endl;
-					throw CharpolyFailed();
-				}
-			Polynomial P (dK [i]+1);
-			F.assign(P[dK[i]], one);
-			for (size_t j=0; j < dK [i]; ++j)
-				F.neg (P [dK [i]-j-1], *(K2b + i*ldk + (offset-j)));
-			frobeniusForm.push_front(P);
-			offset -= dK [i];
-			Ncurr -= dK [i];
-			Ma--;
-		}
-	Mk = Ma;
-
-	if (R<N){
-// 		std::cerr<<"Preconditionning failed; missing rank = "<<N-R
-// 			 <<" completing the Krylov matrix"
-// 			 <<std::endl;
-		size_t Nrest = N-R;
-		typename Field::Element * K21 = K + R*ldk;
-		typename Field::Element * K22 = K21 + R;
-		typename Field::Element * Ki, *Ai;
-
-		//  Compute the n-k last rows of A' = P A^T P^T in K2_
-		// A = A . P^t
-		applyP( F, FflasRight, FflasTrans, N, 0, R, A, lda, Pk);
-
-		// Copy K2_ = (A'_2)^t
-		for (Ki = K21, Ai = A+R; Ki != K21 + Nrest*ldk; Ai++, Ki+=ldk-N)
-			for ( size_t j=0; j<N*lda; j+=lda )
-				*(Ki++) = *(Ai+j);
-
-		// A = A . P : Undo the permutation on A
-		applyP( F, FflasRight, FflasNoTrans, N, 0, R, A, lda, Pk);
-
-		// K2_ = K2_ . P^t (=  ( P A^t P^t )2_ ) 
-		applyP( F, FflasRight, FflasTrans, Nrest, 0, R, K21, ldk, Pk);
-		
-		// K21 = K21 . S1^-1
-		ftrsm (F, FflasRight, FflasUpper, FflasNoTrans, FflasNonUnit, Nrest, R,
-		       one, K, ldk, K21, ldk);  
-
-		typename Field::Element * Arec = new typename Field::Element[Nrest*Nrest];
-		size_t ldarec = Nrest;
-		
-		// Creation of the matrix A2 for recursive call 
-		for (Ki = K22,  Ai = Arec;
-		     Ki != K22 + Nrest*ldk;
-		     Ki += (ldk-Nrest) )
-			for ( size_t j=0; j<Nrest; ++j )
-				*(Ai++) = *(Ki++);
-		fgemm (F, FflasNoTrans, FflasNoTrans, Nrest, Nrest, R, mone,
-		       K21, ldk, K+R, ldk, one, Arec, ldarec);
-
-		std::list<Polynomial> polyList;
-		polyList.clear();
-
-		// Recursive call on the complementary subspace
-		CharpolyArithProg (F, polyList, Nrest, Arec, ldarec, c);
-		delete[] Arec;
-		frobeniusForm.merge(polyList);
-	}
-
-	delete[] Pk;
-	delete[] Qk;
-	size_t deg = c+1;
-	for (size_t i=0; i<Mk; ++i)
- 		dA[i] = dK[i];
-	bk_idx = 0;
-	
-	typename Field::Element *Arp = new typename Field::Element[Ncurr*Ma];
-	typename Field::Element *Ac = new typename Field::Element[Ncurr*Ma];
-	size_t ldac = Ma;
-	size_t ldarp = Ncurr;
-	
-	for (size_t i=0; i < Ncurr; ++i)
- 		for (size_t j=0; j<Ma; ++j)
-			*(K+i*ldk+j) = *(Ac + i*Ma +j) = *(K2b + i + (j)*ldk);
-
-	size_t block_idx, it_idx, rp_val;
-
-	// Main loop of the arithmetic progession
-	while ((nb_full_blocks >= 1) && (Mk > 1)) {
-		delete[] K;
-		delete[] K2;
-		K = new typename Field::Element[Ncurr*Ma];
-		K2 = new typename Field::Element[Ncurr*Ma];
-		ldk = Ma;
- 
-		// Computation of the rank profile
-		for (size_t i=0; i < Ncurr; ++i)
-			for (size_t j=0; j < Ma; ++j)
-				*(Arp + j*ldarp + Ncurr-i-1) = *(Ac + i*ldac + j);
-		for (size_t i=0; i<2*Ncurr; ++i)
-			rp[i] = 0;
-		size_t R = SpecRankProfile (F, Ma, Ncurr, Arp, ldarp, deg-1, rp);
-		if (R < Ncurr){
-			//std::cerr<<"FAIL R<Ncurr"<<std::endl;
-			throw CharpolyFailed();
-		}
-
-		// Computation of the degree vector dK
-		it_idx = 0;
-		rp_val = 0;
-		size_t g = 0;
-		size_t dtot=0;
-		block_idx = 0;
-		nb_full_blocks = 0;
-		while (dtot<Ncurr){
-			do {g++; rp_val++; it_idx++;}
-			while ( /*(g<Ncurr ) &&*/ (rp[g] == rp_val) && (it_idx < deg ));
-			if ((block_idx)&&(it_idx > dK[block_idx-1])){
-				throw CharpolyFailed();
-				//std::cerr<<"FAIL d non decroissant"<<std::endl;
-				//exit(-1);
-			}
-			dK[block_idx++] = it_idx;
-			dtot += it_idx;
-			if (it_idx == deg)
-				nb_full_blocks ++;
-			it_idx=0;
-			rp_val = rp[g];
-		}
-
-		Mk = block_idx;
-				
-		// Selection of dense colums of K 
-		for (size_t i=0; i < nb_full_blocks; ++i){
-			fcopy (F, Ncurr, K+i, ldk, Ac+i, ldac);
-		}
-		
-		// K <- QK K
-		size_t pos = nb_full_blocks*(deg-1);
-		for (size_t i = nb_full_blocks; i < Mk; ++i){
-			for (size_t j=0; j<Ncurr; ++j)
-				F.assign (*(K + i + j*ldk), zero);
-			F.assign (*(K + i + (pos + dK[i]-1)*ldk), one);
-			pos += dA[i];
-		}
-
-		// Copying K2 <- K
-		for (size_t i=0; i<Mk; ++i)
-			fcopy (F, Ncurr, K2+i, ldk, K+i, ldk);
-		CompressRowsQK (F, Mk, K2 + nb_full_blocks*(deg-1)*ldk, ldk,
-				Arp, ldarp, dK+nb_full_blocks, deg, Mk-nb_full_blocks);
-
-		// K <- PA K
-		CompressRows (F, nb_full_blocks, K, ldk, Arp, ldarp, dA, Ma);
-		
-		// A <- newQA^T K (compress)
-		CompressRowsQA (F, Ma, Ac, ldac, Arp, ldarp, dA, Ma);
-		
-		// K <- A K
-		fgemm (F, FflasNoTrans, FflasNoTrans, Ncurr-Ma, nb_full_blocks, Ma, one,
-		       Ac, ldac, K+(Ncurr-Ma)*ldk, ldk, one, K, ldk);
-		fgemm (F, FflasNoTrans, FflasNoTrans, Ma, nb_full_blocks, Ma, one,
-		       Ac+(Ncurr-Ma)*ldac, ldac, K+(Ncurr-Ma)*ldk, ldk, zero, Arp, ldarp);
-		for (size_t i=0; i< Ma; ++i)
-			fcopy(F, nb_full_blocks, K+(Ncurr-Ma+i)*ldk, 1, Arp+i*ldarp, 1);
-		
-		// Copying the last rows of A times K
-		offset = (deg-2)*nb_full_blocks;
-		for (size_t i = nb_full_blocks; i < Mk; ++i) {
-			for (size_t j=0; j<Ncurr; ++j)
-				F.assign(*(K+i+j*ldk), zero);
-			if (dK[i] == dA[i]) // copy the column of A
-				fcopy (F, Ncurr, K+i, ldk, Ac+i, ldac);
-			else{
-				F.assign (*(K + i + (offset+dK[i]-1)*ldk), one);
-			}
-			offset += dA[i]-1;
-		}
-				
-		// K <- QA K
-		DeCompressRowsQA (F, Mk, Ncurr, K, ldk, Arp, ldarp, dA, Ma);
-
-		// K <- QK^T K
-		CompressRowsQK (F, Mk, K + nb_full_blocks*(deg-1)*ldk, ldk, Arp, ldarp,
-				dK+nb_full_blocks, deg, Mk-nb_full_blocks);
-		
-		// K <- K^-1 K
-		size_t *P=new size_t[Mk];
-		size_t *Q=new size_t[Mk];
-		if (LUdivine (F, FflasNonUnit, FflasNoTrans, Mk, Mk , K2 + (Ncurr-Mk)*ldk, ldk, P, Q, FfpackLQUP) < Mk){
-			// should never happen (not a LAS VEGAS check)
-			//std::cerr<<"FAIL R2 < MK"<<std::endl;
-			//			exit(-1);
-		}
-		ftrsm (F, FflasLeft, FflasLower, FflasNoTrans, FflasUnit, Mk, Mk, one,
-		       K2 + (Ncurr-Mk)*ldk, ldk, K+(Ncurr-Mk)*ldk, ldk);
-		ftrsm (F, FflasLeft, FflasUpper, FflasNoTrans, FflasNonUnit, Mk, Mk, one,
-		       K2+(Ncurr-Mk)*ldk, ldk, K+(Ncurr-Mk)*ldk, ldk);
-		applyP (F, FflasLeft, FflasTrans, Mk, 0, Mk, K+(Ncurr-Mk)*ldk,ldk, P);
-		fgemm (F, FflasNoTrans, FflasNoTrans, Ncurr-Mk, Mk, Mk, mone,
-		       K2, ldk, K+(Ncurr-Mk)*ldk,ldk, one, K, ldk);
-		delete[] P;
-		delete[] Q;
-		
-		// K <- PK^T K
-		DeCompressRows (F, Mk, Ncurr, K, ldk, Arp, ldarp, dK, Mk);
-		
-		// K <- K PK (dA <- dK)
-		if (nb_full_blocks*deg < Ncurr)
-			Ma = nb_full_blocks+1;
-		else
-			Ma = nb_full_blocks;
-		
-		for (size_t i=0; i< Ma; ++i)
-			dA[i] = dK[i];
-
-		// Recovery of the completed invariant factors
-		offset = Ncurr-1;
-		size_t oldNcurr = Ncurr;
-		for (size_t i=Mk-1; i>=nb_full_blocks+1;  --i)
-			if (dK[i] >= 1){ 
-				Polynomial  P (dK [i]+1);
-				F.assign(P[dK[i]], one);
-				for (size_t j=0; j < dK[i]; ++j)
-					F.neg( P[dK[i]-j-1], *(K + i + (offset-j)*ldk));
-				frobeniusForm.push_front(P);
-				offset -= dK[i];
-				Ncurr -= dK[i];
-			}
-		for (size_t i= offset+1; i<oldNcurr; ++i)
-			for (size_t j=0; j<nb_full_blocks+1; ++j){
-				if (!F.isZero( *(K+i*ldk+j) )){
-					//std::cerr<<"FAIL C != 0"<<std::endl;
-					throw CharpolyFailed();
-				}
-			}
-		
-		// A <- K
-		delete[] Ac;
-		delete[] Arp;
-		Ac = new typename Field::Element[Ncurr*Mk];
-		ldac = Mk;
-		Arp = new typename Field::Element[Ncurr*Mk];
-		ldarp=Ncurr;
-		for (size_t i=0; i < Ncurr; ++i )
-			fcopy (F, Mk, Ac + i*ldac, 1, K + i*ldk, 1);
-
-		deg++;
-			
-	}
-
-	// Recovery of the first invariant factor
-	Polynomial Pl(dK [0]+1);
-	F.assign(Pl[dK[0]], one);
-	for (size_t j=0; j < dK[0]; ++j)
-		F.neg( Pl[j], *(K  + j*ldk));
-	frobeniusForm.push_front(Pl);
-	delete[] rp;
-	delete[] Arp;
-	delete[] Ac;
-	delete[] K;
-	delete[] K2;
-	delete[] dA;
-	delete[] dK;
-	return frobeniusForm;
-}
-
-template <class Field>
-void FFPACK::CompressRowsQK (Field& F, const size_t M,
-			   typename Field::Element * A, const size_t lda,
-			   typename Field::Element * tmp, const size_t ldtmp,
-			   const size_t * d, const size_t deg,const size_t nb_blocs){
-
-	int currtmp = 0;
-	size_t currw = d[0]-1;
-	size_t currr = d[0]-1;
-	for (int i = 0; i< int(nb_blocs)-1; ++i){
-		for (int j = d[i]-1; j<int(deg)-1; ++j, currr++, currtmp++)
-			fcopy(F, M, tmp + currtmp*ldtmp, 1,  A + currr*lda, 1);
-		for (int j=0; j < int(d[i+1]) -1; ++j, currr++, currw++){
-			fcopy(F, M, A + (currw)*lda, 1, A+(currr)*lda, 1);
-		}
-	}
-	for (int i=0; i < currtmp; ++i, currw++){
-		fcopy (F, M, A + (currw)*lda, 1, tmp + i*ldtmp, 1);
-	}
-}
-
-template <class Field>
-void FFPACK::CompressRows (Field& F, const size_t M,
-			     typename Field::Element * A, const size_t lda,
-			     typename Field::Element * tmp, const size_t ldtmp,
-			     const size_t * d, const size_t nb_blocs){
-
-	size_t currd = d[0]-1;
-	size_t curri = d[0]-1;
-	for (int i = 0; i< int(nb_blocs)-1; ++i){
-		fcopy(F, M, tmp + i*ldtmp, 1,  A + currd*lda, 1);
-		for (int j=0; j < int(d[i+1]) -1; ++j){
-			fcopy(F, M, A + (curri++)*lda, 1, A+(currd+j+1)*lda, 1);
-		}
-		currd += d[i+1];
-	}
-	for (int i=0; i < int(nb_blocs)-1; ++i){
-		fcopy (F, M, A + (curri++)*lda, 1, tmp + i*ldtmp, 1);
-	}
-}
-
-template <class Field>
-void FFPACK::DeCompressRows (Field& F, const size_t M, const size_t N,
-			     typename Field::Element * A, const size_t lda,
-			     typename Field::Element * tmp, const size_t ldtmp,
-			     const size_t * d, const size_t nb_blocs){
-	
-	for (int i=0; i<int(nb_blocs)-1; ++i)
-		fcopy(F, M, tmp + i*ldtmp, 1, A + (N-nb_blocs+i)*lda, 1);
-	
-	size_t w_idx = N - 2;
-	size_t r_idx = N - nb_blocs - 1;
-	for (int i = int(nb_blocs)-2; i>=0; --i){
-		for (size_t j = 0; j<d[i+1]-1; ++j)
-			fcopy (F, M, A + (w_idx--)*lda, 1, A + (r_idx--)*lda, 1);
-		fcopy (F, M, A + (w_idx--)*lda, 1, tmp + i*ldtmp, 1);
-	}
-}
-
-template <class Field>
-void FFPACK::DeCompressRowsQK (Field& F, const size_t M, const size_t N,
-			       typename Field::Element * A, const size_t lda,
-			       typename Field::Element * tmp, const size_t ldtmp,
-			       const size_t * d, const size_t deg,const size_t nb_blocs){
-	
-	size_t zeroblockdim = 1; // the last block contributes with 1
-	size_t currtmp = 0;
-	for (int i=0; i<int(nb_blocs)-1; ++i)
-		zeroblockdim += deg - d[i];
-	for (int i=0; i < zeroblockdim - 1; ++i, ++currtmp)
-		fcopy(F, M, tmp + currtmp*ldtmp, 1,  A + (N - zeroblockdim +i)*lda, 1);
-	currtmp--;
-	size_t w_idx = N - 2;
-	size_t r_idx = N - zeroblockdim - 1;
-
-	for (int i = int(nb_blocs)-2; i>=0; --i){
-		for (size_t j = 0; j < d [i+1] - 1; ++j)
-			fcopy (F, M, A + (w_idx--)*lda, 1, A + (r_idx--)*lda, 1);
-		for (size_t j = 0; j < deg - d[i]; ++j)
-			fcopy (F, M, A + (w_idx--)*lda, 1, tmp + (currtmp--)*ldtmp, 1);
-	}
-}
-
-template <class Field>
-void FFPACK::CompressRowsQA (Field& F, const size_t M,
-			     typename Field::Element * A, const size_t lda,
-			     typename Field::Element * tmp, const size_t ldtmp,
-			     const size_t * d, const size_t nb_blocs){
-
-	size_t currd = 0;
-	size_t curri = 0;
-	for (size_t i = 0; i< nb_blocs; ++i){
-		fcopy(F, M, tmp + i*ldtmp, 1,  A + currd*lda, 1);
-		for (size_t j=0; j < d[i] -1; ++j)
-			fcopy(F, M, A + (curri++)*lda, 1, A+(currd+j+1)*lda, 1);
-		currd += d[i];
-	}
-	for (size_t i=0; i < nb_blocs; ++i)
-		fcopy (F, M, A + (curri++)*lda, 1, tmp + i*ldtmp, 1);
-}
-
-template <class Field>
-void FFPACK::DeCompressRowsQA (Field& F, const size_t M, const size_t N,
-			       typename Field::Element * A, const size_t lda,
-			       typename Field::Element * tmp, const size_t ldtmp,
-			       const size_t * d, const size_t nb_blocs){
-	
-	for (size_t i=0; i<nb_blocs; ++i)
-		fcopy(F, M, tmp + i*ldtmp, 1, A + (N-nb_blocs+i)*lda, 1);
-
-	size_t w_idx = N - 1;
-	size_t r_idx = N - nb_blocs - 1;
-	for (int i = int(nb_blocs)-1; i>=0; --i){
-		for (size_t j = 0; j<d[i]-1; ++j)
-			fcopy (F, M, A + (w_idx--)*lda, 1, A + (r_idx--)*lda, 1);
-		fcopy (F, M, A + (w_idx--)*lda, 1, tmp + i*ldtmp, 1);
-	}
-}
diff --git a/linbox/ffpack/ffpack_krylovelim.inl b/linbox/ffpack/ffpack_krylovelim.inl
deleted file mode 100644
index d22e0ad..0000000
--- a/linbox/ffpack/ffpack_krylovelim.inl
+++ /dev/null
@@ -1,206 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* ffpack/ffpack_krylovelim.inl
- * Copyright (C) 2006 Clement Pernet
- *
- * Written by Clement Pernet <Clement.Pernet at imag.fr>
- *
- * See COPYING for license information.
- */
-
-#ifndef MIN
-#define MIN(a,b) (a<b)?a:b
-#endif
-#ifndef MAX
-#define MAX(a,b) (a<b)?b:a
-#endif
-
-// A is m x n with m <= n
-// Ensures : rankprof is the row rankprofil of the matrix k x n matrix B formed as follows (k = sum d_i):
-// for d_i <  j < d_{i+1} the jth row B_j = is e_j
-// B_{d_i} = A_i
-// iterates must be initialized by [1, 2, ...]
-// inviterates is the inverse finction of iterates
-template <class Field>
-inline size_t 
-FFPACK::KrylovElim( const Field& F, const size_t M, const size_t N,		
-		    typename Field::Element * A, const size_t lda, size_t*P, 
-		    size_t *Q, const size_t deg, size_t *iterates,  size_t * inviterates,size_t  maxit,
-		    size_t virt){
-
-	if ( !(M && N) ) return 0;
-	typedef typename Field::Element elt;
-	static elt Mone, one, zero;
-	F.init(Mone, -1.0);
-	F.init(one,1.0);
-	F.init(zero,0.0);
-
-	if (M == 1){
-		virt += deg;
-		for (size_t i=0; i<virt; ++i)
-			if (iterates[i]){
-				//	cerr<<"A["<<N-i-1<<"]=0"<<endl;
-				F.assign (A [N-iterates[i]], zero);
-			}
-		size_t ip=0;
-		//while (ip<N && !F.isUnit(*(A+ip)))ip++;
-		while (ip<N && F.isZero (*(A+ip))) {
-			//			cout<<(*(A+ip))<<" ";
-			ip++;
-		}
-		//cout<<endl;
-		*Q=0;
-		//cerr<<"ip = "<<ip<<endl;
-		if (ip==N){ // current row is zero
-			*P=0;
-			//cerr<<"return 0"<<endl;
-			return 0;
-		}
-		*P = ip;
-			// 	cerr<<"iterates = ";
-// 		cerr<<"iterates avant"<<endl;
-// 		for (size_t i=0; i<N; ++i)
-//  			cerr<<iterates[i]<<" ";
-//  		cerr<<endl;
-//  		cerr<<"inviterates["<<N<<"-"<<ip<<"] ="<<inviterates[N-ip]<<endl;
-//  		cerr<<"iterates[inviterates[N-ip]] ="<<iterates[inviterates[N-ip]]<<endl;
-		iterates [inviterates[N-ip] -1 ] = 0;
-		if (ip >0){
-			iterates [inviterates[N] -1 ] = N-ip;
-			inviterates[N-ip] = inviterates[N];
-		}
-// 		cerr<<"iterates apres"<<endl;
-// 		for (size_t i=0; i<N; ++i)
-//  			cerr<<iterates[i]<<" ";
-//  		cerr<<endl;
-		//cout<<"iterates ["<<N<<"-1-"<<ip<<"] = 0"<<endl;
-
-		if (ip!=0){
-			// swap the pivot
-			typename Field::Element tmp=*A;
-			*A = *(A+ip);
-			*(A+ip) = tmp;
-		}
-		return 1;
-	} else { // MN>1
-		size_t Nup = M>>1;
-		size_t Ndown =  M - Nup;
-
-		// Recursive call on NW
-		size_t R = KrylovElim (F,  Nup, N, A, lda, P, Q, deg, iterates, inviterates, maxit, virt);
-		
-		typename Field::Element *Ar = A + Nup*lda; // SW
-		typename Field::Element *Ac = A + R;     // NE
-		typename Field::Element *An = Ar + R;    // SE
-
-		if (R){
-			// Ar <- Ar.P
-			applyP (F, FflasRight, FflasTrans, Ndown, 0, R, Ar, lda, P); 
-			// Ar <- Ar.U1^-1
-			ftrsm( F, FflasRight, FflasUpper, 
-			       FflasNoTrans, FFLAS::FflasNonUnit, Ndown, R, 
-			       one, A, lda, Ar, lda);
-			// An <- An - Ar*Ac
-			fgemm( F, FflasNoTrans, FflasNoTrans, Ndown, N-R, R,
-			       Mone, Ar, lda, Ac, lda, one, An, lda);
-		}
-		// Recursive call on SE
-		size_t R2 = KrylovElim (F, Ndown, N-R, An, lda,P+R, Q+Nup, deg, iterates, inviterates, maxit, MIN(maxit-deg,(virt+Nup*deg)));
-
-		for (size_t i = R; i < R + R2; ++i)
-			P[i] += R;
-		if (R2)
-			// An <- An.P2
-			applyP (F, FflasRight, FflasTrans, Nup, R, R+R2, A, lda, P); 
-		
-		// Non zero row permutations
-		for (size_t i = Nup; i < M; i++)
-			Q[i] += Nup;
-		if (R < Nup){
-			// Permutation of the 0 rows
-			for ( size_t i = Nup, j = R ; i < Nup + R2; ++i, ++j){
-				fcopy( F, N - j, A + j*(lda + 1), 1, A + i*lda + j, 1);
-				for (typename Field::Element *Ai = A + i*lda + j;
-				     Ai != A + i*lda + N; ++Ai)
-					F.assign (*Ai, zero);
-				size_t t = Q[j];
-				Q[j]=Q[i];
-				Q[i] = t;
-			}
-		}
-		return R + R2;
-	}
-}
-
-template <class Field>
-size_t 
-FFPACK::SpecRankProfile (const Field& F, const size_t M, const size_t N,
-			 typename Field::Element * A, const size_t lda, const size_t deg,
-			 size_t *rankProfile){
-
-	//size_t deg = (N-1)/M+1; // Number of trivial iterates per blocs
-	size_t * Q = new size_t[M];
-	size_t * P = new size_t[N];
-	size_t * iterates = new size_t[N];
-	size_t * inviterates = new size_t[N+1];
-	for (size_t i=0; i < N; ++i)
-		inviterates[i+1] = iterates[i] = i+1;
-
-	size_t R = KrylovElim (F, M, N, A, lda, P, Q, deg, iterates, inviterates, N,0);
-	//cerr<<"Apres tout iterates = "<<endl;
-
-// 	for (size_t i=0; i<N; ++i)
-// 		cerr<<iterates[i]<<" ";
-// 	cerr<<endl;
-
-	size_t curr_row = 0;
-	size_t it_idx = 0;
-	size_t bk_idx = 0;
-	size_t rp_idx = 0;
-	bool dependent = false;
-	for (size_t i=0; i<M; ++i){
-		//	cerr<<"Block "<<i<<endl;
-		for (size_t j=0; j<deg; ++j){
-			if (curr_row < N+M -1){
-				if (iterates[it_idx++]){
-					rankProfile [rp_idx++] = curr_row;
-					if (dependent){
-#if DEBUG
-						std::cerr<<"FAIL itere dependant intercale"<<std::endl;
-#endif
-						throw CharpolyFailed();
-					}
-#if DEBUG
-					std::cerr<<"X";
-#endif					
-				}
-				else{
-					dependent = true;
-#if DEBUG
-					std::cerr<<"O";
-#endif
-				}
-				curr_row++;
-			}
-		}
-		dependent = false;
-		if ((Q [bk_idx] == i)&&(i<R)){
-			rankProfile [rp_idx++] = curr_row;
-#if DEBUG
- 			std::cerr<<"V"<<std::endl;
-#endif
- 			bk_idx++;
- 		}
-#if DEBUG
- 		else
- 			std::cerr<<"W"<<std::endl;
-#endif
-		curr_row++;
-	}
-	delete[] P;
-	delete[] Q;
-	delete[] inviterates;
-	delete[] iterates;
-	
-	return rp_idx;
-}
diff --git a/linbox/ffpack/ffpack_ludivine.inl b/linbox/ffpack/ffpack_ludivine.inl
deleted file mode 100644
index 12535ed..0000000
--- a/linbox/ffpack/ffpack_ludivine.inl
+++ /dev/null
@@ -1,1096 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* ffpack/ffpack_ludivine.inl
- * Copyright (C) 2005 Clement Pernet
- *
- * Written by Clement Pernet <Clement.Pernet at imag.fr>
- *
- * See COPYING for license information.
- */
-
-#ifndef MIN
-#define MIN(a,b) (a<b)?a:b
-#endif
-#ifndef MAX
-#define MAX(a,b) (a<b)?b:a
-#endif
-
-
-template<class Field>
-inline size_t
-FFPACK::LUdivine_gauss( const Field& F, const FFLAS_DIAG Diag,
-			const size_t M, const size_t N,		
-			typename Field::Element * A, const size_t lda, size_t*P, 
-			size_t *Q, const FFPACK_LUDIVINE_TAG LuTag){
-	static typename Field::Element mone,one,zero;
-	F.init(one,1.0);
-	F.init(zero,0.0);
-	F.neg (mone, one);
-	size_t MN = MIN(M,N);
-	typename Field::Element * Acurr = A;
-	size_t r = 0;
-	
-	for (size_t k = 0; k < MN; ++k){
-		size_t p = r;
-		Acurr = A+k*lda+r;
-		while ((p < N) && F.isZero (*(Acurr++)))
-			p++;
-		if (p < N){
-			P[r] = p;
-			if (r < k){
-				fcopy (F, N-r, (A + r*(lda+1)), 1, (A+k*lda+r),1);
-				Acurr = A+r+k*lda;
-				for (size_t i=r; i<N; ++i)
-					F.assign(*(Acurr++),zero);
-			}
-			
-			fswap (F, M, A+r, lda, A+p, lda);
-			Q[r] = k;
-			r++;
-		}
-		if (k+1<M){
-			ftrsv (F, FflasUpper, FflasTrans, FflasNonUnit, r, A, lda, A+(k+1)*lda, 1);
-			fgemv (F, FflasTrans, r, N-r, mone, A+r, lda, A+(k+1)*lda, 1, one, A+(k+1)*lda+r, 1);
-		} else
-			return r;
-	}
-			
-	return r;
-}
-
-
-template<class Field>
-inline size_t
-FFPACK::LUdivine_small( const Field& F, const FFLAS_DIAG Diag, const FFLAS_TRANSPOSE trans,
-			const size_t M, const size_t N,		
-			typename Field::Element * A, const size_t lda, size_t*P, 
-			size_t *Q, const FFPACK_LUDIVINE_TAG LuTag){
-	return callLUdivine_small <typename Field::Element> ()
-		(F, Diag, trans, M, N, A, lda, P, Q, LuTag);
-}
-template<class Element>
-class FFPACK::callLUdivine_small {
-public:
-	template <class Field>
-	inline size_t 
-	operator()( const Field& F, const FFLAS_DIAG Diag, const FFLAS_TRANSPOSE trans,
-		    const size_t M, const size_t N,		
-		    typename Field::Element * A, const size_t lda, size_t*P, 
-		    size_t *Q, const FFPACK_LUDIVINE_TAG LuTag){
-
-		if ( !(M && N) ) return 0;
-		typedef typename Field::Element elt;
-		elt mone,zero,one;;
-		F.init (one, 1.0);
-		F.neg(mone, one);
-		F.init (zero, 0.0);
-		elt * Aini = A;
-		elt * Acurr;
-		size_t rowp = 0;
-		size_t colp;
-		size_t R = 0;
-		size_t k = 0;
-		//size_t kmax = DotProdBound (F, 0, one) -1; // the max number of delayed operations
-		while ((rowp<M) && (k<N)){
-
-			//Find non zero pivot
-			colp = k;
-			Acurr = Aini;
-			while ((F.isZero(*Acurr)) || (F.isZero (F.init (*Acurr, *Acurr))))
-				if (++colp == N){
-					if (rowp==M-1)
-						break;
-					colp=k; ++rowp;
-					Acurr = Aini += lda;
-				}
-				else
-					++Acurr;
-		
-			if ((rowp == M-1)&&(colp == N))
-				break;
-			R++;
-			P[k] = colp;
-			Q[k] = rowp;
-
-			// Permutation of the pivot column
-			fswap (F, M, A+k, lda, A + colp , lda);
-
-			//Normalization
-			elt invpiv;
-			F.init(*Aini,*Aini);
-			F.inv (invpiv,*Aini);
-
-			for (size_t j=1; j<N-k; ++j)
-				if (!F.isZero(*(Aini+j)))
-					F.init(*(Aini+j), *(Aini+j));
-			for (size_t i=lda; i<(M-rowp)*lda; i+=lda)
-				if (!F.isZero(*(Aini+i)))
-					F.init(*(Aini+i), *(Aini+i));
-
-
-			if (Diag == FflasUnit) {
-				for (size_t j=1; j<N-k; ++j)
-					if (!F.isZero(*(Aini+j)))
-						F.mulin (*(Aini+j),invpiv);
-			} else 
-				for (size_t i=lda; i<(M-rowp)*lda; i+=lda)
-					if (!F.isZero(*(Aini+i)))
-						F.mulin (*(Aini+i),invpiv);
-		
-			//Elimination
-			//Or equivalently, but without delayed ops :
-			fger (F, M-rowp-1, N-k-1, mone, Aini+lda, lda, Aini+1, 1, Aini+(lda+1), lda);
-		
-			Aini += lda+1; ++rowp; ++k;
-		}
-
-		// Compression the U matrix
-		size_t l;
-		if (Diag == FflasNonUnit){
-			Aini = A;
-			l = N;
-		} else {
-			Aini = A+1;
-			l=N-1;
-		}
-		for (size_t i=0; i<R; ++i, Aini += lda+1) {
-			if (Q[i] > i){
-				fcopy (F, l-i, Aini, 1, Aini+(Q[i]-i)*lda, 1);
-				for (size_t j=0; j<l-i; ++j)
-					F.assign (*(Aini+(Q[i]-i)*lda+j), zero);
-			}
-		}
-		return R;
-	}
-};
-
-template<>
-class FFPACK::callLUdivine_small<double>{
-public:
-	template <class Field>
-	inline size_t 
-	operator()( const Field& F, const FFLAS_DIAG Diag,  const FFLAS_TRANSPOSE trans,
-		    const size_t M, const size_t N,		
-		    typename Field::Element * A, const size_t lda, size_t*P, 
-		    size_t *Q, const FFPACK_LUDIVINE_TAG LuTag){
-
-		if ( !(M && N) ) return 0;
-		typedef typename Field::Element elt;
-		elt mone,zero,one;;
-		F.init (one, 1.0);
-		F.neg(mone, one);
-		F.init (zero, 0.0);
-		elt * Aini = A;
-		elt * Acurr;
-		size_t rowp = 0;
-		size_t colp;
-		size_t R = 0;
-		size_t k = 0;
-		size_t delay =0;
-		size_t kmax = DotProdBound (F, 0, one, FflasDouble) -1; // the max number of delayed operations
-		while ((rowp<M) && (k<N)){
-
-			//Find non zero pivot
-			colp = k;
-			Acurr = Aini;
-			while ((F.isZero(*Acurr)) || (F.isZero (F.init (*Acurr, *Acurr))))
-				if (++colp == N){
-					if (rowp==M-1)
-						break;
-					colp=k; ++rowp;
-					Acurr = Aini += lda;
-				}
-				else
-					++Acurr;
-		
-			if ((rowp == M-1)&&(colp == N))
-				break;
-			R++;
-			P[k] = colp;
-			Q[k] = rowp;
-
-			// Permutation of the pivot column
-			fswap (F, M, A+k, lda, A + colp , lda);
-
-			//Normalization
-			elt invpiv;
-			F.init(*Aini,*Aini);
-			F.inv (invpiv,*Aini);
-
-			for (size_t j=1; j<N-k; ++j)
-				if (!F.isZero(*(Aini+j)))
-					F.init(*(Aini+j), *(Aini+j));
-			for (size_t i=lda; i<(M-rowp)*lda; i+=lda)
-				if (!F.isZero(*(Aini+i)))
-					F.init(*(Aini+i), *(Aini+i));
-
-
-			if (Diag == FflasUnit) {
-				for (size_t j=1; j<N-k; ++j)
-					if (!F.isZero(*(Aini+j)))
-						F.mulin (*(Aini+j),invpiv);
-			} else 
-				for (size_t i=lda; i<(M-rowp)*lda; i+=lda)
-					if (!F.isZero(*(Aini+i)))
-						F.mulin (*(Aini+i),invpiv);
-		
-			if (delay++ >= kmax){ // Reduction has to be done
-				delay = 0;
-				for (size_t i=1; i<M-rowp; ++i)
-					for (size_t j=1; j<N-k; ++j)
-						F.init(	*(Aini+i*lda+j),*(Aini+i*lda+j));
-			}
-			//Elimination
-			for (size_t i=1; i<M-rowp; ++i)
-				for (size_t j=1; j<N-k; ++j)
-					*(Aini+i*lda+j) -= *(Aini+i*lda) * *(Aini+j);
-			//Or equivalently, but without delayed ops :
-			//fger (F, M-rowp-1, N-k-1, mone, Aini+lda, lda, Aini+1, 1, Aini+(lda+1), lda);
-		
-			Aini += lda+1; ++rowp; ++k;
-		}
-
-		// Compression the U matrix
-		size_t l;
-		if (Diag == FflasNonUnit){
-			Aini = A;
-			l = N;
-		} else {
-			Aini = A+1;
-			l=N-1;
-		}
-		for (size_t i=0; i<R; ++i, Aini += lda+1) {
-			if (Q[i] > i){
-				fcopy (F, l-i, Aini, 1, Aini+(Q[i]-i)*lda, 1);
-				for (size_t j=0; j<l-i; ++j)
-					F.assign (*(Aini+(Q[i]-i)*lda+j), zero);
-			}
-		}
-		return R;
-	}
-};
-template<>
-class FFPACK::callLUdivine_small<float>{
-public:
-	template <class Field>
-	inline size_t 
-	operator()( const Field& F, const FFLAS_DIAG Diag, const FFLAS_TRANSPOSE trans,
-		    const size_t M, const size_t N,		
-		    typename Field::Element * A, const size_t lda, size_t*P, 
-		    size_t *Q, const FFPACK_LUDIVINE_TAG LuTag){
-
-		if ( !(M && N) ) return 0;
-		typedef typename Field::Element elt;
-		elt mone,zero,one;;
-		F.init (one, 1.0);
-		F.neg(mone, one);
-		F.init (zero, 0.0);
-		elt * Aini = A;
-		elt * Acurr;
-		size_t rowp = 0;
-		size_t colp;
-		size_t R = 0;
-		size_t k = 0;
-		size_t delay =0;
-		size_t kmax = DotProdBound (F, 0, one, FflasFloat) -1; // the max number of delayed operations
-		while ((rowp<M) && (k<N)){
-
-			//Find non zero pivot
-			colp = k;
-			Acurr = Aini;
-			while ((F.isZero(*Acurr)) || (F.isZero (F.init (*Acurr, *Acurr))))
-				if (++colp == N){
-					if (rowp==M-1)
-						break;
-					colp=k; ++rowp;
-					Acurr = Aini += lda;
-				}
-				else
-					++Acurr;
-		
-			if ((rowp == M-1)&&(colp == N))
-				break;
-			R++;
-			P[k] = colp;
-			Q[k] = rowp;
-
-			// Permutation of the pivot column
-			fswap (F, M, A+k, lda, A + colp , lda);
-
-			//Normalization
-			elt invpiv;
-			F.init(*Aini,*Aini);
-			F.inv (invpiv,*Aini);
-
-			for (size_t j=1; j<N-k; ++j)
-				if (!F.isZero(*(Aini+j)))
-					F.init(*(Aini+j), *(Aini+j));
-			for (size_t i=lda; i<(M-rowp)*lda; i+=lda)
-				if (!F.isZero(*(Aini+i)))
-					F.init(*(Aini+i), *(Aini+i));
-
-
-			if (Diag == FflasUnit) {
-				for (size_t j=1; j<N-k; ++j)
-					if (!F.isZero(*(Aini+j)))
-						F.mulin (*(Aini+j),invpiv);
-			} else 
-				for (size_t i=lda; i<(M-rowp)*lda; i+=lda)
-					if (!F.isZero(*(Aini+i)))
-						F.mulin (*(Aini+i),invpiv);
-		
-			if (delay++ >= kmax){ // Reduction has to be done
-				delay = 0;
-				for (size_t i=1; i<M-rowp; ++i)
-					for (size_t j=1; j<N-k; ++j)
-						F.init(	*(Aini+i*lda+j),*(Aini+i*lda+j));
-			}
-			//Elimination
-			for (size_t i=1; i<M-rowp; ++i)
-				for (size_t j=1; j<N-k; ++j)
-					*(Aini+i*lda+j) -= *(Aini+i*lda) * *(Aini+j);
-			//Or equivalently, but without delayed ops :
-			//fger (F, M-rowp-1, N-k-1, mone, Aini+lda, lda, Aini+1, 1, Aini+(lda+1), lda);
-		
-			Aini += lda+1; ++rowp; ++k;
-		}
-
-		// Compression the U matrix
-		size_t l;
-		if (Diag == FflasNonUnit){
-			Aini = A;
-			l = N;
-		} else {
-			Aini = A+1;
-			l=N-1;
-		}
-		for (size_t i=0; i<R; ++i, Aini += lda+1) {
-			if (Q[i] > i){
-				fcopy (F, l-i, Aini, 1, Aini+(Q[i]-i)*lda, 1);
-				for (size_t j=0; j<l-i; ++j)
-					F.assign (*(Aini+(Q[i]-i)*lda+j), zero);
-			}
-		}
-		return R;
-	}
-};
-
-template <class Field>
-inline size_t 
-FFPACK::LUdivine (const Field& F, const FFLAS_DIAG Diag, const FFLAS_TRANSPOSE trans,
-		  const size_t M, const size_t N,		
-		  typename Field::Element * A, const size_t lda, size_t*P, 
-		  size_t *Q, const FFPACK_LUDIVINE_TAG LuTag, const size_t cutoff){
-	
-	if ( !(M && N) ) return 0;
-	typedef typename Field::Element elt;
-	static elt Mone, one, zero;
-	F.init(Mone, -1.0);
-	F.init(one,1.0);
-	F.init(zero,0.0);
-	size_t MN = MIN(M,N);
-
-	size_t incRow, incCol, rowDim, colDim;
-	if (trans == FflasTrans){
-		incRow = 1;
-		incCol = lda;
-		colDim = M;
-		rowDim = N; 
-	} else {
-		incRow = lda;
-		incCol = 1;
-		colDim = N;
-		rowDim = M;
-	}
-	
-	if ((rowDim < cutoff) && (colDim < 2*cutoff)) // the coeff 2 is experimentally determined!
-		return LUdivine_small (F, Diag, trans, M, N, A, lda, P, Q, LuTag);
-	else if (MN == 1){
-		size_t ip=0;
-		//while (ip<N && !F.isUnit(*(A+ip)))ip++;
-		while (F.isZero (*(A+ip*incCol)))
-			if (++ip == colDim)
-				break;
-		*Q=0;
-		if (ip == colDim){ // current row is zero
-			*P=0;
-			if (colDim == 1){
-				//while (ip<M && !F.isUnit(*(A+ip*lda))){
-				while (ip<rowDim && F.isZero(*(A + ip*incRow))){
-					Q[ip]=ip;
-					ip++;
-				}
-				if (ip == rowDim) {return 0;}
-				else{
-					size_t oldip = ip;
-					if ( Diag == FflasNonUnit ){
-						elt invpiv;
-						F.inv(invpiv,*(A+ip*incRow));
-						while(++ip<rowDim) 
-							F.mulin(*(A + ip*incRow), invpiv);
-						elt tmp;
-						F.assign(tmp, *(A+oldip*incRow));
-						F.assign( *(A+oldip*incRow), *A);
-						F.assign( *A, tmp);
-					}
-					*Q=oldip; 
-					
-					return 1;
-				}
-			}
-			else{ *Q=0; return 0;}
-		}
-		*P=ip;
-		if (ip!=0){
-			// swap the pivot
-			typename Field::Element tmp=*A;
-			*A = *(A + ip*incCol);
-			*(A + ip*incCol) = tmp;
-		}
-		elt invpiv;
-		F.inv(invpiv, *A);
-		if ( Diag == FflasUnit ){
-			// Normalisation of the row
-			for (size_t k=1; k<colDim; k++)
-				F.mulin(*(A+k*incCol), invpiv);
-		}
-		else if ( colDim==1 )
-			while(++ip<rowDim) 
-				F.mulin(*(A + ip*incRow), invpiv);
-		return 1;
-	} else { // MN>1
-		size_t Nup = rowDim >> 1;
-		size_t Ndown =  rowDim - Nup;
-		// Recursive call on NW
-		//cerr<<"LUdivine1..";
-
-		//cerr<<"done"<<endl;
-		size_t R, R2;
-		if (trans == FflasTrans){
-			//cerr<<"LUdivine1..."<<endl;
-			R = LUdivine (F, Diag, trans, colDim, Nup, A, lda, P, Q, LuTag, cutoff);
-			//cerr<<"done"<<endl;
-			typename Field::Element *Ar = A + Nup*incRow; // SW
-			typename Field::Element *Ac = A + R*incCol;     // NE
-			typename Field::Element *An = Ar + R*incCol;    // SE
-			if (!R){
-				if (LuTag == FfpackSingular ) 
-					return 0;
-			} else {			
-				applyP (F, FflasLeft, FflasNoTrans, Ndown, 0, R, Ar, lda, P); 
-				// Ar <- L1^-1 Ar
-				//write_field(F,cerr<<"Avant ftrsm"<<endl, A, M, N, lda);
-				ftrsm( F, FflasLeft, FflasLower, 
-				       FflasNoTrans, Diag, R, Ndown,  
-				       one, A, lda, Ar, lda);
-				// An <- An - Ac*Ar
-				//write_field(F,cerr<<"Avant fgemm"<<endl, A, M, N, lda);
-				fgemm( F, FflasNoTrans, FflasNoTrans, colDim-R, Ndown, R,
-				       Mone, Ac, lda, Ar, lda, one, An, lda);
-				//write_field(F,cerr<<"Apres fgemm"<<endl, A, M, N, lda);
-							
-			}
-			// Recursive call on SE
-			// cerr<<"LUdivine2..";
-// 			write_field(F,cerr<<"Apres mise a jour"<<endl, A, M, N, lda);
-			
-			R2 = LUdivine (F, Diag, trans, colDim-R, Ndown, An, lda, P + R, Q + Nup, LuTag, cutoff);
-			//cerr<<"done"<<endl;
-			for (size_t i = R; i < R + R2; ++i)
-				P[i] += R;
-			if (R2)
-				// An <- An.P2
-				applyP (F, FflasLeft, FflasNoTrans, Nup, R, R+R2, A, lda, P); 
-			else if (LuTag == FfpackSingular)
-				return 0;
-			
-		} else{
-			R = LUdivine (F, Diag, trans, Nup, colDim, A, lda, P, Q, LuTag, cutoff);
-			typename Field::Element *Ar = A + Nup*incRow; // SW
-			typename Field::Element *Ac = A + R*incCol;     // NE
-			typename Field::Element *An = Ar + R*incCol;    // SE
-			if (!R){
-				if (LuTag == FfpackSingular ) 
-					return 0;
-			} else {			
-				// Ar <- Ar.P
-				
-				applyP (F, FflasRight, FflasTrans, Ndown, 0, R, Ar, lda, P); 
-				// Ar <- Ar.U1^-1
-				ftrsm( F, FflasRight, FflasUpper, 
-				       FflasNoTrans, Diag, Ndown, R, 
-				       one, A, lda, Ar, lda);
-				// An <- An - Ar*Ac
-				fgemm( F, FflasNoTrans, FflasNoTrans, Ndown, colDim-R, R,
-				       Mone, Ar, lda, Ac, lda, one, An, lda);
-				// Recursive call on SE
-			}
-			// cerr<<"LUdivine2..";
-// 			write_field(F,cerr<<"Apres mise a jour"<<endl, A, M, N, lda);
-			R2=LUdivine (F, Diag, trans, Ndown, N-R, An, lda,P+R, Q+Nup, LuTag, cutoff);
-			//cerr<<"done"<<endl;
-			for (size_t i = R; i < R + R2; ++i)
-				P[i] += R;
-			if (R2)
-				// An <- An.P2
-				applyP (F, FflasRight, FflasTrans, Nup, R, R+R2, A, lda, P); 
-			else if (LuTag == FfpackSingular)
-				return 0;
-			
-		}
-		// Non zero row permutations
-		for (size_t i = Nup; i < rowDim; i++)
-			Q[i] += Nup;
-		if (R < Nup){
-			// Permutation of the 0 rows
-			if (Diag == FflasNonUnit){
-				for ( size_t i = Nup, j = R ; i < Nup + R2; ++i, ++j){
-					fcopy( F, colDim - j, A + j * (lda + 1), incCol, A + i*incRow + j*incCol, incCol);
- 					for (typename Field::Element *Ai = A + i*incRow + j*incCol;
- 					     Ai != A + i*incRow + colDim*incCol; Ai+=incCol)
- 						F.assign (*Ai, zero);
-					size_t t = Q[j];
-					Q[j]=Q[i];
-					Q[i] = t;
-				}
-			} else {
-				for ( size_t i = Nup, j = R+1 ; i < Nup + R2; ++i, ++j){
-					fcopy( F, colDim - j,
-					       A + (j-1)*incRow + j*incCol, incCol,
-					       A + i*incRow + j*incCol, incCol);
-					for (typename Field::Element *Ai = A + i*incRow + j*incCol;
-					     Ai != A + i*incRow + colDim*incCol; Ai+=incCol)
-						F.assign (*Ai, zero);
-					size_t t = Q[j-1];
-					Q[j-1]=Q[i];
-					Q[i] = t;
-				}
-			}
-		}
-		return R + R2;
-	}
-}
-
-
-//---------------------------------------------------------------------
-// LUdivine_construct: (Specialisation of LUdivine)
-// LUP factorisation of the Krylov base matrix of A^t and v.
-// When all rows have been factorized in A, and rank is full,
-// then new krylov vectors are computed and then triangularized
-// P is the permutation matrix stored in the lapack style
-// nRowX is the number of Krylov vectors already computed,
-// nUsedRowX is the number of Krylov vectors already triangularized
-//---------------------------------------------------------------------
-
-	template <class Field>
-size_t
-FFPACK::LUdivine_construct( const Field& F, const FFLAS_DIAG Diag,
-				      const size_t M, const size_t N,
-				      const typename Field::Element * A, const size_t lda,
-				      typename Field::Element * X, const size_t ldx,
-				      typename Field::Element * u, size_t* P,
-				      bool computeX, const FFPACK_MINPOLY_TAG MinTag = FfpackDense,
-				      const size_t kg_mc =0, const size_t kg_mb=0, const size_t kg_j=0){
-
-	static typename Field::Element Mone, one, zero;
-	F.init(Mone, -1.0);
-	F.init(one, 1.0);
-	F.init(zero,0.0);
-	size_t MN = MIN(M,N);
-
-	if (MN == 1){ 
-		size_t ip=0;
-		while (ip<N && F.isZero(*(X+ip))){ip++;}
-		if (ip==N){ // current row is zero
-			*P=0;
-			return 0;
-		}
-		*P=ip;
-		if (ip!=0){
-			// swap the pivot
-			typename Field::Element tmp=*X;
-			*X = *(X+ip);
-			*(X+ip) = tmp;
-		}
-		if ( Diag == FflasUnit ){
-			typename Field::Element invpiv;
-			F.inv(invpiv, *X);
-			
-			// Normalisation of the row
-			for (size_t k=1; k<N; k++)
-				F.mulin(*(X+k), invpiv);
-		}
- 		if (N==1 && M>1 && computeX)// Only appends when A is 1 by 1
-			F.mul(*(X+ldx),*X, *A);
-				
-		return 1;
-	}
-	else{ // MN>1
-		size_t Nup = MN>>1;
-		size_t Ndown =  M - Nup;
-		
-		// Recursive call on NW
-		size_t R = LUdivine_construct(F, Diag, Nup, N, A, lda, X, ldx, u, 
-					       P, computeX, MinTag, kg_mc, kg_mb, kg_j );
-		if (R==Nup){
-			typename Field::Element * Xr = X + Nup*ldx; //  SW
-			typename Field::Element * Xc = X + Nup;     //  NE
-			typename Field::Element * Xn = Xr + Nup;    //  SE
-			typename Field::Element * Xi = Xr;
-			if ( computeX ){
-				if (MinTag == FfpackDense)
-					for (size_t i=0; i< Ndown; ++i, Xi+=ldx){
-						fgemv(F, FflasNoTrans, N, N, one, 
-						      A, lda, u, 1, zero, Xi,1);
-						fcopy(F, N, u,1,Xi, 1);
-					}
-				else // Keller-Gehrig Fast algorithm's matrix
-					for (size_t i=0; i< Ndown; ++i, Xi+=ldx){
-						fgemv_kgf( F, N, A, lda, u, 1, Xi, 1, 
-  							   kg_mc, kg_mb, kg_j );
-						fcopy(F, N, u,1,Xi, 1);
-					}
-			}
-			// Apply the permutation on SW
-			applyP( F, FflasRight, FflasTrans, Ndown, 0, R, Xr, ldx, P); 
-			// Triangular block inversion of NW and apply to SW
-			// Xr <- Xr.U1^-1
-			ftrsm( F, FflasRight, FflasUpper, FflasNoTrans, Diag,
-			       Ndown, R, one, X, ldx, Xr, ldx);
-			
-			// Update of SE
-			// Xn <- Xn - Xr*Xc
-			fgemm( F, FflasNoTrans, FflasNoTrans, Ndown, N-Nup, Nup,
-			       Mone, Xr, ldx, Xc, ldx, one, Xn, ldx);
-
-			// Recursive call on SE
-			
-			size_t R2 = LUdivine_construct(F, Diag, Ndown, N-Nup, A, lda,
-							Xn, ldx, u, P + Nup, 
-							false, MinTag, kg_mc, kg_mb, kg_j);
-			for ( size_t i=R;i<R+R2;++i) P[i] += R;
-			
-			applyP( F, FflasRight, FflasTrans, Nup, R, R+R2, X, ldx, P); 
-			
-			return R+=R2;
-		}
-		else 
-			return R;
-		// Rank deficient matrices can only be factorized 
-		// under the condition: the first R rows are linearly independent
-		// If not, the lower block is never factorized as soon as the
-		// upper block is rank defficient
-	}
-}
-
-//---------------------------------------------------------------------
-// TURBO: rank computation algorithm 
-//---------------------------------------------------------------------
-
-template <class Field>
-inline size_t 
-FFPACK::TURBO (const Field& F, const size_t M, const size_t N,
-	       typename Field::Element* A, const size_t lda, size_t * P, size_t * Q, const size_t cutoff) {
-
-	size_t mo2 = (M>>1);
-	size_t no2 = (N>>1);
-
-	typename Field::Element * NW = A;
-	typename Field::Element * NE = A + no2;
-	typename Field::Element * SW = A + mo2*lda;
-	typename Field::Element * SE = SW + no2;
-	
-	size_t ld1, ld2, ld3, ld4;
-	ld1 = ld2 = ld3 = ld4 = lda;
-
-	if ( !(M && N) ) return 0;
-	typedef typename Field::Element elt;
-	static elt Mone, one, zero;
-	F.init(Mone, -1.0);
-	F.init(one,1.0);
-	F.init(zero,0.0);
-
-	// Column permutation
-	size_t * P1 = new size_t[no2];
-	size_t * P2 = new size_t[N-no2];
-	// Row Permutation
-	size_t * Q1 = new size_t[mo2];
-	size_t * Q2 = new size_t[M-mo2];
-	for (size_t i=0; i<mo2; ++i)
-		Q1[i] = 0;
-	for (size_t i=0; i<M-mo2; ++i)
-		Q2[i] = 0;
-	size_t q1,q2,q3,q3b,q4;
-	q1=q2=q3=q3b=q4=0;
-		
-	// Step 1: NW = L1.Q1.U1.P1
-	size_t mloc = mo2;
-	size_t nloc = no2;
-// 	Timer tim;
-// 	tim.clear();
-// 	tim.start();
-	q1 = LUdivine( F, FflasNonUnit, FflasNoTrans, mloc, no2, NW, ld1, P1, Q1, FfpackLQUP, cutoff);
-	
-// 	tim.stop();
-// 	cerr<<"LQUP1:"<<tim.realtime()<<std::endl;
-// 	tim.start();
-#if DEBUG
-	std::cerr<<"NW= L1.Q1.U1.P1"<<std::endl;
-	write_field(F,std::cerr,NW,M,N,lda);
-#endif	
-	// B1 = L^-1.NE
-#if DEBUG
-	std::cerr<<"avant B1 = L^-1.NE"<<std::endl;
-	write_field(F,std::cerr,NE,mloc,N-no2,ld2);
-#endif	
-	solveLB( F, FflasLeft, mo2, N-no2, q1, NW, ld1, Q1, NE, ld2);
-#if DEBUG
-	std::cerr<<"B1 = L^-1.NE"<<std::endl;
-	write_field(F,std::cerr,NE,mloc,N-no2,ld2);
-#endif	
-
-	// NE = Q^-1.NE
-	
-	applyP( F, FflasLeft, FflasNoTrans, N-no2, 0, mo2, NE, ld2, Q1);		
-#if DEBUG
-	std::cerr<<"NE=Q^-1.NE"<<std::endl;
-	write_field(F,std::cerr,NE,mloc,N-no2,ld2);
-#endif	
-
-	// SW = SW.P1
-	applyP( F, FflasRight, FflasTrans, M-mo2, 0, q1, SW, ld3, P1 );
-#if DEBUG
-	std::cerr<<"SW = SW.P1"<<std::endl;
-	write_field(F,std::cerr,SW,M-mo2,no2,ld3);
-#endif	
-
-// 	tim.stop();
-// 	std::cerr<<"L^-1:"<<tim.realtime()<<std::endl;
-// 	tim.start();
-	
-	// N1 = SW_{1,q1} . U1^-1
-	ftrsm( F, FflasRight, FflasUpper, FflasNoTrans, FflasNonUnit, M-mo2, q1, one, NW, ld1 , SW, ld3 );
-#if DEBUG
-	std::cerr<<" N1 = SW_{1,q1} . U1^-1"<<std::endl;
-	write_field(F,std::cerr,SW,M-mo2,no2,ld3);
-#endif	
-
-// 	tim.stop();
-// 	std::cerr<<"trsm:"<<tim.realtime()<<std::endl;
-// 	tim.start();
-	
-	// I1 = SW_{q1+1,n} - N1.G1  
-	fgemm(F, FflasNoTrans, FflasNoTrans, M-mo2,  no2-q1, q1, Mone, SW, ld3, NW+q1, ld1, one, SW+q1, ld3);
-#if DEBUG
-	std::cerr<<" I1 = SW_{q1+1,n} - N1.G1"<<std::endl;
-	write_field(F,std::cerr,SW,M-mo2,no2,ld3);
-#endif	
-// 	tim.stop();
-// 	std::cerr<<"fgemm1:"<<tim.realtime()<<std::endl;
-// 	tim.start();
-			
-	// E1 = SE - N1.B1_{1,q1}
-	fgemm( F, FflasNoTrans, FflasNoTrans, M-mo2, N-no2, q1, Mone, SW, ld3, NE, ld2, one, SE, ld4);
-#if DEBUG
-	std::cerr<<"  E1 = SE - N1.B1_{1,q1}"<<std::endl;
-	write_field(F,std::cerr,SE,M-mo2,N-no2,ld4);
-#endif	
-// 	tim.stop();
-// 	std::cerr<<"fgemm2:"<<tim.realtime()<<std::endl;
-// 	tim.start();
-
-
-	//Step 2: E1 = L2.Q2.U2.P2
-	mloc = M-mo2;
-	nloc = N-no2;
-	q2 = LUdivine( F, FflasNonUnit, FflasNoTrans, mloc, nloc, SE, ld4, P2, Q2, FfpackLQUP, cutoff);
-#if DEBUG
-	std::cerr<<"  E1 = L2.Q2.U2.P2"<<std::endl;
-	write_field(F,std::cerr,SE,M-mo2,N-no2,ld4);	
-#endif	
-// 	tim.stop();
-// 	std::cerr<<"LQUP2:"<<tim.realtime()<<std::endl;
-// 	tim.start();
-
-	// [I2;F2] = L2^-1.I1
-	solveLB( F, FflasLeft, mloc, no2-q1, q2, SE, ld4, Q2, SW+q1, ld3);
-#if DEBUG
-	std::cerr<<"  [I2;F2] = L2^-1.I1"<<std::endl;
-	write_field(F,std::cerr,SW,M-mo2,no2,ld3);	
-#endif	
-	// I1 = Q2^-1.I1
-	applyP( F, FflasLeft, FflasNoTrans, no2-q1, 0, mloc, SW+q1, ld3, Q2 );
-#if DEBUG
-	std::cerr<<"I1 = Q2^-1.I1"<<std::endl;
-	write_field(F,std::cerr,SW,mloc,no2,ld3);
- #endif	
-
-	// B1 = B1.P2
-	applyP( F, FflasRight, FflasTrans, mo2, 0, q2, NE, ld2, P2 );
-#if DEBUG
-	std::cerr<<"B1 = B1.P2"<<std::endl;
-	write_field(F,std::cerr,NE,mo2,N-no2,ld2);
-#endif	
-	// Updating P
-	//	for (size_t i=no2;i<N;++i)
-	//	P[i] += no2;
-// 	tim.stop();
-// 	std::cerr<<"L2^-1:"<<tim.realtime()<<std::endl;
-// 	tim.start();
-
-	//alternative: de 0 a q2 avant
-	// N2 = B1_{q1+1,mo2} . V2^-1
-	ftrsm(F, FflasRight, FflasUpper,FflasNoTrans,FflasNonUnit, mo2-q1, q2, one, SE, ld4, NE+q1*ld2,ld2);
-// 	tim.stop();
-// 	std::cerr<<"trsm2:"<<tim.realtime()<<std::endl;
-// 	tim.start();
-		
-	// H2 = B1_{q1+1,mo2;q2,N-no2} - N2.E2  
-	fgemm(F, FflasNoTrans, FflasNoTrans, mo2-q1, N-no2-q2, q2, Mone, NE+q1*ld2, ld2, SE+q2, ld4, one, NE+q1*ld2+q2, ld2);
-
-// 	tim.stop();
-// 	std::cerr<<"fgemm12:"<<tim.realtime()<<std::endl;
-// 	tim.start();
-	// O2 = NW_{q1+1,mo2;q1+1,N-no2} = - N2.I2  
-	//write_field (F,cerr<<"avant O2"<<endl, A, M, N, lda);
-
-	fgemm(F, FflasNoTrans, FflasNoTrans, mo2-q1, no2-q1, q2, Mone, NE+q1*ld2, ld2, SW+q1, ld3, zero,
-	      NW+q1*(ld1+1), ld1);
-	//	write_field (F,cerr<<"apres O2"<<endl, A, M, N, lda);
-// 	tim.stop();
-// 	std::cerr<<"fgemm22:"<<tim.realtime()<<std::endl;
-// 	tim.start();
-
-	
-	//Step 3: F2 = L3.Q3.U3.P3
-	mloc = M-mo2-q2;
-	nloc = no2-q1;
-	q3 = LUdivine( F, FflasNonUnit, FflasNoTrans, mloc, nloc, SW+q2*ld3+q1, ld3, P1+q1, Q2+q2, FfpackLQUP, cutoff);
-	
-	// Updating P1,Q2
-	for (size_t i=q1;i<no2;++i)
-		P1[i] += q1;
-	for (size_t i=q2;i<q2+q3;++i)
-		Q2[i] += q2;
-		
-	//Step 3bis: H2 = L3b.Q3b.U3b.P3b
-	mloc = mo2-q1;
-	nloc = N-no2-q2;
-
-	q3b = LUdivine( F, FflasNonUnit, FflasNoTrans, mloc, nloc, NE+q1*ld2+q2, ld2, P2+q2, Q1+q1, FfpackLQUP, cutoff);
-	
-	// Updating P2, Q1
-	for (size_t i = q2; i < q2+q3b; ++i)
-		P2[i] += q2;
-
-// 	tim.stop();
-// 	std::cerr<<"LQUP3et3bis:"<<tim.realtime()<<std::endl;
-// 	tim.start();
-		
-	if (( q3 < no2-q1) && (q3b<mo2-q1)){
-			
-		// [O3;_] = L3b^-1.O2
-		if (q3b>0){
-// 			if ( mo2-q1 < N-no2-q2+q1) 
-// 				// L is expanded to a Lower triangular matrix
-// 				solveLB( F, FflasLeft,mloc, no2-q1, q3b, NE+q1*ld2+q2 , ld2, rP3b, NW+q1*(ld1+1), ld1);
-//			else{
-			//std::cerr<<"USING SOLVELB2"<<std::endl;
-			//no modification of L
-			solveLB2( F, FflasLeft,mloc, no2-q1, q3b, NE+q1*ld2+q2 , ld2, Q1+q1, NW+q1*(ld1+1), ld1);
-//			}
-#if DEBUG
-			std::cerr<<"O2 avant="<<std::endl;
-			write_field(F,std::cerr,NW+q1*(ld1+1),mloc,no2-q1,ld1);
-#endif	
-	
-			// O2 = Q3b^-1.O2
-			applyP( F, FflasLeft, FflasNoTrans, no2-q1, 0, mloc, NW+q1*(ld1+1), ld1, Q1+q1 );
-#if DEBUG
-			std::cerr<<"O2 apres="<<std::endl;
-			write_field(F,std::cerr,NW+q1*(ld1+1),mloc,no2-q1,ld1);
-#endif	
-	
-			//updating Q
-// 			size_t tmp;
-// 			for (size_t j=0;j<mo2-q1;++j)
-// 				if (rP3b[j]!=j){
-// 					//	std::cerr<<"(rP3b["<<j<<"]="<<rP3b[j]<<std::endl;
-// 					tmp = Q[j+q1];
-// 					Q[j+q1] = Q[rP3b[j]+q1];
-// 					Q[rP3b[j]+q1] = tmp;
-// 				}
-				
-			// X2 = X2.P3
-			// Si plusieurs niveaux rec, remplacer X2 par [NW;I2]
-			applyP( F, FflasRight, FflasTrans, mo2-q1-q3b, q1, q1+q3,
-				NW/*+(q1+q3b)*ld1*/, ld1, P1);
-			applyP( F, FflasRight, FflasTrans, q2, q1, q1+q3,
-				SW/*+(q1+q3b)*ld1*/, ld3, P1);
-			
-	
-			// A faire si plusieurs niveaux recursifs
-			// B2 = B2.P3b
-			applyP (F, FflasRight, FflasTrans, q1, q2, q2+q3b,
-				NW, ld2, P2);
-			//flaswp(F,q1,NE,lda,no2+q2,no2+q2+q3b,P,1); 
-			// E2 = E2.P3b
-			applyP (F, FflasRight, FflasTrans, q2, q2, q2+q3b,
-				SE, ld4, P2);
-			//flaswp(F,q2,SE+q2,lda,no2+q2,no2+q2+q3b,P,1); 
-		}
-					
-		// N3 = X2 . D3^-1
-		ftrsm( F, FflasRight, FflasUpper, FflasNoTrans, FflasNonUnit, mo2-q1-q3b, q3, one, SW+q2*ld3+q1, ld3 ,NW+(q1+q3b)*ld1+q1,ld1);
-
-		// T2 = T2 - N3.F3
-		fgemm( F, FflasNoTrans, FflasNoTrans, mo2-q1-q3b, no2-q1-q3,q3, Mone, NW+(q1+q3b)*ld1+q1, ld1, SW+q2*ld3+q3+q1, ld3, one, NW+(q1+q3b)*ld1+q1+q3, ld1 );
-
-
-		//Step 4: T2 = L4.Q4.U4.P4
-		mloc = mo2-q1-q3b;
-		nloc = no2-q1-q3;
-		
-		// size_t * rP4 = new size_t[mloc];
-// 		for (size_t j=0;j<mo2-q1;++j)
-// 			rP4[j]=0;
-		q4 = LUdivine( F, FflasNonUnit, FflasNoTrans, mloc, nloc, NW+(q1+q3b)*ld1+q1+q3, ld1, P1+q1+q3, Q1+q1+q3b, FfpackLQUP, cutoff);
-
-		// Updating P
-		for (size_t i=q1+q3;i<q1+q3+q4;++i)
-			P1[i] += q3;
-
-//		size_t tmp;
-// 			if (rP4[j]!=j){
-// 				//	std::cerr<<"(rP3b["<<j<<"]="<<rP3b[j]<<std::endl;
-// 				tmp = Q[j+q1+q3b];
-// 				Q[j+q1+q3b] = Q[rP3b[j]+q1+q3b];
-// 				Q[rP3b[j]+q1+q3b] = tmp;
-// 			}
-		
-		// A faire si plusieurs niveaux recursifs
-		// [G1;O3] = [G1;O3].P4
-		applyP (F, FflasRight, FflasTrans, q1+q3b, q1+q3, q1+q3+q4,
-			NW, ld1, P1);
-		//flaswp(F,q1+q3b,NE,lda,no2+q2,no2+q2+q3b,P,1); 
-		// [I2;F3] = [I2;F3].P4
-		applyP (F, FflasRight, FflasTrans, q2+q3, q1+q3, q1+q3+q4,
-			SW, ld3, P1);
-		//flaswp(F,q2,SE+q2,lda,no2+q2,no2+q2+q3b,P,1); 
-	}
-	//!!!!!! Attention a appliquer Q4, Q2, Q3, Q3b a gauche !!!!!!!
-	
-	//updating Q1
-	for (size_t i = q1; i < q1+q3b; ++i)
-		Q1[i] += q1;
-	for (size_t i=q1+q3b;i<q1+q3b+q4;++i)
-		Q1[i] += q1 + q3b;
-
-	for (size_t i=0; i<q1; ++i)
-		P[i] = P1[i];
-	for (size_t i=q1; i<q1+q2; ++i)
-		P[i] = P2[i-q1] + no2;
-	for (size_t i=q1+q2; i<q1+q2+q3; ++i)
-		P[i] = P1[i-q2];
-	for (size_t i=q1+q2+q3; i<q1+q2+q3+q3b; ++i)
-		P[i] = P2[i-q1-q3]+no2;
-	for (size_t i=q1+q2+q3+q3b; i<q1+q2+q3+q3b+q4; ++i)
-		P[i] = P1[i-q2-q3b];
-	delete[] P1;
-	delete[] P2;
-
-	for (size_t i=0; i<q1; ++i)
-		Q[i] = Q1[i];
-	for (size_t i=q1; i<q1+q2; ++i)
-		Q[i] = Q2[i-q1] + mo2;
-	for (size_t i=q1+q2; i<q1+q2+q3; ++i)
-		Q[i] = Q2[i-q1] + mo2;
-	for (size_t i=q1+q2+q3; i<q1+q2+q3+q3b; ++i)
-		Q[i] = Q1[i-q2-q3];
-	for (size_t i=q1+q2+q3+q3b; i<q1+q2+q3+q3b+q4; ++i)
-		P[i] = Q1[i-q2-q3];
-	delete[] Q1;
-	delete[] Q2;
-	
-	
-	//write_field (F, cerr<<"avant reordonnancement"<<endl, A, M,N, lda)<<endl;
-	typename Field::Element * R = new typename Field::Element[M*N];
-	size_t ldr = N;
-	// Copying first q1 cols
-	for (size_t i=0; i<q1; ++i)
-		fcopy (F, q1, R+i*ldr, 1, NW+i*ld1,1);
-	for (size_t i=q1; i<q1+q2+q3; ++i)
-		fcopy (F, q1, R+i*ldr, 1, SW+(i-q1)*ld3,1);
-	for (size_t i=q1+q2+q3; i<q2+q3+mo2; ++i)
-		fcopy (F, q1, R+i*ldr, 1, NW+(i-q2-q3)*ld1,1);
-	for (size_t i=q2+q3+mo2; i<M; ++i)
-		fcopy (F, q1, R+i*ldr, 1, SW+(i-mo2)*ld3,1);
-	// Copying q1..q2 cols 
-	for (size_t i=0; i<q1; ++i)
-		fcopy (F, q2, R+q1+i*ldr, 1, NE+i*ld2,1);
-	for (size_t i=q1; i<q1+q2+q3; ++i)
-		fcopy (F, q2, R+q1+i*ldr, 1, SE+(i-q1)*ld4,1);
-	for (size_t i=q1+q2+q3; i<q2+q3+mo2; ++i)
-		fcopy (F, q2, R+q1+i*ldr, 1, NE+(i-q2-q3)*ld2,1);
-	for (size_t i=q2+q3+mo2; i<M; ++i)
-		fcopy (F, q2, R+q1+i*ldr, 1, SE+(i-mo2)*ld4,1);
-	// Copying q2..q3 cols 
-	for (size_t i=0; i<q1; ++i)
-		fcopy (F, q3, R+q1+q2+i*ldr, 1, NW+q1+i*ld1,1);
-	for (size_t i=q1; i<q1+q2+q3; ++i)
-		fcopy (F, q3, R+q1+q2+i*ldr, 1, SW+q1+(i-q1)*ld3,1);
-	for (size_t i=q1+q2+q3; i<q2+q3+mo2; ++i)
-		fcopy (F, q3, R+q1+q2+i*ldr, 1, NW+q1+(i-q2-q3)*ld1,1);
-	for (size_t i=q2+q3+mo2; i<M; ++i)
-		fcopy (F, q3, R+q1+q2+i*ldr, 1, SW+q1+(i-mo2)*ld3,1);
-	// Copying q3..q3b cols 
-	for (size_t i=0; i<q1; ++i)
-		fcopy (F, q3b, R+q1+q2+q3+i*ldr, 1, NE+q2+i*ld2,1);
-	for (size_t i=q1; i<q1+q2+q3; ++i)
-		fcopy (F, q3b, R+q1+q2+q3+i*ldr, 1, SE+q2+(i-q1)*ld4,1);
-	for (size_t i=q1+q2+q3; i<q2+q3+mo2; ++i)
-		fcopy (F, q3b, R+q1+q2+q3+i*ldr, 1, NE+q2+(i-q2-q3)*ld2,1);
-	for (size_t i=q2+q3+mo2; i<M; ++i)
-		fcopy (F, q3b, R+q1+q2+q3+i*ldr, 1, SE+q2+(i-mo2)*ld4,1);
-	// Copying q3b..q4 cols 
-	for (size_t i=0; i<q1; ++i)
-		fcopy (F, q4, R+q1+q2+q3+q3b+i*ldr, 1, NW+q1+q3+i*ld1,1);
-	for (size_t i=q1; i<q1+q2+q3; ++i)
-		fcopy (F, q4, R+q1+q2+q3+q3b+i*ldr, 1, SW+q1+q3+(i-q1)*ld3,1);
-	for (size_t i=q1+q2+q3; i<q2+q3+mo2; ++i)
-		fcopy (F, q4, R+q1+q2+q3+q3b+i*ldr, 1, NW+q1+q3+(i-q2-q3)*ld1,1);
-	for (size_t i=q2+q3+mo2; i<M; ++i)
-		fcopy (F, q4, R+q1+q2+q3+q3b+i*ldr, 1, SW+q1+q3+(i-mo2)*ld3,1);
-	// Copying the last cols 
-	for (size_t i=0; i<q1; ++i)
-		fcopy (F, no2-q1-q3-q4, R+q1+q2+q3+q3b+q4+i*ldr, 1, NW+q1+q3+q4+i*ld1,1);
-	for (size_t i=q1; i<q1+q2+q3; ++i)
-		fcopy (F, no2-q1-q3-q4, R+q1+q2+q3+q3b+q4+i*ldr, 1, SW+q1+q3+q4+(i-q1)*ld3,1);
-	for (size_t i=q1+q2+q3; i<q2+q3+mo2; ++i)
-		fcopy (F, no2-q1-q3-q4, R+q1+q2+q3+q3b+q4+i*ldr, 1, NW+q1+q3+q4+(i-q2-q3)*ld1,1);
-	for (size_t i=q2+q3+mo2; i<M; ++i)
-		fcopy (F, no2-q1-q3-q4, R+q1+q2+q3+q3b+q4+i*ldr, 1, SW+q1+q3+q4+(i-mo2)*ld3,1);
-	// Copying the last cols 
-	for (size_t i=0; i<q1; ++i)
-		fcopy (F, N-no2-q2-q3b, R+no2+q2+q3b+i*ldr, 1, NE+q2+q3b+i*ld2,1);
-	for (size_t i=q1; i<q1+q2+q3; ++i)
-		fcopy (F, N-no2-q2-q3b, R+no2+q2+q3b+i*ldr, 1, SE+q2+q3b+(i-q1)*ld4,1);
-	for (size_t i=q1+q2+q3; i<q2+q3+mo2; ++i)
-		fcopy (F, N-no2-q2-q3b, R+no2+q2+q3b+i*ldr, 1, NE+q2+q3b+(i-q2-q3)*ld2,1);
-	for (size_t i=q2+q3+mo2; i<M; ++i)
-		fcopy (F, N-no2-q2-q3b, R+no2+q2+q3b+i*ldr, 1, SE+q2+q3b+(i-mo2)*ld4,1);
-
-	// A=R : to be improved (avoid allocation of R). To be changed if rec data structure are used
-	for (size_t i=0; i<M; ++i)
-		fcopy (F, N, A+i*lda, 1, R+i*ldr,1);
-	
-	delete[] R;
-	//delete[] Q;
-	// Necessaire:
-	// 1 traiter les flaswp manquants
-	// Facultatif:
-	// 2 permutations de lignes doivent etre coherentes
-	// 3 effectuer les dernieres permutations lignes et colonnes
-	//std::cerr<<q1<<" "<<q2<<" "<<q3<<" "<<q3b<<" "<<q4<<std::endl;
-	return q1+q2+q3+q3b+q4;
-}
diff --git a/linbox/ffpack/ffpack_minpoly.inl b/linbox/ffpack/ffpack_minpoly.inl
deleted file mode 100644
index 6e78a0f..0000000
--- a/linbox/ffpack/ffpack_minpoly.inl
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* ffpack/ffpack_minpoly.inl
- * Copyright (C) 2005 Clement Pernet
- *
- * Written by Clement Pernet <Clement.Pernet at imag.fr>
- *
- * See COPYING for license information.
- */
-
-template <class Field, class Polynomial>
-Polynomial&
-FFPACK::MinPoly( const Field& F, Polynomial& minP, const size_t N,
-			 const typename Field::Element *A, const size_t lda,
-			 typename Field::Element* X, const size_t ldx,
-			 size_t* P, 
-			 const FFPACK_MINPOLY_TAG MinTag = FfpackDense,
-			 const size_t kg_mc =0, 
-			 const size_t kg_mb=0, 
-			 const size_t kg_j=0 ){
-
-	typedef typename Field::Element elt;
-	static elt one,zero;
-	F.init( one, 1.0 );
-	F.init( zero, 0.0 );
-	// nRow is the number of row in the krylov base already computed
-	size_t j, k, nRow = 2;
-	typename Polynomial::iterator it;
-	elt* Xi, *Ui;
-	typename Field::RandIter g (F);
-	bool KeepOn=true;
-	elt* U = new elt[N];
-	// Picking a non zero vector
-	do{
-		for (Ui=U, Xi = X; Ui<U+N; ++Ui, ++Xi){
-			g.random (*Ui);
-		 	*Xi = *Ui;
-			if (!F.isZero(*Ui))
-				KeepOn = false;
-		}
-	}while(KeepOn);
-
-	nRow = 1;
-	// LUP factorization of the Krylov Base Matrix
-	k = LUdivine_construct (F, FflasUnit, N+1, N, A, lda, X, ldx, U, P, true,
-				MinTag, kg_mc, kg_mb, kg_j);
-	//delete[] U;
-	minP.resize(k+1);
-	minP[k] = one;
-	if ( (k==1) && F.isZero(*(X+ldx))){ // minpoly is X
-		delete[] U;
-		for (size_t i=0; i<k; ++i)
-			minP[i] = zero;
-		return minP;
-	}
-	// U contains the k first coefs of the minpoly
-	//elt* m= new elt[k];
-	fcopy( F, k, U, 1, X+k*ldx, 1);
-	ftrsv( F, FflasLower, FflasTrans, FflasNonUnit, k, X, ldx, U, 1);
-	it = minP.begin();
-	for (j=0; j<k; ++j, it++){
-		F.neg(*it, U[j]);
-	}
-	delete[] U;
-	return minP;
-}
diff --git a/linbox/ffpack/ffpack_minpoly_construct.inl b/linbox/ffpack/ffpack_minpoly_construct.inl
deleted file mode 100644
index 13797f5..0000000
--- a/linbox/ffpack/ffpack_minpoly_construct.inl
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* linbox/ffpack/ffpack_minpoly_construct.inl
- * Copyright (C) 2003 Clement Pernet
- *
- * Written by Clement Pernet <Clement.Pernet at imag.fr>
- *
- * See COPYING for license information.
- */
-
-//---------------------------------------------------------------------
-// MinPoly: Compute the minimal polynomial of (A,v) using an LUP 
-// factorization of the Krylov Base (v, Av, .., A^kv)
-// U must be (n+1)*n
-//---------------------------------------------------------------------
-template <class Field, class Polynomial>
-Polynomial&
-LinBox::FFPACK::MinPoly( const Field& F, Polynomial& minP, const size_t N,
-		const typename Field::Element *A, const size_t lda,
-		typename Field::Element* U, size_t ldu,typename Field::Element* X, size_t ldx,
-		size_t* P){
-
-	typedef typename Field::Element elt;
-	static elt one,zero;
-	F.init( one, 1UL );
-	F.init( zero, 0UL );
-	// nRow is the number of row in the krylov base already computed
-	size_t j, k, nRow = 2;
-	elt* B = new elt[ N*N ];
-	typename Polynomial::iterator it;
-	elt* Xi, *Ui;
-	typename Field::RandIter g (F);
-	bool KeepOn=true;
-	// Creating the Krylov Base copy matrix X where to factorize 
-	//elt * X = new elt[(N+1)*N];
-#if DEBUG==2
-	for (j=0;j<(N+1)*N;j++)
-		X[j] = zero;
-#endif
-	// Creating the copy of A, where to compute A^2^i
-	// Try memcopy here
-	for (size_t i=0; i<N; ++i)
-		for ( size_t j=0; j<N; ++j)
-			*(B+i*N+j) = *(A+i*N+j);
-	
-	// Picking a non zero vector
-	do{
-		for (Ui=U, Xi = X; Ui<U+N; ++Ui, ++Xi){
-			g.random (*Ui);
-		 	*Xi = *Ui;
-			if (!F.isZero(*Ui))
-				KeepOn = false;
-		}
-	}while(KeepOn);
-	
-
-	nRow = 1;
-	size_t nUsedRow = 0;
-	// LUP factorization of the Krylov Base Matrix
-	
-	k = LUdivine_construct(F, FflasUnit, N+1, N, B, N, U, ldu, X, N, P,
-			       &nRow, N+1, &nUsedRow );
-	delete[] B;
-	minP.resize(k+1);
-	minP[k] = one;
-	if (k==1 && F.isZero(*(X+N))){ // minpoly is X
-		return minP;
-	}
-	// m contains the k first coefs of the minpoly
-	elt* m= new elt[k];
-	fcopy( F, k, m, 1, X+k*N, 1);
-	ftrsv( F, FflasLower, FflasTrans, FflasNonUnit, k, X, N, m, 1);
-	//delete[] X;
-	it = minP.begin();
-	for (j=0; j<k; ++j, it++){
-		F.neg(*it, m[j]);
-	}
-	delete[] m;
-	return minP;
-}
diff --git a/linbox/field/Makefile.am b/linbox/field/Makefile.am
index 2fe04d6..cb0c3dc 100644
--- a/linbox/field/Makefile.am
+++ b/linbox/field/Makefile.am
@@ -1,64 +1,70 @@
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 pkgincludesubdir=$(pkgincludedir)/field
 
-BASIC_HDRS =			\
-	field-interface.h	\
-	field-traits.h		\
-	rebind.h		\
-	abstract.h		\
-	archetype.h		\
-	envelope.h		\
-	unparametric.h		\
-	param-fuzzy.h		\
-	gmp-rational.h		\
-	modular.h		\
-	modular.inl		\
-	modular-int.h		\
-	modular-int32.h		\
-	modular-short.h		\
-	modular-byte.h		\
-	modular-balanced-double.h	\
-	modular-balanced-float.h	\
-	modular-balanced-int.h		\
-	modular-balanced-int32.h	\
-	modular-double.h	\
-	modular-float.h		\
-	gf2.h			\
-	gf2.inl			\
-	hom.h			\
-	PIR-modular-int.h	\
-	PIR-modular-int32.h	\
-	local2_32.h		\
-	PID-integer.h		\
-	PID-double.h		\
-	block-ring.h		\
-	multimod-field.h
+BASIC_HDRS =            \
+    field-interface.h   \
+    field-traits.h      \
+    rebind.h            \
+    abstract.h          \
+    archetype.h         \
+    envelope.h          \
+    unparametric.h      \
+    param-fuzzy.h       \
+    gmp-rational.h      \
+    modular.h           \
+    modular.inl         \
+    modular-int32.h     \
+    modular-int64.h     \
+    modular-short.h     \
+    modular-byte.h      \
+    modular-balanced.h  \
+    modular-balanced-double.h   \
+    modular-balanced-float.h    \
+    modular-balanced-int32.h    \
+    modular-balanced-int64.h    \
+    modular-crooked-double.h    \
+    modular-double.h    \
+    modular-float.h     \
+    gf2.h               \
+    gf2.inl             \
+    hom.h               \
+    map.h               \
+    PIR-modular-int32.h \
+    local2_32.h         \
+    PID-integer.h       \
+    PID-double.h        \
+    block-ring.h        \
+    multimod-field.h
 
-NTL_HDRS =				\
-	ntl.h				\
-	ntl-RR.h			\
-	ntl-ZZ_p.h			\
-	ntl-ZZ_pE.h			\
-	ntl-ZZ_pX.h			\
-	ntl-lzz_p.h			\
-	ntl-ZZ.h			\
-	ntl-lzz_pE.h			\
-	ntl-lzz_pX.h			\
-	ntl-GF2E.h			\
-	ntl-pid-lzz_p.h			\
-	PIR-ntl-ZZ_p.h			
+NTL_HDRS =              \
+    ntl.h               \
+    ntl-RR.h            \
+    ntl-ZZ_p.h          \
+    ntl-ZZ_pE.h         \
+    ntl-ZZ_pX.h         \
+    ntl-lzz_p.h         \
+    ntl-ZZ.h            \
+    ntl-lzz_pE.h        \
+    ntl-lzz_pX.h        \
+    ntl-GF2E.h          \
+    ntl-pid-lzz_p.h     \
+    PIR-ntl-ZZ_p.h
 
-GIVARO_HDRS =				\
-	givaro.h			\
-	givaro-zpz.h			\
-	givaro-montg.h			\
-	givaro-zpz.inl			\
-	givaro-gfq.h			\
-	givaro-extension.h		\
-	givaro-rational.h
+GIVARO_HDRS =           \
+    givaro.h            \
+    givaro-zpz.h        \
+    givaro-montg.h      \
+    givaro-zpz.inl      \
+    givaro-gfq.h        \
+    givaro-extension.h  \
+    givaro-field.h      \
+    givaro-rational.h
 
-LIDIA_HDRS =				\
-	lidia.h				\
-	lidia-gfq.h
+LIDIA_HDRS =            \
+    lidia.h             \
+    lidia-gfq.h
 
 if LINBOX_HAVE_NTL
 USE_NTL_HDRS = $(NTL_HDRS)
@@ -72,14 +78,18 @@ if LINBOX_HAVE_LIDIA
 USE_LIDIA_HDRS = $(LIDIA_HDRS)
 endif
 
-pkgincludesub_HEADERS =			\
-	$(BASIC_HDRS)			\
-	$(USE_NTL_HDRS)			\
-	$(USE_GIVARO_HDRS)		\
-	$(USE_LIDIA_HDRS)	
+pkgincludesub_HEADERS =     \
+    $(BASIC_HDRS)           \
+    $(USE_NTL_HDRS)         \
+    $(USE_GIVARO_HDRS)      \
+    $(USE_LIDIA_HDRS)
 
-EXTRA_DIST =				\
-	$(NTL_HDRS)			\
-	$(GIVARO_HDRS)			\
-	$(LIDIA_HDRS)			\
-	field.doxy
+EXTRA_DIST =            \
+    $(NTL_HDRS)         \
+    $(GIVARO_HDRS)      \
+    $(LIDIA_HDRS)       \
+    field.doxy          \
+    modular.doxy        \
+    integers.doxy       \
+    lidia.doxy          \
+    ntl.doxy
diff --git a/linbox/field/Makefile.in b/linbox/field/Makefile.in
index faf2906..c7c68c8 100644
--- a/linbox/field/Makefile.in
+++ b/linbox/field/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -37,19 +38,26 @@ 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 \
-	$(top_srcdir)/macros/blas-check.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
 	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
 	$(top_srcdir)/macros/givaro-check.m4 \
 	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
 	$(top_srcdir)/macros/lidia-check.m4 \
 	$(top_srcdir)/macros/linbox-doc.m4 \
 	$(top_srcdir)/macros/linbox-misc.m4 \
 	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
 	$(top_srcdir)/macros/maple-check.m4 \
 	$(top_srcdir)/macros/ntl-check.m4 \
 	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -62,16 +70,17 @@ DIST_SOURCES =
 am__pkgincludesub_HEADERS_DIST = field-interface.h field-traits.h \
 	rebind.h abstract.h archetype.h envelope.h unparametric.h \
 	param-fuzzy.h gmp-rational.h modular.h modular.inl \
-	modular-int.h modular-int32.h modular-short.h modular-byte.h \
-	modular-balanced-double.h modular-balanced-float.h \
-	modular-balanced-int.h modular-balanced-int32.h \
-	modular-double.h modular-float.h gf2.h gf2.inl hom.h \
-	PIR-modular-int.h PIR-modular-int32.h local2_32.h \
-	PID-integer.h PID-double.h block-ring.h multimod-field.h ntl.h \
-	ntl-RR.h ntl-ZZ_p.h ntl-ZZ_pE.h ntl-ZZ_pX.h ntl-lzz_p.h \
-	ntl-ZZ.h ntl-lzz_pE.h ntl-lzz_pX.h ntl-GF2E.h ntl-pid-lzz_p.h \
-	PIR-ntl-ZZ_p.h givaro.h givaro-zpz.h givaro-montg.h \
-	givaro-zpz.inl givaro-gfq.h givaro-extension.h \
+	modular-int32.h modular-int64.h modular-short.h modular-byte.h \
+	modular-balanced.h modular-balanced-double.h \
+	modular-balanced-float.h modular-balanced-int32.h \
+	modular-balanced-int64.h modular-crooked-double.h \
+	modular-double.h modular-float.h gf2.h gf2.inl hom.h map.h \
+	PIR-modular-int32.h local2_32.h PID-integer.h PID-double.h \
+	block-ring.h multimod-field.h ntl.h ntl-RR.h ntl-ZZ_p.h \
+	ntl-ZZ_pE.h ntl-ZZ_pX.h ntl-lzz_p.h ntl-ZZ.h ntl-lzz_pE.h \
+	ntl-lzz_pX.h ntl-GF2E.h ntl-pid-lzz_p.h PIR-ntl-ZZ_p.h \
+	givaro.h givaro-zpz.h givaro-montg.h givaro-zpz.inl \
+	givaro-gfq.h givaro-extension.h givaro-field.h \
 	givaro-rational.h lidia.h lidia-gfq.h
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
@@ -93,18 +102,21 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
 CC = @CC@
+CCNAM = @CCNAM@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
 DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -112,19 +124,24 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
 GIVARO_CFLAGS = @GIVARO_CFLAGS@
 GIVARO_LIBS = @GIVARO_LIBS@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
 GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
@@ -132,41 +149,52 @@ LIBTOOL = @LIBTOOL@
 LIDIA_CFLAGS = @LIDIA_CFLAGS@
 LIDIA_LIBS = @LIDIA_LIBS@
 LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MAPLE_CFLAGS = @MAPLE_CFLAGS@
 MAPLE_HOME = @MAPLE_HOME@
 MAPLE_LIBS = @MAPLE_LIBS@
 MAPLE_VERSION = @MAPLE_VERSION@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
 NTL_CFLAGS = @NTL_CFLAGS@
 NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RM = @RM@
 SACLIB_CFLAGS = @SACLIB_CFLAGS@
 SACLIB_LIBS = @SACLIB_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+TESTS_CFLAGS = @TESTS_CFLAGS@
 VERSION = @VERSION@
+WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -207,83 +235,95 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 pkgincludesubdir = $(pkgincludedir)/field
 BASIC_HDRS = \
-	field-interface.h	\
-	field-traits.h		\
-	rebind.h		\
-	abstract.h		\
-	archetype.h		\
-	envelope.h		\
-	unparametric.h		\
-	param-fuzzy.h		\
-	gmp-rational.h		\
-	modular.h		\
-	modular.inl		\
-	modular-int.h		\
-	modular-int32.h		\
-	modular-short.h		\
-	modular-byte.h		\
-	modular-balanced-double.h	\
-	modular-balanced-float.h	\
-	modular-balanced-int.h		\
-	modular-balanced-int32.h	\
-	modular-double.h	\
-	modular-float.h		\
-	gf2.h			\
-	gf2.inl			\
-	hom.h			\
-	PIR-modular-int.h	\
-	PIR-modular-int32.h	\
-	local2_32.h		\
-	PID-integer.h		\
-	PID-double.h		\
-	block-ring.h		\
-	multimod-field.h
+    field-interface.h   \
+    field-traits.h      \
+    rebind.h            \
+    abstract.h          \
+    archetype.h         \
+    envelope.h          \
+    unparametric.h      \
+    param-fuzzy.h       \
+    gmp-rational.h      \
+    modular.h           \
+    modular.inl         \
+    modular-int32.h     \
+    modular-int64.h     \
+    modular-short.h     \
+    modular-byte.h      \
+    modular-balanced.h  \
+    modular-balanced-double.h   \
+    modular-balanced-float.h    \
+    modular-balanced-int32.h    \
+    modular-balanced-int64.h    \
+    modular-crooked-double.h    \
+    modular-double.h    \
+    modular-float.h     \
+    gf2.h               \
+    gf2.inl             \
+    hom.h               \
+    map.h               \
+    PIR-modular-int32.h \
+    local2_32.h         \
+    PID-integer.h       \
+    PID-double.h        \
+    block-ring.h        \
+    multimod-field.h
 
 NTL_HDRS = \
-	ntl.h				\
-	ntl-RR.h			\
-	ntl-ZZ_p.h			\
-	ntl-ZZ_pE.h			\
-	ntl-ZZ_pX.h			\
-	ntl-lzz_p.h			\
-	ntl-ZZ.h			\
-	ntl-lzz_pE.h			\
-	ntl-lzz_pX.h			\
-	ntl-GF2E.h			\
-	ntl-pid-lzz_p.h			\
-	PIR-ntl-ZZ_p.h			
+    ntl.h               \
+    ntl-RR.h            \
+    ntl-ZZ_p.h          \
+    ntl-ZZ_pE.h         \
+    ntl-ZZ_pX.h         \
+    ntl-lzz_p.h         \
+    ntl-ZZ.h            \
+    ntl-lzz_pE.h        \
+    ntl-lzz_pX.h        \
+    ntl-GF2E.h          \
+    ntl-pid-lzz_p.h     \
+    PIR-ntl-ZZ_p.h
 
 GIVARO_HDRS = \
-	givaro.h			\
-	givaro-zpz.h			\
-	givaro-montg.h			\
-	givaro-zpz.inl			\
-	givaro-gfq.h			\
-	givaro-extension.h		\
-	givaro-rational.h
+    givaro.h            \
+    givaro-zpz.h        \
+    givaro-montg.h      \
+    givaro-zpz.inl      \
+    givaro-gfq.h        \
+    givaro-extension.h  \
+    givaro-field.h      \
+    givaro-rational.h
 
 LIDIA_HDRS = \
-	lidia.h				\
-	lidia-gfq.h
+    lidia.h             \
+    lidia-gfq.h
 
 @LINBOX_HAVE_NTL_TRUE at USE_NTL_HDRS = $(NTL_HDRS)
 @LINBOX_HAVE_GIVARO_TRUE at USE_GIVARO_HDRS = $(GIVARO_HDRS)
 @LINBOX_HAVE_LIDIA_TRUE at USE_LIDIA_HDRS = $(LIDIA_HDRS)
 pkgincludesub_HEADERS = \
-	$(BASIC_HDRS)			\
-	$(USE_NTL_HDRS)			\
-	$(USE_GIVARO_HDRS)		\
-	$(USE_LIDIA_HDRS)	
+    $(BASIC_HDRS)           \
+    $(USE_NTL_HDRS)         \
+    $(USE_GIVARO_HDRS)      \
+    $(USE_LIDIA_HDRS)
 
 EXTRA_DIST = \
-	$(NTL_HDRS)			\
-	$(GIVARO_HDRS)			\
-	$(LIDIA_HDRS)			\
-	field.doxy
+    $(NTL_HDRS)         \
+    $(GIVARO_HDRS)      \
+    $(LIDIA_HDRS)       \
+    field.doxy          \
+    modular.doxy        \
+    integers.doxy       \
+    lidia.doxy          \
+    ntl.doxy
 
 all: all-am
 
@@ -292,8 +332,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
 	      exit 1;; \
 	  esac; \
 	done; \
@@ -346,7 +386,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
@@ -459,6 +499,8 @@ dvi-am:
 
 html: html-am
 
+html-am:
+
 info: info-am
 
 info-am:
@@ -467,18 +509,28 @@ install-data-am: install-pkgincludesubHEADERS
 
 install-dvi: install-dvi-am
 
+install-dvi-am:
+
 install-exec-am:
 
 install-html: install-html-am
 
+install-html-am:
+
 install-info: install-info-am
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-am
 
+install-pdf-am:
+
 install-ps: install-ps-am
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
diff --git a/linbox/field/PID-double.h b/linbox/field/PID-double.h
index 3508964..ebcade2 100644
--- a/linbox/field/PID-double.h
+++ b/linbox/field/PID-double.h
@@ -1,10 +1,11 @@
 /* -*- 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
 /* linbox/field/PID-double.h
- * Copyright (C) 2004 Pascal Giorgi 
+ * Copyright (C) 2004 Pascal Giorgi
  *
  * Written by :
  *               Pascal Giorgi  pascal.giorgi at ens-lyon.fr
- *               
+ *
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -23,83 +24,97 @@
  */
 
 
+/*!  @file field/PID-double.h
+ * @ingroup field
+ * @brief NO DOC
+ */
 
-
-#ifndef __PID_DOUBLE_H
-#define __PID_DOUBLE_H
+#ifndef __LINBOX_pid_double_H
+#define __LINBOX_pid_double_H
 
 #include <linbox/field/unparametric.h>
 #include <linbox/field/field-traits.h>
 
-namespace LinBox {
+namespace LinBox
+{
 
 
-	/// \ingroup ring
-	class PID_double : public UnparametricField<double> 
-	{
+	/*! \ingroup integers
+	 * @brief NO DOC
+	 */
+	class PID_double : public UnparametricField<double> {
 
 	public:
 
 		typedef double Element;
 
-		inline static bool isUnit (const Element& x) {
-			
+		/// test if unit (1 or -1)
+		inline static bool isUnit (const Element& x)
+		{
+
 			return (x == double(1))  || (x== double(-1));
 		}
 
-		inline static Element& abs (Element& x, const Element& a) {
+		/// return absolute value
+		inline static Element& abs (Element& x, const Element& a)
+		{
 			x= (a>0)? a: -a;
 			return x;
 		}
 
-		inline static Element abs (const Element& a){
+		/// return absolute value
+		inline static Element abs (const Element& a)
+		{
 			return (a>0)? a: -a;
 		}
-		
-		/** compare two elements, a and b
+
+		/** compare two elements, a and b.
 		 * return 1, if a > b
 		 * return 0, if a = b;
 		 * return -1. if a < b
 		 */
-		inline long compare (const Element& a, const Element& b) const {
-			
+		inline long compare (const Element& a, const Element& b) const
+		{
+
 			return (a>b)? 1: ((a<b)? -1 : 0);
 		}
-		
 
-		/** @brief gcd (g, a, b)
+
+		/** @brief gcd (g, a, b).
 		 *  return g = gcd (a, b)
 		 */
-		inline static Element& gcd (Element& g, const Element& a, const Element& b) {
-				
+		inline static Element& gcd (Element& g, const Element& a, const Element& b)
+		{
+
 			double  u, v, q, r;
 			u = a; v = b;
 
-			if (u < 0) {	  
-				u = -u;				
+			if (u < 0) {
+				u = -u;
 			}
- 
-			if (v < 0) { 	 
+
+			if (v < 0) {
 				v = -v;
-			} 	
- 
+			}
+
 			while (v != 0) {
 				q = floor(u/v);
 				r = u -q*v;
 				u = v;
 				v = r;
 			}
- 
+
 			g = u;
 
 			return g;
 		}
-	
-		/** @brief gcding (g, b)
+
+		/** @brief gcding (g, b).
 		 *  return g = gcd (g, b)
 		 */
-		inline static Element& gcdin (Element& g, const Element& b) {
-			
+		inline static Element& gcdin (Element& g, const Element& b)
+		{
+
 			gcd(g, g, b);
 
 			return g;
@@ -111,25 +126,26 @@ namespace LinBox {
 		 *  Euclidean algorithm applied to |a| and |b|, with the signs then
 		 *  adjusted according to the signs of a and b.
 		 */
-		inline static Element& xgcd (Element& g, Element& s, Element& t, const Element& a, const Element& b){
+		inline static Element& xgcd (Element& g, Element& s, Element& t, const Element& a, const Element& b)
+		{
 			double  u, v, u0, v0, u1, v1, u2, v2, q, r;
- 
+
 			int aneg = 0, bneg = 0;
 			u = a; v = b;
-			if (u < 0) {	  
+			if (u < 0) {
 				u = -u;
 				aneg = 1;
 			}
- 
-			if (v < 0) {	 
+
+			if (v < 0) {
 				v = -v;
 				bneg = 1;
 			}
- 
+
 			u1 = 1; v1 = 0;
 			u2 = 0; v2 = 1;
 
- 
+
 			while (v != 0) {
 				q = floor(u / v);
 				r = u -q*v;
@@ -142,13 +158,13 @@ namespace LinBox {
 				u1 = u0;
 				v1 = v0;
 			}
- 
+
 			if (aneg)
 				u1 = -u1;
- 
+
 			if (bneg)
 				v1 = -v1;
- 
+
 			g = u;
 			s = u1;
 			t = v1;
@@ -159,72 +175,75 @@ namespace LinBox {
 		/** @brief lcm (c, a, b)
 		 *  c = lcm (a, b)
 		 */
-		inline static Element& lcm (Element& c, const Element& a, const Element& b) {
-			
+		inline static Element& lcm (Element& c, const Element& a, const Element& b)
+		{
+
 			if ((a==0.) || (b==0.)) return c = 0.;
-			
+
 			else {
 				Element g;
-			
+
 				gcd (g, a, b);
-				
+
 				c= a*b;
 				c /= g;
 
 				if (c<0) c = -c; //no abs for double, dpritcha
 				// c=abs (c);
-			
+
 				return c;
 			}
 		}
-		
+
 		/** @brief lcmin (l, b)
 		 *  l = lcm (l, b)
 		 */
-		inline static Element& lcmin (Element& l, const Element& b) {
+		inline static Element& lcmin (Element& l, const Element& b)
+		{
 
 			if ((l==0.) || (b==0.)) return l = 0.;
-			
+
 			else {
 				Element g;
-			
+
 				gcd (g, l, b);
-				
+
 				l*= b;
 				l/= g;
-	  
+
 				//l=abs (l);
 				if (l < 0) l = -l;
 				return l;
 			}
-	
+
 		}
 
 
-		inline static long reconstructRational (Element& a, Element& b, const Element& x, const Element& m, 
-							const Element& a_bound, const Element& b_bound) {
-			
+		inline static long reconstructRational (Element& a, Element& b, const Element& x, const Element& m,
+							const Element& a_bound, const Element& b_bound)
+		{
+
 			double  u, v, u0, u1, u2, q, r;
-	
-			u1 = 0; 
-			u2 = 1; 
+
+			u1 = 0;
+			u2 = 1;
 			u = m; v = x;
- 
+
 			while ((v != 0) && ( v > a_bound)) {
 				q = floor(u / v);
 				r = u -q*v;
 				u = v;
 				v = r;
-				u0 = u2;	 
-				u2 =  u1 - q*u2;	 
-				u1 = u0;	
+				u0 = u2;
+				u2 =  u1 - q*u2;
+				u1 = u0;
 			}
-	
+
 			if (u2 < 0.) { u2= -u2; v=-v;}
 			a = v;
 			b = u2;
-	
-			return  (b > b_bound)? 0: 1;	
+
+			return  (b > b_bound)? 0: 1;
 
 		}
 
@@ -232,38 +251,43 @@ namespace LinBox {
 		/** @brief quo (q, x, y)
 		 *  q = floor (x/y);
 		 */
-		inline static Element& quo (Element& q, const Element& a, const Element& b) {
+		inline static Element& quo (Element& q, const Element& a, const Element& b)
+		{
 			return  q = floor (a/b);
 		}
-      
+
 		/** @brief rem (r, a, b)
 		 *  r = remindar of  a / b
 		 */
-		inline static Element& rem (Element& r, const Element& a, const Element& b)  {
+		inline static Element& rem (Element& r, const Element& a, const Element& b)
+		{
 			Element q;
 			return r= a - quo(q,a,b)*b  ;
-		}	
+		}
 
 		/** @brief quoin (a, b)
 		 *  a = quotient (a, b)
 		 */
-		inline static Element& quoin (Element& a, const Element& b)  {
+		inline static Element& quoin (Element& a, const Element& b)
+		{
 			return quo(a,a,b);
 		}
 
 		/** @brief quoin (a, b)
 		 *  a = quotient (a, b)
 		 */
-		inline static Element& remin (Element& a, const Element& b)  {
+		inline static Element& remin (Element& a, const Element& b)
+		{
 			return rem(a,a,b);
 		}
 
-		
-		/** @brief quoRem (q, r, a, b)				
+
+		/** @brief quoRem (q, r, a, b)
 		 * q = [a/b], r = a - b*q
 		 * |r| < |b|, and if r != 0, sign(r) = sign(b)
 		 */
-		inline static void quoRem (Element& q, Element& r, const Element& a, const Element& b) {
+		inline static void quoRem (Element& q, Element& r, const Element& a, const Element& b)
+		{
 			quo(q,a,b);
 			r = a - q*b;
 		}
@@ -271,30 +295,43 @@ namespace LinBox {
 		/** @brief isDivisor (a, b)
 		 *  Test if a | b.
 		 */
-		inline static bool isDivisor (const Element& a, const Element& b) {
+		inline static bool isDivisor (const Element& a, const Element& b)
+		{
 			double r;
 			return rem(r,a,b)==0.;
 		}
 
 		// some specializations and conversions
 		double& convert(double& x, const Element& y) const
-		{ return x=y;}
+		{
+			return x=y;
+		}
+
+		Element& init(Element& x, const double& y) const
+		{
+			return x=y;
+		}
 
-		Element& init(Element& x, const double& y) const 
-		{ return x=y;}
-      
 		integer& convert(integer& x, const Element& y) const
-		{ return x=(integer)y;}
-      
-		Element& init(Element& x, const integer& y) const 
-		{ return x=(double)y;}
+		{
+			return x=(integer)y;
+		}
+
+		Element& init(Element& x, const integer& y) const
+		{
+			return x=(double)y;
+		}
 
 
 	}; //end of class PID_double
 
 	template<>
 	std::ostream &UnparametricField<double>::write (std::ostream &os) const
-	{ return os << "unparam<double>"; }
+	{
+		return os << "unparam<double>";
+	}
 
 } //end of namespace LinBox
-#endif
+#endif //__LINBOX_pid_double_H
+
+
diff --git a/linbox/field/PID-integer.h b/linbox/field/PID-integer.h
index 9b1d490..b888c73 100644
--- a/linbox/field/PID-integer.h
+++ b/linbox/field/PID-integer.h
@@ -1,10 +1,11 @@
-/* -*- mode: C++; tab-width:8; indent-tabs-mode: t; c-basic-offset:8 -*- */
+/* -*- 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
 /* linbox/field/PID-integer.h
- * Copyright (C) 2004 Pascal Giorgi 
+ * Copyright (C) 2004 Pascal Giorgi
  *
  * Written by :
  *               Pascal Giorgi  pascal.giorgi at ens-lyon.fr
- *               
+ *
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -22,72 +23,111 @@
  * Boston, MA 02111-1307, USA.
  */
 
+/** @file field/PID-integer.h
+ * @ingroup field
+ * @brief NO DOC
+*/
 
+#ifndef __LINBOX_pid_integer_H
+#define __LINBOX_pid_integer_H
 
-
-#ifndef __PID_INTEGER_H
-#define __PID_INTEGER_H
-
-#include <limits.h>			    
+#include <limits.h>
 #include <iostream>
+// #include <gmp++/gmp++_int.h>
 #include <linbox/integer.h>
 #include <linbox/field/unparametric.h>
 #include <linbox/field/field-traits.h>
+#include <linbox/field/gmp-rational.h>
 
 
-
-namespace LinBox {
+namespace LinBox
+{
 
 	template <class Ring>
 	class ClassifyRing;
 
-	/// \ingroup ring
-	class PID_integer : public UnparametricField<integer> 
+	/*! \ingroup integers
+	 * @brief Domain for integer operations.
+	 */
+	class PID_integer : public UnparametricField<integer>
 	{
 
 	public:
 
+		//PID_integer(){}
+		//PID_integer& operator=(PID_integer& K) { return *this; }
+
 		typedef integer Element;
 
-		inline Element& axpyin (integer &r, const integer& a, const integer& x) const {
+		/// axpyin
+		inline Element& axpyin (integer &r, const integer& a, const integer& x) const
+		{
 			return Integer::axpyin(r,a,x);
 		}
 
-		inline  bool isUnit (const Element& x) const { 
-			
+		/// axmyin
+		inline Element& axmyin (integer &r, const integer& a, const integer& x) const
+		{
+			return Integer::axmyin(r,a,x);
+		}
+
+		/// maxpyin
+		inline Element& maxpyin (integer &r, const integer& a, const integer& x) const
+		{
+			// return Integer::maxpyin(r,a,x);
+			return Integer::axpyin(r,-a,x);
+		}
+
+		/// axpy
+		inline Element& axpy (integer &r, const integer& a, const integer& x, const integer& y) const
+		{
+			return Integer::axpy(r,a,x,y);//r = ax+y
+		}
+
+		/// isUnit
+		inline  bool isUnit (const Element& x) const
+		{
+
 			return (x == Element(1))  || (x== Element(-1));
 		}
 
-		inline  Element& abs(Element& x, const Element& a) const {
+		/// abs
+		inline  Element& abs(Element& x, const Element& a) const
+		{
 			x= (a>0)? a: -a;
 			return x;
 		}
 
-		inline  Element abs(const Element& a) const {
+		/// abs
+		inline  Element abs(const Element& a) const
+		{
 			return (a>0)? a: -a;
 		}
 
-		/** compare two elements, a and b
-		  * return 1, if a > b
-		  * return 0, if a = b;
-		  * return -1. if a < b
-		  */
-		inline long compare (const Element& a, const Element& b) const {
-			
+		/** compare two elements, a and b.
+		 * return 1, if a > b
+		 * return 0, if a = b;
+		 * return -1. if a < b
+		 */
+		inline long compare (const Element& a, const Element& b) const
+		{
+
 			return (a>b)? 1: ((a<b)? -1 : 0);
 		}
-		
+
 		/** @brief gcd (g, a, b)
 		 *  return g = gcd (a, b)
 		 */
-		inline  Element& gcd (Element& g, const Element& a, const Element& b) const {
-			return ::gcd(g,a,b);
+		inline  Element& gcd (Element& g, const Element& a, const Element& b) const
+		{
+			return ::Givaro::gcd(g,a,b);
 		}
-	
+
 		/** @brief gcdin(g, b)
 		 *  return g = gcd (g, b)
 		 */
-		inline  Element& gcdin (Element& g, const Element& b) const {
+		inline  Element& gcdin (Element& g, const Element& b) const
+		{
 			gcd(g, g, b);
 			return g;
 		}
@@ -98,107 +138,109 @@ namespace LinBox {
 		 *  Euclidean algorithm applied to |a| and |b|, with the signs then
 		 *  adjusted according to the signs of a and b.
 		 */
-		inline  Element& xgcd (Element& g, Element& s, Element& t, const Element& a, const Element& b) const {
-			return ::gcd(g,a,b,s,t);
+		inline  Element& xgcd (Element& g, Element& s, Element& t, const Element& a, const Element& b) const
+		{
+			return ::Givaro::gcd(g,a,b,s,t);
 		}
 
 		/** @brief lcm (c, a, b)
 		 *  c = lcm (a, b)
 		 */
-		inline  Element& lcm (Element& c, const Element& a, const Element& b) const {
-			
+		inline  Element& lcm (Element& c, const Element& a, const Element& b) const
+		{
+
 			if ((a==Element(0)) || (b==Element(0))) return c = Element(0);
-			
+
 			else {
 				Element g;
-			
 				gcd (g, a, b);
-				
 				c= a*b;
 				c /= g;
-
 				c=abs (c);
-			
 				return c;
 			}
 		}
-		
+
 		/** @brief lcmin (l, b)
 		 *  l = lcm (l, b)
 		 */
-		inline  Element& lcmin (Element& l, const Element& b) const {
+		inline  Element& lcmin (Element& l, const Element& b) const
+		{
 
 			if ((l==Element(0)) || (b==Element(0))) return l = Element(0);
-			
+
 			else {
 				Element g;
-			
 				gcd (g, l, b);
-				
 				l*= b;
 				l/= g;
-
 				l=abs (l);
-			
 				return l;
 			}
-	
-		}
-            
-                inline  void reconstructRational (Element& a, Element& b, const Element& x, const Element& m) const {
-                        RationalReconstruction(a,b, x, m, ::sqrt(m), true, true);
-                }
-            
-                inline  void reconstructRational (Element& a, Element& b, const Element& x, const Element& m, const Element& bound) const {
-                        RationalReconstruction(a,b, x, m, bound, true, true);
-                }
-            
-                inline  long reconstructRational (Element& a, Element& b, 
-                                                        const Element& x, const Element& m, 
-                                                        const Element& a_bound, const Element& b_bound) const {
-                    Element bound = x/b_bound;
-                    // if (bound>a_bound) std::cerr << "a_bound: " << a_bound << ", x/b_bound: " << bound << std::endl;
-                    
-                    RationalReconstruction(a,b,x,m, (bound>a_bound?bound:a_bound), true, false);
-                    return  (b > b_bound)? 0: 1;	
-                }
-           
- 
+		}
+
+		inline  void reconstructRational (Element& a, Element& b, const Element& x, const Element& m) const
+		{
+			RationalReconstruction(a,b, x, m, ::Givaro::sqrt(m), true, true);
+		}
+
+		inline  void reconstructRational (Element& a, Element& b, const Element& x, const Element& m, const Element& bound) const
+		{
+			RationalReconstruction(a,b, x, m, bound, true, true);
+		}
+
+		inline  long reconstructRational (Element& a, Element& b,
+						  const Element& x, const Element& m,
+						  const Element& a_bound, const Element& b_bound) const
+		{
+			Element bound = x/b_bound;
+			// if (bound>a_bound) std::cerr << "a_bound: " << a_bound << ", x/b_bound: " << bound << std::endl;
+
+			RationalReconstruction(a,b,x,m, (bound>a_bound?bound:a_bound), true, false);
+			return  (b > b_bound)? 0: 1;
+		}
+
+
 
 		/** @brief quo (q, x, y)
 		 *  q = floor (x/y);
 		 */
-		inline  Element& quo (Element& q, const Element& a, const Element& b) const {
+		inline  Element& quo (Element& q, const Element& a, const Element& b) const
+		{
 			return  q = a/b;
 		}
-      
+
 		/** @brief rem (r, a, b)
 		 *  r = remindar of  a / b
 		 */
-		inline  Element& rem (Element& r, const Element& a, const Element& b)  const {
+		inline  Element& rem (Element& r, const Element& a, const Element& b)  const
+		{
 			return Integer::mod(r,a,b);
-		}	
+		}
 
 		/** @brief quoin (a, b)
 		 *  a = quotient (a, b)
 		 */
-		inline  Element& quoin (Element& a, const Element& b)  const {
+		inline  Element& quoin (Element& a, const Element& b)  const
+		{
 			return quo(a,a,b);
 		}
 
 		/** @brief quoin (a, b)
 		 *  a = quotient (a, b)
 		 */
-		inline  Element& remin (Element& a, const Element& b)  const {
+		inline  Element& remin (Element& a, const Element& b)  const
+		{
 			return rem(a,a,b);
 		}
 
-		
-		/** @brief quoRem (q, r, a, b)				
+
+		/** @brief quoRem (q, r, a, b)
 		 * q = [a/b], r = a - b*q
 		 * |r| < |b|, and if r != 0, sign(r) = sign(b)
 		 */
-		inline  void quoRem (Element& q, Element& r, const Element& a, const Element& b) const {
+		inline  void quoRem (Element& q, Element& r, const Element& a, const Element& b) const
+		{
 			quo(q,a,b);
 			r = a - q*b;
 		}
@@ -206,7 +248,8 @@ namespace LinBox {
 		/** @brief isDivisor (a, b)
 		 *  Test if b | a.
 		 */
-		inline  bool isDivisor (const Element& a, const Element& b) const {
+		inline  bool isDivisor (const Element& a, const Element& b) const
+		{
 			Element r;
 			return rem(r,a,b)==Element(0);
 		}
@@ -214,212 +257,235 @@ namespace LinBox {
 		/** @brief sqrt(x,y)
 		 *  x=floor(sqrt(y))
 		 */
-		inline Element& sqrt(Element& x, const Element& y) const {
-			return ::sqrt(x,y);
-		}
-
-                inline  Element powtwo(Element& z, const Element& x) const {
-                        z = 1;
-                        //cout << "max" << ULONG_MAX << "x" << x << "?" << (x < ULONG_MAX);
-                        if (x < LONG_MAX) {
-                                z<<=(long int)x;
-                                //cout << "z"<< z;
-                                return z;
-                        } else {
-                                Element n,m;
-                                quoRem(n,m,x,(Element)(LONG_MAX-1));
-                                for (int i=0; i < n; ++i) {
-                                        z <<=(long int)(LONG_MAX-1);
-                                }
-                                z <= (long int)m;
-                                return z;
-                        }
-
-                        //for (Element i=0; i < x; ++i) {
-                        //      z <<= 1;
-                        //}
-                        return z;
-                }
-
-                inline  Element logtwo(Element& z, const Element& x) const {
-                        //cout << "x" << x;
-                        if (x<1) return z=-1;
-                        z = 0;
-                        Element cur = x;
-                        cur >>=1;//cout << "cur" << cur;
-                        while (cur > 0) {
-                                //cout << "cur" << cur;
-                                ++z;
-                                cur >>=1;
-                        }
-                        //cout << "z" << z;
-                        return z;
-                }
+		inline Element& sqrt(Element& x, const Element& y) const
+		{
+			return ::Givaro::sqrt(x,y);
+		}
+
+		inline  Element powtwo(Element& z, const Element& x) const
+		{
+			z = 1;
+			if (x < 0) return z;
+			if (x < ULONG_MAX) {
+				z<<=(unsigned long int)x;
+				//cout << "z"<< z;
+				return z;
+			}
+			else {
+				Element n,m;
+				quoRem(n,m,x,(Element)(LONG_MAX-1));
+				for (int i=0; i < n; ++i) {
+					z <<=(long int)(LONG_MAX-1);
+				}
+				z <= (long int)m;
+				return z;
+			}
+
+			//for (Element i=0; i < x; ++i) {
+			//      z <<= 1;
+			//}
+			//return z; // BB peut pas !
+		}
+
+		inline  Element logtwo(Element& z, const Element& x) const
+		{
+			z = x.bitsize()-1;
+			return z;
+			/*
+			   if (x<1) return z=-1;
+			   z = 0;
+			   Element cur = x;
+			   cur >>=1;//cout << "cur" << cur;
+			   while (cur > 0) {
+			//cout << "cur" << cur;
+			++z;
+			cur >>=1;
+			}
+			//cout << "z" << z;
+			return z;
+			*/
+		}
 
 
 
 		// some specializations and conversions
 		inline double& convert(double& x, const Element& y) const
-		{ return x= (double)y;}
+		{
+			return x= (double)y;
+		}
+
+		inline Element& init(Element& x, const double& y) const
+		{
+			return x=Element(y);
+		}
 
-		inline Element& init(Element& x, const double& y) const 
-		{ return x=Element(y);}
-      
 		inline integer& convert(integer& x, const Element& y) const
-		{ return x=y;}
-      
-		inline Element& init(Element& x, const integer& y = 0) const 
-		{ return x=y;}
-        protected:
-                    // Rational number reconstruction: 
-                    // num/den \equiv f modulo m, with |num|<k and 0 < |den| \leq f/k
-                    // See [von zur Gathen & Gerhard, Modern Computer Algebra, 
-                    //      5.10, Cambridge Univ. Press 1999]
-                inline void RationalReconstruction( Element& a, Element& b, 
-                                                          const Element& f, const Element& m, 
-                                                          const Element& k, 
-                                                          bool reduce, bool recursive ) const {
+		{
+			return x=y;
+		}
+
+		inline Element& init(Element& x, const integer& y = 0) const
+		{
+			return x=y;
+		}
+		/*
+		 * aniau at astronet.pl 06/2009 initialization form GMPRationalElement
+		 */
+		inline Element& init(Element& x, const GMPRationalElement& q) const
+		{
+			GMPRationalField Q;
+			return Q.convert(x,q);
+		}
+
+		inline std::ostream &write (std::ostream &os) const
+		{
+			return os << "PID_integer extends unparam<integer>";
+		}
+
+		inline std::ostream &write (std::ostream &os, const Integer& I) const
+		{
+			return os << I;
+		}
+
+	protected:
+		/*! Rational number reconstruction.
+		* \f$\frac{n}{d} \equiv f \mod m\f$, with \f$\vert n
+		 \vert <k\f$ and \f$0 < \vert d \vert \leq \frac{f}{k}\f$.
+		* @bib
+		* - von zur Gathen & Gerhard, <i>Modern Computer Algebra</i>,
+		*      5.10, Cambridge Univ. Press 1999
+		*/
+		inline void RationalReconstruction( Element& a, Element& b,
+						    const Element& f, const Element& m,
+						    const Element& k,
+						    bool reduce, bool recursive ) const
+		{
 			Element x(f);
-                        if (x<0) {
-                        	if ((-x)>m)
-                            		x %= m;
-                        	if (x<0)
-                            		x += m;
-                    	} else {
-                        	if (x>m)
-                            		x %= m;
-                    	}
-
-                        if (x == 0) {
-                            a = 0;
-                            b = 1;
-                        } else {
-                            bool res = ratrecon(a,b,x,m,k, reduce, recursive);
-                            if (recursive)
-                                for( Element newk = k + 1; (!res) && (newk<f) ; ++newk)
-                                    res = ratrecon(a,b,x,m,newk,reduce, true);
-                        }
-                }
-
-                // Precondition f is suppposed strictly positive and strictly less than m
-                inline  bool ratrecon( Element& num, Element& den, 
-                                             const Element& f, const Element& m, 
-                                             const Element& k, 
-                                             bool reduce, bool recursive ) const {
-                    
+			if (x<0) {
+				if ((-x)>m)
+					x %= m;
+				if (x<0)
+					x += m;
+			}
+			else {
+				if (x>m)
+					x %= m;
+			}
+
+			if (x == 0) {
+				a = 0;
+				b = 1;
+			}
+			else {
+				bool res = ratrecon(a,b,x,m,k, reduce, recursive);
+				if (recursive)
+					for( Element newk = k + 1; (!res) && (newk<f) ; ++newk)
+						res = ratrecon(a,b,x,m,newk,reduce, true);
+			}
+		}
+
+		// Precondition f is suppposed strictly positive and strictly less than m
+		inline  bool ratrecon( Element& num, Element& den,
+				       const Element& f, const Element& m,
+				       const Element& k,
+				       bool reduce, bool recursive ) const
+		{
+
 			//std::cerr << "RatRecon : " << f << " " << m << " " << k << std::endl;
-                    
-
-                        Element  r0, t0, q, u;
-                        r0=m;
-                        t0=0;
-                        num=f;
-                        den=1;
-                        while(num>=k)
-                        {
-        
-                            q = r0;
-                            q /= num;        // r0/num
-                            
-
-                            u = num;
-                            num = r0;  	// num <-- r0
-                            r0 = u;	// r0 <-- num
-//                             u *= q;
-//                             num -= u;	// num <-- r0-q*num
-			    Integer::axmyin(num,u,q);
-                            if (num == 0) return false;
-                            
-                            u = den;
-                            den = t0;  	// num <-- r0
-                            t0 = u;	// r0 <-- num
-//                             u *= q;
-//                             den -= u;	// num <-- r0-q*num
-			    Integer::axmyin(den,u,q);
-
-                        } 
-
-//                        if (den < 0) {
-//                                Integer::negin(num);
-//                                Integer::negin(den);
-//                        }
- 
-                        if (reduce) {
-    
-                                // [GG, MCA, 1999] Theorem 5.26
-                                // (i)
-//                            if (den < 0) {
-//                                Integer::negin(num);
-//                                Integer::negin(den);
-//                            }
-
-                                // (ii)
-                            Element gg;
-                            if (gcd(gg,num,den) != 1) {
-                                
-                                Element ganum, gar2;
-                                for( q = 1, ganum = r0-num, gar2 = r0 ; (ganum >= k) || (gar2<k); ++q ) {
-					ganum -= num;
-					gar2 -= num;
-                                }
-                                
-//                             r0 -= q * num;
-//                             t0 -= q * den;
-                                Integer::axmyin(r0,q,num);
-                                Integer::axmyin(t0,q,den);
-                                
-                                if (t0 < 0) {
-                                    num = -r0;
-                                    den = -t0;
-                                } else {
-                                    num = r0;
-                                    den = t0;
-                                }
-                                
-//                                if (t0 > m/k) {
-				if (den > m/k) {
-                                    if (!recursive) 
-                                        std::cerr 
-                                            << "*** Error *** No rational reconstruction of " 
-                                            << f 
-                                            << " modulo " 
-                                            << m 
-                                            << " with denominator <= " 
-                                            << (m/k)
-                                            << std::endl;   
-                                }
-                                if (gcd(gg,num,den) != 1) {
-                                    if (!recursive) 
-                                        std::cerr 
-                                            << "*** Error *** There exists no rational reconstruction of " 
-                                            << f 
-                                            << " modulo " 
-                                            << m 
-                                            << " with |numerator| < " 
-                                            << k
-                                            << std::endl
-                                            << "*** Error *** But " 
-                                            << num
-                                            << " = "
-                                            << den
-                                            << " * "
-                                            << f
-                                            << " modulo " 
-                                            << m 
-                                            << std::endl;
-                                    return false;
-                                }
-                            }
-                        }
-                       // (i)
-                       if (den < 0) {
-	                       Integer::negin(num);
-                               Integer::negin(den);
-                       }
-
-// std::cerr << "RatRecon End " << num << "/" << den << std::endl;
-                        return true;    
-                }
+			Element  r0, t0, q, u;
+			r0=m;
+			t0=0;
+			num=f;
+			den=1;
+			while(num>=k)
+			{
+				q = r0;
+				q /= num;   // r0/num
+				u = num;
+				num = r0;  	// num <-- r0
+				r0 = u;	// r0 <-- num
+				maxpyin(num,u,q);
+				//Integer::maxpyin(num,u,q);
+				if (num == 0) return false;
+
+				u = den;
+				den = t0;  	// num <-- r0
+				t0 = u;	// r0 <-- num
+				maxpyin(den,u,q);
+				//Integer::maxpyin(den,u,q);
+			}
+
+			if (reduce) {
+				// [GG, MCA, 1999] Theorem 5.26
+
+				// (ii)
+				Element gg;
+				if (gcd(gg,num,den) != 1) {
+
+					Element ganum, gar2;
+					for( q = 1, ganum = r0-num, gar2 = r0 ; (ganum < k) && (gar2>=k); ++q ) {
+						ganum -= num;
+						gar2 -= num;
+					}
+
+					maxpyin(r0,q,num);
+					//Integer::maxpyin(r0,q,num);
+					maxpyin(t0,q,den);
+					//Integer::maxpyin(t0,q,den);
+
+					if (t0 < 0) {
+						num = -r0;
+						den = -t0;
+					}
+					else {
+						num = r0;
+						den = t0;
+					}
+
+					// if (t0 > m/k)
+					if (den > m/k) {
+						if (!recursive)
+							std::cerr
+							<< "*** Error *** No rational reconstruction of "
+							<< f
+							<< " modulo "
+							<< m
+							<< " with denominator <= "
+							<< (m/k)
+							<< std::endl;
+					}
+					if (gcd(gg,num,den) != 1) {
+						if (!recursive)
+							std::cerr
+							<< "*** Error *** There exists no rational reconstruction of "
+							<< f
+							<< " modulo "
+							<< m
+							<< " with |numerator| < "
+							<< k
+							<< std::endl
+							<< "*** Error *** But "
+							<< num
+							<< " = "
+							<< den
+							<< " * "
+							<< f
+							<< " modulo "
+							<< m
+							<< std::endl;
+						return false;
+					}
+				}
+			}
+			// (i)
+			if (den < 0) {
+				Integer::negin(num);
+				Integer::negin(den);
+			}
+
+			// std::cerr << "RatRecon End " << num << "/" << den << std::endl;
+			return true;
+		}
 
 	}; //end of class PID_integer
 
@@ -427,21 +493,21 @@ namespace LinBox {
 	struct ClassifyRing<PID_integer> {
 		typedef RingCategories::IntegerTag categoryTag;
 	};
-	template<>
-	inline std::ostream &UnparametricField<integer>::write (std::ostream &os) const
-	{ return os << "unparam<integer>"; }
 
-	/*
-	// Specialization for Homomorphism
+
+#if 0 // Specialization for Homomorphism
 	template <class _Target>
-	class Hom<PID_integer, _Target> {
+	class Hom<PID_integer, _Target>
+	{
 	public:
 		typedef PID_integer Source;
 		typedef _Target Target;
 		typedef typename Source::Element SrcElt;
 		typedef typename Target::Element Elt;
-		
-		Hom(const Source& S, const Target& T) : _source (S), _target(T){}
+
+		Hom(const Source& S, const Target& T) :
+			_source (S), _target(T)
+		{}
 
 		Elt& image(Elt& t, const SrcElt& s) {
 			if  (s.bitsize() > 52 )
@@ -459,14 +525,16 @@ namespace LinBox {
 		const Source& source() { return _source;}
 
 		const Target& target() { return _target;}
-		
+
 	protected:
 		double tmp;
 		Source _source;
 		Target _target;
-		
+
 	};
-	
-	*/
-} //end of namespace LinBox
+
 #endif
+} //end of namespace LinBox
+
+#endif //__LINBOX_pid_integer_H
+
diff --git a/linbox/field/PIR-modular-int.h b/linbox/field/PIR-modular-int.h
deleted file mode 100644
index c7aee12..0000000
--- a/linbox/field/PIR-modular-int.h
+++ /dev/null
@@ -1,646 +0,0 @@
-#ifndef __LINBOX_PIR_MODULAR_INT_H
-#define __LINBOX_PIR_MODULAR_INT_H
-
-// This file has been replaced by PIR-modular-int32.h
-
-#include <linbox/field/modular-int.h>
-#ifndef LINBOX_MAX_INT
-#define LINBOX_MAX_INT 2147483647
-#endif
-
-#ifndef LINBOX_MAX_MODULUS
-#define LINBOX_MAX_MODULUS 1073741824
-#endif
-#include <linbox/field/field-traits.h>
-
-// Namespace in which all LinBox code resides
-namespace LinBox 
-{ 
-
-	template< class Element>
-		class PIRModular;
-
-	template< class Element >
-		class ModularRandIter;
-	
-	template<class Field>
-		class DotProductDomain;
-
-	template<class Field>
-		class FieldAXPY;
-
-	template<class Field>
-		class MVProductDomain;
-	
-	template <class Ring>
-	struct ClassifyRIng;
-
-	template <class Element>
-	struct ClassifyRIng<PIRModular<Element> >;
-
-	template <>
-	struct ClassifyRIng<PIRModular<int> >  {
-		typedef RingCategories::ModularTag categoryTag;
-	};
-
-	/// \ingroup ring
-	template <>
-		class PIRModular<int> : public Modular<int> {
-
-		public:	       
-
-		friend class FieldAXPY<PIRModular<int> >;
-		
-                friend class DotProductDomain<PIRModular<int> >;
-		
-		friend class MVProductDomain<PIRModular<int> >;
-	       
-		typedef int Element;
-		
-		typedef ModularRandIter<int> RandIter;
-
-		//default modular field,taking 65521 as default modulus
-		PIRModular () :Modular<int>(65521) {
-		}
-		
-		PIRModular (int value) : Modular<int>(value) {
-		}
-		
-
-		/** PIR functions, gcd, xgcd, dxgcd */
-		
-		Element& gcd (Element& g, const Element& a, const Element& b) const {
-
-			GCD (g, a, b);
-
-			return g;
-
-		} 
-
-		Element& xgcd (Element& g, Element& s, Element& t, const Element& a, const Element& b) const {
-			
-			XGCD (g, s, t, a, b);
-
-			if (s < 0) 
-				s += modulus;
-
-			if (t < 0)
-				t += modulus;
-		
-
-			return g;
-		}
-
-		Element& dxgcd (Element& g, Element& s, Element& t, Element& a1, Element& b1, 
-				const Element& a, const Element& b) const {
-
-
-			xgcd (g, s, t, a, b);
-
-			if (g != 0) {
-
-				a1 = a / g;
-
-				b1 = b / g;
-			}
-
-			else {
-
-				a1 = s;
-
-				b1 = t;
-			}
-
-
-			return g;
-
-		}
-
-		bool isDivisor (const Element& a, const Element& b) const {
-
-			Element g;
-
-			if (a == 0) return false;
-			
-			else if (b == 0) return true;
-			
-			else {
-
-				gcd (g, a, modulus);
-				
-				return (b % g) == 0;
-			}
-
-		}
-			
-		Element& div (Element& d, const Element& a, const Element& b) const {
-			
-			Element g, s;
-
-			HXGCD (g, s, b, modulus);
-			
-			Element r;
-
-			r = a % g;
-
-			if (r != 0) throw PreconditionFailed(__FUNCTION__,__LINE__,"Div: not dividable");
-
-			else {
-
-				d = a / g;
-
-				mulin (d, s);
-			}
-
-			return d;
-			
-		}
-
-		Element& normal (Element& a, const Element& b) const {
-			
-			if (b == 0) return a = 0;
-			else {
-				GCD (a, b, modulus);
-			
-				return a;
-			      }
-		}
-
-
-		Element& gcdin (Element& a, const Element& b) const {
-
-			GCD (a, a, b);
-
-			
-			return a;
-		}
-
-		Element& normalIn (Element& a) const {
-			if (a == 0) return a;
-			else {
-				GCD (a, a, modulus);
-
-				return a;
-			     }
-
-		}
-
-
-		Element& divin (Element& a, const Element& b) const {
-
-			div (a, a, b);
-
-			return a;
-		}
-
-
-		bool isUnit(const Element& a) const {
-
-			Element g;
-
-			GCD (g, a, modulus);
-
-
-		//	std::cout << a << " is a unit or not " << g;
-
-	//		std::cout << "modulus = " << modulus <<"\n";
-
-			return g == 1;
-
-		}
-
-		private:
-		static void GCD (int& g, int a, int b) {
-			
-			int  u, v, q, r;
- 
-			if (a < 0) {
-                                if (a < -LINBOX_MAX_INT) throw PreconditionFailed(__FUNCTION__,__LINE__,"XGCD: integer overflow");
-                                a = -a;
-				
-                        }
- 
-                        if (b < 0) {
-                                if (b < -LINBOX_MAX_INT) throw PreconditionFailed(__FUNCTION__,__LINE__,"XGCD: integer overflow");
-                                b = -b;
-			}
- 
-                        u = a; v = b;
- 
-                        while (v != 0) {
-                                q = u / v;
-                                r = u % v;
-                                u = v;
-                                v = r;
-			}
- 
-			g = u;
-
-                }
-		
-		static void XGCD(int& d, int& s, int& t, int a, int b) {
-                        int  u, v, u0, v0, u1, v1, u2, v2, q, r;
- 
-                        int aneg = 0, bneg = 0;
- 
-                        if (a < 0) {
-                                if (a < -LINBOX_MAX_INT) throw PreconditionFailed(__FUNCTION__,__LINE__,"XGCD: integer overflow");
-                                a = -a;
-                                aneg = 1;
-                        }
- 
-                        if (b < 0) {
-                                if (b < -LINBOX_MAX_INT) throw PreconditionFailed(__FUNCTION__,__LINE__,"XGCD: integer overflow");
-                                b = -b;
-                                bneg = 1;
-                        }
- 
-                        u1 = 1; v1 = 0;
-                        u2 = 0; v2 = 1;
-                        u = a; v = b;
- 
-                        while (v != 0) {
-                                q = u / v;
-                                r = u % v;
-                                u = v;
-                                v = r;
-                                u0 = u2;
-                                v0 = v2;
-                                u2 =  u1 - q*u2;
-                                v2 = v1- q*v2;
-                                u1 = u0;
-                                v1 = v0;
-                        }
- 
-                        if (aneg)
-                                u1 = -u1;
- 
-                        if (bneg)
-                                v1 = -v1;
- 
-                        d = u;
-                        s = u1;
-                        t = v1;
-                }
-
-		
-		static void HXGCD (int& d, int& s, int a, int b) {
-			
-                        int  u, v, u0, u1, u2, q, r;
- 
-                        int aneg = 0;
- 
-                        if (a < 0) {
-                                if (a < -LINBOX_MAX_INT) throw PreconditionFailed(__FUNCTION__,__LINE__,"XGCD: integer overflow");
-                                a = -a;
-                                aneg = 1;
-                        }
- 
-                        if (b < 0) {
-                                if (b < -LINBOX_MAX_INT) throw PreconditionFailed(__FUNCTION__,__LINE__,"XGCD: integer overflow");
-                                b = -b;
-                        }
- 
-                        u1 = 1;
-                        u2 = 0;
-                        u = a; v = b;
- 
-                        while (v != 0) {
-                                q = u / v;
-                                r = u % v;
-                                u = v;
-                                v = r;
-                                u0 = u2;
-                               
-                                u2 =  u1 - q*u2;
-                               
-                                u1 = u0;
-                               
-                        }
- 
-                        if (aneg)
-                                u1 = -u1;
- 
- 
-                        d = u;
-                        s = u1;
-
-                }
-
-	};
-
-	template <>
-		class FieldAXPY<PIRModular<int> > {	  
-		public:
-	  
-		typedef int Element;
-		typedef PIRModular<int> Field;
-	  
-		FieldAXPY (const Field &F) : _F (F),_y(0) {}
-		
-
-		FieldAXPY (const FieldAXPY &faxpy) : _F (faxpy._F), _y (0) {}
-	  
-		FieldAXPY<PIRModular<int> > &operator = (const FieldAXPY &faxpy) {
-			_F = faxpy._F; 
-			_y = faxpy._y; 		       
-			return *this; 
-		}
-	  
-		inline Element& mulacc (const Element &a, const Element &x) {
-			uint64 t = (uint64) a * (uint64) x;
-			_y += t;
-			if (_y < t)
-				return _y += _F._two64;  
-                        else
-                            return _y;
-		}
-
-                    inline Element& accumulate (const Element &t) {
-			_y += t;
-			if (_y < t)
-				return _y += _F._two64;
-                        else
-                            return _y;
-		}
-
-		inline Element& get (Element &y) {
-			y =_y % (uint64) _F.modulus;
-			return y;
-		}
-
-		inline FieldAXPY &assign (const Element y) {
-			_y = y; 
-			return *this;
-		}
-
-		inline void reset() {
-			_y = 0;
-		}
-
-	  
-		protected:
-		Field _F;
-		uint64 _y;		
-	};
-
-
-	template <>
-		class DotProductDomain<PIRModular<int> > : public virtual VectorDomainBase<PIRModular<int> > {	       
-
-		public:	  
-		typedef int Element;	  
-		DotProductDomain (const PIRModular<int> &F)
-			: VectorDomainBase<PIRModular<int> > (F) {}
-	  
-	  
-		protected:
-		template <class Vector1, class Vector2>
-			inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const {
-		  
-			typename Vector1::const_iterator i;
-			typename Vector2::const_iterator j;
-		  
-			uint64 y = 0;
-			uint64 t;
-		  
-			for (i = v1.begin (), j = v2.begin (); i < v1.end (); ++i, ++j) {
-				t = ( (uint64) *i ) * ( (uint64) *j );
-				y += t;
-			  
-				if (y < t)
-					y += _F._two64;
-			}
-		  
-			y %= (uint64) _F.modulus; 
-			return res = y;
-
-		}
-	  
-		template <class Vector1, class Vector2>
-			inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const {		  
-			typename Vector1::first_type::const_iterator i_idx;
-			typename Vector1::second_type::const_iterator i_elt;
-		  
-			uint64 y = 0;
-			uint64 t;
-		  
-			for (i_idx = v1.first.begin (), i_elt = v1.second.begin (); i_idx != v1.first.end (); ++i_idx, ++i_elt) {
-				t = ( (uint64) *i_elt ) * ( (uint64) v2[*i_idx] );
-				y += t;
-			  
-				if (y < t)
-					y += _F._two64;
-			}
-		  
-
-			y %= (uint64) _F.modulus;
-		  
-			return res = y;
-		}
-	};
-	  
-	
-	// Specialization of MVProductDomain for int32 modular field	
-	template <>
-		class MVProductDomain<PIRModular<int32> >
-		{
-		public:
-
-			typedef int32 Element;
-
-		protected:
-			template <class Vector1, class Matrix, class Vector2>
-				inline Vector1 &mulColDense
-				(const VectorDomain<PIRModular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v) const
-				{
-					return mulColDenseSpecialized
-						(VD, w, A, v, VectorTraits<typename Matrix::Column>::VectorCategory ());
-				}
-
-		private:
-			template <class Vector1, class Matrix, class Vector2>
-				Vector1 &mulColDenseSpecialized
-				(const VectorDomain<PIRModular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-				 VectorCategories::DenseVectorTag) const;
-			template <class Vector1, class Matrix, class Vector2>
-				Vector1 &mulColDenseSpecialized
-				(const VectorDomain<PIRModular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-				 VectorCategories::SparseSequenceVectorTag) const;
-			template <class Vector1, class Matrix, class Vector2>
-				Vector1 &mulColDenseSpecialized
-				(const VectorDomain<PIRModular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-				 VectorCategories::SparseAssociativeVectorTag) const;
-			template <class Vector1, class Matrix, class Vector2>
-				Vector1 &mulColDenseSpecialized
-				(const VectorDomain<PIRModular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-				 VectorCategories::SparseParallelVectorTag) const;
-
-			mutable std::vector<uint64> _tmp;
-		};
-
-	template <class Vector1, class Matrix, class Vector2>
-		Vector1 &MVProductDomain<PIRModular<int32> >::mulColDenseSpecialized
-		(const VectorDomain<PIRModular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-		 VectorCategories::DenseVectorTag) const {
-		
-		linbox_check (A.coldim () == v.size ());
-		linbox_check (A.rowdim () == w.size ());
-		
-		typename Matrix::ConstColIterator i = A.colBegin ();
-		typename Vector2::const_iterator j;
-		typename Matrix::Column::const_iterator k;
-		std::vector<uint64>::iterator l;
-
-		uint64 t;
-
-		if (_tmp.size () < w.size ())
-			_tmp.resize (w.size ());
-		
-		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
-		
-		for (j = v.begin (); j != v.end (); ++j, ++i) {
-			for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
-				t = ((uint64) *k) * ((uint64) *j);
-
-				*l += t;
-				
-				if (*l < t)
-					*l += VD.field ()._two64;
-			}
-		}
-		
-		typename Vector1::iterator w_j;
-		
-		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
-			*w_j = *l % VD.field ().modulus;
-		
-		return w;
-	}
-	
-	template <class Vector1, class Matrix, class Vector2>
-		Vector1 &MVProductDomain<PIRModular<int32> >::mulColDenseSpecialized
-		(const VectorDomain<PIRModular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-		 VectorCategories::SparseSequenceVectorTag) const
-		{
-			linbox_check (A.coldim () == v.size ());
-			linbox_check (A.rowdim () == w.size ());
-			
-			typename Matrix::ConstColIterator i = A.colBegin ();
-			typename Vector2::const_iterator j;
-			typename Matrix::Column::const_iterator k;
-			std::vector<uint64>::iterator l;
-			
-			uint64 t;
-			
-			if (_tmp.size () < w.size ())
-				_tmp.resize (w.size ());
-			
-			std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
-			
-			for (j = v.begin (); j != v.end (); ++j, ++i) {
-				for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
-					t = ((uint64) k->second) * ((uint64) *j);
-
-					_tmp[k->first] += t;
-					
-					if (_tmp[k->first] < t)
-						_tmp[k->first] += VD.field ()._two64;
-				}
-			}
-			
-			typename Vector1::iterator w_j;
-			
-			for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
-				*w_j = *l % VD.field ().modulus;
-			
-			return w;
-		}
-	
-	template <class Vector1, class Matrix, class Vector2>
-		Vector1 &MVProductDomain<PIRModular<int32> >::mulColDenseSpecialized
-		(const VectorDomain<PIRModular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-		 VectorCategories::SparseAssociativeVectorTag) const {
-
-		linbox_check (A.coldim () == v.size ());
-		linbox_check (A.rowdim () == w.size ());
-		
-		typename Matrix::ConstColIterator i = A.colBegin ();
-		typename Vector2::const_iterator j;
-		typename Matrix::Column::const_iterator k;
-		std::vector<uint64>::iterator l;
-		
-		uint64 t;
-		
-		if (_tmp.size () < w.size ())
-			_tmp.resize (w.size ());
-		
-		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
-		
-		for (j = v.begin (); j != v.end (); ++j, ++i) {
-			for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
-				t = ((uint64) k->second) * ((uint64) *j);
-				
-				_tmp[k->first] += t;
-				
-				if (_tmp[k->first] < t)
-					_tmp[k->first] += VD.field ()._two64;
-			}
-		}
-		
-		typename Vector1::iterator w_j;
-		
-		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
-			*w_j = *l % VD.field ().modulus;
-		
-		return w;
-	}
-
-	template <class Vector1, class Matrix, class Vector2>
-		Vector1 &MVProductDomain<PIRModular<int32> >::mulColDenseSpecialized
-		(const VectorDomain<PIRModular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-		 VectorCategories::SparseParallelVectorTag) const {
-		
-		linbox_check (A.coldim () == v.size ());
-		linbox_check (A.rowdim () == w.size ());
-		
-		typename Matrix::ConstColIterator i = A.colBegin ();
-		typename Vector2::const_iterator j;
-		typename Matrix::Column::first_type::const_iterator k_idx;
-		typename Matrix::Column::second_type::const_iterator k_elt;
-		std::vector<uint64>::iterator l;
-		
-		uint64 t;
-		
-		if (_tmp.size () < w.size ())
-			_tmp.resize (w.size ());
-		
-		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
-		
-		for (j = v.begin (); j != v.end (); ++j, ++i) {
-			for (k_idx = i->first.begin (), k_elt = i->second.begin (), l = _tmp.begin ();
-			     k_idx != i->first.end ();
-			     ++k_idx, ++k_elt, ++l)
-				{
-					t = ((uint64) *k_elt) * ((uint64) *j);
-
-					_tmp[*k_idx] += t;
-
-					if (_tmp[*k_idx] < t)
-						_tmp[*k_idx] += VD.field ()._two64;
-				}
-		}
-
-		typename Vector1::iterator w_j;
-
-		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
-			*w_j = *l % VD.field ().modulus;
-
-		return w;
-	}
-  	  
-
-} 
-
-#include "linbox/randiter/modular.h"
-#endif
diff --git a/linbox/field/PIR-modular-int32.h b/linbox/field/PIR-modular-int32.h
index a06e295..f3a8ded 100644
--- a/linbox/field/PIR-modular-int32.h
+++ b/linbox/field/PIR-modular-int32.h
@@ -1,6 +1,28 @@
-#ifndef __LINBOX_PIR_MODULAR_INT32_H
-#define __LINBOX_PIR_MODULAR_INT32_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
+/* Copyright (C) 2010 LinBox
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __LINBOX_pir_modular_int32_H
+#define __LINBOX_pir_modular_int32_H
 
 #include <linbox/field/modular-int32.h>
 #ifndef LINBOX_MAX_INT
@@ -13,24 +35,24 @@
 #include <linbox/field/field-traits.h>
 
 // Namespace in which all LinBox code resides
-namespace LinBox 
-{ 
+namespace LinBox
+{
 
 	template< class Element>
-		class PIRModular;
+	class PIRModular;
 
 	template< class Element >
-		class ModularRandIter;
-	
+	class ModularRandIter;
+
 	template<class Field>
-		class DotProductDomain;
+	class DotProductDomain;
 
 	template<class Field>
-		class FieldAXPY;
+	class FieldAXPY;
 
 	template<class Field>
-		class MVProductDomain;
-	
+	class MVProductDomain;
+
 	template <class Ring>
 	struct ClassifyRIng;
 
@@ -38,60 +60,66 @@ namespace LinBox
 	struct ClassifyRIng<PIRModular<Element> >;
 
 	template <>
-	struct ClassifyRIng<PIRModular<int32> >  {
+	struct ClassifyRIng<PIRModular<int32_t> >  {
 		typedef RingCategories::ModularTag categoryTag;
 	};
 
 	/// \ingroup ring
 	template <>
-		class PIRModular<int32> : public Modular<int32> {
+	class PIRModular<int32_t> : public Modular<int32_t> {
+
+	public:
+
+		friend class FieldAXPY<PIRModular<int32_t> >;
+
+		friend class DotProductDomain<PIRModular<int32_t> >;
 
-		public:	       
+		friend class MVProductDomain<PIRModular<int32_t> >;
 
-		friend class FieldAXPY<PIRModular<int32> >;
-		
-                friend class DotProductDomain<PIRModular<int32> >;
-		
-		friend class MVProductDomain<PIRModular<int32> >;
-	       
-		typedef int32 Element;
-		
-		typedef ModularRandIter<int32> RandIter;
+		typedef int32_t Element;
+
+		typedef ModularRandIter<int32_t> RandIter;
 
 		//default modular field,taking 65521 as default modulus
-		PIRModular () :Modular<int32>(65521) {
-		}
-		
-		PIRModular (int32 value, int32 exp = 1) : Modular<int32>(value,exp) {
+		PIRModular () :
+			Modular<int32_t>(65521)
+		{
 		}
-		
+
+		PIRModular (int32_t value, int32_t exp = 1) :
+			Modular<int32_t>(value,exp)
+		{ }
+
 
 		/** PIR functions, gcd, xgcd, dxgcd */
-		
-		Element& gcd (Element& g, const Element& a, const Element& b) const {
+
+		Element& gcd (Element& g, const Element& a, const Element& b) const
+		{
 
 			GCD (g, a, b);
 
 			return g;
 
-		} 
+		}
+
+		Element& xgcd (Element& g, Element& s, Element& t, const Element& a, const Element& b) const
+		{
 
-		Element& xgcd (Element& g, Element& s, Element& t, const Element& a, const Element& b) const {
-			
 			XGCD (g, s, t, a, b);
 
-			if (s < 0) 
+			if (s < 0)
 				s += modulus;
 
 			if (t < 0)
 				t += modulus;
-		
+
 
 			return g;
 		}
 
-		Element& dxgcd (Element& g, Element& s, Element& t, Element& a1, Element& b1, 
-				const Element& a, const Element& b) const {
+		Element& dxgcd (Element& g, Element& s, Element& t, Element& a1, Element& b1,
+				const Element& a, const Element& b) const
+		{
 
 
 			xgcd (g, s, t, a, b);
@@ -115,34 +143,36 @@ namespace LinBox
 
 		}
 
-		bool isDivisor (const Element& a, const Element& b) const {
+		bool isDivisor (const Element& a, const Element& b) const
+		{
 
 			Element g;
 
 			if (a == 0) return false;
-			
+
 			else if (b == 0) return true;
-			
+
 			else {
 
 				gcd (g, a, modulus);
-				
+
 				return (b % g) == 0;
 			}
 
 		}
-			
-		Element& div (Element& d, const Element& a, const Element& b) const {
-			
+
+		Element& div (Element& d, const Element& a, const Element& b) const
+		{
+
 			Element g, s;
 
 			HXGCD (g, s, b, modulus);
-			
+
 			Element r;
 
 			r = a % g;
 
-			if (r != 0) throw PreconditionFailed(__FUNCTION__,__LINE__,"Div: not dividable");
+			if (r != 0) throw PreconditionFailed(__func__,__FILE__,__LINE__,"Div: not dividable");
 
 			else {
 
@@ -152,40 +182,44 @@ namespace LinBox
 			}
 
 			return d;
-			
+
 		}
 
-		Element& normal (Element& a, const Element& b) const {
-			
+		Element& normal (Element& a, const Element& b) const
+		{
+
 			if (b == 0) return a = 0;
 			else {
 				GCD (a, b, modulus);
-			
+
 				return a;
-			      }
+			}
 		}
 
 
-		Element& gcdin (Element& a, const Element& b) const {
+		Element& gcdin (Element& a, const Element& b) const
+		{
 
 			GCD (a, a, b);
 
-			
+
 			return a;
 		}
 
-		Element& normalIn (Element& a) const {
+		Element& normalIn (Element& a) const
+		{
 			if (a == 0) return a;
 			else {
 				GCD (a, a, modulus);
 
 				return a;
-			     }
+			}
 
 		}
 
 
-		Element& divin (Element& a, const Element& b) const {
+		Element& divin (Element& a, const Element& b) const
+		{
 
 			div (a, a, b);
 
@@ -193,183 +227,188 @@ namespace LinBox
 		}
 
 
-		bool isUnit(const Element& a) const {
+		bool isUnit(const Element& a) const
+		{
 
 			Element g;
 
 			GCD (g, a, modulus);
 
 
-		//	std::cout << a << " is a unit or not " << g;
+			//	std::cout << a << " is a unit or not " << g;
 
-	//		std::cout << "modulus = " << modulus <<"\n";
+			//		std::cout << "modulus = " << modulus <<"\n";
 
 			return g == 1;
 
 		}
 
-		private:
-		static void GCD (int32& g, int32 a, int32 b) {
-			
-			int32  u, v, q, r;
- 
+	private:
+		static void GCD (int32_t& g, int32_t a, int32_t b) {
+
+			int32_t  u, v, q, r;
+
 			if (a < 0) {
-                                if (a < -LINBOX_MAX_INT) throw PreconditionFailed(__FUNCTION__,__LINE__,"XGCD: integer overflow");
-                                a = -a;
-				
-                        }
- 
-                        if (b < 0) {
-                                if (b < -LINBOX_MAX_INT) throw PreconditionFailed(__FUNCTION__,__LINE__,"XGCD: integer overflow");
-                                b = -b;
+				if (a < -LINBOX_MAX_INT) throw PreconditionFailed(__func__,__FILE__,__LINE__,"XGCD: integer overflow");
+				a = -a;
+
 			}
- 
-                        u = a; v = b;
- 
-                        while (v != 0) {
-                                q = u / v;
-                                r = u % v;
-                                u = v;
-                                v = r;
+
+			if (b < 0) {
+				if (b < -LINBOX_MAX_INT) throw PreconditionFailed(__func__,__FILE__,__LINE__,"XGCD: integer overflow");
+				b = -b;
 			}
- 
+
+			u = a; v = b;
+
+			while (v != 0) {
+				q = u / v;
+				r = u % v;
+				u = v;
+				v = r;
+			}
+
 			g = u;
 
-                }
-		
-		static void XGCD(int32& d, int32& s, int32& t, int32 a, int32 b) {
-                        int32  u, v, u0, v0, u1, v1, u2, v2, q, r;
- 
-                        int32 aneg = 0, bneg = 0;
- 
-                        if (a < 0) {
-                                if (a < -LINBOX_MAX_INT) throw PreconditionFailed(__FUNCTION__,__LINE__,"XGCD: integer overflow");
-                                a = -a;
-                                aneg = 1;
-                        }
- 
-                        if (b < 0) {
-                                if (b < -LINBOX_MAX_INT) throw PreconditionFailed(__FUNCTION__,__LINE__,"XGCD: integer overflow");
-                                b = -b;
-                                bneg = 1;
-                        }
- 
-                        u1 = 1; v1 = 0;
-                        u2 = 0; v2 = 1;
-                        u = a; v = b;
- 
-                        while (v != 0) {
-                                q = u / v;
-                                r = u % v;
-                                u = v;
-                                v = r;
-                                u0 = u2;
-                                v0 = v2;
-                                u2 =  u1 - q*u2;
-                                v2 = v1- q*v2;
-                                u1 = u0;
-                                v1 = v0;
-                        }
- 
-                        if (aneg)
-                                u1 = -u1;
- 
-                        if (bneg)
-                                v1 = -v1;
- 
-                        d = u;
-                        s = u1;
-                        t = v1;
-                }
-
-		
-		static void HXGCD (int32& d, int32& s, int32 a, int32 b) {
-			
-                        int32  u, v, u0, u1, u2, q, r;
- 
-                        int32 aneg = 0;
- 
-                        if (a < 0) {
-                                if (a < -LINBOX_MAX_INT) throw PreconditionFailed(__FUNCTION__,__LINE__,"XGCD: integer overflow");
-                                a = -a;
-                                aneg = 1;
-                        }
- 
-                        if (b < 0) {
-                                if (b < -LINBOX_MAX_INT) throw PreconditionFailed(__FUNCTION__,__LINE__,"XGCD: integer overflow");
-                                b = -b;
-                        }
- 
-                        u1 = 1;
-                        u2 = 0;
-                        u = a; v = b;
- 
-                        while (v != 0) {
-                                q = u / v;
-                                r = u % v;
-                                u = v;
-                                v = r;
-                                u0 = u2;
-                               
-                                u2 =  u1 - q*u2;
-                               
-                                u1 = u0;
-                               
-                        }
- 
-                        if (aneg)
-                                u1 = -u1;
- 
- 
-                        d = u;
-                        s = u1;
-
-                }
+		}
+
+		static void XGCD(int32_t& d, int32_t& s, int32_t& t, int32_t a, int32_t b) {
+			int32_t  u, v, u0, v0, u1, v1, u2, v2, q, r;
+
+			int32_t aneg = 0, bneg = 0;
+
+			if (a < 0) {
+				if (a < -LINBOX_MAX_INT) throw PreconditionFailed(__func__,__FILE__,__LINE__,"XGCD: integer overflow");
+				a = -a;
+				aneg = 1;
+			}
+
+			if (b < 0) {
+				if (b < -LINBOX_MAX_INT) throw PreconditionFailed(__func__,__FILE__,__LINE__,"XGCD: integer overflow");
+				b = -b;
+				bneg = 1;
+			}
+
+			u1 = 1; v1 = 0;
+			u2 = 0; v2 = 1;
+			u = a; v = b;
+
+			while (v != 0) {
+				q = u / v;
+				r = u % v;
+				u = v;
+				v = r;
+				u0 = u2;
+				v0 = v2;
+				u2 =  u1 - q*u2;
+				v2 = v1- q*v2;
+				u1 = u0;
+				v1 = v0;
+			}
+
+			if (aneg)
+				u1 = -u1;
+
+			if (bneg)
+				v1 = -v1;
+
+			d = u;
+			s = u1;
+			t = v1;
+		}
+
+
+		static void HXGCD (int32_t& d, int32_t& s, int32_t a, int32_t b) {
+
+			int32_t  u, v, u0, u1, u2, q, r;
+
+			int32_t aneg = 0;
+
+			if (a < 0) {
+				if (a < -LINBOX_MAX_INT) throw PreconditionFailed(__func__,__FILE__,__LINE__,"XGCD: integer overflow");
+				a = -a;
+				aneg = 1;
+			}
+
+			if (b < 0) {
+				if (b < -LINBOX_MAX_INT) throw PreconditionFailed(__func__,__FILE__,__LINE__,"XGCD: integer overflow");
+				b = -b;
+			}
+
+			u1 = 1;
+			u2 = 0;
+			u = a; v = b;
+
+			while (v != 0) {
+				q = u / v;
+				r = u % v;
+				u = v;
+				v = r;
+				u0 = u2;
+
+				u2 =  u1 - q*u2;
+
+				u1 = u0;
+
+			}
+
+			if (aneg)
+				u1 = -u1;
+
+
+			d = u;
+			s = u1;
+
+		}
 
 	};
 
 	template <>
-		class FieldAXPY<PIRModular<int32> > {	  
-		public:
-	  
-		typedef int32 Element;
-		typedef PIRModular<int32> Field;
-	  
-		FieldAXPY (const Field &F) : _F (F),_y(0) {}
-		
-
-		FieldAXPY (const FieldAXPY &faxpy) : _F (faxpy._F), _y (0) {}
-	  
-		FieldAXPY<PIRModular<int32> > &operator = (const FieldAXPY &faxpy) {
-			_F = faxpy._F; 
-			_y = faxpy._y; 		       
-			return *this; 
+	class FieldAXPY<PIRModular<int32_t> > {
+	public:
+
+		typedef int32_t Element;
+		typedef PIRModular<int32_t> Field;
+
+		FieldAXPY (const Field &F) :
+			_F (F),_y(0)
+		{}
+
+
+		FieldAXPY (const FieldAXPY &faxpy) :
+			_F (faxpy._F), _y (0)
+		{}
+
+		FieldAXPY<PIRModular<int32_t> > &operator = (const FieldAXPY &faxpy) {
+			_F = faxpy._F;
+			_y = faxpy._y;
+			return *this;
 		}
-	  
-		inline uint64& mulacc (const Element &a, const Element &x) {
-			uint64 t = (uint64) a * (uint64) x;
+
+		inline uint64_t& mulacc (const Element &a, const Element &x) {
+			uint64_t t = (uint64_t) a * (uint64_t) x;
 			_y += t;
 			if (_y < t)
 				return _y += _F._two64;
-                       else
-                            return _y;
+			else
+				return _y;
 		}
 
-                    inline uint64& accumulate (const Element &t) {
+		inline uint64_t& accumulate (const Element &t) {
 			_y += t;
-			if (_y < (uint64)t)
+			if (_y < (uint64_t)t)
 				return _y += _F._two64;
-                        else
-                            return _y;
+			else
+				return _y;
 		}
 
 		inline Element& get (Element &y) {
-			y =_y % (uint64) _F.modulus;
+			y =_y % (uint64_t) _F.modulus;
 			return y;
 		}
 
 		inline FieldAXPY &assign (const Element y) {
-			_y = y; 
+			_y = y;
 			return *this;
 		}
 
@@ -377,257 +416,262 @@ namespace LinBox
 			_y = 0;
 		}
 
-	  
-		protected:
+
+	protected:
 		Field _F;
-		uint64 _y;		
+		uint64_t _y;
 	};
 
 
 	template <>
-		class DotProductDomain<PIRModular<int32> > : public virtual VectorDomainBase<PIRModular<int32> > {	       
-
-		public:	  
-		typedef int32 Element;	  
-		DotProductDomain (const PIRModular<int32> &F)
-			: VectorDomainBase<PIRModular<int32> > (F) {}
-	  
-	  
-		protected:
+	class DotProductDomain<PIRModular<int32_t> > : public virtual VectorDomainBase<PIRModular<int32_t> > {
+
+	public:
+		typedef int32_t Element;
+		DotProductDomain (const PIRModular<int32_t> &F) :
+			VectorDomainBase<PIRModular<int32_t> > (F)
+		{}
+
+
+	protected:
 		template <class Vector1, class Vector2>
-			inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const {
-		  
+		inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
+
 			typename Vector1::const_iterator i;
 			typename Vector2::const_iterator j;
-		  
-			uint64 y = 0;
-			uint64 t;
-		  
+
+			uint64_t y = 0;
+			uint64_t t;
+
 			for (i = v1.begin (), j = v2.begin (); i < v1.end (); ++i, ++j) {
-				t = ( (uint64) *i ) * ( (uint64) *j );
+				t = ( (uint64_t) *i ) * ( (uint64_t) *j );
 				y += t;
-			  
+
 				if (y < t)
 					y += _F._two64;
 			}
-		  
-			y %= (uint64) _F.modulus; 
+
+			y %= (uint64_t) _F.modulus;
 			return res = y;
 
 		}
-	  
+
 		template <class Vector1, class Vector2>
-			inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const {		  
+		inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
 			typename Vector1::first_type::const_iterator i_idx;
 			typename Vector1::second_type::const_iterator i_elt;
-		  
-			uint64 y = 0;
-			uint64 t;
-		  
+
+			uint64_t y = 0;
+			uint64_t t;
+
 			for (i_idx = v1.first.begin (), i_elt = v1.second.begin (); i_idx != v1.first.end (); ++i_idx, ++i_elt) {
-				t = ( (uint64) *i_elt ) * ( (uint64) v2[*i_idx] );
+				t = ( (uint64_t) *i_elt ) * ( (uint64_t) v2[*i_idx] );
 				y += t;
-			  
+
 				if (y < t)
 					y += _F._two64;
 			}
-		  
 
-			y %= (uint64) _F.modulus;
-		  
+
+			y %= (uint64_t) _F.modulus;
+
 			return res = y;
 		}
 	};
-	  
-	
-	// Specialization of MVProductDomain for int32 modular field	
+
+
+	// Specialization of MVProductDomain for int32_t modular field
 	template <>
-		class MVProductDomain<PIRModular<int32> >
+	class MVProductDomain<PIRModular<int32_t> > {
+	public:
+
+		typedef int32_t Element;
+
+	protected:
+		template <class Vector1, class Matrix, class Vector2>
+		inline Vector1 &mulColDense
+		(const VectorDomain<PIRModular<int32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v) const
 		{
-		public:
-
-			typedef int32 Element;
-
-		protected:
-			template <class Vector1, class Matrix, class Vector2>
-				inline Vector1 &mulColDense
-				(const VectorDomain<PIRModular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v) const
-				{
-					return mulColDenseSpecialized
-						(VD, w, A, v, VectorTraits<typename Matrix::Column>::VectorCategory ());
-				}
-
-		private:
-			template <class Vector1, class Matrix, class Vector2>
-				Vector1 &mulColDenseSpecialized
-				(const VectorDomain<PIRModular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-				 VectorCategories::DenseVectorTag) const;
-			template <class Vector1, class Matrix, class Vector2>
-				Vector1 &mulColDenseSpecialized
-				(const VectorDomain<PIRModular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-				 VectorCategories::SparseSequenceVectorTag) const;
-			template <class Vector1, class Matrix, class Vector2>
-				Vector1 &mulColDenseSpecialized
-				(const VectorDomain<PIRModular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-				 VectorCategories::SparseAssociativeVectorTag) const;
-			template <class Vector1, class Matrix, class Vector2>
-				Vector1 &mulColDenseSpecialized
-				(const VectorDomain<PIRModular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-				 VectorCategories::SparseParallelVectorTag) const;
-
-			mutable std::vector<uint64> _tmp;
-		};
+			return mulColDenseSpecialized
+			(VD, w, A, v, typename VectorTraits<typename Matrix::Column>::VectorCategory ());
+		}
+
+	private:
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColDenseSpecialized
+		(const VectorDomain<PIRModular<int32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::DenseVectorTag) const;
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColDenseSpecialized
+		(const VectorDomain<PIRModular<int32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::SparseSequenceVectorTag) const;
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColDenseSpecialized
+		(const VectorDomain<PIRModular<int32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::SparseAssociativeVectorTag) const;
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColDenseSpecialized
+		(const VectorDomain<PIRModular<int32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::SparseParallelVectorTag) const;
+
+		mutable std::vector<uint64_t> _tmp;
+	};
 
 	template <class Vector1, class Matrix, class Vector2>
-		Vector1 &MVProductDomain<PIRModular<int32> >::mulColDenseSpecialized
-		(const VectorDomain<PIRModular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-		 VectorCategories::DenseVectorTag) const {
-		
+	Vector1 &MVProductDomain<PIRModular<int32_t> >::mulColDenseSpecialized
+	(const VectorDomain<PIRModular<int32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+	 VectorCategories::DenseVectorTag) const
+	{
+
 		linbox_check (A.coldim () == v.size ());
 		linbox_check (A.rowdim () == w.size ());
-		
+
 		typename Matrix::ConstColIterator i = A.colBegin ();
 		typename Vector2::const_iterator j;
 		typename Matrix::Column::const_iterator k;
-		std::vector<uint64>::iterator l;
+		std::vector<uint64_t>::iterator l;
 
-		uint64 t;
+		uint64_t t;
 
 		if (_tmp.size () < w.size ())
 			_tmp.resize (w.size ());
-		
+
 		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
-		
+
 		for (j = v.begin (); j != v.end (); ++j, ++i) {
 			for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
-				t = ((uint64) *k) * ((uint64) *j);
+				t = ((uint64_t) *k) * ((uint64_t) *j);
 
 				*l += t;
-				
+
 				if (*l < t)
 					*l += VD.field ()._two64;
 			}
 		}
-		
+
 		typename Vector1::iterator w_j;
-		
+
 		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
 			*w_j = *l % VD.field ().modulus;
-		
+
 		return w;
 	}
-	
+
 	template <class Vector1, class Matrix, class Vector2>
-		Vector1 &MVProductDomain<PIRModular<int32> >::mulColDenseSpecialized
-		(const VectorDomain<PIRModular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-		 VectorCategories::SparseSequenceVectorTag) const
-		{
-			linbox_check (A.coldim () == v.size ());
-			linbox_check (A.rowdim () == w.size ());
-			
-			typename Matrix::ConstColIterator i = A.colBegin ();
-			typename Vector2::const_iterator j;
-			typename Matrix::Column::const_iterator k;
-			std::vector<uint64>::iterator l;
-			
-			uint64 t;
-			
-			if (_tmp.size () < w.size ())
-				_tmp.resize (w.size ());
-			
-			std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
-			
-			for (j = v.begin (); j != v.end (); ++j, ++i) {
-				for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
-					t = ((uint64) k->second) * ((uint64) *j);
-
-					_tmp[k->first] += t;
-					
-					if (_tmp[k->first] < t)
-						_tmp[k->first] += VD.field ()._two64;
-				}
+	Vector1 &MVProductDomain<PIRModular<int32_t> >::mulColDenseSpecialized
+	(const VectorDomain<PIRModular<int32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+	 VectorCategories::SparseSequenceVectorTag) const
+	{
+		linbox_check (A.coldim () == v.size ());
+		linbox_check (A.rowdim () == w.size ());
+
+		typename Matrix::ConstColIterator i = A.colBegin ();
+		typename Vector2::const_iterator j;
+		typename Matrix::Column::const_iterator k;
+		std::vector<uint64_t>::iterator l;
+
+		uint64_t t;
+
+		if (_tmp.size () < w.size ())
+			_tmp.resize (w.size ());
+
+		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
+
+		for (j = v.begin (); j != v.end (); ++j, ++i) {
+			for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
+				t = ((uint64_t) k->second) * ((uint64_t) *j);
+
+				_tmp[k->first] += t;
+
+				if (_tmp[k->first] < t)
+					_tmp[k->first] += VD.field ()._two64;
 			}
-			
-			typename Vector1::iterator w_j;
-			
-			for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
-				*w_j = *l % VD.field ().modulus;
-			
-			return w;
 		}
-	
+
+		typename Vector1::iterator w_j;
+
+		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
+			*w_j = *l % VD.field ().modulus;
+
+		return w;
+	}
+
 	template <class Vector1, class Matrix, class Vector2>
-		Vector1 &MVProductDomain<PIRModular<int32> >::mulColDenseSpecialized
-		(const VectorDomain<PIRModular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-		 VectorCategories::SparseAssociativeVectorTag) const {
+	Vector1 &MVProductDomain<PIRModular<int32_t> >::mulColDenseSpecialized
+	(const VectorDomain<PIRModular<int32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+	 VectorCategories::SparseAssociativeVectorTag) const
+	{
 
 		linbox_check (A.coldim () == v.size ());
 		linbox_check (A.rowdim () == w.size ());
-		
+
 		typename Matrix::ConstColIterator i = A.colBegin ();
 		typename Vector2::const_iterator j;
 		typename Matrix::Column::const_iterator k;
-		std::vector<uint64>::iterator l;
-		
-		uint64 t;
-		
+		std::vector<uint64_t>::iterator l;
+
+		uint64_t t;
+
 		if (_tmp.size () < w.size ())
 			_tmp.resize (w.size ());
-		
+
 		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
-		
+
 		for (j = v.begin (); j != v.end (); ++j, ++i) {
 			for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
-				t = ((uint64) k->second) * ((uint64) *j);
-				
+				t = ((uint64_t) k->second) * ((uint64_t) *j);
+
 				_tmp[k->first] += t;
-				
+
 				if (_tmp[k->first] < t)
 					_tmp[k->first] += VD.field ()._two64;
 			}
 		}
-		
+
 		typename Vector1::iterator w_j;
-		
+
 		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
 			*w_j = *l % VD.field ().modulus;
-		
+
 		return w;
 	}
 
 	template <class Vector1, class Matrix, class Vector2>
-		Vector1 &MVProductDomain<PIRModular<int32> >::mulColDenseSpecialized
-		(const VectorDomain<PIRModular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-		 VectorCategories::SparseParallelVectorTag) const {
-		
+	Vector1 &MVProductDomain<PIRModular<int32_t> >::mulColDenseSpecialized
+	(const VectorDomain<PIRModular<int32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+	 VectorCategories::SparseParallelVectorTag) const
+	{
+
 		linbox_check (A.coldim () == v.size ());
 		linbox_check (A.rowdim () == w.size ());
-		
+
 		typename Matrix::ConstColIterator i = A.colBegin ();
 		typename Vector2::const_iterator j;
 		typename Matrix::Column::first_type::const_iterator k_idx;
 		typename Matrix::Column::second_type::const_iterator k_elt;
-		std::vector<uint64>::iterator l;
-		
-		uint64 t;
-		
+		std::vector<uint64_t>::iterator l;
+
+		uint64_t t;
+
 		if (_tmp.size () < w.size ())
 			_tmp.resize (w.size ());
-		
+
 		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
-		
+
 		for (j = v.begin (); j != v.end (); ++j, ++i) {
 			for (k_idx = i->first.begin (), k_elt = i->second.begin (), l = _tmp.begin ();
 			     k_idx != i->first.end ();
 			     ++k_idx, ++k_elt, ++l)
-				{
-					t = ((uint64) *k_elt) * ((uint64) *j);
+			{
+				t = ((uint64_t) *k_elt) * ((uint64_t) *j);
 
-					_tmp[*k_idx] += t;
+				_tmp[*k_idx] += t;
 
-					if (_tmp[*k_idx] < t)
-						_tmp[*k_idx] += VD.field ()._two64;
-				}
+				if (_tmp[*k_idx] < t)
+					_tmp[*k_idx] += VD.field ()._two64;
+			}
 		}
 
 		typename Vector1::iterator w_j;
@@ -637,9 +681,10 @@ namespace LinBox
 
 		return w;
 	}
-  	  
 
-} 
+
+}
 
 #include "linbox/randiter/modular.h"
-#endif
+#endif //__LINBOX_pir_modular_int32_H
+
diff --git a/linbox/field/PIR-ntl-ZZ_p.h b/linbox/field/PIR-ntl-ZZ_p.h
index 1b2186c..19cc2c8 100644
--- a/linbox/field/PIR-ntl-ZZ_p.h
+++ b/linbox/field/PIR-ntl-ZZ_p.h
@@ -1,12 +1,29 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* linbox/field/PIR-ntl-ZZ_p.h
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) 2010 LinBox
  * written by Zhendong Wan
  *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __PIR_NTL_ZZ_p_H__
-#define __PIR_NTL_ZZ_p_H__
+
+#ifndef __LINBOX_pir_ntl_zz_p_H
+#define __LINBOX_pir_ntl_zz_p_H
 
 #include <linbox/field/unparametric.h>
 #include "linbox/linbox-config.h"
@@ -21,10 +38,10 @@
 
 namespace LinBox
 {
-	
+
 	template<class Field>
 	class FieldAXPY;
-	
+
 	template <class Ring>
 	struct ClassifyRIng;
 
@@ -36,11 +53,11 @@ namespace LinBox
 	};
 
 	/** \brief extend Wrapper of ZZ_p from NTL.  Add PIR functions
-	\ingroup field
-	 */
+	  \ingroup field
+	  */
 
 	class PIR_ntl_ZZ_p : public UnparametricField<NTL::ZZ_p> {
-		
+
 	public:
 		typedef NTL::ZZ_p Element;
 
@@ -55,17 +72,17 @@ namespace LinBox
 			NTL::ZZ_p::init(d);
 
 		}
-		
+
 		PIR_ntl_ZZ_p (const integer& d, int exp = 1 ) {
 
-			if(exp != 1) throw PreconditionFailed(__FUNCTION__,__LINE__,"exponent must be 1");
+			if(exp != 1) throw PreconditionFailed(__func__,__FILE__,__LINE__,"exponent must be 1");
 
 			NTL::ZZ_p::init (NTL::to_ZZ(((std::string)d). c_str()));
 
 		}
 
 		inline static integer& cardinality (integer& c) {
-			
+
 			std::stringstream io;
 
 			io << NTL::ZZ_p::modulus();
@@ -74,12 +91,12 @@ namespace LinBox
 
 			return c;
 		}
-			
+
 		inline static NTL::ZZ& cardinality (NTL::ZZ& c) {
 
 			return c = NTL::ZZ_p::modulus();
 		}
-		
+
 		inline static integer& characteristic (integer& c) {
 
 			std::stringstream  io;
@@ -98,39 +115,39 @@ namespace LinBox
 		std::istream& read (std::istream& in)  {
 			return in;
 		}
-		
-		/** @brief 
+
+		/** @brief
 		 *  Init x from y.
 		 */
 		template<class Element2>
-			inline static Element& init (Element& x,  const Element2& y) {
-			
+		inline static Element& init (Element& x,  const Element2& y) {
+
 			NTL::conv (x, y);
-			
+
 			return x;
 		}
 
 		/** @brief
 		 *   Init from a NTL::ZZ_p
-                 */
-                inline static Element& init (Element& x, const Element& y) {
-	
+		 */
+		inline static Element& init (Element& x, const Element& y) {
+
 			x = y;
 
 			return x;
 		}
 
-		/** @brief 
+		/** @brief
 		 *  I don't  know how to init from integer.
 		 */
 		inline static Element& init (Element& x, const integer& y) {
-		
+
 
 			NTL::conv(x, NTL::to_ZZ( (static_cast<const std::string>(y)).c_str() ) );
 			return x;
 		}
-		
-		/** @brief 
+
+		/** @brief
 		 *  Convert y to an Element.
 		 */
 		static integer& convert (integer& x, const Element& y) {
@@ -141,8 +158,8 @@ namespace LinBox
 			unsigned char* byteArray; byteArray = new unsigned char[(size_t)b ];
 			NTL::BytesFromZZ(byteArray, NTL::rep(y), b);
 			integer base(256);
-																							x= integer(0);
-																							for(long i = b - 1; i >= 0; --i) {
+			x= integer(0);
+			for(long i = b - 1; i >= 0; --i) {
 				x *= base;
 				x += integer(byteArray[i]);
 			}
@@ -152,40 +169,40 @@ namespace LinBox
 			return x;
 		}
 
-		
-		/** @brief 
+
+		/** @brief
 		 *  x = y.
 		 */
 		inline static Element&  assign (Element& x, const Element& y)  {
 			return x = y;
 		}
 
-		/** @brief 
+		/** @brief
 		 *  Test if x == y
 		 */
 		inline static bool areEqual (const Element& x ,const Element& y)  {
 			return x == y;
 		}
 
-		/** @brief 
+		/** @brief
 		 *  Test if x == 0
 		 */
 		inline static bool isZero (const Element& x)  {
-			
+
 			return NTL::IsZero (x);
 		}
 
-		/** @brief 
+		/** @brief
 		 *  Test if x == 1
 		 */
 		inline static bool isOne (const Element& x)  {
 
 			return NTL::IsOne (x);
 		}
-								
+
 		// arithmetic
-		
-		/** @brief 
+
+		/** @brief
 		 *  return x = y + z
 		 */
 		inline static Element& add (Element& x, const Element& y, const Element& z)  {
@@ -195,28 +212,28 @@ namespace LinBox
 			return x;
 		}
 
-		/** @brief 
+		/** @brief
 		 *  return x = y - z
 		 */
-		inline static Element& sub (Element& x, const Element& y, const Element& z)  {			
-			
+		inline static Element& sub (Element& x, const Element& y, const Element& z)  {
+
 			NTL::sub (x, y, z);
 
 			return x;
 		}
-			      
-		/** @brief 
+
+		/** @brief
 		 *  return x = y * z
 		 */
 		template <class Int>
-			inline static Element& mul (Element& x, const Element& y, const Int& z)  {
-			
+		inline static Element& mul (Element& x, const Element& y, const Int& z)  {
+
 			NTL::mul (x, y, z);
 
 			return x;
 		}
 
-		/** @brief 
+		/** @brief
 		 *  If exists a, such that a * z =y,
 		 *  return x = one of them.
 		 *  Otherwise, throw an exception
@@ -226,7 +243,7 @@ namespace LinBox
 			NTL::ZZ g, s, t;
 
 			NTL::XGCD (g, s, t, NTL::rep(z), NTL::ZZ_p::modulus());
-			
+
 			NTL::ZZ q, r;
 
 			NTL::DivRem (q, r, NTL::rep(y), g);
@@ -240,18 +257,18 @@ namespace LinBox
 				NTL::conv (tmp2, q);
 
 				NTL::mul (x, tmp1, tmp2);
-				
-			} 
-					
+
+			}
+
 			else
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"Div: not dividable");
+				throw PreconditionFailed(__func__,__FILE__,__LINE__,"Div: not dividable");
 
 
 			return x;
-				
+
 		}
-				
-		/** @brief 
+
+		/** @brief
 		 *  If y is a unit, return x = 1 / y,
 		 *  otherwsie, throw an exception
 		 */
@@ -262,23 +279,23 @@ namespace LinBox
 			return x;
 		}
 
-		/** @brief 
+		/** @brief
 		 *  return x = -y;
 		 */
 		inline static Element& neg (Element& x, const Element& y)  {
-			
+
 			NTL::negate (x, y);
 
 			return x;
 		}
 
 
-		/** @brief 
+		/** @brief
 		 *  return r = a x + y
 		 */
 
 		template <class Int>
-			inline static Element& axpy (Element& r, const Element& a, const Int& x, const Element& y)  {
+		inline static Element& axpy (Element& r, const Element& a, const Int& x, const Element& y)  {
 
 			NTL::mul (r, a, x);
 
@@ -287,141 +304,141 @@ namespace LinBox
 
 
 		// inplace operator
-		
-		/** @brief 
+
+		/** @brief
 		 *  return x += y;
 		 */
 		inline static Element& addin (Element& x, const Element& y) {
-			
+
 			return x += y;
 		}
-		
-		/** @brief 
+
+		/** @brief
 		 *  return x -= y;
 		 */
 		inline static Element& subin (Element& x, const Element& y)  {
-			
+
 			return x -= y;
 		}
 
-		/** @brief 
+		/** @brief
 		 *  return x *= y;
 		 */
 		template<class Int>
-			inline static Element& mulin (Element& x, const Int& y)  {
-			
+		inline static Element& mulin (Element& x, const Int& y)  {
+
 			return x *= y;
 		}
 
-		/** @brief 
+		/** @brief
 		 *  If y divides x, return x /= y,
 		 *  otherwise throw an exception
 		 */
 		inline static Element& divin (Element& x, const Element& y) {
-			
+
 			div (x, x, y);
 
 			return x;
 		}
 
-		/** @brief 
+		/** @brief
 		 *  If x is a unit, x = 1 / x,
 		 *  otherwise, throw an exception.
 		 */
 		inline static Element& invin (Element& x) {
-			
+
 			return x = NTL::inv(x);
-		}				
-		
-		/** @brief 
+		}
+
+		/** @brief
 		 *  return x = -x;
 		 */
-		inline static Element& negin (Element& x)  {			
+		inline static Element& negin (Element& x)  {
 
 			NTL::negate (x, x);
 
 			return x;
 		}
 
-		/** @brief 
+		/** @brief
 		 *  return r += a x
 		 */
 		template <class Int>
-			inline static Element& axpyin (Element& r, const Element& a, const Int& x)  {
+		inline static Element& axpyin (Element& r, const Element& a, const Int& x)  {
 
 			return r += a * x;
 		}
 
-	
+
 		// IO
 
-		/** @brief 
+		/** @brief
 		 *  out << y;
 		 */
 		static std::ostream& write(std::ostream& out,const Element& y)  {
 
 			out << y;
-			
+
 			return out;
 		}
 
 
-		/** @brief 
+		/** @brief
 		 *  read x from istream in
 		 */
 		static std::istream& read(std::istream& in, Element& x) {
-			
+
 			return in >> x;
 		}
 
 
 		/** some PIR function
-		 */
+		*/
 
-		/** @brief 
+		/** @brief
 		 *  Test if x is a unit.
 		 */
 		inline static bool isUnit (const Element& x) {
-			
+
 			NTL::ZZ g;
 
 			NTL::GCD (g, NTL::rep(x), NTL::ZZ_p::modulus());
 
 			return NTL::IsOne (g);
 		}
-		
-		/** @brief 
+
+		/** @brief
 		 *  return g = gcd (a, b)
 		 */
 		inline static Element& gcd (Element& g, const Element& a, const Element& b) {
-			
+
 			NTL::ZZ d;
-			
+
 			NTL::GCD (d, NTL::rep(a), NTL::rep(b));
 
 			NTL::conv (g, d);
 
 			return g;
 		}
-	
-		/** @brief 
+
+		/** @brief
 		 *  return g = gcd (g, b)
 		 */
 		inline static Element& gcdin (Element& g, const Element& b) {
-			
+
 			gcd (g, g, b);
 
 			return g;
 		}
 
-		/** @brief 
+		/** @brief
 		 *  g = gcd(a, b) = a*s + b*t.
 		 *  and gcd (s, t) is a unit.
 		 */
 		inline static Element& xgcd (Element& g, Element& s, Element& t, const Element& a, const Element& b){
 
 			NTL::ZZ g1, s1, t1;
-			
+
 			NTL::XGCD (g1, s1, t1, NTL::rep(a), NTL::rep(b));
 
 			NTL::conv (g, g1);
@@ -433,16 +450,16 @@ namespace LinBox
 			return g;
 		}
 
-		/** @brief 
+		/** @brief
 		 *  g = gcd(a, b) = a*s + b*t.
 		 *  and gcd (s, t) is a unit.
 		 *  s * a1 + t * b1 = a unit.
 		 */
-		inline static Element& dxgcd (Element& g, Element& s, Element& t, Element& a1, Element& b1, 
+		inline static Element& dxgcd (Element& g, Element& s, Element& t, Element& a1, Element& b1,
 					      const Element& a, const Element& b){
 
 			NTL::ZZ g1, s1, t1, a2, b2;
-			
+
 			NTL::XGCD (g1, s1, t1, NTL::rep(a), NTL::rep(b));
 
 			NTL::conv (g, g1);
@@ -461,41 +478,41 @@ namespace LinBox
 			else {
 
 				NTL::div (a2, NTL::rep(a), g1);
-				
+
 				NTL::div (b2, NTL::rep(b), g1);
-				
+
 				NTL::conv (a1, a2);
-				
+
 				NTL::conv (b1, b2);
 			}
-				
+
 			return g;
 		}
 
-		/** @brief 
+		/** @brief
 		 *  Test if a | b.
 		 */
 		inline static bool isDivisor (const Element& a, const Element& b) {
-			
+
 			if ( NTL::IsZero (a) ) return false;
-			
+
 			else if (NTL::IsZero (b)) return true;
-			
+
 			else {
 				NTL::ZZ g, r;
 
 				NTL::GCD (g, NTL::rep(a), NTL::ZZ_p::modulus());
-								
+
 				NTL::rem (r, NTL::rep(b), g);
 
 				return NTL::IsZero (r);
 			}
 		}
 
-		/** @brief 
+		/** @brief
 		 *  a = normalization of b.
 		 */
-			
+
 		inline static Element& normal (Element& a,  const Element& b) {
 
 			NTL::ZZ a1;
@@ -503,32 +520,32 @@ namespace LinBox
 			NTL::GCD (a1, NTL::rep(b), NTL::ZZ_p::modulus());
 
 			NTL::conv (a, a1);
-			
+
 			return a;
 		}
 
-		/** @brief 
-		 */
+		/** @brief
+		*/
 
 		inline static Element& normalIn (Element& a) {
 
-		
+
 			NTL::ZZ a1;
 
 			NTL::GCD (a1, NTL::rep(a), NTL::ZZ_p::modulus());
 
 			NTL::conv (a, a1);
-			
-			return a;	
+
+			return a;
 		}
 
 		inline static integer getMaxModulus()
-			{ return integer( "4294967295" ); } // 2^32 - 1
-		    
+		{ return integer( "4294967295" ); } // 2^32 - 1
+
 	};
 
-	
-		
+
+
 	template <>
 	class FieldAXPY<PIR_ntl_ZZ_p>  {
 	public:
@@ -536,68 +553,72 @@ namespace LinBox
 		typedef Field::Element Element;
 
 		/** Constructor.
-                 * A faxpy object if constructed from a Field.
-                 * Copies of this objects are stored in the faxpy object.
-                 * @param F field F in which arithmetic is done
-                 */
-                FieldAXPY (const Field &F) : _F (F) { _y = NTL::ZZ::zero(); }
- 
-                /** Copy constructor.
-                 * @param faxpy
-                 */
-                FieldAXPY (const FieldAXPY<Field> &faxpy) : _F (faxpy._F), _y (faxpy._y) {}
- 
-                /** Assignment operator
-                 * @param faxpy
-                 */
-                FieldAXPY<Field> &operator = (const FieldAXPY &faxpy)
-                        { _y = faxpy._y; return *this; }
- 
-                /** Add a*x to y
-                 * y += a*x.
-                 * @param a constant reference to element a
-                 * @param x constant reference to element x
-		 */
-            inline NTL::ZZ& mulacc (const Element &a, const Element &x)
-		{ 
-			return _y +=  NTL::rep(a) * NTL::rep(x) ; 
-		}
- 
- 		inline NTL::ZZ& accumulate (const Element &t)
-		{ 
-			return _y += NTL::rep(t); 
-		}
- 
-               /** Retrieve y
-                 *
-                 * Performs the delayed modding out if necessary
-                 */
-                inline Element &get (Element &y) { NTL::conv (y,  _y); return y; }
- 
-                /** Assign method.
-                 * Stores new field element for arithmetic.
-                 * @return reference to self
-                 * @param y_init constant reference to element a
-                 */
-                inline FieldAXPY &assign (const Element& y)
-                {
-                        _y = NTL::rep(y);
-			
-                        return *this;
-                }
-		
+		 * A faxpy object if constructed from a Field.
+		 * Copies of this objects are stored in the faxpy object.
+		 * @param F field F in which arithmetic is done
+		 */
+		FieldAXPY (const Field &F) :
+		       	_F (F)
+		{ _y = NTL::ZZ::zero(); }
+
+		/** Copy constructor.
+		 * @param faxpy
+		 */
+		FieldAXPY (const FieldAXPY<Field> &faxpy) :
+		       	_F (faxpy._F), _y (faxpy._y)
+	       	{}
+
+		/** Assignment operator
+		 * @param faxpy
+		 */
+		FieldAXPY<Field> &operator = (const FieldAXPY &faxpy)
+		{ _y = faxpy._y; return *this; }
+
+		/** Add a*x to y
+		 * y += a*x.
+		 * @param a constant reference to element a
+		 * @param x constant reference to element x
+		 */
+		inline NTL::ZZ& mulacc (const Element &a, const Element &x)
+		{
+			return _y +=  NTL::rep(a) * NTL::rep(x) ;
+		}
+
+		inline NTL::ZZ& accumulate (const Element &t)
+		{
+			return _y += NTL::rep(t);
+		}
+
+		/** Retrieve y
+		 *
+		 * Performs the delayed modding out if necessary
+		 */
+		inline Element &get (Element &y) { NTL::conv (y,  _y); return y; }
+
+		/** Assign method.
+		 * Stores new field element for arithmetic.
+		 * @return reference to self
+		 * @param y constant reference to element a
+		 */
+		inline FieldAXPY &assign (const Element& y)
+		{
+			_y = NTL::rep(y);
+
+			return *this;
+		}
+
 		inline void reset() {
 			_y = NTL::ZZ::zero();
 		}
-			
-            private:
- 
-                /// Field in which arithmetic is done
-                /// Not sure why it must be mutable, but the compiler complains otherwise
-                Field _F;
- 
-                /// Field element for arithmetic
-                NTL::ZZ _y;
+
+	private:
+
+		/// Field in which arithmetic is done
+		/// Not sure why it must be mutable, but the compiler complains otherwise
+		Field _F;
+
+		/// Field element for arithmetic
+		NTL::ZZ _y;
 
 	};
 
@@ -605,115 +626,118 @@ namespace LinBox
 	class DotProductDomain;
 
 	template <>
-	class DotProductDomain<PIR_ntl_ZZ_p> : private virtual VectorDomainBase<PIR_ntl_ZZ_p> {	       
-		
-	public:	  
-		typedef PIR_ntl_ZZ_p::Element Element;	  
-		DotProductDomain (const PIR_ntl_ZZ_p& F)
-			: VectorDomainBase<PIR_ntl_ZZ_p> (F) {}
-	  
-	  
-		protected:
+	class DotProductDomain<PIR_ntl_ZZ_p> : private virtual VectorDomainBase<PIR_ntl_ZZ_p> {
+
+	public:
+		typedef PIR_ntl_ZZ_p::Element Element;
+		DotProductDomain (const PIR_ntl_ZZ_p& F) :
+			VectorDomainBase<PIR_ntl_ZZ_p> (F) {}
+
+
+	protected:
 		template <class Vector1, class Vector2>
-			inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const {
-		  
+		inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
+
 			typename Vector1::const_iterator i;
 			typename Vector2::const_iterator j;
-		  
+
 			NTL::ZZ y;
 			//NTL::ZZ t;
-		  
+
 			for (i = v1.begin (), j = v2.begin (); i < v1.end (); ++i, ++j) {
 
 				y += NTL::rep (*i) * NTL::rep(*j);
-			  
+
 			}
-		  
+
 			//NTL::rem (t, y, NTL::ZZ_p::modulus());
-			
+
 			NTL::conv (res, y);
-			
+
 			return res;
 
 		}
-	  
+
 		template <class Vector1, class Vector2>
-			inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const {		  
+		inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
 			typename Vector1::first_type::const_iterator i_idx;
 			typename Vector1::second_type::const_iterator i_elt;
-		  
+
 			NTL::ZZ y;
 			y = (long)0;
 			//NTL::ZZ t;
-		  
+
 			for (i_idx = v1.first.begin (), i_elt = v1.second.begin (); i_idx != v1.first.end (); ++i_idx, ++i_elt) {
 
 				y += NTL::rep(*i_elt) * NTL::rep(v2[*i_idx]);
-			  
+
 			}
-		  
+
 
 			//NTL::rem (t, y, NTL::ZZ_p::modulus());
-			
+
 			NTL::conv (res, y);
-			
+
 			return res;
 		}
 	};
 
-	// Specialization of MVProductDomain for  PIR_ntl_ZZ_p field	
+	// Specialization of MVProductDomain for  PIR_ntl_ZZ_p field
 
 	template <class Field>
 	class MVProductDomain;
-	
+
 	template <>
 	class MVProductDomain<PIR_ntl_ZZ_p>
+	{
+	public:
+
+		typedef PIR_ntl_ZZ_p::Element Element;
+
+	protected:
+		template <class Vector1, class Matrix, class Vector2>
+		inline Vector1 &mulColDense
+		(const VectorDomain<PIR_ntl_ZZ_p> &VD, Vector1 &w, const Matrix &A, const Vector2 &v) const
 		{
-		public:
-
-			typedef PIR_ntl_ZZ_p::Element Element;
-
-		protected:
-			template <class Vector1, class Matrix, class Vector2>
-			inline Vector1 &mulColDense
-			(const VectorDomain<PIR_ntl_ZZ_p> &VD, Vector1 &w, const Matrix &A, const Vector2 &v) const
-			{
-					return mulColDenseSpecialized
-						(VD, w, A, v, VectorTraits<typename Matrix::Column>::VectorCategory ());
-				}
-
-		private:
-			
-			template <class Vector1, class Matrix, class Vector2>
-			Vector1 &mulColDenseSpecialized
-			(const VectorDomain<PIR_ntl_ZZ_p> &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-			 VectorCategories::DenseVectorTag) const;
-			
-			template <class Vector1, class Matrix, class Vector2>
-			Vector1 &mulColDenseSpecialized
-			(const VectorDomain<PIR_ntl_ZZ_p> &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-			 VectorCategories::SparseSequenceVectorTag) const;
-			
-			template <class Vector1, class Matrix, class Vector2>
-			Vector1 &mulColDenseSpecialized
-			(const VectorDomain<PIR_ntl_ZZ_p> &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-			 VectorCategories::SparseAssociativeVectorTag) const;
-			
-			template <class Vector1, class Matrix, class Vector2>
-			Vector1 &mulColDenseSpecialized
-			(const VectorDomain<PIR_ntl_ZZ_p> &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-			 VectorCategories::SparseParallelVectorTag) const;
-			
+			return mulColDenseSpecialized
+			(VD, w, A, v, VectorTraits<typename Matrix::Column>::VectorCategory ());
+		}
+
+	private:
+
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColDenseSpecialized
+		(const VectorDomain<PIR_ntl_ZZ_p> &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::DenseVectorTag) const;
+
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColDenseSpecialized
+		(const VectorDomain<PIR_ntl_ZZ_p> &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::SparseSequenceVectorTag) const;
+
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColDenseSpecialized
+		(const VectorDomain<PIR_ntl_ZZ_p> &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::SparseAssociativeVectorTag) const;
+
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColDenseSpecialized
+		(const VectorDomain<PIR_ntl_ZZ_p> &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::SparseParallelVectorTag) const;
+
 	};
 
 	template <class Vector1, class Matrix, class Vector2>
-		Vector1 &MVProductDomain<PIR_ntl_ZZ_p>::mulColDenseSpecialized
-		(const VectorDomain<PIR_ntl_ZZ_p> &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-		 VectorCategories::DenseVectorTag) const {
-		
+	Vector1 &MVProductDomain<PIR_ntl_ZZ_p>::mulColDenseSpecialized
+	(const VectorDomain<PIR_ntl_ZZ_p> &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+	 VectorCategories::DenseVectorTag) const
+	{
+
 		linbox_check (A.coldim () == v.size ());
 		linbox_check (A.rowdim () == w.size ());
-		
+
 		typename Matrix::ConstColIterator i = A.colBegin ();
 		typename Vector2::const_iterator j;
 		typename Matrix::Column::const_iterator k;
@@ -723,122 +747,124 @@ namespace LinBox
 		//NTL::ZZ t;
 
 		for (j = v.begin (); j != v.end (); ++j, ++i) {
-			for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) 
+			for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l)
 
 				*l += NTL::rep (*k) + NTL::rep (*j);
-				
+
 		}
-		
+
 		typename Vector1::iterator w_j;
-		
+
 		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l) {
 
 			//NTL::rem (t, *l, NTL::ZZ_p::modulus());
 
 			NTL::conv (*w_j, *l);
 		}
-			
-		
+
+
 		return w;
 	}
-	
+
 	template <class Vector1, class Matrix, class Vector2>
-		Vector1 &MVProductDomain<PIR_ntl_ZZ_p>::mulColDenseSpecialized
-		(const VectorDomain<PIR_ntl_ZZ_p> &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-		 VectorCategories::SparseSequenceVectorTag) const
-		{
-			linbox_check (A.coldim () == v.size ());
-			linbox_check (A.rowdim () == w.size ());
-			
-			typename Matrix::ConstColIterator i = A.colBegin ();
-			typename Vector2::const_iterator j;
-			typename Matrix::Column::const_iterator k;
-			std::vector<NTL::ZZ>::iterator l;
-			std::vector<NTL::ZZ> _tmp(w.size());
-			
-			//NTL::ZZ t;
-			
-			for (j = v.begin (); j != v.end (); ++j, ++i) {
-				for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
-					
-					_tmp[k->first] += NTL::rep (k->second) * NTL::rep (*j);
-					
-				}
-			}
-			
-			typename Vector1::iterator w_j;
-			
-			for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l) {
-				
-				//NTL::rem (t, *l, NTL::ZZ_p::modulus());
-				
-				NTL::conv (*w_j, *l);
+	Vector1 &MVProductDomain<PIR_ntl_ZZ_p>::mulColDenseSpecialized
+	(const VectorDomain<PIR_ntl_ZZ_p> &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+	 VectorCategories::SparseSequenceVectorTag) const
+	{
+		linbox_check (A.coldim () == v.size ());
+		linbox_check (A.rowdim () == w.size ());
+
+		typename Matrix::ConstColIterator i = A.colBegin ();
+		typename Vector2::const_iterator j;
+		typename Matrix::Column::const_iterator k;
+		std::vector<NTL::ZZ>::iterator l;
+		std::vector<NTL::ZZ> _tmp(w.size());
+
+		//NTL::ZZ t;
+
+		for (j = v.begin (); j != v.end (); ++j, ++i) {
+			for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
+
+				_tmp[k->first] += NTL::rep (k->second) * NTL::rep (*j);
+
 			}
-			
-			return w;
 		}
-	
+
+		typename Vector1::iterator w_j;
+
+		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l) {
+
+			//NTL::rem (t, *l, NTL::ZZ_p::modulus());
+
+			NTL::conv (*w_j, *l);
+		}
+
+		return w;
+	}
+
 	template <class Vector1, class Matrix, class Vector2>
-		Vector1 &MVProductDomain<PIR_ntl_ZZ_p >::mulColDenseSpecialized
-		(const VectorDomain<PIR_ntl_ZZ_p > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-		 VectorCategories::SparseAssociativeVectorTag) const {
+	Vector1 &MVProductDomain<PIR_ntl_ZZ_p >::mulColDenseSpecialized
+	(const VectorDomain<PIR_ntl_ZZ_p > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+	 VectorCategories::SparseAssociativeVectorTag) const
+	{
 
 		linbox_check (A.coldim () == v.size ());
 		linbox_check (A.rowdim () == w.size ());
-		
+
 		typename Matrix::ConstColIterator i = A.colBegin ();
 		typename Vector2::const_iterator j;
 		typename Matrix::Column::const_iterator k;
 		std::vector<NTL::ZZ>::iterator l;
 
 		std::vector<NTL::ZZ> _tmp(w.size());
-		
+
 		//NTL::ZZ t;
-		
+
 		for (j = v.begin (); j != v.end (); ++j, ++i) {
 			for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
-								
+
 				_tmp[k->first] += NTL::rep(k -> second) * NTL::rep(*j);
-				
+
 			}
 		}
-		
+
 		typename Vector1::iterator w_j;
-		
+
 		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l) {
 
 			//NTL::rem (t, *l, NTL::ZZ_p::modulus());
-			
+
 			NTL::conv (*w_j, *l);
 		}
-			
-		
+
+
 		return w;
 	}
 
 	template <class Vector1, class Matrix, class Vector2>
-		Vector1 &MVProductDomain<PIR_ntl_ZZ_p>::mulColDenseSpecialized
-		(const VectorDomain<PIR_ntl_ZZ_p> &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-		 VectorCategories::SparseParallelVectorTag) const {
-		
+	Vector1 &MVProductDomain<PIR_ntl_ZZ_p>::mulColDenseSpecialized
+	(const VectorDomain<PIR_ntl_ZZ_p> &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+	 VectorCategories::SparseParallelVectorTag) const
+	{
+
 		linbox_check (A.coldim () == v.size ());
 		linbox_check (A.rowdim () == w.size ());
-		
+
 		typename Matrix::ConstColIterator i = A.colBegin ();
 		typename Vector2::const_iterator j;
 		typename Matrix::Column::first_type::const_iterator k_idx;
 		typename Matrix::Column::second_type::const_iterator k_elt;
 		std::vector<NTL::ZZ>::iterator l;
-		
+
 		std::vector<NTL::ZZ> _tmp(w.size());
 		//NTL::ZZ t;
-				
+
 		for (j = v.begin (); j != v.end (); ++j, ++i) {
 			for (k_idx = i->first.begin (), k_elt = i->second.begin (), l = _tmp.begin ();
 			     k_idx != i->first.end ();
 			     ++k_idx, ++k_elt, ++l)
 
-					_tmp[*k_idx] += NTL::rep(*k_elt) * NTL::rep(*j);
+				_tmp[*k_idx] += NTL::rep(*k_elt) * NTL::rep(*j);
 
 		}
 
@@ -847,15 +873,16 @@ namespace LinBox
 		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l) {
 
 			//NTL::rem (t, *l, NTL::ZZ_p::modulus());
-			
+
 			NTL::conv (*w_j, *l);
 		}
-			
+
 		return w;
 	}
-  	  
 
-	
+
+
 }
 
-#endif
+#endif //__LINBOX_pir_ntl_zz_p_H
+
diff --git a/linbox/field/abstract.h b/linbox/field/abstract.h
index da0aa61..26faa9e 100644
--- a/linbox/field/abstract.h
+++ b/linbox/field/abstract.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/field/abstract.h
  * Copyright (C) 1999-2001 William J Turner,
  *               2001 Bradford Hovinen
@@ -23,8 +23,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __FIELD_ABSTRACT_H
-#define __FIELD_ABSTRACT_H
+#ifndef __LINBOX_abstract_H
+#define __LINBOX_abstract_H
 
 #include <iostream>
 
@@ -40,13 +40,13 @@
 
 #endif
 
-namespace LinBox 
-{ 
+namespace LinBox
+{
 
 	/** \brief field base class.
 	\ingroup field
 
-	 * Found in the file \URL{linbox/field/abstract.h}.
+	 * Found in the file \sa{linbox/field/abstract.h}.
 	 * Abstract base class used to implement the field archetype to minimize
 	 * code bloat.  All public member functions of this class are purely
 	 * virtual and must be implemented by all derived classes.
@@ -57,8 +57,7 @@ namespace LinBox
 	 * it.  This minimizes code bloat, but it also introduces indirection through
 	 * the use of pointers and virtual functions which is inefficient.
 	 */
-	class FieldAbstract
-	{
+	class FieldAbstract {
 	    public:
 
 		/// element type.
@@ -66,10 +65,10 @@ namespace LinBox
 
 		/// Random iterator generator type.
 		typedef RandIterAbstract RandIter;
- 
+
 		/** @name Object Management
 		 * There are no public constructors for this class.
-		 * It should only be used in tandem with \ref{FieldArchetype}.
+		 * It should only be used in tandem with \ref FieldArchetype.
 		 */
 		//@{
 
@@ -105,7 +104,7 @@ namespace LinBox
 		 * @param y integer.
 		 */
 		virtual Element &init (Element &x, const integer &y) const = 0;
- 
+
 		/** Conversion of field element to an integer.
 		 * This function assumes the output field element x has already been
 		 * constructed, but that it is not already initialized.
@@ -115,7 +114,7 @@ namespace LinBox
 		 * @param y constant field element.
 		 */
 		virtual integer &convert (integer &x, const Element &y) const = 0;
- 
+
 		/** Assignment of one field element to another.
 		 * This function assumes both field elements have already been
 		 * constructed and initialized.
@@ -135,7 +134,7 @@ namespace LinBox
 		 * @return integer representing cardinality of the domain
 		 */
 		virtual integer &cardinality (integer &c) const = 0;
- 
+
 		/** Characteristic.
 		 * Return integer representing characteristic of the domain.
 		 * Returns a positive integer to all domains with finite characteristic,
@@ -178,7 +177,7 @@ namespace LinBox
 		virtual Element &add (Element       &x,
 				      const Element &y,
 				      const Element &z) const = 0;
- 
+
 		/** Subtraction.
 		 * x = y - z
 		 * This function assumes all the field elements have already been
@@ -192,7 +191,7 @@ namespace LinBox
 		virtual Element &sub (Element       &x,
 				      const Element &y,
 				      const Element &z) const = 0;
- 
+
 		/** Multiplication.
 		 * x = y * z
 		 * This function assumes all the field elements have already been
@@ -206,7 +205,7 @@ namespace LinBox
 		virtual Element &mul (Element       &x,
 				      const Element &y,
 				      const Element &z) const = 0;
- 
+
 		/** Division.
 		 * x = y / z
 		 * This function assumes all the field elements have already been
@@ -219,7 +218,7 @@ namespace LinBox
 		 */
 		virtual Element &div (Element &x,
 				      const Element &y, const Element &z) const = 0;
- 
+
 		/** Additive Inverse (Negation).
 		 * x = - y
 		 * This function assumes both field elements have already been
@@ -230,7 +229,7 @@ namespace LinBox
 		 * @param  y field element.
 		 */
 		virtual Element &neg (Element &x, const Element &y) const = 0;
- 
+
 		/** Multiplicative Inverse.
 		 * x = 1 / y
 		 * This function assumes both field elements have already been
@@ -244,7 +243,7 @@ namespace LinBox
 
 		/** Natural AXPY.
 		 * r  = a * x + y
-		 * This function assumes all field elements have already been 
+		 * This function assumes all field elements have already been
 		 * constructed and initialized.
 		 * Purely virtual.
 		 * @return reference to r.
@@ -253,13 +252,13 @@ namespace LinBox
 		 * @param  x field element.
 		 * @param  y field element.
 		 */
-		virtual Element &axpy (Element       &r, 
-				       const Element &a, 
-				       const Element &x, 
+		virtual Element &axpy (Element       &r,
+				       const Element &a,
+				       const Element &x,
 				       const Element &y) const = 0;
 
 		//@} Arithmetic Operations
- 
+
 		/** @name Inplace Arithmetic Operations
 		 * x <- x op y; x <- op x
 		 */
@@ -274,7 +273,7 @@ namespace LinBox
 		 * @param  x field element.
 		 */
 		virtual bool isZero (const Element &x) const = 0;
- 
+
 		/** One equality.
 		 * Test if field element is equal to one.
 		 * This function assumes the field element has already been
@@ -295,7 +294,7 @@ namespace LinBox
 		 * @param  y field element.
 		 */
 		virtual Element &addin (Element &x, const Element &y) const = 0;
- 
+
 		/** Inplace Subtraction.
 		 * x -= y
 		 * This function assumes both field elements have already been
@@ -306,7 +305,7 @@ namespace LinBox
 		 * @param  y field element.
 		 */
 		virtual Element &subin (Element &x, const Element &y) const = 0;
- 
+
 		/** Inplace Multiplication.
 		 * x *= y
 		 * This function assumes both field elements have already been
@@ -328,7 +327,7 @@ namespace LinBox
 		 * @param  y field element.
 		 */
 		virtual Element &divin (Element &x, const Element &y) const = 0;
- 
+
 		/** Inplace Additive Inverse (Inplace Negation).
 		 * x = - x
 		 * This function assumes the field element has already been
@@ -338,7 +337,7 @@ namespace LinBox
 		 * @param  x field element (reference returned).
 		 */
 		virtual Element &negin (Element &x) const = 0;
- 
+
 		/** Inplace Multiplicative Inverse.
 		 * x = 1 / x
 		 * This function assumes the field elementhas already been
@@ -351,7 +350,7 @@ namespace LinBox
 
 		/** Inplace AXPY.
 		 * r  += a * x
-		 * This function assumes all field elements have already been 
+		 * This function assumes all field elements have already been
 		 * constructed and initialized.
 		 * Purely virtual
 		 * @return reference to r.
@@ -359,10 +358,10 @@ namespace LinBox
 		 * @param  a field element.
 		 * @param  x field element.
 		 */
-		virtual Element &axpyin (Element       &r, 
-					 const Element &a, 
+		virtual Element &axpyin (Element       &r,
+					 const Element &a,
 					 const Element &x) const = 0;
- 
+
 		//@} Inplace Arithmetic Operations
 #ifndef __LINBOX_XMLENABLED
 		/** @name Input/Output Operations */
@@ -374,7 +373,7 @@ namespace LinBox
 		 * @param  os  output stream to which field is written.
 		 */
 		virtual std::ostream &write (std::ostream &os) const = 0;
- 
+
 		/** Read field.
 		 * Purely virtual.
 		 * @return input stream from which field is read.
@@ -391,7 +390,7 @@ namespace LinBox
 		 * @param  x   field element.
 		 */
 		virtual std::ostream &write (std::ostream &os, const Element &x) const = 0;
- 
+
 		/** Read field element.
 		 * This function assumes the field element has already been
 		 * constructed and initialized.
@@ -419,7 +418,7 @@ namespace LinBox
 		 * never be constructed by itself.
 		 */
 		FieldAbstract () {}
- 
+
 	    private:
 
 		/// FieldArchetype is friend.
@@ -429,4 +428,5 @@ namespace LinBox
 
 } // namespace LinBox
 
-#endif // __FIELD_ABSTRACT_H
+#endif // __LINBOX_abstract_H
+
diff --git a/linbox/field/archetype.h b/linbox/field/archetype.h
index 477cc0c..e83c2cc 100644
--- a/linbox/field/archetype.h
+++ b/linbox/field/archetype.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/field/archetype.h
  * Copyright (C) 1999-2005 William J Turner,
  *               2001 Bradford Hovinen
@@ -24,18 +24,23 @@
  *
  * ------------------------------------
  * 2002-05-14 William J. Turner <wjturner at acm.org>
- * 
+ *
  * changed randIter to RandIter.
  * ------------------------------------
  * 2005-06-24 William J. Turner <wjturner at acm.org>
- * 
+ *
  * Removed using declarations.
  * ------------------------------------
  */
 
+/*!@file field/archetype.h
+ * @ingroup field
+ * @brief NO DOC
+ * @see \ref Archetypes
+ */
 
-#ifndef __FIELD_ARCHETYPE_H
-#define __FIELD_ARCHETYPE_H
+#ifndef __LINBOX_field_archetype_H
+#define __LINBOX_field_archetype_H
 
 #include <iostream>
 #include "linbox/field/field-interface.h"
@@ -48,58 +53,45 @@
 #include "linbox/randiter/envelope.h"
 #include "linbox/integer.h"
 #include "linbox/linbox-config.h"
-
-#ifdef __LINBOX_XMLENABLED
-
-#include "linbox/util/xml/linbox-reader.h"
-#include "linbox/util/xml/linbox-writer.h"
-
-#include <iostream>
-#include <string>
-
-#endif
-
 #include "linbox/util/error.h"
 
 namespace LinBox
 {
 	// Forward declarations
 	class RandIterArchetype;
-
 	/** \brief field specification and archetypical instance.
-	\ingroup field
+	  \ingroup field
 	 *
 	 * The %FieldArchetype and its encapsulated
-	 * element class contain pointers to the \ref FieldAbstract 
+	 * element class contain pointers to the \ref FieldAbstract
 	 * and its encapsulated field element, respectively.
 	 * %FieldAbstract  then uses virtual member functions to
-	 * define operations on its encapsulated field element.  This field 
-	 * element has no knowledge of the field properties being used on it 
+	 * define operations on its encapsulated field element.  This field
+	 * element has no knowledge of the field properties being used on it
 	 * which means the field object must supply these operations.
 	 *
-	 * It does not contain elements zero and one because they can be created 
+	 * It does not contain elements zero and one because they can be created
 	 * whenever necessary, although it might be beneficial from an efficiency
 	 * stand point to include them.  However, because of archetype use three,
 	 * the elements themselves cannot be contained, but rather pointers to them.
 	 */
-	class FieldArchetype : public FieldInterface
-	{
-	    public:
+	class FieldArchetype : public FieldInterface {
+	public:
 
 		/** @name Common Object Interface for a LinBox Field.
-		 * These methods are required of all \ref{LinBox} fields.
+		 * These methods are required of all \ref LinBox fields.
 		 */
 		//@{
-    
+
 		/// the type in which field elements are represented.
 		typedef ElementArchetype Element;
 
 		/// An object of this type is a generator of random field elements.
 		typedef RandIterArchetype RandIter;
-    
+
 		/// @name Object Management
 		//@{
-    
+
 		/** \brief Copy constructor.
 		 *
 		 * Each field class is expected to provide a copy constructor.
@@ -111,9 +103,9 @@ namespace LinBox
 		 * random element generator to which
 		 * <tt> F._randIter_ptr</tt> points.
 		 */
-		FieldArchetype (const FieldArchetype &F) 
-		{ 
-			if (F._field_ptr != 0) _field_ptr = F._field_ptr->clone (); 
+		FieldArchetype (const FieldArchetype &F)
+		{
+			if (F._field_ptr != 0) _field_ptr = F._field_ptr->clone ();
 			if (F._elem_ptr != 0) _elem_ptr = F._elem_ptr->clone ();
 			if (F._randIter_ptr != 0) _randIter_ptr = F._randIter_ptr->clone ();
 		}
@@ -121,7 +113,7 @@ namespace LinBox
 		/** \brief Destructor.
 		 *
 		 * This destroys the field object, but it does not
-		 * destroy any field element objects.  
+		 * destroy any field element objects.
 		 *
 		 * In this archetype implementation, destruction is deletion of
 		 * the field object to which <tt> _field_ptr</tt>
@@ -129,13 +121,13 @@ namespace LinBox
 		 * _elem_ptr</tt> points, and the random element
 		 * generator to which <tt> _randIter_ptr</tt> points.
 		 */
-		~FieldArchetype (void) 
+		~FieldArchetype (void)
 		{
 			if (_field_ptr != 0) delete _field_ptr;
-			if (_elem_ptr != 0) delete _elem_ptr; 
+			if (_elem_ptr != 0) delete _elem_ptr;
 			if (_randIter_ptr != 0) delete _randIter_ptr;
 		}
-    
+
 		/** \brief Assignment operator.
 		 *
 		 * In this archetype implementation, this means copying the field
@@ -151,18 +143,18 @@ namespace LinBox
 				if (_field_ptr != 0) delete _field_ptr;
 				if (_elem_ptr != 0) delete _elem_ptr;
 				if (_randIter_ptr != 0) delete _randIter_ptr;
-				if (F._field_ptr != 0) _field_ptr = F._field_ptr->clone (); 
+				if (F._field_ptr != 0) _field_ptr = F._field_ptr->clone ();
 				if (F._elem_ptr != 0) _elem_ptr = F._elem_ptr->clone ();
 				if (F._randIter_ptr != 0) _randIter_ptr = F._randIter_ptr->clone ();
 			}
 
 			return *this;
 		}
-    
+
 		/** \brief Initialization of field element from an integer.
 		 *
 		 * x becomes the image of n under the natural map from the integers
-		 * to the prime subfield.  It is the result obtained from adding n 1's 
+		 * to the prime subfield.  It is the result obtained from adding n 1's
 		 * in the field.
 
 		 * This function assumes the output field element x
@@ -182,27 +174,27 @@ namespace LinBox
 			_field_ptr->init (*x._elem_ptr, n);
 			return x;
 		}
-  
+
 		/** \brief Conversion of field element to an integer.
 		 *
-		The meaning of conversion is specific to each field class.
-		However, if x is in the prime subfield, the integer n returned is such 
-		that an init from n will reproduce x.  Most often, 0 ≤ n < characteristic.
-
+		 * The meaning of conversion is specific to each field class.
+		 * However, if x is in the prime subfield, the integer n returned is such
+		 * that an init from n will reproduce x.  Most often, \f$0 \leq n < \mathrm{characteristic}\f$.
+		 *
 		 *
 		 * @return reference to n.
 		 * @param n output integer.
-		 * @param x input field element.
+		 * @param y input field element.
 		 */
 		integer &convert (integer &n, const Element &y = 0) const
 		{
 			_field_ptr->convert (n, *y._elem_ptr);
 			return n;
 		}
-    
+
 		/** \brief  Assignment of one field element to another.
 		 *
-		 * This function assumes both field elements have already been 
+		 * This function assumes both field elements have already been
 		 * constructed and initialized.
 		 *
 		 * In this archetype implementation, this means for both x and
@@ -215,22 +207,22 @@ namespace LinBox
 		 */
 		Element &assign (Element &x, const Element &y) const
 		{
-			if (x._elem_ptr == 0) 
+			if (x._elem_ptr == 0)
 				x._elem_ptr = _elem_ptr->clone ();
 
 			_field_ptr->assign (*x._elem_ptr, *y._elem_ptr);
 			return x;
 		}
-    
+
 		/** \brief Cardinality.
 		 *
 		 * Return c, integer representing cardinality of the field.
 		 * c becomes a non-negative integer for all fields with finite
 		 * cardinality, and -1 to signify a field of infinite cardinality.
 		 */
-		integer &cardinality (integer &c) const 
-			{ return _field_ptr->cardinality (c); }
-    
+		integer &cardinality (integer &c) const
+		{ return _field_ptr->cardinality (c); }
+
 		/** \brief Characteristic.
 		 *
 		 * Return c, integer representing characteristic of the field
@@ -239,21 +231,21 @@ namespace LinBox
 		 * and 0 to signify a field of infinite characteristic.
 		 */
 		integer &characteristic (integer &c) const
-			{ return _field_ptr->characteristic (c); }
-    
+		{ return _field_ptr->characteristic (c); }
+
 		//@} Object Management
-    
-		/** @name Arithmetic Operations 
+
+		/** @name Arithmetic Operations
 		 * x <- y op z; x <- op y
 		 * These operations require all elements, including x, to be initialized
 		 * before the operation is called.  Uninitialized field elements will
 		 * give undefined results.
 		 */
 		//@{
-    
+
 		/** \brief Equality of two elements.
 		 *
-		 * This function assumes both field elements have already been 
+		 * This function assumes both field elements have already been
 		 * constructed and initialized.
 		 *
 		 * In this implementation, this means for both x and
@@ -265,14 +257,14 @@ namespace LinBox
 		 * @param  y field element
 		 */
 		bool areEqual (const Element &x, const Element &y) const
-			{ return _field_ptr->areEqual (*x._elem_ptr, *y._elem_ptr); }
-    
+		{ return _field_ptr->areEqual (*x._elem_ptr, *y._elem_ptr); }
+
 		/** \brief Addition, x <-- y + z.
 		 *
-		 * This function assumes all the field elements have already been 
+		 * This function assumes all the field elements have already been
 		 * constructed and initialized.
 		 *
-		 * In this implementation, this means for x, y, and z, 
+		 * In this implementation, this means for x, y, and z,
 		 * <tt> _elem_ptr</tt> exists and does not point to null.
 		 *
 		 * @return reference to x.
@@ -282,10 +274,10 @@ namespace LinBox
 			_field_ptr->add (*x._elem_ptr, *y._elem_ptr, *z._elem_ptr);
 			return x;
 		}
-    
+
 		/** \brief Subtraction, x <-- y - z.
 		 *
-		 * This function assumes all the field elements have already been 
+		 * This function assumes all the field elements have already been
 		 * constructed and initialized.
 		 *
 		 * In this implementation, this means for x, y, and z,
@@ -299,10 +291,10 @@ namespace LinBox
 			_field_ptr->sub (*x._elem_ptr, *y._elem_ptr, *z._elem_ptr);
 			return x;
 		}
-    
+
 		/** \brief Multiplication, x <-- y * z.
 		 *
-		 * This function assumes all the field elements have already been 
+		 * This function assumes all the field elements have already been
 		 * constructed and initialized.
 		 *
 		 * In this implementation, this means for x, y, and z,
@@ -316,10 +308,10 @@ namespace LinBox
 			_field_ptr->mul (*x._elem_ptr, *y._elem_ptr, *z._elem_ptr);
 			return x;
 		}
-    
+
 		/** Division, x <-- y / z.
 		 *
-		 * This function assumes all the field elements have already been 
+		 * This function assumes all the field elements have already been
 		 * constructed and initialized.
 		 *
 		 * In this implementation, this means for x, y, and z,
@@ -333,10 +325,10 @@ namespace LinBox
 			_field_ptr->div (*x._elem_ptr, *y._elem_ptr, *z._elem_ptr);
 			return x;
 		}
-    
+
 		/** \brief Additive Inverse (Negation), x <-- - y.
 		 *
-		 * This function assumes both field elements have already been 
+		 * This function assumes both field elements have already been
 		 * constructed and initialized.
 		 *
 		 * In this implementation, this means for both x and y
@@ -350,11 +342,11 @@ namespace LinBox
 			_field_ptr->neg (*x._elem_ptr, *y._elem_ptr);
 			return x;
 		}
-    
+
 		/** \brief Multiplicative Inverse, x <-- 1 / y.
 		 *
 		 * Requires that y is a unit (i.e. nonzero in a field).
-		 * This function assumes both field elements have already been 
+		 * This function assumes both field elements have already been
 		 * constructed and initialized.
 		 *
 		 * In this implementation, this means for both x and y
@@ -368,17 +360,17 @@ namespace LinBox
 			_field_ptr->inv (*x._elem_ptr, *y._elem_ptr);
 			return x;
 		}
-    
-    
+
+
 		/** \brief Field element AXPY, r  <-- a * x + y.
 		 *
-		 * This function assumes all field elements have already been 
+		 * This function assumes all field elements have already been
 		 * constructed and initialized.
 		 * @return reference to r.
 		 */
-		Element &axpy (Element       &r, 
+		Element &axpy (Element       &r,
 			       const Element &a,
-			       const Element &x, 
+			       const Element &x,
 			       const Element &y) const
 		{
 			_field_ptr->axpy (*r._elem_ptr, *a._elem_ptr, *x._elem_ptr,  *y._elem_ptr);
@@ -386,50 +378,50 @@ namespace LinBox
 		}
 
 		//@} Arithmetic Operations
-    
+
 		/** @name Predicates
 		*/
 		//@{
 		/** Zero equality.
 		 * Test if field element is equal to zero.
-		 * This function assumes the field element has already been 
+		 * This function assumes the field element has already been
 		 * constructed and initialized.
 		 *
-		 * In this implementation, this means the <tt>_elem_ptr</tt> 
+		 * In this implementation, this means the <tt>_elem_ptr</tt>
 		 * of x exists and does not point to null.
 		 *
 		 * @return boolean true if equals zero, false if not.
 		 * @param  x field element.
 		 */
-		bool isZero (const Element &x) const 
-			{ return _field_ptr->isZero (*x._elem_ptr); }
-    
+		bool isZero (const Element &x) const
+		{ return _field_ptr->isZero (*x._elem_ptr); }
+
 		/** One equality.
 		 * Test if field element is equal to one.
-		 * This function assumes the field element has already been 
+		 * This function assumes the field element has already been
 		 * constructed and initialized.
 		 *
-		 * In this implementation, this means the <tt> _elem_ptr</tt> 
+		 * In this implementation, this means the <tt> _elem_ptr</tt>
 		 *of x exists and does not point to null.
 		 *
 		 * @return boolean true if equals one, false if not.
 		 * @param  x field element.
 		 */
-		bool isOne (const Element &x) const 
-			{ return _field_ptr->isOne (*x._elem_ptr); }
+		bool isOne (const Element &x) const
+		{ return _field_ptr->isOne (*x._elem_ptr); }
 		//@}
 
-		/** @name Inplace Arithmetic Operations 
+		/** @name Inplace Arithmetic Operations
 		 * x <- x op y; x <- op x
 		 * These operations require all elements, including x, to be initialized
 		 * before the operation is called.  Uninitialized field elements will
 		 * give undefined results.
 		 */
 		//@{
-    
+
 		/** Inplace Addition.
 		 * x += y
-		 * This function assumes both field elements have already been 
+		 * This function assumes both field elements have already been
 		 * constructed and initialized.
 		 *
 		 * In this implementation, this means for both x and y
@@ -444,10 +436,10 @@ namespace LinBox
 			_field_ptr->addin (*x._elem_ptr, *y._elem_ptr);
 			return x;
 		}
-    
+
 		/** Inplace Subtraction.
 		 * x -= y
-		 * This function assumes both field elements have already been 
+		 * This function assumes both field elements have already been
 		 * constructed and initialized.
 		 *
 		 * In this implementation, this means for both x and y
@@ -463,10 +455,10 @@ namespace LinBox
 			_field_ptr->subin (*x._elem_ptr, *y._elem_ptr);
 			return x;
 		}
- 
+
 		/** Inplace Multiplication.
 		 * x *= y
-		 * This function assumes both field elements have already been 
+		 * This function assumes both field elements have already been
 		 * constructed and initialized.
 		 *
 		 * In this implementation, this means for both x and y
@@ -482,10 +474,10 @@ namespace LinBox
 			_field_ptr->mulin (*x._elem_ptr, *y._elem_ptr);
 			return x;
 		}
-   
+
 		/** Inplace Division.
 		 * x /= y
-		 * This function assumes both field elements have already been 
+		 * This function assumes both field elements have already been
 		 * constructed and initialized.
 		 *
 		 * In this implementation, this means for both x and y
@@ -501,10 +493,10 @@ namespace LinBox
 			_field_ptr->divin (*x._elem_ptr, *y._elem_ptr);
 			return x;
 		}
-    
+
 		/** Inplace Additive Inverse (Inplace Negation).
 		 * x = - x
-		 * This function assumes the field element has already been 
+		 * This function assumes the field element has already been
 		 * constructed and initialized.
 		 *
 		 * In this implementation, this means the <tt>
@@ -519,10 +511,10 @@ namespace LinBox
 			_field_ptr->negin (*x._elem_ptr);
 			return x;
 		}
-    
+
 		/** Inplace Multiplicative Inverse.
 		 * x = 1 / x
-		 * This function assumes the field elementhas already been 
+		 * This function assumes the field elementhas already been
 		 * constructed and initialized.
 		 *
 		 * In this implementation, this means the <tt>
@@ -537,10 +529,10 @@ namespace LinBox
 			_field_ptr->invin (*x._elem_ptr);
 			return x;
 		}
-    
+
 		/** Inplace AXPY.
 		 * r  += a * x
-		 * This function assumes all field elements have already been 
+		 * This function assumes all field elements have already been
 		 * constructed and initialized.
 		 * @return reference to r.
 		 * @param  r field element (reference returned).
@@ -554,24 +546,24 @@ namespace LinBox
 		}
 
 		//@} Inplace Arithmetic Operations
-    
+
 		/** @name Input/Output Operations */
 		//@{
-    
+
 		/** Print field.
 		 * @return output stream to which field is written.
 		 * @param  os  output stream to which field is written.
 		 */
 		std::ostream &write (std::ostream &os) const { return _field_ptr->write (os); }
-    
+
 		/** Read field.
 		 * @return input stream from which field is read.
 		 * @param  is  input stream from which field is read.
 		 */
 		std::istream &read (std::istream &is) { return _field_ptr->read (is); }
-    
+
 		/** Print field element.
-		 * This function assumes the field element has already been 
+		 * This function assumes the field element has already been
 		 * constructed and initialized.
 		 *
 		 * In this implementation, this means for the <tt>
@@ -582,11 +574,11 @@ namespace LinBox
 		 * @param  os  output stream to which field element is written.
 		 * @param  x   field element.
 		 */
-		std::ostream &write (std::ostream &os, const Element &x) const 
-			{ return _field_ptr->write (os, *x._elem_ptr); }
-    
+		std::ostream &write (std::ostream &os, const Element &x) const
+		{ return _field_ptr->write (os, *x._elem_ptr); }
+
 		/** Read field element.
-		 * This function assumes the field element has already been 
+		 * This function assumes the field element has already been
 		 * constructed and initialized.
 		 *
 		 * In this implementation, this means for the <tt>
@@ -598,103 +590,101 @@ namespace LinBox
 		 * @param  x   field element.
 		 */
 		std::istream &read (std::istream &is, Element &x) const
-			{ return _field_ptr->read (is, *x._elem_ptr); }
-    
+		{ return _field_ptr->read (is, *x._elem_ptr); }
+
 		//@} Input/Output Operations
 		//@} Common Object Interface
-    
+
 		/** @name Implementation-Specific Methods.
-		 * These methods are not required of all \ref{LinBox Fields}
+		 * These methods are not required of all \ref LinBox\ Fields
 		 * and are included only for this implementation of the archetype.
 		 */
 		//@{
 
 		/** Constructor.
-		 * Constructs field from pointer to \ref{FieldAbstract} and its
+		 * Constructs field from pointer to \ref FieldAbstract and its
 		 * encapsulated element and random element generator.
 		 * Not part of the interface.
 		 * Creates new copies of field, element, and random iterator generator
 		 * objects in dynamic memory.
-		 * @param  field_ptr pointer to \ref{FieldAbstract}.
-		 * @param  elem_ptr  pointer to \ref{ElementAbstract}, which is the
-		 *                    encapsulated element of \ref{FieldAbstract}.
-		 * @param  randIter_ptr  pointer to \ref{RandIterAbstract}, which is the
+		 * @param  field_ptr pointer to \ref FieldAbstract.
+		 * @param  elem_ptr  pointer to \ref ElementAbstract, which is the
+		 *                    encapsulated element of \ref FieldAbstract.
+		 * @param  randIter_ptr  pointer to \ref RandIterAbstract, which is the
 		 *                        encapsulated random iterator generator
-		 *                        of \ref{FieldAbstract}.
+		 *                        of \ref FieldAbstract.
 		 */
 		FieldArchetype (FieldAbstract    *field_ptr,
-				 ElementAbstract  *elem_ptr,
-				 RandIterAbstract *randIter_ptr = 0)
-			: _field_ptr (field_ptr->clone ()), 
-			  _elem_ptr (elem_ptr->clone ())
+				ElementAbstract  *elem_ptr,
+				RandIterAbstract *randIter_ptr = 0) :
+			_field_ptr (field_ptr->clone ()),
+			_elem_ptr (elem_ptr->clone ())
 		{
 			if (randIter_ptr != 0) _randIter_ptr = randIter_ptr->clone ();
 		}
 
-    
+
 		/** Constructor.
 		 * Constructs field from ANYTHING matching the interface
-		 * using the enveloppe as a \ref{FieldAbstract} and its
+		 * using the enveloppe as a \ref FieldAbstract and its
 		 * encapsulated element and random element generator if needed.
-		 * @param  field_ptr pointer to field matching the interface
-		 * @param  elem_ptr  pointer to element matching the interface
-		 * @param  randIter_ptr  pointer to random matching the interface
+		 * @param  f
 		 */
 		template<class Field_qcq>
-			FieldArchetype (Field_qcq *f) { constructor (f, f); }
-	
+		FieldArchetype (Field_qcq *f) { constructor (f, f); }
+
 		//@} Implementation-Specific Methods
-    
-	    protected:
-    
+
+	protected:
+
 		friend class ElementArchetype;
 		friend class RandIterArchetype;
-    
+
 		/** Pointer to FieldAbstract object.
 		 * Not part of the interface.
 		 * Included to allow for archetype use three.
 		 */
 		mutable FieldAbstract *_field_ptr;
-    
+
 		/** Pointer to ElementAbstract object.
 		 * Not part of the interface.
 		 * Included to allow for archetype use three.
 		 */
 		mutable ElementAbstract *_elem_ptr;
-    
+
 		/** Pointer to RandIterAbstract object.
 		 * Not part of the interface.
 		 * Included to allow for archetype use three.
 		 */
 		mutable RandIterAbstract *_randIter_ptr;
 
-		/** Template method for constructing archetype from a derived class of 
+		/** Template method for constructing archetype from a derived class of
 		 * FieldAbstract.
-		 * This class is needed to help the constructor differentiate between 
+		 * This class is needed to help the constructor differentiate between
 		 * classes derived from FieldAbstract and classes that aren't.
 		 * Should be called with the same argument to both parameters?
 		 * @param	trait	pointer to FieldAbstract or class derived from it
 		 * @param	field_ptr	pointer to class derived from FieldAbstract
 		 */
 		template<class Field_qcq>
-		void constructor (FieldAbstract *trait, 
+		void constructor (FieldAbstract *trait,
 				  Field_qcq      *field_ptr)
 		{
 			_field_ptr    = field_ptr->clone ();
 			_elem_ptr     = static_cast<ElementAbstract*>  (new typename Field_qcq::Element ());
 			_randIter_ptr = static_cast<RandIterAbstract*> (new typename Field_qcq::RandIter (*field_ptr));
 		}
-	 
-		/** Template method for constructing archetype from a class not derived 
+
+		/** Template method for constructing archetype from a class not derived
 		 * from FieldAbstract.
-		 * This class is needed to help the constructor differentiate between 
+		 * This class is needed to help the constructor differentiate between
 		 * classes derived from FieldAbstract and classes that aren't.
 		 * Should be called with the same argument to both parameters?
 		 * @param	trait	pointer to class not derived from FieldAbstract
 		 * @param	field_ptr	pointer to class not derived from FieldAbstract
 		 */
 		template<class Field_qcq>
-		void constructor (void      *trait, 
+		void constructor (void      *trait,
 				  Field_qcq *field_ptr)
 		{
 			FieldEnvelope< Field_qcq > EnvF (*field_ptr);
@@ -705,12 +695,13 @@ namespace LinBox
 		/** Only authorize inhertied classes to use the empty constructor
 		 **/
 		FieldArchetype() {}
-		
+
 
 	}; // class FieldArchetype
-  
+
 } // namespace LinBox
 
 #include "linbox/randiter/archetype.h"
 
-#endif // __FIELD_ARCHETYPE_H
+#endif // __LINBOX_field_archetype_H
+
diff --git a/linbox/field/block-ring.h b/linbox/field/block-ring.h
index 7034ac7..8cc4828 100644
--- a/linbox/field/block-ring.h
+++ b/linbox/field/block-ring.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/fields/blas-ring.h
  * Copyright (C) 2007 LinBox Team
  *
@@ -9,554 +9,581 @@
  */
 
 
-#ifndef __BLOCKRING_H
-#define __BLOCKRING_H
+#ifndef __LINBOX_blockring_H
+#define __LINBOX_blockring_H
 #include <iostream>
 #include "linbox/matrix/blas-matrix.h"
 #include "linbox/field/field-interface.h"
 //#include "linbox/matrix/blas-domain.h"
 #include "linbox/algorithms/blas-domain.h"
-#include "linbox/fflas/fflas.h"
+#include "fflas-ffpack/fflas/fflas.h"
 
-namespace LinBox {
-	
-	
-/** Elements are wrapped BlasMatrix objects.
+namespace LinBox
+{
 
-    Operations expect conformal sizes for inputs and outputs.
 
-    You can expect good performance due to BLAS usage,
-    especially when the Field is Modular<double> or Modular<float>.
- */
+	/** Elements are wrapped BlasMatrix objects.
 
-template < class _Field >
-class BlockRing : public FieldInterface
-{
-    public:
-	_Field _F;
-	BlasMatrixDomain<_Field> _D;        
-	size_t _b;
-	
-	typedef BlasMatrix<typename _Field::Element> Matrix;
-	typedef typename _Field::Element Scalar;
-	
-	
-	
-	/// default constructable wrapper for BlasMatrix
-	class Element 
-	{ 
-		
-	    public:
-		
-		typedef _Field Field;
-		typedef Scalar Entry;
-		
-		Element() : matrix(0) {}
-		
-		~Element() { 
-			release(); 
-		}
-		
-		// copy constructor
-		Element(const Element& e) : matrix(0){
-			if (e.matrix != 0) {
-				matrix = new Matrix(*(e.matrix));
-				// memory leak of previous value?
+	  Operations expect conformal sizes for inputs and outputs.
+
+	  You can expect good performance due to BLAS usage,
+	  especially when the Field is Modular<double> or Modular<float>.
+	  */
+
+	template < class _Field >
+	class BlockRing : public FieldInterface {
+	public:
+		_Field _F;
+		BlasMatrixDomain<_Field> _D;
+		size_t _b;
+
+		typedef BlasMatrix<typename _Field::Element> Matrix;
+		typedef typename _Field::Element Scalar;
+
+
+
+		/// default constructable wrapper for BlasMatrix
+		class Element {
+
+		public:
+
+			typedef _Field Field;
+			typedef Scalar Entry;
+
+			Element() :
+				matrix(0)
+			{}
+
+			~Element() {
+				release();
 			}
-		}
-		
-		// overload assignment
-		Element& operator= (const Element& e) {
-			if (matrix == e.matrix) {
-				return *this;
-			}  else if (e.matrix == 0) {
+
+			// copy constructor
+			Element(const Element& e) :
+				matrix(0)
+			{
+				if (e.matrix != 0) {
+					matrix = new Matrix(*(e.matrix));
+					// memory leak of previous value?
+				}
+			}
+
+			// overload assignment
+			Element& operator= (const Element& e) {
+				if (matrix == e.matrix) {
+					return *this;
+				}
+				else if (e.matrix == 0) {
+					release();
+					return *this;
+				}
+				else {
+					//set(new Matrix(*(e.matrix))); // does this really copy?
+					clone(e);
+					return *this;
+				}
+			}
+
+			void clone(const Element& A) {
+				// make this a deep copy of A
+				// BlasMatrix copy constructor is shallow!
+
 				release();
-				return *this;
-			} else {
-				//set(new Matrix(*(e.matrix))); // does this really copy?
-				clone(e);
-				return *this;
+
+				if(A.matrix == 0) return;
+
+				size_t rows = A.matrix->rowdim();
+				size_t cols = A.matrix->coldim();
+
+				set(new Matrix(rows, cols));
+
+				Scalar* a=A.matrix->getPointer();
+				Scalar* b=  matrix->getPointer();
+
+				for(size_t i=0; i < rows*cols; ++i) {
+					*b=*a;
+					++a; ++b;
+				}
+
+
 			}
-		}
-		
-		void clone(const Element& A) {
-			// make this a deep copy of A
-			// BlasMatrix copy constructor is shallow!
-			
-			release();
-			
-			if(A.matrix == 0) return;
-			
-			size_t rows = A.matrix->rowdim();
-			size_t cols = A.matrix->coldim();
-			
-			set(new Matrix(rows, cols));
-			
-			Scalar* a=A.matrix->getPointer();
-			Scalar* b=  matrix->getPointer();
-			
-			for(size_t i=0; i < rows*cols; i++) {
-				*b=*a;
-				a++; b++;
+
+			// cleanly deletes the current stored value
+			// before assigning to the new value
+			void set(Matrix* thematrix) {
+				this -> release();
+				matrix = thematrix;
 			}
-			
-			
+
+			Matrix* matrix;
+
+		private:
+
+			void release() {
+				if (matrix != 0 )
+					delete matrix;
+				matrix = 0;
+			}
+
+		}; // class Element
+
+
+		class RandIter {
+			typedef typename _Field::RandIter FieldRandIter;
+
+			FieldRandIter r;
+			size_t dim;
+
+		public:
+			RandIter(const BlockRing<_Field>& BR,
+				 const integer size=0,
+				 const integer seed=0) :
+				r(BR._F, size, seed), dim(BR._b) {}
+
+			Element& random(Element& e) const
+			{
+				// e must be init'd
+				for(size_t i=0; i < e. matrix -> rowdim(); ++i)
+					for(size_t j=0; j < e. matrix -> coldim(); ++j)
+						r.random(e.matrix->refEntry(i,j));
+				return e;
 			}
-		
-		// cleanly deletes the current stored value
-		// before assigning to the new value
-		void set(Matrix* thematrix) {
-			this -> release();
-			matrix = thematrix;
-		}
-		
-		Matrix* matrix;
-		
-	    private:
-		
-		void release() {
-			if (matrix != 0 ) 
-				delete matrix;
-			matrix = 0;
-		}  
-		
-	}; // class Element
-	
-	
-	class RandIter 
-	{
-		typedef typename _Field::RandIter FieldRandIter;
-		
-		FieldRandIter r;
-		size_t dim;
-		
-	    public:
-		RandIter(const BlockRing<_Field>& BR, 
-			 const integer size=0, 
-			 const integer seed=0) :
-			r(BR._F, size, seed), dim(BR._b) {}
-		
-		Element& random(Element& e) const {
-			// e must be init'd
-			for(size_t i=0; i < e. matrix -> rowdim(); i++)
-				for(size_t j=0; j < e. matrix -> coldim(); j++)
-					r.random(e.matrix->refEntry(i,j));
-			return e;
-		}
-		
-	}; //class RandIter
-	
-	
-	BlockRing(const _Field& F, size_t d=1)
-		: _F(F), _D(F), _b(d) {}
-	
-	Element& init(Element& B) const {
-		// B is garbage from memory
-		B.set(new Matrix(_b,_b));
-		return B;
-	}
-	
-	template <typename ints>
+
+		}; //class RandIter
+
+
+		BlockRing(const _Field& F, size_t d=1) :
+			_F(F), _D(F), _b(d)
+		{}
+
+		Element& init(Element& B) const
+		{
+			// B is garbage from memory
+			B.set(new Matrix(_b,_b));
+			return B;
+		}
+
+		template <typename ints>
 		Element& init(Element& B, ints n, size_t r = 0, size_t c = 0) const
 		// n supposed to be integer, r num rows, c num cols
-	{ 
-		// default block dim is default dim of ring, but others are allowed.
-		if (r == 0) r = _b; 
-		if (c == 0) c = _b; 
-		
-		B.set(new Matrix(r,c));
-		
-		size_t k = ( (r < c) ? r : c );
-		
-		typename _Field::Element N; _F.init(N, n);
-		
-		for (size_t i = 0; i < k; ++i) (B.matrix)->setEntry(i, i, N);
-		
-		return B;
-		
-	}
-	
-	
-	template <typename ints>
-	ints& convert(ints& x) const
-	{
-		return _F.convert(x);
-	}
-	
-	
-	template <typename ints>
-	ints& convert(ints& x, const Element &A) const 
-	{
-		return _F.convert(x, *(A.matrix->getPointer()));
-	}
-	
-	Element& assign(Element &A, const Element &B) const
-	{
-		return A = B;
-	}
-	
-	
-	integer& cardinality(integer &c) const
-	{
-		// c = p^(b^2)
-		
-		_F.cardinality(c);
-		
+		{
+			// default block dim is default dim of ring, but others are allowed.
+			if (r == 0) r = _b;
+			if (c == 0) c = _b;
+
+			B.set(new Matrix(r,c));
+
+			size_t k = ( (r < c) ? r : c );
+
+			typename _Field::Element N; _F.init(N, n);
+
+			for (size_t i = 0; i < k; ++i) (B.matrix)->setEntry(i, i, N);
+
+			return B;
+
+		}
+
+
+		template <typename ints>
+		ints& convert(ints& x) const
+		{
+			return _F.convert(x);
+		}
+
+
+		template <typename ints>
+		ints& convert(ints& x, const Element &A) const
+		{
+			return _F.convert(x, *(A.matrix->getPointer()));
+		}
+
+		Element& assign(Element &A, const Element &B) const
+		{
+			return A = B;
+		}
+
+
+		integer& cardinality(integer &c) const
+		{
+			// c = p^(b^2)
+
+			_F.cardinality(c);
+
 			if(c > 1) // _F is a finite field
 			{
 				integer tmp, n;
 				n = _b*_b;
 				c = expt(tmp, c, n);
-				} // else c  = -1
-			
+			} // else c  = -1
+
 			return c;
-	}
-	
-	
-	integer& characteristic(integer &c) const
-	{
-		return _F.characteristic(c);
-	}
-	
-	size_t dim() const { return _b; }
-	
-	
-	//Operations
-	// 
-	// All operations will work for matrices of dim != _b
-	// but assume that the dimensions of all the given matrices
-	// are compatible with the dimensions of the A operand.
-	
-	//Operations from the Matrix Domain:
-	
-	Element& mul(Element& C, const Element& A, const Element& B) const
-	{
-		_D.mul(*(C.matrix), *(A.matrix), *(B.matrix)); 
-		return C;
-	}
-	
-	
-	//non-commutative: use mulin_left: A = A*B
-	Element& mulin(Element& A, const Element& B) const
-	{
-		_D.mulin_left(*(A.matrix), *(B.matrix)); 
-		return A;
-	}
-	
-	// D = A*X+Y
-	Element& axpy(Element& D, const Element& A, const Element& X, const Element& Y) const
-		{
-			_D.axpy(*(D.matrix), *(A.matrix), *(X.matrix), *(Y.matrix)); 
+		}
+
+		integer& characteristic(integer &c) const
+		{
+			return _F.characteristic(c);
+		}
+
+		unsigned long cardinality() const
+		{
+			return _F. cardinality() ;
+		}
+
+		unsigned long characteristic() const
+		{
+			return _F. characteristic() ;
+		}
+
+
+
+		size_t dim() const
+		{
+			return _b;
+		}
+
+
+		//Operations
+		//
+		// All operations will work for matrices of dim != _b
+		// but assume that the dimensions of all the given matrices
+		// are compatible with the dimensions of the A operand.
+
+		//Operations from the Matrix Domain:
+
+		Element& mul(Element& C, const Element& A, const Element& B) const
+		{
+			_D.mul(*(C.matrix), *(A.matrix), *(B.matrix));
+			return C;
+		}
+
+
+		//non-commutative: use mulin_left: A = A*B
+		Element& mulin(Element& A, const Element& B) const
+		{
+			_D.mulin_left(*(A.matrix), *(B.matrix));
+			return A;
+		}
+
+		// D = A*X+Y
+		Element& axpy(Element& D, const Element& A, const Element& X, const Element& Y) const
+		{
+			_D.axpy(*(D.matrix), *(A.matrix), *(X.matrix), *(Y.matrix));
 			return D;
 		}
-	
-	// R = A*X+R
-	Element& axpyin(Element& R, const Element& A, const Element& X) const
-	{
-			_D.axpyin(*(R.matrix), *(A.matrix), *(X.matrix)); 
+
+		// R = A*X+R
+		Element& axpyin(Element& R, const Element& A, const Element& X) const
+		{
+			_D.axpyin(*(R.matrix), *(A.matrix), *(X.matrix));
 			return R;
-	}
-	
-	
-	// These operations will not work for all elements
-	// and no checks are provided!
-	
-	// B = A^{-1}
-	Element& inv(Element& B, const Element& A) const {
-		
-		int nullflag = 0;
-		
-		_D.inv(*(B.matrix), *(A.matrix), nullflag);
-
-                if (nullflag)
-                  throw PreconditionFailed(__FUNCTION__,__LINE__,"InvMatrix: inverse undefined");
-			
-		return B;
-	}
-	
-	// A=A^{-1} not really inplace!
-	Element& invin(Element& A) const {
-		
-		int nullflag = 0;
-		
-		//_D.invin(A, A, nullflag);
-		
-		Element B;  init(B, A.matrix->rowdim(), A.matrix->coldim());
-                _D.inv(*(B.matrix), *(A.matrix), nullflag);
-                
-                if (nullflag)
-                     throw PreconditionFailed(__FUNCTION__,__LINE__,"InvMatrix: inverse undefined");
-                
-                A=B;
-			
-		return A;
-	}
-	
-	
+		}
+
+
+		// These operations will not work for all elements
+		// and no checks are provided!
+
+		// B = A^{-1}
+		Element& inv(Element& B, const Element& A) const
+		{
+
+			int nullflag = 0;
+
+			_D.inv(*(B.matrix), *(A.matrix), nullflag);
+
+			if (nullflag)
+				throw PreconditionFailed(__func__,__FILE__,__LINE__,"InvMatrix: inverse undefined");
+
+			return B;
+		}
+
+		// A=A^{-1} not really inplace!
+		Element& invin(Element& A) const
+		{
+
+			int nullflag = 0;
+
+			//_D.invin(A, A, nullflag);
+
+			Element B;  init(B, A.matrix->rowdim(), A.matrix->coldim());
+			_D.inv(*(B.matrix), *(A.matrix), nullflag);
+
+			if (nullflag)
+				throw PreconditionFailed(__func__,__FILE__,__LINE__,"InvMatrix: inverse undefined");
+
+			A=B;
+
+			return A;
+		}
+
+
 		// C = A*B^{-1}
-	Element& div(Element& C, const Element& A, const Element& B) const {
-		
-		_D.right_solve(*(C.matrix),*(B.matrix),*(A.matrix));
-		return C;
-	}
-		
-	
-	//A = A*B^{-1};
-	Element& divin( Element& A, const Element& B) const {
-		_D.right_solve(*(B.matrix),*(A.matrix)); 
-		return A;
-	}
-	
-		
-	
-	
-	// Unwrapped operations using simple loops:
-	
-	// C = A + B
-	Element& add(Element& C, const Element& A, const Element& B) const
-	{
-		size_t rows = A.matrix->rowdim();
-		size_t cols = A.matrix->coldim();
-		
-		Scalar* a=A.matrix->getPointer();
-		Scalar* b=B.matrix->getPointer();
-		Scalar* c=C.matrix->getPointer();
-		
-		//FFLAS::fcopy(_F, rows*cols, b, 1, c, 1); // C = B
-		
-		
-		for(size_t i=0; i < rows*cols; i++) {
-			_F.add(*c,*a,*b);
-				a++; b++; c++;
-		}
-		
-		//Scalar alpha; _F.init(alpha, 1);
-		//FFLAS::faxpy(_F, rows*cols, alpha, a, 1, c, 1);
-		
-		return C;
-	}
-	
-	// A = A + B
-	Element& addin(Element& A, const Element& B) const
-	{
-		size_t r = A.matrix->rowdim();
-		size_t c = A.matrix->coldim();
-		
-		Scalar* a=A.matrix->getPointer();
-		Scalar* b=B.matrix->getPointer();
-		
-		for(size_t i=0; i < r*c; i++) {
-			_F.addin(*a,*b);
-			a++; b++;
-		}
-		
-		return A;
-		
-	}
-	
-	
-	// C = A - B
-	Element& sub(Element& C, const Element& A, const Element& B) const
-	{
-		size_t rows = A.matrix->rowdim();
-		size_t cols = A.matrix->coldim();
-		
-		Scalar* a=A.matrix->getPointer();
-		Scalar* b=B.matrix->getPointer();
-		Scalar* c=C.matrix->getPointer();
-		
-		
-		for(size_t i=0; i < rows*cols; i++) {
-			_F.sub(*c,*a,*b);
-			a++; b++; c++;
-		}
-		
-		return C;
-	}
-	
-	
-	// A = A - B
-	Element& subin(Element& A, const Element& B) const
-	{
-		size_t r = A.matrix->rowdim();
-		size_t c = A.matrix->coldim();
-		
-		Scalar* a=A.matrix->getPointer();
-		Scalar* b=B.matrix->getPointer();
-		
-		for(size_t i=0; i < r*c; i++) {
-			_F.subin(*a,*b);
-			a++; b++;
-		}
-		
-		return A;
-	}
-	
-	
-	//B = -1*A
-	Element& neg(Element& B, const Element& A) const
-	{
-		size_t r = A.matrix->rowdim();
-		size_t c = A.matrix->coldim();
-		
-		Scalar* a=A.matrix->getPointer();
-		Scalar* b=B.matrix->getPointer();
-		
-		for(size_t i=0; i < r*c; i++) {
-			_F.neg(*b,*a);
-			a++; b++;
-		}
-		
-		return B;
-	}
-	
-	
-	//A = -1*A
-	Element& negin(Element& A) const
-	{
-		size_t r = A.matrix->rowdim();
-		size_t c = A.matrix->coldim();
-		
-		Scalar* a=A.matrix->getPointer();
-		
-		for(size_t i=0; i < r*c; i++) {
-			_F.negin(*a);
-			a++;
-		}
-		
-		return A;
-	}
-	
-	bool areEqual(const Element& A, const Element& B) const
-	{
-		
-		size_t r = A.matrix->rowdim();
-		size_t c = A.matrix->coldim();
-		
-		Scalar* a=A.matrix->getPointer();
-		Scalar* b=B.matrix->getPointer();
-		
-		for(size_t i=0; i < r*c; i++) {
-			
-			if(!_F.areEqual(*a,*b)) {
+		Element& div(Element& C, const Element& A, const Element& B) const
+		{
+
+			_D.right_solve(*(C.matrix),*(B.matrix),*(A.matrix));
+			return C;
+		}
+
+
+		//A = A*B^{-1};
+		Element& divin( Element& A, const Element& B) const
+		{
+			_D.right_solve(*(B.matrix),*(A.matrix));
+			return A;
+		}
+
+
+
+
+		// Unwrapped operations using simple loops:
+
+		// C = A + B
+		Element& add(Element& C, const Element& A, const Element& B) const
+		{
+			size_t rows = A.matrix->rowdim();
+			size_t cols = A.matrix->coldim();
+
+			Scalar* a=A.matrix->getPointer();
+			Scalar* b=B.matrix->getPointer();
+			Scalar* c=C.matrix->getPointer();
+
+			//FFLAS::fcopy(_F, rows*cols, b, 1, c, 1); // C = B
+
+
+			for(size_t i=0; i < rows*cols; ++i) {
+				_F.add(*c,*a,*b);
+				++a; ++b; c++;
+			}
+
+			//Scalar alpha; _F.init(alpha, 1);
+			//FFLAS::faxpy(_F, rows*cols, alpha, a, 1, c, 1);
+
+			return C;
+		}
+
+		// A = A + B
+		Element& addin(Element& A, const Element& B) const
+		{
+			size_t r = A.matrix->rowdim();
+			size_t c = A.matrix->coldim();
+
+			Scalar* a=A.matrix->getPointer();
+			Scalar* b=B.matrix->getPointer();
+
+			for(size_t i=0; i < r*c; ++i) {
+				_F.addin(*a,*b);
+				++a; ++b;
+			}
+
+			return A;
+
+		}
+
+
+		// C = A - B
+		Element& sub(Element& C, const Element& A, const Element& B) const
+		{
+			size_t rows = A.matrix->rowdim();
+			size_t cols = A.matrix->coldim();
+
+			Scalar* a=A.matrix->getPointer();
+			Scalar* b=B.matrix->getPointer();
+			Scalar* c=C.matrix->getPointer();
+
+
+			for(size_t i=0; i < rows*cols; ++i) {
+				_F.sub(*c,*a,*b);
+				++a; ++b; c++;
+			}
+
+			return C;
+		}
+
+
+		// A = A - B
+		Element& subin(Element& A, const Element& B) const
+		{
+			size_t r = A.matrix->rowdim();
+			size_t c = A.matrix->coldim();
+
+			Scalar* a=A.matrix->getPointer();
+			Scalar* b=B.matrix->getPointer();
+
+			for(size_t i=0; i < r*c; ++i) {
+				_F.subin(*a,*b);
+				++a; ++b;
+			}
+
+			return A;
+		}
+
+
+		//B = -1*A
+		Element& neg(Element& B, const Element& A) const
+		{
+			size_t r = A.matrix->rowdim();
+			size_t c = A.matrix->coldim();
+
+			Scalar* a=A.matrix->getPointer();
+			Scalar* b=B.matrix->getPointer();
+
+			for(size_t i=0; i < r*c; ++i) {
+				_F.neg(*b,*a);
+				++a; ++b;
+			}
+
+			return B;
+		}
+
+
+		//A = -1*A
+		Element& negin(Element& A) const
+		{
+			size_t r = A.matrix->rowdim();
+			size_t c = A.matrix->coldim();
+
+			Scalar* a=A.matrix->getPointer();
+
+			for(size_t i=0; i < r*c; ++i) {
+				_F.negin(*a);
+				++a;
+			}
+
+			return A;
+		}
+
+		bool areEqual(const Element& A, const Element& B) const
+		{
+
+			size_t r = A.matrix->rowdim();
+			size_t c = A.matrix->coldim();
+
+			Scalar* a=A.matrix->getPointer();
+			Scalar* b=B.matrix->getPointer();
+
+			for(size_t i=0; i < r*c; ++i) {
+
+				if(!_F.areEqual(*a,*b)) {
+					return false;
+				}
+
+				++a; ++b;
+			}
+			return true;
+		}
+
+
+		bool isOne(const Element& X) const
+		{
+			size_t n = X.matrix->rowdim();
+
+			if(n != X.matrix->coldim()) {
 				return false;
 			}
-			
-			a++; b++;
-		}
-		return true;
-	}
-	
-	
-	bool isOne(const Element& X) const
-	{
-		size_t n = X.matrix->rowdim();
-		
-		if(n != X.matrix->coldim()) {
-			return false;
-		}
-		
-		Scalar* x=X.matrix->getPointer();
-		
-		for(size_t i=1; i <= n; i++) 
-			for(size_t j=1; j <= n; j++) 
-			{
-				if(i==j) { // on the diagonal
-					if(!_F.isOne(*x)) {
-						return false;
+
+			Scalar* x=X.matrix->getPointer();
+
+			for(size_t i=1; i <= n; ++i)
+				for(size_t j=1; j <= n; ++j)
+				{
+					if(i==j) { // on the diagonal
+						if(!_F.isOne(*x)) {
+							return false;
+						}
 					}
-				}
-				else {
-					if(!_F.isZero(*x)) {
-						return false;
+					else {
+						if(!_F.isZero(*x)) {
+							return false;
+						}
 					}
+
+					x++;
 				}
-				
+
+
+			return true;
+		}
+
+
+		bool isZero(const Element& X) const
+		{
+
+			size_t r = X.matrix->rowdim();
+			size_t c = X.matrix->coldim();
+
+			Scalar* x=X.matrix->getPointer();
+
+			for(size_t i=0; i < r*c; ++i)
+			{
+				if(!_F.isZero(*x)) {
+					return false;
+				}
+
 				x++;
 			}
-		
-		
-		return true;
-	}
-	
-	
-	bool isZero(const Element& X) const
-	{
-			
-		size_t r = X.matrix->rowdim();
-		size_t c = X.matrix->coldim();
-		
-		Scalar* x=X.matrix->getPointer();
-		
-		for(size_t i=0; i < r*c; i++) 
-		{
-			if(!_F.isZero(*x)) {
-				return false;
+
+			return true;
+		}
+
+
+		//stubs for read and write field
+		std::ostream& write(std::ostream& os) const
+		{
+			return _F.write(os << "Dimension " << _b << " square matrices over ");
+		}
+
+
+
+		std::istream& read(std::istream& is)
+		{
+			return is;
+		}
+
+		// wrapped read and write element
+		std::ostream& write(std::ostream& os, const Element& A) const
+		{
+			return (A.matrix)->write(os << std::endl, _F);
+		}
+
+
+		std::istream& read(std::istream& is, const Element& A) const
+		{
+
+			return (A.matrix)->read(is, _F);
+		}
+
+
+	private:
+
+
+		// recursive helper to compute exponentiation of integers
+		static	  integer& expt (integer& res, integer& a, integer& n)
+		{
+			if (n == 0) {
+				res=1;
+			}
+			else if (n == 1) {
+				res=a;
+			}
+			else if (n[0] & 1) {
+				n -= 1;
+				expt(res, a, n);
+				res*=a;
 			}
-			
-			x++;  
-		}
-		
-		return true;
-	}
-	
-	
-	//stubs for read and write field
-	std::ostream& write(std::ostream& os) const 
-	{
-		return _F.write(os << "Dimension " << _b << " square matrices over ");
-	}
-	
-	
-	
-	std::istream& read(std::istream& is) 
-	{
-		return is;
-	}
-	
-	// wrapped read and write element
-	std::ostream& write(std::ostream& os, const Element& A) const 
-	{
-		return (A.matrix)->write(os << std::endl, _F);
-	}
-	
-	
-	std::istream& read(std::istream& is, const Element& A) const 
-	{
-		
-		return (A.matrix)->read(is, _F);
-	}
-	
-	
-    private:
-	
-	
-	// recursive helper to compute exponentiation of integers
-	static	  integer& expt (integer& res, integer& a, integer& n)
-	{
-		if (n == 0) {
-			res=1;
-		}
-		else if (n == 1) {
-			res=a;
-		}
-		else if (n[0] & 1) {
-			n -= 1;
-			expt(res, a, n);
-			res*=a;
-		} else {
-			n /= 2;
-			expt(res, a, n);
-			res*=res;
-		}
-		
-		return res;
-	}
-	
-	
-	
-  }; // BlockRing
-	
+			else {
+				n /= 2;
+				expt(res, a, n);
+				res*=res;
+			}
+
+			return res;
+		}
+
+
+
+	}; // BlockRing
+
 } // LinBox
 
-#endif // __BLOCKRING_H
+#endif // __LINBOX_blockring_H
+
diff --git a/linbox/field/envelope.h b/linbox/field/envelope.h
index 4c8c4b8..d9f1f70 100644
--- a/linbox/field/envelope.h
+++ b/linbox/field/envelope.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/field/envelope.h
  * Copyright (C) 1999-2001 William J Turner,
  *               2001 Bradford Hovinen
@@ -24,13 +24,13 @@
  *
  * ------------------------------------
  * 2002-05-14 William J. Turner <wjturner at acm.org>
- * 
+ *
  * changed randIter to RandIter.
  * ------------------------------------
  */
 
-#ifndef __FIELD_ENVELOPE_H
-#define __FIELD_ENVELOPE_H
+#ifndef __LINBOX_field_envelope_H
+#define __LINBOX_field_envelope_H
 
 #include <iostream>
 
@@ -47,16 +47,16 @@
 #include "linbox/util/xml/linbox-reader.h"
 #include "linbox/util/xml/linbox-writer.h"
 
-#endif
+#endif //__LINBOX_XMLENABLED
 
 // Namespace in which all LinBox code resides
-namespace LinBox 
-{ 
+namespace LinBox
+{
 	// Forward declarations
 	template <class Field> class RandIterEnvelope;
 
 	/** \brief Derived class used to implement the field archetype
-	\ingroup field
+	  \ingroup field
 
 	  Helps to minimize
 	 * code bloat.  This class implements all purely virtual member functions
@@ -65,9 +65,8 @@ namespace LinBox
 	 * field so that it might be used with the Field archetype.
 	 */
 	template <class Field>
-	class FieldEnvelope : public FieldAbstract
-	{
-	    public:
+	class FieldEnvelope : public FieldAbstract {
+	public:
 
 		/** element type.
 		 * It is derived from the class ElementAbstract, and it must contain
@@ -82,33 +81,39 @@ namespace LinBox
 		typedef RandIterEnvelope<Field> RandIter;
 
 		/** @name Object Management
-		 */
+		*/
 		//@{
- 
+
 		/** Default constructor.
-		 * In this implementation, this means copying the field {\tt E.\_field}.
+		 * In this implementation, this means copying the field \c E._field.
 		 */
 		FieldEnvelope (void) {}
 
 		/** Constructor from field to be wrapped.
 		 * @param F Field object to be wrapped.
 		 */
-		FieldEnvelope (const Field& F) : _field (F) {}
- 
+		FieldEnvelope (const Field& F) :
+			_field (F)
+		{}
+
 		/** Copy constructor.
 		 * Constructs FieldEnvelope object by copying the field.
 		 * This is required to allow field objects to be passed by value
 		 * into functions.
-		 * In this implementation, this means copying the field {\tt E.\_field}.
+		 * In this implementation, this means copying the field \c E._field.
 		 * @param  E FieldEnvelope object.
 		 */
-		FieldEnvelope (const FieldEnvelope& E) : _field (E._field) {}
+		FieldEnvelope (const FieldEnvelope& E) :
+			_field (E._field)
+		{}
 
 #ifdef __LINBOX_XMLENABLED
-		FieldEnvelope(Reader &R) : _field(R) {}
+		FieldEnvelope(Reader &R) :
+			_field(R)
+		{}
 #endif
 
- 
+
 		/** Virtual copy constructor.
 		 * Required because constructors cannot be virtual.
 		 * Passes construction on to derived classes.
@@ -116,7 +121,7 @@ namespace LinBox
 		 * @return pointer to new object in dynamic memory.
 		 */
 		FieldAbstract* clone () const
-			{ return new FieldEnvelope (*this); }
+		{ return new FieldEnvelope (*this); }
 
 		/** Assignment operator.
 		 * Required by abstract base class.
@@ -146,7 +151,7 @@ namespace LinBox
 			_field.init (static_cast<ElementEnvelope<Field>&> (x)._elem, y);
 			return x;
 		}
- 
+
 		/** Conversion of field base element to a template class T.
 		 * This function assumes the output field base element x has already been
 		 * constructed, but that it is not already initialized.
@@ -159,7 +164,7 @@ namespace LinBox
 			_field.convert (x, static_cast<const ElementEnvelope<Field>&> (y)._elem);
 			return x;
 		}
- 
+
 		/** Assignment of one field base element to another.
 		 * This function assumes both field base elements have already been
 		 * constructed and initialized.
@@ -182,8 +187,8 @@ namespace LinBox
 		 * @return integer representing cardinality of the domain
 		 */
 		integer& cardinality (integer& c) const
-			{ return _field.cardinality (c); }
- 
+		{ return _field.cardinality (c); }
+
 		/** Characteristic.
 		 * Return integer representing characteristic of the domain.
 		 * Returns a positive integer to all domains with finite characteristic,
@@ -191,7 +196,7 @@ namespace LinBox
 		 * @return integer representing characteristic of the domain.
 		 */
 		integer& characteristic (integer& c) const
-			{ return _field.characteristic (c); }
+		{ return _field.characteristic (c); }
 
 		//@} Object Management
 
@@ -226,15 +231,15 @@ namespace LinBox
 		 * @param  z field base element.
 		 */
 		ElementAbstract& add (ElementAbstract& x,
-				       const ElementAbstract& y,
-				       const ElementAbstract& z) const
+				      const ElementAbstract& y,
+				      const ElementAbstract& z) const
 		{
 			_field.add (static_cast<ElementEnvelope<Field>&> (x)._elem,
 				    static_cast<const ElementEnvelope<Field>&> (y)._elem,
 				    static_cast<const ElementEnvelope<Field>&> (z)._elem);
 			return x;
 		}
- 
+
 		/** Subtraction.
 		 * x = y - z
 		 * This function assumes all the field base elements have already been
@@ -245,15 +250,15 @@ namespace LinBox
 		 * @param  z field base element.
 		 */
 		ElementAbstract& sub (ElementAbstract& x,
-				       const ElementAbstract& y,
-				       const ElementAbstract& z) const
+				      const ElementAbstract& y,
+				      const ElementAbstract& z) const
 		{
 			_field.sub (static_cast<ElementEnvelope<Field>&> (x)._elem,
 				    static_cast<const ElementEnvelope<Field>&> (y)._elem,
 				    static_cast<const ElementEnvelope<Field>&> (z)._elem);
 			return x;
 		}
- 
+
 		/** Multiplication.
 		 * x = y * z
 		 * This function assumes all the field base elements have already been
@@ -264,15 +269,15 @@ namespace LinBox
 		 * @param  z field base element.
 		 */
 		ElementAbstract& mul (ElementAbstract& x,
-				       const ElementAbstract& y,
-				       const ElementAbstract& z) const
+				      const ElementAbstract& y,
+				      const ElementAbstract& z) const
 		{
 			_field.mul (static_cast<ElementEnvelope<Field>&> (x)._elem,
 				    static_cast<const ElementEnvelope<Field>&> (y)._elem,
 				    static_cast<const ElementEnvelope<Field>&> (z)._elem);
 			return x;
 		}
- 
+
 		/** Division.
 		 * x = y / z
 		 * This function assumes all the field base elements have already been
@@ -283,15 +288,15 @@ namespace LinBox
 		 * @param  z field base element.
 		 */
 		ElementAbstract& div (ElementAbstract& x,
-				       const ElementAbstract& y,
-				       const ElementAbstract& z) const
+				      const ElementAbstract& y,
+				      const ElementAbstract& z) const
 		{
 			_field.div (static_cast<ElementEnvelope<Field>&> (x)._elem,
 				    static_cast<const ElementEnvelope<Field>&> (y)._elem,
 				    static_cast<const ElementEnvelope<Field>&> (z)._elem);
 			return x;
 		}
- 
+
 		/** Additive Inverse (Negation).
 		 * x = - y
 		 * This function assumes both field base elements have already been
@@ -306,7 +311,7 @@ namespace LinBox
 				    static_cast<const ElementEnvelope<Field>&> (y)._elem);
 			return x;
 		}
- 
+
 		/** Multiplicative Inverse.
 		 * x = 1 / y
 		 * This function assumes both field base elements have already been
@@ -324,7 +329,7 @@ namespace LinBox
 
 		/** Natural AXPY.
 		 * r  = a * x + y
-		 * This function assumes all field elements have already been 
+		 * This function assumes all field elements have already been
 		 * constructed and initialized.
 		 * @return reference to r.
 		 * @param  r field element (reference returned).
@@ -332,10 +337,10 @@ namespace LinBox
 		 * @param  x field element.
 		 * @param  y field element.
 		 */
-		ElementAbstract& axpy (ElementAbstract& r, 
-					const ElementAbstract& a, 
-					const ElementAbstract& x, 
-					const ElementAbstract& y) const
+		ElementAbstract& axpy (ElementAbstract& r,
+				       const ElementAbstract& a,
+				       const ElementAbstract& x,
+				       const ElementAbstract& y) const
 		{
 			_field.axpy (static_cast<ElementEnvelope<Field>&> (r)._elem,
 				     static_cast<const ElementEnvelope<Field>&> (a)._elem,
@@ -343,9 +348,9 @@ namespace LinBox
 				     static_cast<const ElementEnvelope<Field>&> (y)._elem);
 			return r;
 		}
- 
+
 		//@} Arithmetic Operations
- 
+
 		/** @name Inplace Arithmetic Operations
 		 * x <- x op y; x <- op x
 		 */
@@ -359,8 +364,8 @@ namespace LinBox
 		 * @param  x field base element.
 		 */
 		bool isZero (const ElementAbstract& x) const
-			{ return _field.isZero (static_cast<const ElementEnvelope<Field>&> (x)._elem); }
- 
+		{ return _field.isZero (static_cast<const ElementEnvelope<Field>&> (x)._elem); }
+
 		/** One equality.
 		 * Test if field base element is equal to one.
 		 * This function assumes the field base element has already been
@@ -369,7 +374,7 @@ namespace LinBox
 		 * @param  x field base element.
 		 */
 		bool isOne (const ElementAbstract& x) const
-			{ return _field.isOne (static_cast<const ElementEnvelope<Field>&> (x)._elem); }
+		{ return _field.isOne (static_cast<const ElementEnvelope<Field>&> (x)._elem); }
 
 		/** Inplace Addition.
 		 * x += y
@@ -385,7 +390,7 @@ namespace LinBox
 				      static_cast<const ElementEnvelope<Field>&> (y)._elem);
 			return x;
 		}
- 
+
 		/** Inplace Subtraction.
 		 * x -= y
 		 * This function assumes both field base elements have already been
@@ -400,7 +405,7 @@ namespace LinBox
 				      static_cast<const ElementEnvelope<Field>&> (y)._elem);
 			return x;
 		}
- 
+
 		/** Inplace Multiplication.
 		 * x *= y
 		 * This function assumes both field base elements have already been
@@ -424,14 +429,14 @@ namespace LinBox
 		 * @param  x field base element (reference returned).
 		 * @param  y field base element.
 		 */
-		ElementAbstract& divin (ElementAbstract& x, 
-					 const ElementAbstract& y) const
+		ElementAbstract& divin (ElementAbstract& x,
+					const ElementAbstract& y) const
 		{
 			_field.divin (static_cast<ElementEnvelope<Field>&> (x)._elem,
 				      static_cast<const ElementEnvelope<Field>&> (y)._elem);
 			return x;
 		}
- 
+
 		/** Inplace Additive Inverse (Inplace Negation).
 		 * x = - x
 		 * This function assumes the field base element has already been
@@ -444,7 +449,7 @@ namespace LinBox
 			_field.negin (static_cast<ElementEnvelope<Field>&> (x)._elem);
 			return x;
 		}
- 
+
 		/** Inplace Multiplicative Inverse.
 		 * x = 1 / x
 		 * This function assumes the field base elementhas already been
@@ -460,23 +465,23 @@ namespace LinBox
 
 		/** Inplace AXPY.
 		 * r  += a * x
-		 * This function assumes all field elements have already been 
+		 * This function assumes all field elements have already been
 		 * constructed and initialized.
 		 * @return reference to r.
 		 * @param  r field element (reference returned).
 		 * @param  a field element.
 		 * @param  x field element.
 		 */
-		ElementAbstract& axpyin (ElementAbstract& r, 
-					  const ElementAbstract& a, 
-					  const ElementAbstract& x) const
+		ElementAbstract& axpyin (ElementAbstract& r,
+					 const ElementAbstract& a,
+					 const ElementAbstract& x) const
 		{
 			_field.axpyin (static_cast<ElementEnvelope<Field>&> (r)._elem,
 				       static_cast<const ElementEnvelope<Field>&> (a)._elem,
 				       static_cast<const ElementEnvelope<Field>&> (x)._elem);
 			return r;
 		}
- 
+
 		//@} Inplace Arithmetic Operations
 
 #ifndef __LINBOX_XMLENABLED
@@ -488,7 +493,7 @@ namespace LinBox
 		 * @param  os  output stream to which field is written.
 		 */
 		std::ostream& write (std::ostream& os) const { return _field.write (os); }
- 
+
 		/** Read field.
 		 * @return input stream from which field is read.
 		 * @param  is  input stream from which field is read.
@@ -503,8 +508,8 @@ namespace LinBox
 		 * @param  x   field base element.
 		 */
 		std::ostream& write (std::ostream& os, const ElementAbstract& x) const
-			{ return _field.write (os, static_cast<const ElementEnvelope<Field>&> (x)._elem); }
- 
+		{ return _field.write (os, static_cast<const ElementEnvelope<Field>&> (x)._elem); }
+
 		/** Read field base element.
 		 * This function assumes the field base element has already been
 		 * constructed and initialized.
@@ -513,7 +518,7 @@ namespace LinBox
 		 * @param  x   field base element.
 		 */
 		std::istream& read (std::istream& is, ElementAbstract& x) const
-			{ return _field.read (is, static_cast<ElementEnvelope<Field>&> (x)._elem); }
+		{ return _field.read (is, static_cast<ElementEnvelope<Field>&> (x)._elem); }
 
 		//@}
 #else
@@ -545,11 +550,11 @@ namespace LinBox
 			return _field.fromTag(R, static_cast<ElementEnvelope<Field>&>(x)._elem);
 		}
 #endif
-			
 
 
 
-	    protected:
+
+	protected:
 
 		friend class RandIterEnvelope<Field>;
 
@@ -562,4 +567,5 @@ namespace LinBox
 
 #include "linbox/randiter/envelope.h"
 
-#endif // __FIELD_ENVELOPE_H
+#endif // __LINBOX_field_envelope_H
+
diff --git a/linbox/field/field-interface.h b/linbox/field/field-interface.h
index 0d083e8..dd254c8 100644
--- a/linbox/field/field-interface.h
+++ b/linbox/field/field-interface.h
@@ -1,66 +1,65 @@
 /* -*- 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
 /* linbox/field/field-interface.h
  * Copyright (C) 2002 David Saunders
  *
  * For licensing information see COPYING
  */
 
-#ifndef __FIELD_INTERFACE_H
-#define __FIELD_INTERFACE_H
+#ifndef __LINBOX_field_interface_H
+#define __LINBOX_field_interface_H
 
 namespace LinBox
 {
-// LinBox Field Interface
-///
-/*
- * The LinBox {@link Fields field} common object {@link Interfaces interface}.
- * The field interface includes the following public members:
- *
- * Types: {\tt Element} and {\tt RandIter}.
- *
- * Object management member functions:
- *   null constructor, copy constructor, destructor, assignment operator, 
- *   {\tt convert(), init(), assign(), characteristic(), cardinality()}.
- *
- * Predicates on field elements:
- *   {\tt areEqual(), isZero(), isOne()}.
- *
- * Basic arithmetic functions:
- *   {\tt axpy(), add(), neg(), sub(), mul(), inv(), div()}.
- *
- * Inplace arithmetic functions:
- *   {\tt axpyin(), addin(), negin(), subin(), mulin(), invin(), divin()}.
- *
- * I/O functions:
- *   {\tt read()} and {\tt write()} for I/O of the field itself and for I/O of its elements.
- *
- * The field archetype class is is the reference instantiation of this 
- * interface and contains the generic specifications of the member functions.
- * Documentation in other field classes is more limited. It serves primarily to explain special properties 
- * specific to the class of the interface member functions and to explain any constructors 
- * or other functionality unique to the class.
- *
- *  @see Interfaces
-*/
-/** 
- * \brief This field base class exists solely to aid documentation organization.
+	// LinBox Field Interface
+	/*
+	 * The LinBox {@link Fields field} common object {@link Interfaces interface}.
+	 * The field interface includes the following public members:
+	 *
+	 * Types: \c Element and \c RandIter.
+	 *
+	 * Object management member functions:
+	 *   null constructor, copy constructor, destructor, assignment operator,
+	 *   \c convert(), \c init(), \c assign(), \c characteristic(), \c cardinality().
+	 *
+	 * Predicates on field elements:
+	 *   \c areEqual(), \c isZero(), \c isOne().
+	 *
+	 * Basic arithmetic functions:
+	 *   \c axpy(), \c add(), \c neg(), \c sub(), \c mul(), \c inv(),\c  div().
+	 *
+	 * Inplace arithmetic functions:
+	 *   \c axpyin(), \c addin(), \c negin(), \c subin(), \c mulin(), \c invin(), \c divin().
+	 *
+	 * I/O functions:
+	 *   \c read() and \c write() for I/O of the field itself and for I/O of its elements.
+	 *
+	 * The field archetype class is is the reference instantiation of this
+	 * interface and contains the generic specifications of the member functions.
+	 * Documentation in other field classes is more limited. It serves primarily to explain special properties
+	 * specific to the class of the interface member functions and to explain any constructors
+	 * or other functionality unique to the class.
+	 *
+	 *  @see Interfaces
+	 */
+	/**
+	 * \brief This field base class exists solely to aid documentation organization.
 
 
- *  For the general field member function documentation consult the {@link FieldArchetype
- FieldArchetype}. For specific properties of individual representations consult the specific field classes.
- \ingourp field
- */
-	class FieldInterface 
-{
-/*
-    public:
-	// this just demo's that some declarations could be here.
-	typedef ElementArchetype Element; 
-	virtual Element& mul(Element& c, const Element& a, const Element& b) const = 0;
-*/
-};// empty class so doc++ makes a nice hierarchy.
+	 *  For the general field member function documentation consult the
+	 *  @link FieldArchetype FieldArchetype at endlink. For specific properties of individual representations consult the specific field classes.
+	 \ingroup field
+	 */
+	class FieldInterface {
+#if 0
+	public:
+		// this just demo's that some declarations could be here.
+		typedef ElementArchetype Element;
+		virtual Element& mul(Element& c, const Element& a, const Element& b) const = 0;
+#endif
+	};// empty class so doc++ makes a nice hierarchy.
 
 } // namespace LinBox
 
-#endif // __FIELD_INTERFACE_H
+#endif // __LINBOX_field_interface_H
+
diff --git a/linbox/field/field-traits.h b/linbox/field/field-traits.h
index b5a25f4..c24e615 100644
--- a/linbox/field/field-traits.h
+++ b/linbox/field/field-traits.h
@@ -1,75 +1,104 @@
 /* -*- 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
 /* linbox/field/field-traits.h
  * Copyright (C) June 2004 Dan Roche
  * see COPYING for permissions etc.
  */
 
-#ifndef __FIELD_TRAITS_H
-#define __FIELD_TRAITS_H
+#ifndef __LINBOX_field_traits_H
+#define __LINBOX_field_traits_H
 
 #include <linbox/integer.h>
 
 // Namespace in which all LinBox library code resides
-namespace LinBox {
-
-/* \brief some basic information about each field or ring.  
-\ingroup field
-
-It will try
- * to take the information from the field when possible, and use defaults
- * otherwise.
- * maxModulus returns the greatest modulus that is usable for a given field, -1
- * for infinite. goodModulus returns takes an integer and returns true if that
- * integer is a valid modulus for the given field.
- * maxExponent and goodExponent do the same for the prime power.
- */
+namespace LinBox
+{
 
-class RingCategories {
+	/*! \brief some basic information about each field or ring.
+	  \ingroup field
 
-public:
+	 * It will try
+	 * to take the information from the field when possible, and use defaults
+	 * otherwise.
+	 * maxModulus returns the greatest modulus that is usable for a given field, -1
+	 * for infinite. goodModulus returns takes an integer and returns true if that
+	 * integer is a valid modulus for the given field.
+	 * maxExponent and goodExponent do the same for the prime power.
+	 */
 
-	//generic ring.
-	struct GenericTag{};
-	//If it is isomorphic to Z/mZ, for some m or its extensions.
-	struct ModularTag : public virtual GenericTag{};
-	//If it is isomorphic to Z
-	struct IntegerTag : public virtual GenericTag{};
-	//If it is isomorphic to Q
-	struct RationalTag : public virtual GenericTag{};
-};
+	class RingCategories {
 
-template <class Field>
-struct ClassifyRing {
-typedef	RingCategories::GenericTag categoryTag;
-};
+	public:
 
-template <class Field>
-struct FieldTraits
-{
-	typedef typename ClassifyRing<Field>::categoryTag categoryTag;
-	
-	static integer& maxModulus( integer& i ) {
-		return i = static_cast<integer>(Field::getMaxModulus());
-	}
-	static bool goodModulus( const integer& i ) {
-		integer max;
-		maxModulus( max );
-		if( max == -1 ) return ( i >= 2 );
-		else if( max == 0 ) return ( i == 0 );
-		else return ( i >= 2 && i <= max );
-	}
-
-	static integer& maxExponent( integer& i ) { return i = 1; }
-	static bool goodExponent( const integer& i ) {
-		integer max;
-                maxExponent( max );
-                if( max == -1 ) return ( i >= 1 );
-                else return ( i >= 1 && i <= max );
-	}
-};
+		//generic ring.
+		struct GenericTag{};
+		//If it is isomorphic to Z/mZ, for some m or its extensions.
+		struct ModularTag : public virtual GenericTag{};
+		//If it is isomorphic to Z
+		struct IntegerTag : public virtual GenericTag{};
+		//If it is isomorphic to Q
+		struct RationalTag : public virtual GenericTag{};
+	};
+
+	template <class Field>
+	struct ClassifyRing
+	{
+		typedef	RingCategories::GenericTag categoryTag;
+	};
+
+	template <class Field>
+	struct FieldTraits
+	{
+		typedef typename ClassifyRing<Field>::categoryTag categoryTag;
+
+		static integer& maxModulus( integer& i )
+		{
+			return i = static_cast<integer>(Field::getMaxModulus());
+		}
+		static uint64_t & maxModulus( uint64_t& i )
+		{
+			return i = static_cast<uint64_t>(Field::getMaxModulus());
+		}
+		static uint32_t & maxModulus( uint32_t& i )
+		{
+			return i = static_cast<uint32_t>(Field::getMaxModulus());
+		}
+
+		static integer maxModulus()
+		{
+			return static_cast<integer>(Field::getMaxModulus());
+		}
+
+		static bool goodModulus( const integer& i )
+		{
+			integer max;
+			maxModulus( max );
+			if( max == -1 )
+				return ( i >= 2 );
+			else if( max == 0 )
+				return ( i == 0 );
+			else
+				return ( i >= 2 && i <= max );
+		}
+
+		static integer& maxExponent( integer& i )
+		{
+			return i = 1;
+		}
+
+		static bool goodExponent( const integer& i )
+		{
+			integer max;
+			maxExponent( max );
+			if( max == -1 )
+				return ( i >= 1 );
+			else
+				return ( i >= 1 && i <= max );
+		}
+	};
 
 } // Namespace LinBox
 
-#endif // __FIELD_TRAITS_H
-  
+#endif // __LINBOX_field_traits_H
+
+
diff --git a/linbox/field/field.doxy b/linbox/field/field.doxy
index 85f2160..2ceb934 100644
--- a/linbox/field/field.doxy
+++ b/linbox/field/field.doxy
@@ -1,13 +1,17 @@
-/** \defgroup field linbox/field
+// Copyright (C) 2010 LinBox, GNU LGPL, see COPYING for licence information
 
-\brief %LinBox fields, field wrappers, field construction tools.
-
-%LinBox fields implement the concept
-which is specified in the field archetype.  
-
-Some implement a basic ring concept rather than a field
-(inv and div are partial functions).  Ring representations with 
-additional functions are also found in the \ref ring directory.
-
-*/
+/** \ingroup linbox
+ * \defgroup field field
+ *
+ *  \brief LinBox fields, field wrappers, field construction tools.
+ *
+ *  LinBox fields implement the concept
+ *  which is specified in the field archetype.
+ *
+ *  Some implement a basic ring concept rather than a field
+ *  (inv and div are partial functions).  Ring representations with
+ *  additional functions are also found in the \ref ring directory.
+ *
+ */
 
+// vim:syn=doxygen
diff --git a/linbox/field/gf2.h b/linbox/field/gf2.h
index d389063..b6812cf 100644
--- a/linbox/field/gf2.h
+++ b/linbox/field/gf2.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/field/gf2.h
  * Copyright (C) 2003-2007 The LinBox group
  *
@@ -10,8 +10,8 @@
  * See COPYING for license information.
  */
 
-#ifndef __FIELD_GF2_H
-#define __FIELD_GF2_H
+#ifndef __LINBOX_field_gf2_H
+#define __LINBOX_field_gf2_H
 
 #include <iostream>
 #include <climits>
@@ -25,498 +25,1255 @@
 #include "linbox/field/field-traits.h"
 
 // Namespace in which all LinBox code resides
-namespace LinBox 
+namespace LinBox
 {
 
-class GF2RandIter;
-
-/** 
- * \brief Integers modulo 2
- *
- * This is a tuned implementation of the field of integers modulo
- * 2. In particular, when one constructs a VectorDomain object over
- * this field, highly optimized bit operations will be used to make
- * vector arithmetic very fast.
- \ingroup field
- */
-
-template <class Ring>
-struct ClassifyRing;
-
-class GF2;
-
-template<>
-struct ClassifyRing<GF2> {
-	typedef RingCategories::ModularTag categoryTag;
-};
-
-class GF2 : public FieldInterface
-{
-    public:
-
-	/** Element type
-	 */
-	typedef bool Element;
-
-	/** Random iterator generator type.
-	 * It must meet the common object interface of random element generators
-	 * as given in the the archetype RandIterArchetype.
-	 */
-	typedef GF2RandIter RandIter;
-
-	/** @name Object Management
-	 */
-	//@{
- 
-	/** Default constructor.
-	 */
-	GF2 (int p = 2, int exp = 1) {
-		if(p != 2) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be 2");
-		if(exp != 1) throw PreconditionFailed(__FUNCTION__,__LINE__,"exponent must be 1");
-	}
+	class GF2RandIter;
 
-	/** Copy constructor.
-	 * Constructs Modular object by copying the field.
-	 * This is required to allow field objects to be passed by value
-	 * into functions.
-	 * @param  F Modular object.
-	 */
-	GF2 (const GF2 &F) {}
-
-	/** Assignment operator
-	 * Required by the archetype
+	/**
+	 * \brief Integers modulo 2
 	 *
-	 * @param F constant reference to Modular object
-	 * @return reference to Modular object for self
-	 */
-	const GF2 &operator = (const GF2 &F) 
-		{ return *this; }
-
-	/** Initialization of field base element from an integer.
-	 * Behaves like C++ allocator construct.
-	 * This function assumes the output field base element x has already been
-	 * constructed, but that it is not already initialized.
-	 * This is not a specialization of the template function because
-	 * such a specialization is not allowed inside the class declaration.
-	 * @return reference to field base element.
-	 * @param x field base element to contain output (reference returned).
-	 * @param y integer.
-	 */
-	Element &init (Element &x, const integer &y = 0) const
-		{ return x = long (y) & 1; }
-
-	BitVector::reference init (BitVector::reference x, const integer &y = 0) const
-		{ return x = long (y) & 1; }
-
-	std::_Bit_reference init (std::_Bit_reference x, const integer &y = 0) const
-		{ return x = long (y) & 1; }
-
-	/** Conversion of field base element to a template class T.
-	 * This function assumes the output field base element x has already been
-	 * constructed, but that it is not already initialized.
-	 * @return reference to template class T.
-	 * @param x template class T to contain output (reference returned).
-	 * @param y constant field base element.
-	 */
-	integer &convert (integer &x, Element y) const
-		{ return x = y; }
- 
-	/** Assignment of one field base element to another.
-	 * This function assumes both field base elements have already been
-	 * constructed and initialized.
-	 * @return reference to x
-	 * @param  x field base element (reference returned).
-	 * @param  y field base element.
-	 */
-	Element &assign (Element &x, Element y) const
-		{ return x = y; }
-
-        BitVector::reference assign (BitVector::reference x, Element y) const
-		{ return x = y; }
-
-        std::_Bit_reference assign (std::_Bit_reference x, Element y) const
-		{ return x = y; }
-    
-	/** Cardinality.
-	 * Return integer representing cardinality of the domain.
-	 * Returns a non-negative integer for all domains with finite
-	 * cardinality, and returns -1 to signify a domain of infinite
-	 * cardinality.
-	 * @return integer representing cardinality of the domain
-	 */
-	integer &cardinality (integer &c) const
-		{ return c = 2; }
-
-	/** Characteristic.
-	 * Return integer representing characteristic of the domain.
-	 * Returns a positive integer to all domains with finite characteristic,
-	 * and returns 0 to signify a domain of infinite characteristic.
-	 * @return integer representing characteristic of the domain.
-	 */
-	integer &characteristic (integer &c) const
-		{ return c = 2; }
-
-	//@} Object Management
-
-	/** @name Arithmetic Operations
-	 * x <- y op z; x <- op y
-	 * These operations require all elements, including x, to be initialized
-	 * before the operation is called.  Uninitialized field base elements will
-	 * give undefined results.
-	 */
-	//@{
-
-	/** Equality of two elements.
-	 * This function assumes both field base elements have already been
-	 * constructed and initialized.
-	 * @return boolean true if equal, false if not.
-	 * @param  x field base element
-	 * @param  y field base element
-	 */
-	bool areEqual (Element x, Element y) const
-		{ return x == y; }
-
-	/** Zero equality.
-	 * Test if field base element is equal to zero.
-	 * This function assumes the field base element has already been
-	 * constructed and initialized.
-	 * @return boolean true if equals zero, false if not.
-	 * @param  x field base element.
-	 */
-	bool isZero (Element x) const
-		{ return !x; }
- 
-	/** One equality.
-	 * Test if field base element is equal to one.
-	 * This function assumes the field base element has already been
-	 * constructed and initialized.
-	 * @return boolean true if equals one, false if not.
-	 * @param  x field base element.
+	 * This is a tuned implementation of the field of integers modulo
+	 * 2. In particular, when one constructs a VectorDomain object over
+	 * this field, highly optimized bit operations will be used to make
+	 * vector arithmetic very fast.
+	 \ingroup field
 	 */
-	bool isOne (Element x) const
-		{ return x; }
 
-	//@} Arithmetic Operations
+	template <class Ring>
+	struct ClassifyRing;
+
+	class GF2;
+
+	template<>
+	struct ClassifyRing<GF2> {
+		typedef RingCategories::ModularTag categoryTag;
+	};
+
+	class GF2 : public FieldInterface {
+	public:
+		const bool zero,one,mone;
+
+
+		/** Element type
+		*/
+		typedef bool Element;
+
+		/** Random iterator generator type.
+		 * It must meet the common object interface of random element generators
+		 * as given in the the archetype RandIterArchetype.
+		 */
+		typedef GF2RandIter RandIter;
+
+		/** @name Object Management
+		*/
+		//@{
+
+		/** Default constructor.
+		*/
+		GF2 () :
+			zero(false),one(true),mone(true)
+		{}
+		GF2 (int p, int exp = 1) :
+			zero(false),one(true),mone(true)
+		{
+			if(p != 2) throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus must be 2");
+			if(exp != 1) throw PreconditionFailed(__func__,__FILE__,__LINE__,"exponent must be 1");
+		}
+
+		/** Copy constructor.
+		 * Constructs Modular object by copying the field.
+		 * This is required to allow field objects to be passed by value
+		 * into functions.
+		 * @param  F Modular object.
+		 */
+		GF2 (const GF2 & F ) :
+			zero(false),one(true),mone(true) {}
+
+		/** Assignment operator.
+		 * Required by the archetype
+		 *
+		 * @param F constant reference to Modular object
+		 * @return reference to Modular object for self
+		 */
+		const GF2 &operator = (const GF2 &F)
+		{
+			return *this;
+		}
+
+		/** Initialization of field base element from an integer.
+		 * Behaves like C++ allocator construct.
+		 * This function assumes the output field base element x has already been
+		 * constructed, but that it is not already initialized.
+		 * This is not a specialization of the template function because
+		 * such a specialization is not allowed inside the class declaration.
+		 * @return reference to field base element.
+		 * @param x field base element to contain output (reference returned).
+		 * @param y integer.
+		 */
+		Element &init (Element &x, const int &y = 0) const
+		{
+			return x = y & 1;
+		}
+
+		Element &init (Element &x, const unsigned int &y = 0) const
+		{
+			return x = y & 1;
+		}
+
+		Element &init (Element &x, const long &y = 0) const
+		{
+			return x = y & 1;
+		}
+
+		Element &init (Element &x, const unsigned long &y = 0) const
+		{
+			return x = y & 1;
+		}
+
+		Element &init (Element &x, const float &y) const
+		{
+			return x = static_cast<unsigned char>(y) & 1;
+		}
+
+		Element &init (Element &x, const double &y) const
+		{
+			return x = static_cast<unsigned char>(y) & 1;
+		}
+
+		Element &init (Element &x, const integer &y) const
+		{
+			return x = static_cast<long>(y) & 1;
+		}
+
+		BitVector::reference init (BitVector::reference x, const integer &y = 0) const
+		{
+			return x = long (y) & 1;
+		}
+
+		std::_Bit_reference init (std::_Bit_reference x, const integer &y = 0) const
+		{
+			return x = long (y) & 1;
+		}
+
+		/** Conversion of field base element to a template class T.
+		 * This function assumes the output field base element x has already been
+		 * constructed, but that it is not already initialized.
+		 * @return reference to template class T.
+		 * @param x template class T to contain output (reference returned).
+		 * @param y constant field base element.
+		 */
+		integer &convert (integer &x, Element y) const
+		{
+			return x = y;
+		}
+
+		std::_Bit_reference convert (std::_Bit_reference x, Element y) const
+		{
+			return x = y;
+		}
+
+		template<class XXX>
+		XXX& convert (XXX& x, Element y) const
+		{
+			return x = static_cast<XXX>(y);
+		}
+
+#if 0
+		unsigned int &convert (unsigned int &x, Element y) const
+		{
+			return x = static_cast<unsigned int>(y);
+		}
+
+		int &convert (int &x, Element y) const
+		{
+			return x = static_cast<int>(y);
+		}
+
+		unsigned long &convert (unsigned long &x, Element y) const
+		{
+			return x = static_cast<unsigned long>(y);
+		}
+
+		long &convert (long &x, Element y) const
+		{
+			return x = static_cast<int>(y);
+		}
+
+		float &convert (float &x, Element y) const
+		{
+			return x = static_cast<float>(y);
+		}
+
+		double &convert (double &x, Element y) const
+		{
+			return x = static_cast<double>(y);
+		}
+#endif
+
+		/** Assignment of one field base element to another.
+		 * This function assumes both field base elements have already been
+		 * constructed and initialized.
+		 * @return reference to x
+		 * @param  x field base element (reference returned).
+		 * @param  y field base element.
+		 */
+		Element &assign (Element &x, Element y) const
+		{
+			return x = y;
+		}
+
+		BitVector::reference assign (BitVector::reference x, Element y) const
+		{
+			return x = y;
+		}
+
+		std::_Bit_reference assign (std::_Bit_reference x, Element y) const
+		{
+			return x = y;
+		}
+
+		/** Cardinality.
+		 * Return integer representing cardinality of the domain.
+		 * Returns a non-negative integer for all domains with finite
+		 * cardinality, and returns -1 to signify a domain of infinite
+		 * cardinality.
+		 * @return integer representing cardinality of the domain
+		 */
+		integer &cardinality (integer &c) const
+		{
+			return c = 2;
+		}
+
+		/** Characteristic.
+		 * Return integer representing characteristic of the domain.
+		 * Returns a positive integer to all domains with finite characteristic,
+		 * and returns 0 to signify a domain of infinite characteristic.
+		 * @return integer representing characteristic of the domain.
+		 */
+		integer &characteristic (integer &c) const
+		{
+			return c = 2;
+		}
+
+		//@} Object Management
+
+		/** @name Arithmetic Operations
+		 * x <- y op z; x <- op y
+		 * These operations require all elements, including x, to be initialized
+		 * before the operation is called.  Uninitialized field base elements will
+		 * give undefined results.
+		 */
+		//@{
+
+		/** Equality of two elements.
+		 * This function assumes both field base elements have already been
+		 * constructed and initialized.
+		 * @return boolean true if equal, false if not.
+		 * @param  x field base element
+		 * @param  y field base element
+		 */
+		bool areEqual (Element x, Element y) const
+		{
+			return x == y;
+		}
+
+		/** Zero equality.
+		 * Test if field base element is equal to zero.
+		 * This function assumes the field base element has already been
+		 * constructed and initialized.
+		 * @return boolean true if equals zero, false if not.
+		 * @param  x field base element.
+		 */
+		bool isZero (Element x) const
+		{
+			return !x;
+		}
+
+		/** One equality.
+		 * Test if field base element is equal to one.
+		 * This function assumes the field base element has already been
+		 * constructed and initialized.
+		 * @return boolean true if equals one, false if not.
+		 * @param  x field base element.
+		 */
+		bool isOne (Element x) const
+		{
+			return x;
+		}
+
+		//@} Arithmetic Operations
+
+		/** @name Input/Output Operations */
+		//@{
+
+		/** Print field.
+		 * @return output stream to which field is written.
+		 * @param  os  output stream to which field is written.
+		 */
+		std::ostream &write (std::ostream &os) const
+		{
+			return os << "integers mod 2";
+		}
+
+		/** Read field.
+		 * @return input stream from which field is read.
+		 * @param  is  input stream from which field is read.
+		 */
+		std::istream &read (std::istream &is)
+		{
+			return is;
+		}
+
+		/** Print field base element.
+		 * This function assumes the field base element has already been
+		 * constructed and initialized.
+		 * @return output stream to which field base element is written.
+		 * @param  os  output stream to which field base element is written.
+		 * @param  x   field base element.
+		 */
+		std::ostream &write (std::ostream &os, Element x) const
+		{
+			return os << x;
+		}
+
+		/** Read field base element.
+		 * @pre This function assumes the field base element has already been
+		 * constructed and initialized.
+		 * @return input stream from which field base element is read.
+		 * @param  is  input stream from which field base element is read.
+		 * @param  x   field base element.
+		 */
+		std::istream &read (std::istream &is, Element &x) const
+		{ is >> x; return is;
+		}
+
+		/** Read field base element.
+		 * @param is input stream
+		 * @param x
+		 * @return  \c is
+		 */
+		std::istream &read (std::istream &is, BitVector::reference x) const
+		{ is >> x; return is;
+		}
+
+		/** Read field base element.
+		 * @param is input stream
+		 * @param x
+		 * @return  \c is
+		 */
+		std::istream &read (std::istream &is, std::_Bit_reference x) const
+		{ bool a; is >> a; x=a; return is;
+		}
+
+		//@}
+
+		/** @name Arithmetic Operations
+		 * x <- y op z; x <- op y
+		 * These operations require all elements, including x, to be initialized
+		 * before the operation is called.  Uninitialized field base elements will
+		 * give undefined results.
+		 */
+		//@{
+
+		/** Addition.
+		 * x = y + z
+		 * This function assumes all the field base elements have already been
+		 * constructed and initialized.
+		 * @return reference to x.
+		 * @param  x field base element (reference returned).
+		 * @param  y field base element.
+		 * @param  z field base element.
+		 */
+		Element &add (Element &x, Element y, Element z) const
+		{
+			return x = y ^ z;
+		}
+
+		/** Addition.
+		 * @param x
+		 * @param y
+		 * @param z
+		 */
+		BitVector::reference add (BitVector::reference x, Element y, Element z) const
+		{
+			return x = y ^ z;
+		}
+
+		/** Addition.
+		 * @param x
+		 * @param y
+		 * @param z
+		 */
+		std::_Bit_reference add (std::_Bit_reference x, Element y, Element z) const
+		{
+			return x = y ^ z;
+		}
+
+		/** Subtraction.
+		 * x = y - z
+		 * This function assumes all the field base elements have already been
+		 * constructed and initialized.
+		 * @return reference to x.
+		 * @param  x field base element (reference returned).
+		 * @param  y field base element.
+		 * @param  z field base element.
+		 */
+		Element &sub (Element &x, Element y, Element z) const
+		{
+			return x = y ^ z;
+		}
+
+		/** Subtraction.
+		 * @param x
+		 * @param y
+		 * @param z
+		 */
+		BitVector::reference sub (BitVector::reference x, Element y, Element z) const
+		{
+			return x = y ^ z;
+		}
+
+		/** Subtraction.
+		 * @param x
+		 * @param y
+		 * @param z
+		 */
+		std::_Bit_reference sub (std::_Bit_reference x, Element y, Element z) const
+		{
+			return x = y ^ z;
+		}
+
+		/** Multiplication.
+		 * x = y * z
+		 * This function assumes all the field base elements have already been
+		 * constructed and initialized.
+		 * @return reference to x.
+		 * @param  x field base element (reference returned).
+		 * @param  y field base element.
+		 * @param  z field base element.
+		 */
+		Element &mul (Element &x, Element y, Element z) const
+		{
+			return x = y & z;
+		}
+
+		/** Multiplication.
+		 * @param x
+		 * @param y
+		 * @param z
+		 */
+		BitVector::reference mul (BitVector::reference x, Element y, Element z) const
+		{
+			return x = y & z;
+		}
+
+		/** Multiplication.
+		 * @param x
+		 * @param y
+		 * @param z
+		 */
+		std::_Bit_reference mul (std::_Bit_reference x, Element y, Element z) const
+		{
+			return x = y & z;
+		}
+
+		/** Division.
+		 * x = y / z
+		 * This function assumes all the field base elements have already been
+		 * constructed and initialized.
+		 * @return reference to x.
+		 * @param  x field base element (reference returned).
+		 * @param  y field base element.
+		 * @param  z field base element.
+		 * @bug z is unused
+		 */
+		Element &div (Element &x, Element y, Element z ) const
+		{
+			return x = y;
+		}
+
+		/** Division.
+		 * @param x
+		 * @param y
+		 * @param z
+		 */
+		BitVector::reference div (BitVector::reference x, Element y, Element z ) const
+		{
+			return x = y;
+		}
+
+		/** Division.
+		 * @param x
+		 * @param y
+		 * @param z
+		 */
+		std::_Bit_reference div (std::_Bit_reference x, Element y, Element z ) const
+		{
+			return x = y;
+		}
+
+		/** Additive Inverse (Negation).
+		 * x = - y
+		 * This function assumes both field base elements have already been
+		 * constructed and initialized.
+		 * @return reference to x.
+		 * @param  x field base element (reference returned).
+		 * @param  y field base element.
+		 */
+		Element &neg (Element &x, Element y) const
+		{
+			return x = y;
+		}
+
+		/** Additive Inverse (Negation).
+		 * @return reference to x.
+		 * @param  x
+		 * @param  y
+		 */
+		BitVector::reference neg (BitVector::reference x, Element y) const
+		{
+			return x = y;
+		}
+
+		/** Additive Inverse (Negation).
+		 * @return reference to x.
+		 * @param  x
+		 * @param  y
+		 */
+		std::_Bit_reference neg (std::_Bit_reference x, Element y) const
+		{
+			return x = y;
+		}
+
+		/** Multiplicative Inverse.
+		 * x = 1 / y
+		 * This function assumes both field base elements have already been
+		 * constructed and initialized.
+		 * @return reference to x.
+		 * @param  x field base element (reference returned).
+		 * @param  y field base element.
+		 */
+		Element &inv (Element &x, Element y) const
+		{
+			return x = y;
+		}
+
+		/** Multiplicative Inverse.
+		 * @return reference to x.
+		 * @param  x
+		 * @param  y
+		 */
+		BitVector::reference inv (BitVector::reference x, Element y) const
+		{
+			return x = y;
+		}
+
+		/** Multiplicative Inverse.
+		 * @return reference to x.
+		 * @param  x
+		 * @param  y
+		 */
+		std::_Bit_reference inv (std::_Bit_reference x, Element y) const
+		{
+			return x = y;
+		}
+
+		/** Natural AXPY.
+		 * r  = a * x + y
+		 * This function assumes all field elements have already been
+		 * constructed and initialized.
+		 * @return reference to r.
+		 * @param  r field element (reference returned).
+		 * @param  a field element.
+		 * @param  x field element.
+		 * @param  y field element.
+		 */
+		BitVector::reference axpy (BitVector::reference r,
+					   Element a,
+					   Element x,
+					   Element y) const
+		{
+			return r = (a & x) ^ y;
+		}
+
+		/** Natural AXPY.
+		 * @return reference to r.
+		 * @param  r
+		 * @param  a
+		 * @param  x
+		 * @param  y
+		 */
+		std::_Bit_reference axpy (std::_Bit_reference r,
+					  Element a,
+					  Element x,
+					  Element y) const
+		{
+			return r = (a & x) ^ y;
+		}
+
+		/** Natural AXPY.
+		 * @return reference to r.
+		 * @param  r
+		 * @param  a
+		 * @param  x
+		 * @param  y
+		 */
+		Element &axpy (Element &r, Element a, Element x, Element y) const
+		{
+			return r = (a & x) ^ y;
+		}
+
+		//@} Arithmetic Operations
+
+		/** @name Inplace Arithmetic Operations
+		 * x <- x op y; x <- op x
+		 */
+		//@{
+
+		/** Inplace Addition.
+		 * x += y
+		 * This function assumes both field base elements have already been
+		 * constructed and initialized.
+		 * @return reference to x.
+		 * @param  x field base element (reference returned).
+		 * @param  y field base element.
+		 */
+		Element &addin (Element &x, Element y) const
+		{
+			return x ^= y;
+		}
+
+		/** Inplace Addition.
+		 * @return reference to x.
+		 * @param  x
+		 * @param  y
+		 */
+		BitVector::reference addin (BitVector::reference x, Element y) const
+		{
+			return x ^= y;
+		}
+
+		/** Inplace Addition.
+		 * @return reference to x.
+		 * @param  x
+		 * @param  y
+		 */
+		std::_Bit_reference addin (std::_Bit_reference x, Element y) const
+		{
+			return x = x ^ y;
+		}
+
+		/** Inplace Subtraction.
+		 * x -= y
+		 * This function assumes both field base elements have already been
+		 * constructed and initialized.
+		 * @return reference to x.
+		 * @param  x field base element (reference returned).
+		 * @param  y field base element.
+		 */
+		Element &subin (Element &x, Element y) const
+		{
+			return x ^= y;
+		}
+
+		/** Inplace Subtraction.
+		 * @return reference to x.
+		 * @param  x
+		 * @param  y
+		 */
+		BitVector::reference subin (BitVector::reference x, Element y) const
+		{
+			return x ^= y;
+		}
+
+		/** Inplace Subtraction.
+		 * @return reference to x.
+		 * @param  x
+		 * @param  y
+		 */
+		std::_Bit_reference subin (std::_Bit_reference x, Element y) const
+		{
+			return x = x ^ y;
+		}
+
+		/** Inplace Multiplication.
+		 * x *= y
+		 * This function assumes both field base elements have already been
+		 * constructed and initialized.
+		 * @return reference to x.
+		 * @param  x field base element (reference returned).
+		 * @param  y field base element.
+		 */
+		Element &mulin (Element &x, Element y) const
+		{
+			return x &= y;
+		}
+
+		/** Inplace Multiplication.
+		 * @return reference to x.
+		 * @param  x
+		 * @param  y
+		 */
+		BitVector::reference mulin (BitVector::reference x, Element y) const
+		{
+			return x &= y;
+		}
+
+		/** Inplace Multiplication.
+		 * @return reference to x.
+		 * @param  x
+		 * @param  y
+		 */
+		Element& mulin (std::_Bit_reference& x, Element y) const
+		{
+			return mulin((bool&)x,y);
+		}
+
+		/** Inplace Division.
+		 * x /= y
+		 * This function assumes both field base elements have already been
+		 * constructed and initialized.
+		 * @return reference to x.
+		 * @param  x field base element (reference returned).
+		 * @param  y field base element.
+		 * @bug y is unused
+		 */
+		Element &divin (Element &x, Element y ) const
+		{
+			return x;
+		}
+
+		/** Inplace Division.
+		 * @return reference to x.
+		 * @param  x
+		 * @param  y
+		 * @bug y is unused
+		 */
+		BitVector::reference divin (BitVector::reference x, Element y ) const
+		{
+			return x;
+		}
+
+		/** Inplace Division.
+		 * @return reference to x.
+		 * @param  x
+		 * @param  y
+		 * @bug y is unused
+		 */
+		std::_Bit_reference divin (std::_Bit_reference x, Element y ) const
+		{
+			return x;
+		}
+
+		/** Inplace Additive Inverse (Inplace Negation).
+		 * x = - x
+		 * This function assumes the field base element has already been
+		 * constructed and initialized.
+		 * @return reference to x.
+		 * @param  x field base element (reference returned).
+		 */
+		Element &negin (Element &x) const
+		{
+			return x;
+		}
+
+		/** Inplace Additive Inplace (Inplace Negation).
+		 * @return reference to x.
+		 * @param  x
+		 * @bug y is unused
+		 */
+		BitVector::reference negin (BitVector::reference x) const
+		{
+			return x;
+		}
+
+		/** Inplace Additive Inplace (Inplace Negation).
+		 * @return reference to x.
+		 * @param  x
+		 * @bug y is unused
+		 */
+		std::_Bit_reference negin (std::_Bit_reference x) const
+		{
+			return x;
+		}
+
+		/** Inplace Multiplicative Inverse.
+		 * x = 1 / x
+		 * This function assumes the field base elementhas already been
+		 * constructed and initialized.
+		 * @return reference to x.
+		 * @param  x field base element (reference returned).
+		 */
+		Element &invin (Element &x) const
+		{
+			return x;
+		}
+
+		/** Inplace Multiplicative Inverse.
+		 * @return reference to x.
+		 * @param  x
+		 */
+		BitVector::reference invin (BitVector::reference x) const
+		{
+			return x;
+		}
+
+		/** Inplace Multiplicative Inverse.
+		 * @return reference to x.
+		 * @param  x
+		 */
+		std::_Bit_reference invin (std::_Bit_reference x) const
+		{
+			return x;
+		}
+
+		/** Inplace AXPY.
+		 * r  += a * x
+		 * This function assumes all field elements have already been
+		 * constructed and initialized.
+		 * Purely virtual
+		 * @return reference to r.
+		 * @param  r field element (reference returned).
+		 * @param  a field element.
+		 * @param  x field element.
+		 */
+		Element &axpyin (Element &r, Element a, Element x) const
+		{
+			return r ^= a & x;
+		}
+
+		/** Inplace AXPY.
+		 * @return reference to r.
+		 * @param  r
+		 * @param  a
+		 * @param  x
+		 */
+		BitVector::reference axpyin (BitVector::reference r, Element a, Element x) const
+		{
+			return r ^= a & x;
+		}
+
+		/** Inplace AXPY.
+		 * @return reference to r.
+		 * @param  r
+		 * @param  a
+		 * @param  x
+		 */
+		std::_Bit_reference axpyin (std::_Bit_reference r, Element a, Element x) const
+		{
+			return r = r ^ (a & x);
+		}
+
+		/** Inplace AXPY.
+		 * @return reference to r.
+		 * @param  r
+		 * @param  a
+		 * @param  x
+		 */
+		Element &axpyin (Element &r, const std::_Bit_reference a, Element x) const
+		{
+			return r ^= a & x;
+		}
+
+		/** Inplace AXPY.
+		 * @return reference to r.
+		 * @param  r
+		 * @param  a
+		 * @param  x
+		 */
+		std::_Bit_reference axpyin (std::_Bit_reference r, const std::_Bit_reference a, Element x) const
+		{
+			return r = r ^ (a & x);
+		}
+
+		/** Inplace AXPY.
+		 * @return reference to r.
+		 * @param  r
+		 * @param  a
+		 * @param  x
+		 */
+		Element &axpyin (Element &r, Element a, const std::_Bit_reference x) const
+		{
+			return r ^= a & static_cast<bool>(x);
+		}
+
+		/** Inplace AXPY.
+		 * @return reference to r.
+		 * @param  r
+		 * @param  a
+		 * @param  x
+		 */
+		std::_Bit_reference axpyin (std::_Bit_reference r, Element a, const std::_Bit_reference x) const
+		{
+			return r = r ^ (a & static_cast<bool>(x));
+		}
+
+		/** Inplace AXPY.
+		 * @return reference to r.
+		 * @param  r
+		 * @param  a
+		 * @param  x
+		 */
+		Element &axpyin (Element &r, const std::_Bit_reference a, const std::_Bit_reference x) const
+		{
+			return r ^= a & static_cast<bool>(x);
+		}
+
+		/** Inplace AXPY.
+		 * @return reference to r.
+		 * @param  r
+		 * @param  a
+		 * @param  x
+		 */
+		std::_Bit_reference axpyin (std::_Bit_reference r, const std::_Bit_reference a, const std::_Bit_reference x) const
+		{
+			return r = r ^ (a & static_cast<bool>(x));
+		}
+
+		//@} Inplace Arithmetic Operations
+
+		static inline int getMaxModulus()
+		{
+			return 2;
+		}
+
+	}; // class GF2
 
-	/** @name Input/Output Operations */
-	//@{
-
-	/** Print field.
-	 * @return output stream to which field is written.
-	 * @param  os  output stream to which field is written.
-	 */
-	std::ostream &write (std::ostream &os) const 
-		{ return os << "integers mod 2"; }
-
-	/** Read field.
-	 * @return input stream from which field is read.
-	 * @param  is  input stream from which field is read.
-	 */
-	std::istream &read (std::istream &is)
-		{ return is; }
-
-	/** Print field base element.
-	 * This function assumes the field base element has already been
-	 * constructed and initialized.
-	 * @return output stream to which field base element is written.
-	 * @param  os  output stream to which field base element is written.
-	 * @param  x   field base element.
-	 */
-	std::ostream &write (std::ostream &os, Element x) const
-		{ return os << x; }
- 
-	/** Read field base element.
-	 * This function assumes the field base element has already been
-	 * constructed and initialized.
-	 * @return input stream from which field base element is read.
-	 * @param  is  input stream from which field base element is read.
-	 * @param  x   field base element.
-	 */
-	std::istream &read (std::istream &is, Element &x) const
-		{ is >> x; return is; }
+} // namespace LinBox
 
-	std::istream &read (std::istream &is, BitVector::reference x) const
-		{ is >> x; return is; }
 
-	std::istream &read (std::istream &is, std::_Bit_reference x) const
-		{ bool a; is >> a; x=a; return is; }
+// Specialization of GivaroField for GF2
+#include "linbox/field/givaro-field.h"
+namespace LinBox
+{
 
-	//@}
+	/**
+	  \brief give LinBox fields an allure of Givaro Fields
+	  \ingroup field
 
-	/** @name Arithmetic Operations
-	 * x <- y op z; x <- op y
-	 * These operations require all elements, including x, to be initialized
-	 * before the operation is called.  Uninitialized field base elements will
-	 * give undefined results.
-	 */
-	//@{
-
-	/** Addition.
-	 * x = y + z
-	 * This function assumes all the field base elements have already been
-	 * constructed and initialized.
-	 * @return reference to x.
-	 * @param  x field base element (reference returned).
-	 * @param  y field base element.
-	 * @param  z field base element.
-	 */
-	Element &add (Element &x, Element y, Element z) const
-		{ return x = y ^ z; }
-
-	BitVector::reference add (BitVector::reference x, Element y, Element z) const
-		{ return x = y ^ z; }
- 
-	std::_Bit_reference add (std::_Bit_reference x, Element y, Element z) const
-		{ return x = y ^ z; }
- 
-	/** Subtraction.
-	 * x = y - z
-	 * This function assumes all the field base elements have already been
-	 * constructed and initialized.
-	 * @return reference to x.
-	 * @param  x field base element (reference returned).
-	 * @param  y field base element.
-	 * @param  z field base element.
-	 */
-	Element &sub (Element &x, Element y, Element z) const
-		{ return x = y ^ z; }
-
-	BitVector::reference sub (BitVector::reference x, Element y, Element z) const
-		{ return x = y ^ z; }
- 
-	std::_Bit_reference sub (std::_Bit_reference x, Element y, Element z) const
-		{ return x = y ^ z; }
- 
-	/** Multiplication.
-	 * x = y * z
-	 * This function assumes all the field base elements have already been
-	 * constructed and initialized.
-	 * @return reference to x.
-	 * @param  x field base element (reference returned).
-	 * @param  y field base element.
-	 * @param  z field base element.
-	 */
-	Element &mul (Element &x, Element y, Element z) const
-		{ return x = y & z; }
-
-	BitVector::reference mul (BitVector::reference x, Element y, Element z) const
-		{ return x = y & z; }
- 
-	std::_Bit_reference mul (std::_Bit_reference x, Element y, Element z) const
-		{ return x = y & z; }
- 
-	/** Division.
-	 * x = y / z
-	 * This function assumes all the field base elements have already been
-	 * constructed and initialized.
-	 * @return reference to x.
-	 * @param  x field base element (reference returned).
-	 * @param  y field base element.
-	 * @param  z field base element.
-	 */
-	Element &div (Element &x, Element y, Element z) const
-		{ return x = y; }
-
-	BitVector::reference div (BitVector::reference x, Element y, Element z) const
-		{ return x = y; }
- 
-	std::_Bit_reference div (std::_Bit_reference x, Element y, Element z) const
-		{ return x = y; }
- 
-	/** Additive Inverse (Negation).
-	 * x = - y
-	 * This function assumes both field base elements have already been
-	 * constructed and initialized.
-	 * @return reference to x.
-	 * @param  x field base element (reference returned).
-	 * @param  y field base element.
-	 */
-	Element &neg (Element &x, Element y) const
-		{ return x = y; }
-
-	BitVector::reference neg (BitVector::reference x, Element y) const
-		{ return x = y; }
- 
-	std::_Bit_reference neg (std::_Bit_reference x, Element y) const
-		{ return x = y; }
- 
-	/** Multiplicative Inverse.
-	 * x = 1 / y
-	 * This function assumes both field base elements have already been
-	 * constructed and initialized.
-	 * @return reference to x.
-	 * @param  x field base element (reference returned).
-	 * @param  y field base element.
-	 */
-	Element &inv (Element &x, Element y) const
-		{ return x = y; }
-
-	BitVector::reference inv (BitVector::reference x, Element y) const
-		{ return x = y; }
-
-	std::_Bit_reference inv (std::_Bit_reference x, Element y) const
-		{ return x = y; }
-
-	/** Natural AXPY.
-	 * r  = a * x + y
-	 * This function assumes all field elements have already been 
-	 * constructed and initialized.
-	 * @return reference to r.
-	 * @param  r field element (reference returned).
-	 * @param  a field element.
-	 * @param  x field element.
-	 * @param  y field element.
-	 */
-	BitVector::reference axpy (BitVector::reference r, 
-				   Element a, 
-				   Element x, 
-				   Element y) const
-		{ return r = (a & x) ^ y; }
-
-	std::_Bit_reference axpy (std::_Bit_reference r, 
-				   Element a, 
-				   Element x, 
-				   Element y) const
-		{ return r = (a & x) ^ y; }
-
-	Element &axpy (Element &r, Element a, Element x, Element y) const
-		{ return r = (a & x) ^ y; }
-
-	//@} Arithmetic Operations
- 
-	/** @name Inplace Arithmetic Operations
-	 * x <- x op y; x <- op x
+	 *  This class adds the necessary requirements allowing
+	 *  the construction of an extension of a LinBox field.
 	 */
-	//@{
-
-	/** Inplace Addition.
-	 * x += y
-	 * This function assumes both field base elements have already been
-	 * constructed and initialized.
-	 * @return reference to x.
-	 * @param  x field base element (reference returned).
-	 * @param  y field base element.
-	 */
-	Element &addin (Element &x, Element y) const
-		{ return x ^= y; }
-
-	BitVector::reference addin (BitVector::reference x, Element y) const
-		{ return x ^= y; }
- 
-	Element& addin (std::_Bit_reference& x, Element y) const
-        	{ return addin( (bool&)x,y); }
- 
-	/** Inplace Subtraction.
-	 * x -= y
-	 * This function assumes both field base elements have already been
-	 * constructed and initialized.
-	 * @return reference to x.
-	 * @param  x field base element (reference returned).
-	 * @param  y field base element.
-	 */
-	Element &subin (Element &x, Element y) const
-		{ return x ^= y; }
-
-	BitVector::reference subin (BitVector::reference x, Element y) const
-		{ return x ^= y; }
- 
-	Element& subin (std::_Bit_reference& x, Element y) const
-		{ return subin((bool&)x, y); }
- 
-	/** Inplace Multiplication.
-	 * x *= y
-	 * This function assumes both field base elements have already been
-	 * constructed and initialized.
-	 * @return reference to x.
-	 * @param  x field base element (reference returned).
-	 * @param  y field base element.
-	 */
-	Element &mulin (Element &x, Element y) const
-		{ return x &= y; }
-
-	BitVector::reference mulin (BitVector::reference x, Element y) const
-		{ return x &= y; }
-    
-	Element& mulin (std::_Bit_reference& x, Element y) const
-		{ return mulin((bool&)x,y); }
- 
-	/** Inplace Division.
-	 * x /= y
-	 * This function assumes both field base elements have already been
-	 * constructed and initialized.
-	 * @return reference to x.
-	 * @param  x field base element (reference returned).
-	 * @param  y field base element.
-	 */
-	Element &divin (Element &x, Element y) const
-		{ return x; }
-
-	BitVector::reference divin (BitVector::reference x, Element y) const
-		{ return x; }
- 
-	std::_Bit_reference divin (std::_Bit_reference x, Element y) const
-		{ return x; }
- 
-	/** Inplace Additive Inverse (Inplace Negation).
-	 * x = - x
-	 * This function assumes the field base element has already been
-	 * constructed and initialized.
-	 * @return reference to x.
-	 * @param  x field base element (reference returned).
-	 */
-	Element &negin (Element &x) const
-		{ return x; }
-
-	BitVector::reference negin (BitVector::reference x) const
-		{ return x; }
- 
-	std::_Bit_reference negin (std::_Bit_reference x) const
-		{ return x; }
- 
-	/** Inplace Multiplicative Inverse.
-	 * x = 1 / x
-	 * This function assumes the field base elementhas already been
-	 * constructed and initialized.
-	 * @return reference to x.
-	 * @param  x field base element (reference returned).
-	 */
-	Element &invin (Element &x) const
-		{ return x; }
-
-	BitVector::reference invin (BitVector::reference x) const
-		{ return x; }
-
-	std::_Bit_reference invin (std::_Bit_reference x) const
-		{ return x; }
-
-	/** Inplace AXPY.
-	 * r  += a * x
-	 * This function assumes all field elements have already been 
-	 * constructed and initialized.
-	 * Purely virtual
-	 * @return reference to r.
-	 * @param  r field element (reference returned).
-	 * @param  a field element.
-	 * @param  x field element.
-	 */
-	Element &axpyin (Element &r, Element a, Element x) const
-		{ return r ^= a & x; }
-
-	BitVector::reference axpyin (BitVector::reference r, Element a, Element x) const
-		{ return r ^= a & x; }
-
-	Element& axpyin (std::_Bit_reference& r, Element a, Element x) const
-		{ return axpyin((bool&)r,a,x); }
-
-	//@} Inplace Arithmetic Operations
-
-	static inline int getMaxModulus() { return 2; }
+	template<>
+	struct GivaroField<LinBox::GF2> : public LinBox::GF2
+	{
+		typedef LinBox::GF2 BaseField;
+		typedef BaseField::Element TT;
+		typedef Signed_Trait<TT>::unsigned_type UTT;
+		typedef TT Rep;
+		typedef GivaroField<BaseField> Self_t;
+		typedef Rep Element;
+		typedef UTT Residu_t;
+
+		Element zero, one;
+		GivaroField(const BaseField& bf) :
+			BaseField(bf)
+		{
+			this->init(zero,0UL);
+			this->init(one, 1UL);
+		}
+
+
+		// -- amxy: r <- c - a * b mod p
+		Rep& amxy (Rep& r, const Rep a, const Rep b, const Rep c) const
+		{
+			Rep tmp;
+			this->mul(tmp, a, b);
+			this->assign(r,c);
+			return this->subin(r,tmp);
+		}
+		std::_Bit_reference amxy (std::_Bit_reference r, const Rep a, const Rep b, const Rep c) const
+		{
+			Rep tmp;
+			this->mul(tmp, a, b);
+			this->assign(r,c);
+			return this->subin(r,tmp);
+		}
+
+
+		// -- maxpy: r <- y - a * x
+		Rep& maxpy (Rep& r, const Rep a, const Rep x, const Rep y) const
+		{
+			Rep tmp; this->mul(tmp, a, x);
+			return this->sub(r,y,tmp);
+		}
+		std::_Bit_reference maxpy (std::_Bit_reference r, const Rep a, const Rep x, const Rep y) const
+		{
+			Rep tmp; this->mul(tmp, a, x);
+			return this->sub(r,y,tmp);
+		}
+		// -- axmyin: r <-  a * x - r
+		Rep& axmyin (Rep& r, const Rep a, const Rep x) const
+		{
+			maxpyin(r,a,x);
+			return negin(r);
+		}
+		std::_Bit_reference axmyin (std::_Bit_reference r, const Rep a, const Rep x) const
+		{
+			maxpyin(r,a,x);
+			return negin(r);
+		}
+		// -- maxpyin: r <- r - a * x
+		Rep& maxpyin (Rep& r, const Rep a, const Rep x) const
+		{
+			Rep tmp; this->mul(tmp, a, x);
+			return this->subin(r,tmp);
+		}
+		std::_Bit_reference maxpyin (std::_Bit_reference r, const Rep a, const Rep x) const
+		{
+			Rep tmp; this->mul(tmp, a, x);
+			return this->subin(r,tmp);
+		}
+
+
+
+		bool areNEqual ( const Rep a, const Rep b) const
+		{
+			return ! this->areEqual(a,b);
+		}
+
+		// Access to the modulus, characteristic, size, exponent
+		UTT residu() const
+		{
+			integer c;
+			BaseField::characteristic(c);
+			return UTT(c);
+		}
+
+		UTT characteristic() const
+		{
+			integer c; BaseField::characteristic(c); return UTT(c);
+		}
+		UTT cardinality() const
+		{
+			integer c; BaseField::cardinality(c); return UTT(c);
+		}
+		UTT exponent() const
+		{
+			return 1;
+		}
+		UTT size() const
+		{ integer c; BaseField::cardinality(c); return UTT(c);
+		}
+
+
+		// ----- random generators
+		template<class RandIter> Rep& random(RandIter& g, Rep& r) const
+		{
+			return r = g() ;
+		}
+		template<class RandIter> Rep& random(RandIter& g, Rep& r, long s) const
+		{
+			return r = g() ;
+		}
+		template<class RandIter> Rep& random(RandIter& g, Rep& r, const Rep& b) const
+		{
+			return r = g() ;
+		}
+		template<class RandIter> Rep& nonzerorandom(RandIter& g, Rep& r) const
+		{
+			return r = g() ;
+		}
+		template<class RandIter> Rep& nonzerorandom(RandIter& g, Rep& r, long s) const
+		{
+			return r = g() ;
+		}
+		template<class RandIter> Rep& nonzerorandom(RandIter& g, Rep& r, const Rep& b) const
+		{
+			return r = g() ;
+		}
+
+		template<class RandIter> std::_Bit_reference random(RandIter& g, std::_Bit_reference r) const
+		{
+			return r = g() ;
+		}
+		template<class RandIter> std::_Bit_reference random(RandIter& g, std::_Bit_reference r, long s) const
+		{
+			return r = g() ;
+		}
+		template<class RandIter> std::_Bit_reference random(RandIter& g, std::_Bit_reference r, const std::_Bit_reference b) const
+		{
+			return r = g() ;
+		}
+		template<class RandIter> std::_Bit_reference nonzerorandom(RandIter& g, std::_Bit_reference r) const
+		{
+			return r = g() ;
+		}
+		template<class RandIter> std::_Bit_reference nonzerorandom(RandIter& g, std::_Bit_reference r, long s) const
+		{
+			return r = g() ;
+		}
+		template<class RandIter> std::_Bit_reference nonzerorandom(RandIter& g, std::_Bit_reference r, const Rep& b) const
+		{
+			return r = g() ;
+		}
+		template<class RandIter> std::_Bit_reference nonzerorandom(RandIter& g, std::_Bit_reference r, const std::_Bit_reference b) const
+		{
+			return r = g() ;
+		}
+
+	};
+
+}
+
+
+
+// Specialization of homomorphism for basefield
+#include "linbox/field/hom.h"
+#include "linbox/field/givaro-extension.h"
+namespace LinBox
+{
 
-}; // class GF2
+	template <>
+	class Hom<GF2,GF2> {
+
+	public:
+		typedef GF2 Target;
+		typedef GF2 Source;
+		typedef Source::Element SrcElt;
+		typedef Target::Element Elt;
+
+		Hom(const Source& S, const Target& ) :
+			_source (S)
+		{}
+		Elt& image(Elt& t, const SrcElt& s)
+		{
+			return _source.assign (t, s);
+		}
+		SrcElt& preimage(SrcElt& s, const Elt& t)
+		{
+			return _source.assign (s, t);
+		}
+		const Source& source()
+		{
+			return _source;
+		}
+		const Target& target()
+		{
+			return _source;
+		}
+
+	protected:
+		Source _source;
+	};
+
+	template<class Target >
+	class Hom<GF2, Target > {
+	public:
+		typedef GF2 Source;
+		typedef typename GF2::Element SrcElt;
+		typedef typename Target::Element Elt;
+
+		Hom(const Source& S, const Target& T) :
+			_source(S), _target(T)
+		{ }
+		Elt& image(Elt& t, const SrcElt& s)
+		{
+			return _source.convert(t,s);
+		}
+		SrcElt& preimage(SrcElt& s, const Elt& t)
+		{
+			return _target.convert(s,t);
+		}
+		std::_Bit_reference preimage(std::_Bit_reference s, const Elt& t) const
+		{
+			int ts;
+			return s = _target.convert(ts, t);
+		}
+
+		const Source& source()
+		{
+			return _source;
+		}
+		const Target& target()
+		{
+			return _target;
+		}
+
+	private:
+		Source _source;
+		Target _target;
+	}; // end Hom
+
+
+
+	template<>
+	class Hom < GF2, GivaroExtension<GF2> > {
+		typedef GF2 Source;
+		typedef GivaroExtension<GF2> Target;
+	public:
+		typedef Source::Element SrcElt;
+		typedef Target::Element Elt;
+
+		//Hom(){}
+		/**
+		 * Construct a homomorphism from a specific source ring S and target
+		 * field T with Hom(S, T).  The default behaviour is error.
+		 * Specializations define all actual homomorphisms.
+		 */
+		Hom(const Source& S, const Target& T) :
+			_source(S), _target(T)
+		{}
+
+		/**
+		 * image(t, s) implements the homomorphism, assigning the
+		 * t the value of the image of s under the mapping.
+		 *
+		 * The default behaviour is a no-op.
+		 */
+		Elt& image(Elt& t, const SrcElt& s) const
+		{
+			return _target.assign(t,s);
+		}
+
+		/** If possible, preimage(s,t) assigns a value to s such that
+		 * the image of s is t.  Otherwise behaviour is unspecified.
+		 * An error may be thrown, a conventional value may be set, or
+		 * an arb value set.
+		 *
+		 * The default behaviour is a no-op.
+		 */
+		SrcElt& preimage(SrcElt& s, const Elt& t) const
+		{
+			return _target.convert(s, t);
+		}
+		std::_Bit_reference preimage(std::_Bit_reference s, const Elt& t) const
+		{
+			bool ts;
+			return s = _target.convert(ts, t);
+		}
+
+		const Source& source() const
+		{
+			return _source;
+		}
+		const Target& target() const
+		{
+			return _target;
+		}
+
+	private:
+		Source _source;
+		Target _target;
+	}; // end Hom
+}
+
+// #include <bits/stl_bvector.h>
+namespace std
+{
+	//! @todo JGD 05.11.2009 : it should be in bits/stl_bvector.h  ...
+	inline void swap(_Bit_reference __x, _Bit_reference __y)
+	{
+		bool __tmp = __x;
+		__x = __y;
+		__y = __tmp;
+	}
+}
 
-} // namespace LinBox
 
 #include "linbox/randiter/gf2.h"
 #include "linbox/field/gf2.inl"
 
-#endif // __FIELD_GF2_H
+#endif // __LINBOX_field_gf2_H
+
diff --git a/linbox/field/gf2.inl b/linbox/field/gf2.inl
index e262448..de6ab58 100644
--- a/linbox/field/gf2.inl
+++ b/linbox/field/gf2.inl
@@ -1,17 +1,17 @@
 /* -*- 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
 /* linbox/field/gf2.inl
  * Copyright (C) 2003 Bradford Hovinen
  *
- * Written by Bradford Hovinen <hovinen at cis.udel.edu>
+ * Written by Bradford Hovinen, Dumas, bds
  *
  * ------------------------------------
  *
  * See COPYING for license information.
  */
 
-#ifndef __FIELD_GF2_INL
-#define __FIELD_GF2_INL
+#ifndef __LINBOX_field_gf2_INL
+#define __LINBOX_field_gf2_INL
 
 #include <iostream>
 #include <time.h>
@@ -25,1005 +25,1129 @@
 #include "linbox/blackbox/diagonal.h"
 #include "linbox/matrix/matrix-domain.h"
 
+#include <cctype> //isdigit
 
 template<typename Vector>
-std::ostream& afficheVector (std::ostream& o, const Vector& C) {
-          for(typename Vector::const_iterator refs =  C.begin();
-                                refs != C.end() ;
-                                      ++refs )
-                          o << (*refs) << " " ;
-            return o;
+std::ostream& afficheVector (std::ostream& o, const Vector& C)
+{
+	for(typename Vector::const_iterator refs =  C.begin();
+	    refs != C.end() ;
+	    ++refs )
+		o << (*refs) << " " ;
+	return o;
 }
 
 
-namespace LinBox 
-{ 
+namespace LinBox
+{
 
-// Specialization of canonical vector types
+	// Specialization of canonical vector types
 
-template <>
-class RawVector<bool>
-{
-    public:
-    typedef BitVector Dense;
-    typedef std::vector<size_t> Sparse;
-    typedef std::vector<size_t> SparseSeq;
-    typedef std::vector<size_t> SparseMap;
-    typedef std::vector<size_t> SparsePar;
-};
-
-// Specialization of DotProductDomain for GF2
-
-template <>
-class DotProductDomain<GF2> : private virtual VectorDomainBase<GF2>
-{
-    public:
+	template <>
+	class RawVector<bool>
+	{
+	public:
+		typedef BitVector Dense;
+		typedef std::vector<size_t> Sparse;
+		typedef std::vector<size_t> SparseSeq;
+		typedef std::vector<size_t> SparseMap;
+		typedef std::vector<size_t> SparsePar;
+	};
+
+	// Specialization of DotProductDomain for GF2
+
+	template <>
+	class DotProductDomain<GF2> : private virtual VectorDomainBase<GF2>
+	{
+	public:
 
-	typedef bool Element;
+		typedef bool Element;
 
-	DotProductDomain (const GF2 &F)
-		: VectorDomainBase<GF2> (F)
-	{}
+		DotProductDomain (const GF2 &F) :
+			VectorDomainBase<GF2> (F)
+		{}
 
-    protected:
-	template <class Vector1, class Vector2>
-	inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const;
+	protected:
+		template <class Vector1, class Vector2>
+		inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const;
 
-	template <class Vector1, class Vector2>
-	inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const;
+		template <class Vector1, class Vector2>
+		inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const;
 
-	template <class Vector1, class Vector2>
-	inline BitVector::reference dotSpecializedDD (BitVector::reference res, const Vector1 &v1, const Vector2 &v2) const;
+		template <class Vector1, class Vector2>
+		inline BitVector::reference dotSpecializedDD (BitVector::reference res, const Vector1 &v1, const Vector2 &v2) const;
 
-	template <class Vector1, class Vector2>
-	inline BitVector::reference dotSpecializedDSP (BitVector::reference res, const Vector1 &v1, const Vector2 &v2) const;
-};
+		template <class Vector1, class Vector2>
+		inline BitVector::reference dotSpecializedDSP (BitVector::reference res, const Vector1 &v1, const Vector2 &v2) const;
+	};
 
-// Specialization of vector domain
+	// Specialization of vector domain
 
-template <>
-class VectorDomain<GF2> : private virtual VectorDomainBase<GF2>, private DotProductDomain<GF2>
-{
-    public:
-	typedef bool Element;
+	template <>
+	class VectorDomain<GF2> : private virtual VectorDomainBase<GF2>, private DotProductDomain<GF2>
+	{
+	public:
+		typedef bool Element;
 
-	VectorDomain (const VectorDomain &VD)
-		: VectorDomainBase<GF2> (VD._F), DotProductDomain<GF2> (VD._F)
-	{}
+		VectorDomain (const VectorDomain &VD) :
+			VectorDomainBase<GF2> (VD._F), DotProductDomain<GF2> (VD._F)
+		{}
 
-	VectorDomain &operator = (const VectorDomain &VD) { return *this; }
+		VectorDomain &operator = (const VectorDomain &) { return *this; }
 
-	const GF2 &field () const { return _F; }
-    
-	template <class Vector>
-	inline std::ostream &write (std::ostream &os, const Vector &x) const
+		const GF2 &field () const
+		{ return _F; }
+
+		template <class Vector>
+		inline std::ostream &write (std::ostream &os, const Vector &x) const
 		{ return writeSpecialized (os, x, typename VectorTraits<Vector>::VectorCategory ()); }
 
-	template <class Vector>
-	inline std::istream &read (std::istream &is, Vector &x) const
+		template <class Vector>
+		inline std::istream &read (std::istream &is, Vector &x) const
 		{ return readSpecialized (is, x, typename VectorTraits<Vector>::VectorCategory ()); }
 
-	template <class Vector1, class Vector2>
-	inline Vector1 &copy (Vector1 &res, const Vector2 &v) const
+		template <class Vector1, class Vector2>
+		inline Vector1 &copy (Vector1 &res, const Vector2 &v) const
 		{ return copySpecialized (res, v,
 					  typename VectorTraits<Vector1>::VectorCategory (),
 					  typename VectorTraits<Vector2>::VectorCategory ()); }
 
-	template <class Vector1, class Vector2>
-	inline Vector1 &copy (Vector1 &res, const Vector2 &v, size_t i, size_t len = 0) const
+		template <class Vector1, class Vector2>
+		inline Vector1 &copy (Vector1 &res, const Vector2 &v, size_t i, size_t len = 0) const
 		{ return copySpecialized (res, v, i, len,
 					  typename VectorTraits<Vector1>::VectorCategory ()); }
 
-	template <class Vector1, class Vector2>
-	inline bool areEqual (const Vector1 &v1, const Vector2 &v2) const
+		template <class Vector1, class Vector2>
+		inline bool areEqual (const Vector1 &v1, const Vector2 &v2) const
 		{ return areEqualSpecialized (v1, v2,
 					      typename VectorTraits<Vector1>::VectorCategory (),
 					      typename VectorTraits<Vector2>::VectorCategory ()); }
 
-	template <class Vector>
-	inline bool isZero (const Vector &v) const
+		template <class Vector>
+		inline bool isZero (const Vector &v) const
 		{ return isZeroSpecialized (v, typename VectorTraits<Vector>::VectorCategory ()); }
 
-	template <class Vector1, class Vector2>
-	inline Element &dot (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		template <class Vector1, class Vector2>
+		inline Element &dot (Element &res, const Vector1 &v1, const Vector2 &v2) const
 		{ return dotSpecialized (res, v1, v2,
 					 typename VectorTraits<Vector1>::VectorCategory (),
 					 typename VectorTraits<Vector2>::VectorCategory ()); }
 
-	template <class Vector1, class Vector2>
-	inline BitVector::reference dot (BitVector::reference res, const Vector1 &v1, const Vector2 &v2) const
+		template <class Vector1, class Vector2>
+		inline BitVector::reference dot (BitVector::reference res, const Vector1 &v1, const Vector2 &v2) const
 		{ return dotSpecialized (res, v1, v2,
 					 typename VectorTraits<Vector1>::VectorCategory (),
 					 typename VectorTraits<Vector2>::VectorCategory ()); }
 
-	template <class Vector1, class Vector2>
-	inline Element &dotprod (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		template <class Vector1, class Vector2>
+		inline Element &dotprod (Element &res, const Vector1 &v1, const Vector2 &v2) const
 		{ return dot (res, v1, v2); }
 
-	template <class Vector1, class Vector2, class Vector3>
-	inline Vector1 &add (Vector1 &res, const Vector2 &y, const Vector3 &x) const
+		template <class Vector1, class Vector2, class Vector3>
+		inline Vector1 &add (Vector1 &res, const Vector2 &y, const Vector3 &x) const
 		{ return addSpecialized (res, y, x,
 					 typename VectorTraits<Vector1>::VectorCategory (),
 					 typename VectorTraits<Vector2>::VectorCategory (),
 					 typename VectorTraits<Vector3>::VectorCategory ()); }
 
-	template <class Vector1, class Vector2>
-	inline Vector1 &addin (Vector1 &y, const Vector2 &x) const
+		template <class Vector1, class Vector2>
+		inline Vector1 &addin (Vector1 &y, const Vector2 &x) const
 		{ return addinSpecialized (y, x,
 					   typename VectorTraits<Vector1>::VectorCategory (),
 					   typename VectorTraits<Vector2>::VectorCategory ()); }
 
-	template <class Vector1, class Vector2, class Vector3>
-	inline Vector1 &sub (Vector1 &res, const Vector2 &y, const Vector3 &x) const
+		template <class Vector1, class Vector2, class Vector3>
+		inline Vector1 &sub (Vector1 &res, const Vector2 &y, const Vector3 &x) const
 		{ return addSpecialized (res, y, x,
 					 typename VectorTraits<Vector1>::VectorCategory (),
 					 typename VectorTraits<Vector2>::VectorCategory (),
 					 typename VectorTraits<Vector3>::VectorCategory ()); }
 
-	template <class Vector1, class Vector2>
-	inline Vector1 &subin (Vector1 &y, const Vector2 &x) const
+		template <class Vector1, class Vector2>
+		inline Vector1 &subin (Vector1 &y, const Vector2 &x) const
 		{ return addinSpecialized (y, x,
 					   typename VectorTraits<Vector1>::VectorCategory (),
 					   typename VectorTraits<Vector2>::VectorCategory ()); }
 
-	template <class Vector1, class Vector2>
-	inline Vector1 &neg (Vector1 &res, const Vector2 &x) const
+		template <class Vector1, class Vector2>
+		inline Vector1 &neg (Vector1 &res, const Vector2 &x) const
 		{ copy (res, x); return res; }
 
-	template <class Vector>
-	inline Vector &negin (Vector &y) const
+		template <class Vector>
+		inline Vector &negin (Vector &y) const
 		{ return y; }
 
-	template <class Vector1, class Vector2>
-	inline Vector1 &mul (Vector1 &res, const Vector2 &x, const Element a) const
+		template <class Vector1, class Vector2>
+		inline Vector1 &mul (Vector1 &res, const Vector2 &x, const Element a) const
 		{ return mulSpecialized (res, x, a, typename VectorTraits<Vector1>::VectorCategory ()); }
 
-	template <class Vector>
-	inline Vector &mulin (Vector &x, const Element a) const
+		template <class Vector>
+		inline Vector &mulin (Vector &x, const Element a) const
 		{ return mulinSpecialized (x, a, typename VectorTraits<Vector>::VectorCategory ()); }
 
-	template <class Vector1, class Vector2, class Vector3>
-	inline Vector1 &axpy (Vector1 &res, const Element a, const Vector2 &x, const Vector3 &y) const
+		template <class Vector1, class Vector2, class Vector3>
+		inline Vector1 &axpy (Vector1 &res, const Element a, const Vector2 &x, const Vector3 &y) const
 		{ if (a) add (res, x, y); else this->copy (res, y); return res; }
 
-	template <class Vector1, class Vector2>
-	inline Vector1 &axpyin (Vector1 &y, const Element a, const Vector2 &x) const
+		template <class Vector1, class Vector2>
+		inline Vector1 &axpyin (Vector1 &y, const Element a, const Vector2 &x) const
 		{ if (a) addin (y, x); return y; }
 
-	VectorDomain (const GF2 &F)
-		: VectorDomainBase<GF2> (F), DotProductDomain<GF2> (F)
-	{}
+		VectorDomain (const GF2 &F) :
+			VectorDomainBase<GF2> (F), DotProductDomain<GF2> (F)
+		{}
+
+
+		// Specialized function implementations
+		template <class Vector>
+		std::ostream &writeSpecialized (std::ostream &os, const Vector &x,
+						VectorCategories::DenseZeroOneVectorTag) const;
+		template <class Vector>
+		std::ostream &writeSpecialized (std::ostream &os, const Vector &x,
+						VectorCategories::SparseZeroOneVectorTag) const;
+
+		template <class Vector>
+		std::istream &readSpecialized (std::istream &is, const Vector &x,
+					       VectorCategories::DenseZeroOneVectorTag) const;
+		template <class Vector>
+		std::istream &readSpecialized (std::istream &is, const Vector &x,
+					       VectorCategories::SparseZeroOneVectorTag) const;
+
+		template <class Vector1, class Vector2>
+		bool areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
+					  VectorCategories::DenseZeroOneVectorTag,
+					  VectorCategories::DenseZeroOneVectorTag) const;
+
+		template <class Vector1, class Vector2>
+		bool areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
+					  VectorCategories::DenseZeroOneVectorTag,
+					  VectorCategories::SparseZeroOneVectorTag) const;
+		template <class Vector1, class Vector2>
+		inline bool areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
+						 VectorCategories::SparseZeroOneVectorTag,
+						 VectorCategories::DenseZeroOneVectorTag) const
+		{ return areEqual (v2, v1); }
+		template <class Vector1, class Vector2>
+		bool areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
+					  VectorCategories::SparseZeroOneVectorTag,
+					  VectorCategories::SparseZeroOneVectorTag) const;
 
-    protected:
 
-// -bds: some kind of permissiveness allowed this to work?
+		template <class Vector>
+		bool isZeroSpecialized (const Vector &v, VectorCategories::DenseZeroOneVectorTag) const;
+		template <class Vector>
+		inline bool isZeroSpecialized (const Vector &v,
+					       VectorCategories::SparseZeroOneVectorTag) const
+		{ return v.empty (); }
 
-	// Specialized function implementations
-	template <class Vector> 
-	std::ostream &writeSpecialized (std::ostream &os, const Vector &x,
-					VectorCategories::DenseZeroOneVectorTag) const;
-	template <class Vector>
-	std::ostream &writeSpecialized (std::ostream &os, const Vector &x,
-					VectorCategories::SparseZeroOneVectorTag) const;
+		template <class Vector1, class Vector2>
+		inline Vector1 &copySpecialized (Vector1 &res, const Vector2 &v,
+						 VectorCategories::DenseZeroOneVectorTag,
+						 VectorCategories::DenseZeroOneVectorTag) const
+		{ std::copy (v.wordBegin (), v.wordEnd (), res.wordBegin ()); return res; }
 
-	template <class Vector>
-	std::istream &readSpecialized (std::istream &is, const Vector &x,
-				       VectorCategories::DenseZeroOneVectorTag) const;
-	template <class Vector>
-	std::istream &readSpecialized (std::istream &is, const Vector &x,
-				       VectorCategories::SparseZeroOneVectorTag) const;
+		template <class Vector1, class Vector2>
+		inline Vector1 &copySpecialized (Vector1 &res, const Vector2 &v, size_t i, size_t len, VectorCategories::DenseZeroOneVectorTag) const
+		{
+			std::copy (v.begin (), (len == 0) ? v.end () : v.begin () + len, res.begin () + i);
+			return res;
+		}
+		template <class Vector1, class Vector2>
+		inline Vector1 &copySpecialized (Vector1 &res, const Vector2 &v, size_t i, size_t len, VectorCategories::DenseVectorTag) const
+		{
+			std::copy (v.begin (), (len == 0) ? v.end () : v.begin () + len, res.begin () + i);
+			return res;
+		}
 
-	template <class Vector1, class Vector2>
-	bool areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
-				  VectorCategories::DenseZeroOneVectorTag,
-				  VectorCategories::DenseZeroOneVectorTag) const;
-	
-	template <class Vector1, class Vector2>
-	bool areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
-				  VectorCategories::DenseZeroOneVectorTag,
-				  VectorCategories::SparseZeroOneVectorTag) const;
-	template <class Vector1, class Vector2>
-	inline bool areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
-					 VectorCategories::SparseZeroOneVectorTag,
-					 VectorCategories::DenseZeroOneVectorTag) const
-		{ return areEqual (v2, v1); }
-	template <class Vector1, class Vector2>
-	bool areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
-				  VectorCategories::SparseZeroOneVectorTag,
-				  VectorCategories::SparseZeroOneVectorTag) const;
-    
 
-	template <class Vector>
-	bool isZeroSpecialized (const Vector &v, VectorCategories::DenseZeroOneVectorTag) const;
-	template <class Vector>
-	inline bool isZeroSpecialized (const Vector &v,
-				       VectorCategories::SparseZeroOneVectorTag) const
-		{ return v.empty (); }
 
-	template <class Vector1, class Vector2>
-	inline Vector1 &copySpecialized (Vector1 &res, const Vector2 &v,
-					 VectorCategories::DenseZeroOneVectorTag,
-					 VectorCategories::DenseZeroOneVectorTag) const
-		{ std::copy (v.wordBegin (), v.wordEnd (), res.wordBegin ()); return res; }
-	template <class Vector1, class Vector2>
-	Vector1 &copySpecialized (Vector1 &res, const Vector2 &v,
-				  VectorCategories::SparseZeroOneVectorTag,
-				  VectorCategories::DenseZeroOneVectorTag) const;
-	template <class Vector1, class Vector2>
-	Vector1 &copySpecialized (Vector1 &res, const Vector2 &v,
-				  VectorCategories::DenseZeroOneVectorTag,
-				  VectorCategories::SparseZeroOneVectorTag) const;
-	template <class Vector1, class Vector2>
-	inline Vector1 &copySpecialized (Vector1 &res, const Vector2 &v,
-					 VectorCategories::SparseZeroOneVectorTag,
-					 VectorCategories::SparseZeroOneVectorTag) const
+		template <class Vector1, class Vector2>
+		Vector1 &copySpecialized (Vector1 &res, const Vector2 &v,
+					  VectorCategories::SparseZeroOneVectorTag,
+					  VectorCategories::DenseZeroOneVectorTag) const;
+		template <class Vector1, class Vector2>
+		Vector1 &copySpecialized (Vector1 &res, const Vector2 &v,
+					  VectorCategories::DenseZeroOneVectorTag,
+					  VectorCategories::SparseZeroOneVectorTag) const;
+		template <class Vector1, class Vector2>
+		inline Vector1 &copySpecialized (Vector1 &res, const Vector2 &v,
+						 VectorCategories::SparseZeroOneVectorTag,
+						 VectorCategories::SparseZeroOneVectorTag) const
 		{ res = v; return res; }
 
-	template <class Vector1, class Vector2>
-	inline Element &dotSpecialized (Element &res, const Vector1 &v1, const Vector2 &v2,
-					VectorCategories::DenseZeroOneVectorTag,
-					VectorCategories::DenseZeroOneVectorTag) const
+		template <class Vector1, class Vector2>
+		inline Element &dotSpecialized (Element &res, const Vector1 &v1, const Vector2 &v2,
+						VectorCategories::DenseZeroOneVectorTag,
+						VectorCategories::DenseZeroOneVectorTag) const
 		{ return DotProductDomain<GF2>::dotSpecializedDD (res, v1, v2); }
-	template <class Vector1, class Vector2>
-	inline Element &dotSpecialized (Element &res, const Vector1 &v1, const Vector2 &v2,
-					VectorCategories::DenseZeroOneVectorTag,
-					VectorCategories::SparseZeroOneVectorTag) const
+		template <class Vector1, class Vector2>
+		inline Element &dotSpecialized (Element &res, const Vector1 &v1, const Vector2 &v2,
+						VectorCategories::DenseZeroOneVectorTag,
+						VectorCategories::SparseZeroOneVectorTag) const
 		{ return DotProductDomain<GF2>::dotSpecializedDSP (res, v1, v2); }
-	template <class Vector1, class Vector2>
-	inline Element &dotSpecialized (Element &res, const Vector1 &v1, const Vector2 &v2,
-					VectorCategories::SparseZeroOneVectorTag,
-					VectorCategories::DenseZeroOneVectorTag) const
+		template <class Vector1, class Vector2>
+		inline Element &dotSpecialized (Element &res, const Vector1 &v1, const Vector2 &v2,
+						VectorCategories::SparseZeroOneVectorTag,
+						VectorCategories::DenseZeroOneVectorTag) const
 		{ return DotProductDomain<GF2>::dotSpecializedDSP (res, v2, v1); }
-	template <class Vector1, class Vector2>
-	Element &dotSpecialized (Element &res, const Vector1 &v1, const Vector2 &v2,
-				 VectorCategories::SparseZeroOneVectorTag,
-				 VectorCategories::SparseZeroOneVectorTag) const;
+		template <class Vector1, class Vector2>
+		Element &dotSpecialized (Element &res, const Vector1 &v1, const Vector2 &v2,
+					 VectorCategories::SparseZeroOneVectorTag,
+					 VectorCategories::SparseZeroOneVectorTag) const;
 
-	template <class Vector1, class Vector2>
-	inline BitVector::reference dotSpecialized (BitVector::reference res, const Vector1 &v1, const Vector2 &v2,
-					VectorCategories::DenseZeroOneVectorTag,
-					VectorCategories::DenseZeroOneVectorTag) const
+		template <class Vector1, class Vector2>
+		inline BitVector::reference dotSpecialized (BitVector::reference res, const Vector1 &v1, const Vector2 &v2,
+							    VectorCategories::DenseZeroOneVectorTag,
+							    VectorCategories::DenseZeroOneVectorTag) const
 		{ return DotProductDomain<GF2>::dotSpecializedDD (res, v1, v2); }
-	template <class Vector1, class Vector2>
-	inline BitVector::reference dotSpecialized (BitVector::reference res, const Vector1 &v1, const Vector2 &v2,
-					VectorCategories::DenseZeroOneVectorTag,
-					VectorCategories::SparseZeroOneVectorTag) const
+		template <class Vector1, class Vector2>
+		inline BitVector::reference dotSpecialized (BitVector::reference res, const Vector1 &v1, const Vector2 &v2,
+							    VectorCategories::DenseZeroOneVectorTag,
+							    VectorCategories::SparseZeroOneVectorTag) const
 		{ return DotProductDomain<GF2>::dotSpecializedDSP (res, v1, v2); }
-	template <class Vector1, class Vector2>
-	inline BitVector::reference dotSpecialized (BitVector::reference res, const Vector1 &v1, const Vector2 &v2,
-					VectorCategories::SparseZeroOneVectorTag,
-					VectorCategories::DenseZeroOneVectorTag) const
+		template <class Vector1, class Vector2>
+		inline BitVector::reference dotSpecialized (BitVector::reference res, const Vector1 &v1, const Vector2 &v2,
+							    VectorCategories::SparseZeroOneVectorTag,
+							    VectorCategories::DenseZeroOneVectorTag) const
 		{ return DotProductDomain<GF2>::dotSpecializedDSP (res, v2, v1); }
-	template <class Vector1, class Vector2>
-	BitVector::reference dotSpecialized (BitVector::reference res, const Vector1 &v1, const Vector2 &v2,
-				 VectorCategories::SparseZeroOneVectorTag,
-				 VectorCategories::SparseZeroOneVectorTag) const;
+		template <class Vector1, class Vector2>
+		BitVector::reference dotSpecialized (BitVector::reference res, const Vector1 &v1, const Vector2 &v2,
+						     VectorCategories::SparseZeroOneVectorTag,
+						     VectorCategories::SparseZeroOneVectorTag) const;
 
-	template <class Vector1, class Vector2, class Vector3>
-	Vector1 &addSpecialized (Vector1 &res, const Vector2 &y, const Vector3 &x,
-				 VectorCategories::DenseZeroOneVectorTag,
-				 VectorCategories::DenseZeroOneVectorTag,
-				 VectorCategories::DenseZeroOneVectorTag) const;
-	template <class Vector1, class Vector2, class Vector3>
-	Vector1 &addSpecialized (Vector1 &res, const Vector2 &y, const Vector3 &x,
-				 VectorCategories::DenseZeroOneVectorTag,
-				 VectorCategories::DenseZeroOneVectorTag,
-				 VectorCategories::SparseZeroOneVectorTag) const
+		template <class Vector1, class Vector2, class Vector3>
+		Vector1 &addSpecialized (Vector1 &res, const Vector2 &y, const Vector3 &x,
+					 VectorCategories::DenseZeroOneVectorTag,
+					 VectorCategories::DenseZeroOneVectorTag,
+					 VectorCategories::DenseZeroOneVectorTag) const;
+		template <class Vector1, class Vector2, class Vector3>
+		Vector1 &addSpecialized (Vector1 &res, const Vector2 &y, const Vector3 &x,
+					 VectorCategories::DenseZeroOneVectorTag,
+					 VectorCategories::DenseZeroOneVectorTag,
+					 VectorCategories::SparseZeroOneVectorTag) const
 		{ copy (res, y); addin (res, x); }
-	template <class Vector1, class Vector2, class Vector3>
-	Vector1 &addSpecialized (Vector1 &res, const Vector2 &y, const Vector3 &x,
-				 VectorCategories::SparseZeroOneVectorTag,
-				 VectorCategories::SparseZeroOneVectorTag,
-				 VectorCategories::SparseZeroOneVectorTag) const;
-
-	template <class Vector1, class Vector2>
-	Vector1 &addinSpecialized (Vector1 &y, const Vector2 &x,
-				   VectorCategories::DenseZeroOneVectorTag,
-				   VectorCategories::DenseZeroOneVectorTag) const;
-	template <class Vector1, class Vector2>
-	Vector1 &addinSpecialized (Vector1 &y, const Vector2 &x,
-				   VectorCategories::DenseZeroOneVectorTag,
-				   VectorCategories::SparseZeroOneVectorTag) const;
-	template <class Vector1, class Vector2>
-	Vector1 &addinSpecialized (Vector1 &y, const Vector2 &x,
-				   VectorCategories::SparseZeroOneVectorTag,
-				   VectorCategories::DenseZeroOneVectorTag) const
+		template <class Vector1, class Vector2, class Vector3>
+		Vector1 &addSpecialized (Vector1 &res, const Vector2 &y, const Vector3 &x,
+					 VectorCategories::SparseZeroOneVectorTag,
+					 VectorCategories::SparseZeroOneVectorTag,
+					 VectorCategories::SparseZeroOneVectorTag) const;
+
+		template <class Vector1, class Vector2>
+		Vector1 &addinSpecialized (Vector1 &y, const Vector2 &x,
+					   VectorCategories::DenseZeroOneVectorTag,
+					   VectorCategories::DenseZeroOneVectorTag) const;
+		template <class Vector1, class Vector2>
+		Vector1 &addinSpecialized (Vector1 &y, const Vector2 &x,
+					   VectorCategories::DenseZeroOneVectorTag,
+					   VectorCategories::SparseZeroOneVectorTag) const;
+		template <class Vector1, class Vector2>
+		Vector1 &addinSpecialized (Vector1 &y, const Vector2 &x,
+					   VectorCategories::SparseZeroOneVectorTag,
+					   VectorCategories::DenseZeroOneVectorTag) const
 		{ Vector1 xp, res; copy (xp, x); add (res, y, xp); copy (y, res); return y; }
-	template <class Vector1, class Vector2>
-	Vector1 &addinSpecialized (Vector1 &y, const Vector2 &x,
-				   VectorCategories::SparseZeroOneVectorTag,
-				   VectorCategories::SparseZeroOneVectorTag) const
+		template <class Vector1, class Vector2>
+		Vector1 &addinSpecialized (Vector1 &y, const Vector2 &x,
+					   VectorCategories::SparseZeroOneVectorTag,
+					   VectorCategories::SparseZeroOneVectorTag) const
 		{ Vector1 res; add (res, y, x); this->copy (y, res); return y; }
 
-	template <class Vector1, class Vector2>
-	Vector1 &mulSpecialized (Vector1 &res, const Vector2 &x, const Element a,
-				 VectorCategories::DenseZeroOneVectorTag tag) const
+		template <class Vector1, class Vector2>
+		Vector1 &mulSpecialized (Vector1 &res, const Vector2 &x, const Element a,
+					 VectorCategories::DenseZeroOneVectorTag ) const
 		{ if (a) this->copy (res, x); else std::fill (res.wordBegin (), res.wordEnd (), 0); return res; }
-	template <class Vector1, class Vector2>
-	Vector1 &mulSpecialized (Vector1 &res, const Vector2 &x, const Element a,
-				 VectorCategories::SparseZeroOneVectorTag tag) const
+		template <class Vector1, class Vector2>
+		Vector1 &mulSpecialized (Vector1 &res, const Vector2 &x, const Element a,
+					 VectorCategories::SparseZeroOneVectorTag ) const
 		{ if (a) this->copy (res, x); else res.clear (); return res; }
 
-	template <class Vector>
-	inline Vector &mulinSpecialized (Vector &x, const Element a,
-					 VectorCategories::DenseZeroOneVectorTag) const
+		template <class Vector>
+		inline Vector &mulinSpecialized (Vector &x, const Element a,
+						 VectorCategories::DenseZeroOneVectorTag) const
 		{ if (!a) std::fill (x.wordBegin (), x.wordEnd (), 0); return x; }
 
-	template <class Vector>
-	inline Vector &mulinSpecialized (Vector &x, const Element a,
-					 VectorCategories::SparseZeroOneVectorTag tag) const
+		template <class Vector>
+		inline Vector &mulinSpecialized (Vector &x, const Element a,
+						 VectorCategories::SparseZeroOneVectorTag ) const
 		{ if (!a) x.clear (); return x; }
 
-	template <class Vector1, class Vector2, class Vector3>
-	inline Vector1 &addSpecialized (Vector1 &res, const Vector2 &y, const Vector3 &x,
-					VectorCategories::GenericVectorTag,
-					VectorCategories::GenericVectorTag,
-					VectorCategories::GenericVectorTag) const
-	{
-		typename LinBox::Vector<GF2>::Sparse v;
-		typename LinBox::Vector<GF2>::Sparse w;
-		typename LinBox::Vector<GF2>::Sparse u;
-
-		copy (v, x);
-		copy (w, y);
-		add (u, w, v);
-		copy (res, u);
+		template <class Vector1, class Vector2, class Vector3>
+		inline Vector1 &addSpecialized (Vector1 &res, const Vector2 &y, const Vector3 &x,
+						VectorCategories::GenericVectorTag,
+						VectorCategories::GenericVectorTag,
+						VectorCategories::GenericVectorTag) const
+		{
+			typename LinBox::Vector<GF2>::Sparse v;
+			typename LinBox::Vector<GF2>::Sparse w;
+			typename LinBox::Vector<GF2>::Sparse u;
+
+			copy (v, x);
+			copy (w, y);
+			add (u, w, v);
+			copy (res, u);
+
+			return u;
+		}
 
-		return u;
-	}
+		template <class Vector1, class Vector2, class Vector3>
+		inline Vector1 &subSpecialized (Vector1 &res, const Vector2 &y, const Vector3 &x,
+						VectorCategories::GenericVectorTag,
+						VectorCategories::GenericVectorTag,
+						VectorCategories::GenericVectorTag) const
+		{
+			typename LinBox::Vector<GF2>::Sparse v;
+			typename LinBox::Vector<GF2>::Sparse w;
+			typename LinBox::Vector<GF2>::Sparse u;
+
+			copy (v, x);
+			copy (w, y);
+			sub (u, w, v);
+			copy (res, u);
+
+			return u;
+		}
+	};
 
-	template <class Vector1, class Vector2, class Vector3>
-	inline Vector1 &subSpecialized (Vector1 &res, const Vector2 &y, const Vector3 &x,
-					VectorCategories::GenericVectorTag,
-					VectorCategories::GenericVectorTag,
-					VectorCategories::GenericVectorTag) const
+	// Specialization of RandomDenseStream
+	template<size_t bitsize> struct MTrandomInt {
+	template<typename M32Twister>
+	unsigned __LINBOX_INT32 operator() (M32Twister& MT) const
 	{
-		typename LinBox::Vector<GF2>::Sparse v;
-		typename LinBox::Vector<GF2>::Sparse w;
-		typename LinBox::Vector<GF2>::Sparse u;
-
-		copy (v, x);
-		copy (w, y);
-		sub (u, w, v);
-		copy (res, u);
-
-		return u;
+		return MT.randomInt();
 	}
-};
-
-// Specialization of RandomDenseStream
-template<size_t bitsize> struct MTrandomInt {
-    template<typename M32Twister>
-    unsigned __LINBOX_INT32 operator() (M32Twister& MT) const {
-        return MT.randomInt();
-    }
-};    
-
-template<> struct MTrandomInt<64> {
-    template<typename M32Twister>
-    unsigned __LINBOX_INT64 operator() (M32Twister& MT) const {
-        unsigned __LINBOX_INT64 tmp = MT.randomInt();
-        tmp <<=32;
-        return tmp += MT.randomInt();
-    }
-};
-
-class RandomDenseStreamGF2 : public VectorStream<BitVector>
-{
-    public:
-	typedef BitVector Vector;
+	};
 
-	RandomDenseStreamGF2 (const GF2 &F, uint32 seed, size_t n, size_t m = 0)
-		: _MT (seed), _n (n), _m (m), _j (0)
-	{}
-
-	Vector &get (Vector &v) 
+	template<> struct MTrandomInt<64> {
+	template<typename M32Twister>
+	unsigned __LINBOX_INT64 operator() (M32Twister& MT) const
 	{
-		Vector::word_iterator i;
-
-		if (_m > 0 && _j++ >= _m)
-			return v;
-
-		for (i = v.wordBegin (); i != v.wordEnd (); i++)
-			*i = MTrandomInt<__LINBOX_BITSOF_LONG>()(_MT);
-                
-                const size_t zeroing = __LINBOX_BITSOF_LONG - (v.size() % __LINBOX_BITSOF_LONG);
-                *(v.wordRbegin()) <<= zeroing;
-                *(v.wordRbegin()) >>= zeroing;
-		return v;
+		unsigned __LINBOX_INT64 tmp = MT.randomInt();
+		tmp <<=32;
+		return tmp += MT.randomInt();
 	}
+	};
 
-	size_t size () const { return _m; }
-	size_t pos () const { return _j; }
-	size_t dim () const { return _n; }
-	operator bool () const { return _m == 0 || _j < _m; }
-	void reset () { _j = 0; }
+	class RandomDenseStreamGF2 : public VectorStream<BitVector>
+	{
+	public:
+		typedef BitVector Vector;
 
-    private:
-	MersenneTwister _MT;
-	size_t          _n;
-	size_t          _m;
-	size_t          _j;
-};
+		RandomDenseStreamGF2 (const GF2 &, uint32_t seed, size_t n, size_t m = 0) :
+			MT (seed), _n (n), _m (m), _j (0)
+		{}
 
-// Specialization of RandomSparseStream
+		Vector &get (Vector &v)
+		{
+			Vector::word_iterator i;
 
-template <class _Vector = Vector<GF2>::Sparse>
-class RandomSparseStreamGF2 : public VectorStream<_Vector>
-{
-    public:
-	typedef GF2 Field;
-	typedef _Vector Vector;
+			if (_m > 0 && _j++ >= _m)
+				return v;
 
-	RandomSparseStreamGF2 (const GF2 &F, uint32 seed, double p, size_t n, size_t m = 0)
-		: _MT (seed), _n (n), _m (m), _j (0)
-	{ setP (p); }
+			for (i = v.wordBegin (); i != v.wordEnd (); i++)
+				*i = MTrandomInt<__LINBOX_BITSOF_LONG>()(MT);
 
-	Vector &get (Vector &v);
+			const size_t zeroing = __LINBOX_BITSOF_LONG - (v.size() % __LINBOX_BITSOF_LONG);
+			*(v.wordRbegin()) <<= zeroing;
+			*(v.wordRbegin()) >>= zeroing;
+			return v;
+		}
 
-	size_t size () const { return _m; }
-	size_t pos () const { return _j; }
-	size_t dim () const { return _n; }
-	operator bool () const { return _m == 0 || _j < _m; }
-	void reset () { _j = 0; }
+		size_t size () const
+		{ return _m; }
+		size_t pos () const
+		{ return _j; }
+		size_t dim () const
+		{ return _n; }
+		operator bool () const
+		{ return _m == 0 || _j < _m; }
+		void reset () { _j = 0; }
+
+	private:
+		MersenneTwister MT;
+		size_t          _n;
+		size_t          _m;
+		size_t          _j;
+	};
+
+	// Specialization of RandomSparseStream
+
+	template <class _Vector = Vector<GF2>::Sparse>
+	class RandomSparseStreamGF2 : public VectorStream<_Vector>
+	{
+	public:
+		typedef GF2 Field;
+		typedef _Vector Vector;
+
+		RandomSparseStreamGF2 (const GF2 &, uint32_t seed, double p, size_t n, size_t m = 0) :
+			MT (seed), _n (n), _m (m), _j (0)
+		{ setP (p); }
+
+		RandomSparseStreamGF2 (const GF2 &F, const GF2RandIter& r, double p, size_t n, size_t m = 0) :
+			MT (r.getMT()), _n (n), _m (m), _j (0)
+		{ setP (p); }
+
+		Vector &get (Vector &v);
+
+		size_t size () const
+		{ return _m; }
+		size_t pos () const
+		{ return _j; }
+		size_t dim () const
+		{ return _n; }
+		operator bool () const
+		{ return _m == 0 || _j < _m; }
+		void reset () { _j = 0; }
+
+		void setP (double p)
+		{
+			linbox_check ((p >= 0.0) && (p <= 1.0));
+			_p = p;
+			_1_log_1mp   = 1 / log (1 - _p);
+		}
 
-	void setP (double p)
+	private:
+		MersenneTwister MT;
+		size_t _n;
+		double _p;
+		double _1_log_1mp;
+		size_t _m;
+		size_t _j;
+	};
+
+	template <class _Vector>
+	_Vector &RandomSparseStreamGF2<_Vector>::get (_Vector &v)
 	{
-		linbox_check ((p >= 0.0) && (p <= 1.0)); 
-		_p = p;
-		_1_log_1mp   = 1 / log (1 - _p);
-	}
+		size_t i = (size_t) -1;
+		double val;
+		int skip;
 
-    private:
-	MersenneTwister _MT;
-	size_t _n;
-	double _p;
-	double _1_log_1mp;
-	size_t _m;
-	size_t _j;
-};
-
-template <class _Vector>
-_Vector &RandomSparseStreamGF2<_Vector>::get (_Vector &v)
-{
-	size_t i = (size_t) -1;
-	double val;
-	int skip;
+		if (_m > 0 && _j++ >= _m)
+			return v;
 
-	if (_m > 0 && _j++ >= _m)
-		return v;
+		v.clear ();
 
-	v.clear ();
+		while (1) {
+			val = (double) MT.randomDouble ();
+			skip = (int) (ceil (log (val) * _1_log_1mp));
 
-	while (1) {
-		val = (double) _MT.randomDouble ();
-		skip = (int) (ceil (log (val) * _1_log_1mp));
+			if (skip <= 0)
+				i++;
+			else
+				i += skip;
 
-		if (skip <= 0)
-			i++;
-		else
-			i += skip;
+			if (i >= _n) break;
 
-		if (i >= _n) break;
+			v.push_back (i);
+		}
 
-		v.push_back (i);
+		return v;
 	}
 
-	return v;
-}
-
-template <class Vector1, class Vector2>
-inline bool &DotProductDomain<GF2>::dotSpecializedDD
+	template <class Vector1, class Vector2>
+	inline bool &DotProductDomain<GF2>::dotSpecializedDD
 	(bool          &res,
 	 const Vector1 &v1,
 	 const Vector2 &v2) const
-{
-	linbox_check (v1.size () == v2.size ());
-
-	unsigned long t = 0;
-	typename Vector1::const_word_iterator i = v1.wordBegin ();
-	typename Vector2::const_word_iterator j = v2.wordBegin ();
-
-	while (i != v1.wordEnd () - 1)
-		t ^= *i++ & *j++;
-        
-        const size_t zeroing = __LINBOX_BITSOF_LONG - (v1.size() % __LINBOX_BITSOF_LONG);
-        unsigned long lastdot = *i & *j;
-        lastdot <<= zeroing;
-        lastdot >>= zeroing;
-        
-        t ^= lastdot;
-        return res = __LINBOX_PARITY(t);
-}
+	{
+		linbox_check (v1.size () == v2.size ());
+
+		unsigned long t = 0;
+		typename Vector1::const_word_iterator i = v1.wordBegin ();
+		typename Vector2::const_word_iterator j = v2.wordBegin ();
 
-template <class Vector1, class Vector2>
-inline bool &DotProductDomain<GF2>::dotSpecializedDSP
+		while (i != v1.wordEnd () - 1)
+			t ^= *i++ & *j++;
+
+		const size_t zeroing = __LINBOX_BITSOF_LONG - (v1.size() % __LINBOX_BITSOF_LONG);
+		unsigned long lastdot = *i & *j;
+		lastdot <<= zeroing;
+		lastdot >>= zeroing;
+
+		t ^= lastdot;
+		return res = __LINBOX_PARITY(t);
+	}
+
+	template <class Vector1, class Vector2>
+	inline bool &DotProductDomain<GF2>::dotSpecializedDSP
 	(bool          &res,
 	 const Vector1 &v1,
 	 const Vector2 &v2) const
-{
-	typename Vector2::const_iterator i;
+	{
+		typename Vector2::const_iterator i;
 
-	res = 0;
+		res = 0;
 
-	for (i = v2.begin (); i != v2.end (); ++i)
-		res ^= v1[*i];
+		for (i = v2.begin (); i != v2.end (); ++i)
+			res ^= v1[*i];
 
-	return res;
-}
+		return res;
+	}
 
-template <class Vector1, class Vector2>
-inline BitVector::reference DotProductDomain<GF2>::dotSpecializedDD
+	template <class Vector1, class Vector2>
+	inline BitVector::reference DotProductDomain<GF2>::dotSpecializedDD
 	(BitVector::reference res,
 	 const Vector1 &v1,
 	 const Vector2 &v2) const
-{
-    bool tmp;
-    return res = dotSpecializedDD(tmp, v1, v2);
-}
+	{
+		bool tmp;
+		return res = dotSpecializedDD(tmp, v1, v2);
+	}
 
-template <class Vector1, class Vector2>
-inline BitVector::reference DotProductDomain<GF2>::dotSpecializedDSP
+	template <class Vector1, class Vector2>
+	inline BitVector::reference DotProductDomain<GF2>::dotSpecializedDSP
 	(BitVector::reference res,
 	 const Vector1 &v1,
 	 const Vector2 &v2) const
-{
-	typename Vector2::const_iterator i;
+	{
+		typename Vector2::const_iterator i;
 
-	res = 0;
+		res = 0;
 
-	for (i = v2.begin (); i != v2.end (); ++i)
-		res ^= v1[*i];
+		for (i = v2.begin (); i != v2.end (); ++i)
+			res ^= v1[*i];
 
-	return res;
-}
+		return res;
+	}
 
-template <class Vector>
-std::ostream &VectorDomain<GF2>::writeSpecialized (std::ostream &os, const Vector &x,
-						   VectorCategories::DenseZeroOneVectorTag) const
-{
-	
+	template <class Vector>
+	std::ostream &VectorDomain<GF2>::writeSpecialized (std::ostream &os, const Vector &x,
+							   VectorCategories::DenseZeroOneVectorTag) const
+	{
 
-// TO BE REMOVED
-	os << "writeSpec DenseZO, of size " << x.size() << ' ';
 
-	os << "[ ";
+		// TO BE REMOVED
+		os << "writeSpec DenseZO, of size " << x.size() << ' ';
 
-	for (typename Vector::const_iterator i = x.begin (); i != x.end (); ++i)
-		os << *i << ' ';
+		os << "[ ";
 
-	os << ']';
+		for (typename Vector::const_iterator i = x.begin (); i != x.end (); ++i)
+			os << *i << ' ';
 
-	os << "( ";
+		os << ']';
 
-	for (typename Vector::const_word_iterator i = x.wordBegin (); i != x.wordEnd (); ++i)
-		os << *i << ' ';
+		os << "( ";
 
-	os << ')';
+		for (typename Vector::const_word_iterator i = x.wordBegin (); i != x.wordEnd (); ++i)
+			os << *i << ' ';
 
-	return os;
-}
+		os << ')';
 
-template <class Vector>
-std::ostream &VectorDomain<GF2>::writeSpecialized (std::ostream &os, const Vector &x,
-						   VectorCategories::SparseZeroOneVectorTag) const
-{
-	typename Vector::const_iterator i;
-	size_t idx = 0;
+		return os;
+	}
+
+	template <class Vector>
+	std::ostream &VectorDomain<GF2>::writeSpecialized (std::ostream &os, const Vector &x,
+							   VectorCategories::SparseZeroOneVectorTag) const
+	{
+		typename Vector::const_iterator i;
+		size_t idx = 0;
 
-// TO BE REMOVED
-	os << "writeSpec SparseZO, of size " << x.size() << ' ';
-	os << "[ ";
+		// TO BE REMOVED
+		os << "writeSpec SparseZO, of size " << x.size() << ' ';
+		os << "[ ";
 
-	for (i = x.begin (); i != x.end (); ++i) {
-		while (++idx <= *i)
-			os << 0 << ' ';
+		for (i = x.begin (); i != x.end (); ++i) {
+			while (++idx <= *i)
+				os << 0 << ' ';
 
-		os << 1 << ' ';
+			os << 1 << ' ';
+		}
+		os << ']';
+
+		return os;
 	}
-	os << ']';
 
-	return os;
-}
+	template <class Vector>
+	std::istream &VectorDomain<GF2>::readSpecialized (std::istream &is, const Vector &x,
+							  VectorCategories::DenseZeroOneVectorTag) const
+	{
+		typename Vector::iterator i;
+		char c;
 
-template <class Vector>
-std::istream &VectorDomain<GF2>::readSpecialized (std::istream &is, const Vector &x,
-						  VectorCategories::DenseZeroOneVectorTag) const
-{
-	typename Vector::iterator i;
-	char c;
+		do { is >> c ; } while (!std::isdigit (c));
 
-	while (!isdigit (is >> c));
+		is.unget ();
 
-	is.unget ();
+		for (i = x.begin (); i != x.end (); ++i)
+			is >> *i;
 
-	for (i = x.begin (); i != x.end (); ++i)
-		is >> *i;
+		return is;
+	}
 
-	return is;
-}
+	template <class Vector>
+	std::istream &VectorDomain<GF2>::readSpecialized (std::istream &is, const Vector &x,
+							  VectorCategories::SparseZeroOneVectorTag) const
+	{
+		char c;
+		size_t idx;
 
-template <class Vector>
-std::istream &VectorDomain<GF2>::readSpecialized (std::istream &is, const Vector &x,
-						  VectorCategories::SparseZeroOneVectorTag) const
-{
-	char c;
-	size_t idx;
+		do { is >> c ; } while (!std::isdigit (c));
 
-	while (!isdigit (is >> c));
+		is.unget ();
+		x.clear ();
 
-	is.unget ();
-	x.clear ();
+		while (1) {
+			is >> c;
 
-	while (1) {
-		is >> c;
+			if (!std::isdigit (c) && c != ' ') break;
+			is.unget ();
+			is >> idx;
+			x.push_back (idx);
+		}
 
-		if (!isdigit (c) && c != ' ') break;
-		is.unget ();
-		is >> idx;
-		x.push_back (idx);
+		return is;
 	}
 
-	return is;
-}
-
-template <class Vector1, class Vector2>
-bool VectorDomain<GF2>::areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
-					     VectorCategories::DenseZeroOneVectorTag,
-					     VectorCategories::SparseZeroOneVectorTag) const
-{
-	typename Vector1::const_iterator i = v1.begin ();
-	typename Vector2::const_iterator j = v2.begin ();
-	size_t idx = 0;
+	template <class Vector1, class Vector2>
+	bool VectorDomain<GF2>::areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
+						     VectorCategories::DenseZeroOneVectorTag,
+						     VectorCategories::SparseZeroOneVectorTag) const
+	{
+		typename Vector1::const_iterator i = v1.begin ();
+		typename Vector2::const_iterator j = v2.begin ();
+		size_t idx = 0;
+
+		for (; j != v2.end (); ++j, ++i, ++idx) {
+			while (idx < *j) {
+				if (*i) return false;
+				++idx;
+				++i;
+			}
+
+			if (!*i) return false;
+		}
 
-	for (; j != v2.end (); ++j, ++i, ++idx) {
-		while (idx < *j) {
+		for (; i != v1.end (); ++i)
 			if (*i) return false;
-			++idx;
-			++i;
-		}
 
-		if (!*i) return false;
+		return true;
 	}
 
-	for (; i != v1.end (); ++i)
-		if (*i) return false;
-
-	return true;
-}
+	template <class Vector1, class Vector2>
+	bool VectorDomain<GF2>::areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
+						     VectorCategories::DenseZeroOneVectorTag,
+						     VectorCategories::DenseZeroOneVectorTag) const
+	{
+		typename Vector1::const_word_iterator i = v1.wordBegin ();
+		typename Vector2::const_word_iterator j = v2.wordBegin ();
+		for (; j != v2.wordEnd (); ++j, ++i)
+			if (*i != *j) return false;
+		return true;
+	}
 
-template <class Vector1, class Vector2>
-bool VectorDomain<GF2>::areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
-					     VectorCategories::DenseZeroOneVectorTag,
-					     VectorCategories::DenseZeroOneVectorTag) const
-{
-	typename Vector1::const_word_iterator i = v1.wordBegin ();
-	typename Vector2::const_word_iterator j = v2.wordBegin ();
-	for (; j != v2.wordEnd (); ++j, ++i)
-		if (*i != *j) return false;
-	return true;
-}
+	template <class Vector1, class Vector2>
+	bool VectorDomain<GF2>::areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
+						     VectorCategories::SparseZeroOneVectorTag,
+						     VectorCategories::SparseZeroOneVectorTag) const
+	{ return v1 == v2;}
 
-template <class Vector1, class Vector2>
-bool VectorDomain<GF2>::areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
-					     VectorCategories::SparseZeroOneVectorTag,
-					     VectorCategories::SparseZeroOneVectorTag) const
-{ return v1 == v2;}
+	template <class Vector>
+	bool VectorDomain<GF2>::isZeroSpecialized (const Vector &v,
+						   VectorCategories::DenseZeroOneVectorTag) const
+	{
+		typename Vector::const_word_iterator i;
 
-template <class Vector>
-bool VectorDomain<GF2>::isZeroSpecialized (const Vector &v,
-					   VectorCategories::DenseZeroOneVectorTag) const
-{
-	typename Vector::const_word_iterator i;
+		for (i = v.wordBegin (); i != v.wordEnd (); ++i)
+			if (*i) return false;
 
-	for (i = v.wordBegin (); i != v.wordEnd (); ++i)
-		if (*i) return false;
+		return true;
+	}
 
-	return true;
-}
+	template <class Vector1, class Vector2>
+	Vector1 &VectorDomain<GF2>::copySpecialized (Vector1 &res, const Vector2 &v,
+						     VectorCategories::SparseZeroOneVectorTag,
+						     VectorCategories::DenseZeroOneVectorTag) const
+	{
+		typename Vector2::const_iterator i;
+		size_t idx = 0;
 
-template <class Vector1, class Vector2>
-Vector1 &VectorDomain<GF2>::copySpecialized (Vector1 &res, const Vector2 &v,
-					     VectorCategories::SparseZeroOneVectorTag,
-					     VectorCategories::DenseZeroOneVectorTag) const
-{
-	typename Vector2::const_iterator i;
-	size_t idx = 0;
+		res.clear ();
 
-	res.clear ();
+		for (i = v.begin (); i != v.end (); ++i, ++idx)
+			if (*i) res.push_back (idx);
 
-	for (i = v.begin (); i != v.end (); ++i, ++idx)
-		if (*i) res.push_back (idx);
+		return res;
+	}
 
-	return res;
-}
+	template <class Vector1, class Vector2>
+	Vector1 &VectorDomain<GF2>::copySpecialized (Vector1 &res, const Vector2 &v,
+						     VectorCategories::DenseZeroOneVectorTag,
+						     VectorCategories::SparseZeroOneVectorTag) const
+	{
+		size_t sparsesize = *(v.rbegin());
+		if (sparsesize > res.size()) res.resize( *(v.rbegin()) );
+		std::fill (res.wordBegin (), res.wordEnd (), 0);
+
+		for (typename Vector2::const_iterator i = v.begin ();
+		     i != v.end ();
+		     ++i)
+			res[*i] = true;
+		return res;
+	}
 
-template <class Vector1, class Vector2>
-Vector1 &VectorDomain<GF2>::copySpecialized (Vector1 &res, const Vector2 &v,
-					     VectorCategories::DenseZeroOneVectorTag,
-					     VectorCategories::SparseZeroOneVectorTag) const
-{
-    	size_t sparsesize = *(v.rbegin());
-    	if (sparsesize > res.size()) res.resize( *(v.rbegin()) );
-	std::fill (res.wordBegin (), res.wordEnd (), 0);
-
-	for (typename Vector2::const_iterator i = v.begin (); 
-             i != v.end (); 
-             ++i)
-        	res[*i] = true;
-	return res;
-}
+	template <class Vector1, class Vector2>
+	bool &VectorDomain<GF2>::dotSpecialized (bool &res, const Vector1 &v1, const Vector2 &v2,
+						 VectorCategories::SparseZeroOneVectorTag,
+						 VectorCategories::SparseZeroOneVectorTag) const
+	{
+		typename Vector1::const_iterator i = v1.begin ();
+		typename Vector2::const_iterator j = v2.begin ();
+		res = false;
+
+		while (i != v1.end () || j != v2.end ()) {
+			while (i != v1.end () && (j == v2.end () || *i < *j)) { res = !res; ++i; }
+			while (j != v2.end () && (i == v1.end () || *j < *i)) { res = !res; ++j; }
+			if (i != v1.end () && j != v2.end () && *i == *j) { ++i; ++j; }
+		}
 
-template <class Vector1, class Vector2>
-bool &VectorDomain<GF2>::dotSpecialized (bool &res, const Vector1 &v1, const Vector2 &v2,
-					 VectorCategories::SparseZeroOneVectorTag,
-					 VectorCategories::SparseZeroOneVectorTag) const
-{
-	typename Vector1::const_iterator i = v1.begin ();
-	typename Vector2::const_iterator j = v2.begin ();
-	res = false;
-
-	while (i != v1.end () || j != v2.end ()) {
-		while (i != v1.end () && (j == v2.end () || *i < *j)) { res = !res; ++i; }
-		while (j != v2.end () && (i == v1.end () || *j < *i)) { res = !res; ++j; }
-		if (i != v1.end () && j != v2.end () && *i == *j) { ++i; ++j; }
+		return res;
 	}
 
-	return res;
-}
+	template <class Vector1, class Vector2, class Vector3>
+	Vector1 &VectorDomain<GF2>::addSpecialized (Vector1 &res, const Vector2 &y, const Vector3 &x,
+						    VectorCategories::DenseZeroOneVectorTag,
+						    VectorCategories::DenseZeroOneVectorTag,
+						    VectorCategories::DenseZeroOneVectorTag) const
+	{
+		linbox_check (res.size () == y.size ());
+		linbox_check (res.size () == x.size ());
 
-template <class Vector1, class Vector2, class Vector3>
-Vector1 &VectorDomain<GF2>::addSpecialized (Vector1 &res, const Vector2 &y, const Vector3 &x,
-					    VectorCategories::DenseZeroOneVectorTag,
-					    VectorCategories::DenseZeroOneVectorTag,
-					    VectorCategories::DenseZeroOneVectorTag) const
-{
-	linbox_check (res.size () == y.size ());
-	linbox_check (res.size () == x.size ());
+		typename Vector1::word_iterator i = res.wordBegin ();
+		typename Vector2::const_word_iterator j = y.wordBegin ();
+		typename Vector3::const_word_iterator k = x.wordBegin ();
 
-	typename Vector1::word_iterator i = res.wordBegin ();
-	typename Vector2::const_word_iterator j = y.wordBegin ();
-	typename Vector3::const_word_iterator k = x.wordBegin ();
+		for (; i != res.wordEnd (); ++i)
+			*i = *j++ ^ *k++;
 
-	for (; i != res.wordEnd (); ++i)
-		*i = *j++ ^ *k++;
+		return res;
+	}
 
-	return res;
-}
+	template <class Vector1, class Vector2, class Vector3>
+	Vector1 &VectorDomain<GF2>::addSpecialized (Vector1 &res, const Vector2 &y, const Vector3 &x,
+						    VectorCategories::SparseZeroOneVectorTag,
+						    VectorCategories::SparseZeroOneVectorTag,
+						    VectorCategories::SparseZeroOneVectorTag) const
+	{
+		typename Vector2::const_iterator i = y.begin ();
+		typename Vector3::const_iterator j = x.begin ();
 
-template <class Vector1, class Vector2, class Vector3>
-Vector1 &VectorDomain<GF2>::addSpecialized (Vector1 &res, const Vector2 &y, const Vector3 &x,
-					    VectorCategories::SparseZeroOneVectorTag,
-					    VectorCategories::SparseZeroOneVectorTag,
-					    VectorCategories::SparseZeroOneVectorTag) const
-{
-	typename Vector2::const_iterator i = y.begin ();
-	typename Vector3::const_iterator j = x.begin ();
+		res.clear ();
 
-	res.clear ();
+		while (i != y.end () || j != x.end ()) {
+			while (i != y.end () && (j == x.end () || *i < *j)) { res.push_back (*i); ++i; }
+			while (j != x.end () && (i == y.end () || *j < *i)) { res.push_back (*j); ++j; }
+			if (i != y.end () && j != x.end () && *i == *j) { ++i; ++j; }
+		}
 
-	while (i != y.end () || j != x.end ()) {
-		while (i != y.end () && (j == x.end () || *i < *j)) { res.push_back (*i); ++i; }
-		while (j != x.end () && (i == y.end () || *j < *i)) { res.push_back (*j); ++j; }
-		if (i != y.end () && j != x.end () && *i == *j) { ++i; ++j; }
+		return res;
 	}
 
-	return res;
-}
+	template <class Vector1, class Vector2>
+	Vector1 &VectorDomain<GF2>::addinSpecialized (Vector1 &y, const Vector2 &x,
+						      VectorCategories::DenseZeroOneVectorTag,
+						      VectorCategories::DenseZeroOneVectorTag) const
+	{
+		linbox_check (y.size () == x.size ());
 
-template <class Vector1, class Vector2>
-Vector1 &VectorDomain<GF2>::addinSpecialized (Vector1 &y, const Vector2 &x,
-					      VectorCategories::DenseZeroOneVectorTag,
-					      VectorCategories::DenseZeroOneVectorTag) const
-{
-	linbox_check (y.size () == x.size ());
+		typename Vector1::word_iterator i = y.wordBegin ();
+		typename Vector2::const_word_iterator j = x.wordBegin ();
 
-	typename Vector1::word_iterator i = y.wordBegin ();
-	typename Vector2::const_word_iterator j = x.wordBegin ();
+		for (; i != y.wordEnd (); ++i, ++j)
+			*i ^= *j;
 
-	for (; i != y.wordEnd (); ++i, ++j)
-		*i ^= *j;
+		return y;
+	}
 
-	return y;
-}
+	template <class Vector1, class Vector2>
+	Vector1 &VectorDomain<GF2>::addinSpecialized (Vector1 &y, const Vector2 &x,
+						      VectorCategories::DenseZeroOneVectorTag,
+						      VectorCategories::SparseZeroOneVectorTag) const
+	{
+		typename Vector2::const_iterator i;
 
-template <class Vector1, class Vector2>
-Vector1 &VectorDomain<GF2>::addinSpecialized (Vector1 &y, const Vector2 &x,
-					      VectorCategories::DenseZeroOneVectorTag,
-					      VectorCategories::SparseZeroOneVectorTag) const
-{
-	typename Vector2::const_iterator i;
+		for (i = x.begin (); i != x.end (); ++i)
+			y[*i] = !y[*i];
 
-	for (i = x.begin (); i != x.end (); ++i)
-		y[*i] = !y[*i];
+		return y;
+	}
 
-	return y;
-}
+	// Specialization of MatrixDomain for GF2
+	template <>
+	class MatrixDomain<GF2>
+	{
+	public:
+		MatrixDomain (const GF2 &F) :
+		       	_VD (F)
+		{}
+
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &vectorMul (Vector1 &w, const Matrix &A, const Vector2 &v) const
+		{ return mulSpecialized (w, A, v, typename MatrixTraits<Matrix>::MatrixCategory ()); }
+
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+					 MatrixCategories::RowMatrixTag) const
+		{
+			return mulRowSpecialized (w, A, v, typename VectorTraits<Vector1>::VectorCategory ());
+		}
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+					 MatrixCategories::ColMatrixTag) const
+		{
+		       	return mulColSpecialized (w, A, v,
+					    typename VectorTraits<Vector1>::VectorCategory (),
+					    typename VectorTraits<Vector2>::VectorCategory ());
+		}
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+					 MatrixCategories::RowColMatrixTag) const
+		{ return mulRowSpecialized (w, A, v, typename VectorTraits<Vector1>::VectorCategory ()); }
+
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulRowSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+					    VectorCategories::DenseZeroOneVectorTag) const;
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulRowSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+					    VectorCategories::SparseZeroOneVectorTag) const;
+
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+					    VectorCategories::DenseZeroOneVectorTag,
+					    VectorCategories::DenseZeroOneVectorTag) const;
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+					    VectorCategories::DenseZeroOneVectorTag,
+					    VectorCategories::SparseZeroOneVectorTag) const;
 
-// Specialization of MatrixDomain for GF2
-template <>
-class MatrixDomain<GF2>
-{
-    public:
-	MatrixDomain (const GF2 &F) : _VD (F) {}
+		VectorDomain<GF2> _VD;
+	};
 
 	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &mulRowSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-				    VectorCategories::DenseZeroOneVectorTag) const;
-	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &mulRowSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-				    VectorCategories::SparseZeroOneVectorTag) const;
+	Vector1 &MatrixDomain<GF2>::mulRowSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+						       VectorCategories::DenseZeroOneVectorTag) const
+	{
+		linbox_check (A.coldim () == v.size ());
+		linbox_check (A.rowdim () == w.size ());
+
+		typename Matrix::ConstRowIterator i = A.rowBegin ();
+		typename Vector1::iterator j = w.begin ();
+
+		for (; j != w.end (); ++j, ++i)
+			_VD.dot (*j, v, *i);
+
+		return w;
+	}
 
 	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &mulColSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-				    VectorCategories::DenseZeroOneVectorTag,
-				    VectorCategories::DenseZeroOneVectorTag) const;
-	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &mulColSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-				    VectorCategories::DenseZeroOneVectorTag,
-				    VectorCategories::SparseZeroOneVectorTag) const;
+	Vector1 &MatrixDomain<GF2>::mulRowSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+						       VectorCategories::SparseZeroOneVectorTag) const
+	{
+		typename Matrix::ConstRowIterator i = A.rowBegin ();
+		GF2::Element t;
+		unsigned int idx = 0;
 
-	VectorDomain<GF2> _VD;
-};
+		w.clear ();
 
-template <class Vector1, class Matrix, class Vector2>
-Vector1 &MatrixDomain<GF2>::mulRowSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-						     VectorCategories::DenseZeroOneVectorTag) const
-{
-	linbox_check (A.coldim () == v.size ());
-	linbox_check (A.rowdim () == w.size ());
+		for (; i != A.rowEnd (); ++i, ++idx) {
+			_VD.dot (t, v, *i);
 
-	typename Matrix::ConstRowIterator i = A.rowBegin ();
-	typename Vector1::iterator j = w.begin ();
+			if (t)
+				w.push_back (t);
+		}
 
-	for (; j != w.end (); ++j, ++i)
-		_VD.dot (*j, v, *i);
+		return w;
+	}
 
-	return w;
-}
+	template <class Vector1, class Matrix, class Vector2 >
+	Vector1 &MatrixDomain<GF2>::mulColSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+						       VectorCategories::DenseZeroOneVectorTag,
+						       VectorCategories::DenseZeroOneVectorTag) const
+	{
+		linbox_check (A.coldim () == v.size ());
+		linbox_check (A.rowdim () == w.size ());
 
-template <class Vector1, class Matrix, class Vector2>
-Vector1 &MatrixDomain<GF2>::mulRowSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-						     VectorCategories::SparseZeroOneVectorTag) const
-{
-	typename Matrix::ConstRowIterator i = A.rowBegin ();
-	GF2::Element t;
-	unsigned int idx = 0;
+		typename Matrix::ConstColIterator i = A.colBegin ();
+		typename Vector2::const_iterator j = v.begin ();
 
-	w.clear ();
+		_VD.subin (w, w);
 
-	for (; i != A.rowEnd (); ++i, ++idx) {
-		_VD.dot (t, v, *i);
+		for (; j != v.end (); ++j, ++i)
+			_VD.axpyin (w, *j, *i);
 
-		if (t)
-			w.push_back (t);
+		return w;
 	}
 
-	return w;
-}
+	template <class Vector1, class Matrix, class Vector2>
+	Vector1 &MatrixDomain<GF2>::mulColSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+						       VectorCategories::DenseZeroOneVectorTag,
+						       VectorCategories::SparseZeroOneVectorTag) const
+	{
+		linbox_check (A.rowdim () == w.size ());
 
-template <class Vector1, class Matrix, class Vector2 >
-Vector1 &MatrixDomain<GF2>::mulColSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-						     VectorCategories::DenseZeroOneVectorTag,
-						     VectorCategories::DenseZeroOneVectorTag) const
-{
-	linbox_check (A.coldim () == v.size ());
-	linbox_check (A.rowdim () == w.size ());
+		typename Vector2::const_iterator j = v.begin ();
 
-	typename Matrix::ConstColIterator i = A.colBegin ();
-	typename Vector2::const_iterator j = v.begin ();
+		_VD.subin (w, w);
 
-	_VD.subin (w, w);
+		for (; j != v.end (); ++j) {
+			typename Matrix::ConstColIterator i = A.colBegin () + *j;
+			_VD.axpyin (w, true, *i);
+		}
 
-	for (; j != v.end (); ++j, ++i)
-		_VD.axpyin (w, *j, *i);
+		return w;
+	}
 
-	return w;
-}
+	// Specialization of diagonal for GF2
+	template <>
+	class Diagonal<GF2, VectorTraits<Vector<GF2>::Dense>::VectorCategory> : public BlackboxArchetype {
+	public:
 
-template <class Vector1, class Matrix, class Vector2>
-Vector1 &MatrixDomain<GF2>::mulColSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-						     VectorCategories::DenseZeroOneVectorTag,
-						     VectorCategories::SparseZeroOneVectorTag) const
-{
-	linbox_check (A.rowdim () == w.size ());
+		typedef GF2                       Field;
+		typedef Vector<GF2>::Dense        Vector;
+		typedef BlackboxArchetype         Blackbox;
+		typedef bool                      Element;
 
-	typename Vector2::const_iterator j = v.begin ();
+		Diagonal (const Field &, const BitVector &y) :
+			_v (y)
+		{}
 
-	_VD.subin (w, w);
+		/// The field.
+		const Field& field() const
+		{return *(new GF2());}
 
-	for (; j != v.end (); ++j) {
-		typename Matrix::ConstColIterator i = A.colBegin () + *j;
-		_VD.axpyin (w, true, *i);
-	}
+		Blackbox *clone() const
+		{ return new Diagonal (*this); }
 
-	return w;
-}
 
-// Specialization of diagonal for GF2
-template <>
-class Diagonal<GF2, VectorTraits<Vector<GF2>::Dense>::VectorCategory>
-	: public BlackboxArchetype
-{
-    public:
+		template <class OutVector, class InVector>
+		OutVector& apply (OutVector& y, const InVector& x) const
+		{
+			linbox_check (y.size () == x.size ());
+			linbox_check (y.size () == _v.size ());
+			typename InVector::const_iterator j1 = x.begin();
+			typename OutVector::iterator i = y.begin();
+			BitVector::const_iterator j2 = _v.begin();
+			for (; i != y.end (); ++i, ++j1, ++j2)
+				*i = *j1 & *j2;
+			return y;
+		}
 
-	typedef GF2                       Field;
-	typedef Vector<GF2>::Dense        Vector;
-	typedef BlackboxArchetype         Blackbox;
-	typedef bool                      Element;
+		Vector& apply (Vector& y, const Vector& x) const
+		{
+			linbox_check (y.size () == x.size ());
+			linbox_check (y.size () == _v.size ());
 
-	Diagonal (const Field &F, const BitVector &y)
-		: _v (y) 
-	{}
+			BitVector::word_iterator i = y.wordBegin ();
+			BitVector::const_word_iterator j1 = x.wordBegin (), j2 = _v.wordBegin ();
 
-        /// The field.	
-        const Field& field() const {return *(new GF2());}
+			for (; i != y.wordEnd (); ++i, ++j1, ++j2)
+				*i = *j1 & *j2;
 
-	Blackbox *clone() const
-		{ return new Diagonal (*this); }
+			return y;
+		}
 
+		template <class OutVector, class InVector>
+		OutVector& applyTranspose (OutVector& y, const InVector& x) const
+		{ return apply (y, x); }
+
+		size_t rowdim () const
+		{ return _v.size (); }
+		size_t coldim () const
+		{ return _v.size (); }
+
+		/** Get an entry and store it in the given value
+		 * @param x Element in which to store result
+		 * @param i Row index
+		 * @param j Column index
+		 * @return Reference to x
+		 */
+		Element &getEntry (Element &x, size_t i, size_t j) const
+		{
+			return (i==j?x=this->_v[i]:x=false);
+		}
 
-	template <class OutVector, class InVector>
-        OutVector& apply (OutVector& y, const InVector& x) const
-        {
-            linbox_check (y.size () == x.size ());
-            linbox_check (y.size () == _v.size ());
-            typename InVector::const_iterator j1 = x.begin();
-            typename OutVector::iterator i = y.begin();
-            BitVector::const_iterator j2 = _v.begin();
-            for (; i != y.end (); ++i, ++j1, ++j2)
-                *i = *j1 & *j2;
-            return y;
-        }       
-
-	Vector& apply (Vector& y, const Vector& x) const
-	{
-		linbox_check (y.size () == x.size ());
-		linbox_check (y.size () == _v.size ());
+	private:
 
-		BitVector::word_iterator i = y.wordBegin ();
-		BitVector::const_word_iterator j1 = x.wordBegin (), j2 = _v.wordBegin ();
+		// Bit vector of elements
+		BitVector _v;
 
-		for (; i != y.wordEnd (); ++i, ++j1, ++j2)
-			*i = *j1 & *j2;
+	}; // template <Field, Vector> class Diagonal<DenseVectorTag>
 
-		return y;
-	}
+} // namespace LinBox
+
+#include "linbox/switch/cekstv.h"
+namespace LinBox
+{
+	// Specialization of Butterfly switch object
+	template <>
+	class CekstvSwitch<GF2>
+	{
+	public:
+		typedef GF2 Field;
+		/// Typedef
+		typedef Field::Element Element;
+		typedef CekstvSwitch<Field> Self_t;
+		typedef CekstvSwitchFactory<Field> Factory;
+
+		/** Constructor from a field and a field element.
+		 * @param F field in which arithmetic is done
+		 * @param switches vector of switches
+		 */
+		CekstvSwitch (const Field::Element &a) :
+			_a (a)
+		{}
+
+		~CekstvSwitch () {}
+
+		bool apply (const Field &F, Element &x, Element &y) const
+		{
+			F.axpyin (x, _a, y);
+			F.addin (y, x);
+			return true;
+		}
 
-	template <class OutVector, class InVector>
-        OutVector& applyTranspose (OutVector& y, const InVector& x) const 
-        { return apply (y, x); }
-    
-	size_t rowdim () const { return _v.size (); } 
-	size_t coldim () const { return _v.size (); } 
+		bool applyTranspose (const Field &F, Element &x, Element &y) const
+		{
+			F.addin (x, y);
+			F.axpyin (y, _a, x);
+			return true;
+		}
 
-    private:
+		bool apply (const Field &F, std::_Bit_reference x, std::_Bit_reference y) const
+		{
+			F.axpyin (x, _a, y);
+			F.addin (y, x);
+			return true;
+		}
 
-	// Bit vector of elements
-	BitVector _v;
-    
-}; // template <Field, Vector> class Diagonal<DenseVectorTag>
+		bool applyTranspose (const Field &F, std::_Bit_reference x, std::_Bit_reference y) const
+		{
+			F.addin (x, y);
+			F.axpyin (y, _a, x);
+			return true;
+		}
 
-} // namespace LinBox
+		template<typename _Tp1>
+		struct rebind
+		{
+			typedef CekstvSwitch<_Tp1> other;
 
+			// special rebind operator() with two fields,
+			// indeed local field is not stored in the switch
+			void operator() (other *& Ap, const Self_t& A, const _Tp1& T, const Field& F) {
+				typename _Tp1::Element u;
+				Hom<Field, _Tp1>(F,T).image(u, A._a);
+				Ap = new other(u);
+			}
+		};
 
 
-#include <linbox/algorithms/gauss.h>
-namespace LinBox 
-{ 
-// Specialization of Gauss Domain for GF2
-        template <>
-	template <class Matrix>
-	unsigned long& GaussDomain<GF2>::InPlaceLinearPivoting (unsigned long &rank,
-                                                                Element       &determinant,
-                                                                Matrix        &A,
-                                                                unsigned long Ni, 
-                                                                unsigned long Nj)
-{
-    throw LinboxError("LinBox ERROR: rank for GF2 not YET implemented\n");
-    return rank;
-}
+	private:
+
+		// Parameter of this 2x2 block
+		Field::Element _a;
+	};
+
 
 } // namespace LinBox
 
-#endif // __FIELD_GF2_INL
+#endif // __LINBOX_field_gf2_INL
+
diff --git a/linbox/field/givaro-extension.h b/linbox/field/givaro-extension.h
index 9bde326..5b2f451 100644
--- a/linbox/field/givaro-extension.h
+++ b/linbox/field/givaro-extension.h
@@ -1,18 +1,21 @@
-
 /* -*- 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
 /* linbox/field/givaro-gfq.h
  * Copyright (C) 2005 JGD
  *
+ * Time-stamp: <22 Jun 10 10:02:34 Jean-Guillaume.Dumas at imag.fr>
  * ------------------------------------
  *
  * See COPYING for license information.
  */
 
+/*! @file field/givaro-extension.h
+ * @ingroup field
+ * @brief NO DOC
+ */
 
-
-#ifndef __FIELD_GIVARO_EXTENSION
-#define __FIELD_GIVARO_EXTENSION
+#ifndef __LINBOX_field_givaro_extension_H
+#define __LINBOX_field_givaro_extension_H
 
 
 #include <linbox/integer.h>
@@ -32,196 +35,172 @@
 #include <string>
 #include <vector>
 
-#endif
+#endif //__LINBOX_XMLENABLED
 
-//------------------------------------
+//---------------------------------------------
 // Files of Givaro library
-
-
 #include <givaro/givextension.h>
 #include <givaro/giv_randiter.h>
-//------------------------------------
+//---------------------------------------------
+// To convert linbox fields to Givaro interface
+#include <linbox/field/givaro-field.h>
 
+//---------------------------------------------
 // Namespace in which all LinBox code resides
-namespace LinBox 
-{ 
+namespace LinBox
+{
 
 	template <class Ring>
 	struct ClassifyRing;
 
-        template< class BaseField>
+	template< class BaseField>
 	class GivaroExtension;
 
-	template<> template< class BaseField>
+#if !defined(__INTEL_COMPILER) && !defined(__CUDACC__)
+	template<>
+#endif
+	template< class BaseField>
 	struct ClassifyRing<GivaroExtension<BaseField> > {
 		typedef RingCategories::ModularTag categoryTag;
-        };
-
-    template<> template< class BaseField>
-    struct FieldTraits< GivaroExtension<BaseField> >
-    {
-	typedef RingCategories::ModularTag categoryTag;
-	
-	static integer& maxModulus( integer& i )
-            { return  FieldTraits<BaseField>::maxModulus(i); } 
-
-	static bool goodModulus( const integer& i ) 
-            { return  FieldTraits<BaseField>::goodModulus(i); } 
-        
-	// After that degree might not be correct ...
-	static integer& maxExponent( integer& i ) { return i = 2147483648UL; }
-	static bool goodExponent( const integer& i ) {
-            integer max;
-            return ( i >= 1 && i <= maxExponent( max ) );
-	}
-    };
-
-  /** 
-  \brief give LinBox fields an allure of Givaro Fields
-  \ingroup field
-
-   *  This class adds the necessary requirements allowing 
-   *  the construction of an extension of a LinBox field.
-   */ 
-    template< class BaseField >
-    struct GivaroField : public BaseField 
-    {
-        typedef typename BaseField::Element TT;
-        typedef typename Signed_Trait<TT>::unsigned_type UTT;
-        typedef TT Rep;
-        typedef GivaroField<BaseField> Self_t;
-        typedef Rep Element;
-        typedef UTT Residu_t;
-
-        Element zero, one;
-        GivaroField(const BaseField& bf) : BaseField(bf) {
-            this->init(zero,0UL);
-            this->init(one, 1UL);
-        }
-
-
-            // -- amxy: r <- c - a * b mod p
-        Rep& amxy (Rep& r, const Rep a, const Rep b, const Rep c) const {
-            Rep tmp;
-            this->mul(tmp, a, b);
-            this->assign(r,c);
-            return this->subin(r,tmp);
-        }
-
-        bool areNEqual ( const Rep a, const Rep b) const {
-            return ! this->areEqual(a,b);
-        }
-
-            // Access to the modulus, characteristic, size, exponent
-        UTT residu() const { integer c; BaseField::characteristic(c); return UTT(c); }
-        UTT characteristic() const  { integer c; BaseField::characteristic(c); return UTT(c); }
-        UTT cardinality() const  { integer c; BaseField::cardinality(c); return UTT(c); }
-        UTT exponent() const { return 1; }
-        UTT size() const  { integer c; BaseField::cardinality(c); return UTT(c); }
-
-
-            // ----- random generators
-        template<class RandIter> Rep& random(RandIter& g, Rep& r) const { return r = g() ; }
-        template<class RandIter> Rep& random(RandIter& g, Rep& r, long s) const { return r = g() ; }
-        template<class RandIter> Rep& random(RandIter& g, Rep& r, const Rep& b) const { return r = g() ; }
-        template<class RandIter> Rep& nonzerorandom(RandIter& g, Rep& r) const { return r = g() ; }
-        template<class RandIter> Rep& nonzerorandom(RandIter& g, Rep& r, long s) const { return r = g() ; }
-        template<class RandIter> Rep& nonzerorandom(RandIter& g, Rep& r, const Rep& b) const { return r = g() ; }
-
-    };
-        
-        
-
-  /** This template class is define just to be in phase with the LinBox
-   *  archetype.
-   *  Most of all methods are inherited from Extension  class
-   *  of Givaro.
-   *  these class allow to construct only extension field with a prime characteristic.
-   */   
-    template< class BaseField = GivaroGfq>
-    class GivaroExtension : public Extension<GivaroField<BaseField> >, public FieldInterface
-    {
- 
-        typedef GivaroExtension<GivaroField<BaseField> > Self_t;
-  public:
-
-    /** Element type.
-     *  This type is inherited from the Givaro class Extension
-     */
-    typedef typename Extension<GivaroField<BaseField> >::Element Element;
-    
-    /** RandIter type
-     *  This type is inherited from the Givaro class GFqDom<TAG>
-     */	
-    typedef GIV_ExtensionrandIter< Extension<GivaroField<BaseField> >, LinBox::integer >  RandIter;
-
-    /** Constructor from an integer
-     */
-    GivaroExtension(const integer& p, const integer& k=1) :
-      Extension<GivaroField<BaseField> >(static_cast<typename Extension<GivaroField<BaseField> >::Residu_t>(int32(p)), static_cast<typename Extension<GivaroField<BaseField> >::Residu_t>(int32(k))) {
-    }
-
-    /** Constructor extension of a base field 
-     */
-    GivaroExtension(const BaseField& bF, const integer& ext=1) :
-      Extension<GivaroField<BaseField> >( GivaroField<BaseField>(bF), static_cast<typename Extension<GivaroField<BaseField> >::Residu_t>(int32(ext))) {
-    }
-
-
-    /** Copy Constructor 
-     */
-    GivaroExtension(const Self_t& F) :
-      Extension<GivaroField<BaseField> >(F) {
-    }
-
-  }; // class GivaroExtension
- 
-
-
-  /** This template class is define just to be in phase with the LinBox
-   *  archetype.
-   *  Most of all methods are inherited from Extension  class
-   *  of Givaro.
-   *  these class allow to construct only extension field with a prime characteristic.
-   */   
-    template<>
-    class GivaroExtension<GivaroGfq> : public Extension<GFqDom<int32> >, public FieldInterface
-    {
- 
-        typedef GivaroExtension<GivaroGfq> Self_t;
-  public:
-
-    /** Element type.
-     *  This type is inherited from the Givaro class Extension
-     */
-    typedef Extension<GFqDom<int32> >::Element Element;
-    
-    /** RandIter type
-     *  This type is inherited from the Givaro class GFqDom<TAG>
-     */	
-    typedef GIV_ExtensionrandIter< Extension< GFqDom<int32> >, LinBox::integer >  RandIter;
-
-    /** Constructor from an integer
-     */
-    GivaroExtension(const integer& p, const integer& k=1) :
-      Extension<GFqDom<int32> >(static_cast< Extension<GFqDom<int32> >::Residu_t>(int32(p)), static_cast< Extension<GFqDom<int32> >::Residu_t>(int32(k))) {
-    }
-
-    /** Constructor extension of a base field 
-     */
-    GivaroExtension(const GivaroGfq& bF, const integer& ext=1) :
-      Extension<GFqDom<int32> >( static_cast< const Extension<GFqDom<int32> >::BaseField_t &>(bF), static_cast< Extension<GFqDom<int32> >::Residu_t>(int32(ext))) {
-    }
-
-
-    /** Copy Constructor 
-     */
-    GivaroExtension(const Self_t& F) :
-      Extension<GFqDom<int32> >(F) {
-    }
-
-  }; // class GivaroExtension
- 
+	};
+
+#if !defined(__INTEL_COMPILER) && !defined(__CUDACC__)
+	template<>
+#endif
+	template< class BaseField>
+	struct FieldTraits< GivaroExtension<BaseField> >
+	{
+		typedef RingCategories::ModularTag categoryTag;
+
+		static integer& maxModulus( integer& i )
+		{
+			return  FieldTraits<BaseField>::maxModulus(i);
+		}
+
+		static bool goodModulus( const integer& i )
+		{
+			return  FieldTraits<BaseField>::goodModulus(i);
+		}
+
+		// After that degree might not be correct ...
+		static integer& maxExponent( integer& i )
+		{
+			return i = 2147483648UL;
+		}
+		static bool goodExponent( const integer& i )
+		{
+			integer max;
+			return ( i >= 1 && i <= maxExponent( max ) );
+		}
+	};
+
+
+	/** This template class is defined to be in phase with the LinBox
+	 *  archetype.
+	 *  Most of all methods are inherited from Extension  class
+	 *  of Givaro.
+	 *  These class allow to construct only extension field with a prime characteristic.
+	 */
+	template< class BaseField = GivaroGfq>
+	class GivaroExtension : public ::Givaro::Extension<GivaroField<BaseField> >, public FieldInterface {
+
+		typedef GivaroExtension<GivaroField<BaseField> > Self_t;
+		typedef ::Givaro::Extension<GivaroField<BaseField> >       Extension_t;
+	public:
+		using Extension_t::zero;
+		using Extension_t::one;
+
+		/** Element type.
+		 *  This type is inherited from the Givaro class Extension
+		 */
+		typedef typename ::Givaro::Extension<GivaroField<BaseField> >::Element Element;
+
+		/** RandIter type.
+		 *  This type is inherited from the Givaro class GFqDom<TAG>
+		 */
+		typedef ::Givaro::GIV_ExtensionrandIter< ::Givaro::Extension<GivaroField<BaseField> >, LinBox::integer >  RandIter;
+
+
+		GivaroExtension()
+		{}
+
+
+		/** Constructor from an integer.
+		*/
+		GivaroExtension(const integer& p, const integer& k=1) :
+			::Givaro::Extension<GivaroField<BaseField> >(static_cast<typename ::Givaro::Extension< GivaroField< BaseField > >::Residu_t >(int32_t(p)), static_cast<typename ::Givaro::Extension< GivaroField< BaseField > >::Residu_t>(int32_t(k)))
+		{
+		}
+
+		/** Constructor extension of a base field.
+		*/
+		GivaroExtension(const BaseField& bF, const integer& ext=1) :
+			::Givaro::Extension<GivaroField<BaseField> >( GivaroField<BaseField>(bF),
+								      static_cast<typename ::Givaro::Extension< GivaroField< BaseField > >::Residu_t>(int32_t(ext)))
+		{
+		}
+
+
+		/** Copy Constructor
+		*/
+		GivaroExtension(const Self_t& F) :
+			::Givaro::Extension<GivaroField<BaseField> >(F) {
+			}
+
+	}; // class GivaroExtension
+
+
+
+	/** This template class is define just to be in phase with the LinBox
+	 *  archetype.
+	 *  Most of all methods are inherited from Extension  class
+	 *  of Givaro.
+	 *  these class allow to construct only extension field with a prime characteristic.
+	 */
+#ifndef __INTEL_COMPILER
+	template<>
+	#endif
+	class GivaroExtension<GivaroGfq> : public ::Givaro::Extension< ::Givaro::GFqDom<int32_t> >, public FieldInterface {
+
+		typedef GivaroExtension<GivaroGfq> Self_t;
+	public:
+
+		/** Element type.
+		 *  This type is inherited from the Givaro class Extension
+		 */
+		typedef ::Givaro::Extension< ::Givaro::GFqDom<int32_t> >::Element Element;
+
+		/** RandIter type.
+		 *  This type is inherited from the Givaro class GFqDom<TAG>
+		 */
+		typedef ::Givaro::GIV_ExtensionrandIter< ::Givaro::Extension< ::Givaro::GFqDom<int32_t> >, LinBox::integer >  RandIter;
+
+		/** Constructor from an integer.
+		*/
+		GivaroExtension(const integer& p, const integer& k=1) :
+			::Givaro::Extension< ::Givaro::GFqDom<int32_t> >(static_cast< ::Givaro::Extension< ::Givaro::GFqDom<int32_t> >::Residu_t>(int32_t(p)),
+						  static_cast< ::Givaro::Extension< ::Givaro::GFqDom<int32_t> >::Residu_t>(int32_t(k)))
+		{
+		}
+
+		/** Constructor extension of a base field.
+		*/
+		GivaroExtension(const GivaroGfq& bF, const integer& ext=1) :
+			::Givaro::Extension< ::Givaro::GFqDom<int32_t> >( static_cast< const ::Givaro::Extension< ::Givaro::GFqDom< int32_t > >::BaseField_t &>(bF),
+						   static_cast< ::Givaro::Extension< ::Givaro::GFqDom<int32_t> >::Residu_t >(int32_t(ext)))
+		{
+		}
+
+
+		/** Copy Constructor.
+		*/
+		GivaroExtension(const Self_t& F) :
+			::Givaro::Extension< ::Givaro::GFqDom<int32_t> >(F)
+		{ }
+
+
+	}; // class GivaroExtension
+
 
 
 } // namespace LinBox
@@ -230,50 +209,65 @@ namespace LinBox
 
 // Specialization of homomorphism for basefield
 #include "linbox/field/hom.h"
-namespace LinBox 
+namespace LinBox
 {
-    template< class BaseField>
-    class Hom < BaseField, GivaroExtension<BaseField> >
-	{
-            typedef BaseField Source;
-            typedef GivaroExtension<BaseField> Target;
-        public:
+	///  NO DOC
+	template< class BaseField>
+	class Hom < BaseField, GivaroExtension<BaseField> > {
+		typedef BaseField Source;
+		typedef GivaroExtension<BaseField> Target;
+	public:
 		typedef typename Source::Element SrcElt;
 		typedef typename Target::Element Elt;
 
 		//Hom(){}
-		/**
-		 * Construct a homomorphism from a specific source ring S and target 
-		 * field T with Hom(S, T).  The default behaviour is error.  
+		/** Constructor.
+		 * Construct a homomorphism from a specific source ring S and target
+		 * field T with Hom(S, T).  The default behaviour is error.
 		 * Specializations define all actual homomorphisms.
 		 */
-		Hom(const Source& S, const Target& T) : _source(S), _target(T){}
+		Hom(const Source& S, const Target& T) :
+			_source(S), _target(T)
+		{}
 
-		/** 
-		 * image(t, s) implements the homomorphism, assigning the 
+		/** Image.
+		 * image(t, s) implements the homomorphism, assigning the
 		 * t the value of the image of s under the mapping.
 		 *
 		 * The default behaviour is a no-op.
 		 */
-		Elt& image(Elt& t, const SrcElt& s) {return _target.assign(t, s);}
+		Elt& image(Elt& t, const SrcElt& s) const
+		{
+			return _target.assign(t, s);
+		}
 
-		/** If possible, preimage(s,t) assigns a value to s such that 
+		/** Preimage.
+		 * If possible, preimage(s,t) assigns a value to s such that
 		 * the image of s is t.  Otherwise behaviour is unspecified.
 		 * An error may be thrown, a conventional value may be set, or
 		 * an arb value set.
 		 *
 		 * The default behaviour is a no-op.
 		 */
-		SrcElt& preimage(SrcElt& s, const Elt& t) {
-                    return _target.getEntry(s, Degree(0), t);
-                }
-
-		const Source& source() { return _source;}
-		const Target& target() { return _target;}
+		SrcElt& preimage(SrcElt& s, const Elt& t) const
+		{
+			//                     return _target.getEntry(s, Degree(0), t);
+			return _target.convert(s, t);
+		}
+
+		const Source& source() const
+		{
+			return _source;
+		}
+		const Target& target() const
+		{
+			return _target;
+		}
 
 	private:
 		Source _source;
 		Target _target;
-    }; // end Hom 
+	}; // end Hom
 }
-#endif // __FIELD_GIVARO_Extension
+#endif // __LINBOX_field_givaro_extension_H
+
diff --git a/linbox/field/givaro-field.h b/linbox/field/givaro-field.h
new file mode 100644
index 0000000..65760b1
--- /dev/null
+++ b/linbox/field/givaro-field.h
@@ -0,0 +1,121 @@
+/* -*- 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
+/* linbox/field/givaro-field.h
+ * Copyright (C) 2009 JGD
+ *
+ * ------------------------------------
+ *
+ * See COPYING for license information.
+ */
+
+#ifndef __LINBOX_givaro_field_H
+#define __LINBOX_givaro_field_H
+
+#include <givaro/givconfig.h>
+#include <linbox/integer.h>
+#include <linbox/field/field-traits.h>
+#include <linbox/field/field-interface.h>
+#include <givaro/givconfig.h>
+
+namespace LinBox
+{
+
+	/**
+	  \brief give LinBox fields an allure of Givaro Fields
+	  \ingroup field
+
+	 *  This class adds the necessary requirements allowing
+	 *  the construction of an extension of a LinBox field
+	 *  or a givaro polynomial of a LinBox field ...
+	 */
+	template< class BaseField >
+	struct GivaroField : public BaseField
+	{
+		typedef typename BaseField::Element TT;
+		typedef typename Signed_Trait<TT>::unsigned_type UTT;
+		typedef TT Rep;
+		typedef GivaroField<BaseField> Self_t;
+		typedef Rep Element;
+		typedef UTT Residu_t;
+
+		Element zero, one;
+		GivaroField() :
+			BaseField()
+		{
+			this->init(zero,0UL);
+			this->init(one, 1UL);
+		}
+		GivaroField(const BaseField& bf) :
+			BaseField(bf)
+		{
+			this->init(zero,0UL);
+			this->init(one, 1UL);
+		}
+
+
+		// -- axmy: r <- a * x - y
+		Rep& axmy (Rep& r, const Rep a, const Rep x, const Rep y) const
+		{
+			Rep tmp; this->mul(tmp, a, x);
+			return this->sub(r,tmp,y);
+		}
+
+		// -- maxpy: r <- y - a * x
+		Rep& maxpy (Rep& r, const Rep a, const Rep x, const Rep y) const
+		{
+			Rep tmp; this->mul(tmp, a, x);
+			return this->sub(r,y,tmp);
+		}
+
+		// -- axmyin: r <-  a * x - r
+		Rep& axmyin (Rep& r, const Rep a, const Rep x) const
+		{
+			maxpyin(r,a,x);
+			return negin(r);
+		}
+
+		// -- maxpyin: r <- r - a * x
+		Rep& maxpyin (Rep& r, const Rep a, const Rep x) const
+		{
+			Rep tmp; this->mul(tmp, a, x);
+			return this->subin(r,tmp);
+		}
+
+		bool areNEqual ( const Rep a, const Rep b) const
+		{
+			return ! this->areEqual(a,b);
+		}
+
+		// Access to the modulus, characteristic, size, exponent
+		UTT residu() const
+		{ integer c; BaseField::characteristic(c); return UTT(c); }
+		UTT characteristic() const  { integer c; BaseField::characteristic(c); return UTT(c); }
+		integer& characteristic(integer& i) const  { return BaseField::characteristic(i); }
+		UTT cardinality() const  { integer c; BaseField::cardinality(c); return UTT(c); }
+		UTT exponent() const
+		{ return 1; }
+		UTT size() const  { integer c; BaseField::cardinality(c); return UTT(c); }
+
+
+		// ----- random generators
+		template<class RandIter> Rep& random(RandIter& g, Rep& r) const
+		{ return this->init(r,g()) ; }
+		template<class RandIter> Rep& random(RandIter& g, Rep& r, long s) const
+		{ return this->init(r,g()) ; }
+		template<class RandIter> Rep& random(RandIter& g, Rep& r, const Rep& b) const
+		{ return this->init(r,g()) ; }
+		template<class RandIter> Rep& nonzerorandom(RandIter& g, Rep& r) const
+		{ do { this->init(r,g()); } while( this->isZero(r) ); return r; }
+		template<class RandIter> Rep& nonzerorandom(RandIter& g, Rep& r, long s) const
+		{ do { this->init(r,g()); } while( this->isZero(r) ); return r; }
+		template<class RandIter> Rep& nonzerorandom(RandIter& g, Rep& r, const Rep& b) const
+		{ do { this->init(r,g()); } while( this->isZero(r) ); return r; }
+
+	};
+
+
+
+} // end namespace LinBox
+
+#endif // __LINBOX_givaro_field_H
+
diff --git a/linbox/field/givaro-gfq.h b/linbox/field/givaro-gfq.h
index 2b406a2..5f112b6 100644
--- a/linbox/field/givaro-gfq.h
+++ b/linbox/field/givaro-gfq.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/field/givaro-gfq.h
  * Copyright (C) 2002 Pascal Giorgi
  *
@@ -13,20 +13,23 @@
  * See COPYING for license information.
  */
 
-/* WARNING this wrapper works only with an improved version of Givaro.
- * This version of givaro won't be available for public yet.
- * But it is available on my web page.
+/*! @file field/givaro-gfq.h
+ *
+ * @warning This wrapper works only with an improved version of Givaro ;
+ * This version of givaro won't be available for public yet ;
+ * But it is available on my web page ;
  * You can send me a mail to get it or for others details.
  */
 
-#ifndef __FIELD_GIVARO_GFQ
-#define __FIELD_GIVARO_GFQ
+#ifndef __LINBOX_field_givaro_gfq_H
+#define __LINBOX_field_givaro_gfq_H
 
 
 #include <linbox/integer.h>
 #include <linbox/field/field-traits.h>
 #include <linbox/field/field-interface.h>
 #include <linbox/util/debug.h>
+#include <linbox/field/hom.h>
 #include "linbox/linbox-config.h"
 
 
@@ -40,8 +43,8 @@
 //------------------------------------
 
 // Namespace in which all LinBox code resides
-namespace LinBox 
-{ 
+namespace LinBox
+{
 
 	template <class Ring>
 	struct ClassifyRing;
@@ -51,17 +54,18 @@ namespace LinBox
 	template<>
 	struct ClassifyRing<GivaroGfq> {
 		typedef RingCategories::ModularTag categoryTag;
-        };
+	};
 
 
 	class GivaroGfq;
-	
+
 	template<>
-	integer& FieldTraits<GivaroGfq>::maxModulus( integer& i )
-		{ return i = integer( 32749 ); } // prevprime( 2^15 )
+	inline integer& FieldTraits<GivaroGfq>::maxModulus( integer& i )
+	{ return i = integer( 32749 ); } // prevprime( 2^15 )
 
 	template<>
-	bool FieldTraits<GivaroGfq>::goodModulus( const integer& i ) {
+	inline bool FieldTraits<GivaroGfq>::goodModulus( const integer& i )
+	{
 		integer max;
 		if( i < 2 || i > FieldTraits<GivaroGfq>::maxModulus(max) )
 			return false;
@@ -69,183 +73,243 @@ namespace LinBox
 	}
 
 	template<>
-	integer& FieldTraits<GivaroGfq>::maxExponent( integer& i )
-		{ return i = 20; } // Cardinality must be <= 2^20
-
-
-  /** wrapper of Givaro's GFqDom<int32>  class 
-  \ingroup field
-
-   *  This class allows to construct only extension fields with a prime characteristic.
-   */   
- class GivaroGfq : public GFqDom<int32>, public FieldInterface
-  {
- 
-  public:
-
-    /** Element type.
-     *  This type is inherited from the Givaro class GFqDom<int32>
-     */
-    typedef  GFqDom<int32>::Rep Element;
-    
-    /** RandIter type
-     *  This type is inherited from the Givaro class GFqDom<TAG>
-     */	
-    typedef GIV_randIter< GFqDom<int32>, LinBox::integer >  RandIter;
-
-    /** Constructor from an integer
-     *  this constructor use the ZpzDom<TAG> constructor
-     */
-    GivaroGfq(const integer& p, const integer& k=1) :
-      GFqDom<int32>(static_cast<UTT>(int32(p)), static_cast<UTT>(int32(k))) {
-	//enforce that the cardinality must be <2^16, for givaro-gfq
-	int32 pl=p;
-	for(int32 i=1;i<k;++i) pl*=(int32)p;
-	if(!FieldTraits<GivaroGfq>::goodModulus(p)) 
-		throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus be between 2 and 2^15 and prime");
-	else if(pl>(1<<20)) throw PreconditionFailed(__FUNCTION__,__LINE__,"cardinality must be < 2^20");
+	inline integer& FieldTraits<GivaroGfq>::maxExponent( integer& i )
+	{ return i = 20; } // Cardinality must be <= 2^20
+
+
+	/** Wrapper of Givaro's GFqDom<int32_t>  class.
+	  \ingroup field
+
+	 *  This class allows to construct only extension fields with a prime characteristic.
+	 */
+	class GivaroGfq : public ::Givaro::GFqDom<int32_t>, public FieldInterface {
+
+	public:
+
+		/** Element type.
+		 *  This type is inherited from the Givaro class GFqDom<int32_t>
+		 */
+		typedef  ::Givaro::GFqDom<int32_t>::Rep Element;
+
+		/** RandIter type
+		 *  This type is inherited from the Givaro class GFqDom<TAG>
+		 */
+		typedef ::Givaro::GIV_randIter< ::Givaro::GFqDom<int32_t>, LinBox::integer >  RandIter;
+
+		/** Empty Constructor
+		*/
+		GivaroGfq() :
+			::Givaro::GFqDom<int32_t>()
+		{ }
+
+		/** Constructor from an integer
+		 *  this constructor use the ZpzDom<TAG> constructor
+		 */
+		GivaroGfq(const integer& p, const integer& k=1) :
+			::Givaro::GFqDom<int32_t>(static_cast<UTT>(int32_t(p)), static_cast<UTT>(int32_t(k)))
+		{
+			//enforce that the cardinality must be <2^16, for givaro-gfq
+			int32_t pl=p;
+			for(int32_t i=1;i<k;++i) pl*=(int32_t)p;
+			if(!FieldTraits<GivaroGfq>::goodModulus(p))
+				throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus be between 2 and 2^15 and prime");
+			else if(pl>(1<<20)) throw PreconditionFailed(__func__,__FILE__,__LINE__,"cardinality must be < 2^20");
+
+		}
+
+		// Dan Roche 6-15-04
+		// This constructor takes a vector of ints that represent the polynomial
+		// to use (for modular arithmetic on the extension field).
+		// Mostly copied from givaro/givgfq.inl
+		GivaroGfq(const integer& p, const integer& k, const std::vector<integer>& modPoly) :
+			::Givaro::GFqDom<int32_t>(static_cast<UTT>(int32_t(p)), static_cast<UTT>(int32_t(k)))
+		{
+
+			//enforce that the cardinality must be <2^16, for givaro-gfq
+			int32_t pl=p;
+			for(int32_t i=1;i<k;++i) pl*=(int32_t)p;
+			if(!FieldTraits<GivaroGfq>::goodModulus(p)) throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus be between 2 and 2^15 and prime");
+			else if(pl>=(1<<16)) throw PreconditionFailed(__func__,__FILE__,__LINE__,"cardinality must be < 2^16");
+
+			if( k < 2 ) throw PreconditionFailed(__func__,__FILE__,__LINE__,"exponent must be >1 if polynomial is specified");
+
+			if(modPoly.size() != (size_t)(k+1)) throw PreconditionFailed(__func__,__FILE__,__LINE__,"Polynomial must be of order k+1");
+
+			::Givaro::GFqDom<int32_t> Zp(p,1);
+			typedef ::Givaro::Poly1FactorDom< ::Givaro::GFqDom<int32_t>, ::Givaro::Dense > PolDom;
+			PolDom Pdom( Zp );
+			PolDom::Element Ft, F, G, H;
+
+			::Givaro::Poly1Dom< ::Givaro::GFqDom<int32_t>, ::Givaro::Dense >::Rep tempVector(k+1);
+			for( int i = 0; i < k+1; i++ )
+				tempVector[i] = modPoly[i] % p;
+			Pdom.assign( F, tempVector );
+
+			Pdom.give_prim_root(G,F);
+			Pdom.assign(H,G);
+
+			typedef ::Givaro::Poly1PadicDom< ::Givaro::GFqDom<int32_t>, ::Givaro::Dense > PadicDom;
+			PadicDom PAD(Pdom);
+
+			PAD.eval(_log2pol[1],H);
+			for (UTT i = 2; i < _qm1; ++i) {
+				Pdom.mulin(H, G);
+				Pdom.modin(H, F);
+				PAD.eval(_log2pol[i], H);
+			}
+
+			for (UTT i = 0; i < _q; ++i)
+				_pol2log[ _log2pol[i] ] = 1;
+
+			UTT a,b,r,P=p;
+			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;
+
+		}
+
+		/** Characteristic.
+		 * Return integer representing characteristic of the domain.
+		 * Returns a positive integer to all domains with finite characteristic,
+		 * and returns 0 to signify a domain of infinite characteristic.
+		 * @return integer representing characteristic of the domain.
+		 */
+		integer& characteristic(integer& c) const
+		{return c=integer(static_cast<int32_t>(::Givaro::GFqDom<int32_t>::characteristic()));}
+
+		int32_t characteristic() const
+		{return static_cast<int32_t>(::Givaro::GFqDom<int32_t>::characteristic());}
+
+
+		/** Cardinality.
+		 * Return integer representing cardinality of the domain.
+		 * Returns a non-negative integer for all domains with finite
+		 * cardinality, and returns -1 to signify a domain of infinite
+		 * cardinality.
+		 * @return integer representing cardinality of the domain
+		 */
+		integer& cardinality(integer& c) const
+		{ return c=integer(static_cast<int32_t>(::Givaro::GFqDom<int32_t>::size()));}
+
+
+		integer cardinality() const
+		{ return integer(static_cast<int32_t>(::Givaro::GFqDom<int32_t>::cardinality()));}
+
+
+		/** Initialization of field base Element from an integer.
+		 * Behaves like C++ allocator construct.
+		 * This function assumes the output field base Element x has already been
+		 * constructed, but that it is not already initialized.
+		 * We assume that the type of Element is short int.
+		 * this methos is just a simple cast.
+		 * @return reference to field base Element.
+		 * @param x field base Element to contain output (reference returned).
+		 * @param y integer.
+		 */
+		Element& init(Element& x , const integer& y = 0) const
+		{ return ::Givaro::GFqDom<int32_t>::init( x, int32_t(y % (integer) _q));}
+
+		// TO BE OPTIMIZED
+		Element& init(Element& x , const float y) const
+		{ return ::Givaro::GFqDom<int32_t>::init( x, (double)y);}
+
+		template<class YYY>
+		Element& init(Element& x , const YYY& y) const
+		{ return ::Givaro::GFqDom<int32_t>::init( x, y);}
+
+		/** Conversion of field base Element to an integer.
+		 * This function assumes the output field base Element x has already been
+		 * constructed, but that it is not already initialized.
+		 * @return reference to an integer.
+		 * @param x integer to contain output (reference returned).
+		 * @param y constant field base Element.
+		 */
+		integer& convert(integer& x, const Element& y) const
+		{
+			int32_t tmp;
+			return x = integer(::Givaro::GFqDom<int32_t>::convert(tmp,y));
+		}
+		// TO BE OPTIMIZED
+		float& convert(float& x, const Element& y) const
+		{
+			double tmp;
+			::Givaro::GFqDom<int32_t>::convert( tmp, y);
+			return x = (float)tmp;
+		}
+
+		template<class XXX>
+		XXX& convert(XXX& x, const Element& y) const
+		{
+			return ::Givaro::GFqDom<int32_t>::convert( x, y);
+		}
+
+		//bool isZero(const Element& x) const { return ::Givaro::GFqDom<int32_t>::isZero(x); }
+
+
+	}; // class GivaroGfq
 
-	}
 
-    // Dan Roche 6-15-04
-    // This constructor takes a vector of ints that represent the polynomial
-    // to use (for modular arithmetic on the extension field).
-    // Mostly copied from givaro/givgfq.inl
-    GivaroGfq(const integer& p, const integer& k, const std::vector<integer>& modPoly)
-      : GFqDom<int32>(static_cast<UTT>(int32(p)), static_cast<UTT>(int32(k))) {
-
-        //enforce that the cardinality must be <2^16, for givaro-gfq
-        int32 pl=p;
-        for(int32 i=1;i<k;++i) pl*=(int32)p;
-        if(!FieldTraits<GivaroGfq>::goodModulus(p)) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus be between 2 and 2^15 and prime");
-        else if(pl>=(1<<16)) throw PreconditionFailed(__FUNCTION__,__LINE__,"cardinality must be < 2^16");
-	
-	if( k < 2 ) throw PreconditionFailed(__FUNCTION__,__LINE__,"exponent must be >1 if polynomial is specified");
-
-	if(modPoly.size() != (size_t)(k+1)) throw PreconditionFailed(__FUNCTION__,__LINE__,"Polynomial must be of order k+1");
-
-	GFqDom<int32> Zp(p,1);
-	typedef Poly1FactorDom< GFqDom<int32>, Dense > PolDom;
-	PolDom Pdom( Zp );
-	PolDom::Element Ft, F, G, H;
-
-	Poly1Dom< GFqDom<int32>, Dense >::Rep tempVector(k+1);
-	for( int i = 0; i < k+1; i++ )
-		tempVector[i] = modPoly[i] % p;
-	Pdom.assign( F, tempVector );
-
-	Pdom.give_prim_root(G,F);
-	Pdom.assign(H,G);
-
-	typedef Poly1PadicDom< GFqDom<int32>, Dense > PadicDom;
-	PadicDom PAD(Pdom);
-
-	PAD.eval(_log2pol[1],H);
-	for (UTT i = 2; i < _qm1; ++i) {
-		Pdom.mulin(H, G);
-		Pdom.modin(H, F);
-		PAD.eval(_log2pol[i], H);
-	}
+	template<>
+	class Hom <GivaroGfq,GivaroGfq> {
+	public:
+		typedef GivaroGfq Source;
+		typedef GivaroGfq Target;
+
+		typedef Source::Element SrcElt;
+		typedef Target::Element Elt;
+
+		//Hom(){}
+		/**
+		 * Construct a homomorphism from a specific source ring S and target
+		 * field T with Hom(S, T).
+		 * Specializations define all actual homomorphisms.
+		 */
+		Hom(const Source& S, const Target& T) :
+			_source(S), _target(T)
+		{ }
+
+		/**
+		 * image(t, s) implements the homomorphism, assigning the
+		 * t the value of the image of s under the mapping.
+		 *
+		 * The default behaviour goes through integers.
+		 */
+		Elt& image(Elt& t, const SrcElt& s)
+		{
+			return _target.init(t, _source.convert(tmp,s));
+		}
+
+		/** If possible, preimage(s,t) assigns a value to s such that
+		 * the image of s is t.  Otherwise behaviour is unspecified.
+		 * An error may be thrown, a conventional value may be set, or
+		 * an arb value set.
+		 *
+		 * The default behaviour goes through integers.
+		 */
+		SrcElt& preimage(SrcElt& s, const Elt& t)
+		{
+			return _source.init(s, _target.convert(tmp,t));
+		}
+		const Source& source() { return _source;}
+		const Target& target() { return _target;}
+
+	private:
+		integer tmp;
+		Source _source;
+		Target _target;
+	}; // end Hom
 
-	for (UTT i = 0; i < _q; ++i)
-		_pol2log[ _log2pol[i] ] = 1;
-	
-	UTT a,b,r,P=p;
-	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;
-
-    }
-
-    /** Characteristic.
-     * Return integer representing characteristic of the domain.
-     * Returns a positive integer to all domains with finite characteristic,
-     * and returns 0 to signify a domain of infinite characteristic.
-     * @return integer representing characteristic of the domain.
-     */
-    integer& characteristic(integer& c) const
-      {return c=integer(static_cast<int32>(GFqDom<int32>::characteristic()));}
-
-    int32 characteristic() const
-      {return static_cast<int32>(GFqDom<int32>::characteristic());}
-    
-      
-    /** Cardinality. 
-     * Return integer representing cardinality of the domain.
-     * Returns a non-negative integer for all domains with finite
-     * cardinality, and returns -1 to signify a domain of infinite
-     * cardinality.
-     * @return integer representing cardinality of the domain
-     */
-    integer& cardinality(integer& c) const
-      { return c=integer(static_cast<int32>(GFqDom<int32>::size()));}
- 
-
-    integer cardinality() const
-      { return integer(static_cast<int32>(GFqDom<int32>::cardinality()));}
- 
-
-    /** Initialization of field base Element from an integer.
-     * Behaves like C++ allocator construct.
-     * This function assumes the output field base Element x has already been
-     * constructed, but that it is not already initialized.
-     * We assume that the type of Element is short int.
-     * this methos is just a simple cast.
-     * @return reference to field base Element.
-     * @param x field base Element to contain output (reference returned).
-     * @param y integer.
-     */  
-    Element& init(Element& x , const integer& y = 0) const
-	  { return GFqDom<int32>::init( x, int32(y % (integer) _q));}
-      
-          // TO BE OPTIMIZED
-    Element& init(Element& x , const float y) const
-      { return GFqDom<int32>::init( x, (double)y);}
-
-      template<class YYY>
-    Element& init(Element& x , const YYY& y) const
-      { return GFqDom<int32>::init( x, y);}
-
-     /** Conversion of field base Element to an integer.
-     * This function assumes the output field base Element x has already been
-     * constructed, but that it is not already initialized.
-     * @return reference to an integer.
-     * @param x integer to contain output (reference returned).
-     * @param y constant field base Element.
-     */
-    integer& convert(integer& x, const Element& y) const
-      {
-	int32 tmp;	
-	return x = integer(GFqDom<int32>::convert(tmp,y));
-      }
-          // TO BE OPTIMIZED
-    float& convert(float& x, const Element& y) const
-      {
-          double tmp;
-          GFqDom<int32>::convert( tmp, y);
-          return x = (float)tmp;
-      }
-
-      template<class XXX>
-    XXX& convert(XXX& x, const Element& y) const
-      {
-	return GFqDom<int32>::convert( x, y);
-      }
-
-    //bool isZero(const Element& x) const { return GFqDom<int32>::isZero(x); }
-
-
-  }; // class GivaroGfq
- 
 
 } // namespace LinBox
 
-#endif // __FIELD_GIVARO_GFQ
+#endif // __LINBOX_field_givaro_gfq_H
+
diff --git a/linbox/field/givaro-montg.h b/linbox/field/givaro-montg.h
index d8b7170..244c029 100644
--- a/linbox/field/givaro-montg.h
+++ b/linbox/field/givaro-montg.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/field/givaro-gfq.h
  * Copyright (C) 2004 Jean-Guillaume Dumas
  *
@@ -16,8 +16,8 @@
  * You can send me a mail to get it or for others details.
  */
 
-#ifndef __FIELD_GIVARO_MONTGOMERY
-#define __FIELD_GIVARO_MONTGOMERY
+#ifndef __LINBOX_field_givaro_montgomery_H
+#define __LINBOX_field_givaro_montgomery_H
 
 
 #include <linbox/integer.h>
@@ -35,8 +35,8 @@
 //------------------------------------
 
 // Namespace in which all LinBox code resides
-namespace LinBox 
-{ 
+namespace LinBox
+{
 
 
 	template <class Ring>
@@ -48,43 +48,44 @@ namespace LinBox
 	struct ClassifyRing<GivaroMontg> {
 		typedef RingCategories::ModularTag categoryTag;
 	};
-	/** 
-	 \brief wrapper of Givaro's Montgomery<Std32>.
+	/**
+	 \brief wrapper of Givaro's ::Givaro::Montgomery< ::Givaro::Std32>.
 	 \ingroup field
 
-	 *  This class is a modular representation with a Montgomery reduction
-	 */   
-	class GivaroMontg : public Montgomery<Std32>, public FieldInterface
-	{
- 
+	 *  This class is a modular representation with a ::Givaro::Montgomery reduction
+	 */
+	class GivaroMontg : public ::Givaro::Montgomery< ::Givaro::Std32>, public FieldInterface {
+
 	public:
 
 		/** Element type.
-		 *  This type is inherited from the Givaro class Montgomery<Std32>
+		 *  This type is inherited from the Givaro class ::Givaro::Montgomery< ::Givaro::Std32>
 		 */
-		typedef  Montgomery<Std32>::Rep Element;
-    
+		typedef  ::Givaro::Montgomery< ::Givaro::Std32>::Rep Element;
+
 		/** RandIter type
-		 *  This type is inherited from the Givaro class Montgomery<Std32>
-		 */	
-		typedef GIV_randIter< Montgomery<Std32>, LinBox::integer >  RandIter;
+		 *  This type is inherited from the Givaro class ::Givaro::Montgomery< ::Givaro::Std32>
+		 */
+		typedef ::Givaro::GIV_randIter< ::Givaro::Montgomery< ::Givaro::Std32>, LinBox::integer >  RandIter;
 
 		/** Constructor from an integer
 		 *  this constructor use the ZpzDom<TAG> constructor
 		 */
 		GivaroMontg(const integer& p) :
-			Montgomery<Std32>(static_cast<uint32>(long(p))) { }
+			::Givaro::Montgomery< ::Givaro::Std32>(static_cast<uint32_t>(long(p)))
+		{ }
 
 		/** Constructor from an integer (takes degree of extension as 2nd parameter, must be 1)
 		 *  this constructor use the ZpzDom<TAG> constructor
 		 */
 	  	GivaroMontg(const integer& p, const integer& k) :
-			Montgomery<Std32>(static_cast<uint32>(long(p))) { 
-			
+			::Givaro::Montgomery< ::Givaro::Std32>(static_cast<uint32_t>(long(p)))
+		{
+
 			if (k!=1)
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"exponent must be 1");
+				throw PreconditionFailed(__func__,__FILE__,__LINE__,"exponent must be 1");
 		}
-    
+
 		/** Characteristic.
 		 * Return integer representing characteristic of the domain.
 		 * Returns a positive integer to all domains with finite characteristic,
@@ -92,13 +93,17 @@ namespace LinBox
 		 * @return integer representing characteristic of the domain.
 		 */
 		integer& characteristic(integer& c) const
-		{return c=integer(static_cast<long>(Montgomery<Std32>::characteristic()));}
+		{
+			return c=integer(static_cast<long>(::Givaro::Montgomery< ::Givaro::Std32>::characteristic()));
+		}
 
 		long characteristic() const
-		{return static_cast<long>(Montgomery<Std32>::characteristic());}
-    
-      
-		/** Cardinality. 
+		{
+			return static_cast<long>(::Givaro::Montgomery< ::Givaro::Std32>::characteristic());
+		}
+
+
+		/** Cardinality.
 		 * Return integer representing cardinality of the domain.
 		 * Returns a non-negative integer for all domains with finite
 		 * cardinality, and returns -1 to signify a domain of infinite
@@ -106,8 +111,15 @@ namespace LinBox
 		 * @return integer representing cardinality of the domain
 		 */
 		integer& cardinality(integer& c) const
-		{ return c=integer(static_cast<long>(Montgomery<Std32>::size()));}
- 
+		{
+		       	return c=integer(static_cast<long>(::Givaro::Montgomery< ::Givaro::Std32>::size()));
+		}
+
+		long cardinality() const
+		{
+			return static_cast<long>(::Givaro::Montgomery< ::Givaro::Std32>::size());
+		}
+
 
 		/** Initialization of field base Element from an integer.
 		 * Behaves like C++ allocator construct.
@@ -118,14 +130,16 @@ namespace LinBox
 		 * @return reference to field base Element.
 		 * @param x field base Element to contain output (reference returned).
 		 * @param y integer.
-		 */  
+		 */
 		Element& init(Element& x , const integer& y=0) const
-		{ 			
-			return Montgomery<Std32>::init( x,long(y % (integer)_p));
+		{
+			return ::Givaro::Montgomery< ::Givaro::Std32>::init( x,long(y % (integer)_p));
 		}
-      
+
 		Element& init(Element& x , const double y) const
-		{ return Montgomery<Std32>::init( x, y);}
+		{
+		       	return ::Givaro::Montgomery< ::Givaro::Std32>::init( x, y);
+		}
 
 		/** Conversion of field base element to an integer.
 		 * This function assumes the output field base element x has already been
@@ -136,24 +150,30 @@ namespace LinBox
 		 */
 		integer& convert(integer& x, const Element& y) const
 		{
-			long tmp;	
-			//	return x = *(new integer(Montgomery<Std32>::convert(tmp,y)));
-			return x = integer(Montgomery<Std32>::convert(tmp,y));
+			long tmp;
+			//	return x = *(new integer(Montgomery< ::Givaro::Std32>::convert(tmp,y)));
+			return x = integer(::Givaro::Montgomery< ::Givaro::Std32>::convert(tmp,y));
 		}
+
 		double& convert(double& x, const Element& y) const
 		{
-			return Montgomery<Std32>::convert( x, y);
+			return ::Givaro::Montgomery< ::Givaro::Std32>::convert( x, y);
 		}
 
-		//bool isZero(const Element& x) const { return Montgomery<Std32>::isZero(x); }
-
+#if 0
+		bool isZero(const Element& x) const
+		{
+		       	return ::Givaro::Montgomery< ::Givaro::Std32>::isZero(x);
+		}
+#endif
 
 		static inline int getMaxModulus() { return 40504; }
 
 	}; // class GivaroMontg
- 
+
 
 
 } // namespace LinBox
 
-#endif // __FIELD_GIVARO_MONTGOMERY
+#endif // __LINBOX_field_givaro_montgomery_H
+
diff --git a/linbox/field/givaro-rational.h b/linbox/field/givaro-rational.h
index a276d9d..de21742 100644
--- a/linbox/field/givaro-rational.h
+++ b/linbox/field/givaro-rational.h
@@ -1,16 +1,16 @@
-
 /* -*- 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
 /* linbox/field/givaro-rational.h
  * Copyright (C) 2004 Gilles Villard
  *
- * Created  Gilles Villard < Gilles.Villard at ens-lyon.fr> 
+ * Created  Gilles Villard < Gilles.Villard at ens-lyon.fr>
  * ven oct  8 13:30:05 CEST 2004
+ * see COPYING for licence information
  */
 
 
-#ifndef __GIVARO_RATIONAL_H
-#define __GIVARO_RATIONAL_H
+#ifndef __LINBOX_givaro_rational_H
+#define __LINBOX_givaro_rational_H
 
 
 #include "linbox/integer.h"
@@ -25,40 +25,174 @@
 //------------------------------------
 
 
-namespace LinBox 
-{ 
+namespace LinBox
+{
 
 	template <class Ring>
-    struct ClassifyRing;
+	struct ClassifyRing;
 
-	class GivaroRational; 
-	
-	template<> 
+	class GivaroRational;
+
+	template<>
 	struct ClassifyRing<GivaroRational> {
 		typedef RingCategories::RationalTag categoryTag;
-	}; 
+	};
+
+	class GivaroRational : public UnparametricField< ::Givaro::Rational>
+	{
+
+	public:
+
+		/** Element type.
+		 *
+		 */
+		typedef  ::Givaro::Rational Element;
+
 
- class GivaroRational : public UnparametricField<Rational>
-  {
- 
-  public:
+		Element& init(Element& x , const integer& y) const
+		{
+			return x=Element(y);
+		}
 
-    /** Element type.
-     *  
-     */
-    typedef  Rational Element;
-    
+		Element& init(Element& x , const integer& n,const integer& d) const
+		{
+			return x=Element(n,d);
+		}
 
-    Element& init(Element& x , const integer& y = 0) const
-	  { return x=Rational(y);}
+		template<class XX>
+		Element& init(Element& x , const XX& y) const
+		{
+			return x=Element(y);
+		}
 
+		integer& convert(integer& i, const Element& r) const
+		{
+			return i=r.nume();
+		}
 
 
+		Element& assign(Element& x , const Element& y) const
+		{
+			return x=y;
+		}
+
+		// x = numerator of y
+		integer& get_num (integer& x, const Element& y)  const
+		{
+			return x = y.nume();
+		}
+
+		// x = denominator of y
+		integer& get_den (integer& x, const Element& y) const
+		{
+			return x = y.deno();
+		}
+
+
+	}; // class
 
-  }; // class 
- 
 
 
 } // namespace LinBox
 
-#endif // __GIVARO_RATIONAL_H
+
+// Specialization of homomorphism for basefield
+#include "linbox/field/hom.h"
+namespace LinBox
+{
+	template <class _Target>
+	class Hom<GivaroRational, _Target> {
+
+	public:
+		typedef GivaroRational Source;
+		typedef _Target Target;
+		typedef typename Source::Element SrcElt;
+		typedef typename Target::Element Elt;
+
+		Hom(const Source& S, const Target& T) :
+			_source (S), _target(T)
+		{
+}
+		Elt& image(Elt& t, const SrcElt& s)
+		{
+			_source. get_num (num, s);
+			_source. get_den (den, s);
+			if (den == 1) {
+				return _target.init(t,num);
+			}
+			else if (num == 1) {
+				_target.init(t,den);
+				return _target.invin(t);
+			}
+			else {
+				_target. init (tmp, den);
+				_target. init (t, num);
+				return _target. divin (t, tmp);
+
+}
+			// 			_target. init (t, den);
+			// 			return _target. invin (t);
+
+}
+		SrcElt& preimage(SrcElt& s, const Elt& t)
+		{
+			_target. convert (num, t);
+			_source. init (s, num);
+			return s;
+
+}
+		const Source& source() {
+return _source;
+}
+		const Target& target() {
+return _target;
+}
+
+	protected:
+		integer num, den;
+		Elt tmp;
+		Source _source;
+		Target _target;
+	}; // end Hom
+
+	template <>
+	class Hom<GivaroRational,GivaroRational> {
+
+	public:
+		typedef GivaroRational Source;
+		typedef Source Target;
+		typedef Source::Element SrcElt;
+		typedef Target::Element Elt;
+
+		Hom(const Source& S, const Target& T) :
+			_source (S), _target(T)
+		{
+}
+		Elt& image(Elt& t, const SrcElt& s) {
+			_target.assign(t, s);
+			return t;
+
+
+}
+		SrcElt& preimage(SrcElt& s, const Elt& t)
+		{
+			_source.assign(s, t);
+			return s;
+
+}
+		const Source& source() {
+return _source;
+}
+		const Target& target() {
+return _target;
+}
+
+	protected:
+		Source _source;
+		Target _target;
+	}; // end Hom
+
+}
+
+#endif // __LINBOX_givaro_rational_H
+
diff --git a/linbox/field/givaro-zpz.h b/linbox/field/givaro-zpz.h
index 0091a6d..e2bc9d9 100644
--- a/linbox/field/givaro-zpz.h
+++ b/linbox/field/givaro-zpz.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/field/givaro-zpz.h
  * Copyright (C) 2002 Pascal Giorgi
  *
@@ -16,8 +16,8 @@
  * You can send me a mail to get it or for others details.
  */
 
-#ifndef __FIELD_GIVARO_ZPZ
-#define __FIELD_GIVARO_ZPZ
+#ifndef __LINBOX_field_givaro_zpz_H
+#define __LINBOX_field_givaro_zpz_H
 
 
 #include "linbox/linbox-config.h"
@@ -27,17 +27,15 @@
 #include "linbox/vector/vector-domain.h"
 //-------------------------------------
 // Files of Givaro library
-#include <givaro/givzpz16std.h>
-#include <givaro/givzpz32std.h>
-#include <givaro/givzpz16table1.h>
+#include <givaro/givzpz.h>
 #include <givaro/giv_randiter.h>
 #include <linbox/field/field-traits.h>
 
 //--------------------------------------
 
 // Namespace in which all LinBox code resides
-namespace LinBox 
-{ 
+namespace LinBox
+{
 
 	/*  This wrappers allows to use three sorts of givaro fields :
 	 *  Elements represent by a 32 bits integer
@@ -46,107 +44,128 @@ namespace LinBox
 	 *
 	 *  To use this fields with the wrapper below just replace the template
 	 *  parameter by the Tag appropriated.
-	 *  "Std16"  for 16 bits integer
-	 *  "Std32"  for 32 bits integer
-	 *  "Log16"  for Zech log representation in 16 bits
+	 *  "Givaro::Std16"  for 16 bits integer
+	 *  "Givaro::Std32"  for 32 bits integer
+	 *  "Givaro::Log16"  for Zech log representation in 16 bits
 	 */
-        template<class Field>
-                class DotProductDomain;
-        template<class Field>
-                class FieldAXPY;
+	template<class Field>
+	class DotProductDomain;
+	template<class Field>
+	class FieldAXPY;
 
 	template <class Ring>
-    struct ClassifyRing;
+	struct ClassifyRing;
 
 	template <class TAG>
 	class GivaroZpz;
-	
-	template<class Tag> 
+
+	template<class Tag>
 	struct ClassifyRing<GivaroZpz<Tag> > {
 		typedef RingCategories::ModularTag categoryTag;
-	}; 
+	};
 
 	/** \brief wrapper of Givaro's ZpzDom.
-\ingroup field
-	
-	 *  Most methods are inherited from ZpzDom<Std16>, ZpzDom<Std32>
-	 *  and ZpzDom<log16> classes of Givaro.
+	  \ingroup field
+
+	 *  Most methods are inherited from ::Givaro::ZpzDom< ::Givaro::Std16>, ::Givaro::ZpzDom< ::Givaro::Std32>
+	 *  and ::Givaro::ZpzDom<log16> classes of Givaro.
 	 *  These classes allow to construct only finite field with a prime modulus.
-	 */   
+	 */
 
-	template <class TAG> class GivaroZpz : public ZpzDom<TAG>, public FieldInterface
+	template <class TAG> class GivaroZpz : public ::Givaro::ZpzDom<TAG>, public FieldInterface
 	{
 
 	private:
 
 		/*		friend class DotProductDomain<GivaroZpz<TAG> > ;
 				friend class FieldAXPY<GivaroZpz<TAG> >; */
-				
+
 	public:
 
 		//typedef integer Integer;
 
 		/** Element type.
-		 *  This type is inherited from the Givaro class ZpzDom<TAG>
+		 *  This type is inherited from the Givaro class ::Givaro::ZpzDom<TAG>
 		 */
-		typedef typename ZpzDom<TAG>::Rep Element;
+		typedef typename ::Givaro::ZpzDom<TAG>::Rep Element;
 
 		/** RandIter type
-		 *  This type is inherited from the Givaro class ZpzDom<TAG>
-		 */	
-		typedef GIV_randIter< ZpzDom<TAG>, integer > RandIter;
+		 *  This type is inherited from the Givaro class ::Givaro::ZpzDom<TAG>
+		 */
+		typedef ::Givaro::GIV_randIter< ::Givaro::ZpzDom<TAG>, integer > RandIter;
 
 		/** Constructor from an integer
-		 *  this constructor use the ZpzDom<TAG> constructor
+		 *  this constructor use the ::Givaro::ZpzDom<TAG> constructor
 		 */
-		GivaroZpz (const integer &p) : ZpzDom<TAG> (static_cast<typename ZpzDom<TAG>::Residu_t> (p))  {}
+		GivaroZpz (const integer &p) :
+			::Givaro::ZpzDom<TAG> (static_cast<typename ::Givaro::ZpzDom<TAG>::Residu_t> (p))
+		{}
 
 
 		/** Constructor from an integer (takes degree of extension as 2nd parameter, must be 1)
-		 *  this constructor use the ZpzDom<TAG> constructor
+		 *  this constructor use the ::Givaro::ZpzDom<TAG> constructor
 		 */
-		GivaroZpz (const integer &p, const integer& k) : ZpzDom<TAG> (static_cast<typename ZpzDom<TAG>::Residu_t> (p))  {
-			
+		GivaroZpz (const integer &p, const integer& k) :
+			::Givaro::ZpzDom<TAG> (static_cast<typename ::Givaro::ZpzDom<TAG>::Residu_t> (p))
+		{
+
 			if (k!=1)
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"exponent must be 1");
+				throw PreconditionFailed(__func__,__FILE__,__LINE__,"exponent must be 1");
 		}
 
-		/** Copy constructor
-		 * This copy constructor use the ZpzDom<TAG> copy constructor
+		/** Copy constructor.
+		 * This copy constructor use the ::Givaro::ZpzDom<TAG> copy constructor
 		 */
-		GivaroZpz (const GivaroZpz<TAG>& F) : ZpzDom<TAG> (F) {}
+		GivaroZpz (const GivaroZpz<TAG>& F) :
+			::Givaro::ZpzDom<TAG> (F)
+		{}
 
 
+#if 0
 		// Rich Seagraves 7-16-2003
 		// As is, this operator is an infinite loop
-		// By not providing an operator= in GivaroZpz, 
-		// the operator= in the base class (ZpzDom<TAG>) is called
+		// By not providing an operator= in GivaroZpz,
+		// the operator= in the base class (::Givaro::ZpzDom<TAG>) is called
 		// automatically by the rules of C++, which I'm guessing is
 		// the "Right Thing" for this operator
 		//
 		/** Operator =
-		 */
-		/*
-		       	GivaroZpz<TAG>& operator= (const GivaroZpz<TAG>& F) {
-				return (*this)=F;
-			}
 		*/
+		/*
+		   GivaroZpz<TAG>& operator= (const GivaroZpz<TAG>& F)
+		   {
+		   return (*this)=F;
+		   }
+		   */
+#endif
 
 		/** Characteristic.
-		 * Return integer representing characteristic of the domain.     
+		 * Return integer representing characteristic of the domain.
 		 * @return integer representing characteristic of the domain.
 		 */
 		integer &characteristic (integer &c) const
-			{ return c = integer (static_cast<int> (ZpzDom<TAG>::size ())); }
+		{
+		       	return c = integer (::Givaro::ZpzDom<TAG>::size ());
+		}
+
 		long characteristic() const
-			{return static_cast<int>(ZpzDom<TAG>::size());}
+		{
+			return static_cast<int>(::Givaro::ZpzDom<TAG>::size());
+		}
 
-		/** Cardinality. 
-		 * Return integer representing cardinality of the domain.     
+		/** Cardinality.
+		 * Return integer representing cardinality of the domain.
 		 * @return integer representing cardinality of the domain
 		 */
 		integer &cardinality (integer &c) const
-			{ return c = integer (static_cast<int> (ZpzDom<TAG>::size ())); }
+		{
+			return c = integer (::Givaro::ZpzDom<TAG>::size ());
+		}
+
+		integer cardinality () const
+		{
+			return integer (::Givaro::ZpzDom<TAG>::size ());
+		}
 
 		/** Conversion of field base element to an integer.
 		 * This function assumes the output field base element x has already been
@@ -156,247 +175,263 @@ namespace LinBox
 		 * @param y constant field base element.
 		 */
 		integer &convert (integer &x, const Element &y) const
-		         { return x = integer (static_cast<int> (y)); }
-		
+		{
+		       	return x = integer (y);
+		}
+
 		double &convert (double& x, const Element& y) const
-		{ return x = (double) y; }
-		
+		{
+		       	return x = static_cast<double>(y);
+		}
+
+		template<class Type>
+		Type &convert (Type& x, const Element& y) const
+		{
+		       	return x = static_cast<Type>(y);
+		}
+
 
 		/** Initialization of field base element from an integer.
 		 * Behaves like C++ allocator construct.
 		 * This function assumes the output field base element x has already been
-		 * constructed, but that it is not already initialized.     
+		 * constructed, but that it is not already initialized.
 		 * @return reference to field base element.
 		 * @param x field base element to contain output (reference returned).
 		 * @param y integer.
-		 */  
+		 */
 		Element &init (Element &x , const integer &y = 0) const
 		{
 			//
-			//	AU 28/03/07 no cast to long allows to use ZpzDom<integer> 
+			//	AU 28/03/07 no cast to long allows to use ::Givaro::ZpzDom<integer>
 			//
-			//ZpzDom<TAG>::init (x, (long) (y% integer(this->_p))); 
-			ZpzDom<TAG>::init (x, (y% integer(this->_p)));
+			//Givaro::ZpzDom<TAG>::init (x, (long) (y% integer(this->_p)));
+			::Givaro::ZpzDom<TAG>::init (x, (y% integer(this->_p)));
 			return x;
 		}
 
 
 		Element &init (Element &x , const double &y ) const
-		{ 
+		{
 			double z = fmod(y, (double) this->_p);
-		        if (z < 0) z += (double) this->_p;
+			if (z < 0) z += (double) this->_p;
 			z += 0.5;
-			return x = static_cast<long>(z); //rounds towards 0
+			return x = static_cast<Element>(z); //rounds towards 0
 		}
-			
-		static int getMaxModulus();
+
+		static uint64_t getMaxModulus();
 
 	}; // class GivaroZpz<TAG>
 
-    
-	template <> int GivaroZpz<Std32>::getMaxModulus() { return 65535; } // 2^16-1
-	template <> int GivaroZpz<Std16>::getMaxModulus() { return 255; }   // 2^8-1
-	template <> int GivaroZpz<Log16>::getMaxModulus() { return 32767; } // 2^15 - 1
- 
+
+	template <> uint64_t GivaroZpz< ::Givaro::Std32>::getMaxModulus() { return 46339; } // 2^15.5-1
+	template <> uint64_t GivaroZpz< ::Givaro::Std64>::getMaxModulus() { return 3037000499ULL; } // 2^15.5-1
+	template <> uint64_t GivaroZpz< ::Givaro::Unsigned32>::getMaxModulus() { return 65535; } // 2^16-1
+	template <> uint64_t GivaroZpz< ::Givaro::Std16>::getMaxModulus() { return 255; }   // 2^8-1
+	template <> uint64_t GivaroZpz< ::Givaro::Log16>::getMaxModulus() { return 32767; } // 2^15 - 1
+
 	/** Specialisation of the convert function for the zech log representation
-	 *	of givaro-zpz (GivaroZpz<Log16>.
-	 *  this function translates the internal representation to the real 
+	 *	of givaro-zpz (GivaroZpz< ::Givaro::Log16>.
+	 *  this function translates the internal representation to the real
 	 *	value of the element.
 	 *	This can have no sense but can be usefull
 	 *  NB : the init function for this specialisation does the same thing.
 	 *  the function transaltes the values to her internal representation.
-	 */ 
-	template <> integer& GivaroZpz<Log16>::convert(integer& x, const Element& y) const
-	{     
+	 */
+	template <> integer& GivaroZpz< ::Givaro::Log16>::convert(integer& x, const Element& y) const
+	{
 		if (y>=this->_p) return x = 0;
 		int tmp = _tab_rep2value[y];
 		return x = integer (tmp);
 	}
 
-	template <> double& GivaroZpz<Log16>::convert(double& x, const Element& y) const
+	template <> double& GivaroZpz< ::Givaro::Log16>::convert(double& x, const Element& y) const
 	{
 		if (y>=this->_p) return x = 0.0;
 		int tmp = _tab_rep2value[y];
 		return x = (double) tmp;
 	}
 
-	template <> GivaroZpz<Log16>::Element& GivaroZpz<Log16>::init(GivaroZpz<Log16>::Element& x, const double& y) const
+	template <> GivaroZpz< ::Givaro::Log16>::Element& GivaroZpz< ::Givaro::Log16>::init(GivaroZpz< ::Givaro::Log16>::Element& x, const double& y) const
 	{
 		double z = fmod(y, (double) this->_p);
 		if (z < 0) z += this->_p;
-		z += 0.5;		
+		z += 0.5;
 		return x = _tab_value2rep[static_cast<long>(z)]; //rounds towards 0
 	}
-	
-	template <> GivaroZpz<Log16>::Element& GivaroZpz<Log16>::init(GivaroZpz<Log16>::Element& x, const integer& y) const
+
+	template <> GivaroZpz< ::Givaro::Log16>::Element& GivaroZpz< ::Givaro::Log16>::init(GivaroZpz< ::Givaro::Log16>::Element& x, const integer& y) const
 	{
 		int tmp =(int) (y % (integer)this->_p);
 		if (tmp < 0 ) tmp += this->_p;
 		return x = _tab_value2rep[tmp];
 	}
 
-	/* Specialization of FieldAXPY for GivaroZpz<Std32> Field */
+	/* Specialization of FieldAXPY for GivaroZpz< ::Givaro::Std32> Field */
+
 
-	
 	template <>
-	class FieldAXPY<GivaroZpz<Std32> >
-	{
-	    public:
+	class FieldAXPY<GivaroZpz< ::Givaro::Std32> > {
+	public:
 
-		typedef GivaroZpz<Std32>::Element Element;
-		typedef GivaroZpz<Std32> Field;
+		typedef GivaroZpz< ::Givaro::Std32>::Element Element;
+		typedef GivaroZpz< ::Givaro::Std32> Field;
 
-		FieldAXPY (const Field &F) : _F (F) , Corr(uint64(-1) % (uint64)F.characteristic() +1){ _y = 0; }
-		FieldAXPY (const FieldAXPY &faxpy) : _F (faxpy._F), _y (0) , Corr(faxpy.Corr) {}
+		FieldAXPY (const Field &F) :
+			_F (F) , Corr(uint64_t(-1) % (uint64_t)F.characteristic() +1)
+		{ _y = 0; }
+		FieldAXPY (const FieldAXPY &faxpy) :
+			_F (faxpy._F), _y (0) , Corr(faxpy.Corr)
+		{}
 
-		FieldAXPY<GivaroZpz<Std32> > &operator = (const FieldAXPY &faxpy) 
-			{ _F = faxpy._F; _y = faxpy._y; Corr = faxpy.Corr; return *this; }
+		FieldAXPY<GivaroZpz< ::Givaro::Std32> > &operator = (const FieldAXPY &faxpy)
+		{ _F = faxpy._F; _y = faxpy._y; Corr = faxpy.Corr; return *this; }
 
-		inline uint64& mulacc (const Element &a, const Element &x)
+		inline uint64_t& mulacc (const Element &a, const Element &x)
 		{
-			uint64 t = (uint64) a * (uint64) x;
+			uint64_t t = (uint64_t) a * (uint64_t) x;
 			_y += t;
 			if (_y < t)
-                            return _y += Corr;
-                        else 
-                            return _y;
-                }
+				return _y += Corr;
+			else
+				return _y;
+		}
 
-		inline uint64& accumulate (const Element &t)
+		inline uint64_t& accumulate (const Element &t)
 		{
 			_y += t;
-			if (_y < (uint64)t)
-                            return _y += Corr;
-                        else 
-                            return _y;
+			if (_y < (uint64_t)t)
+				return _y += Corr;
+			else
+				return _y;
 		}
 
 		inline Element &get (Element &y) {
-			_y %= (uint64) _F.characteristic();
-			if ((int64) _y < 0) _y += _F.characteristic();
-			y = (uint32) _y;
+			_y %= (uint64_t) _F.characteristic();
+			if ((int64_t) _y < 0) _y += _F.characteristic();
+			y = (uint32_t) _y;
 			return y;
 		}
 
 		inline FieldAXPY &assign (const Element y)
-			{ _y = y; return *this; }
+		{ _y = y; return *this; }
 
 		inline void reset() {
 			_y = 0;
 		}
 
-	    private:
+	private:
 
 		Field _F;
-		uint64 _y;
-		uint64 Corr;
-	}; 
+		uint64_t _y;
+		uint64_t Corr;
+	};
 
 
 
 
-	/* Specialization of FieldAXPY for GivaroZpz<Std32> Field */
-	
+	/* Specialization of FieldAXPY for GivaroZpz< ::Givaro::Std32> Field */
+
 	template <>
-	class FieldAXPY<GivaroZpz<Std16> >
-	{
-	    public:
+	class FieldAXPY<GivaroZpz< ::Givaro::Std16> > {
+	public:
 
-		typedef GivaroZpz<Std16>::Element Element;
-		typedef GivaroZpz<Std16> Field;
+		typedef GivaroZpz< ::Givaro::Std16>::Element Element;
+		typedef GivaroZpz< ::Givaro::Std16> Field;
 
-		FieldAXPY (const Field &F) : _F (F) , Corr(uint32(-1) % (uint32)F.characteristic() +1){ _y = 0; }
-		FieldAXPY (const FieldAXPY &faxpy) : _F (faxpy._F), _y (0) , Corr(faxpy.Corr) {}
+		FieldAXPY (const Field &F) :
+			_F (F) , Corr(uint32_t(-1) % (uint32_t)F.characteristic() +1)
+		{ _y = 0; }
+		FieldAXPY (const FieldAXPY &faxpy) :
+			_F (faxpy._F), _y (0) , Corr(faxpy.Corr)
+		{}
 
-		FieldAXPY<GivaroZpz<Std16> > &operator = (const FieldAXPY &faxpy) 
-			{ _F = faxpy._F; _y = faxpy._y; Corr = faxpy.Corr; return *this; }
+		FieldAXPY<GivaroZpz< ::Givaro::Std16> > &operator = (const FieldAXPY &faxpy)
+		{ _F = faxpy._F; _y = faxpy._y; Corr = faxpy.Corr; return *this; }
 
-		inline uint32& mulacc (const Element &a, const Element &x)
+		inline uint32_t& mulacc (const Element &a, const Element &x)
 		{
-                    uint32 t = (uint32) a * (uint32) x;
+			uint32_t t = (uint32_t) a * (uint32_t) x;
 			_y += t;
 
 			if (_y < t)
-                            return _y += Corr;
-                        else
-                            return _y;
+				return _y += Corr;
+			else
+				return _y;
 		}
 
-		inline uint32& accumulate (const Element &t)
+		inline uint32_t& accumulate (const Element &t)
 		{
-                    _y += t;
+			_y += t;
 
-			if (_y < (uint32)t)
-                            return _y += Corr;
-                        else
-                            return _y;
+			if (_y < (uint32_t)t)
+				return _y += Corr;
+			else
+				return _y;
 		}
 
 		inline Element &get (Element &y) {
-			_y %= (uint32) _F.characteristic();
-			if ((int32) _y < 0) _y += _F.characteristic();
-			y = (uint16) _y;
+			_y %= (uint32_t) _F.characteristic();
+			if ((int32_t) _y < 0) _y += _F.characteristic();
+			y = (uint16_t) _y;
 			return y;
 		}
 
 		inline FieldAXPY &assign (const Element y)
-			{ _y = y; return *this; }
+		{ _y = y; return *this; }
 
 		inline void reset() {
 			_y = 0;
 		}
 
-	    private:
+	private:
 
 		Field _F;
-		uint32 _y;
-		uint32 Corr;
+		uint32_t _y;
+		uint32_t Corr;
 	};
 
 
 
-	// Specialization of DotProductDomain for GivaroZpz<Std32> field
-	
+	// Specialization of DotProductDomain for GivaroZpz< ::Givaro::Std32> field
+
 	template <>
-	class DotProductDomain<GivaroZpz<Std32> > :  private virtual VectorDomainBase<GivaroZpz<Std32> >
-	{
+	class DotProductDomain<GivaroZpz< ::Givaro::Std32> > :  private virtual VectorDomainBase<GivaroZpz< ::Givaro::Std32> > {
 
 	public:
-		
-		typedef GivaroZpz<Std32>::Element Element;
-		
-		DotProductDomain (const GivaroZpz<Std32> &F)
-			: VectorDomainBase<GivaroZpz<Std32> > (F) ,
-			  Corr(uint64(-1) % (uint64)F.characteristic() +1),
-			  Max(uint64(-1))
+
+		typedef GivaroZpz< ::Givaro::Std32>::Element Element;
+
+		DotProductDomain (const GivaroZpz< ::Givaro::Std32> &F) :
+			VectorDomainBase<GivaroZpz< ::Givaro::Std32> > (F) ,
+			Corr(uint64_t(-1) % (uint64_t)F.characteristic() +1),
+			Max(uint64_t(-1))
 		{}
-		
+
 	protected:
 		template <class Vector1, class Vector2>
 		inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const;
-		
+
 		template <class Vector1, class Vector2>
 		inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const;
-		
+
 	private:
-		uint64 Corr;
-		uint64 Max;
+		uint64_t Corr;
+		uint64_t Max;
 	};
 
-	// Specialization of DotProductDomain for GivaroZpz<Std16> field
+	// Specialization of DotProductDomain for GivaroZpz< ::Givaro::Std16> field
 
 	template <>
-	class DotProductDomain<GivaroZpz<Std16> > :  private virtual VectorDomainBase<GivaroZpz<Std16> >
-	{
-		
+	class DotProductDomain<GivaroZpz< ::Givaro::Std16> > :  private virtual VectorDomainBase<GivaroZpz< ::Givaro::Std16> > {
+
 	public:
 
-		typedef GivaroZpz<Std16>::Element Element;
+		typedef GivaroZpz< ::Givaro::Std16>::Element Element;
 
-		DotProductDomain (const GivaroZpz<Std16> &F)
-			:  VectorDomainBase<GivaroZpz<Std16> > (F) ,
-			   Corr(uint32(-1) % (uint32)F.characteristic() +1),
-			   Max(uint32(-1))
+		DotProductDomain (const GivaroZpz< ::Givaro::Std16> &F) :
+			VectorDomainBase<GivaroZpz< ::Givaro::Std16> > (F) ,
+			Corr(uint32_t(-1) % (uint32_t)F.characteristic() +1),
+			Max(uint32_t(-1))
 		{}
 
 	protected:
@@ -405,14 +440,15 @@ namespace LinBox
 
 		template <class Vector1, class Vector2>
 		inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const;
-	
+
 	private:
-		uint32 Corr;
-		uint32 Max;
-};
-		
+		uint32_t Corr;
+		uint32_t Max;
+	};
+
 } // namespace LinBox
 
 #include "linbox/field/givaro-zpz.inl"
 
-#endif // __FIELD_GIVARO_ZPZ
+#endif // __LINBOX_field_givaro_zpz_H
+
diff --git a/linbox/field/givaro-zpz.inl b/linbox/field/givaro-zpz.inl
index e876c30..fad0af3 100644
--- a/linbox/field/givaro-zpz.inl
+++ b/linbox/field/givaro-zpz.inl
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/field/givaro-zpz.inl
  * Written by Pascal Giorgi <pascal.giorgi at ens-lyon.fr>
  *
@@ -11,245 +11,247 @@
 
 
 
-#ifndef __GIVARO_ZPZ_INL 
-#define __GIVARO_ZPZ_INL
+#ifndef __LINBOX_givaro_zpz_INL
+#define __LINBOX_givaro_zpz_INL
 
 
 #include <iostream>
 #include "linbox/integer.h"
 
-namespace LinBox {
+namespace LinBox
+{
 
 
 
-template <class Vector1, class Vector2>
-inline GivaroZpz<Std32>::Element &DotProductDomain<GivaroZpz<Std32> >::dotSpecializedDD
-	(GivaroZpz<Std32>::Element &res, const Vector1 &v1, const Vector2 &v2) const
-{
-        uint64 inter,best ;
-	inter=best=0;
-	if (v1.size()==0) return res=GivaroZpz<Std32>::Element(0);
-	else {
-
-		uint64 size      = v1.size();
-		uint64 min       = Max / (Corr+ (uint64)(_F.characteristic()-1)*(uint64)(_F.characteristic()-1));
-		uint64 min_size  =  (size < min ? size : min);
-		uint64 good1     = (size > min_size ?  size - min_size: 0);
-		uint64 good2     = (long)(size / min_size)* min_size ;
-		uint64 good_size = (good1 > good2 ? good1 : good2 );
-		
-		typename Vector1::const_iterator i=v1.begin();
-		typename Vector2::const_iterator j=v2.begin();
-		
-		unsigned long k=0;
-		
-		for (;k<min_size;i++,j++,k++) 
-			best+=(uint64)*i * (uint64)*j;
-		
-		for (inter=best;k<good_size;inter=best) {
-			for (unsigned long l=0;l<min_size;i++,j++,k++,l++)
-				best+= (uint64)*i * (uint64)*j;
-			if (inter > best) best+=Corr;	
+	template <class Vector1, class Vector2>
+	inline GivaroZpz< ::Givaro::Std32>::Element &DotProductDomain<GivaroZpz< ::Givaro::Std32> >::dotSpecializedDD
+	(GivaroZpz< ::Givaro::Std32>::Element &res, const Vector1 &v1, const Vector2 &v2) const
+	{
+		uint64_t inter,best ;
+		inter=best=0;
+		if (v1.size()==0) return res=GivaroZpz< ::Givaro::Std32>::Element(0);
+		else {
+
+			uint64_t size      = v1.size();
+			uint64_t min       = Max / (Corr+ (uint64_t)(_F.characteristic()-1)*(uint64_t)(_F.characteristic()-1));
+			uint64_t min_size  =  (size < min ? size : min);
+			uint64_t good1     = (size > min_size ?  size - min_size: 0);
+			uint64_t good2     = (long)(size / min_size)* min_size ;
+			uint64_t good_size = (good1 > good2 ? good1 : good2 );
+
+			typename Vector1::const_iterator i=v1.begin();
+			typename Vector2::const_iterator j=v2.begin();
+
+			unsigned long k=0;
+
+			for (;k<min_size;i++,j++,k++)
+				best+=(uint64_t)*i * (uint64_t)*j;
+
+			for (inter=best;k<good_size;inter=best) {
+				for (unsigned long l=0;l<min_size;i++,j++,k++,l++)
+					best+= (uint64_t)*i * (uint64_t)*j;
+				if (inter > best) best+=Corr;
+			}
+
+			for (;k<size;i++,j++,k++)
+				best+= (uint64_t)*i * (uint64_t)*j;
+			if (inter > best) best+=Corr;
+
+
+			return res =  best % (uint64_t)_F.characteristic();
 		}
-		
-		for (;k<size;i++,j++,k++)
-			best+= (uint64)*i * (uint64)*j;
-		if (inter > best) best+=Corr;
-		
-	
-		return res =  best % (uint64)_F.characteristic();
 	}
-}
 
-template <class Vector1, class Vector2>
-inline GivaroZpz<Std32>::Element &DotProductDomain<GivaroZpz<Std32> >::dotSpecializedDSP
-	(GivaroZpz<Std32>::Element &res, const Vector1 &v1, const Vector2 &v2) const
-{
-	uint64 inter,best ;
-	inter=best=0;
-	if ((v1.first).size()== 0) 
-		return res=GivaroZpz<Std32>::Element(0);
-	else {
-		uint64 size      = (v1.first).size();
-		uint64 min       = Max / (Corr+ (uint64)(_F.characteristic()-1)*(uint64)(_F.characteristic()-1));
-		uint64 min_size  =  (size < min ? size : min);
-		uint64 good1     = (size > min_size ?  size - min_size: 0);
-		uint64 good2     = (long)(size / min_size)* min_size ;
-		uint64 good_size = (good1 > good2 ? good1 : good2 );
-	
-		typename Vector1::first_type::const_iterator i_idx  =  v1.first.begin ();
-		typename Vector1::second_type::const_iterator i_elt =  v1.second.begin ();
-		
-		unsigned long k=0;
-		
-		for (;k<min_size;i_idx++,i_elt++,k++) 
-			best+=(uint64)*i_elt * (uint64)v2[*i_idx];
-		
-		for (inter=best;k<good_size;inter=best) {
-			for (unsigned long l=0;l<min_size;i_idx++,i_elt++,k++,l++)
-				best+= (uint64)*i_elt * (uint64)v2[*i_idx];
-			if (inter > best) best+=Corr;	
+	template <class Vector1, class Vector2>
+	inline GivaroZpz< ::Givaro::Std32>::Element &DotProductDomain<GivaroZpz< ::Givaro::Std32> >::dotSpecializedDSP
+	(GivaroZpz< ::Givaro::Std32>::Element &res, const Vector1 &v1, const Vector2 &v2) const
+	{
+		uint64_t inter,best ;
+		inter=best=0;
+		if ((v1.first).size()== 0)
+			return res=GivaroZpz< ::Givaro::Std32>::Element(0);
+		else {
+			uint64_t size      = (v1.first).size();
+			uint64_t min       = Max / (Corr+ (uint64_t)(_F.characteristic()-1)*(uint64_t)(_F.characteristic()-1));
+			uint64_t min_size  =  (size < min ? size : min);
+			uint64_t good1     = (size > min_size ?  size - min_size: 0);
+			uint64_t good2     = (long)(size / min_size)* min_size ;
+			uint64_t good_size = (good1 > good2 ? good1 : good2 );
+
+			typename Vector1::first_type::const_iterator i_idx  =  v1.first.begin ();
+			typename Vector1::second_type::const_iterator i_elt =  v1.second.begin ();
+
+			unsigned long k=0;
+
+			for (;k<min_size;i_idx++,i_elt++,k++)
+				best+=(uint64_t)*i_elt * (uint64_t)v2[*i_idx];
+
+			for (inter=best;k<good_size;inter=best) {
+				for (unsigned long l=0;l<min_size;i_idx++,i_elt++,k++,l++)
+					best+= (uint64_t)*i_elt * (uint64_t)v2[*i_idx];
+				if (inter > best) best+=Corr;
+			}
+
+			for (;k<size;i_idx++,i_elt++,k++)
+				best+= (uint64_t)*i_elt * (uint64_t)v2[*i_idx];
+			if (inter > best) best+=Corr;
+
+			return res =  best % _F.characteristic();
 		}
-		
-		for (;k<size;i_idx++,i_elt++,k++)
-			best+= (uint64)*i_elt * (uint64)v2[*i_idx];
-		if (inter > best) best+=Corr;
-		
-		return res =  best % _F.characteristic();
 	}
-}
 
 
 
-template <class Vector1, class Vector2>
-inline GivaroZpz<Std16>::Element &DotProductDomain<GivaroZpz<Std16> >::dotSpecializedDD
-	(GivaroZpz<Std16>::Element &res, const Vector1 &v1, const Vector2 &v2) const
-{
-        uint32 inter,best ;
-	inter=best=0;
-	if (v1.size() == 0)
-		return  res=GivaroZpz<Std16>::Element(0);
-	else {
-		uint32 size      = v1.size();
-		uint32 min       = Max / (Corr+ ((uint32)_F.characteristic()-1)*(uint32)(_F.characteristic()-1));
-		uint32 min_size  =  (size < min ? size : min);
-		uint32 good1     = (size > min_size ?  size - min_size: 0);
-		uint32 good2     = (long)(size / min_size)* min_size ;
-		uint32 good_size = (good1 > good2 ? good1 : good2 );
-		
-		
-		typename Vector1::const_iterator i=v1.begin();
-		typename Vector2::const_iterator j=v2.begin();
-		
-		uint32 k=0;
-		
-		for (;k<min_size;i++,j++,k++) 
-			best+=(uint32)*i * (uint32)*j;
-		
-		for (inter=best;k<good_size;inter=best) {
-			for (unsigned long l=0;l<min_size;i++,j++,k++,l++)
-				best+= (uint32)*i * (uint32)*j;
-			if (inter > best) best+=Corr;	
+	template <class Vector1, class Vector2>
+	inline GivaroZpz< ::Givaro::Std16>::Element &DotProductDomain<GivaroZpz< ::Givaro::Std16> >::dotSpecializedDD
+	(GivaroZpz< ::Givaro::Std16>::Element &res, const Vector1 &v1, const Vector2 &v2) const
+	{
+		uint32_t inter,best ;
+		inter=best=0;
+		if (v1.size() == 0)
+			return  res=GivaroZpz< ::Givaro::Std16>::Element(0);
+		else {
+			uint32_t size      = v1.size();
+			uint32_t min       = Max / (Corr+ ((uint32_t)_F.characteristic()-1)*(uint32_t)(_F.characteristic()-1));
+			uint32_t min_size  =  (size < min ? size : min);
+			uint32_t good1     = (size > min_size ?  size - min_size: 0);
+			uint32_t good2     = (long)(size / min_size)* min_size ;
+			uint32_t good_size = (good1 > good2 ? good1 : good2 );
+
+
+			typename Vector1::const_iterator i=v1.begin();
+			typename Vector2::const_iterator j=v2.begin();
+
+			uint32_t k=0;
+
+			for (;k<min_size;i++,j++,k++)
+				best+=(uint32_t)*i * (uint32_t)*j;
+
+			for (inter=best;k<good_size;inter=best) {
+				for (unsigned long l=0;l<min_size;i++,j++,k++,l++)
+					best+= (uint32_t)*i * (uint32_t)*j;
+				if (inter > best) best+=Corr;
+			}
+
+			for (;k<size;i++,j++,k++)
+				best+= (uint32_t)*i * (uint32_t)*j;
+			if (inter > best) best+=Corr;
+
+			return res = best % (uint32_t)_F.characteristic();
 		}
-		
-		for (;k<size;i++,j++,k++)
-			best+= (uint32)*i * (uint32)*j;
-		if (inter > best) best+=Corr;
-		
-		return res = best % (uint32)_F.characteristic();
 	}
-}
 
-template <class Vector1, class Vector2>
-inline GivaroZpz<Std16>::Element &DotProductDomain<GivaroZpz<Std16> >::dotSpecializedDSP
-	(GivaroZpz<Std16>::Element &res, const Vector1 &v1, const Vector2 &v2) const
-{
-	uint32 inter,best ;
-	inter=best=0;
-	if ((v1.first).size()==0)
-		return  res=GivaroZpz<Std16>::Element(0);
-	else {
-		uint32 size      = (v1.first).size();
-		uint32 min       = Max / (Corr+ (uint32)(_F.characteristic()-1)*(uint32)(_F.characteristic()-1));
-		uint32 min_size  =  (size < min ? size : min);
-		uint32 good1     = (size > min_size ?  size - min_size: 0);
-		uint32 good2     = (long)(size / min_size)* min_size ;
-		uint32 good_size = (good1 > good2 ? good1 : good2 );
-		
-		typename Vector1::first_type::const_iterator i_idx  =  v1.first.begin ();
-		typename Vector1::second_type::const_iterator i_elt =  v1.second.begin ();
-		uint32 k=0;
-		
-		for (;k<min_size;i_idx++,i_elt++,k++) 
-			best+=(uint32)*i_elt * (uint32)v2[*i_idx];
-		
-		for (inter=best;k<good_size;inter=best) {
-			for (unsigned long l=0;l<min_size;i_idx++,i_elt++,k++,l++)
-				best+= (uint32)*i_elt * (uint32)v2[*i_idx];
-			if (inter > best) best+=Corr;	
+	template <class Vector1, class Vector2>
+	inline GivaroZpz< ::Givaro::Std16>::Element &DotProductDomain<GivaroZpz< ::Givaro::Std16> >::dotSpecializedDSP
+	(GivaroZpz< ::Givaro::Std16>::Element &res, const Vector1 &v1, const Vector2 &v2) const
+	{
+		uint32_t inter,best ;
+		inter=best=0;
+		if ((v1.first).size()==0)
+			return  res=GivaroZpz< ::Givaro::Std16>::Element(0);
+		else {
+			uint32_t size      = (v1.first).size();
+			uint32_t min       = Max / (Corr+ (uint32_t)(_F.characteristic()-1)*(uint32_t)(_F.characteristic()-1));
+			uint32_t min_size  =  (size < min ? size : min);
+			uint32_t good1     = (size > min_size ?  size - min_size: 0);
+			uint32_t good2     = (long)(size / min_size)* min_size ;
+			uint32_t good_size = (good1 > good2 ? good1 : good2 );
+
+			typename Vector1::first_type::const_iterator i_idx  =  v1.first.begin ();
+			typename Vector1::second_type::const_iterator i_elt =  v1.second.begin ();
+			uint32_t k=0;
+
+			for (;k<min_size;i_idx++,i_elt++,k++)
+				best+=(uint32_t)*i_elt * (uint32_t)v2[*i_idx];
+
+			for (inter=best;k<good_size;inter=best) {
+				for (unsigned long l=0;l<min_size;i_idx++,i_elt++,k++,l++)
+					best+= (uint32_t)*i_elt * (uint32_t)v2[*i_idx];
+				if (inter > best) best+=Corr;
+			}
+
+			for (;k<size;i_idx++,i_elt++,k++)
+				best+= (uint32_t)*i_elt * (uint32_t)v2[*i_idx];
+			if (inter > best) best+=Corr;
+
+			return res =  best % (uint32_t)_F.characteristic();
 		}
-		
-		for (;k<size;i_idx++,i_elt++,k++)
-		best+= (uint32)*i_elt * (uint32)v2[*i_idx];
-		if (inter > best) best+=Corr;
-		
-		return res =  best % (uint32)_F.characteristic();
 	}
-}
 
 
 #ifdef XMLENABLED
 
-template<>
-bool GivaroZpz<Std16>::toTag(Writer &W) const
-{
-	string s;
-	int16 m = ZpzDom<Std16>::residu();
+	template<>
+	bool GivaroZpz< ::Givaro::Std16>::toTag(Writer &W) const
+	{
+		string s;
+		int16_t m = ZpzDom< ::Givaro::Std16>::residu();
 
-	W.setTagName("field");
-	W.setAttribute("implDetail", "givaro-zpz-std16");
-	W.setAttribute("cardinality", Writer::numToString(s, m));
+		W.setTagName("field");
+		W.setAttribute("implDetail", "givaro-zpz-std16");
+		W.setAttribute("cardinality", Writer::numToString(s, m));
 
-	W.addTagChild();
-	W.setTagName("finite");
+		W.addTagChild();
+		W.setTagName("finite");
 
-	W.addTagChild();
-	W.setTagName("characteristic");
-	W.addNum(m);
-	W.upToParent();
-	W.upToParent();
+		W.addTagChild();
+		W.setTagName("characteristic");
+		W.addNum(m);
+		W.upToParent();
+		W.upToParent();
 
-	return true;
-}
+		return true;
+	}
 
-template <>
-bool GivaroZpz<Std32>::toTag(Writer &W) const
-{
-	string s;
-	int32 m = ZpzDom<Std32>::residu();
+	template <>
+	bool GivaroZpz< ::Givaro::Std32>::toTag(Writer &W) const
+	{
+		string s;
+		int32_t m = ZpzDom< ::Givaro::Std32>::residu();
 
-	W.setTagName("field");
-	W.setAttribute("implDetail", "givaro-zpz-std32");
-	W.setAttribute("cardinality", Writer::numToString(s, m));
+		W.setTagName("field");
+		W.setAttribute("implDetail", "givaro-zpz-std32");
+		W.setAttribute("cardinality", Writer::numToString(s, m));
 
-	W.addTagChild();
-	W.setTagName("finite");
+		W.addTagChild();
+		W.setTagName("finite");
 
-	W.addTagChild();
-	W.setTagName("characteristic");
-	W.addNum(m);
-	W.upToParent();
+		W.addTagChild();
+		W.setTagName("characteristic");
+		W.addNum(m);
+		W.upToParent();
 
-	W.upToParent();
+		W.upToParent();
 
-	return true;
-}
+		return true;
+	}
 
-template <>
-bool GivaroZpz<Log16>::toTag(Writer &W) const
-{
-	string s;
-	int16 m = ZpzDom<Log16>::residu();
+	template <>
+	bool GivaroZpz<Log16>::toTag(Writer &W) const
+	{
+		string s;
+		int16_t m = ZpzDom<Log16>::residu();
 
-	W.setTagName("field");
-	W.setAttribute("implDetail", "givaro-zpz-log16");
-	W.setAttribute("cardinality", Writer::numToString(s, m));
+		W.setTagName("field");
+		W.setAttribute("implDetail", "givaro-zpz-log16");
+		W.setAttribute("cardinality", Writer::numToString(s, m));
 
-	W.addTagChild();
-	W.setTagName("finite");
+		W.addTagChild();
+		W.setTagName("finite");
 
-	W.addTagChild();
-	W.setTagName("characteristic");
-	W.addNum(m);
-	W.upToParent();
+		W.addTagChild();
+		W.setTagName("characteristic");
+		W.addNum(m);
+		W.upToParent();
 
-	W.upToParent();
+		W.upToParent();
 
-	return true;
-}
+		return true;
+	}
 #endif
 
 
 }
 
-#endif
+#endif //__LINBOX_givaro_zpz_INL
+
diff --git a/linbox/field/givaro.h b/linbox/field/givaro.h
index a1aef4d..4d4f735 100644
--- a/linbox/field/givaro.h
+++ b/linbox/field/givaro.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/field/givaro.h
  * Copyright (C) 2002 Pascal Giorgi
  *
@@ -8,8 +8,8 @@
  * See COPYING for license information.
  */
 
-#ifndef __FIELD_GIVARO_H
-#define __FIELD_GIVARO_H
+#ifndef __LINBOX_field_givaro_H
+#define __LINBOX_field_givaro_H
 
 #include <linbox/field/field-traits.h>
 #include "linbox/field/givaro-zpz.h"
@@ -17,4 +17,5 @@
 #include "linbox/field/givaro-gfq.h"
 #include "linbox/field/givaro-extension.h"
 
-#endif // __FIELD_GIVARO_H
+#endif // __LINBOX_field_givaro_H
+
diff --git a/linbox/field/gmp-rational.h b/linbox/field/gmp-rational.h
index 7736f16..ecb3e26 100644
--- a/linbox/field/gmp-rational.h
+++ b/linbox/field/gmp-rational.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/field/gmp-rational.h
  * Copyright (C) 2001, 2002 Bradford Hovinen
  *
@@ -10,8 +10,8 @@
  * See COPYING for license information
  */
 
-#ifndef __FIELD_GMP_RATIONAL_H
-#define __FIELD_GMP_RATIONAL_H
+#ifndef __LINBOX_field_gmp_rational_H
+#define __LINBOX_field_gmp_rational_H
 
 #include <iostream>
 #include <cctype>
@@ -29,632 +29,755 @@
 namespace LinBox
 {
 
-// Forward declarations
-class GMPRationalRandIter;;
-
-/**
- * \brief Field of rational numbers using GMP
- \ingroup field
- *
- * This is a wrapper for the GMP rational number facility, built to the
- * interface of the field archetype. 
- */
-
-template <class Ring>
-struct ClassifyRing;
+	// Forward declarations
+	class GMPRationalRandIter;;
 
-class GMPRationalField;
-
-template<>
-struct ClassifyRing<GMPRationalField> {
-	typedef RingCategories::RationalTag categoryTag;
-};
-
-class GMPRationalField : public FieldInterface
-{
-    private:
+	/**
+	 * \brief Field of rational numbers using GMP
+	 \ingroup field
+	 *
+	 * This is a wrapper for the GMP rational number facility, built to the
+	 * interface of the field archetype.
+	 */
 
-	const integer _cardinality;
-	const integer _characteristic;
+	template <class Ring>
+	struct ClassifyRing;
+
+	class GMPRationalField;
+
+	template<>
+	struct ClassifyRing<GMPRationalField> {
+		typedef RingCategories::RationalTag categoryTag;
+	};
+
+	class GMPRationalField : public FieldInterface {
+	private:
+
+		const integer _cardinality;
+		const integer _characteristic;
+
+		const integer _zero;
+		const integer _one;
+		const integer _neg_one;
+
+	public:
+
+		/** @name Common Object Interface for a LinBox Field.
+		 * These methods are required of all \ref LinBox fields.
+		 */
+		//@{
+
+		/// element type.
+		typedef GMPRationalElement Element;
+
+		/// Random iterator generator type.
+		typedef GMPRationalRandIter RandIter;
+
+		const Element zero;
+		const Element one;
+		const Element neg_one;
+
+		/** @name Object Management
+		 * x <- convert (y)
+		 */
+		//@{
+
+		/** Copy constructor.
+		 *
+		 * Vacuous, since this field is unparametric so there is no need to
+		 * construct multiple field objects
+		 */
+
+		GMPRationalField (const GMPRationalField &) :
+			_cardinality (0), _characteristic (0), _zero (0), _one (1), _neg_one (-1),
+			zero (_zero, _one), one (_one, _one), neg_one (_neg_one, _one)
+		{}
+
+		/** Destructor.
+		 *
+		 * Also vacuous, since there is no de-initialization system
+		 */
+		~GMPRationalField (void)
+		{}
+
+		/** Assignment operator.
+		 *
+		 * Also vacuous
+		 */
+		GMPRationalField &operator= (const GMPRationalField &)
+		{
+			return *this;
+		}
 
-	const integer _zero;
-	const integer _one;
-	const integer _neg_one;
+		/** Initialization of field element from an integer.
+		 * Behaves like C++ allocator construct.
+		 * This function assumes the output field element x has already been
+		 * constructed, but that it is not necessarily already initialized.
+		 * In this implementation, this means the _elem_ptr of x exists, but
+		 * that it may be the null pointer.
+		 * @return reference to field element.
+		 * @param x field element to contain output (reference returned).
+		 * @param y constant reference to integer.
+		 */
+		Element &init (Element &x, const integer &y = 0) const
+		{
+			mpq_set_z (x. rep, SpyInteger::get_mpz(const_cast<integer&>(y)));
+			//mpq_set_si (x.rep, (signed long) y, 1L);
+			//mpq_canonicalize (x.rep);
+			return x;
+		}
 
-    public:
+		/*
+		 * aniau at astronet.pl: 06/2009 Initialization of field element from numerator and denominator
+		 * */
+		Element &init (Element &x, const integer &num, const integer &den) const
+		{
+			init(x,num);
+			Element y;
+			init(y,den);
+			divin(x,y);
+			return x;
+		}
 
-	/** @name Common Object Interface for a LinBox Field.
-	 * These methods are required of all \ref{LinBox} fields.
-	 */
-	//@{
-    
-	/// element type.
-	typedef GMPRationalElement Element;
-
-	/// Random iterator generator type.
-	typedef GMPRationalRandIter RandIter;
-    
-	const Element zero;
-	const Element one;
-	const Element neg_one;
-
-	/** @name Object Management
-	 * x <- convert (y)
-	 */
-	//@{
-    
-	/** Copy constructor.
-	 *
-	 * Vacuous, since this field is unparametric so there is no need to
-	 * construct multiple field objects
-	 */
+		/** Conversion of field element to an integer.
+		 * This function assumes the output field element x has already been
+		 * constructed, but that it is not already initialized.
+		 * In this implementation, this means the _elem_ptr of y exists, and
+		 * that it is not the null pointer.
+		 *
+		 * Returns floor (numerator (y) / denominator (y))
+		 *
+		 * @return reference to integer.
+		 * @param x reference to integer to contain output (reference returned).
+		 * @param y constant reference to field element.
+		 */
+		integer &convert (integer &x, const Element &y = 0) const
+		{
+			mpz_t n, d;
+
+			mpz_init (n);
+			mpz_init (d);
+			mpq_get_num (n, y.rep);
+			mpq_get_den (d, y.rep);
+
+			mpz_divexact (x.get_mpz(), n, d);
+
+			mpz_clear (n);
+			mpz_clear (d);
+
+			/* Shouldn't there be something like this? We'll assume integer is gmp integers.
+			   x.set_mpz(n);
+			   */
+#if 0
+			x = integer::zero;
+
+			// Really bad, but I know of no other general way to do this
+			while (mpz_sgn (n) != 0) {
+				// We need to be ready for multiple word sizes and so on here...
+				x = (x << (sizeof (unsigned long) << 3)) + mpz_get_ui (n);
+				mpz_tdiv_q_2exp (n, n, sizeof (unsigned long) << 3);
+			}
+#endif
+
+			return x;
+		}
 
-	GMPRationalField (const GMPRationalField &F) 
-		: _cardinality (0), _characteristic (0), _zero (0), _one (1), _neg_one (-1),
-		  zero (_zero, _one), one (_one, _one), neg_one (_neg_one, _one)
-	{}
+		/** Assignment of one field element to another.
+		 * This function assumes both field elements have already been
+		 * constructed and initialized.
+		 * In this implementation, this means for both x and y,
+		 * _elem_ptr exists and does not point to null.
+		 * @return reference to x
+		 * @param  x field element (reference returned).
+		 * @param  y field element.
+		 *
+		 * FIXME: Is this x := y? I am assuming so.
+		 */
+		Element &assign (Element &x, const Element &y) const
+		{
+			mpq_set (x.rep, y.rep);
+			return x;
+		}
 
-	/** Destructor.
-	 * 
-	 * Also vacuous, since there is no de-initialization system
-	 */
-	~GMPRationalField (void) 
-	{}
-    
-	/** Assignment operator.
-	 * 
-	 * Also vacuous
-	 */
-	GMPRationalField &operator= (const GMPRationalField &F)
-	{ return *this; }
-    
-	/** Initialization of field element from an integer.
-	 * Behaves like C++ allocator construct.
-	 * This function assumes the output field element x has already been 
-	 * constructed, but that it is not necessarily already initialized.
-	 * In this implementation, this means the _elem_ptr of x exists, but
-	 * that it may be the null pointer.
-	 * @return reference to field element.
-	 * @param x field element to contain output (reference returned).
-	 * @param y constant reference to integer.
-	 */
-	Element &init (Element &x, const integer &y = 0) const
-	{
-		mpq_set_z (x. rep, SpyInteger::get_mpz(const_cast<integer&>(y)));
-		//mpq_set_si (x.rep, (signed long) y, 1L);
-		//mpq_canonicalize (x.rep);
-		return x;
-	}
-  
-	/** Conversion of field element to an integer.
-	 * This function assumes the output field element x has already been 
-	 * constructed, but that it is not already initialized.
-	 * In this implementation, this means the _elem_ptr of y exists, and
-	 * that it is not the null pointer.
-	 *
-	 * Returns floor (numerator (y) / denominator (y))
-	 *
-	 * @return reference to integer.
-	 * @param x reference to integer to contain output (reference returned).
-	 * @param y constant reference to field element.
-	 */
-	integer &convert (integer &x, const Element &y = 0) const
-	{
-		mpz_t n, d;
+		/// is infinite (signified by -1 here)
+		integer &cardinality (integer &c) const
+		{
+			return c = _cardinality;
+		}
 
-		mpz_init (n);
-		mpz_init (d);
-		mpq_get_num (n, y.rep);
-		mpq_get_den (d, y.rep);
+		/// of the rationals is 0.
+		integer &characteristic (integer &c) const
+		{
+			return c = _characteristic;
+		}
 
-		mpz_divexact (x.get_mpz(), n, d);
+		integer cardinality () const
+		{
+			return _cardinality ;
+		}
 
-		/* Shouldn't there be something like this? We'll assume integer is gmp integers.
-		x.set_mpz(n);
-		*/
-// 		x = integer::zero;
+		integer characteristic () const
+		{
+			return _characteristic ;
+		}
 
-// 		// Really bad, but I know of no other general way to do this
-// 		while (mpz_sgn (n) != 0) {
-// 			// We need to be ready for multiple word sizes and so on here...
-// 			x = (x << (sizeof (unsigned long) << 3)) + mpz_get_ui (n);
-// 			mpz_tdiv_q_2exp (n, n, sizeof (unsigned long) << 3);
-// 		}
+		//@} Object Management
+
+		/** @name Arithmetic Operations
+		 * x <- y op z; x <- op y
+		 * These operations require all elements, including x, to be initialized
+		 * before the operation is called.  Uninitialized field elements will
+		 * give undefined results.
+		 */
+		//@{
+
+		/** Equality of two elements.
+		 * This function assumes both field elements have already been
+		 * constructed and initialized.
+		 * In this implementation, this means for both x and y,
+		 * _elem_ptr exists and does not point to null.
+		 * @return boolean true if equal, false if not.
+		 * @param  x field element
+		 * @param  y field element
+		 */
+		bool areEqual (const Element &x, const Element &y) const
+		{ return mpq_equal (x.rep, y.rep); }
+
+		/** Addition.
+		 * x = y + z
+		 * This function assumes all the field elements have already been
+		 * constructed and initialized.
+		 * In this implementation, this means for x, y, and z,
+		 * _elem_ptr exists and does not point to null.
+		 * @return reference to x.
+		 * @param  x field element (reference returned).
+		 * @param  y field element.
+		 * @param  z field element.
+		 */
+		Element &add (Element &x, const Element &y, const Element &z) const
+		{
+			mpq_add (x.rep, y.rep, z.rep);
+			return x;
+		}
 
-		return x;
-	}
-    
-	/** Assignment of one field element to another.
-	 * This function assumes both field elements have already been 
-	 * constructed and initialized.
-	 * In this implementation, this means for both x and y, 
-	 * _elem_ptr exists and does not point to null.
-	 * @return reference to x
-	 * @param  x field element (reference returned).
-	 * @param  y field element.
-	 *
-	 * FIXME: Is this x := y? I am assuming so.
-	 */
-	Element &assign (Element &x, const Element &y) const
-	{
-		mpq_set (x.rep, y.rep);
-		return x;
-	}
-    
-	/// is infinite (signified by -1 here)
-	integer &cardinality (integer &c) const 
-	{ return c = _cardinality; }
-
-	/// of the rationals is 0.
-	integer &characteristic (integer &c) const
-	{ return c = _characteristic; }
-
-	//@} Object Management
-
-	/** @name Arithmetic Operations 
-	 * x <- y op z; x <- op y
-	 * These operations require all elements, including x, to be initialized
-	 * before the operation is called.  Uninitialized field elements will
-	 * give undefined results.
-	 */
-	//@{
-
-	/** Equality of two elements.
-	 * This function assumes both field elements have already been 
-	 * constructed and initialized.
-	 * In this implementation, this means for both x and y, 
-	 * _elem_ptr exists and does not point to null.
-	 * @return boolean true if equal, false if not.
-	 * @param  x field element
-	 * @param  y field element
-	 */
-	bool areEqual (const Element &x, const Element &y) const
-	{ return mpq_equal (x.rep, y.rep); }
-
-	/** Addition.
-	 * x = y + z
-	 * This function assumes all the field elements have already been 
-	 * constructed and initialized.
-	 * In this implementation, this means for x, y, and z, 
-	 * _elem_ptr exists and does not point to null.
-	 * @return reference to x.
-	 * @param  x field element (reference returned).
-	 * @param  y field element.
-	 * @param  z field element.
-	 */
-	Element &add (Element &x, const Element &y, const Element &z) const
-	{
-		mpq_add (x.rep, y.rep, z.rep);
-		return x;
-	}
-    
-	/** Subtraction.
-	 * x = y - z
-	 * This function assumes all the field elements have already been 
-	 * constructed and initialized.
-	 * In this implementation, this means for x, y, and z, 
-	 * _elem_ptr exists and does not point to null.
-	 * @return reference to x.
-	 * @param  x field element (reference returned).
-	 * @param  y field element.
-	 * @param  z field element.
-	 */
-	Element &sub (Element &x, const Element &y, const Element &z) const
-	{
-		mpq_sub (x.rep, y.rep, z.rep);
-		return x;
-	}
-    
-	/** Multiplication.
-	 * x = y * z
-	 * This function assumes all the field elements have already been 
-	 * constructed and initialized.
-	 * In this implementation, this means for x, y, and z, 
-	 * _elem_ptr exists and does not point to null.
-	 * @return reference to x.
-	 * @param  x field element (reference returned).
-	 * @param  y field element.
-	 * @param  z field element.
-	 */
-	Element &mul (Element &x, const Element &y, const Element &z) const
-	{
-		mpq_mul (x.rep, y.rep, z.rep);
-		return x;
-	}
-    
-	/** Division.
-	 * x = y / z
-	 * This function assumes all the field elements have already been 
-	 * constructed and initialized.
-	 * In this implementation, this means for x, y, and z, 
-	 * _elem_ptr exists and does not point to null.
-	 * @return reference to x.
-	 * @param  x field element (reference returned).
-	 * @param  y field element.
-	 * @param  z field element.
-	 */
-	Element &div (Element &x, const Element &y, const Element &z) const
-	{
-		mpq_div (x.rep, y.rep, z.rep);
-		return x;
-	}
+		/** Subtraction.
+		 * x = y - z
+		 * This function assumes all the field elements have already been
+		 * constructed and initialized.
+		 * In this implementation, this means for x, y, and z,
+		 * _elem_ptr exists and does not point to null.
+		 * @return reference to x.
+		 * @param  x field element (reference returned).
+		 * @param  y field element.
+		 * @param  z field element.
+		 */
+		Element &sub (Element &x, const Element &y, const Element &z) const
+		{
+			mpq_sub (x.rep, y.rep, z.rep);
+			return x;
+		}
 
-	/** Additive Inverse (Negation).
-	 * x = - y
-	 * This function assumes both field elements have already been 
-	 * constructed and initialized.
-	 * In this implementation, this means for both x and y 
-	 * _elem_ptr exists and does not point to null.
-	 * @return reference to x.
-	 * @param  x field element (reference returned).
-	 * @param  y field element.
-	 */
-	Element &neg (Element &x, const Element &y) const
-	{
-		mpq_neg (x.rep, y.rep);
-		return x;
-	}
+		/** Multiplication.
+		 * x = y * z
+		 * This function assumes all the field elements have already been
+		 * constructed and initialized.
+		 * In this implementation, this means for x, y, and z,
+		 * _elem_ptr exists and does not point to null.
+		 * @return reference to x.
+		 * @param  x field element (reference returned).
+		 * @param  y field element.
+		 * @param  z field element.
+		 */
+		Element &mul (Element &x, const Element &y, const Element &z) const
+		{
+			mpq_mul (x.rep, y.rep, z.rep);
+			return x;
+		}
 
-	/** Multiplicative Inverse.
-	 * x = 1 / y
-	 * This function assumes both field elements have already been 
-	 * constructed and initialized.
-	 * In this implementation, this means for both x and y 
-	 * _elem_ptr exists and does not point to null.
-	 * @return reference to x.
-	 * @param  x field element (reference returned).
-	 * @param  y field element.
-	 */
-	Element &inv (Element &x, const Element &y) const
-	{
-		mpq_inv (x.rep, y.rep);
-		return x;
-	}
+		/** Division.
+		 * x = y / z
+		 * This function assumes all the field elements have already been
+		 * constructed and initialized.
+		 * In this implementation, this means for x, y, and z,
+		 * _elem_ptr exists and does not point to null.
+		 * @return reference to x.
+		 * @param  x field element (reference returned).
+		 * @param  y field element.
+		 * @param  z field element.
+		 */
+		Element &div (Element &x, const Element &y, const Element &z) const
+		{
+			mpq_div (x.rep, y.rep, z.rep);
+			return x;
+		}
 
-	//@} Arithmetic Operations
+		/** Additive Inverse (Negation).
+		 * x = - y
+		 * This function assumes both field elements have already been
+		 * constructed and initialized.
+		 * In this implementation, this means for both x and y
+		 * _elem_ptr exists and does not point to null.
+		 * @return reference to x.
+		 * @param  x field element (reference returned).
+		 * @param  y field element.
+		 */
+		Element &neg (Element &x, const Element &y) const
+		{
+			mpq_neg (x.rep, y.rep);
+			return x;
+		}
 
-	/** @name Inplace Arithmetic Operations 
-	 * x <- x op y; x <- op x
-	 * These operations require all elements, including x, to be initialized
-	 * before the operation is called.  Uninitialized field elements will
-	 * give undefined results.
-	 */
-	//@{
-    
-	/** Zero equality.
-	 * Test if field element is equal to zero.
-	 * This function assumes the field element has already been 
-	 * constructed and initialized.
-	 * In this implementation, this means the _elem_ptr of x
-	 * exists and does not point to null.
-	 * @return boolean true if equals zero, false if not.
-	 * @param  x field element.
-	 */
-	bool isZero (const Element &x) const 
-	{ return mpq_sgn (x.rep) == 0; }
-    
-	/** One equality.
-	 * Test if field element is equal to one.
-	 * This function assumes the field element has already been 
-	 * constructed and initialized.
-	 * In this implementation, this means the _elem_ptr of x
-	 * exists and does not point to null.
-	 * @return boolean true if equals one, false if not.
-	 * @param  x field element.
-	 */
-	bool isOne (const Element &x) const 
-	{ return mpq_cmp_ui (x.rep, 1L, 1L) == 0; }
-    
-	/** Inplace Addition.
-	 * x += y
-	 * This function assumes both field elements have already been 
-	 * constructed and initialized.
-	 * In this implementation, this means for both x and y 
-	 * _elem_ptr exists and does not point to null.
-	 * @return reference to x.
-	 * @param  x field element (reference returned).
-	 * @param  y field element.
-	 */
-	Element &addin (Element &x, const Element &y) const
-	{
-		mpq_add (x.rep, x.rep, y.rep);
-		return x;
-	}
+		/** Multiplicative Inverse.
+		 * x = 1 / y
+		 * This function assumes both field elements have already been
+		 * constructed and initialized.
+		 * In this implementation, this means for both x and y
+		 * _elem_ptr exists and does not point to null.
+		 * @return reference to x.
+		 * @param  x field element (reference returned).
+		 * @param  y field element.
+		 */
+		Element &inv (Element &x, const Element &y) const
+		{
+			mpq_inv (x.rep, y.rep);
+			return x;
+		}
 
-	/** Inplace Subtraction.
-	 * x -= y
-	 * This function assumes both field elements have already been 
-	 * constructed and initialized.
-	 * In this implementation, this means for both x and y 
-	 * _elem_ptr exists and does not point to null.
-	 * @return reference to x.
-	 * @param  x field element (reference returned).
-	 * @param  y field element.
-	 */
-	Element &subin (Element &x, const Element &y) const
-	{
-		mpq_sub (x.rep, x.rep, y.rep);
-		return x;
-	}
- 
-	/** Inplace Multiplication.
-	 * x *= y
-	 * This function assumes both field elements have already been 
-	 * constructed and initialized.
-	 * In this implementation, this means for both x and y 
-	 * _elem_ptr exists and does not point to null.
-	 * @return reference to x.
-	 * @param  x field element (reference returned).
-	 * @param  y field element.
-	 */
-	Element &mulin (Element &x, const Element &y) const
-	{
-		mpq_mul (x.rep, x.rep, y.rep);
-		return x;
-	}
+		//@} Arithmetic Operations
+
+		/** @name Inplace Arithmetic Operations
+		 * x <- x op y; x <- op x
+		 * These operations require all elements, including x, to be initialized
+		 * before the operation is called.  Uninitialized field elements will
+		 * give undefined results.
+		 */
+		//@{
+
+		/** Zero equality.
+		 * Test if field element is equal to zero.
+		 * This function assumes the field element has already been
+		 * constructed and initialized.
+		 * In this implementation, this means the _elem_ptr of x
+		 * exists and does not point to null.
+		 * @return boolean true if equals zero, false if not.
+		 * @param  x field element.
+		 */
+		bool isZero (const Element &x) const
+		{ return mpq_sgn (x.rep) == 0; }
+
+		/** One equality.
+		 * Test if field element is equal to one.
+		 * This function assumes the field element has already been
+		 * constructed and initialized.
+		 * In this implementation, this means the _elem_ptr of x
+		 * exists and does not point to null.
+		 * @return boolean true if equals one, false if not.
+		 * @param  x field element.
+		 */
+		bool isOne (const Element &x) const
+		{ return mpq_cmp_ui (x.rep, 1L, 1L) == 0; }
+
+		/** Inplace Addition.
+		 * x += y
+		 * This function assumes both field elements have already been
+		 * constructed and initialized.
+		 * In this implementation, this means for both x and y
+		 * _elem_ptr exists and does not point to null.
+		 * @return reference to x.
+		 * @param  x field element (reference returned).
+		 * @param  y field element.
+		 */
+		Element &addin (Element &x, const Element &y) const
+		{
+			mpq_add (x.rep, x.rep, y.rep);
+			return x;
+		}
 
-	Element &axpy (Element &r, const Element &a, const Element &x, const Element &y) const
-	{
-		mpq_mul (r.rep, a.rep, x.rep);
-		mpq_add (r.rep, r.rep, y.rep);
-		return r;
-	}
+		/** Inplace Subtraction.
+		 * x -= y
+		 * This function assumes both field elements have already been
+		 * constructed and initialized.
+		 * In this implementation, this means for both x and y
+		 * _elem_ptr exists and does not point to null.
+		 * @return reference to x.
+		 * @param  x field element (reference returned).
+		 * @param  y field element.
+		 */
+		Element &subin (Element &x, const Element &y) const
+		{
+			mpq_sub (x.rep, x.rep, y.rep);
+			return x;
+		}
 
-	Element &axpyin (Element &r, const Element &a, const Element &x) const
-	{
-		Element tmp;
-		mpq_mul (tmp.rep, a.rep, x.rep);
-		mpq_add (r.rep, r.rep, tmp.rep);
-		return r;
-	}
+		/** Inplace Multiplication.
+		 * x *= y
+		 * This function assumes both field elements have already been
+		 * constructed and initialized.
+		 * In this implementation, this means for both x and y
+		 * _elem_ptr exists and does not point to null.
+		 * @return reference to x.
+		 * @param  x field element (reference returned).
+		 * @param  y field element.
+		 */
+		Element &mulin (Element &x, const Element &y) const
+		{
+			mpq_mul (x.rep, x.rep, y.rep);
+			return x;
+		}
 
-	/** Inplace Division.
-	 * x /= y
-	 * This function assumes both field elements have already been 
-	 * constructed and initialized.
-	 * In this implementation, this means for both x and y 
-	 * _elem_ptr exists and does not point to null.
-	 * @return reference to x.
-	 * @param  x field element (reference returned).
-	 * @param  y field element.
-	 */
-	Element &divin (Element &x, const Element &y) const
-	{
-		mpq_div (x.rep, x.rep, y.rep);
-		return x;
-	}
-    
-	/** Inplace Additive Inverse (Inplace Negation).
-	 * x = - x
-	 * This function assumes the field element has already been 
-	 * constructed and initialized.
-	 * In this implementation, this means the _elem_ptr of x
-	 * exists and does not point to null.
-	 * @return reference to x.
-	 * @param  x field element (reference returned).
-	 */
-	Element &negin (Element &x) const
-	{
-		mpq_neg (x.rep, x.rep);
-		return x;
-	}
+		/*! axpy.
+		 * r = a*x + y
+		 * @param r
+		 * @param a
+		 * @param x
+		 * @param y
+		 */
+		Element &axpy (Element &r, const Element &a, const Element &x, const Element &y) const
+		{
+			mpq_mul (r.rep, a.rep, x.rep);
+			mpq_add (r.rep, r.rep, y.rep);
+			return r;
+		}
 
-	/** Inplace Multiplicative Inverse.
-	 * x = 1 / x
-	 * This function assumes the field elementhas already been 
-	 * constructed and initialized.
-	 * In this implementation, this means the _elem_ptr of x
-	 * exists and does not point to null.
-	 * @return reference to x.
-	 * @param  x field element (reference returned).
-	 */
-	Element &invin (Element &x) const
-	{
-		mpq_inv (x.rep, x.rep);
-		return x;
-	}
-    
-	//@} Inplace Arithmetic Operations
-
-	/** @name Input/Output Operations */
-	//@{
-    
-	/** Print field.
-	 * @return output stream to which field is written.
-	 * @param  os  output stream to which field is written.
-	 *
-	 * This does not do much...
-	 */
-	std::ostream &write (std::ostream &os) const 
-	{ 
-		os << "GMP rational numbers"; 
-		return os;
-	}
-    
-	/** Read field.
-	 * @return input stream from which field is read.
-	 * @param  is  input stream from which field is read.
-	 *
-	 * This does not do much either...
-	 *
-	 * FIXME: Read the same thing written above, and throw an exception if the
-	 * strings do not match.
-	 */
-	std::istream &read (std::istream &is) { return is; }
-    
-	/** Print field element.
-	 * This function assumes the field element has already been 
-	 * constructed and initialized.
-	 * In this implementation, this means for the _elem_ptr for x 
-	 * exists and does not point to null.
-	 * @return output stream to which field element is written.
-	 * @param  os  output stream to which field element is written.
-	 * @param  x   field element.
-	 */
-	std::ostream &write (std::ostream &os, const Element &x) const 
-	{
-		char *str;
+		/*! axpyin.
+		 * r += a*x
+		 * @param r
+		 * @param a
+		 * @param x
+		 */
+		Element &axpyin (Element &r, const Element &a, const Element &x) const
+		{
+			Element tmp;
+			mpq_mul (tmp.rep, a.rep, x.rep);
+			mpq_add (r.rep, r.rep, tmp.rep);
+			return r;
+		}
 
-		str = new char[mpz_sizeinbase (mpq_numref (x.rep), 10) + 2];
-		mpz_get_str (str, 10, mpq_numref (x.rep));
-		os << str;
-		delete[] str;
+		/** Inplace Division.
+		 * x /= y
+		 * This function assumes both field elements have already been
+		 * constructed and initialized.
+		 * In this implementation, this means for both x and y
+		 * _elem_ptr exists and does not point to null.
+		 * @return reference to x.
+		 * @param  x field element (reference returned).
+		 * @param  y field element.
+		 */
+		Element &divin (Element &x, const Element &y) const
+		{
+			mpq_div (x.rep, x.rep, y.rep);
+			return x;
+		}
 
-		if (mpz_cmp_ui (mpq_denref (x.rep), 1L) != 0) {
-			str = new char[mpz_sizeinbase (mpq_denref (x.rep), 10) + 2];
-			mpz_get_str (str, 10, mpq_denref (x.rep));
-			os << '/' << str;
-			delete[] str;
+		/** Inplace Additive Inverse (Inplace Negation).
+		 * x = - x
+		 * This function assumes the field element has already been
+		 * constructed and initialized.
+		 * In this implementation, this means the _elem_ptr of x
+		 * exists and does not point to null.
+		 * @return reference to x.
+		 * @param  x field element (reference returned).
+		 */
+		Element &negin (Element &x) const
+		{
+			mpq_neg (x.rep, x.rep);
+			return x;
 		}
 
-		return os;
-	}
+		/** Inplace Multiplicative Inverse.
+		 * x = 1 / x
+		 * This function assumes the field elementhas already been
+		 * constructed and initialized.
+		 * In this implementation, this means the _elem_ptr of x
+		 * exists and does not point to null.
+		 * @return reference to x.
+		 * @param  x field element (reference returned).
+		 */
+		Element &invin (Element &x) const
+		{
+			mpq_inv (x.rep, x.rep);
+			return x;
+		}
 
-	/** Read field element.
-	 * This function assumes the field element has already been 
-	 * constructed and initialized.
-	 * In this implementation, this means for the _elem_ptr for x 
-	 * exists and does not point to null.
-	 * @return input stream from which field element is read.
-	 * @param  is  input stream from which field element is read.
-	 * @param  x   field element.
-	 *
-	 * FIXME: Avoid the magical limit on size here
-	 * FIXME: Right now it skips over everything until it finds something that
-	 * looks like a number. Is this really the correct policy?
-	 */
-	std::istream &read (std::istream &is, Element &x) const
-	{
-		char buffer[65535], endc;
-		bool found_space = false;
-		int i = 0;			
-
-		do {
-			is.get (endc);
-		} while (is && !isdigit (endc) && endc != '-' && endc != '.');		
-
-		buffer[i]=endc;
-		
-		while ((buffer[i] == '-' || isdigit (buffer[i])) && i < 65535)  {
-			i++;
-			is.get (buffer[i]);
+		//@} Inplace Arithmetic Operations
+
+		/** @name Input/Output Operations */
+		//@{
+
+		/** Print field.
+		 * @return output stream to which field is written.
+		 * @param  os  output stream to which field is written.
+		 *
+		 * This does not do much...
+		 */
+		std::ostream &write (std::ostream &os) const
+		{
+			os << "GMP rational numbers";
+			return os;
 		}
 
-		endc = buffer[i];
-	       	buffer[i] = '\0';
+		/** Read field.
+		 * @return input stream from which field is read.
+		 * @param  is  input stream from which field is read.
+		 *
+		 * This does not do much either...
+		 *
+		 * FIXME: Read the same thing written above, and throw an exception if the
+		 * strings do not match.
+		 */
+		std::istream &read (std::istream &is) { return is; }
+
+		/** Print field element.
+		 * This function assumes the field element has already been
+		 * constructed and initialized.
+		 * In this implementation, this means for the _elem_ptr for x
+		 * exists and does not point to null.
+		 * @return output stream to which field element is written.
+		 * @param  os  output stream to which field element is written.
+		 * @param  x   field element.
+		 */
+		std::ostream &write (std::ostream &os, const Element &x) const
+		{
+			char *str;
+
+			str = new char[mpz_sizeinbase (mpq_numref (x.rep), 10) + 2];
+			mpz_get_str (str, 10, mpq_numref (x.rep));
+			os << str;
+			delete[] str;
 
-		if (i > 0)
-			mpz_set_str (mpq_numref (x.rep), buffer, 10);
-		else
-			mpq_set_si (x.rep, 0L, 1L);
+			if (mpz_cmp_ui (mpq_denref (x.rep), 1L) != 0) {
+				str = new char[mpz_sizeinbase (mpq_denref (x.rep), 10) + 2];
+				mpz_get_str (str, 10, mpq_denref (x.rep));
+				os << '/' << str;
+				delete[] str;
+			}
 
-		if (endc == ' ') {
-			found_space = true;
-			while (endc == ' ') is >> endc;
+			return os;
 		}
 
-		if (endc == '/') {
-			i = 0;
-
-			is.get (endc);
-			while (isspace (endc)) is.get (endc);
-			is.putback (endc);
+		/** Read field element.
+		 * This function assumes the field element has already been
+		 * constructed and initialized.
+		 * In this implementation, this means for the _elem_ptr for x
+		 * exists and does not point to null.
+		 * @return input stream from which field element is read.
+		 * @param  is  input stream from which field element is read.
+		 * @param  x   field element.
+		 *
+		 * FIXME: Avoid the magical limit on size here
+		 * FIXME: Right now it skips over everything until it finds something that
+		 * looks like a number. Is this really the correct policy?
+		 *
+		 * aniau at astronet.pl: 06/2009: supports scientific E/e notation for decimal fractions
+		 */
+		std::istream &read (std::istream &is, Element &x) const
+		{
+			char buffer[65535], endc;
+			bool found_space = false;
+			int i = 0;
 
 			do {
-				is.get (buffer[i++]);
-			} while (isdigit (buffer[i - 1]) && i < 65536);
+				is.get (endc);
+			} while (is && !isdigit (endc) && endc != '-' && endc != '.' &&  endc !='e' && endc != 'E');
+
+			buffer[i]=endc;
+
+			while ((buffer[i] == '-' || isdigit (buffer[i])) && i < 65535)  {
+				i++;
+				is.get (buffer[i]);
+			}
+
+			endc = buffer[i];
+			buffer[i] = '\0';
+
+			if (i > 0)
+				mpz_set_str (mpq_numref (x.rep), buffer, 10);
+			else
+				mpq_set_si (x.rep, 0L, 1L);
+
+			if (endc == ' ') {
+				found_space = true;
+				while (endc == ' ') is >> endc;
+			}
+
+			if (endc == '/') {
+				i = 0;
+
+				is.get (endc);
+				while (isspace (endc)) is.get (endc);
+				is.putback (endc);
+
+				do {
+					is.get (buffer[i++]);
+				} while (isdigit (buffer[i - 1]) && i < 65536);
+
+				is.putback (buffer[i - 1]);
+				buffer[i - 1] = '\0';
+
+				mpz_set_str (mpq_denref (x.rep), buffer, 10);
+				mpq_canonicalize (x.rep);
+				return is;
+			}
+			else {
+				mpz_set_si (mpq_denref (x.rep), 1L);
+			}
+
+			if (endc == '.' && !found_space) {
+				Element decimal_part;
+
+				mpz_set_si (mpq_denref (x.rep), 1L);
+				mpq_set_si (decimal_part.rep, 1L, 1L);
+				mpz_set_si (mpq_denref (decimal_part.rep), 1L);
+
+				i = 0;
+
+				do {
+					is.get (buffer[i++]);
+					if (isdigit (buffer[i - 1]))
+						mpz_mul_ui (mpq_denref (decimal_part.rep),
+							    mpq_denref (decimal_part.rep), 10L);
+				} while (isdigit (buffer[i - 1]) && i < 65536);
+
+				is.putback (buffer[i - 1]);
+				buffer[i - 1] = '\0';
+
+				mpz_set_str (mpq_numref (decimal_part.rep), buffer, 10);
+				mpq_canonicalize (decimal_part.rep);
+
+				mpq_add (x.rep, x.rep, decimal_part.rep);
+
+				do {
+					is.get (endc);
+				} while (is && endc == ' ') ;
+			}
+
+			if ((endc == 'e') || (endc == 'E')) {
+				is.get(endc);
+				bool minus = false;
+				if (endc == '-') {
+					minus = true;
+				}
+				else if (endc == '+') {
+					minus = false;
+				}
+				else {
+					is.putback(endc);
+				}
+
+				i=0;
+				do {
+					is.get (buffer[i++]);
+				} while (isdigit (buffer[i-1]) && i < 65536);
+				is.putback(buffer[i-1]);
+				buffer[i-1] = '\0';
+
+				integer pow(buffer), powten=1;
+
+				for (integer it=0; it< pow; ++it) powten *=10;
+				if (minus) {
+					div(x,x,powten);
+				}
+				else {
+					mul(x,x,powten);
+				}
+			}
+			else {
+				is.putback (endc);
+				//	mpz_set_si (mpq_denref (x.rep), 1L);
+			}
+
+			mpq_canonicalize (x.rep);
+
+			return is;
+		}
 
-			is.putback (buffer[i - 1]);
-			buffer[i - 1] = '\0';
+		//@} Input/Output Operations
 
-			mpz_set_str (mpq_denref (x.rep), buffer, 10);
-		}
-		else if (endc == '.' && !found_space) {
-			Element decimal_part;
 
-			mpz_set_si (mpq_denref (x.rep), 1L);
-			mpq_set_si (decimal_part.rep, 1L, 1L);
-			mpz_set_si (mpq_denref (decimal_part.rep), 1L);
+		//@} Common Object Interface
 
-			i = 0;
+		GMPRationalField (int p = 0, int exp = 1) :
+			_cardinality (0), _characteristic (0), _zero (0), _one (1), _neg_one (-1),
+			zero (_zero, _one), one (_one, _one), neg_one (_neg_one, _one)
+		{
+			if(p != 0) throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus must be 0 (no modulus)");
+			if(exp != 1) throw PreconditionFailed(__func__,__FILE__,__LINE__,"exponent must be 1");
+		}
 
-			do {
-				is.get (buffer[i++]);
-				if (isdigit (buffer[i - 1]))
-					mpz_mul_ui (mpq_denref (decimal_part.rep),
-						    mpq_denref (decimal_part.rep), 10L);
-			} while (isdigit (buffer[i - 1]) && i < 65536);
+		/// max modulus.
+		static inline int getMaxModulus() { return 0; } // no modulus
 
-			is.putback (buffer[i - 1]);
-			buffer[i - 1] = '\0';
+		/*! get numerator.
+		 * @param x  numerator of y
+		 * @param y
+		 */
+		integer& get_num (integer& x, const Element& y)  const{
+			mpq_get_num (SpyInteger::get_mpz(x), y. rep);
+			return x;
 
-			mpz_set_str (mpq_numref (decimal_part.rep), buffer, 10);
-			mpq_canonicalize (decimal_part.rep);
+		}
 
-			mpq_add (x.rep, x.rep, decimal_part.rep);
+		/*! get denominator.
+		 * @param x  denominator of y
+		 * @param y
+		 */
+		integer& get_den (integer& x, const Element& y) const
+		{
+			mpq_get_den (SpyInteger::get_mpz(x), y. rep);
+			return x;
 		}
-		else {
-			is.putback (endc);
-			mpz_set_si (mpq_denref (x.rep), 1L);
+
+		/*! sign.
+		 * @param x
+		 * @return sign of \c x
+		 */
+		int sign (const Element& x) const
+		{
+			return mpq_sgn (x. rep);
 		}
 
-		mpq_canonicalize (x.rep);
+		/*!
+		 * Bitsize as sum of bitsizes of numerator and denominator.
+		 * @param bs
+		 * @param q
+		 * @return \c bs
+		 */
+		integer& bitsize(integer& bs, const Element q) const
+		{
+			integer y; get_den(y,q);
+			integer x; get_num(x,q);
+			bs = x.bitsize() + y.bitsize();
+			return bs;
+		}
 
-		return is;
-	}
 
-	//@} Input/Output Operations
-    
+	}; // class GMPRationalField
 
-	//@} Common Object Interface
 
-	GMPRationalField (int p = 0, int exp = 1)
-		: _cardinality (0), _characteristic (0), _zero (0), _one (1), _neg_one (-1),
-		  zero (_zero, _one), one (_one, _one), neg_one (_neg_one, _one)
+#if 0
+	// use GMPRationalField::read() and GMPRationalField::write(), not these operators.
+	std::ostream &operator << (std::ostream &os, GMPRationalElement &elt)
 	{
-		if(p != 0) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be 0 (no modulus)");
-		if(exp != 1) throw PreconditionFailed(__FUNCTION__,__LINE__,"exponent must be 1");
-	}
-    
-	static inline int getMaxModulus() { return 0; } // no modulus
-	
-	// x = numerator of y
-	integer& get_num (integer& x, const Element& y)  const{
-		mpq_get_num (SpyInteger::get_mpz(x), y. rep);
-		return x;
+		GMPRationalField field;
 
+		field.write (os, elt);
+		return os;
 	}
 
-	// x = denominator of y
-	integer& get_den (integer& x, const Element& y) const {
-		mpq_get_den (SpyInteger::get_mpz(x), y. rep);
-		return x;
-	}
+	std::istream &operator >> (std::istream &is, GMPRationalElement &elt)
+	{
+		GMPRationalField field;
 
-	int sign (const Element& x) const {
-		return mpq_sgn (x. rep);
+		field.read (is, elt);
+		return is;
 	}
 
-}; // class GMPRationalField
-
-std::ostream &operator << (std::ostream &os, GMPRationalElement &elt)
-{
-	GMPRationalField field;
-
-	field.write (os, elt);
-	return os;
-}
-
-std::istream &operator >> (std::istream &is, GMPRationalElement &elt)
-{
-	GMPRationalField field;
-
-	field.read (is, elt);
-	return is;
-}
+#endif
 
 } // namespace LinBox
 
 #include "linbox/randiter/gmp-rational.h"
 
-#endif // __FIELD_GMP_RATIONAL_H
+#endif // __LINBOX_field_gmp_rational_H
+
+
diff --git a/linbox/field/hom.h b/linbox/field/hom.h
index cc72c23..ac34e9a 100644
--- a/linbox/field/hom.h
+++ b/linbox/field/hom.h
@@ -1,12 +1,13 @@
 /* -*- 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
 /* linbox/field/hom.h
+ * Copyright(C) LinBox
  * Written by David Saunders
  * See COPYING for license information.
  */
 
-#ifndef __HOM_H
-#define __HOM_H
+#ifndef __LINBOX_hom_H
+#define __LINBOX_hom_H
 
 #include "linbox/linbox-config.h"
 #include "linbox/field/modular.h"
@@ -15,54 +16,56 @@
 
 #ifdef __LINBOX_HAVE_NTL
 #include <linbox/field/ntl-ZZ.h>
-#endif
+#endif //__LINBOX_HAVE_NTL
 
-namespace LinBox {
+namespace LinBox
+{
 	/// Error object for attempt to establish a Hom that cannot exist.
 	class NoHomError {};
 
 	/**  \brief map element of source ring(field) to target ring
-	\ingroup field
+	  \ingroup field
 
 	 * An instance of Hom is a homomorphism from a ring of type Source
 	 * to a ring (usually field) of type Target.  The intended use is that
-	 * it will be a natural mapping.  For instance: 
-	 * 
+	 * it will be a natural mapping.  For instance:
+	 *
 	 * Hom<Unparametric<Integers>, Modular<integer> >(Z, Zp) nat; // is the mod p mapping.
 	 *
-	 * Hom<<NTL_ZZp, Modular<integer> >(Zp, Mp) nat; 
+	 * Hom<<NTL_ZZp, Modular<integer> >(Zp, Mp) nat;
 	 *
 	 * // is an isomorphism, provided the Zp and Mp have same characteristic.
-	 * Hom<Unparametric<NTL_ZZp, Unparameteric<NTL_ZZpEx> >(Z3, Z27) nat; 
+	 * Hom<Unparametric<NTL_ZZp, Unparameteric<NTL_ZZpEx> >(Z3, Z27) nat;
 	 * // is the embedding of the prime field in the extension.
 	 */
 
-	template< class Source, class Target > 
-	class Hom 
-	{   public:
+	template< class Source, class Target >
+	class Hom {
+	public:
 		typedef typename Source::Element SrcElt;
 		typedef typename Target::Element Elt;
 
 		//Hom(){}
 		/**
-		 * Construct a homomorphism from a specific source ring S and target 
-		 * field T with Hom(S, T).  
+		 * Construct a homomorphism from a specific source ring S and target
+		 * field T with Hom(S, T).
 		 * Specializations define all actual homomorphisms.
 		 */
-		Hom(const Source& S, const Target& T) : _source(S), _target(T){ }
+		Hom(const Source& S, const Target& T) :
+			_source(S), _target(T)
+		{ }
 
-		/** 
-		 * image(t, s) implements the homomorphism, assigning the 
+		/**
+		 * image(t, s) implements the homomorphism, assigning the
 		 * t the value of the image of s under the mapping.
 		 *
 		 * The default behaviour goes through integers.
 		 */
 		Elt& image(Elt& t, const SrcElt& s) {
-                    integer tmp;
-                    return _target.init(t, _source.convert(tmp,s));
-                }
+			return _target.init(t, _source.convert(tmp,s));
+		}
 
-		/** If possible, preimage(s,t) assigns a value to s such that 
+		/** If possible, preimage(s,t) assigns a value to s such that
 		 * the image of s is t.  Otherwise behaviour is unspecified.
 		 * An error may be thrown, a conventional value may be set, or
 		 * an arb value set.
@@ -70,16 +73,16 @@ namespace LinBox {
 		 * The default behaviour goes through integers.
 		 */
 		SrcElt& preimage(SrcElt& s, const Elt& t) {
-                    integer tmp;
-                    return _source.init(s, _target.convert(tmp,t));
-                }
+			return _source.init(s, _target.convert(tmp,t));
+		}
 		const Source& source() { return _source;}
 		const Target& target() { return _target;}
 
 	private:
+		integer tmp;
 		Source _source;
 		Target _target;
-	}; // end Hom 
+	}; // end Hom
 
 
 
@@ -92,13 +95,17 @@ namespace LinBox {
 		typedef Source Target;
 		typedef typename Source::Element SrcElt;
 		typedef typename Target::Element Elt;
-	
-		Hom(const Source& S, const Target& T) : _source (S){}
-		Elt& image(Elt& t, const SrcElt& s) {
+
+		Hom(const Source& S, const Target& T) :
+			_source (S)
+		{}
+		Elt& image(Elt& t, const SrcElt& s)
+		{
 			_source. assign (t, s);
 			return t;
 		}
-		SrcElt& preimage(SrcElt& s, const Elt& t) {
+		SrcElt& preimage(SrcElt& s, const Elt& t)
+		{
 			_source. assign (s, t);
 			return s;
 		}
@@ -107,39 +114,46 @@ namespace LinBox {
 
 	protected:
 		Source _source;
-	}; // end Hom 
+	}; // end Hom
 
 
 }
 
-
-
-
-#ifdef __FIELD_MODULAR_H
+#ifdef __LINBOX_field_modular_H
 // including specialization to modular
 //#include "linbox/field/modular.h"
-/// Specialization to Modular<uint16> --> Modular<uint_32>.
+/// Specialization to Modular<uint16_t> --> Modular<uint_32>.
 // Just a trial.  delete this when better examples exist.
-namespace LinBox {
-	template<> inline Hom<Modular<uint16>, Modular<uint32> >::
-	Hom(const Modular<uint16>& S, const Modular<uint32>& T ): _source(S),_target(T)
+namespace LinBox
+{
+	template<> inline Hom<Modular<uint16_t>, Modular<uint32_t> >::
+	Hom(const Modular<uint16_t>& S, const Modular<uint32_t>& T ) :
+		_source(S),_target(T)
 	{
 		integer ps, pt;
 		if (S.characteristic(ps) != T.characteristic(pt)) throw NoHomError();
 	}
 
-	template<> inline Modular<uint32>::Element& Hom<Modular<uint16>, Modular<uint32> >::
-	image(Modular<uint32>::Element& t, const Modular<uint16>::Element& s) { return t = s; }
+	template<> inline Modular<uint32_t>::Element& Hom<Modular<uint16_t>, Modular<uint32_t> >::
+	image(Modular<uint32_t>::Element& t, const Modular<uint16_t>::Element& s)
+	{
+	       	return t = s;
+	}
 
 	// assumes t normalized.
-	template<> inline Modular<uint16>::Element& Hom<Modular<uint16>, Modular<uint32> >::
-	preimage(Modular<uint16>::Element& s, const Modular<uint32>::Element& t) { return s = t; }
+	template<> inline Modular<uint16_t>::Element& Hom<Modular<uint16_t>, Modular<uint32_t> >::
+	preimage(Modular<uint16_t>::Element& s, const Modular<uint32_t>::Element& t)
+	{
+		linbox_check(t < UINT8_MAX) ;
+	       	return s = (uint16_t) t;
+	}
 
 }// namespace LinBox
-#endif
+#endif //__LINBOX_field_modular_H
 
-#ifdef __FIELD_UNPARAMETRIC_H
-namespace LinBox{
+#ifdef __LINBOX_field_unparametric_H
+namespace LinBox
+{
 
 	template<class _Target>
 	class Hom<UnparametricField<integer>, _Target> {
@@ -149,13 +163,17 @@ namespace LinBox{
 		typedef _Target Target;
 		typedef typename Source::Element SrcElt;
 		typedef typename Target::Element Elt;
-	
-		Hom(const Source& S, const Target& T) : _source (S), _target (T) {}
-		inline Elt& image(Elt& t, const SrcElt& s) {
+
+		Hom(const Source& S, const Target& T) :
+			_source (S), _target (T)
+		{}
+		inline Elt& image(Elt& t, const SrcElt& s)
+		{
 			_target. init (t, s);
 			return t;
 		}
-		inline SrcElt& preimage(SrcElt& s, const Elt& t) {
+		inline SrcElt& preimage(SrcElt& s, const Elt& t)
+		{
 			_target. convert (s, t);
 			return s;
 		}
@@ -165,7 +183,7 @@ namespace LinBox{
 	protected:
 		Source _source;
 		Target _target;
-	}; // end Hom 
+	}; // end Hom
 
 	template<>
 	class Hom<UnparametricField<integer>, UnparametricField<integer> > {
@@ -175,13 +193,17 @@ namespace LinBox{
 		typedef UnparametricField<integer> Target;
 		typedef Source::Element SrcElt;
 		typedef Target::Element Elt;
-	
-		Hom(const Source& S, const Target& T) : _source (S), _target (T) {}
-		inline Elt& image(Elt& t, const SrcElt& s) {
+
+		Hom(const Source& S, const Target& T) :
+			_source (S), _target (T)
+		{}
+		inline Elt& image(Elt& t, const SrcElt& s)
+		{
 			t = s;
 			return t;
 		}
-		inline SrcElt& preimage(SrcElt& s, const Elt& t) {
+		inline SrcElt& preimage(SrcElt& s, const Elt& t)
+		{
 			s = t;
 			return s;
 		}
@@ -191,7 +213,7 @@ namespace LinBox{
 	protected:
 		Source _source;
 		Target _target;
-	}; // end Hom 
+	}; // end Hom
 
 	template<class _Target>
 	class Hom<PID_integer, _Target> {
@@ -201,8 +223,10 @@ namespace LinBox{
 		typedef _Target Target;
 		typedef typename Source::Element SrcElt;
 		typedef typename Target::Element Elt;
-	
-		Hom(const Source& S, const Target& T) : _source (S), _target (T) {}
+
+		Hom(const Source& S, const Target& T) :
+			_source (S), _target (T)
+		{}
 		inline Elt& image(Elt& t, const SrcElt& s) {
 			_target. init (t, s);
 			return t;
@@ -217,7 +241,7 @@ namespace LinBox{
 	protected:
 		Source _source;
 		Target _target;
-	}; // end Hom 
+	}; // end Hom
 
 
 	template<>
@@ -228,9 +252,12 @@ namespace LinBox{
 		typedef Source Target;
 		typedef Source::Element SrcElt;
 		typedef Target::Element Elt;
-	
-		Hom(const Source& S, const Target& T) : _source (S), _target (T) {}
-		inline Elt& image(Elt& t, const SrcElt& s) {
+
+		Hom(const Source& S, const Target& T) :
+			_source (S), _target (T)
+		{}
+		inline Elt& image(Elt& t, const SrcElt& s)
+		{
 			_target. assign (t, s);
 			return t;
 		}
@@ -244,51 +271,54 @@ namespace LinBox{
 	protected:
 		Source _source;
 		Target _target;
-	}; // end Hom 
-
-
-	/*
-	  #ifdef __FIELD_MODULAR_H
-	  // Dan Roche mapping from UnparametricField to Modular - for integer
-	  // computations that use mod one or more primes and possibly chinese
-	  // remaindering.
-	  template<class _INT1, class _INT2>
-	  class Hom<UnparametricField<_INT1 >,Modular<_INT2 > > {
-
-	  public:
-	  typedef UnparametricField<_INT1 > Source;
-	  typedef Modular<_INT2 > Target;
-	  typedef _INT1 SrcElt;
-	  typedef _INT2 Elt;
-
-	  Hom(const Source& S, const Target& T) :_source(S), _target(T) {}
-
-	  inline Elt& image(Elt& t, const SrcElt& s) {
-	  integer temp;
-	  return _target.init(t,_source.convert(temp,s));
-	  }
-	  inline SrcElt& preimage(SrcElt& s, const Elt& t) {
-	  integer temp;
-	  return _source.init(s,_source.convert(temp,t));
-	  }
-	  const Source& source() { return _source; }
-	  const Target& target() { return _target; }
-
-	  protected:
-	  Source _source;
-	  Target _target;
-	  }; // end Hom
-
-	  #endif // __FIELD_MODULAR_H
-	*/
+	}; // end Hom
 
-} // namespace LinBox
+
+#if 0
+#ifdef __FIELD_MODULAR_H
+	// Dan Roche mapping from UnparametricField to Modular - for integer
+	// computations that use mod one or more primes and possibly chinese
+	// remaindering.
+	template<class _INT1, class _INT2>
+	class Hom<UnparametricField<_INT1 >,Modular<_INT2 > > {
+
+	public:
+		typedef UnparametricField<_INT1 > Source;
+		typedef Modular<_INT2 > Target;
+		typedef _INT1 SrcElt;
+		typedef _INT2 Elt;
+
+		Hom(const Source& S, const Target& T) :
+			_source(S), _target(T)
+		{}
+
+		inline Elt& image(Elt& t, const SrcElt& s) {
+			integer temp;
+			return _target.init(t,_source.convert(temp,s));
+		}
+		inline SrcElt& preimage(SrcElt& s, const Elt& t) {
+			integer temp;
+			return _source.init(s,_source.convert(temp,t));
+		}
+		const Source& source() { return _source; }
+		const Target& target() { return _target; }
+
+	protected:
+		Source _source;
+		Target _target;
+	}; // end Hom
+
+#endif // __FIELD_MODULAR_H
 #endif
 
+} // namespace LinBox
+#endif //__LINBOX_field_unparametric_H
+
 #ifdef __LINBOX_HAVE_NTL
-namespace LinBox {
+namespace LinBox
+{
 
-	template<class _Target > 
+	template<class _Target >
 	class Hom <NTL_ZZ , _Target> {
 
 	public:
@@ -296,8 +326,10 @@ namespace LinBox {
 		typedef _Target Target;
 		typedef typename Source::Element SrcElt;
 		typedef typename Target::Element Elt;
-	
-		Hom(const Source& S, const Target& T) : _source(S), _target(T){}
+
+		Hom(const Source& S, const Target& T) :
+			_source(S), _target(T)
+		{}
 		inline Elt& image(Elt& t, const SrcElt& s) {
 			return _target. init (t, _source. convert (tmp, s));
 		}
@@ -311,8 +343,8 @@ namespace LinBox {
 		integer tmp;
 		Source _source;
 		Target _target;
-	}; // end Hom 
-	
+	}; // end Hom
+
 	template<>
 	class Hom <NTL_ZZ , NTL_ZZ> {
 	public:
@@ -320,8 +352,10 @@ namespace LinBox {
 		typedef NTL_ZZ Target;
 		typedef Source::Element SrcElt;
 		typedef Target::Element Elt;
-	
-		Hom(const Source& S, const Target& T) : _source(S), _target(T){}
+
+		Hom(const Source& S, const Target& T) :
+			_source(S), _target(T)
+		{}
 		inline Elt& image(Elt& t, const SrcElt& s) {
 			return _target.assign(t, s);
 		}
@@ -332,16 +366,16 @@ namespace LinBox {
 		const Target& target() { return _target;}
 
 	protected:
-		integer tmp;
 		Source _source;
 		Target _target;
-	}; // end Hom 
-	
+	}; // end Hom
+
 }
-#endif
+#endif //__LINBOX_HAVE_NTL
 
-#ifdef __FIELD_GMP_RATIONAL_H
-namespace LinBox {
+#ifdef __LINBOX_field_gmp_rational_H
+namespace LinBox
+{
 	template <class _Target>
 	class Hom<GMPRationalField, _Target> {
 
@@ -350,23 +384,27 @@ namespace LinBox {
 		typedef _Target Target;
 		typedef typename Source::Element SrcElt;
 		typedef typename Target::Element Elt;
-	
-            Hom(const Source& S, const Target& T) : _source (S), _target(T){ }
+
+		Hom(const Source& S, const Target& T) :
+			_source (S), _target(T)
+		{ }
 		Elt& image(Elt& t, const SrcElt& s) {
 			_source. get_num (num, s);
 			_source. get_den (den, s);
-                        if (den == 1) {
-                            return _target.init(t,num);
-                        } else if (num == 1) {
-                            _target.init(t,den);
-                            return _target.invin(t);
-                        } else {
-                            _target. init (tmp, den);
-                            _target. init (t, num);
-                            return _target. divin (t, tmp);
-                        }
-// 			_target. init (t, den);
-// 			return _target. invin (t);
+			if (den == 1) {
+				return _target.init(t,num);
+			}
+			else if (num == 1) {
+				_target.init(t,den);
+				return _target.invin(t);
+			}
+			else {
+				_target. init (tmp, den);
+				_target. init (t, num);
+				return _target. divin (t, tmp);
+			}
+			// 			_target. init (t, den);
+			// 			return _target. invin (t);
 		}
 		SrcElt& preimage(SrcElt& s, const Elt& t) {
 			_target. convert (num, t);
@@ -381,7 +419,7 @@ namespace LinBox {
 		Elt tmp;
 		Source _source;
 		Target _target;
-	}; // end Hom 
+	}; // end Hom
 
 	template <>
 	class Hom<GMPRationalField, GMPRationalField> {
@@ -391,8 +429,10 @@ namespace LinBox {
 		typedef Source Target;
 		typedef Source::Element SrcElt;
 		typedef Target::Element Elt;
-	
-		Hom(const Source& S, const Target& T) : _source (S), _target(T){}
+
+		Hom(const Source& S, const Target& T) :
+			_source (S), _target(T)
+		{}
 		Elt& image(Elt& t, const SrcElt& s) {
 			_target.assign(t, s);
 			return t;
@@ -407,12 +447,9 @@ namespace LinBox {
 	protected:
 		Source _source;
 		Target _target;
-	}; // end Hom 
+	}; // end Hom
 }
-#endif
-
-
-
+#endif //__LINBOX_field_gmp_rational_H
 
+#endif // __LINBOX_hom_H
 
-#endif // __HOM_H
diff --git a/linbox/field/integers.doxy b/linbox/field/integers.doxy
new file mode 100644
index 0000000..c9de777
--- /dev/null
+++ b/linbox/field/integers.doxy
@@ -0,0 +1,34 @@
+// Copyright (C) 2010 LinBox, GNU LGPL, see COPYING for licence information
+
+/*! @ingroup ring
+ * @defgroup integers Integers
+ * LinBox integer representation and operations.
+ *
+ * LinBox integers come from Givaro which uses GMP. This ensures fastest
+ * operations.
+ *
+ * LinBox provides :
+ * - LinBox::Integer is the Givaro representation of an integer (Givaro::Integer).
+ * - LinBox::integer is a synonym
+ * - LinBox::PID_integer is a domain (ref ???) to perform integers operation on.
+ * - Others ?
+ *
+ *
+ * other use of integers ?
+ *
+ * @warning due to the construction of Givaro, you should always prefer to
+ * group operations as in the example :
+ \code
+ Integer a=1,b=1,c=1;
+ c += a * b ;    // slow
+ axpyin(c,a,b) ; // faster
+ \endcode
+ * @see <a href="http://ljk.imag.fr/CASYS/LOGICIELS/givaro/">Givaro</a> for documentation.
+ */
+
+ /** @ingroup integers
+  * @defgroup primes Primes
+  * @brief NO DOC
+  */
+
+// vim:syn=doxygen
diff --git a/linbox/field/lidia-gfq.h b/linbox/field/lidia-gfq.h
index c69a6e6..27292ba 100644
--- a/linbox/field/lidia-gfq.h
+++ b/linbox/field/lidia-gfq.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/field/lidia-gfq.h
  * Copyright (C) 2002 Pascal Giorgi
  *
@@ -11,9 +11,8 @@
  */
 
 
-
-#ifndef __FIELD_LIDIA_GFQ
-#define __FIELD_LIDIA_GFQ
+#ifndef __LINBOX_lidia_gfq_H
+#define __LINBOX_lidia_gfq_H
 
 //-----------------------------------
 // Files of C/C++ library
@@ -44,6 +43,10 @@
 
 //------------------------------------
 
+/*! @file field/lidia-gfq.h
+ * @brief LiDIA : NO DOC
+* \ingroup field
+*/
 
 // Namespace in which all LinBox library code resides
 namespace LinBox
@@ -61,24 +64,23 @@ namespace LinBox
 
 	/** @brief defines the  Galois Field GF(p<sup>k</sup>).
 
-	* Inherits from galois\_field of LiDIA.
-	 *  p must be prime.
+	* Inherits from \c galois_field of \ref LiDIA.
+	 * @pre \p p must be prime.
 	\ingroup field
 	 */
-	class LidiaGfq  : public LiDIA::galois_field, public FieldInterface 
-	{
+	class LidiaGfq  : public LiDIA::galois_field, public FieldInterface {
 	public:
 
 		/** Element type.
 		 *  This type is inherited from the LiDIA class LiDIA::gf_element
 		 */
 		typedef LiDIA::gf_element  Element;
-    
-    
+
+
 		/** Random element generator which is define in the wrapper LIDIA_randiter
 		 */
 		typedef LidiaGfqRandIter<LidiaGfq>  RandIter;
-    
+
 
 
 		/** Default constructor of the field
@@ -88,22 +90,25 @@ namespace LinBox
 
 		/** @brief Constructor of GF(p^k).
 
-		 *  A GF(p^k) field is constructed through 
+		 *  A GF(p^k) field is constructed through
 		 *  the constructor of LiDIA LiDIA::galois_field
 		 *  We need a double cast to pass integer arguments to the LiDIA constructor
 		 */
 		LidiaGfq(const integer& p , const integer& k=1) :
-			LiDIA::galois_field(static_cast<LiDIA::bigint>(double(p)), 
+			LiDIA::galois_field(static_cast<LiDIA::bigint>(double(p)),
 				     static_cast<LiDIA::lidia_size_t>(int(k))) {}
-     
 
-		/** Copy constructor 
+
+		/** Copy constructor
 		 */
-		LidiaGfq(const LidiaGfq& F) : LiDIA::galois_field(F) {}
+		LidiaGfq(const LidiaGfq& F) :
+		       	LiDIA::galois_field(F)
+		{}
 
 #ifdef __LINBOX_XMLENABLED
 		// XML LinBox::Reader constructor
-		LidiaGfq(LinBox::Reader &R) : LiDIA::galois_field()
+		LidiaGfq(LinBox::Reader &R) :
+		       	LiDIA::galois_field()
 		{
 			integer p, k;
 			if(!R.expectTagName("field") || !R.expectChildTag()) return;
@@ -140,7 +145,7 @@ namespace LinBox
 		}
 #endif
 
-    
+
 		/** Destructor
 		 */
 		~LidiaGfq() {}
@@ -165,7 +170,7 @@ namespace LinBox
 
 		/** Initialization of field Element from an integer.
 		 * Behaves like C++ allocator construct.
-		 * This function assumes the output field Element x has already been 
+		 * This function assumes the output field Element x has already been
 		 * constructed, but that it is not already initialized.
 		 * We also need to define the Element over the field.
 		 * So what we always initialize the Element with the zero field value.
@@ -183,26 +188,26 @@ namespace LinBox
 			else
 				{
 					if (y!=0)
-						if (this->degree() > 1)						
+						if (this->degree() > 1)
 							{
 								LiDIA::Fp_polynomial Pol;
 								LiDIA::bigint p=static_cast<const LiDIA::galois_field&>(*this).characteristic();
 								Pol.set_modulus(p);
 								//Pol.set_max_degree((x.get_field()).degree());
-								
+
 								//integer rem, quo,tmp=y;
 								LiDIA::bigint rem, quo ,tmp;
 								LiDIA::string_to_bigint(std::string(y).data(),tmp);
 								LiDIA::lidia_size_t deg = this->degree();
 								for(LiDIA::lidia_size_t i=0;i<deg;i++)
-								 	{		
+								 	{
 										quo=tmp/p;
 										rem=tmp%p;
 										tmp=quo;
 										if (rem != LiDIA::bigint(0))
 											Pol.set_coefficient(rem,i);
 									}
-								//Element e(x.get_field());	   
+								//Element e(x.get_field());
 								x.set_polynomial_rep(Pol);
 								//x.assign(e);
 							}
@@ -212,15 +217,15 @@ namespace LinBox
 							x.assign(tmp);
 						}
 				}
-			return x;				
+			return x;
 		}
-    
-    
+
+
 
 		/** Conversion of field base Element to an integer.
 		 * This function assumes the output field base Element x has already been
 		 * constructed, but that it is not already initialized.
-		 * As Elements are represented by polynom the convert function return 
+		 * As Elements are represented by polynom the convert function return
 		 * the valuation of polynom in characteristic by the Horner Method.
 		 * That keeps unicity of each Element.
 		 * @return reference to an integer.
@@ -231,8 +236,8 @@ namespace LinBox
 		{
 			LiDIA::bigint fx(0) , X((y.get_field()).characteristic());
 			LiDIA::bigint tmp;
-	
-	 
+
+
 			for(int i=(int)(y.get_field()).degree();i>0;i--)
 				{
 					(y.polynomial_rep()).get_coefficient(tmp,i);
@@ -256,7 +261,7 @@ namespace LinBox
 
 
 		/** Assignment of one field Element to another.
-		 * This function assumes both field Elements have already been 
+		 * This function assumes both field Elements have already been
 		 * constructed and initialized.
 		 * @return reference to x
 		 * @param  x field Element (reference returned).
@@ -274,10 +279,10 @@ namespace LinBox
 		/** Cardinality.
 		 * Return integer representing cardinality of the field.
 		 * Returns  p^k.
-		 * @return constant reference to integer representing cardinality 
+		 * @return constant reference to integer representing cardinality
 		 *	       of the field.
 		 */
-		integer& cardinality(integer& c) const 
+		integer& cardinality(integer& c) const
 		{
 			LiDIA::bigint tmp=number_of_elements();
 			unsigned int size= tmp.bit_length();
@@ -285,7 +290,7 @@ namespace LinBox
 			LiDIA::bigint_to_string(tmp,s);
 
 			return c=integer(s);
- 
+
 		}
 
 
@@ -293,12 +298,12 @@ namespace LinBox
 		/** Characteristic.
 		 * Return integer representing characteristic of the field.
 		 * Returns p.
-		 * @return constant reference to integer representing characteristic 
+		 * @return constant reference to integer representing characteristic
 		 * 	       of the field.
 		 */
 		integer& characteristic(integer& c) const
 		{
-			
+
 			LiDIA::bigint tmp = static_cast<const LiDIA::galois_field&>(*this).characteristic();
 			unsigned int size= tmp.bit_length();
 			char s[(size>>2)+4];
@@ -309,17 +314,17 @@ namespace LinBox
 
 
 		//@} Object Management
-    
-		/** @name Arithmetic Operations 
+
+		/** @name Arithmetic Operations
 		 * x <- y op z; x <- op y
 		 * These operations require all Elements, including x, to be initialized
 		 * before the operation is called.  Uninitialized field Elements will
 		 * give undefined results.
 		 */
 		//@{
-     
+
 		/** Equality of two Elements.
-		 * This function assumes both field Elements have already been 
+		 * This function assumes both field Elements have already been
 		 * constructed and initialized.
 		 * @return boolean true if equal, false if not.
 		 * @param  x field Element
@@ -333,7 +338,7 @@ namespace LinBox
 
 		/** Addition.
 		 * x = y + z
-		 * This function assumes all the field Elements have already been 
+		 * This function assumes all the field Elements have already been
 		 * constructed and initialized.
 		 * @return reference to x.
 		 * @param  x field Element (reference returned).
@@ -341,14 +346,14 @@ namespace LinBox
 		 * @param  z field Element.
 		 */
 		Element& add(Element& x, const Element& y, const Element& z) const
-		{ 
+		{
 			LiDIA::add(x,y,z);
 			return x;
 		}
-    
+
 		/** Subtraction.
 		 * x = y - z
-		 * This function assumes all the field Elements have already been 
+		 * This function assumes all the field Elements have already been
 		 * constructed and initialized.
 		 * @return reference to x.
 		 * @param  x field Element (reference returned).
@@ -360,10 +365,10 @@ namespace LinBox
 			LiDIA::subtract(x,y,z);
 			return x;
 		}
-     
+
 		/** Multiplication.
 		 * x = y * z
-		 * This function assumes all the field Elements have already been 
+		 * This function assumes all the field Elements have already been
 		 * constructed and initialized.
 		 * @return reference to x.
 		 * @param  x field Element (reference returned).
@@ -373,12 +378,12 @@ namespace LinBox
 		Element& mul(Element& x, const Element& y, const Element& z) const
 		{
 			LiDIA::multiply(x,y,z);
-			return x; 
+			return x;
 		}
-     
+
 		/** Division.
 		 * x = y / z
-		 * This function assumes all the field Elements have already been 
+		 * This function assumes all the field Elements have already been
 		 * constructed and initialized.
 		 * @return reference to x.
 		 * @param  x field Element (reference returned).
@@ -390,11 +395,11 @@ namespace LinBox
 			LiDIA::divide(x,y,z);
 			return x;
 		}
-     
-     
+
+
 		/** Additive Inverse (Negation).
 		 * x = - y
-		 * This function assumes both field Elements have already been 
+		 * This function assumes both field Elements have already been
 		 * constructed and initialized.
 		 * @return reference to x.
 		 * @param  x field Element (reference returned).
@@ -410,7 +415,7 @@ namespace LinBox
 
 		/** Multiplicative Inverse.
 		 * x = 1 / y
-		 * This function assumes both field Elements have already been 
+		 * This function assumes both field Elements have already been
 		 * constructed and initialized.
 		 * @return reference to x.
 		 * @param  x field Element (reference returned).
@@ -421,12 +426,12 @@ namespace LinBox
 			LiDIA::invert(x,y);
 			return x;
 		}
-     
-     
+
+
 
 		/** Natural AXPY.
 		 * r  = a * x + y
-		 * This function assumes all field Elements have already been 
+		 * This function assumes all field Elements have already been
 		 * constructed and initialized.
 		 * @return reference to r.
 		 * @param  r field Element (reference returned).
@@ -434,24 +439,24 @@ namespace LinBox
 		 * @param  x field Element.
 		 * @param  y field Element.
 		 */
-		Element& axpy(Element& r, 
+		Element& axpy(Element& r,
 			      const Element& a,
-			      const Element& x, 
+			      const Element& x,
 			      const Element& y) const
 		{
 			return r=a*x+y;
 		}
 
-      
+
 
 		/** Zero equality.
 		 * Test if field Element is equal to zero of field.
-		 * This function assumes the field Element has already been 
+		 * This function assumes the field Element has already been
 		 * constructed and initialized.
 		 * @return boolean true if equals zero of field, false if not.
 		 * @param  x field Element.
 		 */
-		bool isZero(const Element& x) const 
+		bool isZero(const Element& x) const
 		{
 			return x.is_zero();
 		}
@@ -460,70 +465,70 @@ namespace LinBox
 
 		/** One equality.
 		 * Test if field Element is equal to one of field.
-		 * This function assumes the field Element has already been 
+		 * This function assumes the field Element has already been
 		 * constructed and initialized.
 		 * @return boolean true if equals one of field, false if not.
 		 * @param  x field Element.
 		 */
-		bool isOne(const Element& x) const 
+		bool isOne(const Element& x) const
 		{
 			return x.is_one();
 		}
 
 
-     
+
 		/** Inplace Addition.
 		 * x += y
-		 * This function assumes both field Elements have already been 
+		 * This function assumes both field Elements have already been
 		 * constructed and initialized.
 		 * @return reference to x.
 		 * @param  x field Element (reference returned).
 		 * @param  y field Element.
 		 */
 		Element& addin(Element& x, const Element& y) const {
-			return x+=y; 
+			return x+=y;
 		}
-     
+
 		/** Inplace Subtraction.
 		 * x -= y
-		 * This function assumes both field Elements have already been 
+		 * This function assumes both field Elements have already been
 		 * constructed and initialized.
 		 * @return reference to x.
 		 * @param  x field Element (reference returned).
 		 * @param  y field Element.
 		 */
 		Element& subin(Element& x, const Element& y) const {
-			return x-=y; 
+			return x-=y;
 		}
-     
+
 		/** Inplace Multiplication.
 		 * x *= y
-		 * This function assumes both field Elements have already been 
+		 * This function assumes both field Elements have already been
 		 * constructed and initialized.
 		 * @return reference to x.
 		 * @param  x field Element (reference returned).
 		 * @param  y field Element.
 		 */
 		Element& mulin(Element& x, const Element& y) const {
-			return x*=y; 
+			return x*=y;
 		}
-    
+
 		/** Inplace Division.
 		 * x /= y
-		 * This function assumes both field Elements have already been 
+		 * This function assumes both field Elements have already been
 		 * constructed and initialized.
 		 * @return reference to x.
 		 * @param  x field Element (reference returned).
 		 * @param  y field Element.
 		 */
-		Element& divin(Element& x, const Element& y) const { 
+		Element& divin(Element& x, const Element& y) const {
 			return x/=y;
 		}
-     
-     
+
+
 		/** Inplace Additive Inverse (Inplace Negation).
 		 * x = - x
-		 * This function assumes the field Element has already been 
+		 * This function assumes the field Element has already been
 		 * constructed and initialized.
 		 * @return reference to x.
 		 * @param  x field Element (reference returned).
@@ -533,12 +538,12 @@ namespace LinBox
 			x.negate();
 			return x;
 		}
-     
-     
+
+
 
 		/** Inplace Multiplicative Inverse.
 		 * x = 1 / x
-		 * This function assumes the field Elementhas already been 
+		 * This function assumes the field Elementhas already been
 		 * constructed and initialized.
 		 * @return reference to x.
 		 * @param  x field Element (reference returned).
@@ -553,7 +558,7 @@ namespace LinBox
 
 		/** Inplace AXPY.
 		 * r  += a * x
-		 * This function assumes all field Elements have already been 
+		 * This function assumes all field Elements have already been
 		 * constructed and initialized.
 		 * @return reference to r.
 		 * @param  r field Element (reference returned).
@@ -561,7 +566,7 @@ namespace LinBox
 		 * @param  x field Element.
 		 */
 		Element& axpyin(Element& r, const Element& a, const Element& x) const
-		{			 
+		{
 			return  r+=a*x;
 		}
 
@@ -570,7 +575,7 @@ namespace LinBox
 #ifndef __LINBOX_XMLENABLED
 		/** @name Input/Output Operations */
 		//@{
-    
+
 		/** Print field.
 		 * @return output stream to which field is written.
 		 * @param  os  output stream to which field is written.
@@ -581,8 +586,8 @@ namespace LinBox
 			return os<<"corps de Galois GF("<<
 				characteristic(c)<<"^"<<degree()<<")";
 		}
-     
-     
+
+
 		/** Read field.
 		 * @return input stream from which field is read.
 		 * @param  is  input stream from which field is read.
@@ -591,48 +596,48 @@ namespace LinBox
 		{
 			return is ;
 		}
-     
+
 
 		/** Print field Element like a polynom.
 		 * @return output stream to which field Element is written.
 		 * @param  os  output stream to which field Element is written.
-		 * @param  x   field Element.
+		 * @param  e   field Element.
 		 */
 		std::ostream& write(std::ostream& os,const Element& e) const
 		{
-			/*integer tmp; 
+			/*integer tmp;
 			  (*this).convert(tmp,e);
 			  return os<<tmp;
 			*/
 			return os<<e;
 		}
-     
-     
-     
+
+
+
 		/** Read field Element.
 		 * @return input stream from which field Element is read.
 		 * @param  is  input stream from which field Element is read.
-		 * @param  x   field Element.
+		 * @param  e   field Element.
 		 */
 		std::istream& read(std::istream& is, Element& e) const
-		{ 
+		{
 			// return is>>e;
 			integer tmp;
 			is>> tmp;
 			(*this).init(e,tmp);
 			return is;
-	 
+
 		}
 
 		//@}
-      
+
 #else
 		std::ostream &write(std::ostream &os) const
 		{
 			LinBox::Writer W;
-			if( toTag(W)) 
+			if( toTag(W))
 				W.write(os);
-			
+
 			return os;
 		}
 
@@ -667,7 +672,7 @@ namespace LinBox
 			return true;
 		}
 
-		std::ostream &write(std::ostream &os, const Element &e) const 
+		std::ostream &write(std::ostream &os, const Element &e) const
 		{
 			LinBox::Writer W;
 			if (toTag(W, e))
@@ -728,9 +733,9 @@ namespace LinBox
 
 			return true;
 		}
-#endif			
-			
-			
+#endif
+
+
 		static inline integer getMaxModulus()
 		{ return integer( "9007199254740881" ); } // prevprime(2^53)
 
@@ -742,4 +747,5 @@ namespace LinBox
 } // namespace LinBox
 
 
-#endif // __FIELD_LIDIA_GFQ
+#endif // __LINBOX_lidia_gfq_H
+
diff --git a/linbox/field/lidia.doxy b/linbox/field/lidia.doxy
new file mode 100644
index 0000000..29a18e2
--- /dev/null
+++ b/linbox/field/lidia.doxy
@@ -0,0 +1,10 @@
+// Copyright (C) 2010 Brice Boyer, part of LinBox, GNU LGPL, see COPYING
+
+/*! @ingroup field
+ at defgroup LiDIA LiDIA
+
+ at brief NO DOC
+
+*/
+
+// vim:syntax=doxygen
diff --git a/linbox/field/lidia.h b/linbox/field/lidia.h
index d99b010..1225d24 100644
--- a/linbox/field/lidia.h
+++ b/linbox/field/lidia.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/field/lidia.h
  * Copyright (C) 2002 Pascal Giorgi
  *
@@ -8,9 +8,10 @@
  * See COPYING for license information.
  */
 
-#ifndef __FIELD_LIDIA_H
-#define __FIELD_LIDIA_H
+#ifndef __LINBOX_field_lidia_H
+#define __LINBOX_field_lidia_H
 
 #include "linbox/field/lidia-gfq.h"
 
-#endif // __FIELD_LIDIA_H
+#endif // __LINBOX_field_lidia_H
+
diff --git a/linbox/field/local2_32.h b/linbox/field/local2_32.h
index 933c1ee..9b644cd 100644
--- a/linbox/field/local2_32.h
+++ b/linbox/field/local2_32.h
@@ -1,12 +1,29 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* linbox/field/local2_32.h
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) 2010 LinBox
  * written by bds, wan
  *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __LOCAL2_32_H
-#define __LOCAL2_32_H
+
+#ifndef __LINBOX_local2_32_H
+#define __LINBOX_local2_32_H
 
 #include "linbox/field/unparametric.h"
 #include "linbox/util/debug.h"
@@ -17,8 +34,8 @@
 
 namespace LinBox
 {
-  
-        template<typename Ring>
+
+	template<typename Ring>
 	struct ClassifyRing;
 
 	class Local2_32;
@@ -30,14 +47,14 @@ namespace LinBox
 
 	/** \brief Fast arithmetic mod 2^32, including gcd.
 	 *
-	 * Extend UnparametricField<uint32> which is a representation 
-	 * of Z_2^32. It is especially fast because it uses hardware arithmetic 
+	 * Extend UnparametricField<uint32_t> which is a representation
+	 * of Z_2^32. It is especially fast because it uses hardware arithmetic
 	 * directly.  This ring is a Local Principal Ideal Ring.
 	 *
 	 * These needed PIR functions are added:
 	 * gcdin(), isUnit(), also inv() is modified to work correctly.
-	 * The type Exponent is added: more effective rep of the powers of 2, 
-	 * which are important because gcds are powers of 2).  
+	 * The type Exponent is added: more effective rep of the powers of 2,
+	 * which are important because gcds are powers of 2).
 	 * This entails some new versions of divin(), mulin(), isUnit().
 	 *
 	 * Those are the function needed for the LocalSmith algorithm.
@@ -45,39 +62,41 @@ namespace LinBox
 	 * \ingroup field
 	 */
 
-	struct Local2_32: public UnparametricField<uint32>
+	struct Local2_32: public UnparametricField<uint32_t>
 	{
 	public:
 
-		typedef UnparametricField<uint32>::Element Element;
+		typedef UnparametricField<uint32_t>::Element Element;
 		typedef enum {_min=0,_max=32} Exponent; // enum?
 		//Exponent& init(Exponent& a) { return a = 32; }
-			
-		Local2_32 (int p=2, int exp=32) :UnparametricField<uint32>(p,exp) {
-			if(p != 2) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be 2");
-			if(exp != 32) throw PreconditionFailed(__FUNCTION__,__LINE__,"exponent must be 32");
+
+		Local2_32 (int p=2, int exp=32) :
+			UnparametricField<uint32_t>(p,exp)
+		{
+			if(p != 2) throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus must be 2");
+			if(exp != 32) throw PreconditionFailed(__func__,__FILE__,__LINE__,"exponent must be 32");
 		}
 
 		/*
-		static inline Element& gcd(Element& c, Element& a, const Element& b)
-		{   c = a | b; Exponent k = 0; 
-		    while (! (c & 1)) {c >>= 1; ++k;}
-		    //gcdin (k, b);
-		    cout << "gcd called" << endl;
-		    return c = 1 << k;
+		   static inline Element& gcd(Element& c, Element& a, const Element& b)
+		   {   c = a | b; Exponent k = 0;
+		   while (! (c & 1)) {c >>= 1; ++k;}
+		//gcdin (k, b);
+		cout << "gcd called" << endl;
+		return c = 1 << k;
 		}
 
-		*/
+*/
 		// assume k is an exponent of 2.
 		static inline Exponent& gcdin(Exponent& k, const Element& b)
 		{   /*
-		      Element c = b >> k;
-		      c <<= k;
-		      Element d = b;
-		      std::cout << "c, b" << c << " " << b <<  "\n";
-		      if (c != b)  for(k = 0; ! (d & 1); ++k) d >>= 1; 
-		      std::cout << "g, b =" << (int)k << " " << b << "\n";
-		    */
+		       Element c = b >> k;
+		       c <<= k;
+		       Element d = b;
+		       std::cout << "c, b" << c << " " << b <<  "\n";
+		       if (c != b)  for(k = 0; ! (d & 1); ++k) d >>= 1;
+		       std::cout << "g, b =" << (int)k << " " << b << "\n";
+		       */
 			Element d = b;
 			int i;
 			for ( i = 0; (i < k) && (!(d&1)); ++ i) d >>= 1;
@@ -100,11 +119,11 @@ namespace LinBox
 		//Element& div(Element& c, const Element& a, const Element& b) const
 		//{   return c = NTL::rep(a)/NTL::GCD(NTL::rep(a),NTL::rep(b));   }
 		//
-		
-		static inline Element& mulin(Element& a, const Exponent& k) 
-		{  
+
+		static inline Element& mulin(Element& a, const Exponent& k)
+		{
 			if (k >= 32) return a = 0;
-			else return a <<= k;  
+			else return a <<= k;
 		}
 
 		static inline Element& mulin(Element& a, const Element& b)  {
@@ -116,14 +135,14 @@ namespace LinBox
 		}
 
 		/*
-		static inline bool isDivisor(Element a, Element b)
-		{   while (! (a ^ 1)) 
-		    {   if (b ^ 1) return false;
-		        a = a >> 1; b = b >> 1;
-		    }
-		    return true;
-		}
-		*/
+		   static inline bool isDivisor(Element a, Element b)
+		   {   while (! (a ^ 1))
+		   {   if (b ^ 1) return false;
+		   a = a >> 1; b = b >> 1;
+		   }
+		   return true;
+		   }
+		   */
 
 		// assume k is an exponent of 2 and the power of 2 exactly divides a
 		static inline Element& divin(Element& a, const Exponent& k)
@@ -132,31 +151,31 @@ namespace LinBox
 		static inline Element& inv(Element& a, const Element& b) {
 
 			if (!isUnit(b))
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"inv: not a unit");
+				throw PreconditionFailed(__func__,__FILE__,__LINE__,"inv: not a unit");
 			else {
 
 				Element g, s, t;
-				
+
 				xgcd(g, s, t, b, -b);
-				
+
 				return a = s - t;
 			}
 		}
 
-                static inline integer getMaxModulus()
-                        { return integer( "4294967296" ); } // 2^32
+		static inline integer getMaxModulus()
+		{ return integer( "4294967296" ); } // 2^32
 
 	protected:
-		
-		static  Element& xgcd(Element& d, Element& s, Element& t, const Element& a, const Element& b) 
+
+		static  Element& xgcd(Element& d, Element& s, Element& t, const Element& a, const Element& b)
 		{
-		       
+
 			Element  u, v, u0, v0, u1, v1, u2, v2, q, r;
-			
+
 			u1 = 1; v1 = 0;
 			u2 = 0; v2 = 1;
 			u = a; v = b;
-		    
+
 			while (v != 0) {
 				q = u / v;
 				//r = u % v;
@@ -170,8 +189,8 @@ namespace LinBox
 				u1 = u0;
 				v1 = v0;
 			}
-		    
-		    
+
+
 			d = u;
 			s = u1;
 			t = v1;
@@ -182,126 +201,127 @@ namespace LinBox
 			/*
 
 			//Element  u, v, u0, v0, u1, v1, u2, v2, q, r;
-			
+
 			Element u, v, q, r;
-			
-			int64  u0, u1, u2;
-			
+
+			int64_t  u0, u1, u2;
+
 			u1 = 1; //v1 = 0;
 			u2 = 0; //v2 = 1;
 			u = a; v = b;
-		    
+
 			if ( b == 0) {
-				s = 1;
-				t = 0;
-				return d = a ;
+			s = 1;
+			t = 0;
+			return d = a ;
 			}
-			
+
 			if (v != 0) {
-				q = u / v;
-				//r = u % v;
-				r = u - q*v;
-				u = v;
-				v = r;
-				u0 = u2;
-				//v0 = v2;
-				u2 =  u1 - q * u2;
-				//v2 = v1- q * v2;
-				u1 = u0;
-				//v1 = v0;
-				
+			q = u / v;
+			//r = u % v;
+			r = u - q*v;
+			u = v;
+			v = r;
+			u0 = u2;
+			//v0 = v2;
+			u2 =  u1 - q * u2;
+			//v2 = v1- q * v2;
+			u1 = u0;
+			//v1 = v0;
+
 			}
 
 			while (v != 0) {
-				r = u;
-				while ( r >= v) {
-					r = u - v;
-					
-					u2 = u1 - u2;
-				}
-				u0 = u2;
-				u1 = u0;
-				u = v;
-				v = r;
-				
-				
-			}	
-				
-			
+			r = u;
+			while ( r >= v) {
+			r = u - v;
+
+			u2 = u1 - u2;
+			}
+			u0 = u2;
+			u1 = u0;
+			u = v;
+			v = r;
+
+
+			}
+
+
 			while (v != 0) {
-				q = u / v;
-				//r = u % v;
-				r = u - q*v;
-				u = v;
-				v = r;
-				
-				u0 = u2;
-				//v0 = v2;
-				u2 =  u1 - q * u2;
-				//v2 = v1- q * v2;
-				u1 = u0;
-				//v1 = v0;
+			q = u / v;
+			//r = u % v;
+			r = u - q*v;
+			u = v;
+			v = r;
+
+			u0 = u2;
+			//v0 = v2;
+			u2 =  u1 - q * u2;
+			//v2 = v1- q * v2;
+			u1 = u0;
+			//v1 = v0;
 			}
-			
-		    
+
+
 			d = u;
 			s = u1;
-			
-			t = ((int64) d - u1 * (int64) a) / (int64)b;
+
+			t = ((int64_t) d - u1 * (int64_t) a) / (int64_t)b;
 
 			//std::cout << "XGCD is called: d, s, t, a, b, sa + tb: " << d << ' '
 			//<< s << ' ' << t << ' ' << a << ' ' << b << ' ' << s * a + t * b << '\n';
 			return d;
-			
-			
+
+
 			*/
 		}
-		
 
-		/** @brief 
+
+		/** @brief
 		 * Half GCD
 		 * g = gcd (a, b).
 		 * exists t, such that: s * a + t * b = g.
 		 * return g.
 		 */
 		static Element& HGCD (Element& g, Element& s, const Element& a, const  Element& b) {
-			
+
 			Element  u, v, u0, u1, u2, q, r;
-			
+
 			u1 = 1;
 			u2 = 0;
 			u = a; v = b;
-		    
+
 			while (v != 0) {
 				q = u / v;
 				//r = u % v;
 				r = u - q*v;
 				u = v;
 				v = r;
-				
+
 				u0 = u2;
-				
+
 				u2 =  u1 - q*u2;
-				
+
 				u1 = u0;
-				
+
 			}
-		    
-		    
+
+
 			g = u;
 			s = u1;
 
-			return g;	
-	    
+			return g;
+
 		}
 
 	};
 
-        template<>
+	template<>
 	bool FieldTraits< Local2_32 >::goodModulus( const integer& i ) {
 		return i == Local2_32::getMaxModulus();
 	}
-		
+
 } // namespace LinBox
 
-#endif // __LOCAL2_32_H
+#endif // __LINBOX_local2_32_H
+
diff --git a/linbox/field/map.h b/linbox/field/map.h
new file mode 100644
index 0000000..8671657
--- /dev/null
+++ b/linbox/field/map.h
@@ -0,0 +1,108 @@
+/* -*- 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
+/* Copyright (C) 2008 LinBox
+ * Written by JGD
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __LINBOX_map_H
+#define __LINBOX_map_H
+
+#include "linbox/field/hom.h"
+
+namespace LinBox
+{
+
+	template< class Source, class Target >
+	struct Map {
+
+		typedef Hom<Source,Target> Homomorphism;
+
+		Map(const Homomorphism& H) :
+			_hom(H)
+		{}
+		Map(const Source& S, const Target& T) :
+			_hom(S,T)
+		{}
+
+
+		template< typename ContainerTargetElement,
+		typename ContainerSourceElement >
+		ContainerTargetElement& operator() (
+						    ContainerTargetElement& tgt,
+						    const ContainerSourceElement& src)
+		{
+
+			tgt.resize(src.size());
+			typename ContainerTargetElement::iterator tgt_it(tgt.begin());
+			typename ContainerSourceElement::const_iterator src_it(src.begin());
+
+			for( ; src_it != src.end(); ++src_it, ++tgt_it)
+				this->_hom.image (*tgt_it, *src_it);
+
+			return tgt;
+		}
+
+
+	private:
+		Homomorphism _hom;
+	};
+
+
+	template< class Source, class Target >
+	struct PreMap {
+
+		typedef Hom<Source,Target> Homomorphism;
+
+		PreMap(const Homomorphism& H) :
+			_hom(H)
+		{}
+		PreMap(const Source& S, const Target& T) :
+			_hom(S,T)
+		{}
+
+		template< typename ContainerSourceElement,
+		typename ContainerTargetElement >
+		ContainerSourceElement& operator() (
+						    ContainerSourceElement& src,
+						    ContainerTargetElement tgt)
+		{
+
+			src.resize(tgt.size());
+			typename ContainerSourceElement::iterator src_it(src.begin());
+			typename ContainerTargetElement::const_iterator tgt_it(tgt.begin());
+
+			for( ; tgt_it != tgt.end(); ++src_it, ++tgt_it) {
+				this->_hom.preimage (*src_it, *tgt_it);
+			}
+
+			return src;
+		}
+
+
+	private:
+		Homomorphism _hom;
+	};
+
+
+}
+
+#endif // __LINBOX_map_H
+
diff --git a/linbox/field/modular-balanced-double.h b/linbox/field/modular-balanced-double.h
index e69539c..b2ec674 100644
--- a/linbox/field/modular-balanced-double.h
+++ b/linbox/field/modular-balanced-double.h
@@ -1,22 +1,29 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* linbox/field/modular-double.h
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* linbox/field/modular-balanced-double.h
  * Copyright (C) 2003 Pascal Giorgi
- *               2008 Clement Pernet
- * Written by Clement Pernet <clement.pernet at gmail.com>
- *            Pascal Giorgi <pascal.giorgi at ens-lyon.fr>
+ *               2005,2008 Clement Pernet
+ * Written by Pascal Giorgi <pascal.giorgi at ens-lyon.fr>
+ * and Clement Pernet <Clement.Pernet at imag.fr>
  *
  * ------------------------------------
  *
  * See COPYING for license information.
  */
 
+/*! @file field/modular-balanced-double.h
+ * @ingroup field
+ * @brief Balanced representation of <code>Z/mZ</code> over \c double .
+ */
 
+#ifndef __LINBOX_modular_balanced_double_H
+#define __LINBOX_modular_balanced_double_H
 
-
-#ifndef __LINBOX_MODULAR_BALANCED_DOUBLE_H
-#define __LINBOX_MODULAR_BALANCED_DOUBLE_H
-
+#ifdef __INTEL_COMPILER
+#define FmodF fmodf
+#else
+#define FmodF fmod
+#endif
 
 #include "linbox/linbox-config.h"
 #include "linbox/integer.h"
@@ -30,406 +37,241 @@
 #include "linbox/randiter/modular-balanced.h"
 #include "linbox/randiter/nonzero.h"
 
+#include "fflas-ffpack/field/modular-balanced-double.h"
+
 
 // Namespace in which all LinBox code resides
-namespace LinBox { 
-	
+namespace LinBox
+{
+
 	template< class Element >
 	class ModularBalanced;
 
 	template <class Ring>
-	struct ClassifyRing; 
+	struct ClassifyRing;
 
 	template <class Element>
 	struct ClassifyRing<ModularBalanced<Element> >;
 
 	template <>
-	struct ClassifyRing<ModularBalanced<double> >{
+	struct ClassifyRing<ModularBalanced<double> > {
 		typedef RingCategories::ModularTag categoryTag;
 	};
 
 	class MultiModDouble;
-	
-	/// \ingroup field
-	template <>
-	class ModularBalanced<double> : public FieldInterface {
 
-	protected:
+	/*! \ingroup modular
+	 * Centered representation of \f$\mathbf{Z}/m\mathbf{Z}\f$.
+	 * If \c m is the modulus, then elements are represented in \f[ \left
+	 * \llbracket \left \lceil -\frac{m-1}{2} \right \rceil, \left \lceil
+	 * \frac{m-1}{2} \right \rceil \right \rrbracket.\f] This
+	 * representation allows more accumulations before a reduction is
+	 * necessary, at the cost of a more expensive reduction.
+	 */
+	template<>
+	class ModularBalanced<double> : public FieldInterface,
+	      public FFPACK::ModularBalanced<double> {
+
+	      protected:
+
+	      public:
+		      friend class FieldAXPY<ModularBalanced<double> >;
+		      friend class DotProductDomain<ModularBalanced<double> >;
+		      friend class MultiModDouble;
+
+		      typedef double Element;
+		      typedef ModularBalancedRandIter<double> RandIter;
+		      typedef NonzeroRandIter<ModularBalanced<double>, RandIter > NonZeroRandIter;
+
+		      static ClassifyRing <ModularBalanced<double> >::categoryTag getCategory()
+		      {
+			      return ClassifyRing<ModularBalanced<double> >::categoryTag();
+		      }
+
+		      ModularBalanced (const integer& p) :
+			      FFPACK::ModularBalanced<double>((unsigned long)p)
+		      {
+#ifdef DEBUG
+			      if (p > (integer) ULONG_MAX)
+				      throw PreconditionFailed(__func__,__FILE__,__LINE__,"prime too big");
+			      if(modulus <= 1)
+				      throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus must be > 1");
+			      if(modulus > getMaxModulus())
+				      throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus is too big");
+#endif
+
+		      }
+
+		      integer &cardinality (integer &c) const
+		      {
+			      return c = integer(modulus);
+		      }
+
+		      integer &characteristic (integer &c) const
+		      {
+			      return c = integer(modulus);
+		      }
+
+		      long unsigned characteristic(long unsigned int&p) const { return FFPACK::ModularBalanced<double>::characteristic(p) ; }
+		      double & convert(double &x, const Element &y) const { return FFPACK::ModularBalanced<double>::convert(x,y) ; }
+		      float & convert(float&x, const Element &y) const { return FFPACK::ModularBalanced<double>::convert(x,y) ; }
+		      unsigned long characteristic()const{return FFPACK::ModularBalanced<double>::characteristic();}
+		      unsigned long cardinality()const{return FFPACK::ModularBalanced<double>::cardinality();}
+
+		      integer &convert (integer &x, const Element &y) const
+		      {
+			      return x = integer (y);
+		      }
+
+		      Element &init (Element &x, const integer &y) const
+		      {
+			      x = (Element)(y%lmodulus);
+			      if (x<mhalf_mod) return x += modulus ;
+			      else if (x>half_mod) return x -= modulus ;
+			      return  x ;
+		      }
+
+		      //! @bug faux si modulus==2
+		      inline bool isMinusOne (const Element &x) const
+		      {
+			      return (x == -1.);
+		      }
+
+		      unsigned long AccBound(const Element&r) const
+		      {
+			      Element one, zero ; init(one,1UL) ; init(zero,0UL);
+			      double max_double = (double) (1ULL<<DBL_MANT_DIG) - modulus ;
+			      double p = std::max(half_mod,-mhalf_mod) ;
+			      if (areEqual(zero,r))
+				      return (unsigned long) (double(max_double)/p) ;
+			      else if (areEqual(one,r))
+			      {
+				      if (modulus>= getMaxModulus())
+					      return 0 ;
+				      else
+					      return (unsigned long) (double(max_double)/(p*p)) ;
+			      }
+			      else
+				      throw LinboxError("Bad input, expecting 0 or 1");
+			      return 0;
+		      }
+
+	      };
+
+	//! Specialization  of FieldAXPY.
+	template <>
+	class FieldAXPY<ModularBalanced<double> > {
+	public:
 
-		double  modulus;
-		double half_mod;
-		unsigned long   lmodulus;
-		
-	public:	       
-		friend class FieldAXPY<ModularBalanced<double> >;
-		friend class DotProductDomain<ModularBalanced<double> >;
-		friend class MultiModDouble;
-			       
 		typedef double Element;
-		typedef ModularBalancedRandIter<double> RandIter;
-		typedef NonzeroRandIter<ModularBalanced<double>,RandIter> NonZeroRandIter;
+		typedef ModularBalanced<double> Field;
 
-		static ClassifyRing <ModularBalanced<double> >::categoryTag
-		getCategory() {
-			return ClassifyRing<ModularBalanced<double> >::categoryTag();
-		}
+		FieldAXPY (const Field &F) :
+			_F (F),
+			_y(0.) , _bound( (double) ((1ULL << 53) - (int) (_F.modulus*_F.modulus)))
+		{}
 
-		ModularBalanced () {}
+		FieldAXPY (const FieldAXPY &faxpy) :
+			_F (faxpy._F),
+			_y(faxpy._y), _bound(faxpy._bound)
+		{}
 
-		ModularBalanced (int32 p, int exp = 1)  : modulus((double)p),
-							  half_mod( (p-1.)/2),
-							  lmodulus (p) 
+		FieldAXPY<ModularBalanced<double> > &operator = (const FieldAXPY &faxpy)
 		{
-			if(modulus <= 1)
-				throw PreconditionFailed(__FUNCTION__,
-							 __LINE__,
-							 "modulus must be > 1");
-			if( exp != 1 ) throw PreconditionFailed(__FUNCTION__,
-								__LINE__,
-								"exponent must be 1");
-			integer max;
-			if (modulus > (double) FieldTraits<ModularBalanced<double> >::maxModulus(max))
-				throw PreconditionFailed (__FUNCTION__,
-							  __LINE__,
-							  "modulus is too big");
-		}
-
-		ModularBalanced (double p) : modulus (p),
-					     half_mod ((p-1)/2),
-					     lmodulus ((unsigned long)p) {
-			if (modulus <= 1)
-				throw PreconditionFailed(__FUNCTION__,
-							 __LINE__,
-							 "modulus must be > 1");
-			integer max;
-			if (modulus > (double) FieldTraits<ModularBalanced<double> >::maxModulus(max))
-				throw PreconditionFailed (__FUNCTION__,
-							  __LINE__,
-							  "modulus is too big");
-		}
-
-		ModularBalanced (long int p) : modulus((double)p),
-					       half_mod ((p-1)/2),
-					       lmodulus(p) {
-			if ((double) modulus <= 1)
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
-			integer max;
-			if ((double) modulus > (double) FieldTraits<ModularBalanced<double> >::maxModulus(max))
-				throw PreconditionFailed (__FUNCTION__,
-							  __LINE__,
-							  "modulus is too big");
-		}
-
-		ModularBalanced (const integer& p) : modulus((double) p),
-						     half_mod ((p-1)/2),
-						     lmodulus(p){
-			if(modulus <= 1)
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
-	             	if(modulus > getMaxModulus())
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus is too big");
-				
-		}
-
-		ModularBalanced (const ModularBalanced<double>& mf) :
-			modulus (mf.modulus),
-			half_mod (mf.half_mod),
-			lmodulus (mf.lmodulus) {}
-
-		const ModularBalanced &operator= (const ModularBalanced<double> &F) {
-			modulus = F.modulus;
-			half_mod = F.half_mod;
-			lmodulus= F.lmodulus;
+			_F = faxpy._F;
+			_y= faxpy._y;
+			_bound= faxpy._bound;
 			return *this;
 		}
 
-	
-		inline integer &cardinality (integer &c) const{ 
-			return c = integer(modulus);
-		}
-
-		inline integer &characteristic (integer &c) const {
-			return c = integer(modulus); 
-		}
-
-		inline integer &convert (integer &x, const Element &y) const { 
-			if ( y < 0. ) return x = integer (y + modulus) ;
-			else return x = integer (y);
-		}
-
-		inline double &convert (double &x, const Element& y) const {
-			return x=y;
-		}
-		
-		std::ostream &write (std::ostream &os) const {
-			return os << "double mod " << int(modulus);
-		}
-		
-		std::istream &read (std::istream &is) {
-			is >> modulus; 
-			if(modulus <= 1) 
-				throw PreconditionFailed (__FUNCTION__,
-							 __LINE__,
-							  "modulus must be > 1");
-		 	if(modulus > getMaxModulus()) 
-				throw PreconditionFailed (__FUNCTION__,
-							 __LINE__,
-							 "modulus is too big");
-			return is;
-		}
-		
-		std::ostream &write (std::ostream &os, const Element &x) const {
-			return os << int(x);
-		}
-
-		std::istream &read (std::istream &is, Element &x) const {
-			integer tmp;
-                            // JGD : should'nt it be double tmp ???
-			is >> tmp;
-			init(x,tmp); 
-			return is;
-		}
-		
-
-		inline Element &init (Element &x, const integer &y) const  {
-// 			return x = (Element)mpz_fdiv_ui(y.get_mpz(),lmodulus );
-			return x = (Element)(y%lmodulus);
-		}
-
-		inline Element& init(Element& x, const double y =0) const {		  
-
-			x = fmod (y, modulus);
-			if (x > half_mod) return   x -= modulus;
-			else if (x < - half_mod) return x += modulus;
-			else return x;
-		}
-		
-		inline Element& assign(Element& x, const Element& y) const {
-			return x = y;
-		}
-		
-		inline bool areEqual (const Element &x, const Element &y) const {
-			return x == y;
-		}
-
-		inline  bool isZero (const Element &x) const {
-			return x == 0.; 
-		}
-		
-		inline bool isOne (const Element &x) const {
-			return x == 1.; 
-		}
-
-		inline bool isMinusOne (const Element &x) const {
-			return (x == -1.); 
-		}
-
-		inline Element &add (Element &x,
-				     const Element &y,
-				     const Element &z) const {
-			x = y + z;
-			if ( x > half_mod ) return x -= modulus;
-			if ( x < -half_mod ) return x += modulus;
-			return x;
-		}
- 
-		inline Element &sub (Element &x,
-				     const Element &y,
-				     const Element &z) const {
-			x = y - z;
-			if (x > half_mod) return x -= modulus;
-			if (x < -half_mod) return x += modulus;
-			return x;
-		}
-		
-		inline Element &mul (Element &x, const Element &y, const Element &z) const {		
-			x = y * z;
-			return init (x,x);
-		}
- 
-		inline Element &div (Element &x, const Element &y, const Element &z) const {
-			Element temp;
-			inv (temp, z);
-			return mul (x, y, temp);
-		}
- 
-		inline Element &neg (Element &x, const Element &y) const {
-			return x = -y;
-		}
- 
-		inline Element &inv (Element &x, const Element &y) const {
-			// The extended Euclidean algoritm 
-			int x_int, y_int, q, tx, ty, temp;
-			x_int = int (modulus);
-			y_int = (y < 0.) ? int(y + modulus) : int(y);
-			tx = 0; 
-			ty = 1;
-		  
-			while (y_int != 0) {
-				// always: gcd (modulus,residue) = gcd (x_int,y_int)
-				//         sx*modulus + tx*residue = x_int
-				//         sy*modulus + ty*residue = y_int
-				q = x_int / y_int; // integer quotient
-				temp = y_int; y_int = x_int - q * y_int;
-				x_int = temp;
-				temp = ty; ty = tx - q * ty;
-				tx = temp;
-			}
-			if (tx > half_mod ) return x = tx - modulus;
-			if ( tx < -half_mod ) return x = tx + modulus;
-			return x = (double) tx;
-		}
-
-		inline Element &axpy (Element &r, 
-				      const Element &a, 
-				      const Element &x, 
-				      const Element &y) const {
-			r = a * x + y;
-			return init (r, r);
+		inline Element& mulacc (const Element &a, const Element &x)
+		{
+			//                 Element tmp= a*x;
+			//                 return accumulate(tmp);
+			return accumulate(a*x);
 		}
 
-		inline Element &addin (Element &x, const Element &y) const {
-			x += y;
-			if ( x > half_mod ) return x -= modulus;
-			if ( x < -half_mod ) return x += modulus; 
-			return x;
-		}
- 
-		inline Element &subin (Element &x, const Element &y) const {
-			x -= y;
-			if ( x > half_mod ) return x -= modulus;
-			if ( x < -half_mod ) return x += modulus; 
-			return x;
-		}
- 
-		inline Element &mulin (Element &x, const Element &y) const {
-			return mul(x,x,y);
-		}
- 
-		inline Element &divin (Element &x, const Element &y) const {
-			return div(x,x,y);
-		}
- 
-		inline Element &negin (Element &x) const {
-			return x = -x;
-		}
-		
-		inline Element &invin (Element &x) const {
-			return inv (x, x);
+		inline Element& accumulate (const Element &tmp)
+		{
+			_y += tmp;
+			if (_y > _bound)
+				return _y = fmod (_y, _F.modulus);
+			else
+				return _y;
 		}
-		
-		inline Element &axpyin (Element &r, const Element &a, const Element &x) const {
-			r += a * x;
-			return init (r, r);
+		inline Element& subumulate (const Element &tmp)
+		{
+			_y -= tmp;
+			if (_y < 0)
+				return _y += _F.modulus;
+			else
+				return _y;
 		}
 
-		static inline double getMaxModulus()
-			{ return 67108864.0; } // 2^26 
-		
-	};
-
-	template <>
-	class FieldAXPY<ModularBalanced<double> > {	  
-	public:
-	  
-		typedef double Element;
-		typedef ModularBalanced<double> Field;
-	  
-		FieldAXPY (const Field &F) : _F (F),
-					     _y(0.) , _bound( (double) ((1ULL << 53) - (int) (_F.modulus*_F.modulus))) {}
-	  
-		FieldAXPY (const FieldAXPY &faxpy) : _F (faxpy._F),
-		_y(faxpy._y), _bound(faxpy._bound) {}
-	  
-		FieldAXPY<ModularBalanced<double> > &operator = (const FieldAXPY &faxpy) {
-			_F = faxpy._F; 
-			_y= faxpy._y;
-			_bound= faxpy._bound;
-			return *this; 
-		}
-	  
-            inline Element& mulacc (const Element &a, const Element &x) {
-//                 Element tmp= a*x;	
-//                 return accumulate(tmp);
-                return accumulate(a*x);
-            }
-            
-            inline Element& accumulate (const Element &tmp) {   
-                _y += tmp;
-                if (_y > _bound)
-                    return _y = fmod (_y, _F.modulus);
-                else
-                    return _y;
-            }
-            inline Element& subumulate (const Element &tmp) {   
-                _y -= tmp;
-                if (_y < 0)
-                    return _y += _F.modulus;
-                else
-                    return _y;
-            }
-	  
 		inline Element& get (Element &y) {
 			_y = fmod (_y, _F.modulus);
 			return y=_y ;
 		}
-	  
+
 		inline FieldAXPY &assign (const Element y) {
-			_y = y; 
+			_y = y;
 			return *this;
 		}
 
 		inline void reset() {
 			_y = 0.;
 		}
-            
-            inline Element& set (const Element &tmp) {   
-                _y = tmp;
-                if (_y > _bound)
-                    return _y = fmod (_y, _F.modulus);
-                else
-                    return _y;
-            }
-	  
+
+		inline Element& set (const Element &tmp) {
+			_y = tmp;
+			if (_y > _bound)
+				return _y = fmod (_y, _F.modulus);
+			else
+				return _y;
+		}
+
 	private:
-	  
+
 		Field _F;
 		double _y;
-		double _bound;		
+		double _bound;
 	};
-	
-	
+
+
+	//! Specialization  of DotProductDomain.
 	template <>
 	class DotProductDomain<ModularBalanced<double> > : private virtual VectorDomainBase<ModularBalanced<double> > {
 	private:
 		double _bound;
 		size_t _nmax;
-	  
-	public:	  
-		typedef double Element;	  
-		DotProductDomain (const ModularBalanced<double> &F)
-			: VectorDomainBase<ModularBalanced<double> > (F), _bound( (double) ( (1ULL<<53) - (int) (_F.modulus*_F.modulus)))
-			{
-				_nmax= (size_t)floor((double(1<<26)* double(1<<26)*2.)/ (_F.modulus * _F.modulus));
-			}
-	  
+
+	public:
+		typedef double Element;
+		DotProductDomain (const ModularBalanced<double> &F) :
+			VectorDomainBase<ModularBalanced<double> > (F), _bound( (double) ( (1ULL<<53) - (int) (_F.modulus*_F.modulus)))
+		{
+			_nmax= (size_t)floor((double(1<<26)* double(1<<26)*2.)/ (_F.modulus * _F.modulus));
+		}
+
 	protected:
 		template <class Vector1, class Vector2>
-		inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const {
-	    
+		inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
+
 			double y = 0.;
 			double t = 0.;
 			if (v1.size() < _nmax) {
 				for (size_t i = 0; i< v1.size();++i)
-					y += v1[i] * v2[i] ;				
+					y += v1[i] * v2[i] ;
 				y = fmod(y, _F.modulus);
 			}
-			else{			
+			else{
 				size_t i=0;
 				for (;i< v1.size()- _nmax ;i=i+_nmax){
 					for (size_t j=i;j<i+_nmax;++j)
 						y += v1[j] * v2[j];
 					t+=fmod(y, _F.modulus);
-					y=0.;							
+					y=0.;
 				}
 				for (;i < v1.size();++i)
 					y += v1[i] * v2[i];
@@ -440,24 +282,25 @@ namespace LinBox {
 		}
 
 		template <class Vector1, class Vector2>
-		inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const {		  
-				    
+		inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
+
 			double y = 0.;
 			double t =0.;
-			
+
 
 			if (v1.first.size() < _nmax) {
 				for (size_t i=0;i<v1.first.size();++i)
 					y+= v1.second[i] * v2[v1.first[i]];
 				y = fmod(y, _F.modulus);
 			}
-			else {			
+			else {
 				size_t i=0;
 				for (;i< v1.first.size()- _nmax ;i=i+_nmax){
 					for (size_t j=i;j<i+_nmax;++j)
 						y += v1.second[j] * v2[v1.first[j]];
 					t+=fmod(y, _F.modulus);
-					y=0.;							
+					y=0.;
 				}
 				for (;i < v1.first.size();++i)
 					y += v1.second[i] * v2[v1.first[i]];
@@ -469,4 +312,5 @@ namespace LinBox {
 	};
 }
 
-#endif
+#endif //__LINBOX_modular_balanced_double_H
+
diff --git a/linbox/field/modular-balanced-float.h b/linbox/field/modular-balanced-float.h
index f062e4f..e550bf7 100644
--- a/linbox/field/modular-balanced-float.h
+++ b/linbox/field/modular-balanced-float.h
@@ -1,22 +1,29 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* linbox/field/modular-float.h
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* field/modular-balanced-float.h
  * Copyright (C) 2003 Pascal Giorgi
- *               2008 Clement Pernet
+ *               2005,2008 Clement Pernet
  * Written by Clement Pernet <clement.pernet at gmail.com>
  *            Pascal Giorgi <pascal.giorgi at ens-lyon.fr>
- *
+ * Modified   Brice Boyer <bboyer at imag.fr>
  * ------------------------------------
  *
  * See COPYING for license information.
  */
 
+/*! @file field/modular-balanced-float.h
+ * @ingroup field
+ * @brief Balanced  representation of <code>Z/mZ</code> over \c float .
+ */
 
+#ifndef __LINBOX_modular_balanced_float_H
+#define __LINBOX_modular_balanced_float_H
 
-
-#ifndef __LINBOX_MODULAR_BALANCED_FLOAT_H
-#define __LINBOX_MODULAR_BALANCED_FLOAT_H
-
+#ifdef __INTEL_COMPILER
+#define FmodF fmodf
+#else
+#define FmodF fmod
+#endif
 
 #include "linbox/linbox-config.h"
 #include "linbox/integer.h"
@@ -27,454 +34,280 @@
 #include "linbox/util/debug.h"
 #include <math.h>
 #include <linbox/field/field-traits.h>
+#include "linbox/randiter/modular-balanced.h"
+#include "linbox/randiter/nonzero.h"
 
-
+#include "fflas-ffpack/field/modular-balanced-float.h"
 
 
 // Namespace in which all LinBox code resides
-namespace LinBox { 
-	
-	template< class Element >
-	class ModularBalanced;
+namespace LinBox
+{
 
 	template< class Element >
-	class ModularBalancedRandIter;
-
-	template <class Field, class RandIter>
-	class NonZeroRandIter;
+	class ModularBalanced;
 
 	template <class Ring>
-	struct ClassifyRing; 
+	struct ClassifyRing;
 
 	template <class Element>
 	struct ClassifyRing<ModularBalanced<Element> >;
 
 	template <>
-	struct ClassifyRing<ModularBalanced<float> >{
+	struct ClassifyRing<ModularBalanced<float> > {
 		typedef RingCategories::ModularTag categoryTag;
 	};
 
 	class MultiModFloat;
-	
+
 	/// \ingroup field
 	template <>
-	class ModularBalanced<float> : public FieldInterface {
+	class ModularBalanced<float> : public FieldInterface,
+	      public FFPACK::ModularBalanced<float> {
+	      public :
+		      typedef float Element;
+
+	      protected:
+
+	      public:
+		      friend class FieldAXPY<ModularBalanced<Element> >;
+		      friend class DotProductDomain<ModularBalanced<Element> >;
+		      friend class MultiModFloat;
+
+		      typedef ModularBalancedRandIter<Element> RandIter;
+		      typedef NonzeroRandIter<ModularBalanced<Element>, RandIter > NonZeroRandIter;
+
+		      static ClassifyRing <ModularBalanced<Element> >::categoryTag
+		      getCategory()
+		      {
+			      return ClassifyRing<ModularBalanced<Element> >::categoryTag();
+		      }
+
+		      ModularBalanced (const integer& p) :
+			      FFPACK::ModularBalanced<float>((unsigned long)p)
+		      {
+#ifdef DEBUG
+			      if(modulus <= 1)
+				      throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus must be > 1");
+			      if(modulus > getMaxModulus())
+				      throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus is too big");
+			      // check integer not too big.
+#endif
 
-	protected:
+		      }
+
+
+		      inline integer &cardinality (integer &c) const
+		      {
+			      return c = integer(modulus);
+		      }
+
+		      inline integer &characteristic (integer &c) const
+		      {
+			      return c = integer(modulus);
+		      }
+
+		      long unsigned characteristic(long unsigned int&p)const{return FFPACK::ModularBalanced<float>::characteristic(p) ; }
+		      unsigned long characteristic()const{return FFPACK::ModularBalanced<float>::characteristic();}
+		      unsigned long cardinality()const{return FFPACK::ModularBalanced<float>::cardinality();}
+		      double&convert(double &x,const Element&y)const{return FFPACK::ModularBalanced<float>::convert(x,y) ; }
+		      float&convert(float&x,const Element&y)const{return FFPACK::ModularBalanced<float>::convert(x,y) ; }
+
+
+		      inline integer &convert (integer &x, const Element &y) const
+		      {
+			      // if ( y < 0. )
+				      // return x = integer (y + modulus) ;
+			      // else
+				      return x = integer (y);
+		      }
+
+
+		      inline Element &init (Element &x, const integer &y) const
+		      {
+			      x = (Element)(y%lmodulus);
+			      if (x > half_mod) return   x -= modulus;
+			      else if (x < mhalf_mod) return x += modulus;
+
+			      return x;
+		      }
+
+		      inline bool isMinusOne (const Element &x) const
+		      {
+			      return (x == -1.);
+		      }
+
+		      unsigned long AccBound(const Element&r) const
+		      {
+			      Element one, zero ; init(one,1UL) ; init(zero,0UL);
+			      double max_double = (double) (1ULL<<FLT_MANT_DIG) - modulus ;
+			      double p = std::max(half_mod,-mhalf_mod) ;
+			      if (areEqual(zero,r))
+				      return (unsigned long) (double(max_double)/p) ;
+			      else if (areEqual(one,r))
+			      {
+				      if (modulus>= getMaxModulus())
+					      return 0 ;
+				      else
+					      return (unsigned long) (double(max_double)/(p*p)) ;
+			      }
+			      else
+				      throw LinboxError("Bad input, expecting 0 or 1");
+			      return 0;
+		      }
+
+	      };
 
-		float  modulus;
-		float half_mod;
-		unsigned long   lmodulus;
-		
-	public:	       
-		friend class FieldAXPY<ModularBalanced<float> >;
-		friend class DotProductDomain<ModularBalanced<float> >;
-		friend class MultiModFloat;
-			       
+	template <>
+	class FieldAXPY<ModularBalanced<float> > {
+	public:
 		typedef float Element;
-		typedef ModularBalancedRandIter<float> RandIter;
-		typedef NonzeroRandIter<ModularBalanced<float>,ModularBalancedRandIter<float> > NonZeroRandIter;
-
-		static ClassifyRing <ModularBalanced<float> >::categoryTag
-		getCategory() {
-			return ClassifyRing<ModularBalanced<float> >::categoryTag();
-		}
-
-		ModularBalanced () {}
+		typedef ModularBalanced<Element> Field;
 
-		ModularBalanced (int32 p, int exp = 1)  : modulus((float)p),
-							  half_mod( (p-1.)/2),
-							  lmodulus (p) 
-		{
-			if(modulus <= 1)
-				throw PreconditionFailed(__FUNCTION__,
-							 __LINE__,
-							 "modulus must be > 1");
-			if( exp != 1 ) throw PreconditionFailed(__FUNCTION__,
-								__LINE__,
-								"exponent must be 1");
-			integer max;
-			if (modulus > (float) FieldTraits<ModularBalanced<float> >::maxModulus(max))
-				throw PreconditionFailed (__FUNCTION__,
-							  __LINE__,
-							  "modulus is too big");
-		}
+		FieldAXPY (const Field &F) :
+			_F (F),
+			_y(0.) , _bound( (Element) (((1ULL << 24) - (int) (_F.modulus*_F.modulus))))
+		{}
 
-		ModularBalanced (float p) : modulus (p),
-					     half_mod ((p-1)/2),
-					     lmodulus ((unsigned long)p) {
-			if (modulus <= 1)
-				throw PreconditionFailed(__FUNCTION__,
-							 __LINE__,
-							 "modulus must be > 1");
-			integer max;
-			if (modulus > (float) FieldTraits<ModularBalanced<float> >::maxModulus(max))
-				throw PreconditionFailed (__FUNCTION__,
-							  __LINE__,
-							  "modulus is too big");
-		}
+		FieldAXPY (const FieldAXPY &faxpy) :
+			_F (faxpy._F),
+			_y(faxpy._y), _bound(faxpy._bound)
+		{}
 
-		ModularBalanced (long int p) : modulus((float)p),
-					       half_mod ((p-1)/2),
-					       lmodulus(p) {
-			if ((float) modulus <= 1)
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
-			integer max;
-			if ((float) modulus > (float) FieldTraits<ModularBalanced<float> >::maxModulus(max))
-				throw PreconditionFailed (__FUNCTION__,
-							  __LINE__,
-							  "modulus is too big");
-		}
-
-		ModularBalanced (const integer& p) : modulus((float) p),
-						     half_mod ((p-1)/2),
-						     lmodulus(p){
-			if(modulus <= 1)
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
-	             	if(modulus > getMaxModulus())
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus is too big");
-				
-		}
-
-		ModularBalanced (const ModularBalanced<float>& mf) :
-			modulus (mf.modulus),
-			half_mod (mf.half_mod),
-			lmodulus (mf.lmodulus) {}
-
-		const ModularBalanced &operator= (const ModularBalanced<float> &F) {
-			modulus = F.modulus;
-			half_mod = F.half_mod;
-			lmodulus= F.lmodulus;
+		FieldAXPY<ModularBalanced<Element> > &operator = (const FieldAXPY &faxpy) {
+			_F = faxpy._F;
+			_y= faxpy._y;
+			_bound= faxpy._bound;
 			return *this;
 		}
 
-	
-		inline integer &cardinality (integer &c) const{ 
-			return c = integer(modulus);
-		}
-
-		inline integer &characteristic (integer &c) const {
-			return c = integer(modulus); 
-		}
-
-		inline integer &convert (integer &x, const Element &y) const { 
-			if ( y < 0. ) return x = integer (y + modulus) ;
-			else return x = integer (y);
-		}
-
-		inline float &convert (float &x, const Element& y) const {
-			return x=y;
-		}
-		
-		std::ostream &write (std::ostream &os) const {
-			return os << "float mod " << int(modulus);
-		}
-		
-		std::istream &read (std::istream &is) {
-			is >> modulus; 
-			if(modulus <= 1) 
-				throw PreconditionFailed (__FUNCTION__,
-							 __LINE__,
-							  "modulus must be > 1");
-		 	if(modulus > getMaxModulus()) 
-				throw PreconditionFailed (__FUNCTION__,
-							 __LINE__,
-							 "modulus is too big");
-			return is;
-		}
-		
-		std::ostream &write (std::ostream &os, const Element &x) const {
-			return os << int(x);
-		}
-
-		std::istream &read (std::istream &is, Element &x) const {
-			integer tmp;
-                            // JGD : should'nt it be float tmp ???
-			is >> tmp;
-			init(x,tmp); 
-			return is;
-		}
-		
-
-		inline Element &init (Element &x, const integer &y) const  {
-// 			return x = (Element)mpz_fdiv_ui(y.get_mpz(),lmodulus );
-			return x = (Element)(y%lmodulus);
-		}
-
-		inline Element& init(Element& x, const float y =0) const {		  
-
-			x = fmod (y, modulus);
-			if (x > half_mod) return   x -= modulus;
-			else if (x < - half_mod) return x += modulus;
-			else return x;
-		}
-		
-		inline Element& assign(Element& x, const Element& y) const {
-			return x = y;
-		}
-		
-		inline bool areEqual (const Element &x, const Element &y) const {
-			return x == y;
+		inline Element& mulacc (const Element &a, const Element &x) {
+			//                 Element tmp= a*x;
+			//                 return accumulate(tmp);
+			return accumulate(a*x);
 		}
 
-		inline  bool isZero (const Element &x) const {
-			return x == 0.; 
+		inline Element& accumulate (const Element &tmp) {
+			_y += tmp;
+			if (_y > _bound)
+				return _y = fmodf (_y, _F.modulus);
+			else
+				return _y;
 		}
-		
-		inline bool isOne (const Element &x) const {
-			return x == 1.; 
+		inline Element& subumulate (const Element &tmp) {
+			_y -= tmp;
+			if (_y < 0)
+				return _y += _F.modulus;
+			else
+				return _y;
 		}
 
-		inline bool isMinusOne (const Element &x) const {
-			return (x == -1.); 
+		inline Element& get (Element &y) {
+			_y =  fmodf (_y, _F.modulus);
+			return y=_y ;
 		}
 
-		inline Element &add (Element &x,
-				     const Element &y,
-				     const Element &z) const {
-			x = y + z;
-			if ( x > half_mod ) return x -= modulus;
-			if ( x < -half_mod ) return x += modulus;
-			return x;
-		}
- 
-		inline Element &sub (Element &x,
-				     const Element &y,
-				     const Element &z) const {
-			x = y - z;
-			if (x > half_mod) return x -= modulus;
-			if (x < -half_mod) return x += modulus;
-			return x;
-		}
-		
-		inline Element &mul (Element &x, const Element &y, const Element &z) const {		
-			x = y * z;
-			return init (x,x);
-		}
- 
-		inline Element &div (Element &x, const Element &y, const Element &z) const {
-			Element temp;
-			inv (temp, z);
-			return mul (x, y, temp);
-		}
- 
-		inline Element &neg (Element &x, const Element &y) const {
-			return x = -y;
-		}
- 
-		inline Element &inv (Element &x, const Element &y) const {
-			// The extended Euclidean algoritm 
-			int x_int, y_int, q, tx, ty, temp;
-			x_int = int (modulus);
-			y_int = (y < 0.) ? int(y + modulus) : int(y);
-			tx = 0; 
-			ty = 1;
-		  
-			while (y_int != 0) {
-				// always: gcd (modulus,residue) = gcd (x_int,y_int)
-				//         sx*modulus + tx*residue = x_int
-				//         sy*modulus + ty*residue = y_int
-				q = x_int / y_int; // integer quotient
-				temp = y_int; y_int = x_int - q * y_int;
-				x_int = temp;
-				temp = ty; ty = tx - q * ty;
-				tx = temp;
-			}
-			if (tx > half_mod ) return x = tx - modulus;
-			if ( tx < -half_mod ) return x = tx + modulus;
-			return x = (float) tx;
+		inline FieldAXPY &assign (const Element y) {
+			_y = y;
+			return *this;
 		}
 
-		inline Element &axpy (Element &r, 
-				      const Element &a, 
-				      const Element &x, 
-				      const Element &y) const {
-			r = a * x + y;
-			return init (r, r);
+		inline void reset() {
+			_y = 0.;
 		}
 
-		inline Element &addin (Element &x, const Element &y) const {
-			x += y;
-			if ( x > half_mod ) return x -= modulus;
-			if ( x < -half_mod ) return x += modulus; 
-			return x;
-		}
- 
-		inline Element &subin (Element &x, const Element &y) const {
-			x -= y;
-			if ( x > half_mod ) return x -= modulus;
-			if ( x < -half_mod ) return x += modulus; 
-			return x;
-		}
- 
-		inline Element &mulin (Element &x, const Element &y) const {
-			return mul(x,x,y);
-		}
- 
-		inline Element &divin (Element &x, const Element &y) const {
-			return div(x,x,y);
-		}
- 
-		inline Element &negin (Element &x) const {
-			return x = -x;
-		}
-		
-		inline Element &invin (Element &x) const {
-			return inv (x, x);
-		}
-		
-		inline Element &axpyin (Element &r, const Element &a, const Element &x) const {
-			r += a * x;
-			return init (r, r);
+		inline Element& set (const Element &tmp) {
+			_y = tmp;
+			if (_y > _bound)
+				return _y =  fmodf (_y, _F.modulus);
+			else
+				return _y;
 		}
 
-		static inline float getMaxModulus()
-			{ return 2048.; } // 2^11
-		
+	private:
+		Field _F;
+		Element _y;
+		Element _bound;
 	};
 
+
 	template <>
-	class FieldAXPY<ModularBalanced<float> > {	  
+	class DotProductDomain<ModularBalanced<float> > : private virtual VectorDomainBase<ModularBalanced<float> > {
 	public:
-		
 		typedef float Element;
-		typedef ModularBalanced<float> Field;
-		
-		FieldAXPY (const Field &F) : _F (F),
-					     _y(0.) , _bound( (float) (((1ULL << 24) - (int) (_F.modulus*_F.modulus)))) {}
-	  
-		FieldAXPY (const FieldAXPY &faxpy) : _F (faxpy._F),
-		_y(faxpy._y), _bound(faxpy._bound) {}
-	  
-		FieldAXPY<ModularBalanced<float> > &operator = (const FieldAXPY &faxpy) {
-			_F = faxpy._F; 
-			_y= faxpy._y;
-			_bound= faxpy._bound;
-			return *this; 
-		}
-	  
-            inline Element& mulacc (const Element &a, const Element &x) {
-		    //                 Element tmp= a*x;	
-		    //                 return accumulate(tmp);
-		    return accumulate(a*x);
-            }
-            
-            inline Element& accumulate (const Element &tmp) {   
-		    _y += tmp;
-		    if (_y > _bound)
-			    return _y = fmod (_y, _F.modulus);
-		    else
-			    return _y;
-            }
-            inline Element& subumulate (const Element &tmp) {   
-		    _y -= tmp;
-		    if (_y < 0)
-			    return _y += _F.modulus;
-		    else
-			    return _y;
-            }
-	    
-	    inline Element& get (Element &y) {
-			_y = fmod (_y, _F.modulus);
-			return y=_y ;
-		}
-	  
-		inline FieldAXPY &assign (const Element y) {
-			_y = y; 
-			return *this;
+		DotProductDomain (const ModularBalanced<Element> &F) :
+			VectorDomainBase<ModularBalanced<Element> > (F), _bound( (Element) ( (1ULL<<24) - (int) (_F.modulus*_F.modulus)))
+		{
+			_nmax= (size_t)floor((Element(1<<11)* Element(1<<11)*2.)/ (_F.modulus * _F.modulus));
 		}
 
-		inline void reset() {
-			_y = 0.;
-		}
-            
-            inline Element& set (const Element &tmp) {   
-                _y = tmp;
-                if (_y > _bound)
-                    return _y = fmod (_y, _F.modulus);
-                else
-                    return _y;
-            }
-	  
-					     private:
-	  		Field _F;
-		float _y;
-		float _bound;		
-	};
-	
-	
-	template <>
-	class DotProductDomain<ModularBalanced<float> > : private virtual VectorDomainBase<ModularBalanced<float> > {
-	private:
-		float _bound;
-		size_t _nmax;
-	  
-	public:	  
-		typedef float Element;	  
-		DotProductDomain (const ModularBalanced<float> &F)
-			: VectorDomainBase<ModularBalanced<float> > (F), _bound( (float) ( (1ULL<<24) - (int) (_F.modulus*_F.modulus)))
-			{
-				_nmax= (size_t)floor((float(1<<11)* float(1<<11)*2.)/ (_F.modulus * _F.modulus));
-			}
-	  
 	protected:
 		template <class Vector1, class Vector2>
-		inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const {
-	    
-			float y = 0.;
-			float t = 0.;
+		inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
+
+			Element y = 0.;
+			Element t = 0.;
 			if (v1.size() < _nmax) {
 				for (size_t i = 0; i< v1.size();++i)
-					y += v1[i] * v2[i] ;				
-				y = fmod(y, _F.modulus);
+					y += v1[i] * v2[i] ;
+				y =  fmodf(y, _F.modulus);
 			}
-			else{			
+			else{
 				size_t i=0;
 				for (;i< v1.size()- _nmax ;i=i+_nmax){
 					for (size_t j=i;j<i+_nmax;++j)
 						y += v1[j] * v2[j];
-					t+=fmod(y, _F.modulus);
-					y=0.;							
+					t+= fmodf(y, _F.modulus);
+					y=0.;
 				}
 				for (;i < v1.size();++i)
 					y += v1[i] * v2[i];
-				t+=fmod(y, _F.modulus);
-				y = fmod(t, _F.modulus);
+				t+= fmodf(y, _F.modulus);
+				y = fmodf(t, _F.modulus);
 			}
 			return res = y;
 		}
 
 		template <class Vector1, class Vector2>
-		inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const {		  
-				    
-			float y = 0.;
-			float t =0.;
-			
+		inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
+
+			Element y = 0.;
+			Element t =0.;
+
 
 			if (v1.first.size() < _nmax) {
 				for (size_t i=0;i<v1.first.size();++i)
 					y+= v1.second[i] * v2[v1.first[i]];
-				y = fmod(y, _F.modulus);
+				y = fmodf(y, _F.modulus);
 			}
-			else {			
+			else {
 				size_t i=0;
 				for (;i< v1.first.size()- _nmax ;i=i+_nmax){
 					for (size_t j=i;j<i+_nmax;++j)
 						y += v1.second[j] * v2[v1.first[j]];
-					t+=fmod(y, _F.modulus);
-					y=0.;							
+					t+=fmodf(y, _F.modulus);
+					y=0.;
 				}
 				for (;i < v1.first.size();++i)
 					y += v1.second[i] * v2[v1.first[i]];
-				t+= fmod(y, _F.modulus);
-				y = fmod(t, _F.modulus);
+				t+= fmodf(y, _F.modulus);
+				y = fmodf(t, _F.modulus);
 			}
 			return res = y;
 		}
+	private:
+		Element _bound;
+		size_t _nmax;
+
 	};
-	}
+} // Namespace LinBox
 
 #include "linbox/randiter/modular-balanced.h"
 #include "linbox/randiter/nonzero.h"
 
-#endif
+#undef FmodF
+
+#endif //__LINBOX_modular_balanced_float_H
+
diff --git a/linbox/field/modular-balanced-int.h b/linbox/field/modular-balanced-int.h
deleted file mode 100644
index bd6573c..0000000
--- a/linbox/field/modular-balanced-int.h
+++ /dev/null
@@ -1,525 +0,0 @@
-#ifndef __LINBOX_MODULAR_BALANCED_INT_H
-#define __LINBOX_MODULAR_BALANCED_INT_H
-// This file has been replaced by modular-balanced-int32.h
-
-/* balanced representation for modular<int> field, [-p/2,p/2], p is odd. 
- */
-
-#include "linbox/linbox-config.h"
-#include "linbox/integer.h"
-#include "linbox/vector/vector-domain.h"
-#include "linbox/field/field-interface.h"
-#include "linbox/util/field-axpy.h"
-#include "linbox/util/debug.h"
-#include <linbox/field/field-traits.h>
-
-#ifndef LINBOX_MAX_INT
-#define LINBOX_MAX_INT 2147483647
-#endif
-
-#ifndef LINBOX_MAX_MODULUS
-#define LINBOX_MAX_MODULUS 1073741824
-
-#endif 
-
-
-// Namespace in which all LinBox code resides
-namespace LinBox 
-{ 
-
-	template< class Element >
-		class ModularBalanced;
-	template< class Element >
-		class ModularBalancedRandIter;
-	
-	template <class Ring>
-	struct ClassifyRing;
-
-	template <class Element>
-	struct ClassifyRing<ModularBalanced<Element> >;
-
-	template <>
-	struct ClassifyRing<ModularBalanced<int> > {
-		typedef RingCategories::ModularTag categoryTag;
-	};
-
-	
-	/// \ingroup field
-	template <>
-		class ModularBalanced<int> : public FieldInterface {
-		protected:
-		int modulus;
-		int halfmodulus;
-		int nhalfmodulus;
-		double modulusinv;
-
-		public:	       
-
-		friend class FieldAXPY<ModularBalanced<int> >;
-                friend class DotProductDomain<ModularBalanced<int> >;
-			       
-		typedef int Element;
-		typedef ModularBalancedRandIter<int> RandIter;
-
-		//default modular field,taking 65521 as default modulus
-		ModularBalanced () :modulus(65521) {
-			modulusinv = 1/(double)65521;
-			halfmodulus = (65521 >> 1);
-			nhalfmodulus = -halfmodulus;
-		}
-
-		ModularBalanced (int value)  : modulus(value) {
-			halfmodulus = (modulus >> 1);
-			nhalfmodulus = -halfmodulus;
-			modulusinv = 1 / ((double) value); 
-			if(value <= 1) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
-			if(value > LINBOX_MAX_MODULUS) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus is too big");
-			if( ! (value % 2) ) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be odd");
-
-		}
-
-		ModularBalanced(const ModularBalanced<int>& mf) : modulus(mf.modulus),halfmodulus(mf.halfmodulus),nhalfmodulus(mf.nhalfmodulus),modulusinv(mf.modulusinv) { }
-
-		const ModularBalanced &operator=(const ModularBalanced<int> &F) {
-			modulus = F.modulus;
-			halfmodulus = F.halfmodulus;
-			nhalfmodulus = F.nhalfmodulus;
-			modulusinv = F.modulusinv;
-
-			return *this;
-		}
-
-	
-		integer &cardinality (integer &c) const{ 
-			return c = modulus;
-		}
-
-		integer &characteristic (integer &c) const {
-			return c = modulus; 
-		}
-
-		integer &convert (integer &x, const Element &y) const { 
-			if(y >= 0)
-				return x = y;
-			else 
-				return x = y + modulus;
-		}
-		
-		std::ostream &write (std::ostream &os) const {
-			return os << "int mod " << modulus;
-		}
-		
-		std::istream &read (std::istream &is) {
-			is >> modulus; 
-			halfmodulus = modulus/2;
-			nhalfmodulus = -halfmodulus;
-			modulusinv = 1 /((double) modulus );
-                        if(modulus <= 1) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
-                        if(modulus > LINBOX_MAX_MODULUS) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus is too big");
-			if( ! (modulus % 2) ) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be oddd");	
-
-			return is;
-		}
-		
-		std::ostream &write (std::ostream &os, const Element &x) const {
-			return os << x;
-		}
-
-		std::istream &read (std::istream &is, Element &x) const {
-			integer tmp;
-			is >> tmp;
-			init(x,tmp); 
-			return is;
-                }
-		
-
-		Element &init (Element &x, const integer &y) const  {
-			x = y % integer (modulus);
-			if (x < nhalfmodulus) x += modulus;
-			else if (x > halfmodulus) x -= modulus;
-			return x;
-		}
-
-		inline Element& init(Element& x, int y =0) const {
-			x = y % modulus;
-
-			if ( x < nhalfmodulus ) x += modulus;
-			else if (x > halfmodulus ) x -= modulus;
-
-			return x;
-		}
-
-		inline Element& init(Element& x, long y) const {
-			x = y % modulus;
-			if ( x < nhalfmodulus ) x += modulus;
-			else if ( x > halfmodulus ) x -= modulus;
-
-			return x;
-		}
-		
-		inline Element& assign(Element& x, const Element& y) const {
-			return x = y;
-		}
-									
-		
-		inline bool areEqual (const Element &x, const Element &y) const {
-			return x == y;
-		}
-
-		inline  bool isZero (const Element &x) const {
-			return x == 0; 
-		}
-		
-		inline bool isOne (const Element &x) const {
-			return x == 1; 
-		}
-
-		inline Element &add (Element &x, const Element &y, const Element &z) const {
-			x = y + z;
-			if ( x > halfmodulus ) x -= modulus;
-			else if ( x < nhalfmodulus ) x += modulus;
-
-			return x;
-		}
- 
-		inline Element &sub (Element &x, const Element &y, const Element &z) const {
-			x = y - z;
-			if (x > halfmodulus) x -= modulus;
-			else if (x < nhalfmodulus) x += modulus;
-			return x;
-		}
-		
-		inline Element &mul (Element &x, const Element &y, const Element &z) const {
-			int q;
-
-			q  = (int) ((((double) y) * ((double) z)) * modulusinv);  // q could be off by (+/-) 1
-			x = (int) (y*z - q*modulus);
-			
-			if (x > halfmodulus)
-				x -= modulus;
-			else if (x < nhalfmodulus)
-				x += modulus;
-
-			return x;
-		}
- 
-		inline Element &div (Element &x, const Element &y, const Element &z) const {
-			Element temp;
-			inv (temp, z);
-			return mul (x, y, temp);
-		}
- 
-		inline Element &neg (Element &x, const Element &y) const {
-			return x = -y;
-		}
- 
-		inline Element &inv (Element &x, const Element &y) const {
-			int d, t;			
-			XGCD(d, x, t, y, modulus);
-			if (d != 1) 
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"InvMod: inverse undefined");
-			if (x > halfmodulus) 
-				x -= modulus;
-			else if (x < nhalfmodulus)
-				x += modulus;
-
-			return x;		
-							      
-		}
-
-		inline Element &axpy (Element &r, 
-				      const Element &a, 
-				      const Element &x, 
-				      const Element &y) const {
-			int q;
-			
-			q  = (int) (((((double) a) * ((double) x)) + (double)y) * modulusinv);  // q could be off by (+/-) 1
-			r = (int) (a * x + y - q*modulus);
-			
-			
-			if (r > halfmodulus)
-				r -= modulus;
-			else if (r < nhalfmodulus)
-				r += modulus;
-
-			return r;
-
-		}
-
-		inline Element &addin (Element &x, const Element &y) const {
-			x += y;
-			if ( x > halfmodulus ) x -= modulus;
-			else if (x < -halfmodulus) x += modulus;
-
-			return x;
-		}
- 
-		inline Element &subin (Element &x, const Element &y) const {
-			x -= y;
-			if (x > halfmodulus) 
-				x -= modulus;
-			else if (x < nhalfmodulus)
-				x += modulus;
-
-			return x;
-		}
- 
-		inline Element &mulin (Element &x, const Element &y) const {
-			return mul(x,x,y);
-		}
- 
-		inline Element &divin (Element &x, const Element &y) const {
-			return div(x,x,y);
-		}
- 
-		inline Element &negin (Element &x) const {
-			return x = -x;
-		}
- 
-		inline Element &invin (Element &x) const {
-			return inv (x, x);
-		}
-
-		inline Element &axpyin (Element &r, const Element &a, const Element &x) const {
-			int q;
-			
-			q  = (int) (((((double) a)*((double) x)) + (double)r) * modulusinv);  // q could be off by (+/-) 1
-			r = (int) (a * x + r - q*modulus);
-			
-			
-			if (r > halfmodulus)
-				r -= modulus;
-			else if (r < nhalfmodulus)
-				r += modulus;
-
-			return r;
-		}
-
-		private:
-
-      		inline static void XGCD(int& d, int& s, int& t, int a, int b) {
-			int  u, v, u0, v0, u1, v1, u2, v2, q, r;
-			
-			int aneg = 0, bneg = 0;
-			
-			if (a < 0) {
-				if (a < -LINBOX_MAX_INT) throw PreconditionFailed(__FUNCTION__,__LINE__,"XGCD: integer overflow");
-				a = -a;
-				aneg = 1;
-			}
-			
-			if (b < 0) {
-				if (b < -LINBOX_MAX_INT) throw PreconditionFailed(__FUNCTION__,__LINE__,"XGCD: integer overflow");
-				b = -b;
-				bneg = 1;
-			}
-			
-			u1 = 1; v1 = 0;
-			u2 = 0; v2 = 1;
-			u = a; v = b;
-			
-			while (v != 0) {
-				q = u / v;
-				r = u % v;
-				u = v;
-				v = r;
-				u0 = u2;
-				v0 = v2;
-				u2 =  u1 - q*u2;
-				v2 = v1- q*v2;
-				u1 = u0;
-				v1 = v0;
-			}
-			
-			if (aneg)
-				u1 = -u1;
-			
-			if (bneg)
-				v1 = -v1;
-			
-			d = u;
-			s = u1;
-			t = v1;
-		}
-		
-	};
-
-	template <>
-		class FieldAXPY<ModularBalanced<int> > {	  
-		public:
-	  
-		typedef int Element;
-		typedef ModularBalanced<int> Field;
-	  
-		FieldAXPY (const Field &F) : _F (F),_y(0),_times(0) {
-		}
-
-
-		FieldAXPY (const FieldAXPY &faxpy) : _F (faxpy._F), _y (0),_times(0){}
-	  
-		FieldAXPY<ModularBalanced<int> > &operator = (const FieldAXPY &faxpy) {
-			_F = faxpy._F; 
-			_y = faxpy._y; 
-			_times = faxpy._times;
-			return *this; 
-		}
-	  
-		inline int64& mulacc (const Element &a, const Element &x) {
-		        int64 t = (int64) a * (int64)   x;
-			if (_times < blocksize) {
-				++_times;
-				return _y += t;
-			}
-
-			else {
-				_times = 1;
-				normalize();
-				return _y += t;
-			}
-		}
-
-		inline int64& accumulate (const Element &t) {
-			if (_times < blocksize) {
-				++_times;
-				return _y += t;
-			}
-
-			else {
-				_times = 1;
-				normalize();
-				return _y += t;
-			}
-		}
-
-		inline Element& get (Element &y) {
-
-			normalize();
-
-			y = _y;
-			
-			if (y > _F.halfmodulus)
-				y -= _F.modulus;
-			else if (y < _F.nhalfmodulus)
-				y += _F.modulus;
-
-			return y;
-		}
-
-		inline FieldAXPY &assign (const Element y) {
-			_y = y; 
-			return *this;
-		}
-
-		inline void reset() {
-			_y = 0;
-		}
-
-		private:
-	  
-		Field _F;
-		int64 _y;
-		int _times;
-		static const int blocksize = 32;
-
-		inline void normalize() {
-			_y = (int)_y -(int)(int64)((double) _y * _F.modulusinv) * (int)_F.modulus;
-		}
-			
-	};
-
-
-	template <>
-		class DotProductDomain<ModularBalanced<int> > : private virtual VectorDomainBase<ModularBalanced<int> > {
-
-		private:
-		const int blocksize;
-		
-		public:	  
-		typedef int Element;	  
-		DotProductDomain (const ModularBalanced<int> &F)
-			: VectorDomainBase<ModularBalanced<int> > (F) ,blocksize(32){
-		}
-				
-		protected:
-		template <class Vector1, class Vector2>
-			inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const {
-			
-			typename Vector1::const_iterator pv1,pv1e;
-			typename Vector2::const_iterator pv2;
-		  			
-			int64 y = 0;
-			int64 t;
-			int times = 0;
-
-			pv1 = pv1e = v1.begin();
-			pv2 = v2.begin();
-
-			for(int i = 0; i < v1.size() / blocksize ;++i) {
-				pv1e = pv1e + blocksize;
-				for(;pv1 != pv1e;++pv1,++pv2) {
-					t = (((int64) *pv1 ) * ((int64) *pv2 ));
-					y += t;
-				}
-				normalize(y);									
-			}
-
-			for(;pv1 != v1.end(); ++pv1, ++pv2) {
-				t = (((int64) *pv1 ) * ((int64) *pv2 ));
-				y += t;
-			}
-			
-			normalize(y);
-			res = y;
-
-			if (res > _F.halfmodulus) res -= _F.modulus;
-			else if(res < _F.nhalfmodulus) res += _F.modulus;
-
-			return res;
-
-		}
-	  
-		template <class Vector1, class Vector2>
-			inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const {		  
-
-			typename Vector1::first_type::const_iterator i_idx, i_idxe;
-			typename Vector1::second_type::const_iterator i_elt;
-		  
-			int64 y = 0;
-			int64 t;
-
-			i_idx = i_idxe = v1.first.begin();
-			i_elt = v1.second.begin();
-
-			for(int i = 0; i < v1.first.size() / blocksize ; ++i) {
-				i_idxe = i_idxe + blocksize;
-				for(;i_idx!= i_idxe;++i_idx, ++i_elt) {
-					t = ( (int64) *i_elt ) * ( (int64) v2[*i_idx] );
-					y += t;
-				}
-				normalize(y);
-			}
-
-
-			for(;i_idx!= v1.first.end();++i_idx, ++i_elt) {
-				t = ( (int64) *i_elt ) * ( (int64) v2[*i_idx] );
-				y += t;
-			}
-
-			normalize(y);
-
-			res = y;
-			if (res > _F.halfmodulus) res -= _F.modulus;
-			else if(res < _F.nhalfmodulus) res += _F.modulus;	
-
-			return res;
-		}
-
-		inline void normalize(int64& _y) const {
-			_y = (int)_y -(int)(int64)((double) _y * _F.modulusinv) * (int)_F.modulus;
-		}
-			
-	};
-}
-
-#include "linbox/randiter/modular-balanced.h"
-#endif
diff --git a/linbox/field/modular-balanced-int32.h b/linbox/field/modular-balanced-int32.h
index e445a88..44f49c3 100644
--- a/linbox/field/modular-balanced-int32.h
+++ b/linbox/field/modular-balanced-int32.h
@@ -1,8 +1,37 @@
-#ifndef __LINBOX_MODULAR_INT_H
-#define __LINBOX_MODULAR_INT_H
-/* balanced representation for modular<int32> field, [-p/2,p/2], p is odd. 
+/* -*- 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
+/* Copyright (C) 2009 LinBox
+ * Written by C Pernet
+ * updated to compilable condition by <brice.boyer at imag.fr>
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
 
+
+/*! @file field/modular-balanced-int32_t.h
+ * @ingroup field
+ * @brief Balanced representation of <code>Z/mZ</code> over \c int32_t .
+ */
+
+#ifndef __LINBOX_modular_balanced_int32_H
+#define __LINBOX_modular_balanced_int32_H
+
+
 #include "linbox/linbox-config.h"
 #include "linbox/integer.h"
 #include "linbox/vector/vector-domain.h"
@@ -10,364 +39,126 @@
 #include "linbox/field/field-traits.h"
 #include "linbox/util/field-axpy.h"
 #include "linbox/util/debug.h"
-#include <linbox/field/field-traits.h>
-
-#ifndef LINBOX_MAX_INT
-#define LINBOX_MAX_INT 2147483647
-#endif
+#include "linbox/field/field-traits.h"
+#include "linbox/field/modular-int32.h"
 
-// replaced by FieldTraits<Modular<int32> >::maxModulus(integer&)
-// #ifndef LINBOX_MAX_MODULUS
-// #define LINBOX_MAX_MODULUS 1073741824
+#include "fflas-ffpack/field/modular-balanced-int32.h"
 
-//#endif 
+#ifndef LINBOX_MAX_INT /* 2147483647 */
+#define LINBOX_MAX_INT INT32_MAX
+#endif
 
 
 // Namespace in which all LinBox code resides
-namespace LinBox 
-{ 
+namespace LinBox
+{
 
 	template< class Element >
-		class Modular;
+	class ModularBalanced;
 	template< class Element >
-		class ModularRandIter;
-	
+	class ModularBalancedRandIter;
+	template< class Field, class RandIter >
+	class NonzeroRandIter;
+
+
 	template <class Ring>
 	struct ClassifyRing;
 
 	template<class Element>
-	struct ClassifyRing<Modular<Element> >;
+	struct ClassifyRing<ModularBalanced<Element> >;
 
-	template<class Element>
-	struct ClassifyRing<Modular<int32> > {
+	template<>
+	struct ClassifyRing<ModularBalanced<int32_t> > {
 		typedef RingCategories::ModularTag categoryTag;
 	};
 
 	/// \ingroup field
 	template <>
-		class Modular<int32> : public FieldInterface {
-		protected:
-		int32 modulus;
-		int32 halfmodulus;
-		int32 nhalfmodulus;
-		double modulusinv;
-
-		public:	       
-
-		friend class FieldAXPY<Modular<int32> >;
-                friend class DotProductDomain<Modular<int32> >;
-			       
-		typedef int32 Element;
-		typedef ModularRandIter<int32> RandIter;
-
-		//default modular field,taking 65521 as default modulus
-		Modular () :modulus(65521) {
-			modulusinv = 1/(double)65521;
-			halfmodulus = (65521 >> 1);
-			nhalfmodulus = -halfmodulus;
-		}
-
-		Modular (int32 value, int exp = 1)  : modulus(value) {
-			halfmodulus = (modulus >> 1);
-			nhalfmodulus = -halfmodulus;
-			modulusinv = 1 / ((double) value); 
-			if(exp != 1) throw PreconditionFailed(__FUNCTION__,__LINE__,"exponent must be 1");
-			if(value <= 1) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
-			integer max;
-			if(value > FieldTraits<Modular<int32> >::maxModulus(max)) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus is too big");
-			if( ! (value % 2) ) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be odd");
+	class ModularBalanced<int32_t> : public FieldInterface,
+	      public FFPACK::ModularBalanced<int32_t>	{
+	protected:
+		// int32_t modulus;
+		// int32_t halfmodulus;
+		// int32_t nhalfmodulus;
+		// double modulusinv;
 
-		}
+	public:
 
-		Modular(const Modular<int32>& mf) : modulus(mf.modulus),halfmodulus(mf.halfmodulus),nhalfmodulus(mf.nhalfmodulus),modulusinv(mf.modulusinv) { }
+		friend class FieldAXPY<ModularBalanced<int32_t> >;
+		friend class DotProductDomain<ModularBalanced<int32_t> >;
 
-		const Modular &operator=(const Modular<int32> &F) {
-			modulus = F.modulus;
-			halfmodulus = F.halfmodulus;
-			nhalfmodulus = F.nhalfmodulus;
-			modulusinv = F.modulusinv;
+		typedef int32_t Element;
+		typedef ModularBalancedRandIter<int32_t> RandIter;
+		typedef NonzeroRandIter<ModularBalanced<int32_t>,RandIter> NonZeroRandIter;
 
-			return *this;
-		}
+		ModularBalanced(int32_t p, int32_t e=1) :
+			FFPACK::ModularBalanced<int32_t>(p,e)
+		{}
 
-	
-		integer &cardinality (integer &c) const{ 
+		integer &cardinality (integer &c) const
+		{
 			return c = modulus;
 		}
 
-		integer &characteristic (integer &c) const {
-			return c = modulus; 
+		integer &characteristic (integer &c) const
+		{
+		       	return c = modulus;
 		}
 
-		integer &convert (integer &x, const Element &y) const { 
+		unsigned long characteristic()const{return FFPACK::ModularBalanced<int32_t>::characteristic();}
+		unsigned long cardinality ()const{return FFPACK::ModularBalanced<int32_t>::cardinality();}
+
+		// this function converts an int to a natural number ?
+		integer &convert (integer &x, const Element &y) const
+		{
 			if(y >= 0)
 				return x = y;
-			else 
+			else
 				return x = y + modulus;
 		}
-		
-		std::ostream &write (std::ostream &os) const {
-			return os << "int32 mod " << modulus;
-		}
-		
-		std::istream &read (std::istream &is) {
-			is >> modulus; 
-			halfmodulus = modulus/2;
-			nhalfmodulus = -halfmodulus;
-			modulusinv = 1 /((double) modulus );
-                        if(modulus <= 1) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
-			integer max;
-                        if(modulus > FieldTraits<Modular<int32> >::maxModulus(max)) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus is too big");
-			if( ! (modulus % 2) ) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be oddd");	
-
-			return is;
-		}
-		
-		std::ostream &write (std::ostream &os, const Element &x) const {
-			return os << x;
-		}
-
-		std::istream &read (std::istream &is, Element &x) const {
-			integer tmp;
-			is >> tmp;
-			init(x,tmp); 
-			return is;
-                }
-		
-
-		Element &init (Element &x, const integer &y) const  {
-			x = y % integer (modulus);
-			if (x < nhalfmodulus) x += modulus;
-			else if (x > halfmodulus) x -= modulus;
-			return x;
-		}
-
-		inline Element& init(Element& x, int y =0) const {
-			x = y % modulus;
-
-			if ( x < nhalfmodulus ) x += modulus;
-			else if (x > halfmodulus ) x -= modulus;
-
-			return x;
-		}
 
-		inline Element& init(Element& x, long y) const {
-			x = y % modulus;
-			if ( x < nhalfmodulus ) x += modulus;
-			else if ( x > halfmodulus ) x -= modulus;
+		Element &init (Element &x, const integer &y) const
+		{
+			x = y % (long)modulus;
 
-			return x;
-		}
-		
-		inline Element& assign(Element& x, const Element& y) const {
-			return x = y;
-		}
-									
-		
-		inline bool areEqual (const Element &x, const Element &y) const {
-			return x == y;
-		}
-
-		inline  bool isZero (const Element &x) const {
-			return x == 0; 
-		}
-		
-		inline bool isOne (const Element &x) const {
-			return x == 1; 
-		}
-
-		inline Element &add (Element &x, const Element &y, const Element &z) const {
-			x = y + z;
-			if ( x > halfmodulus ) x -= modulus;
-			else if ( x < nhalfmodulus ) x += modulus;
-
-			return x;
-		}
- 
-		inline Element &sub (Element &x, const Element &y, const Element &z) const {
-			x = y - z;
-			if (x > halfmodulus) x -= modulus;
-			else if (x < nhalfmodulus) x += modulus;
-			return x;
-		}
-		
-		inline Element &mul (Element &x, const Element &y, const Element &z) const {
-			int32 q;
-
-			q  = (int32) ((((double) y) * ((double) z)) * modulusinv);  // q could be off by (+/-) 1
-			x = (int32) (y*z - q*modulus);
-			
-			if (x > halfmodulus)
-				x -= modulus;
-			else if (x < nhalfmodulus)
-				x += modulus;
-
-			return x;
-		}
- 
-		inline Element &div (Element &x, const Element &y, const Element &z) const {
-			Element temp;
-			inv (temp, z);
-			return mul (x, y, temp);
-		}
- 
-		inline Element &neg (Element &x, const Element &y) const {
-			return x = -y;
-		}
- 
-		inline Element &inv (Element &x, const Element &y) const {
-			int32 d, t;			
-			XGCD(d, x, t, y, modulus);
-			if (d != 1) 
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"InvMod: inverse undefined");
-			if (x > halfmodulus) 
-				x -= modulus;
-			else if (x < nhalfmodulus)
+			if (x < nhalfmodulus)
 				x += modulus;
-
-			return x;		
-							      
-		}
-
-		inline Element &axpy (Element &r, 
-				      const Element &a, 
-				      const Element &x, 
-				      const Element &y) const {
-			int32 q;
-			
-			q  = (int32) (((((double) a) * ((double) x)) + (double)y) * modulusinv);  // q could be off by (+/-) 1
-			r = (int32) (a * x + y - q*modulus);
-			
-			
-			if (r > halfmodulus)
-				r -= modulus;
-			else if (r < nhalfmodulus)
-				r += modulus;
-
-			return r;
-
-		}
-
-		inline Element &addin (Element &x, const Element &y) const {
-			x += y;
-			if ( x > halfmodulus ) x -= modulus;
-			else if (x < -halfmodulus) x += modulus;
-
-			return x;
-		}
- 
-		inline Element &subin (Element &x, const Element &y) const {
-			x -= y;
-			if (x > halfmodulus) 
+			else if (x > halfmodulus)
 				x -= modulus;
-			else if (x < nhalfmodulus)
-				x += modulus;
 
 			return x;
 		}
- 
-		inline Element &mulin (Element &x, const Element &y) const {
-			return mul(x,x,y);
-		}
- 
-		inline Element &divin (Element &x, const Element &y) const {
-			return div(x,x,y);
-		}
- 
-		inline Element &negin (Element &x) const {
-			return x = -x;
-		}
- 
-		inline Element &invin (Element &x) const {
-			return inv (x, x);
-		}
 
-		inline Element &axpyin (Element &r, const Element &a, const Element &x) const {
-			int32 q;
-			
-			q  = (int32) (((((double) a)*((double) x)) + (double)r) * modulusinv);  // q could be off by (+/-) 1
-			r = (int32) (a * x + r - q*modulus);
-			
-			
-			if (r > halfmodulus)
-				r -= modulus;
-			else if (r < nhalfmodulus)
-				r += modulus;
-
-			return r;
-		}
 
-		private:
-
-      		inline static void XGCD(int32& d, int32& s, int32& t, int32 a, int32 b) {
-			int32  u, v, u0, v0, u1, v1, u2, v2, q, r;
-			
-			int32 aneg = 0, bneg = 0;
-			
-			if (a < 0) {
-				if (a < -LINBOX_MAX_INT) throw PreconditionFailed(__FUNCTION__,__LINE__,"XGCD: integer overflow");
-				a = -a;
-				aneg = 1;
-			}
-			
-			if (b < 0) {
-				if (b < -LINBOX_MAX_INT) throw PreconditionFailed(__FUNCTION__,__LINE__,"XGCD: integer overflow");
-				b = -b;
-				bneg = 1;
-			}
-			
-			u1 = 1; v1 = 0;
-			u2 = 0; v2 = 1;
-			u = a; v = b;
-			
-			while (v != 0) {
-				q = u / v;
-				r = u % v;
-				u = v;
-				v = r;
-				u0 = u2;
-				v0 = v2;
-				u2 =  u1 - q*u2;
-				v2 = v1- q*v2;
-				u1 = u0;
-				v1 = v0;
-			}
-			
-			if (aneg)
-				u1 = -u1;
-			
-			if (bneg)
-				v1 = -v1;
-			
-			d = u;
-			s = u1;
-			t = v1;
-		}
-		
 	};
 
 	template <>
-		class FieldAXPY<Modular<int32> > {	  
-		public:
-	  
-		typedef int32 Element;
-		typedef Modular<int32> Field;
-	  
-		FieldAXPY (const Field &F) : _F (F),_y(0),_times(0) {
-		}
+	class FieldAXPY<ModularBalanced<int32_t> > {
+	public:
+
+		typedef int32_t Element;
+		typedef ModularBalanced<int32_t> Field;
+
+		FieldAXPY (const Field &F) :
+			_F (F),_y(0),_times(0)
+		{ }
 
 
-		FieldAXPY (const FieldAXPY &faxpy) : _F (faxpy._F), _y (0),_times(0){}
-	  
-		FieldAXPY<Modular<int32> > &operator = (const FieldAXPY &faxpy) {
-			_F = faxpy._F; 
-			_y = faxpy._y; 
+		FieldAXPY (const FieldAXPY &faxpy) :
+			_F (faxpy._F), _y (0),_times(0)
+		{}
+
+		FieldAXPY<ModularBalanced<int32_t> > &operator = (const FieldAXPY &faxpy)
+		{
+			_F = faxpy._F;
+			_y = faxpy._y;
 			_times = faxpy._times;
-			return *this; 
+			return *this;
 		}
-	  
-		inline int64& mulacc (const Element &a, const Element &x) {
-		        int64 t = (int64) a * (int64)   x;
+
+		inline int64_t& mulacc (const Element &a, const Element &x)
+		{
+			int64_t t = (int64_t) a * (int64_t)   x;
 			if (_times < blocksize) {
 				++_times;
 				return _y += t;
@@ -380,7 +171,8 @@ namespace LinBox
 			}
 		}
 
-		inline int64& accumulate (const Element &t) {
+		inline int64_t& accumulate (const Element &t)
+		{
 			if (_times < blocksize) {
 				++_times;
 				return _y += t;
@@ -393,12 +185,13 @@ namespace LinBox
 			}
 		}
 
-		inline Element& get (Element &y) {
+		inline Element& get (Element &y)
+		{
 
 			normalize();
 
 			y = _y;
-			
+
 			if (y > _F.halfmodulus)
 				y -= _F.modulus;
 			else if (y < _F.nhalfmodulus)
@@ -407,69 +200,72 @@ namespace LinBox
 			return y;
 		}
 
-		inline FieldAXPY &assign (const Element y) {
-			_y = y; 
+		inline FieldAXPY &assign (const Element y)
+		{
+			_y = y;
 			return *this;
 		}
 
-		inline void reset() {
+		inline void reset()
+		{
 			_y = 0;
 		}
 
-		private:
-	  
+	private:
+
 		Field _F;
-		int64 _y;
-		int32 _times;
-		static const int32 blocksize = 32;
+		int64_t _y;
+		int32_t _times;
+		static const int32_t blocksize = 32;
 
 		inline void normalize() {
-			_y = (int32)_y -(int32)(int64)((double) _y * _F.modulusinv) * (int32)_F.modulus;
+			_y = (int32_t)_y -(int32_t)(int64_t)((double) _y * _F.modulusinv) * (int32_t)_F.modulus;
 		}
-			
+
 	};
 
 
 	template <>
-		class DotProductDomain<Modular<int32> > : private virtual VectorDomainBase<Modular<int32> > {
-
-		private:
-		const int32 blocksize;
-		
-		public:	  
-		typedef int32 Element;	  
-		DotProductDomain (const Modular<int32> &F)
-			: VectorDomainBase<Modular<int32> > (F) ,blocksize(32){
-		}
-				
-		protected:
+	class DotProductDomain<ModularBalanced<int32_t> > : private virtual VectorDomainBase<ModularBalanced<int32_t> > {
+
+	private:
+		const int32_t blocksize;
+
+	public:
+		typedef int32_t Element;
+		DotProductDomain (const ModularBalanced<int32_t> &F) :
+			VectorDomainBase<ModularBalanced<int32_t> > (F) ,blocksize(32)
+		{ }
+
+	protected:
 		template <class Vector1, class Vector2>
-			inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const {
-			
+		inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
+
 			typename Vector1::const_iterator pv1,pv1e;
 			typename Vector2::const_iterator pv2;
-		  			
-			int64 y = 0;
-			int64 t;
-			int32 times = 0;
+
+			int64_t y = 0;
+			int64_t t;
+			// int32_t times = 0;
 
 			pv1 = pv1e = v1.begin();
 			pv2 = v2.begin();
 
-			for(int i = 0; i < v1.size() / blocksize ;++i) {
+			for(size_t i = 0; i < v1.size() / blocksize ;++i) {
 				pv1e = pv1e + blocksize;
 				for(;pv1 != pv1e;++pv1,++pv2) {
-					t = (((int64) *pv1 ) * ((int64) *pv2 ));
+					t = (((int64_t) *pv1 ) * ((int64_t) *pv2 ));
 					y += t;
 				}
-				normalize(y);									
+				normalize(y);
 			}
 
 			for(;pv1 != v1.end(); ++pv1, ++pv2) {
-				t = (((int64) *pv1 ) * ((int64) *pv2 ));
+				t = (((int64_t) *pv1 ) * ((int64_t) *pv2 ));
 				y += t;
 			}
-			
+
 			normalize(y);
 			res = y;
 
@@ -479,23 +275,24 @@ namespace LinBox
 			return res;
 
 		}
-	  
+
 		template <class Vector1, class Vector2>
-			inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const {		  
+		inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
 
 			typename Vector1::first_type::const_iterator i_idx, i_idxe;
 			typename Vector1::second_type::const_iterator i_elt;
-		  
-			int64 y = 0;
-			int64 t;
+
+			int64_t y = 0;
+			int64_t t;
 
 			i_idx = i_idxe = v1.first.begin();
 			i_elt = v1.second.begin();
 
-			for(int i = 0; i < v1.first.size() / blocksize ; ++i) {
+			for(size_t i = 0; i < v1.first.size() / blocksize ; ++i) {
 				i_idxe = i_idxe + blocksize;
 				for(;i_idx!= i_idxe;++i_idx, ++i_elt) {
-					t = ( (int64) *i_elt ) * ( (int64) v2[*i_idx] );
+					t = ( (int64_t) *i_elt ) * ( (int64_t) v2[*i_idx] );
 					y += t;
 				}
 				normalize(y);
@@ -503,7 +300,7 @@ namespace LinBox
 
 
 			for(;i_idx!= v1.first.end();++i_idx, ++i_elt) {
-				t = ( (int64) *i_elt ) * ( (int64) v2[*i_idx] );
+				t = ( (int64_t) *i_elt ) * ( (int64_t) v2[*i_idx] );
 				y += t;
 			}
 
@@ -511,17 +308,19 @@ namespace LinBox
 
 			res = y;
 			if (res > _F.halfmodulus) res -= _F.modulus;
-			else if(res < _F.nhalfmodulus) res += _F.modulus;	
+			else if(res < _F.nhalfmodulus) res += _F.modulus;
 
 			return res;
 		}
 
-		inline void normalize(int64& _y) const {
-			_y = (int32)_y -(int32)(int64)((double) _y * _F.modulusinv) * (int32)_F.modulus;
+		inline void normalize(int64_t& _y) const
+		{
+			_y = (int32_t)_y -(int32_t)(int64_t)((double) _y * _F.modulusinv) * (int32_t)_F.modulus;
 		}
-			
+
 	};
 }
 
-#include "linbox/randiter/modular.h"
-#endif
+#include "linbox/randiter/modular-balanced.h"
+#endif //__LINBOX_modular_balanced_int32_H
+
diff --git a/linbox/field/modular-balanced-int64.h b/linbox/field/modular-balanced-int64.h
new file mode 100644
index 0000000..d39bedf
--- /dev/null
+++ b/linbox/field/modular-balanced-int64.h
@@ -0,0 +1,330 @@
+/* -*- 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
+/* Copyright (C) 2010 LinBox
+ * Adapted by B Boyer <brice.boyer at imag.fr>
+ * (from other modular-balanced* files)
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+/*! @file field/modular-balanced-int64.h
+ * @ingroup field
+ * @brief Balanced representation of <code>Z/mZ</code> over \c int64_t .
+ */
+
+#ifndef __LINBOX_modular_balanced_int64_H
+#define __LINBOX_modular_balanced_int64_H
+
+#include "linbox/linbox-config.h"
+#include "linbox/integer.h"
+#include "linbox/vector/vector-domain.h"
+#include "linbox/field/field-interface.h"
+#include "linbox/field/field-traits.h"
+#include "linbox/util/field-axpy.h"
+#include "linbox/util/debug.h"
+#include "linbox/field/field-traits.h"
+
+#include "fflas-ffpack/field/modular-balanced-int64.h"
+
+#ifndef LINBOX_MAX_INT64
+#ifdef __x86_64__
+#define LINBOX_MAX_INT64 INT64_MAX
+#else
+#define LINBOX_MAX_INT64 INT64_MAX
+#endif
+#endif
+
+
+// Namespace in which all LinBox code resides
+namespace LinBox
+{
+
+	template< class Element >
+	class ModularBalanced;
+	template< class Element >
+	class ModularBalancedRandIter;
+
+	template <class Ring>
+	struct ClassifyRing;
+
+	template<class Element>
+	struct ClassifyRing<ModularBalanced<Element> >;
+
+	template<>
+	struct ClassifyRing<ModularBalanced<int64_t> > {
+		typedef RingCategories::ModularTag categoryTag;
+	};
+
+	/// \ingroup field
+	template <>
+	class ModularBalanced<int64_t> : public FieldInterface
+	      public FFPACK::ModularBalanced<int64_t>	{
+	protected:
+		// int64_t modulus;
+		// int64_t halfmodulus;
+		// int64_t nhalfmodulus;
+		// double modulusinv;
+
+	public:
+
+		friend class FieldAXPY<ModularBalanced<int64_t> >;
+		friend class DotProductDomain<ModularBalanced<int64_t> >;
+
+		typedef int64_t Element;
+		typedef ModularBalancedRandIter<int64_t> RandIter;
+
+		integer &cardinality (integer &c) const
+		{
+			return c = modulus;
+		}
+
+		integer &characteristic (integer &c) const
+		{
+		       	return c = modulus;
+		}
+
+		// this function converts an int to a natural number ?
+		integer &convert (integer &x, const Element &y) const
+		{
+			if(y >= 0)
+				return x = y;
+			else
+				return x = y + modulus;
+		}
+
+		Element &init (Element &x, const integer &y) const
+		{
+			x = y % (long) (modulus);
+			if (x < nhalfmodulus) x += modulus;
+			else if (x > halfmodulus) x -= modulus;
+			return x;
+		}
+
+
+	private:
+
+	};
+
+	template <>
+	class FieldAXPY<ModularBalanced<int64_t> > {
+	public:
+
+		typedef int64_t Element;
+		typedef ModularBalanced<int64_t> Field;
+
+		FieldAXPY (const Field &F) :
+			_F (F),_y(0),_times(0)
+		{
+		}
+
+
+		FieldAXPY (const FieldAXPY &faxpy) :
+			_F (faxpy._F), _y (0),_times(0)
+		{}
+
+		FieldAXPY<ModularBalanced<int64_t> > &operator = (const FieldAXPY &faxpy)
+		{
+			_F = faxpy._F;
+			_y = faxpy._y;
+			_times = faxpy._times;
+			return *this;
+		}
+
+		inline int64_t& mulacc (const Element &a, const Element &x)
+		{
+			int64_t t = (int64_t) a * (int64_t)   x;
+			if (_times < blocksize)
+			{
+				++_times;
+				return _y += t;
+			}
+
+			else {
+				_times = 1;
+				normalize();
+				return _y += t;
+			}
+		}
+
+		inline int64_t& accumulate (const Element &t)
+		{
+			if (_times < blocksize)
+			{
+				++_times;
+				return _y += t;
+			}
+
+			else {
+				_times = 1;
+				normalize();
+				return _y += t;
+			}
+		}
+
+		inline Element& get (Element &y)
+		{
+
+			normalize();
+
+			y = _y;
+
+			if (y > _F.halfmodulus)
+				y -= _F.modulus;
+			else if (y < _F.nhalfmodulus)
+				y += _F.modulus;
+
+			return y;
+		}
+
+		inline FieldAXPY &assign (const Element y)
+		{
+			_y = y;
+			return *this;
+		}
+
+		inline void reset()
+		{
+			_y = 0;
+		}
+
+	private:
+
+		Field _F;
+		int64_t _y;
+		int64_t _times;
+		//!@todo tune me ?
+		static const int64_t blocksize = 32;
+
+		inline void normalize()
+		{
+			_y = (int64_t)_y -(int64_t)(int64_t)((double) _y * _F.modulusinv) * (int64_t)_F.modulus;
+		}
+
+	};
+
+
+	template <>
+	class DotProductDomain<ModularBalanced<int64_t> > : private virtual VectorDomainBase<ModularBalanced<int64_t> > {
+
+	private:
+		const int64_t blocksize;
+
+	public:
+		typedef int64_t Element;
+		DotProductDomain (const ModularBalanced<int64_t> &F) :
+			VectorDomainBase<ModularBalanced<int64_t> > (F) ,blocksize(32)
+		{ }
+
+	protected:
+		template <class Vector1, class Vector2>
+		inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
+
+			typename Vector1::const_iterator pv1,pv1e;
+			typename Vector2::const_iterator pv2;
+
+			int64_t y = 0;
+			int64_t t;
+			int64_t times = 0;
+
+			pv1 = pv1e = v1.begin();
+			pv2 = v2.begin();
+
+			for(int i = 0; i < v1.size() / blocksize ;++i)
+			{
+				pv1e = pv1e + blocksize;
+				for(;pv1 != pv1e;++pv1,++pv2)
+				{
+					t = (((int64_t) *pv1 ) * ((int64_t) *pv2 ));
+					y += t;
+				}
+				normalize(y);
+			}
+
+			for(;pv1 != v1.end(); ++pv1, ++pv2)
+			{
+				t = (((int64_t) *pv1 ) * ((int64_t) *pv2 ));
+				y += t;
+			}
+
+			normalize(y);
+			res = y;
+
+			if (res > _F.halfmodulus) res -= _F.modulus;
+			else if(res < _F.nhalfmodulus) res += _F.modulus;
+
+			return res;
+
+		}
+
+		template <class Vector1, class Vector2>
+		inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
+
+			typename Vector1::first_type::const_iterator i_idx, i_idxe;
+			typename Vector1::second_type::const_iterator i_elt;
+
+			int64_t y = 0;
+			int64_t t;
+
+			i_idx = i_idxe = v1.first.begin();
+			i_elt = v1.second.begin();
+
+			for(int i = 0; i < v1.first.size() / blocksize ; ++i)
+			{
+				i_idxe = i_idxe + blocksize;
+				for(;i_idx!= i_idxe;++i_idx, ++i_elt)
+				{
+					t = ( (int64_t) *i_elt ) * ( (int64_t) v2[*i_idx] );
+					y += t;
+				}
+				normalize(y);
+			}
+
+
+			for(;i_idx!= v1.first.end();++i_idx, ++i_elt)
+			{
+				t = ( (int64_t) *i_elt ) * ( (int64_t) v2[*i_idx] );
+				y += t;
+			}
+
+			normalize(y);
+
+			res = y;
+			if (res > _F.halfmodulus) res -= _F.modulus;
+			else if(res < _F.nhalfmodulus) res += _F.modulus;
+
+			return res;
+		}
+
+		inline void normalize(int64_t& _y) const
+		{
+			_y = (int64_t)_y -(int64_t)(int64_t)((double) _y * _F.modulusinv) * (int64_t)_F.modulus;
+		}
+
+	};
+}
+
+#undef LINBOX_MAX_INT64
+
+#include "linbox/randiter/modular.h" // do not unse _LB_MAX inside this one !
+
+
+#endif //__LINBOX_modular_balanced_int64_H
+
diff --git a/linbox/field/modular-balanced.h b/linbox/field/modular-balanced.h
new file mode 100644
index 0000000..4c4cda3
--- /dev/null
+++ b/linbox/field/modular-balanced.h
@@ -0,0 +1,27 @@
+/* -*- 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
+/* linbox/field/modular-balanced.h
+ * Copyright (C) 2010 LinBox
+ * Written by Brice Boyer <brice.boyer at imag.fr>
+ *
+ * See COPYING for license information.
+ */
+
+/** @file field/modular-balanced.h
+ * @ingroup field
+ * @brief Common header for any modular-balanced field.
+ * Use <code>\#include<modular-balanced></code> to get access to any modular
+ * balanced representation.
+ */
+
+#ifndef __LINBOX_modular_balanced_H
+#define __LINBOX_modular_balanced_H
+
+#include "linbox/field/modular-balanced-float.h"
+#include "linbox/field/modular-balanced-double.h"
+#include "linbox/field/modular-balanced-int32.h"
+#ifdef __LINBOX_HAVE_INT64
+#include "linbox/field/modular-balanced-int64.h"
+#endif
+
+#endif
diff --git a/linbox/field/modular-byte.h b/linbox/field/modular-byte.h
index 3d43bb2..d6d28aa 100644
--- a/linbox/field/modular-byte.h
+++ b/linbox/field/modular-byte.h
@@ -1,7 +1,31 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-#ifndef __LINBOX_MODULAR__INT8_H
-#define __LINBOX_MODULAR__INT8_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
+/* Copyright (C) 2010 LinBox
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*! @file field/modular-byte.h
+ * @ingroup field
+ * @brief  representation of <code>Z/mZ</code> over \c byte .
+ */
+#ifndef __LINBOX_modular_bit_H
+#define __LINBOX_modular_bit_H
 
 
 #include "linbox/linbox-config.h"
@@ -12,25 +36,24 @@
 #include "linbox/util/debug.h"
 #include <linbox/field/field-traits.h>
 
-#ifndef LINBOX_MAX_INT8
-#define LINBOX_MAX_INT8 127
+#ifndef LINBOX_MAX_INT8 /* 127 */
+#define LINBOX_MAX_INT8 INT8_MAX
 #endif
 
-// This is replaced by FieldTraits< Modular<int8> >::maxModulus(integer&)
-// #ifndef LINBOX_MAX_INT8_MODULUS
-// #define LINBOX_MAX_INT8_MODULUS 127
-// #endif
+#ifdef __ICC
+#pragma warning(disable:2259)
+#endif
 
 // Namespace in which all LinBox code resides
-namespace LinBox 
-{ 
+namespace LinBox
+{
 
 	template<class Element>
 	class Modular;
-	
+
 	template<class Element>
 	class ModularRandIter;
-	
+
 	template<class Field>
 	class FieldAXPY;
 
@@ -47,147 +70,200 @@ namespace LinBox
 	struct ClassifyRing<Modular<Element> >;
 
 	template <>
-	struct ClassifyRing<Modular<int8> >{
+	struct ClassifyRing<Modular<int8_t> >{
 		typedef RingCategories::ModularTag categoryTag;
 	};
 
 	/** \brief Specialization of Modular to signed 8 bit element type with efficient dot product.
-         * 
-         * Efficient element operations for dot product, mul, axpy, by using floating point
-         * inverse of modulus (borrowed from NTL) and some use of non-normalized intermediate values.
-         * 
-         * Requires: modulus < 2^7. 
-         * Intended use: prime modulus < 2^7.
+	 *
+	 * Efficient element operations for dot product, mul, axpy, by using floating point
+	 * inverse of modulus (borrowed from NTL) and some use of non-normalized intermediate values.
+	 *
+	 * Requires: modulus < 2^7.
+	 * Intended use: prime modulus < 2^7.
 	 \ingroup field
-	*/
+	 */
 	template <>
-	class Modular<int8> : public FieldInterface {
+	class Modular<int8_t> : public FieldInterface {
+	public:
+		typedef int8_t Element;
 	protected:
-		int8 modulus;
+		Element modulus;
+		unsigned long lmodulus ;
 		double modulusinv;
-	public:	       
-		friend class FieldAXPY<Modular<int8> >;
-		friend class DotProductDomain<Modular<int8> >;
-		friend class MVProductDomain<Modular<int8> >;
+	public:
+		friend class FieldAXPY<Modular<Element> >;
+		friend class DotProductDomain<Modular<Element> >;
+		friend class MVProductDomain<Modular<Element> >;
 
-		typedef int8 Element;
 		typedef ModularRandIter<Element> RandIter;
 
 		//default modular field,taking 65521 as default modulus
-		Modular () :modulus(13){modulusinv=1/(double)13;}
+		Modular () :
+			modulus(13),lmodulus(13)
+		{
+			modulusinv=1/(double)13;
+		}
 
-		Modular (int value, int exp = 1)  : modulus(value) {
-			modulusinv = 1 / ((double) value); 
-			if(exp != 1) throw PreconditionFailed(__FUNCTION__,__LINE__,"exponent must be 1");
-			if(value <= 1) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
+		Modular (int value, int exp = 1)  :
+			modulus(Element(value)),lmodulus((unsigned int)value)
+		{
+			modulusinv = 1 / ((double) value);
+#ifdef DEBUG
+			if(exp != 1) throw PreconditionFailed(__func__,__FILE__,__LINE__,"exponent must be 1");
+			if(value <= 1) throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus must be > 1");
 			integer max;
-			if(value > FieldTraits< Modular<int8> >::maxModulus(max)) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus is too big");
+			if(value > FieldTraits< Modular<Element> >::maxModulus(max)) throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus is too big");
+#endif
 		}
 
-		Modular(const Modular<int8>& mf) : modulus(mf.modulus),modulusinv(mf.modulusinv){}
+		Modular(const Modular<Element>& mf) :
+			modulus(mf.modulus),lmodulus(mf.lmodulus),modulusinv(mf.modulusinv)
+		{}
 
-		Modular &operator=(const Modular<int8> &F) {
-			modulus = F.modulus;
+		Modular &operator=(const Modular<Element> &F)
+		{
+			modulus    = F.modulus;
+			lmodulus   = F.lmodulus;
 			modulusinv = F.modulusinv;
 			return *this;
 		}
 
-	
-		inline integer &cardinality (integer &c) const{ 
+
+		inline integer &cardinality (integer &c) const
+		{
 			return c = modulus;
 		}
 
-		inline integer &characteristic (integer &c) const {
-			return c = modulus; 
+		inline integer &characteristic (integer &c) const
+		{
+			return c = modulus;
 		}
 
-		inline integer &convert (integer &x, const Element &y) const { 
+		inline unsigned long cardinality () const
+		{
+			return  lmodulus;
+		}
+
+		inline unsigned  long characteristic () const
+		{
+			return  lmodulus;
+		}
+
+
+		inline integer &convert (integer &x, const Element &y) const
+		{
 			return x = y;
 		}
-		
-		inline std::ostream &write (std::ostream &os) const {
-			return os << "int8 mod " << (int)modulus;
+
+		inline std::ostream &write (std::ostream &os) const
+		{
+			return os << "Element mod " << (int)modulus;
 		}
-		
-		inline std::istream &read (std::istream &is) {
+
+		inline std::istream &read (std::istream &is)
+		{
 			int prime;
-			is >> prime; 
-			modulus = prime;
+			is >> prime;
+			modulus = (Element) prime;
 			modulusinv = 1 /((double) modulus );
-			if(prime <= 1) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
+#ifdef DEBUG
+			if(prime <= 1) throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus must be > 1");
 			integer max;
-			if(prime > FieldTraits< Modular<int8> >::maxModulus(max)) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus is too big");
-		
+			if(prime > FieldTraits< Modular<Element> >::maxModulus(max)) throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus is too big");
+#endif
+
 			return is;
 		}
-		
-		inline std::ostream &write (std::ostream &os, const Element &x) const {
+
+		inline std::ostream &write (std::ostream &os, const Element &x) const
+		{
 			return os << x;
 		}
 
-		inline std::istream &read (std::istream &is, Element &x) const {
+		inline std::istream &read (std::istream &is, Element &x) const
+		{
 			integer tmp;
 			is >> tmp;
-			init(x,tmp); 
+			init(x,tmp);
 			return is;
 		}
-		
 
-		inline Element &init (Element &x, const integer &y) const  {
-			x =(int8)((int16) (y % integer (modulus)));
+
+		inline Element &init (Element &x, const integer &y) const
+		{
+			x =(Element)((int16_t) (y % (long) (modulus)));
 			if (x < 0) x += modulus;
 			return x;
 		}
 
-		inline Element& init(Element& x, int y =0) const {
+		inline Element& init(Element& x, int y =0) const
+		{
 			x = y % modulus;
 			if ( x < 0 ) x += modulus;
 			return x;
 		}
 
-		inline Element& init(Element& x, long y) const {
+		inline Element& init(Element& x, long y) const
+		{
 			x = y % modulus;
 			if ( x < 0 ) x += modulus;
 			return x;
 		}
-		
-		inline Element& assign(Element& x, const Element& y) const {
+
+	inline Element& init(Element& x, long unsigned y) const
+		{
+			x = Element (y % lmodulus);
+			if ( x < 0 ) x += modulus;
+			return x;
+		}
+
+
+		inline Element& assign(Element& x, const Element& y) const
+		{
 			return x=y;
 		}
-									
-		
-		inline bool areEqual (const Element &x, const Element &y) const {
+
+
+		inline bool areEqual (const Element &x, const Element &y) const
+		{
 			return x == y;
 		}
 
-		inline  bool isZero (const Element &x) const {
-			return x == 0; 
+		inline  bool isZero (const Element &x) const
+		{
+			return x == 0;
 		}
-		
-		inline bool isOne (const Element &x) const {
-			return x == 1; 
+
+		inline bool isOne (const Element &x) const
+		{
+			return x == 1;
 		}
 
-		inline Element &add (Element &x, const Element &y, const Element &z) const {
+		inline Element &add (Element &x, const Element &y, const Element &z) const
+		{
 			x = y + z;
-			if ( (uint8)x >= modulus ) x =( (uint8)x )- modulus;
+			if ( (uint8_t)x >= modulus )
+				x =Element(( (uint8_t)x )- modulus);
 			return x;
 		}
- 
-		inline Element &sub (Element &x, const Element &y, const Element &z) const {
+
+		inline Element &sub (Element &x, const Element &y, const Element &z) const
+		{
 			x = y - z;
 			if (x < 0) x += modulus;
 			return x;
 		}
-		
-		inline Element &mul (Element &x, const Element &y, const Element &z) const {
+
+		inline Element &mul (Element &x, const Element &y, const Element &z) const
+		{
 			Element q;
 
-			double ab=((double) y)* ((double) z);		
+			double ab=((double) y)* ((double) z);
 			q  = (Element)(ab*modulusinv);  // q could be off by (+/-) 1
 			x = (Element) (ab - ((double) q )* ((double) modulus));
-			
-			
+
+
 			if (x >= modulus)
 				x -= modulus;
 			else if (x < 0)
@@ -195,123 +271,144 @@ namespace LinBox
 
 			return x;
 		}
- 
-		inline Element &div (Element &x, const Element &y, const Element &z) const {
+
+		inline Element &div (Element &x, const Element &y, const Element &z) const
+		{
 			Element temp;
 			inv (temp, z);
 			return mul (x, y, temp);
 		}
- 
-		inline Element &neg (Element &x, const Element &y) const {
+
+		inline Element &neg (Element &x, const Element &y) const
+		{
 			if(y==0) return x=0;
 			else return x=modulus-y;
 		}
- 
-		inline Element &inv (Element &x, const Element &y) const {
-			Element d, t;			
+
+		inline Element &inv (Element &x, const Element &y) const
+		{
+			Element d, t;
 			XGCD(d, x, t, y, modulus);
+#ifdef DEBUG
 			if (d != 1)
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"InvMod: inverse undefined");
+				throw PreconditionFailed(__func__,__FILE__,__LINE__,"InvMod: inverse undefined");
+#endif
 			if (x < 0)
 				return x += modulus;
 			else
 				return x;
-							      
 		}
 
-		inline Element &axpy (Element &r, 
-				      const Element &a, 
+		inline Element &axpy (Element &r,
+				      const Element &a,
 				      const Element &x,
-				      const Element &y) const {
+				      const Element &y) const
+		{
 			Element q;
 
-			double ab = ((double) a)* ((double) x) + y;		
+			double ab = ((double) a)* ((double) x) + y;
 			q  = (Element)(ab*modulusinv);  // q could be off by (+/-) 1
 			r = (Element) (ab - ((double) q )* ((double) modulus));
-			
-			
+
+
 			if (r >= modulus)
 				r -= modulus;
 			else if (x < 0)
 				r += modulus;
 
-			return r;	
+			return r;
 
 		}
 
-		inline Element &addin (Element &x, const Element &y) const {
+		inline Element &addin (Element &x, const Element &y) const
+		{
 			x += y;
-			if ( ((uint8) x) >= modulus ) x = ((uint8) x)-modulus;
+			if ( ((uint8_t) x) >= modulus )
+				x = Element( ((uint8_t) x)-modulus );
 			return x;
 		}
- 
-		inline Element &subin (Element &x, const Element &y) const {
+
+		inline Element &subin (Element &x, const Element &y) const
+		{
 			x -= y;
 			if (x < 0) x += modulus;
 			return x;
 		}
- 
-		inline Element &mulin (Element &x, const Element &y) const {
+
+		inline Element &mulin (Element &x, const Element &y) const
+		{
 			return mul(x,x,y);
 		}
- 
-		inline Element &divin (Element &x, const Element &y) const {
+
+		inline Element &divin (Element &x, const Element &y) const
+		{
 			return div(x,x,y);
 		}
- 
-		inline Element &negin (Element &x) const {
-			if (x == 0) return x; 
-			else return x = modulus - x; 
+
+		inline Element &negin (Element &x) const
+		{
+			if (x == 0) return x;
+			else return x = modulus - x;
 		}
- 
-		inline Element &invin (Element &x) const {
+
+		inline Element &invin (Element &x) const
+		{
 			return inv (x, x);
 		}
 
-		inline Element &axpyin (Element &r, const Element &a, const Element &x) const {
-			
-			
+		inline Element &axpyin (Element &r, const Element &a, const Element &x) const
+		{
+
+
 			Element q;
 
-			double ab = ((double) a)* ((double) x) + r;		
+			double ab = ((double) a)* ((double) x) + r;
 			q  = (Element)(ab*modulusinv);  // q could be off by (+/-) 1
 			r = (Element) (ab - ((double) q )* ((double) modulus));
-			
-			
+
+
 			if (r >= modulus)
 				r -= modulus;
 			else if (x < 0)
 				r += modulus;
 
-			return r;	
+			return r;
 		}
 
-		static inline int8 getMaxModulus() { return 127; } // 2^7-1
+		static inline Element getMaxModulus()
+		{
+		       	return INT8_MAX;
+		} // 2^7-1
 
 
 	private:
 
-		static void XGCD(int8& d, int8& s, int8& t, int8 a, int8 b) {
-			int8  u, v, u0, v0, u1, v1, u2, v2, q, r;
-			
-			int8 aneg = 0, bneg = 0;
-			
+		static void XGCD(Element& d, Element& s, Element& t, Element a, Element b)
+		{
+			Element  u, v, u0, v0, u1, v1, u2, v2, q, r;
+
+			Element aneg = 0, bneg = 0;
+
 			if (a < 0) {
-				if (a < -LINBOX_MAX_INT8) throw PreconditionFailed(__FUNCTION__,__LINE__,"XGCD: integer overflow");
+#ifdef DEBUG
+				if (a < -LINBOX_MAX_INT8) throw PreconditionFailed(__func__,__FILE__,__LINE__,"XGCD: integer overflow");
+#endif
 				a = -a;
 				aneg = 1;
 			}
-			
+
 			if (b < 0) {
-				if (b < -LINBOX_MAX_INT8) throw PreconditionFailed(__FUNCTION__,__LINE__,"XGCD: integer overflow");
+#ifdef DEBUG
+				if (b < -LINBOX_MAX_INT8) throw PreconditionFailed(__func__,__FILE__,__LINE__,"XGCD: integer overflow");
+#endif
 				b = -b;
 				bneg = 1;
 			}
-			
+
 			u1 = 1; v1 = 0;
 			u2 = 0; v2 = 1;
 			u = a; v = b;
-			
+
 			while (v != 0) {
 				q = u / v;
 				r = u % v;
@@ -324,299 +421,314 @@ namespace LinBox
 				u1 = u0;
 				v1 = v0;
 			}
-			
+
 			if (aneg)
 				u1 = -u1;
-			
+
 			if (bneg)
 				v1 = -v1;
-			
+
 			d = u;
 			s = u1;
 			t = v1;
 		}
-		
+
 	};
 
 	template <>
-	class FieldAXPY<Modular<int8> > {	  
+	class FieldAXPY<Modular<int8_t> > {
 	public:
-	  
-		typedef int8 Element;
-		typedef Modular<int8> Field;
-	  
-		FieldAXPY (const Field &F) : _F (F),_y(0) {
+
+		typedef int8_t Element;
+		typedef Modular<int8_t> Field;
+
+		FieldAXPY (const Field &F) :
+			_F (F),_y(0)
+		{
 		}
 
-		FieldAXPY (const FieldAXPY &faxpy) : _F (faxpy._F), _y (0){}
-	  
-		FieldAXPY<Modular<int8> > &operator = (const FieldAXPY &faxpy) {
-			_F = faxpy._F; 
-			_y = faxpy._y; 
+		FieldAXPY (const FieldAXPY &faxpy) :
+			_F (faxpy._F), _y (0)
+		{}
+
+		FieldAXPY<Modular<int8_t> > &operator = (const FieldAXPY &faxpy)
+		{
+			_F = faxpy._F;
+			_y = faxpy._y;
 
-			return *this; 
+			return *this;
 		}
-	  
-		inline uint64& mulacc (const Element &a, const Element &x) {
-			uint64 t = ( (uint16) a ) * ( (uint16) x );
-			return _y +=t;		 
+
+		inline uint64_t& mulacc (const Element &a, const Element &x)
+		{
+			uint64_t t = ( (uint16_t) a ) * ( (uint16_t) x );
+			return _y +=t;
 		}
 
-		inline uint64& accumulate (const Element &t) {
-			return _y += t;		 
+		inline uint64_t& accumulate (const Element &t)
+		{
+			return _y += t;
 		}
 
-		inline Element& get (Element &y) {
-			y =_y % (uint64) _F.modulus;
+		inline Element& get (Element &y)
+		{
+			y =_y % (uint64_t) _F.modulus;
 			return y;
 		}
 
-		inline FieldAXPY &assign (const Element y) {
-			_y = y; 
+		inline FieldAXPY &assign (const Element y)
+		{
+			_y = y;
 			return *this;
 		}
 
-		inline void reset() {
+		inline void reset()
+		{
 			_y = 0;
 		}
 
 	private:
-	  
+
 		Field _F;
-		uint64 _y;
-		uint8 _two_64;
+		uint64_t _y;
+		uint8_t _two_64;
 	};
 
 
 	template <>
-	class DotProductDomain<Modular<int8> > : private virtual VectorDomainBase<Modular<int8> > {
+	class DotProductDomain<Modular<int8_t> > : private virtual VectorDomainBase<Modular<int8_t> > {
+
+	public:
+		typedef int8_t Element;
+		DotProductDomain (const Modular<int8_t> &F) :
+			VectorDomainBase<Modular<int8_t> > (F)
+		{ }
 
-	public:	  
-		typedef int8 Element;	 
-		DotProductDomain (const Modular<int8> &F)
-			: VectorDomainBase<Modular<int8> > (F) {
-		}
-	  
 	protected:
 		template <class Vector1, class Vector2>
-		inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const {
-		  
+		inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
+
 			typename Vector1::const_iterator i;
 			typename Vector2::const_iterator j;
-		  
-			uint64 y = 0;
-			// uint64 t;
-		  
+
+			uint64_t y = 0;
+			// uint64_t t;
+
 			for (i = v1.begin (), j = v2.begin (); i < v1.end (); ++i, ++j) {
-				y  += ( (uint16) *i ) * ( (uint16) *j );
+				y  += ( (uint16_t) *i ) * ( (uint16_t) *j );
 			}
-		
-			
-			y %= (uint64) _F.modulus;
-		  
+
+
+			y %= (uint64_t) _F.modulus;
+
 			return res = y;
-			
+
 		}
-	  
+
 		template <class Vector1, class Vector2>
-		inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const {		  
+		inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
 			typename Vector1::first_type::const_iterator i_idx;
 			typename Vector1::second_type::const_iterator i_elt;
-		  
-			uint64 y = 0;
-		  
+
+			uint64_t y = 0;
+
 			for (i_idx = v1.first.begin (), i_elt = v1.second.begin (); i_idx != v1.first.end (); ++i_idx, ++i_elt) {
-				y += ( (uint16) *i_elt ) * ( (uint16) v2[*i_idx] );
+				y += ( (uint16_t) *i_elt ) * ( (uint16_t) v2[*i_idx] );
 			}
-			
-			y %= (uint64) _F.modulus;
-		  
+
+			y %= (uint64_t) _F.modulus;
+
 			return res = y;
 
 		}
-	  
+
 	};
 
-	
+
 	template <>
-	class MVProductDomain<Modular<int8> >
+	class MVProductDomain<Modular<int8_t> >
 	{
 	public:
 
-		typedef int8 Element;
+		typedef int8_t Element;
 
 	protected:
 		template <class Vector1, class Matrix, class Vector2>
 		inline Vector1 &mulColDense
-		(const VectorDomain<Modular<int8> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v) const
+		(const VectorDomain<Modular<int8_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v) const
 		{
 			return mulColDenseSpecialized
-				(VD, w, A, v, VectorTraits<typename Matrix::Column>::VectorCategory ());
+			(VD, w, A, v, VectorTraits<typename Matrix::Column>::VectorCategory ());
 		}
 
 	private:
 		template <class Vector1, class Matrix, class Vector2>
 		Vector1 &mulColDenseSpecialized
-		(const VectorDomain<Modular<int8> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		(const VectorDomain<Modular<int8_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
 		 VectorCategories::DenseVectorTag) const;
 		template <class Vector1, class Matrix, class Vector2>
 		Vector1 &mulColDenseSpecialized
-		(const VectorDomain<Modular<int8> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		(const VectorDomain<Modular<int8_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
 		 VectorCategories::SparseSequenceVectorTag) const;
 		template <class Vector1, class Matrix, class Vector2>
 		Vector1 &mulColDenseSpecialized
-		(const VectorDomain<Modular<int8> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		(const VectorDomain<Modular<int8_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
 		 VectorCategories::SparseAssociativeVectorTag) const;
 		template <class Vector1, class Matrix, class Vector2>
 		Vector1 &mulColDenseSpecialized
-		(const VectorDomain<Modular<int8> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		(const VectorDomain<Modular<int8_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
 		 VectorCategories::SparseParallelVectorTag) const;
 
-		mutable std::vector<uint64> _tmp;
+		mutable std::vector<uint64_t> _tmp;
 	};
 
 	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &MVProductDomain<Modular<int8> >::mulColDenseSpecialized
-	(const VectorDomain<Modular<int8> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-	 VectorCategories::DenseVectorTag) const {
-		
+	Vector1 &MVProductDomain<Modular<int8_t> >::mulColDenseSpecialized
+	(const VectorDomain<Modular<int8_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+	 VectorCategories::DenseVectorTag) const
+	{
+
 		linbox_check (A.coldim () == v.size ());
 		linbox_check (A.rowdim () == w.size ());
-		
+
 		typename Matrix::ConstColIterator i = A.colBegin ();
 		typename Vector2::const_iterator j;
 		typename Matrix::Column::const_iterator k;
-		std::vector<uint64>::iterator l;
+		std::vector<uint64_t>::iterator l;
 
-		uint64 t;
+		uint64_t t;
 
 		if (_tmp.size () < w.size ())
 			_tmp.resize (w.size ());
-		
+
 		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
-		
+
 		for (j = v.begin (); j != v.end (); ++j, ++i) {
 			for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
-				t = ((uint16) *k) * ((uint16) *j);
+				t = ((uint16_t) *k) * ((uint16_t) *j);
 
 				*l += t;
-				
+
 			}
 		}
-		
+
 		typename Vector1::iterator w_j;
-		
+
 		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
 			*w_j = *l % VD.field ().modulus;
-		
+
 		return w;
 	}
-	
+
 	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &MVProductDomain<Modular<int8> >::mulColDenseSpecialized
-	(const VectorDomain<Modular<int8> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+	Vector1 &MVProductDomain<Modular<int8_t> >::mulColDenseSpecialized
+	(const VectorDomain<Modular<int8_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
 	 VectorCategories::SparseSequenceVectorTag) const
 	{
 		linbox_check (A.coldim () == v.size ());
 		linbox_check (A.rowdim () == w.size ());
-			
+
 		typename Matrix::ConstColIterator i = A.colBegin ();
 		typename Vector2::const_iterator j;
 		typename Matrix::Column::const_iterator k;
-		std::vector<uint64>::iterator l;
-			
-		uint64 t;
-			
+		std::vector<uint64_t>::iterator l;
+
+		uint64_t t;
+
 		if (_tmp.size () < w.size ())
 			_tmp.resize (w.size ());
-			
+
 		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
-			
+
 		for (j = v.begin (); j != v.end (); ++j, ++i) {
 			for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
-				t = ((uint16) k->second) * ((uint16) *j);
+				t = ((uint16_t) k->second) * ((uint16_t) *j);
 
 				_tmp[k->first] += t;
-					
+
 			}
 		}
-			
+
 		typename Vector1::iterator w_j;
-			
+
 		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
 			*w_j = *l % VD.field ().modulus;
-			
+
 		return w;
 	}
-	
+
 	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &MVProductDomain<Modular<int8> >::mulColDenseSpecialized
-	(const VectorDomain<Modular<int8> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-	 VectorCategories::SparseAssociativeVectorTag) const {
+	Vector1 &MVProductDomain<Modular<int8_t> >::mulColDenseSpecialized
+	(const VectorDomain<Modular<int8_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+	 VectorCategories::SparseAssociativeVectorTag) const
+	{
 
 		linbox_check (A.coldim () == v.size ());
 		linbox_check (A.rowdim () == w.size ());
-		
+
 		typename Matrix::ConstColIterator i = A.colBegin ();
 		typename Vector2::const_iterator j;
 		typename Matrix::Column::const_iterator k;
-		std::vector<uint64>::iterator l;
-		
-		uint64 t;
-		
+		std::vector<uint64_t>::iterator l;
+
+		uint64_t t;
+
 		if (_tmp.size () < w.size ())
 			_tmp.resize (w.size ());
-		
+
 		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
-		
+
 		for (j = v.begin (); j != v.end (); ++j, ++i) {
 			for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
-				t = ((uint16) k->second) * ((uint16) *j);
-				
+				t = ((uint16_t) k->second) * ((uint16_t) *j);
+
 				_tmp[k->first] += t;
-				
+
 			}
 		}
-		
+
 		typename Vector1::iterator w_j;
-		
+
 		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
 			*w_j = *l % VD.field ().modulus;
-		
+
 		return w;
 	}
 
 	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &MVProductDomain<Modular<int8> >::mulColDenseSpecialized
-	(const VectorDomain<Modular<int8> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-	 VectorCategories::SparseParallelVectorTag) const {
-		
+	Vector1 &MVProductDomain<Modular<int8_t> >::mulColDenseSpecialized
+	(const VectorDomain<Modular<int8_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+	 VectorCategories::SparseParallelVectorTag) const
+	{
+
 		linbox_check (A.coldim () == v.size ());
 		linbox_check (A.rowdim () == w.size ());
-		
+
 		typename Matrix::ConstColIterator i = A.colBegin ();
 		typename Vector2::const_iterator j;
 		typename Matrix::Column::first_type::const_iterator k_idx;
 		typename Matrix::Column::second_type::const_iterator k_elt;
-		std::vector<uint64>::iterator l;
-		
-		uint64 t;
-		
+		std::vector<uint64_t>::iterator l;
+
+		uint64_t t;
+
 		if (_tmp.size () < w.size ())
 			_tmp.resize (w.size ());
-		
+
 		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
-		
+
 		for (j = v.begin (); j != v.end (); ++j, ++i) {
 			for (k_idx = i->first.begin (), k_elt = i->second.begin (), l = _tmp.begin ();
 			     k_idx != i->first.end ();
 			     ++k_idx, ++k_elt, ++l)
-				{
-					t = ((uint16) *k_elt) * ((uint16) *j);
+			{
+				t = ((uint16_t) *k_elt) * ((uint16_t) *j);
 
-					_tmp[*k_idx] += t;
+				_tmp[*k_idx] += t;
 
-				}
+			}
 		}
 
 		typename Vector1::iterator w_j;
@@ -626,9 +738,13 @@ namespace LinBox
 
 		return w;
 	}
-  	  
+
 }
 
-#include "linbox/randiter/modular.h"
+#ifdef __ICC
+#pragma warning(enable:2259)
 #endif
 
+#include "linbox/randiter/modular.h"
+#endif //__LINBOX_modular_bit_H
+
diff --git a/linbox/field/modular-crooked-double.h b/linbox/field/modular-crooked-double.h
new file mode 100644
index 0000000..c8b695b
--- /dev/null
+++ b/linbox/field/modular-crooked-double.h
@@ -0,0 +1,576 @@
+/* -*- 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
+
+/* linbox/field/modular-crooked-double.h
+ * Copyright (C) 2010 LinBox
+ *
+ * adapted from field/modular-balanced-double.h
+ * by Brice Boyer <brice.boyer at imag.fr>
+ *
+ * ------------------------------------
+ *
+ * See COPYING for license information.
+ */
+
+/*! @file field/modular-crooked-double.h
+ * @ingroup field
+ * @brief Crooked  representation of <code>Z/mZ</code> over \c double .
+ * This is a balanced representation with more positive (or negative) representants.
+ * Being tested.
+ */
+#ifndef __LINBOX_modular_crooked_double_H
+#define __LINBOX_modular_crooked_double_H
+
+
+#include "linbox/linbox-config.h"
+#include "linbox/integer.h"
+#include "linbox/vector/vector-domain.h"
+#include "linbox/field/field-interface.h"
+#include "linbox/field/field-traits.h"
+#include "linbox/util/field-axpy.h"
+#include "linbox/util/debug.h"
+#include <cmath>
+#include "linbox/field/field-traits.h"
+#include "linbox/randiter/modular-crooked.h"
+#include "linbox/randiter/nonzero.h"
+#include <iostream>
+
+
+// Namespace in which all LinBox code resides
+namespace LinBox
+{
+	template< class Element >
+	class ModularCrooked;
+
+	template <class Ring>
+	struct ClassifyRing;
+
+	template <class Element>
+	struct ClassifyRing<ModularCrooked<Element> >;
+
+	template <>
+	struct ClassifyRing<ModularCrooked<double> >
+	{
+		typedef RingCategories::ModularTag categoryTag;
+	};
+
+	class MultiModDouble;
+
+	/// \ingroup field
+	template <>
+	class ModularCrooked<double> : public FieldInterface {
+
+	protected:
+
+		double  modulus;
+		double up_mod;
+		double lo_mod;
+		unsigned long   lmodulus;
+
+	public:
+
+		friend class FieldAXPY<ModularCrooked<double> >;
+		friend class DotProductDomain<ModularCrooked<double> >;
+		friend class MultiModDouble;
+
+		typedef double Element;
+		typedef ModularCrookedRandIter<double> RandIter;
+		typedef NonzeroRandIter<ModularCrooked<double>,RandIter> NonZeroRandIter;
+
+		static ClassifyRing <ModularCrooked<double> >::categoryTag
+		getCategory()
+		{
+			return ClassifyRing<ModularCrooked<double> >::categoryTag();
+		}
+
+		ModularCrooked () {}
+
+		ModularCrooked (int32_t p, float f = 0.5, int exp = 1) :
+			modulus((double)p), up_mod( std::ceil((p-1.)*f) ), lo_mod( up_mod-modulus+1 ),lmodulus (p)
+		{
+#ifdef DEBUG
+			if(modulus <= 1)
+				throw PreconditionFailed(__func__,
+							 __LINE__,
+							 "modulus must be > 1");
+			if( exp != 1 ) throw PreconditionFailed(__func__,
+								__LINE__,
+								"exponent must be 1");
+			integer max;
+			if (modulus > (double) FieldTraits<ModularCrooked<double> >::maxModulus(max))
+				throw PreconditionFailed (__func__,
+							  __LINE__,
+							  "modulus is too big");
+#endif
+		}
+
+		ModularCrooked (double p, float f = 0.5) :
+			modulus((double)p), up_mod( std::ceil((p-1.)*f) ), lo_mod( up_mod-modulus+1 ),lmodulus (p)
+		{
+#ifdef DEBUG
+			if (modulus <= 1)
+				throw PreconditionFailed(__func__,
+							 __LINE__,
+							 "modulus must be > 1");
+			integer max;
+			if (modulus > (double) FieldTraits<ModularCrooked<double> >::maxModulus(max))
+				throw PreconditionFailed (__func__,
+							  __LINE__,
+							  "modulus is too big");
+#endif
+		}
+
+		ModularCrooked (long int p, float f = 0.5) :
+			modulus((double)p), up_mod( std::ceil((p-1.)*f) ), lo_mod(  up_mod-modulus+1 ),lmodulus (p)
+		{
+#ifdef DEBUG
+			if ((double) modulus <= 1)
+				throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus must be > 1");
+			integer max;
+			if ((double) modulus > (double) FieldTraits<ModularCrooked<double> >::maxModulus(max))
+				throw PreconditionFailed (__func__,
+							  __LINE__,
+							  "modulus is too big");
+#endif
+		}
+
+		ModularCrooked (const integer& p, float f = 0.5)  :
+			modulus((double)p), up_mod( std::ceil((double)(p-1)*f) ), lo_mod(  up_mod-modulus+1 ),lmodulus (p)
+		{
+#ifdef DEBUG
+			if(modulus <= 1)
+				throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus must be > 1");
+			if(modulus > getMaxModulus())
+				throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus is too big");
+#endif
+
+		}
+
+		ModularCrooked (const ModularCrooked<double>& mf) :
+			modulus (mf.modulus)
+			,up_mod (mf.up_mod)
+			,lo_mod (mf.lo_mod)
+			,lmodulus (mf.lmodulus)
+		{}
+
+		const ModularCrooked &operator= (const ModularCrooked<double> &F)
+		{
+			modulus = F.modulus;
+			up_mod = F.up_mod;
+			lo_mod = F.lo_mod;
+			lmodulus= F.lmodulus;
+			return *this;
+		}
+
+
+		inline integer &cardinality (integer &c) const
+		{
+			return c = integer(modulus);
+		}
+
+		inline integer &characteristic (integer &c) const
+		{
+			return c = integer(modulus);
+		}
+
+		inline size_t characteristic () const
+		{
+			return modulus;
+		}
+
+
+		inline integer &convert (integer &x, const Element &y) const
+		{
+			if ( y < 0. ) return x = integer (y + modulus) ;
+			else return x = integer (y);
+		}
+
+		inline double &convert (double &x, const Element& y) const
+		{
+			return x=y;
+		}
+
+		inline float &convert (float &x, const Element& y) const
+		{
+			return x=y;
+		}
+
+		std::ostream &write (std::ostream &os) const
+		{
+			// os << modulus << '(' << lo_mod << ',' << up_mod << ')' << std::endl;
+			os << "crooked double mod " << int(modulus) << " @ " ;
+			os.precision(2) ;
+			os << (double)up_mod/(modulus-1);
+			os.precision();
+			return os ;
+		}
+
+		std::istream &read (std::istream &is)
+		{
+			is >> modulus;
+#ifdef DEBUG
+			if(modulus <= 1)
+				throw PreconditionFailed (__func__,
+							  __LINE__,
+							  "modulus must be > 1");
+			if(modulus > getMaxModulus())
+				throw PreconditionFailed (__func__,
+							  __LINE__,
+							  "modulus is too big");
+#endif
+			return is;
+		}
+
+		std::ostream &write (std::ostream &os, const Element &x) const
+		{
+			return os << int(x);
+		}
+
+		std::istream &read (std::istream &is, Element &x) const
+		{
+			integer tmp;
+			// JGD : should'nt it be double tmp ???
+			is >> tmp;
+			init(x,tmp);
+			return is;
+		}
+
+
+		inline Element &init (Element &x, const integer &y) const  {
+			x = (Element)(y%lmodulus);
+			if (x < lo_mod) return x += modulus;
+			if (x > up_mod) x -= modulus;
+
+			return x;
+		}
+
+		inline Element& init(Element& x, const double y =0) const
+		{
+
+			x = drem (y, modulus);
+			if (x < lo_mod) return x += modulus;
+			if (x > up_mod) x -= modulus;
+			return x;
+		}
+
+		inline Element& assign(Element& x, const Element& y) const
+		{
+			return x = y;
+		}
+
+		inline bool areEqual (const Element &x, const Element &y) const
+		{
+			return x == y;
+		}
+
+		inline  bool isZero (const Element &x) const
+		{
+			return x == 0.;
+		}
+
+		inline bool isOne (const Element &x) const
+		{
+			return x == 1.;
+		}
+
+		inline bool isMinusOne (const Element &x) const
+		{
+			return (x == -1.);
+		}
+
+		inline Element &add (Element &x,
+				     const Element &y,
+				     const Element &z) const
+		{
+			x = y + z;
+			if ( x < lo_mod ) return x += modulus;
+			if ( x > up_mod ) x -= modulus;
+			return x;
+		}
+
+		inline Element &sub (Element &x,
+				     const Element &y,
+				     const Element &z) const
+		{
+			x = y - z;
+			if (x < lo_mod ) return x += modulus;
+			if (x > up_mod ) x -= modulus;
+			return x;
+		}
+
+		inline Element &mul (Element &x, const Element &y, const Element &z) const
+		{
+			x = y * z;
+			return init (x,x);
+		}
+
+		inline Element &div (Element &x, const Element &y, const Element &z) const
+		{
+			Element temp;
+			inv (temp, z);
+			return mul (x, y, temp);
+		}
+
+		inline Element &neg (Element &x, const Element &y) const
+		{
+			return x = -y;
+		}
+
+		inline Element &inv (Element &x, const Element &y) const
+		{
+			// The extended Euclidean algoritm
+			int x_int, y_int, q, tx, ty, temp;
+			x_int = int (modulus);
+			y_int = (y < 0.) ? int(y + modulus) : int(y);
+			tx = 0;
+			ty = 1;
+
+			while (y_int != 0) {
+				// always: gcd (modulus,residue) = gcd (x_int,y_int)
+				//         sx*modulus + tx*residue = x_int
+				//         sy*modulus + ty*residue = y_int
+				q = x_int / y_int; // integer quotient
+				temp = y_int; y_int = x_int - q * y_int;
+				x_int = temp;
+				temp = ty; ty = tx - q * ty;
+				tx = temp;
+			}
+			if ( tx < lo_mod ) return x = tx + modulus;
+			if ( tx > up_mod ) return x = tx - modulus;
+			return x = (double) tx;
+		}
+
+		inline Element &axpy (Element &r,
+				      const Element &a,
+				      const Element &x,
+				      const Element &y) const
+		{
+			r = a * x + y;
+			return init (r, r);
+		}
+
+		inline Element &addin (Element &x, const Element &y) const
+		{
+			x += y;
+			if ( x < lo_mod ) return x += modulus;
+			if ( x > up_mod ) x -= modulus;
+			return x;
+		}
+
+		inline Element &subin (Element &x, const Element &y) const
+		{
+			x -= y;
+			if ( x < lo_mod ) return x += modulus;
+			if ( x > up_mod ) x -= modulus;
+			return x;
+		}
+
+		inline Element &mulin (Element &x, const Element &y) const
+		{
+			return mul(x,x,y);
+		}
+
+		inline Element &divin (Element &x, const Element &y) const
+		{
+			return div(x,x,y);
+		}
+
+		inline Element &negin (Element &x) const
+		{
+			return x = -x;
+		}
+
+		inline Element &invin (Element &x) const
+		{
+			return inv (x, x);
+		}
+
+		inline Element &axpyin (Element &r, const Element &a, const Element &x) const
+		{
+			r += a * x;
+			return init (r, r);
+		}
+
+		unsigned long AccBound(const Element&r) const
+		{
+			Element one, zero ; init(one,1UL) ; init(zero,0UL);
+			double max_double = (double) (1ULL<<DBL_MANT_DIG) - modulus ;
+			double p = std::max(up_mod,-lo_mod) ;
+			if (areEqual(zero,r))
+				return (unsigned long) (double(max_double)/p) ;
+			else if (areEqual(one,r))
+			{
+				if (modulus>= getMaxModulus())
+					return 0 ;
+				else
+					return (unsigned long) (double(max_double)/(p*p)) ;
+			}
+			else
+				throw LinboxError("Bad input, expecting 0 or 1");
+			return 0;
+		}
+
+
+		static inline double getMaxModulus()
+		{ return 67108864.0; } // 2^26
+
+	};
+
+#define SQR(A) \
+	((A)*(A))
+
+	template <>
+	class FieldAXPY<ModularCrooked<double> > {
+	public:
+
+		typedef double Element;
+		typedef ModularCrooked<double> Field;
+
+		FieldAXPY (const Field &F) :
+			_F (F), _y(0.) , _bound( (double) ((1ULL << 53) - (int) (SQR(std::max(_F.up_mod,-_F.lo_mod)))))
+		{}
+
+		FieldAXPY (const FieldAXPY &faxpy) :
+			_F (faxpy._F),
+			_y(faxpy._y), _bound(faxpy._bound)
+		{}
+
+		FieldAXPY<ModularCrooked<double> > &operator = (const FieldAXPY &faxpy)
+		{
+			_F = faxpy._F;
+			_y= faxpy._y;
+			_bound= faxpy._bound;
+			return *this;
+		}
+
+		inline Element& mulacc (const Element &a, const Element &x) {
+			//                 Element tmp= a*x;
+			//                 return accumulate(tmp);
+			return accumulate(a*x);
+		}
+
+		inline Element& accumulate (const Element &tmp) {
+			_y += tmp;
+			if (_y > _bound)
+				return _y = drem (_y, _F.modulus);
+			else
+				return _y;
+		}
+		inline Element& subumulate (const Element &tmp) {
+			_y -= tmp;
+			if (_y < 0)
+				return _y += _F.modulus;
+			else
+				return _y;
+		}
+
+		inline Element& get (Element &y) {
+			_y = drem (_y, _F.modulus);
+			return y=_y ;
+		}
+
+		inline FieldAXPY &assign (const Element y) {
+			_y = y;
+			return *this;
+		}
+
+		inline void reset() {
+			_y = 0.;
+		}
+
+		inline Element& set (const Element &tmp) {
+			_y = tmp;
+			if (_y > _bound)
+				return _y = drem (_y, _F.modulus);
+			else
+				return _y;
+		}
+
+	private:
+
+		Field _F;
+		double _y;
+		double _bound;
+	};
+
+	template <>
+	class DotProductDomain<ModularCrooked<double> > : private virtual VectorDomainBase<ModularCrooked<double> > {
+	private:
+		double _bound;
+		size_t _nmax;
+
+	public:
+		typedef double Element;
+		DotProductDomain (const ModularCrooked<double> &F) :
+			VectorDomainBase<ModularCrooked<double> > (F), _bound( (double) ( (1ULL<<53) - (int) (SQR(std::max(_F.up_mod,-_F.lo_mod)))))
+		{
+			_nmax= (size_t)floor((double(1<<26)* double(1<<26)*2.)/ (SQR(std::max(_F.up_mod,-_F.lo_mod))));
+		}
+
+	protected:
+		template <class Vector1, class Vector2>
+		inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
+
+			double y = 0.;
+			double t = 0.;
+			if (v1.size() < _nmax) {
+				for (size_t i = 0; i< v1.size();++i)
+					y += v1[i] * v2[i] ;
+				y = drem(y, _F.modulus);
+			}
+			else{
+				size_t i=0;
+				for (;i< v1.size()- _nmax ;i=i+_nmax){
+					for (size_t j=i;j<i+_nmax;++j)
+						y += v1[j] * v2[j];
+					t+=drem(y, _F.modulus);
+					y=0.;
+				}
+				for (;i < v1.size();++i)
+					y += v1[i] * v2[i];
+				t+=drem(y, _F.modulus);
+				y = drem(t, _F.modulus);
+			}
+			return res = y;
+		}
+
+		template <class Vector1, class Vector2>
+		inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
+
+			double y = 0.;
+			double t =0.;
+
+
+			if (v1.first.size() < _nmax) {
+				for (size_t i=0;i<v1.first.size();++i)
+					y+= v1.second[i] * v2[v1.first[i]];
+				y = drem(y, _F.modulus);
+			}
+			else {
+				size_t i=0;
+				for (;i< v1.first.size()- _nmax ;i=i+_nmax){
+					for (size_t j=i;j<i+_nmax;++j)
+						y += v1.second[j] * v2[v1.first[j]];
+					t+=drem(y, _F.modulus);
+					y=0.;
+				}
+				for (;i < v1.first.size();++i)
+					y += v1.second[i] * v2[v1.first[i]];
+				t+= drem(y, _F.modulus);
+				y = drem(t, _F.modulus);
+			}
+			return res = y;
+		}
+	};
+
+	template<class T>
+	std::ostream& operator<< (std::ostream & o, const ModularCrooked<T> & F)
+	{
+		return F.write(o);
+	}
+
+}
+#endif //__LINBOX_modular_crooked_double_H
+
diff --git a/linbox/field/modular-double.h b/linbox/field/modular-double.h
old mode 100755
new mode 100644
index 7654429..a52f2bb
--- a/linbox/field/modular-double.h
+++ b/linbox/field/modular-double.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/field/modular-double.h
  * Copyright (C) 2003 Pascal Giorgi
  *
@@ -10,11 +10,13 @@
  * See COPYING for license information.
  */
 
+/*! @file field/modular-double.h
+ * @ingroup field
+ * @brief Standard representation of <code>Z/mZ</code> over \c double .
+ */
 
-
-
-#ifndef __LINBOX_MODULAR_DOUBLE_H
-#define __LINBOX_MODULAR_DOUBLE_H
+#ifndef __LINBOX_modular_double_H
+#define __LINBOX_modular_double_H
 
 
 #include "linbox/linbox-config.h"
@@ -29,12 +31,13 @@
 #include "linbox/randiter/nonzero.h"
 #include "linbox/randiter/modular.h"
 
-
+#include "fflas-ffpack/field/modular-double.h"
 
 
 // Namespace in which all LinBox code resides
-namespace LinBox { 
-	
+namespace LinBox
+{
+
 	template< class Element >
 	class Modular;
 
@@ -45,413 +48,239 @@ namespace LinBox {
 	class NonzeroRandIter;
 
 	template <class Ring>
-	struct ClassifyRing; 
+	struct ClassifyRing;
+
 	template <class Element>
 	struct ClassifyRing<Modular<Element> >;
+
 	template <>
-	struct ClassifyRing<Modular<double> >{
+	struct ClassifyRing<Modular<double> > {
 		typedef RingCategories::ModularTag categoryTag;
 	};
 
 	class MultiModDouble;
-	
-	/// \ingroup field
-	template <>
-	class Modular<double> : public FieldInterface {
 
-	protected:
+	/*! \ingroup modular
+	 * Standard representation of \f$\mathbf{Z}/m\mathbf{Z}\f$.
+	 * If \c m is the modulus, then elements are represented in \f[ \left
+	 * \llbracket 0, m-1  \right \rrbracket.\f]
+	 */
+	template <>
+	class Modular<double> :
+	      public FFPACK::Modular<double>,public FieldInterface	{
+	      public:
+		      typedef double Element;
+
+	      protected:
+
+	      public:
+		      friend class FieldAXPY<Modular<Element> >;
+		      friend class DotProductDomain<Modular<Element> >;
+		      friend class MultiModDouble;
+
+	      public:
+
+		      typedef ModularRandIter<Element> RandIter;
+		      typedef NonzeroRandIter<Modular<Element>, ModularRandIter<Element> > NonZeroRandIter;
+
+		      static ClassifyRing<Modular<Element> >::categoryTag getCategory() {return ClassifyRing<Modular<Element> >::categoryTag();}
+
+		      Modular (const integer& p, int e=1) :
+			      FFPACK::Modular<double>((unsigned long) p)
+		      {
+			      linbox_check(e==1);
+#ifdef DEBUG
+			      if(modulus <= 1)
+				      throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus must be > 1");
+			      if(modulus > getMaxModulus())
+				      throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus is too big");
+#endif
+		      }
+
+		      Modular () : FFPACK::Modular<double>() {};
+
+		      integer &cardinality (integer &c) const
+		      {
+			      return c = integer(modulus);
+		      }
+
+		      integer &characteristic (integer &c) const
+		      {
+			      return c = integer(modulus);
+		      }
+
+		      integer &convert (integer &x, const Element &y) const
+		      {
+			      return x = integer(y);
+		      }
+
+		      template<class T>T&convert(T&x,const Element&y)const{return x=T(y);}
+		      template<class T>T&characteristic(T&x)const{return x=T(lmodulus);}
+		      unsigned long characteristic()const{return FFPACK::Modular<double>::characteristic();}
+		      unsigned long cardinality()const{return FFPACK::Modular<double>::cardinality();}
+		      template<class T>T&init(T&x)const{return init(x,0);}
+
+		      Element &init (Element &x, const integer &y) const
+		      {
+			      x = (Element)(y%lmodulus);
+			      if (x<0) x+= lmodulus ;
+			      linbox_check(x < lmodulus);
+			      linbox_check(!(x < 0));
+			      return x  ;
+		      }
+
+		       bool isMinusOne (const Element &x) const
+		      {
+			      return (x == modulus-1.);
+		      }
+
+		      /** Max number of operations before reducing
+		       * @param r if \c r=0, we consider how many \c += are performable.
+		       * if \c r=1, then we look for the maximum \c axpy operations doable.
+		       * @return \p 0 if the field is too big, a positive number otherwise, \p -1 if infinity
+		       * on general fields, it is \p 1.
+		       */
+		      unsigned long AccBound(const Element r) const
+		      {
+			      Element one, zero ; init(one,1UL) ; init(zero,0UL);
+			      Element max_Element = (Element) (1ULL<<DBL_MANT_DIG) - modulus ; /* other wise 2^52+(2^52-1) */
+			      Element p = modulus-1 ;
+			      if (areEqual(zero,r))
+				      return (unsigned long) (Element(max_Element)/p) ;
+			      else if (areEqual(one,r))
+			      {
+				      if (modulus>= getMaxModulus())
+					      return 0 ;
+				      else
+					      return (unsigned long) (Element(max_Element)/(modulus*modulus)) ;
+			      }
+			      else
+				      throw LinboxError("Bad input, expecting 0 or 1");
+			      return 0;
+		      }
+
+	      };
 
-		double  modulus;
-		unsigned long   lmodulus;
+	template <>
+	class FieldAXPY<Modular<double> > {
+	public:
 
-		//double inv_modulus;
-		
-	public:	       
-		friend class FieldAXPY<Modular<double> >;
-		friend class DotProductDomain<Modular<double> >;
-		friend class MultiModDouble;
-			       
 		typedef double Element;
-		typedef ModularRandIter<double> RandIter;
-		typedef NonzeroRandIter<Modular<double>, ModularRandIter<double> > NonZeroRandIter;
-
-		static ClassifyRing<Modular<double> >::categoryTag getCategory() {return ClassifyRing<Modular<double> >::categoryTag();}
-		
-
-
-		Modular () {}
-
-		Modular (int32 p, int exp = 1)  : modulus((double)p), lmodulus(p)//, inv_modulus(1./(double)p) 
-		{
-			if(modulus <= 1)
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
-			if( exp != 1 ) throw PreconditionFailed(__FUNCTION__,__LINE__,"exponent must be 1");
-			integer max;
-			if(modulus > (double) FieldTraits<Modular<double> >::maxModulus(max))
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus is too big");
-			
-		}
-
-		Modular (double p) : modulus(p), lmodulus((unsigned long)p) {
-			if( modulus <= 1 )
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
-			integer max;
-			if( modulus > (double) FieldTraits<Modular<double> >::maxModulus(max))
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus is too big");
-		}
-
-		Modular (long int p) :modulus((double)p), lmodulus(p) {
-			if( (double) modulus <= 1 )
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
-			integer max;
-			if( (double) modulus > (double) FieldTraits<Modular<double> >::maxModulus(max))
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus is too big");
-		}
+		typedef Modular<double> Field;
 
-		Modular (const integer& p) : modulus((double) p), lmodulus(p) //, inv_modulus(1./(double)p)
-		{
-			if(modulus <= 1)
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
-	             	if(modulus > 94906265)
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus is too big");
-				
-		}
+		FieldAXPY (const Field &F) :
+			_F (F) , //_invmod(1./_F.modulus),
+			_y(0.) , _bound( (double) ((1ULL << 53) - (int) (_F.modulus*_F.modulus)))
+		{}
 
-		Modular(const Modular<double>& mf) : modulus(mf.modulus), lmodulus(mf.lmodulus)//,inv_modulus(mf.inv_modulus)
+		FieldAXPY (const FieldAXPY &faxpy) :
+			_F (faxpy._F),// _invmod(faxpy._invmod) ,
+			_y(faxpy._y), _bound(faxpy._bound)
 		{}
 
-		const Modular &operator=(const Modular<double> &F) {
-			modulus = F.modulus;
-			lmodulus= F.lmodulus;
-			//inv_modulus = F.inv_modulus;
+		FieldAXPY<Modular<double> > &operator = (const FieldAXPY &faxpy)
+		{
+			_F = faxpy._F;
+			//_invmod= faxpy._invmod;
+			_y= faxpy._y;
+			_bound= faxpy._bound;
 			return *this;
 		}
 
-	
-		integer &cardinality (integer &c) const{ 
-			return c = integer(modulus);
-		}
-
-		integer &characteristic (integer &c) const {
-			return c = integer(modulus); 
-		}
-
-		integer &convert (integer &x, const Element &y) const { 
-			return x = integer(y);
-		}
-
-		double &convert (double &x, const Element& y) const {
-			return x=y;
-		}
-		
-		std::ostream &write (std::ostream &os) const {
-			return os << "double mod " << (int)modulus;
-		}
-		
-		std::istream &read (std::istream &is) {
-			is >> modulus; 
-			if(modulus <= 1) 
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
-		 	if(modulus > 94906265) 
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus is too big");
-
-			return is;
-		}
-		
-		std::ostream &write (std::ostream &os, const Element &x) const {
-			return os << (int)x;
-		}
-
-		std::istream &read (std::istream &is, Element &x) const {
-			integer tmp;
-                            // JGD : should'nt it be double tmp ???
-			is >> tmp;
-			init(x,tmp); 
-			return is;
-		}
-		
-
-		Element &init (Element &x, const integer &y) const  {
-// 			return x = (Element)mpz_fdiv_ui(y.get_mpz(),lmodulus );
-			return x = (Element)(y%lmodulus);
+		 Element& mulacc (const Element &a, const Element &x)
+		{
+			//                 Element tmp= a*x;
+			//                 return accumulate(tmp);
+			return accumulate(a*x);
 		}
 
-		inline Element& init(Element& x, double y =0) const {		  
-
-			//double tmp = y;
-
-			/*
-			int sign=0;
-			if (tmp < 0.0) {
-				tmp=-tmp;
-				sign=1;
-			}	
-			*/	
-
-			//			tmp = floor (y + 0.5);
-
-			//Some odds donot support it. It is in C99.
-			//tmp = round (y); 
-			
-			x = fmod (y, modulus);
-
-			/*
-			if (tmp > modulus) 
-				tmp -= (modulus * floor( tmp*inv_modulus));
-
-			if ( (!tmp) || (tmp == modulus) ){
-				return x = 0.0;
-				
-			}
+		 Element& accumulate (const Element &tmp)
+		{
+			_y += tmp;
+			if (_y > _bound)
+				return _y = fmod (_y, _F.modulus);
 			else
-				if (sign)
-					return x = modulus-tmp;
-				else
-					return x = tmp;
-			*/
-
-			if (x < 0) x += modulus;
-			return x;
-		}
-
-		
-		
-		inline Element& assign(Element& x, const Element& y) const {
-			return x = y;
-		}
-									
-		
-		inline bool areEqual (const Element &x, const Element &y) const {
-			return x == y;
-		}
-
-		inline  bool isZero (const Element &x) const {
-			return x == 0.; 
-		}
-		
-		inline bool isOne (const Element &x) const {
-			return x == 1.; 
+				return _y;
 		}
 
-		inline bool isMinusOne (const Element &x) const {
-			return (x == modulus-1.); 
-		}
-
-		inline Element &add (Element &x, const Element &y, const Element &z) const {
-			x = y + z;
-			if ( x >= modulus ) x -= modulus;
-			return x;
-		}
- 
-		inline Element &sub (Element &x, const Element &y, const Element &z) const {
-			x = y - z;
-			if (x < 0) x += modulus;
-			return x;
-		}
-		
-		inline Element &mul (Element &x, const Element &y, const Element &z) const {		
-			double tmp= y*z;
-			x= fmod(tmp, modulus);
-			//x= tmp - floor(tmp*inv_modulus)*modulus;
-		  
-			return x;
-		}
- 
-		inline Element &div (Element &x, const Element &y, const Element &z) const {
-			Element temp;
-			inv (temp, z);
-			return mul (x, y, temp);
-		}
- 
-		inline Element &neg (Element &x, const Element &y) const {
-			if(y == 0) return x = 0;
-			else return x = modulus - y;
-		}
- 
-		inline Element &inv (Element &x, const Element &y) const {
-			// The extended Euclidean algoritm 
-			int x_int, y_int, q, tx, ty, temp;
-			x_int = int (modulus);
-			y_int = int (y);
-			tx = 0; 
-			ty = 1;
-		  
-			while (y_int != 0) {
-				// always: gcd (modulus,residue) = gcd (x_int,y_int)
-				//         sx*modulus + tx*residue = x_int
-				//         sy*modulus + ty*residue = y_int
-				q = x_int / y_int; // integer quotient
-				temp = y_int; y_int = x_int - q * y_int;
-				x_int = temp;
-				temp = ty; ty = tx - q * ty;
-				tx = temp;
-			}
-		  
-			if (tx < 0) tx += (int)modulus;
-		  
-			// now x_int = gcd (modulus,residue)
-			return x = (double)tx;
-		  
-		  
-		}
-
-		inline Element &axpy (Element &r, 
-				      const Element &a, 
-				      const Element &x, 
-				      const Element &y) const {
-			double tmp = a * x + y;
-			return r= fmod(tmp, modulus); 
-			//return r= tmp- floor(tmp*inv_modulus)*modulus; 
-
-		}
-
-		inline Element &addin (Element &x, const Element &y) const {
-			x += y;
-			if (  x >= modulus ) x -= modulus;
-			return x;
-		}
- 
-		inline Element &subin (Element &x, const Element &y) const {
-			x -= y;
-			if (x < 0.) x += modulus;
-			return x;
-		}
- 
-		inline Element &mulin (Element &x, const Element &y) const {
-			return mul(x,x,y);
-		}
- 
-		inline Element &divin (Element &x, const Element &y) const {
-			return div(x,x,y);
-		}
- 
-		inline Element &negin (Element &x) const {
-			if (x == 0.) return x; 
-			else return x = modulus - x; 
-		}
-		
-		inline Element &invin (Element &x) const {
-			return inv (x, x);
-		}
-		
-		inline Element &axpyin (Element &r, const Element &a, const Element &x) const {
-			double tmp = r + a * x;
-			return r = fmod(tmp, modulus); 
-
-			//return r= tmp- floor(tmp*inv_modulus)*modulus; 
+		 Element& subumulate (const Element &tmp)
+		{
+			_y -= tmp;
+			if (_y < 0)
+				return _y += _F.modulus;
+			else
+				return _y;
 		}
 
-		static inline double getMaxModulus()
-			{ return 67108864.0; } // 2^26 
-		
-	};
-
-	template <>
-	class FieldAXPY<Modular<double> > {	  
-	public:
-	  
-		typedef double Element;
-		typedef Modular<double> Field;
-	  
-		FieldAXPY (const Field &F) : _F (F) , //_invmod(1./_F.modulus), 
-					     _y(0.) , _bound( (double) ((1ULL << 53) - (int) (_F.modulus*_F.modulus))) {}
-	  
-		FieldAXPY (const FieldAXPY &faxpy) : _F (faxpy._F),// _invmod(faxpy._invmod) ,
-		_y(faxpy._y), _bound(faxpy._bound) {}
-	  
-		FieldAXPY<Modular<double> > &operator = (const FieldAXPY &faxpy) {
-			_F = faxpy._F; 
-			//_invmod= faxpy._invmod;
-			_y= faxpy._y;
-			_bound= faxpy._bound;
-			return *this; 
-		}
-	  
-            inline Element& mulacc (const Element &a, const Element &x) {
-//                 Element tmp= a*x;	
-//                 return accumulate(tmp);
-                return accumulate(a*x);
-            }
-            
-            inline Element& accumulate (const Element &tmp) {   
-                _y += tmp;
-                if (_y > _bound)
-                    return _y = fmod (_y, _F.modulus);
-                else
-                    return _y;
-            }
-            inline Element& subumulate (const Element &tmp) {   
-                _y -= tmp;
-                if (_y < 0)
-                    return _y += _F.modulus;
-                else
-                    return _y;
-            }
-	  
-		inline Element& get (Element &y) {
+		 Element& get (Element &y)
+		{
 			_y = fmod (_y, _F.modulus);
 			return y=_y ;
 		}
-	  
-		inline FieldAXPY &assign (const Element y) {
-			_y = y; 
+
+		 FieldAXPY &assign (const Element y)
+		{
+			_y = y;
 			return *this;
 		}
 
-		inline void reset() {
+		 void reset()
+		{
 			_y = 0.;
 		}
-            
-            inline Element& set (const Element &tmp) {   
-                _y = tmp;
-                if (_y > _bound)
-                    return _y = fmod (_y, _F.modulus);
-                else
-                    return _y;
-            }
-	  
+
+		 Element& set (const Element &tmp)
+		{
+			_y = tmp;
+			if (_y > _bound)
+				return _y = fmod (_y, _F.modulus);
+			else
+				return _y;
+		}
+
 	private:
-	  
+
 		Field _F;
 		//double _invmod;
 		double _y;
-		double _bound;		
+		double _bound;
 	};
-	
-	
+
 	template <>
 	class DotProductDomain<Modular<double> > : private virtual VectorDomainBase<Modular<double> > {
 	private:
 		double _bound;
 		size_t _nmax;
 		//double _invmod;
-	  
-	public:	  
-		typedef double Element;	  
-		DotProductDomain (const Modular<double> &F)
-			: VectorDomainBase<Modular<double> > (F), _bound( (double) ( (1ULL<<53) - (int) (_F.modulus*_F.modulus)))//, _invmod(1./_F.modulus) 
-			{
-				_nmax= (size_t)floor((double(1<<26)* double(1<<26)*2.)/ (_F.modulus * _F.modulus));
-			}
-	  
+
+	public:
+		typedef double Element;
+		DotProductDomain (const Modular<double> &F) :
+			VectorDomainBase<Modular<double> > (F), _bound( (double) ( (1ULL<<53) - (int) (F.modulus*F.modulus)))//, _invmod(1./_F.modulus)
+		{
+			_nmax= (size_t)floor((double(1<<26)* double(1<<26)*2.)/ (F.modulus * F.modulus));
+			_nmax = (_nmax>0?_nmax:1);
+		}
+
 	protected:
 		template <class Vector1, class Vector2>
-		inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const {
-	    
+		 Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
+
 			double y = 0.;
 			double t = 0.;
 			if (v1.size() < _nmax) {
 				for (size_t i = 0; i< v1.size();++i)
-					y += v1[i] * v2[i] ;				
+					y += v1[i] * v2[i] ;
 				y = fmod(y, _F.modulus);
 			}
-			else{			
+			else{
 				size_t i=0;
 				for (;i< v1.size()- _nmax ;i=i+_nmax){
 					for (size_t j=i;j<i+_nmax;++j)
 						y += v1[j] * v2[j];
 					t+=fmod(y, _F.modulus);
-					y=0.;							
+					y=0.;
 				}
 				for (;i < v1.size();++i)
 					y += v1[i] * v2[i];
@@ -462,24 +291,25 @@ namespace LinBox {
 		}
 
 		template <class Vector1, class Vector2>
-		inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const {		  
-				    
+		 Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
+
 			double y = 0.;
 			double t =0.;
-			
+
 
 			if (v1.first.size() < _nmax) {
 				for (size_t i=0;i<v1.first.size();++i)
 					y+= v1.second[i] * v2[v1.first[i]];
 				y = fmod(y, _F.modulus);
 			}
-			else {			
+			else {
 				size_t i=0;
 				for (;i< v1.first.size()- _nmax ;i=i+_nmax){
 					for (size_t j=i;j<i+_nmax;++j)
 						y += v1.second[j] * v2[v1.first[j]];
-					t+=fmod(y, _F.modulus);
-					y=0.;							
+					t+=fmod(y, this->_F.modulus);
+					y=0.;
 				}
 				for (;i < v1.first.size();++i)
 					y += v1.second[i] * v2[v1.first[i]];
@@ -492,4 +322,5 @@ namespace LinBox {
 }
 
 
-#endif
+#endif //__LINBOX_modular_double_H
+
diff --git a/linbox/field/modular-float.h b/linbox/field/modular-float.h
index 1c5a669..dbda8ad 100644
--- a/linbox/field/modular-float.h
+++ b/linbox/field/modular-float.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/field/modular-float.h
  * Copyright (C) 2003 Pascal Giorgi
  *               2007 Clement Pernet
@@ -10,11 +10,20 @@
  * See COPYING for license information.
  */
 
+/*! @file field/modular-float.h
+ * @ingroup field
+ * @brief  representation of <code>Z/mZ</code> over \c float .
+ */
 
+#ifndef __LINBOX_modular_float_H
+#define __LINBOX_modular_float_H
 
+#ifdef __INTEL_COMPILER
+#define FmodF fmodf
+#else
+#define FmodF fmod
+#endif
 
-#ifndef __LINBOX_MODULAR_FLOAT_H
-#define __LINBOX_MODULAR_FLOAT_H
 
 
 #include "linbox/linbox-config.h"
@@ -26,462 +35,259 @@
 #include "linbox/util/debug.h"
 #include <math.h>
 #include <linbox/field/field-traits.h>
+#include "linbox/randiter/nonzero.h"
 
-
-
+#include "fflas-ffpack/field/modular-float.h"
 
 // Namespace in which all LinBox code resides
-namespace LinBox { 
-	
+namespace LinBox
+{
+
 	template< class Element >
 	class Modular;
 	template< class Element >
 	class ModularRandIter;
 
+	template< class Field, class RandIter >
+	class NonzeroRandIter;
+
 	template <class Ring>
-	struct ClassifyRing; 
+	struct ClassifyRing;
 	template <class Element>
 	struct ClassifyRing<Modular<Element> >;
 	template <>
-	struct ClassifyRing<Modular<float> >{
+	struct ClassifyRing<Modular<float> > {
 		typedef RingCategories::ModularTag categoryTag;
 	};
 
 	class MultiModFloat;
-	
+
 	/// \ingroup field
 	template <>
-	class Modular<float> : public FieldInterface {
+	class Modular<float> : public FieldInterface,
+	      public FFPACK::Modular<float>	{
+
+	      public :
+		      typedef float Element;
+
+	      public:
+		      friend class FieldAXPY<Modular<Element> >;
+		      friend class DotProductDomain<Modular<Element> >;
+		      friend class MultiModFloat;
+
+		      typedef ModularRandIter<Element> RandIter;
+		      typedef NonzeroRandIter<Modular<Element>, ModularRandIter<Element> > NonZeroRandIter;
+
+		      static ClassifyRing<Modular<Element> >::categoryTag getCategory()
+		      {
+			      return ClassifyRing<Modular<Element> >::categoryTag();
+		      }
+
+		      Modular (const integer& p) :
+			      FFPACK::Modular<float>((unsigned long)p)
+		      {
+#ifdef DEBUG
+			      if(modulus <= 1)
+				      throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus must be > 1");
+			      integer max;
+			      if(modulus > (Element) FieldTraits<Modular<Element> >::maxModulus(max))
+				      throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus is too big");
+#endif
 
-	protected:
+		      }
+
+		      integer &cardinality (integer &c) const
+		      {
+			      return c = integer(modulus);
+		      }
+
+		      integer &characteristic (integer &c) const
+		      {
+			      return c = integer(modulus);
+		      }
+
+		      integer &convert (integer &x, const Element &y) const
+		      {
+			      return x = integer(y);
+		      }
+
+		      template<class T>T&convert(T&x,const Element&y)const{return x=T(y);}
+		      template<class T>T&characteristic(T&x)const{return x=T(lmodulus);}
+		      unsigned long characteristic(void)const{return FFPACK::Modular<float>::characteristic();}
+		      unsigned long cardinality(void)const{return FFPACK::Modular<float>::cardinality();}
+
+		      Element &init (Element &x, const integer &y) const
+		      {
+			      x = (Element)(y%lmodulus);
+
+			      if (x<0) return x+=modulus ;
+			      return x;
+		      }
+
+		      unsigned long AccBound(const Element&r) const
+		      {
+			      Element one, zero ; init(one,1UL) ; init(zero,0UL);
+			      double max_double = (double) (1ULL<<FLT_MANT_DIG) - modulus ;
+			      double p = modulus-1 ;
+			      if (areEqual(zero,r))
+				      return (unsigned long) (double(max_double)/p) ;
+			      else if (areEqual(one,r))
+			      {
+				      if (modulus>= getMaxModulus())
+					      return 0 ;
+				      else
+					      return (unsigned long) (double(max_double)/(modulus*modulus)) ;
+			      }
+			      else
+				      throw LinboxError("Bad input, expecting 0 or 1");
+			      return 0;
+		      }
+
+	      };
 
-		float  modulus;
-		unsigned long   lmodulus;
+	template <>
+	class FieldAXPY<Modular<float> > {
+	public:
 
-		//float inv_modulus;
-		
-	public:	       
-		friend class FieldAXPY<Modular<float> >;
-		friend class DotProductDomain<Modular<float> >;
-		friend class MultiModFloat;
-			       
 		typedef float Element;
-		typedef ModularRandIter<float> RandIter;
-
-		static ClassifyRing<Modular<float> >::categoryTag getCategory() {return ClassifyRing<Modular<float> >::categoryTag();}
-		
-
-
-		Modular () {}
-
-		Modular (int32 p, int exp = 1)  : modulus((float)p), lmodulus(p)//, inv_modulus(1./(float)p) 
-		{
-			if(modulus <= 1)
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
-			if( exp != 1 ) throw PreconditionFailed(__FUNCTION__,__LINE__,"exponent must be 1");
-			integer max;
-			if(modulus > (float) FieldTraits<Modular<float> >::maxModulus(max))
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus is too big");
-			
-		}
-
-		Modular (float p) : modulus(p), lmodulus((unsigned long)p) {
-			if( modulus <= 1 )
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
-			integer max;
-			if( modulus > (float) FieldTraits<Modular<float> >::maxModulus(max))
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus is too big");
-		}
-
-		Modular (long int p) :modulus((float)p), lmodulus(p) {
-			if( (float) modulus <= 1 )
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
-			integer max;
-			if( (float) modulus > (float) FieldTraits<Modular<float> >::maxModulus(max))
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus is too big");
-		}
+		typedef Modular<float> Field;
 
-		Modular (const integer& p) : modulus((float) p), lmodulus(p) //, inv_modulus(1./(float)p)
-		{
-			if(modulus <= 1)
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
-			integer max;
-			if(modulus > (float) FieldTraits<Modular<float> >::maxModulus(max))
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus is too big");
-				
-		}
+		FieldAXPY (const Field &F) :
+			_F (F) , //_invmod(1./_F.modulus),
+			_y(0.) , _bound( (float) ( (1UL << 23) - (int) (_F.modulus*_F.modulus)))
+		{}
 
-		Modular(const Modular<float>& mf) : modulus(mf.modulus), lmodulus(mf.lmodulus)//,inv_modulus(mf.inv_modulus)
+		FieldAXPY (const FieldAXPY &faxpy) :
+			_F (faxpy._F),// _invmod(faxpy._invmod) ,
+			_y(faxpy._y), _bound(faxpy._bound)
 		{}
 
-		const Modular &operator=(const Modular<float> &F) {
-			modulus = F.modulus;
-			lmodulus= F.lmodulus;
-			//inv_modulus = F.inv_modulus;
+		FieldAXPY<Modular<float> > &operator = (const FieldAXPY &faxpy)
+		{
+			_F = faxpy._F;
+			//_invmod= faxpy._invmod;
+			_y= faxpy._y;
+			_bound= faxpy._bound;
 			return *this;
 		}
 
-	
-		integer &cardinality (integer &c) const{ 
-			return c = integer(modulus);
-		}
-
-		integer &characteristic (integer &c) const {
-			return c = integer(modulus); 
-		}
-
-		integer &convert (integer &x, const Element &y) const { 
-			return x = integer(y);
-		}
-
-		float &convert (float &x, const Element& y) const {
-			return x=y;
-		}
-		
-		std::ostream &write (std::ostream &os) const {
-			return os << "float mod " << (int)modulus;
-		}
-		
-		std::istream &read (std::istream &is) {
-			is >> modulus; 
-			if(modulus <= 1) 
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
-		 	if(modulus > 94906265) 
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus is too big");
-
-			return is;
-		}
-		
-		std::ostream &write (std::ostream &os, const Element &x) const {
-			return os << x;
-		}
-
-		std::istream &read (std::istream &is, Element &x) const {
-			integer tmp;
-                            // JGD : should'nt it be float tmp ???
-			is >> tmp;
-			init(x,tmp); 
-			return is;
-		}
-		
-
-		Element &init (Element &x, const integer &y) const  {
-// 			return x = (Element)mpz_fdiv_ui(y.get_mpz(),lmodulus );
-			return x = (Element)(y%lmodulus);
+		inline Element& mulacc (const Element &a, const Element &x)
+		{
+			Element tmp= a*x;
+			return accumulate(tmp);
 		}
 
-		inline Element& init(Element& x, float y =0.0) const {		  
-
-			//float tmp = y;
-
-			/*
-			int sign=0;
-			if (tmp < 0.0) {
-				tmp=-tmp;
-				sign=1;
-			}	
-			*/	
-
-			//			tmp = floor (y + 0.5);
-
-			//Some odds donot support it. It is in C99.
-			//tmp = round (y); 
-			
-			x = fmod (y, modulus);
-
-			/*
-			if (tmp > modulus) 
-				tmp -= (modulus * floor( tmp*inv_modulus));
-
-			if ( (!tmp) || (tmp == modulus) ){
-				return x = 0.0;
-				
-			}
+		inline Element& accumulate (const Element &tmp)
+		{
+			_y += tmp;
+			if (_y > _bound)
+				return _y = fmodf (_y, _F.modulus);
 			else
-				if (sign)
-					return x = modulus-tmp;
-				else
-					return x = tmp;
-			*/
-
-			if (x < 0) x += modulus;
-			return x;
-		}
-
-		inline Element& init(Element& x, double y) const {		  
-
-			x = fmod (y, double(modulus));
-
-			if (x < 0) x += modulus;
-			return x;
-		}
-
-		inline Element& init(Element& x, unsigned long y) const {		  
-
-			x = fmod (float(y), modulus);
-
-			if (x < 0) x += modulus;
-			return x;
-		}
-		inline Element& init(Element& x, int y) const {		  
-
-			x = fmod (float(y), modulus);
-
-			if (x < 0) x += modulus;
-			return x;
-		}
-
-		
-		
-		inline Element& assign(Element& x, const Element& y) const {
-			return x = y;
-		}
-									
-		
-		inline bool areEqual (const Element &x, const Element &y) const {
-			return x == y;
+				return _y;
 		}
 
-		inline  bool isZero (const Element &x) const {
-			return x == 0.; 
-		}
-		
-		inline bool isOne (const Element &x) const {
-			return x == 1.; 
-		}
-
-		inline Element &add (Element &x, const Element &y, const Element &z) const {
-			x = y + z;
-			if ( x >= modulus ) x -= modulus;
-			return x;
-		}
- 
-		inline Element &sub (Element &x, const Element &y, const Element &z) const {
-			x = y - z;
-			if (x < 0) x += modulus;
-			return x;
-		}
-		
-		inline Element &mul (Element &x, const Element &y, const Element &z) const {		
-			float tmp= y*z;
-			x= fmod(tmp, modulus);
-			//x= tmp - floor(tmp*inv_modulus)*modulus;
-		  
-			return x;
-		}
- 
-		inline Element &div (Element &x, const Element &y, const Element &z) const {
-			Element temp;
-			inv (temp, z);
-			return mul (x, y, temp);
-		}
- 
-		inline Element &neg (Element &x, const Element &y) const {
-			if(y == 0) return x = 0;
-			else return x = modulus - y;
-		}
- 
-		inline Element &inv (Element &x, const Element &y) const {
-			// The extended Euclidean algoritm 
-			int x_int, y_int, q, tx, ty, temp;
-			x_int = int (modulus);
-			y_int = int (y);
-			tx = 0; 
-			ty = 1;
-		  
-			while (y_int != 0) {
-				// always: gcd (modulus,residue) = gcd (x_int,y_int)
-				//         sx*modulus + tx*residue = x_int
-				//         sy*modulus + ty*residue = y_int
-				q = x_int / y_int; // integer quotient
-				temp = y_int; y_int = x_int - q * y_int;
-				x_int = temp;
-				temp = ty; ty = tx - q * ty;
-				tx = temp;
-			}
-		  
-			if (tx < 0) tx += (int)modulus;
-		  
-			// now x_int = gcd (modulus,residue)
-			return x = (float)tx;
-		  
-		  
-		}
-
-		inline Element &axpy (Element &r, 
-				      const Element &a, 
-				      const Element &x, 
-				      const Element &y) const {
-			float tmp = a * x + y;
-			return r= fmod(tmp, modulus); 
-			//return r= tmp- floor(tmp*inv_modulus)*modulus; 
-
-		}
-
-		inline Element &addin (Element &x, const Element &y) const {
-			x += y;
-			if (  x >= modulus ) x -= modulus;
-			return x;
-		}
- 
-		inline Element &subin (Element &x, const Element &y) const {
-			x -= y;
-			if (x < 0.) x += modulus;
-			return x;
-		}
- 
-		inline Element &mulin (Element &x, const Element &y) const {
-			return mul(x,x,y);
-		}
- 
-		inline Element &divin (Element &x, const Element &y) const {
-			return div(x,x,y);
-		}
- 
-		inline Element &negin (Element &x) const {
-			if (x == 0.) return x; 
-			else return x = modulus - x; 
-		}
-		
-		inline Element &invin (Element &x) const {
-			return inv (x, x);
-		}
-		
-		inline Element &axpyin (Element &r, const Element &a, const Element &x) const {
-			float tmp = r + a * x;
-			return r = fmod(tmp, modulus); 
-
-			//return r= tmp- floor(tmp*inv_modulus)*modulus; 
-		}
-
-		static inline float getMaxModulus()
-			{ return 4096.0; } // floor( 2^12 )
-		
-	};
-
-	template <>
-	class FieldAXPY<Modular<float> > {	  
-	public:
-	  
-		typedef float Element;
-		typedef Modular<float> Field;
-	  
-		FieldAXPY (const Field &F) : _F (F) , //_invmod(1./_F.modulus), 
-					     _y(0.) , _bound( (float) ( (1 << 23) - (int) (_F.modulus*_F.modulus))) {}
-	  
-		FieldAXPY (const FieldAXPY &faxpy) : _F (faxpy._F),// _invmod(faxpy._invmod) ,
-		_y(faxpy._y), _bound(faxpy._bound) {}
-	  
-		FieldAXPY<Modular<float> > &operator = (const FieldAXPY &faxpy) {
-			_F = faxpy._F; 
-			//_invmod= faxpy._invmod;
-			_y= faxpy._y;
-			_bound= faxpy._bound;
-			return *this; 
-		}
-	  
-            inline Element& mulacc (const Element &a, const Element &x) {
-                Element tmp= a*x;	
-                return accumulate(tmp);
-            }
-            
-            inline Element& accumulate (const Element &tmp) {   
-                _y += tmp;
-                if (_y > _bound)
-                    return _y = fmod (_y, _F.modulus);
-                else
-                    return _y;
-            }
-	  
-		inline Element& get (Element &y) {
-			_y = fmod (_y, _F.modulus);
+		inline Element& get (Element &y)
+		{
+			_y = fmodf (_y, _F.modulus);
 			return y=_y ;
 		}
-	  
-		inline FieldAXPY &assign (const Element y) {
-			_y = y; 
+
+		inline FieldAXPY &assign (const Element y)
+		{
+			_y = y;
 			return *this;
 		}
 
-		inline void reset() {
+		inline void reset()
+		{
 			_y = 0.;
 		}
-	  
+
 	private:
-	  
+
 		Field _F;
 		//float _invmod;
 		float _y;
-		float _bound;		
+		float _bound;
 	};
-	
-	
+
+
 	template <>
 	class DotProductDomain<Modular<float> > : private virtual VectorDomainBase<Modular<float> > {
 	private:
 		float _bound;
 		size_t _nmax;
 		//float _invmod;
-	  
-	public:	  
-		typedef float Element;	  
-		DotProductDomain (const Modular<float> &F)
-			: VectorDomainBase<Modular<float> > (F), _bound( (float) ( (1<<23) - (int) (_F.modulus*_F.modulus)))//, _invmod(1./_F.modulus) 
-			{
-				_nmax= (size_t)floor((float(1<<11)* float(1<<12))/ (_F.modulus * _F.modulus));
-			}
-	  
+
+	public:
+		typedef float Element;
+		DotProductDomain (const Modular<float> &F) :
+			VectorDomainBase<Modular<float> > (F)
+			, _bound( (float) ( (1<<23) - (int) (_F.modulus*_F.modulus)))
+			//, _invmod(1./_F.modulus)
+		{
+			_nmax= (size_t)floor((float(1<<11)* float(1<<12))/ (_F.modulus * _F.modulus));
+		}
+
 	protected:
 		template <class Vector1, class Vector2>
-		inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const {
-	    
+		inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
+
 			float y = 0.;
 			float t = 0.;
-			if (v1.size() < _nmax) {
+			if (v1.size() < _nmax)
+			{
 				for (size_t i = 0; i< v1.size();++i)
-					y += v1[i] * v2[i] ;				
-				y = fmod(y, _F.modulus);
+					y += v1[i] * v2[i] ;
+				y = fmodf(y, _F.modulus);
 			}
-			else{			
+			else
+			{
 				size_t i=0;
-				for (;i< v1.size()- _nmax ;i=i+_nmax){
+				for (;i< v1.size()- _nmax ;i=i+_nmax)
+				{
 					for (size_t j=i;j<i+_nmax;++j)
 						y += v1[j] * v2[j];
-					t+=fmod(y, _F.modulus);
-					y=0.;							
+					t+=fmodf(y, _F.modulus);
+					y=0.;
 				}
 				for (;i < v1.size();++i)
 					y += v1[i] * v2[i];
-				t+=fmod(y, _F.modulus);
-				y = fmod(t, _F.modulus);
+				t+=fmodf(y, _F.modulus);
+				y = fmodf(t, _F.modulus);
 			}
 			return res = y;
 		}
 
 		template <class Vector1, class Vector2>
-		inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const {		  
-				    
+		inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
+
 			float y = 0.;
 			float t =0.;
-			
 
-			if (v1.first.size() < _nmax) {
+
+			if (v1.first.size() < _nmax)
+			{
 				for (size_t i=0;i<v1.first.size();++i)
 					y+= v1.second[i] * v2[v1.first[i]];
-				y = fmod(y, _F.modulus);
+				y = fmodf(y, _F.modulus);
 			}
-			else {			
+			else
+			{
 				size_t i=0;
-				for (;i< v1.first.size()- _nmax ;i=i+_nmax){
+				for (;i< v1.first.size()- _nmax ;i=i+_nmax)
+				{
 					for (size_t j=i;j<i+_nmax;++j)
 						y += v1.second[j] * v2[v1.first[j]];
-					t+=fmod(y, _F.modulus);
-					y=0.;							
+					t+=fmodf(y, _F.modulus);
+					y=0.;
 				}
 				for (;i < v1.first.size();++i)
 					y += v1.second[i] * v2[v1.first[i]];
-				t+= fmod(y, _F.modulus);
-				y = fmod(t, _F.modulus);
+				t+= fmodf(y, _F.modulus);
+				y = fmodf(t, _F.modulus);
 			}
 			return res = y;
 		}
@@ -490,4 +296,7 @@ namespace LinBox {
 
 #include "linbox/randiter/modular.h"
 
-#endif
+#undef FmodF
+
+#endif //__LINBOX_modular_float_H
+
diff --git a/linbox/field/modular-int.h b/linbox/field/modular-int.h
deleted file mode 100644
index d8f3c5d..0000000
--- a/linbox/field/modular-int.h
+++ /dev/null
@@ -1,691 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-// use of modular-int.h is now deprecated.  Use modular-int32.h.
-#include <linbox/field/modular-int32.h>
-
-#if 0
-#ifndef __LINBOX_MODULAR_INT_H
-#define __LINBOX_MODULAR_INT_H
-
-/* Use of this class is depreciated.  Use Modular<int32> in modular-int32.h */
-
-#include "linbox/linbox-config.h"
-#include "linbox/integer.h"
-#include "linbox/vector/vector-domain.h"
-#include "linbox/field/field-interface.h"
-#include "linbox/util/debug.h"
-#include <math.h>
-#include <linbox/field/field-traits.h>
-
-#ifndef LINBOX_MAX_INT
-#define LINBOX_MAX_INT 2147483647
-#endif
-
-#ifndef LINBOX_MAX_MODULUS
-#define LINBOX_MAX_MODULUS 1073741824
-#endif
-
-// Namespace in which all LinBox code resides
-namespace LinBox 
-{ 
-
-	template< class Element >
-		class Modular;
-	template< class Element >
-		class ModularRandIter;
-	template<class Field>
-		class DotProductDomain;
-	template<class Field>
-		class FieldAXPY;
-	template<class Field>
-		class MVProductDomain;
-	
-	template <class Ring>
-	struct ClassifyRing; 
-	
-	template <class Element>
-	struct ClassifyRing<Modular<Element> >;
-
-	template <>
-	struct ClassifyRing<Modular<int> >{
-		typedef RingCategories::ModularTag categoryTag;
-	};
-	
-	/** \brief Specialization of Modular to int element type with efficient dot product.
-	 * 
-	 * Efficient element operations for dot product, mul, axpy, by using floating point
-	 * inverse of modulus (borrowed from NTL) and some use of non-normalized intermediate values.
-	 *
-	 * For some uses this is the most efficient field for primes in the range from half word
-	 * to 2^30.
-	 *
-	 * Requires: Modulus < 2^30.
-	 * Intended use: 2^15 < prime modulus < 2^30.
-	\ingroup field
-	 */
-	template <>
-		class Modular<int> : public FieldInterface {
-
-		protected:
-
-		int modulus;
-
-		double modulusinv;
-		
-		int _two64;
-
-		public:	       
-
-		friend class FieldAXPY<Modular<int> >;
-                friend class DotProductDomain<Modular<int> >;
-		friend class MVProductDomain<Modular<int> >;
-	       
-		typedef int Element;
-		typedef ModularRandIter<int> RandIter;
-
-		//default modular field,taking 65521 as default modulus
-		Modular () :modulus(65521) {
-			modulusinv=1/(double)65521;
-			
-			_two64 = (int) ((uint64) (-1) % (uint64) 65521);
-			_two64 += 1;
-			if (_two64 >= 65521) _two64 -= 65521;
-		}
-
-		Modular (int value)  : modulus(value) {
-			modulusinv = 1 / ((double) value); 
-			if(value<=1) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
-			if(value>LINBOX_MAX_MODULUS) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus is too big");
-			_two64 = (int) ((uint64) (-1) % (uint64) value);
-			_two64 += 1;
-			if (_two64 >= value) _two64 -= value;
-		}
-
-		Modular(const Modular<int>& mf) : modulus(mf.modulus),modulusinv(mf.modulusinv),_two64(mf._two64){}
-
-		const Modular &operator=(const Modular<int> &F) {
-			modulus = F.modulus;
-			modulusinv = F.modulusinv;
-			_two64 = F._two64;
-			return *this;
-		}
-
-	
-		inline integer &cardinality (integer &c) const{ 
-			return c = modulus;
-		}
-
-		inline integer &characteristic (integer &c) const {
-			return c = modulus; 
-		}
-
-		inline integer &convert (integer &x, const Element &y) const { 
-			return x = y;
-		}
-
-		inline double & convert (double &x, const Element &y) const { 
-			return x = (double) y;
-		}
-
-		inline float & convert (float &x, const Element &y) const { 
-			return x = (float) y;
-		}
-		
-		inline std::ostream &write (std::ostream &os) const {
-			return os << "int mod " << modulus;
-		}
-		
-		inline std::istream &read (std::istream &is) {
-			is >> modulus; 
-			modulusinv = 1 /((double) modulus );
-                        if(modulus <= 1) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
-                        if(modulus > LINBOX_MAX_MODULUS) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus is too big");
-			_two64 = (int) ((uint64) (-1) % (uint64) modulus);
-			_two64 += 1;
-			if (_two64 >= modulus) _two64 -= modulus;
-			
-			return is;
-		}
-		
-		inline std::ostream &write (std::ostream &os, const Element &x) const {
-			return os << x;
-		}
-
-		inline std::istream &read (std::istream &is, Element &x) const {
-			integer tmp;
-			is >> tmp;
-			init(x,tmp); 
-			return is;
-                }
-		
-
-		template<class Element1>
-		inline Element &init (Element & x, const Element1 &y) const {
-			x = y % modulus;
-			if (x < 0) x += modulus;
-			return x;
-		}
-
-		inline Element &init (Element &x, const double &y) const  { 
-		  double z = fmod(y, (double)modulus);
-		  if (z < 0) z += (double)modulus;
-		  //z += 0.5; //C Pernet: sounds nasty and not necessary
-		  return x = static_cast<long>(z); //rounds towards 0
-		}
-
-		inline Element &init (Element &x, const float &y) const  { 
-		  return init(x , (double) y);
-		}
-
-		inline Element &init (Element &x, const integer &y) const  {
-			x = y % modulus;
-			if (x < 0) x += modulus;
-			return x;
-		}
-
-		inline Element& init(Element& x, int y =0) const {
-			x = y % modulus;
-			if ( x < 0 ) x += modulus;
-			return x;
-		}
-
-		inline Element& init(Element& x, long y) const {
-			x = y % modulus;
-			if ( x < 0 ) x += modulus; 
-			return x;
-		}
-		
-		inline Element& assign(Element& x, const Element& y) const {
-			return x = y;
-		}
-									
-		
-		inline bool areEqual (const Element &x, const Element &y) const {
-			return x == y;
-		}
-
-		inline  bool isZero (const Element &x) const {
-			return x == 0; 
-		}
-		
-		inline bool isOne (const Element &x) const {
-			return x == 1; 
-		}
-
-		inline Element &add (Element &x, const Element &y, const Element &z) const {
-			x = y + z;
-			if ( x >= modulus ) x -= modulus;
-			return x;
-		}
- 
-		inline Element &sub (Element &x, const Element &y, const Element &z) const {
-			x = y - z;
-			if (x < 0) x += modulus;
-			return x;
-		}
-		
-		inline Element &mul (Element &x, const Element &y, const Element &z) const {
-			int q;
-
-			q  = (int) ((((double) y)*((double) z)) * modulusinv);  // q could be off by (+/-) 1
-			x = (int) (y*z - q*modulus);
-			
-			
-			if (x >= modulus)
-				x -= modulus;
-			else if (x < 0)
-				x += modulus;
-
-			return x;
-		}
- 
-		inline Element &div (Element &x, const Element &y, const Element &z) const {
-			Element temp;
-			inv (temp, z);
-			return mul (x, y, temp);
-		}
- 
-		inline Element &neg (Element &x, const Element &y) const {
-			if(y == 0) return x=0;
-			else return x = modulus-y;
-		}
- 
-		inline Element &inv (Element &x, const Element &y) const {
-			int d, t;			
-			XGCD(d, x, t, y, modulus);
-			if (d != 1) {
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"InvMod: Input is not invertible ");
-			}
-			if (x < 0)
-				x += modulus;
-			return x;		
-							      
-		}
-
-		inline Element &axpy (Element &r, 
-				      const Element &a, 
-				      const Element &x, 
-				      const Element &y) const {
-			int q;
-			
-			q  = (int) (((((double) a) * ((double) x)) + (double)y) * modulusinv);  // q could be off by (+/-) 1
-			r = (int) (a * x + y - q*modulus);
-			
-			
-			if (r >= modulus)
-				r -= modulus;
-			else if (r < 0)
-				r += modulus;
-
-			return r;
-
-		}
-
-		inline Element &addin (Element &x, const Element &y) const {
-			x += y;
-			if (  x >= modulus ) x -= modulus;
-			return x;
-		}
- 
-		inline Element &subin (Element &x, const Element &y) const {
-			x -= y;
-			if (x < 0) x += modulus;
-			return x;
-		}
- 
-		inline Element &mulin (Element &x, const Element &y) const {
-			return mul(x,x,y);
-		}
- 
-		inline Element &divin (Element &x, const Element &y) const {
-			return div(x,x,y);
-		}
- 
-		inline Element &negin (Element &x) const {
-			if (x == 0) return x; 
-			else return x = modulus - x; 
-		}
- 
-		inline Element &invin (Element &x) const {
-			return inv (x, x);
-		}
-
-		inline Element &axpyin (Element &r, const Element &a, const Element &x) const {
-			int q;
-			
-			q  = (int) (((((double) a) * ((double) x)) + (double) r) * modulusinv);  // q could be off by (+/-) 1
-			r = (int) (a * x + r - q*modulus);
-			
-			
-			if (r >= modulus)
-				r -= modulus;
-			else if (r < 0)
-				r += modulus;
-
-			return r;
-		}
-
-		private:
-
-      		static void XGCD(int& d, int& s, int& t, int a, int b) {
-			int  u, v, u0, v0, u1, v1, u2, v2, q, r;
-			
-			int aneg = 0, bneg = 0;
-			
-			if (a < 0) {
-				if (a < -LINBOX_MAX_INT) throw PreconditionFailed(__FUNCTION__,__LINE__,"XGCD: integer overflow");
-				a = -a;
-				aneg = 1;
-			}
-			
-			if (b < 0) {
-				if (b < -LINBOX_MAX_INT) throw PreconditionFailed(__FUNCTION__,__LINE__,"XGCD: integer overflow");
-				b = -b;
-				bneg = 1;
-			}
-			
-			u1 = 1; v1 = 0;
-			u2 = 0; v2 = 1;
-			u = a; v = b;
-			
-			while (v != 0) {
-				q = u / v;
-				r = u % v;
-				u = v;
-				v = r;
-				u0 = u2;
-				v0 = v2;
-				u2 =  u1 - q*u2;
-				v2 = v1- q*v2;
-				u1 = u0;
-				v1 = v0;
-			}
-			
-			if (aneg)
-				u1 = -u1;
-			
-			if (bneg)
-				v1 = -v1;
-			
-			d = u;
-			s = u1;
-			t = v1;
-		}
-		
-	};
-
-	template <>
-		class FieldAXPY<Modular<int> > {	  
-		public:
-	  
-		typedef int Element;
-		typedef Modular<int> Field;
-	  
-		FieldAXPY (const Field &F) : _F (F),_y(0) {}
-		
-
-		FieldAXPY (const FieldAXPY &faxpy) : _F (faxpy._F), _y (0) {}
-	  
-		FieldAXPY<Modular<int> > &operator = (const FieldAXPY &faxpy) {
-			_F = faxpy._F; 
-			_y = faxpy._y; 		       
-			return *this; 
-		}
-	  
-		inline uint64& mulacc (const Element &a, const Element &x) {
-			uint64 t = (uint64) a * (uint64) x;
-			_y += t;
-			if (_y < t)
-				return _y += _F._two64;
-                        else
-                            return _y;
-		}
-
-		inline uint64& accumulate (const Element &t) {
-			_y += t;
-			if (_y < (uint64)t)
-				return _y += _F._two64;
-                        else
-                            return _y;
-		}
-
-		inline Element& get (Element &y) {
-			y =_y % (uint64) _F.modulus;
-			return y;
-		}
-
-		inline FieldAXPY &assign (const Element y) {
-			_y = y; 
-			return *this;
-		}
-
-		inline void reset() {
-			_y = 0;
-		}
-
-	  	protected:
-		Field _F;
-		uint64 _y;		
-	};
-
-
-	template <>
-		class DotProductDomain<Modular<int> > : private virtual VectorDomainBase<Modular<int> > {	       
-
-		public:	  
-		typedef int Element;	  
-		DotProductDomain (const Modular<int> &F)
-			: VectorDomainBase<Modular<int> > (F) {}
-	  
-	  
-		protected:
-		template <class Vector1, class Vector2>
-			inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const {
-		  
-			typename Vector1::const_iterator i;
-			typename Vector2::const_iterator j;
-		  
-			uint64 y = 0;
-			uint64 t;
-		  
-			for (i = v1.begin (), j = v2.begin (); i < v1.end (); ++i, ++j) {
-				t = ( (uint64) *i ) * ( (uint64) *j );
-				y += t;
-			  
-				if (y < t)
-					y += _F._two64;
-			}
-		  
-			y %= (uint64) _F.modulus; 
-			return res = y;
-
-		}
-	  
-		template <class Vector1, class Vector2>
-			inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const {		  
-			typename Vector1::first_type::const_iterator i_idx;
-			typename Vector1::second_type::const_iterator i_elt;
-		  
-			uint64 y = 0;
-			uint64 t;
-		  
-			for (i_idx = v1.first.begin (), i_elt = v1.second.begin (); i_idx != v1.first.end (); ++i_idx, ++i_elt) {
-				t = ( (uint64) *i_elt ) * ( (uint64) v2[*i_idx] );
-				y += t;
-			  
-				if (y < t)
-					y += _F._two64;
-			}
-		  
-
-			y %= (uint64) _F.modulus;
-		  
-			return res = y;
-		}
-	};
-	  
-	// Specialization of MVProductDomain for int32 modular field	
-
-	template <>
-		class MVProductDomain<Modular<int32> >
-		{
-		public:
-
-			typedef int32 Element;
-
-		protected:
-			template <class Vector1, class Matrix, class Vector2>
-				inline Vector1 &mulColDense
-				(const VectorDomain<Modular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v) const
-				{
-					return mulColDenseSpecialized
-						(VD, w, A, v, VectorTraits<typename Matrix::Column>::VectorCategory ());
-				}
-
-		private:
-			template <class Vector1, class Matrix, class Vector2>
-				Vector1 &mulColDenseSpecialized
-				(const VectorDomain<Modular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-				 VectorCategories::DenseVectorTag) const;
-			template <class Vector1, class Matrix, class Vector2>
-				Vector1 &mulColDenseSpecialized
-				(const VectorDomain<Modular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-				 VectorCategories::SparseSequenceVectorTag) const;
-			template <class Vector1, class Matrix, class Vector2>
-				Vector1 &mulColDenseSpecialized
-				(const VectorDomain<Modular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-				 VectorCategories::SparseAssociativeVectorTag) const;
-			template <class Vector1, class Matrix, class Vector2>
-				Vector1 &mulColDenseSpecialized
-				(const VectorDomain<Modular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-				 VectorCategories::SparseParallelVectorTag) const;
-
-			mutable std::vector<uint64> _tmp;
-		};
-
-	template <class Vector1, class Matrix, class Vector2>
-		Vector1 &MVProductDomain<Modular<int32> >::mulColDenseSpecialized
-		(const VectorDomain<Modular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-		 VectorCategories::DenseVectorTag) const {
-		
-		linbox_check (A.coldim () == v.size ());
-		linbox_check (A.rowdim () == w.size ());
-		
-		typename Matrix::ConstColIterator i = A.colBegin ();
-		typename Vector2::const_iterator j;
-		typename Matrix::Column::const_iterator k;
-		std::vector<uint64>::iterator l;
-
-		uint64 t;
-
-		if (_tmp.size () < w.size ())
-			_tmp.resize (w.size ());
-		
-		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
-		
-		for (j = v.begin (); j != v.end (); ++j, ++i) {
-			for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
-				t = ((uint64) *k) * ((uint64) *j);
-
-				*l += t;
-				
-				if (*l < t)
-					*l += VD.field ()._two64;
-			}
-		}
-		
-		typename Vector1::iterator w_j;
-		
-		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
-			*w_j = *l % VD.field ().modulus;
-		
-		return w;
-	}
-	
-	template <class Vector1, class Matrix, class Vector2>
-		Vector1 &MVProductDomain<Modular<int32> >::mulColDenseSpecialized
-		(const VectorDomain<Modular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-		 VectorCategories::SparseSequenceVectorTag) const
-		{
-			linbox_check (A.coldim () == v.size ());
-			linbox_check (A.rowdim () == w.size ());
-			
-			typename Matrix::ConstColIterator i = A.colBegin ();
-			typename Vector2::const_iterator j;
-			typename Matrix::Column::const_iterator k;
-			std::vector<uint64>::iterator l;
-			
-			uint64 t;
-			
-			if (_tmp.size () < w.size ())
-				_tmp.resize (w.size ());
-			
-			std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
-			
-			for (j = v.begin (); j != v.end (); ++j, ++i) {
-				for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
-					t = ((uint64) k->second) * ((uint64) *j);
-
-					_tmp[k->first] += t;
-					
-					if (_tmp[k->first] < t)
-						_tmp[k->first] += VD.field ()._two64;
-				}
-			}
-			
-			typename Vector1::iterator w_j;
-			
-			for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
-				*w_j = *l % VD.field ().modulus;
-			
-			return w;
-		}
-	
-	template <class Vector1, class Matrix, class Vector2>
-		Vector1 &MVProductDomain<Modular<int32> >::mulColDenseSpecialized
-		(const VectorDomain<Modular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-		 VectorCategories::SparseAssociativeVectorTag) const {
-
-		linbox_check (A.coldim () == v.size ());
-		linbox_check (A.rowdim () == w.size ());
-		
-		typename Matrix::ConstColIterator i = A.colBegin ();
-		typename Vector2::const_iterator j;
-		typename Matrix::Column::const_iterator k;
-		std::vector<uint64>::iterator l;
-		
-		uint64 t;
-		
-		if (_tmp.size () < w.size ())
-			_tmp.resize (w.size ());
-		
-		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
-		
-		for (j = v.begin (); j != v.end (); ++j, ++i) {
-			for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
-				t = ((uint64) k->second) * ((uint64) *j);
-				
-				_tmp[k->first] += t;
-				
-				if (_tmp[k->first] < t)
-					_tmp[k->first] += VD.field ()._two64;
-			}
-		}
-		
-		typename Vector1::iterator w_j;
-		
-		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
-			*w_j = *l % VD.field ().modulus;
-		
-		return w;
-	}
-
-	template <class Vector1, class Matrix, class Vector2>
-		Vector1 &MVProductDomain<Modular<int32> >::mulColDenseSpecialized
-		(const VectorDomain<Modular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-		 VectorCategories::SparseParallelVectorTag) const {
-		
-		linbox_check (A.coldim () == v.size ());
-		linbox_check (A.rowdim () == w.size ());
-		
-		typename Matrix::ConstColIterator i = A.colBegin ();
-		typename Vector2::const_iterator j;
-		typename Matrix::Column::first_type::const_iterator k_idx;
-		typename Matrix::Column::second_type::const_iterator k_elt;
-		std::vector<uint64>::iterator l;
-		
-		uint64 t;
-		
-		if (_tmp.size () < w.size ())
-			_tmp.resize (w.size ());
-		
-		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
-		
-		for (j = v.begin (); j != v.end (); ++j, ++i) {
-			for (k_idx = i->first.begin (), k_elt = i->second.begin (), l = _tmp.begin ();
-			     k_idx != i->first.end ();
-			     ++k_idx, ++k_elt, ++l)
-				{
-					t = ((uint64) *k_elt) * ((uint64) *j);
-
-					_tmp[*k_idx] += t;
-
-					if (_tmp[*k_idx] < t)
-						_tmp[*k_idx] += VD.field ()._two64;
-				}
-		}
-
-		typename Vector1::iterator w_j;
-
-		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
-			*w_j = *l % VD.field ().modulus;
-
-		return w;
-	}
-  	  
-
-} 
-
-#include "linbox/randiter/modular.h"
-#endif
-#endif
diff --git a/linbox/field/modular-int32.h b/linbox/field/modular-int32.h
index 329251b..86995a8 100644
--- a/linbox/field/modular-int32.h
+++ b/linbox/field/modular-int32.h
@@ -1,7 +1,31 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-#ifndef __LINBOX_MODULAR_INT32_H
-#define __LINBOX_MODULAR_INT32_H
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) 2010 LinBox
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*! @file field/modular-int32_t.h
+ * @ingroup field
+ * @brief  representation of <code>Z/mZ</code> over \c int32_t .
+ */
+#ifndef __LINBOX_modular_int32_H
+#define __LINBOX_modular_int32_H
 
 
 #include <math.h>
@@ -11,47 +35,47 @@
 #include "linbox/field/field-interface.h"
 #include "linbox/field/field-traits.h"
 #include "linbox/util/debug.h"
-#include <linbox/field/field-traits.h>
+#include "linbox/field/field-traits.h"
 
-#ifndef LINBOX_MAX_INT
-#define LINBOX_MAX_INT 2147483647
-#endif
+#include "fflas-ffpack/field/modular-int32.h"
 
-// This is replaced by FieldTraits< Modular<int32> >::maxModulus(integer&)
-// #ifndef LINBOX_MAX_MODULUS
-// #define LINBOX_MAX_MODULUS 1073741823
-// #endif
+#ifndef LINBOX_MAX_INT /* 2147483647 */
+#define LINBOX_MAX_INT INT32_MAX
+#endif
 
 // Namespace in which all LinBox code resides
-namespace LinBox 
-{ 
+namespace LinBox
+{
 
 	template< class Element >
-		class Modular;
+	class Modular;
 	template< class Element >
-		class ModularRandIter;
+	class ModularRandIter;
+	template< class Field, class RandIter >
+	class NonzeroRandIter;
+
 	template<class Field>
-		class DotProductDomain;
+	class DotProductDomain;
 	template<class Field>
-		class FieldAXPY;
+	class FieldAXPY;
 	template<class Field>
-		class MVProductDomain;
+	class MVProductDomain;
 
 	template <class Ring>
-	struct ClassifyRing; 
-	
+	struct ClassifyRing;
+
 	template <class Element>
 	struct ClassifyRing<Modular<Element> >;
 
 	template <>
-	struct ClassifyRing<Modular<int32> >{
+	struct ClassifyRing<Modular<int32_t> > {
 		typedef RingCategories::ModularTag categoryTag;
 	};
 
-	
-	
-	/** \brief Specialization of Modular to int32 element type with efficient dot product.
-	 * 
+
+
+	/** \brief Specialization of Modular to int32_t element type with efficient dot product.
+	 *
 	 * Efficient element operations for dot product, mul, axpy, by using floating point
 	 * inverse of modulus (borrowed from NTL) and some use of non-normalized intermediate values.
 	 *
@@ -60,623 +84,409 @@ namespace LinBox
 	 *
 	 * Requires: Modulus < 2^30.
 	 * Intended use: 2^15 < prime modulus < 2^30.
-	\ingroup field
+	 \ingroup field
 	 */
 	template <>
-		class Modular<int32> : public FieldInterface {
+	class Modular<int32_t> : public FieldInterface ,
+	      public ::FFPACK::Modular<int32_t> {
 
-		protected:
+	protected:
 
-		int32 modulus;
+	public:
 
-		double modulusinv;
-		
-		int32 _two64;
+		friend class FieldAXPY<Modular<int32_t> >;
+		friend class DotProductDomain<Modular<int32_t> >;
+		friend class MVProductDomain<Modular<int32_t> >;
 
-		public:	       
+		typedef int32_t Element;
+		typedef ModularRandIter<int32_t> RandIter;
+		typedef NonzeroRandIter<Modular<int32_t>, ModularRandIter<int32_t> > NonZeroRandIter;
 
-		friend class FieldAXPY<Modular<int32> >;
-                friend class DotProductDomain<Modular<int32> >;
-		friend class MVProductDomain<Modular<int32> >;
-	       
-		typedef int32 Element;
-		typedef ModularRandIter<int32> RandIter;
+		Modular (integer &p) :
+			FFPACK::Modular<int32_t>((unsigned long)p)
+		{}
 
-		//default modular field,taking 65521 as default modulus
-		Modular () :modulus(65521) {
-			modulusinv=1/(double)65521;
-			
-			_two64 = (int32) ((uint64) (-1) % (uint64) 65521);
-			_two64 += 1;
-			if (_two64 >= 65521) _two64 -= 65521;
-		}
+	       	Modular (int32_t value, int32_t exp=1) :
+			FFPACK::Modular<int32_t>(value,exp)
+		      {}
 
-		Modular (int32 value, int32 exp = 1)  : modulus(value) {
-			modulusinv = 1 / ((double) value); 
-			if(exp != 1) throw PreconditionFailed(__FUNCTION__,__LINE__,"exponent must be 1");
-			if(value<=1) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
-			integer max;
-			if(value>FieldTraits< Modular<int32> >::maxModulus(max)) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus is too big");
-			_two64 = (int32) ((uint64) (-1) % (uint64) value);
-			_two64 += 1;
-			if (_two64 >= value) _two64 -= value;
-		}
-
-		Modular(const Modular<int32>& mf) : modulus(mf.modulus),modulusinv(mf.modulusinv),_two64(mf._two64){}
-
-		const Modular &operator=(const Modular<int32> &F) {
-			modulus = F.modulus;
-			modulusinv = F.modulusinv;
-			_two64 = F._two64;
-			return *this;
-		}
-
-	
-		inline integer &cardinality (integer &c) const{ 
+		 integer &cardinality (integer &c) const
+		{
 			return c = modulus;
 		}
 
-		inline integer &characteristic (integer &c) const {
-			return c = modulus; 
-		}
-
-		inline integer &convert (integer &x, const Element &y) const { 
-			return x = y;
-		}
-		
-		inline double &convert (double &x, const Element &y) const { 
-			return x = (double) y;
-		}
-
-		inline float &convert (float &x, const Element &y) const { 
-			return x = (float) y;
-		}
-		
-		inline std::ostream &write (std::ostream &os) const {
-			return os << "int32 mod " << modulus;
-		}
-		
-		inline std::istream &read (std::istream &is) {
-			is >> modulus; 
-			modulusinv = 1 /((double) modulus );
-                        if(modulus <= 1) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
-			integer max;
-                        if(modulus > FieldTraits< Modular<int32> >::maxModulus(max)) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus is too big");
-			_two64 = (int32) ((uint64) (-1) % (uint64) modulus);
-			_two64 += 1;
-			if (_two64 >= modulus) _two64 -= modulus;
-			
-			return is;
-		}
-		
-		inline std::ostream &write (std::ostream &os, const Element &x) const {
-			return os << x;
-		}
-
-		inline std::istream &read (std::istream &is, Element &x) const {
-			integer tmp;
-			is >> tmp;
-			init(x,tmp); 
-			return is;
-                }
-		
-		inline Element &init (Element & x, const double &y) const {
-		  double z = fmod(y, (double)modulus);
-		  if (z < 0) z += (double)modulus;
-		  //z += 0.5; // C Pernet Sounds nasty and not necessary
-		  return x = static_cast<long>(z); //rounds towards 0
-		}
-
-		inline Element &init (Element & x, const float &y) const {
-		  return init(x , (double) y);
-		}
-
-		template<class Element1>
-		inline Element &init (Element & x, const Element1 &y) const {
-			x = y % modulus;
-			if (x < 0) x += modulus;
-			return x;
+		 integer &characteristic (integer &c) const
+		{
+		       	return c = modulus;
 		}
 
-		inline Element &init (Element &x, const integer &y) const  {
-		        x = y % modulus;
-			if (x < 0) x += modulus;
-			return x;
-		}
 
-		inline Element& init(Element& x, int y =0) const {
-			x = y % modulus;
-			if ( x < 0 ) x += modulus;
-			return x;
-		}
+		 template<class T>T&convert(T&x,const Element&y)const{return x=T(y);}
+		 template<class T>T&characteristic(T&x)const{return x=T(lmodulus);}
+		 unsigned long characteristic()const{return FFPACK::Modular<int32_t>::characteristic();}
+		 unsigned long cardinality()const{return FFPACK::Modular<int32_t>::cardinality();}
 
-		inline Element& init(Element& x, long y) const {
-			x = y % modulus;
-			if ( x < 0 ) x += modulus;
-			return x;
-		}
-		
-		inline Element& assign(Element& x, const Element& y) const {
+		 integer &convert (integer &x, const Element &y) const
+		{
 			return x = y;
 		}
-									
-		
-		inline bool areEqual (const Element &x, const Element &y) const {
-			return x == y;
-		}
 
-		inline  bool isZero (const Element &x) const {
-			return x == 0; 
-		}
-		
-		inline bool isOne (const Element &x) const {
-			return x == 1; 
-		}
 
-		inline Element &add (Element &x, const Element &y, const Element &z) const {
-			x = y + z;
-			if ( x >= modulus ) x -= modulus;
-			return x;
-		}
- 
-		inline Element &sub (Element &x, const Element &y, const Element &z) const {
-			x = y - z;
+		 Element &init (Element &x, const integer &y) const
+		{
+			x = Element (y % modulus);
 			if (x < 0) x += modulus;
 			return x;
 		}
-		
-		inline Element &mul (Element &x, const Element &y, const Element &z) const {
-			int32 q;
-
-			q  = (int32) ((((double) y)*((double) z)) * modulusinv);  // q could be off by (+/-) 1
-			x = (int32) (y*z - q*modulus);
-			
-			
-			if (x >= modulus)
-				x -= modulus;
-			else if (x < 0)
-				x += modulus;
 
-			return x;
-		}
- 
-		inline Element &div (Element &x, const Element &y, const Element &z) const {
-			Element temp;
-			inv (temp, z);
-			return mul (x, y, temp);
-		}
- 
-		inline Element &neg (Element &x, const Element &y) const {
-			if(y == 0) return x=0;
-			else return x = modulus-y;
-		}
- 
-		inline Element &inv (Element &x, const Element &y) const {
-			int32 d, t;			
-			XGCD(d, x, t, y, modulus);
-			if (d != 1) {
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"InvMod: Input is not invertible ");
+		 Element init(Element&x) const { return FFPACK::Modular<int32_t>::init(x) ; }
+
+		unsigned long AccBound(const Element&r) const
+		{
+			Element one, zero ; init(one,1UL) ; init(zero,0UL);
+			double max_double = (double) (INT_MAX) - modulus ;
+			double p = modulus-1 ;
+			if (areEqual(zero,r))
+				return (unsigned long) (max_double/p) ;
+			else if (areEqual(one,r))
+			{
+				if (modulus>= getMaxModulus())
+					return 0 ;
+				else
+					return (unsigned long) max_double/(modulus*modulus) ;
 			}
-			if (x < 0)
-				x += modulus;
-			return x;		
-							      
+			else
+				throw LinboxError("Bad input, expecting 0 or 1");
+			return 0;
 		}
 
-		inline Element &axpy (Element &r, 
-				      const Element &a, 
-				      const Element &x, 
-				      const Element &y) const {
-			int32 q;
-			
-			q  = (int32) (((((double) a) * ((double) x)) + (double)y) * modulusinv);  // q could be off by (+/-) 1
-			r = (int32) (a * x + y - q*modulus);
-			
-			
-			if (r >= modulus)
-				r -= modulus;
-			else if (r < 0)
-				r += modulus;
-
-			return r;
-
-		}
+	private:
 
-		inline Element &addin (Element &x, const Element &y) const {
-			x += y;
-			if (  x >= modulus ) x -= modulus;
-			return x;
-		}
- 
-		inline Element &subin (Element &x, const Element &y) const {
-			x -= y;
-			if (x < 0) x += modulus;
-			return x;
-		}
- 
-		inline Element &mulin (Element &x, const Element &y) const {
-			return mul(x,x,y);
-		}
- 
-		inline Element &divin (Element &x, const Element &y) const {
-			return div(x,x,y);
-		}
- 
-		inline Element &negin (Element &x) const {
-			if (x == 0) return x; 
-			else return x = modulus - x; 
-		}
- 
-		inline Element &invin (Element &x) const {
-			return inv (x, x);
-		}
+	};
 
-		inline Element &axpyin (Element &r, const Element &a, const Element &x) const {
-			int32 q;
-			
-			q  = (int32) (((((double) a) * ((double) x)) + (double) r) * modulusinv);  // q could be off by (+/-) 1
-			r = (int32) (a * x + r - q*modulus);
-			
-			
-			if (r >= modulus)
-				r -= modulus;
-			else if (r < 0)
-				r += modulus;
-
-			return r;
-		}
+	template <>
+	class FieldAXPY<Modular<int32_t> > {
+	public:
 
-		static inline int32 getMaxModulus()
-			{ return 1073741824; } // 2^30
+		typedef int32_t Element;
+		typedef Modular<int32_t> Field;
 
-		private:
+		FieldAXPY (const Field &F) :
+			_F (F),_y(0)
+		{ }
 
-      		static void XGCD(int32& d, int32& s, int32& t, int32 a, int32 b) {
-			int32  u, v, u0, v0, u1, v1, u2, v2, q, r;
-			
-			int32 aneg = 0, bneg = 0;
-			
-			if (a < 0) {
-				if (a < -LINBOX_MAX_INT) throw PreconditionFailed(__FUNCTION__,__LINE__,"XGCD: integer overflow");
-				a = -a;
-				aneg = 1;
-			}
-			
-			if (b < 0) {
-				if (b < -LINBOX_MAX_INT) throw PreconditionFailed(__FUNCTION__,__LINE__,"XGCD: integer overflow");
-				b = -b;
-				bneg = 1;
-			}
-			
-			u1 = 1; v1 = 0;
-			u2 = 0; v2 = 1;
-			u = a; v = b;
-			
-			while (v != 0) {
-				q = u / v;
-				r = u % v;
-				u = v;
-				v = r;
-				u0 = u2;
-				v0 = v2;
-				u2 =  u1 - q*u2;
-				v2 = v1- q*v2;
-				u1 = u0;
-				v1 = v0;
-			}
-			
-			if (aneg)
-				u1 = -u1;
-			
-			if (bneg)
-				v1 = -v1;
-			
-			d = u;
-			s = u1;
-			t = v1;
-		}
 
-	};
+		FieldAXPY (const FieldAXPY &faxpy) :
+			_F (faxpy._F), _y (0)
+		{}
 
-	template <>
-		class FieldAXPY<Modular<int32> > {	  
-		public:
-	  
-		typedef int32 Element;
-		typedef Modular<int32> Field;
-	  
-		FieldAXPY (const Field &F) : _F (F),_y(0) {}
-		
-
-		FieldAXPY (const FieldAXPY &faxpy) : _F (faxpy._F), _y (0) {}
-	  
-		FieldAXPY<Modular<int32> > &operator = (const FieldAXPY &faxpy) {
-			_F = faxpy._F; 
-			_y = faxpy._y; 		       
-			return *this; 
+		FieldAXPY<Modular<int32_t> > &operator = (const FieldAXPY &faxpy)
+		{
+			_F = faxpy._F;
+			_y = faxpy._y;
+			return *this;
 		}
-	  
-		inline uint64& mulacc (const Element &a, const Element &x) {
-			uint64 t = (uint64) a * (uint64) x;
+
+		 uint64_t& mulacc (const Element &a, const Element &x)
+		{
+			uint64_t t = (uint64_t) a * (uint64_t) x;
 			_y += t;
 			if (_y < t)
 				return _y += _F._two64;
-                        else
-                            return _y;
+			else
+				return _y;
 		}
 
-		inline uint64& accumulate (const Element &t) {
+		 uint64_t& accumulate (const Element &t)
+		{
 			_y += t;
-			if (_y < (uint64)t)
+			if (_y < (uint64_t)t)
 				return _y += _F._two64;
-                        else
-                            return _y;
+			else
+				return _y;
 		}
 
-		inline Element& get (Element &y) {
-			y =_y % (uint64) _F.modulus;
+		 Element& get (Element &y)
+		{
+			y =_y % (uint64_t) _F.modulus;
 			return y;
 		}
 
-		inline FieldAXPY &assign (const Element y) {
-			_y = y; 
+		 FieldAXPY &assign (const Element y)
+		{
+			_y = y;
 			return *this;
 		}
 
-		inline void reset() {
+		 void reset()
+		{
 			_y = 0;
 		}
 
-	  	protected:
+	protected:
 		Field _F;
-		uint64 _y;		
+		uint64_t _y;
 	};
 
 
 	template <>
-		class DotProductDomain<Modular<int32> > : private virtual VectorDomainBase<Modular<int32> > {	       
-
-		public:	  
-		typedef int32 Element;	  
-		DotProductDomain (const Modular<int32> &F)
-			: VectorDomainBase<Modular<int32> > (F) {}
-	  
-	  
-		protected:
+	class DotProductDomain<Modular<int32_t> > : private virtual VectorDomainBase<Modular<int32_t> > {
+
+	public:
+		typedef int32_t Element;
+		DotProductDomain (const Modular<int32_t> &F) :
+			VectorDomainBase<Modular<int32_t> > (F)
+		{}
+
+
+	protected:
 		template <class Vector1, class Vector2>
-			inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const {
-		  
+		 Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
+
 			typename Vector1::const_iterator i;
 			typename Vector2::const_iterator j;
-		  
-			uint64 y = 0;
-			uint64 t;
-		  
-			for (i = v1.begin (), j = v2.begin (); i < v1.end (); ++i, ++j) {
-				t = ( (uint64) *i ) * ( (uint64) *j );
+
+			uint64_t y = 0;
+			uint64_t t;
+
+			for (i = v1.begin (), j = v2.begin (); i < v1.end (); ++i, ++j)
+			{
+				t = ( (uint64_t) *i ) * ( (uint64_t) *j );
 				y += t;
-			  
+
 				if (y < t)
 					y += _F._two64;
 			}
-		  
-			y %= (uint64) _F.modulus; 
+
+			y %= (uint64_t) _F.modulus;
 			return res = y;
 
 		}
-	  
+
 		template <class Vector1, class Vector2>
-			inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const {		  
+		 Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
 			typename Vector1::first_type::const_iterator i_idx;
 			typename Vector1::second_type::const_iterator i_elt;
-		  
-			uint64 y = 0;
-			uint64 t;
-		  
-			for (i_idx = v1.first.begin (), i_elt = v1.second.begin (); i_idx != v1.first.end (); ++i_idx, ++i_elt) {
-				t = ( (uint64) *i_elt ) * ( (uint64) v2[*i_idx] );
+
+			uint64_t y = 0;
+			uint64_t t;
+
+			for (i_idx = v1.first.begin (), i_elt = v1.second.begin (); i_idx != v1.first.end (); ++i_idx, ++i_elt)
+			{
+				t = ( (uint64_t) *i_elt ) * ( (uint64_t) v2[*i_idx] );
 				y += t;
-			  
+
 				if (y < t)
 					y += _F._two64;
 			}
-		  
 
-			y %= (uint64) _F.modulus;
-		  
+
+			y %= (uint64_t) _F.modulus;
+
 			return res = y;
 		}
 	};
-	  
-	// Specialization of MVProductDomain for int32 modular field	
+
+	// Specialization of MVProductDomain for int32_t modular field
 
 	template <>
-		class MVProductDomain<Modular<int32> >
+	class MVProductDomain<Modular<int32_t> > {
+	public:
+
+		typedef int32_t Element;
+
+	protected:
+		template <class Vector1, class Matrix, class Vector2>
+		 Vector1 &mulColDense
+		(const VectorDomain<Modular<int32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v) const
 		{
-		public:
-
-			typedef int32 Element;
-
-		protected:
-			template <class Vector1, class Matrix, class Vector2>
-				inline Vector1 &mulColDense
-				(const VectorDomain<Modular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v) const
-				{
-					return mulColDenseSpecialized
-						(VD, w, A, v, typename VectorTraits<typename Matrix::Column>::VectorCategory ());
-				}
-
-		private:
-			template <class Vector1, class Matrix, class Vector2>
-				Vector1 &mulColDenseSpecialized
-				(const VectorDomain<Modular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-				 VectorCategories::DenseVectorTag) const;
-			template <class Vector1, class Matrix, class Vector2>
-				Vector1 &mulColDenseSpecialized
-				(const VectorDomain<Modular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-				 VectorCategories::SparseSequenceVectorTag) const;
-			template <class Vector1, class Matrix, class Vector2>
-				Vector1 &mulColDenseSpecialized
-				(const VectorDomain<Modular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-				 VectorCategories::SparseAssociativeVectorTag) const;
-			template <class Vector1, class Matrix, class Vector2>
-				Vector1 &mulColDenseSpecialized
-				(const VectorDomain<Modular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-				 VectorCategories::SparseParallelVectorTag) const;
-
-			mutable std::vector<uint64> _tmp;
-		};
+			return mulColDenseSpecialized
+			(VD, w, A, v, typename VectorTraits<typename Matrix::Column>::VectorCategory ());
+		}
+
+	private:
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColDenseSpecialized
+		(const VectorDomain<Modular<int32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::DenseVectorTag) const;
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColDenseSpecialized
+		(const VectorDomain<Modular<int32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::SparseSequenceVectorTag) const;
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColDenseSpecialized
+		(const VectorDomain<Modular<int32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::SparseAssociativeVectorTag) const;
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColDenseSpecialized
+		(const VectorDomain<Modular<int32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::SparseParallelVectorTag) const;
+
+		mutable std::vector<uint64_t> _tmp;
+	};
 
 	template <class Vector1, class Matrix, class Vector2>
-		Vector1 &MVProductDomain<Modular<int32> >::mulColDenseSpecialized
-		(const VectorDomain<Modular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-		 VectorCategories::DenseVectorTag) const {
-		
+	Vector1 &MVProductDomain<Modular<int32_t> >::mulColDenseSpecialized
+	(const VectorDomain<Modular<int32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+	 VectorCategories::DenseVectorTag) const
+	{
+
 		linbox_check (A.coldim () == v.size ());
 		linbox_check (A.rowdim () == w.size ());
-		
+
 		typename Matrix::ConstColIterator i = A.colBegin ();
 		typename Vector2::const_iterator j;
 		typename Matrix::Column::const_iterator k;
-		std::vector<uint64>::iterator l;
+		std::vector<uint64_t>::iterator l;
 
-		uint64 t;
+		uint64_t t;
 
 		if (_tmp.size () < w.size ())
 			_tmp.resize (w.size ());
-		
+
 		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
-		
-		for (j = v.begin (); j != v.end (); ++j, ++i) {
-			for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
-				t = ((uint64) *k) * ((uint64) *j);
+
+		for (j = v.begin (); j != v.end (); ++j, ++i)
+		{
+			for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l)
+			{
+				t = ((uint64_t) *k) * ((uint64_t) *j);
 
 				*l += t;
-				
+
 				if (*l < t)
 					*l += VD.field ()._two64;
 			}
 		}
-		
+
 		typename Vector1::iterator w_j;
-		
+
 		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
 			*w_j = *l % VD.field ().modulus;
-		
+
 		return w;
 	}
-	
+
 	template <class Vector1, class Matrix, class Vector2>
-		Vector1 &MVProductDomain<Modular<int32> >::mulColDenseSpecialized
-		(const VectorDomain<Modular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-		 VectorCategories::SparseSequenceVectorTag) const
+	Vector1 &MVProductDomain<Modular<int32_t> >::mulColDenseSpecialized
+	(const VectorDomain<Modular<int32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+	 VectorCategories::SparseSequenceVectorTag) const
+	{
+		linbox_check (A.coldim () == v.size ());
+		linbox_check (A.rowdim () == w.size ());
+
+		typename Matrix::ConstColIterator i = A.colBegin ();
+		typename Vector2::const_iterator j;
+		typename Matrix::Column::const_iterator k;
+		std::vector<uint64_t>::iterator l;
+
+		uint64_t t;
+
+		if (_tmp.size () < w.size ())
+			_tmp.resize (w.size ());
+
+		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
+
+		for (j = v.begin (); j != v.end (); ++j, ++i)
 		{
-			linbox_check (A.coldim () == v.size ());
-			linbox_check (A.rowdim () == w.size ());
-			
-			typename Matrix::ConstColIterator i = A.colBegin ();
-			typename Vector2::const_iterator j;
-			typename Matrix::Column::const_iterator k;
-			std::vector<uint64>::iterator l;
-			
-			uint64 t;
-			
-			if (_tmp.size () < w.size ())
-				_tmp.resize (w.size ());
-			
-			std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
-			
-			for (j = v.begin (); j != v.end (); ++j, ++i) {
-				for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
-					t = ((uint64) k->second) * ((uint64) *j);
-
-					_tmp[k->first] += t;
-					
-					if (_tmp[k->first] < t)
-						_tmp[k->first] += VD.field ()._two64;
-				}
+			for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l)
+			{
+				t = ((uint64_t) k->second) * ((uint64_t) *j);
+
+				_tmp[k->first] += t;
+
+				if (_tmp[k->first] < t)
+					_tmp[k->first] += VD.field ()._two64;
 			}
-			
-			typename Vector1::iterator w_j;
-			
-			for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
-				*w_j = *l % VD.field ().modulus;
-			
-			return w;
 		}
-	
+
+		typename Vector1::iterator w_j;
+
+		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
+			*w_j = *l % VD.field ().modulus;
+
+		return w;
+	}
+
 	template <class Vector1, class Matrix, class Vector2>
-		Vector1 &MVProductDomain<Modular<int32> >::mulColDenseSpecialized
-		(const VectorDomain<Modular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-		 VectorCategories::SparseAssociativeVectorTag) const {
+	Vector1 &MVProductDomain<Modular<int32_t> >::mulColDenseSpecialized
+	(const VectorDomain<Modular<int32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+	 VectorCategories::SparseAssociativeVectorTag) const
+	{
 
 		linbox_check (A.coldim () == v.size ());
 		linbox_check (A.rowdim () == w.size ());
-		
+
 		typename Matrix::ConstColIterator i = A.colBegin ();
 		typename Vector2::const_iterator j;
 		typename Matrix::Column::const_iterator k;
-		std::vector<uint64>::iterator l;
-		
-		uint64 t;
-		
+		std::vector<uint64_t>::iterator l;
+
+		uint64_t t;
+
 		if (_tmp.size () < w.size ())
 			_tmp.resize (w.size ());
-		
+
 		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
-		
-		for (j = v.begin (); j != v.end (); ++j, ++i) {
-			for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
-				t = ((uint64) k->second) * ((uint64) *j);
-				
+
+		for (j = v.begin (); j != v.end (); ++j, ++i)
+		{
+			for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l)
+			{
+				t = ((uint64_t) k->second) * ((uint64_t) *j);
+
 				_tmp[k->first] += t;
-				
+
 				if (_tmp[k->first] < t)
 					_tmp[k->first] += VD.field ()._two64;
 			}
 		}
-		
+
 		typename Vector1::iterator w_j;
-		
+
 		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
 			*w_j = *l % VD.field ().modulus;
-		
+
 		return w;
 	}
 
 	template <class Vector1, class Matrix, class Vector2>
-		Vector1 &MVProductDomain<Modular<int32> >::mulColDenseSpecialized
-		(const VectorDomain<Modular<int32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-		 VectorCategories::SparseParallelVectorTag) const {
-		
+	Vector1 &MVProductDomain<Modular<int32_t> >::mulColDenseSpecialized
+	(const VectorDomain<Modular<int32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+	 VectorCategories::SparseParallelVectorTag) const
+	{
+
 		linbox_check (A.coldim () == v.size ());
 		linbox_check (A.rowdim () == w.size ());
-		
+
 		typename Matrix::ConstColIterator i = A.colBegin ();
 		typename Vector2::const_iterator j;
 		typename Matrix::Column::first_type::const_iterator k_idx;
 		typename Matrix::Column::second_type::const_iterator k_elt;
-		std::vector<uint64>::iterator l;
-		
-		uint64 t;
-		
+		std::vector<uint64_t>::iterator l;
+
+		uint64_t t;
+
 		if (_tmp.size () < w.size ())
 			_tmp.resize (w.size ());
-		
+
 		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
-		
-		for (j = v.begin (); j != v.end (); ++j, ++i) {
+
+		for (j = v.begin (); j != v.end (); ++j, ++i)
+		{
 			for (k_idx = i->first.begin (), k_elt = i->second.begin (), l = _tmp.begin ();
 			     k_idx != i->first.end ();
 			     ++k_idx, ++k_elt, ++l)
-				{
-					t = ((uint64) *k_elt) * ((uint64) *j);
+			{
+				t = ((uint64_t) *k_elt) * ((uint64_t) *j);
 
-					_tmp[*k_idx] += t;
+				_tmp[*k_idx] += t;
 
-					if (_tmp[*k_idx] < t)
-						_tmp[*k_idx] += VD.field ()._two64;
-				}
+				if (_tmp[*k_idx] < t)
+					_tmp[*k_idx] += VD.field ()._two64;
+			}
 		}
 
 		typename Vector1::iterator w_j;
@@ -686,9 +496,11 @@ namespace LinBox
 
 		return w;
 	}
-  	  
 
-} 
+
+}
 
 #include "linbox/randiter/modular.h"
-#endif
+
+#endif //__LINBOX_modular_int32_H
+
diff --git a/linbox/field/modular-int64.h b/linbox/field/modular-int64.h
new file mode 100644
index 0000000..9e0273c
--- /dev/null
+++ b/linbox/field/modular-int64.h
@@ -0,0 +1,490 @@
+/* -*- 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
+/* Copyright (C) 2010 LinBox
+ * Adapted by B Boyer <brice.boyer at imag.fr>
+ * (from other modular-balanced* files)
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*! @file field/modular-int64_t.h
+ * @ingroup field
+ * @brief  representation of <code>Z/mZ</code> over \c int64_t .
+ */
+#ifndef __LINBOX_modular_int64_H
+#define __LINBOX_modular_int64_H
+
+
+#include <math.h>
+#include "linbox/linbox-config.h"
+#include "linbox/integer.h"
+#include "linbox/vector/vector-domain.h"
+#include "linbox/field/field-interface.h"
+#include "linbox/field/field-traits.h"
+#include "linbox/util/debug.h"
+#include "linbox/field/field-traits.h"
+
+#include "fflas-ffpack/field/modular-int64.h"
+
+#ifndef LINBOX_MAX_INT64 /*  18446744073709551615L(L) is UINT64_MAX*/
+#ifdef __x86_64__
+#define LINBOX_MAX_INT64 INT64_MAX
+#else
+#define LINBOX_MAX_INT64 INT64_MAX
+#endif
+#endif
+
+// Namespace in which all LinBox code resides
+namespace LinBox
+{
+
+	template< class Element >
+	class Modular;
+	template< class Element >
+	class ModularRandIter;
+	template<class Field>
+	class DotProductDomain;
+	template<class Field>
+	class FieldAXPY;
+	template<class Field>
+	class MVProductDomain;
+
+	template <class Ring>
+	struct ClassifyRing;
+
+	template <class Element>
+	struct ClassifyRing<Modular<Element> >;
+
+	template <>
+	struct ClassifyRing<Modular<int64_t> > {
+	       	typedef RingCategories::ModularTag categoryTag;
+	};
+
+
+
+	/** \brief Specialization of Modular to int64_t element type with efficient dot product.
+	 *
+	 * Efficient element operations for dot product, mul, axpy, by using floating point
+	 * inverse of modulus (borrowed from NTL) and some use of non-normalized intermediate values.
+	 *
+	 * For some uses this is the most efficient field for primes in the range from half word
+	 * to 2^62.
+	 *
+	 * Requires: Modulus < 2^62.
+	 * Intended use: 2^30 < prime modulus < 2^62.
+	 \ingroup field
+	 */
+	template <>
+	class Modular<int64_t> : public FieldInterface,
+	      public FFPACK::Modular<int64_t>	{
+
+	public:
+		typedef int64_t Element;
+
+		friend class FieldAXPY<Modular<int64_t> >;
+		friend class DotProductDomain<Modular<int64_t> >;
+		friend class MVProductDomain<Modular<int64_t> >;
+
+		typedef ModularRandIter<int64_t> RandIter;
+
+		inline integer &cardinality (integer &c) const
+		{
+			return c = modulus;
+		}
+
+		inline integer &characteristic (integer &c) const
+		{
+			return c = modulus;
+		}
+
+		inline integer characteristic () const
+		{
+			return modulus;
+		}
+
+		inline integer &convert (integer &x, const Element &y) const
+		{
+			return x = y;
+		}
+
+		inline Element &init (Element &x, const integer &y) const
+		{
+			x = Element (y % modulus);
+			if (x < 0) x += modulus;
+			return x;
+		}
+
+
+	private:
+
+
+	};
+
+	template <>
+	class FieldAXPY<Modular<int64_t> > {
+	public:
+
+		typedef int64_t Element;
+		typedef Modular<int64_t> Field;
+
+		FieldAXPY (const Field &F) :
+			_F (F),_y(0)
+		{}
+
+
+		FieldAXPY (const FieldAXPY &faxpy) :
+			_F (faxpy._F), _y (0)
+		{}
+
+		FieldAXPY<Modular<int64_t> > &operator = (const FieldAXPY &faxpy)
+		{
+			_F = faxpy._F;
+			_y = faxpy._y;
+			return *this;
+		}
+
+		inline uint64_t& mulacc (const Element &a, const Element &x)
+		{
+			uint64_t t = (uint64_t) a * (uint64_t) x;
+			_y += t;
+			if (_y < t)
+				return _y += _F._two64;
+			else
+				return _y;
+		}
+
+		inline uint64_t& accumulate (const Element &t)
+		{
+			_y += t;
+			if (_y < (uint64_t)t)
+				return _y += _F._two64;
+			else
+				return _y;
+		}
+
+		inline Element& get (Element &y)
+		{
+			y =_y % (uint64_t) _F.modulus;
+			return y;
+		}
+
+		inline FieldAXPY &assign (const Element y)
+		{
+			_y = y;
+			return *this;
+		}
+
+		inline void reset()
+		{
+			_y = 0;
+		}
+
+	protected:
+		Field _F;
+		uint64_t _y;
+	};
+
+
+	template <>
+	class DotProductDomain<Modular<int64_t> > : private virtual VectorDomainBase<Modular<int64_t> > {
+
+	public:
+		typedef int64_t Element;
+		DotProductDomain (const Modular<int64_t> &F) :
+			VectorDomainBase<Modular<int64_t> > (F)
+		{}
+
+
+	protected:
+		template <class Vector1, class Vector2>
+		inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
+
+			typename Vector1::const_iterator i;
+			typename Vector2::const_iterator j;
+
+			uint64_t y = 0;
+			uint64_t t;
+
+			for (i = v1.begin (), j = v2.begin (); i < v1.end (); ++i, ++j)
+			{
+				t = ( (uint64_t) *i ) * ( (uint64_t) *j );
+				y += t;
+
+				if (y < t)
+					y += _F._two64;
+			}
+
+			y %= (uint64_t) _F.modulus;
+			return res = y;
+
+		}
+
+		template <class Vector1, class Vector2>
+		inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
+			typename Vector1::first_type::const_iterator i_idx;
+			typename Vector1::second_type::const_iterator i_elt;
+
+			uint64_t y = 0;
+			uint64_t t;
+
+			for (i_idx = v1.first.begin (), i_elt = v1.second.begin (); i_idx != v1.first.end (); ++i_idx, ++i_elt)
+			{
+				t = ( (uint64_t) *i_elt ) * ( (uint64_t) v2[*i_idx] );
+				y += t;
+
+				if (y < t)
+					y += _F._two64;
+			}
+
+
+			y %= (uint64_t) _F.modulus;
+
+			return res = y;
+		}
+	};
+
+	// Specialization of MVProductDomain for int64_t modular field
+
+	template <>
+	class MVProductDomain<Modular<int64_t> > {
+	public:
+
+		typedef int64_t Element;
+
+	protected:
+		template <class Vector1, class Matrix, class Vector2>
+		inline Vector1 &mulColDense
+		(const VectorDomain<Modular<int64_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v) const
+		{
+			return mulColDenseSpecialized
+			(VD, w, A, v, typename VectorTraits<typename Matrix::Column>::VectorCategory ());
+		}
+
+	private:
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColDenseSpecialized
+		(const VectorDomain<Modular<int64_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::DenseVectorTag) const;
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColDenseSpecialized
+		(const VectorDomain<Modular<int64_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::SparseSequenceVectorTag) const;
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColDenseSpecialized
+		(const VectorDomain<Modular<int64_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::SparseAssociativeVectorTag) const;
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColDenseSpecialized
+		(const VectorDomain<Modular<int64_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::SparseParallelVectorTag) const;
+
+		mutable std::vector<uint64_t> _tmp;
+	};
+
+	template <class Vector1, class Matrix, class Vector2>
+	Vector1 & MVProductDomain<Modular<int64_t> >::
+	mulColDenseSpecialized (const VectorDomain<Modular<int64_t> > &VD,
+				Vector1 &w,
+				const Matrix &A,
+				const Vector2 &v,
+				VectorCategories::DenseVectorTag) const
+	{
+
+		linbox_check (A.coldim () == v.size ());
+		linbox_check (A.rowdim () == w.size ());
+
+		typename Matrix::ConstColIterator i = A.colBegin ();
+		typename Vector2::const_iterator j;
+		typename Matrix::Column::const_iterator k;
+		std::vector<uint64_t>::iterator l;
+
+		uint64_t t;
+
+		if (_tmp.size () < w.size ())
+			_tmp.resize (w.size ());
+
+		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
+
+		for (j = v.begin (); j != v.end (); ++j, ++i)
+		{
+			for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l)
+			{
+				t = ((uint64_t) *k) * ((uint64_t) *j);
+
+				*l += t;
+
+				if (*l < t)
+					*l += VD.field ()._two64;
+			}
+		}
+
+		typename Vector1::iterator w_j;
+
+		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
+			*w_j = *l % VD.field ().modulus;
+
+		return w;
+	}
+
+	template <class Vector1, class Matrix, class Vector2>
+	Vector1 &MVProductDomain<Modular<int64_t> >::
+	mulColDenseSpecialized (const VectorDomain<Modular<int64_t> > &VD,
+				Vector1 &w,
+				const Matrix &A,
+				const Vector2 &v,
+				VectorCategories::SparseSequenceVectorTag) const
+	{
+		linbox_check (A.coldim () == v.size ());
+		linbox_check (A.rowdim () == w.size ());
+
+		typename Matrix::ConstColIterator i = A.colBegin ();
+		typename Vector2::const_iterator j;
+		typename Matrix::Column::const_iterator k;
+		std::vector<uint64_t>::iterator l;
+
+		uint64_t t;
+
+		if (_tmp.size () < w.size ())
+			_tmp.resize (w.size ());
+
+		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
+
+		for (j = v.begin (); j != v.end (); ++j, ++i)
+		{
+			for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l)
+			{
+				t = ((uint64_t) k->second) * ((uint64_t) *j);
+
+				_tmp[k->first] += t;
+
+				if (_tmp[k->first] < t)
+					_tmp[k->first] += VD.field ()._two64;
+			}
+		}
+
+		typename Vector1::iterator w_j;
+
+		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
+			*w_j = *l % VD.field ().modulus;
+
+		return w;
+	}
+
+	template <class Vector1, class Matrix, class Vector2>
+	Vector1 &MVProductDomain<Modular<int64_t> > ::
+	mulColDenseSpecialized(const VectorDomain<Modular<int64_t> > &VD,
+			       Vector1 &w,
+			       const Matrix &A,
+			       const Vector2 &v,
+			       VectorCategories::SparseAssociativeVectorTag) const
+	{
+
+		linbox_check (A.coldim () == v.size ());
+		linbox_check (A.rowdim () == w.size ());
+
+		typename Matrix::ConstColIterator i = A.colBegin ();
+		typename Vector2::const_iterator j;
+		typename Matrix::Column::const_iterator k;
+		std::vector<uint64_t>::iterator l;
+
+		uint64_t t;
+
+		if (_tmp.size () < w.size ())
+			_tmp.resize (w.size ());
+
+		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
+
+		for (j = v.begin (); j != v.end (); ++j, ++i)
+		{
+			for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l)
+			{
+				t = ((uint64_t) k->second) * ((uint64_t) *j);
+
+				_tmp[k->first] += t;
+
+				if (_tmp[k->first] < t)
+					_tmp[k->first] += VD.field ()._two64;
+			}
+		}
+
+		typename Vector1::iterator w_j;
+
+		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
+			*w_j = *l % VD.field ().modulus;
+
+		return w;
+	}
+
+	template <class Vector1, class Matrix, class Vector2>
+	Vector1 &MVProductDomain<Modular<int64_t> > ::
+	mulColDenseSpecialized (const VectorDomain<Modular<int64_t> > &VD,
+				Vector1 &w,
+				const Matrix &A,
+				const Vector2 &v,
+				VectorCategories::SparseParallelVectorTag) const
+	{
+
+		linbox_check (A.coldim () == v.size ());
+		linbox_check (A.rowdim () == w.size ());
+
+		typename Matrix::ConstColIterator i = A.colBegin ();
+		typename Vector2::const_iterator j;
+		typename Matrix::Column::first_type::const_iterator k_idx;
+		typename Matrix::Column::second_type::const_iterator k_elt;
+		std::vector<uint64_t>::iterator l;
+
+		uint64_t t;
+
+		if (_tmp.size () < w.size ())
+			_tmp.resize (w.size ());
+
+		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
+
+		for (j = v.begin (); j != v.end (); ++j, ++i)
+		{
+			for (k_idx = i->first.begin (), k_elt = i->second.begin (), l = _tmp.begin ();
+			     k_idx != i->first.end ();
+			     ++k_idx, ++k_elt, ++l)
+			{
+				t = ((uint64_t) *k_elt) * ((uint64_t) *j);
+
+				_tmp[*k_idx] += t;
+
+				if (_tmp[*k_idx] < t)
+					_tmp[*k_idx] += VD.field ()._two64;
+			}
+		}
+
+		typename Vector1::iterator w_j;
+
+		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
+			*w_j = *l % VD.field ().modulus;
+
+		return w;
+	}
+
+
+}
+
+#undef LINBOX_MAX_INT64
+
+#include "linbox/randiter/modular.h"
+
+#endif //__LINBOX_modular_int64_H
+
diff --git a/linbox/field/modular-short.h b/linbox/field/modular-short.h
index f80ebdb..653da49 100644
--- a/linbox/field/modular-short.h
+++ b/linbox/field/modular-short.h
@@ -1,10 +1,35 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-#ifndef __LINBOX_MODULAR__INT16_H
-#define __LINBOX_MODULAR__INT16_H
-
-
-#include "math.h"				
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) 2010 LinBox
+ * Written by <?>
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*! @file field/modular-short.h
+ * @ingroup field
+ * @brief  representation of <code>Z/mZ</code> over \c short .
+ */
+#ifndef __LINBOX_modular_short_H
+#define __LINBOX_modular_short_H
+
+
+#include "math.h"
 #include "linbox/linbox-config.h"
 #include "linbox/integer.h"
 #include "linbox/vector/vector-domain.h"
@@ -12,37 +37,36 @@
 #include "linbox/util/debug.h"
 #include "linbox/field/field-traits.h"
 
-#ifndef LINBOX_MAX_INT16
-#define LINBOX_MAX_INT16 32767
+#ifndef LINBOX_MAX_INT16 /* 32767 */
+#define LINBOX_MAX_INT16 INT16_MAX
 #endif
 
-// This is replaced by FieldTraits< Modular<int16> >::maxModulus(integer&)
-// #ifndef LINBOX_MAX_INT16_MODULUS
-// #define LINBOX_MAX_INT16_MODULUS 32767
-// #endif
+#ifdef __ICC /*  pas content avec x = -x par exemple */
+#pragma warning(disable:2259)
+#endif
 
 // Namespace in which all LinBox code resides
-namespace LinBox 
-{ 
+namespace LinBox
+{
 
 	template<class Element>
-		class Modular;
-	
+	class Modular;
+
 	template<class Element>
-		class ModularRandIter;
+	class ModularRandIter;
 
 	template<class Field>
-		class FieldAXPY;
+	class FieldAXPY;
 
 	template<class Field>
-		class DotProductDomain;
+	class DotProductDomain;
 
 	template<class Field>
-		class MVProductDomain;
+	class MVProductDomain;
 
 	template <class Ring>
-	struct ClassifyRing; 
-	
+	struct ClassifyRing;
+
 	template <class Element>
 	struct ClassifyRing<Modular<Element> >;
 
@@ -52,158 +76,211 @@ namespace LinBox
 	};
 
 	/** \brief Specialization of Modular to short element type with efficient dot product.
-	 * 
+	 *
 	 * Efficient element operations for dot product, mul, axpy, by using floating point
 	 * inverse of modulus (borrowed from NTL) and some use of non-normalized intermediate values.
-	 * 
-	 * Requires: modulus < 2^15. 
+	 *
+	 * Requires: modulus < 2^15.
 	 * Intended use: 2^7 < prime modulus < 2^15.
-	\ingroup field
+	 \ingroup field
 	 */
 	template <>
-		class Modular<int16> : public FieldInterface {
-		protected:
-		int16 modulus;
+	class Modular<int16_t> : public FieldInterface {
+	public:
+		typedef int16_t Element;
+	protected:
+		Element modulus;
+		unsigned long lmodulus;
 		double modulusinv;
 
-		public:	       
-		friend class FieldAXPY<Modular<int16> >;
-                friend class DotProductDomain<Modular<int16> >;
-		friend class MVProductDomain<Modular<int16> >;
+	public:
+		friend class FieldAXPY<Modular<Element> >;
+		friend class DotProductDomain<Modular<Element> >;
+		friend class MVProductDomain<Modular<Element> >;
 
-		typedef int16 Element;
-		typedef ModularRandIter<int16> RandIter;
+		typedef ModularRandIter<Element> RandIter;
 
-		//default modular field,taking 65521 as default modulus
-		Modular () :modulus(251){modulusinv=1/(double)251;}
+		//default modular field,taking 251 as default modulus
+		Modular () :
+			modulus(251),lmodulus(modulus)
+		{
+			modulusinv=1/(double)modulus;
+		}
 
-		Modular (int value, int exp = 1)  : modulus(value) {
-			modulusinv = 1 / ((double) value); 
-			if(value<=1) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
+		Modular (int value, int exp = 1)  :
+			modulus((Element)value),lmodulus((unsigned long) value)
+		{
+			modulusinv = 1 / ((double) value);
+#ifdef DEBUG
+			if(value<=1)
+				throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus must be > 1");
 			integer max;
-			if(value>FieldTraits< Modular<int16> >::maxModulus(max)) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus is too big");
-			if(exp != 1) throw PreconditionFailed(__FUNCTION__,__LINE__,"exponent must be 1");
+			if(value>FieldTraits< Modular<Element> >::maxModulus(max))
+				throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus is too big");
+			if(exp != 1)
+				throw PreconditionFailed(__func__,__FILE__,__LINE__,"exponent must be 1");
+#endif
 		}
 
-		Modular(const Modular<int16>& mf) : modulus(mf.modulus),modulusinv(mf.modulusinv){}
+		Modular(const Modular<Element>& mf) :
+			modulus(mf.modulus),lmodulus(mf. lmodulus),modulusinv(mf.modulusinv)
+		{}
 
-		const Modular &operator=(const Modular<int16> &F) {
-			modulus = F.modulus;
-			modulusinv = F.modulusinv;
+		const Modular &operator=(const Modular<Element> &F)
+		{
+			modulus    = F. modulus;
+			lmodulus   = F. lmodulus ;
+			modulusinv = F. modulusinv;
 			return *this;
 		}
 
-	
-		inline integer &cardinality (integer &c) const{ 
+		inline integer &cardinality (integer &c) const
+		{
+			return c = modulus;
+		}
+
+		inline integer &characteristic (integer &c) const
+		{
 			return c = modulus;
 		}
 
-		inline integer &characteristic (integer &c) const {
-			return c = modulus; 
+		inline unsigned long cardinality () const
+		{
+			return  lmodulus;
+		}
+
+		inline unsigned  long characteristic () const
+		{
+			return  lmodulus;
 		}
 
-		inline integer &convert (integer &x, const Element &y) const { 
+
+		inline integer &convert (integer &x, const Element &y) const
+		{
 			return x = y;
 		}
-		
-		inline std::ostream &write (std::ostream &os) const {
-			return os << "int16 mod " << modulus;
+
+		inline std::ostream &write (std::ostream &os) const
+		{
+			return os << "Element mod " << modulus;
 		}
-		
-		inline std::istream &read (std::istream &is) {
+
+		inline std::istream &read (std::istream &is)
+		{
 			int prime;
-			is >> prime; 
-			modulus = prime;
-			modulusinv = 1 /((double) modulus );
-			if(prime <= 1) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
+			is >> prime;
+#ifdef DEBUG
+			if(prime <= 1) throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus must be > 1");
 			integer max;
-			if(prime > FieldTraits< Modular<int16> >::maxModulus(max)) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus is too big");
-		
+			if(prime > FieldTraits< Modular<Element> >::maxModulus(max)) throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus is too big");
+#endif
+			modulus = (Element) prime;
+			modulusinv = 1 /((double) modulus );
+
 			return is;
 		}
-		
-		inline std::ostream &write (std::ostream &os, const Element &x) const {
+
+		inline std::ostream &write (std::ostream &os, const Element &x) const
+		{
 			return os << x;
 		}
 
-		inline std::istream &read (std::istream &is, Element &x) const {
+		inline std::istream &read (std::istream &is, Element &x) const
+		{
 			integer tmp;
 			is >> tmp;
-			init(x,tmp); 
+			init(x,tmp);
 			return is;
-                }
-		
+		}
+
 		template<class T>
-		inline Element &init (Element &x, const T& y) const {
+		inline Element &init (Element &x, const T& y) const
+		{
 			return init( x, static_cast<integer>(y) );
 		}
 
-		inline Element &init (Element &x, const integer &y) const  {
-			x = y % integer (modulus);
-			if (x < 0) x += modulus;
+		inline Element &init (Element &x, const integer &y) const
+		{
+			x = Element(y % (unsigned long)modulus);
+			if (x < 0)
+				x += modulus;
 			return x;
 		}
 
-		inline Element& init(Element& x, int y =0) const {
-			x = y % modulus;
-			if ( x < 0 ) x += modulus;
+		inline Element& init(Element& x, int y =0) const
+		{
+			x = (Element)(y % modulus);
+			if ( x < 0 )
+				x += modulus;
 			return x;
 		}
 
-		inline Element& init(Element& x, long y) const {
+		inline Element& init(Element& x, long y) const
+		{
 			x = y % modulus;
 			if ( x < 0 ) x += modulus;
 			return x;
 		}
 
-		inline Element &init (Element & x, const double &y) const {
-		  double z = fmod(y, (double)modulus);
-		  if (z < 0) z += (double)modulus;
-		  //z += 0.5; // C Pernet Sounds nasty and not necessary
-		  return x = static_cast<long>(z); //rounds towards 0
+		inline Element &init (Element & x, const double &y) const
+		{
+			double z = fmod(y, (double)modulus);
+			if (z < 0) z += (double)modulus;
+			//z += 0.5; // C Pernet Sounds nasty and not necessary
+			return x = static_cast<long>(z); //rounds towards 0
 		}
-		
-		inline Element &init (Element &x, const float &y) const  { 
-		  return init (x, (double) y);
+
+		inline Element &init (Element &x, const float &y) const
+		{
+			return init (x, (double) y);
 		}
 
-		inline Element& assign(Element& x, const Element& y) const {
+		inline Element& assign(Element& x, const Element& y) const
+		{
 			return x = y;
 		}
-									
-		
-		inline bool areEqual (const Element &x, const Element &y) const {
+
+
+		inline bool areEqual (const Element &x, const Element &y) const
+		{
 			return x == y;
 		}
 
-		inline  bool isZero (const Element &x) const {
-			return x == 0; 
+		inline  bool isZero (const Element &x) const
+		{
+			return x == 0;
 		}
-		
-		inline bool isOne (const Element &x) const {
-			return x == 1; 
+
+		inline bool isOne (const Element &x) const
+		{
+			return x == 1;
 		}
 
-		inline Element &add (Element &x, const Element &y, const Element &z) const {
+		inline Element &add (Element &x, const Element &y, const Element &z) const
+		{
 			x = y + z;
-			if ( (uint16)x >= (uint16)modulus ) x =( (uint16)x )- modulus;
+			if ( (uint16_t)x >= (uint16_t)modulus )
+				x = (Element) (( (uint16_t)x )- modulus);
 			return x;
 		}
- 
-		inline Element &sub (Element &x, const Element &y, const Element &z) const {
+
+		inline Element &sub (Element &x, const Element &y, const Element &z) const
+		{
 			x = y - z;
-			if (x < 0) x += modulus;
+			if (x < 0)
+				x += modulus;
 			return x;
 		}
-		
-		inline Element &mul (Element &x, const Element &y, const Element &z) const {
-			int16 q;
 
-			double ab=((double) y)* ((double) z);		
-			q  = (int16)(ab*modulusinv);  // q could be off by (+/-) 1
-			x = (int16) (ab - ((double) q )* ((double) modulus));
-			
-			
+		inline Element &mul (Element &x, const Element &y, const Element &z) const
+		{
+			Element q;
+
+			double ab=((double) y)* ((double) z);
+			q  = (Element)(ab*modulusinv);  // q could be off by (+/-) 1
+			x = (Element) (ab - ((double) q )* ((double) modulus));
+
+
 			if (x >= modulus)
 				x -= modulus;
 			else if (x < 0)
@@ -211,41 +288,49 @@ namespace LinBox
 
 			return x;
 		}
- 
-		inline Element &div (Element &x, const Element &y, const Element &z) const {
+
+		inline Element &div (Element &x, const Element &y, const Element &z) const
+		{
 			Element temp;
 			inv (temp, z);
 			return mul (x, y, temp);
 		}
- 
-		inline Element &neg (Element &x, const Element &y) const {
-			if(y==0) return x=0;
-			else return x=modulus-y;
+
+		inline Element &neg (Element &x, const Element &y) const
+		{
+			if(y==0)
+				return x=0;
+			else
+				return x= modulus-y;
 		}
- 
-		inline Element &inv (Element &x, const Element &y) const {
-			int16 d, t;			
+
+		inline Element &inv (Element &x, const Element &y) const
+		{
+			Element d, t;
 			XGCD(d, x, t, y, modulus);
+#ifdef DEBUG
 			if (d != 1)
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"InvMod: inverse undefined");
+				throw PreconditionFailed(__func__,__FILE__,__LINE__,"InvMod: inverse undefined");
+#endif
 			if (x < 0)
 				return x += modulus;
 			else
 				return x;
-							      
+
 		}
 
-		inline Element &axpy (Element &r, 
-				      const Element &a, 
-				      const Element &x, 
-				      const Element &y) const {
-			int16 q;
+		inline Element &axpy (Element &r,
+				      const Element &a,
+				      const Element &x,
+				      const Element &y) const
+		{
+			Element q;
+
+			double ab=((double) a)* ((double) x) + ( double ) y;
+			q  = (Element)(ab*modulusinv);  // q could be off by (+/-) 1
+			r = (Element) (ab - ((double) q )* ((double) modulus));
+
 
-			double ab=((double) a)* ((double) x) + ( double ) y;		
-			q  = (int16)(ab*modulusinv);  // q could be off by (+/-) 1
-			r = (int16) (ab - ((double) q )* ((double) modulus));
-			
-			
 			if (r >= modulus)
 				r -= modulus;
 			else if (r < 0)
@@ -255,44 +340,52 @@ namespace LinBox
 
 		}
 
-		inline Element &addin (Element &x, const Element &y) const {
+		inline Element &addin (Element &x, const Element &y) const
+		{
 			x += y;
-			if ( ((uint16) x) >= (uint16)modulus ) x = ((uint16) x)-modulus;
+			if ( ((uint16_t) x) >= (uint16_t)modulus )
+				x = Element( ((uint16_t) x)-modulus );
 			return x;
 		}
- 
-		inline Element &subin (Element &x, const Element &y) const {
+
+		inline Element &subin (Element &x, const Element &y) const
+		{
 			x -= y;
 			if (x < 0) x += modulus;
 			return x;
 		}
- 
-		inline Element &mulin (Element &x, const Element &y) const {
+
+		inline Element &mulin (Element &x, const Element &y) const
+		{
 			return mul(x,x,y);
 		}
- 
-		inline Element &divin (Element &x, const Element &y) const {
+
+		inline Element &divin (Element &x, const Element &y) const
+		{
 			return div(x,x,y);
 		}
- 
-		inline Element &negin (Element &x) const {
-			if (x == 0) return x; 
-			else return x = modulus - x; 
+
+		inline Element &negin (Element &x) const
+		{
+			if (x == 0) return x;
+			else return x = modulus - x;
 		}
- 
-		inline Element &invin (Element &x) const {
+
+		inline Element &invin (Element &x) const
+		{
 			return inv (x, x);
 		}
 
-		inline Element &axpyin (Element &r, const Element &a, const Element &x) const {
-			
-			int16 q;
+		inline Element &axpyin (Element &r, const Element &a, const Element &x) const
+		{
+
+			Element q;
+
+			double ab = ((double) a)* ((double) x) + ( double ) r;
+			q  = (Element)(ab*modulusinv);  // q could be off by (+/-) 1
+			r = (Element) (ab - ((double) q )* ((double) modulus));
+
 
-			double ab = ((double) a)* ((double) x) + ( double ) r;		
-			q  = (int16)(ab*modulusinv);  // q could be off by (+/-) 1
-			r = (int16) (ab - ((double) q )* ((double) modulus));
-			
-			
 			if (r >= modulus)
 				r -= modulus;
 			else if (r < 0)
@@ -301,32 +394,42 @@ namespace LinBox
 			return r;
 		}
 
-		static inline int16 getMaxModulus()
-			{ return 32767; } // 2^15 - 1
+		static inline Element getMaxModulus()
+		{
+			return 32767;  // 2^15 - 1
+			// linbox_check(180*181 < INT16_MAX);
+			// return 181 ;
+		}
+
+	private:
 
-		private:
+		static void XGCD(int16_t& d, int16_t& s, int16_t& t, int16_t a, int16_t b)
+		{
+			Element u, v, u0, v0, u1, v1, u2, v2, q, r;
+
+			Element aneg = 0, bneg = 0;
 
-      		static void XGCD(int16& d, int16& s, int16& t, int16 a, int16 b) {
-			int16  u, v, u0, v0, u1, v1, u2, v2, q, r;
-			
-			int16 aneg = 0, bneg = 0;
-			
 			if (a < 0) {
-				if (a < -LINBOX_MAX_INT16) throw PreconditionFailed(__FUNCTION__,__LINE__,"XGCD: integer overflow");
+#ifdef DEBUG
+				if (a < -LINBOX_MAX_INT16) throw PreconditionFailed(__func__,__FILE__,__LINE__,"XGCD: integer overflow");
+#endif
 				a = -a;
 				aneg = 1;
 			}
-			
+
 			if (b < 0) {
-				if (b < -LINBOX_MAX_INT16) throw PreconditionFailed(__FUNCTION__,__LINE__,"XGCD: integer overflow");
+#ifdef DEBUG
+				if (b < -LINBOX_MAX_INT16) throw PreconditionFailed(__func__,__FILE__,__LINE__,"XGCD: integer overflow");
+#endif
 				b = -b;
 				bneg = 1;
 			}
-			
+
 			u1 = 1; v1 = 0;
 			u2 = 0; v2 = 1;
 			u = a; v = b;
-			
+
+
 			while (v != 0) {
 				q = u / v;
 				r = u % v;
@@ -339,297 +442,312 @@ namespace LinBox
 				u1 = u0;
 				v1 = v0;
 			}
-			
+
 			if (aneg)
 				u1 = -u1;
-			
+
 			if (bneg)
 				v1 = -v1;
-			
+
 			d = u;
 			s = u1;
 			t = v1;
 		}
-		
+
 	};
 
 	template <>
-		class FieldAXPY<Modular<int16> > {	  
-		public:
-	  
-		typedef int16 Element;
-		typedef Modular<int16> Field;
-	  
-		FieldAXPY (const Field &F) : _F (F),_y(0) {
+	class FieldAXPY<Modular<int16_t> > {
+	public:
+
+		typedef int16_t Element;
+		typedef Modular<int16_t> Field;
+
+		FieldAXPY (const Field &F) :
+			_F (F),_y(0)
+		{
 		}
 
-		FieldAXPY (const FieldAXPY &faxpy) : _F (faxpy._F), _y (0){}
-	  
-		FieldAXPY<Modular<int16> > &operator = (const FieldAXPY &faxpy) {
-			_F = faxpy._F; 
-			_y = faxpy._y; 
-			return *this; 
+		FieldAXPY (const FieldAXPY &faxpy) :
+			_F (faxpy._F), _y (0)
+		{}
+
+		FieldAXPY<Modular<int16_t> > &operator = (const FieldAXPY &faxpy)
+		{
+			_F = faxpy._F;
+			_y = faxpy._y;
+			return *this;
 		}
-	  
-		inline uint64& mulacc (const Element &a, const Element &x) {
-			uint64 t = ( (uint32) a ) * ( (uint32) x );
-                        return _y+=t;
+
+		inline uint64_t& mulacc (const Element &a, const Element &x)
+		{
+			uint64_t t = ( (uint32_t) a ) * ( (uint32_t) x );
+			return _y+=t;
 		}
 
-                inline uint64& accumulate (const Element &t) {
-			return _y += t;		 
+		inline uint64_t& accumulate (const Element &t)
+		{
+			return _y += t;
 		}
 
-		inline Element& get (Element &y) {
-			y = _y % (uint64) _F.modulus;
+		inline Element& get (Element &y)
+		{
+			y = _y % (uint64_t) _F.modulus;
 			return y;
 		}
 
-		inline FieldAXPY &assign (const Element y) {
-			_y = y; 
+		inline FieldAXPY &assign (const Element y)
+		{
+			_y = y;
 			return *this;
 		}
 
-		inline void reset() {
+		inline void reset()
+		{
 			_y = 0;
 		}
 
-		private:
-	  
+	private:
+
 		Field _F;
-		uint64 _y;
-		uint16 _two_64;
+		uint64_t _y;
+		uint16_t _two_64;
 	};
 
 
 	template <>
-		class DotProductDomain<Modular<int16> > : private virtual VectorDomainBase<Modular<int16> > {
+	class DotProductDomain<Modular<int16_t> > : private virtual VectorDomainBase<Modular<int16_t> > {
 
-		public:	  
-		typedef int16 Element;	  
-		DotProductDomain (const Modular<int16> &F)
-			: VectorDomainBase<Modular<int16> > (F) {
-		}
-	  
-	  
-		protected:
+	public:
+		typedef int16_t Element;
+		DotProductDomain (const Modular<int16_t> &F) :
+			VectorDomainBase<Modular<int16_t> > (F)
+		{ }
+
+
+	protected:
 		template <class Vector1, class Vector2>
-			inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const {
-		  
+		inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
+
 			typename Vector1::const_iterator i;
 			typename Vector2::const_iterator j;
-		  
-			uint64 y = 0;
-			// uint64 t;
-		  
+
+			uint64_t y = 0;
+			// uint64_t t;
+
 			for (i = v1.begin (), j = v2.begin (); i < v1.end (); ++i, ++j) {
-				y  += ( (uint32) *i ) * ( (uint32) *j );
+				y  += ( (uint32_t) *i ) * ( (uint32_t) *j );
 			}
-		       
-			y %= (uint64) _F.modulus;
-		  
+
+			y %= (uint64_t) _F.modulus;
+
 			return res = y;
-			
+
 		}
-	  
+
 		template <class Vector1, class Vector2>
-			inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const {		  
+		inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
 			typename Vector1::first_type::const_iterator i_idx;
 			typename Vector1::second_type::const_iterator i_elt;
-		  
-			uint64 y = 0;
-		  
+
+			uint64_t y = 0;
+
 			for (i_idx = v1.first.begin (), i_elt = v1.second.begin (); i_idx != v1.first.end (); ++i_idx, ++i_elt) {
-				y += ( (uint32) *i_elt ) * ( (uint32) v2[*i_idx] );
+				y += ( (uint32_t) *i_elt ) * ( (uint32_t) v2[*i_idx] );
 			}
-		
-			y %= (uint64) _F.modulus;
-		  
+
+			y %= (uint64_t) _F.modulus;
+
 			return res = y;
 		}
-	  
+
 	};
-	// Specialization of MVProductDomain for int16 modular field	
+	// Specialization of MVProductDomain for int16_t modular field
 
 	template <>
-		class MVProductDomain<Modular<int16> >
-		{
-		public:
-
-			typedef int16 Element;
-
-		protected:
-			template <class Vector1, class Matrix, class Vector2>
-				inline Vector1 &mulColDense
-				(const VectorDomain<Modular<int16> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v) const
-				{
-					return mulColDenseSpecialized
-						(VD, w, A, v, typename VectorTraits<typename Matrix::Column>::VectorCategory ());
-				}
-
-		private:
-			template <class Vector1, class Matrix, class Vector2>
-				Vector1 &mulColDenseSpecialized
-				(const VectorDomain<Modular<int16> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-				 VectorCategories::DenseVectorTag) const;
-			template <class Vector1, class Matrix, class Vector2>
-				Vector1 &mulColDenseSpecialized
-				(const VectorDomain<Modular<int16> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-				 VectorCategories::SparseSequenceVectorTag) const;
-			template <class Vector1, class Matrix, class Vector2>
-				Vector1 &mulColDenseSpecialized
-				(const VectorDomain<Modular<int16> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-				 VectorCategories::SparseAssociativeVectorTag) const;
-			template <class Vector1, class Matrix, class Vector2>
-				Vector1 &mulColDenseSpecialized
-				(const VectorDomain<Modular<int16> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-				 VectorCategories::SparseParallelVectorTag) const;
-
-			mutable std::vector<uint64> _tmp;
-		};
+	class MVProductDomain<Modular<int16_t> >
+	{
+	public:
+
+		typedef int16_t Element;
+
+	protected:
+		template <class Vector1, class Matrix, class Vector2>
+		inline Vector1 &mulColDense
+		(const VectorDomain<Modular<int16_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v) const
+		{
+			return mulColDenseSpecialized
+			(VD, w, A, v, typename VectorTraits<typename Matrix::Column>::VectorCategory ());
+		}
+
+	private:
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColDenseSpecialized
+		(const VectorDomain<Modular<int16_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::DenseVectorTag) const;
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColDenseSpecialized
+		(const VectorDomain<Modular<int16_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::SparseSequenceVectorTag) const;
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColDenseSpecialized
+		(const VectorDomain<Modular<int16_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::SparseAssociativeVectorTag) const;
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColDenseSpecialized
+		(const VectorDomain<Modular<int16_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::SparseParallelVectorTag) const;
+
+		mutable std::vector<uint64_t> _tmp;
+	};
 
 	template <class Vector1, class Matrix, class Vector2>
-		Vector1 &MVProductDomain<Modular<int16> >::mulColDenseSpecialized
-		(const VectorDomain<Modular<int16> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-		 VectorCategories::DenseVectorTag) const {
-		
+	Vector1 &MVProductDomain<Modular<int16_t> >::mulColDenseSpecialized
+	(const VectorDomain<Modular<int16_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+	 VectorCategories::DenseVectorTag) const
+	{
+
 		linbox_check (A.coldim () == v.size ());
 		linbox_check (A.rowdim () == w.size ());
-		
+
 		typename Matrix::ConstColIterator i = A.colBegin ();
 		typename Vector2::const_iterator j;
 		typename Matrix::Column::const_iterator k;
-		std::vector<uint64>::iterator l;
+		std::vector<uint64_t>::iterator l;
 
-		uint64 t;
+		uint64_t t;
 
 		if (_tmp.size () < w.size ())
 			_tmp.resize (w.size ());
-		
+
 		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
-		
+
 		for (j = v.begin (); j != v.end (); ++j, ++i) {
 			for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
-				t = ((uint32) *k) * ((uint32) *j);
+				t = ((uint32_t) *k) * ((uint32_t) *j);
 
 				*l += t;
-				
+
 			}
 		}
-		
+
 		typename Vector1::iterator w_j;
-		
+
 		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
 			*w_j = *l % VD.field ().modulus;
-		
+
 		return w;
 	}
-	
+
 	template <class Vector1, class Matrix, class Vector2>
-		Vector1 &MVProductDomain<Modular<int16> >::mulColDenseSpecialized
-		(const VectorDomain<Modular<int16> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-		 VectorCategories::SparseSequenceVectorTag) const
-		{
-			linbox_check (A.coldim () == v.size ());
-			linbox_check (A.rowdim () == w.size ());
-			
-			typename Matrix::ConstColIterator i = A.colBegin ();
-			typename Vector2::const_iterator j;
-			typename Matrix::Column::const_iterator k;
-			std::vector<uint64>::iterator l;
-			
-			uint64 t;
-			
-			if (_tmp.size () < w.size ())
-				_tmp.resize (w.size ());
-			
-			std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
-			
-			for (j = v.begin (); j != v.end (); ++j, ++i) {
-				for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
-					t = ((uint32) k->second) * ((uint32) *j);
-
-					_tmp[k->first] += t;
-					
-				}
+	Vector1 &MVProductDomain<Modular<int16_t> >::mulColDenseSpecialized
+	(const VectorDomain<Modular<int16_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+	 VectorCategories::SparseSequenceVectorTag) const
+	{
+		linbox_check (A.coldim () == v.size ());
+		linbox_check (A.rowdim () == w.size ());
+
+		typename Matrix::ConstColIterator i = A.colBegin ();
+		typename Vector2::const_iterator j;
+		typename Matrix::Column::const_iterator k;
+		std::vector<uint64_t>::iterator l;
+
+		uint64_t t;
+
+		if (_tmp.size () < w.size ())
+			_tmp.resize (w.size ());
+
+		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
+
+		for (j = v.begin (); j != v.end (); ++j, ++i) {
+			for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
+				t = ((uint32_t) k->second) * ((uint32_t) *j);
+
+				_tmp[k->first] += t;
+
 			}
-			
-			typename Vector1::iterator w_j;
-			
-			for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
-				*w_j = *l % VD.field ().modulus;
-			
-			return w;
-		}
-	
+		}
+
+		typename Vector1::iterator w_j;
+
+		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
+			*w_j = *l % VD.field ().modulus;
+
+		return w;
+	}
+
 	template <class Vector1, class Matrix, class Vector2>
-		Vector1 &MVProductDomain<Modular<int16> >::mulColDenseSpecialized
-		(const VectorDomain<Modular<int16> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-		 VectorCategories::SparseAssociativeVectorTag) const {
+	Vector1 &MVProductDomain<Modular<int16_t> >::mulColDenseSpecialized
+	(const VectorDomain<Modular<int16_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+	 VectorCategories::SparseAssociativeVectorTag) const
+	{
 
 		linbox_check (A.coldim () == v.size ());
 		linbox_check (A.rowdim () == w.size ());
-		
+
 		typename Matrix::ConstColIterator i = A.colBegin ();
 		typename Vector2::const_iterator j;
 		typename Matrix::Column::const_iterator k;
-		std::vector<uint64>::iterator l;
-		
-		uint64 t;
-		
+		std::vector<uint64_t>::iterator l;
+
+		uint64_t t;
+
 		if (_tmp.size () < w.size ())
 			_tmp.resize (w.size ());
-		
+
 		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
-		
+
 		for (j = v.begin (); j != v.end (); ++j, ++i) {
 			for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
-				t = ((uint32) k->second) * ((uint32) *j);
-				
+				t = ((uint32_t) k->second) * ((uint32_t) *j);
+
 				_tmp[k->first] += t;
-				
+
 			}
 		}
-		
+
 		typename Vector1::iterator w_j;
-		
+
 		for (w_j = w.begin (), l = _tmp.begin (); w_j != w.end (); ++w_j, ++l)
 			*w_j = *l % VD.field ().modulus;
-		
+
 		return w;
 	}
 
 	template <class Vector1, class Matrix, class Vector2>
-		Vector1 &MVProductDomain<Modular<int16> >::mulColDenseSpecialized
-		(const VectorDomain<Modular<int16> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-		 VectorCategories::SparseParallelVectorTag) const {
-		
+	Vector1 &MVProductDomain<Modular<int16_t> >::mulColDenseSpecialized
+	(const VectorDomain<Modular<int16_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+	 VectorCategories::SparseParallelVectorTag) const
+	{
+
 		linbox_check (A.coldim () == v.size ());
 		linbox_check (A.rowdim () == w.size ());
-		
+
 		typename Matrix::ConstColIterator i = A.colBegin ();
 		typename Vector2::const_iterator j;
 		typename Matrix::Column::first_type::const_iterator k_idx;
 		typename Matrix::Column::second_type::const_iterator k_elt;
-		std::vector<uint64>::iterator l;
-		
-		uint64 t;
-		
+		std::vector<uint64_t>::iterator l;
+
+		uint64_t t;
+
 		if (_tmp.size () < w.size ())
 			_tmp.resize (w.size ());
-		
+
 		std::fill (_tmp.begin (), _tmp.begin () + w.size (), 0);
-		
+
 		for (j = v.begin (); j != v.end (); ++j, ++i) {
 			for (k_idx = i->first.begin (), k_elt = i->second.begin (), l = _tmp.begin ();
 			     k_idx != i->first.end ();
 			     ++k_idx, ++k_elt, ++l)
-				{
-					t = ((uint32) *k_elt) * ((uint32) *j);
+			{
+				t = ((uint32_t) *k_elt) * ((uint32_t) *j);
 
-					_tmp[*k_idx] += t;
+				_tmp[*k_idx] += t;
 
-				}
+			}
 		}
 
 		typename Vector1::iterator w_j;
@@ -639,9 +757,14 @@ namespace LinBox
 
 		return w;
 	}
-  	  
 
-} 
 
-#include "linbox/randiter/modular.h"
+}
+
+#ifdef __ICC
+#pragma warning(enable:2259)
 #endif
+
+#include "linbox/randiter/modular.h"
+#endif //__LINBOX_modular_short_H
+
diff --git a/linbox/field/modular.doxy b/linbox/field/modular.doxy
new file mode 100644
index 0000000..063b601
--- /dev/null
+++ b/linbox/field/modular.doxy
@@ -0,0 +1,14 @@
+// Copyright (C) 2010 Brice Boyer, part of LinBox, GNU LGPL, see COPYING
+
+/*! @ingroup field
+  @defgroup modular Modular
+
+  @brief Modular Field is a representation of \f$\mathbf{Z}/p\mathbf{Z}\f$.
+
+  - Modular
+  - Modular Balanced
+
+ */
+
+// vim:syntax=doxygen
+
diff --git a/linbox/field/modular.h b/linbox/field/modular.h
index b145d41..1745218 100644
--- a/linbox/field/modular.h
+++ b/linbox/field/modular.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* linbox/field/modular.h
  * Copyright (C) 1999-2001 William J Turner,
  *               2001 Bradford Hovinen
@@ -19,8 +20,19 @@
  * See COPYING for license information.
  */
 
-#ifndef __FIELD_MODULAR_H
-#define __FIELD_MODULAR_H
+/*! @file field/modular.h
+ * @ingroup field
+ * @brief A Modular field is a representations of <code>Z/mZ</code>.
+ * This file groups many implementations/specialisations of modular fields.
+ *   - Modular arithmetic is provided in the <code>ModularXXX<T></code> classes.
+ *   - Specialisations for \ref FieldAXPY, \ref MVProductDomain, \ref DotProductDomain.
+ *   - Random Iterators
+ *   .
+ *
+ */
+
+#ifndef __LINBOX_field_modular_H
+#define __LINBOX_field_modular_H
 
 #include <iostream>
 #include <climits>
@@ -37,67 +49,74 @@
 
 
 // Namespace in which all LinBox code resides
-namespace LinBox 
-{ 
+namespace LinBox
+{
 	template <class Element>
 	class Modular;
 
 	template <class Ring>
-	struct ClassifyRing; 
+	struct ClassifyRing;
 
 	template <class Element>
-	struct ClassifyRing<Modular<Element> >{
+	struct ClassifyRing<Modular<Element> >
+	{
 		typedef RingCategories::ModularTag categoryTag;
 	};
 
-	/** @name ModularBase 
-	 * \brief Base for prime fields where the elements are represented by various primitive types 
-	 * (and their operations).
-	 * Normally use it's children.  This class is of interest for the developer of a new field representation.
+	/** * <!-- @name ModularBase-->
+	 * \brief Base for prime fields where the elements are represented by various primitive types (and their operations).
+	 * \ingroup field
+	 * \defgroup Fields Fields <!--for old \ref Fields...-->
+	 *
 	 *
-	 * 
-	 * This parameterized field can be used to construct any prime
-	 * field. Typical use would be Modular<integer> for integers modulo a
-	 * large prime, Modular<long, long long> for integers modulo a wordsize
+	 * Normally use it's children.  This class is of interest for the
+	 * developer of a new field representation.
+	 *
+	 *
+	 * This parameterized field can be used to construct any prime field.
+	 * Typical use would be Modular<integer> for integers modulo a large
+	 * prime, Modular<long> Modular<long long> for integers modulo a wordsize
 	 * prime, etc. for integers modulo a half-wordsize prime.
-	\ingroup field
 	 */
 	template <class _Element>
-	class ModularBase 
-	{
-	    public:
+	class ModularBase {
+	public:
 
 		/*- Element type
-		 */
+		*/
 		typedef _Element Element;
 
 		/*- Random iterator generator type.
 		 * It must meet the common object interface of random element generators
 		 * as given in the the archetype RandIterArchetype.
 		 */
-	        class RandIter;
+		class RandIter;
 
 		/*- @name Object Management
-		 */
+		*/
 		//@{
- 
+
 		/*- Default constructor.
-		 */
+		*/
 		ModularBase (void) {}
 
 		/*- Constructor from an element type.
-		 * Sets the modulus of the field throug the static member of the 
+		 * Sets the modulus of the field throug the static member of the
 		 * element type.
 		 * @param modulus constant reference to integer prime modulus
 		 */
-		ModularBase (unsigned long modulus) : _modulus (modulus) {}
+		ModularBase (unsigned long modulus) :
+			_modulus ((Element)modulus)
+		{}
 
 		/*- Constructor from an integer.
-		 * Sets the modulus of the field throug the static member of the 
+		 * Sets the modulus of the field throug the static member of the
 		 * element type.
 		 * @param modulus constant reference to integer prime modulus
 		 */
-		ModularBase (const integer &modulus) : _modulus (modulus) {}
+		ModularBase (const integer &modulus) :
+			_modulus ((Element) modulus)
+		{}
 
 		/*- Copy constructor.
 		 * Constructs Modular object by copying the field.
@@ -105,8 +124,10 @@ namespace LinBox
 		 * into functions.
 		 * @param  F Modular object.
 		 */
-		ModularBase (const ModularBase<Element> &F) : _modulus (F._modulus) {}
- 
+		ModularBase (const ModularBase<Element> &F) :
+			_modulus (F._modulus)
+		{}
+
 		/*- Conversion of field base element to a template class T.
 		 * This function assumes the output field base element x has already been
 		 * constructed, but that it is not already initialized.
@@ -115,14 +136,20 @@ namespace LinBox
 		 * @param y constant field base element.
 		 */
 		integer &convert (integer &x, const Element &y) const
-		{ return x = y; }
+		{
+			return x = y;
+		}
 
 		double &convert (double& x, const Element &y) const
-		{return  x= (double) y;}
- 
+		{
+			return  x= (double) y;
+		}
+
 		float &convert (float& x, const Element &y) const
-		{return  x= (float) y;}
-	
+		{
+			return  x= (float) y;
+		}
+
 		/*- Assignment of one field base element to another.
 		 * This function assumes both field base elements have already been
 		 * constructed and initialized.
@@ -130,7 +157,10 @@ namespace LinBox
 		 * @param  x field base element (reference returned).
 		 * @param  y field base element.
 		 */
-		Element &assign (Element &x, const Element &y) const { return x = y; }
+		Element &assign (Element &x, const Element &y) const
+		{
+			return x = y;
+		}
 
 		/*- Cardinality.
 		 * Return integer representing cardinality of the domain.
@@ -140,7 +170,14 @@ namespace LinBox
 		 * @return integer representing cardinality of the domain
 		 */
 		integer &cardinality (integer &c) const
-			{ return c = _modulus; }
+		{
+			return c = _modulus;
+		}
+
+		integer cardinality () const
+		{
+			return  _modulus;
+		}
 
 		/*- Characteristic.
 		 * Return integer representing characteristic of the domain.
@@ -149,7 +186,20 @@ namespace LinBox
 		 * @return integer representing characteristic of the domain.
 		 */
 		integer &characteristic (integer &c) const
-			{ return c = _modulus; }
+		{
+			return c = _modulus;
+		}
+
+		unsigned long &characteristic (unsigned long &c) const
+		{
+			return c = _modulus;
+		}
+
+
+		integer characteristic () const
+		{
+			return  _modulus;
+		}
 
 		//@} Object Management
 
@@ -169,7 +219,9 @@ namespace LinBox
 		 * @param  y field base element
 		 */
 		bool areEqual (const Element &x, const Element &y) const
-			{ return x == y; }
+		{
+			return x == y;
+		}
 
 		/*- Zero equality.
 		 * Test if field base element is equal to zero.
@@ -179,8 +231,10 @@ namespace LinBox
 		 * @param  x field base element.
 		 */
 		bool isZero (const Element &x) const
-			{ return x == 0; }
- 
+		{
+			return x == 0;
+		}
+
 		/*- One equality.
 		 * Test if field base element is equal to one.
 		 * This function assumes the field base element has already been
@@ -189,7 +243,9 @@ namespace LinBox
 		 * @param  x field base element.
 		 */
 		bool isOne (const Element &x) const
-			{ return x == 1; }
+		{
+			return x == 1;
+		}
 
 
 		//@} Arithmetic Operations
@@ -201,14 +257,18 @@ namespace LinBox
 		 * @return output stream to which field is written.
 		 * @param  os  output stream to which field is written.
 		 */
-		std::ostream &write (std::ostream &os) const 
-			{ return os << "Modular field, mod " << _modulus; }
+		std::ostream &write (std::ostream &os) const
+		{
+			return os << "Modular field, mod " << _modulus;
+		}
 
 		/*- Read field.
 		 * @return input stream from which field is read.
 		 * @param  is  input stream from which field is read.
 		 */
-		std::istream &read (std::istream &is) { return is >> _modulus; }
+		std::istream &read (std::istream &is) {
+			return is >> _modulus;
+		}
 
 
 		/*- Print field base element.
@@ -219,8 +279,10 @@ namespace LinBox
 		 * @param  x   field base element.
 		 */
 		std::ostream &write (std::ostream &os, const Element &x) const
-			{ return os << (int) x; }
- 
+		{
+			return os << (int) x;
+		}
+
 
 		/*- Read field base element.
 		 * This function assumes the field base element has already been
@@ -238,12 +300,12 @@ namespace LinBox
 			x = abs (tmp) % integer (_modulus);
 			if (tmp < 0) x = _modulus - x;
 
-			return is; 
+			return is;
 		}
 
 		//@}
 
-	    protected:
+	protected:
 
 		/// Private (non-static) element for modulus
 		Element _modulus;
@@ -263,43 +325,50 @@ namespace LinBox
 	 */
 
 	/** @brief Prime fields of positive characteristic implemented directly in LinBox.
-	 * 
-	 * This parameterized field can be used to construct prime
-	 * fields. Typical use would be Modular<integer> for integers modulo a
-	 * large prime, Modular<uint32>, modular<int>, or modular<double>
-	 for integers modulo a wordsize * prime.  Each of those has specialized performance features
-	 suitable to certain applications.
+	 *
+	 * This parameterized field can be used to construct prime fields.
+	 * Typical use would be Modular<integer> for integers modulo a large
+	 * prime, Modular<uint32_t>, Modular<int32_t>, or Modular<double> for
+	 * integers modulo a wordsize prime.  Each of those has specialized
+	 * performance features suitable to certain applications.
 	 */
 	template <class _Element>
-	class Modular : public ModularBase<_Element>
-	{
-	    public:
+	class Modular : public ModularBase<_Element> {
+	public:
 		typedef _Element Element;
 		typedef typename ModularBase<_Element>::RandIter RandIter;
+		const Element zero,one;
+		Element mone;
 
 		/*- @name Object Management
-		 * @brief see \ref{FieldArchetype} for member specs.
+		 * @brief see \ref FieldArchetype  for member specs.
 		 */
 		//@{
- 
+
 		//private:
 		/*- Default constructor.
-		 */
-		Modular () {}
+		*/
+		Modular () :
+			zero(0),one(1)
+		{}
 
 		/*- Constructor from an element type
-		 * Sets the modulus of the field throug the static member of the 
+		 * Sets the modulus of the field throug the static member of the
 		 * element type.
 		 * @param modulus constant reference to integer prime modulus
 		 */
-		Modular (unsigned long modulus) : ModularBase<_Element> (modulus) {}
+		Modular (unsigned long modulus) :
+			ModularBase<_Element> (modulus),zero(0),one(1)
+		{}
 
 		/*- Constructor from an integer
-		 * Sets the modulus of the field throug the static member of the 
+		 * Sets the modulus of the field throug the static member of the
 		 * element type.
 		 * @param modulus constant reference to integer prime modulus
 		 */
-		Modular (const integer &modulus) : ModularBase<_Element> (modulus) {}
+		Modular (const integer &modulus) :
+			ModularBase<_Element> (modulus),zero(0),one(1)
+		{}
 
 		/* Assignment operator
 		 * Required by the archetype
@@ -307,12 +376,18 @@ namespace LinBox
 		 * @param F constant reference to Modular object
 		 * @return reference to Modular object for self
 		 */
-		const Modular &operator=(const Modular &F) 
+		const Modular &operator=(const Modular &F)
 		{
 			ModularBase<Element>::_modulus = F._modulus;
 			return *this;
 		}
-		public:
+	public:
+
+		static inline Element getMaxModulus()
+		{
+			return Element((1ULL<<(sizeof(Element)*8-1))-1);
+		}
+
 
 		/*- Initialization of field base element from an integer.
 		 * Behaves like C++ allocator construct.
@@ -325,17 +400,31 @@ namespace LinBox
 		 * @param y integer.
 		 */
 		Element &init (Element &x, const integer &y = 0) const
-		{ 
-		  x = y % ModularBase<Element>::_modulus;
-		  if (x < 0) x += ModularBase<Element>::_modulus;
-		  return x;
+		{
+			x = y % ModularBase<Element>::_modulus;
+			if (x < 0) x += ModularBase<Element>::_modulus;
+			return x;
+		}
+
+		Element &init (Element &x, const size_t &y = 0) const
+		{
+			x = (Element) y % ModularBase<Element>::_modulus;
+			if (x < 0) x += ModularBase<Element>::_modulus;
+			return x;
 		}
 
 		Element &init (Element &x, const int y ) const
-		{ 
-		  x = y % ModularBase<Element>::_modulus;
-		  if (x < 0) x += ModularBase<Element>::_modulus;
-		  return x;
+		{
+			x = y % ModularBase<Element>::_modulus;
+			if (x < 0) x += ModularBase<Element>::_modulus;
+			return x;
+		}
+
+		Element &init (Element &x, const long int y ) const
+		{
+			x = y % ModularBase<Element>::_modulus;
+			if (x < 0) x += ModularBase<Element>::_modulus;
+			return x;
 		}
 
 		/*- Initialization of field base element from a double.
@@ -349,22 +438,22 @@ namespace LinBox
 		 * @param y integer.
 		 */
 		Element &init (Element &x, const double &y) const
-		{ 
+		{
 			double z = fmod(y, (double)ModularBase<Element>::_modulus);
-		  if (z < 0) z += (double) ModularBase<Element>::_modulus;
-		  return x = (Element) (z+.5);
+			if (z < 0) z += (double) ModularBase<Element>::_modulus;
+			return x = (Element) (z+.5);
 		}
 
 		Element &init (Element &x, const float &y) const
-		{ 
+		{
 			float z = fmod(y, (float)ModularBase<Element>::_modulus);
-		  if (z < 0) z += (float) ModularBase<Element>::_modulus;
-		  return x = (Element) (z+.5);
+			if (z < 0) z += (float) ModularBase<Element>::_modulus;
+			return x = (Element) (z+.5);
 		}
 
-		//@}  
+		//@}
 		/*- @name Arithmetic Operations
-		 * @brief see \ref{FieldArchetype} for member specs.
+		 * @brief see \ref FieldArchetype  for member specs.
 		 * x <- y op z; x <- op y
 		 * These operations require all elements, including x, to be initialized
 		 * before the operation is called.  Uninitialized field base elements will
@@ -387,7 +476,7 @@ namespace LinBox
 			if (x >= ModularBase<Element>::_modulus) x -= ModularBase<Element>::_modulus;
 			return x;
 		}
- 
+
 		/* Subtraction.
 		 * x = y - z
 		 * This function assumes all the field base elements have already been
@@ -398,12 +487,12 @@ namespace LinBox
 		 * @param  z field base element.
 		 */
 		Element &sub (Element &x, const Element &y, const Element &z) const
-		{ 
+		{
 			x = y - z;
 			if (x < 0) x += ModularBase<Element>::_modulus;
 			return x;
 		}
- 
+
 		/* Multiplication.
 		 * x = y * z
 		 * This function assumes all the field base elements have already been
@@ -414,8 +503,10 @@ namespace LinBox
 		 * @param  z field base element.
 		 */
 		Element &mul (Element &x, const Element &y, const Element &z) const
-			{ return x = (y * z) % ModularBase<Element>::_modulus; }
- 
+		{
+			return x = (y * z) % ModularBase<Element>::_modulus;
+		}
+
 		/* Division.
 		 * x = y / z
 		 * This function assumes all the field base elements have already been
@@ -426,12 +517,12 @@ namespace LinBox
 		 * @param  z field base element.
 		 */
 		Element &div (Element &x, const Element &y, const Element &z) const
-		{ 
+		{
 			Element temp;
 			inv (temp, z);
 			return mul (x, y, temp);
 		}
- 
+
 		/* Additive Inverse (Negation).
 		 * x = - y
 		 * This function assumes both field base elements have already been
@@ -441,8 +532,13 @@ namespace LinBox
 		 * @param  y field base element.
 		 */
 		Element &neg (Element &x, const Element &y) const
-			{ if (y == 0) return x = y; else return x = ModularBase<Element>::_modulus - y; }
- 
+		{
+			if (y == 0)
+				return x = y;
+			else
+				return x = ModularBase<Element>::_modulus - y;
+		}
+
 		/* Multiplicative Inverse.
 		 * x = 1 / y
 		 * This function assumes both field base elements have already been
@@ -455,9 +551,9 @@ namespace LinBox
 		{
 			// The extended Euclidean algoritm
 			Element x_int, y_int, q, tx, ty, temp;
-			x_int = ModularBase<Element>::_modulus; 
+			x_int = ModularBase<Element>::_modulus;
 			y_int = y;
-			tx = 0; 
+			tx = 0;
 			ty = 1;
 
 			while (y_int != 0) {
@@ -478,7 +574,7 @@ namespace LinBox
 
 		/* Natural AXPY.
 		 * r  = a * x + y
-		 * This function assumes all field elements have already been 
+		 * This function assumes all field elements have already been
 		 * constructed and initialized.
 		 * @return reference to r.
 		 * @param  r field element (reference returned).
@@ -486,20 +582,20 @@ namespace LinBox
 		 * @param  x field element.
 		 * @param  y field element.
 		 */
-		Element &axpy (Element &r, 
-			      const Element &a, 
-			      const Element &x, 
-			      const Element &y) const
-		{ 
+		Element &axpy (Element &r,
+			       const Element &a,
+			       const Element &x,
+			       const Element &y) const
+		{
 			r = (a * x + y) % ModularBase<Element>::_modulus;
 			if (r < 0) r += ModularBase<Element>::_modulus;
 			return r;
 		}
 
 		//@} Arithmetic Operations
- 
+
 		/*- @name Inplace Arithmetic Operations
-		 * @brief see \ref{FieldArchetype} for member specs.
+		 * @brief see \ref FieldArchetype  for member specs.
 		 * x <- x op y; x <- op x
 		 */
 		//@{
@@ -513,12 +609,12 @@ namespace LinBox
 		 * @param  y field base element.
 		 */
 		Element &addin (Element &x, const Element &y) const
-		{ 
+		{
 			x += y;
 			if (x >= ModularBase<Element>::_modulus) x -= ModularBase<Element>::_modulus;
 			return x;
 		}
- 
+
 		/* Inplace Subtraction.
 		 * x -= y
 		 * This function assumes both field base elements have already been
@@ -533,7 +629,7 @@ namespace LinBox
 			if (x < 0) x += ModularBase<Element>::_modulus;
 			return x;
 		}
- 
+
 		/* Inplace Multiplication.
 		 * x *= y
 		 * This function assumes both field base elements have already been
@@ -548,7 +644,7 @@ namespace LinBox
 			x %= ModularBase<Element>::_modulus;
 			return x;
 		}
- 
+
 		/* Inplace Division.
 		 * x /= y
 		 * This function assumes both field base elements have already been
@@ -563,7 +659,7 @@ namespace LinBox
 			inv (temp, y);
 			return mulin (x, temp);
 		}
- 
+
 		/* Inplace Additive Inverse (Inplace Negation).
 		 * x = - x
 		 * This function assumes the field base element has already been
@@ -572,8 +668,13 @@ namespace LinBox
 		 * @param  x field base element (reference returned).
 		 */
 		Element &negin (Element &x) const
-			{ if (x == 0) return x; else return x = ModularBase<Element>::_modulus - x; }
- 
+		{
+			if (x == 0)
+				return x;
+			else
+				return x = ModularBase<Element>::_modulus - x;
+		}
+
 		/* Inplace Multiplicative Inverse.
 		 * x = 1 / x
 		 * This function assumes the field base elementhas already been
@@ -582,11 +683,13 @@ namespace LinBox
 		 * @param  x field base element (reference returned).
 		 */
 		Element &invin (Element &x) const
-			{ return inv (x, x); }
+		{
+			return inv (x, x);
+		}
 
 		/* Inplace AXPY.
 		 * r  += a * x
-		 * This function assumes all field elements have already been 
+		 * This function assumes all field elements have already been
 		 * constructed and initialized.
 		 * Purely virtual
 		 * @return reference to r.
@@ -595,7 +698,7 @@ namespace LinBox
 		 * @param  x field element.
 		 */
 		Element &axpyin (Element &r, const Element &a, const Element &x) const
-		{ 
+		{
 			r = (r + a * x) % ModularBase<Element>::_modulus;
 			if (r < 0) r += ModularBase<Element>::_modulus;
 			return r;
@@ -603,90 +706,114 @@ namespace LinBox
 
 		//@} Inplace Arithmetic Operations
 
-	    private:
+	private:
 
 		friend class FieldAXPY<Modular<Element> >;
 
 	}; // class Modular
 
-	/** @brief Allows compact storage when the modulus is less than 2^8. 
-	
-	Requires 1 < the modulus < 2^8, normally prime.
-	See FieldArchetype for member specifications.
-	*/
+	/** @brief Allows compact storage when the modulus is less than 2^8.
+	 *
+	 *  Requires <code>1 < modulus < 2^8</code>, normally prime.  See \ref
+	 *  FieldArchetype for member specifications.
+	 */
 	template <>
-	class Modular<uint8> : public FieldInterface, public ModularBase<uint8>
-	{
-	    public:
-
-		typedef uint8 Element;
-
-		Modular () : _k (0) {}
-		Modular (uint32 modulus)
-			: ModularBase<uint8> (modulus),
-			  _k (((uint64) -1LL) / ((modulus - 1) * (modulus - 1))),
-			  _pinv (1.0 / (double) ((uint8) modulus)) {}
-		Modular (const integer &modulus)
-			: ModularBase<uint8> ((long) modulus),
-			  _k (((uint64) -1LL) / (((uint8)modulus - 1) * ((uint8)modulus - 1))),
-			  _pinv (1.0 / (double) ((uint8) modulus)) {}
+	class Modular<uint8_t> : public FieldInterface, public ModularBase<uint8_t> {
+	public:
+		typedef uint8_t Element;
+		const Element zero,one;
+		Element mone;
+
+		Modular () :
+			zero(0),one(1),_k (0)
+		{}
+		Modular (uint32_t modulus) :
+			ModularBase<Element> (modulus),
+			zero(0),one(1),mone((Element)(modulus-1)),
+			_k (((uint64_t) -1LL) / ((modulus - 1) * (modulus - 1))),
+			_pinv (1.0 / (double) ((Element) modulus))
+		{
+			linbox_check(modulus < UINT8_MAX);
+		}
+		Modular (const integer &modulus) :
+			ModularBase<Element> ((long) modulus),
+			zero(0),one(1),mone(modulus-1),
+			_k (((uint64_t) -1LL) / (((Element)modulus - 1) * ((Element)modulus - 1))),
+			_pinv (1.0 / (double) ((Element) modulus))
+		{
+			linbox_check(modulus < UINT8_MAX);
+		}
 
-		const Modular &operator=(const Modular &F) 
+		const Modular &operator=(const Modular &F)
 		{
-			ModularBase<uint8>::_modulus = F._modulus;
+			ModularBase<Element>::_modulus = F._modulus;
 			_k = F._k;
 			_pinv = F._pinv;
+			mone = F.mone;
 			return *this;
 		}
 
 		Element &init (Element &x, const integer &y = 0) const
 		{
-			x = (unsigned short) (abs (y) % integer (ModularBase<Element>::_modulus));
-			if (y < 0) x = ModularBase<Element>::_modulus - x;
+			x = (Element) (abs (y) % integer (ModularBase<Element>::_modulus));
+			if (y < 0)
+				x = Element(ModularBase<Element>::_modulus - x);
 			return x;
 		}
 
 		Element &init (Element &x, const double &y) const
-		{ 
+		{
 			double z = fmod(y, (double)_modulus);
 			if (z < 0) z += (double) _modulus;
 			return x = (Element) (z);
 		}
 
+		/*! add elements
+		 * @todo is it faster to use uint32 and multiple casts ?
+		 */
 		Element &add (Element &x, const Element &y, const Element &z) const
 		{
-			uint32 t = (uint32) y + (uint32) z;
-			if (t >= (uint32) ModularBase<Element>::_modulus) t -= ModularBase<Element>::_modulus;
-			return x = t;
+			uint32_t t = (uint32_t) y + (uint32_t) z;
+			if (t >= (uint32_t) ModularBase<Element>::_modulus)
+				t -= ModularBase<Element>::_modulus;
+			return x = (Element)t;
 		}
- 
+
 		Element &sub (Element &x, const Element &y, const Element &z) const
-		{ 
-			int32 t = (int32) y - (int32) z;
-			if (t < 0) t += ModularBase<Element>::_modulus;
-			return x = t;
+		{
+			int32_t t = (int32_t) y - (int32_t) z;
+			if (t < 0)
+				t += ModularBase<Element>::_modulus;
+			return x =  (Element)t;
 		}
- 
+
 		Element &mul (Element &x, const Element &y, const Element &z) const
-			{ return x = ((uint32) y * (uint32) z) % (uint32) ModularBase<Element>::_modulus; }
- 
+		{
+			return x = Element( ((uint32_t) y * (uint32_t) z) % (uint32_t) ModularBase<Element>::_modulus );
+		}
+
 		Element &div (Element &x, const Element &y, const Element &z) const
-		{ 
+		{
 			Element temp;
 			inv (temp, z);
 			return mul (x, y, temp);
 		}
- 
+
 		Element &neg (Element &x, const Element &y) const
-			{ if (y == 0) return x = y; else return x = ModularBase<Element>::_modulus - y; }
- 
+		{
+			if (y == 0)
+				return x = y;
+			else
+				return x = (Element) (ModularBase<Element>::_modulus - y);
+		}
+
 		Element &inv (Element &x, const Element &y) const
 		{
-			// The extended Euclidean algoritm 
-			int32 x_int, y_int, q, tx, ty, temp;
+			// The extended Euclidean algoritm
+			int32_t x_int, y_int, q, tx, ty, temp;
 			x_int = ModularBase<Element>::_modulus;
 			y_int = y;
-			tx = 0; 
+			tx = 0;
 			ty = 1;
 
 			while (y_int != 0) {
@@ -703,91 +830,113 @@ namespace LinBox
 			if (tx < 0) tx += ModularBase<Element>::_modulus;
 
 			// now x_int = gcd (modulus,residue)
-			return x = tx;
+			return x = (Element) tx;
 		}
 
-		Element &axpy (Element &r, 
-			       const Element &a, 
-			       const Element &x, 
+		Element &axpy (Element &r,
+			       const Element &a,
+			       const Element &x,
 			       const Element &y) const
 		{
-			r = ((uint32) a * (uint32) x + (uint32) y) % (uint32) ModularBase<Element>::_modulus;
+			r = Element(((uint32_t) a * (uint32_t) x + (uint32_t) y) % (uint32_t) ModularBase<Element>::_modulus) ;
 			return r;
 		}
 
 		Element &addin (Element &x, const Element &y) const
-		{ 
-			uint32 t = (long) x + (long) y;
-			if (t >= (uint32) ModularBase<Element>::_modulus) t -= ModularBase<Element>::_modulus;
-			return x = t;
+		{
+			uint32_t t = (long) x + (long) y;
+			if (t >= (uint32_t) ModularBase<Element>::_modulus) t -= ModularBase<Element>::_modulus;
+			return x = (Element) t;
 		}
- 
+
+		/*! subin.
+		 * @todo why \c long here ?
+		 */
 		Element &subin (Element &x, const Element &y) const
 		{
 			long t = x - y;
 			if (t < 0) t += ModularBase<Element>::_modulus;
-			return x = t;
+			return x = (Element) t;
 		}
- 
+
 		Element &mulin (Element &x, const Element &y) const
 		{
-			x = ((uint32) x * (uint32) y) % (uint32) ModularBase<Element>::_modulus;
+			x = (Element)( ((uint32_t) x * (uint32_t) y) % (uint32_t) ModularBase<Element>::_modulus );
 			return x;
 		}
- 
+
 		Element &divin (Element &x, const Element &y) const
 		{
 			Element temp;
 			inv (temp, y);
 			return mulin (x, temp);
 		}
- 
+
 		Element &negin (Element &x) const
-			{ if (x == 0) return x; else return x = ModularBase<Element>::_modulus - x; }
- 
+		{
+			if (x == 0)
+				return x;
+			else
+				return x = Element(ModularBase<Element>::_modulus - x);
+		}
+
 		Element &invin (Element &x) const
-			{ return inv (x, x); }
+		{
+			return inv (x, x);
+		}
 
 		Element &axpyin (Element &r, const Element &a, const Element &x) const
-		{ 
-			r = ((uint32) r + (uint32) a * (uint32) x) % (uint32) ModularBase<Element>::_modulus;
+		{
+			r = (Element)( ((uint32_t) r + (uint32_t) a * (uint32_t) x) % (uint32_t) ModularBase<Element>::_modulus);
 			return r;
 		}
 
-	    private:
+	private:
 
-		friend class FieldAXPY<Modular<uint8> >;
-		friend class DotProductDomain<Modular<uint8> >;
-		friend class MVProductDomain<Modular<uint8> >;
+		friend class FieldAXPY<Modular<Element> >;
+		friend class DotProductDomain<Modular<Element> >;
+		friend class MVProductDomain<Modular<Element> >;
 
 		// Number of times one can perform an axpy into a long long
 		// before modding out is mandatory.
-		uint64 _k;
+		uint64_t _k;
 
 		// Inverse of modulus in floating point
 		double _pinv;
 
-	}; // class Modular<uint8>
+	}; // class Modular<uint8_t>
 
-	/** @brief Specialization of class Modular for uint16 element type */
+	/** @brief Specialization of class Modular for uint16_t element type */
 	template <>
-	class Modular<uint16> : public FieldInterface, public ModularBase<uint16>
-	{
-	    public:
+	class Modular<uint16_t> : public FieldInterface, public ModularBase<uint16_t> {
+	public:
+
+		typedef uint16_t Element;
 
-		typedef uint16 Element;
+		const Element zero,one;
+		Element mone;
 
-		Modular () : _k (0) {}
-		Modular (uint32 modulus)
-			: ModularBase<uint16> (modulus),
-			  _k (((uint64) -1LL) / ((ModularBase<Element>::_modulus - 1) * (ModularBase<Element>::_modulus - 1))),
-			  _pinv (1.0 / (double) ((uint16) ModularBase<Element>::_modulus)) {}
-		Modular (const integer &modulus)
-			: ModularBase<uint16> ((long) modulus),
-			  _k (((uint64) -1LL) / ((ModularBase<Element>::_modulus - 1) * (ModularBase<Element>::_modulus - 1))),
-			  _pinv (1.0 / (double) ((uint16) ModularBase<Element>::_modulus)) {}
+		Modular () :
+			zero(0),one(1),_k (0)
+		{}
+		Modular (uint32_t modulus) :
+			ModularBase<Element> (modulus),
+			zero(0),one(1),mone((Element)(modulus-1)),
+			_k (((uint64_t) -1LL) / ((ModularBase<Element>::_modulus - 1) * (ModularBase<Element>::_modulus - 1))),
+			_pinv (1.0 / (double) ((Element) ModularBase<Element>::_modulus))
+		{
+			linbox_check(modulus<UINT16_MAX);
+		}
+		Modular (const integer &modulus) :
+			ModularBase<Element> ((long) modulus),
+			zero(0),one(1),mone(Element(modulus-1)),
+			_k (((uint64_t) -1LL) / ((ModularBase<Element>::_modulus - 1) * (ModularBase<Element>::_modulus - 1))),
+			_pinv (1.0 / (double) ((Element) ModularBase<Element>::_modulus))
+		{
+			linbox_check(modulus<UINT16_MAX);
+		}
 
-		const Modular &operator=(const Modular &F) 
+		const Modular &operator=(const Modular &F)
 		{
 			ModularBase<Element>::_modulus = F._modulus;
 			_k = F._k;
@@ -798,51 +947,61 @@ namespace LinBox
 		Element &init (Element &x, const integer &y = 0) const
 		{
 			x = abs (y) % integer (ModularBase<Element>::_modulus);
-			if (y < 0) x = ModularBase<Element>::_modulus - x;
+			if (y < 0)
+				x = Element(ModularBase<Element>::_modulus - x);
 			return x;
 		}
 
 		Element &init (Element &x, const double &y) const
-		{ 
+		{
 			double z = fmod(y, (double)_modulus);
-			if (z < 0) z += (double) _modulus;
+			if (z < 0)
+				z += (double) _modulus;
 			return x = (Element) (z);
 		}
 
 		Element &add (Element &x, const Element &y, const Element &z) const
 		{
-			uint32 t = (uint32) y + (uint32) z;
-			if (t >= (uint32) ModularBase<Element>::_modulus) t -= ModularBase<Element>::_modulus;
-			return x = t;
+			uint32_t t = (uint32_t) y + (uint32_t) z;
+			if (t >= (uint32_t) ModularBase<Element>::_modulus)
+				t -= ModularBase<Element>::_modulus;
+			return x = (Element) t;
 		}
- 
+
 		Element &sub (Element &x, const Element &y, const Element &z) const
-		{ 
-			int32 t = (int32) y - (int32) z;
+		{
+			int32_t t = (int32_t) y - (int32_t) z;
 			if (t < 0) t += ModularBase<Element>::_modulus;
-			return x = t;
+			return x =  (Element) t;
 		}
- 
+
 		Element &mul (Element &x, const Element &y, const Element &z) const
-			{ return x = ((uint32) y * (uint32) z) % (uint32) ModularBase<Element>::_modulus; }
- 
+		{
+			return x = (Element) ( ((uint32_t) y * (uint32_t) z) % (uint32_t) ModularBase<Element>::_modulus);
+		}
+
 		Element &div (Element &x, const Element &y, const Element &z) const
-		{ 
+		{
 			Element temp;
 			inv (temp, z);
 			return mul (x, y, temp);
 		}
- 
+
 		Element &neg (Element &x, const Element &y) const
-			{ if (y == 0) return x = y; else return x = ModularBase<Element>::_modulus - y; }
- 
+		{
+			if (y == 0)
+				return x = y;
+			else
+				return x = (Element)(  ModularBase<Element>::_modulus - y);
+		}
+
 		Element &inv (Element &x, const Element &y) const
 		{
-			// The extended Euclidean algoritm 
-			int32 x_int, y_int, q, tx, ty, temp;
+			// The extended Euclidean algoritm
+			int32_t x_int, y_int, q, tx, ty, temp;
 			x_int = ModularBase<Element>::_modulus;
 			y_int = y;
-			tx = 0; 
+			tx = 0;
 			ty = 1;
 
 			while (y_int != 0) {
@@ -859,88 +1018,104 @@ namespace LinBox
 			if (tx < 0) tx += ModularBase<Element>::_modulus;
 
 			// now x_int = gcd (modulus,residue)
-			return x = tx;
+			return x = (Element)  tx;
 		}
 
-		Element &axpy (Element &r, 
-			       const Element &a, 
-			       const Element &x, 
+		Element &axpy (Element &r,
+			       const Element &a,
+			       const Element &x,
 			       const Element &y) const
 		{
-			r = ((uint32) a * (uint32) x + (uint32) y) % (uint32) ModularBase<Element>::_modulus;
+			r =  (Element)( ((uint32_t) a * (uint32_t) x + (uint32_t) y) % (uint32_t) ModularBase<Element>::_modulus );
 			return r;
 		}
 
 		Element &addin (Element &x, const Element &y) const
-		{ 
-			uint32 t = (long) x + (long) y;
-			if (t >= (uint32) ModularBase<Element>::_modulus) t -= ModularBase<Element>::_modulus;
-			return x = t;
+		{
+			uint32_t t = (long) x + (long) y;
+			if (t >= (uint32_t) ModularBase<Element>::_modulus) t -= ModularBase<Element>::_modulus;
+			return x = (Element)  t;
 		}
- 
+
 		Element &subin (Element &x, const Element &y) const
 		{
 			long t = x - y;
 			if (t < 0) t += ModularBase<Element>::_modulus;
-			return x = t;
+			return x =  (Element) t;
 		}
- 
+
 		Element &mulin (Element &x, const Element &y) const
 		{
-			x = ((uint32) x * (uint32) y) % (uint32) ModularBase<Element>::_modulus;
+			x =  (Element)( ((uint32_t) x * (uint32_t) y) % (uint32_t) ModularBase<Element>::_modulus);
 			return x;
 		}
- 
+
 		Element &divin (Element &x, const Element &y) const
 		{
 			Element temp;
 			inv (temp, y);
 			return mulin (x, temp);
 		}
- 
+
 		Element &negin (Element &x) const
-			{ if (x == 0) return x; else return x = ModularBase<Element>::_modulus - x; }
- 
+		{
+			if (x == 0)
+				return x;
+			else
+				return x = (Element) ( ModularBase<Element>::_modulus - x);
+		}
+
 		Element &invin (Element &x) const
-			{ return inv (x, x); }
+		{
+			return inv (x, x);
+		}
 
 		Element &axpyin (Element &r, const Element &a, const Element &x) const
-		{ 
-			r = ((uint32) r + (uint32) a * (uint32) x) % (uint32) ModularBase<Element>::_modulus;
+		{
+			r = (Element) ( ((uint32_t) r + (uint32_t) a * (uint32_t) x) % (uint32_t) ModularBase<Element>::_modulus);
 			return r;
 		}
 
-	    private:
+	private:
 
-		friend class FieldAXPY<Modular<uint16> >;
-		friend class DotProductDomain<Modular<uint16> >;
-		friend class MVProductDomain<Modular<uint16> >;
+		friend class FieldAXPY<Modular<Element> >;
+		friend class DotProductDomain<Modular<Element> >;
+		friend class MVProductDomain<Modular<Element> >;
 
 		// Number of times one can perform an axpy into a long long
 		// before modding out is mandatory.
-		uint64 _k;
+		uint64_t _k;
 
 		// Inverse of modulus in floating point
 		double _pinv;
 
-	}; // class Modular<uint16>
+	}; // class Modular<uint16_t>
 
-	/** @brief Specialization of class Modular for uint32 element type */
+	/** @brief Specialization of class Modular for uint32_t element type */
 	template <>
-	class Modular<uint32> : public FieldInterface, public ModularBase<uint32>
-	{
-	    public:
+	class Modular<uint32_t> : public FieldInterface, public ModularBase<uint32_t> {
+	public:
 
-		typedef uint32 Element;
+		typedef uint32_t Element;
 
-		Modular () {}
-		Modular (uint32 modulus)  : ModularBase<uint32> (modulus) { init_two_64 (); }
-		Modular (const integer &modulus) : ModularBase<uint32> (modulus) { init_two_64 (); }
+		const Element zero,one;
+		Element mone;
 
-		const Modular &operator=(const Modular &F) 
+		Modular () :
+			zero(0),one(1)
+		{}
+		Modular (uint32_t modulus)  :
+			ModularBase<uint32_t> (modulus),zero(0),one(1),mone(modulus-1)
+		{ init_two_64 (); }
+		Modular (const integer &modulus) :
+			ModularBase<uint32_t> (modulus),zero(0),one(1),mone(modulus-1)
+		{ init_two_64 (); }
+
+		const Modular &operator=(const Modular &F)
 		{
 			ModularBase<Element>::_modulus = F._modulus;
 			_two_64 = F._two_64;
+			mone = F.mone;
 			return *this;
 		}
 
@@ -952,7 +1127,7 @@ namespace LinBox
 		}
 
 		Element &init (Element &x, const double &y) const
-		{ 
+		{
 			double z = fmod(y, (double)_modulus);
 			if (z < 0) z += (double) _modulus;
 			return x = (Element) (z);
@@ -961,37 +1136,44 @@ namespace LinBox
 		Element &add (Element &x, const Element &y, const Element &z) const
 		{
 			x = y + z;
-			if ((uint32) x >= (uint32) ModularBase<Element>::_modulus) x -= ModularBase<Element>::_modulus;
+			if ((uint32_t) x >= (uint32_t) ModularBase<Element>::_modulus) x -= ModularBase<Element>::_modulus;
 			return x;
 		}
- 
+
 		Element &sub (Element &x, const Element &y, const Element &z) const
 		{
 			x = y - z;
-			if ((int32) x < 0) x += ModularBase<Element>::_modulus;
+			if ((int32_t) x < 0) x += ModularBase<Element>::_modulus;
 			return x;
 		}
- 
+
 		Element &mul (Element &x, const Element &y, const Element &z) const
-			{ return x = ((uint64) y * (uint64) z) % (uint64) ModularBase<Element>::_modulus; }
- 
+		{
+			return x = ((uint64_t) y * (uint64_t) z) % (uint64_t) ModularBase<Element>::_modulus;
+		}
+
 		Element &div (Element &x, const Element &y, const Element &z) const
-		{ 
+		{
 			Element temp;
 			inv (temp, z);
 			return mul (x, y, temp);
 		}
- 
+
 		Element &neg (Element &x, const Element &y) const
-			{ if (y == 0) return x = y; else return x = ModularBase<Element>::_modulus - y; }
- 
+		{
+			if (y == 0)
+				return x = y;
+			else
+				return x = ModularBase<Element>::_modulus - y;
+		}
+
 		Element &inv (Element &x, const Element &y) const
 		{
 			// The extended Euclidean algoritm
-			int64 x_int, y_int, q, tx, ty, temp;
+			int64_t x_int, y_int, q, tx, ty, temp;
 			x_int = ModularBase<Element>::_modulus;
 			y_int = y;
-			tx = 0; 
+			tx = 0;
 			ty = 1;
 
 			while (y_int != 0) {
@@ -1011,61 +1193,68 @@ namespace LinBox
 			return x = tx;
 		}
 
-		Element &axpy (Element &r, 
-			       const Element &a, 
-			       const Element &x, 
+		Element &axpy (Element &r,
+			       const Element &a,
+			       const Element &x,
 			       const Element &y) const
 		{
-			r = ((uint64) a * (uint64) x + (uint64) y) % (uint64) ModularBase<Element>::_modulus;
-			if ((int32) r < 0) r += ModularBase<Element>::_modulus;
+			r = ((uint64_t) a * (uint64_t) x + (uint64_t) y) % (uint64_t) ModularBase<Element>::_modulus;
+			if ((int32_t) r < 0) r += ModularBase<Element>::_modulus;
 			return r;
 		}
 
 		Element &addin (Element &x, const Element &y) const
-		{ 
+		{
 			x += y;
-			if ((uint32) x >= (uint32) ModularBase<Element>::_modulus) x -= ModularBase<Element>::_modulus;
+			if ((uint32_t) x >= (uint32_t) ModularBase<Element>::_modulus) x -= ModularBase<Element>::_modulus;
 			return x;
 		}
- 
+
 		Element &subin (Element &x, const Element &y) const
 		{
 			x -= y;
-			if ((int32) x < 0) x += ModularBase<Element>::_modulus;
+			if ((int32_t) x < 0) x += ModularBase<Element>::_modulus;
 			return x;
 		}
- 
+
 		Element &mulin (Element &x, const Element &y) const
 		{
-			x = ((uint64) x * (uint64) y) % (uint64) ModularBase<Element>::_modulus;
+			x = ((uint64_t) x * (uint64_t) y) % (uint64_t) ModularBase<Element>::_modulus;
 			return x;
 		}
- 
+
 		Element &divin (Element &x, const Element &y) const
 		{
 			Element temp;
 			inv (temp, y);
 			return mulin (x, temp);
 		}
- 
+
 		Element &negin (Element &x) const
-			{ if (x == 0) return x; else return x = ModularBase<Element>::_modulus - x; }
- 
+		{
+			if (x == 0)
+				return x;
+			else
+				return x = ModularBase<Element>::_modulus - x;
+		}
+
 		Element &invin (Element &x) const
-			{ return inv (x, x); }
+		{
+			return inv (x, x);
+		}
 
 		Element &axpyin (Element &r, const Element &a, const Element &x) const
-		{ 
-			r = ((uint64) r + (uint64) a * (uint64) x) % (uint64) ModularBase<Element>::_modulus;
-			if ((int32) r < 0) r += ModularBase<Element>::_modulus;
+		{
+			r = ((uint64_t) r + (uint64_t) a * (uint64_t) x) % (uint64_t) ModularBase<Element>::_modulus;
+			if ((int32_t) r < 0) r += ModularBase<Element>::_modulus;
 			return r;
 		}
 
-	    private:
+	private:
 
-		void init_two_64 () 
+		void init_two_64 ()
 		{
-			uint64 two_64 = 2;
+			uint64_t two_64 = 2;
 
 			for (int i = 0; i < 6; ++i)
 				two_64 = (two_64 * two_64) % ModularBase<Element>::_modulus;
@@ -1073,241 +1262,293 @@ namespace LinBox
 			_two_64 = two_64;
 		}
 
-		friend class FieldAXPY<Modular<uint32> >;
-		friend class DotProductDomain<Modular<uint32> >;
-		friend class MVProductDomain<Modular<uint32> >;
+		friend class FieldAXPY<Modular<uint32_t> >;
+		friend class DotProductDomain<Modular<uint32_t> >;
+		friend class MVProductDomain<Modular<uint32_t> >;
 
 		Element _two_64;
 
-	}; // class Modular<uint32>
+	}; // class Modular<uint32_t>
 
-	/* Specialization of FieldAXPY for parameterized modular field */
+	/*! Specialization of FieldAXPY for parameterized modular field */
 
 	template <class _Element>
-	class FieldAXPY<Modular<_Element> >
-	{
-	    public:
+	class FieldAXPY<Modular<_Element> > {
+	public:
 
 		typedef _Element Element;
 		typedef Modular<_Element> Field;
 
-		FieldAXPY (const Field &F) : _F (F) { _y = 0; }
-		FieldAXPY (const FieldAXPY<Modular<Element> > &faxpy) : _F (faxpy._F), _y (faxpy._y) {}
+		FieldAXPY (const Field &F) :
+			_F (F)
+		{ _y = 0; }
+		FieldAXPY (const FieldAXPY<Modular<Element> > &faxpy) :
+			_F (faxpy._F), _y (faxpy._y)
+		{}
 
-		FieldAXPY<Modular <Element> > &operator = (const FieldAXPY &faxpy) 
-			{ _F = faxpy._F; _y = faxpy._y; return *this; }
+		FieldAXPY<Modular <Element> > &operator = (const FieldAXPY &faxpy)
+		{
+			_F = faxpy._F;
+			_y = faxpy._y;
+			return *this;
+		}
 
 		inline Element& mulacc (const Element &a, const Element &x)
-			{ return accumulate(a * x); }
+		{
+			return accumulate(a * x);
+		}
 
 		inline Element& accumulate (const Element &t)
-			{ return _y+=t; }
+		{
+			return _y+=t;
+		}
 
-		inline Element &get (Element &y) { _y %= _F._modulus; y = _y; return y; }
+		inline Element &get (Element &y) { _y %= _F._modulus; y = _y; return y;
+		}
 
 		inline FieldAXPY &assign (const Element y)
-			{ _y = y; return *this; }
+		{
+			_y = y;
+			return *this;
+		}
 
 		inline void reset() {
 			_F.init(_y, 0);
 		}
 
-	    private:
+	private:
 
 		Field _F;
 		Element _y;
 	};
 
-	/* Specialization of FieldAXPY for uint8 modular field */
+	/*! Specialization of FieldAXPY for uint8_t modular field */
 
 	template <>
-	class FieldAXPY<Modular<uint8> >
-	{
-	    public:
+	class FieldAXPY<Modular<uint8_t> > {
+	public:
 
-		typedef uint8 Element;
-		typedef Modular<uint8> Field;
+		typedef uint8_t Element;
+		typedef Modular<uint8_t> Field;
 
-		FieldAXPY (const Field &F) : _F (F), i (F._k) { _y = 0; }
-		FieldAXPY (const FieldAXPY &faxpy) : _F (faxpy._F), _y (0), i (faxpy._F._k) {}
+		FieldAXPY (const Field &F) :
+			_F (F), i (F._k)
+		{ _y = 0; }
+		FieldAXPY (const FieldAXPY &faxpy) :
+			_F (faxpy._F), _y (0), i (faxpy._F._k)
+		{}
 
-		FieldAXPY<Modular<uint8> > &operator = (const FieldAXPY &faxpy) 
-			{ _F = faxpy._F; _y = faxpy._y; return *this; }
+		FieldAXPY<Modular<uint8_t> > &operator = (const FieldAXPY &faxpy)
+		{
+			_F = faxpy._F;
+			_y = faxpy._y;
+			return *this;
+		}
 
-		inline uint64& mulacc (const Element &a, const Element &x)
+		inline uint64_t& mulacc (const Element &a, const Element &x)
 		{
-			uint32 t = (uint32) a * (uint32) x;
+			uint32_t t = (uint32_t) a * (uint32_t) x;
 
 			if (!i--) {
 				i = _F._k;
-				return _y = _y % (uint32) _F._modulus + t;
-			} else
+				return _y = _y % (uint32_t) _F._modulus + t;
+			}
+			else
 				return _y += t;
 		}
 
-            inline uint64& accumulate (const Element &t)
+		inline uint64_t& accumulate (const Element &t)
 		{
 
 			if (!i--) {
 				i = _F._k;
-				return _y = _y % (uint32) _F._modulus + t;
-			} else
+				return _y = _y % (uint32_t) _F._modulus + t;
+			}
+			else
 				return _y += t;
 		}
 
 		inline Element &get (Element &y) {
-			_y %= (uint32) _F._modulus;
-			if ((int32) _y < 0) _y += _F._modulus;
-			y = (uint8) _y;
+			_y %= (uint32_t) _F._modulus;
+			if ((int32_t) _y < 0) _y += _F._modulus;
+			y = (uint8_t) _y;
 			i = _F._k;
 			return y;
 		}
 
 		inline FieldAXPY &assign (const Element y)
-			{ _y = y; i = _F._k; return *this; }
+		{
+			_y = y;
+			i = _F._k;
+			return *this;
+		}
 
 		inline void reset() {
 			_y = 0;
 		}
 
-	    private:
+	private:
 
 		Field _F;
-		uint64 _y;
+		uint64_t _y;
 		int i;
 	};
 
-	/* Specialization of FieldAXPY for uint16 modular field */
-
+	/*! Specialization of FieldAXPY for uint16_t modular field */
 	template <>
-	class FieldAXPY<Modular<uint16> >
-	{
-	    public:
+	class FieldAXPY<Modular<uint16_t> > {
+	public:
 
-		typedef uint16 Element;
-		typedef Modular<uint16> Field;
+		typedef uint16_t Element;
+		typedef Modular<uint16_t> Field;
 
-		FieldAXPY (const Field &F) : _F (F), i (F._k) { _y = 0; }
-		FieldAXPY (const FieldAXPY &faxpy) : _F (faxpy._F), _y (0), i (faxpy._F._k) {}
+		FieldAXPY (const Field &F) :
+			_F (F), i (F._k)
+		{ _y = 0; }
+		FieldAXPY (const FieldAXPY &faxpy) :
+			_F (faxpy._F), _y (0), i (faxpy._F._k)
+		{}
 
-		FieldAXPY<Modular<uint16> > &operator = (const FieldAXPY &faxpy) 
-			{ _F = faxpy._F; _y = faxpy._y; return *this; }
+		FieldAXPY<Modular<uint16_t> > &operator = (const FieldAXPY &faxpy)
+		{
+			_F = faxpy._F;
+			_y = faxpy._y;
+			return *this;
+		}
 
-		inline uint64& mulacc (const Element &a, const Element &x)
+		inline uint64_t& mulacc (const Element &a, const Element &x)
 		{
-			uint64 t = (long long) a * (long long) x;
+			uint64_t t = (long long) a * (long long) x;
 
 			if (!i--) {
 				i = _F._k;
-				return _y = _y % (uint64) _F._modulus + t;
-			} else
+				return _y = _y % (uint64_t) _F._modulus + t;
+			}
+			else
 				return _y += t;
 		}
 
-		inline uint64& accumulate (const Element &t)
+		inline uint64_t& accumulate (const Element &t)
 		{
 			if (!i--) {
 				i = _F._k;
-				return _y = _y % (uint64) _F._modulus + t;
-			} else
+				return _y = _y % (uint64_t) _F._modulus + t;
+			}
+			else
 				return _y += t;
 		}
 
 		inline Element &get (Element &y) {
-			_y %= (uint64) _F._modulus;
-			if ((int64) _y < 0) _y += _F._modulus;
-			y = (uint16) _y;
+			_y %= (uint64_t) _F._modulus;
+			if ((int64_t) _y < 0) _y += _F._modulus;
+			y = (uint16_t) _y;
 			i = _F._k;
 			return y;
 		}
 
 		inline FieldAXPY &assign (const Element y)
-			{ _y = y; i = _F._k; return *this; }
+		{
+			_y = y;
+			i = _F._k;
+			return *this;
+		}
 
 		inline void reset() {
 			_y = 0;
 		}
 
-	    private:
+	private:
 
 		Field _F;
-		uint64 _y;
+		uint64_t _y;
 		int i;
 	};
 
-	/* Specialization of FieldAXPY for unsigned short modular field */
+	/*! Specialization of FieldAXPY for unsigned short modular field */
 
 	template <>
-	class FieldAXPY<Modular<uint32> >
-	{
-	    public:
+	class FieldAXPY<Modular<uint32_t> > {
+	public:
 
-		typedef uint32 Element;
-		typedef Modular<uint32> Field;
+		typedef uint32_t Element;
+		typedef Modular<uint32_t> Field;
 
-		FieldAXPY (const Field &F) : _F (F) { _y = 0; }
-		FieldAXPY (const FieldAXPY &faxpy) : _F (faxpy._F), _y (0) {}
+		FieldAXPY (const Field &F) :
+			_F (F), _y(0)
+		{ }
 
-		FieldAXPY<Modular<uint32> > &operator = (const FieldAXPY &faxpy) 
-			{ _F = faxpy._F; _y = faxpy._y; return *this; }
+		FieldAXPY (const FieldAXPY &faxpy) :
+			_F (faxpy._F), _y (0)
+		{}
 
-		inline uint64& mulacc (const Element &a, const Element &x)
+		FieldAXPY<Modular<uint32_t> > &operator = (const FieldAXPY &faxpy)
 		{
-			uint64 t = (uint64) a * (uint64) x;
+			_F = faxpy._F;
+			_y = faxpy._y;
+			return *this;
+		}
+
+		inline uint64_t& mulacc (const Element &a, const Element &x)
+		{
+			uint64_t t = (uint64_t) a * (uint64_t) x;
 			_y += t;
 
 			if (_y < t)
 				return _y += _F._two_64;
-                        else
-                            return _y;
+			else
+				return _y;
 		}
 
-		inline uint64& accumulate (const Element &t)
+		inline uint64_t& accumulate (const Element &t)
 		{
 			_y += t;
 
 			if (_y < t)
 				return _y += _F._two_64;
-                        else
-                            return _y;
+			else
+				return _y;
 		}
 
-		inline uint64& accumulate_special (const Element &t)
-		{ return _y += t; }
+		inline uint64_t& accumulate_special (const Element &t)
+		{
+			return _y += t;
+		}
 
 		inline Element &get (Element &y) {
-			_y %= (uint64) _F._modulus;
-			//if ((int64) _y < 0) _y += _F._modulus;
-			return y = (uint32) _y;
+			_y %= (uint64_t) _F._modulus;
+			//if ((int64_t) _y < 0) _y += _F._modulus;
+			return y = (uint32_t) _y;
 		}
 
 		inline FieldAXPY &assign (const Element y)
-			{ _y = y; return *this; }
+		{
+			_y = y;
+			return *this;
+		}
 
 		inline void reset() {
 			_y = 0;
 		}
 
-	    private:
+	private:
 
 		Field _F;
-		uint64 _y;
+		uint64_t _y;
 	};
 
-	// Specialization of DotProductDomain for unsigned short modular field
+	//! Specialization of DotProductDomain for unsigned short modular field
 
 	template <>
-	class DotProductDomain<Modular<uint8> > : private virtual VectorDomainBase<Modular<uint8> >
-	{
-	    public:
+	class DotProductDomain<Modular<uint8_t> > : private virtual VectorDomainBase<Modular<uint8_t> > {
+	public:
 
-		typedef uint8 Element;
+		typedef uint8_t Element;
 
-		DotProductDomain (const Modular<uint8> &F)
-			: VectorDomainBase<Modular<uint8> > (F)
+		DotProductDomain (const Modular<uint8_t> &F) :
+			VectorDomainBase<Modular<uint8_t> > (F)
 		{}
 
-	    protected:
+	protected:
 		template <class Vector1, class Vector2>
 		inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const;
 
@@ -1315,20 +1556,19 @@ namespace LinBox
 		inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const;
 	};
 
-	// Specialization of DotProductDomain for unsigned short modular field
+	//! Specialization of DotProductDomain for unsigned short modular field
 
 	template <>
-	class DotProductDomain<Modular<uint16> > : private virtual VectorDomainBase<Modular<uint16> >
-	{
-	    public:
+	class DotProductDomain<Modular<uint16_t> > : private virtual VectorDomainBase<Modular<uint16_t> > {
+	public:
 
-		typedef uint16 Element;
+		typedef uint16_t Element;
 
-		DotProductDomain (const Modular<uint16> &F)
-			: VectorDomainBase<Modular<uint16> > (F)
+		DotProductDomain (const Modular<uint16_t> &F) :
+			VectorDomainBase<Modular<uint16_t> > (F)
 		{}
 
-	    protected:
+	protected:
 		template <class Vector1, class Vector2>
 		inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const;
 
@@ -1336,20 +1576,19 @@ namespace LinBox
 		inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const;
 	};
 
-	// Specialization of DotProductDomain for uint32 modular field
+	//! Specialization of DotProductDomain for uint32_t modular field
 
 	template <>
-	class DotProductDomain<Modular<uint32> > : private virtual VectorDomainBase<Modular<uint32> >
-	{
-	    public:
+	class DotProductDomain<Modular<uint32_t> > : private virtual VectorDomainBase<Modular<uint32_t> > {
+	public:
 
-		typedef uint32 Element;
+		typedef uint32_t Element;
 
-		DotProductDomain (const Modular<uint32> &F)
-			: VectorDomainBase<Modular<uint32> > (F)
+		DotProductDomain (const Modular<uint32_t> &F) :
+			VectorDomainBase<Modular<uint32_t> > (F)
 		{}
 
-	    protected:
+	protected:
 		template <class Vector1, class Vector2>
 		inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const;
 
@@ -1357,134 +1596,130 @@ namespace LinBox
 		inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const;
 	};
 
-	// Specialization of MVProductDomain for uint8 modular field
+	//! Specialization of MVProductDomain for uint8_t modular field
 
 	template <>
-	class MVProductDomain<Modular<uint8> >
-	{
-	    public:
+	class MVProductDomain<Modular<uint8_t> > {
+	public:
 
-		typedef uint8 Element;
+		typedef uint8_t Element;
 
-	    protected:
+	protected:
 		template <class Vector1, class Matrix, class Vector2>
 		inline Vector1 &mulColDense
-			(const VectorDomain<Modular<uint8> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v) const
+		(const VectorDomain<Modular<uint8_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v) const
 		{
-			return mulColDenseSpecialized
-				(VD, w, A, v, typename VectorTraits<typename Matrix::Column>::VectorCategory ());
+			return mulColDenseSpecialized (VD, w, A, v, typename VectorTraits<typename Matrix::Column>::VectorCategory ());
 		}
 
-	    private:
+	private:
 		template <class Vector1, class Matrix, class Vector2>
 		Vector1 &mulColDenseSpecialized
-			(const VectorDomain<Modular<uint8> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-			 VectorCategories::DenseVectorTag) const;
+		(const VectorDomain<Modular<uint8_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::DenseVectorTag) const;
 		template <class Vector1, class Matrix, class Vector2>
 		Vector1 &mulColDenseSpecialized
-			(const VectorDomain<Modular<uint8> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-			 VectorCategories::SparseSequenceVectorTag) const;
+		(const VectorDomain<Modular<uint8_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::SparseSequenceVectorTag) const;
 		template <class Vector1, class Matrix, class Vector2>
 		Vector1 &mulColDenseSpecialized
-			(const VectorDomain<Modular<uint8> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-			 VectorCategories::SparseAssociativeVectorTag) const;
+		(const VectorDomain<Modular<uint8_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::SparseAssociativeVectorTag) const;
 		template <class Vector1, class Matrix, class Vector2>
 		Vector1 &mulColDenseSpecialized
-			(const VectorDomain<Modular<uint8> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-			 VectorCategories::SparseParallelVectorTag) const;
+		(const VectorDomain<Modular<uint8_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::SparseParallelVectorTag) const;
 
-		mutable std::vector<uint32> _tmp;
+		mutable std::vector<uint32_t> _tmp;
 	};
 
-	// Specialization of MVProductDomain for uint16 modular field
+	//! Specialization of MVProductDomain for uint16_t modular field
 
 	template <>
-	class MVProductDomain<Modular<uint16> >
-	{
-	    public:
+	class MVProductDomain<Modular<uint16_t> > {
+	public:
 
-		typedef uint16 Element;
+		typedef uint16_t Element;
 
-	    protected:
+	protected:
 		template <class Vector1, class Matrix, class Vector2>
 		inline Vector1 &mulColDense
-			(const VectorDomain<Modular<uint16> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v) const
+		(const VectorDomain<Modular<uint16_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v) const
 		{
-			return mulColDenseSpecialized
-				(VD, w, A, v, VectorTraits<typename Matrix::Column>::VectorCategory ());
+			return mulColDenseSpecialized (VD, w, A, v, VectorTraits<typename Matrix::Column>::VectorCategory ());
 		}
 
-	    private:
+	private:
 		template <class Vector1, class Matrix, class Vector2>
 		Vector1 &mulColDenseSpecialized
-			(const VectorDomain<Modular<uint16> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-			 VectorCategories::DenseVectorTag) const;
+		(const VectorDomain<Modular<uint16_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::DenseVectorTag) const;
 		template <class Vector1, class Matrix, class Vector2>
 		Vector1 &mulColDenseSpecialized
-			(const VectorDomain<Modular<uint16> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-			 VectorCategories::SparseSequenceVectorTag) const;
+		(const VectorDomain<Modular<uint16_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::SparseSequenceVectorTag) const;
 		template <class Vector1, class Matrix, class Vector2>
 		Vector1 &mulColDenseSpecialized
-			(const VectorDomain<Modular<uint16> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-			 VectorCategories::SparseAssociativeVectorTag) const;
+		(const VectorDomain<Modular<uint16_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::SparseAssociativeVectorTag) const;
 		template <class Vector1, class Matrix, class Vector2>
 		Vector1 &mulColDenseSpecialized
-			(const VectorDomain<Modular<uint16> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-			 VectorCategories::SparseParallelVectorTag) const;
+		(const VectorDomain<Modular<uint16_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::SparseParallelVectorTag) const;
 
-		mutable std::vector<uint64> _tmp;
+		mutable std::vector<uint64_t> _tmp;
 	};
 
-	// Specialization of MVProductDomain for uint32 modular field
+	//! Specialization of MVProductDomain for uint32_t modular field
 
 	template <>
-	class MVProductDomain<Modular<uint32> >
-	{
-	    public:
+	class MVProductDomain<Modular<uint32_t> > {
+	public:
 
-		typedef uint32 Element;
+		typedef uint32_t Element;
 
-	    protected:
+	protected:
 		template <class Vector1, class Matrix, class Vector2>
 		inline Vector1 &mulColDense
-			(const VectorDomain<Modular<uint32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v) const
+		(const VectorDomain<Modular<uint32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v) const
 		{
-			return mulColDenseSpecialized
-				(VD, w, A, v, typename VectorTraits<typename Matrix::Column>::VectorCategory ());
+			return mulColDenseSpecialized (VD, w, A, v, typename VectorTraits<typename Matrix::Column>::VectorCategory ());
 		}
 
-	    private:
+	private:
 		template <class Vector1, class Matrix, class Vector2>
 		Vector1 &mulColDenseSpecialized
-			(const VectorDomain<Modular<uint32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-			 VectorCategories::DenseVectorTag) const;
+		(const VectorDomain<Modular<uint32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::DenseVectorTag) const;
 		template <class Vector1, class Matrix, class Vector2>
 		Vector1 &mulColDenseSpecialized
-			(const VectorDomain<Modular<uint32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-			 VectorCategories::SparseSequenceVectorTag) const;
+		(const VectorDomain<Modular<uint32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::SparseSequenceVectorTag) const;
 		template <class Vector1, class Matrix, class Vector2>
 		Vector1 &mulColDenseSpecialized
-			(const VectorDomain<Modular<uint32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-			 VectorCategories::SparseAssociativeVectorTag) const;
+		(const VectorDomain<Modular<uint32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::SparseAssociativeVectorTag) const;
 		template <class Vector1, class Matrix, class Vector2>
 		Vector1 &mulColDenseSpecialized
-			(const VectorDomain<Modular<uint32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
-			 VectorCategories::SparseParallelVectorTag) const;
+		(const VectorDomain<Modular<uint32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+		 VectorCategories::SparseParallelVectorTag) const;
 
-		mutable std::vector<uint64> _tmp;
+		mutable std::vector<uint64_t> _tmp;
 	};
 
 	template <>
-	inline std::ostream& ModularBase<Integer>::write (std::ostream &os) const 
-	  { return os << "GMP integers mod " << _modulus; }
+	inline std::ostream& ModularBase<Integer>::write (std::ostream &os) const
+	{
+		return os << "GMP integers mod " << _modulus;
+	}
 
 	template <>
-	inline integer& Modular<integer>::init (integer& x, const double& y) const 
-	  {
-	    integer tmp = (integer)y % _modulus;
-	    if (tmp<0) tmp += _modulus;
-	    return x = tmp;
-	  }
+	inline integer& Modular<integer>::init (integer& x, const double& y) const
+	{
+		integer tmp = (integer)y % _modulus;
+		if (tmp<0) tmp += _modulus;
+		return x = tmp;
+	}
 
 
 } // namespace LinBox
@@ -1492,9 +1727,13 @@ namespace LinBox
 #include "linbox/field/modular.inl"
 #include "linbox/randiter/modular.h"
 #include "linbox/field/modular-int32.h"
+#ifdef __LINBOX_HAVE_INT64
+#include "linbox/field/modular-int64.h"
+#endif
 #include "linbox/field/modular-short.h"
 #include "linbox/field/modular-byte.h"
 #include "linbox/field/modular-double.h"
 #include "linbox/field/modular-float.h"
 
-#endif // __FIELD_MODULAR_H
+#endif // __LINBOX_field_modular_H
+
diff --git a/linbox/field/modular.inl b/linbox/field/modular.inl
index 260dc69..c2e923e 100644
--- a/linbox/field/modular.inl
+++ b/linbox/field/modular.inl
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/field/modular.inl
  * Copyright (C) 2002 Bradford Hovinen
  * Copyright (C) 2002 Ahmet Duran
@@ -14,8 +14,8 @@
  * See COPYING for license information.
  */
 
-#ifndef __FIELD_MODULAR_INL
-#define __FIELD_MODULAR_INL
+#ifndef __LINBOX_field_modular_INL
+#define __LINBOX_field_modular_INL
 
 //Dan Roche 7-2-04
 #ifndef __LINBOX_MIN
@@ -27,20 +27,20 @@
 namespace LinBox {
 
 template <class Vector1, class Vector2>
-inline uint8 &DotProductDomain<Modular<uint8> >::dotSpecializedDD
-	(uint8 &res, const Vector1 &v1, const Vector2 &v2) const
+inline uint8_t &DotProductDomain<Modular<uint8_t> >::dotSpecializedDD
+	(uint8_t &res, const Vector1 &v1, const Vector2 &v2) const
 {
 	typename Vector1::const_iterator i = v1.begin ();
 	typename Vector2::const_iterator j = v2.begin ();
 
 	typename Vector1::const_iterator iterend = v1.begin () + v1.size() % _F._k;
 
-	uint64 y = 0;
+	uint64_t y = 0;
 
 	for (; i != iterend; ++i, ++j)
-		y += (uint64) *i * (uint64) *j;
+		y += (uint64_t) *i * (uint64_t) *j;
 
-	y %= (uint64) _F._modulus;
+	y %= (uint64_t) _F._modulus;
 
 	for (; iterend != v1.end (); j += _F._k) {
 		typename Vector1::const_iterator iter_i = iterend;
@@ -49,35 +49,36 @@ inline uint8 &DotProductDomain<Modular<uint8> >::dotSpecializedDD
 		iterend += _F._k;
 
 		for (iter_j = j; iter_i != iterend; ++iter_i, ++iter_j)
-			y += (uint64) *iter_i * (uint64) *j;
+			y += (uint64_t) *iter_i * (uint64_t) *j;
 
-		y %= (uint64) _F._modulus;
+		y %= (uint64_t) _F._modulus;
 	}
 
 	return res = y;
 }
 
 template <class Vector1, class Vector2>
-inline uint8 &DotProductDomain<Modular<uint8> >::dotSpecializedDSP
-	(uint8 &res, const Vector1 &v1, const Vector2 &v2) const
+inline uint8_t &DotProductDomain<Modular<uint8_t> >::dotSpecializedDSP
+	(uint8_t &res, const Vector1 &v1, const Vector2 &v2) const
 {
 	typename Vector1::first_type::const_iterator i_idx = v1.first.begin ();
 	typename Vector1::second_type::const_iterator i_elt = v1.second.begin ();
 
-	uint64 y = 0;
+	uint64_t y = 0;
 
 	if (v1.first.size () < _F._k) {
 		for (; i_idx != v1.first.end (); ++i_idx, ++i_elt)
-			y += (uint64) *i_elt * (uint64) v2[*i_idx];
+			y += (uint64_t) *i_elt * (uint64_t) v2[*i_idx];
 
-		return res = y % (uint64) _F._modulus;
-	} else {
+		return res = y % (uint64_t) _F._modulus;
+	}
+	else {
 		typename Vector1::first_type::const_iterator iterend = v1.first.begin () + v1.first.size() % _F._k;
 
 		for (; i_idx != iterend; ++i_idx, ++i_elt)
-			y += (uint64) *i_elt * (uint64) v2[*i_idx];
+			y += (uint64_t) *i_elt * (uint64_t) v2[*i_idx];
 
-		y %= (uint64) _F._modulus;
+		y %= (uint64_t) _F._modulus;
 
 		while (iterend != v1.first.end ()) {
 			typename Vector1::first_type::const_iterator iter_i_idx = iterend;
@@ -87,9 +88,9 @@ inline uint8 &DotProductDomain<Modular<uint8> >::dotSpecializedDSP
 			i_elt += _F._k;
 
 			for (; iter_i_idx != iterend; ++iter_i_idx, ++iter_i_elt)
-				y += (uint64) *iter_i_elt * (uint64) v2[*iter_i_idx];
+				y += (uint64_t) *iter_i_elt * (uint64_t) v2[*iter_i_idx];
 
-			y %= (uint64) _F._modulus;
+			y %= (uint64_t) _F._modulus;
 		}
 
 		return res = y;
@@ -97,20 +98,20 @@ inline uint8 &DotProductDomain<Modular<uint8> >::dotSpecializedDSP
 }
 
 template <class Vector1, class Vector2>
-inline uint16 &DotProductDomain<Modular<uint16> >::dotSpecializedDD
-	(uint16 &res, const Vector1 &v1, const Vector2 &v2) const
+inline uint16_t &DotProductDomain<Modular<uint16_t> >::dotSpecializedDD
+	(uint16_t &res, const Vector1 &v1, const Vector2 &v2) const
 {
 	typename Vector1::const_iterator i = v1.begin ();
 	typename Vector2::const_iterator j = v2.begin ();
 
 	typename Vector1::const_iterator iterend = v1.begin () + v1.size() % _F._k;
 
-	uint64 y = 0;
+	uint64_t y = 0;
 
 	for (; i != iterend; ++i, ++j)
-		y += (uint64) *i * (uint64) *j;
+		y += (uint64_t) *i * (uint64_t) *j;
 
-	y %= (uint64) _F._modulus;
+	y %= (uint64_t) _F._modulus;
 
 	for (; iterend != v1.end (); j += _F._k) {
 		typename Vector1::const_iterator iter_i = iterend;
@@ -119,35 +120,36 @@ inline uint16 &DotProductDomain<Modular<uint16> >::dotSpecializedDD
 		iterend += _F._k;
 
 		for (iter_j = j; iter_i != iterend; ++iter_i, ++iter_j)
-			y += (uint64) *iter_i * (uint64) *j;
+			y += (uint64_t) *iter_i * (uint64_t) *j;
 
-		y %= (uint64) _F._modulus;
+		y %= (uint64_t) _F._modulus;
 	}
 
 	return res = y;
 }
 
 template <class Vector1, class Vector2>
-inline uint16 &DotProductDomain<Modular<uint16> >::dotSpecializedDSP
-	(uint16 &res, const Vector1 &v1, const Vector2 &v2) const
+inline uint16_t &DotProductDomain<Modular<uint16_t> >::dotSpecializedDSP
+	(uint16_t &res, const Vector1 &v1, const Vector2 &v2) const
 {
 	typename Vector1::first_type::const_iterator i_idx = v1.first.begin ();
 	typename Vector1::second_type::const_iterator i_elt = v1.second.begin ();
 
-	uint64 y = 0;
+	uint64_t y = 0;
 
 	if (v1.first.size () < _F._k) {
 		for (; i_idx != v1.first.end (); ++i_idx, ++i_elt)
-			y += (uint64) *i_elt * (uint64) v2[*i_idx];
+			y += (uint64_t) *i_elt * (uint64_t) v2[*i_idx];
 
-		return res = y % (uint64) _F._modulus;
-	} else {
+		return res = y % (uint64_t) _F._modulus;
+	}
+	else {
 		typename Vector1::first_type::const_iterator iterend = v1.first.begin () + v1.first.size() % _F._k;
 
 		for (; i_idx != iterend; ++i_idx, ++i_elt)
-			y += (uint64) *i_elt * (uint64) v2[*i_idx];
+			y += (uint64_t) *i_elt * (uint64_t) v2[*i_idx];
 
-		y %= (uint64) _F._modulus;
+		y %= (uint64_t) _F._modulus;
 
 		while (iterend != v1.first.end ()) {
 			typename Vector1::first_type::const_iterator iter_i_idx = iterend;
@@ -157,9 +159,9 @@ inline uint16 &DotProductDomain<Modular<uint16> >::dotSpecializedDSP
 			i_elt += _F._k;
 
 			for (; iter_i_idx != iterend; ++iter_i_idx, ++iter_i_elt)
-				y += (uint64) *iter_i_elt * (uint64) v2[*iter_i_idx];
+				y += (uint64_t) *iter_i_elt * (uint64_t) v2[*iter_i_idx];
 
-			y %= (uint64) _F._modulus;
+			y %= (uint64_t) _F._modulus;
 		}
 
 		return res = y;
@@ -167,54 +169,54 @@ inline uint16 &DotProductDomain<Modular<uint16> >::dotSpecializedDSP
 }
 
 template <class Vector1, class Vector2>
-inline uint32 &DotProductDomain<Modular<uint32> >::dotSpecializedDD
-	(uint32 &res, const Vector1 &v1, const Vector2 &v2) const
+inline uint32_t &DotProductDomain<Modular<uint32_t> >::dotSpecializedDD
+	(uint32_t &res, const Vector1 &v1, const Vector2 &v2) const
 {
 	typename Vector1::const_iterator i;
 	typename Vector2::const_iterator j;
-  
-	uint64 y = 0;
-	uint64 t;
+
+	uint64_t y = 0;
+	uint64_t t;
 
 	for (i = v1.begin (), j = v2.begin (); i < v1.end (); ++i, ++j) {
-		t = (uint64) *i * (uint64) *j;
+		t = (uint64_t) *i * (uint64_t) *j;
 		y += t;
 
 		if (y < t)
 			y += _F._two_64;
 	}
-  
-	y %= (uint64) _F._modulus;
+
+	y %= (uint64_t) _F._modulus;
 
 	return res = y;
 }
 
 template <class Vector1, class Vector2>
-inline uint32 &DotProductDomain<Modular<uint32> >::dotSpecializedDSP
-	(uint32 &res, const Vector1 &v1, const Vector2 &v2) const
+inline uint32_t &DotProductDomain<Modular<uint32_t> >::dotSpecializedDSP
+	(uint32_t &res, const Vector1 &v1, const Vector2 &v2) const
 {
 	typename Vector1::first_type::const_iterator i_idx;
 	typename Vector1::second_type::const_iterator i_elt;
-  
-	uint64 y = 0;
-	uint64 t;
+
+	uint64_t y = 0;
+	uint64_t t;
 
 	for (i_idx = v1.first.begin (), i_elt = v1.second.begin (); i_idx != v1.first.end (); ++i_idx, ++i_elt) {
-		t = (uint64) *i_elt * (uint64) v2[*i_idx];
+		t = (uint64_t) *i_elt * (uint64_t) v2[*i_idx];
 		y += t;
 
 		if (y < t)
 			y += _F._two_64;
 	}
-  
-	y %= (uint64) _F._modulus;
+
+	y %= (uint64_t) _F._modulus;
 
 	return res = y;
 }
 
 template <class Vector1, class Matrix, class Vector2>
-Vector1 &MVProductDomain<Modular<uint8> >::mulColDenseSpecialized
-	(const VectorDomain<Modular<uint8> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+Vector1 &MVProductDomain<Modular<uint8_t> >::mulColDenseSpecialized
+	(const VectorDomain<Modular<uint8_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
 	 VectorCategories::DenseVectorTag) const
 {
 	linbox_check (A.coldim () == v.size ());
@@ -223,7 +225,7 @@ Vector1 &MVProductDomain<Modular<uint8> >::mulColDenseSpecialized
 	typename Matrix::ConstColIterator i = A.colBegin ();
 	typename Vector2::const_iterator j, j_end;
 	typename Matrix::Column::const_iterator k;
-	std::vector<uint32>::iterator l, l_end;
+	std::vector<uint32_t>::iterator l, l_end;
 
 	if (_tmp.size () < w.size ())
 		_tmp.resize (w.size ());
@@ -256,8 +258,8 @@ Vector1 &MVProductDomain<Modular<uint8> >::mulColDenseSpecialized
 }
 
 template <class Vector1, class Matrix, class Vector2>
-Vector1 &MVProductDomain<Modular<uint8> >::mulColDenseSpecialized
-	(const VectorDomain<Modular<uint8> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+Vector1 &MVProductDomain<Modular<uint8_t> >::mulColDenseSpecialized
+	(const VectorDomain<Modular<uint8_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
 	 VectorCategories::SparseSequenceVectorTag) const
 {
 	linbox_check (A.coldim () == v.size ());
@@ -266,7 +268,7 @@ Vector1 &MVProductDomain<Modular<uint8> >::mulColDenseSpecialized
 	typename Matrix::ConstColIterator i = A.colBegin ();
 	typename Vector2::const_iterator j, j_end;
 	typename Matrix::Column::const_iterator k;
-	std::vector<uint32>::iterator l, l_end;
+	std::vector<uint32_t>::iterator l, l_end;
 
 	if (_tmp.size () < w.size ())
 		_tmp.resize (w.size ());
@@ -299,8 +301,8 @@ Vector1 &MVProductDomain<Modular<uint8> >::mulColDenseSpecialized
 }
 
 template <class Vector1, class Matrix, class Vector2>
-Vector1 &MVProductDomain<Modular<uint8> >::mulColDenseSpecialized
-	(const VectorDomain<Modular<uint8> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+Vector1 &MVProductDomain<Modular<uint8_t> >::mulColDenseSpecialized
+	(const VectorDomain<Modular<uint8_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
 	 VectorCategories::SparseAssociativeVectorTag) const
 {
 	linbox_check (A.coldim () == v.size ());
@@ -309,7 +311,7 @@ Vector1 &MVProductDomain<Modular<uint8> >::mulColDenseSpecialized
 	typename Matrix::ConstColIterator i = A.colBegin ();
 	typename Vector2::const_iterator j, j_end;
 	typename Matrix::Column::const_iterator k;
-	std::vector<uint32>::iterator l, l_end;
+	std::vector<uint32_t>::iterator l, l_end;
 
 	if (_tmp.size () < w.size ())
 		_tmp.resize (w.size ());
@@ -342,8 +344,8 @@ Vector1 &MVProductDomain<Modular<uint8> >::mulColDenseSpecialized
 }
 
 template <class Vector1, class Matrix, class Vector2>
-Vector1 &MVProductDomain<Modular<uint8> >::mulColDenseSpecialized
-	(const VectorDomain<Modular<uint8> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+Vector1 &MVProductDomain<Modular<uint8_t> >::mulColDenseSpecialized
+	(const VectorDomain<Modular<uint8_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
 	 VectorCategories::SparseParallelVectorTag) const
 {
 	linbox_check (A.coldim () == v.size ());
@@ -353,7 +355,7 @@ Vector1 &MVProductDomain<Modular<uint8> >::mulColDenseSpecialized
 	typename Vector2::const_iterator j, j_end;
 	typename Matrix::Column::first_type::const_iterator k_idx;
 	typename Matrix::Column::second_type::const_iterator k_elt;
-	std::vector<uint32>::iterator l, l_end;
+	std::vector<uint32_t>::iterator l, l_end;
 
 	if (_tmp.size () < w.size ())
 		_tmp.resize (w.size ());
@@ -364,7 +366,7 @@ Vector1 &MVProductDomain<Modular<uint8> >::mulColDenseSpecialized
 
 	do {
 		j = v.begin ();
-		j_end = j + __LINBOX_MIN (uint64 (A.coldim ()), VD.field ()._k);
+		j_end = j + __LINBOX_MIN (uint64_t (A.coldim ()), VD.field ()._k);
 
 		for (; j != j_end; ++j, ++i)
 			for (k_idx = i->first.begin (), k_elt = i->second.begin (), l = _tmp.begin ();
@@ -372,7 +374,7 @@ Vector1 &MVProductDomain<Modular<uint8> >::mulColDenseSpecialized
 			     ++k_idx, ++k_elt, ++l)
 				_tmp[*k_idx] += *k_elt * *j;
 
-		j_end += __LINBOX_MIN (uint64 (A.coldim () - (j_end - v.begin ())), VD.field ()._k);
+		j_end += __LINBOX_MIN (uint64_t (A.coldim () - (j_end - v.begin ())), VD.field ()._k);
 
 		for (l =_tmp.begin (); l != l_end; ++l)
 			*l %= VD.field ()._modulus;
@@ -388,8 +390,8 @@ Vector1 &MVProductDomain<Modular<uint8> >::mulColDenseSpecialized
 }
 
 template <class Vector1, class Matrix, class Vector2>
-Vector1 &MVProductDomain<Modular<uint16> >::mulColDenseSpecialized
-	(const VectorDomain<Modular<uint16> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+Vector1 &MVProductDomain<Modular<uint16_t> >::mulColDenseSpecialized
+	(const VectorDomain<Modular<uint16_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
 	 VectorCategories::DenseVectorTag) const
 {
 	linbox_check (A.coldim () == v.size ());
@@ -399,8 +401,8 @@ Vector1 &MVProductDomain<Modular<uint16> >::mulColDenseSpecialized
 	typename Vector2::const_iterator j = v.begin (), j_end;
 	typename Matrix::Column::const_iterator k;
 	// Dan Roche, 7-1-04
-	// std::vector<uint32>::iterator l, l_end;
-	std::vector<uint64>::iterator l, l_end;
+	// std::vector<uint32_t>::iterator l, l_end;
+	std::vector<uint64_t>::iterator l, l_end;
 
 	if (_tmp.size () < w.size ())
 		_tmp.resize (w.size ());
@@ -433,8 +435,8 @@ Vector1 &MVProductDomain<Modular<uint16> >::mulColDenseSpecialized
 }
 
 template <class Vector1, class Matrix, class Vector2>
-Vector1 &MVProductDomain<Modular<uint16> >::mulColDenseSpecialized
-	(const VectorDomain<Modular<uint16> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+Vector1 &MVProductDomain<Modular<uint16_t> >::mulColDenseSpecialized
+	(const VectorDomain<Modular<uint16_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
 	 VectorCategories::SparseSequenceVectorTag) const
 {
 	linbox_check (A.coldim () == v.size ());
@@ -444,8 +446,8 @@ Vector1 &MVProductDomain<Modular<uint16> >::mulColDenseSpecialized
 	typename Vector2::const_iterator j, j_end;
 	typename Matrix::Column::const_iterator k;
         // Dan Roche, 7-1-04
-        // std::vector<uint32>::iterator l, l_end;
-	std::vector<uint64>::iterator l, l_end;
+        // std::vector<uint32_t>::iterator l, l_end;
+	std::vector<uint64_t>::iterator l, l_end;
 
 	if (_tmp.size () < w.size ())
 		_tmp.resize (w.size ());
@@ -478,8 +480,8 @@ Vector1 &MVProductDomain<Modular<uint16> >::mulColDenseSpecialized
 }
 
 template <class Vector1, class Matrix, class Vector2>
-Vector1 &MVProductDomain<Modular<uint16> >::mulColDenseSpecialized
-	(const VectorDomain<Modular<uint16> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+Vector1 &MVProductDomain<Modular<uint16_t> >::mulColDenseSpecialized
+	(const VectorDomain<Modular<uint16_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
 	 VectorCategories::SparseAssociativeVectorTag) const
 {
 	linbox_check (A.coldim () == v.size ());
@@ -489,8 +491,8 @@ Vector1 &MVProductDomain<Modular<uint16> >::mulColDenseSpecialized
 	typename Vector2::const_iterator j, j_end;
 	typename Matrix::Column::const_iterator k;
         // Dan Roche, 7-1-04
-        // std::vector<uint32>::iterator l, l_end;
-	std::vector<uint64>::iterator l, l_end;
+        // std::vector<uint32_t>::iterator l, l_end;
+	std::vector<uint64_t>::iterator l, l_end;
 
 	if (_tmp.size () < w.size ())
 		_tmp.resize (w.size ());
@@ -523,8 +525,8 @@ Vector1 &MVProductDomain<Modular<uint16> >::mulColDenseSpecialized
 }
 
 template <class Vector1, class Matrix, class Vector2>
-Vector1 &MVProductDomain<Modular<uint16> >::mulColDenseSpecialized
-	(const VectorDomain<Modular<uint16> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+Vector1 &MVProductDomain<Modular<uint16_t> >::mulColDenseSpecialized
+	(const VectorDomain<Modular<uint16_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
 	 VectorCategories::SparseParallelVectorTag) const
 {
 	linbox_check (A.coldim () == v.size ());
@@ -535,8 +537,8 @@ Vector1 &MVProductDomain<Modular<uint16> >::mulColDenseSpecialized
 	typename Matrix::Column::first_type::const_iterator k_idx;
 	typename Matrix::Column::second_type::const_iterator k_elt;
         // Dan Roche, 7-1-04
-        // std::vector<uint32>::iterator l, l_end;
-	std::vector<uint64>::iterator l, l_end;
+        // std::vector<uint32_t>::iterator l, l_end;
+	std::vector<uint64_t>::iterator l, l_end;
 
 	if (_tmp.size () < w.size ())
 		_tmp.resize (w.size ());
@@ -574,8 +576,8 @@ Vector1 &MVProductDomain<Modular<uint16> >::mulColDenseSpecialized
 }
 
 template <class Vector1, class Matrix, class Vector2>
-Vector1 &MVProductDomain<Modular<uint32> >::mulColDenseSpecialized
-	(const VectorDomain<Modular<uint32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+Vector1 &MVProductDomain<Modular<uint32_t> >::mulColDenseSpecialized
+	(const VectorDomain<Modular<uint32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
 	 VectorCategories::DenseVectorTag) const
 {
 	linbox_check (A.coldim () == v.size ());
@@ -584,9 +586,9 @@ Vector1 &MVProductDomain<Modular<uint32> >::mulColDenseSpecialized
 	typename Matrix::ConstColIterator i = A.colBegin ();
 	typename Vector2::const_iterator j;
 	typename Matrix::Column::const_iterator k;
-	std::vector<uint64>::iterator l;
+	std::vector<uint64_t>::iterator l;
 
-	uint64 t;
+	uint64_t t;
 
 	if (_tmp.size () < w.size ())
 		_tmp.resize (w.size ());
@@ -595,7 +597,7 @@ Vector1 &MVProductDomain<Modular<uint32> >::mulColDenseSpecialized
 
 	for (j = v.begin (); j != v.end (); ++j, ++i) {
 		for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
-			t = ((uint64) *k) * ((uint64) *j);
+			t = ((uint64_t) *k) * ((uint64_t) *j);
 
 			*l += t;
 
@@ -613,8 +615,8 @@ Vector1 &MVProductDomain<Modular<uint32> >::mulColDenseSpecialized
 }
 
 template <class Vector1, class Matrix, class Vector2>
-Vector1 &MVProductDomain<Modular<uint32> >::mulColDenseSpecialized
-	(const VectorDomain<Modular<uint32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+Vector1 &MVProductDomain<Modular<uint32_t> >::mulColDenseSpecialized
+	(const VectorDomain<Modular<uint32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
 	 VectorCategories::SparseSequenceVectorTag) const
 {
 	linbox_check (A.coldim () == v.size ());
@@ -623,9 +625,9 @@ Vector1 &MVProductDomain<Modular<uint32> >::mulColDenseSpecialized
 	typename Matrix::ConstColIterator i = A.colBegin ();
 	typename Vector2::const_iterator j;
 	typename Matrix::Column::const_iterator k;
-	std::vector<uint64>::iterator l;
+	std::vector<uint64_t>::iterator l;
 
-	uint64 t;
+	uint64_t t;
 
 	if (_tmp.size () < w.size ())
 		_tmp.resize (w.size ());
@@ -634,7 +636,7 @@ Vector1 &MVProductDomain<Modular<uint32> >::mulColDenseSpecialized
 
 	for (j = v.begin (); j != v.end (); ++j, ++i) {
 		for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
-			t = ((uint64) k->second) * ((uint64) *j);
+			t = ((uint64_t) k->second) * ((uint64_t) *j);
 
 			_tmp[k->first] += t;
 
@@ -652,8 +654,8 @@ Vector1 &MVProductDomain<Modular<uint32> >::mulColDenseSpecialized
 }
 
 template <class Vector1, class Matrix, class Vector2>
-Vector1 &MVProductDomain<Modular<uint32> >::mulColDenseSpecialized
-	(const VectorDomain<Modular<uint32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+Vector1 &MVProductDomain<Modular<uint32_t> >::mulColDenseSpecialized
+	(const VectorDomain<Modular<uint32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
 	 VectorCategories::SparseAssociativeVectorTag) const
 {
 	linbox_check (A.coldim () == v.size ());
@@ -662,9 +664,9 @@ Vector1 &MVProductDomain<Modular<uint32> >::mulColDenseSpecialized
 	typename Matrix::ConstColIterator i = A.colBegin ();
 	typename Vector2::const_iterator j;
 	typename Matrix::Column::const_iterator k;
-	std::vector<uint64>::iterator l;
+	std::vector<uint64_t>::iterator l;
 
-	uint64 t;
+	uint64_t t;
 
 	if (_tmp.size () < w.size ())
 		_tmp.resize (w.size ());
@@ -673,7 +675,7 @@ Vector1 &MVProductDomain<Modular<uint32> >::mulColDenseSpecialized
 
 	for (j = v.begin (); j != v.end (); ++j, ++i) {
 		for (k = i->begin (), l = _tmp.begin (); k != i->end (); ++k, ++l) {
-			t = ((uint64) k->second) * ((uint64) *j);
+			t = ((uint64_t) k->second) * ((uint64_t) *j);
 
 			_tmp[k->first] += t;
 
@@ -691,8 +693,8 @@ Vector1 &MVProductDomain<Modular<uint32> >::mulColDenseSpecialized
 }
 
 template <class Vector1, class Matrix, class Vector2>
-Vector1 &MVProductDomain<Modular<uint32> >::mulColDenseSpecialized
-	(const VectorDomain<Modular<uint32> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
+Vector1 &MVProductDomain<Modular<uint32_t> >::mulColDenseSpecialized
+	(const VectorDomain<Modular<uint32_t> > &VD, Vector1 &w, const Matrix &A, const Vector2 &v,
 	 VectorCategories::SparseParallelVectorTag) const
 {
 	linbox_check (A.coldim () == v.size ());
@@ -702,9 +704,9 @@ Vector1 &MVProductDomain<Modular<uint32> >::mulColDenseSpecialized
 	typename Vector2::const_iterator j;
 	typename Matrix::Column::first_type::const_iterator k_idx;
 	typename Matrix::Column::second_type::const_iterator k_elt;
-	std::vector<uint64>::iterator l;
+	std::vector<uint64_t>::iterator l;
 
-	uint64 t;
+	uint64_t t;
 
 	if (_tmp.size () < w.size ())
 		_tmp.resize (w.size ());
@@ -716,7 +718,7 @@ Vector1 &MVProductDomain<Modular<uint32> >::mulColDenseSpecialized
 		     k_idx != i->first.end ();
 		     ++k_idx, ++k_elt, ++l)
 		{
-			t = ((uint64) *k_elt) * ((uint64) *j);
+			t = ((uint64_t) *k_elt) * ((uint64_t) *j);
 
 			_tmp[*k_idx] += t;
 
@@ -735,5 +737,5 @@ Vector1 &MVProductDomain<Modular<uint32> >::mulColDenseSpecialized
 
 }
 
-#endif // __FIELD_MODULAR_INL
+#endif // __LINBOX_field_modular_INL
 
diff --git a/linbox/field/multimod-field.h b/linbox/field/multimod-field.h
index a015671..601543c 100644
--- a/linbox/field/multimod-field.h
+++ b/linbox/field/multimod-field.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/field/multimod-field.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -13,8 +13,8 @@
 
 
 
-#ifndef __LINBOX_MULTIMOD_FIELD_H
-#define __LINBOX_MULTIMOD_FIELD_H
+#ifndef __LINBOX_multimod_field_H
+#define __LINBOX_multimod_field_H
 
 
 #include "linbox/linbox-config.h"
@@ -24,52 +24,54 @@
 #include "linbox/field/field-traits.h"
 #include "linbox/util/field-axpy.h"
 #include "linbox/util/debug.h"
-#include <math.h>
+#include <cmath>
 #include <vector>
 
 
 
 
 // Namespace in which all LinBox code resides
-namespace LinBox { 
-	
+namespace LinBox
+{
+
 	class MultiModDouble;
 	class MultiModRandIter;
 
 	template <class Ring>
 	struct ClassifyRing;
-	
+
 	template <>
 	struct ClassifyRing<MultiModDouble>{
 		typedef RingCategories::ModularTag categoryTag;
 	};
-	
 
-	
 	class MultiModDouble : public FieldInterface {
-		
+
 	protected:
-		
-		std::vector<Modular<double> >              _fields;		
+
+		std::vector<Modular<double> >              _fields;
 		size_t                                       _size;
 		std::vector<integer>                 _crt_constant;
 		std::vector<double >                  _crt_inverse;
-		integer                                _crt_modulo; 
-	
+		integer                                _crt_modulo;
+
+
+	public:
 
-	public:	       
-		
 		friend class FieldAXPY<MultiModDouble>;
 		friend class DotProductDomain<MultiModDouble>;
 		friend class MultiModRandIter;
 
 		typedef std::vector<double>              Element;
 		typedef MultiModRandIter                RandIter;
-		
-		MultiModDouble (): _size(0) {}
 
-		MultiModDouble (const std::vector<integer> &primes) : _fields(primes.size()), _size(primes.size()),
-								      _crt_constant(primes.size()), _crt_inverse(primes.size()) 
+		MultiModDouble () :
+		       	_size(0)
+		{}
+
+		MultiModDouble (const std::vector<integer> &primes) :
+			_fields(primes.size()), _size(primes.size()),
+			_crt_constant(primes.size()), _crt_inverse(primes.size())
 		{
 			_crt_modulo=1;
 			for (size_t i=0; i<_size; ++i){
@@ -78,16 +80,17 @@ namespace LinBox {
 			}
 			double tmp;
 			for (size_t i=0; i<_size; ++i){
-				_crt_constant[i]= _crt_modulo/(integer)primes[i];	
+				_crt_constant[i]= _crt_modulo/(integer)primes[i];
 				_fields[i].init(tmp, _crt_constant[i]);
 				_fields[i].inv(_crt_inverse[i],tmp);
 			}
 
 		}
 
-		
-		MultiModDouble (const std::vector<double> &primes) : _fields(primes.size()), _size(primes.size()),
-								     _crt_constant(primes.size()), _crt_inverse(primes.size()) 
+
+		MultiModDouble (const std::vector<double> &primes) :
+			_fields(primes.size()), _size(primes.size()),
+			_crt_constant(primes.size()), _crt_inverse(primes.size())
 		{
 			_crt_modulo=1;
 			for (size_t i=0; i<_size; ++i){
@@ -96,18 +99,20 @@ namespace LinBox {
 			}
 			double tmp;
 			for (size_t i=0; i<_size; ++i){
-				_crt_constant[i]= _crt_modulo/(integer)primes[i];	
+				_crt_constant[i]= _crt_modulo/(integer)primes[i];
 				_fields[i].init(tmp, _crt_constant[i]);
 				_fields[i].inv(_crt_inverse[i],tmp);
-			}		
+			}
 		}
 
 
-		MultiModDouble(const MultiModDouble& F) : _fields(F._fields), _size(F._size),
-							  _crt_constant(F._crt_constant), _crt_inverse(F._crt_inverse),
-							  _crt_modulo(F._crt_modulo) {}
+		MultiModDouble(const MultiModDouble& F) :
+			_fields(F._fields), _size(F._size),
+			_crt_constant(F._crt_constant), _crt_inverse(F._crt_inverse),
+			_crt_modulo(F._crt_modulo) {}
 
-		const MultiModDouble &operator=(const MultiModDouble &F) {
+		const MultiModDouble &operator=(const MultiModDouble &F)
+		{
 			_fields       = F._fields;
 			_size         = F._size;
 			_crt_constant = F._crt_constant;
@@ -115,33 +120,37 @@ namespace LinBox {
 			_crt_inverse  = F._crt_inverse;
 			return *this;
 		}
-		
-	
-		size_t size() const 
+
+
+		size_t size() const
 		{return this->_size;}
-	
-		const Modular<double>& getBase(size_t i) const 
+
+		const Modular<double>& getBase(size_t i) const
 		{ return this->_fields[i]; }
 
-		double getModulo(size_t i) const 
+		double getModulo(size_t i) const
 		{ return this->_fields[i].modulus;}
-			
 
-		const integer& getCRTmodulo() const {return _crt_modulo;}	       
 
-		integer &cardinality (integer &c) const{ 
+		const integer& getCRTmodulo() const
+		{return _crt_modulo;}
+
+		integer &cardinality (integer &c) const
+		{
 			c=1;
 			for (size_t i=0; i<_size; ++i){
 				c*=_fields[i].modulus;
-			}				
+			}
 			return c;
 		}
 
-		integer &characteristic (integer &c) const {
+		integer &characteristic (integer &c) const
+		{
 			return c=integer(0);
 		}
 
-		integer &convert (integer &x, const Element &y) const { 
+		integer &convert (integer &x, const Element &y) const
+		{
 			x=0;
 			double tmp;
 			for (size_t i=0;i<_size; ++i){
@@ -154,30 +163,35 @@ namespace LinBox {
 			return x;
 		}
 
-		//double &convert (double &x, const Element& y) const {
-		//	return x=y;
-		//}
-		
-		std::ostream &write (std::ostream &os) const {
-		       os << "multimod double (";
-		       for (size_t i=0;i<_size-1;++i)
-			       os<<integer(_fields[i].modulus)<<",";
-		       os<<integer(_fields[_size-1].modulus)<<")\n";
-		       return os;
+#if 0
+		double &convert (double &x, const Element& y) const
+		{
+			return x=y;
 		}
-		
+#endif
+
+		std::ostream &write (std::ostream &os) const
+		{
+			os << "multimod double (";
+			for (size_t i=0;i<_size-1;++i)
+				os<<integer(_fields[i].modulus)<<",";
+			os<<integer(_fields[_size-1].modulus)<<")\n";
+			return os;
+		}
+
 		std::istream &read (std::istream &is) {
-			/*
-			is >> modulus; 
-			if(modulus <= 1) 
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be > 1");
-			if(modulus > 94906265) 
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus is too big");
-			*/
+#if 0
+			is >> modulus;
+			if(modulus <= 1)
+				throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus must be > 1");
+			if(modulus > 94906265)
+				throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus is too big");
+#endif
 			return is;
 		}
-		
-		std::ostream &write (std::ostream &os, const Element &x) const {
+
+		std::ostream &write (std::ostream &os, const Element &x) const
+		{
 			os<<"(";
 			for (size_t i=0;i<x.size()-1;++i)
 				os<<x[i]<<",";
@@ -185,229 +199,254 @@ namespace LinBox {
 			return os;
 		}
 
-		std::istream &read (std::istream &is, Element &x) const {
+		std::istream &read (std::istream &is, Element &x) const
+		{
 			integer tmp;
 			is >> tmp;
-			init(x,tmp); 
+			init(x,tmp);
 			return is;
 		}
-		
+
 
 		Element &init (Element &x, const integer &y) const  {
 			x.resize(_size);
 			for (size_t i=0;i<_size; ++i)
-				_fields[i].init(x[i], y);	
+				_fields[i].init(x[i], y);
 			return x;
 		}
 
-		inline Element& init(Element& x, double y =0) const {		  
+		inline Element& init(Element& x, double y =0) const
+		{
 			x.resize(_size);
 			for (size_t i=0;i<_size; ++i)
 				_fields[i].init(x[i], y);
 			return x;
 		}
 
-		
-		
-		inline Element& assign(Element& x, const Element& y) const {
+
+
+		inline Element& assign(Element& x, const Element& y) const
+		{
 			return x = y;
 		}
-		
-		
-		inline bool areEqual (const Element &x, const Element &y) const {
+
+
+		inline bool areEqual (const Element &x, const Element &y) const
+		{
 			return x == y;
 		}
 
-		inline  bool isZero (const Element &x) const {
+		inline  bool isZero (const Element &x) const
+		{
 			return x == std::vector<double> (_size, 0.);
 		}
-		
-		inline bool isOne (const Element &x) const {
-			return x == std::vector<double>(_size, 1.); 
+
+		inline bool isOne (const Element &x) const
+		{
+			return x == std::vector<double>(_size, 1.);
 		}
 
-		inline Element &add (Element &x, const Element &y, const Element &z) const {
+		inline Element &add (Element &x, const Element &y, const Element &z) const
+		{
 			for (size_t i=0;i<_size;++i) {
 				_fields[i].add(x[i], y[i], z[i]);
 			}
 			return x;
 		}
- 
-		inline Element &sub (Element &x, const Element &y, const Element &z) const {
+
+		inline Element &sub (Element &x, const Element &y, const Element &z) const
+		{
 			for (size_t i=0;i<_size;++i){
 				_fields[i].sub(x[i], y[i], z[i]);
-			}			
+			}
 			return x;
 		}
-		
-		inline Element &mul (Element &x, const Element &y, const Element &z) const {		
+
+		inline Element &mul (Element &x, const Element &y, const Element &z) const
+		{
 			for (size_t i=0;i<_size;++i){
 				_fields[i].mul(x[i], y[i], z[i]);
 			}
 			return x;
 		}
- 
-		inline Element &div (Element &x, const Element &y, const Element &z) const {
+
+		inline Element &div (Element &x, const Element &y, const Element &z) const
+		{
 			for (size_t i=0;i<_size;++i){
 				_fields[i].div(x[i], y[i], z[i]);
 			}
 			return x;
 		}
- 
-		inline Element &neg (Element &x, const Element &y) const {
+
+		inline Element &neg (Element &x, const Element &y) const
+		{
 			for (size_t i=0;i<_size;++i){
 				_fields[i].neg(x[i], y[i]);
 			}
 			return x;
 		}
- 
-		inline Element &inv (Element &x, const Element &y) const {
+
+		inline Element &inv (Element &x, const Element &y) const
+		{
 			for (size_t i=0;i<_size;++i){
 				_fields[i].inv(x[i], y[i]);
 			}
-			return x;		  		  
+			return x;
 		}
 
-		inline Element &axpy (Element &r, 
-				      const Element &a, 
-				      const Element &x, 
-				      const Element &y) const {
+		inline Element &axpy (Element &r,
+				      const Element &a,
+				      const Element &x,
+				      const Element &y) const
+		{
 			for (size_t i=0;i<_size;++i){
 				_fields[i].axpy(r[i], a[i], x[i], y[i]);
 			}				\
 			return r;
 		}
 
-		inline Element &addin (Element &x, const Element &y) const {
+		inline Element &addin (Element &x, const Element &y) const
+		{
 			for (size_t i=0;i<_size;++i){
 				_fields[i].addin(x[i], y[i]);
 			}
 			return x;
 		}
- 
-		inline Element &subin (Element &x, const Element &y) const {
+
+		inline Element &subin (Element &x, const Element &y) const
+		{
 			for (size_t i=0;i<_size;++i){
 				_fields[i].subin(x[i], y[i]);
-			}	
+			}
 			return x;
 		}
- 
-		inline Element &mulin (Element &x, const Element &y) const {
+
+		inline Element &mulin (Element &x, const Element &y) const
+		{
 			for (size_t i=0;i<_size;++i){
 				_fields[i].mulin(x[i], y[i]);
 			}
 			return x;
 		}
- 
-		inline Element &divin (Element &x, const Element &y) const {
+
+		inline Element &divin (Element &x, const Element &y) const
+		{
 			for (size_t i=0;i<_size;++i){
 				_fields[i].divin(x[i], y[i]);
 			}
 			return x;
 		}
- 
-		inline Element &negin (Element &x) const {
+
+		inline Element &negin (Element &x) const
+		{
 			for (size_t i=0;i<_size;++i){
 				_fields[i].negin(x[i]);
 			}
 			return x;
 		}
-		
-		inline Element &invin (Element &x) const {
+
+		inline Element &invin (Element &x) const
+		{
 			for (size_t i=0;i<_size;++i){
 				_fields[i].invin(x[i]);
 			}
 			return x;
 		}
-		
-		inline Element &axpyin (Element &r, const Element &a, const Element &x) const {
+
+		inline Element &axpyin (Element &r, const Element &a, const Element &x) const
+		{
 			for (size_t i=0;i<_size;++i){
 				_fields[i].axpyin(r[i], a[i], x[i]);
 			}
 			return r;
 		}
-		
+
 		static inline double getMaxModulus()
 		{ return 94906265.0; } // floor( 2^26.5 )
-		
+
 	};// end of class MultiModField
 
 	class MultiModRandIter {
-	
+
 	public:
-		
+
 		MultiModRandIter() {}
-		
+
 		MultiModRandIter(const MultiModDouble &F,
 				 const integer   &size=0,
-				 const integer   &seed=0) : _field(F), _size(size), _seed(seed), _randiter(F._size)
-		{			
+				 const integer   &seed=0) :
+			_field(F), _size(size), _seed(seed), _randiter(F._size)
+		{
 			for (size_t i=0;i< F._size;++i)
 				_randiter[i] = new Modular<double>::RandIter(F._fields[i],size,seed) ;
 		}
-		
+
 		~MultiModRandIter() {for  (size_t i=0;i< _randiter.size();++i) delete _randiter[i]; }
-			
-		const MultiModRandIter& operator= (const MultiModRandIter &R) {
+
+		const MultiModRandIter& operator= (const MultiModRandIter &R)
+		{
 			_seed  = R._seed;
 			_size  = R._size;
 			_field = R._field;
-			_randiter = R._randiter;				
+			_randiter = R._randiter;
 			return *this;
 		}
 
-		std::vector<double>& random(std::vector<double> &x) const { 			
+		std::vector<double>& random(std::vector<double> &x) const
+		{
 			for (size_t i=0;i<x.size();++i)
 				_randiter[i]->random(x[i]);
 			return x;
-		}						
-		
+		}
+
 	protected:
 		MultiModDouble        _field;
-		integer                _size;	
+		integer                _size;
 		integer                _seed;
 		std::vector<Modular<double>::RandIter*> _randiter;
-	};// end of class MultiModRandIter
 
-/*	
+	}; // end of class MultiModRandIter
+
+#if 0
 	template <>
 	class DotProductDomain<MultiModDouble > : private virtual VectorDomainBase<MultiModDouble> {
 	private:
 		//std::vector<double> _bound;
 		std::vector<size_t>  _nmax;
 		//double _invmod;
-	  
-	public:	  
+
+	public:
 		typedef std::vector<double> Element;
-		
-		DotProductDomain (const MultiModDouble &F)
-			: VectorDomainBase<MultiModDouble > (F) //, _invmod(1./_F.modulus) 
+
+		DotProductDomain (const MultiModDouble &F) :
+			VectorDomainBase<MultiModDouble > (F) //, _invmod(1./_F.modulus)
 		{
-				for (size_t i=0; i<F.size();++i){
-					//_bound[i]=  (double) (1<<53 - (int) (_F.getModulo(i)*_F.getModulo(i))))
-					_nmax[i] =  (size_t)floor((double(1<<26)* double(1<<26)*2.)/ (_F.getModulo(i) * _F.getModulo(i)));
-				}
+			for (size_t i=0; i<F.size();++i){
+				//_bound[i]=  (double) (1<<53 - (int) (_F.getModulo(i)*_F.getModulo(i))))
+				_nmax[i] =  (size_t)floor((double(1<<26)* double(1<<26)*2.)/ (_F.getModulo(i) * _F.getModulo(i)));
 			}
-	  
+		}
+
 	protected:
 		template <class Vector1, class Vector2>
-		inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const {
-			
+		inline Element &dotSpecializedDD (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
+
 			for (size_t k=0;k<_F.size();++k){
 				double y = 0.;
 				double t = 0.;
 				if (v1.size() < _nmax[k]) {
 					for (size_t i = 0; i< v1.size();++i)
-						y += v1[i][k] * v2[i][k] ;				
+						y += v1[i][k] * v2[i][k] ;
 					y = fmod(y, _F.getModulo(k));
 				}
-				else{			
+				else{
 					size_t i=0;
 					for (;i< v1.size()- _nmax[k] ;i=i+_nmax[k]){
 						for (size_t j=i;j<i+_nmax[k];++j)
 							y += v1[j][k] * v2[j][k];
 						t+=fmod(y, _F.getModulo(k));
-						y=0.;							
+						y=0.;
 					}
 					for (;i < v1.size();++i)
 						y += v1[i][k] * v2[i][k];
@@ -420,24 +459,25 @@ namespace LinBox {
 		}
 
 		template <class Vector1, class Vector2>
-		inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const {		  
-			
+		inline Element &dotSpecializedDSP (Element &res, const Vector1 &v1, const Vector2 &v2) const
+		{
+
 			for (size_t k=0;k<_F.size();++k){
 				double y = 0.;
 				double t =0.;
-								
+
 				if (v1.first.size() < _nmax[k]) {
 					for (size_t i=0;i<v1.first.size();++i)
 						y+= v1.second[i] * v2[v1.first[i]];
 					y = fmod(y, _F.getModulo(k));
 				}
-				else {			
+				else {
 					size_t i=0;
 					for (;i< v1.first.size()- _nmax[k] ;i=i+_nmax[k]){
 						for (size_t j=i;j<i+_nmax[k];++j)
 							y += v1.second[j] * v2[v1.first[j]];
 						t+=fmod(y, _F.getModulo(k));
-						y=0.;							
+						y=0.;
 					}
 					for (;i < v1.first.size();++i)
 						y += v1.second[i] * v2[v1.first[i]];
@@ -448,9 +488,10 @@ namespace LinBox {
 			return res;
 		}
 	};
-*/
+#endif
+
 }
 
 
+#endif // __LINBOX_multimod_field_H
 
-#endif
diff --git a/linbox/field/ntl-GF2E.h b/linbox/field/ntl-GF2E.h
index a93eae7..b77f873 100644
--- a/linbox/field/ntl-GF2E.h
+++ b/linbox/field/ntl-GF2E.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* linbox/field/ntl-z_pE.h
  * Copyright (C) 2004  Pascal Giorgi
  *
@@ -23,8 +24,8 @@
  */
 
 
-#ifndef __NTL_GF2E_H
-#define __NTL_GF2E_H
+#ifndef __LINBOX_ntl_gf2e_H
+#define __LINBOX_ntl_gf2e_H
 
 
 #include <linbox/util/debug.h>
@@ -37,14 +38,15 @@
 #include "linbox/linbox-config.h"
 #include <linbox/field/field-traits.h>
 
-namespace LinBox {
+namespace LinBox
+{
 
 	template <class Ring>
-	struct ClassifyRing; 
+	struct ClassifyRing;
 
 	template <class Element>
 	struct ClassifyRing<UnparametricRandIter<Element> >;
-	
+
 	template <>
 	struct ClassifyRing<UnparametricRandIter<NTL::GF2E> > {
 		typedef RingCategories::ModularTag categoryTag;
@@ -57,11 +59,11 @@ namespace LinBox {
 	{
 	public:
 		typedef NTL::GF2E Element;
-		UnparametricRandIter<NTL::GF2E>(const UnparametricField<NTL::GF2E>& F =UnparametricField<NTL::GF2E>(), 
-						 const size_t& size = 0,
-						 const size_t& seed = 0
-						 )
-			: _size(size), _seed(seed)
+		UnparametricRandIter<NTL::GF2E>(const UnparametricField<NTL::GF2E>& F =UnparametricField<NTL::GF2E>(),
+						const size_t& size = 0,
+						const size_t& seed = 0
+					       ) :
+			_size(size), _seed(seed)
 		{
 			if(_seed == 0)
 				NTL::SetSeed(NTL::to_ZZ(time(0)));
@@ -69,16 +71,16 @@ namespace LinBox {
 				NTL::SetSeed(NTL::to_ZZ(_seed));
 		}
 
-		UnparametricRandIter<NTL::GF2E>(const UnparametricRandIter<NTL::GF2E>& R)
-			: _size(R._size), _seed(R._seed) 
-	
+		UnparametricRandIter<NTL::GF2E>(const UnparametricRandIter<NTL::GF2E>& R) :
+			_size(R._size), _seed(R._seed)
+
 		{
 			if(_seed == 0)
 				NTL::SetSeed(NTL::to_ZZ(time(0)));
 			else
 				NTL::SetSeed(NTL::to_ZZ(_seed));
 		}
-      
+
 		Element& random (Element& x) const
 		{
 			NTL::random(x);
@@ -95,42 +97,54 @@ namespace LinBox {
 	/*
 	 * Define a parameterized class to easily handle UnparametricField<NTL::GF2E> field
 	 */
-	
- 	class NTL_GF2E : public UnparametricField<NTL::GF2E>
+
+	class NTL_GF2E : public UnparametricField<NTL::GF2E>
 	{
 	public:
-		NTL_GF2E (const integer &p, const integer &k) {	
-		  if(p != 2) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be 2");
-		  NTL::GF2X irredPoly = NTL::BuildSparseIrred_GF2X((long) k);
-		  NTL::GF2E::init(irredPoly);
+		NTL_GF2E (const integer &p, const integer &k)
+		{
+			if(p != 2) throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus must be 2");
+			NTL::GF2X irredPoly = NTL::BuildSparseIrred_GF2X((long) k);
+			NTL::GF2E::init(irredPoly);
 		}
-		
+
 	}; // end o class NTL_GF2E
-	
+
 
 	/*
 	 * Specialization of UnparametricField<> for NTL::GF2E type
 	 */
 	template<>
-	NTL::GF2E& UnparametricField<NTL::GF2E>::init (NTL::GF2E &x, const integer &y) const
+	//	NTL::GF2E& UnparametricField<NTL::GF2E>::init (NTL::GF2E &x, const integer &y) const
+	NTL::GF2E& Caster(NTL::GF2E &x, const integer &y)
 	{
 		x=NTL::to_GF2E(static_cast<long>(y));
 		return x;
 	}
-	
 	template<>
-	integer& UnparametricField<NTL::GF2E>::convert (integer& x, const NTL::GF2E &y) const	{
+	//	NTL::GF2E& UnparametricField<NTL::GF2E>::init (NTL::GF2E &x, const double &y) const
+	NTL::GF2E& Caster(NTL::GF2E &x, const double &y)
+	{
+		x=NTL::to_GF2E(static_cast<long>(y));
+		return x;
+	}
+
+
+	template<>
+	//	integer& UnparametricField<NTL::GF2E>::convert (integer& x, const NTL::GF2E &y) const	{
+	integer& Caster(integer& x, const NTL::GF2E &y)
+	{
 		NTL::GF2X poly = rep(y);
-		
-		long i;		
+
+		long i;
 		x = 0;
 		for(i = deg(poly); i >= 0; --i) {
-		  x <<= 1;
-		  x += rep(coeff(poly, i));
+			x <<= 1;
+			x += rep(coeff(poly, i));
 		}
 		return x;
 	}
-	
+
 
 
 	template<>
@@ -138,27 +152,27 @@ namespace LinBox {
 	{
 		return NTL::IsZero(a);
 	}
-  
+
 	template<>
 	bool UnparametricField<NTL::GF2E>::isOne (const NTL::GF2E& a) const
 	{
 		return NTL::IsOne(a);
 	}
-  
-  
+
+
 	template<>
 	integer& UnparametricField<NTL::GF2E>::characteristic (integer &c) const
 	{
-		return c = 2; 
+		return c = 2;
 	}
-  
+
 	template<>
 	integer& UnparametricField<NTL::GF2E>::cardinality(integer& c) const
-	  {
-	    c=1;
-	    c<<= NTL::GF2E::degree();
-	    return c;
-	  }
+	{
+		c=1;
+		c<<= NTL::GF2E::degree();
+		return c;
+	}
 
 
 	template<>
@@ -183,8 +197,9 @@ namespace LinBox {
 		x=NTL::to_GF2E(tmp);
 		return is;
 	}
-  
+
 
 }
 
-#endif
+#endif //__LINBOX_ntl_gf2e_H
+
diff --git a/linbox/field/ntl-RR.h b/linbox/field/ntl-RR.h
index 5b87e76..10df2a7 100644
--- a/linbox/field/ntl-RR.h
+++ b/linbox/field/ntl-RR.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/field/ntl-RR.h
  * Copyright (C) 1999-2005 William J Turner,
  *               2001 Bradford Hovinen
@@ -12,8 +12,8 @@
  * See COPYING for license information.
  */
 
-#ifndef __FIELD_NTL_RR_H
-#define __FIELD_NTL_RR_H
+#ifndef __LINBOX_field_ntl_rr_H
+#define __LINBOX_field_ntl_rr_H
 #include <NTL/tools.h>
 
 #include <NTL/RR.h>
@@ -25,7 +25,7 @@
 // Namespace in which all LinBox library code resides
 namespace LinBox
 {
-  
+
 	template <class Ring>
 	struct ClassifyRing;
 
@@ -41,14 +41,14 @@ namespace LinBox
 	//typedef UnparametricField<NTL::RR> NTL_RR;
 
 	/** @name class RR.
-	 \brief
-	 * Rational number field.  
-         * This field is provided as a convenience in a few places.  
-         * Use with caution because expression swell.
-         *
-	 * This specialization allows the \ref{UnparametricField} template class to be
+	  \brief
+	 * Rational number field.
+	 * This field is provided as a convenience in a few places.
+	 * Use with caution because expression swell.
+	 *
+	 * This specialization allows the \ref UnparametricField template class to be
 	 * used to wrap NTL's RR class as a LinBox field.
-	\ingroup field
+	 \ingroup field
 	 */
 	//@{
 
@@ -66,9 +66,23 @@ namespace LinBox
 	 * @param x field element to contain output (reference returned).
 	 * @param y integer.
 	 */
+	/*
+	   template <>
+	   NTL::RR& UnparametricField<NTL::RR>::init(NTL::RR& x, const integer& y) const
+	   { return x = NTL::to_RR(static_cast<const long&>(y)); }
+	   template <>
+	   NTL::RR& UnparametricField<NTL::RR>::init(NTL::RR& x, const double& y) const
+	   { return x = NTL::to_RR((long)(y)); }
+	   */
+	template <>
+	NTL::RR& Caster(NTL::RR& x, const integer& y)
+	{ return x = NTL::to_RR(static_cast<const long&>(y)); }
 	template <>
-		NTL::RR& UnparametricField<NTL::RR>::init(NTL::RR& x, const integer& y) const
-		{ return x = NTL::to_RR(static_cast<const long&>(y)); }
+	NTL::RR& Caster(NTL::RR& x, const double& y)
+	{ return x = NTL::to_RR((long)(y)); }
+	template <>
+	NTL::RR& Caster(NTL::RR& x, const int& y)
+	{ return x = NTL::to_RR((long)(y)); }
 
 	/** Conversion of field element to an integer.
 	 * This function assumes the output field element x has already been
@@ -82,9 +96,15 @@ namespace LinBox
 	 * @param x reference to integer to contain output (reference returned).
 	 * @param y constant reference to field element.
 	 */
+	/*
+	   template <>
+	   integer& UnparametricField<NTL::RR>::convert(integer& x, const NTL::RR& y) const
+	   { return x = static_cast<integer>(to_long(y)); }
+	   */
 	template <>
-		integer& UnparametricField<NTL::RR>::convert(integer& x, const NTL::RR& y) const
-		{ return x = static_cast<integer>(to_long(y)); }
+	integer& Caster(integer& x, const NTL::RR& y)
+	{ return x = static_cast<integer>(to_long(y)); }
+
 
 	/** Multiplicative Inverse.
 	 * x = 1 / y
@@ -94,10 +114,10 @@ namespace LinBox
 	 * @param  x field element (reference returned).
 	 * @param  y field element.
 	 */
-	template <> 
-		NTL::RR& UnparametricField<NTL::RR>::inv(NTL::RR& x, const NTL::RR& y) const
-		{ return x = NTL::inv(y); }
- 
+	template <>
+	NTL::RR& UnparametricField<NTL::RR>::inv(NTL::RR& x, const NTL::RR& y) const
+	{ return x = NTL::inv(y); }
+
 	/** Zero equality.
 	 * Test if field element is equal to zero.
 	 * This function assumes the field element has already been
@@ -107,7 +127,7 @@ namespace LinBox
 	 * @param  x field element.
 	 */
 	template <> bool UnparametricField<NTL::RR>::isZero(const NTL::RR& x) const
-		{ return static_cast<bool>(IsZero(x)); }
+	{ return static_cast<bool>(IsZero(x)); }
 
 	/** One equality.
 	 * Test if field element is equal to one.
@@ -118,7 +138,7 @@ namespace LinBox
 	 * @param  x field element.
 	 */
 	template <> bool UnparametricField<NTL::RR>::isOne(const NTL::RR& x) const
-		{ return static_cast<bool>(IsOne(x)); }
+	{ return static_cast<bool>(IsOne(x)); }
 
 	/** Inplace Multiplicative Inverse.
 	 * x = 1 / x
@@ -128,14 +148,14 @@ namespace LinBox
 	 * @param  x field element (reference returned).
 	 */
 	template <> NTL::RR& UnparametricField<NTL::RR>::invin(NTL::RR& x) const
-		{ return x = NTL::inv(x); }
+	{ return x = NTL::inv(x); }
 
 	/** Print field.
 	 * @return output stream to which field is written.
 	 * @param  os  output stream to which field is written.
 	 */
-	template <> std::ostream& UnparametricField<NTL::RR>::write(std::ostream& os) const 
-		{ return os << "unparameterized field NTL::RR"; }
+	template <> std::ostream& UnparametricField<NTL::RR>::write(std::ostream& os) const
+	{ return os << "unparameterized field NTL::RR"; }
 
 
 	/** Random field element creator.
@@ -143,32 +163,33 @@ namespace LinBox
 	 * at the creation of the generator.
 	 * This generator uses the built-in C++ random number generator instead of
 	 * NTL's random function because the NTL function does not allow as much
-	 * control over the sampling size as the generic LinBox template.  This 
-	 * specialization is included only to allow conversion to an NTL 
+	 * control over the sampling size as the generic LinBox template.  This
+	 * specialization is included only to allow conversion to an NTL
 	 * object.
 	 * @return random field element
 	 */
 	template <> NTL::RR& UnparametricRandIter<NTL::RR>::random(NTL::RR &elt) const
-		{
-			// Create new random elements
-			if (_size == 0)
-				elt = rand();
-			else
-				elt = static_cast<long>((double(rand())/RAND_MAX)*double(_size));
+	{
+		// Create new random elements
+		if (_size == 0)
+			elt = rand();
+		else
+			elt = static_cast<long>((double(rand())/RAND_MAX)*double(_size));
 
 #ifdef TRACE
-			double temp = elt;
-			cout << "random double = " << temp 
-			     << "    random NTL::RR = " << elt << endl;
+		double temp = elt;
+		cout << "random double = " << temp
+		<< "    random NTL::RR = " << elt << endl;
 #endif // TRACE
 
-			return elt;
-    
-		} // element& operator() (void)
+		return elt;
 
+	} // element& operator() (void)
 
 
-	//@} 
+
+	//@}
 } // namespace LinBox
 
-#endif // __FIELD_NTL_RR_H
+#endif // __LINBOX_field_ntl_rr_H
+
diff --git a/linbox/field/ntl-ZZ.h b/linbox/field/ntl-ZZ.h
old mode 100755
new mode 100644
index 4258402..1836e2b
--- a/linbox/field/ntl-ZZ.h
+++ b/linbox/field/ntl-ZZ.h
@@ -1,11 +1,33 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* File: ntl-ZZ.h
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) LinBox
  *  Author: Zhendong Wan
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/** @file field/ntl-ZZ.h
+ * @ingroup field
+ * @brief NO DOC
  */
 
-#ifndef __LINBOX_NTL_ZZ_H__
-#define __LINBOX_NTL_ZZ_H__
+#ifndef __LINBOX_ntl_zz_H
+#define __LINBOX_ntl_zz_H
 
 #include <NTL/ZZ.h>
 #include <linbox/integer.h>
@@ -14,7 +36,8 @@
 #include <linbox/randiter/ntl-ZZ.h>
 #include <linbox/field/field-traits.h>
 
-namespace LinBox {
+namespace LinBox
+{
 
 	template <class Ring>
 	struct ClassifyRing ;
@@ -22,69 +45,78 @@ namespace LinBox {
 	class NTL_ZZ;
 
 	template <>
-	struct ClassifyRing<NTL_ZZ> {
+	struct ClassifyRing<NTL_ZZ>
+	{
 		typedef RingCategories::IntegerTag categoryTag;
 	};
-	
+
 	template<class Field>
 	class FieldAXPY;
-	
+
 	/// \brief the integer ring. \ingroup ring
 	class NTL_ZZ {
-		
+
 	public:
 		typedef NTL_ZZRandIter RandIter;
 
 		typedef NTL::ZZ Element;
 
-		NTL_ZZ(int p = 0, int exp = 1) {
-			if( p != 0 ) throw PreconditionFailed(__FUNCTION__,__LINE__,"modulus must be 0 (no modulus)");
-			if( exp != 1 ) throw PreconditionFailed(__FUNCTION__,__LINE__,"exponent must be 1");
+		NTL_ZZ(int p = 0, int exp = 1)
+		{
+			if( p != 0 ) throw PreconditionFailed(__func__,__FILE__,__LINE__,"modulus must be 0 (no modulus)");
+			if( exp != 1 ) throw PreconditionFailed(__func__,__FILE__,__LINE__,"exponent must be 1");
 		}
 
-		inline integer& cardinality (integer& c) const {
+		inline integer& cardinality (integer& c) const
+		{
 			return c = -1;
 		}
-		
-		inline integer& characteristic (integer& c)const   {
+
+		inline integer& characteristic (integer& c)const
+		{
 			return c = 0;
 		}
 
-		std::ostream& write (std::ostream& out) const  {
+		std::ostream& write (std::ostream& out) const
+		{
 			return out << "NTL ZZ Ring";
 		}
 
-		std::istream& read (std::istream& in) const  {
+		std::istream& read (std::istream& in) const
+		{
 			return in;
 		}
-		
+
 		/** @brief
 		 *  Init x from y.
 		 */
 		template<class Element2>
-		inline Element& init (Element& x,  const Element2& y) const  {
-			
+		inline Element& init (Element& x,  const Element2& y) const
+		{
+
 			NTL::conv (x, y);
-			
+
 			return x;
 		}
 
 		/** @brief
 		 *   Init from a NTL::ZZ
-                 */
-                inline Element& init (Element& x, const Element& y) const {
-	
+		 */
+		inline Element& init (Element& x, const Element& y) const
+		{
+
 			x = y;
 
 			return x;
 		}
 
 		/** @brief
-		 *   Init from an int64
+		 *   Init from an int64_t
 		 */
-		inline Element& init (Element& x, const int64& y) const {
+		inline Element& init (Element& x, const int64_t& y) const
+		{
 			bool isNeg = false;
-			uint64 t;
+			uint64_t t;
 			if( y < 0 ) {
 				isNeg = true;
 				t = y * -1;
@@ -96,31 +128,34 @@ namespace LinBox {
 		}
 
 		/** @brief
-		 *   Init from a uint64
+		 *   Init from a uint64_t
 		 */
-		inline Element& init (Element& x, const uint64& y) const {
-			uint64 shift = (uint64)1 << 32;
-			uint32 temp = y % shift;
+		inline Element& init (Element& x, const uint64_t& y) const
+		{
+			uint64_t shift = (uint64_t)1 << 32;
+			uint32_t temp = y % shift;
 			NTL::conv (x,temp);
 			x <<= 32;
 			temp = y / shift;
 			x += temp;
 			return x;
-		} 
+		}
 
 		/** @brief
 		 *  I don't  know how to init from integer efficiently.
 		 */
-		 // c_str is safer than data, Z. W and BDS
-		inline Element& init (Element& x, const integer& y) const {
-	    
+		// c_str is safer than data, Z. W and BDS
+		inline Element& init (Element& x, const integer& y) const
+		{
+
 			return x=NTL::to_ZZ((std::string(y)).c_str());
 		}
-		
+
 		/** @brief
 		 *  Convert y to an Element.
 		 */
-		static inline integer& convert (integer& x, const Element& y){ 
+		inline integer& convert (integer& x, const Element& y) const
+		{
 			bool neg=false;
 			if (sign(y) <0)
 				neg=true;
@@ -128,61 +163,67 @@ namespace LinBox {
 			unsigned char* byteArray;
 			byteArray = new unsigned char[(size_t)b ];
 			BytesFromZZ(byteArray, y, b);
-	    
+
 			integer base(256);
 			x= integer(0);
-	    
+
 			for(long i = b - 1; i >= 0; --i) {
 				x *= base;
 				x += integer(byteArray[i]);
 			}
-			delete [] byteArray;		
+			delete [] byteArray;
 			if (neg)
 				x=-x;
 			return x;
 		}
-	  
-		static inline double& convert (double& x, const Element& y){
+
+		inline double& convert (double& x, const Element& y) const
+		{
 			return x=NTL::to_double(y);
 		}
 
-	  
-		
+
+
 		/** @brief
 		 *  x = y.
 		 */
-		inline Element&  assign (Element& x, const Element& y)  const {
+		inline Element&  assign (Element& x, const Element& y)  const
+		{
 			return x = y;
 		}
 
 		/** @brief
 		 *  Test if x == y
 		 */
-		inline bool areEqual (const Element& x ,const Element& y) const  {
+		inline bool areEqual (const Element& x ,const Element& y) const
+		{
 			return x == y;
 		}
 
 		/** @brief
 		 *  Test if x == 0
 		 */
-		inline bool isZero (const Element& x) const  {
+		inline bool isZero (const Element& x) const
+		{
 			return NTL::IsZero (x);
 		}
 
 		/** @brief
 		 *  Test if x == 1
 		 */
-		inline bool isOne (const Element& x) const  {
+		inline bool isOne (const Element& x) const
+		{
 			return NTL::IsOne (x);
 		}
-								
+
 		// arithmetic
-		
+
 		/** @brief
 		 *  return x = y + z
 		 */
-		inline Element& add (Element& x, const Element& y, const Element& z) const  {			
-			
+		inline Element& add (Element& x, const Element& y, const Element& z) const
+		{
+
 			NTL::add (x, y, z);
 
 			return x;
@@ -191,19 +232,21 @@ namespace LinBox {
 		/** @brief
 		 *  return x = y - z
 		 */
-		inline Element& sub (Element& x, const Element& y, const Element& z) const  {			
-			
+		inline Element& sub (Element& x, const Element& y, const Element& z) const
+		{
+
 			NTL::sub (x, y, z);
 
 			return x;
 		}
-			      
+
 		/** @brief
 		 *  return x = y * z
 		 */
 		template <class Int>
-		inline Element& mul (Element& x, const Element& y, const Int& z) const  {
-			
+		inline Element& mul (Element& x, const Element& y, const Int& z) const
+		{
+
 			NTL::mul (x, y, z);
 
 			return x;
@@ -213,7 +256,8 @@ namespace LinBox {
 		 *  If z divides y, return x = y / z,
 		 *  otherwise, throw an exception
 		 */
-		inline Element& div (Element& x, const Element& y, const Element& z) const {
+		inline Element& div (Element& x, const Element& y, const Element& z) const
+		{
 
 			Element q, r;
 
@@ -223,28 +267,30 @@ namespace LinBox {
 				return x = q;
 
 			else
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"Div: not dividable");
+				throw PreconditionFailed(__func__,__FILE__,__LINE__,"Div: not dividable");
 		}
-				
+
 		/** @brief
 		 *  If y is a unit, return x = 1 / y,
 		 *  otherwsie, throw an exception
 		 */
-		inline Element& inv (Element& x, const Element& y) const {
+		inline Element& inv (Element& x, const Element& y) const
+		{
 
 			if ( NTL::IsOne (y)) return x = y;
 
 			else if ( NTL::IsOne (-y)) return x = y;
-				
-			else 
-				throw PreconditionFailed(__FUNCTION__,__LINE__,"Inv: Not invertible");
+
+			else
+				throw PreconditionFailed(__func__,__FILE__,__LINE__,"Inv: Not invertible");
 		}
 
 		/** @brief
 		 *  return x = -y;
 		 */
-		inline Element& neg (Element& x, const Element& y) const  {
-			
+		inline Element& neg (Element& x, const Element& y) const
+		{
+
 			NTL::negate (x, y);
 
 			return x;
@@ -254,9 +300,9 @@ namespace LinBox {
 		/** @brief
 		 *  return r = a x + y
 		 */
-
 		template <class Int>
-		inline Element& axpy (Element& r, const Element& a, const Int& x, const Element& y) const  {
+		inline Element& axpy (Element& r, const Element& a, const Int& x, const Element& y) const
+		{
 
 			NTL::mul (r, a, x);
 
@@ -265,20 +311,22 @@ namespace LinBox {
 
 
 		// inplace operator
-		
+
 		/** @brief
 		 *  return x += y;
 		 */
-		inline Element& addin (Element& x, const Element& y) const {
-			
+		inline Element& addin (Element& x, const Element& y) const
+		{
+
 			return x += y;
 		}
-		
+
 		/** @brief
 		 *  return x -= y;
 		 */
-		inline Element& subin (Element& x, const Element& y)  const {
-			
+		inline Element& subin (Element& x, const Element& y)  const
+		{
+
 			return x -= y;
 		}
 
@@ -286,8 +334,9 @@ namespace LinBox {
 		 *  return x *= y;
 		 */
 		template<class Int>
-		inline Element& mulin (Element& x, const Int& y)  const {
-			
+		inline Element& mulin (Element& x, const Int& y)  const
+		{
+
 			return x *= y;
 		}
 
@@ -295,8 +344,9 @@ namespace LinBox {
 		 *  If y divides x, return x /= y,
 		 *  otherwise throw an exception
 		 */
-		inline Element& divin (Element& x, const Element& y) const {
-			
+		inline Element& divin (Element& x, const Element& y) const
+		{
+
 			div (x, x, y);
 
 			return x;
@@ -307,18 +357,19 @@ namespace LinBox {
 		 *  otherwise, throw an exception.
 		 */
 		inline Element& invin (Element& x) {
-			
+
 			if (NTL::IsOne (x)) return x;
-			
+
 			else if (NTL::IsOne (-x)) return x;
 
-			else throw PreconditionFailed(__FUNCTION__,__LINE__,"Div: not dividable");
-		}				
-		
+			else throw PreconditionFailed(__func__,__FILE__,__LINE__,"Div: not dividable");
+		}
+
 		/** @brief
 		 *  return x = -x;
 		 */
-		inline Element& negin (Element& x) const  {			
+		inline Element& negin (Element& x) const
+		{
 
 			NTL::negate (x, x);
 
@@ -329,21 +380,23 @@ namespace LinBox {
 		 *  return r += a x
 		 */
 		template <class Int>
-		inline Element& axpyin (Element& r, const Element& a, const Int& x) const  {
+		inline Element& axpyin (Element& r, const Element& a, const Int& x) const
+		{
 
 			return r += a * x;
 		}
 
-	
+
 		// IO
 
 		/** @brief
 		 *  out << y;
 		 */
-		std::ostream& write(std::ostream& out,const Element& y) const  {
+		std::ostream& write(std::ostream& out,const Element& y) const
+		{
 
 			out << y;
-			
+
 			return out;
 		}
 
@@ -351,38 +404,42 @@ namespace LinBox {
 		/** @brief
 		 *  read x from istream in
 		 */
-		std::istream& read(std::istream& in, Element& x) const {
-			
+		std::istream& read(std::istream& in, Element& x) const
+		{
+
 			return in >> x;
 		}
 
 
 		/** some PIR function
-		 */
+		*/
 
 		/** @brief
 		 *  Test if x is a unit.
 		 */
-		inline bool isUnit (const Element& x) const {
-			
+		inline bool isUnit (const Element& x) const
+		{
+
 			return (NTL::IsOne (x) || NTL::IsOne (-x));
 		}
-		
+
 		/** @brief
 		 *  return g = gcd (a, b)
 		 */
-		inline Element& gcd (Element& g, const Element& a, const Element& b) const {
-			
+		inline Element& gcd (Element& g, const Element& a, const Element& b) const
+		{
+
 			NTL::GCD (g, a, b);
 
 			return g;
 		}
-	
+
 		/** @brief
 		 *  return g = gcd (g, b)
 		 */
-		inline Element& gcdin (Element& g, const Element& b) const {
-			
+		inline Element& gcdin (Element& g, const Element& b) const
+		{
+
 			NTL::GCD (g, g, b);
 
 			return g;
@@ -394,8 +451,9 @@ namespace LinBox {
 		 *  Euclidean algorithm applied to |a| and |b|, with the signs then
 		 *  adjusted according to the signs of a and b.
 		 */
-		inline Element& xgcd (Element& g, Element& s, Element& t, const Element& a, const Element& b)const {
-			
+		inline Element& xgcd (Element& g, Element& s, Element& t, const Element& a, const Element& b)const
+		{
+
 			NTL::XGCD (g,s,t,a,b);
 
 			return g;
@@ -404,33 +462,35 @@ namespace LinBox {
 		/** @brief
 		 *  c = lcm (a, b)
 		 */
-		inline Element& lcm (Element& c, const Element& a, const Element& b) const {
-			
+		inline Element& lcm (Element& c, const Element& a, const Element& b) const
+		{
+
 
 			if (NTL::IsZero (a) || NTL::IsZero (b)) return c = NTL::ZZ::zero();
-			
+
 			else {
 				Element g;
-			
+
 				NTL::GCD (g, a, b);
-				
+
 				NTL::mul (c, a, b);
 
 				c /= g;
 
 				NTL::abs (c, c);
-			
+
 				return c;
 			}
 		}
-		
+
 		/** @brief
 		 *  l = lcm (l, b)
 		 */
-		inline Element& lcmin (Element& l, const Element& b) const {
+		inline Element& lcmin (Element& l, const Element& b) const
+		{
 
 			if (NTL::IsZero (l) || NTL::IsZero (b))
-				
+
 				return l = NTL::ZZ::zero();
 
 			else {
@@ -449,9 +509,9 @@ namespace LinBox {
 			}
 		}
 
-				       
 
-				
+
+
 
 		// some specail function
 
@@ -459,26 +519,28 @@ namespace LinBox {
 		 *  x = floor ( sqrt(y)).
 		 */
 
-		inline Element& sqrt (Element& x, const Element& y) const  {
-			
+		inline Element& sqrt (Element& x, const Element& y) const
+		{
+
 			NTL::SqrRoot(x,y);
-			
+
 			return x;
 		}
-		
+
 		/** @brief
 		 *  Requires 0 <= x < m, m > 2 * a_bound * b_bound,
 		 *  a_bound >= 0, b_bound > 0
-		 *   This routine either returns 0, leaving a and b unchanged, 
+		 *   This routine either returns 0, leaving a and b unchanged,
 		 *   or returns 1 and sets a and b so that
 		 *  (1) a = b x (mod m),
 		 *  (2) |a| <= a_bound, 0 < b <= b_bound, and
 		 *  (3) gcd(m, b) = gcd(a, b).
 		 */
-		
-		inline long reconstructRational (Element& a, Element& b, const Element& x, const Element& m, 
-							const Element& a_bound, const Element& b_bound) const {
-			
+
+		inline long reconstructRational (Element& a, Element& b, const Element& x, const Element& m,
+						 const Element& a_bound, const Element& b_bound) const
+		{
+
 			return NTL::ReconstructRational(a,b,x,m,a_bound,b_bound);
 		}
 
@@ -486,8 +548,9 @@ namespace LinBox {
 		/** @brief
 		 *  q = floor (x/y);
 		 */
-		inline Element& quo (Element& q, const Element& a, const Element& b) const {
-			
+		inline Element& quo (Element& q, const Element& a, const Element& b) const
+		{
+
 			NTL::div (q, a, b);
 
 			return q;
@@ -496,35 +559,39 @@ namespace LinBox {
 		/** @brief
 		 *  r = remindar of  a / b
 		 */
-		inline Element& rem (Element& r, const Element& a, const Element& b) const  {
-			
+		inline Element& rem (Element& r, const Element& a, const Element& b) const
+		{
+
 			NTL::rem (r, a, b);
-			
+
 			return r;
-		}	
+		}
 
 		/** @brief
 		 *  a = quotient (a, b)
 		 */
-		inline Element& quoin (Element& a, const Element& b) const  {
-			
+		inline Element& quoin (Element& a, const Element& b) const
+		{
+
 			return a /= b;
-			
+
 		}
 
 		/** @brief
 		 *  a = quotient (a, b)
 		 */
-		inline Element& remin (Element& x, const Element& y)  const {
+		inline Element& remin (Element& x, const Element& y)  const
+		{
 			return x %= y;
 		}
 
-		
+
 		/** @brief
 		 * q = [a/b], r = a - b*q
 		 * |r| < |b|, and if r != 0, sign(r) = sign(b)
 		 */
-		inline void quoRem (Element& q, Element& r, const Element& a, const Element& b) const {
+		inline void quoRem (Element& q, Element& r, const Element& a, const Element& b) const
+		{
 
 			NTL::DivRem(q,r,a,b);
 		}
@@ -532,15 +599,16 @@ namespace LinBox {
 		/** @brief
 		 *  Test if b | a.
 		 */
-		inline bool isDivisor (const Element& a, const Element& b) const {
-			
+		inline bool isDivisor (const Element& a, const Element& b) const
+		{
+
 			if ( NTL::IsZero (a) ) return true;
-			
+
 			else if (NTL::IsZero (b)) return false;
-			
+
 			else {
 				Element r;
-				
+
 				NTL::rem (r, a, b); //weird order changed, dpritcha 2004-07-19
 
 				return NTL::IsZero (r);
@@ -548,121 +616,138 @@ namespace LinBox {
 		}
 
 		/** compare two elements, a and b
-		  * return 1, if a > b
-		  * return 0, if a = b;
-		  * return -1. if a < b
-		  */
-		inline long compare (const Element& a, const Element& b) const {
+		 * return 1, if a > b
+		 * return 0, if a = b;
+		 * return -1. if a < b
+		 */
+		inline long compare (const Element& a, const Element& b) const
+		{
 
 			return NTL::compare (a, b);
 		}
 
 		/** return the absolute value
-		  * x = abs (a);
-		  */
-		inline Element& abs (Element& x, const Element& a) const {
+		 * x = abs (a);
+		 */
+		inline Element& abs (Element& x, const Element& a) const
+		{
 
 			NTL::abs (x, a);
 
 			return x;
 		}
-			
-		
-		static inline int getMaxModulus() { return 0; } // no modulus
-			
+
+
+		static inline int getMaxModulus()
+		{
+			return 0;
+		} // no modulus
+
 	};
-		
+
 
 	template<>
-	class FieldAXPY<NTL_ZZ>  {
+	class FieldAXPY<NTL_ZZ> {
 	public:
 		typedef NTL_ZZ Field;
 		typedef Field::Element Element;
 
 		/** Constructor.
-                 * A faxpy object if constructed from a Field and a field element.
-                 * Copies of this objects are stored in the faxpy object.
-                 * @param F field F in which arithmetic is done
-                 */
-                FieldAXPY (const Field &F) : _F (F) { _y = 0; }
- 
-                /** Copy constructor.
-                 * @param faxpy
-                 */
-                FieldAXPY (const FieldAXPY<Field> &faxpy) : _F (faxpy._F), _y (faxpy._y) {}
- 
-                /** Assignment operator
-                 * @param faxpy
-                 */
-                FieldAXPY<Field> &operator = (const FieldAXPY &faxpy)
-		{ _y = faxpy._y; return *this; }
- 
-                /** Add a*x to y
-                 * y += a*x.
-                 * @param a constant reference to element a
-                 * @param x constant reference to element x
+		 * A faxpy object if constructed from a Field and a field element.
+		 * Copies of this objects are stored in the faxpy object.
+		 * @param F field F in which arithmetic is done
+		 */
+		FieldAXPY (const Field &F) :
+			_F (F)
+		{
+			_y = 0;
+		}
+
+		/** Copy constructor.
+		 * @param faxpy
+		 */
+		FieldAXPY (const FieldAXPY<Field> &faxpy) :
+			_F (faxpy._F), _y (faxpy._y)
+		{}
+
+		/** Assignment operator
+		 * @param faxpy
+		 */
+		FieldAXPY<Field> &operator = (const FieldAXPY &faxpy)
+		{
+			_y = faxpy._y;
+			return *this;
+		}
+
+		/** Add a*x to y
+		 * y += a*x.
+		 * @param a constant reference to element a
+		 * @param x constant reference to element x
 		 * allow optimal multiplication, such as integer * int
-                 */
+		 */
 		template<class Element1>
-                inline Element& mulacc  (const Element &a, const Element1 &x)
+		inline Element& mulacc  (const Element &a, const Element1 &x)
 		{
-			return _y += a * x; 
+			return _y += a * x;
 		}
 
-                inline Element& accumulate (const Element &t)
+		inline Element& accumulate (const Element &t)
 		{
-			return _y += t; 
+			return _y += t;
 		}
 
 		/** Add a*x to y
-                 * y += a*x.
-                 * @param a constant reference to element a
-                 * @param x constant reference to element x
-                 * allow optimal multiplication, such as integer * int
-                 */
-                template<class Element1>
-                inline Element& mulacc (const Element1 &a, const Element &x)
-                {
-                        return _y += a * x;
-                }
-
-		inline Element& mulacc (const Element& a, const Element& b) {
+		 * y += a*x.
+		 * @param a constant reference to element a
+		 * @param x constant reference to element x
+		 * allow optimal multiplication, such as integer * int
+		 */
+		template<class Element1>
+		inline Element& mulacc (const Element1 &a, const Element &x)
+		{
+			return _y += a * x;
+		}
+
+		inline Element& mulacc (const Element& a, const Element& b)
+		{
 
 			return _y += a * b;
 		}
 
- 
-                /** Retrieve y
-                 *
-                 * Performs the delayed modding out if necessary
-                 */
-                inline Element &get (Element &y) { y = _y; return y; }
- 
-                /** Assign method.
-                 * Stores new field element for arithmetic.
-                 * @return reference to self
-                 * @param y_init constant reference to element a
-                 */
-                inline FieldAXPY &assign (const Element& y)
-                {
-                        _y = y;
-                        return *this;
-                }
-		
-		inline void reset() {
+
+		/** Retrieve y
+		 *
+		 * Performs the delayed modding out if necessary
+		 */
+		inline Element &get (Element &y) { y = _y; return y; }
+
+		/** Assign method.
+		 * Stores new field element for arithmetic.
+		 * @return reference to self
+		 * @param y constant reference to element a
+		 */
+		inline FieldAXPY &assign (const Element& y)
+		{
+			_y = y;
+			return *this;
+		}
+
+		inline void reset()
+		{
 			_y = 0;
 		}
-			
+
 	private:
- 
-                /// Field in which arithmetic is done
-                /// Not sure why it must be mutable, but the compiler complains otherwise
-                Field _F;
- 
-                /// Field element for arithmetic
-                Element _y;
+
+		/// Field in which arithmetic is done
+		/// Not sure why it must be mutable, but the compiler complains otherwise
+		Field _F;
+
+		/// Field element for arithmetic
+		Element _y;
 
 	};
 }
 
-#endif
+#endif //__LINBOX_ntl_zz_H
+
diff --git a/linbox/field/ntl-ZZ_p.h b/linbox/field/ntl-ZZ_p.h
index 72f0c36..7cc2f11 100644
--- a/linbox/field/ntl-ZZ_p.h
+++ b/linbox/field/ntl-ZZ_p.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/field/ntl.h
  * Copyright (C) 1999-2005 William J Turner,
  *               2001 Bradford Hovinen
@@ -12,8 +12,18 @@
  * See COPYING for license information.
  */
 
-#ifndef __FIELD_NTL_ZZ_p_H
-#define __FIELD_NTL_ZZ_p_H
+/*! @file field/ntl-ZZ_p.h
+ * @ingroup field
+ * @ingroup NTL
+ * @brief NO DOC
+ */
+
+#ifndef __LINBOX_field_ntl_z_p_H
+#define __LINBOX_field_ntl_z_p_H
+
+#ifndef __LINBOX_HAVE_NTL
+#error "you need NTL here"
+#endif
 
 #include <sys/time.h>
 #include "linbox/linbox-config.h"
@@ -26,13 +36,14 @@
 
 
 // Namespace in which all LinBox library code resides
-namespace LinBox{ 
+namespace LinBox
+{
 
 	template <class Ring>
 	struct ClassifyRing;
 
 
- 	template <>
+	template <>
 	struct ClassifyRing<UnparametricField<NTL::ZZ_p> > {
 		typedef RingCategories::ModularTag categoryTag;
 	};
@@ -46,17 +57,17 @@ namespace LinBox{
 	 * valid for any modulus, only prime moduli are supported in this
 	 * implementation.  The primality of the modulus will not be checked, so
 	 * it is the programmer's responsibility to supply a prime modulus.
-	 * These specializations allow the \ref{UnparametricField} template class to be
-	 * used to wrap NTL's {\tt ZZ\_p} class as a LinBox field.
+	 * These specializations allow the \ref UnparametricField template class to be
+	 * used to wrap NTL's <code>ZZ_p</code> class as a LinBox field.
 	 */
 
 	template<>
 	UnparametricField<NTL::ZZ_p>::UnparametricField(integer q, size_t e)
-	{    
+	{
 		// no default - allow initialization of ZZ_p directly by user.
 		//if(q==0) q=65521;   //set default value to 65521
 		if ( q > 0 )
-		NTL::ZZ_p::init(NTL::to_ZZ((std::string(q)).data())); // it's an error if q not prime, e not 1
+			NTL::ZZ_p::init(NTL::to_ZZ((std::string(q)).data())); // it's an error if q not prime, e not 1
 		//
 	}
 
@@ -72,13 +83,36 @@ namespace LinBox{
 	 \ingroup field
 	 */
 	template <>
-	NTL::ZZ_p& UnparametricField<NTL::ZZ_p>::init(NTL::ZZ_p& x, const integer& y) const
+	//	NTL::ZZ_p& UnparametricField<NTL::ZZ_p>::init(NTL::ZZ_p& x, const integer& y) const
+	NTL::ZZ_p& Caster(NTL::ZZ_p& x, const integer& y)
 	{
 		return x = NTL::to_ZZ_p( NTL::to_ZZ( (static_cast<const std::string>(y)).c_str() ) );
 	}
+	template <>
+	//	NTL::ZZ_p& UnparametricField<NTL::ZZ_p>::init(NTL::ZZ_p& x, const double& y) const
+	NTL::ZZ_p& Caster(NTL::ZZ_p& x, const double& y)
+	{
+		return x = NTL::to_ZZ_p( NTL::to_ZZ((long)(y) ) );
+	}
+	template <>
+	NTL::ZZ_p& Caster(NTL::ZZ_p& x, const int& y)
+	{
+		return x = NTL::to_ZZ_p( NTL::to_ZZ((long)(y) ) );
+	}
+	template <>
+	NTL::ZZ_p& Caster(NTL::ZZ_p& x, const unsigned long& y)
+	{
+		return x = NTL::to_ZZ_p( NTL::to_ZZ((long)(y) ) );
+	}
+	template <>
+	NTL::ZZ_p& Caster(NTL::ZZ_p& x, const unsigned int& y)
+	{
+		return x = NTL::to_ZZ_p( NTL::to_ZZ((long)(y) ) );
+	}
+
+
 
 
-  
 	//@} doc of NTL_ZZ_p
 
 	//@{
@@ -93,17 +127,18 @@ namespace LinBox{
 	 */
 
 	template <>
-	integer& UnparametricField<NTL::ZZ_p>::convert(integer& x, const NTL::ZZ_p& y) const
- 	{ 
-		NTL::ZZ iy = y._ZZ_p__rep; 
-		
+	//	integer& UnparametricField<NTL::ZZ_p>::convert(integer& x, const NTL::ZZ_p& y) const
+	integer& Caster(integer& x, const NTL::ZZ_p& y)
+	{
+		NTL::ZZ iy = y._ZZ_p__rep;
+
 		long nb = NTL::NumBytes(iy);
 		unsigned char *txt;
 		typedef unsigned char u_char;
 		txt = new u_char[nb + 68];
 		// 			   if (!txt) Error("out of memory");
 		BytesFromZZ(txt, iy, nb);
-		
+
 		x = 0;
 		for (long i = 0; i < nb; i++) {
 			x += LinBox::integer( (unsigned long)txt[i] )<<(8*i) ;
@@ -113,9 +148,10 @@ namespace LinBox{
 	}
 
 	//dpritcha
-	template<> 
-	double& UnparametricField<NTL::ZZ_p>::convert(double& x, const NTL::ZZ_p& y) const
-	{ 
+	template<>
+	//	double& UnparametricField<NTL::ZZ_p>::convert(double& x, const NTL::ZZ_p& y) const
+	double& Caster(double& x, const NTL::ZZ_p& y)
+	{
 		x = NTL::to_double(NTL::rep(y));
 		return x;
 	}
@@ -125,7 +161,7 @@ namespace LinBox{
 	 * Returns the modulus of the field, which should be prime.
 	 * @return integer representing cardinality of the field
 	 */
-	template <> 
+	template <>
 	integer& UnparametricField<NTL::ZZ_p>::cardinality(integer& c) const
 	{ return c = static_cast<integer>(to_long(NTL::ZZ_p::modulus())); }
 
@@ -134,10 +170,10 @@ namespace LinBox{
 	 * Returns the modulus of the field, which should be prime.
 	 * @return integer representing characteristic of the field.
 	 */
-	template <> 
+	template <>
 	integer& UnparametricField<NTL::ZZ_p>::characteristic(integer& c) const
-		//FIXME we shouldn't go thru long here as p may be larger than that.
-		// check if NTL has cast ZZp to gmp integers.
+	//FIXME we shouldn't go thru long here as p may be larger than that.
+	// check if NTL has cast ZZp to gmp integers.
 	{ return c = static_cast<integer>(to_long(NTL::ZZ_p::modulus())); }
 
 	/** Multiplicative Inverse.
@@ -148,10 +184,10 @@ namespace LinBox{
 	 * @param  x field element (reference returned).
 	 * @param  y field element.
 	 */
-	template <> NTL::ZZ_p& 
+	template <> NTL::ZZ_p&
 	UnparametricField<NTL::ZZ_p>::inv(NTL::ZZ_p& x, const NTL::ZZ_p& y) const
 	{ return x = NTL::inv(y); }
- 
+
 	/** Zero equality.
 	 * Test if field element is equal to zero.
 	 * This function assumes the field element has already been
@@ -189,31 +225,31 @@ namespace LinBox{
 	 * @return output stream to which field is written.
 	 * @param  os  output stream to which field is written.
 	 */
-	template <> std::ostream& UnparametricField<NTL::ZZ_p>::write(std::ostream& os) const 
-	{ 
-		return os << "unparameterized field NTL::ZZ_p with p = " 
-			  << NTL::ZZ_p::modulus(); 
+	template <> std::ostream& UnparametricField<NTL::ZZ_p>::write(std::ostream& os) const
+	{
+		return os << "unparameterized field NTL::ZZ_p with p = "
+		<< NTL::ZZ_p::modulus();
 	}
 
 	/// Constructor for random field element generator
-	template <> 
-	UnparametricRandIter<NTL::ZZ_p>::UnparametricRandIter (const UnparametricField<NTL::ZZ_p>& F, 
-							       const integer& size, 
-							       const integer& seed)
-		: _size(size), _seed(seed)
+	template <>
+	UnparametricRandIter<NTL::ZZ_p>::UnparametricRandIter (const UnparametricField<NTL::ZZ_p>& F,
+							       const integer& size,
+							       const integer& seed) :
+		_size(size), _seed(seed)
 	{
 		if (_seed == integer(0)) _seed = integer(time(NULL));
-		
-		integer cardinality; 
+
+		integer cardinality;
 		F.cardinality(cardinality);
 		if (_size > cardinality)
 			_size = 0;
 
 #ifdef TRACE
-		std::cout << "created random generator with size " << _size 
-		     << " and seed " << _seed << std::endl;
+		std::cout << "created random generator with size " << _size
+		<< " and seed " << _seed << std::endl;
 #endif // TRACE
-		
+
 		// Seed random number generator
 		NTL::SetSeed(NTL::to_ZZ(static_cast<long>(_seed)));
 	}
@@ -221,10 +257,10 @@ namespace LinBox{
 
 	/// Random field element creator.
 	template <> NTL::ZZ_p& UnparametricRandIter<NTL::ZZ_p>::random(NTL::ZZ_p& x) const
-		//		{ return x = static_cast<long>((double(rand())/RAND_MAX)*double(_size)); }
+	//		{ return x = static_cast<long>((double(rand())/RAND_MAX)*double(_size)); }
 	{
 		if (_size == 0) {
-			return x = NTL::random_ZZ_p(); 
+			return x = NTL::random_ZZ_p();
 		}
 		else {
 			return x = NTL::to_ZZ_p(NTL::RandomBnd(static_cast<long>(_size)));
@@ -232,19 +268,20 @@ namespace LinBox{
 	}
 
 
- 	/***************************************************************
-         *								
-         * @brief Wrapper of zz_p from NTL.	  			
-         * Uses nice mod p via floating pt trick.			
-         *								
-         */		
-        struct NTL_ZZ_p: public UnparametricField<NTL::ZZ_p>{
-		NTL_ZZ_p(integer p, size_t e = 1) 
-			: UnparametricField<NTL::ZZ_p>(p, e)
-                {}
-            
+	/**
+	 *
+	 * @brief Wrapper of zz_p from NTL.
+	 * Uses nice mod p via floating pt trick.
+	 *
+	 */
+	struct NTL_ZZ_p: public UnparametricField<NTL::ZZ_p> {
+
+		NTL_ZZ_p(integer p, size_t e = 1) :
+			UnparametricField<NTL::ZZ_p>(p, e)
+		{}
+
 		NTL::ZZ_p& init(NTL::ZZ_p& x, const integer& y) const
-		{ 
+		{
 			return UnparametricField<NTL::ZZ_p>::init(x,y);
 		}
 
@@ -255,28 +292,28 @@ namespace LinBox{
 			else z -= 0.5;
 			return x = NTL::to_ZZ_p(static_cast<long>(z)); //rounds towards 0
 		}
-		
-                /** Specialization for NTL::ZZ
-                 *
-                 * @return reference to field element.
-                 * @param x field element to contain output (reference returned)
-                 * @param y NTL::ZZ.
-                 */
+
+		/** Specialization for NTL::ZZ
+		 *
+		 * @return reference to field element.
+		 * @param x field element to contain output (reference returned)
+		 * @param y NTL::ZZ.
+		 */
 		NTL::ZZ_p& init(NTL::ZZ_p& x, const NTL::ZZ& y) const
-		{ 
+		{
 			return x = NTL::to_ZZ_p( y );
 		}
-            
-                /** Specialization for NTL::ZZ
-                 *
-                 * @return reference to  NTL::ZZ
-                 * @param x  NTL::ZZ to contain output (reference returned).
-                 * @param y constant reference to field element.
-                 */
+
+		/** Specialization for NTL::ZZ
+		 *
+		 * @return reference to  NTL::ZZ
+		 * @param x  NTL::ZZ to contain output (reference returned).
+		 * @param y constant reference to field element.
+		 */
 		NTL::ZZ& convert(NTL::ZZ& x, const NTL::ZZ_p& y) const
-		{ 
+		{
 			return x = y._ZZ_p__rep;
-                }
+		}
 
 		/** Conversion of field element to an integer.
 		 * This function assumes the output field element x has already been
@@ -287,16 +324,16 @@ namespace LinBox{
 		 * @param y constant reference to field element.
 		 */
 		integer& convert(integer& x, const NTL::ZZ_p& y) const
-		{ 
-			NTL::ZZ iy = y._ZZ_p__rep; 
-			
+		{
+			NTL::ZZ iy = y._ZZ_p__rep;
+
 			long nb = NTL::NumBytes(iy);
 			unsigned char *txt;
 			typedef unsigned char u_char;
 			txt = new u_char[nb + 68];
 			// 			   if (!txt) Error("out of memory");
 			BytesFromZZ(txt, iy, nb);
-			
+
 			x = 0;
 			for (long i = 0; i < nb; i++) {
 				x += LinBox::integer( (unsigned long)txt[i] )<<(8*i) ;
@@ -304,34 +341,36 @@ namespace LinBox{
 			delete [] txt;
 			return x;
 		};
-		
+
 		double& convert(double& x, const NTL::ZZ_p& y) const
-		{ 
+		{
 			x = NTL::to_double(NTL::rep(y));
 			return x;
 		}
 
 		template <class ANY> //dpritcha--FIX
 		NTL::ZZ_p& init(NTL::ZZ_p& x, const ANY& y) const
-		{ return x = NTL::to_ZZ_p(static_cast<const long&>(y)); }
+		{ return x = NTL::to_ZZ_p((long)(y)); }
 
 		template <class ANY>
 		ANY& convert(ANY& x, const NTL::ZZ_p& y) const
-		{ return x = static_cast<ANY>(rep(y)); }
+		{ return x = (ANY)(rep(y)); }
 
 		static inline integer getMaxModulus()
 		{ return integer( -1 ); }
 
-		NTL::ZZ_p& pow( NTL::ZZ_p& res, const NTL::ZZ_p& x, long exp ) const {
+		NTL::ZZ_p& pow( NTL::ZZ_p& res, const NTL::ZZ_p& x, long exp ) const
+		{
 			NTL::power( res, x, exp );
 			return res;
 		}
 
-		NTL::ZZ_p& powin( NTL::ZZ_p& x, long exp ) const {
+		NTL::ZZ_p& powin( NTL::ZZ_p& x, long exp ) const
+		{
 			return x = NTL::power(x,exp);
 		}
-            
-        };
+
+	};
 
 	template <>
 	struct ClassifyRing<NTL_ZZ_p>  {
@@ -343,4 +382,5 @@ namespace LinBox{
 
 } // namespace LinBox
 
-#endif // __FIELD_NTL_ZZ_p_H
+#endif // __LINBOX_field_ntl_zz_p_H
+
diff --git a/linbox/field/ntl-ZZ_pE.h b/linbox/field/ntl-ZZ_pE.h
index 92bda97..5317d8b 100644
--- a/linbox/field/ntl-ZZ_pE.h
+++ b/linbox/field/ntl-ZZ_pE.h
@@ -1,3 +1,28 @@
+/* -*- 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
+/* Copyright (C) LinBox
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_field_ntl_zz_pe_H
+#define __LINBOX_field_ntl_zz_pe_H
+
 #include <linbox/field/unparametric.h>
 #include <linbox/randiter/unparametric.h>
 #include <NTL/ZZ_pXFactoring.h>
@@ -17,11 +42,11 @@
 #include <string>
 #include <vector>
 
-#endif
+#endif //__LINBOX_XMLENABLED
 
 namespace LinBox
 {
-	
+
 	template <class Ring>
 	struct ClassifyRing;
 
@@ -30,290 +55,303 @@ namespace LinBox
 		typedef RingCategories::ModularTag categoryTag;
 	};
 
-  template<>
-  class UnparametricRandIter<NTL::ZZ_pE>
-    {
-    public:
-      typedef NTL::ZZ_pE Element;
-      UnparametricRandIter<NTL::ZZ_pE>(const UnparametricField<NTL::ZZ_pE>& F =UnparametricField<NTL::ZZ_pE>(), 
-				       const size_t& size = 0,
-				       const size_t& seed = 0
-				       )
-	: _size(size), _seed(seed)
+	template<>
+	class UnparametricRandIter<NTL::ZZ_pE>
 	{
-	  if(_seed == 0)
-	    NTL::SetSeed(NTL::to_ZZ(time(0)));
-	  else
-	    NTL::SetSeed(NTL::to_ZZ(_seed));
-	}
+	public:
+		typedef NTL::ZZ_pE Element;
+		UnparametricRandIter<NTL::ZZ_pE>(const UnparametricField<NTL::ZZ_pE>& F =UnparametricField<NTL::ZZ_pE>(),
+						 const size_t& size = 0,
+						 const size_t& seed = 0
+						) :
+			_size(size), _seed(seed)
+		{
+			if(_seed == 0)
+				NTL::SetSeed(NTL::to_ZZ(time(0)));
+			else
+				NTL::SetSeed(NTL::to_ZZ(_seed));
+		}
 
 #ifdef __LINBOX_XMLENABLED
-	UnparametricRandIter(LinBox::Reader &R) {
-		if(!R.expectTagName("randiter")) return;
-		if(!R.expectAttributeNum("seed", _seed) || !R.expectAttributeNum("size", _size)) return;
+		UnparametricRandIter(LinBox::Reader &R)
+		{
+			if(!R.expectTagName("randiter")) return;
+			if(!R.expectAttributeNum("seed", _seed) || !R.expectAttributeNum("size", _size)) return;
 
-		if(_seed == 0) _seed = time(NULL);
+			if(_seed == 0) _seed = time(NULL);
 
-		NTL::SetSeed(NTL::to_ZZ(_seed));
-	}
+			NTL::SetSeed(NTL::to_ZZ(_seed));
+		}
 #endif
 
-      
-      UnparametricRandIter<NTL::ZZ_pE>(const UnparametricRandIter<NTL::ZZ_pE>& R)
-	: _size(R._size), _seed(R._seed) 
-	
+
+		UnparametricRandIter<NTL::ZZ_pE>(const UnparametricRandIter<NTL::ZZ_pE>& R) :
+			_size(R._size), _seed(R._seed)
+
+		{
+			if(_seed == 0)
+				NTL::SetSeed(NTL::to_ZZ(time(0)));
+			else
+				NTL::SetSeed(NTL::to_ZZ(_seed));
+		}
+		Element& random (Element& x) const
+		{
+			NTL::random(x);
+			return x;
+		}
+
+	protected:
+		size_t _size;
+		size_t _seed;
+	};
+}
+
+namespace LinBox
+{
+
+	/*
+	 * Define a parameterized class to handle easily UnparametricField<NTL::ZZ_pE> field
+	 */
+	class NTL_ZZ_pE : public UnparametricField<NTL::ZZ_pE> {
+	public:
+		NTL_ZZ_pE (const integer &p, const integer &k)
+		{
+
+			NTL::ZZ_p::init(NTL::to_ZZ(std::string(p).data()));
+			NTL::ZZ_pX irredPoly = NTL::BuildIrred_ZZ_pX ((long) k);
+			NTL::ZZ_pE::init(irredPoly);
+		}
+
+	}; // end o class NTL_ZZ_pE
+
+
+
+
+
+	template<>
+	//    NTL::ZZ_pE& UnparametricField<NTL::ZZ_pE>::init (NTL::ZZ_pE &x, const integer &y) const
+	NTL::ZZ_pE& Caster(NTL::ZZ_pE &x, const integer &y)
 	{
-	  if(_seed == 0)
-	    NTL::SetSeed(NTL::to_ZZ(time(0)));
-	  else
-	    NTL::SetSeed(NTL::to_ZZ(_seed));
+		x=NTL::to_ZZ_pE(static_cast<long>(y));
+		return x;
 	}
-      Element& random (Element& x) const 
+	template<>
+	//    NTL::ZZ_pE& UnparametricField<NTL::ZZ_pE>::init (NTL::ZZ_pE &x, const double &y) const
+	NTL::ZZ_pE& Caster(NTL::ZZ_pE &x, const double &y)
 	{
-	   NTL::random(x);
-	   return x;
+		x=NTL::to_ZZ_pE(static_cast<long>(y));
+		return x;
 	}
 
-    protected:
-      size_t _size;
-      size_t _seed;
-    };
-}
+	template<>
+	bool UnparametricField<NTL::ZZ_pE>::isZero (const NTL::ZZ_pE& a) const
+	{
+		return NTL::IsZero(a);
+	}
+
+	template<>
+	bool UnparametricField<NTL::ZZ_pE>::isOne (const NTL::ZZ_pE& a) const
+	{
+		return NTL::IsOne(a);
+	}
+
+	// Rich Seagraves, 7-15-03
+	// On the orders of Dr Saunders, I'm re-writing init & convert so that
+	// they convert a ZZpE into a padic number, ie a0 + a1x + a2x^2 +... ->
+	// a0 + a1*p + a2*p^2 + ...
+	//
+	template<>
+	//    integer& UnparametricField<NTL::ZZ_pE>::convert(integer& c, const NTL::ZZ_pE& e) const
+	integer& Caster(integer& c, const NTL::ZZ_pE& e)
+	{
+		NTL::ZZ_pX poly = rep(e);
+		//Integer base = _p;
+		Integer base = static_cast<integer>(to_long(NTL::ZZ_p::modulus()));
+		long i;
+
+		c = 0;
+		for(i = deg(poly); i >= 0; --i) {
+			c *= base;
+			c +=  NTL::to_long(rep(coeff(poly, i)));
+		}
+
+		return c;
+	}
+
+	template<>
+	integer& UnparametricField<NTL::ZZ_pE>::characteristic (integer &c) const
+	{
+		return c=static_cast<integer>(to_long(NTL::ZZ_p::modulus()));
+		//NTL::ZZ_p::modulus();
+	}
+
+	template<>
+	integer& UnparametricField<NTL::ZZ_pE>::cardinality(integer& c) const
+	{
+		c=static_cast<integer>(to_long(NTL::ZZ_p::modulus()));
+		c=pow(c,NTL::ZZ_pE::degree());
+		return c;
+	}
+	template<>
+	NTL::ZZ_pE& UnparametricField<NTL::ZZ_pE>::inv(NTL::ZZ_pE& x, const NTL::ZZ_pE& y) const
+	{
+		x=NTL::to_ZZ_pE(1)/y;
+		return x;
+	}
+	template<>
+	NTL::ZZ_pE& UnparametricField<NTL::ZZ_pE>::invin(NTL::ZZ_pE& x) const
+	{
+		x=NTL::to_ZZ_pE(1)/x;
+		return x;
+	}
+
+	template<>
+	std::istream& UnparametricField<NTL::ZZ_pE>::read(std::istream& is, NTL::ZZ_pE& x) const
+	{
+		long tmp;
+		is>>tmp;
+		x=NTL::to_ZZ_pE(tmp);
+		return is;
+	}
 
-namespace LinBox
-{
 
-  /*
-   * Define a parameterized class to handle easily UnparametricField<NTL::ZZ_pE> field
-   */
-  class NTL_ZZ_pE : public UnparametricField<NTL::ZZ_pE>
-    {
-    public:
-      NTL_ZZ_pE (const integer &p, const integer &k) {
-	
-	NTL::ZZ_p::init(NTL::to_ZZ(std::string(p).data()));
-	NTL::ZZ_pX irredPoly = NTL::BuildIrred_ZZ_pX ((long) k);
-	NTL::ZZ_pE::init(irredPoly);
-      }
-      
-    }; // end o class NTL_ZZ_pE
-  
-
-
-
-
-  template<>
-    NTL::ZZ_pE& UnparametricField<NTL::ZZ_pE>::init (NTL::ZZ_pE &x, const integer &y) const
-    {
-      x=NTL::to_ZZ_pE(static_cast<long>(y));
-      return x;
-    }
-  
-  template<>
-    bool UnparametricField<NTL::ZZ_pE>::isZero (const NTL::ZZ_pE& a) const
-    {
-      return NTL::IsZero(a);
-    }
-  
-  template<>
-    bool UnparametricField<NTL::ZZ_pE>::isOne (const NTL::ZZ_pE& a) const
-    {
-      return NTL::IsOne(a);
-    }
-
-  // Rich Seagraves, 7-15-03
-  // On the orders of Dr Saunders, I'm re-writing init & convert so that
-  // they convert a ZZpE into a padic number, ie a0 + a1x + a2x^2 +... ->
-  // a0 + a1*p + a2*p^2 + ...
-  //
-  template<>
-    integer& UnparametricField<NTL::ZZ_pE>::convert(integer& c, const NTL::ZZ_pE& e) const
-    {
-	    NTL::ZZ_pX poly = rep(e);
-	    Integer base = _p;
-	    long i;
-
-	    c = 0;
-	    for(i = deg(poly); i >= 0; --i) {
-		    c *= base;
-		    c +=  NTL::to_long(rep(coeff(poly, i)));
-	    }
-
-	    return c;
-    }
-  
-  template<>
-    integer& UnparametricField<NTL::ZZ_pE>::characteristic (integer &c) const
-    {
-      return c=static_cast<integer>(to_long(NTL::ZZ_p::modulus()));
-      //NTL::ZZ_p::modulus();
-    }
-  
-  template<>
-    integer& UnparametricField<NTL::ZZ_pE>::cardinality(integer& c) const
-    {
-      c=static_cast<integer>(to_long(NTL::ZZ_p::modulus()));
-      c=pow(c,NTL::ZZ_pE::degree());
-      return c;
-    }
-  template<>
-    NTL::ZZ_pE& UnparametricField<NTL::ZZ_pE>::inv(NTL::ZZ_pE& x, const NTL::ZZ_pE& y) const
-    {
-      x=NTL::to_ZZ_pE(1)/y;
-      return x;
-    }
-  template<>
-    NTL::ZZ_pE& UnparametricField<NTL::ZZ_pE>::invin(NTL::ZZ_pE& x) const
-     {
-       x=NTL::to_ZZ_pE(1)/x;
-       return x;
-     }
-
-   template<>
-     std::istream& UnparametricField<NTL::ZZ_pE>::read(std::istream& is, NTL::ZZ_pE& x) const
-     {
-       long tmp;
-       is>>tmp;
-       x=NTL::to_ZZ_pE(tmp);
-       return is;
-     }		  
-   
-   
 
 #ifdef __LINBOX_XMLENABLED
 
-   template <>
-   bool UnparametricField<NTL::ZZ_pE>::toTag(LinBox::Writer &W) const
-   {
-	   std::string s;
-	   NTL::ZZ_pX poly = NTL::ZZ_pE::modulus();
-	   long i;
-
-	   W.setTagName("field");
-	   W.setAttribute("implDetail", "ntl-ZZpE");
-	   W.setAttribute("cardinality", LinBox::Writer::numToString(s, _card));
-
-	   W.addTagChild();
-	   W.setTagName("finite");
-
-	   W.addTagChild();
-	   W.setTagName("characteristic");
-	   W.addNum(_p);
-	   W.upToParent();
-
-	   W.addTagChild();
-	   W.setTagName("extension");
-	   W.addNum(deg(poly) + 1);
-	   W.upToParent();
-
-	   W.addTagChild();
-	   W.setTagName("polynomial");
-	   
-	   for(i = 0; i <= deg(poly); ++i) {
-		   W.addNum(coeff(poly, i));
-	   }
-	   W.upToParent();
-	   W.upToParent();
-	   W.upToParent();
-
-	   return true;
-   }
-
-   template <> 
-   std::ostream &UnparametricField<NTL::ZZ_pE>::write(std::ostream &os) const
-   {
-	   LinBox::Writer W;
-	   if( toTag(W) )
-		   W.write(os);
-
-	   return os;
-   }
-
-
-   // Elemnt Reading & writing functions
-   // BIG NOTE:  It was decided that for extension fields, the elements
-   // would be represented using a single number that has the following 
-   // property:  for an element e in ZZp[x], with e = a0 + a1x + a2x^2 + ...,
-   // represent e as "<cn>n</cn>" where n = a0 + a1 * p + a2 * p^2 + ...
-   //
-
-   template <>
-   bool UnparametricField<NTL::ZZ_pE>::toTag(LinBox::Writer &W, const Element &e) const
-   {
-	   NTL::ZZ_pX poly = rep(e);
-	   NTL::ZZ accum, base = NTL::ZZ_p::modulus();
-	   long i;
-	   std::string s;
-
-	   accum = 0;
-	   for(i = deg(poly); i >= 0; --i) {
-		   accum *= base;
-		   accum += rep(coeff(poly, i));
-	   }
-
-
-	   W.setTagName("cn");
-	   W.addDataChild(LinBox::Writer::numToString(s, accum));
-
-	   return true;
-   }
-
-   template <>
-   std::ostream &UnparametricField<NTL::ZZ_pE>::write(std::ostream &os, const Element &e) const
-   {
-
-	   LinBox::Writer W;
-	   if( toTag(W, e))
-		   W.write(os);
-
-	   return os;
-   }
-
-
-
-   template <>
-   bool UnparametricField<NTL::ZZ_pE>::fromTag(LinBox::Reader &R, Element &e) const
-   {
-	   NTL::ZZ total, base = NTL::ZZ_p::modulus(), rem;
-	   std::stringstream ss;
-
-	   if(!R.expectTagName("cn") || !R.expectChildTextNum(total))
-		   return false;
-
-	   ss << "[";
-	   while(total > 0) {
-		   rem = total % base;
-		   total /= base;
-		   ss << rem;
-		   if(total > 0) ss << " ";
-	   }
-
-	   ss << "]";
-	   
-	   ss >> e; // use the extraction stream operator
-
-	   return true;
-   }
-
-   template <>
-   std::istream &UnparametricField<NTL::ZZ_pE>::read(std::istream &is, Element &e) const
-   {
-	   LinBox::Reader R(is);
-	   if( !fromTag(R, e)) {
-		   is.setstate(std::istream::failbit);
-		   if(!R.initalized()) {
-			   is.setstate(std::istream::badbit);
-		   }
-	   }
-
-	   return is;
-   }
+	template <>
+	bool UnparametricField<NTL::ZZ_pE>::toTag(LinBox::Writer &W) const
+	{
+		std::string s;
+		NTL::ZZ_pX poly = NTL::ZZ_pE::modulus();
+		long i;
+
+		W.setTagName("field");
+		W.setAttribute("implDetail", "ntl-ZZpE");
+		W.setAttribute("cardinality", LinBox::Writer::numToString(s, _card));
+
+		W.addTagChild();
+		W.setTagName("finite");
+
+		W.addTagChild();
+		W.setTagName("characteristic");
+		W.addNum(_p);
+		W.upToParent();
+
+		W.addTagChild();
+		W.setTagName("extension");
+		W.addNum(deg(poly) + 1);
+		W.upToParent();
+
+		W.addTagChild();
+		W.setTagName("polynomial");
+
+		for(i = 0; i <= deg(poly); ++i) {
+			W.addNum(coeff(poly, i));
+		}
+		W.upToParent();
+		W.upToParent();
+		W.upToParent();
+
+		return true;
+	}
+
+	template <>
+	std::ostream &UnparametricField<NTL::ZZ_pE>::write(std::ostream &os) const
+	{
+		LinBox::Writer W;
+		if( toTag(W) )
+			W.write(os);
+
+		return os;
+	}
+
+
+	// Elemnt Reading & writing functions
+	// BIG NOTE:  It was decided that for extension fields, the elements
+	// would be represented using a single number that has the following
+	// property:  for an element e in ZZp[x], with e = a0 + a1x + a2x^2 + ...,
+	// represent e as "<cn>n</cn>" where n = a0 + a1 * p + a2 * p^2 + ...
+	//
+
+	template <>
+	bool UnparametricField<NTL::ZZ_pE>::toTag(LinBox::Writer &W, const Element &e) const
+	{
+		NTL::ZZ_pX poly = rep(e);
+		NTL::ZZ accum, base = NTL::ZZ_p::modulus();
+		long i;
+		std::string s;
+
+		accum = 0;
+		for(i = deg(poly); i >= 0; --i) {
+			accum *= base;
+			accum += rep(coeff(poly, i));
+		}
+
+
+		W.setTagName("cn");
+		W.addDataChild(LinBox::Writer::numToString(s, accum));
+
+		return true;
+	}
+
+	template <>
+	std::ostream &UnparametricField<NTL::ZZ_pE>::write(std::ostream &os, const Element &e) const
+	{
+
+		LinBox::Writer W;
+		if( toTag(W, e))
+			W.write(os);
+
+		return os;
+	}
+
+
+
+	template <>
+	bool UnparametricField<NTL::ZZ_pE>::fromTag(LinBox::Reader &R, Element &e) const
+	{
+		NTL::ZZ total, base = NTL::ZZ_p::modulus(), rem;
+		std::stringstream ss;
+
+		if(!R.expectTagName("cn") || !R.expectChildTextNum(total))
+			return false;
+
+		ss << "[";
+		while(total > 0) {
+			rem = total % base;
+			total /= base;
+			ss << rem;
+			if(total > 0) ss << " ";
+		}
+
+		ss << "]";
+
+		ss >> e; // use the extraction stream operator
+
+		return true;
+	}
+
+	template <>
+	std::istream &UnparametricField<NTL::ZZ_pE>::read(std::istream &is, Element &e) const
+	{
+		LinBox::Reader R(is);
+		if( !fromTag(R, e)) {
+			is.setstate(std::istream::failbit);
+			if(!R.initalized()) {
+				is.setstate(std::istream::badbit);
+			}
+		}
+
+		return is;
+	}
 
 
 #endif
-	   
 
 
-   
-   
+
+
+
 }
+
+#endif //__LINBOX_field_ntl_zz_pe_H
diff --git a/linbox/field/ntl-ZZ_pX.h b/linbox/field/ntl-ZZ_pX.h
index 5836a28..ccb30df 100644
--- a/linbox/field/ntl-ZZ_pX.h
+++ b/linbox/field/ntl-ZZ_pX.h
@@ -1,9 +1,29 @@
-#ifndef __FIELD_NTL_ZZ_pX_H
-#define __FIELD_NTL_ZZ_pX_H
-
-/** linbox/field/ntl-ZZ_pX.h
-  * Daniel Roche, August 2005
-  */
+/* -*- 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
+/* Copyright (C) 2005 LinBox
+ * written by Daniel Roche, August 2005
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __LINBOX_field_ntl_zz_px_H
+#define __LINBOX_field_ntl_zz_px_H
 
 #include <linbox/field/unparametric.h>
 #include <linbox/field/ntl-ZZ_p.h>
@@ -11,224 +31,245 @@
 #include <vector>
 #include <NTL/ZZ_pX.h>
 
-namespace LinBox { // namespace in which all LinBox code resides
-
-/** Ring (in fact, a unique factorization domain) of polynomial with
-  * coefficients in class NTL_ZZ_p (integers mod a wordsize prime).
-  * All the same functions as any other ring, with the addition of:
-  * Coeff (type), CoeffField (type), getCoeffField, setCoeff, getCoeff, 
-  * leadCoeff, deg
-  */
-class NTL_ZZ_pX :public UnparametricField<NTL::ZZ_pX> {
-    public:
-	typedef NTL_ZZ_p CoeffField;
-	typedef NTL::ZZ_p Coeff;
-	typedef NTL::ZZ_pX Element;
-    
-	/** Standard LinBox field constructor.  The paramters here
-	  * (prime, exponent) are only used to initialize the coefficient field.
-	  */
-	NTL_ZZ_pX( const integer& p, size_t e = 1 )
-	: UnparametricField<NTL::ZZ_pX>(p, e), _CField(p,e)
-	{}
-	
-	/** Constructor from a coefficient field */
-	NTL_ZZ_pX( CoeffField cf ) :_CField(cf) {}
-
-	/** Initialize p to the constant y (p = y*x^0) */
-	template <class ANY>
-	Element& init( Element& p, const ANY& y ) const {
-		Coeff temp;
-		_CField.init( temp, y );
-		return p = temp;
-	}
+namespace LinBox
+{ // namespace in which all LinBox code resides
+
+	/** Ring (in fact, a unique factorization domain) of polynomial with
+	 * coefficients in class NTL_ZZ_p (integers mod a wordsize prime).
+	 * All the same functions as any other ring, with the addition of:
+	 * Coeff (type), CoeffField (type), getCoeffField, setCoeff, getCoeff,
+	 * leadCoeff, deg
+	 */
+	class NTL_ZZ_pX :public UnparametricField<NTL::ZZ_pX> {
+	public:
+		typedef NTL_ZZ_p CoeffField;
+		typedef NTL::ZZ_p Coeff;
+		typedef NTL::ZZ_pX Element;
+
+		/** Standard LinBox field constructor.  The paramters here
+		 * (prime, exponent) are only used to initialize the coefficient field.
+		 */
+		NTL_ZZ_pX( const integer& p, size_t e = 1 ) :
+			UnparametricField<NTL::ZZ_pX>(p, e), _CField(p,e)
+		{}
+
+		/** Constructor from a coefficient field */
+		NTL_ZZ_pX( CoeffField cf ) :
+			_CField(cf)
+		{}
+
+		/** Initialize p to the constant y (p = y*x^0) */
+		template <class ANY>
+		Element& init( Element& p, const ANY& y ) const
+		{
+			Coeff temp;
+			_CField.init( temp, y );
+			return p = temp;
+		}
 
-	/** Initialize p to the constant y (p = y*x^0) */
-	Element& init( Element& p, const Coeff& y ) const {
-		return p = y;
-	}
+		/** Initialize p to the constant y (p = y*x^0) */
+		Element& init( Element& p, const Coeff& y ) const
+		{
+			return p = y;
+		}
 
-	/** Initialize p from a vector of coefficients.
-	  * The vector should be ordered the same way NTL does it: the front
-	  * of the vector corresponds to the trailing coefficients, and the back
-	  * of the vector corresponds to the leading coefficients.  That is,
-	  * v[i] = coefficient of x^i.
-	  */
-	template <class ANY>
-	Element& init( Element& p, const std::vector<ANY>& v ) const {
-		p = 0;
-		Coeff temp;
-		for( long i = 0; i < (long)v.size(); ++i ) {
-			_CField.init( temp, v[ (size_t) i ] );
-			if( !_CField.isZero(temp) )
-				NTL::SetCoeff( p, i, temp );
-		}
-		return p;
-	}
+		/** Initialize p from a vector of coefficients.
+		 * The vector should be ordered the same way NTL does it: the front
+		 * of the vector corresponds to the trailing coefficients, and the back
+		 * of the vector corresponds to the leading coefficients.  That is,
+		 * v[i] = coefficient of x^i.
+		 */
+		template <class ANY>
+		Element& init( Element& p, const std::vector<ANY>& v ) const
+		{
+			p = 0;
+			Coeff temp;
+			for( long i = 0; i < (long)v.size(); ++i ) {
+				_CField.init( temp, v[ (size_t) i ] );
+				if( !_CField.isZero(temp) )
+					NTL::SetCoeff( p, i, temp );
+			}
+			return p;
+		}
 
-	/** Initialize p from a vector of coefficients.
-	  * The vector should be ordered the same way NTL does it: the front
-	  * of the vector corresponds to the trailing coefficients, and the back
-	  * of the vector corresponds to the leading coefficients.  That is,
-	  * v[i] = coefficient of x^i.
-	  */
-	Element& init( Element& p, const std::vector<Coeff>& v ) const {
-		p = 0;
-		for( long i = 0; i < (long)v.size(); ++i )
-			NTL::SetCoeff( p, i, v[ (size_t) i ] );
-		return p;
-	}
+		/** Initialize p from a vector of coefficients.
+		 * The vector should be ordered the same way NTL does it: the front
+		 * of the vector corresponds to the trailing coefficients, and the back
+		 * of the vector corresponds to the leading coefficients.  That is,
+		 * v[i] = coefficient of x^i.
+		 */
+		Element& init( Element& p, const std::vector<Coeff>& v ) const
+		{
+			p = 0;
+			for( long i = 0; i < (long)v.size(); ++i )
+				NTL::SetCoeff( p, i, v[ (size_t) i ] );
+			return p;
+		}
 
-	/** Convert p to a vector of coefficients.
-	  * The vector will be ordered the same way NTL does it: the front
-	  * of the vector corresponds to the trailing coefficients, and the back
-	  * of the vector corresponds to the leading coefficients.  That is,
-	  * v[i] = coefficient of x^i.
-	  */
-	template< class ANY >
-	std::vector<ANY>& convert( std::vector<ANY>& v, const Element& p ) const
-	{
-		v.clear();
-		ANY temp;
-		for( long i = 0; i <= this->deg(p); ++i ) {
-			_CField.convert( temp, NTL::coeff( p, i ) );
-			v.push_back( temp );
+		/** Convert p to a vector of coefficients.
+		 * The vector will be ordered the same way NTL does it: the front
+		 * of the vector corresponds to the trailing coefficients, and the back
+		 * of the vector corresponds to the leading coefficients.  That is,
+		 * v[i] = coefficient of x^i.
+		 */
+		template< class ANY >
+		std::vector<ANY>& convert( std::vector<ANY>& v, const Element& p ) const
+		{
+			v.clear();
+			ANY temp;
+			for( long i = 0; i <= this->deg(p); ++i ) {
+				_CField.convert( temp, NTL::coeff( p, i ) );
+				v.push_back( temp );
+			}
+			return v;
 		}
-		return v;
-	}
 
-	/** Convert p to a vector of coefficients.
-	  * The vector will be ordered the same way NTL does it: the front
-	  * of the vector corresponds to the trailing coefficients, and the back
-	  * of the vector corresponds to the leading coefficients.  That is,
-	  * v[i] = coefficient of x^i.
-	  */
-	std::vector<Coeff>& convert( std::vector<Coeff>& v, const Element& p )
+		/** Convert p to a vector of coefficients.
+		 * The vector will be ordered the same way NTL does it: the front
+		 * of the vector corresponds to the trailing coefficients, and the back
+		 * of the vector corresponds to the leading coefficients.  That is,
+		 * v[i] = coefficient of x^i.
+		 */
+		std::vector<Coeff>& convert( std::vector<Coeff>& v, const Element& p )
 		const
-	{
-		v.clear();
-		for( long i = 0; i <= (long)this->deg(p); ++i )
-			v.push_back( NTL::coeff(p,i) );
-		return v;
-	}
-
-	/** Test if an element equals zero */
-	bool isZero( const Element& x ) const {
-		return ( (this->deg(x) == 0) && 
-		         ( _CField.isZero( NTL::ConstTerm(x) ) ) );
-	}
+		{
+			v.clear();
+			for( long i = 0; i <= (long)this->deg(p); ++i )
+				v.push_back( NTL::coeff(p,i) );
+			return v;
+		}
 
-	/** Test if an element equals one */
-	bool isOne( const Element& x ) const {
-		return ( (this->deg(x) == 0) && 
-		         ( _CField.isOne( NTL::ConstTerm(x) ) ) );
-	}
+		/** Test if an element equals zero */
+		bool isZero( const Element& x ) const
+		{
+			return ( (this->deg(x) == 0) &&
+				 ( _CField.isZero( NTL::ConstTerm(x) ) ) );
+		}
 
-	/** The LinBox field for coefficients */
-	const CoeffField& getCoeffField() const { return _CField; }
+		/** Test if an element equals one */
+		bool isOne( const Element& x ) const
+		{
+			return ( (this->deg(x) == 0) &&
+				 ( _CField.isOne( NTL::ConstTerm(x) ) ) );
+		}
 
-	/** Get the degree of a polynomial 
-	  * Unlike NTL, deg(0)=0.
-	  */
-	size_t deg( const Element& p ) const {
-		long temp = NTL::deg(p);
-		if( temp == -1 ) return 0;
-		else return static_cast<size_t>(temp);
-	}
+		/** The LinBox field for coefficients */
+		const CoeffField& getCoeffField() const
+		{ return _CField; }
+
+		/** Get the degree of a polynomial
+		 * Unlike NTL, deg(0)=0.
+		 */
+		size_t deg( const Element& p ) const
+		{
+			long temp = NTL::deg(p);
+			if( temp == -1 ) return 0;
+			else return static_cast<size_t>(temp);
+		}
 
-	/** r will be set to the reverse of p. */
-	Element& rev( Element& r, const Element& p ) {
-		NTL::reverse(r,p);
-		return r;
-	}
+		/** r will be set to the reverse of p. */
+		Element& rev( Element& r, const Element& p ) {
+			NTL::reverse(r,p);
+			return r;
+		}
 
-	/** r is itself reversed. */
-	Element& revin( Element& r ) {
-		return r = NTL::reverse(r);
-	}
+		/** r is itself reversed. */
+		Element& revin( Element& r ) {
+			return r = NTL::reverse(r);
+		}
 
-	/** Get the leading coefficient of this polynomial. */
-	Coeff& leadCoeff( Coeff& c, const Element& p ) const {
-		c = NTL::LeadCoeff(p);
-		return c;
-	}
+		/** Get the leading coefficient of this polynomial. */
+		Coeff& leadCoeff( Coeff& c, const Element& p ) const
+		{
+			c = NTL::LeadCoeff(p);
+			return c;
+		}
 
-	/** Get the coefficient of x^i in a given polynomial */
-	Coeff& getCoeff( Coeff& c, const Element& p, size_t i ) const {
-		c = NTL::coeff( p, (long)i );
-		return c;
-	}
+		/** Get the coefficient of x^i in a given polynomial */
+		Coeff& getCoeff( Coeff& c, const Element& p, size_t i ) const
+		{
+			c = NTL::coeff( p, (long)i );
+			return c;
+		}
 
-	/** Set the coefficient of x^i in a given polynomial */
-	Element& setCoeff( Element& p, size_t i, const Coeff& c ) const {
-		NTL::SetCoeff(p,(long)i,c);
-		return p;
-	}
+		/** Set the coefficient of x^i in a given polynomial */
+		Element& setCoeff( Element& p, size_t i, const Coeff& c ) const
+		{
+			NTL::SetCoeff(p,(long)i,c);
+			return p;
+		}
 
-	/** Get the quotient of two polynomials */
-	Element& quo( Element& res, const Element& a, const Element& b ) const {
-		NTL::div(res,a,b);
-		return res;
-	}
+		/** Get the quotient of two polynomials */
+		Element& quo( Element& res, const Element& a, const Element& b ) const
+		{
+			NTL::div(res,a,b);
+			return res;
+		}
 
-	/** a = quotient of a, b */
-	Element& quoin( Element& a, const Element& b ) const {
-		return a /= b;
-	}
+		/** a = quotient of a, b */
+		Element& quoin( Element& a, const Element& b ) const
+		{
+			return a /= b;
+		}
 
-	/** Get the remainder under polynomial division */
-	Element& rem( Element& res, const Element& a, const Element& b ) const {
-		NTL::rem(res,a,b);
-		return res;
-	}
+		/** Get the remainder under polynomial division */
+		Element& rem( Element& res, const Element& a, const Element& b ) const
+		{
+			NTL::rem(res,a,b);
+			return res;
+		}
 
-	/** a = remainder of a,b */
-	Element& remin( Element& a, const Element& b ) const {
-		return a %= b;
-	}
+		/** a = remainder of a,b */
+		Element& remin( Element& a, const Element& b ) const
+		{
+			return a %= b;
+		}
 
-	/** Get the quotient and remainder under polynomial division */
-	void quorem( Element& q, Element& r,
-	                 const Element& a, const Element& b ) const
-	{
-		NTL::DivRem(q,r,a,b);
-	}
+		/** Get the quotient and remainder under polynomial division */
+		void quorem( Element& q, Element& r,
+			     const Element& a, const Element& b ) const
+		{
+			NTL::DivRem(q,r,a,b);
+		}
 
-	/** Get characteristic of the field - same as characteristic of 
-	  * coefficient field. */
-	integer& characteristic( integer& c ) const 
+		/** Get characteristic of the field - same as characteristic of
+		 * coefficient field. */
+		integer& characteristic( integer& c ) const
 		{ return _CField.characteristic(c); }
 
-	/** Get the cardinality of the field.  Since the cardinality is
-	  * infinite, by convention we return -1.
-	  */
-	integer& cardinality( integer& c ) const 
+		/** Get the cardinality of the field.  Since the cardinality is
+		 * infinite, by convention we return -1.
+		 */
+		integer& cardinality( integer& c ) const
 		{ return c = static_cast<integer>(-1); }
-	
-	static inline integer getMaxModulus()
-		{ return CoeffField::getMaxModulus(); }
-
-    private:
-	/** Conversion to scalar types doesn't make sense and should not be
-	  * used.  Use getCoeff or leadCoeff to get the scalar values of
-	  * specific coefficients, and then convert them using coeffField()
-	  * if needed.
-	  */
-	template< class ANY >
-	ANY& convert( ANY& x, const Element& y ) const { return x; }
 
-    	CoeffField _CField;
-}; // end of class NTL_ZZ_pX
+		static inline integer getMaxModulus()
+		{ return CoeffField::getMaxModulus(); }
 
-/** Write a description of the field */
-// Oustide of class definition so write(ostream&,const Element&) from
-// UnparametricField still works.
-template<>
-std::ostream& UnparametricField<NTL::ZZ_pX>::write( std::ostream& os ) const {
-	return os << "Polynomial ring using NTL::ZZ_pX";
-}
+	private:
+		/** Conversion to scalar types doesn't make sense and should not be
+		 * used.  Use getCoeff or leadCoeff to get the scalar values of
+		 * specific coefficients, and then convert them using coeffField()
+		 * if needed.
+		 */
+		template< class ANY >
+		ANY& convert( ANY& x, const Element& y ) const
+		{ return x; }
+
+		CoeffField _CField;
+	}; // end of class NTL_ZZ_pX
+
+	/** Write a description of the field */
+	// Oustide of class definition so write(ostream&,const Element&) from
+	// UnparametricField still works.
+	template<>
+	std::ostream& UnparametricField<NTL::ZZ_pX>::write( std::ostream& os ) const
+	{
+		return os << "Polynomial ring using NTL::ZZ_pX";
+	}
 
 
 } // end of namespace LinBox
 
-#endif // __FIELD_NTL_ZZ_pX_H
+#endif // __LINBOX_field_ntl_zz_px_H
+
diff --git a/linbox/field/ntl-lzz_p.h b/linbox/field/ntl-lzz_p.h
index 1a73fb0..3a385fc 100644
--- a/linbox/field/ntl-lzz_p.h
+++ b/linbox/field/ntl-lzz_p.h
@@ -1,16 +1,19 @@
 /* -*- 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
 /* linbox/field/ntl-lzz_p.h
  * Copyright (C) 1999-2005 W. J. Turner,
  *               2001 Bradford Hovinen
+ * Copyright (C) LinBox
  *
  * Written by W. J. Turner <wjturner at acm.org>,
  *            Bradford Hovinen <hovinen at cis.udel.edu>
  *
+ * see COPYING for license information
+ *
  */
 
-#ifndef __FIELD_NTL_zz_p_H
-#define __FIELD_NTL_zz_p_H
+#ifndef __LINBOX_field_ntl_lzz_p_H
+#define __LINBOX_field_ntl_lzz_p_H
 
 #include <NTL/lzz_p.h>
 #include <NTL/ZZ.h>
@@ -25,25 +28,25 @@
 // Namespace in which all LinBox library code resides
 namespace LinBox
 {
-  
-  	template <class Ring>
-	struct ClassifyRing; 
+
+	template <class Ring>
+	struct ClassifyRing;
 
 	class NTL_zz_p;
-	
-	template<> 
+
+	template<>
 	struct ClassifyRing<NTL_zz_p> {
 		typedef RingCategories::ModularTag categoryTag;
 	};
 
-/*
-	integer& FieldTraits<NTL_zz_p>::maxExponent( integer& i )
-		{ return i = integer( "4294967295" ); } // 2^32 - 1
-*/
+	/*
+	   integer& FieldTraits<NTL_zz_p>::maxExponent( integer& i )
+	   { return i = integer( "4294967295" ); } // 2^32 - 1
+	   */
 
 	template<>
 	UnparametricField<NTL::zz_p>::UnparametricField(integer q, size_t e)
-	{    
+	{
 		if(q==0) q=65521;//set default value to 65521
 		NTL::zz_p::init(q); // it's an error if q not prime, e not 1
 	}
@@ -55,9 +58,20 @@ namespace LinBox
 	 * @param x field element to contain output (reference returned).
 	 * @param y integer.
 	 */
-        template <>
-        NTL::zz_p& UnparametricField<NTL::zz_p>::init(NTL::zz_p& x, const integer& y) const
-                { return x = NTL::to_zz_p(y%NTL::zz_p::modulus()); }
+#if 0
+	template <>
+	NTL::zz_p& UnparametricField<NTL::zz_p>::init(NTL::zz_p& x, const integer& y) const
+	{ return x = NTL::to_zz_p(y%NTL::zz_p::modulus()); }
+	template <>
+	NTL::zz_p& UnparametricField<NTL::zz_p>::init(NTL::zz_p& x, const double& y) const
+	{   return x = NTL::to_zz_p((long)(y)%NTL::zz_p::modulus()); }
+#endif
+	template<>
+	NTL::zz_p& Caster(NTL::zz_p& x, const integer& y)
+	{ return x = NTL::to_zz_p(y%NTL::zz_p::modulus()); }
+	template <>
+	NTL::zz_p& Caster(NTL::zz_p& x, const double& y)
+	{   return x = NTL::to_zz_p((long)(y)%NTL::zz_p::modulus()); }
 
 	/** Conversion of field element to an integer.
 	 * This function assumes the output field element x has already been
@@ -71,27 +85,32 @@ namespace LinBox
 	 * @param x reference to integer to contain output (reference returned).
 	 * @param y constant reference to field element.
 	 */
+	/*
+	   template <>
+	   integer& UnparametricField<NTL::zz_p>::convert(integer& x, const NTL::zz_p& y) const
+	   { return x = static_cast<integer>(rep(y)); }
+	   */
 	template <>
-		integer& UnparametricField<NTL::zz_p>::convert(integer& x, const NTL::zz_p& y) const
-		{ return x = static_cast<integer>(rep(y)); }
+	integer& Caster(integer& x, const NTL::zz_p& y)
+	{ return x = static_cast<integer>(rep(y)); }
 
 	/** Cardinality.
 	 * Return integer representing cardinality of the field.
 	 * Returns the modulus of the field, which should be prime.
 	 * @return integer representing cardinality of the field
 	 */
-	template <> 
-		integer& UnparametricField<NTL::zz_p>::cardinality(integer& c) const
-		{ return c = static_cast<integer>(NTL::zz_p::modulus()); }
+	template <>
+	integer& UnparametricField<NTL::zz_p>::cardinality(integer& c) const
+	{ return c = static_cast<integer>(NTL::zz_p::modulus()); }
 
 	/** Characteristic.
 	 * Return integer representing characteristic of the field.
 	 * Returns the modulus of the field, which should be prime.
 	 * @return integer representing characteristic of the field.
 	 */
-	template <> 
-		integer& UnparametricField<NTL::zz_p>::characteristic(integer& c) const
-		{ return c = static_cast<integer>(NTL::zz_p::modulus()); }
+	template <>
+	integer& UnparametricField<NTL::zz_p>::characteristic(integer& c) const
+	{ return c = static_cast<integer>(NTL::zz_p::modulus()); }
 
 	/** Multiplicative Inverse.
 	 * x = 1 / y
@@ -101,10 +120,10 @@ namespace LinBox
 	 * @param  x field element (reference returned).
 	 * @param  y field element.
 	 */
-	template <> NTL::zz_p& 
-		UnparametricField<NTL::zz_p>::inv(NTL::zz_p& x, const NTL::zz_p& y) const
-		{ return x = NTL::inv(y); }
- 
+	template <> NTL::zz_p&
+	UnparametricField<NTL::zz_p>::inv(NTL::zz_p& x, const NTL::zz_p& y) const
+	{ return x = NTL::inv(y); }
+
 	/** Zero equality.
 	 * Test if field element is equal to zero.
 	 * This function assumes the field element has already been
@@ -114,7 +133,7 @@ namespace LinBox
 	 * @param  x field element.
 	 */
 	template <> bool UnparametricField<NTL::zz_p>::isZero(const NTL::zz_p& x) const
-		{ return static_cast<bool>(NTL::IsZero(x)); }
+	{ return static_cast<bool>(NTL::IsZero(x)); }
 
 	/** One equality.
 	 * Test if field element is equal to one.
@@ -125,7 +144,7 @@ namespace LinBox
 	 * @param  x field element.
 	 */
 	template <> bool UnparametricField<NTL::zz_p>::isOne(const NTL::zz_p& x) const
-		{ return static_cast<bool>(NTL::IsOne(x)); }
+	{ return static_cast<bool>(NTL::IsOne(x)); }
 
 	/** Inplace Multiplicative Inverse.
 	 * x = 1 / x
@@ -135,70 +154,70 @@ namespace LinBox
 	 * @param  x field element (reference returned).
 	 */
 	template <> NTL::zz_p& UnparametricField<NTL::zz_p>::invin(NTL::zz_p& x) const
-		{ return x = NTL::inv(x); }
+	{ return x = NTL::inv(x); }
 
 	/** Print field.
 	 * @return output stream to which field is written.
 	 * @param  os  output stream to which field is written.
 	 */
-	template <> std::ostream& UnparametricField<NTL::zz_p>::write(std::ostream& os) const 
-		{ 
-			return os << "unparameterized field NTL::zz_p with p = " 
-				  << NTL::zz_p::modulus(); 
-		}
+	template <> std::ostream& UnparametricField<NTL::zz_p>::write(std::ostream& os) const
+	{
+		return os << "unparameterized field NTL::zz_p with p = "
+		<< NTL::zz_p::modulus();
+	}
 
 	/// Constructor for random field element generator
-	template <> 
-	UnparametricRandIter<NTL::zz_p>::UnparametricRandIter (const UnparametricField<NTL::zz_p>& F, 
-							       const integer& size, 
-							       const integer& seed)
-			: _size(size), _seed(seed)
+	template <>
+	UnparametricRandIter<NTL::zz_p>::UnparametricRandIter (const UnparametricField<NTL::zz_p>& F,
+							       const integer& size,
+							       const integer& seed) :
+		_size(size), _seed(seed)
 	{
 		if (_seed == integer(0)) _seed = integer(time(NULL));
-		
-		integer cardinality; 
+
+		integer cardinality;
 		F.cardinality(cardinality);
 		if (_size > cardinality)
 			_size = 0;
 
 #ifdef TRACE
-		cout << "created random generator with size " << _size 
-   << " and seed " << _seed << endl;
+		cout << "created random generator with size " << _size
+		<< " and seed " << _seed << endl;
 #endif // TRACE
-		
+
 		// Seed random number generator
 		NTL::SetSeed(NTL::to_ZZ(static_cast<long>(_seed)));
 	}
 
 	/// Random field element creator.
 	template <> NTL::zz_p& UnparametricRandIter<NTL::zz_p>::random(NTL::zz_p& x) const
-//		{ return x = static_cast<long>((double(rand())/RAND_MAX)*double(_size)); }
-		{
-		       if (_size == 0)
-		       	       return x = NTL::random_zz_p(); 
-		       else
-			       return x = NTL::to_zz_p(NTL::RandomBnd(static_cast<long>(_size)));
-		}
+	//		{ return x = static_cast<long>((double(rand())/RAND_MAX)*double(_size)); }
+	{
+		if (_size == 0)
+			return x = NTL::random_zz_p();
+		else
+			return x = NTL::to_zz_p(NTL::RandomBnd(static_cast<long>(_size)));
+	}
 
 
 
-	/** 
+	/**
 	 * \brief long ints modulo a positive integer.
-	 * 
+	 *
 	 * While NTL allows any int to serve as the modulus, only prime
 	 * moduli yield fields.  The primality of the modulus will not be checked, so
 	 * it is the programmer's responsibility to supply a prime modulus if a field is
 	 * wanted.
-	 * These specializations allow the \ref{UnparametricField} template class to be
-	 * used to wrap NTL's <tt>zz_p</tt> class as a LinBox field.
+	 * These specializations allow the \ref UnparametricField template class to be
+	 * used to wrap NTL's <code>zz_p</code> class as a LinBox field.
 	 * Uses nice trick for mod p via floating point.
-	\ingroup field
+	 \ingroup field
 	 */
 
 	struct NTL_zz_p: public UnparametricField<NTL::zz_p>
 	{
-		NTL_zz_p(integer p, size_t e = 1) 
-		: UnparametricField<NTL::zz_p>(p, e)
+		NTL_zz_p(integer p, size_t e = 1) :
+			UnparametricField<NTL::zz_p>(p, e)
 		{}
 
 		NTL::zz_p& init(NTL::zz_p& x, const double& y) const
@@ -209,32 +228,37 @@ namespace LinBox
 			return x = NTL::to_zz_p(static_cast<long>(z)); //rounds towards 0
 		}
 
-		NTL::zz_p &init (NTL::zz_p &x, const integer &y=0) const {
+		NTL::zz_p &init (NTL::zz_p &x, const integer &y=0) const
+		{
 			NTL::ZZ tmp= NTL::to_ZZ(std::string(y).data());
 			return x = NTL::to_zz_p(tmp);
 		}
 
+		template <class ANY>
+		NTL::zz_p& init(NTL::zz_p& x, const ANY& y) const
+		{
+			return x = NTL::to_zz_p((long)(y));
+		}
 
-            template <class ANY>
-            NTL::zz_p& init(NTL::zz_p& x, const ANY& y) const
-		{ return x = NTL::to_zz_p(static_cast<const long&>(y)); }
+		template <class ANY>
+		ANY& convert(ANY& x, const NTL::zz_p& y) const
+		{
+		       	return x = (ANY)(rep(y));
+		}
 
-            template <class ANY>
-            ANY& convert(ANY& x, const NTL::zz_p& y) const
-		{ return x = static_cast<ANY>(rep(y)); }
-            
-	    static inline integer getMaxModulus()
+		static inline integer getMaxModulus()
 		{ return integer( NTL_SP_BOUND ); }
 
-	    NTL::zz_p& pow( NTL::zz_p& res, const NTL::zz_p& x, long exp ) const
-	    {
-	    	NTL::power( res, x, exp );
-		return res;
-	    }
+		NTL::zz_p& pow( NTL::zz_p& res, const NTL::zz_p& x, long exp ) const
+		{
+			NTL::power( res, x, exp );
+			return res;
+		}
 
-	    NTL::zz_p& powin( NTL::zz_p& x, long exp ) const {
-	    	return x = NTL::power(x,exp);
-	    }
+		NTL::zz_p& powin( NTL::zz_p& x, long exp ) const
+		{
+			return x = NTL::power(x,exp);
+		}
 	};
 
 
@@ -243,4 +267,5 @@ namespace LinBox
 
 } // namespace LinBox
 
-#endif // __FIELD_NTL_zz_p_H
+#endif // __LINBOX_field_ntl_lzz_p_H
+
diff --git a/linbox/field/ntl-lzz_pE.h b/linbox/field/ntl-lzz_pE.h
index 7a46314..3a17db2 100644
--- a/linbox/field/ntl-lzz_pE.h
+++ b/linbox/field/ntl-lzz_pE.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* linbox/field/ntl-z_pE.h
  * Copyright (C) 2004  Pascal Giorgi
  *
@@ -23,8 +24,8 @@
  */
 
 
-#ifndef __NTL_zz_pE_H
-#define __NTL_zz_pE_H
+#ifndef __LINBOX_ntl_lzz_pe_H
+#define __LINBOX_ntl_lzz_pe_H
 
 
 #include <linbox/field/unparametric.h>
@@ -36,7 +37,8 @@
 #include <linbox/field/field-traits.h>
 
 
-namespace LinBox {
+namespace LinBox
+{
 
 
 	template <class Ring>
@@ -52,11 +54,11 @@ namespace LinBox {
 	{
 	public:
 		typedef NTL::zz_pE Element;
-		UnparametricRandIter<NTL::zz_pE>(const UnparametricField<NTL::zz_pE>& F =UnparametricField<NTL::zz_pE>(), 
+		UnparametricRandIter<NTL::zz_pE>(const UnparametricField<NTL::zz_pE>& F =UnparametricField<NTL::zz_pE>(),
 						 const size_t& size = 0,
 						 const size_t& seed = 0
-						 )
-			: _size(size), _seed(seed)
+						) :
+			_size(size), _seed(seed)
 		{
 			if(_seed == 0)
 				NTL::SetSeed(NTL::to_ZZ(time(0)));
@@ -64,16 +66,16 @@ namespace LinBox {
 				NTL::SetSeed(NTL::to_ZZ(_seed));
 		}
 
-		UnparametricRandIter<NTL::zz_pE>(const UnparametricRandIter<NTL::zz_pE>& R)
-			: _size(R._size), _seed(R._seed) 
-	
+		UnparametricRandIter<NTL::zz_pE>(const UnparametricRandIter<NTL::zz_pE>& R) :
+			_size(R._size), _seed(R._seed)
+
 		{
 			if(_seed == 0)
 				NTL::SetSeed(NTL::to_ZZ(time(0)));
 			else
 				NTL::SetSeed(NTL::to_ZZ(_seed));
 		}
-      
+
 		Element& random (Element& x) const
 		{
 			NTL::random(x);
@@ -90,13 +92,14 @@ namespace LinBox {
 	/*
 	 * Define a parameterized class to easily handle UnparametricField<NTL::zz_pE> field
 	 */
-	
+
 	/// \brief for large cardinality, small prime.  \ingroup field
- 	class NTL_zz_pE : public UnparametricField<NTL::zz_pE>
+	class NTL_zz_pE : public UnparametricField<NTL::zz_pE>
 	{
 	public:
-		NTL_zz_pE (const integer &p, const integer &k) {
-			
+		NTL_zz_pE (const integer &p, const integer &k)
+		{
+
 			NTL::zz_p::init( (long) p);
 			NTL::zz_pX irredPoly = NTL::BuildIrred_zz_pX ((long) k);
 			NTL::zz_pE::init(irredPoly);
@@ -107,33 +110,42 @@ namespace LinBox {
 			NTL::random(x);
 			return x;
 		}
-		
+
 	}; // end o class NTL_zz_pE
-	
+
 
 	/*
 	 * Specialization of UnparametricField<> for NTL::zz_pE type
 	 */
 	template<>
-	NTL::zz_pE& UnparametricField<NTL::zz_pE>::init (NTL::zz_pE &x, const integer &y) const
+	//	NTL::zz_pE& UnparametricField<NTL::zz_pE>::init (NTL::zz_pE &x, const integer &y) const
+	NTL::zz_pE& Caster(NTL::zz_pE &x, const integer &y)
+	{
+		x=NTL::to_zz_pE(static_cast<long>(y));
+		return x;
+	}
+	template<>
+	//	NTL::zz_pE& UnparametricField<NTL::zz_pE>::init (NTL::zz_pE &x, const double &y) const
+	NTL::zz_pE& Caster(NTL::zz_pE &x, const double &y)
 	{
 		x=NTL::to_zz_pE(static_cast<long>(y));
 		return x;
 	}
-	
+
 	template<>
-	integer& UnparametricField<NTL::zz_pE>::convert (integer& x, const NTL::zz_pE &y) const	{
+	//	integer& UnparametricField<NTL::zz_pE>::convert (integer& x, const NTL::zz_pE &y) const	{
+	integer& Caster (integer& x, const NTL::zz_pE &y) {
 		NTL::zz_pX poly = rep(y);
-		integer base = static_cast<integer>(NTL::zz_p::modulus());		
-		long i;		
+		integer base = static_cast<integer>(NTL::zz_p::modulus());
+		long i = deg(poly)+1;
 		x = 0;
-		for(i = deg(poly); i >= 0; --i) {
+		for( ; i-- ; ) {
 			x *= base;
 			x +=  NTL::to_long(rep(coeff(poly, i)));
 		}
 		return x;
 	}
-	
+
 
 
 	template<>
@@ -141,20 +153,20 @@ namespace LinBox {
 	{
 		return NTL::IsZero(a);
 	}
-  
+
 	template<>
 	bool UnparametricField<NTL::zz_pE>::isOne (const NTL::zz_pE& a) const
 	{
 		return NTL::IsOne(a);
 	}
-  
-  
+
+
 	template<>
 	integer& UnparametricField<NTL::zz_pE>::characteristic (integer &c) const
 	{
-		return c = static_cast<integer>(NTL::zz_p::modulus()); 
+		return c = static_cast<integer>(NTL::zz_p::modulus());
 	}
-  
+
 	template<>
 	integer& UnparametricField<NTL::zz_pE>::cardinality(integer& c) const
 	{
@@ -163,15 +175,15 @@ namespace LinBox {
 		unsigned char* byteArray;
 		byteArray = new unsigned char[(size_t)b ];
 		BytesFromZZ(byteArray, card, b);
-      
+
 		integer base(256);
 		c= integer(0);
-      
+
 		for(long i = b - 1; i >= 0; --i) {
 			c *= base;
 			c += integer(byteArray[i]);
 		}
-		delete [] byteArray;		
+		delete [] byteArray;
 
 		return c;
 	}
@@ -199,8 +211,9 @@ namespace LinBox {
 		x=NTL::to_zz_pE(tmp);
 		return is;
 	}
-  
+
 
 }
 
-#endif
+#endif //__LINBOX_ntl_lzz_pe_H
+
diff --git a/linbox/field/ntl-lzz_pX.h b/linbox/field/ntl-lzz_pX.h
index c78f7ad..64d0d38 100644
--- a/linbox/field/ntl-lzz_pX.h
+++ b/linbox/field/ntl-lzz_pX.h
@@ -1,9 +1,30 @@
-#ifndef __FIELD_NTL_lzz_pX_H
-#define __FIELD_NTL_lzz_pX_H
-
-/** linbox/field/ntl-lzz_pX.h
-  * Daniel Roche, August 2005
-  */
+/* -*- 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
+/* Copyright (C) 2005 LinBox
+ *
+ *
+ * Written by Daniel Roche, August 2005
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+
+#ifndef __LINBOX_field_ntl_lzz_px_H
+#define __LINBOX_field_ntl_lzz_px_H
 
 #include <linbox/field/unparametric.h>
 #include <linbox/field/ntl-lzz_p.h>
@@ -11,224 +32,244 @@
 #include <vector>
 #include <NTL/lzz_pX.h>
 
-namespace LinBox { // namespace in which all LinBox code resides
-
-/** Ring (in fact, a unique factorization domain) of polynomial with
-  * coefficients in class NTL_zz_p (integers mod a wordsize prime).
-  * All the same functions as any other ring, with the addition of:
-  * Coeff (type), CoeffField (type), getCoeffField, setCoeff, getCoeff, 
-  * leadCoeff, deg
-  */
-class NTL_zz_pX :public UnparametricField<NTL::zz_pX> {
-    public:
-	typedef NTL_zz_p CoeffField;
-	typedef NTL::zz_p Coeff;
-	typedef NTL::zz_pX Element;
-    
-	/** Standard LinBox field constructor.  The paramters here
-	  * (prime, exponent) are only used to initialize the coefficient field.
-	  */
-	NTL_zz_pX( const integer& p, size_t e = 1 )
-	: UnparametricField<NTL::zz_pX>(p, e), _CField(p,e)
-	{}
-	
-	/** Constructor from a coefficient field */
-	NTL_zz_pX( CoeffField cf ) :_CField(cf) {}
-
-	/** Initialize p to the constant y (p = y*x^0) */
-	template <class ANY>
-	Element& init( Element& p, const ANY& y ) const {
-		Coeff temp;
-		_CField.init( temp, y );
-		return p = temp;
-	}
-
-	/** Initialize p to the constant y (p = y*x^0) */
-	Element& init( Element& p, const Coeff& y ) const {
-		return p = y;
-	}
+namespace LinBox
+{ // namespace in which all LinBox code resides
+
+	/** Ring (in fact, a unique factorization domain) of polynomial with
+	 * coefficients in class NTL_zz_p (integers mod a wordsize prime).
+	 * All the same functions as any other ring, with the addition of:
+	 * Coeff (type), CoeffField (type), getCoeffField, setCoeff, getCoeff,
+	 * leadCoeff, deg
+	 */
+	class NTL_zz_pX :public UnparametricField<NTL::zz_pX> {
+	public:
+		typedef NTL_zz_p CoeffField;
+		typedef NTL::zz_p Coeff;
+		typedef NTL::zz_pX Element;
+
+		/** Standard LinBox field constructor.  The paramters here
+		 * (prime, exponent) are only used to initialize the coefficient field.
+		 */
+		NTL_zz_pX( const integer& p, size_t e = 1 ) :
+			UnparametricField<NTL::zz_pX>(p, e), _CField(p,e)
+		{}
+
+		/** Constructor from a coefficient field */
+		NTL_zz_pX( CoeffField cf ) :
+			_CField(cf)
+	       	{}
+
+		/** Initialize p to the constant y (p = y*x^0) */
+		template <class ANY>
+		Element& init( Element& p, const ANY& y ) const
+		{
+			Coeff temp;
+			_CField.init( temp, y );
+			return p = temp;
+		}
 
-	/** Initialize p from a vector of coefficients.
-	  * The vector should be ordered the same way NTL does it: the front
-	  * of the vector corresponds to the trailing coefficients, and the back
-	  * of the vector corresponds to the leading coefficients.  That is,
-	  * v[i] = coefficient of x^i.
-	  */
-	template <class ANY>
-	Element& init( Element& p, const std::vector<ANY>& v ) const {
-		p = 0;
-		Coeff temp;
-		for( long i = 0; i < (long)v.size(); ++i ) {
-			_CField.init( temp, v[ (size_t) i ] );
-			if( !_CField.isZero(temp) )
-				NTL::SetCoeff( p, i, temp );
-		}
-		return p;
-	}
+		/** Initialize p to the constant y (p = y*x^0) */
+		Element& init( Element& p, const Coeff& y ) const
+		{
+			return p = y;
+		}
 
-	/** Initialize p from a vector of coefficients.
-	  * The vector should be ordered the same way NTL does it: the front
-	  * of the vector corresponds to the trailing coefficients, and the back
-	  * of the vector corresponds to the leading coefficients.  That is,
-	  * v[i] = coefficient of x^i.
-	  */
-	Element& init( Element& p, const std::vector<Coeff>& v ) const {
-		p = 0;
-		for( long i = 0; i < (long)v.size(); ++i )
-			NTL::SetCoeff( p, i, v[ (size_t) i ] );
-		return p;
-	}
+		/** Initialize p from a vector of coefficients.
+		 * The vector should be ordered the same way NTL does it: the front
+		 * of the vector corresponds to the trailing coefficients, and the back
+		 * of the vector corresponds to the leading coefficients.  That is,
+		 * v[i] = coefficient of x^i.
+		 */
+		template <class ANY>
+		Element& init( Element& p, const std::vector<ANY>& v ) const
+		{
+			p = 0;
+			Coeff temp;
+			for( long i = 0; i < (long)v.size(); ++i ) {
+				_CField.init( temp, v[ (size_t) i ] );
+				if( !_CField.isZero(temp) )
+					NTL::SetCoeff( p, i, temp );
+			}
+			return p;
+		}
 
-	/** Convert p to a vector of coefficients.
-	  * The vector will be ordered the same way NTL does it: the front
-	  * of the vector corresponds to the trailing coefficients, and the back
-	  * of the vector corresponds to the leading coefficients.  That is,
-	  * v[i] = coefficient of x^i.
-	  */
-	template< class ANY >
-	std::vector<ANY>& convert( std::vector<ANY>& v, const Element& p ) const
-	{
-		v.clear();
-		ANY temp;
-		for( long i = 0; i <= this->deg(p); ++i ) {
-			_CField.convert( temp, NTL::coeff( p, i ) );
-			v.push_back( temp );
+		/** Initialize p from a vector of coefficients.
+		 * The vector should be ordered the same way NTL does it: the front
+		 * of the vector corresponds to the trailing coefficients, and the back
+		 * of the vector corresponds to the leading coefficients.  That is,
+		 * v[i] = coefficient of x^i.
+		 */
+		Element& init( Element& p, const std::vector<Coeff>& v ) const
+		{
+			p = 0;
+			for( long i = 0; i < (long)v.size(); ++i )
+				NTL::SetCoeff( p, i, v[ (size_t) i ] );
+			return p;
 		}
-		return v;
-	}
 
-	/** Convert p to a vector of coefficients.
-	  * The vector will be ordered the same way NTL does it: the front
-	  * of the vector corresponds to the trailing coefficients, and the back
-	  * of the vector corresponds to the leading coefficients.  That is,
-	  * v[i] = coefficient of x^i.
-	  */
-	std::vector<Coeff>& convert( std::vector<Coeff>& v, const Element& p )
-		const
-	{
-		v.clear();
-		for( long i = 0; i <= (long)this->deg(p); ++i )
-			v.push_back( NTL::coeff(p,i) );
-		return v;
-	}
+		/** Convert p to a vector of coefficients.
+		 * The vector will be ordered the same way NTL does it: the front
+		 * of the vector corresponds to the trailing coefficients, and the back
+		 * of the vector corresponds to the leading coefficients.  That is,
+		 * v[i] = coefficient of x^i.
+		 */
+		template< class ANY >
+		std::vector<ANY>& convert( std::vector<ANY>& v, const Element& p ) const
+		{
+			v.clear();
+			ANY temp;
+			for( long i = 0; i <= this->deg(p); ++i ) {
+				_CField.convert( temp, NTL::coeff( p, i ) );
+				v.push_back( temp );
+			}
+			return v;
+		}
 
-	/** Test if an element equals zero */
-	bool isZero( const Element& x ) const {
-		return ( (this->deg(x) == 0) && 
-		         ( _CField.isZero( NTL::ConstTerm(x) ) ) );
-	}
+		/** Convert p to a vector of coefficients.
+		 * The vector will be ordered the same way NTL does it: the front
+		 * of the vector corresponds to the trailing coefficients, and the back
+		 * of the vector corresponds to the leading coefficients.  That is,
+		 * v[i] = coefficient of x^i.
+		 */
+		std::vector<Coeff>& convert( std::vector<Coeff>& v, const Element& p ) const
+		{
+			v.clear();
+			for( long i = 0; i <= (long)this->deg(p); ++i )
+				v.push_back( NTL::coeff(p,i) );
+			return v;
+		}
 
-	/** Test if an element equals one */
-	bool isOne( const Element& x ) const {
-		return ( (this->deg(x) == 0) && 
-		         ( _CField.isOne( NTL::ConstTerm(x) ) ) );
-	}
+		/** Test if an element equals zero */
+		bool isZero( const Element& x ) const
+		{
+			return ( (this->deg(x) == 0) &&
+				 ( _CField.isZero( NTL::ConstTerm(x) ) ) );
+		}
 
-	/** The LinBox field for coefficients */
-	const CoeffField& getCoeffField() const { return _CField; }
+		/** Test if an element equals one */
+		bool isOne( const Element& x ) const
+		{
+			return ( (this->deg(x) == 0) &&
+				 ( _CField.isOne( NTL::ConstTerm(x) ) ) );
+		}
 
-	/** Get the degree of a polynomial 
-	  * Unlike NTL, deg(0)=0.
-	  */
-	size_t deg( const Element& p ) const {
-		long temp = NTL::deg(p);
-		if( temp == -1 ) return 0;
-		else return static_cast<size_t>(temp);
-	}
+		/** The LinBox field for coefficients */
+		const CoeffField& getCoeffField() const
+		{ return _CField; }
+
+		/** Get the degree of a polynomial
+		 * Unlike NTL, deg(0)=0.
+		 */
+		size_t deg( const Element& p ) const
+		{
+			long temp = NTL::deg(p);
+			if( temp == -1 ) return 0;
+			else return static_cast<size_t>(temp);
+		}
 
-	/** r will be set to the reverse of p. */
-	Element& rev( Element& r, const Element& p ) {
-		NTL::reverse(r,p);
-		return r;
-	}
+		/** r will be set to the reverse of p. */
+		Element& rev( Element& r, const Element& p ) {
+			NTL::reverse(r,p);
+			return r;
+		}
 
-	/** r is itself reversed. */
-	Element& revin( Element& r ) {
-		return r = NTL::reverse(r);
-	}
+		/** r is itself reversed. */
+		Element& revin( Element& r ) {
+			return r = NTL::reverse(r);
+		}
 
-	/** Get the leading coefficient of this polynomial. */
-	Coeff& leadCoeff( Coeff& c, const Element& p ) const {
-		c = NTL::LeadCoeff(p);
-		return c;
-	}
+		/** Get the leading coefficient of this polynomial. */
+		Coeff& leadCoeff( Coeff& c, const Element& p ) const
+		{
+			c = NTL::LeadCoeff(p);
+			return c;
+		}
 
-	/** Get the coefficient of x^i in a given polynomial */
-	Coeff& getCoeff( Coeff& c, const Element& p, size_t i ) const {
-		c = NTL::coeff( p, (long)i );
-		return c;
-	}
+		/** Get the coefficient of x^i in a given polynomial */
+		Coeff& getCoeff( Coeff& c, const Element& p, size_t i ) const
+		{
+			c = NTL::coeff( p, (long)i );
+			return c;
+		}
 
-	/** Set the coefficient of x^i in a given polynomial */
-	Element& setCoeff( Element& p, size_t i, const Coeff& c ) const {
-		NTL::SetCoeff(p,(long)i,c);
-		return p;
-	}
+		/** Set the coefficient of x^i in a given polynomial */
+		Element& setCoeff( Element& p, size_t i, const Coeff& c ) const
+		{
+			NTL::SetCoeff(p,(long)i,c);
+			return p;
+		}
 
-	/** Get the quotient of two polynomials */
-	Element& quo( Element& res, const Element& a, const Element& b ) const {
-		NTL::div(res,a,b);
-		return res;
-	}
+		/** Get the quotient of two polynomials */
+		Element& quo( Element& res, const Element& a, const Element& b ) const
+		{
+			NTL::div(res,a,b);
+			return res;
+		}
 
-	/** a = quotient of a, b */
-	Element& quoin( Element& a, const Element& b ) const {
-		return a /= b;
-	}
+		/** a = quotient of a, b */
+		Element& quoin( Element& a, const Element& b ) const
+		{
+			return a /= b;
+		}
 
-	/** Get the remainder under polynomial division */
-	Element& rem( Element& res, const Element& a, const Element& b ) const {
-		NTL::rem(res,a,b);
-		return res;
-	}
+		/** Get the remainder under polynomial division */
+		Element& rem( Element& res, const Element& a, const Element& b ) const
+		{
+			NTL::rem(res,a,b);
+			return res;
+		}
 
-	/** a = remainder of a,b */
-	Element& remin( Element& a, const Element& b ) const {
-		return a %= b;
-	}
+		/** a = remainder of a,b */
+		Element& remin( Element& a, const Element& b ) const
+		{
+			return a %= b;
+		}
 
-	/** Get the quotient and remainder under polynomial division */
-	void quorem( Element& q, Element& r,
-	                 const Element& a, const Element& b ) const
-	{
-		NTL::DivRem(q,r,a,b);
-	}
+		/** Get the quotient and remainder under polynomial division */
+		void quorem( Element& q, Element& r,
+			     const Element& a, const Element& b ) const
+		{
+			NTL::DivRem(q,r,a,b);
+		}
 
-	/** Get characteristic of the field - same as characteristic of 
-	  * coefficient field. */
-	integer& characteristic( integer& c ) const 
+		/** Get characteristic of the field - same as characteristic of
+		 * coefficient field. */
+		integer& characteristic( integer& c ) const
 		{ return _CField.characteristic(c); }
 
-	/** Get the cardinality of the field.  Since the cardinality is
-	  * infinite, by convention we return -1.
-	  */
-	integer& cardinality( integer& c ) const 
+		/** Get the cardinality of the field.  Since the cardinality is
+		 * infinite, by convention we return -1.
+		 */
+		integer& cardinality( integer& c ) const
 		{ return c = static_cast<integer>(-1); }
-	
-	static inline integer getMaxModulus()
-		{ return CoeffField::getMaxModulus(); }
-
-    private:
-	/** Conversion to scalar types doesn't make sense and should not be
-	  * used.  Use getCoeff or leadCoeff to get the scalar values of
-	  * specific coefficients, and then convert them using coeffField()
-	  * if needed.
-	  */
-	template< class ANY >
-	ANY& convert( ANY& x, const Element& y ) const { return x; }
 
-    	CoeffField _CField;
-}; // end of class NTL_zz_pX
+		static inline integer getMaxModulus()
+		{ return CoeffField::getMaxModulus(); }
 
-/** Write a description of the field */
-// Oustide of class definition so write(ostream&,const Element&) from
-// UnparametricField still works.
-template<>
-std::ostream& UnparametricField<NTL::zz_pX>::write( std::ostream& os ) const {
-	return os << "Polynomial ring using NTL::zz_pX";
-}
+	private:
+		/** Conversion to scalar types doesn't make sense and should not be
+		 * used.  Use getCoeff or leadCoeff to get the scalar values of
+		 * specific coefficients, and then convert them using coeffField()
+		 * if needed.
+		 */
+		template< class ANY >
+		ANY& convert( ANY& x, const Element& y ) const
+		{ return x; }
+
+		CoeffField _CField;
+	}; // end of class NTL_zz_pX
+
+	/** Write a description of the field */
+	// Oustide of class definition so write(ostream&,const Element&) from
+	// UnparametricField still works.
+	template<>
+	std::ostream& UnparametricField<NTL::zz_pX>::write( std::ostream& os ) const
+	{
+		return os << "Polynomial ring using NTL::zz_pX";
+	}
 
 
 } // end of namespace LinBox
 
-#endif // __FIELD_NTL_lzz_pX_H
+#endif // __LINBOX_field_ntl_lzz_px_H
+
diff --git a/linbox/field/ntl-pid-lzz_p.h b/linbox/field/ntl-pid-lzz_p.h
index 7d0f8ab..025d414 100644
--- a/linbox/field/ntl-pid-lzz_p.h
+++ b/linbox/field/ntl-pid-lzz_p.h
@@ -1,12 +1,29 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* linbox/field/ntl-pid-lzz_p.h
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) 2010 LinBox
  * written by bds
  *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __NTL_PID_zz_p_H
-#define __NTL_PID_zz_p_H
+
+#ifndef __LINBOX_ntl_pid_zz_p_H
+#define __LINBOX_ntl_pid_zz_p_H
 
 #include "linbox/field/ntl-lzz_p.h"
 #include "linbox/util/debug.h"
@@ -27,38 +44,40 @@ namespace LinBox
 		typedef RingCategories::ModularTag categoryTag;
 	};
 
-    /** \brief extend Wrapper of zz_p from NTL.  Add PID functions
-	\ingroup field
-     */
-    struct NTL_PID_zz_p: public NTL_zz_p
-    {
+	/** \brief extend Wrapper of zz_p from NTL.  Add PID functions
+	  \ingroup field
+	  */
+	struct NTL_PID_zz_p: public NTL_zz_p
+	{
 	protected: long _modulus;
 	public:
-	NTL_PID_zz_p(long pp, int exp = 1) 
-    	: NTL_zz_p(pp), _modulus(pp) {
-		if( exp != 1 ) throw PreconditionFailed(__FUNCTION__,__LINE__,"exponent must be 1");
-	}
+		   NTL_PID_zz_p(long pp, int exp = 1) :
+			   NTL_zz_p(pp), _modulus(pp)
+		{
+			if( exp != 1 ) throw PreconditionFailed(__func__,__FILE__,__LINE__,"exponent must be 1");
+		}
+
+		   Element& gcd(Element& g, const Element& a, const Element& b) const
+		   {   g = NTL::GCD(NTL::rep(a), NTL::rep(b));
+			   g = NTL::GCD(NTL::rep(g), _modulus);
+			   return g;
+		   }
 
-        Element& gcd(Element& g, const Element& a, const Element& b) const
-	{   g = NTL::GCD(NTL::rep(a), NTL::rep(b));  
-	    g = NTL::GCD(NTL::rep(g), _modulus);
-	    return g;
-	}
+		   Element& gcdin(Element& a, const Element& b) const
+		   {   return gcd(a,a, b);  }
 
-        Element& gcdin(Element& a, const Element& b) const
-	{   return gcd(a,a, b);  }
+		   bool isUnit(const Element& a) const
+		   {   return 1 == NTL::GCD(NTL::rep(a), _modulus);  }
 
-	bool isUnit(const Element& a) const
-	{   return 1 == NTL::GCD(NTL::rep(a), _modulus);  }
+		   Element& div(Element& c, const Element& a, const Element& b) const
+		   {   return c = NTL::rep(a)/NTL::GCD(NTL::rep(a),NTL::rep(b));   }
+		   Element& divin(Element& a, const Element& b) const
+		   {   return div(a, a, b);   }
 
-	Element& div(Element& c, const Element& a, const Element& b) const
-	{   return c = NTL::rep(a)/NTL::GCD(NTL::rep(a),NTL::rep(b));   }
-	Element& divin(Element& a, const Element& b) const
-	{   return div(a, a, b);   }
+		   static inline double getMaxModulus() { return (double)NTL_SP_BOUND; }
+	};
 
-	static inline double getMaxModulus() { return (double)NTL_SP_BOUND; }
-    };
-	    
 } // namespace LinBox
 
-#endif // __NTL_PID_zz_p_H
+#endif // __LINBOX_ntl_pid_zz_p_H
+
diff --git a/linbox/field/ntl.doxy b/linbox/field/ntl.doxy
new file mode 100644
index 0000000..70d5550
--- /dev/null
+++ b/linbox/field/ntl.doxy
@@ -0,0 +1,11 @@
+// Copyright (C) 2010 Brice Boyer, part of LinBox, GNU LGPL, see COPYING
+
+/*! @ingroup field
+ at defgroup NTL NTL
+
+ at brief NO DOC
+
+*/
+
+
+// vim:syntax=doxygen
diff --git a/linbox/field/ntl.h b/linbox/field/ntl.h
index 1d5c6c6..e053824 100644
--- a/linbox/field/ntl.h
+++ b/linbox/field/ntl.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/field/ntl.h
  * Copyright (C) 1999-2002 William J Turner,
  *               2001 Bradford Hovinen
@@ -16,8 +16,8 @@
  * See COPYING for license information.
  */
 
-#ifndef __FIELD_NTL_H
-#define __FIELD_NTL_H
+#ifndef __LINBOX_field_ntl_H
+#define __LINBOX_field_ntl_H
 
 #include "linbox/field/ntl-RR.h"
 #include "linbox/field/ntl-ZZ_p.h"
@@ -26,4 +26,5 @@
 #include "linbox/field/ntl-lzz_pE.h"
 #include "linbox/field/ntl-GF2E.h"
 
-#endif // __FIELD_NTL_H
+#endif // __LINBOX_field_ntl_H
+
diff --git a/linbox/field/param-fuzzy.h b/linbox/field/param-fuzzy.h
index cbaf900..01a14c3 100644
--- a/linbox/field/param-fuzzy.h
+++ b/linbox/field/param-fuzzy.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/field/param-fuzzy.h
  * Copyright (C) 1999-2001 William J Turner,
  *               2001 Bradford Hovinen
@@ -25,8 +25,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __FIELD_PARAM_FUZZY_H
-#define __FIELD_PARAM_FUZZY_H
+#ifndef __LINBOX_param_fuzzy_H
+#define __LINBOX_param_fuzzy_H
 
 #include <iostream>
 
@@ -35,19 +35,18 @@
 #include <linbox/field/field-traits.h>
 
 // Namespace in which all LinBox code resides
-namespace LinBox 
-{ 
+namespace LinBox
+{
 	// Forward declarations
 	class ParamFuzzyRandIter;
 
 	/** Abstract parameterized field of "fuzzy" doubles.
-	 * Field has (non-static, non-negative) member to contain "fuzz value" of 
+	 * Field has (non-static, non-negative) member to contain "fuzz value" of
 	 * field.  Doubles within this fuzz value are considered to be equal.
-	\ingroup field
+	 \ingroup field
 	 */
-	class ParamFuzzy : public FieldInterface
-	{
-	    public:
+	class ParamFuzzy : public FieldInterface {
+	public:
 
 		/** element type.
 		 * It must meet the common object interface of elements as given in the
@@ -62,19 +61,21 @@ namespace LinBox
 		typedef ParamFuzzyRandIter RandIter;
 
 		/** @name Object Management
-		 */
+		*/
 		//@{
- 
+#if 0
 		/** Default constructor.
-		 */
-		//ParamFuzzy (void) {}
-
+		*/
+		ParamFuzzy (void) {}
+#endif
 		/** Constructor from an integer.
-		 * Sets the fuzz value of the field throug the static member of the 
+		 * Sets the fuzz value of the field throug the static member of the
 		 * element type.
 		 * @param value constant reference to double fuzz value
 		 */
-		ParamFuzzy (const double &value = .000000001) : _fuzz (value) {}
+		ParamFuzzy (const double &value = .000000001) :
+			_fuzz (value)
+		{}
 
 		/** Copy constructor.
 		 * Constructs ParamFuzzy object by copying the field.
@@ -82,14 +83,16 @@ namespace LinBox
 		 * into functions.
 		 * @param  F ParamFuzzy object.
 		 */
-		ParamFuzzy (const ParamFuzzy &F) : _fuzz (F._fuzz) {}
- 
+		ParamFuzzy (const ParamFuzzy &F) :
+			_fuzz (F._fuzz)
+		{}
+
 		/** Assignment operator.
 		 * @return reference to ParamFuzzy object for self
 		 * @param F constant reference to ParamFuzzy object
 		 */
 		ParamFuzzy &operator= (const ParamFuzzy &F)
-			{ return *this; }
+		{ return *this; }
 
 		/** Initialization of field base element from an integer.
 		 * Behaves like C++ allocator construct.
@@ -101,9 +104,15 @@ namespace LinBox
 		 * @param x field base element to contain output (reference returned).
 		 * @param y integer.
 		 */
-		Element &init (Element &x, const integer &y) const
-			{ return x = static_cast<double> (y); }
- 
+		Element &init (Element &x, const integer &y = 0) const
+		{ return x = y; }
+
+		/*! init (from double)
+		 * @param x,y
+		 */
+		Element &init (Element &x, const double &y) const
+		{ return x = y; }
+
 		/** Conversion of field base element to a template class T.
 		 * This function assumes the output field base element x has already been
 		 * constructed, but that it is not already initialized.
@@ -112,8 +121,13 @@ namespace LinBox
 		 * @param y constant field base element.
 		 */
 		integer &convert (integer &x, const Element &y) const
-			{ return x = static_cast<integer> (y); }
- 
+		{ return x = y; }
+		/*! convert (double)
+		 * @param x,y
+		 */
+		double &convert (double &x, const Element &y) const
+		{ return x = y; }
+
 		/** Assignment of one field base element to another.
 		 * This function assumes both field base elements have already been
 		 * constructed and initialized.
@@ -122,7 +136,7 @@ namespace LinBox
 		 * @param  y field base element.
 		 */
 		Element &assign (Element &x, const Element &y) const
-			{ return x = y; }
+		{ return x = y; }
 
 		/** Cardinality.
 		 * Return integer representing cardinality of the domain.
@@ -132,7 +146,7 @@ namespace LinBox
 		 * @return integer representing cardinality of the domain
 		 */
 		integer &cardinality (integer &c) const { return c = -1; }
- 
+
 		/** Characteristic.
 		 * Return integer representing characteristic of the domain.
 		 * Returns a positive integer to all domains with finite characteristic,
@@ -159,7 +173,7 @@ namespace LinBox
 		 * @param  y field base element
 		 */
 		bool areEqual (const Element &x, const Element &y) const
-			{ return ( ( x - y <= _fuzz ) && ( y - x <= _fuzz ) ); }
+		{ return ( ( x - y <= _fuzz ) && ( y - x <= _fuzz ) ); }
 
 		/** Addition.
 		 * x = y + z
@@ -171,8 +185,8 @@ namespace LinBox
 		 * @param  z field base element.
 		 */
 		Element &add (Element &x, const Element &y, const Element &z) const
-			{ return x = y + z; }
- 
+		{ return x = y + z; }
+
 		/** Subtraction.
 		 * x = y - z
 		 * This function assumes all the field base elements have already been
@@ -183,8 +197,8 @@ namespace LinBox
 		 * @param  z field base element.
 		 */
 		Element &sub (Element &x, const Element &y, const Element &z) const
-			{ return x = y - z; }
- 
+		{ return x = y - z; }
+
 		/** Multiplication.
 		 * x = y * z
 		 * This function assumes all the field base elements have already been
@@ -195,8 +209,8 @@ namespace LinBox
 		 * @param  z field base element.
 		 */
 		Element &mul (Element &x, const Element &y, const Element &z) const
-			{ return x = y * z; }
- 
+		{ return x = y * z; }
+
 		/** Division.
 		 * x = y / z
 		 * This function assumes all the field base elements have already been
@@ -207,8 +221,8 @@ namespace LinBox
 		 * @param  z field base element.
 		 */
 		Element &div (Element &x, const Element &y, const Element &z) const
-			{ return x = y / z; }
- 
+		{ return x = y / z; }
+
 		/** Additive Inverse (Negation).
 		 * x = - y
 		 * This function assumes both field base elements have already been
@@ -218,8 +232,8 @@ namespace LinBox
 		 * @param  y field base element.
 		 */
 		Element &neg (Element &x, const Element &y) const
-			{ return x = - y; }
- 
+		{ return x = - y; }
+
 		/** Multiplicative Inverse.
 		 * x = 1 / y
 		 * This function assumes both field base elements have already been
@@ -229,11 +243,11 @@ namespace LinBox
 		 * @param  y field base element.
 		 */
 		Element &inv (Element &x, const Element &y) const
-			{ return x = static_cast<double> (1) / y; }
+		{ return x = static_cast<double> (1) / y; }
 
 		/** Natural AXPY.
 		 * r  = a * x + y
-		 * This function assumes all field elements have already been 
+		 * This function assumes all field elements have already been
 		 * constructed and initialized.
 		 * @return reference to r.
 		 * @param  r field element (reference returned).
@@ -241,11 +255,11 @@ namespace LinBox
 		 * @param  x field element.
 		 * @param  y field element.
 		 */
-		Element &axpy (Element &r, 
-			       const Element &a, 
-			       const Element &x, 
+		Element &axpy (Element &r,
+			       const Element &a,
+			       const Element &x,
 			       const Element &y) const
-			{ return r = a * x + y; }
+		{ return r = a * x + y; }
 
 		//@} Arithmetic Operations
 
@@ -262,7 +276,7 @@ namespace LinBox
 		 * @param  x field base element.
 		 */
 		bool isZero (const Element &x) const
-			{ return ( ( x <= _fuzz ) && ( - x <= _fuzz ) ); }
+		{ return ( ( x <= _fuzz ) && ( - x <= _fuzz ) ); }
 
 		/** One equality.
 		 * Test if field base element is equal to one.
@@ -272,7 +286,7 @@ namespace LinBox
 		 * @param  x field base element.
 		 */
 		bool isOne (const Element &x) const
-			{ return ( ( x - 1 <= _fuzz ) && ( 1 - x <= _fuzz ) ); }
+		{ return ( ( x - 1 <= _fuzz ) && ( 1 - x <= _fuzz ) ); }
 
 		/** Inplace Addition.
 		 * x += y
@@ -282,7 +296,7 @@ namespace LinBox
 		 * @param  x field base element (reference returned).
 		 * @param  y field base element.
 		 */
-		Element &addin (Element &x, const Element &y) const { return x += y; } 
+		Element &addin (Element &x, const Element &y) const { return x += y; }
 
 		/** Inplace Subtraction.
 		 * x -= y
@@ -293,7 +307,7 @@ namespace LinBox
 		 * @param  y field base element.
 		 */
 		Element &subin (Element &x, const Element &y) const { return x -= y; }
- 
+
 		/** Inplace Multiplication.
 		 * x *= y
 		 * This function assumes both field base elements have already been
@@ -303,7 +317,7 @@ namespace LinBox
 		 * @param  y field base element.
 		 */
 		Element &mulin (Element &x, const Element &y) const { return x *= y; }
- 
+
 		/** Inplace Division.
 		 * x /= y
 		 * This function assumes both field base elements have already been
@@ -322,7 +336,7 @@ namespace LinBox
 		 * @param  x field base element (reference returned).
 		 */
 		Element &negin (Element &x) const { return x = -x; }
- 
+
 		/** Inplace Multiplicative Inverse.
 		 * x = 1 / x
 		 * This function assumes the field base elementhas already been
@@ -331,11 +345,11 @@ namespace LinBox
 		 * @param  x field base element (reference returned).
 		 */
 		Element &invin (Element &x) const
-			{ return x = static_cast<double> (1) / x; }
+		{ return x = static_cast<double> (1) / x; }
 
 		/** Inplace AXPY.
 		 * r  += a * x
-		 * This function assumes all field elements have already been 
+		 * This function assumes all field elements have already been
 		 * constructed and initialized.
 		 * Purely virtual
 		 * @return reference to r.
@@ -344,10 +358,10 @@ namespace LinBox
 		 * @param  x field element.
 		 */
 		Element &axpyin (Element &r, const Element &a, const Element &x) const
-			{ return r += a * x; }
- 
+		{ return r += a * x; }
+
 		//@} Inplace Arithmetic Operations
-		
+
 		/** @name Input/Output Operations */
 		//@{
 
@@ -355,9 +369,9 @@ namespace LinBox
 		 * @return output stream to which field is written.
 		 * @param  os  output stream to which field is written.
 		 */
-		std::ostream &write (std::ostream &os) const 
-			{ return os << " fuzz value " << _fuzz; }
- 
+		std::ostream &write (std::ostream &os) const
+		{ return os << " fuzz value " << _fuzz; }
+
 		/** Read field.
 		 * @return input stream from which field is read.
 		 * @param  is  input stream from which field is read.
@@ -372,8 +386,8 @@ namespace LinBox
 		 * @param  x   field base element.
 		 */
 		std::ostream &write (std::ostream &os, const Element &x) const
-			{ return os << x; }
- 
+		{ return os << x; }
+
 		/** Read field base element.
 		 * This function assumes the field base element has already been
 		 * constructed and initialized.
@@ -384,12 +398,12 @@ namespace LinBox
 		std::istream &read (std::istream &is, Element &x) const
 		{
 			is >> x;
-			return is; 
+			return is;
 		}
 
 		//@}
 
-	    private:
+	private:
 
 		/// Private static double for fuzz value
 		double _fuzz;
@@ -402,4 +416,5 @@ namespace LinBox
 
 #include "linbox/randiter/param-fuzzy.h"
 
-#endif // __FIELD_PARAM_FUZZY_H
+#endif // __LINBOX_param_fuzzy_H
+
diff --git a/linbox/field/rebind.h b/linbox/field/rebind.h
index 8df559e..abae65a 100644
--- a/linbox/field/rebind.h
+++ b/linbox/field/rebind.h
@@ -1,23 +1,42 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* linbox/field/rebind.h
- * Copyright (C) 2005 Jean-Guillaume Dumas
- * Time-stamp: <16 Jun 05 09:00:15 Jean-Guillaume.Dumas at imag.fr> 
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) 2005 LinBox
+ * Written by Jean-Guillaume Dumas <Jean-Guillaume.Dumas at imag.fr>
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
-#ifndef __LINBOX_REBIND_H
-#define __LINBOX_REBIND_H
+
+#ifndef __LINBOX_rebind_H
+#define __LINBOX_rebind_H
 
 namespace LinBox
 {
 
-/** \brief used in support of Hom, MatrixHom 
+	/** \brief used in support of Hom, MatrixHom
 
-Helps define rebind for vector types.  See blackbox/sparse.h for example of use.
-*/
-template<class XXX, class U>
-struct Rebind 
-{
-    typedef typename XXX::template rebind<U>::other other;
-};
+	  Helps define rebind for vector types.  See blackbox/sparse.h for example of use.
+	  */
+	template<class XXX, class U>
+	struct Rebind
+	{
+		typedef typename XXX::template rebind<U>::other other;
+	};
 
 }
-#endif
+#endif //__LINBOX_rebind_H
+
diff --git a/linbox/field/unparametric.h b/linbox/field/unparametric.h
index 03134ee..6b963d2 100644
--- a/linbox/field/unparametric.h
+++ b/linbox/field/unparametric.h
@@ -1,8 +1,10 @@
 /* -*- 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
 
 /* linbox/field/unparametric.h
  * Copyright (C) 1999-2005 William J Turner,
  *               2001 Bradford Hovinen
+ *               2005 Clement Pernet
  *
  * Written by W. J. Turner <wjturner at acm.org>,
  *            Bradford Hovinen <hovinen at cis.udel.edu>
@@ -22,9 +24,10 @@
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  */
- 
-#ifndef __FIELD_UNPARAMETRIC_H
-#define __FIELD_UNPARAMETRIC_H
+
+#ifndef __LINBOX_field_unparametric_H
+#define __LINBOX_field_unparametric_H
+#include <typeinfo>
 
 #include <string>
 #include <algorithm>
@@ -34,23 +37,31 @@
 #include "linbox/randiter/unparametric.h"
 #include "linbox/linbox-config.h"
 #include <linbox/field/field-traits.h>
+#include <fflas-ffpack/field/unparametric.h>
+//#if __LINBOX_HAVE_NTL
+//#include <linbox/field/ntl-RR.h>
+//#endif // __LINBOX_HAVE_NTL
 
-namespace LinBox 
-{
-	/** \brief Unparameterized field adapter.
-	\ingroup field
 
-	A field having an interface similar to that of floats is adapted to LinBox.
-
-	Used to generate efficient field classes for unparameterized fields (or hidden parameter fields).
-	 
-	Some fields are implemented by definition of the C++ arithmetic operators, such as z = x*y, 
-	for z, y, z instances of a type K.   The LinBox field 
-	Unparametric<K> is the adaptation to LinBox.
+namespace LinBox
+{
 
-	For a typical unparametric field, some of the methods must be defined in a specialization. 
+	template <typename Target, typename Source>
+	Target& Caster (Target& t, const Source& s)
+	{
+		return t = static_cast<Target>(s);
+	}
 
-	*/
+#if 0
+#if __LINBOX_HAVE_NTL
+	typedef NTL::RR Targ;
+	template <>
+	Targ& Caster<Targ, int> (Targ& t, const int& s)
+	{
+		return t = s;
+	}
+#endif // __LINBOX_HAVE_NTL
+#endif
 
 	template <class Ring>
 	struct ClassifyRing;
@@ -59,231 +70,138 @@ namespace LinBox
 	class UnparametricField;
 
 	template <class K>
-	struct ClassifyRing<UnparametricField<K> > { 
+	struct ClassifyRing<UnparametricField<K> > {
 		typedef RingCategories::GenericTag categoryTag;
 	};
 
+
+	/** \brief Unparameterized field adapter.
+	 * \ingroup field
+	 * \defgroup UnparametricField UnparametricField
+	 *
+	 * A field having an interface similar to that of floats is adapted to
+	 * LinBox.
+	 *
+	 *  Used to generate efficient field classes for unparameterized fields
+	 *  (or hidden parameter fields).
+	 *
+	 *  Some fields are implemented by definition of the C++ arithmetic
+	 *  operators, such as <code>z = x*y</code>, for \c x, \c y, \c z
+	 *  instances of a type \c K.  The LinBox field LinBox::Unparametric<K>
+	 *  is the adaptation to LinBox.
+	 *
+	 *  For a typical unparametric field, some of the methods must be
+	 *  defined in a specialization.
+	 */
 	template <class K>
-	class UnparametricField : public FieldInterface
-	{
-	    protected: integer _p; integer _card;
-	    public:
-    
+	class UnparametricField : public FieldInterface,
+		public  FFPACK::UnparametricField<K> {
+	protected:
+		integer _p; integer _card;
+	public:
+
 		/** @name Common Object Interface for a LinBox Field.
 		 * These methods and member types are required of all LinBox fields.
-		 * See \ref{FieldArchetype} for detailed specifications.
+		 * See \ref FieldArchetype  for detailed specifications.
 		 */
 		//@{
-    
+
 		/** The field's element type.
-		 * Type K must provide a default constructor, 
+		 * Type K must provide a default constructor,
 		 * a copy constructor, a destructor, and an assignment operator.
 		 */
 
-		typedef K Element;    
+		typedef K Element;
 
 		/// Type of random field element generators.
 		typedef UnparametricRandIter<K> RandIter;
 
 		/** @name Field Object Basics.
-		 */
+		*/
 		//@{
-    
+
 		/** Builds this field to have characteristic q and cardinality q<sup>e</sup>.
 		 *  This constructor must be defined in a specialization.
 		 */
-		UnparametricField(integer q = 0, size_t e = 1)
-		: _p(q), _card(q == 0 ? integer(-1) : pow(q, e) ) {}  // assuming q is a prime or zero.
+		UnparametricField(integer q = 0, size_t e = 1) :
+			FFPACK::UnparametricField<K>((unsigned long)q,(unsigned long)e),
+			_p(q), _card(q == 0 ? integer(-1) : pow(q, e) )
+			{}  // assuming q is a prime or zero.
 
 		/// construct this field as copy of F.
-		UnparametricField (const UnparametricField &F) : _p(F._p), _card(F._card){}
-    
-		/// 
-		~UnparametricField () {}
-    
-		/* Assignment operator.
-		 * Assigns UnparametricField object F to field.
-		 * @param  F UnparametricField object.
-		 */
-		 // I believe this should be virtual -bds
-		///
-		const UnparametricField &operator=(const UnparametricField &F) const { return *this; }
-		//@} Field Object Basics.
-    
-		/** @name Data Object Management.
-		 * first argument is set and the value is also returned.
-		 */
-	        //@{
-
-		/// x := y.  Caution: it is via cast to long.  Good candidate for specialization.
-		Element &init (Element &x, const integer &y=0) const 
-			{ return x = static_cast<const Element&> (static_cast<const long&> (y)); }
-
-    
-		/// x :=  y.  Caution: it is via cast to long.  Good candidate for specialization.
-		integer &convert (integer &x, const Element &y) const 
-		{ 
-			Element temp (y);
-			//Dan Roche changed this from long to integer.
-			return x = static_cast<integer> (temp); 
-		}
-    
-		/// x :=  y.  Caution: it is via cast to long.  Good candidate for specialization. --dpritcha
-		double &convert (double &x, const Element &y) const 
-		{ 
-			Element temp (y);
-			return x = static_cast<double> (temp); 
-		}
-    
-		///
-		Element &assign (Element &x, const Element &y) const { return x = y; }
-    
+		UnparametricField (const UnparametricField &F) :
+			FFPACK::UnparametricField<K>(F),_p(F._p), _card(F._card)
+		{}
+
+
+		// field/ntl-ZZ_p.h me les demande... //
+
+		Element&inv (Element&x, const Element&y)const{return FFPACK::UnparametricField<K>::inv(x,y);}
+		Element&invin (Element&x)const{return FFPACK::UnparametricField<K>::invin(x);}
+		std::ostream&write (std::ostream&os)const{return FFPACK::UnparametricField<K>::write(os);}
+		std::ostream&write (std::ostream&os, const Element&p)const{return FFPACK::UnparametricField<K>::write(os,p);}
+		bool isZero(const Element&x)const{return FFPACK::UnparametricField<K>::isZero(x);}
+		bool isOne(const Element&x)const{return FFPACK::UnparametricField<K>::isOne(x);}
+		long unsigned int characteristic(long unsigned int&p)const{return FFPACK::UnparametricField<K>::characteristic(p);}
+		long unsigned int characteristic()const{return FFPACK::UnparametricField<K>::characteristic();};
+		long unsigned int cardinality()const{return FFPACK::UnparametricField<K>::cardinality();};
+		template<typename Src>Element&init(Element&x, const Src&s)const{return Caster (x, s);}
+		std::istream&read(std::istream&is, Element&x)const{return FFPACK::UnparametricField<K>::read(is,x);}
+		std::istream&read(std::istream&is)const{return FFPACK::UnparametricField<K>::read(is);}
+		template<typename T>T&convert(T&x,const Element&y)const{return Caster(x,y);}
+
+		// fin des trucs zarbs //
+
 		/// c := cardinality of this field (-1 if infinite).
-		integer &cardinality (integer &c) const { return c = _card; }
-    
+		integer &cardinality (integer &c) const
+		{
+			return c = _card;
+		}
+
 		/// c := characteristic of this field (zero or prime).
-		integer &characteristic (integer &c) const { return c = _p; }
-    
+		integer &characteristic (integer &c) const
+		{
+			return c = _p;
+		}
+
 		//@} Data Object Management
-    
-		/// @name Comparison Predicates
-		//@{
-		///  x == y
-		bool areEqual (const Element &x, const Element &y) const { return x == y; }
-    
-		///  x == 0
-		bool isZero (const Element &x) const { return x == Element (0); }
-    
-		///  x == 1
-		bool isOne (const Element &x) const { return x == Element (1); }
-		//@} Comparison Predicates
-    
-		 
-		/** @name Arithmetic Operations 
-		 * The first argument is set and is also the return value.
-		 */
-		//@{
-    
-		/// x := y + z
-		Element &add (Element &x, const Element &y, const Element &z) const
-			{ return x = y + z; }
-    
-		/// x := y - z
-		Element &sub (Element &x, const Element &y, const Element &z) const
-			{ return x = y - z; }
-    
-		/// x := y*z
-		Element &mul (Element &x, const Element &y, const Element &z) const
-			{ return x = y * z; }
-    
-		/// x := y/z
-		Element &div (Element &x, const Element &y, const Element &z) const
-			{ return x = y / z; }
-    
-		/// x := -y
-		Element &neg (Element &x, const Element &y) const { return x = - y; }
-    
-		/// x := 1/y
-		Element &inv (Element &x, const Element &y) const 
-			{ return x = Element (1) / y; }
-    
-		/// z := a*x + y 
-		// more optimal implementation, if available, can be defined in a template specialization.
-		Element &axpy (Element &z, 
-			       const Element &a, 
-			       const Element &x, 
-			       const Element &y) const
-			{ return z = a * x + y; }
- 
-		//@} Arithmetic Operations
-    
-		/** @name Inplace Arithmetic Operations 
-		 * The first argument is modified and the result is the return value.
-		 */
-		//@{
-    
-		/// x := x + y
-		Element &addin (Element &x, const Element &y) const { return x += y; }
-    
-		/// x := x - y
-		Element &subin (Element &x, const Element &y) const { return x -= y; }
-    
-		/// x := x*y
-		Element &mulin (Element &x, const Element &y) const { return x *= y; }
-    
-		/// x := x/y
-		Element &divin (Element &x, const Element &y) const { return x /= y; }
-    
-		/// x := -x
-		Element &negin (Element &x) const { return x = - x; }
-    
-		/// x := 1/x
-		Element &invin (Element &x) const { return x = Element (1) / x; }
-    
-		/// y := a*x + y
-		Element &axpyin (Element &y, const Element &a, const Element &x) const
-			{ return y += a * x; }
- 
-		//@} Inplace Arithmetic Operations
-
-		/** @name Input/Output Operations */
-		//@{
-    
-		/** Print field.
-		 * @return output stream to which field is written.
-		 * @param  os  output stream to which field is written.
-		 */
-		std::ostream &write (std::ostream &os) const { return os << "unparamterized field"; }
-    
-		/** Read field.
-		 * @return input stream from which field is read.
-		 * @param  is  input stream from which field is read.
-		 */
-		std::istream &read (std::istream &is) const { return is; }
-    
-		/** Print field element.
-		 * @return output stream to which field element is written.
-		 * @param  os  output stream to which field element is written.
-		 * @param  x   field element.
-		 */
-		std::ostream &write (std::ostream &os, const Element &x) const { return os << x; }
-    
-		/** Read field element.
-		 * @return input stream from which field element is read.
-		 * @param  is  input stream from which field element is read.
-		 * @param  x   field element.
-		 */
-		std::istream &read (std::istream &is, Element &x) const { return is >> x; }
-    
-		//@}
-    
+
+
+
+
 		//@} Common Object Interface
-    
+
 		/** @name Implementation-Specific Methods.
 		 * These methods are not required of all LinBox fields
 		 * and are included only for the implementation of this field
 		 * template.
 		 */
 		//@{
-    
-		/// Default constructor
+
+		//- Default constructor
 		//UnparametricField (void) {}
-    
+
 		/** Constructor from field object.
 		 * @param  A unparameterized field object
 		 */
-		UnparametricField (const K &A) {} 
-    
+		UnparametricField (const K &A) {}
+
 		/** Constant access operator.
 		 * @return constant reference to field object
 		 */
-		const K &operator () (void) const { return Element (); }
-    
+		const K &operator () (void) const
+		{
+			return Element ();
+		}
+
 		/** Access operator.
 		 * @return reference to field object
 		 */
-		K &operator () (void) { return Element (); }
-    
+		K &operator () (void)
+		{
+			return Element ();
+		}
+
 		//@} Implementation-Specific Methods
 
 	}; // template <class K> class UnparametricField
@@ -291,6 +209,9 @@ namespace LinBox
 	template<class Field>
 	class FieldAXPY;
 
+	/*! @ingroup integers
+	 * @brief NO DOc
+	 */
 	template<>
 	class FieldAXPY<UnparametricField<integer> >  {
 	public:
@@ -298,76 +219,79 @@ namespace LinBox
 		typedef integer Element;
 
 		/** Constructor.
-                 * A faxpy object if constructed from a Field and a field element.
-                 * Copies of this objects are stored in the faxpy object.
-                 * @param F field F in which arithmetic is done
-                 */
-                FieldAXPY (const Field &F) : _F (F) { _y = 0; }
- 
-                /** Copy constructor.
-                 * @param faxpy
-                 */
-                FieldAXPY (const FieldAXPY<Field> &faxpy) : _F (faxpy._F), _y (faxpy._y) {}
- 
-                /** Assignment operator
-                 * @param faxpy
-                 */
-                FieldAXPY<Field> &operator = (const FieldAXPY &faxpy)
-                        { _y = faxpy._y; return *this; }
- 
-                /** Add a*x to y
-                 * y += a*x.
-                 * @param a constant reference to element a
-                 * @param x constant reference to element x
+		 * A faxpy object if constructed from a Field and a field element.
+		 * Copies of this objects are stored in the faxpy object.
+		 * @param F field F in which arithmetic is done
+		 */
+		FieldAXPY (const Field &F) :
+			_F (F)
+		{ _y = 0; }
+
+		/** Copy constructor.
+		 * @param faxpy
+		 */
+		FieldAXPY (const FieldAXPY<Field> &faxpy) :
+			_F (faxpy._F), _y (faxpy._y)
+		{}
+
+		/** Assignment operator
+		 * @param faxpy
+		 */
+		FieldAXPY<Field> &operator = (const FieldAXPY &faxpy)
+		{ _y = faxpy._y; return *this; }
+
+		/** Add a*x to y
+		 * y += a*x.
+		 * @param a constant reference to element a
+		 * @param x constant reference to element x
 		 * allow optimal multiplication, such as integer * int
-                 */
+		 */
 		template<class Element1>
-                inline Element&  mulacc (const Element &a, const Element1 &x)
-		{ 
-			return _y += (a * x); 
+		inline Element&  mulacc (const Element &a, const Element1 &x)
+		{
+			return _y += (a * x);
 		}
- 
+
 		template<class Element1>
-                inline Element& accumulate (const Element1 &t)
-		{ 
-			return _y += t; 
+		inline Element& accumulate (const Element1 &t)
+		{
+			return _y += t;
+		}
+
+		/** Retrieve y
+		 *
+		 * Performs the delayed modding out if necessary
+		 */
+		inline Element &get (Element &y) { y = _y; return y; }
+
+		/** Assign method.
+		 * Stores new field element for arithmetic.
+		 * @return reference to self
+		 * @param y constant reference to element a
+		 */
+		inline FieldAXPY &assign (const Element& y)
+		{
+			_y = y;
+			return *this;
 		}
- 
-                /** Retrieve y
-                 *
-                 * Performs the delayed modding out if necessary
-                 */
-                inline Element &get (Element &y) { y = _y; return y; }
- 
-                /** Assign method.
-                 * Stores new field element for arithmetic.
-                 * @return reference to self
-                 * @param y_init constant reference to element a
-                 */
-                inline FieldAXPY &assign (const Element& y)
-                {
-                        _y = y;
-                        return *this;
-                }
-		
+
 		inline void reset() {
 			_y = 0;
 		}
-			
-            private:
- 
-                /// Field in which arithmetic is done
-                Field _F;
- 
-                /// Field element for arithmetic
-                Element _y;
 
-	};
-	
-} // namespace LinBox
+	private:
+
+		/// Field in which arithmetic is done
+		Field _F;
 
+		/// Field element for arithmetic
+		Element _y;
 
+	};
+
+} // namespace LinBox
 
 #include "linbox/randiter/unparametric.h"
 
-#endif // __FIELD_UNPARAMETRIC_H_
+#endif // __LINBOX_field_unparametric_H
+
diff --git a/linbox/integer.h b/linbox/integer.h
index 03285f9..e35c1ef 100644
--- a/linbox/integer.h
+++ b/linbox/integer.h
@@ -1,62 +1,86 @@
 /* -*- 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
 /* Copyright(c)'94-97 by Givaro Team
- * Copyright(c)'2000-2002 by LinBox Team 
- * see the copyright file.
+ * Copyright(c)'2000-2002 by LinBox Team
+ * see the COPYING file for license information.
  * Created by M. Samama, T. Gautier
  *
  * Modified Jean-Guillaume.Dumas <Jean-Guillaume.Dumas at imag.fr>
  *          B. David Saunders <saunders at cis.udel.edu>,
  *          Bradford Hovinen <hovinen at cis.udel.edu>
  *          Gilles Villard <Gilles.Villard at ens-lyon.fr>
- *                        JGD Random functions back.                          
- *                        (2002/02/12 16:05:24) 
+ *                        JGD Random functions back.
+ *                        (2002/02/12 16:05:24)
  *
  */
 
-#ifndef __INTEGER_H
-#define __INTEGER_H
+/** @file integer.h
+ * \ingroup linbox
+ * \brief This is a representation of arbitrary integers.
+ *
+ * It is a wrapper of <a href=http://gmplib.org>GMP</a> integers.  Arithmetic operations are via
+ * \c C++ infix operator forms (eg. \c a*b) . It is for ``casual'' uses such as characteristics and
+ * cardinalities and when initializing field elements.  The integers are also represented as a
+ * LinBox ring for use in integer matrix computation, see PID-integer.h  or see  field/ntl-ZZ.h.
+ */
 
+#ifndef __LINBOX_integer_H
+#define __LINBOX_integer_H
+
+//#include <cstdint>
 #include "linbox/linbox-config.h"
 
 #include "gmp++/gmp++.h"
 
+#include <cfloat> // BB : needed on some rare platforms...
+#ifdef __LINBOX_HAVE_STDINT_H
+#define __STDC_LIMIT_MACROS
+#include <stdint.h>
+#endif
+
 namespace LinBox
 {
-	/** \brief This is a representation of arbitrary integers.  
-	 *
-	 * \ingroup linbox
-	 *
-	 * It is a wrapper of GMP integers.  Arithmetic operations are via
-C++ infix operator forms (eg. a*b) . It is for ``casual'' uses such as characteristics and
-cardinalities and when initializing field elements.  The integers are also represented as a 
-LinBox ring for use in integer matrix computation, see pid-integers.h or ntl-ZZ.h.
-	 */ 
-	typedef Integer integer;
+	/*! Integers in LinBox.
+	 * Integer representation from <a href=http://ljk.imag.fr/CASYS/LOGICIELS/givaro/>Givaro</a>.
+	 * @ingroup integers
+	 */
+	typedef ::Givaro::Integer integer;
+	typedef ::Givaro::Integer Integer;
 
-	typedef signed __LINBOX_INT8 int8;
-	typedef signed __LINBOX_INT16 int16;
+#if 0
+// These integer types are defined by Givaro
+	/// int8_t.
+	typedef signed __LINBOX_INT8 int8_t;
+	/// int16_t.
+	typedef signed __LINBOX_INT16 int16_t;
 
-	/** \memo This is a representation of 32 bit ints, usually equivalent to `int'.
+	/** @brief This is a representation of 32 bit ints, usually equivalent to \c int.
 	 *
-	 * The use of `int32' ensures you are working with 
-	 * 32 bit signed ints, [-2^31..2^31).  Similarly, int8, int16, and int64 are defined.
+	 * The use of \c int32_t ensures you are working with
+	 * 32 bit signed ints, \f$[-2^{31}\dots2^{31})\f$.  Similarly, \ref int8_t, \ref int16_t, and \ref int64_t are defined.
 	 */
-	typedef signed __LINBOX_INT32 int32;
+	typedef signed __LINBOX_INT32 int32_t;
 
-	typedef signed __LINBOX_INT64 int64;
+	/// int64_t.
+	typedef signed __LINBOX_INT64 int64_t;
 
-	typedef unsigned __LINBOX_INT8 uint8;
-	typedef unsigned __LINBOX_INT16 uint16;
+	/// unsigned int8_t.
+	typedef unsigned __LINBOX_INT8 uint8_t;
+	/// unsigned int16_t.
+	typedef unsigned __LINBOX_INT16 uint16_t;
 
-	/** This is a representation of 32 bit unsigned ints, usually equivalent to `unsigned int'.
+	/** This is a representation of 32 bit unsigned ints, usually
+	 * equivalent to `<code>unsigned int</code>'.
 	 *
-	 * The use of `uint32' ensures you are working with 
-	 * 32 bit unsigned ints, [0..2^32).  Similarly, uint8, uint16, and uint64 are defined.
+	 * The use of `uint32_t' ensures you are working with
+	 * 32 bit unsigned ints, \f$[0\cdots 2^32[\f$.  Similarly, uint8_t, uint16_t, and uint64_t are defined.
 	 */
-	typedef unsigned __LINBOX_INT32 uint32;
+	typedef unsigned __LINBOX_INT32 uint32_t;
+
+	/// unsigned int64_t.
+	typedef unsigned __LINBOX_INT64 uint64_t;
 
-	typedef unsigned __LINBOX_INT64 uint64;
+#endif
 
 	// Huh? -bds
 	template< class T >
@@ -64,14 +88,17 @@ LinBox ring for use in integer matrix computation, see pid-integers.h or ntl-ZZ.
 
 
 
-        // SPy to have access to protected members of integer
-	struct SpyInteger {
+        /*! @internal
+	 * Spy structure to have access to protected members of ::Givaro::Integer.
+	 */
+	struct SpyInteger
+	{
 
 	    struct InHeritsInteger : public integer {
 	    protected:
 	        friend struct SpyInteger;
-	    };        
-    
+	    };
+
 	    static const InHeritsInteger::Rep* get_rep(const integer& i) {
         	return static_cast<const InHeritsInteger&>(i).get_rep();
 	    }
@@ -87,4 +114,23 @@ LinBox ring for use in integer matrix computation, see pid-integers.h or ntl-ZZ.
 
 }
 
-#endif // __INTEGER_H
+// Dependency to GIVARO >= 3.3.4
+/* givaro/givconfig.h so provides the fixed width integer types such as
+ * int16_t, uint8_t, etc.  The typenames int16, uint8, etc are no longer used
+ * in LinBox or Givaro.
+ */
+#include <givaro/givconfig.h>
+#include <math.h>
+namespace LinBox
+{
+// Natural logarithm of a
+// log(2) being close to 0.69314718055994531
+inline double naturallog(const ::Givaro::Integer& a) {
+  signed long int exp;
+  double d = mpz_get_d_2exp( &exp, (mpz_ptr)(LinBox::SpyInteger::get_rep(a) ) );
+  return (double)exp*0.69314718055994531+log(d);
+}
+}
+
+#endif // __LINBOX_integer_H
+
diff --git a/linbox/integer.inl b/linbox/integer.inl
deleted file mode 100644
index 64f9520..0000000
--- a/linbox/integer.inl
+++ /dev/null
@@ -1,279 +0,0 @@
-/* -*- mode: c; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* linbox/integer.inl
- *
- * Copyright(c)'94-97 by Givaro Team
- * Copyright(c)'2000-2002 by LinBox Team
- * see the copyright file.
- * Created by M. Samama, T. Gautier
- *
- * Modified Jean-Guillaume.Dumas <Jean-Guillaume.Dumas at imag.fr>
- *          B. David Saunders <saunders at cis.udel.edu>,
- *          Bradford Hovinen <hovinen at cis.udel.edu>
- *          Gilles Villard <Gilles.Villard at ens-lyon.fr>
- *                        Fri Apr  5 16:55:46 EST 2002
- *                        JGD Random functions back.
- *                        (2002/02/12 16:05:24) 
- *
- */
-
-#include "linbox/integer.h"
-
-namespace LinBox 
-{
-
-inline integer::~integer()
-{
-	mpz_clear((mpz_ptr)&gmp_rep);
-}
-
-inline integer::integer(const integer &n) {
-	mpz_init_set ( (mpz_ptr)&gmp_rep, (mpz_ptr)&(n.gmp_rep)) ;
-}
-
-inline integer& integer::logcpy(const integer &n)
-{
-	if (this == &n) return *this;
-	mpz_set ( (mpz_ptr)&gmp_rep, (mpz_ptr)&(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 = 0) { mpz_init_set_si((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) ; }
-
-//-----------------------------integer(double)
-inline integer::integer(double d) { mpz_init_set_d((mpz_ptr)&gmp_rep, d) ; }
-
-//-------------------------------------------------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 == (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 == (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 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& 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_ptr)&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; }
-
-// -- 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; }
-
-// -- 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; }
-
-// -- 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_ptr)&gmp_rep ); }
-
-inline int isone(const integer& a) { return ! mpz_cmp_ui((mpz_ptr)&(a.gmp_rep), 1UL); }
-
-inline int iszero(const integer& a) { return ! mpz_cmp_ui((mpz_ptr)&(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 ==0; }
-
-inline int sign(const integer& a) { return a.priv_sign(); }
-
-inline unsigned long length(const integer& a) { return mpz_size( (mpz_ptr)&(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_ptr)&gmp_rep ) ; }
-
-inline unsigned long integer::operator[](size_t i) const
-{
-	if ( mpz_size( (mpz_ptr)&gmp_rep ) > i)
-		return mpz_getlimbn( (mpz_ptr)&gmp_rep, i);
-	else
-		return 0;
-}
-
-inline integer operator <<= (integer& n, unsigned int l) {  return n = n << l; }
-inline integer operator <<= (integer& n, unsigned long l) {  return n = n << l; } 
-inline integer operator >>= (integer& n, unsigned int l) {  return n = n >> l; } 
-inline integer operator >>= (integer& n, unsigned long l) {  return n = n >> l; }
-
-//-------------------------------------------------inline >> & << operators
-inline ostream& operator<< (ostream& o, const integer& a) { return a.print(o); }
- 
-
-//----------------------- Random integers ----------
-
-inline integer integer::random(int sz = 1)
-{
-  integer res;
-  mpz_random((mpz_ptr) &(res.gmp_rep), sz);
-  return res;
-}
-
-inline integer integer::nonzerorandom(int sz) {
-    integer r;
-    while(iszero(r  = random(sz) )) {};
-    return r;
-}
-
-inline integer& integer::random (integer& r, const integer& similar)
-{
-     mpz_random((mpz_ptr) &(r.gmp_rep), mpz_size( (mpz_ptr)&(similar.gmp_rep) )
-);
-     mpz_tdiv_r( (mpz_ptr)&(r.gmp_rep), (mpz_ptr)&(r.gmp_rep), (mpz_ptr)&(similar.gmp_rep) );
-     return r;
-};
-
-inline integer& integer::nonzerorandom (integer& r, const integer& size) {
-    while (iszero(r = random(r,size))) {};
-    return r;
-}
-
-
-inline integer& integer::random (integer& r, long size = 1)
-{
-    mpz_random((mpz_ptr) &(r.gmp_rep), size);
-    return r;
-};
-
-
-inline integer& integer::nonzerorandom (integer& r, long size = 1)
-{    while (iszero(r = random(r,size))) {};
-    return r;
-}
-
-
-}
diff --git a/linbox/linbox-config.h b/linbox/linbox-config.h
index b506e45..e3cc965 100644
--- a/linbox/linbox-config.h
+++ b/linbox/linbox-config.h
@@ -3,18 +3,10 @@
  
 /* linbox/linbox-config.h. Generated automatically at end of configure. */
 /* config.h.  Generated from config.h.in by configure.  */
-/* config.h.in.  Generated from configure.in by autoheader.  */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
 
-/* Enable Autoimplementation of dgetri routine with dtrti and dtrsm */
-/* #undef __LINBOX_AUTOIMPLEMENT_DGETRI */
-
-/* Define if BLAS routines are available */
-#ifndef __LINBOX_BLAS_AVAILABLE 
-#define __LINBOX_BLAS_AVAILABLE   
-#endif
-
-/* Define if GMP has no <gmpxx.h> */
-/* #undef __LINBOX_GMP_NO_CXX */
+/* Define if building universal (internal helper macro) */
+/* #undef __LINBOX_AC_APPLE_UNIVERSAL_BUILD */
 
 /* Define if GMP is version 3.xxx */
 /* #undef __LINBOX_GMP_VERSION_3 */
@@ -22,29 +14,23 @@
 /* Define that architecture uses big endian storage */
 /* #undef __LINBOX_HAVE_BIG_ENDIAN */
 
-/* Define if BLAS is installed */
-#ifndef __LINBOX_HAVE_BLAS 
-#define __LINBOX_HAVE_BLAS  1 
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#ifndef __LINBOX_HAVE_DLFCN_H 
+#define __LINBOX_HAVE_DLFCN_H  1 
 #endif
 
-/* Define if C interface to BLAS is available */
-#ifndef __LINBOX_HAVE_CBLAS 
-#define __LINBOX_HAVE_CBLAS  1 
+/* Define if FFLAFLAS is installed */
+#ifndef __LINBOX_HAVE_FFLAFLAS 
+#define __LINBOX_HAVE_FFLAFLAS  1 
 #endif
 
-/* Define if dgetrf is available */
-/* #undef __LINBOX_HAVE_DGETRF */
-
-/* Define if dgetri is available */
-/* #undef __LINBOX_HAVE_DGETRI */
-
-/* Define to 1 if you have the <dlfcn.h> header file. */
-#ifndef __LINBOX_HAVE_DLFCN_H 
-#define __LINBOX_HAVE_DLFCN_H  1 
+/* Define to 1 if you have the <float.h> header file. */
+#ifndef __LINBOX_HAVE_FLOAT_H 
+#define __LINBOX_HAVE_FLOAT_H  1 
 #endif
 
-/* Define if dtrtri is available */
-/* #undef __LINBOX_HAVE_DTRTRI */
+/* ps2pdf available as external program */
+/* #undef __LINBOX_HAVE_GHOSTSCRIPT */
 
 /* Define if GIVARO is installed */
 #ifndef __LINBOX_HAVE_GIVARO 
@@ -56,6 +42,12 @@
 #define __LINBOX_HAVE_GMP  1 
 #endif
 
+/* gnuplot available as external program */
+/* #undef __LINBOX_HAVE_GNUPLOT */
+
+/* Define if IML is installed */
+/* #undef __LINBOX_HAVE_IML */
+
 /* Define to 1 if you have the <inttypes.h> header file. */
 #ifndef __LINBOX_HAVE_INTTYPES_H 
 #define __LINBOX_HAVE_INTTYPES_H  1 
@@ -64,6 +56,11 @@
 /* Define if LIDIA is installed */
 /* #undef __LINBOX_HAVE_LIDIA */
 
+/* Define to 1 if you have the <limits.h> header file. */
+#ifndef __LINBOX_HAVE_LIMITS_H 
+#define __LINBOX_HAVE_LIMITS_H  1 
+#endif
+
 /* Define that architecture uses little endian storage */
 #ifndef __LINBOX_HAVE_LITTLE_ENDIAN 
 #define __LINBOX_HAVE_LITTLE_ENDIAN  1 
@@ -78,13 +75,16 @@
 #endif
 
 /* Define if NTL is installed */
-#ifndef __LINBOX_HAVE_NTL 
-#define __LINBOX_HAVE_NTL  1 
-#endif
+/* #undef __LINBOX_HAVE_NTL */
 
 /* Define if SACLIB is installed */
 /* #undef __LINBOX_HAVE_SACLIB */
 
+/* Define to 1 if you have the <stddef.h> header file. */
+#ifndef __LINBOX_HAVE_STDDEF_H 
+#define __LINBOX_HAVE_STDDEF_H  1 
+#endif
+
 /* Define to 1 if you have the <stdint.h> header file. */
 #ifndef __LINBOX_HAVE_STDINT_H 
 #define __LINBOX_HAVE_STDINT_H  1 
@@ -110,6 +110,11 @@
 #define __LINBOX_HAVE_SYS_STAT_H  1 
 #endif
 
+/* Define to 1 if you have the <sys/time.h> header file. */
+#ifndef __LINBOX_HAVE_SYS_TIME_H 
+#define __LINBOX_HAVE_SYS_TIME_H  1 
+#endif
+
 /* Define to 1 if you have the <sys/types.h> header file. */
 #ifndef __LINBOX_HAVE_SYS_TYPES_H 
 #define __LINBOX_HAVE_SYS_TYPES_H  1 
@@ -132,7 +137,7 @@
 
 /* Canonical 64-bit data type */
 #ifndef __LINBOX_INT64 
-#define __LINBOX_INT64  long long 
+#define __LINBOX_INT64  long 
 #endif
 
 /* Canonical 8-bit data type */
@@ -140,6 +145,12 @@
 #define __LINBOX_INT8  char 
 #endif
 
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#ifndef __LINBOX_LT_OBJDIR 
+#define __LINBOX_LT_OBJDIR  ".libs/" 
+#endif
+
 /* define is the version of Maple have access function to gmp data */
 /* #undef __LINBOX_MAPLE_GMP_ACCESS */
 
@@ -155,12 +166,12 @@
 
 /* Define to the full name of this package. */
 #ifndef __LINBOX_PACKAGE_NAME 
-#define __LINBOX_PACKAGE_NAME  "linbox" 
+#define __LINBOX_PACKAGE_NAME  "LinBox" 
 #endif
 
 /* Define to the full name and version of this package. */
 #ifndef __LINBOX_PACKAGE_STRING 
-#define __LINBOX_PACKAGE_STRING  "linbox 1.1.6rc0" 
+#define __LINBOX_PACKAGE_STRING  "LinBox 1.2.0" 
 #endif
 
 /* Define to the one symbol short name of this package. */
@@ -168,9 +179,14 @@
 #define __LINBOX_PACKAGE_TARNAME  "linbox" 
 #endif
 
+/* Define to the home page for this package. */
+#ifndef __LINBOX_PACKAGE_URL 
+#define __LINBOX_PACKAGE_URL  "http://www.linalg.org/" 
+#endif
+
 /* Define to the version of this package. */
 #ifndef __LINBOX_PACKAGE_VERSION 
-#define __LINBOX_PACKAGE_VERSION  "1.1.6rc0" 
+#define __LINBOX_PACKAGE_VERSION  "1.2.0" 
 #endif
 
 /* The size of `char', as computed by sizeof. */
@@ -185,7 +201,7 @@
 
 /* The size of `long', as computed by sizeof. */
 #ifndef __LINBOX_SIZEOF_LONG 
-#define __LINBOX_SIZEOF_LONG  4 
+#define __LINBOX_SIZEOF_LONG  8 
 #endif
 
 /* The size of `long long', as computed by sizeof. */
@@ -214,12 +230,24 @@
 
 /* Version number of package */
 #ifndef __LINBOX_VERSION 
-#define __LINBOX_VERSION  "1.1.6rc0" 
+#define __LINBOX_VERSION  "1.2.0" 
 #endif
 
 /* optimized threshold for switching to strassen matrix multiplication */
 /* #undef __LINBOX_WINOTHRESHOLD */
 
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+#  define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+/* #  undef WORDS_BIGENDIAN */
+# endif
+#endif
+
 /* Define if Expat is installed */
 /* #undef __LINBOX_XMLENABLED */
  
diff --git a/linbox/linbox.doxy b/linbox/linbox.doxy
index 4bc0196..dba1c8e 100644
--- a/linbox/linbox.doxy
+++ b/linbox/linbox.doxy
@@ -1,11 +1,20 @@
-/** \defgroup linbox linbox
+// Copyright (C) 2010 LinBox, GNU LGPL, see COPYING for licence information
 
-  \brief This is the linbox library proper.  
+/*+ \defgroup linbox LinBox
+ *
+ * \brief This is the LinBox library proper.
+ *
+ *
+ */
 
-The subdirectories contain the template source code for all the linbox
-fuctionality.  See the Modules list of this documentation for the discussion
-of these main parts of linbox.  Also a few headers are directly in this directory.
-They are for including features of wrapped packages such as Givaro and NTL.
-
-*/
+/*! @namespace LinBox
+ * @brief Namespace in which all linbox code resides.
+ *
+ * The subdirectories of \c linbox/ contain the template source code for all
+ * the LinBox functionality.  See the <a href=modules.html>Modules</a> list for
+ * the documentation of the main parts of linbox.
+ *
+ * @warning The timer comes from Givaro and lives in its anonymous namespace.
+ */
 
+// vim:syn=doxygen
diff --git a/linbox/matrix/Makefile.am b/linbox/matrix/Makefile.am
index 73ce066..dc72fff 100644
--- a/linbox/matrix/Makefile.am
+++ b/linbox/matrix/Makefile.am
@@ -1,26 +1,25 @@
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 pkgincludesubdir=$(pkgincludedir)/matrix
 
-BASIC_HDRS =			\
-	archetype.h		\
-	matrix-category.h	\
-	sparse.h		\
-	sparse.inl		\
-	transpose-matrix.h		\
-	dense.h  		\
-	dense.inl		\
-	dense-submatrix.h	\
-	dense-submatrix.inl	\
-	dense-rows-matrix.h	\
-	matrix-domain.h		\
-	matrix-domain.inl	\
-	matrix-category.h	\
-	blas-matrix.h		\
-	factorized-matrix.h	\
-	factorized-matrix.inl	
+BASIC_HDRS =                                     \
+    archetype.h                                  \
+    matrix-category.h                            \
+    sparse.h             sparse.inl              \
+    transpose-matrix.h                           \
+    dense.h              dense.inl               \
+    dense-submatrix.h    dense-submatrix.inl     \
+    dense-rows-matrix.h                          \
+    matrix-domain.h      matrix-domain.inl       \
+    blas-matrix.h                                \
+    factorized-matrix.h  factorized-matrix.inl   \
+    matrix-permutation.h matrix-permutation.inl  \
+    random-matrix.h
 
 NTL_HDRS =
-GIVARO_HDRS = 
-LIDIA_HDRS = 
+GIVARO_HDRS =
+LIDIA_HDRS =
 
 if LINBOX_HAVE_NTL
 USE_NTL_HDRS = $(NTL_HDRS)
@@ -34,15 +33,15 @@ if LINBOX_HAVE_LIDIA
 USE_LIDIA_HDRS = $(LIDIA_HDRS)
 endif
 
-pkgincludesub_HEADERS =		\
-	$(BASIC_HDRS)		\
-	$(USE_NTL_HDRS)		\
-	$(USE_GIVARO_HDRS)	\
-	$(USE_LIDIA_HDRS)
-
-EXTRA_DIST = 			\
-	$(NTL_HDRS)		\
-	$(GIVARO_HDRS)		\
-	$(LIDIA_HDRS)		\
-	matrix.doxy
+pkgincludesub_HEADERS =     \
+    $(BASIC_HDRS)           \
+    $(USE_NTL_HDRS)         \
+    $(USE_GIVARO_HDRS)      \
+    $(USE_LIDIA_HDRS)
+
+EXTRA_DIST =            \
+    $(NTL_HDRS)         \
+    $(GIVARO_HDRS)      \
+    $(LIDIA_HDRS)       \
+    matrix.doxy
 
diff --git a/linbox/matrix/Makefile.in b/linbox/matrix/Makefile.in
index 9776b7a..b0f3a4b 100644
--- a/linbox/matrix/Makefile.in
+++ b/linbox/matrix/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -37,19 +38,26 @@ DIST_COMMON = $(pkgincludesub_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
-	$(top_srcdir)/macros/blas-check.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
 	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
 	$(top_srcdir)/macros/givaro-check.m4 \
 	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
 	$(top_srcdir)/macros/lidia-check.m4 \
 	$(top_srcdir)/macros/linbox-doc.m4 \
 	$(top_srcdir)/macros/linbox-misc.m4 \
 	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
 	$(top_srcdir)/macros/maple-check.m4 \
 	$(top_srcdir)/macros/ntl-check.m4 \
 	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -79,18 +87,21 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
 CC = @CC@
+CCNAM = @CCNAM@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
 DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -98,19 +109,24 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
 GIVARO_CFLAGS = @GIVARO_CFLAGS@
 GIVARO_LIBS = @GIVARO_LIBS@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
 GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
@@ -118,41 +134,52 @@ LIBTOOL = @LIBTOOL@
 LIDIA_CFLAGS = @LIDIA_CFLAGS@
 LIDIA_LIBS = @LIDIA_LIBS@
 LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MAPLE_CFLAGS = @MAPLE_CFLAGS@
 MAPLE_HOME = @MAPLE_HOME@
 MAPLE_LIBS = @MAPLE_LIBS@
 MAPLE_VERSION = @MAPLE_VERSION@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
 NTL_CFLAGS = @NTL_CFLAGS@
 NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RM = @RM@
 SACLIB_CFLAGS = @SACLIB_CFLAGS@
 SACLIB_LIBS = @SACLIB_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+TESTS_CFLAGS = @TESTS_CFLAGS@
 VERSION = @VERSION@
+WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -193,26 +220,27 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 pkgincludesubdir = $(pkgincludedir)/matrix
 BASIC_HDRS = \
-	archetype.h		\
-	matrix-category.h	\
-	sparse.h		\
-	sparse.inl		\
-	transpose-matrix.h		\
-	dense.h  		\
-	dense.inl		\
-	dense-submatrix.h	\
-	dense-submatrix.inl	\
-	dense-rows-matrix.h	\
-	matrix-domain.h		\
-	matrix-domain.inl	\
-	matrix-category.h	\
-	blas-matrix.h		\
-	factorized-matrix.h	\
-	factorized-matrix.inl	
+    archetype.h                                  \
+    matrix-category.h                            \
+    sparse.h             sparse.inl              \
+    transpose-matrix.h                           \
+    dense.h              dense.inl               \
+    dense-submatrix.h    dense-submatrix.inl     \
+    dense-rows-matrix.h                          \
+    matrix-domain.h      matrix-domain.inl       \
+    blas-matrix.h                                \
+    factorized-matrix.h  factorized-matrix.inl   \
+    matrix-permutation.h matrix-permutation.inl  \
+    random-matrix.h
 
 NTL_HDRS = 
 GIVARO_HDRS = 
@@ -221,16 +249,16 @@ LIDIA_HDRS =
 @LINBOX_HAVE_GIVARO_TRUE at USE_GIVARO_HDRS = $(GIVARO_HDRS)
 @LINBOX_HAVE_LIDIA_TRUE at USE_LIDIA_HDRS = $(LIDIA_HDRS)
 pkgincludesub_HEADERS = \
-	$(BASIC_HDRS)		\
-	$(USE_NTL_HDRS)		\
-	$(USE_GIVARO_HDRS)	\
-	$(USE_LIDIA_HDRS)
+    $(BASIC_HDRS)           \
+    $(USE_NTL_HDRS)         \
+    $(USE_GIVARO_HDRS)      \
+    $(USE_LIDIA_HDRS)
 
 EXTRA_DIST = \
-	$(NTL_HDRS)		\
-	$(GIVARO_HDRS)		\
-	$(LIDIA_HDRS)		\
-	matrix.doxy
+    $(NTL_HDRS)         \
+    $(GIVARO_HDRS)      \
+    $(LIDIA_HDRS)       \
+    matrix.doxy
 
 all: all-am
 
@@ -239,8 +267,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
 	      exit 1;; \
 	  esac; \
 	done; \
@@ -293,7 +321,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
@@ -406,6 +434,8 @@ dvi-am:
 
 html: html-am
 
+html-am:
+
 info: info-am
 
 info-am:
@@ -414,18 +444,28 @@ install-data-am: install-pkgincludesubHEADERS
 
 install-dvi: install-dvi-am
 
+install-dvi-am:
+
 install-exec-am:
 
 install-html: install-html-am
 
+install-html-am:
+
 install-info: install-info-am
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-am
 
+install-pdf-am:
+
 install-ps: install-ps-am
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
diff --git a/linbox/matrix/archetype.h b/linbox/matrix/archetype.h
index 789f7b2..9211cdc 100644
--- a/linbox/matrix/archetype.h
+++ b/linbox/matrix/archetype.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/matrix/archetype.h
  * Copyright (C) 2001 B. David Saunders,
  *               2001-2002 Bradford Hovinen,
@@ -21,8 +21,14 @@
  * See COPYING for license information
  */
 
-#ifndef __MATRIX_ARCHETYPE_H
-#define __MATRIX_ARCHETYPE_H
+/*!@file matrix/archetype.h
+ * @ingroup matrix
+ * @brief NO DOC
+ * @see \ref Archetypes
+ */
+
+#ifndef __LINBOX_matrix_archetype_H
+#define __LINBOX_matrix_archetype_H
 
 #include <iostream>
 #include <vector>
@@ -33,235 +39,248 @@
 namespace LinBox
 {
 
-/** @brief Directly-represented matrix archetype
- *
- * This archetype gives the common interface for matrices that have direct
- * representations. The matrices are required to provide iterators to access and
- * manipulate their entries, but not any matrix-matrix or matrix-vector
- * arithmetic. That is, they are pure containers. As such, they are only
- * parameterized on the element type, not on the field type.
- */
-  
-template <class _Element>
-class MatrixArchetype
-{
-    public:
-
-	typedef _Element Element;
-
-	/** Empty Constructor.
-	 */
-	MatrixArchetype ();
-
-	/** Constructor with size
-	 * @param  m  row dimension
-	 * @param  n  column dimension
-	 */
-	MatrixArchetype (size_t m, size_t n);
-
-	/** Copy constructor
-	 */
-	MatrixArchetype (const MatrixArchetype &M);
-
-	/** Operator =
-	 */
-	MatrixArchetype& operator= (const MatrixArchetype& M);
-
-	/** Get the number of rows in the matrix
-	 * @return Number of rows in matrix
-	 */
-	size_t rowdim () const;
-
-	/** Get the number of columns in the matrix
-	 * @return Number of columns in matrix
-	 */
-	size_t coldim () const;
-
-	/** \brief Resize the matrix to the given dimensions
-	 *
-	 * The state of the matrix's entries after a call to this method is
-	 * undefined.
+	/** @brief Directly-represented matrix archetype
 	 *
-	 * This interface is optional; a matrix can omit it if it makes no sense
-	 * in the context.
-	 *
-	 * @param m Number of rows
-	 * @param n Number of columns
-	 */
-	void resize (size_t m, size_t n);
-
-	/** @name Input and output
-	 */
-
-	//@{
-
-	/** Read the matrix from an input stream
-	 * @param file Input stream from which to read
-	 * @param F Field over which to read
+	 * This archetype gives the common interface for matrices that have direct
+	 * representations. The matrices are required to provide iterators to access and
+	 * manipulate their entries, but not any matrix-matrix or matrix-vector
+	 * arithmetic. That is, they are pure containers. As such, they are only
+	 * parameterized on the element type, not on the field type.
 	 */
-	template <class Field>
-	std::istream &read (std::istream &file, const Field &F);
 
-	/** Write the matrix to an output stream
-	 * @param os Output stream to which to write
-	 * @param F Field over which to write
-	 */
-	template <class Field>
-	std::ostream &write (std::ostream &os, const Field &F) const;
-
-	//@}
-
-	/** @name Access to matrix elements
-	 */
-
-	//@{
-
-	/** Set the entry at the (i, j) position to a_ij.
-	 * @param i Row number, 0...rowdim () - 1
-	 * @param j Column number 0...coldim () - 1
-	 * @param a_ij Element to set
-	 */
-	void setEntry (size_t i, size_t j, const Element &a_ij);
-
-	/** Get a writeable reference to the entry in the (i, j) position.
-	 * @param i Row index of entry
-	 * @param j Column index of entry
-	 * @return Reference to matrix entry
-	 */
-	Element &refEntry (size_t i, size_t j);
-
-	/** Get a read-only reference to the entry in the (i, j) position.
-	 * @param i Row index
-	 * @param j Column index
-	 * @return Const reference to matrix entry
-	 */
-	const Element &getEntry (size_t i, size_t j) const;
-
-	/** Copy the (i, j) entry into x, and return a reference to x.
-	 * This form is more in the Linbox style and is provided for interface
-	 * compatibility with other parts of the library
-	 * @param x Element in which to store result
-	 * @param i Row index
-	 * @param j Column index
-	 * @return Reference to x
-	 */
-	Element &getEntry (Element &x, size_t i, size_t j) const;
-
-	/* N.B. A matrix type may omit either one, but not both, of the
-	 * following two iterator types. If one type is omitted, then certain
-	 * restrictions on matrix-matrix arithmetic apply; see
-	 * @ref{MatrixDomain}
-	 */
-
-	/** @name Column of rows iterator
-	 * The column of rows iterator traverses the rows of the
-	 * matrix in ascending order. Dereferencing the iterator yields
-	 * a row vector in dense format
-	 */
-
-	class Row;
-	class ConstRow;  
-	class RowIterator;    
-	class ConstRowIterator;
-
-	RowIterator rowBegin ();  
-	RowIterator rowEnd ();
-	ConstRowIterator rowBegin () const;        
-	ConstRowIterator rowEnd () const;
-
-	/** @name Row of columns iterator
-	 * The row of columns iterator traverses the columns of the
-	 * matrix in ascending order. Dereferencing the iterator yields
-	 * a column vector in dense format
-	 */
-
-	class Col;
-	class ConstCol;
-	class ColIterator;
-	class ConstColIterator;
-    
-	typedef Col Column;
-	typedef ConstCol ConstColumn;
-
-	ColIterator colBegin ();
-	ColIterator colEnd ();
-	ConstColIterator colBegin () const;    
-	ConstColIterator colEnd () const;
-
-	/** @name Raw iterator
-	 *
-	 * The raw iterator is a method for accessing all entries in the matrix
-	 * in some unspecified order. This can be used, e.g. to reduce all
-	 * matrix entries modulo a prime before passing the matrix into an
-	 * algorithm.
-	 */
-
-	class RawIterator;
-	class ConstRawIterator;
-    
-	RawIterator rawBegin ();		  
-	RawIterator rawEnd ();
-	ConstRawIterator rawBegin () const;
-	ConstRawIterator rawEnd () const;
-
-	/** @name Raw Indexed iterator
-	 * Like the raw iterator, the indexed iterator is a method for 
-	 * accessing all entries in the matrix in some unspecified order. 
-	 * At each position of the the indexed iterator, it also provides 
-	 * the row and column indices of the currently referenced entry.
-	 * This is provided through it's rowIndex() and colIndex() functions.
-	 */
-
-        class RawIndexedIterator;
-        typedef const RawIndexedIterator ConstRawIndexedIterator;
-
-        RawIndexedIterator rawIndexedBegin();
-        RawIndexedIterator rawIndexedEnd();   
-	ConstRawIndexedIterator rawIndexedBegin() const;
-        ConstRawIndexedIterator rawIndexedEnd() const;   
-    
-	/** Retrieve a reference to a row.
-	 * Since rows may also be indexed, this allows A[i][j] notation
-	 * to be used.
-	 *
-	 * This may be omitted by an implementation if no Row type is available
-	 *
-	 * @param i Row index
-	 */
-	Row operator[] (size_t i);
-	ConstRow operator[] (size_t i) const;
-
-	//@}
-
-	/** @name Computing matrix information
-	 */
-
-	//@{
-
-	/** Compute the column density, i.e. the number of entries per column
-	 */
-	template <class Vector>
-	Vector &columnDensity (Vector &v) const;
-
-	/** Compute the transpose
-	 */
-	MatrixArchetype &transpose (MatrixArchetype &M) const;
-
-	//@}
-
-    protected:
-
-	std::vector<Element>  _rep;
-	size_t                _rows, _cols;
-};
-
-template <class Element>
-struct MatrixTraits< MatrixArchetype<Element> >
-{ 
-	typedef MatrixArchetype<Element> MatrixType;
-	typedef typename MatrixCategories::RowColMatrixTag MatrixCategory;
-};
+	template <class _Element>
+	class MatrixArchetype {
+	public:
+
+		typedef _Element Element;
+
+		/** Empty Constructor.
+		*/
+		MatrixArchetype ();
+
+		/** Constructor with size
+		 * @param  m  row dimension
+		 * @param  n  column dimension
+		 */
+		MatrixArchetype (size_t m, size_t n);
+
+		/** Copy constructor
+		*/
+		MatrixArchetype (const MatrixArchetype &M);
+
+		/** Operator =
+		*/
+		MatrixArchetype& operator= (const MatrixArchetype& M);
+
+		/** Get the number of rows in the matrix
+		 * @return Number of rows in matrix
+		 */
+		size_t rowdim () const;
+
+		/** Get the number of columns in the matrix
+		 * @return Number of columns in matrix
+		 */
+		size_t coldim () const;
+
+		/** \brief Resize the matrix to the given dimensions.
+		 *
+		 * The state of the matrix's entries after a call to this method is
+		 * undefined.
+		 *
+		 * This interface is optional; a matrix can omit it if it makes no sense
+		 * in the context.
+		 *
+		 * @param m Number of rows
+		 * @param n Number of columns
+		 */
+		void resize (size_t m, size_t n);
+
+		/** @name Input and output
+		*/
+
+		//@{
+
+		/** Read the matrix from an input stream.
+		 * @param file Input stream from which to read
+		 * @param F Field over which to read
+		 */
+		template <class Field>
+		std::istream &read (std::istream &file, const Field &F);
+
+		/** Write the matrix to an output stream.
+		 * @param os Output stream to which to write
+		 * @param F Field over which to write
+		 */
+		template <class Field>
+		std::ostream &write (std::ostream &os, const Field &F) const;
+
+		//@}
+
+		/**
+		 * @name Access to matrix elements
+		*/
+
+		//@{
+
+		/** Set the entry at the (i, j) position to a_ij.
+		 * @param i Row number, 0...rowdim () - 1
+		 * @param j Column number 0...coldim () - 1
+		 * @param a_ij Element to set
+		 */
+		void setEntry (size_t i, size_t j, const Element &a_ij);
+
+		/** Get a writeable reference to the entry in the (i, j) position.
+		 * @param i Row index of entry
+		 * @param j Column index of entry
+		 * @return Reference to matrix entry
+		 */
+		Element &refEntry (size_t i, size_t j);
+
+		/** Get a read-only reference to the entry in the (i, j) position.
+		 * @param i Row index
+		 * @param j Column index
+		 * @return Const reference to matrix entry
+		 */
+		const Element &getEntry (size_t i, size_t j) const;
+
+		/** Copy the (i, j) entry into x, and return a reference to x.
+		 * This form is more in the Linbox style and is provided for interface
+		 * compatibility with other parts of the library
+		 * @param x Element in which to store result
+		 * @param i Row index
+		 * @param j Column index
+		 * @return Reference to x
+		 */
+		Element &getEntry (Element &x, size_t i, size_t j) const;
+
+		/* N.B. A matrix type may omit either one, but not both, of the
+		 * following two iterator types. If one type is omitted, then certain
+		 * restrictions on matrix-matrix arithmetic apply; see
+		 * @ref MatrixDomain
+		 */
+
+		/** Column of rows iterator.
+		 * The column of rows iterator traverses the rows of the
+		 * matrix in ascending order. Dereferencing the iterator yields
+		 * a row vector in dense format
+		 */
+
+		//@{
+		class Row;
+		class ConstRow;
+		class RowIterator;
+		class ConstRowIterator;
+
+		/// rowBegin
+		RowIterator rowBegin ();
+		/// rowEnd
+		RowIterator rowEnd ();
+		/// const rowBegin
+		ConstRowIterator rowBegin () const;
+		/// const rowEnd
+		ConstRowIterator rowEnd () const;
+		//@}
+
+		/** Row of columns iterator.
+		 * The row of columns iterator traverses the columns of the
+		 * matrix in ascending order. Dereferencing the iterator yields
+		 * a column vector in dense format
+		 */
+		//@{
+		class Col;
+		class ConstCol;
+		class ColIterator;
+		class ConstColIterator;
+
+		typedef Col Column;
+		typedef ConstCol ConstColumn;
+/// colBegin
+		ColIterator colBegin ();
+		/// colEnd
+		ColIterator colEnd ();
+		/// const colBegin
+		ConstColIterator colBegin () const;
+		/// const colEnd
+		ConstColIterator colEnd () const;
+		//@}
+
+		/**  RawIterator.
+		 * The raw iterator is a method for accessing all entries in the matrix
+		 * in some unspecified order. This can be used, e.g. to reduce all
+		 * matrix entries modulo a prime before passing the matrix into an
+		 * algorithm.
+		 */
+		//@{
+		class RawIterator;
+		class ConstRawIterator;
+
+		RawIterator rawBegin ();
+		RawIterator rawEnd ();
+		ConstRawIterator rawBegin () const;
+		ConstRawIterator rawEnd () const;
+		//@}
+
+		/** Like the raw iterator, the indexed iterator is a method for
+		 * accessing all entries in the matrix in some unspecified order.
+		 *
+		 * At each position of the the indexed iterator, it also provides
+		 * the row and column indices of the currently referenced entry.
+		 * This is provided through it's \c rowIndex() and \c colIndex() functions.
+		 */
+		//@{
+		class RawIndexedIterator;
+		typedef const RawIndexedIterator ConstRawIndexedIterator;
+
+		RawIndexedIterator rawIndexedBegin();
+		RawIndexedIterator rawIndexedEnd();
+		ConstRawIndexedIterator rawIndexedBegin() const;
+		ConstRawIndexedIterator rawIndexedEnd() const;
+		//@}
+
+		/** Retrieve a reference to a row.
+		 * Since rows may also be indexed, this allows A[i][j] notation
+		 * to be used.
+		 *
+		 * This may be omitted by an implementation if no Row type is available
+		 *
+		 * @param i Row index
+		 */
+		Row operator[] (size_t i);
+		/// const version
+		ConstRow operator[] (size_t i) const;
+
+		//@}
+
+		/** @name Computing matrix information
+		*/
+
+		//@{
+
+		/** Compute the column density, i.e. the number of entries per column
+		*/
+		template <class Vector>
+		Vector &columnDensity (Vector &v) const;
+
+		/** Compute the transpose
+		*/
+		MatrixArchetype &transpose (MatrixArchetype &M) const;
+
+		//@}
+
+	protected:
+
+		std::vector<Element>  _rep;
+		size_t                _rows, _cols;
+	};
+
+	template <class Element>
+	struct MatrixTraits< MatrixArchetype<Element> >
+	{
+		typedef MatrixArchetype<Element> MatrixType;
+		typedef typename MatrixCategories::RowColMatrixTag MatrixCategory;
+	};
 
 } // namespace LinBox
 
-#endif // __MATRIX_ARCHETYPE_H
+#endif // __LINBOX_matrix_archetype_H
+
diff --git a/linbox/matrix/blas-matrix.h b/linbox/matrix/blas-matrix.h
index c71b56b..dfa81cf 100644
--- a/linbox/matrix/blas-matrix.h
+++ b/linbox/matrix/blas-matrix.h
@@ -1,10 +1,11 @@
 /* -*- 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
 /* linbox/matrix/blas-matrix.h
- * Copyright (C) 2004 Pascal Giorgi, Clément Pernet
+ * Copyright (C) 2004 Pascal Giorgi, Clément Pernet
  *
  * Written by :
  *               Pascal Giorgi  pascal.giorgi at ens-lyon.fr
- *               Clément Pernet clement.pernet at imag.fr
+ *               Clément Pernet clement.pernet at imag.fr
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -22,231 +23,416 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __BLAS_MATRIX_H
-#define __BLAS_MATRIX_H
+/*! @file matrix/blas-matrix.h
+ * @ingroup matrix
+ * A \c BlasMatrix<\c _element > represents a matrix as an array of
+ * <code>_element</code>s.
+ *
+ * @todo explain the differences with \c DenseMatrixBase<\c _element >
+ * and \c DenseSubmatrix<\c _element > or
+ * \c DenseMatrix<\c _field >...
+ */
+
+#ifndef __LINBOX_blas_matrix_H
+#define __LINBOX_blas_matrix_H
 
 
+#include <linbox/solutions/getentry.h>
 #include <linbox/matrix/dense.h>
 #include <linbox/matrix/dense-submatrix.h>
 #include <linbox/util/debug.h>
 #include <linbox/matrix/matrix-category.h>
 
-namespace LinBox {
+#include "linbox/algorithms/cra-full-multip.h"
+namespace LinBox
+{
 
+	// forward declaration
 	template<class Element>
 	class BlasMatrix;
-	
+
 	template <class Element>
 	class MatrixContainerTrait<BlasMatrix<Element> > {
 	public:
 		typedef MatrixContainerCategory::BlasContainer Type;
 	};
-	
+
 	template <class Element>
 	class MatrixContainerTrait<const BlasMatrix<Element> > {
 	public:
 		typedef MatrixContainerCategory::BlasContainer Type;
 	};
 
-
-	// @brief Limited docs so far.
+	/*! BlasMatrix.
+	 * @ingroup matrix
+	 * Limited docs so far.
+	 */
 	template <class _Element>
 	class BlasMatrix : public DenseSubmatrix<_Element> {
-		
+
 	public:
-		typedef _Element Element;
+		typedef _Element                                     Element;
+		// typedef _Element* pointer ?
+		typedef typename DenseSubmatrix<_Element>::Element * pointer;
+		typedef BlasMatrix<Element>                           Self_t;
 
-	protected:        
+	protected:
 		size_t   _stride;
 		bool      _alloc;
-		Element    *_ptr; 		
-		 
-	public:
-
-		BlasMatrix ()
-			: DenseSubmatrix<Element>(*(new DenseMatrixBase<Element> (0,0)),0,0,0,0), _stride(0),  _alloc(true) { _ptr = this->_M->FullIterator(); }
-
-		
-		
-		BlasMatrix (int m, int n) 
-			: DenseSubmatrix<Element>(*(new DenseMatrixBase<Element> (m,n)),0,0,m,n), _stride(n), _alloc(true) { _ptr = this->_M->FullIterator();}
+		pointer     _ptr;
 
+	private:
 
-		/** Constructor from a matrix stream */
-		template< class Field >
-		BlasMatrix(MatrixStream<Field>& ms)
-			: DenseSubmatrix<Element>(*(new DenseMatrixBase<Element> (ms))),  _alloc(true) { _ptr = this->_M->FullIterator(); _stride= this->coldim();}
-
+		/*! @internal
+		 * @name create BlasMatrix
+		 * @{ */
 
-		// Generic copy constructor from either a blackbox or a matrix container
-		template <class Matrix>
-		BlasMatrix (const Matrix &A)
-			: DenseSubmatrix<Element>(*(new DenseMatrixBase<Element> (A.rowdim(),A.coldim())),0,0,A.rowdim(),A.coldim()), _stride(A.coldim()) , _alloc(true)
-		{
-			_ptr = this->_M->FullIterator();
-			createBlasMatrix(A, typename MatrixContainerTrait<Matrix>::Type());
-		}
-		
-		// Generic copy constructor from either a blackbox or a matrix container (allow submatrix)
-		template <class Matrix>
-		BlasMatrix (const Matrix& A, const size_t i0,const size_t j0,const size_t m, const size_t n)
-			: DenseSubmatrix<Element>(*(new DenseMatrixBase<Element> (A.rowdim(),A.coldim())),0,0,A.rowdim(),A.coldim()), _stride(A.coldim()) , _alloc(true)
+		/*! @internal
+		 * Copy data according to blas container structure.
+		 * Specialisation for BlasContainer.
+		 */
+		template <class _Matrix>
+		void createBlasMatrix (const _Matrix& A, MatrixContainerCategory::BlasContainer)
 		{
-			_ptr = this->_M->FullIterator();
-			createBlasMatrix(A, i0, j0, m, n, typename MatrixContainerTrait<Matrix>::Type());
-		}
-
-		
-		// Copy data according to blas container structure
-		template <class Matrix>
-		void createBlasMatrix (const Matrix& A, MatrixContainerCategory::BlasContainer)	
-			
-		{
-			typename Matrix::ConstRawIterator         iter_value = A.rawBegin();
-			typename BlasMatrix<Element>::RawIterator  iter_addr = this->rawBegin();			
+			typename _Matrix::ConstRawIterator         iter_value = A.rawBegin();
+			RawIterator  iter_addr = this->rawBegin();
 			for (;iter_value != A.rawEnd(); ++iter_value,++iter_addr)
-				*iter_addr = *iter_value;			
+				*iter_addr = *iter_value;
 		}
 
-		// Copy data according to Matrix container structure
+		/*! @internal
+		 * Copy data according to Matrix container structure.
+		 * Specialisation for Container
+		 */
 		template <class Matrix>
-		void createBlasMatrix (const Matrix& A, MatrixContainerCategory::Container)	
-			
+		void createBlasMatrix (const Matrix& A, MatrixContainerCategory::Container)
 		{
-			// With both iterators, it is Segfaulting !!!!		
+			// With both iterators, it is Segfaulting !!!!
 			typename Matrix::ConstRawIndexedIterator  iter_index = A.rawIndexedBegin();
 			for (;iter_index != A.rawIndexedEnd(); ++iter_index)
-				this->_M->setEntry( iter_index.rowIndex(), 
-                                                    iter_index.colIndex(), 
-                                                    A.getEntry(iter_index.rowIndex(),iter_index.colIndex())
-                                                    );
-		}
-		
-		
-		// Copy data according to blackbox structure
+				this->_M->setEntry( iter_index.rowIndex(),
+						    iter_index.colIndex(),
+						    A.getEntry(iter_index.rowIndex(),iter_index.colIndex())
+						  );
+		}
+
+		/*! @internal
+		 * Copy data according to blackbox structure.
+		 * Specialisation for Blackbox.
+		 */
 		template <class Matrix>
-		void createBlasMatrix (const Matrix& A, MatrixContainerCategory::Blackbox)	
-			
+		void createBlasMatrix (const Matrix& A, MatrixContainerCategory::Blackbox)
 		{
 			typedef typename Matrix::Field Field;
 			typename Field::Element one, zero;
 			Field F = A.field();
 			F. init(one, 1);
 			F. init(zero, 0);
-			
+
 			std::vector<typename Field::Element> e(A.coldim(), zero), tmp(A.rowdim());
-			
-			typename BlasMatrix<Element>::ColIterator col_p;
-			
+			typedef typename DenseSubmatrix<_Element>::ColIterator ColIterator ;
+			ColIterator col_p;
+
 			typename BlasMatrix<Element>::Col::iterator elt_p;
-			
+
 			typename std::vector<typename Field::Element>::iterator e_p, tmp_p;
-			
-			
-			//for (col_p = colBegin(), e_p = e.begin();
+
+
 			for (col_p = DenseSubmatrix<_Element>:: colBegin(), e_p = e.begin();
-			     e_p != e.end(); ++ col_p, ++ e_p) {
-				
+			     e_p != e.end(); ++ col_p, ++ e_p)
+			{
+
 				F.assign(*e_p, one);
-				
+
 				A.apply (tmp, e);
-				
+
 				for (tmp_p = tmp.begin(), elt_p = col_p -> begin();
 				     tmp_p != tmp.end(); ++ tmp_p, ++ elt_p)
-					
+
 					F.assign(*elt_p, *tmp_p);
-				
+
 				F.assign(*e_p, zero);
-			}			
+			}
 		}
 
-		// Copy data according to Matrix container structure (allow submatrix)
-		template <class Matrix>
-		void createBlasMatrix (const Matrix& A, const size_t i0,const size_t j0,const size_t m, const size_t n, MatrixContainerCategory::Container)
+		/*! @internal
+		 * Copy data according to Matrix container structure (allow submatrix).
+		 * Specialisation for Container
+		 */
+		template <class _Matrix>
+		void createBlasMatrix (const _Matrix& A,
+				       const size_t i0,const size_t j0,
+				       const size_t m, const size_t n,
+				       MatrixContainerCategory::Container)
 		{
-		
-			typename Matrix::ConstRawIterator         iter_value = A.rawBegin();
-			typename Matrix::ConstRawIndexedIterator  iter_index = A.rawIndexedBegin();
-		
+
+			typename _Matrix::ConstRawIterator         iter_value = A.rawBegin();
+			typename _Matrix::ConstRawIndexedIterator  iter_index = A.rawIndexedBegin();
+
 			for (;iter_value != A.rawEnd(); ++iter_value,++iter_index){
 				size_t i,j;
 				i=iter_index.rowIndex();
 				j=iter_index.colIndex();
 				if (( i >= i0) && (i< i0+m) && (j >= j0) && (j < j0+n))
-					this->_M->setEntry(i-i0, j-j0, *iter_value);  
+					this->_M->setEntry(i-i0, j-j0, *iter_value);
 			}
 		}
-		// Copy data according to Matrix container structure (allow submatrix)
+
+		/*! @internal
+		 * Copy data according to Matrix container structure (allow submatrix).
+		 * Specialisation for BlasContainer.
+		 */
 		template <class Matrix>
-		void createBlasMatrix (const Matrix& A, const size_t i0,const size_t j0,const size_t m, const size_t n, MatrixContainerCategory::BlasContainer)
+		void createBlasMatrix (const Matrix& A,
+				       const size_t i0,const size_t j0,
+				       const size_t m, const size_t n,
+				       MatrixContainerCategory::BlasContainer)
 		{
-		
+
 			typename Matrix::ConstRawIterator         iter_value = A.rawBegin();
 			typename Matrix::ConstRawIndexedIterator  iter_index = A.rawIndexedBegin();
-		
+
 			for (;iter_value != A.rawEnd(); ++iter_value,++iter_index){
 				size_t i,j;
 				i=iter_index.rowIndex();
 				j=iter_index.colIndex();
 				if (( i >= i0) && (i< i0+m) && (j >= j0) && (j < j0+n))
-					this->_M->setEntry(i-i0, j-j0, *iter_value);  
+					this->_M->setEntry(i-i0, j-j0, *iter_value);
 			}
 		}
 
+		/*! @internal
+		 * Copy data according to blackbox structure (allow submatrix).
+		 * Specialisation for Blackbox matrices
+		 * @todo need to be implemented by succesive apply
+		 */
+		template <class Matrix>
+		void createBlasMatrix (const Matrix& A,
+				       const size_t i0,const size_t j0,
+				       const size_t m, const size_t n,
+				       MatrixContainerCategory::Blackbox)
+		{
+			throw(NotImplementedYet(__func__,__FILE__,__LINE__,
+						"need to be implemented by succesive apply"));
+		}
+
+		/*! @internal
+		 * @}
+		 */
+
+	public:
+		typedef typename DenseSubmatrix<_Element>::RawIterator RawIterator ; // for nvcc
+
+		/* Constructors. */
+
+		/*! Allocates a new \f$ 0 \times 0\f$ matrix.
+		 */
+		BlasMatrix () :
+			DenseSubmatrix<Element>(*(new DenseMatrixBase<Element> (0,0)),0,0,0,0),
+			_stride(0),  _alloc(true)
+		{
+			_ptr = this->_M->FullIterator();
+		}
+
+		/*! Allocates a new \f$ m \times n\f$ matrix.
+		 * @param m rows
+		 * @param n cols
+		 */
+		BlasMatrix (int m, int n) :
+			DenseSubmatrix<Element>(*(new DenseMatrixBase<Element> (m,n)),0,0,m,n),
+			_stride(n), _alloc(true)
+		{
+			_ptr = this->_M->FullIterator();
+		}
+
+		/*! Allocates a new \f$ m \times n\f$ matrix.
+		 * @param m rows
+		 * @param n cols
+		 */
+		BlasMatrix (size_t m, size_t n) :
+			DenseSubmatrix<Element>(*(new DenseMatrixBase<Element> (m,n)),0,0,m,n),
+			_stride(n), _alloc(true)
+		{
+			_ptr = this->_M->FullIterator();
+		}
 
-		// Copy data according to blackbox structure (allow submatrix)
+		/*! Constructor from a matrix stream.
+		 * @param ms matrix stream.
+		 */
+		template< class Field >
+		BlasMatrix(MatrixStream<Field>& ms) :
+			DenseSubmatrix<Element>(*(new DenseMatrixBase<Element> (ms))),  _alloc(true)
+		{
+			_ptr = this->_M->FullIterator();
+			_stride= this->coldim();
+		}
+
+		/*! Generic copy constructor from either a blackbox or a matrix container.
+		 * @param A matrix to be copied
+		 */
 		template <class Matrix>
-		void createBlasMatrix (const Matrix& A, const size_t i0,const size_t j0,const size_t m, const size_t n, MatrixContainerCategory::Blackbox) 			
+		BlasMatrix (const Matrix &A) :
+			DenseSubmatrix<Element>(*(new DenseMatrixBase<Element> (A.rowdim(),A.coldim())),0,0,A.rowdim(),A.coldim()),
+			_stride(A.coldim()) , _alloc(true)
 		{
-			// need to be implemented by succesive apply
+			_ptr = this->_M->FullIterator();
+			createBlasMatrix(A, typename MatrixContainerTrait<Matrix>::Type());
 		}
 
+		/*! Generic copy constructor from either a blackbox or a matrix container (allow submatrix).
+		 * @param A matrix to be copied
+		 * @param i0
+		 * @param j0
+		 * @param m rows
+		 * @param n columns
+		 */
+		template <class Matrix>
+		BlasMatrix (const Matrix& A,
+			    const size_t i0, const size_t j0,
+			    const size_t m, const size_t n) :
+			DenseSubmatrix<Element>( *(new DenseMatrixBase<Element> (m,n)),0,0,m,n),
+			_stride(A.coldim()) , _alloc(true)
+		{
+			_ptr = this->_M->FullIterator();
+			createBlasMatrix(A, i0, j0, m, n, typename MatrixContainerTrait<Matrix>::Type());
+		}
 
-		// Constructor from matrix (no copy)
-		BlasMatrix ( DenseMatrixBase<Element>& A )	
-			: DenseSubmatrix<Element>(A,0,0,A.rowdim(),A.coldim()), _stride(A.coldim()) , _alloc(false)
-		{ _ptr = this->_M->FullIterator();}
-		
-		// Constructor from matrix (no copy )
-		BlasMatrix ( DenseMatrixBase<Element>& A, const size_t i0,const size_t j0,const size_t m, const size_t n) 
-			: DenseSubmatrix<Element>(A,i0,j0,m,n), _stride(A.coldim()) , _alloc(false) 
-		{_ptr = this->_M->FullIterator();}
+		/*! Constructor.
+		 * @param A matrix to be copied
+		 * @param F ?
+		*/
+		template<class _Matrix, class _Field>
+		BlasMatrix (const _Matrix &A,  const _Field &F) :
+			DenseSubmatrix<Element>( *(new DenseMatrixBase<Element> (A.rowdim(),A.coldim())),0,0,A.rowdim(),A.coldim() ),
+			_stride(A.coldim()) ,
+			_alloc(true)
+		{
+			_ptr = this->_M->FullIterator() ;
+			typename _Matrix::template rebind<_Field>()(*this,A,F);
 
+		}
 
+#if 1
+		/*! Constructor from matrix (no copy).
+		 * @param A DenseMatrixBase
+		 */
+		BlasMatrix ( DenseMatrixBase<Element>& A ) :
+			DenseSubmatrix<Element>(A,0,0,A.rowdim(),A.coldim()),
+			_stride(A.coldim()) , _alloc(false)
+		{
+			_ptr = this->_M->FullIterator();
+		}
 
-		// Copy Constructor of a matrix (copying data)
-		BlasMatrix (const BlasMatrix<Element>& A) 
-			: DenseSubmatrix<Element>(*(new DenseMatrixBase<Element> (*A._M)),0,0,A.rowdim(),A.coldim()), _stride(A._stride), _alloc(true) 
+		/*! Constructor from matrix (no copy).
+		 * @param A DenseMatrixBase
+		 * @param i0
+		 * @param j0
+		 * @param m rows
+		 * @param n columns
+		 */
+		BlasMatrix ( DenseMatrixBase<Element>& A,
+			     const size_t i0, const size_t j0,
+			     const size_t m, const size_t n) :
+			DenseSubmatrix<Element>(A,i0,j0,m,n),
+			_stride(A.coldim()) , _alloc(false)
 		{
 			_ptr = this->_M->FullIterator();
 		}
-		
+#endif
 
-		// Copy Contructor of a matrix (no copy is done, just through pointer)
-		BlasMatrix(BlasMatrix<Element>& A) 
-			: DenseSubmatrix<Element>(A), _stride(A._stride), _alloc(false), _ptr(A._ptr) {}
 
+		/*! Copy Constructor of a matrix (copying data).
+		 * @param A matrix to be copied.
+		 */
+		BlasMatrix (const BlasMatrix<Element>& A) :
+			DenseSubmatrix<Element>(*(new DenseMatrixBase<Element> (*A._M)),0,0,A.rowdim(),A.coldim()),
+			_stride(A._stride), _alloc(true)
+		{
+			_ptr = this->_M->FullIterator();
+		}
 
-		// Copy Contructor of a submatrix (no copy is done, just through pointer)
-		BlasMatrix(BlasMatrix<Element>& A, const size_t i, const size_t j, const size_t m, const size_t n) 
-			: DenseSubmatrix<Element>(A,i,j,m,n), _stride(A._stride), _alloc(false), _ptr(A._ptr+ i*A._stride+j) {}
 
+#if 1
+		/// Copy Contructor of a matrix (no copy is done, just through pointer)
+		/*! @param A BlasMatrix to be copied
+		 */
+		BlasMatrix(BlasMatrix<Element>& A) :
+			DenseSubmatrix<Element>(A),
+			_stride(A._stride), _alloc(false), _ptr(A._ptr)
+		{}
+
+
+		/// Copy Contructor of a submatrix (no copy is done, just through pointer)
+		/*! @param A BlasMatrix to be copied
+		 * @param i0
+		 * @param j0
+		 * @param m rows
+		 * @param n columns
+		 */
+		BlasMatrix(BlasMatrix<Element>& A, const size_t i, const size_t j, const size_t m, const size_t n) :
+			DenseSubmatrix<Element>(A,i,j,m,n),
+			_stride(A._stride), _alloc(false),
+			_ptr(A._ptr+ i*A._stride+j)
+		{}
+#endif
 
-		
-		~BlasMatrix ()  {			
-			if (_alloc) {
+
+
+#if 0 /*  Create a blas matrix from a pointer of elements
+       *  (without allocating a vector in DenseMatrixBase...)
+       *  is it possible ? */
+		BlasMatrix(size_t m, size_t n, size_t stride,
+			   Element * A, size_t lda)
+		{
+
+		}
+#endif
+
+
+		/// Destructor.
+		~BlasMatrix ()
+		{
+			if (_alloc)
 				delete this->_M;
-			}
 		}
 
+		//! Rebind operator
+		template<typename _Tp1>
+		struct rebind {
+			typedef BlasMatrix<typename _Tp1::Element> other;
+
+			void operator() (other & Ap, const Self_t& A, const _Tp1& F)
+			{
+				typedef typename DenseSubmatrix<_Element>::ConstRawIndexedIterator ConstRawIndexedIterator ;
+				typedef typename DenseSubmatrix<_Element>::ConstRawIterator ConstRawIterator ;
+				ConstRawIterator         iter_value = A.rawBegin();
+				ConstRawIndexedIterator  iter_index = A.rawIndexedBegin();
+				typename _Tp1::Element tmp;
+				for (;iter_value != A.rawEnd(); ++iter_value,++iter_index){
+					F.init(  tmp, *iter_value );
+					Ap.setEntry(iter_index.rowIndex(), iter_index.colIndex(),tmp);
+				}
+#if 0
+				linbox_check( Ap.rowdim() == A.rowdim() );
+				linbox_check( Ap.coldim() == A.coldim() ) ;
+				for (size_t i = 0 ; i < A.rowdim() ; ++i)
+					for (size_t j = 0 ; j < A.coldim() ; ++j) {
+						F.init(Ap.refEntry(i,j),(Element)A.getEntry(i,j));
+					}
+#endif
+				return ;
+			}
+		};
+
+
+		//! operator = (copying data)
+		BlasMatrix<Element>& operator= (const BlasMatrix<Element>& A)
+		{
 
-		// operator = (copying data)
-		BlasMatrix<Element>& operator= (const BlasMatrix<Element>& A) {		       		
-				
 			DenseMatrixBase<Element> *tmp= this->_M;
 			this->_M       = new DenseMatrixBase<Element>(*A._M);
 			if (_alloc) {
-				delete tmp; 
+				delete tmp;
 			}
 			this->_beg_row = A._beg_row;
 			this->_end_row = A._end_row;
@@ -254,51 +440,112 @@ namespace LinBox {
 			this->_end_col = A._end_col;
 			_ptr     = this->_M->FullIterator();
 			_alloc   = true;
-			_stride  = A._stride;			
-			
+			_stride  = A._stride;
+
 			return *this;
 		}
-		
-		Element* getPointer() const  {return _ptr;}
 
-		Element* getWritePointer() {return _ptr;}
+		/*! @internal
+		 * Get read-only pointer to the matrix data.
+		 */
+		pointer getPointer() const
+		{
+			return _ptr;
+		}
 
-		size_t getStride() const {return _stride;}	
+		/*! @internal
+		 * Get write pointer to the matrix data.
+		 * Data may be changed this way.
+		 */
+		pointer& getWritePointer()
+		{
+			return _ptr;
+		}
 
-	}; // end of class BlasMatrix
+		/*! @internal
+		 * Get the stride of the matrix
+		 */
+		size_t getStride() const
+		{
+			return _stride;
+		}
 
+		/*! @internal
+		 * Get a reference to the stride of the matrix.
+		 * Modify stride this way.
+		 */
+		size_t& getWriteStride()
+		{
+			return _stride;
+		}
 
+		/*! @internal Is the matrix allocated ?
+		 */
+		bool isAllocated()
+		{
+			return _alloc ;
+		}
+
+	}; // end of class BlasMatrix
 
-	// TAG for triangular blas matrix
+
+	/*! TAG for triangular blas matrix.
+	* @see \ref FFLAS::FFLAS_DIAG and \ref FFLAS::FFLAS_UPLO enums in \c fflas/fflas.h.
+	*/
 	class BlasTag {
 	public:
-		typedef enum{low,up} uplo;
-		typedef enum{unit,nonunit} diag;
+		typedef enum{low,up}       uplo; //!< upper or lower triangular
+		typedef enum{unit,nonunit} diag; //!< unit or non unit diagonal
 	};
 
 
-	// class of triangular blas matrix
+	//! Triangular BLAS matrix.
 	template <class Element>
 	class TriangularBlasMatrix: public BlasMatrix<Element> {
 
 	protected:
-		
-		BlasTag::uplo           _uplo;
-		BlasTag::diag           _diag;
-
-	public:
 
-		TriangularBlasMatrix (const size_t m, const size_t n, BlasTag::uplo x=BlasTag::up, BlasTag::diag y= BlasTag::nonunit)
-			: BlasMatrix<Element>(m, n ) , _uplo(x), _diag(y) {}
+		BlasTag::uplo           _uplo; //!< upper or lower triangular
+		BlasTag::diag           _diag; //!< unit or non unit diagonal
 
-		TriangularBlasMatrix (const BlasMatrix<Element>& A, BlasTag::uplo x=BlasTag::up, BlasTag::diag y= BlasTag::nonunit)
-			: BlasMatrix<Element>(A) , _uplo(x), _diag(y) {}
+	public:
 
-		TriangularBlasMatrix (BlasMatrix<Element>& A, BlasTag::uplo x=BlasTag::up, BlasTag::diag y= BlasTag::nonunit)
-			: BlasMatrix<Element>(A), _uplo(x), _diag(y) {}
-		
-		TriangularBlasMatrix (const TriangularBlasMatrix<Element>& A)
-			: BlasMatrix<Element>(A.rowdim(),A.coldim()), _uplo(A._uplo), _diag(A._diag) {
+		/*! Constructor for a new \c TriangularBlasMatrix.
+		 * @param m rows
+		 * @param n cols
+		 * @param y (non)unit diagonal
+		 * @param x (upp/low)er matrix
+		 */
+		TriangularBlasMatrix (const size_t m, const size_t n,
+				      BlasTag::uplo x=BlasTag::up, BlasTag::diag y= BlasTag::nonunit) :
+			BlasMatrix<Element>(m, n ) , _uplo(x), _diag(y)
+		{}
+
+		/*! Constructor from a \c BlasMatrix (copy).
+		 * @param A matrix
+		 * @param y (non)unit diagonal
+		 * @param x (upp/low)er matrix
+		 */
+		TriangularBlasMatrix (const BlasMatrix<Element>& A,
+				      BlasTag::uplo x=BlasTag::up, BlasTag::diag y= BlasTag::nonunit) :
+			BlasMatrix<Element>(A) , _uplo(x), _diag(y)
+		{}
+
+		/*! Constructor from a \c BlasMatrix (no copy).
+		 * @param A matrix
+		 * @param y (non)unit diagonal
+		 * @param x (upp/low)er matrix
+		 */
+		TriangularBlasMatrix (BlasMatrix<Element>& A, BlasTag::uplo x=BlasTag::up, BlasTag::diag y= BlasTag::nonunit) :
+			BlasMatrix<Element>(A), _uplo(x), _diag(y)
+		{}
+
+		/*! Constructor from a \c TriangularBlasMatrix (copy).
+		 * @param A matrix
+		 */
+		TriangularBlasMatrix (const TriangularBlasMatrix<Element>& A) :
+			BlasMatrix<Element>(A.rowdim(),A.coldim()), _uplo(A._uplo), _diag(A._diag)
+		{
 			switch (A._uplo) {
 			case BlasTag::up:
 				{
@@ -309,39 +556,79 @@ namespace LinBox {
 				}
 			case BlasTag::low:
 				{
-					for (size_t i=0;i<A.rowdim();++i)
+					for (size_t i=0;i<A.rowdim();++i) {
 						for (size_t j=0;j<=i;++j)
 							this->setEntry(i,j,A.getEntry(i,j));
+					}
+
+					break;
+				}
+			default:
+				throw LinboxError ("Error in copy constructor of TriangularBlasMatrix (incorrect argument)");
+			}
+		}
+
+		/*! Generic constructor from a \c Matrix (no copy).
+		 * @param A matrix
+		 * @param y (non)unit diagonal
+		 * @param x (upp/low)er matrix
+		 */
+		template<class Matrix>
+		TriangularBlasMatrix (const Matrix& A, BlasTag::uplo x=BlasTag::up, BlasTag::diag y= BlasTag::nonunit) :
+			BlasMatrix<Element>(A.rowdim(),A.coldim()), _uplo(x), _diag(y)
+		{
+			switch (x) {
+			case BlasTag::up:
+				{
+					for (size_t i=0;i<A.rowdim();++i){
+						for (size_t j=i;j<A.coldim();++j) {
+							Element tmp;
+							this->setEntry(i,j,getEntry(tmp, A,i,j));
+						}
+					}
+					break;
+				}
+			case BlasTag::low:
+				{
+					for (size_t i=0;i<A.rowdim();++i) {
+						for (size_t j=0;j<=i;++j) {
+							Element tmp;
+							this->setEntry(i,j,getEntry(tmp, A,i,j));
+						}
+					}
+
 					break;
 				}
 			default:
 				throw LinboxError ("Error in copy constructor of TriangularBlasMatrix (incorrect argument)");
 			}
-		}		
+		}
 
+		/// get the shape of the matrix (upper or lower)
 		BlasTag::uplo getUpLo() const { return _uplo;}
 
-		BlasTag::diag getDiag() const { return _diag;}	
+		/// Is the diagonal implicitly unit ?
+		BlasTag::diag getDiag() const { return _diag;}
 
 	}; // end of class TriangularBlasMatrix
 
 	template <class Element>
-	struct MatrixTraits< BlasMatrix<Element> >
-	{ 
+	struct MatrixTraits< BlasMatrix<Element> > {
 		typedef BlasMatrix<Element> MatrixType;
-		typedef typename MatrixCategories::RowColMatrixTag MatrixCategory; 
+		typedef typename MatrixCategories::RowColMatrixTag MatrixCategory;
 	};
 
 	template <class Element>
-	struct MatrixTraits< const BlasMatrix<Element> >
-	{ 
+	struct MatrixTraits< const BlasMatrix<Element> > {
 		typedef const BlasMatrix<Element> MatrixType;
-		typedef typename MatrixCategories::RowColMatrixTag MatrixCategory; 
+		typedef typename MatrixCategories::RowColMatrixTag MatrixCategory;
 	};
 
 
-	/** Class used for permuting indices. For example, create a vector (0 1 2 ...) over size_t,
-	 *  then apply a permutation to it using a BlasMatrixDomain to get the natural representation of the permutation.
+	/** Class used for permuting indices.
+	 * For example, create a vector <code>(0 1 2 ...)</code> over \c
+	 * size_t, then apply a permutation to it using a \c BlasMatrixDomain to
+	 * get the natural representation of the permutation.
 	 */
 	class indexDomain {
 	public:
@@ -358,37 +645,75 @@ namespace LinBox {
 		}
 	};
 
-
-// Dan Roche 7-8-04 Changed _P to _PP to avoid confict with a macro defined in
-// <iostream> somewhere.
+#if 0 /*  original BlasPermutation */
+	// Dan Roche 7-8-04 Changed _P to _PP to avoid confict with a macro defined in
+	// <iostream> somewhere.
+	/*! BlasPermutation.
+	 * Lapack ipiv style compressed permutation.
+	 * @todo to be deprecated
+	 */
 	class BlasPermutation {
-		
-		
+
+
 	public:
-		
+
+		/// null constructor
 		BlasPermutation() {};
 
-		BlasPermutation( const size_t n ): _PP(n), _order( n ) {};
+		BlasPermutation( const size_t n ) :
+			_PP(n), _order( n ), _size( -1 )
+		{};
+
+		BlasPermutation( const std::vector<size_t> P ) :
+			_PP( P ), _order( P.size() ) , _size( -1 )
+		{};
 
-		BlasPermutation( const std::vector<size_t> P ) : _PP( P ), _order( P.size() ) {};
+		BlasPermutation( const std::vector<size_t> P, size_t order ) :
+			_PP( P ), _order( order ) , _size( -1 )
+		{};
 
-		BlasPermutation( const BlasPermutation& P): _PP( P._PP ), _order( P._order ) {};
+		BlasPermutation( const std::vector<size_t> P,
+				 size_t order, size_t size ) :
+			_PP( P ), _order( order ) , _size( size )
+		{};
 
-		BlasPermutation& operator=( const BlasPermutation& P ){
-			_PP = P._PP;
+		BlasPermutation( const BlasPermutation& P) :
+			_PP( P._PP ), _order( P._order ) , _size( size )
+		{};
+
+		BlasPermutation& operator=( const BlasPermutation& P )
+		{
+			_PP    = P._PP;
 			_order = P._order;
+			_size  = P._size ;
 			return *this;
 		}
-		
-		
-		const size_t* getPointer() const  { return &_PP[0]; }
-		
-		size_t* getWritePointer()  { return &_PP[0]; }
-	
-		const size_t  getOrder()  const { return _order; }
 
-		BlasPermutation& extendTrivially(const size_t newSize) {
-			if (newSize < _order) 
+		const size_t* getPointer() const
+		{
+			return &_PP[0];
+		}
+
+		size_t* getWritePointer()
+		{
+			return &_PP[0];
+		}
+
+		size_t  getOrder()  const
+		{
+			return _order;
+		}
+
+		size_t  getSize()  const
+		{
+			if (_size == -1)
+				_size = (*(std::max_element(_PP.begin(),_PP.end())))+1 ;
+			return _size;
+		}
+
+		BlasPermutation& extendTrivially(const size_t newSize)
+		{
+			if (newSize < _order)
 				std::cerr << "WARNING: attempting to reduce size of permutation.";
 			_PP.resize(newSize);
 			for (size_t i=_order; i<newSize; i++)
@@ -396,38 +721,99 @@ namespace LinBox {
 			_order = newSize;
 			return *this;
 		};
-	
+
 	protected:
-		
-		std::vector<size_t>  _PP;
-		size_t               _order;
+
+		std::vector<size_t>  _PP ;    //!< Lapack representation of the permutation
+		size_t               _order;  //!< size of the representation (number of permutations)
+		mutable size_t       _size ;  //!< size of the permutation (computed if necessary)
+
+	private :
+
+		/// compresses PackedPermutation to a smaller \c r_.
+		void Compress_()
+		{
+			if (_order==0) {
+				_PP.resize(0) ;
+				// Id_ = true ;
+				return ;
+			}
+			linbox_check(_order);
+			size_t rr = _order-1 ;
+			while ( rr && (_PP[rr] == 0  )) --rr ;    // removing trailing zeros
+			while ( rr && (_PP[rr] == rr )) --rr ;    // useless information
+			if ((rr == 0) && (_PP[0] == 0)) {
+				_order = 0 ;
+				_size = 0  ;
+				Id_ = true ;
+				_PP.resize(0) ;
+				return ;
+			}
+			_order = rr+1 ;
+			_PP.resize(_order,0);   // done cleaning.
+			// recomputing n_ if lost.
+			if (_size !=  -1) {
+				_size = getSize();
+			}
+			cleaned_ = true ;
+			return ;
+		}
+
 
 	}; // end of class BlasPermutation
+#endif
 
+	/*! TransposedBlasMatrix.
+	 * NO DOC
+	 */
 	template< class Matrix >
 	class TransposedBlasMatrix {
 
 	public:
-		
-		TransposedBlasMatrix ( Matrix& M ) :  _M(M) {}
-		
+
+		/*! NO DOC
+		 * @param M
+		 */
+		TransposedBlasMatrix ( Matrix& M ) :
+			_M(M)
+		{}
+
+		/*! NO DOC
+		 */
 		Matrix& getMatrix() const { return _M; }
-	
+
 	protected:
-		Matrix& _M;
+		Matrix& _M; //!< NO DOC
 	};
-	
-	template<>
+
+	/*! TransposedBlasMatrix.
+	 * NO DOC
+	 */
+#if !defined(__INTEL_COMPILER) && !defined(__CUDACC__)
+	template <>
+#endif
 	template< class Matrix >
 	class TransposedBlasMatrix< TransposedBlasMatrix< Matrix > > : public Matrix {
-		
+
 	public:
-		TransposedBlasMatrix ( Matrix& M ) :  Matrix(M){}	
-		TransposedBlasMatrix ( const Matrix& M ) :  Matrix(M){}	
-		
+		/*! TransposedBlasMatrix.
+		 * NO DOC
+		 */
+		TransposedBlasMatrix ( Matrix& M ) :
+			Matrix(M)
+		{}
+
+		/*! TransposedBlasMatrix.
+		 * NO DOC
+		 */
+		TransposedBlasMatrix ( const Matrix& M ) :
+			Matrix(M)
+		{}
+
 	};
-	
+
 
 } // end of namespace LinBox
 
-#endif
+#endif // __LINBOX_blas_matrix_H
+
diff --git a/linbox/matrix/dense-rows-matrix.h b/linbox/matrix/dense-rows-matrix.h
index 62a434f..bed2dc6 100644
--- a/linbox/matrix/dense-rows-matrix.h
+++ b/linbox/matrix/dense-rows-matrix.h
@@ -1,17 +1,17 @@
 /* -*- 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
 /* linbox/matrix/dense-rows-matrix.h
  * Copyright (C) 2003 Bradford Hovinen
  *
  * Written by Bradford Hovinen <bghovinen at math.uwaterloo.ca>
- * 
+ *
  * --------------------------------------------------------
  *
  * See COPYING for license information.
  */
 
-#ifndef __DENSE_ROWS_MATRIX_H
-#define __DENSE_ROWS_MATRIX_H
+#ifndef __LINBOX_dense_rows_matrix_H
+#define __LINBOX_dense_rows_matrix_H
 
 #include <vector>
 #include <utility>
@@ -26,201 +26,214 @@
 namespace LinBox
 {
 
-/** Dense row-wise matrix container
- *
- * This class implements a dense matrix, storing the data as a vector of vectors
- * of the given type, in the same manner as @ref{SparseMatrixBase}. It provides
- * only row iterators.
- *
- * @param Vector Row vector type
- */
-template <class _Row>
-class DenseRowsMatrix
-{
-    public:
-
-	typedef _Row Row;
-	typedef typename Row::value_type Element;
-	typedef typename std::vector<Row> Rep;
-
-	/** Constructor.
-	 * Note: the copy constructor and operator= will work as intended
-	 *       because of STL's container design
-	 * @param  m  row dimension
-	 * @param  n  column dimension
-	 */
-	DenseRowsMatrix (size_t m, size_t n);
-
-	/** Copy constructor.
-	 */
-	DenseRowsMatrix (const DenseRowsMatrix &A)
-		: _A (A._A), _m (A._m), _n (A._n) 
-	{}
-
-	/** Destructor. */
-	~DenseRowsMatrix () {}
-
-	/** Retreive row dimension of the matrix.
-	 * @return integer number of rows of DenseRowsMatrix matrix.
-	 */
-	size_t rowdim () const { return _m; }
-
-	/** Retreive column dimension of matrix.
-	 * @return integer number of columns of DenseRowsMatrix matrix.
-	 */
-	size_t coldim () const { return _n; }
-
-	/** @name Input and output
-	 */
-	//@{
-
-	/** Read a matrix from the given input stream using field read/write
-	 * @param is Input stream from which to read the matrix
-	 * @param F Field with which to read
-	 * @param format Format of input matrix
-	 */
-	template <class Field>
-	std::istream &read (std::istream &is, const Field &F);
-
-	/** Read a matrix from the given input stream using standard operators
-	 * @param is Input stream from which to read the matrix
-	 * @param format Format of input matrix
-	 */
-	std::istream &read (std::istream &is);
-
-	/** Write a matrix to the given output stream using field read/write
-	 * @param os Output stream to which to write the matrix
-	 * @param F Field with which to write
-	 * @param format Format with which to write
-	 */
-	template <class Field>
-	std::ostream &write (std::ostream &os, const Field &F) const;
-
-	/** Write a matrix to the given output stream using standard operators
-	 * @param os Output stream to which to write the matrix
-	 * @param format Format with which to write
-	 */
-	std::ostream &write (std::ostream &os) const;
-
-	//@}
-
-	/** @name Access to matrix elements
-	 */
-	//@{
-
-	/** Set an individual entry
-	 * Setting the entry to 0 will remove it from the matrix
-	 * @param i Row index of entry
-	 * @param j Column index of entry
-	 * @value Value of the new entry
-	 */
-	void setEntry (size_t i, size_t j, const Element &value)
+	/** @brief Dense row-wise matrix container
+	 *
+	 * This class implements a dense matrix, storing the data as a vector of vectors
+	 * of the given type, in the same manner as @ref SparseMatrixBase. It provides
+	 * only row iterators.
+	 *
+	 * @param Vector Row vector type
+	 */
+	template <class _Row>
+	class DenseRowsMatrix {
+	public:
+
+		typedef _Row Row;
+		typedef typename Row::value_type Element;
+		typedef typename std::vector<Row> Rep;
+
+		/** Constructor.
+		 * Note: the copy constructor and operator= will work as intended
+		 *       because of STL's container design
+		 * @param  m  row dimension
+		 * @param  n  column dimension
+		 */
+		DenseRowsMatrix (size_t m, size_t n);
+
+		/** Copy constructor.
+		*/
+		DenseRowsMatrix (const DenseRowsMatrix &A) :
+		       	_A (A._A), _m (A._m), _n (A._n)
+		{}
+
+		/** Destructor. */
+		~DenseRowsMatrix () {}
+
+		/** Retreive row dimension of the matrix.
+		 * @return integer number of rows of DenseRowsMatrix matrix.
+		 */
+		size_t rowdim () const { return _m; }
+
+		/** Retreive column dimension of matrix.
+		 * @return integer number of columns of DenseRowsMatrix matrix.
+		 */
+		size_t coldim () const { return _n; }
+
+		/** @name Input and output
+		*/
+		//@{
+
+		/** Read a matrix from the given input stream using field read/write
+		 * @param is Input stream from which to read the matrix
+		 * @param F Field with which to read
+		 */
+		template <class Field>
+		std::istream &read (std::istream &is, const Field &F);
+
+		/** Read a matrix from the given input stream using standard operators
+		 * @param is Input stream from which to read the matrix
+		 */
+		std::istream &read (std::istream &is);
+
+		/** Write a matrix to the given output stream using field read/write
+		 * @param os Output stream to which to write the matrix
+		 * @param F Field with which to write
+		 */
+		template <class Field>
+		std::ostream &write (std::ostream &os, const Field &F) const;
+
+		/** Write a matrix to the given output stream using standard operators
+		 * @param os Output stream to which to write the matrix
+		 */
+		std::ostream &write (std::ostream &os) const;
+
+		//@}
+
+		/** @name Access to matrix elements
+		*/
+		//@{
+
+		/** Set an individual entry
+		 * Setting the entry to 0 will remove it from the matrix
+		 * @param i Row index of entry
+		 * @param j Column index of entry
+		 * @param value Value of the new entry
+		 */
+		void setEntry (size_t i, size_t j, const Element &value)
 		{ _A[i][j] = value; }
 
-	/** Get a writeable reference to an entry in the matrix
-	 * If there is no entry at the position (i, j), then a new entry
-	 * with a value of zero is inserted and a reference  to it is
-	 * returned.
-	 * @param i Row index of entry
-	 * @param j Column index of entry
-	 * @return Reference to matrix entry
-	 */
-	Element &refEntry (size_t i, size_t j)
+		/** Get a writeable reference to an entry in the matrix
+		 * If there is no entry at the position (i, j), then a new entry
+		 * with a value of zero is inserted and a reference  to it is
+		 * returned.
+		 * @param i Row index of entry
+		 * @param j Column index of entry
+		 * @return Reference to matrix entry
+		 */
+		Element &refEntry (size_t i, size_t j)
 		{ return _A[i][j]; }
 
-	/** Get a read-only individual entry from the matrix
-	 * @param i Row index
-	 * @param j Column index
-	 * @return Const reference to matrix entry
-	 */
-	const Element &getEntry (size_t i, size_t j) const
+		/** Get a read-only individual entry from the matrix
+		 * @param i Row index
+		 * @param j Column index
+		 * @return Const reference to matrix entry
+		 */
+		const Element &getEntry (size_t i, size_t j) const
 		{ return _A[i][j]; }
 
-	/** Get an entry and store it in the given value
-	 * This form is more in the Linbox style and is provided for interface
-	 * compatibility with other parts of the library
-	 * @param x Element in which to store result
-	 * @param i Row index
-	 * @param j Column index
-	 * @return Reference to x
-	 */
-	Element &getEntry (Element &x, size_t i, size_t j) const
+		/** Get an entry and store it in the given value
+		 * This form is more in the Linbox style and is provided for interface
+		 * compatibility with other parts of the library
+		 * @param x Element in which to store result
+		 * @param i Row index
+		 * @param j Column index
+		 * @return Reference to x
+		 */
+		Element &getEntry (Element &x, size_t i, size_t j) const
 		{ return x = _A[i][j]; }
 
-	/** @name Columns of rows iterator
-	 * The columns of row iterator gives each of the rows of the
-	 * matrix in ascending order. Dereferencing the iterator yields
-	 * a row vector in sparse sequence format
-	 */
-
-	typedef typename Rep::iterator RowIterator;
-	typedef typename Rep::const_iterator ConstRowIterator;
-
-	RowIterator rowBegin () { return _A.begin (); }
-	RowIterator rowEnd () { return _A.end (); }
-	ConstRowIterator rowBegin () const { return _A.begin (); }
-	ConstRowIterator rowEnd () const { return _A.end (); }
-
-	/** @name Raw iterator
-	 * The raw iterator is a method for accessing all nonzero
-	 * entries in the matrix in some unspecified order. This can be
-	 * used, e.g. to reduce all matrix entries modulo a prime before
-	 * passing the matrix into an algorithm.
-	 */
-
-	class RawIterator;
-	class ConstRawIterator;
-
-	RawIterator rawBegin ();
-	RawIterator rawEnd ();
-	ConstRawIterator rawBegin () const;
-	ConstRawIterator rawEnd () const;
-
-	/** @name Index iterator
-	 * The index iterator gives the row, column indices of all matrix
-	 * elements in the same order as the raw iterator above. Its value type
-	 * is an STL pair with the row and column indices, starting at 0, in the
-	 * first and second positions, respectively.
-	 */
-
-	class RawIndexedIterator;
-	class ConstRawIndexedIterator;
-
-	RawIndexedIterator rawIndexedBegin ();
-	RawIndexedIterator rawIndexedEnd ();
-	ConstRawIndexedIterator rawIndexedBegin () const;
-	ConstRawIndexedIterator rawIndexedEnd () const;
-
-	/** Retrieve a row as a writeable reference
-	 * @param i Row index
-	 */
-	Row &getRow (size_t i)
+		/** @name Columns of rows iterator
+		 * The columns of row iterator gives each of the rows of the
+		 * matrix in ascending order. Dereferencing the iterator yields
+		 * a row vector in sparse sequence format
+		 */
+
+		typedef typename Rep::iterator RowIterator;
+		typedef typename Rep::const_iterator ConstRowIterator;
+
+		///
+		RowIterator rowBegin () { return _A.begin (); }
+		///
+		RowIterator rowEnd () { return _A.end (); }
+		///
+		ConstRowIterator rowBegin () const { return _A.begin (); }
+		///
+		ConstRowIterator rowEnd () const { return _A.end (); }
+
+		/** @name Raw iterator
+		 * The raw iterator is a method for accessing all nonzero
+		 * entries in the matrix in some unspecified order. This can be
+		 * used, e.g. to reduce all matrix entries modulo a prime before
+		 * passing the matrix into an algorithm.
+		 */
+
+		///
+		class RawIterator;
+		///
+		class ConstRawIterator;
+
+		/// rawBegin
+		RawIterator rawBegin ();
+		/// rawEnd
+		RawIterator rawEnd ();
+		/// const rawBegin
+		ConstRawIterator rawBegin () const;
+		/// const rawEnd
+		ConstRawIterator rawEnd () const;
+
+		/** @name Index iterator
+		 * The index iterator gives the row, column indices of all matrix
+		 * elements in the same order as the raw iterator above. Its value type
+		 * is an STL pair with the row and column indices, starting at 0, in the
+		 * first and second positions, respectively.
+		 */
+
+		/// RawIndexedIterator
+		class RawIndexedIterator;
+		/// ConstRawIndexedIterator
+		class ConstRawIndexedIterator;
+
+		/// rawIndexedBegin
+		RawIndexedIterator rawIndexedBegin ();
+		/// rawIndexedEnd
+		RawIndexedIterator rawIndexedEnd ();
+		/// const rawIndexedBegin
+		ConstRawIndexedIterator rawIndexedBegin () const;
+		/// const rawIndexedEnd
+		ConstRawIndexedIterator rawIndexedEnd () const;
+
+		/** Retrieve a row as a writeable reference
+		 * @param i Row index
+		 */
+		Row &getRow (size_t i)
 		{ return _A[i]; }
 
-	/** Construct the transpose of this matrix and place it in the
-	 * DenseRowsMatrix given
-	 */
-	DenseRowsMatrix &transpose (DenseRowsMatrix &AT) const;
+		/** Construct the transpose of this matrix and place it in the
+		 * DenseRowsMatrix given.
+		 * @param AT
+		 */
+		DenseRowsMatrix &transpose (DenseRowsMatrix &AT) const;
 
-	//@}
+		//@}
 
-    protected:
+	protected:
 
-	friend class SparseMatrixWriteHelper<Element, Row>;
-	friend class SparseMatrixReadWriteHelper<Element, Row>;
+		friend class SparseMatrixWriteHelper<Element, Row>;
+		friend class SparseMatrixReadWriteHelper<Element, Row>;
 
-	Rep               _A;
-	size_t            _m;
-	size_t            _n;
-};
+		Rep               _A;
+		size_t            _m;
+		size_t            _n;
+	};
 
-template <class Row>
-struct MatrixTraits< DenseRowsMatrix<Row> >
-{ 
-	typedef DenseRowsMatrix<Row> MatrixType;
-	typedef typename MatrixCategories::RowMatrixTag<MatrixTraits<MatrixType> > MatrixCategory; 
-};
+	template <class Row>
+	struct MatrixTraits< DenseRowsMatrix<Row> >
+	{
+		typedef DenseRowsMatrix<Row> MatrixType;
+		typedef typename MatrixCategories::RowMatrixTag<MatrixTraits<MatrixType> > MatrixCategory;
+	};
 
 } // namespace LinBox
 
-#endif // __DENSE_ROWS_MATRIX_H
+#endif // __LINBOX_dense_rows_matrix_H
+
diff --git a/linbox/matrix/dense-submatrix.h b/linbox/matrix/dense-submatrix.h
index c864709..c15ea71 100644
--- a/linbox/matrix/dense-submatrix.h
+++ b/linbox/matrix/dense-submatrix.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/matrix/dense-submatrix.h
  * Copyright (C) 2001 B. David Saunders,
  *               2001-2002 Bradford Hovinen,
@@ -21,7 +21,7 @@
  * Have the constructor take a reference rather than a pointer
  * -----------------------------------------------------------
  * 2002-10-27  Bradford Hovinen  <bghovinen at math.uwaterloo.ca>
- * 
+ *
  * Rename from densesubmatrix.h
  *
  * Constructor modifications: changed the interface to match Submatrix
@@ -33,8 +33,15 @@
  * See COPYING for license information
  */
 
-#ifndef __DENSE_SUBMATRIX_H
-#define __DENSE_SUBMATRIX_H
+/*! @file matrix/dense-submatrix.h
+ * @ingroup matrix
+ * @brief Representation of a submatrix of a dense matrix, not resizeable.
+ * This matrix type conforms to the \c LinBox::DenseMatrixBase interface.
+ * \c LinBox::BlasMatrix is an example of DenseSubmatrix.
+ */
+
+#ifndef __LINBOX_dense_submatrix_H
+#define __LINBOX_dense_submatrix_H
 
 #include "linbox/linbox-config.h"
 
@@ -45,249 +52,304 @@
 namespace LinBox
 {
 
-/** Submatrix of a dense matrix
- *
- * This matrix type conforms to the same interface as @ref{DenseMatrixBase},
- * except that you cannot resize it. It represents a submatrix of a dense
- * matrix. Upon construction, one can freely manipulate the entries in the
- * DenseSubmatrix, and the corresponding entries in the underlying
- * DenseMatrixBase will be modified.
-
-\ingroup matrix
- */
-template<class _Element>
-class DenseSubmatrix
-{
-    public:
- 
-	class RawIterator;
-	class ConstRawIterator;
-
-	typedef _Element Element;
-        typedef DenseSubmatrix<_Element> Self_t;
-    
-
-	/** \brief 
-	 *
-	 * The row iterator gives the rows of the
-	 * matrix in ascending order. Dereferencing the iterator yields
-	 * a row vector in dense format
-	 */
-	typedef typename DenseMatrixBase<Element>::RowIterator            RowIterator;
-	typedef typename DenseMatrixBase<Element>::ConstRowIterator       ConstRowIterator;
-	typedef typename DenseMatrixBase<Element>::Row                    Row;
-	typedef typename DenseMatrixBase<Element>::ConstRow               ConstRow;
-
-	/** \brief
+	/** @brief %Submatrix of a dense matrix
 	 *
-	 * The columns iterator gives the columns of the
-	 * matrix in ascending order. Dereferencing the iterator yields
-	 * a column vector in dense format
-	 */
-	typedef typename DenseMatrixBase<Element>::ColIterator            ColIterator;
-	typedef typename DenseMatrixBase<Element>::ConstColIterator       ConstColIterator;
-	typedef typename DenseMatrixBase<Element>::Col                    Col;
-	typedef typename DenseMatrixBase<Element>::Column                 Column;
-	typedef typename DenseMatrixBase<Element>::ConstCol               ConstCol;
-
-	/** \brief
-	 */
-	DenseSubmatrix () :_M(NULL) {}
-
-	/** Constructor from an existing @ref{DenseMatrixBase} and dimensions
-	 * \param M Pointer to @ref{DenseMatrixBase} of which to construct submatrix
-	 * \param row Starting row
-	 * \param col Starting column
-	 * \param rowdim Row dimension
-	 * \param coldim Column dimension
-	 */
-	DenseSubmatrix (DenseMatrixBase<Element> &M,
-			size_t row,
-			size_t col,
-			size_t rowdim,
-			size_t coldim);
-
-	/** Constructor from an existing @ref{DenseMatrixBase} 
-	 * \param M Pointer to @ref{DenseMatrixBase} of which to construct submatrix
-	 */
-	DenseSubmatrix (DenseMatrixBase<Element> &M);
-
-
-	/** Constructor from an existing submatrix and dimensions
-	 * @param SM Constant reference to DenseSubmatrix from which to
-	 *           construct submatrix
-	 * @param row Starting row
-	 * @param col Starting column
-	 * @param rowdim Row dimension
-	 * @param coldim Column dimension
-	 */
-	DenseSubmatrix (const DenseSubmatrix<Element> &SM,
-			size_t row,
-			size_t col,
-			size_t rowdim,
-			size_t coldim);
-
-	/** Copy constructor
-	 * @param _M Submatrix to copy
-	 */
-	DenseSubmatrix (const DenseSubmatrix<Element> &SM);
-
-	/** Assignment operator
-	 * Assign the given submatrix to this one
-	 * @param _M Submatrix to assign
-	 * @return Reference to this submatrix
-	 */
-	DenseSubmatrix &operator = (const DenseSubmatrix<Element> &SM);
+	 * This matrix type conforms to the same interface as @ref DenseMatrixBase,
+	 * except that you cannot resize it. It represents a submatrix of a dense
+	 * matrix. Upon construction, one can freely manipulate the entries in the
+	 * DenseSubmatrix, and the corresponding entries in the underlying
+	 * DenseMatrixBase will be modified.
 
-	/** Get the number of rows in the matrix
-	 * @return Number of rows in matrix
+	 \ingroup matrix
 	 */
-	size_t rowdim () const
-		{ return _end_row - _beg_row; }
-
-	/** Get the number of columns in the matrix
-	 * @return Number of columns in matrix
-	 */
-	size_t coldim () const
-		{ return _end_col - _beg_col; }
-
-
-	template<typename _Tp1>
-        struct rebind
-        { 
-            typedef DenseSubmatrix<typename _Tp1::Element> other; 
-
-            void operator() (other *& Ap, const Self_t& A, const _Tp1& F) {
-                Ap = new other(A.rowdim(), A.coldim());
-                typename Self_t::ConstRawIterator         iter_value = A.rawBegin();
-                typename Self_t::ConstRawIndexedIterator  iter_index = A.rawIndexBegin();
-                typename _Tp1::Element tmp;
-                for (;iter_value != A.rawEnd(); ++iter_value,++iter_index){
-                    F.init(  tmp, *iter_value ); 
-                    Ap->setEntry(iter_index.rowIndex(), iter_index.colIndex(),tmp);
-                }
-            }
-        };
-
-
-
-
-	/** Read the matrix from an input stream
-	 * @param file Input stream from which to read
-	 * @param field 
-	 */
-	template<class Field>
-	std::istream& read (std::istream &file, const Field& field);
-    
-	/** Write the matrix to an output stream
-	 * @param os Output stream to which to write
-	 * @param field
-	 */
-	template<class Field>
-	std::ostream& write (std::ostream &os, const Field& field, bool mapleFormat = false) const;
-	
-	/** Set the entry at (i, j)
-	 * @param i Row number, 0...rowdim () - 1
-	 * @param j Column number 0...coldim () - 1
-	 * @param a_ij Element to set
-	 */
-	void setEntry (size_t i, size_t j, const Element &a_ij)
-		{ _M->setEntry (_beg_row + i, _beg_col + j, a_ij); }
-
-	/** Get a writeable reference to an entry in the matrix
-	 * @param i Row index of entry
-	 * @param j Column index of entry
-	 * @return Reference to matrix entry
-	 */
-	Element &refEntry (size_t i, size_t j)
-		{ return _M->refEntry (i + _beg_row, j + _beg_col); } 
-
-	/** Get a read-only individual entry from the matrix
-	 * @param i Row index
-	 * @param j Column index
-	 * @return Const reference to matrix entry
-	 */
-	const Element &getEntry (size_t i, size_t j) const
-		{ return _M->getEntry (i + _beg_row, j + _beg_col); } 
-
-	/** Get an entry and store it in the given value
-	 * This form is more in the Linbox style and is provided for interface
-	 * compatibility with other parts of the library
-	 * @param x Element in which to store result
-	 * @param i Row index
-	 * @param j Column index
-	 * @return Reference to x
-	 */
-	Element &getEntry (Element &x, size_t i, size_t j)
-		{ return _M->getEntry (x, i + _beg_row, j + _beg_col); } 
-
-	RowIterator rowBegin ();
-	RowIterator rowEnd ();
-	ConstRowIterator rowBegin () const;
-	ConstRowIterator rowEnd () const;
- 
-	ColIterator colBegin ();
-	ColIterator colEnd ();
-	ConstColIterator colBegin () const;
-	ConstColIterator colEnd () const;
-
-	/** \brief
-	 *
-	 * The raw iterator is a method for accessing all entries in the matrix
-	 * in some unspecified order. This can be used, e.g. to reduce all
-	 * matrix entries modulo a prime before passing the matrix into an
-	 * algorithm.
+	template<class _Element>
+	class DenseSubmatrix {
+	public:
+
+		/*  Iterators */
+
+		//! @name Forward declaration of Raw Iterators.
+		//@{
+		// RawIterator.
+		class RawIterator  ;
+		// Const RawIterator.
+		class ConstRawIterator ;
+
+		 // RawIndexed
+		class RawIndexedIterator ;
+		// Const RawIndexed
+		class ConstRawIndexedIterator ;
+		//@}
+
+		typedef _Element                  Element;       //!< Element type
+		typedef DenseSubmatrix<_Element>   Self_t;       //!< Self type
+
+
+		/** @name typedef'd Row Iterators.
+		 *\brief
+		 * The row iterator gives the rows of the
+		 * matrix in ascending order. Dereferencing the iterator yields
+		 * a row vector in dense format
+		 * @{
+		 */
+		typedef typename DenseMatrixBase<Element>::RowIterator            RowIterator;
+		typedef typename DenseMatrixBase<Element>::ConstRowIterator       ConstRowIterator;
+		typedef typename DenseMatrixBase<Element>::Row                    Row;
+		typedef typename DenseMatrixBase<Element>::ConstRow               ConstRow;
+		 //@} Row Iterators
+
+		/** @name typedef'd Column Iterators.
+		 *\brief
+		 * The columns iterator gives the columns of the
+		 * matrix in ascending order. Dereferencing the iterator yields
+		 * a column vector in dense format
+		 * @{
+		 */
+		typedef typename DenseMatrixBase<Element>::ColIterator            ColIterator;
+		typedef typename DenseMatrixBase<Element>::ConstColIterator       ConstColIterator;
+		typedef typename DenseMatrixBase<Element>::Col                    Col;
+		typedef typename DenseMatrixBase<Element>::Column                 Column;
+		typedef typename DenseMatrixBase<Element>::ConstCol               ConstCol;
+		//@} // Column Iterators
+
+
+		/*  constructors */
+
+		/** NULL constructor.  */
+		DenseSubmatrix () :
+			_M(NULL)
+	       	{}
+
+		/** Constructor from an existing @ref DenseMatrixBase  and dimensions.
+		 * \param M Pointer to @ref DenseMatrixBase of which to construct submatrix
+		 * \param row Starting row
+		 * \param col Starting column
+		 * \param rowdim Row dimension
+		 * \param coldim Column dimension
+		 */
+		DenseSubmatrix (DenseMatrixBase<Element> &M,
+				size_t row,
+				size_t col,
+				size_t rowdim,
+				size_t coldim);
+
+		/** Constructor from an existing @ref DenseMatrixBase
+		 * \param M Pointer to @ref DenseMatrixBase of which to construct submatrix
+		 */
+		DenseSubmatrix (DenseMatrixBase<Element> &M);
+
+
+		/** Constructor from an existing submatrix and dimensions
+		 * @param SM Constant reference to DenseSubmatrix from which to
+		 *           construct submatrix
+		 * @param row Starting row
+		 * @param col Starting column
+		 * @param rowdim Row dimension
+		 * @param coldim Column dimension
+		 */
+		DenseSubmatrix (const DenseSubmatrix<Element> &SM,
+				size_t row,
+				size_t col,
+				size_t rowdim,
+				size_t coldim);
+
+		/** Copy constructor.
+		 * @param SM Submatrix to copy
+		 */
+		DenseSubmatrix (const DenseSubmatrix<Element> &SM);
+
+		/*  Members  */
+
+		/** Assignment operator.
+		 * Assign the given submatrix to this one
+		 * @param SM Submatrix to assign
+		 * @return Reference to this submatrix
+		 */
+		DenseSubmatrix &operator = (const DenseSubmatrix<Element> &SM);
+
+		/** Get the number of rows in the matrix
+		 * @return Number of rows in matrix
+		 */
+		size_t rowdim () const
+		{
+			return _end_row - _beg_row;
+		}
+
+		/** Get the number of columns in the matrix
+		 * @return Number of columns in matrix
+		 */
+		size_t coldim () const
+		{
+			return _end_col - _beg_col;
+		}
+
+		template<typename _Tp1>
+		struct rebind {
+			typedef DenseSubmatrix<typename _Tp1::Element> other;
+		};
+
+
+		/** Read the matrix from an input stream.
+		 * @param file Input stream from which to read
+		 * @param field
+		 */
+		template<class Field>
+		std::istream& read (std::istream &file, const Field& field);
+
+		/** Write the matrix to an output stream.
+		 * @param os Output stream to which to write
+		 * @param field
+		 * @param mapleFormat write in Maple(r) format ?
+		 */
+		template<class Field>
+		std::ostream& write (std::ostream &os, const Field& field,
+				     bool mapleFormat = false) const;
+
+		/** Write the matrix to an output stream.
+		 * This a raw version of \c write(os,F) (no field is given).
+		 * @param os Output stream to which to write
+		 * @param mapleFormat write in Maple(r) format ?
+		 */
+		std::ostream& write (std::ostream &os,
+				     bool mapleFormat = false) const;
+
+
+		/** Set the entry at (i, j).
+		 * @param i Row number, 0...rowdim () - 1
+		 * @param j Column number 0...coldim () - 1
+		 * @param a_ij Element to set
+		 */
+		void setEntry (size_t i, size_t j, const Element &a_ij)
+		{
+			_M->setEntry (_beg_row + i, _beg_col + j, a_ij);
+		}
+
+		/** Get a writeable reference to an entry in the matrix.
+		 * @param i Row index of entry
+		 * @param j Column index of entry
+		 * @return Reference to matrix entry
+		 */
+		Element &refEntry (size_t i, size_t j)
+		{
+			return _M->refEntry (i + _beg_row, j + _beg_col);
+		}
+
+		/** Get a read-only individual entry from the matrix.
+		 * @param i Row index
+		 * @param j Column index
+		 * @return Const reference to matrix entry
+		 */
+		const Element &getEntry (size_t i, size_t j) const
+		{
+			return _M->getEntry (i + _beg_row, j + _beg_col);
+		}
+
+		/** Get an entry and store it in the given value.
+		 * This form is more in the Linbox style and is provided for interface
+		 * compatibility with other parts of the library
+		 * @param x Element in which to store result
+		 * @param i Row index
+		 * @param j Column index
+		 * @return Reference to x
+		 */
+		Element &getEntry (Element &x, size_t i, size_t j) const
+		{
+			return _M->getEntry (x, i + _beg_row, j + _beg_col);
+		}
+
+		/// iterator to the begining of a row
+		RowIterator rowBegin ();
+		/// iterator to the end of a row
+		RowIterator rowEnd ();
+		/// const iterator to the begining of a row
+		ConstRowIterator rowBegin () const;
+		/// const iterator to the end of a row
+		ConstRowIterator rowEnd () const;
+
+		ColIterator colBegin ();
+		ColIterator colEnd ();
+		ConstColIterator colBegin () const;
+		ConstColIterator colEnd () const;
+
+		RawIterator rawBegin ();
+		RawIterator rawEnd ();
+		ConstRawIterator rawBegin () const;
+		ConstRawIterator rawEnd () const;
+
+
+		RawIndexedIterator rawIndexedBegin();
+		RawIndexedIterator rawIndexedEnd();
+		ConstRawIndexedIterator rawIndexedBegin() const;
+		ConstRawIndexedIterator rawIndexedEnd() const;
+
+#if 0 /*  operator[] */
+		/*- Retrieve a reference to a row
+		 * @param i Row index
+		 */
+		Row operator[] (int i);               not actually used, causes a compile error...
+		ConstRow operator[] (int i) const;
+#endif
+
+		/*! Creates a transposed matrix of \c *this.
+		 * @param[in] tM
+		 * @return the transposed matrix of this.
+		 */
+		DenseSubmatrix<Element> transpose(DenseMatrixBase<Element> & tM)
+		{
+			linbox_check(tM.coldim() == rowdim());
+			linbox_check(tM.rowdim() == coldim());
+			// DenseMatrixBase<Element> tM(coldim(),rowdim());
+			DenseSubmatrix<Element>  tA(tM);
+			for (size_t i = 0 ; i < rowdim(); ++i)
+				for (size_t j = 0 ; j < coldim(); ++j)
+					tA.setEntry(j,i,getEntry(i,j));
+			return tA;
+		}
+
+		/*! Creates a transposed matrix of \c *this.
+		 * @return the transposed matrix of this.
+		 */
+		DenseSubmatrix<Element> & transpose(DenseSubmatrix<Element> & tA)
+		{
+			for (size_t i = 0 ; i < rowdim(); ++i)
+				for (size_t j = 0 ; j < coldim(); ++j)
+					tA.setEntry(j,i,getEntry(i,j));
+			return tA;
+		}
+
+	protected:
+		DenseMatrixBase<Element> *_M;
+		size_t _beg_row;
+		size_t _end_row;
+		size_t _beg_col;
+		size_t _end_col;
+	};
+
+	/*! Write a matrix to a stream.
+	 * The C++ way using <code>operator<<</code>
+	 * @param o output stream
+	 * @param M matrix to write.
 	 */
+	template<class T>
+	std::ostream& operator<< (std::ostream & o, const DenseSubmatrix<T> & M)
+	{
+		return M.write(o);
+	}
 
-	class RawIterator;   
-	class ConstRawIterator;
-   
-	RawIterator rawBegin ();     
-	RawIterator rawEnd ();
-	ConstRawIterator rawBegin () const;       
-	ConstRawIterator rawEnd () const;  
 
-	/** \brief
-	 *
-	 * Like the raw iterator, the indexed iterator is a method for
-	 * accessing all entries in the matrix in some unspecified order.
-	 * At each position of the the indexed iterator, it also provides
-	 * the row and column indices of the currently referenced entry.
-	 * This is provided through it's rowIndex() and colIndex() functions.
-	 */
-
-        class RawIndexedIterator;
-        class ConstRawIndexedIterator;
-
-        RawIndexedIterator rawIndexedBegin();
-        RawIndexedIterator rawIndexedEnd();   
-	ConstRawIndexedIterator rawIndexedBegin() const;
-        ConstRawIndexedIterator rawIndexedEnd() const;   
-
-	/** Retrieve a reference to a row
-	 * @param i Row index
+	/*! @internal
+	 * @brief MatrixTraits
 	 */
-	//Row operator[] (int i);               not actually used, causes a compile error...
-	//ConstRow operator[] (int i) const;
-
-    protected:
-	DenseMatrixBase<Element> *_M;
-	size_t _beg_row;
-	size_t _end_row;
-	size_t _beg_col;
-	size_t _end_col;
-};
-
-template <class Element>
-struct MatrixTraits< DenseSubmatrix<Element> >
-{ 
-	typedef DenseSubmatrix<Element> MatrixType;
-	typedef typename MatrixCategories::RowColMatrixTag MatrixCategory; 
-};
+	template <class Element>
+	struct MatrixTraits< DenseSubmatrix<Element> > {
+		typedef DenseSubmatrix<Element> MatrixType;
+		typedef typename MatrixCategories::RowColMatrixTag MatrixCategory;
+	};
 
 } // namespace LinBox
 
 #include "linbox/matrix/dense-submatrix.inl"
 
-#endif // __DENSE_SUBMATRIX_H
+#endif // __LINBOX_dense_submatrix_H
+
 
diff --git a/linbox/matrix/dense-submatrix.inl b/linbox/matrix/dense-submatrix.inl
index cbed64d..1f983b5 100644
--- a/linbox/matrix/dense-submatrix.inl
+++ b/linbox/matrix/dense-submatrix.inl
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/matrix/dense-submatrix.inl
  * Copyright (C) 2001 B. David Saunders,
  *               2001-2002 Bradford Hovinen,
@@ -13,7 +13,7 @@
  *
  * -----------------------------------------------------------
  * 2002-10-27  Bradford Hovinen  <bghovinen at math.uwaterloo.ca>
- * 
+ *
  * Rename from densesubmatrix.C
  *
  * Constructor modifications: changed the interface to match Submatrix
@@ -22,8 +22,12 @@
  * See COPYING for license information
  */
 
-#ifndef __DENSE_SUBMATRIX_INL
-#define __DENSE_SUBMATRIX_INL
+/*! @file matrix/dense-submatrix.inl
+ * @brief Implementation of dense-submatrix.h
+ */
+
+#ifndef __LINBOX_dense_submatrix_INL
+#define __LINBOX_dense_submatrix_INL
 
 #include "linbox/util/debug.h"
 #include "linbox/matrix/dense.h"
@@ -32,614 +36,745 @@
 namespace LinBox
 {
 
-template <class Element>
-DenseSubmatrix<Element>::DenseSubmatrix (DenseMatrixBase<Element> &M,
-					 size_t row,
-					 size_t col,
-					 size_t rowdim,
-					 size_t coldim)
-	: _M (&M), _beg_row (row), _end_row (row + rowdim), _beg_col (col), _end_col (col + coldim)
-{
-	linbox_check (_beg_row <= _end_row);
-	linbox_check (_beg_col <= _end_col);
-	linbox_check (_end_row <= M.rowdim ());
-	linbox_check (_end_col <= M.coldim ());
-} 
-
-
-template <class Element>
-DenseSubmatrix<Element>::DenseSubmatrix (DenseMatrixBase<Element> &M)
-	: _M(&M), _beg_row(0), _end_row(M.rowdim()), _beg_col(0), _end_col(M.coldim()) {}
-
-
-
-template <class Element>
-DenseSubmatrix<Element>::DenseSubmatrix (const DenseSubmatrix<Element> &SM,
-					 size_t row,
-					 size_t col,
-					 size_t rowdim,
-					 size_t coldim)
-	: _M (SM._M),
-	  _beg_row (SM._beg_row + row),
-	  _end_row (SM._beg_row + row + rowdim),
-	  _beg_col (SM._beg_col + col),
-	  _end_col (SM._beg_col + col + coldim)
-{
-	linbox_check (_beg_row <= _end_row);
-	linbox_check (_beg_col <= _end_col);
-	linbox_check (_end_row - _beg_row <= SM.rowdim ());
-	linbox_check (_end_col - _beg_col <= SM.coldim ());
-}
-  
-template <class Element>
-DenseSubmatrix<Element>::DenseSubmatrix (const DenseSubmatrix<Element> &SM)
-	: _M (SM._M), _beg_row (SM._beg_row), _end_row (SM._end_row), _beg_col (SM._beg_col), _end_col (SM._end_col)
-{}
-
-template <class Element>
-DenseSubmatrix<Element>& DenseSubmatrix<Element>::operator=(const DenseSubmatrix<Element> &SM)
-{
-	_M = (SM._M);
-	_beg_row = SM._beg_row;
-	_end_row = SM._end_row;
-	_beg_col = SM._beg_col;
-	_end_col = SM._end_col;
-
-	return *this;
-}
-  
-template <class Element>
-class DenseSubmatrix<Element>::RawIterator
-{
-    public:
-	RawIterator (){}
-
-	RawIterator (const typename DenseMatrixBase<Element>::RawIterator& cur,
-		     const size_t c_dim,
-		     const size_t stride,
-		     const size_t c_idx)
-		: _cur (cur), _c_dim (c_dim), _stride(stride), _c_idx (c_idx)
+	template <class _Element>
+	DenseSubmatrix<_Element>::DenseSubmatrix (DenseMatrixBase<_Element> &M,
+						  size_t row,
+						  size_t col,
+						  size_t rowdim,
+						  size_t coldim) :
+		_M (&M), _beg_row (row), _end_row (row + rowdim), _beg_col (col), _end_col (col + coldim)
+	{
+		linbox_check (_beg_row <= _end_row);
+		linbox_check (_beg_col <= _end_col);
+		linbox_check (_end_row <= M.rowdim ());
+		linbox_check (_end_col <= M.coldim ());
+	}
+
+
+	template <class _Element>
+	DenseSubmatrix<_Element>::DenseSubmatrix (DenseMatrixBase<_Element> &M) :
+		_M(&M), _beg_row(0), _end_row(M.rowdim()), _beg_col(0), _end_col(M.coldim())
 	{}
 
-	RawIterator& operator = (const RawIterator& r)
+
+
+	template <class _Element>
+	DenseSubmatrix<_Element>::DenseSubmatrix (const DenseSubmatrix<_Element> &SM,
+						  size_t row,
+						  size_t col,
+						  size_t rowdim,
+						  size_t coldim) :
+		_M (SM._M),
+		_beg_row (SM._beg_row + row),
+		_end_row (SM._beg_row + row + rowdim),
+		_beg_col (SM._beg_col + col),
+		_end_col (SM._beg_col + col + coldim)
 	{
-		_cur = r._cur;
-		_c_dim = r._c_dim;
-		_stride = r._stride;
-		_c_idx = r._c_idx;
-		return *this;
+		linbox_check (_beg_row <= _end_row);
+		linbox_check (_beg_col <= _end_col);
+		linbox_check (_end_row - _beg_row <= SM.rowdim ());
+		linbox_check (_end_col - _beg_col <= SM.coldim ());
 	}
 
-	RawIterator& operator ++()
+	template <class _Element>
+	DenseSubmatrix<_Element>::DenseSubmatrix (const DenseSubmatrix<_Element> &SM) :
+		_M (SM._M), _beg_row (SM._beg_row), _end_row (SM._end_row), _beg_col (SM._beg_col), _end_col (SM._end_col)
+	{ }
+
+	template <class _Element>
+	DenseSubmatrix<_Element>& DenseSubmatrix<_Element>::operator=(const DenseSubmatrix<_Element> &SM)
 	{
-		if (_c_idx < _c_dim - 1){
-			++_cur; ++_c_idx;
-		} else {
-			_cur = _cur + _stride - _c_dim + 1;
-			_c_idx = 0;
-		}
+		_M = (SM._M);
+		_beg_row = SM._beg_row;
+		_end_row = SM._end_row;
+		_beg_col = SM._beg_col;
+		_end_col = SM._end_col;
 
-		return *this;  
+		return *this;
 	}
 
-	RawIterator& operator++ (int)
-	{
-		return this->operator++ ();
-	}
 
-	bool operator != (const RawIterator& r) const
-	{
-		return (_cur != r._cur) || (_c_dim != r._c_dim) || (_stride != r._stride) || (_c_idx != r._c_idx);
-	} 
+	/*! Raw Iterators.
+	 * @ingroup iterators
+	 *
+	 * The raw iterator is a method for accessing all entries in the matrix
+	 * in some unspecified order. This can be used, e.g. to reduce all
+	 * matrix entries modulo a prime before passing the matrix into an
+	 * algorithm.
+	 */
+	template <class _Element>
+	class DenseSubmatrix<_Element>::RawIterator {
+	public:
+		RawIterator (){}
+
+		/*! @internal
+		 * @brief NO DOC
+		 */
+		RawIterator (const typename DenseMatrixBase<_Element>::RawIterator& cur,
+			     const size_t c_dim,
+			     const size_t stride,
+			     const size_t c_idx) :
+			_cur (cur), _c_dim (c_dim), _stride(stride), _c_idx (c_idx)
+		{}
+
+		/*! @internal
+		 * @brief copy operator.
+		 * @param r RawIterator to copy.
+		 */
+		RawIterator& operator = (const RawIterator& r)
+		{
+			_cur    = r._cur;
+			_c_dim  = r._c_dim;
+			_stride = r._stride;
+			_c_idx  = r._c_idx;
+			return *this;
+		}
+
+		/*! @internal
+		 * increment.
+		 * ??
+		 */
+		RawIterator& operator ++()
+		{
+			if (_c_idx < _c_dim - 1){
+				++_cur; ++_c_idx;
+			}
+			else {
+				_cur = _cur + _stride - _c_dim + 1;
+				_c_idx = 0;
+			}
+
+			return *this;
+		}
+
+		/*! @internal
+		 * increment.
+		 * ??
+		 */
+		RawIterator& operator++ (int)
+		{
+			return this->operator++ ();
+		}
+
+
+		/*! @internal
+		 * @brief  operator !=.
+		 * @param r RawIterator to test inequaltity from.
+		 */
+		bool operator != (const RawIterator& r) const
+		{
+			return (_cur != r._cur || _c_dim != r._c_dim) || (_stride != r._stride) || (_c_idx != r._c_idx);
+		}
+
+		//! @internal operator *.
+		_Element& operator * ()
+		{
+			return *_cur;
+		}
+
+		//! @internal operator *.
+		const _Element& operator * () const
+		{
+			return *_cur;
+		}
+
+	protected:
+		typename DenseMatrixBase<_Element>::RawIterator _cur;
+		size_t _c_dim;
+		size_t _stride;
+		size_t _c_idx;
+	};
+
+	/*! Raw Iterators (const version).
+	 * @ingroup iterators
+	 * The raw iterator is a method for accessing all entries in the matrix
+	 * in some unspecified order. This can be used, e.g. to reduce all
+	 * matrix entries modulo a prime before passing the matrix into an
+	 * algorithm.
+	 */
+	template <class _Element>
+	class DenseSubmatrix<_Element>::ConstRawIterator {
+	public:
+		//! @internal Null constructor
+		ConstRawIterator (){}
+
+
+		/*! @internal
+		 * @brief NO DOC
+		 */
+		ConstRawIterator (const typename DenseMatrixBase<_Element>::ConstRawIterator& cur,
+				  const size_t c_dim,
+				  const size_t stride,
+				  const size_t c_idx) :
+			_cur (cur), _c_dim (c_dim), _stride(stride), _c_idx (c_idx)
+		{}
+
+		/*! @internal
+		 * @brief copy operator.
+		 * @param r RawIterator to copy.
+		 */
+		ConstRawIterator& operator = (const ConstRawIterator& r)
+		{
+			_cur = r._cur;
+			_c_dim = r._c_dim;
+			_stride = r._stride;
+			_c_idx = r._c_idx;
+			return *this;
+		}
+
+		/*! @internal
+		 * increment.
+		 * ??
+		 */
+		ConstRawIterator& operator ++()
+		{
+			if (_c_idx < _c_dim - 1){
+				++_cur; ++_c_idx;
+			}
+			else {
+				_cur = _cur + _stride - _c_dim + 1;
+				_c_idx = 0;
+			}
+
+			return *this;
+		}
 
-	Element& operator * ()
+		/*! @internal
+		 * increment.
+		 * ??
+		 */
+		ConstRawIterator& operator++ (int)
+		{
+			return this->operator++ ();
+		}
+
+		/*! @internal
+		 * @brief  operator !=.
+		 * @param r RawIterator to test inequaltity from.
+		 */
+		bool operator != (const ConstRawIterator& r) const
+		{
+			return (_cur != r._cur) || (_c_dim != r._c_dim) || (_stride != r._stride) || (_c_idx != r._c_idx);
+		}
+
+		//! @internal operator *.
+		const _Element& operator * () const
+		{
+			return *_cur;
+		}
+
+	protected:
+		typename DenseMatrixBase<_Element>::ConstRawIterator _cur;
+		size_t _c_dim;
+		size_t _stride;
+		size_t _c_idx;
+	};
+
+#if 0
+	template <class Element>
+	class DenseSubmatrix<Element>::ConstRawIterator {
+	public:
+		ConstRawIterator (){}
+
+		ConstRawIterator ( const typename DenseMatrixBase<Element>::ConstRawIterator& cur,
+				   size_t cont_len,
+				   size_t gap_len) :
+			_beg (beg), _cur (cur), _cont_len (cont_len), _gap_len (gap_len)
+		{}
+
+		ConstRawIterator& operator = (const RawIterator& r)
+		{
+			_cur = r._cur;
+			_beg = r._beg;
+			_cont_len = r._cont_len;
+			_gap_len = r._gap_len;
+			return *this;
+		}
+
+		ConstRawIterator& operator = (const ConstRawIterator& r)
+		{
+			_cur = r._cur;
+			_beg = r._beg;
+			_cont_len = r._cont_len;
+			_gap_len = r._gap_len;
+			return *this;
+		}
+
+		ConstRawIterator& operator++()
+		{
+			if (((_cur - _beg + 1) % _cont_len) != 0)
+				++_cur;
+			else
+			{
+				_cur = _cur + _gap_len + 1;
+				_beg = _beg + _gap_len + _cont_len;
+			}
+			return *this;
+		}
+
+		ConstRawIterator operator++(int)
+		{
+			ConstRawIterator tmp = *this;
+			this->operator++();
+			return tmp;
+		}
+
+		bool operator != (const ConstRawIterator& r) const
+		{
+			return (_cur != r._cur) || (_beg != r._beg) || (_cont_len != r._cont_len) || (_gap_len != r._gap_len);
+		}
+
+		const Element& operator*()
 		{ return *_cur; }
 
-	const Element& operator * () const
+		Element& operator*()
 		{ return *_cur; }
 
-    protected:
-	typename DenseMatrixBase<Element>::RawIterator _cur;
-	size_t _c_dim;
-	size_t _stride;
-	size_t _c_idx;
-};
-  
-template <class Element>
-class DenseSubmatrix<Element>::ConstRawIterator
-{
-    public:
-	ConstRawIterator (){}
-
-	ConstRawIterator (const typename DenseMatrixBase<Element>::ConstRawIterator& cur,
-		     const size_t c_dim,
-		     const size_t stride,
-		     const size_t c_idx)
-		: _cur (cur), _c_dim (c_dim), _stride(stride), _c_idx (c_idx)
-	{}
+		const Element& operator*() const
+		{ return *_cur; }
+
+	protected:
+		typename DenseMatrixBase<Element>::ConstRawIterator _beg;
+		typename DenseMatrixBase<Element>::ConstRawIterator _cur;
+		size_t _cont_len;
+		size_t _gap_len;
+	};
+#endif
 
-	ConstRawIterator& operator = (const ConstRawIterator& r)
+	template <class _Element>
+	typename DenseSubmatrix<_Element>::RawIterator DenseSubmatrix<_Element>::rawBegin ()
 	{
-		_cur = r._cur;
-		_c_dim = r._c_dim;
-		_stride = r._stride;
-		_c_idx = r._c_idx;
-		return *this;
+		return RawIterator (_M->rawBegin () + _beg_row * _M->coldim () + _beg_col,
+				    coldim (), _M->coldim (), 0);
 	}
 
-	ConstRawIterator& operator ++()
+	template <class _Element>
+	typename DenseSubmatrix<_Element>::RawIterator DenseSubmatrix<_Element>::rawEnd ()
 	{
-		if (_c_idx < _c_dim - 1){
-			++_cur; ++_c_idx;
-		} else {
-			_cur = _cur + _stride - _c_dim + 1;
-			_c_idx = 0;
-		}
-
-		return *this;  
+		return RawIterator (_M->rawBegin () + _end_row * _M->coldim () + _beg_col,
+				    coldim (), _M->coldim (), 0);
 	}
 
-	ConstRawIterator& operator++ (int)
+	template <class _Element>
+	typename DenseSubmatrix<_Element>::ConstRawIterator DenseSubmatrix<_Element>::rawBegin () const
 	{
-		return this->operator++ ();
+		return ConstRawIterator (_M->rawBegin () + _beg_row * _M->coldim () + _beg_col,
+					 coldim (), _M->coldim (), 0);
 	}
 
-	bool operator != (const ConstRawIterator& r) const
+	template <class _Element>
+	typename DenseSubmatrix<_Element>::ConstRawIterator DenseSubmatrix<_Element>::rawEnd () const
 	{
-		return (_cur != r._cur) || (_c_dim != r._c_dim) || (_stride != r._stride) || (_c_idx != r._c_idx);
-	} 
-
-	const Element& operator * () const
-		{ return *_cur; }
+		return ConstRawIterator (_M->rawBegin () + _end_row * _M->coldim () + _beg_col,
+					 coldim (), _M->coldim (), 0);
+	}
 
-    protected:
-	typename DenseMatrixBase<Element>::ConstRawIterator _cur;
-	size_t _c_dim;
-	size_t _stride;
-	size_t _c_idx;
-};
-  
-// template <class Element>
-// class DenseSubmatrix<Element>::ConstRawIterator
-// {   
-//     public:
-// 	ConstRawIterator (){}
-
-// 	ConstRawIterator ( const typename DenseMatrixBase<Element>::ConstRawIterator& cur, 
-// 			  size_t cont_len,
-// 			  size_t gap_len)
-// 		:   _beg (beg), _cur (cur), _cont_len (cont_len), _gap_len (gap_len)
-// 	{}
-
-// 	ConstRawIterator& operator = (const RawIterator& r)
-// 	{
-// 		_cur = r._cur;
-// 		_beg = r._beg;
-// 		_cont_len = r._cont_len;
-// 		_gap_len = r._gap_len;
-// 		return *this;
-// 	}
-
-// 	ConstRawIterator& operator = (const ConstRawIterator& r)
-// 	{
-// 		_cur = r._cur;
-// 		_beg = r._beg;
-// 		_cont_len = r._cont_len;
-// 		_gap_len = r._gap_len;
-// 		return *this;
-// 	}
-
-// 	ConstRawIterator& operator++()
-// 	{
-// 		if (((_cur - _beg + 1) % _cont_len) != 0)
-// 			++_cur;
-// 		else
-// 		{
-// 			_cur = _cur + _gap_len + 1;
-// 			_beg = _beg + _gap_len + _cont_len;
-// 		}
-// 		return *this;
-// 	}
-
-// 	ConstRawIterator operator++(int)
-// 	{
-// 		ConstRawIterator tmp = *this;
-// 		this->operator++();
-// 		return tmp;
-// 	}
-
-// 	bool operator != (const ConstRawIterator& r) const
-// 	{
-// 		return (_cur != r._cur) || (_beg != r._beg) || (_cont_len != r._cont_len) || (_gap_len != r._gap_len);
-// 	}
-    
-// 	const Element& operator*()
-// 	{ return *_cur; }
-
-// // 	Element& operator*()
-// // 		{ return *_cur; }
-
-// 	const Element& operator*() const
-// 	{ return *_cur; }
-
-//     protected:
-// 	typename DenseMatrixBase<Element>::ConstRawIterator _beg;
-// 	typename DenseMatrixBase<Element>::ConstRawIterator _cur;
-// 	size_t _cont_len;
-// 	size_t _gap_len;
-// };
-  
-template <class Element>
-typename DenseSubmatrix<Element>::RawIterator DenseSubmatrix<Element>::rawBegin ()
-{
-	return RawIterator (_M->rawBegin () + _beg_row * _M->coldim () + _beg_col, 
-			    coldim (), _M->coldim (), 0);
-}
-  
-template <class Element>
-typename DenseSubmatrix<Element>::RawIterator DenseSubmatrix<Element>::rawEnd ()
-{
-	return RawIterator (_M->rawBegin () + _end_row * _M->coldim () + _beg_col, 
-			    coldim (), _M->coldim (), 0);
-}
-template <class Element>
-typename DenseSubmatrix<Element>::ConstRawIterator DenseSubmatrix<Element>::rawBegin () const
-{
-	return ConstRawIterator (_M->rawBegin () + _beg_row * _M->coldim () + _beg_col, 
-			    coldim (), _M->coldim (), 0);
-}
-  
-template <class Element>
-typename DenseSubmatrix<Element>::ConstRawIterator DenseSubmatrix<Element>::rawEnd () const 
-{
-	return ConstRawIterator (_M->rawBegin () + _end_row * _M->coldim () + _beg_col, 
-			    coldim (), _M->coldim (), 0);
-}
-    
-// template <class Element>
-// typename DenseSubmatrix<Element>::ConstRawIterator DenseSubmatrix<Element>::rawBegin () const
-// {
-// 	return ConstRawIterator (_M->rawBegin () + _beg_row * _M->coldim () + _beg_col, 
-// 				 _M->rawBegin () + _beg_row * _M->coldim () + _beg_col, 
-// 				 coldim (), _M->coldim () - coldim ());
-// }
-  
-// template <class Element>
-// typename DenseSubmatrix<Element>::ConstRawIterator DenseSubmatrix<Element>::rawEnd () const
-// {
-// 	return ConstRawIterator (_M->rawBegin () + _end_row * _M->coldim () + _beg_col, 
-// 				 _M->rawBegin () + _end_row * _M->coldim () + _beg_col, 
-// 				 coldim (), _M->coldim () - coldim ());
-// }
-//////
-template <class Element>
-class DenseSubmatrix<Element>::RawIndexedIterator
-{   
-       public:
-	RawIndexedIterator (){}
-	
-	RawIndexedIterator (const typename DenseMatrixBase<Element>::RawIterator& cur, 
-			    size_t c_dim,
-			    size_t stride,
-			    size_t r_idx,
-			    size_t c_idx)
-		:   _cur (cur), _c_dim (c_dim), _stride (stride), _r_idx(r_idx), _c_idx (c_idx)
-	{}
-	
-	RawIndexedIterator& operator = (const RawIndexedIterator& r)
+#if 0
+	template <class Element>
+	typename DenseSubmatrix<Element>::ConstRawIterator DenseSubmatrix<Element>::rawBegin () const
 	{
-		_cur = r._cur;
-		_stride = r._stride;
-		_c_dim = r._c_dim;
-		_r_idx = r._r_idx;
-		_c_idx = r._c_idx;
-		return *this;
+		return ConstRawIterator (_M->rawBegin () + _beg_row * _M->coldim () + _beg_col,
+					 _M->rawBegin () + _beg_row * _M->coldim () + _beg_col,
+					 coldim (), _M->coldim () - coldim ());
 	}
-	
-	RawIndexedIterator& operator++()
+
+	template <class Element>
+	typename DenseSubmatrix<Element>::ConstRawIterator DenseSubmatrix<Element>::rawEnd () const
 	{
-		if (_c_idx < _c_dim - 1){
-			++_c_idx;
-			++_cur;
+		return ConstRawIterator (_M->rawBegin () + _end_row * _M->coldim () + _beg_col,
+					 _M->rawBegin () + _end_row * _M->coldim () + _beg_col,
+					 coldim (), _M->coldim () - coldim ());
+	}
+#endif
+
+	/*! Raw Indexed Iterator.
+	 * @ingroup iterators
+	 *
+	 * Like the raw iterator, the indexed iterator is a method for
+	 * accessing all entries in the matrix in some unspecified order.
+	 * At each position of the the indexed iterator, it also provides
+	 * the row and column indices of the currently referenced entry.
+	 * This is provided through it's \c rowIndex() and \c colIndex() functions.
+	 */
+	template <class _Element>
+	class DenseSubmatrix<_Element>::RawIndexedIterator {
+	public:
+		RawIndexedIterator (){}
+
+		RawIndexedIterator (const typename DenseMatrixBase<_Element>::RawIterator& cur,
+				    size_t c_dim,
+				    size_t stride,
+				    size_t r_idx,
+				    size_t c_idx) :
+			_cur (cur), _c_dim (c_dim), _stride (stride), _r_idx(r_idx), _c_idx (c_idx)
+		{}
+
+		RawIndexedIterator& operator = (const RawIndexedIterator& r)
+		{
+			_cur = r._cur;
+			_stride = r._stride;
+			_c_dim = r._c_dim;
+			_r_idx = r._r_idx;
+			_c_idx = r._c_idx;
+			return *this;
 		}
-		else
+
+		RawIndexedIterator& operator++()
 		{
-			_cur = _cur + _stride - _c_dim + 1;
-			_c_idx = 0;
-			++_r_idx;
+			if (_c_idx < _c_dim - 1){
+				++_c_idx;
+				++_cur;
+			}
+			else
+			{
+				_cur = _cur + _stride - _c_dim + 1;
+				_c_idx = 0;
+				++_r_idx;
+			}
+			return *this;
 		}
-		return *this;
-	}
-	
-	RawIndexedIterator& operator--()
-	{
-		if (_c_idx > 0){
-			--_c_idx;
-			--_cur;
+
+		RawIndexedIterator& operator--()
+		{
+			if (_c_idx > 0){
+				--_c_idx;
+				--_cur;
+			}
+			else
+			{
+				_cur = _cur - _stride + _c_dim -1;
+				_c_idx = 0;
+				--_r_idx;
+			}
+			return *this;
 		}
-		else
+
+		RawIndexedIterator operator++(int)
 		{
-			_cur = _cur - _stride + _c_dim -1;
-			_c_idx = 0;
-			--_r_idx;
+			RawIndexedIterator tmp = *this;
+			this->operator++();
+			return tmp;
 		}
-		return *this;
-	}
 
-	RawIndexedIterator operator++(int)
-	{
-		RawIndexedIterator tmp = *this;
-		this->operator++();
-		return tmp;
-	}
+		RawIndexedIterator operator--(int)
+		{
+			RawIndexedIterator tmp = *this;
+			this->operator--();
+			return tmp;
+		}
 
-	RawIndexedIterator operator--(int)
+		bool operator != (const RawIndexedIterator& r) const
+		{
+			return ((_c_idx != r._c_idx) || (_r_idx != r._r_idx) ||(_stride != r._stride) || (_c_dim != r._c_dim) );
+		}
+
+		const _Element& operator*() const {return *_cur;}
+
+		_Element& operator*() {return *_cur;}
+
+		size_t rowIndex () const { return _r_idx; }
+
+		size_t colIndex () const { return _c_idx; }
+
+		const _Element& value () const {return *_cur;}
+
+	protected:
+		typename DenseMatrixBase<_Element>::RawIterator _cur;
+		size_t _stride;
+		size_t _c_dim;
+		size_t _r_idx;
+		size_t _c_idx;
+	};
+
+	template <class _Element>
+	typename DenseSubmatrix<_Element>::RawIndexedIterator DenseSubmatrix<_Element>::rawIndexedBegin ()
 	{
-		RawIndexedIterator tmp = *this;
-		this->operator--();
-		return tmp;
+		return RawIndexedIterator (_M->rawBegin () + _beg_row * _M->coldim () + _beg_col,
+					   coldim(), _M->coldim(), 0, 0);
 	}
 
-	bool operator != (const RawIndexedIterator& r) const
+	template <class _Element>
+	typename DenseSubmatrix<_Element>::RawIndexedIterator DenseSubmatrix<_Element>::rawIndexedEnd ()
 	{
-		return ((_cur != r._cur) || (_c_idx != r._c_idx) || (_r_idx != r._r_idx) ||(_stride != r._stride) || (_c_dim != r._c_dim) );
+		return RawIndexedIterator (_M->rawBegin () + _end_row * _M->coldim () + _end_col,
+					   coldim(), _M->coldim (), rowdim()-1, coldim()-1);
 	}
-    
-	const Element& operator*() const {return *_cur;}
 
-	Element& operator*() {return *_cur;}
+	/*! Raw Indexed Iterator (const version).
+	 * @ingroup iterators
+	 *
+	 * Like the raw iterator, the indexed iterator is a method for
+	 * accessing all entries in the matrix in some unspecified order.
+	 * At each position of the the indexed iterator, it also provides
+	 * the row and column indices of the currently referenced entry.
+	 * This is provided through it's \c rowIndex() and \c colIndex() functions.
+	 */
+	template <class _Element>
+	class DenseSubmatrix<_Element>::ConstRawIndexedIterator {
+	public:
+		ConstRawIndexedIterator (){}
+
+		ConstRawIndexedIterator (const typename DenseMatrixBase<_Element>::ConstRawIterator& cur,
+					 size_t c_dim,
+					 size_t stride,
+					 size_t r_idx,
+					 size_t c_idx) :
+			_cur (cur), _stride (stride), _c_dim (c_dim), _r_idx(r_idx), _c_idx (c_idx)
+		{}
+
+		ConstRawIndexedIterator& operator = (const RawIndexedIterator& r)
+		{
+			_cur = r._cur;
+			_stride = r._stride;
+			_c_dim = r._c_dim;
+			_r_idx = r._r_idx;
+			_c_idx = r._c_idx;
+			return *this;
+		}
 
-	size_t rowIndex () const { return _r_idx; }
+		ConstRawIndexedIterator& operator = (const ConstRawIndexedIterator& r)
+		{
+			_cur = r._cur;
+			_stride = r._stride;
+			_c_dim = r._c_dim;
+			_r_idx = r._r_idx;
+			_c_idx = r._c_idx;
+			return *this;
+		}
 
-	size_t colIndex () const { return _c_idx; }
+		ConstRawIndexedIterator& operator++()
+		{
+			if (_c_idx < _c_dim - 1){
+				++_c_idx;
+				++_cur;
+			}
+			else
+			{
+				_cur = _cur + _stride - _c_dim +1;
+				_c_idx = 0;
+				++_r_idx;
+			}
+			return *this;
+		}
+		RawIndexedIterator& operator--()
+		{
+			if (_c_idx > 0){
+				--_c_idx;
+				--_cur;
+			}
+			else
+			{
+				_cur = _cur - _stride + _c_dim -1;
+				_c_idx = 0;
+				--_r_idx;
+			}
+			return *this;
+		}
 
-     protected:
-	typename DenseMatrixBase<Element>::RawIterator _cur;
-	size_t _stride;
-	size_t _c_dim;
-	size_t _r_idx;
-	size_t _c_idx;
-};
-  
-template <class Element>
-typename DenseSubmatrix<Element>::RawIndexedIterator DenseSubmatrix<Element>::rawIndexedBegin ()
-{
-	return RawIndexedIterator (_M->rawBegin () + _beg_row * _M->coldim () + _beg_col, 
-				   coldim(), _M.coldim(), 0, 0);
-}
-  
-template <class Element>
-typename DenseSubmatrix<Element>::RawIndexedIterator DenseSubmatrix<Element>::rawIndexedEnd ()
-{
-	return RawIndexedIterator (_M->rawBegin () + _end_row * _M->coldim () + _end_col, 
-				   coldim (), _M->coldim (), rowdim()-1, coldim()-1);
-}
-
-template <class Element>
-class DenseSubmatrix<Element>::ConstRawIndexedIterator
-{   
-    public:
-	ConstRawIndexedIterator (){}
-
-	ConstRawIndexedIterator (const typename DenseMatrixBase<Element>::ConstRawIterator& cur, 
-				 size_t c_dim,
-				 size_t stride,
-				 size_t r_idx,
-				 size_t c_idx)
-		:   _cur (cur), _stride (stride), _c_dim (c_dim), _r_idx(r_idx), _c_idx (c_idx)
-	{}
+		ConstRawIndexedIterator operator++(int)
+		{
+			ConstRawIndexedIterator tmp = *this;
+			this->operator++();
+			return tmp;
+		}
+
+		ConstRawIndexedIterator operator--(int)
+		{
+			ConstRawIndexedIterator tmp = *this;
+			this->operator--();
+			return tmp;
+		}
+
+		size_t rowIndex () const { return _r_idx; }
+
+		size_t colIndex () const { return _c_idx; }
+
+		bool operator != (const ConstRawIndexedIterator& r) const
+		{
+			return ((_c_idx != r._c_idx) || (_r_idx != r._r_idx) ||(_stride != r._stride) || (_c_dim != r._c_dim) );
+		}
+
+		const _Element& operator*() const {return *_cur;}
+
+
+		friend std::ostream& operator<<(std::ostream& out, const ConstRawIndexedIterator m) {
+			return out /* << m._cur << ' ' */
+			<< m._stride << ' '
+			<< m._c_dim << ' '
+			<< m._r_idx << ' '
+			<< m._c_idx;
+		}
 
-	ConstRawIndexedIterator& operator = (const RawIndexedIterator& r)
+	protected:
+		typename DenseMatrixBase<_Element>::ConstRawIterator _cur;
+		size_t _stride;
+		size_t _c_dim;
+		size_t _r_idx;
+		size_t _c_idx;
+	};
+
+	template <class _Element>
+	typename DenseSubmatrix<_Element>::ConstRawIndexedIterator DenseSubmatrix<_Element>::rawIndexedBegin () const
 	{
-		_cur = r._cur;
-		_stride = r._stride;
-		_c_dim = r._c_dim;
-		_r_idx = r._r_idx;
-		_c_idx = r._c_idx;
-		return *this;
+		return ConstRawIndexedIterator (_M->rawBegin () + _beg_row * _M->coldim () + _beg_col,
+						coldim(), _M->coldim(), 0, 0);
 	}
 
-	ConstRawIndexedIterator& operator = (const ConstRawIndexedIterator& r)
+	template <class _Element>
+	typename DenseSubmatrix<_Element>::ConstRawIndexedIterator DenseSubmatrix<_Element>::rawIndexedEnd () const
 	{
-		_cur = r._cur;
-		_stride = r._stride;
-		_c_dim = r._c_dim;
-		_r_idx = r._r_idx;
-		_c_idx = r._c_idx;
-		return *this;
+		return ConstRawIndexedIterator (_M->rawBegin () + _end_row * _M->coldim () + _end_col,
+						coldim (), _M->coldim (), rowdim()-1, coldim()-1);
 	}
 
-	ConstRawIndexedIterator& operator++()
+	////////
+	template <class _Element>
+	typename DenseSubmatrix<_Element>::RowIterator DenseSubmatrix<_Element>::rowBegin ()
 	{
-		if (_c_idx < _c_dim - 1){
-			++_c_idx;
-			++_cur;
-		}
-		else
-		{
-			_cur = _cur + _stride - _c_dim +1;
-			_c_idx = 0;
-			++_r_idx;
-		}
-		return *this;
+		return RowIterator (_M->rawBegin () + _beg_row * _M->coldim () + _beg_col,
+				    _end_col - _beg_col, _M->coldim ());
 	}
-	RawIndexedIterator& operator--()
+
+	template <class _Element>
+	typename DenseSubmatrix<_Element>::RowIterator DenseSubmatrix<_Element>::rowEnd ()
 	{
-		if (_c_idx > 0){
-			--_c_idx;
-			--_cur;
-		}
-		else
-		{
-			_cur = _cur - _stride + _c_dim -1;
-			_c_idx = 0;
-			--_r_idx;
-		}
-		return *this;
+		return RowIterator (_M->rawBegin () + _end_row * _M->coldim () + _beg_col,
+				    _end_col - _beg_col, _M->coldim ());
 	}
 
-	ConstRawIndexedIterator operator++(int)
+	template <class _Element>
+	typename DenseSubmatrix<_Element>::ConstRowIterator DenseSubmatrix<_Element>::rowBegin () const
 	{
-		ConstRawIndexedIterator tmp = *this;
-		this->operator++();
-		return tmp;
+		return ConstRowIterator (_M->rawBegin () + _beg_row * _M->coldim () + _beg_col,
+					 _end_col - _beg_col, _M->coldim ());
 	}
 
-	ConstRawIndexedIterator operator--(int)
+	template <class _Element>
+	typename DenseSubmatrix<_Element>::ConstRowIterator DenseSubmatrix<_Element>::rowEnd () const
 	{
-		ConstRawIndexedIterator tmp = *this;
-		this->operator--();
-		return tmp;
+		return ConstRowIterator (_M->rawBegin () + _end_row * _M->coldim () + _beg_col,
+					 _end_col - _beg_col, _M->coldim ());
 	}
 
-	size_t rowIndex () const { return _r_idx; }
+	template <class _Element>
+	typename DenseSubmatrix<_Element>::ColIterator DenseSubmatrix<_Element>::colBegin ()
+	{
+		return ColIterator (_M->rawBegin () + _beg_col + _beg_row * _M->coldim (),
+				    _M->coldim (), rowdim ());
+	}
 
-	size_t colIndex () const { return _c_idx; }
+	template <class _Element>
+	typename DenseSubmatrix<_Element>::ColIterator DenseSubmatrix<_Element>::colEnd ()
+	{
+		return ColIterator (_M->rawBegin () + _end_col + _beg_row * _M->coldim (),
+				    _M->coldim (), rowdim ());
+	}
 
-	bool operator != (const ConstRawIndexedIterator& r) const
+	template <class _Element>
+	typename DenseSubmatrix<_Element>::ConstColIterator DenseSubmatrix<_Element>::colBegin () const
 	{
-		return ((_cur != r._cur) || (_c_idx != r._c_idx) || (_r_idx != r._r_idx) ||(_stride != r._stride) || (_c_dim != r._c_dim) );
+		return ConstColIterator (_M->rawBegin () + _beg_col + _beg_row * _M->coldim (),
+					 _M->coldim (), rowdim ());
 	}
-	
-	const Element& operator*() const {return *_cur;}
-
-    protected:
-	typename DenseMatrixBase<Element>::ConstRawIterator _cur;
-	size_t _stride;
-	size_t _c_dim;
-	size_t _r_idx;
-	size_t _c_idx;
-};
-
-template <class Element>
-typename DenseSubmatrix<Element>::ConstRawIndexedIterator DenseSubmatrix<Element>::rawIndexedBegin () const
-{
-	return ConstRawIndexedIterator (_M->rawBegin () + _beg_row * _M->coldim () + _beg_col, 
-					coldim(), _M->coldim(), 0, 0);
-}
-  
-template <class Element>
-typename DenseSubmatrix<Element>::ConstRawIndexedIterator DenseSubmatrix<Element>::rawIndexedEnd () const
-{
-	return ConstRawIndexedIterator (_M->rawBegin () + _end_row * _M->coldim () + _end_col, 
-					coldim (), _M->coldim (), rowdim()-1, coldim()-1);
-}
 
-////////  
-template <class Element>
-typename DenseSubmatrix<Element>::RowIterator DenseSubmatrix<Element>::rowBegin ()
-{
-	return RowIterator (_M->rawBegin () + _beg_row * _M->coldim () + _beg_col,
-			    _end_col - _beg_col, _M->coldim ());
-}
- 
-template <class Element>
-typename DenseSubmatrix<Element>::RowIterator DenseSubmatrix<Element>::rowEnd ()
-{
-	return RowIterator (_M->rawBegin () + _end_row * _M->coldim () + _beg_col,
-			    _end_col - _beg_col, _M->coldim ());
-}
+	template <class _Element>
+	typename DenseSubmatrix<_Element>::ConstColIterator DenseSubmatrix<_Element>::colEnd () const
+	{
+		return ConstColIterator (_M->rawBegin () + _end_col + _beg_row * _M->coldim (),
+					 _M->coldim (), rowdim ());
+	}
 
-template <class Element>
-typename DenseSubmatrix<Element>::ConstRowIterator DenseSubmatrix<Element>::rowBegin () const
-{
-	return ConstRowIterator (_M->rawBegin () + _beg_row * _M->coldim () + _beg_col,
-				 _end_col - _beg_col, _M->coldim ());
-}
-  
-template <class Element>
-typename DenseSubmatrix<Element>::ConstRowIterator DenseSubmatrix<Element>::rowEnd () const
-{
-	return ConstRowIterator (_M->rawBegin () + _end_row * _M->coldim () + _beg_col,
-				 _end_col - _beg_col, _M->coldim ());
-}
+	template <class _Element>
+	template <class Field>
+	std::istream& DenseSubmatrix<_Element>::read (std::istream &file, const Field& field)
+	{
+		RawIterator p;
 
-template <class Element>
-typename DenseSubmatrix<Element>::ColIterator DenseSubmatrix<Element>::colBegin ()
-{
-	return ColIterator (_M->rawBegin () + _beg_col + _beg_row * _M->coldim (),
-			    _M->coldim (), rowdim ());
-}
+		for (p = rawBegin (); p != rawEnd (); ++p) {
+			// each entry is seperated by one space.
+			file.ignore (1);
+			field.read (file, *p);
+		}
 
-template <class Element>
-typename DenseSubmatrix<Element>::ColIterator DenseSubmatrix<Element>::colEnd ()
-{
-	return ColIterator (_M->rawBegin () + _end_col + _beg_row * _M->coldim (),
-			    _M->coldim (), rowdim ());
-}
+		return file;
+	}
 
-template <class Element>
-typename DenseSubmatrix<Element>::ConstColIterator DenseSubmatrix<Element>::colBegin () const
-{
-	return ConstColIterator (_M->rawBegin () + _beg_col + _beg_row * _M->coldim (),
-				 _M->coldim (), rowdim ());
-}
+	template <class _Element>
+	template <class Field>
+	std::ostream &DenseSubmatrix<_Element>::write (std::ostream &os, const Field& field,
+						       bool mapleFormat) const
+	{
+		ConstRowIterator p;
 
-template <class Element>
-typename DenseSubmatrix<Element>::ConstColIterator DenseSubmatrix<Element>::colEnd () const
-{
-	return ConstColIterator (_M->rawBegin () + _end_col + _beg_row * _M->coldim (),
-				 _M->coldim (), rowdim ());
-}
+		// integer c;
+		//int wid;
 
-template <class Element>
-template <class Field>
-std::istream& DenseSubmatrix<Element>::read (std::istream &file, const Field& field)
-{
-	RawIterator p;
+		// field.cardinality (c);
+		//wid = (int) ceil (log ((double) c) / M_LN10); //BB : not used !
 
-	for (p = rawBegin (); p != rawEnd (); ++p) {
-		// each entry is seperated by one space.
-		file.ignore (1);
-		field.read (file, *p);
-	}
+		typename ConstRow::const_iterator pe;
 
-	return file;
-}
+		if (mapleFormat) os << "[";
 
-template <class Element>
-template <class Field>
-std::ostream &DenseSubmatrix<Element>::write (std::ostream &os, const Field& field, bool mapleFormat) const
-{
-	ConstRowIterator p;
+		for (p = rowBegin (); p != rowEnd (); ++p) {
+			if (mapleFormat && (p != rowBegin()))
+				os << ',';
+			if (mapleFormat) os << "[";
+
+			for (pe = p->begin (); pe != p->end (); ++pe) {
+				if (mapleFormat && (pe != p->begin())) os << ',';
+				// matrix base does not provide this field(), maybe should?
+				//_M.field ().write (os, *pe);
+				//os << *pe;
+				//fixed by using extra field
+
+				field.write (os, *pe);
+				os << " ";
+			}
+
+			if (!mapleFormat)
+				os << std::endl;
+			else os << ']';
+		}
 
-	integer c;
-	int wid;
+		if (mapleFormat) os << ']';
+		return os;
+	}
 
-	field.cardinality (c);
-	wid = (int) ceil (log ((double) c) / M_LN10);
+	template <class _Element>
+	std::ostream &DenseSubmatrix<_Element>::write (std::ostream &os, bool mapleFormat) const
+	{
+		ConstRowIterator p;
 
-	typename ConstRow::const_iterator pe;
 
-	if (mapleFormat) os << "[";
 
-	for (p = rowBegin (); p != rowEnd (); ++p) {
-		if (mapleFormat && (p != rowBegin()))
-			os << ',';
+		typename ConstRow::const_iterator pe;
+
 		if (mapleFormat) os << "[";
 
-		for (pe = p->begin (); pe != p->end (); ++pe) {
-			if (mapleFormat && (pe != p->begin())) os << ',';
-			// matrix base does not provide this field(), maybe should?
-			//_M.field ().write (os, *pe);
-		        //os << *pe;
-			//fixed by using extra field
+		for (p = rowBegin (); p != rowEnd (); ++p) {
+			if (mapleFormat && (p != rowBegin()))
+				os << ',';
+			if (mapleFormat) os << "[";
+
+			for (pe = p->begin (); pe != p->end (); ++pe) {
+				if (mapleFormat && (pe != p->begin())) os << ',';
+
+				os << *pe;
+				os << " ";
+			}
 
-			field.write (os, *pe);
-			os << " ";
+			if (!mapleFormat)
+				os << std::endl;
+			else os << ']';
 		}
 
-		if (!mapleFormat)
-			os << std::endl;
-		else os << ']';
+		if (mapleFormat) os << ']';
+		return os;
 	}
 
-	if (mapleFormat) os << ']';
-	os << std::endl;
-
-	return os;
-}
 
 } // namespace LinBox
 
-#endif // __DENSE_SUBMATRIX_INL
+#endif // __LINBOX_dense_submatrix_INL
+
diff --git a/linbox/matrix/dense.h b/linbox/matrix/dense.h
index 5c25ea0..cc4814d 100644
--- a/linbox/matrix/dense.h
+++ b/linbox/matrix/dense.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/matrix/dense.h
  * Copyright (C) 2001 B. David Saunders,
  *               2001-2002 Bradford Hovinen,
@@ -33,8 +33,13 @@
  * See COPYING for license information
  */
 
-#ifndef __MATRIX_DENSE_H
-#define __MATRIX_DENSE_H
+/*! @file matrix/dense.h
+ * @ingroup matrix
+ * @brief Blackbox dense matrix.
+ */
+
+#ifndef __LINBOX_matrix_dense_H
+#define __LINBOX_matrix_dense_H
 
 #include <iostream>
 #include <vector>
@@ -52,264 +57,316 @@
 namespace LinBox
 {
 
-/** Blackbox dense matrix template. This is a class of dense matrices
- * templatized by the entry type, the Element type of some {@link Fields field}.
- * The matrix is stored as a one dimensional STL vector of the elements, by rows. 
- * The interface provides for iteration over rows and over columns.
- *
- * The class LinBox::Dense builds on this base.
- *
- * Currently, only dense vectors are supported when doing matrix-vector applies.
- *
-\ingroup matrix
- */
-  
-template <class _Element>
-class DenseMatrixBase
-{
-    public:
-
-	typedef _Element Element;
-	typedef typename RawVector<Element>::Dense Rep;
-        typedef DenseMatrixBase<_Element> Self_t;
-
-	template<typename _Tp1>
-        struct rebind
-        { 
-            typedef DenseMatrixBase<typename _Tp1::Element> other; 
-
-            void operator() (other *& Ap, const Self_t& A, const _Tp1& F) {
-                Ap = new other(A.rowdim(), A.coldim());
-                typename Self_t::ConstRawIterator         iter_value = A.rawBegin();
-                typename other::RawIterator               new_value = Ap->rawBegin();
-                Hom<typename Self_t::Field, _Tp1> hom(A.field(), F);
-                for (;iter_value != A.rawEnd(); ++iter_value,++new_value)
-                    hom. image (*new_value, *iter_value);
-            }
-        };
-
-	///
-	DenseMatrixBase ()
-		: _rows (0), _cols (0)
-	{}
-
-	/** Constructor.
-	 * @param  m  row dimension
-	 * @param  n  column dimension
-	 */
-	DenseMatrixBase (size_t m, size_t n)
-		: _rep (m * n), _rows (m), _cols (n), _ptr(&_rep[0])
-	{}
-
-	/** Constructor from a matrix stream */
-	template< class Field >
-	DenseMatrixBase( MatrixStream<Field>& ms );
-
-	///
-	DenseMatrixBase (const DenseMatrixBase &M)
-		: _rep (M._rep),_rows (M._rows), _cols (M._cols), _ptr(&_rep[0])
-	{}
-
-	~DenseMatrixBase(){}
-	///
-	DenseMatrixBase& operator= (const DenseMatrixBase& M) {
-		(*this)._rep  = M._rep;
-		(*this)._rows = M._rows;
-		(*this)._cols = M._cols;
-		(*this)._ptr  = &_rep[0];
-		return (*this);
-	}
-
-	/** Get a pointer on the storage of the elements
-	 * @returns a pointer on Elements
-	/todo What is this?
-	 */
-	Element* FullIterator() const {return const_cast<Element*>(&_rep[0]);}
-
-	/** Get the number of rows in the matrix
-	 * @returns Number of rows in matrix
-	 */
-	size_t rowdim () const
-		{ return _rows; }
-
-	/** Get the number of columns in the matrix
-	 * @returns Number of columns in matrix
-	 */
-	size_t coldim () const
-		{ return _cols; }
-
-	/** Resize the matrix to the given dimensions
-	 * The state of the matrix's entries after a call to this method is
-	 * undefined
-	 * @param m Number of rows
-	 * @param n Number of columns
-	 */
-	void resize (size_t m, size_t n, const Element& val = Element())
-	{
-		_rows = m;
-		_cols = n;
-		_rep.resize (m * n, val);
-	}
-
-	/** Read the matrix from an input stream
-	 * @param file Input stream from which to read
-	 * @param F Field over which to read
-	 */
-	template <class Field>
-	std::istream &read (std::istream &file, const Field &F);
-
-	/** Write the matrix to an output stream
-	 * @param os Output stream to which to write
-	 * @param F Field over which to write
-	 */
-	template <class Field>
-	std::ostream &write (std::ostream &os, const Field &F) const;
-
-	/** Set the entry at the (i, j) position to a_ij.
-	 * @param i Row number, 0...rowdim () - 1
-	 * @param j Column number 0...coldim () - 1
-	 * @param a_ij Element to set
-	 */
-	void setEntry (size_t i, size_t j, const Element &a_ij)
-		{ _rep[i * _cols + j] = a_ij; }
-
-	/** Get a writeable reference to the entry in the (i, j) position.
-	 * @param i Row index of entry
-	 * @param j Column index of entry
-	 * @returns Reference to matrix entry
-	 */
-	Element &refEntry (size_t i, size_t j)
-		{ return _rep[i * _cols + j]; }
-
-	/** Get a read-only reference to the entry in the (i, j) position.
-	 * @param i Row index
-	 * @param j Column index
-	 * @returns Const reference to matrix entry
-	 */
-	const Element &getEntry (size_t i, size_t j) const
-		{ return _rep[i * _cols + j]; }
-
-	/** Copy the (i, j) entry into x, and return a reference to x.
-	 * This form is more in the Linbox style and is provided for interface
-	 * compatibility with other parts of the library
-	 * @param x Element in which to store result
-	 * @param i Row index
-	 * @param j Column index
-	 * @returns Reference to x
-	 */
-	Element &getEntry (Element &x, size_t i, size_t j) const
-		{ x = _rep[i * _cols + j]; return x; }
-
-	/** @name Column of rows iterator
-	 * The column of rows iterator traverses the rows of the
-	 * matrix in ascending order. Dereferencing the iterator yields
-	 * a row vector in dense format
-	 */
-
-	typedef Subvector<typename Rep::iterator, typename Rep::const_iterator> Row;  
-	typedef Subvector<typename Rep::const_iterator> ConstRow;  
-
-	class RowIterator;    
-	class ConstRowIterator;
-
-	RowIterator rowBegin ();  
-	RowIterator rowEnd ();
-	ConstRowIterator rowBegin () const;        
-	ConstRowIterator rowEnd () const;
-
-	/** @name Row of columns iterator
-	 * The row of columns iterator traverses the columns of the
-	 * matrix in ascending order. Dereferencing the iterator yields
-	 * a column vector in dense format
-	 */
-
-	typedef Subvector<Subiterator<typename Rep::iterator> > Col;
-	typedef Subvector<Subiterator<typename Rep::const_iterator> > ConstCol;
-	typedef Col Column;
-	typedef ConstCol ConstColumn;
-
-	class ColIterator;
-	class ConstColIterator;
-    
-	ColIterator colBegin ();
-	ColIterator colEnd ();
-	ConstColIterator colBegin () const;    
-	ConstColIterator colEnd () const;
-
-	/** \brief
+	/** @brief LinBox dense matrix template.
+	 * This is a class of dense matrices
+	 * templatized by the entry type, the \c Element type of some @link Fields field at endlink.
+	 * The matrix is stored as a one dimensional STL \c std::vector of the elements, by rows.
+	 * The interface provides for iteration over rows and over columns.
 	 *
-	 * The raw iterator is a method for accessing all entries in the matrix
-	 * in some unspecified order. This can be used, e.g. to reduce all
-	 * matrix entries modulo a prime before passing the matrix into an
-	 * algorithm.
-	 */
-
-	typedef typename Rep::iterator RawIterator;
-	typedef typename Rep::const_iterator ConstRawIterator;
-    
-	RawIterator rawBegin ();		  
-	RawIterator rawEnd ();
-	ConstRawIterator rawBegin () const;
-	ConstRawIterator rawEnd () const;
-
-	/** \brief
+	 * The class \c LinBox::DenseMatrix builds on this base.
 	 *
-	 * Like the raw iterator, the indexed iterator is a method for 
-	 * accessing all entries in the matrix in some unspecified order. 
-	 * At each position of the the indexed iterator, it also provides 
-	 * the row and column indices of the currently referenced entry.
-	 * This is provided through it's rowIndex() and colIndex() functions.
-	 */
-
-        class RawIndexedIterator;
-        class ConstRawIndexedIterator;
-
-        RawIndexedIterator rawIndexedBegin();
-        RawIndexedIterator rawIndexedEnd();   
-	ConstRawIndexedIterator rawIndexedBegin() const;
-        ConstRawIndexedIterator rawIndexedEnd() const;   
-    
-	/** Retrieve a reference to a row.
-	 * Since rows may also be indexed, this allows A[i][j] notation
-	 * to be used.
-	 * @param i Row index
+	 * Currently, only dense vectors are supported when doing matrix-vector applies.
+	 *
+	 * \ingroup matrix
 	 */
-	Row operator[] (size_t i)
-		{ return Row (_rep.begin () + i * _cols, _rep.begin () + i * _cols + _cols); }
-
-	ConstRow operator[] (size_t i) const
-		{ return Row (_rep.begin () + i * _cols, _rep.begin () + i * _cols + _cols); }
-
-	/** Compute column density
+	template <class _Element>
+	class DenseMatrixBase {
+	public:
+
+		typedef _Element                            Element; //!< Element type
+		typedef typename RawVector<Element>::Dense      Rep; //!< No doc
+		typedef DenseMatrixBase<_Element>            Self_t; //!< Self type
+
+		template<typename _Tp1>
+		struct rebind {
+			typedef DenseMatrixBase<typename _Tp1::Element> other;
+		};
+
+		/// NULL constructor.
+		DenseMatrixBase () :
+			_rows (0), _cols (0)
+		{}
+
+		/** Constructor.
+		 * @param  m  row dimension
+		 * @param  n  column dimension
+		 */
+		DenseMatrixBase (size_t m, size_t n) :
+			_rep (m * n), _rows (m), _cols (n), _ptr(&_rep[0])
+		{}
+
+		/** Constructor from a matrix stream.
+		 * @param ms matrix stream
+		 */
+		template< class Field >
+		DenseMatrixBase( MatrixStream<Field>& ms );
+
+		/*! copy constructor.
+		 * @param M Dense matrix to be copied.
+		 */
+		DenseMatrixBase (const DenseMatrixBase &M) :
+			_rep (M._rep),_rows (M._rows), _cols (M._cols), _ptr(&_rep[0])
+		{}
+
+		//! destructor.
+		~DenseMatrixBase(){}
+
+		/*! copy operator.
+		 * @param M matrix to be copied.
+		 */
+		DenseMatrixBase& operator= (const DenseMatrixBase& M)
+		{
+			(*this)._rep  = M._rep;
+			(*this)._rows = M._rows;
+			(*this)._cols = M._cols;
+			(*this)._ptr  = &_rep[0];
+			return (*this);
+		}
+
+		/** Get a pointer on the storage of the elements.
+		 * @returns a pointer on Elements
+		 /todo What is this?
+		 */
+		Element* FullIterator() const
+		{
+			return const_cast<Element*>(&_rep[0]);
+		}
+
+		/** Get the number of rows in the matrix
+		 * @returns Number of rows in matrix
+		 */
+		size_t rowdim () const
+		{
+			return _rows;
+		}
+
+		/** Get the number of columns in the matrix.
+		 * @returns Number of columns in matrix
+		 */
+		size_t coldim () const
+		{
+			return _cols;
+		}
+
+		/** Resize the matrix to the given dimensions.
+		 * The state of the matrix's entries after a call to this method is
+		 * undefined
+		 * @param m Number of rows
+		 * @param n Number of columns
+		 * @param val
+		 */
+		void resize (size_t m, size_t n, const Element& val = Element())
+		{
+			_rows = m;
+			_cols = n;
+			_rep.resize (m * n, val);
+		}
+
+		/** Read the matrix from an input stream.
+		 * @param file Input stream from which to read
+		 * @param F Field over which to read
+		 */
+		template <class Field>
+		std::istream &read (std::istream &file, const Field &F);
+
+		/** Write the matrix to an output stream.
+		 * @param os Output stream to which to write
+		 * @param F Field over which to write
+		 * @param mapleFormat write in Maple format ?
+		 */
+		template <class Field>
+		std::ostream &write (std::ostream &os, const Field &F,
+				     bool mapleFormat=true) const;
+
+		/** Write brutally the matrix to an output stream.
+		 * This a raw version of \c write(os,F) (no field is given).
+		 * @param os Output stream to which to write
+		 * @param mapleFormat write in maple format ?
+		 */
+		std::ostream &write (std::ostream &os,
+				     bool mapleFormat=true) const;
+
+
+		/** Set the entry at the (i, j) position to a_ij.
+		 * @param i Row number, 0...rowdim () - 1
+		 * @param j Column number 0...coldim () - 1
+		 * @param a_ij Element to set
+		 */
+		void setEntry (size_t i, size_t j, const Element &a_ij)
+		{
+			_rep[i * _cols + j] = a_ij;
+		}
+
+		/** Get a writeable reference to the entry in the (i, j) position.
+		 * @param i Row index of entry
+		 * @param j Column index of entry
+		 * @returns Reference to matrix entry
+		 */
+		Element &refEntry (size_t i, size_t j)
+		{
+			return _rep[i * _cols + j];
+		}
+
+		/** Get a read-only reference to the entry in the (i, j) position.
+		 * @param i Row index
+		 * @param j Column index
+		 * @returns Const reference to matrix entry
+		 */
+		const Element &getEntry (size_t i, size_t j) const
+		{
+			return _rep[i * _cols + j];
+		}
+
+		/** Copy the (i, j) entry into x, and return a reference to x.
+		 * This form is more in the Linbox style and is provided for interface
+		 * compatibility with other parts of the library
+		 * @param x Element in which to store result
+		 * @param i Row index
+		 * @param j Column index
+		 * @returns Reference to x
+		 */
+		Element &getEntry (Element &x, size_t i, size_t j) const
+		{
+			x = _rep[i * _cols + j]; return x;
+		}
+
+		/** @name Column of rows iterator
+		 * \brief
+		 * The column of rows iterator traverses the rows of the
+		 * matrix in ascending order. Dereferencing the iterator yields
+		 * a row vector in dense format
+		 */
+		//@{
+		typedef Subvector<typename Rep::iterator, typename Rep::const_iterator> Row;
+		typedef Subvector<typename Rep::const_iterator>                    ConstRow;
+
+		class RowIterator;
+		class ConstRowIterator;
+
+		RowIterator rowBegin ();
+		RowIterator rowEnd ();
+		ConstRowIterator rowBegin () const;
+		ConstRowIterator rowEnd   () const;
+		//@}
+
+		/** @name Row of columns iterator
+		 * \brief
+		 * The row of columns iterator traverses the columns of the
+		 * matrix in ascending order. Dereferencing the iterator yields
+		 * a column vector in dense format
+		 */
+		//@{
+		typedef Subvector<Subiterator<typename Rep::iterator> >            Col;
+		typedef Subvector<Subiterator<typename Rep::const_iterator> > ConstCol;
+		typedef Col           Column;
+		typedef ConstCol ConstColumn;
+
+		class ColIterator;
+		class ConstColIterator;
+
+		ColIterator colBegin ();
+		ColIterator colEnd ();
+		ConstColIterator colBegin () const;
+		ConstColIterator colEnd () const;
+		//@}
+
+		/** @name Raw iterator
+		 * \brief
+		 *
+		 * The raw iterator is a method for accessing all entries in the matrix
+		 * in some unspecified order. This can be used, e.g. to reduce all
+		 * matrix entries modulo a prime before passing the matrix into an
+		 * algorithm.
+		 */
+		//@{
+		typedef typename Rep::iterator RawIterator;
+		typedef typename Rep::const_iterator ConstRawIterator;
+
+		RawIterator rawBegin ();
+		RawIterator rawEnd   ();
+		ConstRawIterator rawBegin () const;
+		ConstRawIterator rawEnd   () const;
+		//@}
+
+		/** @name Raw Indexed iterator
+		 * \brief
+		 *
+		 * Like the raw iterator, the indexed iterator is a method for
+		 * accessing all entries in the matrix in some unspecified order.
+		 * At each position of the the indexed iterator, it also provides
+		 * the row and column indices of the currently referenced entry.
+		 * This is provided through it's \c rowIndex() and \c colIndex() functions.
+		 */
+		//@{
+		class RawIndexedIterator;
+		class ConstRawIndexedIterator;
+
+		RawIndexedIterator rawIndexedBegin ();
+		RawIndexedIterator rawIndexedEnd   ();
+		ConstRawIndexedIterator rawIndexedBegin () const;
+		ConstRawIndexedIterator rawIndexedEnd   () const;
+		//@}
+
+		/** Retrieve a reference to a row.
+		 * Since rows may also be indexed, this allows A[i][j] notation
+		 * to be used.
+		 * @param i Row index
+		 */
+		//@{
+		Row operator[] (size_t i)
+		{
+			return Row (_rep.begin () + i * _cols, _rep.begin () + i * _cols + _cols);
+		}
+
+		ConstRow operator[] (size_t i) const
+		{
+			return Row (_rep.begin () + i * _cols, _rep.begin () + i * _cols + _cols);
+		}
+		//@}
+
+		/** Compute column density.
+		 * @param v
+		*/
+		template <class Vector>
+		Vector &columnDensity (Vector &v) const
+		{
+			std::fill (v.begin (), v.end (), _rows);
+			return v;
+		}
+
+	protected:
+		std::vector<Element>  _rep;
+		size_t                _rows, _cols;
+		Element *             _ptr;
+
+	}; //class DenseMatrixBase 
+
+	/*! Write a matrix to a stream.
+	 * The C++ way using <code>operator<<</code>
+	 * @param o output stream
+	 * @param M matrix to write.
 	 */
+	template<class T>
+	std::ostream& operator<< (std::ostream & o, const DenseMatrixBase<T> & M)
+	{
+		return M.write(o);
+	}
 
-	template <class Vector>
-	Vector &columnDensity (Vector &v) const
-		{ std::fill (v.begin (), v.end (), _rows); return v; }
-
-    protected:
-
-	std::vector<Element>  _rep;
-	size_t                _rows, _cols;
-	Element *             _ptr;
-};
-
-template <class Element>
-struct MatrixTraits< DenseMatrixBase<Element> >
-{ 
-	typedef DenseMatrixBase<Element> MatrixType;
-	typedef typename MatrixCategories::RowColMatrixTag MatrixCategory; 
-};
+	template <class Element>
+	struct MatrixTraits< DenseMatrixBase<Element> > {
+		typedef DenseMatrixBase<Element> MatrixType;
+		typedef typename MatrixCategories::RowColMatrixTag MatrixCategory;
+	};
 
-template <class Element>
-struct MatrixTraits< const DenseMatrixBase<Element> >
-{ 
-	typedef const DenseMatrixBase<Element> MatrixType;
-	typedef typename MatrixCategories::RowColMatrixTag MatrixCategory; 
-};
+	template <class Element>
+	struct MatrixTraits< const DenseMatrixBase<Element> > {
+		typedef const DenseMatrixBase<Element> MatrixType;
+		typedef typename MatrixCategories::RowColMatrixTag MatrixCategory;
+	};
 
 } // namespace LinBox
 
 #include "dense.inl"
 
-#endif // __MATRIX_DENSE_H
+#endif // __LINBOX_matrix_dense_H
+
diff --git a/linbox/matrix/dense.inl b/linbox/matrix/dense.inl
index 17de998..69e6cd7 100644
--- a/linbox/matrix/dense.inl
+++ b/linbox/matrix/dense.inl
@@ -1,12 +1,12 @@
 /* -*- 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
 /* linbox/matrix/dense.inl
- * Copyright (C) 2001 B. David Saunders, 
- *               2001-2002 Bradford Hovinen, 
+ * Copyright (C) 2001 B. David Saunders,
+ *               2001-2002 Bradford Hovinen,
  *               2002 Zhendong Wan
  *
- * Written by B. David Saunders <saunders at cis.udel.edu>, 
- *            Bradford Hovinen <hovinen at cis.udel.edu>, 
+ * Written by B. David Saunders <saunders at cis.udel.edu>,
+ *            Bradford Hovinen <hovinen at cis.udel.edu>,
  *            Zhendong Wan <wan at mail.eecis.udel.edu>
  *
  * evolved from dense-matrix.h by -bds, Zhendong Wan
@@ -24,8 +24,8 @@
  * See COPYING for license information
  */
 
-#ifndef __MATRIX_DENSE_INL
-#define __MATRIX_DENSE_INL
+#ifndef __LINBOX_matrix_dense_INL
+#define __LINBOX_matrix_dense_INL
 
 #include <iostream>
 #include <cmath>
@@ -36,675 +36,913 @@
 namespace LinBox
 {
 
-template <class Element>
-class DenseMatrixBase<Element>::ConstRowIterator
-{
-    public:
-	ConstRowIterator (const typename Rep::const_iterator& p, size_t len, size_t d)
-		: _row (p, p + len), _dis (d) {}
-    
-	ConstRowIterator () {}
-    
-	ConstRowIterator (const ConstRowIterator& colp)
-		: _row (colp._row), _dis (colp._dis) {}
-    
-	ConstRowIterator& operator = (const ConstRowIterator& colp)
-	{
-		_row = colp._row;
-		_dis = colp._dis;
-		return *this;
-	}
+	/*  Constructor */
 
-	ConstRowIterator& operator --()
+	template <class _Element>
+	template <class Field>
+	DenseMatrixBase<_Element>::DenseMatrixBase( MatrixStream<Field>& ms ) :
+		_rep(0), _rows(0), _cols(0), _ptr(NULL)
 	{
-		_row = ConstRow (_row.begin () - _dis, _row.end () - _dis);
-		return *this;
+		if( !ms.getArray(_rep) || !ms.getRows(_rows) || !ms.getColumns(_cols) )
+			throw ms.reportError(__FUNCTION__,__LINE__);
+		_ptr = &_rep[0];
 	}
 
-	ConstRowIterator  operator-- (int)
-        {
-                ConstRowIterator tmp (*this);
-                --*this;
-                return tmp;
-	}
+	/* Iterator classes */
+
+	/*! Const Row Iterator.
+	 * @ingroup iterators
+	 * @brief NO DOC
+	 */
+	template <class Element>
+	class DenseMatrixBase<Element>::ConstRowIterator {
+	public:
+		ConstRowIterator (const typename Rep::const_iterator& p, size_t len, size_t d) :
+			_row (p, p + len), _dis (d)
+		{}
+
+		ConstRowIterator () {}
+
+		ConstRowIterator (const ConstRowIterator& colp) :
+			_row (colp._row), _dis (colp._dis)
+		{}
+
+		ConstRowIterator& operator = (const ConstRowIterator& colp)
+		{
+			_row = colp._row;
+			_dis = colp._dis;
+			return *this;
+		}
 
-	
-	ConstRowIterator& operator++ ()
-	{
-		_row = ConstRow (_row.begin () + _dis, _row.end () + _dis);
-		return *this;
-	}
+		ConstRowIterator& operator --()
+		{
+			_row = ConstRow (_row.begin () - _dis, _row.end () - _dis);
+			return *this;
+		}
 
-	ConstRowIterator  operator++ (int)
-	{
-		ConstRowIterator tmp (*this);
-		++*this;
-		return tmp;
-	}
+		ConstRowIterator  operator-- (int)
+		{
+			ConstRowIterator tmp (*this);
+			--*this;
+			return tmp;
+		}
 
-	ConstRowIterator operator+ (int i)
-		{ return ConstRowIterator (_row.begin () + _dis * i, _row.size (), _dis); }
 
-	ConstRowIterator& operator += (int i)
-	{
-		_row = ConstRow (_row.begin () + _dis * i, _row.end () + _dis * i);
-		return *this;
-	}
+		ConstRowIterator& operator++ ()
+		{
+			_row = ConstRow (_row.begin () + _dis, _row.end () + _dis);
+			return *this;
+		}
 
-	ConstRow operator[] (int i) const
-		{ return ConstRow (_row.begin () + _dis * i, _row.end () + _dis * i); }
+		ConstRowIterator  operator++ (int)
+		{
+			ConstRowIterator tmp (*this);
+			++*this;
+			return tmp;
+		}
+
+		ConstRowIterator operator+ (int i)
+		{
+			return ConstRowIterator (_row.begin () + _dis * i, _row.size (), _dis);
+		}
 
-	ConstRow* operator-> ()
-		{ return &_row; }
+		ConstRowIterator& operator += (int i)
+		{
+			_row = ConstRow (_row.begin () + _dis * i, _row.end () + _dis * i);
+			return *this;
+		}
 
-	ConstRow& operator* ()
-		{ return _row; }
-    
-	bool operator!= (const ConstRowIterator& c) const
-		{ return (_row.begin () != c._row.begin ()) || (_row.end () != c._row.end ()) || (_dis != c._dis); }
+		ConstRow operator[] (int i) const
+		{
+			return ConstRow (_row.begin () + _dis * i, _row.end () + _dis * i);
+		}
 
-    private:
-	ConstRow _row;
-	size_t _dis;
-};
+		ConstRow* operator-> ()
+		{
+			return &_row;
+		}
 
-template <class Element>
-class DenseMatrixBase<Element>::RowIterator
-{
-    public:
-	RowIterator (const typename Rep::iterator& p, size_t len, size_t d)
-		: _row (p, p + len), _dis (d){}
+		ConstRow& operator* ()
+		{
+			return _row;
+		}
+
+		bool operator!= (const ConstRowIterator& c) const
+		{
+			return (_row.begin () != c._row.begin ()) || (_row.end () != c._row.end ()) || (_dis != c._dis);
+		}
+
+	private:
+		ConstRow _row;
+		size_t _dis;
+	};
+
+	/*!  Row Iterator.
+	 * @ingroup iterators
+	 * @brief NO DOC
+	 */
+	template <class Element>
+	class DenseMatrixBase<Element>::RowIterator {
+	public:
+		RowIterator (const typename Rep::iterator& p, size_t len, size_t d) :
+			_row (p, p + len), _dis (d)
+		{}
+
+		RowIterator () {}
+
+		RowIterator (const RowIterator& colp) :
+			_row (colp._row), _dis (colp._dis)
+		{}
+
+		RowIterator& operator = (const RowIterator& colp)
+		{
+			_row = colp._row;
+			_dis = colp._dis;
+			return *this;
+		}
+
+		RowIterator& operator ++ ()
+		{
+			_row = Row (_row.begin () + _dis, _row.end () + _dis);
+			return *this;
+		}
+
+		RowIterator  operator ++ (int)
+		{
+			RowIterator tmp (*this);
+			++*this;
+			return tmp;
+		}
+
+		RowIterator& operator -- ()
+		{
+			_row = Row (_row.begin () - _dis, _row.end () - _dis);
+			return *this;
+		}
+
+		RowIterator  operator -- (int)
+		{
+			RowIterator tmp (*this);
+			--*this;
+			return tmp;
+		}
+
+		RowIterator operator + (int i)
+		{
+			return RowIterator (_row.begin () + _dis * i, _row.size (), _dis);
+		}
+
+		RowIterator& operator += (int i)
+		{
+			_row = Row (_row.begin () + _dis * i, _row.end () + _dis * i);
+			return *this;
+		}
+
+		Row operator[] (int i) const
+		{
+			return Row (const_cast<Row&> (_row).begin () + _dis * i,
+				    const_cast<Row&> (_row).end () + _dis * i);
+		}
+
+		Row* operator-> ()
+		{
+			return &_row;
+		}
+
+		Row& operator* ()
+		{
+			return _row;
+		}
 
-	RowIterator () {}
+		bool operator!= (const RowIterator& c) const
+		{
+			return (_row.begin () != c._row.begin ()) || (_row.end () != c._row.end ()) || (_dis != c._dis);
+		}
+
+		operator ConstRowIterator ()
+		{
+			return ConstRowIterator (_row.begin (), _row.size (), _dis);
+		}
+
+	private:
+		Row _row;
+		size_t _dis;
+	};
+
+	/*! Const Col Iterator.
+	 * @ingroup iterators
+	 * @brief NO DOC
+	 */
+	template <class Element>
+	class DenseMatrixBase<Element>::ConstColIterator {
+	public:
+		ConstColIterator (typename Rep::const_iterator p, size_t stride, size_t len) :
+			_col (Subiterator<typename Rep::const_iterator> (p, stride),
+			      Subiterator<typename Rep::const_iterator> (p + len * stride, stride)),
+			_stride (stride)
+		{}
+
+		ConstColIterator (const ConstCol& col, size_t stride) :
+			_col (col),
+			_stride (stride)
+		{}
+
+		ConstColIterator () {}
+
+		ConstColIterator (const ConstColIterator& rowp) :
+			_col (rowp._col)
+		{}
+
+		ConstColIterator& operator= (const ConstColIterator& rowp)
+		{
+			_col = rowp._col;
+			_stride = rowp._stride;
+			return *this;
+		}
+
+		ConstColIterator& operator++ ()
+		{
+			_col = ConstCol (Subiterator<typename Rep::const_iterator> (_col.begin ().operator-> () + 1, _stride),
+					 Subiterator<typename Rep::const_iterator> (_col.end ().operator-> () + 1, _stride));
+			return *this;
+		}
+
+		ConstColIterator  operator++ (int)
+		{
+			ConstColIterator old(*this);
+			this->operator++ ();
+			return old;
+		}
+
+		ConstColIterator operator + (int i)
+		{
+			return ConstColIterator (_col.begin ().operator-> () + i, _stride, _col.size ());
+		}
+
+		ConstColIterator& operator += (int i)
+		{
+			_col = ConstCol (Subiterator<typename Rep::const_iterator> (_col.begin ().operator-> () + i, _stride),
+					 Subiterator<typename Rep::const_iterator> (_col.end ().operator-> () + i, _stride));
+			return *this;
+		}
+
+		ConstCol operator[] (int i) const
+		{
+			return ConstCol (Subiterator<typename Rep::const_iterator> (_col.begin ().operator-> () + i, _stride),
+					 Subiterator<typename Rep::const_iterator> (_col.end ().operator-> () + i, _stride));
+		}
+
+		ConstCol* operator-> ()
+		{
+			return &_col;
+		}
+
+		ConstCol& operator* ()
+		{
+			return _col;
+		}
+
+		bool operator!= (const ConstColIterator& c) const
+		{
+			return (_col.begin () != c._col.begin ()) || (_col.end () != c._col.end ());
+		}
+
+	private:
+		ConstCol _col;
+		size_t _stride;
+	};
+
+	/*! Col Iterator.
+	 * @ingroup iterators
+	 * @brief NO DOC
+	 */
+	template <class Element>
+	class DenseMatrixBase<Element>::ColIterator {
+	public:
+		ColIterator (typename Rep::iterator p, size_t stride, size_t len) :
+			_col (Subiterator<typename Rep::iterator> (p, stride),
+			      Subiterator<typename Rep::iterator> (p + len * stride, stride)), _stride (stride)
+		{}
+
+		ColIterator () {}
+
+		ColIterator (const ColIterator& rowp) :
+			_col (rowp._col)
+		{}
+
+		ColIterator& operator= (const ColIterator& rowp)
+		{
+			_col = rowp._col;
+			_stride = rowp._stride;
+			return *this;
+		}
+
+		const ColIterator& operator= (const ColIterator& rowp) const
+		{
+			const_cast<ColIterator*> (this)->_col = rowp._col;
+			return *this;
+		}
+
+		ColIterator& operator++ ()
+		{
+			_col = Col (Subiterator<typename Rep::iterator> (_col.begin ().operator-> () + 1, _stride),
+				    Subiterator<typename Rep::iterator> (_col.end ().operator-> () + 1, _stride));
+			return *this;
+		}
+
+		ColIterator  operator++ (int)
+		{
+			Col tmp (_col);
+			this->operator++ ();
+			return tmp;
+		}
+
+		ColIterator operator + (int i)
+		{
+			return ColIterator (_col.begin ().operator-> () + i, _stride, _col.size ());
+		}
+
+		ColIterator& operator += (int i)
+		{
+			_col = Col (Subiterator<typename Rep::iterator> (_col.begin ().operator-> () + i, _stride),
+				    Subiterator<typename Rep::iterator> (_col.end ().operator-> () + i, _stride));
+			return *this;
+		}
+
+		Col operator[] (int i) const
+		{
+			return Col (Subiterator<typename Rep::iterator> (const_cast<Col&> (_col).begin ().operator-> () + i, _stride),
+				    Subiterator<typename Rep::iterator> (const_cast<Col&> (_col).end ().operator-> () + i, _stride));
+		}
+
+		Col* operator-> ()
+		{
+			return &_col;
+		}
+
+		Col& operator* ()
+		{
+			return _col;
+		}
+
+		bool operator!= (const ColIterator& c) const
+		{
+			return (_col.begin () != c._col.begin ()) || (_col.end () != c._col.end ());
+		}
+
+		operator ConstColIterator ()
+		{
+			return ConstColIterator (reinterpret_cast<ConstCol&> (_col) , _stride);
+		}
+
+	private:
+
+		Col _col;
+		size_t _stride;
+	};
+
+	/*!  Raw Indexed Iterator.
+	 * @ingroup iterators
+	 * @brief NO DOC
+	 */
+	template <class Element>
+	class DenseMatrixBase<Element>::RawIndexedIterator {
+		size_t _r_index;
+		size_t _c_index;
+		size_t _dim;
+		typename Rep::iterator _begin;
+
+	public:
+		RawIndexedIterator (const size_t  &dim,
+				    const size_t  &r_index,
+				    const size_t  &c_index,
+				    const typename Rep::iterator &begin) :
+			_r_index (r_index), _c_index (c_index), _dim (dim), _begin (begin)
+		{}
+
+		RawIndexedIterator () :
+			_r_index (0), _c_index (0), _dim (1), _begin (0)
+		{}
+
+		RawIndexedIterator (const RawIndexedIterator& r) :
+			_r_index (r._r_index), _c_index (r._c_index), _dim (r._dim), _begin (r._begin)
+		{}
+
+		RawIndexedIterator& operator = (const RawIndexedIterator &iter)
+		{
+			_r_index = iter._r_index;
+			_c_index = iter._c_index;
+			_dim = iter._dim;
+			_begin = iter._begin;
+			return *this;
+		}
+
+		bool operator == (const RawIndexedIterator &iter) const
+		{
+			return (_r_index == iter._r_index) &&
+			(_c_index == iter._c_index) &&
+			(_dim == iter._dim) &&
+			(_begin==iter._begin);
+		}
+
+		bool operator != (const RawIndexedIterator& iter) const
+		{
+			return (_r_index != iter._r_index) ||
+			(_c_index != iter._c_index) ||
+			(_dim != iter._dim) ||
+			(_begin!=iter._begin);
+		}
+
+		RawIndexedIterator &operator ++ ()
+		{
+			++_c_index;
+
+			if (_c_index == _dim) {
+				_c_index = 0;
+				++_r_index;
+			}
+
+			return *this;
+		}
+
+
+		RawIndexedIterator operator ++ (int)
+		{
+			RawIndexedIterator tmp = *this;
+			++(*this);
+			return tmp;
+		}
+
+		RawIndexedIterator &operator -- ()
+		{
+			if (_c_index)
+				--_c_index;
+			else {
+				--_r_index;
+				_c_index = _dim - 1;
+			}
+
+			return *this;
+		}
+
+
+		RawIndexedIterator operator -- (int)
+		{
+			RawIndexedIterator tmp = *this;
+			--(*this);
+			return tmp;
+		}
+
+		Element &operator * () const
+		{
+			return *(_begin + (_r_index * _dim + _c_index));
+		}
+
+
+		Element* operator -> () const
+		{
+			return _begin + (_r_index * _dim + _c_index);
+		}
+
+
+		size_t rowIndex () const
+		{
+			return _r_index;
+		}
+
+		size_t colIndex () const
+		{
+			return _c_index;
+		}
 
-	RowIterator (const RowIterator& colp)
-		: _row (colp._row), _dis (colp._dis) {}
-    
-	RowIterator& operator = (const RowIterator& colp)
+		const Element &value () const
+		{
+			return *(_begin + (_r_index * _dim + _c_index));
+		}
+
+
+	};
+
+	/*! Const Raw Indexed Iterator.
+	 * @ingroup iterators
+	 * @brief NO DOC
+	 */
+	template <class Element>
+	class DenseMatrixBase<Element>::ConstRawIndexedIterator {
+		size_t _r_index;
+		size_t _c_index;
+		size_t _dim;
+		typedef Element value_type;
+		typename Rep::const_iterator _begin;
+
+	public:
+		ConstRawIndexedIterator (const size_t  &dim,
+					 const size_t  &r_index,
+					 const size_t  &c_index,
+					 const typename Rep::const_iterator &begin) :
+			_r_index (r_index), _c_index (c_index), _dim (dim), _begin (begin)
+		{}
+
+		ConstRawIndexedIterator () :
+			_r_index (0), _c_index (0), _dim (1), _begin (0)
+		{}
+
+		ConstRawIndexedIterator (const ConstRawIndexedIterator& r) :
+			_r_index (r._r_index), _c_index (r._c_index), _dim (r._dim), _begin (r._begin)
+		{}
+
+		ConstRawIndexedIterator& operator = (const ConstRawIndexedIterator &iter)
+		{
+			_r_index = iter._r_index;
+			_c_index = iter._c_index;
+			_dim = iter._dim;
+			_begin = iter._begin;
+			return *this;
+		}
+
+		bool operator == (const ConstRawIndexedIterator &iter) const
+		{
+			return (_r_index == iter._r_index) &&
+			(_c_index == iter._c_index) &&
+			(_dim == iter._dim) &&
+			(_begin==iter._begin);
+		}
+
+		bool operator != (const ConstRawIndexedIterator& iter) const
+		{
+			return (_r_index != iter._r_index) ||
+			(_c_index != iter._c_index) ||
+			(_dim != iter._dim) ||
+			(_begin!=iter._begin);
+		}
+
+		ConstRawIndexedIterator &operator ++ ()
+		{
+			++_c_index;
+
+			if (_c_index == _dim) {
+				_c_index = 0;
+				++_r_index;
+			}
+
+			return *this;
+		}
+
+
+		ConstRawIndexedIterator operator ++ (int)
+		{
+			ConstRawIndexedIterator tmp = *this;
+			++(*this);
+			return tmp;
+		}
+
+		ConstRawIndexedIterator &operator -- ()
+		{
+			if (_c_index)
+				--_c_index;
+			else {
+				--_r_index;
+				_c_index = _dim - 1;
+			}
+
+			return *this;
+		}
+
+
+
+		ConstRawIndexedIterator operator -- (int)
+		{
+			ConstRawIndexedIterator tmp = *this;
+			--(*this);
+			return tmp;
+		}
+
+		const Element &operator * () const
+		{
+			return *(_begin + (_r_index * _dim + _c_index));
+		}
+
+		const Element *operator -> () const
+		{
+			return _begin + (_r_index * _dim + _c_index);
+		}
+
+		size_t rowIndex () const
+		{
+			return _r_index;
+		}
+
+		size_t colIndex () const
+		{
+			return _c_index;
+		}
+
+		const Element &value() const
+		{
+			return *(_begin + (_r_index * _dim + _c_index));
+		}
+	};
+
+	/*  Raw */
+
+	// Entry access raw view.  Size m*n vector in C (row major) order.
+	template <class Element>
+	typename DenseMatrixBase<Element>::RawIterator DenseMatrixBase<Element>::rawBegin ()
 	{
-		_row = colp._row;
-		_dis = colp._dis;
-		return *this;
+		return _rep.begin ();
 	}
-    
-	RowIterator& operator ++ ()
+
+	template <class Element>
+	typename DenseMatrixBase<Element>::RawIterator DenseMatrixBase<Element>::rawEnd ()
 	{
-		_row = Row (_row.begin () + _dis, _row.end () + _dis);
-		return *this;
+		return _rep.end ();
 	}
-    
-	RowIterator  operator ++ (int)
+
+	template <class Element>
+	typename DenseMatrixBase<Element>::ConstRawIterator DenseMatrixBase<Element>::rawBegin () const
 	{
-		RowIterator tmp (*this);
-		++*this;
-		return tmp;
+		return _rep.begin ();
 	}
-    
-        RowIterator& operator -- ()
-        {
-                _row = Row (_row.begin () - _dis, _row.end () - _dis);
-                return *this;
-        }
-
-        RowIterator  operator -- (int)
-        {
-                RowIterator tmp (*this);
-                --*this;
-                return tmp;
-        }
-
-	RowIterator operator + (int i)
-		{ return RowIterator (_row.begin () + _dis * i, _row.size (), _dis); }
-
-	RowIterator& operator += (int i)
+
+	template <class Element>
+	typename DenseMatrixBase<Element>::ConstRawIterator DenseMatrixBase<Element>::rawEnd () const
 	{
-		_row = Row (_row.begin () + _dis * i, _row.end () + _dis * i);
-		return *this;
+		return _rep.end ();
 	}
 
-	Row operator[] (int i) const
-		{ return Row (const_cast<Row&> (_row).begin () + _dis * i,
-			      const_cast<Row&> (_row).end () + _dis * i); }
-
-	Row* operator-> ()
-		{ return &_row; }
-    
-	Row& operator* ()
-		{ return _row; }
- 
-	bool operator!= (const RowIterator& c) const
-		{ return (_row.begin () != c._row.begin ()) || (_row.end () != c._row.end ()) || (_dis != c._dis); }
-
-	operator ConstRowIterator ()
-		{ return ConstRowIterator (_row.begin (), _row.size (), _dis); }
-
-    private:
-	Row _row;
-	size_t _dis;
-};
-
-template <class Element>
-class DenseMatrixBase<Element>::ConstColIterator
-{
-    public:
-	ConstColIterator (typename Rep::const_iterator p, size_t stride, size_t len)
-		: _col (Subiterator<typename Rep::const_iterator> (p, stride),
-			Subiterator<typename Rep::const_iterator> (p + len * stride, stride)), _stride (stride)
-	{}
-    
-	ConstColIterator (const ConstCol& col, size_t stride)
-		:_col (col), _stride (stride){}
-
-	ConstColIterator () {}
-    
-	ConstColIterator (const ConstColIterator& rowp)
-		:_col (rowp._col){}
-
-	ConstColIterator& operator= (const ConstColIterator& rowp)
+	/*  Raw Indexed  */
+
+	template <class Element>
+	typename DenseMatrixBase<Element>::RawIndexedIterator DenseMatrixBase<Element>::rawIndexedBegin ()
 	{
-		_col = rowp._col;
-		_stride = rowp._stride;
-		return *this;
+		return RawIndexedIterator (coldim (), 0, 0, _rep.begin ());
 	}
 
-	ConstColIterator& operator++ ()
+	template <class Element>
+	typename DenseMatrixBase<Element>::RawIndexedIterator DenseMatrixBase<Element>::rawIndexedEnd ()
 	{
-		_col = ConstCol (Subiterator<typename Rep::const_iterator> (_col.begin ().operator-> () + 1, _stride),
-				 Subiterator<typename Rep::const_iterator> (_col.end ().operator-> () + 1, _stride));
-		return *this;
+		return RawIndexedIterator (coldim (), rowdim (), 0, _rep.begin ());
 	}
 
-	ConstColIterator  operator++ (int)
+	template <class Element>
+	typename DenseMatrixBase<Element>::ConstRawIndexedIterator DenseMatrixBase<Element>::rawIndexedBegin () const
 	{
-		ConstColIterator old(*this);
-		this->operator++ ();
-		return old;
+		return ConstRawIndexedIterator (coldim (), 0, 0, _rep.begin ());
 	}
 
-	ConstColIterator operator + (int i)
-		{ return ConstColIterator (_col.begin ().operator-> () + i, _stride, _col.size ()); }
+	template <class Element>
+	typename DenseMatrixBase<Element>::ConstRawIndexedIterator DenseMatrixBase<Element>::rawIndexedEnd () const
+	{
+		return ConstRawIndexedIterator (coldim (), rowdim (), 0, _rep.begin ());
+	}
+
+	/*  Row  */
 
-	ConstColIterator& operator += (int i)
+	template <class Element>
+	typename DenseMatrixBase<Element>::RowIterator DenseMatrixBase<Element>::rowBegin ()
 	{
-		_col = ConstCol (Subiterator<typename Rep::const_iterator> (_col.begin ().operator-> () + i, _stride),
-				 Subiterator<typename Rep::const_iterator> (_col.end ().operator-> () + i, _stride));
-		return *this;
+		return RowIterator (_rep.begin (), _cols, _cols);
 	}
 
-	ConstCol operator[] (int i) const
-		{ return ConstCol (Subiterator<typename Rep::const_iterator> (_col.begin ().operator-> () + i, _stride), 
-				   Subiterator<typename Rep::const_iterator> (_col.end ().operator-> () + i, _stride)); }
-
-	ConstCol* operator-> ()
-		{ return &_col; }
- 
-	ConstCol& operator* ()
-		{ return _col; }
-    
-	bool operator!= (const ConstColIterator& c) const
-		{ return (_col.begin () != c._col.begin ()) || (_col.end () != c._col.end ()); }
-    
-    private:
-	ConstCol _col;
-	size_t _stride;
-};
-
-template <class Element>
-class DenseMatrixBase<Element>::ColIterator
-{
-    public:
-	ColIterator (typename Rep::iterator p, size_t stride, size_t len)
-		: _col (Subiterator<typename Rep::iterator> (p, stride),
-			Subiterator<typename Rep::iterator> (p + len * stride, stride)), _stride (stride)
-	{}
-    
-	ColIterator () {}
-    
-	ColIterator (const ColIterator& rowp)
-		:_col (rowp._col){}
-    
-	ColIterator& operator= (const ColIterator& rowp)
+	template <class Element>
+	typename DenseMatrixBase<Element>::RowIterator DenseMatrixBase<Element>::rowEnd ()
 	{
-		_col = rowp._col;
-		_stride = rowp._stride;
-		return *this;
+		return RowIterator (_rep.end (), _cols, _cols);
 	}
-    
-	const ColIterator& operator= (const ColIterator& rowp) const
+
+	template <class Element>
+	typename DenseMatrixBase<Element>::ConstRowIterator DenseMatrixBase<Element>::rowBegin () const
 	{
-		const_cast<ColIterator*> (this)->_col = rowp._col;
-		return *this;
+		return ConstRowIterator (_rep.begin (), _cols, _cols);
 	}
-    
-	ColIterator& operator++ ()
+
+	template <class Element>
+	typename DenseMatrixBase<Element>::ConstRowIterator DenseMatrixBase<Element>::rowEnd () const
 	{
-		_col = Col (Subiterator<typename Rep::iterator> (_col.begin ().operator-> () + 1, _stride),
-			    Subiterator<typename Rep::iterator> (_col.end ().operator-> () + 1, _stride));
-		return *this;
+		return ConstRowIterator (_rep.end (), _cols, _cols);
 	}
-    
-	ColIterator  operator++ (int)
+
+	/*  Col */
+
+	template <class Element>
+	typename DenseMatrixBase<Element>::ColIterator DenseMatrixBase<Element>::colBegin ()
+	{
+		return  typename DenseMatrixBase<Element>::ColIterator (_rep.begin (), _cols, _rows);
+	}
+
+	template <class Element>
+	typename DenseMatrixBase<Element>::ColIterator DenseMatrixBase<Element>::colEnd ()
 	{
-		Col tmp (_col);
-		this->operator++ ();
-		return tmp;
+		return  typename DenseMatrixBase<Element>::ColIterator (_rep.begin ()+_cols, _cols, _rows);
 	}
-        
-	ColIterator operator + (int i)
-		{ return ColIterator (_col.begin ().operator-> () + i, _stride, _col.size ()); }
 
-	ColIterator& operator += (int i)
+	template <class Element>
+	typename DenseMatrixBase<Element>::ConstColIterator DenseMatrixBase<Element>::colBegin () const
 	{
-		_col = Col (Subiterator<typename Rep::iterator> (_col.begin ().operator-> () + i, _stride),
-			    Subiterator<typename Rep::iterator> (_col.end ().operator-> () + i, _stride));
-		return *this;
+		return  typename DenseMatrixBase<Element>::ConstColIterator (_rep.begin (), _cols, _rows);
 	}
 
-	Col operator[] (int i) const
-		{ return Col (Subiterator<typename Rep::iterator> (const_cast<Col&> (_col).begin ().operator-> () + i, _stride), 
-			      Subiterator<typename Rep::iterator> (const_cast<Col&> (_col).end ().operator-> () + i, _stride)); }
+	template <class Element>
+	typename DenseMatrixBase<Element>::ConstColIterator DenseMatrixBase<Element>::colEnd () const
+	{
+		return  typename DenseMatrixBase<Element>::ConstColIterator (_rep.begin ()+_cols, _cols, _rows);
+	}
 
-	Col* operator-> ()
-		{ return &_col; }
 
-	Col& operator* ()
-		{ return _col; }
+	/* read/write */
 
-	bool operator!= (const ColIterator& c) const
-		{ return (_col.begin () != c._col.begin ()) || (_col.end () != c._col.end ()); }
-   
-	operator ConstColIterator ()
+	template <class Element>
+	template <class Field>
+	std::istream &DenseMatrixBase<Element>::read (std::istream &file, const Field &F)
 	{
-            return ConstColIterator (reinterpret_cast<ConstCol&> (_col) , _stride);
-	}
+#if 0
+		RawIterator p;
+		int m,n;
+		char c;
+		file>>m>>n>>c;
+
+		if (m*n < _rows*_cols)
+			cerr<<"NOT ENOUGH ELEMENT TO READ\n";
+		else {
+			for (p = rawBegin (); p != rawEnd (); ++p) {
+				integer tmp;
+				file>>tmp;cout<<tmp<<endl;
+				//file.ignore(1);
+				F.read (file, *p);
+			}
+		}
+#endif
 
-    private:
 
-	Col _col;
-	size_t _stride;
-};
+		RawIterator p;
+		int m,n;
+		char c;
+		file>>m>>n>>c;
+		_rows = m; _cols = n;
 
-template <class _Element>
-template <class Field>
-DenseMatrixBase<_Element>::DenseMatrixBase( MatrixStream<Field>& ms )
-	:_rep(0), _rows(0), _cols(0), _ptr(NULL)
-{
-	if( !ms.getArray(_rep) || !ms.getRows(_rows) || !ms.getColumns(_cols) )
-		throw ms.reportError(__FUNCTION__,__LINE__);
-	_ptr = &_rep[0];
-}
-
-/// entry access raw view.  Size m*n vector in C (row major) order.
-template <class Element>
-typename DenseMatrixBase<Element>::RawIterator DenseMatrixBase<Element>::rawBegin ()
-	{ return _rep.begin (); }  
-
-template <class Element>
-typename DenseMatrixBase<Element>::RawIterator DenseMatrixBase<Element>::rawEnd ()
-	{ return _rep.end (); }
-  
-template <class Element>
-typename DenseMatrixBase<Element>::ConstRawIterator DenseMatrixBase<Element>::rawBegin () const
-	{ return _rep.begin (); }  
-
-template <class Element>
-typename DenseMatrixBase<Element>::ConstRawIterator DenseMatrixBase<Element>::rawEnd () const
-	{ return _rep.end (); }
-
-template <class Element>
-typename DenseMatrixBase<Element>::RowIterator DenseMatrixBase<Element>::rowBegin ()
-	{ return RowIterator (_rep.begin (), _cols, _cols); }
-
-template <class Element>
-typename DenseMatrixBase<Element>::RowIterator DenseMatrixBase<Element>::rowEnd ()
-	{ return RowIterator (_rep.end (), _cols, _cols); }
-  
-template <class Element>
-typename DenseMatrixBase<Element>::ConstRowIterator DenseMatrixBase<Element>::rowBegin () const
-	{ return ConstRowIterator (_rep.begin (), _cols, _cols); }  
-
-template <class Element>
-typename DenseMatrixBase<Element>::ConstRowIterator DenseMatrixBase<Element>::rowEnd () const
-	{return ConstRowIterator (_rep.end (), _cols, _cols); }
-  
-template <class Element>
-typename DenseMatrixBase<Element>::ColIterator DenseMatrixBase<Element>::colBegin ()
-	{ return  typename DenseMatrixBase<Element>::ColIterator (_rep.begin (), _cols, _rows); }
-
-template <class Element>
-typename DenseMatrixBase<Element>::ColIterator DenseMatrixBase<Element>::colEnd ()
-	{ return  typename DenseMatrixBase<Element>::ColIterator (_rep.begin ()+_cols, _cols, _rows); }
-  
-template <class Element>
-typename DenseMatrixBase<Element>::ConstColIterator DenseMatrixBase<Element>::colBegin () const
-	{ return  typename DenseMatrixBase<Element>::ConstColIterator (_rep.begin (), _cols, _rows); }
-  
-template <class Element>
-typename DenseMatrixBase<Element>::ConstColIterator DenseMatrixBase<Element>::colEnd () const
-	{ return  typename DenseMatrixBase<Element>::ConstColIterator (_rep.begin ()+_cols, _cols, _rows); }
-
-template <class Element>
-template <class Field>
-std::istream &DenseMatrixBase<Element>::read (std::istream &file, const Field &F)
-{
-//  	RawIterator p;
-//  	int m,n; 
-//  	char c;
-//  	file>>m>>n>>c;
-	
-//  	if (m*n < _rows*_cols)
-//  		cerr<<"NOT ENOUGH ELEMENT TO READ\n";
-// 	else {
-//  		for (p = rawBegin (); p != rawEnd (); ++p) {	
-// 			integer tmp;
-// 			file>>tmp;cout<<tmp<<endl;
-//  			//file.ignore(1); 	
-// 			F.read (file, *p);
-//  		}
-//  	}
-
-
-  	RawIterator p;
-  	int m,n; 
-  	char c;
-	file>>m>>n>>c;
-  	_rows = m; _cols = n; 
-
-	Element zero;
-	F.init(zero,0UL);
-	_rep.resize(_rows * _cols, zero);
-	_ptr= &_rep[0];
-	 	
-	if ((c != 'M') && (c != 'm'))
- 	 	for (p = rawBegin (); p != rawEnd (); ++p) 
-			{	
+		Element zero;
+		F.init(zero,0UL);
+		_rep.resize(_rows * _cols, zero);
+		_ptr= &_rep[0];
+
+		if ((c != 'M') && (c != 'm'))
+			for (p = rawBegin (); p != rawEnd (); ++p)
+			{
 				//file.ignore(1);
 				F.read (file, *p);
 			}
 
-	else { // sparse file format - needs fixing
-		int i, j;
-		while (true)
-			{	
+		else { // sparse file format - needs fixing
+			int i, j;
+			while (true)
+			{
 				file >> i >> j;
 				//file.ignore(1);
 				//if (! file) break;
 				if (i+j <= 0) break;
-				F.read (file, _rep[_cols*(i-1) + j-1]);			
+				F.read (file, _rep[_cols*(i-1) + j-1]);
 			}
-	}
-	
-	return file;	
-}
-  
-template <class Element>
-template <class Field>
-std::ostream& DenseMatrixBase<Element>::write (std::ostream &os, const Field &F) const
-{
-
-	integer c;
-	int wid;
-
-	ConstRowIterator p;
-
-
-
-	F.cardinality (c);
-
-	if (c >0)
-		wid = (int) ceil (log ((double) c) / M_LN10);
-	else {
-		integer tmp;
-		size_t max=0;
-		ConstRawIterator it = rawBegin();
-		for (; it != rawEnd(); ++it){
-			F.convert(tmp,*it);
-			if (tmp.bitsize() > max)
-				max= tmp.bitsize();
-		}
-		wid= (int) ceil ((double)max / M_LN10)+1; 
-	}
-
-	for (p = rowBegin (); p != rowEnd (); ++p) {
-		typename ConstRow::const_iterator pe;
-
-		os << "  [ ";
-
-		for (pe = p->begin (); pe != p->end (); ++pe) {
-			os.width (wid);
-			F.write (os, *pe);
-			os << " ";
 		}
 
-		os << "]" << std::endl;
+		return file;
 	}
 
-	return os;
-}
-
-template <class Element>
-class DenseMatrixBase<Element>::RawIndexedIterator
-{
-        size_t _r_index;
-	size_t _c_index;
-	size_t _dim;
-	typename Rep::iterator _begin;
-
-public:
-	RawIndexedIterator (const size_t  &dim,
-			    const size_t  &r_index,
-			    const size_t  &c_index,
-			    const typename Rep::iterator &begin)
-		: _r_index (r_index), _c_index (c_index), _dim (dim), _begin (begin)
-	{}
-	
-	RawIndexedIterator ():_r_index (0), _c_index (0), _dim (1), _begin (0){}
-
-	RawIndexedIterator (const RawIndexedIterator& r)
-		: _r_index (r._r_index), _c_index (r._c_index), _dim (r._dim), _begin (r._begin)
-	{}
-
-	RawIndexedIterator& operator = (const RawIndexedIterator &iter)
+	template <class Element>
+	template <class Field>
+	std::ostream& DenseMatrixBase<Element>::write (std::ostream &os, const Field &F,
+						       bool mapleFormat) const
 	{
-		_r_index = iter._r_index;
-		_c_index = iter._c_index;
-		_dim = iter._dim;
-		_begin = iter._begin;
-		return *this;
-	}
-	
-	bool operator == (const RawIndexedIterator &iter) const
-		{ return (_r_index == iter._r_index) &&
-			  (_c_index == iter._c_index) &&
-			  (_dim == iter._dim) &&
-			  (_begin==iter._begin); }
-
-	bool operator != (const RawIndexedIterator& iter) const
-		{ return (_r_index != iter._r_index) ||
-			  (_c_index != iter._c_index) ||
-			  (_dim != iter._dim) ||
-			  (_begin!=iter._begin); }
-	
-	RawIndexedIterator &operator ++ ()
-	{
-		++_c_index;
 
-		if (_c_index == _dim) {
-			_c_index = 0;
-			++_r_index;
-		}
+		ConstRowIterator p;
 
-		return *this;
-	}
+		if (!mapleFormat) {
+			integer c;
+			int wid;
 
-	
-	RawIndexedIterator operator ++ (int)
-	{
-		RawIndexedIterator tmp = *this;
-		++(*this);
-		return tmp;
-	}
 
-	RawIndexedIterator &operator -- ()
-	{ 
-		if (_c_index)
-			--_c_index;
-		else {
-			--_r_index;
-			_c_index = _dim - 1;
-		}
-
-		return *this;
-	}
 
 
-	RawIndexedIterator operator -- (int) 
-	{
-		RawIndexedIterator tmp = *this;
-		--(*this);
-		return tmp;
-	}	
+			F.cardinality (c);
 
-	Element &operator * () const
-		{ return *(_begin + (_r_index * _dim + _c_index)); }
+			if (c >0)
+				wid = (int) ceil (log ((double) c) / M_LN10);
+			else {
+				integer tmp;
+				size_t max=0;
+				ConstRawIterator it = rawBegin();
+				for (; it != rawEnd(); ++it){
+					F.convert(tmp,*it);
+					if (tmp.bitsize() > max)
+						max= tmp.bitsize();
+				}
+				wid= (int) ceil ((double)max / M_LN10)+1;
+			}
 
-	
-	Element* operator -> () const
-		{ return _begin + (_r_index * _dim + _c_index); }
-	
+			for (p = rowBegin (); p != rowEnd ();++p) {
+				typename ConstRow::const_iterator pe;
 
-	size_t rowIndex () const
-		{ return _r_index; }
+				os << "  [ ";
 
-	size_t colIndex () const
-	{ return _c_index; }
-};
+				for (pe = p->begin (); pe != p->end (); ++pe) {
+					os.width (wid);
+					F.write (os, *pe);
+					os << " ";
+				}
 
-template <class Element>
-typename DenseMatrixBase<Element>::RawIndexedIterator DenseMatrixBase<Element>::rawIndexedBegin () 
-{
-	return RawIndexedIterator (coldim (), 0, 0, _rep.begin ());
-}
+				os << "]" << std::endl;
+			}
+		}
+		else {
 
-template <class Element>
-typename DenseMatrixBase<Element>::RawIndexedIterator DenseMatrixBase<Element>::rawIndexedEnd ()
-{
-	return RawIndexedIterator (coldim (), rowdim (), 0, _rep.begin ());
-}
+			os << "Matrix( " << rowdim() << ',' << coldim() << ",[" ;
+			for (p = rowBegin (); p != rowEnd (); ) {
+				typename ConstRow::const_iterator pe;
 
+				os << " [ ";
 
+				for (pe = p->begin (); pe != p->end (); ) {
+					F.write (os, *pe);
+					++pe ;
+					if (pe != p->end())
+						os << ", ";
+				}
 
-template <class Element>
-class DenseMatrixBase<Element>::ConstRawIndexedIterator
-{
-	size_t _r_index;
-	size_t _c_index;
-	size_t _dim;
-	typename Rep::const_iterator _begin;
-
-    public:
-	ConstRawIndexedIterator (const size_t  &dim,
-			    const size_t  &r_index,
-			    const size_t  &c_index,
-			    const typename Rep::const_iterator &begin)
-		: _r_index (r_index), _c_index (c_index), _dim (dim), _begin (begin)
-	{}
-	
-	ConstRawIndexedIterator ():_r_index (0), _c_index (0), _dim (1), _begin (0){}
-
-	ConstRawIndexedIterator (const ConstRawIndexedIterator& r)
-		: _r_index (r._r_index), _c_index (r._c_index), _dim (r._dim), _begin (r._begin)
-	{}
-
-	ConstRawIndexedIterator& operator = (const ConstRawIndexedIterator &iter)
-	{
-		_r_index = iter._r_index;
-		_c_index = iter._c_index;
-		_dim = iter._dim;
-		_begin = iter._begin;
-		return *this;
-	}
-	
-	bool operator == (const ConstRawIndexedIterator &iter) const
-		{ return (_r_index == iter._r_index) &&
-			  (_c_index == iter._c_index) &&
-			  (_dim == iter._dim) &&
-			  (_begin==iter._begin); }
-
-	bool operator != (const ConstRawIndexedIterator& iter) const
-		{ return (_r_index != iter._r_index) ||
-			  (_c_index != iter._c_index) ||
-			  (_dim != iter._dim) ||
-			  (_begin!=iter._begin); }
-	
-	ConstRawIndexedIterator &operator ++ ()
-	{
-		++_c_index;
+				os << "]" ;
+				++p ;
+			if (p != rowEnd() )
+				os << ',' << std::endl;;
 
-		if (_c_index == _dim) {
-			_c_index = 0;
-			++_r_index;
+			}
+			os << "])" ;
 		}
-
-		return *this;
+		return os;
 	}
 
-	
-	ConstRawIndexedIterator operator ++ (int) 
+	template <class Element>
+	std::ostream& DenseMatrixBase<Element>::write (std::ostream &os,
+						       bool mapleFormat) const
 	{
-		ConstRawIndexedIterator tmp = *this;
-		++(*this);
-		return tmp;
-	}
 
-	ConstRawIndexedIterator &operator -- ()
-	{ 
-		if (_c_index)
-			--_c_index;
-		else {
-			--_r_index;
-			_c_index = _dim - 1;
-		}
+		ConstRowIterator p;
+		if (!mapleFormat) {
+			integer c;
+			int wid;
 
-		return *this;
-	}
 
 
 
-	ConstRawIndexedIterator operator -- (int) 
-	{
-		ConstRawIndexedIterator tmp = *this;
-		--(*this);
-		return tmp;
-	}	
+			integer tmp;
+			size_t max=0;
+			ConstRawIterator it = rawBegin();
+			for (; it != rawEnd(); ++it){
+				tmp = (integer) *it;
+				if (tmp.bitsize() > max)
+					max= tmp.bitsize();
+			}
+			wid= (int) ceil ((double)max / M_LN10)+1;
 
-	const Element &operator * () const
-		{ return *(_begin + (_r_index * _dim + _c_index)); }
+			for (p = rowBegin (); p != rowEnd (); ++p) {
+				typename ConstRow::const_iterator pe;
 
-	const Element *operator -> () const
-		{ return _begin + (_r_index * _dim + _c_index); }
+				os << "  [ ";
 
-	size_t rowIndex () const
-		{ return _r_index; }
+				for (pe = p->begin (); pe != p->end (); ++pe) {
+					os.width (wid);
+					os << *pe;
+					os << " ";
+				}
 
-	size_t colIndex () const
-		{ return _c_index; }
-};
+				os << "]" << std::endl;
+			}
+		}
+		else {
 
+			os << "Matrix( " << rowdim() << ',' << coldim() << ",[" ;
+			for (p = rowBegin (); p != rowEnd (); ) {
+				typename ConstRow::const_iterator pe;
 
+				os << " [ ";
 
-template <class Element>
-typename DenseMatrixBase<Element>::ConstRawIndexedIterator DenseMatrixBase<Element>::rawIndexedBegin () const
-{
-	return ConstRawIndexedIterator (coldim (), 0, 0, _rep.begin ());
-}
+				for (pe = p->begin (); pe != p->end (); ) {
+					os << *pe;
+					++pe ;
+					if (pe != p->end())
+						os << ", ";
+				}
+
+				os << "]" ;
+				++p ;
+				if (p != rowEnd() )
+					os << ',' << std::endl;
+			}
+			os << "])" ;
+		}
+
+		return os;
+	}
 
-template <class Element>
-typename DenseMatrixBase<Element>::ConstRawIndexedIterator DenseMatrixBase<Element>::rawIndexedEnd () const
-{
-	return ConstRawIndexedIterator (coldim (), rowdim (), 0, _rep.begin ());
-}
 
 } // namespace LinBox
 
-#endif // __MATRIX_DENSE_INL
+#endif // __LINBOX_matrix_dense_INL
+
diff --git a/linbox/matrix/factorized-matrix.h b/linbox/matrix/factorized-matrix.h
index ff9cf84..f2494bd 100644
--- a/linbox/matrix/factorized-matrix.h
+++ b/linbox/matrix/factorized-matrix.h
@@ -1,10 +1,11 @@
 /* -*- 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
 /* linbox/matrix/factorized-matrix.h
- * Copyright (C) 2004 Pascal Giorgi, Clément Pernet
+ * Copyright (C) 2004 Pascal Giorgi, Clément Pernet
  *
  * Written by :
  *               Pascal Giorgi  pascal.giorgi at ens-lyon.fr
- *               Clément Pernet clement.pernet at imag.fr
+ *               Clément Pernet clement.pernet at imag.fr
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -23,101 +24,120 @@
  */
 
 
-#ifndef __FACTORIZED_MATRIX_H
-#define __FACTORIZED_MATRIX_H
+#ifndef __LINBOX_factorized_matrix_H
+#define __LINBOX_factorized_matrix_H
+
+#if 0
 #undef _P
 #undef _Q
+#endif
 
 #include <vector>
 
 #include <linbox/matrix/blas-matrix.h>
 #include <linbox/blackbox/blas-blackbox.h>
 #include <linbox/algorithms/blas-domain.h>
-#include <linbox/ffpack/ffpack.h>
+#include <fflas-ffpack/ffpack/ffpack.h>
 
-namespace LinBox{
+#include "linbox/matrix/matrix-permutation.h"
 
-/** @name Factorized Matrix
- * @brief Solving using blas and LU style factored matrix.
- */
-//@{
+namespace LinBox
+{
 
+	/*- @name Factorized Matrix
+	 * @brief Solving using blas and LU style factored matrix.
+	 */
+	//-{
+
+	// forward definition
 	template <class Field>
 	class LQUPMatrix;
 
-	/// 
-	template <class Field, class Operand> 
+	/// @internal
+	template <class Field, class Operand>
 	class FactorizedMatrixLeftSolve {
 	public:
-		Operand& operator() ( const Field& F, 
-				      const LQUPMatrix<Field>& A, 
+		Operand& operator() ( const Field& F,
+				      const LQUPMatrix<Field>& A,
 				      Operand& X, const Operand& B ) const;
 		Operand& operator() ( const Field& F,
-				      const LQUPMatrix<Field>& A, 
+				      const LQUPMatrix<Field>& A,
 				      Operand& B ) const;
 	}; // end of class FactorizedMatrixLeftSolve
 
-	/// 
-	template <class Field, class Operand> 
+	/// @internal
+	template <class Field, class Operand>
 	class FactorizedMatrixRightSolve {
 	public:
-		Operand& operator() ( const Field& F, 
-				      const LQUPMatrix<Field>& A, 
+		Operand& operator() ( const Field& F,
+				      const LQUPMatrix<Field>& A,
 				      Operand& X, const Operand& B ) const;
-		Operand& operator() ( const Field& F, 
-				      const LQUPMatrix<Field>& A, 
+		Operand& operator() ( const Field& F,
+				      const LQUPMatrix<Field>& A,
 				      Operand& B ) const;
 	}; // end of class FactorizedMatrixRightSolve
 
-	///
-	template <class Field, class Operand> 
+	/// @internal
+	template <class Field, class Operand>
 	class FactorizedMatrixLeftLSolve {
 	public:
-		Operand& operator() ( const Field& F, 
+		Operand& operator() ( const Field& F,
 				      const LQUPMatrix<Field>& A,
 				      Operand& X, const Operand& B ) const;
-		Operand& operator() ( const Field& F, 
+		Operand& operator() ( const Field& F,
 				      const LQUPMatrix<Field>& A,
 				      Operand& B ) const;
 	}; // end of class FactorizedMatrixLeftLSolve
 
-	///
-	template <class Field, class Operand> 
+	/// @internal
+	template <class Field, class Operand>
 	class FactorizedMatrixRightLSolve {
 	public:
-		Operand& operator() ( const Field& F, 
+		Operand& operator() ( const Field& F,
 				      const LQUPMatrix<Field>& A,
 				      Operand& X, const Operand& B ) const;
-		Operand& operator() ( const Field& F, 
+		Operand& operator() ( const Field& F,
 				      const LQUPMatrix<Field>& A,
 				      Operand& B ) const;
 	}; // end of class FactorizedMatrixRightLsolve
 
-	///
-	template <class Field, class Operand> 
+	/// @internal
+	template <class Field, class Operand>
 	class FactorizedMatrixLeftUSolve {
 	public:
-		Operand& operator() ( const Field& F, 
+		Operand& operator() ( const Field& F,
 				      const LQUPMatrix<Field>& A,
 				      Operand& X, const Operand& B ) const;
-		Operand& operator() ( const Field& F, 
+		Operand& operator() ( const Field& F,
 				      const LQUPMatrix<Field>& A,
 				      Operand& B ) const;
 	}; // end of class FactorizedMatrixLeftUSolve
 
-	///
-	template <class Field, class Operand> 
+	/// @internal
+	template <class Field, class Operand>
 	class FactorizedMatrixRightUSolve {
 	public:
-		Operand& operator() ( const Field& F, 
+		Operand& operator() ( const Field& F,
 				      const LQUPMatrix<Field>& A,
 				      Operand& X, const Operand& B ) const;
-		Operand& operator() ( const Field& F, 
+		Operand& operator() ( const Field& F,
 				      const LQUPMatrix<Field>& A,
 				      Operand& B ) const;
 	}; // end of class FactorizedMatrixRightUSolve
-	
-	///
+
+	/*! LQUP factorisation.
+	 * This is a class to ease the use LU factorisation (see \ref LUdivine
+	 * in \ref FFPACK)
+	 *
+	 * The factorisation is \f$ A = L Q U P \f$ with \c L lower unit
+	 * triangular, \c U upper non-unit triangular, \c P and \c Q
+	 * permutations.
+	 *
+	 * There are two kind of contructors (with and without permutations)
+	 * and they build a LQUP factorisation of a BlasMatrix/BlasBlackbox on
+	 * a finite field.  There are methods for retrieving L,Q,U and P
+	 * matrices and methods for solving systems.
+	 */
 	template <class Field>
 	class LQUPMatrix {
 
@@ -127,114 +147,296 @@ namespace LinBox{
 
 	protected:
 
-		Field                   _F;
-		BlasMatrix<Element>    &_LU;
-		BlasPermutation         _P;
-		BlasPermutation         _Q;  //note: this is actually Qt! 
-		size_t                  _m;
-		size_t                  _n;
-		size_t               _rank;
-		bool                 _alloc;
-    
+		Field                     _F;
+		BlasMatrix<Element>     &_LU;
+		BlasPermutation<size_t> &_PP;
+		BlasPermutation<size_t> &_QQ;  //note: this is actually Qt!
+		size_t                    _m;
+		size_t                    _n;
+		size_t                 _rank;
+		bool                  _alloc;
+		bool                  _plloc;
+
 	public:
 
+#if 1
+		//! Contruction of LQUP factorization of A (making a copy of A)
+		LQUPMatrix (const Field& F, const BlasMatrix<Element>& A) :
+			_F(F), _LU(*(new BlasMatrix<Element> (A))) ,
+			_PP(*(new BlasPermutation<size_t>(A.coldim()))),
+			_QQ(*(new BlasPermutation<size_t>(A.rowdim()))),
+			_m(A.rowdim()), _n(A.coldim()),
+			_alloc(true),_plloc(true)
+		{
+			//std::cerr<<"Je passe par le constructeur const"<<std::endl;
 
-		// Contruction of LQUP factorization of A (making a copy of A)
-		LQUPMatrix (const Field& F, const BlasMatrix<Element>& A)
-			: _F(F), _LU(*(new BlasMatrix<Element> (A))) ,
-			  _P(A.coldim()), _Q(A.rowdim()), _m(A.rowdim()),
-			  _n(A.coldim()), _alloc(true)  {
+			_rank= FFPACK::LUdivine( _F,FFLAS::FflasNonUnit,  FFLAS::FflasNoTrans, _m, _n,
+						 _LU.getPointer(),_LU.getStride(),
+						 _PP.getWritePointer(), _QQ.getWritePointer(), FFPACK::FfpackLQUP );
+			_PP.setOrder(_rank);
+			_QQ.setOrder(_rank);
+
+		}
+
+		//! Contruction of LQUP factorization of A (in-place in A)
+		LQUPMatrix (const Field& F, BlasMatrix<Element>& A) :
+			_F(F), _LU(A) ,
+			_PP(*(new BlasPermutation<size_t>(A.coldim()))),
+			_QQ(*(new BlasPermutation<size_t>(A.rowdim()))),
+			_m(A.rowdim()), _n(A.coldim()),
+			_alloc(false),_plloc(true)
+		{
+			//std::cerr<<"Je passe par le constructeur non const"<<std::endl;
+			_rank= FFPACK::LUdivine( _F,FFLAS::FflasNonUnit, FFLAS::FflasNoTrans, _m, _n,
+						 _LU.getPointer(),_LU.getStride(),
+						 _PP.getWritePointer(), _QQ.getWritePointer(), FFPACK::FfpackLQUP );
+			_PP.setOrder(_rank);
+			_QQ.setOrder(_rank);
+
+		}
+
+		//! Contruction of LQUP factorization of A (making a copy of A)
+		LQUPMatrix (const BlasBlackbox<Field>& A) :
+			_F(A.field()), _LU(*(new BlasMatrix<Element> (A))) ,
+			_PP(*(new BlasPermutation<size_t>(A.coldim()))),
+			_QQ(*(new BlasPermutation<size_t>(A.rowdim()))),
+			_m(A.rowdim()), _n(A.coldim()),
+			_alloc(true),_plloc(true)
+		{
+
+			_rank= FFPACK::LUdivine( _F,FFLAS::FflasNonUnit,  FFLAS::FflasNoTrans,  _m, _n,
+						 _LU.getPointer(),_LU.getStride(),
+						 _PP.getWritePointer(), _QQ.getWritePointer(), FFPACK::FfpackLQUP );
+			_PP.setOrder(_rank);
+			_QQ.setOrder(_rank);
+
+		}
+
+		//! Contruction of LQUP factorization of A (in-place in A)
+		LQUPMatrix (BlasBlackbox<Field>& A) :
+			_F(A.field()), _LU(static_cast<BlasMatrix<Element>&> (A)) ,
+			_PP(*(new BlasPermutation<size_t>(A.coldim()))),
+			_QQ(*(new BlasPermutation<size_t>(A.rowdim()))),
+			_PP(A.coldim()), _QQ(A.rowdim()),
+			_m(A.rowdim()), _n(A.coldim()),
+			_alloc(false),_plloc(true)
+		{
+
+			_rank= FFPACK::LUdivine( _F,FFLAS::FflasNonUnit,  FFLAS::FflasNoTrans, _m, _n,
+						 _LU.getPointer(),_LU.getStride(),
+						 _PP.getWritePointer(), _QQ.getWritePointer(), FFPACK::FfpackLQUP );
+			_PP.setOrder(_rank);
+			_QQ.setOrder(_rank);
+
+		}
+#endif
+
+		/*! Contruction of LQUP factorization of A (making a copy of A).
+		 * P and Q are arguments !
+		 */
+		LQUPMatrix (const Field& F, const BlasMatrix<Element>& A,
+			    BlasPermutation<size_t> & P, BlasPermutation<size_t> & Q) :
+			_F(F), _LU(*(new BlasMatrix<Element> (A))) ,
+			_PP(P), _QQ(Q),
+			_m(A.rowdim()), _n(A.coldim()),
+			_alloc(true),_plloc(false)
+		{
 			//std::cerr<<"Je passe par le constructeur const"<<std::endl;
 
-			_rank= FFPACK::LUdivine( _F,FFLAS::FflasNonUnit,  FFLAS::FflasNoTrans, _m, _n, 
-						 _LU.getPointer(),_LU.getStride(), 
-						 _P.getWritePointer(), _Q.getWritePointer(), FFPACK::FfpackLQUP );
-			
+			linbox_check(_QQ.getOrder()==A.rowdim());
+			linbox_check(_PP.getOrder()==A.coldim());
+			_rank= FFPACK::LUdivine( _F,FFLAS::FflasNonUnit,  FFLAS::FflasNoTrans, _m, _n,
+						 _LU.getPointer(),_LU.getStride(),
+						 _PP.getWritePointer(), _QQ.getWritePointer(), FFPACK::FfpackLQUP );
+			_PP.setOrder(_rank);
+			_QQ.setOrder(_rank);
+
+
 		}
 
-		// Contruction of LQUP factorization of A (in-place in A)
-		LQUPMatrix (const Field& F, BlasMatrix<Element>& A)
-			: _F(F), _LU(A) , _P(A.coldim()), _Q(A.rowdim()), 
-			  _m(A.rowdim()), _n(A.coldim()), _alloc(false) {
+		/*! Contruction of LQUP factorization of A (in-place in A).
+		 * P and Q are arguments !
+		 */
+		LQUPMatrix (const Field& F, BlasMatrix<Element>& A,
+			    BlasPermutation<size_t> & P, BlasPermutation<size_t> & Q) :
+			_F(F), _LU(A) , _PP(P), _QQ(Q),
+			_m(A.rowdim()), _n(A.coldim()),
+			_alloc(false),_plloc(false)
+		{
 			//std::cerr<<"Je passe par le constructeur non const"<<std::endl;
-			_rank= FFPACK::LUdivine( _F,FFLAS::FflasNonUnit, FFLAS::FflasNoTrans, _m, _n, 
-						 _LU.getPointer(),_LU.getStride(), 
-						 _P.getWritePointer(), _Q.getWritePointer(), FFPACK::FfpackLQUP );
-			
+			linbox_check(_QQ.getOrder()<=A.rowdim());
+			linbox_check(_PP.getOrder()<=A.coldim());
+
+			_rank= FFPACK::LUdivine( _F,FFLAS::FflasNonUnit, FFLAS::FflasNoTrans, _m, _n,
+						 _LU.getPointer(),_LU.getStride(),
+						 _PP.getWritePointer(), _QQ.getWritePointer(), FFPACK::FfpackLQUP );
+			_PP.setOrder(_rank);
+			_QQ.setOrder(_rank);
+
 		}
 
-		// Contruction of LQUP factorization of A (making a copy of A)
-		LQUPMatrix (const BlasBlackbox<Field>& A)
-			: _F(A.field()), _LU(*(new BlasMatrix<Element> (A))) ,
-			  _P(A.coldim()), _Q(A.rowdim()), _m(A.rowdim()),
-			  _n(A.coldim()), _alloc(true)  {
-			
-			_rank= FFPACK::LUdivine( _F,FFLAS::FflasNonUnit,  FFLAS::FflasNoTrans,  _m, _n, 
-						 _LU.getPointer(),_LU.getStride(), 
-						 _P.getWritePointer(), _Q.getWritePointer(), FFPACK::FfpackLQUP );
+		/*! Contruction of LQUP factorization of A (making a copy of A).
+		 * P and Q are arguments !
+		 */
+		LQUPMatrix (const BlasBlackbox<Field>& A,
+			    BlasPermutation<size_t> & P, BlasPermutation<size_t> & Q) :
+			_F(A.field()), _LU(*(new BlasMatrix<Element> (A))) ,
+			_PP(P), _QQ(Q),
+			_m(A.rowdim()), _n(A.coldim()),
+			_alloc(true),_plloc(false)
+		{
+
+			linbox_check(_QQ.getOrder()==A.rowdim());
+			linbox_check(_PP.getOrder()==A.coldim());
+
+
+			_rank= FFPACK::LUdivine( _F,FFLAS::FflasNonUnit,  FFLAS::FflasNoTrans,  _m, _n,
+						 _LU.getPointer(),_LU.getStride(),
+						 _PP.getWritePointer(), _QQ.getWritePointer(), FFPACK::FfpackLQUP );
+
+			_PP.setOrder(_rank);
+			_QQ.setOrder(_rank);
+
 		}
 
-		// Contruction of LQUP factorization of A (in-place in A)
-		LQUPMatrix (BlasBlackbox<Field>& A)
-			: _F(A.field()), _LU(static_cast<BlasMatrix<Element>&> (A)) , _P(A.coldim()), _Q(A.rowdim()), 
-			  _m(A.rowdim()), _n(A.coldim()), _alloc(false) {
-			
-			_rank= FFPACK::LUdivine( _F,FFLAS::FflasNonUnit,  FFLAS::FflasNoTrans, _m, _n, 
-						 _LU.getPointer(),_LU.getStride(), 
-						 _P.getWritePointer(), _Q.getWritePointer(), FFPACK::FfpackLQUP );
+		/*! Contruction of LQUP factorization of A (in-place in A).
+		 * P and Q are arguments !
+		 */
+		LQUPMatrix (BlasBlackbox<Field>& A,
+			    BlasPermutation<size_t> & P, BlasPermutation<size_t> & Q) :
+			_F(A.field()), _LU(static_cast<BlasMatrix<Element>&> (A)) ,
+			_PP(P), _QQ(Q),
+			_m(A.rowdim()), _n(A.coldim()),
+			_alloc(false),_plloc(false)
+		{
+
+			linbox_check(_QQ.getOrder()==A.rowdim());
+			linbox_check(_PP.getOrder()==A.coldim());
+
+
+			_rank= FFPACK::LUdivine( _F,FFLAS::FflasNonUnit,  FFLAS::FflasNoTrans, _m, _n,
+						 _LU.getPointer(),_LU.getStride(),
+						 _PP.getWritePointer(), _QQ.getWritePointer(), FFPACK::FfpackLQUP );
+			_PP.setOrder(_rank);
+			_QQ.setOrder(_rank);
+
 		}
-		
 
-		~LQUPMatrix () {
+		//! destructor.
+		~LQUPMatrix ()
+		{
 			if (_alloc)
 				delete &_LU;
+			if (_plloc) {
+				delete &_PP;
+				delete &_QQ;
+			}
+		}
+
+		//! get the field on which the factorization is done
+		Field& field()
+		{
+			return _F;
+		}
+
+		//! get row dimension
+		size_t rowdim() const
+		{
+			return _m;
+		}
+
+		//! get column dimension
+		size_t coldim() const
+		{
+			return _n;
+		}
+
+		//! get the rank of matrix
+		size_t getrank() const
+		{
+			return _rank;
+		}
+
+		/*! get the permutation P.
+		 * (no copy)
+		 */
+		const BlasPermutation<size_t>& getP() const
+		{
+			return _PP;
 		}
 
-		// get the field on which the factorization is done
-		Field& field() {return _F;}
-
-		// get row dimension
-		size_t rowdim() const {return _m;}
-
-		// get column dimension
-		size_t coldim() const {return _n;}
-    
-		// get the rank of matrix
-		size_t getrank() const {return _rank;}
-    
-		// get the permutation P
-		const BlasPermutation& getP() const {return _P;}
-       
-		/** get the _transpose_ of the permutation Q
-		 * NOTE: this does not return Q itself! (because it is more difficult to compute)
-		 * If needed, Q can be obtained as a TransposedBlasMatrix from the return value
-		 *
-		 * One reason this confusion exists is that left-multiplying by a permuation matrix 
-		 * corresponds to a row permuation \pi \in S_n, while right-multiplying by the same matrix
-		 * corresponds to the inverse column permutation \pi^(-1)!
-		 * Usually this is handled intelligently (eg by applyP) but you must be careful with getQ().
+		/*! get the permutation P.
+		 * (copy)
 		 */
-		const BlasPermutation& getQ() const  {return _Q;}
+		BlasPermutation<size_t> & getP( BlasPermutation<size_t> & P ) const
+		{
+			P = BlasPermutation<size_t>(_PP.getPointer(),_rank);
+			return P;
+		}
+
+		/** Get the <i>transpose</i> of the permutation \p Q.
+		 * @warning This does not return \p Q itself! (because it is
+		 * more difficult to compute) If needed, \p Q can be obtained
+		 * as a \p TransposedBlasMatrix from the return value One
+		 * reason this confusion exists is that left-multiplying by
+		 * a permuation matrix corresponds to a row permuation \f$\pi \in S_n\f$,
+		 * while right-multiplying by the same matrix corresponds to
+		 * the inverse column permutation \f$\pi^{-1}\f$!  Usually this
+		 * is handled intelligently (eg by \c applyP) but you must be
+		 * careful with \c getQ().
+		 */
+		const BlasPermutation<size_t>& getQ() const
+		{
+			return _QQ;
+		}
 
-		// get the Matrix L
-		TriangularBlasMatrix<Element>& getL(TriangularBlasMatrix<Element>& L) const;
+		/*! get the permutation Qt.
+		 * (copy)
+		 * @warning see <code>LQUPMatrix::getQ()</code>
+		 */
+		BlasPermutation<size_t> & getQ( BlasPermutation<size_t> & Qt ) const
+		{
+			Qt = BlasPermutation<size_t>(_QQ.getPointer(),_rank);
+			return Qt ;
+		}
 
-		// get the matrix U
+		/*! get the Matrix \c  L.
+		 * @param[out] L
+		 * @param _QLUP if true then \c L form \c QLUP decomposition,
+		 * else \c L is form \c LQUP decomposition.
+		 * @pre \c L has unit diagonal
+		 */
+		TriangularBlasMatrix<Element>& getL(TriangularBlasMatrix<Element>& L, bool _QLUP = false) const;
+
+		/*! get the matrix  \c  U.
+		 * @pre \c   U has non-unit diagonal
+		 */
 		TriangularBlasMatrix<Element>& getU(TriangularBlasMatrix<Element>& U) const;
 
-		// get the matrix S (from the LSP factorization of A deduced from LQUP)
+		/*! get the matrix S.
+		 *  from the LSP factorization of A deduced from LQUP)
+		 */
 		BlasMatrix<Element>& getS( BlasMatrix<Element>& S) const;
 
-		// get a pointer to the begin of storage
-		Element* getPointer() const { return _LU.getPointer(); }
+		/*! @internal get a pointer to the begin of storage.
+		*/
+		Element* getPointer() const
+		{
+			return _LU.getPointer();
+		}
 
-		// get a pointer to the begin of storage
-		const size_t getStride() const { return _LU.getStride(); }
+		/*! @internal get  the stride in \c _LU
+		*/
+		size_t getStride() const
+		{
+			return _LU.getStride();
+		}
 
-		/*
+		/*!
 		 * Solvers with matrices or vectors
 		 * Operand can be a BlasMatrix<Element> or a std::vector<Element>
 		 */
+		//@{
 		// solve AX=B
 		template <class Operand>
 		Operand& left_solve(Operand& X, const Operand& B) const {
@@ -252,19 +454,19 @@ namespace LinBox{
 		Operand& right_solve(Operand& X, const Operand& B) const {
 			return FactorizedMatrixRightSolve<Field,Operand>()( _F, *this, X, B );
 		}
-		
+
 		// solve XA=B (X is stored in B)
 		template <class Operand>
 		Operand& right_solve(Operand& B) const{
 			return FactorizedMatrixRightSolve<Field,Operand>()( _F, *this, B );
 		}
-		
+
 		// solve LX=B (L from LQUP)
 		template <class Operand>
 		Operand& left_Lsolve(Operand& X, const Operand& B) const{
 			return FactorizedMatrixLeftLSolve<Field,Operand>()( _F, *this, X, B );
 		}
-		
+
 		// solve LX=B (L from LQUP) (X is stored in B)
 		template <class Operand>
 		Operand& left_Lsolve(Operand& B) const{
@@ -276,19 +478,19 @@ namespace LinBox{
 		Operand& right_Lsolve(Operand& X, const Operand& B) const{
 			return FactorizedMatrixRightLSolve<Field,Operand>()( _F, *this, X, B );
 		}
-		
+
 		// solve XL=B (L from LQUP) (X is stored in B)
 		template <class Operand>
 		Operand& right_Lsolve(Operand& B) const{
 			return FactorizedMatrixRightLSolve<Field,Operand>()( _F, *this, B );
 		}
-		
+
 		// solve UX=B (U from LQUP is r by r)
 		template <class Operand>
 		Operand& left_Usolve(Operand& X, const Operand& B) const{
 			return FactorizedMatrixLeftUSolve<Field,Operand>()( _F, *this, X, B );
 		}
-		
+
 		// solve UX=B (U from LQUP) (X is stored in B)
 		template <class Operand>
 		Operand& rleft_Usolve(Operand& B) const{
@@ -300,19 +502,21 @@ namespace LinBox{
 		Operand& right_Usolve(Operand& X, const Operand& B) const{
 			return FactorizedMatrixRightUSolve<Field,Operand>()( _F, *this, X, B );
 		}
-		
+
 		// solve XU=B (U from LQUP) (X is stored in B)
 		template <class Operand>
 		Operand& right_Usolve(Operand& B) const{
 			return FactorizedMatrixRightUSolve<Field,Operand>()( _F, *this, B );
 		}
+		//@}
 
 
 	}; // end of class LQUPMatrix
 
-//@}
+	//-}
 } // end of namespace LinBox
 
 #include <linbox/matrix/factorized-matrix.inl>
 
-#endif
+#endif //__LINBOX_factorized_matrix_H
+
diff --git a/linbox/matrix/factorized-matrix.inl b/linbox/matrix/factorized-matrix.inl
index fd08f58..3a480dc 100644
--- a/linbox/matrix/factorized-matrix.inl
+++ b/linbox/matrix/factorized-matrix.inl
@@ -1,10 +1,11 @@
 /* -*- 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
 /* linbox/matrix/factorized-matrix.inl
- * Copyright (C) 2004 Pascal Giorgi, Clément Pernet
+ * Copyright (C) 2004 Pascal Giorgi, Clément Pernet
  *
  * Written by :
  *               Pascal Giorgi  pascal.giorgi at ens-lyon.fr
- *               Clément Pernet clement.pernet at imag.fr
+ *               Clément Pernet clement.pernet at imag.fr
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -22,45 +23,94 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __FACTORIZED_MATRIX_INL
-#define __FACTORIZED_MATRIX_INL
+#ifndef __LINBOX_factorized_matrix_INL
+#define __LINBOX_factorized_matrix_INL
 
-namespace LinBox{
+namespace LinBox
+{
 
 
 	// get the Matrix L
 	template <class Field>
-	inline TriangularBlasMatrix<typename Field::Element>& LQUPMatrix<Field>::getL(TriangularBlasMatrix<Element>& L) const {
-		
+	inline TriangularBlasMatrix<typename Field::Element>& LQUPMatrix<Field>::getL( TriangularBlasMatrix<Element >& L,
+										    bool _QLUP ) const
+	{
+
 		linbox_check( L.coldim() == _m);
 		linbox_check( L.rowdim() == _m);
 		linbox_check( L.getUpLo() == BlasTag::low);
 		linbox_check( L.getDiag() == BlasTag::unit);
-	
+
 		typename Field::Element zero,one;
 		_F.init( zero, 0UL );
 		_F.init( one, 1UL );
+#if 0
+		if (_m > _n) {
+			size_t i = 0 ;
+			for ( ; i<_n; ++i ){
+				size_t j=0;
+				for (; j<i ; ++j )
+					L.setEntry( i, j, _LU.getEntry(i,j) );
+				for (; j<_m; ++j )
+					L.setEntry( i, j, zero );
+			}
+			for ( ; i<_m; ++i ){
+				size_t j=0;
+				for (; j<_n ; ++j )
+					L.setEntry( i, j, _LU.getEntry(i,j) );
+				for (; j<_m; ++j )
+					L.setEntry( i, j, zero );
+			}
 
+
+		}
+		else {
+			for ( size_t i=0; i<_m; ++i ){
+				size_t j=0;
+				for (; j<i ; ++j )
+					L.setEntry( i, j, _LU.getEntry(i,j) );
+				for (; j<_m; ++j )
+					L.setEntry( i, j, zero );
+			}
+		}
+#endif
+#if 1 /*  slower */
 		for ( size_t i=0; i<_m; ++i ){
 			size_t j=0;
 			for (; j< ((i<_n)?i:_n) ; ++j )
-				L.setEntry( i, j, _LU.getEntry(i,j) );			
+				L.setEntry( i, j, _LU.getEntry(i,j) );
 			for (; j<_m; ++j )
 				L.setEntry( i, j, zero );
-		}		
-				
-		FFPACK::applyP( _F, FFLAS::FflasRight, FFLAS::FflasNoTrans, _m,0,_m, L.getWritePointer(), _m, _Q.getPointer() );
+		}
+#endif
+
+		if (!_QQ.isIdentity())
+			FFPACK::applyP( _F, FFLAS::FflasRight, FFLAS::FflasNoTrans,
+					_m,0,_QQ.getOrder(),
+					L.getWritePointer(), _m, _QQ.getPointer() );
 		for ( size_t i=0; i<_m; ++i )
 			L.setEntry( i, i, one );
-					
+		if (_QLUP) {
+			if (!_QQ.isIdentity()) {
+				FFPACK::applyP( _F, FFLAS::FflasLeft, FFLAS::FflasNoTrans,
+						_m,0,_QQ.getOrder(),
+						L.getWritePointer(), _m, _QQ.getPointer() );
+				FFPACK::applyP( _F, FFLAS::FflasRight, FFLAS::FflasTrans,
+						_m,0,_QQ.getOrder(),
+						L.getWritePointer(), _m, _QQ.getPointer() );
+
+			}
+		}
+
 		return L;
-		
+
 	}
-										      
+
 	// get the matrix U
 	template <class Field>
-	inline TriangularBlasMatrix<typename Field::Element>& LQUPMatrix<Field>::getU(TriangularBlasMatrix<typename Field::Element>& U) const { 
-			
+	inline TriangularBlasMatrix<typename Field::Element>& LQUPMatrix<Field>::getU( TriangularBlasMatrix<typename Field::Element >& U ) const
+	{
+
 		linbox_check( U.rowdim() == _m);
 		linbox_check( U.coldim() == _n);
 		linbox_check( U.getUpLo() == BlasTag::up);
@@ -70,13 +120,14 @@ namespace LinBox{
 				U.setEntry( i, j, _LU.getEntry(i,j) );
 		return U;
 	}
-	
+
 	// get the Matrix S (from the LSP factorization of A deduced from LQUP)
 	template <class Field>
-	inline BlasMatrix<typename Field::Element>& LQUPMatrix<Field>::getS(BlasMatrix<typename Field::Element>& S) const {
-				
+	inline BlasMatrix<typename Field::Element>& LQUPMatrix<Field>::getS( BlasMatrix<typename Field::Element >& S) const
+	{
+
 		linbox_check( S.rowdim() == _m);
-		linbox_check( S.coldim() == _n);  
+		linbox_check( S.coldim() == _n);
 		typename Field::Element zero;
 		_F.init( zero, 0UL);
 		for ( size_t i=0; i<_m; ++i ){
@@ -85,8 +136,11 @@ namespace LinBox{
 			for ( size_t j=i; j<_n; ++j )
 				S.setEntry( i, j, _LU.getEntry(i,j) );
 		}
-	
-		FFPACK::applyP( _F, FFLAS::FflasLeft, FFLAS::FflasTrans, _n, 0, _m, S.getWritePointer(), _n, _Q.getPointer() );
+
+		if (!_QQ.isIdentity())
+			FFPACK::applyP( _F, FFLAS::FflasLeft, FFLAS::FflasTrans,
+					_n, 0, _QQ.getOrder(),
+					S.getWritePointer(), _n, _QQ.getPointer() );
 		return S;
 	}
 
@@ -96,37 +150,39 @@ namespace LinBox{
 	 * Solvers with Matrices: Operand=BlasMatrix<Element>
 	 */
 
-	template <class Field> 
+	template <class Field>
 	class FactorizedMatrixLeftSolve<Field, BlasMatrix<typename Field::Element> > {
 	public:
-		
-		BlasMatrix<typename Field::Element>& operator() (const Field& F, 
+
+		BlasMatrix<typename Field::Element>& operator() (const Field& F,
 								 const LQUPMatrix<Field>& A,
 								 BlasMatrix<typename Field::Element>& X,
-								 const BlasMatrix<typename Field::Element>& B) const{
+								 const BlasMatrix<typename Field::Element>& B) const
+		{
 			linbox_check (A.coldim() == X.rowdim());
 			linbox_check (A.rowdim() == B.rowdim());
 			linbox_check (B.coldim() == X.coldim());
 			int info;
-			
+
 			FFPACK::fgetrs (F, FFLAS::FflasLeft, A.rowdim(), A.coldim(), B.coldim(), A.getrank(),
 					A.getPointer(), A.getStride(), A.getP().getPointer(), A.getQ().getPointer(),
 					X.getPointer(), X.getStride(),
 					B.getPointer(), B.getStride(), &info);
 			if (info > 0)
 				throw LinboxMathInconsistentSystem ("Linear system is inconsistent");
-			
+
 			return X;
 		}
-		
-		BlasMatrix<typename Field::Element>& operator() (const Field& F, 
+
+		BlasMatrix<typename Field::Element>& operator() (const Field& F,
 								 const LQUPMatrix<Field>& A,
-								 BlasMatrix<typename Field::Element>& B) const{
-			
+								 BlasMatrix<typename Field::Element>& B) const
+		{
+
 			int info;
-			linbox_check (A.coldim() == A.rowdim()); 
+			linbox_check (A.coldim() == A.rowdim());
 			linbox_check (A.coldim() == B.rowdim());
-			
+
 			FFPACK::fgetrs (F, FFLAS::FflasLeft, B.rowdim(), B.coldim(), A.getrank(),
 					A.getPointer(), A.getStride(),
 					A.getP().getPointer(), A.getQ().getPointer(),
@@ -137,20 +193,21 @@ namespace LinBox{
 			return B;
 		}
 	}; // end of class FactorizedMatrixLeftSolve
-	
-	template <class Field> 
+
+	template <class Field>
 	class FactorizedMatrixRightSolve<Field, BlasMatrix<typename Field::Element> > {
 	public:
-		
-		BlasMatrix<typename Field::Element>& operator() ( const Field& F, 
+
+		BlasMatrix<typename Field::Element>& operator() ( const Field& F,
 								  const LQUPMatrix<Field>& A,
 								  BlasMatrix<typename Field::Element>& X,
-								  const BlasMatrix<typename Field::Element>& B ) const{
+								  const BlasMatrix<typename Field::Element>& B ) const
+		{
 			linbox_check (A.rowdim() == X.coldim());
 			linbox_check (A.coldim() == B.coldim());
 			linbox_check (B.rowdim() == X.rowdim());
 			int info;
-			
+
 			FFPACK::fgetrs (F, FFLAS::FflasRight, A.rowdim(), A.coldim(), B.rowdim(), A.getrank(),
 					A.getPointer(), A.getStride(),
 					A.getP().getPointer(), A.getQ().getPointer(),
@@ -161,15 +218,16 @@ namespace LinBox{
 
 			return X;
 		}
-		
-		BlasMatrix<typename Field::Element>& operator() ( const Field& F, 
+
+		BlasMatrix<typename Field::Element>& operator() ( const Field& F,
 								  const LQUPMatrix<Field>& A,
-								  BlasMatrix<typename Field::Element>& B ) const{
-			
+								  BlasMatrix<typename Field::Element>& B ) const
+		{
+
 			int info;
-			linbox_check (A.coldim() == A.rowdim()); 
+			linbox_check (A.coldim() == A.rowdim());
 			linbox_check (A.rowdim() == B.coldim());
-			
+
 			FFPACK::fgetrs (F, FFLAS::FflasRight, B.rowdim(), B.coldim(), A.getrank(),
 					A.getPointer(), A.getStride(),
 					A.getP().getPointer(), A.getQ().getPointer(),
@@ -179,75 +237,80 @@ namespace LinBox{
 
 			return B;
 		}
-		
+
 	}; // end of class FactorizedMatrixRightSolve
-	
 
-	template <class Field> 
+
+	template <class Field>
 	class FactorizedMatrixLeftLSolve<Field, BlasMatrix<typename Field::Element> > {
 	public:
-		BlasMatrix<typename Field::Element>& operator() ( const Field& F, 
+		BlasMatrix<typename Field::Element>& operator() ( const Field& F,
 								  const LQUPMatrix<Field>& A,
 								  BlasMatrix<typename Field::Element>& X,
-								  const BlasMatrix<typename Field::Element>& B ) const{
+								  const BlasMatrix<typename Field::Element>& B ) const
+		{
 			linbox_check (A.rowdim() == B.rowdim());
 			X = B;
-			return  (*this)(F, A, X); 
+			return  (*this)(F, A, X);
 		}
-		
-		BlasMatrix<typename Field::Element>& operator() ( const Field& F, 
+
+		BlasMatrix<typename Field::Element>& operator() ( const Field& F,
 								  const LQUPMatrix<Field>& A,
-								  BlasMatrix<typename Field::Element>& B ) const{
-		
+								  BlasMatrix<typename Field::Element>& B ) const
+		{
+
 			linbox_check (A.rowdim() == B.rowdim());
 
 			FFPACK::solveLB2 (F, FFLAS::FflasLeft, B.rowdim(), B.coldim(), A.getrank(),
-					  A.getPointer(), A.getStride(), 
+					  A.getPointer(), A.getStride(),
 					  A.getQ().getPointer(),
 					  B.getPointer(), B.getStride());
 
 			return B;
 		}
 	}; // end of class FactorizedMatrixLeftLSolve
-	
-	template <class Field> 
+
+	template <class Field>
 	class FactorizedMatrixRightLSolve<Field, BlasMatrix<typename Field::Element> > {
 	public:
-		BlasMatrix<typename Field::Element>& operator() (const Field& F, 
+		BlasMatrix<typename Field::Element>& operator() (const Field& F,
 								 const LQUPMatrix<Field>& A,
 								 BlasMatrix<typename Field::Element>& X,
-								 const BlasMatrix<typename Field::Element>& B) const{
+								 const BlasMatrix<typename Field::Element>& B) const
+		{
 			linbox_check (A.rowdim() == B.coldim());
 			X = B;
 			return  (*this)( F, A, X );
 		}
-		
-		BlasMatrix<typename Field::Element>& operator() (const Field& F, 
+
+		BlasMatrix<typename Field::Element>& operator() (const Field& F,
 								 const BlasMatrix<typename Field::element>& A,
-								 BlasMatrix<typename Field::Element>& B) const{
-			
+								 BlasMatrix<typename Field::Element>& B) const
+		{
+
 			linbox_check( A.rowdim() == B.coldim() );
 
 			FFPACK::solveLB2 (F, FFLAS::FflasRight, B.rowdim(), B.coldim(), A.getrank(),
-					  A.getPointer(), A.getStride(), 
+					  A.getPointer(), A.getStride(),
 					  A.getQ().getPointer(), B.getPointer(), B.getStride());
-			return B;	
+			return B;
 		}
 	}; // end of class FactorizedMatrixRightLsolve
 
-	template <class Field> 
+	template <class Field>
 	class FactorizedMatrixLeftUSolve<Field, BlasMatrix<typename Field::Element> > {
 	public:
-		
-		BlasMatrix<typename Field::Element>& operator() ( const Field& F, 
-								  const LQUPMatrix<Field>& A, 
+
+		BlasMatrix<typename Field::Element>& operator() ( const Field& F,
+								  const LQUPMatrix<Field>& A,
 								  BlasMatrix<typename Field::Element>& X,
-								  const BlasMatrix<typename Field::Element>& B ) const{
-			
+								  const BlasMatrix<typename Field::Element>& B ) const
+		{
+
 			linbox_check (A.coldim() == X.rowdim());
 			linbox_check (B.coldim() == X.coldim());
 			linbox_check (A.rowdim() == B.rowdim());
-			
+
 			bool consistent = true;
 			size_t ldb = B.getStride();
 			size_t ldx = X.getStride();
@@ -256,33 +319,34 @@ namespace LinBox{
 			typename Field::Element zero,one;
 			F.init(zero, 0UL);
 			F.init(one, 1UL);
-			
+
 			for (size_t i = A.getrank(); i < B.rowdim(); ++i)
 				for (size_t j = 0; j < B.coldim(); ++j)
 					if (!F.isZero (*(Bp + i*ldb + j)))
 						consistent = false;
-			if (!consistent) 
+			if (!consistent)
 				throw  LinboxMathInconsistentSystem ("Linear system is inconsistent");
-			
+
 			// The last rows of B are now supposed to be 0
 
 			for (size_t i=0; i < A.getrank(); ++i)
 				FFLAS::fcopy (F, B.coldim(), Xp + i*ldx, 1, Bp + i*ldx,1);
-			
-			FFLAS::ftrsm (F, FFLAS::FflasLeft, FFLAS::FflasUpper, FFLAS::FflasNoTrans, FFLAS::FflasNonUnit, 
+
+			FFLAS::ftrsm (F, FFLAS::FflasLeft, FFLAS::FflasUpper, FFLAS::FflasNoTrans, FFLAS::FflasNonUnit,
 				      A.getrank(), X.coldim(), one, A.getPointer(), A.getStride(), X.getPointer(), X.getStride());
 
 			for (size_t i=A.getrank(); i < X.rowdim(); ++i)
 				for (size_t j = 0; j < X.coldim(); ++j)
 					F.assign (*(Xp + i*ldx + j), zero);
-			
+
 			return X;
-			
+
 		}
-		BlasMatrix<typename Field::Element>& operator() ( const Field& F, 
-								  const BlasMatrix<typename Field::Element>& A, 
-								  BlasMatrix<typename Field::Element>& B ) const{
-			
+		BlasMatrix<typename Field::Element>& operator() ( const Field& F,
+								  const BlasMatrix<typename Field::Element>& A,
+								  BlasMatrix<typename Field::Element>& B ) const
+		{
+
 			linbox_check (A.coldim() == A.rowdim());
 			linbox_check (A.coldim() == B.rowdim());
 			typename Field::Element one,zero;
@@ -291,29 +355,30 @@ namespace LinBox{
 			F.init(one, 1UL);
 			F.init(zero, 0UL);
 			bool consistent = true;
-			
+
 			for (size_t i = A.getrank(); i < B.rowdim(); ++i)
 				for (size_t j = 0; j < B.coldim(); ++j)
 					if (!F.isZero (*(Bp + i*ldb + j)))
 						consistent = false;
-			if (!consistent) 
+			if (!consistent)
 				throw LinboxMathInconsistentSystem ("Linear system is inconsistent");
 
-			FFLAS::ftrsm (F, FFLAS::FflasLeft, FFLAS::FflasUpper, FFLAS::FflasNoTrans, FFLAS::FflasNonUnit, 
+			FFLAS::ftrsm (F, FFLAS::FflasLeft, FFLAS::FflasUpper, FFLAS::FflasNoTrans, FFLAS::FflasNonUnit,
 				      A.getrank(), B.coldim(), one, A.getPointer(), A.getStride(), Bp, ldb);
 
 			return B;
 		}
-		
+
 	}; // end of class FactorizedMatrixLeftUSolve
 
-	template <class Field> 
+	template <class Field>
 	class FactorizedMatrixRightUSolve<Field, BlasMatrix<typename Field::Element> > {
 	public:
-		BlasMatrix<typename Field::Element>& operator() ( const Field& F, 
-								  const LQUPMatrix<Field>& A, 
-								  BlasMatrix<typename Field::Element>& X, 
-								  const BlasMatrix<typename Field::Element>& B ) const{
+		BlasMatrix<typename Field::Element>& operator() ( const Field& F,
+								  const LQUPMatrix<Field>& A,
+								  BlasMatrix<typename Field::Element>& X,
+								  const BlasMatrix<typename Field::Element>& B ) const
+		{
 			linbox_check (X.coldim() == A.rowdim());
 			linbox_check (X.rowdim() == B.rowdim());
 			linbox_check (A.coldim() == B.coldim());
@@ -325,34 +390,35 @@ namespace LinBox{
 			size_t R = A.getrank();
 			size_t ldb = B.getStride();
 			size_t ldx = X.getStride();
-			
+
 			for (size_t i = 0; i < X.getrowdim(); ++i)
 				FFLAS::fcopy (F, R, Xp + i*ldx, 1, Bp + i*ldb,1);
 
-			FFLAS::ftrsm (F, FFLAS::FflasRight, FFLAS::FflasUpper, FFLAS::FflasNoTrans, FFLAS::FflasNonUnit, 
-			       X.rowdim(), R, one, A.getPointer(), A.getStride(), X.getPointer(), X.getStride());
+			FFLAS::ftrsm (F, FFLAS::FflasRight, FFLAS::FflasUpper, FFLAS::FflasNoTrans, FFLAS::FflasNonUnit,
+				      X.rowdim(), R, one, A.getPointer(), A.getStride(), X.getPointer(), X.getStride());
 
 			bool consistent = true;
 			if (B.coldim() > X.coldim()) {
 				typename Field::Element* W = new typename Field::Element [B.rowdim() * (B.coldim() - R)];
 				size_t ldw = B.rowdim();
-				
+
 				FFLAS::fgemm (F, FFLAS::FflasNoTrans, FFLAS::FflasNoTrans,
 					      X.rowdim(), B.coldim() - R, R,
 					      one, Xp, X.getStride(), A.getPointer() + R, A.getStride,
 					      zero, W, ldw);
-				
+
 				for (size_t i = 0; i < B.rowdim(); ++i)
 					for (size_t j = 0; j < B.coldim()-R; ++j)
 						if (!F.areEqual (*(W + i*ldw + j), *(Bp + R + i*ldb +j)))
 							consistent = false;
 				delete[] W;
-			} else {
+			}
+			else {
 				FFLAS::fgemm (F, FFLAS::FflasNoTrans, FFLAS::FflasNoTrans,
 					      X.rowdim(), B.coldim() - R, R,
 					      one, Xp, X.getStride(), A.getPointer() + R, A.getStride,
 					      zero, Xp + R, X.getStride());
-				
+
 				for (size_t i = 0; i < B.rowdim(); ++i)
 					for (size_t j = R; j < B.coldim(); ++j)
 						if (!F.areEqual (*(X + i*ldx + j), *(Bp + i*ldb +j)))
@@ -367,9 +433,10 @@ namespace LinBox{
 			return X;
 		}
 
-		BlasMatrix<typename Field::Element>& operator() ( const Field& F, 
-								  const LQUPMatrix<Field>& A, 
-								  BlasMatrix<typename Field::Element>& B ) const{
+		BlasMatrix<typename Field::Element>& operator() ( const Field& F,
+								  const LQUPMatrix<Field>& A,
+								  BlasMatrix<typename Field::Element>& B ) const
+		{
 			linbox_check (A.coldim() == A.rowdim());
 			linbox_check (B.coldim() == A.rowdim());
 
@@ -380,8 +447,8 @@ namespace LinBox{
 			typename Field::Element * Bp = B.getPointer();
 			size_t ldb = B.getStride();
 			size_t R = A.getrank();
-			
-			FFLAS::ftrsm (F, FFLAS::FflasRight, FFLAS::FflasUpper, FFLAS::FflasNoTrans, FFLAS::FflasNonUnit, 
+
+			FFLAS::ftrsm (F, FFLAS::FflasRight, FFLAS::FflasUpper, FFLAS::FflasNoTrans, FFLAS::FflasNonUnit,
 				      B.rowdim(), R, one, A.getPointer(), A.getStride(), B.getPointer(), B.getStride());
 
 			FFLAS::fgemm (F, FFLAS::FflasNoTrans, FFLAS::FflasNoTrans,
@@ -407,13 +474,14 @@ namespace LinBox{
 	 * Solvers with vectors: Operand=std::vector<Element>
 	 */
 
-	template <class Field> 
+	template <class Field>
 	class FactorizedMatrixLeftSolve<Field, std::vector<typename Field::Element> > {
 	public:
-		std::vector<typename Field::Element>& operator() ( const Field& F, 
-								   const LQUPMatrix<Field>& A, 
+		std::vector<typename Field::Element>& operator() ( const Field& F,
+								   const LQUPMatrix<Field>& A,
 								   std::vector<typename Field::Element>& x,
-								   const std::vector<typename Field::Element>& b ) const{
+								   const std::vector<typename Field::Element>& b ) const
+		{
 			linbox_check (A.coldim() == x.size());
 			linbox_check (A.rowdim() == b.size());
 			int info;
@@ -426,15 +494,16 @@ namespace LinBox{
 
 			return x;
 		}
-		
-		std::vector<typename Field::Element>& operator() ( const Field& F, 
-								   const LQUPMatrix<Field>& A, 
-								   std::vector<typename Field::Element>& b ) const{
-			
+
+		std::vector<typename Field::Element>& operator() ( const Field& F,
+								   const LQUPMatrix<Field>& A,
+								   std::vector<typename Field::Element>& b ) const
+		{
+
 			int info;
-			linbox_check (A.coldim() == A.rowdim()); 
+			linbox_check (A.coldim() == A.rowdim());
 			linbox_check (A.coldim() == b.size());
-			
+
 			FFPACK::fgetrs (F, FFLAS::FflasLeft, b.size(), 1, A.getrank(),
 					A.getPointer(), A.getStride(),
 					A.getP().getPointer(), A.getQ().getPointer(),
@@ -446,18 +515,19 @@ namespace LinBox{
 		}
 	}; // end of class FactorizedMatrixLeftSolve
 
-	template <class Field> 
+	template <class Field>
 	class FactorizedMatrixRightSolve<Field, std::vector<typename Field::Element> > {
 	public:
-			
-		std::vector<typename Field::Element>& operator() ( const Field& F, 
-								   const LQUPMatrix<Field>& A, 
+
+		std::vector<typename Field::Element>& operator() ( const Field& F,
+								   const LQUPMatrix<Field>& A,
 								   std::vector<typename Field::Element>& x,
-								   const std::vector<typename Field::Element>& b ) const{
+								   const std::vector<typename Field::Element>& b ) const
+		{
 			linbox_check (A.rowdim() == x.size());
 			linbox_check (A.coldim() == b.size());
 			int info;
-			
+
 			FFPACK::fgetrs (F, FFLAS::FflasRight, A.rowdim(), A.coldim(), 1, A.getrank(),
 					A.getPointer(), A.getStride(),
 					A.getP().getPointer(), A.getQ().getPointer(),
@@ -467,15 +537,16 @@ namespace LinBox{
 
 			return x;
 		}
-		
-		std::vector<typename Field::Element>& operator() ( const Field& F, 
-								   const LQUPMatrix<Field>& A, 
-								   std::vector<typename Field::Element>& b ) const{
-			
+
+		std::vector<typename Field::Element>& operator() ( const Field& F,
+								   const LQUPMatrix<Field>& A,
+								   std::vector<typename Field::Element>& b ) const
+		{
+
 			int info;
-			linbox_check (A.coldim() == A.rowdim()); 
-			linbox_check (A.rowdim() == B.size());
-			
+			linbox_check (A.coldim() == A.rowdim());
+			linbox_check (A.rowdim() == b.size());
+
 			FFPACK::fgetrs (F, FFLAS::FflasRight, 1, b.size(), A.getrank(),
 					A.getPointer(), A.getStride(),
 					A.getP().getPointer(), A.getQ().getPointer(),
@@ -487,124 +558,132 @@ namespace LinBox{
 		}
 	}; // end of class FactorizedMatrixRightSolve
 
-	template <class Field> 
+	template <class Field>
 	class FactorizedMatrixLeftLSolve<Field, std::vector<typename Field::Element> > {
 	public:
-		std::vector<typename Field::Element>& operator() ( const Field& F, 
-								   const LQUPMatrix<Field>& A, 
+		std::vector<typename Field::Element>& operator() ( const Field& F,
+								   const LQUPMatrix<Field>& A,
 								   std::vector<typename Field::Element>& x,
-								   const std::vector<typename Field::Element>& b ) const{
+								   const std::vector<typename Field::Element>& b ) const
+		{
 			linbox_check( A.rowdim() == b.size() );
 			x = b;
 			return (*this)( F, A, x );
 		}
-		
-		std::vector<typename Field::Element>& operator() ( const Field& F, 
+
+		std::vector<typename Field::Element>& operator() ( const Field& F,
 								   const LQUPMatrix<Field>& A,
-								   std::vector<typename Field::Element>& b ) const{
+								   std::vector<typename Field::Element>& b ) const
+		{
 			linbox_check (A.rowdim() == b.size());
 
 			FFPACK::solveLB2 (F, FFLAS::FflasLeft, b.size(), 1, A.getrank(),
-					  A.getPointer(), A.getStride(), 
+					  A.getPointer(), A.getStride(),
 					  A.getQ().getPointer(), &b[0], 1);
 
 			return b;
 
-			size_t n = b.size(); // bds: b not B
-			linbox_check( A.rowdim() == n );
-			size_t r = A.getrank();
-			
+			/* BB: unreachable  !
+			   size_t n = b.size(); // bds: b not B
+			   linbox_check( A.rowdim() == n );
+			   size_t r = A.getrank();
+
 			// To be changed: solveLB is designed for matrices, not for vectors
 			if ( A.rowdim() <= A.coldim() ) {
-				FFPACK::solveLB( F, FFLAS::FflasLeft, n, 1, r, A.getPointer(), A.getStride(), 
-						   A.getQ().getPointer(), &b[0], b.size() );
+			FFPACK::solveLB( F, FFLAS::FflasLeft, n, 1, r, A.getPointer(), A.getStride(),
+			A.getQ().getPointer(), &b[0], b.size() );
 			}
 			else
-				FFPACK::solveLB2( F, FFLAS::FflasLeft, n, 1, r, A.getPointer(), A.getStride(), 
-						    A.getQ().getPointer(), b.getPointer(), b.getStride() );
+			FFPACK::solveLB2( F, FFLAS::FflasLeft, n, 1, r, A.getPointer(), A.getStride(),
+			A.getQ().getPointer(), b.getPointer(), b.getStride() );
 			return b;
+			*/
 		}
 	}; // end of class FactorizedMatrixLeftLSolve
-	
-	template <class Field> 
+
+	template <class Field>
 	class FactorizedMatrixRightLSolve<Field, std::vector<typename Field::Element> > {
 	public:
-		std::vector<typename Field::Element>& operator() ( const Field& F, 
-								   const LQUPMatrix<Field>& A, 
+		std::vector<typename Field::Element>& operator() ( const Field& F,
+								   const LQUPMatrix<Field>& A,
 								   std::vector<typename Field::Element>& x,
-								   const std::vector<typename Field::Element>& b ) const{
+								   const std::vector<typename Field::Element>& b ) const
+		{
 			linbox_check( A.rowdim() == b.size() );
 			x = b;
 			return (*this)( F, A, x );
 		}
-		
-		std::vector<typename Field::Element>& operator() ( const Field& F, 
+
+		std::vector<typename Field::Element>& operator() ( const Field& F,
 								   const LQUPMatrix<Field>& A,
-								   std::vector<typename Field::Element>& b ) const{
+								   std::vector<typename Field::Element>& b ) const
+		{
 			linbox_check (A.rowdim() == b.size());
 
 			FFPACK::solveLB2 (F, FFLAS::FflasRight, 1, b.size(),  A.getrank(),
-					  A.getPointer(), A.getStride(), 
+					  A.getPointer(), A.getStride(),
 					  A.getQ().getPointer(), &b[0], b.size());
-			return b;	
+			return b;
 		}
 	}; // end of class FactorizedMatrixRightLsolve
 
-	template <class Field> 
+	template <class Field>
 	class FactorizedMatrixLeftUSolve<Field, std::vector<typename Field::Element> > {
 	public:
-		std::vector<typename Field::Element>& operator() ( const Field& F, 
-								   const LQUPMatrix<Field>& A, 
+		std::vector<typename Field::Element>& operator() ( const Field& F,
+								   const LQUPMatrix<Field>& A,
 								   std::vector<typename Field::Element>& x,
-								   const std::vector<typename Field::Element>& b ) const{
+								   const std::vector<typename Field::Element>& b ) const
+		{
 			linbox_check (A.coldim() == x.size());
 			linbox_check (A.rowdim() == b.size());
-			
+
 			bool consistent = true;
 			typename Field::Element * bp = &b[0];           ;
 			typename Field::Element * xp = &x[0];
 			typename Field::Element zero,one;
 			F.init(zero, 0UL);
 			F.init(one, 1UL);
-			
+
 			for (size_t i = A.getrank(); i < b.size(); ++i)
 				if (!F.isZero (b[i]))
 					consistent = false;
-			if (!consistent) 
+			if (!consistent)
 				throw  LinboxMathInconsistentSystem ("Linear system is inconsistent");
-			
+
 			// The last rows of B are now supposed to be 0
 
 			for (size_t i=0; i < A.getrank(); ++i)
 				F.assign (x[i], b[i]);
-			
-			FFLAS::ftrsv (F, FFLAS::FflasUpper, FFLAS::FflasNoTrans, FFLAS::FflasNonUnit, 
+
+			FFLAS::ftrsv (F, FFLAS::FflasUpper, FFLAS::FflasNoTrans, FFLAS::FflasNonUnit,
 				      A.getrank(), A.getPointer(), A.getStride(), xp, 1);
 
 			for (size_t i=A.getrank(); i < x.size(); ++i)
 				F.assign (x[i], zero);
 			return x;
-			
+
 		}
-		
-		std::vector<typename Field::Element>& operator() ( const Field& F, 
+
+		std::vector<typename Field::Element>& operator() ( const Field& F,
 								   const LQUPMatrix<Field>& A,
-								   std::vector<typename Field::Element>& b ) const{
-			
+								   std::vector<typename Field::Element>& b ) const
+		{
+
 			linbox_check (A.coldim() == A.rowdim());
 			linbox_check (A.coldim() == b.size());
 			typename Field::Element one,zero;
 			F.init(one, 1UL);
 			F.init(zero, 0UL);
 			bool consistent = true;
-			
+
 			for (size_t i = A.getrank(); i < b.size(); ++i)
 				if (!F.isZero (b[i]))
 					consistent = false;
-			if (!consistent) 
+			if (!consistent)
 				throw  LinboxMathInconsistentSystem ("Linear system is inconsistent");
 
-			FFLAS::ftrsv (F, FFLAS::FflasUpper, FFLAS::FflasNoTrans, FFLAS::FflasNonUnit, 
+			FFLAS::ftrsv (F, FFLAS::FflasUpper, FFLAS::FflasNoTrans, FFLAS::FflasNonUnit,
 				      A.getrank(), A.getPointer(), A.getStride(), &b[0], 1);
 
 			return b;
@@ -612,14 +691,15 @@ namespace LinBox{
 
 	}; // end of class FactorizedMatrixLeftUSolve
 
-	template <class Field> 
+	template <class Field>
 	class FactorizedMatrixRightUSolve<Field, std::vector<typename Field::Element> > {
 	public:
-		std::vector<typename Field::Element>& operator() ( const Field& F, 
-								   const LQUPMatrix<Field>& A, 
+		std::vector<typename Field::Element>& operator() ( const Field& F,
+								   const LQUPMatrix<Field>& A,
 								   std::vector<typename Field::Element>& x,
-								   const std::vector<typename Field::Element>& b ) const{
-			linbox_check (X.size() == A.rowdim());
+								   const std::vector<typename Field::Element>& b ) const
+		{
+			linbox_check (x.size() == A.rowdim());
 			linbox_check (A.coldim() == b.size());
 			typename Field::Element one,zero;
 			F.init(one, 1UL);
@@ -627,11 +707,11 @@ namespace LinBox{
 			typename Field::Element * bp = b.getPointer();
 			typename Field::Element * xp = x.getPointer();
 			size_t R = A.getrank();
-			
+
 			for (size_t i = 0; i < R; ++i)
 				F.assign (x[i], b[i]);
-			
-			FFLAS::ftrsv (F, FFLAS::FflasUpper, FFLAS::FflasTrans, FFLAS::FflasNonUnit, 
+
+			FFLAS::ftrsv (F, FFLAS::FflasUpper, FFLAS::FflasTrans, FFLAS::FflasNonUnit,
 				      R, A.getPointer(), A.getStride(), xp, 1);
 
 			bool consistent = true;
@@ -639,20 +719,21 @@ namespace LinBox{
 				typename Field::Element* W = new typename Field::Element [b.size() - R];
 
 				FFLAS::fgemv (F, FFLAS::FflasTrans,
-					      R, b.size() - R, 
-					      one, A.getPointer() + R, A.getStride, xp, 1, 
+					      R, b.size() - R,
+					      one, A.getPointer() + R, A.getStride, xp, 1,
 					      zero, W, 1);
-			
+
 				for (size_t i = 0; i < b.size() - R; ++i)
 					if (!F.areEqual (W[i], b[i + R]))
 						consistent = false;
 				delete[] W;
-			} else {
+			}
+			else {
 				FFLAS::fgemv (F, FFLAS::FflasTrans,
 					      R, b.size() - R,
-					      one, A.getPointer() + R, A.getStride, xp, 1, 
+					      one, A.getPointer() + R, A.getStride, xp, 1,
 					      zero, xp + R, 1);
-			
+
 				for (size_t i = R; i < b.size(); ++i)
 					if (!F.areEqual (x[i], b[i]))
 						consistent = false;
@@ -665,9 +746,10 @@ namespace LinBox{
 				F.assign (x[j], zero);
 			return x;
 		}
-		std::vector<typename Field::Element>& operator() ( const Field& F, 
+		std::vector<typename Field::Element>& operator() ( const Field& F,
 								   const LQUPMatrix<Field>& A,
-								   std::vector<typename Field::Element>& b ) const{
+								   std::vector<typename Field::Element>& b ) const
+		{
 			linbox_check (A.coldim() == A.rowdim());
 			linbox_check (b.size() == A.rowdim());
 
@@ -677,8 +759,8 @@ namespace LinBox{
 			F.init (zero, 0UL);
 			typename Field::Element * bp = &b[0];
 			size_t R = A.getrank();
-			
-			FFLAS::ftrsv (F, FFLAS::FflasUpper, FFLAS::FflasTrans, FFLAS::FflasNonUnit, 
+
+			FFLAS::ftrsv (F, FFLAS::FflasUpper, FFLAS::FflasTrans, FFLAS::FflasNonUnit,
 				      R, one, A.getPointer(), A.getStride(), bp, 1);
 
 			FFLAS::fgemv (F, FFLAS::FflasTrans,
@@ -701,4 +783,5 @@ namespace LinBox{
 } //end of namespace LinBox
 
 
-#endif
+#endif // __LINBOX_factorized_matrix_INL
+
diff --git a/linbox/matrix/matrix-category.h b/linbox/matrix/matrix-category.h
index 6df6d1d..e3d9b90 100644
--- a/linbox/matrix/matrix-category.h
+++ b/linbox/matrix/matrix-category.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* linbox/matrix/matrix-category.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -21,8 +22,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __MATRIX_CATEGORY_H
-#define __MATRIX_CATEGORY_H
+#ifndef __LINBOX_matrix_category_H
+#define __LINBOX_matrix_category_H
 
 #include <linbox/matrix/sparse.h>
 #include <linbox/matrix/dense.h>
@@ -31,34 +32,35 @@
 #include <linbox/blackbox/dense.h>
 
 
-namespace LinBox{
+namespace LinBox
+{
 
 	struct MatrixContainerCategory {
 		struct BlasContainer{};
 		struct Container{};
 		struct Blackbox{};
 	};
-  
+
 	template <class Matrix>
 	class MatrixContainerTrait {
 	public:
 		typedef MatrixContainerCategory::Blackbox Type;
 	};
-	
+
 
 	template <class Element>
 	class MatrixContainerTrait<DenseMatrixBase<Element> > {
 	public:
 		typedef MatrixContainerCategory::Container Type;
 	};
-	
+
 	template <class Element>
 	class MatrixContainerTrait<SparseMatrixBase<Element> > {
 	public:
 		typedef MatrixContainerCategory::Container Type;
 	};
 
-	
+
 	template <class Field>
 	class MatrixContainerTrait<DenseMatrix<Field> > {
 	public:
@@ -73,4 +75,5 @@ namespace LinBox{
 
 }
 
-#endif
+#endif //__LINBOX_matrix_category_H
+
diff --git a/linbox/matrix/matrix-domain.h b/linbox/matrix/matrix-domain.h
index 28d5d59..6e4e8ca 100644
--- a/linbox/matrix/matrix-domain.h
+++ b/linbox/matrix/matrix-domain.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/matrix/matrix-domain.h
  * Copyright (C) 2002 Zhendong Wan, Bradford Hovinen
  *
@@ -17,8 +17,8 @@
  * See COPYING for license information.
  */
 
-#ifndef __MATRIX_DOMAIN_H
-#define __MATRIX_DOMAIN_H
+#ifndef __LINBOX_matrix_domain_H
+#define __LINBOX_matrix_domain_H
 
 #include <iostream>
 
@@ -28,950 +28,1145 @@
 namespace LinBox
 {
 
-/** \brief For specializing matrix arithmetic
- *
- * This class defines matrix categories that allow us to specialize the matrix
- * arithmetic in \ref MatrixDomain for different matrix representations. For
- * example, a sparse matrix may have an efficient iterator over row vectors but
- * not over column vectors. Therefore, an algorithm that tries to iterate over
- * column vectors will run very slowly. Hence a specialization that avoids using
- * column vectors is used instead.
- */
-
-struct MatrixCategories 
-{
-	struct BlackboxTag { };
-	struct RowMatrixTag : public virtual BlackboxTag { };
-	struct ColMatrixTag : public virtual BlackboxTag { };
-	struct RowColMatrixTag : public RowMatrixTag, public ColMatrixTag { };
-};
-
-template <class Matrix> struct MatrixTraits
-{
-	typedef Matrix MatrixType;
-	typedef typename Matrix::MatrixCategory MatrixCategory;
-};
-
-/** \brief Helper class to allow specializations of certain matrix-vector products
- *
- * This class implements a method mulColSPD that multiplies a
- * column-represented matrix by a dense vector
- */
-
-template <class Field>
-class MVProductDomain
-{
-    public:
-	typedef typename Field::Element Element;
-
-	MVProductDomain () {}
-
-    protected:
-	template <class Vector1, class Matrix, class Vector2>
-	inline Vector1 &mulColDense (const VectorDomain<Field> &VD, Vector1 &w, const Matrix &A, const Vector2 &v) const;
-};
-
-/** \brief Class of matrix arithmetic functions
- *
- * This class encapuslated matrix-matrix and matrix-vector operations, roughly
- * equivalent to BLAS levels 2 and 3. The arithmetic methods are parameterized
- * by matrix type so that they may be used the same way with sparse matrices,
- * dense matrices, and dense submatrices. Except where otherwise noted, they
- * require the matrix inputs to meet the \ref DenseMatrix archetype.
- *
- * These methods are specialized so that they can run efficiently with different
- * matrix representations. If a matrix has an efficient row iterator, but not an
- * efficient column iterator, a specialization that makes use of the former will
- * be selected. This allows a great deal of flexibility when dealing with sparse
- * matrix arithmetic.
- *
- * For all of the arithmetic operations that output matrices, it is assumed that
- * the output matrix has an efficient row iterator. In typical use, the output
- * matrix will be a \ref DenseMatrixBase or a \ref DenseSubmatrix, which has
- * efficient row and column iterators. In particular, one should not perform
- * these arithmetic operations outputting to a \ref SparseMatrixBase.
- *
- * There are other restrictions. See the method-specific documentation for more
- * details.
- */
-
-template <class Field>
-class MatrixDomain : public MVProductDomain<Field>
-{
-    public:
-
-	///
-	MatrixDomain (const Field &F) : _F (F), _VD (F) {}
-
-	/** Retrieve the underlying field
-	 * Return a reference to the field that this matrix domain
-	 * object uses
-	 * @returns reference to field
-	 */
-	const Field &field () const
-		{ return _F; }
-	Field &field () 
-		{ return _F; }
-
-	/** Print matrix.
-	 * @param  os  Output stream to which matrix is written.
-	 * @param  A   Matrix.
-	 * @returns reference to os.
-	 */
-	template <class Matrix>
-	inline std::ostream &write (std::ostream &os, const Matrix &A) const
-		{ return A.write (os, _F); }
-
-	/** Read matrix
-	 * @param  is  Input stream from which matrix is read.
-	 * @param  A   Matrix.
-	 * @returns reference to is.
-	 */
-	template <class Matrix>
-	inline std::istream &read (std::istream &is, Matrix &A) const
-		{ return A.read (is, _F); }
-
-	/** Matrix copy
-	 * B <- A
-	 * Copy the contents of the matrix B to the matrix A
-	 *
-	 * Both matrices must support the same iterators, row or column.
-	 * 
-	 * @param B Matrix B
-	 * @param A Matrix A
-	 * @returns Reference to B
-	 */
-	template <class Matrix1, class Matrix2>
-	inline Matrix1 &copy (Matrix1 &B, const Matrix2 &A) const
-		{ return copySpecialized (B, A,
-					  typename MatrixTraits<Matrix1>::MatrixCategory (),
-					  typename MatrixTraits<Matrix2>::MatrixCategory ()); }
-
-	/** Matrix equality
-	 * Test whether the matrices A and B are equal
-	 * @param A Input vector
-	 * @param B Input vector
-	 * @returns true if and only if the matrices A and B are equal
-	 */
-	template <class Matrix1, class Matrix2>
-	bool areEqual (const Matrix1 &A, const Matrix2 &B) const
-		{ return areEqualSpecialized (B, A,
-					      typename MatrixTraits<Matrix1>::MatrixCategory (),
-					      typename MatrixTraits<Matrix2>::MatrixCategory ()); }
-
-	/** Matrix equality with zero
-	 * @param A Input matrix
-	 * @returns true if and only if the matrix A is zero
-	 */
-	template <class Matrix>
-	inline bool isZero (const Matrix &A) const
-		{ return isZeroSpecialized (A, typename MatrixTraits<Matrix>::MatrixCategory ()); }
-
-	/** Matrix-matrix addition
-	 * C <- A + B
-	 *
-	 * Each of A, B, and C must support the same iterator, either row or
-	 * column
-	 *
-	 * @param C Output matrix C
-	 * @param A Input matrix A
-	 * @param B Input matrix B
-	 * @returns Reference to C
-	 */
-	template <class Matrix1, class Matrix2, class Matrix3>
-	inline Matrix1& add (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const
-		{ return addSpecialized (C, A, B,
-					 typename MatrixTraits<Matrix1>::MatrixCategory (),
-					 typename MatrixTraits<Matrix2>::MatrixCategory (),
-					 typename MatrixTraits<Matrix3>::MatrixCategory ()); }
-    
-	/** Matrix-matrix in-place addition
-	 * A <- A + B
-	 *
-	 * Each of A and B must support the same iterator, either row or column
-	 *
-	 * @param A Input matrix A
-	 * @param B Input matrix B
-	 * @returns Reference to A
-	 */
-	template <class Matrix1, class Matrix2>
-	inline Matrix1& addin (Matrix1 &A, const Matrix2 &B) const
-		{ return addinSpecialized (A, B,
-					   typename MatrixTraits<Matrix1>::MatrixCategory (),
-					   typename MatrixTraits<Matrix2>::MatrixCategory ()); }
-
-	/** Matrix-matrix subtraction
-	 * C <- A - B
-	 *
-	 * Each of A, B, and C must support the same iterator, either row or
-	 * column
+	/** \brief For specializing matrix arithmetic
 	 *
-	 * @param C Output matrix C
-	 * @param A Input matrix A
-	 * @param B Input matrix B
-	 * @returns Reference to C
+	 * This class defines matrix categories that allow us to specialize the matrix
+	 * arithmetic in \ref MatrixDomain for different matrix representations. For
+	 * example, a sparse matrix may have an efficient iterator over row vectors but
+	 * not over column vectors. Therefore, an algorithm that tries to iterate over
+	 * column vectors will run very slowly. Hence a specialization that avoids using
+	 * column vectors is used instead.
 	 */
-	template <class Matrix1, class Matrix2, class Matrix3>
-	inline Matrix1 &sub (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const
-		{ return subSpecialized (C, A, B,
-					 typename MatrixTraits<Matrix1>::MatrixCategory (),
-					 typename MatrixTraits<Matrix2>::MatrixCategory (),
-					 typename MatrixTraits<Matrix3>::MatrixCategory ()); }
-
-	/** Matrix-matrix in-place subtraction
-	 * A <- A - B
-	 *
-	 * Each of A and B must support the same iterator, either row or column
-	 *
-	 * @param A Input matrix A
-	 * @param B Input matrix B
-	 * @returns Reference to A
-	 */
-	template <class Matrix1, class Matrix2>
-	inline Matrix1 &subin (Matrix1 &A, const Matrix2 &B) const
-		{ return subinSpecialized (A, B,
-					   typename MatrixTraits<Matrix1>::MatrixCategory (),
-					   typename MatrixTraits<Matrix2>::MatrixCategory ()); }
-
-	/** Matrix negate
-	 * B <- -A
-	 *
-	 * Each of A and B must support the same iterator, either row or column
-	 *
-	 * @param B Output matrix B
-	 * @param A Input matrix A
-	 * @returns reference to B
-	 */
-	template <class Matrix1, class Matrix2>
-	inline Matrix1 &neg (Matrix1 &B, const Matrix2 &A) const
-		{ return negSpecialized (B, A,
-					 typename MatrixTraits<Matrix1>::MatrixCategory (),
-					 typename MatrixTraits<Matrix2>::MatrixCategory ()); }
-
-	/** Matrix in-place negate
-	 * A <- -A
-	 * @param A Input matrix A; result is stored here
-	 */
-	template <class Matrix>
-	inline Matrix &negin (Matrix &A) const
-		{ return neginSpecialized (A, typename MatrixTraits<Matrix>::MatrixCategory ()); }
 
-	/** Matrix-matrix multiply
-	 * C <- A * B
-	 *
-	 * C must support both row and column iterators, and the vector
-	 * representations must be dense. Examples of supported matrices are
-	 * \ref DenseMatrixBase and \ref DenseSubmatrix.
-	 *
-	 * Either A or B, or both, may have limited iterators. However, either A
-	 * must support row iterators or B must support column iterators. If
-	 * both A and B lack support for an iterator (either row or column),
-	 * then C must support the same type of iterator as A and B.
-	 *
-	 * @param C Output matrix C
-	 * @param A Input matrix A
-	 * @param B Input matrix B
-	 * @returns Reference to C
-	 */
-	template <class Matrix1, class Matrix2, class Matrix3>
-	inline Matrix1 &mul (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const
-		{ return mulSpecialized (C, A, B,
-					 typename MatrixTraits<Matrix1>::MatrixCategory (),
-					 typename MatrixTraits<Matrix2>::MatrixCategory (),
-					 typename MatrixTraits<Matrix3>::MatrixCategory ()); }
-
-	/** Matrix-matrix in-place multiply on the left
-	 * B <- A * B
-	 *
-	 * B should support both row and column iterators, and must be dense. A
-	 * must support row iterators.
-	 *
-	 * @param A Input matrix A
-	 * @param B Input matrix B
-	 * @returns Reference to B
-	 */
-	template <class Matrix1, class Matrix2>
-	inline Matrix2 &leftMulin (const Matrix1 &A, Matrix2 &B) const;
+	struct MatrixCategories {
+		struct BlackboxTag { };
+		struct RowMatrixTag : public virtual BlackboxTag { };
+		struct ColMatrixTag : public virtual BlackboxTag { };
+		struct RowColMatrixTag : public RowMatrixTag, public ColMatrixTag { };
+	};
 
-	/** Matrix-matrix in-place multiply on the right
-	 * A <- A * B
-	 *
-	 * A should support both row and column iterators, and must be dense. B
-	 * must support column iterators.
-	 *
-	 * @param A Input matrix A
-	 * @param B Input matrix B
-	 * @returns Reference to A
-	 */
-	template <class Matrix1, class Matrix2>
-	inline Matrix1 &rightMulin (Matrix1 &A, const Matrix2 &B) const;
-
-	/** Matrix-matrix in-place multiply
-	 * A <- A * B
-	 *
-	 * This is an alias for \ref rightMulin
-	 *
-	 * @param A Input matrix A
-	 * @param B Input matrix B
-	 * @returns Reference to A
-	 */
-	template <class Matrix1, class Matrix2>
-	inline Matrix1 &mulin (Matrix1 &A, const Matrix2 &B) const
-		{ return rightMulin (A, B); }
-
-	/** Matrix-scalar multiply
-	 * C <- B * a
-	 *
-	 * Multiply B by the scalar element a and store the result in C. B and C
-	 * must support the same iterators.
-	 *
-	 * @param C Output matrix C
-	 * @param B Input matrix B
-	 * @param a Input scalar a
-	 * @returns Reference to C
-	 */
-	template <class Matrix1, class Matrix2>
-	inline Matrix1 &mul (Matrix1 &C, const Matrix2 &B, const typename Field::Element &a) const
-		{ return mulSpecialized (C, B, a,
-					 typename MatrixTraits<Matrix1>::MatrixCategory (),
-					 typename MatrixTraits<Matrix2>::MatrixCategory ()); }
-
-	/** Matrix-scalar in-place multiply
-	 * B <- B * a
-	 *
-	 * Multiply B by the scalar element a in-place.
-	 *
-	 * @param B Input matrix B
-	 * @param a Input scalar a
-	 * @returns Reference to B
-	 */
 	template <class Matrix>
-	inline Matrix &mulin (Matrix &B, const typename Field::Element &a) const
-		{ return mulinSpecialized (B, a, typename MatrixTraits<Matrix>::MatrixCategory ()); }
+	struct MatrixTraits {
+		typedef Matrix MatrixType;
+		typedef typename Matrix::MatrixCategory MatrixCategory;
+	};
 
-	/** Matrix-matrix in-place axpy
-	 * Y <- Y + A*X
-	 *
-	 * This function combines \ref mul and \ref add, eliminating the need
-	 * for an additional temporary in expressions of the form $Y = Y +
-	 * AX$. Only one row of additional storage is required. Y may have
-	 * either efficient row iterators or efficient column iterators, and the
-	 * same restrictions on A and X apply as in \ref mul.
-	 *
-	 * Note that no out-of-place axpy is provided, since it gives no
-	 * benefit. One may just as easily multiply into the result and call
-	 * \ref addin.
+	/** \brief Helper class to allow specializations of certain matrix-vector products
 	 *
-	 * @param Y Input matrix Y; result is stored here
-	 * @param A Input matrix A
-	 * @param X Input matrix X
+	 * This class implements a method mulColSPD that multiplies a
+	 * column-represented matrix by a dense vector
 	 */
-	template <class Matrix1, class Matrix2, class Matrix3>
-	inline Matrix1 &axpyin (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X) const
-		{ return axpyinSpecialized (Y, A, X,
-					    typename MatrixTraits<Matrix1>::MatrixCategory (),
-					    typename MatrixTraits<Matrix2>::MatrixCategory (),
-					    typename MatrixTraits<Matrix3>::MatrixCategory ()); }
+	template <class Field>
+	class MVProductDomain {
+	public:
+		typedef typename Field::Element Element;
 
-	/* FIXME: Need documentation of these methods */
-	template<class Matrix1, class Matrix2>
-	Matrix1 &pow_apply (Matrix1 &M1, const Matrix2 &M2, unsigned long int k) const;
-
-	template<class Matrix1, class Matrix2>
-	Matrix1 &pow_horn (Matrix1 &M1, const Matrix2 &M2, unsigned long int k) const;
-
-
-	/* @name Matrix-vector arithmetic operations
-	 * These operations take a matrix satisfying the \ref DenseMatrix
-	 * archetype and LinBox vectors as inputs. They involve matrix-vector
-	 * product and matrix-vector AXPY
-	 */
+		MVProductDomain () {}
 
-	/** Matrix-vector multiply
-	 * w <- A * v
-	 *
-	 * The vectors v and w must be of the same representation (dense, sparse
-	 * sequence, sparse associative, or sparse parallel), but they may be of
-	 * different types. The matrix A may have any representation.
-	 *
-	 * @param w Output vector w
-	 * @param A Input matrix A
-	 * @param v Input vector v
-	 * @returns Reference to w
-	 */
-	template <class Vector1, class Matrix, class Vector2>
-	inline Vector1 &vectorMul (Vector1 &w, const Matrix &A, const Vector2 &v) const
-		{ return mulSpecialized (w, A, v, typename MatrixTraits<Matrix>::MatrixCategory ()); }
+	protected:
+		template <class Vector1, class Matrix, class Vector2>
+		inline Vector1 &mulColDense (const VectorDomain<Field> &VD, Vector1 &w, const Matrix &A, const Vector2 &v) const;
+	};
 
-	/** Matrix-vector in-place axpy
-	 * y <- y + A*x
+	/** Class of matrix arithmetic functions.
 	 *
-	 * This function eliminates the requirement for temporary storage when
-	 * one is computing an expression of the form given above.
+	 * This class encapuslated matrix-matrix and matrix-vector operations, roughly
+	 * equivalent to BLAS levels 2 and 3. The arithmetic methods are parameterized
+	 * by matrix type so that they may be used the same way with sparse matrices,
+	 * dense matrices, and dense submatrices. Except where otherwise noted, they
+	 * require the matrix inputs to meet the \ref DenseMatrix archetype.
 	 *
-	 * The vectors y and x must be of the same representation (dense, sparse
-	 * sequence, sparse associative, or sparse parallel), but they may be of
-	 * different types. The matrix A may have any representation.
+	 * These methods are specialized so that they can run efficiently with different
+	 * matrix representations. If a matrix has an efficient row iterator, but not an
+	 * efficient column iterator, a specialization that makes use of the former will
+	 * be selected. This allows a great deal of flexibility when dealing with sparse
+	 * matrix arithmetic.
 	 *
-	 * Note that out-of-place axpy is not provided since it provides no
-	 * benefit -- one can use mul and then addin to exactly the same effect,
-	 * with no additional storage or performance cost.
-	 * 
-	 * @param y Input vector y; result is stored here
-	 * @param A Input matrix A
-	 * @param x Input vector x
-	 */
-	template <class Vector1, class Matrix, class Vector2>
-	inline Vector1 &vectorAxpyin (Vector1 &y, const Matrix &A, const Vector2 &x) const
-		{ return axpyinSpecialized (y, A, x, typename MatrixTraits<Matrix>::MatrixCategory ()); }
-
-	/*? @name Matrix-black box arithmetic operations
-	 * These operations mimic the matrix-matrix arithmetic operations above,
-	 * but one of the parameters is a \ref BlackboxArchetype.
-	 */
-
-	/** Matrix-black box left-multiply
-	 * C <- A * B
+	 * For all of the arithmetic operations that output matrices, it is assumed that
+	 * the output matrix has an efficient row iterator. In typical use, the output
+	 * matrix will be a \ref DenseMatrixBase or a \ref DenseSubmatrix, which has
+	 * efficient row and column iterators. In particular, one should not perform
+	 * these arithmetic operations outputting to a \ref SparseMatrixBase.
 	 *
-	 * Both C and B must support column iterators
-	 *
-	 * @param C Output matrix
-	 * @param A Black box for A
-	 * @param B Matrix B
+	 * There are other restrictions. See the method-specific documentation for more
+	 * details.
 	 */
-	template <class Matrix1, class Blackbox, class Matrix2>
-	inline Matrix1 &blackboxMulLeft (Matrix1 &C, const Blackbox &A, const Matrix2 &B) const;
-
-	/** Matrix-black box right-multiply
-	 * C <- A * B
-	 *
-	 * Both C and A must support row iterators
-	 *
-	 * @param C Output matrix
-	 * @param A Matrix A
-	 * @param B Black box for B
-	 */
-	template <class Matrix1, class Matrix2, class Blackbox>
-	inline Matrix1 &blackboxMulRight (Matrix1 &C, const Matrix2 &A, const Blackbox &B) const;
-
-	/*? @name Matrix permutations
-	 * These operations permute the rows or columns of a matrix based on
-	 * the given permutation. They are intended for use with Gauss-Jordan
-	 * elimination
-	 */
-
-	/** Permutation
-	 *
-	 * A permutation is represented as a vector of pairs, each
-	 * pair representing a transposition.
-	 */
-	typedef std::pair<unsigned int, unsigned int> Transposition;
-	typedef std::vector<Transposition> Permutation;
-
-
-
-	/** Permute the rows of the given matrix
-	 *
-	 * @param A Output matrix
-	 * @param P_start Start of permutation
-	 * @param P_end End of permutation
-	 * @returns Reference to A
-	 */
-	template <class Matrix, class Iterator>
-	inline Matrix &permuteRows (Matrix   &A,
-				    Iterator  P_start,
-				    Iterator  P_end) const
-		{ return permuteRowsSpecialized (A, P_start, P_end,
-						 typename MatrixTraits<Matrix>::MatrixCategory ()); }
-
-	/** Permute the columns of the given matrix
-	 *
-	 * @param A Output matrix
-	 * @param P_start Start of permutation
-	 * @param P_end End of permutation
-	 * @returns Reference to A
-	 */
-	template <class Matrix, class Iterator>
-	inline Matrix &permuteColumns (Matrix   &A,
-				       Iterator  P_start,
-				       Iterator  P_end) const
-		{ return permuteColsSpecialized (A, P_start, P_end,
-						 typename MatrixTraits<Matrix>::MatrixCategory ()); }
-
-    private:
-
-	// Specialized function implementations
-	template <class Matrix1, class Matrix2> Matrix1 &copyRow (Matrix1 &B, const Matrix2 &A) const;
-	template <class Matrix1, class Matrix2> Matrix1 &copyCol (Matrix1 &B, const Matrix2 &A) const;
-
-	template <class Matrix1, class Matrix2>
-	inline Matrix1 &copySpecialized (Matrix1 &B, const Matrix2 &A,
-				  MatrixCategories::RowMatrixTag,
-				  MatrixCategories::RowMatrixTag) const
-		{ return copyRow (B, A); }
-	template <class Matrix1, class Matrix2>
-	inline Matrix1 &copySpecialized (Matrix1 &B, const Matrix2 &A,
-				  MatrixCategories::ColMatrixTag,
-				  MatrixCategories::ColMatrixTag) const
-		{ return copyCol (B, A); }
-	template <class Matrix1, class Matrix2>
-	inline Matrix1 &copySpecialized (Matrix1 &B, const Matrix2 &A,
+	template <class Field>
+	class MatrixDomain : public MVProductDomain<Field> {
+	public:
+
+		/// Constructor.
+		//! @param F field for MatrixDomain operations.
+		MatrixDomain (const Field &F) :
+			_F (F), _VD (F)
+		{}
+
+		/// Copy operator.
+		MatrixDomain& operator= (const MatrixDomain& MD)
+		{
+			_F = MD._F;
+			_VD = MD._VD;
+			return *this;
+		}
+
+		/** Retrieve the underlying field.
+		 * Return a reference to the field that this matrix domain
+		 * object uses
+		 * @returns reference to field
+		 */
+		//@{
+		const Field &field () const
+		{
+			return _F;
+		}
+		Field &field ()
+		{
+			return _F;
+		}
+		//@}
+
+		/** Print matrix.
+		 * @param  os  Output stream to which matrix is written.
+		 * @param  A   Matrix.
+		 * @returns reference to os.
+		 */
+		template <class Matrix>
+		inline std::ostream &write (std::ostream &os, const Matrix &A) const
+		{
+			return A.write (os, _F);
+		}
+
+		/** Read matrix.
+		 * @param  is  Input stream from which matrix is read.
+		 * @param  A   Matrix.
+		 * @returns reference to is.
+		 */
+		template <class Matrix>
+		inline std::istream &read (std::istream &is, Matrix &A) const
+		{
+			return A.read (is, _F);
+		}
+
+		/** Matrix copy
+		 * B <- A.
+		 * Copy the contents of the matrix B to the matrix A
+		 *
+		 * Both matrices must support the same iterators, row or column.
+		 *
+		 * @param B Matrix B
+		 * @param A Matrix A
+		 * @returns Reference to B
+		 */
+		template <class Matrix1, class Matrix2>
+		inline Matrix1 &copy (Matrix1 &B, const Matrix2 &A) const
+		{
+			return copySpecialized (B, A,
+						typename MatrixTraits<Matrix1>::MatrixCategory (),
+						typename MatrixTraits<Matrix2>::MatrixCategory ());
+		}
+
+		/** Matrix equality.
+		 * Test whether the matrices A and B are equal
+		 * @param A Input vector
+		 * @param B Input vector
+		 * @returns true if and only if the matrices A and B are equal
+		 */
+		template <class Matrix1, class Matrix2>
+		bool areEqual (const Matrix1 &A, const Matrix2 &B) const
+		{
+			return areEqualSpecialized (B, A,
+						    typename MatrixTraits<Matrix1>::MatrixCategory (),
+						    typename MatrixTraits<Matrix2>::MatrixCategory ());
+		}
+
+		/** Matrix equality with zero.
+		 * @param A Input matrix
+		 * @returns true if and only if the matrix A is zero
+		 */
+		template <class Matrix>
+		inline bool isZero (const Matrix &A) const
+		{
+			return isZeroSpecialized (A, typename MatrixTraits<Matrix>::MatrixCategory ());
+		}
+
+		/** Matrix-matrix addition
+		 * C <- A + B.
+		 *
+		 * Each of A, B, and C must support the same iterator, either row or
+		 * column
+		 *
+		 * @param C Output matrix C
+		 * @param A Input matrix A
+		 * @param B Input matrix B
+		 * @returns Reference to C
+		 */
+		template <class Matrix1, class Matrix2, class Matrix3>
+		inline Matrix1& add (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const
+		{
+			return addSpecialized (C, A, B,
+					       typename MatrixTraits<Matrix1>::MatrixCategory (),
+					       typename MatrixTraits<Matrix2>::MatrixCategory (),
+					       typename MatrixTraits<Matrix3>::MatrixCategory ());
+		}
+
+		/** Matrix-matrix in-place addition
+		 * A <- A + B.
+		 *
+		 * Each of A and B must support the same iterator, either row or column
+		 *
+		 * @param A Input matrix A
+		 * @param B Input matrix B
+		 * @returns Reference to A
+		 */
+		template <class Matrix1, class Matrix2>
+		inline Matrix1& addin (Matrix1 &A, const Matrix2 &B) const
+		{
+			return addinSpecialized (A, B,
+						 typename MatrixTraits<Matrix1>::MatrixCategory (),
+						 typename MatrixTraits<Matrix2>::MatrixCategory ());
+		}
+
+		/** Matrix-matrix subtraction
+		 * C <- A - B.
+		 *
+		 * Each of A, B, and C must support the same iterator, either row or
+		 * column
+		 *
+		 * @param C Output matrix C
+		 * @param A Input matrix A
+		 * @param B Input matrix B
+		 * @returns Reference to C
+		 */
+		template <class Matrix1, class Matrix2, class Matrix3>
+		inline Matrix1 &sub (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const
+		{
+			return subSpecialized (C, A, B,
+					       typename MatrixTraits<Matrix1>::MatrixCategory (),
+					       typename MatrixTraits<Matrix2>::MatrixCategory (),
+					       typename MatrixTraits<Matrix3>::MatrixCategory ());
+		}
+
+		/** Matrix-matrix in-place subtraction
+		 * A <- A - B.
+		 *
+		 * Each of A and B must support the same iterator, either row or column
+		 *
+		 * @param A Input matrix A
+		 * @param B Input matrix B
+		 * @returns Reference to A
+		 */
+		template <class Matrix1, class Matrix2>
+		inline Matrix1 &subin (Matrix1 &A, const Matrix2 &B) const
+		{
+			return subinSpecialized (A, B,
+						 typename MatrixTraits<Matrix1>::MatrixCategory (),
+						 typename MatrixTraits<Matrix2>::MatrixCategory ());
+		}
+
+		/** Matrix negate
+		 * B <- -A.
+		 *
+		 * Each of A and B must support the same iterator, either row or column
+		 *
+		 * @param B Output matrix B
+		 * @param A Input matrix A
+		 * @returns reference to B
+		 */
+		template <class Matrix1, class Matrix2>
+		inline Matrix1 &neg (Matrix1 &B, const Matrix2 &A) const
+		{
+			return negSpecialized (B, A,
+					       typename MatrixTraits<Matrix1>::MatrixCategory (),
+					       typename MatrixTraits<Matrix2>::MatrixCategory ());
+		}
+
+		/** Matrix in-place negate
+		 * A <- -A.
+		 * @param A Input matrix A; result is stored here
+		 */
+		template <class Matrix>
+		inline Matrix &negin (Matrix &A) const
+		{
+			return neginSpecialized (A, typename MatrixTraits<Matrix>::MatrixCategory ());
+		}
+
+		/** Matrix-matrix multiply
+		 * C <- A * B.
+		 *
+		 * C must support both row and column iterators, and the vector
+		 * representations must be dense. Examples of supported matrices are
+		 * \ref DenseMatrixBase and \ref DenseSubmatrix.
+		 *
+		 * Either A or B, or both, may have limited iterators. However, either A
+		 * must support row iterators or B must support column iterators. If
+		 * both A and B lack support for an iterator (either row or column),
+		 * then C must support the same type of iterator as A and B.
+		 *
+		 * @param C Output matrix C
+		 * @param A Input matrix A
+		 * @param B Input matrix B
+		 * @returns Reference to C
+		 */
+		template <class Matrix1, class Matrix2, class Matrix3>
+		inline Matrix1 &mul (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const
+		{
+			return mulSpecialized (C, A, B,
+					       typename MatrixTraits<Matrix1>::MatrixCategory (),
+					       typename MatrixTraits<Matrix2>::MatrixCategory (),
+					       typename MatrixTraits<Matrix3>::MatrixCategory ());
+		}
+
+		/** Matrix-matrix in-place multiply on the left
+		 * B <- A * B.
+		 *
+		 * B should support both row and column iterators, and must be dense. A
+		 * must support row iterators.
+		 *
+		 * @param A Input matrix A
+		 * @param B Input matrix B
+		 * @returns Reference to B
+		 */
+		template <class Matrix1, class Matrix2>
+		inline Matrix2 &leftMulin (const Matrix1 &A, Matrix2 &B) const;
+
+		/** Matrix-matrix in-place multiply on the right
+		 * A <- A * B.
+		 *
+		 * A should support both row and column iterators, and must be dense. B
+		 * must support column iterators.
+		 *
+		 * @param A Input matrix A
+		 * @param B Input matrix B
+		 * @returns Reference to A
+		 */
+		template <class Matrix1, class Matrix2>
+		inline Matrix1 &rightMulin (Matrix1 &A, const Matrix2 &B) const;
+
+		/** Matrix-matrix in-place multiply
+		 * A <- A * B.
+		 *
+		 * This is an alias for \ref rightMulin
+		 *
+		 * @param A Input matrix A
+		 * @param B Input matrix B
+		 * @returns Reference to A
+		 */
+		template <class Matrix1, class Matrix2>
+		inline Matrix1 &mulin (Matrix1 &A, const Matrix2 &B) const
+		{
+			return rightMulin (A, B);
+		}
+
+		/** Matrix-scalar multiply
+		 * C <- B * a.
+		 *
+		 * Multiply B by the scalar element a and store the result in C. B and C
+		 * must support the same iterators.
+		 *
+		 * @param C Output matrix C
+		 * @param B Input matrix B
+		 * @param a Input scalar a
+		 * @returns Reference to C
+		 */
+		template <class Matrix1, class Matrix2>
+		inline Matrix1 &mul (Matrix1 &C, const Matrix2 &B, const typename Field::Element &a) const
+		{
+			return mulSpecialized (C, B, a,
+					       typename MatrixTraits<Matrix1>::MatrixCategory (),
+					       typename MatrixTraits<Matrix2>::MatrixCategory ());
+		}
+
+		/** Matrix-scalar in-place multiply
+		 * B <- B * a.
+		 *
+		 * Multiply B by the scalar element a in-place.
+		 *
+		 * @param B Input matrix B
+		 * @param a Input scalar a
+		 * @returns Reference to B
+		 */
+		template <class Matrix>
+		inline Matrix &mulin (Matrix &B, const typename Field::Element &a) const
+		{
+			return mulinSpecialized (B, a, typename MatrixTraits<Matrix>::MatrixCategory ());
+		}
+
+		/** Matrix-matrix in-place axpy
+		 * Y <- Y + A*X.
+		 *
+		 * This function combines \ref mul and \ref add, eliminating the need
+		 * for an additional temporary in expressions of the form $Y = Y +
+		 * AX$. Only one row of additional storage is required. Y may have
+		 * either efficient row iterators or efficient column iterators, and the
+		 * same restrictions on A and X apply as in \ref mul.
+		 *
+		 * Note that no out-of-place axpy is provided, since it gives no
+		 * benefit. One may just as easily multiply into the result and call
+		 * \ref addin.
+		 *
+		 * @param Y Input matrix Y; result is stored here
+		 * @param A Input matrix A
+		 * @param X Input matrix X
+		 */
+		template <class Matrix1, class Matrix2, class Matrix3>
+		inline Matrix1 &axpyin (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X) const
+		{
+			return axpyinSpecialized (Y, A, X,
+						  typename MatrixTraits<Matrix1>::MatrixCategory (),
+						  typename MatrixTraits<Matrix2>::MatrixCategory (),
+						  typename MatrixTraits<Matrix3>::MatrixCategory ());
+		}
+
+		/*!  General matrix multiply
+		 * \f$ D \gets \alpha A B + \beta C\f$.
+		 * @todo not efficient...
+		 */
+		template <class Matrix1, class Matrix2, class Matrix3>
+		inline Matrix1 &muladd (Matrix1                       & D,
+					const typename Field::Element & beta,
+					const Matrix1                 & C,
+					const typename Field::Element & alpha,
+					const Matrix2                 & A,
+					const Matrix3                 & B) const
+		{
+			mul(D,A,B); // D = AB
+			mulin(D,alpha); // D = alpha D
+			Matrix1 CC(C);
+			mulin(CC,beta);   // C = beta C
+			addin(D,CC);   // D = D+C
+			return D;
+		}
+
+		/*! @todo Need documentation of these methods */
+		//@{
+		template<class Matrix1, class Matrix2>
+		Matrix1 &pow_apply (Matrix1 &M1, const Matrix2 &M2, unsigned long int k) const;
+
+		template<class Matrix1, class Matrix2>
+		Matrix1 &pow_horn (Matrix1 &M1, const Matrix2 &M2, unsigned long int k) const;
+		//@}
+
+
+		/*! @name Matrix-vector arithmetic operations
+		 * These operations take a matrix satisfying the \ref DenseMatrix
+		 * archetype and LinBox vectors as inputs. They involve matrix-vector
+		 * product and matrix-vector AXPY
+		 */
+		//@{
+		/** Matrix-vector multiply
+		 * w <- A * v.
+		 *
+		 * The vectors v and w must be of the same representation (dense, sparse
+		 * sequence, sparse associative, or sparse parallel), but they may be of
+		 * different types. The matrix A may have any representation.
+		 *
+		 * @param w Output vector w
+		 * @param A Input matrix A
+		 * @param v Input vector v
+		 * @returns Reference to w
+		 */
+		template <class Vector1, class Matrix, class Vector2>
+		inline Vector1 &vectorMul (Vector1 &w, const Matrix &A, const Vector2 &v) const
+		{
+			return mulSpecialized (w, A, v, typename MatrixTraits<Matrix>::MatrixCategory ());
+		}
+
+		/** Matrix-vector in-place axpy
+		 * \f$y \gets y + A x\f$.
+		 *
+		 * This function eliminates the requirement for temporary storage when
+		 * one is computing an expression of the form given above.
+		 *
+		 * The vectors y and x must be of the same representation (dense, sparse
+		 * sequence, sparse associative, or sparse parallel), but they may be of
+		 * different types. The matrix A may have any representation.
+		 *
+		 * Note that out-of-place axpy is not provided since it provides no
+		 * benefit -- one can use mul and then addin to exactly the same effect,
+		 * with no additional storage or performance cost.
+		 *
+		 * @param y Input vector y; result is stored here
+		 * @param A Input matrix A
+		 * @param x Input vector x
+		 */
+		template <class Vector1, class Matrix, class Vector2>
+		inline Vector1 &vectorAxpyin (Vector1 &y, const Matrix &A, const Vector2 &x) const
+		{
+			return axpyinSpecialized (y, A, x, typename MatrixTraits<Matrix>::MatrixCategory ());
+		}
+		//@}
+
+		/*! @name Matrix-black box arithmetic operations
+		 * These operations mimic the matrix-matrix arithmetic operations above,
+		 * but one of the parameters is a \ref BlackboxArchetype.
+		 */
+		//@{
+		/** Matrix-black box left-multiply
+		 * C <- A * B.
+		 *
+		 * Both C and B must support column iterators
+		 *
+		 * @param C Output matrix
+		 * @param A Black box for A
+		 * @param B Matrix B
+		 */
+		template <class Matrix1, class Blackbox, class Matrix2>
+		inline Matrix1 &blackboxMulLeft (Matrix1 &C, const Blackbox &A, const Matrix2 &B) const;
+
+		/** Matrix-black box right-multiply
+		 * C <- A * B.
+		 *
+		 * Both C and A must support row iterators
+		 *
+		 * @param C Output matrix
+		 * @param A Matrix A
+		 * @param B Black box for B
+		 */
+		template <class Matrix1, class Matrix2, class Blackbox>
+		inline Matrix1 &blackboxMulRight (Matrix1 &C, const Matrix2 &A, const Blackbox &B) const;
+		//@}
+
+		/*! @name Matrix permutations
+		 * @brief
+		 * These operations permute the rows or columns of a matrix based on
+		 * the given permutation. They are intended for use with Gauss-Jordan
+		 * elimination
+		 */
+		//@{
+		/// Transposition.
+		typedef std::pair<unsigned int, unsigned int> Transposition;
+		/** Permutation.
+		 *
+		 * A permutation is represented as a vector of pairs, each
+		 * pair representing a transposition.
+		 */
+		typedef std::vector<Transposition> Permutation;
+
+
+		/** Permute the rows of the given matrix.
+		 *
+		 * @param A Output matrix
+		 * @param P_start Start of permutation
+		 * @param P_end End of permutation
+		 * @returns Reference to A
+		 */
+		template <class Matrix, class Iterator>
+		inline Matrix &permuteRows (Matrix   &A,
+					    Iterator  P_start,
+					    Iterator  P_end) const
+		{
+			return permuteRowsSpecialized (A, P_start, P_end,
+						       typename MatrixTraits<Matrix>::MatrixCategory ());
+		}
+
+		/** Permute the columns of the given matrix.
+		 *
+		 * @param A Output matrix
+		 * @param P_start Start of permutation
+		 * @param P_end End of permutation
+		 * @returns Reference to A
+		 */
+		template <class Matrix, class Iterator>
+		inline Matrix &permuteColumns (Matrix   &A,
+					       Iterator  P_start,
+					       Iterator  P_end) const
+		{
+			return permuteColsSpecialized (A, P_start, P_end,
+						       typename MatrixTraits<Matrix>::MatrixCategory ());
+		}
+		//@}
+
+	private:
+
+		// Specialized function implementations
+		template <class Matrix1, class Matrix2> Matrix1 &copyRow (Matrix1 &B, const Matrix2 &A) const;
+		template <class Matrix1, class Matrix2> Matrix1 &copyCol (Matrix1 &B, const Matrix2 &A) const;
+
+		template <class Matrix1, class Matrix2>
+		inline Matrix1 &copySpecialized (Matrix1 &B, const Matrix2 &A,
+						 MatrixCategories::RowMatrixTag,
+						 MatrixCategories::RowMatrixTag) const
+		{
+			return copyRow (B, A);
+		}
+		template <class Matrix1, class Matrix2>
+		inline Matrix1 &copySpecialized (Matrix1 &B, const Matrix2 &A,
+						 MatrixCategories::ColMatrixTag,
+						 MatrixCategories::ColMatrixTag) const
+		{
+			return copyCol (B, A);
+		}
+		template <class Matrix1, class Matrix2>
+		inline Matrix1 &copySpecialized (Matrix1 &B, const Matrix2 &A,
+						 MatrixCategories::RowColMatrixTag,
+						 MatrixCategories::RowColMatrixTag) const
+		{
+			return copyRow (B, A);
+		}
+
+		template <class Matrix1, class Matrix2> bool areEqualRow (const Matrix1 &A, const Matrix2 &B) const;
+		template <class Matrix1, class Matrix2> bool areEqualCol (const Matrix1 &A, const Matrix2 &B) const;
+
+		template <class Matrix1, class Matrix2>
+		inline bool areEqualSpecialized (const Matrix1 &A, const Matrix2 &B,
+						 MatrixCategories::RowMatrixTag,
+						 MatrixCategories::RowMatrixTag) const
+		{
+			return areEqualRow (A, B);
+		}
+		template <class Matrix1, class Matrix2>
+		inline bool areEqualSpecialized (const Matrix1 &A, const Matrix2 &B,
+						 MatrixCategories::ColMatrixTag,
+						 MatrixCategories::ColMatrixTag) const
+		{
+			return areEqualCol (A, B);
+		}
+		template <class Matrix1, class Matrix2>
+		inline bool areEqualSpecialized (const Matrix1 &A, const Matrix2 &B,
+						 MatrixCategories::RowColMatrixTag,
+						 MatrixCategories::RowColMatrixTag) const
+		{
+			return areEqualRow (A, B);
+		}
+
+		template <class Matrix> bool isZeroRow (const Matrix &v) const;
+		template <class Matrix> bool isZeroCol (const Matrix &v) const;
+
+		template <class Matrix>
+		bool isZeroSpecialized (const Matrix &A, MatrixCategories::RowMatrixTag) const
+		{
+			return isZeroRow (A);
+		}
+		template <class Matrix>
+		bool isZeroSpecialized (const Matrix &A, MatrixCategories::ColMatrixTag) const
+		{
+			return isZeroCol (A);
+		}
+		template <class Matrix>
+		bool isZeroSpecialized (const Matrix &A, MatrixCategories::RowColMatrixTag) const
+		{
+			return isZeroRow (A);
+		}
+
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1& addRow (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const;
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1& addCol (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const;
+
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1& addSpecialized (Matrix1 &C, const Matrix2 &A, const Matrix3 &B,
+					 MatrixCategories::RowMatrixTag,
+					 MatrixCategories::RowMatrixTag,
+					 MatrixCategories::RowMatrixTag) const
+		{
+			return addRow (C, A, B);
+		}
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1& addSpecialized (Matrix1 &C, const Matrix2 &A, const Matrix3 &B,
+					 MatrixCategories::ColMatrixTag,
+					 MatrixCategories::ColMatrixTag,
+					 MatrixCategories::ColMatrixTag) const
+		{
+			return addCol (C, A, B);
+		}
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1& addSpecialized (Matrix1 &C, const Matrix2 &A, const Matrix3 &B,
+					 MatrixCategories::RowColMatrixTag,
 					 MatrixCategories::RowColMatrixTag,
 					 MatrixCategories::RowColMatrixTag) const
-		{ return copyRow (B, A); }
-
-	template <class Matrix1, class Matrix2> bool areEqualRow (const Matrix1 &A, const Matrix2 &B) const;
-	template <class Matrix1, class Matrix2> bool areEqualCol (const Matrix1 &A, const Matrix2 &B) const;
-
-	template <class Matrix1, class Matrix2>
-	inline bool areEqualSpecialized (const Matrix1 &A, const Matrix2 &B,
-				  MatrixCategories::RowMatrixTag,
-				  MatrixCategories::RowMatrixTag) const
-		{ return areEqualRow (A, B); }
-	template <class Matrix1, class Matrix2>
-	inline bool areEqualSpecialized (const Matrix1 &A, const Matrix2 &B,
-				  MatrixCategories::ColMatrixTag,
-				  MatrixCategories::ColMatrixTag) const
-		{ return areEqualCol (A, B); }
-	template <class Matrix1, class Matrix2>
-	inline bool areEqualSpecialized (const Matrix1 &A, const Matrix2 &B,
-				  MatrixCategories::RowColMatrixTag,
-				  MatrixCategories::RowColMatrixTag) const
-		{ return areEqualRow (A, B); }
-
-	template <class Matrix> bool isZeroRow (const Matrix &v) const;
-	template <class Matrix> bool isZeroCol (const Matrix &v) const;
+		{
+			return addRow (C, A, B);
+		}
+
+		template <class Matrix1, class Matrix2> Matrix1& addinRow (Matrix1 &A, const Matrix2 &B) const;
+		template <class Matrix1, class Matrix2> Matrix1& addinCol (Matrix1 &A, const Matrix2 &B) const;
+
+		template <class Matrix1, class Matrix2>
+		inline Matrix1& addinSpecialized (Matrix1 &A, const Matrix2 &B,
+						  MatrixCategories::RowMatrixTag,
+						  MatrixCategories::RowMatrixTag) const
+		{
+			return addinRow (A, B);
+		}
+		template <class Matrix1, class Matrix2>
+		inline Matrix1& addinSpecialized (Matrix1 &A, const Matrix2 &B,
+						  MatrixCategories::ColMatrixTag,
+						  MatrixCategories::ColMatrixTag) const
+		{
+			return addinCol (A, B);
+		}
+		template <class Matrix1, class Matrix2>
+		inline Matrix1& addinSpecialized (Matrix1 &A, const Matrix2 &B,
+						  MatrixCategories::RowColMatrixTag,
+						  MatrixCategories::RowColMatrixTag) const
+		{
+			return addinRow (A, B);
+		}
+
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1& subRow (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const;
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1& subCol (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const;
+
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1& subSpecialized (Matrix1 &C, const Matrix2 &A, const Matrix3 &B,
+					 MatrixCategories::RowMatrixTag,
+					 MatrixCategories::RowMatrixTag,
+					 MatrixCategories::RowMatrixTag) const
+		{
+			return subRow (C, A, B);
+		}
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1& subSpecialized (Matrix1 &C, const Matrix2 &A, const Matrix3 &B,
+					 MatrixCategories::ColMatrixTag,
+					 MatrixCategories::ColMatrixTag,
+					 MatrixCategories::ColMatrixTag) const
+		{
+			return subCol (C, A, B);
+		}
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1& subSpecialized (Matrix1 &C, const Matrix2 &A, const Matrix3 &B,
+					 MatrixCategories::RowColMatrixTag,
+					 MatrixCategories::RowColMatrixTag,
+					 MatrixCategories::RowColMatrixTag) const
+		{
+			return subRow (C, A, B);
+		}
+
+		template <class Matrix1, class Matrix2> Matrix1& subinRow (Matrix1 &A, const Matrix2 &B) const;
+		template <class Matrix1, class Matrix2> Matrix1& subinCol (Matrix1 &A, const Matrix2 &B) const;
+
+		template <class Matrix1, class Matrix2>
+		Matrix1& subinSpecialized (Matrix1 &A, const Matrix2 &B,
+					   MatrixCategories::RowMatrixTag,
+					   MatrixCategories::RowMatrixTag) const
+		{
+			return subinRow (A, B);
+		}
+		template <class Matrix1, class Matrix2>
+		Matrix1& subinSpecialized (Matrix1 &A, const Matrix2 &B,
+					   MatrixCategories::ColMatrixTag,
+					   MatrixCategories::ColMatrixTag) const
+		{
+			return subinCol (A, B);
+		}
+		template <class Matrix1, class Matrix2>
+		Matrix1& subinSpecialized (Matrix1 &A, const Matrix2 &B,
+					   MatrixCategories::RowColMatrixTag,
+					   MatrixCategories::RowColMatrixTag) const
+		{
+			return subinRow (A, B);
+		}
+
+		template <class Matrix1, class Matrix2> Matrix1& negRow (Matrix1 &A, const Matrix2 &B) const;
+		template <class Matrix1, class Matrix2> Matrix1& negCol (Matrix1 &A, const Matrix2 &B) const;
+
+		template <class Matrix1, class Matrix2>
+		inline Matrix1& negSpecialized (Matrix1 &A, const Matrix2 &B,
+						MatrixCategories::RowMatrixTag,
+						MatrixCategories::RowMatrixTag) const
+		{
+			return negRow (A, B);
+		}
+		template <class Matrix1, class Matrix2>
+		inline Matrix1& negSpecialized (Matrix1 &A, const Matrix2 &B,
+						MatrixCategories::ColMatrixTag,
+						MatrixCategories::ColMatrixTag) const
+		{
+			return negCol (A, B);
+		}
+		template <class Matrix1, class Matrix2>
+		inline Matrix1& negSpecialized (Matrix1 &A, const Matrix2 &B,
+						MatrixCategories::RowColMatrixTag,
+						MatrixCategories::RowColMatrixTag) const
+		{
+			return negRow (A, B);
+		}
+
+		template <class Matrix> Matrix &neginRow (Matrix &A) const;
+		template <class Matrix> Matrix &neginCol (Matrix &A) const;
+
+		template <class Matrix>
+		Matrix &neginSpecialized (Matrix &A, MatrixCategories::RowMatrixTag) const
+		{
+			return neginRow (A);
+		}
+		template <class Matrix>
+		Matrix &neginSpecialized (Matrix &A, MatrixCategories::ColMatrixTag) const
+		{
+			return neginCol (A);
+		}
+		template <class Matrix>
+		Matrix &neginSpecialized (Matrix &A, MatrixCategories::RowColMatrixTag) const
+		{
+			return neginRow (A);
+		}
+
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1 &mulRowRowCol (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const;
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1 &mulColRowCol (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const;
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1 &mulRowRowRow (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const;
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1 &mulColColCol (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const;
+
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1 &mulSpecialized (Matrix1 &C, const Matrix2 &A, const Matrix3 &B,
+					 MatrixCategories::RowMatrixTag,
+					 MatrixCategories::RowMatrixTag,
+					 MatrixCategories::ColMatrixTag) const
+		{
+			return mulRowRowCol (C, A, B);
+		}
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1 &mulSpecialized (Matrix1 &C, const Matrix2 &A, const Matrix3 &B,
+					 MatrixCategories::ColMatrixTag,
+					 MatrixCategories::RowMatrixTag,
+					 MatrixCategories::ColMatrixTag) const
+		{
+			return mulColRowCol (C, A, B);
+		}
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1 &mulSpecialized (Matrix1 &C, const Matrix2 &A, const Matrix3 &B,
+					 MatrixCategories::RowColMatrixTag,
+					 MatrixCategories::RowMatrixTag,
+					 MatrixCategories::ColMatrixTag) const
+		{
+			return mulRowRowCol (C, A, B);
+		}
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1 &mulSpecialized (Matrix1 &C, const Matrix2 &A, const Matrix3 &B,
+					 MatrixCategories::RowMatrixTag,
+					 MatrixCategories::RowMatrixTag,
+					 MatrixCategories::RowMatrixTag) const
+		{
+			return mulRowRowRow (C, A, B);
+		}
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1 &mulSpecialized (Matrix1 &C, const Matrix2 &A, const Matrix3 &B,
+					 MatrixCategories::ColMatrixTag,
+					 MatrixCategories::ColMatrixTag,
+					 MatrixCategories::ColMatrixTag) const
+		{
+			return mulColColCol (C, A, B);
+		}
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1 &mulSpecialized (Matrix1 &C, const Matrix2 &A, const Matrix3 &B,
+					 MatrixCategories::RowColMatrixTag,
+					 MatrixCategories::RowColMatrixTag,
+					 MatrixCategories::RowColMatrixTag) const
+		{
+			return mulRowRowCol (C, A, B);
+		}
+
+		template <class Matrix1, class Matrix2>
+		Matrix1 &mulRow (Matrix1 &C, const Matrix2 &B, const typename Field::Element &a) const;
+		template <class Matrix1, class Matrix2>
+		Matrix1 &mulCol (Matrix1 &C, const Matrix2 &B, const typename Field::Element &a) const;
+
+		template <class Matrix1, class Matrix2>
+		Matrix1 &mulSpecialized (Matrix1 &C, const Matrix2 &B, const typename Field::Element &a,
+					 MatrixCategories::RowMatrixTag,
+					 MatrixCategories::RowMatrixTag) const
+		{
+			return mulRow (C, B, a);
+		}
+		template <class Matrix1, class Matrix2>
+		Matrix1 &mulSpecialized (Matrix1 &C, const Matrix2 &B, const typename Field::Element &a,
+					 MatrixCategories::ColMatrixTag,
+					 MatrixCategories::ColMatrixTag) const
+		{
+			return mulCol (C, B, a);
+		}
+		template <class Matrix1, class Matrix2>
+		Matrix1 &mulSpecialized (Matrix1 &C, const Matrix2 &B, const typename Field::Element &a,
+					 MatrixCategories::RowColMatrixTag,
+					 MatrixCategories::RowColMatrixTag) const
+		{
+			return mulRow (C, B, a);
+		}
 
-	template <class Matrix>
-	bool isZeroSpecialized (const Matrix &A, MatrixCategories::RowMatrixTag) const
-		{ return isZeroRow (A); }
-	template <class Matrix>
-	bool isZeroSpecialized (const Matrix &A, MatrixCategories::ColMatrixTag) const
-		{ return isZeroCol (A); }
-	template <class Matrix>
-	bool isZeroSpecialized (const Matrix &A, MatrixCategories::RowColMatrixTag) const
-		{ return isZeroRow (A); }
-
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1& addRow (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const;
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1& addCol (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const;
-
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1& addSpecialized (Matrix1 &C, const Matrix2 &A, const Matrix3 &B,
-				 MatrixCategories::RowMatrixTag,
-				 MatrixCategories::RowMatrixTag,
-				 MatrixCategories::RowMatrixTag) const
-		{ return addRow (C, A, B); }
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1& addSpecialized (Matrix1 &C, const Matrix2 &A, const Matrix3 &B,
-				 MatrixCategories::ColMatrixTag,
-				 MatrixCategories::ColMatrixTag,
-				 MatrixCategories::ColMatrixTag) const
-		{ return addCol (C, A, B); }
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1& addSpecialized (Matrix1 &C, const Matrix2 &A, const Matrix3 &B,
-				 MatrixCategories::RowColMatrixTag,
-				 MatrixCategories::RowColMatrixTag,
-				 MatrixCategories::RowColMatrixTag) const
-		{ return addRow (C, A, B); }
-
-	template <class Matrix1, class Matrix2> Matrix1& addinRow (Matrix1 &A, const Matrix2 &B) const;
-	template <class Matrix1, class Matrix2> Matrix1& addinCol (Matrix1 &A, const Matrix2 &B) const;
-
-	template <class Matrix1, class Matrix2>
-	inline Matrix1& addinSpecialized (Matrix1 &A, const Matrix2 &B,
-					  MatrixCategories::RowMatrixTag,
+		template <class Matrix> Matrix &mulinRow (Matrix &B, const typename Field::Element &a) const;
+		template <class Matrix> Matrix &mulinCol (Matrix &B, const typename Field::Element &a) const;
+
+		template <class Matrix>
+		Matrix &mulinSpecialized (Matrix &B, const typename Field::Element &a,
 					  MatrixCategories::RowMatrixTag) const
-		{ return addinRow (A, B); }
-	template <class Matrix1, class Matrix2>
-	inline Matrix1& addinSpecialized (Matrix1 &A, const Matrix2 &B,
-					  MatrixCategories::ColMatrixTag,
+		{
+			return mulinRow (B, a);
+		}
+		template <class Matrix>
+		Matrix &mulinSpecialized (Matrix &B, const typename Field::Element &a,
 					  MatrixCategories::ColMatrixTag) const
-		{ return addinCol (A, B); }
-	template <class Matrix1, class Matrix2>
-	inline Matrix1& addinSpecialized (Matrix1 &A, const Matrix2 &B,
-					  MatrixCategories::RowColMatrixTag,
+		{
+			return mulinCol (B, a);
+		}
+		template <class Matrix>
+		Matrix &mulinSpecialized (Matrix &B, const typename Field::Element &a,
 					  MatrixCategories::RowColMatrixTag) const
-		{ return addinRow (A, B); }
-
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1& subRow (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const;
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1& subCol (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const;
-
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1& subSpecialized (Matrix1 &C, const Matrix2 &A, const Matrix3 &B,
-				 MatrixCategories::RowMatrixTag,
-				 MatrixCategories::RowMatrixTag,
-				 MatrixCategories::RowMatrixTag) const
-		{ return subRow (C, A, B); }
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1& subSpecialized (Matrix1 &C, const Matrix2 &A, const Matrix3 &B,
-				 MatrixCategories::ColMatrixTag,
-				 MatrixCategories::ColMatrixTag,
-				 MatrixCategories::ColMatrixTag) const
-		{ return subCol (C, A, B); }
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1& subSpecialized (Matrix1 &C, const Matrix2 &A, const Matrix3 &B,
-				 MatrixCategories::RowColMatrixTag,
-				 MatrixCategories::RowColMatrixTag,
-				 MatrixCategories::RowColMatrixTag) const
-		{ return subRow (C, A, B); }
-
-	template <class Matrix1, class Matrix2> Matrix1& subinRow (Matrix1 &A, const Matrix2 &B) const;
-	template <class Matrix1, class Matrix2> Matrix1& subinCol (Matrix1 &A, const Matrix2 &B) const;
-
-	template <class Matrix1, class Matrix2>
-	Matrix1& subinSpecialized (Matrix1 &A, const Matrix2 &B,
-				   MatrixCategories::RowMatrixTag,
-				   MatrixCategories::RowMatrixTag) const
-		{ return subinRow (A, B); }
-	template <class Matrix1, class Matrix2>
-	Matrix1& subinSpecialized (Matrix1 &A, const Matrix2 &B,
-				   MatrixCategories::ColMatrixTag,
-				   MatrixCategories::ColMatrixTag) const
-		{ return subinCol (A, B); }
-	template <class Matrix1, class Matrix2>
-	Matrix1& subinSpecialized (Matrix1 &A, const Matrix2 &B,
-				   MatrixCategories::RowColMatrixTag,
-				   MatrixCategories::RowColMatrixTag) const
-		{ return subinRow (A, B); }
-
-	template <class Matrix1, class Matrix2> Matrix1& negRow (Matrix1 &A, const Matrix2 &B) const;
-	template <class Matrix1, class Matrix2> Matrix1& negCol (Matrix1 &A, const Matrix2 &B) const;
-
-	template <class Matrix1, class Matrix2>
-	inline Matrix1& negSpecialized (Matrix1 &A, const Matrix2 &B,
-					MatrixCategories::RowMatrixTag,
-					MatrixCategories::RowMatrixTag) const
-		{ return negRow (A, B); }
-	template <class Matrix1, class Matrix2>
-	inline Matrix1& negSpecialized (Matrix1 &A, const Matrix2 &B,
-					MatrixCategories::ColMatrixTag,
-					MatrixCategories::ColMatrixTag) const
-		{ return negCol (A, B); }
-	template <class Matrix1, class Matrix2>
-	inline Matrix1& negSpecialized (Matrix1 &A, const Matrix2 &B,
-					MatrixCategories::RowColMatrixTag,
-					MatrixCategories::RowColMatrixTag) const
-		{ return negRow (A, B); }
-
-	template <class Matrix> Matrix &neginRow (Matrix &A) const;
-	template <class Matrix> Matrix &neginCol (Matrix &A) const;
-
-	template <class Matrix>
-	Matrix &neginSpecialized (Matrix &A, MatrixCategories::RowMatrixTag) const
-		{ return neginRow (A); }
-	template <class Matrix>
-	Matrix &neginSpecialized (Matrix &A, MatrixCategories::ColMatrixTag) const
-		{ return neginCol (A); }
-	template <class Matrix>
-	Matrix &neginSpecialized (Matrix &A, MatrixCategories::RowColMatrixTag) const
-		{ return neginRow (A); }
-
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1 &mulRowRowCol (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const;
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1 &mulColRowCol (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const;
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1 &mulRowRowRow (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const;
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1 &mulColColCol (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const;
-
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1 &mulSpecialized (Matrix1 &C, const Matrix2 &A, const Matrix3 &B,
-				 MatrixCategories::RowMatrixTag,
-				 MatrixCategories::RowMatrixTag,
-				 MatrixCategories::ColMatrixTag) const
-		{ return mulRowRowCol (C, A, B); }
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1 &mulSpecialized (Matrix1 &C, const Matrix2 &A, const Matrix3 &B,
-				 MatrixCategories::ColMatrixTag,
-				 MatrixCategories::RowMatrixTag,
-				 MatrixCategories::ColMatrixTag) const
-		{ return mulColRowCol (C, A, B); }
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1 &mulSpecialized (Matrix1 &C, const Matrix2 &A, const Matrix3 &B,
-				 MatrixCategories::RowColMatrixTag,
-				 MatrixCategories::RowMatrixTag,
-				 MatrixCategories::ColMatrixTag) const
-		{ return mulRowRowCol (C, A, B); }
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1 &mulSpecialized (Matrix1 &C, const Matrix2 &A, const Matrix3 &B,
-				 MatrixCategories::RowMatrixTag,
-				 MatrixCategories::RowMatrixTag,
-				 MatrixCategories::RowMatrixTag) const
-		{ return mulRowRowRow (C, A, B); }
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1 &mulSpecialized (Matrix1 &C, const Matrix2 &A, const Matrix3 &B,
-				 MatrixCategories::ColMatrixTag,
-				 MatrixCategories::ColMatrixTag,
-				 MatrixCategories::ColMatrixTag) const
-		{ return mulColColCol (C, A, B); }
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1 &mulSpecialized (Matrix1 &C, const Matrix2 &A, const Matrix3 &B,
-				 MatrixCategories::RowColMatrixTag,
-				 MatrixCategories::RowColMatrixTag,
-				 MatrixCategories::RowColMatrixTag) const
-		{ return mulRowRowCol (C, A, B); }
-
-	template <class Matrix1, class Matrix2>
-	Matrix1 &mulRow (Matrix1 &C, const Matrix2 &B, const typename Field::Element &a) const;
-	template <class Matrix1, class Matrix2>
-	Matrix1 &mulCol (Matrix1 &C, const Matrix2 &B, const typename Field::Element &a) const;
-
-	template <class Matrix1, class Matrix2>
-	Matrix1 &mulSpecialized (Matrix1 &C, const Matrix2 &B, const typename Field::Element &a,
-				 MatrixCategories::RowMatrixTag,
-				 MatrixCategories::RowMatrixTag) const
-		{ return mulRow (C, B, a); }
-	template <class Matrix1, class Matrix2>
-	Matrix1 &mulSpecialized (Matrix1 &C, const Matrix2 &B, const typename Field::Element &a,
-				 MatrixCategories::ColMatrixTag,
-				 MatrixCategories::ColMatrixTag) const
-		{ return mulCol (C, B, a); }
-	template <class Matrix1, class Matrix2>
-	Matrix1 &mulSpecialized (Matrix1 &C, const Matrix2 &B, const typename Field::Element &a,
-				 MatrixCategories::RowColMatrixTag,
-				 MatrixCategories::RowColMatrixTag) const
-		{ return mulRow (C, B, a); }
-
-	template <class Matrix> Matrix &mulinRow (Matrix &B, const typename Field::Element &a) const;
-	template <class Matrix> Matrix &mulinCol (Matrix &B, const typename Field::Element &a) const;
-
-	template <class Matrix>
-	Matrix &mulinSpecialized (Matrix &B, const typename Field::Element &a,
-				  MatrixCategories::RowMatrixTag) const
-		{ return mulinRow (B, a); }
-	template <class Matrix>
-	Matrix &mulinSpecialized (Matrix &B, const typename Field::Element &a,
-				  MatrixCategories::ColMatrixTag) const
-		{ return mulinCol (B, a); }
-	template <class Matrix>
-	Matrix &mulinSpecialized (Matrix &B, const typename Field::Element &a,
-				  MatrixCategories::RowColMatrixTag) const
-		{ return mulinRow (B, a); }
-
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1 &axpyinRowRowCol (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X) const;
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1 &axpyinColRowCol (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X) const;
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1 &axpyinRowRowRow (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X) const;
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1 &axpyinColColCol (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X) const;
-
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1 &axpyinSpecialized (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X,
-				    MatrixCategories::RowMatrixTag,
-				    MatrixCategories::RowMatrixTag,
-				    MatrixCategories::ColMatrixTag) const
-		{ return axpyinRowRowCol (Y, A, X); }
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1 &axpyinSpecialized (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X,
-				    MatrixCategories::ColMatrixTag,
-				    MatrixCategories::RowMatrixTag,
-				    MatrixCategories::ColMatrixTag) const
-		{ return axpyinColRowCol (Y, A, X); }
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1 &axpyinSpecialized (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X,
-				    MatrixCategories::RowColMatrixTag,
-				    MatrixCategories::RowMatrixTag,
-				    MatrixCategories::ColMatrixTag) const
-		{ return axpyinRowRowCol (Y, A, X); }
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1 &axpyinSpecialized (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X,
-				    MatrixCategories::RowMatrixTag,
-				    MatrixCategories::RowMatrixTag,
-				    MatrixCategories::RowMatrixTag) const
-		{ return axpyinRowRowRow (Y, A, X); }
-	
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1 &axpyinSpecialized (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X,
-				    MatrixCategories::ColMatrixTag,
-				    MatrixCategories::ColMatrixTag,
-				    MatrixCategories::ColMatrixTag) const
-	{ return axpyinColColCol (Y, A, X); }
-
-	template <class Matrix1, class Matrix2, class Matrix3>
-	Matrix1 &axpyinSpecialized (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X,
-				    MatrixCategories::RowColMatrixTag,
-				    MatrixCategories::RowColMatrixTag,
-				    MatrixCategories::RowColMatrixTag) const
-		{ return axpyinRowRowCol (Y, A, X); }
-
-	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &mulRowSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-				 VectorCategories::DenseVectorTag) const;
-	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &mulRowSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-				 VectorCategories::SparseSequenceVectorTag) const;
-	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &mulRowSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-				 VectorCategories::SparseAssociativeVectorTag) const;
-	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &mulRowSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-				 VectorCategories::SparseParallelVectorTag) const;
-
-	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &mulColSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-				    VectorCategories::DenseVectorTag,
-				    VectorCategories::DenseVectorTag) const
-	{ return mulColDense (_VD, w, A, v); } 
-	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &mulColSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-				    VectorCategories::DenseVectorTag,
-				    VectorCategories::SparseSequenceVectorTag) const;
-	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &mulColSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-				    VectorCategories::DenseVectorTag,
-				    VectorCategories::SparseAssociativeVectorTag) const;
-	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &mulColSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-				    VectorCategories::DenseVectorTag,
-				    VectorCategories::SparseParallelVectorTag) const;
-
-	template <class Vector1, class Matrix, class Vector2>
-	inline Vector1 &mulColSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-					   VectorCategories::GenericVectorTag,
-					   VectorCategories::GenericVectorTag) const
-	{
-		typename LinBox::Vector<Field>::Dense y;
-
-		VectorWrapper::ensureDim (y, w.size ());
-
-		VectorWrapper::ensureDim (y, w.size ());
-
-		vectorMul (y, A, v);
-		_VD.copy (w, y);
-
-		return w;
-	}
-
-	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &mulSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-				 MatrixCategories::RowMatrixTag) const
-		{ return mulRowSpecialized (w, A, v, typename VectorTraits<Vector1>::VectorCategory ()); }
-	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &mulSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-				 MatrixCategories::ColMatrixTag) const
-		{ return mulColSpecialized (w, A, v,
-					    typename VectorTraits<Vector1>::VectorCategory (),
-					    typename VectorTraits<Vector2>::VectorCategory ()); }
-	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &mulSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-				 MatrixCategories::RowColMatrixTag) const
-		{ return mulRowSpecialized (w, A, v, typename VectorTraits<Vector1>::VectorCategory ()); }
-
-	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &axpyinRowSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
-				       VectorCategories::DenseVectorTag) const;
-	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &axpyinRowSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
-				       VectorCategories::SparseSequenceVectorTag) const;
-	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &axpyinRowSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
-				       VectorCategories::SparseAssociativeVectorTag) const;
-	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &axpyinRowSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
-				       VectorCategories::SparseParallelVectorTag) const;
-
-	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &axpyinColSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
-				       VectorCategories::DenseVectorTag) const;
-	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &axpyinColSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
-				       VectorCategories::SparseSequenceVectorTag) const;
-	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &axpyinColSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
-				       VectorCategories::SparseAssociativeVectorTag) const;
-	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &axpyinColSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
-				       VectorCategories::SparseParallelVectorTag) const;
-
-	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &axpyinSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
-				    MatrixCategories::RowMatrixTag) const
-		{ return axpyinRowSpecialized (y, A, x, typename VectorTraits<Vector1>::VectorCategory ()); }
-	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &axpyinSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
-				    MatrixCategories::ColMatrixTag) const
-		{ return axpyinColSpecialized (y, A, x, typename VectorTraits<Vector1>::VectorCategory ()); }
-	template <class Vector1, class Matrix, class Vector2>
-	Vector1 &axpyinSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
-				    MatrixCategories::RowColMatrixTag) const
-		{ return axpyinRowSpecialized (y, A, x, typename VectorTraits<Vector1>::VectorCategory ()); }
-
-	template <class Matrix, class Iterator>
-	inline Matrix &permuteRowsByRow (Matrix   &A,
-					 Iterator  P_start,
-					 Iterator  P_end) const;
-
-	template <class Matrix, class Iterator>
-	inline Matrix &permuteRowsByCol (Matrix   &A,
-					 Iterator  P_start,
-					 Iterator  P_end) const;
-
-	template <class Matrix, class Iterator>
-	inline Matrix &permuteRowsSpecialized (Matrix   &A,
-					       Iterator  P_start,
-					       Iterator  P_end,
-					       MatrixCategories::RowColMatrixTag) const
-		{ return permuteRowsByCol (A, P_start, P_end); }
-
-	template <class Matrix, class Iterator>
-	inline Matrix &permuteRowsSpecialized (Matrix   &A,
-					       Iterator  P_start,
-					       Iterator  P_end,
-					       MatrixCategories::RowMatrixTag) const
-		{ return permuteRowsByRow (A, P_start, P_end); }
-
-	template <class Matrix, class Iterator>
-	inline Matrix &permuteRowsSpecialized (Matrix   &A,
-					       Iterator  P_start,
-					       Iterator  P_end,
-					       MatrixCategories::ColMatrixTag) const
-		{ return permuteRowsByCol (A, P_start, P_end); }
-
-	template <class Matrix, class Iterator>
-	inline Matrix &permuteColsByRow (Matrix   &A,
-					 Iterator  P_start,
-					 Iterator  P_end) const;
-
-	template <class Matrix, class Iterator>
-	inline Matrix &permuteColsByCol (Matrix   &A,
-					 Iterator  P_start,
-					 Iterator  P_end) const;
-
-	template <class Matrix, class Iterator>
-	inline Matrix &permuteColsSpecialized (Matrix   &A,
-					       Iterator  P_start,
-					       Iterator  P_end,
-					       MatrixCategories::RowColMatrixTag) const
-		{ return permuteColsByRow (A, P_start, P_end); }
-
-	template <class Matrix, class Iterator>
-	inline Matrix &permuteColsSpecialized (Matrix   &A,
-					       Iterator  P_start,
-					       Iterator  P_end,
-					       MatrixCategories::RowMatrixTag) const
-		{ return permuteColsByRow (A, P_start, P_end); }
-
-	template <class Matrix, class Iterator>
-	inline Matrix &permuteColsSpecialized (Matrix   &A,
-					       Iterator  P_start,
-					       Iterator  P_end,
-					       MatrixCategories::ColMatrixTag) const
-		{ return permuteColsByCol (A, P_start, P_end); }
-
-	const Field         &_F;
-	VectorDomain<Field>  _VD;
-};
+		{
+			return mulinRow (B, a);
+		}
+
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1 &axpyinRowRowCol (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X) const;
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1 &axpyinColRowCol (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X) const;
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1 &axpyinRowRowRow (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X) const;
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1 &axpyinColColCol (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X) const;
+
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1 &axpyinSpecialized (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X,
+					    MatrixCategories::RowMatrixTag,
+					    MatrixCategories::RowMatrixTag,
+					    MatrixCategories::ColMatrixTag) const
+		{
+			return axpyinRowRowCol (Y, A, X);
+		}
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1 &axpyinSpecialized (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X,
+					    MatrixCategories::ColMatrixTag,
+					    MatrixCategories::RowMatrixTag,
+					    MatrixCategories::ColMatrixTag) const
+		{
+			return axpyinColRowCol (Y, A, X);
+		}
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1 &axpyinSpecialized (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X,
+					    MatrixCategories::RowColMatrixTag,
+					    MatrixCategories::RowMatrixTag,
+					    MatrixCategories::ColMatrixTag) const
+		{
+			return axpyinRowRowCol (Y, A, X);
+		}
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1 &axpyinSpecialized (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X,
+					    MatrixCategories::RowMatrixTag,
+					    MatrixCategories::RowMatrixTag,
+					    MatrixCategories::RowMatrixTag) const
+		{
+			return axpyinRowRowRow (Y, A, X);
+		}
+
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1 &axpyinSpecialized (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X,
+					    MatrixCategories::ColMatrixTag,
+					    MatrixCategories::ColMatrixTag,
+					    MatrixCategories::ColMatrixTag) const
+		{
+			return axpyinColColCol (Y, A, X);
+		}
+
+		template <class Matrix1, class Matrix2, class Matrix3>
+		Matrix1 &axpyinSpecialized (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X,
+					    MatrixCategories::RowColMatrixTag,
+					    MatrixCategories::RowColMatrixTag,
+					    MatrixCategories::RowColMatrixTag) const
+		{
+			return axpyinRowRowCol (Y, A, X);
+		}
+
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulRowSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+					    VectorCategories::DenseVectorTag) const;
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulRowSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+					    VectorCategories::SparseSequenceVectorTag) const;
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulRowSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+					    VectorCategories::SparseAssociativeVectorTag) const;
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulRowSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+					    VectorCategories::SparseParallelVectorTag) const;
+
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+					    VectorCategories::DenseVectorTag,
+					    VectorCategories::DenseVectorTag) const
+		{
+			return mulColDense (_VD, w, A, v);
+		}
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+					    VectorCategories::DenseVectorTag,
+					    VectorCategories::SparseSequenceVectorTag) const;
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+					    VectorCategories::DenseVectorTag,
+					    VectorCategories::SparseAssociativeVectorTag) const;
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulColSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+					    VectorCategories::DenseVectorTag,
+					    VectorCategories::SparseParallelVectorTag) const;
+
+		template <class Vector1, class Matrix, class Vector2>
+		inline Vector1 &mulColSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+						   VectorCategories::GenericVectorTag,
+						   VectorCategories::GenericVectorTag) const
+		{
+			typename LinBox::Vector<Field>::Dense y;
+
+			VectorWrapper::ensureDim (y, w.size ());
+
+			VectorWrapper::ensureDim (y, w.size ());
+
+			vectorMul (y, A, v);
+			_VD.copy (w, y);
+
+			return w;
+		}
+
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+					 MatrixCategories::RowMatrixTag) const
+		{
+			return mulRowSpecialized (w, A, v, typename VectorTraits<Vector1>::VectorCategory ());
+		}
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+					 MatrixCategories::ColMatrixTag) const
+		{
+			return mulColSpecialized (w, A, v,
+						  typename VectorTraits<Vector1>::VectorCategory (),
+						  typename VectorTraits<Vector2>::VectorCategory ());
+		}
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &mulSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+					 MatrixCategories::RowColMatrixTag) const
+		{
+			return mulRowSpecialized (w, A, v, typename VectorTraits<Vector1>::VectorCategory ());
+		}
+
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &axpyinRowSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
+					       VectorCategories::DenseVectorTag) const;
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &axpyinRowSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
+					       VectorCategories::SparseSequenceVectorTag) const;
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &axpyinRowSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
+					       VectorCategories::SparseAssociativeVectorTag) const;
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &axpyinRowSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
+					       VectorCategories::SparseParallelVectorTag) const;
+
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &axpyinColSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
+					       VectorCategories::DenseVectorTag) const;
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &axpyinColSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
+					       VectorCategories::SparseSequenceVectorTag) const;
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &axpyinColSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
+					       VectorCategories::SparseAssociativeVectorTag) const;
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &axpyinColSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
+					       VectorCategories::SparseParallelVectorTag) const;
+
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &axpyinSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
+					    MatrixCategories::RowMatrixTag) const
+		{
+			return axpyinRowSpecialized (y, A, x, typename VectorTraits<Vector1>::VectorCategory ());
+		}
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &axpyinSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
+					    MatrixCategories::ColMatrixTag) const
+		{
+			return axpyinColSpecialized (y, A, x, typename VectorTraits<Vector1>::VectorCategory ());
+		}
+		template <class Vector1, class Matrix, class Vector2>
+		Vector1 &axpyinSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
+					    MatrixCategories::RowColMatrixTag) const
+		{
+			return axpyinRowSpecialized (y, A, x, typename VectorTraits<Vector1>::VectorCategory ());
+		}
+
+		template <class Matrix, class Iterator>
+		inline Matrix &permuteRowsByRow (Matrix   &A,
+						 Iterator  P_start,
+						 Iterator  P_end) const;
+
+		template <class Matrix, class Iterator>
+		inline Matrix &permuteRowsByCol (Matrix   &A,
+						 Iterator  P_start,
+						 Iterator  P_end) const;
+
+		template <class Matrix, class Iterator>
+		inline Matrix &permuteRowsSpecialized (Matrix   &A,
+						       Iterator  P_start,
+						       Iterator  P_end,
+						       MatrixCategories::RowColMatrixTag) const
+		{
+			return permuteRowsByCol (A, P_start, P_end);
+		}
+
+		template <class Matrix, class Iterator>
+		inline Matrix &permuteRowsSpecialized (Matrix   &A,
+						       Iterator  P_start,
+						       Iterator  P_end,
+						       MatrixCategories::RowMatrixTag) const
+		{
+			return permuteRowsByRow (A, P_start, P_end);
+		}
+
+		template <class Matrix, class Iterator>
+		inline Matrix &permuteRowsSpecialized (Matrix   &A,
+						       Iterator  P_start,
+						       Iterator  P_end,
+						       MatrixCategories::ColMatrixTag) const
+		{
+			return permuteRowsByCol (A, P_start, P_end);
+		}
+
+		template <class Matrix, class Iterator>
+		inline Matrix &permuteColsByRow (Matrix   &A,
+						 Iterator  P_start,
+						 Iterator  P_end) const;
+
+		template <class Matrix, class Iterator>
+		inline Matrix &permuteColsByCol (Matrix   &A,
+						 Iterator  P_start,
+						 Iterator  P_end) const;
+
+		template <class Matrix, class Iterator>
+		inline Matrix &permuteColsSpecialized (Matrix   &A,
+						       Iterator  P_start,
+						       Iterator  P_end,
+						       MatrixCategories::RowColMatrixTag) const
+		{
+			return permuteColsByRow (A, P_start, P_end);
+		}
+
+		template <class Matrix, class Iterator>
+		inline Matrix &permuteColsSpecialized (Matrix   &A,
+						       Iterator  P_start,
+						       Iterator  P_end,
+						       MatrixCategories::RowMatrixTag) const
+		{
+			return permuteColsByRow (A, P_start, P_end);
+		}
+
+		template <class Matrix, class Iterator>
+		inline Matrix &permuteColsSpecialized (Matrix   &A,
+						       Iterator  P_start,
+						       Iterator  P_end,
+						       MatrixCategories::ColMatrixTag) const
+		{
+			return permuteColsByCol (A, P_start, P_end);
+		}
+
+		Field         _F;
+		VectorDomain<Field>  _VD;
+	};
 
 }
 
 
 #include "linbox/matrix/matrix-domain.inl"
 
-#endif // __MATRIX_DOMAIN_H
+#endif // __LINBOX_matrix_domain_H
+
diff --git a/linbox/matrix/matrix-domain.inl b/linbox/matrix/matrix-domain.inl
index e4a0306..5785fff 100644
--- a/linbox/matrix/matrix-domain.inl
+++ b/linbox/matrix/matrix-domain.inl
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* linbox/matrix/matrix-domain.inl
  * Copyright (C) 2002 Bradford Hovinen
@@ -10,1141 +11,1146 @@
  * See COPYING for license information.
  */
 
-#ifndef __MATRIX_DOMAIN_INL
-#define __MATRIX_DOMAIN_INL
+#ifndef __LINBOX_matrix_domain_INL
+#define __LINBOX_matrix_domain_INL
 
 #include "linbox/matrix/transpose-matrix.h"
 
 namespace LinBox
 {
 
-template <class Field>
-template <class Matrix1, class Matrix2>
-Matrix1 &MatrixDomain<Field>::copyRow (Matrix1 &A, const Matrix2 &B) const
-{
-	linbox_check (A.rowdim () == B.rowdim ());
-	linbox_check (A.coldim () == B.coldim ());
-
-	typename Matrix1::RowIterator i;
-	typename Matrix2::ConstRowIterator j;
-
-	i = A.rowBegin ();
-	j = B.rowBegin ();
-
-	for (; i != A.rowEnd (); ++i, ++j)
-		_VD.copy (*i, *j);
-
-	return A;
-}
-
-template <class Field>
-template <class Matrix1, class Matrix2>
-Matrix1 &MatrixDomain<Field>::copyCol (Matrix1 &A, const Matrix2 &B) const
-{
-	linbox_check (A.rowdim () == B.rowdim ());
-	linbox_check (A.coldim () == B.coldim ());
-
-	typename Matrix1::ColIterator i;
-	typename Matrix2::ConstColIterator j;
+	template <class Field>
+	template <class Matrix1, class Matrix2>
+	Matrix1 &MatrixDomain<Field>::copyRow (Matrix1 &A, const Matrix2 &B) const
+	{
+		linbox_check (A.rowdim () == B.rowdim ());
+		linbox_check (A.coldim () == B.coldim ());
 
-	i = A.colBegin ();
-	j = B.colBegin ();
+		typename Matrix1::RowIterator i;
+		typename Matrix2::ConstRowIterator j;
 
-	for (; i != A.colEnd (); ++i, ++j)
-		_VD.copy (*i, *j);
+		i = A.rowBegin ();
+		j = B.rowBegin ();
 
-	return A;
-}
+		for (; i != A.rowEnd (); ++i, ++j)
+			_VD.copy (*i, *j);
 
-template <class Field>
-template <class Matrix1, class Matrix2>
-bool MatrixDomain<Field>::areEqualRow (const Matrix1 &A, const Matrix2 &B) const
-{
-	linbox_check (A.rowdim () == B.rowdim ());
-	linbox_check (A.coldim () == B.coldim ());
+		return A;
+	}
 
-	typename Matrix1::ConstRowIterator i;
-	typename Matrix2::ConstRowIterator j;
+	template <class Field>
+	template <class Matrix1, class Matrix2>
+	Matrix1 &MatrixDomain<Field>::copyCol (Matrix1 &A, const Matrix2 &B) const
+	{
+		linbox_check (A.rowdim () == B.rowdim ());
+		linbox_check (A.coldim () == B.coldim ());
 
-	i = A.rowBegin ();
-	j = B.rowBegin ();
+		typename Matrix1::ColIterator i;
+		typename Matrix2::ConstColIterator j;
 
-	for (; i != A.rowEnd (); ++i, ++j)
-		if (!_VD.areEqual (*i, *j))
-			return false;
+		i = A.colBegin ();
+		j = B.colBegin ();
 
-	return true;
-}
+		for (; i != A.colEnd (); ++i, ++j)
+			_VD.copy (*i, *j);
 
-template <class Field>
-template <class Matrix1, class Matrix2>
-bool MatrixDomain<Field>::areEqualCol (const Matrix1 &A, const Matrix2 &B) const
-{
-	linbox_check (A.rowdim () == B.rowdim ());
-	linbox_check (A.coldim () == B.coldim ());
+		return A;
+	}
 
-	typename Matrix1::ConstColIterator i;
-	typename Matrix2::ConstColIterator j;
+	template <class Field>
+	template <class Matrix1, class Matrix2>
+	bool MatrixDomain<Field>::areEqualRow (const Matrix1 &A, const Matrix2 &B) const
+	{
+		linbox_check (A.rowdim () == B.rowdim ());
+		linbox_check (A.coldim () == B.coldim ());
 
-	i = A.colBegin ();
-	j = B.colBegin ();
+		typename Matrix1::ConstRowIterator i;
+		typename Matrix2::ConstRowIterator j;
 
-	for (; i != A.colEnd (); ++i, ++j)
-		if (!_VD.areEqual (*i, *j))
-			return false;
+		i = A.rowBegin ();
+		j = B.rowBegin ();
 
-	return true;
-}
+		for (; i != A.rowEnd (); ++i, ++j)
+			if (!_VD.areEqual (*i, *j))
+				return false;
 
-template <class Field>
-template <class Matrix>
-bool MatrixDomain<Field>::isZeroRow (const Matrix &A) const
-{
-	typename Matrix::ConstRowIterator i;
+		return true;
+	}
 
-	i = A.rowBegin ();
+	template <class Field>
+	template <class Matrix1, class Matrix2>
+	bool MatrixDomain<Field>::areEqualCol (const Matrix1 &A, const Matrix2 &B) const
+	{
+		linbox_check (A.rowdim () == B.rowdim ());
+		linbox_check (A.coldim () == B.coldim ());
 
-	for (; i != A.rowEnd (); ++i)
-		if (!_VD.isZero (*i))
-			return false;
+		typename Matrix1::ConstColIterator i;
+		typename Matrix2::ConstColIterator j;
 
-	return true;
-}
+		i = A.colBegin ();
+		j = B.colBegin ();
 
-template <class Field>
-template <class Matrix>
-bool MatrixDomain<Field>::isZeroCol (const Matrix &A) const
-{
-	typename Matrix::ConstColIterator i;
+		for (; i != A.colEnd (); ++i, ++j)
+			if (!_VD.areEqual (*i, *j))
+				return false;
 
-	i = A.colBegin ();
+		return true;
+	}
 
-	for (; i != A.colEnd (); ++i)
-		if (!_VD.isZero (*i))
-			return false;
+	template <class Field>
+	template <class Matrix>
+	bool MatrixDomain<Field>::isZeroRow (const Matrix &A) const
+	{
+		typename Matrix::ConstRowIterator i;
 
-	return true;
-}
+		i = A.rowBegin ();
 
-template <class Field>
-template <class Matrix1, class Matrix2, class Matrix3>
-Matrix1 &MatrixDomain<Field>::addRow (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const
-{
-	linbox_check (A.rowdim () == B.rowdim ());
-	linbox_check (A.coldim () == B.coldim ());
-	linbox_check (A.rowdim () == C.rowdim ());
-	linbox_check (A.coldim () == C.coldim ());
+		for (; i != A.rowEnd (); ++i)
+			if (!_VD.isZero (*i))
+				return false;
 
-	typename Matrix1::RowIterator i;
-	typename Matrix2::ConstRowIterator j;
-	typename Matrix3::ConstRowIterator k;
+		return true;
+	}
 
-	i = C.rowBegin ();
-	j = A.rowBegin ();
-	k = B.rowBegin ();
+	template <class Field>
+	template <class Matrix>
+	bool MatrixDomain<Field>::isZeroCol (const Matrix &A) const
+	{
+		typename Matrix::ConstColIterator i;
 
-	for (; i != C.rowEnd (); ++i, ++j, ++k)
-		_VD.add (*i, *j, *k);
+		i = A.colBegin ();
 
-	return C;
-}
+		for (; i != A.colEnd (); ++i)
+			if (!_VD.isZero (*i))
+				return false;
 
-template <class Field>
-template <class Matrix1, class Matrix2, class Matrix3>
-Matrix1 &MatrixDomain<Field>::addCol (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const
-{
-	linbox_check (A.rowdim () == B.rowdim ());
-	linbox_check (A.coldim () == B.coldim ());
-	linbox_check (A.rowdim () == C.rowdim ());
-	linbox_check (A.coldim () == C.coldim ());
+		return true;
+	}
 
-	typename Matrix1::ColIterator i;
-	typename Matrix2::ConstColIterator j;
-	typename Matrix3::ConstColIterator k;
+	template <class Field>
+	template <class Matrix1, class Matrix2, class Matrix3>
+	Matrix1 &MatrixDomain<Field>::addRow (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const
+	{
+		linbox_check (A.rowdim () == B.rowdim ());
+		linbox_check (A.coldim () == B.coldim ());
+		linbox_check (A.rowdim () == C.rowdim ());
+		linbox_check (A.coldim () == C.coldim ());
 
-	i = C.colBegin ();
-	j = A.colBegin ();
-	k = B.colBegin ();
+		typename Matrix1::RowIterator i;
+		typename Matrix2::ConstRowIterator j;
+		typename Matrix3::ConstRowIterator k;
 
-	for (; i != C.colEnd (); ++i, ++j, ++k)
-		_VD.add (*i, *j, *k);
+		i = C.rowBegin ();
+		j = A.rowBegin ();
+		k = B.rowBegin ();
 
-	return C;
-}
+		for (; i != C.rowEnd (); ++i, ++j, ++k)
+			_VD.add (*i, *j, *k);
 
-template <class Field>
-template <class Matrix1, class Matrix2>
-Matrix1 &MatrixDomain<Field>::addinRow (Matrix1 &A, const Matrix2 &B) const
-{
-	linbox_check (A.rowdim () == B.rowdim ());
-	linbox_check (A.coldim () == B.coldim ());
+		return C;
+	}
 
-	typename Matrix1::RowIterator i;
-	typename Matrix2::ConstRowIterator j;
+	template <class Field>
+	template <class Matrix1, class Matrix2, class Matrix3>
+	Matrix1 &MatrixDomain<Field>::addCol (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const
+	{
+		linbox_check (A.rowdim () == B.rowdim ());
+		linbox_check (A.coldim () == B.coldim ());
+		linbox_check (A.rowdim () == C.rowdim ());
+		linbox_check (A.coldim () == C.coldim ());
 
-	i = A.rowBegin ();
-	j = B.rowBegin ();
+		typename Matrix1::ColIterator i;
+		typename Matrix2::ConstColIterator j;
+		typename Matrix3::ConstColIterator k;
 
-	for (; i != A.rowEnd (); ++i, ++j)
-		_VD.addin (*i, *j);
+		i = C.colBegin ();
+		j = A.colBegin ();
+		k = B.colBegin ();
 
-	return A;
-}
+		for (; i != C.colEnd (); ++i, ++j, ++k)
+			_VD.add (*i, *j, *k);
 
-template <class Field>
-template <class Matrix1, class Matrix2>
-Matrix1 &MatrixDomain<Field>::addinCol (Matrix1 &A, const Matrix2 &B) const
-{
-	linbox_check (A.rowdim () == B.rowdim ());
-	linbox_check (A.coldim () == B.coldim ());
+		return C;
+	}
 
-	typename Matrix1::ColIterator i;
-	typename Matrix2::ConstColIterator j;
+	template <class Field>
+	template <class Matrix1, class Matrix2>
+	Matrix1 &MatrixDomain<Field>::addinRow (Matrix1 &A, const Matrix2 &B) const
+	{
+		linbox_check (A.rowdim () == B.rowdim ());
+		linbox_check (A.coldim () == B.coldim ());
 
-	i = A.colBegin ();
-	j = B.colBegin ();
+		typename Matrix1::RowIterator i;
+		typename Matrix2::ConstRowIterator j;
 
-	for (; i != A.colEnd (); ++i, ++j)
-		_VD.addin (*i, *j);
+		i = A.rowBegin ();
+		j = B.rowBegin ();
 
-	return A;
-}
+		for (; i != A.rowEnd (); ++i, ++j)
+			_VD.addin (*i, *j);
 
-template <class Field>
-template <class Matrix1, class Matrix2, class Matrix3>
-Matrix1 &MatrixDomain<Field>::subRow (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const
-{
-	linbox_check (A.rowdim () == B.rowdim ());
-	linbox_check (A.coldim () == B.coldim ());
-	linbox_check (A.rowdim () == C.rowdim ());
-	linbox_check (A.coldim () == C.coldim ());
+		return A;
+	}
 
-	typename Matrix1::RowIterator i;
-	typename Matrix2::ConstRowIterator j;
-	typename Matrix3::ConstRowIterator k;
+	template <class Field>
+	template <class Matrix1, class Matrix2>
+	Matrix1 &MatrixDomain<Field>::addinCol (Matrix1 &A, const Matrix2 &B) const
+	{
+		linbox_check (A.rowdim () == B.rowdim ());
+		linbox_check (A.coldim () == B.coldim ());
 
-	i = C.rowBegin ();
-	j = A.rowBegin ();
-	k = B.rowBegin ();
+		typename Matrix1::ColIterator i;
+		typename Matrix2::ConstColIterator j;
 
-	for (; i != C.rowEnd (); ++i, ++j, ++k)
-		_VD.sub (*i, *j, *k);
+		i = A.colBegin ();
+		j = B.colBegin ();
 
-	return C;
-}
+		for (; i != A.colEnd (); ++i, ++j)
+			_VD.addin (*i, *j);
 
-template <class Field>
-template <class Matrix1, class Matrix2, class Matrix3>
-Matrix1 &MatrixDomain<Field>::subCol (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const
-{
-	linbox_check (A.rowdim () == B.rowdim ());
-	linbox_check (A.coldim () == B.coldim ());
-	linbox_check (A.rowdim () == C.rowdim ());
-	linbox_check (A.coldim () == C.coldim ());
+		return A;
+	}
 
-	typename Matrix1::ColIterator i;
-	typename Matrix2::ConstColIterator j;
-	typename Matrix3::ConstColIterator k;
+	template <class Field>
+	template <class Matrix1, class Matrix2, class Matrix3>
+	Matrix1 &MatrixDomain<Field>::subRow (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const
+	{
+		linbox_check (A.rowdim () == B.rowdim ());
+		linbox_check (A.coldim () == B.coldim ());
+		linbox_check (A.rowdim () == C.rowdim ());
+		linbox_check (A.coldim () == C.coldim ());
 
-	i = C.colBegin ();
-	j = A.colBegin ();
-	k = B.colBegin ();
+		typename Matrix1::RowIterator i;
+		typename Matrix2::ConstRowIterator j;
+		typename Matrix3::ConstRowIterator k;
 
-	for (; i != C.colEnd (); ++i, ++j, ++k)
-		_VD.sub (*i, *j, *k);
+		i = C.rowBegin ();
+		j = A.rowBegin ();
+		k = B.rowBegin ();
 
-	return C;
-}
+		for (; i != C.rowEnd (); ++i, ++j, ++k)
+			_VD.sub (*i, *j, *k);
 
-template <class Field>
-template <class Matrix1, class Matrix2>
-Matrix1 &MatrixDomain<Field>::subinRow (Matrix1 &A, const Matrix2 &B) const
-{
-	linbox_check (A.rowdim () == B.rowdim ());
-	linbox_check (A.coldim () == B.coldim ());
+		return C;
+	}
 
-	typename Matrix1::RowIterator i;
-	typename Matrix2::ConstRowIterator j;
+	template <class Field>
+	template <class Matrix1, class Matrix2, class Matrix3>
+	Matrix1 &MatrixDomain<Field>::subCol (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const
+	{
+		linbox_check (A.rowdim () == B.rowdim ());
+		linbox_check (A.coldim () == B.coldim ());
+		linbox_check (A.rowdim () == C.rowdim ());
+		linbox_check (A.coldim () == C.coldim ());
 
-	i = A.rowBegin ();
-	j = B.rowBegin ();
+		typename Matrix1::ColIterator i;
+		typename Matrix2::ConstColIterator j;
+		typename Matrix3::ConstColIterator k;
 
-	for (; i != A.rowEnd (); ++i, ++j)
-		_VD.subin (*i, *j);
+		i = C.colBegin ();
+		j = A.colBegin ();
+		k = B.colBegin ();
 
-	return A;
-}
+		for (; i != C.colEnd (); ++i, ++j, ++k)
+			_VD.sub (*i, *j, *k);
 
-template <class Field>
-template <class Matrix1, class Matrix2>
-Matrix1 &MatrixDomain<Field>::subinCol (Matrix1 &A, const Matrix2 &B) const
-{
-	linbox_check (A.rowdim () == B.rowdim ());
-	linbox_check (A.coldim () == B.coldim ());
+		return C;
+	}
 
-	typename Matrix1::ColIterator i;
-	typename Matrix2::ConstColIterator j;
+	template <class Field>
+	template <class Matrix1, class Matrix2>
+	Matrix1 &MatrixDomain<Field>::subinRow (Matrix1 &A, const Matrix2 &B) const
+	{
+		linbox_check (A.rowdim () == B.rowdim ());
+		linbox_check (A.coldim () == B.coldim ());
 
-	i = A.colBegin ();
-	j = B.colBegin ();
+		typename Matrix1::RowIterator i;
+		typename Matrix2::ConstRowIterator j;
 
-	for (; i != A.colEnd (); ++i, ++j)
-		_VD.subin (*i, *j);
+		i = A.rowBegin ();
+		j = B.rowBegin ();
 
-	return A;
-}
+		for (; i != A.rowEnd (); ++i, ++j)
+			_VD.subin (*i, *j);
 
-template <class Field>
-template <class Matrix1, class Matrix2>
-Matrix1 &MatrixDomain<Field>::negRow (Matrix1 &A, const Matrix2 &B) const
-{
-	linbox_check (A.rowdim () == B.rowdim ());
-	linbox_check (A.coldim () == B.coldim ());
+		return A;
+	}
 
-	typename Matrix1::RowIterator i;
-	typename Matrix2::ConstRowIterator j;
+	template <class Field>
+	template <class Matrix1, class Matrix2>
+	Matrix1 &MatrixDomain<Field>::subinCol (Matrix1 &A, const Matrix2 &B) const
+	{
+		linbox_check (A.rowdim () == B.rowdim ());
+		linbox_check (A.coldim () == B.coldim ());
 
-	i = A.rowBegin ();
-	j = B.rowBegin ();
+		typename Matrix1::ColIterator i;
+		typename Matrix2::ConstColIterator j;
 
-	for (; i != A.rowEnd (); ++i, ++j)
-		_VD.neg (*i, *j);
+		i = A.colBegin ();
+		j = B.colBegin ();
 
-	return A;
-}
+		for (; i != A.colEnd (); ++i, ++j)
+			_VD.subin (*i, *j);
 
-template <class Field>
-template <class Matrix1, class Matrix2>
-Matrix1 &MatrixDomain<Field>::negCol (Matrix1 &A, const Matrix2 &B) const
-{
-	linbox_check (A.rowdim () == B.rowdim ());
-	linbox_check (A.coldim () == B.coldim ());
+		return A;
+	}
 
-	typename Matrix1::ColIterator i;
-	typename Matrix2::ConstColIterator j;
+	template <class Field>
+	template <class Matrix1, class Matrix2>
+	Matrix1 &MatrixDomain<Field>::negRow (Matrix1 &A, const Matrix2 &B) const
+	{
+		linbox_check (A.rowdim () == B.rowdim ());
+		linbox_check (A.coldim () == B.coldim ());
 
-	i = A.colBegin ();
-	j = B.colBegin ();
+		typename Matrix1::RowIterator i;
+		typename Matrix2::ConstRowIterator j;
 
-	for (; i != A.colEnd (); ++i, ++j)
-		_VD.neg (*i, *j);
+		i = A.rowBegin ();
+		j = B.rowBegin ();
 
-	return A;
-}
+		for (; i != A.rowEnd (); ++i, ++j)
+			_VD.neg (*i, *j);
 
-template <class Field>
-template <class Matrix>
-Matrix &MatrixDomain<Field>::neginRow (Matrix &A) const
-{
-	typename Matrix::RowIterator i;
+		return A;
+	}
 
-	for (i = A.rowBegin (); i != A.rowEnd (); ++i)
-		_VD.negin (*i);
+	template <class Field>
+	template <class Matrix1, class Matrix2>
+	Matrix1 &MatrixDomain<Field>::negCol (Matrix1 &A, const Matrix2 &B) const
+	{
+		linbox_check (A.rowdim () == B.rowdim ());
+		linbox_check (A.coldim () == B.coldim ());
 
-	return A;
-}
+		typename Matrix1::ColIterator i;
+		typename Matrix2::ConstColIterator j;
 
-template <class Field>
-template <class Matrix>
-Matrix &MatrixDomain<Field>::neginCol (Matrix &A) const
-{
-	typename Matrix::ColIterator i;
+		i = A.colBegin ();
+		j = B.colBegin ();
 
-	for (i = A.colBegin (); i != A.colEnd (); ++i)
-		_VD.negin (*i);
+		for (; i != A.colEnd (); ++i, ++j)
+			_VD.neg (*i, *j);
 
-	return A;
-}
+		return A;
+	}
 
-template <class Field>
-template <class Matrix1, class Matrix2, class Matrix3>
-Matrix1 &MatrixDomain<Field>::mulRowRowCol (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const
-{
-	linbox_check (A.coldim () == B.rowdim ());
-	linbox_check (A.rowdim () == C.rowdim ());
-	linbox_check (B.coldim () == C.coldim ());
+	template <class Field>
+	template <class Matrix>
+	Matrix &MatrixDomain<Field>::neginRow (Matrix &A) const
+	{
+		typename Matrix::RowIterator i;
 
-	typename Matrix2::ConstRowIterator i;
-	typename Matrix3::ConstColIterator j;
-	typename Matrix1::RowIterator l1;
-	typename Matrix1::Row::iterator l2;
+		for (i = A.rowBegin (); i != A.rowEnd (); ++i)
+			_VD.negin (*i);
 
-	for (i = A.rowBegin (), l1 = C.rowBegin (); i != A.rowEnd (); ++i, ++l1)
-		for (j = B.colBegin (), l2 = l1->begin (); j != B.colEnd (); ++j, ++l2)
-			_VD.dot (*l2, *i, *j);
+		return A;
+	}
 
-	return C;
-}
+	template <class Field>
+	template <class Matrix>
+	Matrix &MatrixDomain<Field>::neginCol (Matrix &A) const
+	{
+		typename Matrix::ColIterator i;
 
-template <class Field>
-template <class Matrix1, class Matrix2, class Matrix3>
-Matrix1 &MatrixDomain<Field>::mulColRowCol (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const
-{
-	linbox_check (A.coldim () == B.rowdim ());
-	linbox_check (A.rowdim () == C.rowdim ());
-	linbox_check (B.coldim () == C.coldim ());
+		for (i = A.colBegin (); i != A.colEnd (); ++i)
+			_VD.negin (*i);
 
-	typename Matrix2::ConstRowIterator i;
-	typename Matrix3::ConstColIterator j;
-	typename Matrix1::ColIterator l1;
-	typename Matrix1::Col::iterator l2;
+		return A;
+	}
 
-	for (j = B.colBegin (), l1 = C.colBegin (); j != B.colEnd (); ++j, ++l1)
-		for (i = A.rowBegin (), l2 = l1->begin (); i != A.rowEnd (); ++i, ++l2)
-			_VD.dot (*l2, *i, *j);
+	template <class Field>
+	template <class Matrix1, class Matrix2, class Matrix3>
+	Matrix1 &MatrixDomain<Field>::mulRowRowCol (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const
+	{
+		linbox_check (A.coldim () == B.rowdim ());
+		linbox_check (A.rowdim () == C.rowdim ());
+		linbox_check (B.coldim () == C.coldim ());
 
-	return C;
-}
+		typename Matrix2::ConstRowIterator i;
+		typename Matrix3::ConstColIterator j;
+		typename Matrix1::RowIterator l1;
+		typename Matrix1::Row::iterator l2;
 
-template <class Field>
-template <class Matrix1, class Matrix2, class Matrix3>
-Matrix1 &MatrixDomain<Field>::mulRowRowRow (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const
-{
-	linbox_check (A.coldim () == B.rowdim ());
-	linbox_check (A.rowdim () == C.rowdim ());
-	linbox_check (B.coldim () == C.coldim ());
+		for (i = A.rowBegin (), l1 = C.rowBegin (); i != A.rowEnd (); ++i, ++l1)
+			for (j = B.colBegin (), l2 = l1->begin (); j != B.colEnd (); ++j, ++l2)
+				_VD.dot (*l2, *i, *j);
 
-	typename Matrix2::ConstRowIterator i = A.rowBegin ();
-	typename Matrix1::RowIterator j = C.rowBegin ();
+		return C;
+	}
 
-	TransposeMatrix<const Matrix3> BT (B);
+	template <class Field>
+	template <class Matrix1, class Matrix2, class Matrix3>
+	Matrix1 &MatrixDomain<Field>::mulColRowCol (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const
+	{
+		linbox_check (A.coldim () == B.rowdim ());
+		linbox_check (A.rowdim () == C.rowdim ());
+		linbox_check (B.coldim () == C.coldim ());
 
-	for (; i != A.rowEnd (); ++i, ++j)
-		vectorMul (*j, BT, *i);
+		typename Matrix2::ConstRowIterator i;
+		typename Matrix3::ConstColIterator j;
+		typename Matrix1::ColIterator l1;
+		typename Matrix1::Col::iterator l2;
 
-	return C;
-}
+		for (j = B.colBegin (), l1 = C.colBegin (); j != B.colEnd (); ++j, ++l1)
+			for (i = A.rowBegin (), l2 = l1->begin (); i != A.rowEnd (); ++i, ++l2)
+				_VD.dot (*l2, *i, *j);
 
-template <class Field>
-template <class Matrix1, class Matrix2, class Matrix3>
-Matrix1 &MatrixDomain<Field>::mulColColCol (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const
-{
-	linbox_check (A.coldim () == B.rowdim ());
-	linbox_check (A.rowdim () == C.rowdim ());
-	linbox_check (B.coldim () == C.coldim ());
+		return C;
+	}
 
-	typename Matrix3::ConstColIterator i = B.colBegin ();
-	typename Matrix1::ColIterator j = C.colBegin ();
+	template <class Field>
+	template <class Matrix1, class Matrix2, class Matrix3>
+	Matrix1 &MatrixDomain<Field>::mulRowRowRow (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const
+	{
+		linbox_check (A.coldim () == B.rowdim ());
+		linbox_check (A.rowdim () == C.rowdim ());
+		linbox_check (B.coldim () == C.coldim ());
 
-	for (; i != B.colEnd (); ++i, ++j)
-		vectorMul (*j, A, *i);
+		typename Matrix2::ConstRowIterator i = A.rowBegin ();
+		typename Matrix1::RowIterator j = C.rowBegin ();
 
-	return C;
-}
+		TransposeMatrix<const Matrix3> BT (B);
 
-template <class Field>
-template <class Matrix1, class Matrix2>
-Matrix2 &MatrixDomain<Field>::leftMulin (const Matrix1 &A, Matrix2 &B) const
-{
-	linbox_check (A.rowdim () == A.coldim ());
-	linbox_check (A.coldim () == B.rowdim ());
+		for (; i != A.rowEnd (); ++i, ++j)
+			vectorMul (*j, BT, *i);
 
-	typename LinBox::Vector<Field>::Dense t (A.rowdim ());
+		return C;
+	}
 
-	typename Matrix2::ColIterator i;
-	typename Matrix1::ConstRowIterator j;
+	template <class Field>
+	template <class Matrix1, class Matrix2, class Matrix3>
+	Matrix1 &MatrixDomain<Field>::mulColColCol (Matrix1 &C, const Matrix2 &A, const Matrix3 &B) const
+	{
+		linbox_check (A.coldim () == B.rowdim ());
+		linbox_check (A.rowdim () == C.rowdim ());
+		linbox_check (B.coldim () == C.coldim ());
 
-	typename LinBox::Vector<Field>::Dense::iterator k;
+		typename Matrix3::ConstColIterator i = B.colBegin ();
+		typename Matrix1::ColIterator j = C.colBegin ();
 
-	for (i = B.colBegin (); i != B.colEnd (); ++i) {
-		for (j = A.rowBegin (), k = t.begin (); j != A.rowEnd (); ++j, ++k)
-			_VD.dot (*k, *j, *i);
+		for (; i != B.colEnd (); ++i, ++j)
+			vectorMul (*j, A, *i);
 
-		_VD.copy (*i, t);
+		return C;
 	}
 
-	return B;
-}
+	template <class Field>
+	template <class Matrix1, class Matrix2>
+	Matrix2 &MatrixDomain<Field>::leftMulin (const Matrix1 &A, Matrix2 &B) const
+	{
+		linbox_check (A.rowdim () == A.coldim ());
+		linbox_check (A.coldim () == B.rowdim ());
 
-template <class Field>
-template <class Matrix1, class Matrix2>
-Matrix1 &MatrixDomain<Field>::rightMulin (Matrix1 &A, const Matrix2 &B) const
-{
-	linbox_check (A.coldim () == B.rowdim ());
-	linbox_check (B.rowdim () == B.coldim ());
+		typename LinBox::Vector<Field>::Dense t (A.rowdim ());
 
-	typename LinBox::Vector<Field>::Dense t (B.coldim ());
+		typename Matrix2::ColIterator i;
+		typename Matrix1::ConstRowIterator j;
 
-	typename Matrix1::RowIterator i;
-	typename Matrix2::ConstColIterator j;
+		typename LinBox::Vector<Field>::Dense::iterator k;
 
-	typename LinBox::Vector<Field>::Dense::iterator k;
+		for (i = B.colBegin (); i != B.colEnd (); ++i) {
+			for (j = A.rowBegin (), k = t.begin (); j != A.rowEnd (); ++j, ++k)
+				_VD.dot (*k, *j, *i);
 
-	for (i = A.rowBegin (); i != A.rowEnd (); ++i) {
-		for (j = B.colBegin (), k = t.begin (); j != B.colEnd (); ++j, ++k)
-			_VD.dot (*k, *i, *j);
+			_VD.copy (*i, t);
+		}
 
-		_VD.copy (*i, t);
+		return B;
 	}
 
-	return A;
-}
-
-template <class Field>
-template <class Matrix1, class Matrix2>
-Matrix1 &MatrixDomain<Field>::mulRow (Matrix1 &C, const Matrix2 &B, const typename Field::Element &a) const
-{
-	linbox_check (C.rowdim () == B.rowdim ());
-	linbox_check (C.coldim () == B.coldim ());
+	template <class Field>
+	template <class Matrix1, class Matrix2>
+	Matrix1 &MatrixDomain<Field>::rightMulin (Matrix1 &A, const Matrix2 &B) const
+	{
+		linbox_check (A.coldim () == B.rowdim ());
+		linbox_check (B.rowdim () == B.coldim ());
 
-	typename Matrix1::RowIterator i;
-	typename Matrix2::ConstRowIterator j;
+		typename LinBox::Vector<Field>::Dense t (B.coldim ());
 
-	i = C.rowBegin ();
-	j = B.rowBegin ();
+		typename Matrix1::RowIterator i;
+		typename Matrix2::ConstColIterator j;
 
-	for (; i != C.rowEnd (); ++i, ++j)
-		_VD.mul (*i, *j, a);
+		typename LinBox::Vector<Field>::Dense::iterator k;
 
-	return C;
-}
+		for (i = A.rowBegin (); i != A.rowEnd (); ++i) {
+			for (j = B.colBegin (), k = t.begin (); j != B.colEnd (); ++j, ++k)
+				_VD.dot (*k, *i, *j);
 
-template <class Field>
-template <class Matrix1, class Matrix2>
-Matrix1 &MatrixDomain<Field>::mulCol (Matrix1 &C, const Matrix2 &B, const typename Field::Element &a) const
-{
-	linbox_check (C.rowdim () == B.rowdim ());
-	linbox_check (C.coldim () == B.coldim ());
+			_VD.copy (*i, t);
+		}
 
-	typename Matrix1::ColIterator i;
-	typename Matrix2::ConstColIterator j;
+		return A;
+	}
 
-	i = C.colBegin ();
-	j = B.colBegin ();
+	template <class Field>
+	template <class Matrix1, class Matrix2>
+	Matrix1 &MatrixDomain<Field>::mulRow (Matrix1 &C, const Matrix2 &B, const typename Field::Element &a) const
+	{
+		linbox_check (C.rowdim () == B.rowdim ());
+		linbox_check (C.coldim () == B.coldim ());
 
-	for (; i != C.colEnd (); ++i, ++j)
-		_VD.mul (*i, *j, a);
+		typename Matrix1::RowIterator i;
+		typename Matrix2::ConstRowIterator j;
 
-	return C;
-}
+		i = C.rowBegin ();
+		j = B.rowBegin ();
 
-template <class Field>
-template <class Matrix>
-Matrix &MatrixDomain<Field>::mulinRow (Matrix &B, const typename Field::Element &a) const
-{
-	typename Matrix::RowIterator i;
+		for (; i != C.rowEnd (); ++i, ++j)
+			_VD.mul (*i, *j, a);
 
-	for (i = B.rowBegin (); i != B.rowEnd (); ++i)
-		_VD.mulin (*i, a);
+		return C;
+	}
 
-	return B;
-}
+	template <class Field>
+	template <class Matrix1, class Matrix2>
+	Matrix1 &MatrixDomain<Field>::mulCol (Matrix1 &C, const Matrix2 &B, const typename Field::Element &a) const
+	{
+		linbox_check (C.rowdim () == B.rowdim ());
+		linbox_check (C.coldim () == B.coldim ());
 
-template <class Field>
-template <class Matrix>
-Matrix &MatrixDomain<Field>::mulinCol (Matrix &B, const typename Field::Element &a) const
-{
-	typename Matrix::ColIterator i;
+		typename Matrix1::ColIterator i;
+		typename Matrix2::ConstColIterator j;
 
-	for (i = B.colBegin (); i != B.colEnd (); ++i)
-		_VD.mulin (*i, a);
+		i = C.colBegin ();
+		j = B.colBegin ();
 
-	return B;
-}
+		for (; i != C.colEnd (); ++i, ++j)
+			_VD.mul (*i, *j, a);
 
-template <class Field>
-template <class Matrix1, class Matrix2, class Matrix3>
-Matrix1 &MatrixDomain<Field>::axpyinRowRowCol (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X) const
-{
-	linbox_check (A.coldim () == X.rowdim ());
-	linbox_check (A.rowdim () == Y.rowdim ());
-	linbox_check (X.coldim () == Y.coldim ());
+		return C;
+	}
 
-	typename Matrix2::ConstRowIterator i;
-	typename Matrix3::ConstColIterator j;
-	typename Matrix1::RowIterator l1;
-	typename Matrix1::Row::iterator l2;
+	template <class Field>
+	template <class Matrix>
+	Matrix &MatrixDomain<Field>::mulinRow (Matrix &B, const typename Field::Element &a) const
+	{
+		typename Matrix::RowIterator i;
 
-	typename Field::Element t;
+		for (i = B.rowBegin (); i != B.rowEnd (); ++i)
+			_VD.mulin (*i, a);
 
-	for (i = A.rowBegin (), l1 = Y.rowBegin (); i != A.rowEnd (); ++i, ++l1) {
-		for (j = X.colBegin (), l2 = l1->begin (); j != X.colEnd (); ++j, ++l2) {
-			_VD.dot (t, *i, *j);
-			_F.addin (*l2, t);
-		}
+		return B;
 	}
 
-	return Y;
-}
+	template <class Field>
+	template <class Matrix>
+	Matrix &MatrixDomain<Field>::mulinCol (Matrix &B, const typename Field::Element &a) const
+	{
+		typename Matrix::ColIterator i;
 
-template <class Field>
-template <class Matrix1, class Matrix2, class Matrix3>
-Matrix1 &MatrixDomain<Field>::axpyinColRowCol (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X) const
-{
-	linbox_check (A.coldim () == X.rowdim ());
-	linbox_check (A.rowdim () == Y.rowdim ());
-	linbox_check (X.coldim () == Y.coldim ());
+		for (i = B.colBegin (); i != B.colEnd (); ++i)
+			_VD.mulin (*i, a);
+
+		return B;
+	}
 
-	typename Matrix2::ConstRowIterator i;
-	typename Matrix3::ConstColIterator j;
-	typename Matrix1::ColIterator l1;
-	typename Matrix1::Col::iterator l2;
+	template <class Field>
+	template <class Matrix1, class Matrix2, class Matrix3>
+	Matrix1 &MatrixDomain<Field>::axpyinRowRowCol (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X) const
+	{
+		linbox_check (A.coldim () == X.rowdim ());
+		linbox_check (A.rowdim () == Y.rowdim ());
+		linbox_check (X.coldim () == Y.coldim ());
+
+		typename Matrix2::ConstRowIterator i;
+		typename Matrix3::ConstColIterator j;
+		typename Matrix1::RowIterator l1;
+		typename Matrix1::Row::iterator l2;
+
+		typename Field::Element t;
+
+		for (i = A.rowBegin (), l1 = Y.rowBegin (); i != A.rowEnd (); ++i, ++l1) {
+			for (j = X.colBegin (), l2 = l1->begin (); j != X.colEnd (); ++j, ++l2) {
+				_VD.dot (t, *i, *j);
+				_F.addin (*l2, t);
+			}
+		}
 
-	typename Field::Element t;
+		return Y;
+	}
 
-	for (j = X.colBegin (), l1 = Y.colBegin (); j != X.colEnd (); ++j, ++l1) {
-		for (i = A.rowBegin (), l2 = l1->begin (); i != A.rowEnd (); ++i, ++l2) {
-			_VD.dot (t, *i, *j);
-			_F.addin (*l2, t);
+	template <class Field>
+	template <class Matrix1, class Matrix2, class Matrix3>
+	Matrix1 &MatrixDomain<Field>::axpyinColRowCol (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X) const
+	{
+		linbox_check (A.coldim () == X.rowdim ());
+		linbox_check (A.rowdim () == Y.rowdim ());
+		linbox_check (X.coldim () == Y.coldim ());
+
+		typename Matrix2::ConstRowIterator i;
+		typename Matrix3::ConstColIterator j;
+		typename Matrix1::ColIterator l1;
+		typename Matrix1::Col::iterator l2;
+
+		typename Field::Element t;
+
+		for (j = X.colBegin (), l1 = Y.colBegin (); j != X.colEnd (); ++j, ++l1) {
+			for (i = A.rowBegin (), l2 = l1->begin (); i != A.rowEnd (); ++i, ++l2) {
+				_VD.dot (t, *i, *j);
+				_F.addin (*l2, t);
+			}
 		}
+
+		return Y;
 	}
 
-	return Y;
-}
+	template <class Field>
+	template <class Matrix1, class Matrix2, class Matrix3>
+	Matrix1 &MatrixDomain<Field>::axpyinRowRowRow (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X) const
+	{
+		linbox_check (A.coldim () == X.rowdim ());
+		linbox_check (A.rowdim () == Y.rowdim ());
+		linbox_check (X.coldim () == Y.coldim ());
 
-template <class Field>
-template <class Matrix1, class Matrix2, class Matrix3>
-Matrix1 &MatrixDomain<Field>::axpyinRowRowRow (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X) const
-{
-	linbox_check (A.coldim () == X.rowdim ());
-	linbox_check (A.rowdim () == Y.rowdim ());
-	linbox_check (X.coldim () == Y.coldim ());
+		typename LinBox::Vector<Field>::Dense t (X.coldim ());
 
-	typename LinBox::Vector<Field>::Dense t (X.coldim ());
+		typename Matrix2::ConstRowIterator i = A.rowBegin ();
+		typename Matrix1::RowIterator j = Y.rowBegin ();
 
-	typename Matrix2::ConstRowIterator i = A.rowBegin ();
-	typename Matrix1::RowIterator j = Y.rowBegin ();
+		TransposeMatrix<const Matrix3> XT (X);
 
-	TransposeMatrix<const Matrix3> XT (X);
+		for (; i != A.rowEnd (); ++i, ++j) {
+			vectorMul (t, XT, *i);
+			_VD.addin (*j, t);
+		}
 
-	for (; i != A.rowEnd (); ++i, ++j) {
-		vectorMul (t, XT, *i);
-		_VD.addin (*j, t);
+		return Y;
 	}
 
-	return Y;
-}
+	template <class Field>
+	template <class Matrix1, class Matrix2, class Matrix3>
+	Matrix1 &MatrixDomain<Field>::axpyinColColCol (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X) const
+	{
+		linbox_check (A.coldim () == X.rowdim ());
+		linbox_check (A.rowdim () == Y.rowdim ());
+		linbox_check (X.coldim () == Y.coldim ());
 
-template <class Field>
-template <class Matrix1, class Matrix2, class Matrix3>
-Matrix1 &MatrixDomain<Field>::axpyinColColCol (Matrix1 &Y, const Matrix2 &A, const Matrix3 &X) const
-{
-	linbox_check (A.coldim () == X.rowdim ());
-	linbox_check (A.rowdim () == Y.rowdim ());
-	linbox_check (X.coldim () == Y.coldim ());
+		typename LinBox::Vector<Field>::Dense t (A.rowdim ());
 
-	typename LinBox::Vector<Field>::Dense t (A.rowdim ());
+		typename Matrix3::ConstColIterator i = X.colBegin ();
+		typename Matrix1::ColIterator j = Y.colBegin ();
 
-	typename Matrix3::ConstColIterator i = X.colBegin ();
-	typename Matrix1::ColIterator j = Y.colBegin ();
+		for (; i != X.colEnd (); ++i, ++j) {
+			vectorMul (t, A, *i);
+			_VD.addin (*j, t);
+		}
 
-	for (; i != X.colEnd (); ++i, ++j) {
-		vectorMul (t, A, *i);
-		_VD.addin (*j, t);
+		return Y;
 	}
 
-	return Y;
-}
+	template <class Field>
+	template <class Vector1, class Matrix, class Vector2>
+	Vector1 &MatrixDomain<Field>::mulRowSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+							 VectorCategories::DenseVectorTag) const
+	{
+		linbox_check (A.coldim () == v.size ());
+		linbox_check (A.rowdim () == w.size ());
 
-template <class Field>
-template <class Vector1, class Matrix, class Vector2>
-Vector1 &MatrixDomain<Field>::mulRowSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-						 VectorCategories::DenseVectorTag) const
-{
-	linbox_check (A.coldim () == v.size ());
-	linbox_check (A.rowdim () == w.size ());
+		typename Matrix::ConstRowIterator i = A.rowBegin ();
+		typename Vector1::iterator j = w.begin ();
 
-	typename Matrix::ConstRowIterator i = A.rowBegin ();
-	typename Vector1::iterator j = w.begin ();
+		// JGD 02.09.2008 : when sizes differ
+		// A must decide if dot is possible, not w
+		// 	for (; j != w.end (); ++j, ++i)
+		// 		_VD.dot (*j, v, *i);
+		for (; i != A.rowEnd (); ++j, ++i)
+			_VD.dot (*j, v, *i);
 
-	for (; j != w.end (); ++j, ++i)
-		_VD.dot (*j, v, *i);
+		return w;
+	}
 
-	return w;
-}
+	template <class Field>
+	template <class Vector1, class Matrix, class Vector2>
+	Vector1 &MatrixDomain<Field>::mulRowSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+							 VectorCategories::SparseSequenceVectorTag) const
+	{
+		typename Matrix::ConstRowIterator i = A.rowBegin ();
+		typename Field::Element t;
+		unsigned int idx = 0;
 
-template <class Field>
-template <class Vector1, class Matrix, class Vector2>
-Vector1 &MatrixDomain<Field>::mulRowSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-						 VectorCategories::SparseSequenceVectorTag) const
-{
-	typename Matrix::ConstRowIterator i = A.rowBegin ();
-	typename Field::Element t;
-	unsigned int idx = 0;
+		w.clear ();
 
-	w.clear ();
+		for (; i != A.rowEnd (); ++i, ++idx) {
+			_VD.dot (t, v, *i);
 
-	for (; i != A.rowEnd (); ++i, ++idx) {
-		_VD.dot (t, v, *i);
+			if (!_F.isZero (t))
+				w.push_back (std::pair<size_t, typename Field::Element> (idx, t));
+		}
 
-		if (!_F.isZero (t))
-			w.push_back (std::pair<size_t, typename Field::Element> (idx, t));
+		return w;
 	}
 
-	return w;
-}
+	template <class Field>
+	template <class Vector1, class Matrix, class Vector2>
+	Vector1 &MatrixDomain<Field>::mulRowSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+							 VectorCategories::SparseAssociativeVectorTag) const
+	{
+		typename Matrix::ConstRowIterator i = A.rowBegin ();
+		typename Field::Element t;
+		unsigned int idx = 0;
 
-template <class Field>
-template <class Vector1, class Matrix, class Vector2>
-Vector1 &MatrixDomain<Field>::mulRowSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-						 VectorCategories::SparseAssociativeVectorTag) const
-{
-	typename Matrix::ConstRowIterator i = A.rowBegin ();
-	typename Field::Element t;
-	unsigned int idx = 0;
+		w.clear ();
 
-	w.clear ();
+		for (; i != A.rowEnd (); ++i, ++idx) {
+			_VD.dot (t, v, *i);
 
-	for (; i != A.rowEnd (); ++i, ++idx) {
-		_VD.dot (t, v, *i);
+			if (!_F.isZero (t))
+				w[idx] = t;
+		}
 
-		if (!_F.isZero (t))
-			w[idx] = t;
+		return w;
 	}
 
-	return w;
-}
-
-template <class Field>
-template <class Vector1, class Matrix, class Vector2>
-Vector1 &MatrixDomain<Field>::mulRowSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-						 VectorCategories::SparseParallelVectorTag) const
-{
-	typename Matrix::ConstRowIterator i = A.rowBegin ();
-	typename Field::Element t;
-	unsigned int idx = 0;
+	template <class Field>
+	template <class Vector1, class Matrix, class Vector2>
+	Vector1 &MatrixDomain<Field>::mulRowSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+							 VectorCategories::SparseParallelVectorTag) const
+	{
+		typename Matrix::ConstRowIterator i = A.rowBegin ();
+		typename Field::Element t;
+		unsigned int idx = 0;
 
-	w.first.clear ();
-	w.second.clear ();
+		w.first.clear ();
+		w.second.clear ();
 
-	for (; i != A.rowEnd (); ++i, ++idx) {
-		_VD.dot (t, v, *i);
+		for (; i != A.rowEnd (); ++i, ++idx) {
+			_VD.dot (t, v, *i);
 
-		if (!_F.isZero (t)) {
-			w.first.push_back (idx);
-			w.second.push_back (t);
+			if (!_F.isZero (t)) {
+				w.first.push_back (idx);
+				w.second.push_back (t);
+			}
 		}
-	}
 
-	return w;
-}
+		return w;
+	}
 
-template <class Field>
-template <class Vector1, class Matrix, class Vector2>
-Vector1 &MVProductDomain<Field>::mulColDense
+	template <class Field>
+	template <class Vector1, class Matrix, class Vector2>
+	Vector1 &MVProductDomain<Field>::mulColDense
 	(const VectorDomain<Field> &VD, Vector1 &w, const Matrix &A, const Vector2 &v) const
-{
-	linbox_check (A.coldim () == v.size ());
-	linbox_check (A.rowdim () == w.size ());
+	{
+		linbox_check (A.coldim () == v.size ());
+		linbox_check (A.rowdim () == w.size ());
 
-	typename Matrix::ConstColIterator i = A.colBegin ();
-	typename Vector2::const_iterator j = v.begin ();
+		typename Matrix::ConstColIterator i = A.colBegin ();
+		typename Vector2::const_iterator j = v.begin ();
 
-	VD.subin (w, w);
+		VD.subin (w, w);
 
-	for (; j != v.end (); ++j, ++i)
-		VD.axpyin (w, *j, *i);
+		for (; j != v.end (); ++j, ++i)
+			VD.axpyin (w, *j, *i);
 
-	return w;
-}
+		return w;
+	}
 
-template <class Field>
-template <class Vector1, class Matrix, class Vector2>
-Vector1 &MatrixDomain<Field>::mulColSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-						 VectorCategories::DenseVectorTag,
-						 VectorCategories::SparseSequenceVectorTag) const
-{
-	linbox_check (A.rowdim () == w.size ());
+	template <class Field>
+	template <class Vector1, class Matrix, class Vector2>
+	Vector1 &MatrixDomain<Field>::mulColSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+							 VectorCategories::DenseVectorTag,
+							 VectorCategories::SparseSequenceVectorTag) const
+	{
+		linbox_check (A.rowdim () == w.size ());
+
+		typename Vector2::const_iterator j = v.begin ();
 
-	typename Vector2::const_iterator j = v.begin ();
+		_VD.subin (w, w);
 
-	_VD.subin (w, w);
+		for (; j != v.end (); ++j) {
+			typename Matrix::ConstColIterator i = A.colBegin () + j->first;
+			_VD.axpyin (w, j->second, *i);
+		}
 
-	for (; j != v.end (); ++j) {
-		typename Matrix::ConstColIterator i = A.colBegin () + j->first;
-		_VD.axpyin (w, j->second, *i);
+		return w;
 	}
 
-	return w;
-}
+	template <class Field>
+	template <class Vector1, class Matrix, class Vector2>
+	Vector1 &MatrixDomain<Field>::mulColSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+							 VectorCategories::DenseVectorTag,
+							 VectorCategories::SparseAssociativeVectorTag) const
+	{
+		linbox_check (A.rowdim () == w.size ());
 
-template <class Field>
-template <class Vector1, class Matrix, class Vector2>
-Vector1 &MatrixDomain<Field>::mulColSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-						 VectorCategories::DenseVectorTag,
-						 VectorCategories::SparseAssociativeVectorTag) const
-{
-	linbox_check (A.rowdim () == w.size ());
+		typename Vector2::const_iterator j = v.begin ();
 
-	typename Vector2::const_iterator j = v.begin ();
+		_VD.subin (w, w);
 
-	_VD.subin (w, w);
+		for (; j != v.end (); ++j) {
+			typename Matrix::ConstColIterator i = A.colBegin () + j->first;
+			_VD.axpyin (w, j->second, *i);
+		}
 
-	for (; j != v.end (); ++j) {
-		typename Matrix::ConstColIterator i = A.colBegin () + j->first;
-		_VD.axpyin (w, j->second, *i);
+		return w;
 	}
 
-	return w;
-}
+	template <class Field>
+	template <class Vector1, class Matrix, class Vector2>
+	Vector1 &MatrixDomain<Field>::mulColSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
+							 VectorCategories::DenseVectorTag,
+							 VectorCategories::SparseParallelVectorTag) const
+	{
+		linbox_check (A.rowdim () == w.size ());
 
-template <class Field>
-template <class Vector1, class Matrix, class Vector2>
-Vector1 &MatrixDomain<Field>::mulColSpecialized (Vector1 &w, const Matrix &A, const Vector2 &v,
-						 VectorCategories::DenseVectorTag,
-						 VectorCategories::SparseParallelVectorTag) const
-{
-	linbox_check (A.rowdim () == w.size ());
+		typename Vector2::first_type::const_iterator j_idx = v.first.begin ();
+		typename Vector2::second_type::const_iterator j_elt = v.second.begin ();
 
-	typename Vector2::first_type::const_iterator j_idx = v.first.begin ();
-	typename Vector2::second_type::const_iterator j_elt = v.second.begin ();
+		_VD.subin (w, w);
 
-	_VD.subin (w, w);
+		for (; j_idx != v.first.end (); ++j_idx, ++j_elt) {
+			typename Matrix::ConstColIterator i = A.colBegin () + *j_idx;
+			_VD.axpyin (w, *j_elt, *i);
+		}
 
-	for (; j_idx != v.first.end (); ++j_idx, ++j_elt) {
-		typename Matrix::ConstColIterator i = A.colBegin () + *j_idx;
-		_VD.axpyin (w, *j_elt, *i);
+		return w;
 	}
 
-	return w;
-}
+	template <class Field>
+	template <class Vector1, class Matrix, class Vector2>
+	Vector1 &MatrixDomain<Field>::axpyinRowSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
+							    VectorCategories::DenseVectorTag) const
+	{
+		linbox_check (A.coldim () == x.size ());
+		linbox_check (A.rowdim () == y.size ());
 
-template <class Field>
-template <class Vector1, class Matrix, class Vector2>
-Vector1 &MatrixDomain<Field>::axpyinRowSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
-						    VectorCategories::DenseVectorTag) const
-{
-	linbox_check (A.coldim () == x.size ());
-	linbox_check (A.rowdim () == y.size ());
+		typename Matrix::ConstRowIterator i = A.rowBegin ();
+		typename Vector1::iterator j = y.begin ();
 
-	typename Matrix::ConstRowIterator i = A.rowBegin ();
-	typename Vector1::iterator j = y.begin ();
+		typename Field::Element t;
 
-	typename Field::Element t;
+		for (; j != y.end (); ++j, ++i) {
+			_VD.dot (t, x, *i);
+			_F.addin (*j, t);
+		}
 
-	for (; j != y.end (); ++j, ++i) {
-		_VD.dot (t, x, *i);
-		_F.addin (*j, t);
+		return y;
 	}
 
-	return y;
-}
+	template <class Field>
+	template <class Vector1, class Matrix, class Vector2>
+	Vector1 &MatrixDomain<Field>::axpyinRowSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
+							    VectorCategories::SparseSequenceVectorTag) const
+	{
+		typename LinBox::Vector<Field>::Dense t1 (A.coldim ()), t2 (A.rowdim ());
 
-template <class Field>
-template <class Vector1, class Matrix, class Vector2>
-Vector1 &MatrixDomain<Field>::axpyinRowSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
-						    VectorCategories::SparseSequenceVectorTag) const
-{
-	typename LinBox::Vector<Field>::Dense t1 (A.coldim ()), t2 (A.rowdim ());
+		_VD.copy (t1, x);
+		_VD.copy (t2, y);
+		axpyin (t2, A, t1);
+		_VD.copy (y, t2);
 
-	_VD.copy (t1, x);
-	_VD.copy (t2, y);
-	axpyin (t2, A, t1);
-	_VD.copy (y, t2);
+		return y;
+	}
 
-	return y;
-}
+	template <class Field>
+	template <class Vector1, class Matrix, class Vector2>
+	Vector1 &MatrixDomain<Field>::axpyinRowSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
+							    VectorCategories::SparseAssociativeVectorTag) const
+	{
+		typename LinBox::Vector<Field>::Dense t1 (A.coldim ()), t2 (A.rowdim ());
 
-template <class Field>
-template <class Vector1, class Matrix, class Vector2>
-Vector1 &MatrixDomain<Field>::axpyinRowSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
-						    VectorCategories::SparseAssociativeVectorTag) const
-{
-	typename LinBox::Vector<Field>::Dense t1 (A.coldim ()), t2 (A.rowdim ());
+		_VD.copy (t1, x);
+		_VD.copy (t2, y);
+		axpyin (t2, A, t1);
+		_VD.copy (y, t2);
 
-	_VD.copy (t1, x);
-	_VD.copy (t2, y);
-	axpyin (t2, A, t1);
-	_VD.copy (y, t2);
+		return y;
+	}
 
-	return y;
-}
+	template <class Field>
+	template <class Vector1, class Matrix, class Vector2>
+	Vector1 &MatrixDomain<Field>::axpyinRowSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
+							    VectorCategories::SparseParallelVectorTag) const
+	{
+		typename LinBox::Vector<Field>::Dense t1 (A.coldim ()), t2 (A.rowdim ());
 
-template <class Field>
-template <class Vector1, class Matrix, class Vector2>
-Vector1 &MatrixDomain<Field>::axpyinRowSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
-						    VectorCategories::SparseParallelVectorTag) const
-{
-	typename LinBox::Vector<Field>::Dense t1 (A.coldim ()), t2 (A.rowdim ());
+		_VD.copy (t1, x);
+		_VD.copy (t2, y);
+		axpyin (t2, A, t1);
+		_VD.copy (y, t2);
+
+		return y;
+	}
 
-	_VD.copy (t1, x);
-	_VD.copy (t2, y);
-	axpyin (t2, A, t1);
-	_VD.copy (y, t2);
+	template <class Field>
+	template <class Vector1, class Matrix, class Vector2>
+	Vector1 &MatrixDomain<Field>::axpyinColSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
+							    VectorCategories::DenseVectorTag) const
+	{
+		linbox_check (A.coldim () == x.size ());
+		linbox_check (A.rowdim () == y.size ());
 
-	return y;
-}
+		typename Matrix::ConstColIterator i = A.colBegin ();
+		typename Vector2::const_iterator j = x.begin ();
 
-template <class Field>
-template <class Vector1, class Matrix, class Vector2>
-Vector1 &MatrixDomain<Field>::axpyinColSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
-						    VectorCategories::DenseVectorTag) const
-{
-	linbox_check (A.coldim () == x.size ());
-	linbox_check (A.rowdim () == y.size ());
+		for (; j != x.end (); ++j, ++i)
+			_VD.axpyin (y, *j, *i);
 
-	typename Matrix::ConstColIterator i = A.colBegin ();
-	typename Vector2::const_iterator j = x.begin ();
+		return y;
+	}
 
-	for (; j != x.end (); ++j, ++i)
-		_VD.axpyin (y, *j, *i);
+	template <class Field>
+	template <class Vector1, class Matrix, class Vector2>
+	Vector1 &MatrixDomain<Field>::axpyinColSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
+							    VectorCategories::SparseSequenceVectorTag) const
+	{
+		typename Matrix::ConstColIterator i = A.colBegin ();
+		typename Vector2::iterator j = x.begin ();
 
-	return y;
-}
+		int diff;
 
-template <class Field>
-template <class Vector1, class Matrix, class Vector2>
-Vector1 &MatrixDomain<Field>::axpyinColSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
-						    VectorCategories::SparseSequenceVectorTag) const
-{
-	typename Matrix::ConstColIterator i = A.colBegin ();
-	typename Vector2::iterator j = x.begin ();
+		typename LinBox::Vector<Field>::Dense t (A.rowdim ());
 
-	int diff;
+		_VD.copy (t, y);
 
-	typename LinBox::Vector<Field>::Dense t (A.rowdim ());
+		while (j != x.end ()) {
+			_VD.axpyin (t, j->second, *i);
+			diff = j->first; ++j;
+			diff -= j->first;
+			i -= diff;
+		}
 
-	_VD.copy (t, y);
+		_VD.copy (y, t);
 
-	while (j != x.end ()) {
-		_VD.axpyin (t, j->second, *i);
-		diff = j->first; ++j;
-		diff -= j->first;
-		i -= diff;
+		return y;
 	}
 
-	_VD.copy (y, t);
+	template <class Field>
+	template <class Vector1, class Matrix, class Vector2>
+	Vector1 &MatrixDomain<Field>::axpyinColSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
+							    VectorCategories::SparseAssociativeVectorTag) const
+	{
+		typename Matrix::ConstColIterator i = A.colBegin ();
+		typename Vector2::iterator j = x.begin ();
 
-	return y;
-}
+		int diff;
 
-template <class Field>
-template <class Vector1, class Matrix, class Vector2>
-Vector1 &MatrixDomain<Field>::axpyinColSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
-						    VectorCategories::SparseAssociativeVectorTag) const
-{
-	typename Matrix::ConstColIterator i = A.colBegin ();
-	typename Vector2::iterator j = x.begin ();
+		typename LinBox::Vector<Field>::Dense t (A.rowdim ());
 
-	int diff;
+		_VD.copy (t, y);
 
-	typename LinBox::Vector<Field>::Dense t (A.rowdim ());
+		while (j != x.end ()) {
+			_VD.axpyin (t, j->second, *i);
+			diff = j->first; ++j;
+			diff -= j->first;
+			i -= diff;
+		}
 
-	_VD.copy (t, y);
+		_VD.copy (y, t);
 
-	while (j != x.end ()) {
-		_VD.axpyin (t, j->second, *i);
-		diff = j->first; ++j;
-		diff -= j->first;
-		i -= diff;
+		return y;
 	}
 
-	_VD.copy (y, t);
+	template <class Field>
+	template <class Vector1, class Matrix, class Vector2>
+	Vector1 &MatrixDomain<Field>::axpyinColSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
+							    VectorCategories::SparseParallelVectorTag) const
+	{
+		typename Matrix::ConstColIterator i = A.colBegin ();
+		typename Vector2::iterator j_idx = x.first.begin ();
+		typename Vector2::iterator j_elt = x.second.begin ();
 
-	return y;
-}
+		int diff;
 
-template <class Field>
-template <class Vector1, class Matrix, class Vector2>
-Vector1 &MatrixDomain<Field>::axpyinColSpecialized (Vector1 &y, const Matrix &A, const Vector2 &x,
-						    VectorCategories::SparseParallelVectorTag) const
-{
-	typename Matrix::ConstColIterator i = A.colBegin ();
-	typename Vector2::iterator j_idx = x.first.begin ();
-	typename Vector2::iterator j_elt = x.second.begin ();
+		typename LinBox::Vector<Field>::Dense t (A.rowdim ());
 
-	int diff;
+		_VD.copy (t, y);
 
-	typename LinBox::Vector<Field>::Dense t (A.rowdim ());
+		for (; j_idx != x.first.end (); ++j_elt) {
+			_VD.axpyin (t, *j_elt, *i);
+			diff = *j_idx; ++j_idx;
+			diff -= *j_idx;
+			i -= diff;
+		}
 
-	_VD.copy (t, y);
+		_VD.copy (y, t);
 
-	for (; j_idx != x.first.end (); ++j_elt) {
-		_VD.axpyin (t, *j_elt, *i);
-		diff = *j_idx; ++j_idx;
-		diff -= *j_idx;
-		i -= diff;
+		return y;
 	}
 
-	_VD.copy (y, t);
-
-	return y;
-}
+	template <class Field>
+	template <class Matrix1, class Blackbox, class Matrix2>
+	Matrix1 &MatrixDomain<Field>::blackboxMulLeft (Matrix1 &C, const Blackbox &A, const Matrix2 &B) const
+	{
+		linbox_check (A.coldim () == B.rowdim ());
+		linbox_check (A.rowdim () == C.rowdim ());
+		linbox_check (B.coldim () == C.coldim ());
 
-template <class Field>
-template <class Matrix1, class Blackbox, class Matrix2>
-Matrix1 &MatrixDomain<Field>::blackboxMulLeft (Matrix1 &C, const Blackbox &A, const Matrix2 &B) const
-{
-	linbox_check (A.coldim () == B.rowdim ());
-	linbox_check (A.rowdim () == C.rowdim ());
-	linbox_check (B.coldim () == C.coldim ());
+		typename Matrix1::ColIterator i = C.colBegin ();
+		typename Matrix2::ConstColIterator j = B.colBegin ();
 
-	typename Matrix1::ColIterator i = C.colBegin ();
-	typename Matrix2::ConstColIterator j = B.colBegin ();
+		for (; i != C.colEnd (); ++i, ++j)
+			A.apply (*i, *j);
 
-	for (; i != C.colEnd (); ++i, ++j)
-		A.apply (*i, *j);
+		return C;
+	}
 
-	return C;
-}
+	template <class Field>
+	template <class Matrix1, class Matrix2, class Blackbox>
+	Matrix1 &MatrixDomain<Field>::blackboxMulRight (Matrix1 &C, const Matrix2 &A, const Blackbox &B) const
+	{
+		linbox_check (A.coldim () == B.rowdim ());
+		linbox_check (A.rowdim () == C.rowdim ());
+		linbox_check (B.coldim () == C.coldim ());
 
-template <class Field>
-template <class Matrix1, class Matrix2, class Blackbox>
-Matrix1 &MatrixDomain<Field>::blackboxMulRight (Matrix1 &C, const Matrix2 &A, const Blackbox &B) const
-{
-	linbox_check (A.coldim () == B.rowdim ());
-	linbox_check (A.rowdim () == C.rowdim ());
-	linbox_check (B.coldim () == C.coldim ());
+		typename Matrix1::RowIterator i = C.rowBegin ();
+		typename Matrix2::ConstRowIterator j = A.rowBegin ();
 
-	typename Matrix1::RowIterator i = C.rowBegin ();
-	typename Matrix2::ConstRowIterator j = A.rowBegin ();
+		for (; i != C.rowEnd (); ++i, ++j)
+			B.applyTranspose (*i, *j);
 
-	for (; i != C.rowEnd (); ++i, ++j)
-		B.applyTranspose (*i, *j);
+		return C;
+	}
 
-	return C;
-}
+	template <class Field>
+	template <class Matrix, class Iterator>
+	Matrix &MatrixDomain<Field>::permuteRowsByRow (Matrix   &A,
+						       Iterator  P_start,
+						       Iterator  P_end) const
+	{
+		Iterator i;
+		typename Matrix::RowIterator j, k;
 
-template <class Field>
-template <class Matrix, class Iterator>
-Matrix &MatrixDomain<Field>::permuteRowsByRow (Matrix   &A,
-					       Iterator  P_start,
-					       Iterator  P_end) const
-{
-	Iterator i;
-	typename Matrix::RowIterator j, k;
+		for (i = P_start; i != P_end; ++i) {
+			j = A.rowBegin () + i->first;
+			k = A.rowBegin () + i->second;
 
-	for (i = P_start; i != P_end; ++i) {
-		j = A.rowBegin () + i->first;
-		k = A.rowBegin () + i->second;
+			_VD.swap (*j, *k);
+		}
 
-		_VD.swap (*j, *k);
+		return A;
 	}
 
-	return A;
-}
+	template <class Field>
+	template <class Matrix, class Iterator>
+	Matrix &MatrixDomain<Field>::permuteRowsByCol (Matrix   &A,
+						       Iterator  P_start,
+						       Iterator  P_end) const
+	{
+		typename Matrix::ColIterator j;
 
-template <class Field>
-template <class Matrix, class Iterator>
-Matrix &MatrixDomain<Field>::permuteRowsByCol (Matrix   &A,
-					       Iterator  P_start,
-					       Iterator  P_end) const
-{
-	typename Matrix::ColIterator j;
+		for (j = A.colBegin (); j != A.colEnd (); ++j)
+			_VD.permute (*j, P_start, P_end);
 
-	for (j = A.colBegin (); j != A.colEnd (); ++j)
-		_VD.permute (*j, P_start, P_end);
+		return A;
+	}
 
-	return A;
-}
+	template <class Field>
+	template <class Matrix, class Iterator>
+	Matrix &MatrixDomain<Field>::permuteColsByRow (Matrix   &A,
+						       Iterator  P_start,
+						       Iterator  P_end) const
+	{
+		typename Matrix::RowIterator j;
 
-template <class Field>
-template <class Matrix, class Iterator>
-Matrix &MatrixDomain<Field>::permuteColsByRow (Matrix   &A,
-					       Iterator  P_start,
-					       Iterator  P_end) const
-{
-	typename Matrix::RowIterator j;
+		for (j = A.rowBegin (); j != A.rowEnd (); ++j)
+			_VD.permute (*j, P_start, P_end);
 
-	for (j = A.rowBegin (); j != A.rowEnd (); ++j)
-		_VD.permute (*j, P_start, P_end);
+		return A;
+	}
 
-	return A;
-}
+	template <class Field>
+	template <class Matrix, class Iterator>
+	Matrix &MatrixDomain<Field>::permuteColsByCol (Matrix   &A,
+						       Iterator  P_start,
+						       Iterator  P_end) const
+	{
+		Iterator i;
+		typename Matrix::ColIterator j, k;
 
-template <class Field>
-template <class Matrix, class Iterator>
-Matrix &MatrixDomain<Field>::permuteColsByCol (Matrix   &A,
-					       Iterator  P_start,
-					       Iterator  P_end) const
-{
-	Iterator i;
-	typename Matrix::ColIterator j, k;
+		for (i = P_start; i != P_end; ++i) {
+			j = A.colBegin () + i->first;
+			k = A.colBegin () + i->second;
 
-	for (i = P_start; i != P_end; ++i) {
-		j = A.colBegin () + i->first;
-		k = A.colBegin () + i->second;
+			_VD.swap (*j, *k);
+		}
 
-		_VD.swap (*j, *k);
+		return A;
 	}
 
-	return A;
-}
-
-/* FIXME: These methods are undocumented, and I'm unclear what they are supposed
- * to do 
- */
+	/* FIXME: These methods are undocumented, and I'm unclear what they are supposed
+	 * to do
+	 */
 
 #if 0
 
-/*M1<-M2**k;
- */
-template<class Matrix1, class Matrix2>
-Matrix1& MatrixDomain::pow_apply(Matrix1& M1, const Matrix2& M2, unsigned long int k) const
-{
-	linbox_check((M1.rowdim()==M1.coldim())&&
-		     (M2.rowdim()==M2.coldim())&&
-		     (M1.rowdim()==M2.rowdim()));
-
-  
-	typename Matrix1::RawIterator p=M1.rawBegin();
-	for(;p!=M1.rawEnd();++p)
-		M1.field().init(*p,0);
-	for(p=M1.rawBegin();p<M1.rawEnd();)
-	{
-		M1.field().init(*p,1);
-		p=p+M1.rowdim()+1;
-	}
-    
-    
-	for(int i=0;i<k;++i)
-		mulin_R(M1,M2);
-    
-	return M1;
-}
-    
-  
-template<class Matrix1, class Matrix2>
-Matrix1& MatrixDomain::pow_horn(Matrix1& M1, const Matrix2& M2, unsigned long int k) const
-{
-	linbox_check((M1.rowdim()==M1.coldim())&&
-		     (M2.rowdim()==M2.coldim())&&
-		     (M1.rowdim()==M2.rowdim()));
-    
-	if(k==0)
+	/*M1<-M2**k;
+	*/
+	template<class Matrix1, class Matrix2>
+	Matrix1& MatrixDomain::pow_apply(Matrix1& M1, const Matrix2& M2, unsigned long int k) const
 	{
+		linbox_check((M1.rowdim()==M1.coldim())&&
+			     (M2.rowdim()==M2.coldim())&&
+			     (M1.rowdim()==M2.rowdim()));
+
+
 		typename Matrix1::RawIterator p=M1.rawBegin();
 		for(;p!=M1.rawEnd();++p)
 			M1.field().init(*p,0);
 		for(p=M1.rawBegin();p<M1.rawEnd();)
 		{
 			M1.field().init(*p,1);
-			p+=M1.rowdim()+1;
+			p=p+M1.rowdim()+1;
 		}
+
+
+		for(int i=0;i<k;++i)
+			mulin_R(M1,M2);
+
 		return M1;
 	}
-    
-	typename Matrix1::RawIterator p1;
-	typename Matrix2::ConstRawIterator p2;
-	for(p1=M1.rawBegin(),p2=M2.rawBegin();p1!=M1.rawEnd();++p1,++p2)
-		M1.field().assign(*p1,*p2);
-  
-	std::vector<bool> bit;
-	bit.reserve(sizeof(unsigned long)*4);
-	while(k>0)
-	{
-		bit.push_back(k%2);
-		k/=2;
-	};
-
-    
-	std::vector<bool>::reverse_iterator p=bit.rbegin();
-	++p;
-	Matrix1 temp(M1);
-	for(;p!=bit.rend();++p)
+
+
+	template<class Matrix1, class Matrix2>
+	Matrix1& MatrixDomain::pow_horn(Matrix1& M1, const Matrix2& M2, unsigned long int k) const
 	{
-		temp=M1;
-		mulin_L(M1,temp);
-		if(*p)
-			mulin_L(M1,M2);
+		linbox_check((M1.rowdim()==M1.coldim())&&
+			     (M2.rowdim()==M2.coldim())&&
+			     (M1.rowdim()==M2.rowdim()));
 
+		if(k==0)
+		{
+			typename Matrix1::RawIterator p=M1.rawBegin();
+			for(;p!=M1.rawEnd();++p)
+				M1.field().init(*p,0);
+			for(p=M1.rawBegin();p<M1.rawEnd();)
+			{
+				M1.field().init(*p,1);
+				p+=M1.rowdim()+1;
+			}
+			return M1;
+		}
+
+		typename Matrix1::RawIterator p1;
+		typename Matrix2::ConstRawIterator p2;
+		for(p1=M1.rawBegin(),p2=M2.rawBegin();p1!=M1.rawEnd();++p1,++p2)
+			M1.field().assign(*p1,*p2);
+
+		std::vector<bool> bit;
+		bit.reserve(sizeof(unsigned long)*4);
+		while(k>0)
+		{
+			bit.push_back(k%2);
+			k/=2;
+		};
+
+
+		std::vector<bool>::reverse_iterator p=bit.rbegin();
+		++p;
+		Matrix1 temp(M1);
+		for(;p!=bit.rend();++p)
+		{
+			temp=M1;
+			mulin_L(M1,temp);
+			if(*p)
+				mulin_L(M1,M2);
+
+		}
+
+		return M1;
 	}
-      
-	return M1;     
-}
 
 #endif
 
 } // namespace LinBox
 
-#endif // __MATRIX_DOMAIN_INL
+#endif // __LINBOX_matrix_domain_INL
+
diff --git a/linbox/matrix/matrix-permutation.h b/linbox/matrix/matrix-permutation.h
new file mode 100644
index 0000000..c60a994
--- /dev/null
+++ b/linbox/matrix/matrix-permutation.h
@@ -0,0 +1,363 @@
+/* -*- 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
+
+/* Copyright (C) 2010 LinBox
+ * Written by <brice.boyer at imag.fr>
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/** @file matrix/matrix-permutation.h
+ * @ingroup matrix
+ * A permutation class for operations on permutations, their representations
+ * and matrix row/column permuting.
+ *
+ * We provide a \ref LinBox::BlasPermutation class that stores the
+ * permutation packed in a Lapack style and a \ref LinBox::MatrixPermutation
+ * class that represents a permutation naturally.  Converstions are provided.
+ */
+
+#ifndef __LINBOX_matrix_permutation_H
+#define __LINBOX_matrix_permutation_H
+
+#include <vector>
+#include <ostream>
+
+
+// BlasPermutation
+namespace LinBox
+{
+
+#if 0
+	template<class _Uint>
+	class PermutationInterface {
+	public :
+		virtual _Uint getSize() = 0;
+	};
+#endif
+
+	// forward declaration
+	template<class _Uint>
+	class MatrixPermutation ;
+
+	template<class _Uint>
+	class BlasPermutation ;
+
+	/** Lapack-style permutation.
+	 * @ingroup permutation
+	 *
+	 * A Lapack permutation is represented with a vector \f$[p_1,p_2,\cdots, p_r]\f$
+	 * such that \f$p_i > i\f$. Converting it to a classic representation
+	 * of a permutation corresponds to taking an identity permutation and
+	 * then successively permuting \f$(i,p_i)\f$.
+	 * Example : if <code>P=[1,4,4]</code> and <code>V=[1,2,3,4,5]</code>, then <code>P.V=[1,4,2,3,5]</code>.
+	 * @internal
+	 * @pre if \c Q_ is built, then \c P_=Q_
+	*/
+	template<class _UnsignedInt> // unsigned * ou Integer
+	class BlasPermutation /*  : PermutationInterface<_UnsignedInt> */ {
+		typedef BlasPermutation<_UnsignedInt> BlasPerm ;
+	public :
+		BlasPermutation() ;
+		~BlasPermutation() ;
+
+		BlasPermutation(size_t n) ;
+
+		BlasPermutation(const _UnsignedInt * V, const _UnsignedInt & n) ;
+		BlasPermutation(const std::vector<_UnsignedInt> & V);
+		BlasPermutation(const MatrixPermutation<_UnsignedInt> &M);
+
+#if 0
+		BlasPermutation(MatrixPermutation & P);
+		BlasPermutation(TranspositionPermutation & P);
+
+		//        void Invert() ;
+		//        BlasPerm & getInverse(BlasPerm & P) ;
+
+
+		template<class _Perm>
+		_Perm & convert(_Perm & NewP);
+
+		template<class _Perm>
+		_Perm & convertTranspose(_Perm & NewP);
+
+		void getOrder() ;
+		void resize() ;
+		void size() ;
+
+
+		void Tranpsose() ;
+		BlasPerm & getTranspose(BlasPerm & P) ;
+		void Tranpsose(Index &i, Index & j);
+
+		void applyP( BlasPerm & P, enum Side s, enum Trans = NoTranspose) ;
+		void applyPT( BlasPerm & P, enum Side s) ;
+#endif
+
+		// operator =
+		BlasPermutation<_UnsignedInt>& operator= (const BlasPermutation<_UnsignedInt> & P)
+		{
+			r_       = P.r_;
+			n_       = P.n_;
+			P_       = P.P_;
+			Q_       = P.Q_;
+			inv_     = P.inv_ ;
+
+			return (*this) ;
+		}
+
+		/*  size */
+		_UnsignedInt getSize() const ;
+		// _UnsignedInt getOrder() ;
+
+		_UnsignedInt getOrder() const ;
+		void setOrder( size_t r)  ;
+
+		std::vector<_UnsignedInt> & getStorage() ;
+		void resize(_UnsignedInt & s, bool with_zeros=true) ;
+
+		// template<class OutVector, class InVector>
+		// OutVector &apply (OutVector &y, const InVector &x)  ;
+		// template<class OutVector, class InVector>
+		// OutVector &applyTranspose (OutVector &y, const InVector &x) ;
+
+		/*  properties */
+		bool isIdentity() const
+		{
+			return (!r_);
+		}
+
+		/*  convert */
+		/*! Converts a \c BlasPermutation to a \c MatrixPermutation.
+		 * @param[out] P MatrixPermutation to be created. Need not be initialized.
+		 */
+		MatrixPermutation<_UnsignedInt> & Convert(MatrixPermutation<_UnsignedInt> &P);
+
+		/*  apply */
+		// /*! \f$ M \gets P M\f$   */
+		// template<class Matrix>
+		// Matrix & applyRows(Matrix &M);
+		// /*! \f$ M \gets M P\f$   */
+		// template<class Matrix>
+		// Matrix & applyCols(Matrix &M);
+
+		// /*! \f$ M \gets M P^t\f$   */
+		// template<class Matrix>
+		// Matrix & applyTransposeRows(Matrix &M);
+		// /*! \f$ M \gets P^t M\f$   */
+		// template<class Matrix>
+		// Matrix & applyTransposeCols(Matrix &M);
+
+		//_UnsignedInt & operator[] (const _UnsignedInt &i) ;
+		_UnsignedInt  operator[] (const _UnsignedInt i) const ;
+
+		// /*! col \p i and col \p j are swapped
+		 // */
+		// void TransposeCols(_UnsignedInt i, _UnsignedInt j);
+
+		// /*! row \p i and row \p j are swapped
+		 // */
+		// void TransposeRows(_UnsignedInt i, _UnsignedInt j);
+
+		const _UnsignedInt* getPointer() const
+		{
+			linbox_check(r_);
+			return &P_[0];
+		}
+
+		_UnsignedInt* getWritePointer()
+		{
+			linbox_check(r_);
+			return &P_[0];
+		}
+
+		/*  invert */
+		void Transpose();
+		void Invert();
+		BlasPerm & Transpose(BlasPerm &Mt);
+		BlasPerm & Invert(BlasPerm &Mt);
+
+		/* clean */
+		void Compress() ;
+
+		/*  print */
+		/*! writes on output stream \p o */
+		std::ostream & write(std::ostream & o, bool Lapack=true) const ;
+
+		/*! writes \p P on output stream \p o */
+		template<class _Uint>
+		friend std::ostream & operator<<(std::ostream &o, BlasPerm & P) ;
+
+
+	protected :
+		_UnsignedInt			        r_ ;	// size of compressed permutation
+		mutable _UnsignedInt			n_ ;	// dim of permutation
+		std::vector<_UnsignedInt>	        P_ ;	// blas permutation
+		mutable std::vector<_UnsignedInt>       Q_ ;    // corresponding matrix permutation
+		bool                                    inv_ ;  // matrix is inverted ?
+
+		// hmmmm...
+		// using stl vectors instead of pointers for the sake of simplicity...
+		// this allows permutation up to MAX_INT size. Not so restricting for now...
+
+		void BuildQ_() const ;
+		void InvertQ_();
+		std::vector<_UnsignedInt> &InvertQ_(std::vector<_UnsignedInt> & Qinv);
+		void BuildP_(std::vector<_UnsignedInt>&Q, std::vector<_UnsignedInt>&Qinv);
+		bool CheckP_();
+		void InitQ_() const ;
+
+
+	};
+} // LinBox
+
+// MatrixPermutation
+namespace LinBox
+{
+
+	/*! Permutation classique.
+	 * @ingroup permutation
+	 */
+	template<class _UnsignedInt>
+	class MatrixPermutation /*  : PermutationInterface<_UnsignedInt> */ {
+		typedef MatrixPermutation<_UnsignedInt> MatPerm ;
+	private :
+		_UnsignedInt			n_ ; // order of permutation
+		std::vector<_UnsignedInt>	P_ ; // _M_[i] = j ssi P(i) = j
+
+	public :
+		MatrixPermutation();
+		~MatrixPermutation() {};
+		MatrixPermutation(const _UnsignedInt * V, const _UnsignedInt & n) ;
+		MatrixPermutation(const std::vector<_UnsignedInt> & V) ;
+
+		_UnsignedInt  operator[] (const _UnsignedInt i) const ;
+		_UnsignedInt getSize() const ;
+		// _UnsignedInt getSize() ;
+
+		void resize( _UnsignedInt n ) ;
+
+		void Transpose();
+		void Invert();
+		MatPerm & Transpose(MatPerm &Mt);
+		MatPerm & Invert(MatPerm &Mt);
+
+
+
+		/*  print */
+		/*! writes on output stream \p o */
+		std::ostream & write(std::ostream & o) const ;
+
+		/*! writes \p P on output stream \p o */
+		template<class _Uint>
+		friend std::ostream & operator<<(std::ostream &o, MatPerm & P) ;
+
+		template<class OutVector, class InVector>
+		OutVector &apply (OutVector &y, const InVector &x) const ;
+		template<class OutVector, class InVector>
+		OutVector &applyTranspose (OutVector &y, const InVector &x) const ;
+
+
+		void TransposeRows(_UnsignedInt i, _UnsignedInt j);
+		void TransposeCols(_UnsignedInt i, _UnsignedInt j);
+
+	};
+
+} // LinBox
+
+#if 0 /* stuff to be removed */
+namespace LinBox
+{
+
+	//! produit de permutations
+	template<class _UnsignedInt>
+	class TranspositionPermutation {
+		typedef std::pair<_UnsignedInt,_UnsignedInt> Transposition  ;
+	private :
+		_UnsignedInt _n_ ;			// order of permutation
+		_UnsignedInt _r_ ;			//  number of transpositions
+		std::vector<Transposition> _T_ ;	// if _T_[k] = (i,j) then P(i) = j
+
+	public :
+	};
+
+	//!@todo produit de cycles à supports disjoints
+
+
+	//! on regroupe dedans les parties "BB" des perms précédentes.
+
+	template<class _Field>
+	class BlackboxInterface {
+	public :
+		typedef BlackboxInterface<_Field> Self_t ;
+		virtual size_t rowdim() const ;
+		virtual size_t coldim() const ;
+		template<class OutVec,InVec>
+		virtual OutVec &apply (OutVec & , const InVec & ) const ;
+		template<class OutVec,InVec>
+		virtual OutVec &applyTranspose (OutVec & , const InVec & ) const ;
+		virtual _Field & field() const ;
+		template<class _Tp1>
+		virtual struct rebind {
+			typedef BlackboxInterface<_Tp1> other ;
+			virtual void operator() (other &, cosnt Self_t &, const _Tp1 &) ;
+		} ;
+	};
+
+	template<class _Perm, class _Field>
+	class BlackBoxPermutation : public BlackboxInterface { // ?????????????
+	private :
+		_Perm  _P_ ;
+		_Field _F_ ; //????????????????????????
+	public :
+		size_t rowdim() ;
+		size_t coldim() ;
+		void permute( Index i, Index j);
+		const Field & field() { return _F_ ;}
+		apply();
+		applyTranspose() ;
+		template<typename _Tp1>
+		struct rebind {} ;
+
+		setStorage();
+		getStorage();
+
+	};
+
+#if 0
+	template<class _Perm>
+	class PermutationDomain {
+	private :
+		_Perm _P_ ;
+	public :
+		// P.permute(A) ??? :)
+		template<class _Matrix>
+		_Matrix & permute (_Matrix & M,  enum Side s, enum Trans t = NoTranspose) ;
+		template<class _Matrix>
+		_Matrix & invmute (_Matrix & M, enum Side s) ;
+
+
+
+	};
+#endif
+}
+#endif
+
+#include "matrix-permutation.inl"
+
+#endif //__LINBOX_matrix_permutation_H
diff --git a/linbox/matrix/matrix-permutation.inl b/linbox/matrix/matrix-permutation.inl
new file mode 100644
index 0000000..b5476a1
--- /dev/null
+++ b/linbox/matrix/matrix-permutation.inl
@@ -0,0 +1,619 @@
+/* -*- 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
+
+/* Copyright (C) 2010 LinBox
+ * Written by <brice.boyer at imag.fr>
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/** @file matrix-permutation.inl
+ * @brief Implementation of matrix-permutation.h
+ */
+
+#ifndef __LINBOX_matrix_permutation_INL
+#define __LINBOX_matrix_permutation_INL
+
+#define _LB_DBG
+
+#include <algorithm>
+#include "linbox/util/debug.h"
+
+// BlasPermutation
+namespace LinBox
+{
+	template<class _Uint>
+	BlasPermutation<_Uint>::BlasPermutation() :
+	       	r_(0),n_((_Uint)-1),P_(0),Q_(0),inv_(false)
+	{
+		std::cout << "NULL permutation created. Beware !" << std::endl;
+	};
+
+	template<class _Uint>
+	BlasPermutation<_Uint>::BlasPermutation(size_t n) :
+	       	r_(n),n_((_Uint)-1),P_(n),Q_(0),inv_(false)
+	{ };
+
+
+	template<class _Uint>
+	BlasPermutation<_Uint>::~BlasPermutation() {}
+
+	// n_ is not computed here.
+	template<class _Uint>
+	BlasPermutation<_Uint>::BlasPermutation(const _Uint *P, const _Uint & r ) :
+	       	r_(r), n_((_Uint)-1),P_(0),Q_(0),inv_(false)
+	{
+		// std::cout << "CTOR 2" << std::endl;
+		// std::cout << "got : perm of " << r << std::endl;
+		// for (size_t i = 0 ; i< r ; ++i) std::cout << P[i] << ' ' ;
+		// std::cout<<std::endl;
+		if (!r) {
+			// n_ = 0 ;
+			return ;
+		}
+		P_.resize(r_);
+		for (_Uint  i = 0 ; i < r_ ; ++i) {
+			P_[i] = P[i] ;
+		}
+
+		// std::cout << "return : perm  (" << cleaned_ << ") of " << r_ << std::endl;
+		// for (size_t i = 0 ; i< r_ ; ++i) std::cout << P_[i] << ' ' ;
+		// std::cout<<std::endl;
+
+		return ;
+
+	}
+
+	// n_ is not computed here.
+	template<class _Uint>
+	BlasPermutation<_Uint>::BlasPermutation(const std::vector<_Uint> & P) :
+	       	r_(P.size()), n_((_Uint)-1),P_(0),Q_(0),inv_(false)
+	{
+		if ( !r_ )  {
+			// n_ = 0 ;
+			return ;
+		}
+		P_ = P;
+		return ;
+
+	}
+
+	// n_ is not computed here.
+	template<class _Uint>
+	BlasPermutation<_Uint>::BlasPermutation(const MatrixPermutation<_Uint> & P) :
+	       	r_(P.getSize()), n_((_Uint)/*P.getSize()*/-1),P_(P.getSize()),Q_(P),inv_(false)
+	{
+		if ( !r_ ) {
+			return ;
+		}
+		std::vector<_Uint> Qinv(n_);
+		InvertQ_(Qinv);
+		BuildP_(Qinv,Q_);
+	}
+
+	// n_ is computed here
+	template<class _Uint>
+	_Uint
+	BlasPermutation<_Uint>::getSize() const
+	{
+		// std::cout << "getting size (" << r_ << ") :";
+		// this->write(std::cout) << std::endl ;
+
+		// std::cout << " was " << n_ << std::endl;
+		if ( n_ == (_Uint) -1 ) { //! @warning potentially catastrophic
+			if (!r_)
+				n_ = 0 ;
+			else
+				n_ = (*(std::max_element(P_.begin(),P_.end())))+1 ;
+		}
+		// std::cout << " is " << n_ << std::endl;
+		return n_ ;
+	}
+
+	template<class _Uint>
+	_Uint
+	BlasPermutation<_Uint>::getOrder() const
+	{
+		return r_ ;
+	}
+
+	template<class _Uint>
+	void BlasPermutation<_Uint>::setOrder( size_t r)
+	{
+		r_ = r  ;
+		n_ = (_Uint) -1 ;
+	}
+
+
+	template<class _Uint>
+	MatrixPermutation<_Uint> &
+	BlasPermutation<_Uint>::Convert (MatrixPermutation<_Uint> & P)
+	{
+		getSize() ;   // si c'était pas déjà fait...
+		P.resize(n_); // sets P to identity
+		for (_Uint i = 0 ; i < n_ ; ++i)
+			std::swap(P[i],P[P_[i]]);
+		return P ;
+	}
+
+	/// compresses BlasPermutation to a smaller \c r_.
+	template<class _Uint>
+	void BlasPermutation<_Uint>::Compress()
+	{
+		// std::cout << r_ << std::endl;
+		if (!r_) {
+			linbox_check(!n_);
+			P_.resize(0) ;
+			return ;
+		}
+		_Uint rr = r_-1 ;
+		while ( rr && (P_[rr] == 0  )) --rr ;    // removing trailing zeros
+		while ( rr && (P_[rr] == rr )) --rr ;    // useless information
+		if ((rr == 0) && (P_[0] == 0)) {
+			r_ = 0 ;
+			n_ = 0  ;
+			P_.resize(0) ;
+			return ;
+		}
+		r_ = rr+1 ;
+		P_.resize(r_,0);   // done cleaning.
+		n_ = -1 ;
+		// recomputing n_ if lost.
+		// if (n_ != (_Uint) -1) {
+			// n_ = getSize();
+		// }
+		return ;
+	}
+
+	template<class _Uint>
+	void BlasPermutation<_Uint>::InitQ_() const
+	{
+		getSize();
+		Q_.resize(n_);
+		for (_Uint i = 0 ; i < n_ ; ++i) Q_[i] = i ;
+	}
+
+	template<class _Uint>
+	void BlasPermutation<_Uint>::Transpose()
+	{
+		Invert();
+	}
+
+	template<class _Uint>
+	void BlasPermutation<_Uint>::Invert()
+	{
+		if (!r_) {
+			return ;
+		}
+		if (inv_) {
+			inv_ = false ;
+			return ;
+		}
+		inv_ = false ;
+		getSize();
+		// if not already computed :
+		BuildQ_();
+		std::vector<_Uint> Qinv(n_) ;
+		InvertQ_(Qinv);
+		BuildP_(Q_,Qinv);
+		Q_.resize(0);
+		return ;
+	}
+
+	// P = convert(Q), using Qinv
+	template<class _Uint>
+	void BlasPermutation<_Uint>::BuildP_( std::vector<_Uint> &Q, std::vector<_Uint> &Qinv)
+	{
+		linbox_check( r_ );
+		P_.resize(getSize());
+		/*  building */
+		// std::cout << "Buiding P (" << n_ << ")" << std::endl;
+		_Uint pi,qi,qpi ;
+		for (_Uint i = 0 ;i < n_ ; ++i) {
+			pi  = P_[i]  = Qinv[i];
+			if(i == pi) continue ;
+			qi  = Q[i];
+			qpi = Q[pi] ;
+			std::swap(Q[i],Q[pi]);
+			std::swap(Qinv[qi],Qinv[qpi]);
+		}
+		/*  cleaning */
+		linbox_check(n_ && (n_ != (_Uint)-1) );
+		r_ = n_-1 ;
+		Compress();
+		// while (r && P_[r] == r) --r ;
+		// if (P_[0] != 0) ++r ;
+		//std::cout << "new :" << r << std::endl;
+		// r_ = r ;
+		// P_.resize(r_) ;
+		/* rebuild Q */
+		//for (_Uint i = 0 ; i < r_ ; ++i) std::swap(Q[i],Q[P_[i]]);
+	}
+
+	template<class _Uint>
+	void BlasPermutation<_Uint>::BuildQ_() const
+	{
+		if ((_Uint)Q_.size() == n_) return ; // si Q_ est déjà initialisée, alors P_ == Q_
+		// set Q_ to identity
+		InitQ_();
+		// then permute it
+		// faster if P_ is ::Compress()ed
+		for (_Uint i = 0 ; i < r_ ; ++i) {
+			if (P_[i]>i) {
+				std::swap(Q_[i],Q_[P_[i]]);
+			}
+		}
+		return ;
+	}
+
+	template<class _Uint>
+	bool BlasPermutation<_Uint>::CheckP_()
+	{
+		for (_Uint i = 0 ; i < r_ ; ++i)
+			if (P_[i] && P_[i] < i)
+				return false ;
+		return true ;
+	}
+
+	template<class _Uint>
+	std::vector<_Uint> & BlasPermutation<_Uint>::InvertQ_(std::vector<_Uint> & Qinv)
+	{
+		linbox_check(n_ != (_Uint) -1);
+		for (_Uint i = 0 ; i < n_ ; ++i)
+			Qinv[Q_[i]] = i ;
+		return Qinv ;
+	}
+
+#if 0 /*  non-sense */
+	template<class _Uint>
+	void BlasPermutation<_Uint>::InvertQ_()
+	{
+		linbox_check(n_ != (_Uint) -1);
+		for (_Uint i = 0 ; i < n_ ; ++i)
+			Q_[Q_[i]] = i ;
+	}
+#endif
+
+#if 0
+	template<class _Uint>
+	inline _Uint
+	BlasPermutation<_Uint>::operator[](const _Uint & i)
+	{
+		BuildQ_() ;
+		linbox_check( i<Q_.size() ) ;
+		return Q_[i] ;
+	}
+#endif
+
+	template<class _Uint>
+	inline  _Uint
+	BlasPermutation<_Uint>::operator[](const _Uint  i) const
+	{
+		if (!r_) return i ;
+		getSize() ;
+		BuildQ_() ;
+		linbox_check(n_ == Q_.size() );
+		if (i >= n_)
+			return i ;
+		return Q_[i] ;
+	}
+
+
+	/* ****** */
+	/* output */
+	/* ****** */
+	template<class _Uint>
+	std::ostream & BlasPermutation<_Uint>::write (std::ostream & o, bool Lapack) const
+	{
+		if (Lapack) {
+			o << '['  ;
+			_Uint i = 0 ;
+			if (r_) {
+				if (r_ > 1) {
+					for ( ; i < r_-1 ; ++i)
+						o << P_[i] << ',';
+				}
+				o << P_[i] ;
+			}
+			o  << ']' ;
+			if (inv_) o << "^{-1}" ;
+			o << '(' << (long int) (n_+1)-(long int)1 << ')' ;
+		}
+		else {
+			// std::cout << "order : " << r_ << std::endl;
+			// std::cout << "P_ := " << (std::vector<_Uint>)P_ << std::endl;
+			// std::cout << "Q_ := " << (std::vector<_Uint>)Q_ << std::endl;
+			// std::cout << Q_.size() << std::endl;
+			BuildQ_() ;
+			// std::cout << "Q_ := " << (std::vector<_Uint>)Q_ << std::endl;
+			// std::cout << Q_.size() << std::endl;
+			o << '['  ;
+			_Uint i = 0 ;
+			if (n_) {
+				if (n_ > 1) {
+					for ( ; i < n_-1 ; ++i)
+						o << Q_[i] << ',';
+				}
+				o << Q_[i] ;
+			}
+			o  << ']' ;
+			if (inv_) o << "^{-1}" ;
+			o << '(' << (long int) (n_+1)-(long int)1 << ')' ;
+		}
+		return o;
+	}
+
+	template<class _Uint>
+	std::ostream & operator<<(std::ostream &o, BlasPermutation<_Uint> & P)
+	{
+		return P.write(o) ;
+	}
+
+#if 0
+
+	/* ******* */
+	/*  Apply  */
+	/* ******* */
+
+	template<class _Uint>
+	template<class OutVector, class InVector>
+	OutVector &BlasPermutation<_Uint>::apply (OutVector &y, const InVector &x)
+	{
+		linbox_check((_Uint)x.size() == getSize());
+		linbox_check((_Uint)y.size() == getSize());
+		y = x ; // no need for Field operations...
+		for (_Uint i = 0 ; i < r_ ; ++i)
+			std::swap(y[i],y[P_[i]]) ;
+
+		return y ;
+	}
+
+	template<class _Uint>
+	template<class OutVector, class InVector>
+	OutVector &BlasPermutation<_Uint>::applyTranspose (OutVector &y, const InVector &x)
+	{
+		linbox_check((_Uint)x.size() == getSize());
+		linbox_check((_Uint)y.size() == getSize());
+		y = x ; // no need for Field operations...
+		_Uint i = r_ ;
+		for ( ; i-- ; )
+			std::swap(y[i],y[P_[i]]) ;
+
+		return y ;
+	}
+
+#endif
+
+#if 0
+	/* *************** */
+	/*  Transposition  */
+	/* *************** */
+
+	template<class _Uint>
+	void BlasPermutation<_Uint>::TransposeRows(_Uint i, _Uint j)
+	{
+		if (i == j) return ;
+		linbox_check(i<getSize());
+		linbox_check(j<getSize());
+		BuildQ_() ;
+		std::vector<_Uint> Qinv(n_) ;
+		InvertQ_(Qinv);
+		std::swap(Q_[Qinv[i]],Q_[Qinv[j]]);
+		std::swap(Qinv[i],Qinv[j]);
+		BuildP_(Qinv,Q_);
+		Q_.resize(0);
+
+	}
+
+	template<class _Uint>
+	void BlasPermutation<_Uint>::TransposeCols(_Uint i, _Uint j)
+	{
+		if (i == j) return ;
+		linbox_check(i<getSize());
+		linbox_check(j<getSize());
+		BuildQ_() ;
+		std::swap(Q_[i],Q_[j]);
+		std::vector<_Uint> Qinv(n_) ;
+		InvertQ_(Qinv);
+		BuildP_(Qinv,Q_);
+		Q_.resize(0);
+
+	}
+#endif
+
+}
+
+
+namespace LinBox
+{
+	template<class _Uint>
+	MatrixPermutation<_Uint>::MatrixPermutation() :
+	       	n_(0), P_(0)
+       	{}
+
+	template<class _Uint>
+	MatrixPermutation<_Uint>::MatrixPermutation(const _Uint *P, const _Uint &n) :
+		n_(n), P_(n)
+	{
+		for (_Uint i = 0 ; i < n ; ++i)
+			P_[i] = P[i] ;
+	}
+
+	template<class _Uint>
+	MatrixPermutation<_Uint>::MatrixPermutation(const std::vector<_Uint> & P) :
+		n_(P.size()), P_(P)
+       	{}
+
+	template<class _Uint>
+	inline  _Uint
+	MatrixPermutation<_Uint>::operator[](const _Uint  i) const
+	{
+		return P_[i] ;
+	}
+
+
+	template<class _Uint>
+	_Uint
+	MatrixPermutation<_Uint>::getSize() const
+	{ return n_ ; }
+
+	template<class _Uint>
+	void
+	MatrixPermutation<_Uint>::resize( _Uint  n)
+	{
+		if (n < n_) {
+#ifdef DEBUG
+			/* checking that we do only remove terms
+			 * that don't alter the fact P_ is a permuation of [[1,n]].
+			 */
+			bool lost = false ;
+			for (_Uint i = n ; !lost && i < n_ ; ++i)
+				if (P_[i]<n-1) lost = true ;
+			if (lost)
+				std::cerr << "Warning ! (in " << __FILE__ << " at " << __func__ << " (" << __LINE__ << ") your permutation is no longer consistent" << std::endl;
+#endif
+		}
+		/* resizing to identity */
+		P_.resize(n);
+		for (_Uint i = n_ ; i< n ; ++i)
+			P_[i] =  i ;
+		n_ = n ;
+
+		return ;
+	}
+
+
+	/* ****** */
+	/* output */
+	/* ****** */
+	template<class _Uint>
+	std::ostream & MatrixPermutation<_Uint>::write (std::ostream & o) const
+	{
+		o << '['  ;
+		for (_Uint i = 0 ; i < n_ ; ++i)
+		{ o << P_[i]  ; if (i< n_-1) o << ','; }
+		o << ']' ;
+		return o;
+	}
+
+
+	template<class _Uint>
+	std::ostream & operator<<(std::ostream &o, MatrixPermutation<_Uint> & P)
+	{
+		return P.write(o) ;
+	}
+
+	template<class _Uint>
+	void MatrixPermutation<_Uint>::Transpose()
+	{
+		/* out of place */
+		std::vector<_Uint> Q(n_) ;
+		for (_Uint i = 0 ; i < (_Uint) n_ ; ++i)
+			Q[P_[i]] = i ;
+		P_ = Q ;
+		/* in place */
+		//! @todo in place ! (revient à parcourir des cycles)
+
+	}
+
+	template<class _Uint>
+	void MatrixPermutation<_Uint>::Invert()
+	{
+		Transpose() ;
+	}
+
+	template<class _Uint>
+	MatrixPermutation<_Uint> & MatrixPermutation<_Uint>::Transpose(MatrixPermutation<_Uint> &Mt)
+	{
+		//Mt(*this);
+		Mt.P_ = P_;
+		Mt.n_ = n_;
+		Mt.Transpose();
+		return Mt ;
+	}
+
+	template<class _Uint>
+	MatrixPermutation<_Uint> & MatrixPermutation<_Uint>::Invert(MatrixPermutation<_Uint> &Mt)
+	{
+		return Transpose(Mt) ;
+	}
+
+
+	//        MatPerm & TransposeCols(_UnsignedInt i, _UnsignedInt j);
+
+	template<class _Uint>
+	template<class OutVector, class InVector>
+	OutVector &MatrixPermutation<_Uint>::apply (OutVector &y, const InVector &x) const
+	{
+		linbox_check((_Uint)x.size() == n_);
+		linbox_check((_Uint)y.size() == n_);
+		_Uint i = n_;
+		for (;i--;)
+			y[i] = x[P_[i]] ; // no need for Field operations...
+
+		return y ;
+	}
+
+	template<class _Uint>
+	template<class OutVector, class InVector>
+	OutVector &MatrixPermutation<_Uint>::applyTranspose (OutVector &y, const InVector &x) const
+	{
+		linbox_check((_Uint)x.size() == n_);
+		linbox_check((_Uint)y.size() == n_);
+		_Uint i = n_;
+		for (;i--;)
+			y[P_[i]] = x[i] ; // no need for Field operations...
+
+		return y ;
+	}
+
+	template<class _Uint>
+	void MatrixPermutation<_Uint>::TransposeCols(_Uint i, _Uint j)
+	{
+		linbox_check(i<n_);
+		linbox_check(j<n_);
+		if (i == j) return ;
+		std::swap(P_[i],P_[j]);
+	}
+
+	template<class _Uint>
+	void MatrixPermutation<_Uint>::TransposeRows(_Uint i, _Uint j)
+	{
+		linbox_check(i<n_);
+		linbox_check(j<n_);
+		if (i == j) return ;
+		_Uint iloc = 0 ;
+		_Uint jloc = 0 ;
+		_Uint l = 0 ;
+		for ( ; l < n_ && !(iloc && jloc) ; ++l)
+			if (P_[l] == i)
+				iloc = l+1;
+			else if (P_[l] == j)
+				jloc = l+1;
+		linbox_check(iloc);
+		linbox_check(jloc);
+		--iloc ;
+		--jloc ;
+		std::swap(P_[iloc],P_[jloc]);
+
+	}
+
+}
+
+#endif //__LINBOX_matrix_permutation_INL
+
diff --git a/linbox/matrix/matrix.doxy b/linbox/matrix/matrix.doxy
index 33abf98..25a5d52 100644
--- a/linbox/matrix/matrix.doxy
+++ b/linbox/matrix/matrix.doxy
@@ -1,31 +1,44 @@
-/** \defgroup matrix linbox/matrix
- These matrix representations provide iterators for element access.
-
-The class LinBox::DenseMatrixBase provides an archetype for matrices that are
-"directly represented", that is, where the user has direct access to
-iterators over the rows and columns, and to all of the elements themselves
-by position. 
-
-The class LinBox::SparseMatrixBase provides an archetype for matrices that are
-partially "directly represented", that is, where the user has direct access to
-(sparse) iterators over the rows and columns, and to all of the nonzero elements 
-themselves by position. 
-
-The directly represented matrices are pure containers; they provide no matrix
-arithmetic and do not implement the black box interface (but this is added
-in their counterparts LinBox::DenseMatrix and LinBox::SparseMatrix in \ref blackbox) 
-They are
-parameterized solely by element type. The field is not necessary.
-
-Matrices in general may omit one of the iterators, either the row iterator or
-the column iterator. This is useful for, e.g. sparse matrices that are
-represented by sparse row vectors, since column vectors are computationally
-expensive to compute without directly building the transpose of the matrix.
-
-The class \link LinBox::MatrixDomain MatrixDomain \endlink provides a 
-complete suite of matrix arithmetic
-that works transparently with any class meeting the interface defined by the
-classes below. This includes matrix-matrix addition and multiplication,
-matrix-vector multiplication, and matrix-blackbox
-(c.f. \link LinBox::BlackboxArchetype BlackboxArchetype \endlink ) multiplication.
+// Copyright 2010 LinBox. See COPYING for licence information.
+
+/**  \ingroup linbox
+  \defgroup matrix matrix
+  \brief These matrix representations provide iterators for element access.
+
+  The class \c LinBox::DenseMatrixBase provides an archetype for matrices that
+  are "directly represented", that is, where the user has direct access to
+  iterators over the rows and columns, and to all of the elements themselves by
+  position.
+
+  The class \c LinBox::SparseMatrixBase provides an archetype for matrices that
+  are partially "directly represented", that is, where the user has direct
+  access to (sparse) iterators over the rows and columns, and to all of the
+  nonzero elements themselves by position.
+
+  The directly represented matrices are pure containers; they provide no matrix
+  arithmetic and do not implement the black box interface (but this is added in
+  their counterparts \c LinBox::DenseMatrix and \c LinBox::SparseMatrix in \ref
+  blackbox) They are parameterized solely by element type. The field is not
+  necessary.
+
+  Matrices in general may omit one of the iterators, either the row iterator or
+  the column iterator. This is useful for, e.g. sparse matrices that are
+  represented by sparse row vectors, since column vectors are computationally
+  expensive to compute without directly building the transpose of the matrix.
+
+  The class \link LinBox::MatrixDomain MatrixDomain \endlink provides a
+  complete suite of matrix arithmetic that works transparently with any class
+  meeting the interface defined by the classes below. This includes
+  matrix-matrix addition and multiplication, matrix-vector multiplication, and
+  matrix-blackbox (c.f. \link LinBox::BlackboxArchetype BlackboxArchetype
+  \endlink ) multiplication.
+
+  @todo talk about Linux::BlasPermutation
+ */
+
+ /*! @ingroup matrix
+ * @defgroup iterators Iterators
+ * @brief NO DOC YET
  */
+
+
+// vim:syn=doxygen
diff --git a/linbox/matrix/random-matrix.h b/linbox/matrix/random-matrix.h
new file mode 100644
index 0000000..e5a72bd
--- /dev/null
+++ b/linbox/matrix/random-matrix.h
@@ -0,0 +1,634 @@
+/* Copyright (C) 2010 LinBox
+ * Written by Brice Boyer <brice.boyer at imag.fr>
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/** @file matrix/random-matrix.h
+ * @ingroup matrix
+ * @brief Implementation of random matrices.
+ *
+ * We provide function to create random matrices (dense, sparse, structured)
+ * on several rings. This header was first introduced to avoid code redundancy in tests/
+ * and make it easier to write tests/ examples/.
+ *
+ * @todo à la vector/stream.h
+ */
+
+#include "linbox/matrix/blas-matrix.h"
+#include "linbox/randiter/random-integer.h"
+#include "linbox/randiter/random-prime.h"
+#include "linbox/matrix/matrix-permutation.h"
+#include "linbox/algorithms/blas-domain.h"
+
+#include "linbox/algorithms/cra-domain.h"
+#include "linbox/algorithms/cra-full-multip-fixed.h"
+
+namespace LinBox
+{
+
+	struct zarb {
+		zarb() {}
+	} ;
+	struct	_LU_ : public zarb {
+		_LU_(){}
+	} ;
+	// LU_sparse_,
+	// LU_cra_,
+	struct _Rank_update_ : public zarb {
+		_Rank_update_() {}
+	} ;
+
+	/// random method for constructing rank
+	struct RankBuilder {
+		// private :
+		// balancedLC_
+		// public:
+		typedef _LU_                   LU_ ;
+		typedef _Rank_update_ Rank_update_ ;
+		RankBuilder(){}
+	};
+
+	/// Random Dense Matrix builder.
+	template<class Randiter, class Field>
+	class RandomDenseMatrix {
+
+	protected:
+
+	private :
+		Field      F_ ; //!< The field containing the random entries. @todo is there a copy made ?
+		/*! How are entries generated ?
+		 * @pre need only provide <code>elmt& random(elmt&);</code>
+		 * @see \ref LinBox::RandIterArchetype
+		 */
+		Randiter   R_ ;
+		// Matrix    & A_ ; //!< The resulting random matrix
+	public :
+		/// constructor
+		RandomDenseMatrix(Field & F, Randiter & R) :
+			F_(F), R_(R)
+		{  }
+
+		RandomDenseMatrix(const Field & F, Randiter & R) :
+			F_(F), R_(R)
+		{  }
+
+		/// destructor
+		~RandomDenseMatrix() {}
+
+		/*! creates a randomly filled matrix.
+		 * @param A matrix to be randomized.
+		 */
+		template<class Matrix>
+		Matrix & random(Matrix & A) ;
+
+		/*! provide a matrix with prescribed rank.
+		 * @param rank expected rank
+		 * @param meth how is the matrix generated ? see \ref RankBuilder.
+		 * @warning No certificate yet.
+		 */
+		template<class Matrix,class Method>
+		Matrix & randomRank(Matrix & A, int rank
+				    , const Method & meth );
+
+		template<class Matrix>
+		Matrix & randomRank(Matrix & A, int rank
+				    , const RankBuilder::LU_ & meth );
+
+
+		template<class Matrix>
+		Matrix & randomRank(Matrix & A, int rank
+				    , const RankBuilder::Rank_update_ & meth );
+
+
+		/*! provide a matrix with prescribed rank.
+		 * Default method.
+		 * @param rank expected rank
+		 * @warning No certificate yet.
+		 */
+		template<class Matrix>
+		Matrix & randomRank(Matrix & A, int rank);
+
+
+		// template<class Matrix>
+		// void randomInvertible();
+
+		// void randomNilpotent(int nil k); // P N_k P^(-1)
+		//
+		// Matrix& getMatrix(Matrix & A) {
+		// return A = A_ ;
+		// }
+
+	};
+
+	template<class Randiter, class Field>
+	template<class Matrix>
+	Matrix &
+	RandomDenseMatrix<Randiter, Field>::random( Matrix & A)
+	{
+		// A_ = A ; // no copy ?
+		for (size_t i = 0 ; i < A.rowdim() ; ++i)
+			for (size_t j = 0 ; j < A.coldim() ; ++j)
+				R_.random(A.refEntry(i,j));
+		return A;
+	}
+
+	template<class Randiter, class Field>
+	template<class Matrix,class Method>
+	Matrix &
+	RandomDenseMatrix<Randiter, Field>::randomRank(Matrix & A,
+						       int    rank
+						       , const Method & meth )
+	{
+		throw NotImplementedYet(__func__,__FILE__,__LINE__);
+	}
+
+
+	template<class Randiter, class Field>
+	template<class Matrix>
+	Matrix &
+	RandomDenseMatrix<Randiter, Field>::randomRank(
+						       Matrix & A
+						       , int  rank
+						      )
+	{
+		return randomRank(A,rank,RankBuilder::LU_());
+	}
+
+#if 0 /*  invalid use of incomplete type...  */
+	template<class Randiter>
+	DenseMatrix<PID_integer> & RandomDenseMatrix<Randiter,PID_integer>::randomRank(
+												 DenseMatrix<PID_integer> & A
+												 , int rank
+												)
+	{
+		return randomRank(A,rank,RankBuilder::Rank_update_());
+	}
+
+#endif
+
+	template<class Randiter, class Field>
+	template< class Matrix>
+	Matrix &
+	RandomDenseMatrix<Randiter, Field>::randomRank(
+						       Matrix  & A
+						       , int   rank
+						       , const RankBuilder::LU_ & meth
+						      )
+	{
+		return random_lu_rank(F_,R_,A,rank);
+	}
+
+	template<class Randiter, class Field>
+	template<class Matrix>
+	Matrix &
+	RandomDenseMatrix<Randiter, Field>::randomRank(
+						       Matrix    & A
+						       , int     rank
+						       , const RankBuilder::Rank_update_ & meth
+						      )
+	{
+		return random_rankupdate(F_,R_,A,rank);
+	}
+
+	/*  dense matrix with random entries */
+
+	/// @todo To be factorized.
+	void RandomBlasPermutation(BlasPermutation<size_t> & P)
+	{
+		size_t * Pt = P.getWritePointer();
+		// size_t n = P.getSize();
+		size_t r = P.getOrder();
+		size_t n = r ; // no size given ?
+		for (size_t i = 0 ; i < r ; ++i) {
+			Pt[i] = i + size_t( (n-i)*( drand48() ) ) ;
+		}
+		return ;
+	}
+
+	template<class Randiter,class Field>
+	DenseMatrix<Field> &
+	random_lu_rank(const Field        & F,
+		       const Randiter     & R,
+		       DenseMatrix<Field> & A,
+		       int                & rank)
+	{
+		size_t m = A.rowdim() ;
+		size_t n = A.coldim() ;
+
+		linbox_check(m != 0);
+		linbox_check(n != 0);
+		if (rank == -1) rank = std::min(m,n)*drand48() ;
+		linbox_check(!(rank<0 || rank>std::min(m,n)));
+
+		typedef typename Field::Element Element ;
+
+		// be ready for PLUQ
+		//size_t  * P = new size_t [m]   ;
+		BlasPermutation<size_t> P(m);
+		//Element * L = new Element[m*m] ;
+		//TriangularBlasMatrix<Element> L(m,m,BlasTag::low,BlasTag::unit);
+		//! @todo !!!
+		BlasMatrix<Element> L(m,m);
+		// Element * U = new Element[m*n] ;
+		// TriangularBlasMatrix<Element> U(m,n,BlasTag::up,BlasTag::nonunit);
+		//
+		BlasMatrix<Element> U(m,n);
+		//size_t  * Q = new size_t [n]   ;
+		BlasPermutation<size_t> Q(n);
+
+		// be ready for random elements
+		NonzeroRandIter<Randiter, Field> Rnz(F,R);
+		Element one,zero;
+		F.init(one,1UL);
+		F.init(zero,0UL);
+
+		/* Create L a random invertible lower unit triangular matrix (m x m format) */
+		for (size_t j=0 ; j<m ; ++j)
+			for (size_t i=j+1; i<m;++i)
+				R.random( L.refEntry( i,j ) );
+#if 1
+		for (size_t i = 0; i < (size_t) m; ++i)
+			Rnz.random( L.refEntry( i,i ) ); // non zero diagonal
+		for (size_t j=0 ; j<m ; ++j)
+			for (size_t i=0; i<j;++i)
+				L.setEntry( i,j,zero );
+
+
+#endif
+
+		/* Create U a random rank-r upper non-unit triangular matrix (m x n format) */
+		for (size_t i = 0 ; i < (size_t) rank; ++i)
+			for (size_t j = i+1; j < n; ++j)
+				R.random( U.refEntry( i,j ) ); // r random 'triangular' lines
+		for (size_t i = 0; i < (size_t) rank; ++i)
+			Rnz.random( U.refEntry( i,i ) ); // non zero diagonal on rank first lines
+#if 1
+		for (size_t i = rank ; i < m ; ++i)
+			for (size_t j = i ; j < n ; ++j)
+				U.setEntry( i,j,zero ) ; //  zero on remaining 'triangular' lines
+#endif
+
+		/**
+		 * @todo RandomPermutation avec P de type [Matrix-Blas]Permutation
+		 */
+		RandomBlasPermutation(P);
+		RandomBlasPermutation(Q);
+
+		BlasMatrixDomain< Field > BMD(F) ;
+		// LU
+		/**
+		 * @todo : L = [[L1,0],[A,L2]] ;U = [[U1,B],[0,U2]] ; LU = [[ rec(L1,U1), ftrmm(L1,B)],[ftrmm(A,U1),fgemm(A,B)+rec(L2,U2) ]]
+		 * de même UL
+		 */
+
+		BlasMatrix<Element> A_ptr(A) ;
+
+		BMD.mul(A_ptr,L,U);
+
+		/*!
+		 * @todo create BMD.applyP(A,P,BlasTag::Left) ;
+		 * avec P : BlasPermutation
+		 * ou P : MatrixPermutation
+		 * @todo BlasPermutation a un ordre \p p et une taille \p r distinctes !!!
+		 */
+
+		BMD.mulin_left(A_ptr,Q);
+		BMD.mulin_right(P,A_ptr);
+
+		return A ;
+
+	}
+
+#if 0 /*  bad LU mod p + CRA idea */
+	template<class Field>
+	struct LU_mod_p {
+		typedef typename Field::Element Element;
+		long int r_  ;
+		size_t   m_ ;
+		size_t   n_ ;
+		LU_mod_p (size_t rows, size_t cols, long int rank) :
+			r_(rank),m_(rows),n_(cols)
+		{} ;
+
+		BlasMatrix<Element>& operator()(BlasMatrix<Element>& A, const Field& F) const
+		{
+			BlasMatrix<Element> AA(m_,n_);
+			A = AA ; // grrrrrr....
+			// std::cout << m_ << ',' << A.rowdim();
+
+			// linbox_check( m_ == A.rowdim() );
+			// linbox_check( n_ == A.coldim() ) ;
+
+			linbox_check(!(r_<0 || r_>(long int)std::min(m_,n_)));
+
+
+			BlasMatrix<Element> L(m_,m_);
+			BlasMatrix<Element> U(m_,n_);
+
+			// be ready for random elements
+			typedef typename Field::RandIter Randiter  ;
+			Randiter R(F) ;
+			NonzeroRandIter<Field> Rnz(F,R);
+			Element one,zero;
+			F.init(one,1UL);
+			F.init(zero,0UL);
+
+			/* Create L a random invertible lower unit triangular matrix (m x m format) */
+			for (size_t j=0 ; j<m_ ; ++j)
+				for (size_t i=j+1; i<m_;++i)
+					R.random( L.refEntry( i,j ) );
+#if 1
+			for (size_t i = 0; i < (size_t) m_; ++i)
+				Rnz.random( L.refEntry( i,i ) ); // non zero diagonal
+			for (size_t j=0 ; j<m_ ; ++j)
+				for (size_t i=0; i<j;++i)
+					L.setEntry( i,j,zero );
+
+
+#endif
+
+			/* Create U a random rank-r upper non-unit triangular matrix (m x n format) */
+			for (size_t i = 0 ; i < (size_t) r_; ++i)
+				for (size_t j = i+1; j < n_; ++j)
+					R.random( U.refEntry( i,j ) ); // r random 'triangular' lines
+			for (size_t i = 0; i < (size_t) r_; ++i)
+				Rnz.random( U.refEntry( i,i ) ); // non zero diagonal on rank first lines
+#if 1
+			for (size_t i = r_ ; i < m_ ; ++i)
+				for (size_t j = i ; j < n_ ; ++j)
+					U.setEntry( i,j,zero ) ; //  zero on remaining 'triangular' lines
+#endif
+
+			BlasMatrixDomain< Field > BMD(F) ;
+			// LU
+			/**
+			 * @todo : L = [[L1,0],[A,L2]] ;U = [[U1,B],[0,U2]] ; LU = [[ rec(L1,U1), ftrmm(L1,B)],[ftrmm(A,U1),fgemm(A,B)+rec(L2,U2) ]]
+			 * de même UL
+			 */
+
+			// BlasMatrix<Element> A_ptr(A) ;
+
+			// std::cout << "A" << F.characteristic() << " := " ;
+			// A.write(std::cout,true) << ';' << std::endl;
+
+			// std::cout << "L" << F.characteristic() << " := " ;
+			// L.write(std::cout,true) << ';' << std::endl;
+
+			// std::cout << "U" << F.characteristic() << " := " ;
+			// U.write(std::cout,true) << ';' << std::endl;
+			// exit(-1);
+			BMD.mul(A,L,U);
+
+
+			return A ;
+
+		}
+
+		BlasMatrix<Element> initialize()
+		{
+			return BlasMatrix<Element>(m_,n_);
+		}
+
+	};
+
+	template<class Field> struct CRATemporaryVectorTrait< LU_mod_p<Field>, typename Field::Element>
+	{
+		//typedef BlasMatrix<double>::pointer Type_t;
+		typedef BlasMatrix<typename Field::Element> Type_t;
+		// typedef FixedBlasMatrixDouble Type_t;
+	};
+
+
+#define _LB_LOG2 0.6931471807
+	template<class Randiter>
+	BlasMatrix<integer> &
+	random_lu_rank(const PID_integer & F,
+					     const Randiter & R,
+					     BlasMatrix<integer> &A,
+					     int & rank)
+	{
+
+		typedef Modular<double> Field ;
+		typedef Field::Element Element ;
+		/*- CRA -*/
+		size_t PrimeSize  = 10;
+		double UpperBound = _LB_LOG2 * R.getBits() ;
+		RandomPrimeIterator genprime( PrimeSize );
+		// ChineseRemainder< FullMultipFixedCRA< Field > > cra( std::pair<size_t,double>(A.rowdim()*A.coldim(), UpperBound) );
+		ChineseRemainder< FullMultipBlasMatCRA< Field > > cra( std::pair<size_t,double>(A.rowdim()*A.coldim(), UpperBound) );
+
+		LU_mod_p<Field> Iteration(A.rowdim(),A.coldim(),rank);
+
+		// typename BlasMatrix<integer>::RawIterator A_it = A.rawBegin() ;
+
+		cra(A, Iteration, genprime);
+
+		/*- P A Q -*/
+		BlasPermutation<size_t>  P(A.rowdim());
+		BlasPermutation<size_t>  Q(A.coldim());
+
+		RandomBlasPermutation(P);
+		RandomBlasPermutation(Q);
+
+		PID_integer ZZ ;
+		BlasMatrixDomain< PID_integer > BMD(ZZ) ;
+
+		// BMD.mulin_left (A,Q);
+		// BMD.mulin_right(P,A);
+		// throw(NotImplementedYet(__func__,__FILE__,__LINE__));
+		return A ;
+	}
+#undef _LB_LOG2
+#endif
+
+	template<class Randiter>
+	BlasMatrix<integer> &
+	random_lu_rank(const PID_integer   & ZZ,
+		       const Randiter      & R,
+		       BlasMatrix<integer> &A,
+		       int                 & rank)
+	{
+
+		size_t m = A.rowdim() ;
+		size_t n = A.coldim() ;
+
+		linbox_check(m != 0);
+		linbox_check(n != 0);
+		if (rank == -1) rank = std::min(m,n)*drand48() ;
+		linbox_check(!(rank<0 || rank>(int)std::min(m,n)));
+
+
+		// be ready for PLUQ
+		BlasPermutation<size_t> P(m);
+		BlasMatrix<integer> L(m,m);
+		BlasMatrix<integer> U(m,n);
+		BlasPermutation<size_t> Q(n);
+
+		// be ready for random elements
+		Randiter S_(R);
+		S_.setBits(R.getBits()-1);
+		RandomIntegerIter<false> T_(3);
+		NonzeroRandIter<PID_integer,RandomIntegerIter<false> > U_(ZZ,T_);
+
+		integer one(1),zero(0);
+
+		/* Create L a random invertible lower unit triangular matrix (m x m format) */
+		for (size_t j=0 ; j<m ; ++j)
+			for (size_t i=j+1; i<m;++i)
+				S_.random( L.refEntry( i,j ) );
+#if 1
+		for (size_t i = 0; i < (size_t) m; ++i)
+			U_.random( L.refEntry( i,i ) ); // non zero diagonal
+		for (size_t j=0 ; j<m ; ++j)
+			for (size_t i=0; i<j;++i)
+				L.setEntry( i,j,zero );
+
+
+#endif
+
+		/* Create U a random rank-r upper non-unit triangular matrix (m x n format) */
+		for (size_t i = 0 ; i < (size_t) rank; ++i)
+			for (size_t j = i+1; j < n; ++j)
+				T_.random( U.refEntry( i,j ) ); // r random 'triangular' lines
+		for (size_t i = 0; i < (size_t) rank; ++i)
+			U_.random( U.refEntry( i,i ) ); // non zero diagonal on rank first lines
+#if 1
+		for (size_t i = rank ; i < m ; ++i)
+			for (size_t j = i ; j < n ; ++j)
+				U.setEntry( i,j,zero ) ; //  zero on remaining 'triangular' lines
+#endif
+
+		RandomBlasPermutation(P);
+		RandomBlasPermutation(Q);
+
+		BlasMatrixDomain< PID_integer > BMD(ZZ) ;
+		MatrixDomain< PID_integer > MD(ZZ) ;
+		// LU
+		// L.write(std::cout << "L:=",true ) << ';' << std::endl;
+		// L.write(std::cout << "U:=",true ) << ';' << std::endl;
+
+		MD.mul(A,L,U);
+		// A.write(std::cout << "pre A=",true) << std::endl;
+
+		BMD.mulin_left(A,Q);
+		BMD.mulin_right(P,A);
+
+		// P.write(std::cout<<"P:=",false) << std::endl;
+		// P.write(std::cout<<"Q:=",false) << std::endl;
+		// P.write(std::cout<<"Q:=",true) << std::endl;
+
+		return A ;
+	}
+
+#if 0 /*  DenseMatrixBase spec. */
+	template<class Randiter, class Field>
+	DenseMatrix<Field> &
+	random_rankupdate( const Field        & F
+			   ,const Randiter    & R
+			   ,DenseMatrix<Field>& A
+			   , int              & rank
+			 )
+	{
+		size_t m = A.rowdim();
+		size_t n = A.coldim();
+
+
+		DenseMatrix<Field> D(F,m,rank) ;
+		DenseMatrix<Field> G(F,rank,n) ;
+		RandomDenseMatrix<Randiter, Field> RandMatGen(F,R);
+		RandMatGen.random(D) ;
+		RandMatGen.random(G) ;
+		MatrixDomain<Field> MD(F);
+		MD.mul(A,D,G);
+		return A ;
+	}
+
+	template<class Randiter>
+	DenseMatrix<PID_integer> &
+	random_rankupdate( PID_integer               & F //!@bug const !
+			   ,const Randiter           & R
+			   ,DenseMatrix<PID_integer> & A
+			   , int                     & rank
+			 )
+	{
+		//! @todo check randomness
+		size_t m = A.rowdim();
+		size_t n = A.coldim();
+
+		DenseMatrix<PID_integer> D(F,(size_t)m,(size_t)rank) ;
+		DenseMatrix<PID_integer> G(F,(size_t)rank,(size_t)n) ;
+		Randiter S_(R);
+		S_.setBits(R.getBits()-1);
+		RandomDenseMatrix<Randiter,PID_integer > RandMatGen(F,S_);
+		RandMatGen.random(D) ;
+		RandomIntegerIter<false> T_(3);
+		RandomDenseMatrix<RandomIntegerIter<false>,PID_integer > RandSmallMatGen(F,T_);
+		RandMatGen.random(G) ;
+		MatrixDomain<PID_integer> MD(F);
+		MD.mul(A,D,G);
+		return A ;
+	}
+#endif
+
+	template<class Randiter>
+	BlasMatrix<integer> &
+	random_rankupdate( PID_integer          & F //!@bug const !
+			   ,const Randiter      & R
+			   ,BlasMatrix<integer> & A
+			   , int                & rank
+			 )
+	{
+		size_t m = A.rowdim();
+		size_t n = A.coldim();
+
+		BlasMatrix<integer> D((size_t)m,(size_t)rank) ;
+		BlasMatrix<integer> G((size_t)rank,(size_t)n) ;
+		Randiter S_(R);
+		S_.setBits(R.getBits()-1);
+		RandomDenseMatrix<Randiter,PID_integer > RandMatGen(F,S_);
+		RandMatGen.random(D) ;
+		RandomIntegerIter<false> T_(3);
+		RandomDenseMatrix<RandomIntegerIter<false>,PID_integer > RandSmallMatGen(F,T_);
+		RandMatGen.random(G) ;
+
+		MatrixDomain<PID_integer> MD(F);
+		MD.mul(A,D,G);
+
+#if 0 /*  necessary */
+		BlasPermutation<size_t>  P(m);
+		BlasPermutation<size_t>  Q(n);
+
+		RandomBlasPermutation(P);
+		RandomBlasPermutation(Q);
+
+		PID_integer ZZ ;
+		BlasMatrixDomain< PID_integer > BMD(ZZ) ;
+
+		BMD.mulin_left (A,Q);
+		BMD.mulin_right(P,A);
+#endif
+
+		return A ;
+	}
+
+}
+
+
+/* -*- 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/linbox/matrix/sparse.h b/linbox/matrix/sparse.h
index 5f6da57..4c1ba70 100644
--- a/linbox/matrix/sparse.h
+++ b/linbox/matrix/sparse.h
@@ -1,12 +1,12 @@
-/* -*- mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-
+/* -*- 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
 /* linbox/matrix/sparse.h
  * Copyright (C) 2001-2002 Bradford Hovinen
  *               1999-2001 William J Turner,
  *
  * Written by William J Turner <wjturner at math.ncsu.edu>,
  *            Bradford Hovinen <hovinen at cis.udel.edu>
- * 
+ *
  * --------------------------------------------------------
  * 2003-01-11  Bradford Hovinen  <bghovinen at math.uwaterloo.ca>
  *
@@ -40,10 +40,14 @@
  * See COPYING for license information.
  */
 
-#ifndef __MATRIX_SPARSE_H
-#define __MATRIX_SPARSE_H
+#ifndef __LINBOX_matrix_sparse_H
+#define __LINBOX_matrix_sparse_H
 
+#ifndef _SP_BB_VECTOR_
 #include <vector>
+#define _SP_BB_VECTOR_ std::vector
+#endif
+
 #include <utility>
 #include <iostream>
 #include <algorithm>
@@ -57,1300 +61,1397 @@
 
 namespace LinBox
 {
-	
-
-/** Exception class for invalid matrix input
- */
-
-class InvalidMatrixInput {};
-
-// use this in place of NoField member, to avoid code duplication.
-// better yet.  Don't do it at all.
-/// Dummy field for conceptually unclear io.
-template<class _Element>
-class FieldIO 
-{ public:
-	typedef _Element Element;
-
-	std::istream &read (std::istream &stream, Element &elt) const
-		{ return stream >> elt; }
-	std::ostream &write (std::ostream &stream, const Element &elt) const
-		{ return stream << elt; }
-};
-
-// made global to avoid duplicate code. 
-/// tags for SparseMatrixBase::read() and write()
-enum FileFormatTag {
-	FORMAT_DETECT, FORMAT_GUILLAUME, FORMAT_TURNER, FORMAT_MATLAB, FORMAT_MAPLE, FORMAT_PRETTY, FORMAT_MAGMACPT, FORMAT_ONE_BASED
-};
 
-// Forward declaration
-template <class _Element,
-	  class _Row   = typename RawVector<_Element>::Sparse,
-	  class Trait  = typename VectorTraits<_Row>::VectorCategory>
-class SparseMatrixBase;
 
+	/** Exception class for invalid matrix input
+	*/
 
-// Small helper classes to make read and write easier
-template <class _Element, class Row, class Trait = typename VectorTraits<Row>::VectorCategory>
-class SparseMatrixWriteHelper
-{
-    public:
-	typedef _Element Element;
+	class InvalidMatrixInput {};
 
-	// Dummy class to avoid code duplication
-	class NoField 
-	{
-	    public:
+	// use this in place of NoField member, to avoid code duplication.
+	// better yet.  Don't do it at all.
+	/// Dummy field for conceptually unclear io.
+	template<class _Element>
+	class FieldIO {
+	public:
 		typedef _Element Element;
 
 		std::istream &read (std::istream &stream, Element &elt) const
-			{ return stream >> elt; }
+		{ return stream >> elt; }
 		std::ostream &write (std::ostream &stream, const Element &elt) const
-			{ return stream << elt; }
+		{ return stream << elt; }
 	};
 
-	template <class Field>
-	static std::ostream &write (const SparseMatrixBase<Element, Row> &A, std::ostream &os, const Field &F, FileFormatTag format);
-};
-
-template <class Element, class Row, class Trait = typename VectorTraits<Row>::VectorCategory>
-class SparseMatrixReadWriteHelper : public SparseMatrixWriteHelper<Element, Row, Trait>
-{
-	template <class Field>
-	static std::istream &readTurner    (SparseMatrixBase<Element, Row> &A, std::istream &is, const Field &F, char *buf);
-	template <class Field>
-	static std::istream &readGuillaume (SparseMatrixBase<Element, Row> &A, std::istream &is, const Field &F, char *buf);
-	template <class Field>
-	static std::istream &readMatlab    (SparseMatrixBase<Element, Row> &A, std::istream &is, const Field &F, char *buf);
-	template <class Field>
-	static std::istream &readPretty    (SparseMatrixBase<Element, Row> &A, std::istream &is, const Field &F, char *buf);
-	template <class Field>
-	static std::istream &readMagmaCpt  (SparseMatrixBase<Element, Row> &A, std::istream &is, const Field &F, char *buf);
-
-    public:
-
-	template <class Field>
-	static std::istream &read (SparseMatrixBase<Element, Row> &A, std::istream &is, const Field &F, FileFormatTag format);
-};
-
-// Specialization of the above for sparse parallel vectors
-template <class _Element, class Row>
-class SparseMatrixWriteHelper<_Element, Row, VectorCategories::SparseParallelVectorTag >
-{
-    public:
-	typedef _Element Element;
-
-	// Dummy class to avoid code duplication
-	class NoField 
-	{
-	    public:
-		typedef _Element Element;
-
-		std::istream &read (std::istream &stream, Element &elt) const
-			{ return stream >> elt; }
-		std::ostream &write (std::ostream &stream, const Element &elt) const
-			{ return stream << elt; }
+	// made global to avoid duplicate code.
+	/// tags for SparseMatrixBase::read() and write()
+	enum FileFormatTag {
+		FORMAT_DETECT, FORMAT_GUILLAUME, FORMAT_TURNER, FORMAT_MATLAB, FORMAT_MAPLE, FORMAT_PRETTY, FORMAT_MAGMACPT, FORMAT_ONE_BASED
 	};
 
-	template <class Field>
-	static std::ostream &write (const SparseMatrixBase<Element, Row> &A, std::ostream &os, const Field &F, FileFormatTag format);
-};
+	// Forward declaration
+	template <class _Element,
+	class _Row   = typename RawVector<_Element>::Sparse,
+	class Trait  = typename VectorTraits<_Row>::VectorCategory>
+	class SparseMatrixBase;
 
-/** Sparse matrix container
- * This class acts as a generic row-wise container for sparse
- * matrices. It is designed to provide various methods to access the
- * entries of the matrix. In particular, it does not meet the black box
- * archetype; see \ref{SparseMatrix} for an appropriate sparse matrix
- * black box.
- *
- * @param Element Element type
- * @param Row     LinBox sparse vector type to use for rows of matrix
-\ingroup matrix
- */
-template <class _Element, class _Row, class Trait>
-class SparseMatrixBase
-{
-    public:
-
-	typedef _Element Element;
-	typedef _Row Row;
-	typedef const Row ConstRow;
-	typedef typename std::vector<Row> Rep;
-
-	template<typename _Tp1, typename _R1 = typename Rebind<_Row,_Tp1>::other >
-        struct rebind
-        { typedef SparseMatrixBase<typename _Tp1::Element, _R1, Trait> other; };
-
-	/** Constructor.
-	 * Note: the copy constructor and operator= will work as intended
-	 *       because of STL's container design
-	 * @param  m  row dimension
-	 * @param  n  column dimension
-	 */
-        SparseMatrixBase (size_t m, size_t n): _A(m), _m(m), _n(n) {};
 
+	// Small helper classes to make read and write easier
+	template <class _Element, class Row, class Trait = typename VectorTraits<Row>::VectorCategory>
+	class SparseMatrixWriteHelper {
+	public:
+		typedef _Element Element;
 
-	/** Constructor from a MatrixStream
-	 */
-	template <class Field>
-	SparseMatrixBase ( MatrixStream<Field>& ms );
-    
-
-	/** Copy constructor.
-	 */
-	SparseMatrixBase (const SparseMatrixBase<Element, Row, Trait> &A);
+		// Dummy class to avoid code duplication
+		class NoField {
+		public:
+			typedef _Element Element;
 
-	/** Convert constructor.
-	 */
-    	template<class VectorType>
-	SparseMatrixBase (const SparseMatrixBase<Element, VectorType, Trait> &A);
-	/** Destructor. */
-	~SparseMatrixBase () {}
+			std::istream &read (std::istream &stream, Element &elt) const
+			{ return stream >> elt; }
+			std::ostream &write (std::ostream &stream, const Element &elt) const
+			{ return stream << elt; }
+		};
 
-	/** Retreive row dimension of the matrix.
-	 * @return integer number of rows of SparseMatrixBase matrix.
-	 */
-	size_t rowdim () const { return _m; }
+		template <class Field>
+		static std::ostream &write (const SparseMatrixBase<Element, Row> &A, std::ostream &os, const Field &F, FileFormatTag format);
+	};
 
-	/** Retreive column dimension of matrix.
-	 * @return integer number of columns of SparseMatrixBase matrix.
-	 */
-	size_t coldim () const { return _n; }
+	template <class Element, class Row, class Trait = typename VectorTraits<Row>::VectorCategory>
+	class SparseMatrixReadWriteHelper : public SparseMatrixWriteHelper<Element, Row, Trait> {
+		template <class Field>
+		static std::istream &readTurner    (SparseMatrixBase<Element, Row> &A, std::istream &is, const Field &F, char *buf);
+		template <class Field>
+		static std::istream &readGuillaume (SparseMatrixBase<Element, Row> &A, std::istream &is, const Field &F, char *buf);
+		template <class Field>
+		static std::istream &readMatlab    (SparseMatrixBase<Element, Row> &A, std::istream &is, const Field &F, char *buf);
+		template <class Field>
+		static std::istream &readPretty    (SparseMatrixBase<Element, Row> &A, std::istream &is, const Field &F, char *buf);
+		template <class Field>
+		static std::istream &readMagmaCpt  (SparseMatrixBase<Element, Row> &A, std::istream &is, const Field &F, char *buf);
+
+	public:
+
+		template <class Field>
+		static std::istream &read (SparseMatrixBase<Element, Row> &A, std::istream &is, const Field &F, FileFormatTag format);
+	};
 
-	/** Retreive number of elements in the matrix.
-	 * @return integer number of elements of SparseMatrixBase matrix.
-	 */
-	size_t size () const { 
-            size_t s(0);
-            for(typename Rep::const_iterator it = _A.begin(); it != _A.end(); ++it)
-                s+= LinBox::RawVector<_Element>::size(*it);
-            return s;
-        }
-	/** Read a matrix from the given input stream using field read/write
-	 * @param is Input stream from which to read the matrix
-	 * @param F Field with which to read
-	 * @param format Format of input matrix
-	 */
-	template <class Field>
-	std::istream &read (std::istream &is, const Field &F, FileFormatTag format = FORMAT_DETECT);
-	/** Read a matrix from the given input stream using standard operators
-	 * @param is Input stream from which to read the matrix
-	 * @param format Format of input matrix
-	 */
-        std::istream &read (std::istream &is, FileFormatTag format = FORMAT_DETECT);
-    
+	// Specialization of the above for sparse parallel vectors
+	template <class _Element, class Row>
+	class SparseMatrixWriteHelper<_Element, Row, VectorCategories::SparseParallelVectorTag > {
+	public:
+		typedef _Element Element;
 
-	/** Write a matrix to the given output stream using field read/write
-	 * @param os Output stream to which to write the matrix
-	 * @param F Field with which to write
-	 * @param format Format with which to write
-	 */
-	template <class Field>
-	std::ostream &write (std::ostream &os, const Field &F, FileFormatTag format = FORMAT_PRETTY) const;
+		// Dummy class to avoid code duplication
+		class NoField {
+		public:
+			typedef _Element Element;
 
-	/** Write a matrix to the given output stream using standard operators
-	 * @param os Output stream to which to write the matrix
-	 * @param format Format with which to write
-	 */
-	std::ostream &write (std::ostream &os, FileFormatTag format = FORMAT_PRETTY) const;
+			std::istream &read (std::istream &stream, Element &elt) const
+			{ return stream >> elt; }
+			std::ostream &write (std::ostream &stream, const Element &elt) const
+			{ return stream << elt; }
+		};
 
-	/** Set an individual entry
-	 * Setting the entry to 0 will remove it from the matrix
-	 * @param i Row index of entry
-	 * @param j Column index of entry
-	 * @value Value of the new entry
-	 */
-	void setEntry (size_t i, size_t j, const Element &value);
-
-	/** Get a writeable reference to an entry in the matrix
-	 * If there is no entry at the position (i, j), then a new entry
-	 * with a value of zero is inserted and a reference  to it is
-	 * returned.
-	 * @param i Row index of entry
-	 * @param j Column index of entry
-	 * @return Reference to matrix entry
-	 */
-	Element &refEntry (size_t i, size_t j);
+		template <class Field>
+		static std::ostream &write (const SparseMatrixBase<Element, Row> &A, std::ostream &os, const Field &F, FileFormatTag format);
+	};
 
-	/** Get a read-only individual entry from the matrix
-	 * @param i Row index
-	 * @param j Column index
-	 * @return Const reference to matrix entry
+	/** Sparse matrix container
+	 * This class acts as a generic row-wise container for sparse
+	 * matrices. It is designed to provide various methods to access the
+	 * entries of the matrix. In particular, it does not meet the black box
+	 * archetype; see \ref SparseMatrix for an appropriate sparse matrix
+	 * black box.
+	 *
+	 * @param Element Element type
+	 * @param Row     LinBox sparse vector type to use for rows of matrix
+	 \ingroup matrix
 	 */
-	const Element &getEntry (size_t i, size_t j) const;
-
-	/** Get an entry and store it in the given value
-	 * This form is more in the Linbox style and is provided for interface
-	 * compatibility with other parts of the library
-	 * @param x Element in which to store result
-	 * @param i Row index
-	 * @param j Column index
-	 * @return Reference to x
-	 */
-	Element &getEntry (Element &x, size_t i, size_t j) const;
+	template <class _Element, class _Row, class Trait>
+	class SparseMatrixBase {
+	public:
 
-	/** @name Columns of rows iterator
-	 * The columns of row iterator gives each of the rows of the
-	 * matrix in ascending order. Dereferencing the iterator yields
-	 * a row vector in sparse sequence format
-	 */
+		typedef _Element Element;
+		typedef _Row Row;
+		typedef const Row ConstRow;
+		typedef typename _SP_BB_VECTOR_<Row> Rep;
+
+		template<typename _Tp1, typename _R1 = typename Rebind<_Row,_Tp1>::other >
+		struct rebind {
+			typedef SparseMatrixBase<typename _Tp1::Element, _R1, Trait> other;
+		};
+
+		/** Constructor.
+		 * Note: the copy constructor and operator= will work as intended
+		 *       because of STL's container design
+		 * @param  m  row dimension
+		 * @param  n  column dimension
+		 */
+		SparseMatrixBase (size_t m, size_t n) :
+			_A(m), _m(m), _n(n)
+		{};
+
+
+		/** Constructor from a MatrixStream
+		*/
+		template <class Field>
+		SparseMatrixBase ( MatrixStream<Field>& ms );
+
+
+		/** Copy constructor.
+		*/
+		SparseMatrixBase (const SparseMatrixBase<Element, Row, Trait> &A);
+
+		/** Convert constructor.
+		*/
+		template<class VectorType>
+		SparseMatrixBase (const SparseMatrixBase<Element, VectorType, Trait> &A);
+		/** Destructor. */
+		~SparseMatrixBase () {}
+
+		/** Retreive row dimension of the matrix.
+		 * @return integer number of rows of SparseMatrixBase matrix.
+		 */
+		size_t rowdim () const { return _m; }
+
+		/** Retreive column dimension of matrix.
+		 * @return integer number of columns of SparseMatrixBase matrix.
+		 */
+		size_t coldim () const { return _n; }
+
+		/** Retreive number of elements in the matrix.
+		 * @return integer number of elements of SparseMatrixBase matrix.
+		 */
+		size_t size () const {
+			size_t s(0);
+			for(typename Rep::const_iterator it = _A.begin(); it != _A.end(); ++it)
+				s+= LinBox::RawVector<_Element>::size(*it);
+			return s;
+		}
+		/** Read a matrix from the given input stream using field read/write
+		 * @param is Input stream from which to read the matrix
+		 * @param F Field with which to read
+		 * @param format Format of input matrix
+		 */
+		template <class Field>
+		std::istream &read (std::istream &is, const Field &F, FileFormatTag format = FORMAT_DETECT);
+		/** Read a matrix from the given input stream using standard operators
+		 * @param is Input stream from which to read the matrix
+		 * @param format Format of input matrix
+		 */
+		std::istream &read (std::istream &is, FileFormatTag format = FORMAT_DETECT);
+
+
+		/** Write a matrix to the given output stream using field read/write
+		 * @param os Output stream to which to write the matrix
+		 * @param F Field with which to write
+		 * @param format Format with which to write
+		 */
+		template <class Field>
+		std::ostream &write (std::ostream &os, const Field &F, FileFormatTag format = FORMAT_PRETTY) const;
+
+		/** Write a matrix to the given output stream using standard operators
+		 * @param os Output stream to which to write the matrix
+		 * @param format Format with which to write
+		 */
+		std::ostream &write (std::ostream &os, FileFormatTag format = FORMAT_PRETTY) const;
+
+		/** Set an individual entry
+		 * Setting the entry to 0 will remove it from the matrix
+		 * @param i Row index of entry
+		 * @param j Column index of entry
+		 * @param value Value of the new entry
+		 */
+		void setEntry (size_t i, size_t j, const Element &value);
+
+		/** Get a writeable reference to an entry in the matrix
+		 * If there is no entry at the position (i, j), then a new entry
+		 * with a value of zero is inserted and a reference  to it is
+		 * returned.
+		 * @param i Row index of entry
+		 * @param j Column index of entry
+		 * @return Reference to matrix entry
+		 */
+		Element &refEntry (size_t i, size_t j);
+
+		/** Get a read-only individual entry from the matrix
+		 * @param i Row index
+		 * @param j Column index
+		 * @return Const reference to matrix entry
+		 */
+		const Element &getEntry (size_t i, size_t j) const;
+
+		/** Get an entry and store it in the given value
+		 * This form is more in the Linbox style and is provided for interface
+		 * compatibility with other parts of the library
+		 * @param x Element in which to store result
+		 * @param i Row index
+		 * @param j Column index
+		 * @return Reference to x
+		 */
+		Element &getEntry (Element &x, size_t i, size_t j) const;
+
+		/** @name Columns of rows iterator
+		 * The columns of row iterator gives each of the rows of the
+		 * matrix in ascending order. Dereferencing the iterator yields
+		 * a row vector in sparse sequence format
+		 */
+
+		typedef typename Rep::iterator RowIterator;
+		typedef typename Rep::const_iterator ConstRowIterator;
+
+		RowIterator rowBegin ();
+		RowIterator rowEnd ();
+		ConstRowIterator rowBegin () const;
+		ConstRowIterator rowEnd () const;
+
+		/** @name Raw iterator
+		 * The raw iterator is a method for accessing all nonzero
+		 * entries in the matrix in some unspecified order. This can be
+		 * used, e.g. to reduce all matrix entries modulo a prime before
+		 * passing the matrix into an algorithm.
+		 */
+
+		class RawIterator;
+		class ConstRawIterator;
+
+		/// rawBegin.
+		RawIterator rawBegin ();
+		/// rawEnd.
+		RawIterator rawEnd ();
+		/// const rawBegin.
+		ConstRawIterator rawBegin () const;
+		/// const rawEnd
+		ConstRawIterator rawEnd () const;
+
+		/** @name Index iterator
+		 * The index iterator gives the row, column indices of all matrix
+		 * elements in the same order as the raw iterator above. Its value type
+		 * is an STL pair with the row and column indices, starting at 0, in the
+		 * first and second positions, respectively.
+		 */
+
+		class RawIndexedIterator;
+		class ConstRawIndexedIterator;
+
+		/// rawIndexedBegin
+		RawIndexedIterator rawIndexedBegin ();
+		/// rawIndexedEnd
+		RawIndexedIterator rawIndexedEnd ();
+		/// const rawIndexedBegin
+		ConstRawIndexedIterator rawIndexedBegin () const;
+		/// const rawIndexedEnd
+		ConstRawIndexedIterator rawIndexedEnd () const;
+
+		/** Retrieve a row as a writeable reference
+		 * @param i Row index
+		 */
+		Row &getRow (size_t i);
+
+		/** Retrieve a row as a writeable reference.
+		 * @param i Row index
+		 */
+		Row &operator [] (size_t i);
+
+		/** Retrieve a row as a read-only reference.
+		 * @param i Row index
+		 */
+		ConstRow &operator [] (size_t i) const;
+
+		/** Compute the column density, i.e the number of entries per column.
+		 * @param v Vector in which to store column density
+		 */
+		template <class Vector>
+		Vector &columnDensity (Vector &v) const;
+
+		/** Construct the transpose of this matrix and place it in the
+		 * matrix given.
+		 * @param AT
+		 */
+		SparseMatrixBase &transpose (SparseMatrixBase &AT) const;
+
+	protected:
+
+		friend class SparseMatrixWriteHelper<Element, Row>;
+		friend class SparseMatrixReadWriteHelper<Element, Row>;
+
+		Rep               _A;
+		size_t            _m;
+		size_t            _n;
+
+		template<class F, class R, class T> friend class SparseMatrixBase;
+		};
+
+	/* Specialization for sparse sequence vectors */
+
+	template <class _Element, class _Row>
+	class SparseMatrixBase<_Element, _Row, VectorCategories::SparseSequenceVectorTag > {
+	public:
 
-	typedef typename Rep::iterator RowIterator;
-	typedef typename Rep::const_iterator ConstRowIterator;
+		typedef _Element Element;
+		typedef _Row Row;
+		typedef const Row ConstRow;
+		typedef _SP_BB_VECTOR_<Row> Rep;
 
-	RowIterator rowBegin ();
-	RowIterator rowEnd ();
-	ConstRowIterator rowBegin () const;
-	ConstRowIterator rowEnd () const;
+		template<typename _Tp1, typename _R1 = typename Rebind<_Row,_Tp1>::other >
+		struct rebind
+		{ typedef SparseMatrixBase<typename _Tp1::Element, _R1, VectorCategories::SparseSequenceVectorTag> other; };
 
-	/** @name Raw iterator
-	 * The raw iterator is a method for accessing all nonzero
-	 * entries in the matrix in some unspecified order. This can be
-	 * used, e.g. to reduce all matrix entries modulo a prime before
-	 * passing the matrix into an algorithm.
-	 */
+		SparseMatrixBase (size_t m, size_t n) :
+			_A (m), _m (m), _n (n)
+		{}
 
-	class RawIterator;
-	class ConstRawIterator;
+		/** Constructor from a MatrixStream
+		*/
+		template <class Field>
+		SparseMatrixBase ( MatrixStream<Field>& ms );
 
-	RawIterator rawBegin ();
-	RawIterator rawEnd ();
-	ConstRawIterator rawBegin () const;
-	ConstRawIterator rawEnd () const;
+		SparseMatrixBase (const SparseMatrixBase<Element, Row> &A) :
+			_A (A._A), _m (A._m), _n (A._n)
+		{}
 
-	/** @name Index iterator
-	 * The index iterator gives the row, column indices of all matrix
-	 * elements in the same order as the raw iterator above. Its value type
-	 * is an STL pair with the row and column indices, starting at 0, in the
-	 * first and second positions, respectively.
-	 */
+		template<class VectorType>
+		SparseMatrixBase (const SparseMatrixBase<Element, VectorType> &A) :
+			_A(A._m), _m (A._m), _n (A._n)
+		{
+			typename Rep::iterator meit = this->_A.begin();
+			typename SparseMatrixBase<Element, VectorType>::Rep::const_iterator copit = A._A.begin();
+			for( ; meit != this->_A.end(); ++meit, ++copit)
+				LinBox::RawVector<Element>::convert(*meit, *copit);
+		}
 
-	class RawIndexedIterator;
-	class ConstRawIndexedIterator;
+		~SparseMatrixBase () {}
 
-	RawIndexedIterator rawIndexedBegin ();
-	RawIndexedIterator rawIndexedEnd ();
-	ConstRawIndexedIterator rawIndexedBegin () const;
-	ConstRawIndexedIterator rawIndexedEnd () const;
+		size_t rowdim () const { return _m; }
+		size_t coldim () const { return _n; }
 
-	/** Retrieve a row as a writeable reference
-	 * @param i Row index
-	 */
-	Row &getRow (size_t i);
+		size_t size () const
+		{
+			size_t s(0);
+			for(typename Rep::const_iterator it = _A.begin(); it != _A.end(); ++it)
+				s+= LinBox::RawVector<_Element>::size(*it);
+			return s;
+		}
 
-	/** Retrieve a row as a writeable reference
-	 * @param i Row index
-	 */
-	Row &operator [] (size_t i);
+		template <class Field>
+		std::istream &read (std::istream &is, const Field &F, FileFormatTag format = FORMAT_DETECT)
+		{
+			return SparseMatrixReadWriteHelper<Element, Row>::read
+			(*this, is, F, format);
+		}
 
-	/** Retrieve a row as a read-only reference
-	 * @param i Row index
-	 */
-	ConstRow &operator [] (size_t i) const;
+		std::istream &read (std::istream &is, FileFormatTag format = FORMAT_DETECT)
+		{
+			return SparseMatrixReadWriteHelper<Element, Row>::read
+			(*this, is, SparseMatrixReadWriteHelper<Element, Row>::NoField (),
+			 format);
+		}
 
-	/** Compute the column density, i.e. the number of entries per column
-	 * @param v Vector in which to store column density 
-	 */
-	template <class Vector>
-	Vector &columnDensity (Vector &v) const;
+		template <class Field>
+		std::ostream &write (std::ostream &os, const Field &F, FileFormatTag format = FORMAT_PRETTY) const
+		{
+			return SparseMatrixReadWriteHelper<Element, Row>::write
+			(*this, os, F, format);
+		}
 
-	/** Construct the transpose of this matrix and place it in the
-	 * matrix given
-	 */
-	SparseMatrixBase &transpose (SparseMatrixBase &AT) const;
+		std::ostream &write (std::ostream &os, FileFormatTag format = FORMAT_PRETTY) const
+		{
+			return SparseMatrixReadWriteHelper<Element, Row>::write
+			(*this, os, SparseMatrixReadWriteHelper<Element, Row>::NoField (),
+			 format);
+		}
 
-    protected:
-	
-	friend class SparseMatrixWriteHelper<Element, Row>;
-	friend class SparseMatrixReadWriteHelper<Element, Row>;
+		std::ostream &write(std::ostream &) const;
 
-	Rep               _A;
-	size_t            _m;
-	size_t            _n;
+		void           setEntry (size_t i, size_t j, const Element &value);
 
-    	template<class F, class R, class T> friend class SparseMatrixBase;
-};
+		Element       &refEntry (size_t i, size_t j);
 
-/* Specialization for sparse sequence vectors */
+		const Element &getEntry (size_t i, size_t j) const;
 
-template <class _Element, class _Row>
-class SparseMatrixBase<_Element, _Row, VectorCategories::SparseSequenceVectorTag >
-{
-    public:
+		Element       &getEntry (Element &x, size_t i, size_t j) const
+		{
+			return x = getEntry (i, j);
+		}
 
-	typedef _Element Element;
-	typedef _Row Row;
-	typedef const Row ConstRow;
-	typedef std::vector<Row> Rep;
+		typedef typename Rep::iterator RowIterator;
+		typedef typename Rep::const_iterator ConstRowIterator;
 
-	template<typename _Tp1, typename _R1 = typename Rebind<_Row,_Tp1>::other >
-        struct rebind
-        { typedef SparseMatrixBase<typename _Tp1::Element, _R1, VectorCategories::SparseSequenceVectorTag> other; };
+		ConstRowIterator rowBegin () const
+		{
+			return _A.begin ();
+		}
 
-	SparseMatrixBase (size_t m, size_t n)
-		: _A (m), _m (m), _n (n) {}
+		ConstRowIterator rowEnd () const
+		{
+			return _A.end ();
+		}
 
-	/** Constructor from a MatrixStream
-	 */
-	template <class Field>
-	SparseMatrixBase ( MatrixStream<Field>& ms );
-
-	SparseMatrixBase (const SparseMatrixBase<Element, Row> &A)
-		: _A (A._A), _m (A._m), _n (A._n) {}
-
-    	template<class VectorType>
-	SparseMatrixBase (const SparseMatrixBase<Element, VectorType> &A)
-		: _A(A._m), _m (A._m), _n (A._n) {
-            typename Rep::iterator meit = this->_A.begin();
-            typename SparseMatrixBase<Element, VectorType>::Rep::const_iterator copit = A._A.begin();
-            for( ; meit != this->_A.end(); ++meit, ++copit)
-                LinBox::RawVector<Element>::convert(*meit, *copit);
-        }
-
-	~SparseMatrixBase () {}
-
-	size_t rowdim () const { return _m; }
-	size_t coldim () const { return _n; }
-	size_t size () const { 
-            size_t s(0);
-            for(typename Rep::const_iterator it = _A.begin(); it != _A.end(); ++it)
-                s+= LinBox::RawVector<_Element>::size(*it);
-            return s;
-        }
-
-	template <class Field>
-	std::istream &read (std::istream &is, const Field &F, FileFormatTag format = FORMAT_DETECT)
-		{ return SparseMatrixReadWriteHelper<Element, Row>::read
-			  (*this, is, F, format); }
-	std::istream &read (std::istream &is, FileFormatTag format = FORMAT_DETECT)
-		{ return SparseMatrixReadWriteHelper<Element, Row>::read
-			  (*this, is, SparseMatrixReadWriteHelper<Element, Row>::NoField (),
-			   format); }
-	template <class Field>
-	std::ostream &write (std::ostream &os, const Field &F, FileFormatTag format = FORMAT_PRETTY) const
-		{ return SparseMatrixReadWriteHelper<Element, Row>::write
-			  (*this, os, F, format); }
-	std::ostream &write (std::ostream &os, FileFormatTag format = FORMAT_PRETTY) const
-		{ return SparseMatrixReadWriteHelper<Element, Row>::write
-			  (*this, os, SparseMatrixReadWriteHelper<Element, Row>::NoField (),
-			   format); }
-
-	std::ostream &write(std::ostream &) const;
-
-	void           setEntry (size_t i, size_t j, const Element &value);
-	Element       &refEntry (size_t i, size_t j);
-	const Element &getEntry (size_t i, size_t j) const;
-	Element       &getEntry (Element &x, size_t i, size_t j) const
-			{ x = getEntry (i, j); return x; }
-
-	typedef typename Rep::iterator RowIterator;
-	typedef typename Rep::const_iterator ConstRowIterator;
-
-	ConstRowIterator rowBegin () const 
-		{ return _A.begin (); }
-	ConstRowIterator rowEnd () const
-		{ return _A.end (); }
-	RowIterator rowBegin ()
-		{ return _A.begin (); }
-	RowIterator rowEnd ()
-		{ return _A.end (); }
-
-	template <class RepIterator, class RowIterator, class _I_Element>
-	class _RawIterator
-	{
-	    public:
-		typedef _I_Element value_type;
+		RowIterator rowBegin ()
+		{
+			return _A.begin ();
+		}
 
-		_RawIterator (const RepIterator &i, const RowIterator &j, const RepIterator &A_end)
-			: _i (i), _j (j), _A_end (A_end)
+		RowIterator rowEnd ()
 		{
-			if( _i == _A_end ) return;
-		 	while ( _j == _i->end () ) {
- 				if (++_i == _A_end) return;
- 				_j = _i->begin ();
-			}
+			return _A.end ();
 		}
 
-		_RawIterator (const _RawIterator &iter)
-			: _i (iter._i), _j (iter._j), _A_end (iter._A_end)
-		{}
+		template <class RepIterator, class RowIterator, class _I_Element>
+		class _RawIterator {
+		public:
+			typedef _I_Element value_type;
+
+			_RawIterator (const RepIterator &i, const RowIterator &j, const RepIterator &A_end) :
+				_i (i), _j (j), _A_end (A_end)
+			{
+				if( _i == _A_end ) return;
+				while ( _j == _i->end () ) {
+					if (++_i == _A_end) return;
+					_j = _i->begin ();
+				}
+			}
 
-		_RawIterator () {}
+			_RawIterator (const _RawIterator &iter) :
+				_i (iter._i), _j (iter._j), _A_end (iter._A_end)
+			{}
 
-		_RawIterator &operator = (const _RawIterator &iter) 
-		{
-			_i = iter._i;
-			_j = iter._j;
-			_A_end = iter._A_end;
+			_RawIterator () {}
 
-			return *this;
-		}
+			_RawIterator &operator = (const _RawIterator &iter)
+			{
+				_i = iter._i;
+				_j = iter._j;
+				_A_end = iter._A_end;
+
+				return *this;
+			}
 
-		bool operator == (const _RawIterator &i) const
+			bool operator == (const _RawIterator &i) const
 			{ return (_i == i._i) && (_j == i._j); }
 
-		bool operator != (const _RawIterator &i) const
+			bool operator != (const _RawIterator &i) const
 			{ return (_i != i._i) || (_j != i._j); }
 
-		_RawIterator &operator ++ ()
-		{
-			++_j;
-			while( _j == _i->end ()) {
- 				if (++_i == _A_end) return *this;
- 				_j = _i->begin ();
+			_RawIterator &operator ++ ()
+			{
+				++_j;
+				while( _j == _i->end ()) {
+					if (++_i == _A_end) return *this;
+					_j = _i->begin ();
+				}
+
+				// if (++_j == _i->end ())
+				// 				if (++_i != _A_end)
+				// 					_j = _i->begin ();
+				return *this;
 			}
-			
-			// if (++_j == _i->end ())
-// 				if (++_i != _A_end)
-// 					_j = _i->begin ();
-			return *this;
-		}
 
-		_RawIterator operator ++ (int)
-		{
-			_RawIterator tmp = *this;
-			++(*this);
-			return tmp;
-		}
+			_RawIterator operator ++ (int)
+			{
+				_RawIterator tmp = *this;
+				++(*this);
+				return tmp;
+			}
 
-		_RawIterator &operator -- ()
-		{
-			while (_j == _i->begin ())
-				_j = (--_i)->end ();
-			--_j;
-			return *this;
-		}
+			_RawIterator &operator -- ()
+			{
+				while (_j == _i->begin ())
+					_j = (--_i)->end ();
+				--_j;
+				return *this;
+			}
 
-		_RawIterator operator -- (int)
-		{
-			_RawIterator tmp = *this;
-			--(*this);
-			return tmp;
-		}
+			_RawIterator operator -- (int)
+			{
+				_RawIterator tmp = *this;
+				--(*this);
+				return tmp;
+			}
 
-		value_type &operator * ()
+			value_type &operator * ()
 			{ return _j->second; }
 			// { return *(new value_type(_j->second)); }
 			// Dan Roche 2005-7-7 I believe this was a memory leak.
-		value_type *operator -> ()
+			value_type *operator -> ()
 			{ return &(_j->second); }
-		const value_type &operator*() const { return _j->second; }
-		const value_type *operator-> () const { return &(_j->second); }
+			const value_type &operator*() const { return _j->second; }
+			const value_type *operator-> () const { return &(_j->second); }
 
-	    private:
-		RepIterator _i;
-		RowIterator _j;
-		RepIterator _A_end;
-	};
+		private:
+			RepIterator _i;
+			RowIterator _j;
+			RepIterator _A_end;
+		};
 
-	typedef _RawIterator<typename Rep::iterator, typename Row::iterator, Element> RawIterator;
-	typedef _RawIterator<typename Rep::const_iterator, typename Row::const_iterator, const Element> ConstRawIterator;
+		typedef _RawIterator<typename Rep::iterator, typename Row::iterator, Element> RawIterator;
+		typedef _RawIterator<typename Rep::const_iterator, typename Row::const_iterator, const Element> ConstRawIterator;
 
-	RawIterator rawBegin ()
+		RawIterator rawBegin ()
 		{ return RawIterator (_A.begin (), _A.front ().begin (), _A.end ()); }
-	RawIterator rawEnd ()
+		RawIterator rawEnd ()
 		{ return RawIterator (_A.end (), _A.back ().end (), _A.end ()); }
-	ConstRawIterator rawBegin () const
+		ConstRawIterator rawBegin () const
 		{ return ConstRawIterator (_A.begin (), _A.front ().begin (), _A.end ()); }
-	ConstRawIterator rawEnd () const
+		ConstRawIterator rawEnd () const
 		{ return ConstRawIterator (_A.end (), _A.back ().end (), _A.end ()); }
 
-	template <class RepIterator, class RowIdxIterator>
-	class _RawIndexedIterator
-	{
-	    public:
-// 		// typedef std::pair<size_t, size_t> value_type;
-// 		typedef typename RowIdxIterator/*::value_type*/::second_type value_type;
-		typedef typename RowIdxIterator::value_type::second_type value_type;
 
-		_RawIndexedIterator (size_t idx, const RepIterator &i, const RowIdxIterator &j, const RepIterator &A_end)
-			: _i (i), _j (j), _A_end (A_end), _r_index (idx)
-		{
-			if( _i == _A_end ) return;
-			while(_j == _i->end ()) {
-				++_r_index;
-				if (++_i == _A_end) return;
-				_j = _i->begin ();
+
+		/* Generic trait for iterators without type */
+		template<typename U>
+		struct IteratorValueType {
+			typedef typename U::value_type value_type;
+		};
+
+		template<typename X>
+		struct IteratorValueType<const X*> {
+			typedef X value_type;
+		};
+
+		/* Generic trait for iterators without type */
+
+
+
+		template <class RepIterator, class RowIdxIterator>
+		class _RawIndexedIterator {
+		public:
+#if 0
+			typedef std::pair<size_t, size_t> value_type;
+			typedef typename RowIdxIterator/*::value_type*/::second_type value_type;
+			typedef typename RowIdxIterator::value_type::second_type value_type;
+#endif
+			typedef typename IteratorValueType< RowIdxIterator >::value_type::second_type value_type;
+
+			_RawIndexedIterator (size_t idx, const RepIterator &i, const RowIdxIterator &j, const RepIterator &A_end) :
+				_i (i), _j (j), _A_end (A_end), _r_index (idx)
+			{
+				if( _i == _A_end ) return;
+				while(_j == _i->end ()) {
+					++_r_index;
+					if (++_i == _A_end) return;
+					_j = _i->begin ();
+				}
+				_c_index =_j->first;
 			}
-			_c_index =_j->first;		
-		}
 
-		_RawIndexedIterator (const _RawIndexedIterator &iter)
-			: _i (iter._i), _j (iter._j), _A_end (iter._A_end), _r_index (iter._r_index), _c_index (iter._c_index)
-		{}
+			_RawIndexedIterator (const _RawIndexedIterator &iter) :
+				_i (iter._i), _j (iter._j), _A_end (iter._A_end), _r_index (iter._r_index), _c_index (iter._c_index)
+			{}
 
-		_RawIndexedIterator ()
-		{}
+			_RawIndexedIterator ()
+			{}
 
-		_RawIndexedIterator &operator = (const _RawIndexedIterator &iter) 
-		{
-			_A_end = iter._A_end;
-			_i = iter._i;
-			_j = iter._j;
-			_r_index = iter._r_index;
-			_c_index = iter._c_index;
+			_RawIndexedIterator &operator = (const _RawIndexedIterator &iter)
+			{
+				_A_end = iter._A_end;
+				_i = iter._i;
+				_j = iter._j;
+				_r_index = iter._r_index;
+				_c_index = iter._c_index;
 
-			return *this;
-		}
+				return *this;
+			}
 
-		bool operator == (const _RawIndexedIterator &i) const
+			bool operator == (const _RawIndexedIterator &i) const
 			{ return (_i == i._i) && (_j == i._j); }
 
-		bool operator != (const _RawIndexedIterator &i) const
+			bool operator != (const _RawIndexedIterator &i) const
 			{ return (_i != i._i) || (_j != i._j); }
 
-		_RawIndexedIterator &operator ++ ()
-		{
-			++_j;
-			while(_j == _i->end ()){
-				++_r_index;
-				if (++_i == _A_end) return *this;
-				_j = _i->begin ();
+			_RawIndexedIterator &operator ++ ()
+			{
+				++_j;
+				while(_j == _i->end ()){
+					++_r_index;
+					if (++_i == _A_end) return *this;
+					_j = _i->begin ();
+				}
+				_c_index = _j->first;
+#if 0
+				if (++_j == _i->end ()) {
+					if (++_i != _A_end) {
+						_j = _i->begin ();
+						++_r_index;
+					}
+				}
+
+				_c_index = _j->first;
+#endif
+
+				return *this;
 			}
-			_c_index = _j->first;	
-						
-			// if (++_j == _i->end ()) {
-// 				if (++_i != _A_end) {
-// 					_j = _i->begin ();
-// 					++_r_index;
-// 				}
-// 			}
-
-// 			_c_index = _j->first;
-
-			return *this;
-		}
 
-		_RawIndexedIterator operator ++ (int)
-		{
-			_RawIndexedIterator tmp = *this;
-			++(*this);
-			return tmp;
-		}
-
-		_RawIndexedIterator &operator -- ()
-		{
-			while (_j == _i->begin ()) {
-				_j = (--_i)->end ();
-				--_r_index;
+			_RawIndexedIterator operator ++ (int)
+			{
+				_RawIndexedIterator tmp = *this;
+				++(*this);
+				return tmp;
 			}
 
-			--_j;
-			_c_index = _j->first;
-			return *this;
-		}
+			_RawIndexedIterator &operator -- ()
+			{
+				while (_j == _i->begin ()) {
+					_j = (--_i)->end ();
+					--_r_index;
+				}
 
-		_RawIndexedIterator operator -- (int)
-		{
-			_RawIndexedIterator tmp = *this;
-			--(*this);
-			return tmp;
-		}
+				--_j;
+				_c_index = _j->first;
+				return *this;
+			}
 
-		value_type &operator * ()
+			_RawIndexedIterator operator -- (int)
+			{
+				_RawIndexedIterator tmp = *this;
+				--(*this);
+				return tmp;
+			}
+
+			value_type &operator * ()
 			{ return _j->second; }
-		const value_type &operator * () const
+			const value_type &operator * () const
 			{ return _j->second; }
-		value_type *operator -> ()
+			value_type *operator -> ()
 			{ return &(_j->second); }
-		const value_type *operator -> () const
+			const value_type *operator -> () const
 			{ return &(_j->second); }
 
-		size_t rowIndex () const
+			size_t rowIndex () const
 			{ return _r_index; }
-		size_t colIndex () const
+			size_t colIndex () const
 			{ return _c_index; }
+			const value_type &value() const
+			{ return _j->second; }
 
-	    private:
-		RepIterator _i;
-		RowIdxIterator _j;
-		RepIterator _A_end;
+		private:
+			RepIterator _i;
+			RowIdxIterator _j;
+			RepIterator _A_end;
 
-		mutable size_t _r_index;
-		mutable size_t _c_index;
-	};
+			mutable size_t _r_index;
+			mutable size_t _c_index;
+		};
 
-	typedef _RawIndexedIterator<typename Rep::iterator, typename Row::iterator> RawIndexedIterator;
-	typedef _RawIndexedIterator<typename Rep::const_iterator, typename Row::const_iterator> ConstRawIndexedIterator;
+		typedef _RawIndexedIterator<typename Rep::iterator, typename Row::iterator> RawIndexedIterator;
+		typedef _RawIndexedIterator<typename Rep::const_iterator, typename Row::const_iterator> ConstRawIndexedIterator;
 
-	RawIndexedIterator rawIndexedBegin ()
-	{ return RawIndexedIterator (0, _A.begin (), _A.front ().begin (), _A.end ()); }
-	RawIndexedIterator rawIndexedEnd ()
+		RawIndexedIterator rawIndexedBegin ()
+		{ return RawIndexedIterator (0, _A.begin (), _A.front ().begin (), _A.end ()); }
+		RawIndexedIterator rawIndexedEnd ()
 		{ return RawIndexedIterator (_m, _A.end (), _A.back ().end (), _A.end ()); }
-	ConstRawIndexedIterator rawIndexedBegin () const
+		ConstRawIndexedIterator rawIndexedBegin () const
 		{ return ConstRawIndexedIterator (0, _A.begin (), _A.front ().begin (), _A.end ()); }
-	ConstRawIndexedIterator rawIndexedEnd () const
+		ConstRawIndexedIterator rawIndexedEnd () const
 		{ return ConstRawIndexedIterator (_m, _A.end (), _A.back ().end (), _A.end ()); }
 
-	Row &getRow (size_t i) { return _A[i]; }
-	Row &operator [] (size_t i) { return _A[i]; }
-	ConstRow &operator [] (size_t i) const { return _A[i]; }
+		Row &getRow (size_t i) { return _A[i]; }
+		Row &operator [] (size_t i) { return _A[i]; }
+		ConstRow &operator [] (size_t i) const { return _A[i]; }
 
-	template <class Vector> Vector &columnDensity (Vector &v) const;
-	SparseMatrixBase &transpose (SparseMatrixBase &AT) const;
+		template <class Vector> Vector &columnDensity (Vector &v) const;
+		SparseMatrixBase &transpose (SparseMatrixBase &AT) const;
 
-    protected:
+	protected:
 
-	friend class SparseMatrixWriteHelper<Element, Row>;
-	friend class SparseMatrixReadWriteHelper<Element, Row>;
+		friend class SparseMatrixWriteHelper<Element, Row>;
+		friend class SparseMatrixReadWriteHelper<Element, Row>;
 
-	Rep               _A;
-	size_t            _m;
-	size_t            _n;
+		Rep               _A;
+		size_t            _m;
+		size_t            _n;
 
-    	template<class F, class R, class T> friend class SparseMatrixBase;
-};
+		template<class F, class R, class T> friend class SparseMatrixBase;
+		};
 
-/* Specialization for sparse associative vectors */
+	/* Specialization for sparse associative vectors */
 
-template <class _Element, class _Row>
-class SparseMatrixBase<_Element, _Row, VectorCategories::SparseAssociativeVectorTag >
-{
-    public:
-
-	typedef _Element Element;
-	typedef _Row Row;
-	typedef const Row ConstRow;
-	typedef std::vector<Row> Rep;
-
-	template<typename _Tp1, typename _R1 = typename Rebind<_Row,_Tp1>::other >
-        struct rebind
-        { typedef SparseMatrixBase<typename _Tp1::Element, _R1, VectorCategories::SparseAssociativeVectorTag> other; };
-
-	SparseMatrixBase (size_t m, size_t n)
-		: _A (m), _m (m), _n (n) {}
-	SparseMatrixBase (const SparseMatrixBase<Element, Row> &A)
-		: _A (A._A), _m (A._m), _n (A._n) {}
-
-    	template<class VectorType>
-	SparseMatrixBase (const SparseMatrixBase<Element, VectorType> &A)
-		: _A(A.m), _m (A._m), _n (A._n) {
-            typename Rep::iterator meit = this->_A.begin();
-            typename SparseMatrixBase<Element, VectorType>::Rep::const_iterator copit = A._A.begin();
-            for( ; meit != this->_A.end(); ++meit, ++copit)
-                LinBox::RawVector<Element>::convert(*meit, *copit);
-        }
-
-	/** Constructor from a MatrixStream
-	 */
-	template <class Field>
-	SparseMatrixBase ( MatrixStream<Field>& ms );
-	~SparseMatrixBase () {}
-
-	size_t rowdim () const { return _m; }
-	size_t coldim () const { return _n; }
-	size_t size () const { 
-            size_t s(0);
-            for(typename Rep::const_iterator it = _A.begin(); it != _A.end(); ++it)
-                s+= LinBox::RawVector<_Element>::size(*it);
-            return s;
-        }
-
-	template <class Field>
-	std::istream &read (std::istream &is, const Field &F, FileFormatTag format = FORMAT_DETECT)
-		{ return SparseMatrixReadWriteHelper<Element, Row>::read
-			  (*this, is, F, format); }
-	std::istream &read (std::istream &is, FileFormatTag format = FORMAT_DETECT)
-		{ return SparseMatrixReadWriteHelper<Element, Row>::read
-			  (*this, is, SparseMatrixReadWriteHelper<Element, Row>::NoField (),
-			   format); }
-	template <class Field>
-	std::ostream &write (std::ostream &os, const Field &F, FileFormatTag format = FORMAT_PRETTY) const
-		{ return SparseMatrixReadWriteHelper<Element, Row>::write
-			  (*this, os, F, format); }
-	std::ostream &write (std::ostream &os, FileFormatTag format = FORMAT_PRETTY) const
-		{ return SparseMatrixReadWriteHelper<Element, Row>::write
-			  (*this, os, SparseMatrixReadWriteHelper<Element, Row>::NoField (),
-			   format); }
-
-	void           setEntry (size_t i, size_t j, const Element &value) { _A[i][j] = value; }
-	Element       &refEntry (size_t i, size_t j)                       { return _A[i][j]; }
-	const Element &getEntry (size_t i, size_t j) const;
-	Element       &getEntry (Element &x, size_t i, size_t j) const     { x = _A[i][j]; return x; }
-
-	typedef typename Rep::iterator RowIterator;
-	typedef typename Rep::const_iterator ConstRowIterator;
-
-	ConstRowIterator rowBegin () const 
-		{ return _A.begin (); }
-	ConstRowIterator rowEnd () const
-		{ return _A.end (); }
-	RowIterator rowBegin ()
-		{ return _A.begin (); }
-	RowIterator rowEnd ()
-		{ return _A.end (); }
-
-	template <class RepIterator, class RowEltIterator, class _I_Element>
-	class _RawIterator
-	{
-	    public:
-		typedef _I_Element value_type;
+	template <class _Element, class _Row>
+	class SparseMatrixBase<_Element, _Row, VectorCategories::SparseAssociativeVectorTag > {
+	public:
 
-		_RawIterator (const RepIterator &i, const RowEltIterator &j, const RepIterator &A_end)
-			: _i (i), _j (j), _A_end (A_end)
-		{
-			if( _i == _A_end ) return;
-			while( _j == _i->end() ) {
-				if( ++_i == _A_end ) return;
-				_j = _i->begin();
-			}
-		}
+		typedef _Element Element;
+		typedef _Row Row;
+		typedef const Row ConstRow;
+		typedef _SP_BB_VECTOR_<Row> Rep;
 
-		_RawIterator (const _RawIterator &iter)
-			: _i (iter._i), _j (iter._j), _A_end (iter._A_end)
-		{}
+		template<typename _Tp1, typename _R1 = typename Rebind<_Row,_Tp1>::other >
+		struct rebind
+		{ typedef SparseMatrixBase<typename _Tp1::Element, _R1, VectorCategories::SparseAssociativeVectorTag> other; };
 
-		_RawIterator () {}
+		SparseMatrixBase (size_t m, size_t n) :
+			_A (m), _m (m), _n (n)
+		{}
+		SparseMatrixBase (const SparseMatrixBase<Element, Row> &A) :
+			_A (A._A), _m (A._m), _n (A._n)
+		{}
 
-		_RawIterator &operator = (const _RawIterator &iter) 
+		template<class VectorType>
+		SparseMatrixBase (const SparseMatrixBase<Element, VectorType> &A) :
+			_A(A.m), _m (A._m), _n (A._n)
 		{
-			_i = iter._i;
-			_j = iter._j;
-			_A_end = iter._A_end;
+			typename Rep::iterator meit = this->_A.begin();
+			typename SparseMatrixBase<Element, VectorType>::Rep::const_iterator copit = A._A.begin();
+			for( ; meit != this->_A.end(); ++meit, ++copit)
+				LinBox::RawVector<Element>::convert(*meit, *copit);
+		}
 
-			return *this;
+		/** Constructor from a MatrixStream
+		*/
+		template <class Field>
+		SparseMatrixBase ( MatrixStream<Field>& ms );
+		~SparseMatrixBase () {}
+
+		size_t rowdim () const { return _m; }
+		size_t coldim () const { return _n; }
+		size_t size () const {
+			size_t s(0);
+			for(typename Rep::const_iterator it = _A.begin(); it != _A.end(); ++it)
+				s+= LinBox::RawVector<_Element>::size(*it);
+			return s;
 		}
 
-		bool operator == (const _RawIterator &i) const
-			{ return (_i == i._i) && (_j == i._j); }
+		template <class Field>
+		std::istream &read (std::istream &is, const Field &F, FileFormatTag format = FORMAT_DETECT)
+		{
+			return SparseMatrixReadWriteHelper<Element, Row>::read
+			(*this, is, F, format);
+		}
+		std::istream &read (std::istream &is, FileFormatTag format = FORMAT_DETECT)
+		{
+			return SparseMatrixReadWriteHelper<Element, Row>::read
+			(*this, is, SparseMatrixReadWriteHelper<Element, Row>::NoField (),
+			 format);
+		}
+		template <class Field>
+		std::ostream &write (std::ostream &os, const Field &F, FileFormatTag format = FORMAT_PRETTY) const
+		{
+			return SparseMatrixReadWriteHelper<Element, Row>::write
+			(*this, os, F, format);
+		}
+		std::ostream &write (std::ostream &os, FileFormatTag format = FORMAT_PRETTY) const
+		{
+			return SparseMatrixReadWriteHelper<Element, Row>::write
+			(*this, os, SparseMatrixReadWriteHelper<Element, Row>::NoField (),
+			 format);
+		}
 
-		bool operator != (const _RawIterator &i) const
-			{ return (_i != i._i) || (_j != i._j); }
+		void           setEntry (size_t i, size_t j, const Element &value) { _A[i][j] = value; }
+		Element       &refEntry (size_t i, size_t j)                       { return _A[i][j]; }
+		const Element &getEntry (size_t i, size_t j) const;
+		Element       &getEntry (Element &x, size_t i, size_t j) const     { return x = _A[i][j];}
+
+		typedef typename Rep::iterator RowIterator;
+		typedef typename Rep::const_iterator ConstRowIterator;
 
-		_RawIterator &operator ++ ()
+		ConstRowIterator rowBegin () const
 		{
-			while (++_j == _i->end ()) {
-				if (++_i == _A_end ()) return *this;
-				_j = _i->begin ();
-			}
-			return *this;
+			return _A.begin ();
 		}
-
-		_RawIterator operator ++ (int)
+		ConstRowIterator rowEnd () const
 		{
-			_RawIterator tmp = *this;
-			++(*this);
-			return tmp;
+			return _A.end ();
 		}
-
-		_RawIterator &operator -- ()
+		RowIterator rowBegin ()
 		{
-			while (_j == _i->begin ())
-				_j = (--_i)->end ();
-			--_j;
-			return *this;
+			return _A.begin ();
 		}
-
-		_RawIterator operator -- (int)
+		RowIterator rowEnd ()
 		{
-			_RawIterator tmp = *this;
-			--(*this);
-			return tmp;
+			return _A.end ();
 		}
 
-		value_type &operator * ()
+		template <class RepIterator, class RowEltIterator, class _I_Element>
+		class _RawIterator {
+		public:
+			typedef _I_Element value_type;
+
+			_RawIterator (const RepIterator &i, const RowEltIterator &j, const RepIterator &A_end) :
+				_i (i), _j (j), _A_end (A_end)
+			{
+				if( _i == _A_end ) return;
+				while( _j == _i->end() ) {
+					if( ++_i == _A_end ) return;
+					_j = _i->begin();
+				}
+			}
+
+			_RawIterator (const _RawIterator &iter) :
+				_i (iter._i), _j (iter._j), _A_end (iter._A_end)
+			{}
+
+			_RawIterator () {}
+
+			_RawIterator &operator = (const _RawIterator &iter)
+			{
+				_i = iter._i;
+				_j = iter._j;
+				_A_end = iter._A_end;
+
+				return *this;
+			}
+
+			bool operator == (const _RawIterator &i) const
+			{ return (_i == i._i) && (_j == i._j); }
+
+			bool operator != (const _RawIterator &i) const
+			{ return (_i != i._i) || (_j != i._j); }
+
+			_RawIterator &operator ++ ()
+			{
+				while (++_j == _i->end ()) {
+					if (++_i == _A_end ()) return *this;
+					_j = _i->begin ();
+				}
+				return *this;
+			}
+
+			_RawIterator operator ++ (int)
+			{
+				_RawIterator tmp = *this;
+				++(*this);
+				return tmp;
+			}
+
+			_RawIterator &operator -- ()
+			{
+				while (_j == _i->begin ())
+					_j = (--_i)->end ();
+				--_j;
+				return *this;
+			}
+
+			_RawIterator operator -- (int)
+			{
+				_RawIterator tmp = *this;
+				--(*this);
+				return tmp;
+			}
+
+			value_type &operator * ()
 			{ return _j->second; }
-		value_type *operator -> ()
+			value_type *operator -> ()
 			{ return &(_j->second); }
 
-	    private:
-		RepIterator _i;
-		RowEltIterator _j;
-		RepIterator _A_end;
-	};
+		private:
+			RepIterator _i;
+			RowEltIterator _j;
+			RepIterator _A_end;
+		};
 
-	typedef _RawIterator<typename Rep::iterator, typename Row::iterator, Element> RawIterator;
-	typedef _RawIterator<typename Rep::const_iterator, typename Row::const_iterator, const Element> ConstRawIterator;
+		typedef _RawIterator<typename Rep::iterator, typename Row::iterator, Element> RawIterator;
+		typedef _RawIterator<typename Rep::const_iterator, typename Row::const_iterator, const Element> ConstRawIterator;
 
-	RawIterator rawBegin ()
+		RawIterator rawBegin ()
 		{ return RawIterator (_A.begin (), _A.front ().begin (), _A.end ()); }
-	RawIterator rawEnd ()
+		RawIterator rawEnd ()
 		{ return RawIterator (_A.end (), _A.back ().end (), _A.end ()); }
-	ConstRawIterator rawBegin () const
+		ConstRawIterator rawBegin () const
 		{ return ConstRawIterator (_A.begin (), _A.front ().begin (), _A.end ()); }
-	ConstRawIterator rawEnd () const
+		ConstRawIterator rawEnd () const
 		{ return ConstRawIterator (_A.end (), _A.back ().end (), _A.end ()); }
 
-	template <class RepIterator, class RowIdxIterator>
-	class _RawIndexedIterator
-	{
-	    public:
-		typedef std::pair<size_t, size_t> value_type;
-
-		_RawIndexedIterator (size_t idx, const RepIterator &i, const RowIdxIterator &j, const RepIterator &A_end)
-			: _i (i), _j (j), _A_end (A_end), _r_index (idx), _c_index (0)
-		{
-			if( _i == _A_end ) return;
-			while( _j == _i->end() ) {
-				++_r_index;
-				if( ++_i == _A_end ) return;
-				_j = _i->begin();
+		template <class RepIterator, class RowIdxIterator>
+		class _RawIndexedIterator {
+		public:
+			typedef std::pair<size_t, size_t> value_type;
+
+			_RawIndexedIterator (size_t idx, const RepIterator &i, const RowIdxIterator &j, const RepIterator &A_end) :
+				_i (i), _j (j), _A_end (A_end), _r_index (idx), _c_index (0)
+			{
+				if( _i == _A_end ) return;
+				while( _j == _i->end() ) {
+					++_r_index;
+					if( ++_i == _A_end ) return;
+					_j = _i->begin();
+				}
+				_c_index = _j->second;
 			}
-			_c_index = _j->second;
-		}
 
-		_RawIndexedIterator (const _RawIndexedIterator &iter)
-			: _i (iter._i), _j (iter._j), _A_end (iter._A_end), _r_index (iter._r_index), _c_index (iter._c_index)
-		{}
+			_RawIndexedIterator (const _RawIndexedIterator &iter) :
+				_i (iter._i), _j (iter._j), _A_end (iter._A_end), _r_index (iter._r_index), _c_index (iter._c_index)
+			{}
 
-		_RawIndexedIterator ()
-		{}
+			_RawIndexedIterator ()
+			{}
 
-		_RawIndexedIterator &operator = (const _RawIndexedIterator &iter) 
-		{
-			_A_end = iter._A_end;
-			_i = iter._i;
-			_j = iter._j;
-			_r_index = iter._r_index;
-			_c_index = iter._c_index;
+			_RawIndexedIterator &operator = (const _RawIndexedIterator &iter)
+			{
+				_A_end = iter._A_end;
+				_i = iter._i;
+				_j = iter._j;
+				_r_index = iter._r_index;
+				_c_index = iter._c_index;
 
-			return *this;
-		}
+				return *this;
+			}
 
-		bool operator == (const _RawIndexedIterator &i) const
+			bool operator == (const _RawIndexedIterator &i) const
 			{ return (_i == i._i) && (_j == i._j); }
 
-		bool operator != (const _RawIndexedIterator &i) const
+			bool operator != (const _RawIndexedIterator &i) const
 			{ return (_i != i._i) || (_j != i._j); }
 
-		_RawIndexedIterator &operator ++ ()
-		{
-			++_j;
-			while (_j == _i->end ()) {
-				++_r_index;
-				if (++_i == _A_end ()) return *this;
-				_j = _i->begin ();
-			}
-
-			_c_index = _j->second;
+			_RawIndexedIterator &operator ++ ()
+			{
+				++_j;
+				while (_j == _i->end ()) {
+					++_r_index;
+					if (++_i == _A_end ()) return *this;
+					_j = _i->begin ();
+				}
 
-			return *this;
-		}
+				_c_index = _j->second;
 
-		_RawIndexedIterator operator ++ (int)
-		{
-			_RawIndexedIterator tmp = *this;
-			++(*this);
-			return tmp;
-		}
+				return *this;
+			}
 
-		_RawIndexedIterator &operator -- ()
-		{
-			while (_j == _i->begin ()) {
-				_j = (--_i)->end ();
-				--_r_index;
+			_RawIndexedIterator operator ++ (int)
+			{
+				_RawIndexedIterator tmp = *this;
+				++(*this);
+				return tmp;
 			}
 
-			--_j;
-			_c_index = _j->second;
-			return *this;
-		}
+			_RawIndexedIterator &operator -- ()
+			{
+				while (_j == _i->begin ()) {
+					_j = (--_i)->end ();
+					--_r_index;
+				}
 
-		_RawIndexedIterator operator -- (int)
-		{
-			_RawIndexedIterator tmp = *this;
-			--(*this);
-			return tmp;
-		}
+				--_j;
+				_c_index = _j->second;
+				return *this;
+			}
 
-		value_type &operator * ()
+			_RawIndexedIterator operator -- (int)
+			{
+				_RawIndexedIterator tmp = *this;
+				--(*this);
+				return tmp;
+			}
+
+			value_type &operator * ()
 			{ return *_j; }
-		const value_type &operator * () const
+			const value_type &operator * () const
 			{ return *_j; }
-		value_type *operator -> ()
+			value_type *operator -> ()
 			{ return &(*_j); }
-		const value_type *operator -> () const
+			const value_type *operator -> () const
 			{ return &(*_j); }
 
-		size_t rowIndex () const
+			size_t rowIndex () const
 			{ return _r_index; }
-		size_t colIndex () const
+			size_t colIndex () const
 			{ return _c_index; }
+			const value_type &value() const
+			{ return *_j; }
 
-	    private:
-		RepIterator _i;
-		RowIdxIterator _j;
-		RepIterator _A_end;
+		private:
+			RepIterator _i;
+			RowIdxIterator _j;
+			RepIterator _A_end;
 
-		mutable size_t _r_index;
-		mutable size_t _c_index;
-	};
+			mutable size_t _r_index;
+			mutable size_t _c_index;
+		};
 
-	typedef _RawIndexedIterator<typename Rep::iterator, typename Row::iterator> RawIndexedIterator;
-	typedef _RawIndexedIterator<typename Rep::const_iterator, typename Row::const_iterator> ConstRawIndexedIterator;
+		typedef _RawIndexedIterator<typename Rep::iterator, typename Row::iterator> RawIndexedIterator;
+		typedef _RawIndexedIterator<typename Rep::const_iterator, typename Row::const_iterator> ConstRawIndexedIterator;
 
-	RawIndexedIterator rawIndexedBegin ()
+		RawIndexedIterator rawIndexedBegin ()
 		{ return RawIndexedIterator (0, _A.begin (), _A.front ().begin (), _A.end ()); }
-	RawIndexedIterator rawIndexedEnd ()
+		RawIndexedIterator rawIndexedEnd ()
 		{ return RawIndexedIterator (_m, _A.end (), _A.back ().end (), _A.end ()); }
-	ConstRawIndexedIterator rawIndexedBegin () const
+		ConstRawIndexedIterator rawIndexedBegin () const
 		{ return ConstRawIndexedIterator (0, _A.begin (), _A.front ().begin (), _A.end ()); }
-	ConstRawIndexedIterator rawIndexedEnd () const
+		ConstRawIndexedIterator rawIndexedEnd () const
 		{ return ConstRawIndexedIterator (_m, _A.end (), _A.back ().end (), _A.end ()); }
 
-	Row &getRow (size_t i) { return _A[i]; }
-	Row &operator [] (size_t i) { return _A[i]; }
-	ConstRow &operator [] (size_t i) const { return _A[i]; }
+		Row &getRow (size_t i) { return _A[i]; }
+		Row &operator [] (size_t i) { return _A[i]; }
+		ConstRow &operator [] (size_t i) const { return _A[i]; }
 
-	template <class Vector> Vector &columnDensity (Vector &v) const;
-	SparseMatrixBase &transpose (SparseMatrixBase &AT) const;
+		template <class Vector> Vector &columnDensity (Vector &v) const;
+		SparseMatrixBase &transpose (SparseMatrixBase &AT) const;
 
-    protected:
+	protected:
 
-	friend class SparseMatrixWriteHelper<Element, Row>;
-	friend class SparseMatrixReadWriteHelper<Element, Row>;
+		friend class SparseMatrixWriteHelper<Element, Row>;
+		friend class SparseMatrixReadWriteHelper<Element, Row>;
 
-	Rep               _A;
-	size_t            _m;
-	size_t            _n;
+		Rep               _A;
+		size_t            _m;
+		size_t            _n;
 
-    	template<class F, class R, class T> friend class SparseMatrixBase;
-};
+		template<class F, class R, class T> friend class SparseMatrixBase;
+		};
 
-/* Specialization for sparse parallel vectors */
+	/* Specialization for sparse parallel vectors */
 
-template <class _Element, class _Row>
-class SparseMatrixBase<_Element, _Row, VectorCategories::SparseParallelVectorTag >
-{
-    public:
-
-	typedef _Element Element;
-	typedef _Row Row;
-	typedef const Row ConstRow;
-	typedef std::vector<Row> Rep;
-
-	template<typename _Tp1, typename _R1 = typename Rebind<_Row,_Tp1>::other >
-        struct rebind
-        { typedef SparseMatrixBase<typename _Tp1::Element, _R1, VectorCategories::SparseParallelVectorTag> other; };
-
-	SparseMatrixBase (size_t m, size_t n)
-		: _A (m), _m (m), _n (n) {}
-	SparseMatrixBase (const SparseMatrixBase<Element, Row> &A)
-		: _A (A._A), _m (A._m), _n (A._n) {}
-    
-    	template<class VectorType>
-	SparseMatrixBase (const SparseMatrixBase<Element, VectorType> &A)
-		: _A(A._m), _m (A._m), _n (A._n) {
-            typename Rep::iterator meit = this->_A.begin();
-            typename SparseMatrixBase<Element, VectorType>::Rep::const_iterator copit = A._A.begin();
-            for( ; meit != this->_A.end(); ++meit, ++copit)
-                LinBox::RawVector<Element>::convert(*meit, *copit);
-        }
-
-	/** Constructor from a MatrixStream
-	 */
-	template <class Field>
-	SparseMatrixBase ( MatrixStream<Field>& ms );
-
-	~SparseMatrixBase () {}
-
-	size_t rowdim () const { return _m; }
-	size_t coldim () const { return _n; }
-	size_t size () const { 
-            size_t s(0);
-            for(typename Rep::const_iterator it = _A.begin(); it != _A.end(); ++it)
-                s+= LinBox::RawVector<_Element>::size(*it);
-            return s;
-        }
-
-	template <class Field>
-	std::istream &read (std::istream &is, const Field &F, FileFormatTag format = FORMAT_DETECT)
-		{ return SparseMatrixReadWriteHelper<Element, Row>::read
-			  (*this, is, F, format); }
-	std::istream &read (std::istream &is, FileFormatTag format = FORMAT_DETECT)
-		{ return SparseMatrixReadWriteHelper<Element, Row>::read
-			  (*this, is, SparseMatrixReadWriteHelper<Element, Row>::NoField (),
-			   format); }
-	template <class Field>
-	std::ostream &write (std::ostream &os, const Field &F, FileFormatTag format = FORMAT_PRETTY) const
-		{ return SparseMatrixReadWriteHelper<Element, Row>::write
-			  (*this, os, F, format); }
-	std::ostream &write (std::ostream &os, FileFormatTag format = FORMAT_PRETTY) const
-		{ return SparseMatrixReadWriteHelper<Element, Row>::write
-			  (*this, os, SparseMatrixReadWriteHelper<Element, Row>::NoField (),
-			   format); }
-
-	void           setEntry (size_t i, size_t j, const Element &value);
-	Element       &refEntry (size_t i, size_t j);
-	const Element &getEntry (size_t i, size_t j) const;
-	Element       &getEntry (Element &x, size_t i, size_t j) const
-			{ x = getEntry (i, j); return x; }
-
-	typedef typename Rep::iterator RowIterator;
-	typedef typename Rep::const_iterator ConstRowIterator;
-
-	ConstRowIterator rowBegin () const 
-		{ return _A.begin (); }
-	ConstRowIterator rowEnd () const
-		{ return _A.end (); }
-	RowIterator rowBegin ()
-		{ return _A.begin (); }
-	RowIterator rowEnd ()
-		{ return _A.end (); }
-
-	template <class RepIterator, class RowEltIterator, class _I_Element>
-	class _RawIterator
-	{
-	    public:
-		typedef _I_Element value_type;
+	template <class _Element, class _Row>
+	class SparseMatrixBase<_Element, _Row, VectorCategories::SparseParallelVectorTag > {
+	public:
 
-		_RawIterator (const RepIterator &i, const RowEltIterator &j, const RepIterator &A_end)
-			: _i (i), _j (j), _A_end (A_end)
-		{
-			if( _i == _A_end ) return;
-			while( _j == _i->second.end() ) {
-				if( ++_i == _A_end ) return;
-				_j = _i->second.begin();
-			}
-		}
+		typedef _Element Element;
+		typedef _Row Row;
+		typedef const Row ConstRow;
+		typedef _SP_BB_VECTOR_<Row> Rep;
 
-		_RawIterator (const _RawIterator &iter)
-			: _i (iter._i), _j (iter._j), _A_end (iter._A_end)
-		{}
+		template<typename _Tp1, typename _R1 = typename Rebind<_Row,_Tp1>::other >
+		struct rebind
+		{ typedef SparseMatrixBase<typename _Tp1::Element, _R1, VectorCategories::SparseParallelVectorTag> other; };
 
-		_RawIterator () {}
+		SparseMatrixBase (size_t m, size_t n) :
+			_A (m), _m (m), _n (n)
+		{}
+		SparseMatrixBase (const SparseMatrixBase<Element, Row> &A) :
+			_A (A._A), _m (A._m), _n (A._n)
+		{}
 
-		_RawIterator &operator = (const _RawIterator &iter)
+		template<class VectorType>
+		SparseMatrixBase (const SparseMatrixBase<Element, VectorType> &A) :
+			_A(A._m), _m (A._m), _n (A._n)
 		{
-			_i = iter._i;
-			_j = iter._j;
-			_A_end = iter._A_end;
-
-			return *this;
+			typename Rep::iterator meit = this->_A.begin();
+			typename SparseMatrixBase<Element, VectorType>::Rep::const_iterator copit = A._A.begin();
+			for( ; meit != this->_A.end(); ++meit, ++copit)
+				LinBox::RawVector<Element>::convert(*meit, *copit);
 		}
 
-		bool operator == (const _RawIterator &i) const
-			{ return (_i == i._i) && (_j == i._j); }
+		/** Constructor from a MatrixStream
+		*/
+		template <class Field>
+		SparseMatrixBase ( MatrixStream<Field>& ms );
 
-		bool operator != (const _RawIterator &i) const
-			{ return (_i != i._i) || (_j != i._j); }
+		~SparseMatrixBase () {}
 
-		_RawIterator &operator ++ ()
-		{
-			++_j;
-			while( _j == _i->second.end() ) {
-				if( ++_i == _A_end ) return *this;
-				_j = _i->second.begin();
-			}
-			return *this;
+		size_t rowdim () const { return _m; }
+		size_t coldim () const { return _n; }
+		size_t size () const {
+			size_t s(0);
+			for(typename Rep::const_iterator it = _A.begin(); it != _A.end(); ++it)
+				s+= LinBox::RawVector<_Element>::size(*it);
+			return s;
 		}
 
-		_RawIterator operator ++ (int)
+		template <class Field>
+		std::istream &read (std::istream &is, const Field &F, FileFormatTag format = FORMAT_DETECT)
+		{
+			return SparseMatrixReadWriteHelper<Element, Row>::read
+			(*this, is, F, format);
+		}
+		std::istream &read (std::istream &is, FileFormatTag format = FORMAT_DETECT)
+		{
+			return SparseMatrixReadWriteHelper<Element, Row>::read
+			(*this, is, SparseMatrixReadWriteHelper<Element, Row>::NoField (),
+			 format);
+		}
+		template <class Field>
+		std::ostream &write (std::ostream &os, const Field &F, FileFormatTag format = FORMAT_PRETTY) const
 		{
-			_RawIterator tmp = *this;
-			++(*this);
-			return tmp;
+			return SparseMatrixReadWriteHelper<Element, Row>::write
+			(*this, os, F, format);
+		}
+		std::ostream &write (std::ostream &os, FileFormatTag format = FORMAT_PRETTY) const
+		{
+			return SparseMatrixReadWriteHelper<Element, Row>::write
+			(*this, os, SparseMatrixReadWriteHelper<Element, Row>::NoField (),
+			 format);
 		}
 
-		_RawIterator &operator -- ()
+		void           setEntry (size_t i, size_t j, const Element &value);
+		Element       &refEntry (size_t i, size_t j);
+		const Element &getEntry (size_t i, size_t j) const;
+		Element       &getEntry (Element &x, size_t i, size_t j) const
 		{
-			while (_j == _i->second.begin ())
-				_j = (--_i)->second.end ();
-			--_j;
-			return *this;
+			return x = getEntry (i, j);
 		}
 
-		_RawIterator operator -- (int)
+		typedef typename Rep::iterator RowIterator;
+		typedef typename Rep::const_iterator ConstRowIterator;
+
+		ConstRowIterator rowBegin () const
+		{
+			return _A.begin ();
+		}
+		ConstRowIterator rowEnd () const
+		{
+			return _A.end ();
+		}
+		RowIterator rowBegin ()
+		{
+			return _A.begin ();
+		}
+		RowIterator rowEnd ()
 		{
-			_RawIterator tmp = *this;
-			--(*this);
-			return tmp;
+			return _A.end ();
 		}
 
-		value_type &operator * ()
+		template <class RepIterator, class RowEltIterator, class _I_Element>
+		class _RawIterator {
+		public:
+			typedef _I_Element value_type;
+
+			_RawIterator (const RepIterator &i, const RowEltIterator &j, const RepIterator &A_end) :
+				_i (i), _j (j), _A_end (A_end)
+			{
+				if( _i == _A_end ) return;
+				while( _j == _i->second.end() ) {
+					if( ++_i == _A_end ) return;
+					_j = _i->second.begin();
+				}
+			}
+
+			_RawIterator (const _RawIterator &iter) :
+				_i (iter._i), _j (iter._j), _A_end (iter._A_end)
+			{}
+
+			_RawIterator () {}
+
+			_RawIterator &operator = (const _RawIterator &iter)
+			{
+				_i = iter._i;
+				_j = iter._j;
+				_A_end = iter._A_end;
+
+				return *this;
+			}
+
+			bool operator == (const _RawIterator &i) const
+			{ return (_i == i._i) && (_j == i._j); }
+
+			bool operator != (const _RawIterator &i) const
+			{ return (_i != i._i) || (_j != i._j); }
+
+			_RawIterator &operator ++ ()
+			{
+				++_j;
+				while( _j == _i->second.end() ) {
+					if( ++_i == _A_end ) return *this;
+					_j = _i->second.begin();
+				}
+				return *this;
+			}
+
+			_RawIterator operator ++ (int)
+			{
+				_RawIterator tmp = *this;
+				++(*this);
+				return tmp;
+			}
+
+			_RawIterator &operator -- ()
+			{
+				while (_j == _i->second.begin ())
+					_j = (--_i)->second.end ();
+				--_j;
+				return *this;
+			}
+
+			_RawIterator operator -- (int)
+			{
+				_RawIterator tmp = *this;
+				--(*this);
+				return tmp;
+			}
+
+			value_type &operator * ()
 			{ return static_cast<value_type&>(*_j); }
-		value_type *operator -> ()
+			value_type *operator -> ()
 			{ return &(*_j); }
 
-	    private:
-		RepIterator _i;
-		RowEltIterator _j;
-		RepIterator _A_end;
-	};
+		private:
+			RepIterator _i;
+			RowEltIterator _j;
+			RepIterator _A_end;
+		};
 
-	typedef _RawIterator<typename Rep::iterator, typename Row::second_type::iterator, Element> RawIterator;
-	typedef _RawIterator<typename Rep::const_iterator, typename Row::second_type::const_iterator, const Element> ConstRawIterator;
+		typedef _RawIterator<typename Rep::iterator, typename Row::second_type::iterator, Element> RawIterator;
+		typedef _RawIterator<typename Rep::const_iterator, typename Row::second_type::const_iterator, const Element> ConstRawIterator;
 
-	RawIterator rawBegin ()
+		RawIterator rawBegin ()
 		{ return RawIterator (_A.begin (), _A.front ().second.begin (), _A.end ()); }
-	RawIterator rawEnd ()
+		RawIterator rawEnd ()
 		{ return RawIterator (_A.end (), _A.back ().second.end (), _A.end ()); }
-	ConstRawIterator rawBegin () const
+		ConstRawIterator rawBegin () const
 		{ return ConstRawIterator (_A.begin (), _A.front ().second.begin (), _A.end ()); }
-	ConstRawIterator rawEnd () const
+		ConstRawIterator rawEnd () const
 		{ return ConstRawIterator (_A.end (), _A.back ().second.end (), _A.end ()); }
 
-	template <class RepIterator, class RowIdxIterator>
-	class _RawIndexedIterator
-	{
-	    public:
-		typedef typename RepIterator::value_type::second_type::value_type value_type;
-
-		// Dan Roche 7-6-05 Fixed a seg fault this code was causing
-		_RawIndexedIterator (size_t idx, const RepIterator &i, const RowIdxIterator &j, const RepIterator &A_end)
-			: _i (i), _j (j), _A_end (A_end), _r_index (idx), _c_index(0), _value_index(0)
-		{
-			if( _i == _A_end ) return;
-			while( _j == _i->first.end() ) {
-				if( ++_i == _A_end ) return;
-				++_r_index;
-				_j = _i->first.begin();
+		template <class RepIterator, class RowIdxIterator>
+		class _RawIndexedIterator {
+		public:
+			typedef typename RepIterator::value_type::second_type::value_type value_type;
+
+			// Dan Roche 7-6-05 Fixed a seg fault this code was causing
+			_RawIndexedIterator (size_t idx, const RepIterator &i, const RowIdxIterator &j, const RepIterator &A_end) :
+				_i (i), _j (j), _A_end (A_end), _r_index (idx), _c_index(0), _value_index(0)
+			{
+				if( _i == _A_end ) return;
+				while( _j == _i->first.end() ) {
+					if( ++_i == _A_end ) return;
+					++_r_index;
+					_j = _i->first.begin();
+				}
+
+				_c_index = *_j;
+				_value_index = _j-_i->first.begin();
 			}
-			
-			_c_index = *_j;
-			_value_index = _j-_i->first.begin();
-                }
 
-		_RawIndexedIterator (const _RawIndexedIterator &iter)
-			: _i (iter._i), _j (iter._j), _A_end (iter._A_end), _r_index (iter._r_index), _c_index (iter._c_index), _value_index( iter._value_index )
-		{}
+			_RawIndexedIterator (const _RawIndexedIterator &iter) :
+				_i (iter._i), _j (iter._j), _A_end (iter._A_end), _r_index (iter._r_index), _c_index (iter._c_index), _value_index( iter._value_index )
+			{}
 
-		_RawIndexedIterator ()
-		{}
+			_RawIndexedIterator ()
+			{}
 
-		_RawIndexedIterator &operator = (const _RawIndexedIterator &iter) 
-		{
-			_A_end = iter._A_end;
-			_i = iter._i;
-			_j = iter._j;
-			_r_index = iter._r_index;
-			_c_index = iter._c_index;
-			_value_index = iter._value_index;
-
-			return *this;
-		}
+			_RawIndexedIterator &operator = (const _RawIndexedIterator &iter)
+			{
+				_A_end = iter._A_end;
+				_i = iter._i;
+				_j = iter._j;
+				_r_index = iter._r_index;
+				_c_index = iter._c_index;
+				_value_index = iter._value_index;
 
-		bool operator == (const _RawIndexedIterator &i) const
+				return *this;
+			}
+
+			bool operator == (const _RawIndexedIterator &i) const
 			{ return (_i == i._i) && (_j == i._j); }
 
-		bool operator != (const _RawIndexedIterator &i) const
+			bool operator != (const _RawIndexedIterator &i) const
 			{ return (_i != i._i) || (_j != i._j); }
 
-		_RawIndexedIterator &operator ++ ()
-		{
-			if(_j != _i->first.end ()) {
-				++_j ;
-				++_value_index;
-			}
-			while(_j == _i->first.end ()) {
-				++_r_index;
-				if (++_i == _A_end) return *this;
-                                _j = _i->first.begin ();
-				_value_index = 0;
+			_RawIndexedIterator &operator ++ ()
+			{
+				if(_j != _i->first.end ()) {
+					++_j ;
+					++_value_index;
+				}
+				while(_j == _i->first.end ()) {
+					++_r_index;
+					if (++_i == _A_end) return *this;
+					_j = _i->first.begin ();
+					_value_index = 0;
+				}
+				_c_index = *_j;
+
+				return *this;
 			}
-                        _c_index = *_j;
 
-			return *this;
-		}
-
-		_RawIndexedIterator operator ++ (int)
-		{
-			_RawIndexedIterator tmp = *this;
-			++(*this);
-			return tmp;
-		}
-
-		_RawIndexedIterator &operator -- ()
-		{
-			while (_j == _i->first.begin ()) {
-				_j = (--_i)->first.end ();
-				_value_index = _i->first.size();
-				--_r_index;
+			_RawIndexedIterator operator ++ (int)
+			{
+				_RawIndexedIterator tmp = *this;
+				++(*this);
+				return tmp;
 			}
 
-			--_j;
-			--_value_index;
-			_c_index = *_j;
-			return *this;
-		}
+			_RawIndexedIterator &operator -- ()
+			{
+				while (_j == _i->first.begin ()) {
+					_j = (--_i)->first.end ();
+					_value_index = _i->first.size();
+					--_r_index;
+				}
+
+				--_j;
+				--_value_index;
+				_c_index = *_j;
+				return *this;
+			}
 
-		_RawIndexedIterator operator -- (int)
-		{
-			_RawIndexedIterator tmp = *this;
-			--(*this);
-			return tmp;
-		}
+			_RawIndexedIterator operator -- (int)
+			{
+				_RawIndexedIterator tmp = *this;
+				--(*this);
+				return tmp;
+			}
 
- 		const value_type &operator * () const
- 		    { return *(_i->second.begin () + _c_index); }
-		value_type &operator * ()
-		    { return (value_type&)(_i->second)[_value_index]; }
-		value_type *operator -> ()
-			{ return &(*(_i->second.begin () + _c_index)); }
- 		const value_type *operator -> () const
- 			{ return &(*(_i->second.begin () + _c_index)); }
+			//  		const value_type &operator * () const
+			//  		    { return *(_i->second.begin () + _c_index); }
+			value_type &operator * ()
+			{ return (value_type&)(_i->second)[_value_index]; }
+			// 		value_type *operator -> ()
+			// 			{ return &(*(_i->second.begin () + _c_index)); }
+			//  		const value_type *operator -> () const
+			//  			{ return &(*(_i->second.begin () + _c_index)); }
 
-		size_t rowIndex () const
+			size_t rowIndex () const
 			{ return _r_index; }
-		size_t colIndex () const
+			size_t colIndex () const
 			{ return _c_index; }
+			const value_type &value () const
+			{ return (value_type&)(_i->second)[_value_index]; }
 
-	    private:
-		RepIterator _i;
-		RowIdxIterator _j;
-		RepIterator _A_end;
+		private:
+			RepIterator _i;
+			RowIdxIterator _j;
+			RepIterator _A_end;
 
-		mutable size_t _r_index;
-		mutable size_t _c_index;
-		mutable size_t _value_index;
-	};
+			mutable size_t _r_index;
+			mutable size_t _c_index;
+			mutable size_t _value_index;
+		};
 
-	typedef _RawIndexedIterator<typename Rep::iterator, typename Row::first_type::iterator> RawIndexedIterator;
-	typedef _RawIndexedIterator<typename Rep::const_iterator, typename Row::first_type::const_iterator> ConstRawIndexedIterator;
+		typedef _RawIndexedIterator<typename Rep::iterator, typename Row::first_type::iterator> RawIndexedIterator;
+		typedef _RawIndexedIterator<typename Rep::const_iterator, typename Row::first_type::const_iterator> ConstRawIndexedIterator;
 
-	RawIndexedIterator rawIndexedBegin ()
+		RawIndexedIterator rawIndexedBegin ()
 		{ return RawIndexedIterator (0, _A.begin (), _A.front ().first.begin (), _A.end ()); }
-	RawIndexedIterator rawIndexedEnd ()
+		RawIndexedIterator rawIndexedEnd ()
 		{ return RawIndexedIterator (_m, _A.end (), _A.back ().first.end (), _A.end ()); }
-	ConstRawIndexedIterator rawIndexedBegin () const
+		ConstRawIndexedIterator rawIndexedBegin () const
 		{ return ConstRawIndexedIterator (0, _A.begin (), _A.front ().first.begin (), _A.end ()); }
-	ConstRawIndexedIterator rawIndexedEnd () const
+		ConstRawIndexedIterator rawIndexedEnd () const
 		{ return ConstRawIndexedIterator (_m, _A.end (), _A.back ().first.end (), _A.end ()); }
 
-	Row &getRow (size_t i) { return _A[i]; }
-	Row &operator [] (size_t i) { return _A[i]; }
-	ConstRow &operator [] (size_t i) const { return _A[i]; }
+		Row &getRow (size_t i) { return _A[i]; }
+		Row &operator [] (size_t i) { return _A[i]; }
+		ConstRow &operator [] (size_t i) const { return _A[i]; }
 
-	template <class Vector> Vector &columnDensity (Vector &v) const;
-	SparseMatrixBase &transpose (SparseMatrixBase &AT) const;
+		template <class Vector> Vector &columnDensity (Vector &v) const;
+		SparseMatrixBase &transpose (SparseMatrixBase &AT) const;
 
-    protected:
+	protected:
 
-	friend class SparseMatrixWriteHelper<Element, Row>;
-	friend class SparseMatrixReadWriteHelper<Element, Row>;
+		friend class SparseMatrixWriteHelper<Element, Row>;
+		friend class SparseMatrixReadWriteHelper<Element, Row>;
 
-	Rep               _A;
-	size_t            _m;
-	size_t            _n;
+		Rep               _A;
+		size_t            _m;
+		size_t            _n;
 
-    	template<class F, class R, class T> friend class SparseMatrixBase;
-};
+		template<class F, class R, class T> friend class SparseMatrixBase;
+		};
 
-template <class Element, class Row>
-std::ostream &operator << (std::ostream &os, const SparseMatrixBase<Element, Row> &A)
+	template <class Element, class Row>
+	std::ostream &operator << (std::ostream &os, const SparseMatrixBase<Element, Row> &A)
 	{ return A.write (os); }
 
-template <class Element, class Row>
-std::istream &operator >> (std::istream &is, SparseMatrixBase<Element, Row> &A)
+	template <class Element, class Row>
+	std::istream &operator >> (std::istream &is, SparseMatrixBase<Element, Row> &A)
 	{ return A.read (is); }
 
-template <class Element, class Row, class Trait>
-struct MatrixTraits< SparseMatrixBase<Element, Row, Trait> >
-{ 
-	typedef SparseMatrixBase<Element, Row, Trait> MatrixType;
-	typedef typename MatrixCategories::RowMatrixTag MatrixCategory; 
-};
+	template <class Element, class Row, class Trait>
+	struct MatrixTraits< SparseMatrixBase<Element, Row, Trait> >
+	{
+		typedef SparseMatrixBase<Element, Row, Trait> MatrixType;
+		typedef typename MatrixCategories::RowMatrixTag MatrixCategory;
+	};
 
-template <class Element, class Row, class Trait>
-struct MatrixTraits< const SparseMatrixBase<Element, Row, Trait> >
-{ 
-	typedef const SparseMatrixBase<Element, Row, Trait> MatrixType;
-	typedef typename MatrixCategories::RowMatrixTag MatrixCategory; 
-};
+	template <class Element, class Row, class Trait>
+	struct MatrixTraits< const SparseMatrixBase<Element, Row, Trait> >
+	{
+		typedef const SparseMatrixBase<Element, Row, Trait> MatrixType;
+		typedef typename MatrixCategories::RowMatrixTag MatrixCategory;
+	};
 
 } // namespace LinBox
 
 #include "linbox/matrix/sparse.inl"
 
-#endif // __MATRIX_SPARSE_H
+#endif // __LINBOX_matrix_sparse_H
+
diff --git a/linbox/matrix/sparse.inl b/linbox/matrix/sparse.inl
index e5e5ea3..e6a8b05 100644
--- a/linbox/matrix/sparse.inl
+++ b/linbox/matrix/sparse.inl
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/matrix/sparse.inl
  * Copyright (C) 2001-2002 Bradford Hovinen
  *               1999-2001 William J Turner,
@@ -21,8 +21,8 @@
  * See COPYING for license information.
  */
 
-#ifndef __MATRIX_SPARSE_INL
-#define __MATRIX_SPARSE_INL
+#ifndef __LINBOX_matrix_sparse_INL
+#define __LINBOX_matrix_sparse_INL
 
 #include "linbox/linbox-config.h"
 
@@ -42,925 +42,917 @@
 namespace LinBox
 {
 
-template <class Element, class Row, class Trait>
-template <class Field>
-std::istream &SparseMatrixReadWriteHelper<Element, Row, Trait>
-	::readTurner (SparseMatrixBase<Element, Row> &A, std::istream &is, const Field &F, char *buf)
-{
-	size_t i, j;
+	template <class Element, class Row, class Trait>
+	template <class Field>
+	std::istream &SparseMatrixReadWriteHelper<Element, Row, Trait> ::readTurner (SparseMatrixBase<Element, Row> &A, std::istream &is, const Field &F, char *buf)
+	{
+		size_t i, j;
 
-	A._A.clear ();
-	A._A.resize (A._m);
+		A._A.clear ();
+		A._A.resize (A._m);
 
-	do {
-		std::istringstream str (buf);
+		do {
+			std::istringstream str (buf);
 
-		str >> i;
+			str >> i;
 
-		if (i == (size_t) -1) break; // return also if row index is -1
-		str >> j;
-		F.read (str, A.refEntry (i, j));
+			if (i == (size_t) -1) break; // return also if row index is -1
+			str >> j;
+			F.read (str, A.refEntry (i, j));
 
-		is.getline (buf, 80);
-	} while (is);
+			is.getline (buf, 80);
+		} while (is);
 
-	return is;
-}
-
-template <class Element, class Row, class Trait>
-template <class Field>
-std::istream &SparseMatrixReadWriteHelper<Element, Row, Trait>
-	::readGuillaume (SparseMatrixBase<Element, Row> &A, std::istream &is, const Field &F, char *buf)
-{
-	size_t i, j;
-
-	std::istringstream str (buf);	
-	str >> A._m >> A._n;
-		
-	A._A.clear ();
-	A._A.resize (A._m);//cerr<<A.coldim()<<" "<<A.rowdim()<<endl;
-		
-    Element x;
-	while (is >> i) {
-		if (i == 0 || i == (size_t) -1) {is >> j; F.read(is, x); break;}
-		is >> j;
-		if (i > A._m || j > A._n)
-			throw InvalidMatrixInput ();
-		F.read (is, x);
-		if (! F.isZero(x)) A.setEntry (i - 1, j - 1, x);
+		return is;
 	}
 
-	return is;
+	template <class Element, class Row, class Trait>
+	template <class Field>
+	std::istream &SparseMatrixReadWriteHelper<Element, Row, Trait> ::readGuillaume (SparseMatrixBase<Element, Row> &A, std::istream &is, const Field &F, char *buf)
+	{
+		size_t i, j;
 
-}
+		std::istringstream str (buf);
+		str >> A._m >> A._n;
+
+		A._A.clear ();
+		A._A.resize (A._m);//cerr<<A.coldim()<<" "<<A.rowdim()<<endl;
+
+		Element x;
+		while (is >> i) {
+			if (i == 0 || i == (size_t) -1) {is >> j; F.read(is, x); break;}
+			is >> j;
+			if (i > A._m || j > A._n)
+				throw InvalidMatrixInput ();
+			F.read (is, x);
+			if (! F.isZero(x)) A.setEntry (i - 1, j - 1, x);
+		}
 
-template <class Element, class Row, class Trait>
-template <class Field>
-std::istream &SparseMatrixReadWriteHelper<Element, Row, Trait>
-	::readMatlab (SparseMatrixBase<Element, Row> &A, std::istream &is, const Field &F, char *buf)
-{
-	size_t i = 0, j = 0;
-	char c;
-	Element a_ij;
+		return is;
 
-	while (1) {
-		do is >> c; while (is && !isdigit (c));
-		if (!is) break;
+	}
 
-		is.putback (c);
+	template <class Element, class Row, class Trait>
+	template <class Field>
+	std::istream &SparseMatrixReadWriteHelper<Element, Row, Trait> ::readMatlab (SparseMatrixBase<Element, Row> &A, std::istream &is, const Field &F, char *buf)
+	{
+		size_t i = 0, j = 0;
+		char c;
+		Element a_ij;
 
-		F.read (is, a_ij);
-		A.setEntry (i, j++, a_ij);
+		while (1) {
+			do is >> c; while (is && !std::isdigit (c));
+			if (!is) break;
 
-		do is >> c; while (is && c != ',' && c != ';' && c != ']');
-		if (!is) break;;
+			is.putback (c);
 
-		if (c == ';') {
-			++i;
-			j = 0;
-		}
-		else if (c == ']') break;
-	}
+			F.read (is, a_ij);
+			A.setEntry (i, j++, a_ij);
 
-	return is;
-}
+			do is >> c; while (is && c != ',' && c != ';' && c != ']');
+			if (!is) break;;
 
-template <class Element, class Row, class Trait>
-template <class Field>
-std::istream &SparseMatrixReadWriteHelper<Element, Row, Trait>
-	::readPretty (SparseMatrixBase<Element, Row> &A, std::istream &is, const Field &F, char *buf)
-{
-	size_t i, j;
-	Element a_ij;
-	char c;
+			if (c == ';') {
+				++i;
+				j = 0;
+			}
+			else if (c == ']') break;
+		}
 
-	A._m = 0;
-	A._A.clear ();
+		return is;
+	}
 
-	i = 0;
+	template <class Element, class Row, class Trait>
+	template <class Field>
+	std::istream &SparseMatrixReadWriteHelper<Element, Row, Trait> ::readPretty (SparseMatrixBase<Element, Row> &A, std::istream &is, const Field &F, char *buf)
+	{
+		size_t i, j;
+		Element a_ij;
+		char c;
 
-	do {
-		A._m++;
-		A._A.push_back (Row ());
+		A._m = 0;
+		A._A.clear ();
 
-		std::istringstream str (buf);
+		i = 0;
 
-		do str >> c; while (isspace (c));
-		if (c != '[')
-			throw InvalidMatrixInput ();
+		do {
+			A._m++;
+			A._A.push_back (Row ());
 
-		j = 0;
+			std::istringstream str (buf);
 
-		while (str) {
 			do str >> c; while (isspace (c));
-			if (!str || c == ']') break;
-			F.read (str, a_ij);
+			if (c != '[')
+				throw InvalidMatrixInput ();
 
-			j++;
-			if (j > A._n)
-				A._n++;
+			j = 0;
 
-			if (!F.isZero(a_ij))
-				A.setEntry (i, j, a_ij);
-		}
+			while (str) {
+				do str >> c; while (isspace (c));
+				if (!str || c == ']') break;
+				F.read (str, a_ij);
 
-		is.getline (buf, 80);
+				j++;
+				if (j > A._n)
+					A._n++;
 
-		i++;
-	} while (is);
+				if (!F.isZero(a_ij))
+					A.setEntry (i, j, a_ij);
+			}
 
-	return is;
+			is.getline (buf, 80);
 
-}
+			i++;
+		} while (is);
 
-template <class Element, class Row, class Trait>
-template <class Field>
-std::istream &SparseMatrixReadWriteHelper<Element, Row, Trait>
-	::readMagmaCpt (SparseMatrixBase<Element, Row> &A, std::istream &is, const Field &F, char *buf)
-{
-	size_t i, j;
-	Element a_ij;
-	char c;
-	const char matrixstart = '[', matrixend = ']';
-	const char rowstart = '[', rowend = ']';
-	const char pairstart = '[', pairend = ']';
-
-	A._m = A._n = 0;
-	A._A.clear ();
-
-    do {is.get(c);} while (c != matrixstart ); // find matrix start
-	i = 0;
-	while (true)
+			return is;
+
+	}
+
+	template <class Element, class Row, class Trait>
+	template <class Field>
+	std::istream &SparseMatrixReadWriteHelper<Element, Row, Trait> ::readMagmaCpt (SparseMatrixBase<Element, Row> &A, std::istream &is, const Field &F, char *buf)
 	{
-        do {is.get(c);} while (c != matrixend && c != rowstart);
-		if (c == matrixend) return is;
-		else
-		{   
-			A._m++;
-			A._A.push_back (Row ());
-	        //processrow(i)
-			while (true) 
+		size_t i, j;
+		Element a_ij;
+		char c;
+		const char matrixstart = '[', matrixend = ']';
+		const char rowstart = '[', rowend = ']';
+		const char pairstart = '[', pairend = ']';
+
+		A._m = A._n = 0;
+		A._A.clear ();
+
+		do {is.get(c);} while (c != matrixstart ); // find matrix start
+		i = 0;
+		while (true)
+		{
+			do {is.get(c);} while (c != matrixend && c != rowstart);
+			if (c == matrixend) return is;
+			else
 			{
-        		do {is.get(c);} while (c != pairstart && c != rowend ); 
-				if (c == rowend) break;
-				else
-				{  //processpair( j v for row i);
-					is >> j; 
-					if (j > A._n) A._n = j;
-    				do {is.get(c);} while (!isdigit(c) && c != '-' && c != '+');
-					is.unget();
-					F.read(is, a_ij);
-			        if (!F.isZero(a_ij)) A.setEntry (i, j-1, a_ij);
-					do {is.get(c);} while (c != pairend);
+				A._m++;
+				A._A.push_back (Row ());
+				//processrow(i)
+				while (true)
+				{
+					do {is.get(c);} while (c != pairstart && c != rowend );
+					if (c == rowend) break;
+					else
+					{  //processpair( j v for row i);
+						is >> j;
+						if (j > A._n) A._n = j;
+						do {is.get(c);} while (!std::isdigit(c) && c != '-' && c != '+');
+						is.unget();
+						F.read(is, a_ij);
+						if (!F.isZero(a_ij)) A.setEntry (i, j-1, a_ij);
+						do {is.get(c);} while (c != pairend);
+					}
 				}
+				++i;
 			}
-			++i;
 		}
+		//return is; //BB: unreachable
 	}
-	return is;
-}
-
-template <class Element, class Row, class Trait>
-template <class Field>
-std::istream &SparseMatrixReadWriteHelper<Element, Row, Trait>
-	::read (SparseMatrixBase<Element, Row> &A, std::istream &is, const Field &F,
-		FileFormatTag format)
-{
-	char buf[80];
-	buf[0]=0;
-	char c;
 
-	switch (format) {
-	    case FORMAT_DETECT: {
-		is.getline (buf, 80);
-		std::istringstream str (buf);
-		do str >> c; while (isspace (c));
-
-		if (c == '[') {
-			if (strchr (buf, ';') != NULL)
-				readMatlab (A, is, F, buf);
-			else
-				readPretty (A, is, F, buf);
-		} else if (isdigit (c)) {
-			do str >> c; while (str && (isspace (c) || isdigit (c)));
-
-			if (c == 'M')
-				return readGuillaume (A, is, F, buf);
-			else
-				return readTurner (A, is, F, buf);
-		} else
-			throw InvalidMatrixInput ();
-		break;
+	template <class Element, class Row, class Trait>
+	template <class Field>
+	std::istream &SparseMatrixReadWriteHelper<Element, Row, Trait> ::read (SparseMatrixBase<Element, Row> &A, std::istream &is, const Field &F,
+									       FileFormatTag format)
+	{
+		char buf[80];
+		buf[0]=0;
+		char c;
+
+		switch (format) {
+		case FORMAT_DETECT: {
+					    is.getline (buf, 80);
+					    std::istringstream str (buf);
+					    do str >> c; while (isspace (c));
+
+					    if (c == '[') {
+						    if (strchr (buf, ';') != NULL)
+							    readMatlab (A, is, F, buf);
+						    else
+							    readPretty (A, is, F, buf);
+					    }
+					    else if (std::isdigit (c)) {
+						    do str >> c; while (str && (isspace (c) || std::isdigit (c)));
+
+						    if (c == 'M')
+							    return readGuillaume (A, is, F, buf);
+						    else
+							    return readTurner (A, is, F, buf);
+					    }
+					    else
+						    throw InvalidMatrixInput ();
+					    break;
+				    }
+
+		case FORMAT_TURNER:
+				    return readTurner (A, is, F, buf);
+		case FORMAT_GUILLAUME:
+				    return readGuillaume (A, is, F, buf);
+		case FORMAT_MATLAB:
+				    return readMatlab (A, is, F, buf);
+		case FORMAT_PRETTY:
+				    return readPretty (A, is, F, buf);
+		case FORMAT_MAGMACPT:
+				    return readMagmaCpt (A, is, F, buf);
+		default:
+				    throw InvalidMatrixInput();
 		}
 
-	    case FORMAT_TURNER:
-		return readTurner (A, is, F, buf);
-	    case FORMAT_GUILLAUME:
-		return readGuillaume (A, is, F, buf);
-	    case FORMAT_MATLAB:
-		return readMatlab (A, is, F, buf);
-	    case FORMAT_PRETTY:
-		return readPretty (A, is, F, buf);
-	    case FORMAT_MAGMACPT:
-		return readMagmaCpt (A, is, F, buf);
-	    default:
-	    	throw InvalidMatrixInput();
+		return is;
 	}
 
-	return is;
-}
-
-template <class Element, class Row, class Trait>
-template <class Field>
-std::ostream &SparseMatrixWriteHelper<Element, Row, Trait>
-	::write (const SparseMatrixBase<Element, Row> &A, std::ostream &os, const Field &F, 
-		FileFormatTag format)
-{
-	typename SparseMatrixBase<Element, Row>::Rep::const_iterator i;
-	typename Row::const_iterator j;
-	typename Field::Element zero;
-	size_t i_idx, j_idx;
-	//	int col_width;
-	integer c;
-        bool firstrow;
-
-	// Avoid massive unneeded overhead in the case that this
-	// printing is disabled
-	if (commentator.isNullStream (os))
-		return os;
-
-	switch (format) {
-	    case FORMAT_DETECT:
-		throw PreconditionFailed (__FUNCTION__, __LINE__, "format != FORMAT_DETECT");
-		break;
-
-	    case FORMAT_TURNER:
-		// The i j v triples, with zero based indices.
-		for (i = A._A.begin (), i_idx = 0; i != A._A.end (); i++, i_idx++) {
-			for (j = i->begin (), j_idx = 0; j != i->end (); j++, j_idx++) {
-				os << i_idx << ' ' << j->first << ' ';
-				F.write (os, j->second);
-				os << std::endl;
+	template <class Element, class Row, class Trait>
+	template <class Field>
+	std::ostream &SparseMatrixWriteHelper<Element, Row, Trait> ::write (const SparseMatrixBase<Element, Row> &A, std::ostream &os, const Field &F,
+									    FileFormatTag format)
+	{
+		typename SparseMatrixBase<Element, Row>::Rep::const_iterator i;
+		typename Row::const_iterator j;
+		typename Field::Element zero;
+		size_t i_idx, j_idx;
+		//	int col_width;
+		integer c;
+		bool firstrow;
+
+		// Avoid massive unneeded overhead in the case that this
+		// printing is disabled
+		if (commentator.isNullStream (os))
+			return os;
+
+		switch (format) {
+		case FORMAT_DETECT:
+			throw PreconditionFailed (__func__, __LINE__, "format != FORMAT_DETECT");
+			//break;//BB: unreachable
+
+		case FORMAT_TURNER:
+			// The i j v triples, with zero based indices.
+			for (i = A._A.begin (), i_idx = 0; i != A._A.end (); i++, i_idx++) {
+				for (j = i->begin (), j_idx = 0; j != i->end (); j++, j_idx++) {
+					os << i_idx << ' ' << j->first << ' ';
+					F.write (os, j->second);
+					os << std::endl;
+				}
 			}
-		}
-		break;
-
-	    case FORMAT_ONE_BASED:
-		// The i j v triples, with zero based indices.
-		for (i = A._A.begin (), i_idx = 0; i != A._A.end (); i++, i_idx++) {
-			for (j = i->begin (), j_idx = 0; j != i->end (); j++, j_idx++) {
-				os << i_idx + 1 << ' ' << j->first + 1 << ' ';
-				F.write (os, j->second);
-				os << std::endl;
+			break;
+
+		case FORMAT_ONE_BASED:
+			// The i j v triples, with zero based indices.
+			for (i = A._A.begin (), i_idx = 0; i != A._A.end (); i++, i_idx++) {
+				for (j = i->begin (), j_idx = 0; j != i->end (); j++, j_idx++) {
+					os << i_idx + 1 << ' ' << j->first + 1 << ' ';
+					F.write (os, j->second);
+					os << std::endl;
+				}
 			}
-		}
-		break;
-
-	    case FORMAT_GUILLAUME:
-		// row col 'M' header line followed by the i j v triples, one based, 
-		// followed by 0 0 0.
-		os << A._m << ' ' << A._n << " M" << std::endl;
-
-		for (i = A._A.begin (), i_idx = 0; i != A._A.end (); i++, i_idx++) {
-			for (j = i->begin (), j_idx = 0; j != i->end (); j++, j_idx++) {
-				os << i_idx + 1 << ' ' << j->first + 1 << ' ';
-				F.write (os, j->second);
-				os << std::endl;
+			break;
+
+		case FORMAT_GUILLAUME:
+			// row col 'M' header line followed by the i j v triples, one based,
+			// followed by 0 0 0.
+			os << A._m << ' ' << A._n << " M" << std::endl;
+
+			for (i = A._A.begin (), i_idx = 0; i != A._A.end (); i++, i_idx++) {
+				for (j = i->begin (), j_idx = 0; j != i->end (); j++, j_idx++) {
+					os << i_idx + 1 << ' ' << j->first + 1 << ' ';
+					F.write (os, j->second);
+					os << std::endl;
+				}
 			}
-		}
 
-		os << "0 0 0" << std::endl;
+			os << "0 0 0" << std::endl;
 
-		break;
+			break;
 
-	    case FORMAT_MATLAB:
-		F.init (zero, 0);
+		case FORMAT_MATLAB:
+			F.init (zero, 0);
 
-		os << "[";
+			os << "[";
 
-		for (i = A._A.begin (), i_idx = 0; i != A._A.end (); i++, i_idx++) {
-			j = i->begin ();
+			for (i = A._A.begin (), i_idx = 0; i != A._A.end (); i++, i_idx++) {
+				j = i->begin ();
 
-			for (j_idx = 0; j_idx < A._n; j_idx++) {
-				if (j == i->end () || j_idx != j->first)
-					F.write (os, zero);
-				else {
-					F.write (os, j->second);
-					j++;
+				for (j_idx = 0; j_idx < A._n; j_idx++) {
+					if (j == i->end () || j_idx != j->first)
+						F.write (os, zero);
+					else {
+						F.write (os, j->second);
+						j++;
+					}
+
+					if (j_idx < A._n - 1)
+						os << ", ";
 				}
 
-				if (j_idx < A._n - 1)
-					os << ", ";
+				os << "; ";
 			}
 
-			os << "; ";
-		}
+			os << "]";
 
-		os << "]" << std::endl;
+			break;
 
-		break;
+		case FORMAT_MAPLE:
+			F.init (zero, 0);
 
-	    case FORMAT_MAPLE:
-		F.init (zero, 0);
+			os << "[";
+			firstrow=true;
 
-		os << "[";
-                firstrow=true;
+			for (i = A._A.begin (), i_idx = 0; i != A._A.end (); ++i, ++i_idx) {
+				if (firstrow) {
+					os << "[";
+					firstrow =false;
+				}
+				else
+					os << ", [";
 
-		for (i = A._A.begin (), i_idx = 0; i != A._A.end (); ++i, ++i_idx) {
-			if (firstrow) {
-                            os << "[";
-                            firstrow =false;
-                        } else 
-                             os << ", [";
-                           
-			j = i->begin ();
+				j = i->begin ();
 
-			for (j_idx = 0; j_idx < A._n; j_idx++) {
-				if (j == i->end () || j_idx != j->first)
-					F.write (os, zero);
-				else {
-					F.write (os, j->second);
-					j++;
+				for (j_idx = 0; j_idx < A._n; j_idx++) {
+					if (j == i->end () || j_idx != j->first)
+						F.write (os, zero);
+					else {
+						F.write (os, j->second);
+						j++;
+					}
+
+					if (j_idx < A._n - 1)
+						os << ", ";
 				}
 
-				if (j_idx < A._n - 1)
-					os << ", ";
+				os << " ]";
 			}
 
-			os << " ]";
-		}
+			os << "]";
 
-		os << "]" << std::endl;
+			break;
 
-		break;
+		case FORMAT_PRETTY:
+			//F.characteristic (c);
+			//col_width = (int) ceil (log ((double) c) / M_LN10);
+			F.init (zero, 0);
 
-	    case FORMAT_PRETTY:
-		//F.characteristic (c);
-		//col_width = (int) ceil (log ((double) c) / M_LN10);
-		F.init (zero, 0);
+			for (i = A._A.begin (), i_idx = 0; i != A._A.end (); i++, i_idx++) {
+				os << "  [ ";
 
-		for (i = A._A.begin (), i_idx = 0; i != A._A.end (); i++, i_idx++) {
-			os << "  [ ";
+				j = i->begin ();
 
-			j = i->begin ();
+				for (j_idx = 0; j_idx < A._n; j_idx++) {
+					//os.width (col_width);
 
-			for (j_idx = 0; j_idx < A._n; j_idx++) {
-				//os.width (col_width);
+					if (j == i->end () || j_idx != j->first)
+						F.write (os, zero);
+					else {
+						F.write (os, j->second);
+						j++;
+					}
 
-				if (j == i->end () || j_idx != j->first)
-					F.write (os, zero);
-				else {
-					F.write (os, j->second);
-					j++;
+					os << ' ';
 				}
 
-				os << ' ';
+				os << ']' << std::endl;
 			}
 
-			os << ']' << std::endl;
-		}
-
-		break;
-
-	    case FORMAT_MAGMACPT: 
-		os << "sparse matrix written in MagmaCpt form is not implemented" << std::endl;
-		break;
-	}
+			break;
 
-	return os;
-}
+		case FORMAT_MAGMACPT:
+			os << "sparse matrix written in MagmaCpt form is not implemented" << std::endl;
+			break;
+		}
 
-template <class Element, class Row>
-template <class Field>
-std::ostream &SparseMatrixWriteHelper<Element, Row, VectorCategories::SparseParallelVectorTag >
-	::write (const SparseMatrixBase<Element, Row> &A, std::ostream &os, const Field &F, 
-		FileFormatTag format)
-{
-	typename SparseMatrixBase<Element, Row>::Rep::const_iterator i;
-	typename Row::first_type::const_iterator j_idx;
-	typename Row::second_type::const_iterator j_elt;
-	typename Field::Element zero;
-	size_t i_idx, j_idx_1, col_idx;
-	//int col_width;
-	integer c;
-        bool firstrow;
-        
-	// Avoid massive unneeded overhead in the case that this
-	// printing is disabled
-	if (commentator.isNullStream (os))
 		return os;
+	}
 
-	switch (format) {
-	    case FORMAT_DETECT:
-		throw PreconditionFailed (__FUNCTION__, __LINE__, "format != FORMAT_DETECT");
-		break;
-
-	    case FORMAT_TURNER:
-		for (i = A._A.begin (), i_idx = 0; i != A._A.end (); i++, i_idx++) {
-			for (j_idx = i->first.begin (), j_elt = i->second.begin ();
-			     j_idx != i->first.end ();
-			     ++j_idx, ++j_elt)
-			{
-				os << i_idx << ' ' << *j_idx << ' ';
-				F.write (os, *j_elt);
-				os << std::endl;
+	template <class Element, class Row>
+	template <class Field>
+	std::ostream &SparseMatrixWriteHelper<Element, Row, VectorCategories::SparseParallelVectorTag > ::write (const SparseMatrixBase<Element, Row> &A, std::ostream &os, const Field &F,
+														 FileFormatTag format)
+	{
+		typename SparseMatrixBase<Element, Row>::Rep::const_iterator i;
+		typename Row::first_type::const_iterator j_idx;
+		typename Row::second_type::const_iterator j_elt;
+		typename Field::Element zero;
+		size_t i_idx, j_idx_1, col_idx;
+		//int col_width;
+		integer c;
+		bool firstrow;
+
+		// Avoid massive unneeded overhead in the case that this
+		// printing is disabled
+		if (commentator.isNullStream (os))
+			return os;
+
+		switch (format) {
+		case FORMAT_DETECT:
+			throw PreconditionFailed (__func__, __LINE__, "format != FORMAT_DETECT");
+			//break//BB: unreachable;
+
+		case FORMAT_TURNER:
+			for (i = A._A.begin (), i_idx = 0; i != A._A.end (); i++, i_idx++) {
+				for (j_idx = i->first.begin (), j_elt = i->second.begin ();
+				     j_idx != i->first.end ();
+				     ++j_idx, ++j_elt)
+				{
+					os << i_idx << ' ' << *j_idx << ' ';
+					F.write (os, *j_elt);
+					os << std::endl;
+				}
 			}
-		}
 
-		break;
+			break;
 
-	    case FORMAT_ONE_BASED:
-		for (i = A._A.begin (), i_idx = 0; i != A._A.end (); i++, i_idx++) {
-			for (j_idx = i->first.begin (), j_elt = i->second.begin ();
-			     j_idx != i->first.end ();
-			     ++j_idx, ++j_elt)
-			{
-				os << i_idx + 1 << ' ' << *j_idx + 1 << ' ';
-				F.write (os, *j_elt);
-				os << std::endl;
+		case FORMAT_ONE_BASED:
+			for (i = A._A.begin (), i_idx = 0; i != A._A.end (); i++, i_idx++) {
+				for (j_idx = i->first.begin (), j_elt = i->second.begin ();
+				     j_idx != i->first.end ();
+				     ++j_idx, ++j_elt)
+				{
+					os << i_idx + 1 << ' ' << *j_idx + 1 << ' ';
+					F.write (os, *j_elt);
+					os << std::endl;
+				}
 			}
-		}
 
-		break;
+			break;
 
-	    case FORMAT_GUILLAUME:
-		os << A._m << ' ' << A._n << " M" << std::endl;
+		case FORMAT_GUILLAUME:
+			os << A._m << ' ' << A._n << " M" << std::endl;
 
-		for (i = A._A.begin (), i_idx = 0; i != A._A.end (); i++, i_idx++) {
-			for (j_idx = i->first.begin (), j_elt = i->second.begin ();
-			     j_idx != i->first.end ();
-			     ++j_idx, ++j_elt)
-			{
-				os << i_idx + 1 << ' ' << *j_idx + 1 << ' ';
-				F.write (os, *j_elt);
-				os << std::endl;
+			for (i = A._A.begin (), i_idx = 0; i != A._A.end (); i++, i_idx++) {
+				for (j_idx = i->first.begin (), j_elt = i->second.begin ();
+				     j_idx != i->first.end ();
+				     ++j_idx, ++j_elt)
+				{
+					os << i_idx + 1 << ' ' << *j_idx + 1 << ' ';
+					F.write (os, *j_elt);
+					os << std::endl;
+				}
 			}
-		}
 
-		os << "0 0 0" << std::endl;
+			os << "0 0 0" << std::endl;
 
-		break;
+			break;
 
-	    case FORMAT_MAPLE:
-		F.init (zero, 0);
-                firstrow=true;
+		case FORMAT_MAPLE:
+			F.init (zero, 0);
+			firstrow=true;
 
-		os << "[";
+			os << "[";
 
-		for (i = A._A.begin (), i_idx = 0; i != A._A.end (); i++, i_idx++) {
-			if (firstrow) {
-                            os << "[";
-                            firstrow =false;
-                        } else 
-                             os << ", [";
-                           
-			j_idx = i->first.begin ();
-			j_elt = i->second.begin ();
-
-			for (j_idx_1 = 0; j_idx_1 < A._n; j_idx_1++) {
-				if (j_idx == i->first.end () || j_idx_1 != *j_idx)
-					F.write (os, zero);
-				else {
-					F.write (os, *j_elt);
-					++j_idx;
-					++j_elt;
+			for (i = A._A.begin (), i_idx = 0; i != A._A.end (); i++, i_idx++) {
+				if (firstrow) {
+					os << "[";
+					firstrow =false;
+				}
+				else
+					os << ", [";
+
+				j_idx = i->first.begin ();
+				j_elt = i->second.begin ();
+
+				for (j_idx_1 = 0; j_idx_1 < A._n; j_idx_1++) {
+					if (j_idx == i->first.end () || j_idx_1 != *j_idx)
+						F.write (os, zero);
+					else {
+						F.write (os, *j_elt);
+						++j_idx;
+						++j_elt;
+					}
+
+					if (j_idx_1 < A._n - 1)
+						os << ", ";
 				}
 
-				if (j_idx_1 < A._n - 1)
-					os << ", ";
+				os << "]";
 			}
 
 			os << "]";
-		}
 
-		os << "]" << std::endl;
+			break;
 
-		break;
+		case FORMAT_MATLAB:
+			F.init (zero, 0);
 
-	    case FORMAT_MATLAB:
-		F.init (zero, 0);
+			os << "[";
 
-		os << "[";
+			for (i = A._A.begin (), i_idx = 0; i != A._A.end (); i++, i_idx++) {
+				j_idx = i->first.begin ();
+				j_elt = i->second.begin ();
 
-		for (i = A._A.begin (), i_idx = 0; i != A._A.end (); i++, i_idx++) {
-			j_idx = i->first.begin ();
-			j_elt = i->second.begin ();
+				for (j_idx_1 = 0; j_idx_1 < A._n; j_idx_1++) {
+					if (j_idx == i->first.end () || j_idx_1 != *j_idx)
+						F.write (os, zero);
+					else {
+						F.write (os, *j_elt);
+						++j_idx;
+						++j_elt;
+					}
 
-			for (j_idx_1 = 0; j_idx_1 < A._n; j_idx_1++) {
-				if (j_idx == i->first.end () || j_idx_1 != *j_idx)
-					F.write (os, zero);
-				else {
-					F.write (os, *j_elt);
-					++j_idx;
-					++j_elt;
+					if (j_idx_1 < A._n - 1)
+						os << ", ";
 				}
 
-				if (j_idx_1 < A._n - 1)
-					os << ", ";
+				os << "; ";
 			}
 
-			os << "; ";
-		}
+			os << "]";
 
-		os << "]" << std::endl;
+			break;
 
-		break;
+		case FORMAT_PRETTY:
+			//F.characteristic (c);
+			//col_width = (int) ceil (log ((double) c) / M_LN10);
+			F.init (zero, 0);
 
-	    case FORMAT_PRETTY:
-		//F.characteristic (c);
-		//col_width = (int) ceil (log ((double) c) / M_LN10);
-		F.init (zero, 0);
+			for (i = A._A.begin (), i_idx = 0; i != A._A.end (); i++, i_idx++) {
+				os << "  [ ";
 
-		for (i = A._A.begin (), i_idx = 0; i != A._A.end (); i++, i_idx++) {
-			os << "  [ ";
+				j_idx = i->first.begin ();
+				j_elt = i->second.begin ();
 
-			j_idx = i->first.begin ();
-			j_elt = i->second.begin ();
+				for (col_idx = 0; col_idx < A._n; col_idx++) {
+					//os.width (col_width);
 
-			for (col_idx = 0; col_idx < A._n; col_idx++) {
-				//os.width (col_width);
+					if (j_idx == i->first.end () || col_idx != *j_idx)
+						F.write (os, zero);
+					else {
+						F.write (os, *j_elt);
+						++j_idx; ++j_elt;
+					}
 
-				if (j_idx == i->first.end () || col_idx != *j_idx)
-					F.write (os, zero);
-				else {
-					F.write (os, *j_elt);
-					++j_idx; ++j_elt;
+					os << ' ';
 				}
 
-				os << ' ';
+				os << ']';
 			}
 
-			os << ']' << std::endl;
+			break;
+		case FORMAT_MAGMACPT:
+			os << "sparse matrix written in MagmaCpt form is not implemented" << std::endl;
+			break;
 		}
 
-		break;
-	    case FORMAT_MAGMACPT:
-		os << "sparse matrix written in MagmaCpt form is not implemented" << std::endl;
-		break;
+		return os;
 	}
 
-	return os;
-}
-
-template <class Element, class Row, class Tag>
-template <class Field>
-SparseMatrixBase<Element,Row,Tag>
-	::SparseMatrixBase( MatrixStream<Field>& ms )
-	:_A(0), _m(0), _n(0)
-{
-	Element val;
-	size_t i, j;
-	while( ms.nextTriple(i,j,val) ) {
-		if( i >= _m ) {
-			_m = i + 1;
-			_A.resize( _m );
+	template <class Element, class Row, class Tag>
+	template <class Field>
+	SparseMatrixBase<Element,Row,Tag> ::SparseMatrixBase( MatrixStream<Field>& ms ) :
+		_A(0), _m(0), _n(0)
+	{
+		Element val;
+		size_t i, j;
+		while( ms.nextTriple(i,j,val) ) {
+			if( i >= _m ) {
+				_m = i + 1;
+				_A.resize( _m );
+			}
+			if( j >= _n ) _n = j + 1;
+			setEntry(i,j,val);
+		}
+		if( ms.getError() > END_OF_MATRIX )
+			throw ms.reportError(__func__,__LINE__);
+		if( !ms.getDimensions( i, _n ) )
+			throw ms.reportError(__func__,__LINE__);
+		if( i > _m ) {
+			_m = i;
+			_A.resize(_m);
 		}
-		if( j >= _n ) _n = j + 1;
-		setEntry(i,j,val);
-	}
-	if( ms.getError() > END_OF_MATRIX )
-		throw ms.reportError(__FUNCTION__,__LINE__);
-	if( !ms.getDimensions( i, _n ) )
-		throw ms.reportError(__FUNCTION__,__LINE__);
-	if( i > _m ) {
-		_m = i;
-		_A.resize(_m);
 	}
-}
 
-template <class Element, class Row>
-template <class Field>
-SparseMatrixBase<Element,Row,VectorCategories::SparseSequenceVectorTag>
-	::SparseMatrixBase( MatrixStream<Field>& ms )
-	:_A(0), _m(0), _n(0)
-{
-	Element val;
-	size_t i, j;
-	while( ms.nextTriple(i,j,val) ) {
-		if( i >= _m ) {
-			_m = i + 1;
-			_A.resize( _m );
+	template <class Element, class Row>
+	template <class Field>
+	SparseMatrixBase<Element,Row,VectorCategories::SparseSequenceVectorTag> ::SparseMatrixBase( MatrixStream<Field>& ms ) :
+		_A(0), _m(0), _n(0)
+	{
+		Element val;
+		size_t i, j;
+		while( ms.nextTriple(i,j,val) ) {
+			if( i >= _m ) {
+				_m = i + 1;
+				_A.resize( _m );
+			}
+			if( j >= _n ) _n = j + 1;
+			setEntry(i,j,val);
+		}
+		if( ms.getError() > END_OF_MATRIX )
+			throw ms.reportError(__func__,__LINE__);
+		if( !ms.getDimensions( i, _n ) )
+			throw ms.reportError(__func__,__LINE__);
+		if( i > _m ) {
+			_m = i;
+			_A.resize(_m);
 		}
-		if( j >= _n ) _n = j + 1;
-		setEntry(i,j,val);
-	}
-	if( ms.getError() > END_OF_MATRIX )
-		throw ms.reportError(__FUNCTION__,__LINE__);
-	if( !ms.getDimensions( i, _n ) )
-		throw ms.reportError(__FUNCTION__,__LINE__);
-	if( i > _m ) {
-		_m = i;
-		_A.resize(_m);
 	}
-}
 
-template <class Element, class Row>
-template <class Field>
-SparseMatrixBase<Element,Row,VectorCategories::SparseAssociativeVectorTag>
-	::SparseMatrixBase( MatrixStream<Field>& ms )
-	:_A(0), _m(0), _n(0)
-{
-	Element val;
-	size_t i, j;
-	while( ms.nextTriple(i,j,val) ) {
-		if( i >= _m ) {
-			_m = i + 1;
-			_A.resize( _m );
+	template <class Element, class Row>
+	template <class Field>
+	SparseMatrixBase<Element,Row,VectorCategories::SparseAssociativeVectorTag> ::SparseMatrixBase( MatrixStream<Field>& ms ) :
+		_A(0), _m(0), _n(0)
+	{
+		Element val;
+		size_t i, j;
+		while( ms.nextTriple(i,j,val) ) {
+			if( i >= _m ) {
+				_m = i + 1;
+				_A.resize( _m );
+			}
+			if( j >= _n ) _n = j + 1;
+			setEntry(i,j,val);
+		}
+		if( ms.getError() > END_OF_MATRIX )
+			throw ms.reportError(__func__,__LINE__);
+		if( !ms.getDimensions( i, _n ) )
+			throw ms.reportError(__func__,__LINE__);
+		if( i > _m ) {
+			_m = i;
+			_A.resize(_m);
 		}
-		if( j >= _n ) _n = j + 1;
-		setEntry(i,j,val);
-	}
-	if( ms.getError() > END_OF_MATRIX )
-		throw ms.reportError(__FUNCTION__,__LINE__);
-	if( !ms.getDimensions( i, _n ) )
-		throw ms.reportError(__FUNCTION__,__LINE__);
-	if( i > _m ) {
-		_m = i;
-		_A.resize(_m);
 	}
-}
 
-template <class Element, class Row>
-template <class Field>
-SparseMatrixBase<Element,Row,VectorCategories::SparseParallelVectorTag>
-	::SparseMatrixBase( MatrixStream<Field>& ms )
-	:_A(0), _m(0), _n(0)
-{
-	Element val;
-	size_t i, j;
-	while( ms.nextTriple(i,j,val) ) {
-		if( i >= _m ) {
-			_m = i + 1;
-			_A.resize( _m );
+	template <class Element, class Row>
+	template <class Field>
+	SparseMatrixBase<Element,Row,VectorCategories::SparseParallelVectorTag> ::SparseMatrixBase( MatrixStream<Field>& ms ) :
+		_A(0), _m(0), _n(0)
+	{
+		Element val;
+		size_t i, j;
+		while( ms.nextTriple(i,j,val) ) {
+			if( i >= _m ) {
+				_m = i + 1;
+				_A.resize( _m );
+			}
+			if( j >= _n ) _n = j + 1;
+			setEntry(i,j,val);
+		}
+		if( ms.getError() > END_OF_MATRIX )
+			throw ms.reportError(__func__,__LINE__);
+		if( !ms.getDimensions( i, _n ) )
+			throw ms.reportError(__func__,__LINE__);
+		if( i > _m ) {
+			_m = i;
+			_A.resize(_m);
 		}
-		if( j >= _n ) _n = j + 1;
-		setEntry(i,j,val);
 	}
-	if( ms.getError() > END_OF_MATRIX )
-		throw ms.reportError(__FUNCTION__,__LINE__);
-	if( !ms.getDimensions( i, _n ) )
-		throw ms.reportError(__FUNCTION__,__LINE__);
-	if( i > _m ) {
-		_m = i;
-		_A.resize(_m);
+
+	template <class Element, class Row>
+	void SparseMatrixBase<Element, Row, VectorCategories::SparseSequenceVectorTag > ::setEntry (size_t i, size_t j, const Element &value)
+	{
+		typedef typename Row::value_type value_type;
+		Row &v = _A[i];
+		typename Row::iterator iter;
+
+		if (v.size () == 0) {
+			v.push_back ( value_type(j, value));
+		}
+		else {
+			iter = std::lower_bound (v.begin (), v.end (), j, VectorWrapper::CompareSparseEntries<Element> ());
+
+			if (iter == v.end () || iter->first != j)
+				iter = v.insert (iter, value_type(j, value));
+			else
+				iter->second = value;
+		}
 	}
-}
 
-template <class Element, class Row>
-void SparseMatrixBase<Element, Row, VectorCategories::SparseSequenceVectorTag >
-	::setEntry (size_t i, size_t j, const Element &value) 
-{
-	Row &v = _A[i];
-	typename Row::iterator iter;
-
-	if (v.size () == 0) {
-		v.push_back (std::pair <size_t, Element> (j, value));                
-	} else {
-		iter = std::lower_bound (v.begin (), v.end (), j, VectorWrapper::CompareSparseEntries<Element> ());
-
-		if (iter == v.end () || iter->first != j)
-			iter = v.insert (iter, std::pair <size_t, Element> (j, value));
-                else
-                    	iter->second = value;
- 	}
-}
-
-template <class Element, class Row>
-Element &SparseMatrixBase<Element, Row, VectorCategories::SparseSequenceVectorTag >
-	::refEntry (size_t i, size_t j) 
-{
-	static Element zero;
+	template <class Element, class Row>
+	Element &SparseMatrixBase<Element, Row, VectorCategories::SparseSequenceVectorTag > ::refEntry (size_t i, size_t j)
+	{
+		static Element zero;
 
-	Row &v = _A[i];
-	typename Row::iterator iter;
+		Row &v = _A[i];
+		typename Row::iterator iter;
 
-	if (v.size () == 0) {
-		v.push_back (std::pair <size_t, Element> (j, zero));
-		return v.front ().second;
-	} else {
-		iter = std::lower_bound (v.begin (), v.end (), j, VectorWrapper::CompareSparseEntries<Element> ());
+		if (v.size () == 0) {
+			v.push_back (std::pair <size_t, Element> (j, zero));
+			return v.front ().second;
+		}
+		else {
+			iter = std::lower_bound (v.begin (), v.end (), j, VectorWrapper::CompareSparseEntries<Element> ());
 
-		if (iter == v.end () || iter->first != j)
-			iter = v.insert (iter, std::pair <size_t, Element> (j, zero));
+			if (iter == v.end () || iter->first != j)
+				iter = v.insert (iter, std::pair <size_t, Element> (j, zero));
 
-		return iter->second;
+			return iter->second;
+		}
 	}
-}
 
-template <class Element, class Row>
-const Element &SparseMatrixBase<Element, Row, VectorCategories::SparseSequenceVectorTag >
-	::getEntry (size_t i, size_t j) const
-{
-	static Element zero;
-
-	const Row &v = _A[i];
-	typename Row::const_iterator iter;
+	template <class Element, class Row>
+	const Element &SparseMatrixBase<Element, Row, VectorCategories::SparseSequenceVectorTag > ::getEntry (size_t i, size_t j) const
+	{
+		static Element zero;
 
-	if (v.size () == 0)
-		return zero;
-	else {
-		iter = std::lower_bound (v.begin (), v.end (), j, VectorWrapper::CompareSparseEntries<Element> ());
+		const Row &v = _A[i];
+		typename Row::const_iterator iter;
 
-		if (iter == v.end () || iter->first != j)
+		if (v.size () == 0)
 			return zero;
-		else
-			return iter->second;
-	}
-}
+		else {
+			iter = std::lower_bound (v.begin (), v.end (), j, VectorWrapper::CompareSparseEntries<Element> ());
 
-template <class Element, class Row>
-const Element &SparseMatrixBase<Element, Row, VectorCategories::SparseAssociativeVectorTag >
-	::getEntry (size_t i, size_t j) const
-{
-	static Element zero;
+			if (iter == v.end () || iter->first != j)
+				return zero;
+			else
+				return iter->second;
+		}
+	}
 
-	const Row &v = _A[i];
-	typename Row::const_iterator iter;
+	template <class Element, class Row>
+	const Element &SparseMatrixBase<Element, Row, VectorCategories::SparseAssociativeVectorTag > ::getEntry (size_t i, size_t j) const
+	{
+		static Element zero;
 
-	if (v.size () == 0)
-		return zero;
-	else {
-		iter = v.find (j);
+		const Row &v = _A[i];
+		typename Row::const_iterator iter;
 
-		if (iter == v.end () || iter->first != j)
+		if (v.size () == 0)
 			return zero;
-		else
-			return iter->second;
-	}
-}
+		else {
+			iter = v.find (j);
 
-template <class Element, class Row>
-void SparseMatrixBase<Element, Row, VectorCategories::SparseParallelVectorTag >
-	::setEntry (size_t i, size_t j, const Element &value) 
-{
-	while (_A.size() < i + 1) _A.push_back(Row());
-	_m = _A.size(); 
-
-	Row &v = _A[i];
-	typename Row::first_type::iterator iter;
-
-	if (v.first.size () == 0) {
-		v.first.push_back (j);
-		v.second.push_back (value);
-	} else {
-		iter = std::lower_bound (v.first.begin (), v.first.end (), j);
-
-		if (iter == v.first.end () || *iter != j) {
-			iter = v.first.insert (iter, j);
-			v.second.insert (v.second.begin () + (iter - v.first.begin ()), value);
-		} else
-                    	*(v.second.begin () + (iter - v.first.begin ())) = value;
+			if (iter == v.end () || iter->first != j)
+				return zero;
+			else
+				return iter->second;
+		}
 	}
-}
 
-template <class Element, class Row>
-Element &SparseMatrixBase<Element, Row, VectorCategories::SparseParallelVectorTag >
-	::refEntry (size_t i, size_t j) 
-{
-	static Element zero;
-
-	Row &v = _A[i];
-	typename Row::first_type::iterator iter;
-	typename Row::second_type::iterator iter_elt;
-
-	if (v.first.size () == 0) {
-		v.first.push_back (j);
-		v.second.push_back (zero);
-		return v.second.front ();
-	} else {
-		iter = std::lower_bound (v.first.begin (), v.first.end (), j);
-
-		if (iter == v.first.end () || *iter != j) {
-			iter = v.first.insert (iter, j);
-			iter_elt = v.second.insert (v.second.begin () + (iter - v.first.begin ()), zero);
+	template <class Element, class Row>
+	void SparseMatrixBase<Element, Row, VectorCategories::SparseParallelVectorTag > ::setEntry (size_t i, size_t j, const Element &value)
+	{
+		while (_A.size() < i + 1) _A.push_back(Row());
+		_m = _A.size();
+
+		Row &v = _A[i];
+		typename Row::first_type::iterator iter;
+
+		if (v.first.size () == 0) {
+			v.first.push_back (j);
+			v.second.push_back (value);
 		}
-		else
-			iter_elt = v.second.begin () + (iter - v.first.begin ());
+		else {
+			iter = std::lower_bound (v.first.begin (), v.first.end (), j);
 
-		return *iter_elt;
+			if (iter == v.first.end () || *iter != j) {
+				iter = v.first.insert (iter, j);
+				v.second.insert (v.second.begin () + (iter - v.first.begin ()), value);
+			}
+			else
+				*(v.second.begin () + (iter - v.first.begin ())) = value;
+		}
 	}
-}
 
-template <class Element, class Row>
-const Element &SparseMatrixBase<Element, Row, VectorCategories::SparseParallelVectorTag >
-	::getEntry (size_t i, size_t j) const
-{
-	static Element zero;
+	template <class Element, class Row>
+	Element &SparseMatrixBase<Element, Row, VectorCategories::SparseParallelVectorTag > ::refEntry (size_t i, size_t j)
+	{
+		static Element zero;
 
-	const Row &v = _A[i];
-	typename Row::first_type::const_iterator iter;
+		Row &v = _A[i];
+		typename Row::first_type::iterator iter;
+		typename Row::second_type::iterator iter_elt;
 
-	if (v.first.size () == 0)
-		return zero;
-	else {
-		iter = std::lower_bound (v.first.begin (), v.first.end (), j);
+		if (v.first.size () == 0) {
+			v.first.push_back (j);
+			v.second.push_back (zero);
+			return v.second.front ();
+		}
+		else {
+			iter = std::lower_bound (v.first.begin (), v.first.end (), j);
 
-		if (iter == v.first.end () || *iter != j)
-			return zero;
-		else
-			return *(v.second.begin () + (iter - v.first.begin ()));
+			if (iter == v.first.end () || *iter != j) {
+				iter = v.first.insert (iter, j);
+				iter_elt = v.second.insert (v.second.begin () + (iter - v.first.begin ()), zero);
+			}
+			else
+				iter_elt = v.second.begin () + (iter - v.first.begin ());
+
+			return *iter_elt;
+		}
 	}
-}
 
-template <class Element, class Row>
-template <class Vector>
-Vector &SparseMatrixBase<Element, Row, VectorCategories::SparseSequenceVectorTag >::columnDensity (Vector &v) const
-{
-	unsigned int row = 0;
+	template <class Element, class Row>
+	const Element &SparseMatrixBase<Element, Row, VectorCategories::SparseParallelVectorTag > ::getEntry (size_t i, size_t j) const
+	{
+		static Element zero;
+
+		const Row &v = _A[i];
+		typename Row::first_type::const_iterator iter;
 
-	for (ConstRowIterator i = rowBegin (); i != rowEnd (); ++i, ++row) {
-		typename Row::const_iterator j = i.begin ();
+		if (v.first.size () == 0)
+			return zero;
+		else {
+			iter = std::lower_bound (v.first.begin (), v.first.end (), j);
 
-		for (; j != i->begin (); ++j)
-			++v[j->first];
+			if (iter == v.first.end () || *iter != j)
+				return zero;
+			else
+				return *(v.second.begin () + (iter - v.first.begin ()));
+		}
 	}
 
-	return v;
-}
+	template <class Element, class Row>
+	template <class Vector>
+	Vector &SparseMatrixBase<Element, Row, VectorCategories::SparseSequenceVectorTag >::columnDensity (Vector &v) const
+	{
+		unsigned int row = 0;
 
-template <class Element, class Row>
-template <class Vector>
-Vector &SparseMatrixBase<Element, Row, VectorCategories::SparseParallelVectorTag >::columnDensity (Vector &v) const
-{
-	unsigned int row = 0;
+		for (ConstRowIterator i = rowBegin (); i != rowEnd (); ++i, ++row) {
+			typename Row::const_iterator j = i.begin ();
 
-	for (ConstRowIterator i = rowBegin (); i != rowEnd (); ++i, ++row) {
-		typename Row::first_type::const_iterator j_idx = i->first.begin ();
+			for (; j != i->begin (); ++j)
+				++v[j->first];
+		}
 
-		for (; j_idx != i->first.end (); ++j_idx)
-			++v[*j_idx];
+		return v;
 	}
 
-	return v;
-}
+	template <class Element, class Row>
+	template <class Vector>
+	Vector &SparseMatrixBase<Element, Row, VectorCategories::SparseParallelVectorTag >::columnDensity (Vector &v) const
+	{
+		unsigned int row = 0;
 
-template <class Element, class Row>
-template <class Vector>
-Vector &SparseMatrixBase<Element, Row, VectorCategories::SparseAssociativeVectorTag >::columnDensity (Vector &v) const
-{
-	unsigned int row = 0;
+		for (ConstRowIterator i = rowBegin (); i != rowEnd (); ++i, ++row) {
+			typename Row::first_type::const_iterator j_idx = i->first.begin ();
 
-	for (ConstRowIterator i = rowBegin (); i != rowEnd (); ++i, ++row) {
-		typename Row::const_iterator j = i.begin ();
+			for (; j_idx != i->first.end (); ++j_idx)
+				++v[*j_idx];
+		}
 
-		for (; j != i->begin (); ++j)
-			++v[j->first];
+		return v;
 	}
 
-	return v;
-}
+	template <class Element, class Row>
+	template <class Vector>
+	Vector &SparseMatrixBase<Element, Row, VectorCategories::SparseAssociativeVectorTag >::columnDensity (Vector &v) const
+	{
+		unsigned int row = 0;
 
-template <class Element, class Row>
-SparseMatrixBase<Element, Row, VectorCategories::SparseSequenceVectorTag >
-	&SparseMatrixBase<Element, Row, VectorCategories::SparseSequenceVectorTag >::transpose (SparseMatrixBase &AT) const
-{
-	unsigned int row = 0;
+		for (ConstRowIterator i = rowBegin (); i != rowEnd (); ++i, ++row) {
+			typename Row::const_iterator j = i.begin ();
 
-	for (ConstRowIterator i = rowBegin (); i != rowEnd (); ++i, ++row) {
-		typename Row::const_iterator j = i.begin ();
+			for (; j != i->begin (); ++j)
+				++v[j->first];
+		}
 
-		for (; j != i->begin (); ++j)
-			AT._A[j->first].push_back (std::pair<size_t, Element> (row, j->second));
+		return v;
 	}
 
-	return AT;
-}
+	template <class Element, class Row>
+	SparseMatrixBase<Element, Row, VectorCategories::SparseSequenceVectorTag >
+	&SparseMatrixBase<Element, Row, VectorCategories::SparseSequenceVectorTag >::transpose (SparseMatrixBase &AT) const
+	{
+		unsigned int row = 0;
 
-template <class Element, class Row>
-SparseMatrixBase<Element, Row, VectorCategories::SparseAssociativeVectorTag >
-	&SparseMatrixBase<Element, Row, VectorCategories::SparseAssociativeVectorTag >::transpose (SparseMatrixBase &AT) const
-{
-	unsigned int row = 0;
+		for (ConstRowIterator i = rowBegin (); i != rowEnd (); ++i, ++row) {
+			typename Row::const_iterator j = i.begin ();
 
-	for (ConstRowIterator i = rowBegin (); i != rowEnd (); ++i, ++row) {
-		typename Row::const_iterator j = i.begin ();
+			for (; j != i->begin (); ++j)
+				AT._A[j->first].push_back (std::pair<size_t, Element> (row, j->second));
+		}
 
-		for (; j != i->begin (); ++j)
-			AT._A[j->first][row] = j->second;
+		return AT;
 	}
 
-	return AT;
-}
+	template <class Element, class Row>
+	SparseMatrixBase<Element, Row, VectorCategories::SparseAssociativeVectorTag >
+	&SparseMatrixBase<Element, Row, VectorCategories::SparseAssociativeVectorTag >::transpose (SparseMatrixBase &AT) const
+	{
+		unsigned int row = 0;
+
+		for (ConstRowIterator i = rowBegin (); i != rowEnd (); ++i, ++row) {
+			typename Row::const_iterator j = i.begin ();
+
+			for (; j != i->begin (); ++j)
+				AT._A[j->first][row] = j->second;
+		}
+
+		return AT;
+	}
 
-template <class Element, class Row>
-SparseMatrixBase<Element, Row, VectorCategories::SparseParallelVectorTag >
+	template <class Element, class Row>
+	SparseMatrixBase<Element, Row, VectorCategories::SparseParallelVectorTag >
 	&SparseMatrixBase<Element, Row, VectorCategories::SparseParallelVectorTag >::transpose (SparseMatrixBase &AT) const
-{
-	unsigned int row = 0;
+	{
+		unsigned int row = 0;
 
-	for (ConstRowIterator i = rowBegin (); i != rowEnd (); ++i, ++row) {
-		typename Row::first_type::const_iterator j_idx = i->first.begin ();
-		typename Row::second_type::const_iterator j_elt = i->second.begin ();
+		for (ConstRowIterator i = rowBegin (); i != rowEnd (); ++i, ++row) {
+			typename Row::first_type::const_iterator j_idx = i->first.begin ();
+			typename Row::second_type::const_iterator j_elt = i->second.begin ();
 
-		for (; j_idx != i->first.end (); ++j_idx, ++j_elt) {
-			AT._A[*j_idx].first.push_back (row);
-			AT._A[*j_idx].second.push_back (*j_elt);
+			for (; j_idx != i->first.end (); ++j_idx, ++j_elt) {
+				AT._A[*j_idx].first.push_back (row);
+				AT._A[*j_idx].second.push_back (*j_elt);
+			}
 		}
-	}
 
-	return AT;
-}
+		return AT;
+	}
 
 } // namespace LinBox
 
-#endif // __MATRIX_SPARSE_INL
+#endif // __LINBOX_matrix_sparse_INL
+
diff --git a/linbox/matrix/transpose-matrix.h b/linbox/matrix/transpose-matrix.h
index 48d4371..13f2b82 100644
--- a/linbox/matrix/transpose-matrix.h
+++ b/linbox/matrix/transpose-matrix.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/matrix/transpose.h
  * Copyright (C) 2002 Bradford Hovinen,
  *
@@ -16,8 +16,8 @@
  * See COPYING for license information
  */
 
-#ifndef __MATRIX_TRANSPOSE_H
-#define __MATRIX_TRANSPOSE_H
+#ifndef __LINBOX_matrix_transpose_INL
+#define __LINBOX_matrix_transpose_INL
 
 #include <iostream>
 #include <vector>
@@ -33,400 +33,650 @@
 namespace LinBox
 {
 
-/** Matrix transpose
- * 
- * This class takes a matrix meeting the @ref{DenseMatrixBase} archetype and
- * switches the row and column iterators, giving the transpose of the original
- * matrix. It is generic with respect to the matrix given.
- * 
- * If the matrix given has limited iterators, then its transpose will have
- * limited iterators as well. In particular, if the matrix given has only row
- * iterators, then the transpose object will have only column iterators, and
- * vice versa.
- * 
- * This class differs from @ref{Transpose} in that it constructs a full matrix
- * representation, with row and/or column iterators. It does not include any
- * logic for matrix-vector products, and does not meet the
- * @ref{BlackboxArchetype} interface. Nor does it make such assumptions about
- * the matrix given.
- *
- * This class gives a constant matrix as output. It provides no iterators for
- * modification of the data in the matrix.
- * 
- * The input/output functionality of this class passes requests directly through
- * to the underlying matrix. In particular, the output will be the transpose of
- * the matrix expected and the input will expect the transpose of the matrix
- * given. Thus, it is not recommended to use TransposeMatrix for reading and
- * writing matrices, except for testing purposes.
- */
-  
-template <class Matrix, class Trait = typename MatrixTraits<Matrix>::MatrixCategory>
-class TransposeMatrix
-{
-    public:
-
-	typedef typename Matrix::Element Element;
-
-	typedef typename Matrix::ColIterator RowIterator;
-	typedef typename Matrix::RowIterator ColIterator;
-	typedef typename Matrix::RawIterator RawIterator;
-	typedef typename Matrix::RawIndexedIterator RawIndexedIterator;
-	typedef typename Matrix::ConstColIterator ConstRowIterator;
-	typedef typename Matrix::ConstRowIterator ConstColIterator;
-	typedef typename Matrix::ConstRawIterator ConstRawIterator;
-	typedef typename Matrix::ConstRawIndexedIterator ConstRawIndexedIterator;
-
-	typedef typename Matrix::Row Column;
-	typedef typename Matrix::Row Col;
-	typedef typename Matrix::Col Row;
-
-	/** Constructor.
-	 * @param  A  Underlying matrix of which to construct the transpose
-	 */
-	TransposeMatrix (Matrix &A)
-		: _A (A)
-	{}
-
-	/** Copy constructor
-	 */
-	TransposeMatrix (const TransposeMatrix &M)
-		: _A (M._A)
-	{}
-
-	/** Get the number of rows in the matrix
-	 * @return Number of rows in matrix
-	 */
-	inline size_t rowdim () const
-		{ return _A.coldim (); }
-
-	/** Get the number of columns in the matrix
-	 * @return Number of columns in matrix
-	 */
-	inline size_t coldim () const
-		{ return _A.rowdim (); }
-
-	/** @name Matrix I/O
-	 */
-
-	//@{
-
-	/** Write a matrix to an output stream
-	 * @param stream Stream to which to write the matrix
-	 * @return Reference to stream
-	 */
-	template <class Field>
-	inline std::ostream &write (std::ostream &stream, const Field &F) const
-		{ return _A.write (stream, F); }
-
-	//@} Matrix I/O
-
-	/** @name Access to matrix elements
-	 */
-
-	//@{
-
-	/** Set the entry at the (i, j) position to a_ij.
-	 * @param i Row number, 0...rowdim () - 1
-	 * @param j Column number 0...coldim () - 1
-	 * @param a_ij Element to set
-	 */
-	void setEntry (size_t i, size_t j, const Element &a_ij)
-		{ _A.setEntry (j, i, a_ij); }
-
-	/** Get a writeable reference to the entry in the (i, j) position.
-	 * @param i Row index of entry
-	 * @param j Column index of entry
-	 * @return Reference to matrix entry
-	 */
-	Element &refEntry (size_t i, size_t j)
-		{ return _A.refEntry (j, i); }
-
-	/** Get a read-only reference to the entry in the (i, j) position.
-	 * @param i Row index
-	 * @param j Column index
-	 * @return Const reference to matrix entry
-	 */
-	inline const Element &getEntry (size_t i, size_t j) const
-		{ return _A.getEntry (j, i); }
-
-	/** Copy the (i, j) entry into x, and return a reference to x.
-	 * This form is more in the Linbox style and is provided for interface
-	 * compatibility with other parts of the library
-	 * @param x Element in which to store result
-	 * @param i Row index
-	 * @param j Column index
-	 * @return Reference to x
-	 */
-	inline Element &getEntry (Element &x, size_t i, size_t j) const
-		{ return _A.getEntry (x, j, i); }
-
-	/** @name Column of rows iterator
-	 * The column of rows iterator traverses the rows of the
-	 * matrix in ascending order. Dereferencing the iterator yields
-	 * a row vector in dense format
-	 */
-
-	inline RowIterator rowBegin () { return _A.colBegin (); }
-	inline RowIterator rowEnd () { return _A.colEnd (); }
-	inline ConstRowIterator rowBegin () const { return _A.colBegin (); }
-	inline ConstRowIterator rowEnd () const { return _A.colEnd (); }
-
-	/** @name Row of columns iterator
-	 * The row of columns iterator traverses the columns of the
-	 * matrix in ascending order. Dereferencing the iterator yields
-	 * a column vector in dense format
-	 */
-
-	inline ColIterator colBegin () { return _A.rowBegin (); }
-	inline ColIterator colEnd () { return _A.rowEnd (); }
-	inline ConstColIterator colBegin () const { return _A.rowBegin (); }
-	inline ConstColIterator colEnd () const { return _A.rowEnd (); }
-
-	/** @name Raw iterator
+	/** @brief Matrix transpose
 	 *
-	 * The raw iterator is a method for accessing all entries in the matrix
-	 * in some unspecified order. This can be used, e.g. to reduce all
-	 * matrix entries modulo a prime before passing the matrix into an
-	 * algorithm.
-	 */
-
-	inline RawIterator rawBegin () { return _A.rawBegin (); }
-	inline RawIterator rawEnd () { return _A.rawEnd (); }
-	inline ConstRawIterator rawBegin () const { return _A.rawBegin (); }
-	inline ConstRawIterator rawEnd () const { return _A.rawEnd (); }
-
-	/** @name Raw Indexed iterator
-	 * Like the raw iterator, the indexed iterator is a method for 
-	 * accessing all entries in the matrix in some unspecified order. 
-	 * At each position of the the indexed iterator, it also provides 
-	 * the row and column indices of the currently referenced entry.
-	 * This is provided through it's rowIndex() and colIndex() functions.
+	 * This class takes a matrix meeting the @ref DenseMatrixBase archetype
+	 * and switches the row and column iterators, giving the transpose of
+	 * the original matrix. It is generic with respect to the matrix given.
+	 *
+	 * If the matrix given has limited iterators, then its transpose will
+	 * have limited iterators as well. In particular, if the matrix given
+	 * has only row iterators, then the transpose object will have only
+	 * column iterators, and vice versa.
+	 *
+	 * This class differs from @ref Transpose in that it constructs a full
+	 * matrix representation, with row and/or column iterators. It does not
+	 * include any logic for matrix-vector products, and does not meet the
+	 * @ref BlackboxArchetype interface. Nor does it make such assumptions
+	 * about the matrix given.
+	 *
+	 * This class gives a constant matrix as output. It provides no
+	 * iterators for modification of the data in the matrix.
+	 *
+	 * The input/output functionality of this class passes requests
+	 * directly through to the underlying matrix. In particular, the output
+	 * will be the transpose of the matrix expected and the input will
+	 * expect the transpose of the matrix given. Thus, it is not
+	 * recommended to use TransposeMatrix for reading and writing matrices,
+	 * except for testing purposes.
 	 */
 
-	inline RawIndexedIterator rawIndexedBegin() { return _A.rawIndexedBegin (); }
-        inline RawIndexedIterator rawIndexedEnd() { return _A.rawIndexedEnd (); }
-	inline ConstRawIndexedIterator rawIndexedBegin() const { return _A.rawIndexedBegin (); }
-        inline ConstRawIndexedIterator rawIndexedEnd() const { return _A.rawIndexedEnd (); }
-
-	//@}
-
-    protected:
-
-	Matrix &_A;
-};
-
-// Specialization for matrices that have both row and column iterators
-
-template <class Matrix>
-class TransposeMatrix<Matrix, MatrixCategories::RowColMatrixTag>
-{
-    public:
-
-	typedef typename Matrix::Element Element;
-
-	typedef typename Matrix::ColIterator RowIterator;
-	typedef typename Matrix::RowIterator ColIterator;
-	typedef typename Matrix::RawIterator RawIterator;
-	typedef typename Matrix::RawIndexedIterator RawIndexedIterator;
-	typedef typename Matrix::ConstColIterator ConstRowIterator;
-	typedef typename Matrix::ConstRowIterator ConstColIterator;
-	typedef typename Matrix::ConstRawIterator ConstRawIterator;
-	typedef typename Matrix::ConstRawIndexedIterator ConstRawIndexedIterator;
-
-	typedef typename Matrix::Row Column;
-	typedef typename Matrix::Row Col;
-	typedef typename Matrix::Col Row;
-
-	TransposeMatrix (Matrix &A) : _A (A) {}
-	TransposeMatrix (const TransposeMatrix &M) : _A (M._A) {}
-
-	inline size_t rowdim () const { return _A.coldim (); }
-	inline size_t coldim () const { return _A.rowdim (); }
-
-	template <class Field>
-	inline std::ostream &write (std::ostream &stream, const Field &F) const
-		{ return _A.write (stream, F); }
-
-	inline void setEntry (size_t i, size_t j, const Element &a_ij) { _A.setEntry (j, i, a_ij); }
-	inline Element &refEntry (size_t i, size_t j) { return _A.refEntry (j, i); }
-	inline const Element &getEntry (size_t i, size_t j) const { return _A.getEntry (j, i); }
-	inline Element &getEntry (Element &x, size_t i, size_t j) const { return _A.getEntry (x, j, i); }
-
-	inline RowIterator rowBegin () { return _A.colBegin (); }
-	inline RowIterator rowEnd () { return _A.colEnd (); }
-	inline ConstRowIterator rowBegin () const { return _A.colBegin (); }
-	inline ConstRowIterator rowEnd () const { return _A.colEnd (); }
-
-	inline ColIterator colBegin () { return _A.rowBegin (); }
-	inline ColIterator colEnd () { return _A.rowEnd (); }
-	inline ConstColIterator colBegin () const { return _A.rowBegin (); }
-	inline ConstColIterator colEnd () const { return _A.rowEnd (); }
-
-	inline RawIterator rawBegin () { return _A.rawBegin (); }
-	inline RawIterator rawEnd () { return _A.rawEnd (); }
-	inline ConstRawIterator rawBegin () const { return _A.rawBegin (); }
-	inline ConstRawIterator rawEnd () const { return _A.rawEnd (); }
-
-	inline RawIndexedIterator rawIndexedBegin() { return _A.rawIndexedBegin (); }
-        inline RawIndexedIterator rawIndexedEnd() { return _A.rawIndexedEnd (); }
-	inline ConstRawIndexedIterator rawIndexedBegin() const { return _A.rawIndexedBegin (); }
-        inline ConstRawIndexedIterator rawIndexedEnd() const { return _A.rawIndexedEnd (); }
-
-    protected:
-
-	Matrix &_A;
-};
-
-// Specialization for matrices that have only row iterators
-
-template <class Matrix>
-class TransposeMatrix<Matrix, MatrixCategories::RowMatrixTag>
-{
-    public:
-
-	typedef typename Matrix::Element Element;
-
-	typedef typename Matrix::RowIterator ColIterator;
-	typedef typename Matrix::RawIterator RawIterator;
-	typedef typename Matrix::RawIndexedIterator RawIndexedIterator;
-	typedef typename Matrix::ConstRowIterator ConstColIterator;
-	typedef typename Matrix::ConstRawIterator ConstRawIterator;
-	typedef typename Matrix::ConstRawIndexedIterator ConstRawIndexedIterator;
-
-	typedef typename Matrix::Row Column;
-	typedef typename Matrix::Row Col;
-
-	TransposeMatrix () {}
-	TransposeMatrix (Matrix &A) : _A (A) {}
-	TransposeMatrix (const TransposeMatrix &M) : _A (M._A) {}
-
-	inline size_t rowdim () const { return _A.coldim (); }
-	inline size_t coldim () const { return _A.rowdim (); }
-
-	template <class Field>
-	inline std::ostream &write (std::ostream &stream, const Field &F) const
-		{ return _A.write (stream, F); }
-
-	inline void setEntry (size_t i, size_t j, const Element &a_ij) { _A.setEntry (j, i, a_ij); }
-	inline Element &refEntry (size_t i, size_t j) { return _A.refEntry (j, i); }
-	inline const Element &getEntry (size_t i, size_t j) const { return _A.getEntry (j, i); }
-	inline Element &getEntry (Element &x, size_t i, size_t j) const { return _A.getEntry (x, j, i); }
-
-	inline ColIterator colBegin () { return _A.rowBegin (); }
-	inline ColIterator colEnd () { return _A.rowEnd (); }
-	inline ConstColIterator colBegin () const { return _A.rowBegin (); }
-	inline ConstColIterator colEnd () const { return _A.rowEnd (); }
-
-	inline RawIterator rawBegin () { return _A.rawBegin (); }
-	inline RawIterator rawEnd () { return _A.rawEnd (); }
-	inline ConstRawIterator rawBegin () const { return _A.rawBegin (); }
-	inline ConstRawIterator rawEnd () const { return _A.rawEnd (); }
-
-	inline RawIndexedIterator rawIndexedBegin() { return _A.rawIndexedBegin (); }
-        inline RawIndexedIterator rawIndexedEnd() { return _A.rawIndexedEnd (); }
-	inline ConstRawIndexedIterator rawIndexedBegin() const { return _A.rawIndexedBegin (); }
-        inline ConstRawIndexedIterator rawIndexedEnd() const { return _A.rawIndexedEnd (); }
-
-    protected:
-
-	Matrix &_A;
-};
-
-// Specialization for matrices that have only column iterators
-
-template <class Matrix>
-class TransposeMatrix<Matrix, MatrixCategories::ColMatrixTag>
-{
-    public:
-
-	typedef typename Matrix::Element Element;
-
-	typedef typename Matrix::ColIterator RowIterator;
-	typedef typename Matrix::RawIterator RawIterator;
-	typedef typename Matrix::RawIndexedIterator RawIndexedIterator;
-	typedef typename Matrix::ConstColIterator ConstRowIterator;
-	typedef typename Matrix::ConstRawIterator ConstRawIterator;
-	typedef typename Matrix::ConstRawIndexedIterator ConstRawIndexedIterator;
-
-	typedef typename Matrix::Col Row;
-
-	TransposeMatrix (Matrix &A) : _A (A) {}
-	TransposeMatrix (const TransposeMatrix &M) : _A (M._A) {}
-
-	inline size_t rowdim () const { return _A.coldim (); }
-	inline size_t coldim () const { return _A.rowdim (); }
-
-	template <class Field>
-	inline std::ostream &write (std::ostream &stream, const Field &F) const
-		{ return _A.write (stream, F); }
-
-	inline void setEntry (size_t i, size_t j, const Element &a_ij) { _A.setEntry (j, i, a_ij); }
-	inline Element &refEntry (size_t i, size_t j) { return _A.refEntry (j, i); }
-	inline const Element &getEntry (size_t i, size_t j) const { return _A.getEntry (j, i); }
-	inline Element &getEntry (Element &x, size_t i, size_t j) const { return _A.getEntry (x, j, i); }
-
-	inline RowIterator rowBegin () { return _A.colBegin (); }
-	inline RowIterator rowEnd () { return _A.colEnd (); }
-	inline ConstRowIterator rowBegin () const { return _A.colBegin (); }
-	inline ConstRowIterator rowEnd () const { return _A.colEnd (); }
-
-	inline RawIterator rawBegin () { return _A.rawBegin (); }
-	inline RawIterator rawEnd () { return _A.rawEnd (); }
-	inline ConstRawIterator rawBegin () const { return _A.rawBegin (); }
-	inline ConstRawIterator rawEnd () const { return _A.rawEnd (); }
-
-	inline RawIndexedIterator rawIndexedBegin() { return _A.rawIndexedBegin (); }
-        inline RawIndexedIterator rawIndexedEnd() { return _A.rawIndexedEnd (); }
-	inline ConstRawIndexedIterator rawIndexedBegin() const { return _A.rawIndexedBegin (); }
-        inline ConstRawIndexedIterator rawIndexedEnd() const { return _A.rawIndexedEnd (); }
-
-    protected:
-
-	const Matrix &_A;
-};
-
-template <class Matrix>
-struct MatrixTraits< TransposeMatrix<Matrix, MatrixCategories::RowColMatrixTag> >
-{ 
-	typedef TransposeMatrix<Matrix, MatrixCategories::RowColMatrixTag> MatrixType;
-	typedef typename MatrixCategories::RowColMatrixTag MatrixCategory; 
-};
-
-template <class Matrix>
-struct MatrixTraits< TransposeMatrix<Matrix, MatrixCategories::RowMatrixTag > >
-{ 
-	typedef TransposeMatrix<Matrix, MatrixCategories::RowMatrixTag> MatrixType;
-	typedef typename MatrixCategories::ColMatrixTag MatrixCategory; 
-};
-
-template <class Matrix>
-struct MatrixTraits< TransposeMatrix<Matrix, MatrixCategories::ColMatrixTag > >
-{ 
-	typedef TransposeMatrix<Matrix, MatrixCategories::ColMatrixTag> MatrixType;
-	typedef typename MatrixCategories::RowMatrixTag MatrixCategory; 
-};
-
-template <class Matrix>
-struct MatrixTraits<const TransposeMatrix<Matrix, MatrixCategories::RowColMatrixTag> >
-{ 
-	typedef const TransposeMatrix<Matrix, MatrixCategories::RowColMatrixTag> MatrixType;
-	typedef typename MatrixCategories::RowColMatrixTag MatrixCategory; 
-};
-
-template <class Matrix>
-struct MatrixTraits<const TransposeMatrix<Matrix, MatrixCategories::RowMatrixTag> >
-{ 
-	typedef const TransposeMatrix<Matrix, MatrixCategories::RowMatrixTag> MatrixType;
-	typedef typename MatrixCategories::ColMatrixTag MatrixCategory; 
-};
-
-template <class Matrix>
-struct MatrixTraits<const TransposeMatrix<Matrix, MatrixCategories::ColMatrixTag> >
-{ 
-	typedef const TransposeMatrix<Matrix, MatrixCategories::ColMatrixTag> MatrixType;
-	typedef typename MatrixCategories::RowMatrixTag MatrixCategory; 
-};
+	template <class Matrix, class Trait = typename MatrixTraits<Matrix>::MatrixCategory>
+	class TransposeMatrix {
+	public:
+
+		typedef typename Matrix::Element Element;
+
+		typedef typename Matrix::ColIterator RowIterator;
+		typedef typename Matrix::RowIterator ColIterator;
+		typedef typename Matrix::RawIterator RawIterator;
+		typedef typename Matrix::RawIndexedIterator RawIndexedIterator;
+		typedef typename Matrix::ConstColIterator ConstRowIterator;
+		typedef typename Matrix::ConstRowIterator ConstColIterator;
+		typedef typename Matrix::ConstRawIterator ConstRawIterator;
+		typedef typename Matrix::ConstRawIndexedIterator ConstRawIndexedIterator;
+
+		typedef typename Matrix::Row Column;
+		typedef typename Matrix::Row Col;
+		typedef typename Matrix::Col Row;
+
+		/** Constructor.
+		 * @param  A  Underlying matrix of which to construct the transpose
+		 */
+		TransposeMatrix (Matrix &A) :
+			_A (A)
+		{}
+
+		/** Copy constructor
+		*/
+		TransposeMatrix (const TransposeMatrix &M) :
+			_A (M._A)
+		{}
+
+		/** Get the number of rows in the matrix
+		 * @return Number of rows in matrix
+		 */
+		inline size_t rowdim () const
+		{
+			return _A.coldim ();
+		}
+
+		/** Get the number of columns in the matrix
+		 * @return Number of columns in matrix
+		 */
+		inline size_t coldim () const
+		{
+			return _A.rowdim ();
+		}
+
+		/** @name Matrix I/O
+		*/
+
+		//@{
+
+		/** Write a matrix to an output stream
+		 * @param stream Stream to which to write the matrix
+		 * @param F
+		 * @return Reference to stream
+		 */
+		template <class Field>
+		inline std::ostream &write (std::ostream &stream, const Field &F) const
+		{
+			return _A.write (stream, F);
+		}
+
+		//@} Matrix I/O
+
+		/** @name Access to matrix elements
+		*/
+
+		//@{
+
+		/** Set the entry at the (i, j) position to a_ij.
+		 * @param i Row number, 0...rowdim () - 1
+		 * @param j Column number 0...coldim () - 1
+		 * @param a_ij Element to set
+		 */
+		void setEntry (size_t i, size_t j, const Element &a_ij)
+		{
+			_A.setEntry (j, i, a_ij);
+		}
+
+		/** Get a writeable reference to the entry in the (i, j) position.
+		 * @param i Row index of entry
+		 * @param j Column index of entry
+		 * @return Reference to matrix entry
+		 */
+		Element &refEntry (size_t i, size_t j)
+		{
+			return _A.refEntry (j, i);
+		}
+
+		/** Get a read-only reference to the entry in the (i, j) position.
+		 * @param i Row index
+		 * @param j Column index
+		 * @return Const reference to matrix entry
+		 */
+		inline const Element &getEntry (size_t i, size_t j) const
+		{
+			return _A.getEntry (j, i);
+		}
+
+		/** Copy the (i, j) entry into x, and return a reference to x.
+		 * This form is more in the Linbox style and is provided for interface
+		 * compatibility with other parts of the library
+		 * @param x Element in which to store result
+		 * @param i Row index
+		 * @param j Column index
+		 * @return Reference to x
+		 */
+		inline Element &getEntry (Element &x, size_t i, size_t j) const
+		{
+			return _A.getEntry (x, j, i);
+		}
+
+		/** @name Column of rows iterator
+		 * The column of rows iterator traverses the rows of the
+		 * matrix in ascending order. Dereferencing the iterator yields
+		 * a row vector in dense format
+		 */
+
+		inline RowIterator rowBegin ()
+		{
+			return _A.colBegin ();
+		}
+		inline RowIterator rowEnd ()
+		{
+			return _A.colEnd ();
+		}
+		inline ConstRowIterator rowBegin () const
+		{
+			return _A.colBegin ();
+		}
+		inline ConstRowIterator rowEnd () const
+		{
+			return _A.colEnd ();
+		}
+
+		/** @name Row of columns iterator
+		 * The row of columns iterator traverses the columns of the
+		 * matrix in ascending order. Dereferencing the iterator yields
+		 * a column vector in dense format
+		 */
+
+		inline ColIterator colBegin ()
+		{
+			return _A.rowBegin ();
+		}
+		inline ColIterator colEnd ()
+		{
+			return _A.rowEnd ();
+		}
+		inline ConstColIterator colBegin () const
+		{
+			return _A.rowBegin ();
+		}
+		inline ConstColIterator colEnd () const
+		{
+			return _A.rowEnd ();
+		}
+
+		/** @name Raw iterator
+		 *
+		 * The raw iterator is a method for accessing all entries in the matrix
+		 * in some unspecified order. This can be used, e.g. to reduce all
+		 * matrix entries modulo a prime before passing the matrix into an
+		 * algorithm.
+		 */
+
+		inline RawIterator rawBegin ()
+		{
+			return _A.rawBegin ();
+		}
+		inline RawIterator rawEnd ()
+		{
+			return _A.rawEnd ();
+		}
+		inline ConstRawIterator rawBegin () const
+		{
+			return _A.rawBegin ();
+		}
+		inline ConstRawIterator rawEnd () const
+		{
+			return _A.rawEnd ();
+		}
+
+		/** @name Raw Indexed iterator.
+		 * @brief
+		 * Like the raw iterator, the indexed iterator is a method for
+		 * accessing all entries in the matrix in some unspecified order.
+		 * At each position of the the indexed iterator, it also provides
+		 * the row and column indices of the currently referenced entry.
+		 * This is provided through it's rowIndex() and colIndex() functions.
+		 */
+
+		inline RawIndexedIterator rawIndexedBegin()
+		{
+			return _A.rawIndexedBegin ();
+		}
+		inline RawIndexedIterator rawIndexedEnd()
+		{
+			return _A.rawIndexedEnd ();
+		}
+		inline ConstRawIndexedIterator rawIndexedBegin() const
+		{
+			return _A.rawIndexedBegin ();
+		}
+		inline ConstRawIndexedIterator rawIndexedEnd() const
+		{
+			return _A.rawIndexedEnd ();
+		}
+
+		//@}
+
+	protected:
+
+		Matrix &_A;
+	};
+
+	// Specialization for matrices that have both row and column iterators
+
+	template <class Matrix>
+	class TransposeMatrix<Matrix, MatrixCategories::RowColMatrixTag> {
+	public:
+
+		typedef typename Matrix::Element Element;
+
+		typedef typename Matrix::ColIterator RowIterator;
+		typedef typename Matrix::RowIterator ColIterator;
+		typedef typename Matrix::RawIterator RawIterator;
+		typedef typename Matrix::RawIndexedIterator RawIndexedIterator;
+		typedef typename Matrix::ConstColIterator ConstRowIterator;
+		typedef typename Matrix::ConstRowIterator ConstColIterator;
+		typedef typename Matrix::ConstRawIterator ConstRawIterator;
+		typedef typename Matrix::ConstRawIndexedIterator ConstRawIndexedIterator;
+
+		typedef typename Matrix::Row Column;
+		typedef typename Matrix::Row Col;
+		typedef typename Matrix::Col Row;
+
+		TransposeMatrix (Matrix &A) :
+			_A (A)
+		{}
+
+		TransposeMatrix (const TransposeMatrix &M) :
+			_A (M._A)
+		{}
+
+		inline size_t rowdim () const
+		{
+			return _A.coldim ();
+		}
+		inline size_t coldim () const
+		{
+			return _A.rowdim ();
+		}
+
+		template <class Field>
+		inline std::ostream &write (std::ostream &stream, const Field &F) const
+		{
+			return _A.write (stream, F);
+		}
+
+		inline void setEntry (size_t i, size_t j, const Element &a_ij)
+		{
+			_A.setEntry (j, i, a_ij);
+		}
+		inline Element &refEntry (size_t i, size_t j)
+		{
+			return _A.refEntry (j, i);
+		}
+		inline const Element &getEntry (size_t i, size_t j) const
+		{
+			return _A.getEntry (j, i);
+		}
+		inline Element &getEntry (Element &x, size_t i, size_t j) const
+		{
+			return _A.getEntry (x, j, i);
+		}
+
+		inline RowIterator rowBegin ()
+		{
+			return _A.colBegin ();
+		}
+		inline RowIterator rowEnd ()
+		{
+			return _A.colEnd ();
+		}
+		inline ConstRowIterator rowBegin () const
+		{
+			return _A.colBegin ();
+		}
+		inline ConstRowIterator rowEnd () const
+		{
+			return _A.colEnd ();
+		}
+
+		inline ColIterator colBegin ()
+		{
+			return _A.rowBegin ();
+		}
+		inline ColIterator colEnd ()
+		{
+			return _A.rowEnd ();
+		}
+		inline ConstColIterator colBegin () const
+		{
+			return _A.rowBegin ();
+		}
+		inline ConstColIterator colEnd () const
+		{
+			return _A.rowEnd ();
+		}
+
+		inline RawIterator rawBegin ()
+		{
+			return _A.rawBegin ();
+		}
+		inline RawIterator rawEnd ()
+		{
+			return _A.rawEnd ();
+		}
+		inline ConstRawIterator rawBegin () const
+		{
+			return _A.rawBegin ();
+		}
+		inline ConstRawIterator rawEnd () const
+		{
+			return _A.rawEnd ();
+		}
+
+		inline RawIndexedIterator rawIndexedBegin()
+		{
+			return _A.rawIndexedBegin ();
+		}
+		inline RawIndexedIterator rawIndexedEnd()
+		{
+			return _A.rawIndexedEnd ();
+		}
+		inline ConstRawIndexedIterator rawIndexedBegin() const
+		{
+			return _A.rawIndexedBegin ();
+		}
+		inline ConstRawIndexedIterator rawIndexedEnd() const
+		{
+			return _A.rawIndexedEnd ();
+		}
+
+	protected:
+
+		Matrix &_A;
+	};
+
+	// Specialization for matrices that have only row iterators
+
+	template <class Matrix>
+	class TransposeMatrix<Matrix, MatrixCategories::RowMatrixTag> {
+	public:
+
+		typedef typename Matrix::Element Element;
+
+		typedef typename Matrix::RowIterator ColIterator;
+		typedef typename Matrix::RawIterator RawIterator;
+		typedef typename Matrix::RawIndexedIterator RawIndexedIterator;
+		typedef typename Matrix::ConstRowIterator ConstColIterator;
+		typedef typename Matrix::ConstRawIterator ConstRawIterator;
+		typedef typename Matrix::ConstRawIndexedIterator ConstRawIndexedIterator;
+
+		typedef typename Matrix::Row Column;
+		typedef typename Matrix::Row Col;
+
+		// TransposeMatrix () {}
+
+		TransposeMatrix (Matrix &A) :
+			_A (A)
+		{}
+		TransposeMatrix (const TransposeMatrix &M) :
+			_A (M._A)
+		{}
+
+		inline size_t rowdim () const
+		{
+			return _A.coldim ();
+		}
+		inline size_t coldim () const
+		{
+			return _A.rowdim ();
+		}
+
+		template <class Field>
+		inline std::ostream &write (std::ostream &stream, const Field &F) const
+		{
+			return _A.write (stream, F);
+		}
+
+		inline void setEntry (size_t i, size_t j, const Element &a_ij)
+		{
+			_A.setEntry (j, i, a_ij);
+		}
+		inline Element &refEntry (size_t i, size_t j)
+		{
+			return _A.refEntry (j, i);
+		}
+		inline const Element &getEntry (size_t i, size_t j) const
+		{
+			return _A.getEntry (j, i);
+		}
+		inline Element &getEntry (Element &x, size_t i, size_t j) const
+		{
+			return _A.getEntry (x, j, i);
+		}
+
+		inline ColIterator colBegin ()
+		{
+			return _A.rowBegin ();
+		}
+		inline ColIterator colEnd ()
+		{
+			return _A.rowEnd ();
+		}
+		inline ConstColIterator colBegin () const
+		{
+			return _A.rowBegin ();
+		}
+		inline ConstColIterator colEnd () const
+		{
+			return _A.rowEnd ();
+		}
+
+		inline RawIterator rawBegin ()
+		{
+			return _A.rawBegin ();
+		}
+		inline RawIterator rawEnd ()
+		{
+			return _A.rawEnd ();
+		}
+		inline ConstRawIterator rawBegin () const
+		{
+			return _A.rawBegin ();
+		}
+		inline ConstRawIterator rawEnd () const
+		{
+			return _A.rawEnd ();
+		}
+
+		inline RawIndexedIterator rawIndexedBegin()
+		{
+			return _A.rawIndexedBegin ();
+		}
+		inline RawIndexedIterator rawIndexedEnd()
+		{
+			return _A.rawIndexedEnd ();
+		}
+		inline ConstRawIndexedIterator rawIndexedBegin() const
+		{
+			return _A.rawIndexedBegin ();
+		}
+		inline ConstRawIndexedIterator rawIndexedEnd() const
+		{
+			return _A.rawIndexedEnd ();
+		}
+
+	protected:
+
+		Matrix &_A;
+	};
+
+	// Specialization for matrices that have only column iterators
+
+	template <class Matrix>
+	class TransposeMatrix<Matrix, MatrixCategories::ColMatrixTag> {
+	public:
+
+		typedef typename Matrix::Element Element;
+
+		typedef typename Matrix::ColIterator RowIterator;
+		typedef typename Matrix::RawIterator RawIterator;
+		typedef typename Matrix::RawIndexedIterator RawIndexedIterator;
+		typedef typename Matrix::ConstColIterator ConstRowIterator;
+		typedef typename Matrix::ConstRawIterator ConstRawIterator;
+		typedef typename Matrix::ConstRawIndexedIterator ConstRawIndexedIterator;
+
+		typedef typename Matrix::Col Row;
+
+		TransposeMatrix (Matrix &A) :
+			_A (A)
+		{}
+		TransposeMatrix (const TransposeMatrix &M) :
+			_A (M._A)
+		{}
+
+		inline size_t rowdim () const
+		{
+			return _A.coldim ();
+		}
+		inline size_t coldim () const
+		{
+			return _A.rowdim ();
+		}
+
+		template <class Field>
+		inline std::ostream &write (std::ostream &stream, const Field &F) const
+		{
+			return _A.write (stream, F);
+		}
+
+		inline void setEntry (size_t i, size_t j, const Element &a_ij)
+		{
+			_A.setEntry (j, i, a_ij);
+		}
+		inline Element &refEntry (size_t i, size_t j)
+		{
+			return _A.refEntry (j, i);
+		}
+		inline const Element &getEntry (size_t i, size_t j) const
+		{
+			return _A.getEntry (j, i);
+		}
+		inline Element &getEntry (Element &x, size_t i, size_t j) const
+		{
+			return _A.getEntry (x, j, i);
+		}
+
+		inline RowIterator rowBegin ()
+		{
+			return _A.colBegin ();
+		}
+		inline RowIterator rowEnd ()
+		{
+			return _A.colEnd ();
+		}
+		inline ConstRowIterator rowBegin () const
+		{
+			return _A.colBegin ();
+		}
+		inline ConstRowIterator rowEnd () const
+		{
+			return _A.colEnd ();
+		}
+
+		inline RawIterator rawBegin ()
+		{
+			return _A.rawBegin ();
+		}
+		inline RawIterator rawEnd ()
+		{
+			return _A.rawEnd ();
+		}
+		inline ConstRawIterator rawBegin () const
+		{
+			return _A.rawBegin ();
+		}
+		inline ConstRawIterator rawEnd () const
+		{
+			return _A.rawEnd ();
+		}
+
+		inline RawIndexedIterator rawIndexedBegin()
+		{
+			return _A.rawIndexedBegin ();
+		}
+		inline RawIndexedIterator rawIndexedEnd()
+		{
+			return _A.rawIndexedEnd ();
+		}
+		inline ConstRawIndexedIterator rawIndexedBegin() const
+		{
+			return _A.rawIndexedBegin ();
+		}
+		inline ConstRawIndexedIterator rawIndexedEnd() const
+		{
+			return _A.rawIndexedEnd ();
+		}
+
+	protected:
+
+		const Matrix &_A;
+	};
+
+	template <class Matrix>
+	struct MatrixTraits< TransposeMatrix<Matrix, MatrixCategories::RowColMatrixTag> > {
+		typedef TransposeMatrix<Matrix, MatrixCategories::RowColMatrixTag> MatrixType;
+		typedef typename MatrixCategories::RowColMatrixTag MatrixCategory;
+	};
+
+	template <class Matrix>
+	struct MatrixTraits< TransposeMatrix<Matrix, MatrixCategories::RowMatrixTag > > {
+		typedef TransposeMatrix<Matrix, MatrixCategories::RowMatrixTag> MatrixType;
+		typedef typename MatrixCategories::ColMatrixTag MatrixCategory;
+	};
+
+	template <class Matrix>
+	struct MatrixTraits< TransposeMatrix<Matrix, MatrixCategories::ColMatrixTag > > {
+		typedef TransposeMatrix<Matrix, MatrixCategories::ColMatrixTag> MatrixType;
+		typedef typename MatrixCategories::RowMatrixTag MatrixCategory;
+	};
+
+	template <class Matrix>
+	struct MatrixTraits<const TransposeMatrix<Matrix, MatrixCategories::RowColMatrixTag> > {
+		typedef const TransposeMatrix<Matrix, MatrixCategories::RowColMatrixTag> MatrixType;
+		typedef typename MatrixCategories::RowColMatrixTag MatrixCategory;
+	};
+
+	template <class Matrix>
+	struct MatrixTraits<const TransposeMatrix<Matrix, MatrixCategories::RowMatrixTag> > {
+		typedef const TransposeMatrix<Matrix, MatrixCategories::RowMatrixTag> MatrixType;
+		typedef typename MatrixCategories::ColMatrixTag MatrixCategory;
+	};
+
+	template <class Matrix>
+	struct MatrixTraits<const TransposeMatrix<Matrix, MatrixCategories::ColMatrixTag> > {
+		typedef const TransposeMatrix<Matrix, MatrixCategories::ColMatrixTag> MatrixType;
+		typedef typename MatrixCategories::RowMatrixTag MatrixCategory;
+	};
 
 } // namespace LinBox
 
-#endif // __MATRIX_TRANSPOSE_INL
+#endif // __LINBOX_matrix_transpose_INL
+
diff --git a/linbox/randiter/Makefile.am b/linbox/randiter/Makefile.am
index 30afb71..8b35a9f 100644
--- a/linbox/randiter/Makefile.am
+++ b/linbox/randiter/Makefile.am
@@ -1,33 +1,38 @@
-INCLUDES=-I$(top_srcdir)/linbox $(GMP_CFLAGS)
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+AM_CPPFLAGS=-I$(top_srcdir)/linbox
 pkgincludesubdir=$(pkgincludedir)/randiter
 
-AM_CXXFLAGS = -O2 -Wall -DDISABLE_COMMENTATOR $(GMP_CFLAGS) $(NTL_CFLAGS) $(ATLAS_CFLAGS) $(GIVARO_CFLAGS)
- 
-BASIC_HDRS =				\
-	abstract.h			\
-	archetype.h			\
-	envelope.h			\
-	gmp-rational.h			\
-	param-fuzzy.h			\
-	modular.h			\
-	modular-balanced.h		\
-	unparametric.h			\
-	gf2.h				\
-	nonzero.h			\
-	mersenne-twister.h		\
-	ntl-ZZ.h			\
-	random-prime.h			\
-	gmp-random-prime.h		\
-	random-fftprime.h		\
-	multimod-randomprime.h
+AM_CXXFLAGS = @DEFAULT_CFLAGS@ -DDISABLE_COMMENTATOR $(GMP_CFLAGS) $(NTL_CFLAGS) $(ATLAS_CFLAGS) $(GIVARO_CFLAGS)  $(FFLAFLAS_CFLAGS)
+
+BASIC_HDRS =            \
+    abstract.h          \
+    archetype.h         \
+    envelope.h          \
+    gmp-rational.h      \
+    param-fuzzy.h       \
+    modular.h           \
+    modular-balanced.h  \
+    modular-crooked.h   \
+    unparametric.h      \
+    gf2.h               \
+    nonzero.h           \
+    mersenne-twister.h  \
+    ntl-ZZ.h            \
+    random-prime.h      \
+    random-integer.h    \
+    gmp-random-prime.h  \
+    random-fftprime.h   \
+    multimod-randomprime.h
 
 NTL_HDRS =
 
 GIVARO_HDRS =
 
-LIDIA_HDRS =				\
-	lidia.h				\
-	lidia-gfq.h
+LIDIA_HDRS =            \
+    lidia.h             \
+    lidia-gfq.h
 
 if LINBOX_HAVE_NTL
 USE_NTL_HDRS = $(NTL_HDRS)
@@ -41,22 +46,22 @@ if LINBOX_HAVE_LIDIA
 USE_LIDIA_HDRS = $(LIDIA_HDRS)
 endif
 
-pkgincludesub_HEADERS =			\
-	$(BASIC_HDRS)			\
-	$(USE_NTL_HDRS)			\
-	$(USE_GIVARO_HDRS)		\
-	$(USE_LIDIA_HDRS)
+pkgincludesub_HEADERS =     \
+    $(BASIC_HDRS)           \
+    $(USE_NTL_HDRS)         \
+    $(USE_GIVARO_HDRS)      \
+    $(USE_LIDIA_HDRS)
 
-EXTRA_DIST =				\
-	$(NTL_HDRS)			\
-	$(GIVARO_HDRS)			\
-	$(LIDIA_HDRS)			\
-	randiter.doxy			\
-	archetype.doxy			\
-	randiter-wrappers.doxy
+EXTRA_DIST =                \
+    $(NTL_HDRS)             \
+    $(GIVARO_HDRS)          \
+    $(LIDIA_HDRS)           \
+    randiter.doxy           \
+    archetype.doxy          \
+    randiter-wrappers.doxy
 
 noinst_LTLIBRARIES = libranditer.la
 
-libranditer_la_SOURCES =	\
-	mersenne-twister.C
+libranditer_la_SOURCES =    \
+    mersenne-twister.C
 
diff --git a/linbox/randiter/Makefile.in b/linbox/randiter/Makefile.in
index 7dc2876..2a66cf3 100644
--- a/linbox/randiter/Makefile.in
+++ b/linbox/randiter/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -38,19 +39,26 @@ 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 \
-	$(top_srcdir)/macros/blas-check.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
 	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
 	$(top_srcdir)/macros/givaro-check.m4 \
 	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
 	$(top_srcdir)/macros/lidia-check.m4 \
 	$(top_srcdir)/macros/linbox-doc.m4 \
 	$(top_srcdir)/macros/linbox-misc.m4 \
 	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
 	$(top_srcdir)/macros/maple-check.m4 \
 	$(top_srcdir)/macros/ntl-check.m4 \
 	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -76,9 +84,10 @@ SOURCES = $(libranditer_la_SOURCES)
 DIST_SOURCES = $(libranditer_la_SOURCES)
 am__pkgincludesub_HEADERS_DIST = abstract.h archetype.h envelope.h \
 	gmp-rational.h param-fuzzy.h modular.h modular-balanced.h \
-	unparametric.h gf2.h nonzero.h mersenne-twister.h ntl-ZZ.h \
-	random-prime.h gmp-random-prime.h random-fftprime.h \
-	multimod-randomprime.h lidia.h lidia-gfq.h
+	modular-crooked.h unparametric.h gf2.h nonzero.h \
+	mersenne-twister.h ntl-ZZ.h random-prime.h random-integer.h \
+	gmp-random-prime.h random-fftprime.h multimod-randomprime.h \
+	lidia.h lidia-gfq.h
 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
 am__vpath_adj = case $$p in \
     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -99,18 +108,21 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
 CC = @CC@
+CCNAM = @CCNAM@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
 DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -118,19 +130,24 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
 GIVARO_CFLAGS = @GIVARO_CFLAGS@
 GIVARO_LIBS = @GIVARO_LIBS@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
 GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
@@ -138,41 +155,52 @@ LIBTOOL = @LIBTOOL@
 LIDIA_CFLAGS = @LIDIA_CFLAGS@
 LIDIA_LIBS = @LIDIA_LIBS@
 LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MAPLE_CFLAGS = @MAPLE_CFLAGS@
 MAPLE_HOME = @MAPLE_HOME@
 MAPLE_LIBS = @MAPLE_LIBS@
 MAPLE_VERSION = @MAPLE_VERSION@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
 NTL_CFLAGS = @NTL_CFLAGS@
 NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RM = @RM@
 SACLIB_CFLAGS = @SACLIB_CFLAGS@
 SACLIB_LIBS = @SACLIB_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+TESTS_CFLAGS = @TESTS_CFLAGS@
 VERSION = @VERSION@
+WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -213,55 +241,62 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-INCLUDES = -I$(top_srcdir)/linbox $(GMP_CFLAGS)
+
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+AM_CPPFLAGS = -I$(top_srcdir)/linbox
 pkgincludesubdir = $(pkgincludedir)/randiter
-AM_CXXFLAGS = -O2 -Wall -DDISABLE_COMMENTATOR $(GMP_CFLAGS) $(NTL_CFLAGS) $(ATLAS_CFLAGS) $(GIVARO_CFLAGS)
+AM_CXXFLAGS = @DEFAULT_CFLAGS@ -DDISABLE_COMMENTATOR $(GMP_CFLAGS) $(NTL_CFLAGS) $(ATLAS_CFLAGS) $(GIVARO_CFLAGS)  $(FFLAFLAS_CFLAGS)
 BASIC_HDRS = \
-	abstract.h			\
-	archetype.h			\
-	envelope.h			\
-	gmp-rational.h			\
-	param-fuzzy.h			\
-	modular.h			\
-	modular-balanced.h		\
-	unparametric.h			\
-	gf2.h				\
-	nonzero.h			\
-	mersenne-twister.h		\
-	ntl-ZZ.h			\
-	random-prime.h			\
-	gmp-random-prime.h		\
-	random-fftprime.h		\
-	multimod-randomprime.h
+    abstract.h          \
+    archetype.h         \
+    envelope.h          \
+    gmp-rational.h      \
+    param-fuzzy.h       \
+    modular.h           \
+    modular-balanced.h  \
+    modular-crooked.h   \
+    unparametric.h      \
+    gf2.h               \
+    nonzero.h           \
+    mersenne-twister.h  \
+    ntl-ZZ.h            \
+    random-prime.h      \
+    random-integer.h    \
+    gmp-random-prime.h  \
+    random-fftprime.h   \
+    multimod-randomprime.h
 
 NTL_HDRS = 
 GIVARO_HDRS = 
 LIDIA_HDRS = \
-	lidia.h				\
-	lidia-gfq.h
+    lidia.h             \
+    lidia-gfq.h
 
 @LINBOX_HAVE_NTL_TRUE at USE_NTL_HDRS = $(NTL_HDRS)
 @LINBOX_HAVE_GIVARO_TRUE at USE_GIVARO_HDRS = $(GIVARO_HDRS)
 @LINBOX_HAVE_LIDIA_TRUE at USE_LIDIA_HDRS = $(LIDIA_HDRS)
 pkgincludesub_HEADERS = \
-	$(BASIC_HDRS)			\
-	$(USE_NTL_HDRS)			\
-	$(USE_GIVARO_HDRS)		\
-	$(USE_LIDIA_HDRS)
+    $(BASIC_HDRS)           \
+    $(USE_NTL_HDRS)         \
+    $(USE_GIVARO_HDRS)      \
+    $(USE_LIDIA_HDRS)
 
 EXTRA_DIST = \
-	$(NTL_HDRS)			\
-	$(GIVARO_HDRS)			\
-	$(LIDIA_HDRS)			\
-	randiter.doxy			\
-	archetype.doxy			\
-	randiter-wrappers.doxy
+    $(NTL_HDRS)             \
+    $(GIVARO_HDRS)          \
+    $(LIDIA_HDRS)           \
+    randiter.doxy           \
+    archetype.doxy          \
+    randiter-wrappers.doxy
 
 noinst_LTLIBRARIES = libranditer.la
 libranditer_la_SOURCES = \
-	mersenne-twister.C
+    mersenne-twister.C
 
 all: all-am
 
@@ -271,8 +306,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
 	      exit 1;; \
 	  esac; \
 	done; \
@@ -351,7 +386,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
@@ -466,6 +501,8 @@ dvi-am:
 
 html: html-am
 
+html-am:
+
 info: info-am
 
 info-am:
@@ -474,18 +511,28 @@ install-data-am: install-pkgincludesubHEADERS
 
 install-dvi: install-dvi-am
 
+install-dvi-am:
+
 install-exec-am:
 
 install-html: install-html-am
 
+install-html-am:
+
 install-info: install-info-am
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-am
 
+install-pdf-am:
+
 install-ps: install-ps-am
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
diff --git a/linbox/randiter/abstract.h b/linbox/randiter/abstract.h
index d61560a..120888d 100644
--- a/linbox/randiter/abstract.h
+++ b/linbox/randiter/abstract.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/randiter/abstract.h
  * Copyright (C) 1999-2001 William J Turner,
  *               2002 Bradford Hovinen
@@ -23,33 +23,33 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __RANDITER_ABSTRACT_H
-#define __RANDITER_ABSTRACT_H
+#ifndef __LINBOX_randiter_abstract_H
+#define __LINBOX_randiter_abstract_H
 
 #include <iostream>
 #include <linbox/integer.h>
 
-namespace LinBox 
-{ 
+namespace LinBox
+{
 	// forward declarations
 	class FieldAbstract;
 	class ElementAbstract;
 
 	/** Random field element generator.
-	 * This encapsulated class is a generator of random field elements for 
+	 * This encapsulated class is a generator of random field elements for
 	 * the encapsulating field.
 	 * It is required to contain constructors from a field object and
-	 * two integers.  The first integer being a cardinality of a set to 
-	 * draw the random elements from, and the second being a seed for the 
+	 * two integers.  The first integer being a cardinality of a set to
+	 * draw the random elements from, and the second being a seed for the
 	 * random number generator.
 	 * It is also required to contain a copy constructor, a destructor, and
-	 * random() which acts on a reference to a field element.  
+	 * random() which acts on a reference to a field element.
 	 * The random value is written to the argument
 	 * and also returned as a reference.
+	 * @see \subpage randomFEGW Randiter Field Element Generator wrapper
 	 */
-	class RandIterAbstract
-	{
-	    public:
+	class RandIterAbstract {
+	public:
 
 		typedef ElementAbstract Element;
 
@@ -63,14 +63,14 @@ namespace LinBox
 		 * A seed of zero means to use some arbitrary seed for the generator.
 		 * Purely virtual.
 		 * @param F LinBox field archetype object in which to do arithmetic
-		 * @param size constant integer reference of sample size from which to 
+		 * @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)
 		 */
-		virtual RandIterAbstract *construct (const FieldAbstract &F, 
-						      const integer &size = 0, 
-						      const integer &seed = 0) const = 0;
+		virtual RandIterAbstract *construct (const FieldAbstract &F,
+						     const integer &size = 0,
+						     const integer &seed = 0) const = 0;
 
 		/** Virtual copy constructor.
 		 * Required because constructors cannot be virtual.
@@ -88,7 +88,7 @@ namespace LinBox
 		virtual RandIterAbstract &operator= (const RandIterAbstract &x) = 0;
 
 		/** Destructor.
-		 */
+		*/
 		virtual ~RandIterAbstract (void) {}
 
 		/** Random field element creator.
@@ -97,7 +97,7 @@ namespace LinBox
 		 */
 		virtual Element &random (Element &a) const = 0;
 
-	    protected:
+	protected:
 
 		/** Default constructor
 		 * Required by derived classes, but protected because this class should
@@ -109,4 +109,5 @@ namespace LinBox
 
 } // namespace LinBox
 
-#endif // __RANDITER_ABSTRACT_H
+#endif // __LINBOX_randiter_abstract_H
+
diff --git a/linbox/randiter/archetype.doxy b/linbox/randiter/archetype.doxy
index e32cb93..8cab1b9 100644
--- a/linbox/randiter/archetype.doxy
+++ b/linbox/randiter/archetype.doxy
@@ -1,12 +1,12 @@
-/* \page Random Iterator Generator Archetype
+/*! \page randomIGA Random Iterator Generator Archetype
 
-  The \Ref{LinBox} random iterator generator archetype defines the random
+  The \ref LinBox random iterator generator archetype defines the random
   iterator generator common object interface.
 
-  @see Archetypes
+  @see \ref Archetypes
 
-  @\brief {@link Archetypes Archetype} for implementing the \Ref{LinBox}
-        \Ref{Random Iterator Generators} common object interface.
+  \brief @link Archetypes Archetype at endlink for implementing the %LinBox
+        \ref randomIGA common object interface.
 */
 //@{
   //@Include: archetype.h
@@ -14,3 +14,4 @@
   //@Include: envelope.h
 //@}
 
+// vim:syn=doxygen
diff --git a/linbox/randiter/archetype.h b/linbox/randiter/archetype.h
index f15cc3d..1b48bc0 100644
--- a/linbox/randiter/archetype.h
+++ b/linbox/randiter/archetype.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/randiter/archetype.h
  * Copyright (C) 1999-2001 William J Turner,
  *               2002 Bradford Hovinen
@@ -23,8 +23,15 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __RANDITER_ARCHETYPE_H
-#define __RANDITER_ARCHETYPE_H
+/*!@file randiter/archetype.h
+ * @ingroup randiter
+ * @brief NO DOC
+ * @see \ref Archetypes
+ */
+
+
+#ifndef __LINBOX_randiter_archetype_H
+#define __LINBOX_randiter_archetype_H
 
 #include "linbox/field/archetype.h"
 #include "linbox/field/abstract.h"
@@ -37,29 +44,28 @@ namespace LinBox
 
 	/** \brief Random field element generator archetype.
 	 *
-	 * This encapsulated class is a generator of random field elements for 
+	 * This encapsulated class is a generator of random field elements for
 	 * the encapsulating field.
 	 * It is required to contain constructors from a field object and
-	 * two integers.  The first integer being a cardinality of a set to 
-	 * draw the random elements from, and the second being a seed for the 
+	 * two integers.  The first integer being a cardinality of a set to
+	 * draw the random elements from, and the second being a seed for the
 	 * random number generator.
 	 * It is also required to contain a copy constructor, a destructor, and
-	 * an operator () which acts on a reference to a field element.  In this 
-	 * operator (), the random element is placed into the input field element 
+	 * an operator () which acts on a reference to a field element.  In this
+	 * operator (), the random element is placed into the input field element
 	 * and also returned as a reference.
 	 */
-	class RandIterArchetype
-	{
-	    public:
-    
+	class RandIterArchetype {
+	public:
+
 		/** @name Common Object Interface.
-		 * These methods are required of all \Ref{LinBox} field element generators.
+		 * These methods are required of all LinBox field element generators.
 		 */
 		//@{
-    
+
 		/// element type
 		typedef ElementArchetype 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
@@ -70,20 +76,20 @@ namespace LinBox
 		 * entire field.  A seed of zero means to use some
 		 * arbitrary seed for the generator.  In this
 		 * implementation, this means copying the field to
-		 * which {\tt F.\_field\_ptr} points, the element to
-		 * which {\tt F.\_elem\_ptr} points, and the random
-		 * element generator to which {\tt F.\_randIter\_ptr} points.
+		 * which <code>F._field_ptr</code> points, the element to
+		 * which <code>F._elem_ptr</code> points, and the random
+		 * element generator to which <code>F._randIter_ptr</code> points.
 		 *
 		 * @param F LinBox field archetype object in which to do arithmetic
-		 * @param size constant integer reference of sample size from which to 
+		 * @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 
+		 * @param seed constant integer reference from which to seed random number
 		 *             generator (default = 0)
 		 */
-		RandIterArchetype (const FieldArchetype &F, 
-				    const integer &size = 0, 
-				    const integer &seed = 0)
-			{ _randIter_ptr = F._randIter_ptr->construct (*F._field_ptr, size, seed); }
+		RandIterArchetype (const FieldArchetype &F,
+				   const integer &size = 0,
+				   const integer &seed = 0)
+		{ _randIter_ptr = F._randIter_ptr->construct (*F._field_ptr, size, seed); }
 
 		/** Copy constructor.
 		 * Constructs RandIterArchetype object by copying the random field
@@ -91,27 +97,27 @@ namespace LinBox
 		 * 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 {\tt R.\_randIter\_ptr} points.
+		 * generator to which <code>R._randIter_ptr</code> points.
 		 * @param  R RandIterArchetype object.
 		 */
-		RandIterArchetype (const RandIterArchetype &R) 
-			{ _randIter_ptr = R._randIter_ptr->clone (); }
+		RandIterArchetype (const RandIterArchetype &R)
+		{ _randIter_ptr = R._randIter_ptr->clone (); }
 
 
 		/** Constructor.
 		 * Constructs RandIterArchetype  from ANYTHING matching the interface
-		 * using the enveloppe as a \Ref{FieldAbstract} and its
+		 * using the enveloppe as a \ref FieldAbstract and its
 		 * encapsulated element and random element generator if needed.
-		 * @param  field\_ptr pointer to field matching the interface
-		 * @param  elem\_ptr  pointer to element matching the interface
-		 * @param  randIter\_ptr  pointer to random matching the interface
+		 * @param f
+		 * @param size
+		 * @param seed
 		 */
 		template<class Field_qcq>
-			RandIterArchetype (Field_qcq *f, 
-				    const integer &size = 0, 
-				    const integer &seed = 0) 
+		RandIterArchetype (Field_qcq *f,
+				   const integer &size = 0,
+				   const integer &seed = 0)
 		{ constructor (f, f, size, seed); }
-	
+
 
 
 		/** Destructor.
@@ -119,16 +125,16 @@ namespace LinBox
 		 * This destructs the random field element generator
 		 * object.  In this implementation, this destroys the
 		 * generator by deleting the random generator object
-		 * to which {\tt \_randIter\_ptr} points.
+		 * to which \c _randIter_ptr points.
 		 */
-		~RandIterArchetype () 
-			{ delete _randIter_ptr; }
-    
+		~RandIterArchetype ()
+		{ delete _randIter_ptr; }
+
 		/** Assignment operator.
 		 *
 		 * Assigns RandIterArchetype object R to generator.
 		 * In this implementation, this means copying the
-		 * generator to which {\tt R.\_randIter\_ptr} points.
+		 * generator to which \c R._randIter_ptr points.
 		 *
 		 * @param  R RandIterArchetype object.
 		 */
@@ -140,7 +146,7 @@ namespace LinBox
 			}
 			return *this;
 		}
- 
+
 		/** Random field element creator.
 		 * This returns a random field element from the information supplied
 		 * at the creation of the generator.
@@ -153,63 +159,64 @@ namespace LinBox
 		}
 
 		//@} Common Object Iterface
-    
+
 		/** @name Implementation-Specific Methods.
-		 * These methods are not required of all 
-		 * \Ref{LinBox Random field element generators}
+		 * These methods are not required of all
+		 * LinBox random field element generators
 		 * and are included only for this implementation of the archetype.
 		 */
 		//@{
-    
+
 		/** Constructor.
-		 * Constructs field from pointer to \Ref{RandIterAbstract}.
+		 * Constructs field from pointer to \ref RandIterAbstract.
 		 * Not part of the interface.
 		 * Creates new copies of random iterator generator object in dynamic memory.
-		 * @param  randIter_ptr  pointer to \Ref{RandIterAbstract}
+		 * @param  randIter_ptr  pointer to \ref RandIterAbstract
 		 */
-		RandIterArchetype (RandIterAbstract* randIter_ptr)
-			: _randIter_ptr (randIter_ptr->clone ()) {}
+		RandIterArchetype (RandIterAbstract* randIter_ptr) :
+			_randIter_ptr (randIter_ptr->clone ())
+		{}
 
 		//@} Implementation-Specific Methods
-    
-	    private:
 
-		/** Pointer to RandIterAbstract object.
+	private:
+
+		/** @internal Pointer to RandIterAbstract object.
 		 * Not part of the interface.
 		 * Included to allow for archetype use three.
 		 */
 		mutable RandIterAbstract *_randIter_ptr;
 
-		/** Template method for constructing archetype from a derived class of 
+		/** @internal Template method for constructing archetype from a derived class of
 		 * FieldAbstract.
-		 * This class is needed to help the constructor differentiate between 
+		 * This class is needed to help the constructor differentiate between
 		 * classes derived from FieldAbstract and classes that aren't.
 		 * Should be called with the same argument to both parameters?
 		 * @param	trait	pointer to FieldAbstract or class derived from it
 		 * @param	field_ptr	pointer to class derived from FieldAbstract
 		 */
 		template<class Field_qcq>
-		void constructor (FieldAbstract *trait, 
-				  Field_qcq     *field_ptr, 
-				  const integer &size = 0, 
+		void constructor (FieldAbstract *trait,
+				  Field_qcq     *field_ptr,
+				  const integer &size = 0,
 				  const integer &seed = 0)
 		{
 			typename Field_qcq::RandIter FRI(*field_ptr);
 			_randIter_ptr = FRI->construct (*field_ptr, size, seed);
 		}
-	 
-		/** Template method for constructing archetype from a class not derived 
+
+		/** @internal Template method for constructing archetype from a class not derived
 		 * from FieldAbstract.
-		 * This class is needed to help the constructor differentiate between 
+		 * This class is needed to help the constructor differentiate between
 		 * classes derived from FieldAbstract and classes that aren't.
 		 * Should be called with the same argument to both parameters?
 		 * @param	trait	pointer to class not derived from FieldAbstract
-		 * @param	field\_ptr	pointer to class not derived from FieldAbstract
+		 * @param	field_ptr	pointer to class not derived from FieldAbstract
 		 */
 		template<class Field_qcq>
-		void constructor (void      *trait, 
-				  Field_qcq *field_ptr, 
-				  const integer &size = 0, 
+		void constructor (void      *trait,
+				  Field_qcq *field_ptr,
+				  const integer &size = 0,
 				  const integer &seed = 0)
 		{
 			FieldEnvelope< Field_qcq > EnvF (*field_ptr);
@@ -217,7 +224,8 @@ namespace LinBox
 		}
 
 	}; // class RandIterArchetype
- 
+
 } // namespace LinBox
 
-#endif // __RANDITER_ARCHETYPE_H
+#endif // __LINBOX_randiter_archetype_H
+
diff --git a/linbox/randiter/envelope.h b/linbox/randiter/envelope.h
index 5b5d11a..bebc651 100644
--- a/linbox/randiter/envelope.h
+++ b/linbox/randiter/envelope.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/randiter/envelope.h
  * Copyright (C) 1999-2001 William J Turner,
  *               2002 Bradford Hovinen
@@ -23,36 +23,35 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __RANDITER_ENVELOPE_H
-#define __RANDITER_ENVELOPE_H
+#ifndef __LINBOX_randiter_envelope_H
+#define __LINBOX_randiter_envelope_H
 
 #include <iostream>
 #include "linbox/field/envelope.h"
 #include "linbox/element/envelope.h"
 #include "linbox/randiter/abstract.h"
 
-namespace LinBox 
-{ 
+namespace LinBox
+{
 
 	/** Random field base element generator.
-	 * This encapsulated class is a generator of random field base elements for 
+	 * This encapsulated class is a generator of random field base elements for
 	 * the encapsulating field.
 	 * It is required to contain constructors from a field object and
-	 * two integers.  The first integer being a cardinality of a set to 
-	 * draw the random elements from, and the second being a seed for the 
+	 * two integers.  The first integer being a cardinality of a set to
+	 * draw the random elements from, and the second being a seed for the
 	 * random number generator.
 	 * It is also required to contain a copy constructor, a destructor, and
-	 * an operator() which acts on a reference to a field base element.  In this 
-	 * operator(), the random element is placed into the input field base element 
+	 * an operator() which acts on a reference to a field base element.  In this
+	 * operator(), the random element is placed into the input field base element
 	 * and also returned as a reference.
 	 */
 	template <class Field>
-	class RandIterEnvelope : public RandIterAbstract
-	{
-	    public:
+	class RandIterEnvelope : public RandIterAbstract {
+	public:
 
 		/// element type
-                //typedef ElementAbstract element;
+		//typedef ElementAbstract element;
 		typedef ElementEnvelope<Field> Element;
 
 		/** Constructor from field, sampling size, and seed.
@@ -62,20 +61,23 @@ namespace LinBox
 		 * 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.
 		 * @param F LinBox field envelope object in which to do arithmetic
-		 * @param size constant integer reference of sample size from which to 
+		 * @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)
 		 */
-		RandIterEnvelope (const FieldEnvelope<Field> &F, 
-				   const integer &size = 0, 
-				   const integer &seed = 0)
-			: _randIter (F._field, size, seed) {}
+		RandIterEnvelope (const FieldEnvelope<Field> &F,
+				  const integer &size = 0,
+				  const integer &seed = 0) :
+			_randIter (F._field, size, seed)
+		{}
 
 		/** Constructor from random field element generator to be wrapped
 		 * @param R random field element generator object to be wrapped
 		 */
-		RandIterEnvelope (const typename Field::RandIter &R) : _randIter (R) {}
+		RandIterEnvelope (const typename Field::RandIter &R) :
+			_randIter (R)
+		{}
 
 		/** Copy constructor.
 		 * Constructs RandIterEnvelope object by copying the random field
@@ -84,14 +86,16 @@ namespace LinBox
 		 * into functions.
 		 * @param  R RandIterEnvelope object.
 		 */
-		RandIterEnvelope (const RandIterEnvelope &R) : _randIter (R._randIter) {}
+		RandIterEnvelope (const RandIterEnvelope &R) :
+			RandIterAbstract(R), _randIter (R._randIter)
+		{}
 
 		/** Destructor.
 		 * Required by abstract base class.
 		 * This destructs the random field element generator object.
 		 */
 		~RandIterEnvelope () {}
-    
+
 		/** Assignment operator.
 		 * Assigns RandIterEnvelope object R to generator.
 		 * Required by abstract base class.
@@ -104,7 +108,7 @@ namespace LinBox
 
 			return *this;
 		}
- 
+
 		/** Virtual constructor from field, sampling size, and seed.
 		 * Required because constructors cannot be virtual.
 		 * Passes construction on to derived classes.
@@ -115,15 +119,15 @@ namespace LinBox
 		 * A seed of zero means to use some arbitrary seed for the generator.
 		 * Required by abstract base class.
 		 * @param F LinBox field abstract object in which to do arithmetic
-		 * @param size constant integer reference of sample size from which to 
+		 * @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)
 		 */
-		RandIterAbstract *construct (const FieldAbstract &F, 
-					      const integer &size = 0, 
-					      const integer &seed = 0) const
-		{ 
+		RandIterAbstract *construct (const FieldAbstract &F,
+					     const integer &size = 0,
+					     const integer &seed = 0) const
+		{
 			return new RandIterEnvelope (static_cast<const FieldEnvelope<Field>&> (F)._field, size, seed);
 		}
 
@@ -134,7 +138,7 @@ namespace LinBox
 		 * @return pointer to new RandIterAbstract object in dynamic memory.
 		 */
 		RandIterAbstract* clone (void) const
-			{ return new RandIterEnvelope (*this); }
+		{ return new RandIterEnvelope (*this); }
 
 		/** Random field element creator.
 		 * This returns a random field element from the information supplied
@@ -143,17 +147,17 @@ namespace LinBox
 		 * @return reference to random field element
 		 */
 		ElementAbstract &random (ElementAbstract &a) const
-			//{ return  _randIter.random (a); }
-			// GV Thu Apr 18 14:46:46 MEST 2002
-			// modify by P.G. 2004-07-16
-                     {
-			     _randIter.random(static_cast<ElementEnvelope<Field>&> (a)._elem );
-			     return  a; 
-		     }
+		//{ return  _randIter.random (a); }
+		// GV Thu Apr 18 14:46:46 MEST 2002
+		// modify by P.G. 2004-07-16
+		{
+			_randIter.random(static_cast<ElementEnvelope<Field>&> (a)._elem );
+			return  a;
+		}
 
 
 
-	    private:
+	private:
 
 		typename Field::RandIter _randIter;
 
@@ -161,5 +165,5 @@ namespace LinBox
 
 } // namespace LinBox
 
-#endif // __RANDITER_ENVELOPE_H
+#endif // __LINBOX_randiter_envelope_H
 
diff --git a/linbox/randiter/gf2.h b/linbox/randiter/gf2.h
index 40092fa..c6fc968 100644
--- a/linbox/randiter/gf2.h
+++ b/linbox/randiter/gf2.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/randiter/gf2.h
  * Copyright (C) 2003 Bradford Hovinen
  *
@@ -10,8 +10,8 @@
  * See COPYING for license information.
  */
 
-#ifndef __RANDITER_GF2_H
-#define __RANDITER_GF2_H
+#ifndef __LINBOX_randiter_gf2_H
+#define __LINBOX_randiter_gf2_H
 
 #include <iostream>
 #include <vector>
@@ -36,99 +36,107 @@
 
 #endif
 
-namespace LinBox 
-{ 
-
-class GF2RandIter
+namespace LinBox
 {
-    public:
-	typedef bool 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 (c)).
-	 * 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.
-	 * Purely virtual.
-	 * @param F LinBox field archetype object in which to do arithmetic
-	 * @param size constant integer reference of sample size from which to 
-	 *             sample (default = modulus of field)
-	 * @param seed constant integer reference from which to seed random number
-	 *             generator (default = 0)
-	 */
-	GF2RandIter (const GF2 &F, 
-		     const integer &size = 0, 
-		     const integer &seed = 0)
-	{
-		long _seed = seed;
-
-		if (_seed == 0) _seed = time (NULL);
-		_MT.setSeed (_seed);
-	}
-
-	GF2RandIter (const GF2RandIter &R) {}
-
-	/** Destructor.
-	 * This destructs the random field element generator object.
-	 */
-	~GF2RandIter () {}
-    
-	/** Assignment operator.
-	 * Assigns ModularRandIter object R to generator.
-	 * @param  R ModularRandIter object.
-	 */
-	GF2RandIter &operator = (const GF2RandIter &R)
+
+	class GF2RandIter {
+	public:
+		typedef bool 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 (c)).
+		 * 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.
+		 * Purely virtual.
+		 * @param F    LinBox field archetype object in which to do arithmetic
+		 * @param size constant integer reference of sample size from which to
+		 *             sample (default = modulus of field)
+		 * @param seed constant integer reference from which to seed random number
+		 *             generator (default = 0)
+		 */
+		GF2RandIter (const GF2 & F,
+			     const integer &size  = 0 ,
+			     const integer &seed = 0)
+		{
+			long _seed = seed;
+
+			if (_seed == 0) _seed = time (NULL);
+			MT.setSeed (_seed);
+		}
+
+		/// constructor
+		GF2RandIter (const GF2RandIter &) {}
+
+		/** Destructor.
+		 * This destructs the random field element generator object.
+		 */
+		~GF2RandIter () {}
+
+		/** Assignment operator.
+		 * Assigns ModularRandIter object R to generator.
+		 * @param  R ModularRandIter object.
+		 */
+		GF2RandIter &operator = (const GF2RandIter & R)
 		{ return *this; }
- 
-	/** Random field element creator.
-	 * This returns a random field element from the information supplied
-	 * at the creation of the generator.
-	 * Required by abstract base class.
-	 * @return reference to random field element
-	 */
-	bool &random (bool &a)  const
-		{ return a = _MT.randomIntRange (0, 2); }
-
-	/** Random field element creator.
-	 * This returns a random field element from the information supplied
-	 * at the creation of the generator.
-	 * Required by abstract base class.
-	 * @return reference to random field element
-	 */
-	BitVector::reference random (BitVector::reference a)  const
-		{ return a = _MT.randomIntRange (0, 2); }
-
-
-	/** Random field element creator.
-	 * This returns a random field element from the information supplied
-	 * at the creation of the generator.
-	 * Required by abstract base class.
-	 * @return reference to random field element
-	 */
-	std::_Bit_reference random (std::_Bit_reference a)  const
-		{ return a = _MT.randomIntRange (0, 2); }
-
-	/** Random field element creator.
-	 * This returns a random field element from the information supplied
-	 * at the creation of the generator.
-	 * Required by abstract base class.
-	 * @return reference to random field element
-	 */
-	ElementAbstract &random (ElementAbstract &a)  const
-	{
-		bool tmp;
-
-		random (tmp);
-		return (a = ElementEnvelope <GF2> (tmp));
-	}
-
-    private:
-
-	MersenneTwister _MT;
-
-}; // class GF2RandIter
-
-} // namespace LinBox 
-
-#endif // __RANDITER_GF2_H
+
+		/** Random field element creator.
+		 * This returns a random field element from the information supplied
+		 * at the creation of the generator.
+		 * Required by abstract base class.
+		 * @return reference to random field element
+		 */
+		bool &random (bool &a)  const
+		{ return a = MT.randomIntRange (0, 2); }
+
+		/** Random field element creator.
+		 * This returns a random field element from the information supplied
+		 * at the creation of the generator.
+		 * Required by abstract base class.
+		 * @return reference to random field element
+		 */
+		BitVector::reference random (BitVector::reference a)  const
+		{ return a = MT.randomIntRange (0, 2); }
+
+
+		/** Random field element creator.
+		 * This returns a random field element from the information supplied
+		 * at the creation of the generator.
+		 * Required by abstract base class.
+		 * @return reference to random field element
+		 */
+		std::_Bit_reference random (std::_Bit_reference a)  const
+		{ return a = MT.randomIntRange (0, 2); }
+
+		/** Random field element creator.
+		 * This returns a random field element from the information supplied
+		 * at the creation of the generator.
+		 * Required by abstract base class.
+		 * @return reference to random field element
+		 */
+		ElementAbstract &random (ElementAbstract &a)  const
+		{
+			bool tmp;
+
+			random (tmp);
+			return (a = ElementEnvelope <GF2> (tmp));
+		}
+
+
+		uint32_t& random (uint32_t& a)  const
+		{ return a = MT.randomInt(); }
+
+		MersenneTwister& getMT() { return MT; }
+		const MersenneTwister& getMT() const { return MT; }
+
+	private:
+
+		MersenneTwister MT;
+
+	}; // class GF2RandIter
+
+} // namespace LinBox
+
+#endif // __LINBOX_randiter_gf2_H
+
diff --git a/linbox/randiter/gmp-random-prime.h b/linbox/randiter/gmp-random-prime.h
index ea47037..f3a3e93 100644
--- a/linbox/randiter/gmp-random-prime.h
+++ b/linbox/randiter/gmp-random-prime.h
@@ -1,27 +1,55 @@
-#ifndef __GMP_RANDOM_PRIME_H
-#define __GMP_RANDOM_PRIME_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
+/* Copyright (C) 2010 LinBox
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#error "deprecated and not tested"
+
+#ifndef __LINBOX_gmp_random_prime_H
+#define __LINBOX_gmp_random_prime_H
 
 #include <linbox/integer.h>
 
-namespace LinBox {
-/** \brief generating random prime integers, using the gmp library.
+namespace LinBox
+{
+	/** \brief generating random prime integers, using the gmp library.
 
-  * Similar to random-prime.h, but return type is integer, not long, allowing
-  * for larger primes.
-  * @author Dan Roche
-  */
+	 * Similar to random-prime.h, but return type is integer, not long, allowing
+	 * for larger primes.
+	 * @author Dan Roche
+	 * @deprecated This is not true.
+	 */
 
 	class GmpRandomPrime {
-	    public:
-	    
+	public:
+
 		integer max;
 
 		/** Create a new random prime generator.  Primes generated will
-		  * be <= max.
-		  */
-		GmpRandomPrime( integer m ) :max(m) {}
+		 * be <= max.
+		 */
+		GmpRandomPrime( integer m ) :
+			max(m)
+		{}
 
-		inline integer randomPrime() const {
+		inline integer randomPrime() const
+		{
 			integer test;
 			do test=test-1;//integer::nonzerorandom( test, max );
 			while( !probab_prime( test, 10 ) );
@@ -29,14 +57,15 @@ namespace LinBox {
 		}
 
 		// I believe reference returned is appropriate. -bds
-		//inline integer randomPrime( integer& p ) {
-		inline integer& randomPrime( integer& p ) {
+		inline integer& randomPrime( integer& p )
+		{
 			do integer::nonzerorandom( p, max );
 			while( !probab_prime( p, 10 ) );
 			return p;
 		}
-		
+
 	};
 }
 
-#endif
+#endif //__LINBOX_gmp_random_prime_H
+
diff --git a/linbox/randiter/gmp-rational.h b/linbox/randiter/gmp-rational.h
index 80e8cf0..8421473 100644
--- a/linbox/randiter/gmp-rational.h
+++ b/linbox/randiter/gmp-rational.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/randiter/gmp-rational.h
  * Copyright (C) 2001-2002 Bradford Hovinen
  *
@@ -22,8 +22,13 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __RANDITER_GMP_RATIONAL_H
-#define __RANDITER_GMP_RATIONAL_H
+/*! @file randiter/gmp-rational.h
+ * @ingroup randiter
+ * @brief Generate a random rational with prescribed size.
+ */
+
+#ifndef __LINBOX_randiter_gmp_rational_H
+#define __LINBOX_randiter_gmp_rational_H
 
 #include "linbox/field/gmp-rational.h"
 #include "linbox/element/gmp-rational.h"
@@ -37,123 +42,146 @@
 namespace LinBox
 {
 
-class GMPRationalRandIter
-{
-    public:
-    
-	typedef GMPRationalElement Element;
-    
-	GMPRationalRandIter (const GMPRationalField &F,
-			     const integer &size = 0,
-			     const integer &seed = 0)
-		: _F (F), _size (size), _seed (seed)
-	{
-		if (seed == 0)
-			_seed = time (NULL);
-	}
+	class GMPRationalRandIter {
+	public:
+
+		/// Element type.
+		typedef GMPRationalElement Element;
+
+		/*! Rational number random iterator.
+		 * @ingroup rationals
+		 * @ingroup randiter
+		 *
+		 * @param F rational field
+		 * @param size ??.
+		 * @param seed seed for random generator. By default it is 0
+		 * and a new one is created.
+		 */
+		GMPRationalRandIter (const GMPRationalField &F,
+				     const integer &size = 0,
+				     const integer &seed = 0) :
+			_F (F), _size (size), _seed (seed)
+		{
+			if (seed == 0)
+				_seed = time (NULL);
+		}
 
 
 
-	GMPRationalRandIter (const GMPRationalRandIter& R)
-		: _F (R._F), _size (R._size), _seed (R._seed) {}
+		/// Copy constructor
+		/// @param R Random iterator to copy.
+		GMPRationalRandIter (const GMPRationalRandIter& R) :
+			_F (R._F), _size (R._size), _seed (R._seed)
+		{}
 
 
 #ifdef __LINBOX_XMLENABLED
-	GMPRationalRandIter(LinBox::Reader &R) : _F(R.Down(1))
-	{
-		R.Up(1);
-		if(!R.expectTagName("randiter")) return;
-		if(!R.expectAttributeNum("seed", _seed) || !R.expectAttributeNum("size", _size)) return;
+		GMPRationalRandIter(LinBox::Reader &R) :
+			_F(R.Down(1))
+		{
+			R.Up(1);
+			if(!R.expectTagName("randiter")) return;
+			if(!R.expectAttributeNum("seed", _seed) || !R.expectAttributeNum("size", _size)) return;
 
-		if(_seed == 0) _seed = time( NULL);
+			if(_seed == 0) _seed = time( NULL);
 
-		return;
+			return;
 
-	}
+		}
 #endif
 
 
-	~GMPRationalRandIter() 
-	{}
-    
-	GMPRationalRandIter& operator=(const GMPRationalRandIter& R)
-	{
-		if (this != &R) { // guard against self-assignment
-			_F = R._F;
-			_seed = R._seed;
-			_size = R._size;
+		/// Destructor.
+		~GMPRationalRandIter()
+		{}
+
+		/*! Copy.
+		* @param R Random iterator to copy.
+		* @return a reference to this copy.
+		*/
+		GMPRationalRandIter& operator=(const GMPRationalRandIter& R)
+		{
+			if (this != &R) { // guard against self-assignment
+				_F = R._F;
+				_seed = R._seed;
+				_size = R._size;
+			}
+			return *this;
 		}
-		return *this;
-	}
- 
-	Element &random (Element &a)  const
-	{
-		unsigned int s;
-		int value = 0;
 
-		if (_size == 0) {
-			s = _seed;
-
-			value = rand_r (&s);
+		/*! get a random number.
+		 * @param[out] a a random rational.
+		 */
+		Element &random (Element &a)  const
+		{
+			unsigned int s;
+			int value = 0;
 
-			mpz_set_si (mpq_numref (a.rep), value);
+			if (_size == 0) {
+				s = _seed;
 
-			do {
 				value = rand_r (&s);
-			} while (value == 0);
 
-			const_cast<integer&>(_seed) = s;
-			mpz_set_si (mpq_denref (a.rep), value);
-		}
-		else {
-			unsigned int s;
-			int num, den;
+				mpz_set_si (mpq_numref (a.rep), value);
 
-			s = _seed;
-			num = rand_r (&s);
+				do {
+					value = rand_r (&s);
+				} while (value == 0);
 
-			if (_size > 0) {
-				unsigned long tmp = _size;
-				num %= tmp;
-				den = 1L;
-			} else {
-				den = rand_r (&s);
+				const_cast<integer&>(_seed) = s;
+				mpz_set_si (mpq_denref (a.rep), value);
+			}
+			else {
+				unsigned int s;
+				int num, den;
+
+				s = _seed;
+				num = rand_r (&s);
+
+				if (_size > 0) {
+					unsigned long tmp = _size;
+					num %= tmp;
+					den = 1L;
+				}
+				else {
+					den = rand_r (&s);
+				}
+
+				const_cast<integer&>(_seed) = s;
+
+				mpz_set_si (mpq_numref (a.rep), num);
+				mpz_set_si (mpq_denref (a.rep), den);
 			}
 
-			const_cast<integer&>(_seed) = s;
+			mpq_canonicalize (a.rep);
+
+			return a;
+		}
 
-			mpz_set_si (mpq_numref (a.rep), num);
-			mpz_set_si (mpq_denref (a.rep), den);
+		/** Random field element creator.
+		 * This returns a random field element from the information supplied
+		 * at the creation of the generator.
+		 * Required by abstract base class.
+		 * @param[out] a random field element.
+		 * @return reference to random field element \p a.
+		 */
+		ElementAbstract &random (ElementAbstract &a)  const
+		{
+			Element tmp;
+
+			random (tmp);
+			return (a = ElementEnvelope <GMPRationalField> (tmp));
 		}
 
-		mpq_canonicalize (a.rep);
-
-		return a;
-	}
- 
-	/** Random field element creator.
-	 * This returns a random field element from the information supplied
-	 * at the creation of the generator.
-	 * Required by abstract base class.
-	 * @return reference to random field element
-	 */
-	ElementAbstract &random (ElementAbstract &a)  const
-	{
-		Element tmp;
-
-		random (tmp);
-		return (a = ElementEnvelope <GMPRationalField> (tmp));
-	}
-
-    private:
-
-	GMPRationalField _F;
-
-	integer _size;
-	integer _seed;
-     
-}; // class GMPRationalRandIter
- 
+	private:
+
+		GMPRationalField _F; //!< @internal rational field
+		integer _size;       //!< @internal ??
+		integer _seed;       //!< @internal seed
+
+	}; // class GMPRationalRandIter
+
 } // namespace LinBox
 
-#endif // __RANDITER_GMP_RANDOM_H
+#endif // __LINBOX_randiter_gmp_random_H
+
diff --git a/linbox/randiter/lidia-gfq.h b/linbox/randiter/lidia-gfq.h
index bd8e450..351aa86 100644
--- a/linbox/randiter/lidia-gfq.h
+++ b/linbox/randiter/lidia-gfq.h
@@ -1,9 +1,32 @@
+/* -*- 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
+/* Copyright (C) 2010 LinBox
+ * Written by  Pascal Giorgi
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
 /* File: src/wrapper/by_scope/field/LIDIA_randiter.h
  * Author: Pascal Giorgi for the LinBox group
  */
 
-#ifndef __RANDITER_LIDIA_GFQ
-#define __RANDITER_LIDIA_GFQ
+#ifndef __LINBOX_lidia_randiter_gfq_H
+#define __LINBOX_lidia_randiter_gfq_H
 
 #include "LiDIA/gf_element.h"
 
@@ -23,106 +46,109 @@
 namespace LinBox
 {
 
- template<class field> class LidiaGfqRandIter
-    {
-    public:
-      
-
-      /* Element of the class Field
-       */
-      typedef typename field::Element Element;
-
-      /* Constructor of the class LidiaGfqRandIter .
-       * the size has to be a divisor of the degree of the Field F.
-       * the seed doesn't do something for the moment.
-       */
-      LidiaGfqRandIter(const field& F, 
-		       const integer& size = 0, 
-		       const integer& seed = 0)
-	: _size(size), _seed(seed) , GF(F)
-	{ 
-	  if (_seed == integer(0)) _seed = time(NULL);
-	  
-	  integer cardinality ;
-	  F.cardinality(cardinality);
-	  if ( (cardinality != integer(-1)) &&  (_size > cardinality) )
-	    _size = cardinality;
-	  
-	  
+	template<class field> class LidiaGfqRandIter
+	{
+	public:
+
+
+		/* Element of the class Field
+		*/
+		typedef typename field::Element Element;
+
+		/* Constructor of the class LidiaGfqRandIter .
+		 * the size has to be a divisor of the degree of the Field F.
+		 * the seed doesn't do something for the moment.
+		 */
+		LidiaGfqRandIter(const field& F,
+				 const integer& size = 0,
+				 const integer& seed = 0) :
+			_size(size), _seed(seed) , GF(F)
+		{
+			if (_seed == integer(0)) _seed = time(NULL);
+
+			integer cardinality ;
+			F.cardinality(cardinality);
+			if ( (cardinality != integer(-1)) &&  (_size > cardinality) )
+				_size = cardinality;
+
+
 #ifdef TRACE
-	  cout << "created random generator with size " << _size 
-	       << " and seed " << _seed << endl;
+			cout << "created random generator with size " << _size
+			<< " and seed " << _seed << endl;
 #endif // TRACE
-	  
-	  // Seed random number generator
-	  //srand(_seed);
-	  LiDIA::bigint tmp;
-	  
-	  string_to_bigint((std::string(seed)).c_str(),tmp);
-	  LiDIA::bigint::seed(tmp);
-      
-	  
-	}
-
-      LidiaGfqRandIter(const LidiaGfqRandIter& R)
-	: _size(R._size), _seed(R._seed), GF(R.GF) {}
-      
-      
-      ~LidiaGfqRandIter(void) {}
-      
-      
-      LidiaGfqRandIter& operator=(const LidiaGfqRandIter& R)
-	{
-	  if (this != &R) // guard against self-assignment
-	    {
-	      _size = R._size;
-	      _seed = R._seed;
-	    }
-	  
-	  return *this;
-	}           
 
+			// Seed random number generator
+			//srand(_seed);
+			LiDIA::bigint tmp;
+
+			string_to_bigint((std::string(seed)).c_str(),tmp);
+			LiDIA::bigint::seed(tmp);
+
+
+		}
+
+		LidiaGfqRandIter(const LidiaGfqRandIter& R) :
+			_size(R._size), _seed(R._seed), GF(R.GF) {}
+
+
+		~LidiaGfqRandIter(void) {}
+
+
+		LidiaGfqRandIter& operator=(const LidiaGfqRandIter& R)
+		{
+			if (this != &R) // guard against self-assignment
+			{
+				_size = R._size;
+				_seed = R._seed;
+			}
+
+			return *this;
+		}
+
+
+		Element& random (Element& x)  const
+		{
+			Element e(GF);
+			if (_size == 0)
+				e.randomize();
+			else
+				e.randomize(_size);
+
+			x.assign(e);
+			return x;
+
+			/* Another method allowing generate with a sampling size
+
+			   long temp;
+			   Element e;
+			   if (_size==0)
+			   temp= rand();
+			   else
+			   temp= static_cast<long>((double(rand())/RAND_MAX)*double(_size));
+
+			   GF.init(e,integer(temp));
+			   return x=e;
+			   */
+
+		}
+
+		LidiaGfqRandIter(void) :
+		       	_size(0), _seed(0)
+		{ time(NULL); }
+
+	private:
+
+		/// Sampling size
+		integer _size;
+
+		/// Seed
+		integer _seed;
+
+		field GF;
+
+	}; // class LidiaGfqRandIter
 
-      Element& random (Element& x)  const
-	{
-	  Element e(GF);
-	  if (_size == 0)
-	    e.randomize();
-	  else	  
-	    e.randomize(_size);
-	  
-	  x.assign(e);
-	  return x;
-	  
-	  /* Another method allowing generate with a sampling size
-	     
-	  long temp;
-	  Element e;
-	  if (_size==0)
-	  temp= rand();
-	  else
-	  temp= static_cast<long>((double(rand())/RAND_MAX)*double(_size));
-	  
-	  GF.init(e,integer(temp));
-	  return x=e;
-	  */
-	  
-	}
-      
-      LidiaGfqRandIter(void) : _size(0), _seed(0) { time(NULL); }
-      
-    private:
-      
-      /// Sampling size
-	integer _size;
-	
-	/// Seed
-	  integer _seed;
-	  
-	  field GF;
-	  
-    }; // class LidiaGfqRandIter
- 
 } // namespace LinBox
 
-#endif // -_LIDIA_RANDITER_GFQ
+#endif // __LINBOX_lidia_randiter_gfq_H
+
diff --git a/linbox/randiter/lidia.h b/linbox/randiter/lidia.h
index 14fc9eb..03b596d 100644
--- a/linbox/randiter/lidia.h
+++ b/linbox/randiter/lidia.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/randiter/lidia.h
  * Copyright (C) 2002 Pascal Giorgi
  *
@@ -8,9 +8,10 @@
  * See COPYING for license information.
  */
 
-#ifndef __RANDITER_LIDIA_H
-#define __RANDITER_LIDIA_H
+#ifndef __LINBOX_randiter_lidia_H
+#define __LINBOX_randiter_lidia_H
 
 #include "linbox/randiter/lidia-gfq.h"
 
-#endif // __RANDITER_LIDIA_H
+#endif // __LINBOX_randiter_lidia_H
+
diff --git a/linbox/randiter/mersenne-twister.C b/linbox/randiter/mersenne-twister.C
index 4405ab6..25aecf8 100644
--- a/linbox/randiter/mersenne-twister.C
+++ b/linbox/randiter/mersenne-twister.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* linbox/randiter/mersenne-twister.C
  * Copyright (C) 1997 Makoto Matsumoto and Takuji Nishimura,
@@ -34,177 +35,178 @@
 namespace LinBox
 {
 
-/* transform [0..2^32] -> [0..1] */
-static const double doubleTransform = 2.3283064365386962890625e-10;
+	/* transform [0..2^32] -> [0..1] */
+	static const double doubleTransform = 2.3283064365386962890625e-10;
 
-static const int N = 624;                // length of state vector
-static const int M = 397;                // a period parameter
-static const uint32 K = 0x9908B0DFU;     // a magic constant
+	static const int N = 624;                // length of state vector
+	static const int M = 397;                // a period parameter
+	static const uint32_t K = 0x9908B0DFU;     // a magic constant
 
-static inline uint32 hiBit (uint32 u)    // mask all but highest   bit of u
+	static inline uint32_t hiBit (uint32_t u)    // mask all but highest   bit of u
 	{ return (u) & 0x80000000U; }
-static inline uint32 loBit (uint32 u)    // mask all but lowest    bit of u
+	static inline uint32_t loBit (uint32_t u)    // mask all but lowest    bit of u
 	{ return (u) & 0x00000001U; }
-static inline uint32 loBits (uint32 u)   // mask     the highest   bit of u
+	static inline uint32_t loBits (uint32_t u)   // mask     the highest   bit of u
 	{ return (u) & 0x7FFFFFFFU; }
-static inline uint32 mixBits (uint32 u, uint32 v)   // move hi bit of u to hi bit of v
+	static inline uint32_t mixBits (uint32_t u, uint32_t v)   // move hi bit of u to hi bit of v
 	{ return hiBit (u) | loBits(v); }
 
-MersenneTwister::MersenneTwister (uint32 seed)
-	: _state (N + 1), _left (-1)
-{
-	setSeed (seed);
-}
+	MersenneTwister::MersenneTwister (uint32_t seed) :
+		_state (N + 1), _left (-1)
+	{
+		setSeed (seed);
+	}
 
-uint32 MersenneTwister::reload ()
-{
-	register std::vector<uint32>::iterator p0 = _state.begin ();
-	register std::vector<uint32>::iterator p2 = _state.begin () + 2;
-	register std::vector<uint32>::iterator pM = _state.begin () + M;
-	register uint32 s0, s1;
-	register int j;
+	uint32_t MersenneTwister::reload ()
+	{
+		std::vector<uint32_t>::iterator p0 = _state.begin ();
+		std::vector<uint32_t>::iterator p2 = _state.begin () + 2;
+		std::vector<uint32_t>::iterator pM = _state.begin () + M;
+		uint32_t s0, s1;
+		int j;
 
-	if (_left < -1)
-		setSeed (4357U);
+		if (_left < -1)
+			setSeed (4357U);
 
-	_left = N - 1, _next = _state.begin () + 1;
+		_left = N - 1, _next = _state.begin () + 1;
 
-	for(s0 = _state[0], s1 = _state[1], j = N - M + 1; --j; s0 = s1, s1 = *p2++)
-		*p0++ = *pM++ ^ (mixBits (s0, s1) >> 1) ^ (loBit (s1) ? K : 0U);
+		for(s0 = _state[0], s1 = _state[1], j = N - M + 1; --j; s0 = s1, s1 = *p2++)
+			*p0++ = *pM++ ^ (mixBits (s0, s1) >> 1) ^ (loBit (s1) ? K : 0U);
 
-	for(pM = _state.begin (), j = M; --j; s0 = s1, s1 = *p2++)
-		*p0++ = *pM++ ^ (mixBits (s0, s1) >> 1) ^ (loBit (s1) ? K : 0U);
+		for(pM = _state.begin (), j = M; --j; s0 = s1, s1 = *p2++)
+			*p0++ = *pM++ ^ (mixBits (s0, s1) >> 1) ^ (loBit (s1) ? K : 0U);
 
-	s1 = _state[0], *p0 = *pM ^ (mixBits (s0, s1) >> 1) ^ (loBit (s1) ? K : 0U);
-	s1 ^= (s1 >> 11);
-	s1 ^= (s1 <<  7) & 0x9D2C5680U;
-	s1 ^= (s1 << 15) & 0xEFC60000U;
-	return(s1 ^ (s1 >> 18));
-}
+		s1 = _state[0], *p0 = *pM ^ (mixBits (s0, s1) >> 1) ^ (loBit (s1) ? K : 0U);
+		s1 ^= (s1 >> 11);
+		s1 ^= (s1 <<  7) & 0x9D2C5680U;
+		s1 ^= (s1 << 15) & 0xEFC60000U;
+		return(s1 ^ (s1 >> 18));
+	}
 
 
-uint32 MersenneTwister::randomInt ()
-{
-	uint32 y;
+	uint32_t MersenneTwister::randomInt ()
+	{
+		uint32_t y;
 
-	if (--_left < 0)
-		return (reload ());
+		if (--_left < 0)
+			return (reload ());
 
-	y  = *_next++;
-	y ^= (y >> 11);
-	y ^= (y <<  7) & 0x9D2C5680U;
-	y ^= (y << 15) & 0xEFC60000U;
-	return (y ^ (y >> 18));
-}
+		y  = *_next++;
+		y ^= (y >> 11);
+		y ^= (y <<  7) & 0x9D2C5680U;
+		y ^= (y << 15) & 0xEFC60000U;
+		return (y ^ (y >> 18));
+	}
 
-/* N.B. The following is adapted from Glib 2.2, g_rand_double
- */
+	/* N.B. The following is adapted from Glib 2.2, g_rand_double
+	*/
 
-double MersenneTwister::randomDouble ()
-{
-	double retval;
+	double MersenneTwister::randomDouble ()
+	{
+		double retval;
 
-	do {
-		/* We set all 52 bits after the point for this, not only the first
-		   32. Thats why we need two calls to randomInt */
-		retval = randomInt () * doubleTransform;
-		retval = (retval + randomInt ()) * doubleTransform;
-	} while (retval >= 1.0);
+		do {
+			/* We set all 52 bits after the point for this, not only the first
+			   32. Thats why we need two calls to randomInt */
+			retval = randomInt () * doubleTransform;
+			retval = (retval + randomInt ()) * doubleTransform;
+		} while (retval >= 1.0);
 
-	return retval;
-}
+		return retval;
+	}
 
-/* N.B. The following is adapted from Glib 2.2, g_rand_int_range
- */
+	/* N.B. The following is adapted from Glib 2.2, g_rand_int_range
+	*/
 
-uint32 MersenneTwister::randomIntRange (uint32 start, uint32 end) 
-{
-	linbox_check (end > start);
-
-	uint32 dist = end - start;
-	uint32 random;
-
-	/* All tricks doing modulo calculations do not have a perfect
-	 * distribution -> We must use the slower way through gdouble for
-	 * maximal quality. */
-   
-	if (dist <= 0x10000L) { /* 2^16 */
-		/* This method, which only calls g_rand_int once is only good
-		 * for (end - begin) <= 2^16, because we only have 32 bits set
-		 * from the one call to g_rand_int (). */
-
-		/* we are using (trans + trans * trans), because g_rand_int only
-		 * covers [0..2^32-1] and thus g_rand_int * trans only covers
-		 * [0..1-2^-32], but the biggest double < 1 is 1-2^-52. 
-		 */
-
-		double double_rand =
+	uint32_t MersenneTwister::randomIntRange (uint32_t start, uint32_t end)
+	{
+		linbox_check (end > start);
+
+		uint32_t dist = end - start;
+		uint32_t random;
+
+		/* All tricks doing modulo calculations do not have a perfect
+		 * distribution -> We must use the slower way through gdouble for
+		 * maximal quality. */
+
+		if (dist <= 0x10000L) { /* 2^16 */
+			/* This method, which only calls g_rand_int once is only good
+			 * for (end - begin) <= 2^16, because we only have 32 bits set
+			 * from the one call to g_rand_int (). */
+
+			/* we are using (trans + trans * trans), because g_rand_int only
+			 * covers [0..2^32-1] and thus g_rand_int * trans only covers
+			 * [0..1-2^-32], but the biggest double < 1 is 1-2^-52.
+			 */
+
+			double double_rand =
 			randomInt () * (doubleTransform + doubleTransform * doubleTransform);
-      
-		random = (uint32) (double_rand * dist);
-	} else {
-		/* Now we use g_rand_double_range (), which will set 52 bits for
-		   us, so that it is safe to round and still get a decent
-		   distribution */
-		random = (uint32) randomDoubleRange (0, dist);
+
+			random = (uint32_t) (double_rand * dist);
+		}
+		else {
+			/* Now we use g_rand_double_range (), which will set 52 bits for
+			   us, so that it is safe to round and still get a decent
+			   distribution */
+			random = (uint32_t) randomDoubleRange (0, dist);
+		}
+
+		return start + random;
 	}
- 
-	return start + random;
-}
 
-void MersenneTwister::setSeed (uint32 seed) 
-{
-	//
-	// We initialize _state[0..(N-1)] via the generator
-	//
-	//   x_new = (69069 * x_old) mod 2^32
-	//
-	// from Line 15 of Table 1, p. 106, Sec. 3.3.4 of Knuth's
-	// _The Art of Computer Programming_, Volume 2, 3rd ed.
-	//
-	// Notes (SJC): I do not know what the initial state requirements
-	// of the Mersenne Twister are, but it seems this seeding generator
-	// could be better.  It achieves the maximum period for its modulus
-	// (2^30) iff x_initial is odd (p. 20-21, Sec. 3.2.1.2, Knuth); if
-	// x_initial can be even, you have sequences like 0, 0, 0, ...;
-	// 2^31, 2^31, 2^31, ...; 2^30, 2^30, 2^30, ...; 2^29, 2^29 + 2^31,
-	// 2^29, 2^29 + 2^31, ..., etc. so I force seed to be odd below.
-	//
-	// Even if x_initial is odd, if x_initial is 1 mod 4 then
-	//
-	//   the          lowest bit of x is always 1,
-	//   the  next-to-lowest bit of x is always 0,
-	//   the 2nd-from-lowest bit of x alternates      ... 0 1 0 1 0 1 0 1 ... ,
-	//   the 3rd-from-lowest bit of x 4-cycles        ... 0 1 1 0 0 1 1 0 ... ,
-	//   the 4th-from-lowest bit of x has the 8-cycle ... 0 0 0 1 1 1 1 0 ... ,
-	//    ...
-	//
-	// and if x_initial is 3 mod 4 then
-	//
-	//   the          lowest bit of x is always 1,
-	//   the  next-to-lowest bit of x is always 1,
-	//   the 2nd-from-lowest bit of x alternates      ... 0 1 0 1 0 1 0 1 ... ,
-	//   the 3rd-from-lowest bit of x 4-cycles        ... 0 0 1 1 0 0 1 1 ... ,
-	//   the 4th-from-lowest bit of x has the 8-cycle ... 0 0 1 1 1 1 0 0 ... ,
-	//    ...
-	//
-	// The generator's potency (min. s>=0 with (69069-1)^s = 0 mod 2^32) is
-	// 16, which seems to be alright by p. 25, Sec. 3.2.1.3 of Knuth.  It
-	// also does well in the dimension 2..5 spectral tests, but it could be
-	// better in dimension 6 (Line 15, Table 1, p. 106, Sec. 3.3.4, Knuth).
-	//
-	// Note that the random number user does not see the values generated
-	// here directly since reloadMT() will always munge them first, so maybe
-	// none of all of this matters.  In fact, the seed values made here could
-	// even be extra-special desirable if the Mersenne Twister theory says
-	// so-- that's why the only change I made is to restrict to odd seeds.
-	//
-
-	register uint32 x = (seed | 1U) & 0xFFFFFFFFU;
-	register std::vector<uint32>::iterator s = _state.begin ();
-	register int j;
-
-	for (_left = 0, *s++ = x, j = N; --j; *s++ = (x *= 69069U) & 0xFFFFFFFFU);
-}
+	void MersenneTwister::setSeed (uint32_t seed)
+	{
+		//
+		// We initialize _state[0..(N-1)] via the generator
+		//
+		//   x_new = (69069 * x_old) mod 2^32
+		//
+		// from Line 15 of Table 1, p. 106, Sec. 3.3.4 of Knuth's
+		// _The Art of Computer Programming_, Volume 2, 3rd ed.
+		//
+		// Notes (SJC): I do not know what the initial state requirements
+		// of the Mersenne Twister are, but it seems this seeding generator
+		// could be better.  It achieves the maximum period for its modulus
+		// (2^30) iff x_initial is odd (p. 20-21, Sec. 3.2.1.2, Knuth); if
+		// x_initial can be even, you have sequences like 0, 0, 0, ...;
+		// 2^31, 2^31, 2^31, ...; 2^30, 2^30, 2^30, ...; 2^29, 2^29 + 2^31,
+		// 2^29, 2^29 + 2^31, ..., etc. so I force seed to be odd below.
+		//
+		// Even if x_initial is odd, if x_initial is 1 mod 4 then
+		//
+		//   the          lowest bit of x is always 1,
+		//   the  next-to-lowest bit of x is always 0,
+		//   the 2nd-from-lowest bit of x alternates      ... 0 1 0 1 0 1 0 1 ... ,
+		//   the 3rd-from-lowest bit of x 4-cycles        ... 0 1 1 0 0 1 1 0 ... ,
+		//   the 4th-from-lowest bit of x has the 8-cycle ... 0 0 0 1 1 1 1 0 ... ,
+		//    ...
+		//
+		// and if x_initial is 3 mod 4 then
+		//
+		//   the          lowest bit of x is always 1,
+		//   the  next-to-lowest bit of x is always 1,
+		//   the 2nd-from-lowest bit of x alternates      ... 0 1 0 1 0 1 0 1 ... ,
+		//   the 3rd-from-lowest bit of x 4-cycles        ... 0 0 1 1 0 0 1 1 ... ,
+		//   the 4th-from-lowest bit of x has the 8-cycle ... 0 0 1 1 1 1 0 0 ... ,
+		//    ...
+		//
+		// The generator's potency (min. s>=0 with (69069-1)^s = 0 mod 2^32) is
+		// 16, which seems to be alright by p. 25, Sec. 3.2.1.3 of Knuth.  It
+		// also does well in the dimension 2..5 spectral tests, but it could be
+		// better in dimension 6 (Line 15, Table 1, p. 106, Sec. 3.3.4, Knuth).
+		//
+		// Note that the random number user does not see the values generated
+		// here directly since reloadMT() will always munge them first, so maybe
+		// none of all of this matters.  In fact, the seed values made here could
+		// even be extra-special desirable if the Mersenne Twister theory says
+		// so-- that's why the only change I made is to restrict to odd seeds.
+		//
+
+		uint32_t x = (seed | 1U) & 0xFFFFFFFFU;
+		std::vector<uint32_t>::iterator s = _state.begin ();
+		int j;
+
+		for (_left = 0, *s++ = x, j = N; --j; *s++ = (x *= 69069U) & 0xFFFFFFFFU) ;
+	}
 
 }
diff --git a/linbox/randiter/mersenne-twister.h b/linbox/randiter/mersenne-twister.h
index b7cfc8f..252881d 100644
--- a/linbox/randiter/mersenne-twister.h
+++ b/linbox/randiter/mersenne-twister.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/randiter/mersenne-twister.h
  * Copyright (C) 2002 Bradford Hovinen
  *
@@ -24,8 +24,8 @@
  * generator tests.
  */
 
-#ifndef __MERSENNE_TWISTER_H
-#define __MERSENNE_TWISTER_H
+#ifndef __LINBOX_mersenne_twister_H
+#define __LINBOX_mersenne_twister_H
 
 #include <vector>
 
@@ -34,40 +34,40 @@
 namespace LinBox
 {
 
-class MersenneTwister 
-{
-    public:
-	MersenneTwister (uint32 seed = 0);
+	class MersenneTwister {
+	public:
+		MersenneTwister (uint32_t seed = 0);
 
-	uint32 reload ();
-	uint32 randomInt ();
-	uint32 randomInt () const
-	{ return const_cast<MersenneTwister&>(*this).randomInt();}
+		uint32_t reload ();
+		uint32_t randomInt ();
+		uint32_t randomInt () const
+		{ return const_cast<MersenneTwister&>(*this).randomInt();}
 
-	uint32 randomIntRange (uint32 start, uint32 end);
-	uint32 randomIntRange (uint32 start, uint32 end) const
-	{ return const_cast<MersenneTwister&>(*this).randomIntRange(start,end); }
+		uint32_t randomIntRange (uint32_t start, uint32_t end);
+		uint32_t randomIntRange (uint32_t start, uint32_t end) const
+		{ return const_cast<MersenneTwister&>(*this).randomIntRange(start,end); }
 
-	double randomDouble ();
-	double randomDouble ()  const
-	{ return const_cast<MersenneTwister&>(*this).randomDouble(); }
+		double randomDouble ();
+		double randomDouble ()  const
+		{ return const_cast<MersenneTwister&>(*this).randomDouble(); }
 
-	double randomDoubleRange (double start, double end)
+		double randomDoubleRange (double start, double end)
 		{ return randomDouble () * (end - start) + start; }
-	double randomDoubleRange (double start, double end) const
-	{ return const_cast<MersenneTwister&>(*this).randomDoubleRange(start,end); }
+		double randomDoubleRange (double start, double end) const
+		{ return const_cast<MersenneTwister&>(*this).randomDoubleRange(start,end); }
 
-	void setSeed (uint32 seed);
+		void setSeed (uint32_t seed);
+
+	private:
+		std::vector<uint32_t>           _state;
+		std::vector<uint32_t>::iterator _next;
+		int                           _left;
+	};
 
-    private:
-	std::vector<uint32>           _state;
-	std::vector<uint32>::iterator _next;
-	int                           _left;
-};
- 
 }
 
 #ifdef LinBoxSrcOnly
 #include <linbox/randiter/mersenne-twister.C>
 #endif
-#endif // __MERSENNE_TWISTER_H
+#endif // __LINBOX_mersenne_twister_H
+
diff --git a/linbox/randiter/modular-balanced.h b/linbox/randiter/modular-balanced.h
index baeef4c..eb71a16 100644
--- a/linbox/randiter/modular-balanced.h
+++ b/linbox/randiter/modular-balanced.h
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* linbox/randiter/modular-balanced.h
  * Copyright (C) 1999-2005 William J Turner,
@@ -29,8 +30,8 @@
  * See COPYING for license information.
  */
 
-#ifndef __RANDITER_MODULAR_BALANCED_H
-#define __RANDITER_MODULAR_BALANCED_H
+#ifndef __LINBOX_randiter_modular_balanced_H
+#define __LINBOX_randiter_modular_balanced_H
 
 #include <iostream>
 #include <vector>
@@ -40,31 +41,30 @@
 #include "linbox/element/abstract.h"
 #include "linbox/element/envelope.h"
 #include "linbox/util/commentator.h"
-#include "linbox/randiter/mersenne-twister.h"
+//#include "linbox/randiter/mersenne-twister.h"
 #include "linbox/linbox-config.h"
 
-namespace LinBox 
-{ 
+namespace LinBox
+{
 
 	template <class Element>
 	class ModularBalanced;
 
 	/** Random field base element generator.
-	 * This encapsulated class is a generator of random field base elements for 
+	 * This encapsulated class is a generator of random field base elements for
 	 * the encapsulating field.
 	 * It is required to contain constructors from a field object and
-	 * two integers.  The first integer being a cardinality of a set to 
-	 * draw the random elements from, and the second being a seed for the 
+	 * two integers.  The first integer being a cardinality of a set to
+	 * draw the random elements from, and the second being a seed for the
 	 * random number generator.
 	 * It is also required to contain a copy constructor, a destructor, and
-	 * an operator () which acts on a reference to a field base element.  In this 
-	 * operator (), the random element is placed into the input field base element 
+	 * an operator () which acts on a reference to a field base element.  In this
+	 * operator (), the random element is placed into the input field base element
 	 * and also returned as a reference.
 	 */
 	template <class Element>
-	class ModularBalancedRandIter
-	{
-	    public:
+	class ModularBalancedRandIter {
+	public:
 
 		/** Constructor from field, sampling size, and seed.
 		 * The random field element iterator works in the field F, is seeded
@@ -74,15 +74,15 @@ namespace LinBox
 		 * A seed of zero means to use some arbitrary seed for the generator.
 		 * Purely virtual.
 		 * @param F LinBox field archetype object in which to do arithmetic
-		 * @param size constant integer reference of sample size from which to 
+		 * @param size constant integer reference of sample size from which to
 		 *             sample (default = modulus of field)
 		 * @param seed constant integer reference from which to seed random number
 		 *             generator (default = 0)
 		 */
-		ModularBalancedRandIter (const ModularBalanced<Element> &F, 
-				 const integer &size = 0, 
-				 const integer &seed = 0)
-			: _F (F), _size (size), _seed (seed)
+		ModularBalancedRandIter (const ModularBalanced<Element> &F,
+					 const integer &size = 0,
+					 const integer &seed = 0) :
+			_F (F), _size (size), _seed (seed)
 		{
 			if (_seed == 0) _seed = time (NULL);
 
@@ -94,8 +94,8 @@ namespace LinBox
 				_size = cardinality;
 
 			commentator.report (10, INTERNAL_DESCRIPTION)
-				<< "Created random generator with size " << _size 
-				<< " and seed " << _seed << std::endl;
+			<< "Created random generator with size " << _size
+			<< " and seed " << _seed << std::endl;
 
 			// Seed random number generator
 			srand (_seed);
@@ -108,14 +108,15 @@ namespace LinBox
 		 * into functions.
 		 * @param  R ModularBalancedRandIter object.
 		 */
-		ModularBalancedRandIter (const ModularBalancedRandIter<Element> &R) 
-			: _F (R._F), _size (R._size), _seed (R._seed) {}
+		ModularBalancedRandIter (const ModularBalancedRandIter<Element> &R) :
+			_F (R._F), _size (R._size), _seed (R._seed)
+		{}
 
 		/** Destructor.
 		 * This destructs the random field element generator object.
 		 */
 		~ModularBalancedRandIter () {}
-    
+
 		/** Assignment operator.
 		 * Assigns ModularBalancedRandIter object R to generator.
 		 * @param  R ModularBalancedRandIter object.
@@ -129,7 +130,7 @@ namespace LinBox
 
 			return *this;
 		}
- 
+
 		/** Random field element creator.
 		 * This returns a random field element from the information supplied
 		 * at the creation of the generator.
@@ -153,18 +154,19 @@ namespace LinBox
 			return (a = ElementEnvelope <ModularBalanced<Element> > (tmp));
 		}
 
-	    private:
+	private:
 		/// Field in which arithmetic is done
 		ModularBalanced<Element> _F;
 
 		/// Sampling size
 		integer _size;
-    
+
 		/// Seed
 		long _seed;
 
 	}; // class ModularBalancedRandIter
 
-} // namespace LinBox 
+} // namespace LinBox
+
+#endif //__LINBOX_randiter_modular_balanced_H
 
-#endif 
diff --git a/linbox/randiter/modular-crooked.h b/linbox/randiter/modular-crooked.h
new file mode 100644
index 0000000..5b819e2
--- /dev/null
+++ b/linbox/randiter/modular-crooked.h
@@ -0,0 +1,152 @@
+/* -*- 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
+
+/* linbox/randiter/modular-crooked.h
+ * Copyright (C) 2010 LinBox
+ *
+ * Adapted from randiter/modular-dense.h
+ * by Brice Boyer <brice.boyer at imag.fr>
+ *
+ * See COPYING for license information.
+ */
+
+#ifndef __LINBOX_randiter_modular_crooked_H
+#define __LINBOX_randiter_modular_crooked_H
+
+#include <iostream>
+#include <vector>
+
+#include "time.h"
+#include "linbox/integer.h"
+#include "linbox/element/abstract.h"
+#include "linbox/element/envelope.h"
+#include "linbox/util/commentator.h"
+//#include "linbox/randiter/mersenne-twister.h"
+#include "linbox/linbox-config.h"
+
+namespace LinBox
+{
+
+	template <class Element>
+	class ModularCrooked;
+
+	/** Random field base element generator.
+	 * This encapsulated class is a generator of random field base elements for
+	 * the encapsulating field.
+	 * It is required to contain constructors from a field object and
+	 * two integers.  The first integer being a cardinality of a set to
+	 * draw the random elements from, and the second being a seed for the
+	 * random number generator.
+	 * It is also required to contain a copy constructor, a destructor, and
+	 * an operator () which acts on a reference to a field base element.  In this
+	 * operator (), the random element is placed into the input field base element
+	 * and also returned as a reference.
+	 */
+	template <class Element>
+	class ModularCrookedRandIter {
+	public:
+
+		/** 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 (c)).
+		 * 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.
+		 * Purely virtual.
+		 * @param F LinBox field archetype object in which to do arithmetic
+		 * @param size constant integer reference of sample size from which to
+		 *             sample (default = modulus of field)
+		 * @param seed constant integer reference from which to seed random number
+		 *             generator (default = 0)
+		 */
+		ModularCrookedRandIter (const ModularCrooked<Element> &F,
+					const integer &size = 0,
+					const integer &seed = 0) :
+			_F (F), _size (size), _seed (seed)
+		{
+			if (_seed == 0) _seed = time (NULL);
+
+			integer cardinality;
+
+			F.cardinality (cardinality);
+
+			if ((_size == 0) || (_size > cardinality))
+				_size = cardinality;
+
+			commentator.report (10, INTERNAL_DESCRIPTION)
+			<< "Created random generator with size " << _size
+			<< " and seed " << _seed << std::endl;
+
+			// Seed random number generator
+			srand (_seed);
+		}
+
+		/** Copy constructor.
+		 * Constructs ModularCrookedRandIter object by copying the random field
+		 * element generator.
+		 * This is required to allow generator objects to be passed by value
+		 * into functions.
+		 * @param  R ModularCrookedRandIter object.
+		 */
+		ModularCrookedRandIter (const ModularCrookedRandIter<Element> &R) :
+			_F (R._F), _size (R._size), _seed (R._seed)
+		{}
+
+		/** Destructor.
+		 * This destructs the random field element generator object.
+		 */
+		~ModularCrookedRandIter () {}
+
+		/** Assignment operator.
+		 * Assigns ModularCrookedRandIter object R to generator.
+		 * @param  R ModularCrookedRandIter object.
+		 */
+		ModularCrookedRandIter<Element> &operator=(const ModularCrookedRandIter<Element> &R)
+		{
+			if (this != &R) { // guard against self-assignment
+				_size = R._size;
+				_seed = R._seed;
+			}
+
+			return *this;
+		}
+
+		/** Random field element creator.
+		 * This returns a random field element from the information supplied
+		 * at the creation of the generator.
+		 * Required by abstract base class.
+		 * @return reference to random field element
+		 */
+		Element &random (Element &a) const
+		{ return _F.init(a,rand()); }
+
+		/** Random field element creator.
+		 * This returns a random field element from the information supplied
+		 * at the creation of the generator.
+		 * Required by abstract base class.
+		 * @return reference to random field element
+		 */
+		ElementAbstract &random (ElementAbstract &a) const
+		{
+			Element tmp;
+
+			random (tmp);
+			return (a = ElementEnvelope <ModularCrooked<Element> > (tmp));
+		}
+
+	private:
+		/// Field in which arithmetic is done
+		ModularCrooked<Element> _F;
+
+		/// Sampling size
+		integer _size;
+
+		/// Seed
+		long _seed;
+
+	}; // class ModularCrookedRandIter
+
+} // namespace LinBox
+
+#endif //__LINBOX_randiter_modular_crooked_H
+
diff --git a/linbox/randiter/modular.h b/linbox/randiter/modular.h
index db3a351..11eb4c1 100644
--- a/linbox/randiter/modular.h
+++ b/linbox/randiter/modular.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/randiter/modular.h
  * Copyright (C) 1999-2005 William J Turner,
  *               2002 Bradford Hovinen
@@ -29,8 +29,8 @@
  * See COPYING for license information.
  */
 
-#ifndef __RANDITER_MODULAR_H
-#define __RANDITER_MODULAR_H
+#ifndef __LINBOX_randiter_modular_H
+#define __LINBOX_randiter_modular_H
 
 #include <iostream>
 #include <vector>
@@ -44,43 +44,42 @@
 #include "linbox/randiter/mersenne-twister.h"
 #include "linbox/linbox-config.h"
 
-namespace LinBox 
-{ 
+namespace LinBox
+{
 
 	/** Random field base element generator.
-	 * This encapsulated class is a generator of random field base elements for 
+	 * This encapsulated class is a generator of random field base elements for
 	 * the encapsulating field.
 	 * It is required to contain constructors from a field object and
-	 * two integers.  The first integer being a cardinality of a set to 
-	 * draw the random elements from, and the second being a seed for the 
+	 * two integers.  The first integer being a cardinality of a set to
+	 * draw the random elements from, and the second being a seed for the
 	 * random number generator.
 	 * It is also required to contain a copy constructor, a destructor, and
-	 * an operator () which acts on a reference to a field base element.  In this 
-	 * operator (), the random element is placed into the input field base element 
+	 * an operator () which acts on a reference to a field base element.  In this
+	 * operator (), the random element is placed into the input field base element
 	 * and also returned as a reference.
 	 */
 	template <class Element>
-	class ModularRandIter
-	{
-	    public:
+	class ModularRandIter {
+	public:
 
 		/** 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 (c)).
+		 * than <code>1/min (size, F.cardinality (c))</code>.
 		 * 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.
 		 * Purely virtual.
 		 * @param F LinBox field archetype object in which to do arithmetic
-		 * @param size constant integer reference of sample size from which to 
+		 * @param size constant integer reference of sample size from which to
 		 *             sample (default = modulus of field)
 		 * @param seed constant integer reference from which to seed random number
-		 *             generator (default = 0)
+		 *             generator (default is 0 and new seed is generated)
 		 */
-		ModularRandIter (const Modular<Element> &F, 
-				 const integer &size = 0, 
-				 const integer &seed = 0)
-			: _F (F), _size (size), _seed (seed)
+		ModularRandIter (const Modular<Element> &F,
+				 const integer &size = 0,
+				 const integer &seed = 0) :
+			_F (F), _size (size), _seed (seed)
 		{
 			if (_seed == 0) _seed = time (NULL);
 
@@ -92,8 +91,8 @@ namespace LinBox
 				_size = cardinality;
 
 			commentator.report (10, INTERNAL_DESCRIPTION)
-				<< "Created random generator with size " << _size 
-				<< " and seed " << _seed << std::endl;
+			<< "Created random generator with size " << _size
+			<< " and seed " << _seed << std::endl;
 
 			// Seed random number generator
 			srand (_seed);
@@ -106,14 +105,15 @@ namespace LinBox
 		 * into functions.
 		 * @param  R ModularRandIter object.
 		 */
-		ModularRandIter (const ModularRandIter<Element> &R) 
-			: _F (R._F), _size (R._size), _seed (R._seed) {}
+		ModularRandIter (const ModularRandIter<Element> &R) :
+			_F (R._F), _size (R._size), _seed (R._seed)
+		{}
 
 		/** Destructor.
 		 * This destructs the random field element generator object.
 		 */
 		~ModularRandIter () {}
-    
+
 		/** Assignment operator.
 		 * Assigns ModularRandIter object R to generator.
 		 * @param  R ModularRandIter object.
@@ -127,7 +127,7 @@ namespace LinBox
 
 			return *this;
 		}
- 
+
 		/** Random field element creator.
 		 * This returns a random field element from the information supplied
 		 * at the creation of the generator.
@@ -145,10 +145,10 @@ namespace LinBox
 		 */
 		Element &nonzerorandom (Element &a) const
 		{
-			//return a = rand() % (_F.modulus -1) + 1; }
+			//return a = rand() % (_F.modulus -1) + 1;
 
 			// CPernet: stupidly slow, but now way to get _F.modulus without changing the interface
-			while (_F.isZero (random(a)));
+			while (_F.isZero (random(a))) ;
 			return a;
 		}
 
@@ -166,14 +166,14 @@ namespace LinBox
 			return (a = ElementEnvelope <Modular<Element> > (tmp));
 		}
 
-	    private:
+	private:
 
 		/// Field in which arithmetic is done
 		Modular<Element> _F;
 
 		/// Sampling size
 		integer _size;
-    
+
 		/// Seed
 		long _seed;
 
@@ -183,30 +183,32 @@ namespace LinBox
 	class ModularBase<Element>::RandIter {
 		ModularRandIter<Element> _r;
 
-	    public:
-		RandIter (const Modular<Element> &F, const integer &size = 0, const integer &seed = 0)
-			: _r (F, size, seed) {}
-		RandIter (const ModularBase<Element>::RandIter &r)
-			: _r (r._r) {}
+	public:
+		RandIter (const Modular<Element> &F, const integer &size = 0, const integer &seed = 0) :
+			_r (F, size, seed)
+		{}
+		RandIter (const ModularBase<Element>::RandIter &r) :
+			_r (r._r)
+		{}
 
 		~RandIter () {}
 		RandIter &operator= (const RandIter &r)
-			{ _r = r._r; return *this; }
+		{ _r = r._r; return *this; }
 		Element &random (Element &a) const
-			{ return _r.random (a); }
+		{ return _r.random (a); }
 		ElementAbstract &random (ElementAbstract &a) const
-			{ return _r.random (a); }
+		{ return _r.random (a); }
 
 	};
 
 	template <>
-	class ModularBase<uint16>::RandIter {
+	class ModularBase<uint16_t>::RandIter {
 		MersenneTwister _r;
-		uint16 _size;
-		uint16 _seed;
+		uint16_t _size;
+		time_t _seed;
 
-	    public:
-		typedef uint16 Element;
+	public:
+		typedef uint16_t Element;
 
 		RandIter (const Modular<Element> &F, const integer &size = 0, const integer &seed = 0)
 		{
@@ -227,28 +229,77 @@ namespace LinBox
 			_r.setSeed (_seed);
 		}
 
-		RandIter (const ModularBase<Element>::RandIter &r)
-			: _r (r._r), _size (r._size), _seed (r._seed) {}
+		RandIter (const ModularBase<Element>::RandIter &r) :
+			_r (r._r), _size (r._size), _seed (r._seed)
+		{}
 
 		~RandIter () {}
 		RandIter &operator= (const RandIter &r)
-			{ _r = r._r; return *this; }
+		{
+			_r = r._r;
+			return *this;
+	       	}
 		Element &random (Element &a) const
-			{ return a = _r.randomIntRange (0, _size); }
+		{
+			return a = (Element)_r.randomIntRange (0, _size);
+		}
 		ElementAbstract &random (ElementAbstract &a)  const
-			{ return a = ElementEnvelope <Modular<Element> >
-				  (_r.randomIntRange (0, _size)); }
+		{ return a = ElementEnvelope <Modular<Element> >
+			(_r.randomIntRange (0, _size)); }
+
+	};
+
+	template <>
+	class ModularBase<uint32_t>::RandIter {
+		MersenneTwister _r;
+		uint32_t _size;
+		time_t _seed;
+
+	public:
+		typedef uint32_t Element;
+
+		RandIter (const Modular<Element> &F, const integer &size = 0, const integer &seed = 0)
+		{
+			_seed = seed;
+			_size = size;
+
+			if (_seed == 0) _seed = time (NULL);
+
+			integer c;
+
+			F.cardinality (c);
+
+			linbox_check (c != -1);
+
+			if ((_size == 0) || (_size > double (c)))
+				_size = c;
+
+			_r.setSeed (_seed);
+		}
+
+		RandIter (const ModularBase<Element>::RandIter &r) :
+			_r (r._r), _size (r._size), _seed (r._seed)
+		{}
+
+		~RandIter () {}
+		RandIter &operator= (const RandIter &r)
+		{ _r = r._r; return *this; }
+		Element &random (Element &a) const
+		{ return a = _r.randomIntRange (0, _size); }
+		ElementAbstract &random (ElementAbstract &a) const
+		{ return a = ElementEnvelope <Modular<Element> >
+			(_r.randomIntRange (0, _size)); }
 
 	};
 
 	template <>
-	class ModularBase<uint32>::RandIter {
+	class ModularBase<uint64_t>::RandIter {
 		MersenneTwister _r;
-		uint32 _size;
-		uint32 _seed;
+		uint64_t _size;
+		time_t _seed;
 
-	    public:
-		typedef uint32 Element;
+	public:
+		typedef uint64_t Element;
 
 		RandIter (const Modular<Element> &F, const integer &size = 0, const integer &seed = 0)
 		{
@@ -269,19 +320,22 @@ namespace LinBox
 			_r.setSeed (_seed);
 		}
 
-		RandIter (const ModularBase<Element>::RandIter &r)
-			: _r (r._r), _size (r._size), _seed (r._seed) {}
+		RandIter (const ModularBase<Element>::RandIter &r) :
+			_r (r._r), _size (r._size), _seed (r._seed)
+		{}
 
 		~RandIter () {}
 		RandIter &operator= (const RandIter &r)
-			{ _r = r._r; return *this; }
+		{ _r = r._r; return *this; }
 		Element &random (Element &a) const
-			{ return a = _r.randomIntRange (0, _size); }
+		{ return a = _r.randomIntRange (0, _size); }
 		ElementAbstract &random (ElementAbstract &a) const
-			{ return a = ElementEnvelope <Modular<Element> >
-				  (_r.randomIntRange (0, _size)); }
+		{ return a = ElementEnvelope <Modular<Element> >
+			(_r.randomIntRange (0, _size)); }
 
 	};
-} // namespace LinBox 
 
-#endif // _LARGE_MODULAR_RANDITER_
+}// namespace LinBox
+
+#endif // __LINBOX_randiter_modular_H
+
diff --git a/linbox/randiter/multimod-randomprime.h b/linbox/randiter/multimod-randomprime.h
index eeccc1b..6508d84 100644
--- a/linbox/randiter/multimod-randomprime.h
+++ b/linbox/randiter/multimod-randomprime.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/randiter/multimod-randomprime.h
  * Copyright (C) 2005 Pascal Giorgi
  *
@@ -11,16 +11,17 @@
  */
 
 
-#ifndef _MULTIMOD_RANDOM_PRIME_H__
-#define _MULTIMOD_RANDOM_PRIME_H__
+#ifndef __LINBOX_multimod_random_prime_H
+#define __LINBOX_multimod_random_prime_H
 
 #include <linbox/integer.h>
 #include <linbox/util/timer.h>
 #include <vector>
 
-namespace LinBox {
-	
-	class MultiModRandomPrime {		
+namespace LinBox
+{
+
+	class MultiModRandomPrime {
 	protected:
 
 		size_t   _bits;
@@ -28,76 +29,82 @@ namespace LinBox {
 		integer _shift;
 
 	public:
-		
 
-		MultiModRandomPrime(size_t n=1, size_t bits = 30, unsigned long seed = 0) 
-			: _bits(bits), _size(n)
+
+		MultiModRandomPrime(size_t n=1, size_t bits = 30, unsigned long seed = 0) :
+			_bits(bits), _size(n)
 		{
 			_shift = integer(1)<<_bits;
 
-			if (! seed) 
+			if (! seed)
 				MultiModRandomPrime::setSeed( BaseTimer::seed() );
 			else
 				MultiModRandomPrime::setSeed( seed );
 		}
-	  
+
 		// define the prime type
 		typedef std::vector<integer> Prime_Type;
-	  
-		/** @memo randomPrime()
+
+		/** \c randomPrime().
 		 *  return a vector of random prime
 		 */
-		inline Prime_Type randomPrime() const {std::cout<<"ist used\n";
+		inline Prime_Type randomPrime() const
+		{
+			std::cout<<"ist used\n";
 			std::vector<integer> tmp(_size);
 			for (size_t i=0;i<_size; ++i){
 				do {
 					integer::random(tmp[i],_bits-1);
 					tmp[i]= _shift-tmp[i];
-					nextprime(tmp[i],tmp[i]);					
-				} while (find(tmp.begin(), tmp.begin()+i, tmp[i]) != (tmp.begin()+i ));				
-			}				
+					nextprime(tmp[i],tmp[i]);
+				} while (std::find(tmp.begin(), tmp.begin()+i, tmp[i]) != (tmp.begin()+i ));
+			}
 			return tmp;
 		}
-	  
-		/** @memo randomPrime(Prime_Type& p)
+
+		/** @c randomPrime(Prime_Type& p).
 		 *  return a random prime
 		 */
-		inline Prime_Type randomPrime (Prime_Type& p) const {
+		inline Prime_Type randomPrime (Prime_Type& p) const
+		{
 			for (size_t i=0;i<p.size(); ++i){
 				do {
 					integer::random(p[i],_bits-1);
 					p[i]= _shift-p[i];
 					nextprime(p[i],p[i]);
-				} while (find(p.begin(), p.begin()+i-1, p[i]) != (p.begin()+i-1 ));		
+				} while (std::find(p.begin(), p.begin()+i-1, p[i]) != (p.begin()+i-1 ));
 			}
 			return p;
 		}
-	  
 
-		/** @memo setSeed (unsigned long ul)
+
+		/** @c setSeed(unsigned long ul).
 		 *  Set the random seed to be ul.
 		 */
-		void static setSeed(unsigned long ul) { 
+		void static setSeed(unsigned long ul)
+		{
 			integer::seeding(ul);
 		}
 
 
-		inline Prime_Type createPrimes (const integer& maxPrime, const integer& productBound) const {
+		inline Prime_Type createPrimes (const integer& maxPrime, const integer& productBound) const
+		{
 			Prime_Type tmp;
-			integer acc=1, cur=maxPrime; 
-			
+			integer acc=1, cur=maxPrime;
+
 			do {
 				prevprime(cur, cur);
 				tmp.push_back(cur);
-				acc*=cur;				
+				acc*=cur;
 			} while (acc < productBound);
 
 			return tmp;
 		}
-		
-	  
-	  
+
+
+
 	};
 }
 
-#endif
+#endif //__LINBOX_multimod_random_prime_H
+
diff --git a/linbox/randiter/nonzero.h b/linbox/randiter/nonzero.h
index c1eecd2..fe3ce0a 100644
--- a/linbox/randiter/nonzero.h
+++ b/linbox/randiter/nonzero.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/randiter/nonzero.h
  * Copyright (C) 2001-2002 Bradford Hovinen
  *
@@ -11,8 +11,8 @@
  * See COPYING for license information.
  */
 
-#ifndef __RANDITER_NONZERO_H
-#define __RANDITER_NONZERO_H
+#ifndef __LINBOX_randiter_nonzero_H
+#define __LINBOX_randiter_nonzero_H
 
 #include "linbox/field/archetype.h"
 #include "linbox/randiter/archetype.h"
@@ -41,20 +41,21 @@ namespace LinBox
 	 * is entirely nonzero numbers.
 	 **/
 	template <class Field, class RandIter = typename Field::RandIter>
-	class NonzeroRandIter
-	{
-	    public:
-    
+	class NonzeroRandIter {
+	public:
+
 		typedef typename Field::Element Element;
 
-		NonzeroRandIter (const Field &F, const RandIter &r)
-			: _F (F), _r (r) {}
+		NonzeroRandIter (const Field &F, const RandIter &r) :
+			_F (F), _r (r)
+		{}
 
-		NonzeroRandIter (const NonzeroRandIter& R)
-			: _F (R._F), _r (R._r) {}
+		NonzeroRandIter (const NonzeroRandIter& R) :
+			_F (R._F), _r (R._r)
+		{}
 
-		~NonzeroRandIter() 
-			{}
+		~NonzeroRandIter()
+		{}
 
 		NonzeroRandIter& operator=(const NonzeroRandIter& R)
 		{
@@ -66,7 +67,8 @@ namespace LinBox
 			return *this;
 		}
 
-		Element &random (Element &a)  const
+		template<class Elt>
+		Elt &random (Elt &a)  const
 		{
 			do _r.random (a); while (_F.isZero (a));
 			return a;
@@ -86,13 +88,14 @@ namespace LinBox
 			return (a = ElementEnvelope <Field> (tmp));
 		}
 
-	    private:
+	private:
 
 		Field    _F;
 		RandIter _r;
-     
+
 	}; // class NonzeroRandIter
- 
+
 } // namespace LinBox
 
-#endif // __RANDITER_NONZERO_H
+#endif // __LINBOX_randiter_nonzero_H
+
diff --git a/linbox/randiter/ntl-ZZ.h b/linbox/randiter/ntl-ZZ.h
index 0258825..c10f024 100644
--- a/linbox/randiter/ntl-ZZ.h
+++ b/linbox/randiter/ntl-ZZ.h
@@ -1,13 +1,34 @@
-/* File linbox/randiter/ntl-ZZ.h
- *  Author: Zhendong Wan
+/* -*- 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
+/* Copyright (C) 2010 LinBox
+ * Written by Zhendong Wan
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
 
-#ifndef ___RANDITER_NTL_ZZ_H__
-#define ___RANDITER_NTL_ZZ_H__
+#ifndef __LINBOX_randiter_ntl_zz_H
+#define __LINBOX_randiter_ntl_zz_H
 
+#include <ctime>
 #include <vector>
 
-namespace LinBox {
+namespace LinBox
+{
 
 	class NTL_ZZ;
 
@@ -15,33 +36,35 @@ namespace LinBox {
 	public:
 		typedef NTL::ZZ  Element;
 
-		NTL_ZZRandIter (const NTL_ZZ& F, 
-				const integer& size = 0, 
+		NTL_ZZRandIter (const NTL_ZZ& F,
+				const integer& size = 0,
 				const integer& seed = 0
-				) {
-					  
-		  _size = NTL::to_ZZ(std::string(size).data());
+			       ) {
 
-		  if (seed == integer(0)) NTL::SetSeed (NTL::to_ZZ(time(NULL)));
-		  
-		  else NTL::SetSeed(NTL::to_ZZ(std::string(seed).data()));
+			_size = NTL::to_ZZ(std::string(size).data());
+
+			if (seed == integer(0)) NTL::SetSeed (NTL::to_ZZ(time(NULL)));
+
+			else NTL::SetSeed(NTL::to_ZZ(std::string(seed).data()));
 		}
-		
-		Element& random (Element& x) const {
-		
-		  if (_size == 0)
-		    NTL::RandomLen (x, 30);
-		  else
-		    NTL::RandomBnd (x, _size);
+
+		Element& random (Element& x) const
+		{
+
+			if (_size == 0)
+				NTL::RandomLen (x, 30);
+			else
+				NTL::RandomBnd (x, _size);
 
 			return x;
-		} 
+		}
 
 	private:
 		Element _size;
-		
-	}; 
+
+	};
 
 } // namespace LinBox
 
-#endif // 
+#endif //  __LINBOX_randiter_ntl_zz_H
+
diff --git a/linbox/randiter/param-fuzzy.h b/linbox/randiter/param-fuzzy.h
index 2639a94..6c27709 100644
--- a/linbox/randiter/param-fuzzy.h
+++ b/linbox/randiter/param-fuzzy.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/randiter/param-fuzzy.h
  * Copyright (C) 1999-2001 William J Turner,
  *               2002 Bradford Hovinen
@@ -24,51 +24,51 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __RANDITER_PARAM_FUZZY_H
-#define __RANDITER_PARAM_FUZZY_H
+#ifndef __LINBOX_randiter_param_fuzzy_H
+#define __LINBOX_randiter_param_fuzzy_H
 
 #include <iostream>
 #include <vector>
-#include <time.h>
+#include <cstdlib>
 
 #include "linbox/integer.h"
 #include "linbox/element/abstract.h"
 #include "linbox/element/envelope.h"
 #include "linbox/field/param-fuzzy.h"
 
-namespace LinBox 
-{ 
+namespace LinBox
+{
 
-	class ParamFuzzyRandIter
-	{
+	class ParamFuzzyRandIter {
 	    public:
 
 		/// element type
 		typedef double Element;
 
 		ParamFuzzyRandIter (/*const ParamFuzzy &F, */
-				   const integer &size = 0, 
-				   const integer &seed = 0)
-			: /*_F (F),*/ _size (size), _seed (seed)
-		{ 
+				   const integer &size = 0,
+				   const integer &seed = 0) :
+		       	/*_F (F),*/ _size (size), _seed (seed)
+		{
 			/*if (_size == 0) F.cardinality (_size);*/
-			if (_seed == 0) _seed = std::time (NULL);    
+			if (_seed == 0) _seed = time (NULL);
 		}
 
 		ParamFuzzyRandIter (const ParamFuzzy &F,
-				    const integer &size = 0, 
-				    const integer &seed = 0)
-			: _F (F), _size (size), _seed (seed)
-		{ 
+				    const integer &size = 0,
+				    const integer &seed = 0) :
+		       	_F (F), _size (size), _seed (seed)
+		{
 			if (_size == 0) F.cardinality (_size);
-			if (_seed == 0) _seed = std::time (NULL);    
+			if (_seed == 0) _seed = time (NULL);
 		}
 
-		ParamFuzzyRandIter (const ParamFuzzyRandIter &R) 
-			: /*_F (R._F),*/ _size (R._size), _seed (R._seed) {}
+		ParamFuzzyRandIter (const ParamFuzzyRandIter &R) :
+		       	/*_F (R._F),*/ _size (R._size), _seed (R._seed)
+		{}
 
 		~ParamFuzzyRandIter () {}
-    
+
 		ParamFuzzyRandIter &operator=(const ParamFuzzyRandIter &R)
 		{
 			if (this != &R) { // guard against self-assignment
@@ -78,7 +78,7 @@ namespace LinBox
 
 			return *this;
 		}
- 
+
 		Element &random (Element &a)  const
 		{
 			// Create new random elements
@@ -103,12 +103,13 @@ namespace LinBox
 
 		/// Sampling size
 		integer _size;
-    
+
 		/// Seed
 		integer _seed;
 
 	}; // class ParamFuzzyRandIter : public ParamFuzzyRandIter
 
-} // namespace LinBox 
+} // namespace LinBox
+
+#endif // __LINBOX_randiter_param_fuzzy_H
 
-#endif // __PARAM_FUZZY_H
diff --git a/linbox/randiter/randiter-wrappers.doxy b/linbox/randiter/randiter-wrappers.doxy
index 80f1946..dd87e90 100644
--- a/linbox/randiter/randiter-wrappers.doxy
+++ b/linbox/randiter/randiter-wrappers.doxy
@@ -1,7 +1,9 @@
-/* \page Random field element generator wrappers
+/** \page randomFEGW Random field element generator wrappers
 
-  @see Fields
+  @see \ref Fields
   @see Field Wrappers
 
-  @memo Wrappers to make \Ref{LinBox} random field element generators.
+  @brief Wrappers to make \ref LinBox random field element generators.
 */
+
+// vim:syn=doxygen
diff --git a/linbox/randiter/randiter.doxy b/linbox/randiter/randiter.doxy
index 33b58f1..1008350 100644
--- a/linbox/randiter/randiter.doxy
+++ b/linbox/randiter/randiter.doxy
@@ -1,18 +1,20 @@
-/** \defgroup randiter linbox/randiter 
+// Copyright 2010 LinBox. See COPYING for lincence information.
 
-Random Iterator Generators
+/**\ingroup linbox
+  \defgroup randiter randiter
 
-  All \Ref{LinBox} random iterator generators must implement the 
-  random iterator generator common object interface 
-  as it is defined in the random iterator generator
-  {@link RandIterArchetype archetype}.  
-  This interface consists of the methods required of all \Ref{LinBox} 
-  random iterator generators.
+  \brief Random Iterator Generators
 
-  @see Archetypes
+  All LinBox random iterator generators must implement the random iterator
+  generator common object interface as it is defined in the random iterator
+  generator \link LinBox::RandIterArchetype archetype\endlink.  This interface
+  consists of the methods required of all LinBox random iterator generators.
 
-*/
+  @see \ref Archetypes
+
+ */
 //@{
-  //@Include *.h
+//@Include *.h
 //@}
 
+// vim:syn=doxygen
diff --git a/linbox/randiter/random-fftprime.h b/linbox/randiter/random-fftprime.h
index 5893752..9facc05 100644
--- a/linbox/randiter/random-fftprime.h
+++ b/linbox/randiter/random-fftprime.h
@@ -1,4 +1,5 @@
 /* -*- 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
 /* linbox/algorithms/
  * Copyright (C) 2005  Pascal Giorgi
  *
@@ -21,82 +22,87 @@
  */
 
 
-#ifndef __RANDOM_FFTPRIME_H__
-#define __RANDOM_FFTPRIME_H__
+#ifndef __LINBOX_random_fftprime_H
+#define __LINBOX_random_fftprime_H
 
 #include <linbox/integer.h>
 #include <linbox/util/timer.h>
 
-namespace LinBox {
-	
-	class RandomFFTPrime {		
+namespace LinBox
+{
+
+	class RandomFFTPrime {
 	public:
 
 		int         _bits;
 
-		RandomFFTPrime(int bits = 20, unsigned long seed = 0) 
-			: _bits(bits)
-                {
-			if (! seed) 
+		RandomFFTPrime(int bits = 20, unsigned long seed = 0) :
+			_bits(bits)
+		{
+			if (! seed)
 				RandomFFTPrime::setSeed( BaseTimer::seed() );
 			else
 				RandomFFTPrime::setSeed( seed );
-                }
-	  
+		}
+
 		// define the prime type
 		typedef integer Prime_Type;
-	  
+
 		/** @brief randomPrime()
 		 *  return a random prime
 		 */
-		inline Prime_Type randomPrime() const {
+		inline Prime_Type randomPrime() const
+		{
 			integer tmp;
 			size_t cbits=5;
 			size_t tresh;
-			do {				
+			do {
 				tresh = 1<<(cbits);
 				size_t p = 1<<(_bits-cbits);
 				do {
 					integer::random(tmp,cbits);
 					tmp = tmp*p+1;
-					tresh--;						
-				} while ((::probab_prime(tmp)<2) && (tresh));
+					tresh--;
+				} while ((::Givaro::probab_prime(tmp)<2) && (tresh));
 				cbits++;
 			}
 			while(tresh==0);
 			return tmp;
 		}
-	  
+
 		/** @brief randomPrime(Prime_Type& p)
 		 *  return a random prime
 		 */
-		inline Prime_Type randomPrime (Prime_Type& t) const {
+		inline Prime_Type randomPrime (Prime_Type& t) const
+		{
 			size_t cbits=5;
 			size_t tresh;
-			do {				
+			do {
 				tresh = 1<<(cbits);
 				size_t p = 1<<(_bits-cbits);
 				do {
 					integer::random(t,cbits);
 					t = t*p+1;
 					tresh--;
-				} while (!::probab_prime(t) && (tresh));
+				} while (!Givaro::probab_prime(t) && (tresh));
 				cbits++;
 			}
 			while(tresh==0);
 
 			return t;
 		}
-	  
+
 		/** @brief setSeed (unsigned long ul)
 		 *  Set the random seed to be ul.
 		 */
-		void static setSeed(unsigned long ul) { 
+		void static setSeed(unsigned long ul)
+		{
 			integer::seeding(ul);
 		}
 
-	  	  
+
 	};
 }
 
-#endif
+#endif //__LINBOX_random_fftprime_H
+
diff --git a/linbox/randiter/random-integer.h b/linbox/randiter/random-integer.h
new file mode 100644
index 0000000..873d7f7
--- /dev/null
+++ b/linbox/randiter/random-integer.h
@@ -0,0 +1,195 @@
+/* -*- 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
+/* Copyright (C) 2010 LinBox
+ * Written by <brice.boyer at imag.fr>
+ * (adapted form random-prime.h)
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*! @file randiter/random-integer.h
+ * @ingroup randiter
+ * @ingroup integer
+ * @brief Generates random \ref integers.
+ */
+
+#ifndef __LINBOX_random_integer_iterator_H
+#define __LINBOX_random_integer_iterator_H
+
+#include "linbox/integer.h"
+#include "linbox/util/timer.h"
+#include "linbox/util/debug.h"
+
+namespace LinBox
+{
+
+	/*!@brief Random Prime Generator.
+	 * @ingroup integers
+	 * @ingroup randiter
+	 *
+	 * Generates integers of specified length.
+	 * @tparam _Unsigned if \c true, then only non negative integers
+	 * are generated, if \c false, their sign is random.
+	 */
+	template<bool _Unsigned=true>
+	class RandomIntegerIterator {
+
+		unsigned int    _bits;  //!< common lenght of all integers
+		integer      _integer;  //!< the generated integer.
+
+	public:
+		/*! Constructor.
+		 * @param bits size of integers (in bits)
+		 * @param seed if \c 0 a seed will be generated, otherwise, the
+		 * provided seed will be use.
+		 */
+		RandomIntegerIterator(unsigned int bits = 30, unsigned long seed = 0) :
+			_bits(bits)
+		{
+			linbox_check(bits>1);
+			if (! seed)
+				RandomIntegerIterator::setSeed( BaseTimer::seed() );
+			else
+				RandomIntegerIterator::setSeed( seed );
+
+			integer::random_exact<_Unsigned>(_integer,_bits);
+		}
+
+		typedef integer Integer_Type ;
+
+		/** @brief operator++()
+		 *  creates a new random integer.
+		 */
+		inline RandomIntegerIterator &operator ++ ()
+		{
+			integer::random_exact<_Unsigned>(_integer,_bits);
+			return *this;
+		}
+
+		/** @brief get the random integer.
+		 *  returns the actual integer.
+		 */
+		const Integer_Type &operator *  () const
+		{
+			return _integer;
+		}
+
+		/** @brief get the random integer.
+		 *  returns the actual integer.
+		 *  @warning a new integer is not generated.
+		 */
+		const Integer_Type & randomInteger() const
+		{
+			return _integer;
+		}
+
+		/** @brief Sets the seed.
+		 *  Set the random seed to be \p ul.
+		 *  @param ul the new seed.
+		 */
+		void static setSeed(unsigned long ul)
+		{
+			integer::seeding(ul);
+		}
+
+
+	};
+
+	/*! @brief Random Integer Iterator.
+	 * @ingroup integers
+	 * @ingroup randiter
+	 *
+	 * Generates integers of size smaller than a prescribed one.
+	 * This class is closer to the LinBox::RandIterArchetype.
+	 * @todo
+	 * one could create the same one on a LinBox::PID_double ?
+	 * @tparam _Unsigned if \c true, then only non negative integers
+	 * are generated, if \c false, their sign is random.
+	 */
+	template<bool _Unsigned=true>
+	class RandomIntegerIter {
+
+		unsigned int 	_bits;  //!< max length for all integers
+		integer         _seed;  //!< the generated integer.
+
+	public:
+		/*! Constructor.
+		 * @param bits max size of integers (in bits)
+		 * @param seed if \c 0 a seed will be generated, otherwise, the
+		 * provided seed will be use.
+		 */
+		RandomIntegerIter(unsigned int bits = 30, unsigned long seed = 0) :
+			_bits(bits)
+		{
+			linbox_check(bits>1);
+			if (! seed)
+				_seed = BaseTimer::seed() ;
+			else
+				_seed = seed ;
+
+			integer::seeding(_seed);
+		}
+
+		/// destructor.
+		~RandomIntegerIter() {}
+
+		/// copy constructor.
+		/// @param R random iterator to be copied.
+		RandomIntegerIter (const RandomIntegerIter &R) :
+			_bits(R._bits), _seed(R._seed)
+		{}
+
+		typedef integer Element ;
+
+		/// copy.
+		/// @param R random iterator to be copied.
+		RandomIntegerIter &operator=(const RandomIntegerIter &R)
+		{
+			if (this != &R) {
+				_bits = R._bits;
+				_seed = R._seed;
+			}
+			return *this;
+		}
+
+		/** @brief get the random integer.
+		 * @param[out] a the new integer number
+		 */
+		const integer & random (integer & a) const
+		{
+			integer::random_lessthan<_Unsigned>(a,_bits);
+
+			return a;
+		}
+
+		void setBits (unsigned int  bits)
+		{
+			_bits = bits;
+		}
+
+		unsigned int getBits () const
+		{
+			return _bits ;
+		}
+
+	};
+
+}
+
+#endif //__LINBOX_random_integer_iterator_H
+
diff --git a/linbox/randiter/random-prime.h b/linbox/randiter/random-prime.h
index b51c6f5..2969362 100644
--- a/linbox/randiter/random-prime.h
+++ b/linbox/randiter/random-prime.h
@@ -1,64 +1,253 @@
-/* -*- mode:C++ -*- */
-/*  File: primeiter.h
- *  Time-stamp: <12 Mar 07 18:35:26 Jean-Guillaume.Dumas at imag.fr> 
+/* -*- 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
+/* Copyright (C) 2007,2010 LinBox
+ * Written by <Jean-Guillaume.Dumas at imag.fr>
+ * Modified by <brice.boyer at imag.fr> (RandomPrimeIter)
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
-#ifndef __RANDOM_PRIME_ITERATOR_H__
-#define __RANDOM_PRIME_ITERATOR_H__
+
+/*! @file randiter/random-prime.h
+ * @ingroup randiter
+ * @brief Generates random positive prime \ref integers.
+ */
+
+#ifndef __LINBOX_random_prime_iterator_H
+#define __LINBOX_random_prime_iterator_H
 #include <linbox/integer.h>
 #include <linbox/util/timer.h>
+#include "linbox/util/debug.h"
+#include <cstdlib> // drand48, temporary
+
+namespace LinBox
+{
+
+	/*!  @brief Random Prime Generator.
+	 * @ingroup primes
+	 * @ingroup randiter
+	 *
+	 * Generates prime of specified length.
+	 * @internal
+	 * It is given by <code>nextprime(2^_bits-p)</code> where <code>size(p) < _bits</code>.
+	 * @todo
+	 * One could use Integer::random_exact.
+	 */
+	//template<class Prime_Type = integer>
+	class RandomPrimeIterator {
+
+		unsigned int 	_bits;  //!< common lenght of all primes
+		integer        _shift;  //!< @internal used to set proper bit size
+		integer        _prime;  //!< the generated prime.
+
+	public:
+		/*! Constructor.
+		 * @param bits size of primes (in bits). Default is 30 so it
+		 * can fit in a <code>Linbox::Modular<double></code>.
+		 * @param seed if \c 0 a seed will be generated, otherwise, the
+		 * provided seed will be use.
+		 */
+		RandomPrimeIterator(unsigned int bits = 30, unsigned long seed = 0) :
+			_bits(bits), _shift(integer(1)<<_bits)
+		{
+			linbox_check(bits >1);
+			if (! seed)
+				RandomPrimeIterator::setSeed( BaseTimer::seed() );
+			else
+				RandomPrimeIterator::setSeed( seed );
+
+			integer::random(_prime,_bits-1);
+			_prime = _shift - _prime;
+			nextprime( _prime, _prime);
+		}
+
+		typedef integer Prime_Type ;
+
+		/** @brief operator++()
+		 *  creates a new random prime.
+		 */
+		inline RandomPrimeIterator &operator ++ ()
+		{
+			integer::random(_prime,_bits-1);
+			_prime = _shift - _prime;
+			nextprime( _prime, _prime);
+			return *this;
+		}
+
+		/** @brief get the random prime.
+		 *  returns the actual prime.
+		 */
+		const Prime_Type &operator *  () const
+		{
+			return _prime;
+		}
+
+		/** @brief get the random prime.
+		 *  returns the actual prime.
+		 *  @warning a new prime is not generated.
+		 */
+		const Prime_Type & randomPrime() const
+		{
+			return _prime;
+		}
+
+		/** @brief Sets the seed.
+		 *  Set the random seed to be \p ul.
+		 *  @param ul the new seed.
+		 */
+		void static setSeed(unsigned long ul)
+		{
+			integer::seeding(ul);
+		}
+
+
+	};
+
+	/*! @brief Random Prime Iterator.
+	 * @ingroup primes
+	 * @ingroup randiter
+	 *
+	 * Generates prime of size smaller than a prescribed one.
+	 * This class is closer to the LinBox::RandIterArchetype.
+	 * @todo
+	 * one could create the same one on a LinBox::PID_double ?
+	 */
+	class RandomPrimeIter {
+
+		unsigned int 	_bits;  //!< max length for all primes
+		integer         _seed;  //!< the generated prime.
+
+	public:
+		/*! Constructor.
+		 * @param bits max size of primes (in bits). Default is 30 so it
+		 * can fit in a <code>Linbox::Modular<double></code>.
+		 * @param seed if \c 0 a seed will be generated, otherwise, the
+		 * provided seed will be use.
+		 */
+		RandomPrimeIter(unsigned int bits = 30, unsigned long seed = 0) :
+			_bits(bits)
+		{
+			linbox_check(bits >1);
+			if (! seed)
+				_seed = BaseTimer::seed() ;
+			else
+				_seed = seed ;
+
+			integer::seeding(_seed);
+		}
+
+		/// destructor.
+		~RandomPrimeIter() {}
+
+		/// prime type
+		typedef integer Prime_Type ;
+		/// copy constructor.
+		/// @param R random iterator to be copied.
+		RandomPrimeIter (const RandomPrimeIter &R) :
+			_bits(R._bits), _seed(R._seed)
+		{}
+
+		typedef integer Element ;
+
+		/// copy.
+		/// @param R random iterator to be copied.
+		RandomPrimeIter &operator=(const RandomPrimeIter &R)
+		{
+			if (this != &R) {
+				_bits = R._bits;
+				_seed = R._seed;
+			}
+			return *this;
+		}
+
+		/** @brief get a random prime of maximum size \c _bits .
+		 * @param[out] a a prime number
+		 */
+		integer & random (integer & a) const
+		{
+			integer::random(a,_bits);
+
+			nextprime( a, a);
+			while (a.bitsize()>_bits)
+				prevprime(a,a);
+
+			return a;
+		}
+
+		integer  random () const
+		{
+			integer a ;
+			return random(a);
+		}
+
+		integer & random_exact (integer & a) const
+		{
+			// integer::random_exact(a,_bits);
+			integer::random(a,_bits-1); //!@todo uses random_exact when givaro is released.
+			a = (integer(1)<<_bits) - a;
+
+			nextprime( a, a);
+			while (a.bitsize()>_bits)
+				prevprime(a,a);
+
+			return a;
+		}
+
+		integer random_exact () const
+		{
+			integer a ;
+			return random_exact(a);
+		}
+
+		integer & random_between (integer & a, unsigned long _low_bits) const
+		{
+			linbox_check(_low_bits < _bits);
+			// integer::random_exact(a,_bits);
+			unsigned long ze_bits = _low_bits+(unsigned long)((_bits - _low_bits)*drand48()) ;
+			linbox_check (!(ze_bits<_low_bits) && !(ze_bits>_bits));
+			integer::random(a,ze_bits-1); //!@todo uses random_between when givaro is released.
+			a = (integer(1)<<ze_bits) - a;
+
+			nextprime( a, a);
+			while (a.bitsize()>_bits)
+				prevprime(a,a);
+
+			linbox_check(a.bitsize() >= _low_bits && a.bitsize() <= _bits) ;
+
+			return a;
+		}
+
+		integer random_between ( unsigned long _low_bits) const
+		{
+			// std::cout << "random between " << _low_bits << " and " << _bits << std::endl;
+			integer a ;
+			random_between(a,_low_bits);
+			// std::cout << a << std::endl;
+			return a ;
+		}
+
+		void setBits (unsigned int  bits)
+		{
+			_bits = bits;
+		}
+
+	};
 
-namespace LinBox {
-	
-    class RandomPrimeIterator {		
-    public:
-        
-        int 	_bits;
-        integer _shift;
-        integer _prime;
-
-        RandomPrimeIterator(int bits = 30, unsigned long seed = 0) 
-                : _bits(bits)
-            {
-                _shift = integer(1)<<_bits;
-                if (! seed) 
-                    RandomPrimeIterator::setSeed( BaseTimer::seed() );
-                else
-                    RandomPrimeIterator::setSeed( seed );
-
-                integer::random(_prime,_bits-1);
-                _prime = _shift - _prime;
-                nextprime( _prime, _prime);
-            }
-	  
-            // define the prime type
-        typedef integer Prime_Type;
-	  
-            /** @brief operator++()
-             *  creates a new random prime
-             */
-	inline RandomPrimeIterator &operator ++ () { 
-            integer::random(_prime,_bits-1);
-            _prime = _shift - _prime;
-            nextprime( _prime, _prime);
-            return *this;
-        }
-
-            /** @brief operator*()
-             *  returns the actual prime
-             */
-        Prime_Type &operator *  () { 
-            return _prime;
-        }
-       
-            /** @brief setSeed (unsigned long ul)
-             *  Set the random seed to be ul.
-             */
-        void static setSeed(unsigned long ul) { 
-	    integer::seeding(ul);
-        }
-        
-        
-    };
 }
 
-#endif
+#endif //__LINBOX_random_prime_iterator_H
+
diff --git a/linbox/randiter/unparametric.h b/linbox/randiter/unparametric.h
index 2ea013b..4ededb7 100644
--- a/linbox/randiter/unparametric.h
+++ b/linbox/randiter/unparametric.h
@@ -1,10 +1,30 @@
-/* File: src/wrappers/by_scope/random/unparam_randiter.h
- * Author: William J Turner for the LinBox group
+/* -*- 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
+/* Copyright (C) 2010 LinBox
+ * Written by William J Turner
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
 
-#ifndef ___RANDITER_UNPARAMETRIC_H
-#define ___RANDITER_UNPARAMETRIC_H
+#ifndef __LINBOX_randiter_unparametric_H
+#define __LINBOX_randiter_unparametric_H
 
+#include <ctime>
 #include <vector>
 
 // Namespace in which all LinBox library code resides
@@ -12,12 +32,12 @@ namespace LinBox
 {
 	// forward declarations
 	template <class K> class UnparametricField;
-		
+
 	/** Unparameterized random field element generator template.
-	 * Implements LinBox random field element generator common object interface 
+	 * Implements LinBox random field element generator common object interface
 	 * for unparameterized fields.
 	 * Used to generate efficient field classes for unparameterized fields.
-	 * Constructs LinBox unparameterized random field element generators from 
+	 * Constructs LinBox unparameterized random field element generators from
 	 * field types K.
 	 * In particular, constructs LinBox random field element generators for
 	 * unparameterized fields from field types that
@@ -27,25 +47,25 @@ namespace LinBox
 	 * field interface, such as, UnparametricRandIter< SaclibQ > as
 	 * a template specialization.
 	 * This implementation uses the standard C++ random number generator.  Thus,
-	 * only one random field element generator can be used at a time since 
-	 * creating a new one will re-seed the built-in generator and affect all 
+	 * only one random field element generator can be used at a time since
+	 * creating a new one will re-seed the built-in generator and affect all
 	 * current LinBox generators.
 	 * @param  K unparameterized field class
 	 */
 	template <class K> class UnparametricRandIter
 	{
 	public:
-		
+
 		/** @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, 
+		 * The field element must contain a default constructor,
 		 * a copy constructor, a destructor, and an assignment operator.
 		 */
-		typedef K Element;    
+		typedef K Element;
 
 		/** Constructor from field, sampling size, and seed.
 		 * The random field element iterator works in the field F, is seeded
@@ -56,29 +76,30 @@ namespace LinBox
 		 * 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 
+		 * @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)
 		 */
 		UnparametricRandIter(
-				const UnparametricField<K>& F, 
-				const integer& size = 0, 
-				const integer& seed = 0
-				)
-			: _size(size), _seed(seed)
+				     const UnparametricField<K>& F,
+				     const integer& size = 0,
+				     const integer& seed = 0
+				    ) :
+			_size(size), _seed(seed)
 		{
-			if (_seed == integer(0)) _seed = integer(time(NULL));
-			
+			if (_seed == integer(0))
+				_seed = Integer::random();
+
 			integer cardinality; F.cardinality(cardinality);
 			if ( (cardinality != integer(-1)) && (_size > cardinality) )
 				_size = cardinality;
 
 #ifdef TRACE
-			cout << "created random generator with size " << _size 
-	   << " and seed " << _seed << endl;
+			cout << "created random generator with size " << _size
+			<< " and seed " << _seed << endl;
 #endif // TRACE
-			
+
 			// Seed random number generator
 			srand(static_cast<long>(_seed));
 
@@ -93,16 +114,17 @@ namespace LinBox
 		 * generator to which R._randIter_ptr points.
 		 * @param  R UnparametricRandIter object.
 		 */
-		UnparametricRandIter(const UnparametricRandIter& R)
-			: _size(R._size), _seed(R._seed) {}
+		UnparametricRandIter(const UnparametricRandIter& R) :
+			_size(R._size), _seed(R._seed)
+		{}
 
 		/** Destructor.
 		 * This destructs the random field element generator object.
-		 * In this implementation, this destroys the generator by deleting 
+		 * In this implementation, this destroys the generator by deleting
 		 * the random generator object to which _randIter_ptr points.
 		 */
 		~UnparametricRandIter(void) {}
-		
+
 		/** Assignment operator.
 		 * Assigns UnparametricRandIter object R to generator.
 		 * In this implementation, this means copying the generator to
@@ -119,7 +141,7 @@ namespace LinBox
 
 			return *this;
 		}
- 
+
 		/** Random field element creator.
 		 * This returns a random field element from the information supplied
 		 * at the creation of the generator.
@@ -132,28 +154,32 @@ namespace LinBox
 				return x = rand();
 			else
 				return x = static_cast<integer>((double(rand())/RAND_MAX)*double(_size));
-		
+
 		} // element& operator() (void)
 
 		//@} Common Object Iterface
-	 
+
 		/** @name Implementation-Specific Methods.
-		 * These methods are not required of all 
-		 * \Ref{LinBox Random field element generators}
+		 * These methods are not required of all
+		 * \ref LinBox\ Random\ field\ element\ generators
 		 * and are included only for this implementation of the archetype.
 		 */
 		//@{
 
 		/// Default constructor
-		UnparametricRandIter(void) : _size(0), _seed(0) { time(NULL); }
-		
+		UnparametricRandIter(void) :
+			_size(0), _seed(0)
+		{
+			time(NULL);
+		}
+
 		//@}
 
 	private:
 
 		/// Sampling size
 		integer _size;
-		
+
 		/// Seed
 		integer _seed;
 
@@ -161,4 +187,5 @@ namespace LinBox
 
 } // namespace LinBox
 
-#endif // ___RANDITER_UNPARAMETRIC_H
+#endif // __LINBOX_randiter_unparametric_H
+
diff --git a/linbox/ring/Makefile.am b/linbox/ring/Makefile.am
index f99f230..af29ba5 100644
--- a/linbox/ring/Makefile.am
+++ b/linbox/ring/Makefile.am
@@ -1,15 +1,20 @@
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 pkgincludesubdir=$(pkgincludedir)/ring
 
-BASIC_HDRS =			\
-	ring-interface.h	\
-	givaro-polynomial.h     \
-	abstract.h		\
-	archetype.h		\
-	envelope.h		\
-	poweroftwomodular.h
+BASIC_HDRS =            \
+    ring-interface.h    \
+    givaro-polynomial.h \
+    abstract.h          \
+    archetype.h         \
+    envelope.h          \
+    poweroftwomodular.h
 
-EXTRA_DIST = ring.doxy
+EXTRA_DIST =            \
+    ring.doxy           \
+    polynomial.doxy
 
-pkgincludesub_HEADERS =			\
-	$(BASIC_HDRS)			
+pkgincludesub_HEADERS = \
+    $(BASIC_HDRS)
 
diff --git a/linbox/ring/Makefile.in b/linbox/ring/Makefile.in
index 5d95be6..052b5d7 100644
--- a/linbox/ring/Makefile.in
+++ b/linbox/ring/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -37,19 +38,26 @@ DIST_COMMON = $(pkgincludesub_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
-	$(top_srcdir)/macros/blas-check.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
 	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
 	$(top_srcdir)/macros/givaro-check.m4 \
 	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
 	$(top_srcdir)/macros/lidia-check.m4 \
 	$(top_srcdir)/macros/linbox-doc.m4 \
 	$(top_srcdir)/macros/linbox-misc.m4 \
 	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
 	$(top_srcdir)/macros/maple-check.m4 \
 	$(top_srcdir)/macros/ntl-check.m4 \
 	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -79,18 +87,21 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
 CC = @CC@
+CCNAM = @CCNAM@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
 DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -98,19 +109,24 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
 GIVARO_CFLAGS = @GIVARO_CFLAGS@
 GIVARO_LIBS = @GIVARO_LIBS@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
 GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
@@ -118,41 +134,52 @@ LIBTOOL = @LIBTOOL@
 LIDIA_CFLAGS = @LIDIA_CFLAGS@
 LIDIA_LIBS = @LIDIA_LIBS@
 LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MAPLE_CFLAGS = @MAPLE_CFLAGS@
 MAPLE_HOME = @MAPLE_HOME@
 MAPLE_LIBS = @MAPLE_LIBS@
 MAPLE_VERSION = @MAPLE_VERSION@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
 NTL_CFLAGS = @NTL_CFLAGS@
 NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RM = @RM@
 SACLIB_CFLAGS = @SACLIB_CFLAGS@
 SACLIB_LIBS = @SACLIB_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+TESTS_CFLAGS = @TESTS_CFLAGS@
 VERSION = @VERSION@
+WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -193,20 +220,28 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 pkgincludesubdir = $(pkgincludedir)/ring
 BASIC_HDRS = \
-	ring-interface.h	\
-	givaro-polynomial.h     \
-	abstract.h		\
-	archetype.h		\
-	envelope.h		\
-	poweroftwomodular.h
-
-EXTRA_DIST = ring.doxy
+    ring-interface.h    \
+    givaro-polynomial.h \
+    abstract.h          \
+    archetype.h         \
+    envelope.h          \
+    poweroftwomodular.h
+
+EXTRA_DIST = \
+    ring.doxy           \
+    polynomial.doxy
+
 pkgincludesub_HEADERS = \
-	$(BASIC_HDRS)			
+    $(BASIC_HDRS)
 
 all: all-am
 
@@ -215,8 +250,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
 	      exit 1;; \
 	  esac; \
 	done; \
@@ -269,7 +304,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
@@ -382,6 +417,8 @@ dvi-am:
 
 html: html-am
 
+html-am:
+
 info: info-am
 
 info-am:
@@ -390,18 +427,28 @@ install-data-am: install-pkgincludesubHEADERS
 
 install-dvi: install-dvi-am
 
+install-dvi-am:
+
 install-exec-am:
 
 install-html: install-html-am
 
+install-html-am:
+
 install-info: install-info-am
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-am
 
+install-pdf-am:
+
 install-ps: install-ps-am
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
diff --git a/linbox/ring/abstract.h b/linbox/ring/abstract.h
index 5f294f1..8e1f96d 100644
--- a/linbox/ring/abstract.h
+++ b/linbox/ring/abstract.h
@@ -1,6 +1,7 @@
 /* -*- 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
 /* linbox/ring/abstract.h
+ * Copyright(C) LinBox
  * Written by J-G Dumas <Jean-Guillaume.Dumas at imag.fr>,
  *            Clement Pernet <Clement.Pernet at imag.fr>
  *
@@ -20,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __RING_ABSTRACT_H
-#define __RING_ABSTRACT_H
+#ifndef __LINBOX_ring_abstract_H
+#define __LINBOX_ring_abstract_H
 
 #include <iostream>
 
@@ -37,13 +38,13 @@
 
 #endif
 
-namespace LinBox 
-{ 
+namespace LinBox
+{
 
 	/** \brief Abstract ring base class.
-	\ingroup ring 
+	\ingroup ring
 
-	 * Found in the file \URL{linbox/ring/abstract.h}.
+	 * Found in the file \sa{linbox/ring/abstract.h}.
 	 * Abstract base class used to implement the ring archetype to minimize
 	 * code bloat.  All public member functions of this class are purely
 	 * virtual and must be implemented by all derived classes.
@@ -54,8 +55,7 @@ namespace LinBox
 	 * it.  This minimizes code bloat, but it also introduces indirection through
 	 * the use of pointers and virtual functions which is inefficient.
 	 */
-  class RingAbstract : public FieldAbstract
-	{
+  class RingAbstract : public FieldAbstract {
 	    public:
 
 /* 		/// element type. */
@@ -67,7 +67,7 @@ namespace LinBox
 		typedef FieldAbstract::RandIter RandIter;
 		/** @name Object Management
 		 * There are no public constructors for this class.
-		 * It should only be used in tandem with \Ref{FieldArchetype}.
+		 * It should only be used in tandem with \ref FieldArchetype.
 		 */
 		//@{
 
@@ -95,7 +95,7 @@ namespace LinBox
 		 * @param  x ring element.
 		 */
 		virtual bool isUnit (const Element &x) const = 0;
- 
+
 		/** Divisibility of zero test.
 		 * Test if ring element is a zero divisor.
 		 * This function assumes the ring element has already been
@@ -114,6 +114,7 @@ namespace LinBox
 
 	}; // class FieldAbstract
 
-} // namespace LinBox
+}  // namespace LinBox
+
+#endif // __LINBOX_ring_abstract_H
 
-#endif // __RING_ABSTRACT_H
diff --git a/linbox/ring/archetype.h b/linbox/ring/archetype.h
index 87b5a30..b14d982 100644
--- a/linbox/ring/archetype.h
+++ b/linbox/ring/archetype.h
@@ -1,9 +1,10 @@
 /* -*- 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
 /* linbox/ring/archetype.h
+ * Copyright(C) LinBox
  * Written by J-G Dumas <Jean-Guillaume.Dumas at imag.fr>,
  *            Clement Pernet <Clement.Pernet at imag.fr>
- * 
+ *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
@@ -21,9 +22,16 @@
  *
  */
 
+/*!@file ring/archetype.h
+ * @ingroup ring
+ * @brief Specification and archetypic instance for the ring interface.
+ * @see \ref Archetypes
+ */
+
+
 
-#ifndef __RING_ARCHETYPE_H
-#define __RING_ARCHETYPE_H
+#ifndef __LINBOX_ring_archetype_H
+#define __LINBOX_ring_archetype_H
 
 #include <iostream>
 #include "linbox/field/archetype.h"
@@ -46,41 +54,40 @@ namespace LinBox
 	// Forward declarations
 	class RandIterArchetype;
 
-	/** 
-	 * \brief specification and archetypic instance for the ring interface 
-	\ingroup ring
+	/**
+	 * \brief specification and archetypic instance for the ring interface
+	 \ingroup ring
 	 *
-	 * The \Ref{RingArchetype} and its encapsulated
-	 * element class contain pointers to the \Ref{RingAbstract}
+	 * The \ref RingArchetype and its encapsulated
+	 * element class contain pointers to the \ref RingAbstract
 	 * and its encapsulated ring element, respectively.
-	 * \Ref{RingAbstract} then uses virtual member functions to
-	 * define operations on its encapsulated ring element.  This ring 
-	 * element has no knowledge of the ring properties being used on it 
+	 * \ref RingAbstract then uses virtual member functions to
+	 * define operations on its encapsulated ring element.  This ring
+	 * element has no knowledge of the ring properties being used on it
 	 * which means the ring object must supply these operations.
 	 *
-	 * It does not contain elements zero and one because they can be created 
+	 * It does not contain elements zero and one because they can be created
 	 * whenever necessary, although it might be beneficial from an efficiency
 	 * stand point to include them.  However, because of archetype use three,
 	 * the elements themselves cannot be contained, but rather pointers to them.
 	 */
-	class RingArchetype : public virtual FieldArchetype
-	{
-	    public:
+	class RingArchetype : public virtual FieldArchetype {
+	public:
 
 		/** @name Common Object Interface for a LinBox Ring.
-		 * These methods are required of all \Ref{LinBox} rings.
+		 * These methods are required of all \ref LinBox rings.
 		 */
 		//@{
-    
+
 		/// element type.
-/* 		typedef ElementArchetype Element; */
+		/* 		typedef ElementArchetype Element; */
 		typedef FieldArchetype::Element Element;
 		/// Random iterator generator type.
-/* 		typedef RandIterArchetype RandIter; */
+		/* 		typedef RandIterArchetype RandIter; */
 		typedef FieldArchetype::RandIter RandIter;
 		/// @name Object Management
 		//@{
-    
+
 		/** Copy constructor.
 		 *
 		 * Constructs RingArchetype object by copying the
@@ -88,130 +95,130 @@ namespace LinBox
 		 * be passed by value into functions.
 		 *
 		 * In this implementation, this means copying the
-		 * ring to which {\tt F.\_ring\_ptr} points, the
-		 * element to which {\tt F.\_elem\_ptr} points, and the
+		 * ring to which \c F._ring_ptr points, the
+		 * element to which \c F._elem_ptr points, and the
 		 * random element generator to which
-		 * {\tt F.\_randIter\_ptr} points.
+		 * \c F._randIter_ptr points.
 		 *
-		 * @param F {\tt RingArchetype} object.
+		 * @param F \ref RingArchetype object.
 		 */
-	  RingArchetype (const RingArchetype &F) : FieldArchetype ( F )	{ }
-    
-	  /** \brief Invertibility test.
+		RingArchetype (const RingArchetype &F) :
+		       	FieldArchetype ( F )
+		{ }
+
+		/** \brief Invertibility test.
 		 * Test if ring element is invertible.
 		 * This function assumes the ring element has already been
 		 * constructed and initialized.
-		 * In this implementation, this means the {\tt
-		 * \_elem\_ptr} of x exists and does not point to
+		 * In this implementation, this means the \c
+		 * _elem_ptr of x exists and does not point to
 		 * null.
 		 *
 		 * @return boolean true if equals zero, false if not.
 		 * @param  x ring element.
 		 */
-	  bool isUnit (const Element &x) const 
-	    { return _ring_ptr->isUnit (*x._elem_ptr); }
-    
+		bool isUnit (const Element &x) const
+		{ return _ring_ptr->isUnit (*x._elem_ptr); }
+
 		/** Divisibility of zero test.
 		 * Test if ring element is a zero divisor.
 		 * This function assumes the ring element has already been
 		 * constructed and initialized.
 		 *
-		 * In this implementation, this means the {\tt
-		 * \_elem\_ptr} of x exists and does not point to
+		 * In this implementation, this means the \c
+		 * _elem_ptr of x exists and does not point to
 		 * null.
 		 *
 		 * @return boolean true if divides zero, false if not.
 		 * @param  x ring element.
 		 */
-		bool isZeroDivisor (const Element &x) const 
-			{ return _ring_ptr->isZeroDivisor (*x._elem_ptr); }
-    
+		bool isZeroDivisor (const Element &x) const
+		{ return _ring_ptr->isZeroDivisor (*x._elem_ptr); }
+
 
 		/** Constructor.
-		 * Constructs ring from pointer to \Ref{RingAbstract} and its
+		 * Constructs ring from pointer to \ref RingAbstract and its
 		 * encapsulated element and random element generator.
 		 * Not part of the interface.
 		 * Creates new copies of ring, element, and random iterator generator
 		 * objects in dynamic memory.
-		 * @param  ring\_ptr pointer to \Ref{RingAbstract}.
-		 * @param  elem\_ptr  pointer to \Ref{ElementAbstract}, which is the
-		 *                    encapsulated element of \Ref{RingAbstract}.
-		 * @param  randIter\_ptr  pointer to \Ref{RandIterAbstract}, which is the
+		 * @param  ring_ptr pointer to \ref RingAbstract.
+		 * @param  elem_ptr  pointer to \ref ElementAbstract, which is the
+		 *                    encapsulated element of \ref RingAbstract.
+		 * @param  randIter_ptr  pointer to \ref RandIterAbstract, which is the
 		 *                        encapsulated random iterator generator
-		 *                        of \Ref{RingAbstract}.
+		 *                        of \ref RingAbstract.
 		 */
 		RingArchetype (RingAbstract    *ring_ptr,
-				 ElementAbstract  *elem_ptr,
-				 RandIterAbstract *randIter_ptr = 0)
-		  : FieldArchetype( static_cast<FieldAbstract*>(ring_ptr->clone()),
-				    elem_ptr, randIter_ptr ),
-		  _ring_ptr (dynamic_cast<RingAbstract*>(ring_ptr->clone ()))
-		{
-		}
+			       ElementAbstract  *elem_ptr,
+			       RandIterAbstract *randIter_ptr = 0) :
+			FieldArchetype( static_cast<FieldAbstract*>(ring_ptr->clone()),
+					elem_ptr, randIter_ptr ),
+			_ring_ptr (dynamic_cast<RingAbstract*>(ring_ptr->clone ()))
+		{ }
+
 
-    
 		/** Constructor.
 		 * Constructs ring from ANYTHING matching the interface
-		 * using the enveloppe as a \Ref{RingAbstract} and its
+		 * using the enveloppe as a \ref RingAbstract and its
 		 * encapsulated element and random element generator if needed.
-		 * @param  ring\_ptr pointer to ring matching the interface
-		 * @param  elem\_ptr  pointer to element matching the interface
-		 * @param  randIter\_ptr  pointer to random matching the interface
+		 * @param f
 		 */
 		template<class Ring_qcq>
 		RingArchetype (Ring_qcq *f)
 		{ Ring_constructor (f, f); }
-	
+
 		//@} Implementation-Specific Methods
-    
-	    private:
-    
+
+	private:
+
 		friend class ElementArchetype;
 		friend class RandIterArchetype;
-    
+
 		/** Pointer to RingAbstract object.
 		 * Not part of the interface.
 		 * Included to allow for archetype use three.
 		 */
 		mutable RingAbstract *_ring_ptr;
-    
 
-		/** Template method for constructing archetype from a derived class of 
+
+		/** Template method for constructing archetype from a derived class of
 		 * RingAbstract.
-		 * This class is needed to help the constructor differentiate between 
+		 * This class is needed to help the constructor differentiate between
 		 * classes derived from RingAbstract and classes that aren't.
 		 * Should be called with the same argument to both parameters?
 		 * @param	trait	pointer to RingAbstract or class derived from it
-		 * @param	ring\_ptr	pointer to class derived from RingAbstract
+		 * @param	ring_ptr	pointer to class derived from RingAbstract
 		 */
 		template<class Ring_qcq>
-		void Ring_constructor (RingAbstract *trait, 
-				  Ring_qcq     *ring_ptr)
+		void Ring_constructor (RingAbstract *trait,
+				       Ring_qcq     *ring_ptr)
 		{
 			constructor( static_cast<FieldAbstract*>(trait), ring_ptr);
 			_ring_ptr    = dynamic_cast<RingAbstract*>(ring_ptr->clone ());
 
 		}
-	 
-		/** Template method for constructing archetype from a class not derived 
+
+		/** Template method for constructing archetype from a class not derived
 		 * from RingAbstract.
-		 * This class is needed to help the constructor differentiate between 
+		 * This class is needed to help the constructor differentiate between
 		 * classes derived from RingAbstract and classes that aren't.
 		 * Should be called with the same argument to both parameters?
 		 * @param	trait	pointer to class not derived from RingAbstract
-		 * @param	ring\_ptr	pointer to class not derived from RingAbstract
+		 * @param	ring_ptr	pointer to class not derived from RingAbstract
 		 */
 		template<class Ring_qcq>
-		void Ring_constructor (void      *trait, 
-				  Ring_qcq *ring_ptr)
+		void Ring_constructor (void      *trait,
+				       Ring_qcq *ring_ptr)
 		{
 			RingEnvelope< Ring_qcq > EnvF (*ring_ptr);
 			Ring_constructor (static_cast<RingAbstract*> (&EnvF), &EnvF) ;
 		}
 
 	}; // class RingArchetype
-  
-} // namespace LinBox
 
+	}  // namespace LinBox
+
+
+#endif // __LINBOX_ring_archetype_H
 
-#endif // __RING_ARCHETYPE_H
diff --git a/linbox/ring/envelope.h b/linbox/ring/envelope.h
index 94eb3a6..fb3d96f 100644
--- a/linbox/ring/envelope.h
+++ b/linbox/ring/envelope.h
@@ -1,6 +1,7 @@
 /* -*- 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
 /* linbox/ring/envelope.h
+ * Copyright(C) LinBox
  * Written by J-G Dumas <Jean-Guillaume.Dumas at imag.fr>,
  *            Clement Pernet <Clement.Pernet at imag.fr>
  *
@@ -22,8 +23,8 @@
  * ------------------------------------
  */
 
-#ifndef __RING_ENVELOPE_H
-#define __RING_ENVELOPE_H
+#ifndef __LINBOX_ring_envelope_H
+#define __LINBOX_ring_envelope_H
 
 #include <iostream>
 
@@ -43,18 +44,18 @@
 #endif
 
 // Namespace in which all LinBox code resides
-namespace LinBox 
-{ 
+namespace LinBox
+{
 	// Forward declarations
 	template <class Ring> class RandIterEnvelope;
 
-	/** 
-	 * \brief implement the ring archetype to minimize code bloat.  
+	/**
+	 * \brief implement the ring archetype to minimize code bloat.
 	\ingroup ring
 
 	This class implements all purely virtual member functions
 	 * of the abstract base class.  This class is used to wrap a
-	 * \Ref{LinBox}
+	 * \ref LinBox
 	 * ring so that it might be used with the Ring archetype.
 	 */
 	template <class Ring>
@@ -78,39 +79,47 @@ namespace LinBox
 		/** @name Object Management
 		 */
 		//@{
- 
+
 		/** Default constructor.
-		 * In this implementation, this means copying the ring {\tt E.\_field}.
+		 * In this implementation, this means copying the ring \c E._field.
 		 */
 		RingEnvelope (void) {}
 
 		/** Constructor from ring to be wrapped.
 		 * @param F Ring object to be wrapped.
 		 */
-		RingEnvelope (const Ring& F) : FieldEnvelope<Ring> (F) {}
- 
+		RingEnvelope (const Ring& F) :
+		       	FieldEnvelope<Ring> (F)
+		{}
+
 		/** Copy constructor.
 		 * Constructs RingEnvelope object by copying the ring.
 		 * This is required to allow ring objects to be passed by value
 		 * into functions.
-		 * In this implementation, this means copying the ring {\tt E.\_field}.
+		 * In this implementation, this means copying the ring \c E._field.
 		 * @param  E RingEnvelope object.
 		 */
-		RingEnvelope (const RingEnvelope& E) : FieldEnvelope<Ring> (E._field) {}
+		RingEnvelope (const RingEnvelope& E) :
+		       	FieldEnvelope<Ring> (E._field)
+		{}
 
 #ifdef __LINBOX_XMLENABLED
-		RingEnvelope(Reader &R) : FieldEnvelope<Ring>(R) {}
+		RingEnvelope(Reader &R) :
+		       	FieldEnvelope<Ring>(R)
+	       	{}
 #endif
 
- 
+
 		/** Virtual copy constructor.
 		 * Required because constructors cannot be virtual.
 		 * Passes construction on to derived classes.
 		 * This function is not part of the common object interface.
 		 * @return pointer to new object in dynamic memory.
 		 */
-// 		RingAbstract* clone () const
-// 			{ return new RingEnvelope (*this); }
+#if 0
+		RingAbstract* clone () const
+		{ return new RingEnvelope (*this); }
+#endif
 
 		FieldAbstract* clone () const
 			{ return static_cast<RingAbstract*>( new RingEnvelope (*this)); }
@@ -167,14 +176,14 @@ namespace LinBox
 		}
 		integer& cardinality (integer& c) const{
 			return FieldEnvelope<Ring>::cardinality(c);
-			
+
 		}
 		integer& characteristic (integer& c) const{
 			return FieldEnvelope<Ring>::characteristic(c);
-			
+
 		}
 		bool areEqual (const ElementAbstract& x, const ElementAbstract& y) const{
-			
+
 			return FieldEnvelope<Ring>::areEqual(x,y);
 		}
 
@@ -199,10 +208,10 @@ namespace LinBox
 				      const ElementAbstract& z) const{
 			return FieldEnvelope<Ring>::div(x,y,z);
 		}
-		
-		ElementAbstract& axpy (ElementAbstract& r, 
-					const ElementAbstract& a, 
-					const ElementAbstract& x, 
+
+		ElementAbstract& axpy (ElementAbstract& r,
+					const ElementAbstract& a,
+					const ElementAbstract& x,
 					const ElementAbstract& y) const
 		{
 			return FieldEnvelope<Ring>::axpy(r,a,x,y);
@@ -224,9 +233,9 @@ namespace LinBox
 					const ElementAbstract& z) const{
 			return FieldEnvelope<Ring>::divin(x,z);
 		}
-		
-		ElementAbstract& axpyin(ElementAbstract& r, 
-					const ElementAbstract& x, 
+
+		ElementAbstract& axpyin(ElementAbstract& r,
+					const ElementAbstract& x,
 					const ElementAbstract& y) const
 		{
 			return FieldEnvelope<Ring>::axpyin(r,x,y);
@@ -235,7 +244,7 @@ namespace LinBox
 			return FieldEnvelope<Ring>::isZero(x);
 		}
 
-		
+
 		bool isOne (const ElementAbstract& x) const{
 			return FieldEnvelope<Ring>::isOne(x);
 		}
@@ -251,7 +260,7 @@ namespace LinBox
 
 		bool isUnit (const ElementAbstract& x) const
 			{ return _field.isUnit (static_cast<const ElementEnvelope<Ring>&> (x)._elem); }
- 
+
 		/** Divisibility of zero test.
 		 * Test if ring element is a zero divisor.
 		 * This function assumes the ring element has already been
@@ -264,14 +273,14 @@ namespace LinBox
 			{ return _field.isZeroDivisor (static_cast<const ElementEnvelope<Ring>&> (x)._elem); }
 
 
-		std::ostream& write (std::ostream& os) const 
+		std::ostream& write (std::ostream& os) const
 		{ return  FieldEnvelope<Ring>::write (os); }
-		
+
 		std::istream& read (std::istream& is) { return FieldEnvelope<Ring>::read (is); }
 
 		std::ostream& write (std::ostream& os, const ElementAbstract& x) const
 			{ return FieldEnvelope<Ring>::write (os, x); }
- 
+
 		std::istream& read (std::istream& is, ElementAbstract& x) const
 			{ return FieldEnvelope<Ring>::read (is, x); }
 	    private:
@@ -285,4 +294,5 @@ namespace LinBox
 
 #include "linbox/randiter/envelope.h"
 
-#endif // __RING_ENVELOPE_H
+#endif // __LINBOX_ring_envelope_H
+
diff --git a/linbox/ring/givaro-polynomial.h b/linbox/ring/givaro-polynomial.h
index 19d1841..b33767b 100644
--- a/linbox/ring/givaro-polynomial.h
+++ b/linbox/ring/givaro-polynomial.h
@@ -1,67 +1,83 @@
 /* -*- 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
 /* linbox/ring/givaro-polynomial.h
- * Written by 
+ * Copyright(C) LinBox
+ * Written by
  * Clement Pernet
  *
  * See COPYING for license information.
  */
 
-#ifndef __GIVAROPOLYNOMIAL_H
-#define __GIVAROPOLYNOMIAL_H
+/*! @file ring/givaro-polynomial.h
+ * @ingroup ring
+ * @brief NO DOC
+ */
+
+#ifndef __LINBOX_givaropolynomial_H
+#define __LINBOX_givaropolynomial_H
 
 #include <iostream>
-#include "givaro/givpoly1.h"
-#include "givaro/givpoly1factor.h"
+#include <givaro/givpoly1.h>
+#include <givaro/givpoly1factor.h>
 #include "linbox/integer.h"
 #include "linbox/field/unparametric.h"
-#include "linbox/element/givaro-polynomial.h"
+#include "linbox/field/givaro-field.h"
+//#include "linbox/element/givaro-polynomial.h"
 
 
 // Namespace in which all LinBox code resides
-namespace LinBox 
-{ 
-	
-	/** \brief polynomials with coefficients modulo some power of two
-	\ingroup ring
+namespace LinBox
+{
+
+	/** Polynomials.
+	 * \ingroup ring
 	 *
-	 * @param Polynomial type, e.g. std::vector<Field::Element>
+	 * -param Polynomial type, e.g. std::vector<Field::Element>
+	 *  @tparam Domain
+	 *  @tparam StorageTag
 	 */
-template <class Domain, class StorageTag>
-class GivPolynomialRing : public Poly1Dom<Domain,StorageTag>
-{
-public:
+	template <class Domain, class StorageTag=::Givaro::Dense>
+	class GivPolynomialRing : public ::Givaro::Poly1Dom<GivaroField<Domain>,StorageTag> {
+	public:
 
-	//	using Poly1Dom<Domain,StorageTag>::eval;
-	typedef GivPolynomial<typename Domain::Element> Element;
+		//	using ::Givaro::Poly1Dom<Domain,StorageTag>::eval;
+		typedef typename ::Givaro::Poly1Dom<Domain,StorageTag>::Element Element;
 
-	typedef Element Polynomial;
+		typedef Element Polynomial;
 
-	GivPolynomialRing () {}
+		GivPolynomialRing () {}
 
-	GivPolynomialRing (const Domain& D)
-		: Poly1Dom<Domain,StorageTag>(D, Indeter()){}
+		GivPolynomialRing (const Domain& D) :
+			::Givaro::Poly1Dom<GivaroField<Domain>,StorageTag>(D, ::Givaro::Indeter())
+		{}
+
+		GivPolynomialRing (const Domain& D, const ::Givaro::Indeter& I) :
+			::Givaro::Poly1Dom<GivaroField<Domain>,StorageTag>(D, I)
+		{}
+
+		template<class PolyCont>
+		PolyCont& factor (PolyCont& factors,
+				  std::vector<unsigned long>& exp,
+				  const Polynomial& P);
+
+	};
 
-	template<class PolyCont>
-	PolyCont& factor (PolyCont& factors, 
-			  std::vector<unsigned long>& exp,
-			  const Polynomial& P);
-	
-};
 
-	
 #ifdef __LINBOX_HAVE_NTL
 }
 #include "linbox/field/ntl-ZZ.h"
 #include "NTL/ZZXFactoring.h"
-namespace LinBox{
-template <>
-template <>
-std::vector<GivPolynomial<integer>* >& 
-GivPolynomialRing<UnparametricField<integer>,Dense>::factor (std::vector<GivPolynomial<integer>* >& factors, 
-							     std::vector<unsigned long>& exp,
-							     const GivPolynomial<integer> &P)
+namespace LinBox
 {
+	typedef GivPolynomialRing<UnparametricField<integer>,::Givaro::Dense> GivPolIntDense;
+
+	template <>
+	template <>
+	std::vector<GivPolIntDense::Element* >&
+	GivPolIntDense::factor (std::vector<GivPolIntDense::Element* >& factors,
+				std::vector<unsigned long>& exp,
+				const GivPolIntDense::Element &P)
+	{
 		NTL::ZZXFac_InitNumPrimes = 1;
 		NTL::ZZX f;
 		for (size_t i = 0; i < P.size(); ++i){
@@ -70,13 +86,13 @@ GivPolynomialRing<UnparametricField<integer>,Dense>::factor (std::vector<GivPoly
 		NTL::vec_pair_ZZX_long ntlfactors;
 		NTL::ZZ c;
 		NTL::factor (c, ntlfactors, f);
-			
-		NTL::ZZ t; 
+
+		NTL::ZZ t;
 		NTL_ZZ NTLIntDom;
 		factors.resize(ntlfactors.length());
 		exp.resize(ntlfactors.length());
 		for (int i= 0; i<ntlfactors.length(); ++i) {
-			factors[i] = new GivPolynomial<integer>( deg(ntlfactors[i].a)+1 );
+			factors[i] = new GivPolIntDense::Element( deg(ntlfactors[i].a)+1 );
 			for(int j = 0; j <= deg(ntlfactors[i].a); ++j) {
 				NTL::GetCoeff(t,ntlfactors[i].a,j);
 				NTLIntDom.convert( factors[i]->operator[](j), t );
@@ -84,16 +100,20 @@ GivPolynomialRing<UnparametricField<integer>,Dense>::factor (std::vector<GivPoly
 			exp[i] = ntlfactors[i].b;
 		}
 		return factors;
+	}
 }
 
 #include <linbox/field/PID-integer.h>
-template <>
-template <>
-std::vector<GivPolynomial<integer>* >& 
-GivPolynomialRing<PID_integer,Dense>::factor<std::vector<GivPolynomial<integer>* > > (std::vector<GivPolynomial<integer>* >& factors, 
-										      std::vector<unsigned long>& exp,
-										      const GivPolynomial<integer> &P)
+namespace LinBox
 {
+	typedef GivPolynomialRing<PID_integer,::Givaro::Dense> GivPolPIDIntDense;
+	template <>
+	template <>
+	std::vector<GivPolPIDIntDense::Element* >&
+	GivPolPIDIntDense::factor<std::vector<GivPolPIDIntDense::Element* > > (std::vector<GivPolPIDIntDense::Element* >& factors,
+									       std::vector<unsigned long>& exp,
+									       const GivPolPIDIntDense::Element &P)
+	{
 		NTL::ZZXFac_InitNumPrimes = 1;
 		NTL::ZZX f;
 		for (size_t i = 0; i < P.size(); ++i){
@@ -102,13 +122,13 @@ GivPolynomialRing<PID_integer,Dense>::factor<std::vector<GivPolynomial<integer>*
 		NTL::vec_pair_ZZX_long ntlfactors;
 		NTL::ZZ c;
 		NTL::factor (c, ntlfactors, f);
-			
-		NTL::ZZ t; 
+
+		NTL::ZZ t;
 		NTL_ZZ NTLIntDom;
 		factors.resize(ntlfactors.length());
 		exp.resize(ntlfactors.length());
 		for (int i= 0; i<ntlfactors.length(); ++i) {
-			factors[i] = new GivPolynomial<integer>( deg(ntlfactors[i].a)+1 );
+			factors[i] = new GivPolPIDIntDense::Element( deg(ntlfactors[i].a)+1 );
 			for(int j = 0; j <= deg(ntlfactors[i].a); ++j) {
 				NTL::GetCoeff(t,ntlfactors[i].a,j);
 				NTLIntDom.convert( factors[i]->operator[](j), t );
@@ -116,15 +136,17 @@ GivPolynomialRing<PID_integer,Dense>::factor<std::vector<GivPolynomial<integer>*
 			exp[i] = ntlfactors[i].b;
 		}
 		return factors;
-}
+	}
 
-template <>
-template <>
-std::vector<GivPolynomial<NTL::ZZ>* >& 
-GivPolynomialRing< NTL_ZZ , Dense>::factor<std::vector<GivPolynomial<NTL::ZZ>* > > (std::vector<GivPolynomial<NTL::ZZ>* >& factors, 
-										    std::vector<unsigned long>& exp,
-										    const GivPolynomial<NTL::ZZ> &P)
-{
+	typedef GivPolynomialRing< NTL_ZZ , ::Givaro::Dense> GivPolZZDense;
+	template <>
+	template <>
+	std::vector<GivPolZZDense::Element* >&
+	GivPolZZDense::factor<std::vector<GivPolZZDense::Element* > >
+	(std::vector<GivPolZZDense::Element* >& factors,
+	 std::vector<unsigned long>& exp,
+	 const GivPolZZDense::Element &P)
+	{
 		NTL::ZZXFac_InitNumPrimes = 1;
 		NTL::ZZX f;
 		for (size_t i = 0; i < P.size(); ++i){
@@ -133,51 +155,57 @@ GivPolynomialRing< NTL_ZZ , Dense>::factor<std::vector<GivPolynomial<NTL::ZZ>* >
 		NTL::vec_pair_ZZX_long ntlfactors;
 		NTL::ZZ c;
 		NTL::factor (c, ntlfactors, f);
-			
-		NTL::ZZ t; 
+
+		NTL::ZZ t;
 		factors.resize(ntlfactors.length());
 		exp.resize(ntlfactors.length());
 		for (int i= 0; i<ntlfactors.length(); ++i) {
-			factors[i] = new GivPolynomial<NTL::ZZ>( deg(ntlfactors[i].a)+1 );
+			factors[i] = new GivPolZZDense::Element( deg(ntlfactors[i].a)+1 );
 			for(int j = 0; j <= deg(ntlfactors[i].a); ++j) {
 				NTL::GetCoeff( factors[i]->operator[](j),ntlfactors[i].a,j);
 			}
 			exp[i] = ntlfactors[i].b;
 		}
 		return factors;
-} 
+	}
 
 #endif
 
-template <>
-template <>
-std::vector<GivPolynomial<double> *>& 
-GivPolynomialRing<Modular<double>,Dense>::factor (std::vector<GivPolynomial<double>* > & factors, 
-						  std::vector<unsigned long>& exp,
-						  const GivPolynomial<double>& P)
-{
-	integer charac;
-	_domain.characteristic(charac);
-	double p = charac;
-	Poly1FactorDom<Modular<double>,Dense, Modular<double>::RandIter> PFD(*this, Modular<double>::RandIter(_domain));
-	std::vector<givvector<double> > factors2;
-	PFD.CZfactor ( factors2, exp, static_cast<givvector<double> >(P),p);
-
-	//std::cerr<<"factorization done"<<std::endl;
-	factors.resize(factors2.size());
-	std::vector<GivPolynomial<double>* >::iterator itf = factors.begin();
-	std::vector<givvector<double> >::const_iterator itf2 = factors2.begin();
-	for (; itf2 != factors2.end();++itf,++itf2){
-		*itf = new GivPolynomial<double>(*itf2);
-		//std::cerr<<"converting factor"<<(*itf)<<std::endl;
-		for (size_t i=0; i< (*itf)->size();++i)
-			_domain.divin((*itf)->operator[](i),(*itf)->operator[]((*itf)->size()-1));
-		_domain.assign((*itf)->operator[]((*itf)->size()-1),1.0);
+	typedef GivPolynomialRing<Modular<double>,::Givaro::Dense> GivPolMdDense;
+	template <>
+	template <>
+	std::vector<GivPolMdDense::Element *>&
+	GivPolMdDense::factor (std::vector<GivPolMdDense::Element* > & factors,
+			       std::vector<unsigned long>& exp,
+			       const GivPolMdDense::Element& P)
+	{
+		integer charac;
+		_domain.characteristic(charac);
+		double p = charac;
+		typedef GivaroField<Modular<double> > GivModDouble;
+		typedef ::Givaro::Poly1FactorDom< GivModDouble,::Givaro::Dense, GivModDouble::RandIter> PolysDouble;
+
+
+		PolysDouble PFD(*this, GivModDouble::RandIter(_domain));
+		std::vector<PolysDouble::Element> factors2;
+		PFD.CZfactor ( factors2, exp, static_cast<PolysDouble::Element>(P),p);
+
+		//std::cerr<<"factorization done"<<std::endl;
+		factors.resize(factors2.size());
+		std::vector<GivPolMdDense::Element* >::iterator itf = factors.begin();
+		std::vector<PolysDouble::Element >::const_iterator itf2 = factors2.begin();
+		for (; itf2 != factors2.end();++itf,++itf2){
+			*itf = new GivPolMdDense::Element(*itf2);
+			//std::cerr<<"converting factor"<<(*itf)<<std::endl;
+			for (size_t i=0; i< (*itf)->size();++i)
+				_domain.divin((*itf)->operator[](i),(*itf)->operator[]((*itf)->size()-1));
+			_domain.assign((*itf)->operator[]((*itf)->size()-1),1.0);
+		}
+		return factors;
 	}
-	return factors;
-}	
 
 } // namespace LinBox
 
 
-#endif // __GIVAROPOLYNOMIAL_H
+#endif // __LINBOX_givaropolynomial_H
+
diff --git a/linbox/ring/polynomial.doxy b/linbox/ring/polynomial.doxy
new file mode 100644
index 0000000..2fbdd87
--- /dev/null
+++ b/linbox/ring/polynomial.doxy
@@ -0,0 +1,8 @@
+// Copyright (C) 2010 LinBox, GNU LGPL, see COPYING for licence information
+
+/*! @ingroup ring
+ * @defgroup polynomials Polynomials
+ * @brief NO DOC YET
+ */
+
+// vim:syn=doxygen
diff --git a/linbox/ring/poweroftwomodular.h b/linbox/ring/poweroftwomodular.h
index 2bc4e8d..bf99f5f 100644
--- a/linbox/ring/poweroftwomodular.h
+++ b/linbox/ring/poweroftwomodular.h
@@ -1,16 +1,17 @@
 /* -*- 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
 /* linbox/field/modular.h
- * Written by 
- *    Pierrick Vignard 
+ * Copyright(C) LinBox
+ * Written by
+ *    Pierrick Vignard
  *    Jean-Guillaume Dumas <Jean-Guillaume.Dumas at imag.fr>
  *
  *
  * See COPYING for license information.
  */
 
-#ifndef __POWEROFTWOMODULAR_H
-#define __POWEROFTWOMODULAR_H
+#ifndef __LINBOX_poweroftwomodular_H
+#define __LINBOX_poweroftwomodular_H
 
 #include <iostream>
 
@@ -20,66 +21,66 @@
 #include "linbox/randiter/unparametric.h"
 
 // Namespace in which all LinBox code resides
-namespace LinBox 
-{ 
-	
+namespace LinBox
+{
+
 	/** \brief Ring of elements modulo some power of two
-	\ingroup ring
+	  \ingroup ring
 	 *
 	 * @param element Element type, e.g. long or integer
 	 * @param Intermediate Type to use for intermediate computations. This
 	 *                     should be a data type that can support integers
 	 *                     twice the length of the maximal modulus used
 	 */
-  template <class Ints> class PowerOfTwoModular 
+	template <class Ints> class PowerOfTwoModular
 	{
 	public:
-		
+
 		/** Element type
-		 */
+		*/
 		typedef Ints Element;
 
 		/** Random iterator generator type.
 		 * It must meet the common object interface of random element generators
 		 * as given in the the archetype RandIterArchetype.
 		 */
-	        struct RandIter{
-		  typedef Ints Element;
+		struct RandIter{
+			typedef Ints Element;
 
-		  RandIter ( const PowerOfTwoModular<Ints>& F, 
-			     const integer& size = 0, const integer& seed = 0){
-		    if (_seed == integer(0)) _seed = integer(time(NULL));
-		    srand(static_cast<long>(_seed));
-			
-		  }
+			RandIter ( const PowerOfTwoModular<Ints>& F,
+				   const integer& size = 0, const integer& seed = 0){
+				if (_seed == integer(0)) _seed = integer(time(NULL));
+				srand(static_cast<long>(_seed));
 
-		  RandIter ( const RandIter& R ):_seed(R._seed){  
-		    
-		  }
+			}
 
-		  RandIter ( void ):_seed(0){  
-		    
-		  }
+			RandIter ( const RandIter& R ) :
+				_seed(R._seed)
+			{ }
 
-		Element& random (Element& x) const
-		{
-		  return x=rand();
-		}
+			RandIter ( void ) :
+				_seed(0)
+			{ }
+
+			Element& random (Element& x) const
+			{
+				return x=rand();
+			}
 		protected:
-		  integer _seed;
+			integer _seed;
 		};
 
 		/** @name Object Management
-		 */
+		*/
 		//@{
- 
+
 		/** Default constructor.
-		 */
+		*/
 		PowerOfTwoModular (void) {
 			_poweroftwo=sizeof(Ints)<<3;
 		}
 
- 
+
 		/** Conversion of field base element to a template class T.
 		 * This function assumes the output field base element x has already been
 		 * constructed, but that it is not already initialized.
@@ -101,9 +102,9 @@ namespace LinBox
 		 * @param y integer.
 		 */
 		Element &init (Element &x, const Ints &y = 0) const
-		{ 
+		{
 			return x=y;
-		} 
+		}
 
 
 		/** Assignment of one field base element to another.
@@ -168,7 +169,7 @@ namespace LinBox
 		 */
 		bool isZero (const Element &x) const
 		{ return x == 0; }
- 
+
 		/** One equality.
 		 * Test if field base element is equal to one.
 		 * This function assumes the field base element has already been
@@ -179,31 +180,38 @@ namespace LinBox
 		bool isOne (const Element &x) const
 		{ return x == 1; }
 
-		
+		/*! isUnit.
+		 * @param x
+		 */
 		bool isUnit (const Element &x) const
-		  { return x&1UL; }
+		{ return x&1UL; }
 
+		/*! isZeroDivisor.
+		 * @param x
+		 */
 		bool isZeroDivisor ( const Element &x ) const
-		  { return !(x&1UL); }
+		{ return !(x&1UL); }
 
-		/** Gcd with 2^_poweroftwo *
-		 * Valid for Ints up to 32 bits *
+		/** Gcd with 2^_poweroftwo .
+		 * Valid for Ints up to 32 bits
 		 * Specialization is required for bigger Ints
+		 * @param x
+		 * @param y
 		 */
 		Element &gcd_poweroftwo (Element &x,const Element &y) const
-		{ 
-		  return x=GCD2E32(y);
+		{
+			return x=GCD2E32(y);
 		}
 
 		/** Does x divide y */
 		bool doesdivide (const Element &x, const Element &y) const
-		{ 
+		{
 			Element tmp1,tmp2;
 			gcd_poweroftwo(tmp1,x),gcd_poweroftwo(tmp2,y);
 			return tmp1<=tmp2;
 		}
 
-		/** Power of two in x 
+		/** Power of two in x
 		 * Input Element x = 2^n*y where y is odd
 		 * Output n
 		 */
@@ -214,15 +222,20 @@ namespace LinBox
 			//printf("tmp = %d\n",tmp);
 			int n=0;
 			while(tmp^1)
-				{
-					tmp>>=1;
-					++n;
-					//printf("tmp = %d et n = %d\n",tmp,n);
-				}
+			{
+				tmp>>=1;
+				++n;
+				//printf("tmp = %d et n = %d\n",tmp,n);
+			}
 			return n;
-					
+
 		}
 
+		/*! bezout.
+		 * @param x,y
+		 * @param gcd
+		 * @param u,v
+		 */
 		Element &bezout(const Element &x, const Element &y, Element &gcd, Element &u, Element &v) const
 		{
 			Element v1,v2,v3,t1,t2,t3,q;
@@ -233,18 +246,18 @@ namespace LinBox
 			v2=1;
 			v3=y;
 			while(v3!=0)
-				{
-					q=gcd/v3;
-					t1=u-q*v1;
-					t2=v-q*v2;
-					t3=gcd-q*v3;
-					u=v1;
-					v=v2;
-					gcd=v3;
-					v1=t1;
-					v2=t2;
-					v3=t3;
-				}
+			{
+				q=gcd/v3;
+				t1=u-q*v1;
+				t2=v-q*v2;
+				t3=gcd-q*v3;
+				u=v1;
+				v=v2;
+				gcd=v3;
+				v1=t1;
+				v2=t2;
+				v3=t3;
+			}
 			return gcd;
 		}
 
@@ -257,7 +270,7 @@ namespace LinBox
 		 * @return output stream to which field is written.
 		 * @param  os  output stream to which field is written.
 		 */
-		std::ostream &write (std::ostream &os) const 
+		std::ostream &write (std::ostream &os) const
 		{ return os << "integers mod 2^" << _poweroftwo; }
 
 		/** Read field.
@@ -275,7 +288,7 @@ namespace LinBox
 		 */
 		std::ostream &write (std::ostream &os, const Element &x) const
 		{ return os << x; }
- 
+
 		/** Read field base element.
 		 * This function assumes the field base element has already been
 		 * constructed and initialized.
@@ -290,7 +303,7 @@ namespace LinBox
 
 
 
-		//@}  
+		//@}
 
 		/** @name Arithmetic Operations
 		 * x <- y op z; x <- op y
@@ -313,7 +326,7 @@ namespace LinBox
 		{
 			return x = y + z;
 		}
- 
+
 		/** Subtraction.
 		 * x = y - z
 		 * This function assumes all the field base elements have already been
@@ -324,10 +337,10 @@ namespace LinBox
 		 * @param  z field base element.
 		 */
 		Element &sub (Element &x, const Element &y, const Element &z) const
-		{ 
+		{
 			return x = y - z;
 		}
- 
+
 		/** Multiplication.
 		 * x = y * z
 		 * This function assumes all the field base elements have already been
@@ -339,7 +352,7 @@ namespace LinBox
 		 */
 		Element &mul (Element &x, const Element &y, const Element &z) const
 		{ return x = (y * z); }
- 
+
 		/** Division.
 		 * x = y / z
 		 * This function assumes all the field base elements have already been
@@ -351,7 +364,7 @@ namespace LinBox
 		 * @param  z field base element.
 		 */
 		Element &div (Element &x, const Element &y, const Element &z) const
-		{ 
+		{
 			int n=poweroftwoinx(z);
 			Element tmp;
 			inv(tmp, z>>n );
@@ -369,7 +382,7 @@ namespace LinBox
 		Element &neg (Element &x, const Element &y) const
 		{ return x = (~y)+1; }
 		//{ return x = 0-y; }
- 
+
 		/** Multiplicative Inverse.
 		 * x = 1 / y
 		 * This function assumes both field base elements have already been
@@ -385,10 +398,10 @@ namespace LinBox
 			neg(v,y>>1);
 			u=(y+(v<<2));
 			for(unsigned int puiss=2;puiss<_poweroftwo;puiss<<=1)
-				{
-					v*=v;
-					u*=(u*y+(v<<(puiss+1)));
-				}
+			{
+				v*=v;
+				u*=(u*y+(v<<(puiss+1)));
+			}
 			return x=u;
 		}
 
@@ -413,7 +426,7 @@ namespace LinBox
 
 		/** Natural AXPY.
 		 * r  = a * x + y
-		 * This function assumes all field elements have already been 
+		 * This function assumes all field elements have already been
 		 * constructed and initialized.
 		 * @return reference to r.
 		 * @param  r field element (reference returned).
@@ -421,16 +434,16 @@ namespace LinBox
 		 * @param  x field element.
 		 * @param  y field element.
 		 */
-		Element &axpy (Element &r, 
-			       const Element &a, 
-			       const Element &x, 
+		Element &axpy (Element &r,
+			       const Element &a,
+			       const Element &x,
 			       const Element &y) const
-		{ 
+		{
 			return r = (a * x + y);
 		}
 
 		//@} Arithmetic Operations
- 
+
 		/** @name Inplace Arithmetic Operations
 		 * x <- x op y; x <- op x
 		 */
@@ -445,10 +458,10 @@ namespace LinBox
 		 * @param  y field base element.
 		 */
 		Element &addin (Element &x, const Element &y) const
-		{ 
+		{
 			return x += y;
 		}
- 
+
 		/** Inplace Subtraction.
 		 * x -= y
 		 * This function assumes both field base elements have already been
@@ -461,7 +474,7 @@ namespace LinBox
 		{
 			return x -= y;
 		}
- 
+
 		/** Inplace Multiplication.
 		 * x *= y
 		 * This function assumes both field base elements have already been
@@ -474,7 +487,7 @@ namespace LinBox
 		{
 			return x*=y;
 		}
- 
+
 		/** Inplace Division.
 		 * x /= y
 		 * This function assumes both field base elements have already been
@@ -489,7 +502,7 @@ namespace LinBox
 			inv (temp, y);
 			return mulin (x, temp);
 		}
- 
+
 		/** Inplace Additive Inverse (Inplace Negation).
 		 * x = - x
 		 * This function assumes the field base element has already been
@@ -501,7 +514,7 @@ namespace LinBox
 		{
 			return x = (~x)+1;
 		}
- 
+
 		/** Inplace Multiplicative Inverse.
 		 * x = 1 / x
 		 * This function assumes the field base elementhas already been
@@ -514,7 +527,7 @@ namespace LinBox
 
 		/** Inplace AXPY.
 		 * r  += a * x
-		 * This function assumes all field elements have already been 
+		 * This function assumes all field elements have already been
 		 * constructed and initialized.
 		 * Purely virtual
 		 * @return reference to r.
@@ -523,7 +536,7 @@ namespace LinBox
 		 * @param  x field element.
 		 */
 		Element &axpyin (Element &r, const Element &a, const Element &x) const
-		{ 
+		{
 			return r = (r + a * x);
 		}
 
@@ -532,25 +545,28 @@ namespace LinBox
 
 		//@}
 
-	protected:
+protected:
 
 		/// Private (non-static) element for modulus
 		Element _poweroftwo;
 
-	}; // class PowerOfTwoModular
-	
-	/* Specialization of gcd_poweroftwo for Int64
- 	 */
-/* 	template<> */
-/* 	  PowerOfTwoModular<int64>::Element&  */
-/* 	  PowerOfTwoModular<int64>::gcd_poweroftwo (Element &x,const Element &y) const */
-/* 		{  */
-/* 		  return x=GCD2E64(y); */
-/* 		}  */
+}; // class PowerOfTwoModular
+
+#if 0
+/* Specialization of gcd_poweroftwo for Int64
+*/
+template<>
+PowerOfTwoModular<int64_t>::Element&
+PowerOfTwoModular<int64_t>::gcd_poweroftwo (Element &x,const Element &y) const
+{
+	return x=GCD2E64(y);
+}
+#endif
 
 } // namespace LinBox
 
 // #include "linbox/field/modular.inl"
 // #include "linbox/randiter/modular.h"
 
-#endif // __POWEROFTWOMODULAR_H
+#endif // __LINBOX_poweroftwomodular_H
+
diff --git a/linbox/ring/ring-interface.h b/linbox/ring/ring-interface.h
index 8fb367d..7ae0b0e 100644
--- a/linbox/ring/ring-interface.h
+++ b/linbox/ring/ring-interface.h
@@ -1,6 +1,7 @@
 /* -*- 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
 /* linbox/ring/ring-interface.h
+ * Copyright(C) LinBox
  * Written by
  *  Jean-Guillaume Dumas <Jean-Guillaume.Dumas at imag.fr>
  *  Clément Pernet <Clement.Pernet at imag.fr>
@@ -8,58 +9,59 @@
  * For licensing information see COPYING
  */
 
-#ifndef __RING_INTERFACE_H
-#define __RING_INTERFACE_H
+#ifndef __LINBOX_ring_interface_H
+#define __LINBOX_ring_interface_H
 
 namespace LinBox
 {
-// LinBox Ring Interface
-/*
- * The LinBox {@link Rings ring} common object {@link Interfaces interface}.
- * The ring interface includes the following public members:
- *
- * Types: {\tt Element} and {\tt RandIter}.
- *
- * Object management member functions:
- *   null constructor, copy constructor, destructor, assignment operator, 
- *   {\tt convert(), init(), assign(), characteristic(), cardinality()}.
- *
- * Predicates on ring elements:
- *   {\tt areEqual(), isZero(), isOne()}.
- *
- * Basic arithmetic functions:
- *   {\tt axpy(), add(), neg(), sub(), mul(), inv(), div()}.
- *
- * Inplace arithmetic functions:
- *   {\tt axpyin(), addin(), negin(), subin(), mulin(), invin(), divin()}.
- *
- * I/O functions:
- *   {\tt read()} and {\tt write()} for I/O of the ring itself and for I/O of its elements.
- *
- * The ring archetype class is is the reference instantiation of this 
- * interface and contains the generic specifications of the member functions.
- * Documentation in other ring classes is more limited. It serves primarily to explain special properties 
- * specific to the class of the interface member functions and to explain any constructors 
- * or other functionality unique to the class.
- *
- *  @see Interfaces
-*/
-/** 
- * @brief This ring base class exists solely to aid documentation organization.
+	// LinBox Ring Interface
+	/*
+	 * The LinBox @link Rings ring at endlink common object @link Interfaces interface at endlink.
+	 * The ring interface includes the following public members:
+	 *
+	 * Types: \c Element and \c RandIter.
+	 *
+	 * Object management member functions:
+	 *   null constructor, copy constructor, destructor, assignment operator,
+	 *   \c convert(), \c init(), \c assign(), \c characteristic(),\c cardinality().
+	 *
+	 * Predicates on ring elements:
+	 *   \c areEqual(), \c isZero(), \c isOne().
+	 *
+	 * Basic arithmetic functions:
+	 *   \c axpy(), \c add(), \c neg(), \c sub(), \c mul(), \c inv(), \c div().
+	 *
+	 * Inplace arithmetic functions:
+	 *   \c axpyin(), \c addin(), \c negin(), \c subin(), \c mulin(), \c invin(), \c divin().
+	 *
+	 * I/O functions:
+	 *   \c read() and \c write() for I/O of the ring itself and for I/O of its elements.
+	 *
+	 * The ring archetype class is is the reference instantiation of this
+	 * interface and contains the generic specifications of the member functions.
+	 * Documentation in other ring classes is more limited. It serves primarily to explain special properties
+	 * specific to the class of the interface member functions and to explain any constructors
+	 * or other functionality unique to the class.
+	 *
+	 *  @see Interfaces
+	 */
+	/**
+	 * @brief This ring base class exists solely to aid documentation organization.
 
- *  For the general ring member function documentation consult the {@link RingArchetype
- RingArchetype}. For specific properties of individual representations consult the specific ring classes.
- */
-  class RingInterface 
-{
-/*
-    public:
-	// this just demo's that some declarations could be here.
-	typedef ElementArchetype Element; 
-	virtual Element& mul(Element& c, const Element& a, const Element& b) const = 0;
-*/
-};// empty class so doc++ makes a nice hierarchy.
+	 *  For the general ring member function documentation consult the
+	 *  @link RingArchetype RingArchetype at endlink. For specific properties
+	 *  of individual representations consult the specific ring classes.
+	 */
+	class RingInterface {
+		/*
+		   public:
+		// this just demo's that some declarations could be here.
+		typedef ElementArchetype Element;
+		virtual Element& mul(Element& c, const Element& a, const Element& b) const = 0;
+		*/
+	};// empty class so doc++ makes a nice hierarchy.
 
 } // namespace LinBox
 
-#endif // __RING_INTERFACE_H
+#endif // __LINBOX_ring_interface_H
+
diff --git a/linbox/ring/ring.doxy b/linbox/ring/ring.doxy
index 750232a..78e4050 100644
--- a/linbox/ring/ring.doxy
+++ b/linbox/ring/ring.doxy
@@ -1,10 +1,13 @@
-/** \defgroup ring linbox/ring
+/** \ingroup linbox
+  \defgroup ring ring
 
-LinBox rings, ring wrappers, ring construction tools.
+  \brief LinBox rings, ring wrappers, ring construction tools.
 
-LinBox rings implement the ring concept,
-inheriting from the field concept,
-as it is defined in the ring archetype. 
+  LinBox rings implement the ring concept,
+  inheriting from the field concept,
+  as it is defined in the ring archetype.
 
-*/
+ */
+
+// vim:syn=doxygen
 
diff --git a/linbox/solutions/Makefile.am b/linbox/solutions/Makefile.am
index 821efa8..d6e35de 100644
--- a/linbox/solutions/Makefile.am
+++ b/linbox/solutions/Makefile.am
@@ -1,17 +1,31 @@
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+#
+AM_CXXFLAGS = @DEFAULT_CFLAGS@ -DLinBoxSrcOnly
 pkgincludesubdir=$(pkgincludedir)/solutions
 
-pkgincludesub_HEADERS=		\
-	methods.h		\
-	minpoly.h		\
-	rank.h			\
-	trace.h			\
-	getentry.h			\
-	det.h			\
-	solve.h                 \
-	is-positive-definite.h  \
-	is-positive-semidefinite.h  \
-	charpoly.h		\
-	valence.h	\
-	smith-form.h
+pkgincludesub_HEADERS=          \
+    methods.h                   \
+    minpoly.h                   \
+    rank.h                      \
+    trace.h                     \
+    getentry.h                  \
+    det.h                       \
+    solve.h                     \
+    is-positive-definite.h      \
+    is-positive-semidefinite.h  \
+    charpoly.h                  \
+    valence.h                   \
+    nullspace.h                 \
+    smith-form.h
 
-EXTRA_DIST = solutions.doxy
+EXTRA_DIST =                \
+    solutions.doxy          \
+    systemsolving.doxy      \
+    rank.doxy               \
+    determinant.doxy        \
+    minpoly.doxy            \
+    charpoly.doxy           \
+    reducedforms.doxy       \
+    nullspace.doxy
diff --git a/linbox/solutions/Makefile.in b/linbox/solutions/Makefile.in
index 59fb4ee..8ba79ca 100644
--- a/linbox/solutions/Makefile.in
+++ b/linbox/solutions/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -37,19 +38,26 @@ DIST_COMMON = $(pkgincludesub_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
-	$(top_srcdir)/macros/blas-check.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
 	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
 	$(top_srcdir)/macros/givaro-check.m4 \
 	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
 	$(top_srcdir)/macros/lidia-check.m4 \
 	$(top_srcdir)/macros/linbox-doc.m4 \
 	$(top_srcdir)/macros/linbox-misc.m4 \
 	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
 	$(top_srcdir)/macros/maple-check.m4 \
 	$(top_srcdir)/macros/ntl-check.m4 \
 	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -79,18 +87,21 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
 CC = @CC@
+CCNAM = @CCNAM@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
 DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -98,19 +109,24 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
 GIVARO_CFLAGS = @GIVARO_CFLAGS@
 GIVARO_LIBS = @GIVARO_LIBS@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
 GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
@@ -118,41 +134,52 @@ LIBTOOL = @LIBTOOL@
 LIDIA_CFLAGS = @LIDIA_CFLAGS@
 LIDIA_LIBS = @LIDIA_LIBS@
 LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MAPLE_CFLAGS = @MAPLE_CFLAGS@
 MAPLE_HOME = @MAPLE_HOME@
 MAPLE_LIBS = @MAPLE_LIBS@
 MAPLE_VERSION = @MAPLE_VERSION@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
 NTL_CFLAGS = @NTL_CFLAGS@
 NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RM = @RM@
 SACLIB_CFLAGS = @SACLIB_CFLAGS@
 SACLIB_LIBS = @SACLIB_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+TESTS_CFLAGS = @TESTS_CFLAGS@
 VERSION = @VERSION@
+WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -193,24 +220,41 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+#
+AM_CXXFLAGS = @DEFAULT_CFLAGS@ -DLinBoxSrcOnly
 pkgincludesubdir = $(pkgincludedir)/solutions
 pkgincludesub_HEADERS = \
-	methods.h		\
-	minpoly.h		\
-	rank.h			\
-	trace.h			\
-	getentry.h			\
-	det.h			\
-	solve.h                 \
-	is-positive-definite.h  \
-	is-positive-semidefinite.h  \
-	charpoly.h		\
-	valence.h	\
-	smith-form.h
-
-EXTRA_DIST = solutions.doxy
+    methods.h                   \
+    minpoly.h                   \
+    rank.h                      \
+    trace.h                     \
+    getentry.h                  \
+    det.h                       \
+    solve.h                     \
+    is-positive-definite.h      \
+    is-positive-semidefinite.h  \
+    charpoly.h                  \
+    valence.h                   \
+    nullspace.h                 \
+    smith-form.h
+
+EXTRA_DIST = \
+    solutions.doxy          \
+    systemsolving.doxy      \
+    rank.doxy               \
+    determinant.doxy        \
+    minpoly.doxy            \
+    charpoly.doxy           \
+    reducedforms.doxy       \
+    nullspace.doxy
+
 all: all-am
 
 .SUFFIXES:
@@ -218,8 +262,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
 	      exit 1;; \
 	  esac; \
 	done; \
@@ -272,7 +316,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
@@ -385,6 +429,8 @@ dvi-am:
 
 html: html-am
 
+html-am:
+
 info: info-am
 
 info-am:
@@ -393,18 +439,28 @@ install-data-am: install-pkgincludesubHEADERS
 
 install-dvi: install-dvi-am
 
+install-dvi-am:
+
 install-exec-am:
 
 install-html: install-html-am
 
+install-html-am:
+
 install-info: install-info-am
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-am
 
+install-pdf-am:
+
 install-ps: install-ps-am
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
diff --git a/linbox/solutions/charpoly.doxy b/linbox/solutions/charpoly.doxy
new file mode 100644
index 0000000..30f617b
--- /dev/null
+++ b/linbox/solutions/charpoly.doxy
@@ -0,0 +1,9 @@
+// Copyright (C) 2010 LinBox, GNU LGPL, see COPYING for licence information
+
+/** @ingroup solutions
+ at defgroup  charpoly Characteristic polynomial
+ at brief NO DOC YET
+
+*/
+
+// vim:syntax=doxygen
diff --git a/linbox/solutions/charpoly.h b/linbox/solutions/charpoly.h
index c8743de..a91f42f 100644
--- a/linbox/solutions/charpoly.h
+++ b/linbox/solutions/charpoly.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/solutions/charpoly.h
  * Copyright (C) 2005 Clement Pernet
  *
@@ -21,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __CHARPOLY_H
-#define __CHARPOLY_H
+#ifndef __LINBOX_charpoly_H
+#define __LINBOX_charpoly_H
 
 
 
@@ -43,61 +43,57 @@ namespace LinBox
 {
 
 	// for specialization with respect to the DomainCategory
- 	template< class Blackbox, class Polynomial, class MyMethod, class DomainCategory>
- 	Polynomial &charpoly ( Polynomial            &P, 
- 			       const Blackbox        &A,
- 			       const DomainCategory  &tag,
- 			       const MyMethod        &M);
-	
-
-	//error handler for rational domain
-	template <class Blackbox, class Polynomial>
-	Polynomial &charpoly (Polynomial& P,
-			      const Blackbox& A,
-			      const RingCategories::RationalTag& tag,
-			      const Method::Hybrid& M)
-	{
-		throw LinboxError("LinBox ERROR: charpoly is not yet define over a rational domain");
-	}
-
-        /** \brief  ...using an optional Method parameter
-	    \param P - the output characteristic polynomial.  If the polynomial 
-	    is of degree d, this random access container has size d+1, the 0-th 
-	    entry is the constant coefficient and the d-th is 1 since the charpoly 
-	    is monic.
-	    \param A - a blackbox matrix
-	    Optional \param M - the method object.  Generally, the default
-	    object suffices and the algorithm used is determined by the class of M.
-	    Basic methods are Method::Blackbox, Method::Elimination, and 
-	    Method::Hybrid (the default).
-	    See methods.h for more options.
-	    \return a reference to P.
-	*/
+	template< class Blackbox, class Polynomial, class MyMethod, class DomainCategory>
+	Polynomial &charpoly ( Polynomial            &P,
+			       const Blackbox        &A,
+			       const DomainCategory  &tag,
+			       const MyMethod        &M);
+
+
+	/*	//error handler for rational domain
+		template <class Blackbox, class Polynomial>
+		Polynomial &charpoly (Polynomial& P,
+		const Blackbox& A,
+		const RingCategories::RationalTag& tag,
+		const Method::Hybrid& M)
+		{
+		throw LinboxError("LinBox ERROR: charpoly is not yet defined over a rational domain");
+		}
+		*/
+	/** \brief  ...using an optional Method parameter
+	  \param P - the output characteristic polynomial.  If the polynomial
+	  is of degree d, this random access container has size d+1, the 0-th
+	  entry is the constant coefficient and the d-th is 1 since the charpoly
+	  is monic.
+	  \param A - a blackbox matrix
+	  Optional \param M - the method object.  Generally, the default
+	  object suffices and the algorithm used is determined by the class of M.
+	  Basic methods are Method::Blackbox, Method::Elimination, and
+	  Method::Hybrid (the default).
+	  See methods.h for more options.
+	  \return a reference to P.
+	  */
 	template <class Blackbox, class Polynomial, class MyMethod>
-	Polynomial &charpoly (Polynomial         & P, 
+	Polynomial &charpoly (Polynomial         & P,
 			      const Blackbox     & A,
 			      const MyMethod     & M){
 		return charpoly( P, A, typename FieldTraits<typename Blackbox::Field>::categoryTag(), M);
 	}
-}
-
 
-namespace LinBox
-{
 
 	/// \brief ...using default method
 	template<class Blackbox, class Polynomial>
-	Polynomial &charpoly (Polynomial        & P, 
+	Polynomial &charpoly (Polynomial        & P,
 			      const Blackbox    & A)
 	{
 		return charpoly (P, A, Method::Hybrid());
 	}
 
-	// The charpoly with Hybrid Method 
-	template<class Polynomial, class Blackbox, class DomainCategory>
-	Polynomial &charpoly (Polynomial            &P, 
+	// The charpoly with Hybrid Method
+	template<class Polynomial, class Blackbox>
+	Polynomial &charpoly (Polynomial            &P,
 			      const Blackbox        &A,
-			      const DomainCategory  &tag,
+			      const RingCategories::ModularTag  &tag,
 			      const Method::Hybrid  &M)
 	{
 		// not yet a hybrid
@@ -105,112 +101,198 @@ namespace LinBox
 		return charpoly(P, A, tag, Method::BlasElimination(M));
 	}
 
-	// The charpoly with Hybrid Method 
-	template<class Polynomial, class Domain, class DomainCategory>
-	Polynomial &charpoly (Polynomial            &P, 
+	// The charpoly with Hybrid Method
+	template<class Polynomial, class Domain>
+	Polynomial &charpoly (Polynomial            &P,
 			      const SparseMatrix<Domain>  &A,
-			      const DomainCategory  &tag,
+			      const RingCategories::ModularTag  &tag,
 			      const Method::Hybrid  &M)
 	{
 		// not yet a hybrid
 		return charpoly(P, A, tag, Method::Blackbox(M));
 	}
-	// The charpoly with Hybrid Method 
-	template<class Polynomial, class Domain, class DomainCategory>
-	Polynomial &charpoly (Polynomial            &P, 
+	// The charpoly with Hybrid Method
+	template<class Polynomial, class Domain>
+	Polynomial &charpoly (Polynomial            &P,
 			      const DenseMatrix<Domain> &A,
-			      const DomainCategory  &tag,
+			      const RingCategories::ModularTag  &tag,
 			      const Method::Hybrid  &M)
 	{
 		// not yet a hybrid
 		return charpoly(P, A, tag, Method::BlasElimination(M));
 	}
-	
-	// The charpoly with Elimination Method 
-	template<class Polynomial, class Blackbox, class DomainCategory>
-	Polynomial &charpoly (Polynomial                &P, 
+
+	// The charpoly with Elimination Method
+	template<class Polynomial, class Blackbox>
+	Polynomial &charpoly (Polynomial                &P,
 			      const Blackbox            &A,
-			      const DomainCategory      &tag,
+			      const RingCategories::ModularTag      &tag,
 			      const Method::Elimination &M)
 	{
 		return charpoly(P, A, tag, Method::BlasElimination(M));
 	}
 
 
-	/** @brief Compute the characteristic polynomial over <bold>Z</bold><sub>p</sub>
+	/** @brief Compute the characteristic polynomial over \f$\mathbf{Z}_p\f$.
 	 *
-	 * Compute the characteristic polynomial of a matrix using dense 
+	 * Compute the characteristic polynomial of a matrix using dense
 	 * elimination methods
 
 	 * @param P Polynomial where to store the result
 	 * @param A Blackbox representing the matrix
+	 * @param tag
+	 * @param M
 	 */
 	template < class Polynomial, class Blackbox >
-	Polynomial& charpoly (Polynomial                       & P, 
+	Polynomial& charpoly (Polynomial                       & P,
 			      const Blackbox                   & A,
 			      const RingCategories::ModularTag & tag,
-			      const Method::BlasElimination    & M) 
-	{ 	
+			      const Method::BlasElimination    & M)
+	{
 		if (A.coldim() != A.rowdim())
 			throw LinboxError("LinBox ERROR: matrix must be square for characteristic polynomial computation\n");
-		
-		BlasBlackbox< typename Blackbox::Field > BBB (A);
+
+		BlasBlackbox< typename Blackbox::Field >     BBB (A);
 		BlasMatrixDomain< typename Blackbox::Field > BMD (BBB.field());
 		return BMD.charpoly (P, static_cast<BlasMatrix<typename Blackbox::Field::Element> >(BBB));
 	}
 
 }
 
-//	#if 0
+#include "linbox/algorithms/matrix-hom.h"
+
+#include "linbox/algorithms/rational-cra2.h"
+#include "linbox/algorithms/varprec-cra-early-multip.h"
+#include "linbox/algorithms/charpoly-rational.h"
+
+namespace LinBox
+{
+	template <class Blackbox, class MyMethod>
+	struct IntegerModularCharpoly {
+		const Blackbox &A;
+		const MyMethod &M;
+
+		IntegerModularCharpoly(const Blackbox& b, const MyMethod& n) :
+			A(b), M(n)
+		{}
+
+		template<typename Polynomial, typename Field>
+		Polynomial& operator()(Polynomial& P, const Field& F) const
+		{
+			typedef typename Blackbox::template rebind<Field>::other FBlackbox;
+			FBlackbox Ap(A, F);
+			return charpoly( P, Ap, typename FieldTraits<Field>::categoryTag(), M);
+			// 			integer p;
+			// 			F.characteristic(p);
+			//			std::cerr<<"Charpoly(A) mod "<<p<<" = "<<P;
+		}
+	};
+
+	template < class Blackbox,  class Polynomial >
+	Polynomial& charpoly (Polynomial                       & P,
+			      const Blackbox                   & A,
+			      const RingCategories::IntegerTag & tag,
+			      const Method::Hybrid	       & M)
+	{
+		commentator.start ("Integer Charpoly", "Icharpoly");
+		if ( (A.rowdim() < 1000) && (A.coldim() <1000) )
+			charpoly(P, A, tag, Method::BlasElimination(M) );
+		else
+			charpoly(P, A, tag, Method::Blackbox(M) );
+		commentator.stop ("done", NULL, "Icharpoly");
+		return P;
+	}
+
+	//#if 0
 #if defined(__LINBOX_HAVE_NTL) && defined(__LINBOX_HAVE_GIVARO)
+}
 
 #include "linbox/algorithms/cia.h"
-namespace LinBox {
+namespace LinBox
+{
+#if 0
+
+	// The charpoly with Hybrid Method
+	template<class Blackbox, class Polynomial>
+	Polynomial &charpoly (Polynomial                        &P,
+			      const Blackbox                    &A,
+			      const RingCategories::IntegerTag  &tag,
+			      const Method::Hybrid              &M)
+	{
+		// not yet a hybrid
+		return charpoly(P, A, tag, Method::Blackbox(M));
+	}
+#endif
+
+	template < class IntRing, class Polynomial >
+	Polynomial& charpoly (Polynomial                       & P,
+			      const DenseMatrix<IntRing>         & A,
+			      const RingCategories::IntegerTag & tag,
+			      const Method::Hybrid             & M)
+	{
+		commentator.start ("DenseMatrix Integer Charpoly", "Icharpoly");
+		charpoly(P, A, tag, Method::BlasElimination(M) );
+		commentator.stop ("done", NULL, "Icharpoly");
+		return P;
+	}
+
+	template < class IntRing, class Polynomial >
+	Polynomial& charpoly (Polynomial                       & P,
+			      const BlasMatrix<IntRing>         & A,
+			      const RingCategories::IntegerTag & tag,
+			      const Method::Hybrid             & M)
+	{
+		commentator.start ("BlasMatrix Integer Charpoly", "Icharpoly");
+		charpoly(P, A, tag, Method::BlasElimination(M) );
+		commentator.stop ("done", NULL, "Icharpoly");
+		return P;
+	}
+
 	/** @brief Compute the characteristic polynomial over {\bf Z}
 	 *
-	 * Compute the characteristic polynomial of a matrix using dense 
+	 * Compute the characteristic polynomial of a matrix using dense
 	 * elimination methods
 
 	 * @param P Polynomial where to store the result
-	 * @param A \ref{Blacbox} representing the matrix
+	 * @param A \ref Black-Box representing the matrix
 	 */
 
 
 	template < class Polynomial, class Blackbox >
-	Polynomial& charpoly (Polynomial                       & P, 
+	Polynomial& charpoly (Polynomial                       & P,
 			      const Blackbox                   & A,
 			      const RingCategories::IntegerTag & tag,
-			      const Method::BlasElimination    & M) 
+			      const Method::BlasElimination    & M)
 	{
 		if (A.coldim() != A.rowdim())
 			throw LinboxError("LinBox ERROR: matrix must be square for characteristic polynomial computation\n");
-		GivPolynomial<typename Blackbox::Field::Element> Pg;
+		typename GivPolynomialRing<typename Blackbox::Field>::Element Pg;
 		return P = cia (Pg, A, M);
 	}
 
 	/** Compute the characteristic polynomial over {\bf Z}
 	 *
-	 * Compute the characteristic polynomial of a matrix, represented via 
+	 * Compute the characteristic polynomial of a matrix, represented via
 	 * a blackBox.
-	 * 
+	 *
 	 * @param P Polynomial where to store the result
-	 * @param A \ref{Blacbox} representing the matrix
+	 * @param A \ref Black-Box representing the matrix
 	 */
 	template < class Polynomial, class Blackbox/*, class Categorytag*/ >
-	Polynomial& charpoly (Polynomial                       & P, 
+	Polynomial& charpoly (Polynomial                       & P,
 			      const Blackbox                   & A,
 			      const RingCategories::IntegerTag & tag,
 			      const Method::Blackbox           & M)
 	{
 		if (A.coldim() != A.rowdim())
 			throw LinboxError("LinBox ERROR: matrix must be square for characteristic polynomial computation\n");
-		GivPolynomial<typename Blackbox::Field::Element> Pg;
-		return P = blackboxcharpoly (Pg, A, tag, M);
+		typename GivPolynomialRing<typename Blackbox::Field>::Element Pg;
+		return P = BBcharpoly::blackboxcharpoly (Pg, A, tag, M);
 	}
 
 
-#else
-
+#else //  no NTL or no Givaro (??)
+}
 
 #include "linbox/field/modular.h"
 #include "linbox/algorithms/cra-domain.h"
@@ -219,15 +301,25 @@ namespace LinBox {
 #include "linbox/randiter/random-prime.h"
 #include "linbox/algorithms/matrix-hom.h"
 
-namespace LinBox {
+namespace LinBox
+{
+
+#if 0
+#include "linbox/algorithms/rational-cra2.h"
+#include "linbox/algorithms/varprec-cra-early-multip.h"
+#include "linbox/algorithms/charpoly-rational.h"
+
+	namespace LinBox
+{
 	template <class Blackbox, class MyMethod>
-	struct IntegerModularCharpoly {       
+	struct IntegerModularCharpoly {
 		const Blackbox &A;
 		const MyMethod &M;
-		
-		IntegerModularCharpoly(const Blackbox& b, const MyMethod& n) 
-			: A(b), M(n) {}
-		
+
+		IntegerModularCharpoly(const Blackbox& b, const MyMethod& n) :
+			A(b), M(n)
+		{}
+
 		template<typename Polynomial, typename Field>
 		Polynomial& operator()(Polynomial& P, const Field& F) const {
 			typedef typename Blackbox::template rebind<Field>::other FBlackbox;
@@ -240,11 +332,12 @@ namespace LinBox {
 
 			delete Ap;
 			return P;
-		}            
+		}
 	};
-       
+#endif
+
 	template < class Polynomial,class Blackbox >
-	Polynomial& charpoly (Polynomial                       & P, 
+	Polynomial& charpoly (Polynomial                       & P,
 			      const Blackbox                   & A,
 			      const RingCategories::IntegerTag & tag,
 			      const Method::Blackbox           & M)
@@ -253,35 +346,38 @@ namespace LinBox {
 			throw LinboxError("LinBox ERROR: matrix must be square for characteristic polynomial computation\n");
 
 		commentator.start ("Integer BlackBox Charpoly : No NTL installation -> chinese remaindering", "IbbCharpoly");
-		
-		RandomPrimeIterator genprime( 26-(int)ceil(log((double)A.rowdim())*0.7213475205)); 
-
-		// typename Blackbox::ConstRawIterator it = A.rawBegin();
-// 		typename Blackbox::ConstRawIterator it_end = A.rawEnd();
-// 		integer max = 1,min=0;
-// 		while( it != it_end ){
-// 			//      cerr<<"it="<<(*it)<<endl;
-// 			if (max < (*it))
-// 				max = *it; 
-// 			if ( min > (*it))
-// 				min = *it;
-// 			it++;
-// 		}
-// 		if (max<-min) 
-// 			max=-min;
-// 		size_t n=A.coldim();		
-// 		double hadamarcp = n/2.0*(log(double(n))+2*log(double(max))+0.21163275)/log(2.0);
-
-// 		ChineseRemainder< FullMultipCRA<Modular<double> > > cra(hadamarcp);
- 		ChineseRemainder< EarlyMultipCRA<Modular<double> > > cra(3UL);		
+
+		RandomPrimeIterator genprime( 26-(int)ceil(log((double)A.rowdim())*0.7213475205));
+#if 0
+		typename Blackbox::ConstRawIterator it = A.rawBegin();
+		typename Blackbox::ConstRawIterator it_end = A.rawEnd();
+		integer max = 1,min=0;
+		while( it != it_end ){
+			//      cerr<<"it="<<(*it)<<endl;
+			if (max < (*it))
+				max = *it;
+			if ( min > (*it))
+				min = *it;
+			it++;
+		}
+		if (max<-min)
+			max=-min;
+		size_t n=A.coldim();
+		double hadamarcp = n/2.0*(log(double(n))+2*log(double(max))+0.21163275)/log(2.0);
+
+		ChineseRemainder< FullMultipCRA<Modular<double> > > cra(hadamarcp);
+#endif
+		ChineseRemainder< EarlyMultipCRA<Modular<double> > > cra(3UL);
 
 		IntegerModularCharpoly<Blackbox,Method::Blackbox> iteration(A, M);
 		cra.operator() (P, iteration, genprime);
 		commentator.stop ("done", NULL, "IbbCharpoly");
 		return P;
 	}
+
+
 	template < class Polynomial,class Blackbox >
-	Polynomial& charpoly (Polynomial                       & P, 
+	Polynomial& charpoly (Polynomial                       & P,
 			      const Blackbox                   & A,
 			      const RingCategories::IntegerTag & tag,
 			      const Method::BlasElimination    & M)
@@ -290,29 +386,28 @@ namespace LinBox {
 			throw LinboxError("LinBox ERROR: matrix must be square for characteristic polynomial computation\n");
 
 		commentator.start ("Integer Dense Charpoly : No NTL installation -> chinese remaindering", "IbbCharpoly");
-		
-		RandomPrimeIterator genprime( 26-(int)ceil(log((double)A.rowdim())*0.7213475205)); 
-
-
-// 		typename Blackbox::ConstRawIterator it = A.rawBegin();
-// 		typename Blackbox::ConstRawIterator it_end = A.rawEnd();
-// 		integer max = 1,min=0;
-// 		while( it != it_end ){
-// 			//      cerr<<"it="<<(*it)<<endl;
-// 			if (max < (*it))
-// 				max = *it; 
-// 			if ( min > (*it))
-// 				min = *it;
-// 			it++;
-// 		}
-// 		if (max<-min) 
-// 			max=-min;
-// 		size_t n=A.coldim();
-// 		double hadamarcp = n/2.0*(log(double(n))+2*log(double(max))+0.21163275)/log(2.0);
-
-		
-//		ChineseRemainder< FullMultipCRA<Modular<double> > > cra(hadamarcp);
 
+		RandomPrimeIterator genprime( 26-(int)ceil(log((double)A.rowdim())*0.7213475205));
+#if 0
+		typename Blackbox::ConstRawIterator it = A.rawBegin();
+		typename Blackbox::ConstRawIterator it_end = A.rawEnd();
+		integer max = 1,min=0;
+		while( it != it_end ){
+			//      cerr<<"it="<<(*it)<<endl;
+			if (max < (*it))
+				max = *it;
+			if ( min > (*it))
+				min = *it;
+			it++;
+		}
+		if (max<-min)
+			max=-min;
+		size_t n=A.coldim();
+		double hadamarcp = n/2.0*(log(double(n))+2*log(double(max))+0.21163275)/log(2.0);
+
+
+		ChineseRemainder< FullMultipCRA<Modular<double> > > cra(hadamarcp);
+#endif
 		ChineseRemainder< EarlyMultipCRA<Modular<double> > > cra(3UL);
 		IntegerModularCharpoly<Blackbox,Method::BlasElimination> iteration(A, M);
 		cra(P, iteration, genprime);
@@ -320,19 +415,21 @@ namespace LinBox {
 		return P;
 	}
 
-#endif	
 
-	
-	/** Compute the characteristic polynomial over <bold>Z</bold><sub>p</sub>.
+#endif
+
+	/** Compute the characteristic polynomial over \f$\mathbf{Z}_p\f$.
 	 *
-	 * Compute the characteristic polynomial of a matrix, represented via 
+	 * Compute the characteristic polynomial of a matrix, represented via
 	 * a blackBox.
-	 * 
+	 *
 	 * @param P Polynomial where to store the result
 	 * @param A Blackbox representing the matrix
+	 * @param tag
+	 * @param M
 	 */
 	template < class Polynomial, class Blackbox/*, class Categorytag*/ >
-	Polynomial& charpoly (Polynomial                       & P, 
+	Polynomial& charpoly (Polynomial                       & P,
 			      const Blackbox                   & A,
 			      const RingCategories::ModularTag & tag,
 			      const Method::Blackbox           & M)
@@ -341,14 +438,46 @@ namespace LinBox {
 			throw LinboxError("LinBox ERROR: matrix must be square for characteristic polynomial computation\n");
 
 #ifdef __LINBOX_HAVE_GIVARO
-		GivPolynomial<typename Blackbox::Field::Element> Pg;
-		return P = blackboxcharpoly (Pg, A, tag, M);
+		typename GivPolynomialRing<typename Blackbox::Field>::Element Pg;
+		return P = BBcharpoly::blackboxcharpoly (Pg, A, tag, M);
 #else
 		return charpoly(P, A, tag, Method::BlasElimination());
 #endif
 	}
-	
 
-}
+	template < class Blackbox, class Polynomial, class MyMethod>
+	Polynomial &charpoly (Polynomial& P, const Blackbox& A,
+			      const RingCategories::RationalTag& tag, const MyMethod& M)
+	{
+		commentator.start ("Rational Charpoly", "Rcharpoly");
+
+		RandomPrimeIterator genprime( 26-(int)ceil(log((double)A.rowdim())*0.7213475205));
+		RationalRemainder2< VarPrecEarlyMultipCRA<Modular<double> > > rra(3UL);
+		IntegerModularCharpoly<Blackbox,MyMethod> iteration(A, M);
+
+		std::vector<Integer> PP; // use of integer due to non genericity of cra. PG 2005-08-04
+		Integer den;
+		rra(PP,den, iteration, genprime);
+		size_t i =0;
+		P.resize(PP.size());
+		for (typename Polynomial::iterator it= P.begin(); it != P.end(); ++it, ++i)
+			A.field().init(*it, PP[i],den);
+
+		commentator.stop ("done", NULL, "Rcharpoly");
+
+		return P;
+	}
+
+	template < class Field, template <class> class Polynomial, class MyMethod>
+	Polynomial<typename Field::Element> &charpoly (Polynomial<typename Field::Element>& P, const DenseMatrix<Field>& A,
+						       const RingCategories::RationalTag& tag, const MyMethod& M)
+	{
+		commentator.start ("Dense Rational Charpoly", "Rcharpoly");
+		rational_charpoly(P,A,M);
+
+		commentator.stop ("done", NULL, "Rcharpoly");
+		return P;
+	}
+}  // end of LinBox namespace
+#endif // __LINBOX_charpoly_H
 
-#endif // __CHARPOLY_H
diff --git a/linbox/solutions/det.h b/linbox/solutions/det.h
index 397fbe8..7bd62c1 100644
--- a/linbox/solutions/det.h
+++ b/linbox/solutions/det.h
@@ -1,7 +1,8 @@
 /* -*- 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
 /* linbox/solutions/det.h
  * Copyright (C) 2001, 2002 LinBox
- * Time-stamp: <20 May 08 13:36:45 Jean-Guillaume.Dumas at imag.fr> 
+ * Time-stamp: <12 Jul 10 09:47:36 Jean-Guillaume.Dumas at imag.fr>
  *
  *
  * This library is free software; you can redistribute it and/or
@@ -19,8 +20,14 @@
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  */
-#ifndef __DET_H
-#define __DET_H
+
+/*! @file solutions/det.h
+ * @ingroup solutions
+ * @brief NO DOC
+ */
+
+#ifndef __LINBOX_det_H
+#define __LINBOX_det_H
 
 #include "linbox/blackbox/diagonal.h"
 #include "linbox/blackbox/compose.h"
@@ -44,104 +51,104 @@
 // Namespace in which all LinBox library code resides
 namespace LinBox
 {
-	/** \brief Compute the determinant of A
+	/** \brief Compute the determinant of A.
 	 *
 	 * The determinant of a linear operator A, represented as a
 	 * black box, is computed over the ring or field of A.
 	 *
-	 * @param d   - Field element into which to store the result
-	 * @param A   - Black box of which to compute the determinant
-	 * @param tag - optional tag.  Specifies Integer, Rational or modular ring/field
-	 * @param M   - optional method.  The default is Method::Hybrid(), Other options
-	 include Blackbox, Elimination, Wiedemann, BlasElimination and SparseElimination.  
-         Sometimes it helps to 	 indicate properties of the matrix in the method object 
-         (for instance symmetry). See class Method for details.
-         \ingroup solutions
-        */
-	template< class Blackbox, class DetMethod, class DomainCategory> 
-	typename Blackbox::Field::Element &det (typename Blackbox::Field::Element          &d, 
+	 * @param d    Field element into which to store the result
+	 * @param A    Black box of which to compute the determinant
+	 * @param tag  optional tag.  Specifies Integer, Rational or modular ring/field
+	 * @param M    optional method.  The default is Method::Hybrid(), Other options
+	 include Blackbox, Elimination, Wiedemann, BlasElimination and SparseElimination.
+	 Sometimes it helps to 	 indicate properties of the matrix in the method object
+	 (for instance symmetry). See class Method for details.
+	 \ingroup solutions
+	 */
+	template< class Blackbox, class DetMethod, class DomainCategory>
+	typename Blackbox::Field::Element &det (typename Blackbox::Field::Element          &d,
 						const Blackbox                             &A,
 						const DomainCategory                     &tag,
 						const DetMethod                           &M);
 
-	// The det where A can be modified in place 
-        // Default is to use the generic det (might copy)
-	template< class Blackbox, class DetMethod, class DomainCategory> 
-	typename Blackbox::Field::Element &detin (typename Blackbox::Field::Element	&d, 
-                                                  Blackbox                             	&A,
-                                                  const DomainCategory			&tag,
-                                                  const DetMethod			&M) 
-        {
-            	return det(d, A, tag, M);
-        }
-
-	// The det with default Method 
+	// The det where A can be modified in place
+	// Default is to use the generic det (might copy)
+	template< class Blackbox, class DetMethod, class DomainCategory>
+	typename Blackbox::Field::Element &detin (typename Blackbox::Field::Element	&d,
+						  Blackbox                             	&A,
+						  const DomainCategory			&tag,
+						  const DetMethod			&M)
+	{
+		return det(d, A, tag, M);
+	}
+
+	// The det with default Method
 	template<class Blackbox>
-	typename Blackbox::Field::Element &det (typename Blackbox::Field::Element	&d, 
+	typename Blackbox::Field::Element &det (typename Blackbox::Field::Element	&d,
 						const Blackbox				&A)
 	{
 		return det(d, A, Method::Hybrid());
 	}
 
-	// The det where A can be modified in place 
+	// The det where A can be modified in place
 	template<class Blackbox>
-	typename Blackbox::Field::Element &detin (typename Blackbox::Field::Element	&d, 
-                                                  Blackbox				&A)
+	typename Blackbox::Field::Element &detin (typename Blackbox::Field::Element	&d,
+						  Blackbox				&A)
 	{
 		return detin(d, A, Method::Hybrid());
 	}
 
 	// The det with category specializer
 	template <class Blackbox, class MyMethod>
-	typename Blackbox::Field::Element &det (typename Blackbox::Field::Element	&d, 
+	typename Blackbox::Field::Element &det (typename Blackbox::Field::Element	&d,
 						const Blackbox				&A,
-						const MyMethod				&M) 
+						const MyMethod				&M)
 	{
 		return det(d, A, typename FieldTraits<typename Blackbox::Field>::categoryTag(), M);
 	}
 
 	// The in place det with category specializer
 	template <class Blackbox, class MyMethod>
-	typename Blackbox::Field::Element &detin (typename Blackbox::Field::Element     &d, 
-                                                  Blackbox                              &A,
-                                                  const MyMethod                        &M) 
+	typename Blackbox::Field::Element &detin (typename Blackbox::Field::Element     &d,
+						  Blackbox                              &A,
+						  const MyMethod                        &M)
 	{
-            	return detin(d, A, typename FieldTraits<typename Blackbox::Field>::categoryTag(), M);
+		return detin(d, A, typename FieldTraits<typename Blackbox::Field>::categoryTag(), M);
 	}
 
-	// The det with Hybrid Method 
+	// The det with Hybrid Method
 	template<class Blackbox>
-	typename Blackbox::Field::Element &det (typename Blackbox::Field::Element	&d, 
+	typename Blackbox::Field::Element &det (typename Blackbox::Field::Element	&d,
 						const Blackbox				&A,
 						const RingCategories::ModularTag	&tag,
 						const Method::Hybrid			&M)
 	{
 		// not yet a hybrid
-		
-		if (useBB(A)) 
+
+		if (useBB(A))
 			return det(d, A, tag, Method::Blackbox(M));
 		else
-		
+
 			return det(d, A, tag, Method::Elimination(M));
 	}
 	template<class Blackbox>
-	typename Blackbox::Field::Element &detin (typename Blackbox::Field::Element	&d, 
-                                                  Blackbox				&A,
-                                                  const RingCategories::ModularTag	&tag,
-                                                  const Method::Hybrid			&M)
+	typename Blackbox::Field::Element &detin (typename Blackbox::Field::Element	&d,
+						  Blackbox				&A,
+						  const RingCategories::ModularTag	&tag,
+						  const Method::Hybrid			&M)
 	{
 		// not yet a hybrid
 		/*
-		  if (useBB(A)) 
-		  return det(d, A, tag, Method::Blackbox(M));
-		  else
-		*/
+		   if (useBB(A))
+		   return det(d, A, tag, Method::Blackbox(M));
+		   else
+		   */
 		return detin(d, A, tag, Method::Elimination(M));
 	}
 
 	// The det with Hybrid Method on DenseMatrix
 	template<class Field>
-	typename Field::Element &det (typename Field::Element         	&d, 
+	typename Field::Element &det (typename Field::Element         	&d,
 				      const DenseMatrix<Field>		&A,
 				      const RingCategories::ModularTag	&tag,
 				      const Method::Hybrid		&M)
@@ -150,38 +157,38 @@ namespace LinBox
 	}
 
 	template<class Field>
-	typename Field::Element &detin (typename Field::Element         	&d, 
-                                        DenseMatrix<Field>			&A,
-                                        const RingCategories::ModularTag	&tag,
-                                        const Method::Hybrid			&M)
+	typename Field::Element &detin (typename Field::Element         	&d,
+					DenseMatrix<Field>			&A,
+					const RingCategories::ModularTag	&tag,
+					const Method::Hybrid			&M)
 	{
 		return detin(d, A, tag, Method::Elimination(M));
 	}
 
 	// Forward declaration saves us from including blackbox/toeplitz.h
 	template<class A, class B> class Toeplitz;
-       
+
 	// Toeplitz determinant
 	template<class CField, class PField >
 	typename CField::Element& det(typename CField::Element		& res,
 				      const Toeplitz<CField,PField>	& A )
-	{ 
-            if (A.coldim() != A.rowdim())
-                throw LinboxError("LinBox ERROR: matrix must be square for determinant computation\n");
-            return A.det(res);
+	{
+		if (A.coldim() != A.rowdim())
+			throw LinboxError("LinBox ERROR: matrix must be square for determinant computation\n");
+		return A.det(res);
 	}
 	template<class CField, class PField >
 	typename CField::Element& detin(typename CField::Element	& res,
-                                        Toeplitz<CField,PField>		& A )
-	{ 
-            if (A.coldim() != A.rowdim())
-                throw LinboxError("LinBox ERROR: matrix must be square for determinant computation\n");
-            return A.det(res);
+					Toeplitz<CField,PField>		& A )
+	{
+		if (A.coldim() != A.rowdim())
+			throw LinboxError("LinBox ERROR: matrix must be square for determinant computation\n");
+		return A.det(res);
 	}
-	// The det with BlackBox Method 
+	// The det with BlackBox Method
 	template<class Blackbox>
 	typename Blackbox::Field::Element &det (
-						typename Blackbox::Field::Element       &d, 
+						typename Blackbox::Field::Element       &d,
 						const Blackbox                          &A,
 						const RingCategories::ModularTag        &tag,
 						const Method::Blackbox			&M)
@@ -192,32 +199,32 @@ namespace LinBox
 
 	// The det with Wiedemann, finite field.
 	template <class Blackbox>
-	typename Blackbox::Field::Element &det (typename Blackbox::Field::Element	&d, 
+	typename Blackbox::Field::Element &det (typename Blackbox::Field::Element	&d,
 						const Blackbox				&A,
 						const RingCategories::ModularTag	&tag,
-						const Method::Wiedemann			&M) 
+						const Method::Wiedemann			&M)
 	{
 		if (A.coldim() != A.rowdim())
 			throw LinboxError("LinBox ERROR: matrix must be square for determinant computation\n");
-		
+
 		typedef typename Blackbox::Field Field;
 		typedef std::vector<typename Field::Element> Polynomial;
 		Field F = A.field();
-		
+
 		if(M.symmetric()) {
 			commentator.start ("Symmetric Wiedemann Determinant", "sdet");
-			linbox_check (A.coldim () == A.rowdim ());       
+			linbox_check (A.coldim () == A.rowdim ());
 			Polynomial               phi;
 			unsigned long            deg;
 			typename Field::RandIter iter (F);
-                    
+
 			// Precondition here to separate the eigenvalues, so that
 			// minpoly (B) = charpoly (B) with high probability
 			// Here there is an extra diagonal computation
-			// The probability of success is also divided by two, as 
+			// The probability of success is also divided by two, as
 			// diag^2 contains only squares and squares are half the total elements
 			std::vector<typename Field::Element> diag (A.coldim ());
-                    
+
 			typename Field::Element pi;
 			size_t i;
 			size_t iternum = 1;
@@ -227,18 +234,18 @@ namespace LinBox
 					do iter.random (diag[i]); while (F.isZero (diag[i]));
 					F.mulin (pi, diag[i]);
 				}
-                        
+
 				Diagonal<Field> D (F, diag);
-				Compose<Blackbox,Diagonal<Field> > B0 (&A, &D);                        
+				Compose<Blackbox,Diagonal<Field> > B0 (&A, &D);
 				typedef Compose<Diagonal<Field>,Compose<Blackbox,Diagonal<Field> > > Blackbox1;
 				Blackbox1 B(&D, &B0);
 
 				BlackboxContainerSymmetric<Field, Blackbox1> TF (&B, F, iter);
-			
+
 				MasseyDomain<Field, BlackboxContainerSymmetric<Field, Blackbox1> > WD (&TF, M.earlyTermThreshold ());
 
 				WD.minpoly (phi, deg);
-				//                         std::cout << "\tdet: iteration # " << iternum << "\tMinpoly deg= " 
+				//                         std::cout << "\tdet: iteration # " << iternum << "\tMinpoly deg= "
 				//                                   << phi.size() << "\n" ;
 				//                         std::cout << "[" ;
 				//                         for(typename Polynomial::const_iterator refs =  phi.begin();
@@ -246,33 +253,34 @@ namespace LinBox
 				// 				      ++refs )
 				// 		          std::cout << (*refs) << " " ;
 				//                         std::cout << "]" << std::endl;
-			
+
 				++iternum;
 			} while ( (phi.size () < A.coldim () + 1) && ( !F.isZero (phi[0]) ) );
-                    
-                   
-			// Divided twice since multiplied twice by the diagonal matrix
-			F.div (d, phi[0], pi);
-			F.divin (d, pi);
-                   
-			if ( (deg & 1) == 1)
-				F.negin (d);
-                 
-			commentator.stop ("done", NULL, "sdet");
-                    
-			return d;                   
-		} else {
+
+
+				// Divided twice since multiplied twice by the diagonal matrix
+				F.div (d, phi[0], pi);
+				F.divin (d, pi);
+
+				if ( (deg & 1) == 1)
+					F.negin (d);
+
+				commentator.stop ("done", NULL, "sdet");
+
+				return d;
+		}
+		else {
 			commentator.start ("Wiedemann Determinant", "wdet");
 			linbox_check (A.coldim () == A.rowdim ());
-                    
+
 			Polynomial               phi;
 			unsigned long            deg;
 			typename Field::RandIter iter (F);
-                    
+
 			// Precondition here to separate the eigenvalues, so that
 			// minpoly (B) = charpoly (B) with high probability
 			std::vector<typename Field::Element> diag (A.coldim ());
-                    
+
 			typename Field::Element pi;
 			size_t i;
 			size_t iternum = 1;
@@ -282,31 +290,31 @@ namespace LinBox
 					do iter.random (diag[i]); while (F.isZero (diag[i]));
 					F.mulin (pi, diag[i]);
 				}
-                        
+
 				Diagonal<Field> D (F, diag);
-                        
+
 				Compose<Blackbox,Diagonal<Field> > B (&A, &D);
-                        
+
 				typedef Compose<Blackbox,Diagonal<Field> > Blackbox1;
 
 				BlackboxContainer<Field, Blackbox1> TF (&B, F, iter);
-			
+
 				MasseyDomain<Field, BlackboxContainer<Field, Blackbox1> > WD (&TF, M.earlyTermThreshold ());
 
 				WD.minpoly (phi, deg);
-			
+
 				++iternum;
 			} while ( (phi.size () < A.coldim () + 1) && ( !F.isZero (phi[0]) ) );
-                    
-			F.div (d, phi[0], pi);
-                    
-			if ( (deg & 1) == 1)
-				F.negin (d);
-                    
-                  
-			commentator.stop ("done", NULL, "wdet");
-                    
-			return d;
+
+				F.div (d, phi[0], pi);
+
+				if ( (deg & 1) == 1)
+					F.negin (d);
+
+
+				commentator.stop ("done", NULL, "wdet");
+
+				return d;
 		}
 	}
 
@@ -317,14 +325,14 @@ namespace LinBox
 	typename Blackbox::Field::Element &det (typename Blackbox::Field::Element       &d,
 						const Blackbox                          &A,
 						const RingCategories::ModularTag        &tag,
-						const Method::BlasElimination           &M) 
+						const Method::BlasElimination           &M)
 	{
 		if (A.coldim() != A.rowdim())
 			throw LinboxError("LinBox ERROR: matrix must be square for determinant computation\n");
 
 		typedef typename Blackbox::Field Field;
 		Field F = A.field();
-		
+
 		commentator.start ("Blas Determinant", "blasdet");
 
 		linbox_check (A.coldim () == A.rowdim ());
@@ -337,145 +345,146 @@ namespace LinBox
 		return d;
 	}
 
-        template <class Blackbox>
-        typename Blackbox::Field::Element &det (typename Blackbox::Field::Element	&d,
-                                                const Blackbox  			&A,
-                                                const RingCategories::ModularTag  	&tag,
-                                                const Method::SparseElimination		&M) 
-        {
-             if (A.coldim() != A.rowdim())
-                throw LinboxError("LinBox ERROR: matrix must be square for determinant computation\n");
-            
-            typedef typename Blackbox::Field Field;
-            commentator.start ("Sparse Elimination Determinant", "SEDet");
-                // We make a copy as these data will be destroyed
-            SparseMatrix<Field, typename LinBox::Vector<Field>::SparseSeq> A1 (A.field(), A.rowdim(), A.coldim());
-            typename Blackbox::Field::Element tmp;
-            for(size_t i = 0; i < A.rowdim() ; ++i)
-                for(size_t j = 0; j < A.coldim(); ++j)
-                    A1.setEntry(i,j,getEntry(tmp, A, i, j));
-            GaussDomain<Field> GD ( A1.field() );
-            GD.detin (d, A1, M.strategy ());
-            commentator.stop ("done", NULL, "SEDet");
-            return d;
-           
-        }
-    
-
-        template <class Field, class Vector>
-        typename Field::Element &det (typename Field::Element	&d,
-                                      const SparseMatrix<Field, Vector>	&A,
-                                      const RingCategories::ModularTag  	&tag,
-                                      const Method::SparseElimination		&M) 
-        {
-            if (A.coldim() != A.rowdim())
-                throw LinboxError("LinBox ERROR: matrix must be square for determinant computation\n");
-            
-            commentator.start ("Sparse Elimination Determinant", "SEDet");
-                // We make a copy as these data will be destroyed
-            SparseMatrix<Field, typename LinBox::Vector<Field>::SparseSeq> A1 (A);  
-            GaussDomain<Field> GD ( A.field() );
-            GD.detin (d, A1, M.strategy ());
-            commentator.stop ("done", NULL, "SEdet");
-            return d;
-        }
-    
-     	template <class Field>
-        typename Field::Element &detin (typename Field::Element         	&d,
-                                        SparseMatrix<Field, typename LinBox::Vector<Field>::SparseSeq>  &A,
-                                        const RingCategories::ModularTag  	&tag,
-                                        const Method::SparseElimination     	&M) 
-        {
-            if (A.coldim() != A.rowdim())
-                throw LinboxError("LinBox ERROR: matrix must be square for determinant computation\n");
-            
-            commentator.start ("Sparse Elimination Determinant in place", "SEDetin");
-            GaussDomain<Field> GD ( A.field() );
-            GD.detin (d, A, M.strategy ());
-            commentator.stop ("done", NULL, "SEdetin");
-            return d;
-        }
-    
-    	
-	// The det with Elimination Method 
+	template <class Blackbox>
+	typename Blackbox::Field::Element &det (typename Blackbox::Field::Element	&d,
+						const Blackbox  			&A,
+						const RingCategories::ModularTag  	&tag,
+						const Method::SparseElimination		&M)
+	{
+		if (A.coldim() != A.rowdim())
+			throw LinboxError("LinBox ERROR: matrix must be square for determinant computation\n");
+
+		typedef typename Blackbox::Field Field;
+		commentator.start ("Sparse Elimination Determinant", "SEDet");
+		// We make a copy as these data will be destroyed
+		SparseMatrix<Field, typename LinBox::Vector<Field>::SparseSeq> A1 (A.field(), A.rowdim(), A.coldim());
+		typename Blackbox::Field::Element tmp;
+		for(size_t i = 0; i < A.rowdim() ; ++i)
+			for(size_t j = 0; j < A.coldim(); ++j)
+				A1.setEntry(i,j,getEntry(tmp, A, i, j));
+		GaussDomain<Field> GD ( A1.field() );
+		GD.detin (d, A1, M.strategy ());
+		commentator.stop ("done", NULL, "SEDet");
+		return d;
+
+	}
+
+
+	template <class Field, class Vector>
+	typename Field::Element &det (typename Field::Element	&d,
+				      const SparseMatrix<Field, Vector>	&A,
+				      const RingCategories::ModularTag  	&tag,
+				      const Method::SparseElimination		&M)
+	{
+		if (A.coldim() != A.rowdim())
+			throw LinboxError("LinBox ERROR: matrix must be square for determinant computation\n");
+
+		commentator.start ("Sparse Elimination Determinant", "SEDet");
+		// We make a copy as these data will be destroyed
+		SparseMatrix<Field, typename LinBox::Vector<Field>::SparseSeq> A1 (A);
+		GaussDomain<Field> GD ( A.field() );
+		GD.detin (d, A1, M.strategy ());
+		commentator.stop ("done", NULL, "SEdet");
+		return d;
+	}
+
+	template <class Field>
+	typename Field::Element &detin (typename Field::Element         	&d,
+					SparseMatrix<Field, typename LinBox::Vector<Field>::SparseSeq>  &A,
+					const RingCategories::ModularTag  	&tag,
+					const Method::SparseElimination     	&M)
+	{
+		if (A.coldim() != A.rowdim())
+			throw LinboxError("LinBox ERROR: matrix must be square for determinant computation\n");
+
+		commentator.start ("Sparse Elimination Determinant in place", "SEDetin");
+		GaussDomain<Field> GD ( A.field() );
+		GD.detin (d, A, M.strategy ());
+		commentator.stop ("done", NULL, "SEdetin");
+		return d;
+	}
+
+
+	// The det with Elimination Method
 	template<class Field, class Vector>
-	typename Field::Element &det (typename Field::Element		&d, 
-                                      const SparseMatrix<Field, Vector>	&A,
-                                      const RingCategories::ModularTag	&tag,
-                                      const Method::Elimination		&M)
+	typename Field::Element &det (typename Field::Element		&d,
+				      const SparseMatrix<Field, Vector>	&A,
+				      const RingCategories::ModularTag	&tag,
+				      const Method::Elimination		&M)
 	{
 		return det(d, A, tag, Method::SparseElimination(M));
 	}
 
 
-     	template <class Field>
-        typename Field::Element &detin (typename Field::Element         	&d,
-                                        SparseMatrix<Field, typename LinBox::Vector<Field>::SparseSeq>  &A,
-                                        const RingCategories::ModularTag  	&tag,
-                                        const Method::Elimination     		&M) 
-        {
-            return detin(d, A, tag, Method::SparseElimination(M));
+	template <class Field>
+	typename Field::Element &detin (typename Field::Element         	&d,
+					SparseMatrix<Field, typename LinBox::Vector<Field>::SparseSeq>  &A,
+					const RingCategories::ModularTag  	&tag,
+					const Method::Elimination     		&M)
+	{
+		return detin(d, A, tag, Method::SparseElimination(M));
 	}
 
 	template<class Field, class Vector>
-	typename Field::Element &detin (typename Field::Element			&d, 
-                                        SparseMatrix<Field, Vector> 		&A,
-                                        const RingCategories::ModularTag      	&tag,
-                                        const Method::Elimination		&M)
+	typename Field::Element &detin (typename Field::Element			&d,
+					SparseMatrix<Field, Vector> 		&A,
+					const RingCategories::ModularTag      	&tag,
+					const Method::Elimination		&M)
 	{
-                // Matrix is not of type SparseMatrix<..SparseSeq> otherwise previous specialization would occur
-                // will copy A into SparseMatrix<..SparseSeq> or BlasMatrix
-            const Field& F = A.field();
-            integer c; F.characteristic(c); 
-            if ((c < LinBox::BlasBound) && ((A.rowdim() < 300) || (A.coldim() < 300) || (A.size() > (A.coldim()*A.rowdim()/100))))
-                return det(d, A, tag, Method::BlasElimination(M));
-            else
-                return det(d, A, tag, Method::SparseElimination(M));
+		// Matrix is not of type SparseMatrix<..SparseSeq> otherwise previous specialization would occur
+		// will copy A into SparseMatrix<..SparseSeq> or BlasMatrix
+		const Field& F = A.field();
+		integer c; F.characteristic(c);
+		if ((c < LinBox::BlasBound) && ((A.rowdim() < 300) || (A.coldim() < 300) || (A.size() > (A.coldim()*A.rowdim()/100))))
+			return det(d, A, tag, Method::BlasElimination(M));
+		else
+			return det(d, A, tag, Method::SparseElimination(M));
 	}
 
 
-	// The det with Elimination Method 
+	// The det with Elimination Method
 	template<class Blackbox>
-	typename Blackbox::Field::Element &det (typename Blackbox::Field::Element	&d, 
+	typename Blackbox::Field::Element &det (typename Blackbox::Field::Element	&d,
 						const Blackbox				&A,
 						const RingCategories::ModularTag	&tag,
 						const Method::Elimination		&M)
 	{
-                // Matrix is not of type SparseMatrix otherwise previous specialization would occur
-                // will copy A into BlasMatrix 
+		// Matrix is not of type SparseMatrix otherwise previous specialization would occur
+		// will copy A into BlasMatrix
 		return det(d, A, tag, Method::BlasElimination(M));
 	}
 
 
 	template<class Blackbox>
-	typename Blackbox::Field::Element &detin (typename Blackbox::Field::Element	&d, 
-                                                  Blackbox                            	&A,
-                                                  const RingCategories::ModularTag      &tag,
-                                                  const Method::Elimination		&M)
+	typename Blackbox::Field::Element &detin (typename Blackbox::Field::Element	&d,
+						  Blackbox                            	&A,
+						  const RingCategories::ModularTag      &tag,
+						  const Method::Elimination		&M)
 	{
-                // Matrix is not of type SparseMatrix otherwise previous specialization would occur
-                // will copy A into BlasMatrix 
-            return det(d, A, tag, Method::BlasElimination(M));
+		// Matrix is not of type SparseMatrix otherwise previous specialization would occur
+		// will copy A into BlasMatrix
+		return det(d, A, tag, Method::BlasElimination(M));
 	}
 
-    
-	
-	// This should work for a DenseMatrix too ?
-	/** \brief A will be modified.
 
-	\returns d determinant of A.
-	\param A this BlasBlackbox matrix will be modified in place in the process.
-	\ingroup solutions
- 	*/
+
+	// This should work for a DenseMatrix too ?
+	/** Rank of Blackbox \p A.
+	  * \ingroup solutions
+	  * A will be modified.
+	  * \param[out]  d determinant of \p A.
+	  * \param       A this BlasBlackbox matrix will be modified in place in the process.
+	  * \return \p d
+	  */
 	template <class Field>
 	typename Field::Element &detin (typename Field::Element             &d,
-					BlasBlackbox<Field>                   &A)
+					BlasBlackbox<Field>                  &A)
 	{
 		if (A.coldim() != A.rowdim())
 			throw LinboxError("LinBox ERROR: matrix must be square for determinant computation\n");
 
 		Field F = A.field();
-		
+
 		commentator.start ("Determinant", "detin");
 		linbox_check (A.coldim () == A.rowdim ());
 
@@ -485,43 +494,48 @@ namespace LinBox
 
 		return d;
 	}
-} // end of LinBox namespace 
+} // end of LinBox namespace
 
 #include "linbox/field/modular.h"
 //#include "linbox/field/givaro-zpz.h"
 
+#ifdef __LINBOX_HAVE_MPI
+#include "linbox/algorithms/cra-mpi.h"
+#else
 #ifdef __LINBOX_HAVE_KAAPI //use the kaapi version instead of the usual version if this macro is defined
-    #include "linbox/algorithms/cra-kaapi.h"
+#include "linbox/algorithms/cra-kaapi.h"
 #else
-    #include "linbox/algorithms/cra-domain.h"
+#include "linbox/algorithms/cra-domain.h"
+#endif
 #endif
 
 #include "linbox/algorithms/cra-early-single.h"
 #include "linbox/randiter/random-prime.h"
 #include "linbox/algorithms/matrix-hom.h"
 
-namespace LinBox {
-    
+namespace LinBox
+{
+
 	template <class Blackbox, class MyMethod>
-	struct IntegerModularDet {       
+	struct IntegerModularDet {
 		const Blackbox &A;
 		const MyMethod &M;
-        
-		IntegerModularDet(const Blackbox& b, const MyMethod& n) 
-			: A(b), M(n) {}
-        
-        
+
+		IntegerModularDet(const Blackbox& b, const MyMethod& n) :
+			A(b), M(n)
+		{}
+
+
 		template<typename Field>
-		typename Field::Element& operator()(typename Field::Element& d, const Field& F) const {
+		typename Field::Element& operator()(typename Field::Element& d, const Field& F) const
+		{
 			typedef typename Blackbox::template rebind<Field>::other FBlackbox;
-			FBlackbox * Ap;
-			MatrixHom::map(Ap, A, F);
-			detin( d, *Ap, M);
-			delete Ap;
+			FBlackbox Ap(A, F);
+			detin( d, Ap, M);
 			return d;
 		}
 	};
-    
+
 
 	template <class Blackbox, class MyMethod>
 	typename Blackbox::Field::Element &cra_det (typename Blackbox::Field::Element         &d,
@@ -529,39 +543,31 @@ namespace LinBox {
 						    const RingCategories::IntegerTag          &tag,
 						    const MyMethod                            &M
 #ifdef __LINBOX_HAVE_MPI
-							 ,Communicator 										 *C = NULL
+						    ,Communicator                             *C = NULL
 #endif
-																								)
+						   )
 	{
-		commentator.start ("Integer Determinant", "idet");
-	   //  if no parallelism or if this is the parent process
+		//  if no parallelism or if this is the parent process
 		//  begin the verbose output
 #ifdef __LINBOX_HAVE_MPI
-	   if(!C || C->rank() == 0)
+		if(!C || C->rank() == 0)
 #endif
-		IntegerModularDet<Blackbox, MyMethod> iteration(A, M);
+			commentator.start ("Integer Determinant", "idet");
 		// 0.7213475205 is an upper approximation of 1/(2log(2))
-		RandomPrimeIterator genprime( 26-(int)ceil(log((double)A.rowdim())*0.7213475205)); 
-		ChineseRemainder< EarlySingleCRA< Modular<double> > > cra(4UL);
+		IntegerModularDet<Blackbox, MyMethod> iteration(A, M);
+		RandomPrimeIterator genprime( 26-(int)ceil(log((double)A.rowdim())*0.7213475205));
 		integer dd; // use of integer due to non genericity of cra. PG 2005-08-04
 
-		/*
-		//  if no parallelism or if parent process
-		if(!C || !C->rank()){
-			//  if parallel, report size of parallel world
-			if(C) std::cout << "C->size()... " << C->size() << std::endl;
-			std::cout << "using cra_det With C = " << int(C) 
-						 << " and dd = " << dd << std::endl;
-		}
-		*/
 		//  will call regular cra if C=0
 #ifdef __LINBOX_HAVE_MPI
-		cra(dd, iteration, genprime, C);
+		MPIChineseRemainder< EarlySingleCRA< Modular<double> > > cra(4UL, C);
+		cra(dd, iteration, genprime);
 		if(!C || C->rank() == 0){
 			A.field().init(d, dd); // convert the result from integer to original type
 			commentator.stop ("done", NULL, "det");
 		}
 #else
+		ChineseRemainder< EarlySingleCRA< Modular<double> > > cra(4UL);
 		cra(dd, iteration, genprime);
 		A.field().init(d, dd); // convert the result from integer to original type
 		commentator.stop ("done", NULL, "idet");
@@ -580,8 +586,12 @@ namespace LinBox {
 # define SOLUTION_CRA_DET cra_det
 #endif
 
-namespace LinBox {
-    
+#include "linbox/algorithms/rational-cra2.h"
+#include "linbox/algorithms/varprec-cra-early-single.h"
+#include "linbox/algorithms/det-rational.h"
+namespace LinBox
+{
+
 	template <class Blackbox, class MyMethod>
 	typename Blackbox::Field::Element &det (typename Blackbox::Field::Element         &d,
 						const Blackbox                            &A,
@@ -591,32 +601,65 @@ namespace LinBox {
 		if (A.coldim() != A.rowdim())
 			throw LinboxError("LinBox ERROR: matrix must be square for determinant computation\n");
 		return SOLUTION_CRA_DET(d, A, tag, M);
-	}    
-
+	}
 
-	//error handler for rational domain
-	template< class Blackbox, class DetMethod> 
-	typename Blackbox::Field::Element &det (typename Blackbox::Field::Element         &d, 
+	template< class Blackbox, class MyMethod>
+	typename Blackbox::Field::Element &det (typename Blackbox::Field::Element         &d,
 						const Blackbox                            &A,
 						const RingCategories::RationalTag       &tag,
-						const DetMethod                          &M)
+						const MyMethod                          &M)
+	{
+		if (A.coldim() != A.rowdim())
+			throw LinboxError("LinBox ERROR: matrix must be square for determinant computation\n");
+
+		commentator.start ("Rational Determinant", "rdet");
+
+		Integer num,den;
+
+		IntegerModularDet<Blackbox, MyMethod> iteration(A, M);
+		RandomPrimeIterator genprime( 26-(int)ceil(log((double)A.rowdim())*0.7213475205));
+		RationalRemainder2< VarPrecEarlySingleCRA< Modular<double> > > rra(4UL);
+
+		rra(num,den, iteration, genprime);
+
+		A.field().init(d, num,den); // convert the result from integer to original type
+
+		commentator.stop ("done", NULL, "rdet");
+		return d;
+	}
+
+	template<class Field, class MyMethod>
+	typename Field::Element &det (typename Field::Element                 &d,
+				      const DenseMatrix<Field>                &A,
+				      const RingCategories::RationalTag       &tag,
+				      const MyMethod                          &M)
 	{
-		throw LinboxError("LinBox ERROR: determinant is not yet defined over a rational domain");
+		if (A.coldim() != A.rowdim())
+			throw LinboxError("LinBox ERROR: matrix must be square for determinant computation\n");
+
+		commentator.start ("Dense Rational Determinant", "rdet");
+
+		rational_det(d,A,M);
+
+		commentator.stop ("done", NULL, "rdet");
+		return d;
 	}
 
 } // end of LinBox namespace
 
 #ifdef __LINBOX_HAVE_MPI
-namespace LinBox {
-    
+namespace LinBox
+{
+
 	template <class Blackbox>
-	typename Blackbox::Field::Element &det (typename Blackbox::Field::Element         &d,
-						const Blackbox                            &A,
-						/*const*/ Communicator						&C)
+	typename Blackbox::Field::Element &det (typename Blackbox::Field::Element       &d,
+						const Blackbox                          &A,
+						/*const*/ Communicator			&C)
 	{
 		return det(d, A, Method::Hybrid(C));
 	}
 }
 #endif //__LINBOX_HAVE_MPI
 
-#endif // __DET_H
+#endif // __LINBOX_det_H
+
diff --git a/linbox/solutions/determinant.doxy b/linbox/solutions/determinant.doxy
new file mode 100644
index 0000000..03f9484
--- /dev/null
+++ b/linbox/solutions/determinant.doxy
@@ -0,0 +1,9 @@
+// Copyright (C) 2010 LinBox, GNU LGPL, see COPYING for licence information
+
+/** @ingroup solutions
+ at defgroup  determin Determinant
+ at brief NO DOC YET
+
+*/
+
+// vim:syntax=doxygen
diff --git a/linbox/solutions/getentry.h b/linbox/solutions/getentry.h
index 325db94..93474b8 100644
--- a/linbox/solutions/getentry.h
+++ b/linbox/solutions/getentry.h
@@ -1,14 +1,15 @@
 /* -*- 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
 /* linbox/solutions/getentry.h
+ * Copyright(C) LinBox
  *  Evolved from an earlier one by Bradford Hovinen <hovinen at cis.udel.edu>
  *  -bds
  *
  * See COPYING for license information.
  */
 
-#ifndef __GETENTRY_H
-#define __GETENTRY_H
+#ifndef __LINBOX_getentry_H
+#define __LINBOX_getentry_H
 
 #include <vector>
 
@@ -21,131 +22,106 @@
 #include "linbox/blackbox/diagonal.h"
 #include "linbox/solutions/methods.h"
 
-namespace LinBox 
+namespace LinBox
 {
 
-/** \brief
- * Getting the i,j entry of the blackbox.
- */
-template <class BB> 
-typename BB::Field::Element& getEntry(typename BB::Field::Element& x, const BB& A, const size_t i, const size_t j)
-{ return getEntry(x, A, i, j, Method::Hybrid()); }
-
-// Any BBs that offer a local getEntry can specialize the BB class for the Hybrid method.
-/** \brief our best guess
-
-Hybrid method will choose based on matrix size and type
-*/
-
-template <class BB> 
-typename BB::Field::Element& getEntry(typename BB::Field::Element& x, const BB& A, const size_t i, const size_t j, 
-		const Method::Hybrid& m)
-{ return getEntry(x, A, i, j, Method::Blackbox(m)); }
-
-// DenseMatrix specialization
-template <class Field> 
-typename Field::Element& getEntry(typename Field::Element& x, const DenseMatrix<Field>& A, const size_t i, const size_t j, 
-		const Method::Hybrid& m)
-{	
-	return A.getEntry(x,i,j);
-}
-
-// SparseMatrix specialization
-template <class Field> 
-typename Field::Element& getEntry(typename Field::Element& x, const SparseMatrix<Field>& A, const size_t i, const size_t j, 
-				  const Method::Hybrid& m)
-{
-	return A.getEntry(x,i,j);
-}
-
-// scalar matrix specialization 
-template <class Field>
-typename Field::Element & getEntry(typename Field::Element & x, const ScalarMatrix<Field>& A, const size_t i, const size_t j, const Method::Hybrid& m) 
-{ return A.getEntry(x, i, j); }
+	/// limited doc so far.
+	namespace GetEntryTags
+	{	struct GenericBB{};	struct Local{};
+		struct SpecialCDB{}; struct SpecialCBD{}; struct SpecialCDD{};
+	}; // namespace GetEntryTags
 
+	template<class BB> struct GetEntryCategory { typedef GetEntryTags::GenericBB Tag; };
 
-// diagonal specialization 
-template <class Field, class Trait>
-typename Field::Element & getEntry(typename Field::Element & x, const Diagonal<Field, Trait>& A, const size_t i, const size_t j, const Method::Hybrid& m) 
-{ return A.getEntry(x, i, j); }
-
-/** \brief our elimination (a fake in this case)
-
-Elimination method will go to blackbox.
-*/
-template <class BB> 
-typename BB::Field::Element& getEntry(typename BB::Field::Element& x, const BB& A, const size_t i, const size_t j, const Method::Elimination& m)
-{ return getEntry(x, A, i, j, Method::Blackbox(m)); 
-}
-
-
-	/** Compute the getEntry of a linear operator A, represented as a black
-	 * box. This class is parameterized by the black box type so that it can
-	 * be specialized for different black boxes.
+	/** \brief
+	 * Getting the i,j entry of the blackbox.
 	 */
+	template <class BB>
+	typename BB::Field::Element& getEntry(typename BB::Field::Element& x, const BB& A, const size_t i, const size_t j)
+	{
+		typename GetEntryCategory<BB>::Tag t;
+		return getEntry(x, A, i, j, t);
+	}
 
-	template <class Blackbox>
-	typename Blackbox::Field::Element &getEntry (typename Blackbox::Field::Element &res,
-					const Blackbox          &A, const size_t i, const size_t j, 
-					const Method::Blackbox& m)
+	/// To ignore methods
+	template <class BB, class Method>
+	typename BB::Field::Element& getEntry(typename BB::Field::Element& x, const BB& A, const size_t i, const size_t j, Method & m)
+	{ return getEntry(x, A, i, j);	}
+
+	// Generic BBs require use of apply.
+	template <class BB>
+	typename BB::Field::Element& getEntry(typename BB::Field::Element& x, const BB& A, const size_t i, const size_t j, GetEntryTags::GenericBB t)
 	{
+		typedef typename BB::Field Field;
+		typedef typename Field::Element Elt;
+		typedef std::vector<Elt> Vector;
 
-		typedef typename Blackbox::Field Field;
-		typedef std::vector<typename Field::Element> Vector;
-		Vector v, w;
-		VectorWrapper::ensureDim (v, A.coldim ());
-		VectorWrapper::ensureDim (w, A.rowdim ());
 		const Field& F = A.field();
-		typename Field::Element zero; F.init(zero, 0UL);
-		typename Vector::iterator it;
-		for (it = v.begin (); it != v.end (); ++it)
+		Elt zero; F.init(zero, 0UL);
+		Vector v(A.coldim(), zero), w(A.rowdim(), zero);
+		for (typename Vector::iterator it = v.begin (); it != v.end (); ++it)
 			F.assign (*it, zero);
 		F.init(v[j],1UL);
-		F.init (res, 0);
 		A.apply (w, v);
-		F.assign (res, VectorWrapper::constRef<Field, Vector> (w, i));
-		return res;
+		F.assign (x, VectorWrapper::constRef<Field, Vector> (w, i));
+		return x;
 	}
 
+	// BBs that offer a local getEntry.
+	template<class Field> struct GetEntryCategory<DenseMatrix<Field> > { typedef GetEntryTags::Local Tag; };
+	template<class A, class B> struct GetEntryCategory<SparseMatrix<A,B> > { typedef GetEntryTags::Local Tag; };
+	template<class A, class B, class C> struct GetEntryCategory<SparseMatrixBase<A,B,C> > { typedef GetEntryTags::Local Tag; };
+	template<class Field, class Trait> struct GetEntryCategory<Diagonal<Field, Trait> > { typedef GetEntryTags::Local Tag; };
+	template<class Field> struct GetEntryCategory<ScalarMatrix<Field> > { typedef GetEntryTags::Local Tag; };
 
+	template <class BB>
+	typename BB::Field::Element& getEntry(typename BB::Field::Element& x, const BB& A, const size_t i, const size_t j, GetEntryTags::Local t )
+	{ return A.getEntry(x, i, j); }
 
+	// Compose< Diagonal, BB > specialization
+	template <class Field, class Trait, class BB>
+	struct GetEntryCategory<Compose<Diagonal<Field, Trait>,BB> > { typedef GetEntryTags::SpecialCDB Tag; };
 
+	template <class Field, class Trait, class BB>
+	typename Field::Element& getEntry(typename Field::Element& x, const Compose<Diagonal<Field, Trait>, BB>& A, const size_t i, const size_t j, GetEntryTags::SpecialCDB t)
+	{
+		typename Field::Element y;
+		getEntry(y, *(A.getLeftPtr()), i, i);
+		getEntry(x, *(A.getRightPtr()), i, j);
+		return A.field().mulin(x, y);
+	}
 
-// Compose< Diagonal, BB > specialization
-template <class Field, class Trait, class BlackBox> 
-typename Field::Element& getEntry(typename Field::Element& t, const Compose<Diagonal<Field, Trait>, BlackBox>& A, const size_t i, const size_t j, const Method::Hybrid& m)
-{
-    typename Field::Element y;
-    getEntry(y, *(A.getLeftPtr()), i, i);
-    getEntry(t, *(A.getRightPtr()), i, j);
-    return A.field().mulin(t, y);
-}
+	// Compose< BB, Diagonal > specialization
+	template <class BB, class Field, class Trait>
+	struct GetEntryCategory<Compose<BB, Diagonal<Field, Trait> > > { typedef GetEntryTags::SpecialCBD Tag; };
 
-// Compose< BB, Diagonal > specialization
-template <class BlackBox, class Field, class Trait> 
-typename Field::Element& getEntry(typename Field::Element& t, const Compose<BlackBox, Diagonal<Field, Trait> >& A, const size_t i, const size_t j, const Method::Hybrid& m)
-{
-    typename Field::Element y;
-    getEntry(y, *(A.getLeftPtr()), i, j);
-    getEntry(t, *(A.getRightPtr()), j, j);
-    return A.field().mulin(t, y);
-}
+	template <class BB, class Field, class Trait>
+	typename Field::Element& getEntry(typename Field::Element& x, const Compose<BB, Diagonal<Field, Trait> >& A, const size_t i, const size_t j, GetEntryTags::SpecialCBD t)
+	{
+		typename Field::Element y;
+		getEntry(y, *(A.getLeftPtr()), i, j);
+		getEntry(x, *(A.getRightPtr()), j, j);
+		return A.field().mulin(x, y);
+	}
 
-// Compose< Diagonal, Diagonal > specialization
-template <class Field, class T1, class T2> 
-typename Field::Element& getEntry(typename Field::Element& t, const Compose<Diagonal<Field,T1>, Diagonal<Field, T2> >& A, const size_t i, const size_t j, const Method::Hybrid& m)
-{
-    if (i != j) 
-        return A.field().init(t, 0UL);
-    else {
-        typename Field::Element y;
-        getEntry(y, *(A.getLeftPtr()), i, i);
-        getEntry(t, *(A.getRightPtr()), j, j);
-        return A.field().mulin(t, y);
-    }
-}
+	// Compose< Diagonal, Diagonal > specialization
+	template <class Field, class T1, class T2>
+	struct GetEntryCategory<Compose<Diagonal<Field, T1>,Diagonal<Field, T2> > > { typedef GetEntryTags::SpecialCDD Tag; };
+
+	template <class Field, class T1, class T2>
+	typename Field::Element& getEntry(typename Field::Element& x, const Compose<Diagonal<Field,T1>, Diagonal<Field, T2> >& A, const size_t i, const size_t j, GetEntryTags::SpecialCDD t)
+	{
+		if (i != j)
+			return A.field().init(x, 0UL);
+		else {
+			typename Field::Element y;
+			getEntry(y, *(A.getLeftPtr()), i, i);
+			getEntry(x, *(A.getRightPtr()), j, j);
+			return A.field().mulin(x, y);
+		}
+	}
 
 
 }
 
-#endif // __GETENTRY_H
+#endif // __LINBOX_getentry_H
diff --git a/linbox/solutions/is-positive-definite.h b/linbox/solutions/is-positive-definite.h
index b43180d..3a14239 100644
--- a/linbox/solutions/is-positive-definite.h
+++ b/linbox/solutions/is-positive-definite.h
@@ -1,8 +1,26 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* linbox/solutions/is-positive-definite.h
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) 2010 LinBox
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
-#ifndef __IS_POSITIVE_DEFINITE_H
-#define __IS_POSITIVE_DEFINITE_H
+
+#ifndef __LINBOX_is_positive_definite_H
+#define __LINBOX_is_positive_definite_H
 
 #include "linbox/util/error.h"
 #include <linbox/algorithms/matrix-hom.h>
@@ -11,124 +29,124 @@
 namespace LinBox
 {
 	// for specialization with respect to the DomainCategory
-    template< class Blackbox, class isPositiveDefiniteMethod, class DomainCategory>
-    bool isPositiveDefinite (
-		const Blackbox        &A,
-		const DomainCategory  &tag,
-		const isPositiveDefiniteMethod  &M);
+	template< class Blackbox, class isPositiveDefiniteMethod, class DomainCategory>
+	bool isPositiveDefinite (
+				 const Blackbox        &A,
+				 const DomainCategory  &tag,
+				 const isPositiveDefiniteMethod  &M);
 
-	/** Compute the isPositiveDefinite of A
+	/** Compute the isPositiveDefinite of A.
 	 *
 	 * The isPositiveDefinite of a linear operator A, represented as a
 	 * black box, is computed over the ring or field of A.
 	 *
-	 * @param r OUTPUT instance into which to store the result r
 	 * @param A Black box of which to compute the isPositiveDefinite
 	 * @param M may be a Method::Hybrid (default), Method::Blackbox, Method::Elimination, or of other method type.
-         \ingroup isPositiveDefinites
-        */
-    template <class Blackbox, class MyMethod>
-    bool isPositiveDefinite (
-		const Blackbox                              &A,
-		const MyMethod                           &M) 
-    {
-        return isPositiveDefinite( A, typename FieldTraits<typename Blackbox::Field>::categoryTag(), M);
-    }
-
-	// The isPositiveDefinite with default Method 
-    template<class Blackbox>
-    bool isPositiveDefinite ( const Blackbox  &A) {
-        return isPositiveDefinite(A, 
-		Method::Hybrid());
-    }
+	 \ingroup isPositiveDefinites
+	 */
+	template <class Blackbox, class MyMethod>
+	bool isPositiveDefinite (
+				 const Blackbox                              &A,
+				 const MyMethod                           &M)
+	{
+		return isPositiveDefinite( A, typename FieldTraits<typename Blackbox::Field>::categoryTag(), M);
+	}
+
+	// The isPositiveDefinite with default Method
+	template<class Blackbox>
+	bool isPositiveDefinite ( const Blackbox  &A)
+	{
+		return isPositiveDefinite(A,
+					  Method::Hybrid());
+	}
 
 	// The isPositiveDefinite for ModularTag (is nonsense)
-    template<class Blackbox, class MyMethod>
-    bool isPositiveDefinite (
-        const Blackbox                            &A,
-        const RingCategories::ModularTag          &tag,
-		const MyMethod& M)
-    {
+	template<class Blackbox, class MyMethod>
+	bool isPositiveDefinite (
+				 const Blackbox                            &A,
+				 const RingCategories::ModularTag          &tag,
+				 const MyMethod& M)
+	{
 		//commentator << "nonsense!!"
 		throw (LinboxError("isPositiveDefinite: Integer matrix required"));
-        return false;
-    }
-
-	// The isPositiveDefinite with Hybrid Method 
-    template<class Blackbox>
-    bool isPositiveDefinite (
-        const Blackbox 			&A,
-        const RingCategories::IntegerTag          &tag,
-		const Method::Hybrid& M)
-    {
+		return false;
+	}
+
+	// The isPositiveDefinite with Hybrid Method
+	template<class Blackbox>
+	bool isPositiveDefinite (
+				 const Blackbox 			&A,
+				 const RingCategories::IntegerTag          &tag,
+				 const Method::Hybrid& M)
+	{
 		// should try a modular minpoly and decide on the degree of that...
-        if (A.rowdim() != A.coldim()) return false;
+		if (A.rowdim() != A.coldim()) return false;
 		// this crude size check can be refined
 		if (A.coldim() > 7000) return isPositiveDefinite(A, tag, Method::Blackbox(M));
 		else return isPositiveDefinite(A, tag, Method::Elimination(M));
-    }
-
-	// The isPositiveDefinite with Elimination Method 
-    template<class Blackbox>
-    bool isPositiveDefinite (
-		const Blackbox                            &A,
-		const RingCategories::IntegerTag          &tag,
-		const Method::Elimination& M)
-    {
+	}
+
+	// The isPositiveDefinite with Elimination Method
+	template<class Blackbox>
+	bool isPositiveDefinite (
+				 const Blackbox                            &A,
+				 const RingCategories::IntegerTag          &tag,
+				 const Method::Elimination& M)
+	{
 		// this can be a hybrid of EliminationMinpoly and BlasElimination (which means use LU here)
 		// It will be faster to do EliminationMinpoly when deg(m_A) is low.
 
 		// right now it is just BlasElimination
-        return isPositiveDefinite(A, tag, Method::BlasElimination(M));
-    }
+		return isPositiveDefinite(A, tag, Method::BlasElimination(M));
+	}
 
-	// The isPositiveDefinite with BlackBox Method 
-    template<class Blackbox>
-    bool isPositiveDefinite (
-		const Blackbox                      &A,
-		const RingCategories::IntegerTag    &tag,
-		const Method::Blackbox              &M)
-    {
-        return isPositiveDefinite(A, tag, Method::Wiedemann(M));
-    }
+	// The isPositiveDefinite with BlackBox Method
+	template<class Blackbox>
+	bool isPositiveDefinite (
+				 const Blackbox                      &A,
+				 const RingCategories::IntegerTag    &tag,
+				 const Method::Blackbox              &M)
+	{
+		return isPositiveDefinite(A, tag, Method::Wiedemann(M));
+	}
 
 
 	// The isPositiveDefinite with Wiedemann, finite field.
-    template <class Blackbox>
-    bool isPositiveDefinite (
-		const Blackbox                      &A,
-		const RingCategories::IntegerTag    &tag,
-		const Method::Wiedemann             &M)
-    {
+	template <class Blackbox>
+	bool isPositiveDefinite (
+				 const Blackbox                      &A,
+				 const RingCategories::IntegerTag    &tag,
+				 const Method::Wiedemann             &M)
+	{
 		// call Wiedemann code
 		return Signature::isPosDef(A, Signature::Minpoly_Method() );
 	}
 
-	// the isPositiveDefinite with Blas. 
-    template <class Blackbox>
-    bool isPositiveDefinite (
-		const Blackbox                      &A,
-		const RingCategories::IntegerTag    &tag,
-		const Method::BlasElimination       &M)
-    {
+	// the isPositiveDefinite with Blas.
+	template <class Blackbox>
+	bool isPositiveDefinite (
+				 const Blackbox                      &A,
+				 const RingCategories::IntegerTag    &tag,
+				 const Method::BlasElimination       &M)
+	{
 		// call BlasElimination code
-		DenseMatrix<typename Blackbox::Field>* DA;
+		DenseMatrix<typename Blackbox::Field> DA(A.field(), A.rowdim(), A.coldim());
 		MatrixHom::map(DA, A, A. field());
-		bool s = Signature::isPosDef(*DA, Signature::BLAS_LPM_Method() );
-		delete DA;
-		return s;
+		return Signature::isPosDef(DA, Signature::BLAS_LPM_Method() );
 	}
-	
+
 	// the isPositiveDefinite with Blas, DenseMatrix
-    template <class Ring>
-    bool isPositiveDefinite (
-		const DenseMatrix<Ring> &A,
-		const RingCategories::IntegerTag    &tag,
-		const Method::BlasElimination       &M)
-    {
+	template <class Ring>
+	bool isPositiveDefinite (
+				 const DenseMatrix<Ring> &A,
+				 const RingCategories::IntegerTag    &tag,
+				 const Method::BlasElimination       &M)
+	{
 		// call BlasElimination code
 		return Signature::isPosDef(A, Signature::BLAS_LPM_Method() );
 	}
-	
+
 } // end of LinBox namespace
-#endif // __IS_POSITIVE_DEFINITE_H
+
+#endif // __LINBOX_is_positive_definite_H
+
diff --git a/linbox/solutions/is-positive-semidefinite.h b/linbox/solutions/is-positive-semidefinite.h
index f26d436..ac99182 100644
--- a/linbox/solutions/is-positive-semidefinite.h
+++ b/linbox/solutions/is-positive-semidefinite.h
@@ -1,8 +1,27 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* linbox/solutions/is-positive-semidefinite.h
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) 2010 LinBox
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
-#ifndef __IS_POSITIVE_SEMIDEFINITE_H
-#define __IS_POSITIVE_SEMIDEFINITE_H
+
+#ifndef __LINBOX_is_positive_semidefinite_H
+#define __LINBOX_is_positive_semidefinite_H
 
 #include "linbox/util/error.h"
 #include <linbox/algorithms/matrix-hom.h>
@@ -11,124 +30,123 @@
 namespace LinBox
 {
 	// for specialization with respect to the DomainCategory
-    template< class Blackbox, class isPositiveSemiDefiniteMethod, class DomainCategory>
-    bool isPositiveSemiDefinite (
-		const Blackbox        &A,
-		const DomainCategory  &tag,
-		const isPositiveSemiDefiniteMethod  &M);
+	template< class Blackbox, class isPositiveSemiDefiniteMethod, class DomainCategory>
+	bool isPositiveSemiDefinite (
+				     const Blackbox        &A,
+				     const DomainCategory  &tag,
+				     const isPositiveSemiDefiniteMethod  &M);
 
-	/** Compute the isPositiveSemiDefinite of A
+	/** Compute the isPositiveSemiDefinite of A.
 	 *
 	 * The isPositiveSemiDefinite of a linear operator A, represented as a
 	 * black box, is computed over the ring or field of A.
 	 *
-	 * @param r OUTPUT instance into which to store the result r
 	 * @param A Black box of which to compute the isPositiveSemiDefinite
 	 * @param M may be a Method::Hybrid (SemiDefault), Method::Blackbox, Method::Elimination, or of other method type.
-         \ingroup isPositiveSemiDefinites
-        */
-    template <class Blackbox, class MyMethod>
-    bool isPositiveSemiDefinite (
-		const Blackbox                              &A,
-		const MyMethod                           &M) 
-    {
-        return isPositiveSemiDefinite( A, typename FieldTraits<typename Blackbox::Field>::categoryTag(), M);
-    }
-
-	// The isPositiveSemiDefinite with SemiDefault Method 
-    template<class Blackbox>
-    bool isPositiveSemiDefinite ( const Blackbox  &A) {
-        return isPositiveSemiDefinite(A, 
-		Method::Hybrid());
-    }
+	 \ingroup isPositiveSemiDefinites
+	 */
+	template <class Blackbox, class MyMethod>
+	bool isPositiveSemiDefinite (
+				     const Blackbox                              &A,
+				     const MyMethod                           &M)
+	{
+		return isPositiveSemiDefinite( A, typename FieldTraits<typename Blackbox::Field>::categoryTag(), M);
+	}
+
+	// The isPositiveSemiDefinite with SemiDefault Method
+	template<class Blackbox>
+	bool isPositiveSemiDefinite ( const Blackbox  &A)
+	{
+		return isPositiveSemiDefinite(A,
+					      Method::Hybrid());
+	}
 
 	// The isPositiveSemiDefinite for ModularTag (is nonsense)
-    template<class Blackbox, class MyMethod>
-    bool isPositiveSemiDefinite (
-        const Blackbox                            &A,
-        const RingCategories::ModularTag          &tag,
-		const MyMethod& M)
-    {
+	template<class Blackbox, class MyMethod>
+	bool isPositiveSemiDefinite (
+				     const Blackbox                            &A,
+				     const RingCategories::ModularTag          &tag,
+				     const MyMethod& M)
+	{
 		//commentator << "nonsense!!"
 		throw (LinboxError("isPositiveSemiDefinite: Integer matrix required"));
-        return false;
-    }
-
-	// The isPositiveSemiDefinite with Hybrid Method 
-    template<class Blackbox>
-    bool isPositiveSemiDefinite (
-        const Blackbox 			&A,
-        const RingCategories::IntegerTag          &tag,
-		const Method::Hybrid& M)
-    {
+		return false;
+	}
+
+	// The isPositiveSemiDefinite with Hybrid Method
+	template<class Blackbox>
+	bool isPositiveSemiDefinite (
+				     const Blackbox 			&A,
+				     const RingCategories::IntegerTag          &tag,
+				     const Method::Hybrid& M)
+	{
 		// should try a modular minpoly and decide on the degree of that...
-        if (A.rowdim() != A.coldim()) return false;
+		if (A.rowdim() != A.coldim()) return false;
 		// this crude size check can be refined
 		if (A.coldim() > 7000) return isPositiveSemiDefinite(A, tag, Method::Blackbox(M));
 		else return isPositiveSemiDefinite(A, tag, Method::Elimination(M));
-    }
-
-	// The isPositiveSemiDefinite with Elimination Method 
-    template<class Blackbox>
-    bool isPositiveSemiDefinite (
-		const Blackbox                            &A,
-		const RingCategories::IntegerTag          &tag,
-		const Method::Elimination& M)
-    {
+	}
+
+	// The isPositiveSemiDefinite with Elimination Method
+	template<class Blackbox>
+	bool isPositiveSemiDefinite (
+				     const Blackbox                            &A,
+				     const RingCategories::IntegerTag          &tag,
+				     const Method::Elimination& M)
+	{
 		// this can be a hybrid of EliminationMinpoly and BlasElimination (which means use LU here)
 		// It will be faster to do EliminationMinpoly when deg(m_A) is low.
 
 		// right now it is just BlasElimination
-        return isPositiveSemiDefinite(A, tag, Method::BlasElimination(M));
-    }
+		return isPositiveSemiDefinite(A, tag, Method::BlasElimination(M));
+	}
 
-	// The isPositiveSemiDefinite with BlackBox Method 
-    template<class Blackbox>
-    bool isPositiveSemiDefinite (
-		const Blackbox                      &A,
-		const RingCategories::IntegerTag    &tag,
-		const Method::Blackbox              &M)
-    {
-        return isPositiveSemiDefinite(A, tag, Method::Wiedemann(M));
-    }
+	// The isPositiveSemiDefinite with BlackBox Method
+	template<class Blackbox>
+	bool isPositiveSemiDefinite (
+				     const Blackbox                      &A,
+				     const RingCategories::IntegerTag    &tag,
+				     const Method::Blackbox              &M)
+	{
+		return isPositiveSemiDefinite(A, tag, Method::Wiedemann(M));
+	}
 
 
 	// The isPositiveSemiDefinite with Wiedemann, finite field.
-    template <class Blackbox>
-    bool isPositiveSemiDefinite (
-		const Blackbox                      &A,
-		const RingCategories::IntegerTag    &tag,
-		const Method::Wiedemann             &M)
-    {
+	template <class Blackbox>
+	bool isPositiveSemiDefinite (
+				     const Blackbox                      &A,
+				     const RingCategories::IntegerTag    &tag,
+				     const Method::Wiedemann             &M)
+	{
 		// call Wiedemann code
 		return Signature::isPosSemiDef(A, Signature::Minpoly_Method() );
 	}
 
-	// the isPositiveSemiDefinite with Blas. 
-    template <class Blackbox>
-    bool isPositiveSemiDefinite (
-		const Blackbox                      &A,
-		const RingCategories::IntegerTag    &tag,
-		const Method::BlasElimination       &M)
-    {
+	// the isPositiveSemiDefinite with Blas.
+	template <class Blackbox>
+	bool isPositiveSemiDefinite (
+				     const Blackbox                      &A,
+				     const RingCategories::IntegerTag    &tag,
+				     const Method::BlasElimination       &M)
+	{
 		// call BlasElimination code
-		DenseMatrix<typename Blackbox::Field>* DA;
+		DenseMatrix<typename Blackbox::Field> DA(A.field(), A.rowdim(), A.coldim());
 		MatrixHom::map(DA, A, A. field());
-		bool s = Signature::isPosSemiDef(*DA, Signature::BLAS_LPM_Method() );
-		delete DA;
-		return s;
+		return Signature::isPosSemiDef(DA, Signature::BLAS_LPM_Method() );
 	}
-	
+
 	// the isPositiveSemiDefinite with Blas, DenseMatrix
-    template <class Ring>
-    bool isPositiveSemiDefinite (
-		const DenseMatrix<Ring> &A,
-		const RingCategories::IntegerTag    &tag,
-		const Method::BlasElimination       &M)
-    {
+	template <class Ring>
+	bool isPositiveSemiDefinite (
+				     const DenseMatrix<Ring> &A,
+				     const RingCategories::IntegerTag    &tag,
+				     const Method::BlasElimination       &M)
+	{
 		// call BlasElimination code
 		return Signature::isPosSemiDef(A, Signature::BLAS_LPM_Method() );
 	}
-	
+
 } // end of LinBox namespace
-#endif // __IS_POSITIVE_SEMIDEFINITE_H
+#endif // __LINBOX_is_positive_semidefinite_H
+
diff --git a/linbox/solutions/methods.h b/linbox/solutions/methods.h
index 3b2209f..47acc17 100644
--- a/linbox/solutions/methods.h
+++ b/linbox/solutions/methods.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/solutions/methods.h
  * Copyright (C) 1999, 2001 Jean-Guillaume Dumas, Bradford Hovinen
  *
@@ -25,8 +25,13 @@
  * See COPYING for license information.
  */
 
-#ifndef __METHODS_H
-#define __METHODS_H
+/*! @file solutions/methods.h
+ * @ingroup solutions
+ * @brief NO DOC
+ */
+
+#ifndef __LINBOX_method_H
+#define __LINBOX_method_H
 
 #ifndef DEFAULT_EARLY_TERM_THRESHOLD
 #  define DEFAULT_EARLY_TERM_THRESHOLD 20
@@ -40,33 +45,39 @@
 
 namespace LinBox
 {
-// JGD 22.01.2007 : adapted from Lidzhade Fhulu's
-    template <typename EnumT, typename BaseEnumT>
-    struct InheritEnum {
-        InheritEnum() {}
-        InheritEnum(EnumT e) : enum_(e) {}
-        InheritEnum(BaseEnumT e) : baseEnum_(e) {}
-        explicit InheritEnum( int val ) : enum_(static_cast<EnumT>(val)) {}
-        operator EnumT() const { return enum_; }
-    private:
-        union { 
-            EnumT enum_;
-            BaseEnumT baseEnum_;
-        };
-};
-
-
+	///
+	// JGD 22.01.2007 : adapted from Lidzhade Fhulu's
+	template <typename EnumT, typename BaseEnumT>
+	struct InheritEnum {
+		InheritEnum() {}
+		InheritEnum(EnumT e) :
+			enum_(e)
+		{}
+		InheritEnum(BaseEnumT e) :
+		       	baseEnum_(e)
+	       	{}
+		explicit InheritEnum( int val ) :
+		       	enum_(static_cast<EnumT>(val))
+	       	{}
+		operator EnumT() const { return enum_; }
+	private:
+		union {
+			EnumT enum_;
+			BaseEnumT baseEnum_;
+		};
+	};
 
+	///
 	struct Specifier {
 		/** Whether the system is known to be singular or nonsingular */
 		enum SingularState {
 			SINGULARITY_UNKNOWN, SINGULAR, NONSINGULAR
 		};
 
-		/** Which preconditioner to use to ensure generic rank profile
+		/** @brief Which preconditioner to use to ensure generic rank profile
 		 *
 		 * NO_PRECONDITIONER - Do not use any preconditioner
-		 * BUTTERFLY - Use a butterfly network, see @ref{Butterfly}
+		 * BUTTERFLY - Use a butterfly network, see @ref Butterfly
 		 * SPARSE - Use a sparse preconditioner, c.f. (Mulders 2000)
 		 * TOEPLITZ - Use a Toeplitz preconditioner, c.f. (Kaltofen and Saunders
 		 * 1991)
@@ -79,27 +90,27 @@ namespace LinBox
 		 * nonsingular diagonal matrices (Lanczos only)
 		 * DENSE (Dixon use)
 		 */
-        
+
 		enum Preconditioner {
 			NO_PRECONDITIONER, BUTTERFLY, SPARSE, TOEPLITZ, SYMMETRIZE, PARTIAL_DIAGONAL, PARTIAL_DIAGONAL_SYMMETRIZE, FULL_DIAGONAL, DENSE
 		};
 
-                /** Other shapes : 
-                 *  UNIMOD_UT -- unimodular upper triang. Toeplitz
-                 *  UNIMOD_LT -- unimodular lower triang. Toeplitz
-                 *  UNIMOD_UH -- unimodular upper triang. Hankel
-                 *  UNIMOD_LH -- unimodular lower triang. Hankel
-                 **/
-            	enum BlackboxShape {
-                	DIAGONAL = 15, HANKEL, UNIMOD_UT, UNIMOD_LT,  UNIMOD_UH,  UNIMOD_LH,  BLKVECTOR
-            	};
-
-            	/** Shape of a Blackbox
-                 *  Precontioner shapes and 
-                 *  other blackbox shape are 
-                 *  combined
-                 **/ 
-            	typedef InheritEnum<BlackboxShape, Preconditioner> Shape;
+		/** Other shapes :
+		 *  UNIMOD_UT -- unimodular upper triang. Toeplitz
+		 *  UNIMOD_LT -- unimodular lower triang. Toeplitz
+		 *  UNIMOD_UH -- unimodular upper triang. Hankel
+		 *  UNIMOD_LH -- unimodular lower triang. Hankel
+		 **/
+		enum BlackboxShape {
+			DIAGONAL = 15, HANKEL, UNIMOD_UT, UNIMOD_LT,  UNIMOD_UH,  UNIMOD_LH,  BLKVECTOR, TRI_SUP, TRI_INF
+		};
+
+		/** Shape of a Blackbox
+		 *  Precontioner shapes and
+		 *  other blackbox shape are
+		 *  combined
+		 **/
+		typedef InheritEnum<BlackboxShape, Preconditioner> Shape;
 
 		/** Whether the rank of the system is known (otherwise its value) */
 		enum {
@@ -110,35 +121,36 @@ namespace LinBox
 		enum {
 			SYMMETRIC = true, NON_SYMMETRIC = false
 		};
-    
+
 		/** Whether the probabilistic computation has to be certified Las-Vegas */
 		enum {
 			CERTIFY = true, DONT_CERTIFY = false
 		};
 
 		/** Linear-time pivoting or not for eliminations */
-                enum PivotStrategy {
+		enum PivotStrategy {
 			PIVOT_LINEAR, PIVOT_NONE
 		};
-            
-		Specifier ( ) 
-			: _preconditioner(NO_PRECONDITIONER),
-			  _rank(RANK_UNKNOWN),
-			  _singular(SINGULARITY_UNKNOWN),
-			  _symmetric(NON_SYMMETRIC),
-			  _certificate(DONT_CERTIFY),
-			  _maxTries(1),
-			  _ett(DEFAULT_EARLY_TERM_THRESHOLD),
-			  _blockingFactor(16),
-			  _strategy(PIVOT_LINEAR),
-                          _shape(SPARSE),
-			  _provensuccessprobability( 0.0 )
+
+		Specifier ( ) :
+			_preconditioner(NO_PRECONDITIONER),
+			_rank(RANK_UNKNOWN),
+			_singular(SINGULARITY_UNKNOWN),
+			_symmetric(NON_SYMMETRIC),
+			_certificate(CERTIFY),
+			_maxTries(1),
+			_ett(DEFAULT_EARLY_TERM_THRESHOLD),
+			_blockingFactor(16),
+			_strategy(PIVOT_LINEAR),
+			_shape(SPARSE),
+			_provensuccessprobability( 0.0 )
 #ifdef __LINBOX_HAVE_MPI
-			  , _communicatorp( 0 )
+			, _communicatorp( 0 )
 #endif
-		{}
-  
-		Specifier (const Specifier& s): 
+			, _checkResult( true )
+			{}
+
+		Specifier (const Specifier& s):
 			_preconditioner( s._preconditioner),
 			_rank( s._rank),
 			_singular( s._singular),
@@ -148,15 +160,16 @@ namespace LinBox
 			_ett( s._ett),
 			_blockingFactor( s._blockingFactor),
 			_strategy( s._strategy),
-                        _shape( s._shape),
+			_shape( s._shape),
 			_provensuccessprobability( s._provensuccessprobability)
 #ifdef __LINBOX_HAVE_MPI
 			, _communicatorp(s._communicatorp)
 #endif
-		{}
+			, _checkResult( s._checkResult )
+			{}
 
 		/** Accessors
-		 * 
+		 *
 		 * These functions just return the corresponding parameters from the
 		 * structure
 		 */
@@ -170,7 +183,7 @@ namespace LinBox
 		unsigned long	earlyTermThreshold ()	const { return _ett; }
 		unsigned long	blockingFactor ()	const { return _blockingFactor; }
 		PivotStrategy	strategy ()		const { return _strategy; }
-            	Shape		shape ()		const { return _shape; }
+		Shape		shape ()		const { return _shape; }
 		double		trustability ()		const { return _provensuccessprobability; }
 		bool		checkResult ()		const { return _checkResult; }
 #ifdef __LINBOX_HAVE_MPI
@@ -178,11 +191,11 @@ namespace LinBox
 #endif
 
 
-		/** Manipulators
+		/** @brief Manipulators
 		 *
 		 * These functions allow on-the-fly modification of a SolverTraits
 		 * structure. Note that it is guaranteed that your SolverTraits
-		 * structure will not be modified during @ref{solve}.
+		 * structure will not be modified during @ref solve.
 		 */
 
 		void preconditioner (Preconditioner p) { _preconditioner = p; }
@@ -212,46 +225,68 @@ namespace LinBox
 		unsigned long  _ett;
 		unsigned long  _blockingFactor;
 		PivotStrategy  _strategy;
-            	Shape          _shape;
+		Shape          _shape;
 		double         _provensuccessprobability;
 		bool           _checkResult;
 #ifdef __LINBOX_HAVE_MPI
 		Communicator*   _communicatorp;
 #endif
 	};
-    
-	struct HybridSpecifier :public Specifier {
+
+	/// HybridSpecifier
+	struct HybridSpecifier : public Specifier {
 		HybridSpecifier(){};
-		HybridSpecifier (const Specifier& m): Specifier(m){};
+		HybridSpecifier (const Specifier& m) :
+		       	Specifier(m)
+		{};
 #ifdef __LINBOX_HAVE_MPI
-		HybridSpecifier (Communicator& C): Specifier()
+		HybridSpecifier (Communicator& C) :
+		       	Specifier()
 		{ _communicatorp = &C; };
 #endif
 	};
-	struct BlackboxSpecifier :public Specifier {
+
+	/// BlackboxSpecifier
+	struct BlackboxSpecifier : public Specifier {
 		BlackboxSpecifier(){};
-		BlackboxSpecifier (const Specifier& m): Specifier(m){};
+		BlackboxSpecifier (const Specifier& m) :
+		       	Specifier(m)
+		{};
 	};
-	struct EliminationSpecifier :public Specifier {
+
+	/// EliminationSpecifier
+	struct EliminationSpecifier : public Specifier {
 		EliminationSpecifier(){};
-		EliminationSpecifier (const Specifier& m): Specifier(m){};
+		EliminationSpecifier (const Specifier& m) :
+		       	Specifier(m)
+		{};
 	};
 
+	///
 	struct WiedemannTraits : public Specifier {
-		/** Constructor
+		/** Constructora.
+		 *
+		 *  @param symmetric True only if the system is symmetric. This improves
+		 * performance somewhat, but will yield incorrect results if the system
+		 * is not actually symmetric. Default is false.
+		 *
+		 * @param thres
 		 *
-		 * @param precond Preconditioner to use, default is sparse
 		 * @param rank Rank, if known; otherwise use RANK_UNKNOWN
+		 *
+		 * @param preconditioner Preconditioner to use, default is sparse
+		 *
 		 * @param singular Whether the system is known to be singular or
 		 * nonsingular; default is UNKNOWN
-		 * @param symmetric True only if the system is symmetric. This improves
-		 * performance somewhat, but will yield incorrect results if the system
-		 * is not actually symmetric. Default is false.
+		 *
 		 * @param certificate True if the solver should attempt to find a
 		 * certificate of inconsistency if it suspects the system to be
 		 * inconsistent; default is true
+		 *
 		 * @param maxTries Maximum number of trials before giving up and
 		 * returning a failure; default is 100
+		 *
+		 * @param checkResult
 		 */
 		WiedemannTraits (
 				 bool           symmetric      = NON_SYMMETRIC,
@@ -262,7 +297,7 @@ namespace LinBox
 				 bool           certificate    = CERTIFY,
 				 unsigned long  maxTries       = 100,
 				 bool           checkResult    = true
-				 )
+				)
 
 		{ Specifier::_preconditioner = preconditioner;
 			Specifier::_rank =(rank);
@@ -274,28 +309,54 @@ namespace LinBox
 			Specifier::_checkResult = (checkResult);
 		}
 
-		WiedemannTraits( const Specifier& S) :  Specifier(S) {}   
+		WiedemannTraits( const Specifier& S) :
+		      	Specifier(S)
+	       	{}
 	};
-    
+
+	///
+	struct WiedemannExtensionTraits : public WiedemannTraits {
+		WiedemannExtensionTraits (
+					  bool           symmetric      = NON_SYMMETRIC,
+					  unsigned long  thres          = DEFAULT_EARLY_TERM_THRESHOLD,
+					  size_t         rank           = RANK_UNKNOWN,
+					  Preconditioner preconditioner = SPARSE,
+					  SingularState  singular       = SINGULARITY_UNKNOWN,
+					  bool           certificate    = CERTIFY,
+					  unsigned long  maxTries       = 100,
+					  bool           checkResult    = true
+					 ) :
+			WiedemannTraits(symmetric,thres,rank,preconditioner,singular,certificate,maxTries,checkResult)
+		{}
+		WiedemannExtensionTraits( const Specifier& S) :
+			WiedemannTraits(S)
+		{}
+	};
+
+	///
 	struct LanczosTraits : public Specifier {
-		/** Constructor
+		/** Constructor.
 		 *
-		 * @param precond Preconditioner to use, default is sparse
+		 * @param preconditioner Preconditioner to use, default is sparse
 		 * @param maxTries Maximum number of trials before giving up and
 		 * returning a failure; default is 100
 		 */
 		LanczosTraits (Preconditioner preconditioner = FULL_DIAGONAL,
 			       unsigned long maxTries       = 100)
-		{ Specifier::_preconditioner =(preconditioner);
-			Specifier::_maxTries =(maxTries);    
+		{
+			Specifier::_preconditioner =(preconditioner);
+			Specifier::_maxTries =(maxTries);
 		}
-		LanczosTraits( const Specifier& S) :  Specifier(S) {}   
+		LanczosTraits( const Specifier& S) :
+		      	Specifier(S)
+	       	{}
 	};
 
+	///
 	struct BlockLanczosTraits : public Specifier {
-		/** Constructor
+		/** Constructor.
 		 *
-		 * @param precond Preconditioner to use, default is sparse
+		 * @param preconditioner Preconditioner to use, default is sparse
 		 * @param maxTries Maximum number of trials before giving up and
 		 * returning a failure; default is 100
 		 * @param blockingFactor Blocking factor to use
@@ -303,30 +364,39 @@ namespace LinBox
 		BlockLanczosTraits (Preconditioner preconditioner = FULL_DIAGONAL,
 				    unsigned long  maxTries       = 100,
 				    int            blockingFactor = 16)
-		{ Specifier::_preconditioner =(preconditioner);
-            
+		{
+			Specifier::_preconditioner =(preconditioner);
+
 			Specifier::_maxTries = (maxTries);
-            
+
 			Specifier::_blockingFactor = (blockingFactor);
 		}
-        
-		BlockLanczosTraits( const Specifier& S) :  Specifier(S) {}   
+
+		BlockLanczosTraits( const Specifier& S) :
+		      	Specifier(S)
+	       	{}
 	};
-    
+
+	///
 	struct SparseEliminationTraits  : public Specifier {
-		/** Constructor
+		/** Constructor.
 		 *
 		 * @param strategy Pivoting strategy to use
 		 */
-		SparseEliminationTraits (PivotStrategy strategy = PIVOT_LINEAR) { Specifier::_strategy = (strategy) ;}
-		SparseEliminationTraits( const EliminationSpecifier& S) :  Specifier(S) {}   
+		SparseEliminationTraits (PivotStrategy strategy = PIVOT_LINEAR)
+		{
+			Specifier::_strategy = (strategy) ;
+		}
+		SparseEliminationTraits( const EliminationSpecifier& S) :
+		      	Specifier(S)
+	       	{}
 	};
 
+	///
+	struct DixonTraits : public Specifier {
 
-    	struct DixonTraits : public Specifier {
-		
 		enum SolutionType {
-			DETERMINIST, RANDOM, DIOPHANTINE 
+			DETERMINIST, RANDOM, DIOPHANTINE
 		};
 
 		DixonTraits ( SolutionType   solution       = DETERMINIST,
@@ -335,28 +405,30 @@ namespace LinBox
 			      int            maxTries       = 10,
 			      Preconditioner preconditioner = DENSE,
 			      size_t          rank          = RANK_UNKNOWN)
-		{ 
+		{
 			_solution= (solution);
 			Specifier::_singular= (singular);
 			Specifier::_certificate= (certificate);
 			Specifier::_maxTries= (maxTries);
-			Specifier::_preconditioner=(preconditioner);		    
+			Specifier::_preconditioner=(preconditioner);
 			Specifier::_rank=(rank);
 		}
 
-		DixonTraits( const Specifier& S) :  Specifier(S) {
+		DixonTraits( const Specifier& S) :
+		       	Specifier(S)
+		{
 			_solution= RANDOM;
-		}   
-		
-          	SolutionType solution () const { return _solution;}
-		
+		}
+
+		SolutionType solution () const { return _solution;}
+
 		void solution (SolutionType s) { _solution= (s);}
 
 	protected:
 		SolutionType _solution;
 	};
 
-
+	///
 	struct BlockWiedemannTraits : public Specifier {
 		BlockWiedemannTraits ( Preconditioner preconditioner = NO_PRECONDITIONER,
 				       size_t          rank            = RANK_UNKNOWN)
@@ -364,21 +436,43 @@ namespace LinBox
 			Specifier::_preconditioner = preconditioner;
 			Specifier::_rank=rank;
 		}
-		BlockWiedemannTraits( const Specifier& S) :  Specifier(S) {}   
+		BlockWiedemannTraits( const Specifier& S) :
+		       	Specifier(S)
+		{}
 	};
 
-	//Using numerical methods to symbolically solve linear systems. 
+	//Using Wan's numeric/symbolic method to solve linear systems.
 	//based on a preprinted article, submitted to JSC 2004
-	struct NumericalTraits : public Specifier{
+	struct WanTraits : public Specifier
+	{
+		WanTraits ( Preconditioner preconditioner = NO_PRECONDITIONER,
+				  size_t          rank          = RANK_UNKNOWN)
+		{
+			Specifier::_preconditioner=(preconditioner);
+
+			Specifier::_rank=(rank) ;
+		}
+		WanTraits( const Specifier& S) :
+		       	Specifier(S)
+	       	{}
+	};
+
+	//Using numerical methods to symbolically solve linear systems.
+	struct NumericalTraits : public Specifier
+	{
 		NumericalTraits ( Preconditioner preconditioner = NO_PRECONDITIONER,
 				  size_t          rank          = RANK_UNKNOWN)
-		{ Specifier::_preconditioner=(preconditioner);
-			
+		{
+			Specifier::_preconditioner=(preconditioner);
+
 			Specifier::_rank=(rank) ;
 		}
-		NumericalTraits( const Specifier& S) :  Specifier(S) {}   
+		NumericalTraits( const Specifier& S) :
+		       	Specifier(S)
+	       	{}
 	};
 
+	///
 	struct BlockHankelTraits : public Specifier {
 		BlockHankelTraits ( Preconditioner preconditioner = NO_PRECONDITIONER,
 				    size_t          rank            = RANK_UNKNOWN)
@@ -386,54 +480,76 @@ namespace LinBox
 			Specifier::_preconditioner = preconditioner;
 			Specifier::_rank=rank;
 		}
-		BlockHankelTraits( const Specifier& S) :  Specifier(S) {}   
+		BlockHankelTraits( const Specifier& S) :
+		       	Specifier(S)
+	       	{}
 	};
 
-
+	///
 	struct BlasEliminationTraits : public Specifier {
 		BlasEliminationTraits() {}
-		BlasEliminationTraits( const Specifier& S) :  Specifier(S) {}   
+		BlasEliminationTraits( const Specifier& S) :
+		       	Specifier(S)
+	       	{}
 
 	};
-    
+
+	///
+	struct BlasExtensionTraits : public BlasEliminationTraits {
+		BlasExtensionTraits (bool           //certificate    = CERTIFY
+				     , unsigned long  //maxTries       = 100
+				     , bool         //checkResult    = true
+				    ) :
+			BlasEliminationTraits()
+		{}
+		BlasExtensionTraits( const Specifier& S) :
+		       	BlasEliminationTraits(S)
+	       	{}
+	};
+
+	///
 	struct NonBlasEliminationTraits : public Specifier {
 		NonBlasEliminationTraits() {}
-		NonBlasEliminationTraits( const Specifier& S) :  Specifier(S) {}   
-        
+		NonBlasEliminationTraits( const Specifier& S) :
+		       	Specifier(S)
+	       	{}
+
 	};
 
 	/// Method specifiers for controlling algorithm choice
 	struct Method {
-		typedef HybridSpecifier		Hybrid;
-		typedef BlackboxSpecifier	Blackbox;
-		typedef EliminationSpecifier	Elimination;
-		typedef WiedemannTraits		Wiedemann;
-		typedef LanczosTraits		Lanczos;
-		typedef BlockLanczosTraits	BlockLanczos;
-		typedef SparseEliminationTraits	SparseElimination;       
-		typedef NumericalTraits		Numerical;
-            	typedef BlasEliminationTraits 	BlasElimination;
-		typedef NonBlasEliminationTraits NonBlasElimination;
-		typedef DixonTraits             Dixon;
-		typedef BlockHankelTraits       BlockHankel;
+		typedef HybridSpecifier		Hybrid;              //!< Method::Hybrid : no doc
+		typedef BlackboxSpecifier	Blackbox;            //!< Method::Blackbox : no doc
+		typedef EliminationSpecifier	Elimination;         //!< Method::Elimination : no doc
+		typedef WiedemannTraits		Wiedemann;           //!< Method::Wiedemann : no doc
+		typedef WiedemannExtensionTraits ExtensionWiedemann; //!< Method::ExtensionWiedemann :  no doc
+		typedef LanczosTraits		Lanczos;             //!< Method::Lanczos : no doc.
+		typedef BlockLanczosTraits	BlockLanczos;        //!< Method::BlockLanczos : no doc.
+		typedef SparseEliminationTraits	SparseElimination;   //!< Method::SparseElimination : no doc
+		typedef NumericalTraits		Numerical;           //!< Method::Numerical : no doc.
+		typedef BlasEliminationTraits 	BlasElimination;     //!< Method::BlasElimination : no doc
+		typedef BlasExtensionTraits ExtensionBlasElimination;//!< Method::ExtensionBlasElimination : no doc
+		typedef NonBlasEliminationTraits NonBlasElimination; //!< Method::NonBlasElimination : no doc.
+		typedef DixonTraits             Dixon;               //!< Method::Dixon : no doc
+		typedef BlockHankelTraits       BlockHankel;         //!< Method::BlockHankel : no doc
 		Method(){}
 	};
 
 	template<class BB>
-	bool useBB(const BB& A) 
-	{  return A.coldim() > 1000 && A.rowdim() > 1000;
+	bool useBB(const BB& A)
+	{
+		return (A.coldim() > 1000) && (A.rowdim() > 1000);
 	}
 
 	template<class Field>
 	bool useBB(const DenseMatrix<Field>& A) { return false; }
 
-	/** Solver traits
+	/** Solver traits.
 	 *
-         * User-specified parameters for solving a linear system.
-         */
-	struct SolverTraits : public Specifier
-	{
-		/** Constructor
+	 * User-specified parameters for solving a linear system.
+	 */
+	struct SolverTraits : public Specifier {
+		/** Constructor.
 		 *
 		 * @param checkResult True if and only if the solution should be checked
 		 * for correctness after it is computed (very much recommended for the
@@ -445,9 +561,11 @@ namespace LinBox
 
 		/** Constructor from a MethodTraits structure
 		 *
-		 * @param traits MethodTraits structure from which to get defaults
+		 * @param S MethodTraits structure from which to get defaults
 		 */
-		SolverTraits( const Specifier& S) :  Specifier(S) {}
+		SolverTraits( const Specifier& S) :
+		       	Specifier(S)
+	       	{}
 	};
 
 	/** Exception thrown when the computed solution vector is not a true
@@ -459,11 +577,10 @@ namespace LinBox
 	 * inconsistent. Contains a certificate of inconsistency.
 	 */
 	template <class Vector>
-	class InconsistentSystem 
-	{
+	class InconsistentSystem {
 	public:
-		InconsistentSystem (Vector &u)
-			: _u (u)
+		InconsistentSystem (Vector &u) :
+		       	_u (u)
 		{}
 
 		const Vector &certificate () const { return _u; }
@@ -475,4 +592,5 @@ namespace LinBox
 
 }
 
-#endif
+#endif // __LINBOX_method_H
+
diff --git a/linbox/solutions/minpoly.doxy b/linbox/solutions/minpoly.doxy
new file mode 100644
index 0000000..ef65dc0
--- /dev/null
+++ b/linbox/solutions/minpoly.doxy
@@ -0,0 +1,9 @@
+// Copyright (C) 2010 LinBox, GNU LGPL, see COPYING for licence information
+
+/** @ingroup solutions
+ at defgroup minpoly Minimal polynomial
+ at brief NO DOC YET
+
+*/
+
+// vim:syntax=doxygen
diff --git a/linbox/solutions/minpoly.h b/linbox/solutions/minpoly.h
index e50674b..c1fa017 100644
--- a/linbox/solutions/minpoly.h
+++ b/linbox/solutions/minpoly.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/solutions/minpoly.h
  * Copyright (C) 1999, 2001 Jean-Guillaume Dumas
  *
@@ -21,23 +21,27 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __MINPOLY_H
-#define __MINPOLY_H
+#ifndef __LINBOX_minpoly_H
+#define __LINBOX_minpoly_H
 
-#include "linbox/algorithms/blackbox-container.h"
-#include "linbox/algorithms/blackbox-container-symmetric.h"
-#include "linbox/algorithms/massey-domain.h"     // massey recurring sequence solver
-#include "linbox/algorithms/blas-domain.h"
 #include "linbox/solutions/methods.h"
 #include "linbox/util/commentator.h"
+
+#include "linbox/blackbox/squarize.h"
+
+#include "linbox/algorithms/blas-domain.h"
+#include "linbox/algorithms/wiedemann.h"
+
 #ifdef __LINBOX_HAVE_MPI
 #include "linbox/util/mpicpp.h"
+#include "linbox/algorithms/cra-mpi.h"
 #endif
-#include <linbox/algorithms/minpoly-integer.h>
 
-namespace LinBox 
+#include "linbox/algorithms/minpoly-integer.h"
+
+namespace LinBox
 {
-	
+
 	/*- @brief Minimal polynomial of a blackbox linear operator A.
 	 * The resulting polynomial is a vector of coefficients.
 	 * Somewhere we should document our handling of polys.
@@ -48,71 +52,74 @@ namespace LinBox
 			     const DomainCategory& tag,
 			     const MyMethod& M);
 
-	//error handler for rational domain
+	/*
+	   template < class Blackbox, class Polynomial, class MyMethod>
+	   Polynomial &minpoly (Polynomial& P,
+	   const Blackbox& A,
+	   const RingCategories::RationalTag& tag,
+	   const MyMethod& M)
+	   {
+	   throw LinboxError("LinBox ERROR: minpoly is not yet defined over a rational domain");
+	   }
+	   */
+
+	/** \brief  ...using an optional Method parameter
+	  \param P - the output minimal polynomial.  If the polynomial is
+	  of degree d, this random access container has size d+1, the 0-th entry is
+	  the constant coefficient and the d-th is 1 since the minpoly is monic.
+	  \param A - a blackbox matrix
+	  Optional \param M - the method object.  Generally, the default
+	  object suffices and the algorithm used is determined by the class of M.
+	  Basic methods are Method::Blackbox, Method::Elimination, and Method::Hybrid
+	  (the default).
+	  See methods.h for more options.
+	  \return a reference to P.
+	  */
 	template < class Blackbox, class Polynomial, class MyMethod>
 	Polynomial &minpoly (Polynomial& P,
 			     const Blackbox& A,
-			     const RingCategories::RationalTag& tag,
 			     const MyMethod& M)
 	{
-		throw LinboxError("LinBox ERROR: minpoly is not yet define over a rational domain");
-	}
- 
-
-        /** \brief  ...using an optional Method parameter
-	    \param P - the output minimal polynomial.  If the polynomial is
-	    of degree d, this random access container has size d+1, the 0-th entry is 
-	    the constant coefficient and the d-th is 1 since the minpoly is monic.
-	    \param A - a blackbox matrix
-	    Optional \param M - the method object.  Generally, the default
-	    object suffices and the algorithm used is determined by the class of M.
-	    Basic methods are Method::Blackbox, Method::Elimination, and Method::Hybrid
-	    (the default).
-	    See methods.h for more options.
-	    \return a reference to P.
-	*/
-	template < class Blackbox, class Polynomial, class MyMethod>
-	Polynomial &minpoly (Polynomial& P,
-			     const Blackbox& A,
-			     const MyMethod& M){
 		return minpoly (P, A, typename FieldTraits<typename Blackbox::Field>::categoryTag(), M);
 	}
 
-        /// \brief  ...using default Method 
+	/// \brief  ...using default Method
 	template<class Polynomial, class Blackbox>
-	Polynomial &minpoly (Polynomial &P, 
-			     const Blackbox &A)    
-	{        return minpoly (P, A, Method::Hybrid());    }
+	Polynomial &minpoly (Polynomial &P,
+			     const Blackbox &A)
+	{
+		return minpoly (P, A, Method::Hybrid());
+	}
 
 
 
-	// The minpoly with Hybrid Method 
+	// The minpoly with Hybrid Method
 	template<class Polynomial, class Blackbox>
 	Polynomial &minpoly (
-			     Polynomial         &P, 
+			     Polynomial         &P,
 			     const Blackbox                            &A,
 			     const RingCategories::ModularTag          &tag,
 			     const Method::Hybrid& M)
 	{
 		// not yet a hybrid
-		return minpoly(P, A, tag, Method::Wiedemann(M));
+		return minpoly(P, A, tag, Method::Blackbox(M));
 	}
 
 	// The minpoly with Hybrid Method on DenseMatrix
 	template<class Polynomial, class Field>
 	Polynomial &minpoly (
-			     Polynomial         &P, 
+			     Polynomial         &P,
 			     const DenseMatrix<Field> 			&A,
 			     const RingCategories::ModularTag          &tag,
 			     const Method::Hybrid& M)
 	{
 		return minpoly(P, A, tag, Method::Elimination(M));
 	}
-	
+
 	// The minpoly with Hybrid Method on BlasBlackbox
 	template<class Polynomial, class Field>
 	Polynomial &minpoly (
-			     Polynomial         &P, 
+			     Polynomial         &P,
 			     const BlasBlackbox<Field> 			&A,
 			     const RingCategories::ModularTag          &tag,
 			     const Method::Hybrid& M)
@@ -120,10 +127,10 @@ namespace LinBox
 		return minpoly(P, A, tag, Method::Elimination(M));
 	}
 
-	// The minpoly with Elimination Method 
+	// The minpoly with Elimination Method
 	template<class Polynomial, class Blackbox>
 	Polynomial &minpoly (
-			     Polynomial         &P, 
+			     Polynomial         &P,
 			     const Blackbox                            &A,
 			     const RingCategories::ModularTag          &tag,
 			     const Method::Elimination& M)
@@ -131,198 +138,103 @@ namespace LinBox
 		return minpoly(P, A, tag, Method::BlasElimination(M));
 	}
 
-	// The minpoly with BlasElimination Method 
+	// The minpoly with BlasElimination Method
 	template<class Polynomial, class Blackbox>
 	Polynomial &minpoly (
-			     Polynomial         &P, 
+			     Polynomial         &P,
 			     const Blackbox                            &A,
 			     const RingCategories::ModularTag          &tag,
 			     const Method::BlasElimination& M)
 	{
-	    	if (A.coldim() != A.rowdim())
-			throw LinboxError("LinBox ERROR: matrix must be square for minimal polynomial computation\n");
+		commentator.start ("Convertion to BLAS Minimal polynomial", "blasconvert");
 
-		BlasBlackbox< typename Blackbox::Field > BBB (A);
-		BlasMatrixDomain< typename Blackbox::Field > BMD (BBB.field());
-		return BMD.minpoly (P, static_cast<const BlasMatrix<typename Blackbox::Field::Element>& >(BBB));
+		if (A.coldim() != A.rowdim()) {
+			commentator.report(Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION) << "Squarize matrix" << std::endl;
+			Squarize<Blackbox> B(&A);
+			BlasBlackbox< typename Blackbox::Field > BBB (B);
+			BlasMatrixDomain< typename Blackbox::Field > BMD (BBB.field());
+			commentator.stop ("done", NULL, "blasconvert");
+
+			return BMD.minpoly (P, static_cast<const BlasMatrix<typename Blackbox::Field::Element>& >(BBB));
+		}
+		else {
+			BlasBlackbox< typename Blackbox::Field > BBB (A);
+			BlasMatrixDomain< typename Blackbox::Field > BMD (BBB.field());
+			commentator.stop ("done", NULL, "blasconvert");
+			return BMD.minpoly (P, static_cast<const BlasMatrix<typename Blackbox::Field::Element>& >(BBB));
+		}
 	}
 
-	// The minpoly with BlackBox Method 
+	// The minpoly with BlackBox Method
 	template<class Polynomial, class Blackbox>
 	Polynomial &minpoly (
-			     Polynomial         &P, 
+			     Polynomial         &P,
 			     const Blackbox                            &A,
 			     const RingCategories::ModularTag          &tag,
 			     const Method::Blackbox& M)
 	{
-		return minpoly(P, A, tag, Method::Wiedemann (M));
-	}
-
-	/*
-	  template<class Polynomial, class Blackbox>
-	  Polynomial &minpoly (Polynomial& P,
-	  const Blackbox& A,
-	  const RingCategories::ModularTag          &tag,
-	  const Method::Wiedemann& M = Method::Wiedemann ());
-	
-	  return minpoly (P, A, typename FieldTraits<typename Blackbox::Field>::categoryTag(), M);
-	  }
-
-	  template<class Polynomial, class Blackbox>
-	  Polynomial &minpoly (Polynomial& P,
-	  const Blackbox& A,
-	  RingCategories::IntegerTag tag,
-	  const Method::Wiedemann& M = Method::Wiedemann ())
-	  {	
-	  typedef Modular<double> ModularField;
-	  MinPoly<typename Blackbox::Field::Element, ModularField>::minPoly(P, A);
-
-	  return P;
-	  }
-	*/
-	/*
-
-	template < class Blackbox, class Polynomial, class FieldCategoryTag>
-	Polynomial &minpolySymmetric (Polynomial& P,
-	const Blackbox& A,
-	FieldCategoryTag tag,
-	const Method::Wiedemann& M = Method::Wiedemann ());
-
-	template < class Blackbox, class Polynomial>
-	Polynomial &minpolySymmetric (Polynomial& P,
-	const Blackbox& A,
-	const RingCategories::ModularTag          &tag,
-	const Method::Wiedemann& M = Method::Wiedemann ()) 
-	{
-
-	minpolySymmetric(P, A,  typename FieldTraits<typename Blackbox::Field>::categoryTag(), M);
-	return P;
-	}
-				 
-	template < class Blackbox, class Polynomial>
-	Polynomial &minpolySymmetric (Polynomial& P,
-	const Blackbox& A,
-	RingCategories::IntegerTag tag,
-	const Method::Wiedemann& M = Method::Wiedemann ())
-	{	
-	typedef typename Blackbox::Field::Element Integer;
-	typedef Modular<double> ModularField;
-	MinPoly<Integer, ModularField>::minPoly(P, A);
-
-	return P;
+		if (M.certificate()) {
+			// Will make a word size extension
+			// when field size is too small
+			return minpoly(P, A, tag, Method::ExtensionWiedemann (M));
+		}
+		else
+			return minpoly(P, A, tag, Method::Wiedemann (M));
 	}
-	*/
-
-	template<class Polynomial, class Blackbox>
-	Polynomial &minpoly (Polynomial& P,
-			     const Blackbox& A,
-			     RingCategories::ModularTag tag,
-			     const Method::Wiedemann& M = Method::Wiedemann ())
-	{
-		if (A.coldim() != A.rowdim())
-			throw LinboxError("LinBox ERROR: matrix must be square for minimal polynomial computation\n");
-
-		typedef typename Blackbox::Field Field;
-		typename Field::RandIter i (A.field());
-		unsigned long            deg;
 
-		commentator.start ("Wiedemann Minimal polynomial", "minpoly");
 
-		BlackboxContainer<Field, Blackbox> TF (&A, A.field(), i);
-		MasseyDomain< Field, BlackboxContainer<Field, Blackbox> > WD (&TF, M.earlyTermThreshold ());
 
-		WD.minpoly (P, deg);
-
-#ifdef INCLUDE_TIMING
-		commentator.report (Commentator::LEVEL_IMPORTANT, TIMING_MEASURE)
-			<< "Time required for applies:      " << TF.applyTime () << endl;
-		commentator.report (Commentator::LEVEL_IMPORTANT, TIMING_MEASURE)
-			<< "Time required for dot products: " << TF.dotTime () << endl;
-		commentator.report (Commentator::LEVEL_IMPORTANT, TIMING_MEASURE)
-			<< "Time required for discrepency:  " << WD.discrepencyTime () << endl;
-		commentator.report (Commentator::LEVEL_IMPORTANT, TIMING_MEASURE)
-			<< "Time required for LSR fix:      " << WD.fixTime () << endl;
-#endif // INCLUDE_TIMING
-
-		commentator.stop ("done", NULL, "minpoly");
-
-		return P;
-	}
-
-	/*
-	  template < class Blackbox, class Polynomial>
-	  Polynomial &minpolySymmetric (Polynomial& P,
-	  const Blackbox& A,
-	  RingCategories::ModularTag tag,
-	  const Method::Wiedemann& M = Method::Wiedemann ())
-	  {
-	  typedef typename Blackbox::Field Field;
-	  typename Field::RandIter i (A.field());
-	  unsigned long            deg;
-
-	  commentator.start ("Minimal polynomial", "minpoly");
-
-	  BlackboxContainerSymmetric<Field, Blackbox> TF (&A, A.field(), i);
-	  MasseyDomain< Field, BlackboxContainerSymmetric<Field, Blackbox> > WD (&TF, M.earlyTermThreshold ());
-
-	  WD.minpoly (P, deg);
-
-	  #ifdef INCLUDE_TIMING
-	  commentator.report (Commentator::LEVEL_IMPORTANT, TIMING_MEASURE)
-	  << "Time required for applies:      " << TF.applyTime () << endl;
-	  commentator.report (Commentator::LEVEL_IMPORTANT, TIMING_MEASURE)
-	  << "Time required for dot products: " << TF.dotTime () << endl;
-	  commentator.report (Commentator::LEVEL_IMPORTANT, TIMING_MEASURE)
-	  << "Time required for discrepency:  " << WD.discrepencyTime () << endl;
-	  commentator.report (Commentator::LEVEL_IMPORTANT, TIMING_MEASURE)
-	  << "Time required for LSR fix:      " << WD.fixTime () << endl;
-	  #endif // INCLUDE_TIMING
-
-	  commentator.stop ("done", NULL, "minpoly");
-
-	  return P;
-	  }
-	*/
 }
 
+// ---------------------------------------------------------
+// Chinese Remaindering generic wrappers for integer minpoly
+// ---------------------------------------------------------
+
 #include "linbox/field/modular-double.h"
 #include "linbox/algorithms/cra-domain.h"
 #include "linbox/randiter/random-prime.h"
 #include "linbox/algorithms/matrix-hom.h"
 
-namespace LinBox {
-   
+#include "linbox/algorithms/rational-cra2.h"
+#include "linbox/algorithms/varprec-cra-early-multip.h"
+#include "linbox/algorithms/minpoly-rational.h"
+
+namespace LinBox
+{
+
 	template <class Blackbox, class MyMethod>
-	struct IntegerModularMinpoly {       
+	struct IntegerModularMinpoly {
 		const Blackbox &A;
 		const MyMethod &M;
 
-		IntegerModularMinpoly(const Blackbox& b, const MyMethod& n) 
-			: A(b), M(n) {}
-        
-        
+		IntegerModularMinpoly(const Blackbox& b, const MyMethod& n) :
+			A(b), M(n)
+		{}
+
+
 		template<typename Polynomial, typename Field>
-		Polynomial& operator()(Polynomial& P, const Field& F) const {
+		Polynomial& operator()(Polynomial& P, const Field& F) const
+		{
 			typedef typename Blackbox::template rebind<Field>::other FBlackbox;
-			FBlackbox * Ap;
-			MatrixHom::map(Ap, A, F);
-			minpoly( P, *Ap, typename FieldTraits<Field>::categoryTag(), M);
-			delete Ap;
-			return P;
-		}            
+			FBlackbox Ap(A, F);
+			return minpoly( P, Ap, typename FieldTraits<Field>::categoryTag(), M);
+		}
 	};
 
 	template <class Polynomial, class Blackbox, class MyMethod>
-	Polynomial &minpoly (Polynomial 			&P, 
-                             const Blackbox                     &A,
-                             const RingCategories::IntegerTag   &tag,
-                             const MyMethod                     &M)
+	Polynomial &minpoly (Polynomial 			&P,
+			     const Blackbox                     &A,
+			     const RingCategories::IntegerTag   &tag,
+			     const MyMethod                     &M)
 	{
+#if 0
 		if (A.coldim() != A.rowdim())
 			throw LinboxError("LinBox ERROR: matrix must be square for minimal polynomial computation\n");
+#endif
 
 #ifdef __LINBOX_HAVE_MPI
-		if(!M.communicatorp() || (M.communicatorp())->rank() == 0) 
+		Communicator *c = M.communicatorp();
+		if(!c || c->rank() == 0)
 			commentator.start ("Integer Minpoly", "Iminpoly");
 		else{
 			//commentator.setMaxDepth(0);
@@ -333,13 +245,14 @@ namespace LinBox {
 		commentator.start ("Integer Minpoly", "Iminpoly");
 #endif
 		// 0.7213475205 is an upper approximation of 1/(2log(2))
-		RandomPrimeIterator genprime( 26-(int)ceil(log((double)A.rowdim())*0.7213475205)); 
-		ChineseRemainder< EarlyMultipCRA<Modular<double> > > cra(3UL);
+		RandomPrimeIterator genprime( 26-(int)ceil(log((double)A.rowdim())*0.7213475205));
 		IntegerModularMinpoly<Blackbox,MyMethod> iteration(A, M);
-		std::vector<integer> PP; // use of integer du to non genericity of cra. PG 2005-08-04
+		std::vector<integer> PP; // use of integer due to non genericity of cra. PG 2005-08-04
 #ifdef __LINBOX_HAVE_MPI
-		cra(PP, iteration, genprime, M.communicatorp());
+		MPIChineseRemainder< EarlyMultipCRA<Modular<double> > > cra(3UL, c);
+		cra(PP, iteration, genprime);
 #else
+		ChineseRemainder< EarlyMultipCRA<Modular<double> > > cra(3UL);
 		cra(PP, iteration, genprime);
 #endif
 		size_t i =0;
@@ -348,11 +261,44 @@ namespace LinBox {
 			A.field().init(*it, PP[i]);
 
 #ifdef __LINBOX_HAVE_MPI
-		if(!M.communicatorp() || (M.communicatorp())->rank() == 0) 
+		if(c || c->rank() == 0)
 #endif
 			commentator.stop ("done", NULL, "Iminpoly");
 		return P;
 	}
-	
+
+	template < class Blackbox, class Polynomial, class MyMethod>
+	Polynomial &minpoly (Polynomial& P, const Blackbox& A,
+			     const RingCategories::RationalTag& tag, const MyMethod& M)
+	{
+		commentator.start ("Rational Minpoly", "Rminpoly");
+
+		RandomPrimeIterator genprime( 26-(int)ceil(log((double)A.rowdim())*0.7213475205));
+		RationalRemainder2< VarPrecEarlyMultipCRA<Modular<double> > > rra(3UL);
+		IntegerModularMinpoly<Blackbox,MyMethod> iteration(A, M);
+
+		std::vector<Integer> PP; // use of integer due to non genericity of cra. PG 2005-08-04
+		Integer den;
+		rra(PP,den, iteration, genprime);
+		size_t i =0;
+		P.resize(PP.size());
+		for (typename Polynomial::iterator it= P.begin(); it != P.end(); ++it, ++i)
+			A.field().init(*it, PP[i],den);
+
+		commentator.stop ("done", NULL, "Rminpoly");
+
+		return P;
+	}
+
+	template < class Field, template<class> class Polynomial, class MyMethod>
+	Polynomial<typename Field::Element> &minpoly (Polynomial<typename Field::Element>& P, const DenseMatrix<Field>& A,
+						      const RingCategories::RationalTag& tag, const MyMethod& M)
+	{
+		commentator.start ("Dense Rational Minpoly", "Rminpoly");
+
+		rational_minpoly(P,A,M);
+		return P;
+	}
 } // end of LinBox namespace
-#endif // __MINPOLY_H
+#endif // __LINBOX_minpoly_H
+
diff --git a/linbox/solutions/nullspace.doxy b/linbox/solutions/nullspace.doxy
new file mode 100644
index 0000000..ed8750f
--- /dev/null
+++ b/linbox/solutions/nullspace.doxy
@@ -0,0 +1,10 @@
+// Copyright (C) 2010 LinBox, GNU LGPL, see COPYING for licence information
+
+/** @ingroup solutions
+ at defgroup nullsp Nullspace
+ at brief NO DOC YET
+
+
+*/
+
+// vim:syntax=doxygen
diff --git a/linbox/solutions/nullspace.h b/linbox/solutions/nullspace.h
new file mode 100644
index 0000000..88fe5fa
--- /dev/null
+++ b/linbox/solutions/nullspace.h
@@ -0,0 +1,41 @@
+/* -*- 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
+/* Copyright (C) 2009 LinBox
+ * Written by <brice.boyer at imag.fr>
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_nullspace_H
+#define __LINBOX_nullspace_H
+
+/** \file linbox/solutions/nullspace.h
+ * @brief Nullspace solutions.
+ * This file will eventually comprehend :
+ * - Dense matrix nullspace on Integers or <code>Z/pZ</code>
+ * - Sparse matrix nullspace
+ * - Random element in the nullspace
+ */
+
+namespace LinBox
+{
+#error "you don't want to include this file for now."
+}
+
+#endif // __LINBOX_modulardense_nullspace_H
+
diff --git a/linbox/solutions/rank.doxy b/linbox/solutions/rank.doxy
new file mode 100644
index 0000000..ebb485e
--- /dev/null
+++ b/linbox/solutions/rank.doxy
@@ -0,0 +1,9 @@
+// Copyright (C) 2010 LinBox, GNU LGPL, see COPYING for licence information
+
+/** @ingroup solutions
+ at defgroup  rk Rank
+ at brief NO DOC YET
+
+*/
+
+// vim:syntax=doxygen
diff --git a/linbox/solutions/rank.h b/linbox/solutions/rank.h
index c770152..d17e51b 100644
--- a/linbox/solutions/rank.h
+++ b/linbox/solutions/rank.h
@@ -1,12 +1,13 @@
 /* -*- 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
 /* linbox/solutions/rank.h
+ * Copyright(C) LinBox
  * ------------------------------------
  * See COPYING for license information.
  */
 
-#ifndef __RANK_H
-#define __RANK_H
+#ifndef __LINBOX_rank_H
+#define __LINBOX_rank_H
 
 //#include "linbox-config.h"
 #include "linbox/field/modular.h"
@@ -23,7 +24,9 @@
 #include "linbox/algorithms/blackbox-container.h"
 #include "linbox/algorithms/massey-domain.h"
 #include "linbox/algorithms/gauss.h"
+#include "linbox/algorithms/gauss-gf2.h"
 #include "linbox/algorithms/blas-domain.h"
+#include "linbox/algorithms/whisart_trace.h"
 #include "linbox/matrix/blas-matrix.h"
 #include "linbox/switch/cekstv.h"
 #include "linbox/blackbox/butterfly.h"
@@ -37,614 +40,660 @@
 #include "linbox/util/debug.h"
 
 // Namespace in which all LinBox library code resides
-namespace LinBox {
-
-
-	/** 
-            Compute the rank of a linear transform A over a field by selected method. 
-            For very large and/or very sparse matrices the Wiedemann method will be faster
-            (and is memory efficient).
-            For some sparse matrices SparseElimination may outperform Wiedemann.
-            For small or dense matrices BlasElimination will be faster.
-	    \param r - output rank of A.
-            \param - input A linear transform, member of any blackbox class.
-            \param - input M may be a Method::Wiedemann (the default), a Method::BlasElimination, or a Method::SparseElimination..
-            \returns  reference to r.
-            \ingroup solutions
-	*/
-	
- 	template <class Blackbox, class Method, class DomainCategory>
- 	unsigned long &rank (unsigned long                   &r,
- 			     const Blackbox                  &A,
-			     const DomainCategory          &tag,
- 			     const Method                   &M);
+namespace LinBox
+{
+
+
+	/**
+	 * Compute the rank of a linear transform A over a field by selected method.
+	 * \ingroup solutions
+	 * For very large and/or very sparse matrices the Wiedemann method will be faster
+	 * (and it is memory efficient).
+	 * For some sparse matrices SparseElimination may outperform Wiedemann.
+	 * For small or dense matrices BlasElimination will be faster.
+	 * \param[out] r  output rank of A.
+	 * \param[in]  A linear transform, member of any blackbox class.
+	 * \param[in]  M may be a \p Method::Wiedemann (the default), a \p Method::BlasElimination, or a \p Method::SparseElimination..
+	 * \param      tag UNDOC
+	 * \return a reference to r.
+	 */
+	template <class Blackbox, class Method, class DomainCategory>
+	inline unsigned long &rank (unsigned long                   &r,
+				    const Blackbox                  &A,
+				    const DomainCategory          &tag,
+				    const Method                   &M);
 
 	// error hanlder for rational domain
 	template <class Blackbox, class Method>
- 	unsigned long &rank (unsigned long                           &r,
- 			     const Blackbox                          &A,
-			     const RingCategories::RationalTag     &tag,
- 			     const Method                           &M){
-		throw LinboxError("LinBox ERROR: rank is not yet defined over a rational domain");
+	inline unsigned long &rank (unsigned long                           &r,
+				    const Blackbox                          &A,
+				    const RingCategories::RationalTag     &tag,
+				    const Method                           &M){
+		commentator.start ("Rational Rank", "Rrank");
+		// Same mapping as the integer one
+		rank(r, A, RingCategories::IntegerTag(), M);
+		commentator.stop ("done", NULL, "Rrank");
+		return r;
 	}
 
 
-	/** 
-            Compute the rank of a linear transform A over a field. 
+	/**
+	 * Compute the rank of a linear transform A over a field.
+	 * \ingroup solutions
+	 * The default method is Wiedemann(), using diagonal preconditioning and
+	 * the minpoly.  For small or dense matrices BlasElimination will be faster.
+	 * \param      A linear transform, member of any blackbox class.
+	 * \param[out] r rank of \p A
+	 * \return     \p r rank of \p A.
+	  */
+	template <class Blackbox>
+	inline unsigned long &rank (unsigned long                   &r,
+				    const Blackbox                  &A)
+	{
+		return rank(r, A, typename FieldTraits<typename Blackbox::Field>::categoryTag(), Method::Hybrid());
+	}
 
-            The default method is Wiedemann(), using diagonal preconditioning and 
-            the minpoly.  For small or dense matrices BlasElimination will be faster.
-            \returns <em>r</em> rank of A.
-            \param A linear transform, member of any blackbox class.
-            \ingroup solutions
+	/** Rank of \p A.
+	 * \p A may be modified
+	 * @param A matrix
+	 * @param r rank
 	*/
-    template <class Blackbox>
-    unsigned long &rank (unsigned long                   &r,
-                         const Blackbox                  &A)
-    {  return rank(r, A, typename FieldTraits<typename Blackbox::Field>::categoryTag(), Method::Hybrid()); 
-    }
+	template <class Matrix>
+	inline unsigned long &rankin (unsigned long                   &r,
+				      Matrix                          &A)
+	{
+		return rankin(r, A, typename FieldTraits<typename Matrix::Field>::categoryTag(), Method::Elimination());
+	}
 
-	/** A may be modified
-	*/
-    template <class Matrix>
-    unsigned long &rankin (unsigned long                   &r,
-                         Matrix                  &A)
-    {  return rankin(r, A, typename FieldTraits<typename Matrix::Field>::categoryTag(), Method::Elimination()); 
-    }
-
-    template <class Blackbox>
-    unsigned long &rank (unsigned long                   &r,
-                         const Blackbox                  &A,
-                         const RingCategories::ModularTag     &tag,
-                         const Method::Hybrid         &m)
-    { // this should become a BB/Blas hybrid in the style of Duran/Saunders/Wan.  
-        if (useBB(A)) return rank(r, A, tag, Method::Blackbox(m )); 
-        else return rank(r, A, tag, Method::Elimination( m ));
-    }
-
-    template <class Blackbox>
-    unsigned long &rank (unsigned long                   &r,
-                         const Blackbox                  &A,
-                         const RingCategories::ModularTag                  &tag,
-                         const Method::Elimination    &m)
-    {  
-        typedef typename Blackbox::Field Field;
-        const Field& F = A.field();
-        integer a, b; F.characteristic(a); F.cardinality(b);
-        if (a == b && a < LinBox::BlasBound)
-		return rank(r, A, tag, Method::BlasElimination(m));
-	else
-		return rank(r, A, tag, Method::NonBlasElimination( m ));
-    }
-
-
-    template <class Field, class Vector>
-    unsigned long &rank (unsigned long                   &r,
-                         const SparseMatrix<Field, Vector>         &A,
-                         const RingCategories::ModularTag                  &tag,
-                         const Method::Elimination    &m)
-    {  
-        return rank(r, A, tag, Method::SparseElimination(m));
-    }
+	template <class Blackbox>
+	inline unsigned long &rank (unsigned long                    &r,
+				    const Blackbox                   &A,
+				    const RingCategories::ModularTag &tag,
+				    const Method::Hybrid             &m)
+	{ // this should become a BB/Blas hybrid in the style of Duran/Saunders/Wan.
+		if (useBB(A)) return rank(r, A, tag, Method::Blackbox(m ));
+		else return rank(r, A, tag, Method::Elimination( m ));
+	}
+
+	template <class Blackbox>
+	inline unsigned long &rank (unsigned long                     &r,
+				    const Blackbox                    &A,
+				    const RingCategories::ModularTag  &tag,
+				    const Method::Elimination         &m)
+	{
+		typedef typename Blackbox::Field Field;
+		const Field& F = A.field();
+		integer a, b; F.characteristic(a); F.cardinality(b);
+		if (a == b && a < LinBox::BlasBound)
+			return rank(r, A, tag, Method::BlasElimination(m));
+		else
+			return rank(r, A, tag, Method::NonBlasElimination( m ));
+	}
+
+
+	template <class Field, class Vector>
+	inline unsigned long &rank (unsigned long                      &r,
+				    const SparseMatrix<Field, Vector>  &A,
+				    const RingCategories::ModularTag   &tag,
+				    const Method::Elimination          &m)
+	{
+		return rank(r, A, tag, Method::SparseElimination(m));
+	}
 
 
 	// specialization of NonBlas for SparseMatrix
-    template <class Blackbox>
-    unsigned long &rank (unsigned long                   &r,
-                         const Blackbox                  &A,
-                         const   RingCategories::ModularTag           &tag,
-                         const Method::NonBlasElimination& m)
-    {
-        return rank(r, A, tag, Method::SparseElimination(m));
-    }
-
-
-    template <class Blackbox>
-    unsigned long &rank (unsigned long                   &r,
-                         const Blackbox                  &A,
-                         const  RingCategories::ModularTag                   &tag,
-                         const Method::Blackbox& m);
-    
-
-	/** 
-            Compute the rank of a linear transform A over a field. 
-
-            The default method is Wiedemann(), using diagonal preconditioning and 
-            the minpoly.  For small or dense matrices BlasElimination will be faster.
-            \returns <em>r</em> rank of A.
-            \param A linear transform, member of any blackbox class.
-            \ingroup solutions
-	*/
-    template <class Blackbox, class Method>
-    unsigned long &rank (unsigned long                   &r,
-                         const Blackbox                  &A,
-                         const Method    &M)
-    {  return rank(r, A, typename FieldTraits<typename Blackbox::Field>::categoryTag(), M); 
-    }
+	template <class Blackbox>
+	inline unsigned long &rank (unsigned long                       &r,
+				    const Blackbox                      &A,
+				    const   RingCategories::ModularTag  &tag,
+				    const Method::NonBlasElimination    & m)
+	{
+		return rank(r, A, tag, Method::SparseElimination(m));
+	}
+
+
+	template <class Blackbox>
+	inline unsigned long &rank (unsigned long                     &r,
+				    const Blackbox                    &A,
+				    const  RingCategories::ModularTag &tag,
+				    const Method::Blackbox            &m);
+
+
+	/**
+	 * Compute the rank of a linear transform A over a field.
+	 * \ingroup solutions
+	 *
+	 * The default method is \p Wiedemann(), using diagonal preconditioning and
+	 * the minpoly.  For small or dense matrices \p BlasElimination will be faster.
+	 * \return \p r rank of \p A.
+	 * \param A linear transform, member of any blackbox class.
+	 * @param[out] r rank of \p A
+	 * @param M method (see ???)
+	 */
+	template <class Blackbox, class Method>
+	inline unsigned long &rank (unsigned long                   &r,
+				    const Blackbox                  &A,
+				    const Method    &M)
+	{  return rank(r, A, typename FieldTraits<typename Blackbox::Field>::categoryTag(), M);
+	}
 
 	/// M may be <code>Method::Wiedemann()</code>.
-    template <class Blackbox>
-    unsigned long &rank (unsigned long                   &res,
-                         const Blackbox                  &A,
-                         const RingCategories::ModularTag          &tag,
-                         const Method::Wiedemann    &M) 
-// This is too much for solutions.  It belongs in algorithms
-    {
-            
-        typedef typename Blackbox::Field Field;
-        const Field F = A.field();
-        typename Field::RandIter iter (F);
-            
-        if (M.symmetric()) {
-            commentator.start ("Symmetric Rank", "srank");
-		
-                
-            std::vector<typename Field::Element> d1;
-            size_t i;
-                
-            VectorWrapper::ensureDim (d1, A.coldim ());
-
-            for (i = 0; i < A.coldim (); i++)
-                do iter.random (d1[i]); while (F.isZero (d1[i]));
-
-                
-            Diagonal<Field> D1 (F, d1);
-                
-                
-            Compose<Diagonal<Field>,Blackbox > B1 (&D1, &A);
-            typedef Compose<Compose<Diagonal<Field>,Blackbox >, Diagonal<Field> > BlackBox1;
-            BlackBox1 B (&B1, &D1);
-                
-            BlackboxContainerSymmetric<Field, BlackBox1> TF (&B, F, iter);
-            MasseyDomain<Field, BlackboxContainerSymmetric<Field, BlackBox1> > WD (&TF, M.earlyTermThreshold ());
-            std::vector<typename Field::Element> phi;
-            WD.pseudo_minpoly (phi, res);
-            commentator.report(Commentator::LEVEL_ALWAYS,INTERNAL_DESCRIPTION) << "Pseudo Minpoly degree: " << res << std::endl;
-               
-            commentator.start ("Monte Carlo certification", "trace");
-            typename Field::Element t, p2; F.init(p2, 0UL);
-            trace(t, B);            
-            if (phi.size() >= 2) F.neg(p2, phi[ phi.size()-2]);
-                
-            int nbperm = 0; unsigned long rk;
-            int logn = 2*(unsigned long)floor( log( (double)A.rowdim() ) );
-            bool tryagain = (! F.areEqual( t, p2 ));
-            while( tryagain ) {
-                commentator.stop ("fail", NULL, "trace");
-
-//                 Permutation<Field> P(A.rowdim(), F);          
-//                 for (i = 0; i < A.rowdim (); ++i)
-//                     P.permute( rand() % A.rowdim() , rand() % A.rowdim() );
-//                 for (i = 0; i < A.rowdim (); ++i)
-//                     P.permute( rand() % A.rowdim() , rand() % A.rowdim() );
-
-//                 Transpose< Permutation<Field> > TP(&P);
-//                 typedef Compose< Permutation<Field>, Blackbox > BlackboxP;
-//                 typedef Compose< Compose< Permutation<Field>, Blackbox >, Transpose< Permutation<Field> > > BlackboxPAP;
-//                 BlackboxP PA(&P, &A);
-//                 BlackboxPAP BP( &PA , &TP );
-
-//                 for (i = 0; i < A.coldim (); i++)
-//                     do iter.random (d1[i]); while (F.isZero (d1[i]));
-//                 Diagonal<Field> D1 (F, d1);
-//                 Compose<Diagonal<Field>,BlackboxPAP > B1 (&D1, &BP);
-//                 typedef Compose<Compose<Diagonal<Field>,BlackboxPAP >, Diagonal<Field> > BlackBox2;
-//                 BlackBox2 B (&B1, &D1);
-
-                for (i = 0; i < A.coldim (); i++)
-                    do iter.random (d1[i]); while (F.isZero (d1[i]));
-                Diagonal<Field> D1 (F, d1);
-                Compose<Diagonal<Field>,Blackbox > B1 (&D1, &A);
-                BlackBox1 B (&B1, &D1);
-                
-                BlackboxContainerSymmetric<Field, BlackBox1> TF (&B, F, iter);
-                MasseyDomain<Field, BlackboxContainerSymmetric<Field, BlackBox1> > WD (&TF, M.earlyTermThreshold ());
-                
-                WD.pseudo_minpoly (phi, rk);
-                commentator.report(Commentator::LEVEL_ALWAYS,INTERNAL_DESCRIPTION) << "Permuted pseudo Minpoly degree: " << res << std::endl;
-                commentator.start ("Monte Carlo certification", "trace");
-                if (phi.size() >= 2) F.neg(p2, phi[ phi.size()-2]);
-                
-                trace(t, B);
-
-                tryagain = (! F.areEqual( t, p2 ));
-                if (res > rk) 
-                    tryagain = true;
-                else
-                    res = rk;
-                if( ++nbperm > logn) break;
-            }
-            commentator.report(Commentator::LEVEL_ALWAYS,INTERNAL_DESCRIPTION) << "symm permutations : " << nbperm << std::endl;
-            nbperm = 0;
-            while(tryagain) {
-                commentator.stop ("fail", NULL, "trace");
-//             F.write( F.write( commentator.report(Commentator::LEVEL_ALWAYS,INTERNAL_DESCRIPTION)
-//                               << "end trace: ", t) << ", p2: ", p2) << std::endl;
-                typename Field::RandIter r (F);
-                typename CekstvSwitch<Field>::Factory factory (r);
-                typedef Butterfly<Field, CekstvSwitch<Field> > ButterflyP;
-                ButterflyP P (F, A.rowdim(), factory);
-                for (i = 0; i < A.coldim (); i++)
-                    do iter.random (d1[i]); while (F.isZero (d1[i]));
-                Diagonal<Field> D1 (F, d1);
-                typedef Compose< ButterflyP, Diagonal<Field> > ButD;
-                ButD PD(&P, &D1);
-
-                Transpose< ButD > TP (&PD);
-                
-                Compose< ButD, Blackbox > B1( &PD, &A);
-
-                typedef Compose< Compose< ButD, Blackbox > , Transpose< ButD > > BlackBoxBAB;
-                BlackBoxBAB PAP(&B1, &TP);
-                
-                BlackboxContainerSymmetric<Field, BlackBoxBAB> TF (&PAP, F, iter);
-                MasseyDomain<Field, BlackboxContainerSymmetric<Field, BlackBoxBAB> > WD (&TF, M.earlyTermThreshold ());
-                
-                WD.pseudo_minpoly (phi, rk);
-                commentator.report(Commentator::LEVEL_ALWAYS,INTERNAL_DESCRIPTION) << "Butterfly pseudo Minpoly degree: " << res << std::endl;
-                commentator.start ("Monte Carlo certification", "trace");
-                if (phi.size() >= 2) F.neg(p2, phi[ phi.size()-2]);
-                
-                trace(t, PAP);
-
-                tryagain = (! F.areEqual( t, p2 ));
-                if (res > rk) 
-                    tryagain = true;
-                else
-                    res = rk;
-                ++nbperm;
-            }
-            
-                // F.write( F.write( commentator.report(Commentator::LEVEL_ALWAYS,INTERNAL_DESCRIPTION)
-                //              << "end trace: ", t) << ", p2: ", p2) << std::endl;
-            
-            commentator.report(Commentator::LEVEL_ALWAYS,INTERNAL_DESCRIPTION) << "butterflies : " << nbperm << std::endl;
-
-            commentator.stop ("success", NULL, "trace");
-            commentator.stop ("done", NULL, "srank");
-            
-            return res;
-        } else {
-                
-            commentator.start ("Rank", "wrank");
-
-            std::vector<typename Field::Element> d1, d2;
-            size_t i;
-                
-            VectorWrapper::ensureDim (d1, A.coldim ());
-            VectorWrapper::ensureDim (d2, A.rowdim ());
-                
-            for (i = 0; i < A.coldim (); i++)
-                do iter.random (d1[i]); while (F.isZero (d1[i]));
-                
-            for (i = 0; i < A.rowdim (); i++)
-                do iter.random (d2[i]); while (F.isZero (d2[i]));
-                
-            Diagonal<Field> D1 (F, d1), D2 (F, d2);
-            Transpose<Blackbox> AT (&A);
-                
-            Compose<Diagonal<Field>,Transpose<Blackbox> > B1 (&D1, &AT);
-            Compose<Compose<Diagonal<Field>,Transpose<Blackbox> >, Diagonal<Field> > B2 (&B1, &D2);
-            Compose<Compose<Compose<Diagonal<Field>,Transpose<Blackbox> >, Diagonal<Field> >, Blackbox> B3 (&B2, &A);
-                // Here there is an extra diagonal computation
-                // The probability of success is also divided by two, as 
-                // D2^2 contains only squares and squares are half the total elements                
-            typedef Compose<Compose<Compose<Compose<Diagonal<Field>,Transpose<Blackbox> >, Diagonal<Field> >, Blackbox>, Diagonal<Field> > Blackbox1;
-            Blackbox1 B (&B3, &D1);
-
-            BlackboxContainerSymmetric<Field, Blackbox1> TF (&B, F, iter);
-            MasseyDomain<Field, BlackboxContainerSymmetric<Field, Blackbox1> > WD (&TF, M.earlyTermThreshold ());
-                
-            std::vector<typename Field::Element> phi;
-            WD.pseudo_minpoly (phi, res);
-            commentator.report(Commentator::LEVEL_ALWAYS,INTERNAL_DESCRIPTION) << "Pseudo Minpoly degree: " << res << std::endl;
-            commentator.start ("Monte Carlo certification", "trace");
-
-            typename Field::Element t, p2; F.init(p2, 0UL);
-            trace(t, B);            
-            if (phi.size() >= 2) F.neg(p2, phi[ phi.size()-2]);
-                
-            int nbperm = 0; unsigned long rk;
-            int logn = 2*(unsigned long)floor( log( (double)A.rowdim() ) );
-            bool tryagain = (! F.areEqual( t, p2 ));
-            while( tryagain ) {
-                commentator.stop ("fail", NULL, "trace");
-                Permutation<Field> P(A.rowdim(), F);          
-                for (i = 0; i < A.rowdim (); ++i)
-                    P.permute( rand() % A.rowdim() , rand() % A.rowdim() );
-                for (i = 0; i < A.rowdim (); ++i)
-                    P.permute( rand() % A.rowdim() , rand() % A.rowdim() );
-
-                typedef Compose< Permutation<Field>, Blackbox > BlackboxP;
-                BlackboxP BP(&P, &A);
-
-                for (i = 0; i < A.coldim (); i++)
-                    do iter.random (d1[i]); while (F.isZero (d1[i]));
-                
-                for (i = 0; i < A.rowdim (); i++)
-                    do iter.random (d2[i]); while (F.isZero (d2[i]));
-                
-                Diagonal<Field> D1 (F, d1), D2 (F, d2);
-                Transpose<BlackboxP> AT (&BP);
-                
-                Compose<Diagonal<Field>,Transpose<BlackboxP> > B1 (&D1, &AT);
-                Compose<Compose<Diagonal<Field>,Transpose<BlackboxP> >, Diagonal<Field> > B2 (&B1, &D2);
-                Compose<Compose<Compose<Diagonal<Field>,Transpose<BlackboxP> >, Diagonal<Field> >, BlackboxP> B3 (&B2, &BP);
-                typedef Compose<Compose<Compose<Compose<Diagonal<Field>,Transpose<BlackboxP> >, Diagonal<Field> >, BlackboxP>, Diagonal<Field> > Blackbox1;
-                Blackbox1 B (&B3, &D1);
-
-                BlackboxContainerSymmetric<Field, Blackbox1> TF (&B, F, iter);
-                MasseyDomain<Field, BlackboxContainerSymmetric<Field, Blackbox1> > MD (&TF, M.earlyTermThreshold ());
-                
-                MD.pseudo_minpoly (phi, rk);
-                commentator.report(Commentator::LEVEL_ALWAYS,INTERNAL_DESCRIPTION) << "Permuted pseudo Minpoly degree: " << rk << std::endl;
-                commentator.start ("Monte Carlo certification", "trace");
-                if (phi.size() >= 2) F.neg(p2, phi[ phi.size()-2]);
-                
-                trace(t, B);
-                tryagain = (! F.areEqual( t, p2 ));
-                if (res > rk) 
-                    tryagain = true;
-                else
-                    res = rk;
-                if( ++nbperm > logn) break;
-            }
-            commentator.report(Commentator::LEVEL_ALWAYS,INTERNAL_DESCRIPTION) << "permutations : " << nbperm << std::endl;
-            nbperm = 0;
-            while(tryagain) {
-                commentator.stop ("fail", NULL, "trace");
-                typename Field::RandIter r (F);
-                typename CekstvSwitch<Field>::Factory factory (r);
-                typedef Butterfly<Field, CekstvSwitch<Field> > ButterflyP;
-                ButterflyP P (F, A.rowdim(), factory);
-                
-                typedef Compose< ButterflyP, Blackbox > BlackboxP;
-                BlackboxP BP(&P, &A);
-
-                for (i = 0; i < A.coldim (); i++)
-                    do iter.random (d1[i]); while (F.isZero (d1[i]));
-                
-                for (i = 0; i < A.rowdim (); i++)
-                    do iter.random (d2[i]); while (F.isZero (d2[i]));
-                
-                Diagonal<Field> D1 (F, d1), D2 (F, d2);
-                Transpose<BlackboxP> AT (&BP);
-                
-                Compose<Diagonal<Field>,Transpose<BlackboxP> > B1 (&D1, &AT);
-                Compose<Compose<Diagonal<Field>,Transpose<BlackboxP> >, Diagonal<Field> > B2 (&B1, &D2);
-                Compose<Compose<Compose<Diagonal<Field>,Transpose<BlackboxP> >, Diagonal<Field> >, BlackboxP> B3 (&B2, &BP);
-                typedef Compose<Compose<Compose<Compose<Diagonal<Field>,Transpose<BlackboxP> >, Diagonal<Field> >, BlackboxP>, Diagonal<Field> > Blackbox1;
-                Blackbox1 B (&B3, &D1);
-
-                BlackboxContainerSymmetric<Field, Blackbox1> TF (&B, F, iter);
-                MasseyDomain<Field, BlackboxContainerSymmetric<Field, Blackbox1> > MD (&TF, M.earlyTermThreshold ());
-                
-                MD.pseudo_minpoly (phi, rk);
-                commentator.report(Commentator::LEVEL_ALWAYS,INTERNAL_DESCRIPTION) << "Butterfly pseudo Minpoly degree: " << rk << std::endl;
-                commentator.start ("Monte Carlo certification", "trace");
-                if (phi.size() >= 2) F.neg(p2, phi[ phi.size()-2]);
-                
-                trace(t, B);
-                tryagain = (! F.areEqual( t, p2 ));
-                if (res > rk) 
-                    tryagain = true;
-                else
-                    res = rk;
-                ++nbperm;
-            }
-            commentator.report(Commentator::LEVEL_ALWAYS,INTERNAL_DESCRIPTION) << "butterflies : " << nbperm << std::endl;
-            commentator.stop ("success", NULL, "trace");
-            commentator.stop ("done", NULL, "wrank");
-            
-            return res;
-        }
-
-    }
+	template <class Blackbox>
+	inline unsigned long &rank (unsigned long                     &res,
+				    const Blackbox                    &A,
+				    const RingCategories::ModularTag  &tag,
+				    const Method::Wiedemann           &M)
+	// This is too much for solutions.  It belongs in algorithms
+	{
+
+		typedef typename Blackbox::Field Field;
+		const Field F = A.field();
+		typename Field::RandIter iter (F);
+
+		if (M.symmetric()) {
+			commentator.start ("Symmetric Rank", "srank");
+
+
+			std::vector<typename Field::Element> d1;
+			size_t i;
+
+			VectorWrapper::ensureDim (d1, A.coldim ());
+
+			for (i = 0; i < A.coldim (); i++)
+				do iter.random (d1[i]); while (F.isZero (d1[i]));
+
+
+			Diagonal<Field> D1 (F, d1);
+
+
+			Compose<Diagonal<Field>,Blackbox > B1 (&D1, &A);
+			typedef Compose<Compose<Diagonal<Field>,Blackbox >, Diagonal<Field> > BlackBox1;
+			BlackBox1 B (&B1, &D1);
+
+			BlackboxContainerSymmetric<Field, BlackBox1> TF (&B, F, iter);
+			MasseyDomain<Field, BlackboxContainerSymmetric<Field, BlackBox1> > WD (&TF, M.earlyTermThreshold ());
+			std::vector<typename Field::Element> phi;
+			WD.pseudo_minpoly (phi, res);
+			commentator.report(Commentator::LEVEL_ALWAYS,INTERNAL_DESCRIPTION) << "Pseudo Minpoly degree: " << res << std::endl;
+
+			commentator.start ("Monte Carlo certification (1)", "trace");
+			typename Field::Element t, p2; F.init(p2, 0UL);
+			trace(t, B);
+			if (phi.size() >= 2) F.neg(p2, phi[ phi.size()-2]);
+
+			int nbperm = 0; unsigned long rk;
+			int logn = 2*(unsigned long)floor( log( (double)A.rowdim() ) );
+			bool tryagain = (! F.areEqual( t, p2 ));
+			while( tryagain ) {
+				commentator.stop ("fail", NULL, "trace");
+#if 0
+
+				Permutation<Field> P(A.rowdim(), F);
+				for (i = 0; i < A.rowdim (); ++i)
+					P.permute( rand() % A.rowdim() , rand() % A.rowdim() );
+				for (i = 0; i < A.rowdim (); ++i)
+					P.permute( rand() % A.rowdim() , rand() % A.rowdim() );
+
+				Transpose< Permutation<Field> > TP(&P);
+				typedef Compose< Permutation<Field>, Blackbox > BlackboxP;
+				typedef Compose< Compose< Permutation<Field>, Blackbox >, Transpose< Permutation<Field> > > BlackboxPAP;
+				BlackboxP PA(&P, &A);
+				BlackboxPAP BP( &PA , &TP );
+
+				for (i = 0; i < A.coldim (); i++)
+					do iter.random (d1[i]); while (F.isZero (d1[i]));
+				Diagonal<Field> D1 (F, d1);
+				Compose<Diagonal<Field>,BlackboxPAP > B1 (&D1, &BP);
+				typedef Compose<Compose<Diagonal<Field>,BlackboxPAP >, Diagonal<Field> > BlackBox2;
+				BlackBox2 B (&B1, &D1);
+#endif
+
+				for (i = 0; i < A.coldim (); i++)
+					do iter.random (d1[i]); while (F.isZero (d1[i]));
+				Diagonal<Field> D1 (F, d1);
+				Compose<Diagonal<Field>,Blackbox > B1 (&D1, &A);
+				BlackBox1 B (&B1, &D1);
+
+				BlackboxContainerSymmetric<Field, BlackBox1> TF (&B, F, iter);
+				MasseyDomain<Field, BlackboxContainerSymmetric<Field, BlackBox1> > WD (&TF, M.earlyTermThreshold ());
+
+				WD.pseudo_minpoly (phi, rk);
+				commentator.report(Commentator::LEVEL_ALWAYS,INTERNAL_DESCRIPTION) << "Permuted pseudo Minpoly degree: " << res << std::endl;
+				commentator.start ("Monte Carlo certification (2)", "trace");
+				if (phi.size() >= 2) F.neg(p2, phi[ phi.size()-2]);
+
+				trace(t, B);
+
+				tryagain = (! F.areEqual( t, p2 ));
+				if (res > rk)
+					tryagain = true;
+				else
+					res = rk;
+				if( ++nbperm > logn) break;
+			}
+			commentator.report(Commentator::LEVEL_ALWAYS,INTERNAL_DESCRIPTION) << "symm permutations : " << nbperm << std::endl;
+			nbperm = 0;
+			while(tryagain) {
+				commentator.stop ("fail", NULL, "trace");
+				//             F.write( F.write( commentator.report(Commentator::LEVEL_ALWAYS,INTERNAL_DESCRIPTION)
+				//                               << "end trace: ", t) << ", p2: ", p2) << std::endl;
+				typename Field::RandIter r (F);
+				typename CekstvSwitch<Field>::Factory factory (r);
+				typedef Butterfly<Field, CekstvSwitch<Field> > ButterflyP;
+				ButterflyP P (F, A.rowdim(), factory);
+				for (i = 0; i < A.coldim (); i++)
+					do iter.random (d1[i]); while (F.isZero (d1[i]));
+				Diagonal<Field> D1 (F, d1);
+				typedef Compose< ButterflyP, Diagonal<Field> > ButD;
+				ButD PD(&P, &D1);
+
+				Transpose< ButD > TP (&PD);
+
+				Compose< ButD, Blackbox > B1( &PD, &A);
+
+				typedef Compose< Compose< ButD, Blackbox > , Transpose< ButD > > BlackBoxBAB;
+				BlackBoxBAB PAP(&B1, &TP);
+
+				BlackboxContainerSymmetric<Field, BlackBoxBAB> TF (&PAP, F, iter);
+				MasseyDomain<Field, BlackboxContainerSymmetric<Field, BlackBoxBAB> > WD (&TF, M.earlyTermThreshold ());
+
+				WD.pseudo_minpoly (phi, rk);
+				commentator.report(Commentator::LEVEL_ALWAYS,INTERNAL_DESCRIPTION) << "Butterfly pseudo Minpoly degree: " << res << std::endl;
+				commentator.start ("Monte Carlo certification (3)", "trace");
+				if (phi.size() >= 2) F.neg(p2, phi[ phi.size()-2]);
+
+				trace(t, PAP);
+
+				tryagain = (! F.areEqual( t, p2 ));
+				if (res > rk)
+					tryagain = true;
+				else
+					res = rk;
+				++nbperm;
+			}
+
+			// F.write( F.write( commentator.report(Commentator::LEVEL_ALWAYS,INTERNAL_DESCRIPTION)
+			//              << "end trace: ", t) << ", p2: ", p2) << std::endl;
+
+			commentator.report(Commentator::LEVEL_ALWAYS,INTERNAL_DESCRIPTION) << "butterflies : " << nbperm << std::endl;
+
+			commentator.stop ("success", NULL, "trace");
+			commentator.stop ("done", NULL, "srank");
+
+			return res;
+		}
+		else {
+
+			commentator.start ("Rank", "wrank");
+
+			std::vector<typename Field::Element> d1, d2;
+			size_t i;
+
+			VectorWrapper::ensureDim (d1, A.coldim ());
+			VectorWrapper::ensureDim (d2, A.rowdim ());
+
+			for (i = 0; i < A.coldim (); i++)
+				do iter.random (d1[i]); while (F.isZero (d1[i]));
+
+			for (i = 0; i < A.rowdim (); i++)
+				do iter.random (d2[i]); while (F.isZero (d2[i]));
+
+			Diagonal<Field> D1 (F, d1), D2 (F, d2);
+			Transpose<Blackbox> AT (&A);
+
+			Compose<Diagonal<Field>,Transpose<Blackbox> > B1 (&D1, &AT);
+			Compose<Compose<Diagonal<Field>,Transpose<Blackbox> >, Diagonal<Field> > B2 (&B1, &D2);
+			Compose<Compose<Compose<Diagonal<Field>,Transpose<Blackbox> >, Diagonal<Field> >, Blackbox> B3 (&B2, &A);
+			// Here there is an extra diagonal computation
+			// The probability of success is also divided by two, as
+			// D2^2 contains only squares and squares are half the total elements
+			typedef Compose<Compose<Compose<Compose<Diagonal<Field>,Transpose<Blackbox> >, Diagonal<Field> >, Blackbox>, Diagonal<Field> > Blackbox1;
+			Blackbox1 B (&B3, &D1);
+
+			BlackboxContainerSymmetric<Field, Blackbox1> TF (&B, F, iter);
+			MasseyDomain<Field, BlackboxContainerSymmetric<Field, Blackbox1> > WD (&TF, M.earlyTermThreshold ());
+
+			std::vector<typename Field::Element> phi;
+			WD.pseudo_minpoly (phi, res);
+			commentator.report(Commentator::LEVEL_ALWAYS,INTERNAL_DESCRIPTION) << "Pseudo Minpoly degree: " << res << std::endl;
+			commentator.start ("Monte Carlo certification (4)", "trace");
+
+			typename Field::Element t, p2; F.init(p2, 0UL);
+			//             trace(t, B);
+			WhisartTraceTranspose(t, F, D1, A, D2);
+			if (phi.size() >= 2) F.neg(p2, phi[ phi.size()-2]);
+
+			int nbperm = 0; unsigned long rk;
+			int logn = 2*(unsigned long)floor( log( (double)A.rowdim() ) );
+			bool tryagain = (! F.areEqual( t, p2 ));
+			while( tryagain ) {
+				commentator.stop ("fail", NULL, "trace");
+				Permutation<Field> P(A.rowdim(), F);
+				for (i = 0; i < A.rowdim (); ++i)
+					P.permute( rand() % A.rowdim() , rand() % A.rowdim() );
+				for (i = 0; i < A.rowdim (); ++i)
+					P.permute( rand() % A.rowdim() , rand() % A.rowdim() );
+
+				typedef Compose< Permutation<Field>, Blackbox > BlackboxP;
+				BlackboxP BP(&P, &A);
+
+				for (i = 0; i < A.coldim (); i++)
+					do iter.random (d1[i]); while (F.isZero (d1[i]));
+
+				for (i = 0; i < A.rowdim (); i++)
+					do iter.random (d2[i]); while (F.isZero (d2[i]));
+
+				Diagonal<Field> D1 (F, d1), D2 (F, d2);
+				Transpose<BlackboxP> AT (&BP);
+
+				Compose<Diagonal<Field>,Transpose<BlackboxP> > B1 (&D1, &AT);
+				Compose<Compose<Diagonal<Field>,Transpose<BlackboxP> >, Diagonal<Field> > B2 (&B1, &D2);
+				Compose<Compose<Compose<Diagonal<Field>,Transpose<BlackboxP> >, Diagonal<Field> >, BlackboxP> B3 (&B2, &BP);
+				typedef Compose<Compose<Compose<Compose<Diagonal<Field>,Transpose<BlackboxP> >, Diagonal<Field> >, BlackboxP>, Diagonal<Field> > Blackbox1;
+				Blackbox1 B (&B3, &D1);
+
+				BlackboxContainerSymmetric<Field, Blackbox1> TF (&B, F, iter);
+				MasseyDomain<Field, BlackboxContainerSymmetric<Field, Blackbox1> > MD (&TF, M.earlyTermThreshold ());
+
+				MD.pseudo_minpoly (phi, rk);
+				commentator.report(Commentator::LEVEL_ALWAYS,INTERNAL_DESCRIPTION) << "Permuted pseudo Minpoly degree: " << rk << std::endl;
+				commentator.start ("Monte Carlo certification (5)", "trace");
+				if (phi.size() >= 2) F.neg(p2, phi[ phi.size()-2]);
+
+				//                 trace(t, B);
+				WhisartTraceTranspose(t, F, D1, BP, D2);
+				tryagain = (! F.areEqual( t, p2 ));
+				if (res > rk)
+					tryagain = true;
+				else
+					res = rk;
+				if( ++nbperm > logn) break;
+			}
+			commentator.report(Commentator::LEVEL_ALWAYS,INTERNAL_DESCRIPTION) << "permutations : " << nbperm << std::endl;
+			nbperm = 0;
+			while(tryagain) {
+				commentator.stop ("fail", NULL, "trace");
+				typename Field::RandIter r (F);
+				typename CekstvSwitch<Field>::Factory factory (r);
+				typedef Butterfly<Field, CekstvSwitch<Field> > ButterflyP;
+				ButterflyP P (F, A.rowdim(), factory);
+
+				typedef Compose< ButterflyP, Blackbox > BlackboxP;
+				BlackboxP BP(&P, &A);
+
+				for (i = 0; i < A.coldim (); i++)
+					do iter.random (d1[i]); while (F.isZero (d1[i]));
+
+				for (i = 0; i < A.rowdim (); i++)
+					do iter.random (d2[i]); while (F.isZero (d2[i]));
+
+				Diagonal<Field> D1 (F, d1), D2 (F, d2);
+				Transpose<BlackboxP> AT (&BP);
+
+				Compose<Diagonal<Field>,Transpose<BlackboxP> > B1 (&D1, &AT);
+				Compose<Compose<Diagonal<Field>,Transpose<BlackboxP> >, Diagonal<Field> > B2 (&B1, &D2);
+				Compose<Compose<Compose<Diagonal<Field>,Transpose<BlackboxP> >, Diagonal<Field> >, BlackboxP> B3 (&B2, &BP);
+				typedef Compose<Compose<Compose<Compose<Diagonal<Field>,Transpose<BlackboxP> >, Diagonal<Field> >, BlackboxP>, Diagonal<Field> > Blackbox1;
+				Blackbox1 B (&B3, &D1);
+
+				BlackboxContainerSymmetric<Field, Blackbox1> TF (&B, F, iter);
+				MasseyDomain<Field, BlackboxContainerSymmetric<Field, Blackbox1> > MD (&TF, M.earlyTermThreshold ());
+
+				MD.pseudo_minpoly (phi, rk);
+				commentator.report(Commentator::LEVEL_ALWAYS,INTERNAL_DESCRIPTION) << "Butterfly pseudo Minpoly degree: " << rk << std::endl;
+				commentator.start ("Monte Carlo certification (6)", "trace");
+				if (phi.size() >= 2) F.neg(p2, phi[ phi.size()-2]);
+
+				//                 trace(t, B);
+				WhisartTraceTranspose(t, F, D1, BP, D2);
+				tryagain = (! F.areEqual( t, p2 ));
+				if (res > rk)
+					tryagain = true;
+				else
+					res = rk;
+				++nbperm;
+			}
+			commentator.report(Commentator::LEVEL_ALWAYS,INTERNAL_DESCRIPTION) << "butterflies : " << nbperm << std::endl;
+			commentator.stop ("success", NULL, "trace");
+			commentator.stop ("done", NULL, "wrank");
+
+			return res;
+		}
+
+	}
 
 	/// M may be <code>Method::SparseElimination()</code>.
-    template <class Field>
-    unsigned long &rank (unsigned long                       &r,
-                         const SparseMatrix<Field, typename LinBox::Vector<Field>::SparseSeq>  &A,
-                         const RingCategories::ModularTag    &tag,
-                         const Method::SparseElimination     &M) 
-    {
-         // We make a copy as these data will be destroyed
-        SparseMatrix<Field, typename LinBox::Vector<Field>::SparseSeq> A1 (A);  
-        return rankin(r, A1, tag, M);
-    }
-    
-    template <class Field, class Method>
-    unsigned long &rankin (unsigned long                   &r,
-                           SparseMatrix<Field, typename LinBox::Vector<Field>::SparseSeq>  &A,
-                         const Method    &M)
-    {  return rankin(r, A, typename FieldTraits<Field>::categoryTag(), M); 
-    }
-
-
-   template <class Blackbox, class Ring>
-    unsigned long &rankin (unsigned long                     &r,
-                           Blackbox &A,
-                           const RingCategories::IntegerTag    &tag,
-                           const Method::SparseElimination     &M)
-    {
-        commentator.start ("Integer Rank", "irank");
-        typedef Modular<double> Field;
-        integer mmodulus; 
-        FieldTraits<Field>::maxModulus(mmodulus);
-        RandomPrimeIterator genprime( (long) floor (log((double)mmodulus) ) );
-        ++genprime;
-        typedef typename Blackbox::template rebind< Field >::other FBlackbox;
-        FBlackbox * Ap;
-        MatrixHom::map(Ap, A, Field(*genprime) );
-        commentator.report (Commentator::LEVEL_ALWAYS,INTERNAL_WARNING) << "Integer Rank is done modulo " << mmodulus << std::endl;
-        rankin(r, *Ap, RingCategories::ModularTag(), M);
-        delete Ap;
-        commentator.stop ("done", NULL, "irank");
-        return r;
-    }
-    
-    template <class Field>
-    unsigned long &rankin (unsigned long                       &r,
-                           SparseMatrix<Field, typename LinBox::Vector<Field>::SparseSeq>  &A,
-                           const RingCategories::ModularTag    &tag,
-                           const Method::SparseElimination     &M) 
-    {
-        commentator.start ("Sparse Elimination Rank", "serank");
-        GaussDomain<Field> GD ( A.field() );
-        GD.rankin (r, A, M.strategy ());
-        commentator.stop ("done", NULL, "serank");
-        return r;
-    }
+	template <class Field>
+	inline unsigned long &rank (unsigned long                       &r,
+				    const SparseMatrix<Field, typename LinBox::Vector<Field>::SparseSeq>  &A,
+				    const RingCategories::ModularTag    &tag,
+				    const Method::SparseElimination     &M)
+	{
+		// We make a copy as these data will be destroyed
+		SparseMatrix<Field, typename LinBox::Vector<Field>::SparseSeq> A1 (A);
+		return rankin(r, A1, tag, M);
+	}
+
+	template <class Field, class Method>
+	inline unsigned long &rankin (unsigned long                   &r,
+				      SparseMatrix<Field, typename LinBox::Vector<Field>::SparseSeq>  &A,
+				      const Method                    &M)
+	{
+		return rankin(r, A, typename FieldTraits<Field>::categoryTag(), M);
+	}
+
+
+	template <class Blackbox, class Ring>
+	inline unsigned long &rankin (unsigned long                       &r,
+				      Blackbox                            &A,
+				      const RingCategories::IntegerTag    &tag,
+				      const Method::SparseElimination     &M)
+	{
+		commentator.start ("Integer Rank inplace", "irank");
+		typedef Modular<double> Field;
+		integer mmodulus;
+		FieldTraits<Field>::maxModulus(mmodulus);
+		RandomPrimeIterator genprime( (long) floor (log((double)mmodulus) ) );
+		++genprime;
+		typedef typename Blackbox::template rebind< Field >::other FBlackbox;
+		Field Fp(*genprime);
+		FBlackbox Ap(A, Fp);
+		commentator.report (Commentator::LEVEL_ALWAYS,INTERNAL_WARNING) << "Integer Rank is done modulo " << *genprime << std::endl;
+		rankin(r, Ap, RingCategories::ModularTag(), M);
+		commentator.stop ("done", NULL, "irank");
+		return r;
+	}
+
+	template <class Field>
+	inline unsigned long &rankin (unsigned long                       &r,
+				      SparseMatrix<Field, typename LinBox::Vector<Field>::SparseSeq>  &A,
+				      const RingCategories::ModularTag    &tag,
+				      const Method::SparseElimination     &M)
+	{
+		commentator.start ("Sparse Elimination Rank", "serank");
+		GaussDomain<Field> GD ( A.field() );
+		GD.rankin (r, A, M.strategy ());
+		commentator.stop ("done", NULL, "serank");
+		return r;
+	}
+
+	/// specialization to \f$ \mathbf{F}_2 \f$
+	inline unsigned long &rankin (unsigned long                       &r,
+				      GaussDomain<GF2>::Matrix            &A,
+				      const Method::SparseElimination     &)//M
+	{
+		commentator.start ("Sparse Elimination Rank over GF2", "serankmod2");
+		GaussDomain<GF2> GD ( A.field() );
+		GD.rankin (r, A, Specifier::PIVOT_LINEAR);
+		commentator.stop ("done", NULL, "serankmod2");
+		return r;
+	}
+
+	/// specialization to \f$ \mathbf{F}_2 \f$
+	inline unsigned long &rankin (unsigned long                       &r,
+				      GaussDomain<GF2>::Matrix            &A,
+				      const RingCategories::ModularTag    &,//tag
+				      const Method::SparseElimination     &M)
+	{
+		return rankin(r, A, M);
+	}
 
 	// Change of representation to be able to call the sparse elimination
-    template <class Blackbox>
-    unsigned long &rank (unsigned long                       &r,
-                         const Blackbox  &A,
-                         const RingCategories::ModularTag    &tag,
-                         const Method::SparseElimination     &M) 
-    {
-        typedef typename Blackbox::Field Field;
-        typedef SparseMatrix<Field, typename LinBox::Vector<Field>::SparseSeq> SparseBB;
-        SparseBB * SpA;
-	MatrixHom::map(SpA, A, A.field());
-        rankin(r, *SpA, tag, M);
-        delete SpA;
-        return r;
-    }
-    
+	template <class Blackbox>
+	inline unsigned long &rank (unsigned long                       &r,
+				    const Blackbox                      &A,
+				    const RingCategories::ModularTag    &tag,
+				    const Method::SparseElimination     &M)
+	{
+		typedef typename Blackbox::Field Field;
+		typedef SparseMatrix<Field, typename LinBox::Vector<Field>::SparseSeq> SparseBB;
+		SparseBB SpA(A.field(), A.rowdim(), A.coldim() );
+		MatrixHom::map(SpA, A, A.field());
+		return rankin(r, SpA, tag, M);
+	}
+
 	// M may be <code>Method::BlasElimination()</code>.
-    template <class Blackbox>
-    unsigned long &rank (unsigned long                     &r,
-                         const Blackbox                      &A,
-                         const RingCategories::ModularTag          &tag,
-                         const Method::BlasElimination  &M) 
-    {
-        
-        commentator.start ("Blas Rank", "blasrank");
-        typedef typename Blackbox::Field Field;
-        const Field F = A.field();
-        integer a, b; F.characteristic(a); F.cardinality(b);
-        linbox_check( a == b );
-        linbox_check( a < LinBox::BlasBound);
-        BlasMatrix<typename Field::Element> B(A);
-	BlasMatrixDomain<Field> D(F);
-        r = D.rank(B);
-	commentator.stop ("done", NULL, "blasrank");
-        return r;
-    }
-
-
-// is this used?
+	template <class Blackbox>
+	inline unsigned long &rank (unsigned long                      &r,
+				    const Blackbox                     &A,
+				    const RingCategories::ModularTag   &tag,
+				    const Method::BlasElimination      &M)
+	{
+
+		commentator.start ("Blas Rank", "blasrank");
+		typedef typename Blackbox::Field Field;
+		const Field F = A.field();
+		integer a, b; F.characteristic(a); F.cardinality(b);
+		linbox_check( a == b );
+		linbox_check( a < LinBox::BlasBound);
+		BlasMatrix<typename Field::Element> B(A);
+		BlasMatrixDomain<Field> D(F);
+		r = D.rank(B);
+		commentator.stop ("done", NULL, "blasrank");
+		return r;
+	}
+
+
+	// is this used?
 	// A is modified.
-    template <class Matrix>
-    unsigned long &rankin (unsigned long                      &r,
-                           Matrix                               &A,
-                           const RingCategories::ModularTag          &tag,
-                           const Method::SparseElimination &M) 
-    {
-        typedef typename Matrix::Field Field;
-        const Field F = A.field();
-        GaussDomain<Field> GD (F);
-        GD.rankin( r, A, M.strategy ());
-        return r;
-    }
+	template <class Matrix>
+	inline unsigned long &rankin (unsigned long                      &r,
+				      Matrix                             &A,
+				      const RingCategories::ModularTag   &tag,
+				      const Method::SparseElimination    &M)
+	{
+		typedef typename Matrix::Field Field;
+		const Field F = A.field();
+		GaussDomain<Field> GD (F);
+		GD.rankin( r, A, M.strategy ());
+		return r;
+	}
 
 	/// A is modified.
-    template <class Field>
-    unsigned long &rankin (unsigned long                     &r,
-                           BlasBlackbox<Field>                 &A,
-                           const RingCategories::ModularTag          &tag,
-                           const Method::BlasElimination  &M) 
-    {
-
-        commentator.start ("BlasBB Rank", "blasbbrank");
-        const Field F = A.field();
-        BlasMatrixDomain<Field> D(F);
-        r = D.rankin(static_cast< BlasMatrix<typename Field::Element>& >(A));
-        commentator.stop ("done", NULL, "blasbbrank");
-        return r;
-    }
-
-    template <class Blackbox, class MyMethod>
-    unsigned long &rank (unsigned long                     &r,
-                         const Blackbox                      &A,
-                         const RingCategories::IntegerTag          &tag,
-                         const MyMethod                           &M)
-    {
-        commentator.start ("Integer Rank", "iirank");
-        typedef Modular<double> Field;
-        integer mmodulus; 
-        FieldTraits<Field>::maxModulus(mmodulus);
-        RandomPrimeIterator genprime( (long) floor (log((double)mmodulus) ) );
-        ++genprime;
-        typedef typename Blackbox::template rebind< Field >::other FBlackbox;
-        FBlackbox * Ap;
-        MatrixHom::map(Ap, A, Field(*genprime) );
-        commentator.report (Commentator::LEVEL_ALWAYS,INTERNAL_WARNING) << "Integer Rank is done modulo " << mmodulus << std::endl;
-        rank(r, *Ap, RingCategories::ModularTag(), M);
-        delete Ap;
-        commentator.stop ("done", NULL, "iirank");
-        return r;
-    }
+	template <class Field>
+	inline unsigned long &rankin (unsigned long                     &r,
+				      BlasBlackbox<Field>               &A,
+				      const RingCategories::ModularTag  &tag,
+				      const Method::BlasElimination     &M)
+	{
+
+		commentator.start ("BlasBB Rank", "blasbbrank");
+		const Field F = A.field();
+		BlasMatrixDomain<Field> D(F);
+		r = D.rankin(static_cast< BlasMatrix<typename Field::Element>& >(A));
+		commentator.stop ("done", NULL, "blasbbrank");
+		return r;
+	}
+
+	template <class Blackbox, class MyMethod>
+	inline unsigned long &rank (unsigned long                     &r,
+				    const Blackbox                    &A,
+				    const RingCategories::IntegerTag  &tag,
+				    const MyMethod                    &M)
+	{
+		commentator.start ("Integer Rank", "iirank");
+		typedef Modular<double> Field;
+		integer mmodulus;
+		FieldTraits<Field>::maxModulus(mmodulus);
+		RandomPrimeIterator genprime( (long) floor (log((double)mmodulus) ) );
+		++genprime;
+		typedef typename Blackbox::template rebind< Field >::other FBlackbox;
+		Field Fp(*genprime);
+		FBlackbox Ap(A, Fp );
+		commentator.report (Commentator::LEVEL_ALWAYS,INTERNAL_DESCRIPTION) << "Integer Rank is done modulo " << *genprime << std::endl;
+
+		rank(r, Ap, RingCategories::ModularTag(), M);
+		commentator.stop ("done", NULL, "iirank");
+		return r;
+	}
 } // LinBox
 
 
 #ifdef __LINBOX_HAVE_GIVARO
-#define LINBOX_EXTENSION_DEGREE_MAX 20
+#ifndef LINBOX_EXTENSION_DEGREE_MAX
+#define LINBOX_EXTENSION_DEGREE_MAX 19
+#endif
 
 #include "linbox/field/givaro-extension.h"
-namespace LinBox {
-    template <class Blackbox>
-    unsigned long &rank (unsigned long                   &r,
-                         const Blackbox                  &A,
-                         const  RingCategories::ModularTag                   &tag,
-                         const Method::Blackbox& m)
-    {  
-        commentator.start ("BB Rank", "extend");
-        if (m.certificate()) {
-            typedef typename Blackbox::Field Field;
-            const Field& F = A.field();
-            integer a,c; F.cardinality(a); F.characteristic(c);
-            if (a != c) {
-                unsigned long extend = (unsigned long)FF_EXPONENT_MAX(a,(integer)LINBOX_EXTENSION_DEGREE_MAX);
-                if (extend > 1) {
-                    commentator.report (Commentator::LEVEL_ALWAYS,INTERNAL_WARNING) << "Extension of degree " << extend << std::endl;
-                    GivaroExtension<Field> EF( F, extend);
-                    typedef typename Blackbox::template rebind< GivaroExtension<Field>  >::other FBlackbox;
-                    FBlackbox * Ap;
-                    MatrixHom::map(Ap, A, EF );
-                    rank(r, *Ap, tag, Method::Wiedemann(m));
-                }
-            } else {
-                unsigned long extend = (unsigned long)FF_EXPONENT_MAX(c,(integer)LINBOX_EXTENSION_DEGREE_MAX);
-                if (extend > 1) {
-                    commentator.report (Commentator::LEVEL_ALWAYS,INTERNAL_WARNING) << "Word size extension : " << extend << std::endl;
-                    GivaroGfq EF( (unsigned long)c, extend);                    
-                    typedef typename Blackbox::template rebind< GivaroGfq >::other FBlackbox;
-                    FBlackbox * Ap;
-                    MatrixHom::map(Ap, A, EF );
-                    rank(r, *Ap, tag, Method::Wiedemann(m));
-                }
-            }
-        } else
-            rank(r, A, tag, Method::Wiedemann(m)); 
-        commentator.stop ("done", NULL, "extend");
-        return r; 
-    }
+namespace LinBox
+{
+	template <class Blackbox>
+	inline unsigned long &rank (unsigned long                     &r,
+				    const Blackbox                    &A,
+				    const RingCategories::ModularTag  &tag,
+				    const Method::Blackbox            & m)
+	{
+		commentator.start ("BB Rank", "extend");
+		if (m.certificate()) {
+			typedef typename Blackbox::Field Field;
+			const Field& F = A.field();
+			integer a,c; F.cardinality(a); F.characteristic(c);
+			if (a != c) {
+				unsigned long extend = (unsigned long)FF_EXPONENT_MAX(a,(integer)LINBOX_EXTENSION_DEGREE_MAX);
+				if (extend > 1) {
+					commentator.report (Commentator::LEVEL_ALWAYS,INTERNAL_WARNING) << "Extension of degree " << extend << std::endl;
+					GivaroExtension<Field> EF( F, extend);
+					typedef typename Blackbox::template rebind< GivaroExtension<Field>  >::other FBlackbox;
+					FBlackbox Ap(A, EF);
+					rank(r, Ap, tag, Method::Wiedemann(m));
+				}
+				else
+					rank(r, A, tag, Method::Wiedemann(m));
+			}
+			else {
+				unsigned long extend = (unsigned long)FF_EXPONENT_MAX(c,(integer)LINBOX_EXTENSION_DEGREE_MAX);
+				if (extend > 1) {
+					commentator.report (Commentator::LEVEL_ALWAYS,INTERNAL_WARNING) << "Word size extension : " << extend << std::endl;
+					GivaroGfq EF( (unsigned long)c, extend);
+					typedef typename Blackbox::template rebind< GivaroGfq >::other FBlackbox;
+					FBlackbox Ap(A, EF);
+					rank(r, Ap, tag, Method::Wiedemann(m));
+				}
+				else
+					rank(r, A, tag, Method::Wiedemann(m));
+			}
+		}
+		else
+			rank(r, A, tag, Method::Wiedemann(m));
+		commentator.stop ("done", NULL, "extend");
+		return r;
+	}
 }
 #else
-namespace LinBox {
-    template <class Blackbox>
-    unsigned long &rank (unsigned long                   &r,
-                         const Blackbox                  &A,
-                         const  RingCategories::ModularTag                   &tag,
-                         const Method::Blackbox& m)
-    {  
-            return rank(r, A, tag, Method::Wiedemann(m)); 
-    }
+namespace LinBox
+{
+	template <class Blackbox>
+	inline unsigned long &rank (unsigned long                      &r,
+				    const Blackbox                     &A,
+				    const  RingCategories::ModularTag  &tag,
+				    const Method::Blackbox             & m)
+	{
+		return rank(r, A, tag, Method::Wiedemann(m));
+	}
 }
 #endif
 
 
 
-#endif // __RANK_H
+#endif // __LINBOX_rank_H
+
diff --git a/linbox/solutions/reducedforms.doxy b/linbox/solutions/reducedforms.doxy
new file mode 100644
index 0000000..4a7ee73
--- /dev/null
+++ b/linbox/solutions/reducedforms.doxy
@@ -0,0 +1,17 @@
+// Copyright (C) 2010 LinBox, GNU LGPL, see COPYING for licence information
+
+/** @ingroup solutions
+ at defgroup reducedforms Recuded forms
+ at brief NO DOC YET
+
+\section lu LU
+
+\section echelon Echelo
+
+\section frobenius Frobenius
+
+\section smith Smith normal form
+
+*/
+
+// vim:syntax=doxygen
diff --git a/linbox/solutions/smith-form.h b/linbox/solutions/smith-form.h
index 7bd32d0..bedc6be 100644
--- a/linbox/solutions/smith-form.h
+++ b/linbox/solutions/smith-form.h
@@ -1,14 +1,37 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* linbox/solutions/smith-form.h
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) 2010 LinBox
+ *
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
-#ifndef __SMITH_FORM_H
-#define __SMITH_FORM_H
+
+#ifndef __LINBOX_smith_form_H
+#define __LINBOX_smith_form_H
 
 #include <list>
 #include <vector>
 #include <linbox/util/error.h>
 #include <linbox/algorithms/matrix-hom.h>
+#ifdef __LINBOX_HAVE_NTL
 #include <linbox/algorithms/smith-form-adaptive.h>
+#endif
+#include <linbox/field/PID-integer.h>
 //#include <linbox/algorithms/smith-form.h>
 //#include <linbox/algorithms/smith-form-local.h>
 
@@ -17,131 +40,135 @@ namespace LinBox
 	template<class I1, class Lp>
 	void distinct (I1 a, I1 b, Lp& c)
 	{	typename I1::value_type e;
-  		size_t count = 0;
-  		if (a != b) {e = *a; ++a; count = 1;}
-  		else return;
-  		while (a != b)
-  		{	if (*a == e) 
-				++count;
-     			else
-     			{	c.push_back(typename Lp::value_type(e, count));
-       				e = *a; count = 1;
-     			}
-     			++a;
-  		}
-  		c.push_back(typename Lp::value_type(e, count));
-  		return;
+		size_t count = 0;
+		if (a != b) {e = *a; ++a; count = 1;}
+		else return;
+		while (a != b)
+		{	if (*a == e)
+			++count;
+			else
+			{	c.push_back(typename Lp::value_type(e, count));
+				e = *a; count = 1;
+			}
+			++a;
+		}
+		c.push_back(typename Lp::value_type(e, count));
+		return;
 	}
 
 
-	/** Compute the Smith form of A
+	/** Compute the Smith form of A.
+	 * \ingroup solutions
 	 *
 	 * The Smith form of a linear operator A, represented as a
-	 * black box, is computed over a representation of Z or Z_m.
+	 * black box, is computed over a representation of \f$Z\f$ or \f$Z_m\f$.
 	 *
-	 * @param Output S, a list of invariant/repcount pairs.
+	 * @param[out] S a list of invariant/repcount pairs.
 	 * @param A Matrix of which to compute the Smith form
-	 * @param M may be a Method::Hybrid (default), which uses the 
-	 algorithms/smith-form-adaptive.  
-	 Other methods will be provided later.  For now see the examples/smith.C
+	 * @param M may be a \p Method::Hybrid (default), which uses the
+	 algorithms/smith-form-adaptive.
+	 @todo Other methods will be provided later.
+	 For now see the examples/smith.C
 	 for ways to call other smith form algorithms.
-         \ingroup solutions
-        */
-    template <class Output, class Blackbox, class MyMethod>
-    Output &smithForm(Output & S, 
-		const Blackbox                              &A,
-		const MyMethod                           &M) 
-    {
-	    smithForm(S, A, typename FieldTraits<typename Blackbox::Field>::categoryTag(), M);
-	    return S;
-    }
-
-        // for specialization with respect to the DomainCategory
-    template< class Output, class Blackbox, class SmithMethod, class DomainCategory>
-    Output &smithForm(Output & S, 
-                      const Blackbox        &A,
-                      const DomainCategory  &tag,
-                      const SmithMethod  &M)      
-    {
-        throw LinboxError( "Smith form solution implemented only for DenseMatrix<NTL_ZZ>");
-    }
-
-	// The smithForm with default Method 
-    template<class Output, class Blackbox>
-    Output &smithForm(Output& S, 
-					  const Blackbox& A) {
-
-        smithForm(S, A, Method::Hybrid());
+	 */
+	template <class Output, class Blackbox, class MyMethod>
+	Output &smithForm(Output & S,
+			  const Blackbox                              &A,
+			  const MyMethod                           &M)
+	{
+		smithForm(S, A, typename FieldTraits<typename Blackbox::Field>::categoryTag(), M);
+		return S;
+	}
+
+	// for specialization with respect to the DomainCategory
+	template< class Output, class Blackbox, class SmithMethod, class DomainCategory>
+	Output &smithForm(Output & S,
+			  const Blackbox        &A,
+			  const DomainCategory  &tag,
+			  const SmithMethod  &M)
+	{
+		throw LinBoxError( "Smith form solution implemented only for DenseMatrix<PID_integer>.\n                 Please reconfigure LinBox with NTL enabled.");
+	}
+
+	// The smithForm with default Method
+	template<class Output, class Blackbox>
+	Output &smithForm(Output& S,
+			  const Blackbox& A)
+	{
+
+		smithForm(S, A, Method::Hybrid());
 		return S;
-    }
+	}
 
 #if 0
-	// The smithForm for ModularTag 
-    template<class Output, class Blackbox, class MyMethod>
-    Output &smithForm(Output & S, 
-        const Blackbox                            &A,
-        const RingCategories::ModularTag          &tag,
-		const MyMethod& M)
-    {
+	// The smithForm for ModularTag
+	template<class Output, class Blackbox, class MyMethod>
+	Output &smithForm(Output & S,
+			  const Blackbox                            &A,
+			  const RingCategories::ModularTag          &tag,
+			  const MyMethod& M)
+	{
 		typename Blackbox::Field F = A.field();
 		integer p, c; F.characteristic(p); F.cardinality(c);
-		if (probab_prime(p) && p == c) 
+		if (probab_prime(p) && p == c)
 		{	size_t r; rank(r, A);
 			S.resize(0);
 			size_t n = (A.rowdim() > A.coldim() ? A.coldim() : A.rowdim())-r;
 			if (r > 0) S.push_back( std::pair<size_t, integer>(r, 1) );
 			if (n > 0) S.push_back( std::pair<size_t, integer>(n, 0) );
 		}
-		else 
-		{ 
-			integr x; size_t c; 
+		else
+		{
+			integr x; size_t c;
 			for(x = p, c = 0; divides(2, x); x /= 2, ++c);
-		 
-		 	if (x == 1 && c <= 32) // (a low power of 2) 
-		  	{
-		    	List L;
+
+			if (x == 1 && c <= 32) // (a low power of 2)
+			{
+				List L;
 				LocalSmith<Local2_32> SmithForm;
 				SmithForm( L, M, R );
 				distinct(L.begin(), L.end(), S);
 
-		  	}
-		//  if (a odd prime power) call local-smith
-		  	else 
+			}
+			//  if (a odd prime power) call local-smith
+			else
 			{
 				IliopoulosElimination::smithIn (M);
 				typedef std::list< PIR::Element > List;
 				List L;
 				for (size_t i = 0; i < M.rowdim(); ++i) L.push_back(M[i][i]);
 				distinct(L.begin(), L.end(), S);
-		  	}
+			}
 		}
-		  
-		  return S;
-    }
+
+		return S;
+	}
 #endif
 
-	// The smithForm with Hybrid Method 
-    template<>
-    std::list<std::pair<integer, size_t> > &smithForm(std::list<std::pair<integer, size_t> >& S, 
-        const DenseMatrix<NTL_ZZ> 	&A,
-        const RingCategories::IntegerTag          &tag,
-		const Method::Hybrid& M)
-    {
+#ifdef __LINBOX_HAVE_NTL
+	// The smithForm with Hybrid Method
+	template<>
+	std::list<std::pair<integer, size_t> > &smithForm(std::list<std::pair<integer, size_t> >& S,
+							  const DenseMatrix<PID_integer> 	&A,
+							  const RingCategories::IntegerTag          &tag,
+							  const Method::Hybrid& M)
+	{
 		std::vector<integer> v (A.rowdim() < A.coldim() ? A.rowdim() : A.coldim());
 		SmithFormAdaptive::smithForm(v, A);
 		distinct(v.begin(), v.end(), S);
 
 		return S;
-    }
+	}
+#endif
 
 #if 0
-	// The smithForm with Elimination Method 
-    template<class Output, class Ring>
-    Output &smithForm(Output & S, 
-		const DenseMatrix<Ring> &A,
-		const RingCategories::IntegerTag          &tag,
-		const Method::Elimination& M)
-    {
+	// The smithForm with Elimination Method
+	template<class Output, class Ring>
+	Output &smithForm(Output & S,
+			  const DenseMatrix<Ring> &A,
+			  const RingCategories::IntegerTag          &tag,
+			  const Method::Elimination& M)
+	{
 		typename Ring::Element d;
 		det(d, A, tag, M); // or just use default hybrid?  What does elim mean?
 		integer D;
@@ -150,32 +177,33 @@ namespace LinBox
 		{  typedef Modular<int> Ring2;
 			Ring2 R2(D);
 			MatrixHom::map(B, A, R2);
-	    	IliolopousElimination::smithIn(B);
-        //return diagonal of B in Output object.
+			IliolopousElimination::smithIn(B);
+			//return diagonal of B in Output object.
 		}
 		else
 		{  typedef Modular<integer> Ring2;
 			Ring2 R2(D);
 			MatrixHom::map(B, A, R2);
-	    	IliolopousElimination::smithIn(B);
-        //return diagonal of B in Output object.
+			IliolopousElimination::smithIn(B);
+			//return diagonal of B in Output object.
 		}
 
-    }
+	}
 #endif
 
 #if 0
-	// The smithForm with BlackBox Method 
-    template<class Output, class Blackbox>
-    Output &smithForm(Output & S, 
-		const Blackbox                      &A,
-		const RingCategories::IntegerTag    &tag,
-		const Method::Blackbox              &M)
-    {
+	// The smithForm with BlackBox Method
+	template<class Output, class Blackbox>
+	Output &smithForm(Output & S,
+			  const Blackbox                      &A,
+			  const RingCategories::IntegerTag    &tag,
+			  const Method::Blackbox              &M)
+	{
 		// this will be binary search smith form (EGV')
-    }
+	}
 #endif
-    
+
 
 } // end of LinBox namespace
-#endif // __SMITH_FORM_H
+#endif // __LINBOX_smith_form_H
+
diff --git a/linbox/solutions/solutions.doxy b/linbox/solutions/solutions.doxy
index e0d2efd..2e446a0 100644
--- a/linbox/solutions/solutions.doxy
+++ b/linbox/solutions/solutions.doxy
@@ -1,154 +1,175 @@
-/** \defgroup solutions linbox/solutions
-
-These are problem oriented drivers providing simple interfaces to the
-linear algebra %algorithms.  The arguments to each are discussed in detail in the 
-documentation of each function. The optional method parameter is discussed in general
-terms just below the list.
-<ul>
-<li> <code>rank(r, A[, method])</code> r gets rank of A
-<li><code>determinant(d, A[, method])</code> d gets determinant of A
-<li><code>solve(x, A, b[, method[, status]])</code> get x such that Ax = b, random solution if sigular and consistent, x = 0 if inconsistent (also inconsistency is indicated in the status).  
-The method parameter may include specifications that can make the computation faster.  
-These include symmetry, nonsingularity, and that an arbitrary solution is acceptable rather than a random sample.
-<li><code>minpoly(m, A[, method, status])</code> m gets minimal polynomial of A
-<li><code>charpoly(c, A[, method, status])</code> c gets characteristic polynomial of A
-<li><code>smithForm(S, A[, method])</code> S gets Smith Normal Form of A. 
-Smith form is unitarily equivalent to A and is diag(s<sub>1</sub> .. s<sub>n</sub>) such that 
-s<sub>i</sub> | s<sub>i+1</sub>.
-\todo its multipliers? its output form variants?
-</li>
-
-<li><code>frobeniusForm(F, A, method, status)</code> F gets Frobenius (Rational) normal form of A. 
-Frobenius form is similar to A and is a direct sum of companion matrices C<sub>f<sub>i</sub></sub> such that, f<sub>i</sub> divides f<sub>i+1</sub>.
-
-\todo primary form?  Relative primary form of A?  Primary form is similar to A and finest which
-is a direct sum of companion matrices C<sub>f<sub>i</sub></sub> such that, for all i, j, gcd(f<sub>i</sub>, f<sub>j</sub>) = 1 or f<sub>i</sub>
-or f<sub>j</sub>. Relative primary form is coarsest such decomposition.
-
-<li><code>signature(s, A, method)</code>
-<li><code>bool isPositiveDefinite(A, method_symm)</code>
-<li><code>bool isPositiveSemidefinite(A, method_symm)</code>
-</ul>
-<p>
-The algorithms are actively under development, and there is an algorithm choice
-to be made for each function.  The choice is determined by an optional argument
-to the function which is a method object.  The class of the method object determines the 
-approach used and data in the object may help determine algorithm variants at run time.
-This makes it easy to try out and compare several approaches for a given matrix.
-<p>
-The first method classes to consider are the Blackbox, Elimination, and Hybrid classes.  
-Blackbox and Elimination methods may be used for virtually every solution function.
-<p>
-The Elimination class provides access to algorithms based on dense or sparse elimination
-and the algorithms take advantage of the numeric BLAS routines when the underlying field
-or ring is the integers or a prime field of appropriate cardinality.
-<p>
-The Blackbox class provides functions which are space efficient and are particularly
-effective for very large and very sparse systems.  They are also fast and useful for structured 
-systems such as Toeplitz, Hankel, Vandermonde, etc.  Currently in %LinBox 
-the superfast methods for structured matrices are not implemented.
-<p>
-The Hybrid class chooses Blackbox, Elimination, or a mix of them based on matrix properties
-checked at runtime.  It is the default method.
-Thus for each problem (e.g. rank)
-the function call without a method, <code>rank(r, A)</code>, is equivalent to a call
-using the default Hybrid object, <code>rank(r, A, Method::Hybrid())</code>.  
-<p>
-Hybrid algorithms are under development and not in final form.
-The method used under the Hybrid designation may be a sophisticated hybrid algorithm, 
-a very basic one, or simply our guess of the most widely useful of the available algorithms.
-The basic hybrid method is to use the elimination approach if the matrix is small
-or in a dense representation, and a blackbox method otherwise.  A dense representation
-is one which inherits from DenseMatrix or BlasMatrix.  Small means both row and column
-dimensions are less than 10<sup>3</sup>.  <!-- What value really?  -->
-The threshold values can be changed in 
-the hybrid method object. For instance <code>Hybrid h; h.setSmallThreshold(5000); rank(r, A, h)</code>.
-<p>
-Additional method classes exist to focus in greater detail on the method.  For instance, 
-in the Blackbox situation there are the Wiedemann, BlockWiedemann, Lanczos, and BlockLanczos
-approaches, to name a few.  Actually, For each solution function, the Blackbox class simply 
-chooses from among these the best one as currently implemented.  They may be used specifically
-to override that default.  Thus <code>rank(r, A, Blackbox())</code> uses the Wiedemann method.
-But <code>rank(r, A, BlockLanczos())</code> could be called as well. 
-\todo this may soon be reversed, in fact.
-
-Also choice of 
-preconditioner may be possible either at runtime by putting an indicator in the method object
-or at compile time by using a more special class of method such as BlockWiedemannButterfly.
-<p>
-Other method classes focus on algorithms attuned to specific matrix properties.  For instance,
-there may be HybridSymmetric, EliminationSymmetric, and BlackboxSymmetric.  Using these method
-choices, several functions are about twice as fast as those where the symmetry is unspecified.
-To get the same effect as a runtime choice, objects of the basic method classes may contain
-an indicator of symmetry, <code>Method::Elimination e; e.setSymmetric(); rank(r, A, e)</code>.
-
-<!-- TODO I'd prefer to say that indicating symmetry is done in the matrix:
-specialize for classes that only hold symmetric matrices, otherwise check symmetry with two
-apply's (apply and applyTranspose give same result on a random vector x). 
--->
-
-<p>
-Not every implemented algorithm is available through solution functions and their methods,
-but this is a good starting point.  See \ref algorithms for the other possibilities.
-<p>
-If the status parameter is given, it is used for output of side information.  For instance
-the solve function will set it's isConsistent() property indicating whether or not the system
-was found to be consistent.  Also an upper bound on the probability of error is given by 
-errorBound().  
-In the future, it may even provide consistency certificates and cofactors for normal forms.
-
-*/
-
-/* sketch of the classes and methods as envisioned for version 1.0.
-
-rank with Blackbox is using symmetrizing Wiedemann
-  Standard Wiedemann if the field is finite and large
-  Standard Wiedemann mod a random wordsize prime if the field/ring is Q/Z
-  Wiedemann over an extension field if the field is finite and small.
-
-rank with Elimination is 
-  blas lu with pivoting over prime field, not too small nor too big
-  blas lu mod a random wordsize prime if the field/ring is Q/Z
-  elementwise lu with pivoting for small or large prime field and nonprime field.
- 
-rank with Hybrid is using introspecive method when reinstated.  Until then basic hybrid.
-  Elimination::rank if the matrix is small (< 10k) or dense (by type)
-  Blackbox::rank, otherwise.
-
-BlackboxSymmetric::rank is using symmetric Wiedemann
-
-EliminationSymmetric::rank is using a symmetric LU.
-
-StandardSymmetric is using at first simple then later sophisticated hybrids
-of BlackboxSymmetric and EliminationSymmetric.
-
-The Symmetric classes are providing signature(), isPositiveDefinite(), is PositiveSemidefinite(),
-but not the unsymmetric classes.
-
-The system should allow compile time specialization by class of blackbox and class of field.
-The system should allow runtime specialization by matrix size, by other matrix properties
-either discovered or provided by the caller, and by properties of the underlying field/ring
-of computation.
-The system should encourage reasonable split between solutions dir and algorithms dir.
-In general, the code in solutions directory should not get too involved.  I suppose 
-a solutions header could even be:
-solutions/my-solutions-class.h
-
-About LU.  I am not sure LU,LPUQ LDL^T and similar factorizations should be provided
-in the solutions directory.  My favorite view is that the blackbox wrapper of 
-a dense or sparse (mutable) matrix can also wrap the factorization.  Thus, when any 
-function is called which needs the matrix factored, the factorization is done.  But the 
-blackbox apply still works as if the factorization hasn't happened.  However if another
-function needing the factorization is called, the time for factorization is saved.  In 
-particular the blackbox matrix inverse is cheap after the first call in which the factorization
-is done.
-
-Back to listing methods:
+// Copyright (C) 2010 LinBox, GNU LGPL, see COPYING for licence information
+
+/** \ingroup linbox
+  \defgroup solutions solutions
+
+  \brief These are problem oriented drivers providing simple interfaces to the linear algebra %algorithms.
+
+  The arguments to each are discussed in detail in the
+  documentation of each function. The optional method parameter is discussed in general
+  terms just below the list.
+  <ul>
+  <li><code>rank(r, A[, method])</code> r gets rank of A</li>
+  <li><code>determinant(d, A[, method])</code> d gets determinant of A</li>
+  <li><code>solve(x, A, b[, method[, status]])</code> get x such that Ax = b, random solution if sigular and consistent, x = 0 if inconsistent (also inconsistency is indicated in the status).
+  The method parameter may include specifications that can make the computation faster.
+  These include symmetry, nonsingularity, and that an arbitrary solution is acceptable rather than a random sample.</li>
+  <li><code>minpoly(m, A[, method, status])</code> m gets minimal polynomial of A</li>
+  <li><code>charpoly(c, A[, method, status])</code> c gets characteristic polynomial of A</li>
+  <li><code>smithForm(S, A[, method])</code> S gets Smith Normal Form of A.
+  Smith form is unitarily equivalent to A and is diag(s<sub>1</sub> .. s<sub>n</sub>) such that
+  s<sub>i</sub> | s<sub>i+1</sub>.
+  \todo its multipliers? its output form variants?
+  </li>
+
+  <li><code>frobeniusForm(F, A, method, status)</code> F gets Frobenius (Rational) normal form of A.
+  Frobenius form is similar to A and is a direct sum of companion matrices C<sub>f<sub>i</sub></sub> such that, f<sub>i</sub> divides f<sub>i+1</sub>.</li>
+
+  \todo primary form?  Relative primary form of A?  Primary form is similar to A and finest which
+  is a direct sum of companion matrices C<sub>f<sub>i</sub></sub> such that, for all i, j, gcd(f<sub>i</sub>, f<sub>j</sub>) = 1 or f<sub>i</sub>
+  or f<sub>j</sub>. Relative primary form is coarsest such decomposition.
+
+  <li><code>signature(s, A, method)</code></li>
+  <li><code>bool isPositiveDefinite(A, method_symm)</code></li>
+  <li><code>bool isPositiveSemidefinite(A, method_symm)</code></li>
+  </ul>
+
+  The algorithms are actively under development, and there is an algorithm choice
+  to be made for each function.  The choice is determined by an optional argument
+  to the function which is a method object. The class of the method object determines the
+  approach used and data in the object may help determine algorithm variants at run time.
+  This makes it easy to try out and compare several approaches for a given matrix.
+
+  The first method classes to consider are the @link LinBox::Method::Blackbox Blackbox at endlink, @link LinBox::Method::Elimination Elimination at endlink, and @link LinBox::Method::Hybrid Hybrid at endlink classes.
+  \c Blackbox and \c Elimination methods may be used for virtually every solution function.
+
+  - The @link LinBox::Method::Elimination Elimination at endlink class provides access to algorithms based on dense or sparse elimination
+  and the algorithms take advantage of the numeric BLAS routines when the underlying field
+  or ring is the integers or a prime field of appropriate cardinality.
+
+  - The @link LinBox::Method::Blackbox Blackbox at endlink class provides functions which are space efficient and are particularly
+  effective for very large and very sparse systems.  They are also fast and useful for structured
+  systems such as Toeplitz, Hankel, Vandermonde, etc.  Currently in %LinBox
+  the superfast methods for structured matrices are not implemented.
+
+  - The @link LinBox::Method::Hybrid Hybrid at endlink class chooses \c Blackbox, \c Elimination, or a mix of them
+  based on matrix properties checked at runtime.  It is the default method.  Thus
+  for each problem (e.g. rank) the function call without a method, <code>rank(r,
+  A)</code>, is equivalent to a call using the default Hybrid object,
+  <code>rank(r, A, Method::Hybrid())</code>.
+  .
+
+  Hybrid algorithms are under development and not in final form.  The method
+  used under the Hybrid designation may be a sophisticated hybrid algorithm, a
+  very basic one, or simply our guess of the most widely useful of the available
+  algorithms.  The basic hybrid method is to use the elimination approach if the
+  matrix is small or in a dense representation, and a blackbox method otherwise.
+  A dense representation is one which inherits from \c DenseMatrix or \c
+  BlasMatrix.  Small means both row and column dimensions are less than
+  10<sup>3</sup>.  <!-- What value really?  --> The threshold values can be
+  changed in the hybrid method object. For instance
+  \code
+  Hybrid h;
+  h.setSmallThreshold(5000);
+  rank(r, A, h) ;
+  \endcode
+
+  Additional method classes exist to focus in greater detail on the method.
+  For instance, in the \c Blackbox situation there are the @link LinBox::Method::Wiedemann Wiedemann at endlink,
+  @link LinBox::Method::BlockWiedemann BlockWiedemann at endlink,  @link LinBox::Method::Lanczos Lanczos at endlink, and @link LinBox::Method::BlockLanczos BlockLanczos at endlink approaches, to name a few.
+  Actually, for each solution function, the \c Blackbox class simply chooses from
+  among these the best one as currently implemented.  They may be used
+  specifically to override that default.  Thus <code>rank(r, A,Blackbox())</code>
+  uses the Wiedemann method.  But <code>rank(r, A, BlockLanczos())</code> could be
+  called as well.
+
+  \todo this may soon be reversed, in fact.
+
+  Also choice of preconditioner may be possible either at runtime by putting an
+  indicator in the method object or at compile time by using a more special class
+  of method such as  @link LinBox::Method::BlockWiedemannButterfly BlockWiedemannButterfly at endlink.
+
+  Other method classes focus on algorithms attuned to specific matrix properties.  For instance,
+  there may be @link LinBox::Method::HybridSymmetric HybridSymmetric at endlink, @link LinBox::Method::EliminationSymmetric EliminationSymmetric at endlink, and @link LinBox::Method::BlackboxSymmetric BlackboxSymmetric at endlink.  Using these method
+  choices, several functions are about twice as fast as those where the symmetry is unspecified.
+  To get the same effect as a runtime choice, objects of the basic method classes may contain
+  an indicator of symmetry,
+  \code
+  Method::Elimination e;
+  e.setSymmetric();
+  rank(r, A, e);
+  \endcode
+
+  <!-- TODO I'd prefer to say that indicating symmetry is done in the matrix:
+  specialize for classes that only hold symmetric matrices, otherwise check symmetry with two
+  apply's (apply and applyTranspose give same result on a random vector x).
+  -->
+
+  Not every implemented algorithm is available through solution functions and
+  their methods, but this is a good starting point.  See \ref algorithms for the
+  other possibilities and \c LinBox::Method for available methods.
+
+  If the status parameter is given, it is used for output of side information.  For instance
+  the solve function will set it's \c isConsistent() property indicating whether or not the system
+  was found to be consistent.  Also an upper bound on the probability of error is given by
+  \c errorBound().
+  In the future, it may even provide consistency certificates and cofactors for normal forms.
+
+  */
+
+  <!--
+  sketch of the classes and methods as envisioned for version 1.0.
+
+  rank with Blackbox is using symmetrizing Wiedemann
+  - Standard Wiedemann if the field is finite and large
+  - Standard Wiedemann mod a random wordsize prime if the field/ring is Q/Z
+  - Wiedemann over an extension field if the field is finite and small.
+
+  rank with Elimination is
+  - blas lu with pivoting over prime field, not too small nor too big
+  - blas lu mod a random wordsize prime if the field/ring is Q/Z
+  - elementwise lu with pivoting for small or large prime field and nonprime field.
+
+	rank with Hybrid is using introspecive method when reinstated.  Until then basic hybrid.
+\c Elimination::rank if the matrix is small (< 10k) or dense (by type)
+	\c Blackbox::rank, otherwise.
+
+	\c BlackboxSymmetric::rank is using symmetric Wiedemann
+
+	\c EliminationSymmetric::rank is using a symmetric LU.
+
+	StandardSymmetric is using at first simple then later sophisticated hybrids
+	of BlackboxSymmetric and EliminationSymmetric.
+
+	The Symmetric classes are providing signature(), isPositiveDefinite(), is PositiveSemidefinite(),
+	but not the unsymmetric classes.
+
+	The system should allow compile time specialization by class of blackbox and class of field.
+	The system should allow runtime specialization by matrix size, by other matrix properties
+	either discovered or provided by the caller, and by properties of the underlying field/ring
+	of computation.
+	The system should encourage reasonable split between solutions dir and algorithms dir.
+	In general, the code in solutions directory should not get too involved.  I suppose
+	a solutions header could even be:
+	solutions/my-solutions-class.h
+
+	About LU.  I am not sure LU,LPUQ LDL^T and similar factorizations should be provided
+	in the solutions directory.  My favorite view is that the blackbox wrapper of
+	a dense or sparse (mutable) matrix can also wrap the factorization.  Thus, when any
+	function is called which needs the matrix factored, the factorization is done.  But the
+	blackbox apply still works as if the factorization hasn't happened.  However if another
+	function needing the factorization is called, the time for factorization is saved.  In
+	particular the blackbox matrix inverse is cheap after the first call in which the factorization
+	is done.
+
+	Back to listing methods:
 
 minpoly is probabilistic, whether by blackbox or elim methods (random vector, Keller-Gehrig)
-For small primes wiedemann should use lcm of several tries until nothing new is added
-(a form of early termination).  I don't believe this is implemented yet.
+	For small primes wiedemann should use lcm of several tries until nothing new is added
+	(a form of early termination).  I don't believe this is implemented yet.
 
-Blackbox::solve(x, A, b) is Blackbox::nullspaceRandom(y, [A b]), then
-return x_i = y_i/y_n, for i in 0..n-1.
-*/
+	Blackbox::solve(x, A, b) is Blackbox::nullspaceRandom(y, [A b]), then
+	return x_i = y_i/y_n, for i in 0..n-1.
+	-->
+
+// vim:syn=doxygen
diff --git a/linbox/solutions/solve.h b/linbox/solutions/solve.h
index 6209334..bdf3558 100644
--- a/linbox/solutions/solve.h
+++ b/linbox/solutions/solve.h
@@ -1,18 +1,21 @@
 /* -*- 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
 /* linbox/solutions/solve.h
+ * Copyright(C) LinBox
  *  Evolved from an earlier one by Bradford Hovinen <hovinen at cis.udel.edu>
  *
  * See COPYING for license information.
  */
 
-#ifndef __SOLVE_H
-#define __SOLVE_H
+#ifndef __LINBOX_solve_H
+#define __LINBOX_solve_H
 
 #include <vector>
 #include <algorithm>
 
 // must fix this list...
+#include "linbox/algorithms/gauss.h"
+#include "linbox/algorithms/gauss-gf2.h"
 #include "linbox/algorithms/wiedemann.h"
 #include "linbox/algorithms/rational-solver.h"
 #include "linbox/algorithms/diophantine-solver.h"
@@ -24,7 +27,10 @@
 #include "linbox/solutions/methods.h"
 #include "linbox/algorithms/bbsolve.h"
 
-namespace LinBox 
+#include "linbox/algorithms/rational-cra2.h"
+#include "linbox/algorithms/varprec-cra-early-multip.h"
+
+namespace LinBox
 {
 
 	// for specialization with respect to the DomainCategory
@@ -38,15 +44,15 @@ namespace LinBox
 
 	/** \brief Solve Ax = b, for x.
 	 *
-	 * Vector x such that Ax = b is returned.  
+	 * Vector x such that Ax = b is returned.
 	 In the case of a singular matrix A, if the system is consistent, a random
 	 solution is returned by default.  The method parameter may contain
-	 an indication that an arbitrary element of the solution space is 
-	 acceptable, which can be faster to compute.  
-	 If the system is inconsistent the zero vector is returned. 
-	 
-         \ingroup solutions
-        */
+	 an indication that an arbitrary element of the solution space is
+	 acceptable, which can be faster to compute.
+	 If the system is inconsistent the zero vector is returned.
+
+	 \ingroup solutions
+	 */
 	//and the SolveStatus, if non-null, is set to indicate inconsistency.
 	template< class Vector, class Blackbox, class SolveMethod>
 	Vector & solve (Vector &        		x,
@@ -54,235 +60,319 @@ namespace LinBox
 			const Vector &			b,
 			const SolveMethod &             M)
 	//		SolveStatus * 			s = 0)
-	{ 
+	{
 		return solve(x, A, b, typename FieldTraits<typename Blackbox::Field>::categoryTag(), M);
 	}
 
 	// the solve with default method
 	template< class Vector, class Blackbox>
 	Vector& solve(Vector& x, const Blackbox& A, const Vector& b)
-	{ return solve(x, A, b, Method::Hybrid()); }
+	{
+		return solve(x, A, b, Method::Hybrid());
+	}
 
 	// in methods.h FoobarMethod and Method::Foobar are the same class.
 	// in methods.h template<BB> bool useBB(const BB& A) is defined.
 
 	// specialize this on blackboxes which have local methods
-	template <class Vector, class BB> 
-	Vector& solve(Vector& x, const BB& A, const Vector& b, 
+	template <class Vector, class BB>
+	Vector& solve(Vector& x, const BB& A, const Vector& b,
 		      const Method::Hybrid& m)
-	{	
-		if (useBB(A)) return solve(x, A, b, Method::Blackbox(m)); 
+	{
+		if (useBB(A)) return solve(x, A, b, Method::Blackbox(m));
 		else return solve(x, A, b, Method::Elimination(m));
 	}
 
-	template <class Vector, class BB> 
-	Vector& solve(Vector& x, const BB& A, const Vector& b, 
+	template <class Vector, class BB>
+	Vector& solve(Vector& x, const BB& A, const Vector& b,
 		      const Method::Blackbox& m)
-	{ 
+	{
 		// what is chosen here should be best and/or most reliable currently available choice
 		// 		integer c; A.field().cardinality(c);
 		// 		if (c < 100) return solve(x, A, b, Method::BlockLanczos(m));
 		return solve(x, A, b, Method::Wiedemann(m));
 	}
 
-	// temporary - fix this
-#define inBlasRange(p) true
+	//! @todo temporary - fix this
+//#define inBlasRange(p) true
 
-	template <class Vector, class BB> 
-	Vector& solve(Vector& x, const BB& A, const Vector& b, 
+	template <class Vector, class BB>
+	Vector& solve(Vector& x, const BB& A, const Vector& b,
 		      const Method::Elimination& m)
-	{ 
+	{
 		integer c, p;
 		A.field().cardinality(c);
 		A.field().characteristic(p);
 		//if ( p == 0 || (c == p && inBlasRange(p)) )
-		return solve(x, A, b, 
-			     typename FieldTraits<typename BB::Field>::categoryTag(), 
-			     Method::BlasElimination(m)); 
-  		//else 
-		//	return solve(x, A, b, 
-		//			typename FieldTraits<typename BB::Field>::categoryTag(), 
-		//			Method::NonBlasElimination(m)); 
+		return solve(x, A, b,
+			     typename FieldTraits<typename BB::Field>::categoryTag(),
+			     Method::BlasElimination(m));
+		//else
+		//	return solve(x, A, b,
+		//			typename FieldTraits<typename BB::Field>::categoryTag(),
+		//			Method::NonBlasElimination(m));
+	}
+
+	template <class Vector, class Field>
+	Vector& solvein(Vector& x, SparseMatrix<Field, typename LinBox::Vector<Field>::SparseSeq>& A, const Vector& b, const Method::SparseElimination& m)
+	{
+		commentator.start ("Sparse Elimination Solve In Place", "sesolvein");
+		GaussDomain<Field> GD ( A.field() );
+		GD.solvein(x, A, b);
+		commentator.stop ("done", NULL, "sesolvein");
+		return x;
 	}
 
-	template <class Vector, class Field> 
-	Vector& solve(Vector& x, const SparseMatrix<Field>& A, const Vector& b, 
+
+	// Change of representation to be able to call the sparse elimination
+	template <class Vector, class Blackbox>
+	Vector& solve(Vector& x, const Blackbox& A, const Vector& b,
+		      const Method::SparseElimination& m)
+	{
+		typedef typename Blackbox::Field Field;
+		typedef SparseMatrix<Field, typename LinBox::Vector<Field>::SparseSeq> SparseBB;
+		SparseBB SpA(A.field(), A.rowdim(), A.coldim());
+		MatrixHom::map(SpA, A, A.field());
+		return solvein(x, SpA, b, m);
+	}
+
+	template <class Vector>
+	Vector& solvein(Vector& x,
+			GaussDomain<GF2>::Matrix    &A,
+			const Vector& b,
+			const Method::SparseElimination& m)
+	{
+		commentator.start ("Sparse Elimination Solve In Place over GF2", "GF2sesolvein");
+		GaussDomain<GF2> GD ( A.field() );
+		GD.solvein(x, A, b);
+		commentator.stop ("done", NULL, "GF2sesolvein");
+		return x;
+	}
+	template <class Vector>
+	Vector& solve(Vector& x,
+		      GaussDomain<GF2>::Matrix    &A,
+		      const Vector& b,
+		      const Method::SparseElimination& m)
+	{
+		// We make a copy
+		GaussDomain<GF2>::Matrix SpA(A.field(), A.rowdim(), A.coldim());
+		MatrixHom::map(SpA, A, A.field());
+		return solvein(x, SpA, b, m);
+	}
+
+	template <class Vector, class Field>
+	Vector& solve(Vector& x, const SparseMatrix<Field>& A, const Vector& b,
 		      const Method::Elimination& m)
-	{	
+	{
 		//             bool consistent = false;
 		// sparse elimination based solver can be called here ?
-        	// For now we call the dense one
-        	
-		return solve(x, A, b, 
-			     typename FieldTraits<typename SparseMatrix<Field>::Field>::categoryTag(), 
-			     Method::BlasElimination(m)); 
-
-		// 		if ( ! consistent ) {  // we will return the zero vector
-		// 			typename Field::Element zero; A.field().init(zero, 0);
-		// 			for (typename Vector::iterator i = x.begin(); i != x.end(); ++i) *i = zero;
-		// 		}
-		// 		return x;
+		// For now we call the dense one
+
+		return solve(x, A, b,
+			     typename FieldTraits<typename SparseMatrix<Field>::Field>::categoryTag(),
+			     Method::BlasElimination(m));
+
+#if 0
+		if ( ! consistent ) {  // we will return the zero vector
+			typename Field::Element zero; A.field().init(zero, 0);
+			for (typename Vector::iterator i = x.begin(); i != x.end(); ++i) *i = zero;
+		}
+		return x;
+#endif
 	}
 	// BlasElimination section ///////////////////
 
-	template <class Vector, class BB> 
-	Vector& solve(Vector& x, const BB& A, const Vector& b, 
-		      const RingCategories::ModularTag & tag, 
+	template <class Vector, class BB>
+	Vector& solve(Vector& x, const BB& A, const Vector& b,
+		      const RingCategories::ModularTag & tag,
 		      const Method::BlasElimination& m)
-	{ 
+	{
 		BlasBlackbox<typename BB::Field> B(A); // copy A into a BlasBlackbox
 		return solve(x, B, b, tag, m);
-	} 
+	}
 
-	template <class Vector, class Field> 
-	Vector& solve(Vector& x, const BlasBlackbox<Field>& A, const Vector& b, 
-		      const RingCategories::ModularTag & tag, 
+	template <class Vector, class Field>
+	Vector& solve(Vector& x, const BlasBlackbox<Field>& A, const Vector& b,
+		      const RingCategories::ModularTag & tag,
 		      const Method::BlasElimination& m)
-	{ 
+	{
 		if ((A.coldim() != x.size()) || (A.rowdim() != b.size()))
 			throw LinboxError("LinBox ERROR: dimension of data are not compatible in system solving (solving impossible)");
 
 		commentator.start ("Solving linear system (FFLAS LQUP)", "LQUP::left_solve");
-		//		bool consistent = false;
+		//bool consistent = false;
 		LQUPMatrix<Field> LQUP(A);
 		//FactorizedMatrix<Field> LQUP(A);
 
 		LQUP.left_solve(x, b);
 
-		// this should be implemented directly in left_solve 
-		//if ( ! consistent ) {  // we will return the zero vector
-		//	typename Field::Element zero; A.field().init(zero, 0);
-		//	for (typename Vector::iterator i = x.begin(); i != x.end(); ++i) *i = zero;
-		//}
+#if 0
+		// this should be implemented directly in left_solve
+		if ( ! consistent ) {  // we will return the zero vector
+			typename Field::Element zero;
+			A.field().init(zero, 0);
+			for (typename Vector::iterator i = x.begin(); i != x.end(); ++i)
+				*i = zero;
+		}
+#endif
 		commentator.stop ("done", NULL, "LQUP::left_solve");
 		return x;
-	} 
+	}
+
 
-	
 	/* Integer tag Specialization for Dixon method:
-	 * 2 interfaces: 
+	 * 2 interfaces:
 	 *   - the output is a common denominator and a vector of numerator (no need of rational number)
 	 *   - the output is a vector of rational
-	 */  
+	 */
 
 
 	// error handler for bad use of the integer solver API
-	template <class Vector, class BB> 
-	Vector& solve(Vector& x, const BB& A, const Vector& b, 
-		      const RingCategories::IntegerTag & tag, 
+	template <class Vector, class BB>
+	Vector& solve(Vector& x, const BB& A, const Vector& b,
+		      const RingCategories::IntegerTag & tag,
 		      const Method::BlasElimination& m)
-	{ 
+	{
 		std::cout<<"try to solve system over the integer\n"
-			 <<"the API need either \n"
-			 <<" - a vector of rational as the solution \n"
-			 <<" - or an integer for the common denominator and a vector of integer for the numerators\n\n";
+		<<"the API need either \n"
+		<<" - a vector of rational as the solution \n"
+		<<" - or an integer for the common denominator and a vector of integer for the numerators\n\n";
 		throw LinboxError("bad use of integer API solver\n");
-		
-	} 
 
-	// error handler for non defined solver over rational domain
-	template <class RatVector, class Vector, class BB, class MethodTraits> 
-	Vector& solve(RatVector& x, const BB& A, const Vector& b, 
-		      const RingCategories::RationalTag & tag, 
+	}
+
+#if 0
+	template <class RatVector, class Vector, class BB, class MethodTraits>
+	Vector& solve(RatVector& x, const BB& A, const Vector& b,
+		      const RingCategories::RationalTag & tag,
 		      const MethodTraits& m)
-	{ 
-		throw LinboxError("LinBox ERROR: solver not yet defined over rational domain");
+	{
+		if ((A.coldim() != x.size()) || (A.rowdim() != b.size()))
+			throw LinboxError("LinBox ERROR: dimension of data are not compatible in system solving (solving impossible)");
+
+		commentator.start ("Rational CRA Solve", "Rsolve");
+		size_t bits = 26 -(int)ceil(log((double)A.rowdim())*0.7213475205);
+		RandomPrimeIterator genprime( bits);
+
+		RationalRemainder2< VarPrecEarlyMultipCRA< Modular<double> > > rra(3UL);//using default RR method
+		IntegerModularSolve<BB,Vector,MethodTraits > iteration(A, b, m);
+		integer den;
+		std::vector< integer > num(A.coldim());
+
+		rra(num, den, iteration, genprime);
+
+		typename RatVector::iterator it_x= x.begin();
+		typename std::vector<integer>::const_iterator it_num= num.begin();
+
+		for (; it_x != x.end(); ++it_x, ++it_num){
+			integer g = gcd( *it_num, den);
+			*it_x = typename RatVector::value_type(*it_num/g, den/g);
+		}
+
+		commentator.stop ("done", NULL, "Rsolve");
+		return x;
 	}
-	
+#endif
 	// error handler for non defined solver over rational domain
-	template <class Vector, class BB, class MethodTraits> 
-	Vector& solve(Vector& x, const BB& A, const Vector& b, 
-		      const RingCategories::RationalTag & tag, 
+#if 0
+	template <class Vector, class BB, class MethodTraits>
+	Vector& solve(Vector& x, const BB& A, const Vector& b,
+		      const RingCategories::RationalTag & tag,
 		      const MethodTraits& m)
-	{ 
+	{
 		throw LinboxError("LinBox ERROR: solver not yet defined over rational domain");
 	}
-	
-	
+#endif
+
 	/*
 	 * 1st integer solver API :
 	 * solution is a vector of rational numbers
 	 * RatVector is assumed to be the type of a vector of rational number
-	 */	
+	 */
 
 	// default API (method is BlasElimination)
-	template<class RatVector, class Vector, class BB>	
-	RatVector& solve(RatVector& x, const BB &A, const Vector &b){
+	template<class RatVector, class Vector, class BB>
+	RatVector& solve(RatVector& x, const BB &A, const Vector &b)
+	{
 		return solve(x, A, b, Method::BlasElimination());
 	}
 
 	// API with Hybrid method
-	template<class RatVector, class Vector, class BB>	
-	RatVector& solve(RatVector& x, const BB &A, const Vector &b, const Method::Hybrid &m){
-		if (useBB(A)) 
-			return solve(x, A, b, Method::Blackbox(m)); 
-		else 
+	template<class RatVector, class Vector, class BB>
+	RatVector& solve(RatVector& x, const BB &A, const Vector &b, const Method::Hybrid &m)
+	{
+		if (useBB(A))
+			return solve(x, A, b, Method::Blackbox(m));
+		else
 			return solve(x, A, b, Method::Elimination(m));
 	}
 
 	// API with Blackbox method
-	template<class RatVector, class Vector, class BB>	
-	RatVector& solve(RatVector& x, const BB &A, const Vector &b, const Method::Blackbox &m){
+	template<class RatVector, class Vector, class BB>
+	RatVector& solve(RatVector& x, const BB &A, const Vector &b, const Method::Blackbox &m)
+	{
 		return solve(x, A, b, Method::Wiedemann(m));
 	}
 
 	// API with Elimination method
-	template<class RatVector, class Vector, class BB>	
-	RatVector& solve(RatVector& x, const BB &A, const Vector &b, const Method::Elimination &m){
+	template<class RatVector, class Vector, class BB>
+	RatVector& solve(RatVector& x, const BB &A, const Vector &b, const Method::Elimination &m)
+	{
 		return solve(x, A, b,  Method::BlasElimination(m));
 	}
 
 
 	// launcher of specialized solver depending on the MethodTrait
-	template<class RatVector, class Vector, class BB, class MethodTraits>	
-	RatVector& solve(RatVector& x, const BB &A, const Vector &b, const MethodTraits &m){
+	template<class RatVector, class Vector, class BB, class MethodTraits>
+	RatVector& solve(RatVector& x, const BB &A, const Vector &b, const MethodTraits &m)
+	{
 		return solve(x, A, b, typename FieldTraits<typename BB::Field>::categoryTag(),  m);
 	}
 
 
 	/* Specializations for BlasElimination over the integers
-	 */
+	*/
 
 	// input matrix is generic (copying it into a BlasBlackbox)
-	template <class RatVector, class Vector, class BB> 
-	RatVector& solve(RatVector& x, const BB& A, const Vector& b, 
-			 const RingCategories::IntegerTag & tag, 
+	template <class RatVector, class Vector, class BB>
+	RatVector& solve(RatVector& x, const BB& A, const Vector& b,
+			 const RingCategories::IntegerTag & tag,
 			 const Method::BlasElimination& m)
-	{ 
+	{
 		BlasBlackbox<typename BB::Field> B(A); // copy A into a BlasBlackbox
 		return solve(x, B, b, tag, m);
-	} 
-	
+	}
+
 	// input matrix is a BlasBlackbox (no copy)
-	template <class RatVector, class Vector, class Ring> 
-	RatVector& solve(RatVector& x, const BlasBlackbox<Ring>& A, const Vector& b, 
-			 const RingCategories::IntegerTag & tag, 
+	template <class RatVector, class Vector, class Ring>
+	RatVector& solve(RatVector& x, const BlasBlackbox<Ring>& A, const Vector& b,
+			 const RingCategories::IntegerTag & tag,
 			 const Method::BlasElimination& m)
-	{ 
-	
+	{
+
 		Method::Dixon mDixon(m);
 		typename Ring::Element d;
 		std::vector< typename Ring::Element> num(A.coldim());
 		solve (num, d, A, b, tag, mDixon);
-		
+
 		typename RatVector::iterator it_x= x.begin();
 		typename std::vector< typename Ring::Element>::const_iterator it_num= num.begin();
 		integer n,den;
 		A.field().convert(den,d);
-		for (; it_x != x.end(); ++it_x, ++it_num){			
+		for (; it_x != x.end(); ++it_x, ++it_num){
 			A.field().convert(n, *it_num);
 			*it_x = typename RatVector::value_type(n, den);
 		}
-			
+
 		return x;
-	} 
+	}
 
 	// input matrix is a DenseMatrix (no copy)
-	template <class RatVector, class Vector, class Ring> 
-	RatVector& solve(RatVector& x, const DenseMatrix<Ring>& A, const Vector& b, 
-			 const RingCategories::IntegerTag & tag, 
+	template <class RatVector, class Vector, class Ring>
+	RatVector& solve(RatVector& x, const DenseMatrix<Ring>& A, const Vector& b,
+			 const RingCategories::IntegerTag & tag,
 			 const Method::BlasElimination& m)
-	{ 
+	{
 		Method::Dixon mDixon(m);
 		typename Ring::Element d;
 		std::vector< typename Ring::Element> num(A.coldim());
@@ -290,63 +380,79 @@ namespace LinBox
 		typename RatVector::iterator it_x= x.begin();
 		typename std::vector< typename Ring::Element>::const_iterator it_num= num.begin();
 		integer n,den;
-		A.field().convert(den,d); 
-		for (; it_x != x.end(); ++it_x, ++it_num){			
+		A.field().convert(den,d);
+		for (; it_x != x.end(); ++it_x, ++it_num){
 			A.field().convert(n, *it_num);
 			*it_x = typename RatVector::value_type(n, den);
 		}
-		
+
 		return x;
-	} 
+	}
 
 	/*
 	 * 2nd integer solver API :
 	 * solution is a formed by a common denominator and a vector of integer numerator
 	 * solution is num/d
 	 */
-	
-	
+
+
 	// default API (method is BlasElimination)
 	template< class Vector, class BB>
-	Vector& solve(Vector &x, typename BB::Field::Element &d, const BB &A, const Vector &b){
+	Vector& solve(Vector &x, typename BB::Field::Element &d, const BB &A, const Vector &b)
+	{
 		return solve(x, d, A, b, typename FieldTraits<typename BB::Field>::categoryTag(),  Method::BlasElimination());
 	}
-		
+
 	// launcher of specialized solver depending on the MethodTraits
 	template< class Vector, class BB, class MethodTraits>
-	Vector& solve(Vector &x, typename BB::Field::Element &d, const BB &A, const Vector &b, const MethodTraits &m){
+	Vector& solve(Vector &x, typename BB::Field::Element &d, const BB &A, const Vector &b, const MethodTraits &m)
+	{
 		return solve(x, d, A, b, typename FieldTraits<typename BB::Field>::categoryTag(), m);
 	}
-	
+
 	/* Specialization for BlasElimination over the integers
-	 */
-	
+	*/
+
 	// input matrix is generic (copying it into a BlasBlackbox)
-	template <class Vector, class BB> 
-	Vector& solve(Vector& x, typename BB::Field::Element &d, const BB& A, const Vector& b, 
-		      const RingCategories::IntegerTag & tag, 
+	template <class Vector, class BB>
+	Vector& solve(Vector& x, typename BB::Field::Element &d, const BB& A, const Vector& b,
+		      const RingCategories::IntegerTag & tag,
 		      const Method::BlasElimination& m)
-	{ 
+	{
 		BlasBlackbox<typename BB::Field> B(A); // copy A into a BlasBlackbox
 		return solve(x, d, B, b, tag, m);
-	} 
-	
+	}
+
 	// input matrix is a BlasBlackbox (no copy)
-	template <class Vector, class Ring> 
-	Vector& solve(Vector& x, typename Ring::Element &d, const BlasBlackbox<Ring>& A, const Vector& b, 
-		      const RingCategories::IntegerTag & tag, 
+	template <class Vector, class Ring>
+	Vector& solve(Vector& x, typename Ring::Element &d,
+		      const BlasBlackbox<Ring>& A, const Vector& b,
+		      const RingCategories::IntegerTag & tag,
 		      const Method::BlasElimination& m)
-	{ 
+	{
 		Method::Dixon mDixon(m);
 		return solve(x, d, A, b, tag, mDixon);
-	} 
+	}
 
 	// input matrix is a DenseMatrix (no copy)
-	template <class Vector, class Ring> 
-	Vector& solve(Vector& x, typename Ring::Element &d, const DenseMatrix<Ring>& A, const Vector& b, 
-		      const RingCategories::IntegerTag & tag, 
+	template <class Vector, class Ring>
+	Vector& solve(Vector& x, typename Ring::Element &d,
+		      const DenseMatrix<Ring>& A, const Vector& b,
+		      const RingCategories::IntegerTag & tag,
 		      const Method::BlasElimination& m)
-	{ 
+	{
+		Method::Dixon mDixon(m);
+		return solve(x, d, A, b, tag, mDixon);
+	}
+
+	// input matrix is a SparseMatrix (no copy)
+	template <class Vect, class Ring>
+	Vect& solve(Vect& x, typename Ring::Element &d,
+		    const SparseMatrix<Ring, typename Vector<Ring>::SparseSeq>& A,
+		    const Vect& b,
+		    const RingCategories::IntegerTag & tag,
+		    const Method::SparseElimination& m)
+	{
 		Method::Dixon mDixon(m);
 		return solve(x, d, A, b, tag, mDixon);
 	}
@@ -354,214 +460,319 @@ namespace LinBox
 
 
 	/** \brief solver specialization with the 2nd API and DixonTraits over integer (no copying)
-	 */
-	template <class Vector, class Ring> 
-	Vector& solve(Vector& x, typename Ring::Element &d, const BlasBlackbox<Ring>& A, const Vector& b, 
+	*/
+	template <class Vector, class Ring>
+	Vector& solve(Vector& x, typename Ring::Element &d, const BlasBlackbox<Ring>& A, const Vector& b,
 		      const RingCategories::IntegerTag tag, Method::Dixon& m)
-	{ 
+	{
 		if ((A.coldim() != x.size()) || (A.rowdim() != b.size()))
 			throw LinboxError("LinBox ERROR: dimension of data are not compatible in system solving (solving impossible)");
 
 		commentator.start ("Padic Integer Blas-based Solving", "solving");
-		
+
 		typedef Modular<double> Field;
 		// 0.7213475205 is an upper approximation of 1/(2log(2))
-		RandomPrimeIterator genprime( 26-(int)ceil(log((double)A.rowdim())*0.7213475205)); 
-		RationalSolver<Ring, Field, RandomPrimeIterator, DixonTraits> rsolve(A.field(), genprime); 			
+		RandomPrimeIterator genprime( 26-(int)ceil(log((double)A.rowdim())*0.7213475205));
+		RationalSolver<Ring, Field, RandomPrimeIterator, DixonTraits> rsolve(A.field(), genprime);
 		SolverReturnStatus status = SS_OK;
 
 		// if singularity unknown and matrix is square, we try nonsingular solver
 		switch ( m.singular() ) {
 		case Specifier::SINGULARITY_UNKNOWN:
-			switch (A.rowdim() == A.coldim() ? 
-				status=rsolve.solveNonsingular(x, d, A, b, false ,m.maxTries()) : SS_SINGULAR) {				
+			switch (A.rowdim() == A.coldim() ?
+				status=rsolve.solveNonsingular(x, d, A, b, false ,m.maxTries()) : SS_SINGULAR) {
 			case SS_OK:
-				m.singular(Specifier::NONSINGULAR);				
-				break;					
+				m.singular(Specifier::NONSINGULAR);
+				break;
 			case SS_SINGULAR:
 				switch (m.solution()){
 				case DixonTraits::DETERMINIST:
-					status= rsolve.monolithicSolve(x, d, A, b, false, false, m.maxTries(), 
+					status= rsolve.monolithicSolve(x, d, A, b, false, false, m.maxTries(),
 								       (m.certificate()? SL_LASVEGAS: SL_MONTECARLO));
-					break;					
+					break;
 				case DixonTraits::RANDOM:
-					status= rsolve.monolithicSolve(x, d, A, b, false, true, m.maxTries(), 
+					status= rsolve.monolithicSolve(x, d, A, b, false, true, m.maxTries(),
 								       (m.certificate()? SL_LASVEGAS: SL_MONTECARLO));
-					break;					
+					break;
 				case DixonTraits::DIOPHANTINE:
-					{ 
+					{
 						DiophantineSolver<RationalSolver<Ring,Field,RandomPrimeIterator, DixonTraits> > dsolve(rsolve);
 						status= dsolve.diophantineSolve(x, d, A, b, m.maxTries(),
 										(m.certificate()? SL_LASVEGAS: SL_MONTECARLO));
-                                        }
-                                        break;					
+					}
+					break;
 				default:
 					break;
-				}			
+				}
 				break;
 			default:
-                                break;
+				break;
 			}
 			break;
-			
+
 		case Specifier::NONSINGULAR:
 			rsolve.solveNonsingular(x, d, A, b, false ,m.maxTries());
 			break;
-			    
+
 		case Specifier::SINGULAR:
 			switch (m.solution()){
 			case DixonTraits::DETERMINIST:
-				status= rsolve.monolithicSolve(x, d, A, b, 
-							       false, false, m.maxTries(), 
+				status= rsolve.monolithicSolve(x, d, A, b,
+							       false, false, m.maxTries(),
 							       (m.certificate()? SL_LASVEGAS: SL_MONTECARLO));
 				break;
-				
+
 			case DixonTraits::RANDOM:
-				status= rsolve.monolithicSolve(x, d, A, b, 
-							       false, true, m.maxTries(), 
+				status= rsolve.monolithicSolve(x, d, A, b,
+							       false, true, m.maxTries(),
 							       (m.certificate()? SL_LASVEGAS: SL_MONTECARLO));
 				break;
-				
+
 			case DixonTraits::DIOPHANTINE:
 				{
 					DiophantineSolver<RationalSolver<Ring,Field,RandomPrimeIterator, DixonTraits> > dsolve(rsolve);
 					status= dsolve.diophantineSolve(x, d, A, b, m.maxTries(),
 									(m.certificate()? SL_LASVEGAS: SL_MONTECARLO));
-                                }
+				}
 				break;
-				
-			//default:
-			//	break;
-			}		
-		default:			    
+
+				//default:
+				//	break;
+			}
+		default:
 			break;
 		}
 
 		commentator.stop("done", NULL, "solving");
 
-		if ( status == SS_INCONSISTENT ) {  
+		if ( status == SS_INCONSISTENT ) {
 			throw LinboxMathInconsistentSystem("Linear system is inconsistent");
-//			typename Ring::Element zero; A.field().init(zero, 0);
-// 			for (typename Vector::iterator i = x.begin(); i != x.end(); ++i) *i = zero;
+			//			typename Ring::Element zero; A.field().init(zero, 0);
+			// 			for (typename Vector::iterator i = x.begin(); i != x.end(); ++i) *i = zero;
 		}
 		return x;
-	}	
+	}
 
 	/** \brief solver specialization with the 2nd API and DixonTraits over integer (no copying)
-	 */
-	template <class Vector, class Ring> 
-	Vector& solve(Vector& x, typename Ring::Element &d, const DenseMatrix<Ring>& A, const Vector& b, 
+	*/
+	template <class Vector, class Ring>
+	Vector& solve(Vector& x, typename Ring::Element &d, const DenseMatrix<Ring>& A, const Vector& b,
 		      const RingCategories::IntegerTag tag, Method::Dixon& m)
-	{  
+	{
 		if ((A.coldim() != x.size()) || (A.rowdim() != b.size()))
 			throw LinboxError("LinBox ERROR: dimension of data are not compatible in system solving (solving impossible)");
-		
+
 		commentator.start ("Padic Integer Blas-based Solving", "solving");
-		
+
 		typedef Modular<double> Field;
 		// 0.7213475205 is an upper approximation of 1/(2log(2))
-		RandomPrimeIterator genprime( 26-(int)ceil(log((double)A.rowdim())*0.7213475205)); 
-		RationalSolver<Ring, Field, RandomPrimeIterator, DixonTraits> rsolve(A.field(), genprime); 			
+		RandomPrimeIterator genprime( 26-(int)ceil(log((double)A.rowdim())*0.7213475205));
+		RationalSolver<Ring, Field, RandomPrimeIterator, DixonTraits> rsolve(A.field(), genprime);
 		SolverReturnStatus status = SS_OK;
 		// if singularity unknown and matrix is square, we try nonsingular solver
 		switch ( m.singular() ) {
 		case Specifier::SINGULARITY_UNKNOWN:
-			switch (A.rowdim() == A.coldim() ? 
-				status=rsolve.solveNonsingular(x, d, A, b, false ,m.maxTries()) : SS_SINGULAR) {				
+			switch (A.rowdim() == A.coldim() ?
+				status=rsolve.solveNonsingular(x, d, A, b, false ,m.maxTries()) : SS_SINGULAR) {
 			case SS_OK:
-				m.singular(Specifier::NONSINGULAR);				
-				break;					
+				m.singular(Specifier::NONSINGULAR);
+				break;
 			case SS_SINGULAR:
 				switch (m.solution()){
 				case DixonTraits::DETERMINIST:
-					status= rsolve.monolithicSolve(x, d, A, b, false, false, m.maxTries(), 
+					status= rsolve.monolithicSolve(x, d, A, b, false, false, m.maxTries(),
 								       (m.certificate()? SL_LASVEGAS: SL_MONTECARLO));
-					break;					
+					break;
 				case DixonTraits::RANDOM:
-					status= rsolve.monolithicSolve(x, d, A, b, false, true, m.maxTries(), 
+					status= rsolve.monolithicSolve(x, d, A, b, false, true, m.maxTries(),
 								       (m.certificate()? SL_LASVEGAS: SL_MONTECARLO));
-					break;					
+					break;
 				case DixonTraits::DIOPHANTINE:
 					DiophantineSolver<RationalSolver<Ring,Field,RandomPrimeIterator, DixonTraits> > dsolve(rsolve);
 					status= dsolve.diophantineSolve(x, d, A, b, m.maxTries(),
 									(m.certificate()? SL_LASVEGAS: SL_MONTECARLO));
-					break;					
-				//default:
-				//	break;
-				}			
+					break;
+					//default:
+					//	break;
+				}
 				break;
 			}
-			
+
 		case Specifier::NONSINGULAR:
 			rsolve.solveNonsingular(x, d, A, b, false ,m.maxTries());
 			break;
-			    
+
 		case Specifier::SINGULAR:
 			switch (m.solution()){
 			case DixonTraits::DETERMINIST:
-				status= rsolve.monolithicSolve(x, d, A, b, 
-							       false, false, m.maxTries(), 
+				status= rsolve.monolithicSolve(x, d, A, b,
+							       false, false, m.maxTries(),
 							       (m.certificate()? SL_LASVEGAS: SL_MONTECARLO));
 				break;
-				
+
 			case DixonTraits::RANDOM:
-				status= rsolve.monolithicSolve(x, d, A, b, 
-							       false, true, m.maxTries(), 
+				status= rsolve.monolithicSolve(x, d, A, b,
+							       false, true, m.maxTries(),
 							       (m.certificate()? SL_LASVEGAS: SL_MONTECARLO));
 				break;
-				
+
 			case DixonTraits::DIOPHANTINE:
 				DiophantineSolver<RationalSolver<Ring,Field,RandomPrimeIterator, DixonTraits> > dsolve(rsolve);
 				status= dsolve.diophantineSolve(x, d, A, b, m.maxTries(),
 								(m.certificate()? SL_LASVEGAS: SL_MONTECARLO));
 				break;
-				
-			//default:
-			//	break;
-			}		
-		default:			    
+
+				//default:
+				//	break;
+			}
+		default:
 			break;
 		}
 
 		commentator.stop("done", NULL, "solving");
-		if ( status == SS_INCONSISTENT ) {  
+		if ( status == SS_INCONSISTENT ) {
 			throw LinboxMathInconsistentSystem("Linear system is inconsistent");
-// 			typename Ring::Element zero; A.field().init(zero, 0);
-// 			for (typename Vector::iterator i = x.begin(); i != x.end(); ++i) *i = zero;
+			// 			typename Ring::Element zero; A.field().init(zero, 0);
+			// 			for (typename Vector::iterator i = x.begin(); i != x.end(); ++i) *i = zero;
 		}
-		return x;	
-	}	
+		return x;
+	}
 
-	/*
-	  struct BlasEliminationCRASpecifier;
-	  // Extra case put in (1) for timing comparison or (2) for parallelism or 
-	  // (3) as an example of how we might leave an abandoned choice around in a 
-	  // callable state for future reference 
-	  template <class Vector, class Field> 
-	  Vector& solve(Vector& x, const DenseMatrix<Field>& A, const Vector& b, 
-	  const RingCategories::IntegerTag & tag, 
-	  const BlasEliminationCRASpecifier & m)
-	  { // (low priority) J-G puts in code using CRA object CRA and solve(x, A, b, ModularTag, Method::BlasElimination) 
-	  typename Field::Element zero; A.field().init(zero, 0);
-	  for (typename Vector::iterator i = x.begin(); i != x.end(); ++i) *i = zero;
-	  return x;
-	  } 
+
+
+	/** \brief solver specialization with the 2nd API and DixonTraits over integer (no copying)
 	*/
+	template <class Vect, class Ring>
+	Vect& solve(Vect& x, typename Ring::Element &d,
+		    const SparseMatrix<Ring, typename Vector<Ring>::SparseSeq> & A,
+		    const Vect& b,
+		    const RingCategories::IntegerTag tag,
+		    Method::Dixon& m)
+	{
+		if ((A.coldim() != x.size()) || (A.rowdim() != b.size()))
+			throw LinboxError("LinBox ERROR: dimension of data are not compatible in system solving (solving impossible)");
+
+		commentator.start ("Padic Integer Sparse Elimination Solving", "solving");
+
+		typedef Modular<double> Field;
+		// 0.7213475205 is an upper approximation of 1/(2log(2))
+		RandomPrimeIterator genprime( 26-(int)ceil(log((double)A.rowdim())*0.7213475205));
+		RationalSolver<Ring, Field, RandomPrimeIterator, SparseEliminationTraits> rsolve(A.field(), genprime);
+		SolverReturnStatus status = SS_OK;
+
+		// if singularity unknown and matrix is square, we try nonsingular solver
+		switch ( m.singular() ) {
+		case Specifier::SINGULARITY_UNKNOWN:
+			switch (A.rowdim() == A.coldim() ?
+				status=rsolve.solveNonsingular(x, d, A, b,m.maxTries()) : SS_SINGULAR) {
+			case SS_OK:
+				m.singular(Specifier::NONSINGULAR);
+				break;
+#if 0
+			case SS_SINGULAR:
+				switch (m.solution()){
+				case DixonTraits::DETERMINIST:
+					status= rsolve.monolithicSolve(x, d, A, b, false, false, m.maxTries(),
+								       (m.certificate()? SL_LASVEGAS: SL_MONTECARLO));
+					break;
+				case DixonTraits::RANDOM:
+					status= rsolve.monolithicSolve(x, d, A, b, false, true, m.maxTries(),
+								       (m.certificate()? SL_LASVEGAS: SL_MONTECARLO));
+					break;
+				case DixonTraits::DIOPHANTINE:
+					{
+						DiophantineSolver<RationalSolver<Ring,Field,RandomPrimeIterator, DixonTraits> > dsolve(rsolve);
+						status= dsolve.diophantineSolve(x, d, A, b, m.maxTries(),
+										(m.certificate()? SL_LASVEGAS: SL_MONTECARLO));
+					}
+					break;
+				default:
+					break;
+				}
+				break;
+#endif
+			default:
+				break;
+			}
+			break;
+
+		case Specifier::NONSINGULAR:
+			rsolve.solveNonsingular(x, d, A, b, m.maxTries());
+			break;
+
+		case Specifier::SINGULAR:
+#if 0
+			switch (m.solution()){
+			case DixonTraits::DETERMINIST:
+				status= rsolve.monolithicSolve(x, d, A, b,
+							       false, false, m.maxTries(),
+							       (m.certificate()? SL_LASVEGAS: SL_MONTECARLO));
+				break;
+
+			case DixonTraits::RANDOM:
+				status= rsolve.monolithicSolve(x, d, A, b,
+							       false, true, m.maxTries(),
+							       (m.certificate()? SL_LASVEGAS: SL_MONTECARLO));
+				break;
+
+			case DixonTraits::DIOPHANTINE:
+				{
+					DiophantineSolver<RationalSolver<Ring,Field,RandomPrimeIterator, DixonTraits> > dsolve(rsolve);
+					status= dsolve.diophantineSolve(x, d, A, b, m.maxTries(),
+									(m.certificate()? SL_LASVEGAS: SL_MONTECARLO));
+				}
+				break;
+
+				//default:
+				//	break;
+			}
+#endif
+		default:
+			break;
+		}
+
+		commentator.stop("done", NULL, "solving");
+
+		if ( status == SS_INCONSISTENT ) {
+			throw LinboxMathInconsistentSystem("Linear system is inconsistent");
+			//			typename Ring::Element zero; A.field().init(zero, 0);
+			// 			for (typename Vect::iterator i = x.begin(); i != x.end(); ++i) *i = zero;
+		}
+		return x;
+	}
+
+
+
+#if 0
+	struct BlasEliminationCRASpecifier;
+	// Extra case put in (1) for timing comparison or (2) for parallelism or
+	// (3) as an example of how we might leave an abandoned choice around in a
+	// callable state for future reference
+	template <class Vector, class Field>
+	Vector& solve(Vector& x, const DenseMatrix<Field>& A, const Vector& b,
+		      const RingCategories::IntegerTag & tag,
+		      const BlasEliminationCRASpecifier & m)
+	{ // (low priority) J-G puts in code using CRA object CRA and solve(x, A, b, ModularTag, Method::BlasElimination)
+		typename Field::Element zero; A.field().init(zero, 0);
+		for (typename Vector::iterator i = x.begin(); i != x.end(); ++i) *i = zero;
+		return x;
+	}
+#endif
 
 	// NonBlasElimination section ////////////////
 
-	template <class Vector, class BB> 
-	Vector& solve(Vector& x, const BB& A, const Vector& b, 
-		      const RingCategories::ModularTag & tag, 
+	template <class Vector, class BB>
+	Vector& solve(Vector& x, const BB& A, const Vector& b,
+		      const RingCategories::ModularTag & tag,
 		      const Method::NonBlasElimination& m)
 	{	DenseMatrix<typename BB::Field> B(A); // copy
 		return solve(x, B, b, tag, m);
 	}
 
 	// specialization when no need to copy
-	template <class Vector, class Field> 
-	Vector& solve(Vector& x, const DenseMatrix<Field>& A, const Vector& b, 
-		      const RingCategories::ModularTag & tag, 
+	template <class Vector, class Field>
+	Vector& solve(Vector& x, const DenseMatrix<Field>& A, const Vector& b,
+		      const RingCategories::ModularTag & tag,
 		      const Method::NonBlasElimination& m)
 	{ //Do we have a non blas elimination?  There was not one in the original solve.h (now algorithms/bbsolve.h).
 		return x;
@@ -571,45 +782,47 @@ namespace LinBox
 
 	// Lanczos ////////////////
 	// may throw SolverFailed or InconsistentSystem
-	
-	// 	template <class Vector, class BB> 
-	// 	Vector& solve(Vector& x, const BB& A, const Vector& b, 
-	// 		      const RingCategories::ModularTag & tag, 
-	// 		      const Method::Lanczos& m)
-	// 	{
-	// 		solve(A, x, b, A.field(), m);
-	// 		return x;
-	// 	}
-
-
-
-	// 	template <class Vector, class BB> 
-	// 	Vector& solve(Vector& x, const BB& A, const Vector& b, 
-	// 		      const RingCategories::ModularTag & tag, 
-	// 		      const Method::BlockLanczos& m)
-	// 	{
-	//             try { 
-	//                 solve(A, x, b, A.field(), m); 
-	//             } catch (SolveFailed) {
-	//                 typename BB::Field::Element zero; A.field().init(zero, 0);
-	//                 for (typename Vector::iterator i = x.begin(); 
-	//                      i != x.end(); ++i) 
-	//                     *i = zero;
-	//             }
-	//             return x;
-	// 	}
+#if 0
+
+	template <class Vector, class BB>
+	Vector& solve(Vector& x, const BB& A, const Vector& b,
+		      const RingCategories::ModularTag & tag,
+		      const Method::Lanczos& m)
+	{
+		solve(A, x, b, A.field(), m);
+		return x;
+	}
+
+
+
+	template <class Vector, class BB>
+	Vector& solve(Vector& x, const BB& A, const Vector& b,
+		      const RingCategories::ModularTag & tag,
+		      const Method::BlockLanczos& m)
+	{
+		try {
+			solve(A, x, b, A.field(), m);
+		} catch (SolveFailed) {
+			typename BB::Field::Element zero; A.field().init(zero, 0);
+			for (typename Vector::iterator i = x.begin();
+			     i != x.end(); ++i)
+				*i = zero;
+		}
+		return x;
+	}
+#endif
 
 	// Wiedemann section ////////////////
 
 	// may throw SolverFailed or InconsistentSystem
-	template <class Vector, class BB> 
-	Vector& solve(Vector& x, const BB& A, const Vector& b, 
-		      const RingCategories::ModularTag & tag, 
+	template <class Vector, class BB>
+	Vector& solve(Vector& x, const BB& A, const Vector& b,
+		      const RingCategories::ModularTag & tag,
 		      const Method::Wiedemann& m)
 	{
 		if ((A.coldim() != x.size()) || (A.rowdim() != b.size()))
 			throw LinboxError("LinBox ERROR: dimension of data are not compatible in system solving (solving impossible)");
-		
+
 		// adapt to earlier signature of wiedemann solver
 		solve(A, x, b, A.field(), m);
 		return x;
@@ -619,7 +832,7 @@ namespace LinBox
 	/* remark 1.  I used copy constructors when switching method types.
 	   But if the method types are (empty) child classes of a common  parent class containing
 	   all the information, then casts can be used in place of copies.
-	*/ 
+	   */
 
 } // LinBox
 
@@ -632,23 +845,26 @@ namespace LinBox
 #include "linbox/algorithms/matrix-hom.h"
 #include "linbox/vector/vector-traits.h"
 
-namespace LinBox {
-   
+namespace LinBox
+{
+
 
 	template <class Blackbox, class Vector, class MyMethod>
-	struct IntegerModularSolve {       
+	struct IntegerModularSolve {
 		const Blackbox &A;
 		const Vector &B;
 		const MyMethod &M;
 
-		IntegerModularSolve(const Blackbox& b, const Vector& v, const MyMethod& n) 
-			: A(b), B(v), M(n) {}
-        
-        
+		IntegerModularSolve(const Blackbox& b, const Vector& v, const MyMethod& n) :
+			A(b), B(v), M(n)
+		{}
+
+
 		template<typename Field>
-		typename Rebind<Vector, Field>::other& operator()(typename Rebind<Vector, Field>::other& x, const Field& F) const {
+		typename Rebind<Vector, Field>::other& operator()(typename Rebind<Vector, Field>::other& x, const Field& F) const
+		{
 			typedef typename Blackbox::template rebind<Field>::other FBlackbox;
-			FBlackbox * Ap;
+			FBlackbox Ap(F, A.rowdim(), A.coldim());
 			MatrixHom::map(Ap, A, F);
 
 			typedef typename Rebind<Vector, Field>::other FVector;
@@ -660,17 +876,14 @@ namespace LinBox {
 				hom.image (*Bpit, *Bit);
 
 			VectorWrapper::ensureDim (x, A.coldim());
-			solve( x, *Ap, Bp, M);
-			delete Ap;
-
-			return x;
-		}            
+			return solve( x, Ap, Bp, M);
+		}
 	};
 
 	// may throw SolverFailed or InconsistentSystem
-	template <class Vector, class BB, class MyMethod> 
-	Vector& solve(Vector& x, typename BB::Field::Element& d, const BB& A, const Vector& b, 
-		      const RingCategories::IntegerTag & tag, 
+	template <class Vector, class BB, class MyMethod>
+	Vector& solve(Vector& x, typename BB::Field::Element& d, const BB& A, const Vector& b,
+		      const RingCategories::IntegerTag & tag,
 		      const MyMethod& M)
 	{
 		if ((A.coldim() != x.size()) || (A.rowdim() != b.size()))
@@ -678,10 +891,10 @@ namespace LinBox {
 
 		commentator.start ("Integer CRA Solve", "Isolve");
 
-		RandomPrimeIterator genprime( 26 -(int)ceil(log((double)A.rowdim())*0.7213475205)); 
+		RandomPrimeIterator genprime( 26 -(int)ceil(log((double)A.rowdim())*0.7213475205));
 		//         RationalRemainder< Modular<double> > rra((double)
 		//                                                  ( A.coldim()/2.0*log((double) A.coldim()) ) );
-	
+
 		RationalRemainder< EarlyMultipRatCRA< Modular<double> > > rra(3UL);
 		IntegerModularSolve<BB,Vector,MyMethod> iteration(A, b, M);
 
@@ -690,10 +903,10 @@ namespace LinBox {
 		std::vector< Integer > num(A.coldim());
 		rra(num, den, iteration, genprime);
 		//rra(x, d, iteration, genprime);
-		
+
 		typename Vector::iterator it_x= x.begin();
 		typename std::vector<Integer>::const_iterator it_num= num.begin();
-		
+
 		// convert the result
 		for (; it_x != x.end(); ++it_x, ++it_num)
 			A.field().init(*it_x, *it_num);
@@ -702,10 +915,10 @@ namespace LinBox {
 		commentator.stop ("done", NULL, "Isolve");
 		return x;
 	}
-	
-	template <class RatVector, class Vector, class BB, class MyMethod> 
-	RatVector& solve(RatVector& x, const BB& A, const Vector& b, 
-			 const RingCategories::IntegerTag & tag, 
+
+	template <class RatVector, class Vector, class BB, class MyMethod>
+	RatVector& solve(RatVector& x, const BB& A, const Vector& b,
+			 const RingCategories::IntegerTag & tag,
 			 const MyMethod& M)
 	{
 		if ((A.coldim() != x.size()) || (A.rowdim() != b.size()))
@@ -718,19 +931,70 @@ namespace LinBox {
 		typename RatVector::iterator it_x= x.begin();
 		typename std::vector<typename BB::Field::Element>::const_iterator it_num= num.begin();
 		integer n,d;
-		A.field().convert(d,den); 
-		for (; it_x != x.end(); ++it_x, ++it_num){			
+		A.field().convert(d,den);
+		for (; it_x != x.end(); ++it_x, ++it_num){
 			A.field().convert(n, *it_num);
 			*it_x = typename RatVector::value_type(n, d);
 		}
 		commentator.stop ("done", NULL, "Rsolve");
 		return x;
 	}
-    
+
+	template <class RatVector, class Vector, class BB, class MethodTraits>
+	RatVector& solve(RatVector& x, const BB& A, const Vector& b,
+			 const RingCategories::RationalTag & tag,
+			 const MethodTraits& m)
+	{
+		if ((A.coldim() != x.size()) || (A.rowdim() != b.size()))
+			throw LinboxError("LinBox ERROR: dimension of data are not compatible in system solving (solving impossible)");
+		commentator.start ("Rational CRA Solve", "Rsolve");
+		size_t bits = 26 -(int)ceil(log((double)A.rowdim())*0.7213475205);
+		RandomPrimeIterator genprime( bits);
+		RationalRemainder2< VarPrecEarlyMultipCRA< Modular<double> > > rra(3UL);//using default RR method
+		IntegerModularSolve<BB,Vector,MethodTraits > iteration(A, b, m);
+		integer den;
+		std::vector< integer > num(A.coldim());
+		rra(num, den, iteration, genprime);
+		typename RatVector::iterator it_x= x.begin();
+		typename std::vector<integer>::const_iterator it_num= num.begin();
+		for (; it_x != x.end(); ++it_x, ++it_num){
+			integer g = gcd( *it_num, den);
+			*it_x = typename RatVector::value_type(*it_num/g, den/g);
+		}
+		commentator.stop ("done", NULL, "Rsolve");
+		return x;
+	}
+
+	template <class RatVector, class BB, class MethodTraits>
+	RatVector& solve(RatVector& x, const BB& A, const RatVector& b,
+			 const RingCategories::RationalTag & tag,
+			 const MethodTraits& m)
+	{
+		if ((A.coldim() != x.size()) || (A.rowdim() != b.size()))
+			throw LinboxError("LinBox ERROR: dimension of data are not compatible in system solving (solving impossible)");
+		commentator.start ("Rational CRA Solve", "Rsolve");
+		size_t bits = 26 -(int)ceil(log((double)A.rowdim())*0.7213475205);
+		RandomPrimeIterator genprime( bits);
+		RationalRemainder2< VarPrecEarlyMultipCRA< Modular<double> > > rra(3UL);//using default RR method
+		IntegerModularSolve<BB,RatVector,MethodTraits > iteration(A, b, m);
+		integer den;
+		std::vector< integer > num(A.coldim());
+		rra(num, den, iteration, genprime);
+		typename RatVector::iterator it_x= x.begin();
+		typename std::vector<integer>::const_iterator it_num= num.begin();
+		for (; it_x != x.end(); ++it_x, ++it_num){
+			integer g = gcd( *it_num, den);
+			*it_x = typename RatVector::value_type(*it_num/g, den/g);
+		}
+		commentator.stop ("done", NULL, "Rsolve");
+		return x;
+	}
+
 } // LinBox
 
 
 
 
-#endif // __SOLVE_H
+#endif // __LINBOX_solve_H
+
 
diff --git a/linbox/solutions/systemsolving.doxy b/linbox/solutions/systemsolving.doxy
new file mode 100644
index 0000000..922c387
--- /dev/null
+++ b/linbox/solutions/systemsolving.doxy
@@ -0,0 +1,10 @@
+// Copyright (C) 2010 LinBox, GNU LGPL, see COPYING for licence information
+
+/** @ingroup solutions
+ at defgroup systemsolving System solving
+ at brief NO DOC YET
+
+
+*/
+
+// vim:syntax=doxygen
diff --git a/linbox/solutions/trace.h b/linbox/solutions/trace.h
index 48567b9..30be1fd 100644
--- a/linbox/solutions/trace.h
+++ b/linbox/solutions/trace.h
@@ -1,196 +1,84 @@
 /* -*- 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
 /* linbox/solutions/trace.h
+ * Copyright(C) LinBox
  *  Evolved from an earlier one by Bradford Hovinen <hovinen at cis.udel.edu>
  *  -bds
  *
  * See COPYING for license information.
  */
 
-#ifndef __TRACE_H
-#define __TRACE_H
+#ifndef __LINBOX_trace_H
+#define __LINBOX_trace_H
 
 #include <vector>
-//#include <algorithm>
-
-// must fix this list...
-//#include "linbox/algorithms/wiedemann.h"
-//#include "linbox/algorithms/lanczos.h"
-//#include "linbox/algorithms/block-lanczos.h"
-#include "linbox/util/debug.h"
-#include "linbox/vector/vector-domain.h"
-#include "linbox/blackbox/dense.h"
-#include "linbox/blackbox/sparse.h"
+
 #include "linbox/blackbox/scalar-matrix.h"
-#include "linbox/solutions/methods.h"
+//#include "linbox/blackbox/toeplitz.h"
 #include "linbox/solutions/getentry.h"
-#include "linbox/blackbox/diagonal.h"
-#include "linbox/blackbox/compose.h"
 
-namespace LinBox 
+namespace LinBox
 {
 
+	// Trait to show whether or not the BB class has a local trace function.
+	template<class BB> struct TraceCategory;
 
-/* for trace we actually use only the blackbox method and local defs for sparse,
- dense, and a few other BB types.
-*/
-/** \brief sum of eigenvalues
- 
-Also sum of diagonal entries.
-This is the generic one.
+	/// undocumented
+	namespace TraceTags
+	{
+		struct Generic{};
+		struct Local{};
+	};
 
-testing multiple doc comments.
-*/
-template <class BB> 
-typename BB::Field::Element& trace(typename BB::Field::Element& t, const BB& A)
-{ return trace(t, A, Method::Hybrid()); }
+	template<class BB> struct TraceCategory		{ typedef TraceTags::Generic Tag; };
 
-// Any BBs that offer a local trace can specialize the BB class for the Hybrid method.
-/** \brief our best guess
+	template<class Field>
+	struct TraceCategory<ScalarMatrix<Field> > 	{ typedef TraceTags::Local Tag; };
 
-Hybrid method will choose based on matrix size and type
-*/
+	//template<class Field, class PD>
+	//struct TraceCategory<Toeplitz<Field,PD> >	{ typedef typename TraceTags::Local Tag; };
 
-template <class BB> 
-typename BB::Field::Element& trace(typename BB::Field::Element& t, const BB& A, 
-		const Method::Hybrid& m)
-{ return trace(t, A, Method::Blackbox(m)); }
-
-// DenseMatrix specialization
-template <class Field> 
-typename Field::Element& trace(typename Field::Element& t, const DenseMatrix<Field>& A, 
-		const Method::Hybrid& m)
-{	typename Field::Element x;
-	A.field().init(t, 0);
-	for (size_t i = 0; i < A.coldim(); ++i)  {
-		A.getEntry(x,i,i);
-		A.field().addin(t, x);
-	}
-	return t;
-}
-
-// SparseMatrix specialization
-template <class Field, class Row> 
-typename Field::Element& trace(typename Field::Element& t, const SparseMatrix<Field, Row>& A, 
-		const Method::Hybrid& m)
-{	typename Field::Element x;
-	A.field().init(t, 0);
-	for (size_t i = 0; i < A.coldim(); ++i) { 
-		A.getEntry(x,i,i);
-		A.field().addin(t, x);
-	}
-	return t;
-}
-
-// Diagonal specialization
-template <class Field, class Trait> 
-typename Field::Element& trace(typename Field::Element& t, const Diagonal<Field, Trait>& A, 
-		const Method::Hybrid& m)
-{	typename Field::Element x;
-	A.field().init(t, 0);
-	for (size_t i = 0; i < A.coldim(); ++i) { 
-		A.getEntry(x,i,i);
-		A.field().addin(t, x);
-	}
-	return t;
-}
+	// trace
+	/** \brief Sum of the eigenvalues.
 
-// scalar matrix specialization 
-template <class Field>
-typename Field::Element & trace(typename Field::Element & t, const ScalarMatrix<Field>& A, const Method::Hybrid& m) 
-{ return A.trace(t); }
+	  Also it is the sum of the diagonal entries.
 
-/** \brief our elimination (a fake in this case)
+	  Runtime on n by n matrix is n times the cost of getEntry().
+	  This is linear in n for those classes where getEntry is constant time
+	  (eg DenseMatrix and SparseMatrix).
+	  Trace is constant time when the diagonal is necessarily constant, eg. for ScalarMatrix and Toeplitz.
+	  Worst case time is cost of n blackbox applies (matrix vector products), and apply cost typically ranges between O(n) and O(n^2).
 
-Elimination method will go to blackbox.
 */
-template <class BB> 
-typename BB::Field::Element& trace(typename BB::Field::Element& t, const BB& A, const Method::Elimination& m)
-{ return trace(t, A, Method::Blackbox(m)); 
-}
-
-
-    /** Compute the trace of a linear operator A, represented as a black
-     * box. This class is parameterized by the black box type so that it can
-     * be specialized for different black boxes.
-     */
-
-template <class Blackbox>
-typename Blackbox::Field::Element &trace (typename Blackbox::Field::Element &res,
-                                          const Blackbox          &A, 
-                                          const Method::Blackbox& m)
-{
-    
-    typedef typename Blackbox::Field Field;
-    typedef std::vector<typename Field::Element> Vector;
-    Vector v, w;
-    Field F = A.field();
-    StandardBasisStream<Field, Vector> stream (F, A.coldim ());
-    
-    VectorWrapper::ensureDim (v, A.coldim ());
-    VectorWrapper::ensureDim (w, A.rowdim ());
-    
-    F.init (res, 0);
-    
-    while (stream) {
-        stream >> v;
-        A.apply (w, v);
-        F.addin (res, VectorWrapper::constRef<Field, Vector> (w, stream.pos () - 1));
-    }
-    
-    return res;
-}
-
-
-// Compose< Diagonal, BB > specialization
-template <class Field, class Trait, class BlackBox> 
-typename Field::Element& trace(typename Field::Element& t, const Compose<Diagonal<Field, Trait>, BlackBox>& A, const Method::Hybrid& m)
-{
-    typename Field::Element x, y;
-    A.field().init(t, 0);
-    size_t n = (A.coldim()<A.rowdim()?A.coldim():A.rowdim());
-    for (size_t i = 0; i < n; ++i) { 
-        getEntry(x, *(A.getRightPtr()), i, i);
-        getEntry(y, *(A.getLeftPtr()), i, i);
-        A.field().axpyin(t, x, y);
-    }
-    return t;
-}
-
-// Compose< BB, Diagonal > specialization
-template <class BlackBox, class Field, class Trait> 
-typename Field::Element& trace(typename Field::Element& t, const Compose<BlackBox, Diagonal<Field, Trait> >& A, const Method::Hybrid& m)
-{
-    typename Field::Element x, y;
-    A.field().init(t, 0);
-    size_t n = (A.coldim()<A.rowdim()?A.coldim():A.rowdim());
-    for (size_t i = 0; i < n; ++i) { 
-        getEntry(x, *(A.getRightPtr()), i, i);
-        getEntry(y, *(A.getLeftPtr()), i, i);
-        A.field().axpyin(t, x, y);
-    }
-    return t;
-}
-
-
-// Compose< Diagonal, Diagonal > specialization
-template <class Field, class T1, class T2> 
-typename Field::Element& trace(typename Field::Element& t, const Compose<Diagonal<Field,T1>, Diagonal<Field, T2> >& A, const Method::Hybrid& m)
-{
-    typename Field::Element x, y;
-    A.field().init(t, 0);
-    size_t n = (A.coldim()<A.rowdim()?A.coldim():A.rowdim());
-    for (size_t i = 0; i < n; ++i) { 
-        getEntry(x, *(A.getRightPtr()), i, i);
-        getEntry(y, *(A.getLeftPtr()), i, i);
-        A.field().axpyin(t, x, y);
-    }
-    return t;
-}
+	template <class BB>
+	typename BB::Field::Element& trace(typename BB::Field::Element& t, const BB& A)
+	{
+		typename TraceCategory<BB>::Tag tt;
+		return trace(t, A, tt);
+	}
 
+	/* Generic approach.  It will be efficient for BBs with efficient getEntry.
+	   If getEntry is constant time on n by n BB's, trace will be in O(n).
+	   */
+	template <class BB>
+	typename BB::Field::Element& trace(typename BB::Field::Element& t, const BB& A, TraceTags::Generic tt)
+	{
+		typename BB::Field::Element x;
+		A.field().init(x, 0);
+		A.field().init(t, 0);
+		for (size_t i = 0; i < A.coldim(); ++i)
+			A.field().addin(t, getEntry(x,A,i,i));
+		return t;
+	}
 
-}
+	/* Specialization for BB's with local trace function.
+	   Allows constant time trace for, eg., ScalarMatrix, Toeplitz.
+	   */
+	template <class BB>
+	typename BB::Field::Element & trace(typename BB::Field::Element & t, const BB& A, TraceTags::Local tt)
+	{ return A.trace(t); }
 
+}; // namespace LinBox
 
+#endif // __LINBOX_trace_H
 
-#endif // __TRACE_H
diff --git a/linbox/solutions/valence.h b/linbox/solutions/valence.h
index 8b3265c..30c3f17 100644
--- a/linbox/solutions/valence.h
+++ b/linbox/solutions/valence.h
@@ -1,32 +1,51 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-// ======================================================================= //
-// Copyright (C)  1999, Linbox project
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) 1999 LinBox
+ * Written by <Jean-Guillaume.Dumas at imag.fr>
+ * Modified by Z. Wan to fit in linbox
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
 // Givaro / Athapascan-1
 // Valence computation
-// Time-stamp: <09 Mar 07 18:34:05 Jean-Guillaume.Dumas at imag.fr> 
-// ======================================================================= //
-// Modified by Z. Wan to fit in linbox
-#ifndef __LINBOX_VALENCE_H__
-#define __LINBOX_VALENCE_H__
+
+#ifndef __LINBOX_valence_H
+#define __LINBOX_valence_H
 
 #include <vector>
 #include <linbox/blackbox/transpose.h>
 
 #include <linbox/solutions/minpoly.h>
 
-namespace LinBox 
+namespace LinBox
 {
-	
+
 	/*- @brief Valence of a blackbox linear operator A.
-         * This is the coefficient of the smallest degree
-         * non zero monomial of the minimal polynomial of A.
+	 * This is the coefficient of the smallest degree
+	 * non zero monomial of the minimal polynomial of A.
 	 * The resulting value is a Field Element.
 	 */
 	template < class Blackbox, class DomainCategory, class MyMethod>
 	typename Blackbox::Field::Element &valence (typename Blackbox::Field::Element & V,
-                                                    const Blackbox& A,
-                                                    const DomainCategory& tag,
-                                                    const MyMethod& M);
+						    const Blackbox& A,
+						    const DomainCategory& tag,
+						    const MyMethod& M);
 
 
 	/** \brief Compute the valence of A
@@ -37,253 +56,279 @@ namespace LinBox
 	 * @param v Field element into which to store the result
 	 * @param A Black box of which to compute the determinant
 	 * @param M may is a Method.
-         \ingroup solutions
-        */
-    template <class Blackbox, class MyMethod>
-    typename Blackbox::Field::Element &valence (typename Blackbox::Field::Element         &v, 
-                                                const Blackbox                              &A,
-                                                const MyMethod                           &M) 
-    {
-        return valence(v, A, typename FieldTraits<typename Blackbox::Field>::categoryTag(), M);
-    }
-
-	// The valence with default Method 
-    template<class Blackbox>
-    typename Blackbox::Field::Element &valence (typename Blackbox::Field::Element         &v, 
-                                                const Blackbox                               &A)
-    {
-        return valence(v, A, Method::Hybrid());
-    }
-
-    template<class Blackbox, class MyMethod>
-    typename Blackbox::Field::Element &valence (
-	typename Blackbox::Field::Element         &v, 
-        const Blackbox                            &A,
-        const RingCategories::ModularTag          &tag,
-	const MyMethod& M)
-    {
-        typedef typename Blackbox::Field::Element Elt_t;
-        std::vector<Elt_t> minp;
-        minpoly(minp, A, tag, M);
-        typename std::vector<Elt_t>::const_iterator it = minp.begin();
-        for( ; it != minp.end(); ++it)
-            if (! A.field().isZero(*it)) break;
-        if (it != minp.end())
-            return v=*it;
-        else
-            return A.field().init(v,0UL);
-    }
+	 \ingroup solutions
+	 */
+	template <class Blackbox, class MyMethod>
+	typename Blackbox::Field::Element &valence (typename Blackbox::Field::Element         &v,
+						    const Blackbox                              &A,
+						    const MyMethod                           &M)
+	{
+		return valence(v, A, typename FieldTraits<typename Blackbox::Field>::categoryTag(), M);
+	}
+
+	// The valence with default Method
+	template<class Blackbox>
+	typename Blackbox::Field::Element &valence (typename Blackbox::Field::Element         &v,
+						    const Blackbox                               &A)
+	{
+		return valence(v, A, Method::Hybrid());
+	}
+
+	template<class Blackbox, class MyMethod>
+	typename Blackbox::Field::Element &valence (
+						    typename Blackbox::Field::Element         &v,
+						    const Blackbox                            &A,
+						    const RingCategories::ModularTag          &tag,
+						    const MyMethod& M)
+	{
+		typedef typename Blackbox::Field::Element Elt_t;
+		std::vector<Elt_t> minp;
+		minpoly(minp, A, tag, M);
+		typename std::vector<Elt_t>::const_iterator it = minp.begin();
+		for( ; it != minp.end(); ++it)
+			if (! A.field().isZero(*it)) break;
+		if (it != minp.end())
+			return v=*it;
+		else
+			return A.field().init(v,0UL);
+	}
 
 }
 
-#include "linbox/field/modular.h"
+#include "linbox/field/modular-double.h"
+#include "linbox/field/givaro-zpz.h"
 #include "linbox/algorithms/cra-domain.h"
 #include "linbox/algorithms/cra-early-single.h"
 #include "linbox/randiter/random-prime.h"
 #include "linbox/algorithms/matrix-hom.h"
+#include <typeinfo>
+
+namespace LinBox
+{
+
+	template <class Blackbox, class MyMethod>
+	struct IntegerModularValence {
+		const Blackbox &A;
+		const MyMethod &M;
+
+		IntegerModularValence(const Blackbox& b, const MyMethod& n) :
+			A(b), M(n)
+		{}
+
+
+		template<typename Field>
+		typename Field::Element& operator()(typename Field::Element& v, const Field& F) const
+		{
+			commentator.start ("Modular Valence", "Mvalence");
+			std::ostream& report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+			F.write(report) << std::endl;
+			typedef typename Blackbox::template rebind<Field>::other FBlackbox;
+			report << typeid(A).name() << ", A is: " << A.rowdim() << 'x' << A.coldim() << std::endl;
+
+			FBlackbox Ap(A, F);
+
+			report << typeid(Ap).name() << ", Ap is: " << Ap.rowdim() << 'x' << Ap.coldim() << std::endl;
+
+			valence( v, Ap, M);
+			F.write( F.write(report << "one valence: ", v) << " mod " ) << std::endl;;
+			commentator.stop ("done", NULL, "Mvalence");
+			return v;
+		}
+	};
+
+	template <class Blackbox, class MyMethod>
+	typename Blackbox::Field::Element &valence (typename Blackbox::Field::Element &V,
+						    const Blackbox                     &A,
+						    const RingCategories::IntegerTag   &tag,
+						    const MyMethod                     &M)
+	{
+		commentator.start ("Integer Valence", "Ivalence");
+#if __LINBOX_SIZEOF_LONG == 8
+		RandomPrimeIterator genprime( 31 );
+		ChineseRemainder< EarlySingleCRA< GivaroZpz< ::Givaro::Std64> > > cra(3UL);
+#else
+		RandomPrimeIterator genprime( 26 );
+		ChineseRemainder< EarlySingleCRA< Modular<double> > > cra(3UL);
+#endif
+		IntegerModularValence<Blackbox,MyMethod> iteration(A, M);
+		cra(V, iteration, genprime);
+		commentator.stop ("done", NULL, "Ivalence");
+		return V;
+	}
+
 
-namespace LinBox {
-   
-    template <class Blackbox, class MyMethod>
-    struct IntegerModularValence {       
-        const Blackbox &A;
-        const MyMethod &M;
-
-        IntegerModularValence(const Blackbox& b, const MyMethod& n) 
-                : A(b), M(n) {}
-        
-        
-        template<typename Field>
-	typename Field::Element& operator()(typename Field::Element& v, const Field& F) const {
-            typedef typename Blackbox::template rebind<Field>::other FBlackbox;
-            FBlackbox * Ap;
-            MatrixHom::map(Ap, A, F);
-            valence( v, *Ap, M);
-            delete Ap;
-            return v;
-        }            
-    };
-
-    template <class Blackbox, class MyMethod>
-	typename Blackbox::Field::Element &valence (typename Blackbox::Field::Element &V, 
-                                                    const Blackbox                     &A,
-                                                    const RingCategories::IntegerTag   &tag,
-                                                    const MyMethod                     &M)
-    {
-        commentator.start ("Integer Valence", "Ivalence");
-        RandomPrimeIterator genprime( 26 ); 
-        ChineseRemainder< EarlySingleCRA< Modular<double> > > cra(3UL);
-        IntegerModularValence<Blackbox,MyMethod> iteration(A, M);
-        cra(V, iteration, genprime);
-        commentator.stop ("done", NULL, "Ivalence");
-        return V;
-    }
-
-    
 } //End of LinBox
 
 
-namespace LinBox {
-	
+namespace LinBox
+{
+
 
-class Valence {
+	class Valence {
 	public:
 
-	// compute the bound for eigenvalue of AAT via oval of cassini
-	// works with both SparseMatrix and DenseMatrix
-	template <class Blackbox>
-	static integer& cassini (integer& r, const Blackbox& A) {
-		//commentator.start ("Cassini bound", "cassini");
-    	integer _aat_diag, _aat_radius, _aat_radius1;
-    	typedef typename Blackbox::Field Ring;
-		_aat_diag = 0; _aat_radius = 0, _aat_radius1 = 0;
-
-        std::vector< integer > d(A. rowdim()),w(A. coldim());
-        std::vector<integer>::iterator di, wi;
-        for(wi = w.begin();wi!= w.end();++wi) 
-            *wi = 0;
-        for(di = d.begin();di!= d.end();++di) 
-            *di = 0;
-		//typename Blackbox::ConstRowIterator row_p;
-		typename Blackbox::Element tmp_e;
-		Ring R(A. field());
-		integer tmp; size_t i, j;
-	
-		for (j = 0, di = d. begin(); j < A. rowdim(); ++ j, ++ di) {
-			// not efficient, but I am not tired of doing case by case
-			for ( i = 0; i < A. coldim(); ++ i) {
-				R. assign(tmp_e, A.getEntry( j, i));
-				R. convert (tmp, tmp_e);
-				if (tmp != 0) {
-					*di += tmp * tmp;
-					w [(int) i] += abs (tmp);
-				}
+		// compute the bound for eigenvalue of AAT via oval of cassini
+		// works with both SparseMatrix and DenseMatrix
+		template <class Blackbox>
+		static integer& cassini (integer& r, const Blackbox& A)
+		{
+			//commentator.start ("Cassini bound", "cassini");
+			integer _aat_diag, _aat_radius, _aat_radius1;
+			typedef typename Blackbox::Field Ring;
+			_aat_diag = 0; _aat_radius = 0, _aat_radius1 = 0;
+
+			std::vector< integer > d(A. rowdim()),w(A. coldim());
+			std::vector<integer>::iterator di, wi;
+			for(wi = w.begin();wi!= w.end();++wi)
+				*wi = 0;
+			for(di = d.begin();di!= d.end();++di)
+				*di = 0;
+			//typename Blackbox::ConstRowIterator row_p;
+			typename Blackbox::Element tmp_e;
+			Ring R(A. field());
+			integer tmp; size_t i, j;
 
-            _aat_diag = _aat_diag >= *di ? _aat_diag : *di;
-            }
-        }
-
-		for (j = 0, di = d. begin(); j < A. rowdim(); ++ j, ++ di) {
-           	integer local_radius = 0;
-			for (i = 0; i < A. coldim(); ++ i) {
-				R. assign (tmp_e, A. getEntry (j, i));
-				R. convert (tmp, tmp_e);
-				if (tmp != 0) 
-					local_radius += abs (tmp) * w[(int)i];
+			for (j = 0, di = d. begin(); j < A. rowdim(); ++ j, ++ di) {
+				// not efficient, but I am not tired of doing case by case
+				for ( i = 0; i < A. coldim(); ++ i) {
+					R. assign(tmp_e, A.getEntry( j, i));
+					R. convert (tmp, tmp_e);
+					if (tmp != 0) {
+						*di += tmp * tmp;
+						w [(int) i] += abs (tmp);
+					}
+
+					_aat_diag = _aat_diag >= *di ? _aat_diag : *di;
+				}
 			}
-			local_radius -= *di;
-			if ( local_radius > _aat_radius1) {
-				if ( local_radius > _aat_radius) {
-					_aat_radius1 = _aat_radius;
-					_aat_radius = local_radius;
-				} else
-					_aat_radius1 = local_radius;
+
+			for (j = 0, di = d. begin(); j < A. rowdim(); ++ j, ++ di) {
+				integer local_radius = 0;
+				for (i = 0; i < A. coldim(); ++ i) {
+					R. assign (tmp_e, A. getEntry (j, i));
+					R. convert (tmp, tmp_e);
+					if (tmp != 0)
+						local_radius += abs (tmp) * w[(int)i];
+				}
+				local_radius -= *di;
+				if ( local_radius > _aat_radius1) {
+					if ( local_radius > _aat_radius) {
+						_aat_radius1 = _aat_radius;
+						_aat_radius = local_radius;
+					}
+					else
+						_aat_radius1 = local_radius;
+				}
 			}
+
+			r = _aat_diag + (integer)sqrt( _aat_radius * _aat_radius1 );
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+			//std::cout << "Cassini bound (AAT) =: " << r << std::endl;
+			//commentator. stop ("done", NULL, "cassini");
+			return r;
 		}
 
-        r = _aat_diag + (integer)sqrt( _aat_radius * _aat_radius1 );
-	commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-	//std::cout << "Cassini bound (AAT) =: " << r << std::endl;
-		//commentator. stop ("done", NULL, "cassini");
-		return r;
-    }   
-
-	// compute one valence of AAT over a field
-	template <class Blackbox>
-	static void one_valence(typename Blackbox::Element& v, unsigned long& r, const Blackbox& A) {
-		//commentator.start ("One valence", "one valence");
-		typedef std::vector<typename Blackbox::Element> Poly; Poly poly;
-		typename Blackbox::Field F(A. field());
-		Transpose<Blackbox> AT (&A);
-		Compose<Blackbox, Transpose<Blackbox> > AAT(&A, &AT);
-		// compute the minpoly of AAT
-		minpoly(poly, AAT, Method::Wiedemann());
-		typename Poly::iterator p;
-		F. init (v, 0);
-
-		for (p = poly. begin(); p != poly. end(); ++ p)
-			if (! F. isZero (*p)) {
-				F. assign (v, *p);
-				break;
-			}
-		
-		r = poly. size() -1;
-		std::ostream& report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-			
-		//	std::ostream& report = std::cout;
-		report << "one valence =: " << v << " over ";
-		A. field(). write(report); report << std::endl;
-		//commentator. stop ("done", NULL, "one valence");
-		return;
-	}
+		// compute one valence of AAT over a field
+		template <class Blackbox>
+		static void one_valence(typename Blackbox::Element& v, unsigned long& r, const Blackbox& A)
+		{
+			//commentator.start ("One valence", "one valence");
+			typedef std::vector<typename Blackbox::Element> Poly; Poly poly;
+			typename Blackbox::Field F(A. field());
+			Transpose<Blackbox> AT (&A);
+			Compose<Blackbox, Transpose<Blackbox> > AAT(&A, &AT);
+			// compute the minpoly of AAT
+			minpoly(poly, AAT, Method::Wiedemann());
+			typename Poly::iterator p;
+			F. init (v, 0);
+
+			for (p = poly. begin(); p != poly. end(); ++ p)
+				if (! F. isZero (*p)) {
+					F. assign (v, *p);
+					break;
+				}
+
+			r = poly. size() -1;
+			std::ostream& report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
 
-	// compute the valence of AAT over an integer ring
-	template <class Blackbox>
-	static void valence(Integer& val, const Blackbox& A) {
-		commentator. start ("Valence (AAT)", "Valence");
-		typedef Modular<int32> Field;
-		typedef typename MatrixHomTrait<Blackbox, Field>::value_type FBlackbox;
-		FBlackbox* Ap;
-		int n_bit = (int)(log((double)Field::getMaxModulus()) / M_LN2 - 2);
-		unsigned long d; 
-                RandomPrimeIterator g(n_bit); Field::Element v;
-		++g; Field F(*g);
-		MatrixHom::map (Ap, A, F);
-		one_valence(v, d, *Ap); delete Ap;
-		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-		//std::cout<<"degree of minpoly of AAT: " << d << std::endl;
-		valence (val, d, A);
-		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION)
+			//	std::ostream& report = std::cout;
+			report << "one valence =: " << v << " over ";
+			A. field(). write(report); report << std::endl;
+			//commentator. stop ("done", NULL, "one valence");
+			return;
+		}
+
+		// compute the valence of AAT over an integer ring
+		template <class Blackbox>
+		static void valence(Integer& val, const Blackbox& A)
+		{
+			commentator. start ("Valence (AAT)", "Valence");
+			typedef Modular<int32_t> Field;
+			typedef typename MatrixHomTrait<Blackbox, Field>::value_type FBlackbox;
+			double log_max_mod = log((double)FieldTraits<Field>::maxModulus()) ;
+			int n_bit = (int)(log_max_mod / M_LN2 - 2);
+			unsigned long d;
+			RandomPrimeIterator g(n_bit); Field::Element v;
+			++g; Field F(*g);
+			FBlackbox Ap(A, F);
+			one_valence(v, d, Ap);
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+			//std::cout<<"degree of minpoly of AAT: " << d << std::endl;
+			valence (val, d, A);
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION)
 			<< "Integer valence =: " << val << std::endl;
-		commentator. stop ("done", NULL, "Valence");
-		return;
-	}
+			commentator. stop ("done", NULL, "Valence");
+			return;
+		}
 
-	// compute the valence of AAT over an integer ring
-	// d, the degree of min_poly of AAT
-	template <class Blackbox>
-	static void valence(Integer& val, unsigned long d, const Blackbox& A) {
-
-		typedef Modular<int32> Field;
-		typedef typename MatrixHomTrait<Blackbox, Field>::value_type FBlackbox;
-		FBlackbox* Ap;
-		int n_bit = (int)(log((double)Field::getMaxModulus()) / M_LN2 - 2);
-                RandomPrimeIterator rg(n_bit);
-		std::vector<integer> Lv, Lm;
-		unsigned long d1; Field::Element v; integer im = 1;
-		//compute an upper bound for val.
-		integer bound; cassini (bound, A); bound = pow (bound, d); bound *= 2;
-		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION)
+		// compute the valence of AAT over an integer ring
+		// d, the degree of min_poly of AAT
+		template <class Blackbox>
+		static void valence(Integer& val, unsigned long d, const Blackbox& A)
+		{
+
+			typedef Modular<int32_t> Field;
+			typedef typename MatrixHomTrait<Blackbox, Field>::value_type FBlackbox;
+
+			double log_max_mod = log((double)FieldTraits<Field>::maxModulus()) ;
+			int n_bit = (int)(log_max_mod / M_LN2 - 2);
+			RandomPrimeIterator rg(n_bit);
+			std::vector<integer> Lv, Lm;
+			unsigned long d1; Field::Element v; integer im = 1;
+			//compute an upper bound for val.
+			integer bound; cassini (bound, A); bound = pow (bound, d); bound *= 2;
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION)
 			<< "Bound for valence: " << bound << std::endl;
 
-		do {
-			++rg;
-			Field F(*rg);
-			MatrixHom::map (Ap, A, F);
-			one_valence(v, d1, *Ap); delete Ap;
-			if (d1 == d) {
-				im *= *rg;
-				Lm. push_back ( *rg ); Lv. push_back (integer(v));
+			do {
+				++rg;
+				Field F(*rg);
+				FBlackbox Ap(A, F);
+				one_valence(v, d1, Ap);
+				if (d1 == d) {
+					im *= *rg;
+					Lm. push_back ( *rg ); Lv. push_back (integer(v));
+				}
+			} while (im < bound);
+
+			val = 0;
+			std::vector<integer>::iterator Lv_p, Lm_p; integer tmp, a, b, g;
+			for (Lv_p = Lv. begin(), Lm_p = Lm. begin(); Lv_p != Lv. end(); ++ Lv_p, ++ Lm_p) {
+				tmp = im / *Lm_p;
+				gcd (g, *Lm_p, tmp, a, b);
+				val += *Lv_p * b * tmp;
+				val %= im;
 			}
-		} while (im < bound);
-
-		val = 0;
-		std::vector<integer>::iterator Lv_p, Lm_p; integer tmp, a, b, g;
-		for (Lv_p = Lv. begin(), Lm_p = Lm. begin(); Lv_p != Lv. end(); ++ Lv_p, ++ Lm_p) {
-			tmp = im / *Lm_p;
-			gcd (g, *Lm_p, tmp, a, b);
-			val += *Lv_p * b * tmp;
-			val %= im;
-		}
 
-		if (sign (val) < 0)
-			val += im;
-		tmp = val - im;
-		if (abs(tmp) < abs(val)) 
-			val = tmp;
+			if (sign (val) < 0)
+				val += im;
+			tmp = val - im;
+			if (abs(tmp) < abs(val))
+				val = tmp;
 
-		return;
-	}
-};
+			return;
+		}
+	};
 } //End of LinBox
-#endif
+#endif //__LINBOX_valence_H
+
diff --git a/linbox/switch/Makefile.am b/linbox/switch/Makefile.am
index 6ac2f51..fc68875 100644
--- a/linbox/switch/Makefile.am
+++ b/linbox/switch/Makefile.am
@@ -1,3 +1,6 @@
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 pkgincludesubdir=$(pkgincludedir)/switch
 
 pkgincludesub_HEADERS=		\
diff --git a/linbox/switch/Makefile.in b/linbox/switch/Makefile.in
index 870e4f4..b0c97b9 100644
--- a/linbox/switch/Makefile.in
+++ b/linbox/switch/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -37,19 +38,26 @@ DIST_COMMON = $(pkgincludesub_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
-	$(top_srcdir)/macros/blas-check.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
 	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
 	$(top_srcdir)/macros/givaro-check.m4 \
 	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
 	$(top_srcdir)/macros/lidia-check.m4 \
 	$(top_srcdir)/macros/linbox-doc.m4 \
 	$(top_srcdir)/macros/linbox-misc.m4 \
 	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
 	$(top_srcdir)/macros/maple-check.m4 \
 	$(top_srcdir)/macros/ntl-check.m4 \
 	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -79,18 +87,21 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
 CC = @CC@
+CCNAM = @CCNAM@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
 DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -98,19 +109,24 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
 GIVARO_CFLAGS = @GIVARO_CFLAGS@
 GIVARO_LIBS = @GIVARO_LIBS@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
 GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
@@ -118,41 +134,52 @@ LIBTOOL = @LIBTOOL@
 LIDIA_CFLAGS = @LIDIA_CFLAGS@
 LIDIA_LIBS = @LIDIA_LIBS@
 LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MAPLE_CFLAGS = @MAPLE_CFLAGS@
 MAPLE_HOME = @MAPLE_HOME@
 MAPLE_LIBS = @MAPLE_LIBS@
 MAPLE_VERSION = @MAPLE_VERSION@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
 NTL_CFLAGS = @NTL_CFLAGS@
 NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RM = @RM@
 SACLIB_CFLAGS = @SACLIB_CFLAGS@
 SACLIB_LIBS = @SACLIB_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+TESTS_CFLAGS = @TESTS_CFLAGS@
 VERSION = @VERSION@
+WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -193,8 +220,13 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 pkgincludesubdir = $(pkgincludedir)/switch
 pkgincludesub_HEADERS = \
 	boolean.h		\
@@ -207,8 +239,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
 	      exit 1;; \
 	  esac; \
 	done; \
@@ -261,7 +293,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
@@ -374,6 +406,8 @@ dvi-am:
 
 html: html-am
 
+html-am:
+
 info: info-am
 
 info-am:
@@ -382,18 +416,28 @@ install-data-am: install-pkgincludesubHEADERS
 
 install-dvi: install-dvi-am
 
+install-dvi-am:
+
 install-exec-am:
 
 install-html: install-html-am
 
+install-html-am:
+
 install-info: install-info-am
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-am
 
+install-pdf-am:
+
 install-ps: install-ps-am
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
diff --git a/linbox/switch/boolean.h b/linbox/switch/boolean.h
index 35d9cd4..455081b 100644
--- a/linbox/switch/boolean.h
+++ b/linbox/switch/boolean.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/switch/boolean.h
  * Copyright (C) 1999-2001 William J Turner
  *
@@ -30,133 +30,141 @@
  * See COPYING for license information.
  */
 
-#ifndef __BOOLEAN_H
-#define __BOOLEAN_H
+#ifndef __LINBOX_boolean_H
+#define __LINBOX_boolean_H
 
 #include <vector>
 
 namespace LinBox
 {
 
-class BooleanSwitchFactory;
-
-/** Boolean switch object.
- * This is a switch predicate object that is applied
- * to two references to elements to switch them as needed 
- * by the \Ref{Butterfly Switching Network BlackBox Matrix Object}.
- */
-class BooleanSwitch
-{
-    public:
-
-	typedef BooleanSwitchFactory Factory;
-
-	/** Constructor from an STL vector of booleans.
-	 * The switch is applied using the vector of booleans.
-	 * A true value means to swap the two elements, and a false
-	 * value means not to.
-	 * The apply function starts at the beginning of the vector moving 
-	 * forward through it, and applyTranspose function starts at the end
-	 * moving backwards.  Both repeat the vector after they pass through it.
-	 * @param switches vector of switches
-	 */
-	BooleanSwitch (const bool s)
-		: _s (s)
-	{}
+	class BooleanSwitchFactory;
 
-	/** Destructor.
-	 */
-	~BooleanSwitch () {}
-
-	/** Apply switch function.
-	 * Switches the elements in references according to current boolean
-	 * value.  Swaps the elements if boolean is true, otherwise does nothing.
-	 * It is templatized by the element type to be swapped.
-	 * @return bool true if swapped, false otherwise
-	 * @param x reference to first element to be switched
-	 * @param y reference to second element to be switched
+	/** Boolean switch object.
+	 * This is a switch predicate object that is applied
+	 * to two references to elements to switch them as needed
+	 * by the \ref Butterfly\ Switching\ Network\ BlackBox\ Matrix\ Object.
 	 */
-	template <class Field>
-	bool apply (const Field             &F,
-		    typename Field::Element &x,
-		    typename Field::Element &y) const;
-
-	/** Apply switch transpose function.
-	 * Switches the elements in references according to current boolean
-	 * value.  Swaps the elements if boolean is true, otherwise does nothing.
-	 * It is templatized by the element type to be swapped.
-	 * @return bool true if swapped, false otherwise
-	 * @param x reference to first element to be switched
-	 * @param y reference to second element to be switched
+	class BooleanSwitch {
+	public:
+
+		typedef BooleanSwitch Self_t;
+		typedef BooleanSwitchFactory Factory;
+
+		/** Constructor from an STL vector of booleans.
+		 * The switch is applied using the vector of booleans.
+		 * A true value means to swap the two elements, and a false
+		 * value means not to.
+		 * The apply function starts at the beginning of the vector moving
+		 * forward through it, and applyTranspose function starts at the end
+		 * moving backwards.  Both repeat the vector after they pass through it.
+		 * @param s vector of switches
+		 */
+		BooleanSwitch (const bool s) :
+		       	_s (s)
+		{}
+
+		/** Destructor.
+		*/
+		~BooleanSwitch () {}
+
+		/** Apply switch function.
+		 * Switches the elements in references according to current boolean
+		 * value.  Swaps the elements if boolean is true, otherwise does nothing.
+		 * It is templatized by the element type to be swapped.
+		 * @return bool \c true if swapped, \c false otherwise
+		 * @param F
+		 * @param x reference to first element to be switched
+		 * @param y reference to second element to be switched
+		 */
+		template <class Field>
+		bool apply (const Field             &F,
+			    typename Field::Element &x,
+			    typename Field::Element &y) const;
+
+		/** Apply switch transpose function.
+		 * Switches the elements in references according to current boolean
+		 * value.  Swaps the elements if boolean is true, otherwise does nothing.
+		 * It is templatized by the element type to be swapped.
+		 * @return bool \c true if swapped, \c false otherwise
+		 * @param F
+		 * @param x reference to first element to be switched
+		 * @param y reference to second element to be switched
+		 */
+		template <class Field>
+		bool applyTranspose (const Field             &F,
+				     typename Field::Element &x,
+				     typename Field::Element &y) const;
+
+		template<typename _Tp1>
+		struct rebind {
+			typedef BooleanSwitch other;
+
+		};
+
+	protected:
+
+		bool _s;
+
+	}; // class boolean_switch
+
+	/** Boolean switch factory
+	 *
+	 * This class facilitates construction of boolean switch objects by the
+	 * butterfly matrix.
 	 */
-	template <class Field>
-	bool applyTranspose (const Field             &F,
-			     typename Field::Element &x,
-			     typename Field::Element &y) const;
-
-    private:
 
-	bool _s;
+	class BooleanSwitchFactory {
+	public:
+		/** Constructor from an STL vector of bools
+		*/
+		BooleanSwitchFactory (const std::vector<bool> &switches) :
+		       	_switches (switches), _iter (switches.begin ())
+		{}
+
+		/** Construct and return a boolean switch object
+		 *
+		 * This function walks through the switches object given in the
+		 * constructor, advancing on each invocation. It wraps around to the
+		 * beginning of the vector when it reaches the end.
+		 */
+		BooleanSwitch makeSwitch ()
+		{
+			if (_iter == _switches.end ())
+				_iter = _switches.begin ();
+
+			return BooleanSwitch (*_iter++);
+		}
+
+	private:
+
+		const std::vector<bool> &_switches;
+		std::vector<bool>::const_iterator _iter;
+	};
 
-}; // class boolean_switch
-
-/** Boolean switch factory
- *
- * This class facilitates construction of boolean switch objects by the
- * butterfly matrix.
- */
-
-class BooleanSwitchFactory 
-{
-    public:
-	/** Constructor from an STL vector of bools
-	 */
-	BooleanSwitchFactory (const std::vector<bool> &switches)
-		: _switches (switches), _iter (switches.begin ())
-	{}
-
-	/** Construct and return a boolean switch object
-	 *
-	 * This function walks through the switches object given in the
-	 * constructor, advancing on each invocation. It wraps around to the
-	 * beginning of the vector when it reaches the end.
-	 */
-	BooleanSwitch makeSwitch ()
+	template <class Field>
+	inline bool BooleanSwitch::apply (const Field             &F,
+					  typename Field::Element &x,
+					  typename Field::Element &y) const
 	{
-		if (_iter == _switches.end ())
-			_iter = _switches.begin ();
+		if (_s)
+			std::swap (x, y);
 
-		return BooleanSwitch (*_iter++);
+		return _s;
 	}
 
-    private:
-
-	const std::vector<bool> &_switches;
-	std::vector<bool>::const_iterator _iter;
-};
-
-template <class Field> 
-inline bool BooleanSwitch::apply (const Field             &F,
-				  typename Field::Element &x,
-				  typename Field::Element &y) const
-{
-	if (_s)
-		std::swap (x, y);
+	template <class Field>
+	inline bool BooleanSwitch::applyTranspose (const Field             &F,
+						   typename Field::Element &x,
+						   typename Field::Element &y) const
+	{
+		if (_s)
+			std::swap (x, y);
 
-	return _s;
-}
-  
-template <class Field> 
-inline bool BooleanSwitch::applyTranspose (const Field             &F,
-					   typename Field::Element &x,
-					   typename Field::Element &y) const
-{
-	if (_s)
-		std::swap (x, y);
+		return _s;
+	}
 
-	return _s;
 }
 
-}
+#endif // __LINBOX_boolean_H
 
-#endif // __BOOLEAN_H
diff --git a/linbox/switch/cekstv.h b/linbox/switch/cekstv.h
index 8ab013e..1e03a65 100644
--- a/linbox/switch/cekstv.h
+++ b/linbox/switch/cekstv.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/switch/cekstv.h
  * Copyright (C) 1999-2001 William J Turner
  *
@@ -8,16 +8,16 @@
  * -----------------------------------------------------------
  * 2002-09-26  Bradford Hovinen  <bghovinen at math.uwaterloo.ca>
  *
- * Refactoring: The switch object now contains only the information for one 2x2	
- * block. A vector of switches is maintained by the butterfly preconditioner	
- * instead of the switch object. Since there will be many switch objects, they	
+ * Refactoring: The switch object now contains only the information for one 2x2
+ * block. A vector of switches is maintained by the butterfly preconditioner
+ * instead of the switch object. Since there will be many switch objects, they
  * should be kept very lightweight, so the field is not maintained in the object
- * itself, but instead passed to apply and applyTranspose. Since those methods	
- * are inline, this does not create overhead. apply and applyTranspose now take	
- * four field elements: the source elements and destination elements. This	
- * eliminates the need to keep an additional temporary in the class, and	
+ * itself, but instead passed to apply and applyTranspose. Since those methods
+ * are inline, this does not create overhead. apply and applyTranspose now take
+ * four field elements: the source elements and destination elements. This
+ * eliminates the need to keep an additional temporary in the class, and
  * eliminates the need for copying in the butterfly.
- * 
+ *
  * -----------------------------------------------------------
  * 2002-08-20  Bradford Hovinen  <hovinen at cis.udel.edu>
  *
@@ -30,126 +30,145 @@
  * See COPYING for license information.
  */
 
-#ifndef __CEKSTV_H
-#define __CEKSTV_H
+#ifndef __LINBOX_cekstv_H
+#define __LINBOX_cekstv_H
 
 #include <vector>
 
 namespace LinBox
 {
 
-template <class Field>
-class CekstvSwitchFactory;
-
-/** Butterfly switch object from preconditioner paper.
- * This is a switch predicate object that is applied
- * to two references to elements to switch them as needed 
- * by the \Ref{Butterfly Switching Network BlackBox Matrix Object}
- * following the exchange matrix introduced in "Efficient Matrix
- * Preconditioners for Black Box Linear Algebra" by Chen, Eberly, 
- * Kaltofen, Saunders, Turner, and Villard.
- * This class is templatized by the field in which the arithmetic
- * is done.
- */
-template <class Field>
-class CekstvSwitch
-{
-    public:
-
-	/// Typedef
-	typedef typename Field::Element Element;
-	typedef CekstvSwitchFactory<Field> Factory;
-
-	/** Constructor from a field and a field element.
-	 * @param F field in which arithmetic is done
-	 * @param switches vector of switches
+	template <class Field>
+	class CekstvSwitchFactory;
+
+	/** Butterfly switch object from preconditioner paper.
+	 * This is a switch predicate object that is applied
+	 * to two references to elements to switch them as needed
+	 * by the \ref Butterfly\ Switching\ Network\ BlackBox\ Matrix\ Object
+	 * following the exchange matrix introduced in "Efficient Matrix
+	 * Preconditioners for Black Box Linear Algebra" by Chen, Eberly,
+	 * Kaltofen, Saunders, Turner, and Villard.
+	 * This class is templatized by the field in which the arithmetic
+	 * is done.
 	 */
-	CekstvSwitch (const typename Field::Element &a)
-		: _a (a) 
-	{}
-
-	/** Destructor.
-	 */
-	~CekstvSwitch () {}
-
-	/** Apply switch function.
-	 * Switches the elements in references according to the
-	 * exchange matrix introduced in "Efficient Matrix
-	 * Preconditioners for Black Box Linear Algebra" by Chen, Eberly, 
-	 * Kaltofen, Saunders, Turner, and Villard and the current field element
-	 * specified in the switch object.
-	 * @return bool true if swapped, false otherwise
-	 * @param x reference to first element to be switched
-	 * @param y reference to second element to be switched
-	 */
-	bool apply (const Field &F, Element &x, Element &y) const;
-
-	/** Apply switch transpose function.
-	 * Switches the elements in references according to the
-	 * transpose of the exchange matrix introduced in "Efficient Matrix
-	 * Preconditioners for Black Box Linear Algebra" by Chen, Eberly, 
-	 * Kaltofen, Saunders, Turner, and Villard and the current field element
-	 * specified in the switch object.
-	 * @return bool true if swapped, false otherwise
-	 * @param x reference to first element to be switched
-	 * @param y reference to second element to be switched
+	template <class Field>
+	class CekstvSwitch {
+	public:
+
+		/// Typedef
+		typedef typename Field::Element Element;
+		typedef CekstvSwitch<Field> Self_t;
+		typedef CekstvSwitchFactory<Field> Factory;
+
+		CekstvSwitch () {}
+
+		/** Constructor from a field and a field element.
+		 * @param a vector of switches
+		 */
+		CekstvSwitch (const typename Field::Element &a) :
+		       	_a (a)
+		{}
+
+		/** Destructor.
+		*/
+		~CekstvSwitch () {}
+
+		/** Apply switch function.
+		 * Switches the elements in references according to the
+		 * exchange matrix introduced in "Efficient Matrix
+		 * Preconditioners for Black Box Linear Algebra" by Chen, Eberly,
+		 * Kaltofen, Saunders, Turner, and Villard and the current field element
+		 * specified in the switch object.
+		 * @return bool true if swapped, false otherwise
+		 * @param F
+		 * @param x reference to first element to be switched
+		 * @param y reference to second element to be switched
+		 */
+		bool apply (const Field &F, Element &x, Element &y) const;
+
+		/** Apply switch transpose function.
+		 * Switches the elements in references according to the
+		 * transpose of the exchange matrix introduced in "Efficient Matrix
+		 * Preconditioners for Black Box Linear Algebra" by Chen, Eberly,
+		 * Kaltofen, Saunders, Turner, and Villard and the current field element
+		 * specified in the switch object.
+		 * @return bool true if swapped, false otherwise
+		 * @param F
+		 * @param x reference to first element to be switched
+		 * @param y reference to second element to be switched
+		 */
+		bool applyTranspose (const Field &F, Element &x, Element &y) const;
+
+
+		template<typename _Tp1>
+		struct rebind
+		{
+			typedef CekstvSwitch<_Tp1> other;
+
+			// special rebind operator() with two fields,
+			// indeed local field is not stored in the switch
+			void operator() (other & Ap, const Self_t& A, const _Tp1& T, const Field& F) {
+				Hom<Field, _Tp1>(F,T).image(Ap.getData(), A.getData());
+			}
+		};
+
+		typename Field::Element& getData() { return _a; }
+		const typename Field::Element& getData() const { return _a; }
+
+
+	private:
+
+		// Parameter of this 2x2 block
+		typename Field::Element _a;
+	};
+
+	/** Cekstv switch factory
+	 *
+	 * This class facilitates construction of cekstv switch objects by the
+	 * butterfly matrix.
 	 */
-	bool applyTranspose (const Field &F, Element &x, Element &y) const;
 
-   private:
-
-	// Parameter of this 2x2 block
-	typename Field::Element _a;
-};
-
-/** Cekstv switch factory
- *
- * This class facilitates construction of cekstv switch objects by the
- * butterfly matrix.
- */
-
-template <class Field>
-class CekstvSwitchFactory 
-{
-    public:
-	/** Constructor from an STL vector of bools
-	 */
-	CekstvSwitchFactory (typename Field::RandIter r)
-		: _r (r)
-	{}
-
-	/** Construct and return a boolean switch object
-	 */
-	CekstvSwitch<Field> makeSwitch ()
+	template <class Field>
+	class CekstvSwitchFactory {
+	public:
+		/** Constructor from an STL vector of bools
+		*/
+		CekstvSwitchFactory (typename Field::RandIter r) :
+		       	_r (r)
+		{}
+
+		/** Construct and return a boolean switch object
+		*/
+		CekstvSwitch<Field> makeSwitch ()
 		{ typename Field::Element a; return CekstvSwitch<Field> (_r.random (a)); }
 
-    private:
+	private:
 
-	typename Field::RandIter _r;
-};
+		typename Field::RandIter _r;
+	};
 
-template <class Field> 
-inline bool CekstvSwitch<Field>::apply (const Field             &F,
-					typename Field::Element &x,
-					typename Field::Element &y) const
-{
-	F.axpyin (x, _a, y);
-	F.addin (y, x);
+	template <class Field>
+	inline bool CekstvSwitch<Field>::apply (const Field             &F,
+						typename Field::Element &x,
+						typename Field::Element &y) const
+	{
+		F.axpyin (x, _a, y);
+		F.addin (y, x);
 
-	return true;
-}
-  
-template <class Field> 
-inline bool CekstvSwitch<Field>::applyTranspose (const Field             &F,
-						 typename Field::Element &x,
-						 typename Field::Element &y) const
-{
-	F.addin (x, y);
-	F.axpyin (y, _a, x);
+		return true;
+	}
 
-	return true;
-}
+	template <class Field>
+	inline bool CekstvSwitch<Field>::applyTranspose (const Field             &F,
+							 typename Field::Element &x,
+							 typename Field::Element &y) const
+	{
+		F.addin (x, y);
+		F.axpyin (y, _a, x);
+
+		return true;
+	}
 
 }
 
-#endif // __CEKSTV_H
+#endif // __LINBOX_cekstv_H
diff --git a/linbox/util/Makefile.am b/linbox/util/Makefile.am
index d9fae06..01718cf 100644
--- a/linbox/util/Makefile.am
+++ b/linbox/util/Makefile.am
@@ -1,6 +1,13 @@
-INCLUDES=-I$(top_srcdir) -I$(top_srcdir)/linbox
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+#we now need to include givaro headers for timer ? (oupa ? plus moche que ça tu meurs)
+AM_CPPFLAGS=-I$(top_srcdir) -I$(top_srcdir)/linbox $(FFLAFLAS_CFLAGS) $(GIVARO_CFLAGS)
+LIBS=-lgivaro
 
-AM_CFLAGS=-Wall -O2
+
+
+AM_CXXFLAGS=@DEFAULT_CFLAGS@
 
 SUBDIRS=formats
 
@@ -10,24 +17,25 @@ noinst_LTLIBRARIES=libutil.la
 
 
 libutil_la_SOURCES=	\
-	timer.C		\
-	error.C		\
+	error.C		    \
 	commentator.C	\
 	debug.C
 
 #libutil_la_LIBADD=	\
 #	gmp++/libgmpxx.la
 
-pkgincludesub_HEADERS=\
-	debug.h				\
-	error.h				\
+pkgincludesub_HEADERS=      \
+	debug.h				    \
+	timer.h				    \
+	error.h				    \
 	commentator.h 			\
-	timer.h				\
+	contracts.h 			\
 	prime-stream.h			\
+	iml_wrapper.h           \
 	field-axpy.h			\
 	matrix-stream.h			\
 	matrix-stream.inl		\
-	mpicpp.h			\
+	mpicpp.h			    \
 	mpicpp.inl
 
 EXTRA_DIST = util.doxy
diff --git a/linbox/util/Makefile.in b/linbox/util/Makefile.in
index 07f6e08..a6a8f26 100644
--- a/linbox/util/Makefile.in
+++ b/linbox/util/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -38,19 +39,26 @@ DIST_COMMON = $(pkgincludesub_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
-	$(top_srcdir)/macros/blas-check.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
 	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
 	$(top_srcdir)/macros/givaro-check.m4 \
 	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
 	$(top_srcdir)/macros/lidia-check.m4 \
 	$(top_srcdir)/macros/linbox-doc.m4 \
 	$(top_srcdir)/macros/linbox-misc.m4 \
 	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
 	$(top_srcdir)/macros/maple-check.m4 \
 	$(top_srcdir)/macros/ntl-check.m4 \
 	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -58,7 +66,7 @@ CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
 LTLIBRARIES = $(noinst_LTLIBRARIES)
 libutil_la_LIBADD =
-am_libutil_la_OBJECTS = timer.lo error.lo commentator.lo debug.lo
+am_libutil_la_OBJECTS = error.lo commentator.lo debug.lo
 libutil_la_OBJECTS = $(am_libutil_la_OBJECTS)
 DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
 depcomp =
@@ -104,18 +112,21 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
 CC = @CC@
+CCNAM = @CCNAM@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
 DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -123,61 +134,77 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
 GIVARO_CFLAGS = @GIVARO_CFLAGS@
 GIVARO_LIBS = @GIVARO_LIBS@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
 GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
+LIBS = -lgivaro
 LIBTOOL = @LIBTOOL@
 LIDIA_CFLAGS = @LIDIA_CFLAGS@
 LIDIA_LIBS = @LIDIA_LIBS@
 LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MAPLE_CFLAGS = @MAPLE_CFLAGS@
 MAPLE_HOME = @MAPLE_HOME@
 MAPLE_LIBS = @MAPLE_LIBS@
 MAPLE_VERSION = @MAPLE_VERSION@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
 NTL_CFLAGS = @NTL_CFLAGS@
 NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RM = @RM@
 SACLIB_CFLAGS = @SACLIB_CFLAGS@
 SACLIB_LIBS = @SACLIB_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+TESTS_CFLAGS = @TESTS_CFLAGS@
 VERSION = @VERSION@
+WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -218,16 +245,21 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/linbox
-AM_CFLAGS = -Wall -O2
+
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+#we now need to include givaro headers for timer ? (oupa ? plus moche que ça tu meurs)
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/linbox $(FFLAFLAS_CFLAGS) $(GIVARO_CFLAGS)
+AM_CXXFLAGS = @DEFAULT_CFLAGS@
 SUBDIRS = formats
 pkgincludesubdir = $(pkgincludedir)/util
 noinst_LTLIBRARIES = libutil.la
 libutil_la_SOURCES = \
-	timer.C		\
-	error.C		\
+	error.C		    \
 	commentator.C	\
 	debug.C
 
@@ -235,15 +267,17 @@ libutil_la_SOURCES = \
 #libutil_la_LIBADD=	\
 #	gmp++/libgmpxx.la
 pkgincludesub_HEADERS = \
-	debug.h				\
-	error.h				\
+	debug.h				    \
+	timer.h				    \
+	error.h				    \
 	commentator.h 			\
-	timer.h				\
+	contracts.h 			\
 	prime-stream.h			\
+	iml_wrapper.h           \
 	field-axpy.h			\
 	matrix-stream.h			\
 	matrix-stream.inl		\
-	mpicpp.h			\
+	mpicpp.h			    \
 	mpicpp.inl
 
 EXTRA_DIST = util.doxy
@@ -255,8 +289,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
 	      exit 1;; \
 	  esac; \
 	done; \
@@ -337,7 +371,7 @@ uninstall-pkgincludesubHEADERS:
 #     (which will cause the Makefiles to be regenerated when you run `make');
 # (2) otherwise, pass the desired values on the `make' command line.
 $(RECURSIVE_TARGETS):
-	@failcom='exit 1'; \
+	@fail= failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
 	    *=* | --[!k]*);; \
@@ -362,7 +396,7 @@ $(RECURSIVE_TARGETS):
 	fi; test -z "$$fail"
 
 $(RECURSIVE_CLEAN_TARGETS):
-	@failcom='exit 1'; \
+	@fail= failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
 	    *=* | --[!k]*);; \
@@ -405,7 +439,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
@@ -551,6 +585,8 @@ dvi-am:
 
 html: html-recursive
 
+html-am:
+
 info: info-recursive
 
 info-am:
@@ -559,18 +595,28 @@ install-data-am: install-pkgincludesubHEADERS
 
 install-dvi: install-dvi-recursive
 
+install-dvi-am:
+
 install-exec-am:
 
 install-html: install-html-recursive
 
+install-html-am:
+
 install-info: install-info-recursive
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-recursive
 
+install-pdf-am:
+
 install-ps: install-ps-recursive
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-recursive
diff --git a/linbox/util/commentator.C b/linbox/util/commentator.C
index af047d1..3ed68ab 100644
--- a/linbox/util/commentator.C
+++ b/linbox/util/commentator.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* linbox/util/commentator.C
  * Copyright (C) 1999 B. David Saunders,
@@ -24,10 +25,15 @@
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  *
- * This file implements the C++ interface to commentators (for 
+ * This file implements the C++ interface to commentators (for
  * providing runtime commentary to the user)
  */
 
+/*! @internal
+ * @file util/commentator.C
+ * @brief implementation of LinBox::Commentator.
+ */
+
 #include "linbox/linbox-config.h"
 
 #include <string>
@@ -38,9 +44,9 @@
 
 #include "linbox/util/commentator.h"
 #include "linbox/util/debug.h"
-#include "linbox/util/timer.h"
 
-namespace LinBox 
+
+namespace LinBox
 {
 	// -----------------------------------------------------
 	// Mathematical routines
@@ -50,7 +56,7 @@ namespace LinBox
 		long rm = r - 1 ;
 		double c1 = double (rm) / double (r), c2 = a / double (r);
 		double g = 1, pgr = 1, err = a - 1;
-    
+
 		while (err > precision) {
 			g = g * c1 + c2 / pgr;
 			pgr = pow (g, (double) rm);
@@ -67,7 +73,7 @@ namespace LinBox
 		long r = 2;
 		double g;
 
-		while ((g = nroot (a, r, 0.1)) >= 2) {
+		while ((g = nroot ((double)a, r, 0.1)) >= 2) {
 			l = (long) floor (g);
 			if (g-double (l) > 0.1)
 				++l;
@@ -79,9 +85,12 @@ namespace LinBox
 		return 0;
 	}
 
-	Commentator::Commentator () 
-		: cnull (new nullstreambuf), _estimationMethod (BEST_ESTIMATE), _format (OUTPUT_CONSOLE),
-		  _show_timing (true), _show_progress (true), _show_est_time (true)
+#ifndef DISABLE_COMMENTATOR
+	Commentator::Commentator () :
+		// cnull (new nullstreambuf)
+		cnull ("/dev/null")
+		, _estimationMethod (BEST_ESTIMATE), _format (OUTPUT_CONSOLE),
+		_show_timing (true), _show_progress (true), _show_est_time (true)
 	{
 		//registerMessageClass (BRIEF_REPORT,         std::clog, 1, LEVEL_IMPORTANT);
 		registerMessageClass (BRIEF_REPORT,         _report, 1, LEVEL_IMPORTANT);
@@ -93,11 +102,13 @@ namespace LinBox
 		registerMessageClass (INTERNAL_ERROR,       _report, 10, LEVEL_NORMAL);
 		registerMessageClass (INTERNAL_DESCRIPTION, _report);
 	}
-	Commentator::Commentator (std::ostream& out) 
-		: cnull (new nullstreambuf), _estimationMethod (BEST_ESTIMATE), _format (OUTPUT_CONSOLE),
-		  _show_timing (true), _show_progress (true), _show_est_time (true)
+	Commentator::Commentator (std::ostream& out) :
+		// cnull (new nullstreambuf)
+		cnull ("/dev/null")
+		, _estimationMethod (BEST_ESTIMATE), _format (OUTPUT_CONSOLE),
+		_show_timing (true), _show_progress (true), _show_est_time (true)
 	{
-		registerMessageClass (BRIEF_REPORT,         out, 1, LEVEL_IMPORTANT);
+		//registerMessageClass (BRIEF_REPORT,         out, 1, LEVEL_IMPORTANT);
 		registerMessageClass (BRIEF_REPORT,         out, 1, LEVEL_IMPORTANT);
 		registerMessageClass (PROGRESS_REPORT,      _report);
 		registerMessageClass (TIMING_MEASURE,       _report);
@@ -108,19 +119,24 @@ namespace LinBox
 		registerMessageClass (INTERNAL_DESCRIPTION, _report);
 	}
 
-	Commentator::~Commentator() {
-		std::map <const char *, MessageClass *, LessThanString>::iterator i;
-		for (i = _messageClasses.begin (); i != _messageClasses.end (); ++i) 
+	Commentator::~Commentator()
+	{
+		std::map <const char *, MessageClass *, C_str_Less >::iterator i;
+		for (i = _messageClasses.begin (); i != _messageClasses.end (); ++i)
 			delete i->second;
+		while (!_activities.empty()){
+			delete _activities.top();
+			_activities.pop();
+		}
 	}
 
-	void Commentator::start (const char *description, const char *fn, unsigned long len) 
+	void Commentator::start (const char *description, const char *fn, unsigned long len)
 	{
 		if (fn == (const char *) 0 && _activities.size () > 0)
 			fn = _activities.top ()->_fn;
 
 		if (isPrinted (_activities.size () + 1, LEVEL_IMPORTANT, INTERNAL_DESCRIPTION, fn))
-			report (LEVEL_IMPORTANT, INTERNAL_DESCRIPTION) //<< "Starting activity: " 
+			report (LEVEL_IMPORTANT, INTERNAL_DESCRIPTION) //<< "Starting activity: "
 			<< description << std::endl;
 
 		Activity *new_act = new Activity (description, fn, len);
@@ -133,7 +149,7 @@ namespace LinBox
 		new_act->_timer.start ();
 	}
 
-	void Commentator::startIteration (unsigned int iter, unsigned long len) 
+	void Commentator::startIteration (unsigned int iter, unsigned long len)
 	{
 		std::ostringstream str;
 
@@ -143,9 +159,9 @@ namespace LinBox
 		start (_iteration_str.c_str (), (const char *) 0, len);
 	}
 
-	void Commentator::stop (const char *msg, const char *long_msg, const char *fn) 
+	void Commentator::stop (const char *msg, const char *long_msg, const char *fn)
 	{
-		float realtime, usertime, systime;
+		double realtime, usertime, systime;
 		Activity *top_act;
 
 		linbox_check (_activities.top () != (Activity *) 0);
@@ -172,7 +188,7 @@ namespace LinBox
 		    strcmp (fn, top_act->_fn) != 0)
 		{
 			report (LEVEL_IMPORTANT, INTERNAL_WARNING)
-				<< "Activity report mismatch. Check that start () and stop () calls are paired correctly." << std::endl;
+			<< "Activity report mismatch. Check that start () and stop () calls are paired correctly." << std::endl;
 		}
 
 		fn = top_act->_fn;
@@ -181,9 +197,7 @@ namespace LinBox
 
 		if (isPrinted (_activities.size (), LEVEL_IMPORTANT, BRIEF_REPORT, fn))
 		{
-		//std::cout << "calling finishA ";
 			finishActivityReport (*top_act, msg);
-			//std::cout << std::endl;
 		}
 
 		if (isPrinted (_activities.size () + 1, LEVEL_IMPORTANT, INTERNAL_DESCRIPTION, fn)) {
@@ -208,14 +222,14 @@ namespace LinBox
 		delete top_act;
 	}
 
-	void Commentator::progress (long k, long len) 
+	void Commentator::progress (long k, long len)
 	{
 		linbox_check (_activities.top () != (Activity *) 0);
 
 		Activity *act = _activities.top ();
-                Timer tmp = act->_timer;
+		::Givaro::Timer tmp = act->_timer;
 		act->_timer.stop ();
-                
+
 		if (k == -1)
 			act->_progress++;
 		else
@@ -231,14 +245,14 @@ namespace LinBox
 		rep.precision (3);
 		rep.setf (std::ios::fixed);
 		rep << "Progress: " << act->_progress << " out of " << act->_len
-		    << " (" << act->_timer.realtime () << "s elapsed)" << std::endl;
+		<< " (" << act->_timer.realtime () << "s elapsed)" << std::endl;
 
 		if (_show_progress && isPrinted (_activities.size () - 1, LEVEL_IMPORTANT, BRIEF_REPORT, act->_fn))
 			updateActivityReport (*act);
-                act->_timer = tmp;
+		act->_timer = tmp;
 	}
 
-	std::ostream &Commentator::report (long level, const char *msg_class) 
+	std::ostream &Commentator::report (long level, const char *msg_class)
 	{
 		linbox_check (msg_class != (const char *) 0);
 
@@ -278,27 +292,27 @@ namespace LinBox
 		}
 	}
 
-	void Commentator::setMaxDepth (long depth) 
+	void Commentator::setMaxDepth (long depth)
 	{
 		MessageClass &briefReportClass = getMessageClass (BRIEF_REPORT);
-		std::map <const char *, MessageClass *, LessThanString>::iterator i;
+		std::map <const char *, MessageClass *, C_str_Less>::iterator i;
 
 		for (i = _messageClasses.begin (); i != _messageClasses.end (); ++i)
 			if (i->second != &briefReportClass)
 				i->second->setMaxDepth (depth);
 	}
 
-	void Commentator::setMaxDetailLevel (long level) 
+	void Commentator::setMaxDetailLevel (long level)
 	{
 		MessageClass &briefReportClass = getMessageClass (BRIEF_REPORT);
-		std::map <const char *, MessageClass *, LessThanString>::iterator i;
+		std::map <const char *, MessageClass *, C_str_Less>::iterator i;
 
 		for (i = _messageClasses.begin (); i != _messageClasses.end (); ++i)
 			if (i->second != &briefReportClass)
 				i->second->setMaxDetailLevel (level);
 	}
 
-	MessageClass &Commentator::registerMessageClass (const char *msg_class, std::ostream &stream, unsigned long max_depth, unsigned long max_level) 
+	MessageClass &Commentator::registerMessageClass (const char *msg_class, std::ostream &stream, unsigned long max_depth, unsigned long max_level)
 	{
 		linbox_check (msg_class != (const char *) 0);
 
@@ -307,7 +321,7 @@ namespace LinBox
 		return *new_obj;
 	}
 
-	MessageClass &Commentator::cloneMessageClass (const char *new_msg_class, const char *msg_class) 
+	MessageClass &Commentator::cloneMessageClass (const char *new_msg_class, const char *msg_class)
 	{
 		linbox_check (new_msg_class != (const char *) 0);
 		linbox_check (msg_class != (const char *) 0);
@@ -318,7 +332,7 @@ namespace LinBox
 		return *new_obj;
 	}
 
-	MessageClass &Commentator::cloneMessageClass (const char *new_msg_class, const char *msg_class, std::ostream &stream) 
+	MessageClass &Commentator::cloneMessageClass (const char *new_msg_class, const char *msg_class, std::ostream &stream)
 	{
 		linbox_check (new_msg_class != (const char *) 0);
 		linbox_check (msg_class != (const char *) 0);
@@ -330,19 +344,19 @@ namespace LinBox
 	}
 
 	MessageClass &Commentator::getMessageClass (const char *msg_class)
-		{ return *_messageClasses[msg_class]; }
+	{ return *_messageClasses[msg_class]; }
 
-	void Commentator::setPrintParameters (unsigned long depth, unsigned long level, const char *fn) 
+	void Commentator::setPrintParameters (unsigned long depth, unsigned long level, const char *fn)
 	{
 		MessageClass &briefReportClass = getMessageClass (BRIEF_REPORT);
-		std::map <const char *, MessageClass *, LessThanString>::iterator i;
+		std::map <const char *, MessageClass *, C_str_Less>::iterator i;
 
 		for (i = _messageClasses.begin (); i != _messageClasses.end (); ++i)
 			if (i->second != &briefReportClass)
 				i->second->setPrintParameters (depth, level, fn);
 	}
 
-	void Commentator::setBriefReportParameters (OutputFormat format, bool show_timing, bool show_progress, bool show_est_time) 
+	void Commentator::setBriefReportParameters (OutputFormat format, bool show_timing, bool show_progress, bool show_est_time)
 	{
 		_format        = format;
 		_show_timing   = show_timing;
@@ -360,11 +374,12 @@ namespace LinBox
 		return messageClass.isPrinted (depth, level, fn);
 	}
 
-	void Commentator::setBriefReportStream (std::ostream &stream) 
-		{ setMessageClassStream (BRIEF_REPORT, stream); }
+	void Commentator::setBriefReportStream (std::ostream &stream)
+	{ setMessageClassStream (BRIEF_REPORT, stream); }
 
-	void Commentator::setReportStream (std::ostream &stream) 
+	void Commentator::setReportStream (std::ostream &stream)
 	{
+		setMessageClassStream (BRIEF_REPORT,      stream);
 		setMessageClassStream (PROGRESS_REPORT,      stream);
 		setMessageClassStream (TIMING_MEASURE,       stream);
 		setMessageClassStream (TIMING_ESTIMATE,      stream);
@@ -377,21 +392,21 @@ namespace LinBox
 			getMessageClass (BRIEF_REPORT).setMaxDepth (0);
 	}
 
-	void Commentator::setMessageClassStream (const char *msg_class, std::ostream &stream) 
+	void Commentator::setMessageClassStream (const char *msg_class, std::ostream &stream)
 	{
-                //temporarily fixed the bug in test-commentator, left memory leaking.
-                MessageClass *old_msg_class = _messageClasses[msg_class];
-                cloneMessageClass (msg_class, msg_class, stream);
-                delete old_msg_class;
+		//temporarily fixed the bug in test-commentator, left memory leaking.
+		MessageClass *old_msg_class = _messageClasses[msg_class];
+		cloneMessageClass (msg_class, msg_class, stream);
+		delete old_msg_class;
 
 	}
 
-	void Commentator::setDefaultReportFile (const char *filename) 
+	void Commentator::setDefaultReportFile (const char *filename)
 	{
 		_report.open (filename);
 	}
 
-	void Commentator::printActivityReport (Activity &activity) 
+	void Commentator::printActivityReport (Activity &activity)
 	{
 		MessageClass &messageClass = getMessageClass (BRIEF_REPORT);
 
@@ -420,7 +435,7 @@ namespace LinBox
 		}
 	}
 
-	void Commentator::updateActivityReport (Activity &activity) 
+	void Commentator::updateActivityReport (Activity &activity)
 	{
 		MessageClass &messageClass = getMessageClass (BRIEF_REPORT);
 		unsigned int i, old_len;
@@ -445,7 +460,7 @@ namespace LinBox
 #if 0
 				if (_show_est_time)
 					messageClass._stream << activity._estimate.front ()._time
-							     << " remaining" << std::endl;
+					<< " remaining" << std::endl;
 #endif
 			}
 
@@ -457,21 +472,20 @@ namespace LinBox
 #if 0
 				if (_show_est_time)
 					messageClass._stream << " (" << activity._estimate.front ()._time
-							     << " remaining)";
+					<< " remaining)";
 #endif
 				messageClass._stream << std::endl;
 			}
 #if 0
 			else if (_show_est_time)
 				messageClass._stream << activity._estimate.front ()._time
-						     << " remaining" << std::endl;
+				<< " remaining" << std::endl;
 #endif
 		}
 	}
 
-	void Commentator::finishActivityReport (Activity &activity, const char *msg) 
+	void Commentator::finishActivityReport (Activity &activity, const char *msg)
 	{
-	//std::cout << "finishA " << _show_progress << _show_timing << std::endl;
 		MessageClass &messageClass = getMessageClass (BRIEF_REPORT);
 		unsigned int i;
 
@@ -519,17 +533,17 @@ namespace LinBox
 				    const char *msg_class,
 				    std::ostream &stream,
 				    unsigned long max_depth,
-				    unsigned long max_level) 
-		: _msg_class (msg_class),
-		  _smart_streambuf (comm, stream),
-		  _stream (&_smart_streambuf),
-		  _max_level (max_level),
-		  _max_depth (max_depth)
+				    unsigned long max_level) :
+		_msg_class (msg_class),
+		_smart_streambuf (comm, stream),
+		_stream (&_smart_streambuf),
+		_max_level (max_level),
+		_max_depth (max_depth)
 	{
 		fixDefaultConfig ();
 	}
 
-	void MessageClass::setMaxDepth (long depth) 
+	void MessageClass::setMaxDepth (long depth)
 	{
 		_max_depth = (unsigned long) depth;
 		fixDefaultConfig ();
@@ -541,7 +555,7 @@ namespace LinBox
 		fixDefaultConfig ();
 	}
 
-	void MessageClass::setPrintParameters (unsigned long depth, unsigned long level, const char *fn) 
+	void MessageClass::setPrintParameters (unsigned long depth, unsigned long level, const char *fn)
 	{
 		if (fn == (const char *) 0)
 			fn = "";
@@ -557,7 +571,8 @@ namespace LinBox
 			if (i->second <= level) {
 				j = i++;
 				config.erase (j);
-			} else {
+			}
+			else {
 				++i;
 			}
 		}
@@ -572,7 +587,8 @@ namespace LinBox
 			if (i->second > level) {
 				j = i++;
 				config.erase (j);
-			} else {
+			}
+			else {
 				++i;
 			}
 		}
@@ -583,40 +599,49 @@ namespace LinBox
 
 	bool MessageClass::isPrinted (unsigned long depth, unsigned long level, const char *fn)
 	{
- 		if (checkConfig (_configuration[""], depth, level))
-		{	//std::cout << " fn=\"\", d " << depth << ", l " << level << " false" << std::endl;
- 			return true;
-		}
+		return
+		checkConfig (_configuration[""], depth, level)
+		||
+		(	fn != (const char *) 0
+			&&
+			checkConfig (_configuration[fn], depth, level)
+		);
+#if 0
+
+		if (checkConfig (_configuration[""], depth, level))
+			return true;
 		else if (fn != (const char *) 0)
 			//return checkConfig (_configuration[fn], depth, level);
-			{ bool ans = checkConfig (_configuration[fn], depth, level);
-			  if (ans) 
-		 		{	//std::cout << " fn=" << fn << ", d " << depth << ", l " << level << " true" << std::endl;
-			 		return true;
-		 		}
-			  else
-		 		{	//std::cout << " fn=" << fn << ", d " << depth << ", l " << level << " false" << std::endl;
-			 		return false;
-		 		}
-		 	}
+		{ bool ans = checkConfig (_configuration[fn], depth, level);
+			if (ans)
+			{	//std::cerr << " fn=" << fn << ", d " << depth << ", l " << level << " true" << std::endl;
+				return true;
+			}
+			else
+			{	//std::cerr << " fn=" << fn << ", d " << depth << ", l " << level << " false" << std::endl;
+				return false;
+			}
+		}
 
 		else
-		{	//std::cout << " fn=0, d " << depth << ", l " << level << " false" << std::endl;
+		{	//std::cerr << " fn=0, d " << depth << ", l " << level << " false" << std::endl;
 			return false;
 		}
+
+#endif
 	}
 
 	MessageClass::MessageClass (const Commentator &comm,
 				    const char *msg_class,
 				    std::ostream &stream,
-				    Configuration configuration) 
-		: _msg_class (msg_class),
-		  _smart_streambuf (comm, stream),
-		  _stream (&_smart_streambuf),
-		  _configuration (configuration)
+				    Configuration configuration) :
+		_msg_class (msg_class),
+		_smart_streambuf (comm, stream),
+		_stream (&_smart_streambuf),
+		_configuration (configuration)
 	{}
 
-	void MessageClass::fixDefaultConfig () 
+	void MessageClass::fixDefaultConfig ()
 	{
 		std::list <std::pair <unsigned long, unsigned long> > &config = _configuration[""];
 
@@ -625,20 +650,23 @@ namespace LinBox
 		config.push_back (std::pair <unsigned long, unsigned long> ((unsigned long) -1, Commentator::LEVEL_ALWAYS));
 	}
 
-	bool MessageClass::checkConfig (std::list <std::pair <unsigned long, unsigned long> > &config, unsigned long depth, unsigned long level) 
+	bool MessageClass::checkConfig (std::list <std::pair <unsigned long, unsigned long> > &config,
+					unsigned long depth,
+					unsigned long ) //lvl
 	{
 		std::list <std::pair <unsigned long, unsigned long> >::iterator i;
 
-		i = config.begin ();
-		while (i != config.end ()) {
+		for ( i = config.begin (); i != config.end (); ++i) {
 			if (depth < i->first) {
+#if 0
+				// uninitialized value error goes away if we ignore level.
 				if (level <= i->second)
 					return true;
 				else
 					return false;
+#endif
+				return true;
 			}
-
-			i++;
 		}
 
 		return false;
@@ -659,13 +687,13 @@ namespace LinBox
 		}
 	}
 
-	int MessageClass::smartStreambuf::sync () 
+	int MessageClass::smartStreambuf::sync ()
 	{
 		std::streamsize n = pptr () - pbase ();
 		return (n && writeData (pbase (), n) != n) ? EOF : 0;
 	}
 
-	int MessageClass::smartStreambuf::overflow (int ch) 
+	int MessageClass::smartStreambuf::overflow (int ch)
 	{
 		std::streamsize n = pptr () - pbase ();
 
@@ -674,7 +702,7 @@ namespace LinBox
 
 		if (ch != EOF) {
 			char cbuf[1];
-			cbuf[0] = ch;
+			cbuf[0] = (char)ch;
 			if (writeData (cbuf, 1) != 1)
 				return EOF;
 		}
@@ -698,7 +726,7 @@ namespace LinBox
 			_indent_next = false;
 		}
 
-		for (idx = 0; (idx < m) &&(text[idx] != '\n') ; ++idx);
+		for (idx = 0; (idx < m) &&(text[idx] != '\n') ; ++idx) ;
 
 		while (idx < m) {
 			_stream.write (text, idx + 1);
@@ -710,7 +738,7 @@ namespace LinBox
 				_indent_next = true;
 
 			text += idx + 1;
-			for (idx = 0; idx != '\n' && idx < m; ++idx);
+			for (idx = 0; idx != '\n' && idx < m; ++idx) ;
 		}
 
 		_stream.write (text, m);
@@ -720,6 +748,8 @@ namespace LinBox
 		return n;
 	}
 
+#endif
 	// Default global commentator
-	Commentator commentator;
+	Commentator commentator ;
 }
+
diff --git a/linbox/util/commentator.h b/linbox/util/commentator.h
index b3e9ef3..e45e321 100644
--- a/linbox/util/commentator.h
+++ b/linbox/util/commentator.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/util/commentator.h
  * Copyright (C) 1999 B. David Saunders,
  *                    Jean-Guillaume Dumas
@@ -24,12 +24,17 @@
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  *
- * This file implements the C++ interface to commentators (for 
+ * This file implements the C++ interface to commentators (for
  * providing runtime commentary to the user)
  */
 
-#ifndef __COMMENTATOR_H
-#define __COMMENTATOR_H
+/*! @file util/commentator.h
+ * @ingroup util
+ * @brief Reports information to the user.
+ */
+
+#ifndef __LINBOX_commentator_H
+#define __LINBOX_commentator_H
 
 #include <deque>
 #include <stack>
@@ -66,7 +71,7 @@
 #define MSG_STATUS(ret) (ret ? MSG_PASSED : MSG_FAILED)
 
 // Legacy definitions -- please do not use
-#define PRINT_EVERYTHING 100000 
+#define PRINT_EVERYTHING 100000
 #define PRINT_NOTHING 0
 
 #define LVL_ALWAYS =  1,
@@ -77,43 +82,37 @@
 #define LVL_NEVER  =  (2*PRINT_EVERYTHING)
 
 #ifndef DISABLE_COMMENTATOR
-namespace LinBox 
+
+namespace LinBox
 {
 	// Forward declaration
 	class MessageClass;
 	class Commentator;
 
-	// Utility object needed for associative containers
-	struct LessThanString
-	{
-		bool operator () (const char *str1, const char *str2) const 
-			{ return strcmp (str1, str2) < 0; }
-	};
-
 	// \class ActivityState commentator.h linbox/util/commentator.h
-	/** 
+	/** @internal
 	 * \brief used by commentator
 
 	 * This stores a snapshot of the state of the commentator's activity
 	 * stack, so it may be restored after an exception is thrown
 	 */
 	class ActivityState {
-	    public:
+	public:
 
-		ActivityState (void *act)
-			: _act (act)
+		ActivityState (void *act) :
+			_act (act)
 		{}
 
-	    private:
+	private:
 
 		friend class Commentator;
 
 		void *_act;
 	};
 
-	/** * \brief give information to user during runtime
-	 \ingroup util
-
+	/** @brief Give information to user during runtime.
+	 * \ingroup util
+	 *
 	 * This object is used for reporting information about a computation to
 	 * the user. Such information includes errors and warnings, descriptions
 	 * of internal progress, performance measurements, and timing
@@ -121,16 +120,17 @@ namespace LinBox
 	 * amount of information displayed.
 	 *
 	 * Typical usage follows the following pattern:
-	  \code
-	    void myFunction () {
-	        commentator.start ("Doing important work", "myFunction", 100);
-	        for (int i = 0; i < 100; i++) {
-	            ...
-	            commentator.progress ();
-	        }
-	        commentator.stop (MSG_DONE, "Task completed successfully");
-	    }
-	  \endcode
+	 \code
+	 void myFunction ()
+	 {
+	     commentator.start ("Doing important work", "myFunction", 100);
+	     for (int i = 0; i < 100; i++) {
+	         ...
+	         commentator.progress ();
+	     }
+	     commentator.stop (MSG_DONE, "Task completed successfully");
+	 }
+	 \endcode
 	 *
 	 * In the above example, the call to commentator.start () informs the
 	 * commentator that some new activity has begun. This may be invoked
@@ -158,26 +158,29 @@ namespace LinBox
 	 * The commentator allows very precise control over what gets
 	 * printed. See the Configuration section below.
 	 */
-
 	class Commentator {
-	    public: 
-		/** Default constructor
+	public:
+		/** @internal
+		 * Default constructor.
 		 * Constructs a commentator with default settings
 		 */
 		Commentator ();
 		Commentator (std::ostream&);
 
 
-		/** Default destructor
-		 */
+		/** @internal
+		 * Default destructor.
+		*/
 		virtual ~Commentator ();
 
-		/** @name Reporting facilities
-		 */
+		/**@internal
+		 * @name Reporting facilities.
+		 * @{
+		*/
 
-		//@{
 
-		/** Start an activity
+		/** <!-- at internal-->
+		 * Start an activity.
 		 * Inform the commentator that some new activity has begun. This
 		 * is typically called at the beginning of a library function.
 		 * @param description A human-readable text description of the
@@ -194,7 +197,8 @@ namespace LinBox
 			    const char *fn = (const char *) 0,
 			    unsigned long len = 0);
 
-		/** Start a new iteration
+		/** @internal
+		 * Start a new iteration.
 		 * This is a convenience function to indicate that an iteration
 		 * has started
 		 * @param iter Number of the iteration
@@ -205,7 +209,8 @@ namespace LinBox
 		 */
 		void startIteration (unsigned int iter, unsigned long len = 0);
 
-		/** Stop an activity
+		/** <!-- at internal-->
+		 * Stop an activity.
 		 * Inform the commentator that the current activity has
 		 * finished.
 		 * @param msg A short (one word) message describing the
@@ -223,7 +228,8 @@ namespace LinBox
 			   const char *long_msg = (const char *) 0,
 			   const char *fn = (const char *) 0);
 
-		/** Report progress in the current activity
+		/** <!-- at internal-->
+		 * Report progress in the current activity.
 		 * Inform the commentator that k steps of the current activity
 		 * have been completed.
 		 * @param k Number of steps completed; use -1 to increment the
@@ -234,7 +240,8 @@ namespace LinBox
 		 */
 		void progress (long k = -1, long len = -1);
 
-		/** Message level
+		/** @internal
+		 * Message level.
 		 * Some default settings to use for the message level
 		 */
 		enum MessageLevel {
@@ -244,7 +251,8 @@ namespace LinBox
 			LEVEL_UNIMPORTANT  =  3
 		};
 
-		/** Basic reporting
+		/** <!-- at internal-->
+		 * Basic reporting.
 		 * Send some report string to the commentator
 		 * @param level Level of detail of the message
 		 * @param msg_class Type of message
@@ -252,13 +260,16 @@ namespace LinBox
 		 */
 		std::ostream &report (long level = LEVEL_IMPORTANT, const char *msg_class = INTERNAL_DESCRIPTION);
 
-		/** Indent to the correct column on the given string
-		 */
+		/** @internal
+		 * Indent to the correct column on the given string.
+		*/
 		void indent (std::ostream &stream) const;
 
 		//@} Reporting facilities
 
-		/** @name Activity stack restoration
+
+		/** @internal
+		 * @name Activity stack restoration.
 		 *
 		 * The methods below facilitate restoring the activity stack
 		 * after an exception has been thrown. If user code wishes to
@@ -271,21 +282,25 @@ namespace LinBox
 
 		//@{
 
-		/** Save activity state
+		/** @internal
+		 * Save activity state.
 		 *
 		 * Saves a copy of the activity state and returns it to the
 		 * caller. The caller need only pass this object back to
-		 * \ref{restoreActivityState} to return the commentator's
+		 * \ref restoreActivityState to return the commentator's
 		 * activity stack to the state it was when saveActivityState was
 		 * called.
 		 *
 		 * @return ActivityState object
 		 */
 
-		ActivityState saveActivityState () const 
-			{ return ActivityState (_activities.top ()); }
+		ActivityState saveActivityState () const
+		{
+		       	return ActivityState (_activities.top ());
+		}
 
-		/** Restore activity state
+		/** @internal
+		 * Restore activity state.
 		 *
 		 * Restores the activity state to the point it was when the
 		 * given ActivityState object was passed. Note that this
@@ -296,19 +311,23 @@ namespace LinBox
 
 		void restoreActivityState (ActivityState state);
 
-		/** @name Configuration
-		 */
+		/** @internal
+		 * @name Configuration
+		*/
 
 		//@{
 
-		/** Output format
+		/** @internal
+		 * Output format.
 		 * OUTPUT_CONSOLE - output human-readable and tailor-made for the console
 		 * OUTPUT_PIPE - output made for piping into other processes
 		 *
 		 * This affects only the brief report
 		 */
-		enum OutputFormat
-			{ OUTPUT_CONSOLE, OUTPUT_PIPE };
+		enum OutputFormat {
+		       	OUTPUT_CONSOLE,
+		       	OUTPUT_PIPE
+		};
 
 		enum EstimationMethod {
 			BEST_ESTIMATE,
@@ -321,9 +340,10 @@ namespace LinBox
 			LONG_TIMING
 		};
 
-		/** Set maximum message depth
+		/** @internal
+		 * Set maximum message depth.
 		 * Sets the maximum activity depth, as defined by
-		 * Commentator::start and Commentator::stop, at which messages
+		 * \c Commentator::start and \c Commentator::stop, at which messages
 		 * of all classes will be printed.
 		 * @param depth Maximum depth at which to print messages; set to
 		 *              -1 to print messages at any depth and 0 to
@@ -331,7 +351,8 @@ namespace LinBox
 		 */
 		void setMaxDepth (long depth);
 
-		/** Set maximum detail level
+		/** @internal
+		 * Set maximum detail level.
 		 * Sets the maximum detail level at which to print messages
 		 * @param level Maximum detail level at which to print messages;
 		 *              set to -1 to print messages at all levels and 0
@@ -339,7 +360,8 @@ namespace LinBox
 		 */
 		void setMaxDetailLevel (long level);
 
-		/** Register a new message class
+		/** @internal
+		 * Register a new message class.
 		 * Register some new message class with the commentator.
 		 * @param msg_class Name of message class
 		 * @param stream Stream to which to send data of this type
@@ -355,7 +377,8 @@ namespace LinBox
 						    unsigned long max_depth = 1,
 						    unsigned long max_level = 2);
 
-		/** Clone an existing message class
+		/** @internal
+		 * Clone an existing message class.
 		 * Clone the message class to construct a new message class with
 		 * the same parameters.
 		 * @param new_msg_class Name of the new class
@@ -364,7 +387,8 @@ namespace LinBox
 		 */
 		MessageClass &cloneMessageClass (const char *new_msg_class, const char *msg_class);
 
-		/** Clone an existing message class, specifying a new output stream
+		/** @internal
+		 * Clone an existing message class, specifying a new output stream.
 		 * Clone the message class to construct a new message class with
 		 * the same parameters.
 		 * @param new_msg_class Name of the new class
@@ -376,13 +400,15 @@ namespace LinBox
 						 const char *msg_class,
 						 std::ostream &stream);
 
-		/** Retrieve a message class by name
+		/** @internal
+		 * Retrieve a message class by name.
 		 * @param msg_class Name of message class
 		 * @return Reference to message class object
 		 */
 		MessageClass &getMessageClass (const char *msg_class);
 
-		/** Precise control over printing
+		/** @internal
+		 * Precise control over printing.
 		 * Specifies that all messages up to the given depth and the
 		 * given detail level should be printed
 		 *
@@ -398,7 +424,8 @@ namespace LinBox
 					 unsigned long level,
 					 const char *fn = (const char *) 0);
 
-		/** Set parameters for the brief report
+		/** @internal
+		 * Set parameters for the brief report.
 		 * @param format Output format
 		 * @param show_timing Show the CPU time for each toplevel activity
 		 * @param show_progress Show a counter of the progress as each
@@ -410,7 +437,8 @@ namespace LinBox
 					       bool show_progress,
 					       bool show_est_time);
 
-		/** Determine whether a message will be printed
+		/** @internal
+		 * Determine whether a message will be printed.
 		 * @param depth Activity depth
 		 * @param level Message level
 		 * @param msg_class Type of message
@@ -423,7 +451,8 @@ namespace LinBox
 				const char *msg_class,
 				const char *fn = (const char *) 0);
 
-		/** Determine whether a message will be printed
+		/** @internal
+		 * Determine whether a message will be printed.
 		 * This variant uses the current activity depth rather than
 		 * specifying it explicitly.
 		 * @param level Message level
@@ -435,47 +464,59 @@ namespace LinBox
 		bool isPrinted (unsigned long level,
 				const char *msg_class,
 				const char *fn = (const char *) 0)
-			{ return isPrinted (_activities.size (), level, msg_class, fn); }
+		{
+		       	return isPrinted (_activities.size (), level, msg_class, fn);
+		}
 
-		/** Determine whether the stream given is the null stream
-		 * @param stream Stream to check
+		/** @internal
+		 * Determine whether the stream given is the null stream.
+		 * @param str Stream to check
 		 * @return true if stream is the null stream; false otherwise
 		 */
-		bool isNullStream (const std::ostream &str) 
-			{ return &str == &cnull; }
+		bool isNullStream (const std::ostream &str)
+		{
+			return &str == &cnull;
+		}
 
-		/** Set output stream for brief report
+		/** @internal
+		 * Set output stream for brief report.
 		 * @param stream Output stream
 		 */
 		void setBriefReportStream (std::ostream &stream);
 
-		/** Set output stream for all reports other than the brief
+		/** @internal
+		 * Set output stream for all reports other than the brief.
 		 * report
 		 * @param stream Output stream
 		 */
 		void setReportStream (std::ostream &stream);
 
-		/** Set the output stream for a given message class
+		/** @internal
+		 * Set the output stream for a given message class.
 		 * @param msg_class Message class
 		 * @param stream Output stream
 		 */
 		void setMessageClassStream (const char *msg_class, std::ostream &stream);
 
-		/** Set default report file
-		 * @param name of file
+		/** @internal
+		 * Set default report file.
+		 * @param filename of file
 		 */
 		void setDefaultReportFile (const char *filename);
 
 		//@} Configuration
 
-		/** @name Legacy commentator interface
+		/** @internal
+		 * @name Legacy commentator interface
 		 * These routines provide compatibility with the old commentator
 		 * interface. They are deprecated.
+		 * @deprecated
 		 */
 
 		//@{
 
-		/** Start an activity
+		/** @internal
+		 * Start an activity.
 		 * @param id String identifier of activity
 		 * @param msg Message to print
 		 * @param msglevel Level of message
@@ -487,16 +528,25 @@ namespace LinBox
 			report ((MessageLevel) msglevel, msgclass) << msg << std::endl;
 		}
 
-		/** Stop an activity
+		/** @internal
+		 * Stop an activity.
 		 * @param msg Message to print
-		 * @param msglevel Level of message
+		 */
+		 /* @param msglevel Level of message
 		 * @param msgclass Class of message
 		 * @param time_type Type of timing to use
 		 */
-		void stop (const char *msg, long msglevel, const char *msgclass, long time_type)
-			{ stop (msg); }
+		void stop (const char *msg
+			   , long //msglevel
+			   , const char * //msgclass
+			   , long //time_type
+			  )
+		{
+			stop (msg);
+		}
 
-		/** Report progress
+		/** @internal
+		 * Report progress.
 		 * @param msg Message to print
 		 * @param msglevel Level of message
 		 * @param k Number of steps completed
@@ -508,66 +558,96 @@ namespace LinBox
 			report ((MessageLevel) msglevel, INTERNAL_DESCRIPTION) << msg << std::endl;
 		}
 
-		/** General reporting
+		/** @internal
+		 * General reporting.
 		 * @param msg Message to print
 		 * @param msglevel Level of message
 		 * @param msgclass Class of message
 		 */
 		void report (const char *msg, long msglevel, const char *msgclass)
-			{ report ((MessageLevel) msglevel, msgclass) << msg << std::endl; }
+		{
+			report ((MessageLevel) msglevel, msgclass) << msg << std::endl;
+		}
 
-		/** Test whether message is printed
+		/** @internal
+		 * Test whether message is printed.
 		 * @param msglevel Level of message
 		 * @param msgclass Class of message
 		 */
 		bool printed (long msglevel, const char *msgclass)
-			{ return isPrinted (_activities.size (), (MessageLevel) msglevel, msgclass); }
+		{
+			return isPrinted (_activities.size (), (MessageLevel) msglevel, msgclass);
+		}
 
 		//@} Legacy commentator interface
 
-		/** Use this stream to disable a message class entirely
-		 */
-		std::ostream cnull;
+		/** @internal
+		 * Use this stream to disable a message class entirely.
+		*/
+		std::ofstream cnull;
 
-	    private:
+	private:
+#if 0
 		// Null std::ostream prints nothing
 		struct nullstreambuf : public std::streambuf {
 			nullstreambuf() {};
-                        // GV modidied seek_dir twice 
-			std::streampos seekoff(std::streambuf::off_type, std::ios::seekdir, std::ios::openmode) {return 0;}
-			std::streampos seekpos(std::streambuf::pos_type, std::ios::openmode) {return 0;}
-			std::streampos sys_seek(std::streambuf::off_type, std::ios::seekdir) {return 0;}
-			std::streamsize showmanyc () {return 0;}
-			void imbue(const std::locale &loc) {}
+			// GV modidied seek_dir twice
+			std::streampos seekoff(std::streambuf::off_type, std::ios::seekdir, std::ios::openmode)
+			{
+				return 0;
+			}
+			std::streampos seekpos(std::streambuf::pos_type, std::ios::openmode)
+			{
+				return 0;
+			}
+			std::streampos sys_seek(std::streambuf::off_type, std::ios::seekdir)
+			{
+				return 0;
+			}
+			std::streamsize showmanyc ()
+			{
+				return 0;
+			}
+			void imbue(const std::locale &loc)
+			{}
 		};
+#endif
 
-	    protected:
+	protected:
 		struct StepsAndTime {
-			StepsAndTime (long k = 0, double t = 0.0)
-				: _time(t), _steps(k) {}
+			StepsAndTime (long k = 0, double t = 0.0) :
+				_time(t), _steps(k)
+			{}
 
 			double                   _time;
 			long                     _steps;
 		};
-        
+
 		typedef std::deque<StepsAndTime> Estimator;
 
 		struct Activity {
-			Activity (const char *desc, const char *fn, unsigned long len) 
-				: _desc (desc), _fn (fn), _len (len), _progress (0) {}
+			Activity (const char *desc, const char *fn, unsigned long len) :
+				_desc (desc), _fn (fn), _len (len), _progress (0)
+			{}
 
 			const char              *_desc;
 			const char              *_fn;
 			unsigned long            _len;
 			unsigned long            _progress;
-			Timer                    _timer;
+			::Givaro::Timer                    _timer;
 			Estimator                _estimate;
 		};
 
 		std::stack<Activity *>           _activities;      // Stack of activity structures
 
-		std::map<const char *, MessageClass *, LessThanString>
-			                         _messageClasses;
+		struct C_str_Less {
+			bool operator() (const char* x, const char * y) const {
+				return strcmp(x,y)<0;
+			}
+		};
+
+		std::map<const char *, MessageClass *, C_str_Less>
+		_messageClasses;
 		EstimationMethod                 _estimationMethod;     // Activity estimator
 
 		// Brief report parameters
@@ -588,14 +668,17 @@ namespace LinBox
 		virtual void finishActivityReport (Activity &activity, const char *msg);
 	};
 
-	/** Message class object
+	/** @internal
+	 * Message class object.
 	 * This object encapsulates the configuration of a given message class
 	 */
 	class MessageClass {
-	    public:
+	public:
 		friend class Commentator;
 
-		/** Constructor
+		/**  @internal
+		 * Constructor.
+		 *
 		 * Constructs a new MessageClass object with the given type,
 		 * outputing to the given stream. All other parameters are set
 		 * to factory defaults.
@@ -614,19 +697,21 @@ namespace LinBox
 			      unsigned long max_depth = 1,
 			      unsigned long max_level = 2);
 
-		/** Copy constructor
-		 */
-		MessageClass (const MessageClass &message_class)
-			: _msg_class (message_class._msg_class),
-			  _smart_streambuf (message_class._smart_streambuf.comm (),
-					    message_class._smart_streambuf.stream ()),
-			  _stream (&_smart_streambuf),
-			  _configuration (message_class._configuration),
-			  _max_level (message_class._max_level),
-			  _max_depth (message_class._max_depth)
+		/** @internal
+		 * Copy constructor.
+		*/
+		MessageClass (const MessageClass &message_class) :
+			_msg_class (message_class._msg_class),
+			_smart_streambuf (message_class._smart_streambuf.comm (),
+					  message_class._smart_streambuf.stream ()),
+			_stream (&_smart_streambuf),
+			_configuration (message_class._configuration),
+			_max_level (message_class._max_level),
+			_max_depth (message_class._max_depth)
 		{}
 
-		/** Set maximum message depth
+		/** @internal
+		 * Set maximum message depth.
 		 * Sets the maximum activity depth, as defined by
 		 * Commentator::start and Commentator::stop, at which messages
 		 * of this class will be printed.
@@ -636,7 +721,8 @@ namespace LinBox
 		 */
 		void setMaxDepth (long depth);
 
-		/** Set maximum detail level
+		/** @internal
+		 * Set maximum detail level.
 		 * Sets the maximum detail level at which to print messages
 		 * @param level Maximum detail level at which to print messages;
 		 *              set to -1 to print messages at all levels and 0
@@ -644,7 +730,8 @@ namespace LinBox
 		 */
 		void setMaxDetailLevel (long level);
 
-		/** Precise control over printing
+		/** @internal
+		 * Precise control over printing.
 		 * Specifies that all messages up to the given depth and the
 		 * given activity level should be printed
 		 * @param depth Maximum depth at which to print
@@ -655,8 +742,9 @@ namespace LinBox
 		 */
 		void setPrintParameters (unsigned long depth, unsigned long level, const char *fn);
 
-		/** Determine whether a given message will be printed when of
-		 * this message class
+		/** @internal
+		 * Determine whether a given message will be printed when of
+		 * this message class.
 		 * @param depth Activity depty of the message
 		 * @param level Detail level of the message
 		 * @param fn Fully qualified function name (0 if not applicable;
@@ -666,18 +754,17 @@ namespace LinBox
 		 */
 		bool isPrinted (unsigned long depth, unsigned long level, const char *fn = (const char *) 0);
 
-	    private:
-		typedef std::map <const char *, std::list<std::pair <unsigned long, unsigned long> >, LessThanString> Configuration;
+	private:
+		typedef std::map <const char *, std::list<std::pair <unsigned long, unsigned long> > > Configuration;
 
-		class smartStreambuf : public std::streambuf 
-		{
+		class smartStreambuf : public std::streambuf {
 			const Commentator &_comm;
 			std::ostream &_stream;
 			bool _indent_next;
 
-		    public:
-			smartStreambuf (const Commentator &comm, std::ostream &stream)
-				: _comm (comm), _stream (stream), _indent_next (true)
+		public:
+			smartStreambuf (const Commentator &comm, std::ostream &stream) :
+				_comm (comm), _stream (stream), _indent_next (true)
 			{}
 
 			int sync ();
@@ -685,8 +772,14 @@ namespace LinBox
 			std::streamsize xsputn (const char *text, std::streamsize n);
 			int writeData (const char *text, std::streamsize n);
 
-			const Commentator &comm () const { return _comm; }
-			std::ostream &stream () const { return _stream; }
+			const Commentator &comm () const
+			{
+			       	return _comm;
+			}
+			std::ostream &stream () const
+			{
+			       	return _stream;
+			}
 		};
 
 		const char     *_msg_class; // Name of this message class
@@ -715,52 +808,83 @@ namespace LinBox
 #endif
 
 #else //DISABLE_COMMENTATOR
-//#  define Commentator CommentatorDisabled
-//#  define MessageClass MessageClassDisabled
-//#  define commentator commentatorDisabled
+
+#if 0
+#  define Commentator CommentatorDisabled
+#  define MessageClass MessageClassDisabled
+#  define commentator commentatorDisabled
+#endif
 
 // This provides a "null" commentator that should compile totally out of the
 // program when DISABLE_COMMENTATOR is defined. All code making use of the
 // commentator should disappear.
 
-namespace LinBox 
+
+namespace LinBox
 {
 	// Forward declaration
 	class Commentator;
 
 	class MessageClass {
-	    public:
+	public:
 		friend class Commentator;
 
-		inline MessageClass (const char *msg_class, std::ostream &stream, unsigned long max_depth = 1, unsigned long max_level = 2) {}
-		inline MessageClass () {}
-		inline void setMaxDepth (long depth) {}
-		inline void setMaxDetailLevel (long level) {}
-		inline void setPrintParameters (unsigned long, unsigned long level, const char *fn) {}
-		inline bool isPrinted (unsigned long depth, unsigned long level, const char *fn = (const char *) 0) { return false; }
+		inline MessageClass (const char *, std::ostream &, unsigned long = 1, unsigned long = 2)
+	       	{}
+		inline MessageClass ()
+	       	{}
+		inline void setMaxDepth (long )
+	       	{}
+		inline void setMaxDetailLevel (long )
+	       	{}
+		inline void setPrintParameters (unsigned long, unsigned long , const char *)
+	       	{}
+		inline bool isPrinted (unsigned long , unsigned long , const char * = (const char *) 0)
+		{
+		       	return false;
+		}
 	};
 
 	class Commentator {
-	    public: 
-		inline Commentator () : cnull (new nullstreambuf) {}
-		inline  ~Commentator () {}
-		inline void start (const char *description, const char *fn = (const char *) 0, unsigned long len = 0) {}
-		inline void startIteration (unsigned int iter, unsigned long len = 0) {}
-		inline void stop (const char *msg, const char *long_msg = (const char *) 0, const char *fn = (const char *) 0) {}
-		inline void progress (long k = -1, long len = -1) {}
+	public:
+#if 0
+		inline Commentator () :
+			cnull (new nullstreambuf)
+		{}
+#endif
+		inline Commentator () :
+			cnull ("/dev/null")
+		{}
+		inline  ~Commentator ()
+	       	{}
+		inline void start (const char *, const char * = (const char *) 0, unsigned long = 0)
+	       	{}
+		inline void startIteration (unsigned int , unsigned long = 0)
+		{}
+		inline void stop (const char *, const char * = (const char *) 0, const char * = (const char *) 0)
+		{}
+		inline void progress (long = -1, long = -1)
+	       	{}
 
 		enum MessageLevel {
 			LEVEL_ALWAYS       =  0,
 			LEVEL_IMPORTANT    =  1,
 			LEVEL_NORMAL       =  2,
-			LEVEL_UNIMPORTANT  =  3,
+			LEVEL_UNIMPORTANT  =  3
 		};
 
-		inline std::ostream &report (long level, const char *msg_class) { return cnull; }
-		inline void indent (std::ostream &stream) {}
+		inline std::ostream &report (long , const char *)
+		{
+		       	return cnull;
+		}
+
+		inline void indent (std::ostream &)
+		{}
 
-		enum OutputFormat
-			{ OUTPUT_CONSOLE, OUTPUT_PIPE };
+		enum OutputFormat {
+		       	OUTPUT_CONSOLE,
+			OUTPUT_PIPE
+		};
 
 		enum EstimationMethod {
 			BEST_ESTIMATE,
@@ -773,54 +897,99 @@ namespace LinBox
 			LONG_TIMING
 		};
 
-		inline void setMaxDepth (long depth) {}
-		inline void setMaxDetailLevel (long level) {}
-		inline MessageClass &registerMessageClass (const char *msg_class, std::ostream &stream, unsigned long max_depth = 1, unsigned long max_level = 2)
-			{ return _msgcls; }
-		inline MessageClass &cloneMessageClass (const char *new_msg_class, const char *msg_class)
-			{ return _msgcls; }
-		inline MessageClass &cloneMessageClass (const char *new_msg_class, const char *msg_class, std::ostream &stream)
-			{ return _msgcls; }
-		inline MessageClass &getMessageClass (const char *msg_class)
-			{ return _msgcls; }
-		inline void setPrintParameters (unsigned long depth, unsigned long level, const char *fn = (const char *) 0) {}
-		inline void setBriefReportParameters (OutputFormat format, bool show_timing, bool show_progress, bool show_est_time) {}
-		inline bool isPrinted (unsigned long depth, unsigned long level, const char *msg_class, const char *fn = (const char *) 0)
-			{ return false; }
-		inline bool isPrinted (unsigned long level, const char *msg_class, const char *fn = (const char *) 0) { return false; }
-		inline bool isNullStream (const std::ostream &str) { return true; }
-		inline void setBriefReportStream (std::ostream &stream) {}
-		inline void setReportStream (std::ostream &stream) {}
-		inline void setMessageClassStream (const char *msg_class, std::ostream &stream) {}
-		inline void setDefaultReportFile (const char *filename) {}
-		inline void start (const char *id, const char *msg, long msglevel, const char *msgclass) {}
-		inline void stop (const char *msg, long msglevel, const char *msgclass, long time_type) {}
-		inline void progress (const char *msg, long msglevel, long k, long n) {}
-		inline void report (const char *msg, long msglevel, const char *msgclass) {}
-		inline bool printed (long msglevel, const char *msgclass) { return false; }
-
-		std::ostream cnull;
-
-	    private:
+		inline void setMaxDepth (long )
+	       	{}
+		inline void setMaxDetailLevel (long )
+		{}
+		inline MessageClass &registerMessageClass (const char *, std::ostream &, unsigned long = 1, unsigned long = 2)
+		{
+		       	return _msgcls;
+		}
+		inline MessageClass &cloneMessageClass (const char *, const char *)
+		{
+		       	return _msgcls;
+	       	}
+		inline MessageClass &cloneMessageClass (const char *, const char *, std::ostream &)
+		{
+		       	return _msgcls;
+	       	}
+		inline MessageClass &getMessageClass (const char *)
+		{
+		       	return _msgcls;
+	       	}
+		inline void setPrintParameters (unsigned long , unsigned long , const char * = (const char *) 0)
+	       	{}
+		inline void setBriefReportParameters (OutputFormat , bool , bool , bool )
+	       	{}
+		inline bool isPrinted (unsigned long , unsigned long , const char *, const char * = (const char *) 0)
+		{
+		       	return false;
+	       	}
+		inline bool isPrinted (unsigned long , const char *, const char * = (const char *) 0)
+		{
+		       	return false;
+		}
+		inline bool isNullStream (const std::ostream &)
+		{
+		       	return true;
+		}
+		inline void setBriefReportStream (std::ostream &)
+		{}
+		inline void setReportStream (std::ostream &)
+	       	{}
+		inline void setMessageClassStream (const char *, std::ostream &)
+	       	{}
+		inline void setDefaultReportFile (const char *)
+	       	{}
+		inline void start (const char *, const char *, long , const char *)
+	       	{}
+		inline void stop (const char *, long , const char *, long)
+	       	{}
+		inline void progress (const char *, long , long , long )
+	       	{}
+		inline void report (const char *, long , const char *)
+	       	{}
+		inline bool printed (long , const char *)
+		{
+		       	return false;
+		}
+
+		std::ofstream cnull;
+
+	private:
+#if 0
 		// Null std::ostream prints nothing
 		struct nullstreambuf : public std::streambuf {
 			nullstreambuf () {};
 			~nullstreambuf () {};
-			inline std::streampos seekoff (std::streambuf::off_type, std::ios::seekdir, std::ios::openmode) { return 0; }
-			inline std::streampos seekpos (std::streambuf::pos_type, std::ios::openmode) { return 0; }
-			inline std::streampos sys_seek (std::streambuf::off_type, std::ios::seekdir) { return 0; }
-			inline std::streamsize showmanyc () { return 0; }
+			inline std::streampos seekoff (std::streambuf::off_type, std::ios::seekdir, std::ios::openmode)
+			{
+			       	return 0;
+			}
+			inline std::streampos seekpos (std::streambuf::pos_type, std::ios::openmode)
+			{
+			       	return 0;
+			}
+			inline std::streampos sys_seek (std::streambuf::off_type, std::ios::seekdir)
+			{
+			       	return 0;
+			}
+			inline std::streamsize showmanyc ()
+			{
+			       	return 0;
+			}
 			inline void imbue (const std::locale &loc) {}
 		};
+#endif
 
 		MessageClass _msgcls;
 	};
 
 	// Default global commentator
-	Commentator commentator;
+	extern Commentator commentator;
 	//static Commentator commentator;
 }
 
 #endif // DISABLE_COMMENTATOR
 
-#endif // __COMMENTATOR_H
+#endif // __LINBOX_commentator_H
diff --git a/linbox/util/contracts.h b/linbox/util/contracts.h
new file mode 100644
index 0000000..5b5fb79
--- /dev/null
+++ b/linbox/util/contracts.h
@@ -0,0 +1,75 @@
+/* -*- 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
+/* Copyright (C) LinBox
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_util_contracts_H
+#define __LINBOX_util_contracts_H
+
+// Object class is the base class for all
+// objects in the system. All classes inheriting from this class need
+// to define a method IsValid. This method should perform a
+// consistency check on the state of the object. Note that
+// this method needs to be defined only when a debug build is made
+#include <cassert>
+#include <cstddef>
+#if 0
+class Object {
+public:
+#ifdef _DEBUG
+	virtual bool IsValid() const = 0;
+#endif
+
+};
+#endif
+#if _DEBUG == 2
+
+// The debug mode also defines the following macros. Failure of any of these macros leads to
+// program termination. The user is notified of the error condition with the right file name
+// and line number. The actual failing operation is also printed using the stringizing operator #
+
+#define ASSERT(bool_expression) assert(bool_expression)
+#define IS_VALID(obj) ASSERT((obj) != NULL && (obj)->IsValid())
+#define REQUIRE(bool_expression) ASSERT(bool_expression)
+#define ENSURE(bool_expression) ASSERT(bool_expression)
+#define STATE(expression) expression
+
+#elif _DEBUG == 1
+
+#define ASSERT(bool_expression) assert(bool_expression)
+#define IS_VALID(obj) ASSERT((obj) != NULL && (obj)->IsValid())
+#define REQUIRE(bool_expression) if( ! bool_expression ) throw InvalidOperationException(__FILE__,__LINE__);
+#define ENSURE(bool_expression) ASSERT(bool_expression)
+#define STATE(expression) expression
+
+#elif _DEBUG == 0
+
+// When built in release mode, the _DEBUG flag would not be defined, thus there will be no overhead
+// in the final release from these checks.
+
+#define ASSERT(ignore) ((void) 0)
+#define IS_VALID(ignore) ((void) 0)
+#define REQUIRE(ignore) ((void) 0)
+#define ENSURE(ignore) ((void) 0)
+#define STATE(ignore) ((void) 0)
+
+#endif
+
+#endif //__LINBOX_util_contracts_H
diff --git a/linbox/util/debug.C b/linbox/util/debug.C
index 1481307..03a0413 100644
--- a/linbox/util/debug.C
+++ b/linbox/util/debug.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* linbox/util/debug.C
  * Copyright (C) 2001 Bradford Hovinen
@@ -35,4 +36,6 @@ namespace LinBox
 	}
 
 	std::ostream *PreconditionFailed::_errorStream;
+
+	std::ostream *NotImplementedYet::_errorStream ;
 }
diff --git a/linbox/util/debug.h b/linbox/util/debug.h
index ccdc807..fbb899d 100644
--- a/linbox/util/debug.h
+++ b/linbox/util/debug.h
@@ -1,9 +1,13 @@
 /* -*- 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
 /* linbox/util/debug.h
- * Copyright (C) 2001 Bradford Hovinen
  *
+ * Copyright (C) 2001,2010 LinBox
+ * Copyright (C) 2001 Bradford Hovinen
+ * Copyright (C) 2010 LinBox
  * Written by Bradford Hovinen <hovinen at cis.udel.edu>
+ * Modified by BB.
+ *
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -19,22 +23,36 @@
  * License along with this library; if not, write to the
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
+ *
+ */
+
+/*! @file util/debug.h
+ * @ingroup util
+ * Various utilities for debugging.
+ * @todo we should put vector printing elsewhere.
  */
 
-#ifndef __UTIL_DEBUG_H
-#define __UTIL_DEBUG_H
+#ifndef __LINBOX_util_debug_H
+#define __LINBOX_util_debug_H
 
 #include <iostream>
 #include <sstream>
-#include <linbox/util/error.h>
+#include "linbox/util/error.h"
+#include <vector>
+#include <list>
 
+/*! Check an assertion (à la \c std::assert).
+ * If in DEBUG mode, throws a \ref PreconditionFailed exception.
+ * In REALEASE mode, nothing is checked.
+ * @param check assertion to be checked.
+ */
 #ifndef DEBUG
 #  define linbox_check(check)
 #else
 #  ifdef __GNUC__
 #    define linbox_check(check) \
         if (!(check)) \
-                 throw LinBox::PreconditionFailed (__FUNCTION__, __LINE__, #check);
+                 throw LinBox::PreconditionFailed (__func__, __FILE__, __LINE__, #check); //BB : should work on non gnu compilers too
 #  else
 #    define linbox_check(check) \
         if (!(check)) \
@@ -44,12 +62,27 @@
 
 namespace LinBox
 {
-	class PreconditionFailed : public LinboxError
-	{
+	/*!  A precondtion failed.
+	 * @ingroup util
+	 * The \c throw mechanism is usually used here as in
+	 \code
+	 if (!check)
+	 throw(PreconditionFailed(__func__,__LINE__,"this check just failed");
+	 \endcode
+	 * The parameters of the constructor help debugging.
+	 */
+	class PreconditionFailed {//: public LinboxError BB: otherwise,  error.h:39 segfaults
 		static std::ostream *_errorStream;
 
-	    public:
-		PreconditionFailed (const char *function, int line, const char *check) {
+	public:
+		/*! @internal
+		 * A precondtion failed.
+		 * @param function usually \c __func__, the function that threw the error
+		 * @param line     usually \c __LINE__, the line where it happened
+		 * @param check    a string telling what failed.
+		 */
+		PreconditionFailed (const char *function, int line, const char *check)
+		{
 			if (_errorStream == (std::ostream *) 0)
 				_errorStream = &std::cerr;
 
@@ -58,16 +91,150 @@ namespace LinBox
 			(*_errorStream) << "Precondition not met:" << check << std::endl;
 		}
 
+		/*! @internal
+		 * A precondtion failed.
+		 * The parameter help debugging. This is not much different from the previous
+		 * except we can digg faster in the file where the exception was triggered.
+		 * @param function usually \c __func__, the function that threw the error
+		 * @param file     usually \c __FILE__, the file where this function is
+		 * @param line     usually \c __LINE__, the line where it happened
+		 * @param check    a string telling what failed.
+		 */
+		PreconditionFailed (const char* function, const char *file, int line, const char *check)
+		{
+			if (_errorStream == (std::ostream *) 0)
+				_errorStream = &std::cerr;
+
+			(*_errorStream) << std::endl << std::endl;
+			(*_errorStream) << "ERROR (at " << function << " in " << file << ':' <<  line << "): " << std::endl;
+			(*_errorStream) << "Precondition not met:" << check << std::endl;
+		}
+
 		static void setErrorStream (std::ostream &stream);
 
-		// -- overload the virtual print of LinboxError
-		std::ostream &print (std::ostream &o) const { 
+		/*! @internal overload the virtual print of LinboxError.
+		 * @param o output stream
+		 */
+		std::ostream &print (std::ostream &o) const
+		{
 			if (std::ostringstream * str = dynamic_cast<std::ostringstream*>(_errorStream))
-				return o << str->str() ; 
+				return o << str->str() ;
 			else
 				throw LinboxError("LinBox ERROR: PreconditionFailed exception is not initialized correctly");
 		}
 	};
+
+	/*! @internal A function is "not implemented yet(tm)".
+	 * where, why ?
+	 */
+	class NotImplementedYet {
+	protected:
+		static std::ostream *_errorStream;
+
+	public:
+		/*! @internal
+		 * A precondtion failed.
+		 * The parameter help debugging. This is not much different from the previous
+		 * except we can digg faster in the file where the exception was triggered.
+		 * @param function usually \c __func__, the function that threw the error
+		 * @param file     usually \c __FILE__, the file where this function is
+		 * @param line     usually \c __LINE__, the line where it happened
+		 * @param why      by default, lazy people don't provide an explanation.
+		 */
+		NotImplementedYet() {}
+
+		NotImplementedYet(const char * function,
+				  const char* file,
+				  int line,
+				  const char * why='\0')
+		{
+			if (_errorStream == (std::ostream *) 0)
+				_errorStream = &std::cerr;
+
+			(*_errorStream) << std::endl << std::endl;
+			(*_errorStream) << "ERROR (at " << function << " in " << file << ':' <<  line << "): " << std::endl;
+			(*_errorStream) << " This function is not implemented yet" ;
+			if (why)
+				(*_errorStream)	<< " (" << why << ")" <<std::endl;
+			else
+				(*_errorStream)	<<  "." << std::endl;
+
+		}
+	};
+
+	/*! @internal Something went wrong.
+	 * what ?
+	 */
+	class LinBoxFailure : public NotImplementedYet {
+	public:
+		/*! @internal
+		 * LinBox failed.
+		 * The parameter help debugging/explaining.
+		 * @param function usually \c __func__, the function that threw the error
+		 * @param file     usually \c __FILE__, the file where this function is
+		 * @param line     usually \c __LINE__, the line where it happened
+		 * @param what     what happened ? should not be NULL...
+		 */
+		LinBoxFailure(const char * function,
+			      const char* file,
+			      int line,
+			      const char * what='\0')
+		{
+			if (_errorStream == (std::ostream *) 0)
+				_errorStream = &std::cerr;
+
+			(*_errorStream) << std::endl << std::endl;
+			(*_errorStream) << "ERROR (at " << function << " in " << file << ':' <<  line << "): " << std::endl;
+			(*_errorStream) << " failure : " ;
+			if (what)
+				(*_errorStream)	<< what << "." <<std::endl;
+			else
+				(*_errorStream)	<<  "no explanation." << std::endl;
+
+		}
+	};
+
+	/*! @internal Something is wrong.
+	 * what ?
+	 */
+	class LinBoxError : public NotImplementedYet {
+	public:
+		/*! @internal
+		 * User failed.
+		 * The parameter help debugging/explaining.
+		 * @param function usually \c __func__, the function that threw the error
+		 * @param file     usually \c __FILE__, the file where this function is
+		 * @param line     usually \c __LINE__, the line where it happened
+		 * @param what     what happened ? should not be NULL...
+		 */
+		LinBoxError(const char * what,
+			    const char * function='\0',
+			    const char* file='\0',
+			    int line=-1)
+		{
+			if (_errorStream == (std::ostream *) 0)
+				_errorStream = &std::cerr;
+
+			(*_errorStream) << std::endl << std::endl;
+			(*_errorStream) << " *** ERROR *** : " << what << std::endl;
+			if (function) {
+				(*_errorStream) << "(at " << function ;
+				if (file) {
+					(*_errorStream) << " in " << file ;
+					if (line>=0)
+						(*_errorStream) << ':' <<  line ;
+					(*_errorStream) << ")" ;
+				}
+			}
+			else if (file) { // extremely unlikely...
+				(*_errorStream) << "(in " << file ;
+				if (line>=0)
+					(*_errorStream) << ':' <<  line ;
+				(*_errorStream) << ")" ;
+			}
+			(*_errorStream) << std::endl;
+		}
+	};
 }
 
 #ifdef LinBoxSrcOnly
@@ -75,4 +242,7 @@ namespace LinBox
 #include <linbox/util/debug.C>
 #endif
 
-#endif // __UTIL_DEBUG_H
+#include <fflas-ffpack/utils/print-utils.h>
+
+#endif // __LINBOX_util_debug_H
+
diff --git a/linbox/util/error.C b/linbox/util/error.C
index d0780c1..9496423 100644
--- a/linbox/util/error.C
+++ b/linbox/util/error.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* linbox/util/error.C
  * Copyright (C) 1994-1997 Givaro Team
@@ -27,9 +28,9 @@
 
 namespace LinBox
 {
-	std::ostream& operator<< (std::ostream& o, const LinboxError& E) 
+	std::ostream& operator<< (std::ostream& o, const LinboxError& E)
 	{
-		E.print(o) ; 
+		E.print(o) ;
 		return o ;
 	}
 }
diff --git a/linbox/util/error.h b/linbox/util/error.h
index 07e19e2..447fb81 100644
--- a/linbox/util/error.h
+++ b/linbox/util/error.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/util/error.h
  * Copyright (C) 1994-1997 Givaro Team
  *
@@ -21,8 +21,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __UTIL_ERROR_H
-#define __UTIL_ERROR_H
+#ifndef __LINBOX_util_error_H
+#define __LINBOX_util_error_H
 
 #include <cstring>
 #include <iostream>
@@ -30,61 +30,70 @@
 namespace LinBox
 {
 
-// ------------------------------- LinboxError
-/** base class for execption handling in Givaro
-\ingroup util
-*/
-class LinboxError {
-	const static size_t max_error_string = 256;
-public:
-	LinboxError (const char* msg = 0) {
-		std::strncpy(strg, msg, max_error_string);
-		strg[max_error_string-1] = 0;
-	};
+	// ------------------------------- LinboxError
+	/** base class for execption handling in Givaro.
+	  \ingroup util
+	  */
+	class LinboxError {
+		static const size_t max_error_string = 256;
+	public:
+		LinboxError (const char* msg = '\0') {
+			std::strncpy(strg, msg, max_error_string);
+			strg[max_error_string-1] = 0;
+		};
 
 
-	// -- virtual print of the error message
-	virtual std::ostream &print (std::ostream &o) const
-	{ return o << strg<<std::endl ; }
-  
-	// -- non virtual output operator
-	friend std::ostream &operator << (std::ostream &o, const LinboxError &E);
+		// -- virtual print of the error message
+		virtual std::ostream &print (std::ostream &o) const
+		{ return o << strg<<std::endl ; }
 
-	// - useful to setup a break point on it
-	static void throw_error (const LinboxError &err)
+		// -- non virtual output operator
+		friend std::ostream &operator << (std::ostream &o, const LinboxError &E);
+
+		// - useful to setup a break point on it
+		static void throw_error (const LinboxError &err)
 		{ throw err; }
 
-    	virtual ~LinboxError() {}        
-
-    protected:
-	char strg[max_error_string]; 
-};
-
-class LinboxMathError : public LinboxError {
- public:
-	LinboxMathError (const char* msg) : LinboxError (msg) {};
-};
-
-class LinboxMathDivZero : public LinboxMathError {
- public:
-	LinboxMathDivZero (const char* msg) : LinboxMathError (msg) {};
-};
-
-class LinboxMathInconsistentSystem : public LinboxMathError {
- public:
-	LinboxMathInconsistentSystem (const char* msg) : LinboxMathError (msg) {};
-};
-
-// -- Exception thrown in input of data structure 
-class LinboxBadFormat : public LinboxError {
- public:
-	LinboxBadFormat (const char* msg) : LinboxError (msg) {};
-};
- 
+		virtual ~LinboxError() {}
+
+	protected:
+		char strg[max_error_string];
+	};
+
+	class LinboxMathError : public LinboxError {
+	public:
+		LinboxMathError (const char* msg) :
+			LinboxError (msg)
+		{};
+	};
+
+	class LinboxMathDivZero : public LinboxMathError {
+	public:
+		LinboxMathDivZero (const char* msg) :
+			LinboxMathError (msg)
+		{};
+	};
+
+	class LinboxMathInconsistentSystem : public LinboxMathError {
+	public:
+		LinboxMathInconsistentSystem (const char* msg) :
+			LinboxMathError (msg)
+		{};
+	};
+
+	// -- Exception thrown in input of data structure
+	class LinboxBadFormat : public LinboxError {
+	public:
+		LinboxBadFormat (const char* msg) :
+			LinboxError (msg)
+		{};
+	};
+
 }
 
 #ifdef LinBoxSrcOnly       // for all-source compilation
 #    include <linbox/util/error.C>
 #endif
 
-#endif // __UTIL_ERROR_H
+#endif // __LINBOX_util_error_H
+
diff --git a/linbox/util/field-axpy.h b/linbox/util/field-axpy.h
index 94381b2..d497540 100644
--- a/linbox/util/field-axpy.h
+++ b/linbox/util/field-axpy.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/util/field-axpy.h
  * Copyright (C) 1999-2001 William J Turner,
  *               2001 Bradford Hovinen
@@ -23,16 +23,16 @@
  * Boston, MA 02111-1307, USA.
  */
 
-#ifndef __UTIL_FIELD_AXPY_H
-#define __UTIL_FIELD_AXPY_H
+#ifndef __LINBOX_util_field_axpy_H
+#define __LINBOX_util_field_axpy_H
 
 // Namespace in which all LinBox library code resides
 namespace LinBox
 {
 	/** FieldAXPY object.
 	 *
-	 * This class is used to wrap the operation y = y + a * x. It acts as an
-	 * accumulator for y.
+	 * This class is used to wrap the operation <code>y = y + a * x</code>. It acts as an
+	 * accumulator for \c y.
 	 *
 	 * Through the use of template specialization, objects of this type can
 	 * be used to speed up vector dot product operations. In particular, for
@@ -40,16 +40,15 @@ namespace LinBox
 	 * expensive. In many cases, this can be postponed until the end of the
 	 * dot product operation, thus vastly improving performance.
 	 *
-	 * This object is constructed from the field object F and a field
+	 * This object is constructed from the field object \c F and a field
 	 * element a which it stores and thus can use several times.  The use of
 	 * an object instead of a static variable to store the element a makes
 	 * this method thread-safe.
 	 *
-	 * @param Field \Ref{LinBox} {@link Fields field}
+	 * @param Field \ref LinBox @link Fields field at endlink
 	 */
 	template <class Field>
-	class FieldAXPY 
-	{
+	class FieldAXPY {
 	    public:
 
 		/// Definition of element type
@@ -60,17 +59,21 @@ namespace LinBox
 		 * Copies of this objects are stored in the faxpy object.
 		 * @param F field F in which arithmetic is done
 		 */
-		FieldAXPY (const Field &F) : _F (F) { _F.init (_y, 0); }
+		FieldAXPY (const Field &F) :
+		       	_F (F)
+		{ _F.init (_y, 0); }
 
 		/** Copy constructor.
 		 * @param faxpy
 		 */
-		FieldAXPY (const FieldAXPY<Field> &faxpy) : _F (faxpy._F), _y (faxpy._y) {}
+		FieldAXPY (const FieldAXPY<Field> &faxpy) :
+		       	_F (faxpy._F), _y (faxpy._y)
+	       	{}
 
 		/** Assignment operator
 		 * @param faxpy
 		 */
-		FieldAXPY<Field> &operator = (const FieldAXPY &faxpy) 
+		FieldAXPY<Field> &operator = (const FieldAXPY &faxpy)
 			{ _y = faxpy._y; return *this; }
 
 		/** Add a*x to y
@@ -80,10 +83,10 @@ namespace LinBox
 		 */
             inline Element& mulacc (const Element &a, const Element &x)
                 { return _F.axpyin (_y, a, x); }
-            
+
             inline Element& accumulate (const Element &t)
                 { return _F.addin (_y, t); }
-            
+
 		/** Retrieve y
 		 *
 		 * Performs the delayed modding out if necessary
@@ -93,19 +96,19 @@ namespace LinBox
 		/** Assign method.
 		 * Stores new field element for arithmetic.
 		 * @return reference to self
-		 * @param y_init constant reference to element a
+		 * @param y constant reference to element a
 		 */
 		inline FieldAXPY &assign (const Element y)
 		{
 			_y = y;
 			return *this;
 		}
-		
+
 		inline void reset() {
 			_F.init(_y,0);
 		}
 
-	    private:
+	    protected:
 
 		/// Field in which arithmetic is done
 		/// Not sure why it must be mutable, but the compiler complains otherwise
@@ -118,4 +121,5 @@ namespace LinBox
 
 } // namespace LinBox
 
-#endif // __UTIL_FIELD_AXPY_H
+#endif // __LINBOX_util_field_axpy_H
+
diff --git a/linbox/util/formats/Makefile.am b/linbox/util/formats/Makefile.am
index 6a80eec..e95456e 100644
--- a/linbox/util/formats/Makefile.am
+++ b/linbox/util/formats/Makefile.am
@@ -1,3 +1,6 @@
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 pkgincludesubdir=$(pkgincludedir)/util/formats
 
 pkgincludesub_HEADERS=			\
diff --git a/linbox/util/formats/Makefile.in b/linbox/util/formats/Makefile.in
index 5fc4979..e9cb5d3 100644
--- a/linbox/util/formats/Makefile.in
+++ b/linbox/util/formats/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -37,19 +38,26 @@ DIST_COMMON = $(pkgincludesub_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
-	$(top_srcdir)/macros/blas-check.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
 	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
 	$(top_srcdir)/macros/givaro-check.m4 \
 	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
 	$(top_srcdir)/macros/lidia-check.m4 \
 	$(top_srcdir)/macros/linbox-doc.m4 \
 	$(top_srcdir)/macros/linbox-misc.m4 \
 	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
 	$(top_srcdir)/macros/maple-check.m4 \
 	$(top_srcdir)/macros/ntl-check.m4 \
 	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -79,18 +87,21 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
 CC = @CC@
+CCNAM = @CCNAM@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
 DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -98,19 +109,24 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
 GIVARO_CFLAGS = @GIVARO_CFLAGS@
 GIVARO_LIBS = @GIVARO_LIBS@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
 GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
@@ -118,41 +134,52 @@ LIBTOOL = @LIBTOOL@
 LIDIA_CFLAGS = @LIDIA_CFLAGS@
 LIDIA_LIBS = @LIDIA_LIBS@
 LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MAPLE_CFLAGS = @MAPLE_CFLAGS@
 MAPLE_HOME = @MAPLE_HOME@
 MAPLE_LIBS = @MAPLE_LIBS@
 MAPLE_VERSION = @MAPLE_VERSION@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
 NTL_CFLAGS = @NTL_CFLAGS@
 NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RM = @RM@
 SACLIB_CFLAGS = @SACLIB_CFLAGS@
 SACLIB_LIBS = @SACLIB_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+TESTS_CFLAGS = @TESTS_CFLAGS@
 VERSION = @VERSION@
+WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -193,8 +220,13 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 pkgincludesubdir = $(pkgincludedir)/util/formats
 pkgincludesub_HEADERS = \
 	generic-dense.h			\
@@ -211,8 +243,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
 	      exit 1;; \
 	  esac; \
 	done; \
@@ -265,7 +297,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
@@ -378,6 +410,8 @@ dvi-am:
 
 html: html-am
 
+html-am:
+
 info: info-am
 
 info-am:
@@ -386,18 +420,28 @@ install-data-am: install-pkgincludesubHEADERS
 
 install-dvi: install-dvi-am
 
+install-dvi-am:
+
 install-exec-am:
 
 install-html: install-html-am
 
+install-html-am:
+
 install-info: install-info-am
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-am
 
+install-pdf-am:
+
 install-ps: install-ps-am
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
diff --git a/linbox/util/formats/generic-dense.h b/linbox/util/formats/generic-dense.h
index 0ae7ca1..ac583e7 100644
--- a/linbox/util/formats/generic-dense.h
+++ b/linbox/util/formats/generic-dense.h
@@ -1,87 +1,114 @@
+/* -*- 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
+/* Copyright (C) 2010 LinBox
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+#ifndef __LINBOX_format_dense_H
+#define __LINBOX_format_dense_H
+
 /* dense.h
  * MatrixStreamReader specialization for matrices in the generic dense format:
  * 1st line: #rows #cols
  * Subsequent lines: every entry, row by row.
  */
 
-#ifndef __FORMAT_DENSE_H
-#define __FORMAT_DENSE_H
-
-/*
+#if 0
 namespace LinBox__FORMAT_DENSE_H
-	{ static const char* name = "Generic Dense Format";
-	  static const char* shortname = "dense"; }
-	  */
-
-namespace LinBox {
-
-template<class Field>
-class DenseReader :public MatrixStreamReader<Field> {
-    public:
-    	typedef typename MatrixStreamReader<Field>::Element Element;
-    private:
-    	size_t currentRow, currentCol;
-    protected:
-
-    	MatrixStreamError initImpl(const char* firstLine) {
-		char* restLine;
-		int i = 0;
-
-		// Read m
-		this->_m = strtoul(firstLine,&restLine,0);
-		if( this->_m == 0 && restLine == firstLine )
-			return NO_FORMAT;
-		i = restLine - firstLine;
-
-		// Read n
-		this->_n = strtoul(firstLine+i,&restLine,0);
-		if( this->_n == 0 && restLine == (firstLine+i) )
-			return NO_FORMAT;
-		i = restLine - firstLine;
-
-		// Check whitespace for rest of line
-		++i;
-		while( firstLine[i] && isspace(firstLine[i]) )
+{
+	static const char* name = "Generic Dense Format";
+	static const char* shortname = "dense";
+}
+#endif
+
+namespace LinBox
+{
+
+	template<class Field>
+	class DenseReader :public MatrixStreamReader<Field> {
+	public:
+		typedef typename MatrixStreamReader<Field>::Element Element;
+	private:
+		size_t currentRow, currentCol;
+	protected:
+
+		MatrixStreamError initImpl(const char* firstLine) {
+			char* restLine;
+			int i = 0;
+
+			// Read m
+			this->_m = strtoul(firstLine,&restLine,0);
+			if( this->_m == 0 && restLine == firstLine )
+				return NO_FORMAT;
+			i = restLine - firstLine;
+
+			// Read n
+			this->_n = strtoul(firstLine+i,&restLine,0);
+			if( this->_n == 0 && restLine == (firstLine+i) )
+				return NO_FORMAT;
+			i = restLine - firstLine;
+
+			// Check whitespace for rest of line
 			++i;
-		if( firstLine[i] ) return BAD_FORMAT;
-
-		this->knowM = this->knowN = true;
-
-		currentRow = currentCol = 0;
-		return GOOD;
-	}
-
-	MatrixStreamError nextTripleImpl( size_t& m, size_t& n, Element& v ) {
-	    if( currentRow == this->_m ) return END_OF_MATRIX;
-	    m = currentRow;
-	    n = currentCol;
-
-	    this->ms->readWhiteSpace();
-	    this->ms->getField().read(*(this->sin),v);
-	    if( this->sin->eof() ) return END_OF_FILE;
-	    if( !this->sin->good() ) return BAD_FORMAT;
-	    
-	    if( ++currentCol == this->_n ) {
-	    	++currentRow;
-		currentCol = 0;
-	    }
-	    return GOOD;
-	}
-
-    public:
-    	DenseReader() {
-		currentRow = currentCol = -1;
-	}
-
-	bool isSparse() const { return false; }
-    	
-	const char* getName() const { return "Generic Dense Format"; }//LinBox__FORMAT_DENSE_H::name; }
-	
-	const char* shortName() const 
-		{ return "dense"; }//LinBox__FORMAT_DENSE_H::shortname; }
+			while( firstLine[i] && isspace(firstLine[i]) )
+				++i;
+			if( firstLine[i] ) return BAD_FORMAT;
+
+			this->knowM = this->knowN = true;
+
+			currentRow = currentCol = 0;
+			return GOOD;
+		}
+
+		MatrixStreamError nextTripleImpl( size_t& m, size_t& n, Element& v ) {
+			if( currentRow == this->_m ) return END_OF_MATRIX;
+			m = currentRow;
+			n = currentCol;
+
+			this->ms->readWhiteSpace();
+			this->ms->getField().read(*(this->sin),v);
+			if( this->sin->eof() ) return END_OF_FILE;
+			if( !this->sin->good() ) return BAD_FORMAT;
+
+			if( ++currentCol == this->_n ) {
+				++currentRow;
+				currentCol = 0;
+			}
+			return GOOD;
+		}
+
+	public:
+		DenseReader() {
+			currentRow = currentCol = (size_t) -1;
+		}
+
+		bool isSparse() const { return false; }
+
+		const char* getName() const { return "Generic Dense Format"; }//LinBox__FORMAT_DENSE_H::name; }
+
+		const char* shortName() const
+		{ return "dense"; }//LinBox__FORMAT_DENSE_H::shortname;
 
 };
 
 }
 
-#endif // __FORMAT_DENSE_H
+#endif // __LINBOX_format_dense_H
+
diff --git a/linbox/util/formats/maple.h b/linbox/util/formats/maple.h
index be4a47d..a84c61f 100644
--- a/linbox/util/formats/maple.h
+++ b/linbox/util/formats/maple.h
@@ -1,3 +1,29 @@
+/* -*- 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
+/* Copyright (C) 2005 LinBox
+ * Written by  Dan Roche
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_format_maple_H
+#define __LINBOX_format_maple_H
+
 /* matrix-market-array.h
  * MatrixStreamReader for Maple-style (text) matrices.
  * The general format is Matrix(r,c,<init> [,...]),
@@ -8,435 +34,435 @@
  * and even the outer Matrix(...) part is. In any case, either the word
  * "Matrix" or two opening square brackets "[[" must be present on the
  * first line so the format can be identified.
- * Dan Roche, 1-25-05
  */
 
-#ifndef __FORMAT_MAPLE_H
-#define __FORMAT_MAPLE_H
-
 #include <string>
 #include <sstream>
 #include <linbox/util/matrix-stream.h>
 
-/*
+#if 0
 namespace LinBox__FORMAT_MAPLE_H
-	{ static const char* name = "Maple Text Format";
-	  static const char* shortname = "maple"; }
-	  */
-
-namespace LinBox {
-
-template<class Field>
-class MapleReader :public MatrixStreamReader<Field> {
-    public:
-    	typedef typename MatrixStreamReader<Field>::Element Element;
-    private:
-	/* These are used to keep track of where we are in the data for
-	 * array-based data. They are also used to keep track of where we
-	 * are in reading the frontmatter of the matrix.
-	 * If currentCol is 0, then we have not reached the matrix data yet.
-	 * Then currentRow can be 0,2,3,4,5, depending on how many of the
-	 * tokens ( r , c , have been read.
-	 */
-	size_t currentCol, currentRow;
-	bool openParen;
-	bool array;
-	std::stringstream *stin;
-
-	MatrixStreamError processCandidate( const char* cand ) {
-		if( strlen(cand) < 6 ||
-		    tolower(cand[1]) != 'a' ||
-		    tolower(cand[2]) != 't' ||
-		    tolower(cand[3]) != 'r' ||
-		    tolower(cand[4]) != 'i' ||
-		    tolower(cand[5]) != 'x' )
-			return NO_FORMAT;
-		
-		int i = 6;
-		while( cand[i] && isspace(cand[i]) ) ++i;
-		
-		if( !cand[i] ) {
+{
+	static const char* name = "Maple Text Format";
+	static const char* shortname = "maple";
+}
+#endif
+
+namespace LinBox
+{
+
+	template<class Field>
+	class MapleReader :public MatrixStreamReader<Field> {
+	public:
+		typedef typename MatrixStreamReader<Field>::Element Element;
+	private:
+		/* These are used to keep track of where we are in the data for
+		 * array-based data. They are also used to keep track of where we
+		 * are in reading the frontmatter of the matrix.
+		 * If currentCol is 0, then we have not reached the matrix data yet.
+		 * Then currentRow can be 0,2,3,4,5, depending on how many of the
+		 * tokens ( r , c , have been read.
+		 */
+		size_t currentCol, currentRow;
+		bool openParen;
+		bool array;
+		std::stringstream *stin;
+
+		MatrixStreamError processCandidate( const char* cand ) {
+			if( strlen(cand) < 6 ||
+			    tolower(cand[1]) != 'a' ||
+			    tolower(cand[2]) != 't' ||
+			    tolower(cand[3]) != 'r' ||
+			    tolower(cand[4]) != 'i' ||
+			    tolower(cand[5]) != 'x' )
+				return NO_FORMAT;
+
+			int i = 6;
+			while( cand[i] && isspace(cand[i]) ) ++i;
+
+			if( !cand[i] ) {
+				openParen = true;
+				return GOOD;
+			}
+
+			if( cand[i] != '(' ) return BAD_FORMAT;
+
 			openParen = true;
-			return GOOD;
-		}
-		
-		if( cand[i] != '(' ) return BAD_FORMAT;
-
-		openParen = true;
-		currentCol = 1;
-
-		++i;
-		while( cand[i] && isspace(cand[i]) ) ++i;
-		if( !cand[i] ) return GOOD;
-
-		char* pastNum;
-		if( isdigit(cand[i]) ) {
-			this->_m = strtoul( cand+i, &pastNum, 0 );
-			if( this->_m == 0 && pastNum == cand+i )
-				return BAD_FORMAT;
-			this->knowM = true;
-			currentCol = 2;
-			i = pastNum - cand;
-		}
-		else {
-			currentCol = i;
-			return GOOD;
-		}
+			currentCol = 1;
 
-		while( cand[i] && isspace(cand[i]) ) ++i;
-		if( !cand[i] ) return GOOD;
-		if( cand[i] != ',' ) return BAD_FORMAT;
-		currentCol = 3;
-
-		++i;
-		while( cand[i] && isspace(cand[i]) ) ++i;
-		if( !cand[i] ) return GOOD;
-
-		if( isdigit(cand[i]) ) {
-			this->_n = strtoul( cand+i, &pastNum, 0 );
-			if( this->_n == 0 && pastNum == cand+i )
-				return BAD_FORMAT;
-			this->knowN = true;
-			currentCol = 4;
-			i = pastNum - cand;
-		}
-		else {
-			currentCol = i;
-			return GOOD;
-		}
+			++i;
+			while( cand[i] && isspace(cand[i]) ) ++i;
+			if( !cand[i] ) return GOOD;
 
-		while( cand[i] && isspace(cand[i]) ) ++i;
-		if( !cand[i] ) return GOOD;
-		if( cand[i] != ',' ) return BAD_FORMAT;
-		currentCol = i;
-		return GOOD;
-	}
-
-	MatrixStreamError readUntil(char end) {
-		if( stin ) {
-			while( !stin->eof() && stin->get() != end )
-			if( stin->eof() ) {
-				delete stin;
-				stin = NULL;
+			char* pastNum;
+			if( std::isdigit(cand[i]) ) {
+				this->_m = strtoul( cand+i, &pastNum, 0 );
+				if( this->_m == 0 && pastNum == cand+i )
+					return BAD_FORMAT;
+				this->knowM = true;
+				currentCol = 2;
+				i = pastNum - cand;
+			}
+			else {
+				currentCol = i;
+				return GOOD;
 			}
-			else return GOOD;
-		}
 
-		this->ms->readWhiteSpace();
-		while( this->sin->get() != end )
-			this->ms->readWhiteSpace();
-		if( this->sin->eof() ) return END_OF_FILE;
-		return GOOD;
-	}
-	
-	MatrixStreamError readWhite() {
-		if( stin ) {
-			int peekVal = stin->peek();
-			while( stin->good() && isspace(peekVal) ) {
-				stin->get();
-				peekVal = stin->peek();
+			while( cand[i] && isspace(cand[i]) ) ++i;
+			if( !cand[i] ) return GOOD;
+			if( cand[i] != ',' ) return BAD_FORMAT;
+			currentCol = 3;
+
+			++i;
+			while( cand[i] && isspace(cand[i]) ) ++i;
+			if( !cand[i] ) return GOOD;
+
+			if( std::isdigit(cand[i]) ) {
+				this->_n = strtoul( cand+i, &pastNum, 0 );
+				if( this->_n == 0 && pastNum == cand+i )
+					return BAD_FORMAT;
+				this->knowN = true;
+				currentCol = 4;
+				i = pastNum - cand;
 			}
-			if( !stin->good() || peekVal < 0 ) {
-				delete stin;
-				stin = NULL;
+			else {
+				currentCol = i;
+				return GOOD;
 			}
+
+			while( cand[i] && isspace(cand[i]) ) ++i;
+			if( !cand[i] ) return GOOD;
+			if( cand[i] != ',' ) return BAD_FORMAT;
+			currentCol = i;
+			return GOOD;
 		}
-		if( !stin ) { // Note this is NOT equivalent to "else"
+
+		MatrixStreamError readUntil(char end) {
+			if( stin ) {
+				while( !stin->eof() && stin->get() != end )
+					if( stin->eof() ) {
+						delete stin;
+						stin = NULL;
+					}
+					else return GOOD;
+			}
+
 			this->ms->readWhiteSpace();
+			while( this->sin->get() != end )
+				this->ms->readWhiteSpace();
 			if( this->sin->eof() ) return END_OF_FILE;
+			return GOOD;
 		}
-		return GOOD;
-	}
-
-	MatrixStreamError readCharacter(char &c) {
-		MatrixStreamError mse = readWhite();
-		if( mse > GOOD ) return mse;
-		if( stin ) stin->get(c);
-		else this->sin->get(c);
-		return GOOD;
-	}
-
-	MatrixStreamError readElement(Element& ele) {
-		MatrixStreamError mse = readWhite();
-		if( mse > GOOD ) return mse;
-		if( stin ) {
-			this->ms->getField().read(*stin,ele);
-			if( stin->eof() ) {
-				delete stin;
-				stin = NULL;
+
+		MatrixStreamError readWhite() {
+			if( stin ) {
+				int peekVal = stin->peek();
+				while( stin->good() && isspace(peekVal) ) {
+					stin->get();
+					peekVal = stin->peek();
+				}
+				if( !stin->good() || peekVal < 0 ) {
+					delete stin;
+					stin = NULL;
+				}
 			}
-			else if( !stin->good() )
-				return BAD_FORMAT;
+			if( !stin ) { // Note this is NOT equivalent to "else"
+				this->ms->readWhiteSpace();
+				if( this->sin->eof() ) return END_OF_FILE;
+			}
+			return GOOD;
 		}
-		else {
-			this->ms->getField().read(*(this->sin),ele);
-			if( !this->sin->eof() && !this->sin->good() )
-				return BAD_FORMAT;
+
+		MatrixStreamError readCharacter(char &c) {
+			MatrixStreamError mse = readWhite();
+			if( mse > GOOD ) return mse;
+			if( stin ) stin->get(c);
+			else this->sin->get(c);
+			return GOOD;
 		}
-		return GOOD;
-	}
-	
-	MatrixStreamError readNumber(size_t& num) {
-		MatrixStreamError mse = readWhite();
-		if( mse > GOOD ) return mse;
-		if( stin ) {
-			(*stin) >> num;
-			if( stin->eof() ) {
-				delete stin;
-				stin = NULL;
+
+		MatrixStreamError readElement(Element& ele) {
+			MatrixStreamError mse = readWhite();
+			if( mse > GOOD ) return mse;
+			if( stin ) {
+				this->ms->getField().read(*stin,ele);
+				if( stin->eof() ) {
+					delete stin;
+					stin = NULL;
+				}
+				else if( !stin->good() )
+					return BAD_FORMAT;
 			}
-			else if( !stin->good() )
-				return BAD_FORMAT;
-		}
-		else {
-			*(this->sin) >> num;
-			if( !this->sin->eof() && !this->sin->good() )
-				return BAD_FORMAT;
+			else {
+				this->ms->getField().read(*(this->sin),ele);
+				if( !this->sin->eof() && !this->sin->good() )
+					return BAD_FORMAT;
+			}
+			return GOOD;
 		}
-		return GOOD;
-	}
 
-    protected:
-    	MatrixStreamError nextTripleImpl( size_t& m, size_t& n, Element& v ) {
-		if( currentRow == 0 ) {
-			while( currentCol < 7 ) {
-				this->ms->readWhiteSpace();
-				if( this->sin->eof() )
-					return END_OF_FILE;
+		MatrixStreamError readNumber(size_t& num) {
+			MatrixStreamError mse = readWhite();
+			if( mse > GOOD ) return mse;
+			if( stin ) {
+				(*stin) >> num;
+				if( stin->eof() ) {
+					delete stin;
+					stin = NULL;
+				}
+				else if( !stin->good() )
+					return BAD_FORMAT;
+			}
+			else {
+				*(this->sin) >> num;
+				if( !this->sin->eof() && !this->sin->good() )
+					return BAD_FORMAT;
+			}
+			return GOOD;
+		}
 
-				char ch;
-				switch( currentCol ) {
-				    case 0:
-					if( this->sin->get() != '(' )
-						return BAD_FORMAT;
-					break;
-				    case 1:
-				    	if( isdigit(this->sin->peek()) ) {
-						*(this->sin) >> this->_m;
-						if( this->sin->eof() )
-							return END_OF_FILE;
-						if( !this->sin->good() )
+	protected:
+		MatrixStreamError nextTripleImpl( size_t& m, size_t& n, Element& v ) {
+			if( currentRow == 0 ) {
+				while( currentCol < 7 ) {
+					this->ms->readWhiteSpace();
+					if( this->sin->eof() )
+						return END_OF_FILE;
+
+					char ch;
+					switch( currentCol ) {
+					case 0:
+						if( this->sin->get() != '(' )
 							return BAD_FORMAT;
-						this->knowM = true;
-					}
-					else currentCol = 4;
-					break;
-				    case 2:
-				    case 4:
-				    	if( this->sin->get() != ',' )
-						return BAD_FORMAT;
-					break;
-				    case 3:
-				    	if( isdigit(this->sin->peek()) ) {
-						*(this->sin) >> this->_n;
-						if( this->sin->eof() )
-							return END_OF_FILE;
-						if( !this->sin->good() )
+						break;
+					case 1:
+						if( std::isdigit(this->sin->peek()) ) {
+							*(this->sin) >> this->_m;
+							if( this->sin->eof() )
+								return END_OF_FILE;
+							if( !this->sin->good() )
+								return BAD_FORMAT;
+							this->knowM = true;
+						}
+						else currentCol = 4;
+						break;
+					case 2:
+					case 4:
+						if( this->sin->get() != ',' )
 							return BAD_FORMAT;
-						this->knowN = true;
-					}
-					else currentCol = 4;
-					break;
-				    case 5:
-				    	ch = this->sin->get();
-					if( ch == '{' ) {
-						array = false;
-						currentCol = 6;
+						break;
+					case 3:
+						if( std::isdigit(this->sin->peek()) ) {
+							*(this->sin) >> this->_n;
+							if( this->sin->eof() )
+								return END_OF_FILE;
+							if( !this->sin->good() )
+								return BAD_FORMAT;
+							this->knowN = true;
+						}
+						else currentCol = 4;
+						break;
+					case 5:
+						ch = (char)this->sin->get();
+						if( ch == '{' ) {
+							array = false;
+							currentCol = 6;
+						}
+						else if( ch == '[' )
+							array = true;
+						else return BAD_FORMAT;
+						break;
+					case 6:
+						if( this->sin->get() != '[' )
+							return BAD_FORMAT;
+						break;
 					}
-					else if( ch == '[' )
-						array = true;
-					else return BAD_FORMAT;
-					break;
-				    case 6:
-				    	if( this->sin->get() != '[' )
-						return BAD_FORMAT;
-					break;
+					++currentCol;
 				}
-				++currentCol;
+
+				currentRow = currentCol = 1;
 			}
 
-			currentRow = currentCol = 1;
-		}
+			if( array ) {
+				MatrixStreamError mse = readElement(v);
+				if( mse > GOOD ) return mse;
+				m = currentRow - 1;
+				n = currentCol - 1;
 
-		if( array ) {
-			MatrixStreamError mse = readElement(v);
-			if( mse > GOOD ) return mse;
-			m = currentRow - 1;
-			n = currentCol - 1;
-			
-			char c;
-			mse = readCharacter(c);
-			if( mse > GOOD ) return mse;
-			if( c == ',' ) {
-				++currentCol;
-				if( this->knowN && currentCol > this->_n )
-					return BAD_FORMAT;
-			}
-			else if( c == ']' ) {
-				if( !this->knowN ) {
-					this->knowN = true;
-					this->_n = currentCol;
-				}
-				currentCol = 1;
+				char c;
 				mse = readCharacter(c);
 				if( mse > GOOD ) return mse;
 				if( c == ',' ) {
-					++currentRow;
-					if( this->knowM && 
-					    currentRow > this->_m )
-					    	return BAD_FORMAT;
-					mse = readCharacter(c);
-					if( mse > GOOD ) return mse;
-					if( c != '[' ) return BAD_FORMAT;
+					++currentCol;
+					if( this->knowN && currentCol > this->_n )
+						return BAD_FORMAT;
 				}
 				else if( c == ']' ) {
-					if( !this->knowM ) {
-						this->knowM = true;
-						this->_m = currentRow;
+					if( !this->knowN ) {
+						this->knowN = true;
+						this->_n = currentCol;
+					}
+					currentCol = 1;
+					mse = readCharacter(c);
+					if( mse > GOOD ) return mse;
+					if( c == ',' ) {
+						++currentRow;
+						if( this->knowM &&
+						    currentRow > this->_m )
+							return BAD_FORMAT;
+						mse = readCharacter(c);
+						if( mse > GOOD ) return mse;
+						if( c != '[' ) return BAD_FORMAT;
+					}
+					else if( c == ']' ) {
+						if( !this->knowM ) {
+							this->knowM = true;
+							this->_m = currentRow;
+						}
+						if( openParen ) {
+							mse = readUntil(')');
+							if( mse > GOOD ) return mse;
+						}
+						this->atEnd = true;
 					}
+					else return BAD_FORMAT;
+				}
+			}
+			else {
+				char c;
+				MatrixStreamError mse = readCharacter(c);
+				if( mse > GOOD ) return mse;
+				if( c != '(' ) return BAD_FORMAT;
+				mse = readNumber(m);
+				if( mse > GOOD ) return mse;
+				mse = readCharacter(c);
+				if( mse > GOOD ) return mse;
+				if( c != ',' ) return BAD_FORMAT;
+				mse = readNumber(n);
+				if( mse > GOOD ) return mse;
+				mse = readCharacter(c);
+				if( mse > GOOD ) return mse;
+				if( c != ')' ) return BAD_FORMAT;
+				mse = readCharacter(c);
+				if( mse > GOOD ) return mse;
+				if( c != '=' ) return BAD_FORMAT;
+				mse = readElement(v);
+				if( mse > GOOD ) return mse;
+				mse = readCharacter(c);
+				if( mse > GOOD ) return mse;
+				if( c == '}' ) {
 					if( openParen ) {
 						mse = readUntil(')');
 						if( mse > GOOD ) return mse;
 					}
 					this->atEnd = true;
 				}
-				else return BAD_FORMAT;
+				--m;
+				--n;
 			}
+			return GOOD;
 		}
-		else {
-			char c;
-			MatrixStreamError mse = readCharacter(c);
-			if( mse > GOOD ) return mse;
-			if( c != '(' ) return BAD_FORMAT;
-			mse = readNumber(m);
-			if( mse > GOOD ) return mse;
-			mse = readCharacter(c);
-			if( mse > GOOD ) return mse;
-			if( c != ',' ) return BAD_FORMAT;
-			mse = readNumber(n);
-			if( mse > GOOD ) return mse;
-			mse = readCharacter(c);
-			if( mse > GOOD ) return mse;
-			if( c != ')' ) return BAD_FORMAT;
-			mse = readCharacter(c);
-			if( mse > GOOD ) return mse;
-			if( c != '=' ) return BAD_FORMAT;
-			mse = readElement(v);
-			if( mse > GOOD ) return mse;
-			mse = readCharacter(c);
-			if( mse > GOOD ) return mse;
-			if( c == '}' ) {
-				if( openParen ) {
-					mse = readUntil(')');
-					if( mse > GOOD ) return mse;
+
+		MatrixStreamError initImpl( const char* firstLine ) {
+			// First look for the word "Matrix"
+			const char* candidate = strpbrk(firstLine,"mM");
+			MatrixStreamError procErr;
+			while( candidate ) {
+				procErr = processCandidate(candidate);
+				if( procErr < NO_FORMAT ) {
+					if( procErr > GOOD ) return procErr;
+					else break;
 				}
-				this->atEnd = true;
-			}
-			--m;
-			--n;
-		}
-		return GOOD;
-	}
-
-	MatrixStreamError initImpl( const char* firstLine ) {
-		// First look for the word "Matrix"
-		const char* candidate = strpbrk(firstLine,"mM");
-		MatrixStreamError procErr;
-		while( candidate ) {
-			procErr = processCandidate(candidate);
-			if( procErr < NO_FORMAT ) {
-				if( procErr > GOOD ) return procErr;
-				else break;
+				candidate = strpbrk(candidate+1,"mM");
 			}
-			candidate = strpbrk(candidate+1,"mM");
-		}
-
-		bool lineend = false;
-		int i = 0;
 
-		if( candidate ) {
-			lineend = currentCol <= 5;
-			i = currentCol;
-			if( !lineend ) currentCol = 5;
-			while( !lineend && currentCol < 7 ) {
-				while( candidate[i] && isspace(candidate[i]) )
+			bool lineend = false;
+			int i = 0;
+
+			if( candidate ) {
+				lineend = currentCol <= 5;
+				i = currentCol;
+				if( !lineend ) currentCol = 5;
+				while( !lineend && currentCol < 7 ) {
+					while( candidate[i] && isspace(candidate[i]) )
+						++i;
+					switch(candidate[i]) {
+					case '\0':
+						lineend = true;
+						break;
+					case '[':
+						array = true;
+						++currentCol;
+						break;
+					case '{':
+						if( currentCol == 5 ) {
+							array = false;
+							currentCol = 7;
+							break;
+						}
+					default:
+						return BAD_FORMAT;
+					}
 					++i;
-				switch(candidate[i]) {
-				    case '\0':
-				    	lineend = true;
-					break;
-				    case '[':
-				    	array = true;
-					++currentCol;
-					break;
-				    case '{':
-				    	if( currentCol == 5 ) {
-						array = false;
+				}
+			}
+			else { // Look for [[
+				candidate = strchr(firstLine,'[');
+				while( candidate ) {
+					i = 1;
+					while( candidate[i] && isspace(candidate[i]) )
+						++i;
+					if( candidate[i] == '[' ) {
+						openParen = false;
 						currentCol = 7;
+						++i;
 						break;
 					}
-				    default:
-				    	return BAD_FORMAT;
+					candidate = strchr(candidate+1,'[');
 				}
-				++i;
 			}
-		}
-		else { // Look for [[
-			candidate = strchr(firstLine,'[');
-			while( candidate ) {
-				i = 1;
-				while( candidate[i] && isspace(candidate[i]) )
-					++i;
-				if( candidate[i] == '[' ) {
-					openParen = false;
-					currentCol = 7;
-					++i;
-					break;
-				}
-				candidate = strchr(candidate+1,'[');
+
+			if( !candidate ) return NO_FORMAT;
+			else if( currentCol < 7 ) return GOOD;
+
+			currentRow = currentCol = 1;
+			if( this->knowM && !this->knowN ) {
+				this->knowN = true;
+				this->_n = this->_m;
 			}
+			if( !array && !this->knowM ) return BAD_FORMAT;
+
+			// Now candidate+i is the beginning of the actual data.
+			while( candidate[i] && isspace(candidate[i]) ) ++i;
+			if( !candidate[i] ) return GOOD;
+
+			std::string st(candidate+i);
+			stin = new std::stringstream(st);
+
+			return GOOD;
 		}
 
-		if( !candidate ) return NO_FORMAT;
-		else if( currentCol < 7 ) return GOOD;
+	public:
+		MapleReader() {
+			currentCol = currentRow = 0;
+			stin = NULL;
+		}
 
-		currentRow = currentCol = 1;
-		if( this->knowM && !this->knowN ) {
-			this->knowN = true;
-			this->_n = this->_m;
+		~MapleReader() {
+			if( stin ) delete stin;
 		}
-		if( !array && !this->knowM ) return BAD_FORMAT;
-
-		// Now candidate+i is the beginning of the actual data.
-		while( candidate[i] && isspace(candidate[i]) ) ++i;
-		if( !candidate[i] ) return GOOD;
-
-		std::string st(candidate+i);
-		stin = new std::stringstream(st);
-		
-		return GOOD;
-	}
-
-    public:
-    	MapleReader() {
-		currentCol = currentRow = 0;
-		stin = NULL;
-	}
-
-	~MapleReader() {
-		if( stin ) delete stin;
-	}
-
-	bool isSparse() const { return !array; }
-	
-	const char* getName() const 
+
+		bool isSparse() const { return !array; }
+
+		const char* getName() const
 		{ return "Maple Text Format"; }// LinBox__FORMAT_MAPLE_H::name; }
-	
-	const char* shortName() const 
-		{ return "maple"; }// LinBox__FORMAT_MAPLE_H::shortname; }
+
+		const char* shortName() const
+		{ return "maple"; }// LinBox__FORMAT_MAPLE_H::shortname;
 };
 
 
 }
 
-#endif
+#endif // __LINBOX_format_maple_H
+
diff --git a/linbox/util/formats/matrix-market.h b/linbox/util/formats/matrix-market.h
index e75e87d..ee20438 100644
--- a/linbox/util/formats/matrix-market.h
+++ b/linbox/util/formats/matrix-market.h
@@ -1,190 +1,216 @@
+/* -*- 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
+/* Copyright (C) 2005 LinBox
+ * Written by  Dan Roche
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_format_matrix_market_H
+#define __LINBOX_format_matrix_market_H
+
 /* matrix-market-array.h
  * MatrixStreamReader specialization for matrices in the MatrixMarket coordinate
  * format.
- * Dan Roche, 1-25-05
  */
 
-#ifndef __FORMAT_MATRIX_MARKET_H
-#define __FORMAT_MATRIX_MARKET_H
-
 #include <string>
 #include <sstream>
 #include <linbox/util/matrix-stream.h>
 
-/*
+#if 0
 namespace LinBox__FORMAT_MATRIX_MARKET_H
-	{ static const char* name = "Matrix Market Format";
-	  static const char* shortname = "mm"; }
-	  */
+{
+	static const char* name = "Matrix Market Format";
+	static const char* shortname = "mm";
+}
+#endif
 
-namespace LinBox {
+namespace LinBox
+{
 
-#ifndef __INTEGER_H
-class integer;
+#ifndef __LINBOX_integer_H
+	class integer;
 #endif
 
-static bool equalCaseInsensitive(const std::string s1, const char* s2) {
-	int len = s1.size();
-	int counter = 0;
-	while( counter < len && s2[counter] != '\0' &&
-	       toupper(s1[counter]) == toupper(s2[counter]) ) ++counter;
-	return( counter == len && s2[counter] == '\0' );
-}
+	static bool equalCaseInsensitive(const std::string s1, const char* s2) {
+		int len = s1.size();
+		int counter = 0;
+		while( counter < len && s2[counter] != '\0' &&
+		       toupper(s1[counter]) == toupper(s2[counter]) ) ++counter;
+		return( counter == len && s2[counter] == '\0' );
+	}
 
-template<class Field>
-class MatrixMarketReader :public MatrixStreamReader<Field> {
-    public:
-    	typedef typename MatrixStreamReader<Field>::Element Element;
-    private:
-    	int entriesLeft;
-	size_t currentCol, currentRow;
-	bool array;
-	bool pattern;
-	bool symmetric;
-
-	MatrixStreamError readHeader() {
-	        //Skip comments
-		this->ms->readWhiteSpace();
-		while( !this->sin->eof() && this->sin->peek() == '%' ) {
-			char c;
-			while( this->sin->get(c) ) {
-				if( c == '\n' || c == '\r' ) {
-					this->sin->putback(c);
-					break;
+	template<class Field>
+	class MatrixMarketReader :public MatrixStreamReader<Field> {
+	public:
+		typedef typename MatrixStreamReader<Field>::Element Element;
+	private:
+		int entriesLeft;
+		size_t currentCol, currentRow;
+		bool array;
+		bool pattern;
+		bool symmetric;
+
+		MatrixStreamError readHeader() {
+			//Skip comments
+			this->ms->readWhiteSpace();
+			while( !this->sin->eof() && this->sin->peek() == '%' ) {
+				char c;
+				while( this->sin->get(c) ) {
+					if( c == '\n' || c == '\r' ) {
+						this->sin->putback(c);
+						break;
+					}
 				}
+				this->ms->readWhiteSpace();
 			}
-			this->ms->readWhiteSpace();
-		}
 
-		*(this->sin) >> this->_m;
-		this->ms->readWhiteSpace();
-		*(this->sin) >> this->_n;
-		this->ms->readWhiteSpace();
-		if( !array ) {
-			*(this->sin) >> entriesLeft;
+			*(this->sin) >> this->_m;
 			this->ms->readWhiteSpace();
-		}
-
-	        if( this->sin->eof() ) return END_OF_FILE;
-	        if( !this->sin->good() ) return BAD_FORMAT;
+			*(this->sin) >> this->_n;
+			this->ms->readWhiteSpace();
+			if( !array ) {
+				*(this->sin) >> entriesLeft;
+				this->ms->readWhiteSpace();
+			}
 
-		this->knowM = this->knowN = true;
-		currentCol = currentRow = 1;
+			if( this->sin->eof() ) return END_OF_FILE;
+			if( !this->sin->good() ) return BAD_FORMAT;
 
-		if( symmetric && (this->_m != this->_n) ) return BAD_FORMAT;
-		if( this->_m < 1 || this->_n < 1 ) return BAD_FORMAT;
-		if( !array && (entriesLeft < 0 || 
-		    (size_t)entriesLeft > this->_m*this->_n ) )
-		    return BAD_FORMAT;
+			this->knowM = this->knowN = true;
+			currentCol = currentRow = 1;
 
-		return GOOD;
-	}
+			if( symmetric && (this->_m != this->_n) ) return BAD_FORMAT;
+			if( this->_m < 1 || this->_n < 1 ) return BAD_FORMAT;
+			if( !array && (entriesLeft < 0 ||
+				       (size_t)entriesLeft > this->_m*this->_n ) )
+				return BAD_FORMAT;
 
-    protected:
-    	MatrixStreamError nextTripleImpl( size_t& i, size_t& j, Element& v ) {
-		if( currentCol == 0 && currentRow == 0 ) {
-			MatrixStreamError mse = readHeader();
-			if( mse != GOOD ) return mse;
+			return GOOD;
 		}
 
-		if( array ) {
-			if( currentCol == this->_n+1 ) return END_OF_MATRIX;
-			j = currentCol;
-			i = currentRow;
-			if( ++currentRow == this->_m+1 ) {
-				++currentCol;
-				currentRow = (symmetric ? currentCol : 1);
+	protected:
+		MatrixStreamError nextTripleImpl( size_t& i, size_t& j, Element& v ) {
+			if( currentCol == 0 && currentRow == 0 ) {
+				MatrixStreamError mse = readHeader();
+				if( mse != GOOD ) return mse;
 			}
-		}
-		else {
-			if( --entriesLeft < 0 ) return END_OF_MATRIX;
 
-			this->ms->readWhiteSpace();
-			*(this->sin) >> i;
-			if( this->sin->eof() ) return END_OF_FILE;
-			if( !this->sin->good() ) return BAD_FORMAT;
+			if( array ) {
+				if( currentCol == this->_n+1 ) return END_OF_MATRIX;
+				j = currentCol;
+				i = currentRow;
+				if( ++currentRow == this->_m+1 ) {
+					++currentCol;
+					currentRow = (symmetric ? currentCol : 1);
+				}
+			}
+			else {
+				if( --entriesLeft < 0 ) return END_OF_MATRIX;
+
+				this->ms->readWhiteSpace();
+				*(this->sin) >> i;
+				if( this->sin->eof() ) return END_OF_FILE;
+				if( !this->sin->good() ) return BAD_FORMAT;
+
+				this->ms->readWhiteSpace();
+				*(this->sin) >> j;
+				if( this->sin->eof() ) return END_OF_FILE;
+				if( !this->sin->good() ) return BAD_FORMAT;
+			}
 
-			this->ms->readWhiteSpace();
-			*(this->sin) >> j;
-			if( this->sin->eof() ) return END_OF_FILE;
-			if( !this->sin->good() ) return BAD_FORMAT;
-		}
+			if( pattern ) this->ms->getField().init(v,(integer)1);
+			else {
+				this->ms->readWhiteSpace();
+				this->ms->getField().read(*(this->sin),v);
+				if( this->sin->eof() ) return END_OF_FILE;
+				if( !this->sin->good() ) return BAD_FORMAT;
+			}
 
-		if( pattern ) this->ms->getField().init(v,(integer)1);
-		else {
-			this->ms->readWhiteSpace();
-			this->ms->getField().read(*(this->sin),v);
-			if( this->sin->eof() ) return END_OF_FILE;
-			if( !this->sin->good() ) return BAD_FORMAT;
+			--i;
+			--j;
+			if(  i >= this->_m || j >= this->_n )
+				return BAD_FORMAT;
+			if( symmetric && (i != j) ) saveTriple(j,i,v);
+
+			return GOOD;
 		}
 
-		--i;
-		--j;
-		if( i < 0 || i >= this->_m || j < 0 || j >= this->_n )
-			return BAD_FORMAT;
-		if( symmetric && (i != j) ) saveTriple(j,i,v);
+		MatrixStreamError initImpl( const char* firstLine ) {
+			std::string st(firstLine);
+			std::stringstream stin(st);
 
-		return GOOD;
-	}
+			if( stin.get() != '%' || stin.get() != '%' )
+				return NO_FORMAT;
+			if( !stin.good() ) return NO_FORMAT;
 
-	MatrixStreamError initImpl( const char* firstLine ) {
-		std::string st(firstLine);
-		std::stringstream stin(st);
+			std::string s;
+			stin >> s;
+			if( !stin.good() ) return NO_FORMAT;
+			if( !equalCaseInsensitive(s,"MatrixMarket") ) return NO_FORMAT;
 
-	   	if( stin.get() != '%' || stin.get() != '%' )
-	    		return NO_FORMAT;
-	        if( !stin.good() ) return NO_FORMAT;
+			stin >> s;
+			if( !stin.good() ) return BAD_FORMAT;
+			if( !equalCaseInsensitive(s,"matrix") ) return BAD_FORMAT;
 
-		std::string s;
-		stin >> s;
-	        if( !stin.good() ) return NO_FORMAT;
-		if( !equalCaseInsensitive(s,"MatrixMarket") ) return NO_FORMAT;
-	    
-		stin >> s;
-	        if( !stin.good() ) return BAD_FORMAT;
-		if( !equalCaseInsensitive(s,"matrix") ) return BAD_FORMAT;
+			stin >> s;
+			if( !stin.good() ) return BAD_FORMAT;
+			if( equalCaseInsensitive(s,"array") ) array = true;
+			else if( equalCaseInsensitive(s,"coordinate") ) array = false;
+			else return BAD_FORMAT;
 
-		stin >> s;
-	        if( !stin.good() ) return BAD_FORMAT;
-		if( equalCaseInsensitive(s,"array") ) array = true;
-		else if( equalCaseInsensitive(s,"coordinate") ) array = false;
-		else return BAD_FORMAT;
+			stin >> s;
+			if( !stin.good() ) return BAD_FORMAT;
+			pattern = equalCaseInsensitive(s,"pattern");
 
-		stin >> s;
-	        if( !stin.good() ) return BAD_FORMAT;
-		pattern = equalCaseInsensitive(s,"pattern");
+			stin >> s;
+			if( !stin.eof() && !stin.good() ) return BAD_FORMAT;
+			if( equalCaseInsensitive(s,"symmetric") ) symmetric = true;
+			else if( equalCaseInsensitive(s,"general") ) symmetric = false;
+			else return BAD_FORMAT;
 
-		stin >> s;
-	        if( !stin.eof() && !stin.good() ) return BAD_FORMAT;
-		if( equalCaseInsensitive(s,"symmetric") ) symmetric = true;
-		else if( equalCaseInsensitive(s,"general") ) symmetric = false;
-		else return BAD_FORMAT;
+			stin >> s;
+			if( !stin.eof() ) return BAD_FORMAT;
 
-		stin >> s;
-		if( !stin.eof() ) return BAD_FORMAT;
+			if( array && pattern ) return BAD_FORMAT;
 
-		if( array && pattern ) return BAD_FORMAT;
+			currentRow = currentCol = 0;
 
-		currentRow = currentCol = 0;
+			return GOOD;
+		}
 
-		return GOOD;
-	}
+	public:
+		MatrixMarketReader() {
+			entriesLeft = -1;
+			currentCol = currentRow = 0;
+		}
 
-    public:
-    	MatrixMarketReader() {
-		entriesLeft = -1;
-		currentCol = currentRow = 0;
-	}
+		bool isSparse() const { return !array; }
+
+		const char* getName() const
+		{ return "Matrix Market Format"; }// LinBox__FORMAT_MATRIX_MARKET_H::name;
 
-	bool isSparse() const { return !array; }
-	
-	const char* getName() const 
-		{ return "Matrix Market Format"; }// LinBox__FORMAT_MATRIX_MARKET_H::name; }
-	
-	const char* shortName() const 
-		{ return "mm"; }// LinBox__FORMAT_MATRIX_MARKET_H::shortname; }
-};
+		const char* shortName() const
+		{ return "mm"; }// LinBox__FORMAT_MATRIX_MARKET_H::shortname;
+	};
 
 }
 
-#endif
+#endif //__LINBOX_format_matrix_market_H
+
diff --git a/linbox/util/formats/matrix-stream-readers.h b/linbox/util/formats/matrix-stream-readers.h
index 8ebca6d..a3c4cd7 100644
--- a/linbox/util/formats/matrix-stream-readers.h
+++ b/linbox/util/formats/matrix-stream-readers.h
@@ -1,4 +1,29 @@
-/* matrix-stream-readers.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
+/* Copyright (C) LinBox
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_matrix_stream_readers_H
+#define __LINBOX_matrix_stream_readers_H
+
+/*! \file matrix-stream-readers.h
  * Here is where all the formats (each of which is a subclass of
  * MatrixStreamReader) are defined, in two places:
  *
@@ -22,3 +47,5 @@
 #include "generic-dense.h"
 #include "matrix-market.h"
 #include "maple.h"
+
+#endif //__LINBOX_matrix_stream_readers_H
diff --git a/linbox/util/formats/sms.h b/linbox/util/formats/sms.h
index e41d3fd..3a1ea5b 100644
--- a/linbox/util/formats/sms.h
+++ b/linbox/util/formats/sms.h
@@ -1,106 +1,138 @@
-/* MatrixStreamReader for sms matrix format
- * Dan Roche, 1-12-05
- * 1st line: "50 60 M" // #rows #cols letter-M
+/* -*- 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
+/* Copyright (C) 2005 LinBox
+ * Written by Dan Roche
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*! @file util/formats/sms.h
+ * @brief MatrixStreamReader for sms matrix format
+ *
+ * 1st line: "50 60 X" // #rows #cols a letter (e.g M, I, R, P ...)
  * Subsequent lines: i j v // row index, col index, value
  * last line: 0 0 0
  */
 
-#ifndef __SMS_H
-#define __SMS_H
+#ifndef __LINBOX_sms_H
+#define __LINBOX_sms_H
 
 #include <cstdlib>
 
 /*
-namespace LinBox__SMS_H
-	{ static const char* name = "SMS Sparse Integer Matrix Format";
-	  static const char* shortname = "sms"; }
-	  */
-
-namespace LinBox {
-
-template<class Field>
-class SMSReader :public MatrixStreamReader<Field> {
-    public:
-    	typedef typename MatrixStreamReader<Field>::Element Element;
-    private:
-    	int _base;
-
-    protected:
-
-	MatrixStreamError initImpl(const char* firstLine) {
-		char* restLine;
-		int i = 0;
-
-		// Read m
-		this->_m = strtoul(firstLine,&restLine,0);
-		if( this->_m == 0 && restLine == firstLine )
-			return NO_FORMAT;
-		i = restLine - firstLine;
-
-		// Read n
-		this->_n = strtoul(firstLine+i,&restLine,0);
-		if( this->_n == 0 && restLine == firstLine+i )
-			return NO_FORMAT;
-		i = restLine - firstLine;
-
-		// Read "M"
-		while( firstLine[i] && isspace(firstLine[i]) )
+   namespace LinBox__SMS_H
+{ static const char* name = "SMS Sparse Integer Matrix Format";
+static const char* shortname = "sms"; }
+*/
+
+namespace LinBox
+{
+
+	template<class Field>
+	class SMSReader :public MatrixStreamReader<Field> {
+	public:
+		typedef typename MatrixStreamReader<Field>::Element Element;
+	private:
+		int _base;
+
+	protected:
+
+		MatrixStreamError initImpl(const char* firstLine) {
+			char* restLine;
+			int i = 0;
+
+			// Read m
+			this->_m = strtoul(firstLine,&restLine,0);
+			if( this->_m == 0 && restLine == firstLine )
+				return NO_FORMAT;
+			i = restLine - firstLine;
+
+			// Read n
+			this->_n = strtoul(firstLine+i,&restLine,0);
+			if( this->_n == 0 && restLine == firstLine+i )
+				return NO_FORMAT;
+			i = restLine - firstLine;
+
+			// Read "M" or "R" or "P" or "I"
+			while( firstLine[i] && isspace(firstLine[i]) )
+				++i;
+			if( !firstLine[i] || (firstLine[i] != 'M' &&
+					      firstLine[i] != 'm' &&
+					      firstLine[i] != 'I' &&
+					      firstLine[i] != 'i' &&
+					      firstLine[i] != 'R' &&
+					      firstLine[i] != 'r' &&
+					      firstLine[i] != 'P' &&
+					      firstLine[i] != 'p'   ) )
+				return NO_FORMAT;
+
+			// Check whitespace for rest of line
 			++i;
-		if( !firstLine[i] || (firstLine[i] != 'M' &&
-		                      firstLine[i] != 'm'   ) )
-			return NO_FORMAT;
+			while( firstLine[i] && isspace(firstLine[i]) )
+				++i;
+			if( firstLine[i] ) return BAD_FORMAT;
 
-		// Check whitespace for rest of line
-		++i;
-		while( firstLine[i] && isspace(firstLine[i]) )
-			++i;
-		if( firstLine[i] ) return BAD_FORMAT;
+			this->knowM = this->knowN = true;
 
-		this->knowM = this->knowN = true;
+			return GOOD;
+		}
 
-		return GOOD;
-	}
+		MatrixStreamError nextTripleImpl( size_t& m, size_t& n, Element& v ) {
+			this->ms->readWhiteSpace();
+			*(this->sin) >> m;
+			if( this->sin->eof() ) return END_OF_FILE;
+			if( !this->sin->good() ) return BAD_FORMAT;
 
-	MatrixStreamError nextTripleImpl( size_t& m, size_t& n, Element& v ) {
-		this->ms->readWhiteSpace();
-	        *(this->sin) >> m;
-	        if( this->sin->eof() ) return END_OF_FILE;
-	        if( !this->sin->good() ) return BAD_FORMAT;
-       
-		this->ms->readWhiteSpace();
-	        *(this->sin) >> n;
-	        if( this->sin->eof() ) return END_OF_FILE;
-	        if( !this->sin->good() ) return BAD_FORMAT;
-       
-		this->ms->readWhiteSpace();
-		if( this->sin->eof() ) return END_OF_FILE;
-	        this->ms->getField().read(*(this->sin),v);
-	        if( this->sin->eof() ) this->atEnd = true;
-	        else if( !this->sin->good() ) return BAD_FORMAT;
+			this->ms->readWhiteSpace();
+			*(this->sin) >> n;
+			if( this->sin->eof() ) return END_OF_FILE;
+			if( !this->sin->good() ) return BAD_FORMAT;
 
-		if( m == 0 && n == 0 ) return END_OF_MATRIX;
+			this->ms->readWhiteSpace();
+			if( this->sin->eof() ) return END_OF_FILE;
+			this->ms->getField().read(*(this->sin),v);
+			if( this->sin->eof() ) this->atEnd = true;
+			else if( !this->sin->good() ) return BAD_FORMAT;
 
-		m -= _base;
-		n -= _base;
+			if( m == 0 && n == 0 ) return END_OF_MATRIX;
 
-		if( m < 0 || m >= this->_m ||
-		    n < 0 || n >= this->_n ) return BAD_FORMAT;
+			m -= _base;
+			n -= _base;
 
-		return GOOD;
-	}
+			if( m >= this->_m ||
+			    n >= this->_n ) return BAD_FORMAT;
 
-    public:
-    	SMSReader( int base = 1 ) {
-		_base = base;
-	}
+			return GOOD;
+		}
 
-	const char* getName() const {return "SMS Sparse Integer Matrix Format"; }//LinBox__SMS_H::name;}
-	const char* shortName() const
-	{ return "sms"; }//LinBox__SMS_H::shortname; }
+	public:
+		SMSReader( int base = 1 ) {
+			_base = base;
+		}
 
-	bool isSparse() const { return true; }
-};
+		const char* getName() const {return "SMS Sparse Integer Matrix Format"; }//LinBox__SMS_H::name;}
+		const char* shortName() const
+		{ return "sms"; }//LinBox__SMS_H::shortname; }
+
+		bool isSparse() const { return true; }
+		};
 
 }
 
-#endif // __FORMAT_SPARSE_ROW_H
+#endif // __LINBOX_sms_H
+
diff --git a/linbox/util/formats/sparse-row.h b/linbox/util/formats/sparse-row.h
index 307f14e..9e28417 100644
--- a/linbox/util/formats/sparse-row.h
+++ b/linbox/util/formats/sparse-row.h
@@ -1,3 +1,28 @@
+/* -*- 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
+/* Copyright (C) 2010 LinBox
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_format_sparse_row_H
+#define __LINBOX_format_sparse_row_H
+
 /* sparse-row.h
  * MatrixStreamReader specialization for matrices in the sparse row format:
  * 1st line: "50 60 S" // #rows #cols letter-S
@@ -5,107 +30,108 @@
  * One next line for each row in matrix.
  */
 
-#ifndef __FORMAT_SPARSE_ROW_H
-#define __FORMAT_SPARSE_ROW_H
-
 #include <cstdlib>
 
-/*
+#if 0
 namespace LinBox__FORMAT_SPARSE_ROW_H
-	{ static const char* name = "Sparse Row Format";
-	  static const char* shortname = "sparserow"; }
-	  */
-
-namespace LinBox {
-
-template<class Field>
-class SparseRowReader :public MatrixStreamReader<Field> {
-    public:
-    	typedef typename MatrixStreamReader<Field>::Element Element;
-    private:
-    	int _base;
-	size_t currentRow, colsLeft;
-
-    protected:
-
-	MatrixStreamError initImpl(const char* firstLine) {
-		char* restLine;
-		int i = 0;
-
-		// Read m
-		this->_m = strtoul(firstLine,&restLine,0);
-		if( this->_m == 0 && restLine == firstLine )
-			return NO_FORMAT;
-		i = restLine - firstLine;
-
-		// Read n
-		this->_n = strtoul(firstLine+i,&restLine,0);
-		if( this->_n == 0 && restLine == firstLine+i )
-			return NO_FORMAT;
-		i = restLine - firstLine;
-
-		// Read "S"
-		while( firstLine[i] && isspace(firstLine[i]) )
+{
+	static const char* name = "Sparse Row Format";
+	static const char* shortname = "sparserow";
+}
+#endif
+
+namespace LinBox
+{
+
+	template<class Field>
+	class SparseRowReader :public MatrixStreamReader<Field> {
+	public:
+		typedef typename MatrixStreamReader<Field>::Element Element;
+	private:
+		int _base;
+		size_t currentRow, colsLeft;
+
+	protected:
+
+		MatrixStreamError initImpl(const char* firstLine) {
+			char* restLine;
+			int i = 0;
+
+			// Read m
+			this->_m = strtoul(firstLine,&restLine,0);
+			if( this->_m == 0 && restLine == firstLine )
+				return NO_FORMAT;
+			i = restLine - firstLine;
+
+			// Read n
+			this->_n = strtoul(firstLine+i,&restLine,0);
+			if( this->_n == 0 && restLine == firstLine+i )
+				return NO_FORMAT;
+			i = restLine - firstLine;
+
+			// Read "S"
+			while( firstLine[i] && isspace(firstLine[i]) )
+				++i;
+			if( !firstLine[i] || (firstLine[i] != 'S' &&
+					      firstLine[i] != 's'   ) )
+				return NO_FORMAT;
+
+			// Check whitespace for rest of line
 			++i;
-		if( !firstLine[i] || (firstLine[i] != 'S' &&
-		                      firstLine[i] != 's'   ) )
-			return NO_FORMAT;
+			while( firstLine[i] && isspace(firstLine[i]) )
+				++i;
+			if( firstLine[i] ) return BAD_FORMAT;
+
+			this->knowM = this->knowN = true;
+
+			currentRow = (size_t) -1;
+			colsLeft = 0;
+			return GOOD;
+		}
+
+		MatrixStreamError nextTripleImpl( size_t& m, size_t& n, Element& v ) {
+			while( colsLeft == 0 ) {
+				if( ++currentRow == this->_m ) return END_OF_MATRIX;
+				this->ms->readWhiteSpace();
+				*(this->sin) >> colsLeft;
+				if( this->sin->eof() ) return END_OF_FILE;
+				if( !this->sin->good() ) return BAD_FORMAT;
+			}
 
-		// Check whitespace for rest of line
-		++i;
-		while( firstLine[i] && isspace(firstLine[i]) )
-			++i;
-		if( firstLine[i] ) return BAD_FORMAT;
+			this->ms->readWhiteSpace();
+			*(this->sin) >> n;
+			if( this->sin->eof() ) return END_OF_FILE;
+			if( !this->sin->good() ) return BAD_FORMAT;
 
-		this->knowM = this->knowN = true;
+			this->ms->readWhiteSpace();
+			this->ms->getField().read(*(this->sin),v);
+			if( this->sin->eof() ) return END_OF_FILE;
+			if( !this->sin->good() ) return BAD_FORMAT;
 
-		currentRow = -1;
-		colsLeft = 0;
-		return GOOD;
-	}
+			n -= _base;
+			m = currentRow;
+			--colsLeft;
 
-	MatrixStreamError nextTripleImpl( size_t& m, size_t& n, Element& v ) {
-	        while( colsLeft == 0 ) {
-	          	if( ++currentRow == this->_m ) return END_OF_MATRIX;
-			this->ms->readWhiteSpace();
-	          	*(this->sin) >> colsLeft;
-	          	if( this->sin->eof() ) return END_OF_FILE;
-	          	if( !this->sin->good() ) return BAD_FORMAT;
-	        }
-       
-		this->ms->readWhiteSpace();
-	        *(this->sin) >> n;
-	        if( this->sin->eof() ) return END_OF_FILE;
-	        if( !this->sin->good() ) return BAD_FORMAT;
-       
-		this->ms->readWhiteSpace();
-	        this->ms->getField().read(*(this->sin),v);
-	        if( this->sin->eof() ) return END_OF_FILE;
-	        if( !this->sin->good() ) return BAD_FORMAT;
-
-		n -= _base;
-		m = currentRow;
-		--colsLeft;
-
-		if( m < 0 || m >= this->_m ||
-		    n < 0 || n >= this->_n ) return BAD_FORMAT;
-
-		return GOOD;
-	}
-
-    public:
-    	SparseRowReader( int base = 0 ) {
-		_base = base;
-		currentRow = colsLeft = -1;
-	}
-
-	const char* getName() const {return "Sparse Row Format"; }//LinBox__FORMAT_SPARSE_ROW_H::name;}
-	const char* shortName() const
-	{ return "sparserow"; }//LinBox__FORMAT_SPARSE_ROW_H::shortname; }
-
-	bool isSparse() const { return true; }
-};
+			if(  m >= this->_m ||
+			     n >= this->_n ) return BAD_FORMAT;
+
+			return GOOD;
+		}
+
+	public:
+		SparseRowReader( int base = 0 ) {
+			_base = base;
+			currentRow = colsLeft = (size_t) -1;
+		}
+
+		const char* getName() const {return "Sparse Row Format"; }//LinBox__FORMAT_SPARSE_ROW_H::name;
+		const char* shortName() const
+		{ return "sparserow"; }//LinBox__FORMAT_SPARSE_ROW_H::shortname;
+
+		bool isSparse() const { return true; }
+	};
 
 }
 
-#endif // __FORMAT_SPARSE_ROW_H
+#endif // __LINBOX_format_sparse_row_H
+
diff --git a/linbox/util/iml_wrapper.h b/linbox/util/iml_wrapper.h
new file mode 100644
index 0000000..cf43978
--- /dev/null
+++ b/linbox/util/iml_wrapper.h
@@ -0,0 +1,90 @@
+/* -*- 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
+
+/* Copyright (C) 2011 LinBox
+ * Written by BB <brice.boyer at imag.fr>
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*! @file util/iml_wrapper.h
+ * @ingroup util
+ * @brief Wraper for IML routines and puts them in a dedicated namespace.
+ * This wrapper includes iml.h definitions in an IML namespace.  The \#defines
+ * found elsewhere in the library (eg X*ALLOC) are rewritten.  The functions
+ * that are provided in the .a but not in the header are provided <code>extern
+ * "C"</code>.
+ */
+
+#ifndef __LINBOX_util_iml_wrapper_H
+#define __LINBOX_util_iml_wrapper_H
+
+#ifdef __LINBOX_HAVE_IML
+/*! @brief Namespace for IML routines.
+ * This namespace is foreign to LinBox'.
+ */
+namespace IML {
+	extern "C" {
+#include "iml.h"
+
+		FiniteField **
+		findRNS (const FiniteField RNS_bound, const mpz_t mp_maxInter, long *length) ;
+		FiniteField *
+		repBound (const long len, const FiniteField *basis, const FiniteField *cmbasis) ;
+		void
+		basisProd (const long len, const FiniteField *basis, mpz_t mp_prod) ;
+		void
+		ChineseRemainder (const long len, const mpz_t mp_prod, \
+				  const FiniteField *basis, const FiniteField *cmbasis, \
+				  const FiniteField *bdcoeff, Double *Ac, mpz_t mp_Ac);
+		void
+		ChineseRemainderPos (const long len, const FiniteField *basis, \
+				     const FiniteField *cmbasis, Double *Ac, mpz_t mp_Ac);
+
+	}
+	// #include <stdlib.h>
+#ifndef XMALLOC
+#define IML_XMALLOC(type, num)                                  \
+	((type *) malloc ((num) * sizeof(type)))
+#else
+#define IML_XMALLOC(type, num)                                  \
+	XMALLOC(type, num)
+#endif
+
+#ifndef XFREE
+#define IML_XFREE(stale)                            do {        \
+	if (stale) { free (stale);  stale = 0; }                    \
+        } while (0)
+#else
+#define IML_XFREE(stale)                                        \
+	XFREE(stale)
+#endif
+
+	extern "C" {
+		void *xcalloc  (size_t num, size_t size);
+		void *xmalloc  (size_t num);
+		void *xrealloc (void *p, size_t num);
+
+	}
+
+}
+#else
+#error "you are using IML wrapper without IML available in LinBox."
+#endif
+
+#endif // __LINBOX_util_iml_wrapper_H
diff --git a/linbox/util/matrix-stream.h b/linbox/util/matrix-stream.h
index 7580ece..ea996a8 100644
--- a/linbox/util/matrix-stream.h
+++ b/linbox/util/matrix-stream.h
@@ -1,7 +1,33 @@
+/* -*- 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
+/* Copyright (C) 2005 LinBox
+ * Written by Dan Roche
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_matrix_stream_H
+#define __LINBOX_matrix_stream_H
+
 /* matrix-stream.h
  * Take a file or stream of a matrix, return (row, column, value) triples from
  * that matrix.  Automatically determine matrix format.
- * 
+ *
  * NOTE to developers:  To add a new format, write a subclass of
  *                      MatrixStreamReader and put it in the formats
  *                      subdirectory.  Then you must add this new format to
@@ -10,18 +36,15 @@
  *                      you look at that file.  Once you do this, the new format
  *                      will automatically be used.
  *
- * by Dan Roche, 1-12-05
  */
 
-#ifndef __MATRIX_STREAM_H
-#define __MATRIX_STREAM_H
-
 #include <iostream>
 #include <queue>
 #include <vector>
 
-namespace LinBox { // namespace in which all LinBox code resides
-
+namespace LinBox
+{
+// namespace in which all LinBox code resides
 //  Error codes enumeration
 enum MatrixStreamError {
 	GOOD, // There is one format that has not yet encountered any errors
@@ -36,9 +59,10 @@ enum MatrixStreamError {
 
 template <class Field> class MatrixStream;
 
-/** An abstract base class to represent readers for specific formats.  For each
- * format that is to be supported, make an extension of this class that
- * implements protected methods nextTripleImpl and initImpl.
+/** An abstract base class to represent readers for specific formats.
+ *
+ * For each format that is to be supported, make an extension of this class
+ * that implements protected methods nextTripleImpl and initImpl.
  \ingroup util
  */
 template <class Field>
@@ -68,14 +92,14 @@ class MatrixStreamReader {
       * get an instance of the field via ms->getField().
       */
 	MatrixStream<Field>* ms;
-	
+
     /** The number of rows in the matrix.  This will be set by default to 0.
       */
 	size_t _m;
 
     /** Indicates whether the row dimension is accurate */
     	bool knowM;
-	
+
     /** Number of columns in the matrix.  Similar requirements as _m above. */
 	size_t _n;
 
@@ -90,14 +114,14 @@ class MatrixStreamReader {
 
     /** Save the triple (m,n,v) onto the savedTriples std::queue. */
 	void saveTriple(size_t m, size_t n, const Element& v);
-	
+
     /** Read the next triple of row index, column index, value and store it in
      * the given references.
      * @return A MatrixStreamError indicating the success or failure of the
      *         operation
      */
 	virtual MatrixStreamError nextTripleImpl(size_t&,size_t&,Element&) = 0;
-	
+
     /** Read the first line of the matrix from the stream and attempt to
      * determine if it is of this reader's type.
      * @return A MatrixStreamError indicating the success or failure of the
@@ -107,12 +131,13 @@ class MatrixStreamReader {
 
     /** A protected constructor that is called automatically when subclasses
      * are instantiated. */
-	MatrixStreamReader() {
-		sin = NULL;
-		ms = NULL;
-		_m = _n = 0;
-		knowM = knowN = false;
-		atEnd = false;
+	MatrixStreamReader()
+	{
+		sin       = NULL;
+		ms        = NULL;
+		_m        = _n = 0;
+		knowM     = knowN = false;
+		atEnd     = false;
 		lastError = GOOD;
 	}
 
@@ -151,7 +176,7 @@ class MatrixStreamReader {
      * it to the savedTriples std::queue rather than returning it.  The error
      * returned is that given from the subclass method. */
 	MatrixStreamError saveNext();
-	
+
     /** Get the number of rows in this matrix, store it in the given int. */
 	MatrixStreamError getRows(size_t&);
 
@@ -164,6 +189,7 @@ class MatrixStreamReader {
 	}
 };
 
+/// MatrixStream.
 template <class Field>
 class MatrixStream {
     public:
@@ -180,13 +206,13 @@ class MatrixStream {
      * the init functions).
      */
 	static const int FIRST_LINE_LIMIT = 160;
-	
+
     /** The underlying input stream from which data is being read. */
     	std::istream& in;
 
     /** The lineNumber is recorded in case the user wants to know at which line
       * an error occurs.  This will be updated automatically by any of the read
-      * methods below if they encounter breaks; it is up to the subclasses to 
+      * methods below if they encounter breaks; it is up to the subclasses to
       * increment lineNumber if they read any newline characters independently.
       */
 	int lineNumber;
@@ -204,7 +230,7 @@ class MatrixStream {
 	const Field& f;
 
     /** To ensure no one makes a copy of an instance of this class */
-    	MatrixStream( const MatrixStream<Field>& ) {}
+	MatrixStream( const MatrixStream<Field>& )  ;// BB si {} pbm d'initialisation
 
     /** Called by the constructors to get things going. */
 	void init();
@@ -220,13 +246,16 @@ class MatrixStream {
      * @throws MatrixStreamError if an error occurs in reading the
      *         first line (i.e. on initialization).
      */
-    	MatrixStream( const Field& fld, std::istream& i );
-	
+    	MatrixStream( const Field& fld, std::istream& in );
+
     /** Destructor */
 	~MatrixStream() { delete reader; }
-	
+
+    /** Re initiliaze after one matrix has been read. */
+	void newmatrix();
+
     /** Read some white space (if there is any). Using this method is preferable
-     * to letting the input stream handle whitespace skipping because this 
+     * to letting the input stream handle whitespace skipping because this
      * method will update the line number when breaks are encountered.
      * @return true iff there is more data after the whitespace.
      */
@@ -252,7 +281,7 @@ class MatrixStream {
      * @return true iff the operation succeeded.
      */
 	bool getColumns(size_t&);
-	
+
     /** Get the number of rows and columns in the matrix and store them in the
      * given ints.
      * @return true iff the operation succeeded.
@@ -290,8 +319,9 @@ class MatrixStream {
 	bool isSparse() const { return reader->isSparse(); }
 }; // end of class MatrixStream
 
-} // end of namespace LinBox
+}  // end of namespace LinBox
 
 #include "matrix-stream.inl"
 
-#endif // MATRIX_STREAM_H
+#endif // __LINBOX_matrix_stream_H
+
diff --git a/linbox/util/matrix-stream.inl b/linbox/util/matrix-stream.inl
index 399a79b..ad263aa 100644
--- a/linbox/util/matrix-stream.inl
+++ b/linbox/util/matrix-stream.inl
@@ -1,284 +1,331 @@
-#include "linbox/util/formats/matrix-stream-readers.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
+/* Copyright (C) LinBox
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_matrix_stream_INL
+#define __LINBOX_matrix_stream_INL
 
-namespace LinBox {
+#include "linbox/util/formats/matrix-stream-readers.h"
 
-template<class Field>
-bool MatrixStream<Field>::readWhiteSpace()
+namespace LinBox
 {
-	char c;
-	while(in.get(c)) {
-		if (isspace(c))
-			switch(c) {
-			    case '\n': ++lineNumber; break;
-		    	case '\r': if( in.peek() != '\n' ) ++lineNumber; break;
+
+	template<class Field>
+	bool MatrixStream<Field>::readWhiteSpace()
+	{
+		char c;
+		while(in.get(c)) {
+			if (isspace(c))
+				switch(c) {
+				case '\n': ++lineNumber; break;
+				case '\r': if( in.peek() != '\n' ) ++lineNumber; break;
+				}
+			else {
+				in.putback(c);
+				return true;
 			}
-		else {
-    		in.putback(c);
-			return true;
+
 		}
+		return false; // because eof or read error.
+	}
 
+	template<class Field>
+	void MatrixStreamReader<Field>::saveTriple(size_t m, size_t n, const Element& v )
+	{
+		static std::pair<std::pair<size_t,size_t>,Element> temp;
+		temp.first.first = m;
+		temp.first.second = n;
+		temp.second = v;
+		savedTriples.push(temp);
 	}
-	return false; // because eof or read error.
-}
-
-template<class Field>
-void MatrixStreamReader<Field>::saveTriple(size_t m, size_t n, const Element& v ) {
-	static std::pair<std::pair<size_t,size_t>,Element> temp;
-	temp.first.first = m;
-	temp.first.second = n;
-	temp.second = v;
-	savedTriples.push(temp);
-}
-
-template<class Field>
-MatrixStreamError MatrixStreamReader<Field>::init
+
+	template<class Field>
+	MatrixStreamError MatrixStreamReader<Field>::init
 	(const char* firstLine, std::istream* i, MatrixStream<Field>* m )
-{
-	if( !i || !m || !firstLine ) throw "Bad istream or MatrixStream";
-	sin = i;
-	ms = m;
-	return initImpl(firstLine);
-}
-
-template<class Field>
-MatrixStreamError MatrixStreamReader<Field>::nextTriple
-	(size_t& m, size_t& n, Element& v) 
-{
-	if( savedTriples.size() == 0 ) {
-		if( atEnd ) {
-			if( lastError <= GOOD ) lastError = END_OF_MATRIX;
+	{
+		if( !i || !m || !firstLine ) throw "Bad istream or MatrixStream";
+		sin = i;
+		ms = m;
+		return initImpl(firstLine);
+	}
+
+	template<class Field>
+	MatrixStreamError MatrixStreamReader<Field>::nextTriple
+	(size_t& m, size_t& n, Element& v)
+	{
+		if( savedTriples.size() == 0 ) {
+			if( atEnd ) {
+				if( lastError <= GOOD ) lastError = END_OF_MATRIX;
+				return lastError;
+			}
+			if( lastError > GOOD ) return lastError;
+			lastError =  nextTripleImpl(m,n,v);
 			return lastError;
 		}
-		if( lastError > GOOD ) return lastError;
-		lastError =  nextTripleImpl(m,n,v);
-		return lastError;
+		m = savedTriples.front().first.first;
+		n = savedTriples.front().first.second;
+		v = savedTriples.front().second;
+		savedTriples.pop();
+		return GOOD;
 	}
-	m = savedTriples.front().first.first;
-	n = savedTriples.front().first.second;
-	v = savedTriples.front().second;
-	savedTriples.pop();
-	return GOOD;
-}
-
-template<class Field>
-MatrixStreamError MatrixStreamReader<Field>::getArray
+
+	template<class Field>
+	MatrixStreamError MatrixStreamReader<Field>::getArray
 	(std::vector<Element> &array)
-{
-	MatrixStreamError mse = GOOD;
-	size_t c = 0,loc,i,j;
-	Element v;
-
-	while( true ) {
-		mse = nextTriple(i,j,v);
-		if( mse > GOOD ) break;
-		if( i > 0 ) {
-			mse = getColumns(c);
+	{
+		MatrixStreamError mse = GOOD;
+		size_t c = 0,loc,i,j;
+		Element v;
+
+		while( true ) {
+			mse = nextTriple(i,j,v);
 			if( mse > GOOD ) break;
+			if( i > 0 ) {
+				mse = getColumns(c);
+				if( mse > GOOD ) break;
+			}
+			loc = i*c+j;
+			if( loc >= array.size() )
+				array.resize(c ? (i+1)*c : loc+1);
+			array[loc] = v;
 		}
-		loc = i*c+j;
-		if( loc >= array.size() )
-			array.resize(c ? (i+1)*c : loc+1);
-		array[loc] = v;
+		if( mse > END_OF_MATRIX ) return mse;
+		mse = getRows(j);
+		if( mse > END_OF_MATRIX ) return mse;
+		if( array.size() < j*c ) array.resize(j*c);
+		return GOOD;
 	}
-	if( mse > END_OF_MATRIX ) return mse;
-	mse = getRows(j);
-	if( mse > END_OF_MATRIX ) return mse;
-	if( array.size() < j*c ) array.resize(j*c);
-	return GOOD;
-}
-
-template<class Field>
-MatrixStreamError MatrixStreamReader<Field>::saveNext() {
-	if( lastError > GOOD ) return lastError;
-	if( atEnd ) {
-		lastError = END_OF_MATRIX;
+
+	template<class Field>
+	MatrixStreamError MatrixStreamReader<Field>::saveNext()
+	{
+		if( lastError > GOOD ) return lastError;
+		if( atEnd ) {
+			lastError = END_OF_MATRIX;
+			return lastError;
+		}
+		size_t m, n;
+		Element v;
+		lastError = nextTripleImpl(m,n,v);
+		if( lastError <= GOOD ) saveTriple(m,n,v);
 		return lastError;
 	}
-	size_t m, n;
-	Element v;
-	lastError = nextTripleImpl(m,n,v);
-	if( lastError <= GOOD ) saveTriple(m,n,v);
-	return lastError;
-}
-
-template<class Field>
-MatrixStreamError MatrixStreamReader<Field>::getRows(size_t& m) {
-	MatrixStreamError toRet = GOOD;
-	while( !knowM ) {
-		if( atEnd ) return END_OF_MATRIX;
-		toRet = saveNext();
-		if( toRet > GOOD ) return toRet;
+
+	template<class Field>
+	MatrixStreamError MatrixStreamReader<Field>::getRows(size_t& m)
+	{
+		MatrixStreamError toRet = GOOD;
+		while( !knowM ) {
+			if( atEnd ) return END_OF_MATRIX;
+			toRet = saveNext();
+			if( toRet > GOOD ) return toRet;
+		}
+		m = _m;
+		return toRet;
 	}
-	m = _m;
-	return toRet;
-}
-
-template<class Field>
-MatrixStreamError MatrixStreamReader<Field>::getColumns(size_t& n) {
-	MatrixStreamError toRet = GOOD;
-	while( !knowN ) {
-		if( atEnd ) return END_OF_MATRIX;
-		toRet = saveNext();
-		if( toRet > GOOD ) return toRet;
+
+	template<class Field>
+	MatrixStreamError MatrixStreamReader<Field>::getColumns(size_t& n)
+	{
+		MatrixStreamError toRet = GOOD;
+		while( !knowN ) {
+			if( atEnd ) return END_OF_MATRIX;
+			toRet = saveNext();
+			if( toRet > GOOD ) return toRet;
+		}
+		n = _n;
+		return toRet;
 	}
-	n = _n;
-	return toRet;
-}
 
-template<class Field>
-void MatrixStream<Field>::init() {
-	lineNumber = 1;
+	template<class Field>
+	void MatrixStream<Field>::init()
+	{
+		lineNumber = 1;
 
-	//Skip comments
-	readWhiteSpace();
-	while( !in.eof() && in.peek() == '#' ) {
-		char c;
-		while( in.get(c) ) {
-			if( c == '\n' ) break;
-			if( c == '\r' ) {
-				if( in.peek() == '\n' )
-					in.get();
-				break;
+		//Skip comments
+		readWhiteSpace();
+		while( !in.eof() && in.peek() == '#' ) {
+			char c;
+			while( in.get(c) ) {
+				if( c == '\n' ) break;
+				if( c == '\r' ) {
+					if( in.peek() == '\n' )
+						in.get();
+					break;
+				}
 			}
+			++lineNumber;
+			readWhiteSpace();
 		}
-		++lineNumber;
-		readWhiteSpace();
+
+		//Get first line
+		firstLine = new char[FIRST_LINE_LIMIT];
+		in.getline(firstLine,FIRST_LINE_LIMIT);
+		firstLine[in.gcount()] = '\0';
+
+		//Initialize readers
+		currentError = NO_FORMAT;
+		__MATRIX_STREAM_READERDEFS
+		delete[] firstLine;
+
+		if( !reader ) return;
+		else if( currentError > GOOD )
+			errorLineNumber = lineNumber;
 	}
 
-	//Get first line
-	firstLine = new char[FIRST_LINE_LIMIT];
-	in.getline(firstLine,FIRST_LINE_LIMIT);
-	firstLine[in.gcount()] = '\0';
-
-	//Initialize readers
-	currentError = NO_FORMAT;
-	__MATRIX_STREAM_READERDEFS
-	delete[] firstLine;
-
-	if( !reader ) return;
-	else if( currentError > GOOD )
-		errorLineNumber = lineNumber;
-}
-
-template<class Field>
-void MatrixStream<Field>::addReader( MatrixStreamReader<Field>* r ) {
-	if( currentError == GOOD ) {
-		delete r;
-		return;
+	template<class Field>
+	void MatrixStream<Field>::addReader( MatrixStreamReader<Field>* r )
+	{
+		if( currentError == GOOD ) {
+			delete r;
+			return;
+		}
+
+		MatrixStreamError mse = r->init( firstLine, &in, this );
+		if( mse < currentError ) {
+			if( reader ) delete reader;
+			reader = r;
+			currentError = mse;
+		}
 	}
 
-	MatrixStreamError mse = r->init( firstLine, &in, this );
-	if( mse < currentError ) {
-		if( reader ) delete reader;
-		reader = r;
-		currentError = mse;
+	template<class Field>
+	MatrixStream<Field>::MatrixStream(const Field& fld, std::istream& i ) :
+		reader(NULL),in(i),readAnythingYet(false),f(fld)
+	{
+		init();
+		if( currentError > GOOD ) throw currentError;
 	}
-}
 
-template<class Field>
-MatrixStream<Field>::MatrixStream(const Field& fld, std::istream& i )
-	:reader(NULL),in(i),readAnythingYet(false),f(fld)
-{
-	init();
-	if( currentError > GOOD ) throw currentError;
-}
+	template<class Field>
+	void MatrixStream<Field>::newmatrix()
+	{
+		readAnythingYet = false;
+		init();
+		if( currentError > GOOD ) throw currentError;
+	}
 
-template<class Field>
-bool MatrixStream<Field>::nextTriple(size_t& m, size_t& n, Element& v) {
-	if( currentError > GOOD ) return false;
+	template<class Field>
+	bool MatrixStream<Field>::nextTriple(size_t& m, size_t& n, Element& v)
+	{
+		if( currentError > GOOD ) return false;
 
-	do {
-		currentError = reader->nextTriple(m,n,v);
-	} while( f.isZero(v) && currentError == GOOD );
+		do {
+			currentError = reader->nextTriple(m,n,v);
+		} while( f.isZero(v) && currentError == GOOD );
 
-	if( currentError != GOOD ) {
-		errorLineNumber = lineNumber;
-		return false;
-	}
+		if( currentError != GOOD ) {
+			errorLineNumber = lineNumber;
+			return false;
+		}
 
-	readAnythingYet = true;
-	return true;
-}
-
-template<class Field>
-bool MatrixStream<Field>::getArray(std::vector<Element> &array) {
-	if( currentError > GOOD || readAnythingYet ) return false;
-	currentError = reader->getArray(array);
-	
-	if( currentError != GOOD ) {
-		errorLineNumber = lineNumber;
-		return false;
+		readAnythingYet = true;
+		return true;
 	}
 
-	readAnythingYet = true;
-	return true;
-}
+	template<class Field>
+	bool MatrixStream<Field>::getArray(std::vector<Element> &array)
+	{
+		if( currentError > GOOD || readAnythingYet ) return false;
+		currentError = reader->getArray(array);
+
+		if( currentError != GOOD ) {
+			errorLineNumber = lineNumber;
+			return false;
+		}
 
-template<class Field>
-bool MatrixStream<Field>::getRows(size_t& m) {
-	MatrixStreamError mse = reader->getRows(m);
+		readAnythingYet = true;
+		return true;
+	}
 
-	if( currentError > GOOD ) 
-		return (mse == GOOD);
-	else if( mse > GOOD ) {
-		currentError = mse;
-		errorLineNumber = lineNumber;
-		return false;
+	template<class Field>
+	bool MatrixStream<Field>::getRows(size_t& m)
+	{
+		MatrixStreamError mse = reader->getRows(m);
+
+		if( currentError > GOOD )
+			return (mse == GOOD);
+		else if( mse > GOOD ) {
+			currentError = mse;
+			errorLineNumber = lineNumber;
+			return false;
+		}
+		else return true;
 	}
-	else return true;
-}
-
-template<class Field>
-bool MatrixStream<Field>::getColumns(size_t& n) {
-	MatrixStreamError mse = reader->getColumns(n);
-
-	if( currentError > GOOD ) 
-		return (mse == GOOD);
-	else if( mse > GOOD ) {
-		currentError = mse;
-		errorLineNumber = lineNumber;
-		return false;
+
+	template<class Field>
+	bool MatrixStream<Field>::getColumns(size_t& n)
+	{
+		MatrixStreamError mse = reader->getColumns(n);
+
+		if( currentError > GOOD )
+			return (mse == GOOD);
+		else if( mse > GOOD ) {
+			currentError = mse;
+			errorLineNumber = lineNumber;
+			return false;
+		}
+		else return true;
 	}
-	else return true;
-}
 
-template<class Field>
-bool MatrixStream<Field>::getDimensions( size_t& m, size_t& n ) {
-	return( getRows(m) && getColumns(n) );
-}
+	template<class Field>
+	bool MatrixStream<Field>::getDimensions( size_t& m, size_t& n )
+	{
+		return( getRows(m) && getColumns(n) );
+	}
 
-template<class Field>
-MatrixStreamError MatrixStream<Field>::reportError
-		( const char* func, int line ) const
+	template<class Field>
+	MatrixStreamError MatrixStream<Field>::reportError
+	( const char* func, int line ) const
 	{
-        	std::cerr << std::endl
-		         << "ERROR (" << func << ":" << line << "): "
-			 << "Problem reading matrix:" << std::endl;
+		std::cerr << std::endl
+		<< "ERROR (" << func << ":" << line << "): "
+			<< "Problem reading matrix:" << std::endl;
 		switch( getError() ) {
-		    case END_OF_MATRIX:
-		    	std::cerr << "There is no more data in the matrix file.";
+		case END_OF_MATRIX:
+			std::cerr << "There is no more data in the matrix file.";
 			break;
-		    case END_OF_FILE:
-		    	std::cerr << "An EOF was encountered unexpectedly in reading the data.";
+		case END_OF_FILE:
+			std::cerr << "An EOF was encountered unexpectedly in reading the data.";
 			break;
-		    case BAD_FORMAT:
-		    	std::cerr << "There is a formatting error in the matrix.";
+		case BAD_FORMAT:
+			std::cerr << "There is a formatting error in the matrix.";
 			break;
-		    case NO_FORMAT:
-		    	std::cerr << "The matrix format is not recognized or supported.";
+		case NO_FORMAT:
+			std::cerr << "The matrix format is not recognized or supported.";
 			break;
-		    case GOOD: break;
-		    default: break;
+		case GOOD: break;
+		default: break;
 		}
 		std::cerr << std::endl << "At line number: " << lineNumber << std::endl
-		          << "Matrix format is " << getFormat() << std::endl;
+		<< "Matrix format is " << getFormat() << std::endl;
 		return currentError;
 	}
 
-template<class Field>
-int MatrixStream<Field>::getLineNumber() const {
-	if( currentError > GOOD ) return errorLineNumber;
-	else return lineNumber;
-}
+	template<class Field>
+	int MatrixStream<Field>::getLineNumber() const {
+		if( currentError > GOOD ) return errorLineNumber;
+		else return lineNumber;
+	}
 
 } // end of namespace LinBox
+
+#endif // __LINBOX_matrix_stream_INL
diff --git a/linbox/util/mpicpp.h b/linbox/util/mpicpp.h
index e28e180..c100bd8 100644
--- a/linbox/util/mpicpp.h
+++ b/linbox/util/mpicpp.h
@@ -1,102 +1,127 @@
-#ifndef __MPICPP_H_
-#define __MPICPP_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
+/* Copyright (C) 2010 LinBox
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __LINBOX_mpicpp_H
+#define __LINBOX_mpicpp_H
 
 #ifndef __LINBOX_HAVE_MPI
- typedef int Communicator; 
+typedef int Communicator;
 #else
 #include <iterator>
 
 // problem of mpi(ch2) in C++
-#undef SEEK_SET 
-#undef SEEK_CUR 
-#undef SEEK_END 
+#undef SEEK_SET
+#undef SEEK_CUR
+#undef SEEK_END
 #include <mpi.h>
 
 
-namespace LinBox {
-/* Idea:  Only use ssend for send.
-*/
-class Communicator
-{   public:
-    // constructors and destructor
+namespace LinBox
+{
+	/* Idea:  Only use ssend for send.
+	*/
+	class Communicator {
+	public:
+		// constructors and destructor
 
-	// constructor from existing communicator 
-	//`Communicator(MPI_Comm comm = MPI_COMM_NULL);
-   Communicator(MPI_Comm comm);
-	// MPI_initializing constructor
-	// When this communicator is destroyed MPI is shut down (finalized).
-	Communicator(int* ac, char*** av);
+		// constructor from existing communicator
+		//`Communicator(MPI_Comm comm = MPI_COMM_NULL);
+		Communicator(MPI_Comm comm);
+		// MPI_initializing constructor
+		// When this communicator is destroyed MPI is shut down (finalized).
+		Communicator(int* ac, char*** av);
 
-	// copy constructor
-	Communicator(const Communicator& D);
+		// copy constructor
+		Communicator(const Communicator& D);
 
-	~Communicator();
+		~Communicator();
 
-    // accessors
-	int size();
+		// accessors
+		int size();
 
-int rank();
+		int rank();
 
-	MPI_Status status(); 
+		MPI_Status status();
 
-	MPI_Comm mpi_communicator();
+		MPI_Comm mpi_communicator();
 
-    // peer to peer communication
-	template < class Ptr >
-	void send( Ptr b, Ptr e, int dest, int tag);
+		// peer to peer communication
+		template < class Ptr >
+		void send( Ptr b, Ptr e, int dest, int tag);
 
-	template < class Ptr >
-	void ssend( Ptr b, Ptr e, int dest, int tag);
+		template < class Ptr >
+		void ssend( Ptr b, Ptr e, int dest, int tag);
 
-	template < class Ptr >
-	void recv( Ptr b, Ptr e, int dest, int tag);
+		template < class Ptr >
+		void recv( Ptr b, Ptr e, int dest, int tag);
 
-	template < class X >
-	void send( X *b, X *e, int dest, int tag);
+		template < class X >
+		void send( X *b, X *e, int dest, int tag);
 
-	template < class X >
-	void recv( X *b, X *e, int dest, int tag);
+		template < class X >
+		void recv( X *b, X *e, int dest, int tag);
 
-	// whole object send and recv
-	template < class X >
-	void send( X& b, int dest /*, int tag = 0 */);
+		// whole object send and recv
+		template < class X >
+		void send( X& b, int dest /*, int tag = 0 */);
 
-	template < class X >
-	void ssend( X& b, int dest /*, int tag = 0 */);
+		template < class X >
+		void ssend( X& b, int dest /*, int tag = 0 */);
 
-	template < class X >
-	void bsend( X& b, int dest);
+		template < class X >
+		void bsend( X& b, int dest);
 
-	template < class X >
-	void recv( X& b, int dest /*, int tag = 0*/);
-/*
-   template < vector < class X > >
-	void send( X& b, int dest );
-*/
+		template < class X >
+		void recv( X& b, int dest /*, int tag = 0*/);
+		/*
+		   template < vector < class X > >
+		   void send( X& b, int dest );
+		   */
 
-	template < class X >
-	void buffer_attach( X b);
+		template < class X >
+		void buffer_attach( X b);
 
-	template < class X >
-	int buffer_detach( X &b, int *size);
+		template < class X >
+		int buffer_detach( X &b, int *size);
 
 
-    // collective communication
-	template < class Ptr, class Function_object >
-	void reduce( Ptr bloc, Ptr eloc, Ptr bres, Function_object binop, int root);
+		// collective communication
+		template < class Ptr, class Function_object >
+		void reduce( Ptr bloc, Ptr eloc, Ptr bres, Function_object binop, int root);
 
-    // member access
-	MPI_Status get_stat();
-	 
-   protected:
-	MPI_Comm _mpi_comm; // MPI's handle for the communicator
-	bool _mpi_boss; // true of an MPI initializing communicator
-                       // There is at most one initializing communicator.
-	MPI_Status stat; // status from most recent receive
+		// member access
+		MPI_Status get_stat();
 
-};
+	protected:
+		MPI_Comm _mpi_comm; // MPI's handle for the communicator
+		bool _mpi_boss; // true of an MPI initializing communicator
+		// There is at most one initializing communicator.
+		MPI_Status stat; // status from most recent receive
+
+	};
 }// namespace LinBox
 
 #include "mpicpp.inl"
+
 #endif // __LINBOX_HAVE_MPI
-#endif // __MPICPP_H_
+#endif // __LINBOX_mpicpp_H
+
diff --git a/linbox/util/mpicpp.inl b/linbox/util/mpicpp.inl
index 9dc0544..15db547 100644
--- a/linbox/util/mpicpp.inl
+++ b/linbox/util/mpicpp.inl
@@ -1,167 +1,194 @@
-#ifndef __MPICPP_INL_
-#define __MPICPP_INL_
+/* -*- 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
+/* Copyright (C) 2010 LinBox
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+
+#ifndef __LINBOX_mpicpp_INL
+#define __LINBOX_mpicpp_INL
 //  BRYAN - changed the iterator specific lines to simply
 //  sizeof (int *)'s...  also updated the .h file to not
 //  define these functions as having default parameters,
 //  as mpicxx compiler was having trouble with this
 
-namespace LinBox {
-
-Communicator::Communicator(MPI_Comm comm = MPI_COMM_NULL)
-	: _mpi_comm(comm), _mpi_boss(false)
-{}
-
-// MPI_initializing constructor
-// When this communicator is destroyed MPI is shut down (finalized).
-Communicator::Communicator(int* ac, char*** av)
-	: _mpi_comm(MPI_COMM_WORLD), _mpi_boss(true)
-{	MPI_Init(ac, av); }
-
-// copy constructor
-Communicator::Communicator(const Communicator& D) 
-	: _mpi_comm(D._mpi_comm), _mpi_boss(false), stat(D.stat)
-{}
-
-Communicator::~Communicator()  
-{	if (_mpi_boss) MPI_Finalize(); }
-
-    // accessors
-int Communicator::size()
-{	int s; MPI_Comm_size(_mpi_comm, &s); return s; }
-
-int Communicator::rank()
-{	int r; MPI_Comm_rank(_mpi_comm, &r); return r; }
-
-MPI_Status Communicator::status() 
-{	return stat; }
-
-MPI_Comm Communicator::mpi_communicator()
-{	return _mpi_comm; }
-
-    // peer to peer communication
-template < class Ptr >
-void Communicator::send( Ptr b, Ptr e, int dest, int tag = 0)
+namespace LinBox
 {
-	MPI_Send( &*b, 
-	(e - b)*sizeof(typename Ptr::value_type), 
-	MPI_BYTE,
-	dest, 
-	tag,
-	_mpi_comm);
-}
-
-template < class Ptr >
-void Communicator::ssend( Ptr b, Ptr e, int dest, int tag = 0)
-{	MPI_Ssend( &b[0], 
-	//(e - b)*sizeof(iterator_traits<Ptr>::value_type), 
-	(e-b)*sizeof(int *),
-	MPI_BYTE,
-	dest, 
-	tag,
-	_mpi_comm);
-}
-
-template < class Ptr >
-void Communicator::recv( Ptr b, Ptr e, int dest, int tag = 0)
-{	
-MPI_Recv( &b[0], 
-	(e - b)*sizeof(typename Ptr::value_type), 
-	MPI_BYTE,
-	dest, 
-	tag,
-	_mpi_comm,
-	&stat);
-}
-
-template < class X >
-void Communicator::send( X *b, X *e, int dest, int tag = 0)
-{
-	MPI_Send( b, 
-	(e - b)*sizeof(X), 
-	MPI_BYTE,
-	dest, 
-	tag,
-	_mpi_comm);
-}
 
+	Communicator::Communicator(MPI_Comm comm = MPI_COMM_NULL) :
+		_mpi_comm(comm), _mpi_boss(false)
+	{}
+
+	// MPI_initializing constructor
+	// When this communicator is destroyed MPI is shut down (finalized).
+	Communicator::Communicator(int* ac, char*** av) :
+		_mpi_comm(MPI_COMM_WORLD), _mpi_boss(true)
+	{	MPI_Init(ac, av); }
+
+	// copy constructor
+	Communicator::Communicator(const Communicator& D) :
+		_mpi_comm(D._mpi_comm), _mpi_boss(false), stat(D.stat)
+	{}
+
+	Communicator::~Communicator()
+	{	if (_mpi_boss) MPI_Finalize(); }
+
+	// accessors
+	int Communicator::size()
+	{	int s; MPI_Comm_size(_mpi_comm, &s); return s; }
+
+	int Communicator::rank()
+	{	int r; MPI_Comm_rank(_mpi_comm, &r); return r; }
+
+	MPI_Status Communicator::status()
+	{	return stat; }
+
+	MPI_Comm Communicator::mpi_communicator()
+	{	return _mpi_comm; }
+
+	// peer to peer communication
+	template < class Ptr >
+	void Communicator::send( Ptr b, Ptr e, int dest, int tag = 0)
+	{
+		MPI_Send( &*b,
+			  (e - b)*sizeof(typename Ptr::value_type),
+			  MPI_BYTE,
+			  dest,
+			  tag,
+			  _mpi_comm);
+	}
+
+	template < class Ptr >
+	void Communicator::ssend( Ptr b, Ptr e, int dest, int tag = 0)
+	{	MPI_Ssend( &b[0],
+			   //(e - b)*sizeof(iterator_traits<Ptr>::value_type),
+			   (e-b)*sizeof(int *),
+			   MPI_BYTE,
+			   dest,
+			   tag,
+			   _mpi_comm);
+	}
+
+	template < class Ptr >
+	void Communicator::recv( Ptr b, Ptr e, int dest, int tag = 0)
+	{
+		MPI_Recv( &b[0],
+			  (e - b)*sizeof(typename Ptr::value_type),
+			  MPI_BYTE,
+			  dest,
+			  tag,
+			  _mpi_comm,
+			  &stat);
+	}
+
+	template < class X >
+	void Communicator::send( X *b, X *e, int dest, int tag = 0)
+	{
+		MPI_Send( b,
+			  (e - b)*sizeof(X),
+			  MPI_BYTE,
+			  dest,
+			  tag,
+			  _mpi_comm);
+	}
+
+
+	template < class X >
+	void Communicator::recv( X *b, X *e, int dest, int tag = 0)
+	{
+		MPI_Recv( b,
+			  (e - b)*sizeof(X),
+			  MPI_BYTE,
+			  dest,
+			  tag,
+			  _mpi_comm,
+			  &stat);
+	}
+
+
+	// whole object send and recv
+	template < class X >
+	void Communicator::send( X& b, int dest /*, int tag = 0 */)
+	{	MPI_Send(&b,
+			 sizeof(X),
+			 MPI_BYTE,
+			 dest,
+			 0,
+			 _mpi_comm);
+	}
+
+	template < class X >
+	void Communicator::ssend( X& b, int dest /*, int tag = 0 */)
+	{	MPI_Ssend(&b,
+			  sizeof(X),
+			  MPI_BYTE,
+			  dest,
+			  0,
+			  _mpi_comm);
+	}
+
+	template < class X >
+	void Communicator::bsend(X& b, int dest /*, int tag = 0*/)
+	{	MPI_Bsend( &b,
+			   sizeof(X),
+			   MPI_BYTE,
+			   dest,
+			   0,
+			   _mpi_comm);
+	}
+
+	template < class X >
+	void Communicator::recv( X& b, int dest /*, int tag = 0*/)
+	{	MPI_Recv( &b,
+			  sizeof(X),
+			  MPI_BYTE,
+			  dest,
+			  0,
+			  _mpi_comm,
+			  &stat);
+	}
+
+	template < class X >
+	void Communicator::buffer_attach(X b)
+	{
+		MPI_Buffer_attach( malloc(sizeof(X) *  60) ,
+				   sizeof(X) * 60 );
+	}
+
+	template < class X >
+	int Communicator::buffer_detach(X &b, int *size)
+	{  return MPI_Buffer_detach( &b,
+				     size);
+	}
+
+	// collective communication
+	template < class Ptr, class Function_object >
+	void Communicator::reduce( Ptr bloc, Ptr eloc, Ptr bres, Function_object binop, int root)
+	{}
+
+	// member access
+	MPI_Status Communicator::get_stat()
+	{
+		return stat;
+	}
+
+} // namespace LinBox
+#endif // __LINBOX_mpicpp_INL
 
-template < class X >
-void Communicator::recv( X *b, X *e, int dest, int tag = 0)
-{
-	MPI_Recv( b, 
-	(e - b)*sizeof(X), 
-	MPI_BYTE,
-	dest, 
-	tag,
-	_mpi_comm,
-	&stat);
-}
-	
-
-// whole object send and recv
-template < class X >
-void Communicator::send( X& b, int dest /*, int tag = 0 */)
-{	MPI_Send(&b, 
-	sizeof(X), 
-	MPI_BYTE,
-	dest, 
-	0,
-	_mpi_comm);
-}
-
-template < class X >
-void Communicator::ssend( X& b, int dest /*, int tag = 0 */)
-{	MPI_Ssend(&b, 
-	sizeof(X), 
-	MPI_BYTE,
-	dest, 
-	0,
-	_mpi_comm);
-}
-
-template < class X >
-void Communicator::bsend(X& b, int dest /*, int tag = 0*/)
-{	MPI_Bsend( &b, 
-	sizeof(X),
-	MPI_BYTE,
-	dest, 
-	0,
-	_mpi_comm);
-}
-
-template < class X >
-void Communicator::recv( X& b, int dest /*, int tag = 0*/)
-{	MPI_Recv( &b, 
-	sizeof(X),
-	MPI_BYTE,
-	dest, 
-	0,
-	_mpi_comm,
-	&stat);
-}
-
-template < class X >
-void Communicator::buffer_attach(X b)
-{  
-   MPI_Buffer_attach( malloc(sizeof(X) *  60) ,
-   sizeof(X) * 60 );
-}
-
-template < class X >
-int Communicator::buffer_detach(X &b, int *size)
-{  return MPI_Buffer_detach( &b,
-   size);
-}
-    // collective communication
-template < class Ptr, class Function_object >
-void Communicator::reduce( Ptr bloc, Ptr eloc, Ptr bres, Function_object binop, int root)
-{}
-
-   /// member access
-
-MPI_Status Communicator::get_stat(){
-   return stat;
-}
-
-}// namespace LinBox
-#endif // __MPICPP_INL_
diff --git a/linbox/util/prime-stream.h b/linbox/util/prime-stream.h
index 24f344d..cf8393b 100644
--- a/linbox/util/prime-stream.h
+++ b/linbox/util/prime-stream.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/randiter/primes.h
  * Copyright (C) 2002 Bradford Hovinen
  *
@@ -12,8 +12,8 @@
  * Stream of prime numbers
  */
 
-#ifndef __PRIME_STREAM_H
-#define __PRIME_STREAM_H
+#ifndef __LINBOX_prime_stream_H
+#define __LINBOX_prime_stream_H
 
 #include "linbox/integer.h"
 
@@ -23,68 +23,70 @@
 namespace LinBox
 {
 
-/** Prime number stream
- *
- * Provides a source of prime numbers of given characteristics to use in parts
- * of the library that need to reduce modulo one or more primes.
- **/
-template <class Element>
-class PrimeStream
-{
-    public:
-
-	/** Constructor
+	/** Prime number stream
 	 *
-	 * Construct a PrimeStream object.
-	 * @param start Starting point; need not be prime itself
-	 * @param move_up true if we should move up from the starting point, false otherwise
-	 */
-	PrimeStream (Integer &start, bool move_up = true)
-		: _curr (start), _move_up (move_up) {}
+	 * Provides a source of prime numbers of given characteristics to use in parts
+	 * of the library that need to reduce modulo one or more primes.
+	 **/
+	template <class Element>
+	class PrimeStream {
+	public:
+
+		/** Constructor
+		 *
+		 * Construct a PrimeStream object.
+		 * @param start Starting point; need not be prime itself
+		 * @param move_up true if we should move up from the starting point, false otherwise
+		 */
+		PrimeStream (Integer &start, bool move_up = true) :
+			_curr (start), _move_up (move_up)
+		{}
+
+		~PrimeStream ()
+		{}
+
+		/** Get the next prime element
+		 *
+		 * @param a Place to store the next prime element
+		 * @return Reference to next prime element
+		 */
+		Element &next (Element &a)
+		{
+
+			/** @warning LinBox::Integer does not support prevprime */
+#if 0
+			if (_move_up == true) {
+				nextprime (_curr, _curr);
+				a = _curr;
+				_curr += 2L;
+			}
+			else {
+				prevprime (_curr, _curr);
+				a = _curr;
+				_curr -= 2L;
+			}
+#endif
 
-	~PrimeStream () 
-	{}
-
-	/** Get the next prime element
-	 *
-	 * @param a Place to store the next prime element
-	 * @return Reference to next prime element
-	 */
-	Element &next (Element &a) 
-	{
-
-		/** LinBox::Integer doesnot support prevprime */
-		/*
-		if (_move_up == true) {
 			nextprime (_curr, _curr);
 			a = _curr;
 			_curr += 2L;
-		} else {
-			prevprime (_curr, _curr);
-			a = _curr;
-			_curr -= 2L;
+
+			return a;
 		}
-		*/
 
-		nextprime (_curr, _curr);
-		a = _curr;
-		_curr += 2L;
+		/** Operator form for getting the next prime element
+		*/
+		PrimeStream<Element> &operator >> (Element &a)
+		{ next (a); return *this; }
 
-		return a;
-	}
+	private:
 
-	/** Operator form for getting the next prime element
-	 */
-	PrimeStream<Element> &operator >> (Element &a) 
-		{ next (a); return *this; }
+		Integer _curr;
+		bool    _move_up;
 
-    private:
+	}; // class PrimeStream
 
-	Integer _curr;
-	bool    _move_up;
-     
-}; // class PrimeStream
- 
 } // namespace LinBox
 
-#endif // __PRIME_STREAM_H
+#endif // __LINBOX_prime_stream_H
+
diff --git a/linbox/util/timer.C b/linbox/util/timer.C
deleted file mode 100644
index 63d25ed..0000000
--- a/linbox/util/timer.C
+++ /dev/null
@@ -1,204 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* linbox/util/timer.C
- * Copyright (C) 1994-1997 Givaro Team
- *
- * Written by T. Gautier
- *
- * See COPYING for license information.
- */
-#ifndef __LINBOX__TIMER__C__
-#define __LINBOX__TIMER__C__
-// Description:
-// - various timer objects
-// - to be rewritten to be more efficient
-
-#include <cmath>
-
-extern "C" {
-# include <sys/time.h>
-# include <sys/resource.h>
-//  int getrusage (int, struct rusage*) ;
-}
-
-#include <iostream>
-
-#include "linbox/util/timer.h"
-
-namespace LinBox 
-{
-
-// Return a value to initialize random generator 
-long BaseTimer::seed() 
-{
-	struct timeval tp;
-	gettimeofday(&tp, 0) ;
-	return(tp.tv_usec);
-}
-
-// Output the value of the timer :
-std::ostream& BaseTimer::print( std::ostream& o ) const 
-{ return o << _t ; }
-
-// Some arithmetic operator :
-BaseTimer& BaseTimer::operator = (const BaseTimer & T) 
-{  
-	_t = T._t ; 
-	return *this ; 
-}
-      
-// Computes and returns interval of time
-// beteween *this and T
-const BaseTimer BaseTimer::operator - (const BaseTimer & T) const
-{
-	BaseTimer Tmp ;
-	Tmp._t = _t - T._t ; 
-	return Tmp ;
-}
-
-const BaseTimer BaseTimer::operator - () 
-{
-	BaseTimer Tmp ;
-	Tmp._t = -_t ; 
-	return Tmp ;
-}
-
-const BaseTimer BaseTimer::operator + (const BaseTimer & T)  const
-{
-	BaseTimer Tmp ;
-	Tmp._t = _t + T._t ; 
-	return Tmp ;
-}
-
-// Start timer
-void RealTimer::start()
-{  
-	struct timeval tmp2 ; 
-	gettimeofday (&tmp2, 0) ;
-
-	// real time 
-	_start_t = (double) tmp2.tv_sec + 
-		((double) tmp2.tv_usec)/ (double)BaseTimer::MSPSEC ; 
-}
-
-
-// Stop timer 
-void RealTimer::stop()
-{ 
-	struct timeval tmp2 ;  
-	gettimeofday (&tmp2, 0) ;
-
-	// real time 
-	_t = (double) tmp2.tv_sec + 
-		((double) tmp2.tv_usec)/ (double)BaseTimer::MSPSEC - _start_t ; 
-}
-
-// Start timer
-void UserTimer::start()
-{
-	struct rusage  tmp1 ;  // to getrusage (sys+user times)
-	getrusage (RUSAGE_SELF, &tmp1) ;
-	// user time
-	_start_t = (double) tmp1.ru_utime.tv_sec +
-		((double) tmp1.ru_utime.tv_usec)/ (double)MSPSEC ;
-}
-
-
-// Stop timer
-void UserTimer::stop()
-{
-	struct rusage  tmp1 ;  // to getrusage (sys+user times)
-	getrusage (RUSAGE_SELF, &tmp1) ;
-	// user time
-	_t = (double) tmp1.ru_utime.tv_sec +
-		((double) tmp1.ru_utime.tv_usec)/ (double)MSPSEC - _start_t ;
-}
-
-
-// Start timer
-void SysTimer::start()
-{
-	struct rusage  tmp1 ;  // to getrusage (sys+user times)
-	getrusage (RUSAGE_SELF, &tmp1) ;
-	// user time
-	_start_t = (double) tmp1.ru_stime.tv_sec + 
-		((double) tmp1.ru_stime.tv_usec)/ (double)MSPSEC ;
-}
-
-
-// Stop timer
-void SysTimer::stop()
-{
-	struct rusage  tmp1 ;  // to getrusage (sys+user times)
-	getrusage (RUSAGE_SELF, &tmp1) ;
-	// user time
-	_t = (double) tmp1.ru_stime.tv_sec +
-		((double) tmp1.ru_stime.tv_usec)/ (double)MSPSEC - _start_t ;
-}
-
-
-
-// Clear timer :
-void Timer::clear() 
-{ rt.clear() ; ut.clear(); st.clear(); _count = 0; }
-
-// Start timer
-void Timer::start() 
-{ rt.start() ; ut.start(); st.start(); _count = 0; }
-
-// Stop timer
-void Timer::stop() 
-{ rt.stop() ; ut.stop(); st.stop(); _count = 1; }
-
-
-std::ostream& Timer::print( std::ostream& o ) const
-{
-	o << "user time: " << usertime() << '\n' ;
-	o << "sys. time: " << systime() << '\n' ;
-	return o << "real time: " << realtime() << std::endl ;
-}
-
-// Some arithmetic operator :
-Timer& Timer::operator = (const Timer & T)
-{
-	ut = T.ut ; 
-	st = T.st ; 
-	rt = T.rt ;
-	_count = T._count;
-	return *this ;
-}
-
-// Comput._tes and returns interval of time
-// beteween *this and T
-const Timer Timer::operator - (const Timer & T)  const
-{
-	Timer Tmp ;
-	Tmp.ut = ut - T.ut ;
-	Tmp.st = st - T.st ;
-	Tmp.rt = rt - T.rt ;
-	Tmp._count = _count - T._count;
-	return Tmp ;
-}
-
-const Timer Timer::operator - ()
-{
-	Timer Tmp ;
-	Tmp.ut = -ut ;
-	Tmp.st = -st ;
-	Tmp.rt = -rt ;
-	Tmp._count = - _count;
-	return Tmp ;
-}
-
-const Timer Timer::operator + (const Timer & T)  const
-{
-	Timer Tmp ;
-	Tmp.ut = ut + T.ut ;
-	Tmp.st = st + T.st ;
-	Tmp.rt = rt + T.rt ;
-	Tmp._count = _count + T._count;
-	return Tmp ;
-}
- 
-}
-#endif
diff --git a/linbox/util/timer.h b/linbox/util/timer.h
index cb45896..1f02562 100644
--- a/linbox/util/timer.h
+++ b/linbox/util/timer.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/util/timer.h
  * Copyright (C) 1994-1997 Givaro Team
  *
@@ -17,141 +17,21 @@
  *
  */
 
-#ifndef __LINBOX_TIMER_H
-#define __LINBOX_TIMER_H
-
-#include <iostream>
-
-namespace LinBox 
-{
-
-/** \brief base for class RealTimer; class SysTimer; class UserTimer;
-\ingroup util
-*/
-
-class BaseTimer { 
-    public:
-	enum { 
-		MSPSEC = 1000000  // microsecond per second
-	};
-
-        BaseTimer() {_start_t = 0;}
-
-	// -- Clear timer :
-	inline void clear() { _t = 0; }
-
-	// -- total amount of second spent 
-	inline double time() const { return _t; }
-
-	// -- Return a value to initialize random generator
-	static long seed();
-
-	// -- basic methods:
-	std::ostream &print (std::ostream &) const;
-       
-	// -- Some arithmetic operators to compute cumulative time :
-	BaseTimer& operator = (const BaseTimer & T) ;
-	const BaseTimer operator - (const BaseTimer & T)  const;
-	const BaseTimer operator - () ;
-	const BaseTimer operator +  (const BaseTimer & T)  const;
-	BaseTimer& operator += (const BaseTimer & T) { return *this = *this + T; };
-	BaseTimer& operator -= (const BaseTimer & T) { return *this = *this - T; };
-
-    public:
-	double _start_t;  // time as of start ()
-	double _t;        // time  
-};
-
-inline std::ostream &operator << (std::ostream &o, const BaseTimer &BT)
-	{ return BT.print(o); }
-
-class RealTimer : public BaseTimer {
-    public:
-	inline RealTimer (const BaseTimer &BT) : BaseTimer (BT) {};
-	inline RealTimer () {};
-	void start ();
-	void stop ();
-};
-
-
-class UserTimer : public BaseTimer {
-    public:
-	inline UserTimer (const BaseTimer &BT) : BaseTimer (BT) {};
-	inline UserTimer () {};
-	void start ();
-	void stop ();
-};
-
-
-class SysTimer : public BaseTimer {
-    public:
-	inline SysTimer (const BaseTimer &BT): BaseTimer (BT) {};
-	inline SysTimer () {};
-	void start ();
-	void stop ();
-};
-
-
-class Timer {
-public :
-	
-	Timer() { rt.clear(); ut.clear(); st.clear(); _count = 0; }
-	
-	// Clear timer :
-	void clear(); 
-
-	// Start timer
-	void start ();
-
-	// Stop timer 
-	void stop ();
-
-	// total amount of second spent in user mode
-	double usertime () const { return ut.time(); }
-
-	// total amount of second spent in system mode
-	double systime () const { return st.time(); }
-
-	// real total amount of second spent.  
-	double realtime () const { return rt.time(); }
-
-	// retourne une petite graine
-	// long seed() const { return RealTimer::seed(); }
-
-	// Some arithmetic operators to compute cumulative time :
-	Timer& operator = (const Timer & T) ;
-	const Timer operator - (const Timer & T)  const;
-	const Timer operator - () ;
-	const Timer operator + (const Timer & T)  const;
-	Timer& operator += (const Timer & T) { return *this = *this + T; };
-	Timer& operator -= (const Timer & T) { return *this = *this - T; };
-
-	// -- methods :
-	std::ostream &print (std::ostream &) const;
-
-	size_t count() const {return _count;}
-
-    private:
-	size_t _count; // how many 
+/*! @file util/timer.h
+ * @ingroup util
+ * LinBox timer is Givaro's.
+ */
 
-	RealTimer rt;
-	UserTimer ut;
-	SysTimer  st;
-};
+#ifndef __LINBOX_timer_H
+#define __LINBOX_timer_H
 
-// inline std::ostream &operator << (std::ostream &o, const Timer &T)
-// 	{ return T.print (o); }
+#include <givaro/givtimer.h>
 
-inline std::ostream &operator << (std::ostream &o, const Timer &T)
-{ 
-	double ut = T.usertime();
-	if (ut < 0.0000000001) ut = 0;
-	return o << T.realtime() << "s (" << ut << " cpu) [" << T.count() << "]"; }
- 
+namespace LinBox {
+typedef ::Givaro::Timer Timer  ;
+typedef ::Givaro::BaseTimer BaseTimer ;
+typedef ::Givaro::UserTimer UserTimer ;
+typedef ::Givaro::SysTimer SysTimer ;
 }
 
-#ifdef LinBoxSrcOnly  // for all-source compilation
-#    include <linbox/util/timer.C>
-#endif
-
-#endif 
+#endif  //__LINBOX_timer_H
diff --git a/linbox/util/util.doxy b/linbox/util/util.doxy
index 250f760..c5a475f 100644
--- a/linbox/util/util.doxy
+++ b/linbox/util/util.doxy
@@ -1,6 +1,9 @@
-/** \defgroup util linbox/util
+/** \ingroup linbox
+  \defgroup util util
 
-Miscellaneous utilities.
+  @brief Miscellaneous utilities.
 
-Basic GMP integer wrapper, timers, commentator, matrix-stream-reader, error, debug. 
-*/
+  Basic GMP integer wrapper, timers, commentator, matrix-stream-reader, error, debug.
+ */
+
+// vim:syn=doxygen
diff --git a/linbox/vector/Makefile.am b/linbox/vector/Makefile.am
index 74acc45..16881a4 100644
--- a/linbox/vector/Makefile.am
+++ b/linbox/vector/Makefile.am
@@ -1,3 +1,6 @@
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 pkgincludesubdir=$(pkgincludedir)/vector
 
 EXTRA_DIST=			\
@@ -5,6 +8,7 @@ EXTRA_DIST=			\
 
 pkgincludesub_HEADERS=		\
 	pair.h			\
+	light_container.h			\
 	sparse.h		\
 	vector-traits.h		\
 	subvector.h		\
diff --git a/linbox/vector/Makefile.in b/linbox/vector/Makefile.in
index 9601532..3e282a1 100644
--- a/linbox/vector/Makefile.in
+++ b/linbox/vector/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -37,19 +38,26 @@ DIST_COMMON = $(pkgincludesub_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
-	$(top_srcdir)/macros/blas-check.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
 	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
 	$(top_srcdir)/macros/givaro-check.m4 \
 	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
 	$(top_srcdir)/macros/lidia-check.m4 \
 	$(top_srcdir)/macros/linbox-doc.m4 \
 	$(top_srcdir)/macros/linbox-misc.m4 \
 	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
 	$(top_srcdir)/macros/maple-check.m4 \
 	$(top_srcdir)/macros/ntl-check.m4 \
 	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -79,18 +87,21 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
 CC = @CC@
+CCNAM = @CCNAM@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
 DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -98,19 +109,24 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
 GIVARO_CFLAGS = @GIVARO_CFLAGS@
 GIVARO_LIBS = @GIVARO_LIBS@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
 GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
@@ -118,41 +134,52 @@ LIBTOOL = @LIBTOOL@
 LIDIA_CFLAGS = @LIDIA_CFLAGS@
 LIDIA_LIBS = @LIDIA_LIBS@
 LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MAPLE_CFLAGS = @MAPLE_CFLAGS@
 MAPLE_HOME = @MAPLE_HOME@
 MAPLE_LIBS = @MAPLE_LIBS@
 MAPLE_VERSION = @MAPLE_VERSION@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
 NTL_CFLAGS = @NTL_CFLAGS@
 NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RM = @RM@
 SACLIB_CFLAGS = @SACLIB_CFLAGS@
 SACLIB_LIBS = @SACLIB_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+TESTS_CFLAGS = @TESTS_CFLAGS@
 VERSION = @VERSION@
+WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -193,14 +220,20 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 pkgincludesubdir = $(pkgincludedir)/vector
 EXTRA_DIST = \
 	vector.doxy
 
 pkgincludesub_HEADERS = \
 	pair.h			\
+	light_container.h			\
 	sparse.h		\
 	vector-traits.h		\
 	subvector.h		\
@@ -220,8 +253,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
 	      exit 1;; \
 	  esac; \
 	done; \
@@ -274,7 +307,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
@@ -387,6 +420,8 @@ dvi-am:
 
 html: html-am
 
+html-am:
+
 info: info-am
 
 info-am:
@@ -395,18 +430,28 @@ install-data-am: install-pkgincludesubHEADERS
 
 install-dvi: install-dvi-am
 
+install-dvi-am:
+
 install-exec-am:
 
 install-html: install-html-am
 
+install-html-am:
+
 install-info: install-info-am
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-am
 
+install-pdf-am:
+
 install-ps: install-ps-am
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
diff --git a/linbox/vector/bit-vector.h b/linbox/vector/bit-vector.h
index 9657a99..3c066ba 100644
--- a/linbox/vector/bit-vector.h
+++ b/linbox/vector/bit-vector.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/vector/bit-vector.h
  * Copyright (C) 2003 Bradford Hovinen
  *
@@ -8,8 +8,8 @@
  * See COPYING for license information.
  */
 
-#ifndef __BIT_VECTOR_H
-#define __BIT_VECTOR_H
+#ifndef __LINBOX_bit_vector_H
+#define __LINBOX_bit_vector_H
 
 #include <iterator>
 #include <vector>
@@ -20,152 +20,153 @@
 namespace LinBox
 {
 
-/** Binary constant defined both for 32 and 64 bits
- */
+	/** Binary constant defined both for 32 and 64 bits
+	*/
 #if (__LINBOX_SIZEOF_LONG == 4)
 #define __LINBOX_BITSOF_LONG 32
 #define __LINBOX_BITSOF_LONG_MUN 31
 #define __LINBOX_LOGOF_SIZE 5
 #define __LINBOX_POS_ALL_ONES 0x1F
-const unsigned long __LINBOX_ALL_ONES = static_cast<const unsigned long>(-1);
+	const unsigned long __LINBOX_ALL_ONES = static_cast<unsigned long>(-1);
 #define __LINBOX_PARITY(s) ParallelParity(s)
 
-    bool ParallelParity(unsigned long t) {
-	t ^= (t >> 16);
-	t ^= (t >> 8);
-	t ^= (t >> 4);
-        t &= 0xf;
-        return bool( (0x6996 >> t) & 0x1);
-    }
+	inline bool ParallelParity(unsigned long t) {
+		t ^= (t >> 16);
+		t ^= (t >> 8);
+		t ^= (t >> 4);
+		t &= 0xf;
+		return bool( (0x6996 >> t) & 0x1);
+	}
 #endif
 #if (__LINBOX_SIZEOF_LONG == 8)
 #define __LINBOX_BITSOF_LONG 64
 #define __LINBOX_BITSOF_LONG_MUN 63
 #define __LINBOX_LOGOF_SIZE 6
 #define __LINBOX_POS_ALL_ONES 0x3F
-const unsigned long __LINBOX_ALL_ONES = static_cast<const unsigned long>(-1);
+	const unsigned long __LINBOX_ALL_ONES = static_cast<unsigned long>(-1);
 #define __LINBOX_PARITY(s) ParallelParity(s)
 
-    bool ParallelParity(unsigned long t) {
-	t ^= (t >> 32);
-	t ^= (t >> 16);
-	t ^= (t >> 8);
-	t ^= (t >> 4);
-        t &= 0xf;
-        return bool( (0x6996 >> t) & 0x1);
-    }
+	inline bool ParallelParity(unsigned long t) {
+		t ^= (t >> 32);
+		t ^= (t >> 16);
+		t ^= (t >> 8);
+		t ^= (t >> 4);
+		t &= 0xf;
+		return bool( (0x6996 >> t) & 0x1);
+	}
 #endif
 
-/** A vector of boolean 0-1 values, stored compactly to save space. 
- *
- * BitVector provides an additional iterator, word_iterator, that gives
- * the bits in compact 32-bit words, so that vector operations may be done in
- * parallel. It is similar to the STL bit_vector except that it provides the
- * aforementioned additional iterator.
- \ingroup vector
- */
-
-class BitVector
-{
-    public:
-	typedef bool        value_type;
-	typedef size_t      size_type;
-	typedef long         difference_type;
-	typedef std::vector<unsigned long>::iterator               word_iterator;
-	typedef std::vector<unsigned long>::const_iterator         const_word_iterator;
-	typedef std::vector<unsigned long>::reverse_iterator       reverse_word_iterator;
-	typedef std::vector<unsigned long>::const_reverse_iterator const_reverse_word_iterator;
-
-	BitVector () {}
-	BitVector (std::vector<bool> &v)
+	/** A vector of boolean 0-1 values, stored compactly to save space.
+	 *
+	 * BitVector provides an additional iterator, word_iterator, that gives
+	 * the bits in compact 32-bit words, so that vector operations may be done in
+	 * parallel. It is similar to the STL bit_vector except that it provides the
+	 * aforementioned additional iterator.
+	 \ingroup vector
+	 */
+
+	class BitVector {
+	public:
+		typedef bool        value_type;
+		typedef size_t      size_type;
+		typedef long         difference_type;
+		typedef std::vector<unsigned long>::iterator               word_iterator;
+		typedef std::vector<unsigned long>::const_iterator         const_word_iterator;
+		typedef std::vector<unsigned long>::reverse_iterator       reverse_word_iterator;
+		typedef std::vector<unsigned long>::const_reverse_iterator const_reverse_word_iterator;
+
+		BitVector () {}
+		BitVector (std::vector<bool> &v)
 		{ *this = v; }
-	BitVector (std::vector<unsigned long> &v)
-		: _v (v), _size (_v.size () * __LINBOX_BITSOF_LONG) {}
-	BitVector (size_t n, bool val = false)
+		BitVector (std::vector<unsigned long> &v) :
+		       	_v (v), _size (_v.size () * __LINBOX_BITSOF_LONG) {}
+		BitVector (size_t n, bool val = false)
 		{ resize (n, val); }
-		
-	// Copy constructor
-	BitVector (const BitVector &v) 
-		: _v (v._v), _size (v._size) {}
 
-	~BitVector () {}
+		// Copy constructor
+		BitVector (const BitVector &v) :
+		       	_v (v._v), _size (v._size) {}
 
-	// Reference
+		~BitVector () {}
 
-	class reference;
-	class const_reference;
+		// Reference
 
-	// Iterators
+		class reference;
+		class const_reference;
 
-	class iterator;
-	class const_iterator;
+		// Iterators
 
-	typedef std::reverse_iterator<iterator> reverse_iterator;
-	typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+		class iterator;
+		class const_iterator;
 
-	typedef iterator    pointer;
+		typedef std::reverse_iterator<iterator> reverse_iterator;
+		typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
 
-	inline iterator                    begin      (void);
-	inline const_iterator              begin      (void) const;
-	inline iterator                    end        (void);
-	inline const_iterator              end        (void) const;
+		typedef iterator    pointer;
+		typedef const_iterator    const_pointer;
 
-	inline reverse_iterator            rbegin     (void);
-	inline const_reverse_iterator      rbegin     (void) const;
-	inline reverse_iterator            rend       (void);
-	inline const_reverse_iterator      rend       (void) const;
+		inline iterator                    begin      (void);
+		inline const_iterator              begin      (void) const;
+		inline iterator                    end        (void);
+		inline const_iterator              end        (void) const;
 
-	inline word_iterator               wordBegin  (void)       { return _v.begin (); }
-	inline const_word_iterator         wordBegin  (void) const { return _v.begin (); }
-	inline word_iterator               wordEnd    (void)       { return _v.end (); }
-	inline const_word_iterator         wordEnd    (void) const { return _v.end (); }
+		inline reverse_iterator            rbegin     (void);
+		inline const_reverse_iterator      rbegin     (void) const;
+		inline reverse_iterator            rend       (void);
+		inline const_reverse_iterator      rend       (void) const;
 
-	inline reverse_word_iterator       wordRbegin (void)       { return _v.rbegin (); }
-	inline const_reverse_word_iterator wordRbegin (void) const { return _v.rbegin (); }
-	inline reverse_word_iterator       wordRend   (void)       { return _v.rend (); }
-	inline const_reverse_word_iterator wordRend   (void) const { return _v.rend (); }
+		inline word_iterator               wordBegin  (void)       { return _v.begin (); }
+		inline const_word_iterator         wordBegin  (void) const { return _v.begin (); }
+		inline word_iterator               wordEnd    (void)       { return _v.end (); }
+		inline const_word_iterator         wordEnd    (void) const { return _v.end (); }
 
-	// Element access
+		inline reverse_word_iterator       wordRbegin (void)       { return _v.rbegin (); }
+		inline const_reverse_word_iterator wordRbegin (void) const { return _v.rbegin (); }
+		inline reverse_word_iterator       wordRend   (void)       { return _v.rend (); }
+		inline const_reverse_word_iterator wordRend   (void) const { return _v.rend (); }
 
-	inline reference       operator[] (size_type n);
-	inline const_reference operator[] (size_type n) const;
+		// Element access
 
-	reference at       (size_type n);
-	const_reference at (size_type n) const;
+		inline reference       operator[] (size_type n);
+		inline const_reference operator[] (size_type n) const;
 
-	inline reference       front (void);
-	inline const_reference front (void) const;
-	inline reference       back  (void);
-	inline const_reference back  (void) const;
+		reference at       (size_type n);
+		const_reference at (size_type n) const;
 
-	template<class Container>
-	BitVector &operator = (const Container& x);
+		inline reference       front (void);
+		inline const_reference front (void) const;
+		inline reference       back  (void);
+		inline const_reference back  (void) const;
 
-	void resize (size_type new_size, bool val = false);
+		template<class Container>
+		BitVector &operator = (const Container& x);
 
-	inline size_type size      (void) const { return _size;            }
-	inline bool      empty     (void) const { return _v.empty ();      }
-	inline size_type max_size  (void) const { return _v.size  () * __LINBOX_BITSOF_LONG; }
+		void resize (size_type new_size, bool val = false);
 
-	bool operator == (const BitVector &v) const;
+		inline size_type size      (void) const { return _size;            }
+		inline bool      empty     (void) const { return _v.empty ();      }
+		inline size_type max_size  (void) const { return _v.size  () * __LINBOX_BITSOF_LONG; }
 
-    protected:
+		bool operator == (const BitVector &v) const;
 
-	std::vector<unsigned long> _v;
-	size_t              _size;
+	protected:
 
-}; // template <class Vector> class ReverseVector
+		std::vector<unsigned long> _v;
+		size_t              _size;
 
-// Vector traits for BitVector wrapper
-template <>
-struct VectorTraits<BitVector>
-{ 
-	typedef BitVector VectorType;
-	typedef VectorCategories::DenseZeroOneVectorTag VectorCategory; 
-};
+	}; // template <class Vector> class ReverseVector
+
+	// Vector traits for BitVector wrapper
+	template <>
+	struct VectorTraits<BitVector>
+	{
+		typedef BitVector VectorType;
+		typedef VectorCategories::DenseZeroOneVectorTag VectorCategory;
+	};
 
 } // namespace LinBox
 
 #include "linbox/vector/bit-vector.inl"
 
-#endif // __BIT_VECTOR_H
+#endif // __LINBOX_bit_vector_H
+
diff --git a/linbox/vector/bit-vector.inl b/linbox/vector/bit-vector.inl
index f194dcd..ae8efc5 100644
--- a/linbox/vector/bit-vector.inl
+++ b/linbox/vector/bit-vector.inl
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/vector/bit-vector.inl
  * Copyright (C) 2003 Bradford Hovinen
  *
@@ -8,15 +8,17 @@
  * See COPYING for license information.
  */
 
-#ifndef __BIT_VECTOR_INL
-#define __BIT_VECTOR_INL
+#ifndef __LINBOX_bit_vector_INL
+#define __LINBOX_bit_vector_INL
 
 #include <stdexcept>
+#include <vector>
+
 
 #include "linbox/vector/vector-traits.h"
 #include "linbox/vector/bit-vector.h"
 
-namespace std 
+namespace std
 {
 	template <>
 	struct iterator_traits<LinBox::BitVector::iterator>
@@ -42,445 +44,603 @@ namespace std
 namespace LinBox
 {
 
-class BitVector::reference
-{
-    public:
-
-	reference (std::vector<unsigned long>::iterator word, uint8 position)
-		: _word (word), _pos (position) {}
-
-	~reference () {}
+	class BitVector::reference {
+	public:
 
-	reference &operator = (reference &a) 
-		{ return *this = (bool) a; }
+		reference (std::vector<unsigned long>::iterator word, uint8_t position) :
+			_word (word), _pos (position)
+		{}
 
-	reference &operator = (bool v) 
-		{ 
-                    *_word = v ? (*_word | (1UL << _pos)) : (*_word & ~(1UL << _pos));
-                    return *this;
-}
+		~reference () {}
 
-	reference &operator &= (reference &a) 
-		{ *_word &= ~(1UL << _pos) | (a.get_bit () << (_pos - a._pos)); return *this; }
-
-	reference &operator &= (bool v) 
-		{ *_word &= ~(1UL << _pos) | (v & (1UL << _pos)); return *this; }
-
-	reference &operator |= (reference &a) 
-		{ *_word |= a.get_bit () << (_pos - a._pos); return *this; }
-
-	reference &operator |= (bool v) 
-		{ *_word |= v & (1UL << _pos); return *this; }
-
-	reference &operator ^= (reference &a) 
-		{ *_word ^= a.get_bit () << (_pos - a._pos); return *this; }
+		reference &operator = (reference &a)
+		{
+			return *this = (bool) a;
+		}
 
-	reference &operator ^= (bool v) 
-		{ *_word ^= v & (1UL << _pos); return *this; }
+		reference &operator = (bool v)
+		{
+			*_word = v ? (*_word | (1UL << _pos)) : (*_word & ~(1UL << _pos));
+			return *this;
+		}
 
-	operator bool (void) const
-		{ return (*_word >> _pos) & 1UL; return *this; }
+		reference &operator &= (reference &a)
+		{
+			*_word &= ~(1UL << _pos) | (a.get_bit () << (_pos - a._pos));
+			return *this;
+		}
 
-    private:
-	friend class iterator;
-	friend class const_iterator;
+		reference &operator &= (bool v)
+		{
+			*_word &= ~(1UL << _pos) | (v & (1UL << _pos));
+			return *this;
+		}
 
-	unsigned long neg_mask_word (void) { return *_word & ~(1UL << _pos); }
-	unsigned long get_bit ()           { return *_word & (1UL << _pos); }
+		reference &operator |= (reference &a)
+		{
+			*_word |= a.get_bit () << (_pos - a._pos);
+			return *this;
+		}
 
-	std::vector<unsigned long>::iterator _word;
-	uint8                         _pos;
-};
+		reference &operator |= (bool v)
+		{
+			*_word |= v & (1UL << _pos);
+			return *this;
+		}
 
-std::istream &operator >> (std::istream &is, BitVector::reference &a) 
-	{ bool v; is >> v; a = v; return is; }
+		reference &operator ^= (reference &a)
+		{
+			*_word ^= a.get_bit () << (_pos - a._pos);
+			return *this;
+		}
 
-std::ostream &operator << (std::ostream &os, BitVector::reference &a) 
-	{ os << bool (a); return os; }
+		reference &operator ^= (bool v)
+		{
+			*_word ^= v & (1UL << _pos);
+			return *this;
+		}
 
-class BitVector::const_reference
-{
-    public:
+		operator bool (void) const
+		{
+			return (*_word >> _pos) & 1UL;
+		}
 
-	const_reference (std::vector<unsigned long>::const_iterator word, uint8 position)
-		: _word (word), _pos (position) {}
+	private:
+		friend class iterator;
+		friend class const_iterator;
+		friend class const_reference;
 
-	~const_reference () {}
+		unsigned long neg_mask_word (void)
+		{
+			return *_word & ~(1UL << _pos);
+		}
+		unsigned long get_bit ()
+		{
+			return *_word & (1UL << _pos);
+		}
 
-	operator bool (void) const
-		{ return (*_word >> _pos) & 1UL; }
+		std::vector<unsigned long>::iterator _word;
+		uint8_t                         _pos;
+	};
 
-    private:
-	friend class const_iterator;
+	inline std::istream &operator >> (std::istream &is, BitVector::reference &a)
+	{
+		bool v;
+		is >> v;
+		a = v;
+		return is;
+	}
 
-	std::vector<unsigned long>::const_iterator _word;
-	uint8                               _pos;
-};
+	inline std::ostream &operator << (std::ostream &os, BitVector::reference &a)
+	{
+		os << bool (a);
+		return os;
+	}
 
-std::ostream &operator << (std::ostream &os, BitVector::const_reference &a) 
-	{ os << bool (a); return os; }
+	class BitVector::const_reference {
+	public:
 
-class BitVector::iterator : public std::iterator <std::random_access_iterator_tag, bool>
-{
-    public:
+		const_reference (BitVector::reference r) :
+			_word (r._word), _pos (r._pos)
+		{}
 
-	typedef std::iterator_traits<iterator>::iterator_category iterator_category;
-	typedef std::iterator_traits<iterator>::reference reference;
-	typedef std::iterator_traits<iterator>::pointer pointer;
-	typedef std::iterator_traits<iterator>::value_type value_type;
-	typedef std::iterator_traits<iterator>::difference_type difference_type;
+		const_reference (std::vector<unsigned long>::iterator word, uint8_t position) :
+			_word (word), _pos (position)
+		{}
 
-	iterator () : _ref (std::vector<unsigned long>::iterator (), 0UL) {}
-	iterator (std::vector<unsigned long>::iterator word, uint8 position) : _ref (word, position) {}
-	iterator (const iterator &i) : _ref (i._ref._word, i._ref._pos) {}
+		const_reference (std::vector<unsigned long>::const_iterator word, uint8_t position) :
+			_word (word), _pos (position)
+		{}
 
-	iterator &operator = (const iterator &i) {
-		_ref._word = i._ref._word;
-		_ref._pos = i._ref._pos;
-		return *this;
-	}
+		~const_reference () {}
 
-	iterator &operator ++ () 
-	{
-		if (++_ref._pos > __LINBOX_BITSOF_LONG_MUN) {
-			++_ref._word;
-			_ref._pos = 0UL;
+		operator bool (void) const
+		{
+			return (*_word >> _pos) & 1UL;
 		}
 
-		return *this;
-	}
-
-	iterator operator ++ (int) 
-	{
-		iterator tmp (*this);
-		++*this;
-		return tmp;
-	}
+	private:
+		friend class const_iterator;
 
-	iterator operator + (difference_type i) const
-	{
-		std::vector<unsigned long>::iterator new_word = _ref._word + (i >> __LINBOX_LOGOF_SIZE);
-		uint8 new_pos = _ref._pos + (i & __LINBOX_POS_ALL_ONES);
-
-		new_word += new_pos >> __LINBOX_LOGOF_SIZE;
-		new_pos &= __LINBOX_POS_ALL_ONES;
-
-		return iterator (new_word, new_pos);
-	}
+		std::vector<unsigned long>::const_iterator _word;
+		uint8_t                               _pos;
+	};
 
-	iterator &operator += (difference_type i) 
+	inline std::ostream &operator << (std::ostream &os, BitVector::const_reference &a)
 	{
-		_ref._word += i >> __LINBOX_LOGOF_SIZE;
-		_ref._pos  += i & __LINBOX_POS_ALL_ONES;
-		_ref._word += _ref._pos >> __LINBOX_LOGOF_SIZE;
-		_ref._pos  &= __LINBOX_POS_ALL_ONES;
-		return *this;
+		os << bool (a);
+		return os;
 	}
 
-	iterator &operator -- () 
-	{
-		if (--_ref._pos > __LINBOX_BITSOF_LONG_MUN) {
-			--_ref._word;
-			_ref._pos = __LINBOX_BITSOF_LONG_MUN;
+	// class BitVector::iterator : public std::iterator <std::random_access_iterator_tag, bool>
+	class BitVector::iterator : public std::_Bit_iterator {
+	public:
+
+		typedef std::iterator_traits<iterator>::iterator_category iterator_category;
+		typedef std::iterator_traits<iterator>::reference reference;
+		typedef std::iterator_traits<iterator>::pointer pointer;
+		typedef std::iterator_traits<iterator>::value_type value_type;
+		typedef std::iterator_traits<iterator>::difference_type difference_type;
+
+		iterator () :
+			_ref (std::vector<unsigned long>::iterator (), 0UL)
+		{}
+		iterator (std::vector<unsigned long>::iterator word, uint8_t position) :
+			_ref (word, position)
+		{}
+		iterator (const iterator &i) :
+			std::_Bit_iterator(),_ref (i._ref._word, i._ref._pos)
+		{}
+
+		iterator &operator = (const iterator &i)
+		{
+			_ref._word = i._ref._word;
+			_ref._pos = i._ref._pos;
+			return *this;
 		}
 
-		return *this;
-	}
+		iterator &operator ++ ()
+		{
+			if (++_ref._pos > __LINBOX_BITSOF_LONG_MUN) {
+				++_ref._word;
+				_ref._pos = 0UL;
+			}
 
-	iterator operator -- (int) 
-	{
-		iterator tmp (*this);
-		--*this;
-		return tmp;
-	}
+			return *this;
+		}
 
-	iterator operator - (difference_type i) const
-		{ return *this + -i; }
+		iterator operator ++ (int)
+		{
+			iterator tmp (*this);
+			++*this;
+			return tmp;
+		}
 
-	iterator &operator -= (difference_type i) 
-		{ return *this += -i; }
+		iterator operator + (difference_type i) const
+		{
+			std::vector<unsigned long>::iterator new_word = _ref._word + (i >> __LINBOX_LOGOF_SIZE);
+#ifdef __INTEL_COMPILER
+#pragma warning(disable:2259)
+#endif
+			uint8_t new_pos = _ref._pos + (uint8_t) (i & __LINBOX_POS_ALL_ONES);
+#ifdef __INTEL_COMPILER
+#pragma warning(enable:2259)
+#endif
+
+			new_word += new_pos >> __LINBOX_LOGOF_SIZE;
+			new_pos &= __LINBOX_POS_ALL_ONES;
+
+#ifndef __CUDACC__
+			return iterator (new_word, new_pos);
+#else
+			std::cout << "nvcc not happy here" << std::endl;
+			exit(-4);
+#endif
+		}
 
-	difference_type operator - (iterator &i) const 
-		{ return (_ref._word - i._ref._word) * __LINBOX_BITSOF_LONG + (_ref._pos - i._ref._pos); }
+		iterator &operator += (difference_type i)
+		{
+			_ref._word += i >> __LINBOX_LOGOF_SIZE;
+#ifdef __INTEL_COMPILER
+#pragma warning(disable:2259)
+#endif
+			_ref._pos  += (uint8_t) (i & __LINBOX_POS_ALL_ONES);
+#ifdef __INTEL_COMPILER
+#pragma warning(enable:2259)
+#endif
+			_ref._word += _ref._pos >> __LINBOX_LOGOF_SIZE;
+			_ref._pos  &= __LINBOX_POS_ALL_ONES;
+			return *this;
+		}
 
-	reference operator [] (long i) 
-		{ return *(*this + i); }
+		iterator &operator -- ()
+		{
+			if (--_ref._pos > __LINBOX_BITSOF_LONG_MUN) {
+				--_ref._word;
+				_ref._pos = __LINBOX_BITSOF_LONG_MUN;
+			}
 
-	reference operator * () 
-		{ return _ref; }
+			return *this;
+		}
 
-	bool operator == (const iterator &c) const 
-		{ return (_ref._word == c._ref._word) && (_ref._pos == c._ref._pos); }
+		iterator operator -- (int)
+		{
+			iterator tmp (*this);
+			--*this;
+			return tmp;
+		}
 
-	bool operator != (const iterator &c) const 
-		{ return (_ref._word != c._ref._word) || (_ref._pos != c._ref._pos); }
+		iterator operator - (difference_type i) const
+		{
+			return *this + -i;
+		}
 
-    private:
-	friend class const_iterator;
+		iterator &operator -= (difference_type i)
+		{
+			return *this += -i;
+		}
 
-	reference _ref;
-};
- 
-class BitVector::const_iterator : public std::iterator <std::random_access_iterator_tag, bool>
-{
-    public:
+		difference_type operator - (iterator &i) const
+		{
+			return (_ref._word - i._ref._word) * __LINBOX_BITSOF_LONG + (_ref._pos - i._ref._pos);
+		}
 
-	typedef std::iterator_traits<const_iterator>::iterator_category iterator_category;
-	typedef std::iterator_traits<const_iterator>::reference reference;
-	typedef std::iterator_traits<const_iterator>::pointer pointer;
-	typedef std::iterator_traits<const_iterator>::value_type value_type;
-	typedef std::iterator_traits<const_iterator>::difference_type difference_type;
+		reference operator [] (long i)
+		{
+			return *(*this + i);
+		}
 
-	const_iterator () : _ref (std::vector<unsigned long>::const_iterator (), 0UL) {}
-	const_iterator (std::vector<unsigned long>::const_iterator word, uint8 position) : _ref (word, position) {}
-	const_iterator (const const_iterator &i) : _ref (i._ref._word, i._ref._pos) {}
+		reference operator * ()
+		{
+			return _ref;
+		}
 
-	const_iterator &operator = (const const_iterator &i) {
-		_ref._word = i._ref._word;
-		_ref._pos = i._ref._pos;
-		return *this;
-	}
+		const_reference operator * () const
+		{
+			return _ref;
+		}
 
-	const_iterator &operator = (const iterator &i) {
-		_ref._word = i._ref._word;
-		_ref._pos = i._ref._pos;
-		return *this;
-	}
+		bool operator == (const iterator &c) const
+		{
+			return (_ref._word == c._ref._word) && (_ref._pos == c._ref._pos);
+		}
 
-	const_iterator &operator ++ () 
-	{
-		if (++_ref._pos > __LINBOX_BITSOF_LONG_MUN) {
-			++_ref._word;
-			_ref._pos = 0UL;
+		bool operator != (const iterator &c) const
+		{
+			return (_ref._word != c._ref._word) || (_ref._pos != c._ref._pos);
 		}
 
-		return *this;
-	}
+	protected:
+		friend class const_iterator;
 
-	const_iterator operator ++ (int) 
-	{
-		const_iterator tmp (*this);
-		++*this;
-		return tmp;
-	}
+		reference _ref;
+	};
 
-	const_iterator operator + (long i) const
-	{
-		std::vector<unsigned long>::const_iterator new_word = _ref._word + (i >> __LINBOX_LOGOF_SIZE);
-		uint8 new_pos = _ref._pos + (i & __LINBOX_POS_ALL_ONES);
+	class BitVector::const_iterator : public std::iterator <std::random_access_iterator_tag, bool> {
+	public:
+
+		typedef std::iterator_traits<const_iterator>::iterator_category iterator_category;
+		typedef std::iterator_traits<const_iterator>::reference const_reference;
+		typedef std::iterator_traits<const_iterator>::pointer pointer;
+		typedef std::iterator_traits<const_iterator>::value_type value_type;
+		typedef std::iterator_traits<const_iterator>::difference_type difference_type;
+		typedef BitVector::iterator iterator;
+
+		const_iterator () :
+			_ref (std::vector<unsigned long>::const_iterator (), 0UL)
+		{}
+		const_iterator (std::vector<unsigned long>::const_iterator word, uint8_t position) :
+			_ref (word, position)
+		{}
+		const_iterator (const const_iterator &i) :
+			_ref (i._ref._word, i._ref._pos)
+		{}
+
+		const_iterator &operator = (const const_iterator &i)
+		{
+			this->_ref._word = i._ref._word;
+			this->_ref._pos = i._ref._pos;
+			return *this;
+		}
 
-		new_word += new_pos >> __LINBOX_LOGOF_SIZE;
-		new_pos &= __LINBOX_POS_ALL_ONES;
+		const_iterator &operator = (const iterator &i)
+		{
+			this->_ref._word = i._ref._word;
+			this->_ref._pos = i._ref._pos;
+			return *this;
+		}
 
-		return const_iterator (new_word, new_pos);
-	}
+		const_iterator &operator ++ ()
+		{
+			if (++_ref._pos > __LINBOX_BITSOF_LONG_MUN) {
+				++_ref._word;
+				_ref._pos = 0UL;
+			}
 
-	const_iterator &operator += (long i) 
-	{
-		_ref._word += i >> __LINBOX_LOGOF_SIZE;
-		_ref._pos  += i & __LINBOX_POS_ALL_ONES;
-		_ref._word += _ref._pos >> __LINBOX_LOGOF_SIZE;
-		_ref._pos  &= __LINBOX_POS_ALL_ONES;
-		return *this;
-	}
+			return *this;
+		}
 
-	const_iterator &operator -- () 
-	{
-		if (--_ref._pos > __LINBOX_BITSOF_LONG_MUN) {
-			--_ref._word;
-			_ref._pos = __LINBOX_BITSOF_LONG_MUN;
+		const_iterator operator ++ (int)
+		{
+			const_iterator tmp (*this);
+			++*this;
+			return tmp;
 		}
 
-		return *this;
-	}
+		const_iterator operator + (long i) const
+		{
+			std::vector<unsigned long>::const_iterator new_word = _ref._word + (i >> __LINBOX_LOGOF_SIZE);
+#ifdef __INTEL_COMPILER
+#pragma warning(disable:2259)
+#endif
+			uint8_t new_pos = _ref._pos + (uint8_t) (i & __LINBOX_POS_ALL_ONES);
+#ifdef __INTEL_COMPILER
+#pragma warning(enable:2259)
+#endif
+			new_word += new_pos >> __LINBOX_LOGOF_SIZE;
+			new_pos &= __LINBOX_POS_ALL_ONES;
+
+			return const_iterator (new_word, new_pos);
+		}
 
-	const_iterator operator -- (int) 
-	{
-		const_iterator tmp (*this);
-		--*this;
-		return tmp;
-	}
+		const_iterator &operator += (long i)
+		{
+			_ref._word += i >> __LINBOX_LOGOF_SIZE;
+#ifdef __INTEL_COMPILER
+#pragma warning(disable:2259)
+#endif
+			_ref._pos  += (uint8_t) (i & __LINBOX_POS_ALL_ONES);
+#ifdef __INTEL_COMPILER
+#pragma warning(enable:2259)
+#endif
+			_ref._word += _ref._pos >> __LINBOX_LOGOF_SIZE;
+			_ref._pos  &= __LINBOX_POS_ALL_ONES;
+			return *this;
+		}
 
-	const_iterator operator - (difference_type i) const 
-		{ return *this + -i; }
+		const_iterator &operator -- ()
+		{
+			if (--_ref._pos > __LINBOX_BITSOF_LONG_MUN) {
+				--_ref._word;
+				_ref._pos = __LINBOX_BITSOF_LONG_MUN;
+			}
 
-	const_iterator &operator -= (difference_type i) 
-		{ return *this += -i; }
+			return *this;
+		}
 
-	difference_type operator - (const_iterator &i) const 
-		{ return (_ref._word - i._ref._word) * __LINBOX_BITSOF_LONG + (_ref._pos - i._ref._pos); }
+		const_iterator operator -- (int)
+		{
+			const_iterator tmp (*this);
+			--*this;
+			return tmp;
+		}
 
-	reference operator [] (difference_type i) const
-		{ return *(*this + i); }
+		const_iterator operator - (difference_type i) const
+		{
+			return *this + -i;
+		}
 
-	reference operator * () const
-		{ return _ref; }
+		const_iterator &operator -= (difference_type i)
+		{
+			return *this += -i;
+		}
 
-	bool operator == (const const_iterator &c) const 
-		{ return (_ref._word == c._ref._word) && (_ref._pos == c._ref._pos); }
+		difference_type operator - (const_iterator &i) const
+		{
+			return (_ref._word - i._ref._word) * __LINBOX_BITSOF_LONG + (_ref._pos - i._ref._pos);
+		}
 
-	bool operator == (const iterator &c) const 
-		{ return (_ref._word == c._ref._word) && (_ref._pos == c._ref._pos); }
+		const_reference operator [] (difference_type i) const
+		{
+			return *(*this + i);
+		}
 
-	bool operator != (const const_iterator &c) const 
-		{ return (_ref._word != c._ref._word) || (_ref._pos != c._ref._pos); }
+		const_reference operator * () const
+		{
+			return _ref;
+		}
 
-	bool operator != (const iterator &c) const 
-		{ return (_ref._word != c._ref._word) || (_ref._pos != c._ref._pos); }
+		bool operator == (const const_iterator &c) const
+		{
+			return (_ref._word == c._ref._word) && (_ref._pos == c._ref._pos);
+		}
 
-    private:
+		bool operator == (const BitVector::iterator &c) const
+		{
+			return (this->_ref._word == c._ref._word) && (this->_ref._pos == c._ref._pos);
+		}
 
-	const_reference _ref;
-};
+		bool operator != (const const_iterator &c) const
+		{
+			return (_ref._word != c._ref._word) || (_ref._pos != c._ref._pos);
+		}
 
-inline BitVector::iterator BitVector::begin (void)
-	{ return iterator (_v.begin (), 0UL); }
+		bool operator != (const BitVector::iterator &c) const
+		{
+			return (_ref._word != c._ref._word) || (_ref._pos != c._ref._pos);
+		}
 
-inline BitVector::const_iterator BitVector::begin (void) const
-	{ return const_iterator (_v.begin (), 0UL); }
+	protected:
 
-inline BitVector::iterator BitVector::end (void)
-{
-	if ((_size & __LINBOX_POS_ALL_ONES) == 0UL)
-		return iterator (_v.end (), 0UL);
-	else
-		return iterator (_v.end () - 1UL, _size & __LINBOX_POS_ALL_ONES);
-}
+		const_reference _ref;
+	};
 
-inline BitVector::const_iterator BitVector::end (void) const
-{
-	if ((_size & __LINBOX_POS_ALL_ONES) == 0UL)
-		return const_iterator (_v.end (), 0UL);
-	else
-		return const_iterator (_v.end () - 1UL, _size & __LINBOX_POS_ALL_ONES);
-}
+	inline BitVector::iterator BitVector::begin (void)
+	{
+		return iterator (_v.begin (), 0UL);
+	}
 
-inline BitVector::reverse_iterator BitVector::rbegin (void)
-	{ return reverse_iterator (end () - 1UL); }
+	inline BitVector::const_iterator BitVector::begin (void) const
+	{
+		return const_iterator (_v.begin (), 0UL);
+	}
 
-inline BitVector::const_reverse_iterator BitVector::rbegin (void) const
-	{ return const_reverse_iterator (end () - 1UL); }
+	inline BitVector::iterator BitVector::end (void)
+	{
+		if ((_size & __LINBOX_POS_ALL_ONES) == 0UL)
+			return iterator (_v.end (), 0UL);
+		else
+			return iterator (_v.end () - 1UL, _size & __LINBOX_POS_ALL_ONES);
+	}
 
-inline BitVector::reverse_iterator BitVector::rend (void)
-	{ return reverse_iterator (begin () - 1UL); }
+	inline BitVector::const_iterator BitVector::end (void) const
+	{
+		if ((_size & __LINBOX_POS_ALL_ONES) == 0UL)
+			return const_iterator (_v.end (), 0UL);
+		else
+			return const_iterator (_v.end () - 1UL, _size & __LINBOX_POS_ALL_ONES);
+	}
 
-inline BitVector::const_reverse_iterator BitVector::rend (void) const
-	{ return const_reverse_iterator (begin () - 1UL); }
+	inline BitVector::reverse_iterator BitVector::rbegin (void)
+	{
+		return reverse_iterator (end () - 1UL);
+	}
 
-inline BitVector::reference BitVector::operator[] (BitVector::size_type n)
-	{ return *(begin () + n); }
+	inline BitVector::const_reverse_iterator BitVector::rbegin (void) const
+	{
+		return const_reverse_iterator (end () - 1UL);
+	}
 
-inline BitVector::const_reference BitVector::operator[] (BitVector::size_type n) const
-	{ return *(begin () + n); }
+	inline BitVector::reverse_iterator BitVector::rend (void)
+	{
+		return reverse_iterator (begin () - 1UL);
+	}
 
-BitVector::reference BitVector::at (BitVector::size_type n)
-{
-	if (n >= _size)
-		throw std::out_of_range ("LinBox::BitVector");
-	else
-		return (*this)[n];
-}
+	inline BitVector::const_reverse_iterator BitVector::rend (void) const
+	{
+		return const_reverse_iterator (begin () - 1UL);
+	}
 
-BitVector::const_reference BitVector::at (BitVector::size_type n) const
-{
-	if (n >= _size)
-		throw std::out_of_range ("LinBox::BitVector");
-	else
-		return (*this)[n];
-}
+	inline BitVector::reference BitVector::operator[] (BitVector::size_type n)
+	{
+		return *(begin () + n);
+	}
 
-inline BitVector::reference BitVector::front (void)
-	{ return reference (_v.begin (), 0UL); }
+	inline BitVector::const_reference BitVector::operator[] (BitVector::size_type n) const
+	{
+		return *(begin () + n);
+	}
 
-inline BitVector::const_reference BitVector::front (void) const
-	{ return const_reference (_v.begin (), 0UL); }
+	inline BitVector::reference BitVector::at (BitVector::size_type n)
+	{
+		if (n >= _size)
+			throw std::out_of_range ("LinBox::BitVector");
+		else
+			return (*this)[n];
+	}
 
-inline BitVector::reference BitVector::back (void)
-{
-	if ( (_size & __LINBOX_POS_ALL_ONES) == 0UL)
-		return reference (_v.end (), 0UL);
-	else
-		return reference (_v.end () - 1UL, _size & __LINBOX_POS_ALL_ONES);
-}
+	inline BitVector::const_reference BitVector::at (BitVector::size_type n) const
+	{
+		if (n >= _size)
+			throw std::out_of_range ("LinBox::BitVector");
+		else
+			return (*this)[n];
+	}
 
-inline BitVector::const_reference BitVector::back (void) const
-{
-	if ( (_size & __LINBOX_POS_ALL_ONES) == 0UL)
-		return const_reference (_v.end (), 0UL);
-	else
-		return const_reference (_v.end () - 1UL, _size & __LINBOX_POS_ALL_ONES);
-}
+	inline BitVector::reference BitVector::front (void)
+	{
+		return reference (_v.begin (), 0UL);
+	}
 
-template<class Container>
-BitVector &BitVector::operator = (const Container &v)
-{
-	typename Container::const_iterator i;
-	typename Container::const_iterator i_end = v.begin () + (v.size () >> __LINBOX_LOGOF_SIZE);
-	std::vector<unsigned long>::iterator j;
-	unsigned long idx;
+	inline BitVector::const_reference BitVector::front (void) const
+	{
+		return const_reference (_v.begin (), 0UL);
+	}
 
-	_v.resize ((v.size () >> __LINBOX_LOGOF_SIZE) + ((v.size () & __LINBOX_POS_ALL_ONES) ? 1UL : 0UL));
+	inline BitVector::reference BitVector::back (void)
+	{
+		if ( (_size & __LINBOX_POS_ALL_ONES) == 0UL)
+			return reference (_v.end (), 0UL);
+		else
+			return reference (_v.end () - 1UL, _size & __LINBOX_POS_ALL_ONES);
+	}
 
-	for (j = _v.begin (); i != i_end; ++j) {
-		*j = 0UL;
-		for (idx = 0UL; idx < __LINBOX_BITSOF_LONG; ++idx, ++i) {
-			*j <<= 1UL;
-			*j |= *i & 1UL;
-		}
+	inline BitVector::const_reference BitVector::back (void) const
+	{
+		if ( (_size & __LINBOX_POS_ALL_ONES) == 0UL)
+			return const_reference (_v.end (), 0UL);
+		else
+			return const_reference (_v.end () - 1UL, _size & __LINBOX_POS_ALL_ONES);
 	}
 
-	if (v.size () & __LINBOX_POS_ALL_ONES) {
-		*j = 0UL;
+	template<class Container>
+	inline BitVector &BitVector::operator = (const Container &v)
+	{
+		typename Container::const_iterator i;
+		typename Container::const_iterator i_end = v.begin () + (v.size () >> __LINBOX_LOGOF_SIZE);
+		std::vector<unsigned long>::iterator j;
+		unsigned long idx;
+
+		_v.resize ((v.size () >> __LINBOX_LOGOF_SIZE) + ((v.size () & __LINBOX_POS_ALL_ONES) ? 1UL : 0UL));
+
+		for (j = _v.begin (); i != i_end; ++j) {
+			*j = 0UL;
+			for (idx = 0UL; idx < __LINBOX_BITSOF_LONG; ++idx, ++i) {
+				*j <<= 1UL;
+				*j |= *i & 1UL;
+			}
+		}
+
+		if (v.size () & __LINBOX_POS_ALL_ONES) {
+			*j = 0UL;
 
-		for (idx = 0UL; idx < (v.size () & __LINBOX_POS_ALL_ONES); ++idx) {
-			*j <<= 1UL;
-			*j |= *i & 1UL;
+			for (idx = 0UL; idx < (v.size () & __LINBOX_POS_ALL_ONES); ++idx) {
+				*j <<= 1UL;
+				*j |= *i & 1UL;
+			}
 		}
-	}
 
-	_size = v.size ();
+		_size = v.size ();
 
-	return *this;
-}
+		return *this;
+	}
 
-void BitVector::resize (BitVector::size_type new_size, bool val)
-	{_v.resize ((new_size >> __LINBOX_LOGOF_SIZE) + ((new_size & __LINBOX_POS_ALL_ONES) ? 1UL : 0UL), val ? __LINBOX_ALL_ONES : 0UL); _size = new_size; }
+	inline void BitVector::resize (BitVector::size_type new_size, bool val)
+	{
+		_v.resize ((new_size >> __LINBOX_LOGOF_SIZE) + ((new_size & __LINBOX_POS_ALL_ONES) ? 1UL : 0UL), val ? __LINBOX_ALL_ONES : 0UL);
+		_size = new_size;
+	}
 
-bool BitVector::operator == (const BitVector &v) const
-{
-	const_word_iterator i, j;
-	unsigned long mask;
+	inline bool BitVector::operator == (const BitVector &v) const
+	{
+		const_word_iterator i, j;
+		unsigned long mask;
 
-	if (_size != v._size) return false;
+		if (_size != v._size) return false;
 
-	for (i = wordBegin (), j = v.wordBegin (); i != wordEnd () - 1UL; ++i, ++j)
-		if (*i != *j) return false;
+		for (i = wordBegin (), j = v.wordBegin (); i != wordEnd () - 1UL; ++i, ++j)
+			if (*i != *j) return false;
 
-	mask = (1UL << (_size & (8 * sizeof (unsigned long) - 1UL))) - 1UL;
-	if (mask == 0UL) mask = (unsigned long) -1UL;
+		mask = (1UL << (_size & (8 * sizeof (unsigned long) - 1UL))) - 1UL;
+		if (mask == 0UL) mask = (unsigned long) -1UL;
 
-	if ((*i & mask) == (*j & mask))
-		return true;
-	else
-		return false;
-}
+		if ((*i & mask) == (*j & mask))
+			return true;
+		else
+			return false;
+	}
 
-/* 
-namespace VectorWrapper 
-{
-	template <class Field, class Vector, class Trait>
-	inline BitVector::reference refSpecialized
+#if 0
+	namespace VectorWrapper
+	{
+		template <class Field, class Vector, class Trait>
+		inline BitVector::reference refSpecialized
 		(Vector &v, size_t i, VectorCategories::DenseZeroOneVectorTag<Trait>)
-	{ return v[i]; }
+		{
+			return v[i];
+		}
 
-	template <class Field, class Vector, class Trait>
-	inline BitVector::const_reference constRefSpecialized
+		template <class Field, class Vector, class Trait>
+		inline BitVector::const_reference constRefSpecialized
 		(const Vector &v, size_t i, VectorCategories::DenseZeroOneVectorTag<Trait>)
-	{ return v[i]; }
+		{
+			return v[i];
+		}
 
-}
-*/
+	}
+#endif
 
 } // namespace LinBox
 
-#endif // __BIT_VECTOR_INL
+#endif // __LINBOX_bit_vector_INL
+
diff --git a/linbox/vector/light_container.h b/linbox/vector/light_container.h
new file mode 100644
index 0000000..0316877
--- /dev/null
+++ b/linbox/vector/light_container.h
@@ -0,0 +1,341 @@
+/* -*- 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
+/* Copyright (C) 2010 LinBox
+ * Written by JG Dumas <Jean-Guillaume.Dumas at imag.fr>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+// =================================================================== //
+// LightContainer : std::vector like container
+// =================================================================== //
+
+#ifndef __LINBOX_light_vector_container_H
+#define __LINBOX_light_vector_container_H
+
+#include <iostream>
+#include <cstdlib>
+#include "linbox/util/contracts.h"
+#include "linbox/vector/vector-traits.h"
+
+
+namespace LinBox
+{
+
+	template<typename Elem> struct LightContainer {
+	private:
+		typedef LightContainer<Elem> Self_t;
+		size_t allocated;
+		Elem * _container;
+		Elem * _finish;
+	public:
+		typedef Elem value_type;
+		typedef Elem* iterator;
+		typedef const Elem* const_iterator;
+
+		LightContainer() :
+			allocated(2), _container(new Elem[allocated]), _finish(_container)
+		{
+			ENSURE( (allocated == 2) && (size() == 0) );
+
+		}
+		LightContainer(size_t s) :
+			allocated(s), _container(new Elem[s]), _finish(_container+s)
+		{
+
+			ENSURE( (allocated == s) && (size() == s) );
+			ENSURE( allocated >= size() );
+
+		}
+
+		Self_t& operator=(const Self_t& v)
+		{
+			this->resize(v.size());
+			const_iterator vit = v.begin();
+			for(iterator tit = begin(); tit != end(); ++tit, ++vit)
+				*tit = *vit;
+			return *this;
+		}
+
+		LightContainer(const Self_t& v) :
+			allocated(v.allocated)
+		{
+			_container = new Elem[allocated];
+			_finish = _container +v.size();
+			const_iterator vit = v.begin();
+			for(iterator tit = begin(); tit != end(); ++tit, ++vit)
+				*tit = *vit;
+		}
+
+		void reserve(size_t s)
+		{
+			STATE( size_t oldsize = size() );
+			reallocate(s, size() );
+			ENSURE( (allocated >= s) && (size() == oldsize) && ( allocated >= size() ) );
+		}
+
+		size_t size() const
+		{
+			return size_t(_finish - _container);
+		}
+
+		Elem& operator[](size_t i)
+		{
+			REQUIRE( (i >= 0) && (i < allocated) && (i < size()) );
+			return _container[i];
+		}
+
+		const Elem& operator[](size_t i) const
+		{
+			REQUIRE( (i >= 0) && (i < allocated) && (i < size()) );
+			return _container[i];
+		}
+
+		void clear()
+		{
+			_finish = _container;
+			ENSURE( (size() == 0) );
+
+		}
+		void resize(size_t s)
+		{
+			if (s>allocated) reallocate( s+(s>>1), s );
+			else _finish = _container + s;
+			ENSURE( allocated >= size() );
+		}
+		iterator begin() { return _container; }
+		iterator end() { return _finish; }
+		const_iterator begin() const { return const_iterator(_container); }
+		const_iterator end() const { return const_iterator(_finish); }
+		Elem& front() { return *_container; }
+		const Elem& front() const { return *_container; }
+		Elem& back() { return *(_finish-1); }
+		const Elem& back() const { return *(_finish-1); }
+
+		void push_back(const Elem& c)
+		{
+			STATE( size_t  oldsize = size() );
+			if (size() == allocated) reserve(allocated+(allocated>>1));
+			*(_finish) = c; ++_finish;
+
+			ENSURE( size() == (oldsize+1) );
+			ENSURE( allocated >= size() );
+		}
+		void pop_back()
+		{
+			STATE( size_t  oldsize = size() );
+			REQUIRE( oldsize >= 1 );
+			--_finish;
+			ENSURE( size() == (oldsize-1) );
+			ENSURE( allocated >= size() );
+		}
+
+		~LightContainer() { delete[] _container; }
+
+
+		iterator insert(iterator pos, const Elem& c)
+		{
+			REQUIRE( (pos-begin()) <= (end()-begin()) );
+			REQUIRE( (pos-begin()) >= 0 );
+			STATE( size_t oldsize = size() );
+			iterator newpos;
+			if (pos == _finish) {
+				push_back(c);
+				newpos = _finish-1;
+			}
+			else {
+				if (allocated > size())
+					newpos = insertwithspace(pos,c);
+				else
+					newpos = insertwithrealloc(pos,c);
+			}
+			ENSURE( size() == oldsize+1 );
+			ENSURE( allocated >= size() );
+			return newpos;
+		}
+
+		iterator insert(iterator pos, const_iterator beg, const_iterator end)
+		{
+			REQUIRE( (pos-begin()) <= (end()-begin()) );
+			REQUIRE( (pos-begin()) >= 0 );
+			if (pos == _finish) {
+				for(const_iterator iter=beg; iter != end; ++iter)
+					push_back(*iter);
+			}
+			else {
+				for(const_iterator iter=beg; iter != end; ++iter)
+					insert(pos, *iter);
+			}
+			ENSURE( allocated >= size() );
+			return pos;
+		}
+
+
+		iterator erase(iterator pos)
+		{
+			REQUIRE( (pos-begin()) < (end()-begin()) );
+			REQUIRE( (pos-begin()) >= 0 );
+			STATE( size_t oldsize = size() );
+			iterator ppos=pos+1;
+			if ( ppos == _finish) {
+				pop_back();
+			}
+			else {
+				*(pos)=*(ppos);
+				erase(ppos);
+			}
+			ENSURE( size() == oldsize-1 );
+			ENSURE( allocated >= size() );
+			ENSURE( _finish >= _container );
+			return pos;
+		}
+
+		iterator erase(iterator first, iterator last)
+		{
+			REQUIRE( (first-begin()) < (end()-begin()) );
+			REQUIRE( (last-begin()) <= (end()-begin()) );
+			REQUIRE( (last-first) > 0 );
+			REQUIRE( (first-begin()) >= 0 );
+			STATE( size_t oldsize = size() );
+			const size_t lmf = last-first;
+			if ( last == _finish) {
+				for(size_t i=0; i<lmf; ++i) pop_back();
+			}
+			else {
+				iterator nf(first), nl(last);
+				for( ; (nf != last) && (nl != _finish); ++nf, ++nl)
+					*(nf) = *(nl);
+				erase(nf,nl);
+			}
+			ENSURE( size() == oldsize-lmf );
+			ENSURE( allocated >= size() );
+			ENSURE( _finish >= _container );
+			return first;
+		}
+
+#if 0
+		friend std::ostream& operator<< (std::ostream& o, const Self_t& C) {
+			o << '[';
+			const_iterator refs =  C.begin();
+			for( ; refs != (C.end()-1) ; ++refs )
+				o << (*refs) << ',';
+			return o << (*refs) << ']';
+		}
+		friend std::ostream& operator<< (std::ostream& o, const Self_t& C) {
+			o << '[';
+			for(size_t i=0; i<(C.size()-1); ++i)
+				o << C[i] << ',';
+			return o << C[C.size()-1] << ']';
+		}
+#endif
+
+		friend std::ostream& operator<< (std::ostream& o, const Self_t& C)
+		{
+			o << '[';
+			for(const_iterator refs =  C.begin(); refs != C.end() ; ++refs )
+				o << (*refs) << ',';
+			return o << ']';
+		}
+
+
+
+	protected:
+		void reallocate(size_t s, size_t endc)
+		{
+			REQUIRE( (s >= endc) );
+			if (allocated < s) {
+				Elem * futur = new Elem[s];
+				for(size_t i=0; (i<s) && (i < allocated); ++i)
+					futur[i] = _container[i];
+				size_t olds = size();
+				delete [] _container;
+				_container = futur;
+				_finish = _container + olds;
+				allocated = s;
+			}
+			_finish = _container + endc;
+			ENSURE( allocated >= size() );
+		}
+
+		iterator insertwithspace(iterator pos, const Elem& c)
+		{
+			STATE( size_t oldsize = size() );
+			STATE( size_t oldalloc = allocated );
+			REQUIRE( (size()+1) <= allocated );
+			REQUIRE( (pos-begin()) <= (end()-begin()) );
+			REQUIRE( (pos-begin()) >= 0 );
+			if (pos == _finish) {
+				push_back(c);
+			}
+			else {
+				insertwithspace(pos+1, *(pos));
+				*(pos) = c;
+			}
+			ENSURE( size() == oldsize+1 );
+			ENSURE( allocated >= size() );
+			ENSURE( allocated == oldalloc );
+			return pos;
+		}
+
+		iterator insertwithrealloc(iterator pos, const Elem& c)
+		{
+			REQUIRE( (pos-begin()) <= (end()-begin()) );
+			REQUIRE( (pos-begin()) >= 0 );
+			allocated += (allocated>>1);
+			Elem * futur = new Elem[allocated];
+			iterator newcont = futur;
+			iterator oldcont=_container;
+			for( ; oldcont != pos; ++oldcont,++newcont)
+				*newcont = *oldcont;
+			*newcont = c;
+			iterator newpos = newcont;
+			for(++newcont ; oldcont != _finish; ++oldcont,++newcont)
+				*newcont = *oldcont;
+			size_t olds = size();
+			delete [] _container;
+			_container = futur;
+			_finish = _container + (++olds);
+			ENSURE( allocated >= size() );
+			return newpos;
+		}
+
+
+
+	};
+
+
+	// Specialization for LightContainer
+	template <class Element>
+	struct VectorTraits< LightContainer<Element> > {
+		typedef LightContainer<Element> VectorType;
+		typedef typename VectorCategories::DenseVectorTag VectorCategory;
+	};
+
+	// Specialization for LightContainer of pairs of size_t and elements
+	template <class Element>
+	struct VectorTraits< LightContainer< std::pair<size_t, Element> > > {
+		typedef LightContainer< std::pair<size_t, Element> > VectorType;
+		typedef typename VectorCategories::SparseSequenceVectorTag VectorCategory;
+
+		static void sort (VectorType& v) { std::stable_sort(v.begin(), v.end(), SparseSequenceVectorPairLessThan<Element>()); }
+	};
+
+} // namespace LinBox
+
+#endif //__LINBOX_light_vector_container_H
+
diff --git a/linbox/vector/pair.h b/linbox/vector/pair.h
index c7de40d..9839430 100644
--- a/linbox/vector/pair.h
+++ b/linbox/vector/pair.h
@@ -1,76 +1,104 @@
-// ======================================================================= // (C) Linbox 2000
+/* -*- 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
+/* Copyright (C) 2010 LinBox
+ * Written by JG Dumas <Jean-Guillaume.Dumas at imag.fr>
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
 // Pair of I and T : struct { column index, value }
-// Time-stamp: <19 Sep 03 11:00:25 Jean-Guillaume.Dumas at imag.fr> 
-// ======================================================================= 
-#ifndef _LIN_PAIR_H_
-#define _LIN_PAIR_H_
+// =======================================================================
+#ifndef __LINBOX_pair_H
+#define __LINBOX_pair_H
 #include <iostream>
 
 // ---------------------------------------------------
 //
 /// Pair of I and T : struct { column index, value }
-template<class T, class I = unsigned long> class Pair {
+template<class I, class T> class Pair {
 public:
-    typedef Pair<T, I> Self_t;
-    typedef T                      Type_t;
-
-//    ~Pair() {};
-    Pair() {};
-
-    Pair(const I jj, const T& val) :_j(jj),_value(val){};
-    Pair(const Self_t& p) :_j(p._j),_value(p._value){};
-
-
-    T getvalue() const { return _value; };
-
-    I getindex() const { return _j; };
-    I j() const { return _j; };
-    
-    T affect(const T& val) { return _value = val; };
-    T change_value(const T& val) { return _value = val; };
-   
-    I change_j(const I jj) { return _j = jj; };      
-    I change_index(const I jj) { return _j = jj; };      
-            
-            
-    Self_t assign(const T& val) {
-        _value = val;
-        return *this;
-    };      
-            
-    Self_t assign(const I jj, const T& val) {
-        _value = val;
-        _j = jj;
-        return *this;
-    };      
-            
-    I decr() { return --_j; };      
-    I operator--() { return --_j; };      
-    I operator--(int) { return _j--; };      
-    I incr() { return ++_j; };      
-    I operator++() { return ++_j; };      
-    I operator++(int) { return _j++; };      
-            
-    friend inline std::istream& operator>> (std::istream& is, Pair<T, I>& a) {
-        I jj;
-        T val;
-        is >> jj >> val;
-        a._value=val; a._j=jj;
-//         a = Pair<T, I>(jj,val);
-        return is;
-};
-    
-    friend inline std::ostream& operator<< (std::ostream& o, const Pair<T, I> a){
-//         return o << a.j() << " " << a.getvalue()  ;
-        return o << a._j << " " << a._value ;
-};
-    
+	typedef Pair<I, T> Self_t;
+	typedef T                      Type_t;
+	typedef I                      first_type;
+	typedef T                      second_type;
+
+	//    ~Pair() {};
+	Pair() {};
+
+	Pair(const I jj, const T& val) :
+		first(jj),second(val)
+	{};
+	Pair(const Self_t& p) :
+		first(p.first),second(p.second)
+	{};
+
+
+	T getvalue() const { return second; };
+
+	I getindex() const { return first; };
+	I j() const { return first; };
+
+	T affect(const T& val) { return second = val; };
+	T change_value(const T& val) { return second = val; };
+
+	I change_j(const I jj) { return first = jj; };
+	I change_index(const I jj) { return first = jj; };
 
-private:
-    I _j;
-    T _value;
+
+	Self_t assign(const T& val)
+	{
+		second = val;
+		return *this;
+	};
+
+	Self_t assign(const I jj, const T& val)
+	{
+		second = val;
+		first = jj;
+		return *this;
+	};
+
+	I decr() { return --first; };
+	I operator--() { return --first; };
+	I operator--(int) { return first--; };
+	I incr() { return ++first; };
+	I operator++() { return ++first; };
+	I operator++(int) { return first++; };
+
+	friend inline std::istream& operator>> (std::istream& is, Pair<I, T>& a)
+	{
+		is >> a.first >> a.second;
+		return is;
+
+	}
+
+	friend inline std::ostream& operator<< (std::ostream& o, const Pair<I, T> a)
+	{
+		return o << a.first << " " << a.second ;
+	}
+
+
+public:
+	I first;
+	T second;
 };
 
 
 
-#endif // _LIN_PAIR_H_
+#endif // __LINBOX_pair_H
+
diff --git a/linbox/vector/random.h b/linbox/vector/random.h
index 749ed05..813fc6b 100644
--- a/linbox/vector/random.h
+++ b/linbox/vector/random.h
@@ -1,3 +1,5 @@
+/* -*- 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
 /* tests/test-sparse0.C	(Formerly test-sparse-matrix.C)
  * Copyright (C) 2002 William J. Turner
  *
@@ -8,14 +10,14 @@
  *
  * Added parametrization of VectorCategory tags by VectorTraits. See
  * vector-traits.h for more details.
- *  
+ *
  * ------------------------------------
  *
  * See COPYING for lincense information.
  */
 
-#ifndef __VECTOR_RANDOM_H
-#define __VECTOR_RANDOM_H
+#ifndef __LINBOX_vector_random_H
+#define __LINBOX_vector_random_H
 
 #include <utility>
 #include "linbox/integer.h"
@@ -43,18 +45,18 @@ namespace LinBox
 	 \ingroup vector
 	 */
 	template <class Field, class Vector>
-		inline
-		Vector
-		randomVector(Field& F, size_t n, typename Field::RandIter& r)
-		{ 
-			return 
-				randomVector<Field, Vector>(
-						F, 
-						n, 
-						r, 
-						VectorTraits<Vector>::VectorCategory()
-						); 
-		}
+	inline
+	Vector
+	randomVector(Field& F, size_t n, typename Field::RandIter& r)
+	{
+		return
+		randomVector<Field, Vector>(
+					    F,
+					    n,
+					    r,
+					    VectorTraits<Vector>::VectorCategory()
+					   );
+	}
 
 	/* Random dense vector generator
 	 * This templated function takes a field and a random field element
@@ -69,28 +71,28 @@ namespace LinBox
 	 * @param tag	category of vector obtained from vector trait
 	 */
 	template <class Field, class Vector, class VectorTrait>
-		inline
-		Vector
-		randomVector(
-				Field& F, 
-				size_t n,
-				typename Field::RandIter& r,
-				VectorCategories::DenseVectorTag<VectorTrait> tag
-				)
-		{
+	inline
+	Vector
+	randomVector(
+		     Field& F,
+		     size_t n,
+		     typename Field::RandIter& r,
+		     VectorCategories::DenseVectorTag<VectorTrait> tag
+		    )
+	{
 #ifdef TRACE
-			cout << "Called dense random vector" << endl;
+		cout << "Called dense random vector" << endl;
 #endif // TRACE
 
-			Vector v(n);
-			typename Vector::iterator iter;
+		Vector v(n);
+		typename Vector::iterator iter;
+
+		for (iter = v.begin(); iter != v.end(); iter++)
+			r.random(*iter);
 
-			for (iter = v.begin(); iter != v.end(); iter++)
-				r.random(*iter);
+		return v;
 
-			return v;
-  
-		} // randomVector(F, r, VectorCategories::DenseVectorTag& tag)
+	} // randomVector(F, r, VectorCategories::DenseVectorTag& tag)
 
 	/* Random sparse sequence vector generator
 	 * This templated function takes a field and a random field element
@@ -105,37 +107,37 @@ namespace LinBox
 	 * @param tag	category of vector obtained from vector trait
 	 */
 	template <class Field, class Vector, class VectorTrait>
-		inline
-		Vector
-		randomVector(
-				Field& F, 
-				size_t n,
-				typename Field::RandIter& r,
-				VectorCategories::SparseSequenceVectorTag<VectorTrait> tag
-				)
-		{
+	inline
+	Vector
+	randomVector(
+		     Field& F,
+		     size_t n,
+		     typename Field::RandIter& r,
+		     VectorCategories::SparseSequenceVectorTag<VectorTrait> tag
+		    )
+	{
 #ifdef TRACE
-			cout << "Called sparse sequence random vector" << endl
-				<< "   return vector v = " << endl;
+		cout << "Called sparse sequence random vector" << endl
+		<< "   return vector v = " << endl;
 #endif // TRACE
 
-			Vector v(n);
-			typename Vector::iterator iter;
-			size_t i = 0;
-			for (iter = v.begin(); iter != v.end(); iter++, i++)
-			{
-				iter->first = i;
-				r.random(iter->second);
+		Vector v(n);
+		typename Vector::iterator iter;
+		size_t i = 0;
+		for (iter = v.begin(); iter != v.end(); iter++, i++)
+		{
+			iter->first = i;
+			r.random(iter->second);
 #ifdef TRACE
-				cout << "      v[" << iter->first << "] = ";
-				F.write(cout, iter->second);
-				cout << endl;
+			cout << "      v[" << iter->first << "] = ";
+			F.write(cout, iter->second);
+			cout << endl;
 #endif // TRACE
-			}
+		}
 
-			return v;
-  
-		} // randomVector(F, r, VectorCategories::SparseSequenceVectorTag& tag)
+		return v;
+
+	} // randomVector(F, r, VectorCategories::SparseSequenceVectorTag& tag)
 
 	/* Random sparse associative vector generator
 	 * This templated function takes a field and a random field element
@@ -150,38 +152,39 @@ namespace LinBox
 	 * @param tag	category of vector obtained from vector trait
 	 */
 	template <class Field, class Vector, class VectorTrait>
-		inline
-		Vector
-		randomVector(
-				Field& F, 
-				size_t n,
-				typename Field::RandIter& r,
-				VectorCategories::SparseAssociativeVectorTag<VectorTrait> tag
-				)
-		{
+	inline
+	Vector
+	randomVector(
+		     Field& F,
+		     size_t n,
+		     typename Field::RandIter& r,
+		     VectorCategories::SparseAssociativeVectorTag<VectorTrait> tag
+		    )
+	{
 #ifdef TRACE
-			cout << "Called sparse associative random vector" << endl
-				<< "   return vector v = " << endl;
+		cout << "Called sparse associative random vector" << endl
+		<< "   return vector v = " << endl;
 #endif // TRACE
 
-			Vector v;
-			typename Field::Element temp;
-			
-			for (size_t i = 0; i < size_t(n); i++)
-			{
-				r.random(temp);
-				v.insert(make_pair(i, temp));
+		Vector v;
+		typename Field::Element temp;
+
+		for (size_t i = 0; i < size_t(n); i++)
+		{
+			r.random(temp);
+			v.insert(make_pair(i, temp));
 #ifdef TRACE
-				cout << "      v[" << i << "] = ";
-				F.write(cout, v[i]);
-				cout << endl;
+			cout << "      v[" << i << "] = ";
+			F.write(cout, v[i]);
+			cout << endl;
 #endif // TRACE
-			}
+		}
+
+		return v;
 
-			return v;
-  
-		} // randomVector(F, r, VectorCategories::SparseAssociativeVectorTag& tag)
+	} // randomVector(F, r, VectorCategories::SparseAssociativeVectorTag& tag)
 
 }
 
-#endif // __VECTOR_RANDOM_H
+#endif // __LINBOX_vector_random_H
+
diff --git a/linbox/vector/reverse.h b/linbox/vector/reverse.h
index 9723c4d..76d2674 100644
--- a/linbox/vector/reverse.h
+++ b/linbox/vector/reverse.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/vector/reverse.h
  * Copyright (C) 2002 Bradford Hovinen
  *
@@ -8,8 +8,8 @@
  * See COPYING for license information.
  */
 
-#ifndef __REVERSE_H
-#define __REVERSE_H
+#ifndef __LINBOX_reverse_H
+#define __LINBOX_reverse_H
 
 #include "vector-traits.h"
 
@@ -26,8 +26,7 @@ namespace LinBox
 	 \ingroup vector
 	 */
 	template <class Vector>
-	class ReverseVector
-	{
+	class ReverseVector {
 	    public:
 		typedef typename Vector::value_type             value_type;
 		typedef typename Vector::size_type              size_type;
@@ -40,12 +39,14 @@ namespace LinBox
 		typedef typename Vector::iterator               reverse_iterator;
 		typedef typename Vector::const_iterator         const_reverse_iterator;
 
-		ReverseVector (Vector& v)
-			: _v (v) {}
-		
+		ReverseVector (Vector& v) :
+		       	_v (v)
+		{}
+
 		// Copy constructor
-		ReverseVector (const ReverseVector<Vector> &v) 
-			: _v (v._v) {}
+		ReverseVector (const ReverseVector<Vector> &v) :
+		       	_v (v._v)
+		{}
 
 		~ReverseVector () {}
 
@@ -66,24 +67,24 @@ namespace LinBox
 		inline reference       operator[] (size_type n)       { return (begin ())[n]; }
 		inline const_reference operator[] (size_type n) const { return (begin ())[n]; }
 
-		// the method "at" does appear to be implemented 
+		// the method "at" does appear to be implemented
 		// in the gnu implementation of the STL
 		reference at (size_type n)  // validity is relative to valid _begin, _end
-		{   
+		{
 			iterator p = begin () + n;
-			if (begin () <= p && p < end ()) 
+			if (begin () <= p && p < end ())
 				return *p;
 			else
-				throw std::out_of_range(); //out of range error message.
+				throw std::out_of_range("out of range"); //out of range error message.
 		}
 
-		const_reference at(size_type n) const 
+		const_reference at(size_type n) const
 		{
 			const_iterator p = begin () + n;
 			if (begin () <= p && p < end ())
 				return *p;
-			else 
-				throw std::out_of_range(); //out of range error message
+			else
+				throw std::out_of_range("out of range"); //out of range error message
 		}
 
 		inline reference       front (void)       { return *begin (); }
@@ -108,14 +109,14 @@ namespace LinBox
 //		template <class In> void assign(In first, In last);
 //		void assign(size_type n, const T& val);
 
-		// Stack operations:  
+		// Stack operations:
 		// 	not implemented because they invalidate iterators
 
 		// List operations:
 		// 	not implemented because they invalidate iterators
 
 		// Capacity
-		// 	resize, reserve: not implemented because they 
+		// 	resize, reserve: not implemented because they
 		// 		invalidate iterators
 
 		inline size_type size      (void) const { return _v.size  (); }
@@ -129,11 +130,12 @@ namespace LinBox
 	}; // template <class Vector> class ReverseVector
 
 	// Vector traits for ReverseVector wrapper
-	template <class Vector> 
+	template <class Vector>
 	struct VectorTraits<ReverseVector<Vector> >
-	{ 
-		typedef typename VectorTraits<Vector>::VectorCategory VectorCategory; 
+	{
+		typedef typename VectorTraits<Vector>::VectorCategory VectorCategory;
 	};
 
 } // namespace LinBox
-#endif
+#endif //__LINBOX_reverse_H
+
diff --git a/linbox/vector/sparse.h b/linbox/vector/sparse.h
index ee0f3a8..31e01b5 100644
--- a/linbox/vector/sparse.h
+++ b/linbox/vector/sparse.h
@@ -1,63 +1,103 @@
-// ======================================================================= // (C) Linbox 2000
+/* -*- 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
+/* linbox/solutions/minpoly.h
+ * Copyright (C) 2000, 2010 Jean-Guillaume Dumas
+ *
+ * Written by Jean-Guillaume Dumas <Jean-Guillaume.Dumas at imag.fr>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+// =======================================================================
 // Sparse Vector      : vector< Pair<T> > and an additional actual size
-// Time-stamp: <15 Jul 05 10:27:48 Jean-Guillaume.Dumas at imag.fr> 
-// ======================================================================= 
-#ifndef _SPARSE_VECTOR_H_
-#define _SPARSE_VECTOR_H_
+// =======================================================================
+#ifndef __LINBOX_sparse_vector_H
+#define __LINBOX_sparse_vector_H
 #include <iostream>
 
-#include "linbox/vector/pair.h"
 #include <linbox/vector/vector-traits.h>
 
 // ---------------------------------------------------
 //
-/// Default container for sparse vectors is STL vector
+/// Default container for sparse vectors is LightContainer
 #ifndef _IBB_VECTOR_
-#include <vector>
-#define _IBB_VECTOR_ std::vector
+// #include <vector>
+// #define _IBB_VECTOR_ std::vector
+#include "linbox/vector/light_container.h"
+#define _IBB_VECTOR_ LightContainer
 #endif // _IBB_VECTOR_
+#ifndef _IBB_PAIR_
+#include <utility>
+#define _IBB_PAIR_ std::pair
+// #include "linbox/vector/pair.h"
+// #define _IBB_PAIR_ Pair
+#endif // _IBB_PAIR_
 
 
 
-namespace LinBox{
-// ---------------------------------------------------
-//
-/** \brief vector< Pair<T> > and actualsize
-\ingroup vector
-*/
-template<class T, class I = unsigned long>
-class Sparse_Vector : public _IBB_VECTOR_< Pair<T, I> > {
-public:
-    typedef Pair<T, I>             Element;
-    typedef T                      Type_t;
-    typedef Sparse_Vector<T, I>    Self_t;
-
-    // Dan Roche 6-30-04
-    typedef VectorCategories::SparseSequenceVectorTag VectorCategory;
-
-
-    Sparse_Vector() {};
-    Sparse_Vector(size_t n) : _IBB_VECTOR_< Pair<T, I> >(n), _rsize(0) {};
-    Sparse_Vector(size_t n, size_t rn) : _IBB_VECTOR_< Pair<T, I> >(n), _rsize(rn) {};
-    ~Sparse_Vector() {};
-    
-            
-
-        /// Actual dimension of the vector, 0 for infinite or unknown
-    inline size_t actualsize() const { return _rsize; };            
-    inline size_t reactualsize( const size_t s ) { return _rsize = s; };
-    template<class XX> inline size_t reactualsize( const XX s ) { return _rsize = (size_t)s; };
-
-    friend inline std::ostream& operator<< (std::ostream& o, const Sparse_Vector<T, I> v) {
-        if (v.size())
-            for(long i=0;i<v.size();i++)
-                o << v[i] << std::endl;
-        return o;
-    }
-
-private:
-    size_t _rsize;
-};    
+namespace LinBox
+{
+	// ---------------------------------------------------
+	//
+	/** \brief vector< Pair<T,I> > and actualsize
+	  \ingroup vector
+	  */
+	template<class T, class I = unsigned int>
+	class Sparse_Vector : public _IBB_VECTOR_< _IBB_PAIR_<I, T> > {
+	public:
+		typedef _IBB_PAIR_<I, T>       Element;
+		typedef T                      Type_t;
+		typedef Sparse_Vector<T, I>    Self_t;
+
+		// Dan Roche 6-30-04
+		typedef VectorCategories::SparseSequenceVectorTag VectorCategory;
+
+
+		Sparse_Vector() {};
+		Sparse_Vector(size_t n) :
+			_IBB_VECTOR_< _IBB_PAIR_<I, T> >(n), _rsize(0)
+		{};
+		Sparse_Vector(size_t n, size_t rn) :
+			_IBB_VECTOR_< _IBB_PAIR_<I, T> >(n), _rsize(rn)
+		{};
+		~Sparse_Vector() {};
+
+
+
+		/// Actual dimension of the vector, 0 for infinite or unknown
+		inline size_t actualsize() const { return _rsize; };
+		inline size_t reactualsize( const size_t s ) { return _rsize = s; };
+		template<class XX> inline size_t reactualsize( const XX s )
+		{
+			return _rsize = (size_t)s;
+		}
+
+		friend inline std::ostream& operator<< (std::ostream& o, const Sparse_Vector<T, I> v)
+		{
+			if (v.size())
+				for(long i=0;i<v.size();i++)
+					o << v[i] << std::endl;
+			return o;
+		}
+
+
+	private:
+		size_t _rsize;
+	};
 
 } //end of namespace LinBox
-#endif // _SPARSE_VECTOR_H_
+
+#endif // __LINBOX_sparse_vector_H
diff --git a/linbox/vector/stream.h b/linbox/vector/stream.h
index f4424c4..fcf3b8c 100644
--- a/linbox/vector/stream.h
+++ b/linbox/vector/stream.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/vector/stream.h
  * Copyright (C) 2002 Bradford Hovinen
  *
@@ -32,20 +32,20 @@
  * Refactor: Create one class StandardBasisFactory, parameterized by vector
  * type, with specializations for dense, sparse map, and sparse associative
  * vectors.
- * 
+ *
  * ------------------------------------
  * Modified by Dmitriy Morozov <linbox at foxcub.org>. May 27, 2002.
  *
- * Added parametrization of the VectorCategroy tags by VectorTraits (see 
+ * Added parametrization of the VectorCategroy tags by VectorTraits (see
  * vector-traits.h for more details).
- * 
+ *
  * ------------------------------------
- *  
+ *
  * See COPYING for license information.
  */
 
-#ifndef __VECTOR_STREAM_H
-#define __VECTOR_STREAM_H
+#ifndef __LINBOX_vector_stream_H
+#define __LINBOX_vector_stream_H
 
 #include <vector>
 #include <cmath>
@@ -55,806 +55,796 @@
 #include "linbox/randiter/nonzero.h"
 #include "linbox/randiter/mersenne-twister.h"
 
-namespace LinBox 
-{
-
-/** \brief Vector factory
-
- * This is an abstract base class that generates a sequence of vectors
- * in a generic way. Typical uses would be in tests, where the same test
- * might be run on a sequence of random vectors or on e_1, ..., e_n.
- \ingroup vector
+/**
+ * @file vector/stream.h
+ *
+ * @brief Generation of sequences of random vectors.
+ *
+ * Random, sparse, basis vectors,...
  */
-template <class _Vector>
-class VectorStream 
-{
-    public:
-	typedef _Vector Vector;
-        typedef VectorStream<Vector> Self_t;
-     
-
-	virtual ~VectorStream () {}
-
-	/** Get the next vector from the factory and store it in v
-	 */
-
-	virtual Vector &get (Vector &v) = 0;
-
-	/** Extraction operator form
-	 */
-	Self_t &operator >> (Vector &v)
-		{ get (v); return *this; }
-
-	/** Get the number of vectors to be constructed in this stream
-	 */
-	virtual size_t size () const = 0;
-
-	/** Get the number of vectors constructed so far
-	 */
-	virtual size_t pos () const = 0;
 
-	/** Get the dimension of each vector
-	 */
-	virtual size_t dim () const = 0;
-
-	/** Return true if and only if the vector stream still has more vectors
-	 * to construct
-	 */
-	virtual operator bool () const = 0;
+namespace LinBox
+{
 
-	/** Reset the vector stream to the beginning.
-	 */
-	virtual void reset () = 0;
+	/** \brief Vector factory.
 
-	/** Alias for reset
+	 * This is an abstract base class that generates a sequence of vectors
+	 * in a generic way. Typical uses would be in tests, where the same test
+	 * might be run on a sequence of random vectors or on e_1, ..., e_n.
+	 \ingroup vector
 	 */
-	void rewind () { reset (); }
+	template <class _Vector>
+	class VectorStream {
+	public:
+		typedef _Vector Vector;
+		typedef VectorStream<Vector> Self_t;
 
-	/** @name Legacy interface
-	 * These functions provide compatiblity with older parts of the
-	 * library. Their use is deprecated.
-	 */
 
-	//@{
+		virtual ~VectorStream () {}
 
-	Vector &next (Vector &v) { return get (v); }
-	size_t j () const { return pos (); }
-	size_t m () const { return size (); }
-	size_t n () const { return dim (); }
+		/** Get the next vector from the factory and store it in v
+		*/
 
-	//@}
-};
+		virtual Vector &get (Vector &v) = 0;
 
-/** Constant vector factory
- * Returns the same vector repeatedly
- */
-template <class _Vector>
-class ConstantVectorStream : public VectorStream<_Vector>
-{
-    public:
-	typedef _Vector Vector;
-        typedef ConstantVectorStream<Vector> Self_t;
-
-	/** Constructor
-	 * Construct a new factory with the given field and vector size.
-	 * @param v Vector to return on next
-	 * @param m Number of vectors to return (0 for unlimited)
-	 */
-	ConstantVectorStream (Vector &v, size_t m) : _v (v), _m (m), _j (0) {}
+		/** Extraction operator form
+		*/
+		Self_t &operator >> (Vector &v)
+		{ get (v); return *this; }
 
-	/** Retrieve vector
-	 * @param v Vector to use
-	 */
-	Vector &get (Vector &v) 
+		/** Get the number of vectors to be constructed in this stream
+		*/
+		virtual size_t size () const = 0;
+
+		/** Get the number of vectors constructed so far
+		*/
+		virtual size_t pos () const = 0;
+
+		/** Get the dimension of each vector
+		*/
+		virtual size_t dim () const = 0;
+
+		/** Return true if and only if the vector stream still has more vectors
+		 * to construct
+		 */
+		virtual operator bool () const = 0;
+
+		/** Reset the vector stream to the beginning.
+		*/
+		virtual void reset () = 0;
+
+		/** Alias for reset
+		*/
+		void rewind () { reset (); }
+
+		/** @name Legacy interface
+		 * These functions provide compatiblity with older parts of the
+		 * library. Their use is deprecated.
+		 */
+
+		//@{
+
+		Vector &next (Vector &v) { return get (v); }
+		size_t j () const { return pos (); }
+		size_t m () const { return size (); }
+		size_t n () const { return dim (); }
+
+		//@}
+	};
+
+	/** @brief Constant vector factory.
+	 * Returns the same vector repeatedly
+	 */
+	template <class _Vector>
+	class ConstantVectorStream : public VectorStream<_Vector> {
+	public:
+		typedef _Vector Vector;
+		typedef ConstantVectorStream<Vector> Self_t;
+
+		/** Constructor.
+		 * Construct a new factory with the given field and vector size.
+		 * @param v Vector to return on next
+		 * @param m Number of vectors to return (0 for unlimited)
+		 */
+		ConstantVectorStream (Vector &v, size_t m) :
+		       	_v (v), _m (m), _j (0)
+	       	{}
+
+		/** Retrieve vector
+		 * @param v Vector to use
+		 */
+		Vector &get (Vector &v)
 		{ if (_m == 0 || _j < _m) copy (_v.begin (), _v.end (), v.begin ()); return v; }
 
-	/** Extraction operator form
-	 */
-	Self_t &operator >> (Vector &v)
+		/** Extraction operator form
+		*/
+		Self_t &operator >> (Vector &v)
 		{ get (v); return *this; }
-	/** Number of vectors to be created
-	 */
-	size_t size () const { return _m; }
-
-	/** Number of vectors created so far
-	 */
-	size_t pos () const { return _j; }
-
-	/** Dimension of the space
-	 */
-	size_t dim () const { return _v.size (); }
-
-	/** Check whether we have reached the end
-	 */
-	operator bool () const { return _m == 0 || _j < _m; }
-
-	/** Reset the factory to start at the beginning
-	 */
-	void reset () { _j = 0; }
-
-    private:
-	Vector &_v;
-	size_t  _m;
-	size_t  _j;
-};
-
-/** Random dense vector stream
- * Generates a sequence of random dense vectors over a given field
- */
-template <class Field, class _Vector = typename LinBox::Vector<Field>::Dense, class RandIter = typename Field::RandIter, class Trait = typename VectorTraits<_Vector>::VectorCategory>
-class RandomDenseStream : public VectorStream<_Vector>
-{
-    public:
-	typedef _Vector Vector;
-        typedef RandomDenseStream<Field, Vector, RandIter, Trait> Self_t;
-
-	/** Constructor
-	 * Construct a new stream with the given field and vector size.
-	 * @param F Field over which to create random vectors
-	 * @param n Size of vectors
-	 * @param m Number of vectors to return (0 for unlimited)
-	 */
-	RandomDenseStream (const Field &F, size_t n, size_t m = 0);
-
-	/** Constructor
-	 * Construct a new stream with the given field and vector size.
-	 * @param F Field over which to create random vectors
-	 * @param n Size of vectors
-	 * @param m Number of vectors to return (0 for unlimited)
-	 */
-	RandomDenseStream (const Field &F, const RandIter &r, size_t n, size_t m = 0);
-
-	/** Get next element
-	 * @param v Vector into which to generate random vector
-	 * @return reference to new random vector
-	 */
-	Vector &get (Vector &v);
-
-	/** Extraction operator form
-	 */
-	Self_t &operator >> (Vector &v)
+		/** Number of vectors to be created
+		*/
+		size_t size () const { return _m; }
+
+		/** Number of vectors created so far
+		*/
+		size_t pos () const { return _j; }
+
+		/** Dimension of the space
+		*/
+		size_t dim () const { return _v.size (); }
+
+		/** Check whether we have reached the end
+		*/
+		operator bool () const { return _m == 0 || _j < _m; }
+
+		/** Reset the factory to start at the beginning
+		*/
+		void reset () { _j = 0; }
+
+	private:
+		Vector &_v;
+		size_t  _m;
+		size_t  _j;
+	};
+
+	/** @brief Random dense vector stream.
+	 * Generates a sequence of random dense vectors over a given field
+	 */
+	template <class Field, class _Vector = typename LinBox::Vector<Field>::Dense, class RandIter = typename Field::RandIter, class Trait = typename VectorTraits<_Vector>::VectorCategory>
+	class RandomDenseStream : public VectorStream<_Vector> {
+	public:
+		typedef _Vector Vector;
+		typedef RandomDenseStream<Field, Vector, RandIter, Trait> Self_t;
+
+		/** Constructor
+		 * Construct a new stream with the given field and vector size.
+		 * @param F Field over which to create random vectors
+		 * @param n Size of vectors
+		 * @param m Number of vectors to return (0 for unlimited)
+		 */
+		RandomDenseStream (const Field &F, size_t n, size_t m = 0);
+
+		/** Constructor.
+		 * Construct a new stream with the given field and vector size.
+		 * @param F Field over which to create random vectors
+		 * @param r
+		 * @param n Size of vectors
+		 * @param m Number of vectors to return (0 for unlimited)
+		 */
+		RandomDenseStream (const Field &F, const RandIter &r, size_t n, size_t m = 0);
+
+		/** Get next element
+		 * @param v Vector into which to generate random vector
+		 * @return reference to new random vector
+		 */
+		Vector &get (Vector &v);
+
+		/** Extraction operator form
+		*/
+		Self_t &operator >> (Vector &v)
 		{ get (v); return *this; }
-	/** Number of vectors to be created
-	 */
-	size_t size () const;
-
-	/** Number of vectors created so far
-	 */
-	size_t pos () const;
-
-	/** Dimension of the space
-	 */
-	size_t dim () const;
-
-	/** Check whether we have reached the end
-	 */
-	operator bool () const;
-
-	/** Reset the stream to start at the beginning
-	 */
-	void reset ();
-};
-
-// Specialization of random dense stream for dense vectors
-
-template <class Field, class _Vector, class RandIter>
-class RandomDenseStream<Field, _Vector, RandIter, VectorCategories::DenseVectorTag > : public VectorStream<_Vector>
-{
-    public:
-	typedef _Vector Vector;
-        typedef RandomDenseStream<Field, Vector, RandIter, VectorCategories::DenseVectorTag > Self_t;
-
-	RandomDenseStream (const Field &F, size_t n, size_t m = 0)
-		: _F (F), _r (F), _n (n), _m (m), _j (0)
-	{}
-
-	RandomDenseStream (const Field &F, const RandIter &r, size_t n, size_t m = 0)
-		: _F (F), _r (r), _n (n), _m (m), _j (0)
-	{}
-
-	Vector &get (Vector &v) 
-	{
-		typename Vector::iterator i;
+		/** Number of vectors to be created
+		*/
+		size_t size () const;
+
+		/** Number of vectors created so far
+		*/
+		size_t pos () const;
+
+		/** Dimension of the space
+		*/
+		size_t dim () const;
+
+		/** Check whether we have reached the end
+		*/
+		operator bool () const;
+
+		/** Reset the stream to start at the beginning
+		*/
+		void reset ();
+	};
+
+	//! Specialization of random dense stream for dense vectors
+	template <class Field, class _Vector, class RandIter>
+	class RandomDenseStream<Field, _Vector, RandIter, VectorCategories::DenseVectorTag > : public VectorStream<_Vector> {
+	public:
+		typedef _Vector Vector;
+		typedef RandomDenseStream<Field, Vector, RandIter, VectorCategories::DenseVectorTag > Self_t;
+
+		RandomDenseStream (const Field &F, size_t n, size_t m = 0) :
+			_F (F), _r (F), _n (n), _m (m), _j (0)
+		{}
+
+		RandomDenseStream (const Field &F, const RandIter &r, size_t n, size_t m = 0) :
+			_F (F), _r (r), _n (n), _m (m), _j (0)
+		{}
+
+		Vector &get (Vector &v)
+		{
+			typename Vector::iterator i;
+
+			if ( (_m > 0) && (_j++ >= _m) )
+				return v;
+
+			for (i = v.begin (); i != v.end (); i++)
+				_r.random (*i);
 
-		if (_m > 0 && _j++ >= _m)
 			return v;
+		}
 
-		for (i = v.begin (); i != v.end (); i++)
-			_r.random (*i);
-
-		return v;
-	}
-
-	/** Extraction operator form
-	 */
-	Self_t &operator >> (Vector &v)
+		/** Extraction operator form
+		*/
+		Self_t &operator >> (Vector &v)
 		{ get (v); return *this; }
-	size_t size () const { return _m; }
-	size_t pos () const { return _j; }
-	size_t dim () const { return _n; }
-	operator bool () const { return _m == 0 || _j < _m; }
-	void reset () { _j = 0; }
-
-    private:
-	const Field &_F;
-	RandIter     _r;
-	size_t       _n;
-	size_t       _m;
-	size_t       _j;
-};
-
-/** Random sparse vector stream
- * Generates a sequence of random sparse vectors over a given field
- */
-template <class Field, class _Vector = typename LinBox::Vector<Field>::Sparse, class RandIter = typename Field::RandIter, class Trait = typename VectorTraits<_Vector>::VectorCategory>
-class RandomSparseStream : public VectorStream<_Vector>
-{
-    public:
-	typedef _Vector Vector;
-        typedef RandomSparseStream<Field, Vector, RandIter, Trait > Self_t;
-
-	/** Constructor
-	 * Construct a new stream with the given field and vector size.
-	 * @param F Field over which to create random vectors
-	 * @param p Proportion of nonzero entries
-	 * @param n Size of vectors
-	 * @param m Number of vectors to return (0 for unlimited)
-	 */
-	RandomSparseStream (const Field &F, double p, size_t n, size_t m = 0);
-
-	/** Constructor
-	 * Construct a new stream with the given field and vector size.
-	 * @param F Field over which to create random vectors
-	 * @param n Size of vectors
-	 * @param p Proportion of nonzero entries
-	 * @param m Number of vectors to return (0 for unlimited)
-	 */
-	RandomSparseStream (const Field &F, const RandIter &r, double p, size_t n, size_t m = 0);
-
-	/** Get next element
-	 * @param v Vector into which to generate random vector
-	 * @return reference to new random vector
-	 */
-	Vector &get (Vector &v);
-
-	/** Extraction operator form
-	 */
-	Self_t &operator >> (Vector &v)
+		size_t size () const { return _m; }
+		size_t pos () const { return _j; }
+		size_t dim () const { return _n; }
+		operator bool () const { return _m == 0 || _j < _m; }
+		void reset () { _j = 0; }
+
+	private:
+		const Field &_F;
+		RandIter     _r;
+		size_t       _n;
+		size_t       _m;
+		size_t       _j;
+	};
+
+	/** @brief Random sparse vector stream.
+	 * Generates a sequence of random sparse vectors over a given field
+	 */
+	template <class Field, class _Vector = typename LinBox::Vector<Field>::Sparse, class RandIter = typename Field::RandIter, class Trait = typename VectorTraits<_Vector>::VectorCategory>
+	class RandomSparseStream : public VectorStream<_Vector> {
+	public:
+		typedef _Vector Vector;
+		typedef RandomSparseStream<Field, Vector, RandIter, Trait > Self_t;
+
+		/** Constructor
+		 * Construct a new stream with the given field and vector size.
+		 * @param F Field over which to create random vectors
+		 * @param p Proportion of nonzero entries
+		 * @param n Size of vectors
+		 * @param m Number of vectors to return (0 for unlimited)
+		 */
+		RandomSparseStream (const Field &F, double p, size_t n, size_t m = 0);
+
+		/** Constructor.
+		 * Construct a new stream with the given field and vector size.
+		 * @param F Field over which to create random vectors
+		 * @param r
+		 * @param n Size of vectors
+		 * @param p Proportion of nonzero entries
+		 * @param m Number of vectors to return (0 for unlimited)
+		 * @param seed
+		 */
+		RandomSparseStream (const Field &F, const RandIter &r, double p, size_t n, size_t m = 0, int seed=time (NULL));
+
+		/** Get next element
+		 * @param v Vector into which to generate random vector
+		 * @return reference to new random vector
+		 */
+		Vector &get (Vector &v);
+
+		/** Extraction operator form
+		*/
+		Self_t &operator >> (Vector &v)
 		{ get (v); return *this; }
-	/** Number of vectors to be created
-	 */
-	size_t size () const;
-
-	/** Number of vectors created so far
-	 */
-	size_t pos () const;
-
-	/** Dimension of the space
-	 */
-	size_t dim () const;
-
-	/** Check whether we have reached the end
-	 */
-	operator bool () const;
-
-	/** Reset the stream to start at the beginning
-	 */
-	void reset ();
-
-	/** Set the probability of a nonzero entry
-	 */
-	void setP (double p);
-};
-
-// Specialization of RandomSparseStream for dense vectors
-
-template <class Field, class _Vector, class RandIter>
-class RandomSparseStream<Field, _Vector, RandIter, VectorCategories::DenseVectorTag > : public VectorStream<_Vector>
-{
-    public:
-	typedef _Vector Vector;
-        typedef RandomSparseStream<Field, Vector, RandIter, VectorCategories::DenseVectorTag > Self_t;
-
-	RandomSparseStream (const Field &F, double p, size_t n, size_t m = 0)
-		: _F (F), _r1 (F), _r (F, _r1),
-		  _n (n), _p (p), _m (m), _j (0),
-		  _MT (time (NULL))
+		/** Number of vectors to be created
+		*/
+		size_t size () const;
+
+		/** Number of vectors created so far
+		*/
+		size_t pos () const;
+
+		/** Dimension of the space
+		*/
+		size_t dim () const;
+
+		/** Check whether we have reached the end
+		*/
+		operator bool () const;
+
+		/** Reset the stream to start at the beginning
+		*/
+		void reset ();
+
+		/** Set the probability of a nonzero entry
+		*/
+		void setP (double p);
+	};
+
+	//! Specialization of RandomSparseStream for dense vectors
+	template <class Field, class _Vector, class RandIter>
+	class RandomSparseStream<Field, _Vector, RandIter, VectorCategories::DenseVectorTag > : public VectorStream<_Vector> {
+	public:
+		typedef _Vector Vector;
+		typedef RandomSparseStream<Field, Vector, RandIter, VectorCategories::DenseVectorTag > Self_t;
+
+		RandomSparseStream (const Field &F, double p, size_t n, size_t m = 0) :
+			_F (F), _r1 (F), _r (F, _r1),
+			_n (n), _p (p), _m (m), _j (0),
+			MT (time (NULL))
 		{ linbox_check ((p >= 0.0) && (p <= 1.0)); _F.init (_zero, 0); }
 
-	RandomSparseStream (const Field &F, const RandIter &r, double p, size_t n, size_t m = 0)
-		: _F (F), _r1 (r), _r (F, _r1), _n (n), _p (p), _m (m), _j (0),
-		  _MT (time (NULL))
+		RandomSparseStream (const Field &F, const RandIter &r, double p, size_t n, size_t m = 0, int seed=time (NULL)) :
+			_F (F), _r1 (r), _r (F, _r1), _n (n), _p (p), _m (m), _j (0),
+			MT (seed)
 		{ linbox_check ((p >= 0.0) && (p <= 1.0)); _F.init (_zero, 0); }
 
-	Vector &get (Vector &v)
-	{
-		double val;
+		Vector &get (Vector &v)
+		{
+			double val;
 
-		if (_m > 0 && _j++ >= _m)
-			return v;
+			if (_m > 0 && _j++ >= _m)
+				return v;
 
-		for (typename Vector::iterator i = v.begin (); i != v.end (); ++i) {
-			val = _MT.randomDouble ();
+			for (typename Vector::iterator i = v.begin (); i != v.end (); ++i) {
+				val = MT.randomDouble ();
 
-			if (val < _p)
-				_r.random (*i);
-			else
-				_F.assign (*i, _zero);
-		}
+				if (val < _p)
+					_r.random (*i);
+				else
+					_F.assign (*i, _zero);
+			}
 
-		return v;
-	}
-	/** Extraction operator form
-	 */
-	Self_t &operator >> (Vector &v)
+			return v;
+		}
+		/** Extraction operator form
+		*/
+		Self_t &operator >> (Vector &v)
 		{ get (v); return *this; }
 
-	size_t size () const { return _m; }
-	size_t pos () const { return _j; }
-	size_t dim () const { return _n; }
-	operator bool () const { return _m == 0 || _j < _m; }
-	void reset () { _j = 0; }
-	void setP (double p) { linbox_check ((p >= 0.0) && (p <= 1.0)); _p = p; }
-
-    private:
-	const Field                      &_F;
-	typename Field::Element           _zero;
-	RandIter                          _r1;
-	NonzeroRandIter<Field, RandIter>  _r;
-	size_t                            _n;
-	double                            _p;
-	size_t                            _m;
-	size_t                            _j;
-	MersenneTwister                   _MT;
-};
-
-// Specialization of RandomSparseStream for sparse sequence vectors
-
-template <class Field, class _Vector, class RandIter>
-class RandomSparseStream<Field, _Vector, RandIter, VectorCategories::SparseSequenceVectorTag > : public VectorStream<_Vector>
-{
-    public:
-	typedef _Vector Vector;
-        typedef RandomSparseStream<Field, Vector, RandIter, VectorCategories::SparseSequenceVectorTag > Self_t;
-
-	RandomSparseStream (const Field &F, double p, size_t n, size_t m = 0)
-		: _F (F), _r1 (F), _r (F, _r1), _n (n), _m (m), _j (0),
-		  _MT (time (NULL))
+		size_t size () const { return _m; }
+		size_t pos () const { return _j; }
+		size_t dim () const { return _n; }
+		operator bool () const { return _m == 0 || _j < _m; }
+		void reset () { _j = 0; }
+		void setP (double p) { linbox_check ((p >= 0.0) && (p <= 1.0)); _p = p; }
+
+	private:
+		const Field                      &_F;
+		typename Field::Element           _zero;
+		RandIter                          _r1;
+		NonzeroRandIter<Field, RandIter>  _r;
+		size_t                            _n;
+		double                            _p;
+		size_t                            _m;
+		size_t                            _j;
+		MersenneTwister                   MT;
+	};
+
+	//! Specialization of RandomSparseStream for sparse sequence vectors
+	template <class Field, class _Vector, class RandIter>
+	class RandomSparseStream<Field, _Vector, RandIter, VectorCategories::SparseSequenceVectorTag > : public VectorStream<_Vector> {
+	public:
+		typedef _Vector Vector;
+		typedef RandomSparseStream<Field, Vector, RandIter, VectorCategories::SparseSequenceVectorTag > Self_t;
+
+		RandomSparseStream (const Field &F, double p, size_t n, size_t m = 0) :
+			_F (F), _r1 (F), _r (F, _r1), _n (n), _m (m), _j (0),
+			MT (time (NULL))
 		{ setP (p); }
 
-	RandomSparseStream (const Field &F, const RandIter &r, double p, size_t n, size_t m = 0)
-		: _F (F), _r1 (r), _r (F, _r1), _n (n), _p (p), _m (m), _j (0),
-		  _MT (time (NULL))
+		RandomSparseStream (const Field &F, const RandIter &r, double p, size_t n, size_t m = 0, int seed=time (NULL)) :
+			_F (F), _r1 (r), _r (F, _r1), _n (n), _p (p), _m (m), _j (0),
+			MT (seed)
 		{ setP (p); }
 
-	Vector &get (Vector &v) 
-	{
-		typename Field::Element x;
-		size_t i = (size_t) -1;
-		double val;
-		int skip;
+		Vector &get (Vector &v)
+		{
+			typename Field::Element x;
+			size_t i = (size_t) -1;
+			double val;
+			int skip;
 
-		if (_m > 0 && _j++ >= _m)
-			return v;
+			if (_m > 0 && _j++ >= _m)
+				return v;
 
-		v.clear ();
+			v.clear ();
 
-		while (1) {
-			val = _MT.randomDouble ();
-			skip = (int) (ceil (log (val) * _1_log_1mp));
+			while (1) {
+				val = MT.randomDouble ();
+				skip = (int) (ceil (log (val) * _1_log_1mp));
 
-			if (skip <= 0)
-				++i;
-			else
-				i += skip;
+				if (skip <= 0)
+					++i;
+				else
+					i += skip;
 
-			if (i >= _n) break;
+				if (i >= _n) break;
 
-			_r.random (x);
-			v.push_back (std::pair<size_t, typename Field::Element> (i, x));
-		}
+				_r.random (x);
+				v.push_back (std::pair<size_t, typename Field::Element> (i, x));
+			}
 
-		return v;
-	}
-	/** Extraction operator form
-	 */
-	Self_t &operator >> (Vector &v)
+			return v;
+		}
+		/** Extraction operator form
+		*/
+		Self_t &operator >> (Vector &v)
 		{ get (v); return *this; }
 
-	size_t size () const { return _m; }
-	size_t pos () const { return _j; }
-	size_t dim () const { return _n; }
-	operator bool () const { return _m == 0 || _j < _m; }
-	void reset () { _j = 0; }
-
-	void setP (double p)
-	{
-		linbox_check ((p >= 0.0) && (p <= 1.0)); 
-		_p = p;
-		_1_log_1mp   = 1 / log (1 - _p);
-	}
-
-    private:
-	const Field                      &_F;
-	RandIter                          _r1;
-	NonzeroRandIter<Field, RandIter>  _r;
-	size_t                            _n;
-	double                            _p;
-	double                            _1_log_1mp;
-	size_t                            _m;
-	size_t                            _j;
-	MersenneTwister                   _MT;
-};
-
-// Specialization of RandomSparseStream for sparse associative vectors
-
-template <class Field, class _Vector, class RandIter>
-class RandomSparseStream<Field, _Vector, RandIter, VectorCategories::SparseAssociativeVectorTag > : public VectorStream<_Vector>
-{
-    public:
-	typedef _Vector Vector;
-        typedef RandomSparseStream<Field, Vector, RandIter, VectorCategories::SparseAssociativeVectorTag > Self_t;
-
-	RandomSparseStream (const Field &F, double p, size_t n, size_t m = 0)
-		: _F (F), _r1 (F), _r (F, _r1),
-		  _n (n), _k ((long) (p * n)), _j (0), _m (m),
-		  _MT (time (NULL))
-	{}
-
-	RandomSparseStream (const Field &F, const RandIter &r, double p, size_t n, size_t m = 0)
-		: _F (F), _r1 (F), _r (F, _r1), _n (n), _k ((long) (p * n)), _j (0), _m (m),
-		  _MT (time (NULL))
-	{}
-
-	Vector &get (Vector &v) 
-	{
-		typename Field::Element x;
-		int i, idx;
-
-		if (_m > 0 && _j++ >= _m)
-			return v;
+		size_t size () const { return _m; }
+		size_t pos () const { return _j; }
+		size_t dim () const { return _n; }
+		operator bool () const { return _m == 0 || _j < _m; }
+		void reset () { _j = 0; }
+
+		void setP (double p)
+		{
+			linbox_check ((p >= 0.0) && (p <= 1.0));
+			_p = p;
+			_1_log_1mp   = 1 / log (1 - _p);
+		}
 
-		v.clear ();
+	private:
+		const Field                      &_F;
+		RandIter                          _r1;
+		NonzeroRandIter<Field, RandIter>  _r;
+		size_t                            _n;
+		double                            _p;
+		double                            _1_log_1mp;
+		size_t                            _m;
+		size_t                            _j;
+		MersenneTwister                   MT;
+	};
+
+	//! Specialization of RandomSparseStream for sparse associative vectors
+	template <class Field, class _Vector, class RandIter>
+	class RandomSparseStream<Field, _Vector, RandIter, VectorCategories::SparseAssociativeVectorTag > : public VectorStream<_Vector> {
+	public:
+		typedef _Vector Vector;
+		typedef RandomSparseStream<Field, Vector, RandIter, VectorCategories::SparseAssociativeVectorTag > Self_t;
+
+		RandomSparseStream (const Field &F, double p, size_t n, size_t m = 0) :
+			_F (F), _r1 (F), _r (F, _r1),
+			_n (n), _k ((long) (p * n)), _j (0), _m (m),
+			MT (time (NULL))
+		{}
+
+		RandomSparseStream (const Field &F, const RandIter &r, double p, size_t n, size_t m = 0, int seed=time (NULL)) :
+			_F (F), _r1 (F), _r (F, _r1), _n (n), _k ((long) (p * n)), _j (0), _m (m),
+			MT (seed)
+		{}
+
+		Vector &get (Vector &v)
+		{
+			typename Field::Element x;
+			int i, idx;
+
+			if (_m > 0 && _j++ >= _m)
+				return v;
+
+			v.clear ();
+
+			for (i = 0; i < _k; i++) {
+				_r.random (x);
+				while (!_F.isZero (v[idx = MT.randomIntRange (0, _n)])) ;
+				v[idx] = x;
+			}
 
-		for (i = 0; i < _k; i++) {
-			_r.random (x);
-			while (!_F.isZero (v[idx = _MT.randomIntRange (0, _n)]));
-			v[idx] = x;
+			return v;
 		}
-
-		return v;
-	}
-	/** Extraction operator form
-	 */
-	Self_t &operator >> (Vector &v)
+		/** Extraction operator form
+		*/
+		Self_t &operator >> (Vector &v)
 		{ get (v); return *this; }
 
-	size_t size () const { return _m; }
-	size_t pos () const { return _j; }
-	size_t dim () const { return _n; }
-	operator bool () const { return _m == 0 || _j < _m; }
-	void reset () { _j = 0; }
-	void setP (double p) { _k = (long) (p * _n); }
-
-    private:
-	const Field                      &_F;
-	RandIter                          _r1;
-	NonzeroRandIter<Field, RandIter>  _r;
-	size_t                            _n;
-	long                              _k;
-	size_t                            _j;
-	size_t                            _m;
-	MersenneTwister                   _MT;
-};
-
-// Specialization of RandomSparseStream for sparse parallel vectors
-
-template <class Field, class _Vector, class RandIter>
-class RandomSparseStream<Field, _Vector, RandIter, VectorCategories::SparseParallelVectorTag > : public VectorStream<_Vector>
-{
-    public:
-	typedef _Vector Vector;
-        typedef RandomSparseStream<Field, Vector, RandIter, VectorCategories::SparseParallelVectorTag > Self_t;
-
-	RandomSparseStream (const Field &F, double p, size_t n, size_t m = 0)
-		: _F (F), _r1 (F), _r (F, _r1), _n (n), _m (m), _j (0),
-		  _MT (time (NULL))
+		size_t size () const { return _m; }
+		size_t pos () const { return _j; }
+		size_t dim () const { return _n; }
+		operator bool () const { return _m == 0 || _j < _m; }
+		void reset () { _j = 0; }
+		void setP (double p) { _k = (long) (p * _n); }
+
+	private:
+		const Field                      &_F;
+		RandIter                          _r1;
+		NonzeroRandIter<Field, RandIter>  _r;
+		size_t                            _n;
+		long                              _k;
+		size_t                            _j;
+		size_t                            _m;
+		MersenneTwister                   MT;
+	};
+
+	//! Specialization of RandomSparseStream for sparse parallel vectors
+	template <class Field, class _Vector, class RandIter>
+	class RandomSparseStream<Field, _Vector, RandIter, VectorCategories::SparseParallelVectorTag > : public VectorStream<_Vector> {
+	public:
+		typedef _Vector Vector;
+		typedef RandomSparseStream<Field, Vector, RandIter, VectorCategories::SparseParallelVectorTag > Self_t;
+
+		RandomSparseStream (const Field &F, double p, size_t n, size_t m = 0) :
+			_F (F), _r1 (F), _r (F, _r1), _n (n), _m (m), _j (0),
+			MT (time (NULL))
 		{ setP (p); }
 
-	RandomSparseStream (const Field &F, const RandIter &r, double p, size_t n, size_t m = 0)
-		: _F (F), _r1 (r), _r (F, _r1), _n (n), _m (m), _j (0),
-		  _MT (time (NULL))
+		RandomSparseStream (const Field &F, const RandIter &r, double p, size_t n, size_t m = 0, int seed=time (NULL)) :
+			_F (F), _r1 (r), _r (F, _r1), _n (n), _m (m), _j (0),
+			MT (seed)
 		{ setP (p); }
 
-	Vector &get (Vector &v) 
-	{
-		typename Field::Element x;
-		size_t i = (size_t) -1;
-		double val;
-		int skip;
+		Vector &get (Vector &v)
+		{
+			typename Field::Element x;
+			size_t i = (size_t) -1;
+			double val;
+			int skip;
 
-		if (_m > 0 && _j++ >= _m)
-			return v;
+			if (_m > 0 && _j++ >= _m)
+				return v;
 
-		v.first.clear ();
-		v.second.clear ();
+			v.first.clear ();
+			v.second.clear ();
 
-		while (1) {
-			val = _MT.randomDouble ();
-			skip = (int) (ceil (log (val) * _1_log_1mp));
+			while (1) {
+				val = MT.randomDouble ();
+				skip = (int) (ceil (log (val) * _1_log_1mp));
 
-			if (skip <= 0)
-				i++;
-			else
-				i += skip;
+				if (skip <= 0)
+					i++;
+				else
+					i += skip;
 
-			if (i >= _n) break;
+				if (i >= _n) break;
 
-			_r.random (x);
-			v.first.push_back (i);
-			v.second.push_back (x);
-		}
+				_r.random (x);
+				v.first.push_back (i);
+				v.second.push_back (x);
+			}
 
-		return v;
-	}
+			return v;
+		}
 
-	/** Extraction operator form
-	 */
-	Self_t &operator >> (Vector &v)
+		/** Extraction operator form
+		*/
+		Self_t &operator >> (Vector &v)
 		{ get (v); return *this; }
 
-	size_t size () const { return _m; }
-	size_t pos () const { return _j; }
-	size_t dim () const { return _n; }
-	operator bool () const { return _m == 0 || _j < _m; }
-	void reset () { _j = 0; }
-
-	void setP (double p)
-	{
-		linbox_check ((p >= 0.0) && (p <= 1.0)); 
-		_p = p;
-		_1_log_1mp   = 1 / log (1 - _p);
-	}
-
-    private:
-	const Field                      &_F;
-	RandIter                          _r1;
-	NonzeroRandIter<Field, RandIter>  _r;
-	size_t                            _n;
-	double                            _p;
-	double                            _1_log_1mp;
-	size_t                            _m;
-	size_t                            _j;
-	MersenneTwister                   _MT;
-};
-
-/** Stream for e_1,...,e_n
- * Generates the sequence e_1,...,e_n over a given field
- * 
- * This class is generic with respect to the underlying vector
- * representation.
- */
-
-template <class Field, class _Vector, class Trait = typename VectorTraits<_Vector>::VectorCategory>
-class StandardBasisStream : public VectorStream<_Vector>
-{
-    public:
-	typedef _Vector Vector;
-        typedef StandardBasisStream<Field, Vector, Trait > Self_t;
-
-	/** Constructor
-	 * Construct a new stream with the given field and vector size.
-	 * @param F Field over which to create vectors
-	 * @param n Size of vectors
-	 */
-	StandardBasisStream (Field &F, size_t n);
-
-	/** Get next element
-	 * @param v Vector into which to generate vector
-	 * @return reference to new vector
-	 */
-	Vector &get (Vector &v);
+		size_t size () const { return _m; }
+		size_t pos () const { return _j; }
+		size_t dim () const { return _n; }
+		operator bool () const { return _m == 0 || _j < _m; }
+		void reset () { _j = 0; }
+
+		void setP (double p)
+		{
+			linbox_check ((p >= 0.0) && (p <= 1.0));
+			_p = p;
+			_1_log_1mp   = 1 / log (1 - _p);
+		}
 
-	/** Extraction operator form
-	 */
-	Self_t &operator >> (Vector &v)
+	private:
+		const Field                      &_F;
+		RandIter                          _r1;
+		NonzeroRandIter<Field, RandIter>  _r;
+		size_t                            _n;
+		double                            _p;
+		double                            _1_log_1mp;
+		size_t                            _m;
+		size_t                            _j;
+		MersenneTwister                   MT;
+	};
+
+	/** @brief Stream for \f$e_1,\cdots,e_n\f$.
+	 * Generates the sequence (e_1,...,e_n) over a given field
+	 *
+	 * This class is generic with respect to the underlying vector
+	 * representation.
+	 */
+	template <class Field, class _Vector, class Trait = typename VectorTraits<_Vector>::VectorCategory>
+	class StandardBasisStream : public VectorStream<_Vector> {
+	public:
+		typedef _Vector Vector;
+		typedef StandardBasisStream<Field, Vector, Trait > Self_t;
+
+		/** Constructor.
+		 * Construct a new stream with the given field and vector size.
+		 * @param F Field over which to create vectors
+		 * @param n Size of vectors
+		 */
+		StandardBasisStream (Field &F, size_t n);
+
+		/** Get next element
+		 * @param v Vector into which to generate vector
+		 * @return reference to new vector
+		 */
+		Vector &get (Vector &v);
+
+		/** Extraction operator form
+		*/
+		Self_t &operator >> (Vector &v)
 		{ get (v); return *this; }
-	/** Number of vectors to be created
-	 */
-	size_t size () const;
-
-	/** Number of vectors created so far
-	 */
-	size_t pos () const;
+		/** Number of vectors to be created
+		*/
+		size_t size () const;
+
+		/** Number of vectors created so far
+		*/
+		size_t pos () const;
+
+		/** Dimension of the space
+		*/
+		size_t dim () const;
+
+		/** Check whether we have reached the end
+		*/
+		operator bool () const;
+
+		/** Reset the stream to start at the beginning
+		*/
+		void reset ();
+
+	private:
+		const Field              &_F;
+		size_t                    _n;
+		size_t                    _j;
+	};
+
+	//! Specialization of standard basis stream for dense vectors
+	template <class Field, class _Vector>
+	class StandardBasisStream<Field, _Vector, VectorCategories::DenseVectorTag > : public VectorStream<_Vector> {
+	public:
+		typedef _Vector Vector;
+		typedef StandardBasisStream<Field, Vector, VectorCategories::DenseVectorTag > Self_t;
+
+		StandardBasisStream (const Field &F, size_t n) :
+			_F (F), _n (n), _j (0)
+		{}
+
+		Vector &get (Vector &v)
+		{
+			static typename Field::Element zero;
+			typename Vector::iterator i;
+			size_t idx;
+
+			for (i = v.begin (), idx = 0; i != v.end (); i++, idx++) {
+				if (idx == _j)
+					_F.init (*i, 1);
+				else
+					_F.assign (*i, zero);
+			}
+
+			_j++;
 
-	/** Dimension of the space
-	 */
-	size_t dim () const;
-
-	/** Check whether we have reached the end
-	 */
-	operator bool () const;
-
-	/** Reset the stream to start at the beginning
-	 */
-	void reset ();
-
-    private:
-	const Field              &_F;
-	size_t                    _n;
-	size_t                    _j;
-};
-
-// Specialization of standard basis stream for dense vectors
-
-template <class Field, class _Vector>
-class StandardBasisStream<Field, _Vector, VectorCategories::DenseVectorTag > : public VectorStream<_Vector>
-{
-    public:
-	typedef _Vector Vector;
-        typedef StandardBasisStream<Field, Vector, VectorCategories::DenseVectorTag > Self_t;
-
-	StandardBasisStream (const Field &F, size_t n)
-		: _F (F), _n (n), _j (0)
-	{}
-
-	Vector &get (Vector &v) 
-	{
-		static typename Field::Element zero;
-		typename Vector::iterator i;
-		size_t idx;
-
-		for (i = v.begin (), idx = 0; i != v.end (); i++, idx++) {
-			if (idx == _j)
-				_F.init (*i, 1);
-			else
-				_F.assign (*i, zero);
+			return v;
 		}
 
-		_j++;
-
-		return v;
-	}
-
-	/** Extraction operator form
-	 */
-	Self_t &operator >> (Vector &v)
+		/** Extraction operator form
+		*/
+		Self_t &operator >> (Vector &v)
 		{ get (v); return *this; }
-	size_t size () const { return _n; }
-	size_t pos () const { return _j; }
-	size_t dim () const { return _n; }
-	operator bool () const { return _j < _n; }
-	void reset () { _j = 0; }
-
-    private:
-	const Field              &_F;
-	size_t                    _n;
-	size_t                    _j;
-};
-
-// Specialization of standard basis stream for sparse sequence vectors
-
-template <class Field, class _Vector>
-class StandardBasisStream<Field, _Vector, VectorCategories::SparseSequenceVectorTag > : public VectorStream<_Vector>
-{
-    public:
-	typedef _Vector Vector;
-        typedef StandardBasisStream<Field, Vector, VectorCategories::SparseSequenceVectorTag > Self_t;
-
-	StandardBasisStream (Field &F, size_t n)
-		: _F (F), _n (n), _j (0)
-	{ _F.init (_one, 1); }
+		size_t size () const { return _n; }
+		size_t pos () const { return _j; }
+		size_t dim () const { return _n; }
+		operator bool () const { return _j < _n; }
+		void reset () { _j = 0; }
+
+	private:
+		const Field              &_F;
+		size_t                    _n;
+		size_t                    _j;
+	};
+
+	//! Specialization of standard basis stream for sparse sequence vectors
+	template <class Field, class _Vector>
+	class StandardBasisStream<Field, _Vector, VectorCategories::SparseSequenceVectorTag > : public VectorStream<_Vector> {
+	public:
+		typedef _Vector Vector;
+		typedef StandardBasisStream<Field, Vector, VectorCategories::SparseSequenceVectorTag > Self_t;
+
+		StandardBasisStream (Field &F, size_t n) :
+			_F (F), _n (n), _j (0)
+		{ _F.init (_one, 1); }
+
+		Vector &get (Vector &v)
+		{
+			v.clear ();
+
+			if (_j < _n)
+				v.push_back (std::pair <size_t, typename Field::Element> (_j++, _one));
 
-	Vector &get (Vector &v) 
-	{
-		v.clear ();
-
-		if (_j < _n)
-			v.push_back (std::pair <size_t, typename Field::Element> (_j++, _one));
-
-		return v;
-	}
-	/** Extraction operator form
-	 */
-	Self_t &operator >> (Vector &v)
+			return v;
+		}
+		/** Extraction operator form
+		*/
+		Self_t &operator >> (Vector &v)
 		{ get (v); return *this; }
 
-	size_t size () const { return _n; }
-	size_t pos () const { return _j; }
-	size_t dim () const { return _n; }
-	operator bool () const { return _j < _n; }
-	void reset () { _j = 0; }
-
-    private:
-	const Field              &_F;
-	size_t                    _n;
-	size_t                    _j;
-	typename Field::Element   _one;
-};
-
-// Specialization of standard basis stream for sparse associative vectors
-
-template <class Field, class _Vector>
-class StandardBasisStream<Field, _Vector, VectorCategories::SparseAssociativeVectorTag > : public VectorStream<_Vector>
-{
-    public:
-	typedef _Vector Vector;
-        typedef StandardBasisStream<Field, Vector, VectorCategories::SparseAssociativeVectorTag > Self_t;
-
-	StandardBasisStream (Field &F, size_t n)
-		: _F (F), _n (n), _j (0)
-	{ _F.init (_one, 1); }
-
-	Vector &get (Vector &v) 
-	{
-		v.clear ();
+		size_t size () const { return _n; }
+		size_t pos () const { return _j; }
+		size_t dim () const { return _n; }
+		operator bool () const { return _j < _n; }
+		void reset () { _j = 0; }
+
+	private:
+		const Field              &_F;
+		size_t                    _n;
+		size_t                    _j;
+		typename Field::Element   _one;
+	};
+
+	//! Specialization of standard basis stream for sparse associative vectors
+	template <class Field, class _Vector>
+	class StandardBasisStream<Field, _Vector, VectorCategories::SparseAssociativeVectorTag > : public VectorStream<_Vector> {
+	public:
+		typedef _Vector Vector;
+		typedef StandardBasisStream<Field, Vector, VectorCategories::SparseAssociativeVectorTag > Self_t;
+
+		StandardBasisStream (Field &F, size_t n) :
+			_F (F), _n (n), _j (0)
+		{ _F.init (_one, 1); }
+
+		Vector &get (Vector &v)
+		{
+			v.clear ();
+
+			if (_j < _n)
+				v.insert (std::pair <size_t, typename Field::Element> (_j++, _one));
 
-		if (_j < _n)
-			v.insert (std::pair <size_t, typename Field::Element> (_j++, _one));
-
-		return v;
-	}
+			return v;
+		}
 
-	/** Extraction operator form
-	 */
-	Self_t &operator >> (Vector &v)
+		/** Extraction operator form
+		*/
+		Self_t &operator >> (Vector &v)
 		{ get (v); return *this; }
-	size_t pos () const { return _j; }
-	size_t size () const { return _n; }
-	size_t dim () const { return _n; }
-	operator bool () const { return _j < _n; }
-	void reset () { _j = 0; }
-
-    private:
-	const Field              &_F;
-	size_t                    _n;
-	size_t                    _j;
-	typename Field::Element   _one;
-};
-
-// Specialization of standard basis stream for sparse parallel vectors
-
-template <class Field, class _Vector>
-class StandardBasisStream<Field, _Vector, VectorCategories::SparseParallelVectorTag > : public VectorStream<_Vector>
-{
-    public:
-	typedef _Vector Vector;
-        typedef StandardBasisStream<Field, Vector, VectorCategories::SparseParallelVectorTag> Self_t;
-
-	StandardBasisStream (Field &F, size_t n)
-		: _F (F), _n (n), _j (0)
-	{ _F.init (_one, 1); }
-
-	Vector &get (Vector &v) 
-	{
-		v.first.clear ();
-		v.second.clear ();
-
-		if (_j < _n) {
-			v.first.push_back (_j++);
-			v.second.push_back (_one);
-		}
+		size_t pos () const { return _j; }
+		size_t size () const { return _n; }
+		size_t dim () const { return _n; }
+		operator bool () const { return _j < _n; }
+		void reset () { _j = 0; }
+
+	private:
+		const Field              &_F;
+		size_t                    _n;
+		size_t                    _j;
+		typename Field::Element   _one;
+	};
+
+	//! Specialization of standard basis stream for sparse parallel vectors
+	template <class Field, class _Vector>
+	class StandardBasisStream<Field, _Vector, VectorCategories::SparseParallelVectorTag > : public VectorStream<_Vector> {
+	public:
+		typedef _Vector Vector;
+		typedef StandardBasisStream<Field, Vector, VectorCategories::SparseParallelVectorTag> Self_t;
+
+		StandardBasisStream (Field &F, size_t n) :
+			_F (F), _n (n), _j (0)
+		{ _F.init (_one, 1); }
+
+		Vector &get (Vector &v)
+		{
+			v.first.clear ();
+			v.second.clear ();
+
+			if (_j < _n) {
+				v.first.push_back (_j++);
+				v.second.push_back (_one);
+			}
 
-		return v;
-	}
+			return v;
+		}
 
-	/** Extraction operator form
-	 */
-	Self_t &operator >> (Vector &v)
+		/** Extraction operator form
+		*/
+		Self_t &operator >> (Vector &v)
 		{ get (v); return *this; }
-	size_t size () const { return _n; }
-	size_t pos () const { return _j; }
-	size_t dim () const { return _n; }
-	operator bool () const { return _j < _n; }
-	void reset () { _j = 0; }
-
-    private:
-	const Field              &_F;
-	size_t                    _n;
-	size_t                    _j;
-	typename Field::Element   _one;
-};
+		size_t size () const { return _n; }
+		size_t pos () const { return _j; }
+		size_t dim () const { return _n; }
+		operator bool () const { return _j < _n; }
+		void reset () { _j = 0; }
+
+	private:
+		const Field              &_F;
+		size_t                    _n;
+		size_t                    _j;
+		typename Field::Element   _one;
+	};
 
 } // namespace LinBox
 
-#endif // __VECTOR_STREAM_H
+#endif // __LINBOX_vector_stream_H
+
diff --git a/linbox/vector/subiterator.h b/linbox/vector/subiterator.h
index a41e491..2b2b00e 100644
--- a/linbox/vector/subiterator.h
+++ b/linbox/vector/subiterator.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/vector/subiterator.h
  * Copyright (C) 2002 William J. Turner
  *
@@ -10,8 +10,8 @@
  * See COPYING for license information.
  */
 
-#ifndef __SUBITERATOR_H
-#define __SUBITERATOR_H
+#ifndef __LINBOX_subiterator_H
+#define __LINBOX_subiterator_H
 
 #include <iterator>
 #include <vector>
@@ -20,126 +20,126 @@
 namespace LinBox
 {
 
-/** \brief Subvector iterator class provides striding iterators.
-\ingroup vector
+	/** \brief Subvector iterator class provides striding iterators.
+	  \ingroup vector
 
- *  A Subiterator steps by a fixed stride thru the underlying container.
- *  Subiter<Iterator> requires that Iterator be a random access iterator class 
- *  and then itself provides the full functionality of a random access iterator
- *  class.  See STL documentation for that functionality.  
- *  Documented here is only the constructor from (1) an iterator of an 
- *  underlying container and (2) a stride amount. 
- */
-template <typename Iterator>
-class Subiterator
-{
-    public:
-	// Types
-    	
-	typedef typename std::iterator_traits<Iterator>::iterator_category	iterator_category;
-	typedef typename std::iterator_traits<Iterator>::value_type		value_type;
-	typedef typename std::iterator_traits<Iterator>::difference_type	difference_type;
-	typedef typename std::iterator_traits<Iterator>::pointer		pointer;
-	typedef typename std::iterator_traits<Iterator>::reference		reference;
-
-	// Constructors
-
-	Subiterator () {}
-
-	/** Subiterator p (pp, 3) provides an iterator which initially  has
-	 *  the same reference, but for which increments and offsets step by
-	 *  the amount stride rather than 1.  
-	 *  Thus p+k is equivalent to pp+(stride*k).
-	 * 
-	 *  Striding iterators are easily positioned beyond the bounds of the 
-	 *  underlying container.  It is up to the user to dereference the 
-	 *  iterator only when it has a valid reference.
+	 *  A Subiterator steps by a fixed stride thru the underlying container.
+	 *  Subiter<Iterator> requires that Iterator be a random access iterator class
+	 *  and then itself provides the full functionality of a random access iterator
+	 *  class.  See STL documentation for that functionality.
+	 *  Documented here is only the constructor from (1) an iterator of an
+	 *  underlying container and (2) a stride amount.
 	 */
-	Subiterator (const Iterator &iter, const difference_type& stride = 1)
-		: _iter (iter), _stride (stride) {}
-
-	template<class Iterator2>
-	Subiterator (const Subiterator<Iterator2>& iter)
-		: _iter (iter._iter), _stride (iter._stride) {}
-
-	
-	template<class Iterator2>
-	Subiterator& operator = (const Subiterator<Iterator2>& sub)
-	{
-		_iter=sub._iter;
-		_stride=sub._stride;
-		return *this;
-	}
-
-	// Access operations
-	reference operator * () const 
+	template <typename Iterator>
+	class Subiterator {
+	public:
+		// Types
+
+		typedef typename std::iterator_traits<Iterator>::iterator_category	iterator_category;
+		typedef typename std::iterator_traits<Iterator>::value_type		value_type;
+		typedef typename std::iterator_traits<Iterator>::difference_type	difference_type;
+		typedef typename std::iterator_traits<Iterator>::pointer		pointer;
+		typedef typename std::iterator_traits<Iterator>::reference		reference;
+
+		// Constructors
+
+		Subiterator () {}
+
+		/** Subiterator p (pp, 3) provides an iterator which initially  has
+		 *  the same reference, but for which increments and offsets step by
+		 *  the amount stride rather than 1.
+		 *  Thus p+k is equivalent to pp+(stride*k).
+		 *
+		 *  Striding iterators are easily positioned beyond the bounds of the
+		 *  underlying container.  It is up to the user to dereference the
+		 *  iterator only when it has a valid reference.
+		 */
+		Subiterator (const Iterator &iter, const difference_type& stride = 1) :
+		       	_iter (iter), _stride (stride) {}
+
+		template<class Iterator2>
+		Subiterator (const Subiterator<Iterator2>& iter) :
+		       	_iter (iter._iter), _stride (iter._stride) {}
+
+
+		template<class Iterator2>
+		Subiterator& operator = (const Subiterator<Iterator2>& sub)
+		{
+			_iter=sub._iter;
+			_stride=sub._stride;
+			return *this;
+		}
+
+		// Access operations
+		reference operator * () const
 		{ return *_iter; }
 
-	Iterator operator -> () const 
+		Iterator operator -> () const
 		{ return _iter; }
 
-	reference operator [] (difference_type n) const 
+		reference operator [] (difference_type n) const
 		{ return _iter[n * _stride]; }
 
-	// Iteration operations
-    	
-	Subiterator& operator ++ () 
+		// Iteration operations
+
+		Subiterator& operator ++ ()
 		{ _iter += _stride; return *this; }
-    	
-	Subiterator operator ++ (int) 
+
+		Subiterator operator ++ (int)
 		{ Subiterator tmp = *this; _iter += _stride; return tmp; }
-    	
-	Subiterator& operator -- () 
+
+		Subiterator& operator -- ()
 		{ _iter -= _stride; return *this; }
-    	
-	Subiterator operator -- (int) 
+
+		Subiterator operator -- (int)
 		{ Subiterator tmp = *this; _iter -= _stride; return tmp; }
 
-	Subiterator operator + (difference_type n) const 
+		Subiterator operator + (difference_type n) const
 		{ return Subiterator (_iter + (n * _stride), _stride); }
-    	
-	Subiterator& operator += (difference_type n) 
+
+		Subiterator& operator += (difference_type n)
 		{ _iter += (n * _stride); return *this; }
-    	
-	Subiterator operator - (difference_type n) const 
+
+		Subiterator operator - (difference_type n) const
 		{ return Subiterator (_iter - (n * _stride), _stride); }
-    	
-	difference_type operator - (const Subiterator& x) const 
+
+		difference_type operator - (const Subiterator& x) const
 		{ return (_iter - x._iter)/_stride; }
-    	
-	Subiterator& operator -= (difference_type n) 
+
+		Subiterator& operator -= (difference_type n)
 		{ _iter -= (n * _stride); return *this; }
 
-	// Comparison operations
+		// Comparison operations
 
-	bool operator == (const Subiterator& i) const 
+		bool operator == (const Subiterator& i) const
 		{ return ( (this->_stride == i._stride) && (this->_iter == i._iter) ); }
-    	
-	bool operator != (const Subiterator& i) const 
+
+		bool operator != (const Subiterator& i) const
 		{ return !(*this == i); }
-    	
-	bool operator < (const Subiterator& i) const 
+
+		bool operator < (const Subiterator& i) const
 		{ return (this->_iter < i._iter); }
-    	
-	bool operator > (const Subiterator& i) const 
+
+		bool operator > (const Subiterator& i) const
 		{ return (this->_iter > i._iter); }
-    	
-	bool operator <= (const Subiterator& i) const 
+
+		bool operator <= (const Subiterator& i) const
 		{ return (this->_iter <= i._iter); }
-    	
-	bool operator >= (const Subiterator& i) const 
+
+		bool operator >= (const Subiterator& i) const
 		{ return (this->_iter >= i._iter); }
 
-	void swap (Subiterator& x)
+		void swap (Subiterator& x)
 		{ std::swap (_iter, x._iter); std::swap (_stride, x._stride); }
-	
-    protected:
 
-	Iterator	_iter;		// wrapped iterator
-	difference_type	_stride;	// length between iterations
+	protected:
 
-}; // template <class Iterator> class Subiterator
+		Iterator	_iter;		// wrapped iterator
+		difference_type	_stride;	// length between iterations
+
+	}; // template <class Iterator> class Subiterator
 
 } // namespace LinBox
 
-#endif // __SUBITERATOR_H
+#endif // __LINBOX_subiterator_H
+
diff --git a/linbox/vector/subvector.h b/linbox/vector/subvector.h
index 186d88d..65b76e3 100644
--- a/linbox/vector/subvector.h
+++ b/linbox/vector/subvector.h
@@ -1,5 +1,5 @@
-/* -*- mode: C++; style: linux; -*- */
-
+/* -*- 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
 /* linbox/vector/subvector.h
  * Copyright (C) 2002 William J. Turner
  *
@@ -8,212 +8,230 @@
  * See COPYING for license information.
  *
  * Written by William J. Turner <wjturner at acm.org>
- * Mods by -bds 
- * Maintained by: -bds <saunders at udel.edu> 
+ * Mods by -bds
+ * Maintained by: -bds <saunders at udel.edu>
  * (where there is missing or buggy function, please contact me rather than workaround)
  */
 
-#ifndef __SUBVECTOR_H
-#define __SUBVECTOR_H
+#ifndef __LINBOX_subvector_H
+#define __LINBOX_subvector_H
 
 #include <linbox/vector/subiterator.h>
 #include <iterator>
 #include <linbox/vector/vector-traits.h>
 #include <stdexcept>
 
-namespace LinBox 	{
-//wrapper Iterator to get a const Iterator
-
-/** \brief Dense subvector 
-\ingroup vector
-
- * This class provides a statically sized subvector of a 
- * random access container (such as std::vector, deque).
- * It does not work on sparse linbox vectors.
- * It implements all of the types and methods of a std::vector
- * except for those that invalidate iterators, i.e.,
- * those (potentially) involving vector resizing, such as
- * push_back(), insert(), resize().
- */
-template <typename Iterator, typename ConstIterator = Iterator> 
-class Subvector //: public Vector // for types
+namespace LinBox
 {
-    public:
-	// Types
-	typedef typename std::iterator_traits<Iterator>::value_type value_type;
-	// should allocator_type even be offered?
-	//include <memory>
-	//typedef allocator<value_type>	allocator_type;
-    
-	typedef size_t                                              size_type;
-	typedef typename std::iterator_traits<Iterator>::difference_type difference_type;
-	typedef typename std::iterator_traits<Iterator>::pointer	    pointer;
-	typedef typename std::iterator_traits<Iterator>::reference	    reference;
-	typedef const reference	                                    const_reference;
-	typedef Iterator                                            iterator;
-	//typedef typename ConstIteratorType<Iterator>::const_iterator         const_iterator;
-
-	typedef ConstIterator                                            const_iterator;
-
-	typedef std::reverse_iterator<iterator>	                    reverse_iterator;
-	typedef std::reverse_iterator<const_iterator>               const_reverse_iterator;
-   	
-	Subvector() : _begin(Iterator ()), _end(Iterator ()) {}
-   	
-	template<class Vector>
-	Subvector (Vector& v, size_type start, size_type stride, size_type length)
-	: _begin (iterator (v.begin() + start, stride)),
-	  _end   (iterator (v.begin() + start + (stride * length), stride)) {}
-	
-	Subvector(iterator begin, iterator end) : _begin(begin), _end(end) {}
-	
-	Subvector(iterator begin, size_type length) : _begin(begin), _end(begin + length) {}
-	
-	//copy constructor
-	Subvector(const Subvector& x) : _begin(x._begin), _end(x._end) {}
-	
-	~Subvector() {}
-	
-	// Iterators
-	
-	iterator               begin  (void)       { return _begin; }
-	const_iterator         begin  (void) const { return _begin; }
-	iterator               end    (void)       { return _end; }
-	const_iterator         end    (void) const { return _end; }
-	
-	reverse_iterator       rbegin (void)       { return reverse_iterator (_end); }
-	const_reverse_iterator rbegin (void) const { return reverse_iterator (_end); }
-	reverse_iterator       rend   (void)       { return reverse_iterator (_begin); }
-	const_reverse_iterator rend   (void) const { return reverse_iterator (_begin); }
-	
-	// Element access
-	
-	reference       operator[] (size_type n)       { return _begin[n]; }
-	const_reference operator[] (size_type n) const { return _begin[n]; }
-	
-	// the method "at" does appear to be implemented 
-	// in the gnu implementation of the STL
-	reference at(size_type n)  // validity is relative to valid _begin, _end
-	{   
-		iterator p = _begin + n;
-		if ( _begin <= p && p < _end ) 
-			return *p;
-		else 
-			throw std::out_of_range(); //out of range error message.
-	}
-	
-	const_reference at(size_type n) const 
-	{
-		const_iterator p = _begin + n;
-		if ( _begin <= p && p < _end)
-			return *p;
-		else 
-			throw std::out_of_range(); //out of range error message
-	}
-	
-	reference       front (void)       { return *_begin; }
-	const_reference front (void) const { return *_begin; }
-	reference       back  (void)       { return *( _end - 1 ); }
-	const_reference back  (void) const { return *( _end - 1 ); }
-	
-	template<class Container>
-	/** assign the elements of Container one by one to *this.
-	 *  Container must be at least as long as this.
+	//wrapper Iterator to get a const Iterator
+
+	/** \brief Dense subvector
+	  \ingroup vector
+
+	 * This class provides a statically sized subvector of a
+	 * random access container (such as std::vector, deque).
+	 * It does not work on sparse linbox vectors.
+	 * It implements all of the types and methods of a std::vector
+	 * except for those that invalidate iterators, i.e.,
+	 * those (potentially) involving vector resizing, such as
+	 * push_back(), insert(), resize().
 	 */
-	Subvector& operator= (const Container& x)
-	{
-		typename Container::const_iterator q = x.begin ();
-		
-		for (iterator p = _begin (); p != _end (); ++p, ++q)
-			*p = *q;
-		
-		return *this;
-	}
-	
-	template<class Iterator2, class ConstIterator2>
-	Subvector& operator = (const Subvector<Iterator2, ConstIterator2>& sub)
+	template <typename Iterator, typename ConstIterator = Iterator>
+	class Subvector //: public Vector // for types
 	{
-		_begin=sub.begin();
-		_end=sub.end();
-		return *this;
-	}
-	
-	//		template <class In> void assign(In first, In last);
-	//		void assign(size_type n, const T& val);
-	
-	// Stack operations:  
-	// 	not implemented because they invalidate iterators
-	
-	// List operations:
-	// 	not implemented because they invalidate iterators
-	
-	// Capacity
-	// 	resize, reserve: not implemented because they 
-	// 		invalidate iterators
-	
-	//copy assignment
-	Subvector& operator=(const Subvector& sub)
-	{ _begin = sub._begin; _end = sub._end; return *this; }
-	
-	size_type size      (void) const { return _end - _begin; }
-	bool      empty     (void) const { return _end == _begin; }
-	size_type max_size  (void) const { return _end - _begin; }
-	//size_type capacity(void) const { return _end - _begin; }
-	
-	// Swap
-
-	void swap (Subvector& x)
-	{ std::swap (_begin,x._begin); std::swap(_end, x._end); }
-	
-	
-    protected:
-	
-	iterator _begin; // a subiterator of wrapped vector
-	iterator _end;	 // a subiterator of wrapped vector
-	
-}; // template <class Vector> class Subvector
-  
-// Vector traits for Subvector wrapper
-template <typename Iterator, typename ConstIterator> 
-struct VectorTraits<Subvector<Iterator, ConstIterator> >
-{ 
-	typedef VectorCategories::DenseVectorTag VectorCategory; 
-};
-  
-  /*     Equality and unequality operators may be desirable, both for raw vectors of elements
-	 and for vectors over a field with non-unique element representations.   In the latter
-	 case a vector domain can provide it thru it's areEqual predicate.  The following
-	 thought makes the valid point that raw vector equality could easily be misused.  
-	 I remain agnostic on the subject.   -bds
-
- 	 These and also < type operator comparisons are inappropriate for use
-	 by linbox programmers, since we are interested in comparing vectors
-	 of field elements not vectors of underlying representation type.
-	 Not wishing to use these functions, we don't bother to implement them.
-	 template<class Iterator>
-	 bool operator==(const Subvector<Iterator>& sub1, const Subvector<Iterator>& sub2) const;
-	 
-	 template<class Iterator>
-	 bool operator!=(const Subvector<Iterator>& sub1, const Subvector<Iterator>& sub2) const;
-  */
+	public:
+		// Types
+		typedef typename std::iterator_traits<Iterator>::value_type value_type;
+		// should allocator_type even be offered?
+		//include <memory>
+		//typedef allocator<value_type>	allocator_type;
+		typedef typename VectorCategories::DenseVectorTag VectorCategory;
+
+		typedef size_t                                              size_type;
+		typedef typename std::iterator_traits<Iterator>::difference_type difference_type;
+		typedef typename std::iterator_traits<Iterator>::pointer	    pointer;
+		typedef typename std::iterator_traits<Iterator>::reference	    reference;
+		typedef const value_type&	                                    const_reference;
+		typedef Iterator                                            iterator;
+		//typedef typename ConstIteratorType<Iterator>::const_iterator         const_iterator;
+
+		typedef ConstIterator                                            const_iterator;
+
+		typedef std::reverse_iterator<iterator>	                    reverse_iterator;
+		typedef std::reverse_iterator<const_iterator>               const_reverse_iterator;
+
+		Subvector() :
+			_begin(Iterator ()), _end(Iterator ())
+		{}
+
+		template<class Vector>
+		Subvector (Vector& v, size_type start, size_type stride, size_type length) :
+			_begin (iterator (v.begin() + start, stride)),
+			_end   (iterator (v.begin() + start + (stride * length), stride))
+		{}
+
+		Subvector(iterator begin, iterator end) :
+			_begin(begin), _end(end)
+		{}
+
+		Subvector(iterator begin, size_type length) :
+			_begin(begin), _end(begin + length)
+		{}
+
+		//copy constructor
+		Subvector(const Subvector& x) :
+			_begin(x._begin), _end(x._end)
+		{}
+
+		~Subvector() {}
+
+		// Iterators
+
+		iterator               begin  (void)       { return _begin; }
+		const_iterator         begin  (void) const { return _begin; }
+		iterator               end    (void)       { return _end; }
+		const_iterator         end    (void) const { return _end; }
+
+		reverse_iterator       rbegin (void)       { return reverse_iterator (_end); }
+		const_reverse_iterator rbegin (void) const { return reverse_iterator (_end); }
+		reverse_iterator       rend   (void)       { return reverse_iterator (_begin); }
+		const_reverse_iterator rend   (void) const { return reverse_iterator (_begin); }
+
+		// Element access
+
+		reference       operator[] (size_type n)       { return _begin[n]; }
+		const_reference operator[] (size_type n) const { return _begin[n]; }
+
+		// the method "at" does appear to be implemented
+		// in the gnu implementation of the STL
+		reference at(size_type n)  // validity is relative to valid _begin, _end
+		{
+			iterator p = _begin + n;
+			if ( _begin <= p && p < _end )
+				return *p;
+			else
+				throw std::out_of_range("out of range"); //out of range error message.
+		}
+
+		const_reference at(size_type n) const
+		{
+			const_iterator p = _begin + n;
+			if ( _begin <= p && p < _end)
+				return *p;
+			else
+				throw std::out_of_range("out of range"); //out of range error message
+		}
+
+		reference       front (void)       { return *_begin; }
+		const_reference front (void) const { return *_begin; }
+		reference       back  (void)       { return *( _end - 1 ); }
+		const_reference back  (void) const { return *( _end - 1 ); }
+
+		template<class Container>
+		/** assign the elements of Container one by one to *this.
+		 *  Container must be at least as long as this.
+		 */
+		Subvector& operator= (const Container& x)
+		{
+			typename Container::const_iterator q = x.begin ();
+
+			for (iterator p = _begin (); p != _end (); ++p, ++q)
+				*p = *q;
+
+			return *this;
+		}
+
+		template<class Iterator2, class ConstIterator2>
+		Subvector& operator = (const Subvector<Iterator2, ConstIterator2>& sub)
+		{
+			_begin=sub.begin();
+			_end=sub.end();
+			return *this;
+		}
+
+#if 0
+		template <class In> void assign(In first, In last);
+		void assign(size_type n, const T& val);
+
+		// Stack operations:
+		// 	not implemented because they invalidate iterators
+
+		// List operations:
+		// 	not implemented because they invalidate iterators
+
+		// Capacity
+		// 	resize, reserve: not implemented because they
+		// 		invalidate iterators
+#endif
+
+		//copy assignment
+		Subvector& operator=(const Subvector& sub)
+		{ _begin = sub._begin; _end = sub._end; return *this; }
+
+		size_type size      (void) const { return _end - _begin; }
+		bool      empty     (void) const { return _end == _begin; }
+		size_type max_size  (void) const { return _end - _begin; }
+		//size_type capacity(void) const { return _end - _begin; }
+
+		// Swap
+		void swap (Subvector& x)
+		{ std::swap (_begin,x._begin); std::swap(_end, x._end); }
+
+
+	protected:
+
+		iterator _begin; // a subiterator of wrapped vector
+		iterator _end;	 // a subiterator of wrapped vector
+
+	}; // template <class Vector> class Subvector
+
+	// Vector traits for Subvector wrapper
+	template <typename Iterator, typename ConstIterator>
+	struct VectorTraits<Subvector<Iterator, ConstIterator> > {
+		typedef VectorCategories::DenseVectorTag VectorCategory;
+	};
+
+	/* Equality and unequality operators may be desirable, both for raw
+	 * vectors of elements and for vectors over a field with non-unique
+	 * element representations.   In the latter case a vector domain can
+	 * provide it thru it's areEqual predicate.  The following thought
+	 * makes the valid point that raw vector equality could easily be
+	 * misused.  I remain agnostic on the subject.   -bds
+	 *
+	 * These and also < type operator comparisons are inappropriate for use
+	 * by linbox programmers, since we are interested in comparing vectors
+	 * of field elements not vectors of underlying representation type.
+	 * Not wishing to use these functions, we don't bother to implement
+	 * them.
+	 */
+#if 0
+	template<class Iterator>
+	bool operator==(const Subvector<Iterator>& sub1, const Subvector<Iterator>& sub2) const;
+
+	template<class Iterator>
+	bool operator!=(const Subvector<Iterator>& sub1, const Subvector<Iterator>& sub2) const;
+#endif
 
 } // namespace LinBox
 
 
-namespace std {
+namespace std
+{
 
 	template<class TP>
-       		void swap (TP&, TP&);
+	void swap (TP&, TP&);
 
 
 	template<class Iterator, class ConstIterator>
-	void swap ( LinBox::Subvector<Iterator, ConstIterator>& x, 
-		    LinBox::Subvector<Iterator, ConstIterator>& y ) {
+	void swap ( LinBox::Subvector<Iterator, ConstIterator>& x,
+		    LinBox::Subvector<Iterator, ConstIterator>& y )
+	{
 
 		x. swap (y);
 
-		
+
 	}
 }
-	
-#endif
+
+#endif //__LINBOX_subvector_H
+
diff --git a/linbox/vector/vector-domain.h b/linbox/vector/vector-domain.h
index af2cb3f..25cb1c9 100644
--- a/linbox/vector/vector-domain.h
+++ b/linbox/vector/vector-domain.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/vector/vector-domain.h
  * Copyright (C) 2001-2002 Bradford Hovinen
  *
@@ -13,13 +13,13 @@
  * contains all functions that require only one vector type (such as axpy, mul,
  * read, and write). VectorDomain inherits VectorDomainBase and implements
  * dotprod, which requires two vector types.
- * 
+ *
  * ------------------------------------
  * Modified by Dmitriy Morozov <linbox at foxcub.org>. May 27, 2002.
  *
  * Added the modifications for categories and vector traits that were designed
  * at the Rootbeer meeting. Added parametrization of VectorTags by VectorTraits.
- * 
+ *
  * ------------------------------------
  * 2002-06-04 Bradford Hovinen <hovinen at cis.udel.edu>
  *
@@ -37,8 +37,8 @@
  * See COPYING for license information.
  */
 
-#ifndef __FIELD_VECTOR_DOMAIN_H
-#define __FIELD_VECTOR_DOMAIN_H
+#ifndef __LINBOX_field_vector_domain_H
+#define __LINBOX_field_vector_domain_H
 
 #include <iostream>
 
@@ -57,13 +57,18 @@ namespace LinBox
 	 \ingroup vector
 	 */
 	template <class Field>
-	class VectorDomainBase 
-	{
+	class VectorDomainBase {
 	public:
-		VectorDomainBase (const Field &F)
-			: _F (F), accu(F)
+		VectorDomainBase (const Field &F) :
+			_F (F), accu(F)
 		{}
 
+		VectorDomainBase& operator= (const VectorDomainBase& VD)
+		{	_F = VD._F;
+			accu = VD.accu;
+			return *this;
+		}
+
 	protected:
 		Field _F;
 		mutable FieldAXPY<Field> accu;
@@ -81,14 +86,13 @@ namespace LinBox
 	 * class VectorDomain.
 	 */
 	template <class Field>
-	class DotProductDomain : public virtual VectorDomainBase<Field>
-	{
+	class DotProductDomain : public virtual VectorDomainBase<Field> {
 	public:
 
 		typedef typename Field::Element Element;
 
-		DotProductDomain (const Field &F)
-			: VectorDomainBase<Field> (F)
+		DotProductDomain (const Field &F) :
+			VectorDomainBase<Field> (F)
 		{}
 
 	protected:
@@ -115,41 +119,46 @@ namespace LinBox
 	 * as a template parameter and it will work as intended, though its
 	 * operation may not be fully optimized.
 	 */
-// JGD 01.10.2003 : Why inherit twice from VectorDomainBase<Field> ???
-// bds 2004Apr25 : well, g++ 3.4.3 wants explicit base domains on everything - eases that.
+	// JGD 01.10.2003 : Why inherit twice from VectorDomainBase<Field> ???
+	// bds 2004Apr25 : well, g++ 3.4.3 wants explicit base domains on everything - eases that.
 	template <class Field>
-	class VectorDomain : public virtual DotProductDomain<Field>, public virtual VectorDomainBase<Field>
-	{
-      	public:
-    
+	class VectorDomain : public virtual DotProductDomain<Field>, public virtual VectorDomainBase<Field> {
+	public:
+
 		typedef typename Field::Element         Element;
 
 		/** Copy constructor.
 		 * Constructs VectorDomain object by copying the domain.
-		 * This is required to allow matrix domain objects to be passed
+		 * This is required to allow vector domain objects to be passed
 		 * by value into functions.
-		 * @param  MD VectorDomain object.
+		 * @param  VD VectorDomain object.
 		 */
-		VectorDomain (const VectorDomain &VD)
-			: DotProductDomain<Field> (VD._F), VectorDomainBase<Field> (VD._F)
+		VectorDomain (const VectorDomain &VD) :
+			VectorDomainBase<Field> (VD._F), DotProductDomain<Field> (VD._F)
 		{}
-    
+
 		/** Assignment operator.
 		 * Assigns VectorDomain object MD to field.
-		 * @param  MD VectorDomain object.
+		 * @param  VD VectorDomain object.
 		 */
-		VectorDomain &operator = (const VectorDomain &VD) const
-			{ VectorDomainBase<Field>::_F = VD._F; VectorDomainBase<Field>::accu = VD.accu; return *this; }
+		VectorDomain &operator = (const VectorDomain &VD)
+		{
+			VectorDomainBase<Field>::_F = VD._F;
+			VectorDomainBase<Field>::accu = VD.accu;
+			return *this;
+		}
 
 		/** Retrieve the underlying field
-		 * Return a reference to the field that this matrix domain
+		 * Return a reference to the field that this vector domain
 		 * object uses
 		 * @return reference to field
 		 */
 
 		const Field &field () const
-		{ return VectorDomainBase<Field>::_F; }
-    
+		{
+			return VectorDomainBase<Field>::_F;
+		}
+
 		/** Vector input/output operations
 		 * These routines are useful for reading and writing vectors to
 		 * and from file streams. They are analagous to field read and
@@ -159,7 +168,7 @@ namespace LinBox
 		//@{
 
 		/** Print vector of field elements.
-		 * This function assumes the field element has already been 
+		 * This function assumes the field element has already been
 		 * constructed and initialized.
 		 * @return output stream to which field element is written.
 		 * @param  os  output stream to which field element is written.
@@ -167,10 +176,12 @@ namespace LinBox
 		 */
 		template <class Vector>
 		inline std::ostream &write (std::ostream &os, const Vector &x) const
-		{ return writeSpecialized (os, x, typename VectorTraits<Vector>::VectorCategory ()); }
+		{
+			return writeSpecialized (os, x, typename VectorTraits<Vector>::VectorCategory ());
+		}
 
 		/** Read vector of field elements.
-		 * This function assumes the field element has already been 
+		 * This function assumes the field element has already been
 		 * constructed and initialized.
 		 * @return input stream from which field element is read.
 		 * @param  is  input stream from which field element is read.
@@ -178,7 +189,9 @@ namespace LinBox
 		 */
 		template <class Vector>
 		inline std::istream &read (std::istream &is, Vector &x) const
-		{ return readSpecialized (is, x, typename VectorTraits<Vector>::VectorCategory ()); }
+		{
+			return readSpecialized (is, x, typename VectorTraits<Vector>::VectorCategory ());
+		}
 
 		//@} Input/Output Operations
 
@@ -190,7 +203,7 @@ namespace LinBox
 
 		//@{
 
-		/** Vector copy
+		/** Vector copy.
 		 * Copy a vector to another vector, possibly converting to a
 		 * different representation
 		 * @param res Output vector
@@ -199,11 +212,13 @@ namespace LinBox
 		 */
 		template <class Vector1, class Vector2>
 		inline Vector1 &copy (Vector1 &res, const Vector2 &v) const
-		{ return copySpecialized (res, v,
-					  typename VectorTraits<Vector1>::VectorCategory (),
-					  typename VectorTraits<Vector2>::VectorCategory ()); }
+		{
+			return copySpecialized (res, v,
+						typename VectorTraits<Vector1>::VectorCategory (),
+						typename VectorTraits<Vector2>::VectorCategory ());
+		}
 
-		/** Vector copy
+		/** Vector copy.
 		 * Copy a vector to a portion of another vector, possibly
 		 * converting to a different representation
 		 * @param res Output vector
@@ -215,45 +230,60 @@ namespace LinBox
 		 */
 		template <class Vector1, class Vector2>
 		inline Vector1 &copy (Vector1 &res, const Vector2 &v, size_t i, size_t len = 0) const
-		{ return copySpecialized (res, v, i, len,
-					  typename VectorTraits<Vector1>::VectorCategory ()); }
+		{
+			return copySpecialized (res, v, i, len,
+						typename VectorTraits<Vector1>::VectorCategory ());
+		}
 
-		/** Vector equality
+		/** Vector equality.
 		 * @param v1 Input vector
 		 * @param v2 Input vector
 		 * @returns true if and only if the vectors v1 and v2 are equal
 		 */
 		template <class Vector1, class Vector2>
 		inline bool areEqual (const Vector1 &v1, const Vector2 &v2) const
-		{ return areEqualSpecialized (v1, v2,
-					      typename VectorTraits<Vector1>::VectorCategory (),
-					      typename VectorTraits<Vector2>::VectorCategory ()); }
+		{
+			return areEqualSpecialized (v1, v2,
+						    typename VectorTraits<Vector1>::VectorCategory (),
+						    typename VectorTraits<Vector2>::VectorCategory ());
+		}
 
-		/** Vector equality with zero
+		/** Vector equality with zero.
 		 * @param v Input vector
 		 * @returns true if and only if the vector v is zero
 		 */
 		template <class Vector>
 		inline bool isZero (const Vector &v) const
-		{ return isZeroSpecialized (v, typename VectorTraits<Vector>::VectorCategory ()); }
+		{
+			return isZeroSpecialized (v, typename VectorTraits<Vector>::VectorCategory ());
+		}
 
-		/** Vector-vector dot product
+		/** Vector-vector dot product.
 		 * @param res element into which to store result
 		 * @param v1 Input vector
 		 * @param v2 Input vector
 		 */
 		template <class Vector1, class Vector2>
 		inline Element &dot (Element &res, const Vector1 &v1, const Vector2 &v2) const
-		{ return dotSpecialized (res, v1, v2,
-					 typename VectorTraits<Vector1>::VectorCategory (),
-					 typename VectorTraits<Vector2>::VectorCategory ()); }
+		{
+			return dotSpecialized (res, v1, v2,
+					       typename VectorTraits<Vector1>::VectorCategory (),
+					       typename VectorTraits<Vector2>::VectorCategory ());
+		}
 
-		/* Alias for the above, to avoid source incompatibility */
+		/** Vector-vector dot product.
+		 * Alias for the above, to avoid source incompatibility.
+		 * @param res element into which to store result
+		 * @param v1 Input vector
+		 * @param v2 Input vector
+		 */
 		template <class Vector1, class Vector2>
 		inline Element &dotprod (Element &res, const Vector1 &v1, const Vector2 &v2) const
-		{ return dot (res, v1, v2); }
+		{
+			return dot (res, v1, v2);
+		}
 
-		/** Vector add
+		/** Vector add.
 		 * res <- y + x
 		 * @param res Vector into which to store result
 		 * @param y Input vector y
@@ -261,23 +291,27 @@ namespace LinBox
 		 */
 		template <class Vector1, class Vector2, class Vector3>
 		inline Vector1 &add (Vector1 &res, const Vector2 &y, const Vector3 &x) const
-		{ return addSpecialized (res, y, x,
-					 typename VectorTraits<Vector1>::VectorCategory (),
-					 typename VectorTraits<Vector2>::VectorCategory (),
-					 typename VectorTraits<Vector3>::VectorCategory ()); }
+		{
+			return addSpecialized (res, y, x,
+					       typename VectorTraits<Vector1>::VectorCategory (),
+					       typename VectorTraits<Vector2>::VectorCategory (),
+					       typename VectorTraits<Vector3>::VectorCategory ());
+		}
 
-		/** Vector in-place add
+		/** Vector in-place add.
 		 * y <- y + x
 		 * @param y Input vector y; result is stored here
 		 * @param x Input vector x
 		 */
 		template <class Vector1, class Vector2>
 		inline Vector1 &addin (Vector1 &y, const Vector2 &x) const
-		{ return addinSpecialized (y, x,
-					   typename VectorTraits<Vector1>::VectorCategory (),
-					   typename VectorTraits<Vector2>::VectorCategory ()); }
+		{
+			return addinSpecialized (y, x,
+						 typename VectorTraits<Vector1>::VectorCategory (),
+						 typename VectorTraits<Vector2>::VectorCategory ());
+		}
 
-		/** Vector subtract
+		/** Vector subtract.
 		 * res <- y - x
 		 * @param res Vector into which to store result
 		 * @param y Input vector y
@@ -285,42 +319,50 @@ namespace LinBox
 		 */
 		template <class Vector1, class Vector2, class Vector3>
 		inline Vector1 &sub (Vector1 &res, const Vector2 &y, const Vector3 &x) const
-		{ return subSpecialized (res, y, x,
-					 typename VectorTraits<Vector1>::VectorCategory (),
-					 typename VectorTraits<Vector2>::VectorCategory (),
-					 typename VectorTraits<Vector3>::VectorCategory ()); }
+		{
+			return subSpecialized (res, y, x,
+					       typename VectorTraits<Vector1>::VectorCategory (),
+					       typename VectorTraits<Vector2>::VectorCategory (),
+					       typename VectorTraits<Vector3>::VectorCategory ());
+		}
 
-		/** Vector in-place subtract
+		/** Vector in-place subtract.
 		 * y <- y - x
 		 * @param y Input vector y; result is stored here
 		 * @param x Input vector x
 		 */
 		template <class Vector1, class Vector2>
 		inline Vector1 &subin (Vector1 &y, const Vector2 &x) const
-		{ return subinSpecialized (y, x,
-					   typename VectorTraits<Vector1>::VectorCategory (),
-					   typename VectorTraits<Vector2>::VectorCategory ()); }
+		{
+			return subinSpecialized (y, x,
+						 typename VectorTraits<Vector1>::VectorCategory (),
+						 typename VectorTraits<Vector2>::VectorCategory ());
+		}
 
-		/** Vector negate
+		/** Vector negate.
 		 * res <- -x
 		 * @param res Vector into which to store result
 		 * @param x Input vector x
 		 */
 		template <class Vector1, class Vector2>
 		inline Vector1 &neg (Vector1 &res, const Vector2 &x) const
-		{ return negSpecialized (res, x,
-					 typename VectorTraits<Vector1>::VectorCategory (),
-					 typename VectorTraits<Vector2>::VectorCategory ()); }
+		{
+			return negSpecialized (res, x,
+					       typename VectorTraits<Vector1>::VectorCategory (),
+					       typename VectorTraits<Vector2>::VectorCategory ());
+		}
 
-		/** Vector in-place negate
+		/** Vector in-place negate.
 		 * y <- -y
 		 * @param y Input vector y; result is stored here
 		 */
 		template <class Vector>
 		inline Vector &negin (Vector &y) const
-		{ return neginSpecialized (y, typename VectorTraits<Vector>::VectorCategory ()); }
+		{
+			return neginSpecialized (y, typename VectorTraits<Vector>::VectorCategory ());
+		}
 
-		/** Scalar-vector multiplication
+		/** Scalar-vector multiplication.
 		 * res <- a * x
 		 * @param res Vector into which to store result
 		 * @param x Input vector x
@@ -328,19 +370,22 @@ namespace LinBox
 		 */
 		template <class Vector1, class Vector2>
 		inline Vector1 &mul (Vector1 &res, const Vector2 &x, const Element &a) const
-		{ return mulSpecialized (res, x, a, typename VectorTraits<Vector1>::VectorCategory ()); }
+		{
+			return mulSpecialized (res, x, a, typename VectorTraits<Vector1>::VectorCategory ());
+		}
 
-		/** In-place scalar-vector multiplication
+		/** In-place scalar-vector multiplication.
 		 * x <- a * x
-		 * @param res Vector into which to store result
 		 * @param x Input vector x
 		 * @param a Input element a
 		 */
 		template <class Vector>
 		inline Vector &mulin (Vector &x, const Element &a) const
-		{ return mulinSpecialized (x, a, typename VectorTraits<Vector>::VectorCategory ()); }
+		{
+			return mulinSpecialized (x, a, typename VectorTraits<Vector>::VectorCategory ());
+		}
 
-		/** Vector axpy
+		/** Vector axpy.
 		 * res <- y + a*x
 		 * @param res Vector into which to store result
 		 * @param a Scalar element a
@@ -349,9 +394,11 @@ namespace LinBox
 		 */
 		template <class Vector1, class Vector2, class Vector3>
 		inline Vector1 &axpy (Vector1 &res, const Element &a, const Vector2 &x, const Vector3 &y) const
-		{ return axpySpecialized (res, y, a, x, typename VectorTraits<Vector1>::VectorCategory ()); }
+		{
+			return axpySpecialized (res, y, a, x, typename VectorTraits<Vector1>::VectorCategory ());
+		}
 
-		/** Vector in-place axpy
+		/** Vector in-place axpy.
 		 * y <- y + a*x
 		 * @param y Input vector y; result is stored here
 		 * @param a Scalar element a
@@ -359,9 +406,11 @@ namespace LinBox
 		 */
 		template <class Vector1, class Vector2>
 		inline Vector1 &axpyin (Vector1 &y, const Element &a, const Vector2 &x) const
-		{ return axpyinSpecialized (y, a, x,
-					    typename VectorTraits<Vector1>::VectorCategory (),
-					    typename VectorTraits<Vector2>::VectorCategory ()); }
+		{
+			return axpyinSpecialized (y, a, x,
+						  typename VectorTraits<Vector1>::VectorCategory (),
+						  typename VectorTraits<Vector2>::VectorCategory ());
+		}
 
 		//@} Vector arithmetic operations
 
@@ -372,7 +421,7 @@ namespace LinBox
 
 		//@{
 
-		/** Permutation
+		/** Permutation.
 		 *
 		 * A permutation is represented as a vector of pairs, each
 		 * pair representing a transposition.
@@ -387,10 +436,12 @@ namespace LinBox
 		 */
 		template <class Vector>
 		inline void swap (Vector &v1, Vector &v2) const
-			{ swapSpecialized (v1, v2, typename VectorTraits<Vector>::VectorCategory ()); }
+		{
+			swapSpecialized (v1, v2, typename VectorTraits<Vector>::VectorCategory ());
+		}
 
 		/** Permute the entries of a given vector using the given
-		 * permutation
+		 * permutation.
 		 *
 		 * @param v Vector to permute
 		 * @param P_start Iterator of the start of the permutation to apply
@@ -401,27 +452,41 @@ namespace LinBox
 		inline Vector &permute (Vector   &v,
 					Iterator  P_start,
 					Iterator  P_end) const
-			{ return permuteSpecialized (v, P_start, P_end,
-						     typename VectorTraits<Vector>::VectorCategory ()); }
+		{
+			return permuteSpecialized (v, P_start, P_end,
+						   typename VectorTraits<Vector>::VectorCategory ());
+		}
 
 		//@}
 
 		/** @name Implementation-Specific Methods.
-		 * These methods are not required of all \Ref{LinBox Fields}
+		 * These methods are not required of all \ref LinBox\ Fields
 		 * and are included only for this implementation of the archetype.
 		 */
 		//@{
 
-		/** Construct from a field
+		/** Construct from a field.
 		 * @param F Field from which to construct
 		 */
-		VectorDomain (const Field &F)
-			: 
-                        VectorDomainBase<Field> (F),DotProductDomain<Field> (F)
+		VectorDomain (const Field &F) :
+			VectorDomainBase<Field> (F),DotProductDomain<Field> (F)
 		{}
 
 		//@} Implementation-Specific Methods
-    
+
+		/*! Random vector.
+		 * @param v vector to be randomized.
+		 */
+		template <class Vector>
+		Vector& random(Vector& v)
+		{
+			typename Field::RandIter r(field());
+
+			typedef typename Vector::iterator iterator;
+			for (iterator p = v.begin(); p != v.end(); ++p) r.random(*p);
+			return v;
+		}
+
 	protected:
 
 		// Specialized function implementations
@@ -472,7 +537,9 @@ namespace LinBox
 		bool areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
 					  VectorCategories::DenseVectorTag,
 					  VectorCategories::SparseSequenceVectorTag) const
-		{ return areEqual (v2, v1); }
+		{
+			return areEqual (v2, v1);
+		}
 		template <class Vector1, class Vector2>
 		bool areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
 					  VectorCategories::SparseSequenceVectorTag,
@@ -490,12 +557,16 @@ namespace LinBox
 		bool areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
 					  VectorCategories::DenseVectorTag,
 					  VectorCategories::SparseAssociativeVectorTag) const
-		{ return areEqual (v2, v1); }
+		{
+			return areEqual (v2, v1);
+		}
 		template <class Vector1, class Vector2>
 		inline bool areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
 						 VectorCategories::SparseSequenceVectorTag,
 						 VectorCategories::SparseAssociativeVectorTag) const
-		{ return areEqual (v2, v1); }
+		{
+			return areEqual (v2, v1);
+		}
 		template <class Vector1, class Vector2>
 		bool areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
 					  VectorCategories::SparseAssociativeVectorTag,
@@ -509,17 +580,23 @@ namespace LinBox
 		bool areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
 					  VectorCategories::DenseVectorTag,
 					  VectorCategories::SparseParallelVectorTag) const
-		{ return areEqual (v2, v1); }
+		{
+			return areEqual (v2, v1);
+		}
 		template <class Vector1, class Vector2>
 		inline bool areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
 						 VectorCategories::SparseSequenceVectorTag,
 						 VectorCategories::SparseParallelVectorTag) const
-		{ return areEqual (v2, v1); }
+		{
+			return areEqual (v2, v1);
+		}
 		template <class Vector1, class Vector2>
 		inline bool areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
 						 VectorCategories::SparseAssociativeVectorTag,
 						 VectorCategories::SparseParallelVectorTag) const
-		{ return areEqual (v2, v1); }
+		{
+			return areEqual (v2, v1);
+		}
 		template <class Vector1, class Vector2>
 		bool areEqualSpecialized (const Vector1 &v1, const Vector2 &v2,
 					  VectorCategories::SparseParallelVectorTag,
@@ -538,7 +615,8 @@ namespace LinBox
 		inline Vector1 &copySpecialized (Vector1 &res, const Vector2 &v,
 						 VectorCategories::DenseVectorTag,
 						 VectorCategories::DenseVectorTag) const
-		{ std::copy (v.begin (), v.end (), res.begin ()); return res; }
+		{ std::copy (v.begin (), v.end (), res.begin ()); return res;
+		}
 		template <class Vector1, class Vector2>
 		Vector1 &copySpecialized (Vector1 &res, const Vector2 &v,
 					  VectorCategories::SparseSequenceVectorTag,
@@ -560,7 +638,9 @@ namespace LinBox
 		inline Vector1 &copySpecialized (Vector1 &res, const Vector2 &v,
 						 VectorCategories::SparseSequenceVectorTag,
 						 VectorCategories::SparseSequenceVectorTag) const
-		{ res.resize (v.size ()); std::copy (v.begin (), v.end (), res.begin ()); return res; }
+		{
+			res.resize (v.size ()); std::copy (v.begin (), v.end (), res.begin ()); return res;
+		}
 		template <class Vector1, class Vector2>
 		Vector1 &copySpecialized (Vector1 &res, const Vector2 &v,
 					  VectorCategories::SparseAssociativeVectorTag,
@@ -637,7 +717,9 @@ namespace LinBox
 		inline Element &dotSpecialized (Element &res, const Vector1 &v1, const Vector2 &v2,
 						VectorCategories::DenseVectorTag,
 						VectorCategories::DenseVectorTag) const
-		{ return DotProductDomain<Field>::dotSpecializedDD (res, v1, v2); }
+		{
+			return DotProductDomain<Field>::dotSpecializedDD (res, v1, v2);
+		}
 		template <class Vector1, class Vector2>
 		inline Element &dotSpecialized (Element &res, const Vector1 &v1, const Vector2 &v2,
 						VectorCategories::SparseSequenceVectorTag,
@@ -650,13 +732,17 @@ namespace LinBox
 		inline Element &dotSpecialized (Element &res, const Vector1 &v1, const Vector2 &v2,
 						VectorCategories::SparseParallelVectorTag,
 						VectorCategories::DenseVectorTag) const
-		{ return DotProductDomain<Field>::dotSpecializedDSP (res, v1, v2); }
+		{
+			return DotProductDomain<Field>::dotSpecializedDSP (res, v1, v2);
+		}
 
 		template <class Vector1, class Vector2>
 		inline Element &dotSpecialized (Element &res, const Vector1 &v1, const Vector2 &v2,
 						VectorCategories::DenseVectorTag,
 						VectorCategories::SparseSequenceVectorTag) const
-		{ return dot (res, v2, v1); }
+		{
+			return dot (res, v2, v1);
+		}
 		template <class Vector1, class Vector2>
 		inline Element &dotSpecialized (Element &res, const Vector1 &v1, const Vector2 &v2,
 						VectorCategories::SparseSequenceVectorTag,
@@ -674,12 +760,16 @@ namespace LinBox
 		inline Element &dotSpecialized (Element &res, const Vector1 &v1, const Vector2 &v2,
 						VectorCategories::DenseVectorTag,
 						VectorCategories::SparseAssociativeVectorTag) const
-		{ return dot (res, v2, v1); }
+		{
+			return dot (res, v2, v1);
+		}
 		template <class Vector1, class Vector2>
 		inline Element &dotSpecialized (Element &res, const Vector1 &v1, const Vector2 &v2,
 						VectorCategories::SparseSequenceVectorTag,
 						VectorCategories::SparseAssociativeVectorTag) const
-		{ return dot (res, v2, v1); }
+		{
+			return dot (res, v2, v1);
+		}
 		template <class Vector1, class Vector2>
 		inline Element &dotSpecialized (Element &res, const Vector1 &v1, const Vector2 &v2,
 						VectorCategories::SparseAssociativeVectorTag,
@@ -693,17 +783,23 @@ namespace LinBox
 		inline Element &dotSpecialized (Element &res, const Vector1 &v1, const Vector2 &v2,
 						VectorCategories::DenseVectorTag,
 						VectorCategories::SparseParallelVectorTag) const
-		{ return dot (res, v2, v1); }
+		{
+			return dot (res, v2, v1);
+		}
 		template <class Vector1, class Vector2>
 		inline Element &dotSpecialized (Element &res, const Vector1 &v1, const Vector2 &v2,
 						VectorCategories::SparseSequenceVectorTag,
 						VectorCategories::SparseParallelVectorTag) const
-		{ return dot (res, v2, v1); }
+		{
+			return dot (res, v2, v1);
+		}
 		template <class Vector1, class Vector2>
 		inline Element &dotSpecialized (Element &res, const Vector1 &v1, const Vector2 &v2,
 						VectorCategories::SparseAssociativeVectorTag,
 						VectorCategories::SparseParallelVectorTag) const
-		{ return dot (res, v2, v1); }
+		{
+			return dot (res, v2, v1);
+		}
 		template <class Vector1, class Vector2>
 		inline Element &dotSpecialized (Element &res, const Vector1 &v1, const Vector2 &v2,
 						VectorCategories::SparseParallelVectorTag,
@@ -1114,33 +1210,34 @@ namespace LinBox
 			return y;
 		}
 
-		template <class Vector>
+		template<class Vector>
 		inline void swapSpecialized (Vector &v1, Vector &v2,
 					     VectorCategories::DenseVectorTag) const;
-		template <class Vector>
-		inline void swapSpecialized (Vector &v1, Vector &v2,
+
+		template<class _Vector> // BB : nvcc not happy with class Vector (and I agree :))
+		inline void swapSpecialized (_Vector &v1, _Vector &v2,
 					     VectorCategories::SparseSequenceVectorTag) const
 		{
 			typename LinBox::Vector<Field>::SparseSeq t;
 			t = v1; v1 = v2; v2 = t;
 		}
 
-		template <class Vector>
-		inline void swapSpecialized (Vector &v1, Vector &v2,
+		template <class _Vector>
+		inline void swapSpecialized (_Vector &v1, _Vector &v2,
 					     VectorCategories::SparseAssociativeVectorTag) const
 		{
 			typename LinBox::Vector<Field>::SparseMap t;
 			t = v1; v1 = v2; v2 = t;
 		}
 
-		template <class Vector>
-		inline void swapSpecialized (Vector &v1, Vector &v2,
+		template <class _Vector>
+		inline void swapSpecialized (_Vector &v1, _Vector &v2,
 					     VectorCategories::SparseParallelVectorTag) const
 		{
 			typename LinBox::Vector<Field>::SparsePar t;
 			t = v1; v1 = v2; v2 = t;
 		}
-	
+
 		template <class Vector, class Iterator>
 		inline Vector &permuteSpecialized (Vector   &v,
 						   Iterator  P_start,
@@ -1167,4 +1264,5 @@ namespace LinBox
 
 #include "linbox/vector/vector-domain.inl"
 
-#endif // __FIELD_MATRIX_DOMAIN_H
+#endif // __LINBOX_field_vector_domain_H
+
diff --git a/linbox/vector/vector-domain.inl b/linbox/vector/vector-domain.inl
index ea5c4d9..7dfb8df 100644
--- a/linbox/vector/vector-domain.inl
+++ b/linbox/vector/vector-domain.inl
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/vector/vector-domain.inl
  * Copyright (C) 2001-2002 Bradford Hovinen
  *
@@ -14,9 +14,9 @@
  * ------------------------------------
  * Modified by Dmitriy Morozov <linbox at foxcub.org>
  *
- * Added the modifications for categories and vector traits that were designed 
+ * Added the modifications for categories and vector traits that were designed
  * at the Rootbeer meeting. Added parametrization of VectorTags by VectorTraits.
- * 
+ *
  * ------------------------------------
  * 2002-06-04 Bradford Hovinen <hovinen at cis.udel.edu>
  *
@@ -24,12 +24,12 @@
  * vector-domain.h  This means the functions each take a parameter tag (or, for
  * dot product, tag1 and tag2) that allows specialization by vector type.
  * ------------------------------------
- * 
+ *
  * See COPYING for license information.
  */
 
-#ifndef __FIELD_VECTOR_DOMAIN_C
-#define __FIELD_VECTOR_DOMAIN_C
+#ifndef __LINBOX_field_vector_domain_INL
+#define __LINBOX_field_vector_domain_INL
 
 #include "linbox/linbox-config.h"
 
@@ -877,7 +877,8 @@ namespace LinBox
 	{
 		if (i == 0 && len == 0) {
 			copy (res, v);
-		} else {
+		}
+		else {
 			Vector1 res_part;
 
 			copy (res_part, v);
@@ -905,7 +906,7 @@ namespace LinBox
 			part_end = res_part.end ();
 		else
 			part_end = std::lower_bound (res_part.begin (), res_part.end (), len,
-						    VectorWrapper::CompareSparseEntries<Element> ());
+						     VectorWrapper::CompareSparseEntries<Element> ());
 
 		for (iter = res_part.begin (); iter != part_end; iter++)
 			iter->first += i;
@@ -961,7 +962,8 @@ namespace LinBox
 		if (len == 0) {
 			part_idx_end = res_part.first.end ();
 			part_elt_end = res_part.second.end ();
-		} else {
+		}
+		else {
 			part_idx_end = std::lower_bound (res_part.first.begin (), res_part.first.end (), len);
 			part_elt_end = res_part.second.begin () + (part_idx_end - res_part.first.begin ());
 		}
@@ -1055,7 +1057,8 @@ namespace LinBox
 		if (len == 0) {
 			v_idx_end = v.first.end ();
 			v_elt_end = v.second.end ();
-		} else {
+		}
+		else {
 			v_idx_end = std::lower_bound (v.first.begin (), v.first.end (), len);
 			v_elt_end = v.second.begin () + (v_idx_end - v.first.begin ());
 		}
@@ -1125,7 +1128,8 @@ namespace LinBox
 				if (!VectorDomainBase<Field>::_F.isZero (tmp))
 					res.push_back (std::pair <size_t, Element> (j->first, tmp));
 				i++;
-			} else {
+			}
+			else {
 				res.push_back (*j);
 			}
 		}
@@ -1160,7 +1164,8 @@ namespace LinBox
 			if (i != y.end () && i->first == j->first) {
 				res[j->first] = VectorDomainBase<Field>::_F.add (tmp, i->second, j->second);
 				i++;
-			} else {
+			}
+			else {
 				res[j->first] = j->second;
 			}
 		}
@@ -1203,7 +1208,8 @@ namespace LinBox
 					res.second.push_back (tmp);
 				}
 				++i_idx; ++i_elt;
-			} else {
+			}
+			else {
 				res.first.push_back (*j_idx);
 				res.second.push_back (*j_elt);
 			}
@@ -1326,7 +1332,8 @@ namespace LinBox
 				if (!VectorDomainBase<Field>::_F.isZero (tmp))
 					res.push_back (std::pair <size_t, Element> (j->first, tmp));
 				i++;
-			} else {
+			}
+			else {
 				res.push_back (std::pair <size_t, Element> (j->first, VectorDomainBase<Field>::_F.neg (tmp, j->second)));
 			}
 		}
@@ -1361,7 +1368,8 @@ namespace LinBox
 			if (i != y.end () && i->first == j->first) {
 				res[j->first] = VectorDomainBase<Field>::_F.sub (tmp, i->second, j->second);
 				i++;
-			} else {
+			}
+			else {
 				res[j->first] = VectorDomainBase<Field>::_F.neg (tmp, j->second);
 			}
 		}
@@ -1404,7 +1412,8 @@ namespace LinBox
 					res.second.push_back (tmp);
 				}
 				++i_idx; ++i_elt;
-			} else {
+			}
+			else {
 				res.first.push_back (*j_idx);
 				res.second.push_back (VectorDomainBase<Field>::_F.neg (tmp, *j_elt));
 			}
@@ -1610,16 +1619,16 @@ namespace LinBox
 	template <class Field>
 	template <class Vector1, class Vector2>
 	Vector1 &VectorDomain<Field>::mulSpecialized
-		(Vector1                                 &res,
-		 const Vector2                           &x,
-		 const typename Field::Element           &a,
-		 VectorCategories::DenseVectorTag  tag) const
+	(Vector1                                 &res,
+	 const Vector2                           &x,
+	 const typename Field::Element           &a,
+	 VectorCategories::DenseVectorTag  ) const
 	{
 		typename Vector2::const_iterator i;
 		typename Vector1::iterator j;
 
 		linbox_check (res.size () == x.size ());
-	
+
 		for (i = x.begin (), j = res.begin (); i != x.end (); ++i, ++j)
 			VectorDomainBase<Field>::_F.mul (*j, *i, a);
 
@@ -1629,10 +1638,10 @@ namespace LinBox
 	template <class Field>
 	template <class Vector1, class Vector2>
 	Vector1 &VectorDomain<Field>::mulSpecialized
-		(Vector1                                          &res,
-		 const Vector2                                    &x,
-		 const typename Field::Element                    &a,
-		 VectorCategories::SparseSequenceVectorTag  tag) const
+	(Vector1                                          &res,
+	 const Vector2                                    &x,
+	 const typename Field::Element                    &a,
+	 VectorCategories::SparseSequenceVectorTag  ) const
 	{
 		typename Vector2::const_iterator i;
 		Element tmp;
@@ -1651,10 +1660,10 @@ namespace LinBox
 	template <class Field>
 	template <class Vector1, class Vector2>
 	Vector1 &VectorDomain<Field>::mulSpecialized
-		(Vector1                                             &res,
-		 const Vector2                                       &x,
-		 const typename Field::Element                       &a,
-		 VectorCategories::SparseAssociativeVectorTag  tag) const
+	(Vector1                                             &res,
+	 const Vector2                                       &x,
+	 const typename Field::Element                       &a,
+	 VectorCategories::SparseAssociativeVectorTag  ) const
 	{
 		typename Vector2::const_iterator i;
 		Element tmp;
@@ -1673,10 +1682,10 @@ namespace LinBox
 	template <class Field>
 	template <class Vector1, class Vector2>
 	Vector1 &VectorDomain<Field>::mulSpecialized
-		(Vector1                                          &res,
-		 const Vector2                                    &x,
-		 const typename Field::Element                    &a,
-		 VectorCategories::SparseParallelVectorTag  tag) const
+	(Vector1                                          &res,
+	 const Vector2                                    &x,
+	 const typename Field::Element                    &a,
+	 VectorCategories::SparseParallelVectorTag  ) const
 	{
 		typename Vector2::first_type::const_iterator i_idx;
 		typename Vector2::second_type::const_iterator i_elt;
@@ -1700,9 +1709,9 @@ namespace LinBox
 	template <class Field>
 	template <class Vector>
 	Vector &VectorDomain<Field>::mulinSpecialized
-		(Vector                                  &x,
-		 const typename Field::Element           &a,
-		 VectorCategories::DenseVectorTag  tag) const
+	(Vector                                  &x,
+	 const typename Field::Element           &a,
+	 VectorCategories::DenseVectorTag  ) const
 	{
 		typename Vector::iterator i;
 
@@ -1715,9 +1724,9 @@ namespace LinBox
 	template <class Field>
 	template <class Vector>
 	Vector &VectorDomain<Field>::mulinSpecialized
-		(Vector                                           &x,
-		 const typename Field::Element                    &a,
-		 VectorCategories::SparseSequenceVectorTag  tag) const
+	(Vector                                           &x,
+	 const typename Field::Element                    &a,
+	 VectorCategories::SparseSequenceVectorTag  ) const
 	{
 		typename Vector::iterator i;
 
@@ -1735,9 +1744,9 @@ namespace LinBox
 	template <class Field>
 	template <class Vector>
 	Vector &VectorDomain<Field>::mulinSpecialized
-		(Vector                                              &x,
-		 const typename Field::Element                       &a,
-		 VectorCategories::SparseAssociativeVectorTag  tag) const
+	(Vector                                              &x,
+	 const typename Field::Element                       &a,
+	 VectorCategories::SparseAssociativeVectorTag  ) const
 	{
 		typename Vector::iterator i;
 
@@ -1755,9 +1764,9 @@ namespace LinBox
 	template <class Field>
 	template <class Vector>
 	Vector &VectorDomain<Field>::mulinSpecialized
-		(Vector                                           &x,
-		 const typename Field::Element                    &a,
-		 VectorCategories::SparseParallelVectorTag  tag) const
+	(Vector                                           &x,
+	 const typename Field::Element                    &a,
+	 VectorCategories::SparseParallelVectorTag  ) const
 	{
 		typename Vector::second_type::iterator i;
 
@@ -1776,11 +1785,11 @@ namespace LinBox
 	template <class Field>
 	template <class Vector1, class Vector2, class Vector3>
 	Vector1 &VectorDomain<Field>::axpySpecialized
-		(Vector1                                 &res,
-		 const Vector2                           &y,
-		 const typename Field::Element           &a,
-		 const Vector3                           &x,
-		 VectorCategories::DenseVectorTag  tag) const
+	(Vector1                                 &res,
+	 const Vector2                           &y,
+	 const typename Field::Element           &a,
+	 const Vector3                           &x,
+	 VectorCategories::DenseVectorTag  ) const
 	{
 		typename Vector2::const_iterator i;
 		typename Vector3::const_iterator j;
@@ -1798,11 +1807,11 @@ namespace LinBox
 	template <class Field>
 	template <class Vector1, class Vector2, class Vector3>
 	Vector1 &VectorDomain<Field>::axpySpecialized
-		(Vector1                                          &res,
-		 const Vector2                                    &y,
-		 const typename Field::Element                    &a,
-		 const Vector3                                    &x,
-		 VectorCategories::SparseSequenceVectorTag  tag) const
+	(Vector1                                          &res,
+	 const Vector2                                    &y,
+	 const typename Field::Element                    &a,
+	 const Vector3                                    &x,
+	 VectorCategories::SparseSequenceVectorTag  ) const
 	{
 		typename Vector2::const_iterator i;
 		typename Vector3::const_iterator j;
@@ -1838,11 +1847,11 @@ namespace LinBox
 	template <class Field>
 	template <class Vector1, class Vector2, class Vector3>
 	Vector1 &VectorDomain<Field>::axpySpecialized
-		(Vector1                                             &res,
-		 const Vector2                                       &y,
-		 const typename Field::Element                       &a,
-		 const Vector3                                       &x,
-		 VectorCategories::SparseAssociativeVectorTag  tag) const
+	(Vector1                                             &res,
+	 const Vector2                                       &y,
+	 const typename Field::Element                       &a,
+	 const Vector3                                       &x,
+	 VectorCategories::SparseAssociativeVectorTag  ) const
 	{
 		typename Vector2::const_iterator i;
 		typename Vector3::const_iterator j;
@@ -1874,11 +1883,11 @@ namespace LinBox
 	template <class Field>
 	template <class Vector1, class Vector2, class Vector3>
 	Vector1 &VectorDomain<Field>::axpySpecialized
-		(Vector1                                          &res, 	
-		 const Vector2                                    &y,
-		 const typename Field::Element                    &a,
-		 const Vector3                                    &x,
-		 VectorCategories::SparseParallelVectorTag  tag) const
+	(Vector1                                          &res,
+	 const Vector2                                    &y,
+	 const typename Field::Element                    &a,
+	 const Vector3                                    &x,
+	 VectorCategories::SparseParallelVectorTag  ) const
 	{
 		typename Vector2::first_type::const_iterator i_idx = y.first.begin ();
 		typename Vector3::first_type::const_iterator j_idx = x.first.begin ();
@@ -1903,7 +1912,8 @@ namespace LinBox
 					res.second.push_back (tmp);
 				}
 				++i_idx; ++i_elt;
-			} else {
+			}
+			else {
 				res.first.push_back (*j_idx);
 				res.second.push_back (VectorDomainBase<Field>::_F.mul (tmp, *j_elt, a));
 			}
@@ -1921,11 +1931,11 @@ namespace LinBox
 	template <class Field>
 	template <class Vector1, class Vector2>
 	Vector1 &VectorDomain<Field>::axpyinSpecialized
-		(Vector1                                 &y,
-		 const typename Field::Element           &a,
-		 const Vector2                           &x,
-		 VectorCategories::DenseVectorTag,
-		 VectorCategories::DenseVectorTag) const
+	(Vector1                                 &y,
+	 const typename Field::Element           &a,
+	 const Vector2                           &x,
+	 VectorCategories::DenseVectorTag,
+	 VectorCategories::DenseVectorTag) const
 	{
 		typename Vector1::iterator i;
 		typename Vector2::const_iterator j;
@@ -1941,11 +1951,11 @@ namespace LinBox
 	template <class Field>
 	template <class Vector1, class Vector2>
 	Vector1 &VectorDomain<Field>::axpyinSpecialized
-		(Vector1                                 &y,
-		 const typename Field::Element           &a,
-		 const Vector2                           &x,
-		 VectorCategories::DenseVectorTag,
-		 VectorCategories::SparseSequenceVectorTag) const
+	(Vector1                                 &y,
+	 const typename Field::Element           &a,
+	 const Vector2                           &x,
+	 VectorCategories::DenseVectorTag,
+	 VectorCategories::SparseSequenceVectorTag) const
 	{
 		typename Vector2::const_iterator j;
 
@@ -1958,11 +1968,11 @@ namespace LinBox
 	template <class Field>
 	template <class Vector1, class Vector2>
 	Vector1 &VectorDomain<Field>::axpyinSpecialized
-		(Vector1                                 &y,
-		 const typename Field::Element           &a,
-		 const Vector2                           &x,
-		 VectorCategories::DenseVectorTag,
-		 VectorCategories::SparseAssociativeVectorTag) const
+	(Vector1                                 &y,
+	 const typename Field::Element           &a,
+	 const Vector2                           &x,
+	 VectorCategories::DenseVectorTag,
+	 VectorCategories::SparseAssociativeVectorTag) const
 	{
 		typename Vector2::const_iterator j;
 
@@ -1975,11 +1985,11 @@ namespace LinBox
 	template <class Field>
 	template <class Vector1, class Vector2>
 	Vector1 &VectorDomain<Field>::axpyinSpecialized
-		(Vector1                                 &y,
-		 const typename Field::Element           &a,
-		 const Vector2                           &x,
-		 VectorCategories::DenseVectorTag,
-		 VectorCategories::SparseParallelVectorTag) const
+	(Vector1                                 &y,
+	 const typename Field::Element           &a,
+	 const Vector2                           &x,
+	 VectorCategories::DenseVectorTag,
+	 VectorCategories::SparseParallelVectorTag) const
 	{
 		typename Vector2::first_type::const_iterator j_idx = x.first.begin ();
 		typename Vector2::second_type::const_iterator j_elt = x.second.begin ();
@@ -1993,11 +2003,11 @@ namespace LinBox
 	template <class Field>
 	template <class Vector1, class Vector2>
 	Vector1 &VectorDomain<Field>::axpyinSpecialized
-		(Vector1                                          &y,
-		 const typename Field::Element                    &a,
-		 const Vector2                                    &x,
-		 VectorCategories::SparseSequenceVectorTag,
-		 VectorCategories::SparseSequenceVectorTag) const
+	(Vector1                                          &y,
+	 const typename Field::Element                    &a,
+	 const Vector2                                    &x,
+	 VectorCategories::SparseSequenceVectorTag,
+	 VectorCategories::SparseSequenceVectorTag) const
 	{
 		Vector1 res;
 
@@ -2009,11 +2019,11 @@ namespace LinBox
 	template <class Field>
 	template <class Vector1, class Vector2>
 	Vector1 &VectorDomain<Field>::axpyinSpecialized
-		(Vector1                                             &y,
-		 const typename Field::Element                       &a,
-		 const Vector2                                       &x,
-		 VectorCategories::SparseAssociativeVectorTag,
-		 VectorCategories::SparseAssociativeVectorTag) const
+	(Vector1                                             &y,
+	 const typename Field::Element                       &a,
+	 const Vector2                                       &x,
+	 VectorCategories::SparseAssociativeVectorTag,
+	 VectorCategories::SparseAssociativeVectorTag) const
 	{
 		typename Vector1::iterator i;
 		typename Vector2::const_iterator j;
@@ -2039,11 +2049,11 @@ namespace LinBox
 	template <class Field>
 	template <class Vector1, class Vector2>
 	Vector1 &VectorDomain<Field>::axpyinSpecialized
-		(Vector1                                          &y,
-		 const typename Field::Element                    &a,
-		 const Vector2                                    &x,
-		 VectorCategories::SparseParallelVectorTag,
-		 VectorCategories::SparseParallelVectorTag) const
+	(Vector1                                          &y,
+	 const typename Field::Element                    &a,
+	 const Vector2                                    &x,
+	 VectorCategories::SparseParallelVectorTag,
+	 VectorCategories::SparseParallelVectorTag) const
 	{
 		Vector1 res;
 
@@ -2055,9 +2065,9 @@ namespace LinBox
 	template <class Field>
 	template <class Vector1, class Vector2>
 	inline typename Field::Element &DotProductDomain<Field>::dotSpecializedDD
-		(Element                                  &res,
-		 const Vector1                            &v1,
-		 const Vector2                            &v2) const
+	(Element                                  &res,
+	 const Vector1                            &v1,
+	 const Vector2                            &v2) const
 	{
 		typename Vector1::const_iterator i;
 		typename Vector2::const_iterator j;
@@ -2074,14 +2084,14 @@ namespace LinBox
 	template <class Field>
 	template <class Vector1, class Vector2>
 	inline typename Field::Element &VectorDomain<Field>::dotSpecialized
-		(Element                                           &res,
-		 const Vector1                                     &v1,
-		 const Vector2                                     &v2,
-		 VectorCategories::SparseSequenceVectorTag  tag1,
-		 VectorCategories::DenseVectorTag           tag2) const
+	(Element                                           &res,
+	 const Vector1                                     &v1,
+	 const Vector2                                     &v2,
+	 VectorCategories::SparseSequenceVectorTag  ,
+	 VectorCategories::DenseVectorTag           ) const
 	{
 		typename Vector1::const_iterator i;
-		
+
 		VectorDomainBase<Field>::accu.reset();
 
 		for (i = v1.begin (); i != v1.end (); i++)
@@ -2093,11 +2103,11 @@ namespace LinBox
 	template <class Field>
 	template <class Vector1, class Vector2>
 	inline typename Field::Element &VectorDomain<Field>::dotSpecialized
-		(Element                                              &res,
-		 const Vector1                                        &v1,
-		 const Vector2                                        &v2,
-		 VectorCategories::SparseAssociativeVectorTag  tag1,
-		 VectorCategories::DenseVectorTag              tag2) const
+	(Element                                              &res,
+	 const Vector1                                        &v1,
+	 const Vector2                                        &v2,
+	 VectorCategories::SparseAssociativeVectorTag  ,
+	 VectorCategories::DenseVectorTag              ) const
 	{
 		typename Vector1::const_iterator i;
 		VectorDomainBase<Field>::accu.reset();
@@ -2111,9 +2121,9 @@ namespace LinBox
 	template <class Field>
 	template <class Vector1, class Vector2>
 	inline typename Field::Element &DotProductDomain<Field>::dotSpecializedDSP
-		(Element                                           &res,
-		 const Vector1                                     &v1,
-		 const Vector2                                     &v2) const
+	(Element                                           &res,
+	 const Vector1                                     &v1,
+	 const Vector2                                     &v2) const
 	{
 		typename Vector1::first_type::const_iterator i_idx;
 		typename Vector1::second_type::const_iterator i_elt;
@@ -2128,11 +2138,11 @@ namespace LinBox
 	template <class Field>
 	template <class Vector1, class Vector2>
 	inline typename Field::Element &VectorDomain<Field>::dotSpecialized
-		(Element                                              &res,
-		 const Vector1                                        &v1,
-		 const Vector2                                        &v2,
-		 VectorCategories::SparseSequenceVectorTag     tag1,
-		 VectorCategories::SparseSequenceVectorTag     tag2) const
+	(Element                                              &res,
+	 const Vector1                                        &v1,
+	 const Vector2                                        &v2,
+	 VectorCategories::SparseSequenceVectorTag     ,
+	 VectorCategories::SparseSequenceVectorTag     ) const
 	{
 		typename Vector1::const_iterator i;
 		typename Vector2::const_iterator j;
@@ -2151,11 +2161,11 @@ namespace LinBox
 	template <class Field>
 	template <class Vector1, class Vector2>
 	inline typename Field::Element &VectorDomain<Field>::dotSpecialized
-		(Element                                              &res,
-		 const Vector1                                        &v1,
-		 const Vector2                                        &v2,
-		 VectorCategories::SparseAssociativeVectorTag  tag1,
-		 VectorCategories::SparseSequenceVectorTag     tag2) const
+	(Element                                              &res,
+	 const Vector1                                        &v1,
+	 const Vector2                                        &v2,
+	 VectorCategories::SparseAssociativeVectorTag  ,
+	 VectorCategories::SparseSequenceVectorTag     ) const
 	{
 		typename Vector1::const_iterator i;
 		typename Vector2::const_iterator j;
@@ -2174,11 +2184,11 @@ namespace LinBox
 	template <class Field>
 	template <class Vector1, class Vector2>
 	inline typename Field::Element &VectorDomain<Field>::dotSpecialized
-		(Element                                              &res,
-		 const Vector1                                        &v1,
-		 const Vector2                                        &v2,
-		 VectorCategories::SparseParallelVectorTag     tag1,
-		 VectorCategories::SparseSequenceVectorTag     tag2) const
+	(Element                                              &res,
+	 const Vector1                                        &v1,
+	 const Vector2                                        &v2,
+	 VectorCategories::SparseParallelVectorTag     ,
+	 VectorCategories::SparseSequenceVectorTag     ) const
 	{
 		typename Vector1::first_type::const_iterator i_idx = v1.first.begin ();
 		typename Vector1::second_type::const_iterator i_elt = v1.second.begin ();
@@ -2198,11 +2208,11 @@ namespace LinBox
 	template <class Field>
 	template <class Vector1, class Vector2>
 	inline typename Field::Element &VectorDomain<Field>::dotSpecialized
-		(Element                                              &res,
-		 const Vector1                                        &v1,
-		 const Vector2                                        &v2,
-		 VectorCategories::SparseAssociativeVectorTag  tag1,
-		 VectorCategories::SparseAssociativeVectorTag  tag2) const
+	(Element                                              &res,
+	 const Vector1                                        &v1,
+	 const Vector2                                        &v2,
+	 VectorCategories::SparseAssociativeVectorTag  ,
+	 VectorCategories::SparseAssociativeVectorTag  ) const
 	{
 		typename Vector1::const_iterator i;
 		typename Vector2::const_iterator j;
@@ -2221,11 +2231,11 @@ namespace LinBox
 	template <class Field>
 	template <class Vector1, class Vector2>
 	inline typename Field::Element &VectorDomain<Field>::dotSpecialized
-		(Element                                              &res,
-		 const Vector1                                        &v1,
-		 const Vector2                                        &v2,
-		 VectorCategories::SparseParallelVectorTag     tag1,
-		 VectorCategories::SparseAssociativeVectorTag  tag2) const
+	(Element                                              &res,
+	 const Vector1                                        &v1,
+	 const Vector2                                        &v2,
+	 VectorCategories::SparseParallelVectorTag     ,
+	 VectorCategories::SparseAssociativeVectorTag  ) const
 	{
 		typename Vector1::first_type::const_iterator i_idx = v1.first.begin ();
 		typename Vector1::second_type::const_iterator i_elt = v1.second.begin ();
@@ -2245,11 +2255,11 @@ namespace LinBox
 	template <class Field>
 	template <class Vector1, class Vector2>
 	inline typename Field::Element &VectorDomain<Field>::dotSpecialized
-		(Element                                              &res,
-		 const Vector1                                        &v1,
-		 const Vector2                                        &v2,
-		 VectorCategories::SparseParallelVectorTag     tag1,
-		 VectorCategories::SparseParallelVectorTag     tag2) const
+	(Element                                              &res,
+	 const Vector1                                        &v1,
+	 const Vector2                                        &v2,
+	 VectorCategories::SparseParallelVectorTag     ,
+	 VectorCategories::SparseParallelVectorTag     ) const
 	{
 		typename Vector1::first_type::const_iterator i_idx = v1.first.begin ();
 		typename Vector1::second_type::const_iterator i_elt = v1.second.begin ();
@@ -2272,8 +2282,8 @@ namespace LinBox
 	template <class Field>
 	template <class Vector>
 	inline void VectorDomain<Field>::swapSpecialized
-		(Vector &v1, Vector &v2,
-		 VectorCategories::DenseVectorTag) const 
+	(Vector &v1, Vector &v2,
+	 VectorCategories::DenseVectorTag) const
 	{
 		typename Vector::iterator j, k;
 
@@ -2284,8 +2294,8 @@ namespace LinBox
 	template <class Field>
 	template <class Vector, class Iterator>
 	inline Vector &VectorDomain<Field>::permuteSpecialized
-		(Vector &v, Iterator P_start, Iterator P_end,
-		 VectorCategories::DenseVectorTag) const 
+	(Vector &v, Iterator P_start, Iterator P_end,
+	 VectorCategories::DenseVectorTag) const
 	{
 		Iterator i;
 
@@ -2296,10 +2306,10 @@ namespace LinBox
 	}
 
 	template <class Field>
-	template <class Vector, class Iterator>
-	inline Vector &VectorDomain<Field>::permuteSpecialized
-		(Vector &v, Iterator P_start, Iterator P_end,
-		 VectorCategories::SparseSequenceVectorTag) const 
+	template <class _Vector, class Iterator>
+	inline _Vector &VectorDomain<Field>::permuteSpecialized
+	(_Vector &v, Iterator P_start, Iterator P_end,
+	 VectorCategories::SparseSequenceVectorTag) const
 	{
 		unsigned int max = 0;
 
@@ -2315,10 +2325,10 @@ namespace LinBox
 	}
 
 	template <class Field>
-	template <class Vector, class Iterator>
-	inline Vector &VectorDomain<Field>::permuteSpecialized
-		(Vector &v, Iterator P_start, Iterator P_end,
-		 VectorCategories::SparseAssociativeVectorTag) const 
+	template <class _Vector, class Iterator>
+	inline _Vector &VectorDomain<Field>::permuteSpecialized
+	(_Vector &v, Iterator P_start, Iterator P_end,
+	 VectorCategories::SparseAssociativeVectorTag) const
 	{
 		unsigned int max = 0;
 
@@ -2334,15 +2344,15 @@ namespace LinBox
 	}
 
 	template <class Field>
-	template <class Vector, class Iterator>
-	inline Vector &VectorDomain<Field>::permuteSpecialized
-		(Vector &v, Iterator P_start, Iterator P_end,
-		 VectorCategories::SparseParallelVectorTag) const 
+	template <class _Vector, class Iterator>
+	inline _Vector &VectorDomain<Field>::permuteSpecialized
+	(_Vector &v, Iterator P_start, Iterator P_end,
+	 VectorCategories::SparseParallelVectorTag) const
 	{
 		unsigned int max = 0;
 
 		//z.w. Does it require max bigger the maximal index of v?
-		if (v. first. size() > 0) 
+		if (v. first. size() > 0)
 			max = *std::max_element(v. first. begin(), v. first. end());
 
 		for (Iterator i = P_start; i != P_end; ++i)
@@ -2359,4 +2369,5 @@ namespace LinBox
 
 } // namespace LinBox
 
-#endif // __FIELD_VECTOR_DOMAIN_H
+#endif // __LINBOX_field_vector_domain_INL
+
diff --git a/linbox/vector/vector-traits.h b/linbox/vector/vector-traits.h
index b70b76f..5451173 100644
--- a/linbox/vector/vector-traits.h
+++ b/linbox/vector/vector-traits.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/vector/vector-traits.h
  * Copyright (C) 1999-2001 William J Turner,
  *               2001-2002 Bradford Hovinen
@@ -14,15 +14,17 @@
  * and added typedef of those parameters to Traits. So now VectorCategory
  * for each vector has a "reference" back to the VectorTrait of each specific
  * vector (list of pairs, deque of pairs, etc.) through a typedef Trait. This
- * allows for generic manipulation of all vectors and placing the 
+ * allows for generic manipulation of all vectors and placing the
  * vector-implementation dependent code into VectorTraits only - as is done now
  * with the function sort.
  *
- * ------------------------------------ 
+ * see COPYING for license details
+ *
+ * ------------------------------------
  */
 
-#ifndef __VECTOR_TRAITS_H
-#define __VECTOR_TRAITS_H
+#ifndef __LINBOX_vector_traits_H
+#define __LINBOX_vector_traits_H
 
 #include <vector>	// STL vectors
 #include <list>		// STL lists
@@ -38,100 +40,101 @@
 namespace LinBox
 {
 
-/** @name Vector traits.
- * Vector traits are use to allow template specialization to choose different
- * code for dense and sparse vectors.
-	\ingroup vector
- */
-//@{
+	/** @name Vector traits.
+	 * Vector traits are use to allow template specialization to choose different
+	 * code for dense and sparse vectors.
+	 \ingroup vector
+	 */
+	//@{
 
 	/** \brief List of vector categories.
 
 	 * This structure contains three structures: one relating to dense vectors,
-	 * one relating to sparse vectors implemented as sequences of pairs, and 
+	 * one relating to sparse vectors implemented as sequences of pairs, and
 	 * one relating to sparse vectors implemented as associative containers.
-	 * These types allow us to use template specialization to use different 
+	 * These types allow us to use template specialization to use different
 	 * code for different types of vectors.
 	 */
-        struct VectorCategories
-        {
-            struct GenericVectorTag { 
-                friend std::ostream& operator<< (std::ostream& o, 
-                                                 const GenericVectorTag& t) {
-                    return o << "GenericVectorTag"; 
-                } 
-            };
-            
-                // These are valid for GF2 only
-            struct DenseZeroOneVectorTag : public GenericVectorTag { 
-                friend std::ostream& operator<< (std::ostream& o, 
-                                                 const DenseZeroOneVectorTag& t) { 
-                    return o << "DenseZeroOneVectorTag"; 
-                } 
-            };
-            struct SparseZeroOneVectorTag : public GenericVectorTag { 
-                friend std::ostream& operator<< (std::ostream& o, 
-                                                 const SparseZeroOneVectorTag& t) { 
-                    return o << "SparseZeroOneVectorTag"; 
-                } 
-            };
-
-                // These are valid for all fields
-            struct DenseVectorTag : public SparseZeroOneVectorTag { 
-                    // Inherits from SparseZeroOneVectorTag:
-                    // This simplifies gf2 management of vectors
-                    // and makes Dense vector also a generic vector
-                friend std::ostream& operator<< (std::ostream& o, 
-                                                 const DenseVectorTag& t) { 
-                    return o << "DenseVectorTag"; 
-                } 
-            };
-            
-            struct SparseVectorTag : public GenericVectorTag { 
-                friend std::ostream& operator<< (std::ostream& o, 
-                                                 const SparseVectorTag& t) { 
-                    return o << "SparseVectorTag"; 
-                } 
-            };
-            
-            struct SparseSequenceVectorTag : public SparseVectorTag { 
-                friend std::ostream& operator<< (std::ostream& o, 
-                                                 const SparseSequenceVectorTag& t) { 
-                    return o << "SparseSequenceVectorTag"; 
-                } 
-            };
-            struct SparseAssociativeVectorTag : public SparseVectorTag { 
-                friend std::ostream& operator<< (std::ostream& o, 
-                                                 const SparseAssociativeVectorTag& t) { 
-                    return o << "SparseAssociativeVectorTag"; 
-                } 
-            };
-            struct SparseParallelVectorTag : public SparseVectorTag { 
-                friend std::ostream& operator<< (std::ostream& o, 
-                                                 const SparseParallelVectorTag& t) { 
-                    return o << "SparseParallelVectorTag"; 
-                } 
-            };
-
-        };
-
-	// Helper structure used for various STL's sorts (std::list::sort and std::stable_sort) 
+	struct VectorCategories
+	{
+		struct GenericVectorTag {
+			friend std::ostream& operator<< (std::ostream& o,
+							 const GenericVectorTag& ) {
+				return o << "GenericVectorTag";
+			}
+		};
+
+		// These are valid for GF2 only
+
+		struct SparseZeroOneVectorTag : public GenericVectorTag {
+			friend std::ostream& operator<< (std::ostream& o,
+							 const SparseZeroOneVectorTag& ) {
+				return o << "SparseZeroOneVectorTag";
+			}
+		};
+		// These are valid for all fields
+		struct DenseVectorTag : public SparseZeroOneVectorTag {
+			// Inherits from SparseZeroOneVectorTag:
+			// This simplifies gf2 management of vectors
+			// and makes Dense vector also a generic vector
+			friend std::ostream& operator<< (std::ostream& o,
+							 const DenseVectorTag& ) {
+				return o << "DenseVectorTag";
+			}
+		};
+
+		struct SparseVectorTag : public GenericVectorTag {
+			friend std::ostream& operator<< (std::ostream& o,
+							 const SparseVectorTag& ) {
+				return o << "SparseVectorTag";
+			}
+		};
+
+		struct SparseSequenceVectorTag : public SparseVectorTag {
+			friend std::ostream& operator<< (std::ostream& o,
+							 const SparseSequenceVectorTag& ) {
+				return o << "SparseSequenceVectorTag";
+			}
+		};
+		struct SparseAssociativeVectorTag : public SparseVectorTag {
+			friend std::ostream& operator<< (std::ostream& o,
+							 const SparseAssociativeVectorTag& ) {
+				return o << "SparseAssociativeVectorTag";
+			}
+		};
+		struct SparseParallelVectorTag : public SparseVectorTag {
+			friend std::ostream& operator<< (std::ostream& o,
+							 const SparseParallelVectorTag& ) {
+				return o << "SparseParallelVectorTag";
+			}
+		};
+
+		struct DenseZeroOneVectorTag : public DenseVectorTag {
+			friend std::ostream& operator<< (std::ostream& o,
+							 const DenseZeroOneVectorTag& ) {
+				return o << "DenseZeroOneVectorTag";
+			}
+		};
+
+	};
+
+	// Helper structure used for various STL's sorts (std::list::sort and std::stable_sort)
 	// for comparison of two pairs of elements (by their first elements)
 	template<class Element>
 	struct SparseSequenceVectorPairLessThan :
 		public std::binary_function<const std::pair<size_t, Element>&, const std::pair<size_t, Element>&, bool >
 	{
 		bool operator() (const std::pair<size_t, Element>& p1, const std::pair<size_t, Element>& p2)
-			{ return p1.first < p2.first; }
+		{ return p1.first < p2.first; }
 	};
 
 
 	/** Vector traits template structure.
 	 * By default, it tries to take all information from the vector class,
 	 * but it cannot usually do this.  For example, the vector_category
-	 * type is not defined in STL types, so this must be done through 
+	 * type is not defined in STL types, so this must be done through
 	 * template specialization.
-	 * @param Vector \Ref{LinBox} dense or sparse vector.
+	 * @param Vector \ref LinBox  dense or sparse vector.
 	 */
 	template <class Vector> struct VectorTraits
 	{
@@ -145,77 +148,80 @@ namespace LinBox
 	// Specialization for STL vectors
 	template <class Element>
 	struct VectorTraits< std::vector<Element> >
-	{ 
+	{
 		typedef std::vector<Element> VectorType;
-		typedef typename VectorCategories::DenseVectorTag VectorCategory; 
+		typedef typename VectorCategories::DenseVectorTag VectorCategory;
 	};
 
 	// Specialization for STL vectors of pairs of size_t and elements
-	template <class Element> 
+	template <class Element>
 	struct VectorTraits< std::vector< std::pair<size_t, Element> > >
-	{ 
+	{
 		typedef std::vector< std::pair<size_t, Element> > VectorType;
-		typedef typename VectorCategories::SparseSequenceVectorTag VectorCategory; 
+		typedef typename VectorCategories::SparseSequenceVectorTag VectorCategory;
 
 		static void sort (VectorType& v) { std::stable_sort(v.begin(), v.end(), SparseSequenceVectorPairLessThan<Element>()); }
 	};
 
 	// Specialization for STL lists of pairs of size_t and elements
-	template <class Element> 
+	template <class Element>
 	struct VectorTraits< std::list< std::pair<size_t, Element> > >
-	{ 
+	{
 		typedef std::list< std::pair<size_t, Element> > VectorType;
-		typedef typename VectorCategories::SparseSequenceVectorTag VectorCategory; 
+		typedef typename VectorCategories::SparseSequenceVectorTag VectorCategory;
 
 		static void sort (VectorType& v) { v.sort(SparseSequenceVectorPairLessThan<Element>()); }
 	};
 
 	// Specialization for STL singly linked lists of pairs of size_t and elements
-	template <class Element> 
+	template <class Element>
 	struct VectorTraits< std::deque< std::pair<size_t, Element> > >
-	{ 
+	{
 		typedef std::deque< std::pair<size_t, Element> > VectorType;
-		typedef typename VectorCategories::SparseSequenceVectorTag VectorCategory; 
+		typedef typename VectorCategories::SparseSequenceVectorTag VectorCategory;
 
 		static void sort (VectorType& v) { std::stable_sort(v.begin, v.end(), SparseSequenceVectorPairLessThan<Element>()); }
 	};
-  
+
 	// Specialization for STL maps of size_t and elements
-	template <class Element> 
+	template <class Element>
 	struct VectorTraits< std::map<size_t, Element> >
-	{ 
+	{
 		typedef std::map<size_t, Element> VectorType;
-		typedef typename VectorCategories::SparseAssociativeVectorTag VectorCategory; 
+		typedef typename VectorCategories::SparseAssociativeVectorTag VectorCategory;
 	};
 
 	// Specialization for an STL pair of an STL vector of size_t's and an STL vector of elements
-	template <class Element> 
+	template <class Element>
 	struct VectorTraits< std::pair<std::vector<size_t>, std::vector<Element> > >
-	{ 
+	{
 		typedef std::pair<std::vector<size_t>, std::vector<Element> > VectorType;
-		typedef typename VectorCategories::SparseParallelVectorTag VectorCategory; 
+		typedef typename VectorCategories::SparseParallelVectorTag VectorCategory;
 	};
 
 	// Namespace containing some useful generic functions
 
-	namespace VectorWrapper 
+	/// limited doc so far.
+	namespace VectorWrapper
 	{
 		template <class T>
-		class CompareSparseEntries
-		{
-		    public:
-			inline bool operator () (const std::pair <size_t, T> &i, const size_t j) const
-				{ return i.first < j; }
+		class CompareSparseEntries {
+		public:
+			template<typename PairType>
+			inline bool operator () (const PairType &i, const size_t j) const
+			{ return i.first < j; }
 		};
 
 		template <class Field, class Vector>
 		inline typename Field::Element &refSpecialized
-			(Vector &v, size_t i, VectorCategories::DenseVectorTag)
-			{ return v[i]; }
+		(Vector &v, size_t i, VectorCategories::DenseVectorTag)
+		{
+		       	return v[i];
+		}
 
 		template <class Field, class Vector>
 		inline typename Field::Element &refSpecialized
-			(Vector &v, size_t i, VectorCategories::SparseSequenceVectorTag)
+		(Vector &v, size_t i, VectorCategories::SparseSequenceVectorTag)
 		{
 			static typename Field::Element zero;
 			typename Vector::iterator j;
@@ -235,12 +241,14 @@ namespace LinBox
 
 		template <class Field, class Vector>
 		inline typename Field::Element &refSpecialized
-			(Vector &v, size_t i, VectorCategories::SparseAssociativeVectorTag)
-			{ return v[i]; }
+		(Vector &v, size_t i, VectorCategories::SparseAssociativeVectorTag)
+		{
+			return v[i];
+		}
 
 		template <class Field, class Vector>
 		inline typename Field::Element &refSpecialized
-			(Vector &v, size_t i, VectorCategories::SparseParallelVectorTag)
+		(Vector &v, size_t i, VectorCategories::SparseParallelVectorTag)
 		{
 			static typename Field::Element zero;
 			typename Vector::first_type::iterator j_idx;
@@ -264,17 +272,21 @@ namespace LinBox
 		}
 
 		template <class Field, class Vector>
-		inline typename Field::Element &ref (Vector &v, size_t i) 
-			{ return refSpecialized<Field, Vector> (v, i, typename VectorTraits<Vector>::VectorCategory()); }
+		inline typename Field::Element &ref (Vector &v, size_t i)
+		{
+			return refSpecialized<Field, Vector> (v, i, typename VectorTraits<Vector>::VectorCategory());
+		}
 
 		template <class Field, class Vector>
 		inline const typename Field::Element &constRefSpecialized
-			(Vector &v, size_t i, VectorCategories::DenseVectorTag)
-			{ return v[i]; }
+		(Vector &v, size_t i, VectorCategories::DenseVectorTag)
+		{
+			return v[i];
+		}
 
 		template <class Field, class Vector>
 		inline const typename Field::Element &constRefSpecialized
-			(Vector &v, size_t i, VectorCategories::SparseSequenceVectorTag)
+		(Vector &v, size_t i, VectorCategories::SparseSequenceVectorTag)
 		{
 			static typename Field::Element zero;
 			typename Vector::const_iterator j;
@@ -292,12 +304,14 @@ namespace LinBox
 
 		template <class Field, class Vector>
 		inline const typename Field::Element &constRefSpecialized
-			(Vector &v, size_t i, VectorCategories::SparseAssociativeVectorTag)
-			{ return v[i]; }
+		(Vector &v, size_t i, VectorCategories::SparseAssociativeVectorTag)
+		{
+			return v[i];
+		}
 
 		template <class Field, class Vector>
 		inline typename Field::Element &constRefSpecialized
-			(Vector &v, size_t i, VectorCategories::SparseParallelVectorTag)
+		(Vector &v, size_t i, VectorCategories::SparseParallelVectorTag)
 		{
 			static typename Field::Element zero;
 			typename Vector::first_type::iterator j_idx;
@@ -318,38 +332,47 @@ namespace LinBox
 
 		template <class Vector>
 		inline void ensureDimSpecialized (Vector &v, size_t n, VectorCategories::DenseZeroOneVectorTag)
-			{ v.resize (n); }
+		{
+			v.resize (n);
+		}
+
 
 		template <class Vector>
 		inline void ensureDimSpecialized (Vector &v, size_t n, VectorCategories::SparseZeroOneVectorTag)
-			{}
+		{}
 
 		template <class Field, class Vector>
-		inline const typename Field::Element &constRef (Vector &v, size_t i) 
-			{ return constRefSpecialized<Field, Vector> (v, i, typename VectorTraits<Vector>::VectorCategory()); }
+		inline const typename Field::Element &constRef (Vector &v, size_t i)
+		{
+			return constRefSpecialized<Field, Vector> (v, i, typename VectorTraits<Vector>::VectorCategory());
+		}
 
 		template <class Vector>
 		inline void ensureDimSpecialized (Vector &v, size_t n, VectorCategories::DenseVectorTag)
-			{ v.resize (n); }
+		{
+			v.resize (n);
+		}
 
 		template <class Vector>
 		inline void ensureDimSpecialized (Vector &v, size_t n, VectorCategories::SparseSequenceVectorTag)
-			{}
+		{}
 
 		template <class Vector>
 		inline void ensureDimSpecialized (Vector &v, size_t n, VectorCategories::SparseAssociativeVectorTag)
-			{}
+		{}
 
 		template <class Vector>
 		inline void ensureDimSpecialized (Vector &v, size_t n, VectorCategories::SparseParallelVectorTag)
-			{}
+		{}
 
 		template <class Vector>
-		inline void ensureDim (Vector &v, size_t n) 
-			{ ensureDimSpecialized (v, n, typename VectorTraits<Vector>::VectorCategory()); }
+		inline void ensureDim (Vector &v, size_t n)
+		{
+			ensureDimSpecialized (v, n, typename VectorTraits<Vector>::VectorCategory());
+		}
 	} // Namespace VectorWrapper
 
-	// Now we create some "canonical" vector types, so that users don't 
+	// Now we create some "canonical" vector types, so that users don't
 	// always have to typedef everything
 
 	/** Canonical vector types
@@ -361,92 +384,93 @@ namespace LinBox
 	 */
 
 	template <class Element>
-	struct RawVector 
+	struct RawVector
 	{
-            typedef std::vector<Element> Dense;
-            typedef std::pair<std::vector<size_t>, std::vector<Element> > Sparse;
-            typedef std::vector<std::pair<size_t, Element> > SparseSeq;
-            typedef std::map<size_t, Element> SparseMap;
-            typedef std::pair<std::vector<size_t>, std::vector<Element> > SparsePar;
-            
-            template<class VType> static size_t size(const VType& d) { return d.size(); }        
-            static size_t size(const Sparse& d) { return d.first.size(); }        
-//             static size_t size(const SparsePar& d) { return d.first.size(); }      
-
-            template<class VType>
-            static VType& convert(VType& u, const VType& v) { return u = v; }
-            
-            static Dense& convert(Dense& u, const SparseSeq& v) {
-                for(typename SparseSeq::const_iterator sit = v.begin(); sit != v.end(); ++sit) {
-                    if (sit->first > u.size()) u.resize(sit->first);
-                    u[sit->first] = sit->second;
-                }
-                return u;
-            }
-            static Sparse& convert(Sparse& u, const SparseSeq& v) {
-                u.first.resize(v.size());
-                u.second.resize(v.size());
-                typename SparseSeq::const_iterator ssit = v.begin();
-                std::vector<size_t>::iterator vit = u.first.begin();
-                typename std::vector<Element>::iterator eit = u.second.begin();
-                for(; ssit != v.end(); ++ssit, ++vit, ++eit) {
-                    *vit = ssit->first;
-                    *eit = ssit->second;
-                }
-                return u;
-            }
-             static SparseSeq& convert(SparseSeq& u, const Sparse& v) {
-                u.resize(v.first.size());
-                typename SparseSeq::iterator ssit = u.begin();
-                std::vector<size_t>::const_iterator vit = v.first.begin();
-                typename std::vector<Element>::const_iterator eit = v.second.begin();
-                for(; ssit != u.end(); ++ssit, ++vit, ++eit) {
-                    ssit->first = *vit;
-                    ssit->second = *eit;
-                }
-                return u;
-            }
-                  
-                // TODO : other convertions
-            
-  	};
+		typedef std::vector<Element> Dense;
+		typedef std::pair<std::vector<size_t>, std::vector<Element> > Sparse;
+		typedef std::vector<std::pair<size_t, Element> > SparseSeq;
+		typedef std::map<size_t, Element> SparseMap;
+		typedef std::pair<std::vector<size_t>, std::vector<Element> > SparsePar;
+
+		template<class VType> static size_t size(const VType& d) { return d.size(); }
+		static size_t size(const Sparse& d) { return d.first.size(); }
+		//             static size_t size(const SparsePar& d) { return d.first.size(); }
+
+		template<class VType>
+		static VType& convert(VType& u, const VType& v) { return u = v; }
+
+		static Dense& convert(Dense& u, const SparseSeq& v) {
+			for(typename SparseSeq::const_iterator sit = v.begin(); sit != v.end(); ++sit) {
+				if (sit->first > u.size()) u.resize(sit->first);
+				u[sit->first] = sit->second;
+			}
+			return u;
+		}
+		static Sparse& convert(Sparse& u, const SparseSeq& v) {
+			u.first.resize(v.size());
+			u.second.resize(v.size());
+			typename SparseSeq::const_iterator ssit = v.begin();
+			std::vector<size_t>::iterator vit = u.first.begin();
+			typename std::vector<Element>::iterator eit = u.second.begin();
+			for(; ssit != v.end(); ++ssit, ++vit, ++eit) {
+				*vit = ssit->first;
+				*eit = ssit->second;
+			}
+			return u;
+		}
+		static SparseSeq& convert(SparseSeq& u, const Sparse& v) {
+			u.resize(v.first.size());
+			typename SparseSeq::iterator ssit = u.begin();
+			std::vector<size_t>::const_iterator vit = v.first.begin();
+			typename std::vector<Element>::const_iterator eit = v.second.begin();
+			for(; ssit != u.end(); ++ssit, ++vit, ++eit) {
+				ssit->first = *vit;
+				ssit->second = *eit;
+			}
+			return u;
+		}
+
+		// TODO : other convertions
+
+	};
 
 	template <class Field>
 	struct Vector : public RawVector<typename Field::Element>
 	{
-            typedef typename Field::Element Element;
-            
-            template<class U>
-            struct rebind {
-                typedef Vector<U> other;
-            };
+		typedef typename Field::Element Element;
+
+		template<class U>
+		struct rebind {
+			typedef Vector<U> other;
+		};
+	};
+
+
+	template<class T, class U>
+	struct Rebind< std::vector<T>, U > {
+		typedef typename Vector<U>::Dense other;
 	};
 
- 
-    	template<class T, class U>
-    	struct Rebind< std::vector<T>, U > {
-        	typedef typename Vector<U>::Dense other;
-    	};
 
-    
 	template<class T, class U>
 	struct Rebind< std::pair<std::vector<size_t>, std::vector<T> >,U > {
-	    typedef typename Vector<U>::Sparse other;
+		typedef typename Vector<U>::Sparse other;
 	};
 
 	template<class T, class U>
 	struct Rebind< std::vector<std::pair<size_t, T> >, U > {
-	    typedef typename Vector<U>::SparseSeq other;
+		typedef typename Vector<U>::SparseSeq other;
 	};
 
 	template<class T, class U>
 	struct Rebind< std::map<size_t, T>, U > {
-	    typedef typename Vector<U>::SparseMap other;
+		typedef typename Vector<U>::SparseMap other;
 	};
 
-   
-//@} Vector traits
+
+	//@} Vector traits
 
 } // namespace LinBox
 
-#endif // __VECTOR_TRAITS_H
+#endif // __LINBOX_vector_traits_H
+
diff --git a/linbox/vector/vector.doxy b/linbox/vector/vector.doxy
index 3c55dba..cdb2e1d 100644
--- a/linbox/vector/vector.doxy
+++ b/linbox/vector/vector.doxy
@@ -1,28 +1,32 @@
-/** \defgroup vector linbox/vector
+/** \ingroup linbox
+  \defgroup Vector vector
 
-  All LinBox dense vectors must implement the dense vector common 
+  \brief LinBox vectors.
+
+  All LinBox dense vectors must implement the dense vector common
   object interface as it is defined in the dense vector
-  {@link Archetypes archetype}.  It is basically the non-resizing subset 
-  of functionality of the STL vector<T> container.
-  For information on the STL vector, see SGI's 
-  \URL[Standard Template Library Programmer's Guide]{http://www.sgi.com/Technology/STL/}.
+  @link Archetypes archetype at endlink.
+  It is basically the non-resizing subset
+  of functionality of the STL <code>vector<T></code> container.
+  For information on the STL vector, see SGI's
+  <a href=http://www.sgi.com/Technology/STL/>Standard Template Library Programmer's Guide</a>.
 
-All LinBox sparse vectors must implement the sparse vector common
+  All LinBox sparse vectors must implement the sparse vector common
   object interface as it is defined in the sparse vector
-    {@link Archetypes archetype}.
+  @link Archetypes archetype at endlink.
 
-The LinBox sparse vector common object interface is the same as either
-  the STL sequence of pairs of {\tt size\_t} and a field element
-    or an STL unique and pair associative container.  (That is, an STL map
-	  without the operator[].)
-		    It is also always assumed that the entries in the sparse vector are in
-			  ascending order starting with the first index no less than zero.
+  The LinBox sparse vector common object interface is the same as either
+  the STL sequence of pairs of \c size_t and a field element
+  or an STL unique and pair associative container.  (That is, an STL \c map
+  without the <code>operator[]</code>.)
+  It is also always assumed that the entries in the sparse vector are in
+  ascending order starting with the first index no less than zero.
 
 
-  LinBox vectors are indexed starting at zero, not one, 
+  LinBox vectors are indexed starting at zero, not one,
   just like STL vectors and C-style arrays.
 
   @see Archetypes
 
-*/
-
+ */
+// vim:syn=doxygen
diff --git a/ltmain.sh b/ltmain.sh
deleted file mode 100644
index 0bf3848..0000000
--- a/ltmain.sh
+++ /dev/null
@@ -1,6964 +0,0 @@
-# ltmain.sh - Provide generalized library-building support services.
-# NOTE: Changing this file will not affect anything until you rerun configure.
-#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
-# 2007, 2008  Free Software Foundation, Inc.
-# Originally by Gordon Matzigkeit <gord at gnu.ai.mit.edu>, 1996
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# 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.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-basename="s,^.*/,,g"
-
-# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
-# is ksh but when the shell is invoked as "sh" and the current value of
-# the _XPG environment variable is not equal to 1 (one), the special
-# positional parameter $0, within a function call, is the name of the
-# function.
-progpath="$0"
-
-# The name of this program:
-progname=`echo "$progpath" | $SED $basename`
-modename="$progname"
-
-# Global variables:
-EXIT_SUCCESS=0
-EXIT_FAILURE=1
-
-PROGRAM=ltmain.sh
-PACKAGE=libtool
-VERSION="1.5.26 Debian 1.5.26-4"
-TIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)"
-
-# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
-fi
-BIN_SH=xpg4; export BIN_SH # for Tru64
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# Check that we have a working $echo.
-if test "X$1" = X--no-reexec; then
-  # Discard the --no-reexec flag, and continue.
-  shift
-elif test "X$1" = X--fallback-echo; then
-  # Avoid inline document here, it may be left over
-  :
-elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
-  # Yippee, $echo works!
-  :
-else
-  # Restart under the correct shell, and then maybe $echo will work.
-  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
-fi
-
-if test "X$1" = X--fallback-echo; then
-  # used as fallback echo
-  shift
-  cat <<EOF
-$*
-EOF
-  exit $EXIT_SUCCESS
-fi
-
-default_mode=
-help="Try \`$progname --help' for more information."
-magic="%%%MAGIC variable%%%"
-mkdir="mkdir"
-mv="mv -f"
-rm="rm -f"
-
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed="${SED}"' -e 1s/^X//'
-sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
-# test EBCDIC or ASCII
-case `echo X|tr X '\101'` in
- A) # ASCII based system
-    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
-  SP2NL='tr \040 \012'
-  NL2SP='tr \015\012 \040\040'
-  ;;
- *) # EBCDIC based system
-  SP2NL='tr \100 \n'
-  NL2SP='tr \r\n \100\100'
-  ;;
-esac
-
-# NLS nuisances.
-# Only set LANG and LC_ALL to C if already set.
-# These must not be set unconditionally because not all systems understand
-# e.g. LANG=C (notably SCO).
-# We save the old values to restore during execute mode.
-lt_env=
-for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
-do
-  eval "if test \"\${$lt_var+set}\" = set; then
-	  save_$lt_var=\$$lt_var
-	  lt_env=\"$lt_var=\$$lt_var \$lt_env\"
-	  $lt_var=C
-	  export $lt_var
-	fi"
-done
-
-if test -n "$lt_env"; then
-  lt_env="env $lt_env"
-fi
-
-# Make sure IFS has a sensible default
-lt_nl='
-'
-IFS=" 	$lt_nl"
-
-if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
-  $echo "$modename: not configured to build any kind of library" 1>&2
-  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
-  exit $EXIT_FAILURE
-fi
-
-# Global variables.
-mode=$default_mode
-nonopt=
-prev=
-prevopt=
-run=
-show="$echo"
-show_help=
-execute_dlfiles=
-duplicate_deps=no
-preserve_args=
-lo2o="s/\\.lo\$/.${objext}/"
-o2lo="s/\\.${objext}\$/.lo/"
-extracted_archives=
-extracted_serial=0
-
-#####################################
-# Shell function definitions:
-# This seems to be the best place for them
-
-# func_mktempdir [string]
-# Make a temporary directory that won't clash with other running
-# libtool processes, and avoids race conditions if possible.  If
-# given, STRING is the basename for that directory.
-func_mktempdir ()
-{
-    my_template="${TMPDIR-/tmp}/${1-$progname}"
-
-    if test "$run" = ":"; then
-      # Return a directory name, but don't create it in dry-run mode
-      my_tmpdir="${my_template}-$$"
-    else
-
-      # If mktemp works, use that first and foremost
-      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
-
-      if test ! -d "$my_tmpdir"; then
-	# Failing that, at least try and use $RANDOM to avoid a race
-	my_tmpdir="${my_template}-${RANDOM-0}$$"
-
-	save_mktempdir_umask=`umask`
-	umask 0077
-	$mkdir "$my_tmpdir"
-	umask $save_mktempdir_umask
-      fi
-
-      # If we're not in dry-run mode, bomb out on failure
-      test -d "$my_tmpdir" || {
-        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
-	exit $EXIT_FAILURE
-      }
-    fi
-
-    $echo "X$my_tmpdir" | $Xsed
-}
-
-
-# func_win32_libid arg
-# return the library type of file 'arg'
-#
-# Need a lot of goo to handle *both* DLLs and import libs
-# Has to be a shell function in order to 'eat' the argument
-# that is supplied when $file_magic_command is called.
-func_win32_libid ()
-{
-  win32_libid_type="unknown"
-  win32_fileres=`file -L $1 2>/dev/null`
-  case $win32_fileres in
-  *ar\ archive\ import\ library*) # definitely import
-    win32_libid_type="x86 archive import"
-    ;;
-  *ar\ archive*) # could be an import, or static
-    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
-      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
-      win32_nmres=`eval $NM -f posix -A $1 | \
-	$SED -n -e '1,100{
-		/ I /{
-			s,.*,import,
-			p
-			q
-			}
-		}'`
-      case $win32_nmres in
-      import*)  win32_libid_type="x86 archive import";;
-      *)        win32_libid_type="x86 archive static";;
-      esac
-    fi
-    ;;
-  *DLL*)
-    win32_libid_type="x86 DLL"
-    ;;
-  *executable*) # but shell scripts are "executable" too...
-    case $win32_fileres in
-    *MS\ Windows\ PE\ Intel*)
-      win32_libid_type="x86 DLL"
-      ;;
-    esac
-    ;;
-  esac
-  $echo $win32_libid_type
-}
-
-
-# func_infer_tag arg
-# Infer tagged configuration to use if any are available and
-# if one wasn't chosen via the "--tag" command line option.
-# Only attempt this if the compiler in the base compile
-# command doesn't match the default compiler.
-# arg is usually of the form 'gcc ...'
-func_infer_tag ()
-{
-    if test -n "$available_tags" && test -z "$tagname"; then
-      CC_quoted=
-      for arg in $CC; do
-	case $arg in
-	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	  arg="\"$arg\""
-	  ;;
-	esac
-	CC_quoted="$CC_quoted $arg"
-      done
-      case $@ in
-      # Blanks in the command may have been stripped by the calling shell,
-      # but not from the CC environment variable when configure was run.
-      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
-      # Blanks at the start of $base_compile will cause this to fail
-      # if we don't check for them as well.
-      *)
-	for z in $available_tags; do
-	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
-	    # Evaluate the configuration.
-	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
-	    CC_quoted=
-	    for arg in $CC; do
-	    # Double-quote args containing other shell metacharacters.
-	    case $arg in
-	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	      arg="\"$arg\""
-	      ;;
-	    esac
-	    CC_quoted="$CC_quoted $arg"
-	  done
-	    case "$@ " in
-	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
-	      # The compiler in the base compile command matches
-	      # the one in the tagged configuration.
-	      # Assume this is the tagged configuration we want.
-	      tagname=$z
-	      break
-	      ;;
-	    esac
-	  fi
-	done
-	# If $tagname still isn't set, then no tagged configuration
-	# was found and let the user know that the "--tag" command
-	# line option must be used.
-	if test -z "$tagname"; then
-	  $echo "$modename: unable to infer tagged configuration"
-	  $echo "$modename: specify a tag with \`--tag'" 1>&2
-	  exit $EXIT_FAILURE
-#        else
-#          $echo "$modename: using $tagname tagged configuration"
-	fi
-	;;
-      esac
-    fi
-}
-
-
-# func_extract_an_archive dir oldlib
-func_extract_an_archive ()
-{
-    f_ex_an_ar_dir="$1"; shift
-    f_ex_an_ar_oldlib="$1"
-
-    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
-    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
-    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
-     :
-    else
-      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
-      exit $EXIT_FAILURE
-    fi
-}
-
-# func_extract_archives gentop oldlib ...
-func_extract_archives ()
-{
-    my_gentop="$1"; shift
-    my_oldlibs=${1+"$@"}
-    my_oldobjs=""
-    my_xlib=""
-    my_xabs=""
-    my_xdir=""
-    my_status=""
-
-    $show "${rm}r $my_gentop"
-    $run ${rm}r "$my_gentop"
-    $show "$mkdir $my_gentop"
-    $run $mkdir "$my_gentop"
-    my_status=$?
-    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
-      exit $my_status
-    fi
-
-    for my_xlib in $my_oldlibs; do
-      # Extract the objects.
-      case $my_xlib in
-	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
-	*) my_xabs=`pwd`"/$my_xlib" ;;
-      esac
-      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
-      my_xlib_u=$my_xlib
-      while :; do
-        case " $extracted_archives " in
-	*" $my_xlib_u "*)
-	  extracted_serial=`expr $extracted_serial + 1`
-	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
-	*) break ;;
-	esac
-      done
-      extracted_archives="$extracted_archives $my_xlib_u"
-      my_xdir="$my_gentop/$my_xlib_u"
-
-      $show "${rm}r $my_xdir"
-      $run ${rm}r "$my_xdir"
-      $show "$mkdir $my_xdir"
-      $run $mkdir "$my_xdir"
-      exit_status=$?
-      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
-	exit $exit_status
-      fi
-      case $host in
-      *-darwin*)
-	$show "Extracting $my_xabs"
-	# Do not bother doing anything if just a dry run
-	if test -z "$run"; then
-	  darwin_orig_dir=`pwd`
-	  cd $my_xdir || exit $?
-	  darwin_archive=$my_xabs
-	  darwin_curdir=`pwd`
-	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
-	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
-	  if test -n "$darwin_arches"; then 
-	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
-	    darwin_arch=
-	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
-	    for darwin_arch in  $darwin_arches ; do
-	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
-	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
-	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
-	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
-	      cd "$darwin_curdir"
-	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
-	    done # $darwin_arches
-      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
-	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
-	    darwin_file=
-	    darwin_files=
-	    for darwin_file in $darwin_filelist; do
-	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
-	      lipo -create -output "$darwin_file" $darwin_files
-	    done # $darwin_filelist
-	    ${rm}r unfat-$$
-	    cd "$darwin_orig_dir"
-	  else
-	    cd "$darwin_orig_dir"
- 	    func_extract_an_archive "$my_xdir" "$my_xabs"
-	  fi # $darwin_arches
-	fi # $run
-	;;
-      *)
-        func_extract_an_archive "$my_xdir" "$my_xabs"
-        ;;
-      esac
-      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
-    done
-    func_extract_archives_result="$my_oldobjs"
-}
-# End of Shell function definitions
-#####################################
-
-# Darwin sucks
-eval std_shrext=\"$shrext_cmds\"
-
-disable_libs=no
-
-# Parse our command line options once, thoroughly.
-while test "$#" -gt 0
-do
-  arg="$1"
-  shift
-
-  case $arg in
-  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
-  *) optarg= ;;
-  esac
-
-  # If the previous option needs an argument, assign it.
-  if test -n "$prev"; then
-    case $prev in
-    execute_dlfiles)
-      execute_dlfiles="$execute_dlfiles $arg"
-      ;;
-    tag)
-      tagname="$arg"
-      preserve_args="${preserve_args}=$arg"
-
-      # Check whether tagname contains only valid characters
-      case $tagname in
-      *[!-_A-Za-z0-9,/]*)
-	$echo "$progname: invalid tag name: $tagname" 1>&2
-	exit $EXIT_FAILURE
-	;;
-      esac
-
-      case $tagname in
-      CC)
-	# Don't test for the "default" C tag, as we know, it's there, but
-	# not specially marked.
-	;;
-      *)
-	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
-	  taglist="$taglist $tagname"
-	  # Evaluate the configuration.
-	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
-	else
-	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
-	fi
-	;;
-      esac
-      ;;
-    *)
-      eval "$prev=\$arg"
-      ;;
-    esac
-
-    prev=
-    prevopt=
-    continue
-  fi
-
-  # Have we seen a non-optional argument yet?
-  case $arg in
-  --help)
-    show_help=yes
-    ;;
-
-  --version)
-    echo "\
-$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
-
-Copyright (C) 2008  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."
-    exit $?
-    ;;
-
-  --config)
-    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
-    # Now print the configurations for the tags.
-    for tagname in $taglist; do
-      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
-    done
-    exit $?
-    ;;
-
-  --debug)
-    $echo "$progname: enabling shell trace mode"
-    set -x
-    preserve_args="$preserve_args $arg"
-    ;;
-
-  --dry-run | -n)
-    run=:
-    ;;
-
-  --features)
-    $echo "host: $host"
-    if test "$build_libtool_libs" = yes; then
-      $echo "enable shared libraries"
-    else
-      $echo "disable shared libraries"
-    fi
-    if test "$build_old_libs" = yes; then
-      $echo "enable static libraries"
-    else
-      $echo "disable static libraries"
-    fi
-    exit $?
-    ;;
-
-  --finish) mode="finish" ;;
-
-  --mode) prevopt="--mode" prev=mode ;;
-  --mode=*) mode="$optarg" ;;
-
-  --preserve-dup-deps) duplicate_deps="yes" ;;
-
-  --quiet | --silent)
-    show=:
-    preserve_args="$preserve_args $arg"
-    ;;
-
-  --tag)
-    prevopt="--tag"
-    prev=tag
-    preserve_args="$preserve_args --tag"
-    ;;
-  --tag=*)
-    set tag "$optarg" ${1+"$@"}
-    shift
-    prev=tag
-    preserve_args="$preserve_args --tag"
-    ;;
-
-  -dlopen)
-    prevopt="-dlopen"
-    prev=execute_dlfiles
-    ;;
-
-  -*)
-    $echo "$modename: unrecognized option \`$arg'" 1>&2
-    $echo "$help" 1>&2
-    exit $EXIT_FAILURE
-    ;;
-
-  *)
-    nonopt="$arg"
-    break
-    ;;
-  esac
-done
-
-if test -n "$prevopt"; then
-  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
-  $echo "$help" 1>&2
-  exit $EXIT_FAILURE
-fi
-
-case $disable_libs in
-no) 
-  ;;
-shared)
-  build_libtool_libs=no
-  build_old_libs=yes
-  ;;
-static)
-  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
-  ;;
-esac
-
-# If this variable is set in any of the actions, the command in it
-# will be execed at the end.  This prevents here-documents from being
-# left over by shells.
-exec_cmd=
-
-if test -z "$show_help"; then
-
-  # Infer the operation mode.
-  if test -z "$mode"; then
-    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
-    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
-    case $nonopt in
-    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
-      mode=link
-      for arg
-      do
-	case $arg in
-	-c)
-	   mode=compile
-	   break
-	   ;;
-	esac
-      done
-      ;;
-    *db | *dbx | *strace | *truss)
-      mode=execute
-      ;;
-    *install*|cp|mv)
-      mode=install
-      ;;
-    *rm)
-      mode=uninstall
-      ;;
-    *)
-      # If we have no mode, but dlfiles were specified, then do execute mode.
-      test -n "$execute_dlfiles" && mode=execute
-
-      # Just use the default operation mode.
-      if test -z "$mode"; then
-	if test -n "$nonopt"; then
-	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
-	else
-	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
-	fi
-      fi
-      ;;
-    esac
-  fi
-
-  # Only execute mode is allowed to have -dlopen flags.
-  if test -n "$execute_dlfiles" && test "$mode" != execute; then
-    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
-    $echo "$help" 1>&2
-    exit $EXIT_FAILURE
-  fi
-
-  # Change the help message to a mode-specific one.
-  generic_help="$help"
-  help="Try \`$modename --help --mode=$mode' for more information."
-
-  # These modes are in order of execution frequency so that they run quickly.
-  case $mode in
-  # libtool compile mode
-  compile)
-    modename="$modename: compile"
-    # Get the compilation command and the source file.
-    base_compile=
-    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
-    suppress_opt=yes
-    suppress_output=
-    arg_mode=normal
-    libobj=
-    later=
-
-    for arg
-    do
-      case $arg_mode in
-      arg  )
-	# do not "continue".  Instead, add this to base_compile
-	lastarg="$arg"
-	arg_mode=normal
-	;;
-
-      target )
-	libobj="$arg"
-	arg_mode=normal
-	continue
-	;;
-
-      normal )
-	# Accept any command-line options.
-	case $arg in
-	-o)
-	  if test -n "$libobj" ; then
-	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
-	    exit $EXIT_FAILURE
-	  fi
-	  arg_mode=target
-	  continue
-	  ;;
-
-	-static | -prefer-pic | -prefer-non-pic)
-	  later="$later $arg"
-	  continue
-	  ;;
-
-	-no-suppress)
-	  suppress_opt=no
-	  continue
-	  ;;
-
-	-Xcompiler)
-	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
-	  continue      #  The current "srcfile" will either be retained or
-	  ;;            #  replaced later.  I would guess that would be a bug.
-
-	-Wc,*)
-	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
-	  lastarg=
-	  save_ifs="$IFS"; IFS=','
- 	  for arg in $args; do
-	    IFS="$save_ifs"
-
-	    # Double-quote args containing other shell metacharacters.
-	    # Many Bourne shells cannot handle close brackets correctly
-	    # in scan sets, so we specify it separately.
-	    case $arg in
-	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	      arg="\"$arg\""
-	      ;;
-	    esac
-	    lastarg="$lastarg $arg"
-	  done
-	  IFS="$save_ifs"
-	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
-
-	  # Add the arguments to base_compile.
-	  base_compile="$base_compile $lastarg"
-	  continue
-	  ;;
-
-	* )
-	  # Accept the current argument as the source file.
-	  # The previous "srcfile" becomes the current argument.
-	  #
-	  lastarg="$srcfile"
-	  srcfile="$arg"
-	  ;;
-	esac  #  case $arg
-	;;
-      esac    #  case $arg_mode
-
-      # Aesthetically quote the previous argument.
-      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
-
-      case $lastarg in
-      # Double-quote args containing other shell metacharacters.
-      # Many Bourne shells cannot handle close brackets correctly
-      # in scan sets, and some SunOS ksh mistreat backslash-escaping
-      # in scan sets (worked around with variable expansion),
-      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
-      # at all, so we specify them separately.
-      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	lastarg="\"$lastarg\""
-	;;
-      esac
-
-      base_compile="$base_compile $lastarg"
-    done # for arg
-
-    case $arg_mode in
-    arg)
-      $echo "$modename: you must specify an argument for -Xcompile"
-      exit $EXIT_FAILURE
-      ;;
-    target)
-      $echo "$modename: you must specify a target with \`-o'" 1>&2
-      exit $EXIT_FAILURE
-      ;;
-    *)
-      # Get the name of the library object.
-      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
-      ;;
-    esac
-
-    # Recognize several different file suffixes.
-    # If the user specifies -o file.o, it is replaced with file.lo
-    xform='[cCFSifmso]'
-    case $libobj in
-    *.ada) xform=ada ;;
-    *.adb) xform=adb ;;
-    *.ads) xform=ads ;;
-    *.asm) xform=asm ;;
-    *.c++) xform=c++ ;;
-    *.cc) xform=cc ;;
-    *.ii) xform=ii ;;
-    *.class) xform=class ;;
-    *.cpp) xform=cpp ;;
-    *.cxx) xform=cxx ;;
-    *.[fF][09]?) xform=[fF][09]. ;;
-    *.for) xform=for ;;
-    *.java) xform=java ;;
-    *.obj) xform=obj ;;
-    *.sx) xform=sx ;;
-    esac
-
-    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
-
-    case $libobj in
-    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
-    *)
-      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
-      exit $EXIT_FAILURE
-      ;;
-    esac
-
-    func_infer_tag $base_compile
-
-    for arg in $later; do
-      case $arg in
-      -static)
-	build_old_libs=yes
-	continue
-	;;
-
-      -prefer-pic)
-	pic_mode=yes
-	continue
-	;;
-
-      -prefer-non-pic)
-	pic_mode=no
-	continue
-	;;
-      esac
-    done
-
-    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
-    case $qlibobj in
-      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	qlibobj="\"$qlibobj\"" ;;
-    esac
-    test "X$libobj" != "X$qlibobj" \
-	&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
-	&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
-    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
-    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
-    if test "X$xdir" = "X$obj"; then
-      xdir=
-    else
-      xdir=$xdir/
-    fi
-    lobj=${xdir}$objdir/$objname
-
-    if test -z "$base_compile"; then
-      $echo "$modename: you must specify a compilation command" 1>&2
-      $echo "$help" 1>&2
-      exit $EXIT_FAILURE
-    fi
-
-    # Delete any leftover library objects.
-    if test "$build_old_libs" = yes; then
-      removelist="$obj $lobj $libobj ${libobj}T"
-    else
-      removelist="$lobj $libobj ${libobj}T"
-    fi
-
-    $run $rm $removelist
-    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
-
-    # On Cygwin there's no "real" PIC flag so we must build both object types
-    case $host_os in
-    cygwin* | mingw* | pw32* | os2*)
-      pic_mode=default
-      ;;
-    esac
-    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
-      # non-PIC code in shared libraries is not supported
-      pic_mode=default
-    fi
-
-    # Calculate the filename of the output object if compiler does
-    # not support -o with -c
-    if test "$compiler_c_o" = no; then
-      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
-      lockfile="$output_obj.lock"
-      removelist="$removelist $output_obj $lockfile"
-      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
-    else
-      output_obj=
-      need_locks=no
-      lockfile=
-    fi
-
-    # Lock this critical section if it is needed
-    # We use this script file to make the link, it avoids creating a new file
-    if test "$need_locks" = yes; then
-      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
-	$show "Waiting for $lockfile to be removed"
-	sleep 2
-      done
-    elif test "$need_locks" = warn; then
-      if test -f "$lockfile"; then
-	$echo "\
-*** ERROR, $lockfile exists and contains:
-`cat $lockfile 2>/dev/null`
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together.  If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
-	$run $rm $removelist
-	exit $EXIT_FAILURE
-      fi
-      $echo "$srcfile" > "$lockfile"
-    fi
-
-    if test -n "$fix_srcfile_path"; then
-      eval srcfile=\"$fix_srcfile_path\"
-    fi
-    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
-    case $qsrcfile in
-      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-      qsrcfile="\"$qsrcfile\"" ;;
-    esac
-
-    $run $rm "$libobj" "${libobj}T"
-
-    # Create a libtool object file (analogous to a ".la" file),
-    # but don't create it if we're doing a dry run.
-    test -z "$run" && cat > ${libobj}T <<EOF
-# $libobj - a libtool object file
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# Name of the PIC object.
-EOF
-
-    # Only build a PIC object if we are building libtool libraries.
-    if test "$build_libtool_libs" = yes; then
-      # Without this assignment, base_compile gets emptied.
-      fbsd_hideous_sh_bug=$base_compile
-
-      if test "$pic_mode" != no; then
-	command="$base_compile $qsrcfile $pic_flag"
-      else
-	# Don't build PIC code
-	command="$base_compile $qsrcfile"
-      fi
-
-      if test ! -d "${xdir}$objdir"; then
-	$show "$mkdir ${xdir}$objdir"
-	$run $mkdir ${xdir}$objdir
-	exit_status=$?
-	if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
-	  exit $exit_status
-	fi
-      fi
-
-      if test -z "$output_obj"; then
-	# Place PIC objects in $objdir
-	command="$command -o $lobj"
-      fi
-
-      $run $rm "$lobj" "$output_obj"
-
-      $show "$command"
-      if $run eval $lt_env "$command"; then :
-      else
-	test -n "$output_obj" && $run $rm $removelist
-	exit $EXIT_FAILURE
-      fi
-
-      if test "$need_locks" = warn &&
-	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
-	$echo "\
-*** ERROR, $lockfile contains:
-`cat $lockfile 2>/dev/null`
-
-but it should contain:
-$srcfile
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together.  If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
-	$run $rm $removelist
-	exit $EXIT_FAILURE
-      fi
-
-      # Just move the object if needed, then go on to compile the next one
-      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
-	$show "$mv $output_obj $lobj"
-	if $run $mv $output_obj $lobj; then :
-	else
-	  error=$?
-	  $run $rm $removelist
-	  exit $error
-	fi
-      fi
-
-      # Append the name of the PIC object to the libtool object file.
-      test -z "$run" && cat >> ${libobj}T <<EOF
-pic_object='$objdir/$objname'
-
-EOF
-
-      # Allow error messages only from the first compilation.
-      if test "$suppress_opt" = yes; then
-        suppress_output=' >/dev/null 2>&1'
-      fi
-    else
-      # No PIC object so indicate it doesn't exist in the libtool
-      # object file.
-      test -z "$run" && cat >> ${libobj}T <<EOF
-pic_object=none
-
-EOF
-    fi
-
-    # Only build a position-dependent object if we build old libraries.
-    if test "$build_old_libs" = yes; then
-      if test "$pic_mode" != yes; then
-	# Don't build PIC code
-	command="$base_compile $qsrcfile"
-      else
-	command="$base_compile $qsrcfile $pic_flag"
-      fi
-      if test "$compiler_c_o" = yes; then
-	command="$command -o $obj"
-      fi
-
-      # Suppress compiler output if we already did a PIC compilation.
-      command="$command$suppress_output"
-      $run $rm "$obj" "$output_obj"
-      $show "$command"
-      if $run eval $lt_env "$command"; then :
-      else
-	$run $rm $removelist
-	exit $EXIT_FAILURE
-      fi
-
-      if test "$need_locks" = warn &&
-	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
-	$echo "\
-*** ERROR, $lockfile contains:
-`cat $lockfile 2>/dev/null`
-
-but it should contain:
-$srcfile
-
-This indicates that another process is trying to use the same
-temporary object file, and libtool could not work around it because
-your compiler does not support \`-c' and \`-o' together.  If you
-repeat this compilation, it may succeed, by chance, but you had better
-avoid parallel builds (make -j) in this platform, or get a better
-compiler."
-
-	$run $rm $removelist
-	exit $EXIT_FAILURE
-      fi
-
-      # Just move the object if needed
-      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
-	$show "$mv $output_obj $obj"
-	if $run $mv $output_obj $obj; then :
-	else
-	  error=$?
-	  $run $rm $removelist
-	  exit $error
-	fi
-      fi
-
-      # Append the name of the non-PIC object the libtool object file.
-      # Only append if the libtool object file exists.
-      test -z "$run" && cat >> ${libobj}T <<EOF
-# Name of the non-PIC object.
-non_pic_object='$objname'
-
-EOF
-    else
-      # Append the name of the non-PIC object the libtool object file.
-      # Only append if the libtool object file exists.
-      test -z "$run" && cat >> ${libobj}T <<EOF
-# Name of the non-PIC object.
-non_pic_object=none
-
-EOF
-    fi
-
-    $run $mv "${libobj}T" "${libobj}"
-
-    # Unlock the critical section if it was locked
-    if test "$need_locks" != no; then
-      $run $rm "$lockfile"
-    fi
-
-    exit $EXIT_SUCCESS
-    ;;
-
-  # libtool link mode
-  link | relink)
-    modename="$modename: link"
-    case $host in
-    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
-      # It is impossible to link a dll without this setting, and
-      # we shouldn't force the makefile maintainer to figure out
-      # which system we are compiling for in order to pass an extra
-      # flag for every libtool invocation.
-      # allow_undefined=no
-
-      # FIXME: Unfortunately, there are problems with the above when trying
-      # to make a dll which has undefined symbols, in which case not
-      # even a static library is built.  For now, we need to specify
-      # -no-undefined on the libtool link line when we can be certain
-      # that all symbols are satisfied, otherwise we get a static library.
-      allow_undefined=yes
-      ;;
-    *)
-      allow_undefined=yes
-      ;;
-    esac
-    libtool_args="$nonopt"
-    base_compile="$nonopt $@"
-    compile_command="$nonopt"
-    finalize_command="$nonopt"
-
-    compile_rpath=
-    finalize_rpath=
-    compile_shlibpath=
-    finalize_shlibpath=
-    convenience=
-    old_convenience=
-    deplibs=
-    old_deplibs=
-    compiler_flags=
-    linker_flags=
-    dllsearchpath=
-    lib_search_path=`pwd`
-    inst_prefix_dir=
-
-    avoid_version=no
-    dlfiles=
-    dlprefiles=
-    dlself=no
-    export_dynamic=no
-    export_symbols=
-    export_symbols_regex=
-    generated=
-    libobjs=
-    ltlibs=
-    module=no
-    no_install=no
-    objs=
-    non_pic_objects=
-    notinst_path= # paths that contain not-installed libtool libraries
-    precious_files_regex=
-    prefer_static_libs=no
-    preload=no
-    prev=
-    prevarg=
-    release=
-    rpath=
-    xrpath=
-    perm_rpath=
-    temp_rpath=
-    thread_safe=no
-    vinfo=
-    vinfo_number=no
-    single_module="${wl}-single_module"
-
-    func_infer_tag $base_compile
-
-    # We need to know -static, to get the right output filenames.
-    for arg
-    do
-      case $arg in
-      -all-static | -static | -static-libtool-libs)
-	case $arg in
-	-all-static)
-	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
-	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
-	  fi
-	  if test -n "$link_static_flag"; then
-	    dlopen_self=$dlopen_self_static
-	  fi
-	  prefer_static_libs=yes
-	  ;;
-	-static)
-	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
-	    dlopen_self=$dlopen_self_static
-	  fi
-	  prefer_static_libs=built
-	  ;;
-	-static-libtool-libs)
-	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
-	    dlopen_self=$dlopen_self_static
-	  fi
-	  prefer_static_libs=yes
-	  ;;
-	esac
-	build_libtool_libs=no
-	build_old_libs=yes
-	break
-	;;
-      esac
-    done
-
-    # See if our shared archives depend on static archives.
-    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
-
-    # Go through the arguments, transforming them on the way.
-    while test "$#" -gt 0; do
-      arg="$1"
-      shift
-      case $arg in
-      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
-	;;
-      *) qarg=$arg ;;
-      esac
-      libtool_args="$libtool_args $qarg"
-
-      # If the previous option needs an argument, assign it.
-      if test -n "$prev"; then
-	case $prev in
-	output)
-	  compile_command="$compile_command @OUTPUT@"
-	  finalize_command="$finalize_command @OUTPUT@"
-	  ;;
-	esac
-
-	case $prev in
-	dlfiles|dlprefiles)
-	  if test "$preload" = no; then
-	    # Add the symbol object into the linking commands.
-	    compile_command="$compile_command @SYMFILE@"
-	    finalize_command="$finalize_command @SYMFILE@"
-	    preload=yes
-	  fi
-	  case $arg in
-	  *.la | *.lo) ;;  # We handle these cases below.
-	  force)
-	    if test "$dlself" = no; then
-	      dlself=needless
-	      export_dynamic=yes
-	    fi
-	    prev=
-	    continue
-	    ;;
-	  self)
-	    if test "$prev" = dlprefiles; then
-	      dlself=yes
-	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
-	      dlself=yes
-	    else
-	      dlself=needless
-	      export_dynamic=yes
-	    fi
-	    prev=
-	    continue
-	    ;;
-	  *)
-	    if test "$prev" = dlfiles; then
-	      dlfiles="$dlfiles $arg"
-	    else
-	      dlprefiles="$dlprefiles $arg"
-	    fi
-	    prev=
-	    continue
-	    ;;
-	  esac
-	  ;;
-	expsyms)
-	  export_symbols="$arg"
-	  if test ! -f "$arg"; then
-	    $echo "$modename: symbol file \`$arg' does not exist"
-	    exit $EXIT_FAILURE
-	  fi
-	  prev=
-	  continue
-	  ;;
-	expsyms_regex)
-	  export_symbols_regex="$arg"
-	  prev=
-	  continue
-	  ;;
-	inst_prefix)
-	  inst_prefix_dir="$arg"
-	  prev=
-	  continue
-	  ;;
-	precious_regex)
-	  precious_files_regex="$arg"
-	  prev=
-	  continue
-	  ;;
-	release)
-	  release="-$arg"
-	  prev=
-	  continue
-	  ;;
-	objectlist)
-	  if test -f "$arg"; then
-	    save_arg=$arg
-	    moreargs=
-	    for fil in `cat $save_arg`
-	    do
-#	      moreargs="$moreargs $fil"
-	      arg=$fil
-	      # A libtool-controlled object.
-
-	      # Check to see that this really is a libtool object.
-	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
-		pic_object=
-		non_pic_object=
-
-		# Read the .lo file
-		# If there is no directory component, then add one.
-		case $arg in
-		*/* | *\\*) . $arg ;;
-		*) . ./$arg ;;
-		esac
-
-		if test -z "$pic_object" || \
-		   test -z "$non_pic_object" ||
-		   test "$pic_object" = none && \
-		   test "$non_pic_object" = none; then
-		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
-		  exit $EXIT_FAILURE
-		fi
-
-		# Extract subdirectory from the argument.
-		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
-		if test "X$xdir" = "X$arg"; then
-		  xdir=
-		else
-		  xdir="$xdir/"
-		fi
-
-		if test "$pic_object" != none; then
-		  # Prepend the subdirectory the object is found in.
-		  pic_object="$xdir$pic_object"
-
-		  if test "$prev" = dlfiles; then
-		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
-		      dlfiles="$dlfiles $pic_object"
-		      prev=
-		      continue
-		    else
-		      # If libtool objects are unsupported, then we need to preload.
-		      prev=dlprefiles
-		    fi
-		  fi
-
-		  # CHECK ME:  I think I busted this.  -Ossama
-		  if test "$prev" = dlprefiles; then
-		    # Preload the old-style object.
-		    dlprefiles="$dlprefiles $pic_object"
-		    prev=
-		  fi
-
-		  # A PIC object.
-		  libobjs="$libobjs $pic_object"
-		  arg="$pic_object"
-		fi
-
-		# Non-PIC object.
-		if test "$non_pic_object" != none; then
-		  # Prepend the subdirectory the object is found in.
-		  non_pic_object="$xdir$non_pic_object"
-
-		  # A standard non-PIC object
-		  non_pic_objects="$non_pic_objects $non_pic_object"
-		  if test -z "$pic_object" || test "$pic_object" = none ; then
-		    arg="$non_pic_object"
-		  fi
-		else
-		  # If the PIC object exists, use it instead.
-		  # $xdir was prepended to $pic_object above.
-		  non_pic_object="$pic_object"
-		  non_pic_objects="$non_pic_objects $non_pic_object"
-		fi
-	      else
-		# Only an error if not doing a dry-run.
-		if test -z "$run"; then
-		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
-		  exit $EXIT_FAILURE
-		else
-		  # Dry-run case.
-
-		  # Extract subdirectory from the argument.
-		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
-		  if test "X$xdir" = "X$arg"; then
-		    xdir=
-		  else
-		    xdir="$xdir/"
-		  fi
-
-		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
-		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
-		  libobjs="$libobjs $pic_object"
-		  non_pic_objects="$non_pic_objects $non_pic_object"
-		fi
-	      fi
-	    done
-	  else
-	    $echo "$modename: link input file \`$save_arg' does not exist"
-	    exit $EXIT_FAILURE
-	  fi
-	  arg=$save_arg
-	  prev=
-	  continue
-	  ;;
-	rpath | xrpath)
-	  # We need an absolute path.
-	  case $arg in
-	  [\\/]* | [A-Za-z]:[\\/]*) ;;
-	  *)
-	    $echo "$modename: only absolute run-paths are allowed" 1>&2
-	    exit $EXIT_FAILURE
-	    ;;
-	  esac
-	  if test "$prev" = rpath; then
-	    case "$rpath " in
-	    *" $arg "*) ;;
-	    *) rpath="$rpath $arg" ;;
-	    esac
-	  else
-	    case "$xrpath " in
-	    *" $arg "*) ;;
-	    *) xrpath="$xrpath $arg" ;;
-	    esac
-	  fi
-	  prev=
-	  continue
-	  ;;
-	xcompiler)
-	  compiler_flags="$compiler_flags $qarg"
-	  prev=
-	  compile_command="$compile_command $qarg"
-	  finalize_command="$finalize_command $qarg"
-	  continue
-	  ;;
-	xlinker)
-	  linker_flags="$linker_flags $qarg"
-	  compiler_flags="$compiler_flags $wl$qarg"
-	  prev=
-	  compile_command="$compile_command $wl$qarg"
-	  finalize_command="$finalize_command $wl$qarg"
-	  continue
-	  ;;
-	xcclinker)
-	  linker_flags="$linker_flags $qarg"
-	  compiler_flags="$compiler_flags $qarg"
-	  prev=
-	  compile_command="$compile_command $qarg"
-	  finalize_command="$finalize_command $qarg"
-	  continue
-	  ;;
-	shrext)
-  	  shrext_cmds="$arg"
-	  prev=
-	  continue
-	  ;;
-	darwin_framework|darwin_framework_skip)
-	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
-	  compile_command="$compile_command $arg"
-	  finalize_command="$finalize_command $arg"
-	  prev=
-	  continue
-	  ;;
-	*)
-	  eval "$prev=\"\$arg\""
-	  prev=
-	  continue
-	  ;;
-	esac
-      fi # test -n "$prev"
-
-      prevarg="$arg"
-
-      case $arg in
-      -all-static)
-	if test -n "$link_static_flag"; then
-	  compile_command="$compile_command $link_static_flag"
-	  finalize_command="$finalize_command $link_static_flag"
-	fi
-	continue
-	;;
-
-      -allow-undefined)
-	# FIXME: remove this flag sometime in the future.
-	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
-	continue
-	;;
-
-      -avoid-version)
-	avoid_version=yes
-	continue
-	;;
-
-      -dlopen)
-	prev=dlfiles
-	continue
-	;;
-
-      -dlpreopen)
-	prev=dlprefiles
-	continue
-	;;
-
-      -export-dynamic)
-	export_dynamic=yes
-	continue
-	;;
-
-      -export-symbols | -export-symbols-regex)
-	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
-	  $echo "$modename: more than one -exported-symbols argument is not allowed"
-	  exit $EXIT_FAILURE
-	fi
-	if test "X$arg" = "X-export-symbols"; then
-	  prev=expsyms
-	else
-	  prev=expsyms_regex
-	fi
-	continue
-	;;
-
-      -framework|-arch|-isysroot)
-	case " $CC " in
-	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
-		prev=darwin_framework_skip ;;
-	  *) compiler_flags="$compiler_flags $arg"
-	     prev=darwin_framework ;;
-	esac
-	compile_command="$compile_command $arg"
-	finalize_command="$finalize_command $arg"
-	continue
-	;;
-
-      -inst-prefix-dir)
-	prev=inst_prefix
-	continue
-	;;
-
-      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
-      # so, if we see these flags be careful not to treat them like -L
-      -L[A-Z][A-Z]*:*)
-	case $with_gcc/$host in
-	no/*-*-irix* | /*-*-irix*)
-	  compile_command="$compile_command $arg"
-	  finalize_command="$finalize_command $arg"
-	  ;;
-	esac
-	continue
-	;;
-
-      -L*)
-	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
-	# We need an absolute path.
-	case $dir in
-	[\\/]* | [A-Za-z]:[\\/]*) ;;
-	*)
-	  absdir=`cd "$dir" && pwd`
-	  if test -z "$absdir"; then
-	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
-	    absdir="$dir"
-	    notinst_path="$notinst_path $dir"
-	  fi
-	  dir="$absdir"
-	  ;;
-	esac
-	case "$deplibs " in
-	*" -L$dir "*) ;;
-	*)
-	  deplibs="$deplibs -L$dir"
-	  lib_search_path="$lib_search_path $dir"
-	  ;;
-	esac
-	case $host in
-	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
-	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
-	  case :$dllsearchpath: in
-	  *":$dir:"*) ;;
-	  *) dllsearchpath="$dllsearchpath:$dir";;
-	  esac
-	  case :$dllsearchpath: in
-	  *":$testbindir:"*) ;;
-	  *) dllsearchpath="$dllsearchpath:$testbindir";;
-	  esac
-	  ;;
-	esac
-	continue
-	;;
-
-      -l*)
-	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
-	  case $host in
-	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
-	    # These systems don't actually have a C or math library (as such)
-	    continue
-	    ;;
-	  *-*-os2*)
-	    # These systems don't actually have a C library (as such)
-	    test "X$arg" = "X-lc" && continue
-	    ;;
-	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
-	    # Do not include libc due to us having libc/libc_r.
-	    test "X$arg" = "X-lc" && continue
-	    ;;
-	  *-*-rhapsody* | *-*-darwin1.[012])
-	    # Rhapsody C and math libraries are in the System framework
-	    deplibs="$deplibs -framework System"
-	    continue
-	    ;;
-	  *-*-sco3.2v5* | *-*-sco5v6*)
-	    # Causes problems with __ctype
-	    test "X$arg" = "X-lc" && continue
-	    ;;
-	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
-	    # Compiler inserts libc in the correct place for threads to work
-	    test "X$arg" = "X-lc" && continue
-	    ;;
-	  esac
-	elif test "X$arg" = "X-lc_r"; then
-	 case $host in
-	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
-	   # Do not include libc_r directly, use -pthread flag.
-	   continue
-	   ;;
-	 esac
-	fi
-	deplibs="$deplibs $arg"
-	continue
-	;;
-
-      # Tru64 UNIX uses -model [arg] to determine the layout of C++
-      # classes, name mangling, and exception handling.
-      -model)
-	compile_command="$compile_command $arg"
-	compiler_flags="$compiler_flags $arg"
-	finalize_command="$finalize_command $arg"
-	prev=xcompiler
-	continue
-	;;
-
-     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
-	compiler_flags="$compiler_flags $arg"
-	compile_command="$compile_command $arg"
-	finalize_command="$finalize_command $arg"
-	continue
-	;;
-
-      -multi_module)
-	single_module="${wl}-multi_module"
-	continue
-	;;
-
-      -module)
-	module=yes
-	continue
-	;;
-
-      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
-      # -r[0-9][0-9]* specifies the processor on the SGI compiler
-      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
-      # +DA*, +DD* enable 64-bit mode on the HP compiler
-      # -q* pass through compiler args for the IBM compiler
-      # -m* pass through architecture-specific compiler args for GCC
-      # -m*, -t[45]*, -txscale* pass through architecture-specific
-      # compiler args for GCC
-      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
-      # -F/path gives path to uninstalled frameworks, gcc on darwin
-      # @file GCC response files
-      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
-      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
-
-	# Unknown arguments in both finalize_command and compile_command need
-	# to be aesthetically quoted because they are evaled later.
-	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
-	case $arg in
-	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	  arg="\"$arg\""
-	  ;;
-	esac
-        compile_command="$compile_command $arg"
-        finalize_command="$finalize_command $arg"
-        compiler_flags="$compiler_flags $arg"
-        continue
-        ;;
-
-      -shrext)
-	prev=shrext
-	continue
-	;;
-
-      -no-fast-install)
-	fast_install=no
-	continue
-	;;
-
-      -no-install)
-	case $host in
-	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
-	  # The PATH hackery in wrapper scripts is required on Windows
-	  # and Darwin in order for the loader to find any dlls it needs.
-	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
-	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
-	  fast_install=no
-	  ;;
-	*) no_install=yes ;;
-	esac
-	continue
-	;;
-
-      -no-undefined)
-	allow_undefined=no
-	continue
-	;;
-
-      -objectlist)
-	prev=objectlist
-	continue
-	;;
-
-      -o) prev=output ;;
-
-      -precious-files-regex)
-	prev=precious_regex
-	continue
-	;;
-
-      -release)
-	prev=release
-	continue
-	;;
-
-      -rpath)
-	prev=rpath
-	continue
-	;;
-
-      -R)
-	prev=xrpath
-	continue
-	;;
-
-      -R*)
-	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
-	# We need an absolute path.
-	case $dir in
-	[\\/]* | [A-Za-z]:[\\/]*) ;;
-	*)
-	  $echo "$modename: only absolute run-paths are allowed" 1>&2
-	  exit $EXIT_FAILURE
-	  ;;
-	esac
-	case "$xrpath " in
-	*" $dir "*) ;;
-	*) xrpath="$xrpath $dir" ;;
-	esac
-	continue
-	;;
-
-      -static | -static-libtool-libs)
-	# The effects of -static are defined in a previous loop.
-	# We used to do the same as -all-static on platforms that
-	# didn't have a PIC flag, but the assumption that the effects
-	# would be equivalent was wrong.  It would break on at least
-	# Digital Unix and AIX.
-	continue
-	;;
-
-      -thread-safe)
-	thread_safe=yes
-	continue
-	;;
-
-      -version-info)
-	prev=vinfo
-	continue
-	;;
-      -version-number)
-	prev=vinfo
-	vinfo_number=yes
-	continue
-	;;
-
-      -Wc,*)
-	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
-	arg=
-	save_ifs="$IFS"; IFS=','
-	for flag in $args; do
-	  IFS="$save_ifs"
-	  case $flag in
-	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	    flag="\"$flag\""
-	    ;;
-	  esac
-	  arg="$arg $wl$flag"
-	  compiler_flags="$compiler_flags $flag"
-	done
-	IFS="$save_ifs"
-	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
-	;;
-
-      -Wl,*)
-	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
-	arg=
-	save_ifs="$IFS"; IFS=','
-	for flag in $args; do
-	  IFS="$save_ifs"
-	  case $flag in
-	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	    flag="\"$flag\""
-	    ;;
-	  esac
-	  arg="$arg $wl$flag"
-	  compiler_flags="$compiler_flags $wl$flag"
-	  linker_flags="$linker_flags $flag"
-	done
-	IFS="$save_ifs"
-	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
-	;;
-
-      -Xcompiler)
-	prev=xcompiler
-	continue
-	;;
-
-      -Xlinker)
-	prev=xlinker
-	continue
-	;;
-
-      -XCClinker)
-	prev=xcclinker
-	continue
-	;;
-
-      # Some other compiler flag.
-      -* | +*)
-	# Unknown arguments in both finalize_command and compile_command need
-	# to be aesthetically quoted because they are evaled later.
-	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
-	case $arg in
-	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	  arg="\"$arg\""
-	  ;;
-	esac
-	;;
-
-      *.$objext)
-	# A standard object.
-	objs="$objs $arg"
-	;;
-
-      *.lo)
-	# A libtool-controlled object.
-
-	# Check to see that this really is a libtool object.
-	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
-	  pic_object=
-	  non_pic_object=
-
-	  # Read the .lo file
-	  # If there is no directory component, then add one.
-	  case $arg in
-	  */* | *\\*) . $arg ;;
-	  *) . ./$arg ;;
-	  esac
-
-	  if test -z "$pic_object" || \
-	     test -z "$non_pic_object" ||
-	     test "$pic_object" = none && \
-	     test "$non_pic_object" = none; then
-	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
-	    exit $EXIT_FAILURE
-	  fi
-
-	  # Extract subdirectory from the argument.
-	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
-	  if test "X$xdir" = "X$arg"; then
-	    xdir=
- 	  else
-	    xdir="$xdir/"
-	  fi
-
-	  if test "$pic_object" != none; then
-	    # Prepend the subdirectory the object is found in.
-	    pic_object="$xdir$pic_object"
-
-	    if test "$prev" = dlfiles; then
-	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
-		dlfiles="$dlfiles $pic_object"
-		prev=
-		continue
-	      else
-		# If libtool objects are unsupported, then we need to preload.
-		prev=dlprefiles
-	      fi
-	    fi
-
-	    # CHECK ME:  I think I busted this.  -Ossama
-	    if test "$prev" = dlprefiles; then
-	      # Preload the old-style object.
-	      dlprefiles="$dlprefiles $pic_object"
-	      prev=
-	    fi
-
-	    # A PIC object.
-	    libobjs="$libobjs $pic_object"
-	    arg="$pic_object"
-	  fi
-
-	  # Non-PIC object.
-	  if test "$non_pic_object" != none; then
-	    # Prepend the subdirectory the object is found in.
-	    non_pic_object="$xdir$non_pic_object"
-
-	    # A standard non-PIC object
-	    non_pic_objects="$non_pic_objects $non_pic_object"
-	    if test -z "$pic_object" || test "$pic_object" = none ; then
-	      arg="$non_pic_object"
-	    fi
-	  else
-	    # If the PIC object exists, use it instead.
-	    # $xdir was prepended to $pic_object above.
-	    non_pic_object="$pic_object"
-	    non_pic_objects="$non_pic_objects $non_pic_object"
-	  fi
-	else
-	  # Only an error if not doing a dry-run.
-	  if test -z "$run"; then
-	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
-	    exit $EXIT_FAILURE
-	  else
-	    # Dry-run case.
-
-	    # Extract subdirectory from the argument.
-	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
-	    if test "X$xdir" = "X$arg"; then
-	      xdir=
-	    else
-	      xdir="$xdir/"
-	    fi
-
-	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
-	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
-	    libobjs="$libobjs $pic_object"
-	    non_pic_objects="$non_pic_objects $non_pic_object"
-	  fi
-	fi
-	;;
-
-      *.$libext)
-	# An archive.
-	deplibs="$deplibs $arg"
-	old_deplibs="$old_deplibs $arg"
-	continue
-	;;
-
-      *.la)
-	# A libtool-controlled library.
-
-	if test "$prev" = dlfiles; then
-	  # This library was specified with -dlopen.
-	  dlfiles="$dlfiles $arg"
-	  prev=
-	elif test "$prev" = dlprefiles; then
-	  # The library was specified with -dlpreopen.
-	  dlprefiles="$dlprefiles $arg"
-	  prev=
-	else
-	  deplibs="$deplibs $arg"
-	fi
-	continue
-	;;
-
-      # Some other compiler argument.
-      *)
-	# Unknown arguments in both finalize_command and compile_command need
-	# to be aesthetically quoted because they are evaled later.
-	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
-	case $arg in
-	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	  arg="\"$arg\""
-	  ;;
-	esac
-	;;
-      esac # arg
-
-      # Now actually substitute the argument into the commands.
-      if test -n "$arg"; then
-	compile_command="$compile_command $arg"
-	finalize_command="$finalize_command $arg"
-      fi
-    done # argument parsing loop
-
-    if test -n "$prev"; then
-      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
-      $echo "$help" 1>&2
-      exit $EXIT_FAILURE
-    fi
-
-    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
-      eval arg=\"$export_dynamic_flag_spec\"
-      compile_command="$compile_command $arg"
-      finalize_command="$finalize_command $arg"
-    fi
-
-    oldlibs=
-    # calculate the name of the file, without its directory
-    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
-    libobjs_save="$libobjs"
-
-    if test -n "$shlibpath_var"; then
-      # get the directories listed in $shlibpath_var
-      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
-    else
-      shlib_search_path=
-    fi
-    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
-    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
-
-    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
-    if test "X$output_objdir" = "X$output"; then
-      output_objdir="$objdir"
-    else
-      output_objdir="$output_objdir/$objdir"
-    fi
-    # Create the object directory.
-    if test ! -d "$output_objdir"; then
-      $show "$mkdir $output_objdir"
-      $run $mkdir $output_objdir
-      exit_status=$?
-      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
-	exit $exit_status
-      fi
-    fi
-
-    # Determine the type of output
-    case $output in
-    "")
-      $echo "$modename: you must specify an output file" 1>&2
-      $echo "$help" 1>&2
-      exit $EXIT_FAILURE
-      ;;
-    *.$libext) linkmode=oldlib ;;
-    *.lo | *.$objext) linkmode=obj ;;
-    *.la) linkmode=lib ;;
-    *) linkmode=prog ;; # Anything else should be a program.
-    esac
-
-    case $host in
-    *cygwin* | *mingw* | *pw32*)
-      # don't eliminate duplications in $postdeps and $predeps
-      duplicate_compiler_generated_deps=yes
-      ;;
-    *)
-      duplicate_compiler_generated_deps=$duplicate_deps
-      ;;
-    esac
-    specialdeplibs=
-
-    libs=
-    # Find all interdependent deplibs by searching for libraries
-    # that are linked more than once (e.g. -la -lb -la)
-    for deplib in $deplibs; do
-      if test "X$duplicate_deps" = "Xyes" ; then
-	case "$libs " in
-	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
-	esac
-      fi
-      libs="$libs $deplib"
-    done
-
-    if test "$linkmode" = lib; then
-      libs="$predeps $libs $compiler_lib_search_path $postdeps"
-
-      # Compute libraries that are listed more than once in $predeps
-      # $postdeps and mark them as special (i.e., whose duplicates are
-      # not to be eliminated).
-      pre_post_deps=
-      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
-	for pre_post_dep in $predeps $postdeps; do
-	  case "$pre_post_deps " in
-	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
-	  esac
-	  pre_post_deps="$pre_post_deps $pre_post_dep"
-	done
-      fi
-      pre_post_deps=
-    fi
-
-    deplibs=
-    newdependency_libs=
-    newlib_search_path=
-    need_relink=no # whether we're linking any uninstalled libtool libraries
-    notinst_deplibs= # not-installed libtool libraries
-    case $linkmode in
-    lib)
-	passes="conv link"
-	for file in $dlfiles $dlprefiles; do
-	  case $file in
-	  *.la) ;;
-	  *)
-	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
-	    exit $EXIT_FAILURE
-	    ;;
-	  esac
-	done
-	;;
-    prog)
-	compile_deplibs=
-	finalize_deplibs=
-	alldeplibs=no
-	newdlfiles=
-	newdlprefiles=
-	passes="conv scan dlopen dlpreopen link"
-	;;
-    *)  passes="conv"
-	;;
-    esac
-    for pass in $passes; do
-      if test "$linkmode,$pass" = "lib,link" ||
-	 test "$linkmode,$pass" = "prog,scan"; then
-	libs="$deplibs"
-	deplibs=
-      fi
-      if test "$linkmode" = prog; then
-	case $pass in
-	dlopen) libs="$dlfiles" ;;
-	dlpreopen) libs="$dlprefiles" ;;
-	link)
-	  libs="$deplibs %DEPLIBS%"
-	  test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
-	  ;;
-	esac
-      fi
-      if test "$pass" = dlopen; then
-	# Collect dlpreopened libraries
-	save_deplibs="$deplibs"
-	deplibs=
-      fi
-      for deplib in $libs; do
-	lib=
-	found=no
-	case $deplib in
-	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
-	  if test "$linkmode,$pass" = "prog,link"; then
-	    compile_deplibs="$deplib $compile_deplibs"
-	    finalize_deplibs="$deplib $finalize_deplibs"
-	  else
-	    compiler_flags="$compiler_flags $deplib"
-	  fi
-	  continue
-	  ;;
-	-l*)
-	  if test "$linkmode" != lib && test "$linkmode" != prog; then
-	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
-	    continue
-	  fi
-	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
-	  if test "$linkmode" = lib; then
-	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
-	  else
-	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
-	  fi
-	  for searchdir in $searchdirs; do
-	    for search_ext in .la $std_shrext .so .a; do
-	      # Search the libtool library
-	      lib="$searchdir/lib${name}${search_ext}"
-	      if test -f "$lib"; then
-		if test "$search_ext" = ".la"; then
-		  found=yes
-		else
-		  found=no
-		fi
-		break 2
-	      fi
-	    done
-	  done
-	  if test "$found" != yes; then
-	    # deplib doesn't seem to be a libtool library
-	    if test "$linkmode,$pass" = "prog,link"; then
-	      compile_deplibs="$deplib $compile_deplibs"
-	      finalize_deplibs="$deplib $finalize_deplibs"
-	    else
-	      deplibs="$deplib $deplibs"
-	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
-	    fi
-	    continue
-	  else # deplib is a libtool library
-	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
-	    # We need to do some special things here, and not later.
-	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-	      case " $predeps $postdeps " in
-	      *" $deplib "*)
-		if (${SED} -e '2q' $lib |
-                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
-		  library_names=
-		  old_library=
-		  case $lib in
-		  */* | *\\*) . $lib ;;
-		  *) . ./$lib ;;
-		  esac
-		  for l in $old_library $library_names; do
-		    ll="$l"
-		  done
-		  if test "X$ll" = "X$old_library" ; then # only static version available
-		    found=no
-		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
-		    test "X$ladir" = "X$lib" && ladir="."
-		    lib=$ladir/$old_library
-		    if test "$linkmode,$pass" = "prog,link"; then
-		      compile_deplibs="$deplib $compile_deplibs"
-		      finalize_deplibs="$deplib $finalize_deplibs"
-		    else
-		      deplibs="$deplib $deplibs"
-		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
-		    fi
-		    continue
-		  fi
-		fi
-	        ;;
-	      *) ;;
-	      esac
-	    fi
-	  fi
-	  ;; # -l
-	-L*)
-	  case $linkmode in
-	  lib)
-	    deplibs="$deplib $deplibs"
-	    test "$pass" = conv && continue
-	    newdependency_libs="$deplib $newdependency_libs"
-	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
-	    ;;
-	  prog)
-	    if test "$pass" = conv; then
-	      deplibs="$deplib $deplibs"
-	      continue
-	    fi
-	    if test "$pass" = scan; then
-	      deplibs="$deplib $deplibs"
-	    else
-	      compile_deplibs="$deplib $compile_deplibs"
-	      finalize_deplibs="$deplib $finalize_deplibs"
-	    fi
-	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
-	    ;;
-	  *)
-	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
-	    ;;
-	  esac # linkmode
-	  continue
-	  ;; # -L
-	-R*)
-	  if test "$pass" = link; then
-	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
-	    # Make sure the xrpath contains only unique directories.
-	    case "$xrpath " in
-	    *" $dir "*) ;;
-	    *) xrpath="$xrpath $dir" ;;
-	    esac
-	  fi
-	  deplibs="$deplib $deplibs"
-	  continue
-	  ;;
-	*.la) lib="$deplib" ;;
-	*.$libext)
-	  if test "$pass" = conv; then
-	    deplibs="$deplib $deplibs"
-	    continue
-	  fi
-	  case $linkmode in
-	  lib)
-	    valid_a_lib=no
-	    case $deplibs_check_method in
-	      match_pattern*)
-		set dummy $deplibs_check_method
-	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
-		if eval $echo \"$deplib\" 2>/dev/null \
-		    | $SED 10q \
-		    | $EGREP "$match_pattern_regex" > /dev/null; then
-		  valid_a_lib=yes
-		fi
-		;;
-	      pass_all)
-		valid_a_lib=yes
-		;;
-            esac
-	    if test "$valid_a_lib" != yes; then
-	      $echo
-	      $echo "*** Warning: Trying to link with static lib archive $deplib."
-	      $echo "*** I have the capability to make that library automatically link in when"
-	      $echo "*** you link to this library.  But I can only do this if you have a"
-	      $echo "*** shared version of the library, which you do not appear to have"
-	      $echo "*** because the file extensions .$libext of this argument makes me believe"
-	      $echo "*** that it is just a static archive that I should not used here."
-	    else
-	      $echo
-	      $echo "*** Warning: Linking the shared library $output against the"
-	      $echo "*** static library $deplib is not portable!"
-	      deplibs="$deplib $deplibs"
-	    fi
-	    continue
-	    ;;
-	  prog)
-	    if test "$pass" != link; then
-	      deplibs="$deplib $deplibs"
-	    else
-	      compile_deplibs="$deplib $compile_deplibs"
-	      finalize_deplibs="$deplib $finalize_deplibs"
-	    fi
-	    continue
-	    ;;
-	  esac # linkmode
-	  ;; # *.$libext
-	*.lo | *.$objext)
-	  if test "$pass" = conv; then
-	    deplibs="$deplib $deplibs"
-	  elif test "$linkmode" = prog; then
-	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
-	      # If there is no dlopen support or we're linking statically,
-	      # we need to preload.
-	      newdlprefiles="$newdlprefiles $deplib"
-	      compile_deplibs="$deplib $compile_deplibs"
-	      finalize_deplibs="$deplib $finalize_deplibs"
-	    else
-	      newdlfiles="$newdlfiles $deplib"
-	    fi
-	  fi
-	  continue
-	  ;;
-	%DEPLIBS%)
-	  alldeplibs=yes
-	  continue
-	  ;;
-	esac # case $deplib
-	if test "$found" = yes || test -f "$lib"; then :
-	else
-	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
-	  exit $EXIT_FAILURE
-	fi
-
-	# Check to see that this really is a libtool archive.
-	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
-	else
-	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
-	  exit $EXIT_FAILURE
-	fi
-
-	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
-	test "X$ladir" = "X$lib" && ladir="."
-
-	dlname=
-	dlopen=
-	dlpreopen=
-	libdir=
-	library_names=
-	old_library=
-	# If the library was installed with an old release of libtool,
-	# it will not redefine variables installed, or shouldnotlink
-	installed=yes
-	shouldnotlink=no
-	avoidtemprpath=
-
-
-	# Read the .la file
-	case $lib in
-	*/* | *\\*) . $lib ;;
-	*) . ./$lib ;;
-	esac
-
-	if test "$linkmode,$pass" = "lib,link" ||
-	   test "$linkmode,$pass" = "prog,scan" ||
-	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
-	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
-	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
-	fi
-
-	if test "$pass" = conv; then
-	  # Only check for convenience libraries
-	  deplibs="$lib $deplibs"
-	  if test -z "$libdir"; then
-	    if test -z "$old_library"; then
-	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
-	      exit $EXIT_FAILURE
-	    fi
-	    # It is a libtool convenience library, so add in its objects.
-	    convenience="$convenience $ladir/$objdir/$old_library"
-	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
-	    tmp_libs=
-	    for deplib in $dependency_libs; do
-	      deplibs="$deplib $deplibs"
-              if test "X$duplicate_deps" = "Xyes" ; then
-	        case "$tmp_libs " in
-	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
-	        esac
-              fi
-	      tmp_libs="$tmp_libs $deplib"
-	    done
-	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
-	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
-	    exit $EXIT_FAILURE
-	  fi
-	  continue
-	fi # $pass = conv
-
-
-	# Get the name of the library we link against.
-	linklib=
-	for l in $old_library $library_names; do
-	  linklib="$l"
-	done
-	if test -z "$linklib"; then
-	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
-	  exit $EXIT_FAILURE
-	fi
-
-	# This library was specified with -dlopen.
-	if test "$pass" = dlopen; then
-	  if test -z "$libdir"; then
-	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
-	    exit $EXIT_FAILURE
-	  fi
-	  if test -z "$dlname" ||
-	     test "$dlopen_support" != yes ||
-	     test "$build_libtool_libs" = no; then
-	    # If there is no dlname, no dlopen support or we're linking
-	    # statically, we need to preload.  We also need to preload any
-	    # dependent libraries so libltdl's deplib preloader doesn't
-	    # bomb out in the load deplibs phase.
-	    dlprefiles="$dlprefiles $lib $dependency_libs"
-	  else
-	    newdlfiles="$newdlfiles $lib"
-	  fi
-	  continue
-	fi # $pass = dlopen
-
-	# We need an absolute path.
-	case $ladir in
-	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
-	*)
-	  abs_ladir=`cd "$ladir" && pwd`
-	  if test -z "$abs_ladir"; then
-	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
-	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
-	    abs_ladir="$ladir"
-	  fi
-	  ;;
-	esac
-	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
-
-	# Find the relevant object directory and library name.
-	if test "X$installed" = Xyes; then
-	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
-	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
-	    dir="$ladir"
-	    absdir="$abs_ladir"
-	    libdir="$abs_ladir"
-	  else
-	    dir="$libdir"
-	    absdir="$libdir"
-	  fi
-	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
-	else
-	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
-	    dir="$ladir"
-	    absdir="$abs_ladir"
-	    # Remove this search path later
-	    notinst_path="$notinst_path $abs_ladir"
-	  else
-	    dir="$ladir/$objdir"
-	    absdir="$abs_ladir/$objdir"
-	    # Remove this search path later
-	    notinst_path="$notinst_path $abs_ladir"
-	  fi
-	fi # $installed = yes
-	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
-
-	# This library was specified with -dlpreopen.
-	if test "$pass" = dlpreopen; then
-	  if test -z "$libdir"; then
-	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
-	    exit $EXIT_FAILURE
-	  fi
-	  # Prefer using a static library (so that no silly _DYNAMIC symbols
-	  # are required to link).
-	  if test -n "$old_library"; then
-	    newdlprefiles="$newdlprefiles $dir/$old_library"
-	  # Otherwise, use the dlname, so that lt_dlopen finds it.
-	  elif test -n "$dlname"; then
-	    newdlprefiles="$newdlprefiles $dir/$dlname"
-	  else
-	    newdlprefiles="$newdlprefiles $dir/$linklib"
-	  fi
-	fi # $pass = dlpreopen
-
-	if test -z "$libdir"; then
-	  # Link the convenience library
-	  if test "$linkmode" = lib; then
-	    deplibs="$dir/$old_library $deplibs"
-	  elif test "$linkmode,$pass" = "prog,link"; then
-	    compile_deplibs="$dir/$old_library $compile_deplibs"
-	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
-	  else
-	    deplibs="$lib $deplibs" # used for prog,scan pass
-	  fi
-	  continue
-	fi
-
-
-	if test "$linkmode" = prog && test "$pass" != link; then
-	  newlib_search_path="$newlib_search_path $ladir"
-	  deplibs="$lib $deplibs"
-
-	  linkalldeplibs=no
-	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
-	     test "$build_libtool_libs" = no; then
-	    linkalldeplibs=yes
-	  fi
-
-	  tmp_libs=
-	  for deplib in $dependency_libs; do
-	    case $deplib in
-	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
-	    esac
-	    # Need to link against all dependency_libs?
-	    if test "$linkalldeplibs" = yes; then
-	      deplibs="$deplib $deplibs"
-	    else
-	      # Need to hardcode shared library paths
-	      # or/and link against static libraries
-	      newdependency_libs="$deplib $newdependency_libs"
-	    fi
-	    if test "X$duplicate_deps" = "Xyes" ; then
-	      case "$tmp_libs " in
-	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
-	      esac
-	    fi
-	    tmp_libs="$tmp_libs $deplib"
-	  done # for deplib
-	  continue
-	fi # $linkmode = prog...
-
-	if test "$linkmode,$pass" = "prog,link"; then
-	  if test -n "$library_names" &&
-	     { { test "$prefer_static_libs" = no ||
-		 test "$prefer_static_libs,$installed" = "built,yes"; } ||
-	       test -z "$old_library"; }; then
-	    # We need to hardcode the library path
-	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
-	      # Make sure the rpath contains only unique directories.
-	      case "$temp_rpath " in
-	      *" $dir "*) ;;
-	      *" $absdir "*) ;;
-	      *) temp_rpath="$temp_rpath $absdir" ;;
-	      esac
-	    fi
-
-	    # Hardcode the library path.
-	    # Skip directories that are in the system default run-time
-	    # search path.
-	    case " $sys_lib_dlsearch_path " in
-	    *" $absdir "*) ;;
-	    *)
-	      case "$compile_rpath " in
-	      *" $absdir "*) ;;
-	      *) compile_rpath="$compile_rpath $absdir"
-	      esac
-	      ;;
-	    esac
-	    case " $sys_lib_dlsearch_path " in
-	    *" $libdir "*) ;;
-	    *)
-	      case "$finalize_rpath " in
-	      *" $libdir "*) ;;
-	      *) finalize_rpath="$finalize_rpath $libdir"
-	      esac
-	      ;;
-	    esac
-	  fi # $linkmode,$pass = prog,link...
-
-	  if test "$alldeplibs" = yes &&
-	     { test "$deplibs_check_method" = pass_all ||
-	       { test "$build_libtool_libs" = yes &&
-		 test -n "$library_names"; }; }; then
-	    # We only need to search for static libraries
-	    continue
-	  fi
-	fi
-
-	link_static=no # Whether the deplib will be linked statically
-	use_static_libs=$prefer_static_libs
-	if test "$use_static_libs" = built && test "$installed" = yes ; then
-	  use_static_libs=no
-	fi
-	if test -n "$library_names" &&
-	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
-	  if test "$installed" = no; then
-	    notinst_deplibs="$notinst_deplibs $lib"
-	    need_relink=yes
-	  fi
-	  # This is a shared library
-
-	  # Warn about portability, can't link against -module's on
-	  # some systems (darwin)
-	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
-	    $echo
-	    if test "$linkmode" = prog; then
-	      $echo "*** Warning: Linking the executable $output against the loadable module"
-	    else
-	      $echo "*** Warning: Linking the shared library $output against the loadable module"
-	    fi
-	    $echo "*** $linklib is not portable!"
-	  fi
-	  if test "$linkmode" = lib &&
-	     test "$hardcode_into_libs" = yes; then
-	    # Hardcode the library path.
-	    # Skip directories that are in the system default run-time
-	    # search path.
-	    case " $sys_lib_dlsearch_path " in
-	    *" $absdir "*) ;;
-	    *)
-	      case "$compile_rpath " in
-	      *" $absdir "*) ;;
-	      *) compile_rpath="$compile_rpath $absdir"
-	      esac
-	      ;;
-	    esac
-	    case " $sys_lib_dlsearch_path " in
-	    *" $libdir "*) ;;
-	    *)
-	      case "$finalize_rpath " in
-	      *" $libdir "*) ;;
-	      *) finalize_rpath="$finalize_rpath $libdir"
-	      esac
-	      ;;
-	    esac
-	  fi
-
-	  if test -n "$old_archive_from_expsyms_cmds"; then
-	    # figure out the soname
-	    set dummy $library_names
-	    realname="$2"
-	    shift; shift
-	    libname=`eval \\$echo \"$libname_spec\"`
-	    # use dlname if we got it. it's perfectly good, no?
-	    if test -n "$dlname"; then
-	      soname="$dlname"
-	    elif test -n "$soname_spec"; then
-	      # bleh windows
-	      case $host in
-	      *cygwin* | mingw*)
-		major=`expr $current - $age`
-		versuffix="-$major"
-		;;
-	      esac
-	      eval soname=\"$soname_spec\"
-	    else
-	      soname="$realname"
-	    fi
-
-	    # Make a new name for the extract_expsyms_cmds to use
-	    soroot="$soname"
-	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
-	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
-
-	    # If the library has no export list, then create one now
-	    if test -f "$output_objdir/$soname-def"; then :
-	    else
-	      $show "extracting exported symbol list from \`$soname'"
-	      save_ifs="$IFS"; IFS='~'
-	      cmds=$extract_expsyms_cmds
-	      for cmd in $cmds; do
-		IFS="$save_ifs"
-		eval cmd=\"$cmd\"
-		$show "$cmd"
-		$run eval "$cmd" || exit $?
-	      done
-	      IFS="$save_ifs"
-	    fi
-
-	    # Create $newlib
-	    if test -f "$output_objdir/$newlib"; then :; else
-	      $show "generating import library for \`$soname'"
-	      save_ifs="$IFS"; IFS='~'
-	      cmds=$old_archive_from_expsyms_cmds
-	      for cmd in $cmds; do
-		IFS="$save_ifs"
-		eval cmd=\"$cmd\"
-		$show "$cmd"
-		$run eval "$cmd" || exit $?
-	      done
-	      IFS="$save_ifs"
-	    fi
-	    # make sure the library variables are pointing to the new library
-	    dir=$output_objdir
-	    linklib=$newlib
-	  fi # test -n "$old_archive_from_expsyms_cmds"
-
-	  if test "$linkmode" = prog || test "$mode" != relink; then
-	    add_shlibpath=
-	    add_dir=
-	    add=
-	    lib_linked=yes
-	    case $hardcode_action in
-	    immediate | unsupported)
-	      if test "$hardcode_direct" = no; then
-		add="$dir/$linklib"
-		case $host in
-		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
-		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
-		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
-		    *-*-unixware7*) add_dir="-L$dir" ;;
-		  *-*-darwin* )
-		    # if the lib is a module then we can not link against
-		    # it, someone is ignoring the new warnings I added
-		    if /usr/bin/file -L $add 2> /dev/null |
-                      $EGREP ": [^:]* bundle" >/dev/null ; then
-		      $echo "** Warning, lib $linklib is a module, not a shared library"
-		      if test -z "$old_library" ; then
-		        $echo
-		        $echo "** And there doesn't seem to be a static archive available"
-		        $echo "** The link will probably fail, sorry"
-		      else
-		        add="$dir/$old_library"
-		      fi
-		    fi
-		esac
-	      elif test "$hardcode_minus_L" = no; then
-		case $host in
-		*-*-sunos*) add_shlibpath="$dir" ;;
-		esac
-		add_dir="-L$dir"
-		add="-l$name"
-	      elif test "$hardcode_shlibpath_var" = no; then
-		add_shlibpath="$dir"
-		add="-l$name"
-	      else
-		lib_linked=no
-	      fi
-	      ;;
-	    relink)
-	      if test "$hardcode_direct" = yes; then
-		add="$dir/$linklib"
-	      elif test "$hardcode_minus_L" = yes; then
-		add_dir="-L$dir"
-		# Try looking first in the location we're being installed to.
-		if test -n "$inst_prefix_dir"; then
-		  case $libdir in
-		    [\\/]*)
-		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
-		      ;;
-		  esac
-		fi
-		add="-l$name"
-	      elif test "$hardcode_shlibpath_var" = yes; then
-		add_shlibpath="$dir"
-		add="-l$name"
-	      else
-		lib_linked=no
-	      fi
-	      ;;
-	    *) lib_linked=no ;;
-	    esac
-
-	    if test "$lib_linked" != yes; then
-	      $echo "$modename: configuration error: unsupported hardcode properties"
-	      exit $EXIT_FAILURE
-	    fi
-
-	    if test -n "$add_shlibpath"; then
-	      case :$compile_shlibpath: in
-	      *":$add_shlibpath:"*) ;;
-	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
-	      esac
-	    fi
-	    if test "$linkmode" = prog; then
-	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
-	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
-	    else
-	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
-	      test -n "$add" && deplibs="$add $deplibs"
-	      if test "$hardcode_direct" != yes && \
-		 test "$hardcode_minus_L" != yes && \
-		 test "$hardcode_shlibpath_var" = yes; then
-		case :$finalize_shlibpath: in
-		*":$libdir:"*) ;;
-		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
-		esac
-	      fi
-	    fi
-	  fi
-
-	  if test "$linkmode" = prog || test "$mode" = relink; then
-	    add_shlibpath=
-	    add_dir=
-	    add=
-	    # Finalize command for both is simple: just hardcode it.
-	    if test "$hardcode_direct" = yes; then
-	      add="$libdir/$linklib"
-	    elif test "$hardcode_minus_L" = yes; then
-	      add_dir="-L$libdir"
-	      add="-l$name"
-	    elif test "$hardcode_shlibpath_var" = yes; then
-	      case :$finalize_shlibpath: in
-	      *":$libdir:"*) ;;
-	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
-	      esac
-	      add="-l$name"
-	    elif test "$hardcode_automatic" = yes; then
-	      if test -n "$inst_prefix_dir" &&
-		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
-	        add="$inst_prefix_dir$libdir/$linklib"
-	      else
-	        add="$libdir/$linklib"
-	      fi
-	    else
-	      # We cannot seem to hardcode it, guess we'll fake it.
-	      add_dir="-L$libdir"
-	      # Try looking first in the location we're being installed to.
-	      if test -n "$inst_prefix_dir"; then
-		case $libdir in
-		  [\\/]*)
-		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
-		    ;;
-		esac
-	      fi
-	      add="-l$name"
-	    fi
-
-	    if test "$linkmode" = prog; then
-	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
-	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
-	    else
-	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
-	      test -n "$add" && deplibs="$add $deplibs"
-	    fi
-	  fi
-	elif test "$linkmode" = prog; then
-	  # Here we assume that one of hardcode_direct or hardcode_minus_L
-	  # is not unsupported.  This is valid on all known static and
-	  # shared platforms.
-	  if test "$hardcode_direct" != unsupported; then
-	    test -n "$old_library" && linklib="$old_library"
-	    compile_deplibs="$dir/$linklib $compile_deplibs"
-	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
-	  else
-	    compile_deplibs="-l$name -L$dir $compile_deplibs"
-	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
-	  fi
-	elif test "$build_libtool_libs" = yes; then
-	  # Not a shared library
-	  if test "$deplibs_check_method" != pass_all; then
-	    # We're trying link a shared library against a static one
-	    # but the system doesn't support it.
-
-	    # Just print a warning and add the library to dependency_libs so
-	    # that the program can be linked against the static library.
-	    $echo
-	    $echo "*** Warning: This system can not link to static lib archive $lib."
-	    $echo "*** I have the capability to make that library automatically link in when"
-	    $echo "*** you link to this library.  But I can only do this if you have a"
-	    $echo "*** shared version of the library, which you do not appear to have."
-	    if test "$module" = yes; then
-	      $echo "*** But as you try to build a module library, libtool will still create "
-	      $echo "*** a static module, that should work as long as the dlopening application"
-	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
-	      if test -z "$global_symbol_pipe"; then
-		$echo
-		$echo "*** However, this would only work if libtool was able to extract symbol"
-		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
-		$echo "*** not find such a program.  So, this module is probably useless."
-		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
-	      fi
-	      if test "$build_old_libs" = no; then
-		build_libtool_libs=module
-		build_old_libs=yes
-	      else
-		build_libtool_libs=no
-	      fi
-	    fi
-	  else
-	    deplibs="$dir/$old_library $deplibs"
-	    link_static=yes
-	  fi
-	fi # link shared/static library?
-
-	if test "$linkmode" = lib; then
-	  if test -n "$dependency_libs" &&
-	     { test "$hardcode_into_libs" != yes ||
-	       test "$build_old_libs" = yes ||
-	       test "$link_static" = yes; }; then
-	    # Extract -R from dependency_libs
-	    temp_deplibs=
-	    for libdir in $dependency_libs; do
-	      case $libdir in
-	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
-		   case " $xrpath " in
-		   *" $temp_xrpath "*) ;;
-		   *) xrpath="$xrpath $temp_xrpath";;
-		   esac;;
-	      *) temp_deplibs="$temp_deplibs $libdir";;
-	      esac
-	    done
-	    dependency_libs="$temp_deplibs"
-	  fi
-
-	  newlib_search_path="$newlib_search_path $absdir"
-	  # Link against this library
-	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
-	  # ... and its dependency_libs
-	  tmp_libs=
-	  for deplib in $dependency_libs; do
-	    newdependency_libs="$deplib $newdependency_libs"
-	    if test "X$duplicate_deps" = "Xyes" ; then
-	      case "$tmp_libs " in
-	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
-	      esac
-	    fi
-	    tmp_libs="$tmp_libs $deplib"
-	  done
-
-	  if test "$link_all_deplibs" != no; then
-	    # Add the search paths of all dependency libraries
-	    for deplib in $dependency_libs; do
-	      case $deplib in
-	      -L*) path="$deplib" ;;
-	      *.la)
-		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
-		test "X$dir" = "X$deplib" && dir="."
-		# We need an absolute path.
-		case $dir in
-		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
-		*)
-		  absdir=`cd "$dir" && pwd`
-		  if test -z "$absdir"; then
-		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
-		    absdir="$dir"
-		  fi
-		  ;;
-		esac
-		if grep "^installed=no" $deplib > /dev/null; then
-		  path="$absdir/$objdir"
-		else
-		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
-		  if test -z "$libdir"; then
-		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
-		    exit $EXIT_FAILURE
-		  fi
-		  if test "$absdir" != "$libdir"; then
-		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
-		  fi
-		  path="$absdir"
-		fi
-		depdepl=
-		case $host in
-		*-*-darwin*)
-		  # we do not want to link against static libs,
-		  # but need to link against shared
-		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
-		  eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
-		  if test -n "$deplibrary_names" ; then
-		    for tmp in $deplibrary_names ; do
-		      depdepl=$tmp
-		    done
-		    if test -f "$deplibdir/$depdepl" ; then
-		      depdepl="$deplibdir/$depdepl"
-	      	    elif test -f "$path/$depdepl" ; then
-		      depdepl="$path/$depdepl"
-		    else
-		      # Can't find it, oh well...
-		      depdepl=
-		    fi
-		    # do not add paths which are already there
-		    case " $newlib_search_path " in
-		    *" $path "*) ;;
-		    *) newlib_search_path="$newlib_search_path $path";;
-		    esac
-		  fi
-		  path=""
-		  ;;
-		*)
-		  path="-L$path"
-		  ;;
-		esac
-		;;
-	      -l*)
-		case $host in
-		*-*-darwin*)
-		  # Again, we only want to link against shared libraries
-		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
-		  for tmp in $newlib_search_path ; do
-		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
-		      eval depdepl="$tmp/lib$tmp_libs.dylib"
-		      break
-		    fi
-		  done
-		  path=""
-		  ;;
-		*) continue ;;
-		esac
-		;;
-	      *) continue ;;
-	      esac
-	      case " $deplibs " in
-	      *" $path "*) ;;
-	      *) deplibs="$path $deplibs" ;;
-	      esac
-	      case " $deplibs " in
-	      *" $depdepl "*) ;;
-	      *) deplibs="$depdepl $deplibs" ;;
-	      esac
-	    done
-	  fi # link_all_deplibs != no
-	fi # linkmode = lib
-      done # for deplib in $libs
-      dependency_libs="$newdependency_libs"
-      if test "$pass" = dlpreopen; then
-	# Link the dlpreopened libraries before other libraries
-	for deplib in $save_deplibs; do
-	  deplibs="$deplib $deplibs"
-	done
-      fi
-      if test "$pass" != dlopen; then
-	if test "$pass" != conv; then
-	  # Make sure lib_search_path contains only unique directories.
-	  lib_search_path=
-	  for dir in $newlib_search_path; do
-	    case "$lib_search_path " in
-	    *" $dir "*) ;;
-	    *) lib_search_path="$lib_search_path $dir" ;;
-	    esac
-	  done
-	  newlib_search_path=
-	fi
-
-	if test "$linkmode,$pass" != "prog,link"; then
-	  vars="deplibs"
-	else
-	  vars="compile_deplibs finalize_deplibs"
-	fi
-	for var in $vars dependency_libs; do
-	  # Add libraries to $var in reverse order
-	  eval tmp_libs=\"\$$var\"
-	  new_libs=
-	  for deplib in $tmp_libs; do
-	    # FIXME: Pedantically, this is the right thing to do, so
-	    #        that some nasty dependency loop isn't accidentally
-	    #        broken:
-	    #new_libs="$deplib $new_libs"
-	    # Pragmatically, this seems to cause very few problems in
-	    # practice:
-	    case $deplib in
-	    -L*) new_libs="$deplib $new_libs" ;;
-	    -R*) ;;
-	    *)
-	      # And here is the reason: when a library appears more
-	      # than once as an explicit dependence of a library, or
-	      # is implicitly linked in more than once by the
-	      # compiler, it is considered special, and multiple
-	      # occurrences thereof are not removed.  Compare this
-	      # with having the same library being listed as a
-	      # dependency of multiple other libraries: in this case,
-	      # we know (pedantically, we assume) the library does not
-	      # need to be listed more than once, so we keep only the
-	      # last copy.  This is not always right, but it is rare
-	      # enough that we require users that really mean to play
-	      # such unportable linking tricks to link the library
-	      # using -Wl,-lname, so that libtool does not consider it
-	      # for duplicate removal.
-	      case " $specialdeplibs " in
-	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
-	      *)
-		case " $new_libs " in
-		*" $deplib "*) ;;
-		*) new_libs="$deplib $new_libs" ;;
-		esac
-		;;
-	      esac
-	      ;;
-	    esac
-	  done
-	  tmp_libs=
-	  for deplib in $new_libs; do
-	    case $deplib in
-	    -L*)
-	      case " $tmp_libs " in
-	      *" $deplib "*) ;;
-	      *) tmp_libs="$tmp_libs $deplib" ;;
-	      esac
-	      ;;
-	    *) tmp_libs="$tmp_libs $deplib" ;;
-	    esac
-	  done
-	  eval $var=\"$tmp_libs\"
-	done # for var
-      fi
-      # Last step: remove runtime libs from dependency_libs
-      # (they stay in deplibs)
-      tmp_libs=
-      for i in $dependency_libs ; do
-	case " $predeps $postdeps $compiler_lib_search_path " in
-	*" $i "*)
-	  i=""
-	  ;;
-	esac
-	if test -n "$i" ; then
-	  tmp_libs="$tmp_libs $i"
-	fi
-      done
-      dependency_libs=$tmp_libs
-    done # for pass
-    if test "$linkmode" = prog; then
-      dlfiles="$newdlfiles"
-      dlprefiles="$newdlprefiles"
-    fi
-
-    case $linkmode in
-    oldlib)
-      case " $deplibs" in
-      *\ -l* | *\ -L*)
-	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
-      esac
-
-      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
-	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
-      fi
-
-      if test -n "$rpath"; then
-	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
-      fi
-
-      if test -n "$xrpath"; then
-	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
-      fi
-
-      if test -n "$vinfo"; then
-	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
-      fi
-
-      if test -n "$release"; then
-	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
-      fi
-
-      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
-	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
-      fi
-
-      # Now set the variables for building old libraries.
-      build_libtool_libs=no
-      oldlibs="$output"
-      objs="$objs$old_deplibs"
-      ;;
-
-    lib)
-      # Make sure we only generate libraries of the form `libNAME.la'.
-      case $outputname in
-      lib*)
-	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
-	eval shared_ext=\"$shrext_cmds\"
-	eval libname=\"$libname_spec\"
-	;;
-      *)
-	if test "$module" = no; then
-	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
-	  $echo "$help" 1>&2
-	  exit $EXIT_FAILURE
-	fi
-	if test "$need_lib_prefix" != no; then
-	  # Add the "lib" prefix for modules if required
-	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
-	  eval shared_ext=\"$shrext_cmds\"
-	  eval libname=\"$libname_spec\"
-	else
-	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
-	fi
-	;;
-      esac
-
-      if test -n "$objs"; then
-	if test "$deplibs_check_method" != pass_all; then
-	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
-	  exit $EXIT_FAILURE
-	else
-	  $echo
-	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
-	  $echo "*** objects $objs is not portable!"
-	  libobjs="$libobjs $objs"
-	fi
-      fi
-
-      if test "$dlself" != no; then
-	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
-      fi
-
-      set dummy $rpath
-      if test "$#" -gt 2; then
-	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
-      fi
-      install_libdir="$2"
-
-      oldlibs=
-      if test -z "$rpath"; then
-	if test "$build_libtool_libs" = yes; then
-	  # Building a libtool convenience library.
-	  # Some compilers have problems with a `.al' extension so
-	  # convenience libraries should have the same extension an
-	  # archive normally would.
-	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
-	  build_libtool_libs=convenience
-	  build_old_libs=yes
-	fi
-
-	if test -n "$vinfo"; then
-	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
-	fi
-
-	if test -n "$release"; then
-	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
-	fi
-      else
-
-	# Parse the version information argument.
-	save_ifs="$IFS"; IFS=':'
-	set dummy $vinfo 0 0 0
-	IFS="$save_ifs"
-
-	if test -n "$8"; then
-	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
-	  $echo "$help" 1>&2
-	  exit $EXIT_FAILURE
-	fi
-
-	# convert absolute version numbers to libtool ages
-	# this retains compatibility with .la files and attempts
-	# to make the code below a bit more comprehensible
-
-	case $vinfo_number in
-	yes)
-	  number_major="$2"
-	  number_minor="$3"
-	  number_revision="$4"
-	  #
-	  # There are really only two kinds -- those that
-	  # use the current revision as the major version
-	  # and those that subtract age and use age as
-	  # a minor version.  But, then there is irix
-	  # which has an extra 1 added just for fun
-	  #
-	  case $version_type in
-	  darwin|linux|osf|windows|none)
-	    current=`expr $number_major + $number_minor`
-	    age="$number_minor"
-	    revision="$number_revision"
-	    ;;
-	  freebsd-aout|freebsd-elf|sunos)
-	    current="$number_major"
-	    revision="$number_minor"
-	    age="0"
-	    ;;
-	  irix|nonstopux)
-	    current=`expr $number_major + $number_minor`
-	    age="$number_minor"
-	    revision="$number_minor"
-	    lt_irix_increment=no
-	    ;;
-	  *)
-	    $echo "$modename: unknown library version type \`$version_type'" 1>&2
-	    $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
-	    exit $EXIT_FAILURE
-	    ;;
-	  esac
-	  ;;
-	no)
-	  current="$2"
-	  revision="$3"
-	  age="$4"
-	  ;;
-	esac
-
-	# Check that each of the things are valid numbers.
-	case $current in
-	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
-	*)
-	  $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
-	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
-	  exit $EXIT_FAILURE
-	  ;;
-	esac
-
-	case $revision in
-	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
-	*)
-	  $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
-	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
-	  exit $EXIT_FAILURE
-	  ;;
-	esac
-
-	case $age in
-	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
-	*)
-	  $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
-	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
-	  exit $EXIT_FAILURE
-	  ;;
-	esac
-
-	if test "$age" -gt "$current"; then
-	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
-	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
-	  exit $EXIT_FAILURE
-	fi
-
-	# Calculate the version variables.
-	major=
-	versuffix=
-	verstring=
-	case $version_type in
-	none) ;;
-
-	darwin)
-	  # Like Linux, but with the current version available in
-	  # verstring for coding it into the library header
-	  major=.`expr $current - $age`
-	  versuffix="$major.$age.$revision"
-	  # Darwin ld doesn't like 0 for these options...
-	  minor_current=`expr $current + 1`
-	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
-	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
-	  ;;
-
-	freebsd-aout)
-	  major=".$current"
-	  versuffix=".$current.$revision";
-	  ;;
-
-	freebsd-elf)
-	  major=".$current"
-	  versuffix=".$current";
-	  ;;
-
-	irix | nonstopux)
-	  if test "X$lt_irix_increment" = "Xno"; then
-	    major=`expr $current - $age`
-	  else
-	    major=`expr $current - $age + 1`
-	  fi
-	  case $version_type in
-	    nonstopux) verstring_prefix=nonstopux ;;
-	    *)         verstring_prefix=sgi ;;
-	  esac
-	  verstring="$verstring_prefix$major.$revision"
-
-	  # Add in all the interfaces that we are compatible with.
-	  loop=$revision
-	  while test "$loop" -ne 0; do
-	    iface=`expr $revision - $loop`
-	    loop=`expr $loop - 1`
-	    verstring="$verstring_prefix$major.$iface:$verstring"
-	  done
-
-	  # Before this point, $major must not contain `.'.
-	  major=.$major
-	  versuffix="$major.$revision"
-	  ;;
-
-	linux)
-	  major=.`expr $current - $age`
-	  versuffix="$major.$age.$revision"
-	  ;;
-
-	osf)
-	  major=.`expr $current - $age`
-	  versuffix=".$current.$age.$revision"
-	  verstring="$current.$age.$revision"
-
-	  # Add in all the interfaces that we are compatible with.
-	  loop=$age
-	  while test "$loop" -ne 0; do
-	    iface=`expr $current - $loop`
-	    loop=`expr $loop - 1`
-	    verstring="$verstring:${iface}.0"
-	  done
-
-	  # Make executables depend on our current version.
-	  verstring="$verstring:${current}.0"
-	  ;;
-
-	sunos)
-	  major=".$current"
-	  versuffix=".$current.$revision"
-	  ;;
-
-	windows)
-	  # Use '-' rather than '.', since we only want one
-	  # extension on DOS 8.3 filesystems.
-	  major=`expr $current - $age`
-	  versuffix="-$major"
-	  ;;
-
-	*)
-	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
-	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
-	  exit $EXIT_FAILURE
-	  ;;
-	esac
-
-	# Clear the version info if we defaulted, and they specified a release.
-	if test -z "$vinfo" && test -n "$release"; then
-	  major=
-	  case $version_type in
-	  darwin)
-	    # we can't check for "0.0" in archive_cmds due to quoting
-	    # problems, so we reset it completely
-	    verstring=
-	    ;;
-	  *)
-	    verstring="0.0"
-	    ;;
-	  esac
-	  if test "$need_version" = no; then
-	    versuffix=
-	  else
-	    versuffix=".0.0"
-	  fi
-	fi
-
-	# Remove version info from name if versioning should be avoided
-	if test "$avoid_version" = yes && test "$need_version" = no; then
-	  major=
-	  versuffix=
-	  verstring=""
-	fi
-
-	# Check to see if the archive will have undefined symbols.
-	if test "$allow_undefined" = yes; then
-	  if test "$allow_undefined_flag" = unsupported; then
-	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
-	    build_libtool_libs=no
-	    build_old_libs=yes
-	  fi
-	else
-	  # Don't allow undefined symbols.
-	  allow_undefined_flag="$no_undefined_flag"
-	fi
-      fi
-
-      if test "$mode" != relink; then
-	# Remove our outputs, but don't remove object files since they
-	# may have been created when compiling PIC objects.
-	removelist=
-	tempremovelist=`$echo "$output_objdir/*"`
-	for p in $tempremovelist; do
-	  case $p in
-	    *.$objext)
-	       ;;
-	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
-	       if test "X$precious_files_regex" != "X"; then
-	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
-	         then
-		   continue
-		 fi
-	       fi
-	       removelist="$removelist $p"
-	       ;;
-	    *) ;;
-	  esac
-	done
-	if test -n "$removelist"; then
-	  $show "${rm}r $removelist"
-	  $run ${rm}r $removelist
-	fi
-      fi
-
-      # Now set the variables for building old libraries.
-      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
-	oldlibs="$oldlibs $output_objdir/$libname.$libext"
-
-	# Transform .lo files to .o files.
-	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
-      fi
-
-      # Eliminate all temporary directories.
-      #for path in $notinst_path; do
-      #	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
-      #	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
-      #	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
-      #done
-
-      if test -n "$xrpath"; then
-	# If the user specified any rpath flags, then add them.
-	temp_xrpath=
-	for libdir in $xrpath; do
-	  temp_xrpath="$temp_xrpath -R$libdir"
-	  case "$finalize_rpath " in
-	  *" $libdir "*) ;;
-	  *) finalize_rpath="$finalize_rpath $libdir" ;;
-	  esac
-	done
-	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
-	  dependency_libs="$temp_xrpath $dependency_libs"
-	fi
-      fi
-
-      # Make sure dlfiles contains only unique files that won't be dlpreopened
-      old_dlfiles="$dlfiles"
-      dlfiles=
-      for lib in $old_dlfiles; do
-	case " $dlprefiles $dlfiles " in
-	*" $lib "*) ;;
-	*) dlfiles="$dlfiles $lib" ;;
-	esac
-      done
-
-      # Make sure dlprefiles contains only unique files
-      old_dlprefiles="$dlprefiles"
-      dlprefiles=
-      for lib in $old_dlprefiles; do
-	case "$dlprefiles " in
-	*" $lib "*) ;;
-	*) dlprefiles="$dlprefiles $lib" ;;
-	esac
-      done
-
-      if test "$build_libtool_libs" = yes; then
-	if test -n "$rpath"; then
-	  case $host in
-	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
-	    # these systems don't actually have a c library (as such)!
-	    ;;
-	  *-*-rhapsody* | *-*-darwin1.[012])
-	    # Rhapsody C library is in the System framework
-	    deplibs="$deplibs -framework System"
-	    ;;
-	  *-*-netbsd*)
-	    # Don't link with libc until the a.out ld.so is fixed.
-	    ;;
-	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
-	    # Do not include libc due to us having libc/libc_r.
-	    ;;
-	  *-*-sco3.2v5* | *-*-sco5v6*)
-	    # Causes problems with __ctype
-	    ;;
-	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
-	    # Compiler inserts libc in the correct place for threads to work
-	    ;;
- 	  *)
-	    # Add libc to deplibs on all other systems if necessary.
-	    if test "$build_libtool_need_lc" = "yes"; then
-	      deplibs="$deplibs -lc"
-	    fi
-	    ;;
-	  esac
-	fi
-
-	# Transform deplibs into only deplibs that can be linked in shared.
-	name_save=$name
-	libname_save=$libname
-	release_save=$release
-	versuffix_save=$versuffix
-	major_save=$major
-	# I'm not sure if I'm treating the release correctly.  I think
-	# release should show up in the -l (ie -lgmp5) so we don't want to
-	# add it in twice.  Is that correct?
-	release=""
-	versuffix=""
-	major=""
-	newdeplibs=
-	droppeddeps=no
-	case $deplibs_check_method in
-	pass_all)
-	  # Don't check for shared/static.  Everything works.
-	  # This might be a little naive.  We might want to check
-	  # whether the library exists or not.  But this is on
-	  # osf3 & osf4 and I'm not really sure... Just
-	  # implementing what was already the behavior.
-	  newdeplibs=$deplibs
-	  ;;
-	test_compile)
-	  # This code stresses the "libraries are programs" paradigm to its
-	  # limits. Maybe even breaks it.  We compile a program, linking it
-	  # against the deplibs as a proxy for the library.  Then we can check
-	  # whether they linked in statically or dynamically with ldd.
-	  $rm conftest.c
-	  cat > conftest.c <<EOF
-	  int main() { return 0; }
-EOF
-	  $rm conftest
-	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
-	    ldd_output=`ldd conftest`
-	    for i in $deplibs; do
-	      name=`expr $i : '-l\(.*\)'`
-	      # If $name is empty we are operating on a -L argument.
-              if test "$name" != "" && test "$name" != "0"; then
-		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-		  case " $predeps $postdeps " in
-		  *" $i "*)
-		    newdeplibs="$newdeplibs $i"
-		    i=""
-		    ;;
-		  esac
-	        fi
-		if test -n "$i" ; then
-		  libname=`eval \\$echo \"$libname_spec\"`
-		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
-		  set dummy $deplib_matches
-		  deplib_match=$2
-		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
-		    newdeplibs="$newdeplibs $i"
-		  else
-		    droppeddeps=yes
-		    $echo
-		    $echo "*** Warning: dynamic linker does not accept needed library $i."
-		    $echo "*** I have the capability to make that library automatically link in when"
-		    $echo "*** you link to this library.  But I can only do this if you have a"
-		    $echo "*** shared version of the library, which I believe you do not have"
-		    $echo "*** because a test_compile did reveal that the linker did not use it for"
-		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
-		  fi
-		fi
-	      else
-		newdeplibs="$newdeplibs $i"
-	      fi
-	    done
-	  else
-	    # Error occurred in the first compile.  Let's try to salvage
-	    # the situation: Compile a separate program for each library.
-	    for i in $deplibs; do
-	      name=`expr $i : '-l\(.*\)'`
-	      # If $name is empty we are operating on a -L argument.
-              if test "$name" != "" && test "$name" != "0"; then
-		$rm conftest
-		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
-		  ldd_output=`ldd conftest`
-		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-		    case " $predeps $postdeps " in
-		    *" $i "*)
-		      newdeplibs="$newdeplibs $i"
-		      i=""
-		      ;;
-		    esac
-		  fi
-		  if test -n "$i" ; then
-		    libname=`eval \\$echo \"$libname_spec\"`
-		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
-		    set dummy $deplib_matches
-		    deplib_match=$2
-		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
-		      newdeplibs="$newdeplibs $i"
-		    else
-		      droppeddeps=yes
-		      $echo
-		      $echo "*** Warning: dynamic linker does not accept needed library $i."
-		      $echo "*** I have the capability to make that library automatically link in when"
-		      $echo "*** you link to this library.  But I can only do this if you have a"
-		      $echo "*** shared version of the library, which you do not appear to have"
-		      $echo "*** because a test_compile did reveal that the linker did not use this one"
-		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
-		    fi
-		  fi
-		else
-		  droppeddeps=yes
-		  $echo
-		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
-		  $echo "*** make it link in!  You will probably need to install it or some"
-		  $echo "*** library that it depends on before this library will be fully"
-		  $echo "*** functional.  Installing it before continuing would be even better."
-		fi
-	      else
-		newdeplibs="$newdeplibs $i"
-	      fi
-	    done
-	  fi
-	  ;;
-	file_magic*)
-	  set dummy $deplibs_check_method
-	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
-	  for a_deplib in $deplibs; do
-	    name=`expr $a_deplib : '-l\(.*\)'`
-	    # If $name is empty we are operating on a -L argument.
-            if test "$name" != "" && test  "$name" != "0"; then
-	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-		case " $predeps $postdeps " in
-		*" $a_deplib "*)
-		  newdeplibs="$newdeplibs $a_deplib"
-		  a_deplib=""
-		  ;;
-		esac
-	      fi
-	      if test -n "$a_deplib" ; then
-		libname=`eval \\$echo \"$libname_spec\"`
-		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
-		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
-		  for potent_lib in $potential_libs; do
-		      # Follow soft links.
-		      if ls -lLd "$potent_lib" 2>/dev/null \
-			 | grep " -> " >/dev/null; then
-			continue
-		      fi
-		      # The statement above tries to avoid entering an
-		      # endless loop below, in case of cyclic links.
-		      # We might still enter an endless loop, since a link
-		      # loop can be closed while we follow links,
-		      # but so what?
-		      potlib="$potent_lib"
-		      while test -h "$potlib" 2>/dev/null; do
-			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
-			case $potliblink in
-			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
-			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
-			esac
-		      done
-		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
-			 | ${SED} 10q \
-			 | $EGREP "$file_magic_regex" > /dev/null; then
-			newdeplibs="$newdeplibs $a_deplib"
-			a_deplib=""
-			break 2
-		      fi
-		  done
-		done
-	      fi
-	      if test -n "$a_deplib" ; then
-		droppeddeps=yes
-		$echo
-		$echo "*** Warning: linker path does not have real file for library $a_deplib."
-		$echo "*** I have the capability to make that library automatically link in when"
-		$echo "*** you link to this library.  But I can only do this if you have a"
-		$echo "*** shared version of the library, which you do not appear to have"
-		$echo "*** because I did check the linker path looking for a file starting"
-		if test -z "$potlib" ; then
-		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
-		else
-		  $echo "*** with $libname and none of the candidates passed a file format test"
-		  $echo "*** using a file magic. Last file checked: $potlib"
-		fi
-	      fi
-	    else
-	      # Add a -L argument.
-	      newdeplibs="$newdeplibs $a_deplib"
-	    fi
-	  done # Gone through all deplibs.
-	  ;;
-	match_pattern*)
-	  set dummy $deplibs_check_method
-	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
-	  for a_deplib in $deplibs; do
-	    name=`expr $a_deplib : '-l\(.*\)'`
-	    # If $name is empty we are operating on a -L argument.
-	    if test -n "$name" && test "$name" != "0"; then
-	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-		case " $predeps $postdeps " in
-		*" $a_deplib "*)
-		  newdeplibs="$newdeplibs $a_deplib"
-		  a_deplib=""
-		  ;;
-		esac
-	      fi
-	      if test -n "$a_deplib" ; then
-		libname=`eval \\$echo \"$libname_spec\"`
-		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
-		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
-		  for potent_lib in $potential_libs; do
-		    potlib="$potent_lib" # see symlink-check above in file_magic test
-		    if eval $echo \"$potent_lib\" 2>/dev/null \
-		        | ${SED} 10q \
-		        | $EGREP "$match_pattern_regex" > /dev/null; then
-		      newdeplibs="$newdeplibs $a_deplib"
-		      a_deplib=""
-		      break 2
-		    fi
-		  done
-		done
-	      fi
-	      if test -n "$a_deplib" ; then
-		droppeddeps=yes
-		$echo
-		$echo "*** Warning: linker path does not have real file for library $a_deplib."
-		$echo "*** I have the capability to make that library automatically link in when"
-		$echo "*** you link to this library.  But I can only do this if you have a"
-		$echo "*** shared version of the library, which you do not appear to have"
-		$echo "*** because I did check the linker path looking for a file starting"
-		if test -z "$potlib" ; then
-		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
-		else
-		  $echo "*** with $libname and none of the candidates passed a file format test"
-		  $echo "*** using a regex pattern. Last file checked: $potlib"
-		fi
-	      fi
-	    else
-	      # Add a -L argument.
-	      newdeplibs="$newdeplibs $a_deplib"
-	    fi
-	  done # Gone through all deplibs.
-	  ;;
-	none | unknown | *)
-	  newdeplibs=""
-	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
-	    -e 's/ -[LR][^ ]*//g'`
-	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
-	    for i in $predeps $postdeps ; do
-	      # can't use Xsed below, because $i might contain '/'
-	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
-	    done
-	  fi
-	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
-	    | grep . >/dev/null; then
-	    $echo
-	    if test "X$deplibs_check_method" = "Xnone"; then
-	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
-	    else
-	      $echo "*** Warning: inter-library dependencies are not known to be supported."
-	    fi
-	    $echo "*** All declared inter-library dependencies are being dropped."
-	    droppeddeps=yes
-	  fi
-	  ;;
-	esac
-	versuffix=$versuffix_save
-	major=$major_save
-	release=$release_save
-	libname=$libname_save
-	name=$name_save
-
-	case $host in
-	*-*-rhapsody* | *-*-darwin1.[012])
-	  # On Rhapsody replace the C library is the System framework
-	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
-	  ;;
-	esac
-
-	if test "$droppeddeps" = yes; then
-	  if test "$module" = yes; then
-	    $echo
-	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
-	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
-	    $echo "*** a static module, that should work as long as the dlopening"
-	    $echo "*** application is linked with the -dlopen flag."
-	    if test -z "$global_symbol_pipe"; then
-	      $echo
-	      $echo "*** However, this would only work if libtool was able to extract symbol"
-	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
-	      $echo "*** not find such a program.  So, this module is probably useless."
-	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
-	    fi
-	    if test "$build_old_libs" = no; then
-	      oldlibs="$output_objdir/$libname.$libext"
-	      build_libtool_libs=module
-	      build_old_libs=yes
-	    else
-	      build_libtool_libs=no
-	    fi
-	  else
-	    $echo "*** The inter-library dependencies that have been dropped here will be"
-	    $echo "*** automatically added whenever a program is linked with this library"
-	    $echo "*** or is declared to -dlopen it."
-
-	    if test "$allow_undefined" = no; then
-	      $echo
-	      $echo "*** Since this library must not contain undefined symbols,"
-	      $echo "*** because either the platform does not support them or"
-	      $echo "*** it was explicitly requested with -no-undefined,"
-	      $echo "*** libtool will only create a static version of it."
-	      if test "$build_old_libs" = no; then
-		oldlibs="$output_objdir/$libname.$libext"
-		build_libtool_libs=module
-		build_old_libs=yes
-	      else
-		build_libtool_libs=no
-	      fi
-	    fi
-	  fi
-	fi
-	# Done checking deplibs!
-	deplibs=$newdeplibs
-      fi
-
-
-      # move library search paths that coincide with paths to not yet
-      # installed libraries to the beginning of the library search list
-      new_libs=
-      for path in $notinst_path; do
-	case " $new_libs " in
-	*" -L$path/$objdir "*) ;;
-	*)
-	  case " $deplibs " in
-	  *" -L$path/$objdir "*)
-	    new_libs="$new_libs -L$path/$objdir" ;;
-	  esac
-	  ;;
-	esac
-      done
-      for deplib in $deplibs; do
-	case $deplib in
-	-L*)
-	  case " $new_libs " in
-	  *" $deplib "*) ;;
-	  *) new_libs="$new_libs $deplib" ;;
-	  esac
-	  ;;
-	*) new_libs="$new_libs $deplib" ;;
-	esac
-      done
-      deplibs="$new_libs"
-
-
-      # All the library-specific variables (install_libdir is set above).
-      library_names=
-      old_library=
-      dlname=
-
-      # Test again, we may have decided not to build it any more
-      if test "$build_libtool_libs" = yes; then
-	if test "$hardcode_into_libs" = yes; then
-	  # Hardcode the library paths
-	  hardcode_libdirs=
-	  dep_rpath=
-	  rpath="$finalize_rpath"
-	  test "$mode" != relink && rpath="$compile_rpath$rpath"
-	  for libdir in $rpath; do
-	    if test -n "$hardcode_libdir_flag_spec"; then
-	      if test -n "$hardcode_libdir_separator"; then
-		if test -z "$hardcode_libdirs"; then
-		  hardcode_libdirs="$libdir"
-		else
-		  # Just accumulate the unique libdirs.
-		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
-		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
-		    ;;
-		  *)
-		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
-		    ;;
-		  esac
-		fi
-	      else
-		eval flag=\"$hardcode_libdir_flag_spec\"
-		dep_rpath="$dep_rpath $flag"
-	      fi
-	    elif test -n "$runpath_var"; then
-	      case "$perm_rpath " in
-	      *" $libdir "*) ;;
-	      *) perm_rpath="$perm_rpath $libdir" ;;
-	      esac
-	    fi
-	  done
-	  # Substitute the hardcoded libdirs into the rpath.
-	  if test -n "$hardcode_libdir_separator" &&
-	     test -n "$hardcode_libdirs"; then
-	    libdir="$hardcode_libdirs"
-	    if test -n "$hardcode_libdir_flag_spec_ld"; then
-	      case $archive_cmds in
-	      *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
-	      *)      eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
-	      esac
-	    else
-	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
-	    fi
-	  fi
-	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
-	    # We should set the runpath_var.
-	    rpath=
-	    for dir in $perm_rpath; do
-	      rpath="$rpath$dir:"
-	    done
-	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
-	  fi
-	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
-	fi
-
-	shlibpath="$finalize_shlibpath"
-	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
-	if test -n "$shlibpath"; then
-	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
-	fi
-
-	# Get the real and link names of the library.
-	eval shared_ext=\"$shrext_cmds\"
-	eval library_names=\"$library_names_spec\"
-	set dummy $library_names
-	realname="$2"
-	shift; shift
-
-	if test -n "$soname_spec"; then
-	  eval soname=\"$soname_spec\"
-	else
-	  soname="$realname"
-	fi
-	if test -z "$dlname"; then
-	  dlname=$soname
-	fi
-
-	lib="$output_objdir/$realname"
-	linknames=
-	for link
-	do
-	  linknames="$linknames $link"
-	done
-
-	# Use standard objects if they are pic
-	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-
-	# Prepare the list of exported symbols
-	if test -z "$export_symbols"; then
-	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
-	    $show "generating symbol list for \`$libname.la'"
-	    export_symbols="$output_objdir/$libname.exp"
-	    $run $rm $export_symbols
-	    cmds=$export_symbols_cmds
-	    save_ifs="$IFS"; IFS='~'
-	    for cmd in $cmds; do
-	      IFS="$save_ifs"
-	      eval cmd=\"$cmd\"
-	      if len=`expr "X$cmd" : ".*"` &&
-	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
-	        $show "$cmd"
-	        $run eval "$cmd" || exit $?
-	        skipped_export=false
-	      else
-	        # The command line is too long to execute in one step.
-	        $show "using reloadable object file for export list..."
-	        skipped_export=:
-		# Break out early, otherwise skipped_export may be
-		# set to false by a later but shorter cmd.
-		break
-	      fi
-	    done
-	    IFS="$save_ifs"
-	    if test -n "$export_symbols_regex"; then
-	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
-	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
-	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
-	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
-	    fi
-	  fi
-	fi
-
-	if test -n "$export_symbols" && test -n "$include_expsyms"; then
-	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
-	fi
-
-	tmp_deplibs=
-	for test_deplib in $deplibs; do
-		case " $convenience " in
-		*" $test_deplib "*) ;;
-		*)
-			tmp_deplibs="$tmp_deplibs $test_deplib"
-			;;
-		esac
-	done
-	deplibs="$tmp_deplibs"
-
-	if test -n "$convenience"; then
-	  if test -n "$whole_archive_flag_spec"; then
-	    save_libobjs=$libobjs
-	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
-	  else
-	    gentop="$output_objdir/${outputname}x"
-	    generated="$generated $gentop"
-
-	    func_extract_archives $gentop $convenience
-	    libobjs="$libobjs $func_extract_archives_result"
-	  fi
-	fi
-	
-	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
-	  eval flag=\"$thread_safe_flag_spec\"
-	  linker_flags="$linker_flags $flag"
-	fi
-
-	# Make a backup of the uninstalled library when relinking
-	if test "$mode" = relink; then
-	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
-	fi
-
-	# Do each of the archive commands.
-	if test "$module" = yes && test -n "$module_cmds" ; then
-	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
-	    eval test_cmds=\"$module_expsym_cmds\"
-	    cmds=$module_expsym_cmds
-	  else
-	    eval test_cmds=\"$module_cmds\"
-	    cmds=$module_cmds
-	  fi
-	else
-	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
-	  eval test_cmds=\"$archive_expsym_cmds\"
-	  cmds=$archive_expsym_cmds
-	else
-	  eval test_cmds=\"$archive_cmds\"
-	  cmds=$archive_cmds
-	  fi
-	fi
-
-	if test "X$skipped_export" != "X:" &&
-	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
-	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
-	  :
-	else
-	  # The command line is too long to link in one step, link piecewise.
-	  $echo "creating reloadable object files..."
-
-	  # Save the value of $output and $libobjs because we want to
-	  # use them later.  If we have whole_archive_flag_spec, we
-	  # want to use save_libobjs as it was before
-	  # whole_archive_flag_spec was expanded, because we can't
-	  # assume the linker understands whole_archive_flag_spec.
-	  # This may have to be revisited, in case too many
-	  # convenience libraries get linked in and end up exceeding
-	  # the spec.
-	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
-	    save_libobjs=$libobjs
-	  fi
-	  save_output=$output
-	  output_la=`$echo "X$output" | $Xsed -e "$basename"`
-
-	  # Clear the reloadable object creation command queue and
-	  # initialize k to one.
-	  test_cmds=
-	  concat_cmds=
-	  objlist=
-	  delfiles=
-	  last_robj=
-	  k=1
-	  output=$output_objdir/$output_la-${k}.$objext
-	  # Loop over the list of objects to be linked.
-	  for obj in $save_libobjs
-	  do
-	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
-	    if test "X$objlist" = X ||
-	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
-		 test "$len" -le "$max_cmd_len"; }; then
-	      objlist="$objlist $obj"
-	    else
-	      # The command $test_cmds is almost too long, add a
-	      # command to the queue.
-	      if test "$k" -eq 1 ; then
-		# The first file doesn't have a previous command to add.
-		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
-	      else
-		# All subsequent reloadable object files will link in
-		# the last one created.
-		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
-	      fi
-	      last_robj=$output_objdir/$output_la-${k}.$objext
-	      k=`expr $k + 1`
-	      output=$output_objdir/$output_la-${k}.$objext
-	      objlist=$obj
-	      len=1
-	    fi
-	  done
-	  # Handle the remaining objects by creating one last
-	  # reloadable object file.  All subsequent reloadable object
-	  # files will link in the last one created.
-	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
-	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
-
-	  if ${skipped_export-false}; then
-	    $show "generating symbol list for \`$libname.la'"
-	    export_symbols="$output_objdir/$libname.exp"
-	    $run $rm $export_symbols
-	    libobjs=$output
-	    # Append the command to create the export file.
-	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
-          fi
-
-	  # Set up a command to remove the reloadable object files
-	  # after they are used.
-	  i=0
-	  while test "$i" -lt "$k"
-	  do
-	    i=`expr $i + 1`
-	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
-	  done
-
-	  $echo "creating a temporary reloadable object file: $output"
-
-	  # Loop through the commands generated above and execute them.
-	  save_ifs="$IFS"; IFS='~'
-	  for cmd in $concat_cmds; do
-	    IFS="$save_ifs"
-	    $show "$cmd"
-	    $run eval "$cmd" || exit $?
-	  done
-	  IFS="$save_ifs"
-
-	  libobjs=$output
-	  # Restore the value of output.
-	  output=$save_output
-
-	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
-	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
-	  fi
-	  # Expand the library linking commands again to reset the
-	  # value of $libobjs for piecewise linking.
-
-	  # Do each of the archive commands.
-	  if test "$module" = yes && test -n "$module_cmds" ; then
-	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
-	      cmds=$module_expsym_cmds
-	    else
-	      cmds=$module_cmds
-	    fi
-	  else
-	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
-	    cmds=$archive_expsym_cmds
-	  else
-	    cmds=$archive_cmds
-	    fi
-	  fi
-
-	  # Append the command to remove the reloadable object files
-	  # to the just-reset $cmds.
-	  eval cmds=\"\$cmds~\$rm $delfiles\"
-	fi
-	save_ifs="$IFS"; IFS='~'
-	for cmd in $cmds; do
-	  IFS="$save_ifs"
-	  eval cmd=\"$cmd\"
-	  $show "$cmd"
-	  $run eval "$cmd" || {
-	    lt_exit=$?
-
-	    # Restore the uninstalled library and exit
-	    if test "$mode" = relink; then
-	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
-	    fi
-
-	    exit $lt_exit
-	  }
-	done
-	IFS="$save_ifs"
-
-	# Restore the uninstalled library and exit
-	if test "$mode" = relink; then
-	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
-
-	  if test -n "$convenience"; then
-	    if test -z "$whole_archive_flag_spec"; then
-	      $show "${rm}r $gentop"
-	      $run ${rm}r "$gentop"
-	    fi
-	  fi
-
-	  exit $EXIT_SUCCESS
-	fi
-
-	# Create links to the real library.
-	for linkname in $linknames; do
-	  if test "$realname" != "$linkname"; then
-	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
-	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
-	  fi
-	done
-
-	# If -module or -export-dynamic was specified, set the dlname.
-	if test "$module" = yes || test "$export_dynamic" = yes; then
-	  # On all known operating systems, these are identical.
-	  dlname="$soname"
-	fi
-      fi
-      ;;
-
-    obj)
-      case " $deplibs" in
-      *\ -l* | *\ -L*)
-	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;;
-      esac
-
-      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
-	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
-      fi
-
-      if test -n "$rpath"; then
-	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
-      fi
-
-      if test -n "$xrpath"; then
-	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
-      fi
-
-      if test -n "$vinfo"; then
-	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
-      fi
-
-      if test -n "$release"; then
-	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
-      fi
-
-      case $output in
-      *.lo)
-	if test -n "$objs$old_deplibs"; then
-	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
-	  exit $EXIT_FAILURE
-	fi
-	libobj="$output"
-	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
-	;;
-      *)
-	libobj=
-	obj="$output"
-	;;
-      esac
-
-      # Delete the old objects.
-      $run $rm $obj $libobj
-
-      # Objects from convenience libraries.  This assumes
-      # single-version convenience libraries.  Whenever we create
-      # different ones for PIC/non-PIC, this we'll have to duplicate
-      # the extraction.
-      reload_conv_objs=
-      gentop=
-      # reload_cmds runs $LD directly, so let us get rid of
-      # -Wl from whole_archive_flag_spec and hope we can get by with
-      # turning comma into space..
-      wl=
-
-      if test -n "$convenience"; then
-	if test -n "$whole_archive_flag_spec"; then
-	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
-	  reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
-	else
-	  gentop="$output_objdir/${obj}x"
-	  generated="$generated $gentop"
-
-	  func_extract_archives $gentop $convenience
-	  reload_conv_objs="$reload_objs $func_extract_archives_result"
-	fi
-      fi
-
-      # Create the old-style object.
-      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
-
-      output="$obj"
-      cmds=$reload_cmds
-      save_ifs="$IFS"; IFS='~'
-      for cmd in $cmds; do
-	IFS="$save_ifs"
-	eval cmd=\"$cmd\"
-	$show "$cmd"
-	$run eval "$cmd" || exit $?
-      done
-      IFS="$save_ifs"
-
-      # Exit if we aren't doing a library object file.
-      if test -z "$libobj"; then
-	if test -n "$gentop"; then
-	  $show "${rm}r $gentop"
-	  $run ${rm}r $gentop
-	fi
-
-	exit $EXIT_SUCCESS
-      fi
-
-      if test "$build_libtool_libs" != yes; then
-	if test -n "$gentop"; then
-	  $show "${rm}r $gentop"
-	  $run ${rm}r $gentop
-	fi
-
-	# Create an invalid libtool object if no PIC, so that we don't
-	# accidentally link it into a program.
-	# $show "echo timestamp > $libobj"
-	# $run eval "echo timestamp > $libobj" || exit $?
-	exit $EXIT_SUCCESS
-      fi
-
-      if test -n "$pic_flag" || test "$pic_mode" != default; then
-	# Only do commands if we really have different PIC objects.
-	reload_objs="$libobjs $reload_conv_objs"
-	output="$libobj"
-	cmds=$reload_cmds
-	save_ifs="$IFS"; IFS='~'
-	for cmd in $cmds; do
-	  IFS="$save_ifs"
-	  eval cmd=\"$cmd\"
-	  $show "$cmd"
-	  $run eval "$cmd" || exit $?
-	done
-	IFS="$save_ifs"
-      fi
-
-      if test -n "$gentop"; then
-	$show "${rm}r $gentop"
-	$run ${rm}r $gentop
-      fi
-
-      exit $EXIT_SUCCESS
-      ;;
-
-    prog)
-      case $host in
-	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
-      esac
-      if test -n "$vinfo"; then
-	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
-      fi
-
-      if test -n "$release"; then
-	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
-      fi
-
-      if test "$preload" = yes; then
-	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
-	   test "$dlopen_self_static" = unknown; then
-	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
-	fi
-      fi
-
-      case $host in
-      *-*-rhapsody* | *-*-darwin1.[012])
-	# On Rhapsody replace the C library is the System framework
-	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
-	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
-	;;
-      esac
-
-      case $host in
-      *darwin*)
-        # Don't allow lazy linking, it breaks C++ global constructors
-        if test "$tagname" = CXX ; then
-        compile_command="$compile_command ${wl}-bind_at_load"
-        finalize_command="$finalize_command ${wl}-bind_at_load"
-        fi
-        ;;
-      esac
-
-
-      # move library search paths that coincide with paths to not yet
-      # installed libraries to the beginning of the library search list
-      new_libs=
-      for path in $notinst_path; do
-	case " $new_libs " in
-	*" -L$path/$objdir "*) ;;
-	*)
-	  case " $compile_deplibs " in
-	  *" -L$path/$objdir "*)
-	    new_libs="$new_libs -L$path/$objdir" ;;
-	  esac
-	  ;;
-	esac
-      done
-      for deplib in $compile_deplibs; do
-	case $deplib in
-	-L*)
-	  case " $new_libs " in
-	  *" $deplib "*) ;;
-	  *) new_libs="$new_libs $deplib" ;;
-	  esac
-	  ;;
-	*) new_libs="$new_libs $deplib" ;;
-	esac
-      done
-      compile_deplibs="$new_libs"
-
-
-      compile_command="$compile_command $compile_deplibs"
-      finalize_command="$finalize_command $finalize_deplibs"
-
-      if test -n "$rpath$xrpath"; then
-	# If the user specified any rpath flags, then add them.
-	for libdir in $rpath $xrpath; do
-	  # This is the magic to use -rpath.
-	  case "$finalize_rpath " in
-	  *" $libdir "*) ;;
-	  *) finalize_rpath="$finalize_rpath $libdir" ;;
-	  esac
-	done
-      fi
-
-      # Now hardcode the library paths
-      rpath=
-      hardcode_libdirs=
-      for libdir in $compile_rpath $finalize_rpath; do
-	if test -n "$hardcode_libdir_flag_spec"; then
-	  if test -n "$hardcode_libdir_separator"; then
-	    if test -z "$hardcode_libdirs"; then
-	      hardcode_libdirs="$libdir"
-	    else
-	      # Just accumulate the unique libdirs.
-	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
-	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
-		;;
-	      *)
-		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
-		;;
-	      esac
-	    fi
-	  else
-	    eval flag=\"$hardcode_libdir_flag_spec\"
-	    rpath="$rpath $flag"
-	  fi
-	elif test -n "$runpath_var"; then
-	  case "$perm_rpath " in
-	  *" $libdir "*) ;;
-	  *) perm_rpath="$perm_rpath $libdir" ;;
-	  esac
-	fi
-	case $host in
-	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
-	  testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
-	  case :$dllsearchpath: in
-	  *":$libdir:"*) ;;
-	  *) dllsearchpath="$dllsearchpath:$libdir";;
-	  esac
-	  case :$dllsearchpath: in
-	  *":$testbindir:"*) ;;
-	  *) dllsearchpath="$dllsearchpath:$testbindir";;
-	  esac
-	  ;;
-	esac
-      done
-      # Substitute the hardcoded libdirs into the rpath.
-      if test -n "$hardcode_libdir_separator" &&
-	 test -n "$hardcode_libdirs"; then
-	libdir="$hardcode_libdirs"
-	eval rpath=\" $hardcode_libdir_flag_spec\"
-      fi
-      compile_rpath="$rpath"
-
-      rpath=
-      hardcode_libdirs=
-      for libdir in $finalize_rpath; do
-	if test -n "$hardcode_libdir_flag_spec"; then
-	  if test -n "$hardcode_libdir_separator"; then
-	    if test -z "$hardcode_libdirs"; then
-	      hardcode_libdirs="$libdir"
-	    else
-	      # Just accumulate the unique libdirs.
-	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
-	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
-		;;
-	      *)
-		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
-		;;
-	      esac
-	    fi
-	  else
-	    eval flag=\"$hardcode_libdir_flag_spec\"
-	    rpath="$rpath $flag"
-	  fi
-	elif test -n "$runpath_var"; then
-	  case "$finalize_perm_rpath " in
-	  *" $libdir "*) ;;
-	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
-	  esac
-	fi
-      done
-      # Substitute the hardcoded libdirs into the rpath.
-      if test -n "$hardcode_libdir_separator" &&
-	 test -n "$hardcode_libdirs"; then
-	libdir="$hardcode_libdirs"
-	eval rpath=\" $hardcode_libdir_flag_spec\"
-      fi
-      finalize_rpath="$rpath"
-
-      if test -n "$libobjs" && test "$build_old_libs" = yes; then
-	# Transform all the library objects into standard objects.
-	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-      fi
-
-      dlsyms=
-      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
-	if test -n "$NM" && test -n "$global_symbol_pipe"; then
-	  dlsyms="${outputname}S.c"
-	else
-	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
-	fi
-      fi
-
-      if test -n "$dlsyms"; then
-	case $dlsyms in
-	"") ;;
-	*.c)
-	  # Discover the nlist of each of the dlfiles.
-	  nlist="$output_objdir/${outputname}.nm"
-
-	  $show "$rm $nlist ${nlist}S ${nlist}T"
-	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
-
-	  # Parse the name list into a source file.
-	  $show "creating $output_objdir/$dlsyms"
-
-	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
-/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
-/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
-
-#ifdef __cplusplus
-extern \"C\" {
-#endif
-
-/* Prevent the only kind of declaration conflicts we can make. */
-#define lt_preloaded_symbols some_other_symbol
-
-/* External symbol declarations for the compiler. */\
-"
-
-	  if test "$dlself" = yes; then
-	    $show "generating symbol list for \`$output'"
-
-	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
-
-	    # Add our own program objects to the symbol list.
-	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
-	    for arg in $progfiles; do
-	      $show "extracting global C symbols from \`$arg'"
-	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
-	    done
-
-	    if test -n "$exclude_expsyms"; then
-	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
-	      $run eval '$mv "$nlist"T "$nlist"'
-	    fi
-
-	    if test -n "$export_symbols_regex"; then
-	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
-	      $run eval '$mv "$nlist"T "$nlist"'
-	    fi
-
-	    # Prepare the list of exported symbols
-	    if test -z "$export_symbols"; then
-	      export_symbols="$output_objdir/$outputname.exp"
-	      $run $rm $export_symbols
-	      $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
-              case $host in
-              *cygwin* | *mingw* )
-	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
-		$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
-                ;;
-              esac
-	    else
-	      $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
-	      $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
-	      $run eval 'mv "$nlist"T "$nlist"'
-              case $host in
-              *cygwin* | *mingw* )
-	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
-		$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
-                ;;
-              esac
-	    fi
-	  fi
-
-	  for arg in $dlprefiles; do
-	    $show "extracting global C symbols from \`$arg'"
-	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
-	    $run eval '$echo ": $name " >> "$nlist"'
-	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
-	  done
-
-	  if test -z "$run"; then
-	    # Make sure we have at least an empty file.
-	    test -f "$nlist" || : > "$nlist"
-
-	    if test -n "$exclude_expsyms"; then
-	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
-	      $mv "$nlist"T "$nlist"
-	    fi
-
-	    # Try sorting and uniquifying the output.
-	    if grep -v "^: " < "$nlist" |
-		if sort -k 3 </dev/null >/dev/null 2>&1; then
-		  sort -k 3
-		else
-		  sort +2
-		fi |
-		uniq > "$nlist"S; then
-	      :
-	    else
-	      grep -v "^: " < "$nlist" > "$nlist"S
-	    fi
-
-	    if test -f "$nlist"S; then
-	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
-	    else
-	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
-	    fi
-
-	    $echo >> "$output_objdir/$dlsyms" "\
-
-#undef lt_preloaded_symbols
-
-#if defined (__STDC__) && __STDC__
-# define lt_ptr void *
-#else
-# define lt_ptr char *
-# define const
-#endif
-
-/* The mapping between symbol names and symbols. */
-"
-
-	    case $host in
-	    *cygwin* | *mingw* )
-	  $echo >> "$output_objdir/$dlsyms" "\
-/* DATA imports from DLLs on WIN32 can't be const, because
-   runtime relocations are performed -- see ld's documentation
-   on pseudo-relocs */
-struct {
-"
-	      ;;
-	    * )
-	  $echo >> "$output_objdir/$dlsyms" "\
-const struct {
-"
-	      ;;
-	    esac
-
-
-	  $echo >> "$output_objdir/$dlsyms" "\
-  const char *name;
-  lt_ptr address;
-}
-lt_preloaded_symbols[] =
-{\
-"
-
-	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
-
-	    $echo >> "$output_objdir/$dlsyms" "\
-  {0, (lt_ptr) 0}
-};
-
-/* This works around a problem in FreeBSD linker */
-#ifdef FREEBSD_WORKAROUND
-static const void *lt_preloaded_setup() {
-  return lt_preloaded_symbols;
-}
-#endif
-
-#ifdef __cplusplus
-}
-#endif\
-"
-	  fi
-
-	  pic_flag_for_symtable=
-	  case $host in
-	  # compiling the symbol table file with pic_flag works around
-	  # a FreeBSD bug that causes programs to crash when -lm is
-	  # linked before any other PIC object.  But we must not use
-	  # pic_flag when linking with -static.  The problem exists in
-	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
-	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
-	    case "$compile_command " in
-	    *" -static "*) ;;
-	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
-	    esac;;
-	  *-*-hpux*)
-	    case "$compile_command " in
-	    *" -static "*) ;;
-	    *) pic_flag_for_symtable=" $pic_flag";;
-	    esac
-	  esac
-
-	  # Now compile the dynamic symbol file.
-	  $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
-	  $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
-
-	  # Clean up the generated files.
-	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
-	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
-
-	  # Transform the symbol file into the correct name.
-          case $host in
-          *cygwin* | *mingw* )
-            if test -f "$output_objdir/${outputname}.def" ; then
-              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
-              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
-            else
-              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
-              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
-             fi
-            ;;
-          * )
-            compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
-            finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
-            ;;
-          esac
-	  ;;
-	*)
-	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
-	  exit $EXIT_FAILURE
-	  ;;
-	esac
-      else
-	# We keep going just in case the user didn't refer to
-	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
-	# really was required.
-
-	# Nullify the symbol file.
-	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
-	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
-      fi
-
-      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
-	# Replace the output file specification.
-	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
-	link_command="$compile_command$compile_rpath"
-
-	# We have no uninstalled library dependencies, so finalize right now.
-	$show "$link_command"
-	$run eval "$link_command"
-	exit_status=$?
-
-	# Delete the generated files.
-	if test -n "$dlsyms"; then
-	  $show "$rm $output_objdir/${outputname}S.${objext}"
-	  $run $rm "$output_objdir/${outputname}S.${objext}"
-	fi
-
-	exit $exit_status
-      fi
-
-      if test -n "$shlibpath_var"; then
-	# We should set the shlibpath_var
-	rpath=
-	for dir in $temp_rpath; do
-	  case $dir in
-	  [\\/]* | [A-Za-z]:[\\/]*)
-	    # Absolute path.
-	    rpath="$rpath$dir:"
-	    ;;
-	  *)
-	    # Relative path: add a thisdir entry.
-	    rpath="$rpath\$thisdir/$dir:"
-	    ;;
-	  esac
-	done
-	temp_rpath="$rpath"
-      fi
-
-      if test -n "$compile_shlibpath$finalize_shlibpath"; then
-	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
-      fi
-      if test -n "$finalize_shlibpath"; then
-	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
-      fi
-
-      compile_var=
-      finalize_var=
-      if test -n "$runpath_var"; then
-	if test -n "$perm_rpath"; then
-	  # We should set the runpath_var.
-	  rpath=
-	  for dir in $perm_rpath; do
-	    rpath="$rpath$dir:"
-	  done
-	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
-	fi
-	if test -n "$finalize_perm_rpath"; then
-	  # We should set the runpath_var.
-	  rpath=
-	  for dir in $finalize_perm_rpath; do
-	    rpath="$rpath$dir:"
-	  done
-	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
-	fi
-      fi
-
-      if test "$no_install" = yes; then
-	# We don't need to create a wrapper script.
-	link_command="$compile_var$compile_command$compile_rpath"
-	# Replace the output file specification.
-	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
-	# Delete the old output file.
-	$run $rm $output
-	# Link the executable and exit
-	$show "$link_command"
-	$run eval "$link_command" || exit $?
-	exit $EXIT_SUCCESS
-      fi
-
-      if test "$hardcode_action" = relink; then
-	# Fast installation is not supported
-	link_command="$compile_var$compile_command$compile_rpath"
-	relink_command="$finalize_var$finalize_command$finalize_rpath"
-
-	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
-	$echo "$modename: \`$output' will be relinked during installation" 1>&2
-      else
-	if test "$fast_install" != no; then
-	  link_command="$finalize_var$compile_command$finalize_rpath"
-	  if test "$fast_install" = yes; then
-	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
-	  else
-	    # fast_install is set to needless
-	    relink_command=
-	  fi
-	else
-	  link_command="$compile_var$compile_command$compile_rpath"
-	  relink_command="$finalize_var$finalize_command$finalize_rpath"
-	fi
-      fi
-
-      # Replace the output file specification.
-      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
-
-      # Delete the old output files.
-      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
-
-      $show "$link_command"
-      $run eval "$link_command" || exit $?
-
-      # Now create the wrapper script.
-      $show "creating $output"
-
-      # Quote the relink command for shipping.
-      if test -n "$relink_command"; then
-	# Preserve any variables that may affect compiler behavior
-	for var in $variables_saved_for_relink; do
-	  if eval test -z \"\${$var+set}\"; then
-	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
-	  elif eval var_value=\$$var; test -z "$var_value"; then
-	    relink_command="$var=; export $var; $relink_command"
-	  else
-	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
-	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
-	  fi
-	done
-	relink_command="(cd `pwd`; $relink_command)"
-	relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
-      fi
-
-      # Quote $echo for shipping.
-      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
-	case $progpath in
-	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
-	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
-	esac
-	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
-      else
-	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
-      fi
-
-      # Only actually do things if our run command is non-null.
-      if test -z "$run"; then
-	# win32 will think the script is a binary if it has
-	# a .exe suffix, so we strip it off here.
-	case $output in
-	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
-	esac
-	# test for cygwin because mv fails w/o .exe extensions
-	case $host in
-	  *cygwin*)
-	    exeext=.exe
-	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
-	  *) exeext= ;;
-	esac
-	case $host in
-	  *cygwin* | *mingw* )
-            output_name=`basename $output`
-            output_path=`dirname $output`
-            cwrappersource="$output_path/$objdir/lt-$output_name.c"
-            cwrapper="$output_path/$output_name.exe"
-            $rm $cwrappersource $cwrapper
-            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
-
-	    cat > $cwrappersource <<EOF
-
-/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
-   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-
-   The $output program cannot be directly executed until all the libtool
-   libraries that it depends on are installed.
-
-   This wrapper executable should never be moved out of the build directory.
-   If it is, it will not operate correctly.
-
-   Currently, it simply execs the wrapper *script* "/bin/sh $output",
-   but could eventually absorb all of the scripts functionality and
-   exec $objdir/$outputname directly.
-*/
-EOF
-	    cat >> $cwrappersource<<"EOF"
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <malloc.h>
-#include <stdarg.h>
-#include <assert.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/stat.h>
-
-#if defined(PATH_MAX)
-# define LT_PATHMAX PATH_MAX
-#elif defined(MAXPATHLEN)
-# define LT_PATHMAX MAXPATHLEN
-#else
-# define LT_PATHMAX 1024
-#endif
-
-#ifndef DIR_SEPARATOR
-# define DIR_SEPARATOR '/'
-# define PATH_SEPARATOR ':'
-#endif
-
-#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
-  defined (__OS2__)
-# define HAVE_DOS_BASED_FILE_SYSTEM
-# ifndef DIR_SEPARATOR_2
-#  define DIR_SEPARATOR_2 '\\'
-# endif
-# ifndef PATH_SEPARATOR_2
-#  define PATH_SEPARATOR_2 ';'
-# endif
-#endif
-
-#ifndef DIR_SEPARATOR_2
-# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
-#else /* DIR_SEPARATOR_2 */
-# define IS_DIR_SEPARATOR(ch) \
-        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
-#endif /* DIR_SEPARATOR_2 */
-
-#ifndef PATH_SEPARATOR_2
-# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
-#else /* PATH_SEPARATOR_2 */
-# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
-#endif /* PATH_SEPARATOR_2 */
-
-#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
-#define XFREE(stale) do { \
-  if (stale) { free ((void *) stale); stale = 0; } \
-} while (0)
-
-/* -DDEBUG is fairly common in CFLAGS.  */
-#undef DEBUG
-#if defined DEBUGWRAPPER
-# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
-#else
-# define DEBUG(format, ...)
-#endif
-
-const char *program_name = NULL;
-
-void * xmalloc (size_t num);
-char * xstrdup (const char *string);
-const char * base_name (const char *name);
-char * find_executable(const char *wrapper);
-int    check_executable(const char *path);
-char * strendzap(char *str, const char *pat);
-void lt_fatal (const char *message, ...);
-
-int
-main (int argc, char *argv[])
-{
-  char **newargz;
-  int i;
-
-  program_name = (char *) xstrdup (base_name (argv[0]));
-  DEBUG("(main) argv[0]      : %s\n",argv[0]);
-  DEBUG("(main) program_name : %s\n",program_name);
-  newargz = XMALLOC(char *, argc+2);
-EOF
-
-            cat >> $cwrappersource <<EOF
-  newargz[0] = (char *) xstrdup("$SHELL");
-EOF
-
-            cat >> $cwrappersource <<"EOF"
-  newargz[1] = find_executable(argv[0]);
-  if (newargz[1] == NULL)
-    lt_fatal("Couldn't find %s", argv[0]);
-  DEBUG("(main) found exe at : %s\n",newargz[1]);
-  /* we know the script has the same name, without the .exe */
-  /* so make sure newargz[1] doesn't end in .exe */
-  strendzap(newargz[1],".exe");
-  for (i = 1; i < argc; i++)
-    newargz[i+1] = xstrdup(argv[i]);
-  newargz[argc+1] = NULL;
-
-  for (i=0; i<argc+1; i++)
-  {
-    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
-    ;
-  }
-
-EOF
-
-            case $host_os in
-              mingw*)
-                cat >> $cwrappersource <<EOF
-  execv("$SHELL",(char const **)newargz);
-EOF
-              ;;
-              *)
-                cat >> $cwrappersource <<EOF
-  execv("$SHELL",newargz);
-EOF
-              ;;
-            esac
-
-            cat >> $cwrappersource <<"EOF"
-  return 127;
-}
-
-void *
-xmalloc (size_t num)
-{
-  void * p = (void *) malloc (num);
-  if (!p)
-    lt_fatal ("Memory exhausted");
-
-  return p;
-}
-
-char *
-xstrdup (const char *string)
-{
-  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
-;
-}
-
-const char *
-base_name (const char *name)
-{
-  const char *base;
-
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
-  /* Skip over the disk name in MSDOS pathnames. */
-  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
-    name += 2;
-#endif
-
-  for (base = name; *name; name++)
-    if (IS_DIR_SEPARATOR (*name))
-      base = name + 1;
-  return base;
-}
-
-int
-check_executable(const char * path)
-{
-  struct stat st;
-
-  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
-  if ((!path) || (!*path))
-    return 0;
-
-  if ((stat (path, &st) >= 0) &&
-      (
-        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
-#if defined (S_IXOTH)
-       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
-#endif
-#if defined (S_IXGRP)
-       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
-#endif
-       ((st.st_mode & S_IXUSR) == S_IXUSR))
-      )
-    return 1;
-  else
-    return 0;
-}
-
-/* Searches for the full path of the wrapper.  Returns
-   newly allocated full path name if found, NULL otherwise */
-char *
-find_executable (const char* wrapper)
-{
-  int has_slash = 0;
-  const char* p;
-  const char* p_next;
-  /* static buffer for getcwd */
-  char tmp[LT_PATHMAX + 1];
-  int tmp_len;
-  char* concat_name;
-
-  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
-
-  if ((wrapper == NULL) || (*wrapper == '\0'))
-    return NULL;
-
-  /* Absolute path? */
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
-  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
-  {
-    concat_name = xstrdup (wrapper);
-    if (check_executable(concat_name))
-      return concat_name;
-    XFREE(concat_name);
-  }
-  else
-  {
-#endif
-    if (IS_DIR_SEPARATOR (wrapper[0]))
-    {
-      concat_name = xstrdup (wrapper);
-      if (check_executable(concat_name))
-        return concat_name;
-      XFREE(concat_name);
-    }
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
-  }
-#endif
-
-  for (p = wrapper; *p; p++)
-    if (*p == '/')
-    {
-      has_slash = 1;
-      break;
-    }
-  if (!has_slash)
-  {
-    /* no slashes; search PATH */
-    const char* path = getenv ("PATH");
-    if (path != NULL)
-    {
-      for (p = path; *p; p = p_next)
-      {
-        const char* q;
-        size_t p_len;
-        for (q = p; *q; q++)
-          if (IS_PATH_SEPARATOR(*q))
-            break;
-        p_len = q - p;
-        p_next = (*q == '\0' ? q : q + 1);
-        if (p_len == 0)
-        {
-          /* empty path: current directory */
-          if (getcwd (tmp, LT_PATHMAX) == NULL)
-            lt_fatal ("getcwd failed");
-          tmp_len = strlen(tmp);
-          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
-          memcpy (concat_name, tmp, tmp_len);
-          concat_name[tmp_len] = '/';
-          strcpy (concat_name + tmp_len + 1, wrapper);
-        }
-        else
-        {
-          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
-          memcpy (concat_name, p, p_len);
-          concat_name[p_len] = '/';
-          strcpy (concat_name + p_len + 1, wrapper);
-        }
-        if (check_executable(concat_name))
-          return concat_name;
-        XFREE(concat_name);
-      }
-    }
-    /* not found in PATH; assume curdir */
-  }
-  /* Relative path | not found in path: prepend cwd */
-  if (getcwd (tmp, LT_PATHMAX) == NULL)
-    lt_fatal ("getcwd failed");
-  tmp_len = strlen(tmp);
-  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
-  memcpy (concat_name, tmp, tmp_len);
-  concat_name[tmp_len] = '/';
-  strcpy (concat_name + tmp_len + 1, wrapper);
-
-  if (check_executable(concat_name))
-    return concat_name;
-  XFREE(concat_name);
-  return NULL;
-}
-
-char *
-strendzap(char *str, const char *pat)
-{
-  size_t len, patlen;
-
-  assert(str != NULL);
-  assert(pat != NULL);
-
-  len = strlen(str);
-  patlen = strlen(pat);
-
-  if (patlen <= len)
-  {
-    str += len - patlen;
-    if (strcmp(str, pat) == 0)
-      *str = '\0';
-  }
-  return str;
-}
-
-static void
-lt_error_core (int exit_status, const char * mode,
-          const char * message, va_list ap)
-{
-  fprintf (stderr, "%s: %s: ", program_name, mode);
-  vfprintf (stderr, message, ap);
-  fprintf (stderr, ".\n");
-
-  if (exit_status >= 0)
-    exit (exit_status);
-}
-
-void
-lt_fatal (const char *message, ...)
-{
-  va_list ap;
-  va_start (ap, message);
-  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
-  va_end (ap);
-}
-EOF
-          # we should really use a build-platform specific compiler
-          # here, but OTOH, the wrappers (shell script and this C one)
-          # are only useful if you want to execute the "real" binary.
-          # Since the "real" binary is built for $host, then this
-          # wrapper might as well be built for $host, too.
-          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
-          ;;
-        esac
-        $rm $output
-        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
-
-	$echo > $output "\
-#! $SHELL
-
-# $output - temporary wrapper script for $objdir/$outputname
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-#
-# The $output program cannot be directly executed until all the libtool
-# libraries that it depends on are installed.
-#
-# This wrapper script should never be moved out of the build directory.
-# If it is, it will not operate correctly.
-
-# Sed substitution that helps us do robust quoting.  It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed='${SED} -e 1s/^X//'
-sed_quote_subst='$sed_quote_subst'
-
-# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
-if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '\${1+\"\$@\"}'='\"\$@\"'
-  setopt NO_GLOB_SUBST
-else
-  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
-fi
-BIN_SH=xpg4; export BIN_SH # for Tru64
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-relink_command=\"$relink_command\"
-
-# This environment variable determines our operation mode.
-if test \"\$libtool_install_magic\" = \"$magic\"; then
-  # install mode needs the following variable:
-  notinst_deplibs='$notinst_deplibs'
-else
-  # When we are sourced in execute mode, \$file and \$echo are already set.
-  if test \"\$libtool_execute_magic\" != \"$magic\"; then
-    echo=\"$qecho\"
-    file=\"\$0\"
-    # Make sure echo works.
-    if test \"X\$1\" = X--no-reexec; then
-      # Discard the --no-reexec flag, and continue.
-      shift
-    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
-      # Yippee, \$echo works!
-      :
-    else
-      # Restart under the correct shell, and then maybe \$echo will work.
-      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
-    fi
-  fi\
-"
-	$echo >> $output "\
-
-  # Find the directory that this script lives in.
-  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
-  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
-
-  # Follow symbolic links until we get to the real thisdir.
-  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
-  while test -n \"\$file\"; do
-    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
-
-    # If there was a directory component, then change thisdir.
-    if test \"x\$destdir\" != \"x\$file\"; then
-      case \"\$destdir\" in
-      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
-      *) thisdir=\"\$thisdir/\$destdir\" ;;
-      esac
-    fi
-
-    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
-    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
-  done
-
-  # Try to get the absolute directory name.
-  absdir=\`cd \"\$thisdir\" && pwd\`
-  test -n \"\$absdir\" && thisdir=\"\$absdir\"
-"
-
-	if test "$fast_install" = yes; then
-	  $echo >> $output "\
-  program=lt-'$outputname'$exeext
-  progdir=\"\$thisdir/$objdir\"
-
-  if test ! -f \"\$progdir/\$program\" || \\
-     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
-       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
-
-    file=\"\$\$-\$program\"
-
-    if test ! -d \"\$progdir\"; then
-      $mkdir \"\$progdir\"
-    else
-      $rm \"\$progdir/\$file\"
-    fi"
-
-	  $echo >> $output "\
-
-    # relink executable if necessary
-    if test -n \"\$relink_command\"; then
-      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
-      else
-	$echo \"\$relink_command_output\" >&2
-	$rm \"\$progdir/\$file\"
-	exit $EXIT_FAILURE
-      fi
-    fi
-
-    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
-    { $rm \"\$progdir/\$program\";
-      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
-    $rm \"\$progdir/\$file\"
-  fi"
-	else
-	  $echo >> $output "\
-  program='$outputname'
-  progdir=\"\$thisdir/$objdir\"
-"
-	fi
-
-	$echo >> $output "\
-
-  if test -f \"\$progdir/\$program\"; then"
-
-	# Export our shlibpath_var if we have one.
-	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
-	  $echo >> $output "\
-    # Add our own library path to $shlibpath_var
-    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
-
-    # Some systems cannot cope with colon-terminated $shlibpath_var
-    # The second colon is a workaround for a bug in BeOS R4 sed
-    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
-
-    export $shlibpath_var
-"
-	fi
-
-	# fixup the dll searchpath if we need to.
-	if test -n "$dllsearchpath"; then
-	  $echo >> $output "\
-    # Add the dll search path components to the executable PATH
-    PATH=$dllsearchpath:\$PATH
-"
-	fi
-
-	$echo >> $output "\
-    if test \"\$libtool_execute_magic\" != \"$magic\"; then
-      # Run the actual program with our arguments.
-"
-	case $host in
-	# Backslashes separate directories on plain windows
-	*-*-mingw | *-*-os2*)
-	  $echo >> $output "\
-      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
-"
-	  ;;
-
-	*)
-	  $echo >> $output "\
-      exec \"\$progdir/\$program\" \${1+\"\$@\"}
-"
-	  ;;
-	esac
-	$echo >> $output "\
-      \$echo \"\$0: cannot exec \$program \$*\"
-      exit $EXIT_FAILURE
-    fi
-  else
-    # The program doesn't exist.
-    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
-    \$echo \"This script is just a wrapper for \$program.\" 1>&2
-    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
-    exit $EXIT_FAILURE
-  fi
-fi\
-"
-	chmod +x $output
-      fi
-      exit $EXIT_SUCCESS
-      ;;
-    esac
-
-    # See if we need to build an old-fashioned archive.
-    for oldlib in $oldlibs; do
-
-      if test "$build_libtool_libs" = convenience; then
-	oldobjs="$libobjs_save"
-	addlibs="$convenience"
-	build_libtool_libs=no
-      else
-	if test "$build_libtool_libs" = module; then
-	  oldobjs="$libobjs_save"
-	  build_libtool_libs=no
-	else
-	  oldobjs="$old_deplibs $non_pic_objects"
-	fi
-	addlibs="$old_convenience"
-      fi
-
-      if test -n "$addlibs"; then
-	gentop="$output_objdir/${outputname}x"
-	generated="$generated $gentop"
-
-	func_extract_archives $gentop $addlibs
-	oldobjs="$oldobjs $func_extract_archives_result"
-      fi
-
-      # Do each command in the archive commands.
-      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
-       cmds=$old_archive_from_new_cmds
-      else
-	# POSIX demands no paths to be encoded in archives.  We have
-	# to avoid creating archives with duplicate basenames if we
-	# might have to extract them afterwards, e.g., when creating a
-	# static archive out of a convenience library, or when linking
-	# the entirety of a libtool archive into another (currently
-	# not supported by libtool).
-	if (for obj in $oldobjs
-	    do
-	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
-	    done | sort | sort -uc >/dev/null 2>&1); then
-	  :
-	else
-	  $echo "copying selected object files to avoid basename conflicts..."
-
-	  if test -z "$gentop"; then
-	    gentop="$output_objdir/${outputname}x"
-	    generated="$generated $gentop"
-
-	    $show "${rm}r $gentop"
-	    $run ${rm}r "$gentop"
-	    $show "$mkdir $gentop"
-	    $run $mkdir "$gentop"
-	    exit_status=$?
-	    if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
-	      exit $exit_status
-	    fi
-	  fi
-
-	  save_oldobjs=$oldobjs
-	  oldobjs=
-	  counter=1
-	  for obj in $save_oldobjs
-	  do
-	    objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
-	    case " $oldobjs " in
-	    " ") oldobjs=$obj ;;
-	    *[\ /]"$objbase "*)
-	      while :; do
-		# Make sure we don't pick an alternate name that also
-		# overlaps.
-		newobj=lt$counter-$objbase
-		counter=`expr $counter + 1`
-		case " $oldobjs " in
-		*[\ /]"$newobj "*) ;;
-		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
-		esac
-	      done
-	      $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
-	      $run ln "$obj" "$gentop/$newobj" ||
-	      $run cp "$obj" "$gentop/$newobj"
-	      oldobjs="$oldobjs $gentop/$newobj"
-	      ;;
-	    *) oldobjs="$oldobjs $obj" ;;
-	    esac
-	  done
-	fi
-
-	eval cmds=\"$old_archive_cmds\"
-
-	if len=`expr "X$cmds" : ".*"` &&
-	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
-	  cmds=$old_archive_cmds
-	else
-	  # the command line is too long to link in one step, link in parts
-	  $echo "using piecewise archive linking..."
-	  save_RANLIB=$RANLIB
-	  RANLIB=:
-	  objlist=
-	  concat_cmds=
-	  save_oldobjs=$oldobjs
-
-	  # Is there a better way of finding the last object in the list?
-	  for obj in $save_oldobjs
-	  do
-	    last_oldobj=$obj
-	  done
-	  for obj in $save_oldobjs
-	  do
-	    oldobjs="$objlist $obj"
-	    objlist="$objlist $obj"
-	    eval test_cmds=\"$old_archive_cmds\"
-	    if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
-	       test "$len" -le "$max_cmd_len"; then
-	      :
-	    else
-	      # the above command should be used before it gets too long
-	      oldobjs=$objlist
-	      if test "$obj" = "$last_oldobj" ; then
-	        RANLIB=$save_RANLIB
-	      fi
-	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
-	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
-	      objlist=
-	    fi
-	  done
-	  RANLIB=$save_RANLIB
-	  oldobjs=$objlist
-	  if test "X$oldobjs" = "X" ; then
-	    eval cmds=\"\$concat_cmds\"
-	  else
-	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
-	  fi
-	fi
-      fi
-      save_ifs="$IFS"; IFS='~'
-      for cmd in $cmds; do
-        eval cmd=\"$cmd\"
-	IFS="$save_ifs"
-	$show "$cmd"
-	$run eval "$cmd" || exit $?
-      done
-      IFS="$save_ifs"
-    done
-
-    if test -n "$generated"; then
-      $show "${rm}r$generated"
-      $run ${rm}r$generated
-    fi
-
-    # Now create the libtool archive.
-    case $output in
-    *.la)
-      old_library=
-      test "$build_old_libs" = yes && old_library="$libname.$libext"
-      $show "creating $output"
-
-      # Preserve any variables that may affect compiler behavior
-      for var in $variables_saved_for_relink; do
-	if eval test -z \"\${$var+set}\"; then
-	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
-	elif eval var_value=\$$var; test -z "$var_value"; then
-	  relink_command="$var=; export $var; $relink_command"
-	else
-	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
-	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
-	fi
-      done
-      # Quote the link command for shipping.
-      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
-      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
-      if test "$hardcode_automatic" = yes ; then
-	relink_command=
-      fi
-
-
-      # Only create the output if not a dry run.
-      if test -z "$run"; then
-	for installed in no yes; do
-	  if test "$installed" = yes; then
-	    if test -z "$install_libdir"; then
-	      break
-	    fi
-	    output="$output_objdir/$outputname"i
-	    # Replace all uninstalled libtool libraries with the installed ones
-	    newdependency_libs=
-	    for deplib in $dependency_libs; do
-	      case $deplib in
-	      *.la)
-		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
-		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
-		if test -z "$libdir"; then
-		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
-		  exit $EXIT_FAILURE
-		fi
-		newdependency_libs="$newdependency_libs $libdir/$name"
-		;;
-	      *) newdependency_libs="$newdependency_libs $deplib" ;;
-	      esac
-	    done
-	    dependency_libs="$newdependency_libs"
-	    newdlfiles=
-	    for lib in $dlfiles; do
-	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
-	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
-	      if test -z "$libdir"; then
-		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
-		exit $EXIT_FAILURE
-	      fi
-	      newdlfiles="$newdlfiles $libdir/$name"
-	    done
-	    dlfiles="$newdlfiles"
-	    newdlprefiles=
-	    for lib in $dlprefiles; do
-	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
-	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
-	      if test -z "$libdir"; then
-		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
-		exit $EXIT_FAILURE
-	      fi
-	      newdlprefiles="$newdlprefiles $libdir/$name"
-	    done
-	    dlprefiles="$newdlprefiles"
-	  else
-	    newdlfiles=
-	    for lib in $dlfiles; do
-	      case $lib in
-		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
-		*) abs=`pwd`"/$lib" ;;
-	      esac
-	      newdlfiles="$newdlfiles $abs"
-	    done
-	    dlfiles="$newdlfiles"
-	    newdlprefiles=
-	    for lib in $dlprefiles; do
-	      case $lib in
-		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
-		*) abs=`pwd`"/$lib" ;;
-	      esac
-	      newdlprefiles="$newdlprefiles $abs"
-	    done
-	    dlprefiles="$newdlprefiles"
-	  fi
-	  $rm $output
-	  # place dlname in correct position for cygwin
-	  tdlname=$dlname
-	  case $host,$output,$installed,$module,$dlname in
-	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
-	  esac
-	  $echo > $output "\
-# $outputname - a libtool library file
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# The name that we can dlopen(3).
-dlname='$tdlname'
-
-# Names of this library.
-library_names='$library_names'
-
-# The name of the static archive.
-old_library='$old_library'
-
-# Libraries that this one depends upon.
-dependency_libs='$dependency_libs'
-
-# Version information for $libname.
-current=$current
-age=$age
-revision=$revision
-
-# Is this an already installed library?
-installed=$installed
-
-# Should we warn about portability when linking against -modules?
-shouldnotlink=$module
-
-# Files to dlopen/dlpreopen
-dlopen='$dlfiles'
-dlpreopen='$dlprefiles'
-
-# Directory that this library needs to be installed in:
-libdir='$install_libdir'"
-	  if test "$installed" = no && test "$need_relink" = yes; then
-	    $echo >> $output "\
-relink_command=\"$relink_command\""
-	  fi
-	done
-      fi
-
-      # Do a symbolic link so that the libtool archive can be found in
-      # LD_LIBRARY_PATH before the program is installed.
-      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
-      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
-      ;;
-    esac
-    exit $EXIT_SUCCESS
-    ;;
-
-  # libtool install mode
-  install)
-    modename="$modename: install"
-
-    # There may be an optional sh(1) argument at the beginning of
-    # install_prog (especially on Windows NT).
-    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
-       # Allow the use of GNU shtool's install command.
-       $echo "X$nonopt" | grep shtool > /dev/null; then
-      # Aesthetically quote it.
-      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
-      case $arg in
-      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	arg="\"$arg\""
-	;;
-      esac
-      install_prog="$arg "
-      arg="$1"
-      shift
-    else
-      install_prog=
-      arg=$nonopt
-    fi
-
-    # The real first argument should be the name of the installation program.
-    # Aesthetically quote it.
-    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
-    case $arg in
-    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-      arg="\"$arg\""
-      ;;
-    esac
-    install_prog="$install_prog$arg"
-
-    # We need to accept at least all the BSD install flags.
-    dest=
-    files=
-    opts=
-    prev=
-    install_type=
-    isdir=no
-    stripme=
-    for arg
-    do
-      if test -n "$dest"; then
-	files="$files $dest"
-	dest=$arg
-	continue
-      fi
-
-      case $arg in
-      -d) isdir=yes ;;
-      -f) 
-      	case " $install_prog " in
-	*[\\\ /]cp\ *) ;;
-	*) prev=$arg ;;
-	esac
-	;;
-      -g | -m | -o) prev=$arg ;;
-      -s)
-	stripme=" -s"
-	continue
-	;;
-      -*)
-	;;
-      *)
-	# If the previous option needed an argument, then skip it.
-	if test -n "$prev"; then
-	  prev=
-	else
-	  dest=$arg
-	  continue
-	fi
-	;;
-      esac
-
-      # Aesthetically quote the argument.
-      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
-      case $arg in
-      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
-	arg="\"$arg\""
-	;;
-      esac
-      install_prog="$install_prog $arg"
-    done
-
-    if test -z "$install_prog"; then
-      $echo "$modename: you must specify an install program" 1>&2
-      $echo "$help" 1>&2
-      exit $EXIT_FAILURE
-    fi
-
-    if test -n "$prev"; then
-      $echo "$modename: the \`$prev' option requires an argument" 1>&2
-      $echo "$help" 1>&2
-      exit $EXIT_FAILURE
-    fi
-
-    if test -z "$files"; then
-      if test -z "$dest"; then
-	$echo "$modename: no file or destination specified" 1>&2
-      else
-	$echo "$modename: you must specify a destination" 1>&2
-      fi
-      $echo "$help" 1>&2
-      exit $EXIT_FAILURE
-    fi
-
-    # Strip any trailing slash from the destination.
-    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
-
-    # Check to see that the destination is a directory.
-    test -d "$dest" && isdir=yes
-    if test "$isdir" = yes; then
-      destdir="$dest"
-      destname=
-    else
-      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
-      test "X$destdir" = "X$dest" && destdir=.
-      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
-
-      # Not a directory, so check to see that there is only one file specified.
-      set dummy $files
-      if test "$#" -gt 2; then
-	$echo "$modename: \`$dest' is not a directory" 1>&2
-	$echo "$help" 1>&2
-	exit $EXIT_FAILURE
-      fi
-    fi
-    case $destdir in
-    [\\/]* | [A-Za-z]:[\\/]*) ;;
-    *)
-      for file in $files; do
-	case $file in
-	*.lo) ;;
-	*)
-	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
-	  $echo "$help" 1>&2
-	  exit $EXIT_FAILURE
-	  ;;
-	esac
-      done
-      ;;
-    esac
-
-    # This variable tells wrapper scripts just to set variables rather
-    # than running their programs.
-    libtool_install_magic="$magic"
-
-    staticlibs=
-    future_libdirs=
-    current_libdirs=
-    for file in $files; do
-
-      # Do each installation.
-      case $file in
-      *.$libext)
-	# Do the static libraries later.
-	staticlibs="$staticlibs $file"
-	;;
-
-      *.la)
-	# Check to see that this really is a libtool archive.
-	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
-	else
-	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
-	  $echo "$help" 1>&2
-	  exit $EXIT_FAILURE
-	fi
-
-	library_names=
-	old_library=
-	relink_command=
-	# If there is no directory component, then add one.
-	case $file in
-	*/* | *\\*) . $file ;;
-	*) . ./$file ;;
-	esac
-
-	# Add the libdir to current_libdirs if it is the destination.
-	if test "X$destdir" = "X$libdir"; then
-	  case "$current_libdirs " in
-	  *" $libdir "*) ;;
-	  *) current_libdirs="$current_libdirs $libdir" ;;
-	  esac
-	else
-	  # Note the libdir as a future libdir.
-	  case "$future_libdirs " in
-	  *" $libdir "*) ;;
-	  *) future_libdirs="$future_libdirs $libdir" ;;
-	  esac
-	fi
-
-	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
-	test "X$dir" = "X$file/" && dir=
-	dir="$dir$objdir"
-
-	if test -n "$relink_command"; then
-	  # Determine the prefix the user has applied to our future dir.
-	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
-
-	  # Don't allow the user to place us outside of our expected
-	  # location b/c this prevents finding dependent libraries that
-	  # are installed to the same prefix.
-	  # At present, this check doesn't affect windows .dll's that
-	  # are installed into $libdir/../bin (currently, that works fine)
-	  # but it's something to keep an eye on.
-	  if test "$inst_prefix_dir" = "$destdir"; then
-	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
-	    exit $EXIT_FAILURE
-	  fi
-
-	  if test -n "$inst_prefix_dir"; then
-	    # Stick the inst_prefix_dir data into the link command.
-	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
-	  else
-	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
-	  fi
-
-	  $echo "$modename: warning: relinking \`$file'" 1>&2
-	  $show "$relink_command"
-	  if $run eval "$relink_command"; then :
-	  else
-	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
-	    exit $EXIT_FAILURE
-	  fi
-	fi
-
-	# See the names of the shared library.
-	set dummy $library_names
-	if test -n "$2"; then
-	  realname="$2"
-	  shift
-	  shift
-
-	  srcname="$realname"
-	  test -n "$relink_command" && srcname="$realname"T
-
-	  # Install the shared library and build the symlinks.
-	  $show "$install_prog $dir/$srcname $destdir/$realname"
-	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
-	  if test -n "$stripme" && test -n "$striplib"; then
-	    $show "$striplib $destdir/$realname"
-	    $run eval "$striplib $destdir/$realname" || exit $?
-	  fi
-
-	  if test "$#" -gt 0; then
-	    # Delete the old symlinks, and create new ones.
-	    # Try `ln -sf' first, because the `ln' binary might depend on
-	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
-	    # so we also need to try rm && ln -s.
-	    for linkname
-	    do
-	      if test "$linkname" != "$realname"; then
-                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
-                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
-	      fi
-	    done
-	  fi
-
-	  # Do each command in the postinstall commands.
-	  lib="$destdir/$realname"
-	  cmds=$postinstall_cmds
-	  save_ifs="$IFS"; IFS='~'
-	  for cmd in $cmds; do
-	    IFS="$save_ifs"
-	    eval cmd=\"$cmd\"
-	    $show "$cmd"
-	    $run eval "$cmd" || {
-	      lt_exit=$?
-
-	      # Restore the uninstalled library and exit
-	      if test "$mode" = relink; then
-		$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
-	      fi
-
-	      exit $lt_exit
-	    }
-	  done
-	  IFS="$save_ifs"
-	fi
-
-	# Install the pseudo-library for information purposes.
-	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
-	instname="$dir/$name"i
-	$show "$install_prog $instname $destdir/$name"
-	$run eval "$install_prog $instname $destdir/$name" || exit $?
-
-	# Maybe install the static library, too.
-	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
-	;;
-
-      *.lo)
-	# Install (i.e. copy) a libtool object.
-
-	# Figure out destination file name, if it wasn't already specified.
-	if test -n "$destname"; then
-	  destfile="$destdir/$destname"
-	else
-	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
-	  destfile="$destdir/$destfile"
-	fi
-
-	# Deduce the name of the destination old-style object file.
-	case $destfile in
-	*.lo)
-	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
-	  ;;
-	*.$objext)
-	  staticdest="$destfile"
-	  destfile=
-	  ;;
-	*)
-	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
-	  $echo "$help" 1>&2
-	  exit $EXIT_FAILURE
-	  ;;
-	esac
-
-	# Install the libtool object if requested.
-	if test -n "$destfile"; then
-	  $show "$install_prog $file $destfile"
-	  $run eval "$install_prog $file $destfile" || exit $?
-	fi
-
-	# Install the old object if enabled.
-	if test "$build_old_libs" = yes; then
-	  # Deduce the name of the old-style object file.
-	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
-
-	  $show "$install_prog $staticobj $staticdest"
-	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
-	fi
-	exit $EXIT_SUCCESS
-	;;
-
-      *)
-	# Figure out destination file name, if it wasn't already specified.
-	if test -n "$destname"; then
-	  destfile="$destdir/$destname"
-	else
-	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
-	  destfile="$destdir/$destfile"
-	fi
-
-	# If the file is missing, and there is a .exe on the end, strip it
-	# because it is most likely a libtool script we actually want to
-	# install
-	stripped_ext=""
-	case $file in
-	  *.exe)
-	    if test ! -f "$file"; then
-	      file=`$echo $file|${SED} 's,.exe$,,'`
-	      stripped_ext=".exe"
-	    fi
-	    ;;
-	esac
-
-	# Do a test to see if this is really a libtool program.
-	case $host in
-	*cygwin*|*mingw*)
-	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
-	    ;;
-	*)
-	    wrapper=$file
-	    ;;
-	esac
-	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
-	  notinst_deplibs=
-	  relink_command=
-
-	  # Note that it is not necessary on cygwin/mingw to append a dot to
-	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
-	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
-	  # `FILE.' does not work on cygwin managed mounts.
-	  #
-	  # If there is no directory component, then add one.
-	  case $wrapper in
-	  */* | *\\*) . ${wrapper} ;;
-	  *) . ./${wrapper} ;;
-	  esac
-
-	  # Check the variables that should have been set.
-	  if test -z "$notinst_deplibs"; then
-	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
-	    exit $EXIT_FAILURE
-	  fi
-
-	  finalize=yes
-	  for lib in $notinst_deplibs; do
-	    # Check to see that each library is installed.
-	    libdir=
-	    if test -f "$lib"; then
-	      # If there is no directory component, then add one.
-	      case $lib in
-	      */* | *\\*) . $lib ;;
-	      *) . ./$lib ;;
-	      esac
-	    fi
-	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
-	    if test -n "$libdir" && test ! -f "$libfile"; then
-	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
-	      finalize=no
-	    fi
-	  done
-
-	  relink_command=
-	  # Note that it is not necessary on cygwin/mingw to append a dot to
-	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
-	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
-	  # `FILE.' does not work on cygwin managed mounts.
-	  #
-	  # If there is no directory component, then add one.
-	  case $wrapper in
-	  */* | *\\*) . ${wrapper} ;;
-	  *) . ./${wrapper} ;;
-	  esac
-
-	  outputname=
-	  if test "$fast_install" = no && test -n "$relink_command"; then
-	    if test "$finalize" = yes && test -z "$run"; then
-	      tmpdir=`func_mktempdir`
-	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
-	      outputname="$tmpdir/$file"
-	      # Replace the output file specification.
-	      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
-
-	      $show "$relink_command"
-	      if $run eval "$relink_command"; then :
-	      else
-		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
-		${rm}r "$tmpdir"
-		continue
-	      fi
-	      file="$outputname"
-	    else
-	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
-	    fi
-	  else
-	    # Install the binary that we compiled earlier.
-	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
-	  fi
-	fi
-
-	# remove .exe since cygwin /usr/bin/install will append another
-	# one anyway 
-	case $install_prog,$host in
-	*/usr/bin/install*,*cygwin*)
-	  case $file:$destfile in
-	  *.exe:*.exe)
-	    # this is ok
-	    ;;
-	  *.exe:*)
-	    destfile=$destfile.exe
-	    ;;
-	  *:*.exe)
-	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
-	    ;;
-	  esac
-	  ;;
-	esac
-	$show "$install_prog$stripme $file $destfile"
-	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
-	test -n "$outputname" && ${rm}r "$tmpdir"
-	;;
-      esac
-    done
-
-    for file in $staticlibs; do
-      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
-
-      # Set up the ranlib parameters.
-      oldlib="$destdir/$name"
-
-      $show "$install_prog $file $oldlib"
-      $run eval "$install_prog \$file \$oldlib" || exit $?
-
-      if test -n "$stripme" && test -n "$old_striplib"; then
-	$show "$old_striplib $oldlib"
-	$run eval "$old_striplib $oldlib" || exit $?
-      fi
-
-      # Do each command in the postinstall commands.
-      cmds=$old_postinstall_cmds
-      save_ifs="$IFS"; IFS='~'
-      for cmd in $cmds; do
-	IFS="$save_ifs"
-	eval cmd=\"$cmd\"
-	$show "$cmd"
-	$run eval "$cmd" || exit $?
-      done
-      IFS="$save_ifs"
-    done
-
-    if test -n "$future_libdirs"; then
-      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
-    fi
-
-    if test -n "$current_libdirs"; then
-      # Maybe just do a dry run.
-      test -n "$run" && current_libdirs=" -n$current_libdirs"
-      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
-    else
-      exit $EXIT_SUCCESS
-    fi
-    ;;
-
-  # libtool finish mode
-  finish)
-    modename="$modename: finish"
-    libdirs="$nonopt"
-    admincmds=
-
-    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
-      for dir
-      do
-	libdirs="$libdirs $dir"
-      done
-
-      for libdir in $libdirs; do
-	if test -n "$finish_cmds"; then
-	  # Do each command in the finish commands.
-	  cmds=$finish_cmds
-	  save_ifs="$IFS"; IFS='~'
-	  for cmd in $cmds; do
-	    IFS="$save_ifs"
-	    eval cmd=\"$cmd\"
-	    $show "$cmd"
-	    $run eval "$cmd" || admincmds="$admincmds
-       $cmd"
-	  done
-	  IFS="$save_ifs"
-	fi
-	if test -n "$finish_eval"; then
-	  # Do the single finish_eval.
-	  eval cmds=\"$finish_eval\"
-	  $run eval "$cmds" || admincmds="$admincmds
-       $cmds"
-	fi
-      done
-    fi
-
-    # Exit here if they wanted silent mode.
-    test "$show" = : && exit $EXIT_SUCCESS
-
-    $echo "X----------------------------------------------------------------------" | $Xsed
-    $echo "Libraries have been installed in:"
-    for libdir in $libdirs; do
-      $echo "   $libdir"
-    done
-    $echo
-    $echo "If you ever happen to want to link against installed libraries"
-    $echo "in a given directory, LIBDIR, you must either use libtool, and"
-    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
-    $echo "flag during linking and do at least one of the following:"
-    if test -n "$shlibpath_var"; then
-      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
-      $echo "     during execution"
-    fi
-    if test -n "$runpath_var"; then
-      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
-      $echo "     during linking"
-    fi
-    if test -n "$hardcode_libdir_flag_spec"; then
-      libdir=LIBDIR
-      eval flag=\"$hardcode_libdir_flag_spec\"
-
-      $echo "   - use the \`$flag' linker flag"
-    fi
-    if test -n "$admincmds"; then
-      $echo "   - have your system administrator run these commands:$admincmds"
-    fi
-    if test -f /etc/ld.so.conf; then
-      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
-    fi
-    $echo
-    $echo "See any operating system documentation about shared libraries for"
-    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
-    $echo "X----------------------------------------------------------------------" | $Xsed
-    exit $EXIT_SUCCESS
-    ;;
-
-  # libtool execute mode
-  execute)
-    modename="$modename: execute"
-
-    # The first argument is the command name.
-    cmd="$nonopt"
-    if test -z "$cmd"; then
-      $echo "$modename: you must specify a COMMAND" 1>&2
-      $echo "$help"
-      exit $EXIT_FAILURE
-    fi
-
-    # Handle -dlopen flags immediately.
-    for file in $execute_dlfiles; do
-      if test ! -f "$file"; then
-	$echo "$modename: \`$file' is not a file" 1>&2
-	$echo "$help" 1>&2
-	exit $EXIT_FAILURE
-      fi
-
-      dir=
-      case $file in
-      *.la)
-	# Check to see that this really is a libtool archive.
-	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
-	else
-	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
-	  $echo "$help" 1>&2
-	  exit $EXIT_FAILURE
-	fi
-
-	# Read the libtool library.
-	dlname=
-	library_names=
-
-	# If there is no directory component, then add one.
-	case $file in
-	*/* | *\\*) . $file ;;
-	*) . ./$file ;;
-	esac
-
-	# Skip this library if it cannot be dlopened.
-	if test -z "$dlname"; then
-	  # Warn if it was a shared library.
-	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
-	  continue
-	fi
-
-	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
-	test "X$dir" = "X$file" && dir=.
-
-	if test -f "$dir/$objdir/$dlname"; then
-	  dir="$dir/$objdir"
-	else
-	  if test ! -f "$dir/$dlname"; then
-	    $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
-	    exit $EXIT_FAILURE
-	  fi
-	fi
-	;;
-
-      *.lo)
-	# Just add the directory containing the .lo file.
-	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
-	test "X$dir" = "X$file" && dir=.
-	;;
-
-      *)
-	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
-	continue
-	;;
-      esac
-
-      # Get the absolute pathname.
-      absdir=`cd "$dir" && pwd`
-      test -n "$absdir" && dir="$absdir"
-
-      # Now add the directory to shlibpath_var.
-      if eval "test -z \"\$$shlibpath_var\""; then
-	eval "$shlibpath_var=\"\$dir\""
-      else
-	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
-      fi
-    done
-
-    # This variable tells wrapper scripts just to set shlibpath_var
-    # rather than running their programs.
-    libtool_execute_magic="$magic"
-
-    # Check if any of the arguments is a wrapper script.
-    args=
-    for file
-    do
-      case $file in
-      -*) ;;
-      *)
-	# Do a test to see if this is really a libtool program.
-	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
-	  # If there is no directory component, then add one.
-	  case $file in
-	  */* | *\\*) . $file ;;
-	  *) . ./$file ;;
-	  esac
-
-	  # Transform arg to wrapped name.
-	  file="$progdir/$program"
-	fi
-	;;
-      esac
-      # Quote arguments (to preserve shell metacharacters).
-      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
-      args="$args \"$file\""
-    done
-
-    if test -z "$run"; then
-      if test -n "$shlibpath_var"; then
-	# Export the shlibpath_var.
-	eval "export $shlibpath_var"
-      fi
-
-      # Restore saved environment variables
-      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
-      do
-	eval "if test \"\${save_$lt_var+set}\" = set; then
-		$lt_var=\$save_$lt_var; export $lt_var
-	      fi"
-      done
-
-      # Now prepare to actually exec the command.
-      exec_cmd="\$cmd$args"
-    else
-      # Display what would be done.
-      if test -n "$shlibpath_var"; then
-	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
-	$echo "export $shlibpath_var"
-      fi
-      $echo "$cmd$args"
-      exit $EXIT_SUCCESS
-    fi
-    ;;
-
-  # libtool clean and uninstall mode
-  clean | uninstall)
-    modename="$modename: $mode"
-    rm="$nonopt"
-    files=
-    rmforce=
-    exit_status=0
-
-    # This variable tells wrapper scripts just to set variables rather
-    # than running their programs.
-    libtool_install_magic="$magic"
-
-    for arg
-    do
-      case $arg in
-      -f) rm="$rm $arg"; rmforce=yes ;;
-      -*) rm="$rm $arg" ;;
-      *) files="$files $arg" ;;
-      esac
-    done
-
-    if test -z "$rm"; then
-      $echo "$modename: you must specify an RM program" 1>&2
-      $echo "$help" 1>&2
-      exit $EXIT_FAILURE
-    fi
-
-    rmdirs=
-
-    origobjdir="$objdir"
-    for file in $files; do
-      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
-      if test "X$dir" = "X$file"; then
-	dir=.
-	objdir="$origobjdir"
-      else
-	objdir="$dir/$origobjdir"
-      fi
-      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
-      test "$mode" = uninstall && objdir="$dir"
-
-      # Remember objdir for removal later, being careful to avoid duplicates
-      if test "$mode" = clean; then
-	case " $rmdirs " in
-	  *" $objdir "*) ;;
-	  *) rmdirs="$rmdirs $objdir" ;;
-	esac
-      fi
-
-      # Don't error if the file doesn't exist and rm -f was used.
-      if (test -L "$file") >/dev/null 2>&1 \
-	|| (test -h "$file") >/dev/null 2>&1 \
-	|| test -f "$file"; then
-	:
-      elif test -d "$file"; then
-	exit_status=1
-	continue
-      elif test "$rmforce" = yes; then
-	continue
-      fi
-
-      rmfiles="$file"
-
-      case $name in
-      *.la)
-	# Possibly a libtool archive, so verify it.
-	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
-	  . $dir/$name
-
-	  # Delete the libtool libraries and symlinks.
-	  for n in $library_names; do
-	    rmfiles="$rmfiles $objdir/$n"
-	  done
-	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
-
-	  case "$mode" in
-	  clean)
-	    case "  $library_names " in
-	    # "  " in the beginning catches empty $dlname
-	    *" $dlname "*) ;;
-	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
-	    esac
-	     test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
-	    ;;
-	  uninstall)
-	    if test -n "$library_names"; then
-	      # Do each command in the postuninstall commands.
-	      cmds=$postuninstall_cmds
-	      save_ifs="$IFS"; IFS='~'
-	      for cmd in $cmds; do
-		IFS="$save_ifs"
-		eval cmd=\"$cmd\"
-		$show "$cmd"
-		$run eval "$cmd"
-		if test "$?" -ne 0 && test "$rmforce" != yes; then
-		  exit_status=1
-		fi
-	      done
-	      IFS="$save_ifs"
-	    fi
-
-	    if test -n "$old_library"; then
-	      # Do each command in the old_postuninstall commands.
-	      cmds=$old_postuninstall_cmds
-	      save_ifs="$IFS"; IFS='~'
-	      for cmd in $cmds; do
-		IFS="$save_ifs"
-		eval cmd=\"$cmd\"
-		$show "$cmd"
-		$run eval "$cmd"
-		if test "$?" -ne 0 && test "$rmforce" != yes; then
-		  exit_status=1
-		fi
-	      done
-	      IFS="$save_ifs"
-	    fi
-	    # FIXME: should reinstall the best remaining shared library.
-	    ;;
-	  esac
-	fi
-	;;
-
-      *.lo)
-	# Possibly a libtool object, so verify it.
-	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
-
-	  # Read the .lo file
-	  . $dir/$name
-
-	  # Add PIC object to the list of files to remove.
-	  if test -n "$pic_object" \
-	     && test "$pic_object" != none; then
-	    rmfiles="$rmfiles $dir/$pic_object"
-	  fi
-
-	  # Add non-PIC object to the list of files to remove.
-	  if test -n "$non_pic_object" \
-	     && test "$non_pic_object" != none; then
-	    rmfiles="$rmfiles $dir/$non_pic_object"
-	  fi
-	fi
-	;;
-
-      *)
-	if test "$mode" = clean ; then
-	  noexename=$name
-	  case $file in
-	  *.exe)
-	    file=`$echo $file|${SED} 's,.exe$,,'`
-	    noexename=`$echo $name|${SED} 's,.exe$,,'`
-	    # $file with .exe has already been added to rmfiles,
-	    # add $file without .exe
-	    rmfiles="$rmfiles $file"
-	    ;;
-	  esac
-	  # Do a test to see if this is a libtool program.
-	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
-	    relink_command=
-	    . $dir/$noexename
-
-	    # note $name still contains .exe if it was in $file originally
-	    # as does the version of $file that was added into $rmfiles
-	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
-	    if test "$fast_install" = yes && test -n "$relink_command"; then
-	      rmfiles="$rmfiles $objdir/lt-$name"
-	    fi
-	    if test "X$noexename" != "X$name" ; then
-	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
-	    fi
-	  fi
-	fi
-	;;
-      esac
-      $show "$rm $rmfiles"
-      $run $rm $rmfiles || exit_status=1
-    done
-    objdir="$origobjdir"
-
-    # Try to remove the ${objdir}s in the directories where we deleted files
-    for dir in $rmdirs; do
-      if test -d "$dir"; then
-	$show "rmdir $dir"
-	$run rmdir $dir >/dev/null 2>&1
-      fi
-    done
-
-    exit $exit_status
-    ;;
-
-  "")
-    $echo "$modename: you must specify a MODE" 1>&2
-    $echo "$generic_help" 1>&2
-    exit $EXIT_FAILURE
-    ;;
-  esac
-
-  if test -z "$exec_cmd"; then
-    $echo "$modename: invalid operation mode \`$mode'" 1>&2
-    $echo "$generic_help" 1>&2
-    exit $EXIT_FAILURE
-  fi
-fi # test -z "$show_help"
-
-if test -n "$exec_cmd"; then
-  eval exec $exec_cmd
-  exit $EXIT_FAILURE
-fi
-
-# We need to display help for each of the modes.
-case $mode in
-"") $echo \
-"Usage: $modename [OPTION]... [MODE-ARG]...
-
-Provide generalized library-building support services.
-
-    --config          show all configuration variables
-    --debug           enable verbose shell tracing
--n, --dry-run         display commands without modifying any files
-    --features        display basic configuration information and exit
-    --finish          same as \`--mode=finish'
-    --help            display this help message and exit
-    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
-    --quiet           same as \`--silent'
-    --silent          don't print informational messages
-    --tag=TAG         use configuration variables from tag TAG
-    --version         print version information
-
-MODE must be one of the following:
-
-      clean           remove files from the build directory
-      compile         compile a source file into a libtool object
-      execute         automatically set library path, then run a program
-      finish          complete the installation of libtool libraries
-      install         install libraries or executables
-      link            create a library or an executable
-      uninstall       remove libraries from an installed directory
-
-MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
-a more detailed description of MODE.
-
-Report bugs to <bug-libtool at gnu.org>."
-  exit $EXIT_SUCCESS
-  ;;
-
-clean)
-  $echo \
-"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
-
-Remove files from the build directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, object or program, all the files associated
-with it are deleted. Otherwise, only FILE itself is deleted using RM."
-  ;;
-
-compile)
-  $echo \
-"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
-
-Compile a source file into a libtool library object.
-
-This mode accepts the following additional options:
-
-  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
-  -prefer-pic       try to building PIC objects only
-  -prefer-non-pic   try to building non-PIC objects only
-  -static           always build a \`.o' file suitable for static linking
-
-COMPILE-COMMAND is a command to be used in creating a \`standard' object file
-from the given SOURCEFILE.
-
-The output file name is determined by removing the directory component from
-SOURCEFILE, then substituting the C source code suffix \`.c' with the
-library object suffix, \`.lo'."
-  ;;
-
-execute)
-  $echo \
-"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
-
-Automatically set library path, then run a program.
-
-This mode accepts the following additional options:
-
-  -dlopen FILE      add the directory containing FILE to the library path
-
-This mode sets the library path environment variable according to \`-dlopen'
-flags.
-
-If any of the ARGS are libtool executable wrappers, then they are translated
-into their corresponding uninstalled binary, and any of their required library
-directories are added to the library path.
-
-Then, COMMAND is executed, with ARGS as arguments."
-  ;;
-
-finish)
-  $echo \
-"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
-
-Complete the installation of libtool libraries.
-
-Each LIBDIR is a directory that contains libtool libraries.
-
-The commands that this mode executes may require superuser privileges.  Use
-the \`--dry-run' option if you just want to see what would be executed."
-  ;;
-
-install)
-  $echo \
-"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
-
-Install executables or libraries.
-
-INSTALL-COMMAND is the installation command.  The first component should be
-either the \`install' or \`cp' program.
-
-The rest of the components are interpreted as arguments to that command (only
-BSD-compatible install options are recognized)."
-  ;;
-
-link)
-  $echo \
-"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
-
-Link object files or libraries together to form another library, or to
-create an executable program.
-
-LINK-COMMAND is a command using the C compiler that you would use to create
-a program from several object files.
-
-The following components of LINK-COMMAND are treated specially:
-
-  -all-static       do not do any dynamic linking at all
-  -avoid-version    do not add a version suffix if possible
-  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
-  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
-  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
-  -export-symbols SYMFILE
-                    try to export only the symbols listed in SYMFILE
-  -export-symbols-regex REGEX
-                    try to export only the symbols matching REGEX
-  -LLIBDIR          search LIBDIR for required installed libraries
-  -lNAME            OUTPUT-FILE requires the installed library libNAME
-  -module           build a library that can dlopened
-  -no-fast-install  disable the fast-install mode
-  -no-install       link a not-installable executable
-  -no-undefined     declare that a library does not refer to external symbols
-  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
-  -objectlist FILE  Use a list of object files found in FILE to specify objects
-  -precious-files-regex REGEX
-                    don't remove output files matching REGEX
-  -release RELEASE  specify package release information
-  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
-  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
-  -static           do not do any dynamic linking of uninstalled libtool libraries
-  -static-libtool-libs
-                    do not do any dynamic linking of libtool libraries
-  -version-info CURRENT[:REVISION[:AGE]]
-                    specify library version info [each variable defaults to 0]
-
-All other options (arguments beginning with \`-') are ignored.
-
-Every other argument is treated as a filename.  Files ending in \`.la' are
-treated as uninstalled libtool libraries, other files are standard or library
-object files.
-
-If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
-only library objects (\`.lo' files) may be specified, and \`-rpath' is
-required, except when creating a convenience library.
-
-If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
-using \`ar' and \`ranlib', or on Windows using \`lib'.
-
-If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
-is created, otherwise an executable program is created."
-  ;;
-
-uninstall)
-  $echo \
-"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
-
-Remove libraries from an installation directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, all the files associated with it are deleted.
-Otherwise, only FILE itself is deleted using RM."
-  ;;
-
-*)
-  $echo "$modename: invalid operation mode \`$mode'" 1>&2
-  $echo "$help" 1>&2
-  exit $EXIT_FAILURE
-  ;;
-esac
-
-$echo
-$echo "Try \`$modename --help' for more information about other modes."
-
-exit $?
-
-# The TAGs below are defined such that we never get into a situation
-# in which we disable both kinds of libraries.  Given conflicting
-# choices, we go for a static library, that is the most portable,
-# since we can't tell whether shared libraries were disabled because
-# the user asked for that or because the platform doesn't support
-# them.  This is particularly important on AIX, because we don't
-# support having both static and shared libraries enabled at the same
-# time on that platform, so we default to a shared-only configuration.
-# If a disable-shared tag is given, we'll fallback to a static-only
-# configuration.  But we'll never go from static-only to shared-only.
-
-# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
-disable_libs=shared
-# ### END LIBTOOL TAG CONFIG: disable-shared
-
-# ### BEGIN LIBTOOL TAG CONFIG: disable-static
-disable_libs=static
-# ### END LIBTOOL TAG CONFIG: disable-static
-
-# Local Variables:
-# mode:shell-script
-# sh-indentation:2
-# End:
diff --git a/macros/Makefile.am b/macros/Makefile.am
index 6026633..3cf6261 100644
--- a/macros/Makefile.am
+++ b/macros/Makefile.am
@@ -1,3 +1,6 @@
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 EXTRA_DIST=\
 	aclocal-include.m4	\
 	givaro-check.m4		\
@@ -11,4 +14,5 @@ EXTRA_DIST=\
 	expat-check.m4		\
 	config-header.m4	\
 	linbox-misc.m4		\
+	iml-check.m4        \
 	maple-check-version.mpl
diff --git a/macros/Makefile.in b/macros/Makefile.in
index a0d4ace..2171d6e 100644
--- a/macros/Makefile.in
+++ b/macros/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -35,19 +36,26 @@ subdir = macros
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
-	$(top_srcdir)/macros/blas-check.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
 	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
 	$(top_srcdir)/macros/givaro-check.m4 \
 	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
 	$(top_srcdir)/macros/lidia-check.m4 \
 	$(top_srcdir)/macros/linbox-doc.m4 \
 	$(top_srcdir)/macros/linbox-misc.m4 \
 	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
 	$(top_srcdir)/macros/maple-check.m4 \
 	$(top_srcdir)/macros/ntl-check.m4 \
 	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -66,18 +74,21 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
 CC = @CC@
+CCNAM = @CCNAM@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
 DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -85,19 +96,24 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
 GIVARO_CFLAGS = @GIVARO_CFLAGS@
 GIVARO_LIBS = @GIVARO_LIBS@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
 GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
@@ -105,41 +121,52 @@ LIBTOOL = @LIBTOOL@
 LIDIA_CFLAGS = @LIDIA_CFLAGS@
 LIDIA_LIBS = @LIDIA_LIBS@
 LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MAPLE_CFLAGS = @MAPLE_CFLAGS@
 MAPLE_HOME = @MAPLE_HOME@
 MAPLE_LIBS = @MAPLE_LIBS@
 MAPLE_VERSION = @MAPLE_VERSION@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
 NTL_CFLAGS = @NTL_CFLAGS@
 NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RM = @RM@
 SACLIB_CFLAGS = @SACLIB_CFLAGS@
 SACLIB_LIBS = @SACLIB_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+TESTS_CFLAGS = @TESTS_CFLAGS@
 VERSION = @VERSION@
+WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -180,8 +207,13 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 EXTRA_DIST = \
 	aclocal-include.m4	\
 	givaro-check.m4		\
@@ -195,6 +227,7 @@ EXTRA_DIST = \
 	expat-check.m4		\
 	config-header.m4	\
 	linbox-misc.m4		\
+	iml-check.m4        \
 	maple-check-version.mpl
 
 all: all-am
@@ -204,8 +237,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
 	      exit 1;; \
 	  esac; \
 	done; \
@@ -310,6 +343,8 @@ dvi-am:
 
 html: html-am
 
+html-am:
+
 info: info-am
 
 info-am:
@@ -318,18 +353,28 @@ install-data-am:
 
 install-dvi: install-dvi-am
 
+install-dvi-am:
+
 install-exec-am:
 
 install-html: install-html-am
 
+install-html-am:
+
 install-info: install-info-am
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-am
 
+install-pdf-am:
+
 install-ps: install-ps-am
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
diff --git a/macros/aclocal-include.m4 b/macros/aclocal-include.m4
index abf6533..3dbea21 100644
--- a/macros/aclocal-include.m4
+++ b/macros/aclocal-include.m4
@@ -1,7 +1,12 @@
+# Copyright (c) 2011 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+
+
 # aclocal-include.m4
-# 
+#
 # This macro adds the name macrodir to the set of directories
-# that `aclocal' searches for macros.  
+# that `aclocal' searches for macros.
 
 # serial 1
 
diff --git a/macros/atlas-check.m4 b/macros/atlas-check.m4
index 3feff14..d8a4981 100644
--- a/macros/atlas-check.m4
+++ b/macros/atlas-check.m4
@@ -1,4 +1,7 @@
 # Check for ATLAS
+# Copyright (c) 2003 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 # Pascal Giorgi , 2003-03-04
 # Inspired by gnome-bonobo-check.m4 by Miguel de Icaza, 99-04-12
 # Stolen from Chris Lahey       99-2-5
@@ -15,13 +18,13 @@ AC_DEFUN([LB_CHECK_ATLAS],
 [
 
 AC_ARG_WITH(atlas,
-	    [  --with-atlas=<path>|yes|no 
-					   Use Atlas library. 
+	    [AC_HELP_STRING([--with-atlas=<path>|yes|no],
+					   [Use Atlas library.
 					   If argument is no, you do not have the library installed on your machine (set as default).
 					   If argument is yes or <empty> that means the library is reachable with the standard
 					   search path (/usr or /usr/local).
-	 				   Otherwise you give the <path> to the directory which contain the library. 	       		
-	     ],
+	 				   Otherwise you give the <path> to the directory which contain the library.
+	     ])],
 	     [if test "$withval" = yes ; then
 			ATLAS_HOME_PATH="${DEFAULT_CHECKING_PATH}"
 	      elif test "$withval" != no ; then
@@ -30,10 +33,10 @@ AC_ARG_WITH(atlas,
 	     [])
 
 AC_ARG_WITH(atlas-includes,
-	    [  --with-atlas-includes=<path>
-					   Useful for multi-platform installation.
-					   Add the path of ATLAS platform dependant headers.					   
-					   Need --with-atlas=<generic path> option.
+	    [AC_HELP_STRING([--with-atlas-includes=<path>],
+					   [Useful for multi-platform installation.
+					   Add the path of ATLAS platform dependant headers.
+					   Need --with-atlas=<generic path> option.])
 	     ],
 	     [ if test -n "$withval" ; then
 			OPT_ATLAS_CFLAGS="$withval"
@@ -42,11 +45,11 @@ AC_ARG_WITH(atlas-includes,
 	     [])
 
 AC_ARG_WITH(atlas-libraries,
-	    [  --with-atlas-libraries=<path>
-					   Useful for multi-platform installation.
-					   Add the path of ATLAS platform dependant libraries.					   
+	    [AC_HELP_STRING([--with-atlas-libraries=<path>],
+					   [Useful for multi-platform installation.
+					   Add the path of ATLAS platform dependant libraries.
 					   Need --with-atlas=<generic path> option.
-	     ],
+	     ])],
 	     [ if test -n "$withval" ; then
 			OPT_ATLAS_LIBS="$withval"
 	       fi
@@ -66,7 +69,7 @@ if test -n "$ATLAS_HOME_PATH" ; then
 AC_MSG_CHECKING(for ATLAS >= $min_atlas_version)
 fi
 
-for ATLAS_HOME in ${ATLAS_HOME_PATH} 
+for ATLAS_HOME in ${ATLAS_HOME_PATH}
  do
 if test -r "$ATLAS_HOME/include/cblas.h"; then
 
@@ -77,11 +80,11 @@ if test -r "$ATLAS_HOME/include/cblas.h"; then
 			ATLAS_CFLAGS="-I${ATLAS_HOME}/include -I${OPT_ATLAS_CFLAGS}"
 		fi
 		if test -z "${OPT_ATLAS_LIBS}" ; then
-			ATLAS_LIBS="-L${ATLAS_HOME}/lib -llapack -lcblas -latlas" 
-		else	
+			ATLAS_LIBS="-L${ATLAS_HOME}/lib -llapack -lcblas -latlas"
+		else
 			ATLAS_LIBS="-L${ATLAS_HOME}/lib -L${OPT_ATLAS_LIBS} -llapack -lcblas -latlas"
 		fi
-		
+
 	else
 		if test -z "${OPT_ATLAS_CFLAGS}" ; then
 			ATLAS_CFLAGS=
@@ -89,13 +92,13 @@ if test -r "$ATLAS_HOME/include/cblas.h"; then
 			ATLAS_CFLAGS="-I${OPT_ATLAS_CFLAGS}"
 		fi
 		if test -z "${OPT_ATLAS_LIBS}" ; then
-			ATLAS_LIBS="-llapack -lcblas -latlas" 
-		else	
+			ATLAS_LIBS="-llapack -lcblas -latlas"
+		else
 			ATLAS_LIBS="-L${OPT_ATLAS_LIBS} -llapack -lcblas -latlas"
 		fi
 	fi
 
-	CXXFLAGS="${BACKUP_CXXFLAGS} ${ATLAS_CFLAGS} ${GMP_CFLAGS}" 
+	CXXFLAGS="${BACKUP_CXXFLAGS} ${ATLAS_CFLAGS} ${GMP_CFLAGS}"
 	LIBS="${BACKUP_LIBS} ${ATLAS_LIBS} ${GMP_LIBS}"
 
 	AC_TRY_LINK(
@@ -105,18 +108,18 @@ if test -r "$ATLAS_HOME/include/cblas.h"; then
 	AC_TRY_RUN(
 	[#include <atlas_buildinfo.h>
 	 int main () {  if  (ATL_VERS[0] <3) return -1; else return 0; }
-	],[	
-	atlas_found="yes"	
+	],[
+	atlas_found="yes"
 	break
-	],[	
-	atlas_problem="$problem $ATLAS_HOME"	
+	],[
+	atlas_problem="$problem $ATLAS_HOME"
 	unset ATLAS_CFLAGS
-	unset ATLAS_LIBS	
+	unset ATLAS_LIBS
 	],[
 	atlas_found="yes"
 	atlas_cross="yes"
 	break
-	])	
+	])
 	],
 	[
 	atlas_found="no"
@@ -130,7 +133,7 @@ else
 fi
 done
 
-if test "x$atlas_found" = "xyes" ; then		
+if test "x$atlas_found" = "xyes" ; then
 	AC_SUBST(ATLAS_CFLAGS)
 	AC_SUBST(ATLAS_LIBS)
 	AC_DEFINE(HAVE_ATLAS,1,[Define if ATLAS is installed])
@@ -148,10 +151,10 @@ elif test -n "$atlas_problem"; then
 	AC_MSG_RESULT(problem)
 	echo "Sorry, your ATLAS version is too old. Disabling."
 	ifelse([$3], , :, [$3])
-elif test "x$atlas_found" = "xno" ; then	
+elif test "x$atlas_found" = "xno" ; then
 	AC_MSG_RESULT(not found)
 	ifelse([$3], , :, [$3])
-fi	
+fi
 
 AM_CONDITIONAL(LINBOX_HAVE_ATLAS, test "x$HAVE_ATLAS" = "xyes")
 
diff --git a/macros/blas-check.m4 b/macros/blas-check.m4
deleted file mode 100644
index 25dbe14..0000000
--- a/macros/blas-check.m4
+++ /dev/null
@@ -1,498 +0,0 @@
-# Check for BLAS
-# Copyright Pascal Giorgi 2005
-
-
-dnl LB_CHECK_BLAS ([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
-dnl
-dnl Test for BLAS and define BLAS_LIBS
-
-AC_DEFUN([LB_CHECK_BLAS],
-[
-
-AC_ARG_WITH(blas,
-[  --with-blas=<lib>|yes Use BLAS library. This library is mandatory for LinBox
-   			compilation. If argument is yes or <empty> that means 
-			the library is reachable with the standard search path 
-			(/usr or /usr/local). Otherwise you give the <path> to 
-			the directory which contain the library.
-	     ],
-	     [if test "$withval" = yes ; then
-			BLAS_HOME_PATH="${DEFAULT_CHECKING_PATH}"
-	      else
-			BLAS_HOME_PATH="$withval"
-			BLAS_VAL="$withval"
-	     fi],
-	     [BLAS_HOME_PATH="${DEFAULT_CHECKING_PATH}"])
-
-
-
-
-dnl Check for existence
-
-BACKUP_CXXFLAGS=${CXXFLAGS}
-BACKUP_LIBS=${LIBS}
-
-if test -n "$BLAS_HOME_PATH" ; then
-AC_MSG_CHECKING(for C interface to BLAS)
-fi
-
-   
-###
-### Check first for C interface to BLAS
-###
-
-
-if test -n "$BLAS_VAL"; then
-
-	## check with user supplied value
-	CBLAS="yes"	 	
-	CBLAS_FLAG="-D__LINBOX_HAVE_CBLAS"
-
-	if   test -d "$BLAS_VAL"; then
-		if test -r "$BLAS_VAL/lib/libcblas.a" ; then 
-			ATLAS_NEEDED=`nm -u $BLAS_VAL/lib/libcblas.a | grep ATL`
-			if test -n "$ATLAS_NEEDED"; then
-				ATLAS_LIBS="-llapack -lcblas -latlas"	
-			else
-				ATLAS_LIBS="-lcblas -llapack"
-			fi		
-			BLAS_LIBS="-L${BLAS_VAL}/lib $ATLAS_LIBS" 
-
-		elif test -r "$BLAS_VAL/libcblas.a" ; then 
-			ATLAS_NEEDED=`nm -u $BLAS_VAL/libcblas.a | grep ATL`
-			if test -n "$ATLAS_NEEDED"; then
-				ATLAS_LIBS="-llapack -lcblas -latlas"	
-			else
-				ATLAS_LIBS="-lcblas -llapack"
-			fi		
-			BLAS_LIBS="-L${BLAS_VAL} $ATLAS_LIBS" 
-                elif test -r "$BLAS_VAL/include/mkl_cblas.h"; then
-			case `./config.guess` in
-				i686-*linux-gnu)
-					MKL_ARCH=32;
-					;;
-				x86_64-*-linux-gnu)
-					MKL_ARCH=em64t;
-					;;
-				*)
-					echo "Sorry unsupported arch, please complain in linbox-use discussion group";
-					;;
-			esac	
-                        BLAS_LIBS="-L${BLAS_VAL}/lib/${MKL_ARCH}/ -lmkl_lapack64 -lmkl -lvml -lguide"
-		fi
-	else
-		BLAS_LIBS="$BLAS_VAL"
-	fi		
-	CXXFLAGS="${BACKUP_CXXFLAGS} ${CBLAS_FLAG}" 
-	LIBS="${BACKUP_LIBS} ${BLAS_LIBS}" 
-
-	AC_TRY_LINK(
-	[#define __LINBOX_CONFIGURATION
-         #include "linbox/config-blas.h"],
-	[double a;],
-	[
-	AC_TRY_RUN(
-	[#define __LINBOX_CONFIGURATION
-       	 #include "linbox/config-blas.h"
-	 int main () {  double a[4] = {1.,2.,3.,4.}; double b[4]= {4.,3.,2.,1.}; double c[4]; 
-			cblas_dgemm(CblasRowMajor, CblasNoTrans,CblasNoTrans,2,2,2,1., a,2,b,2,0.,c,2);
-			if ( (c[0]!=8.) && (c[1]!=5.) && (c[2]!=20.) && (c[3]!=13))
-				return -1;
-			else
-				return 0;
-		      }
-	],[	
-	blas_found="yes"	
-	break
-	],[	
-	blas_problem="$problem $BLAS_VAL"	
-	unset BLAS_LIBS	
-	],[
-	blas_found="yes"
-	blas_cross="yes"
-	break
-	])	
-	],
-	[
-	blas_found="no"
-	blas_checked="$checked $BLAS_VAL"
-	unset BLAS_LIBS
-	])
-else
-
-	## check in default path
-	for BLAS_HOME in ${DEFAULT_CHECKING_PATH} 
-	do		
-		CBLAS="yes"
-		CBLAS_FLAG="-D__LINBOX_HAVE_CBLAS"
-	
-		if test -r "/System/Library/Frameworks/Accelerate.framework"; then
-			BLAS_LIBS="-Wl,-framework -Wl,Accelerate"
-		elif test -r "$BLAS_HOME/lib/libcblas.a"; then
-
-			ATLAS_NEEDED=`nm -u $BLAS_HOME/lib/libcblas.a | grep ATL`
-			if test -n "$ATLAS_NEEDED"; then
-				ATLAS_LIBS="-llapack -lcblas -latlas"	
-			else
-				ATLAS_LIBS="-lcblas -llapack"
-			fi		
-			if test "x$BLAS_HOME" = "x/usr" -o "x$BLAS_HOME" = "x/usr/local" ; then
- 				BLAS_LIBS=" ${ATLAS_LIBS}"
-			else
-				BLAS_LIBS="-L${BLAS_HOME}/lib ${ATLAS_LIBS}"
-			fi
-
-		elif test -r "$BLAS_HOME/libcblas.a"; then
-			ATLAS_NEEDED=`nm -u $BLAS_HOME/lib/libcblas.a | grep ATL`
-			if test -n "$ATLAS_NEEDED"; then
-				ATLAS_LIBS="-llapack -lcblas -latlas"
-			else
-				ATLAS_LIBS="-lcblas -llapack"	
-			fi		
-			BLAS_LIBS="-L${BLAS_HOME} ${ATLAS_LIBS}"
-		fi 
-	
-		CXXFLAGS="${BACKUP_CXXFLAGS} ${CBLAS_FLAG}" 
-		LIBS="${BACKUP_LIBS} ${BLAS_LIBS}" 
-
-		AC_TRY_LINK(
-		[#define __LINBOX_CONFIGURATION
-       		  #include "linbox/config-blas.h"],
-		[double a;],
-		[
-		AC_TRY_RUN(
-		[#define __LINBOX_CONFIGURATION
-     	         #include "linbox/config-blas.h"
-		 int main () {  double a[4] = {1.,2.,3.,4.}; double b[4]= {4.,3.,2.,1.}; double c[4]; 
-				cblas_dgemm(CblasRowMajor, CblasNoTrans,CblasNoTrans,2,2,2,1., a,2,b,2,0.,c,2);
-				if ( (c[0]!=8.) && (c[1]!=5.) && (c[2]!=20.) && (c[3]!=13))
-					return -1;
-				else
-					return 0;
-			      }
-		],[	
-		blas_found="yes"	
-		break
-		],[	
-		blas_problem="$problem $BLAS_HOME"	
-		unset BLAS_LIBS	
-		],[
-		blas_found="yes"
-		blas_cross="yes"
-		break
-		])	
-		],
-		[
- 		blas_found="no"
-		blas_checked="$checked $BLAS_HOME"
-		unset BLAS_LIBS
-		])
-	done
-fi
-
-if test "x$blas_found" = "xyes"; then
-	AC_SUBST(BLAS_LIBS)
-	AC_SUBST(CBLAS_FLAG)
-	AC_DEFINE(HAVE_BLAS,1,[Define if BLAS is installed])
-	AC_DEFINE(HAVE_CBLAS,1,[Define if C interface to BLAS is available])
-	AC_DEFINE(BLAS_AVAILABLE,,[Define if BLAS routines are available])
-	HAVE_BLAS=yes
-	if test "x$blas_cross" != "xyes"; then
-		AC_MSG_RESULT(found)
-	else
-		AC_MSG_RESULT(unknown)
-		echo "WARNING: You appear to be cross compiling, so there is no way to determine"
-		echo "whether your BLAS are good. I am assuming it is."
-	fi
-	ifelse([$2], , :, [$2])
-
-elif test -n "$blas_problem"; then
-	AC_MSG_RESULT(not working)
-	#echo "Sorry, your BLAS are not working. Disabling."
-elif test "x$blas_found" = "xno" ; then	
-	AC_MSG_RESULT(not found)
-fi	
-
-
-###
-### Check if other BLAS are available (only if C BLAS are not available)
-###
-if test "x$blas_found" != "xyes" ; then
-	AC_MSG_CHECKING(for others BLAS)
-	CBLAS="no"	 	
-	CBLAS_FLAG=""
-	if test -n "$BLAS_VAL"; then
-		if   test -d "$BLAS_VAL"; then
-			if test -r "${BLAS_VAL}/lib/libblas.a" ; then
-				BLAS_LIBS="-L${BLAS_VAL}/lib  -lblas" 
-			fi
-			if test -r "${BLAS_VAL}/libblas.a" ; then
-				BLAS_LIBS="-L${BLAS_VAL}  -lblas" 
-			fi
-		else
-			BLAS_LIBS=$BLAS_VAL
-		fi		
-		CXXFLAGS="${BACKUP_CXXFLAGS} ${CBLAS_FLAG}" 
-		LIBS="${BACKUP_LIBS} ${BLAS_LIBS}" 
-
-		AC_TRY_LINK(
-		[#define __LINBOX_CONFIGURATION
-       		 #include "linbox/config-blas.h"],
-		[double a;],
-		[
-		AC_TRY_RUN(
-		[#define __LINBOX_CONFIGURATION
-       		 #include "linbox/config-blas.h"
-		 int main () {  double a[4] = {1.,2.,3.,4.}; double b[4]= {4.,3.,2.,1.}; double c[4]; 
-				cblas_dgemm(CblasRowMajor, CblasNoTrans,CblasNoTrans,2,2,2,1., a,2,b,2,0.,c,2);
-				if ( (c[0]!=8.) && (c[1]!=5.) && (c[2]!=20.) && (c[3]!=13))
-					return -1;
-				else
-					return 0;
-			      }
-		],[	
-		blas_found="yes"	
-		break
-		],[	
-		blas_problem="$problem $BLAS_"	
-		unset BLAS_LIBS	
-		],[
-		blas_found="yes"
-		blas_cross="yes"
-		break
-		])	
-		],
-		[
-		blas_found="no"
-		blas_checked="$checked $BLAS_VAL"
-		unset BLAS_LIBS
-		])
-	else
-
-		## check in default path
-		for BLAS_HOME in ${DEFAULT_CHECKING_PATH} 
-		do
-			CBLAS="no"
-			CBLAS_FLAG=""
-
-			if test -r "$BLAS_HOME/lib64/libblas.a" && test -r "$BLAS_HOME/lib64/liblapack.a" ; then
-				BLAS_LIBS="-L${BLAS_HOME}/lib64 -llapack -lblas"
-			elif test -r "$BLAS_HOME/lib/libblas.a" && test -r "$BLAS_HOME/lib/liblapack.a" ; then
-				BLAS_LIBS="-L${BLAS_HOME}/lib -llapack -lblas"
-			elif test -r "$BLAS_HOME/lib/libblas.a"; then
-				if test "x$BLAS_HOME" = "x/usr" -o "x$BLAS_HOME" = "/usr/local" ; then
- 					BLAS_LIBS="-lblas"
-				else
-					BLAS_LIBS="-L${BLAS_HOME}/lib  -lblas"
-				fi
-			elif test -r "$BLAS_HOME/libblas.a"; then
-				BLAS_LIBS="-L${BLAS_HOME} -lblas"
-			fi 
-	
-			CXXFLAGS="${BACKUP_CXXFLAGS} ${CBLAS_FLAG}" 
-			LIBS="${BACKUP_LIBS} ${BLAS_LIBS}" 
-
-			AC_TRY_LINK(	
-			[#define __LINBOX_CONFIGURATION
-       		         #include "linbox/config-blas.h"],	
-			[double a;],
-			[
-			AC_TRY_RUN(
-			[#define __LINBOX_CONFIGURATION
-     		         #include "linbox/config-blas.h"
-			 int main () {  double a[4] = {1.,2.,3.,4.}; double b[4]= {4.,3.,2.,1.}; double c[4]; 
-					cblas_dgemm(CblasRowMajor, CblasNoTrans,CblasNoTrans,2,2,2,1., a,2,b,2,0.,c,2);
-					if ( (c[0]!=8.) && (c[1]!=5.) && (c[2]!=20.) && (c[3]!=13))
-						return -1;
-					else
-						return 0;
-				      }
-			],[	
-			blas_found="yes"	
-			break
-			],[	
-			blas_problem="$problem $BLAS_HOME"	
-			unset BLAS_LIBS	
-			],[
-			blas_found="yes"
-			blas_cross="yes"
-			break
-			])	
-			],
-			[
- 			blas_found="no"
-			blas_checked="$checked $BLAS_HOME"
-			unset BLAS_LIBS
-			])
-		done
-	fi
-
-
-	if test "x$blas_found" = "xyes"; then
-		AC_SUBST(BLAS_LIBS)
-		AC_SUBST(CBLAS_FLAG)	
-		AC_DEFINE(HAVE_BLAS,1,[Define if BLAS is installed])	
-		AC_DEFINE(BLAS_AVAILABLE,,[Define if BLAS routines are available])
-		HAVE_BLAS=yes
-		if test "x$blas_cross" != "xyes"; then
-			AC_MSG_RESULT(found)
-		else
-			AC_MSG_RESULT(unknown)
-			echo "WARNING: You appear to be cross compiling, so there is no way to determine"
-			echo "whether your BLAS are good. I am assuming it is."
-		fi
-		ifelse([$2], , :, [$2])
-	elif test -n "$blas_problem"; then
-		AC_MSG_RESULT(problem)
-		echo "Sorry, your BLAS are not working. Disabling."
-		ifelse([$3], , :, [$3])
-	elif test "x$blas_found" = "xno" ; then	
-		AC_MSG_RESULT(not found)
-		ifelse([$3], , :, [$3])
-	fi
-
-
-
-
-## Check for dgetrf (mainly for Goto less than 1.7)
-	AC_MSG_CHECKING(for dgetrf)
-	AC_TRY_RUN(
-	[#define __LINBOX_CONFIGURATION
-	 #define __LINBOX_HAVE_DGETRF 1
-       	 #include "linbox/config-blas.h"
-	 int main () {  double a[4] = {1.,2.,3.,4.};
-			int ipiv[2];
-			clapack_dgetrf(CblasRowMajor, 2, 2, a, 2, ipiv);
-			if ( (a[0]!=2.) && (a[1]!=0.5) && (a[2]!=4.) && (a[3]!=1.))
-				return -1;
-			else
-				return 0;
-		      }
-	],[	
-	dgetrf_found="yes"	
-	break
-	],[	
-	dgetrf_problem="$problem"	
-	],[
-	break
-	])	
-
-	if test "x$dgetrf_found" = "xyes"; then
-		AC_MSG_RESULT(found)
-		AC_DEFINE(HAVE_DGETRF,1,[Define if dgetrf is available])
-	else
-		AC_MSG_RESULT(disabling)
-		#AC_DEFINE(HAVE_DGETRF,0,[Define if dgetrf is available])	
-	fi
-	
-## Check for dtrtri (mainly for Goto less than 1.7)
-	AC_MSG_CHECKING(for dtrtri)
-	AC_TRY_RUN(
-	[#define __LINBOX_CONFIGURATION
-	 #define __LINBOX_HAVE_DTRTRI
-       	 #include "linbox/config-blas.h"
-	 int main () {  double a[4] = {1.,2.,3.,4.};
-			int ipiv[2];
-			clapack_dtrtri(CblasRowMajor,CblasUpper,CblasNonUnit,2, a, 2);
-			if ( (a[0]!=1.) && (a[1]!=-0.5) && (a[2]!=0.) && (a[3]!=0.25))
-				return -1;
-			else
-				return 0;
-		      }
-	],[	
-	dtrtri_found="yes"	
-	break
-	],[	
-	dtrtri_problem="$problem"	
-	],[
-	break
-	])	
-
-	if test "x$dtrtri_found" = "xyes"; then
-		AC_MSG_RESULT(found)
-		AC_DEFINE(HAVE_DTRTRI,1,[Define if dtrtri is available])
-	else
-		AC_MSG_RESULT(disabling)
-	fi
-
-
-## Check for dgetri (mainly for Goto less than 1.7)
-	AC_MSG_CHECKING(for dgetri)
-	AC_TRY_RUN(
-	[#define __LINBOX_CONFIGURATION
-	 #define __LINBOX_HAVE_DGETRF 1
-	 #define __LINBOX_HAVE_DGETRI 1
-       	 #include "linbox/config-blas.h"
-	 int main () {  double a[4] = {2.,0.5,4.,1.};
-			int ipiv[2] = {2,2};
-			clapack_dgetri(CblasRowMajor, 2, a, 2, ipiv);
-			if ( (a[0]!=-2.) && (a[1]!=1.) && (a[2]!=1.5) && (a[3]!=-0.5))
-				return -1;
-			else
-				return 0;
-		      }
-	],[	
-	dgetri_found="yes"	
-	break
-	],[	
-	dgetri_problem="autoimplement"	
-	],[
-	break
-	])
-
-	if test "x$dgetri_problem" = "xautoimplement"; then
-		if test "x$dtrtri_found" = "xyes"; then
-			AC_MSG_RESULT(no)
-			AC_MSG_CHECKING(for autoimplementation of dgetri)
-			AC_TRY_RUN(
-			[#define __LINBOX_CONFIGURATION
-		 	 #define __LINBOX_AUTOIMPLEMENT_DGETRI
-		 	 #define __LINBOX_HAVE_DGETRI 
-		 	 #define __LINBOX_HAVE_DTRTRI
-	 	 	 #include "linbox/config-blas.h"
-		 	 int main () {  double a[4] = {2.,0.5,4.,1.};
-					int ipiv[2] = {2,2};				
-					clapack_dgetri(CblasRowMajor, 2, a, 2, ipiv);
-					if ( (a[0]!=-2.) && (a[1]!=1.) && (a[2]!=1.5) && (a[3]!=-0.5))
-						return -1;
-					else
-						return 0;
-				      }
-			],[	
-			dgetri_found="yes"	
-			break
-			],[	
-			dgetri_problem="$problem"	
-			],[
-			break
-			])
-			if test "x$dgetri_found" = "xyes"; then
-				AC_MSG_RESULT(working)
-				AC_DEFINE(HAVE_DGETRI,1,[Define if dgetri is available])
-				AC_DEFINE(AUTOIMPLEMENT_DGETRI,,[Enable Autoimplementation of dgetri routine with dtrti and dtrsm])
-			else
-				AC_MSG_RESULT(disabling)
-				AC_DEFINE(HAVE_DGETRI,0,[Define if dgetri is available])
-			fi				
-		else	
-			AC_MSG_RESULT(disabling)
-			#AC_DEFINE(HAVE_DGETRI,0,[Define if dgetri is available])
-		fi
-	else
-		AC_MSG_RESULT(working)
-		AC_DEFINE(HAVE_DGETRI,1,[Define if dgetri is available])
-	fi	
-fi
-
-
-
-AM_CONDITIONAL(LINBOX_HAVE_BLAS, test "x$HAVE_BLAS" = "xyes")
-
-CXXFLAGS=${BACKUP_CXXFLAGS}
-LIBS=${BACKUP_LIBS}
-#unset LD_LIBRARY_PATH
-
-
-])
-
-
diff --git a/macros/config-header.m4 b/macros/config-header.m4
index 7e27e84..50ad739 100644
--- a/macros/config-header.m4
+++ b/macros/config-header.m4
@@ -1,3 +1,7 @@
+# Copyright (c) 2011 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+
 
 
 AC_DEFUN([AX_PREFIX_CONFIG_H],[AC_REQUIRE([AC_CONFIG_HEADER])
diff --git a/macros/debug.m4 b/macros/debug.m4
new file mode 100644
index 0000000..b115fb6
--- /dev/null
+++ b/macros/debug.m4
@@ -0,0 +1,91 @@
+# 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.
+
+dnl enable basic debug mode.
+AC_DEFUN([AC_DEBUG],
+[AC_MSG_CHECKING([whether to enable debugging options in the library])
+  AC_ARG_ENABLE(debug,
+[AC_HELP_STRING([--enable-debug], [enable debugging options in library])],
+      USE_DEBUG=$enableval,
+      USE_DEBUG=no)
+  AC_MSG_RESULT([$USE_DEBUG])
+  AM_CONDITIONAL(DEBUG, [test $USE_DEBUG = yes])
+  DBG=$USE_DEBUG
+  AC_SUBST(DBG)dnl
+]
+)
+
+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  )
+
+
+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])],
+      USE_WARNINGS=$enableval,
+      USE_WARNINGS=no)
+  AC_MSG_RESULT([$USE_WARNINGS])
+  AM_CONDITIONAL(WARNINGS, [test $USE_WARNINGS = yes])
+  WARN=$USE_WARNINGS
+  AC_SUBST(WARN)dnl
+]
+)
+
+AC_DEFUN([AC_COMPILER_NAME],
+[
+AC_MSG_CHECKING(for family name of compiler)
+AC_TRY_RUN(dnl ICC ?
+[   #ifdef __INTEL_COMPILER
+   int main() { return 0 ; }
+   #else
+   pas intel
+   #endif],dnl
+[dnl
+   AC_MSG_RESULT(icc)
+   CCNAM=icc
+   AC_SUBST(CCNAM)
+],dnl GCC ?
+[dnl
+   AC_TRY_RUN(dnl GCC ?
+[#ifdef __GNUC__
+   int main() { return 0 ; }
+   #else
+   pas gcc non plus.
+   #endif],[
+   AC_MSG_RESULT(gcc)
+   CCNAM=gcc
+   AC_SUBST(CCNAM)
+   ],[
+   AC_MSG_RESULT(unknown)
+   CCNAM=unknown
+   AC_SUBST(CCNAM)
+   ],[
+   AC_MSG_RESULT(unknown)
+   CCNAM=unknown
+   AC_SUBST(CCNAM)
+   ])
+],dnl GCC !
+[
+   AC_MSG_RESULT(unknown)
+   CCNAM=unknown
+   AC_SUBST(CCNAM)
+])
+])
+
diff --git a/macros/expat-check.m4 b/macros/expat-check.m4
index 880499c..1b035ae 100644
--- a/macros/expat-check.m4
+++ b/macros/expat-check.m4
@@ -1,4 +1,7 @@
 # Check for expat
+# Copyright (c) the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 # Rich Seagraves
 # stolen from Pascal Giorgi, 2001-12-10
 # Inspired by gnome-bonobo-check.m4 by Miguel de Icaza, 99-04-12
@@ -15,14 +18,14 @@ AC_DEFUN([LB_CHECK_EXPAT],
 [
 
 AC_ARG_WITH(expat,
-[  --with-expat=<path>|yes|no Use Expat library. If argument is no, you do not 
-                             have the library installed on your machine (set 
-			     as default). If argument is yes or <empty> that 
+[AC_ARG_WITH([--with-expat=<path>|yes|no], [Use Expat library. If argument is no, you do not
+                             have the library installed on your machine (set
+			     as default). If argument is yes or <empty> that
 			     means the library is reachable with the standard
-			     search path (/usr or /usr/local). Otherwise you 
+			     search path (/usr or /usr/local). Otherwise you
 			     give the <path> to the directory which contain the
-			     library. 
-	     ],
+			     library.
+	     ])],
 	     [if test "$withval" = yes ; then
 			EXPAT_HOME_PATH="${DEFAULT_CHECKING_PATH}"
 	      elif test "$withval" != no ; then
@@ -42,7 +45,7 @@ if test -n "$EXPAT_HOME_PATH"; then
 AC_MSG_CHECKING(for EXPAT >= $min_expat_version)
 fi
 
-for EXPAT_HOME in ${EXPAT_HOME_PATH} 
+for EXPAT_HOME in ${EXPAT_HOME_PATH}
  do
 if test -r "$EXPAT_HOME/include/expat.h"; then
 
@@ -51,10 +54,10 @@ if test -r "$EXPAT_HOME/include/expat.h"; then
 		EXPAT_LIBS="-L${EXPAT_HOME}/lib -lexpat"
 	else
 		EXPAT_CFLAGS=
-		EXPAT_LIBS="-lexpat"		
+		EXPAT_LIBS="-lexpat"
 	fi
-	
-	CXXFLAGS="${BACKUP_CXXFLAGS} ${EXPAT_CFLAGS} ${GMP_CFLAGS}" 
+
+	CXXFLAGS="${BACKUP_CXXFLAGS} ${EXPAT_CFLAGS} ${GMP_CFLAGS}"
 	LIBS="${BACKUP_LIBS} ${EXPAT_LIBS} ${GMP_LIBS}"
 	AC_TRY_LINK(
 	[#include <expat.h>],
@@ -64,17 +67,17 @@ if test -r "$EXPAT_HOME/include/expat.h"; then
 	[#include <expat.h>
 	 int main () {  if(XML_MAJOR_VERSION < 1  || (XML_MAJOR_VERSION == 1 && XML_MINOR_VERSION < 95)) return -1;  else return 0; }
 	],[
-	expat_found="yes"	
+	expat_found="yes"
 	break
-	],[	
-	expat_problem="$problem $EXPAT_HOME"	
+	],[
+	expat_problem="$problem $EXPAT_HOME"
 	unset EXPAT_CFLAGS
-	unset EXPAT_LIBS	
+	unset EXPAT_LIBS
 	],[
 	expat_found="yes"
 	expat_cross="yes"
 	break
-	])	
+	])
 	],
 	[
 	expat_found="no"
@@ -87,9 +90,9 @@ else
 fi
 done
 
-if test "x$expat_found" = "xyes" ; then		
+if test "x$expat_found" = "xyes" ; then
 	AC_SUBST(EXPAT_CFLAGS)
-	AC_SUBST(EXPAT_LIBS)	
+	AC_SUBST(EXPAT_LIBS)
 	AC_DEFINE(XMLENABLED,1,[Define if Expat is installed])
 	HAVE_EXPAT=yes
 	if test "x$expat_cross" != "xyes"; then
@@ -104,11 +107,11 @@ elif test -n "$expat_problem"; then
 	AC_MSG_RESULT(problem)
 	echo "Sorry, your EXPAT version is too old. Disabling."
 	ifelse([$3], , :, [$3])
-elif test "x$expat_found" = "xno" ; then	
+elif test "x$expat_found" = "xno" ; then
 	AC_MSG_RESULT(not found)
 	ifelse([$3], , :, [$3])
-fi	
-	
+fi
+
 AM_CONDITIONAL(LINBOX_HAVE_EXPAT, test "x$HAVE_EXPAT" = "xyes")
 
 CXXFLAGS=${BACKUP_CXXFLAGS}
diff --git a/macros/fflaflas-check.m4 b/macros/fflaflas-check.m4
new file mode 100644
index 0000000..ce859ee
--- /dev/null
+++ b/macros/fflaflas-check.m4
@@ -0,0 +1,115 @@
+# Check for Fflas-Ffpack
+# Copyright (c) the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+# Boyer Brice 19/04/11
+# Bradford Hovinen, 2001-06-13
+# Modified by Pascal Giorgi, 2003-12-03
+# Inspired by gnome-bonobo-check.m4 by Miguel de Icaza, 99-04-12
+# Stolen from Chris Lahey       99-2-5
+# stolen from Manish Singh again
+# stolen back from Frank Belew
+# stolen from Manish Singh
+# Shamelessly stolen from Owen Taylor
+
+dnl LB_CHECK_FFLAFLAS ([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl
+dnl Test for FFLAFLAS and define FFLAFLAS_CFLAGS and FFLAFLAS_LIBS
+
+AC_DEFUN([LB_CHECK_FFLAFLAS],
+[
+
+AC_ARG_WITH(fflas-ffpack,
+	[AC_HELP_STRING([--with-fflas-ffpack=<path>|yes], [Use Fflas-Ffpack library. This library is mandatory for
+		LinBox compilation. If argument is yes or <empty> or <bad> :)
+		that means the library is reachable with the standard
+		search path (/usr or /usr/local). Otherwise you give
+		the <path> to the directory which contains the
+		library.
+        Available at "http://linalg.org/projects/fflas-ffpack".
+	])],
+    [if test "$withval" = yes ; then
+        FFLAFLAS_HOME_PATH="${DEFAULT_CHECKING_PATH}"
+        elif test "$withval" != no ; then
+        FFLAFLAS_HOME_PATH="$withval ${DEFAULT_CHECKING_PATH}"
+        fi],
+    [FFLAFLAS_HOME_PATH="${DEFAULT_CHECKING_PATH}"])
+
+dnl  min_iml_version=ifelse([$1], ,1.0.3,$1)
+
+
+dnl Check for existence
+BACKUP_CXXFLAGS=${CXXFLAGS}
+BACKUP_LIBS=${LIBS}
+
+AC_MSG_CHECKING(for FFLAFLAS)
+
+for FFLAFLAS_HOME in ${FFLAFLAS_HOME_PATH}
+  do
+    if test -r "$FFLAFLAS_HOME/include/fflas-ffpack/fflas-ffpack.h"; then
+
+		BLAS_LIBS=`$FFLAFLAS_HOME/bin/fflasffpack-config --blas-libs`
+		dnl  BLAS_CFLAGS=`$FFLAFLAS_HOME/bin/fflasffpack-config --cflags`
+
+
+       if test "x$FFLAFLAS_HOME" != "x/usr" -a "x$FFLAFLAS_HOME" != "x/usr/local"; then
+           FFLAFLAS_CFLAGS="-I${FFLAFLAS_HOME}/include"
+       else
+           FFLAFLAS_CFLAGS=
+       fi
+
+       CXXFLAGS="${BACKUP_CXXFLAGS} ${FFLAFLAS_CFLAGS} ${BLAS_CFLAGS}"
+       LIBS="${BACKUP_LIBS} ${BLAS_LIBS}"
+
+       AC_TRY_LINK(
+       [#include "fflas-ffpack/fflas-ffpack.h"],
+       [FFLAS::FFLAS_TRANSPOSE a;],
+       [
+	   fflaflas_found="yes"
+	   FFLAFLAS_LOC="$FFLAFLAS_HOME"
+	   ],
+       [
+       fflaflas_found="no"
+       fflaflas_checked="$checked $FFLAFLAS_HOME"
+       unset FFLAFLAS_CFLAGS
+	   unset FFLAFLAS_LOC
+	   unset BLAS_LIBS
+       ])
+	   dnl  AC_MSG_RESULT(found in $fflaflas_checked ? $fflaflas_found)
+    else
+       fflasflas_found="no"
+	   dnl  AC_MSG_RESULT(not found at all $FFLAFLAS_HOME : $fflaflas_found)
+    fi
+done
+
+if test "x$fflaflas_found" = "xyes" ; then
+    AC_SUBST(FFLAFLAS_CFLAGS)
+    AC_SUBST(FFLAFLAS_LIBS)
+	AC_SUBST(FFLAFLAS_LOC)
+	AC_SUBST(BLAS_LIBS)
+    AC_DEFINE(HAVE_FFLAFLAS,1,[Define if FFLAFLAS is installed])
+    HAVE_FFLAFLAS=yes
+    if test "x$fflasflas_cross" != "xyes"; then
+        AC_MSG_RESULT(found)
+    else
+        AC_MSG_RESULT(unknown)
+        echo "WARNING: You appear to be cross compiling, so there is no way to determine"
+        echo "whether your FFLAFLAS version is new enough. I am assuming it is."
+    fi
+    ifelse([$2], , :, [$2])
+elif test -n "$fflasflas_problem"; then
+    AC_MSG_RESULT(problem)
+    echo "Sorry, your FFLAFLAS version is too old. Disabling."
+    ifelse([$3], , :, [$3])
+elif test "x$fflasflas_found" = "xno" ; then
+    AC_MSG_RESULT(not found)
+    ifelse([$3], , :, [$3])
+fi
+
+AM_CONDITIONAL(LINBOX_HAVE_FFLAFLAS, test "x$HAVE_FFLAFLAS" = "xyes")
+
+CXXFLAGS=${BACKUP_CXXFLAGS}
+LIBS=${BACKUP_LIBS}
+#unset LD_LIBRARY_PATH
+
+])
diff --git a/macros/givaro-check.m4 b/macros/givaro-check.m4
index 4ee2380..012b93c 100644
--- a/macros/givaro-check.m4
+++ b/macros/givaro-check.m4
@@ -1,4 +1,7 @@
 # Check for GIVARO
+# Copyright (c) the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 # Bradford Hovinen, 2001-06-13
 # Modified by Pascal Giorgi, 2003-12-03
 # Inspired by gnome-bonobo-check.m4 by Miguel de Icaza, 99-04-12
@@ -7,6 +10,7 @@
 # stolen back from Frank Belew
 # stolen from Manish Singh
 # Shamelessly stolen from Owen Taylor
+# This file is part of LinBox, see COPYING for licence information.
 
 dnl LB_CHECK_GIVARO ([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
 dnl
@@ -16,13 +20,13 @@ AC_DEFUN([LB_CHECK_GIVARO],
 [
 
 AC_ARG_WITH(givaro,
-[  --with-givaro=<path>|yes Use Givaro library. This library is mandatory for 
-                           LinBox compilation. If argument is yes or <empty> 
+[AC_HELP_STRING([--with-givaro=<path>|yes], [Use Givaro library. This library is mandatory for
+                           LinBox compilation. If argument is yes or <empty>
 			   that means the library is reachable with the standard
-			   search path (/usr or /usr/local). Otherwise you give 
-			   the <path> to the directory which contain the 
+			   search path (/usr or /usr/local). Otherwise you give
+			   the <path> to the directory which contains the
 			   library.
-],		  
+])],
 	     [if test "$withval" = yes ; then
 			GIVARO_HOME_PATH="${DEFAULT_CHECKING_PATH}"
 	      elif test "$withval" != no ; then
@@ -30,66 +34,72 @@ AC_ARG_WITH(givaro,
 	     fi],
 	     [GIVARO_HOME_PATH="${DEFAULT_CHECKING_PATH}"])
 
-min_givaro_version=ifelse([$1], ,3.2.10,$1)
+dnl -------------- dnl
+dnl GIVARO VERSION dnl
+dnl -------------- dnl
 
+version_min=30400
+min_givaro_version=ifelse([$1], ,3.4.0,$1)
+max_givaro_version=ifelse([$2], ,3.5.0,$2)
 
 dnl Check for existence
 
 BACKUP_CXXFLAGS=${CXXFLAGS}
 BACKUP_LIBS=${LIBS}
 
-AC_MSG_CHECKING(for GIVARO >= $min_givaro_version)
+AC_MSG_CHECKING(for GIVARO >= $min_givaro_version and < $max_givaro_version)
 
-for GIVARO_HOME in ${GIVARO_HOME_PATH} 
- do	
+for GIVARO_HOME in ${GIVARO_HOME_PATH}
+ do
 if test -r "$GIVARO_HOME/include/givaro/givconfig.h"; then
 
 	if test "x$GIVARO_HOME" != "x/usr" -a "x$GIVARO_HOME" != "x/usr/local"; then
 		GIVARO_CFLAGS="-I${GIVARO_HOME}/include"
-		GIVARO_LIBS="-L${GIVARO_HOME}/lib -lgivaro"
+		GIVARO_LIBS="-L${GIVARO_HOME}/lib -lgivaro ${GIVARO_HOME}/lib/libgivaro.so"
 	else
 		GIVARO_CFLAGS=
-		GIVARO_LIBS="-lgivaro"		
-	fi	
-	CXXFLAGS="${BACKUP_CXXFLAGS} ${GIVARO_CFLAGS} ${GMP_CFLAGS}" 
+		GIVARO_LIBS="-lgivaro"
+	fi
+	CXXFLAGS="${BACKUP_CXXFLAGS} ${GIVARO_CFLAGS} ${GMP_CFLAGS}"
 	LIBS="${BACKUP_LIBS} ${GIVARO_LIBS} ${GMP_LIBS}"
 
 	AC_TRY_LINK(
 	[#include <givaro/givinteger.h>],
-	[Integer a;],
+	[Givaro::Integer a;],
 	[
 	AC_TRY_RUN(
-	[#include <givaro/givconfig.h>	 
-	 int main () { if (GIVARO_VERSION < 3) return -1; else return 0; }
+	[#include <givaro/givconfig.h>
+	 int main () { if (GIVARO_VERSION < $version_min || GIVARO_VERSION >= (($version_min/100+1)*100) || GIVARO_VERSION>0x030000) return -1; else return 0; /* old version of Givaro are defined as hexa 0x03yyzz*/ }
 	],[
-	givaro_found="yes"	
+	givaro_found="yes"
 	break
-	],[	
-	givaro_problem="$problem $GIVARO_HOME"	
+	],[
+	givaro_problem="$problem $GIVARO_HOME"
 	unset GIVARO_CFLAGS
 	unset GIVARO_LIBS
 	],[
 	givaro_found="yes"
 	givaro_cross="yes"
-	
+
 	break
-	])	
+	])
 	],
 	[
 	givaro_found="no"
 	givaro_checked="$checked $GIVARO_HOME"
 	unset GIVARO_CFLAGS
 	unset GIVARO_LIBS
-	
+
 	])
 else
 	givaro_found="no"
-fi	
+fi
 done
 
-if test "x$givaro_found" = "xyes" ; then		
+if test "x$givaro_found" = "xyes" ; then
 	AC_SUBST(GIVARO_CFLAGS)
 	AC_SUBST(GIVARO_LIBS)
+	dnl  echo $GIVARO_CFLAGS $GIVARO_LIBS
 	AC_DEFINE(HAVE_GIVARO,1,[Define if GIVARO is installed])
 	HAVE_GIVARO=yes
 	if test "x$givaro_cross" != "xyes"; then
@@ -107,7 +117,7 @@ elif test -n "$givaro_problem"; then
 elif test "x$givaro_found" = "xno" ; then
 	AC_MSG_RESULT(not found)
 	ifelse([$3], , :, [$3])
-fi	
+fi
 
 AM_CONDITIONAL(LINBOX_HAVE_GIVARO, test "x$HAVE_GIVARO" = "xyes")
 
diff --git a/macros/gmp-check.m4 b/macros/gmp-check.m4
index 15219d3..a339124 100644
--- a/macros/gmp-check.m4
+++ b/macros/gmp-check.m4
@@ -1,4 +1,7 @@
 # Check for GMP
+# Copyright (c) the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 # Modified by Pascal Giorgi, 2003-12-03
 
 dnl LB_CHECK_GMP ([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
@@ -8,13 +11,13 @@ dnl Test for the GNU Multiprecision library and define GMP_CFLAGS and GMP_LIBS
 AC_DEFUN([LB_CHECK_GMP],
 [
 AC_ARG_WITH(gmp,
-[  --with-gmp= <path>|yes Use GMP library. This library is mandatory for LinBox
-	                 compilation. If argument is yes or <empty> that means 
+[AC_HELP_STRING([--with-gmp= <path>|yes], [Use GMP library. This library is mandatory for LinBox
+	                 compilation. If argument is yes or <empty> that means
    	       		 the library is reachable with the standard search path
 			 "/usr" or "/usr/local" (set as default). Otherwise you
-			 give the <path> to the directory which contain the 
+			 give the <path> to the directory which contain the
 			 library.
-],
+])],
 		[if test "$withval" = yes ; then
 			GMP_HOME_PATH="${DEFAULT_CHECKING_PATH}"
 	         elif test "$withval" != no ; then
@@ -30,18 +33,18 @@ BACKUP_LIBS=${LIBS}
 
 AC_MSG_CHECKING(for GMP >= $min_gmp_version)
 
-for GMP_HOME in ${GMP_HOME_PATH} 
-  do	
+for GMP_HOME in ${GMP_HOME_PATH}
+  do
 	if test -r "$GMP_HOME/include/gmp.h"; then
 
 		if test "x$GMP_HOME" != "x/usr" -a "x$GMP_HOME" != "x/usr/local"; then
 			GMP_CFLAGS="-I${GMP_HOME}/include"
-			GMP_LIBS="-L${GMP_HOME}/lib -lgmp"	
+			GMP_LIBS="-L${GMP_HOME}/lib -lgmpxx -lgmp"
 		else
 			GMP_CFLAGS=
-			GMP_LIBS="-lgmp"		
+			GMP_LIBS="-lgmpxx -lgmp"
 		fi
-	
+
 		CXXFLAGS="${CXXFLAGS} ${GMP_CFLAGS}"
 		LIBS="${LIBS} ${GMP_LIBS}"
 
@@ -73,20 +76,14 @@ for GMP_HOME in ${GMP_HOME_PATH}
 					],[
 						AC_MSG_RESULT(yes)
 						GMP_VERSION=""
-						GMP_LIBS="$GMP_LIBS -lgmpxx"
 						AC_SUBST(GMP_VERSION)
 					],[
-						gmp_found="no"	
+						gmp_found="no"
 						AC_MSG_RESULT(no)
-						AC_DEFINE(GMP_NO_CXX,1,[Define if GMP has no <gmpxx.h>])
-						unset GMP_CFLAGS
-						unset GMP_LIBS	
-						GMP_VERSION="-DGMP_NO_CXX"
-						AC_SUBST(GMP_VERSION)
 					],[
 						dnl This should never happen
 						AC_MSG_RESULT(no)
-					])				
+					])
 				],[
 					AC_MSG_RESULT(no)
 					AC_DEFINE(GMP_VERSION_3,1,[Define if GMP is version 3.xxx])
@@ -98,28 +95,28 @@ for GMP_HOME in ${GMP_HOME_PATH}
 				])
 				ifelse([$2], , :, [$2])
 				break
-			],[			
+			],[
 				gmp_problem="$gmp_problem $GMP_HOME"
 				unset GMP_CFLAGS
-				unset GMP_LIBS	
+				unset GMP_LIBS
 			],[
 				AC_MSG_RESULT(unknown)
 				echo "WARNING: You appear to be cross compiling, so there is no way to determine"
 				echo "whether your GMP version is new enough. I am assuming it is."
 				AC_SUBST(GMP_CFLAGS)
 				AC_SUBST(GMP_LIBS)
-				AC_DEFINE(HAVE_GMP,1,[Define if GMP is installed])	
+				AC_DEFINE(HAVE_GMP,1,[Define if GMP is installed])
 				ifelse([$2], , :, [$2])
 				break
-			])	
+			])
 		],[
-		gmp_found="no"	
+		gmp_found="no"
 		unset GMP_CFLAGS
-		unset GMP_LIBS	
+		unset GMP_LIBS
 		])
 
 	else
-		gmp_found="no"	
+		gmp_found="no"
 	fi
 done
 
diff --git a/macros/iml-check.m4 b/macros/iml-check.m4
new file mode 100644
index 0000000..a7853ab
--- /dev/null
+++ b/macros/iml-check.m4
@@ -0,0 +1,126 @@
+# Check for IML
+# Copyright (c) the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+# Boyer Brice 07/04/11
+# Bradford Hovinen, 2001-06-13
+# Modified by Pascal Giorgi, 2003-12-03
+# Inspired by gnome-bonobo-check.m4 by Miguel de Icaza, 99-04-12
+# Stolen from Chris Lahey       99-2-5
+# stolen from Manish Singh again
+# stolen back from Frank Belew
+# stolen from Manish Singh
+# Shamelessly stolen from Owen Taylor
+# This file is part of LinBox, see COPYING for licence information.
+
+dnl LB_CHECK_IML ([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl
+dnl Test for IML and define IML_CFLAGS and IML_LIBS
+
+AC_DEFUN([LB_CHECK_IML],
+[
+
+AC_ARG_WITH(iml,
+[AC_HELP_STRING([--with-iml=<path>|yes], [Use IML library. This library is (not yet) mandatory for
+    LinBox compilation. If argument is yes or <empty> or <bad> :)
+    that means the library is reachable with the standard
+    search path (/usr or /usr/local). Otherwise you give
+    the <path> to the directory which contains the
+    library.
+])],
+    [if test "$withval" = yes ; then
+        IML_HOME_PATH="${DEFAULT_CHECKING_PATH}"
+        elif test "$withval" != no ; then
+        IML_HOME_PATH="$withval ${DEFAULT_CHECKING_PATH}"
+        fi],
+    [IML_HOME_PATH="${DEFAULT_CHECKING_PATH}"])
+
+dnl  min_iml_version=ifelse([$1], ,1.0.3,$1)
+
+
+dnl Check for existence
+BACKUP_CXXFLAGS=${CXXFLAGS}
+BACKUP_LIBS=${LIBS}
+
+AC_MSG_CHECKING(for IML)
+
+for IML_HOME in ${IML_HOME_PATH}
+  do
+    if test -r "$IML_HOME/include/iml.h"; then
+
+       if test "x$IML_HOME" != "x/usr" -a "x$IML_HOME" != "x/usr/local"; then
+           IML_CFLAGS="-I${IML_HOME}/include"
+           IML_LIBS="-L${IML_HOME}/lib -liml"
+       else
+           IML_CFLAGS=
+           IML_LIBS="-liml"
+       fi
+
+       CXXFLAGS="${BACKUP_CXXFLAGS} ${IML_CFLAGS} ${GMP_CFLAGS}"
+       LIBS="${BACKUP_LIBS} ${IML_LIBS} ${GMP_LIBS}"
+
+       AC_TRY_LINK(
+       [#include <gmp.h>
+	   extern "C" {
+	   #include <iml.h>
+	   }],
+       [Double a;],
+       [
+	   AC_TRY_RUN(
+	   [
+	   int main () { return 0; /* not possible to check version */ }
+	   ],[
+	   iml_found="yes"
+	   break
+	   ],[
+	   iml_problem="$problem $IML_HOME"
+	   unset IML_CFLAGS
+	   unset IML_LIBS
+	   ],[
+	   iml_found="yes"
+	   iml_cross="yes"
+	   break
+	   ])
+	   ],
+       [
+       iml_found="no"
+       iml_checked="$checked $IML_HOME"
+       unset IML_CFLAGS
+       unset IML_LIBS
+       ])
+	   dnl  AC_MSG_RESULT(found in $iml_checked ? $iml_found)
+    else
+       iml_found="no"
+	   dnl  AC_MSG_RESULT(not found at all $IML_HOME : $iml_found)
+    fi
+done
+
+if test "x$iml_found" = "xyes" ; then
+    AC_SUBST(IML_CFLAGS)
+    AC_SUBST(IML_LIBS)
+    AC_DEFINE(HAVE_IML,1,[Define if IML is installed])
+    HAVE_IML=yes
+    if test "x$iml_cross" != "xyes"; then
+        AC_MSG_RESULT(found)
+    else
+        AC_MSG_RESULT(unknown)
+        echo "WARNING: You appear to be cross compiling, so there is no way to determine"
+        echo "whether your IML version is new enough. I am assuming it is."
+    fi
+    ifelse([$2], , :, [$2])
+elif test -n "$iml_problem"; then
+    AC_MSG_RESULT(problem)
+    echo "Sorry, your IML version is too old. Disabling."
+    ifelse([$3], , :, [$3])
+elif test "x$iml_found" = "xno" ; then
+    AC_MSG_RESULT(not found)
+    ifelse([$3], , :, [$3])
+fi
+
+AM_CONDITIONAL(LINBOX_HAVE_IML, test "x$HAVE_IML" = "xyes")
+
+CXXFLAGS=${BACKUP_CXXFLAGS}
+LIBS=${BACKUP_LIBS}
+#unset LD_LIBRARY_PATH
+
+])
diff --git a/macros/libtool.m4 b/macros/libtool.m4
new file mode 100644
index 0000000..8ff3c76
--- /dev/null
+++ b/macros/libtool.m4
@@ -0,0 +1,7851 @@
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+#
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
+#                 Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+# 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.
+
+m4_define([_LT_COPYING], [dnl
+#   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+#                 2006, 2007, 2008, 2009, 2010 Free Software Foundation,
+#                 Inc.
+#   Written by Gordon Matzigkeit, 1996
+#
+#   This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING.  If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+])
+
+# serial 57 LT_INIT
+
+
+# LT_PREREQ(VERSION)
+# ------------------
+# Complain and exit if this libtool version is less that VERSION.
+m4_defun([LT_PREREQ],
+[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
+       [m4_default([$3],
+		   [m4_fatal([Libtool version $1 or higher is required],
+		             63)])],
+       [$2])])
+
+
+# _LT_CHECK_BUILDDIR
+# ------------------
+# Complain if the absolute build directory name contains unusual characters
+m4_defun([_LT_CHECK_BUILDDIR],
+[case `pwd` in
+  *\ * | *\	*)
+    AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
+esac
+])
+
+
+# LT_INIT([OPTIONS])
+# ------------------
+AC_DEFUN([LT_INIT],
+[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
+AC_BEFORE([$0], [LT_LANG])dnl
+AC_BEFORE([$0], [LT_OUTPUT])dnl
+AC_BEFORE([$0], [LTDL_INIT])dnl
+m4_require([_LT_CHECK_BUILDDIR])dnl
+
+dnl Autoconf doesn't catch unexpanded LT_ macros by default:
+m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
+m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
+dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
+dnl unless we require an AC_DEFUNed macro:
+AC_REQUIRE([LTOPTIONS_VERSION])dnl
+AC_REQUIRE([LTSUGAR_VERSION])dnl
+AC_REQUIRE([LTVERSION_VERSION])dnl
+AC_REQUIRE([LTOBSOLETE_VERSION])dnl
+m4_require([_LT_PROG_LTMAIN])dnl
+
+_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
+
+dnl Parse OPTIONS
+_LT_SET_OPTIONS([$0], [$1])
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+_LT_SETUP
+
+# Only expand once:
+m4_define([LT_INIT])
+])# LT_INIT
+
+# Old names:
+AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
+AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
+dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
+m4_defun([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+  case $cc_temp in
+    compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+    distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+])
+
+
+# _LT_FILEUTILS_DEFAULTS
+# ----------------------
+# It is okay to use these file commands and assume they have been set
+# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
+m4_defun([_LT_FILEUTILS_DEFAULTS],
+[: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+])# _LT_FILEUTILS_DEFAULTS
+
+
+# _LT_SETUP
+# ---------
+m4_defun([_LT_SETUP],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
+
+_LT_DECL([], [host_alias], [0], [The host system])dnl
+_LT_DECL([], [host], [0])dnl
+_LT_DECL([], [host_os], [0])dnl
+dnl
+_LT_DECL([], [build_alias], [0], [The build system])dnl
+_LT_DECL([], [build], [0])dnl
+_LT_DECL([], [build_os], [0])dnl
+dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+test -z "$LN_S" && LN_S="ln -s"
+_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
+dnl
+AC_REQUIRE([LT_CMD_MAX_LEN])dnl
+_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
+_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
+dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
+m4_require([_LT_CMD_RELOAD])dnl
+m4_require([_LT_CHECK_MAGIC_METHOD])dnl
+m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
+m4_require([_LT_CMD_OLD_ARCHIVE])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_WITH_SYSROOT])dnl
+
+_LT_CONFIG_LIBTOOL_INIT([
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+])
+if test -n "${ZSH_VERSION+set}" ; then
+   setopt NO_GLOB_SUBST
+fi
+
+_LT_CHECK_OBJDIR
+
+m4_require([_LT_TAG_COMPILER])dnl
+
+case $host_os in
+aix3*)
+  # AIX sometimes has problems with the GCC collect2 program.  For some
+  # reason, if we set the COLLECT_NAMES environment variable, the problems
+  # vanish in a puff of smoke.
+  if test "X${COLLECT_NAMES+set}" != Xset; then
+    COLLECT_NAMES=
+    export COLLECT_NAMES
+  fi
+  ;;
+esac
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+  if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+    _LT_PATH_MAGIC
+  fi
+  ;;
+esac
+
+# Use C for the default configuration in the libtool script
+LT_SUPPORTED_TAG([CC])
+_LT_LANG_C_CONFIG
+_LT_LANG_DEFAULT_CONFIG
+_LT_CONFIG_COMMANDS
+])# _LT_SETUP
+
+
+# _LT_PREPARE_SED_QUOTE_VARS
+# --------------------------
+# Define a few sed substitution that help us do robust quoting.
+m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
+[# Backslashify metacharacters that are still active within
+# double-quoted strings.
+sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([["`\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+])
+
+# _LT_PROG_LTMAIN
+# ---------------
+# Note that this code is called both from `configure', and `config.status'
+# now that we use AC_CONFIG_COMMANDS to generate libtool.  Notably,
+# `config.status' has no value for ac_aux_dir unless we are using Automake,
+# so we pass a copy along to make sure it has a sensible value anyway.
+m4_defun([_LT_PROG_LTMAIN],
+[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
+_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
+ltmain="$ac_aux_dir/ltmain.sh"
+])# _LT_PROG_LTMAIN
+
+
+## ------------------------------------- ##
+## Accumulate code for creating libtool. ##
+## ------------------------------------- ##
+
+# So that we can recreate a full libtool script including additional
+# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
+# in macros and then make a single call at the end using the `libtool'
+# label.
+
+
+# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
+# ----------------------------------------
+# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL_INIT],
+[m4_ifval([$1],
+          [m4_append([_LT_OUTPUT_LIBTOOL_INIT],
+                     [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_INIT])
+
+
+# _LT_CONFIG_LIBTOOL([COMMANDS])
+# ------------------------------
+# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL],
+[m4_ifval([$1],
+          [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
+                     [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
+
+
+# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
+# -----------------------------------------------------
+m4_defun([_LT_CONFIG_SAVE_COMMANDS],
+[_LT_CONFIG_LIBTOOL([$1])
+_LT_CONFIG_LIBTOOL_INIT([$2])
+])
+
+
+# _LT_FORMAT_COMMENT([COMMENT])
+# -----------------------------
+# Add leading comment marks to the start of each line, and a trailing
+# full-stop to the whole comment if one is not present already.
+m4_define([_LT_FORMAT_COMMENT],
+[m4_ifval([$1], [
+m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
+              [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
+)])
+
+
+
+## ------------------------ ##
+## FIXME: Eliminate VARNAME ##
+## ------------------------ ##
+
+
+# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
+# -------------------------------------------------------------------
+# CONFIGNAME is the name given to the value in the libtool script.
+# VARNAME is the (base) name used in the configure script.
+# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
+# VARNAME.  Any other value will be used directly.
+m4_define([_LT_DECL],
+[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
+    [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
+	[m4_ifval([$1], [$1], [$2])])
+    lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
+    m4_ifval([$4],
+	[lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
+    lt_dict_add_subkey([lt_decl_dict], [$2],
+	[tagged?], [m4_ifval([$5], [yes], [no])])])
+])
+
+
+# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
+# --------------------------------------------------------
+m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
+
+
+# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_tag_varnames],
+[_lt_decl_filter([tagged?], [yes], $@)])
+
+
+# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
+# ---------------------------------------------------------
+m4_define([_lt_decl_filter],
+[m4_case([$#],
+  [0], [m4_fatal([$0: too few arguments: $#])],
+  [1], [m4_fatal([$0: too few arguments: $#: $1])],
+  [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
+  [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
+  [lt_dict_filter([lt_decl_dict], $@)])[]dnl
+])
+
+
+# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
+# --------------------------------------------------
+m4_define([lt_decl_quote_varnames],
+[_lt_decl_filter([value], [1], $@)])
+
+
+# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_dquote_varnames],
+[_lt_decl_filter([value], [2], $@)])
+
+
+# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_varnames_tagged],
+[m4_assert([$# <= 2])dnl
+_$0(m4_quote(m4_default([$1], [[, ]])),
+    m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
+    m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
+m4_define([_lt_decl_varnames_tagged],
+[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
+
+
+# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_all_varnames],
+[_$0(m4_quote(m4_default([$1], [[, ]])),
+     m4_if([$2], [],
+	   m4_quote(lt_decl_varnames),
+	m4_quote(m4_shift($@))))[]dnl
+])
+m4_define([_lt_decl_all_varnames],
+[lt_join($@, lt_decl_varnames_tagged([$1],
+			lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
+])
+
+
+# _LT_CONFIG_STATUS_DECLARE([VARNAME])
+# ------------------------------------
+# Quote a variable value, and forward it to `config.status' so that its
+# declaration there will have the same value as in `configure'.  VARNAME
+# must have a single quote delimited value for this to work.
+m4_define([_LT_CONFIG_STATUS_DECLARE],
+[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
+
+
+# _LT_CONFIG_STATUS_DECLARATIONS
+# ------------------------------
+# We delimit libtool config variables with single quotes, so when
+# we write them to config.status, we have to be sure to quote all
+# embedded single quotes properly.  In configure, this macro expands
+# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
+#
+#    <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`'
+m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
+    [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAGS
+# ----------------
+# Output comment and list of tags supported by the script
+m4_defun([_LT_LIBTOOL_TAGS],
+[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
+available_tags="_LT_TAGS"dnl
+])
+
+
+# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
+# -----------------------------------
+# Extract the dictionary values for VARNAME (optionally with TAG) and
+# expand to a commented shell variable setting:
+#
+#    # Some comment about what VAR is for.
+#    visible_name=$lt_internal_name
+m4_define([_LT_LIBTOOL_DECLARE],
+[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
+					   [description])))[]dnl
+m4_pushdef([_libtool_name],
+    m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
+m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
+    [0], [_libtool_name=[$]$1],
+    [1], [_libtool_name=$lt_[]$1],
+    [2], [_libtool_name=$lt_[]$1],
+    [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
+m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
+])
+
+
+# _LT_LIBTOOL_CONFIG_VARS
+# -----------------------
+# Produce commented declarations of non-tagged libtool config variables
+# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
+# script.  Tagged libtool config variables (even for the LIBTOOL CONFIG
+# section) are produced by _LT_LIBTOOL_TAG_VARS.
+m4_defun([_LT_LIBTOOL_CONFIG_VARS],
+[m4_foreach([_lt_var],
+    m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
+    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAG_VARS(TAG)
+# -------------------------
+m4_define([_LT_LIBTOOL_TAG_VARS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
+    [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
+
+
+# _LT_TAGVAR(VARNAME, [TAGNAME])
+# ------------------------------
+m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
+
+
+# _LT_CONFIG_COMMANDS
+# -------------------
+# Send accumulated output to $CONFIG_STATUS.  Thanks to the lists of
+# variables for single and double quote escaping we saved from calls
+# to _LT_DECL, we can put quote escaped variables declarations
+# into `config.status', and then the shell code to quote escape them in
+# for loops in `config.status'.  Finally, any additional code accumulated
+# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
+m4_defun([_LT_CONFIG_COMMANDS],
+[AC_PROVIDE_IFELSE([LT_OUTPUT],
+	dnl If the libtool generation code has been placed in $CONFIG_LT,
+	dnl instead of duplicating it all over again into config.status,
+	dnl then we will have config.status run $CONFIG_LT later, so it
+	dnl needs to know what name is stored there:
+        [AC_CONFIG_COMMANDS([libtool],
+            [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
+    dnl If the libtool generation code is destined for config.status,
+    dnl expand the accumulated commands and init code now:
+    [AC_CONFIG_COMMANDS([libtool],
+        [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
+])#_LT_CONFIG_COMMANDS
+
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
+[
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+_LT_CONFIG_STATUS_DECLARATIONS
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# A function that is used when there is no print builtin or printf.
+func_fallback_echo ()
+{
+  eval 'cat <<_LTECHO_EOF
+\$[]1
+_LTECHO_EOF'
+}
+
+# Quote evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_quote_varnames); do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[[\\\\\\\`\\"\\\$]]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+# Double-quote double-evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_dquote_varnames); do
+    case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
+    *[[\\\\\\\`\\"\\\$]]*)
+      eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+      ;;
+    *)
+      eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+      ;;
+    esac
+done
+
+_LT_OUTPUT_LIBTOOL_INIT
+])
+
+# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
+# ------------------------------------
+# Generate a child script FILE with all initialization necessary to
+# reuse the environment learned by the parent script, and make the
+# file executable.  If COMMENT is supplied, it is inserted after the
+# `#!' sequence but before initialization text begins.  After this
+# macro, additional text can be appended to FILE to form the body of
+# the child script.  The macro ends with non-zero status if the
+# file could not be fully written (such as if the disk is full).
+m4_ifdef([AS_INIT_GENERATED],
+[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
+[m4_defun([_LT_GENERATED_FILE_INIT],
+[m4_require([AS_PREPARE])]dnl
+[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
+[lt_write_fail=0
+cat >$1 <<_ASEOF || lt_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+$2
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$1 <<\_ASEOF || lt_write_fail=1
+AS_SHELL_SANITIZE
+_AS_PREPARE
+exec AS_MESSAGE_FD>&1
+_ASEOF
+test $lt_write_fail = 0 && chmod +x $1[]dnl
+m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
+
+# LT_OUTPUT
+# ---------
+# This macro allows early generation of the libtool script (before
+# AC_OUTPUT is called), incase it is used in configure for compilation
+# tests.
+AC_DEFUN([LT_OUTPUT],
+[: ${CONFIG_LT=./config.lt}
+AC_MSG_NOTICE([creating $CONFIG_LT])
+_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
+[# Run this file to recreate a libtool stub with the current configuration.])
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+lt_cl_silent=false
+exec AS_MESSAGE_LOG_FD>>config.log
+{
+  echo
+  AS_BOX([Running $as_me.])
+} >&AS_MESSAGE_LOG_FD
+
+lt_cl_help="\
+\`$as_me' creates a local libtool stub from the current configuration,
+for use in further configure time tests before the real libtool is
+generated.
+
+Usage: $[0] [[OPTIONS]]
+
+  -h, --help      print this help, then exit
+  -V, --version   print version number, then exit
+  -q, --quiet     do not print progress messages
+  -d, --debug     don't remove temporary files
+
+Report bugs to <bug-libtool at gnu.org>."
+
+lt_cl_version="\
+m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
+m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
+configured by $[0], generated by m4_PACKAGE_STRING.
+
+Copyright (C) 2010 Free Software Foundation, Inc.
+This config.lt script is free software; the Free Software Foundation
+gives unlimited permision to copy, distribute and modify it."
+
+while test $[#] != 0
+do
+  case $[1] in
+    --version | --v* | -V )
+      echo "$lt_cl_version"; exit 0 ;;
+    --help | --h* | -h )
+      echo "$lt_cl_help"; exit 0 ;;
+    --debug | --d* | -d )
+      debug=: ;;
+    --quiet | --q* | --silent | --s* | -q )
+      lt_cl_silent=: ;;
+
+    -*) AC_MSG_ERROR([unrecognized option: $[1]
+Try \`$[0] --help' for more information.]) ;;
+
+    *) AC_MSG_ERROR([unrecognized argument: $[1]
+Try \`$[0] --help' for more information.]) ;;
+  esac
+  shift
+done
+
+if $lt_cl_silent; then
+  exec AS_MESSAGE_FD>/dev/null
+fi
+_LTEOF
+
+cat >>"$CONFIG_LT" <<_LTEOF
+_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AC_MSG_NOTICE([creating $ofile])
+_LT_OUTPUT_LIBTOOL_COMMANDS
+AS_EXIT(0)
+_LTEOF
+chmod +x "$CONFIG_LT"
+
+# configure is writing to config.log, but config.lt does its own redirection,
+# appending to config.log, which fails on DOS, as config.log is still kept
+# open by configure.  Here we exec the FD to /dev/null, effectively closing
+# config.log, so it can be properly (re)opened and appended to by config.lt.
+lt_cl_success=:
+test "$silent" = yes &&
+  lt_config_lt_args="$lt_config_lt_args --quiet"
+exec AS_MESSAGE_LOG_FD>/dev/null
+$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+exec AS_MESSAGE_LOG_FD>>config.log
+$lt_cl_success || AS_EXIT(1)
+])# LT_OUTPUT
+
+
+# _LT_CONFIG(TAG)
+# ---------------
+# If TAG is the built-in tag, create an initial libtool script with a
+# default configuration from the untagged config vars.  Otherwise add code
+# to config.status for appending the configuration named by TAG from the
+# matching tagged config vars.
+m4_defun([_LT_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_CONFIG_SAVE_COMMANDS([
+  m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
+  m4_if(_LT_TAG, [C], [
+    # See if we are running on zsh, and set the options which allow our
+    # commands through without removal of \ escapes.
+    if test -n "${ZSH_VERSION+set}" ; then
+      setopt NO_GLOB_SUBST
+    fi
+
+    cfgfile="${ofile}T"
+    trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+    $RM "$cfgfile"
+
+    cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+_LT_COPYING
+_LT_LIBTOOL_TAGS
+
+# ### BEGIN LIBTOOL CONFIG
+_LT_LIBTOOL_CONFIG_VARS
+_LT_LIBTOOL_TAG_VARS
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+  case $host_os in
+  aix3*)
+    cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program.  For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+  COLLECT_NAMES=
+  export COLLECT_NAMES
+fi
+_LT_EOF
+    ;;
+  esac
+
+  _LT_PROG_LTMAIN
+
+  # We use sed instead of cat because bash on DJGPP gets confused if
+  # if finds mixed CR/LF and LF-only lines.  Since sed operates in
+  # text mode, it properly converts lines to CR/LF.  This bash problem
+  # is reportedly fixed, but why not run on old versions too?
+  sed '$q' "$ltmain" >> "$cfgfile" \
+     || (rm -f "$cfgfile"; exit 1)
+
+  _LT_PROG_REPLACE_SHELLFNS
+
+   mv -f "$cfgfile" "$ofile" ||
+    (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+  chmod +x "$ofile"
+],
+[cat <<_LT_EOF >> "$ofile"
+
+dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
+dnl in a comment (ie after a #).
+# ### BEGIN LIBTOOL TAG CONFIG: $1
+_LT_LIBTOOL_TAG_VARS(_LT_TAG)
+# ### END LIBTOOL TAG CONFIG: $1
+_LT_EOF
+])dnl /m4_if
+],
+[m4_if([$1], [], [
+    PACKAGE='$PACKAGE'
+    VERSION='$VERSION'
+    TIMESTAMP='$TIMESTAMP'
+    RM='$RM'
+    ofile='$ofile'], [])
+])dnl /_LT_CONFIG_SAVE_COMMANDS
+])# _LT_CONFIG
+
+
+# LT_SUPPORTED_TAG(TAG)
+# ---------------------
+# Trace this macro to discover what tags are supported by the libtool
+# --tag option, using:
+#    autoconf --trace 'LT_SUPPORTED_TAG:$1'
+AC_DEFUN([LT_SUPPORTED_TAG], [])
+
+
+# C support is built-in for now
+m4_define([_LT_LANG_C_enabled], [])
+m4_define([_LT_TAGS], [])
+
+
+# LT_LANG(LANG)
+# -------------
+# Enable libtool support for the given language if not already enabled.
+AC_DEFUN([LT_LANG],
+[AC_BEFORE([$0], [LT_OUTPUT])dnl
+m4_case([$1],
+  [C],			[_LT_LANG(C)],
+  [C++],		[_LT_LANG(CXX)],
+  [Java],		[_LT_LANG(GCJ)],
+  [Fortran 77],		[_LT_LANG(F77)],
+  [Fortran],		[_LT_LANG(FC)],
+  [Windows Resource],	[_LT_LANG(RC)],
+  [m4_ifdef([_LT_LANG_]$1[_CONFIG],
+    [_LT_LANG($1)],
+    [m4_fatal([$0: unsupported language: "$1"])])])dnl
+])# LT_LANG
+
+
+# _LT_LANG(LANGNAME)
+# ------------------
+m4_defun([_LT_LANG],
+[m4_ifdef([_LT_LANG_]$1[_enabled], [],
+  [LT_SUPPORTED_TAG([$1])dnl
+  m4_append([_LT_TAGS], [$1 ])dnl
+  m4_define([_LT_LANG_]$1[_enabled], [])dnl
+  _LT_LANG_$1_CONFIG($1)])dnl
+])# _LT_LANG
+
+
+# _LT_LANG_DEFAULT_CONFIG
+# -----------------------
+m4_defun([_LT_LANG_DEFAULT_CONFIG],
+[AC_PROVIDE_IFELSE([AC_PROG_CXX],
+  [LT_LANG(CXX)],
+  [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_F77],
+  [LT_LANG(F77)],
+  [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_FC],
+  [LT_LANG(FC)],
+  [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
+
+dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
+dnl pulling things in needlessly.
+AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+  [LT_LANG(GCJ)],
+  [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+    [LT_LANG(GCJ)],
+    [AC_PROVIDE_IFELSE([LT_PROG_GCJ],
+      [LT_LANG(GCJ)],
+      [m4_ifdef([AC_PROG_GCJ],
+	[m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
+       m4_ifdef([A][M_PROG_GCJ],
+	[m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
+       m4_ifdef([LT_PROG_GCJ],
+	[m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
+
+AC_PROVIDE_IFELSE([LT_PROG_RC],
+  [LT_LANG(RC)],
+  [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
+])# _LT_LANG_DEFAULT_CONFIG
+
+# Obsolete macros:
+AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
+AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
+AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
+AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
+AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
+dnl AC_DEFUN([AC_LIBTOOL_F77], [])
+dnl AC_DEFUN([AC_LIBTOOL_FC], [])
+dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
+dnl AC_DEFUN([AC_LIBTOOL_RC], [])
+
+
+# _LT_TAG_COMPILER
+# ----------------
+m4_defun([_LT_TAG_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
+_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
+_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
+_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_TAG_COMPILER
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+m4_defun([_LT_COMPILER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+m4_defun([_LT_LINKER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+])# _LT_LINKER_BOILERPLATE
+
+# _LT_REQUIRED_DARWIN_CHECKS
+# -------------------------
+m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
+  case $host_os in
+    rhapsody* | darwin*)
+    AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
+    AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
+    AC_CHECK_TOOL([LIPO], [lipo], [:])
+    AC_CHECK_TOOL([OTOOL], [otool], [:])
+    AC_CHECK_TOOL([OTOOL64], [otool64], [:])
+    _LT_DECL([], [DSYMUTIL], [1],
+      [Tool to manipulate archived DWARF debug symbol files on Mac OS X])
+    _LT_DECL([], [NMEDIT], [1],
+      [Tool to change global to local symbols on Mac OS X])
+    _LT_DECL([], [LIPO], [1],
+      [Tool to manipulate fat objects and archives on Mac OS X])
+    _LT_DECL([], [OTOOL], [1],
+      [ldd/readelf like tool for Mach-O binaries on Mac OS X])
+    _LT_DECL([], [OTOOL64], [1],
+      [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
+
+    AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
+      [lt_cv_apple_cc_single_mod=no
+      if test -z "${LT_MULTI_MODULE}"; then
+	# By default we will add the -single_module flag. You can override
+	# by either setting the environment variable LT_MULTI_MODULE
+	# non-empty at configure time, or by adding -multi_module to the
+	# link flags.
+	rm -rf libconftest.dylib*
+	echo "int foo(void){return 1;}" > conftest.c
+	echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
+	$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+	  -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+        _lt_result=$?
+	if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+	  lt_cv_apple_cc_single_mod=yes
+	else
+	  cat conftest.err >&AS_MESSAGE_LOG_FD
+	fi
+	rm -rf libconftest.dylib*
+	rm -f conftest.*
+      fi])
+    AC_CACHE_CHECK([for -exported_symbols_list linker flag],
+      [lt_cv_ld_exported_symbols_list],
+      [lt_cv_ld_exported_symbols_list=no
+      save_LDFLAGS=$LDFLAGS
+      echo "_main" > conftest.sym
+      LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+	[lt_cv_ld_exported_symbols_list=yes],
+	[lt_cv_ld_exported_symbols_list=no])
+	LDFLAGS="$save_LDFLAGS"
+    ])
+    AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
+      [lt_cv_ld_force_load=no
+      cat > conftest.c << _LT_EOF
+int forced_loaded() { return 2;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
+      $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
+      echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
+      $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
+      echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
+      $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
+      cat > conftest.c << _LT_EOF
+int main() { return 0;}
+_LT_EOF
+      echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
+      $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
+      _lt_result=$?
+      if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then
+	lt_cv_ld_force_load=yes
+      else
+	cat conftest.err >&AS_MESSAGE_LOG_FD
+      fi
+        rm -f conftest.err libconftest.a conftest conftest.c
+        rm -rf conftest.dSYM
+    ])
+    case $host_os in
+    rhapsody* | darwin1.[[012]])
+      _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+    darwin1.*)
+      _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+    darwin*) # darwin 5.x on
+      # if running on 10.5 or later, the deployment target defaults
+      # to the OS version, if on x86, and 10.4, the deployment
+      # target defaults to 10.4. Don't you love it?
+      case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+	10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+	10.[[012]]*)
+	  _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+	10.*)
+	  _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+      esac
+    ;;
+  esac
+    if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+      _lt_dar_single_mod='$single_module'
+    fi
+    if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+      _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+    else
+      _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+    fi
+    if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
+      _lt_dsymutil='~$DSYMUTIL $lib || :'
+    else
+      _lt_dsymutil=
+    fi
+    ;;
+  esac
+])
+
+
+# _LT_DARWIN_LINKER_FEATURES
+# --------------------------
+# Checks for linker and compiler features on darwin
+m4_defun([_LT_DARWIN_LINKER_FEATURES],
+[
+  m4_require([_LT_REQUIRED_DARWIN_CHECKS])
+  _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+  _LT_TAGVAR(hardcode_direct, $1)=no
+  _LT_TAGVAR(hardcode_automatic, $1)=yes
+  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  if test "$lt_cv_ld_force_load" = "yes"; then
+    _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
+  else
+    _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+  fi
+  _LT_TAGVAR(link_all_deplibs, $1)=yes
+  _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
+  case $cc_basename in
+     ifort*) _lt_dar_can_shared=yes ;;
+     *) _lt_dar_can_shared=$GCC ;;
+  esac
+  if test "$_lt_dar_can_shared" = "yes"; then
+    output_verbose_link_cmd=func_echo_all
+    _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+    _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+    _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+    _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+    m4_if([$1], [CXX],
+[   if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+      _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+      _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+    fi
+],[])
+  else
+  _LT_TAGVAR(ld_shlibs, $1)=no
+  fi
+])
+
+# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
+# ----------------------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+# Store the results from the different compilers for each TAGNAME.
+# Allow to override them for all tags through lt_cv_aix_libpath.
+m4_defun([_LT_SYS_MODULE_PATH_AIX],
+[m4_require([_LT_DECL_SED])dnl
+if test "${lt_cv_aix_libpath+set}" = set; then
+  aix_libpath=$lt_cv_aix_libpath
+else
+  AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
+  [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
+  lt_aix_libpath_sed='[
+      /Import File Strings/,/^$/ {
+	  /^0/ {
+	      s/^0  *\([^ ]*\) *$/\1/
+	      p
+	  }
+      }]'
+  _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  # Check for a 64-bit object if we didn't find anything.
+  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+  fi],[])
+  if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
+    _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
+  fi
+  ])
+  aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
+fi
+])# _LT_SYS_MODULE_PATH_AIX
+
+
+# _LT_SHELL_INIT(ARG)
+# -------------------
+m4_define([_LT_SHELL_INIT],
+[m4_divert_text([M4SH-INIT], [$1
+])])# _LT_SHELL_INIT
+
+
+
+# _LT_PROG_ECHO_BACKSLASH
+# -----------------------
+# Find how we can fake an echo command that does not interpret backslash.
+# In particular, with Autoconf 2.60 or later we add some code to the start
+# of the generated configure script which will find a shell with a builtin
+# printf (which we can use as an echo command).
+m4_defun([_LT_PROG_ECHO_BACKSLASH],
+[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+
+AC_MSG_CHECKING([how to print strings])
+# Test print first, because it will be a builtin if present.
+if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
+   test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='print -r --'
+elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
+  ECHO='printf %s\n'
+else
+  # Use this function as a fallback that always works.
+  func_fallback_echo ()
+  {
+    eval 'cat <<_LTECHO_EOF
+$[]1
+_LTECHO_EOF'
+  }
+  ECHO='func_fallback_echo'
+fi
+
+# func_echo_all arg...
+# Invoke $ECHO with all args, space-separated.
+func_echo_all ()
+{
+    $ECHO "$*" 
+}
+
+case "$ECHO" in
+  printf*) AC_MSG_RESULT([printf]) ;;
+  print*) AC_MSG_RESULT([print -r]) ;;
+  *) AC_MSG_RESULT([cat]) ;;
+esac
+
+m4_ifdef([_AS_DETECT_SUGGESTED],
+[_AS_DETECT_SUGGESTED([
+  test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
+    ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
+    ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
+    PATH=/empty FPATH=/empty; export PATH FPATH
+    test "X`printf %s $ECHO`" = "X$ECHO" \
+      || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
+
+_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
+_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
+])# _LT_PROG_ECHO_BACKSLASH
+
+
+# _LT_WITH_SYSROOT
+# ----------------
+AC_DEFUN([_LT_WITH_SYSROOT],
+[AC_MSG_CHECKING([for sysroot])
+AC_ARG_WITH([sysroot],
+[  --with-sysroot[=DIR] Search for dependent libraries within DIR
+                        (or the compiler's sysroot if not specified).],
+[], [with_sysroot=no])
+
+dnl lt_sysroot will always be passed unquoted.  We quote it here
+dnl in case the user passed a directory name.
+lt_sysroot=
+case ${with_sysroot} in #(
+ yes)
+   if test "$GCC" = yes; then
+     lt_sysroot=`$CC --print-sysroot 2>/dev/null`
+   fi
+   ;; #(
+ /*)
+   lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
+   ;; #(
+ no|'')
+   ;; #(
+ *)
+   AC_MSG_RESULT([${with_sysroot}])
+   AC_MSG_ERROR([The sysroot must be an absolute path.])
+   ;;
+esac
+
+ AC_MSG_RESULT([${lt_sysroot:-no}])
+_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
+[dependent libraries, and in which our libraries should be installed.])])
+
+# _LT_ENABLE_LOCK
+# ---------------
+m4_defun([_LT_ENABLE_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+  [AS_HELP_STRING([--disable-libtool-lock],
+    [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.$ac_objext` in
+      *ELF-32*)
+	HPUX_IA64_MODE="32"
+	;;
+      *ELF-64*)
+	HPUX_IA64_MODE="64"
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+*-*-irix6*)
+  # Find out which ABI we are using.
+  echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    if test "$lt_cv_prog_gnu_ld" = yes; then
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -melf32bsmip"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -melf32bmipn32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -melf64bmip"
+	;;
+      esac
+    else
+      case `/usr/bin/file conftest.$ac_objext` in
+	*32-bit*)
+	  LD="${LD-ld} -32"
+	  ;;
+	*N32*)
+	  LD="${LD-ld} -n32"
+	  ;;
+	*64-bit*)
+	  LD="${LD-ld} -64"
+	  ;;
+      esac
+    fi
+  fi
+  rm -rf conftest*
+  ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+      *32-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_i386_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_i386"
+	    ;;
+	  ppc64-*linux*|powerpc64-*linux*)
+	    LD="${LD-ld} -m elf32ppclinux"
+	    ;;
+	  s390x-*linux*)
+	    LD="${LD-ld} -m elf_s390"
+	    ;;
+	  sparc64-*linux*)
+	    LD="${LD-ld} -m elf32_sparc"
+	    ;;
+	esac
+	;;
+      *64-bit*)
+	case $host in
+	  x86_64-*kfreebsd*-gnu)
+	    LD="${LD-ld} -m elf_x86_64_fbsd"
+	    ;;
+	  x86_64-*linux*)
+	    LD="${LD-ld} -m elf_x86_64"
+	    ;;
+	  ppc*-*linux*|powerpc*-*linux*)
+	    LD="${LD-ld} -m elf64ppc"
+	    ;;
+	  s390*-*linux*|s390*-*tpf*)
+	    LD="${LD-ld} -m elf64_s390"
+	    ;;
+	  sparc*-*linux*)
+	    LD="${LD-ld} -m elf64_sparc"
+	    ;;
+	esac
+	;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+
+*-*-sco3.2v5*)
+  # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+  SAVE_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -belf"
+  AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+    [AC_LANG_PUSH(C)
+     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+     AC_LANG_POP])
+  if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+    # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+    CFLAGS="$SAVE_CFLAGS"
+  fi
+  ;;
+sparc*-*solaris*)
+  # Find out which ABI we are using.
+  echo 'int i;' > conftest.$ac_ext
+  if AC_TRY_EVAL(ac_compile); then
+    case `/usr/bin/file conftest.o` in
+    *64-bit*)
+      case $lt_cv_prog_gnu_ld in
+      yes*) LD="${LD-ld} -m elf64_sparc" ;;
+      *)
+	if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+	  LD="${LD-ld} -64"
+	fi
+	;;
+      esac
+      ;;
+    esac
+  fi
+  rm -rf conftest*
+  ;;
+esac
+
+need_locks="$enable_libtool_lock"
+])# _LT_ENABLE_LOCK
+
+
+# _LT_PROG_AR
+# -----------
+m4_defun([_LT_PROG_AR],
+[AC_CHECK_TOOLS(AR, [ar], false)
+: ${AR=ar}
+: ${AR_FLAGS=cru}
+_LT_DECL([], [AR], [1], [The archiver])
+_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
+
+AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
+  [lt_cv_ar_at_file=no
+   AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
+     [echo conftest.$ac_objext > conftest.lst
+      lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
+      AC_TRY_EVAL([lt_ar_try])
+      if test "$ac_status" -eq 0; then
+	# Ensure the archiver fails upon bogus file names.
+	rm -f conftest.$ac_objext libconftest.a
+	AC_TRY_EVAL([lt_ar_try])
+	if test "$ac_status" -ne 0; then
+          lt_cv_ar_at_file=@
+        fi
+      fi
+      rm -f conftest.* libconftest.a
+     ])
+  ])
+
+if test "x$lt_cv_ar_at_file" = xno; then
+  archiver_list_spec=
+else
+  archiver_list_spec=$lt_cv_ar_at_file
+fi
+_LT_DECL([], [archiver_list_spec], [1],
+  [How to feed a file listing to the archiver])
+])# _LT_PROG_AR
+
+
+# _LT_CMD_OLD_ARCHIVE
+# -------------------
+m4_defun([_LT_CMD_OLD_ARCHIVE],
+[_LT_PROG_AR
+
+AC_CHECK_TOOL(STRIP, strip, :)
+test -z "$STRIP" && STRIP=:
+_LT_DECL([], [STRIP], [1], [A symbol stripping program])
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+test -z "$RANLIB" && RANLIB=:
+_LT_DECL([], [RANLIB], [1],
+    [Commands used to install an old-style archive])
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+  case $host_os in
+  openbsd*)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+    ;;
+  *)
+    old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+    ;;
+  esac
+  old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+case $host_os in
+  darwin*)
+    lock_old_archive_extraction=yes ;;
+  *)
+    lock_old_archive_extraction=no ;;
+esac
+_LT_DECL([], [old_postinstall_cmds], [2])
+_LT_DECL([], [old_postuninstall_cmds], [2])
+_LT_TAGDECL([], [old_archive_cmds], [2],
+    [Commands used to build an old-style archive])
+_LT_DECL([], [lock_old_archive_extraction], [0],
+    [Whether to use a lock for old archive extraction])
+])# _LT_CMD_OLD_ARCHIVE
+
+
+# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#		[OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([_LT_COMPILER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+   lt_compiler_flag="$3"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   # The option is referenced via a variable to avoid confusing sed.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>conftest.err)
+   ac_status=$?
+   cat conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s "$ac_outfile"; then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings other than the usual output.
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp
+     $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+     if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+       $2=yes
+     fi
+   fi
+   $RM conftest*
+])
+
+if test x"[$]$2" = xyes; then
+    m4_if([$5], , :, [$5])
+else
+    m4_if([$6], , :, [$6])
+fi
+])# _LT_COMPILER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
+
+
+# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+#                  [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------
+# Check whether the given linker option works
+AC_DEFUN([_LT_LINKER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+  [$2=no
+   save_LDFLAGS="$LDFLAGS"
+   LDFLAGS="$LDFLAGS $3"
+   echo "$lt_simple_link_test_code" > conftest.$ac_ext
+   if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+     # The linker can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     if test -s conftest.err; then
+       # Append any errors to the config.log.
+       cat conftest.err 1>&AS_MESSAGE_LOG_FD
+       $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+       $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+       if diff conftest.exp conftest.er2 >/dev/null; then
+         $2=yes
+       fi
+     else
+       $2=yes
+     fi
+   fi
+   $RM -r conftest*
+   LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+    m4_if([$4], , :, [$4])
+else
+    m4_if([$5], , :, [$5])
+fi
+])# _LT_LINKER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
+
+
+# LT_CMD_MAX_LEN
+#---------------
+AC_DEFUN([LT_CMD_MAX_LEN],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+  i=0
+  teststring="ABCD"
+
+  case $build_os in
+  msdosdjgpp*)
+    # On DJGPP, this test can blow up pretty badly due to problems in libc
+    # (any single argument exceeding 2000 bytes causes a buffer overrun
+    # during glob expansion).  Even if it were fixed, the result of this
+    # check would be larger than it should be.
+    lt_cv_sys_max_cmd_len=12288;    # 12K is about right
+    ;;
+
+  gnu*)
+    # Under GNU Hurd, this test is not required because there is
+    # no limit to the length of command line arguments.
+    # Libtool will interpret -1 as no limit whatsoever
+    lt_cv_sys_max_cmd_len=-1;
+    ;;
+
+  cygwin* | mingw* | cegcc*)
+    # On Win9x/ME, this test blows up -- it succeeds, but takes
+    # about 5 minutes as the teststring grows exponentially.
+    # Worse, since 9x/ME are not pre-emptively multitasking,
+    # you end up with a "frozen" computer, even though with patience
+    # the test eventually succeeds (with a max line length of 256k).
+    # Instead, let's just punt: use the minimum linelength reported by
+    # all of the supported platforms: 8192 (on NT/2K/XP).
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  mint*)
+    # On MiNT this can take a long time and run out of memory.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  amigaos*)
+    # On AmigaOS with pdksh, this test takes hours, literally.
+    # So we just punt and use a minimum line length of 8192.
+    lt_cv_sys_max_cmd_len=8192;
+    ;;
+
+  netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+    # This has been around since 386BSD, at least.  Likely further.
+    if test -x /sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+    elif test -x /usr/sbin/sysctl; then
+      lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+    else
+      lt_cv_sys_max_cmd_len=65536	# usable default for all BSDs
+    fi
+    # And add a safety zone
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+    lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    ;;
+
+  interix*)
+    # We know the value 262144 and hardcode it with a safety zone (like BSD)
+    lt_cv_sys_max_cmd_len=196608
+    ;;
+
+  osf*)
+    # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+    # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+    # nice to cause kernel panics so lets avoid the loop below.
+    # First set a reasonable default.
+    lt_cv_sys_max_cmd_len=16384
+    #
+    if test -x /sbin/sysconfig; then
+      case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+        *1*) lt_cv_sys_max_cmd_len=-1 ;;
+      esac
+    fi
+    ;;
+  sco3.2v5*)
+    lt_cv_sys_max_cmd_len=102400
+    ;;
+  sysv5* | sco5v6* | sysv4.2uw2*)
+    kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+    if test -n "$kargmax"; then
+      lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[	 ]]//'`
+    else
+      lt_cv_sys_max_cmd_len=32768
+    fi
+    ;;
+  *)
+    lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+    if test -n "$lt_cv_sys_max_cmd_len"; then
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+    else
+      # Make teststring a little bigger before we do anything with it.
+      # a 1K string should be a reasonable start.
+      for i in 1 2 3 4 5 6 7 8 ; do
+        teststring=$teststring$teststring
+      done
+      SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+      # If test is not a shell built-in, we'll probably end up computing a
+      # maximum length that is only half of the actual maximum length, but
+      # we can't tell.
+      while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \
+	         = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+	      test $i != 17 # 1/2 MB should be enough
+      do
+        i=`expr $i + 1`
+        teststring=$teststring$teststring
+      done
+      # Only check the string length outside the loop.
+      lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+      teststring=
+      # Add a significant safety factor because C++ compilers can tack on
+      # massive amounts of additional arguments before passing them to the
+      # linker.  It appears as though 1/2 is a usable value.
+      lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+    fi
+    ;;
+  esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+  AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+  AC_MSG_RESULT(none)
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+_LT_DECL([], [max_cmd_len], [0],
+    [What is the maximum length of a command?])
+])# LT_CMD_MAX_LEN
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
+
+
+# _LT_HEADER_DLFCN
+# ----------------
+m4_defun([_LT_HEADER_DLFCN],
+[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
+])# _LT_HEADER_DLFCN
+
+
+# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+#                      ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ----------------------------------------------------------------
+m4_defun([_LT_TRY_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+  [$4]
+else
+  lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+  lt_status=$lt_dlunknown
+  cat > conftest.$ac_ext <<_LT_EOF
+[#line $LINENO "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+#  define LT_DLGLOBAL		RTLD_GLOBAL
+#else
+#  ifdef DL_GLOBAL
+#    define LT_DLGLOBAL		DL_GLOBAL
+#  else
+#    define LT_DLGLOBAL		0
+#  endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+   find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+#  ifdef RTLD_LAZY
+#    define LT_DLLAZY_OR_NOW		RTLD_LAZY
+#  else
+#    ifdef DL_LAZY
+#      define LT_DLLAZY_OR_NOW		DL_LAZY
+#    else
+#      ifdef RTLD_NOW
+#        define LT_DLLAZY_OR_NOW	RTLD_NOW
+#      else
+#        ifdef DL_NOW
+#          define LT_DLLAZY_OR_NOW	DL_NOW
+#        else
+#          define LT_DLLAZY_OR_NOW	0
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+/* When -fvisbility=hidden is used, assume the code has been annotated
+   correspondingly for the symbols needed.  */
+#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
+int fnord () __attribute__((visibility("default")));
+#endif
+
+int fnord () { return 42; }
+int main ()
+{
+  void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+  int status = $lt_dlunknown;
+
+  if (self)
+    {
+      if (dlsym (self,"fnord"))       status = $lt_dlno_uscore;
+      else
+        {
+	  if (dlsym( self,"_fnord"))  status = $lt_dlneed_uscore;
+          else puts (dlerror ());
+	}
+      /* dlclose (self); */
+    }
+  else
+    puts (dlerror ());
+
+  return status;
+}]
+_LT_EOF
+  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+    (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+    lt_status=$?
+    case x$lt_status in
+      x$lt_dlno_uscore) $1 ;;
+      x$lt_dlneed_uscore) $2 ;;
+      x$lt_dlunknown|x*) $3 ;;
+    esac
+  else :
+    # compilation failed
+    $3
+  fi
+fi
+rm -fr conftest*
+])# _LT_TRY_DLOPEN_SELF
+
+
+# LT_SYS_DLOPEN_SELF
+# ------------------
+AC_DEFUN([LT_SYS_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+  enable_dlopen=unknown
+  enable_dlopen_self=unknown
+  enable_dlopen_self_static=unknown
+else
+  lt_cv_dlopen=no
+  lt_cv_dlopen_libs=
+
+  case $host_os in
+  beos*)
+    lt_cv_dlopen="load_add_on"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ;;
+
+  mingw* | pw32* | cegcc*)
+    lt_cv_dlopen="LoadLibrary"
+    lt_cv_dlopen_libs=
+    ;;
+
+  cygwin*)
+    lt_cv_dlopen="dlopen"
+    lt_cv_dlopen_libs=
+    ;;
+
+  darwin*)
+  # if libdl is installed we need to link against it
+    AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+    lt_cv_dlopen="dyld"
+    lt_cv_dlopen_libs=
+    lt_cv_dlopen_self=yes
+    ])
+    ;;
+
+  *)
+    AC_CHECK_FUNC([shl_load],
+	  [lt_cv_dlopen="shl_load"],
+      [AC_CHECK_LIB([dld], [shl_load],
+	    [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
+	[AC_CHECK_FUNC([dlopen],
+	      [lt_cv_dlopen="dlopen"],
+	  [AC_CHECK_LIB([dl], [dlopen],
+		[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+	    [AC_CHECK_LIB([svld], [dlopen],
+		  [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+	      [AC_CHECK_LIB([dld], [dld_link],
+		    [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
+	      ])
+	    ])
+	  ])
+	])
+      ])
+    ;;
+  esac
+
+  if test "x$lt_cv_dlopen" != xno; then
+    enable_dlopen=yes
+  else
+    enable_dlopen=no
+  fi
+
+  case $lt_cv_dlopen in
+  dlopen)
+    save_CPPFLAGS="$CPPFLAGS"
+    test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+    save_LDFLAGS="$LDFLAGS"
+    wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+    save_LIBS="$LIBS"
+    LIBS="$lt_cv_dlopen_libs $LIBS"
+
+    AC_CACHE_CHECK([whether a program can dlopen itself],
+	  lt_cv_dlopen_self, [dnl
+	  _LT_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+	    lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+    ])
+
+    if test "x$lt_cv_dlopen_self" = xyes; then
+      wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+      AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+	  lt_cv_dlopen_self_static, [dnl
+	  _LT_TRY_DLOPEN_SELF(
+	    lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+	    lt_cv_dlopen_self_static=no,  lt_cv_dlopen_self_static=cross)
+      ])
+    fi
+
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+    ;;
+  esac
+
+  case $lt_cv_dlopen_self in
+  yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+  *) enable_dlopen_self=unknown ;;
+  esac
+
+  case $lt_cv_dlopen_self_static in
+  yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+  *) enable_dlopen_self_static=unknown ;;
+  esac
+fi
+_LT_DECL([dlopen_support], [enable_dlopen], [0],
+	 [Whether dlopen is supported])
+_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
+	 [Whether dlopen of programs is supported])
+_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
+	 [Whether dlopen of statically linked programs is supported])
+])# LT_SYS_DLOPEN_SELF
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
+
+
+# _LT_COMPILER_C_O([TAGNAME])
+# ---------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler.
+# This macro does not hard code the compiler like AC_PROG_CC_C_O.
+m4_defun([_LT_COMPILER_C_O],
+[m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+  [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+   $RM -r conftest 2>/dev/null
+   mkdir conftest
+   cd conftest
+   mkdir out
+   echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+   lt_compiler_flag="-o out/conftest2.$ac_objext"
+   # Insert the option either (1) after the last *FLAGS variable, or
+   # (2) before a word containing "conftest.", or (3) at the end.
+   # Note that $ac_compile itself does not contain backslashes and begins
+   # with a dollar sign (not a hyphen), so the echo should work correctly.
+   lt_compile=`echo "$ac_compile" | $SED \
+   -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+   -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+   -e 's:$: $lt_compiler_flag:'`
+   (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+   (eval "$lt_compile" 2>out/conftest.err)
+   ac_status=$?
+   cat out/conftest.err >&AS_MESSAGE_LOG_FD
+   echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+   if (exit $ac_status) && test -s out/conftest2.$ac_objext
+   then
+     # The compiler can only warn and ignore the option if not recognized
+     # So say no if there are warnings
+     $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp
+     $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+     if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+       _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+     fi
+   fi
+   chmod u+w . 2>&AS_MESSAGE_LOG_FD
+   $RM conftest*
+   # SGI C++ compiler will create directory out/ii_files/ for
+   # template instantiation
+   test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+   $RM out/* && rmdir out
+   cd ..
+   $RM -r conftest
+   $RM conftest*
+])
+_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
+	[Does compiler simultaneously support -c and -o options?])
+])# _LT_COMPILER_C_O
+
+
+# _LT_COMPILER_FILE_LOCKS([TAGNAME])
+# ----------------------------------
+# Check to see if we can do hard links to lock some files if needed
+m4_defun([_LT_COMPILER_FILE_LOCKS],
+[m4_require([_LT_ENABLE_LOCK])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_COMPILER_C_O([$1])
+
+hard_links="nottested"
+if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+  # do not overwrite the value of need_locks provided by the user
+  AC_MSG_CHECKING([if we can lock with hard links])
+  hard_links=yes
+  $RM conftest*
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  touch conftest.a
+  ln conftest.a conftest.b 2>&5 || hard_links=no
+  ln conftest.a conftest.b 2>/dev/null && hard_links=no
+  AC_MSG_RESULT([$hard_links])
+  if test "$hard_links" = no; then
+    AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+    need_locks=warn
+  fi
+else
+  need_locks=no
+fi
+_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
+])# _LT_COMPILER_FILE_LOCKS
+
+
+# _LT_CHECK_OBJDIR
+# ----------------
+m4_defun([_LT_CHECK_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+  lt_cv_objdir=.libs
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+_LT_DECL([], [objdir], [0],
+         [The name of the directory that contains temporary libtool files])dnl
+m4_pattern_allow([LT_OBJDIR])dnl
+AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
+  [Define to the sub-directory in which libtool stores uninstalled libraries.])
+])# _LT_CHECK_OBJDIR
+
+
+# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
+# --------------------------------------
+# Check hardcoding attributes.
+m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
+   test -n "$_LT_TAGVAR(runpath_var, $1)" ||
+   test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+  # We can hardcode non-existent directories.
+  if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
+     # If the only mechanism to avoid hardcoding is shlibpath_var, we
+     # have to relink, otherwise we might link with an installed library
+     # when we should be linking with a yet-to-be-installed one
+     ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+     test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
+    # Linking always hardcodes the temporary library directory.
+    _LT_TAGVAR(hardcode_action, $1)=relink
+  else
+    # We can link without hardcoding, and we can hardcode nonexisting dirs.
+    _LT_TAGVAR(hardcode_action, $1)=immediate
+  fi
+else
+  # We cannot hardcode anything, or else we can only hardcode existing
+  # directories.
+  _LT_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
+   test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
+  # Fast installation is not supported
+  enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+     test "$enable_shared" = no; then
+  # Fast installation is not necessary
+  enable_fast_install=needless
+fi
+_LT_TAGDECL([], [hardcode_action], [0],
+    [How to hardcode a shared library path into an executable])
+])# _LT_LINKER_HARDCODE_LIBPATH
+
+
+# _LT_CMD_STRIPLIB
+# ----------------
+m4_defun([_LT_CMD_STRIPLIB],
+[m4_require([_LT_DECL_EGREP])
+striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+  test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+  test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+  AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+  case $host_os in
+  darwin*)
+    if test -n "$STRIP" ; then
+      striplib="$STRIP -x"
+      old_striplib="$STRIP -S"
+      AC_MSG_RESULT([yes])
+    else
+      AC_MSG_RESULT([no])
+    fi
+    ;;
+  *)
+    AC_MSG_RESULT([no])
+    ;;
+  esac
+fi
+_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
+_LT_DECL([], [striplib], [1])
+])# _LT_CMD_STRIPLIB
+
+
+# _LT_SYS_DYNAMIC_LINKER([TAG])
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+m4_defun([_LT_SYS_DYNAMIC_LINKER],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_OBJDUMP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+AC_MSG_CHECKING([dynamic linker characteristics])
+m4_if([$1],
+	[], [
+if test "$GCC" = yes; then
+  case $host_os in
+    darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+    *) lt_awk_arg="/^libraries:/" ;;
+  esac
+  case $host_os in
+    mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
+    *) lt_sed_strip_eq="s,=/,/,g" ;;
+  esac
+  lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
+  case $lt_search_path_spec in
+  *\;*)
+    # if the path contains ";" then we assume it to be the separator
+    # otherwise default to the standard path separator (i.e. ":") - it is
+    # assumed that no part of a normal pathname contains ";" but that should
+    # okay in the real world where ";" in dirpaths is itself problematic.
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
+    ;;
+  *)
+    lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
+    ;;
+  esac
+  # Ok, now we have the path, separated by spaces, we can step through it
+  # and add multilib dir if necessary.
+  lt_tmp_lt_search_path_spec=
+  lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+  for lt_sys_path in $lt_search_path_spec; do
+    if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+      lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+    else
+      test -d "$lt_sys_path" && \
+	lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+    fi
+  done
+  lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+  lt_foo="";
+  lt_count=0;
+  for (lt_i = NF; lt_i > 0; lt_i--) {
+    if ($lt_i != "" && $lt_i != ".") {
+      if ($lt_i == "..") {
+        lt_count++;
+      } else {
+        if (lt_count == 0) {
+          lt_foo="/" $lt_i lt_foo;
+        } else {
+          lt_count--;
+        }
+      }
+    }
+  }
+  if (lt_foo != "") { lt_freq[[lt_foo]]++; }
+  if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
+}'`
+  # AWK program above erroneously prepends '/' to C:/dos/paths
+  # for these hosts.
+  case $host_os in
+    mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
+      $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
+  esac
+  sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+else
+  sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+  shlibpath_var=LIBPATH
+
+  # AIX 3 has no versioning support, so we append a major version to the name.
+  soname_spec='${libname}${release}${shared_ext}$major'
+  ;;
+
+aix[[4-9]]*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  hardcode_into_libs=yes
+  if test "$host_cpu" = ia64; then
+    # AIX 5 supports IA64
+    library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+    shlibpath_var=LD_LIBRARY_PATH
+  else
+    # With GCC up to 2.95.x, collect2 would create an import file
+    # for dependence libraries.  The import file would start with
+    # the line `#! .'.  This would cause the generated library to
+    # depend on `.', always an invalid library.  This was fixed in
+    # development snapshots of GCC prior to 3.0.
+    case $host_os in
+      aix4 | aix4.[[01]] | aix4.[[01]].*)
+      if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+	   echo ' yes '
+	   echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+	:
+      else
+	can_build_shared=no
+      fi
+      ;;
+    esac
+    # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+    # soname into executable. Probably we can add versioning support to
+    # collect2, so additional links can be useful in future.
+    if test "$aix_use_runtimelinking" = yes; then
+      # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+      # instead of lib<name>.a to let people know that these are not
+      # typical AIX shared libraries.
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    else
+      # We preserve .a as extension for shared libraries through AIX4.2
+      # and later when we are not doing run time linking.
+      library_names_spec='${libname}${release}.a $libname.a'
+      soname_spec='${libname}${release}${shared_ext}$major'
+    fi
+    shlibpath_var=LIBPATH
+  fi
+  ;;
+
+amigaos*)
+  case $host_cpu in
+  powerpc)
+    # Since July 2007 AmigaOS4 officially supports .so libraries.
+    # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    ;;
+  m68k)
+    library_names_spec='$libname.ixlibrary $libname.a'
+    # Create ${libname}_ixlibrary.a entries in /sys/libs.
+    finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+    ;;
+  esac
+  ;;
+
+beos*)
+  library_names_spec='${libname}${shared_ext}'
+  dynamic_linker="$host_os ld.so"
+  shlibpath_var=LIBRARY_PATH
+  ;;
+
+bsdi[[45]]*)
+  version_type=linux
+  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'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+  sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+  # the default ld.so.conf also contains /usr/contrib/lib and
+  # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+  # libtool to hard-code these into programs
+  ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+  version_type=windows
+  shrext_cmds=".dll"
+  need_version=no
+  need_lib_prefix=no
+
+  case $GCC,$cc_basename in
+  yes,*)
+    # gcc
+    library_names_spec='$libname.dll.a'
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname~
+      chmod a+x \$dldir/$dlname~
+      if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+        eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+      fi'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+
+    case $host_os in
+    cygwin*)
+      # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+      soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+m4_if([$1], [],[
+      sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
+      ;;
+    mingw* | cegcc*)
+      # MinGW DLLs use traditional 'lib' prefix
+      soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    pw32*)
+      # pw32 DLLs use 'pw' prefix rather than 'lib'
+      library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+      ;;
+    esac
+    dynamic_linker='Win32 ld.exe'
+    ;;
+
+  *,cl*)
+    # Native MSVC
+    libname_spec='$name'
+    soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+    library_names_spec='${libname}.dll.lib'
+
+    case $build_os in
+    mingw*)
+      sys_lib_search_path_spec=
+      lt_save_ifs=$IFS
+      IFS=';'
+      for lt_path in $LIB
+      do
+        IFS=$lt_save_ifs
+        # Let DOS variable expansion print the short 8.3 style file name.
+        lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"`
+        sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path"
+      done
+      IFS=$lt_save_ifs
+      # Convert to MSYS style.
+      sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'`
+      ;;
+    cygwin*)
+      # Convert to unix form, then to dos form, then back to unix form
+      # but this time dos style (no spaces!) so that the unix form looks
+      # like /cygdrive/c/PROGRA~1:/cygdr...
+      sys_lib_search_path_spec=`cygpath --path --unix "$LIB"`
+      sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null`
+      sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      ;;
+    *)
+      sys_lib_search_path_spec="$LIB"
+      if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
+        # It is most probably a Windows format PATH.
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+      else
+        sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+      fi
+      # FIXME: find the short name or the path components, as spaces are
+      # common. (e.g. "Program Files" -> "PROGRA~1")
+      ;;
+    esac
+
+    # DLL is installed to $(libdir)/../bin by postinstall_cmds
+    postinstall_cmds='base_file=`basename \${file}`~
+      dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+      dldir=$destdir/`dirname \$dlpath`~
+      test -d \$dldir || mkdir -p \$dldir~
+      $install_prog $dir/$dlname \$dldir/$dlname'
+    postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+      dlpath=$dir/\$dldll~
+       $RM \$dlpath'
+    shlibpath_overrides_runpath=yes
+    dynamic_linker='Win32 link.exe'
+    ;;
+
+  *)
+    # Assume MSVC wrapper
+    library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+    dynamic_linker='Win32 ld.exe'
+    ;;
+  esac
+  # FIXME: first we should search . and the directory the executable is in
+  shlibpath_var=PATH
+  ;;
+
+darwin* | rhapsody*)
+  dynamic_linker="$host_os dyld"
+  version_type=darwin
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+  soname_spec='${libname}${release}${major}$shared_ext'
+  shlibpath_overrides_runpath=yes
+  shlibpath_var=DYLD_LIBRARY_PATH
+  shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+m4_if([$1], [],[
+  sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
+  sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+  ;;
+
+dgux*)
+  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
+  ;;
+
+freebsd1*)
+  dynamic_linker=no
+  ;;
+
+freebsd* | dragonfly*)
+  # DragonFly does not have aout.  When/if they implement a new
+  # versioning mechanism, adjust this.
+  if test -x /usr/bin/objformat; then
+    objformat=`/usr/bin/objformat`
+  else
+    case $host_os in
+    freebsd[[123]]*) objformat=aout ;;
+    *) objformat=elf ;;
+    esac
+  fi
+  version_type=freebsd-$objformat
+  case $version_type in
+    freebsd-elf*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+      need_version=no
+      need_lib_prefix=no
+      ;;
+    freebsd-*)
+      library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+      need_version=yes
+      ;;
+  esac
+  shlibpath_var=LD_LIBRARY_PATH
+  case $host_os in
+  freebsd2*)
+    shlibpath_overrides_runpath=yes
+    ;;
+  freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+  freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+    shlibpath_overrides_runpath=no
+    hardcode_into_libs=yes
+    ;;
+  *) # from 4.6 on, and DragonFly
+    shlibpath_overrides_runpath=yes
+    hardcode_into_libs=yes
+    ;;
+  esac
+  ;;
+
+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
+  ;;
+
+haiku*)
+  version_type=linux
+  need_lib_prefix=no
+  need_version=no
+  dynamic_linker="$host_os runtime_loader"
+  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=LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib'
+  hardcode_into_libs=yes
+  ;;
+
+hpux9* | hpux10* | hpux11*)
+  # Give a soname corresponding to the major version so that dld.sl refuses to
+  # link against other versions.
+  version_type=sunos
+  need_lib_prefix=no
+  need_version=no
+  case $host_cpu in
+  ia64*)
+    shrext_cmds='.so'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.so"
+    shlibpath_var=LD_LIBRARY_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    if test "X$HPUX_IA64_MODE" = X32; then
+      sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+    else
+      sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+    fi
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  hppa*64*)
+    shrext_cmds='.sl'
+    hardcode_into_libs=yes
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+    shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+    sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+    ;;
+  *)
+    shrext_cmds='.sl'
+    dynamic_linker="$host_os dld.sl"
+    shlibpath_var=SHLIB_PATH
+    shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    ;;
+  esac
+  # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+  postinstall_cmds='chmod 555 $lib'
+  # or fails outright, so override atomically:
+  install_override_mode=555
+  ;;
+
+interix[[3-9]]*)
+  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'
+  dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $host_os in
+    nonstopux*) version_type=nonstopux ;;
+    *)
+	if test "$lt_cv_prog_gnu_ld" = yes; then
+		version_type=linux
+	else
+		version_type=irix
+	fi ;;
+  esac
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+  case $host_os in
+  irix5* | nonstopux*)
+    libsuff= shlibsuff=
+    ;;
+  *)
+    case $LD in # libtool.m4 will add one of these switches to LD
+    *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+      libsuff= shlibsuff= libmagic=32-bit;;
+    *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+      libsuff=32 shlibsuff=N32 libmagic=N32;;
+    *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+      libsuff=64 shlibsuff=64 libmagic=64-bit;;
+    *) libsuff= shlibsuff= libmagic=never-match;;
+    esac
+    ;;
+  esac
+  shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+  shlibpath_overrides_runpath=no
+  sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+  sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+  hardcode_into_libs=yes
+  ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+  dynamic_linker=no
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-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'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+
+  # Some binutils ld are patched to set DT_RUNPATH
+  AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
+    [lt_cv_shlibpath_overrides_runpath=no
+    save_LDFLAGS=$LDFLAGS
+    save_libdir=$libdir
+    eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
+	 LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+      [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
+	 [lt_cv_shlibpath_overrides_runpath=yes])])
+    LDFLAGS=$save_LDFLAGS
+    libdir=$save_libdir
+    ])
+  shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath
+
+  # This implies no fast_install, which is unacceptable.
+  # Some rework will be needed to allow for fast_install
+  # before this can be enabled.
+  hardcode_into_libs=yes
+
+  # Append ld.so.conf contents to the search path
+  if test -f /etc/ld.so.conf; then
+    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[	 ]*hwcap[	 ]/d;s/[:,	]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '`
+    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+  fi
+
+  # We used to test for /lib/ld.so.1 and disable shared libraries on
+  # powerpc, because MkLinux only supported shared libraries with the
+  # GNU dynamic linker.  Since this was broken with cross compilers,
+  # most powerpc-linux boxes support dynamic linking these days and
+  # people can always --disable-shared, the test was removed, and we
+  # assume the GNU/Linux dynamic linker is in use.
+  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
+  need_version=no
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+    finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+    dynamic_linker='NetBSD (a.out) ld.so'
+  else
+    library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+    soname_spec='${libname}${release}${shared_ext}$major'
+    dynamic_linker='NetBSD ld.elf_so'
+  fi
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  ;;
+
+newsos6)
+  version_type=linux
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  ;;
+
+*nto* | *qnx*)
+  version_type=qnx
+  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='ldqnx.so'
+  ;;
+
+openbsd*)
+  version_type=sunos
+  sys_lib_dlsearch_path_spec="/usr/lib"
+  need_lib_prefix=no
+  # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+  case $host_os in
+    openbsd3.3 | openbsd3.3.*)	need_version=yes ;;
+    *)				need_version=no  ;;
+  esac
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    case $host_os in
+      openbsd2.[[89]] | openbsd2.[[89]].*)
+	shlibpath_overrides_runpath=no
+	;;
+      *)
+	shlibpath_overrides_runpath=yes
+	;;
+      esac
+  else
+    shlibpath_overrides_runpath=yes
+  fi
+  ;;
+
+os2*)
+  libname_spec='$name'
+  shrext_cmds=".dll"
+  need_lib_prefix=no
+  library_names_spec='$libname${shared_ext} $libname.a'
+  dynamic_linker='OS/2 ld.exe'
+  shlibpath_var=LIBPATH
+  ;;
+
+osf3* | osf4* | osf5*)
+  version_type=osf
+  need_lib_prefix=no
+  need_version=no
+  soname_spec='${libname}${release}${shared_ext}$major'
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+  shlibpath_var=LD_LIBRARY_PATH
+  sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+  sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+  ;;
+
+rdos*)
+  dynamic_linker=no
+  ;;
+
+solaris*)
+  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=yes
+  hardcode_into_libs=yes
+  # ldd complains unless libraries are executable
+  postinstall_cmds='chmod +x $lib'
+  ;;
+
+sunos4*)
+  version_type=sunos
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+  finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  if test "$with_gnu_ld" = yes; then
+    need_lib_prefix=no
+  fi
+  need_version=yes
+  ;;
+
+sysv4 | sysv4.3*)
+  version_type=linux
+  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
+  case $host_vendor in
+    sni)
+      shlibpath_overrides_runpath=no
+      need_lib_prefix=no
+      runpath_var=LD_RUN_PATH
+      ;;
+    siemens)
+      need_lib_prefix=no
+      ;;
+    motorola)
+      need_lib_prefix=no
+      need_version=no
+      shlibpath_overrides_runpath=no
+      sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+      ;;
+  esac
+  ;;
+
+sysv4*MP*)
+  if test -d /usr/nec ;then
+    version_type=linux
+    library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+    soname_spec='$libname${shared_ext}.$major'
+    shlibpath_var=LD_LIBRARY_PATH
+  fi
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  version_type=freebsd-elf
+  need_lib_prefix=no
+  need_version=no
+  library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+  soname_spec='${libname}${release}${shared_ext}$major'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=yes
+  hardcode_into_libs=yes
+  if test "$with_gnu_ld" = yes; then
+    sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+  else
+    sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+    case $host_os in
+      sco3.2v5*)
+        sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+	;;
+    esac
+  fi
+  sys_lib_dlsearch_path_spec='/usr/lib'
+  ;;
+
+tpf*)
+  # TPF is a cross-target only.  Preferred cross-host = GNU/Linux.
+  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}'
+  shlibpath_var=LD_LIBRARY_PATH
+  shlibpath_overrides_runpath=no
+  hardcode_into_libs=yes
+  ;;
+
+uts4*)
+  version_type=linux
+  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
+  ;;
+
+*)
+  dynamic_linker=no
+  ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+  variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+  sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+  sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+_LT_DECL([], [variables_saved_for_relink], [1],
+    [Variables whose values should be saved in libtool wrapper scripts and
+    restored at link time])
+_LT_DECL([], [need_lib_prefix], [0],
+    [Do we need the "lib" prefix for modules?])
+_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
+_LT_DECL([], [version_type], [0], [Library versioning type])
+_LT_DECL([], [runpath_var], [0],  [Shared library runtime path variable])
+_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
+_LT_DECL([], [shlibpath_overrides_runpath], [0],
+    [Is shlibpath searched before the hard-coded library search path?])
+_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
+_LT_DECL([], [library_names_spec], [1],
+    [[List of archive names.  First name is the real one, the rest are links.
+    The last name is the one that the linker finds with -lNAME]])
+_LT_DECL([], [soname_spec], [1],
+    [[The coded name of the library, if different from the real name]])
+_LT_DECL([], [install_override_mode], [1],
+    [Permission mode override for installation of shared libraries])
+_LT_DECL([], [postinstall_cmds], [2],
+    [Command to use after installation of a shared archive])
+_LT_DECL([], [postuninstall_cmds], [2],
+    [Command to use after uninstallation of a shared archive])
+_LT_DECL([], [finish_cmds], [2],
+    [Commands used to finish a libtool library installation in a directory])
+_LT_DECL([], [finish_eval], [1],
+    [[As "finish_cmds", except a single script fragment to be evaled but
+    not shown]])
+_LT_DECL([], [hardcode_into_libs], [0],
+    [Whether we should hardcode library paths into libraries])
+_LT_DECL([], [sys_lib_search_path_spec], [2],
+    [Compile-time system search path for libraries])
+_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
+    [Run-time system search path for libraries])
+])# _LT_SYS_DYNAMIC_LINKER
+
+
+# _LT_PATH_TOOL_PREFIX(TOOL)
+# --------------------------
+# find a file program which can recognize shared library
+AC_DEFUN([_LT_PATH_TOOL_PREFIX],
+[m4_require([_LT_DECL_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] |  ?:[\\/]*])
+  lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+  ;;
+*)
+  lt_save_MAGIC_CMD="$MAGIC_CMD"
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word.  This closes a longstanding sh security hole.
+  ac_dummy="m4_if([$2], , $PATH, [$2])"
+  for ac_dir in $ac_dummy; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$1; then
+      lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+      if test -n "$file_magic_test_file"; then
+	case $deplibs_check_method in
+	"file_magic "*)
+	  file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+	  MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+	  if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+	    $EGREP "$file_magic_regex" > /dev/null; then
+	    :
+	  else
+	    cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such.  This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem.  Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool at gnu.org
+
+_LT_EOF
+	  fi ;;
+	esac
+      fi
+      break
+    fi
+  done
+  IFS="$lt_save_ifs"
+  MAGIC_CMD="$lt_save_MAGIC_CMD"
+  ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+  AC_MSG_RESULT($MAGIC_CMD)
+else
+  AC_MSG_RESULT(no)
+fi
+_LT_DECL([], [MAGIC_CMD], [0],
+	 [Used to examine libraries when file_magic_cmd begins with "file"])dnl
+])# _LT_PATH_TOOL_PREFIX
+
+# Old name:
+AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
+
+
+# _LT_PATH_MAGIC
+# --------------
+# find a file program which can recognize a shared library
+m4_defun([_LT_PATH_MAGIC],
+[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+  if test -n "$ac_tool_prefix"; then
+    _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+  else
+    MAGIC_CMD=:
+  fi
+fi
+])# _LT_PATH_MAGIC
+
+
+# LT_PATH_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([LT_PATH_LD],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
+
+AC_ARG_WITH([gnu-ld],
+    [AS_HELP_STRING([--with-gnu-ld],
+	[assume the C compiler uses GNU ld @<:@default=no@:>@])],
+    [test "$withval" = no || with_gnu_ld=yes],
+    [with_gnu_ld=no])dnl
+
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by $CC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]]* | ?:[[\\/]]*)
+      re_direlt='/[[^/]][[^/]]*/\.\./'
+      # Canonicalize the pathname of ld
+      ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
+      while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
+	ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL(lt_cv_path_LD,
+[if test -z "$LD"; then
+  lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+  for ac_dir in $PATH; do
+    IFS="$lt_save_ifs"
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      lt_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some variants of GNU ld only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+      *GNU* | *'with BFD'*)
+	test "$with_gnu_ld" != no && break
+	;;
+      *)
+	test "$with_gnu_ld" != yes && break
+	;;
+      esac
+    fi
+  done
+  IFS="$lt_save_ifs"
+else
+  lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+  AC_MSG_RESULT($LD)
+else
+  AC_MSG_RESULT(no)
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+_LT_PATH_LD_GNU
+AC_SUBST([LD])
+
+_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
+])# LT_PATH_LD
+
+# Old names:
+AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
+AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_LD], [])
+dnl AC_DEFUN([AC_PROG_LD], [])
+
+
+# _LT_PATH_LD_GNU
+#- --------------
+m4_defun([_LT_PATH_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  lt_cv_prog_gnu_ld=yes
+  ;;
+*)
+  lt_cv_prog_gnu_ld=no
+  ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# _LT_PATH_LD_GNU
+
+
+# _LT_CMD_RELOAD
+# --------------
+# find reload flag for linker
+#   -- PORTME Some linkers may need a different reload flag.
+m4_defun([_LT_CMD_RELOAD],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+  lt_cv_ld_reload_flag,
+  [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    if test "$GCC" != yes; then
+      reload_cmds=false
+    fi
+    ;;
+  darwin*)
+    if test "$GCC" = yes; then
+      reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+    else
+      reload_cmds='$LD$reload_flag -o $output$reload_objs'
+    fi
+    ;;
+esac
+_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
+_LT_TAGDECL([], [reload_cmds], [2])dnl
+])# _LT_CMD_RELOAD
+
+
+# _LT_CHECK_MAGIC_METHOD
+# ----------------------
+# how to check for library dependencies
+#  -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_MAGIC_METHOD],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+AC_CACHE_CHECK([how to recognize dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[[4-9]]*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+beos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+bsdi[[45]]*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+  lt_cv_file_magic_cmd='/usr/bin/file -L'
+  lt_cv_file_magic_test_file=/shlib/libc.so
+  ;;
+
+cygwin*)
+  # func_win32_libid is a shell function defined in ltmain.sh
+  lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+  lt_cv_file_magic_cmd='func_win32_libid'
+  ;;
+
+mingw* | pw32*)
+  # Base MSYS/MinGW do not provide the 'file' command needed by
+  # func_win32_libid shell function, so use a weaker test based on 'objdump',
+  # unless we find 'file', for example because we are cross-compiling.
+  # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
+  if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+    lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+    lt_cv_file_magic_cmd='func_win32_libid'
+  else
+    # Keep this pattern in sync with the one in func_win32_libid.
+    lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+    lt_cv_file_magic_cmd='$OBJDUMP -f'
+  fi
+  ;;
+
+cegcc*)
+  # use the weaker test based on 'objdump'. See mingw*.
+  lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+  lt_cv_file_magic_cmd='$OBJDUMP -f'
+  ;;
+
+darwin* | rhapsody*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+freebsd* | dragonfly*)
+  if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+    case $host_cpu in
+    i*86 )
+      # Not sure whether the presence of OpenBSD here was a mistake.
+      # Let's accept both of them until this is cleared up.
+      lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+      lt_cv_file_magic_cmd=/usr/bin/file
+      lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+      ;;
+    esac
+  else
+    lt_cv_deplibs_check_method=pass_all
+  fi
+  ;;
+
+gnu*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+haiku*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+hpux10.20* | hpux11*)
+  lt_cv_file_magic_cmd=/usr/bin/file
+  case $host_cpu in
+  ia64*)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+    lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+    ;;
+  hppa*64*)
+    [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
+    lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+    ;;
+  *)
+    lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
+    lt_cv_file_magic_test_file=/usr/lib/libc.sl
+    ;;
+  esac
+  ;;
+
+interix[[3-9]]*)
+  # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+  ;;
+
+irix5* | irix6* | nonstopux*)
+  case $LD in
+  *-32|*"-32 ") libmagic=32-bit;;
+  *-n32|*"-n32 ") libmagic=N32;;
+  *-64|*"-64 ") libmagic=64-bit;;
+  *) libmagic=never-match;;
+  esac
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+netbsd* | netbsdelf*-gnu)
+  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
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+  fi
+  ;;
+
+newos6*)
+  lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+  lt_cv_file_magic_cmd=/usr/bin/file
+  lt_cv_file_magic_test_file=/usr/lib/libnls.so
+  ;;
+
+*nto* | *qnx*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+openbsd*)
+  if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+  else
+    lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+  fi
+  ;;
+
+osf3* | osf4* | osf5*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+rdos*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+solaris*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+
+sysv4 | sysv4.3*)
+  case $host_vendor in
+  motorola)
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+    lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+    ;;
+  ncr)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  sequent)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+    ;;
+  sni)
+    lt_cv_file_magic_cmd='/bin/file'
+    lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+    lt_cv_file_magic_test_file=/lib/libc.so
+    ;;
+  siemens)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  pc)
+    lt_cv_deplibs_check_method=pass_all
+    ;;
+  esac
+  ;;
+
+tpf*)
+  lt_cv_deplibs_check_method=pass_all
+  ;;
+esac
+])
+
+file_magic_glob=
+want_nocaseglob=no
+if test "$build" = "$host"; then
+  case $host_os in
+  mingw* | pw32*)
+    if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
+      want_nocaseglob=yes
+    else
+      file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
+    fi
+    ;;
+  esac
+fi
+
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+_LT_DECL([], [deplibs_check_method], [1],
+    [Method to check whether dependent libraries are shared objects])
+_LT_DECL([], [file_magic_cmd], [1],
+    [Command to use when deplibs_check_method = "file_magic"])
+_LT_DECL([], [file_magic_glob], [1],
+    [How to find potential files when deplibs_check_method = "file_magic"])
+_LT_DECL([], [want_nocaseglob], [1],
+    [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
+])# _LT_CHECK_MAGIC_METHOD
+
+
+# LT_PATH_NM
+# ----------
+# find the pathname to a BSD- or MS-compatible name lister
+AC_DEFUN([LT_PATH_NM],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
+[if test -n "$NM"; then
+  # Let the user override the test.
+  lt_cv_path_NM="$NM"
+else
+  lt_nm_to_check="${ac_tool_prefix}nm"
+  if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+    lt_nm_to_check="$lt_nm_to_check nm"
+  fi
+  for lt_tmp_nm in $lt_nm_to_check; do
+    lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+    for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+      IFS="$lt_save_ifs"
+      test -z "$ac_dir" && ac_dir=.
+      tmp_nm="$ac_dir/$lt_tmp_nm"
+      if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+	# Check to see if the nm accepts a BSD-compat flag.
+	# Adding the `sed 1q' prevents false positives on HP-UX, which says:
+	#   nm: unknown option "B" ignored
+	# Tru64's nm complains that /dev/null is an invalid object file
+	case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+	*/dev/null* | *'Invalid file or object type'*)
+	  lt_cv_path_NM="$tmp_nm -B"
+	  break
+	  ;;
+	*)
+	  case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+	  */dev/null*)
+	    lt_cv_path_NM="$tmp_nm -p"
+	    break
+	    ;;
+	  *)
+	    lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+	    continue # so that we can try to find one that supports BSD flags
+	    ;;
+	  esac
+	  ;;
+	esac
+      fi
+    done
+    IFS="$lt_save_ifs"
+  done
+  : ${lt_cv_path_NM=no}
+fi])
+if test "$lt_cv_path_NM" != "no"; then
+  NM="$lt_cv_path_NM"
+else
+  # Didn't find any BSD compatible name lister, look for dumpbin.
+  if test -n "$DUMPBIN"; then :
+    # Let the user override the test.
+  else
+    AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
+    case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
+    *COFF*)
+      DUMPBIN="$DUMPBIN -symbols"
+      ;;
+    *)
+      DUMPBIN=:
+      ;;
+    esac
+  fi
+  AC_SUBST([DUMPBIN])
+  if test "$DUMPBIN" != ":"; then
+    NM="$DUMPBIN"
+  fi
+fi
+test -z "$NM" && NM=nm
+AC_SUBST([NM])
+_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
+
+AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
+  [lt_cv_nm_interface="BSD nm"
+  echo "int some_variable = 0;" > conftest.$ac_ext
+  (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+  (eval "$ac_compile" 2>conftest.err)
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+  (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
+  cat conftest.out >&AS_MESSAGE_LOG_FD
+  if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+    lt_cv_nm_interface="MS dumpbin"
+  fi
+  rm -f conftest*])
+])# LT_PATH_NM
+
+# Old names:
+AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
+AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_NM], [])
+dnl AC_DEFUN([AC_PROG_NM], [])
+
+# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+# --------------------------------
+# how to determine the name of the shared library
+# associated with a specific link library.
+#  -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+m4_require([_LT_DECL_DLLTOOL])
+AC_CACHE_CHECK([how to associate runtime and link libraries],
+lt_cv_sharedlib_from_linklib_cmd,
+[lt_cv_sharedlib_from_linklib_cmd='unknown'
+
+case $host_os in
+cygwin* | mingw* | pw32* | cegcc*)
+  # two different shell functions defined in ltmain.sh
+  # decide which to use based on capabilities of $DLLTOOL
+  case `$DLLTOOL --help 2>&1` in
+  *--identify-strict*)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+    ;;
+  *)
+    lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+    ;;
+  esac
+  ;;
+*)
+  # fallback: assume linklib IS sharedlib
+  lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+  ;;
+esac
+])
+sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
+test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
+
+_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
+    [Command to associate shared and link libraries])
+])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+
+
+# _LT_PATH_MANIFEST_TOOL
+# ----------------------
+# locate the manifest tool
+m4_defun([_LT_PATH_MANIFEST_TOOL],
+[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
+test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
+AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
+  [lt_cv_path_mainfest_tool=no
+  echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
+  $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
+  cat conftest.err >&AS_MESSAGE_LOG_FD
+  if $GREP 'Manifest Tool' conftest.out > /dev/null; then
+    lt_cv_path_mainfest_tool=yes
+  fi
+  rm -f conftest*])
+if test "x$lt_cv_path_mainfest_tool" != xyes; then
+  MANIFEST_TOOL=:
+fi
+_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
+])# _LT_PATH_MANIFEST_TOOL
+
+
+# LT_LIB_M
+# --------
+# check for math library
+AC_DEFUN([LT_LIB_M],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
+  # These system don't have libm, or don't need it
+  ;;
+*-ncr-sysv4.3*)
+  AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+  AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+  ;;
+*)
+  AC_CHECK_LIB(m, cos, LIBM="-lm")
+  ;;
+esac
+AC_SUBST([LIBM])
+])# LT_LIB_M
+
+# Old name:
+AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_CHECK_LIBM], [])
+
+
+# _LT_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------
+m4_defun([_LT_COMPILER_NO_RTTI],
+[m4_require([_LT_TAG_COMPILER])dnl
+
+_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+  case $cc_basename in
+  nvcc*)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
+  *)
+    _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
+  esac
+
+  _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+    lt_cv_prog_compiler_rtti_exceptions,
+    [-fno-rtti -fno-exceptions], [],
+    [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
+	[Compiler flag to turn off builtin functions])
+])# _LT_COMPILER_NO_RTTI
+
+
+# _LT_CMD_GLOBAL_SYMBOLS
+# ----------------------
+m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix.  What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+  symcode='[[BCDT]]'
+  ;;
+cygwin* | mingw* | pw32* | cegcc*)
+  symcode='[[ABCDGISTW]]'
+  ;;
+hpux*)
+  if test "$host_cpu" = ia64; then
+    symcode='[[ABCDEGRST]]'
+  fi
+  ;;
+irix* | nonstopux*)
+  symcode='[[BCDEGRST]]'
+  ;;
+osf*)
+  symcode='[[BCDEGQRST]]'
+  ;;
+solaris*)
+  symcode='[[BDRT]]'
+  ;;
+sco3.2v5*)
+  symcode='[[DT]]'
+  ;;
+sysv4.2uw2*)
+  symcode='[[DT]]'
+  ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+  symcode='[[ABDT]]'
+  ;;
+sysv4)
+  symcode='[[DFNSTU]]'
+  ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+  symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/  {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/  {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/  {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+  opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+  ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+  # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+  symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+  # Write the raw and C identifiers.
+  if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+    # Fake it for dumpbin and say T for any non-static function
+    # and D for any global variable.
+    # Also find C++ and __fastcall symbols from MSVC++,
+    # which start with @ or ?.
+    lt_cv_sys_global_symbol_pipe="$AWK ['"\
+"     {last_section=section; section=\$ 3};"\
+"     /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+"     \$ 0!~/External *\|/{next};"\
+"     / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+"     {if(hide[section]) next};"\
+"     {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+"     {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+"     s[1]~/^[@?]/{print s[1], s[1]; next};"\
+"     s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+"     ' prfx=^$ac_symprfx]"
+  else
+    lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[	 ]]\($symcode$symcode*\)[[	 ]][[	 ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+  fi
+  lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+
+  # Check to see that the pipe works correctly.
+  pipe_works=no
+
+  rm -f conftest*
+  cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+  if AC_TRY_EVAL(ac_compile); then
+    # Now try to grab the symbols.
+    nlist=conftest.nm
+    if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
+      # Try sorting and uniquifying the output.
+      if sort "$nlist" | uniq > "$nlist"T; then
+	mv -f "$nlist"T "$nlist"
+      else
+	rm -f "$nlist"T
+      fi
+
+      # Make sure that we snagged all the symbols we need.
+      if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+	if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+	  cat <<_LT_EOF > conftest.$ac_ext
+/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
+/* DATA imports from DLLs on WIN32 con't be const, because runtime
+   relocations are performed -- see ld's documentation on pseudo-relocs.  */
+# define LT@&t at _DLSYM_CONST
+#elif defined(__osf__)
+/* This system does not cope well with relocations in const data.  */
+# define LT@&t at _DLSYM_CONST
+#else
+# define LT@&t at _DLSYM_CONST const
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+	  # Now generate the symbol file.
+	  eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+	  cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols.  */
+LT@&t at _DLSYM_CONST struct {
+  const char *name;
+  void       *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[[]] =
+{
+  { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+	  $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/  {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+	  cat <<\_LT_EOF >> conftest.$ac_ext
+  {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+  return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+	  # Now try linking the two files.
+	  mv conftest.$ac_objext conftstm.$ac_objext
+	  lt_globsym_save_LIBS=$LIBS
+	  lt_globsym_save_CFLAGS=$CFLAGS
+	  LIBS="conftstm.$ac_objext"
+	  CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+	  if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+	    pipe_works=yes
+	  fi
+	  LIBS=$lt_globsym_save_LIBS
+	  CFLAGS=$lt_globsym_save_CFLAGS
+	else
+	  echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+	fi
+      else
+	echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+      fi
+    else
+      echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+    fi
+  else
+    echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+    cat conftest.$ac_ext >&5
+  fi
+  rm -rf conftest* conftst*
+
+  # Do not use the global_symbol_pipe unless it works.
+  if test "$pipe_works" = yes; then
+    break
+  else
+    lt_cv_sys_global_symbol_pipe=
+  fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+  lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+  AC_MSG_RESULT(failed)
+else
+  AC_MSG_RESULT(ok)
+fi
+
+# Response file support.
+if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+  nm_file_list_spec='@'
+elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
+  nm_file_list_spec='@'
+fi
+
+_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
+    [Take the output of nm and produce a listing of raw symbols and C names])
+_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
+    [Transform the output of nm in a proper C declaration])
+_LT_DECL([global_symbol_to_c_name_address],
+    [lt_cv_sys_global_symbol_to_c_name_address], [1],
+    [Transform the output of nm in a C name address pair])
+_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
+    [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
+    [Transform the output of nm in a C name address pair when lib prefix is needed])
+_LT_DECL([], [nm_file_list_spec], [1],
+    [Specify filename containing input files for $NM])
+]) # _LT_CMD_GLOBAL_SYMBOLS
+
+
+# _LT_COMPILER_PIC([TAGNAME])
+# ---------------------------
+m4_defun([_LT_COMPILER_PIC],
+[m4_require([_LT_TAG_COMPILER])dnl
+_LT_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_TAGVAR(lt_prog_compiler_static, $1)=
+
+m4_if([$1], [CXX], [
+  # C++ specific cases for pic, static, wl, etc.
+  if test "$GXX" = yes; then
+    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+    aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+    mingw* | cygwin* | os2* | pw32* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+    *djgpp*)
+      # DJGPP does not support shared libraries at all
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+      ;;
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)=
+      ;;
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+    *qnx* | *nto*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+    *)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+  else
+    case $host_os in
+      aix[[4-9]]*)
+	# All AIX code is PIC.
+	if test "$host_cpu" = ia64; then
+	  # AIX 5 now supports IA64 processor
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	else
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+	fi
+	;;
+      chorus*)
+	case $cc_basename in
+	cxch68*)
+	  # Green Hills C++ Compiler
+	  # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+	  ;;
+	esac
+	;;
+      mingw* | cygwin* | os2* | pw32* | cegcc*)
+	# This hack is so that the source file can tell whether it is being
+	# built for inclusion in a dll (and should export symbols for example).
+	m4_if([$1], [GCJ], [],
+	  [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+	;;
+      dgux*)
+	case $cc_basename in
+	  ec++*)
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  ghcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      freebsd* | dragonfly*)
+	# FreeBSD uses GNU C++
+	;;
+      hpux9* | hpux10* | hpux11*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    if test "$host_cpu" != ia64; then
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	    fi
+	    ;;
+	  aCC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+	    case $host_cpu in
+	    hppa*64*|ia64*)
+	      # +Z the default
+	      ;;
+	    *)
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	      ;;
+	    esac
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      interix*)
+	# This is c89, which is MS Visual C++ (no shared libs)
+	# Anyone wants to do a port?
+	;;
+      irix5* | irix6* | nonstopux*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    # CC pic flag -KPIC is the default.
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+	case $cc_basename in
+	  KCC*)
+	    # KAI C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	    ;;
+	  ecpc* )
+	    # old Intel C++ for x86_64 which still supported -KPIC.
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	    ;;
+	  icpc* )
+	    # Intel C++, used to be incompatible with GCC.
+	    # ICC 10 doesn't accept -KPIC any more.
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+	    ;;
+	  pgCC* | pgcpp*)
+	    # Portland Group C++ compiler
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  cxx*)
+	    # Compaq C++
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
+	    # IBM XL 8.0, 9.0 on PPC and BlueGene
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+      lynxos*)
+	;;
+      m88k*)
+	;;
+      mvs*)
+	case $cc_basename in
+	  cxx*)
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      netbsd* | netbsdelf*-gnu)
+	;;
+      *qnx* | *nto*)
+        # QNX uses GNU C++, but need to define -shared option too, otherwise
+        # it will coredump.
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+        ;;
+      osf3* | osf4* | osf5*)
+	case $cc_basename in
+	  KCC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+	    ;;
+	  RCC*)
+	    # Rational C++ 2.4.1
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  cxx*)
+	    # Digital/Compaq C++
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    # Make sure the PIC flag is empty.  It appears that all Alpha
+	    # Linux and Compaq Tru64 Unix objects are PIC.
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      psos*)
+	;;
+      solaris*)
+	case $cc_basename in
+	  CC* | sunCC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+	    ;;
+	  gcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sunos4*)
+	case $cc_basename in
+	  CC*)
+	    # Sun C++ 4.x
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	  lcc*)
+	    # Lucid
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+	case $cc_basename in
+	  CC*)
+	    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	    ;;
+	esac
+	;;
+      tandem*)
+	case $cc_basename in
+	  NCC*)
+	    # NonStop-UX NCC 3.20
+	    _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	    ;;
+	  *)
+	    ;;
+	esac
+	;;
+      vxworks*)
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+	;;
+    esac
+  fi
+],
+[
+  if test "$GCC" = yes; then
+    _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+    _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+    case $host_os in
+      aix*)
+      # All AIX code is PIC.
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+        ;;
+      m68k)
+            # FIXME: we need at least 68020 code to build shared libraries, but
+            # adding the `-m68020' flag to GCC prevents building anything better,
+            # like `-m68040'.
+            _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+        ;;
+      esac
+      ;;
+
+    beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+      # PIC is the default for these OSes.
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      # Although the cygwin gcc ignores -fPIC, still need this for old-style
+      # (--disable-auto-import) libraries
+      m4_if([$1], [GCJ], [],
+	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      ;;
+
+    haiku*)
+      # PIC is the default for Haiku.
+      # The "-static" flag exists, but is broken.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)=
+      ;;
+
+    hpux*)
+      # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+      # PA HP-UX.  On IA64 HP-UX, PIC is the default but the pic flag
+      # sets the default TLS model and affects inlining.
+      case $host_cpu in
+      hppa*64*)
+	# +Z the default
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	;;
+      esac
+      ;;
+
+    interix[[3-9]]*)
+      # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+      # Instead, we relocate shared libraries at runtime.
+      ;;
+
+    msdosdjgpp*)
+      # Just because we use GCC doesn't mean we suddenly get shared libraries
+      # on systems that don't support them.
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      enable_shared=no
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+      fi
+      ;;
+
+    *)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+      ;;
+    esac
+
+    case $cc_basename in
+    nvcc*) # Cuda Compiler Driver 2.2
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC'
+      ;;
+    esac
+  else
+    # PORTME Check for flag to pass linker flags through the system compiler.
+    case $host_os in
+    aix*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      if test "$host_cpu" = ia64; then
+	# AIX 5 now supports IA64 processor
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      else
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+      fi
+      ;;
+
+    mingw* | cygwin* | pw32* | os2* | cegcc*)
+      # This hack is so that the source file can tell whether it is being
+      # built for inclusion in a dll (and should export symbols for example).
+      m4_if([$1], [GCJ], [],
+	[_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+      ;;
+
+    hpux9* | hpux10* | hpux11*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+      # not for PA HP-UX.
+      case $host_cpu in
+      hppa*64*|ia64*)
+	# +Z the default
+	;;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+	;;
+      esac
+      # Is there a better lt_prog_compiler_static that works with the bundled CC?
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # PIC (with -KPIC) is the default.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      case $cc_basename in
+      # old Intel for x86_64 which still supported -KPIC.
+      ecc*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      # icc used to be incompatible with GCC.
+      # ICC 10 doesn't accept -KPIC any more.
+      icc* | ifort*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+        ;;
+      # Lahey Fortran 8.1.
+      lf95*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
+	;;
+      nagfor*)
+	# NAG Fortran compiler
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	;;
+      pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+        # Portland Group compilers (*not* the Pentium gcc compiler,
+	# which looks to be a dead project)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+        ;;
+      ccc*)
+        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+        # All Alpha code is PIC.
+        _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+        ;;
+      xl* | bgxl* | bgf* | mpixl*)
+	# IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+	;;
+      *)
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ F* | *Sun*Fortran*)
+	  # Sun Fortran 8.3 passes all unrecognized flags to the linker
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
+	  ;;
+	*Sun\ C*)
+	  # Sun C 5.9
+	  _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+	  _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+	  _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+	  ;;
+	esac
+	;;
+      esac
+      ;;
+
+    newsos6)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *nto* | *qnx*)
+      # QNX uses GNU C++, but need to define -shared option too, otherwise
+      # it will coredump.
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+      ;;
+
+    osf3* | osf4* | osf5*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      # All OSF/1 code is PIC.
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    rdos*)
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+      ;;
+
+    solaris*)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      case $cc_basename in
+      f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+      *)
+	_LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec ;then
+	_LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+	_LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      fi
+      ;;
+
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    unicos*)
+      _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+
+    uts4*)
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+      _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+      ;;
+
+    *)
+      _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+      ;;
+    esac
+  fi
+])
+case $host_os in
+  # For platforms which do not support PIC, -DPIC is meaningless:
+  *djgpp*)
+    _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+    ;;
+  *)
+    _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t at m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
+    ;;
+esac
+
+AC_CACHE_CHECK([for $compiler option to produce PIC],
+  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
+  [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+  _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
+    [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
+    [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t at m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
+    [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
+     "" | " "*) ;;
+     *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+     esac],
+    [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+     _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
+	[Additional compiler flags for building library objects])
+
+_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
+	[How to pass a linker flag through the compiler])
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
+_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+  _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
+  $lt_tmp_static_flag,
+  [],
+  [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
+_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
+	[Compiler flag to prevent dynamic linking])
+])# _LT_COMPILER_PIC
+
+
+# _LT_LINKER_SHLIBS([TAGNAME])
+# ----------------------------
+# See if the linker supports building shared libraries.
+m4_defun([_LT_LINKER_SHLIBS],
+[AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+m4_if([$1], [CXX], [
+  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+  case $host_os in
+  aix[[4-9]]*)
+    # If we're using GNU nm, then we don't want the "-C" option.
+    # -C means demangle to AIX nm, but means don't demangle with GNU nm
+    # Also, AIX nm treats weak defined symbols like other global defined
+    # symbols, whereas GNU nm marks them as "W".
+    if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    else
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+    fi
+    ;;
+  pw32*)
+    _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+    ;;
+  cygwin* | mingw* | cegcc*)
+    case $cc_basename in
+    cl*) ;;
+    *)
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+      ;;
+    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'
+    ;;
+  esac
+], [
+  runpath_var=
+  _LT_TAGVAR(allow_undefined_flag, $1)=
+  _LT_TAGVAR(always_export_symbols, $1)=no
+  _LT_TAGVAR(archive_cmds, $1)=
+  _LT_TAGVAR(archive_expsym_cmds, $1)=
+  _LT_TAGVAR(compiler_needs_object, $1)=no
+  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+  _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+  _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+  _LT_TAGVAR(hardcode_automatic, $1)=no
+  _LT_TAGVAR(hardcode_direct, $1)=no
+  _LT_TAGVAR(hardcode_direct_absolute, $1)=no
+  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+  _LT_TAGVAR(hardcode_libdir_separator, $1)=
+  _LT_TAGVAR(hardcode_minus_L, $1)=no
+  _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+  _LT_TAGVAR(inherit_rpath, $1)=no
+  _LT_TAGVAR(link_all_deplibs, $1)=unknown
+  _LT_TAGVAR(module_cmds, $1)=
+  _LT_TAGVAR(module_expsym_cmds, $1)=
+  _LT_TAGVAR(old_archive_from_new_cmds, $1)=
+  _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+  _LT_TAGVAR(thread_safe_flag_spec, $1)=
+  _LT_TAGVAR(whole_archive_flag_spec, $1)=
+  # include_expsyms should be a list of space-separated symbols to be *always*
+  # included in the symbol list
+  _LT_TAGVAR(include_expsyms, $1)=
+  # exclude_expsyms can be an extended regexp of symbols to exclude
+  # it will be wrapped by ` (' and `)$', so one must not match beginning or
+  # end of line.  Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+  # as well as any symbol that contains `d'.
+  _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+  # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+  # platforms (ab)use it in PIC code, but their linkers get confused if
+  # the symbol is explicitly referenced.  Since portable code cannot
+  # rely on this symbol name, it's probably fine to never include it in
+  # preloaded symbol tables.
+  # Exclude shared library initialization/finalization symbols.
+dnl Note also adjust exclude_expsyms for C++ above.
+  extract_expsyms_cmds=
+
+  case $host_os in
+  cygwin* | mingw* | pw32* | cegcc*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+  linux* | k*bsd*-gnu | gnu*)
+    _LT_TAGVAR(link_all_deplibs, $1)=no
+    ;;
+  esac
+
+  _LT_TAGVAR(ld_shlibs, $1)=yes
+
+  # On some targets, GNU ld is compatible enough with the native linker
+  # that we're better off using the native interface for both.
+  lt_use_gnu_ld_interface=no
+  if test "$with_gnu_ld" = yes; then
+    case $host_os in
+      aix*)
+	# The AIX port of GNU ld has always aspired to compatibility
+	# with the native linker.  However, as the warning in the GNU ld
+	# block says, versions before 2.19.5* couldn't really create working
+	# shared libraries, regardless of the interface used.
+	case `$LD -v 2>&1` in
+	  *\ \(GNU\ Binutils\)\ 2.19.5*) ;;
+	  *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;;
+	  *\ \(GNU\ Binutils\)\ [[3-9]]*) ;;
+	  *)
+	    lt_use_gnu_ld_interface=yes
+	    ;;
+	esac
+	;;
+      *)
+	lt_use_gnu_ld_interface=yes
+	;;
+    esac
+  fi
+
+  if test "$lt_use_gnu_ld_interface" = yes; then
+    # If archive_cmds runs LD, not CC, wlarc should be empty
+    wlarc='${wl}'
+
+    # Set some defaults for GNU ld with shared library support. These
+    # are reset later if shared libraries are not supported. Putting them
+    # here allows them to be overridden if necessary.
+    runpath_var=LD_RUN_PATH
+    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+    # ancient GNU ld didn't support --whole-archive et. al.
+    if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+      _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+    else
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+    supports_anon_versioning=no
+    case `$LD -v 2>&1` in
+      *GNU\ gold*) supports_anon_versioning=yes ;;
+      *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+      *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+      *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+      *\ 2.11.*) ;; # other 2.11 versions
+      *) supports_anon_versioning=yes ;;
+    esac
+
+    # See if GNU ld supports shared libraries.
+    case $host_os in
+    aix[[3-9]]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support.  If you
+*** really care for shared libraries, you may want to install binutils
+*** 2.20 or above, or modify your PATH so that a non-GNU linker is found.
+*** You will then need to restart the configuration process.
+
+_LT_EOF
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_expsym_cmds, $1)=''
+        ;;
+      m68k)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes
+        ;;
+      esac
+      ;;
+
+    beos*)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	# Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
+	# support --undefined.  This deserves some investigation.  FIXME
+	_LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+      # as there is no search path for DLLs.
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(always_export_symbols, $1)=no
+      _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+      _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+      _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
+
+      if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	# If the export-symbols file already is a .def file (1st line
+	# is EXPORTS), use it as is; otherwise, prepend...
+	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	  cp $export_symbols $output_objdir/$soname.def;
+	else
+	  echo EXPORTS > $output_objdir/$soname.def;
+	  cat $export_symbols >> $output_objdir/$soname.def;
+	fi~
+	$CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    haiku*)
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    interix[[3-9]]*)
+      _LT_TAGVAR(hardcode_direct, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+      # Instead, shared libraries are loaded at an image base (0x10000000 by
+      # default) and relocated if they conflict, which is a slow very memory
+      # consuming and fragmenting process.  To avoid this, we pick a random,
+      # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+      # time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+      ;;
+
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+      tmp_diet=no
+      if test "$host_os" = linux-dietlibc; then
+	case $cc_basename in
+	  diet\ *) tmp_diet=yes;;	# linux-dietlibc with static linking (!diet-dyn)
+	esac
+      fi
+      if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+	 && test "$tmp_diet" = no
+      then
+	tmp_addflag=' $pic_flag'
+	tmp_sharedflag='-shared'
+	case $cc_basename,$host_cpu in
+        pgcc*)				# Portland Group C compiler
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag'
+	  ;;
+	pgf77* | pgf90* | pgf95* | pgfortran*)
+					# Portland Group f77 and f90 compilers
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  tmp_addflag=' $pic_flag -Mnomain' ;;
+	ecc*,ia64* | icc*,ia64*)	# Intel C compiler on ia64
+	  tmp_addflag=' -i_dynamic' ;;
+	efc*,ia64* | ifort*,ia64*)	# Intel Fortran compiler on ia64
+	  tmp_addflag=' -i_dynamic -nofor_main' ;;
+	ifc* | ifort*)			# Intel Fortran compiler
+	  tmp_addflag=' -nofor_main' ;;
+	lf95*)				# Lahey Fortran 8.1
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)=
+	  tmp_sharedflag='--shared' ;;
+	xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+	  tmp_sharedflag='-qmkshrobj'
+	  tmp_addflag= ;;
+	nvcc*)	# Cuda Compiler Driver 2.2
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(compiler_needs_object, $1)=yes
+	  ;;
+	esac
+	case `$CC -V 2>&1 | sed 5q` in
+	*Sun\ C*)			# Sun C 5.9
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	  _LT_TAGVAR(compiler_needs_object, $1)=yes
+	  tmp_sharedflag='-G' ;;
+	*Sun\ F*)			# Sun Fortran 8.3
+	  tmp_sharedflag='-G' ;;
+	esac
+	_LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+        if test "x$supports_anon_versioning" = xyes; then
+          _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+	    cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	    echo "local: *; };" >> $output_objdir/$libname.ver~
+	    $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+        fi
+
+	case $cc_basename in
+	xlf* | bgf* | bgxlf* | mpixlf*)
+	  # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+	  _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
+	  if test "x$supports_anon_versioning" = xyes; then
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+	      cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+	      echo "local: *; };" >> $output_objdir/$libname.ver~
+	      $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+	  fi
+	  ;;
+	esac
+      else
+        _LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+	wlarc=
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      fi
+      ;;
+
+    solaris*)
+      if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+      elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems.  Therefore, libtool
+*** is disabling shared libraries support.  We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer.  Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+	;;
+	*)
+	  # For security reasons, it is highly recommended that you always
+	  # use absolute paths for naming shared libraries, and exclude the
+	  # DT_RUNPATH tag from executables and libraries.  But doing so
+	  # requires that you compile everything twice, which is a pain.
+	  if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+	  else
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	  fi
+	;;
+      esac
+      ;;
+
+    sunos4*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      wlarc=
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+    esac
+
+    if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
+      runpath_var=
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+      _LT_TAGVAR(whole_archive_flag_spec, $1)=
+    fi
+  else
+    # PORTME fill in a description of your system's linker (not GNU ld)
+    case $host_os in
+    aix3*)
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(always_export_symbols, $1)=yes
+      _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+	# Neither direct hardcoding nor static linking is supported with a
+	# broken collect2.
+	_LT_TAGVAR(hardcode_direct, $1)=unsupported
+      fi
+      ;;
+
+    aix[[4-9]]*)
+      if test "$host_cpu" = ia64; then
+	# On IA64, the linker does run time linking by default, so we don't
+	# have to do anything special.
+	aix_use_runtimelinking=no
+	exp_sym_flag='-Bexport'
+	no_entry_flag=""
+      else
+	# If we're using GNU nm, then we don't want the "-C" option.
+	# -C means demangle to AIX nm, but means don't demangle with GNU nm
+	# Also, AIX nm treats weak defined symbols like other global
+	# defined symbols, whereas GNU nm marks them as "W".
+	if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	else
+	  _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+	fi
+	aix_use_runtimelinking=no
+
+	# Test if we are trying to use run time linking or normal
+	# AIX style linking. If -brtl is somewhere in LDFLAGS, we
+	# need to do runtime linking.
+	case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+	  for ld_flag in $LDFLAGS; do
+	  if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+	    aix_use_runtimelinking=yes
+	    break
+	  fi
+	  done
+	  ;;
+	esac
+
+	exp_sym_flag='-bexport'
+	no_entry_flag='-bnoentry'
+      fi
+
+      # When large executables or shared objects are built, AIX ld can
+      # have problems creating the table of contents.  If linking a library
+      # or program results in "error TOC overflow" add -mminimal-toc to
+      # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+      # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+      _LT_TAGVAR(archive_cmds, $1)=''
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+      if test "$GCC" = yes; then
+	case $host_os in aix4.[[012]]|aix4.[[012]].*)
+	# We only want to do this on AIX 4.2 and lower, the check
+	# below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	   strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	  # We have reworked collect2
+	  :
+	  else
+	  # We have old collect2
+	  _LT_TAGVAR(hardcode_direct, $1)=unsupported
+	  # It fails to find uninstalled libraries when the uninstalled
+	  # path is not listed in the libpath.  Setting hardcode_minus_L
+	  # to unsupported forces relinking
+	  _LT_TAGVAR(hardcode_minus_L, $1)=yes
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	  _LT_TAGVAR(hardcode_libdir_separator, $1)=
+	  fi
+	  ;;
+	esac
+	shared_flag='-shared'
+	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
+	# VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	# chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+	else
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag='${wl}-G'
+	  else
+	    shared_flag='${wl}-bM:SRE'
+	  fi
+	fi
+      fi
+
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+      # It seems that -bexpall does not export symbols beginning with
+      # underscore (_), so it is better to generate a list of symbols to export.
+      _LT_TAGVAR(always_export_symbols, $1)=yes
+      if test "$aix_use_runtimelinking" = yes; then
+	# Warning - without using the other runtime loading flags (-brtl),
+	# -berok will link without error, but may produce a broken library.
+	_LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+        # Determine the default libpath from the value encoded in an
+        # empty executable.
+        _LT_SYS_MODULE_PATH_AIX([$1])
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+      else
+	if test "$host_cpu" = ia64; then
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	  _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+	else
+	 # Determine the default libpath from the value encoded in an
+	 # empty executable.
+	 _LT_SYS_MODULE_PATH_AIX([$1])
+	 _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	  # Warning - without using the other run time loading flags,
+	  # -berok will link without error, but may produce a broken library.
+	  _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	  _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	  if test "$with_gnu_ld" = yes; then
+	    # We only use this code for GNU lds that support --whole-archive.
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	  else
+	    # Exported symbols can be pulled into shared objects from archives
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	  fi
+	  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	  # This is similar to how AIX traditionally builds its shared libraries.
+	  _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+	fi
+      fi
+      ;;
+
+    amigaos*)
+      case $host_cpu in
+      powerpc)
+            # see comment about AmigaOS4 .so support
+            _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+            _LT_TAGVAR(archive_expsym_cmds, $1)=''
+        ;;
+      m68k)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+            _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes
+        ;;
+      esac
+      ;;
+
+    bsdi[[45]]*)
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+      ;;
+
+    cygwin* | mingw* | pw32* | cegcc*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      case $cc_basename in
+      cl*)
+	# Native MSVC
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	_LT_TAGVAR(always_export_symbols, $1)=yes
+	_LT_TAGVAR(file_list_spec, $1)='@'
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	_LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	    sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	  else
+	    sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	  fi~
+	  $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	  linknames='
+	# The linker will not automatically build a static lib if we build a DLL.
+	# _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	_LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+	# Don't use ranlib
+	_LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+	_LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+	  lt_tool_outputfile="@TOOL_OUTPUT@"~
+	  case $lt_outputfile in
+	    *.exe|*.EXE) ;;
+	    *)
+	      lt_outputfile="$lt_outputfile.exe"
+	      lt_tool_outputfile="$lt_tool_outputfile.exe"
+	      ;;
+	  esac~
+	  if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	    $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	    $RM "$lt_outputfile.manifest";
+	  fi'
+	;;
+      *)
+	# Assume MSVC wrapper
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	_LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	# Tell ltmain to make .lib files, not .a files.
+	libext=lib
+	# Tell ltmain to make .dll files, not .so files.
+	shrext_cmds=".dll"
+	# FIXME: Setting linknames here is a bad hack.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
+	# The linker will automatically build a .lib file if we build a DLL.
+	_LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	# FIXME: Should let the user specify the lib program.
+	_LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+	_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	;;
+      esac
+      ;;
+
+    darwin* | rhapsody*)
+      _LT_DARWIN_LINKER_FEATURES($1)
+      ;;
+
+    dgux*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    freebsd1*)
+      _LT_TAGVAR(ld_shlibs, $1)=no
+      ;;
+
+    # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+    # support.  Future versions do this automatically, but an explicit c++rt0.o
+    # does not break anything, and helps significantly (at the cost of a little
+    # extra space).
+    freebsd2.2*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+    freebsd2*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+    freebsd* | dragonfly*)
+      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    hpux9*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+      ;;
+
+    hpux10*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
+	_LT_TAGVAR(hardcode_direct, $1)=yes
+	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	# hardcode_minus_L: Not really in the search PATH,
+	# but as the default location of the library.
+	_LT_TAGVAR(hardcode_minus_L, $1)=yes
+      fi
+      ;;
+
+    hpux11*)
+      if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+	case $host_cpu in
+	hppa*64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	esac
+      else
+	case $host_cpu in
+	hppa*64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	ia64*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	m4_if($1, [], [
+	  # Older versions of the 11.00 compiler do not understand -b yet
+	  # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
+	  _LT_LINKER_OPTION([if $CC understands -b],
+	    _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
+	    [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
+	    [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
+	  [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
+	  ;;
+	esac
+      fi
+      if test "$with_gnu_ld" = no; then
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	case $host_cpu in
+	hppa*64*|ia64*)
+	  _LT_TAGVAR(hardcode_direct, $1)=no
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	  ;;
+	*)
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+	  # hardcode_minus_L: Not really in the search PATH,
+	  # but as the default location of the library.
+	  _LT_TAGVAR(hardcode_minus_L, $1)=yes
+	  ;;
+	esac
+      fi
+      ;;
+
+    irix5* | irix6* | nonstopux*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	# Try to use the -exported_symbol ld option, if it does not
+	# work, assume that -exports_file does not work either and
+	# implicitly export all symbols.
+	# This should be the same for all languages, so no per-tag cache variable.
+	AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
+	  [lt_cv_irix_exported_symbol],
+	  [save_LDFLAGS="$LDFLAGS"
+	   LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+	   AC_LINK_IFELSE(
+	     [AC_LANG_SOURCE(
+	        [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
+			      [C++], [[int foo (void) { return 0; }]],
+			      [Fortran 77], [[
+      subroutine foo
+      end]],
+			      [Fortran], [[
+      subroutine foo
+      end]])])],
+	      [lt_cv_irix_exported_symbol=yes],
+	      [lt_cv_irix_exported_symbol=no])
+           LDFLAGS="$save_LDFLAGS"])
+	if test "$lt_cv_irix_exported_symbol" = yes; then
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+	fi
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(inherit_rpath, $1)=yes
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    netbsd* | netbsdelf*-gnu)
+      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
+	_LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags'      # ELF
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    newsos6)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *nto* | *qnx*)
+      ;;
+
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+	_LT_TAGVAR(hardcode_direct, $1)=yes
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	else
+	  case $host_os in
+	   openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+	     _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	     ;;
+	   *)
+	     _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+	     _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	     ;;
+	  esac
+	fi
+      else
+	_LT_TAGVAR(ld_shlibs, $1)=no
+      fi
+      ;;
+
+    os2*)
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+      _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+      _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+      ;;
+
+    osf3*)
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+      else
+	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    osf4* | osf5*)	# as osf3* with the addition of -msym flag
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+      else
+	_LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+	$CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+	# Both c and cxx compiler support -rpath directly
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+      fi
+      _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+      ;;
+
+    solaris*)
+      _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
+      if test "$GCC" = yes; then
+	wlarc='${wl}'
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+      else
+	case `$CC -V 2>&1` in
+	*"Compilers 5.0"*)
+	  wlarc=''
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+	  ;;
+	*)
+	  wlarc='${wl}'
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	  $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+	  ;;
+	esac
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      case $host_os in
+      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+      *)
+	# The compiler driver will combine and reorder linker options,
+	# but understands `-z linker_flag'.  GCC discards it without `$wl',
+	# but is careful enough not to reorder.
+	# Supported since Solaris 2.6 (maybe 2.5.1?)
+	if test "$GCC" = yes; then
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+	else
+	  _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+	fi
+	;;
+      esac
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      ;;
+
+    sunos4*)
+      if test "x$host_vendor" = xsequent; then
+	# Use $CC to link under sequent, because it throws in some extra .o
+	# files that make .init and .fini sections work.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+      fi
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_direct, $1)=yes
+      _LT_TAGVAR(hardcode_minus_L, $1)=yes
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4)
+      case $host_vendor in
+	sni)
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+	;;
+	siemens)
+	  ## LD is ld it makes a PLAMLIB
+	  ## CC just makes a GrossModule.
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+	  _LT_TAGVAR(hardcode_direct, $1)=no
+        ;;
+	motorola)
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	  _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+	;;
+      esac
+      runpath_var='LD_RUN_PATH'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    sysv4.3*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+      ;;
+
+    sysv4*MP*)
+      if test -d /usr/nec; then
+	_LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	runpath_var=LD_RUN_PATH
+	hardcode_runpath_var=yes
+	_LT_TAGVAR(ld_shlibs, $1)=yes
+      fi
+      ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    sysv5* | sco3.2v5* | sco5v6*)
+      # Note: We can NOT use -z defs as we might desire, because we do not
+      # link with -lc, and that would cause any symbols used from libc to
+      # always be unresolved, which means just about no library would
+      # ever link correctly.  If we're not using GNU ld we use -z text
+      # though, which does catch some bad symbols but isn't as heavy-handed
+      # as -z defs.
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+      _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+      _LT_TAGVAR(link_all_deplibs, $1)=yes
+      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+      runpath_var='LD_RUN_PATH'
+
+      if test "$GCC" = yes; then
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      else
+	_LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+      fi
+      ;;
+
+    uts4*)
+      _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      ;;
+
+    *)
+      _LT_TAGVAR(ld_shlibs, $1)=no
+      ;;
+    esac
+
+    if test x$host_vendor = xsni; then
+      case $host in
+      sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
+	;;
+      esac
+    fi
+  fi
+])
+AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
+
+_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
+_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
+_LT_DECL([], [extract_expsyms_cmds], [2],
+    [The commands to extract the exported symbol list from a shared archive])
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+  # Assume -lc should be added
+  _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+  if test "$enable_shared" = yes && test "$GCC" = yes; then
+    case $_LT_TAGVAR(archive_cmds, $1) in
+    *'~'*)
+      # FIXME: we may have to deal with multi-command sequences.
+      ;;
+    '$CC '*)
+      # Test whether the compiler implicitly links with -lc since on some
+      # systems, -lgcc has to come before -lc. If gcc already passes -lc
+      # to ld, don't add -lc before -lgcc.
+      AC_CACHE_CHECK([whether -lc should be explicitly linked in],
+	[lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
+	[$RM conftest*
+	echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+	if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+	  soname=conftest
+	  lib=conftest
+	  libobjs=conftest.$ac_objext
+	  deplibs=
+	  wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
+	  pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+	  compiler_flags=-v
+	  linker_flags=-v
+	  verstring=
+	  output_objdir=.
+	  libname=conftest
+	  lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+	  _LT_TAGVAR(allow_undefined_flag, $1)=
+	  if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+	  then
+	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	  else
+	    lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	  fi
+	  _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+	else
+	  cat conftest.err 1>&5
+	fi
+	$RM conftest*
+	])
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
+      ;;
+    esac
+  fi
+  ;;
+esac
+
+_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
+    [Whether or not to add -lc for building shared libraries])
+_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
+    [enable_shared_with_static_runtimes], [0],
+    [Whether or not to disallow shared libs when runtime libs are static])
+_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
+    [Compiler flag to allow reflexive dlopens])
+_LT_TAGDECL([], [whole_archive_flag_spec], [1],
+    [Compiler flag to generate shared objects directly from archives])
+_LT_TAGDECL([], [compiler_needs_object], [1],
+    [Whether the compiler copes with passing no objects directly])
+_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
+    [Create an old-style archive from a shared archive])
+_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
+    [Create a temporary old-style archive to link instead of a shared archive])
+_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
+_LT_TAGDECL([], [archive_expsym_cmds], [2])
+_LT_TAGDECL([], [module_cmds], [2],
+    [Commands used to build a loadable module if different from building
+    a shared archive.])
+_LT_TAGDECL([], [module_expsym_cmds], [2])
+_LT_TAGDECL([], [with_gnu_ld], [1],
+    [Whether we are building with GNU ld or not])
+_LT_TAGDECL([], [allow_undefined_flag], [1],
+    [Flag that allows shared libraries with undefined symbols to be built])
+_LT_TAGDECL([], [no_undefined_flag], [1],
+    [Flag that enforces no undefined symbols])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
+    [Flag to hardcode $libdir into a binary during linking.
+    This must work even if $libdir does not exist])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1],
+    [[If ld is used when linking, flag to hardcode $libdir into a binary
+    during linking.  This must work even if $libdir does not exist]])
+_LT_TAGDECL([], [hardcode_libdir_separator], [1],
+    [Whether we need a single "-rpath" flag with a separated argument])
+_LT_TAGDECL([], [hardcode_direct], [0],
+    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+    DIR into the resulting binary])
+_LT_TAGDECL([], [hardcode_direct_absolute], [0],
+    [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+    DIR into the resulting binary and the resulting library dependency is
+    "absolute", i.e impossible to change by setting ${shlibpath_var} if the
+    library is relocated])
+_LT_TAGDECL([], [hardcode_minus_L], [0],
+    [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+    into the resulting binary])
+_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
+    [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+    into the resulting binary])
+_LT_TAGDECL([], [hardcode_automatic], [0],
+    [Set to "yes" if building a shared library automatically hardcodes DIR
+    into the library and all subsequent libraries and executables linked
+    against it])
+_LT_TAGDECL([], [inherit_rpath], [0],
+    [Set to yes if linker adds runtime paths of dependent libraries
+    to runtime path list])
+_LT_TAGDECL([], [link_all_deplibs], [0],
+    [Whether libtool must link a program against all its dependency libraries])
+_LT_TAGDECL([], [always_export_symbols], [0],
+    [Set to "yes" if exported symbols are required])
+_LT_TAGDECL([], [export_symbols_cmds], [2],
+    [The commands to list exported symbols])
+_LT_TAGDECL([], [exclude_expsyms], [1],
+    [Symbols that should not be listed in the preloaded symbols])
+_LT_TAGDECL([], [include_expsyms], [1],
+    [Symbols that must always be exported])
+_LT_TAGDECL([], [prelink_cmds], [2],
+    [Commands necessary for linking programs (against libraries) with templates])
+_LT_TAGDECL([], [postlink_cmds], [2],
+    [Commands necessary for finishing linking programs])
+_LT_TAGDECL([], [file_list_spec], [1],
+    [Specify filename containing input files])
+dnl FIXME: Not yet implemented
+dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
+dnl    [Compiler flag to generate thread safe objects])
+])# _LT_LINKER_SHLIBS
+
+
+# _LT_LANG_C_CONFIG([TAG])
+# ------------------------
+# Ensure that the configuration variables for a C compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_C_CONFIG],
+[m4_require([_LT_DECL_EGREP])dnl
+lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+_LT_TAG_COMPILER
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_SYS_DYNAMIC_LINKER($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+  LT_SYS_DLOPEN_SELF
+  _LT_CMD_STRIPLIB
+
+  # Report which library types will actually be built
+  AC_MSG_CHECKING([if libtool supports shared libraries])
+  AC_MSG_RESULT([$can_build_shared])
+
+  AC_MSG_CHECKING([whether to build shared libraries])
+  test "$can_build_shared" = "no" && enable_shared=no
+
+  # On AIX, shared libraries and static libraries use the same namespace, and
+  # are all built from PIC.
+  case $host_os in
+  aix3*)
+    test "$enable_shared" = yes && enable_static=no
+    if test -n "$RANLIB"; then
+      archive_cmds="$archive_cmds~\$RANLIB \$lib"
+      postinstall_cmds='$RANLIB $lib'
+    fi
+    ;;
+
+  aix[[4-9]]*)
+    if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+      test "$enable_shared" = yes && enable_static=no
+    fi
+    ;;
+  esac
+  AC_MSG_RESULT([$enable_shared])
+
+  AC_MSG_CHECKING([whether to build static libraries])
+  # Make sure either enable_shared or enable_static is yes.
+  test "$enable_shared" = yes || enable_static=yes
+  AC_MSG_RESULT([$enable_static])
+
+  _LT_CONFIG($1)
+fi
+AC_LANG_POP
+CC="$lt_save_CC"
+])# _LT_LANG_C_CONFIG
+
+
+# _LT_LANG_CXX_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a C++ compiler are suitably
+# defined.  These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_CXX_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_PATH_MANIFEST_TOOL])dnl
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+    ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+    (test "X$CXX" != "Xg++"))) ; then
+  AC_PROG_CXXCPP
+else
+  _lt_caught_CXX_error=yes
+fi
+
+AC_LANG_PUSH(C++)
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(compiler_needs_object, $1)=no
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="int some_variable = 0;"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC=$CC
+  lt_save_CFLAGS=$CFLAGS
+  lt_save_LD=$LD
+  lt_save_GCC=$GCC
+  GCC=$GXX
+  lt_save_with_gnu_ld=$with_gnu_ld
+  lt_save_path_LD=$lt_cv_path_LD
+  if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+    lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+  else
+    $as_unset lt_cv_prog_gnu_ld
+  fi
+  if test -n "${lt_cv_path_LDCXX+set}"; then
+    lt_cv_path_LD=$lt_cv_path_LDCXX
+  else
+    $as_unset lt_cv_path_LD
+  fi
+  test -z "${LDCXX+set}" || LD=$LDCXX
+  CC=${CXX-"c++"}
+  CFLAGS=$CXXFLAGS
+  compiler=$CC
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+
+  if test -n "$compiler"; then
+    # We don't want -fno-exception when compiling C++ code, so set the
+    # no_builtin_flag separately
+    if test "$GXX" = yes; then
+      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+    else
+      _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+    fi
+
+    if test "$GXX" = yes; then
+      # Set up default GNU C++ configuration
+
+      LT_PATH_LD
+
+      # Check if GNU C++ uses GNU ld as the underlying linker, since the
+      # archiving commands below assume that GNU ld is being used.
+      if test "$with_gnu_ld" = yes; then
+        _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+        # If archive_cmds runs LD, not CC, wlarc should be empty
+        # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+        #     investigate it a little bit more. (MM)
+        wlarc='${wl}'
+
+        # ancient GNU ld didn't support --whole-archive et. al.
+        if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+	  $GREP 'no-whole-archive' > /dev/null; then
+          _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+        else
+          _LT_TAGVAR(whole_archive_flag_spec, $1)=
+        fi
+      else
+        with_gnu_ld=no
+        wlarc=
+
+        # A generic and very simple default shared library creation
+        # command for GNU C++ for the case where it uses the native
+        # linker, instead of GNU ld.  If possible, this setting should
+        # overridden to take advantage of the native linker features on
+        # the platform it is being used on.
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+      fi
+
+      # Commands to make compiler produce verbose output that lists
+      # what "hidden" libraries, object files and flags are used when
+      # linking a shared library.
+      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+    else
+      GXX=no
+      with_gnu_ld=no
+      wlarc=
+    fi
+
+    # PORTME: fill in a description of your system's C++ link characteristics
+    AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+    _LT_TAGVAR(ld_shlibs, $1)=yes
+    case $host_os in
+      aix3*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+      aix[[4-9]]*)
+        if test "$host_cpu" = ia64; then
+          # On IA64, the linker does run time linking by default, so we don't
+          # have to do anything special.
+          aix_use_runtimelinking=no
+          exp_sym_flag='-Bexport'
+          no_entry_flag=""
+        else
+          aix_use_runtimelinking=no
+
+          # Test if we are trying to use run time linking or normal
+          # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+          # need to do runtime linking.
+          case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*)
+	    for ld_flag in $LDFLAGS; do
+	      case $ld_flag in
+	      *-brtl*)
+	        aix_use_runtimelinking=yes
+	        break
+	        ;;
+	      esac
+	    done
+	    ;;
+          esac
+
+          exp_sym_flag='-bexport'
+          no_entry_flag='-bnoentry'
+        fi
+
+        # When large executables or shared objects are built, AIX ld can
+        # have problems creating the table of contents.  If linking a library
+        # or program results in "error TOC overflow" add -mminimal-toc to
+        # CXXFLAGS/CFLAGS for g++/gcc.  In the cases where that is not
+        # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+        _LT_TAGVAR(archive_cmds, $1)=''
+        _LT_TAGVAR(hardcode_direct, $1)=yes
+        _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+        _LT_TAGVAR(link_all_deplibs, $1)=yes
+        _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+        if test "$GXX" = yes; then
+          case $host_os in aix4.[[012]]|aix4.[[012]].*)
+          # We only want to do this on AIX 4.2 and lower, the check
+          # below for broken collect2 doesn't work under 4.3+
+	  collect2name=`${CC} -print-prog-name=collect2`
+	  if test -f "$collect2name" &&
+	     strings "$collect2name" | $GREP resolve_lib_name >/dev/null
+	  then
+	    # We have reworked collect2
+	    :
+	  else
+	    # We have old collect2
+	    _LT_TAGVAR(hardcode_direct, $1)=unsupported
+	    # It fails to find uninstalled libraries when the uninstalled
+	    # path is not listed in the libpath.  Setting hardcode_minus_L
+	    # to unsupported forces relinking
+	    _LT_TAGVAR(hardcode_minus_L, $1)=yes
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=
+	  fi
+          esac
+          shared_flag='-shared'
+	  if test "$aix_use_runtimelinking" = yes; then
+	    shared_flag="$shared_flag "'${wl}-G'
+	  fi
+        else
+          # not using gcc
+          if test "$host_cpu" = ia64; then
+	  # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+	  # chokes on -Wl,-G. The following line is correct:
+	  shared_flag='-G'
+          else
+	    if test "$aix_use_runtimelinking" = yes; then
+	      shared_flag='${wl}-G'
+	    else
+	      shared_flag='${wl}-bM:SRE'
+	    fi
+          fi
+        fi
+
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+        # It seems that -bexpall does not export symbols beginning with
+        # underscore (_), so it is better to generate a list of symbols to
+	# export.
+        _LT_TAGVAR(always_export_symbols, $1)=yes
+        if test "$aix_use_runtimelinking" = yes; then
+          # Warning - without using the other runtime loading flags (-brtl),
+          # -berok will link without error, but may produce a broken library.
+          _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+          # Determine the default libpath from the value encoded in an empty
+          # executable.
+          _LT_SYS_MODULE_PATH_AIX([$1])
+          _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+          _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+        else
+          if test "$host_cpu" = ia64; then
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+	    _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+          else
+	    # Determine the default libpath from the value encoded in an
+	    # empty executable.
+	    _LT_SYS_MODULE_PATH_AIX([$1])
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+	    # Warning - without using the other run time loading flags,
+	    # -berok will link without error, but may produce a broken library.
+	    _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+	    _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+	    if test "$with_gnu_ld" = yes; then
+	      # We only use this code for GNU lds that support --whole-archive.
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    else
+	      # Exported symbols can be pulled into shared objects from archives
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+	    fi
+	    _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+	    # This is similar to how AIX traditionally builds its shared
+	    # libraries.
+	    _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+          fi
+        fi
+        ;;
+
+      beos*)
+	if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  # Joseph Beckenbach <jrb3 at best.com> says some releases of gcc
+	  # support --undefined.  This deserves some investigation.  FIXME
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	else
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+
+      chorus*)
+        case $cc_basename in
+          *)
+	  # FIXME: insert proper C++ library support
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	  ;;
+        esac
+        ;;
+
+      cygwin* | mingw* | pw32* | cegcc*)
+	case $GXX,$cc_basename in
+	,cl* | no,cl*)
+	  # Native MSVC
+	  # hardcode_libdir_flag_spec is actually meaningless, as there is
+	  # no search path for DLLs.
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  _LT_TAGVAR(always_export_symbols, $1)=yes
+	  _LT_TAGVAR(file_list_spec, $1)='@'
+	  # Tell ltmain to make .lib files, not .a files.
+	  libext=lib
+	  # Tell ltmain to make .dll files, not .so files.
+	  shrext_cmds=".dll"
+	  # FIXME: Setting linknames here is a bad hack.
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	      $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp;
+	    else
+	      $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp;
+	    fi~
+	    $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~
+	    linknames='
+	  # The linker will not automatically build a static lib if we build a DLL.
+	  # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+	  # Don't use ranlib
+	  _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
+	  _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~
+	    lt_tool_outputfile="@TOOL_OUTPUT@"~
+	    case $lt_outputfile in
+	      *.exe|*.EXE) ;;
+	      *)
+		lt_outputfile="$lt_outputfile.exe"
+		lt_tool_outputfile="$lt_tool_outputfile.exe"
+		;;
+	    esac~
+	    func_to_tool_file "$lt_outputfile"~
+	    if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then
+	      $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1;
+	      $RM "$lt_outputfile.manifest";
+	    fi'
+	  ;;
+	*)
+	  # g++
+	  # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+	  # as there is no search path for DLLs.
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+	  _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
+	  _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+	  _LT_TAGVAR(always_export_symbols, $1)=no
+	  _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+	  if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	    # If the export-symbols file already is a .def file (1st line
+	    # is EXPORTS), use it as is; otherwise, prepend...
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+	      cp $export_symbols $output_objdir/$soname.def;
+	    else
+	      echo EXPORTS > $output_objdir/$soname.def;
+	      cat $export_symbols >> $output_objdir/$soname.def;
+	    fi~
+	    $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+	  else
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	  fi
+	  ;;
+	esac
+	;;
+      darwin* | rhapsody*)
+        _LT_DARWIN_LINKER_FEATURES($1)
+	;;
+
+      dgux*)
+        case $cc_basename in
+          ec++*)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          ghcx*)
+	    # Green Hills C++ Compiler
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+        esac
+        ;;
+
+      freebsd[[12]]*)
+        # C++ shared libraries reported to be fairly broken before
+	# switch to ELF
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      freebsd-elf*)
+        _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+        ;;
+
+      freebsd* | dragonfly*)
+        # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+        # conventions
+        _LT_TAGVAR(ld_shlibs, $1)=yes
+        ;;
+
+      gnu*)
+        ;;
+
+      haiku*)
+        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+        _LT_TAGVAR(link_all_deplibs, $1)=yes
+        ;;
+
+      hpux9*)
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+        _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+        _LT_TAGVAR(hardcode_direct, $1)=yes
+        _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+				             # but as the default
+				             # location of the library.
+
+        case $cc_basename in
+          CC*)
+            # FIXME: insert proper C++ library support
+            _LT_TAGVAR(ld_shlibs, $1)=no
+            ;;
+          aCC*)
+            _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            # Commands to make compiler produce verbose output that lists
+            # what "hidden" libraries, object files and flags are used when
+            # linking a shared library.
+            #
+            # There doesn't appear to be a way to prevent this compiler from
+            # explicitly linking system object files so we need to strip them
+            # from the output so that they don't get included in the library
+            # dependencies.
+            output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+            ;;
+          *)
+            if test "$GXX" = yes; then
+              _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+            else
+              # FIXME: insert proper C++ library support
+              _LT_TAGVAR(ld_shlibs, $1)=no
+            fi
+            ;;
+        esac
+        ;;
+
+      hpux10*|hpux11*)
+        if test $with_gnu_ld = no; then
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+	  _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+          case $host_cpu in
+            hppa*64*|ia64*)
+              ;;
+            *)
+	      _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+              ;;
+          esac
+        fi
+        case $host_cpu in
+          hppa*64*|ia64*)
+            _LT_TAGVAR(hardcode_direct, $1)=no
+            _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+            ;;
+          *)
+            _LT_TAGVAR(hardcode_direct, $1)=yes
+            _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+            _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+					         # but as the default
+					         # location of the library.
+            ;;
+        esac
+
+        case $cc_basename in
+          CC*)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          aCC*)
+	    case $host_cpu in
+	      hppa*64*)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	      ia64*)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	      *)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	        ;;
+	    esac
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    ;;
+          *)
+	    if test "$GXX" = yes; then
+	      if test $with_gnu_ld = no; then
+	        case $host_cpu in
+	          hppa*64*)
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	          ia64*)
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	          *)
+	            _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	            ;;
+	        esac
+	      fi
+	    else
+	      # FIXME: insert proper C++ library support
+	      _LT_TAGVAR(ld_shlibs, $1)=no
+	    fi
+	    ;;
+        esac
+        ;;
+
+      interix[[3-9]]*)
+	_LT_TAGVAR(hardcode_direct, $1)=no
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	# Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+	# Instead, shared libraries are loaded at an image base (0x10000000 by
+	# default) and relocated if they conflict, which is a slow very memory
+	# consuming and fragmenting process.  To avoid this, we pick a random,
+	# 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+	# time.  Moving up from 0x10000000 also allows more sbrk(2) space.
+	_LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	_LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+	;;
+      irix5* | irix6*)
+        case $cc_basename in
+          CC*)
+	    # SGI C++
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -ar", where "CC" is the IRIX C++ compiler.  This is
+	    # necessary to make sure instantiated templates are included
+	    # in the archive.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+	    ;;
+          *)
+	    if test "$GXX" = yes; then
+	      if test "$with_gnu_ld" = no; then
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+	      else
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
+	      fi
+	    fi
+	    _LT_TAGVAR(link_all_deplibs, $1)=yes
+	    ;;
+        esac
+        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+        _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+        _LT_TAGVAR(inherit_rpath, $1)=yes
+        ;;
+
+      linux* | k*bsd*-gnu | kopensolaris*-gnu)
+        case $cc_basename in
+          KCC*)
+	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	    # KCC will only create a shared library if the output file
+	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+	    # to its proper name (with version) after linking.
+	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+	    ;;
+	  icpc* | ecpc* )
+	    # Intel C++
+	    with_gnu_ld=yes
+	    # version 8.0 and above of icpc choke on multiply defined symbols
+	    # if we add $predep_objects and $postdep_objects, however 7.1 and
+	    # earlier do not add the objects themselves.
+	    case `$CC -V 2>&1` in
+	      *"Version 7."*)
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	      *)  # Version 8.0 or newer
+	        tmp_idyn=
+	        case $host_cpu in
+		  ia64*) tmp_idyn=' -i_dynamic';;
+		esac
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+		_LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+		;;
+	    esac
+	    _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+	    ;;
+          pgCC* | pgcpp*)
+            # Portland Group C++ compiler
+	    case `$CC -V` in
+	    *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
+	      _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+		compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
+	      _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+		$AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
+		$RANLIB $oldlib'
+	      _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
+		rm -rf $tpldir~
+		$CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+		$CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+	      ;;
+	    *) # Version 6 and above use weak symbols
+	      _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+	      ;;
+	    esac
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test  -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+            ;;
+	  cxx*)
+	    # Compaq C++
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname  -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+	    runpath_var=LD_RUN_PATH
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
+	    ;;
+	  xl* | mpixl* | bgxl*)
+	    # IBM XL 8.0 on PPC, with GNU ld
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+	    if test "x$supports_anon_versioning" = xyes; then
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+		cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+		echo "local: *; };" >> $output_objdir/$libname.ver~
+		$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+	    fi
+	    ;;
+	  *)
+	    case `$CC -V 2>&1 | sed 5q` in
+	    *Sun\ C*)
+	      # Sun C++ 5.9
+	      _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+	      _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	      _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	      _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive'
+	      _LT_TAGVAR(compiler_needs_object, $1)=yes
+
+	      # Not sure whether something based on
+	      # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+	      # would be better.
+	      output_verbose_link_cmd='func_echo_all'
+
+	      # Archives containing C++ object files must be created using
+	      # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	      # necessary to make sure instantiated templates are included
+	      # in the archive.
+	      _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+	      ;;
+	    esac
+	    ;;
+	esac
+	;;
+
+      lynxos*)
+        # FIXME: insert proper C++ library support
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      m88k*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      mvs*)
+        case $cc_basename in
+          cxx*)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+	  *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+	esac
+	;;
+
+      netbsd*)
+        if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+	  _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable  -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+	  wlarc=
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	fi
+	# Workaround some broken pre-1.5 toolchains
+	output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+	;;
+
+      *nto* | *qnx*)
+        _LT_TAGVAR(ld_shlibs, $1)=yes
+	;;
+
+      openbsd2*)
+        # C++ shared libraries are fairly broken
+	_LT_TAGVAR(ld_shlibs, $1)=no
+	;;
+
+      openbsd*)
+	if test -f /usr/libexec/ld.so; then
+	  _LT_TAGVAR(hardcode_direct, $1)=yes
+	  _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	  _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+	  _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	  if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+	    _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+	    _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+	  fi
+	  output_verbose_link_cmd=func_echo_all
+	else
+	  _LT_TAGVAR(ld_shlibs, $1)=no
+	fi
+	;;
+
+      osf3* | osf4* | osf5*)
+        case $cc_basename in
+          KCC*)
+	    # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+	    # KCC will only create a shared library if the output file
+	    # ends with ".so" (or ".sl" for HP-UX), so rename the library
+	    # to its proper name (with version) after linking.
+	    _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Archives containing C++ object files must be created using
+	    # the KAI C++ compiler.
+	    case $host in
+	      osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
+	      *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
+	    esac
+	    ;;
+          RCC*)
+	    # Rational C++ 2.4.1
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          cxx*)
+	    case $host in
+	      osf3*)
+	        _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+		;;
+	      *)
+	        _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
+	        _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+	          echo "-hidden">> $lib.exp~
+	          $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp  `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
+	          $RM $lib.exp'
+	        _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+		;;
+	    esac
+
+	    _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	    # Commands to make compiler produce verbose output that lists
+	    # what "hidden" libraries, object files and flags are used when
+	    # linking a shared library.
+	    #
+	    # There doesn't appear to be a way to prevent this compiler from
+	    # explicitly linking system object files so we need to strip them
+	    # from the output so that they don't get included in the library
+	    # dependencies.
+	    output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
+	    ;;
+	  *)
+	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	      _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+	      case $host in
+	        osf3*)
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	        *)
+	          _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+		  ;;
+	      esac
+
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+	      _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+	      # Commands to make compiler produce verbose output that lists
+	      # what "hidden" libraries, object files and flags are used when
+	      # linking a shared library.
+	      output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+
+	    else
+	      # FIXME: insert proper C++ library support
+	      _LT_TAGVAR(ld_shlibs, $1)=no
+	    fi
+	    ;;
+        esac
+        ;;
+
+      psos*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      sunos4*)
+        case $cc_basename in
+          CC*)
+	    # Sun C++ 4.x
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          lcc*)
+	    # Lucid
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+        esac
+        ;;
+
+      solaris*)
+        case $cc_basename in
+          CC* | sunCC*)
+	    # Sun C++ 4.2, 5.x and Centerline C++
+            _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
+	    _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag}  -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+	      $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	    _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+	    _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	    case $host_os in
+	      solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+	      *)
+		# The compiler driver will combine and reorder linker options,
+		# but understands `-z linker_flag'.
+	        # Supported since Solaris 2.6 (maybe 2.5.1?)
+		_LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+	        ;;
+	    esac
+	    _LT_TAGVAR(link_all_deplibs, $1)=yes
+
+	    output_verbose_link_cmd='func_echo_all'
+
+	    # Archives containing C++ object files must be created using
+	    # "CC -xar", where "CC" is the Sun C++ compiler.  This is
+	    # necessary to make sure instantiated templates are included
+	    # in the archive.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+	    ;;
+          gcx*)
+	    # Green Hills C++ Compiler
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+	    # The C++ compiler must be used to create the archive.
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+	    ;;
+          *)
+	    # GNU C++ compiler with Solaris linker
+	    if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+	      _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+	      if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+		  $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	        # Commands to make compiler produce verbose output that lists
+	        # what "hidden" libraries, object files and flags are used when
+	        # linking a shared library.
+	        output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	      else
+	        # g++ 2.7 appears to require `-G' NOT `-shared' on this
+	        # platform.
+	        _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+	        _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+		  $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+	        # Commands to make compiler produce verbose output that lists
+	        # what "hidden" libraries, object files and flags are used when
+	        # linking a shared library.
+	        output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+	      fi
+
+	      _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+	      case $host_os in
+		solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+		*)
+		  _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+		  ;;
+	      esac
+	    fi
+	    ;;
+        esac
+        ;;
+
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+      _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+      _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+      _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+      runpath_var='LD_RUN_PATH'
+
+      case $cc_basename in
+        CC*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+	*)
+	  _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	  ;;
+      esac
+      ;;
+
+      sysv5* | sco3.2v5* | sco5v6*)
+	# Note: We can NOT use -z defs as we might desire, because we do not
+	# link with -lc, and that would cause any symbols used from libc to
+	# always be unresolved, which means just about no library would
+	# ever link correctly.  If we're not using GNU ld we use -z text
+	# though, which does catch some bad symbols but isn't as heavy-handed
+	# as -z defs.
+	_LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+	_LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+	_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+	_LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+	_LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+	_LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+	_LT_TAGVAR(link_all_deplibs, $1)=yes
+	_LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+	runpath_var='LD_RUN_PATH'
+
+	case $cc_basename in
+          CC*)
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
+	      '"$_LT_TAGVAR(old_archive_cmds, $1)"
+	    _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
+	      '"$_LT_TAGVAR(reload_cmds, $1)"
+	    ;;
+	  *)
+	    _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+	    ;;
+	esac
+      ;;
+
+      tandem*)
+        case $cc_basename in
+          NCC*)
+	    # NonStop-UX NCC 3.20
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+          *)
+	    # FIXME: insert proper C++ library support
+	    _LT_TAGVAR(ld_shlibs, $1)=no
+	    ;;
+        esac
+        ;;
+
+      vxworks*)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+
+      *)
+        # FIXME: insert proper C++ library support
+        _LT_TAGVAR(ld_shlibs, $1)=no
+        ;;
+    esac
+
+    AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+    test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+    _LT_TAGVAR(GCC, $1)="$GXX"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_SYS_HIDDEN_LIBDEPS($1)
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+  LDCXX=$LD
+  LD=$lt_save_LD
+  GCC=$lt_save_GCC
+  with_gnu_ld=$lt_save_with_gnu_ld
+  lt_cv_path_LDCXX=$lt_cv_path_LD
+  lt_cv_path_LD=$lt_save_path_LD
+  lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+  lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+fi # test "$_lt_caught_CXX_error" != yes
+
+AC_LANG_POP
+])# _LT_LANG_CXX_CONFIG
+
+
+# _LT_FUNC_STRIPNAME_CNF
+# ----------------------
+# func_stripname_cnf prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+#
+# This function is identical to the (non-XSI) version of func_stripname,
+# except this one can be used by m4 code that may be executed by configure,
+# rather than the libtool script.
+m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
+AC_REQUIRE([_LT_DECL_SED])
+AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
+func_stripname_cnf ()
+{
+  case ${2} in
+  .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
+  *)  func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
+  esac
+} # func_stripname_cnf
+])# _LT_FUNC_STRIPNAME_CNF
+
+# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
+# ---------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
+# Dependencies to place before and after the object being linked:
+_LT_TAGVAR(predep_objects, $1)=
+_LT_TAGVAR(postdep_objects, $1)=
+_LT_TAGVAR(predeps, $1)=
+_LT_TAGVAR(postdeps, $1)=
+_LT_TAGVAR(compiler_lib_search_path, $1)=
+
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library.  It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
+int a;
+void foo (void) { a = 0; }
+_LT_EOF
+], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+  Foo (void) { a = 0; }
+private:
+  int a;
+};
+_LT_EOF
+], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
+      subroutine foo
+      implicit none
+      integer*4 a
+      a=0
+      return
+      end
+_LT_EOF
+], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
+      subroutine foo
+      implicit none
+      integer a
+      a=0
+      return
+      end
+_LT_EOF
+], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
+public class foo {
+  private int a;
+  public void bar (void) {
+    a = 0;
+  }
+};
+_LT_EOF
+])
+
+_lt_libdeps_save_CFLAGS=$CFLAGS
+case "$CC $CFLAGS " in #(
+*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
+*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
+esac
+
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+  # Parse the compiler output and extract the necessary
+  # objects, libraries and library flags.
+
+  # Sentinel used to keep track of whether or not we are before
+  # the conftest object file.
+  pre_test_object_deps_done=no
+
+  for p in `eval "$output_verbose_link_cmd"`; do
+    case ${prev}${p} in
+
+    -L* | -R* | -l*)
+       # Some compilers place space between "-{L,R}" and the path.
+       # Remove the space.
+       if test $p = "-L" ||
+          test $p = "-R"; then
+	 prev=$p
+	 continue
+       fi
+
+       # Expand the sysroot to ease extracting the directories later.
+       if test -z "$prev"; then
+         case $p in
+         -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
+         -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
+         -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
+         esac
+       fi
+       case $p in
+       =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
+       esac
+       if test "$pre_test_object_deps_done" = no; then
+	 case ${prev} in
+	 -L | -R)
+	   # Internal compiler library paths should come after those
+	   # provided the user.  The postdeps already come after the
+	   # user supplied libs so there is no need to process them.
+	   if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
+	     _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+	   else
+	     _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+	   fi
+	   ;;
+	 # The "-l" case would never come before the object being
+	 # linked, so don't bother handling this case.
+	 esac
+       else
+	 if test -z "$_LT_TAGVAR(postdeps, $1)"; then
+	   _LT_TAGVAR(postdeps, $1)="${prev}${p}"
+	 else
+	   _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
+	 fi
+       fi
+       prev=
+       ;;
+
+    *.lto.$objext) ;; # Ignore GCC LTO objects
+    *.$objext)
+       # This assumes that the test object file only shows up
+       # once in the compiler output.
+       if test "$p" = "conftest.$objext"; then
+	 pre_test_object_deps_done=yes
+	 continue
+       fi
+
+       if test "$pre_test_object_deps_done" = no; then
+	 if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
+	   _LT_TAGVAR(predep_objects, $1)="$p"
+	 else
+	   _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
+	 fi
+       else
+	 if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
+	   _LT_TAGVAR(postdep_objects, $1)="$p"
+	 else
+	   _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
+	 fi
+       fi
+       ;;
+
+    *) ;; # Ignore the rest.
+
+    esac
+  done
+
+  # Clean up.
+  rm -f a.out a.exe
+else
+  echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$RM -f confest.$objext
+CFLAGS=$_lt_libdeps_save_CFLAGS
+
+# PORTME: override above test on systems where it is broken
+m4_if([$1], [CXX],
+[case $host_os in
+interix[[3-9]]*)
+  # Interix 3.5 installs completely hosed .la files for C++, so rather than
+  # hack all around it, let's just trust "g++" to DTRT.
+  _LT_TAGVAR(predep_objects,$1)=
+  _LT_TAGVAR(postdep_objects,$1)=
+  _LT_TAGVAR(postdeps,$1)=
+  ;;
+
+linux*)
+  case `$CC -V 2>&1 | sed 5q` in
+  *Sun\ C*)
+    # Sun C++ 5.9
+
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+
+solaris*)
+  case $cc_basename in
+  CC* | sunCC*)
+    # The more standards-conforming stlport4 library is
+    # incompatible with the Cstd library. Avoid specifying
+    # it if it's in CXXFLAGS. Ignore libCrun as
+    # -library=stlport4 depends on it.
+    case " $CXX $CXXFLAGS " in
+    *" -library=stlport4 "*)
+      solaris_use_stlport4=yes
+      ;;
+    esac
+
+    # Adding this requires a known-good setup of shared libraries for
+    # Sun compiler versions before 5.6, else PIC objects from an old
+    # archive will be linked into the output, leading to subtle bugs.
+    if test "$solaris_use_stlport4" != yes; then
+      _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+    fi
+    ;;
+  esac
+  ;;
+esac
+])
+
+case " $_LT_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=
+if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
+    [The directories searched by this compiler when creating a shared library])
+_LT_TAGDECL([], [predep_objects], [1],
+    [Dependencies to place before and after the objects being linked to
+    create a shared library])
+_LT_TAGDECL([], [postdep_objects], [1])
+_LT_TAGDECL([], [predeps], [1])
+_LT_TAGDECL([], [postdeps], [1])
+_LT_TAGDECL([], [compiler_lib_search_path], [1],
+    [The library search path used internally by the compiler when linking
+    a shared library])
+])# _LT_SYS_HIDDEN_LIBDEPS
+
+
+# _LT_LANG_F77_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a Fortran 77 compiler are
+# suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_F77_CONFIG],
+[AC_LANG_PUSH(Fortran 77)
+if test -z "$F77" || test "X$F77" = "Xno"; then
+  _lt_disable_F77=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the F77 compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_F77" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="\
+      program t
+      end
+"
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC="$CC"
+  lt_save_GCC=$GCC
+  lt_save_CFLAGS=$CFLAGS
+  CC=${F77-"f77"}
+  CFLAGS=$FFLAGS
+  compiler=$CC
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+  GCC=$G77
+  if test -n "$compiler"; then
+    AC_MSG_CHECKING([if libtool supports shared libraries])
+    AC_MSG_RESULT([$can_build_shared])
+
+    AC_MSG_CHECKING([whether to build shared libraries])
+    test "$can_build_shared" = "no" && enable_shared=no
+
+    # On AIX, shared libraries and static libraries use the same namespace, and
+    # are all built from PIC.
+    case $host_os in
+      aix3*)
+        test "$enable_shared" = yes && enable_static=no
+        if test -n "$RANLIB"; then
+          archive_cmds="$archive_cmds~\$RANLIB \$lib"
+          postinstall_cmds='$RANLIB $lib'
+        fi
+        ;;
+      aix[[4-9]]*)
+	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+	  test "$enable_shared" = yes && enable_static=no
+	fi
+        ;;
+    esac
+    AC_MSG_RESULT([$enable_shared])
+
+    AC_MSG_CHECKING([whether to build static libraries])
+    # Make sure either enable_shared or enable_static is yes.
+    test "$enable_shared" = yes || enable_static=yes
+    AC_MSG_RESULT([$enable_static])
+
+    _LT_TAGVAR(GCC, $1)="$G77"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  GCC=$lt_save_GCC
+  CC="$lt_save_CC"
+  CFLAGS="$lt_save_CFLAGS"
+fi # test "$_lt_disable_F77" != yes
+
+AC_LANG_POP
+])# _LT_LANG_F77_CONFIG
+
+
+# _LT_LANG_FC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for a Fortran compiler are
+# suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_FC_CONFIG],
+[AC_LANG_PUSH(Fortran)
+
+if test -z "$FC" || test "X$FC" = "Xno"; then
+  _lt_disable_FC=yes
+fi
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for fc test sources.
+ac_ext=${ac_fc_srcext-f}
+
+# Object file extension for compiled fc test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the FC compiler isn't working.  Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_FC" != yes; then
+  # Code to be used in simple compile tests
+  lt_simple_compile_test_code="\
+      subroutine t
+      return
+      end
+"
+
+  # Code to be used in simple link tests
+  lt_simple_link_test_code="\
+      program t
+      end
+"
+
+  # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+  _LT_TAG_COMPILER
+
+  # save warnings/boilerplate of simple test code
+  _LT_COMPILER_BOILERPLATE
+  _LT_LINKER_BOILERPLATE
+
+  # Allow CC to be a program name with arguments.
+  lt_save_CC="$CC"
+  lt_save_GCC=$GCC
+  lt_save_CFLAGS=$CFLAGS
+  CC=${FC-"f95"}
+  CFLAGS=$FCFLAGS
+  compiler=$CC
+  GCC=$ac_cv_fc_compiler_gnu
+
+  _LT_TAGVAR(compiler, $1)=$CC
+  _LT_CC_BASENAME([$compiler])
+
+  if test -n "$compiler"; then
+    AC_MSG_CHECKING([if libtool supports shared libraries])
+    AC_MSG_RESULT([$can_build_shared])
+
+    AC_MSG_CHECKING([whether to build shared libraries])
+    test "$can_build_shared" = "no" && enable_shared=no
+
+    # On AIX, shared libraries and static libraries use the same namespace, and
+    # are all built from PIC.
+    case $host_os in
+      aix3*)
+        test "$enable_shared" = yes && enable_static=no
+        if test -n "$RANLIB"; then
+          archive_cmds="$archive_cmds~\$RANLIB \$lib"
+          postinstall_cmds='$RANLIB $lib'
+        fi
+        ;;
+      aix[[4-9]]*)
+	if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+	  test "$enable_shared" = yes && enable_static=no
+	fi
+        ;;
+    esac
+    AC_MSG_RESULT([$enable_shared])
+
+    AC_MSG_CHECKING([whether to build static libraries])
+    # Make sure either enable_shared or enable_static is yes.
+    test "$enable_shared" = yes || enable_static=yes
+    AC_MSG_RESULT([$enable_static])
+
+    _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
+    _LT_TAGVAR(LD, $1)="$LD"
+
+    ## CAVEAT EMPTOR:
+    ## There is no encapsulation within the following macros, do not change
+    ## the running order or otherwise move them around unless you know exactly
+    ## what you are doing...
+    _LT_SYS_HIDDEN_LIBDEPS($1)
+    _LT_COMPILER_PIC($1)
+    _LT_COMPILER_C_O($1)
+    _LT_COMPILER_FILE_LOCKS($1)
+    _LT_LINKER_SHLIBS($1)
+    _LT_SYS_DYNAMIC_LINKER($1)
+    _LT_LINKER_HARDCODE_LIBPATH($1)
+
+    _LT_CONFIG($1)
+  fi # test -n "$compiler"
+
+  GCC=$lt_save_GCC
+  CC=$lt_save_CC
+  CFLAGS=$lt_save_CFLAGS
+fi # test "$_lt_disable_FC" != yes
+
+AC_LANG_POP
+])# _LT_LANG_FC_CONFIG
+
+
+# _LT_LANG_GCJ_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Java Compiler compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GCJ_CONFIG],
+[AC_REQUIRE([LT_PROG_GCJ])dnl
+AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GCJ-"gcj"}
+CFLAGS=$GCJFLAGS
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(reload_flag, $1)=$reload_flag
+_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+  _LT_COMPILER_NO_RTTI($1)
+  _LT_COMPILER_PIC($1)
+  _LT_COMPILER_C_O($1)
+  _LT_COMPILER_FILE_LOCKS($1)
+  _LT_LINKER_SHLIBS($1)
+  _LT_LINKER_HARDCODE_LIBPATH($1)
+
+  _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_GCJ_CONFIG
+
+
+# _LT_LANG_RC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for the Windows resource compiler
+# are suitably defined.  These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_RC_CONFIG],
+[AC_REQUIRE([LT_PROG_RC])dnl
+AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+lt_save_CFLAGS=$CFLAGS
+lt_save_GCC=$GCC
+GCC=
+CC=${RC-"windres"}
+CFLAGS=
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+if test -n "$compiler"; then
+  :
+  _LT_CONFIG($1)
+fi
+
+GCC=$lt_save_GCC
+AC_LANG_RESTORE
+CC=$lt_save_CC
+CFLAGS=$lt_save_CFLAGS
+])# _LT_LANG_RC_CONFIG
+
+
+# LT_PROG_GCJ
+# -----------
+AC_DEFUN([LT_PROG_GCJ],
+[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
+  [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
+    [AC_CHECK_TOOL(GCJ, gcj,)
+      test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+      AC_SUBST(GCJFLAGS)])])[]dnl
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
+
+
+# LT_PROG_RC
+# ----------
+AC_DEFUN([LT_PROG_RC],
+[AC_CHECK_TOOL(RC, windres,)
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_RC], [])
+
+
+# _LT_DECL_EGREP
+# --------------
+# If we don't have a new enough Autoconf to choose the best grep
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_EGREP],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_REQUIRE([AC_PROG_FGREP])dnl
+test -z "$GREP" && GREP=grep
+_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
+_LT_DECL([], [EGREP], [1], [An ERE matcher])
+_LT_DECL([], [FGREP], [1], [A literal string matcher])
+dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
+AC_SUBST([GREP])
+])
+
+
+# _LT_DECL_OBJDUMP
+# --------------
+# If we don't have a new enough Autoconf to choose the best objdump
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_OBJDUMP],
+[AC_CHECK_TOOL(OBJDUMP, objdump, false)
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
+AC_SUBST([OBJDUMP])
+])
+
+# _LT_DECL_DLLTOOL
+# ----------------
+# Ensure DLLTOOL variable is set.
+m4_defun([_LT_DECL_DLLTOOL],
+[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
+AC_SUBST([DLLTOOL])
+])
+
+# _LT_DECL_SED
+# ------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible.  Prefer GNU sed if found.
+m4_defun([_LT_DECL_SED],
+[AC_PROG_SED
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
+_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
+    [Sed that helps us avoid accidentally triggering echo(1) options like -n])
+])# _LT_DECL_SED
+
+m4_ifndef([AC_PROG_SED], [
+############################################################
+# NOTE: This macro has been submitted for inclusion into   #
+#  GNU Autoconf as AC_PROG_SED.  When it is available in   #
+#  a released version of Autoconf we should remove this    #
+#  macro and use it instead.                               #
+############################################################
+
+m4_defun([AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for lt_ac_prog in sed gsed; do
+    for ac_exec_ext in '' $ac_executable_extensions; do
+      if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+        lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+      fi
+    done
+  done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+  test ! -f $lt_ac_sed && continue
+  cat /dev/null > conftest.in
+  lt_ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+  # Check for GNU sed and select it if it is found.
+  if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+    lt_cv_path_SED=$lt_ac_sed
+    break
+  fi
+  while true; do
+    cat conftest.in conftest.in >conftest.tmp
+    mv conftest.tmp conftest.in
+    cp conftest.in conftest.nl
+    echo >>conftest.nl
+    $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+    cmp -s conftest.out conftest.nl || break
+    # 10000 chars as input seems more than enough
+    test $lt_ac_count -gt 10 && break
+    lt_ac_count=`expr $lt_ac_count + 1`
+    if test $lt_ac_count -gt $lt_ac_max; then
+      lt_ac_max=$lt_ac_count
+      lt_cv_path_SED=$lt_ac_sed
+    fi
+  done
+done
+])
+SED=$lt_cv_path_SED
+AC_SUBST([SED])
+AC_MSG_RESULT([$SED])
+])#AC_PROG_SED
+])#m4_ifndef
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_SED], [])
+
+
+# _LT_CHECK_SHELL_FEATURES
+# ------------------------
+# Find out whether the shell is Bourne or XSI compatible,
+# or has some other useful features.
+m4_defun([_LT_CHECK_SHELL_FEATURES],
+[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,b/c, \
+    && eval 'test $(( 1 + 1 )) -eq 2 \
+    && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+  && xsi_shell=yes
+AC_MSG_RESULT([$xsi_shell])
+_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
+
+AC_MSG_CHECKING([whether the shell understands "+="])
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
+    >/dev/null 2>&1 \
+  && lt_shell_append=yes
+AC_MSG_RESULT([$lt_shell_append])
+_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  lt_unset=unset
+else
+  lt_unset=false
+fi
+_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+  lt_SP2NL='tr \040 \012'
+  lt_NL2SP='tr \015\012 \040\040'
+  ;;
+ *) # EBCDIC based system
+  lt_SP2NL='tr \100 \n'
+  lt_NL2SP='tr \r\n \100\100'
+  ;;
+esac
+_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
+_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
+])# _LT_CHECK_SHELL_FEATURES
+
+
+# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
+# ------------------------------------------------------
+# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
+# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
+m4_defun([_LT_PROG_FUNCTION_REPLACE],
+[dnl {
+sed -e '/^$1 ()$/,/^} # $1 /c\
+$1 ()\
+{\
+m4_bpatsubsts([$2], [$], [\\], [^\([	 ]\)], [\\\1])
+} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
+  && mv -f "$cfgfile.tmp" "$cfgfile" \
+    || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+test 0 -eq $? || _lt_function_replace_fail=:
+])
+
+
+# _LT_PROG_REPLACE_SHELLFNS
+# -------------------------
+# Replace existing portable implementations of several shell functions with
+# equivalent extended shell implementations where those features are available..
+m4_defun([_LT_PROG_REPLACE_SHELLFNS],
+[if test x"$xsi_shell" = xyes; then
+  _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
+    case ${1} in
+      */*) func_dirname_result="${1%/*}${2}" ;;
+      *  ) func_dirname_result="${3}" ;;
+    esac])
+
+  _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
+    func_basename_result="${1##*/}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
+    case ${1} in
+      */*) func_dirname_result="${1%/*}${2}" ;;
+      *  ) func_dirname_result="${3}" ;;
+    esac
+    func_basename_result="${1##*/}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
+    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+    # positional parameters, so assign one to ordinary parameter first.
+    func_stripname_result=${3}
+    func_stripname_result=${func_stripname_result#"${1}"}
+    func_stripname_result=${func_stripname_result%"${2}"}])
+
+  _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
+    func_split_long_opt_name=${1%%=*}
+    func_split_long_opt_arg=${1#*=}])
+
+  _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
+    func_split_short_opt_arg=${1#??}
+    func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
+
+  _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
+    case ${1} in
+      *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+      *)    func_lo2o_result=${1} ;;
+    esac])
+
+  _LT_PROG_FUNCTION_REPLACE([func_xform], [    func_xform_result=${1%.*}.lo])
+
+  _LT_PROG_FUNCTION_REPLACE([func_arith], [    func_arith_result=$(( $[*] ))])
+
+  _LT_PROG_FUNCTION_REPLACE([func_len], [    func_len_result=${#1}])
+fi
+
+if test x"$lt_shell_append" = xyes; then
+  _LT_PROG_FUNCTION_REPLACE([func_append], [    eval "${1}+=\\${2}"])
+
+  _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
+    func_quote_for_eval "${2}"
+dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
+    eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
+
+  # Save a `func_append' function call where possible by direct use of '+='
+  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+else
+  # Save a `func_append' function call even when '+=' is not available
+  sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
+    && mv -f "$cfgfile.tmp" "$cfgfile" \
+      || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
+  test 0 -eq $? || _lt_function_replace_fail=:
+fi
+
+if test x"$_lt_function_replace_fail" = x":"; then
+  AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
+fi
+])
+
+# _LT_PATH_CONVERSION_FUNCTIONS
+# -----------------------------
+# Determine which file name conversion functions should be used by
+# func_to_host_file (and, implicitly, by func_to_host_path).  These are needed
+# for certain cross-compile configurations and native mingw.
+m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+AC_MSG_CHECKING([how to convert $build file names to $host format])
+AC_CACHE_VAL(lt_cv_to_host_file_cmd,
+[case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
+        ;;
+    esac
+    ;;
+  *-*-cygwin* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
+        ;;
+      *-*-cygwin* )
+        lt_cv_to_host_file_cmd=func_convert_file_noop
+        ;;
+      * ) # otherwise, assume *nix
+        lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
+        ;;
+    esac
+    ;;
+  * ) # unhandled hosts (and "normal" native builds)
+    lt_cv_to_host_file_cmd=func_convert_file_noop
+    ;;
+esac
+])
+to_host_file_cmd=$lt_cv_to_host_file_cmd
+AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
+_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
+         [0], [convert $build file names to $host format])dnl
+
+AC_MSG_CHECKING([how to convert $build file names to toolchain format])
+AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
+[#assume ordinary cross tools, or native build.
+lt_cv_to_tool_file_cmd=func_convert_file_noop
+case $host in
+  *-*-mingw* )
+    case $build in
+      *-*-mingw* ) # actually msys
+        lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
+        ;;
+    esac
+    ;;
+esac
+])
+to_tool_file_cmd=$lt_cv_to_tool_file_cmd
+AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
+_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
+         [0], [convert $build files to toolchain format])dnl
+])# _LT_PATH_CONVERSION_FUNCTIONS
diff --git a/macros/lidia-check.m4 b/macros/lidia-check.m4
index df22450..7db9c8d 100644
--- a/macros/lidia-check.m4
+++ b/macros/lidia-check.m4
@@ -7,6 +7,9 @@
 # stolen back from Frank Belew
 # stolen from Manish Singh
 # Shamelessly stolen from Owen Taylor
+# Copyright (c) the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 
 dnl LB_CHECK_LIDIA ([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
 dnl
@@ -16,14 +19,14 @@ AC_DEFUN([LB_CHECK_LIDIA],
 [
 
 AC_ARG_WITH(lidia,
-[  --with-lidia=<path>|yes|no Use Lidia library. If argument is no, you do not 
-                             have the library installed on your machine (set 
-			     as default). If argument is yes or <empty> that 
+[AC_HELP_STRING([--with-lidia=<path>|yes|no], [Use Lidia library. If argument is no, you do not
+                             have the library installed on your machine (set
+			     as default). If argument is yes or <empty> that
 			     means the library is reachable with the standard
-			     search path (/usr or /usr/local). Otherwise you 
-			     give the <path> to the directory which contain the 
-			     library. 
-	     ],
+			     search path (/usr or /usr/local). Otherwise you
+			     give the <path> to the directory which contain the
+			     library.
+	     ])],
 	     [if test "$withval" = yes ; then
 			LIDIA_HOME_PATH="${DEFAULT_CHECKING_PATH}"
 	      elif test "$withval" != no ; then
@@ -43,17 +46,17 @@ if test -n "$LIDIA_HOME_PATH" ; then
 AC_MSG_CHECKING(for LIDIA >= $min_lidia_version)
 fi
 
-for LIDIA_HOME in ${LIDIA_HOME_PATH} 
- do	
+for LIDIA_HOME in ${LIDIA_HOME_PATH}
+ do
 if test -r "$LIDIA_HOME/include/LiDIA/LiDIA.h"; then
 	if test "x$LIDIA_HOME" != "x/usr" -a "x$LIDIA_HOME" != "x/usr/local"; then
 		LIDIA_CFLAGS="-I${LIDIA_HOME}/include"
 		LIDIA_LIBS="-L${LIDIA_HOME}/lib -lLiDIA"
 	else
 		LIDIA_CFLAGS=
-		LIDIA_LIBS="-lLiDIA"		
-	fi	
-	CXXFLAGS="${BACKUP_CXXFLAGS} ${LIDIA_CFLAGS} ${GMP_CFLAGS}" 
+		LIDIA_LIBS="-lLiDIA"
+	fi
+	CXXFLAGS="${BACKUP_CXXFLAGS} ${LIDIA_CFLAGS} ${GMP_CFLAGS}"
 	LIBS="${BACKUP_LIBS} ${LIDIA_LIBS} ${GMP_LIBS}"
 
 	AC_TRY_LINK(
@@ -66,28 +69,28 @@ if test -r "$LIDIA_HOME/include/LiDIA/LiDIA.h"; then
 	],[
 	lidia_found="yes"
 	break
-	],[	
-	lidia_problem="$problem $LIDIA_HOME"	
+	],[
+	lidia_problem="$problem $LIDIA_HOME"
 	unset LIDIA_CFLAGS
 	unset LIDIA_LIBS
 	],[
 	lidia_found="yes"
 	lidia_cross="yes"
 	break
-	])	
+	])
 	],
 	[
 	lidia_found="no"
 	lidia_checked="$checked $LIDIA_HOME"
 	unset LIDIA_CFLAGS
-	unset LIDIA_LIBS	
+	unset LIDIA_LIBS
 	])
 else
 	lidia_found="no"
 fi
 done
 
-if test "x$lidia_found" = "xyes" ; then		
+if test "x$lidia_found" = "xyes" ; then
 	AC_SUBST(LIDIA_CFLAGS)
 	AC_SUBST(LIDIA_LIBS)
 	AC_DEFINE(HAVE_LIDIA,1,[Define if LIDIA is installed])
@@ -99,15 +102,15 @@ if test "x$lidia_found" = "xyes" ; then
 		echo "WARNING: You appear to be cross compiling, so there is no way to determine"
 		echo "whether your LIDIA version is new enough. I am assuming it is."
 	fi
-	ifelse([$2], , :, [$2])	
+	ifelse([$2], , :, [$2])
 elif test -n "$lidia_problem"; then
 	AC_MSG_RESULT(problem)
 	echo "Sorry, your LIDIA version is too old. Disabling."
 	ifelse([$3], , :, [$3])
-elif test "x$lidia_found" = "xno" ; then	
+elif test "x$lidia_found" = "xno" ; then
 	AC_MSG_RESULT(not found)
 	ifelse([$3], , :, [$3])
-fi	
+fi
 
 
 AM_CONDITIONAL(LINBOX_HAVE_LIDIA, test "x$HAVE_LIDIA" = "xyes")
diff --git a/macros/linbox-doc.m4 b/macros/linbox-doc.m4
index ae7dc7a..355df62 100644
--- a/macros/linbox-doc.m4
+++ b/macros/linbox-doc.m4
@@ -1,3 +1,6 @@
+# Copyright (c) the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 
 AC_DEFUN([LB_DOC],
 [
@@ -6,7 +9,7 @@ AC_MSG_CHECKING(whether to build documentation)
 
 
 AC_ARG_WITH(docdir,
-[  --with-docdir=<path> Where the LinBox documentation should be installed],
+[AC_HELP_STRING([--with-docdir=<path>], [Where the LinBox documentation should be installed])],
             [
 		LINBOX_DOC_PATH="$withval"
 	    ],
@@ -17,7 +20,7 @@ AC_ARG_WITH(docdir,
 AC_SUBST(LINBOX_DOC_PATH)
 
 AC_ARG_WITH(doxygen,
-[  --with-doxygen=<path> Give the path to Doxygen. Note: --enable-doc needed],
+[AC_HELP_STRING([--with-doxygen=<path>], [Give the path to Doxygen. Note: --enable-doc needed])],
             [
 		DOXYGEN_PATH="$PATH $withval"
 	    ],
@@ -25,7 +28,7 @@ AC_ARG_WITH(doxygen,
 		DOXYGEN_PATH="$PATH"
 	    ])
 
-AC_ARG_ENABLE(doc,[  --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)
@@ -40,7 +43,7 @@ export PATH=$DOXYGEN_PATH
 	exit -1
 }
 AC_MSG_RESULT(yes)
-AM_CONDITIONAL(LINBOX_BUILD_DOC, true)	
+AM_CONDITIONAL(LINBOX_BUILD_DOC, true)
 ],
 [
 AC_MSG_RESULT(no)
diff --git a/macros/linbox-misc.m4 b/macros/linbox-misc.m4
index ac7bfd3..d16fb3a 100644
--- a/macros/linbox-misc.m4
+++ b/macros/linbox-misc.m4
@@ -1,35 +1,39 @@
 # linbox miscellaneous functonnnalities
+# Copyright (c) the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+
 
 
 AC_DEFUN([LB_MISC],
 [
 
 AC_ARG_WITH(default,
-[  --with-default=<path> Add <path> to the default path for external package 
+[AC_HELP_STRING([--with-default=<path>], [Add <path> to the default path for external package
   		        checking. Set as default with /usr and /usr/local.
-],
+])],
 	    [if test "$withval" = yes ; then
-			echo "Default path = /usr /usr/local"
-			DEFAULT_CHECKING_PATH="/usr /usr/local"
+			echo "Default path = /usr /usr/local "
+			DEFAULT_CHECKING_PATH="/usr /usr/local "
 	      else
-			echo "Default path = $withval /usr /usr/local"
-			DEFAULT_CHECKING_PATH="$withval /usr /usr/local"
+			echo "Default path = $withval /usr /usr/local "
+			DEFAULT_CHECKING_PATH="$withval /usr /usr/local "
 	     fi
 	     ],
 	     [
-		echo "Default path = /usr /usr/local"
-		DEFAULT_CHECKING_PATH="/usr /usr/local"
+		echo "Default path = /usr /usr/local "
+		DEFAULT_CHECKING_PATH="/usr /usr/local "
              ])
 
 
 AC_ARG_WITH(all,
-[  --with-all= <path>|yes|no Use all external packages. If the argument is no, 
-  	      		   you not sure that all libraries are reachable with 
+[AC_HELP_STRING([--with-all=<path>|yes|no], [Use all external packages. If the argument is no,
+  	      		   you not sure that all libraries are reachable with
 			   the default path. If the argument is yes or <empty>,
 			   that means that all libraries are reachable with the
-			   default path. Otherwise add <path> to default path 
+			   default path. Otherwise add <path> to default path
 			   and enable all external packages.
-],
+])],
 	    [if test "$withval" = yes ; then
 			check_all="yes"
 			echo "Checking all external packages in ${DEFAULT_CHECKING_PATH}"
@@ -37,11 +41,11 @@ AC_ARG_WITH(all,
 	      elif test "$withval" != no ; then
 			check_all="yes"
 			DEFAULT_CHECKING_PATH="$withval ${DEFAULT_CHECKING_PATH}"
-			echo "Checking all external packages in ${DEFAULT_CHECKING_PATH}"			
+			echo "Checking all external packages in ${DEFAULT_CHECKING_PATH}"
 	     fi
 	     ],
 	     [])
-					
+
 if test -n "$check_all"; then
 
 	GMP_HOME_PATH="${DEFAULT_CHECKING_PATH}"
diff --git a/macros/linbox-opt.m4 b/macros/linbox-opt.m4
index 2a8a034..e25dca8 100644
--- a/macros/linbox-opt.m4
+++ b/macros/linbox-opt.m4
@@ -1,145 +1,46 @@
+# Copyright (c) the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+
+
+
 AC_DEFUN([LB_OPT],
 [
 AC_MSG_CHECKING([whether to use run time optimization])
 
-AC_ARG_ENABLE(optimization, 
-[  --enable-optimization  Enable run time optimization in LinBox code],
+AC_ARG_ENABLE(optimization,
+[AC_HELP_STRING([--enable-optimization], [Enable run time optimization in LinBox code (only Strassen matrix threshold for now)])],
 [
-AC_MSG_RESULT(yes)
 
-	
+
 BACKUP_CXXFLAGS=${CXXFLAGS}
 BACKUP_LIBS=${LIBS}
-	
-if test "x$HAVE_BLAS" = "xyes" ;then
-AC_MSG_CHECKING([best threshold for Strassen-Winograd matrix multiplication])
-
-
-CXXFLAGS="${BACKUP_CXXFLAGS} -I`pwd` -I`pwd`/linbox ${BLAS_CFLAGS} ${GMP_CFLAGS}  ${GIVARO_CFLAGS} ${CBLAS_FLAG}" 
-LIBS="${BACKUP_LIBS} ${BLAS_LIBS} ${GMP_LIBS}" 
-
 
-echo   " #define __LINBOX_INT8  $LINBOX_INT8  	 
-	 #define __LINBOX_INT16 $LINBOX_INT16 	 
-	 #define __LINBOX_INT32 $LINBOX_INT32 	 
-	 #define __LINBOX_INT64 $LINBOX_INT64 	 
-" > linbox/linbox-config.h 
-
-
-AC_TRY_RUN([	#define LinBoxSrcOnly
-		#include <iostream>
-		#include <fstream>
-		#define __LINBOX_CONFIGURATION
-		#define _LINBOX_LINBOX_CONFIG_H
-		#include <linbox/config-blas.h>
-		#include <linbox/field/modular-double.h>
-		#include <linbox/fflas/fflas.h>
-		#include <linbox/util/timer.h>
-
-		using namespace LinBox;
-		int main () {  
-  
-		  Modular<double> F(17);
-		  size_t n=300, nmax=5000, prec=512, nbest=0, count=0;
-		  LinBox::Timer chrono;
-		  double basetime, time;
-		  bool bound=false;
-  
-		  double *A, *C;	 
-		  A = new double[nmax*nmax];
-		  C = new double[nmax*nmax];
-		  for (size_t i=0; i<nmax*nmax;++i){
-		    A[i]=2.;		  
-	  	  }
-    
-		  std::ofstream outlog;
-		  outlog.open("config.log", std::ofstream::out | std::ofstream::app);
-		  outlog << std::endl 
-			 << "Threshold for finite field Strassen-Winograd matrix multiplication"
-			 << std::endl;
-		  do {    
-		    chrono.start();	
-		    FFLAS::fgemm(F, FFLAS::FflasNoTrans, FFLAS::FflasNoTrans,
-				 n, n, n, 1., A, n, A, n, 0., C, n, 0);
-		    chrono.stop();
-		    std::cout << std::endl 
-			      << "fgemm " << n << "x" << n << ": " 
-			      << chrono.usertime() << " s, " 
-                              << (2.0/chrono.usertime()*n/100.0*n/100.0*n/100.0) << " Mffops" 
-			      << std::endl;
-		    outlog << std::endl 
-			      << "fgemm " << n << "x" << n << ": " 
-			      << chrono.usertime() << " s, " 
-                              << (2.0/chrono.usertime()*n/100.0*n/100.0*n/100.0) << " Mffops" 
-			      << std::endl;
-		    basetime= chrono.usertime();
-		    chrono.clear();
-		    chrono.start();	
-		    FFLAS::fgemm(F, FFLAS::FflasNoTrans, FFLAS::FflasNoTrans,
-				 n, n, n, 1., A, n, A, n, 0., C, n, 1);
-		    chrono.stop();
-		    std::cout << "1Wino " << n << "x" << n << ": " 
-			      << chrono.usertime() << " s, " 
-			      << (2.0/chrono.usertime()*n/100.0*n/100.0*n/100.0) << " Mffops" 
-			      << std::endl;
-		    outlog << "1Wino " << n << "x" << n << ": " 
-			      << chrono.usertime() << " s, " 
-			      << (2.0/chrono.usertime()*n/100.0*n/100.0*n/100.0) << " Mffops" 
-			      << std::endl;
-		    time= chrono.usertime();
-        
-		    if (basetime > time ){ 
-		      count++;
-		      if (count > 1){	
-	    		 nbest=n;
-		         bound=true;
-		         prec=prec>>1;
-		         n-=prec;     
-		      }
-		    }
-		    else{
-		      count=0;	    
-		      if (bound)
-			prec=prec>>1;
-		      n+=prec;
-		    }
-		  } while ((prec > 64 ) && (n < nmax));
-
-		  std::ofstream out("WinoThreshold");
-		  out<<nbest;
-		  out.close();
-
-		  outlog << "defined __LINBOX_STRASSEN_OPTIMIZATION" << std::endl
-			 << "defined __LINBOX_WINOTHRESHOLD to " << nbest << "" << std::endl;
-	          outlog.close();
-
-		  delete[] A;		 
-		  delete[] C;  
-  
-		  return 0; 
-		}
-	],[	
-	AC_MSG_RESULT(done)
-	WT="`cat WinoThreshold`"
-	if test "$WT" != "0"; then 
-	 AC_DEFINE(STRASSEN_OPTIMIZATION,,[Define if optimized  threshold for Strassen-Winograd matrix multiplication is available])
-	 AC_DEFINE_UNQUOTED(WINOTHRESHOLD, $WT, [optimized threshold for switching to strassen matrix multiplication])
-	fi
-	],[
-	AC_MSG_RESULT(problem)
+CXXFLAGS=${FFLAFLAS_CFLAGS}
+
+AC_TRY_RUN([ #include "fflasffpack-config.h"
+   int main() {
+#ifdef __FFLAFLAS_STRASSEN_OPTIMIZATION
+return 0;
+#else
+pas bon !
+#endif
+} ],[dnl OK
+	strassen_opti="yes"
+	AC_DEFINE(STRASSEN_OPTIMIZATION,,[Define if optimized  threshold for Strassen-Winograd matrix multiplication is available])
+    WINO="`grep "define.*__FFLAFLAS_WINOTHRESHOLD" ${FFLAFLAS_LOC}/include/fflasffpack-config.h  | awk '{print $NF}'`"
+	AC_MSG_RESULT(ok : $WINO)
+	AC_DEFINE_UNQUOTED(WINOTHRESHOLD, $WINO, [optimized threshold for switching to strassen matrix multiplication])
+	],[ dnl NO
+	AC_MSG_RESULT(not enabled. Please optimise Strassen threshold in Fflas-Ffpack)
 	strassen_opti="no"
-	break
-	],[
+	],[ dnl CROSS
 	AC_MSG_RESULT(cross compilation)
 	strassen_opti="no"
-	break
-	\rm -f linbox/linbox-config,h 2>&1 > /dev/null
 	])
 
-fi;
-],[
-AC_MSG_RESULT(no)
-\rm -f linbox/linbox-config.h  2>&1 > /dev/null
+],
+[AC_MSG_RESULT(no)])
 ])
 
-])
+CXXFLAGS=${BACKUP_CXXFLAGS}
diff --git a/macros/ltoptions.m4 b/macros/ltoptions.m4
new file mode 100644
index 0000000..17cfd51
--- /dev/null
+++ b/macros/ltoptions.m4
@@ -0,0 +1,369 @@
+# Helper functions for option handling.                    -*- Autoconf -*-
+#
+#   Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
+#   Inc.
+#   Written by Gary V. Vaughan, 2004
+#
+# 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 7 ltoptions.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
+
+
+# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
+# ------------------------------------------
+m4_define([_LT_MANGLE_OPTION],
+[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
+
+
+# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
+# ---------------------------------------
+# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
+# matching handler defined, dispatch to it.  Other OPTION-NAMEs are
+# saved as a flag.
+m4_define([_LT_SET_OPTION],
+[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
+m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
+        _LT_MANGLE_DEFUN([$1], [$2]),
+    [m4_warning([Unknown $1 option `$2'])])[]dnl
+])
+
+
+# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
+# ------------------------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+m4_define([_LT_IF_OPTION],
+[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
+
+
+# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
+# -------------------------------------------------------
+# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
+# are set.
+m4_define([_LT_UNLESS_OPTIONS],
+[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+	    [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
+		      [m4_define([$0_found])])])[]dnl
+m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
+])[]dnl
+])
+
+
+# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
+# ----------------------------------------
+# OPTION-LIST is a space-separated list of Libtool options associated
+# with MACRO-NAME.  If any OPTION has a matching handler declared with
+# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
+# the unknown option and exit.
+m4_defun([_LT_SET_OPTIONS],
+[# Set options
+m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+    [_LT_SET_OPTION([$1], _LT_Option)])
+
+m4_if([$1],[LT_INIT],[
+  dnl
+  dnl Simply set some default values (i.e off) if boolean options were not
+  dnl specified:
+  _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
+  ])
+  _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
+  ])
+  dnl
+  dnl If no reference was made to various pairs of opposing options, then
+  dnl we run the default mode handler for the pair.  For example, if neither
+  dnl `shared' nor `disable-shared' was passed, we enable building of shared
+  dnl archives by default:
+  _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
+  _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
+  _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
+  		   [_LT_ENABLE_FAST_INSTALL])
+  ])
+])# _LT_SET_OPTIONS
+
+
+## --------------------------------- ##
+## Macros to handle LT_INIT options. ##
+## --------------------------------- ##
+
+# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
+# -----------------------------------------
+m4_define([_LT_MANGLE_DEFUN],
+[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
+
+
+# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
+# -----------------------------------------------
+m4_define([LT_OPTION_DEFINE],
+[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
+])# LT_OPTION_DEFINE
+
+
+# dlopen
+# ------
+LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
+])
+
+AU_DEFUN([AC_LIBTOOL_DLOPEN],
+[_LT_SET_OPTION([LT_INIT], [dlopen])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `dlopen' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
+
+
+# win32-dll
+# ---------
+# Declare package support for building win32 dll's.
+LT_OPTION_DEFINE([LT_INIT], [win32-dll],
+[enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
+  AC_CHECK_TOOL(AS, as, false)
+  AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+  ;;
+esac
+
+test -z "$AS" && AS=as
+_LT_DECL([], [AS],      [1], [Assembler program])dnl
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
+])# win32-dll
+
+AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+_LT_SET_OPTION([LT_INIT], [win32-dll])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `win32-dll' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
+
+
+# _LT_ENABLE_SHARED([DEFAULT])
+# ----------------------------
+# implement the --enable-shared flag, and supports the `shared' and
+# `disable-shared' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_SHARED],
+[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([shared],
+    [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+	[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_shared=yes ;;
+    no) enable_shared=no ;;
+    *)
+      enable_shared=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_shared=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
+
+    _LT_DECL([build_libtool_libs], [enable_shared], [0],
+	[Whether or not to build shared libraries])
+])# _LT_ENABLE_SHARED
+
+LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
+])
+
+AC_DEFUN([AC_DISABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], [disable-shared])
+])
+
+AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_SHARED], [])
+dnl AC_DEFUN([AM_DISABLE_SHARED], [])
+
+
+
+# _LT_ENABLE_STATIC([DEFAULT])
+# ----------------------------
+# implement the --enable-static flag, and support the `static' and
+# `disable-static' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_STATIC],
+[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([static],
+    [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+	[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_static=yes ;;
+    no) enable_static=no ;;
+    *)
+     enable_static=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_static=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
+
+    _LT_DECL([build_old_libs], [enable_static], [0],
+	[Whether or not to build static libraries])
+])# _LT_ENABLE_STATIC
+
+LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
+])
+
+AC_DEFUN([AC_DISABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], [disable-static])
+])
+
+AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_STATIC], [])
+dnl AC_DEFUN([AM_DISABLE_STATIC], [])
+
+
+
+# _LT_ENABLE_FAST_INSTALL([DEFAULT])
+# ----------------------------------
+# implement the --enable-fast-install flag, and support the `fast-install'
+# and `disable-fast-install' LT_INIT options.
+# DEFAULT is either `yes' or `no'.  If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_FAST_INSTALL],
+[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([fast-install],
+    [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+    [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+    [p=${PACKAGE-default}
+    case $enableval in
+    yes) enable_fast_install=yes ;;
+    no) enable_fast_install=no ;;
+    *)
+      enable_fast_install=no
+      # Look at the argument we got.  We use all the common list separators.
+      lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+      for pkg in $enableval; do
+	IFS="$lt_save_ifs"
+	if test "X$pkg" = "X$p"; then
+	  enable_fast_install=yes
+	fi
+      done
+      IFS="$lt_save_ifs"
+      ;;
+    esac],
+    [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
+
+_LT_DECL([fast_install], [enable_fast_install], [0],
+	 [Whether or not to optimize for fast installation])dnl
+])# _LT_ENABLE_FAST_INSTALL
+
+LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
+
+# Old names:
+AU_DEFUN([AC_ENABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `fast-install' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AC_DISABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-fast-install' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
+dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
+
+
+# _LT_WITH_PIC([MODE])
+# --------------------
+# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# LT_INIT options.
+# MODE is either `yes' or `no'.  If omitted, it defaults to `both'.
+m4_define([_LT_WITH_PIC],
+[AC_ARG_WITH([pic],
+    [AS_HELP_STRING([--with-pic],
+	[try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+    [pic_mode="$withval"],
+    [pic_mode=default])
+
+test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
+
+_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
+])# _LT_WITH_PIC
+
+LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
+
+# Old name:
+AU_DEFUN([AC_LIBTOOL_PICMODE],
+[_LT_SET_OPTION([LT_INIT], [pic-only])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `pic-only' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
+
+## ----------------- ##
+## LTDL_INIT Options ##
+## ----------------- ##
+
+m4_define([_LTDL_MODE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
+		 [m4_define([_LTDL_MODE], [nonrecursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [recursive],
+		 [m4_define([_LTDL_MODE], [recursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [subproject],
+		 [m4_define([_LTDL_MODE], [subproject])])
+
+m4_define([_LTDL_TYPE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [installable],
+		 [m4_define([_LTDL_TYPE], [installable])])
+LT_OPTION_DEFINE([LTDL_INIT], [convenience],
+		 [m4_define([_LTDL_TYPE], [convenience])])
diff --git a/macros/ltsugar.m4 b/macros/ltsugar.m4
new file mode 100644
index 0000000..9000a05
--- /dev/null
+++ b/macros/ltsugar.m4
@@ -0,0 +1,123 @@
+# ltsugar.m4 -- libtool m4 base layer.                         -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# 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 6 ltsugar.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
+
+
+# lt_join(SEP, ARG1, [ARG2...])
+# -----------------------------
+# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
+# associated separator.
+# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
+# versions in m4sugar had bugs.
+m4_define([lt_join],
+[m4_if([$#], [1], [],
+       [$#], [2], [[$2]],
+       [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
+m4_define([_lt_join],
+[m4_if([$#$2], [2], [],
+       [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
+
+
+# lt_car(LIST)
+# lt_cdr(LIST)
+# ------------
+# Manipulate m4 lists.
+# These macros are necessary as long as will still need to support
+# Autoconf-2.59 which quotes differently.
+m4_define([lt_car], [[$1]])
+m4_define([lt_cdr],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+       [$#], 1, [],
+       [m4_dquote(m4_shift($@))])])
+m4_define([lt_unquote], $1)
+
+
+# lt_append(MACRO-NAME, STRING, [SEPARATOR])
+# ------------------------------------------
+# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
+# Note that neither SEPARATOR nor STRING are expanded; they are appended
+# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
+# No SEPARATOR is output if MACRO-NAME was previously undefined (different
+# than defined and empty).
+#
+# This macro is needed until we can rely on Autoconf 2.62, since earlier
+# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
+m4_define([lt_append],
+[m4_define([$1],
+	   m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
+
+
+
+# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
+# ----------------------------------------------------------
+# Produce a SEP delimited list of all paired combinations of elements of
+# PREFIX-LIST with SUFFIX1 through SUFFIXn.  Each element of the list
+# has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
+m4_define([lt_combine],
+[m4_if(m4_eval([$# > 3]), [1],
+       [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+	     [m4_foreach([_Lt_suffix],
+		]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+	[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
+
+
+# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
+# -----------------------------------------------------------------------
+# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
+# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
+m4_define([lt_if_append_uniq],
+[m4_ifdef([$1],
+	  [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
+		 [lt_append([$1], [$2], [$3])$4],
+		 [$5])],
+	  [lt_append([$1], [$2], [$3])$4])])
+
+
+# lt_dict_add(DICT, KEY, VALUE)
+# -----------------------------
+m4_define([lt_dict_add],
+[m4_define([$1($2)], [$3])])
+
+
+# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
+# --------------------------------------------
+m4_define([lt_dict_add_subkey],
+[m4_define([$1($2:$3)], [$4])])
+
+
+# lt_dict_fetch(DICT, KEY, [SUBKEY])
+# ----------------------------------
+m4_define([lt_dict_fetch],
+[m4_ifval([$3],
+	m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
+    m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
+
+
+# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
+# -----------------------------------------------------------------
+m4_define([lt_if_dict_fetch],
+[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
+	[$5],
+    [$6])])
+
+
+# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
+# --------------------------------------------------------------
+m4_define([lt_dict_filter],
+[m4_if([$5], [], [],
+  [lt_join(m4_quote(m4_default([$4], [[, ]])),
+           lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
+		      [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
+])
diff --git a/macros/ltversion.m4 b/macros/ltversion.m4
new file mode 100644
index 0000000..9c7b5d4
--- /dev/null
+++ b/macros/ltversion.m4
@@ -0,0 +1,23 @@
+# ltversion.m4 -- version numbers			-*- Autoconf -*-
+#
+#   Copyright (C) 2004 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004
+#
+# 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.
+
+# @configure_input@
+
+# serial 3293 ltversion.m4
+# This file is part of GNU Libtool
+
+m4_define([LT_PACKAGE_VERSION], [2.4])
+m4_define([LT_PACKAGE_REVISION], [1.3293])
+
+AC_DEFUN([LTVERSION_VERSION],
+[macro_version='2.4'
+macro_revision='1.3293'
+_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
+_LT_DECL(, macro_revision, 0)
+])
diff --git a/macros/lt~obsolete.m4 b/macros/lt~obsolete.m4
new file mode 100644
index 0000000..c573da9
--- /dev/null
+++ b/macros/lt~obsolete.m4
@@ -0,0 +1,98 @@
+# lt~obsolete.m4 -- aclocal satisfying obsolete definitions.    -*-Autoconf-*-
+#
+#   Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+#   Written by Scott James Remnant, 2004.
+#
+# 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 lt~obsolete.m4
+
+# These exist entirely to fool aclocal when bootstrapping libtool.
+#
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
+# which have later been changed to m4_define as they aren't part of the
+# exported API, or moved to Autoconf or Automake where they belong.
+#
+# The trouble is, aclocal is a bit thick.  It'll see the old AC_DEFUN
+# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
+# using a macro with the same name in our local m4/libtool.m4 it'll
+# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
+# and doesn't know about Autoconf macros at all.)
+#
+# So we provide this file, which has a silly filename so it's always
+# included after everything else.  This provides aclocal with the
+# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
+# because those macros already exist, or will be overwritten later.
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. 
+#
+# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
+# Yes, that means every name once taken will need to remain here until
+# we give up compatibility with versions before 1.7, at which point
+# we need to keep only those names which we still refer to.
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
+
+m4_ifndef([AC_LIBTOOL_LINKER_OPTION],	[AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
+m4_ifndef([AC_PROG_EGREP],		[AC_DEFUN([AC_PROG_EGREP])])
+m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_AC_SHELL_INIT],		[AC_DEFUN([_LT_AC_SHELL_INIT])])
+m4_ifndef([_LT_AC_SYS_LIBPATH_AIX],	[AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
+m4_ifndef([_LT_PROG_LTMAIN],		[AC_DEFUN([_LT_PROG_LTMAIN])])
+m4_ifndef([_LT_AC_TAGVAR],		[AC_DEFUN([_LT_AC_TAGVAR])])
+m4_ifndef([AC_LTDL_ENABLE_INSTALL],	[AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
+m4_ifndef([AC_LTDL_PREOPEN],		[AC_DEFUN([AC_LTDL_PREOPEN])])
+m4_ifndef([_LT_AC_SYS_COMPILER],	[AC_DEFUN([_LT_AC_SYS_COMPILER])])
+m4_ifndef([_LT_AC_LOCK],		[AC_DEFUN([_LT_AC_LOCK])])
+m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE],	[AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
+m4_ifndef([_LT_AC_TRY_DLOPEN_SELF],	[AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
+m4_ifndef([AC_LIBTOOL_PROG_CC_C_O],	[AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
+m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
+m4_ifndef([AC_LIBTOOL_OBJDIR],		[AC_DEFUN([AC_LIBTOOL_OBJDIR])])
+m4_ifndef([AC_LTDL_OBJDIR],		[AC_DEFUN([AC_LTDL_OBJDIR])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
+m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP],	[AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
+m4_ifndef([AC_PATH_MAGIC],		[AC_DEFUN([AC_PATH_MAGIC])])
+m4_ifndef([AC_PROG_LD_GNU],		[AC_DEFUN([AC_PROG_LD_GNU])])
+m4_ifndef([AC_PROG_LD_RELOAD_FLAG],	[AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
+m4_ifndef([AC_DEPLIBS_CHECK_METHOD],	[AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
+m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS],	[AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
+m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP],	[AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
+m4_ifndef([LT_AC_PROG_EGREP],		[AC_DEFUN([LT_AC_PROG_EGREP])])
+m4_ifndef([LT_AC_PROG_SED],		[AC_DEFUN([LT_AC_PROG_SED])])
+m4_ifndef([_LT_CC_BASENAME],		[AC_DEFUN([_LT_CC_BASENAME])])
+m4_ifndef([_LT_COMPILER_BOILERPLATE],	[AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
+m4_ifndef([_LT_LINKER_BOILERPLATE],	[AC_DEFUN([_LT_LINKER_BOILERPLATE])])
+m4_ifndef([_AC_PROG_LIBTOOL],		[AC_DEFUN([_AC_PROG_LIBTOOL])])
+m4_ifndef([AC_LIBTOOL_SETUP],		[AC_DEFUN([AC_LIBTOOL_SETUP])])
+m4_ifndef([_LT_AC_CHECK_DLFCN],		[AC_DEFUN([_LT_AC_CHECK_DLFCN])])
+m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER],	[AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
+m4_ifndef([_LT_AC_TAGCONFIG],		[AC_DEFUN([_LT_AC_TAGCONFIG])])
+m4_ifndef([AC_DISABLE_FAST_INSTALL],	[AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
+m4_ifndef([_LT_AC_LANG_CXX],		[AC_DEFUN([_LT_AC_LANG_CXX])])
+m4_ifndef([_LT_AC_LANG_F77],		[AC_DEFUN([_LT_AC_LANG_F77])])
+m4_ifndef([_LT_AC_LANG_GCJ],		[AC_DEFUN([_LT_AC_LANG_GCJ])])
+m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
+m4_ifndef([_LT_AC_LANG_C_CONFIG],	[AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
+m4_ifndef([_LT_AC_LANG_CXX_CONFIG],	[AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
+m4_ifndef([_LT_AC_LANG_F77_CONFIG],	[AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
+m4_ifndef([_LT_AC_LANG_GCJ_CONFIG],	[AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG],	[AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
+m4_ifndef([_LT_AC_LANG_RC_CONFIG],	[AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
+m4_ifndef([AC_LIBTOOL_CONFIG],		[AC_DEFUN([AC_LIBTOOL_CONFIG])])
+m4_ifndef([_LT_AC_FILE_LTDLL_C],	[AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
+m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS],	[AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
+m4_ifndef([_LT_AC_PROG_CXXCPP],		[AC_DEFUN([_LT_AC_PROG_CXXCPP])])
+m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS],	[AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
+m4_ifndef([_LT_PROG_ECHO_BACKSLASH],	[AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_PROG_F77],		[AC_DEFUN([_LT_PROG_F77])])
+m4_ifndef([_LT_PROG_FC],		[AC_DEFUN([_LT_PROG_FC])])
+m4_ifndef([_LT_PROG_CXX],		[AC_DEFUN([_LT_PROG_CXX])])
diff --git a/macros/maple-check-version.mpl b/macros/maple-check-version.mpl
index 384a95c..c27a14c 100644
--- a/macros/maple-check-version.mpl
+++ b/macros/maple-check-version.mpl
@@ -1,3 +1,8 @@
+# Copyright (c) the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+
+
 fd := FileTools[Text][Open]("maple_version.txt", create=true, overwrite=true);
 v:=substring(kernelopts(version),7..SearchText(".",kernelopts(version))-1);
-FileTools[Text][WriteString](fd,convert(v,string));
\ No newline at end of file
+FileTools[Text][WriteString](fd,convert(v,string));
diff --git a/macros/maple-check.m4 b/macros/maple-check.m4
index fe46d95..c5ccb6d 100644
--- a/macros/maple-check.m4
+++ b/macros/maple-check.m4
@@ -10,6 +10,11 @@
 # Shamelessly stolen from Owen Taylor
 
 
+# Copyright (c) the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+
+
 
 
 #Enables the compilation of the drivers
@@ -17,7 +22,7 @@ AC_DEFUN([LB_DRIVER],
 [
 AC_MSG_CHECKING([whether to compile the drivers])
 
-AC_ARG_ENABLE(drivers, [  --enable-drivers Enable the compilation of the drivers],
+AC_ARG_ENABLE(drivers, [AC_HELP_STRING([--enable-drivers], [Enable the compilation of the drivers])],
 [
 AC_MSG_RESULT(yes)
 compile_drivers="yes"
@@ -33,22 +38,22 @@ AC_DEFUN([LB_CHECK_MAPLE],
 [
 
 AC_ARG_WITH(maple,
-[ --with-maple=<path>|yes|no Use Maple library. If argument is no, you do not 
-  			    have the library installed on your machine (set as 
-			    default). If argument is yes or <empty> that means 
+[AC_HELP_STRING([--with-maple=<path>|yes|no], [Use Maple library. If argument is no, you do not
+  			    have the library installed on your machine (set as
+			    default). If argument is yes or <empty> that means
 			    the library is well installed and so reachable.
 			    Otherwise you give the <path> to the directory which
-			    contains the Software. 
-	    ],
+			    contains the Software.
+	    ])],
             [if test "$withval" = yes ; then
-		MAPLE_HOME_PATH="${DEFAULT_CHECKING_PATH} unknown"	
-	      elif test "$withval" != no ; then			
+		MAPLE_HOME_PATH="${DEFAULT_CHECKING_PATH} unknown"
+	      elif test "$withval" != no ; then
 		MAPLE_HOME_PATH="$withval ${DEFAULT_CHECKING_PATH} unknown"
 	     fi	],
 	    [])
 
-AC_ARG_ENABLE(shared,
-[  --enable-shared Check for shared compilation (needed by --with-maple)],
+AC_ARG_ENABLE(shared, dnl this name is a bad idea
+[AC_HELP_STRING([--enable-shared], [Check for shared compilation (needed by --with-maple)])],
 	      [have_shared="$enableval"],
               [have_shared="no"])
 
@@ -63,13 +68,13 @@ if test ${LIB_DIR} = "NONE/lib" ; then
 fi
 
 
-for MAPLE_HOME in ${MAPLE_HOME_PATH} 
+for MAPLE_HOME in ${MAPLE_HOME_PATH}
 do
 		if test "x$MAPLE_HOME" != "xunknown"; then
 			if test -r "${MAPLE_HOME}/bin/maple.system.type" && test -r "${MAPLE_HOME}/extern/include/maplec.h" ; then
 				MAPLE_BIN=${MAPLE_HOME}/`${MAPLE_HOME}/bin/maple.system.type`
-			else			
-				MAPLE_BIN=""								
+			else
+				MAPLE_BIN=""
 			fi
 		else
 			if test -r "/usr/local/bin/xmaple" && test -r "/usr/local/bin/maple.system.type"; then
@@ -79,12 +84,12 @@ do
 					MAPLE_HOME=`sed -ne "s/MAPLE='\(.*\)'/\\1/p" /usr/bin/xmaple`
 					MAPLE_BIN="${MAPLE_HOME}/"`${MAPLE_HOME}/bin/maple.system.type`
 			else
-					MAPLE_BIN=""				
+					MAPLE_BIN=""
 			fi
-		fi					
-	
+		fi
+
 		if test -z "${MAPLE_BIN}" ; then
-			maple_found="no"			
+			maple_found="no"
 		else
 			maple_found="yes"
 			if test $have_shared = "yes"; then
@@ -95,26 +100,26 @@ do
 					AC_MSG_RESULT(problem)
 					echo " your version of Maple is too old, at least version 9 is recquired. Disabling."
 					break
-				else			
-					AC_MSG_RESULT(found)	
+				else
+					AC_MSG_RESULT(found)
 					LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${MAPLE_BIN}:${LIB_DIR}"
 					LD_RUN_PATH="${LD_RUN_PATH}:${MAPLE_BIN}:${LIB_DIR}"
 					export LD_LIBRARY_PATH
 					export LD_RUN_PATH
 					MAPLE_LIBS="-L${MAPLE_BIN} -lmaplec -lstdc++"
-					MAPLE_CFLAGS="-I${MAPLE_HOME}/extern/include"				
+					MAPLE_CFLAGS="-I${MAPLE_HOME}/extern/include"
        					AC_SUBST(MAPLE_LIBS)
 					AC_SUBST(MAPLE_CFLAGS)
 					AC_SUBST(MAPLE_HOME)
 					AC_SUBST(MAPLE_VERSION)
 					if test ${MAPLE_VERSION} -ge 10 	; then
-						AC_DEFINE_UNQUOTED(MAPLE_GMP_ACCESS,, [define is the version of Maple have access function to gmp data])	
+						AC_DEFINE_UNQUOTED(MAPLE_GMP_ACCESS,, [define is the version of Maple have access function to gmp data])
 					fi
 					AC_DEFINE(HAVE_MAPLE,1,[Define if MAPLE is installed])
 					HAVE_MAPLE=yes
 					break
 				fi
-			else			
+			else
 				AC_MSG_RESULT(problem)
 				echo " you need to give option --enable-shared to allow Maple interfacing. Disabling."
 				break
diff --git a/macros/ntl-check.m4 b/macros/ntl-check.m4
index 115e914..5429cbe 100644
--- a/macros/ntl-check.m4
+++ b/macros/ntl-check.m4
@@ -7,6 +7,10 @@
 # stolen back from Frank Belew
 # stolen from Manish Singh
 # Shamelessly stolen from Owen Taylor
+# Copyright (c) the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+
 
 dnl LB_CHECK_NTL ([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
 dnl
@@ -17,13 +21,13 @@ AC_DEFUN([LB_CHECK_NTL],
 [
 
 AC_ARG_WITH(ntl,
-[  --with-ntl=<path>|yes|no  Use NTL library. If argument is no, you do not have
-                            the library installed on your machine (set as 
-			    default). If argument is yes or <empty> that means 
-			    the library is reachable with the standard search 
-			    path (/usr or /usr/local). Otherwise you give the 
-			    <path> to the directory which contain the library. 
-	     ],
+[AC_HELP_STRING([--with-ntl=<path>|yes|no], [Use NTL library. If argument is no, you do not have
+                            the library installed on your machine (set as
+			    default). If argument is yes or <empty> that means
+			    the library is reachable with the standard search
+			    path (/usr or /usr/local). Otherwise you give the
+			    <path> to the directory which contain the library.
+	     ])],
 	     [if test "$withval" = yes ; then
 			NTL_HOME_PATH="${DEFAULT_CHECKING_PATH}"
 	      elif test "$withval" != no ; then
@@ -42,8 +46,8 @@ if test -n "$NTL_HOME_PATH"; then
 AC_MSG_CHECKING(for NTL >= $min_ntl_version)
 fi
 
-for NTL_HOME in ${NTL_HOME_PATH} 
- do	
+for NTL_HOME in ${NTL_HOME_PATH}
+ do
 if test -r "$NTL_HOME/include/NTL/ZZ.h"; then
 
 	if test "x$NTL_HOME" != "x/usr" -a "x$NTL_HOME" != "x/usr/local"; then
@@ -51,9 +55,9 @@ if test -r "$NTL_HOME/include/NTL/ZZ.h"; then
 		NTL_LIBS="-L${NTL_HOME}/lib -lntl"
 	else
 		NTL_CFLAGS=
-		NTL_LIBS="-lntl"		
-	fi	
-	CXXFLAGS="${BACKUP_CXXFLAGS} ${NTL_CFLAGS} ${GMP_CFLAGS}" 
+		NTL_LIBS="-lntl"
+	fi
+	CXXFLAGS="${BACKUP_CXXFLAGS} ${NTL_CFLAGS} ${GMP_CFLAGS}"
 	LIBS="${BACKUP_LIBS} ${NTL_LIBS} ${GMP_LIBS}"
 
 	AC_TRY_LINK(
@@ -62,32 +66,32 @@ if test -r "$NTL_HOME/include/NTL/ZZ.h"; then
 	[
 	AC_TRY_RUN(
 	[#include <NTL/version.h>
-	int main () { if (NTL_MAJOR_VERSION < 5) return -1; else return 0; }	
+	int main () { if (NTL_MAJOR_VERSION < 5) return -1; else return 0; }
 	],[
-	ntl_found="yes"	
+	ntl_found="yes"
 	break
-	],[	
-	ntl_problem="$problem $NTL_HOME"	
+	],[
+	ntl_problem="$problem $NTL_HOME"
 	unset NTL_CFLAGS
-	unset NTL_LIBS	
+	unset NTL_LIBS
 	],[
 	ntl_found="yes"
-	ntl_cross="yes"	
+	ntl_cross="yes"
 	break
-	])	
+	])
 	],
 	[
 	ntl_found="no"
 	ntl_checked="$checked $NTL_HOME"
 	unset NTL_CFLAGS
-	unset NTL_LIBS	
+	unset NTL_LIBS
 	])
 else
 	ntl_found="no"
 fi
 done
 
-if test "x$ntl_found" = "xyes" ; then		
+if test "x$ntl_found" = "xyes" ; then
 	AC_SUBST(NTL_CFLAGS)
 	AC_SUBST(NTL_LIBS)
 	AC_DEFINE(HAVE_NTL,1,[Define if NTL is installed])
@@ -109,8 +113,8 @@ elif test   "x$ntl_found" = "xno";  then
 	if test "x$NTL_HOME" != "x/usr" -a "x$NTL_HOME" != "x/usr/local" ; then
 		AC_MSG_WARN(NTL >= $min_ntl_version was not found. LinBox also requires the NTL namespace to be enabled.  Please make sure NTL is compiled correctly.)
 	fi
-	ifelse([$3], , :, [$3])	
-fi	
+	ifelse([$3], , :, [$3])
+fi
 
 
 
diff --git a/macros/saclib-check.m4 b/macros/saclib-check.m4
index 7fe82b4..6c92f0e 100644
--- a/macros/saclib-check.m4
+++ b/macros/saclib-check.m4
@@ -1,12 +1,16 @@
 # Check for SACLIB
 # Bradford Hovinen, 2001-06-13
-# Modified by Pascal Giorgi, 2003-12-03 
+# Modified by Pascal Giorgi, 2003-12-03
 # Inspired by gnome-bonobo-check.m4 by Miguel de Icaza, 99-04-12
 # Stolen from Chris Lahey       99-2-5
 # stolen from Manish Singh again
 # stolen back from Frank Belew
 # stolen from Manish Singh
 # Shamelessly stolen from Owen Taylor
+# Copyright (c) the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+
 
 dnl LB_CHECK_SACLIB ([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
 dnl
@@ -16,14 +20,14 @@ AC_DEFUN([LB_CHECK_SACLIB],
 [
 
 AC_ARG_WITH(saclib,
-[  --with-saclib=<path>|yes|no Use Saclib library. If argument is no, you do 
-                              not have the library installed on your machine 
-			      (set as default). If argument is yes or <empty> 
-			      that means the library is reachable with the 
+[AC_HELP_STRING([--with-saclib=<path>|yes|no], [Use Saclib library. If argument is no, you do
+                              not have the library installed on your machine
+			      (set as default). If argument is yes or <empty>
+			      that means the library is reachable with the
 			      standard search path (/usr or /usr/local).
-			      Otherwise you give the <path> to the directory 
-			      which contain the library. 
-	     ],
+			      Otherwise you give the <path> to the directory
+			      which contain the library.
+	     ])],
 	     [if test "$withval" = yes ; then
 			SACLIB_HOME_PATH="${DEFAULT_CHECKING_PATH}"
 	      elif test "$withval" != no ; then
@@ -43,7 +47,7 @@ if test -n  "$SACLIB_HOME_PATH"; then
 AC_MSG_CHECKING(for SACLIB >= $min_saclib_version)
 fi
 
-for SACLIB_HOME in ${SACLIB_HOME_PATH} 
+for SACLIB_HOME in ${SACLIB_HOME_PATH}
  do
 if test -r "$SACLIB_HOME/include/saclib.h"; then
 
@@ -52,9 +56,9 @@ if test -r "$SACLIB_HOME/include/saclib.h"; then
 		SACLIB_LIBS="-L${SACLIB_HOME}/lib -lsaclib"
 	else
 		SACLIB_CFLAGS=
-		SACLIB_LIBS="-lsaclib"		
+		SACLIB_LIBS="-lsaclib"
 	fi
-	
+
 	CXXFLAGS="${BACKUP_CXXFLAGS} ${SACLIB_CFLAGS} ${GMP_CFLAGS}" 	LIBS="${BACKUP_LIBS} ${SACLIB_LIBS} ${GMP_LIBS}"
 
 	AC_TRY_LINK(
@@ -65,14 +69,14 @@ if test -r "$SACLIB_HOME/include/saclib.h"; then
 	[#include <saclib.h>
 	int main () {  if ( __GNU_MP_VERSION < 3) return -1; else return 0; }
 	],[
-	saclib_found="yes"		
+	saclib_found="yes"
 	break
 	],[
-	saclib_problem="$problem $SACLIB_HOME"	
+	saclib_problem="$problem $SACLIB_HOME"
 	unset SACLIB_CFLAGS
 	unset SACLIB_LIBS
 
-	
+
 	],[
 	saclib_found="yes"
 	saclib_cross="yes"
@@ -81,7 +85,7 @@ if test -r "$SACLIB_HOME/include/saclib.h"; then
 	],
 	[
 	saclib_found="no"
-	saclib_checked="$saclib_checked $SACLIB_HOME"	
+	saclib_checked="$saclib_checked $SACLIB_HOME"
 	unset SACLIB_CFLAGS
 	unset SACLIB_LIBS
 	])
@@ -92,7 +96,7 @@ fi
 done
 
 
-if test "x$saclib_found" = "xyes" ; then		
+if test "x$saclib_found" = "xyes" ; then
 	AC_SUBST(SACLIB_CFLAGS)
 	AC_SUBST(SACLIB_LIBS)
 	AC_DEFINE(HAVE_SACLIB,1,[Define if SACLIB is installed])
@@ -113,7 +117,7 @@ elif test -n "$saclib_problem"; then
 elif test "x$saclib_found" = "xno" ; then
 	AC_MSG_RESULT(not found)
 	ifelse([$3], , :, [$3])
-fi	
+fi
 
 
 
@@ -123,4 +127,4 @@ CXXFLAGS=${BACKUP_CXXFLAGS}
 LIBS=${BACKUP_LIBS}
 #unset LD_LIBRARY_PATH
 
-])
\ No newline at end of file
+])
diff --git a/macros/sage-check.m4 b/macros/sage-check.m4
index de5de5d..eb12be4 100644
--- a/macros/sage-check.m4
+++ b/macros/sage-check.m4
@@ -1,12 +1,33 @@
+# Copyright (c) the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+
+
 AC_DEFUN([LB_CHECK_SAGE],
 [
 AC_MSG_CHECKING([whether to compile the sage interface])
 
-AC_ARG_ENABLE(sage, 
-[  --enable-sage Enable the compilation of the sage interface],
+AC_ARG_ENABLE(sage,
+[AC_HELP_STRING([--enable-sage], [Enable the compilation of the sage interface])],
 [
 AC_MSG_RESULT(yes)
 sage_interface="yes"
+
+if test "x$HAVE_NTL" = "xyes" ; then
+dnl  AC_CHECK_TOOL(OBJDUMP, objdump, false)
+AC_MSG_CHECKING([whether NTL was built with -fPIC])
+res=yes;
+$OBJDUMP --reloc $NTL_HOME/lib/libntl.a | $EGREP '(GOT|PLT|JU?MP_SLOT)' >/dev/null || res=no
+if test "x$res" = "xno" ; then
+	AC_MSG_RESULT(no)
+	echo
+	echo "You must have NTL compiled with -fPIC for Sage interface  "
+    exit 1
+else
+	AC_MSG_RESULT(yes)
+fi
+fi
+
 ],[
 AC_MSG_RESULT(no)
 sage_interface="no"
diff --git a/missing b/missing
deleted file mode 100755
index 1c8ff70..0000000
--- a/missing
+++ /dev/null
@@ -1,367 +0,0 @@
-#! /bin/sh
-# Common stub for a few missing GNU programs while installing.
-
-scriptversion=2006-05-10.23
-
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
-#   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
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU 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.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-if test $# -eq 0; then
-  echo 1>&2 "Try \`$0 --help' for more information"
-  exit 1
-fi
-
-run=:
-sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
-sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
-
-# In the cases where this matters, `missing' is being run in the
-# srcdir already.
-if test -f configure.ac; then
-  configure_ac=configure.ac
-else
-  configure_ac=configure.in
-fi
-
-msg="missing on your system"
-
-case $1 in
---run)
-  # Try to run requested program, and just exit if it succeeds.
-  run=
-  shift
-  "$@" && exit 0
-  # Exit code 63 means version mismatch.  This often happens
-  # when the user try to use an ancient version of a tool on
-  # a file that requires a minimum version.  In this case we
-  # we should proceed has if the program had been absent, or
-  # if --run hadn't been passed.
-  if test $? = 63; then
-    run=:
-    msg="probably too old"
-  fi
-  ;;
-
-  -h|--h|--he|--hel|--help)
-    echo "\
-$0 [OPTION]... PROGRAM [ARGUMENT]...
-
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
-error status if there is no known handling for PROGRAM.
-
-Options:
-  -h, --help      display this help and exit
-  -v, --version   output version information and exit
-  --run           try to run the given command, and emulate it if it fails
-
-Supported PROGRAM values:
-  aclocal      touch file \`aclocal.m4'
-  autoconf     touch file \`configure'
-  autoheader   touch file \`config.h.in'
-  autom4te     touch the output file, or create a stub one
-  automake     touch all \`Makefile.in' files
-  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
-  flex         create \`lex.yy.c', if possible, from existing .c
-  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]
-
-Send bug reports to <bug-automake at gnu.org>."
-    exit $?
-    ;;
-
-  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
-    echo "missing $scriptversion (GNU Automake)"
-    exit $?
-    ;;
-
-  -*)
-    echo 1>&2 "$0: Unknown \`$1' option"
-    echo 1>&2 "Try \`$0 --help' for more information"
-    exit 1
-    ;;
-
-esac
-
-# Now exit if we have it, but it failed.  Also exit now if we
-# don't have it and --version was passed (most likely to detect
-# the program).
-case $1 in
-  lex|yacc)
-    # 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.
-       exit 1
-    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
-       # Could not run --version or --help.  This is probably someone
-       # running `$TOOL --version' or `$TOOL --help' to check whether
-       # $TOOL exists and not knowing $TOOL uses missing.
-       exit 1
-    fi
-    ;;
-esac
-
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case $1 in
-  aclocal*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
-         to install the \`Automake' and \`Perl' packages.  Grab them from
-         any GNU archive site."
-    touch aclocal.m4
-    ;;
-
-  autoconf)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`${configure_ac}'.  You might want to install the
-         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
-         archive site."
-    touch configure
-    ;;
-
-  autoheader)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
-         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
-         from any GNU archive site."
-    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
-    test -z "$files" && files="config.h"
-    touch_files=
-    for f in $files; do
-      case $f in
-      *:*) touch_files="$touch_files "`echo "$f" |
-				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
-      *) touch_files="$touch_files $f.in";;
-      esac
-    done
-    touch $touch_files
-    ;;
-
-  automake*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
-         You might want to install the \`Automake' and \`Perl' packages.
-         Grab them from any GNU archive site."
-    find . -type f -name Makefile.am -print |
-	   sed 's/\.am$/.in/' |
-	   while read f; do touch "$f"; done
-    ;;
-
-  autom4te)
-    echo 1>&2 "\
-WARNING: \`$1' is needed, but is $msg.
-         You might have modified some files without having the
-         proper tools for further handling them.
-         You can get \`$1' as part of \`Autoconf' from any GNU
-         archive site."
-
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -f "$file"; then
-	touch $file
-    else
-	test -z "$file" || exec >$file
-	echo "#! /bin/sh"
-	echo "# Created by GNU Automake missing as a replacement of"
-	echo "#  $ $@"
-	echo "exit 0"
-	chmod +x $file
-	exit 1
-    fi
-    ;;
-
-  bison|yacc)
-    echo 1>&2 "\
-WARNING: \`$1' $msg.  You should only need it if
-         you modified a \`.y' file.  You may need the \`Bison' package
-         in order for those modifications to take effect.  You can get
-         \`Bison' from any GNU archive site."
-    rm -f y.tab.c y.tab.h
-    if test $# -ne 1; then
-        eval LASTARG="\${$#}"
-	case $LASTARG in
-	*.y)
-	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
-	    if test -f "$SRCFILE"; then
-	         cp "$SRCFILE" y.tab.c
-	    fi
-	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
-	    if test -f "$SRCFILE"; then
-	         cp "$SRCFILE" y.tab.h
-	    fi
-	  ;;
-	esac
-    fi
-    if test ! -f y.tab.h; then
-	echo >y.tab.h
-    fi
-    if test ! -f y.tab.c; then
-	echo 'main() { return 0; }' >y.tab.c
-    fi
-    ;;
-
-  lex|flex)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified a \`.l' file.  You may need the \`Flex' package
-         in order for those modifications to take effect.  You can get
-         \`Flex' from any GNU archive site."
-    rm -f lex.yy.c
-    if test $# -ne 1; then
-        eval LASTARG="\${$#}"
-	case $LASTARG in
-	*.l)
-	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
-	    if test -f "$SRCFILE"; then
-	         cp "$SRCFILE" lex.yy.c
-	    fi
-	  ;;
-	esac
-    fi
-    if test ! -f lex.yy.c; then
-	echo 'main() { return 0; }' >lex.yy.c
-    fi
-    ;;
-
-  help2man)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-	 you modified a dependency of a manual page.  You may need the
-	 \`Help2man' package in order for those modifications to take
-	 effect.  You can get \`Help2man' from any GNU archive site."
-
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -f "$file"; then
-	touch $file
-    else
-	test -z "$file" || exec >$file
-	echo ".ab help2man is required to generate this page"
-	exit 1
-    fi
-    ;;
-
-  makeinfo)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified a \`.texi' or \`.texinfo' file, or any other file
-         indirectly affecting the aspect of the manual.  The spurious
-         call might also be the consequence of using a buggy \`make' (AIX,
-         DU, IRIX).  You might want to install the \`Texinfo' package or
-         the \`GNU make' package.  Grab either from any GNU archive site."
-    # The file to touch is that specified with -o ...
-    file=`echo "$*" | sed -n "$sed_output"`
-    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
-    if test -z "$file"; then
-      # ... or it is the one specified with @setfilename ...
-      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
-      file=`sed -n '
-	/^@setfilename/{
-	  s/.* \([^ ]*\) *$/\1/
-	  p
-	  q
-	}' $infile`
-      # ... or it is derived from the source name (dir/f.texi becomes f.info)
-      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
-    fi
-    # If the file does not exist, the user really needs makeinfo;
-    # let's fail without touching anything.
-    test -f $file || exit 1
-    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.
-         You might have modified some files without having the
-         proper tools for further handling them.  Check the \`README' file,
-         it often tells you about the needed prerequisites for installing
-         this package.  You may also peek at any GNU archive site, in case
-         some other package would contain this missing \`$1' program."
-    exit 1
-    ;;
-esac
-
-exit 0
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 237ad66..e3641b1 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,150 +1,175 @@
-INCLUDES=-I$(top_srcdir) -I$(top_srcdir)/linbox
-#AM_LDFLAGS = -llapack -lcblas -latlas 
-#AM_CXXFLAGS = -g -DLinBoxSrcOnly -Wall -O2 
-AM_CXXFLAGS = -g -DLinBoxSrcOnly -Wall 
-#AM_CFLAGS = -g -Wall
-
-SUBDIRS = data
-
-AM_CPPFLAGS= $(CBLAS_FLAG) $(GMP_CFLAGS) $(NTL_CFLAGS) $(GIVARO_CFLAGS) $(LIDIA_CFLAGS)
-LDADD = $(BLAS_LIBS) $(NTL_LIBS) $(GMP_LIBS) $(GIVARO_LIBS) $(LIDIA_LIBS)
-
-EXTRA_DIST=\
-test-common.C
-
-# Put an entry for your test-mycomponent.C here (or in one of the other test groups).  
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+
+AM_CPPFLAGS=-I$(top_srcdir) -I$(top_srcdir)/linbox
+# AM_LDFLAGS = -llapack -lcblas -latlas
+AM_LDFLAGS = $(top_srcdir)/linbox/.libs/liblinbox.a
+#  SAFER_FLAGS = -g -Wall -Wextra -Wno-unused-parameter
+# bds: no need to optimize for unit/regression tests, and opt adds a lot to compilation time
+AM_CXXFLAGS = @TESTS_CFLAGS@ -DLinBoxSrcOnly
+#  AM_CXXFLAGS = $(SAFER_FLAGS) -DLinBoxSrcOnly
+#AM_CXXFLAGS = $(SAFER_FLAGS) -DLinBoxSrcOnly -O2
+# AM_CXXFLAGS = -g -DLinBoxSrcOnly -Wall -DDEBUG -O0
+# AM_CXXFLAGS = -g -DLinBoxSrcOnly -Wall -D__LINBOX_HAVE_DGETRF -D__LINBOX_HAVE_DGETRI
+# AM_CFLAGS = -g -Wall
+
+SUBDIRS = data matrix
+
+AM_CPPFLAGS+= $(CBLAS_FLAG) $(FFLAFLAS_CFLAGS) $(GMP_CFLAGS) $(NTL_CFLAGS) $(GIVARO_CFLAGS) $(LIDIA_CFLAGS)
+LDADD = $(BLAS_LIBS) $(NTL_LIBS) $(GIVARO_LIBS) $(GMP_LIBS)  $(LIDIA_LIBS)
+AM_LDFLAGS+=-static
+
+EXTRA_DIST=            \
+		test-common.C  \
+		tests.doxy     \
+		checker.C
+
+#  test-generic-for-quad.h
+
+# Put an entry for your test-mycomponent.C here (or in one of the other test groups).
 # Don't forget to add a test_mycomponent_SOURCES entry below.
 #
 # Once present, tests should remain present, being moved from one group to another.
 # Note that among the available groups are NONCOMPILING_TESTS and FAILING_TESTS, which
 # will be ignored by "make check" and can be temporary storage for problematic tests.
-BASIC_TESTS =  			\
-        test-bitonic-sort       \
-	test-blas-domain	\
-        test-butterfly          \
-        test-commentator        \
-        test-charpoly			\
-        test-companion          \
-        test-dense              \
-        test-det                \
-        test-diagonal           \
-        test-dif                \
-        test-direct-sum         \
-	test-ffpack		\
-        test-frobenius          \
-        test-getentry           \
-        test-gf2                \
-        test-gmp-rational       \
-        test-hilbert            \
-        test-hom                \
-        test-inverse            \
-        test-isposdef           \
-        test-ispossemidef       \
-        test-matrix-domain      \
-        test-matrix-stream      \
-        test-minpoly            \
-        test-modular            \
-        test-modular-balanced-int\
-        test-modular-byte       \
-        test-modular-double     \
-        test-modular-int        \
-        test-modular-short      \
-	test-block-ring			\
-        test-moore-penrose      \
-        test-randiter-nonzero   \
-        test-rank               \
-        test-scalar-matrix      \
-        test-sparse             \
-        test-subiterator        \
-        test-submatrix          \
-        test-subvector          \
-        test-trace              \
-        test-triplesbb          \
-        test-vector-domain      \
-	test-zero-one 
+BASIC_TESTS =  \
+        test-bitonic-sort             \
+        test-blas-domain              \
+        test-butterfly                \
+        test-commentator              \
+        test-companion                \
+        test-dense                    \
+        test-det                      \
+        test-diagonal                 \
+        test-dif                      \
+        test-direct-sum               \
+        test-ffpack                   \
+        test-frobenius                \
+        test-getentry                 \
+        test-gf2                      \
+        test-gmp-rational             \
+        test-hilbert                  \
+        test-hom                      \
+        test-inverse                  \
+        test-isposdef                 \
+        test-ispossemidef             \
+        test-matrix-domain            \
+        test-matrix-stream            \
+        test-minpoly                  \
+        test-modular                  \
+        test-modular-balanced-int     \
+        test-modular-balanced-float   \
+        test-modular-balanced-double  \
+        test-modular-byte             \
+        test-modular-double           \
+        test-modular-float            \
+        test-modular-int              \
+        test-modular-short            \
+        test-block-ring               \
+        test-PID-integer              \
+        test-moore-penrose            \
+        test-randiter-nonzero         \
+        test-rank                     \
+        test-rational-matrix-factory  \
+        test-scalar-matrix            \
+        test-sparse                   \
+        test-subiterator              \
+        test-submatrix                \
+        test-subvector                \
+        test-sum                      \
+        test-trace                    \
+        test-triplesbb                \
+        test-vector-domain            \
+        test-qlup                     \
+        test-zero-one                 \
+        test-solve                    \
+        test-nullspace                \
+        test-smith-form-binary        \
+        test-rational-solver          \
+        test-rational-solver-adaptive \
+        test-solve-nonsingular        \
+        test-last-invariant-factor    \
+        test-charpoly                 \
+        test-cra                      \
+        test-cradomain                \
+        test-unparametric-field       \
+		test-rational-reconstruction-base
+
+#  test-integer-tools
+
 # tests of components not adhering to LinBox requirements.
-NONCOMPLIANT_TESTS =	\
-	test-unparametric-field	\
-	test-ntl-RR		\
-	test-param-fuzzy
+NONCOMPLIANT_TESTS =                   \
+        test-ntl-RR                    \
+        test-param-fuzzy
 
 #These need clapack
 #test-rational-solver-adaptive
-#test-smith-form-adaptive  
 
-# this allows _SOURCES entry to remain
-# except for "make dist"
-NONEXISTING_TESTS =
-#NONEXISTING_TESTS = test-solutions
-#
-#test_solutions_SOURCES=    \
-#	test-common.h	\
-#	test-solutions.C
-#
 
-NONCOMPILING_TESTS =  		
-#		test-inertia			
+DUBIOUS_TESTS =                 \
+		test-zo
+#  test-quad-matrix
+
+NONCOMPILING_TESTS =           \
+        test-dense-zero-one
 
-FAILING_TESTS =		\
-        test-solve              \
-        test-zo                 \
-        test-quad-matrix        \
-        test-mg-block-lanczos   \
-	test-la-block-lanczos    
-#       test-over-under         
-#       test-side-by-side       
+FAILING_TESTS =                  \
+        test-rat-charpoly        \
+		test-rat-solve           \
+		test-rat-minpoly         \
+		test-smith-form-local    \
+		test-smith-form-adaptive \
+		test-dyadic-to-rational  \
+		test-mg-block-lanczos    \
+		test-ftrmm               \
+        test-la-block-lanczos
 
-USE_NONCOMPILING_TESTS = 
-USE_FAILING_TESTS = 
+USE_NONCOMPILING_TESTS =
+USE_FAILING_TESTS =
 # comment out these two lines to avoid facing reality
 #USE_NONCOMPILING_TESTS += $(NONCOMPILING_TESTS)
 #USE_FAILING_TESTS += $(FAILING_TESTS)
 
 # a benchmarker, not to be included in check.
-BENCHMARKS = 		\
-	benchmark-fields		\
-	benchmark-blas-domain
+BENCHMARKS =                    \
+        benchmark-fields        \
+        benchmark-blas-domain
 
 # historical tests, no longer in use
-#	test-nag-sparse		  replaced by tripplesbb
-#       test-lsp 	lsp.h superceded by factorized-matrix.h
+#        test-nag-sparse                  replaced by tripplesbb
+#       test-lsp         lsp.h superceded by factorized-matrix.h
 # removed test
-#	test-nag-sparse
-#	test-image-field       replaced by hom 
+#        test-nag-sparse
+#        test-image-field       replaced by hom
 #       test-lsp
 # I put test-gssv_rank in hmrg:~saunders/gen_superlu.  It is not linbox until and unless it is made to work
 # test-gssv is an ntl test
 
 
 # no explicit test needed, I guess...
-#	Transpose is tested in test-triplesbb
-#	Compose is tested in test-butterfly
-
-GIVARO_TESTS =			\
-	test-givaro-zpz		\
-	test-givaro-zpzuns
-
-NTL_TESTS = 				\
-	test-ntl-lzz_p			\
-	test-ntl-ZZ_p			\
-	test-ntl-toeplitz		\
-	test-ntl-hankel   		\
-	test-ntl-sylvester		\
-	test-sum			\
-	test-smith-form-local		\
-	test-smith-form			\
-	test-smith-form-iliopoulos	\
-	test-smith-form-adaptive	\
-	test-smith-form-binary		\
-	test-rational-solver		\
-	test-rational-solver-adaptive	\
-	test-last-invariant-factor	\
-	test-toeplitz-det
-
-LIDIA_TESTS =			\
-	test-lidia-gfq
-
-ATLAS_TESTS = 
+#        Transpose is tested in test-triplesbb
+#        Compose is tested in test-butterfly
+
+GIVARO_TESTS =                        \
+        test-givaro-zpz               \
+        test-givaro-zpzuns
+
+NTL_TESTS =                           \
+        test-smith-form               \
+        test-ntl-lzz_p                \
+        test-ntl-ZZ_p                 \
+        test-ntl-toeplitz             \
+        test-ntl-hankel               \
+        test-ntl-sylvester            \
+        test-smith-form-iliopoulos    \
+        test-toeplitz-det
+
+LIDIA_TESTS =                         \
+        test-lidia-gfq
+
+ATLAS_TESTS =                         \
+        test-optimization
 
 if LINBOX_HAVE_NTL
 USE_NTL_TESTS = $(NTL_TESTS)
@@ -162,353 +187,441 @@ endif
 USE_ATLAS_TESTS = $(ATLAS_TESTS)
 
 
-TESTS =				\
-	$(BASIC_TESTS)		\
-	$(USE_GIVARO_TESTS)	\
-	$(USE_NTL_TESTS)	\
-	$(USE_LIDIA_TESTS)	\
-	$(USE_NONCOMPILING_TESTS)	\
-	$(USE_FAILING_TESTS)	\
-	$(USE_ATLAS_TESTS)
+TESTS =                               \
+        $(BASIC_TESTS)                \
+        $(USE_GIVARO_TESTS)           \
+        $(USE_NTL_TESTS)              \
+        $(USE_LIDIA_TESTS)            \
+        $(USE_NONCOMPILING_TESTS)     \
+        $(USE_FAILING_TESTS)          \
+        $(USE_ATLAS_TESTS)
 
 
 CLEANFILES = $(TESTS)
 
 EXTRA_PROGRAMS = \
-	$(BASIC_TESTS)		\
-	$(GIVARO_TESTS)		\
-	$(NTL_TESTS)		\
-	$(ATLAS_TESTS)		\
-	$(LIDIA_TESTS)		\
-	$(BENCHMARKS) 		\
-	$(NONEXISTING_TESTS)	\
-	$(NONCOMPILING_TESTS)	\
-	$(NONCOMPLIANT_TESTS)	\
-	$(FAILING_TESTS)
-
-
-test_commentator_SOURCES =		\
-	test-commentator.C		\
-	test-common.h
-
-test_modular_SOURCES =			\
-	test-modular.C			\
-	test-generic.h			\
-	test-common.h
-
-test_block_ring_SOURCES =			\
-	test-block-ring.C			\
-	test-field.h			\
-	test-common.h
-
-test_hom_SOURCES =			\
-	test-hom.C			\
-	test-generic.h			\
-	test-common.h
-
-test_gf2_SOURCES =			\
-	test-gf2.C			\
-	test-generic.h			\
-	test-common.h
-
-test_gmp_rational_SOURCES =		\
-	test-gmp-rational.C		\
-	test-generic.h			\
-	test-common.h
-
-test_unparametric_field_SOURCES =	\
-	test-unparametric-field.C	\
-	test-generic.h			\
-	test-common.h
-
-test_randiter_nonzero_SOURCES =		\
-	test-randiter-nonzero.C		\
-	test-common.h
-
-test_subiterator_SOURCES = 		\
-	test-subiterator.C		\
-	test-common.h
-
-test_subvector_SOURCES = 		\
-	test-subvector.C		\
-	test-common.h
-
-test_vector_domain_SOURCES = 		\
-	test-vector-domain.C		\
-	test-vector-domain.h		
-
-test_matrix_domain_SOURCES = 		\
-	test-matrix-domain.C		\
-	test-common.h
-
-test_dense_SOURCES = 			\
-	test-dense.C			\
-	test-common.h
-
-test_sparse_SOURCES = 			\
-	test-sparse.C			\
-	test-common.h
-
-test_submatrix_SOURCES = 		\
-	test-submatrix.C		\
-	test-common.h
-
-test_scalar_matrix_SOURCES = 		\
-	test-scalar-matrix.C		\
-	test-generic.h			\
-	test-common.h
-
-test_butterfly_SOURCES = 		\
-	test-vector-domain.h		\
-	test-blackbox.h			\
-	test-butterfly.C		\
-	test-generic.h			\
-	test-common.h
-
-test_charpoly_SOURCES = 		\
-	test-charpoly.C			\
-	test-common.h
-
-test_diagonal_SOURCES = 		\
-	test-diagonal.C			\
-	test-generic.h			\
-	test-common.h
-
-test_sum_SOURCES = 			\
-	test-sum.C			\
-	test-generic.h			\
-	test-common.h
-
-test_dif_SOURCES = 			\
-	test-dif.C	test-generic.h	\
-	test-common.h
-
-test_triplesbb_SOURCES =		\
-	test-triplesbb.C		\
-	test-generic.h			\
-	test-common.h
-
-#test_inertia_SOURCES =		\
-#	test-inertia.C		\
-#	test-common.h
-
-test_hilbert_SOURCES =			\
-	test-hilbert.C	test-generic.h	\
-	test-common.h
-
-test_ntl_toeplitz_SOURCES =		\
-	test-ntl-toeplitz.C		\
-	test-common.h
-
-test_ntl_hankel_SOURCES =		\
-	test-ntl-hankel.C		\
-	test-common.h
-
-
-test_ntl_sylvester_SOURCES =		\
-	test-ntl-sylvester.C		\
-	test-common.h
-
-test_toeplitz_det_SOURCES =		\
-	test-toeplitz-det.C
-
-test_trace_SOURCES = 			\
-	test-trace.C			\
-	test-common.h
-
-test_getentry_SOURCES = 			\
-	test-getentry.C			\
-	test-common.h
-
-test_minpoly_SOURCES = 			\
-	test-minpoly.C			\
-	test-common.h
-
-test_det_SOURCES = 			\
-	test-det.C			\
-	test-common.h
-
-test_rank_SOURCES =			\
-	test-rank.C			\
-	test-common.h
-
-test_solve_SOURCES =			\
-	test-solve.C			\
-	test-common.h
-
-test_direct_sum_SOURCES =		\
-	test-direct-sum.C		\
-	test-generic.h			\
-	test-common.h
-
-test_frobenius_SOURCES =		\
-	test-frobenius.C		\
-	test-generic.h			\
-	test-common.h
-
-test_companion_SOURCES =		\
-	test-companion.C		\
-	test-generic.h			\
-	test-common.h
-
-test_inverse_SOURCES =			\
-	test-inverse.C			\
-	test-common.h
-
-test_moore_penrose_SOURCES =		\
-	test-moore-penrose.C		\
-	test-common.h
-
-test_ntl_RR_SOURCES =			\
-	test-ntl-RR.C			\
-	test-generic.h			\
-	test-common.h
-
-test_ntl_ZZ_p_SOURCES =			\
-	test-ntl-ZZ_p.C			\
-	test-generic.h			\
-	test-common.h
-
-test_ntl_lzz_p_SOURCES =		\
-	test-ntl-lzz_p.C		\
-	test-generic.h			\
-	test-common.h
-
-test_givaro_zpz_SOURCES =		\
-	test-givaro-zpz.C		\
-	test-generic.h			\
-	test-common.h
-
-test_givaro_zpzuns_SOURCES =		\
-	test-givaro-zpzuns.C		\
-	test-generic.h			\
-	test-common.h
-
-test_lidia_gfq_SOURCES =		\
-	test-lidia-gfq.C		\
-	test-generic.h			\
-	test-common.h
-
-test_param_fuzzy_SOURCES =	        \
-	test-param-fuzzy.C	        \
-	test-generic.h		        \
-	test-common.h
-
-#test_side_by_side_SOURCES =		\
-#	test-side-by-side.C		\
-#	test-generic.h			\
-#	test-common.h
-
-#test_over_under_SOURCES =		\
-#	test-over-under.C		\
-#	test-generic.h			\
-#	test-common.h
-
-test_quad_matrix_SOURCES =		\
-	test-quad-matrix.C		\
-	test-generic-for-quad.h		\
-	test-generic.h			\
-	test-common.h
-
-test_zo_SOURCES =			\
-	test-zo.C			\
-	test-generic.h			\
-	test-common.h
-
-test_zero_one_SOURCES =			\
-	test-zero-one.C			\
-	test-generic.h			\
-	test-common.h
-
-test_modular_int_SOURCES =		\
-	test-modular-int.C 		\
-	test-common.h	
-
-test_modular_short_SOURCES =		\
-	test-modular-short.C		\
-	test-generic.h			\
-	test-common.h
-
-test_modular_double_SOURCES =		\
-	test-modular-double.C		\
-	test-generic.h			\
-	test-common.h
-
-test_modular_byte_SOURCES =		\
-	test-modular-byte.C		\
-	test-generic.h			\
-	test-common.h
-
-test_modular_balanced_int_SOURCES =             \
-        test-modular-balanced-int.C             \
+        $(BASIC_TESTS)                \
+        $(GIVARO_TESTS)               \
+        $(NTL_TESTS)                  \
+        $(ATLAS_TESTS)                \
+        $(LIDIA_TESTS)                \
+        $(BENCHMARKS)                 \
+        $(NONEXISTING_TESTS)          \
+        $(NONCOMPILING_TESTS)         \
+        $(NONCOMPLIANT_TESTS)         \
+        $(DUBIOUS_TESTS)              \
+        $(FAILING_TESTS)
+
+
+test_commentator_SOURCES =                \
+        test-commentator.C                \
+        test-common.h
+
+test_modular_SOURCES =                        \
+        test-modular.C                        \
+        test-generic.h                        \
+        test-common.h
+
+test_block_ring_SOURCES =                 \
+        test-block-ring.C                 \
+        test-field.h                      \
+        test-common.h
+
+test_PID_integer_SOURCES =                 \
+        test-PID-integer.C                 \
+        test-field.h                      \
+        test-common.h
+
+test_hom_SOURCES =                        \
+        test-hom.C                        \
+        test-generic.h                    \
+        test-common.h
+
+test_gf2_SOURCES =                        \
+        test-gf2.C                        \
+        test-generic.h                    \
+        test-common.h
+
+test_gmp_rational_SOURCES =               \
+        test-gmp-rational.C               \
+        test-generic.h                    \
+        test-common.h
+
+test_unparametric_field_SOURCES =        \
+        test-unparametric-field.C        \
+        test-generic.h                   \
+        test-common.h
+
+test_randiter_nonzero_SOURCES =          \
+        test-randiter-nonzero.C          \
+        test-common.h
+
+test_rational_matrix_factory_SOURCES =  \
+        test-rational-matrix-factory.C  \
+        test-common.h
+
+test_rational_reconstruction_base_SOURCES =  \
+	  test-rational-reconstruction-base.C  \
+	  test-common.h
+
+test_rat_solve_SOURCES =                \
+        test-rat-solve.C                \
+        test-common.h
+
+test_rat_charpoly_SOURCES =             \
+        test-rat-charpoly.C             \
+        test-common.h
+
+test_rat_minpoly_SOURCES =              \
+        test-rat-minpoly.C              \
+        test-common.h
+
+test_subiterator_SOURCES =              \
+        test-subiterator.C              \
+        test-common.h
+
+test_subvector_SOURCES =                \
+        test-subvector.C                \
+        test-common.h
+
+test_vector_domain_SOURCES =            \
+        test-vector-domain.C            \
+        test-vector-domain.h
+
+test_matrix_domain_SOURCES =            \
+        test-matrix-domain.C            \
+        test-common.h
+
+test_dense_SOURCES =                    \
+        test-dense.C                    \
+        test-common.h
+
+test_sparse_SOURCES =                   \
+        test-sparse.C                   \
+        test-common.h
+
+test_submatrix_SOURCES =                \
+        test-submatrix.C                \
+        test-common.h
+
+test_scalar_matrix_SOURCES =            \
+        test-scalar-matrix.C            \
+        test-generic.h                  \
+        test-common.h
+
+test_butterfly_SOURCES =                \
+        test-vector-domain.h            \
+        test-blackbox.h                 \
+        test-butterfly.C                \
+        test-generic.h                  \
+        test-common.h
+
+test_charpoly_SOURCES =                 \
+        test-charpoly.C                 \
+        test-common.h
+
+test_diagonal_SOURCES =                 \
+        test-diagonal.C                 \
+        test-generic.h                  \
+        test-common.h
+
+test_sum_SOURCES =                      \
+        test-sum.C                      \
+        test-generic.h                  \
+        test-common.h
+
+test_dif_SOURCES =                          \
+        test-dif.C        test-generic.h    \
+        test-common.h
+
+test_triplesbb_SOURCES =                \
+        test-triplesbb.C                \
+        test-generic.h                  \
+        test-common.h
+
+test_hilbert_SOURCES =                        \
+        test-hilbert.C        test-generic.h        \
+        test-common.h
+
+test_ntl_toeplitz_SOURCES =                \
+        test-ntl-toeplitz.C                \
+        test-common.h
+
+test_ntl_hankel_SOURCES =                \
+        test-ntl-hankel.C                \
+        test-common.h
+
+
+test_ntl_sylvester_SOURCES =                \
+        test-ntl-sylvester.C                \
+        test-common.h
+
+test_toeplitz_det_SOURCES =                \
+        test-toeplitz-det.C
+
+test_trace_SOURCES =                         \
+        test-trace.C                         \
+        test-common.h
+
+test_getentry_SOURCES =                         \
+        test-getentry.C                         \
+        test-common.h
+
+test_minpoly_SOURCES =                         \
+        test-minpoly.C                         \
+        test-common.h
+
+test_det_SOURCES =                        \
+        test-det.C                        \
+        test-common.h
+
+test_rank_SOURCES =                        \
+        test-rank.C                        \
+        test-common.h
+
+test_qlup_SOURCES =                        \
+        test-qlup.C                        \
+        test-common.h
+
+test_solve_SOURCES =                        \
+        test-solve.C                        \
+        test-common.h
+
+test_direct_sum_SOURCES =                \
+        test-direct-sum.C                \
+        test-generic.h                   \
+        test-common.h
+
+test_frobenius_SOURCES =                \
+        test-frobenius.C                \
         test-generic.h                  \
         test-common.h
 
-test_smith_form_iliopoulos_SOURCES=    \
-	test-common.h	\
-	test-smith-form-iliopoulos.C
+test_companion_SOURCES =                \
+        test-companion.C                \
+        test-generic.h                  \
+        test-common.h
 
-test_smith_form_binary_SOURCES=    \
-	test-common.h	\
-	test-smith-form-binary.C
+test_inverse_SOURCES =                        \
+        test-inverse.C                        \
+        test-common.h
+
+test_moore_penrose_SOURCES =                \
+        test-moore-penrose.C                \
+        test-common.h
+
+test_ntl_RR_SOURCES =                        \
+        test-ntl-RR.C                        \
+        test-generic.h                       \
+        test-common.h
+
+test_ntl_ZZ_p_SOURCES =                        \
+        test-ntl-ZZ_p.C                        \
+        test-generic.h                         \
+        test-common.h
+
+test_ntl_lzz_p_SOURCES =                \
+        test-ntl-lzz_p.C                \
+        test-generic.h                  \
+        test-common.h
+
+test_givaro_zpz_SOURCES =                \
+        test-givaro-zpz.C                \
+        test-generic.h                   \
+        test-common.h
+
+test_givaro_zpzuns_SOURCES =                \
+        test-givaro-zpzuns.C                \
+        test-generic.h                      \
+        test-common.h
+
+test_lidia_gfq_SOURCES =                \
+        test-lidia-gfq.C                \
+        test-generic.h                  \
+        test-common.h
+
+test_param_fuzzy_SOURCES =                \
+        test-param-fuzzy.C                \
+        test-generic.h                    \
+        test-common.h
+
+#  test_quad_matrix_SOURCES =                \
+#  test-quad-matrix.C                \
+#  test-generic-for-quad.h           \
+#  test-generic.h                    \
+#  test-common.h
+
+test_zo_SOURCES =                        \
+        test-zo.C                        \
+        test-generic.h                   \
+        test-common.h
+
+test_zero_one_SOURCES =                       \
+        test-zero-one.C                       \
+        test-generic.h                        \
+        test-common.h
+
+test_modular_int_SOURCES =                \
+        test-modular-int.C                \
+        test-common.h
+
+test_modular_short_SOURCES =                \
+        test-modular-short.C                \
+        test-generic.h                      \
+        test-common.h
+
+test_modular_double_SOURCES =                \
+        test-modular-double.C                \
+        test-generic.h                       \
+        test-common.h
+
+test_modular_float_SOURCES =                \
+        test-modular-float.C                \
+        test-generic.h                       \
+        test-common.h
+
+
+test_modular_byte_SOURCES =          \
+        test-modular-byte.C          \
+        test-generic.h               \
+        test-common.h
+
+test_modular_balanced_int_SOURCES =  \
+        test-modular-balanced-int.C  \
+        test-generic.h               \
+        test-common.h
+
+test_modular_balanced_double_SOURCES =  \
+        test-modular-balanced-double.C  \
+        test-generic.h               \
+        test-common.h
+
+test_modular_balanced_float_SOURCES =  \
+        test-modular-balanced-float.C  \
+        test-generic.h               \
+        test-common.h
+
+test_smith_form_iliopoulos_SOURCES=  \
+        test-common.h                \
+        test-smith-form-iliopoulos.C
+
+test_smith_form_binary_SOURCES=  \
+        test-common.h            \
+        test-smith-form-binary.C
 
 test_smith_form_SOURCES=    \
-	test-common.h	\
-	test-smith-form.C
+        test-common.h       \
+        test-smith-form.C
 
 test_last_invariant_factor_SOURCES=    \
-	test-common.h	\
-	test-last-invariant-factor.C
+        test-common.h                  \
+        test-last-invariant-factor.C
 
 test_smith_form_local_SOURCES=    \
-	test-common.h	\
-	test-smith-form-local.C
+        test-common.h             \
+        test-smith-form-local.C
 
-test_bitonic_sort_SOURCES=    \
-        test-common.h   \
+test_optimization_SOURCES=    \
+        test-common.h         \
+        test-optimization.C
+
+test_nullspace_SOURCES=    \
+        test-common.h      \
+        test-nullspace.C
+
+test_bitonic_sort_SOURCES=              \
+        test-common.h                   \
         test-bitonic-sort.C
 
-test_rational_solver_SOURCES =		\
-	test-common.h	\
-	test-rational-solver.C
+test_rational_solver_SOURCES =          \
+        test-common.h                   \
+        test-rational-solver.C
 
-test_blas_domain_SOURCES=		\
-	test-common.h   \
-	test-blas-domain.C
+test_blas_domain_SOURCES=               \
+        test-common.h                   \
+        test-blas-domain.C
 
-test_ffpack_SOURCES=		\
-	test-common.h   \
-	test-ffpack.C
+test_ffpack_SOURCES=                    \
+        test-common.h                   \
+        test-ffpack.C
 
-test_matrix_stream_SOURCES =		\
-	test-matrix-stream.C
+test_matrix_stream_SOURCES =            \
+        test-matrix-stream.C
 
-test_la_block_lanczos_SOURCES =		\
-	test-la-block-lanczos.C
+test_la_block_lanczos_SOURCES =         \
+        test-la-block-lanczos.C
 
-test_mg_block_lanczos_SOURCES =		\
-	test-mg-block-lanczos.C
+test_mg_block_lanczos_SOURCES =         \
+        test-mg-block-lanczos.C
 
 test_rational_solver_adaptive_SOURCES = \
-	test-rational-solver-adaptive.C \
-	test-common.h
+        test-rational-solver-adaptive.C \
+        test-common.h
+
+test_dyadic_to_rational_SOURCES = \
+        test-dyadic-to-rational.C \
+        test-common.h
+
+test_cra_SOURCES =                      \
+        test-cra.C                      \
+        test-common.h
+
+test_cradomain_SOURCES =                \
+        test-cradomain.C                \
+        test-common.h
+
+
+# NTL test
+
+test_smith_form_adaptive_SOURCES=      \
+        test-common.h                  \
+        test-smith-form-adaptive.C
+
+benchmark_fields_SOURCES=              \
+        test-common.h                  \
+        benchmark-fields.C
+
+benchmark_blas_domain_SOURCES=         \
+        test-common.h                  \
+        benchmark-blas-domain.C
+
+test_isposdef_SOURCES=                 \
+        test-common.h                  \
+        test-isposdef.C
+
+test_dense_zero_one_SOURCES=           \
+        test-blackbox.h                \
+        test-dense-zero-one.C
+
+test_ispossemidef_SOURCES=            \
+        test-common.h                 \
+        test-ispossemidef.C
+
+test_ftrmm_SOURCES =                  \
+		test-ftrmm.C
+
+test_solve_nonsingular_SOURCES=       \
+		test-common.h                   \
+		test-solve-nonsingular.C
+
+#  test_integer_tools_SOURCES =          \
+#  test-integer-tools.C
 
-test_smith_form_adaptive_SOURCES=    \
-	test-common.h	\
-	test-smith-form-adaptive.C
+fullcheck: checker
+	./checker
 
-benchmark_fields_SOURCES=    \
-	test-common.h	\
-	benchmark-fields.C
+checker: checker.C
 
-benchmark_blas_domain_SOURCES=		\
-	test-common.h   \
-	benchmark-blas-domain.C
+CLEANFILES= checker               \
+			$(BASIC_TESTS)        \
+			$(FAILING_TESTS)      \
+			$(NONCOMPLIANT_TESTS) \
+			$(BENCHMARKS)         \
+			$(DUBIOUS_TESTS)      \
+			$(NTL_TESTS)          \
+			$(GIVARO_TESTS)       \
+			$(ATLAS_TESTS)
 
-test_isposdef_SOURCES=    \
-	test-common.h	\
-	test-isposdef.C
 
-test_ispossemidef_SOURCES=    \
-	test-common.h	\
-	test-ispossemidef.C
+#  %:%.C
+#  $(CXX) $(OPTFLAGS) $(AM_CPPFLAGS) $(AM_CXXFLAGS) $*.C -o $*  `$(GIVARO_BIN)/givaro-config --cflags` `$(FFLAFLAS_BIN)/fflasffpack-config --cflags`  $(LDADD)  `$(GIVARO_BIN)/givaro-config --libs` `$(FFLAFLAS_BIN)/ffasffpack-config --libs`
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 0c6d3af..167dee0 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -13,6 +14,10 @@
 # PARTICULAR PURPOSE.
 
 @SET_MAKE@
+
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
 pkglibdir = $(libdir)/@PACKAGE@
@@ -31,30 +36,37 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-TESTS = $(am__EXEEXT_1) $(am__EXEEXT_9) $(am__EXEEXT_10) \
-	$(am__EXEEXT_11) $(am__EXEEXT_4) $(am__EXEEXT_4) \
-	$(am__EXEEXT_12)
+TESTS = $(am__EXEEXT_1) $(am__EXEEXT_11) $(am__EXEEXT_12) \
+	$(am__EXEEXT_13) $(am__EXEEXT_14) $(am__EXEEXT_14) \
+	$(am__EXEEXT_15)
 EXTRA_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
 	$(am__EXEEXT_4) $(am__EXEEXT_5) $(am__EXEEXT_6) \
-	$(am__EXEEXT_4) $(am__EXEEXT_4) $(am__EXEEXT_7) \
-	$(am__EXEEXT_8)
+	$(am__EXEEXT_7) $(am__EXEEXT_8) $(am__EXEEXT_9) \
+	$(am__EXEEXT_10)
 subdir = tests
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in TODO
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
-	$(top_srcdir)/macros/blas-check.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
 	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
 	$(top_srcdir)/macros/givaro-check.m4 \
 	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
 	$(top_srcdir)/macros/lidia-check.m4 \
 	$(top_srcdir)/macros/linbox-doc.m4 \
 	$(top_srcdir)/macros/linbox-misc.m4 \
 	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
 	$(top_srcdir)/macros/maple-check.m4 \
 	$(top_srcdir)/macros/ntl-check.m4 \
 	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -62,43 +74,54 @@ CONFIG_HEADER = $(top_builddir)/config.h
 CONFIG_CLEAN_FILES =
 am__EXEEXT_1 = test-bitonic-sort$(EXEEXT) test-blas-domain$(EXEEXT) \
 	test-butterfly$(EXEEXT) test-commentator$(EXEEXT) \
-	test-charpoly$(EXEEXT) test-companion$(EXEEXT) \
-	test-dense$(EXEEXT) test-det$(EXEEXT) test-diagonal$(EXEEXT) \
-	test-dif$(EXEEXT) test-direct-sum$(EXEEXT) \
-	test-ffpack$(EXEEXT) test-frobenius$(EXEEXT) \
-	test-getentry$(EXEEXT) test-gf2$(EXEEXT) \
-	test-gmp-rational$(EXEEXT) test-hilbert$(EXEEXT) \
-	test-hom$(EXEEXT) test-inverse$(EXEEXT) test-isposdef$(EXEEXT) \
-	test-ispossemidef$(EXEEXT) test-matrix-domain$(EXEEXT) \
-	test-matrix-stream$(EXEEXT) test-minpoly$(EXEEXT) \
-	test-modular$(EXEEXT) test-modular-balanced-int$(EXEEXT) \
+	test-companion$(EXEEXT) test-dense$(EXEEXT) test-det$(EXEEXT) \
+	test-diagonal$(EXEEXT) test-dif$(EXEEXT) \
+	test-direct-sum$(EXEEXT) test-ffpack$(EXEEXT) \
+	test-frobenius$(EXEEXT) test-getentry$(EXEEXT) \
+	test-gf2$(EXEEXT) test-gmp-rational$(EXEEXT) \
+	test-hilbert$(EXEEXT) test-hom$(EXEEXT) test-inverse$(EXEEXT) \
+	test-isposdef$(EXEEXT) test-ispossemidef$(EXEEXT) \
+	test-matrix-domain$(EXEEXT) test-matrix-stream$(EXEEXT) \
+	test-minpoly$(EXEEXT) test-modular$(EXEEXT) \
+	test-modular-balanced-int$(EXEEXT) \
+	test-modular-balanced-float$(EXEEXT) \
+	test-modular-balanced-double$(EXEEXT) \
 	test-modular-byte$(EXEEXT) test-modular-double$(EXEEXT) \
-	test-modular-int$(EXEEXT) test-modular-short$(EXEEXT) \
-	test-block-ring$(EXEEXT) test-moore-penrose$(EXEEXT) \
+	test-modular-float$(EXEEXT) test-modular-int$(EXEEXT) \
+	test-modular-short$(EXEEXT) test-block-ring$(EXEEXT) \
+	test-PID-integer$(EXEEXT) test-moore-penrose$(EXEEXT) \
 	test-randiter-nonzero$(EXEEXT) test-rank$(EXEEXT) \
+	test-rational-matrix-factory$(EXEEXT) \
 	test-scalar-matrix$(EXEEXT) test-sparse$(EXEEXT) \
 	test-subiterator$(EXEEXT) test-submatrix$(EXEEXT) \
-	test-subvector$(EXEEXT) test-trace$(EXEEXT) \
+	test-subvector$(EXEEXT) test-sum$(EXEEXT) test-trace$(EXEEXT) \
 	test-triplesbb$(EXEEXT) test-vector-domain$(EXEEXT) \
-	test-zero-one$(EXEEXT)
-am__EXEEXT_2 = test-givaro-zpz$(EXEEXT) test-givaro-zpzuns$(EXEEXT)
-am__EXEEXT_3 = test-ntl-lzz_p$(EXEEXT) test-ntl-ZZ_p$(EXEEXT) \
-	test-ntl-toeplitz$(EXEEXT) test-ntl-hankel$(EXEEXT) \
-	test-ntl-sylvester$(EXEEXT) test-sum$(EXEEXT) \
-	test-smith-form-local$(EXEEXT) test-smith-form$(EXEEXT) \
-	test-smith-form-iliopoulos$(EXEEXT) \
-	test-smith-form-adaptive$(EXEEXT) \
-	test-smith-form-binary$(EXEEXT) test-rational-solver$(EXEEXT) \
+	test-qlup$(EXEEXT) test-zero-one$(EXEEXT) test-solve$(EXEEXT) \
+	test-nullspace$(EXEEXT) test-smith-form-binary$(EXEEXT) \
+	test-rational-solver$(EXEEXT) \
 	test-rational-solver-adaptive$(EXEEXT) \
-	test-last-invariant-factor$(EXEEXT) test-toeplitz-det$(EXEEXT)
-am__EXEEXT_4 =
+	test-solve-nonsingular$(EXEEXT) \
+	test-last-invariant-factor$(EXEEXT) test-charpoly$(EXEEXT) \
+	test-cra$(EXEEXT) test-cradomain$(EXEEXT) \
+	test-unparametric-field$(EXEEXT) \
+	test-rational-reconstruction-base$(EXEEXT)
+am__EXEEXT_2 = test-givaro-zpz$(EXEEXT) test-givaro-zpzuns$(EXEEXT)
+am__EXEEXT_3 = test-smith-form$(EXEEXT) test-ntl-lzz_p$(EXEEXT) \
+	test-ntl-ZZ_p$(EXEEXT) test-ntl-toeplitz$(EXEEXT) \
+	test-ntl-hankel$(EXEEXT) test-ntl-sylvester$(EXEEXT) \
+	test-smith-form-iliopoulos$(EXEEXT) test-toeplitz-det$(EXEEXT)
+am__EXEEXT_4 = test-optimization$(EXEEXT)
 am__EXEEXT_5 = test-lidia-gfq$(EXEEXT)
 am__EXEEXT_6 = benchmark-fields$(EXEEXT) \
 	benchmark-blas-domain$(EXEEXT)
-am__EXEEXT_7 = test-unparametric-field$(EXEEXT) test-ntl-RR$(EXEEXT) \
-	test-param-fuzzy$(EXEEXT)
-am__EXEEXT_8 = test-solve$(EXEEXT) test-zo$(EXEEXT) \
-	test-quad-matrix$(EXEEXT) test-mg-block-lanczos$(EXEEXT) \
+am__EXEEXT_7 = test-dense-zero-one$(EXEEXT)
+am__EXEEXT_8 = test-ntl-RR$(EXEEXT) test-param-fuzzy$(EXEEXT)
+am__EXEEXT_9 = test-zo$(EXEEXT)
+am__EXEEXT_10 = test-rat-charpoly$(EXEEXT) test-rat-solve$(EXEEXT) \
+	test-rat-minpoly$(EXEEXT) test-smith-form-local$(EXEEXT) \
+	test-smith-form-adaptive$(EXEEXT) \
+	test-dyadic-to-rational$(EXEEXT) \
+	test-mg-block-lanczos$(EXEEXT) test-ftrmm$(EXEEXT) \
 	test-la-block-lanczos$(EXEEXT)
 am_benchmark_blas_domain_OBJECTS = benchmark-blas-domain.$(OBJEXT)
 benchmark_blas_domain_OBJECTS = $(am_benchmark_blas_domain_OBJECTS)
@@ -113,6 +136,12 @@ benchmark_fields_LDADD = $(LDADD)
 benchmark_fields_DEPENDENCIES = $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_test_PID_integer_OBJECTS = test-PID-integer.$(OBJEXT)
+test_PID_integer_OBJECTS = $(am_test_PID_integer_OBJECTS)
+test_PID_integer_LDADD = $(LDADD)
+test_PID_integer_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_test_bitonic_sort_OBJECTS = test-bitonic-sort.$(OBJEXT)
 test_bitonic_sort_OBJECTS = $(am_test_bitonic_sort_OBJECTS)
 test_bitonic_sort_LDADD = $(LDADD)
@@ -155,12 +184,30 @@ test_companion_LDADD = $(LDADD)
 test_companion_DEPENDENCIES = $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_test_cra_OBJECTS = test-cra.$(OBJEXT)
+test_cra_OBJECTS = $(am_test_cra_OBJECTS)
+test_cra_LDADD = $(LDADD)
+test_cra_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
+am_test_cradomain_OBJECTS = test-cradomain.$(OBJEXT)
+test_cradomain_OBJECTS = $(am_test_cradomain_OBJECTS)
+test_cradomain_LDADD = $(LDADD)
+test_cradomain_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_test_dense_OBJECTS = test-dense.$(OBJEXT)
 test_dense_OBJECTS = $(am_test_dense_OBJECTS)
 test_dense_LDADD = $(LDADD)
 test_dense_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1)
+am_test_dense_zero_one_OBJECTS = test-dense-zero-one.$(OBJEXT)
+test_dense_zero_one_OBJECTS = $(am_test_dense_zero_one_OBJECTS)
+test_dense_zero_one_LDADD = $(LDADD)
+test_dense_zero_one_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_test_det_OBJECTS = test-det.$(OBJEXT)
 test_det_OBJECTS = $(am_test_det_OBJECTS)
 test_det_LDADD = $(LDADD)
@@ -185,6 +232,14 @@ test_direct_sum_LDADD = $(LDADD)
 test_direct_sum_DEPENDENCIES = $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_test_dyadic_to_rational_OBJECTS =  \
+	test-dyadic-to-rational.$(OBJEXT)
+test_dyadic_to_rational_OBJECTS =  \
+	$(am_test_dyadic_to_rational_OBJECTS)
+test_dyadic_to_rational_LDADD = $(LDADD)
+test_dyadic_to_rational_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_test_ffpack_OBJECTS = test-ffpack.$(OBJEXT)
 test_ffpack_OBJECTS = $(am_test_ffpack_OBJECTS)
 test_ffpack_LDADD = $(LDADD)
@@ -197,6 +252,12 @@ test_frobenius_LDADD = $(LDADD)
 test_frobenius_DEPENDENCIES = $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_test_ftrmm_OBJECTS = test-ftrmm.$(OBJEXT)
+test_ftrmm_OBJECTS = $(am_test_ftrmm_OBJECTS)
+test_ftrmm_LDADD = $(LDADD)
+test_ftrmm_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
 am_test_getentry_OBJECTS = test-getentry.$(OBJEXT)
 test_getentry_OBJECTS = $(am_test_getentry_OBJECTS)
 test_getentry_LDADD = $(LDADD)
@@ -307,6 +368,22 @@ test_modular_LDADD = $(LDADD)
 test_modular_DEPENDENCIES = $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_test_modular_balanced_double_OBJECTS =  \
+	test-modular-balanced-double.$(OBJEXT)
+test_modular_balanced_double_OBJECTS =  \
+	$(am_test_modular_balanced_double_OBJECTS)
+test_modular_balanced_double_LDADD = $(LDADD)
+test_modular_balanced_double_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_test_modular_balanced_float_OBJECTS =  \
+	test-modular-balanced-float.$(OBJEXT)
+test_modular_balanced_float_OBJECTS =  \
+	$(am_test_modular_balanced_float_OBJECTS)
+test_modular_balanced_float_LDADD = $(LDADD)
+test_modular_balanced_float_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_test_modular_balanced_int_OBJECTS =  \
 	test-modular-balanced-int.$(OBJEXT)
 test_modular_balanced_int_OBJECTS =  \
@@ -327,6 +404,12 @@ test_modular_double_LDADD = $(LDADD)
 test_modular_double_DEPENDENCIES = $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_test_modular_float_OBJECTS = test-modular-float.$(OBJEXT)
+test_modular_float_OBJECTS = $(am_test_modular_float_OBJECTS)
+test_modular_float_LDADD = $(LDADD)
+test_modular_float_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_test_modular_int_OBJECTS = test-modular-int.$(OBJEXT)
 test_modular_int_OBJECTS = $(am_test_modular_int_OBJECTS)
 test_modular_int_LDADD = $(LDADD)
@@ -381,18 +464,30 @@ test_ntl_toeplitz_LDADD = $(LDADD)
 test_ntl_toeplitz_DEPENDENCIES = $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_test_nullspace_OBJECTS = test-nullspace.$(OBJEXT)
+test_nullspace_OBJECTS = $(am_test_nullspace_OBJECTS)
+test_nullspace_LDADD = $(LDADD)
+test_nullspace_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_test_optimization_OBJECTS = test-optimization.$(OBJEXT)
+test_optimization_OBJECTS = $(am_test_optimization_OBJECTS)
+test_optimization_LDADD = $(LDADD)
+test_optimization_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_test_param_fuzzy_OBJECTS = test-param-fuzzy.$(OBJEXT)
 test_param_fuzzy_OBJECTS = $(am_test_param_fuzzy_OBJECTS)
 test_param_fuzzy_LDADD = $(LDADD)
 test_param_fuzzy_DEPENDENCIES = $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-am_test_quad_matrix_OBJECTS = test-quad-matrix.$(OBJEXT)
-test_quad_matrix_OBJECTS = $(am_test_quad_matrix_OBJECTS)
-test_quad_matrix_LDADD = $(LDADD)
-test_quad_matrix_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+am_test_qlup_OBJECTS = test-qlup.$(OBJEXT)
+test_qlup_OBJECTS = $(am_test_qlup_OBJECTS)
+test_qlup_LDADD = $(LDADD)
+test_qlup_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
-	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+	$(am__DEPENDENCIES_1)
 am_test_randiter_nonzero_OBJECTS = test-randiter-nonzero.$(OBJEXT)
 test_randiter_nonzero_OBJECTS = $(am_test_randiter_nonzero_OBJECTS)
 test_randiter_nonzero_LDADD = $(LDADD)
@@ -405,6 +500,41 @@ test_rank_LDADD = $(LDADD)
 test_rank_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1)
+am_test_rat_charpoly_OBJECTS = test-rat-charpoly.$(OBJEXT)
+test_rat_charpoly_OBJECTS = $(am_test_rat_charpoly_OBJECTS)
+test_rat_charpoly_LDADD = $(LDADD)
+test_rat_charpoly_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_test_rat_minpoly_OBJECTS = test-rat-minpoly.$(OBJEXT)
+test_rat_minpoly_OBJECTS = $(am_test_rat_minpoly_OBJECTS)
+test_rat_minpoly_LDADD = $(LDADD)
+test_rat_minpoly_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_test_rat_solve_OBJECTS = test-rat-solve.$(OBJEXT)
+test_rat_solve_OBJECTS = $(am_test_rat_solve_OBJECTS)
+test_rat_solve_LDADD = $(LDADD)
+test_rat_solve_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_test_rational_matrix_factory_OBJECTS =  \
+	test-rational-matrix-factory.$(OBJEXT)
+test_rational_matrix_factory_OBJECTS =  \
+	$(am_test_rational_matrix_factory_OBJECTS)
+test_rational_matrix_factory_LDADD = $(LDADD)
+test_rational_matrix_factory_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_test_rational_reconstruction_base_OBJECTS =  \
+	test-rational-reconstruction-base.$(OBJEXT)
+test_rational_reconstruction_base_OBJECTS =  \
+	$(am_test_rational_reconstruction_base_OBJECTS)
+test_rational_reconstruction_base_LDADD = $(LDADD)
+test_rational_reconstruction_base_DEPENDENCIES =  \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
 am_test_rational_solver_OBJECTS = test-rational-solver.$(OBJEXT)
 test_rational_solver_OBJECTS = $(am_test_rational_solver_OBJECTS)
 test_rational_solver_LDADD = $(LDADD)
@@ -465,6 +595,12 @@ test_solve_LDADD = $(LDADD)
 test_solve_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1)
+am_test_solve_nonsingular_OBJECTS = test-solve-nonsingular.$(OBJEXT)
+test_solve_nonsingular_OBJECTS = $(am_test_solve_nonsingular_OBJECTS)
+test_solve_nonsingular_LDADD = $(LDADD)
+test_solve_nonsingular_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_test_sparse_OBJECTS = test-sparse.$(OBJEXT)
 test_sparse_OBJECTS = $(am_test_sparse_OBJECTS)
 test_sparse_LDADD = $(LDADD)
@@ -561,13 +697,16 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
 	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
 	$(LDFLAGS) -o $@
 SOURCES = $(benchmark_blas_domain_SOURCES) $(benchmark_fields_SOURCES) \
-	$(test_bitonic_sort_SOURCES) $(test_blas_domain_SOURCES) \
-	$(test_block_ring_SOURCES) $(test_butterfly_SOURCES) \
-	$(test_charpoly_SOURCES) $(test_commentator_SOURCES) \
-	$(test_companion_SOURCES) $(test_dense_SOURCES) \
+	$(test_PID_integer_SOURCES) $(test_bitonic_sort_SOURCES) \
+	$(test_blas_domain_SOURCES) $(test_block_ring_SOURCES) \
+	$(test_butterfly_SOURCES) $(test_charpoly_SOURCES) \
+	$(test_commentator_SOURCES) $(test_companion_SOURCES) \
+	$(test_cra_SOURCES) $(test_cradomain_SOURCES) \
+	$(test_dense_SOURCES) $(test_dense_zero_one_SOURCES) \
 	$(test_det_SOURCES) $(test_diagonal_SOURCES) \
 	$(test_dif_SOURCES) $(test_direct_sum_SOURCES) \
-	$(test_ffpack_SOURCES) $(test_frobenius_SOURCES) \
+	$(test_dyadic_to_rational_SOURCES) $(test_ffpack_SOURCES) \
+	$(test_frobenius_SOURCES) $(test_ftrmm_SOURCES) \
 	$(test_getentry_SOURCES) $(test_gf2_SOURCES) \
 	$(test_givaro_zpz_SOURCES) $(test_givaro_zpzuns_SOURCES) \
 	$(test_gmp_rational_SOURCES) $(test_hilbert_SOURCES) \
@@ -578,37 +717,48 @@ SOURCES = $(benchmark_blas_domain_SOURCES) $(benchmark_fields_SOURCES) \
 	$(test_lidia_gfq_SOURCES) $(test_matrix_domain_SOURCES) \
 	$(test_matrix_stream_SOURCES) $(test_mg_block_lanczos_SOURCES) \
 	$(test_minpoly_SOURCES) $(test_modular_SOURCES) \
+	$(test_modular_balanced_double_SOURCES) \
+	$(test_modular_balanced_float_SOURCES) \
 	$(test_modular_balanced_int_SOURCES) \
 	$(test_modular_byte_SOURCES) $(test_modular_double_SOURCES) \
-	$(test_modular_int_SOURCES) $(test_modular_short_SOURCES) \
-	$(test_moore_penrose_SOURCES) $(test_ntl_RR_SOURCES) \
-	$(test_ntl_ZZ_p_SOURCES) $(test_ntl_hankel_SOURCES) \
-	$(test_ntl_lzz_p_SOURCES) $(test_ntl_sylvester_SOURCES) \
-	$(test_ntl_toeplitz_SOURCES) $(test_param_fuzzy_SOURCES) \
-	$(test_quad_matrix_SOURCES) $(test_randiter_nonzero_SOURCES) \
-	$(test_rank_SOURCES) $(test_rational_solver_SOURCES) \
+	$(test_modular_float_SOURCES) $(test_modular_int_SOURCES) \
+	$(test_modular_short_SOURCES) $(test_moore_penrose_SOURCES) \
+	$(test_ntl_RR_SOURCES) $(test_ntl_ZZ_p_SOURCES) \
+	$(test_ntl_hankel_SOURCES) $(test_ntl_lzz_p_SOURCES) \
+	$(test_ntl_sylvester_SOURCES) $(test_ntl_toeplitz_SOURCES) \
+	$(test_nullspace_SOURCES) $(test_optimization_SOURCES) \
+	$(test_param_fuzzy_SOURCES) $(test_qlup_SOURCES) \
+	$(test_randiter_nonzero_SOURCES) $(test_rank_SOURCES) \
+	$(test_rat_charpoly_SOURCES) $(test_rat_minpoly_SOURCES) \
+	$(test_rat_solve_SOURCES) \
+	$(test_rational_matrix_factory_SOURCES) \
+	$(test_rational_reconstruction_base_SOURCES) \
+	$(test_rational_solver_SOURCES) \
 	$(test_rational_solver_adaptive_SOURCES) \
 	$(test_scalar_matrix_SOURCES) $(test_smith_form_SOURCES) \
 	$(test_smith_form_adaptive_SOURCES) \
 	$(test_smith_form_binary_SOURCES) \
 	$(test_smith_form_iliopoulos_SOURCES) \
 	$(test_smith_form_local_SOURCES) $(test_solve_SOURCES) \
-	$(test_sparse_SOURCES) $(test_subiterator_SOURCES) \
-	$(test_submatrix_SOURCES) $(test_subvector_SOURCES) \
-	$(test_sum_SOURCES) $(test_toeplitz_det_SOURCES) \
-	$(test_trace_SOURCES) $(test_triplesbb_SOURCES) \
-	$(test_unparametric_field_SOURCES) \
+	$(test_solve_nonsingular_SOURCES) $(test_sparse_SOURCES) \
+	$(test_subiterator_SOURCES) $(test_submatrix_SOURCES) \
+	$(test_subvector_SOURCES) $(test_sum_SOURCES) \
+	$(test_toeplitz_det_SOURCES) $(test_trace_SOURCES) \
+	$(test_triplesbb_SOURCES) $(test_unparametric_field_SOURCES) \
 	$(test_vector_domain_SOURCES) $(test_zero_one_SOURCES) \
 	$(test_zo_SOURCES)
 DIST_SOURCES = $(benchmark_blas_domain_SOURCES) \
-	$(benchmark_fields_SOURCES) $(test_bitonic_sort_SOURCES) \
-	$(test_blas_domain_SOURCES) $(test_block_ring_SOURCES) \
-	$(test_butterfly_SOURCES) $(test_charpoly_SOURCES) \
-	$(test_commentator_SOURCES) $(test_companion_SOURCES) \
-	$(test_dense_SOURCES) $(test_det_SOURCES) \
+	$(benchmark_fields_SOURCES) $(test_PID_integer_SOURCES) \
+	$(test_bitonic_sort_SOURCES) $(test_blas_domain_SOURCES) \
+	$(test_block_ring_SOURCES) $(test_butterfly_SOURCES) \
+	$(test_charpoly_SOURCES) $(test_commentator_SOURCES) \
+	$(test_companion_SOURCES) $(test_cra_SOURCES) \
+	$(test_cradomain_SOURCES) $(test_dense_SOURCES) \
+	$(test_dense_zero_one_SOURCES) $(test_det_SOURCES) \
 	$(test_diagonal_SOURCES) $(test_dif_SOURCES) \
-	$(test_direct_sum_SOURCES) $(test_ffpack_SOURCES) \
-	$(test_frobenius_SOURCES) $(test_getentry_SOURCES) \
+	$(test_direct_sum_SOURCES) $(test_dyadic_to_rational_SOURCES) \
+	$(test_ffpack_SOURCES) $(test_frobenius_SOURCES) \
+	$(test_ftrmm_SOURCES) $(test_getentry_SOURCES) \
 	$(test_gf2_SOURCES) $(test_givaro_zpz_SOURCES) \
 	$(test_givaro_zpzuns_SOURCES) $(test_gmp_rational_SOURCES) \
 	$(test_hilbert_SOURCES) $(test_hom_SOURCES) \
@@ -618,26 +768,34 @@ DIST_SOURCES = $(benchmark_blas_domain_SOURCES) \
 	$(test_lidia_gfq_SOURCES) $(test_matrix_domain_SOURCES) \
 	$(test_matrix_stream_SOURCES) $(test_mg_block_lanczos_SOURCES) \
 	$(test_minpoly_SOURCES) $(test_modular_SOURCES) \
+	$(test_modular_balanced_double_SOURCES) \
+	$(test_modular_balanced_float_SOURCES) \
 	$(test_modular_balanced_int_SOURCES) \
 	$(test_modular_byte_SOURCES) $(test_modular_double_SOURCES) \
-	$(test_modular_int_SOURCES) $(test_modular_short_SOURCES) \
-	$(test_moore_penrose_SOURCES) $(test_ntl_RR_SOURCES) \
-	$(test_ntl_ZZ_p_SOURCES) $(test_ntl_hankel_SOURCES) \
-	$(test_ntl_lzz_p_SOURCES) $(test_ntl_sylvester_SOURCES) \
-	$(test_ntl_toeplitz_SOURCES) $(test_param_fuzzy_SOURCES) \
-	$(test_quad_matrix_SOURCES) $(test_randiter_nonzero_SOURCES) \
-	$(test_rank_SOURCES) $(test_rational_solver_SOURCES) \
+	$(test_modular_float_SOURCES) $(test_modular_int_SOURCES) \
+	$(test_modular_short_SOURCES) $(test_moore_penrose_SOURCES) \
+	$(test_ntl_RR_SOURCES) $(test_ntl_ZZ_p_SOURCES) \
+	$(test_ntl_hankel_SOURCES) $(test_ntl_lzz_p_SOURCES) \
+	$(test_ntl_sylvester_SOURCES) $(test_ntl_toeplitz_SOURCES) \
+	$(test_nullspace_SOURCES) $(test_optimization_SOURCES) \
+	$(test_param_fuzzy_SOURCES) $(test_qlup_SOURCES) \
+	$(test_randiter_nonzero_SOURCES) $(test_rank_SOURCES) \
+	$(test_rat_charpoly_SOURCES) $(test_rat_minpoly_SOURCES) \
+	$(test_rat_solve_SOURCES) \
+	$(test_rational_matrix_factory_SOURCES) \
+	$(test_rational_reconstruction_base_SOURCES) \
+	$(test_rational_solver_SOURCES) \
 	$(test_rational_solver_adaptive_SOURCES) \
 	$(test_scalar_matrix_SOURCES) $(test_smith_form_SOURCES) \
 	$(test_smith_form_adaptive_SOURCES) \
 	$(test_smith_form_binary_SOURCES) \
 	$(test_smith_form_iliopoulos_SOURCES) \
 	$(test_smith_form_local_SOURCES) $(test_solve_SOURCES) \
-	$(test_sparse_SOURCES) $(test_subiterator_SOURCES) \
-	$(test_submatrix_SOURCES) $(test_subvector_SOURCES) \
-	$(test_sum_SOURCES) $(test_toeplitz_det_SOURCES) \
-	$(test_trace_SOURCES) $(test_triplesbb_SOURCES) \
-	$(test_unparametric_field_SOURCES) \
+	$(test_solve_nonsingular_SOURCES) $(test_sparse_SOURCES) \
+	$(test_subiterator_SOURCES) $(test_submatrix_SOURCES) \
+	$(test_subvector_SOURCES) $(test_sum_SOURCES) \
+	$(test_toeplitz_det_SOURCES) $(test_trace_SOURCES) \
+	$(test_triplesbb_SOURCES) $(test_unparametric_field_SOURCES) \
 	$(test_vector_domain_SOURCES) $(test_zero_one_SOURCES) \
 	$(test_zo_SOURCES)
 RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
@@ -651,10 +809,11 @@ RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
   distclean-recursive maintainer-clean-recursive
 ETAGS = etags
 CTAGS = ctags
- at LINBOX_HAVE_GIVARO_TRUE@am__EXEEXT_9 = $(am__EXEEXT_2)
- at LINBOX_HAVE_NTL_TRUE@am__EXEEXT_10 = $(am__EXEEXT_3)
- at LINBOX_HAVE_LIDIA_TRUE@am__EXEEXT_11 = $(am__EXEEXT_5)
-am__EXEEXT_12 = $(am__EXEEXT_4)
+ at LINBOX_HAVE_GIVARO_TRUE@am__EXEEXT_11 = $(am__EXEEXT_2)
+ at LINBOX_HAVE_NTL_TRUE@am__EXEEXT_12 = $(am__EXEEXT_3)
+ at LINBOX_HAVE_LIDIA_TRUE@am__EXEEXT_13 = $(am__EXEEXT_5)
+am__EXEEXT_14 =
+am__EXEEXT_15 = $(am__EXEEXT_4)
 DIST_SUBDIRS = $(SUBDIRS)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
@@ -665,18 +824,21 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
 CC = @CC@
+CCNAM = @CCNAM@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
 DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -684,19 +846,24 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
 GIVARO_CFLAGS = @GIVARO_CFLAGS@
 GIVARO_LIBS = @GIVARO_LIBS@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
 GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
@@ -704,41 +871,52 @@ LIBTOOL = @LIBTOOL@
 LIDIA_CFLAGS = @LIDIA_CFLAGS@
 LIDIA_LIBS = @LIDIA_LIBS@
 LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MAPLE_CFLAGS = @MAPLE_CFLAGS@
 MAPLE_HOME = @MAPLE_HOME@
 MAPLE_LIBS = @MAPLE_LIBS@
 MAPLE_VERSION = @MAPLE_VERSION@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
 NTL_CFLAGS = @NTL_CFLAGS@
 NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RM = @RM@
 SACLIB_CFLAGS = @SACLIB_CFLAGS@
 SACLIB_LIBS = @SACLIB_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+TESTS_CFLAGS = @TESTS_CFLAGS@
 VERSION = @VERSION@
+WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -779,102 +957,130 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/linbox
-#AM_LDFLAGS = -llapack -lcblas -latlas 
-#AM_CXXFLAGS = -g -DLinBoxSrcOnly -Wall -O2 
-AM_CXXFLAGS = -g -DLinBoxSrcOnly -Wall 
-#AM_CFLAGS = -g -Wall
-SUBDIRS = data
-AM_CPPFLAGS = $(CBLAS_FLAG) $(GMP_CFLAGS) $(NTL_CFLAGS) $(GIVARO_CFLAGS) $(LIDIA_CFLAGS)
-LDADD = $(BLAS_LIBS) $(NTL_LIBS) $(GMP_LIBS) $(GIVARO_LIBS) $(LIDIA_LIBS)
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/linbox $(CBLAS_FLAG) \
+	$(FFLAFLAS_CFLAGS) $(GMP_CFLAGS) $(NTL_CFLAGS) \
+	$(GIVARO_CFLAGS) $(LIDIA_CFLAGS)
+# AM_LDFLAGS = -llapack -lcblas -latlas
+AM_LDFLAGS = $(top_srcdir)/linbox/.libs/liblinbox.a -static
+#  SAFER_FLAGS = -g -Wall -Wextra -Wno-unused-parameter
+# bds: no need to optimize for unit/regression tests, and opt adds a lot to compilation time
+AM_CXXFLAGS = @TESTS_CFLAGS@ -DLinBoxSrcOnly
+#  AM_CXXFLAGS = $(SAFER_FLAGS) -DLinBoxSrcOnly
+#AM_CXXFLAGS = $(SAFER_FLAGS) -DLinBoxSrcOnly -O2
+# AM_CXXFLAGS = -g -DLinBoxSrcOnly -Wall -DDEBUG -O0
+# AM_CXXFLAGS = -g -DLinBoxSrcOnly -Wall -D__LINBOX_HAVE_DGETRF -D__LINBOX_HAVE_DGETRI
+# AM_CFLAGS = -g -Wall
+SUBDIRS = data matrix
+LDADD = $(BLAS_LIBS) $(NTL_LIBS) $(GIVARO_LIBS) $(GMP_LIBS)  $(LIDIA_LIBS)
 EXTRA_DIST = \
-test-common.C
+		test-common.C  \
+		tests.doxy     \
+		checker.C
+
 
+#  test-generic-for-quad.h
 
-# Put an entry for your test-mycomponent.C here (or in one of the other test groups).  
+# Put an entry for your test-mycomponent.C here (or in one of the other test groups).
 # Don't forget to add a test_mycomponent_SOURCES entry below.
 #
 # Once present, tests should remain present, being moved from one group to another.
 # Note that among the available groups are NONCOMPILING_TESTS and FAILING_TESTS, which
 # will be ignored by "make check" and can be temporary storage for problematic tests.
 BASIC_TESTS = \
-        test-bitonic-sort       \
-	test-blas-domain	\
-        test-butterfly          \
-        test-commentator        \
-        test-charpoly			\
-        test-companion          \
-        test-dense              \
-        test-det                \
-        test-diagonal           \
-        test-dif                \
-        test-direct-sum         \
-	test-ffpack		\
-        test-frobenius          \
-        test-getentry           \
-        test-gf2                \
-        test-gmp-rational       \
-        test-hilbert            \
-        test-hom                \
-        test-inverse            \
-        test-isposdef           \
-        test-ispossemidef       \
-        test-matrix-domain      \
-        test-matrix-stream      \
-        test-minpoly            \
-        test-modular            \
-        test-modular-balanced-int\
-        test-modular-byte       \
-        test-modular-double     \
-        test-modular-int        \
-        test-modular-short      \
-	test-block-ring			\
-        test-moore-penrose      \
-        test-randiter-nonzero   \
-        test-rank               \
-        test-scalar-matrix      \
-        test-sparse             \
-        test-subiterator        \
-        test-submatrix          \
-        test-subvector          \
-        test-trace              \
-        test-triplesbb          \
-        test-vector-domain      \
-	test-zero-one 
+        test-bitonic-sort             \
+        test-blas-domain              \
+        test-butterfly                \
+        test-commentator              \
+        test-companion                \
+        test-dense                    \
+        test-det                      \
+        test-diagonal                 \
+        test-dif                      \
+        test-direct-sum               \
+        test-ffpack                   \
+        test-frobenius                \
+        test-getentry                 \
+        test-gf2                      \
+        test-gmp-rational             \
+        test-hilbert                  \
+        test-hom                      \
+        test-inverse                  \
+        test-isposdef                 \
+        test-ispossemidef             \
+        test-matrix-domain            \
+        test-matrix-stream            \
+        test-minpoly                  \
+        test-modular                  \
+        test-modular-balanced-int     \
+        test-modular-balanced-float   \
+        test-modular-balanced-double  \
+        test-modular-byte             \
+        test-modular-double           \
+        test-modular-float            \
+        test-modular-int              \
+        test-modular-short            \
+        test-block-ring               \
+        test-PID-integer              \
+        test-moore-penrose            \
+        test-randiter-nonzero         \
+        test-rank                     \
+        test-rational-matrix-factory  \
+        test-scalar-matrix            \
+        test-sparse                   \
+        test-subiterator              \
+        test-submatrix                \
+        test-subvector                \
+        test-sum                      \
+        test-trace                    \
+        test-triplesbb                \
+        test-vector-domain            \
+        test-qlup                     \
+        test-zero-one                 \
+        test-solve                    \
+        test-nullspace                \
+        test-smith-form-binary        \
+        test-rational-solver          \
+        test-rational-solver-adaptive \
+        test-solve-nonsingular        \
+        test-last-invariant-factor    \
+        test-charpoly                 \
+        test-cra                      \
+        test-cradomain                \
+        test-unparametric-field       \
+		test-rational-reconstruction-base
+
+
+#  test-integer-tools
 
 # tests of components not adhering to LinBox requirements.
 NONCOMPLIANT_TESTS = \
-	test-unparametric-field	\
-	test-ntl-RR		\
-	test-param-fuzzy
+        test-ntl-RR                    \
+        test-param-fuzzy
 
 
 #These need clapack
 #test-rational-solver-adaptive
-#test-smith-form-adaptive  
+DUBIOUS_TESTS = \
+		test-zo
+
+#  test-quad-matrix
+NONCOMPILING_TESTS = \
+        test-dense-zero-one
 
-# this allows _SOURCES entry to remain
-# except for "make dist"
-NONEXISTING_TESTS = 
-#NONEXISTING_TESTS = test-solutions
-#
-#test_solutions_SOURCES=    \
-#	test-common.h	\
-#	test-solutions.C
-#
-NONCOMPILING_TESTS = 
-#		test-inertia			
 FAILING_TESTS = \
-        test-solve              \
-        test-zo                 \
-        test-quad-matrix        \
-        test-mg-block-lanczos   \
-	test-la-block-lanczos    
-
-#       test-over-under         
-#       test-side-by-side       
+        test-rat-charpoly        \
+		test-rat-solve           \
+		test-rat-minpoly         \
+		test-smith-form-local    \
+		test-smith-form-adaptive \
+		test-dyadic-to-rational  \
+		test-mg-block-lanczos    \
+		test-ftrmm               \
+        test-la-block-lanczos
+
 USE_NONCOMPILING_TESTS = 
 USE_FAILING_TESTS = 
 # comment out these two lines to avoid facing reality
@@ -883,377 +1089,444 @@ USE_FAILING_TESTS =
 
 # a benchmarker, not to be included in check.
 BENCHMARKS = \
-	benchmark-fields		\
-	benchmark-blas-domain
+        benchmark-fields        \
+        benchmark-blas-domain
 
 
 # historical tests, no longer in use
-#	test-nag-sparse		  replaced by tripplesbb
-#       test-lsp 	lsp.h superceded by factorized-matrix.h
+#        test-nag-sparse                  replaced by tripplesbb
+#       test-lsp         lsp.h superceded by factorized-matrix.h
 # removed test
-#	test-nag-sparse
-#	test-image-field       replaced by hom 
+#        test-nag-sparse
+#        test-image-field       replaced by hom
 #       test-lsp
 # I put test-gssv_rank in hmrg:~saunders/gen_superlu.  It is not linbox until and unless it is made to work
 # test-gssv is an ntl test
 
 # no explicit test needed, I guess...
-#	Transpose is tested in test-triplesbb
-#	Compose is tested in test-butterfly
+#        Transpose is tested in test-triplesbb
+#        Compose is tested in test-butterfly
 GIVARO_TESTS = \
-	test-givaro-zpz		\
-	test-givaro-zpzuns
+        test-givaro-zpz               \
+        test-givaro-zpzuns
 
 NTL_TESTS = \
-	test-ntl-lzz_p			\
-	test-ntl-ZZ_p			\
-	test-ntl-toeplitz		\
-	test-ntl-hankel   		\
-	test-ntl-sylvester		\
-	test-sum			\
-	test-smith-form-local		\
-	test-smith-form			\
-	test-smith-form-iliopoulos	\
-	test-smith-form-adaptive	\
-	test-smith-form-binary		\
-	test-rational-solver		\
-	test-rational-solver-adaptive	\
-	test-last-invariant-factor	\
-	test-toeplitz-det
+        test-smith-form               \
+        test-ntl-lzz_p                \
+        test-ntl-ZZ_p                 \
+        test-ntl-toeplitz             \
+        test-ntl-hankel               \
+        test-ntl-sylvester            \
+        test-smith-form-iliopoulos    \
+        test-toeplitz-det
 
 LIDIA_TESTS = \
-	test-lidia-gfq
+        test-lidia-gfq
+
+ATLAS_TESTS = \
+        test-optimization
 
-ATLAS_TESTS = 
 @LINBOX_HAVE_NTL_TRUE at USE_NTL_TESTS = $(NTL_TESTS)
 @LINBOX_HAVE_GIVARO_TRUE at USE_GIVARO_TESTS = $(GIVARO_TESTS)
 @LINBOX_HAVE_LIDIA_TRUE at USE_LIDIA_TESTS = $(LIDIA_TESTS)
 USE_ATLAS_TESTS = $(ATLAS_TESTS)
-CLEANFILES = $(TESTS)
+CLEANFILES = checker               \
+			$(BASIC_TESTS)        \
+			$(FAILING_TESTS)      \
+			$(NONCOMPLIANT_TESTS) \
+			$(BENCHMARKS)         \
+			$(DUBIOUS_TESTS)      \
+			$(NTL_TESTS)          \
+			$(GIVARO_TESTS)       \
+			$(ATLAS_TESTS)
+
 test_commentator_SOURCES = \
-	test-commentator.C		\
-	test-common.h
+        test-commentator.C                \
+        test-common.h
 
 test_modular_SOURCES = \
-	test-modular.C			\
-	test-generic.h			\
-	test-common.h
+        test-modular.C                        \
+        test-generic.h                        \
+        test-common.h
 
 test_block_ring_SOURCES = \
-	test-block-ring.C			\
-	test-field.h			\
-	test-common.h
+        test-block-ring.C                 \
+        test-field.h                      \
+        test-common.h
+
+test_PID_integer_SOURCES = \
+        test-PID-integer.C                 \
+        test-field.h                      \
+        test-common.h
 
 test_hom_SOURCES = \
-	test-hom.C			\
-	test-generic.h			\
-	test-common.h
+        test-hom.C                        \
+        test-generic.h                    \
+        test-common.h
 
 test_gf2_SOURCES = \
-	test-gf2.C			\
-	test-generic.h			\
-	test-common.h
+        test-gf2.C                        \
+        test-generic.h                    \
+        test-common.h
 
 test_gmp_rational_SOURCES = \
-	test-gmp-rational.C		\
-	test-generic.h			\
-	test-common.h
+        test-gmp-rational.C               \
+        test-generic.h                    \
+        test-common.h
 
 test_unparametric_field_SOURCES = \
-	test-unparametric-field.C	\
-	test-generic.h			\
-	test-common.h
+        test-unparametric-field.C        \
+        test-generic.h                   \
+        test-common.h
 
 test_randiter_nonzero_SOURCES = \
-	test-randiter-nonzero.C		\
-	test-common.h
+        test-randiter-nonzero.C          \
+        test-common.h
+
+test_rational_matrix_factory_SOURCES = \
+        test-rational-matrix-factory.C  \
+        test-common.h
+
+test_rational_reconstruction_base_SOURCES = \
+	  test-rational-reconstruction-base.C  \
+	  test-common.h
+
+test_rat_solve_SOURCES = \
+        test-rat-solve.C                \
+        test-common.h
+
+test_rat_charpoly_SOURCES = \
+        test-rat-charpoly.C             \
+        test-common.h
+
+test_rat_minpoly_SOURCES = \
+        test-rat-minpoly.C              \
+        test-common.h
 
 test_subiterator_SOURCES = \
-	test-subiterator.C		\
-	test-common.h
+        test-subiterator.C              \
+        test-common.h
 
 test_subvector_SOURCES = \
-	test-subvector.C		\
-	test-common.h
+        test-subvector.C                \
+        test-common.h
 
 test_vector_domain_SOURCES = \
-	test-vector-domain.C		\
-	test-vector-domain.h		
+        test-vector-domain.C            \
+        test-vector-domain.h
 
 test_matrix_domain_SOURCES = \
-	test-matrix-domain.C		\
-	test-common.h
+        test-matrix-domain.C            \
+        test-common.h
 
 test_dense_SOURCES = \
-	test-dense.C			\
-	test-common.h
+        test-dense.C                    \
+        test-common.h
 
 test_sparse_SOURCES = \
-	test-sparse.C			\
-	test-common.h
+        test-sparse.C                   \
+        test-common.h
 
 test_submatrix_SOURCES = \
-	test-submatrix.C		\
-	test-common.h
+        test-submatrix.C                \
+        test-common.h
 
 test_scalar_matrix_SOURCES = \
-	test-scalar-matrix.C		\
-	test-generic.h			\
-	test-common.h
+        test-scalar-matrix.C            \
+        test-generic.h                  \
+        test-common.h
 
 test_butterfly_SOURCES = \
-	test-vector-domain.h		\
-	test-blackbox.h			\
-	test-butterfly.C		\
-	test-generic.h			\
-	test-common.h
+        test-vector-domain.h            \
+        test-blackbox.h                 \
+        test-butterfly.C                \
+        test-generic.h                  \
+        test-common.h
 
 test_charpoly_SOURCES = \
-	test-charpoly.C			\
-	test-common.h
+        test-charpoly.C                 \
+        test-common.h
 
 test_diagonal_SOURCES = \
-	test-diagonal.C			\
-	test-generic.h			\
-	test-common.h
+        test-diagonal.C                 \
+        test-generic.h                  \
+        test-common.h
 
 test_sum_SOURCES = \
-	test-sum.C			\
-	test-generic.h			\
-	test-common.h
+        test-sum.C                      \
+        test-generic.h                  \
+        test-common.h
 
 test_dif_SOURCES = \
-	test-dif.C	test-generic.h	\
-	test-common.h
+        test-dif.C        test-generic.h    \
+        test-common.h
 
 test_triplesbb_SOURCES = \
-	test-triplesbb.C		\
-	test-generic.h			\
-	test-common.h
-
+        test-triplesbb.C                \
+        test-generic.h                  \
+        test-common.h
 
-#test_inertia_SOURCES =		\
-#	test-inertia.C		\
-#	test-common.h
 test_hilbert_SOURCES = \
-	test-hilbert.C	test-generic.h	\
-	test-common.h
+        test-hilbert.C        test-generic.h        \
+        test-common.h
 
 test_ntl_toeplitz_SOURCES = \
-	test-ntl-toeplitz.C		\
-	test-common.h
+        test-ntl-toeplitz.C                \
+        test-common.h
 
 test_ntl_hankel_SOURCES = \
-	test-ntl-hankel.C		\
-	test-common.h
+        test-ntl-hankel.C                \
+        test-common.h
 
 test_ntl_sylvester_SOURCES = \
-	test-ntl-sylvester.C		\
-	test-common.h
+        test-ntl-sylvester.C                \
+        test-common.h
 
 test_toeplitz_det_SOURCES = \
-	test-toeplitz-det.C
+        test-toeplitz-det.C
 
 test_trace_SOURCES = \
-	test-trace.C			\
-	test-common.h
+        test-trace.C                         \
+        test-common.h
 
 test_getentry_SOURCES = \
-	test-getentry.C			\
-	test-common.h
+        test-getentry.C                         \
+        test-common.h
 
 test_minpoly_SOURCES = \
-	test-minpoly.C			\
-	test-common.h
+        test-minpoly.C                         \
+        test-common.h
 
 test_det_SOURCES = \
-	test-det.C			\
-	test-common.h
+        test-det.C                        \
+        test-common.h
 
 test_rank_SOURCES = \
-	test-rank.C			\
-	test-common.h
+        test-rank.C                        \
+        test-common.h
+
+test_qlup_SOURCES = \
+        test-qlup.C                        \
+        test-common.h
 
 test_solve_SOURCES = \
-	test-solve.C			\
-	test-common.h
+        test-solve.C                        \
+        test-common.h
 
 test_direct_sum_SOURCES = \
-	test-direct-sum.C		\
-	test-generic.h			\
-	test-common.h
+        test-direct-sum.C                \
+        test-generic.h                   \
+        test-common.h
 
 test_frobenius_SOURCES = \
-	test-frobenius.C		\
-	test-generic.h			\
-	test-common.h
+        test-frobenius.C                \
+        test-generic.h                  \
+        test-common.h
 
 test_companion_SOURCES = \
-	test-companion.C		\
-	test-generic.h			\
-	test-common.h
+        test-companion.C                \
+        test-generic.h                  \
+        test-common.h
 
 test_inverse_SOURCES = \
-	test-inverse.C			\
-	test-common.h
+        test-inverse.C                        \
+        test-common.h
 
 test_moore_penrose_SOURCES = \
-	test-moore-penrose.C		\
-	test-common.h
+        test-moore-penrose.C                \
+        test-common.h
 
 test_ntl_RR_SOURCES = \
-	test-ntl-RR.C			\
-	test-generic.h			\
-	test-common.h
+        test-ntl-RR.C                        \
+        test-generic.h                       \
+        test-common.h
 
 test_ntl_ZZ_p_SOURCES = \
-	test-ntl-ZZ_p.C			\
-	test-generic.h			\
-	test-common.h
+        test-ntl-ZZ_p.C                        \
+        test-generic.h                         \
+        test-common.h
 
 test_ntl_lzz_p_SOURCES = \
-	test-ntl-lzz_p.C		\
-	test-generic.h			\
-	test-common.h
+        test-ntl-lzz_p.C                \
+        test-generic.h                  \
+        test-common.h
 
 test_givaro_zpz_SOURCES = \
-	test-givaro-zpz.C		\
-	test-generic.h			\
-	test-common.h
+        test-givaro-zpz.C                \
+        test-generic.h                   \
+        test-common.h
 
 test_givaro_zpzuns_SOURCES = \
-	test-givaro-zpzuns.C		\
-	test-generic.h			\
-	test-common.h
+        test-givaro-zpzuns.C                \
+        test-generic.h                      \
+        test-common.h
 
 test_lidia_gfq_SOURCES = \
-	test-lidia-gfq.C		\
-	test-generic.h			\
-	test-common.h
+        test-lidia-gfq.C                \
+        test-generic.h                  \
+        test-common.h
 
 test_param_fuzzy_SOURCES = \
-	test-param-fuzzy.C	        \
-	test-generic.h		        \
-	test-common.h
-
-
-#test_side_by_side_SOURCES =		\
-#	test-side-by-side.C		\
-#	test-generic.h			\
-#	test-common.h
-
-#test_over_under_SOURCES =		\
-#	test-over-under.C		\
-#	test-generic.h			\
-#	test-common.h
-test_quad_matrix_SOURCES = \
-	test-quad-matrix.C		\
-	test-generic-for-quad.h		\
-	test-generic.h			\
-	test-common.h
+        test-param-fuzzy.C                \
+        test-generic.h                    \
+        test-common.h
 
+
+#  test_quad_matrix_SOURCES =                \
+#  test-quad-matrix.C                \
+#  test-generic-for-quad.h           \
+#  test-generic.h                    \
+#  test-common.h
 test_zo_SOURCES = \
-	test-zo.C			\
-	test-generic.h			\
-	test-common.h
+        test-zo.C                        \
+        test-generic.h                   \
+        test-common.h
 
 test_zero_one_SOURCES = \
-	test-zero-one.C			\
-	test-generic.h			\
-	test-common.h
+        test-zero-one.C                       \
+        test-generic.h                        \
+        test-common.h
 
 test_modular_int_SOURCES = \
-	test-modular-int.C 		\
-	test-common.h	
+        test-modular-int.C                \
+        test-common.h
 
 test_modular_short_SOURCES = \
-	test-modular-short.C		\
-	test-generic.h			\
-	test-common.h
+        test-modular-short.C                \
+        test-generic.h                      \
+        test-common.h
 
 test_modular_double_SOURCES = \
-	test-modular-double.C		\
-	test-generic.h			\
-	test-common.h
+        test-modular-double.C                \
+        test-generic.h                       \
+        test-common.h
+
+test_modular_float_SOURCES = \
+        test-modular-float.C                \
+        test-generic.h                       \
+        test-common.h
 
 test_modular_byte_SOURCES = \
-	test-modular-byte.C		\
-	test-generic.h			\
-	test-common.h
+        test-modular-byte.C          \
+        test-generic.h               \
+        test-common.h
 
 test_modular_balanced_int_SOURCES = \
-        test-modular-balanced-int.C             \
-        test-generic.h                  \
+        test-modular-balanced-int.C  \
+        test-generic.h               \
+        test-common.h
+
+test_modular_balanced_double_SOURCES = \
+        test-modular-balanced-double.C  \
+        test-generic.h               \
+        test-common.h
+
+test_modular_balanced_float_SOURCES = \
+        test-modular-balanced-float.C  \
+        test-generic.h               \
         test-common.h
 
 test_smith_form_iliopoulos_SOURCES = \
-	test-common.h	\
-	test-smith-form-iliopoulos.C
+        test-common.h                \
+        test-smith-form-iliopoulos.C
 
 test_smith_form_binary_SOURCES = \
-	test-common.h	\
-	test-smith-form-binary.C
+        test-common.h            \
+        test-smith-form-binary.C
 
 test_smith_form_SOURCES = \
-	test-common.h	\
-	test-smith-form.C
+        test-common.h       \
+        test-smith-form.C
 
 test_last_invariant_factor_SOURCES = \
-	test-common.h	\
-	test-last-invariant-factor.C
+        test-common.h                  \
+        test-last-invariant-factor.C
 
 test_smith_form_local_SOURCES = \
-	test-common.h	\
-	test-smith-form-local.C
+        test-common.h             \
+        test-smith-form-local.C
+
+test_optimization_SOURCES = \
+        test-common.h         \
+        test-optimization.C
+
+test_nullspace_SOURCES = \
+        test-common.h      \
+        test-nullspace.C
 
 test_bitonic_sort_SOURCES = \
-        test-common.h   \
+        test-common.h                   \
         test-bitonic-sort.C
 
 test_rational_solver_SOURCES = \
-	test-common.h	\
-	test-rational-solver.C
+        test-common.h                   \
+        test-rational-solver.C
 
 test_blas_domain_SOURCES = \
-	test-common.h   \
-	test-blas-domain.C
+        test-common.h                   \
+        test-blas-domain.C
 
 test_ffpack_SOURCES = \
-	test-common.h   \
-	test-ffpack.C
+        test-common.h                   \
+        test-ffpack.C
 
 test_matrix_stream_SOURCES = \
-	test-matrix-stream.C
+        test-matrix-stream.C
 
 test_la_block_lanczos_SOURCES = \
-	test-la-block-lanczos.C
+        test-la-block-lanczos.C
 
 test_mg_block_lanczos_SOURCES = \
-	test-mg-block-lanczos.C
+        test-mg-block-lanczos.C
 
 test_rational_solver_adaptive_SOURCES = \
-	test-rational-solver-adaptive.C \
-	test-common.h
+        test-rational-solver-adaptive.C \
+        test-common.h
+
+test_dyadic_to_rational_SOURCES = \
+        test-dyadic-to-rational.C \
+        test-common.h
+
+test_cra_SOURCES = \
+        test-cra.C                      \
+        test-common.h
 
+test_cradomain_SOURCES = \
+        test-cradomain.C                \
+        test-common.h
+
+
+# NTL test
 test_smith_form_adaptive_SOURCES = \
-	test-common.h	\
-	test-smith-form-adaptive.C
+        test-common.h                  \
+        test-smith-form-adaptive.C
 
 benchmark_fields_SOURCES = \
-	test-common.h	\
-	benchmark-fields.C
+        test-common.h                  \
+        benchmark-fields.C
 
 benchmark_blas_domain_SOURCES = \
-	test-common.h   \
-	benchmark-blas-domain.C
+        test-common.h                  \
+        benchmark-blas-domain.C
 
 test_isposdef_SOURCES = \
-	test-common.h	\
-	test-isposdef.C
+        test-common.h                  \
+        test-isposdef.C
+
+test_dense_zero_one_SOURCES = \
+        test-blackbox.h                \
+        test-dense-zero-one.C
 
 test_ispossemidef_SOURCES = \
-	test-common.h	\
-	test-ispossemidef.C
+        test-common.h                 \
+        test-ispossemidef.C
+
+test_ftrmm_SOURCES = \
+		test-ftrmm.C
+
+test_solve_nonsingular_SOURCES = \
+		test-common.h                   \
+		test-solve-nonsingular.C
 
 all: all-recursive
 
@@ -1263,8 +1536,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
 	      exit 1;; \
 	  esac; \
 	done; \
@@ -1294,6 +1567,9 @@ benchmark-blas-domain$(EXEEXT): $(benchmark_blas_domain_OBJECTS) $(benchmark_bla
 benchmark-fields$(EXEEXT): $(benchmark_fields_OBJECTS) $(benchmark_fields_DEPENDENCIES) 
 	@rm -f benchmark-fields$(EXEEXT)
 	$(CXXLINK) $(benchmark_fields_OBJECTS) $(benchmark_fields_LDADD) $(LIBS)
+test-PID-integer$(EXEEXT): $(test_PID_integer_OBJECTS) $(test_PID_integer_DEPENDENCIES) 
+	@rm -f test-PID-integer$(EXEEXT)
+	$(CXXLINK) $(test_PID_integer_OBJECTS) $(test_PID_integer_LDADD) $(LIBS)
 test-bitonic-sort$(EXEEXT): $(test_bitonic_sort_OBJECTS) $(test_bitonic_sort_DEPENDENCIES) 
 	@rm -f test-bitonic-sort$(EXEEXT)
 	$(CXXLINK) $(test_bitonic_sort_OBJECTS) $(test_bitonic_sort_LDADD) $(LIBS)
@@ -1315,9 +1591,18 @@ test-commentator$(EXEEXT): $(test_commentator_OBJECTS) $(test_commentator_DEPEND
 test-companion$(EXEEXT): $(test_companion_OBJECTS) $(test_companion_DEPENDENCIES) 
 	@rm -f test-companion$(EXEEXT)
 	$(CXXLINK) $(test_companion_OBJECTS) $(test_companion_LDADD) $(LIBS)
+test-cra$(EXEEXT): $(test_cra_OBJECTS) $(test_cra_DEPENDENCIES) 
+	@rm -f test-cra$(EXEEXT)
+	$(CXXLINK) $(test_cra_OBJECTS) $(test_cra_LDADD) $(LIBS)
+test-cradomain$(EXEEXT): $(test_cradomain_OBJECTS) $(test_cradomain_DEPENDENCIES) 
+	@rm -f test-cradomain$(EXEEXT)
+	$(CXXLINK) $(test_cradomain_OBJECTS) $(test_cradomain_LDADD) $(LIBS)
 test-dense$(EXEEXT): $(test_dense_OBJECTS) $(test_dense_DEPENDENCIES) 
 	@rm -f test-dense$(EXEEXT)
 	$(CXXLINK) $(test_dense_OBJECTS) $(test_dense_LDADD) $(LIBS)
+test-dense-zero-one$(EXEEXT): $(test_dense_zero_one_OBJECTS) $(test_dense_zero_one_DEPENDENCIES) 
+	@rm -f test-dense-zero-one$(EXEEXT)
+	$(CXXLINK) $(test_dense_zero_one_OBJECTS) $(test_dense_zero_one_LDADD) $(LIBS)
 test-det$(EXEEXT): $(test_det_OBJECTS) $(test_det_DEPENDENCIES) 
 	@rm -f test-det$(EXEEXT)
 	$(CXXLINK) $(test_det_OBJECTS) $(test_det_LDADD) $(LIBS)
@@ -1330,12 +1615,18 @@ test-dif$(EXEEXT): $(test_dif_OBJECTS) $(test_dif_DEPENDENCIES)
 test-direct-sum$(EXEEXT): $(test_direct_sum_OBJECTS) $(test_direct_sum_DEPENDENCIES) 
 	@rm -f test-direct-sum$(EXEEXT)
 	$(CXXLINK) $(test_direct_sum_OBJECTS) $(test_direct_sum_LDADD) $(LIBS)
+test-dyadic-to-rational$(EXEEXT): $(test_dyadic_to_rational_OBJECTS) $(test_dyadic_to_rational_DEPENDENCIES) 
+	@rm -f test-dyadic-to-rational$(EXEEXT)
+	$(CXXLINK) $(test_dyadic_to_rational_OBJECTS) $(test_dyadic_to_rational_LDADD) $(LIBS)
 test-ffpack$(EXEEXT): $(test_ffpack_OBJECTS) $(test_ffpack_DEPENDENCIES) 
 	@rm -f test-ffpack$(EXEEXT)
 	$(CXXLINK) $(test_ffpack_OBJECTS) $(test_ffpack_LDADD) $(LIBS)
 test-frobenius$(EXEEXT): $(test_frobenius_OBJECTS) $(test_frobenius_DEPENDENCIES) 
 	@rm -f test-frobenius$(EXEEXT)
 	$(CXXLINK) $(test_frobenius_OBJECTS) $(test_frobenius_LDADD) $(LIBS)
+test-ftrmm$(EXEEXT): $(test_ftrmm_OBJECTS) $(test_ftrmm_DEPENDENCIES) 
+	@rm -f test-ftrmm$(EXEEXT)
+	$(CXXLINK) $(test_ftrmm_OBJECTS) $(test_ftrmm_LDADD) $(LIBS)
 test-getentry$(EXEEXT): $(test_getentry_OBJECTS) $(test_getentry_DEPENDENCIES) 
 	@rm -f test-getentry$(EXEEXT)
 	$(CXXLINK) $(test_getentry_OBJECTS) $(test_getentry_LDADD) $(LIBS)
@@ -1390,6 +1681,12 @@ test-minpoly$(EXEEXT): $(test_minpoly_OBJECTS) $(test_minpoly_DEPENDENCIES)
 test-modular$(EXEEXT): $(test_modular_OBJECTS) $(test_modular_DEPENDENCIES) 
 	@rm -f test-modular$(EXEEXT)
 	$(CXXLINK) $(test_modular_OBJECTS) $(test_modular_LDADD) $(LIBS)
+test-modular-balanced-double$(EXEEXT): $(test_modular_balanced_double_OBJECTS) $(test_modular_balanced_double_DEPENDENCIES) 
+	@rm -f test-modular-balanced-double$(EXEEXT)
+	$(CXXLINK) $(test_modular_balanced_double_OBJECTS) $(test_modular_balanced_double_LDADD) $(LIBS)
+test-modular-balanced-float$(EXEEXT): $(test_modular_balanced_float_OBJECTS) $(test_modular_balanced_float_DEPENDENCIES) 
+	@rm -f test-modular-balanced-float$(EXEEXT)
+	$(CXXLINK) $(test_modular_balanced_float_OBJECTS) $(test_modular_balanced_float_LDADD) $(LIBS)
 test-modular-balanced-int$(EXEEXT): $(test_modular_balanced_int_OBJECTS) $(test_modular_balanced_int_DEPENDENCIES) 
 	@rm -f test-modular-balanced-int$(EXEEXT)
 	$(CXXLINK) $(test_modular_balanced_int_OBJECTS) $(test_modular_balanced_int_LDADD) $(LIBS)
@@ -1399,6 +1696,9 @@ test-modular-byte$(EXEEXT): $(test_modular_byte_OBJECTS) $(test_modular_byte_DEP
 test-modular-double$(EXEEXT): $(test_modular_double_OBJECTS) $(test_modular_double_DEPENDENCIES) 
 	@rm -f test-modular-double$(EXEEXT)
 	$(CXXLINK) $(test_modular_double_OBJECTS) $(test_modular_double_LDADD) $(LIBS)
+test-modular-float$(EXEEXT): $(test_modular_float_OBJECTS) $(test_modular_float_DEPENDENCIES) 
+	@rm -f test-modular-float$(EXEEXT)
+	$(CXXLINK) $(test_modular_float_OBJECTS) $(test_modular_float_LDADD) $(LIBS)
 test-modular-int$(EXEEXT): $(test_modular_int_OBJECTS) $(test_modular_int_DEPENDENCIES) 
 	@rm -f test-modular-int$(EXEEXT)
 	$(CXXLINK) $(test_modular_int_OBJECTS) $(test_modular_int_LDADD) $(LIBS)
@@ -1426,18 +1726,39 @@ test-ntl-sylvester$(EXEEXT): $(test_ntl_sylvester_OBJECTS) $(test_ntl_sylvester_
 test-ntl-toeplitz$(EXEEXT): $(test_ntl_toeplitz_OBJECTS) $(test_ntl_toeplitz_DEPENDENCIES) 
 	@rm -f test-ntl-toeplitz$(EXEEXT)
 	$(CXXLINK) $(test_ntl_toeplitz_OBJECTS) $(test_ntl_toeplitz_LDADD) $(LIBS)
+test-nullspace$(EXEEXT): $(test_nullspace_OBJECTS) $(test_nullspace_DEPENDENCIES) 
+	@rm -f test-nullspace$(EXEEXT)
+	$(CXXLINK) $(test_nullspace_OBJECTS) $(test_nullspace_LDADD) $(LIBS)
+test-optimization$(EXEEXT): $(test_optimization_OBJECTS) $(test_optimization_DEPENDENCIES) 
+	@rm -f test-optimization$(EXEEXT)
+	$(CXXLINK) $(test_optimization_OBJECTS) $(test_optimization_LDADD) $(LIBS)
 test-param-fuzzy$(EXEEXT): $(test_param_fuzzy_OBJECTS) $(test_param_fuzzy_DEPENDENCIES) 
 	@rm -f test-param-fuzzy$(EXEEXT)
 	$(CXXLINK) $(test_param_fuzzy_OBJECTS) $(test_param_fuzzy_LDADD) $(LIBS)
-test-quad-matrix$(EXEEXT): $(test_quad_matrix_OBJECTS) $(test_quad_matrix_DEPENDENCIES) 
-	@rm -f test-quad-matrix$(EXEEXT)
-	$(CXXLINK) $(test_quad_matrix_OBJECTS) $(test_quad_matrix_LDADD) $(LIBS)
+test-qlup$(EXEEXT): $(test_qlup_OBJECTS) $(test_qlup_DEPENDENCIES) 
+	@rm -f test-qlup$(EXEEXT)
+	$(CXXLINK) $(test_qlup_OBJECTS) $(test_qlup_LDADD) $(LIBS)
 test-randiter-nonzero$(EXEEXT): $(test_randiter_nonzero_OBJECTS) $(test_randiter_nonzero_DEPENDENCIES) 
 	@rm -f test-randiter-nonzero$(EXEEXT)
 	$(CXXLINK) $(test_randiter_nonzero_OBJECTS) $(test_randiter_nonzero_LDADD) $(LIBS)
 test-rank$(EXEEXT): $(test_rank_OBJECTS) $(test_rank_DEPENDENCIES) 
 	@rm -f test-rank$(EXEEXT)
 	$(CXXLINK) $(test_rank_OBJECTS) $(test_rank_LDADD) $(LIBS)
+test-rat-charpoly$(EXEEXT): $(test_rat_charpoly_OBJECTS) $(test_rat_charpoly_DEPENDENCIES) 
+	@rm -f test-rat-charpoly$(EXEEXT)
+	$(CXXLINK) $(test_rat_charpoly_OBJECTS) $(test_rat_charpoly_LDADD) $(LIBS)
+test-rat-minpoly$(EXEEXT): $(test_rat_minpoly_OBJECTS) $(test_rat_minpoly_DEPENDENCIES) 
+	@rm -f test-rat-minpoly$(EXEEXT)
+	$(CXXLINK) $(test_rat_minpoly_OBJECTS) $(test_rat_minpoly_LDADD) $(LIBS)
+test-rat-solve$(EXEEXT): $(test_rat_solve_OBJECTS) $(test_rat_solve_DEPENDENCIES) 
+	@rm -f test-rat-solve$(EXEEXT)
+	$(CXXLINK) $(test_rat_solve_OBJECTS) $(test_rat_solve_LDADD) $(LIBS)
+test-rational-matrix-factory$(EXEEXT): $(test_rational_matrix_factory_OBJECTS) $(test_rational_matrix_factory_DEPENDENCIES) 
+	@rm -f test-rational-matrix-factory$(EXEEXT)
+	$(CXXLINK) $(test_rational_matrix_factory_OBJECTS) $(test_rational_matrix_factory_LDADD) $(LIBS)
+test-rational-reconstruction-base$(EXEEXT): $(test_rational_reconstruction_base_OBJECTS) $(test_rational_reconstruction_base_DEPENDENCIES) 
+	@rm -f test-rational-reconstruction-base$(EXEEXT)
+	$(CXXLINK) $(test_rational_reconstruction_base_OBJECTS) $(test_rational_reconstruction_base_LDADD) $(LIBS)
 test-rational-solver$(EXEEXT): $(test_rational_solver_OBJECTS) $(test_rational_solver_DEPENDENCIES) 
 	@rm -f test-rational-solver$(EXEEXT)
 	$(CXXLINK) $(test_rational_solver_OBJECTS) $(test_rational_solver_LDADD) $(LIBS)
@@ -1465,6 +1786,9 @@ test-smith-form-local$(EXEEXT): $(test_smith_form_local_OBJECTS) $(test_smith_fo
 test-solve$(EXEEXT): $(test_solve_OBJECTS) $(test_solve_DEPENDENCIES) 
 	@rm -f test-solve$(EXEEXT)
 	$(CXXLINK) $(test_solve_OBJECTS) $(test_solve_LDADD) $(LIBS)
+test-solve-nonsingular$(EXEEXT): $(test_solve_nonsingular_OBJECTS) $(test_solve_nonsingular_DEPENDENCIES) 
+	@rm -f test-solve-nonsingular$(EXEEXT)
+	$(CXXLINK) $(test_solve_nonsingular_OBJECTS) $(test_solve_nonsingular_LDADD) $(LIBS)
 test-sparse$(EXEEXT): $(test_sparse_OBJECTS) $(test_sparse_DEPENDENCIES) 
 	@rm -f test-sparse$(EXEEXT)
 	$(CXXLINK) $(test_sparse_OBJECTS) $(test_sparse_LDADD) $(LIBS)
@@ -1530,7 +1854,7 @@ clean-libtool:
 #     (which will cause the Makefiles to be regenerated when you run `make');
 # (2) otherwise, pass the desired values on the `make' command line.
 $(RECURSIVE_TARGETS):
-	@failcom='exit 1'; \
+	@fail= failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
 	    *=* | --[!k]*);; \
@@ -1555,7 +1879,7 @@ $(RECURSIVE_TARGETS):
 	fi; test -z "$$fail"
 
 $(RECURSIVE_CLEAN_TARGETS):
-	@failcom='exit 1'; \
+	@fail= failcom='exit 1'; \
 	for f in x $$MAKEFLAGS; do \
 	  case $$f in \
 	    *=* | --[!k]*);; \
@@ -1598,7 +1922,7 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
 	      END { if (nonempty) { for (i in files) print i; }; }'`; \
 	mkid -fID $$unique
 tags: TAGS
@@ -1654,7 +1978,7 @@ distclean-tags:
 	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
 
 check-TESTS: $(TESTS)
-	@failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[	 ]'; \
+	@failed=0; all=0; xfail=0; xpass=0; skip=0; \
 	srcdir=$(srcdir); export srcdir; \
 	list=' $(TESTS) '; \
 	if test -n "$$list"; then \
@@ -1665,7 +1989,7 @@ check-TESTS: $(TESTS)
 	    if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
 	      all=`expr $$all + 1`; \
 	      case " $(XFAIL_TESTS) " in \
-	      *$$ws$$tst$$ws*) \
+	      *[\ \	]$$tst[\ \	]*) \
 		xpass=`expr $$xpass + 1`; \
 		failed=`expr $$failed + 1`; \
 		echo "XPASS: $$tst"; \
@@ -1677,7 +2001,7 @@ check-TESTS: $(TESTS)
 	    elif test $$? -ne 77; then \
 	      all=`expr $$all + 1`; \
 	      case " $(XFAIL_TESTS) " in \
-	      *$$ws$$tst$$ws*) \
+	      *[\ \	]$$tst[\ \	]*) \
 		xfail=`expr $$xfail + 1`; \
 		echo "XFAIL: $$tst"; \
 	      ;; \
@@ -1691,23 +2015,36 @@ check-TESTS: $(TESTS)
 	      echo "SKIP: $$tst"; \
 	    fi; \
 	  done; \
+	  if test "$$all" -eq 1; then \
+	    tests="test"; \
+	    All=""; \
+	  else \
+	    tests="tests"; \
+	    All="All "; \
+	  fi; \
 	  if test "$$failed" -eq 0; then \
 	    if test "$$xfail" -eq 0; then \
-	      banner="All $$all tests passed"; \
+	      banner="$$All$$all $$tests passed"; \
 	    else \
-	      banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+	      if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
+	      banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
 	    fi; \
 	  else \
 	    if test "$$xpass" -eq 0; then \
-	      banner="$$failed of $$all tests failed"; \
+	      banner="$$failed of $$all $$tests failed"; \
 	    else \
-	      banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+	      if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
+	      banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
 	    fi; \
 	  fi; \
 	  dashes="$$banner"; \
 	  skipped=""; \
 	  if test "$$skip" -ne 0; then \
-	    skipped="($$skip tests were not run)"; \
+	    if test "$$skip" -eq 1; then \
+	      skipped="($$skip test was not run)"; \
+	    else \
+	      skipped="($$skip tests were not run)"; \
+	    fi; \
 	    test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
 	      dashes="$$skipped"; \
 	  fi; \
@@ -1815,6 +2152,8 @@ dvi-am:
 
 html: html-recursive
 
+html-am:
+
 info: info-recursive
 
 info-am:
@@ -1823,18 +2162,28 @@ install-data-am:
 
 install-dvi: install-dvi-recursive
 
+install-dvi-am:
+
 install-exec-am:
 
 install-html: install-html-recursive
 
+install-html-am:
+
 install-info: install-info-recursive
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-recursive
 
+install-pdf-am:
+
 install-ps: install-ps-recursive
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-recursive
@@ -1874,6 +2223,17 @@ uninstall-am:
 	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
 	uninstall uninstall-am
 
+
+#  test_integer_tools_SOURCES =          \
+#  test-integer-tools.C
+
+fullcheck: checker
+	./checker
+
+checker: checker.C
+
+#  %:%.C
+#  $(CXX) $(OPTFLAGS) $(AM_CPPFLAGS) $(AM_CXXFLAGS) $*.C -o $*  `$(GIVARO_BIN)/givaro-config --cflags` `$(FFLAFLAS_BIN)/fflasffpack-config --cflags`  $(LDADD)  `$(GIVARO_BIN)/givaro-config --libs` `$(FFLAFLAS_BIN)/ffasffpack-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/benchmark-blas-domain.C b/tests/benchmark-blas-domain.C
index 7dc6636..13b608e 100644
--- a/tests/benchmark-blas-domain.C
+++ b/tests/benchmark-blas-domain.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-blas-domain.C
  * Copyright (C) 2004 Pascal Giorgi
@@ -11,6 +12,13 @@
  *
  *
  */
+
+/*! @file  tests/benchmark-blas-domain.C
+ * @ingroup tests
+ * @brief no doc.
+ */
+
+
  // where is this used?
 #define __MINP_CONSTRUCT
 #include "linbox/linbox-config.h"
@@ -36,7 +44,8 @@ const int maxpretty = 35;
 
 string blank;
 
-const char* pretty(string a) {
+const char* pretty(string a)
+{
 
 	blank = "     " + a;
 	int msgsize= maxpretty - blank.size();
@@ -49,7 +58,8 @@ const char* pretty(string a) {
 #define mycommentator commentator
 
 template <class Field>
-static bool testMulAdd (const Field& F, size_t n, int iterations) {
+static bool testMulAdd (const Field& F, size_t n, int iterations)
+{
 
 	typedef typename Field::Element     Element;
 	typedef typename Field::RandIter   RandIter;
@@ -59,21 +69,21 @@ static bool testMulAdd (const Field& F, size_t n, int iterations) {
 	//mycommentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
 	//mycommentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
 	mycommentator.start (pretty("Testing muladd"),"testMulAdd",iterations);
-	
+
 	RandIter G(F);
 	bool ret = true;
 	BlasMatrixDomain<Field> BMD(F);
 	MatrixDomain<Field>      MD(F);
 	VectorDomain<Field>      VD(F);
-	
+
 	for (int k=0;k<iterations; ++k) {
-    
+
 		mycommentator.progress(k);
 		Matrix A(n,n),B(n,n),C(n,n),D(n,n),T(n,n),R(n,n);
 		std::vector<Element> x(n),y(n),z(n),t(n);
 
 		Element alpha, beta,malpha,tmp;
-		
+
 
 		// Create 3 random n*n matrices
 		for (size_t i=0;i<n;++i)
@@ -87,23 +97,23 @@ static bool testMulAdd (const Field& F, size_t n, int iterations) {
 		for (size_t i=0;i<n;++i) {
 			G.random(x[i]);
 			G.random(y[i]);
-		}			
+		}
 
 		// create 2 random element
 		G.random(alpha);
 		G.random(beta);
-	
+
 		F.neg(malpha,alpha);
 
 		// compute D = -alpha.(A*C+B*C) + alpha.(A+B)*C
-		
+
 		BMD.mul(D,A,C);
 		BMD.mul(T,B,C);
 		MD.addin(D,T);
-		
+
 		MD.add(T,A,B);
 		BMD.muladd(R,malpha,D,alpha,T,C);
-		
+
 		if (!MD.isZero(R))
 			ret=false;
 
@@ -120,20 +130,19 @@ static bool testMulAdd (const Field& F, size_t n, int iterations) {
 		if (!VD.areEqual(t,z))
 			ret=false;
 	}
-	
+
 	mycommentator.stop(MSG_STATUS (ret), (const char *) 0, "testMulAdd");
-	
+
 	return ret;
 }
 
-
-
 /*
  *  Testing the rank of dense matrices using BlasDomain
  *  construct a n*n matrices of rank r and compute the rank
  */
 template <class Field>
-static bool testRank (const Field& F,size_t n, int iterations) {
+static bool testRank (const Field& F,size_t n, int iterations)
+{
 
 	typedef typename Field::Element Element;
 	typedef typename Field::RandIter RandIter;
@@ -144,64 +153,64 @@ static bool testRank (const Field& F,size_t n, int iterations) {
 	mycommentator.start (pretty("Testing rank"),"testRank",iterations);
 
 	RandIter G(F);
-	NonzeroRandIter<Field> Gn(F,G); 
+	NonzeroRandIter<Field> Gn(F,G);
 	Element tmp;
 	unsigned int r;
 	bool ret = true;
 	BlasMatrixDomain<Field> BMD(F);
 
 	for (int k=0;k<iterations; ++k) {
-    
+
 		mycommentator.progress(k);
 		BlasMatrix<Element> A(n,n),S(n,n), L(n,n);
-     
+
 		r = rand() % n;
 		// create S as an upper triangular matrix with r nonzero rows
 		for (size_t i=0;i<r;++i){
 			S.setEntry(i,i,Gn.random(tmp));
-			for (size_t j=i+1;j<n;++j)     
+			for (size_t j=i+1;j<n;++j)
 				S.setEntry(i,j,G.random(tmp));
 		}
-     
+
 		// create L as a lower triangular matrix with nonzero elements on the diagonal
 		for (size_t i=0;i<n;++i){
 			for (size_t j=0;j<i;++j)
 				L.setEntry(i,j,G.random(tmp));
 			L.setEntry(i,i,Gn.random(tmp));
 		}
-     
+
 		//  compute A=LS
 		BMD.mul(A,L,S);
-     
+
 		// compute the rank of A
 		unsigned int rank= BMD.rankin(A);
 		if (rank!=r)
 			ret=false;
 	}
-  	
+
 	mycommentator.stop(MSG_STATUS (ret), (const char *) 0, "testRank");
-    
+
 	return ret;
 }
 
-
 /*
  *  Testing the determinant of dense matrices using BlasDomain
  *  construct a n*n matrices of determinant d and compute the determinant
  */
 template <class Field>
-static bool testDet (const Field& F,size_t n, int iterations) {
+static bool testDet (const Field& F,size_t n, int iterations)
+{
 
 	typedef typename Field::Element Element;
 	typedef typename Field::RandIter RandIter;
-  
+
 	//Commentator mycommentator (std::cout);
 	//mycommentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
 	//mycommentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
 	mycommentator.start (pretty("Testing determinant"),"testDet",iterations);
 
 	RandIter G(F);
-	NonzeroRandIter<Field> Gn(F,G); 
+	NonzeroRandIter<Field> Gn(F,G);
 	Element tmp,One,d;
 	F.init(One,1UL);
 
@@ -209,22 +218,22 @@ static bool testDet (const Field& F,size_t n, int iterations) {
 	BlasMatrixDomain<Field> BMD(F);
 
 	for (int k=0;k<iterations;++k) {
-		
+
 		mycommentator.progress(k);
 
 		G.random(d);
 
 		BlasMatrix<Element> A(n,n),S(n,n), L(n,n);
 
-		// create S as an upper triangular matrix of full rank 
+		// create S as an upper triangular matrix of full rank
 		// with diagonal's element equal to 1 except the first entry wich equals to d
 		for (size_t i=0;i<n;++i){
 			S.setEntry(i,i,One);
-			for (size_t j=i+1;j<n;++j)      
+			for (size_t j=i+1;j<n;++j)
 				S.setEntry(i,j,G.random(tmp));
 		}
 		S.setEntry(0,0,d);
-    
+
 		// create L as a lower triangular matrix with only 1's on diagonal
 		for (size_t i=0;i<n;++i){
 			for (size_t j=0;j<i;++j)
@@ -232,40 +241,41 @@ static bool testDet (const Field& F,size_t n, int iterations) {
 			L.setEntry(i,i,One);
 		}
 
-    
+
 		//  compute A=LS
 		BMD.mul(A,L,S);
-    
+
 		// compute the determinant of A
 		Element det= BMD.detin(A);
 
 		if (!F.areEqual(det,d))
 			ret=false;
 	}
-  
+
 	mycommentator.stop(MSG_STATUS (ret), (const char *) 0, "testDet");
-    
+
 	return ret;
 }
 
 /*
  *  Testing the inverse of dense matrices using BlasDomain
- *  construct a non-singular n*n matrices 
+ *  construct a non-singular n*n matrices
  */
 template <class Field>
-static bool testInv (const Field& F,size_t n, int iterations) {
+static bool testInv (const Field& F,size_t n, int iterations)
+{
 
 	typedef typename Field::Element Element;
 	typedef typename Field::RandIter RandIter;
 	typedef  BlasMatrix<Element> Matrix;
-  
+
 	//Commentator mycommentator (std::cout);
 	//mycommentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
 	//mycommentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
 	mycommentator.start (pretty("Testing inverse"),"testInv",iterations);
 
 	RandIter G(F);
-	NonzeroRandIter<Field> Gn(F,G); 
+	NonzeroRandIter<Field> Gn(F,G);
 	Element One,tmp;
 	F.init(One,1UL);
 
@@ -276,55 +286,55 @@ static bool testInv (const Field& F,size_t n, int iterations) {
 	Matrix Id(n,n);
 	for (size_t i=0;i<n;++i)
 		Id.setEntry(i,i,One);
-  
+
 	for (int k=0;k<iterations;++k) {
-    
+
 		mycommentator.progress(k);
-   
+
 
 		Matrix A(n,n),S(n,n), L(n,n), invA(n,n);
 
-		// create S as an upper triangular matrix of full rank 
-		// with nonzero random diagonal's element 
+		// create S as an upper triangular matrix of full rank
+		// with nonzero random diagonal's element
 		for (size_t i=0;i<n;++i){
 			S.setEntry(i,i,Gn.random(tmp));
-			for (size_t j=i+1;j<n;++j)      
+			for (size_t j=i+1;j<n;++j)
 				S.setEntry(i,j,G.random(tmp));
 		}
-     
-		// create L as a lower triangular matrix 
-		// with only 1's on diagonal 
+
+		// create L as a lower triangular matrix
+		// with only 1's on diagonal
 		for (size_t i=0;i<n;++i){
 			for (size_t j=0;j<i;++j)
 				L.setEntry(i,j,G.random(tmp));
 			L.setEntry(i,i,One);
 		}
-        
+
 		//  compute A=LS
 		BMD.mul(A,L,S);
-      
+
 		// compute the inverse of A
 		BMD.inv(invA,A);
-        
+
 		// compute Ainv*A and A*Ainv
 		BMD.mul(L,invA,A);
 		BMD.mul(S,A,invA);
-   
+
 		if (!MD.areEqual(L,Id) || !MD.areEqual(S,Id))
 			ret=false;
 	}
-  
+
 	mycommentator.stop(MSG_STATUS (ret), (const char *) 0, "testInv");
-    
+
 	return ret;
 }
 
-
 /*
- * Test resolution of linear system with a triangular matrix 
+ * Test resolution of linear system with a triangular matrix
  */
 template <class Field>
-static bool testTriangularSolve (const Field& F, size_t m, size_t n, int iterations) {
+static bool testTriangularSolve (const Field& F, size_t m, size_t n, int iterations)
+{
 
 	typedef typename Field::Element                  Element;
 	typedef BlasMatrix<Element>                       Matrix;
@@ -337,21 +347,21 @@ static bool testTriangularSolve (const Field& F, size_t m, size_t n, int iterati
 	mycommentator.start (pretty("Testing triangular solver"),"testTriangularSolve",iterations);
 
 	RandIter G(F);
-	NonzeroRandIter<Field> Gn(F,G); 
+	NonzeroRandIter<Field> Gn(F,G);
 	Element One,tmp;
 	F.init(One,1UL);
-  
+
 	bool ret = true;
 	MatrixDomain<Field> MD(F);
 	VectorDomain<Field>  VD(F);
 	BlasMatrixDomain<Field> BMD(F);
 
 	for (int k=0;k<iterations;++k) {
-    
-		mycommentator.progress(k);    
-    
+
+		mycommentator.progress(k);
+
 		Matrix Al(m,m),Au(m,m);
-		Matrix X(m,n), B(m,n), C(m,n);  
+		Matrix X(m,n), B(m,n), C(m,n);
 
 		std::vector<Element> b(m),x(m),c(m);
 
@@ -363,7 +373,7 @@ static bool testTriangularSolve (const Field& F, size_t m, size_t n, int iterati
 		//create random vector b
 		for( size_t i=0;i<m;++i)
 			F.init(b[i],G.random(tmp));
-    
+
 		// Create Au a random full rank upper triangular matrix
 		for (size_t i=0;i<m;++i){
 			Au.setEntry(i,i,Gn.random(tmp));
@@ -372,72 +382,73 @@ static bool testTriangularSolve (const Field& F, size_t m, size_t n, int iterati
 		}
 
 		// Create Al a random full rank lower triangular matrix
-		for (size_t i=0;i<m;++i){      
+		for (size_t i=0;i<m;++i){
 			for (size_t j=0;j<i;++j)
 				Al.setEntry(i,j,G.random(tmp));
-			Al.setEntry(i,i,Gn.random(tmp));	  
+			Al.setEntry(i,i,Gn.random(tmp));
 		}
 
 		// Create 2 trinagular matrix as view of matrix
 		TriangularMatrix TAl(Al,BlasTag::low,BlasTag::nonunit), TAu(Au,BlasTag::up,BlasTag::nonunit);
-    
+
 		// testing solver with matrix right hand side
-		BMD.left_solve(X,TAl,B);    
-		BMD.mul(C,Al,X);          
+		BMD.left_solve(X,TAl,B);
+		BMD.mul(C,Al,X);
 		if (!MD.areEqual(C,B))
 			ret=false;
-        
+
 		BMD.left_solve(X,TAu,B);
-		BMD.mul(C,Au,X);   
+		BMD.mul(C,Au,X);
 		if (!MD.areEqual(C,B))
 			ret=false;
-        
+
 		// testing solver with matrix left hand side
 		BMD.right_solve(X,TAl,B);
-		BMD.mul(C,X,Al);    
+		BMD.mul(C,X,Al);
 		if (!MD.areEqual(C,B))
 			ret=false;
-        
+
 		BMD.right_solve(X,TAu,B);
-		BMD.mul(C,X,Au);    
+		BMD.mul(C,X,Au);
 		if (!MD.areEqual(C,B))
 			ret=false;
-       
+
 
 		// testing solver with vector right hand side
-		BMD.left_solve(x,TAl,b);    
-		BMD.mul(c,Al,x);          
+		BMD.left_solve(x,TAl,b);
+		BMD.mul(c,Al,x);
 		if (!VD.areEqual(c,b))
 			ret=false;
-        
+
 		BMD.left_solve(x,TAu,b);
-		BMD.mul(c,Au,x);   
+		BMD.mul(c,Au,x);
 		if (!VD.areEqual(c,b))
 			ret=false;
-        
+
 		// testing solver with vector left hand side
 		BMD.right_solve(x,TAl,b);
-		BMD.mul(c,x,Al);    
+		BMD.mul(c,x,Al);
 		if (!VD.areEqual(c,b))
 			ret=false;
-        
+
 		BMD.right_solve(x,TAu,b);
-		BMD.mul(c,x,Au);    
+		BMD.mul(c,x,Au);
 		if (!VD.areEqual(c,b))
 			ret=false;
 
 	}
 
 	mycommentator.stop(MSG_STATUS (ret), (const char *) 0, "testTriangularSolve");
-    
+
 	return ret;
 }
 
 /*
- * Test resolution of linear system with a matrix 
+ * Test resolution of linear system with a matrix
  */
 template <class Field>
-static bool testSolve (const Field& F, size_t m, size_t n, int iterations) {
+static bool testSolve (const Field& F, size_t m, size_t n, int iterations)
+{
 
 	typedef typename Field::Element                  Element;
 	typedef BlasMatrix<Element>                       Matrix;
@@ -449,21 +460,21 @@ static bool testSolve (const Field& F, size_t m, size_t n, int iterations) {
 	mycommentator.start (pretty("Testing solver"),"testSolve",iterations);
 
 	RandIter G(F);
-	NonzeroRandIter<Field> Gn(F,G); 
+	NonzeroRandIter<Field> Gn(F,G);
 	Element One,tmp;
 	F.init(One,1UL);
-  
+
 	bool ret = true;
 	MatrixDomain<Field> MD(F);
 	VectorDomain<Field>  VD(F);
 	BlasMatrixDomain<Field> BMD(F);
 
 	for (int k=0;k<iterations;++k) {
-    
-		mycommentator.progress(k);    
-    
+
+		mycommentator.progress(k);
+
 		Matrix A(m,m),L(m,m),S(m,m);
-		Matrix X(m,n), B(m,n), C(m,n);  
+		Matrix X(m,n), B(m,n), C(m,n);
 
 		std::vector<Element> b(m),x(m),c(m);
 
@@ -475,86 +486,86 @@ static bool testSolve (const Field& F, size_t m, size_t n, int iterations) {
 		//create a random vector b
 		for( size_t i=0;i<m;++i)
 			F.init(b[i],G.random(tmp));
-    
-   
-		// create S as an upper triangular matrix of full rank 
-		// with nonzero random diagonal's element 
+
+
+		// create S as an upper triangular matrix of full rank
+		// with nonzero random diagonal's element
 		for (size_t i=0;i<m;++i){
 			S.setEntry(i,i,Gn.random(tmp));
-			for (size_t j=i+1;j<n;++j)      
+			for (size_t j=i+1;j<n;++j)
 				S.setEntry(i,j,G.random(tmp));
 		}
-    
-		// create L as a lower triangular matrix 
-		// with only 1's on diagonal 
+
+		// create L as a lower triangular matrix
+		// with only 1's on diagonal
 		for (size_t i=0;i<m;++i){
 			for (size_t j=0;j<i;++j)
 				L.setEntry(i,j,G.random(tmp));
 			L.setEntry(i,i,One);
 		}
-        
+
 		//  compute A=LS
 		BMD.mul(A,L,S);
 
 
 		// testing solver with matrix right hand side
-		BMD.left_solve(X,A,B);    
-		BMD.mul(C,A,X);          
+		BMD.left_solve(X,A,B);
+		BMD.mul(C,A,X);
 		if (!MD.areEqual(C,B))
 			ret=false;
-        
+
 		BMD.left_solve(X,A,B);
-		BMD.mul(C,A,X);   
+		BMD.mul(C,A,X);
 		if (!MD.areEqual(C,B))
 			ret=false;
-        
+
 		// testing solver with matrix left hand side
 		BMD.right_solve(X,A,B);
-		BMD.mul(C,X,A);    
+		BMD.mul(C,X,A);
 		if (!MD.areEqual(C,B))
 			ret=false;
-        
+
 		BMD.right_solve(X,A,B);
-		BMD.mul(C,X,A);    
+		BMD.mul(C,X,A);
 		if (!MD.areEqual(C,B))
 			ret=false;
-       
+
 
 		// testing solver with vector right hand side
-		BMD.left_solve(x,A,b);    
-		BMD.mul(c,A,x);          
+		BMD.left_solve(x,A,b);
+		BMD.mul(c,A,x);
 		if (!VD.areEqual(c,b))
 			ret=false;
-        
+
 		BMD.left_solve(x,A,b);
-		BMD.mul(c,A,x);   
+		BMD.mul(c,A,x);
 		if (!VD.areEqual(c,b))
 			ret=false;
-        
+
 		// testing solver with vector left hand side
 		BMD.right_solve(x,A,b);
-		BMD.mul(c,x,A);    
+		BMD.mul(c,x,A);
 		if (!VD.areEqual(c,b))
 			ret=false;
-        
+
 		BMD.right_solve(x,A,b);
-		BMD.mul(c,x,A);    
+		BMD.mul(c,x,A);
 		if (!VD.areEqual(c,b))
 			ret=false;
 
 	}
 
 	mycommentator.stop(MSG_STATUS (ret), (const char *) 0, "testSolve");
-    
+
 	return ret;
 }
 
 /*
  * Test of the BlasPermutations
  */
-
 template <class Field>
-static bool testPermutation (const Field& F, size_t m, int iterations) {
+static bool testPermutation (const Field& F, size_t m, int iterations)
+{
 
 	typedef typename Field::Element                  Element;
 	typedef BlasMatrix<Element>                       Matrix;
@@ -566,20 +577,20 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 	mycommentator.start (pretty("Testing permutations"),"testPermutation",iterations);
 
 	RandIter G(F);
-	NonzeroRandIter<Field> Gn(F,G); 
+	NonzeroRandIter<Field> Gn(F,G);
 	Element One,zero,tmp,tmp2;
 	F.init(One,1UL);
 	F.init(zero,0UL);
-  
+
 	bool ret = true;
 	MatrixDomain<Field> MD(F);
 	VectorDomain<Field>  VD(F);
 	BlasMatrixDomain<Field> BMD(F);
 
 	for (int k=0;k<iterations;++k) {
-    
-		mycommentator.progress(k);    
-    
+
+		mycommentator.progress(k);
+
 		std::vector<size_t> P(m);
 
 		Field Z2(2);
@@ -588,16 +599,16 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		for (size_t i=0; i<m; ++i){
 			G.random(tmp);
 			if ( Z2.isZero(G2.random(tmp2) ) )
-				P[i] = i + ( (size_t) tmp % (m-i) ); 
-			else				
+				P[i] = i + ( (size_t) tmp % (m-i) );
+			else
 				P[i] = i;
 		}
-		
+
 		//std::cerr<<P<<std::endl;
 		Matrix A(m,m), Abis(m,m), B(m,m), C(m,m), D(m,m);
 		std::vector<Element> a(m),abis(m),b(m),c(m), d(m);
-		BlasPermutation Perm(P);
-		
+		BlasPermutation<size_t> Perm(P);
+
 		// Create A a random matrix
 		for (size_t i=0;i<m;++i)
 			for (size_t j=0;j<m;++j)
@@ -609,21 +620,21 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		/*
 		 * Test A.P.P^t == A
 		 */
-		
+
 		// B = A.P
 		BMD.mul( B, A, Perm);
-		// C = B.P^t 
-		BMD.mul( C, B, TransposedBlasMatrix<BlasPermutation>(Perm) );
+		// C = B.P^t
+		BMD.mul( C, B, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm) );
 		// Test C==A
 		if (!MD.areEqual(A,C))
 			ret=false;
 		/*
 		 * Test A.P^t.P == A
 		 */
-		
+
 		// B = A.P^t
-		BMD.mul( B, A, TransposedBlasMatrix<BlasPermutation>(Perm));
-		// C = B.P 
+		BMD.mul( B, A, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm));
+		// C = B.P
 		BMD.mul( C, B, Perm );
 		// Test C==A
 		if (!MD.areEqual(A,C))
@@ -631,21 +642,21 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		/*
 		 * Test P.P^t.A == A
 		 */
-		
+
 		// B = P.A
 		BMD.mul( B, Perm, A);
-		// C = P^t.B 
-		BMD.mul( C, TransposedBlasMatrix<BlasPermutation>(Perm) , B);
+		// C = P^t.B
+		BMD.mul( C, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm) , B);
 		// Test C==A
 		if (!MD.areEqual(A,C))
 			ret=false;
 		/*
 		 * Test P^t.P.A == A
 		 */
-		
+
 		// B = P^t.A
-		BMD.mul( B, TransposedBlasMatrix<BlasPermutation>(Perm), A);
-		// C = P.B 
+		BMD.mul( B, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm), A);
+		// C = P.B
 		BMD.mul( C, Perm, B);
 		// Test C==A
 		if (!MD.areEqual(A,C))
@@ -654,11 +665,11 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		/*
 		 * Test a.P.P^t == a
 		 */
-		
+
 		// b = a.P
 		BMD.mul( b, a, Perm);
-		// c = b.P^t 
-		BMD.mul( c, b, TransposedBlasMatrix<BlasPermutation>(Perm) );
+		// c = b.P^t
+		BMD.mul( c, b, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm) );
 		// Test c==a
 		if (!VD.areEqual(a,c))
 			ret=false;
@@ -666,10 +677,10 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		/*
 		 * Test a.P^t.P == a
 		 */
-		
+
 		// b = a.P^t
-		BMD.mul( b, a, TransposedBlasMatrix<BlasPermutation>(Perm));
-		// c = B.P 
+		BMD.mul( b, a, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm));
+		// c = B.P
 		BMD.mul( c, b, Perm );
 		// Test c==a
 		if (!VD.areEqual(a,c))
@@ -677,11 +688,11 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		/*
 		 * Test P.P^t.a == a
 		 */
-		
+
 		// b = P.a
 		BMD.mul( b, Perm, a);
-		// c = P^t.b 
-		BMD.mul( c, TransposedBlasMatrix<BlasPermutation>(Perm) , b);
+		// c = P^t.b
+		BMD.mul( c, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm) , b);
 		// Test c==a
 		if (!VD.areEqual(a,c))
 			ret=false;
@@ -689,10 +700,10 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		/*
 		 * Test P^t.P.a == a
 		 */
-		
+
 		// b = P^t.a
-		BMD.mul( b, TransposedBlasMatrix<BlasPermutation>(Perm), a);
-		// c = P.b 
+		BMD.mul( b, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm), a);
+		// c = P.b
 		BMD.mul( c, Perm, b);
 		// Test c==a
 		if (!VD.areEqual(a,c))
@@ -706,7 +717,7 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		for (size_t i=0;i<m;++i)
 			for (size_t j=0;j<m;++j)
 				B.setEntry(i,j,G.random(tmp));
-		
+
 		// Abis = P.A
 		BMD.mul( Abis, Perm, A);
 		// C = (P.A)^-1.B
@@ -724,7 +735,7 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		for (size_t i=0;i<m;++i)
 			for (size_t j=0;j<m;++j)
 				B.setEntry(i,j,G.random(tmp));
-		
+
 		// Abis = A.P
 		BMD.mul( Abis, A, Perm);
 		// C = (A.P)^-1.B
@@ -743,7 +754,7 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		for (size_t i=0;i<m;++i)
 			for (size_t j=0;j<m;++j)
 				B.setEntry(i,j,G.random(tmp));
-		
+
 		// Abis = P.A
 		BMD.mul( Abis, Perm, A);
 		// C = B.(P.A)^-1
@@ -754,7 +765,7 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		BMD.mul(D, C, A);
 		if (!MD.areEqual(D,B))
 		  ret=false;
-		
+
 		/*
 		 * Test B.A.P^t.(A.P)^-1 == B
 		 */
@@ -762,7 +773,7 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		for (size_t i=0;i<m;++i)
 			for (size_t j=0;j<m;++j)
 				B.setEntry(i,j,G.random(tmp));
-		
+
 		// Abis = A.P
 		BMD.mul( Abis, A, Perm);
 		// C = B.(A.P)^-1
@@ -771,7 +782,7 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		BMD.mul(D, C, A);
 		// C = C.P
 		BMD.mulin_left( D, Perm);
-			
+
 		if (!MD.areEqual(D,B))
 			ret=false;
 		/*
@@ -781,15 +792,15 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		for (size_t i=0;i<m;++i)
 			for (size_t j=0;j<m;++j)
 				B.setEntry(i,j,G.random(tmp));
-		
+
 		// Abis = P^t.A
-		BMD.mul( Abis, TransposedBlasMatrix<BlasPermutation>(Perm), A);
+		BMD.mul( Abis, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm), A);
 		// C = (P^t.A)^-1.B
 		BMD.left_solve( C, Abis, B);
 		// D = A.C (= P.B)
 		BMD.mul(D, A, C);
 		// D = P^t.D
-		BMD.mulin_right( TransposedBlasMatrix<BlasPermutation>(Perm),D);
+		BMD.mulin_right( TransposedBlasMatrix<BlasPermutation<size_t> >(Perm),D);
 		if (!MD.areEqual(D,B))
 			ret=false;
 		/*
@@ -799,13 +810,13 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		for (size_t i=0;i<m;++i)
 			for (size_t j=0;j<m;++j)
 				B.setEntry(i,j,G.random(tmp));
-		
+
 		// Abis = A.P^t
-		BMD.mul( Abis, A, TransposedBlasMatrix<BlasPermutation>(Perm));
+		BMD.mul( Abis, A, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm));
 		// C = (A.P^t)^-1.B
 		BMD.left_solve( C, Abis, B);
 		// C = P^t.C
-		BMD.mulin_right( TransposedBlasMatrix<BlasPermutation>(Perm),C);
+		BMD.mulin_right( TransposedBlasMatrix<BlasPermutation<size_t> >(Perm),C);
 		// D = A.C (= P.B)
 		BMD.mul(D, A, C);
 
@@ -818,18 +829,18 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		for (size_t i=0;i<m;++i)
 			for (size_t j=0;j<m;++j)
 				B.setEntry(i,j,G.random(tmp));
-		
+
 		// Abis = P^t.A
-		BMD.mul( Abis, TransposedBlasMatrix<BlasPermutation>(Perm), A);
+		BMD.mul( Abis, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm), A);
 		// C = B.(P^t.A)^-1
 		BMD.right_solve( C, Abis, B);
 		// C = C.P^t
-		BMD.mulin_left( C,TransposedBlasMatrix<BlasPermutation>(Perm));
+		BMD.mulin_left( C,TransposedBlasMatrix<BlasPermutation<size_t> >(Perm));
 		// D = C.A (=B)
 		BMD.mul(D, C, A);
 		if (!MD.areEqual(D,B))
 		  ret=false;
-		
+
 		/*
 		 * Test B.A.P.(A.P^t)^-1 == B
 		 */
@@ -837,21 +848,21 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		for (size_t i=0;i<m;++i)
 			for (size_t j=0;j<m;++j)
 				B.setEntry(i,j,G.random(tmp));
-		
+
 		// Abis = A.P^t
-		BMD.mul( Abis, A, TransposedBlasMatrix<BlasPermutation>(Perm));
+		BMD.mul( Abis, A, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm));
 		// C = B.(A.P^t)^-1
 		BMD.right_solve( C, Abis, B);
 		// D = C.A (= B.P)
 		BMD.mul(D, C, A);
 		// C = C.P^t
-		BMD.mulin_left( D, TransposedBlasMatrix<BlasPermutation>(Perm));
-			
+		BMD.mulin_left( D, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm));
+
 		if (!MD.areEqual(D,B))
 			ret=false;
 	}
 	mycommentator.stop(MSG_STATUS (ret), (const char *) 0, "testPermutation");
-	
+
 	return ret;
 }
 
@@ -859,7 +870,8 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
  * Test of the LQUPMatrix class
  */
 template <class Field>
-static bool testLQUP (const Field& F, size_t m, size_t n, int iterations) {
+static bool testLQUP (const Field& F, size_t m, size_t n, int iterations)
+{
 
 	typedef typename Field::Element                  Element;
 	typedef BlasMatrix<Element>                       Matrix;
@@ -871,21 +883,21 @@ static bool testLQUP (const Field& F, size_t m, size_t n, int iterations) {
 	mycommentator.start (pretty("Testing LQUP factorization"),"testLQUP",iterations);
 
 	RandIter G(F);
-	NonzeroRandIter<Field> Gn(F,G); 
+	NonzeroRandIter<Field> Gn(F,G);
 	Element One,zero,tmp;
 	F.init(One,1UL);
 	F.init(zero,0UL);
-  
+
 	bool ret = true;
 	MatrixDomain<Field> MD(F);
 	BlasMatrixDomain<Field> BMD(F);
 
 	for (int k=0;k<iterations;++k) {
-    
-		mycommentator.progress(k);    
-    
+
+		mycommentator.progress(k);
+
 		Matrix A(m,n), Abis(m,n), B(m,m), C(m,n);
-		
+
 
 		// Create B a random matrix of rank n/2
 		for (size_t j=0;j<m;++j)
@@ -903,41 +915,41 @@ static bool testLQUP (const Field& F, size_t m, size_t n, int iterations) {
 			else
 				for (size_t j=0;j<n;++j)
 					C.setEntry(i,j,zero);
-		
+
 		// A = B*C
 		BMD.mul(A, B, C);
-		
+
 		Abis = A;
 
-		LQUPMatrix<Field> X(F,A);
-		
+		BlasPermutation<size_t>  P(A.coldim()),Q(A.rowdim());
+		LQUPMatrix<Field> X(F,A,P,Q);
+
 		TriangularBlasMatrix<Element> L(m,m,BlasTag::low,BlasTag::unit);
 		TriangularBlasMatrix<Element> U(m,n,BlasTag::up,BlasTag::nonunit);
 		X.getL(L);
 		X.getU(U);
-		BlasPermutation P,Q;
 		P=X.getP();
 
 		Q=X.getQ();
-		
+
 		// C = U*P
 		BMD.mul( C, U, P);
 		// C = Q*C
 		BMD.mulin_right( Q, C);
 		// A = L*C
 		BMD.mul( A, L, C);
-		
+
 		if (!MD.areEqual(A,Abis))
 			ret=false;
 
 		// Second pass
 		// A = B*C
 		BMD.mul(A, B, C);
-		
+
 		Abis = A;
 
-		LQUPMatrix<Field> Y(F,A);
-		
+		LQUPMatrix<Field> Y(F,A,P,Q);
+
 		TriangularBlasMatrix<Element> L2(m,m,BlasTag::low,BlasTag::unit);
 		TriangularBlasMatrix<Element> U2(m,n,BlasTag::up,BlasTag::nonunit);
 		Y.getL(L2);
@@ -945,25 +957,26 @@ static bool testLQUP (const Field& F, size_t m, size_t n, int iterations) {
 		P=Y.getP();
 
 		Q=Y.getQ();
-		
+
 		// C = Q*U2
 		BMD.mul( C,Q,U2);
 		// C = Q*C
 		BMD.mulin_left(  C,P);
 		// A = L*C
 		BMD.mul( A, L2, C);
-		
+
 		if (!MD.areEqual(A,Abis))
 			ret=false;
 	}
 
 	mycommentator.stop(MSG_STATUS (ret), (const char *) 0, "testLQUP");
-    
+
 	return ret;
 }
 
 template <class Field>
-static bool testMinPoly (const Field& F, size_t n, int iterations) {
+static bool testMinPoly (const Field& F, size_t n, int iterations)
+{
 	typedef typename Field::Element                  Element;
 	typedef BlasMatrix<Element>                       Matrix;
 	typedef typename Field::RandIter                RandIter;
@@ -975,26 +988,26 @@ static bool testMinPoly (const Field& F, size_t n, int iterations) {
 	mycommentator.start (pretty("Testing minpoly"),"testMinPoly",iterations);
 	Element tmp, one, zero,mone;
 	RandIter G(F);
-	NonzeroRandIter<Field> Gn(F,G); 
+	NonzeroRandIter<Field> Gn(F,G);
 	F.init(one, 1UL);
 	F.init(zero, 0UL);
 	F.neg(mone, one);
 	//F.neg( mone, one);
 	bool ret = true;
 	BlasMatrixDomain<Field> BMD(F);
-		
+
 	for (int k=0;k<iterations;++k) {
-    
-		mycommentator.progress(k);    
+
+		mycommentator.progress(k);
 
 		Matrix A(n,n);
 		Polynomial P;
 		// Test MinPoly(In) = X-1
 		for (size_t i=0;i<n;++i)
 			A.setEntry(i,i,one);
-		
+
 		BMD.minpoly( P, A );
-		
+
 		if ( P.size() !=2 )
 			ret = false;
 		if ( !F.areEqual(P[0], mone) )
@@ -1004,7 +1017,7 @@ static bool testMinPoly (const Field& F, size_t n, int iterations) {
 
 		// Test MinPoly(a*In) = X-a
 		G.random(tmp);
-		
+
 		for (size_t i=0;i<n;++i)
 			A.setEntry(i,i,tmp);
 		F.negin(tmp);
@@ -1026,7 +1039,7 @@ static bool testMinPoly (const Field& F, size_t n, int iterations) {
 		}
 		for (size_t j=0;j<n;++j)
 			A.setEntry(n-1,j,zero);
-		
+
 		BMD.minpoly( P, A );
 		if ( P.size() !=n+1 )
 			ret = false;
@@ -1039,12 +1052,13 @@ static bool testMinPoly (const Field& F, size_t n, int iterations) {
 	}
 
 	mycommentator.stop(MSG_STATUS (ret), (const char *) 0, "testMinPoly");
-	
+
 	return ret;
 }
 
 template <class Field>
-static bool testCharPoly (const Field& F, size_t n, int iterations) {
+static bool testCharPoly (const Field& F, size_t n, int iterations)
+{
 	typedef typename Field::Element                  Element;
 	typedef BlasMatrix<Element>                       Matrix;
 	typedef typename Field::RandIter                RandIter;
@@ -1055,17 +1069,17 @@ static bool testCharPoly (const Field& F, size_t n, int iterations) {
 	mycommentator.start (pretty("Testing charpoly"),"testCharPoly",iterations);
 	Element tmp, one, zero,mone;
 	RandIter G(F);
-	NonzeroRandIter<Field> Gn(F,G); 
+	NonzeroRandIter<Field> Gn(F,G);
 	F.init(one, 1UL);
 	F.init(zero, 0UL);
 	F.neg(mone, one);
 	//F.neg( mone, one);
 	bool ret = true;
 	BlasMatrixDomain<Field> BMD(F);
-	
+
 	for (int k=0;k<iterations;++k) {
-    
-		mycommentator.progress(k);    
+
+		mycommentator.progress(k);
 
 		Matrix A(n,n);
 		list<Polynomial> P;
@@ -1088,13 +1102,13 @@ static bool testCharPoly (const Field& F, size_t n, int iterations) {
 				ret = false;
 			if ( !F.areEqual(P_it->operator[](1), one) )
 				ret = false;
-			
+
 			P_it++;
 		}
-		
+
 		// Test CharPoly(a*In) = X-a
 		G.random(tmp);
-		
+
 		for (size_t i=0;i<n;++i)
 			A.setEntry(i,i,tmp);
 		F.negin(tmp);
@@ -1113,20 +1127,13 @@ static bool testCharPoly (const Field& F, size_t n, int iterations) {
 	}
 
 	mycommentator.stop(MSG_STATUS (ret), (const char *) 0, "testCharPoly");
-	
+
 	return ret;
 }
 
-template<class T, template <class T> class Container>
-std::ostream& operator<< (std::ostream& o, const Container<T>& C) {
-	for(typename Container<T>::const_iterator refs =  C.begin();
-	    refs != C.end() ;
-	    ++refs )
-		o << (*refs) << " " ;
-	return o << std::endl;
-}
 
-int main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
 	commentator.setBriefReportStream (cout);
 	commentator.getMessageClass (BRIEF_REPORT).setMaxDepth (2);
 	commentator.getMessageClass (BRIEF_REPORT).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
@@ -1134,12 +1141,12 @@ int main(int argc, char **argv) {
 	static size_t n = 400;
 	static integer q = 1000003U;
 	static int iterations = 3;
-	
+
     static Argument args[] = {
         { 'n', "-n N", "Set dimension of test matrices to NxN", TYPE_INT,     &n },
         { 'q', "-q Q", "Operate over the \"field\" GF(Q) [1]", TYPE_INTEGER, &q },
         { 'i', "-i I", "Perform each test for I iterations",    TYPE_INT,     &iterations },
-		{ '\0' }
+	END_OF_ARGUMENTS
     };
 
 	parseArguments (argc, argv, args);
@@ -1148,14 +1155,14 @@ int main(int argc, char **argv) {
 	typedef Modular<double> Field;
 	//typedef Modular<int> Field;
 	//typedef Modular<float> Field;
-        
+
 	Field F (q);
-    
+
 	bool pass = true;
 
 	srand (time (NULL));
 
-    
+
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (20);
 	//commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_IMPORTANT);
 
@@ -1163,7 +1170,7 @@ int main(int argc, char **argv) {
 
 
 	if (!testMulAdd (F,n,iterations)) pass=false;
- 	if (!testRank (F, n, iterations))   pass = false;   
+ 	if (!testRank (F, n, iterations))   pass = false;
  	if (!testDet  (F, n, iterations)) pass = false;
  	if (!testInv  (F, n, iterations)) pass = false;
  	if (!testTriangularSolve (F,n,n,iterations)) pass=false;
@@ -1172,9 +1179,9 @@ int main(int argc, char **argv) {
  	if (!testLQUP (F,n,n,iterations)) pass=false;
  	if (!testMinPoly (F,n,iterations)) pass=false;
 	if (!testCharPoly (F,n,iterations)) pass=false;
-	
-	commentator.stop("done", 0, "BlasMatrixDomain"); 
+
+	commentator.stop("done", 0, "BlasMatrixDomain");
 	return pass ? 0 : -1;
 }
-  
-  
+
+
diff --git a/tests/benchmark-fields.C b/tests/benchmark-fields.C
index e2f737e..11c7b7e 100644
--- a/tests/benchmark-fields.C
+++ b/tests/benchmark-fields.C
@@ -1,10 +1,16 @@
 /* -*- 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
 
 /* tests/test-fields.C
  * Written by Dan Roche
  * Copyright (C) June 2004 Dan Roche, part of LinBox, GNU LGPL. See COPYING for license.
  */
 
+/*! @file  tests/benchmark-fields.C
+ * @ingroup tests
+ * @brief  no doc
+ */
+
 #include "linbox/linbox-config.h"
 #include "linbox/util/timer.h"
 // #include "linbox/field/givaro-gfq.h"
@@ -18,9 +24,8 @@
 #endif
 
 #include "linbox/field/modular.h"
-#include "linbox/field/modular-int32.h"
-#include "linbox/field/modular-int.h"
-#include "linbox/field/modular-double.h"
+#include "linbox/field/modular-balanced.h"
+#include "linbox/field/modular-crooked-double.h"
 #include "linbox/field/field-traits.h"
 #include "linbox/vector/stream.h"
 #include "linbox/integer.h"
@@ -51,7 +56,8 @@ using namespace LinBox;
  */
 
 template< class Field >
-void fieldTest( const Field& f, double* array, long iter = 1000000, bool fulltest = false ) {
+void fieldTest( const Field& f, double* array, long iter = 1000000, bool fulltest = false )
+{
 
 	long vectorSize = 10000;
 	float sparsity = .01;
@@ -60,46 +66,47 @@ void fieldTest( const Field& f, double* array, long iter = 1000000, bool fulltes
 
 	// initialize a few field elements,
 	typedef typename Field::Element Element;
-	register Element returnValue; f.init(returnValue, 1);
-	register Element s; f.init(s, 0); 
+	Element returnValue; f.init(returnValue, 1);
+	Element s; f.init(s, 0);
 
-	register Element a, b, c;
+	Element a, b, c;
 	typename Field::RandIter r(f);
-	r.random( a ); r.random( b ); r.random( c ); 
+	r.random( a ); r.random( b ); r.random( c );
 	std::vector<Element> dv1( vectorSize ), dv2( vectorSize );
 	for (i = 0; i < vectorSize; ++i ) {
 		r.random( dv1[i] );
 		r.random( dv2[i] );
 	}
-	RandomSparseStream<Field> sparse( f, sparsity, vectorSize ); 
+	RandomSparseStream<Field> sparse( f, sparsity, vectorSize );
 	typename RandomSparseStream<Field>::Vector sv; sparse.get( sv );
 
-/*
+#if 0
 	// initialize and fill array of random elements.
 	typename Field::RandIter r(f);
 	typename Field::Element *elements;
 	elements = new typename Field::Element[ iter * 3 ];
 	for( int i = 0; i < iter*3; i++ ) {
 		do { r.random( elements[i] ); }
-			while( f.isZero( elements[i] ) );
+		while( f.isZero( elements[i] ) );
 	}
 
 	// initialize random vector streams
 	RandomDenseStream<Field> dense( f, vectorSize, 2);
 	typename RandomDenseStream<Field>::Vector dv1; dense.get( dv1 );
 	typename RandomDenseStream<Field>::Vector dv2; dense.get( dv2 );
-	RandomSparseStream<Field> sparse( f, sparsity, vectorSize ); 
+	RandomSparseStream<Field> sparse( f, sparsity, vectorSize );
 	typename RandomSparseStream<Field>::Vector sv; sparse.get( sv );
 
 	RandomDenseStream<Field> dense1( f, vectorSize, iter/vectorSize );
 	RandomDenseStream<Field> dense2( f, vectorSize, iter/vectorSize );
-	RandomSparseStream<Field> sparse( f, sparsity, vectorSize ); 
+	RandomSparseStream<Field> sparse( f, sparsity, vectorSize );
 
 	// initialize individual vectors to hold results
 	typename RandomDenseStream<Field>::Vector dv1;
 	typename RandomDenseStream<Field>::Vector dv2;
 	typename RandomSparseStream<Field>::Vector sv;
-*/
+#endif
+
 	VectorWrapper::ensureDim (dv1,vectorSize);
 	VectorWrapper::ensureDim (dv2,vectorSize);
 	VectorWrapper::ensureDim (sv,vectorSize);
@@ -110,7 +117,7 @@ void fieldTest( const Field& f, double* array, long iter = 1000000, bool fulltes
 	double overHeadTime;
 
 	timer.clear(); timer.start();
-	f.init(s, 0); 
+	f.init(s, 0);
 	for( i = 0; i < iter; i++ ) { f.init(returnValue, i); f.addin(s, returnValue); }
 	timer.stop(); overHeadTime = timer.time();
 
@@ -122,27 +129,27 @@ void fieldTest( const Field& f, double* array, long iter = 1000000, bool fulltes
 		f.addin(s, returnValue);
 	}
 	timer.stop(); array[0] = timer.time() - overHeadTime;
-//std::cout << iter << " add done " << array[0] << std::endl;
-
-if (fulltest) {
-    // sub
-    timer.clear(); timer.start();
-    for( i = 0; i < iter; i++ ) {
-		f.init(a, i);
-		f.sub( returnValue, a, b);
-		f.addin(s, returnValue);
-    }
-    timer.stop(); array[1] = timer.time() - overHeadTime;
+	//std::cout << iter << " add done " << array[0] << std::endl;
+
+	if (fulltest) {
+		// sub
+		timer.clear(); timer.start();
+		for( i = 0; i < iter; i++ ) {
+			f.init(a, i);
+			f.sub( returnValue, a, b);
+			f.addin(s, returnValue);
+		}
+		timer.stop(); array[1] = timer.time() - overHeadTime;
 
-	// neg
-	timer.clear(); timer.start();
-	for( i = 0; i < iter; i++ ) {
-		f.init(a, i);
-		f.neg( returnValue, a);
-		f.addin(s, returnValue);
-	}
-	timer.stop(); array[2] = timer.time() - overHeadTime;
-} // end if (fulltest)
+		// neg
+		timer.clear(); timer.start();
+		for( i = 0; i < iter; i++ ) {
+			f.init(a, i);
+			f.neg( returnValue, a);
+			f.addin(s, returnValue);
+		}
+		timer.stop(); array[2] = timer.time() - overHeadTime;
+	} // end if (fulltest)
 
 	// mul
 	timer.clear(); timer.start();
@@ -152,27 +159,27 @@ if (fulltest) {
 		f.addin(s, returnValue);
 	}
 	timer.stop(); array[3] = timer.time() - overHeadTime;
-//std::cout << iter << " mul done " << array[3] << std::endl;
-
-if (fulltest) {
-	// inv
-	timer.clear(); timer.start();
-	for( i = 0; i < iter; i++ ) {
-		f.init(a, i);  if (f.isZero(a)) f.init(a, 1);
-		f.inv( returnValue, a);
-		f.addin(s, returnValue);
-	}
-	timer.stop(); array[4] = timer.time() - overHeadTime;
+	//std::cout << iter << " mul done " << array[3] << std::endl;
+
+	if (fulltest) {
+		// inv
+		timer.clear(); timer.start();
+		for( i = 0; i < iter; i++ ) {
+			f.init(a, i);  if (f.isZero(a)) f.init(a, 1);
+			f.inv( returnValue, a);
+			f.addin(s, returnValue);
+		}
+		timer.stop(); array[4] = timer.time() - overHeadTime;
 
-	// div
-	timer.clear(); timer.start();
-	for( i = 0; i < iter; i++ ) {
-		f.init(a, i); 
-		f.div( returnValue, a, b);
-		f.addin(s, returnValue);
-	}
-	timer.stop(); array[5] = timer.time() - overHeadTime;
-} // end if (fulltest)
+		// div
+		timer.clear(); timer.start();
+		for( i = 0; i < iter; i++ ) {
+			f.init(a, i);
+			f.div( returnValue, a, b);
+			f.addin(s, returnValue);
+		}
+		timer.stop(); array[5] = timer.time() - overHeadTime;
+	} // end if (fulltest)
 
 	// axpy
 	timer.clear(); timer.start();
@@ -192,25 +199,25 @@ if (fulltest) {
 		f.addin(s, returnValue);
 	}
 	timer.stop(); array[7] = timer.time();
-//	std::cout << (iter/vectorSize) << " dd " << timer.time() << std::endl;;
-
-if (fulltest) {
-	// DotProduct2 ( dense * sparse )
-	timer.clear(); timer.start();
-	for( i = 0; i < iter/vectorSize; i++ ) {
-		f.init(dv1.back(), i);
-    	for ( int j = 0; j < sparsity_inv; ++ j ) {
-			f.init(dv1.front(), j);
-			VD.dot( returnValue, dv1, sv );
-			f.addin(s, returnValue);
+	//	std::cout << (iter/vectorSize) << " dd " << timer.time() << std::endl;;
+
+	if (fulltest) {
+		// DotProduct2 ( dense * sparse )
+		timer.clear(); timer.start();
+		for( i = 0; i < iter/vectorSize; i++ ) {
+			f.init(dv1.back(), i);
+			for ( int j = 0; j < sparsity_inv; ++ j ) {
+				f.init(dv1.front(), j);
+				VD.dot( returnValue, dv1, sv );
+				f.addin(s, returnValue);
+			}
 		}
-	}
-	timer.stop(); array[8] = timer.time();
-	//std::cout << "ds " << timer.time() << std::endl;;
-} // end if (fulltest)
+		timer.stop(); array[8] = timer.time();
+		//std::cout << "ds " << timer.time() << std::endl;;
+	} // end if (fulltest)
 
 	// Convert timings to mops (million operations per second)
-	for( i = 0; i < 9; i++ ) {	
+	for( i = 0; i < 9; i++ ) {
 		double t = array[i];
 		array[i] = iter / (t > 0 ? (t * 1000000) : 0) ;
 	}
@@ -224,9 +231,10 @@ if (fulltest) {
  * (one floating-point and one int operation) can be executed on the current
  * machine.
  */
-int64 getOps(int unit) {
-	int64 ops = 1;
-	int64 i = 0;
+int64_t getOps(int unit)
+{
+	int64_t ops = 1;
+	int64_t i = 0;
 	int a = 13;
 	double b = 1.3;
 	UserTimer opsClock;
@@ -252,25 +260,27 @@ int64 getOps(int unit) {
 	return ops;
 }
 
-void printTimings( double* timings, bool fulltest = false ) {
-	if (fulltest){ std::cout 
-	     << std::setw(11) << timings[0] << ' '
-	     << std::setw(11) << timings[1] << ' '
-	     << std::setw(11) << timings[2] << ' '
-	     << std::setw(11) << timings[3] << ' '
-	     << std::setw(11) << timings[4] << ' '
-	     << std::setw(11) << timings[5] << ' '
-	;} std::cout 
-	     << std::setw(11) << timings[6] << ' '
-	     << std::setw(11) << timings[7] << ' '
-	; if (fulltest){ std::cout 
-	     << std::setw(11) << timings[8] << ' '
-	;} std::cout 
-	     << std::setw(11) << timings[6]/(1/(1/timings[0] + 1/timings[3])); // axpy/(mul+add) ratio
+void printTimings( double* timings, bool fulltest = false )
+{
+	if (fulltest){ std::cout
+		<< std::setw(11) << timings[0] << ' '
+		<< std::setw(11) << timings[1] << ' '
+		<< std::setw(11) << timings[2] << ' '
+		<< std::setw(11) << timings[3] << ' '
+		<< std::setw(11) << timings[4] << ' '
+		<< std::setw(11) << timings[5] << ' '
+		;} std::cout
+		<< std::setw(11) << timings[6] << ' '
+		<< std::setw(11) << timings[7] << ' '
+		; if (fulltest){ std::cout
+			<< std::setw(11) << timings[8] << ' '
+			;} std::cout
+			<< std::setw(11) << timings[6]/(1/(1/timings[0] + 1/timings[3])); // axpy/(mul+add) ratio
 }
 
 template <class Field>
-void doTest(const char* name, integer& p, integer& exp, int64& iter, bool fulltest = false) {
+void doTest(const char* name, integer& p, integer& exp, int64_t& iter, bool fulltest = false)
+{
 	static double mops[11];
 	if( FieldTraits<Field>::goodModulus( p ) &&
 	    FieldTraits<Field>::goodExponent( exp ) ) {
@@ -280,65 +290,81 @@ void doTest(const char* name, integer& p, integer& exp, int64& iter, bool fullte
 		std::cout << std::setw(20) << name;
 		printTimings( mops, fulltest);
 		std::cout << std::endl;
-	} 
+	}
 	else {
 		std::cout << std::setw(20) << name << ": " << p << "^" << exp << " is out of range" << std::endl;
 	}
 }
 
-int main(int argc, char** argv) {
-	int64 ops = getOps(1);
+int main(int argc, char** argv)
+{
+	int64_t ops = getOps(1);
 	std::cout << "timings recorded in mops.  Bigger is better." << std::endl;
 	std::cout << "Ops per sec, roughly: " << ops << std::endl;
-	//int64 iterations = ops/16;
-	int64 iterations = ops;
+	//int64_t iterations = ops/16;
+	int64_t iterations = ops;
 	integer prime(101), exp(1);
 	if( argc >= 2 ) prime = integer( argv[1] );
 	if( argc >= 3 ) exp = integer( argv[2] );
 	//bool fulltest = true;
 	bool fulltest = false;
-	if( argc > 3 ) fulltest = ( argv[3][0] == 1 ); 
+	if( argc > 3 ) fulltest = ( argv[3][0] == 1 );
 	if( argc > 4 ) exit(1);
 
 	std::cout << std::setw(20) << "Field Name";
-	if (fulltest) { std::cout 
-	     << std::setw(12) << "add "
-	     << std::setw(12) << "sub "
-	     << std::setw(12) << "neg "
-	     << std::setw(12) << "mul "
-	     << std::setw(12) << "inv "
-	     << std::setw(12) << "div "
-	;} std::cout 
-	     << std::setw(12) << "axpy"
-	     << std::setw(12) << "dot d*d "
-	; if (fulltest) { std::cout 
-	     << std::setw(12) << "dot d*s "
-	;} std::cout 
-	     << std::setw(12) << "axpy/(mul+add)"
-		 << std::endl;
-
-    doTest< Modular<int8> >( "Modular<int8>", prime, exp, iterations, fulltest );
-    doTest< Modular<int16> >( "Modular<int16>", prime, exp, iterations, fulltest );
-    doTest< Modular<int32> >( "Modular<int32>", prime, exp, iterations, fulltest );
-    doTest< Modular<int> >( "Modular<int>", prime, exp, iterations, fulltest );
-    doTest< Modular<double> >( "Modular<double>", prime, exp, iterations, fulltest );
-    doTest< Modular<float> >( "Modular<float>", prime, exp, iterations, fulltest );
+	if (fulltest) {
+		std::cout
+		<< std::setw(12) << "add "
+		<< std::setw(12) << "sub "
+		<< std::setw(12) << "neg "
+		<< std::setw(12) << "mul "
+		<< std::setw(12) << "inv "
+		<< std::setw(12) << "div "
+		;
+	}
+	std::cout
+	<< std::setw(12) << "axpy"
+	<< std::setw(12) << "dot d*d "
+	;
+	if (fulltest) {
+		std::cout
+		<< std::setw(12) << "dot d*s "
+		;
+	}
+	std::cout
+	<< std::setw(12) << "axpy/(mul+add)"
+	<< std::endl;
+
+	doTest< Modular<int8_t> >( "Modular<int8_t>", prime, exp, iterations, fulltest );
+	doTest< Modular<int16_t> >( "Modular<int16_t>", prime, exp, iterations, fulltest );
+	doTest< Modular<int32_t> >( "Modular<int32_t>", prime, exp, iterations, fulltest );
+	//doTest< Modular<int> >( "Modular<int>", prime, exp, iterations, fulltest );
+	doTest< Modular<double> >( "Modular<double>", prime, exp, iterations, fulltest );
+	doTest< Modular<float> >( "Modular<float>", prime, exp, iterations, fulltest );
+
+	//doTest< ModularBalanced<int8_t> >( "ModularBalanced<int8_t>", prime, exp, iterations, fulltest );
+	//doTest< ModularBalanced<int16_t> >( "ModularBalanced<int16_t>", prime, exp, iterations, fulltest );
+	doTest< ModularBalanced<int32_t> >( "ModularBalanced<int32_t>", prime, exp, iterations, fulltest );
+	doTest< ModularBalanced<double> >( "ModularBalanced<double>", prime, exp, iterations, fulltest );
+	doTest< ModularBalanced<float> >( "ModularBalanced<float>", prime, exp, iterations, fulltest );
+
+	doTest< ModularCrooked<double> >( "ModularCrooked<double>", prime, exp, iterations, fulltest );
 
 #ifdef __LINBOX_HAVE_NTL
-    doTest< NTL_zz_p >( "NTL_zz_p", prime, exp, iterations, fulltest );
-    doTest< NTL_PID_zz_p >( "NTL_PID_zz_p", prime, exp, iterations, fulltest ); 
-    doTest< NTL_ZZ_p >( "NTL_ZZ_p", prime, exp, iterations, fulltest );
-    doTest< PIR_ntl_ZZ_p >( "PIR_ntl_ZZ_p", prime, exp, iterations, fulltest );
-    doTest< NTL_ZZ >( "NTL_ZZ", prime, exp, iterations, fulltest );
+	doTest< NTL_zz_p >( "NTL_zz_p", prime, exp, iterations, fulltest );
+	doTest< NTL_PID_zz_p >( "NTL_PID_zz_p", prime, exp, iterations, fulltest );
+	doTest< NTL_ZZ_p >( "NTL_ZZ_p", prime, exp, iterations, fulltest );
+	doTest< PIR_ntl_ZZ_p >( "PIR_ntl_ZZ_p", prime, exp, iterations, fulltest );
+	doTest< NTL_ZZ >( "NTL_ZZ", prime, exp, iterations, fulltest );
 #endif
 #ifdef __LINBOX_HAVE_LIDIA
-    doTest< LidiaGfq >( "LidiaGfq", prime, exp, iterations, fulltest );
+	doTest< LidiaGfq >( "LidiaGfq", prime, exp, iterations, fulltest );
 #endif
-//	doTest< GF2 >( "GF2", prime, exp, iterations, fulltest );
-    doTest< GMPRationalField >( "GMPRationalField", prime, exp, iterations, fulltest ); 
+	//	doTest< GF2 >( "GF2", prime, exp, iterations, fulltest );
+	doTest< GMPRationalField >( "GMPRationalField", prime, exp, iterations, fulltest );
 	//if (prime == 2)
-    	doTest< PIRModular<int32> >( "PIRModular<int32>", prime, exp, iterations, fulltest );
-    doTest< Local2_32 >( "Local2_32", prime, exp, iterations, fulltest );
+	doTest< PIRModular<int32_t> >( "PIRModular<int32_t>", prime, exp, iterations, fulltest );
+	doTest< Local2_32 >( "Local2_32", prime, exp, iterations, fulltest );
 
 	return 0;
 }
diff --git a/tests/checker.C b/tests/checker.C
new file mode 100644
index 0000000..61305e7
--- /dev/null
+++ b/tests/checker.C
@@ -0,0 +1,337 @@
+/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=g0,t0,\:0
+
+/** @file tests/checker.C
+ at brief script to run LinBox tests
+
+Checker is compiled and run by the check macro invoked by "make check" in the top source dir or in tests/.  It may be run with "make test" or by "make checker; checker" in /tests, avoiding spurrious output of the autotool's check macro.  Run without args, checker prints an explanation of command line options, then proceeds with default test behaviour.
+
+Each LinBox test gets a line below.  A LinBox unit/regresssion test has a default behaviour -- when there are no command line file names -- in which nothing is written to any output stream and the return value is 0 for a passing test, nonzero for any failure.
+
+The current convention is that (1) linbox' check macro, checker.C, runs the tests with no command line parameters at all, and (2) if there is a command line file name, verbose diagnostic output is written to that file and more terse output may be written to standard output streams.  The second feature is intended to assist debugging with individual tests.
+
+In future, command line arguments could be used in checking to vary matrix sizes and other parameters in check runs.
+
+There should be a 1-1 correspondence between files tests/test-*.C and calls
+here to build_n_run() or no_build_n_run() (possibly commented out).
+*/
+
+#include <cstdlib>
+#include <iostream>
+#include <fstream>
+#include <sstream>
+//#include <iomanip>
+using namespace std;
+
+#include "../linbox/linbox-config.h"
+
+struct counts {
+	int      pass;
+       	int buildfail;
+	int   runfail;
+	int   skipped;
+	counts() :
+		pass(0), buildfail(0), runfail(0), skipped(0)
+	{}
+	int total()
+	{
+	       	return pass + buildfail + runfail;
+       	}
+};
+
+void build_n_run(string s, counts& cnt, int flag = 2, string r = "") ;
+void no_build_n_run(string s, counts& cnt, int flag = 2, string r = "") ;
+
+int main(int argc, char* argv[])
+{
+	int flag = 1; // default verbosity, no force
+	if (argc < 2) {
+		cout << "usage: " << argv[0] << " [summary,default,errors,verbose] [c]" << endl;
+		cout << "  summary: only 4 lines printed." << endl;
+		cout << "  default: also one line per test." << endl;
+		cout << "  warnings: shows subtest failures." << endl;
+		cout << "  errors: also any build and run output for error cases." << endl;
+		cout << "  verbose: also any build and run output for each test." << endl;
+		cout << "  2nd arg, if present, forces rebuild of all tests." << endl;
+	}
+       	else {
+		if (argv[1][0] == 's') flag = 0; // summary
+		if (argv[1][0] == 'd') flag = 1; // default
+		if (argv[1][0] == 'w') flag = 2; // errors
+		if (argv[1][0] == 'e') flag = 3; // verbose
+		if (argv[1][0] == 'v') flag = 3; // verbose
+		if (argc > 2) flag += 5; // force rebuilds
+	}
+
+	// the setup
+	system("rm -f checkdata");
+#if 0
+	string compiler;
+	//system("make -n ");
+	system("make -n checkerdata > checkdata");
+	ifstream fin("checkdata", ifstream::in);
+	do {getline(fin, compiler);}
+	while (fin && compiler.find("something") == compiler.npos);
+	cout << compiler << endl << endl;
+	system("rm -f checkdata");
+#endif
+
+	// the tests
+	counts counter;
+
+/*
+Each test gets a line below.  A LinBox unit/regresssion test has a default behaviour -- when there are no command line file names -- in which nothing is written to any output stream and the return value is 0 for a passing test, nonzero for any failure.
+
+The current convention is that (1) linbox' check macro, checker.C, runs the tests with no command line parameters at all, and (2) if there is a command line file name, verbose diagnostic output is written to that file and more terse output may be written to standard output streams.  The second feature is intended to assist debugging with individual tests.
+
+In future, command line arguments could be used in checking to vary matrix sizes and other parameters in check runs.
+
+There should be a 1-1 correspondence between files tests/test-*.C and calls
+here to build_n_run or no_build_n_run (possibly commented out).
+Thus "ls test-*.C |wc" and "grep test- checker.C |grep \
+build |wc" should yield the same number of lines.
+*/
+
+//BASIC_TESTS
+	build_n_run("test-bitonic-sort", counter, flag);
+	build_n_run("test-blas-domain", counter, flag);
+	build_n_run("test-block-ring", counter, flag);
+	build_n_run("test-butterfly", counter, flag);
+	build_n_run("test-charpoly", counter, flag);//, "intermittent inf loop, bb or cp responsible?");
+	build_n_run("test-commentator", counter, flag);
+	build_n_run("test-companion", counter, flag);
+	build_n_run("test-cra", counter, flag);
+	build_n_run("test-cradomain", counter, flag);
+	build_n_run("test-dense", counter, flag);
+	build_n_run("test-det", counter, flag);
+	build_n_run("test-diagonal", counter, flag);
+	build_n_run("test-dif", counter, flag);
+	build_n_run("test-direct-sum", counter, flag);
+	build_n_run("test-dyadic-to-rational", counter, flag, "bds responsible");
+	build_n_run("test-ffpack", counter, flag);
+	build_n_run("test-frobenius", counter, flag);
+	build_n_run("test-getentry", counter, flag);
+	build_n_run("test-gf2", counter, flag);
+	build_n_run("test-gmp-rational", counter, flag);
+	build_n_run("test-hilbert", counter, flag);
+	build_n_run("test-hom", counter, flag);
+	build_n_run("test-inverse", counter, flag);
+	build_n_run("test-isposdef", counter, flag);
+	build_n_run("test-ispossemidef", counter, flag);
+	build_n_run("test-last-invariant-factor", counter, flag);
+	build_n_run("test-matrix-domain", counter, flag);
+	build_n_run("test-matrix-stream", counter, flag);
+	build_n_run("test-minpoly", counter, flag);
+	build_n_run("test-modular", counter, flag);
+	build_n_run("test-modular-balanced-int", counter, flag);
+	build_n_run("test-modular-balanced-float", counter, flag);
+	build_n_run("test-modular-balanced-double", counter, flag);
+	build_n_run("test-modular-byte", counter, flag);
+	build_n_run("test-modular-double", counter, flag);
+	build_n_run("test-modular-float", counter, flag);
+	build_n_run("test-modular-int", counter, flag);
+	build_n_run("test-modular-short", counter, flag);
+	build_n_run("test-moore-penrose", counter, flag);
+	build_n_run("test-nullspace", counter, flag);
+	build_n_run("test-PID-integer", counter, flag);
+	build_n_run("test-qlup", counter, flag);
+	build_n_run("test-randiter-nonzero", counter, flag);
+	build_n_run("test-rank", counter, flag);
+	build_n_run("test-rational-matrix-factory ", counter, flag);
+	build_n_run("test-rational-reconstruction-base", counter, flag);
+	build_n_run("test-rat-charpoly", counter, flag);//, "infinite loop, cp responsible?");
+	build_n_run("test-scalar-matrix", counter, flag);
+	build_n_run("test-smith-form-binary", counter, flag);
+	build_n_run("test-solve", counter, flag);
+	build_n_run("test-sparse", counter, flag);
+	build_n_run("test-subiterator", counter, flag);
+	build_n_run("test-submatrix", counter, flag);
+	build_n_run("test-subvector", counter, flag);
+	build_n_run("test-sum", counter, flag);
+	build_n_run("test-rational-solver", counter, flag);
+	build_n_run("test-trace", counter, flag);
+	build_n_run("test-triplesbb", counter, flag);
+	build_n_run("test-unparametric-field", counter, flag); //has been useful in num/sym.
+	build_n_run("test-vector-domain", counter, flag);
+	build_n_run("test-zero-one", counter, flag);
+
+#if __LINBOX_HAVE_GIVARO
+//	if (flag > 0) cout << "	Givaro tests" << endl;
+	build_n_run("test-givaro-zpz", counter, flag);
+	build_n_run("test-givaro-zpzuns", counter, flag, "may fail on small fields because of supposed non-randomness or failure to find a non trivial element");
+	build_n_run("test-rat-solve", counter, flag); // "infinite loop");
+	build_n_run("test-rat-minpoly", counter, flag); // "intermittent failures");
+#else
+	if (flag > 0) cout << "	not doing Givaro dependent tests" << endl;
+	cout << "Configuration problem?  __LINBOX_HAVE_GIVARO is not set, but LinBox requires Givaro" << endl;
+	counter.skipped += 4;
+#endif
+
+#if __LINBOX_HAVE_LAPACK
+	if (flag > 0) cout << "	Lapack dependent tests" << endl;
+	build_n_run("test-rational-solver-adaptive", counter, flag);
+	// needs output cleanup.  Resolve whether a benchmark or a test.
+	build_n_run("test-solve-nonsingular", counter, flag, "bds responsible");
+#else
+	if (flag > 0) cout << "	not doing Lapack dependent tests" << endl;
+	no_build_n_run("test-rational-solver-adaptive", counter, flag);
+	// needs output cleanup.  Resolve whether a benchmark or a test.
+	no_build_n_run("test-solve-nonsingular", counter, flag, "bds responsible");
+#endif
+
+#if __LINBOX_HAVE_NTL
+	if (flag > 0) cout << "	NTL dependent tests" << endl;
+	build_n_run("test-ntl-hankel", counter, flag);
+	build_n_run("test-ntl-lzz_p", counter, flag);
+	build_n_run("test-ntl-toeplitz", counter, flag);
+	build_n_run("test-ntl-sylvester", counter, flag);
+	build_n_run("test-ntl-RR", counter, flag);
+	build_n_run("test-ntl-ZZ_p", counter, flag);
+	build_n_run("test-toeplitz-det", counter, flag);
+	build_n_run("test-smith-form", counter, flag);
+	build_n_run("test-smith-form-adaptive", counter, flag);
+	build_n_run("test-smith-form-iliopoulos", counter, flag);
+#else
+	if (flag > 0) cout << "	not doing NTL dependent tests" << endl;
+	no_build_n_run("test-ntl-hankel", counter, flag);
+	no_build_n_run("test-ntl-lzz_p", counter, flag);
+	no_build_n_run("test-ntl-toeplitz", counter, flag);
+	no_build_n_run("test-ntl-RR", counter, flag);
+	no_build_n_run("test-ntl-sylvester", counter, flag);
+	no_build_n_run("test-ntl-ZZ_p", counter, flag);
+	no_build_n_run("test-toeplitz-det", counter, flag, "can we have non NTL version?");
+	no_build_n_run("test-smith-form", counter, flag);
+	no_build_n_run("test-smith-form-adaptive", counter, flag);
+	no_build_n_run("test-smith-form-iliopoulos", counter, flag);
+#endif
+
+#if __LINBOX_HAVE_LIDIA
+	if (flag > 0) cout << "	Lidia dependent tests" << endl;
+	build_n_run("./test-lidia-gfq", counter, flag);
+#else
+	if (flag > 0) cout << "	not doing Lidia dependent test" << endl;
+	no_build_n_run("test-lidia-gfq", counter, flag);
+#endif
+
+#if __LINBOX_HAVE_ATLAS
+	if (flag > 0) cout << "	Atlas dependent tests" << endl;
+	build_n_run("./test-optimization", counter, flag);
+#else
+	if (flag > 0) cout << "	not doing Atlas dependent test" << endl;
+	no_build_n_run("test-optimization", counter, flag, "?");
+#endif
+
+	// tests of "doubles as a field" which doesn't adhere to LinBox field or ring specs.
+	if (flag > 0) cout << "	Noncompliant tests" << endl;
+	build_n_run("test-param-fuzzy", counter, flag);
+
+#if 1
+	if (flag > 0) cout << "	Tests requiring further development" << endl;
+	build_n_run("test-smith-form-local", counter, flag, "bds"); //"intermittent failures");
+	no_build_n_run("test-ftrmm", counter, flag, "bb/cp");
+
+	if (flag > 0) cout << "	Immature tests" << endl;
+	no_build_n_run("test-quad-matrix", counter, flag, "half baked, bds responsible"); no_build_n_run("test-dense-zero-one", counter, flag, "half baked, bds responsible"); build_n_run("test-zo", counter, flag, "half baked, BY responsible");
+	// test-integer-tools -- there is no test-integer-tools.C file
+	// no one has taken these on.
+	//no_build_n_run("test-mg-block-lanczos", counter, flag, "make fails, nobody responsible");
+#endif
+
+#if 0
+	if (flag > 0) cout << "	Non tests" << endl;
+	no_build_n_run("test-template", counter, flag, "yup, model for tests, not an actual test");
+	// test-common.C is included in test-common.h,
+	//  but could be separately compiled (no templates).
+	no_build_n_run("test-common", counter, flag, "not a test");
+	no_build_n_run("test-fields", counter, flag, "deprecated");
+	no_build_n_run("test-matrix", counter, flag, "deprecated?");
+	no_build_n_run("test-image-field", counter, flag, "deprecated");
+
+//BENCHMARKS =
+	build_n_run("benchmark-fields", counter, flag);
+	build_n_run("benchmark-blas-domain", counter, flag);
+
+# I put test-gssv_rank in hmrg:~saunders/gen_superlu.  It is not linbox until and unless it is made to work
+# test-gssv is an ntl test
+
+# no explicit test needed, I guess...
+#        Transpose is tested in test-triplesbb
+#        Compose is tested in test-butterfly
+
+#endif
+
+	// the summary
+	cout << "--------------------------------------------------------------------" << endl;
+	if (counter.buildfail || counter.runfail)
+		cout << "Of " << counter.total() << " tests, "
+			<< counter.buildfail << " failed to compile and "
+			<< counter.runfail << " failed at runtime."
+			<< "  (" << counter.skipped << " skipped tests.)" << endl;
+	else
+		cout << endl << "All " << counter.total() << " tests pass."
+			<< "  (" << counter.skipped << " skipped tests.)" << endl;
+	cout << "  File tests/checkdata contains any output from the builds and runs." << endl;
+	cout << "--------------------------------------------------------------------" << endl;
+
+	return counter.buildfail || counter.runfail ? -1 : 0;
+}
+
+void no_build_n_run(string s, counts& cnt, int flag, string r)
+{
+	if (flag >= 5) flag -= 5;
+	if (flag > 0) {
+		cout.width(35); cout << left << s;
+		if (r.length() > 0) cout << "skipped, " << r << "." << endl;
+		else cout << "skipped." << endl;
+	}
+	cnt.skipped++;
+}
+
+void build_n_run(string s, counts& cnt, int flag, string r)
+{
+// ignore r.
+	string cmd;
+	if (flag >= 5) { // force build
+		flag -= 5;
+		cmd = "touch " + s + ".C";
+		system(cmd.c_str());
+	}
+	if (flag >= 1) {
+		cout.width(35); cout << left << s;
+		cout << "build"; cout.flush();
+	}
+	cmd = "make " + s + " 2>> checkdata >> checkdata";
+	int status = system(cmd.c_str());
+	if (status == 2) goto abort; // valid on at least one platform.
+	if (status != 0) { // build failure
+		if (flag >= 1) cout << " FAILS" << endl;
+		if (flag >= 3) system ("cat checkdata; rm checkdata");
+		cnt.buildfail++;
+		// if (flag == 2) could grep for first "error" in compiler output
+
+	}
+       	else { // build success
+		if (flag >= 1) { cout << "\b\b\b\b\b  run"; cout.flush(); }
+		std::ostringstream prog ;
+		prog << "./" << s ;
+		status = system(prog.str().c_str());
+		if (status == 2) goto abort; // valid on at least one platform.
+		if (status != 0) {
+			if (flag >= 1) cout << " FAILS" << endl;
+			if (flag >= 3) system ("cat checkdata");
+			cnt.runfail++;
+		}
+	       	else {
+			if (flag >= 1) cout << "\b\b\b\bOK  " << endl;
+			if (flag >= 2) system ("grep \"warn\" checkdata");
+			cnt.pass++;
+			//cerr << "ok" << endl;
+		}
+	}
+	if (flag >= 3) system("rm -f checkdata");
+	return;
+abort:
+	cout << endl << "Interrupted, aborting." << endl;
+	exit(-1);
+}
+
diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index 75541da..866a168 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -1,3 +1,6 @@
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 EXTRA_DIST = \
 	test.matrix			\
 	sms.matrix			\
diff --git a/tests/data/Makefile.in b/tests/data/Makefile.in
index 94c9e4b..090b537 100644
--- a/tests/data/Makefile.in
+++ b/tests/data/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.3 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  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.
@@ -35,19 +36,26 @@ subdir = tests/data
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
-	$(top_srcdir)/macros/blas-check.m4 \
 	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
 	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
 	$(top_srcdir)/macros/givaro-check.m4 \
 	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
 	$(top_srcdir)/macros/lidia-check.m4 \
 	$(top_srcdir)/macros/linbox-doc.m4 \
 	$(top_srcdir)/macros/linbox-misc.m4 \
 	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
 	$(top_srcdir)/macros/maple-check.m4 \
 	$(top_srcdir)/macros/ntl-check.m4 \
 	$(top_srcdir)/macros/saclib-check.m4 \
-	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.in
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 	$(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -66,18 +74,21 @@ AUTOHEADER = @AUTOHEADER@
 AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 BLAS_LIBS = @BLAS_LIBS@
-CBLAS_FLAG = @CBLAS_FLAG@
 CC = @CC@
+CCNAM = @CCNAM@
 CFLAGS = @CFLAGS@
-CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CXX = @CXX@
 CXXCPP = @CXXCPP@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
 DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
 DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -85,19 +96,24 @@ EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 EXPAT_CFLAGS = @EXPAT_CFLAGS@
 EXPAT_LIBS = @EXPAT_LIBS@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
 GIVARO_CFLAGS = @GIVARO_CFLAGS@
 GIVARO_LIBS = @GIVARO_LIBS@
 GMP_CFLAGS = @GMP_CFLAGS@
 GMP_LIBS = @GMP_LIBS@
 GMP_VERSION = @GMP_VERSION@
 GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
 INSTALL = @INSTALL@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBOBJS = @LIBOBJS@
 LIBS = @LIBS@
@@ -105,41 +121,52 @@ LIBTOOL = @LIBTOOL@
 LIDIA_CFLAGS = @LIDIA_CFLAGS@
 LIDIA_LIBS = @LIDIA_LIBS@
 LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
 MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
 MAPLE_CFLAGS = @MAPLE_CFLAGS@
 MAPLE_HOME = @MAPLE_HOME@
 MAPLE_LIBS = @MAPLE_LIBS@
 MAPLE_VERSION = @MAPLE_VERSION@
 MKDIR_P = @MKDIR_P@
+NM = @NM@
 NMEDIT = @NMEDIT@
 NTL_CFLAGS = @NTL_CFLAGS@
 NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
 OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
 PACKAGE = @PACKAGE@
 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
 PACKAGE_NAME = @PACKAGE_NAME@
 PACKAGE_STRING = @PACKAGE_STRING@
 PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
 RANLIB = @RANLIB@
+RM = @RM@
 SACLIB_CFLAGS = @SACLIB_CFLAGS@
 SACLIB_LIBS = @SACLIB_LIBS@
 SED = @SED@
 SET_MAKE = @SET_MAKE@
 SHELL = @SHELL@
 STRIP = @STRIP@
+TESTS_CFLAGS = @TESTS_CFLAGS@
 VERSION = @VERSION@
+WARN = @WARN@
 abs_builddir = @abs_builddir@
 abs_srcdir = @abs_srcdir@
 abs_top_builddir = @abs_top_builddir@
 abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
 ac_ct_CC = @ac_ct_CC@
 ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
 am__leading_dot = @am__leading_dot@
 am__tar = @am__tar@
 am__untar = @am__untar@
@@ -180,8 +207,13 @@ sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
+
+# Copyright (c) 2010 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
 EXTRA_DIST = \
 	test.matrix			\
 	sms.matrix			\
@@ -199,8 +231,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__confi
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
 	    *$$dep*) \
-	      cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-		&& exit 0; \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
 	      exit 1;; \
 	  esac; \
 	done; \
@@ -305,6 +337,8 @@ dvi-am:
 
 html: html-am
 
+html-am:
+
 info: info-am
 
 info-am:
@@ -313,18 +347,28 @@ install-data-am:
 
 install-dvi: install-dvi-am
 
+install-dvi-am:
+
 install-exec-am:
 
 install-html: install-html-am
 
+install-html-am:
+
 install-info: install-info-am
 
+install-info-am:
+
 install-man:
 
 install-pdf: install-pdf-am
 
+install-pdf-am:
+
 install-ps: install-ps-am
 
+install-ps-am:
+
 installcheck-am:
 
 maintainer-clean: maintainer-clean-am
diff --git a/tests/matrix/Makefile.am b/tests/matrix/Makefile.am
new file mode 100644
index 0000000..c4e73ca
--- /dev/null
+++ b/tests/matrix/Makefile.am
@@ -0,0 +1,12 @@
+# Copyright (c) 2011 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+
+EXTRA_DIST = \
+	 coin.h     \
+	 hadamard.h \
+	 invhilb.h  \
+	 jmat.h     \
+	 minmax.h   \
+	 randomans.h\
+   	 randommat.h
diff --git a/tests/matrix/Makefile.in b/tests/matrix/Makefile.in
new file mode 100644
index 0000000..4f832da
--- /dev/null
+++ b/tests/matrix/Makefile.in
@@ -0,0 +1,406 @@
+# Makefile.in generated by automake 1.10.3 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.
+# 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.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+# Copyright (c) 2011 the LinBox group
+# This file is part of LinBox
+# see COPYING for licence
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+subdir = tests/matrix
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/macros/aclocal-include.m4 \
+	$(top_srcdir)/macros/config-header.m4 \
+	$(top_srcdir)/macros/debug.m4 \
+	$(top_srcdir)/macros/expat-check.m4 \
+	$(top_srcdir)/macros/fflaflas-check.m4 \
+	$(top_srcdir)/macros/givaro-check.m4 \
+	$(top_srcdir)/macros/gmp-check.m4 \
+	$(top_srcdir)/macros/iml-check.m4 \
+	$(top_srcdir)/macros/libtool.m4 \
+	$(top_srcdir)/macros/lidia-check.m4 \
+	$(top_srcdir)/macros/linbox-doc.m4 \
+	$(top_srcdir)/macros/linbox-misc.m4 \
+	$(top_srcdir)/macros/linbox-opt.m4 \
+	$(top_srcdir)/macros/ltoptions.m4 \
+	$(top_srcdir)/macros/ltsugar.m4 \
+	$(top_srcdir)/macros/ltversion.m4 \
+	$(top_srcdir)/macros/lt~obsolete.m4 \
+	$(top_srcdir)/macros/maple-check.m4 \
+	$(top_srcdir)/macros/ntl-check.m4 \
+	$(top_srcdir)/macros/saclib-check.m4 \
+	$(top_srcdir)/macros/sage-check.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+depcomp =
+am__depfiles_maybe =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLAS_LIBS = @BLAS_LIBS@
+CC = @CC@
+CCNAM = @CCNAM@
+CFLAGS = @CFLAGS@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DBG = @DBG@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFAULT_CFLAGS = @DEFAULT_CFLAGS@
+DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+EXPAT_CFLAGS = @EXPAT_CFLAGS@
+EXPAT_LIBS = @EXPAT_LIBS@
+FFLAFLAS_CFLAGS = @FFLAFLAS_CFLAGS@
+FFLAFLAS_LIBS = @FFLAFLAS_LIBS@
+FFLAFLAS_LOC = @FFLAFLAS_LOC@
+FGREP = @FGREP@
+GIVARO_CFLAGS = @GIVARO_CFLAGS@
+GIVARO_LIBS = @GIVARO_LIBS@
+GMP_CFLAGS = @GMP_CFLAGS@
+GMP_LIBS = @GMP_LIBS@
+GMP_VERSION = @GMP_VERSION@
+GREP = @GREP@
+IML_CFLAGS = @IML_CFLAGS@
+IML_LIBS = @IML_LIBS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIDIA_CFLAGS = @LIDIA_CFLAGS@
+LIDIA_LIBS = @LIDIA_LIBS@
+LINBOX_DOC_PATH = @LINBOX_DOC_PATH@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MAPLE_CFLAGS = @MAPLE_CFLAGS@
+MAPLE_HOME = @MAPLE_HOME@
+MAPLE_LIBS = @MAPLE_LIBS@
+MAPLE_VERSION = @MAPLE_VERSION@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NTL_CFLAGS = @NTL_CFLAGS@
+NTL_LIBS = @NTL_LIBS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+RM = @RM@
+SACLIB_CFLAGS = @SACLIB_CFLAGS@
+SACLIB_LIBS = @SACLIB_LIBS@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TESTS_CFLAGS = @TESTS_CFLAGS@
+VERSION = @VERSION@
+WARN = @WARN@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__leading_dot = @am__leading_dot@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = \
+	 coin.h     \
+	 hadamard.h \
+	 invhilb.h  \
+	 jmat.h     \
+	 minmax.h   \
+	 randomans.h\
+   	 randommat.h
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  --ignore-deps tests/matrix/Makefile'; \
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  --ignore-deps tests/matrix/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(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
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  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 $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-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
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+	-rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+	distclean distclean-generic distclean-libtool distdir dvi \
+	dvi-am html html-am info info-am install install-am \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	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/tests/matrix/coin.h b/tests/matrix/coin.h
new file mode 100644
index 0000000..66891c3
--- /dev/null
+++ b/tests/matrix/coin.h
@@ -0,0 +1,8 @@
+#ifndef _COIN_H
+#define _COIN_H
+
+#define CEILING 100
+#define R_CEILING 1000
+#define COMB_CEILING 10
+
+#endif
diff --git a/tests/matrix/hadamard.h b/tests/matrix/hadamard.h
new file mode 100644
index 0000000..ae27603
--- /dev/null
+++ b/tests/matrix/hadamard.h
@@ -0,0 +1,30 @@
+namespace LinBox{
+
+void isPower2(size_t n){
+	size_t p = 1;
+	while(p < n) p <<= 1;
+	if(p != n){} //  THROW ERROR };
+}
+
+template<class Ring, class Matrix>
+Matrix& hadamard(const Ring& R, Matrix& Mat, size_t n){
+	size_t val = 1;
+	typename Ring::Element tmp;
+
+	Mat.setEntry(0, 0, R.init(tmp, val));
+
+	for(size_t k = 1; k < n; k*=2){
+		for(size_t i = 0; i < k; ++i){
+			for(size_t j = 0; j < k; ++j){
+				Mat.getEntry(tmp, i, j);
+				Mat.setEntry(i+k, j, tmp);
+				Mat.setEntry(i, j+k, tmp);
+				Mat.setEntry(i+k, j+k, R.negin(tmp));
+			}
+		}
+	}
+
+	return Mat;
+}
+
+}
diff --git a/tests/matrix/invhilb.h b/tests/matrix/invhilb.h
new file mode 100644
index 0000000..1fb7818
--- /dev/null
+++ b/tests/matrix/invhilb.h
@@ -0,0 +1,32 @@
+#include<cstdlib>
+#include "linbox/integer.h"
+
+//#include<iostream>
+//using namespace std;
+namespace LinBox{
+
+template<class Ring, class Matrix>
+Matrix& invhilb(const Ring& R, Matrix& Mat, int n){
+	typedef typename Ring::Element Element;
+	
+	integer p = n;
+	integer r;
+	Element val;
+	int i, j, i_ind, j_ind;
+	for(i_ind=0, i = 1; i <= n; i++, i_ind++){
+		if(i>1) p = ((n-i+1)*p*(n+i-1))/((i-1)*(i-1));
+		r = p*p;	
+		R.init(val, (r/(2*i-1)));
+		Mat.setEntry(i_ind, i_ind, val);
+		for(j_ind=i, j = i+1; j <= n; j++, j_ind++){
+			r = -1*((n-j+1)*r*(n+j-1))/((j-1)*(j-1));
+			R.init(val, (r/(i+j-1)));
+			Mat.setEntry(i_ind, j_ind, val);
+			Mat.setEntry(j_ind, i_ind, val);
+		}
+	}
+
+	return Mat;
+}
+
+}
diff --git a/tests/matrix/jmat.h b/tests/matrix/jmat.h
new file mode 100644
index 0000000..c1ff0f9
--- /dev/null
+++ b/tests/matrix/jmat.h
@@ -0,0 +1,24 @@
+namespace LinBox{
+
+size_t lambda = 1000000000;
+
+template<class Ring, class Matrix>
+Matrix& jordanform(const Ring& R, Matrix& Mat, size_t n){
+	size_t val = 1;
+	typename Ring::Element one, lam;
+	R.init(one, val);
+	R.init(lam, lambda);
+
+	Mat.setEntry(0, 0, one);
+
+	for(size_t i = 0; i < n; ++i){
+		for(size_t j = 0; j < n; ++j){
+			if(i == j) Mat.setEntry(i, j, lam);
+			if(j+1 == i) Mat.setEntry(i, j, one);
+		}
+	}
+
+	return Mat;
+}
+
+}; //LinBox
diff --git a/tests/matrix/minmax.h b/tests/matrix/minmax.h
new file mode 100644
index 0000000..2c7b2ef
--- /dev/null
+++ b/tests/matrix/minmax.h
@@ -0,0 +1,52 @@
+namespace LinBox{
+
+template<class Ring, class Matrix>
+Matrix& minmat(const Ring& R, Matrix& Mat, size_t n){
+	size_t val;
+	typename Ring::Element tmp;
+
+	for(size_t i = 0; i < n; ++i){
+		for(size_t j = 0; j < n; ++j){
+			val = i < j ? i : j;
+			R.init(tmp, val+1);
+			Mat.setEntry(i, j, tmp);
+		}
+	}
+
+	return Mat;
+}
+
+template<class Ring, class Matrix>
+Matrix& maxmat(const Ring& R, Matrix& Mat, size_t n){
+	size_t val;
+	typename Ring::Element tmp;
+
+	for(size_t i = 0; i < n; ++i){
+		for(size_t j = 0; j < n; ++j){
+			val = i > j ? i : j;
+			R.init(tmp, val+1);
+			Mat.setEntry(i, j, tmp);
+		}
+	}
+
+	return Mat;
+}
+
+template<class Ring, class Matrix>
+Matrix& qlehmer(const Ring& R, Matrix& Mat, size_t n){
+	size_t val;
+	typename Ring::Element tmp;
+
+	for(size_t i = 0; i < n; ++i){
+		for(size_t j = 0; j < n; ++j){
+			val = i > j ? i : j;
+			val++;
+			R.init(tmp, val*val);
+			Mat.setEntry(i, j, tmp);
+		}
+	}
+
+	return Mat;
+}
+
+}; //LinBox
diff --git a/tests/matrix/randomans.h b/tests/matrix/randomans.h
new file mode 100644
index 0000000..20d5625
--- /dev/null
+++ b/tests/matrix/randomans.h
@@ -0,0 +1,75 @@
+//  randomans.h  - Random Almost NonSingular matrix
+
+#include<cstdlib>
+#include<vector>
+#include "coin.h"
+
+//#include<iostream>
+//using namespace std;
+
+namespace LinBox{
+
+template<class Ring, class Matrix>
+Matrix& randomAns(const Ring& R, Matrix& Mat, size_t n, size_t epr){
+	epr = epr > n ? n : epr;
+
+	int val, pos, neg;
+	vector<int> usedV(epr);
+	typename Ring::Element tmp;
+
+	srand(time(NULL));
+
+	//  build first n-1 rows
+	for(size_t i = 0; i < n-1; ++i) {
+		//std::cerr << "in row " << i << endl;
+		//  reset used vector
+		for(size_t q = 0; q < epr; ++q)
+			usedV[q] = -1;
+
+		//  epr elements per row
+		for(size_t k = 0; k < epr; ++k){
+			neg = 1;
+			if(rand()%2) neg = -1;
+			//  generate value in [0, ceiling)
+			val = neg*(rand()%CEILING);
+			//  choose random location for value
+			do{
+				pos = rand()%n;  // pos in [0, n)
+			}
+			while(used(usedV, pos));
+			usedV[k] = pos;  //  record location
+			
+			//std::cerr << "\t set value " << val << " in pos " << pos << std::endl;
+			//  finally, set entry
+			Mat.setEntry(i, pos, R.init(tmp, val));
+		}
+	}
+
+	//  to store each element in our final row
+	vector<typename Ring::Element> tmps(n);
+	for(size_t i=0; i<n; ++i)
+		R.init(tmps[i], 0);
+
+	//  build last row incorporate every row 
+	for(size_t i = 0; i < n-1; ++i){
+		neg = 1;
+		if(rand()%2) neg = -1;
+		val = neg*(rand()%COMB_CEILING);
+		//  val is the multiplier for this row
+		for(size_t j = 0; j < n; ++j){
+			R.axpyin(tmps[j], val, Mat.getEntry(i, j));
+		}
+	}
+	for(size_t i=0; i<n; ++i)
+		Mat.setEntry(n-1, i, tmps[i]);
+
+	//  add one to random value
+	size_t wildcard = rand()%n;	
+	R.init(tmp, Mat.getEntry(n-1, wildcard));
+	R.addin(tmp, 1);
+	Mat.setEntry(n-1, wildcard, tmp);
+			
+	return Mat;
+}
+
+}
diff --git a/tests/matrix/randommat.h b/tests/matrix/randommat.h
new file mode 100644
index 0000000..aff41bf
--- /dev/null
+++ b/tests/matrix/randommat.h
@@ -0,0 +1,57 @@
+#include "coin.h"
+#include<cstdlib>
+#include<vector>
+
+//#include<iostream>
+//using namespace std;
+
+namespace LinBox{
+
+bool used(vector<int> &array, int value){
+	vector<int>::iterator i;
+	for(i = array.begin(); i != array.end(); ++i)
+		if( (*i) == value ) return true;  //  already used location
+	return false;  //  used
+}
+
+template<class Ring, class Matrix>
+Matrix& randomMat(const Ring& R, Matrix& Mat, size_t n, size_t epr){
+
+	epr = epr > n ? n : epr;
+
+	int val, pos, neg;
+	vector<int> usedV(epr);
+	typename Ring::Element tmp;
+
+	//srand(time(NULL));
+
+	for(size_t i = 0; i < n; ++i) {
+		//std::cerr << "in row " << i << endl;
+		//  reset used vector
+		for(size_t q = 0; q < epr; ++q)
+			usedV[q] = -1;
+
+		//  epr elements per row
+		for(size_t k = 0; k < epr; ++k){
+			neg = 1;
+			if(rand()%2) neg = -1;
+			//  generate value in [0, ceiling)
+			val = neg*(rand()%CEILING);
+			//  choose random location for value
+			do{
+				pos = rand()%n;  // pos in [0, n)
+			}
+			while(used(usedV, pos));
+			usedV[k] = pos;  //  record location
+			
+			//std::cerr << "\t set value " << val << " in pos " << pos << std::endl;
+			//  finally, set entry
+			//Mat.setEntry(i, pos, R.init(tmp, 1));
+			Mat.setEntry(i, pos, R.init(tmp, val));
+		}
+	}
+			
+	return Mat;
+}
+
+}
diff --git a/tests/test-PID-integer.C b/tests/test-PID-integer.C
new file mode 100644
index 0000000..0486886
--- /dev/null
+++ b/tests/test-PID-integer.C
@@ -0,0 +1,66 @@
+/* -*- 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
+
+/* tests/test-PID-integer.C
+ * Copyright (C) 2011 Dave Saunders
+ *
+ * morphed from another test by Dave Saunders <saunders at cis.udel.edu>
+ *
+ * See COPYING for license information.
+ */
+
+/*! @file  tests/test-PID-integer.C
+ * @ingroup tests
+ * @brief run runFieldTests testRandomIterator tests on PID_integer
+ * @test run runFieldTests testRandomIterator tests on PID_integer
+ */
+
+
+#include "linbox/linbox-config.h"
+
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <vector>
+#include <queue>
+
+#include "test-common.h"
+#include "test-field.h"
+
+#include "linbox/field/PID-integer.h"
+
+using namespace LinBox;
+
+int main (int argc, char **argv)
+{
+	static size_t n = 10000;
+	static int iterations = 1;
+	static int trials = 100000;
+	static int categories = 100;
+	static int hist_level = 1;
+
+	static Argument args[] = {
+		{ 'n', "-n N", "Set dimension of test vectors to NxN.", TYPE_INT,     &n },
+		{ 't', "-t T", "Number of trials for the random iterator test.", TYPE_INT, &trials },
+		{ 'c', "-c C", "Number of categories for the random iterator test.", TYPE_INT, &categories },
+		{ 'H', "-H H", "History level for random iterator test.", TYPE_INT, &hist_level },
+		END_OF_ARGUMENTS
+	};
+
+	parseArguments (argc, argv, args);
+
+	commentator.start("PID-integer ring test suite", "PID-integer");
+	bool pass = true;
+
+	PID_integer ZZ;
+
+	// Make sure some more detailed messages get printed
+	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (4);
+	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
+
+	if (!runBasicRingTests (ZZ,  "PID-integer",  iterations, false)) pass = false;
+//	if (!testRandomIterator (ZZ,  "PID-integer", trials, categories, hist_level)) pass = false;
+
+	commentator.stop("PID-integer, field test suite");
+	return pass ? 0 : -1;
+}
diff --git a/tests/test-bitonic-sort.C b/tests/test-bitonic-sort.C
old mode 100755
new mode 100644
index c2be10d..a56254e
--- a/tests/test-bitonic-sort.C
+++ b/tests/test-bitonic-sort.C
@@ -1,7 +1,35 @@
-/* File: test-bitonic-sort.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
+/* Copyright (C) LinBox
+ *
  *  Author: Zhendong Wan
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
 
+
+/*! @file  tests/test-bitonic-sort.C
+ * @ingroup tests
+ * @brief no doc.
+ * @test NO DOC
+ */
+
+
+
 #include <algorithm>
 #include <linbox/algorithms/bitonic-sort.h>
 #include <linbox/util/commentator.h>
@@ -9,10 +37,9 @@
 #include "test-common.h"
 
 using namespace LinBox;
- 
-class Comparator {
 
-	public:
+class Comparator {
+public:
 
 	void operator()(int& min, int& max) const {
 
@@ -23,11 +50,12 @@ class Comparator {
 
 };
 
-bool testRandom (std::ostream& report, int s, int iteration) {
- 
+bool testRandom (std::ostream& report, int s, int iteration)
+{
+
 	using namespace std;
-	
-        commentator.start ("test bitonic sort", "test bitonic sort", iteration);
+
+	commentator.start ("test bitonic sort", "test bitonic sort", iteration);
 
 	bool iter_passed = true;
 	bool ret = true;
@@ -37,110 +65,111 @@ bool testRandom (std::ostream& report, int s, int iteration) {
 	for (int i = 0; i < iteration; ++ i) {
 
 		commentator.startIteration (i);
-	
+
 		std::vector<int> v(s), d(s);
 
-	
+
 		std::vector<int>::iterator p1, p2;
 
-		
-		for (p1 = v. begin(), p2 = d.begin(); p1 != v.end(); ++ p1, ++p2) 
-			
+
+		for (p1 = v. begin(), p2 = d.begin(); p1 != v.end(); ++ p1, ++p2)
+
 			*p1 = *p2 = rand();
-		
+
 		report << "Input vector:  ";
-	
+
 
 		for (p1 = v.begin(); p1 != v.end(); ++ p1)
 
 			report << *p1 << " ";
-		
+
 		report << endl;
 
 
 		bitonicSort(v.begin(), v.end(), comp);
 
-		
+
 
 		report << "Computed sequence by bitonic sorting network:\n";
-		
-		
+
+
 		for (p1 = v.begin(); p1 != v.end(); ++ p1)
 
 			report << *p1 << " ";
-		
+
 		report << '\n';
 
 		stable_sort(d.begin(), d.end());
-	
+
 		report << "Expected sequence after sorting:\n";
-		
-		
+
+
 		for (p1 = d.begin(); p1 != d.end(); ++ p1)
 
 			report << *p1 << " ";
-		
+
 		report << '\n';
-	
-	
 
-		for (p1 = v.begin(), p2 = d. begin(); p1 != v.end(); ++ p1, ++ p2) 
+
+
+		for (p1 = v.begin(), p2 = d. begin(); p1 != v.end(); ++ p1, ++ p2)
 
 			if (*p1 != *p2) {
-		
+
 				ret = iter_passed = false;
 
 				break;
 			}
-	
-		if (!iter_passed) 
-		
-		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+
+		if (!iter_passed)
+
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
 			<< "ERROR: Computed Smith form is incorrect" << endl;
-		
-	
-		
+
+
+
 		commentator.stop ("done");
-		
+
 		commentator.progress ();
-	
+
 	}
-	 
-	
-	  commentator.stop (MSG_STATUS (ret), (const char *) 0, "testRandom");
-                                                                                                        
-	  return ret;
+
+
+	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testRandom");
+
+	return ret;
 
 }
 
-int main(int argc, char** argv) {
-                                                                                                        
-        using namespace LinBox;
-                                                                                                        
-        bool pass = true;
-                                                                                                        
-        static size_t n = 512;
-                                                                                                        
-        static int iterations = 2;
-                                                                                                        
-        static Argument args[] = {
-                { 'n', "-n N", "Set size of sequence to N.  N must be a power of 2)",  TYPE_INT,     &n },
-                { 'i', "-i I", "Perform each test for I iterations"
-,           TYPE_INT,     &iterations },
-				{ '\0' }
-        };
-                                                                                                        
-                                                                                                        
-        parseArguments (argc, argv, args);
-                                                                                                        
+int main(int argc, char** argv)
+{
+
+	using namespace LinBox;
+
+	bool pass = true;
+
+	static size_t n = 512;
+
+	static int iterations = 2;
+
+	static Argument args[] = {
+		{ 'n', "-n N", "Set size of sequence to N.  N must be a power of 2)",  TYPE_INT,     &n },
+		{ 'i', "-i I", "Perform each test for I iterations"
+			,           TYPE_INT,     &iterations },
+		END_OF_ARGUMENTS
+	};
+
+
+	parseArguments (argc, argv, args);
+
 	commentator.start("Sort network test suite", "bitonic sort");
 	std::ostream& report = commentator.report();
-    commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (5);
+	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (5);
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
 
 	if (!testRandom(report, n, iterations)) pass = false;
 	commentator.stop("sort network test suite");
 
-        return pass ? 0 : -1;
-                                                                                                        
+	return pass ? 0 : -1;
+
 }
diff --git a/tests/test-blackbox.h b/tests/test-blackbox.h
index face81b..7231ed8 100644
--- a/tests/test-blackbox.h
+++ b/tests/test-blackbox.h
@@ -1,5 +1,5 @@
-/* -*- mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-
+/* -*- 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
 /* linbox/tests/test-blackbox.h
  * Copyright (C) 2001, 2002 Bradford Hovinen
  *
@@ -16,8 +16,8 @@
  * See COPYING for license information.
  */
 
-#ifndef __TEST_BLACKBOX_H
-#define __TEST_BLACKBOX_H
+#ifndef __LINBOX_test_blackbox_H
+#define __LINBOX_test_blackbox_H
 
 #include <iostream>
 #include <vector>
@@ -29,11 +29,11 @@
 #include "linbox/vector/vector-domain.h"
 #include "linbox/blackbox/dense.h"
 
-#include "test-common.h" 
+#include "test-common.h"
 
 using namespace std;
 
-// Generic tests for black boxes 
+// Generic tests for black boxes
 /// testBlackbox combines testTranspose and testLinearity
 
 /** Random check that (u^T A) v = u^T (A v).
@@ -54,9 +54,9 @@ using namespace std;
 template <class Field, class Blackbox, class Vector>
 static bool
 testTranspose (Field                             &F,
-			   Blackbox							 &A,
-			   LinBox::VectorStream<Vector>      &stream1,
-			   LinBox::VectorStream<Vector>      &stream2) 
+	       Blackbox							 &A,
+	       LinBox::VectorStream<Vector>      &stream1,
+	       LinBox::VectorStream<Vector>      &stream2)
 {
 	bool ret = true;
 
@@ -102,7 +102,7 @@ testTranspose (Field                             &F,
 		if (!F.areEqual (r1, r2)) {
 			ret = false;
 			LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: Values are not equal" << endl;
+			<< "ERROR: Values are not equal" << endl;
 		}
 
 		LinBox::commentator.stop ("done");
@@ -129,7 +129,7 @@ static bool
 testLinearity (Field                             &F,
 	       BB 				 &A,
 	       LinBox::VectorStream<Vector>      &stream1,
-	       LinBox::VectorStream<Vector>      &stream2) 
+	       LinBox::VectorStream<Vector>      &stream2)
 {
 	bool ret = true, iter_passed;
 
@@ -177,7 +177,7 @@ testLinearity (Field                             &F,
 		VD.axpy ( AxpaAy, alpha, Ay, Ax);
 
 		VD.write( report << "   x+alpha y = ", xpay) << endl;
- 
+
 		VD.write( report << "A(x+alpha y) = ", Axpay) << endl;
 
 		VD.write( report << "          Ax = ", Ax) << endl;
@@ -191,7 +191,7 @@ testLinearity (Field                             &F,
 
 		if (!iter_passed)
 			LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: Vectors are not equal" << endl;
+			<< "ERROR: Vectors are not equal" << endl;
 
 		LinBox::commentator.stop ("done");
 		LinBox::commentator.progress ();
@@ -201,13 +201,13 @@ testLinearity (Field                             &F,
 }
 
 /** Generic blackbox test 4: combination of tests
- * 
+ *
  * Call testTranspose and testLinearity.
  * If large, time apply and applyTranspose.
  * if small, call testSmallBlackbox.
  */
-template <class BB> 
-static bool 
+template <class BB>
+static bool
 testBlackbox(BB &A)
 {
 	size_t largeThresh = 2000; // Above it do timing of apply and applyTr.
@@ -215,7 +215,7 @@ testBlackbox(BB &A)
 	typedef std::vector<typename Field::Element> DenseVector;
 	std::ostream &report = LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
 	report << "testBlackbox on " << A.rowdim() << " by " << A.coldim() << " matrix." << endl;
-	
+
 	LinBox::commentator.setMaxDepth(-1);
 	bool ret = true;
 	typename BB::Field F = A.field();
@@ -226,63 +226,63 @@ testBlackbox(BB &A)
 		for(size_t i = 0; i < A.coldim(); ++i) F.init(x[i], i);
 		for(size_t i = 0; i < A.rowdim(); ++i) F.init(y[i], i);
 		//A.apply(y, x);
-		
+
 		if (A.coldim() >= largeThresh)
-			{
-				LinBox::commentator.start ("\t--Timing Test (Av)","testApply", 1);
-				A.apply(y, x);
-				LinBox::commentator.stop (MSG_STATUS (true), (const char *) 0, "testApply");
-			}
-		
+		{
+			LinBox::commentator.start ("\t--Timing Test (Av)","testApply", 1);
+			A.apply(y, x);
+			LinBox::commentator.stop (MSG_STATUS (true), (const char *) 0, "testApply");
+		}
+
 		if (A.rowdim() >= largeThresh)
-			{
-				LinBox::commentator.start ("\t--Timing Test(v^T A)", 
-										   "testApplyTranspose", 1);
-				A.applyTranspose(x, y);
-				LinBox::commentator.stop (MSG_STATUS (true), (const char *) 0, "testApplyTranspose");
-			}
-		
+		{
+			LinBox::commentator.start ("\t--Timing Test(v^T A)",
+						   "testApplyTranspose", 1);
+			A.applyTranspose(x, y);
+			LinBox::commentator.stop (MSG_STATUS (true), (const char *) 0, "testApplyTranspose");
+		}
+
 	} // timing test block
-	
-#if 1 
-	size_t iterations = 2; 
+
+#if 1
+	size_t iterations = 1;
 	typename Field::RandIter r(F);
-	LinBox::RandomDenseStream<Field, DenseVector> stream1 (F, r, A.rowdim(), iterations); 
-	typename Field::Element x; 
+	LinBox::RandomDenseStream<Field, DenseVector> stream1 (F, r, A.rowdim(), iterations);
+	typename Field::Element x;
 	r.random(x);
-	LinBox::RandomDenseStream<Field, DenseVector> stream2 (F, r, A.coldim(), iterations); 
+	LinBox::RandomDenseStream<Field, DenseVector> stream2 (F, r, A.coldim(), iterations);
 
 	LinBox::commentator.start ("\t--Testing A(ax+y) = a(Ax) + (Ay)", "testLinearity", 1);
 	ret = ret && testLinearity (F, A, stream1, stream2);
-	
-	LinBox::commentator.stop (MSG_STATUS (ret), 
-							  (const char *) 0, "testLinearity");
-	
-	LinBox::commentator.start ("\t--Testing u^T(Av) = (u^T A)v", 
-							   "testTranspose", 1);
-	
-	LinBox::RandomDenseStream<Field, DenseVector> stream3 (F, r, A.rowdim(), iterations); 
-	LinBox::RandomDenseStream<Field, DenseVector> stream4 (F, r, A.coldim(), iterations); 
-
-	ret = ret && testTranspose (F, A, stream3, stream4); 
-	LinBox::commentator.stop (MSG_STATUS (ret), 
-							  (const char *) 0, "testTranspose");
-	
+
+	LinBox::commentator.stop (MSG_STATUS (ret),
+				  (const char *) 0, "testLinearity");
+
+	LinBox::commentator.start ("\t--Testing u^T(Av) = (u^T A)v",
+				   "testTranspose", 1);
+
+	LinBox::RandomDenseStream<Field, DenseVector> stream3 (F, r, A.rowdim(), iterations);
+	LinBox::RandomDenseStream<Field, DenseVector> stream4 (F, r, A.coldim(), iterations);
+
+	ret = ret && testTranspose (F, A, stream3, stream4);
+	LinBox::commentator.stop (MSG_STATUS (ret),
+				  (const char *) 0, "testTranspose");
+
 #endif
-	
+
 	return ret;
 }
- 
+
 /** Generic blackbox test 5: test several sizes
- * 
+ *
  * Call testTranspose and testLinearity.
  * If large, time apply and applyTranspose.
  * if small, call test
-SmallBlackbox.
+ SmallBlackbox.
  */
-template <class Field, class Blackbox> 
-static bool 
-testBB(Field& F) 
+template <class Field, class Blackbox>
+static bool
+testBB(Field& F)
 {
 	bool pass = true;
 
@@ -296,4 +296,4 @@ testBB(Field& F)
 	return pass;
 }
 
-#endif // __TEST_BLACKBOX_H
+#endif // __LINBOX_test_blackbox_H
diff --git a/tests/test-blas-domain.C b/tests/test-blas-domain.C
index 3239ae6..abc43a2 100644
--- a/tests/test-blas-domain.C
+++ b/tests/test-blas-domain.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-blas-domain.C
  * Copyright (C) 2004 Pascal Giorgi
@@ -11,6 +12,15 @@
  *
  *
  */
+
+
+/*! @file  tests/test-blas-domain.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test NO DOC
+ */
+
+
  // where is this used?
 #define __MINP_CONSTRUCT
 #include "linbox/linbox-config.h"
@@ -25,6 +35,10 @@
 #include <linbox/randiter/nonzero.h>
 #include <linbox/util/commentator.h>
 #include <linbox/algorithms/blas-domain.h>
+#include "linbox/field/PID-integer.h"
+// #include "linbox/algorithms/matrix-hom.h"
+
+#include "linbox/matrix/random-matrix.h"
 
 #include <vector>
 
@@ -36,7 +50,8 @@ const int maxpretty = 35;
 
 string blank;
 
-const char* pretty(string a) {
+const char* pretty(string a)
+{
 
 	blank = "     " + a;
 	int msgsize= maxpretty - blank.size();
@@ -49,7 +64,8 @@ const char* pretty(string a) {
 
 
 template <class Field>
-static bool testMulAdd (const Field& F, size_t n, int iterations) {
+static bool testMulAdd (const Field& F, size_t n, int iterations)
+{
 
 	typedef typename Field::Element     Element;
 	typedef typename Field::RandIter   RandIter;
@@ -59,21 +75,21 @@ static bool testMulAdd (const Field& F, size_t n, int iterations) {
 	mycommentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
 	mycommentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
 	mycommentator.start (pretty("Testing muladd"),"testMulAdd",iterations);
-	
+
 	RandIter G(F);
 	bool ret = true;
 	BlasMatrixDomain<Field> BMD(F);
 	MatrixDomain<Field>      MD(F);
 	VectorDomain<Field>      VD(F);
-	
+
 	for (int k=0;k<iterations; ++k) {
-    
+
 		mycommentator.progress(k);
 		Matrix A(n,n),B(n,n),C(n,n),D(n,n),T(n,n),R(n,n);
 		std::vector<Element> x(n),y(n),z(n),t(n);
 
 		Element alpha, beta,malpha,tmp;
-		
+
 
 		// Create 3 random n*n matrices
 		for (size_t i=0;i<n;++i)
@@ -87,23 +103,23 @@ static bool testMulAdd (const Field& F, size_t n, int iterations) {
 		for (size_t i=0;i<n;++i) {
 			G.random(x[i]);
 			G.random(y[i]);
-		}			
+		}
 
 		// create 2 random element
 		G.random(alpha);
 		G.random(beta);
-	
+
 		F.neg(malpha,alpha);
 
 		// compute D = -alpha.(A*C+B*C) + alpha.(A+B)*C
-		
+
 		BMD.mul(D,A,C);
 		BMD.mul(T,B,C);
 		MD.addin(D,T);
-		
+
 		MD.add(T,A,B);
 		BMD.muladd(R,malpha,D,alpha,T,C);
-		
+
 		if (!MD.isZero(R))
 			ret=false;
 
@@ -120,12 +136,386 @@ static bool testMulAdd (const Field& F, size_t n, int iterations) {
 		if (!VD.areEqual(t,z))
 			ret=false;
 	}
-	
+
 	mycommentator.stop(MSG_STATUS (ret), (const char *) 0, "testMulAdd");
-	
+
 	return ret;
 }
 
+// computes D = alpha A B + beta C on integers and check the result is ok mod p.
+// actually we check the mod p muladd here...
+bool CheckMulAdd( const Integer & alpha , const BlasMatrix<Integer> & A , const BlasMatrix<Integer> & B , const Integer & beta , const BlasMatrix<Integer> & C)
+{
+
+	size_t M = C.rowdim();
+	size_t N = C.coldim();
+
+	typedef Modular<double>       ModularField ;
+	typedef ModularField::Element      Element ;
+
+	PID_integer ZZ ;
+	MatrixDomain<PID_integer> ZMD(ZZ);
+
+	BlasMatrix<Integer> D(M,N);
+
+	Integer p = Integer::random_between(10,12) ;
+	nextprime(p,p); //!@bug si p n'est pas premier, fgemm fait n'importe quoi (division par alpha)
+	ModularField Zp (p);
+
+	BlasMatrixDomain<ModularField> BMD (Zp);
+	MatrixDomain<ModularField>      MD (Zp);
+
+	// Ep = b C + a A B
+	ZMD.muladd(D,beta,C,alpha,A,B);
+	BlasMatrix<Element> Dp(D,Zp); // D mod p
+
+	BlasMatrix<Element> Ap(A,Zp);
+	BlasMatrix<Element> Bp(B,Zp);
+	BlasMatrix<Element> Cp(C,Zp);
+	// BlasMatrix<Element> Ap(A.rowdim(),A.coldim());
+	// BlasMatrix<Element> Bp(B.rowdim(),B.coldim());
+	// BlasMatrix<Element> Cp(C.rowdim(),C.coldim());
+	// MatrixHom::map(Ap,A,Zp);
+	// MatrixHom::map(Bp,B,Zp);
+	// MatrixHom::map(Cp,C,Zp);
+	BlasMatrix<Element> Ep(M,N);  // D mod p
+
+	Element ap, bp ;
+	Zp.init(ap,alpha);
+	Zp.init(bp,beta);
+
+	// Ep = bp Cp + ap Ap Bp mod p
+	BMD.muladd(Ep,bp,Cp,ap,Ap,Bp);
+
+	bool pass = MD.areEqual(Ep,Dp);
+	if (!pass) {
+#if 0
+		std::cout << "#########################################" << std::endl;
+		std::cout << "p := " << p << ';' << std::endl;
+		std::cout << "ap,bp := " << ap << ',' << bp << ';' << std::endl;
+		Ap.write(std::cout << "Ap :=", true) << ";" << std::endl;
+		Bp.write(std::cout << "Bp :=", true) << ";" << std::endl;
+		Cp.write(std::cout << "Cp :=", true) << ";" << std::endl;
+		Dp.write(std::cout << "Dp :=", true) << ";" << std::endl;
+		Ep.write(std::cout << "Ep :=", true) << ";" << std::endl;
+		std::cout << "alpha,beta := " << alpha << ',' << beta << ';' << std::endl;
+		A.write(std::cout << "A :=",true) << ';' << std::endl;
+		B.write(std::cout << "B :=",true) << ';' << std::endl;
+		C.write(std::cout << "C :=",true) << ';' << std::endl;
+		D.write(std::cout << "E :=",true) << ';' << std::endl;
+		std::cout << "evalm(E-alpha*A.B-beta*C);" << std::endl;
+		std::cout << "#########################################" << std::endl;
+#endif
+		mycommentator.report() << " *** BMD ERROR (" << alpha << ',' << beta << ") *** " << std::endl;
+	}
+
+	// Ep = bp Cp + ap Ap Bp mod p
+	MD.muladd(Ep,bp,Cp,ap,Ap,Bp);
+	bool all = MD.areEqual(Ep,Dp);
+	if (!all) {
+		mycommentator.report() << " *** MD ERROR *** " << std::endl;
+	}
+
+	return pass&all ;
+
+}
+
+// tests MulAdd for various parameters alpha and beta.
+template <class Field>
+static bool testMulAddAgain (const Field& , size_t n, int iterations)
+{
+
+	typedef BlasMatrix<Integer>         IMatrix;
+
+	//Commentator mycommentator;
+	mycommentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
+	mycommentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
+	mycommentator.start (pretty("Testing muladd again"),"testMulAddAgain",iterations);
+
+	bool ret = true;
+
+	size_t ll = 17 ;
+	Integer::seeding();
+#if 0
+	size_t lA = 15 ;
+	size_t lB = 18 ;
+	size_t lC = 19 ;
+
+	PID_integer ZZ ;
+
+	typedef RandomIntegerIter<>                       IntRandIter ;
+	typedef RandomDenseMatrix<IntRandIter, PID_integer > IntRand_t;
+
+	IntRandIter RA(lA);
+	IntRandIter RB(lB);
+	IntRandIter RC(lC);
+
+	IntRand_t Arand (ZZ,RA);
+	IntRand_t Brand (ZZ,RB);
+	IntRand_t Crand (ZZ,RC);
+#endif
+
+	for (int k=0;k<iterations; ++k) {
+
+		mycommentator.progress(k);
+		IMatrix A(n,n),B(n,n),C(n,n),D(n,n),E(n,n);
+
+		Integer a , b;
+#if 0
+		Arand.random<IMatrix>(A);
+		Brand.random<IMatrix>(B);
+		Crand.random<IMatrix>(C);
+#endif
+		for (size_t i=0;i<n;++i)
+			for (size_t j=0;j<n;++j){
+				A.setEntry(i,j,Integer::random());
+				B.setEntry(i,j,Integer::random());
+				C.setEntry(i,j,Integer::random());
+			}
+
+		a = 1 ; b = 1 ;
+		if (!CheckMulAdd(a,A,B,b,C)) ret = false ;
+		a = 1 ; b = -1 ;
+		if (!CheckMulAdd(a,A,B,b,C)) ret = false ;
+		a = -1 ; b = 1 ;
+		if (!CheckMulAdd(a,A,B,b,C)) ret = false ;
+		a = -1 ; b = -1 ;
+		if (!CheckMulAdd(a,A,B,b,C)) ret = false ;
+		a = 0 ; b = 1 ;
+		if (!CheckMulAdd(a,A,B,b,C)) ret = false ;
+		a = 1 ; b = 0 ;
+		if (!CheckMulAdd(a,A,B,b,C)) ret = false ;
+		a = 0 ; b = -1 ;
+		if (!CheckMulAdd(a,A,B,b,C)) ret = false ;
+		a = -1 ; b = 0 ;
+		if (!CheckMulAdd(a,A,B,b,C)) ret = false ;
+		a = Integer::random<false>(ll) ; b = 1 ;
+		if (!CheckMulAdd(a,A,B,b,C)) ret = false ;
+		a =Integer::random<false>(ll) ; b = -1 ;
+		if (!CheckMulAdd(a,A,B,b,C)) ret = false ;
+		a =  1 ; b = Integer::random<false>(ll) ;
+		if (!CheckMulAdd(a,A,B,b,C)) ret = false ;
+		a = -1 ; b = Integer::random<false>(ll) ;
+		if (!CheckMulAdd(a,A,B,b,C)) ret = false ;
+		a = 0 ; b = Integer::random<false>(ll) ;
+		if (!CheckMulAdd(a,A,B,b,C)) ret = false ;
+		a = Integer::random<false>(ll) ; b = 0 ;
+		if (!CheckMulAdd(a,A,B,b,C)) ret = false ;
+		a = Integer::random<false>(ll) ; b = Integer::random<false>(ll) ;
+		if (!CheckMulAdd(a,A,B,b,C)) ret = false ;
+
+	}
+
+
+	mycommentator.stop(MSG_STATUS (ret), (const char *) 0, "testMulAddAgain");
+
+	return ret;
+}
+
+// tests MulAdd for various shapes and values of transposition.
+template <class Field>
+static bool testMulAddShapeTrans (const Field &F, size_t m, size_t n, size_t k, int iterations)
+{
+	bool ret = true ;
+	mycommentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
+	mycommentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
+	mycommentator.start (pretty("Testing muladd for shapes and transposition"),"testMulAddShapeTrans",iterations);
+
+
+	typedef typename Field::Element Element;
+	typedef BlasMatrix<Element> Matrix ;
+	typedef TransposedBlasMatrix<Matrix> TransposedMatrix ;
+	typedef typename Field::RandIter Randiter ;
+	Randiter R(F) ;
+	RandomDenseMatrix<Randiter,Field> RandMat(F,R);
+
+	BlasMatrixDomain<Field> BMD (F);
+	MatrixDomain<Field>      MD (F);
+
+	// input matrix
+	Matrix A(m,k);
+	Matrix B(k,n);
+	Matrix C(m,n);
+	// result matrix
+	Matrix D(m,n);
+	Matrix E(m,n);
+
+	// random A,B
+	RandMat.random(A);
+	RandMat.random(B);
+	RandMat.random(C);
+
+	// hard tranpose A,B
+	Matrix A1 (k,m) ;
+	A.transpose(A1) ;
+	Matrix B1 (n,k) ;
+	B.transpose(B1) ;
+	TransposedMatrix tA(A1); // t(tA)=A
+	TransposedMatrix tB(B1); // t(tB)=B
+
+	// random alpha, beta
+	Element alpha ;
+	do {R.random(alpha);} while (F.isZero(alpha)); // nonzerorandom
+
+	Element beta ;
+	R.random(beta);
+
+	// témoin.
+	MD.muladd(D,beta,C,alpha,A,B);
+
+	// A,B
+	BMD.muladd(E,beta,C,alpha,A,B);
+	if (!MD.areEqual(E,D)) {
+		ret = false ;
+		mycommentator.report() << " *** BMD ERROR (" << alpha << ',' << beta << ") (noTrans, noTrans) *** " << std::endl;
+	}
+
+	BMD.muladd(E,beta,C,alpha,A,tB);
+	if (!MD.areEqual(E,D))  {
+		ret = false ;
+		mycommentator.report() << " *** BMD ERROR (" << alpha << ',' << beta << ") (noTrans, Trans) *** " << std::endl;
+	}
+
+	BMD.muladd(E,beta,C,alpha,tA,B);
+	if (!MD.areEqual(E,D)) {
+		ret = false ;
+		mycommentator.report() << " *** BMD ERROR (" << alpha << ',' << beta << ") (Trans, noTrans) *** " << std::endl;
+	}
+
+	BMD.muladd(E,beta,C,alpha,tA,tB);
+	if (!MD.areEqual(E,D)) {
+		ret = false ;
+		mycommentator.report() << " *** BMD ERROR (" << alpha << ',' << beta << ") (Trans, Trans) *** " << std::endl;
+	}
+
+
+	mycommentator.stop(MSG_STATUS (ret), (const char *) 0, "testMulAddShapeTrans");
+	return ret ;
+}
+
+// tests MulAdd for various shapes and values of transposition.
+template<class Field, bool LeftSide, bool UnitDiag>
+static bool testTriangMulShapeTrans (const Field &F, size_t m, size_t n, int iterations)
+{
+	bool ret = true ;
+	mycommentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
+	mycommentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
+	mycommentator.start (pretty("Testing triangular matmul for shapes and transposition"),"testTriangMulShapeTrans",iterations);
+
+
+	typedef typename Field::Element                               Element;
+	typedef BlasMatrix<Element>                                   Matrix ;
+	typedef TriangularBlasMatrix<Element>               TriangularMatrix ;
+	typedef TransposedBlasMatrix<Matrix>                TransposedMatrix ;
+	typedef TransposedBlasMatrix<TriangularMatrix > TransposedTriangular ;
+	typedef typename Field::RandIter                            Randiter ;
+	Randiter R(F) ;
+	RandomDenseMatrix<Randiter,Field> RandMat(F,R);
+
+	Element one ;
+	F.init(one,1);
+
+	BlasMatrixDomain<Field> BMD (F);
+	MatrixDomain<Field>      MD (F);
+
+	int k = LeftSide?m:n ;
+	// input matrix
+	Matrix A(k,k); // A = L+U-I. Either L or U is unit.
+	Matrix B(m,n);
+	// result matrix
+	Matrix D(m,n);
+	Matrix E(m,n);
+
+	// random A,B
+	RandMat.random(A);
+	RandMat.random(B);
+
+	// hard tranpose A,B
+	Matrix A1 (k,k) ;
+	A.transpose(A1) ;
+
+
+
+	/*  test (L+U-I) B+B = LB+UB */
+	if (LeftSide)
+		BMD.muladd(D,one,B,one,A,B);
+	else
+		BMD.muladd(D,one,B,one,B,A);
+
+	/****  DIRECT ****/
+	{
+		/*  L */
+		TriangularMatrix L (A, BlasTag::low,
+				    (UnitDiag?BlasTag::unit:BlasTag::nonunit));
+
+		/*  U */
+		TriangularMatrix U (A, BlasTag::up,
+				    (!UnitDiag?BlasTag::unit:BlasTag::nonunit));
+
+		/*  make product */
+		E = B ;
+		// Matrix G(m,n);
+		// G = E ;
+		Matrix G((const Matrix&)E); //!@warning on n'oublie pas l'esperluette !!!
+		if(LeftSide) {
+			BMD.mulin_right(L,E) ; // B <- AB
+			BMD.mulin_right(U,G) ;
+		}
+		else {
+			BMD.mulin_left(G,L) ;  // B <- BA
+			BMD.mulin_left(E,U) ;
+		}
+		BMD.addin(E,G);
+
+		/*  check equality */
+		if (!MD.areEqual(E,D)) {
+			ret = false ;
+			mycommentator.report() << " *** BMD ERROR (" << (LeftSide?"left":"right") << ',' << (UnitDiag?" L":" U") << " is unit) *** " << std::endl;
+		}
+		else {
+			mycommentator.report() << " direct triangular multiplication ok." << std::endl;
+		}
+	}
+	/****  Transpose ****/
+	{
+		/*  L */
+		TriangularMatrix L1 (A1, BlasTag::low,
+				    (UnitDiag?BlasTag::unit:BlasTag::nonunit));
+
+		/*  U */
+		TriangularMatrix U1 (A1, BlasTag::up,
+				    (!UnitDiag?BlasTag::unit:BlasTag::nonunit));
+
+		TransposedTriangular L(L1);
+		TransposedTriangular U(U1);
+		/*  make product */
+		E = B ;
+		// Matrix G(m,n);
+		// G = E ;
+		Matrix G((const Matrix&)E); //!@warning on n'oublie pas l'esperluette !!!
+		if(LeftSide) {
+			BMD.mulin_right(L,E) ; // B <- AB
+			BMD.mulin_right(U,G) ;
+		}
+		else {
+			BMD.mulin_left(G,L) ;  // B <- BA
+			BMD.mulin_left(E,U) ;
+		}
+		BMD.addin(E,G);
+
+		/*  check equality */
+		if (!MD.areEqual(E,D)) {
+			ret = false ;
+			mycommentator.report() << " *** BMD ERROR Transpose (" << (LeftSide?"left":"right") << ',' << (UnitDiag?" L":" U") << " is unit) *** " << std::endl;
+		}
+		else {
+			mycommentator.report() << " transposed triangular multiplication ok." << std::endl;
+		}
+	}
+
+	mycommentator.stop(MSG_STATUS (ret), (const char *) 0, "testMulAddShapeTrans");
+	return ret ;
+}
 
 
 /*
@@ -133,7 +523,8 @@ static bool testMulAdd (const Field& F, size_t n, int iterations) {
  *  construct a n*n matrices of rank r and compute the rank
  */
 template <class Field>
-static bool testRank (const Field& F,size_t n, int iterations) {
+static bool testRank (const Field& F,size_t n, int iterations)
+{
 
 	typedef typename Field::Element Element;
 	typedef typename Field::RandIter RandIter;
@@ -144,43 +535,49 @@ static bool testRank (const Field& F,size_t n, int iterations) {
 	mycommentator.start (pretty("Testing rank"),"testRank",iterations);
 
 	RandIter G(F);
-	NonzeroRandIter<Field> Gn(F,G); 
+	NonzeroRandIter<Field> Gn(F,G);
 	Element tmp;
 	unsigned int r;
 	bool ret = true;
 	BlasMatrixDomain<Field> BMD(F);
 
 	for (int k=0;k<iterations; ++k) {
-    
+
 		mycommentator.progress(k);
 		BlasMatrix<Element> A(n,n),S(n,n), L(n,n);
-     
-		r = rand() % n;
+
+		r = random() % n;
 		// create S as an upper triangular matrix with r nonzero rows
 		for (size_t i=0;i<r;++i){
 			S.setEntry(i,i,Gn.random(tmp));
-			for (size_t j=i+1;j<n;++j)     
+			for (size_t j=i+1;j<n;++j)
 				S.setEntry(i,j,G.random(tmp));
 		}
-     
+                BMD.write(commentator.report(), S) << std::endl;
+
+
 		// create L as a lower triangular matrix with nonzero elements on the diagonal
 		for (size_t i=0;i<n;++i){
 			for (size_t j=0;j<i;++j)
 				L.setEntry(i,j,G.random(tmp));
 			L.setEntry(i,i,Gn.random(tmp));
 		}
-     
+                BMD.write(commentator.report(), L) << std::endl;
+
 		//  compute A=LS
 		BMD.mul(A,L,S);
-     
+                BMD.write(commentator.report(), A) << std::endl;
+
 		// compute the rank of A
 		unsigned int rank= BMD.rankin(A);
+		commentator.report() << "Rank " << rank << " should be " << r << std::endl;
+
 		if (rank!=r)
 			ret=false;
 	}
-  	
+
 	mycommentator.stop(MSG_STATUS (ret), (const char *) 0, "testRank");
-    
+
 	return ret;
 }
 
@@ -190,18 +587,19 @@ static bool testRank (const Field& F,size_t n, int iterations) {
  *  construct a n*n matrices of determinant d and compute the determinant
  */
 template <class Field>
-static bool testDet (const Field& F,size_t n, int iterations) {
+static bool testDet (const Field& F,size_t n, int iterations)
+{
 
 	typedef typename Field::Element Element;
 	typedef typename Field::RandIter RandIter;
-  
+
 	//Commentator mycommentator;
 	mycommentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
 	mycommentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
 	mycommentator.start (pretty("Testing determinant"),"testDet",iterations);
 
 	RandIter G(F);
-	NonzeroRandIter<Field> Gn(F,G); 
+	NonzeroRandIter<Field> Gn(F,G);
 	Element tmp,One,d;
 	F.init(One,1UL);
 
@@ -209,22 +607,22 @@ static bool testDet (const Field& F,size_t n, int iterations) {
 	BlasMatrixDomain<Field> BMD(F);
 
 	for (int k=0;k<iterations;++k) {
-		
+
 		mycommentator.progress(k);
 
 		G.random(d);
 
 		BlasMatrix<Element> A(n,n),S(n,n), L(n,n);
 
-		// create S as an upper triangular matrix of full rank 
+		// create S as an upper triangular matrix of full rank
 		// with diagonal's element equal to 1 except the first entry wich equals to d
 		for (size_t i=0;i<n;++i){
 			S.setEntry(i,i,One);
-			for (size_t j=i+1;j<n;++j)      
+			for (size_t j=i+1;j<n;++j)
 				S.setEntry(i,j,G.random(tmp));
 		}
 		S.setEntry(0,0,d);
-    
+
 		// create L as a lower triangular matrix with only 1's on diagonal
 		for (size_t i=0;i<n;++i){
 			for (size_t j=0;j<i;++j)
@@ -232,40 +630,41 @@ static bool testDet (const Field& F,size_t n, int iterations) {
 			L.setEntry(i,i,One);
 		}
 
-    
+
 		//  compute A=LS
 		BMD.mul(A,L,S);
-    
+
 		// compute the determinant of A
 		Element det= BMD.detin(A);
 
 		if (!F.areEqual(det,d))
 			ret=false;
 	}
-  
+
 	mycommentator.stop(MSG_STATUS (ret), (const char *) 0, "testDet");
-    
+
 	return ret;
 }
 
 /*
  *  Testing the inverse of dense matrices using BlasDomain
- *  construct a non-singular n*n matrices 
+ *  construct a non-singular n*n matrices
  */
 template <class Field>
-static bool testInv (const Field& F,size_t n, int iterations) {
+static bool testInv (const Field& F,size_t n, int iterations)
+{
 
 	typedef typename Field::Element Element;
 	typedef typename Field::RandIter RandIter;
 	typedef  BlasMatrix<Element> Matrix;
-  
+
 	//Commentator mycommentator;
 	mycommentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
 	mycommentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
 	mycommentator.start (pretty("Testing inverse"),"testInv",iterations);
 
 	RandIter G(F);
-	NonzeroRandIter<Field> Gn(F,G); 
+	NonzeroRandIter<Field> Gn(F,G);
 	Element One,tmp;
 	F.init(One,1UL);
 
@@ -276,55 +675,56 @@ static bool testInv (const Field& F,size_t n, int iterations) {
 	Matrix Id(n,n);
 	for (size_t i=0;i<n;++i)
 		Id.setEntry(i,i,One);
-  
+
 	for (int k=0;k<iterations;++k) {
-    
+
 		mycommentator.progress(k);
-   
+
 
 		Matrix A(n,n),S(n,n), L(n,n), invA(n,n);
 
-		// create S as an upper triangular matrix of full rank 
-		// with nonzero random diagonal's element 
+		// create S as an upper triangular matrix of full rank
+		// with nonzero random diagonal's element
 		for (size_t i=0;i<n;++i){
 			S.setEntry(i,i,Gn.random(tmp));
-			for (size_t j=i+1;j<n;++j)      
+			for (size_t j=i+1;j<n;++j)
 				S.setEntry(i,j,G.random(tmp));
 		}
-     
-		// create L as a lower triangular matrix 
-		// with only 1's on diagonal 
+
+		// create L as a lower triangular matrix
+		// with only 1's on diagonal
 		for (size_t i=0;i<n;++i){
 			for (size_t j=0;j<i;++j)
 				L.setEntry(i,j,G.random(tmp));
 			L.setEntry(i,i,One);
 		}
-        
+
 		//  compute A=LS
 		BMD.mul(A,L,S);
-      
+
 		// compute the inverse of A
 		BMD.inv(invA,A);
-        
+
 		// compute Ainv*A and A*Ainv
 		BMD.mul(L,invA,A);
 		BMD.mul(S,A,invA);
-   
+
 		if (!MD.areEqual(L,Id) || !MD.areEqual(S,Id))
 			ret=false;
 	}
-  
+
 	mycommentator.stop(MSG_STATUS (ret), (const char *) 0, "testInv");
-    
+
 	return ret;
 }
 
 
 /*
- * Test resolution of linear system with a triangular matrix 
+ * Test resolution of linear system with a triangular matrix
  */
 template <class Field>
-static bool testTriangularSolve (const Field& F, size_t m, size_t n, int iterations) {
+static bool testTriangularSolve (const Field& F, size_t m, size_t n, int iterations)
+{
 
 	typedef typename Field::Element                  Element;
 	typedef BlasMatrix<Element>                       Matrix;
@@ -337,21 +737,21 @@ static bool testTriangularSolve (const Field& F, size_t m, size_t n, int iterati
 	mycommentator.start (pretty("Testing triangular solver"),"testTriangularSolve",iterations);
 
 	RandIter G(F);
-	NonzeroRandIter<Field> Gn(F,G); 
+	NonzeroRandIter<Field> Gn(F,G);
 	Element One,tmp;
 	F.init(One,1UL);
-  
+
 	bool ret = true;
 	MatrixDomain<Field> MD(F);
 	VectorDomain<Field>  VD(F);
 	BlasMatrixDomain<Field> BMD(F);
 
 	for (int k=0;k<iterations;++k) {
-    
-		mycommentator.progress(k);    
-    
+
+		mycommentator.progress(k);
+
 		Matrix Al(m,m),Au(m,m);
-		Matrix X(m,n), B(m,n), C(m,n);  
+		Matrix X(m,n), B(m,n), C(m,n);
 
 		std::vector<Element> b(m),x(m),c(m);
 
@@ -363,7 +763,7 @@ static bool testTriangularSolve (const Field& F, size_t m, size_t n, int iterati
 		//create random vector b
 		for( size_t i=0;i<m;++i)
 			F.init(b[i],G.random(tmp));
-    
+
 		// Create Au a random full rank upper triangular matrix
 		for (size_t i=0;i<m;++i){
 			Au.setEntry(i,i,Gn.random(tmp));
@@ -372,72 +772,73 @@ static bool testTriangularSolve (const Field& F, size_t m, size_t n, int iterati
 		}
 
 		// Create Al a random full rank lower triangular matrix
-		for (size_t i=0;i<m;++i){      
+		for (size_t i=0;i<m;++i){
 			for (size_t j=0;j<i;++j)
 				Al.setEntry(i,j,G.random(tmp));
-			Al.setEntry(i,i,Gn.random(tmp));	  
+			Al.setEntry(i,i,Gn.random(tmp));
 		}
 
 		// Create 2 trinagular matrix as view of matrix
 		TriangularMatrix TAl(Al,BlasTag::low,BlasTag::nonunit), TAu(Au,BlasTag::up,BlasTag::nonunit);
-    
+
 		// testing solver with matrix right hand side
-		BMD.left_solve(X,TAl,B);    
-		BMD.mul(C,Al,X);          
+		BMD.left_solve(X,TAl,B);
+		BMD.mul(C,Al,X);
 		if (!MD.areEqual(C,B))
 			ret=false;
-        
+
 		BMD.left_solve(X,TAu,B);
-		BMD.mul(C,Au,X);   
+		BMD.mul(C,Au,X);
 		if (!MD.areEqual(C,B))
 			ret=false;
-        
+
 		// testing solver with matrix left hand side
 		BMD.right_solve(X,TAl,B);
-		BMD.mul(C,X,Al);    
+		BMD.mul(C,X,Al);
 		if (!MD.areEqual(C,B))
 			ret=false;
-        
+
 		BMD.right_solve(X,TAu,B);
-		BMD.mul(C,X,Au);    
+		BMD.mul(C,X,Au);
 		if (!MD.areEqual(C,B))
 			ret=false;
-       
+
 
 		// testing solver with vector right hand side
-		BMD.left_solve(x,TAl,b);    
-		BMD.mul(c,Al,x);          
+		BMD.left_solve(x,TAl,b);
+		BMD.mul(c,Al,x);
 		if (!VD.areEqual(c,b))
 			ret=false;
-        
+
 		BMD.left_solve(x,TAu,b);
-		BMD.mul(c,Au,x);   
+		BMD.mul(c,Au,x);
 		if (!VD.areEqual(c,b))
 			ret=false;
-        
+
 		// testing solver with vector left hand side
 		BMD.right_solve(x,TAl,b);
-		BMD.mul(c,x,Al);    
+		BMD.mul(c,x,Al);
 		if (!VD.areEqual(c,b))
 			ret=false;
-        
+
 		BMD.right_solve(x,TAu,b);
-		BMD.mul(c,x,Au);    
+		BMD.mul(c,x,Au);
 		if (!VD.areEqual(c,b))
 			ret=false;
 
 	}
 
 	mycommentator.stop(MSG_STATUS (ret), (const char *) 0, "testTriangularSolve");
-    
+
 	return ret;
 }
 
 /*
- * Test resolution of linear system with a matrix 
+ * Test resolution of linear system with a matrix
  */
 template <class Field>
-static bool testSolve (const Field& F, size_t m, size_t n, int iterations) {
+static bool testSolve (const Field& F, size_t m, size_t n, int iterations)
+{
 
 	typedef typename Field::Element                  Element;
 	typedef BlasMatrix<Element>                       Matrix;
@@ -449,21 +850,21 @@ static bool testSolve (const Field& F, size_t m, size_t n, int iterations) {
 	mycommentator.start (pretty("Testing solver"),"testTriangularSolve",iterations);
 
 	RandIter G(F);
-	NonzeroRandIter<Field> Gn(F,G); 
+	NonzeroRandIter<Field> Gn(F,G);
 	Element One,tmp;
 	F.init(One,1UL);
-  
+
 	bool ret = true;
 	MatrixDomain<Field> MD(F);
 	VectorDomain<Field>  VD(F);
 	BlasMatrixDomain<Field> BMD(F);
 
 	for (int k=0;k<iterations;++k) {
-    
-		mycommentator.progress(k);    
-    
+
+		mycommentator.progress(k);
+
 		Matrix A(m,m),L(m,m),S(m,m);
-		Matrix X(m,n), B(m,n), C(m,n);  
+		Matrix X(m,n), B(m,n), C(m,n);
 
 		std::vector<Element> b(m),x(m),c(m);
 
@@ -475,86 +876,86 @@ static bool testSolve (const Field& F, size_t m, size_t n, int iterations) {
 		//create a random vector b
 		for( size_t i=0;i<m;++i)
 			F.init(b[i],G.random(tmp));
-    
-   
-		// create S as an upper triangular matrix of full rank 
-		// with nonzero random diagonal's element 
+
+
+		// create S as an upper triangular matrix of full rank
+		// with nonzero random diagonal's element
 		for (size_t i=0;i<m;++i){
 			S.setEntry(i,i,Gn.random(tmp));
-			for (size_t j=i+1;j<n;++j)      
+			for (size_t j=i+1;j<n;++j)
 				S.setEntry(i,j,G.random(tmp));
 		}
-    
-		// create L as a lower triangular matrix 
-		// with only 1's on diagonal 
+
+		// create L as a lower triangular matrix
+		// with only 1's on diagonal
 		for (size_t i=0;i<m;++i){
 			for (size_t j=0;j<i;++j)
 				L.setEntry(i,j,G.random(tmp));
 			L.setEntry(i,i,One);
 		}
-        
+
 		//  compute A=LS
 		BMD.mul(A,L,S);
 
 
 		// testing solver with matrix right hand side
-		BMD.left_solve(X,A,B);    
-		BMD.mul(C,A,X);          
+		BMD.left_solve(X,A,B);
+		BMD.mul(C,A,X);
 		if (!MD.areEqual(C,B))
 			ret=false;
-        
+
 		BMD.left_solve(X,A,B);
-		BMD.mul(C,A,X);   
+		BMD.mul(C,A,X);
 		if (!MD.areEqual(C,B))
 			ret=false;
-        
+
 		// testing solver with matrix left hand side
 		BMD.right_solve(X,A,B);
-		BMD.mul(C,X,A);    
+		BMD.mul(C,X,A);
 		if (!MD.areEqual(C,B))
 			ret=false;
-        
+
 		BMD.right_solve(X,A,B);
-		BMD.mul(C,X,A);    
+		BMD.mul(C,X,A);
 		if (!MD.areEqual(C,B))
 			ret=false;
-       
+
 
 		// testing solver with vector right hand side
-		BMD.left_solve(x,A,b);    
-		BMD.mul(c,A,x);          
+		BMD.left_solve(x,A,b);
+		BMD.mul(c,A,x);
 		if (!VD.areEqual(c,b))
 			ret=false;
-        
+
 		BMD.left_solve(x,A,b);
-		BMD.mul(c,A,x);   
+		BMD.mul(c,A,x);
 		if (!VD.areEqual(c,b))
 			ret=false;
-        
+
 		// testing solver with vector left hand side
 		BMD.right_solve(x,A,b);
-		BMD.mul(c,x,A);    
+		BMD.mul(c,x,A);
 		if (!VD.areEqual(c,b))
 			ret=false;
-        
+
 		BMD.right_solve(x,A,b);
-		BMD.mul(c,x,A);    
+		BMD.mul(c,x,A);
 		if (!VD.areEqual(c,b))
 			ret=false;
 
 	}
 
 	mycommentator.stop(MSG_STATUS (ret), (const char *) 0, "testTriangularSolve");
-    
+
 	return ret;
 }
 
 /*
  * Test of the BlasPermutations
  */
-
 template <class Field>
-static bool testPermutation (const Field& F, size_t m, int iterations) {
+static bool testPermutation (const Field& F, size_t m, int iterations)
+{
 
 	typedef typename Field::Element                  Element;
 	typedef BlasMatrix<Element>                       Matrix;
@@ -566,20 +967,20 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 	mycommentator.start (pretty("Testing permutations"),"testPermutation",iterations);
 
 	RandIter G(F);
-	NonzeroRandIter<Field> Gn(F,G); 
+	NonzeroRandIter<Field> Gn(F,G);
 	Element One,zero,tmp,tmp2;
 	F.init(One,1UL);
 	F.init(zero,0UL);
-  
+
 	bool ret = true;
 	MatrixDomain<Field> MD(F);
 	VectorDomain<Field>  VD(F);
 	BlasMatrixDomain<Field> BMD(F);
 
 	for (int k=0;k<iterations;++k) {
-    
-		mycommentator.progress(k);    
-    
+
+		mycommentator.progress(k);
+
 		std::vector<size_t> P(m);
 
 		Field Z2(2);
@@ -588,16 +989,16 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		for (size_t i=0; i<m; ++i){
 			G.random(tmp);
 			if ( Z2.isZero(G2.random(tmp2) ) )
-				P[i] = i + ( (size_t) tmp % (m-i) ); 
-			else				
+				P[i] = i + ( (size_t) tmp % (m-i) );
+			else
 				P[i] = i;
 		}
-		
+
 		//std::cerr<<P<<std::endl;
 		Matrix A(m,m), Abis(m,m), B(m,m), C(m,m), D(m,m);
 		std::vector<Element> a(m),abis(m),b(m),c(m), d(m);
-		BlasPermutation Perm(P);
-		
+		BlasPermutation<size_t>  Perm(P);
+
 		// Create A a random matrix
 		for (size_t i=0;i<m;++i)
 			for (size_t j=0;j<m;++j)
@@ -609,21 +1010,21 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		/*
 		 * Test A.P.P^t == A
 		 */
-		
+
 		// B = A.P
 		BMD.mul( B, A, Perm);
-		// C = B.P^t 
-		BMD.mul( C, B, TransposedBlasMatrix<BlasPermutation>(Perm) );
+		// C = B.P^t
+		BMD.mul( C, B, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm) );
 		// Test C==A
 		if (!MD.areEqual(A,C))
 			ret=false;
 		/*
 		 * Test A.P^t.P == A
 		 */
-		
+
 		// B = A.P^t
-		BMD.mul( B, A, TransposedBlasMatrix<BlasPermutation>(Perm));
-		// C = B.P 
+		BMD.mul( B, A, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm));
+		// C = B.P
 		BMD.mul( C, B, Perm );
 		// Test C==A
 		if (!MD.areEqual(A,C))
@@ -631,21 +1032,21 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		/*
 		 * Test P.P^t.A == A
 		 */
-		
+
 		// B = P.A
 		BMD.mul( B, Perm, A);
-		// C = P^t.B 
-		BMD.mul( C, TransposedBlasMatrix<BlasPermutation>(Perm) , B);
+		// C = P^t.B
+		BMD.mul( C, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm) , B);
 		// Test C==A
 		if (!MD.areEqual(A,C))
 			ret=false;
 		/*
 		 * Test P^t.P.A == A
 		 */
-		
+
 		// B = P^t.A
-		BMD.mul( B, TransposedBlasMatrix<BlasPermutation>(Perm), A);
-		// C = P.B 
+		BMD.mul( B, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm), A);
+		// C = P.B
 		BMD.mul( C, Perm, B);
 		// Test C==A
 		if (!MD.areEqual(A,C))
@@ -654,11 +1055,11 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		/*
 		 * Test a.P.P^t == a
 		 */
-		
+
 		// b = a.P
 		BMD.mul( b, a, Perm);
-		// c = b.P^t 
-		BMD.mul( c, b, TransposedBlasMatrix<BlasPermutation>(Perm) );
+		// c = b.P^t
+		BMD.mul( c, b, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm) );
 		// Test c==a
 		if (!VD.areEqual(a,c))
 			ret=false;
@@ -666,10 +1067,10 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		/*
 		 * Test a.P^t.P == a
 		 */
-		
+
 		// b = a.P^t
-		BMD.mul( b, a, TransposedBlasMatrix<BlasPermutation>(Perm));
-		// c = B.P 
+		BMD.mul( b, a, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm));
+		// c = B.P
 		BMD.mul( c, b, Perm );
 		// Test c==a
 		if (!VD.areEqual(a,c))
@@ -677,11 +1078,11 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		/*
 		 * Test P.P^t.a == a
 		 */
-		
+
 		// b = P.a
 		BMD.mul( b, Perm, a);
-		// c = P^t.b 
-		BMD.mul( c, TransposedBlasMatrix<BlasPermutation>(Perm) , b);
+		// c = P^t.b
+		BMD.mul( c, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm) , b);
 		// Test c==a
 		if (!VD.areEqual(a,c))
 			ret=false;
@@ -689,10 +1090,10 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		/*
 		 * Test P^t.P.a == a
 		 */
-		
+
 		// b = P^t.a
-		BMD.mul( b, TransposedBlasMatrix<BlasPermutation>(Perm), a);
-		// c = P.b 
+		BMD.mul( b, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm), a);
+		// c = P.b
 		BMD.mul( c, Perm, b);
 		// Test c==a
 		if (!VD.areEqual(a,c))
@@ -706,7 +1107,7 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		for (size_t i=0;i<m;++i)
 			for (size_t j=0;j<m;++j)
 				B.setEntry(i,j,G.random(tmp));
-		
+
 		// Abis = P.A
 		BMD.mul( Abis, Perm, A);
 		// C = (P.A)^-1.B
@@ -724,7 +1125,7 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		for (size_t i=0;i<m;++i)
 			for (size_t j=0;j<m;++j)
 				B.setEntry(i,j,G.random(tmp));
-		
+
 		// Abis = A.P
 		BMD.mul( Abis, A, Perm);
 		// C = (A.P)^-1.B
@@ -743,7 +1144,7 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		for (size_t i=0;i<m;++i)
 			for (size_t j=0;j<m;++j)
 				B.setEntry(i,j,G.random(tmp));
-		
+
 		// Abis = P.A
 		BMD.mul( Abis, Perm, A);
 		// C = B.(P.A)^-1
@@ -754,7 +1155,7 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		BMD.mul(D, C, A);
 		if (!MD.areEqual(D,B))
 		  ret=false;
-		
+
 		/*
 		 * Test B.A.P^t.(A.P)^-1 == B
 		 */
@@ -762,7 +1163,7 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		for (size_t i=0;i<m;++i)
 			for (size_t j=0;j<m;++j)
 				B.setEntry(i,j,G.random(tmp));
-		
+
 		// Abis = A.P
 		BMD.mul( Abis, A, Perm);
 		// C = B.(A.P)^-1
@@ -771,7 +1172,7 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		BMD.mul(D, C, A);
 		// C = C.P
 		BMD.mulin_left( D, Perm);
-			
+
 		if (!MD.areEqual(D,B))
 			ret=false;
 		/*
@@ -781,15 +1182,15 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		for (size_t i=0;i<m;++i)
 			for (size_t j=0;j<m;++j)
 				B.setEntry(i,j,G.random(tmp));
-		
+
 		// Abis = P^t.A
-		BMD.mul( Abis, TransposedBlasMatrix<BlasPermutation>(Perm), A);
+		BMD.mul( Abis, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm), A);
 		// C = (P^t.A)^-1.B
 		BMD.left_solve( C, Abis, B);
 		// D = A.C (= P.B)
 		BMD.mul(D, A, C);
 		// D = P^t.D
-		BMD.mulin_right( TransposedBlasMatrix<BlasPermutation>(Perm),D);
+		BMD.mulin_right( TransposedBlasMatrix<BlasPermutation<size_t> >(Perm),D);
 		if (!MD.areEqual(D,B))
 			ret=false;
 		/*
@@ -799,13 +1200,13 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		for (size_t i=0;i<m;++i)
 			for (size_t j=0;j<m;++j)
 				B.setEntry(i,j,G.random(tmp));
-		
+
 		// Abis = A.P^t
-		BMD.mul( Abis, A, TransposedBlasMatrix<BlasPermutation>(Perm));
+		BMD.mul( Abis, A, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm));
 		// C = (A.P^t)^-1.B
 		BMD.left_solve( C, Abis, B);
 		// C = P^t.C
-		BMD.mulin_right( TransposedBlasMatrix<BlasPermutation>(Perm),C);
+		BMD.mulin_right( TransposedBlasMatrix<BlasPermutation<size_t> >(Perm),C);
 		// D = A.C (= P.B)
 		BMD.mul(D, A, C);
 
@@ -818,18 +1219,18 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		for (size_t i=0;i<m;++i)
 			for (size_t j=0;j<m;++j)
 				B.setEntry(i,j,G.random(tmp));
-		
+
 		// Abis = P^t.A
-		BMD.mul( Abis, TransposedBlasMatrix<BlasPermutation>(Perm), A);
+		BMD.mul( Abis, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm), A);
 		// C = B.(P^t.A)^-1
 		BMD.right_solve( C, Abis, B);
 		// C = C.P^t
-		BMD.mulin_left( C,TransposedBlasMatrix<BlasPermutation>(Perm));
+		BMD.mulin_left( C,TransposedBlasMatrix<BlasPermutation<size_t> >(Perm));
 		// D = C.A (=B)
 		BMD.mul(D, C, A);
 		if (!MD.areEqual(D,B))
 		  ret=false;
-		
+
 		/*
 		 * Test B.A.P.(A.P^t)^-1 == B
 		 */
@@ -837,21 +1238,21 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
 		for (size_t i=0;i<m;++i)
 			for (size_t j=0;j<m;++j)
 				B.setEntry(i,j,G.random(tmp));
-		
+
 		// Abis = A.P^t
-		BMD.mul( Abis, A, TransposedBlasMatrix<BlasPermutation>(Perm));
+		BMD.mul( Abis, A, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm));
 		// C = B.(A.P^t)^-1
 		BMD.right_solve( C, Abis, B);
 		// D = C.A (= B.P)
 		BMD.mul(D, C, A);
 		// C = C.P^t
-		BMD.mulin_left( D, TransposedBlasMatrix<BlasPermutation>(Perm));
-			
+		BMD.mulin_left( D, TransposedBlasMatrix<BlasPermutation<size_t> >(Perm));
+
 		if (!MD.areEqual(D,B))
 			ret=false;
 	}
 	mycommentator.stop(MSG_STATUS (ret), (const char *) 0, "testLQUP");
-	
+
 	return ret;
 }
 
@@ -859,7 +1260,8 @@ static bool testPermutation (const Field& F, size_t m, int iterations) {
  * Test of the LQUPMatrix class
  */
 template <class Field>
-static bool testLQUP (const Field& F, size_t m, size_t n, int iterations) {
+static bool testLQUP (const Field& F, size_t m, size_t n, int iterations)
+{
 
 	typedef typename Field::Element                  Element;
 	typedef BlasMatrix<Element>                       Matrix;
@@ -871,21 +1273,21 @@ static bool testLQUP (const Field& F, size_t m, size_t n, int iterations) {
 	mycommentator.start (pretty("Testing LQUP factorization"),"testLQUP",iterations);
 
 	RandIter G(F);
-	NonzeroRandIter<Field> Gn(F,G); 
+	NonzeroRandIter<Field> Gn(F,G);
 	Element One,zero,tmp;
 	F.init(One,1UL);
 	F.init(zero,0UL);
-  
+
 	bool ret = true;
 	MatrixDomain<Field> MD(F);
 	BlasMatrixDomain<Field> BMD(F);
 
 	for (int k=0;k<iterations;++k) {
-    
-		mycommentator.progress(k);    
-    
+
+		mycommentator.progress(k);
+
 		Matrix A(m,n), Abis(m,n), B(m,m), C(m,n);
-		
+
 
 		// Create B a random matrix of rank n/2
 		for (size_t j=0;j<m;++j)
@@ -903,41 +1305,41 @@ static bool testLQUP (const Field& F, size_t m, size_t n, int iterations) {
 			else
 				for (size_t j=0;j<n;++j)
 					C.setEntry(i,j,zero);
-		
+
 		// A = B*C
 		BMD.mul(A, B, C);
-		
+
 		Abis = A;
 
-		LQUPMatrix<Field> X(F,A);
-		
+		BlasPermutation<size_t>  P(A.coldim()),Q(A.rowdim());
+		LQUPMatrix<Field> X(F,A,P,Q);
+
 		TriangularBlasMatrix<Element> L(m,m,BlasTag::low,BlasTag::unit);
 		TriangularBlasMatrix<Element> U(m,n,BlasTag::up,BlasTag::nonunit);
 		X.getL(L);
 		X.getU(U);
-		BlasPermutation P,Q;
 		P=X.getP();
 
 		Q=X.getQ();
-		
+
 		// C = U*P
 		BMD.mul( C, U, P);
 		// C = Q*C
 		BMD.mulin_right( Q, C);
 		// A = L*C
 		BMD.mul( A, L, C);
-		
+
 		if (!MD.areEqual(A,Abis))
 			ret=false;
 
 		// Second pass
 		// A = B*C
 		BMD.mul(A, B, C);
-		
+
 		Abis = A;
 
-		LQUPMatrix<Field> Y(F,A);
-		
+		LQUPMatrix<Field> Y(F,A,P,Q);
+
 		TriangularBlasMatrix<Element> L2(m,m,BlasTag::low,BlasTag::unit);
 		TriangularBlasMatrix<Element> U2(m,n,BlasTag::up,BlasTag::nonunit);
 		Y.getL(L2);
@@ -945,25 +1347,26 @@ static bool testLQUP (const Field& F, size_t m, size_t n, int iterations) {
 		P=Y.getP();
 
 		Q=Y.getQ();
-		
+
 		// C = Q*U2
 		BMD.mul( C,Q,U2);
 		// C = Q*C
 		BMD.mulin_left(  C,P);
 		// A = L*C
 		BMD.mul( A, L2, C);
-		
+
 		if (!MD.areEqual(A,Abis))
 			ret=false;
 	}
 
 	mycommentator.stop(MSG_STATUS (ret), (const char *) 0, "testLQUP");
-    
+
 	return ret;
 }
 
 template <class Field>
-static bool testMinPoly (const Field& F, size_t n, int iterations) {
+static bool testMinPoly (const Field& F, size_t n, int iterations)
+{
 	typedef typename Field::Element                  Element;
 	typedef BlasMatrix<Element>                       Matrix;
 	typedef typename Field::RandIter                RandIter;
@@ -974,26 +1377,26 @@ static bool testMinPoly (const Field& F, size_t n, int iterations) {
 	mycommentator.start (pretty("Testing minpoly"),"testMinPoly",iterations);
 	Element tmp, one, zero,mone;
 	RandIter G(F);
-	NonzeroRandIter<Field> Gn(F,G); 
+	NonzeroRandIter<Field> Gn(F,G);
 	F.init(one, 1UL);
 	F.init(zero, 0UL);
 	F.neg(mone, one);
 	//F.neg( mone, one);
 	bool ret = true;
 	BlasMatrixDomain<Field> BMD(F);
-		
+
 	for (int k=0;k<iterations;++k) {
-    
-		mycommentator.progress(k);    
+
+		mycommentator.progress(k);
 
 		Matrix A(n,n);
 		Polynomial P;
 		// Test MinPoly(In) = X-1
 		for (size_t i=0;i<n;++i)
 			A.setEntry(i,i,one);
-		
+
 		BMD.minpoly( P, A );
-		
+
 		if ( P.size() !=2 )
 			ret = false;
 		if ( !F.areEqual(P[0], mone) )
@@ -1003,7 +1406,7 @@ static bool testMinPoly (const Field& F, size_t n, int iterations) {
 
 		// Test MinPoly(a*In) = X-a
 		G.random(tmp);
-		
+
 		for (size_t i=0;i<n;++i)
 			A.setEntry(i,i,tmp);
 		F.negin(tmp);
@@ -1025,7 +1428,7 @@ static bool testMinPoly (const Field& F, size_t n, int iterations) {
 		}
 		for (size_t j=0;j<n;++j)
 			A.setEntry(n-1,j,zero);
-		
+
 		BMD.minpoly( P, A );
 		if ( P.size() !=n+1 )
 			ret = false;
@@ -1038,12 +1441,13 @@ static bool testMinPoly (const Field& F, size_t n, int iterations) {
 	}
 
 	mycommentator.stop(MSG_STATUS (ret), (const char *) 0, "testMinPoly");
-	
+
 	return ret;
 }
 
 template <class Field>
-static bool testCharPoly (const Field& F, size_t n, int iterations) {
+static bool testCharPoly (const Field& F, size_t n, int iterations)
+{
 	typedef typename Field::Element                  Element;
 	typedef BlasMatrix<Element>                       Matrix;
 	typedef typename Field::RandIter                RandIter;
@@ -1054,17 +1458,17 @@ static bool testCharPoly (const Field& F, size_t n, int iterations) {
 	mycommentator.start (pretty("Testing charpoly"),"testCharPoly",iterations);
 	Element tmp, one, zero,mone;
 	RandIter G(F);
-	NonzeroRandIter<Field> Gn(F,G); 
+	NonzeroRandIter<Field> Gn(F,G);
 	F.init(one, 1UL);
 	F.init(zero, 0UL);
 	F.neg(mone, one);
 	//F.neg( mone, one);
 	bool ret = true;
 	BlasMatrixDomain<Field> BMD(F);
-	
+
 	for (int k=0;k<iterations;++k) {
-    
-		mycommentator.progress(k);    
+
+		mycommentator.progress(k);
 
 		Matrix A(n,n);
 		list<Polynomial> P;
@@ -1087,13 +1491,13 @@ static bool testCharPoly (const Field& F, size_t n, int iterations) {
 				ret = false;
 			if ( !F.areEqual(P_it->operator[](1), one) )
 				ret = false;
-			
+
 			P_it++;
 		}
-		
+
 		// Test CharPoly(a*In) = X-a
 		G.random(tmp);
-		
+
 		for (size_t i=0;i<n;++i)
 			A.setEntry(i,i,tmp);
 		F.negin(tmp);
@@ -1112,30 +1516,63 @@ static bool testCharPoly (const Field& F, size_t n, int iterations) {
 	}
 
 	mycommentator.stop(MSG_STATUS (ret), (const char *) 0, "testCharPoly");
-	
+
 	return ret;
 }
 
-template<class T, template <class T> class Container>
-std::ostream& operator<< (std::ostream& o, const Container<T>& C) {
-	for(typename Container<T>::const_iterator refs =  C.begin();
-	    refs != C.end() ;
-	    ++refs )
-		o << (*refs) << " " ;
-	return o << std::endl;
+
+
+// returns true if ok, false if not.
+template<class Field>
+int launch_tests(Field & F, int n, int iterations)
+{
+	bool pass = true ;
+	//std::cout << "no blas tests for now" << std::endl;
+	// no slow test while I work on io
+	if (!testMulAdd (F,n,iterations))                     pass=false;
+	if (!testMulAddAgain (F,n,iterations))                pass=false;
+	int m = n+n/2 ; int k = 2*n+1 ;
+	if (!testMulAddShapeTrans (F,n,m,k,iterations))       pass=false;
+	if (!testMulAddShapeTrans (F,n,k,m,iterations))       pass=false;
+	if (!testMulAddShapeTrans (F,m,n,k,iterations))       pass=false;
+	if (!testMulAddShapeTrans (F,m,k,n,iterations))       pass=false;
+	if (!testMulAddShapeTrans (F,k,n,m,iterations))       pass=false;
+	if (!testMulAddShapeTrans (F,k,m,n,iterations))       pass=false;
+	if (!testTriangMulShapeTrans<Field,true,true>   (F,m,n,iterations))     pass=false;
+	if (!testTriangMulShapeTrans<Field,true,true>   (F,n,m,iterations))     pass=false;
+	if (!testTriangMulShapeTrans<Field,false,true>  (F,m,n,iterations))     pass=false;
+	if (!testTriangMulShapeTrans<Field,false,true>  (F,n,m,iterations))     pass=false;
+	if (!testTriangMulShapeTrans<Field,true,false>  (F,m,n,iterations))     pass=false;
+	if (!testTriangMulShapeTrans<Field,true,false>  (F,n,m,iterations))     pass=false;
+	if (!testTriangMulShapeTrans<Field,false,false> (F,m,n,iterations))     pass=false;
+	if (!testTriangMulShapeTrans<Field,false,false> (F,n,m,iterations))     pass=false;
+ 	if (!testRank (F, n, iterations))                     pass=false;
+ 	if (!testDet  (F, n, iterations))                     pass=false;
+ 	if (!testInv  (F, n, iterations))                     pass=false;
+ 	if (!testTriangularSolve (F,n,n,iterations))          pass=false;
+ 	if (!testSolve (F,n,n,iterations))                    pass=false;
+ 	if (!testPermutation (F,n,iterations))                pass=false;
+ 	if (!testLQUP (F,n,n,iterations))                     pass=false;
+ 	if (!testMinPoly (F,n,iterations))                    pass=false;
+	if (!testCharPoly (F,n,iterations))                   pass=false;
+	//
+	//
+	return pass ;
+
 }
 
-int main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
 
 	static size_t n = 40;
 	static integer q = 1000003U;
-	static int iterations = 1; 
-	
+	static int iterations = 2;
+
     static Argument args[] = {
         { 'n', "-n N", "Set dimension of test matrices to NxN", TYPE_INT,     &n },
-        { 'q', "-q Q", "Operate over the \"field\" GF(Q) [1]", TYPE_INTEGER, &q },
+        { 'q', "-q Q", "Operate over the \"field\" GF(Q) [1]",  TYPE_INTEGER, &q },
         { 'i', "-i I", "Perform each test for I iterations",    TYPE_INT,     &iterations },
-		{ '\0' }
+	END_OF_ARGUMENTS
     };
 
 	parseArguments (argc, argv, args);
@@ -1143,35 +1580,27 @@ int main(int argc, char **argv) {
 	typedef Modular<double> Field;
 	//typedef Modular<int> Field;
 	//typedef Modular<float> Field;
-        
+
 	Field F (q);
-    
+	// ModularBalanced<double> G(q);
+	Modular<float> H(2011);
+
 	bool pass = true;
 
 	srand (time (NULL));
 
-    
+
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
 
 	commentator.start("BlasMatrixDomain test suite", "BlasMatrixDomain");
 
-	//std::cout << "no blas tests for now" << std::endl;
-	// no slow test while I work on io
-	if (!testMulAdd (F,n,iterations)) pass=false;
- 	if (!testRank (F, n, iterations))   pass = false;   
- 	if (!testDet  (F, n, iterations)) pass = false;
- 	if (!testInv  (F, n, iterations)) pass = false;
- 	if (!testTriangularSolve (F,n,n,iterations)) pass=false;
- 	if (!testSolve (F,n,n,iterations)) pass=false;
- 	if (!testPermutation (F,n,iterations)) pass=false;
- 	if (!testLQUP (F,n,n,iterations)) pass=false;
- 	if (!testMinPoly (F,n,iterations)) pass=false;
-	if (!testCharPoly (F,n,iterations)) pass=false;
-	//
-	
-	commentator.stop("BlasMatrixDomain test suite"); 
+	pass &= launch_tests(F,n,iterations);
+	// pass &= launch_tests(G,n,iterations);
+	pass &= launch_tests(H,n,iterations);
+
+	commentator.stop(MSG_STATUS (pass), (const char *) 0,"BlasMatrixDomain test suite");
 	return pass ? 0 : -1;
 }
-  
-  
+
+
diff --git a/tests/test-block-ring.C b/tests/test-block-ring.C
index 306bf5e..2c4eb20 100644
--- a/tests/test-block-ring.C
+++ b/tests/test-block-ring.C
@@ -1,10 +1,35 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* tests/test-block-ring.C
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) LinBox
+ *
  * Copyright (C) 2007 b d saunders
  *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+/*! @file  tests/test-block-ring.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test NO DOC
  */
 
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -28,35 +53,35 @@ int main (int argc, char **argv)
 
     static Argument args[] = {
 	{ 'n', "-n N", "Set dimension of blocks to N.", TYPE_INT,     &n },
-    { 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
+	{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
 	{ 'i', "-i I", "Perform each test for I iterations.",      TYPE_INT,     &iterations },
-    { '\0' }
+	END_OF_ARGUMENTS
     };
 
     parseArguments (argc, argv, args);
 
 	commentator.start("block-ring test suite", "block-ring");
 	bool pass = true;
-	
-	typedef Modular<int> Field1;  
-	typedef Modular<double> Field2;  
-        
+
+	typedef Modular<int> Field1;
+	typedef Modular<double> Field2;
+
         Field1 F1(q, 1);
 	BlockRing<Field1> R1(F1, n);
 
         Field2 F2(q, 1);
         BlockRing<Field2> R2(F2, n);
-                        	
+
 	// Make sure some more detailed messages get printed
 	//commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
         commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (4);
         commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
-                
+
 
 	if (!runBasicRingTests(R1, "BlockRing of Modular<int>", iterations)) pass = false;
 	if (!runBasicRingTests(R2, "BlockRing of Modular<double>", iterations)) pass = false;
 
 	commentator.stop("block-ring test suite");
 	return pass ? 0 : -1;
-        
+
 }
diff --git a/tests/test-butterfly.C b/tests/test-butterfly.C
index 2cf7dab..8d919f0 100644
--- a/tests/test-butterfly.C
+++ b/tests/test-butterfly.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-butterfly.C
  * Copyright (C) 2002 Bradford Hovinen
@@ -10,6 +11,15 @@
  * See COPYING for license information.
  */
 
+
+/*! @file  tests/test-butterfly.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test NO DOC
+ */
+
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -42,7 +52,7 @@ using namespace std;
  */
 
 template <class Field, class Vector>
-static bool testSetButterfly (const Field &F, VectorStream<Vector> &stream, size_t k) 
+static bool testSetButterfly (const Field &F, VectorStream<Vector> &stream, size_t k)
 {
 	commentator.start ("Testing setButterfly", "testSetButterfly", stream.size ());
 
@@ -130,7 +140,7 @@ static bool testSetButterfly (const Field &F, VectorStream<Vector> &stream, size
  */
 
 template <class Field>
-static bool testCekstvSwitch (const Field &F, unsigned int iterations, size_t n, size_t r) 
+static bool testCekstvSwitch (const Field &F, unsigned int iterations, size_t n, size_t r)
 {
 	commentator.start ("Testing cekstv switch", "testCekstvSwitch", iterations);
 
@@ -229,7 +239,7 @@ static bool testCekstvSwitch (const Field &F, unsigned int iterations, size_t n,
 template <class Field>
 static bool testRandomLinearity (const Field                                 &F,
 				 VectorStream<typename Vector<Field>::Dense> &v1_stream,
-				 VectorStream<typename Vector<Field>::Dense> &v2_stream) 
+				 VectorStream<typename Vector<Field>::Dense> &v2_stream)
 {
 	commentator.start ("Testing random linearity", "testRandomLinearity", v1_stream.size ());
 
@@ -263,7 +273,7 @@ static bool testRandomLinearity (const Field                                 &F,
 template <class Field>
 static bool testRandomTranspose (const Field                                 &F,
 				 VectorStream<typename Vector<Field>::Dense> &v1_stream,
-				 VectorStream<typename Vector<Field>::Dense> &v2_stream) 
+				 VectorStream<typename Vector<Field>::Dense> &v2_stream)
 {
 	commentator.start ("Testing random transpose", "testRandomTranspose", v1_stream.size ());
 
@@ -295,10 +305,10 @@ int main (int argc, char **argv)
 		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
 		{ 'i', "-i I", "Perform each test for I iterations.",           TYPE_INT,     &iterations },
 		{ 'k', "-k K", "K nonzero elements in random vectors.",        TYPE_INT,     &k },
-    	{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
-	typedef Modular<LinBox::uint32> Field;
+	typedef Modular<uint32_t> Field;
 
 	parseArguments (argc, argv, args);
 	Field F (q);
diff --git a/tests/test-charpoly.C b/tests/test-charpoly.C
index 30de68f..b27ac90 100644
--- a/tests/test-charpoly.C
+++ b/tests/test-charpoly.C
@@ -1,11 +1,22 @@
 /* -*- 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
 /* tests/test-charpoly.C
+ * Copyright (C) LinBox
  * Written by bds (starting from test-charpoly.C)
  *
  * See COPYING for license information.
  */
 
+/*! @file  tests/test-charpoly.C
+ * @ingroup tests
+ * @brief tests the characteristic polynomial of sparse and special matrices
+ * @warning gcc-4.2 produces bad optimized code there
+ * @bug occasionnnaly there is a "SIGFPE, Arithmetic exception." in CRA
+ * @bug testRandomCharpoly is not always tested !!
+ * @test characteristic polynomial of some matrices (sparse, special)
+ */
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -13,14 +24,6 @@
 #include <fstream>
 #include <vector>
 #include <cstdio>
-template<class T, template <class T> class Container>
-std::ostream& operator<< (std::ostream& o, const Container<T>& C) {
-	for(typename Container<T>::const_iterator refs =  C.begin();
-	    refs != C.end() ;
-	    ++refs )
-		o << (*refs) << " " ;
-	return o << std::endl;
-}
 
 #include "linbox/blackbox/sparse.h"
 #include "linbox/blackbox/scalar-matrix.h"
@@ -33,6 +36,7 @@ std::ostream& operator<< (std::ostream& o, const Container<T>& C) {
 
 using namespace LinBox;
 
+
 /* Test 1: charpoly of the identity matrix
  *
  * Construct the identity matrix and compute its characteristic polynomial. Confirm
@@ -43,31 +47,31 @@ using namespace LinBox;
  *
  * Return true on success and false on failure
  */
-
 template <class Dom, class Polynomial>
 typename Dom::Element eval (const Dom& D,
 			    typename Dom::Element& value,
 			    const Polynomial& P,
-			    const typename Dom::Element x){
+			    const typename Dom::Element x)
+{
 	typename Dom::Element tmp = P[P.size()-1];
 	for (int i = P.size()-2; i >= 0; --i){
 		D.mulin (tmp, x);
 		D.addin (tmp, P[i]);
 	}
-	return value = tmp; 
+	return value = tmp;
 }
 
 template <class Dom>
-static bool testIdentityCharpoly (Dom &Z, size_t n, bool symmetrizing=false) 
+static bool testIdentityCharpoly (Dom &Z, size_t n, bool symmetrizing=false)
 {
 	typedef typename Dom::Element Element;
 	typedef vector<Element> Vector;
 	typedef ScalarMatrix<Dom> Blackbox;
-	//typedef GivPolynomialRing<Dom, Dense> PolDom;
-	//typedef typename PolDom::Element Polynomial;
-	typedef Vector Polynomial;
+	typedef GivPolynomialRing<Dom, ::Givaro::Dense> PolDom;
+	typedef typename PolDom::Element Polynomial;
+	//typedef Vector Polynomial;
 
-	commentator.start ("Testing identity Charpoly", "testIdentityCharpoly");
+	LinBox::commentator.start ("Testing identity Charpoly", "testIdentityCharpoly");
 
 	bool ret = true;
 	Element one; Z.init(one, 1);
@@ -81,7 +85,7 @@ static bool testIdentityCharpoly (Dom &Z, size_t n, bool symmetrizing=false)
 
 	charpoly (phi, A);
 
-	ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+	ostream &report = LinBox::commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
 	report << "Characteristic polynomial is: ";
 	printPolynomial<Dom, Polynomial> (Z, report, phi);
 
@@ -100,11 +104,11 @@ static bool testIdentityCharpoly (Dom &Z, size_t n, bool symmetrizing=false)
 	if (! Z.areEqual(val2, pow2)) ret = false;
 
 	if (! ret){
-		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+		LinBox::commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
 			<< "ERROR: Characteristic polynomial is incorrect" << endl;
 	}
 
-	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testIdentityCharpoly");
+	LinBox::commentator.stop (MSG_STATUS (ret), (const char *) 0, "testIdentityCharpoly");
 
 	return ret;
 }
@@ -119,18 +123,17 @@ static bool testIdentityCharpoly (Dom &Z, size_t n, bool symmetrizing=false)
  *
  * Return true on success and false on failure
  */
-
 template <class Field>
 static bool testNilpotentCharpoly (Field &F, size_t n)
 {
 	typedef vector <typename Field::Element> Vector;
-// 	typedef GivPolynomialRing<Field, Dense> PolDom;
+// 	typedef GivPolynomialRing<Field, ::Givaro::Dense> PolDom;
 // 	typedef typename PolDom::Element Polynomial;
 	typedef Vector Polynomial;
 	typedef pair <vector <size_t>, vector <typename Field::Element> > Row;
 	typedef SparseMatrix <Field> Blackbox;
 
-	commentator.start ("Testing nilpotent charpoly", "testNilpotentCharpoly");
+	LinBox::commentator.start ("Testing nilpotent charpoly", "testNilpotentCharpoly");
 
 	bool ret = true;
 	bool lowerTermsCorrect = true;
@@ -142,25 +145,32 @@ static bool testNilpotentCharpoly (Field &F, size_t n)
 	stream.next (v);
 	Blackbox A (F, stream);
 
+	ostream &who = LinBox::commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+	who << "Matrix:" << endl;
+	A.write (who, FORMAT_PRETTY);
+
+
+
 	Polynomial phi;
 
 	charpoly (phi, A);
 
-	ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+	ostream &report = LinBox::commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
 	report << "characteristic polynomial is: ";
 	printPolynomial (F, report, phi);
 
+	linbox_check(n);
 	for (i = 0; i < n - 1; i++)
 		if (!F.isZero (phi[i]))
 			lowerTermsCorrect = false;
 
 	if (phi.size () != n + 1 || !F.isOne (phi[n]) || !lowerTermsCorrect) {
 		ret = false;
-		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-			<< "ERROR: characteristic polynomial is incorrect" << endl;
+		LinBox::commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+			<< "ERROR: characteristic polynomial is incorrect (should be x^" << n << ')' << endl;
 	}
 
-	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testNilpotentCharpoly");
+	LinBox::commentator.stop (MSG_STATUS (ret), (const char *) 0, "testNilpotentCharpoly");
 
 	return ret;
 }
@@ -182,78 +192,58 @@ static bool testNilpotentCharpoly (Field &F, size_t n)
 
 template <class Field, class Row, class Vector>
 bool testRandomCharpoly (Field                 &F,
-			int                    iterations,
 			VectorStream<Row>    &A_stream,
 			VectorStream<Vector> &v_stream)
 {
-	//typedef GivPolynomialRing<Field, Dense> PolDom;
+	//typedef GivPolynomialRing<Field, ::Givaro::Dense> PolDom;
 	//typedef typename PolDom::Element Polynomial;
 	typedef std::vector<typename Field::Element> Polynomial;
 	typedef SparseMatrix <Field> Blackbox;
 
-	commentator.start ("Testing sparse random charpoly", "testRandomCharpoly", iterations);
+	LinBox::commentator.start ("Testing sparse random charpoly", "testRandomCharpoly", 1);
 
 	bool ret = true;
-	bool iter_passed;
 
 	VectorDomain<Field> VD (F);
-
-	Vector v, w;
-
+	Vector w, v;
 	VectorWrapper::ensureDim (v, v_stream.n ());
 	VectorWrapper::ensureDim (w, v_stream.n ());
 
-	for (int i = 0; i < iterations; i++) {
-		commentator.startIteration (i);
-
-		iter_passed = true;
-
-		A_stream.reset ();
-		Blackbox A (F, A_stream);
-
-		ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-		report << "Matrix:" << endl;
-		A.write (report, FORMAT_PRETTY);
-
-		Polynomial phi;
+	A_stream.reset ();
+	Blackbox A (F, A_stream);
 
-		charpoly (phi, A);
+	ostream &report = LinBox::commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+	report << "Matrix:" << endl;
+	A.write (report, FORMAT_PRETTY);
 
-		report << "characteristic polynomial is: ";
-		printPolynomial (F, report, phi);
-
-		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION)
-			<< "deg charpoly (A) = " << phi.size () - 1 << endl;
-
-		v_stream.reset ();
+	Polynomial phi;
 
-		while (v_stream) {
-			v_stream.next (v);
+	charpoly (phi, A);
 
-			report << "Input vector  " << v_stream.j () << ": ";
-			VD.write (report, v);
-			report << endl;
+	report << "characteristic polynomial is: ";
+	printPolynomial (F, report, phi);
 
-			applyPoly (F, w, A, phi, v);
+	LinBox::commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION)
+		<< "deg charpoly (A) = " << phi.size () - 1 << endl;
 
-			report << "Output vector " << v_stream.j () << ": ";
-			VD.write (report, w);
-			report << endl;
+	v_stream.reset ();
 
-			if (!VD.isZero (w))
-				ret = iter_passed = false;
-		}
+	while (v_stream) {
+		v_stream.next (v);
+		VD.write (report << "Input vector  " << v_stream.j () << ": ", v) << endl;
 
-		if (!iter_passed)
-			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: Output vector was incorrect" << endl;
+		applyPoly (F, w, A, phi, v);
+		VD.write (report << "Output vector " << v_stream.j () << ": ", w) << endl;
 
-		commentator.stop ("done");
-		commentator.progress ();
+		//bds: VD.isZero fails to work right when -O2 using gcc 4.2
+		if (!VD.isZero (w)) { ret = false; break; }
 	}
 
-	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testRandomCharpoly");
+	if (!ret)
+		LinBox::commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+			<< "ERROR: Output vector was incorrect" << endl;
 
+	LinBox::commentator.stop (MSG_STATUS (ret), (const char *) 0, "testRandomCharpoly");
 	return ret;
 }
 #endif
@@ -265,19 +255,17 @@ int main (int argc, char **argv)
 	std::cout<<setprecision(8);
 	std::cerr<<setprecision(8);
 	static size_t n = 50;
-	static integer q = 33554467U; 
-	//static integer q = 1000003U; // 33554467U; 
-	static int iterations = 1;
-	static int numVectors = 100;
+	static integer q = 33554467U;
+	//static integer q = 103U; // 33554467U;
+	static int numVectors = 10;
 	static int k = 3;
 
 	static Argument args[] = {
 		{ 'n', "-n N", "Set dimension of test matrices to NxN.",                 TYPE_INT,     &n },
 		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].",          TYPE_INTEGER, &q },
-		{ 'i', "-i I", "Perform each test for I iterations.",                    TYPE_INT,     &iterations },
 		{ 'v', "-v V", "Use V test vectors for the random charpoly tests.",      TYPE_INT,     &numVectors },
 		{ 'k', "-k K", "K nonzero Elements per row in sparse random apply test.", TYPE_INT,     &k },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
 
@@ -291,11 +279,11 @@ int main (int argc, char **argv)
 	Field F (q);
 	srand (time (NULL));
 
-	commentator.getMessageClass (TIMING_MEASURE).setMaxDepth (10);
-	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (10);
-	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
+	LinBox::commentator.getMessageClass (TIMING_MEASURE).setMaxDepth (10);
+	LinBox::commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (10);
+	LinBox::commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
 
-	ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+	ostream &report = LinBox::commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
 	report << endl << "Black box characteristic polynomial of a matrix over a prime field test suite" << endl;
 
 	RandomDenseStream<Field, DenseVector, NonzeroRandIter<Field> >
@@ -304,7 +292,7 @@ int main (int argc, char **argv)
 		A_stream (F, NonzeroRandIter<Field> (F, Field::RandIter (F)), (double) k / (double) n, n, n);
 
 	if (!testNilpotentCharpoly (F, n)) pass = false;
-	if (!testRandomCharpoly    (F, iterations, A_stream, v_stream)) pass = false;
+	if (!testRandomCharpoly    (F, A_stream, v_stream)) pass = false;
 
 	// symmetrizing
 	if (!testIdentityCharpoly  (F, n, true)) pass = false;
@@ -316,9 +304,9 @@ int main (int argc, char **argv)
 	PID_integer  Z;
 	srand (time (NULL));
 
-	commentator.getMessageClass (TIMING_MEASURE).setMaxDepth (10);
-	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (10);
-	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
+	LinBox::commentator.getMessageClass (TIMING_MEASURE).setMaxDepth (10);
+	LinBox::commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (10);
+	LinBox::commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
 
 	report << endl << "Black box characteristic polynomial of an integer matrix test suite" << endl;
 
@@ -332,7 +320,7 @@ int main (int argc, char **argv)
 	if (!testNilpotentCharpoly (Z, n)) pass = false;
 
 	//Comment by Z. Wan. Stream doesn't work here
-	//if (!testRandomCharpoly    (Z, iterations, zA_stream, zv_stream)) pass = false;
+	//if (!testRandomCharpoly    (Z, zA_stream, zv_stream)) pass = false;
 
 	// symmetrizing
 	if (!testIdentityCharpoly  (Z, n, true)) pass = false;
diff --git a/tests/test-commentator.C b/tests/test-commentator.C
index 1e4c601..d133081 100644
--- a/tests/test-commentator.C
+++ b/tests/test-commentator.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-commentator.C
  * Copyright (C) 2002 Bradford Hovinen
@@ -17,6 +18,13 @@
  * (specified on the command line) for any anomolies.
  */
 
+/*! @file  tests/test-commentator.C
+ * @ingroup tests
+ * @brief no doc.
+ * @test tests LinBox::Commentator
+ * @bug this test does not even test if anything is outputted (and it passes even though)
+ */
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -32,7 +40,7 @@ using namespace std;
 
 // Output various report strings
 
-void outputReportStrings () 
+void outputReportStrings ()
 {
 	static const char *classes[] =
 		{ INTERNAL_DESCRIPTION, INTERNAL_WARNING, INTERNAL_ERROR };
@@ -47,7 +55,7 @@ void outputReportStrings ()
 
 // Simple test activity to exercise commentator features
 
-void runTestActivity (bool reportStrings) 
+void runTestActivity (bool reportStrings)
 {
 	commentator.start ("Test activity", "test", 2);
 
@@ -81,7 +89,7 @@ void runTestActivity (bool reportStrings)
  * Return true on success and false on failure
  */
 
-static bool testPrimaryOutput () 
+static bool testPrimaryOutput ()
 {
 	//cout << "Testing primary output...";
 
@@ -122,7 +130,7 @@ static bool testPrimaryOutput ()
  * Return true on success and false on failure
  */
 
-static bool testBriefReport () 
+static bool testBriefReport ()
 {
 	//cout << "Testing brief report...";
 
@@ -166,7 +174,7 @@ int main (int argc, char **argv)
 	bool pass = true;
 
 	static Argument args[] = {
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
diff --git a/tests/test-common.C b/tests/test-common.C
index aae050b..1756c47 100644
--- a/tests/test-common.C
+++ b/tests/test-common.C
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/tests/test-common.C
  * Copyright (C) 2001, 2002 Bradford Hovinen
  *
@@ -20,8 +20,17 @@
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  */
-#ifndef __TEST_COMMON_C
-#define __TEST_COMMON_C
+
+
+/*! @file  tests/test-common.C
+ * @ingroup tests
+ * @brief  no doc
+ */
+
+
+
+#ifndef __LINBOX_test_common_C
+#define __LINBOX_test_common_C
 
 
 #include "linbox/linbox-config.h"
@@ -33,184 +42,19 @@
 #include <cstdlib>
 #include <cstring>
 #include <cmath>
+#include <list>
 
 #include "linbox/util/commentator.h"
 #include "linbox/field/archetype.h"
 
 #include "test-common.h"
 
-using namespace LinBox;
-
-/* Display a help message on command usage */
-
-void printHelpMessage (const char *program, Argument *args, bool printDefaults = false) 
-{
-	int i, l;
-
-	// Skip past libtool prefix in program name
-	if (!strncmp (program, "lt-", strlen ("lt-")))
-		program += strlen ("lt-");
-
-	std::cout << "Usage: " << program << " [options] [<report file>]" << std::endl;
-	std::cout << std::endl;
-	std::cout << "Where [options] are the following:" << std::endl;
-
-	for (i = 0; args[i].c != '\0'; i++) {
-		if (args[i].example != 0) {
-			std::cout << "  " << args[i].example;
-			l = 10 - strlen (args[i].example);
-			do std::cout << ' '; while (--l > 0);
-		}
-		else if (args[i].type == TYPE_NONE)
-			std::cout << "  -" << args[i].c << " {YN+-} ";
-		else 
-			std::cout << "  -" << args[i].c << ' ' << args[i].c << "      ";
-			
-		std::cout << args[i].helpString;
-		if (printDefaults) {
-			l = 54 - strlen (args[i].helpString);
-			do std::cout << ' '; while (--l > 0);
-			std::cout << " (default ";
-			switch (args[i].type) {
-			case TYPE_NONE:
-				cout << ((*(bool *)args[i].data)?"ON":"OFF");
-				break;
-			case TYPE_INT:
-				cout << *(int *) args[i].data;
-				break;
-			case TYPE_INTEGER:
-				cout << *(Integer *) args[i].data;
-				break;
-			case TYPE_DOUBLE:
-				cout << *(double *) args[i].data;
-				break;
-			}
-			std::cout << ")";		
-		}
-		std::cout << std::endl;
-	}
-
-	std::cout << "  -h or -?  Display this message" << std::endl;
-	std::cout << "For boolean switches, the argument may be omitted, meaning the switch should be ON" << std::endl;
-	std::cout << std::endl;
-	std::cout << "If <report file> is '-' the report is written to std output.  If <report file> is" << std::endl; 
-	std::cout << "not given, then no detailed reporting is done. This is suitable if you wish only" << std::endl;
-	std::cout << "to determine whether the tests succeeded." << std::endl;
-	std::cout << std::endl;
-	std::cout << "[1] N.B. This program does not verify the primality of Q, and does not use a" << std::endl;
-	std::cout << "    field extension in the event that Q=p^n, n > 1" << std::endl;
-	std::cout << std::endl;
-}
-
-/* Find an argument in the argument list for a character */
-
-Argument *findArgument (Argument *args, char c) 
-{
-	int i;
-
-	for (i = 0; args[i].c != '\0' && args[i].c != c; i++);
-
-	if (args[i].c != '\0')
-		return &(args[i]);
-	else
-		return (Argument *) 0;
-}
-
-/* Parse command line arguments */
-
-void parseArguments (int argc, char **argv, Argument *args, bool printDefaults)
-{
-	int i;
-	Argument *current;
-
-	for (i = 1; i < argc; i++) {
-		if (argv[i][0] == '-') {
-			if (argv[i][1] == 0) {
-			commentator.setBriefReportStream (cout);
-			commentator.setReportStream (cout);
-			std::cout << "Writing report data to cout (intermingled with brief report)" << std::endl << std::endl;
-			std::cout.flush ();
-			}
-			else if (argv[i][1] == 'h' || argv[i][1] == '?') {
-				printHelpMessage (argv[0], args, printDefaults);
-				exit (1);
-			}
-			else if ((current = findArgument (args, argv[i][1])) != (Argument *) 0) {
-				switch (current->type) {
-				case TYPE_NONE:
-					if (argc == i+1 || (argv[i+1][0] == '-' && argv[i+1][1] != '\0')) {
-						// if at last argument, or next argument is a switch, set to true
-						*(bool *) current->data = true;
-						break;
-					}
-					*(bool *) current->data = 
-						(argv[i+1][0] == '+' 
-						 || argv[i+1][0] == 'Y' 
-						 || argv[i+1][0] == 'y' 
-						 || argv[i+1][0] == 'T' 
-						 || argv[i+1][0] == 't') ;
-					i++;
-					break;
-
-				case TYPE_INT:
-					*(int *) current->data = atoi (argv[i+1]);
-					i++;
-					break;
-
-				case TYPE_INTEGER: 
-					{
-						integer tmp(argv[i+1]);
-						*(integer *) current->data = tmp;
-					}
-					i++;
-					break;
-
-				case TYPE_DOUBLE:
-					*(double *) current->data = atof (argv[i+1]);
-					i++;
-					break;
-				}
-			} else {
-				std::cerr << "ERROR: Bad argument " << argv[i] << std::endl;
-				break;
-			}
-		} else {
-		    commentator.setBriefReportStream(cout);
-			commentator.setDefaultReportFile (argv[i]);
-			std::cout << "Writing report data to " << argv[i] << std::endl << std::endl;
-			std::cout.flush ();
-		}
-	}
-}
-
-std::ostream& writeCommandString (std::ostream& os, Argument *args, char* programName) {
-	os << programName;
-	for (int i = 0; args[i].c != '\0'; i++) {
-		cout << " -" << args[i].c;
-		switch (args[i].type) {
-		case TYPE_NONE:
-			if (! (*(bool *)args[i].data)) os << " N";
-			break;
-		case TYPE_INT:
-			os << ' ' << *(int *) args[i].data;
-			break;
-		case TYPE_INTEGER:
-			os << ' ' << *(Integer *) args[i].data;
-			break;
-		case TYPE_DOUBLE:
-			os << ' ' << *(double *) args[i].data;
-			break;
-		}
-	}
-	return os << std::endl;
-}
-
-bool isPower (integer n, integer m)
+bool isPower (LinBox::integer n, LinBox::integer m)
 {
 	return (n == 1) || (((n % m) == 0) && isPower (n/m, m));
 }
 
-inline double incompleteGamma (double a, double x, double tol) 
+inline double incompleteGamma (double a, double x, double tol)
 {
 	double xa_ex = pow (x, a) * exp (-x);
 	double pi = 1.0;
@@ -226,7 +70,7 @@ inline double incompleteGamma (double a, double x, double tol)
 		sigma += xn / pi;
 		xn *= x;
 		++n;
-	} while (abs (sigma - last_sigma) >= tol);
+	} while (abs (sigma - last_sigma) >= tol) ;
 
 	return sigma * xa_ex;
 }
@@ -235,5 +79,5 @@ double chiSquaredCDF (double chi_sqr, double df)
 {
 	return incompleteGamma (df / 2.0, chi_sqr / 2.0, 1e-10) / exp (gamma (df / 2.0));
 }
-#endif // __TEST_COMMON_H
+#endif // __LINBOX_test_common_C
 
diff --git a/tests/test-common.h b/tests/test-common.h
index eba2bf3..8844f2a 100644
--- a/tests/test-common.h
+++ b/tests/test-common.h
@@ -1,5 +1,5 @@
 /* -*- 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
 /* linbox/tests/test-common.C
  * Copyright (C) 2001, 2002 Bradford Hovinen
  *
@@ -11,14 +11,14 @@
  * Added parametrization to the VectorCategory tags to make them fit the
  * Rootbeer meeting design of VectorCategories being parametrized by
  * VectorTraits.
- * 
+ *
  * ------------------------------------
- * 
+ *
  * See COPYING for license information.
  */
 
-#ifndef __TEST_COMMON_H
-#define __TEST_COMMON_H
+#ifndef __LINBOX_test_common_H
+#define __LINBOX_test_common_H
 
 #include <iostream>
 #include <fstream>
@@ -30,33 +30,20 @@
 
 using namespace std;
 
-enum ArgumentType {
-	TYPE_NONE, TYPE_INT, TYPE_INTEGER, TYPE_DOUBLE
-};
-#define TYPE_BOOL TYPE_NONE
-
-struct Argument 
-{
-	char             c;
-	const char            *example;
-	const char            *helpString;
-	ArgumentType     type;
-	void            *data;
-};
-// example may be passed as null and will be generated intelligently
-// eg "-b {YN+-}" for bools, "-v v" for all else
+#include "linbox/util/commentator.h"
+#include "fflas-ffpack/utils/args-parser.h"
 
 template <class Field, class Vector>
-void printVector (Field &F, ostream &output, const Vector &v) 
+void printVector (Field &F, ostream &output, const Vector &v)
 { printVectorSpecialized(F, output, v, typename LinBox::VectorTraits<Vector>::VectorCategory()); }
 
 template <class Field, class Vector>
 void printVectorSpecialized(
-		Field &F, 
-		ostream &output, 
-		const Vector &v, 
-		LinBox::VectorCategories::DenseVectorTag tag
-		)
+			    Field &F,
+			    ostream &output,
+			    const Vector &v,
+			    LinBox::VectorCategories::DenseVectorTag tag
+			   )
 {
 	unsigned int i;
 
@@ -71,11 +58,11 @@ void printVectorSpecialized(
 
 template <class Field, class Vector>
 void printVectorSpecialized(
-		Field &F, 
-		ostream &output, 
-		const Vector &v, 
-		LinBox::VectorCategories::SparseSequenceVectorTag tag
-		)
+			    Field &F,
+			    ostream &output,
+			    const Vector &v,
+			    LinBox::VectorCategories::SparseSequenceVectorTag tag
+			   )
 {
 	typename Vector::const_iterator i;
 	unsigned int j;
@@ -97,11 +84,11 @@ void printVectorSpecialized(
 
 template <class Field, class Vector>
 void printVectorSpecialized(
-		Field &F, 
-		ostream &output, 
-		const Vector &v, 
-		LinBox::VectorCategories::SparseAssociativeVectorTag tag
-		)
+			    Field &F,
+			    ostream &output,
+			    const Vector &v,
+			    LinBox::VectorCategories::SparseAssociativeVectorTag tag
+			   )
 {
 	typename Vector::const_iterator i;
 	unsigned int j;
@@ -122,78 +109,82 @@ void printVectorSpecialized(
 }
 
 template <class Field, class Vector>
-bool areVectorsEqual (Field &F, const Vector &v, const Vector &w) 
-{ return areVectorsEqualSpecialized(F, v, w, LinBox::VectorTraits<Vector>::VectorCategory()); }
+bool areVectorsEqual (Field &F, const Vector &v, const Vector &w)
+{
+	return areVectorsEqualSpecialized(F, v, w, LinBox::VectorTraits<Vector>::VectorCategory());
+}
 
 template <class Field, class Vector>
 bool areVectorsEqualSpecialized(
-		Field &F, 
-		const Vector &v, 
-		const Vector &w, 
-		LinBox::VectorCategories::DenseVectorTag tag
-		)
+				Field &F,
+				const Vector &v,
+				const Vector &w,
+				LinBox::VectorCategories::DenseVectorTag tag
+			       )
 {
 	if (v.size() != w.size()) return false;
 
 	for (size_t i = 0; i < v.size(); i++)
 		if (!F.areEqual (w[i], v[i]))
 			return false;
-	
+
 	return true;
 }
 
 template <class Field, class Vector>
 bool areVectorsEqualSpecialized(
-		Field &F, 
-		const Vector &v, 
-		const Vector &w, 
-		LinBox::VectorCategories::SparseSequenceVectorTag tag
-		)
+				Field &F,
+				const Vector &v,
+				const Vector &w,
+				LinBox::VectorCategories::SparseSequenceVectorTag tag
+			       )
 {
 	if (v.size() != w.size()) return false;
 
 	typename Vector::const_iterator v_iter, w_iter;
 	w_iter = w.begin();
-	
+
 	for ( v_iter = v.begin(); v_iter != v.end(); v_iter++, w_iter++)
-		if ( (w_iter->first != v_iter->first) 
-				|| (!F.areEqual (w_iter->second, v_iter->second)) )
+		if ( (w_iter->first != v_iter->first)
+		     || (!F.areEqual (w_iter->second, v_iter->second)) )
 			return false;
-	
+
 	return true;
 }
 
 template <class Field, class Vector>
 bool areVectorsEqualSpecialized(
-		Field &F, 
-		const Vector &v, 
-		const Vector &w, 
-		LinBox::VectorCategories::SparseAssociativeVectorTag tag
-		)
+				Field &F,
+				const Vector &v,
+				const Vector &w,
+				LinBox::VectorCategories::SparseAssociativeVectorTag tag
+			       )
 {
 	if (v.size() != w.size()) return false;
 
 	typename Vector::const_iterator v_iter, w_iter;
 	w_iter = w.begin();
-	
+
 	for ( v_iter = v.begin(); v_iter != v.end(); v_iter++, w_iter++)
-		if ( (w_iter->first != v_iter->first) 
-				|| (!F.areEqual (w_iter->second, v_iter->second)) )
+		if ( (w_iter->first != v_iter->first)
+		     || (!F.areEqual (w_iter->second, v_iter->second)) )
 			return false;
-	
+
 	return true;
 }
 
 template <class Field, class Vector>
-bool allZero (Field &F, const Vector &v) 
-{ return allZeroSpecialized(F, v, LinBox::VectorTraits<Vector>::VectorCategory()); }
+bool allZero (Field &F, const Vector &v)
+{
+       	return allZeroSpecialized(F, v, LinBox::VectorTraits<Vector>::VectorCategory());
+}
 
 template <class Field, class Vector>
 bool allZeroSpecialized(
-		Field &F, 
-		const Vector &v, 
-		LinBox::VectorCategories::DenseVectorTag tag
-		)
+			Field &F,
+			const Vector &v,
+			LinBox::VectorCategories::DenseVectorTag tag
+		       )
 {
 	for (size_t i = 0; i < v.size(); i++)
 		if (!F.isZero (v[i]))
@@ -201,27 +192,27 @@ bool allZeroSpecialized(
 
 	return true;
 }
-	
+
 template <class Field, class Vector>
 bool allZeroSpecialized(
-		Field &F, 
-		const Vector &v, 
-		LinBox::VectorCategories::SparseSequenceVectorTag tag
-		)
+			Field &F,
+			const Vector &v,
+			LinBox::VectorCategories::SparseSequenceVectorTag tag
+		       )
 {
-	if (0 != v.size()) 
+	if (0 != v.size())
 		return false;
 	else
 		return true;
 }
 
 template <class Field, class Polynomial>
-void printPolynomial (Field &F, ostream &output, const Polynomial &v) 
+void printPolynomial (Field &F, ostream &output, const Polynomial &v)
 {
 	int i;
 	size_t val;
 
-	for (val = 0; val < v.size () && F.isZero (v[val]); val++);
+	for (val = 0; val < v.size () && F.isZero (v[val]); val++) ;
 
 	if (v.size () == 0 || val == v.size ())
 		output << "0";
@@ -249,7 +240,7 @@ applyPoly (const Field                             &F,
 	   Vector                                  &w,
 	   const Blackbox			   &A,
 	   const Polynomial                        &phi,
-	   const Vector                            &v) 
+	   const Vector                            &v)
 {
 	LinBox::VectorDomain <Field> VD (F);
 	Vector z;
@@ -274,7 +265,7 @@ vector <typename Field::Element> &
 multiEvalPoly (const Field                            &F,
 	       vector <typename Field::Element>       &w,
 	       const Polynomial                       &phi,
-	       const vector <typename Field::Element> &v) 
+	       const vector <typename Field::Element> &v)
 {
 	typedef vector <typename Field::Element> Vector;
 
@@ -305,7 +296,7 @@ Polynomial &
 interpolatePoly (const Field                            &F,
 		 Polynomial                             &f,
 		 const vector <typename Field::Element> &x,
-		 const vector <typename Field::Element> &y) 
+		 const vector <typename Field::Element> &y)
 {
 	typedef vector <typename Field::Element> Vector;
 
@@ -313,7 +304,7 @@ interpolatePoly (const Field                            &F,
 
 	// NB I leave one element in g always initialized to 0 as the ficticious
 	// negative-first coefficient. This streamlines some of the code.
-	static const int g_FUDGE = 1; 
+	static const int g_FUDGE = 1;
 	Vector g(n + g_FUDGE);
 	F.init (g[0], 0);
 
@@ -358,10 +349,6 @@ interpolatePoly (const Field                            &F,
 	return f;
 }
 
-void parseArguments (int argc, char **argv, Argument *args, bool printDefaults = true);
-
-/** writes the values of all arguments, preceded by the programName */
-std::ostream& writeCommandString (std::ostream& os, Argument *args, char* programName);
 
 bool isPower        (LinBox::integer n, LinBox::integer m);
 
@@ -378,4 +365,4 @@ double chiSquaredCDF (double chi_sqr, double df);
 #ifdef LinBoxSrcOnly
 #include "test-common.C"
 #endif
-#endif // __TEST_COMMON_H
+#endif // __LINBOX_test_common_H
diff --git a/tests/test-companion.C b/tests/test-companion.C
index c3c5e37..586362e 100644
--- a/tests/test-companion.C
+++ b/tests/test-companion.C
@@ -1,9 +1,36 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* tests/test-scalar-matrix.C
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) LinBox
+ *
  * using generic testBlackbox  -bds
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+/*! @file  tests/test-companion.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test NO DOC
  */
 
+
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -30,7 +57,7 @@ int main (int argc, char **argv)
 		{ 'n', "-n N", "Set dimension of test matrices to NxN.",        TYPE_INT,     &n },
 		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
 		{ 'i', "-i I", "Perform each test for I iterations.",          TYPE_INT,     &iterations },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
@@ -39,15 +66,15 @@ int main (int argc, char **argv)
 
 	commentator.start("Companion matrix black box test suite", "companion");
 
-	typedef Modular<uint32> Field;
+	typedef Modular<uint32_t> Field;
 	typedef vector <Field::Element> Vector;
 	typedef vector <Field::Element> Polynomial;
 	typedef Companion<Field> Blackbox;
 
 	Field F (q);
-	Field::Element d; 
+	Field::Element d;
 	F.init (d, -1);
-	Polynomial p(n+1, d);  
+	Polynomial p(n+1, d);
 	F.init (d, 1); F.assign(p[n], d);
 
 	Blackbox A (F, p);
diff --git a/tests/test-cra.C b/tests/test-cra.C
new file mode 100644
index 0000000..d4bef2b
--- /dev/null
+++ b/tests/test-cra.C
@@ -0,0 +1,566 @@
+/* -*- 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
+/* Copyright (C) LinBox
+ *
+ *  Written by Brice Boyer <brice.boyer at imag.fr>
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*! @file  tests/test-cra.C
+ * @ingroup tests
+ * @ingroup CRA
+ * @brief We test the various CRA algorithms here.
+ * @test cra algorithms
+ */
+
+#include "linbox/integer.h"
+#include "linbox/randiter/random-prime.h"
+#include "linbox/algorithms/cra-domain.h"
+#include "linbox/algorithms/cra-early-single.h"
+#include "linbox/algorithms/cra-early-multip.h"
+
+#include "linbox/matrix/blas-matrix.h"
+#include "linbox/algorithms/cra-full-multip.h"
+#include "linbox/algorithms/cra-full-multip-fixed.h"
+
+#define _LB_REPEAT(command) \
+do { for (size_t i = 0 ; pass && i < iters ; ++i) {  command } } while(0)
+
+using namespace LinBox ;
+
+
+// testing EarlySingleCRA
+template< class T >
+int test_early_single(std::ostream & report, size_t PrimeSize, size_t Size)
+{
+
+	typedef typename std::vector<T> Vect ;
+	typedef typename Vect::iterator Iterator;
+	Vect primes(Size) ;
+	RandomPrimeIterator RP(PrimeSize);
+	/*  primes, probably not all coprime... */
+	for (size_t i = 0 ; i < Size ; ++i) {
+		primes[i] = RP.randomPrime() ;
+		++RP ;
+	}
+
+	/*  residues */
+	Vect residues(Size) ;
+	for (size_t i = 0 ; i < Size ; ++i)
+		residues[i] = Integer::random(PrimeSize-1);
+
+	typedef LinBox::Modular<double> ModularField ;
+
+	Iterator genprime = primes.begin()  ; // prime iterator
+	Iterator residu = residues.begin()  ; // residu iterator
+
+	report << "EarlySingleCRA (" <<  4UL << ')' << std::endl;
+	EarlySingleCRA<ModularField> cra( 4UL ) ;
+	Integer res = 0; // the result
+	typedef ModularField::Element Element;
+	Element residue ; // temporary
+	{ /* init */
+		ModularField F(*genprime);
+		F.init(residue,*residu);
+		cra.initialize(F,residue);
+		++genprime;
+		++residu;
+	}
+	while (genprime < primes.end() && !cra.terminated() )
+	{ /* progress */
+		if (cra.noncoprime((integer)*genprime)) {
+			report << "bad luck, you picked twice the same prime..." <<std::endl;
+			report << "EarlySingleCRA exiting successfully." << std::endl;
+			return EXIT_SUCCESS ; // pas la faute à cra...
+		}
+		ModularField F(*genprime);
+		F.init(residue,*residu);
+		cra.progress(F,residue);
+		++genprime;
+		++residu ;
+	}
+
+	cra.result(res);
+
+	for (size_t i = 0 ; i < Size ; ++i){
+		ModularField F(primes[i]);
+		Element tmp1,tmp2 ;
+		F.init(tmp1,res);
+		F.init(tmp2,residues[i]);
+		if(!F.areEqual(tmp1,tmp2)){
+			report << tmp1 << "!=" << tmp2 << std::endl;
+			report << " *** EarlySingleCRA failed. ***" << std::endl;
+			return EXIT_FAILURE ;
+		}
+	}
+
+	report << "EarlySingleCRA exiting successfully." << std::endl;
+
+	return EXIT_SUCCESS ;
+}
+
+// testing EarlyMultipCRA
+template< class T >
+int test_early_multip(std::ostream & report, size_t PrimeSize, size_t Taille, size_t Size)
+{
+
+	typedef typename std::vector<T>                     Vect ;
+	typedef typename Vect::iterator                  Iterator;
+	typedef typename std::vector<Vect>::iterator VectIterator;
+	typedef LinBox::Modular<double>             ModularField ;
+	typedef ModularField::Element                     Element;
+	typedef std::vector<Integer>                      IntVect;
+	typedef std::vector<Element>                        pVect;
+
+	/*  primes */
+	Vect primes(Size) ;
+	RandomPrimeIterator RP(PrimeSize);
+	for (size_t i = 0 ; i < Size ; ++i) {
+		primes[i] = RP.randomPrime() ;
+		++RP ;
+	}
+
+	/*  residues */
+	std::vector<Vect> residues(Size) ;
+	for (size_t i = 0 ; i < Size ; ++i){
+		residues[i].resize(Taille);
+		for (size_t j = 0 ; j < Taille ; ++j)
+			residues[i][j] = Integer::random(PrimeSize-1);
+	}
+
+
+	Iterator   genprime = primes.begin()    ; // prime iterator
+	VectIterator residu = residues.begin()  ; // residu iterator
+
+	report << "EarlyMultpCRA (" <<  4UL << ')' << std::endl;
+	EarlyMultipCRA<ModularField> cra( 4UL ) ;
+	IntVect result (Taille); // the result
+	pVect residue(Taille) ; // temporary
+	{ /* init */
+		ModularField F(*genprime);
+		for (size_t i = 0 ; i < Taille ; ++i)
+			F.init(residue[i],(*residu)[i]);
+		cra.initialize(F,residue);
+		++genprime;
+		++residu;
+	}
+	while (genprime < primes.end() && !cra.terminated() )
+	{ /* progress */
+		if (cra.noncoprime((integer)*genprime)) {
+			report << "bad luck, you picked twice the same prime..." <<std::endl;
+			report << "EarlyMultipCRA exiting successfully." << std::endl;
+			return EXIT_SUCCESS ; // pas la faute à cra...
+		}
+		ModularField F(*genprime);
+		for (size_t i = 0 ; i < Taille ; ++i)
+			F.init(residue[i],(*residu)[i]);
+		cra.progress(F,residue);
+		++genprime;
+		++residu ;
+	}
+
+	cra.result(result);
+
+	for (size_t i = 0 ; i < Size ; ++i){
+		ModularField F(primes[i]);
+		for (size_t j = 0 ; j < Taille ; ++j){
+			Element tmp1,tmp2 ;
+			F.init(tmp1,result[j]);
+			F.init(tmp2,residues[i][j]);
+			if(!F.areEqual(tmp1,tmp2)){
+				report << " *** EarlyMultipCRA failed. ***" << std::endl;
+				return EXIT_FAILURE ;
+			}
+		}
+	}
+
+	report << "EarlyMultipCRA exiting successfully." << std::endl;
+
+	return EXIT_SUCCESS ;
+}
+
+
+#if 1 /* testing FullMultipBlasMatCRA */
+template< class T>
+int test_full_multip_matrix(std::ostream & report, size_t PrimeSize, size_t Size, std::pair<size_t, size_t> dims)
+{
+
+	typedef typename std::vector<T>                    Vect ;
+	typedef typename LinBox::BlasMatrix<T>           Matrix ;
+	typedef typename std::vector<Matrix>            MatVect ;
+	typedef typename Vect::iterator                 Iterator;
+	typedef typename MatVect::iterator           MatIterator;
+	typedef typename LinBox::BlasMatrix<Integer>  IntMatrix ;
+
+	typedef LinBox::Modular<double>            ModularField ;
+	typedef ModularField::Element                    Element;
+	typedef typename LinBox::BlasMatrix<Element>    pMatrix ;
+
+	Vect primes(Size) ;
+	/*  probably not all coprime... */
+	RandomPrimeIterator RP(PrimeSize);
+	for (size_t i = 0 ; i < Size ; ++i) {
+		primes[i] = RP.randomPrime() ;
+		++RP ;
+	}
+
+	/*  residues */
+	const Matrix Zero (dims.first,dims.second);
+	MatVect residues(Size) ;
+	for (size_t k = 0 ; k < Size ; ++k) {
+		residues[k] = Zero ;
+		for (size_t i = 0 ; i < Zero.rowdim() ; ++i)
+			for (size_t j = 0 ; j < Zero.coldim() ; ++j)
+				residues[k].setEntry( i,j,Integer::random(PrimeSize-1) );
+	}
+
+	Iterator  genprime =   primes.begin()  ; // prime iterator
+	MatIterator residu = residues.begin()  ; // residu iterator
+
+	double LogIntSize = (PrimeSize+1)*std::log(2)+std::log(Size)+1 ;
+
+	std::pair<size_t,double> my_pair(dims.first*dims.second,LogIntSize)  ;
+
+	report << "FullMultipBlasMatCRA (" <<  my_pair.first << ", " << my_pair.second << ')' << std::endl;
+	FullMultipBlasMatCRA<ModularField> cra( my_pair ) ;
+	IntMatrix result(dims.first,dims.second); // the result
+	pMatrix residue(dims.first,dims.second) ; // temporary
+	{ /* init */
+		ModularField F(*genprime);
+		for (size_t i = 0 ; i < residue.rowdim(); ++i)
+			for (size_t j = 0 ; j < residue.coldim(); ++j)
+				F.init(residue.refEntry(i,j),(*residu).getEntry(i,j));
+		cra.initialize(F,residue);
+		++genprime;
+		++residu;
+	}
+	while (genprime < primes.end() /*  && !cra.terminated() */ )
+	{ /* progress */
+		if (cra.noncoprime((integer)*genprime))
+		{
+			report << "bad luck, you picked twice the same prime..." <<std::endl;
+			report << "FullMultipBlasMatCRA exiting successfully." << std::endl;
+			return EXIT_SUCCESS ; // pas la faute à cra...
+		}
+		ModularField F(*genprime);
+		for (size_t i = 0 ; i < residue.rowdim(); ++i)
+			for (size_t j = 0 ; j < residue.coldim(); ++j)
+				F.init(residue.refEntry(i,j),(*residu).getEntry(i,j));
+
+		cra.progress(F,residue);
+		++genprime;
+		++residu ;
+	}
+
+	cra.result(result);
+
+	for (size_t i = 0 ; i < Size ; ++i){
+		ModularField F(primes[i]);
+		for (size_t l = 0 ; l < dims.first ; ++l)
+			for (size_t m = 0 ; m < dims.second ; ++m) {
+				Element tmp1,tmp2 ;
+				F.init(tmp1,result.getEntry(l,m));
+				F.init(tmp2,residues[i].getEntry(l,m));
+				if(!F.areEqual(tmp1,tmp2)){
+					report << result.getEntry(l,m) << ';' << residues[i].getEntry(l,m) << '@' << primes[i] << std::endl;
+					report << i << ':' << l << ',' << m << "> " << tmp1 << "!=" << tmp2 << std::endl;
+					report << " *** FullMultipBlasMatCRA failed. ***" << std::endl;
+					return EXIT_FAILURE ;
+				}
+			}
+	}
+
+	report << "FullMultipBlasMatCRA exiting successfully." << std::endl;
+
+	return EXIT_SUCCESS ;
+}
+#endif
+
+// testing FullMultipCRA
+template< class T>
+int test_full_multip(std::ostream & report, size_t PrimeSize, size_t Size, size_t Taille)
+{
+
+	typedef typename std::vector<T>                    Vect ;
+	typedef typename std::vector<Vect>             VectVect ;
+	typedef std::vector<Integer>                    IntVect ;
+	typedef typename Vect::iterator                 Iterator;
+	typedef typename VectVect::iterator         VectIterator;
+
+	typedef LinBox::Modular<double >           ModularField ;
+	typedef ModularField::Element                    Element;
+	typedef typename std::vector<Element>             pVect ;
+
+	Vect primes(Size) ;
+	/*  probably not all coprime... */
+	RandomPrimeIterator RP(PrimeSize);
+	for (size_t i = 0 ; i < Size ; ++i) {
+		primes[i] = RP.randomPrime() ;
+		++RP ;
+	}
+
+	/*  residues */
+	VectVect residues(Size) ;
+	for (size_t k = 0 ; k < Size ; ++k) {
+		residues[k].resize(Taille) ;
+		for (size_t i = 0 ; i < Taille ; ++i)
+			residues[k][i] = Integer::random(PrimeSize-1) ;
+	}
+
+
+	Iterator   genprime =   primes.begin()  ; // prime iterator
+	VectIterator residu = residues.begin()  ; // residu iterator
+
+	double LogIntSize = PrimeSize*std::log(2)+std::log(Size)+1 ;
+
+	report << "FullMultipCRA (" <<  LogIntSize << ')' << std::endl;
+	FullMultipCRA<ModularField> cra( LogIntSize ) ;
+	IntVect result(Taille) ; // the result
+	pVect  residue(Taille) ; // temporary
+	{ /* init */
+		ModularField F(*genprime);
+		for (size_t i = 0 ; i < Taille; ++i)
+			F.init(residue[i],(*residu)[i]);
+		cra.initialize(F,residue);
+		++genprime;
+		++residu;
+	}
+	while (genprime < primes.end() /* && !cra.terminated()*/ )
+	{ /* progress */
+		if (cra.noncoprime((integer)*genprime))
+		{
+			report << "bad luck, you picked twice the same prime..." <<std::endl;
+			report << "FullMultipCRA exiting successfully." << std::endl;
+			return EXIT_SUCCESS ; // pas la faute à cra...
+		}
+		ModularField F(*genprime);
+		for (size_t i = 0 ; i < Taille; ++i)
+			F.init(residue[i],(*residu)[i]);
+		cra.progress(F,residue);
+		++genprime;
+		++residu ;
+	}
+
+	cra.result(result);
+
+	for (size_t i = 0 ; i < Size ; ++i){
+		ModularField F(primes[i]);
+		for (size_t j = 0 ; j < Taille ; ++j) {
+			Element tmp1,tmp2 ;
+			F.init(tmp1,result[j]);
+			F.init(tmp2,residues[i][j]);
+			if(!F.areEqual(tmp1,tmp2)){
+				report << " *** FullMultipCRA failed. ***" << std::endl;
+				return EXIT_FAILURE ;
+			}
+		}
+	}
+
+	report << "FullMultipCRA exiting successfully." << std::endl;
+
+	return EXIT_SUCCESS ;
+}
+
+
+
+#if 1 /* testing FullMultipFixedCRA */
+template< class T>
+int test_full_multip_fixed(std::ostream & report, size_t PrimeSize, size_t Size, size_t Taille)
+{
+
+
+	typedef typename std::vector<T>                    Vect ;
+	typedef typename std::vector<Vect>             VectVect ;
+	typedef std::vector<Integer>                    IntVect ;
+	typedef IntVect::iterator                IntVectIterator;
+	typedef typename Vect::iterator                 Iterator;
+	typedef typename VectVect::iterator         VectIterator;
+
+	typedef LinBox::Modular<double >           ModularField ;
+	typedef ModularField::Element                    Element;
+	typedef typename std::vector<Element>             pVect ;
+	typedef typename pVect::iterator          pVectIterator ;
+
+	Vect primes(Size) ;
+	/*  probably not all coprime... */
+	RandomPrimeIterator RP(PrimeSize);
+	for (size_t i = 0 ; i < Size ; ++i) {
+		primes[i] = RP.randomPrime() ;
+		++RP ;
+	}
+
+	/*  residues */
+	VectVect residues(Size) ;
+	for (size_t k = 0 ; k < Size ; ++k) {
+		residues[k].resize(Taille) ;
+		for (size_t i = 0 ; i < Taille ; ++i)
+			residues[k][i] = Integer::random(PrimeSize-1) ;
+	}
+
+	Iterator   genprime =   primes.begin()  ; // prime iterator
+	VectIterator residu = residues.begin()  ; // residu iterator
+
+	double LogIntSize = PrimeSize*std::log(2)+std::log(Size) ;
+
+	std::pair<size_t,double> my_pair(Taille,LogIntSize)  ;
+
+	report << "FullMultipFixedCRA (" <<  my_pair.first << ", " << my_pair.second << ')' << std::endl;
+
+	FullMultipFixedCRA<ModularField> cra( my_pair ) ;
+	IntVect result(Taille) ; // the result
+	pVect  residue(Taille) ; // temporary
+	pVectIterator residue_it = residue.begin();
+	{ /* init */
+		ModularField F(*genprime);
+		for (size_t i = 0 ; i < Taille; ++i)
+			F.init(residue[i],(*residu)[i]);
+		cra.initialize(F,residue_it);
+		++genprime;
+		++residu;
+	}
+	while (genprime < primes.end() /* && !cra.terminated()*/ )
+	{ /* progress */
+		if (cra.noncoprime((integer)*genprime))
+		{
+			report << "bad luck, you picked twice the same prime..." <<std::endl;
+			report << "FullMultipFixedCRA exiting successfully." << std::endl;
+			return EXIT_SUCCESS ; // pas la faute à cra...
+		}
+		ModularField F(*genprime);
+		pVectIterator residue_it = residue.begin();
+		for (size_t i = 0 ; i < Taille; ++i)
+			F.init(residue[i],(*residu)[i]);
+		cra.progress(F,residue_it);
+		++genprime;
+		++residu ;
+	}
+
+	IntVectIterator result_it = result.begin();
+
+	cra.result(result_it);
+
+	for (size_t i = 0 ; i < Size ; ++i){
+		ModularField F(primes[i]);
+		for (size_t j = 0 ; j < Taille ; ++j) {
+			Element tmp1,tmp2 ;
+			F.init(tmp1,result[j]);
+			F.init(tmp2,residues[i][j]);
+			if(!F.areEqual(tmp1,tmp2)){
+				report << " *** FullMultipFixedCRA failed. ***" << std::endl;
+				return EXIT_FAILURE ;
+			}
+		}
+	}
+
+	report << "FullMultipFixedCRA exiting successfully." << std::endl;
+
+	return EXIT_SUCCESS ;
+}
+#endif
+
+bool test_CRA_algos(size_t PrimeSize, size_t Size, size_t Taille, size_t iters)
+{
+	bool pass = true ;
+	std::ostream &report = LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT,
+							   INTERNAL_DESCRIPTION);
+
+
+
+	typedef std::pair<size_t,size_t> Pair ;
+
+	/* EARLY SINGLE */
+	_LB_REPEAT( if (test_early_single<double>(report,22,Size))                       pass = false ;  ) ;
+	_LB_REPEAT( if (test_early_single<integer>(report,PrimeSize,Size))               pass = false ;  ) ;
+
+	/* EARLY MULTIPLE */
+	_LB_REPEAT( if (test_early_multip<double>(report,22,Taille*2,Size))              pass = false ;  ) ;
+	_LB_REPEAT( if (test_early_multip<integer>(report,PrimeSize,Taille*2,Size))      pass = false ;  ) ;
+
+	_LB_REPEAT( if (test_early_multip<double>(report,22,Taille/4,Size))              pass = false ;  ) ;
+	_LB_REPEAT( if (test_early_multip<integer>(report,PrimeSize,Taille/4,Size))      pass = false ;  ) ;
+
+	/* FULL MULTIPLE */
+	_LB_REPEAT( if (test_full_multip<double>(report,22,Size,Taille))                 pass = false ;  ) ;
+	_LB_REPEAT( if (test_full_multip<integer>(report,PrimeSize,Size,Taille))         pass = false ;  ) ;
+
+	_LB_REPEAT( if (test_full_multip<double>(report,22,Size,Taille/4))               pass = false ;  ) ;
+	_LB_REPEAT( if (test_full_multip<integer>(report,PrimeSize,Size,Taille/4))       pass = false ;  ) ;
+
+#if 1 /* FULL MULTIPLE FIXED */
+	_LB_REPEAT( if (test_full_multip_fixed<double>(report,22,Size,Taille))           pass = false ;  ) ;
+	_LB_REPEAT( if (test_full_multip_fixed<integer>(report,PrimeSize,Size,Taille))   pass = false ;  ) ;
+
+	_LB_REPEAT( if (test_full_multip_fixed<double>(report,22,Size,Taille/4))         pass = false ;  ) ;
+	_LB_REPEAT( if (test_full_multip_fixed<integer>(report,PrimeSize,Size,Taille/4)) pass = false ;  ) ;
+#endif
+
+
+#if 1 /* FULL MULTIPLE MATRIX */
+	Taille = 15 ;
+	Pair q(Taille,2*Taille);
+	_LB_REPEAT( if (test_full_multip_matrix<double>(report,22,Size,q))               pass = false ;  ) ;
+	_LB_REPEAT( if (test_full_multip_matrix<integer>(report,PrimeSize,Size,q))       pass = false ;  ) ;
+
+	Pair s(Taille*2,Taille);
+	_LB_REPEAT( if (test_full_multip_matrix<double>(report,22,Size,s))               pass = false ;  ) ;
+	_LB_REPEAT( if (test_full_multip_matrix<integer>(report,PrimeSize,Size,s))       pass = false ;  ) ;
+
+#endif
+
+	return pass ;
+
+}
+
+#include "test-common.h"
+#include "linbox/util/timer.h"
+
+// launching tests
+int main(int ac, char ** av)
+{
+
+	/*  Argument parsing/setting */
+
+	static size_t       n = 50;    /*  Taille */
+	static size_t       p = 22;    /*  PrimeSize */
+	// static size_t    seed =  0;    /*  ! unused */
+	static size_t   iters = 20;    /* _LB_REPEAT */
+
+        static Argument as[] = {
+                { 'n', "-n N", "Set number of primes.", TYPE_INT , &n },
+                { 'p', "-p P", "Set size of test primes.", TYPE_INT , &p },
+                { 'i', "-i I", "Perform each test for I iterations.",     TYPE_INT, &iters },
+		END_OF_ARGUMENTS
+        };
+
+	parseArguments (ac, av, as);
+
+	bool pass = true ;
+
+	srand(time(NULL));             // seeding
+	size_t PrimeSize   =  p;       // size of the residues/primes
+	size_t Size        =  n ;      // nb of residues/primes
+	size_t Taille      =  2*Size ; // nb of vectors of residues
+
+
+	commentator.start("CRA-Algos test suite", "CRA-Algos");
+
+	pass = test_CRA_algos(PrimeSize,Size,Taille,iters) ;
+
+	commentator.stop(MSG_STATUS (pass), (const char *) 0,"CRA-Algos test suite");
+	return !pass ;
+}
diff --git a/tests/test-cradomain.C b/tests/test-cradomain.C
new file mode 100644
index 0000000..47bc684
--- /dev/null
+++ b/tests/test-cradomain.C
@@ -0,0 +1,333 @@
+/* -*- 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
+
+/* Copyright (C) 2010 LinBox
+ *
+ * Time-stamp: <05 Apr 11 11:01:44 Jean-Guillaume.Dumas at imag.fr>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*! @file tests/test-cradomain.C
+ * @ingroup tests
+ * @brief tests LinBox::ChineseRemainer
+ * @test tests LinBox::ChineseRemainer (see \ref CRA)
+ */
+
+#include <linbox/algorithms/cra-domain.h>
+#include <linbox/field/modular-double.h>
+#include "linbox/algorithms/blas-domain.h"
+#include "linbox/algorithms/cra-early-multip.h"
+#include "linbox/algorithms/cra-full-multip.h"
+#include "linbox/algorithms/cra-full-multip-fixed.h"
+#include "linbox/algorithms/cra-givrnsfixed.h"
+#include "linbox/randiter/random-prime.h"
+#include "linbox/integer.h"
+
+using namespace LinBox;
+
+struct Interator {
+	std::vector<integer> _v;
+	double maxsize;
+
+	Interator(const std::vector<integer>& v) :
+		_v(v), maxsize(0.0)
+	{
+		for(std::vector<integer>::const_iterator it=_v.begin();
+		    it != _v.end(); ++it) {
+			double ds = ::Givaro::naturallog(*it);
+			maxsize = (maxsize<ds?ds:maxsize);
+		}
+	}
+
+	Interator(int n, int s) :
+		_v(n), maxsize(0.0)
+	{
+		for(std::vector<integer>::iterator it=_v.begin();
+		    it != _v.end(); ++it) {
+			Integer::random<false>(*it, s);
+			double ds = ::Givaro::naturallog(*it);
+			maxsize = (maxsize<ds?ds:maxsize);
+		}
+	}
+
+	const std::vector<integer>& getVector()
+	{
+	       	return _v;
+       	}
+	double getLogSize() const
+	{
+	       	return maxsize;
+	}
+
+	template<typename Field>
+	std::vector<typename Field::Element>& operator()(std::vector<typename Field::Element>& v,
+							 const Field& F) const
+	{
+		v.resize(_v.size());
+		std::vector<integer>::const_iterator vit=_v.begin();
+		typename std::vector<typename Field::Element>::iterator eit=v.begin();
+		for( ; vit != _v.end(); ++vit, ++eit){
+			F.init(*eit, *vit);
+		}
+
+		return v;
+	}
+};
+
+struct InteratorIt;
+namespace LinBox
+{
+	template<class Element> struct CRATemporaryVectorTrait<InteratorIt , Element> {
+		typedef typename std::vector<double>::iterator Type_t;
+	};
+}
+
+struct InteratorIt : public Interator {
+
+	mutable std::vector<double> _C;
+
+	InteratorIt(const std::vector<integer>& v) :
+		Interator(v), _C(v.size())
+	{}
+	InteratorIt(int n, int s) :
+		Interator(n,s), _C(n)
+	{}
+
+	template<typename Iterator, typename Field>
+	Iterator& operator()(Iterator& res, const Field& F) const
+	{
+		std::vector<integer>::const_iterator vit=this->_v.begin();
+		std::vector<double>::iterator eit=_C.begin();
+		for( ; vit != _v.end(); ++vit, ++eit) {
+			F.init(*eit, *vit);
+		}
+
+		return res=_C.begin();
+	}
+
+};
+
+template<typename Field> struct InteratorBlas;
+namespace LinBox
+{
+	template<class Element,class Field> struct CRATemporaryVectorTrait<InteratorBlas<Field> , Element> {
+		typedef typename LinBox::BlasMatrix<Element>::pointer Type_t;
+	};
+}
+
+template<typename Field>
+struct InteratorBlas : public Interator {
+	typedef typename Field::Element Element;
+	typedef LinBox::BlasMatrix<Element> Matrix;
+	typedef typename Matrix::pointer Pointer;
+	mutable Matrix _C;
+
+	InteratorBlas(const std::vector<integer>& v) : Interator(v), _C((int)v.size(), (int)1) {}
+	InteratorBlas(int n, int s) : Interator(n,s), _C(n,1) {}
+
+	Pointer& operator()(Pointer& res, const Field& F) const
+	{
+		std::vector<integer>::const_iterator vit=this->_v.begin();
+		res = _C.getWritePointer();
+		for( ; vit != _v.end(); ++vit, ++res)
+			F.init(*res, *vit);
+
+		return res=_C.getWritePointer();
+	}
+
+};
+
+#include <typeinfo>
+
+
+template<typename Builder, typename Iter, typename RandGen, typename BoundType>
+bool TestOneCRA(std::ostream& report, Iter& iteration, RandGen& genprime, size_t N, const BoundType& bound)
+{
+	report << "ChineseRemainder<" << typeid(Builder).name() << ">(" << bound << ')' << std::endl;
+	LinBox::ChineseRemainder< Builder > cra( bound );
+	std::vector<integer> Res(N);
+	cra( Res, iteration, genprime);
+	bool locpass = std::equal( Res.begin(), Res.end(), iteration.getVector().begin() );
+	if (locpass) report << "ChineseRemainder<" << typeid(Builder).name() << ">(" << iteration.getLogSize() << ')' << ", passed."  << std::endl;
+	else {
+		report << "***ERROR***: ChineseRemainder<" << typeid(Builder).name() << ">(" << iteration.getLogSize() << ')' << "***ERROR***"  << std::endl;
+		std::vector<integer>::const_iterator Rit=Res.begin();
+		std::vector<integer>::const_iterator Oit=iteration.getVector().begin();
+		for( ; Rit!=Res.end(); ++Rit, ++Oit)
+			if (*Rit != *Oit)
+				report << *Rit <<  " != " << * Oit << std::endl;
+
+	}
+	return locpass;
+}
+
+template<typename Builder, typename Iter, typename RandGen, typename BoundType>
+bool TestOneCRAbegin(std::ostream& report, Iter& iteration, RandGen& genprime, size_t N, const BoundType& bound)
+{
+	report << "ChineseRemainder<" << typeid(Builder).name() << ">(" << bound << ')' << std::endl;
+	LinBox::ChineseRemainder< Builder > cra( bound );
+	std::vector<integer> Res(N);
+	std::vector<integer>::iterator ResIT= Res.begin();
+	cra( ResIT, iteration, genprime);
+	bool locpass = std::equal( Res.begin(), Res.end(), iteration.getVector().begin() );
+	if (locpass) report << "ChineseRemainder<" << typeid(Builder).name() << ">(" << iteration.getLogSize() << ')' << ", passed."  << std::endl;
+	else {
+		report << "***ERROR***: ChineseRemainder<" << typeid(Builder).name() << ">(" << iteration.getLogSize() << ')' << "***ERROR***"  << std::endl;
+		std::vector<integer>::const_iterator Rit=Res.begin();
+		std::vector<integer>::const_iterator Oit=iteration.getVector().begin();
+		for( ; Rit!=Res.end(); ++Rit, ++Oit)
+			if (*Rit != *Oit)
+				report << *Rit <<  " != " << * Oit << std::endl;
+
+	}
+	return locpass;
+}
+
+template<typename Builder, typename Iter, typename RandGen, typename BoundType>
+bool TestOneCRAWritePointer(std::ostream& report, Iter& iteration, RandGen& genprime, size_t N, const BoundType& bound)
+{
+	report << "ChineseRemainder<" << typeid(Builder).name() << ">(" << bound << ')' << std::endl;
+	LinBox::ChineseRemainder< Builder > cra( bound );
+	LinBox::BlasMatrix<integer> Res( (int)N, (int)N);
+	cra( Res.getWritePointer(), iteration, genprime);
+	bool locpass = std::equal( iteration.getVector().begin(), iteration.getVector().end(), Res.getWritePointer() );
+
+	if (locpass) report << "ChineseRemainder<" << typeid(Builder).name() << ">(" << iteration.getLogSize() << ')' << ", passed."  << std::endl;
+	else {
+		report << "***ERROR***: ChineseRemainder<" << typeid(Builder).name() << ">(" << iteration.getLogSize() << ')' << "***ERROR***"  << std::endl;
+	}
+	return locpass;
+}
+
+
+bool TestCra(int N, int S, size_t seed)
+{
+
+	std::ostream &report = LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT,
+							   INTERNAL_DESCRIPTION);
+	// std::ostream &report = std::cout;
+
+	size_t new_seed = (seed?(seed):(BaseTimer::seed())) ;
+	report << "TestCra(" << N << ',' << S << ',' << new_seed << ')' << std::endl;
+	Integer::seeding(new_seed);
+
+	Interator iteration(N, S);
+	InteratorIt iterationIt(iteration.getVector());
+	InteratorBlas<LinBox::Modular<double> > iterationBlas(iteration.getVector());
+	LinBox::RandomPrimeIterator genprime( 24, new_seed );
+
+	bool pass = true;
+
+	pass &= TestOneCRA< LinBox::EarlyMultipCRA< LinBox::Modular<double> >,
+	     Interator, LinBox::RandomPrimeIterator>(
+						     report, iteration, genprime, N, 5);
+
+	pass &= TestOneCRA< LinBox::EarlyMultipCRA< LinBox::Modular<double> >,
+	     Interator, LinBox::RandomPrimeIterator>(
+						     report, iteration, genprime, N, 15);
+
+	pass &= TestOneCRA< LinBox::FullMultipCRA< LinBox::Modular<double> >,
+	     Interator, LinBox::RandomPrimeIterator>(
+						     report, iteration, genprime, N, iteration.getLogSize()+1);
+
+	pass &= TestOneCRA< LinBox::FullMultipCRA< LinBox::Modular<double> >,
+	     Interator, LinBox::RandomPrimeIterator>(
+						     report, iteration, genprime, N, 3*iteration.getLogSize()+15);
+
+	pass &= TestOneCRAbegin<LinBox::FullMultipFixedCRA< LinBox::Modular<double> >,
+	     InteratorIt, LinBox::RandomPrimeIterator>(
+						       report, iterationIt, genprime, N, std::pair<size_t,double>(N,iteration.getLogSize()+1));
+
+	pass &= TestOneCRAbegin<LinBox::FullMultipFixedCRA< LinBox::Modular<double> >,
+	     InteratorIt, LinBox::RandomPrimeIterator>(
+						       report, iterationIt, genprime, N, std::pair<size_t,double>(N,3*iteration.getLogSize()+15));
+
+
+	pass &= TestOneCRAWritePointer<LinBox::FullMultipFixedCRA< LinBox::Modular<double> >,
+	     InteratorIt, LinBox::RandomPrimeIterator>(
+						       report, iterationIt, genprime, N, std::pair<size_t,double>(N,iterationIt.getLogSize()+1) );
+
+	pass &= TestOneCRAWritePointer<LinBox::FullMultipFixedCRA< LinBox::Modular<double> >,
+	     InteratorIt, LinBox::RandomPrimeIterator>(
+						       report, iterationIt, genprime, N, std::pair<size_t,double>(N,3*iterationIt.getLogSize()+15) );
+
+	pass &= TestOneCRAWritePointer<LinBox::FullMultipFixedCRA< LinBox::Modular<double> >,
+	     InteratorBlas< LinBox::Modular<double> >,
+	     LinBox::RandomPrimeIterator>(
+					  report, iterationBlas, genprime, N, std::pair<size_t,double>(N,iterationIt.getLogSize()+1) );
+
+	pass &= TestOneCRAWritePointer<LinBox::FullMultipFixedCRA< LinBox::Modular<double> >,
+	     InteratorBlas< LinBox::Modular<double> >,
+	     LinBox::RandomPrimeIterator>(
+					  report, iterationBlas, genprime, N, std::pair<size_t,double>(N,3*iterationIt.getLogSize()+15) );
+
+
+        std::vector<integer> PrimeSet;
+        double PrimeSize = 0.0;
+        for( ; PrimeSize < (iterationIt.getLogSize()+1); ++genprime ) {
+            if (find(PrimeSet.begin(), PrimeSet.end(), *genprime) == PrimeSet.end()) {
+                PrimeSet.push_back( *genprime );
+                PrimeSize += ::Givaro::naturallog(*genprime);
+            }
+        }
+
+        std::vector<integer>::iterator psit = PrimeSet.begin();
+
+	pass &= TestOneCRA<
+            LinBox::GivaroRnsFixedCRA< LinBox::Modular<double> >,
+            Interator,
+            std::vector<integer>::iterator,
+            std::vector<integer> >(
+                 report, iteration, psit, N, PrimeSet);
+
+
+	if (pass) report << "TestCra(" << N << ',' << S << ')' << ", passed." << std::endl;
+	else
+		report << "***ERROR***: TestCra(" << N << ',' << S << ')' << " ***ERROR***" << std::endl;
+
+	return pass;
+}
+
+#include "test-common.h"
+#include "linbox/util/timer.h"
+
+int main (int argc, char **argv)
+{
+	static size_t n = 10;
+	static size_t s = 30;
+	static size_t seed = 0;
+	static int iterations = 20;
+
+	static Argument args[] = {
+		{ 'n', "-n N", "Set dimension of test vectors to NxN.", TYPE_INT , &n },
+		{ 's', "-s S", "Set size of test integers.", TYPE_INT , &s },
+		{ 'z', "-z Z", "Set seed.", TYPE_INT , &seed },
+		{ 'i', "-i I", "Perform each test for I iterations.",     TYPE_INT, &iterations },
+		END_OF_ARGUMENTS
+	};
+
+	parseArguments (argc, argv, args);
+
+	LinBox::commentator.start("CRA-Domain test suite", "CRADom");
+	bool pass = true;
+
+	for(int i=0; pass && i<iterations; ++i)
+		pass &= TestCra(n,s,seed);
+
+	LinBox::commentator.stop(MSG_STATUS (pass), (const char *) 0,"CRA-Domain test suite");
+	return pass ? 0 : -1;
+}
diff --git a/tests/test-dense-zero-one.C b/tests/test-dense-zero-one.C
new file mode 100644
index 0000000..9be71a8
--- /dev/null
+++ b/tests/test-dense-zero-one.C
@@ -0,0 +1,415 @@
+/* -*- 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
+/* Copyright (C) LinBox
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+
+/*! @file  tests/test-dense-zero-one.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test NO DOC
+ */
+
+
+
+
+#include "linbox/matrix/blas-matrix.h"
+#include "linbox/algorithms/blas-domain.h"
+#include "linbox/matrix/matrix-domain.h"
+#include "linbox/field/modular-float.h"
+#include "linbox/field/modular-double.h"
+
+#include "linbox/blackbox/dense-zero-one.h"
+
+#include <vector>
+#include "linbox/util/timer.h"
+#include "test-common.h"
+
+namespace LinBox
+{
+template <class _Field>
+struct BlackboxDomain : public _Field
+{
+	// types Scalar, Block, Blackbox
+	typedef _Field Field; // transitional
+	typedef typename _Field::Element Scalar;
+	typedef typename _Field::Element Element; // transitional
+	typedef typename _Field::RandIter RandIter;
+	typedef BlasMatrix<Element> Block;
+	/*struct Block: public BlasMatrix<Element> {
+		Block( int m, int n ): BlasMatrix<Element> ( m, n ) {}
+		Block& subBlock( Block & B, size_t i, size_t j, size_t m, size_t n ) {
+			return B = BlasMatrix<Element>(*this, i, j, m, n);
+		}
+		const Block& subBlock( const Block & B, size_t i, size_t j, size_t m, size_t n ) {
+			return B = BlasMatrix<Element>(static_cast<DenseMatrixBase<Element> >(*this), i, j, m, n);
+		}
+		Block & operator= (BlasMatrix<Element> & rhs){
+			*this = rhs;
+			return *this;
+		}
+	}; */
+	BlackboxDomain(){}
+	BlackboxDomain(long q): Field(q) {}
+
+	// A <-- A + B.  A and B must have same shape.
+	Block & addin( Block & A, const Block & B ) const { return MatrixDomain<Field>(*this).addin(A,B); }
+	// for the Scalar addin.
+	using Field::addin;
+
+	// A <-- B * C.  A, B, C must have compatible shapes.
+	Block & mul( Block & C, const Block & A, const Block & B ) const {
+		return BlasMatrixDomain<Field>(*this).mul(C,A,B);
+	}
+
+	// for the Scalar mul.
+	using Field::mul;
+
+	// C <-- B * C.  A, B, C must have compatible shapes.
+	Block & axpyin( Block & C, const Block & A, const Block & B ) const {
+		return BlasMatrixDomain<Field>(*this).axpyin(C,A,B);
+	}
+
+	// for the Scalar axpyin
+	using Field::axpyin;
+
+	// A <-- B * C.  A, B, C must have compatible shapes.
+	bool areEqual( const Block & A, const Block & B ) const {
+		return MatrixDomain<Field>(*this).areEqual(A,B);
+	}
+	// for the Scalar areEqual.
+	using Field::areEqual;
+
+	// Set the entries in a block to zero.
+	void zero( Block& B ) const {
+		for ( typename Block::RawIterator raw = B.rawBegin(); raw != B.rawEnd(); ++raw )
+			init(*raw, 0);
+	}
+
+	// Set the entries in a block to random field elements.
+	void random( Block& B) {
+		RandIter r(*this);
+		for ( typename Block::RowIterator row = B.rowBegin(); row != B.rowEnd(); ++row )
+			for ( typename Block::Row::iterator place = row->begin(); place != row->end(); ++place )
+				r.random(*place);
+	}
+
+}; //BlackboxDomain
+
+} // LinBox
+
+using namespace std;
+using namespace LinBox;
+
+template <class Blackbox>
+bool testAssociativity(Blackbox& A)
+{
+	typedef typename Blackbox::MatrixDomain Dom;
+	Dom MD = A.domain();
+	size_t m = A.rowdim(), n = A.coldim() - 100;
+	size_t k = (m + n)/2;
+	typename Dom::Block B(k,m), C(m,n);
+	MD.random(B); MD.random(C);
+
+	typename Dom::Block D(m,n), E(k,n);
+
+	A.apply(D, C); // D = AC
+	MD.mul(E,B,D); // E = B(AC)
+
+	typename Dom::Block F(k,m), G(k,n);
+
+	A.unpackingApplyTranspose(F,B); // F = BA
+	MD.mul(G,F,C); // G = (BA)C
+	return MD.areEqual(E,G);
+
+
+} // testAssociativity
+
+template <class Blackbox>
+void testTiming(Blackbox & A)
+{
+	typedef typename Blackbox::MatrixDomain Dom;
+	typedef typename Dom::Block Block;
+
+	Dom MD = A.domain();
+	size_t m = A.rowdim(), n = A.coldim();
+	size_t k = (m + n)/2;
+
+	LinBox::UserTimer timer;
+
+	Block B(n,k), C(m,k), D(k,m), E(k,n), F(k,k);
+	MD.random(B); MD.random(D);
+
+	vector<typename Dom::Element> v1, v2(m);
+	typename Dom::RandIter r(MD);
+	typename Dom::Element x;
+	for(size_t i = 0; i != n; ++i){
+		r.random(x);
+		v1.push_back(x);
+	}
+
+
+	//Tests:
+	cout << "Timing tests:" << endl << endl;
+
+	timer.clear(); timer.start();
+	for(size_t j = 0; j != m; ++j) A.apply(v2,v1);
+	timer.stop();
+	cout << "apply using vectors time: " << timer << endl;
+
+	timer.clear(); timer.start();
+	A.applyTranspose(C,B);
+	timer.stop();
+	cout << "apply using row addin time: " << timer << endl;
+
+	timer.clear(); timer.start();
+	A.unpackingApplyTranspose(C,B);
+	timer.stop();
+	cout << "apply using block axpy time: " << timer << endl;
+
+	timer.clear(); timer.start();
+	MD.mul(F, D, C);
+	timer.stop();
+	cout << "Matrix Domain mul time: " << timer << endl;
+
+	cout << "End of timing tests" << endl << endl;
+
+} // testTiming
+
+
+template <class Blackbox>
+void blockSizeTimingTest(Blackbox & A, size_t size)
+{
+	typedef typename Blackbox::MatrixDomain Dom;
+	typedef typename Dom::Block Block;
+
+	Dom MD = A.domain();
+	size_t m = A.rowdim();
+
+	LinBox::UserTimer timer;
+
+	Block B(m,m), C(m,m), D(m,m);
+	MD.random(B); MD.random(D);
+
+	cout << size << "         " << m << "       ";
+
+	timer.clear(); timer.start();
+	A.unpackingApply(C,B,size);
+	timer.stop();
+	cout << timer << "              ";
+
+	timer.clear(); timer.start();
+	A.unpackingApplyTranspose(C,B,size);
+	timer.stop();
+	cout << timer << "               ";
+
+	timer.clear(); timer.start();
+	MD.mul(C,D,B);
+	timer.stop();
+	cout << timer << "     ";
+
+	cout << endl;
+
+} //blockSizeTimingTest()
+
+
+template <class Blackbox>
+void stressTest (Blackbox & A)
+{
+	//Note that the rowdim/coldim of A must be 30000
+	typedef typename Blackbox::MatrixDomain Dom;
+	typedef typename Dom::Block Block;
+
+	Dom MD = A.domain();
+	size_t m = 30000;
+	size_t n = 2000;
+
+	LinBox::UserTimer timer;
+
+	Block B(m,n), C(m,n);
+	MD.random(B);
+
+	cout << "Test: 30000x30000 matrix multiplied by 30000x2000 matrix\nblock size = 2048\n\n";
+
+	timer.clear(); timer.start();
+	A.unpackingApply(C,B,2048);
+	timer.stop();
+	cout << "unpacking apply time: " << timer << endl;
+
+	Block D(m,m); MD.random(D);
+
+	timer.clear(); timer.start();
+	MD.mul(C,D,B);
+	timer.stop();
+	cout << "domain mul time: " << timer << endl;
+
+	cout << endl;
+}  //end stressTest()
+
+template <class Blackbox>
+void largeTest (Blackbox & A)
+{
+	//Use for large blackboxes
+	typedef typename Blackbox::MatrixDomain Dom;
+	typedef typename Dom::Block Block;
+
+	Dom MD = A.domain();
+	size_t m = A.coldim();
+	size_t n = 2000;
+
+	LinBox::UserTimer timer;
+
+	Block B(m,n), C(m,n);
+	MD.random(B);
+
+	cout << "Test: " << A.rowdim() << "x" << m << "blackbox multiplied by " << m << "x" << n << "block\nblock size: 2048\n\n";
+
+	timer.clear(); timer.start();
+	A.unpackingApply(C,B,2048);
+	timer.stop();
+	cout << "unpacking apply time: " << timer << endl;
+}  //end largeTest
+
+
+int main (int argc, char* argv[])
+{
+
+	static size_t n = 100;
+        static integer f = 4093;
+        static integer d = 1000003;
+	static bool t = false;
+
+        static Argument args[] = {
+                { 'n', "-n N", "Set dimension of test matrices to NxN.", TYPE_INT,     &n },
+                { 'f', "-f Q", "Operate over the \"field\" GF(Q).", TYPE_INTEGER, &f },
+                { 'd', "-d Q", "Operate over the \"field\" GF(Q).", TYPE_INTEGER, &d },
+                { 't', "-t T", "If T is flagged, only run timing tests.", TYPE_BOOL, &t },
+		END_OF_ARGUMENTS
+        };
+
+        parseArguments (argc, argv, args);
+
+	// create a dense-zero-one
+	typedef Modular<float> FieldF;
+	typedef Modular<double> FieldD;
+
+	BlackboxDomain<FieldF> F(f);
+	FieldF::RandIter r1(F);
+
+	BlackboxDomain<FieldD> D(d);
+	FieldD::RandIter r2(D);
+
+	DenseZeroOne<BlackboxDomain<FieldF> > A(F, n, n);
+	DenseZeroOne<BlackboxDomain<FieldD> > B(D, n, n);
+	FieldF::Element zeroF, oneF;
+	FieldD::Element zeroD, oneD;
+	F.init(oneF, 1); F.init(zeroF, 0);
+	D.init(oneD, 1); D.init(zeroD, 0);
+
+	for (size_t i = 0; i < n; ++i)
+		for (size_t j = 0; j < n; ++j) {
+			if (rand()%2){
+				A.setEntry(i, j, oneF);
+				B.setEntry(i, j, oneD);
+			}
+
+			else {
+				A.setEntry(i, j, zeroF);
+				B.setEntry(i, j, zeroD);
+			}
+		}
+
+	//A.write(cout) << endl << endl;
+	//B.write(cout) << endl << endl;
+
+	/* basic everyday test
+	cout << endl;
+	cout << "Domain: Modular<float>, GF(" << f << ")" << endl;
+	testTiming(A);
+
+	cout << "Domain: Modular<double>, GF(" << d << ")" << endl;
+	testTiming(B);
+	*/
+
+	/* block size tests
+	cout << endl;
+	cout << "Domain: Modular<double>, GF(" << d << ")" << endl << endl;
+	cout << "block Size     n     unpackingApply   unpackingApplyTranspose    Domain mul" << endl << endl;
+	for (size_t sizeU = 256; sizeU != 4096; sizeU *= 2)
+		for (int count = 500; count != 4500; count += 500){
+			DenseZeroOne<BlackboxDomain<FieldD> > C(D, count, count);
+
+			for (size_t i = 0; i < count; ++i)
+				for (size_t j = 0; j < count; ++j) {
+					if (rand()%2)
+						C.setEntry(i, j, oneD);
+					else
+						C.setEntry(i, j, zeroD);
+				}
+
+				blockSizeTimingTest(C, sizeU);
+		}
+	*/
+
+
+	/* stress test
+	cout << "Domain: Modular<double>, GF(" << d << ")" << endl;
+	DenseZeroOne<BlackboxDomain<FieldD> > C(D, 30000, 30000);
+	for (size_t i = 0; i != 30000; ++i)
+		for (size_t j = 0; j != 30000; ++j) {
+			if (rand()%2)
+				C.setEntry(i, j, oneD);
+			else
+				C.setEntry(i, j, zeroD);
+		}
+	stressTest(C);
+	*/
+
+	/* large tests
+	cout << "Domain: Modular<double>, GF(" << d << ")" << endl;
+	for (size_t dim = 120000; dim < 150000; dim *= 2){
+		DenseZeroOne<BlackboxDomain<FieldD> > C(D, dim, dim);
+		for (size_t i = 0; i != dim; ++i)
+			for (size_t j = 0; j != dim; ++j) {
+				if (rand()%2)
+					C.setEntry(i, j, oneD);
+				else
+					C.setEntry(i, j, zeroD);
+			}
+		cout << "blackbox created\n";
+		largeTest(C);
+	}
+	*/
+
+	if (!t){
+		bool pass = testAssociativity(B);
+		/*
+		if (pass)
+			cout << "passes" << endl;
+		else
+			cout << "fails" << endl;
+		*/
+
+		return pass ? 0 : -1;
+	}
+
+}
+
diff --git a/tests/test-dense.C b/tests/test-dense.C
index 24e1a5a..12f3580 100644
--- a/tests/test-dense.C
+++ b/tests/test-dense.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-dense.C
  * Copyright (C) 2001, 2002 Bradford Hovinen
@@ -11,6 +12,16 @@
  * See COPYING for license information
  */
 
+
+/*! @file  tests/test-dense.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test NO DOC
+ */
+
+
+
+// something currently commented out
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -20,7 +31,9 @@
 
 #include "linbox/util/commentator.h"
 #include "linbox/field/modular.h"
+#include "linbox/matrix/dense.h"
 #include "linbox/blackbox/dense.h"
+#include "linbox/matrix/dense-submatrix.h"
 
 #include "test-common.h"
 #include "test-generic.h"
@@ -41,9 +54,11 @@ using namespace LinBox;
  */
 
 template <class Field>
-static bool testIdentity (Field &F, long n, int iterations) 
+static bool testIdentity (Field &F, long n, int iterations)
 {
 	typedef typename Vector<Field>::Dense Vector;
+	typedef DenseMatrixBase <typename Field::Element> Base;
+	typedef DenseSubmatrix <typename Field::Element> Matrix;
 	typedef DenseMatrix <Field> Blackbox;
 
 	commentator.start ("Testing identity apply", "testIdentity", iterations);
@@ -53,7 +68,11 @@ static bool testIdentity (Field &F, long n, int iterations)
 
 	int i, j;
 
-	Blackbox I (F, n, n);
+	Blackbox I(F, n, n);
+	Matrix K(I);
+	//typename Field::Element x; F.init(x);
+	//F.write(std::cout, K.getEntry(x, i, j)) << std::endl;
+	//Matrix L(K);
 	typename Field::Element one;
 
 	F.init (one, 1);
@@ -79,7 +98,11 @@ static bool testIdentity (Field &F, long n, int iterations)
 		printVector<Field> (F, report, v);
 
 		I.apply (w, v);
+		printVector<Field> (F, report, w);
 
+		Base J (I);
+		Blackbox K(F, J);
+		K.apply (w, v);
 		report << "Output vector: ";
 		printVector<Field> (F, report, w);
 
@@ -109,7 +132,7 @@ static bool testIdentity (Field &F, long n, int iterations)
  * function interpolates (using Lagrange interpolants) the evaluation points to
  * get the original polynomials and checks whether the coefficients match the
  * original vectors.
- * 
+ *
  * F - Field over which to perform computations
  * n - Dimension to which to make matrix
  * iterations - Number of random diagonal matrices to construct
@@ -119,7 +142,7 @@ static bool testIdentity (Field &F, long n, int iterations)
  */
 
 template <class Field>
-static bool testVandermonde (Field &F, long n, int iterations, int N) 
+static bool testVandermonde (Field &F, long n, int iterations, int N)
 {
 	typedef typename Vector<Field>::Dense Vector;
 	typedef vector <typename Field::Element> Polynomial;
@@ -228,7 +251,7 @@ template <class Field>
 static bool testRandomLinearity (const Field                                 &F,
 				 VectorStream<typename Vector<Field>::Dense> &A_stream,
 				 VectorStream<typename Vector<Field>::Dense> &v1_stream,
-				 VectorStream<typename Vector<Field>::Dense> &v2_stream) 
+				 VectorStream<typename Vector<Field>::Dense> &v2_stream)
 {
 	commentator.start ("Testing random linearity", "testRandomLinearity", v1_stream.size ());
 
@@ -262,7 +285,7 @@ template <class Field>
 static bool testRandomTranspose (const Field                                 &F,
 				 VectorStream<typename Vector<Field>::Dense> &A_stream,
 				 VectorStream<typename Vector<Field>::Dense> &v1_stream,
-				 VectorStream<typename Vector<Field>::Dense> &v2_stream) 
+				 VectorStream<typename Vector<Field>::Dense> &v2_stream)
 {
 	commentator.start ("Testing random transpose", "testRandomTranspose", v1_stream.size ());
 
@@ -287,16 +310,16 @@ int main (int argc, char **argv)
 	static size_t n = 10;
 	static integer q = 101;
 	static int iterations = 2; // was 100
-	static int N = 1;
+	//static int N = 1;
 
 	static Argument args[] = {
 		{ 'n', "-n N", "Set dimension of test matrices to NxN.", TYPE_INT,     &n },
 		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
 		{ 'i', "-i I", "Perform each test for I iterations.",   TYPE_INT,     &iterations },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
-	typedef Modular<uint32> Field;
+	typedef Modular<uint32_t> Field;
 
 	parseArguments (argc, argv, args);
 	Field F (q);
@@ -311,9 +334,9 @@ int main (int argc, char **argv)
 	RandomDenseStream<Field> v2_stream (F, n, iterations);
 
 	if (!testIdentity    (F, n, iterations)) pass = false;
-	if (!testVandermonde (F, n, iterations, N)) pass = false;
-	if (!testRandomLinearity (F, A_stream, v1_stream, v2_stream)) pass = false;
-	if (!testRandomTranspose (F, A_stream, v1_stream, v2_stream)) pass = false;
+	//if (!testVandermonde (F, n, iterations, N)) pass = false;
+	//if (!testRandomLinearity (F, A_stream, v1_stream, v2_stream)) pass = false;
+	//if (!testRandomTranspose (F, A_stream, v1_stream, v2_stream)) pass = false;
 
 	commentator.stop("dense matrix black box test suite");
 	return pass ? 0 : -1;
diff --git a/tests/test-det.C b/tests/test-det.C
index 15c1bc5..2179aae 100644
--- a/tests/test-det.C
+++ b/tests/test-det.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-det.C
  * Copyright (C) 2002 Bradford Hovinen
@@ -10,6 +11,15 @@
  * See COPYING for license information
  */
 
+
+/*! @file  tests/test-det.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test NO DOC
+ */
+
+
+
 #include <iostream>
 #include <fstream>
 #include <vector>
@@ -20,6 +30,7 @@
 #include "linbox/util/commentator.h"
 #include "linbox/field/modular.h"
 #include "linbox/field/PID-integer.h"
+#include "linbox/field/gmp-rational.h"
 #include "linbox/blackbox/diagonal.h"
 #include "linbox/blackbox/sparse.h"
 #include "linbox/blackbox/dense.h"
@@ -43,7 +54,7 @@ using namespace LinBox;
  */
 
 template <class Field>
-static bool testDiagonalDet1 (Field &F, size_t n, int iterations) 
+static bool testDiagonalDet1 (Field &F, size_t n, int iterations)
 {
 	typedef vector <typename Field::Element> Vector;
 	typedef vector <typename Field::Element> Polynomial;
@@ -94,7 +105,7 @@ static bool testDiagonalDet1 (Field &F, size_t n, int iterations)
 		report << endl;
 
 		Blackbox D (F, d);
-                
+
                 Method::Wiedemann WiedemannChoice;
 		det (phi_wiedemann, D,  WiedemannChoice);
 		F.write (report << "Computed determinant (Wiedemann) : ", phi_wiedemann) << endl;
@@ -137,7 +148,7 @@ static bool testDiagonalDet1 (Field &F, size_t n, int iterations)
  */
 
 template <class Field>
-static bool testDiagonalDet2 (Field &F, size_t n, int iterations) 
+static bool testDiagonalDet2 (Field &F, size_t n, int iterations)
 {
 	typedef vector <typename Field::Element> Vector;
 	typedef vector <typename Field::Element> Polynomial;
@@ -229,7 +240,7 @@ static bool testDiagonalDet2 (Field &F, size_t n, int iterations)
  */
 
 template <class Field>
-static bool testSingularDiagonalDet (Field &F, size_t n, int iterations) 
+static bool testSingularDiagonalDet (Field &F, size_t n, int iterations)
 {
 	typedef vector <typename Field::Element> Vector;
 	typedef vector <typename Field::Element> Polynomial;
@@ -310,7 +321,7 @@ static bool testSingularDiagonalDet (Field &F, size_t n, int iterations)
  * Returns true on success and false on failure
  */
 
-bool testIntegerDet (size_t n, int iterations) 
+bool testIntegerDet (size_t n, int iterations)
 {
  	commentator.start ("Testing integer determinant", "testIntegerDet", iterations);
 
@@ -334,30 +345,30 @@ bool testIntegerDet (size_t n, int iterations)
 	 		integer::negin(A.refEntry(1,1));
 	 		integer::negin(pi);
 	 	}
-                              
+
 		// 	if (i == iterations - 1) {
-		// 			A.setEntry(1, 2, A.getEntry(1,1)); 
-		// 			A.setEntry(2, 1, A.getEntry(2,2)); 
+		// 			A.setEntry(1, 2, A.getEntry(1,1));
+		// 			A.setEntry(2, 1, A.getEntry(2,2));
 		// 			pi = 0;
 		// 		}
 
 		//GMP_Integers R;
 		//A.write(cout,R);
 	 	ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
- 		
-	 	report << "True determinant: "; 
+
+	 	report << "True determinant: ";
 		report << pi;
 		report << endl;
- 		
+
                 Method::Wiedemann WiedemannChoice;
                 det (det_A_wiedemann, A, WiedemannChoice);
  	 	report << "Computed integer determinant (Wiedemann): " << det_A_wiedemann << endl;
-		                
+
 
                 WiedemannChoice.symmetric(Specifier::SYMMETRIC);
                 det (det_A_symm_wied, A, WiedemannChoice);
 	 	report << "Computed integer determinant (Symmetric Wiedemann): " << det_A_symm_wied << endl;
- 		
+
                 det (det_A_blas_elimination, A, Method::BlasElimination());
 	 	report << "Computed integer determinant (BlasElimination): " << det_A_blas_elimination << endl;
 
@@ -388,7 +399,7 @@ bool testIntegerDet (size_t n, int iterations)
  * Returns true on success and false on failure
  */
 
-bool testIntegerDetGen (size_t n, int iterations) 
+bool testIntegerDetGen (size_t n, int iterations)
 {
  	commentator.start ("Testing integer determinant, generic methods", "testIntegerDeterminantGeneric", iterations);
 
@@ -412,11 +423,11 @@ bool testIntegerDetGen (size_t n, int iterations)
 	 		integer::negin(A.refEntry(1,1));
 	 		integer::negin(pi);
 	 	}
-                              
+
 	 	ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
- 		
+
 	 	report << "True determinant: " << pi << endl;
- 		
+
                 det (det_A, A);
  	 	report << "Computed integer determinant (Default): " << det_A << endl;
 		if (det_A != pi){
@@ -432,7 +443,7 @@ bool testIntegerDetGen (size_t n, int iterations)
 	 			<< "ERROR: Hybrid Computed determinant is incorrect" << endl;
 	 		ret = false;
 	 	}
- 		
+
                 det (det_A_B, A, Method::Blackbox());
 	 	report << "Computed integer determinant (Blackbox): " << det_A_B << endl;
 		if (det_A_B != pi){
@@ -440,7 +451,7 @@ bool testIntegerDetGen (size_t n, int iterations)
 	 			<< "ERROR: Blackbox Computed determinant is incorrect" << endl;
 	 		ret = false;
 	 	}
- 		
+
                 det (det_A_E, A, Method::Elimination());
 	 	report << "Computed integer determinant (Elimination): " << det_A_E << endl;
 		if (det_A_E != pi){
@@ -460,6 +471,129 @@ bool testIntegerDetGen (size_t n, int iterations)
 	return ret;
 }
 
+/* Test 6: Rational determinant by generic methods
+ *
+ * Construct a random nonsingular diagonal sparse matrix and compute its
+ * determinant over Z
+ *
+ * n - Dimension to which to make matrix
+ * iterations - Number of iterations to run
+ *
+ * Returns true on success and false on failure
+ */
+
+bool testRationalDetGen (size_t n, int iterations)
+{
+ 	commentator.start ("Testing rational determinant, generic methods", "testRationalDeterminantGeneric", iterations);
+
+	bool ret = true;
+
+	for (int i = 0; i < iterations; ++i) {
+		commentator.startIteration (i);
+		GMPRationalField Q;
+		SparseMatrix<GMPRationalField > A (Q, n, n);
+		DenseMatrix <GMPRationalField > BB(Q, n, n);
+
+	 	GMPRationalField::Element pi(1,1);
+ 		GMPRationalField::Element det_A, det_B,det_A_H, det_B_H, det_A_B, det_B_B, det_A_E, det_B_E;
+
+ 		for (unsigned int j = 0; j < n; ++j) {
+			integer tmp_n;
+	 		integer tmp_d;
+			integer::nonzerorandom (tmp_n, 20*i + 1);
+ 			integer::nonzerorandom (tmp_d, 20*i + 1);
+			GMPRationalField::Element tmp;
+			Q.init(tmp,tmp_n,tmp_d);
+			A.setEntry(j,j,tmp);
+			BB.setEntry(j,j,tmp);
+		 	Q.mulin (pi, tmp);
+ 		}
+
+	 	if (i % 2) {
+	 		Q.negin(A. refEntry(1,1));
+			Q.negin(BB.refEntry(1,1));
+	 		Q.negin(pi);
+	 	}
+
+	 	ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+
+	 	report << "True determinant: ";  Q.write(report,pi); report << endl;
+
+                det (det_A, A);
+ 	 	report << "Computed rational determinant (Default): "; Q.write(report, det_A); report << endl;
+		if (!Q.areEqual(det_A ,pi)){
+	 		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+	 			<< "ERROR: Default Computed determinant is incorrect" << endl;
+	 		ret = false;
+	 	}
+
+                det (det_A_H, A, Method::Hybrid());
+	 	report << "Computed rational determinant (Hybrid): "; Q.write(report, det_A_H); report << endl;
+		if (!Q.areEqual(det_A_H ,pi)){
+	 		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+	 			<< "ERROR: Hybrid Computed determinant is incorrect" << endl;
+	 		ret = false;
+	 	}
+
+                det (det_A_B, A, Method::Blackbox());
+	 	report << "Computed rational determinant (Blackbox): "; Q.write(report, det_A_B); report<< endl;
+		if (!Q.areEqual(det_A_B , pi)){
+	 		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+	 			<< "ERROR: Blackbox Computed determinant is incorrect" << endl;
+	 		ret = false;
+	 	}
+
+                det (det_A_E, A, Method::Elimination());
+	 	report << "Computed rational determinant (Elimination): "; Q.write(report, det_A_E); report << endl;
+		if (!Q.areEqual(det_A_E ,pi)){
+	 		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+	 			<< "ERROR: Elimination Computed determinant is incorrect" << endl;
+	 		ret = false;
+	 	}
+
+		det (det_B, BB);
+ 	 	report << "Computed rational determinant (Default): "; Q.write(report, det_A); report << endl;
+		if (!Q.areEqual(det_B ,pi)){
+	 		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+	 			<< "ERROR: (Dense) Default Computed determinant is incorrect" << endl;
+	 		ret = false;
+	 	}
+
+                det (det_B_H, BB, Method::Hybrid());
+	 	report << "Computed rational determinant (Hybrid): "; Q.write(report, det_A_H); report << endl;
+		if (!Q.areEqual(det_B_H ,pi)){
+	 		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+	 			<< "ERROR: (Dense) Hybrid Computed determinant is incorrect" << endl;
+	 		ret = false;
+	 	}
+		det (det_B_B, BB, Method::Blackbox());
+	 	report << "Computed rational determinant (Blackbox): "; Q.write(report, det_A_B); report<< endl;
+		if (!Q.areEqual(det_B_B , pi)){
+	 		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+	 			<< "ERROR: (Dense) Blackbox Computed determinant is incorrect" << endl;
+	 		ret = false;
+	 	}
+
+		det (det_B_E, BB, Method::Elimination());
+	 	report << "Computed rational determinant (BlasElimination): "; Q.write(report, det_A_E); report << endl;
+		if (!Q.areEqual(det_B_E ,pi)){
+	 		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+	 			<< "ERROR: (Dense) Elimination Computed determinant is incorrect" << endl;
+	 		ret = false;
+	 	}
+
+
+		commentator.stop ("done");
+	 	commentator.progress ();
+	 	//commentator.progress (i, iterations);
+ 	}
+
+	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testRationalDeterminantGeneric");
+
+	return ret;
+}
+
+
 int main (int argc, char **argv)
 {
 	bool pass = true;
@@ -472,13 +606,13 @@ int main (int argc, char **argv)
 		{ 'n', "-n N", "Set dimension of test matrices to NxN", TYPE_INT,     &n },
 		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1]", TYPE_INTEGER, &q },
 		{ 'i', "-i I", "Perform each test for I iterations",    TYPE_INT,     &iterations },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
 	Modular<int> F (q);
 
-	commentator.start("Determinant test suite", "det"); 
+	commentator.start("Determinant test suite", "det");
 
 	// Make sure some more detailed messages get printed
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
@@ -489,6 +623,7 @@ int main (int argc, char **argv)
 	if (!testSingularDiagonalDet (F, n, iterations)) pass = false;
 	if (!testIntegerDet          (n, iterations)) pass = false;
 	if (!testIntegerDetGen          (n, iterations)) pass = false;
+	if (!testRationalDetGen          (n, iterations)) pass = false;
 
 	commentator.stop("determinant test suite");
 	return pass ? 0 : -1;
diff --git a/tests/test-diagonal.C b/tests/test-diagonal.C
index 489af38..672220c 100644
--- a/tests/test-diagonal.C
+++ b/tests/test-diagonal.C
@@ -1,15 +1,26 @@
 /* -*- 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
 
 /* tests/test-diagonal.C
  * Copyright (C) 2001, 2002 Bradford Hovinen
  *
  * Written by Bradford Hovinen <hovinen at cis.udel.edu>
  *
+ * Time-stamp: <22 Jun 10 15:59:39 Jean-Guillaume.Dumas at imag.fr>
  * --------------------------------------------------------
  *
  * See COPYING for license information
  */
 
+
+/*! @file  tests/test-diagonal.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test NO DOC
+ */
+
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -44,7 +55,7 @@ using namespace LinBox;
  */
 
 template <class Field, class Vector>
-static bool testIdentityApply (Field &F, VectorStream<Vector> &stream) 
+static bool testIdentityApply (Field &F, VectorStream<Vector> &stream)
 {
         typedef LinBox::Diagonal<Field> Blackbox;
 
@@ -120,7 +131,7 @@ static bool testIdentityApply (Field &F, VectorStream<Vector> &stream)
  */
 
 template <class Field, class Vector>
-static bool testRandomMinpoly (Field &F, VectorStream<Vector> &stream) 
+static bool testRandomMinpoly (Field &F, VectorStream<Vector> &stream)
 {
 	typedef vector <typename Field::Element> Polynomial;
 	typedef LinBox::Diagonal <Field> Blackbox;
@@ -178,7 +189,7 @@ static bool testRandomMinpoly (Field &F, VectorStream<Vector> &stream)
 	// try it with the random cstor of diagonal
 	LinBox::Diagonal <Field> D(F, 10);
 	unsigned long r;
-	rank(r, D, Method::Wiedemann());
+	LinBox::rank(r, D, Method::Wiedemann());
 	if (r != 10)
 			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
 				<< "ERROR: zeroes in random diagonal" << endl;
@@ -206,7 +217,7 @@ template <class Field, class Vector>
 static bool testRandomLinearity (Field &F,
 				 VectorStream<std::vector<typename Field::Element> > &d_stream,
 				 VectorStream<Vector> &stream1,
-				 VectorStream<Vector> &stream2) 
+				 VectorStream<Vector> &stream2)
 {
 	typedef LinBox::Diagonal <Field> Blackbox;
 
@@ -248,7 +259,7 @@ template <class Field, class Vector>
 static bool testRandomTranspose (Field &F,
 				 VectorStream<std::vector<typename Field::Element> > &d_stream,
 				 VectorStream<Vector> &stream1,
-				 VectorStream<Vector> &stream2) 
+				 VectorStream<Vector> &stream2)
 {
 	typedef LinBox::Diagonal <Field> Blackbox;
 
@@ -286,10 +297,10 @@ int main (int argc, char **argv)
 		{ 'n', "-n N", "Set dimension of test matrices to NxN.", TYPE_INT,     &n },
 		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
-	typedef Modular<LinBox::uint32> Field; //C.Pernet: avoids confusion with givaro::uint32
+	typedef Modular<uint32_t> Field; //C.Pernet: avoids confusion with givaro::uint32_t
 	typedef vector<Field::Element> Vector;
 
 	parseArguments (argc, argv, args);
diff --git a/tests/test-dif.C b/tests/test-dif.C
index ab30ba7..45fc2f4 100644
--- a/tests/test-dif.C
+++ b/tests/test-dif.C
@@ -1,5 +1,7 @@
 /* -*- 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
 /* tests/test-dif.C
+ * Copyright (C) LinBox
  * +- modified from tests/test-sum.C
  * transform by bds
  *
@@ -9,6 +11,15 @@
  * See COPYING for license information.
  */
 
+
+/*! @file  tests/test-dif.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test NO DOC
+ */
+
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -41,7 +52,7 @@ using namespace LinBox;
  */
 
 template <class Field, class Vector>
-static bool testZeroApply (Field &F, VectorStream<Vector> &stream1, VectorStream<Vector> &stream2) 
+static bool testZeroApply (Field &F, VectorStream<Vector> &stream1, VectorStream<Vector> &stream2)
 {
 	typedef Diagonal <Field> Blackbox;
 
@@ -126,7 +137,7 @@ static bool testZeroApply (Field &F, VectorStream<Vector> &stream1, VectorStream
  */
 
 template <class Field>
-static bool testRandomTranspose (Field &F, size_t n, int iterations) 
+static bool testRandomTranspose (Field &F, size_t n, int iterations)
 {
 	typedef vector <typename Field::Element> Vector;
 	typedef Diagonal <Field> Blackbox;
@@ -169,10 +180,10 @@ int main (int argc, char **argv)
 		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
 		{ 'i', "-i I", "Perform each test for I iterations.",   TYPE_INT,     &iterations1 },
 		{ 'j', "-j J", "Apply test matrix to J vectors.",         TYPE_INT,     &iterations2 },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
-	typedef Modular<int32> Field;
+	typedef Modular<int32_t> Field;
 
 	parseArguments (argc, argv, args);
 	Field F (101);
diff --git a/tests/test-direct-sum.C b/tests/test-direct-sum.C
index 73cf9c9..f94b955 100644
--- a/tests/test-direct-sum.C
+++ b/tests/test-direct-sum.C
@@ -1,11 +1,19 @@
 /* -*- 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
 /* tests/test-direct-sum.C
+ * Copyright (C) LinBox
  * Written by David Saunders
  *
  * See COPYING for license information.
  */
 
+/*! @file  tests/test-direct-sum.C
+ * @ingroup tests
+ * @brief no doc.
+ * @test NO DOC
+ */
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -35,10 +43,10 @@ int main (int argc, char **argv)
 		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
 		{ 'i', "-i I", "Perform each test for I iterations.",   TYPE_INT,     &iterations1 },
 		{ 'j', "-j J", "Apply test matrix to J vectors.",         TYPE_INT,     &iterations2 },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
-	typedef Modular<uint32> Field;
+	typedef Modular<uint32_t> Field;
 	typedef vector<Field::Element> Vector;
 
 	parseArguments (argc, argv, args);
@@ -53,7 +61,7 @@ int main (int argc, char **argv)
 	ScalarMatrix<Field> B(F, 10, k);
 	F.init(k, 2);
 	ScalarMatrix<Field> C(F, 5, k);
-	
+
 	DirectSum<ScalarMatrix<Field>, ScalarMatrix<Field> > A(&B, &C);
 	pass = pass && testBlackbox(A);
 	DirectSum<ScalarMatrix<Field>, ScalarMatrix<Field> > D(B, C);
diff --git a/tests/test-dyadic-to-rational.C b/tests/test-dyadic-to-rational.C
new file mode 100644
index 0000000..19ca129
--- /dev/null
+++ b/tests/test-dyadic-to-rational.C
@@ -0,0 +1,60 @@
+/* -*- 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
+
+
+/* tests/test-template.C
+ * LinBox copyright/license applies. See COPYING.
+ */
+
+#include "linbox/linbox-config.h"
+#include "linbox/util/commentator.h"
+#include "test-common.h"
+
+#define TestingDyadicToRational 
+#include "linbox/algorithms/dyadic-to-rational.h" // can assume commentator and config loaded
+#undef TestingDyadicToRational 
+
+int main (int argc, char **argv) { 
+
+	// customize optional args
+	size_t n = 10;
+
+	static Argument args[] = {
+		{ 'n', "-n N", "Set dimension of test matrices to NxN.",                 TYPE_INT,     &n },
+		END_OF_ARGUMENTS
+	};
+	parseArguments (argc, argv, args);
+
+	commentator.getMessageClass (TIMING_MEASURE).setMaxDepth (10);
+	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (10);
+	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
+
+	// run test
+	LinBox::commentator.start("DyadicToRational unit/regression test");
+	bool pass = testDyadicToRational(n);
+	LinBox::commentator.stop("DyadicToRational unit/regression test");
+	return pass ? 0 : -1;
+
+	/* parseArguments sets flags n and q, and arg structure ac, av, where ac, av refer to remaining args after flag processing.
+	 Any -n <n>, -q <q>, -h flag, and first non-option arg will have been stripped from av.
+	 The first non-option arg is used as file name for commentator output.
+	 from av.  Ac is argc less the arguments thus stripped and handled.
+	 -h, by convention sets ac = -1, indicating that testOBJECT should just explain the args on cout.
+
+	 note: options are deliberately limited to these three: 
+	  -h is conventional for giving a brief help with args (and is widely used).
+	  -n sets a size parameter, a frequent device.
+	  -q often determines the field of computation but may be used in other ways.
+
+	 Generally this is as many run time parameters as a test user can reasonably remember and exploit.  
+	 If additional control of testing is desired, usually the easiest and least error prone method 
+	 is to edit the test function and recompile.  However, the test function can use the ac and av args 
+	 to exploit further parameters. This ac/av use discouraged absent strong reason for it.
+
+	 One use pattern of tests is that the unit designer tests with many parameters during development.
+	 These may turn levels of debugging on and off, explore special cases, etc.).  However, when the unit 
+	 is deployed and the test serves only as a unit/regression test, these features are seldom needed, 
+	 if ever.  They may be left there just in case, but it is suggested NOT to document them in the -h help.
+	*/
+
+}
diff --git a/tests/test-ffpack.C b/tests/test-ffpack.C
index 5170a6a..85e1eac 100644
--- a/tests/test-ffpack.C
+++ b/tests/test-ffpack.C
@@ -1,27 +1,59 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-//--------------------------------------------------------------------------
-//          Tests for the ffpack set of routines
-//--------------------------------------------------------------------------
-// usage: test-ffpack p A n, for n lsp factorization  
-// of A over Z/pZ
-//-------------------------------------------------------------------------
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) LinBox
+ *
+ * written by C. Pernet
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+/*! @file tests/test-ffpack.C
+ * @brief Tests for the ffpack set of routines.
+ * usage: test-ffpack p A n, for n lsp factorization  of A over Z/pZ
+ *
+ * \ingroup tests
+ * @bug this file does not compile or the test fails for some fields.
+ * @test NO DOC
+ */
 
 #include "linbox/linbox-config.h"
+
 #include <iostream>
+#include <vector>
+
 #include <linbox/integer.h>
 #include <linbox/matrix/matrix-domain.h>
-//#include "linbox/field/givaro-zpz.h"
+#include "linbox/field/givaro-zpz.h"
 #include "linbox/field/modular.h"
-#include "linbox/ffpack/ffpack.h"
-#include <vector>
+#include "linbox/field/modular-balanced.h"
+#include "fflas-ffpack/ffpack/ffpack.h"
+#include "linbox/util/commentator.h"
+
 #include "test-common.h"
 
+#define _LB_FULL_TEST
+
 using namespace LinBox;
 
 string blank;
 
 const int maxpretty = 35;
-const char* pretty(string a) {
+const char* pretty(string a)
+{
 
 	blank = "     " + a;
 	int msgsize= maxpretty - blank.size();
@@ -32,11 +64,12 @@ const char* pretty(string a) {
 }
 
 /*
- *  Testing the rank of dense matrices 
+ *  Testing the rank of dense matrices
  *  construct a n*n matrices of rank r and compute the rank
  */
 template <class Field>
-static bool testRank (const Field& F,size_t n, int iterations) {
+static bool testRank (const Field& F,size_t n, int iterations)
+{
 
 	typedef typename Field::Element Element;
 	typedef typename Field::RandIter RandIter;
@@ -50,31 +83,31 @@ static bool testRank (const Field& F,size_t n, int iterations) {
 	F.init( one, 1UL);
 	F.init( zero, 0UL);
 	RandIter G(F);
-	NonzeroRandIter<Field> Gn(F,G); 
+	NonzeroRandIter<Field> Gn(F,G);
 
 	unsigned int r;
 	bool ret = true;
-	
+
 	for (int k=0;k<iterations; ++k) {
-    
+
 		commentator.progress(k);
 		Element * A = new Element[n*n];
 		Element * S = new Element[n*n];
 		Element * L = new Element[n*n];
-     
+
 		r = rand() % n;
 		// create S as an upper triangular matrix with r nonzero rows
 		for (size_t i=0;i<r;++i){
 			for (size_t j=0;j<i;++j)
 				F.assign(*(S+j+i*n),zero);
 			Gn.random(*(S+i*n+i));
-			for (size_t j=i+1;j<n;++j)     
+			for (size_t j=i+1;j<n;++j)
 				G.random(*(S+i*n+j));
 		}
 		for (size_t i=r;i<n;++i){
 			for (size_t j=0;j<n;++j)
 				F.assign(*(S+j+i*n),zero);
-		}			
+		}
 		// create L as a lower triangular matrix with nonzero elements on the diagonal
 		for (size_t i=0;i<n;++i){
 			for (size_t j=0;j<i;++j)
@@ -84,7 +117,7 @@ static bool testRank (const Field& F,size_t n, int iterations) {
 				F.assign(*(L+j+i*n),zero);
 
 		}
-		
+
 		//  compute A=LS
 		FFLAS::fgemm( F, FFLAS::FflasNoTrans, FFLAS::FflasNoTrans, n, n, n,
 			      one, L, n, S, n, zero, A, n );
@@ -97,9 +130,9 @@ static bool testRank (const Field& F,size_t n, int iterations) {
 		if (rank!=r)
 			ret=false;
 	}
-  	
+
 	commentator.stop(MSG_STATUS (ret), (const char *) 0, "testRank");
-    
+
 	return ret;
 }
 
@@ -108,7 +141,8 @@ static bool testRank (const Field& F,size_t n, int iterations) {
  *  construct a n*n matrices of rank r and compute the rank
  */
 template <class Field>
-static bool testTURBO (const Field& F,size_t n, int iterations) {
+static bool testTURBO (const Field& F,size_t n, int iterations)
+{
 
 	typedef typename Field::Element Element;
 	typedef typename Field::RandIter RandIter;
@@ -122,25 +156,25 @@ static bool testTURBO (const Field& F,size_t n, int iterations) {
 	F.init( one, 1UL);
 	F.init( zero, 0UL);
 	RandIter G(F);
-	NonzeroRandIter<Field> Gn(F,G); 
+	NonzeroRandIter<Field> Gn(F,G);
 
 	unsigned int r;
 	bool ret = true;
-		
+
 	for (int k=0;k<iterations; ++k) {
-    
+
 		commentator.progress(k);
 		Element * A = new Element[n*n];
 		Element * S = new Element[n*n];
 		Element * L = new Element[n*n];
-     
+
 		r = rand() % n;
 		// create S as an upper triangular matrix with r nonzero rows
 		for (size_t i=0;i<r;++i){
 			for (size_t j=0;j<i;++j)
 				F.assign(*(S+j+i*n),zero);
 			Gn.random(*(S+i*n+i));
-			for (size_t j=i+1;j<n;++j)     
+			for (size_t j=i+1;j<n;++j)
 				G.random(*(S+i*n+j));
 		}
 		for (size_t i=r; i<n; ++i)
@@ -154,20 +188,20 @@ static bool testTURBO (const Field& F,size_t n, int iterations) {
 			for (size_t j=i+1;j<n;++j)
 				F.assign(*(L+j+i*n),zero);
 		}
-	
-		
+
+
 		//  compute A=LS
 		FFLAS::fgemm( F, FFLAS::FflasNoTrans, FFLAS::FflasNoTrans, n, n, n,
 			      one, L, n, S, n, zero, A, n );
-		
+
 		delete[] L;
 		delete[] S;
 		// compute the rank of A
 		size_t * P = new size_t[n];
 		size_t * Q = new size_t[n];
-		unsigned int rank= FFPACK::TURBO( F, n, n, 
+		unsigned int rank= FFPACK::TURBO( F, n, n,
 						  A,n, P, Q, 100);
-// 						  A, n, A+no2,n, 
+// 						  A, n, A+no2,n,
 // 						    A+no2*n, n, A+no2*(n+1), n );
 
 		delete[] P;
@@ -177,9 +211,9 @@ static bool testTURBO (const Field& F,size_t n, int iterations) {
 		if (rank!=r)
 			ret=false;
 	}
-  	
+
 	commentator.stop(MSG_STATUS (ret), (const char *) 0, "testTURBO");
-    
+
 	return ret;
 }
 
@@ -189,47 +223,48 @@ static bool testTURBO (const Field& F,size_t n, int iterations) {
  *  construct a n*n matrices of determinant d and compute the determinant
  */
 template <class Field>
-static bool testDet (const Field& F,size_t n, int iterations) {
+static bool testDet (const Field& F,size_t n, int iterations)
+{
 
 	typedef typename Field::Element Element;
 	typedef typename Field::RandIter RandIter;
-  
+
 	//Commentator commentator;
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
 	commentator.start (pretty("Testing determinant"),"testDet",iterations);
 
 	RandIter G(F);
-	NonzeroRandIter<Field> Gn(F,G); 
+	NonzeroRandIter<Field> Gn(F,G);
 	Element one,zero,d;
 	F.init(one,1UL);
 	F.init(zero,0UL);
 
 	bool ret = true;
-	
+
 	for (int k=0;k<iterations;++k) {
-		
+
 		commentator.progress(k);
 
 		G.random(d);
-		
+
 		Element * A = new Element[n*n];
 		Element * S = new Element[n*n];
 		Element * L = new Element[n*n];
 
-		
 
-		// create S as an upper triangular matrix of full rank 
+
+		// create S as an upper triangular matrix of full rank
 		// with diagonal's element equal to 1 except the first entry wich equals to d
 		for (size_t i=0;i<n;++i){
 			for (size_t j=0;j<i;++j)
 				F.assign(*(S+j+i*n),zero);
 			F.assign(*(S+i*n+i), one);
-			for (size_t j=i+1;j<n;++j)      
+			for (size_t j=i+1;j<n;++j)
 				G.random(*(S+i*n+j));
 		}
 		F.assign(*S,d);
-		
+
 		// create L as a lower triangular matrix with only 1's on diagonal
 		for (size_t i=0;i<n;++i){
 			for (size_t j=0;j<i;++j)
@@ -239,7 +274,7 @@ static bool testDet (const Field& F,size_t n, int iterations) {
 				F.assign(*(L+j+i*n),zero);
 		}
 
-    
+
 		//  compute A=LS
 		FFLAS::fgemm( F, FFLAS::FflasNoTrans, FFLAS::FflasNoTrans, n, n, n,
 			      one, L, n, S, n, zero, A, n );
@@ -255,9 +290,9 @@ static bool testDet (const Field& F,size_t n, int iterations) {
 		if (!F.areEqual(det,d))
 			ret=false;
 	}
-  
+
 	commentator.stop(MSG_STATUS (ret), (const char *) 0, "testDet");
-    
+
 	return ret;
 }
 
@@ -265,7 +300,8 @@ static bool testDet (const Field& F,size_t n, int iterations) {
  * Test of the LQUP factorization routine
  */
 template <class Field>
-static bool testLUdivine (const Field& F, size_t m, size_t n, int iterations) {
+static bool testLUdivine (const Field& F, size_t m, size_t n, int iterations)
+{
 
 	typedef typename Field::Element                  Element;
 	typedef typename Field::RandIter                RandIter;
@@ -276,22 +312,22 @@ static bool testLUdivine (const Field& F, size_t m, size_t n, int iterations) {
 	commentator.start (pretty("Testing LQUP factorization"),"testLQUP",iterations);
 
 	RandIter G(F);
-	NonzeroRandIter<Field> Gn(F,G); 
+	NonzeroRandIter<Field> Gn(F,G);
 	Element one,zero;
 	F.init(one,1UL);
 	F.init(zero,0UL);
-  
+
 	bool ret = true;
-	
+
 	for (int k=0;k<iterations;++k) {
-    
-		commentator.progress(k);    
-		
-		
+
+		commentator.progress(k);
+
+
 		Element * A = new Element[m*n];
 		Element * B = new Element[m*m];
 		Element * C = new Element[m*n];
-		
+
 
 		// Create B a random matrix of rank n/2
 		for (size_t j=0;j<m;++j)
@@ -300,7 +336,8 @@ static bool testLUdivine (const Field& F, size_t m, size_t n, int iterations) {
 					F.assign (*(B+i*m+j),zero);
 				for (size_t i=j;i<m;++i)
 					Gn.random (*(B+i*m+j));
-			} else
+			}
+			else
 				for (size_t i=0;i<m;++i)
 					F.assign (*(B+i*m+j), zero);
 		// Create C a random matrix of rank n/2
@@ -310,10 +347,11 @@ static bool testLUdivine (const Field& F, size_t m, size_t n, int iterations) {
 					F.assign (*(C+i*n+j),zero);
 				for (size_t j = i; j < n; ++j)
 					Gn.random (*(C+i*n+j));
-			} else
+			}
+			else
 				for (size_t j = 0; j < n; ++j)
 					F.assign (*(C+i*n+j),zero);
-		
+
 		// A = B*C
 		FFLAS::fgemm( F, FFLAS::FflasNoTrans, FFLAS::FflasNoTrans, m, n, m,
 			      one, B, m, C, n, zero, A, n );
@@ -326,7 +364,7 @@ static bool testLUdivine (const Field& F, size_t m, size_t n, int iterations) {
 
 		size_t * P = new size_t[n];
 		size_t * Q = new size_t[m];
-		
+
 // 		write_field (F, cerr<<"A="<<endl, A, m, n, n);
 		size_t r = FFPACK::LUdivine( F, FFLAS::FflasNonUnit, FFLAS::FflasNoTrans,
 					     m, n, A, n, P, Q, FFPACK::FfpackLQUP);
@@ -334,31 +372,36 @@ static bool testLUdivine (const Field& F, size_t m, size_t n, int iterations) {
 
 		Element * L = new Element[m*m];
 		Element * U = new Element[m*n];
-	
+
 		for (size_t i=0; i<m; ++i){
 			for (size_t j = 0; j < i; ++j)
-				F.assign (*(L+i*n+j), *(A+i*n+j) );
-			for (size_t j = i; j < n; ++j)
-				F.assign (*(L+i*n+j), zero );
+				if (j<n)
+					F.assign (*(L+i*m+j), *(A+i*n+j) );
+				else
+					F.assign (*(L+i*m+j), zero );
+
+			for (size_t j = i; j < m; ++j)
+				F.assign (*(L+i*m+j), zero );
 		}
-		FFPACK::applyP( F, FFLAS::FflasRight, FFLAS::FflasNoTrans, m, 
+		FFPACK::applyP( F, FFLAS::FflasRight, FFLAS::FflasNoTrans, m,
 				  0, r, L, m, Q);
 		for (size_t i=0; i<m; ++i)
-			F.assign( *(L+i*n+i), one);
+			F.assign( *(L+i*m+i), one);
 		for (size_t i=0; i<m; ++i){
 			for (size_t j=0; j<i; ++j)
-				F.assign( *(U+i*n+j), zero );
+				if (j<n)
+					F.assign( *(U+i*n+j), zero );
 			for (size_t j=i; j<n; ++j)
 				F.assign( *(U+i*n+j), *(A+i*n+j) );
 		}
 // 		write_field (F, cerr<<"L="<<endl, L, m, m, m);
 // 		write_field (F, cerr<<"U"<<endl, U, m, n, n);
 		// C = U*P
-		FFPACK::applyP( F, FFLAS::FflasRight, FFLAS::FflasNoTrans, m, 
+		FFPACK::applyP( F, FFLAS::FflasRight, FFLAS::FflasNoTrans, m,
 				  0, r, U, n, P);
 		//		write_field (F, cerr<<"UP"<<endl, U, m, n, n);
 		// C = Q*C
-		FFPACK::applyP( F, FFLAS::FflasLeft, FFLAS::FflasTrans, n, 
+		FFPACK::applyP( F, FFLAS::FflasLeft, FFLAS::FflasTrans, n,
 				  0, r, U, n, Q);
 		//		write_field (F, cerr<<"QUP"<<endl, U, m, n, n);
 
@@ -369,7 +412,7 @@ static bool testLUdivine (const Field& F, size_t m, size_t n, int iterations) {
 			      one, L, m, U, n, zero, A, n );
 		delete[] L;
 		delete[] U;
-		
+
 		for (size_t i = 0; i < m;++i)
 			for (size_t j = 0; j < n; ++j)
 				if (!F.areEqual( *(A+i*n+j), *(Abis+i*n+j))){
@@ -388,12 +431,13 @@ static bool testLUdivine (const Field& F, size_t m, size_t n, int iterations) {
 	}
 
 	commentator.stop(MSG_STATUS (ret), (const char *) 0, "testLQUP");
-    
+
 	return ret;
 }
 
 template <class Field>
-static bool testMinPoly (const Field& F, size_t n, int iterations) {
+static bool testMinPoly (const Field& F, size_t n, int iterations)
+{
 	typedef typename Field::Element                  Element;
 	typedef typename Field::RandIter                RandIter;
 	typedef vector<Element>                       Polynomial;
@@ -403,21 +447,21 @@ static bool testMinPoly (const Field& F, size_t n, int iterations) {
 	commentator.start (pretty("Testing minpoly"),"testMinPoly",iterations);
 	Element tmp, one, zero,mone;
 	RandIter G(F);
-	NonzeroRandIter<Field> Gn(F,G); 
+	NonzeroRandIter<Field> Gn(F,G);
 	F.init(one, 1UL);
 	F.init(zero, 0UL);
 	F.neg(mone, one);
 	//F.neg( mone, one);
 	bool ret = true;
-			
+
 	for (int k=0;k<iterations;++k) {
-    
-		commentator.progress(k);    
-		
+
+		commentator.progress(k);
+
 		Element * A = new Element[n*n];
 		Element * X = new Element[n*(n+1)];
 		size_t * Perm = new size_t[n];
-			
+
 		Polynomial P;
 		// Test MinPoly(In) = X-1
 		for (size_t i=0;i<n;++i){
@@ -425,9 +469,9 @@ static bool testMinPoly (const Field& F, size_t n, int iterations) {
 				F.assign(*(A+j+i*n),zero);
 			F.assign(*(A+i*(n+1)),one);
 		}
-		
+
 		FFPACK::MinPoly( F, P, n, A, n, X, n, Perm );
-		
+
 		if ( P.size() !=2 )
 			ret = false;
 		if ( !F.areEqual(P[0], mone) )
@@ -437,20 +481,20 @@ static bool testMinPoly (const Field& F, size_t n, int iterations) {
 		if(!ret) cerr<<"MinP(In)!=X-1"<<endl;
 		// Test MinPoly(a*In) = X-a
 		G.random(tmp);
-		
+
 		for (size_t i=0;i<n;++i){
 			for (size_t j=0;j<n;++j)
 				F.assign(*(A+j+i*n),zero);
-			
+
 			F.assign(*(A+i*(n+1)),tmp);
 		}
-		
+
 		F.negin(tmp);
-		
-		for (size_t i=0; i<n ;++i) 
+
+		for (size_t i=0; i<n ;++i)
 			Perm[i]=0;
 		FFPACK::MinPoly( F, P, n, A, n, X, n, Perm );
-	
+
 		if ( P.size() !=2 )
 			ret = false;
 		if ( !F.areEqual(P[0], tmp) ){
@@ -463,39 +507,43 @@ static bool testMinPoly (const Field& F, size_t n, int iterations) {
 			ret = false;
 		}
 		if(!ret) cerr<<"MinP(aIn)!=X-a"<<endl;
-		
-// 		for (size_t i=0;i<n-1;++i){
-// 			for (size_t j=0; j<n; ++j)
-// 				F.assign(*(A+i*n+j),zero);
-// 			F.assign(*(A+i*n+i+1),one);
-// 		}
-// 		for (size_t j=0;j<n;++j)
-// 			F.assign(*(A+(n-1)*n+j),zero);
-		
-// 		for (size_t i=0; i<n ;++i) 
-// 			Perm[i]=0;
-// 		FFPACK::MinPoly( F, P, n, A, n, X, n, Perm );
-	
-// 		if ( P.size() !=n+1 )
-// 			ret = false;
-// 		for (size_t i=0; i<n;++i)
-// 			if ( !F.areEqual(P[i], zero) )
-// 				ret = false;
-// 		if ( !F.areEqual(P[n], one) )
-// 			ret = false;
-// 		if(!ret) cerr<<"MinP(J)!=X^n"<<endl;
+
+#if 1 /*  ??? */
+		for (size_t i=0;i<n-1;++i){
+			for (size_t j=0; j<n; ++j)
+				F.assign(*(A+i*n+j),zero);
+			F.assign(*(A+i*n+i+1),one);
+		}
+		for (size_t j=0;j<n;++j)
+			F.assign(*(A+(n-1)*n+j),zero);
+
+		for (size_t i=0; i<n ;++i)
+			Perm[i]=0;
+		FFPACK::MinPoly( F, P, n, A, n, X, n, Perm );
+
+		if ( P.size() !=n+1 )
+			ret = false;
+		for (size_t i=0; i<n;++i)
+			if ( !F.areEqual(P[i], zero) )
+				ret = false;
+		if ( !F.areEqual(P[n], one) )
+			ret = false;
+		if(!ret) cerr<<"MinP(J)!=X^n"<<endl;
+#endif
 		delete[] A;
 		delete[] X;
 		delete[] Perm;
 	}
 
+
 	commentator.stop(MSG_STATUS (ret), (const char *) 0, "testMinPoly");
-	
+
 	return ret;
 }
 
 template <class Field>
-static bool testCharPoly (const Field& F, size_t n, int iterations) {
+static bool testCharPoly (const Field& F, size_t n, int iterations)
+{
 	typedef typename Field::Element                  Element;
 	typedef typename Field::RandIter                RandIter;
 	typedef vector<Element>                       Polynomial;
@@ -505,18 +553,18 @@ static bool testCharPoly (const Field& F, size_t n, int iterations) {
 	commentator.start (pretty("Testing charpoly"),"testCharPoly",iterations);
 	Element tmp, one, zero,mone;
 	RandIter G(F);
-	NonzeroRandIter<Field> Gn(F,G); 
+	NonzeroRandIter<Field> Gn(F,G);
 	F.init(one, 1UL);
 	F.init(zero, 0UL);
 	F.neg(mone, one);
 	bool ret = true;
-	
+
 	for (int k=0;k<iterations;++k) {
-    
-		commentator.progress(k);    
+
+		commentator.progress(k);
 
 		Element * A = new Element[n*n];
-		
+
 		std::list<Polynomial> P;
 		// Test CharPoly(In) = (X-1)^n
 		for (size_t i=0;i<n;++i){
@@ -529,7 +577,7 @@ static bool testCharPoly (const Field& F, size_t n, int iterations) {
 		P.clear();
 
 		FFPACK::CharPoly (F, P, n, A, n);
-	
+
 
 		typename list<Polynomial>::const_iterator P_it = P.begin();
 		while (P_it != P.end()){
@@ -542,20 +590,20 @@ static bool testCharPoly (const Field& F, size_t n, int iterations) {
 			if ( !F.areEqual(P_it->operator[](1), one) ){
 				ret = false;
 			}
-			
+
 			P_it++;
 		}
-		
+
 		// Test CharPoly(a*In) = X-a
 		G.random(tmp);
-		
+
 		for (size_t i=0;i<n;++i)
 			F.assign(*(A+i*(n+1)),tmp);
 		F.negin(tmp);
 		P.clear();
 
 		FFPACK::CharPoly( F, P, n, A, n );
-	
+
 		P_it = P.begin();
 
 		while (P_it != P.end()){
@@ -571,29 +619,30 @@ static bool testCharPoly (const Field& F, size_t n, int iterations) {
 	}
 
 	commentator.stop(MSG_STATUS (ret), (const char *) 0, "testCharPoly");
-	
+
 	return ret;
 }
 
 template <class Field>
-static bool testInv (const Field& F,size_t n, int iterations) {
+static bool testInv (const Field& F,size_t n, int iterations)
+{
 
 	typedef typename Field::Element Element;
 	typedef typename Field::RandIter RandIter;
-  
+
 	//Commentator commentator;
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
 	commentator.start (pretty("Testing inverse"),"testInv",iterations);
-	
+
 	RandIter G(F);
-	NonzeroRandIter<Field> Gn(F,G); 
+	NonzeroRandIter<Field> Gn(F,G);
 	Element zero,one;
 	F.init(one,1UL);
 	F.init(zero,0UL);
-	
+
 	bool ret = true;
-	
+
 	Element * Id = new Element[n*n];
 	for (size_t i=0;i<n;++i){
 		for (size_t j=0;j<n;++j)
@@ -601,28 +650,28 @@ static bool testInv (const Field& F,size_t n, int iterations) {
 		F.assign( *(Id+i*(n+1)),one);
 	}
 	for (int k=0;k<iterations;++k) {
-    
+
 		commentator.progress(k);
-   
+
 
 		Element * A = new Element[n*n];
 		Element * L = new Element[n*n];
 		Element * S = new Element[n*n];
 
-		
 
-		// create S as an upper triangular matrix of full rank 
-		// with nonzero random diagonal's element 
+
+		// create S as an upper triangular matrix of full rank
+		// with nonzero random diagonal's element
 		for (size_t i=0;i<n;++i){
-			for (size_t j=0;j<i;++j)      
+			for (size_t j=0;j<i;++j)
 				F.assign(*(S+i*n+j),zero);
 			Gn.random(*(S+i*(n+1)));
-			for (size_t j=i+1;j<n;++j)      
+			for (size_t j=i+1;j<n;++j)
 				G.random(*(S+i*n+j));
 		}
-     
-		// create L as a lower triangular matrix 
-		// with only 1's on diagonal 
+
+		// create L as a lower triangular matrix
+		// with only 1's on diagonal
 		for (size_t i=0;i<n;++i){
 			for (size_t j=0;j<i;++j)
 				G.random(*(L+i*n+j));
@@ -631,7 +680,7 @@ static bool testInv (const Field& F,size_t n, int iterations) {
 				F.assign(*(L+i*n+j),zero);
 
 		}
-        
+
 		//  compute A=LS
 
 		FFLAS::fgemm( F, FFLAS::FflasNoTrans, FFLAS::FflasNoTrans, n, n, n,
@@ -644,7 +693,7 @@ static bool testInv (const Field& F,size_t n, int iterations) {
 		// compute the inverse of A
 		int nullity;
 		FFPACK::Invert2 ( F, n, A, n, invA, n, nullity);
-		
+
 		// compute Ainv*A and A*Ainv
 
 		FFLAS::fgemm( F, FFLAS::FflasNoTrans, FFLAS::FflasNoTrans, n, n, n,
@@ -652,9 +701,9 @@ static bool testInv (const Field& F,size_t n, int iterations) {
 
 		FFLAS::fgemm( F, FFLAS::FflasNoTrans, FFLAS::FflasNoTrans, n, n, n,
 			      one, invA, n, Ab, n, zero, S, n );
-   
+
 		for (size_t i=0;i<n*n;++i)
-			if ( !F.areEqual(*(L+i),*(Id+i)) || !F.areEqual(*(S+i),*(Id+i)) ) 
+			if ( !F.areEqual(*(L+i),*(Id+i)) || !F.areEqual(*(S+i),*(Id+i)) )
 				ret =false;
 		if (!ret){
 			// write_field (F, cerr<<"ID1="<<endl, L, n,n,n);
@@ -668,136 +717,294 @@ static bool testInv (const Field& F,size_t n, int iterations) {
 		delete[] invA;
 	}
 	delete[] Id;
-	
+
 	commentator.stop(MSG_STATUS (ret), (const char *) 0, "testInv");
-    
+
 	return ret;
 }
 
 template <class Field>
-static bool testapplyP (const Field& F,size_t n, int iterations) {
+static bool testapplyP (const Field& F,size_t n, int iterations)
+{
 
 	typedef typename Field::Element Element;
 	typedef typename Field::RandIter RandIter;
-  
+
 	//Commentator commentator;
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
 	commentator.start (pretty("Testing applyP"),"testapplyP",iterations);
-	
+
 	RandIter G(F);
 	Element zero,one,tmp,tmp2;
 	F.init(one,1UL);
 	F.init(zero,0UL);
-	
+
 	bool ret = true;
 	Field Z2(2);
 	RandIter G2(Z2);
-	
+
 	for (int k=0;k<iterations;++k) {
-		
+
 		commentator.progress(k);
-		
+
 
 		Element * A = new Element[n*n];
 		Element * Ab = new Element[n*n];
 		size_t * P =new size_t[n];
-		
-		
+
+
 		for (size_t i=0; i<n; ++i){
 			G.random(tmp);
 			if ( Z2.isZero(G2.random(tmp2) ) )
-				P[i] = i + ( (size_t) tmp % (n-i) ); 
-			else				
+				P[i] = i + ( (size_t) tmp % (n-i) );
+			else
 				P[i] = i;
 		}
-		
-		// create S as an upper triangular matrix of full rank 
-		// with nonzero random diagonal's element 
+
+		// create S as an upper triangular matrix of full rank
+		// with nonzero random diagonal's element
 		for (size_t i=0;i<n;++i){
-			for (size_t j=0;j<n;++j)      
+			for (size_t j=0;j<n;++j)
 				G.random(*(A+i*n+j));
 		}
-		
+
 		for (size_t i = 0; i<n*n; ++i)
 			F.assign( *(Ab+i), *(A+i) );
-		
+
 		//  compute A=LS
 
 		FFPACK::applyP( F, FFLAS::FflasRight, FFLAS::FflasNoTrans, n, 0, n, A, n, P );
 		FFPACK::applyP( F, FFLAS::FflasLeft, FFLAS::FflasNoTrans, n, 0, n, A, n, P );
 		FFPACK::applyP( F, FFLAS::FflasRight, FFLAS::FflasTrans, n, 0, n, A, n, P );
 		FFPACK::applyP( F, FFLAS::FflasLeft, FFLAS::FflasTrans, n, 0, n, A, n, P );
-		
+
 		for (size_t i=0;i<n*n;++i)
-			if ( !F.areEqual(*(Ab+i),*(A+i)) ) 
+			if ( !F.areEqual(*(Ab+i),*(A+i)) )
 				ret =false;
 		delete[] A;
 		delete[] Ab;
 		delete[] P;
 	}
-	
+
 	commentator.stop(MSG_STATUS (ret), (const char *) 0, "testApplyP");
-    
+
 	return ret;
 }
 
-int main(int argc, char** argv){
-	//-----------------------------------------------------------------------
-	// Choice of the finite field representation
-	//typedef GivaroZpz<Std32> Field;
-	typedef Modular<double> Field;
-	//typedef Modular<float> Field;
-	//typedef Modular<LinBox::uint32> Field;
-	//------------------------------------------------------------------------
-
+int main(int argc, char** argv)
+{
 	bool pass = true;
 
-	static size_t n = 130;
-	static integer q = 65521;
+	static size_t n = 130+(size_t)(130*drand48());
+	static size_t m = 130+(size_t)(130*drand48());
+	static integer q = 653;
 	static int iterations =1;
 
 	static Argument args[] = {
-		{ 'n', "-n N", "Set dimension of test matrices to NxN.",       TYPE_INT,     &n },
-		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q }, 
+		{ 'n', "-n N", "Set dimension of test matrices to MxN.",       TYPE_INT,     &n },
+		{ 'm', "-m M", "Set dimension of test matrices to MxN.",       TYPE_INT,     &m },
+		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
 		{ 'i', "-i I", "Perform each test for I iterations.",           TYPE_INT,     &iterations },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
-    
-	Field F (q);
 
-	srand(time (NULL));
-	
-	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
-	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
-	commentator.start("ffpack test suite", "ffpack");
-
- 	if (!testLUdivine (F, n,n, iterations)) pass=false;
- 	if (!testRank (F, n, iterations))   pass = false;   
- 	if (!testDet (F, n, iterations))   pass = false;   
-  	if (!testTURBO (F, n, iterations))   pass = false;   
-  	if (!testapplyP  (F, n, iterations)) pass = false;
-  	if (!testInv  (F, n, iterations)) pass = false;
-  	if (!testMinPoly (F,n,iterations)) pass=false;
-	if (!testCharPoly (F,n,iterations)) pass=false;
-	
-	commentator.stop(MSG_STATUS(pass),"ffpack test suite");
-    
-	return pass ? 0 : -1;
-}
+	/* Modular Double */
+	{
+		typedef Modular<double> Field;
+
+		Field F (q);
+
+		srand(time (NULL));
+
+		commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
+		commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
+		commentator.start("ffpack test suite", "ffpack");
 
+		if (!testLUdivine (F, m,n, iterations)) pass = false;
+		if (!testRank (F, n, iterations))       pass = false;
+		if (!testDet (F, n, iterations))        pass = false;
+		if (!testTURBO (F, n, iterations))      pass = false;
+		if (!testapplyP  (F, n, iterations))    pass = false;
+		if (!testInv  (F, n, iterations))       pass = false;
+		if (!testMinPoly (F,n,iterations))      pass = false;
+		if (!testCharPoly (F,n,iterations))     pass = false;
 
+	}
+
+#ifdef _LB_FULL_TEST
+	/* Modular Float */
+	{
+		typedef Modular<float> Field;
+
+		Field F (q);
+
+		srand(time (NULL));
+
+		commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
+		commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
+		commentator.start("ffpack test suite", "ffpack");
+
+		if (!testLUdivine (F, m,n, iterations)) pass = false;
+		if (!testRank (F, n, iterations))       pass = false;
+		if (!testDet (F, n, iterations))        pass = false;
+		if (!testTURBO (F, n, iterations))      pass = false;
+		if (!testapplyP  (F, n, iterations))    pass = false;
+		if (!testInv  (F, n, iterations))       pass = false;
+		if (!testMinPoly (F,n,iterations))      pass = false;
+		if (!testCharPoly (F,n,iterations))     pass = false;
+
+	}
+
+	/* Modular Balanced Double */
+	{
+		typedef LinBox::ModularBalanced<double> Field;
+
+		Field F (q);
+
+		srand(time (NULL));
+
+		commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
+		commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
+		commentator.start("ffpack test suite", "ffpack");
+
+		if (!testLUdivine (F, m,n, iterations)) pass = false;
+		if (!testRank (F, n, iterations))       pass = false;
+		if (!testDet (F, n, iterations))        pass = false;
+		if (!testTURBO (F, n, iterations))      pass = false;
+		if (!testapplyP  (F, n, iterations))    pass = false;
+		if (!testInv  (F, n, iterations))       pass = false;
+		if (!testMinPoly (F,n,iterations))      pass = false;
+		if (!testCharPoly (F,n,iterations))     pass = false;
+
+	}
+
+	/* Modular Balanced Float */
+	{
+		typedef ModularBalanced<float> Field;
+
+		Field F (q);
+
+		srand(time (NULL));
+
+		commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
+		commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
+		commentator.start("ffpack test suite", "ffpack");
+
+		if (!testLUdivine (F, m,n, iterations)) pass = false;
+		if (!testRank (F, n, iterations))       pass = false;
+		if (!testDet (F, n, iterations))        pass = false;
+		if (!testTURBO (F, n, iterations))      pass = false;
+		if (!testapplyP  (F, n, iterations))    pass = false;
+		if (!testInv  (F, n, iterations))       pass = false;
+		if (!testMinPoly (F,n,iterations))      pass = false;
+		if (!testCharPoly (F,n,iterations))     pass = false;
+
+	}
+#warning "some tests don't compile or fail"
+	/* Modular int32_t */
+	{
+		typedef Modular<int32_t> Field;
+
+		Field F (q);
+
+		srand(time (NULL));
 
+		commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
+		commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
+		commentator.start("ffpack test suite", "ffpack");
 
+		if (!testLUdivine (F, m,n, iterations)) pass = false;
+		if (!testRank (F, n, iterations))       pass = false;
+		if (!testDet (F, n, iterations))        pass = false;
+		if (!testTURBO (F, n, iterations))      pass = false;
+		if (!testapplyP  (F, n, iterations))    pass = false;
+		if (!testInv  (F, n, iterations))       pass = false;
+		if (!testMinPoly (F,n,iterations))      pass = false;
+		if (!testCharPoly (F,n,iterations))     pass = false;
 
+	}
+
+#if 0 // fails
+	/* Modular Balanced int32_t */
+	{
+		typedef ModularBalanced<int32_t > Field ;
 
+		Field F (q);
 
+		srand(time (NULL));
 
+		commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
+		commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
+		commentator.start("ffpack test suite", "ffpack");
 
+		if (!testLUdivine (F, m,n, iterations)) pass = false;
+		if (!testRank (F, n, iterations))       pass = false;
+		if (!testDet (F, n, iterations))        pass = false;
+		if (!testTURBO (F, n, iterations))      pass = false;
+		if (!testapplyP  (F, n, iterations))    pass = false;
+		if (!testInv  (F, n, iterations))       pass = false;
+		if (!testMinPoly (F,n,iterations))      pass = false;
+		if (!testCharPoly (F,n,iterations))     pass = false;
+	}
+#endif
 
+#if 0 // no NonZeroRandIter
+	/* Modular uint32_t */
+	{
+		typedef Modular<uint32_t> Field;
+
+		Field F (q);
+
+		srand(time (NULL));
+
+		commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
+		commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
+		commentator.start("ffpack test suite", "ffpack");
+
+		if (!testLUdivine (F, m,n, iterations)) pass=false;
+		if (!testRank (F, n, iterations))   pass = false;
+		if (!testDet (F, n, iterations))   pass = false;
+		if (!testTURBO (F, n, iterations))   pass = false;
+		if (!testapplyP  (F, n, iterations)) pass = false;
+		if (!testInv  (F, n, iterations)) pass = false;
+		if (!testMinPoly (F,n,iterations)) pass=false;
+		if (!testCharPoly (F,n,iterations)) pass=false;
+	}
+#endif
+
+#if 0 // no NonZeroRandIter
+	/* GivaroZpz int32_t */
+	{
+		typedef GivaroZpz<Std32> Field;
+
+		Field F (q);
+
+		srand(time (NULL));
+
+		commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
+		commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
+		commentator.start("ffpack test suite", "ffpack");
+
+		if (!testLUdivine (F, m,n, iterations)) pass=false;
+		if (!testRank (F, n, iterations))   pass = false;
+		if (!testDet (F, n, iterations))   pass = false;
+		if (!testTURBO (F, n, iterations))   pass = false;
+		if (!testapplyP  (F, n, iterations)) pass = false;
+		if (!testInv  (F, n, iterations)) pass = false;
+		if (!testMinPoly (F,n,iterations)) pass=false;
+		if (!testCharPoly (F,n,iterations)) pass=false;
+	}
+#endif
+#endif
+	commentator.stop(MSG_STATUS(pass),"ffpack test suite");
+
+	return pass ? 0 : -1;
+}
 
 
+#undef _LB_FULL_TEST
 
 
diff --git a/tests/test-field.h b/tests/test-field.h
index 7f33bae..7e629c5 100644
--- a/tests/test-field.h
+++ b/tests/test-field.h
@@ -1,5 +1,5 @@
-/* -*- mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-
+/* -*- 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
 /* linbox/tests/test-field.h
  * Copyright (C) 2001, 2002 Bradford Hovinen
  * See COPYING for license information.
@@ -7,8 +7,14 @@
  * Extracted by bds from test-generic.h, written by Bradford Hovinen <hovinen at cis.udel.edu>
  */
 
-#ifndef __TEST_FIELD_H
-#define __TEST_FIELD_H
+/*! @file tests/test-field.h
+ * @ingroup tests
+ * @brief tests field operations
+ * @test  tests field operations
+ */
+
+#ifndef __LINBOX_test_field_H
+#define __LINBOX_test_field_H
 
 #include <iostream>
 //#include <fstream>
@@ -18,16 +24,22 @@
 
 #include "linbox/util/commentator.h"
 #include "linbox/util/field-axpy.h"
+#include "linbox/randiter/nonzero.h"
 //#include "linbox/vector/stream.h"
 #include "linbox/integer.h"
 
-#include "test-common.h" 
+#include "test-common.h"
 
 /* Modular exponentiation */
 using namespace std;
 
+// LinBox::Commentator commentator(std::cout);
+
+using LinBox::commentator ;
+
+
 template <class Field>
-typename Field::Element& expt (const Field &F, typename Field::Element &res, const typename Field::Element &a, LinBox::integer &n) 
+typename Field::Element& expt (const Field &F, typename Field::Element &res, const typename Field::Element &a, LinBox::integer &n)
 {
 	if (n == 0) {
 		F.init (res, 1);
@@ -39,11 +51,12 @@ typename Field::Element& expt (const Field &F, typename Field::Element &res, con
 		n -= 1;
 		expt (F, res, a, n);
 		F.mulin (res, a);
-	} else {
+	}
+	else {
 		n /= 2;
 		expt (F, res, a, n);
-                typename Field::Element tmp;
-                F.init(tmp,0);
+		typename Field::Element tmp;
+		F.init(tmp,0);
 		res = F.mul (tmp, res, res);
 	}
 
@@ -69,17 +82,19 @@ bool reportError(string rep, bool& flag)
  */
 
 template<class Field>
-bool testField (Field &F, const char *title, bool fieldp = true) 
+bool testField (Field &F, const char *title, bool fieldp = true)
 {
+	commentator.start (title, "testField", 5);
+	// ostream &report = std::cout ;
+	ostream &report = commentator.report (LinBox::Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+
 	typename Field::Element zero, one, two, three;
 	F.init(zero, 0); F.init(one, 1); F.init(two, 2); F.init(three, 3);
 
 	typename Field::Element a, b, c, d, e, f;
 	F.init(a,0); F.init(b,0); F.init(c,0); F.init(d,0); F.init(e,0); F.init(f,0);
 
-	commentator.start (title, "testField", 5);
 
-	ostream &report = commentator.report (LinBox::Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
 	report << "Field self description: " << F.write (report) << endl;
 	//	report << "field Element 2: " << F.write (report, two) << endl;
 
@@ -88,7 +103,7 @@ bool testField (Field &F, const char *title, bool fieldp = true)
 
 	commentator.start ("\t--Testing characteristic/cardinality match");
 
-	F.characteristic (n); 
+	F.characteristic (n);
 	F.cardinality (m);
 
 	if (n > 0 && !isPower (m, n)) part_pass = reportError("Characteristic, cardinality mismatch", pass);
@@ -97,15 +112,20 @@ bool testField (Field &F, const char *title, bool fieldp = true)
 	commentator.progress ();
 
 	/* tests for presence of members with minimal check of semantics */
-	// these checks need improvement 
+	// these checks need improvement
 
 	commentator.start ("\t--Testing correctness of 0 and 1");
 	part_pass = true;
 
-	if (!F.isZero (zero)) part_pass = reportError( "isZero (0) is false", pass);
+	if (!F.isZero (zero)) {
+		part_pass = reportError( "isZero (0) is false", pass);
+	}
 	if (F.isZero (one)) part_pass = reportError( "isZero (1) is true", pass);
 	if (F.isOne (zero)) part_pass = reportError( "isOne (0) is true", pass);
-	if (!F.isOne (one)) part_pass = reportError( "isOne (1) is false", pass);
+	if (!F.isOne (one)) {
+		part_pass = reportError( "isOne (1) is false", pass);
+	}
+
 
 	commentator.stop (MSG_STATUS (part_pass));
 	commentator.progress ();
@@ -116,9 +136,10 @@ bool testField (Field &F, const char *title, bool fieldp = true)
 	if (F.cardinality (m) <= 0)
 		n = 49193295;   // Just using some odd value
 	else
-		n -= 1;
+		n = n/2-1;
+	if (!n) ++n;
+
 
-	
 	report << "Initial integer: " << n << endl;
 	F.init (a, n);  F.write ( report << "Result of init: ", a) << endl;
 
@@ -141,7 +162,7 @@ bool testField (Field &F, const char *title, bool fieldp = true)
 	F.assign (d, three);
 	F.addin (d, two); F.write (report << "Result of 2 + 3 (inplace): ", d) << endl;
 
-	if (!F.areEqual (a, F.init (f, 5)) || !F.areEqual (d, a)) 
+	if (!F.areEqual (a, F.init (f, 5)) || !F.areEqual (d, a))
 		part_pass = reportError( "Results of add are incorrect", pass);
 
 	F.neg (a, two); F.write (report << "Result of -2: ", a) << endl;
@@ -149,14 +170,14 @@ bool testField (Field &F, const char *title, bool fieldp = true)
 	F.negin (d); F.write (report << "Result of -2 (inplace): ", d) << endl;
 	F.init (f, -2); F.write( report << "-2 via init: ", f) << endl;
 
-	if (!F.areEqual (a, f) || !F.areEqual (d, a)) 
+	if (!F.areEqual (a, f) || !F.areEqual (d, a))
 		part_pass = reportError( "Results of neg are incorrect", pass);
 
 	F.sub (a, three, two); F.write (report << "Result of 3 - 2: ", a) << endl;
 	F.init (d, 3);
 	F.subin (d, two); F.write (report << "Result of 3 - 2 (inplace): ", d) << endl;
 
-	if (!F.areEqual (a, one) || !F.areEqual (d, a)) 
+	if (!F.areEqual (a, one) || !F.areEqual (d, a))
 		part_pass = reportError( "Results of neg sub incorrect", pass);
 
 	F.mul (a, two, three); F.write (report << "Result of 2 * 3: ", a) << endl;
@@ -164,14 +185,14 @@ bool testField (Field &F, const char *title, bool fieldp = true)
 	F.mulin (d, three); F.write (report << "Result of 2 * 3 (inplace): ", d) << endl;
 	F.init (f, 6);
 
-	if (!F.areEqual (a, f) || !F.areEqual (d, a)) 
+	if (!F.areEqual (a, f) || !F.areEqual (d, a))
 		part_pass = reportError( "Results of mul incorrect", pass);
 
 	F.inv (a, one); F.write (report << "Result of inverting 1: ", a) << endl;
 	F.assign (d, one);
 	F.invin (d); F.write (report << "Result of inverting 1 (inplace): ", d) << endl;
 
-	if (!F.areEqual (a, one) || !F.areEqual (d, a)) 
+	if (!F.areEqual (a, one) || !F.areEqual (d, a))
 		part_pass = reportError( "Results of inv incorrect", pass);
 
 	if ( F.isZero(two) ) F.assign(f, three); else F.assign(f, two);
@@ -179,7 +200,7 @@ bool testField (Field &F, const char *title, bool fieldp = true)
 	F.assign(d, f);
 	F.divin (d, f); F.write ( report << "Result of f/f (inplace): ", d) << endl;
 
-	if (!F.areEqual (a, one) || !F.areEqual (d, a)) 
+	if (!F.areEqual (a, one) || !F.areEqual (d, a))
 		part_pass = reportError( "Results of div incorrect", pass);
 
 	F.axpy (a, two, three, two); F.write ( report << "Result of axpy 2*3 + 2: ", a) << endl;
@@ -187,7 +208,7 @@ bool testField (Field &F, const char *title, bool fieldp = true)
 	F.axpyin (d, two, three); F.write ( report << "Result of axpy 2*3 + 2 (inplace): ", d) << endl;
 	F.init (f, 8);
 
-	if ( !F.areEqual (a, f) || !F.areEqual (d, a) ) 
+	if ( !F.areEqual (a, f) || !F.areEqual (d, a) )
 		part_pass = reportError( "Results of axpy incorrect", pass);
 
 	commentator.stop (MSG_STATUS (part_pass));
@@ -201,7 +222,7 @@ bool testField (Field &F, const char *title, bool fieldp = true)
 	F.init (a, 1);
 	F.init (b, 1);
 	F.init (c, 0);
-	
+
 	n = 101;
 	expt(F, a, two, n);
 	F.subin (a, one); F.write( report << "using expt, 2^101 - 1: ", a) << endl;
@@ -211,35 +232,36 @@ bool testField (Field &F, const char *title, bool fieldp = true)
 		F.mulin (b, two);
 	}
 
-	if (!F.areEqual (a, c)) 
+	if (!F.areEqual (a, c))
 		part_pass = reportError( "2^101 - 1 != 1 + 2 + .. + 2^100", pass);
 
 	// 1 + 2*(1 + 2*( ... (1) ... )), 100 times.
 	F.assign (d, one);
 	for (int i = 1; i < 101; ++i)
 	{	F.axpy (b, two, d, one); F.assign(d, b); }
-    F.write( report << "using axpy, 1 + 2(1 + ... + 2(1)...), with 100 '+'s: ", d) << endl;
+	F.write( report << "using axpy, 1 + 2(1 + ... + 2(1)...), with 100 '+'s: ", d) << endl;
 
-	if (!F.areEqual (a, d)) 
-	part_pass = reportError( "2^101 - 1 != 1 + 2(1 + ... + 2(1)...), with 100 '+'s: ", pass);
+	if (!F.areEqual (a, d))
+		part_pass = reportError( "2^101 - 1 != 1 + 2(1 + ... + 2(1)...), with 100 '+'s: ", pass);
 
 	commentator.stop (MSG_STATUS (part_pass));
 	commentator.progress ();
 
-	/* untested so far
-	   ostream &write (ostream &os) const 
-	   istream &read (istream &is)
-	   ostream &write (ostream &os, const Element &x) const 
-	   istream &read (istream &is, Element &x) const
-	   FieldArchetype (FieldAbstract*, ElementAbstract*, RandIterAbstract* = 0)
-	*/
+	/*! @todo untested so far :
+	 * - ostream &write (ostream &os) const
+	 * - istream &read (istream &is)
+	 * - ostream &write (ostream &os, const Element &x) const
+	 * - istream &read (istream &is, Element &x) const
+	 * - FieldArchetype (FieldAbstract*, ElementAbstract*, RandIterAbstract* = 0)
+	 * .
+	 */
 
 	commentator.stop (MSG_STATUS (pass), (const char *) 0, "testField");
-	
+
 	return pass;
 }
 
-
+
 /** Tests of algebraic properties of fields */
 
 /* Generic test 6: Negation of elements
@@ -248,7 +270,7 @@ bool testField (Field &F, const char *title, bool fieldp = true)
  */
 
 template <class Field>
-bool testFieldNegation (const Field &F, const char *name, unsigned int iterations) 
+bool testFieldNegation (const Field &F, const char *name, unsigned int iterations)
 {
 	std::ostringstream str;
 	str << "\t--Testing " << name << " negation" << ends;
@@ -264,7 +286,7 @@ bool testFieldNegation (const Field &F, const char *name, unsigned int iteration
 
 	for (unsigned int i = 0; i < iterations; i++) {
 		commentator.startIteration (i);
-		
+
 		r.random (a);
 
 		ostream &report = commentator.report (LinBox::Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
@@ -298,7 +320,7 @@ bool testFieldNegation (const Field &F, const char *name, unsigned int iteration
  */
 
 template <class Field>
-bool testFieldInversion (const Field &F, const char *name, unsigned int iterations) 
+bool testFieldInversion (const Field &F, const char *name, unsigned int iterations)
 {
 	std::ostringstream str;
 	str << "\t--Testing " << name << " inversion" << ends;
@@ -307,7 +329,7 @@ bool testFieldInversion (const Field &F, const char *name, unsigned int iteratio
 	commentator.start (st, "testFieldInversion", iterations);
 
 	typename Field::Element a, ainv, aainv, one;
-        F.init (a,0); F.init (ainv,0); F.init (aainv,0);
+	F.init (a,0); F.init (ainv,0); F.init (aainv,0);
 	F.init (one, 1);
 	typename Field::RandIter r (F);
 
@@ -350,7 +372,7 @@ bool testFieldInversion (const Field &F, const char *name, unsigned int iteratio
 
 
 template <class Field>
-bool testFieldDistributivity(const Field &F, const char *name, unsigned int iterations) 
+bool testFieldDistributivity(const Field &F, const char *name, unsigned int iterations)
 {
 	std::ostringstream str;
 	str << "\t--Testing " << name << " distributivity" << ends;
@@ -359,11 +381,11 @@ bool testFieldDistributivity(const Field &F, const char *name, unsigned int iter
 	commentator.start (st, "testFieldDistributivity", iterations);
 
 	typename Field::Element a, b, c, a_b, a_bc, ac, bc, ac_bc, ca_b, ca, cb, ca_cb;
-        F.init (a,0); F.init (b,0); F.init (c,0); 
-        F.init (a_b,0); F.init (a_bc,0); F.init (ac,0); F.init (bc,0);
-        F.init (ac_bc,0); 
-		F.init (ca_b,0); F.init (ca,0); F.init (cb,0); F.init (ca_cb,0); 
-        
+	F.init (a,0); F.init (b,0); F.init (c,0);
+	F.init (a_b,0); F.init (a_bc,0); F.init (ac,0); F.init (bc,0);
+	F.init (ac_bc,0);
+	F.init (ca_b,0); F.init (ca,0); F.init (cb,0); F.init (ca_cb,0);
+
 	typename Field::RandIter r (F);
 
 	bool ret = true;
@@ -402,7 +424,7 @@ bool testFieldDistributivity(const Field &F, const char *name, unsigned int iter
 
 		report << "c * a + c * b = ";
 		F.write (report, ca_cb) << endl;
-		if (!F.areEqual (a_bc, ac_bc) || !F.areEqual (ca_b, ca_cb)) 
+		if (!F.areEqual (a_bc, ac_bc) || !F.areEqual (ca_b, ca_cb))
 			reportError("Operations were not distributative", ret);
 
 		commentator.stop ("done");
@@ -424,7 +446,7 @@ bool testFieldDistributivity(const Field &F, const char *name, unsigned int iter
 
 
 template <class Field>
-bool testFieldCommutativity (const Field &F, const char *name, unsigned int iterations) 
+bool testFieldCommutativity (const Field &F, const char *name, unsigned int iterations)
 {
 	std::ostringstream str;
 	str << "\t--Testing " << name << " commutativity," << ends;
@@ -433,11 +455,11 @@ bool testFieldCommutativity (const Field &F, const char *name, unsigned int iter
 	commentator.start (st, "testFieldCommutativity", iterations);
 
 	typename Field::Element a, b, ab, ba, a_b, b_a;
-        F.init (a,0); F.init (b,0);
-        F.init (ab,0); F.init (ba,0);
-        F.init (a_b,0); F.init (b_a,0);
+	F.init (a,0); F.init (b,0);
+	F.init (ab,0); F.init (ba,0);
+	F.init (a_b,0); F.init (b_a,0);
+
 
-        
 	typename Field::RandIter r (F);
 
 	bool ret = true;
@@ -462,7 +484,7 @@ bool testFieldCommutativity (const Field &F, const char *name, unsigned int iter
 		report << "b*a = ";
 		F.write (report, ba) << endl;
 
-		if (!F.areEqual (ab, ba)) 
+		if (!F.areEqual (ab, ba))
 			reportError("Multiplication was not commutative", ret);
 
 
@@ -475,7 +497,7 @@ bool testFieldCommutativity (const Field &F, const char *name, unsigned int iter
 		report << "b+a = ";
 		F.write (report, b_a) << endl;
 
-		if (!F.areEqual (a_b, b_a)) 
+		if (!F.areEqual (a_b, b_a))
 			reportError("Addition was not commutative", ret);
 
 
@@ -497,7 +519,7 @@ bool testFieldCommutativity (const Field &F, const char *name, unsigned int iter
  */
 
 template <class Field>
-bool testFieldAssociativity (const Field &F, const char *name, unsigned int iterations) 
+bool testFieldAssociativity (const Field &F, const char *name, unsigned int iterations)
 {
 	std::ostringstream str;
 	str << "\t--Testing " << name << " associativity" << ends;
@@ -506,8 +528,8 @@ bool testFieldAssociativity (const Field &F, const char *name, unsigned int iter
 	commentator.start (st, "testFieldAssociativity", iterations);
 
 	typename Field::Element a, b, c, a_b, b_c, a_bc, ab_c;
-        F.init (a,0); F.init (b,0); F.init (c,0);
-        F.init (a_b,0); F.init (b_c,0); F.init (a_bc,0); F.init (ab_c,0);
+	F.init (a,0); F.init (b,0); F.init (c,0);
+	F.init (a_b,0); F.init (b_c,0); F.init (a_bc,0); F.init (ab_c,0);
 	typename Field::RandIter r (F);
 
 	bool ret = true;
@@ -568,7 +590,7 @@ bool testFieldAssociativity (const Field &F, const char *name, unsigned int iter
  */
 
 template <class Field>
-bool testGeometricSummation (const Field &F, const char *name, unsigned int iterations, unsigned int n) 
+bool testGeometricSummation (const Field &F, const char *name, unsigned int iterations, unsigned int n)
 {
 	std::ostringstream str;
 	str << "\t--Testing " << name << " geometric summation" << ends;
@@ -578,17 +600,24 @@ bool testGeometricSummation (const Field &F, const char *name, unsigned int iter
 
 	typename Field::Element a, a_n, k, zero, one;
 	typename Field::RandIter r (F);
+	typename LinBox::NonzeroRandIter<Field> z(F,r);
 
 	F.init (zero, 0);
 	F.init (one, 1);
-        F.init (a,0); F.init (a_n,0); F.init (k,0);
+	F.init (a,0); F.init (a_n,0); F.init (k,0);
 
 	bool ret = true;
+        LinBox::Integer card; F.cardinality(card);
 
 	for (unsigned int i = 0; i < iterations; i++) {
 		commentator.startIteration (i);
 
-		do r.random (a); while (F.areEqual (a, one));
+		size_t no_bad_loop = card+10 ;
+		do z.random (a); while (F.areEqual (a, one) && --no_bad_loop);
+		if (!no_bad_loop) {
+			reportError(" *** ERROR *** could not find an element different form 1...",ret);
+			break;
+		}
 
 		ostream &report = commentator.report (LinBox::Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
 		report << "Random element a: ";
@@ -643,7 +672,7 @@ bool testGeometricSummation (const Field &F, const char *name, unsigned int iter
  */
 
 template <class Field>
-bool testFieldCharacteristic (const Field &F, const char *name, unsigned int iterations) 
+bool testFieldCharacteristic (const Field &F, const char *name, unsigned int iterations)
 {
 	std::ostringstream str;
 	str << "\t--Testing " << name << " characteristic" << ends;
@@ -657,8 +686,8 @@ bool testFieldCharacteristic (const Field &F, const char *name, unsigned int ite
 
 	F.characteristic (p);
 	F.init (zero, 0);
-        F.init (a,0); F.init (sigma,0);
-        
+	F.init (a,0); F.init (sigma,0);
+
 	bool ret = true;
 
 	ostream &report = commentator.report (LinBox::Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
@@ -675,7 +704,7 @@ bool testFieldCharacteristic (const Field &F, const char *name, unsigned int ite
 
 		F.assign (sigma, zero);
 
-// suggestion: make this run in time O(lg(p)), then take the conditional out of the run...Tests
+		// suggestion: make this run in time O(lg(p)), then take the conditional out of the run...Tests
 		for (j = 0; j < p; j += 1)
 			F.addin (sigma, a);
 
@@ -701,7 +730,7 @@ bool testFieldCharacteristic (const Field &F, const char *name, unsigned int ite
  */
 
 template <class Field>
-bool testFreshmansDream (const Field &F, const char *name, unsigned int iterations) 
+bool testFreshmansDream (const Field &F, const char *name, unsigned int iterations)
 {
 	std::ostringstream str;
 	str << "\t--Testing " << name << " Freshman's Dream" << ends;
@@ -724,8 +753,8 @@ bool testFreshmansDream (const Field &F, const char *name, unsigned int iteratio
 	typename Field::RandIter r (F);
 	typename Field::Element a, b, a_b, a_b_p, a_p, b_p, a_p_b_p;
 
-        F.init (a,0); F.init (b,0); F.init (a_b,0);
-        F.init (a_b_p,0); F.init (a_p,0); F.init (b_p,0); F.init (a_p_b_p,0);
+	F.init (a,0); F.init (b,0); F.init (a_b,0);
+	F.init (a_b_p,0); F.init (a_p,0); F.init (b_p,0); F.init (a_p_b_p,0);
 
 	for (unsigned int i = 0; i < iterations; i++) {
 		commentator.startIteration (i);
@@ -774,7 +803,7 @@ bool testFreshmansDream (const Field &F, const char *name, unsigned int iteratio
 }
 
 
-/* Tests of field features */ 
+/* Tests of field features */
 
 /** Generic test 7: Consistency of in-place and out-of-place arithmetic
  *
@@ -786,9 +815,15 @@ bool testFreshmansDream (const Field &F, const char *name, unsigned int iteratio
 
 template <class Field>
 bool testArithmeticConsistency (const Field &F, const char *name, unsigned int iterations)
-{  return testRingArithmeticConsistency(F, name, iterations) 
-	   && testInvDivConsistency(F, name, iterations); 
+{
+	bool ret = true ;
+
+	ret &= testRingArithmeticConsistency(F, name, iterations) ;
+	ret &= testInvDivConsistency(F, name, iterations);
+
+	return ret;
 }
+
 template <class Field>
 bool testRingArithmeticConsistency (const Field &F, const char *name, unsigned int iterations)
 {
@@ -802,7 +837,7 @@ bool testRingArithmeticConsistency (const Field &F, const char *name, unsigned i
 
 	typename Field::RandIter r (F);
 	typename Field::Element a, b, c1, c2;
-        F.init (a,0); F.init (b,0); F.init (c1,0); F.init (c2,0);
+	F.init (a,0); F.init (b,0); F.init (c1,0); F.init (c2,0);
 
 	for (unsigned int i = 0; i < iterations; i++) {
 		commentator.startIteration (i);
@@ -869,28 +904,92 @@ bool testRingArithmeticConsistency (const Field &F, const char *name, unsigned i
 }
 
 template <class Field>
+bool testRingTrivia (const Field &F, const char *name)
+{
+	//! @bug BlockRing does not know about 0 and 1 !
+	std::ostringstream str;
+	str << "\t--Testing " << name << " units" << ends;
+	char * st = new char[str.str().size()];
+	strcpy (st, str.str().c_str());
+	commentator.start (st, "testRingTrivia");
+
+	bool ret = true;
+
+	/*  some trivial tests */
+
+
+	ostream &rapport = commentator.report (LinBox::Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+
+	//!@todo enable init with 1UL et -1L pour GMPRationalElement
+	typename Field::Element one, mone, zero ;
+	LinBox::integer pun = 1 ;
+	LinBox::integer mun = -1 ;
+	LinBox::integer zer = 0 ;
+	F.init(one,pun);
+	F.init(mone,mun);
+	F.neg(mone,one);
+	// F.init(mone,-1L);
+	F.init(zero,zer);
+
+	rapport << "1 - 1 = " ;
+	typename Field::Element nil ;
+
+	F.add(nil,one,mone);
+
+	F.write(rapport,nil) << std::endl ;
+
+	if ( !F.areEqual(nil,zero) ) {
+		reportError("1+1!=0", ret);
+	}
+
+	typename Field::Element un ;
+	rapport << "-1 * -1 = " ;
+	F.mul(un,mone,mone);
+	F.write(rapport,un) << std::endl ;
+
+	if ( !F.areEqual(un,one) ) {
+		reportError("-1 * -1 != 1", ret);
+	}
+
+	F.init(nil,pun);
+	rapport << "-1 +  -1 * -1 = " ;
+	F.axpy(nil,mone,mone,mone) ;
+	F.write(rapport,nil) << std::endl ;
+
+	if ( !F.areEqual(nil,zero) ) {
+		reportError("-1+(-1*-1)!=0", ret);
+	}
+
+	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testRingTrivia");
+	delete[] st;
+	return ret;
+}
+
+
+
+template <class Field>
 bool testInvDivConsistency (const Field &F, const char *name, unsigned int iterations)
 {
-    std::ostringstream str;
-    str << "\t--Testing " << name << " in-place/out-of-place inv and div consistency" << ends;
+	std::ostringstream str;
+	str << "\t--Testing " << name << " in-place/out-of-place inv and div consistency" << ends;
 	char * st = new char[str.str().size()];
 	strcpy (st, str.str().c_str());
 	commentator.start (st, "testInvDivConsistency", iterations);
 
-    bool ret = true;
+	bool ret = true;
 
-    typename Field::RandIter r (F);
-    typename Field::Element a, b, c1, c2;
-    F.init (a,0); F.init (b,0); F.init (c1,0); F.init (c2,0);
+	typename Field::RandIter r (F);
+	typename Field::Element a, b, c1, c2;
+	F.init (a,0); F.init (b,0); F.init (c1,0); F.init (c2,0);
 
-    for (unsigned int i = 0; i < iterations; i++) {
-        commentator.startIteration (i);
+	for (unsigned int i = 0; i < iterations; i++) {
+		commentator.startIteration (i);
 
-        r.random (a); r.random (b);
+		r.random (a); r.random (b);
 
 		// This should be immaterial, since we have already "proven" commutativity
 		if (F.isZero (a) && !F.isZero (b))
-		std::swap (a, b);
+			std::swap (a, b);
 
 		ostream &report = commentator.report (LinBox::Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
 		report << "Random elements a = ";
@@ -907,7 +1006,7 @@ bool testInvDivConsistency (const Field &F, const char *name, unsigned int itera
 			F.write (report, c1) << ", (in-place) ";
 			F.write (report, c2) << endl;
 
-		if (!F.areEqual (c1, c2)) reportError("Consistency failure for division", ret);
+			if (!F.areEqual (c1, c2)) reportError("Consistency failure for division", ret);
 
 			F.inv (c1, a);
 			F.assign (c2, a);
@@ -917,7 +1016,7 @@ bool testInvDivConsistency (const Field &F, const char *name, unsigned int itera
 			F.write (report, c1) << ", (in-place) ";
 			F.write (report, c2) << endl;
 
-		if (!F.areEqual (c1, c2)) reportError("Consistency failure for inversion", ret);
+			if (!F.areEqual (c1, c2)) reportError("Consistency failure for inversion", ret);
 		}
 
 		commentator.stop ("done");
@@ -948,8 +1047,8 @@ bool testAxpyConsistency (const Field &F, const char *name, unsigned int iterati
 
 	typename Field::RandIter r (F);
 	typename Field::Element a, x, y, c1, c2, c3;
-        F.init (a,0); F.init (x,0); F.init (y,0); 
-        F.init (c1,0); F.init (c2,0); F.init (c3,0);
+	F.init (a,0); F.init (x,0); F.init (y,0);
+	F.init (c1,0); F.init (c2,0); F.init (c3,0);
 
 	for (unsigned int i = 0; i < iterations; i++) {
 		commentator.startIteration (i);
@@ -1001,47 +1100,50 @@ bool testRanditerBasic(const Field &F, const char *name, unsigned int iterations
 	strcpy (st, str.str().c_str());
 	commentator.start (st, "testRanditerBasic", iterations);
 
-	 typename Field::RandIter r (F);
-	 typename Field::Element a;
-		 F.init (a,0);
-
-	 if (iterations < 20) iterations = 20;
-	 for (unsigned int i = 0; i < iterations; i++) {
-		 r.random (a);
-		 if ( ! F.isZero(a) ) {ret = true; break;}
-
-	 }
-
-	 commentator.stop (MSG_STATUS (ret), (const char *) 0, "testRanditerBasic");
-	 delete[] st;
-	 return ret;
- }
-
- 
- /* Convenience function to run all of the field tests on a given field */
-
- template <class Field>
- bool runFieldTests (const Field &F, const char *desc, unsigned int iterations, size_t n, bool runCharacteristicTest = true) 
- // n is not used.
- {	ostringstream str;
-
-	 str << "\t--Testing " << desc << " field" << ends;
-	 char * st = new char[str.str().size()];
-	 strcpy (st, str.str().c_str());
-	 commentator.start (st, "runFieldTests");
-	 bool ret =  runBasicRingTests(F, desc, iterations, runCharacteristicTest)
-		 && testInvDivConsistency(F, desc, iterations) 
-		 && testFieldInversion (F, desc, iterations)
-		 && testFieldCommutativity (F, desc, iterations)
-		 && testFreshmansDream(F, desc, iterations);
-
-	 commentator.stop (MSG_STATUS (ret));
-	 delete[] st;
-	 return ret;
+	typename Field::RandIter r (F);
+	typename Field::Element a;
+	F.init (a,0);
+
+	if (iterations < 20) iterations = 20;
+	for (unsigned int i = 0; i < iterations; i++) {
+		r.random (a);
+		if ( ! F.isZero(a) ) {ret = true; break;}
+
+	}
+
+	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testRanditerBasic");
+	delete[] st;
+	return ret;
 }
 
+
+/* Convenience function to run all of the field tests on a given field */
+
 template <class Field>
-bool runBasicRingTests (const Field &F, const char *desc, unsigned int iterations, bool runCharacteristicTest = true) 
+bool runFieldTests (const Field &F, const char *desc, unsigned int iterations, size_t n, bool runCharacteristicTest = true)
+	// n is not used.
+{
+
+	ostringstream str;
+
+	str << "\t--Testing " << desc << " field" << ends;
+	char * st = new char[str.str().size()];
+	strcpy (st, str.str().c_str());
+	commentator.start (st, "runFieldTests");
+	bool ret =  runBasicRingTests(F, desc, iterations, runCharacteristicTest) ;
+	ret &= testInvDivConsistency(F, desc, iterations) ;
+	ret &= testFieldInversion (F, desc, iterations) ;
+	ret &= testFieldCommutativity (F, desc, iterations) ;
+	ret &= testFreshmansDream(F, desc, iterations);
+	ret &= testRingTrivia(F,desc);
+
+	commentator.stop (MSG_STATUS (ret));
+	delete[] st;
+	return ret;
+}
+
+template <class Field>
+bool runBasicRingTests (const Field &F, const char *desc, unsigned int iterations, bool runCharacteristicTest = true)
 {
 	bool pass = true;
 	ostringstream str;
@@ -1051,23 +1153,33 @@ bool runBasicRingTests (const Field &F, const char *desc, unsigned int iteration
 	strcpy (st, str.str().c_str());
 
 	commentator.start (st, "runBasicRingTests", runCharacteristicTest ? 11 : 10);
-	
-	if (!testField                 (F, string(str.str()).c_str()))                pass = false; commentator.progress ();
-	if (!testFieldNegation         (F, desc, iterations))                    pass = false; commentator.progress ();
-	if (!testFieldDistributivity           (F, desc, iterations))                    pass = false; commentator.progress ();
-	if (!testFieldAssociativity    (F, desc, iterations))                    pass = false; commentator.progress ();
+
+	if (!testField                     (F, string(str.str()).c_str()))           pass = false;
+	commentator.progress ();
+	if (!testFieldNegation             (F, desc, iterations))                    pass = false;
+       	commentator.progress ();
+	if (!testFieldDistributivity       (F, desc, iterations))                    pass = false;
+       	commentator.progress ();
+	if (!testFieldAssociativity        (F, desc, iterations))                    pass = false;
+       	commentator.progress ();
 
 	if (runCharacteristicTest) {
-		if (!testFieldCharacteristic (F, desc, iterations))
-			pass = false;
+		if (!testFieldCharacteristic (F, desc, iterations))                  pass = false;
+		commentator.progress ();
+	}
+        LinBox::integer card;
 
+	if (F.cardinality(card) != 2) { // otherwise it is not very interesting to find a element not zero and not one !
+		if (!testGeometricSummation        (F, desc, iterations, 100))               pass = false;
 		commentator.progress ();
 	}
 
-	if (!testGeometricSummation    (F, desc, iterations, 100))               pass = false; commentator.progress ();
-	if (!testRingArithmeticConsistency (F, desc, iterations))                    pass = false; commentator.progress ();
-	if (!testAxpyConsistency       (F, desc, iterations))                    pass = false; commentator.progress ();
-	if (!testRanditerBasic       (F, desc, iterations))                    pass = false; commentator.progress ();
+	if (!testArithmeticConsistency (F, desc, iterations))                    pass = false;
+       	commentator.progress ();
+	if (!testAxpyConsistency           (F, desc, iterations))                    pass = false;
+       	commentator.progress ();
+	if (!testRanditerBasic             (F, desc, iterations))                    pass = false;
+       	commentator.progress ();
 
 	commentator.stop (MSG_STATUS (pass), (const char *) 0, "runBasicRingTests");
 	delete[] st;
@@ -1080,14 +1192,14 @@ bool runBasicRingTests (const Field &F, const char *desc, unsigned int iteration
  *
  * Test that the random iterator over the given field works.
  *
- * Test up to five times, accepting any one, to increase probability of 
+ * Test up to five times, accepting any one, to increase probability of
  * passing statistical tests.
  */
 template <class Field>
 bool testRandomIterator (const Field &F, const char *text,
 			 unsigned int num_trials,
 			 unsigned int num_categories,
-			 unsigned int hist_len) 
+			 unsigned int hist_len)
 {
 	std::ostringstream str;
 
@@ -1095,19 +1207,19 @@ bool testRandomIterator (const Field &F, const char *text,
 	char * st = new char[str.str().size()];
 	strcpy (st, str.str().c_str());
 
-	LinBox::commentator.start (st, "testRandomIterator");
+	commentator.start (st, "testRandomIterator");
 
-	std::ostream &report = LinBox::commentator.report (LinBox::Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION);
+	std::ostream &report = commentator.report (LinBox::Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION);
 
 	/* This test either passes or runs a lot of times */
-	for (int i = 1; 
+	for (int i = 1;
 	     (!  testRandomIteratorStep (F, text, num_trials, num_categories, hist_len)) && (i < 20) ;
 	     ++i ){
-		if (0 == i % 10)  
+		if (0 == i % 10)
 			report << "Warning! Probable failure of uniformity" << std::endl;
-		};
+	};
 
-	LinBox::commentator.stop (MSG_STATUS (true), (const char *) 0, "testRandomIterator");
+	commentator.stop (MSG_STATUS (true), (const char *) 0, "testRandomIterator");
 
 	delete[] st;
 	return true;
@@ -1121,17 +1233,17 @@ bool testRandomIterator (const Field &F, const char *text,
 
 template <class Field>
 bool testRandomIteratorStep (const Field &F,
-			 const char *text,
-			 unsigned int num_trials,
-			 unsigned int num_categories,
-			 unsigned int hist_len) 
+			     const char *text,
+			     unsigned int num_trials,
+			     unsigned int num_categories,
+			     unsigned int hist_len)
 {
 	//std::ostringstream str;
 
 	//str << "\t--Testing " << text << "::RandIter" << std::ends;
 
-	//LinBox::commentator.start (str.str ().c_str (), "testRandomIteratorStep");
-	std::ostream &report = LinBox::commentator.report (LinBox::Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION);
+	//commentator.start (str.str ().c_str (), "testRandomIteratorStep");
+	std::ostream &report = commentator.report (LinBox::Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION);
 
 	bool ret = true;
 
@@ -1156,10 +1268,10 @@ bool testRandomIteratorStep (const Field &F,
 	// C++ ints. Otherwise, I don't know how to place the numbers into
 	// categories in any well-defined manner.
 	for (i = 0; i < num_trials; ++i) {
-		integer ix, id;
+		LinBox::integer ix, id;
 		F.convert(ix, iter.random (x));
 
-   
+
 		categories1[ix % num_categories]++;
 		categories2[(unsigned int) (double (ix) / double (card) * num_categories)]++;
 
@@ -1186,10 +1298,10 @@ bool testRandomIteratorStep (const Field &F,
 	p = chiSquaredCDF (chi_squared * (double)num_categories / (double)num_trials, (double)num_categories - 1.0);
 
 	report << "Test of distribution uniformity (low-order): chi^2 = "
-	       << chi_squared * num_categories / num_trials << std::endl;
+								<< chi_squared * num_categories / num_trials << std::endl;
 	report << "Test of distribution uniformity (low-order):     p = " << p << std::endl;
 
-	if (p < 0.05 || p > 0.95) 
+	if (p < 0.05 || p > 0.95)
 		reportError("Random iterator's values do not appear to be uniformly distributed", ret);
 
 	chi_squared = 0.0;
@@ -1201,10 +1313,10 @@ bool testRandomIteratorStep (const Field &F,
 	p = chiSquaredCDF (chi_squared * num_categories / num_trials, num_categories - 1);
 
 	report << "Test of distribution uniformity (high-order): chi^2 = "
-	       << chi_squared * num_categories / num_trials << std::endl;
+								 << chi_squared * num_categories / num_trials << std::endl;
 	report << "Test of distribution uniformity (high-order):     p = " << p << std::endl;
 
-	if (p < 0.05 || p > 0.95) 
+	if (p < 0.05 || p > 0.95)
 		reportError("Consistency failure for addition", ret);
 
 	diff_cat_iter = diff_categories.begin ();
@@ -1221,15 +1333,15 @@ bool testRandomIteratorStep (const Field &F,
 		p = chiSquaredCDF (chi_squared * num_categories / num_trials, num_categories - 1);
 
 		report << "Test of " << idx + 1 << " spacing: chi^2 = "
-		       << chi_squared * num_categories / num_trials << std::endl;
+		<< chi_squared * num_categories / num_trials << std::endl;
 		report << "Test of " << idx + 1 << " spacing:     p = " << p << std::endl;
 
-		if (p < 0.05 || p > 0.95) 
+		if (p < 0.05 || p > 0.95)
 			reportError("Difference values do not appear to be uniformly distributed", ret);
 	}
 
-	//LinBox::commentator.stop (MSG_STATUS (ret), (const char *) 0, "testRandomIteratorStep");
+	//commentator.stop (MSG_STATUS (ret), (const char *) 0, "testRandomIteratorStep");
 	return ret;
 }
 //@}
-#endif // __TEST_FIELD_H
+#endif // __LINBOX_test_field_H
diff --git a/tests/test-frobenius.C b/tests/test-frobenius.C
index aafdecb..844a64d 100644
--- a/tests/test-frobenius.C
+++ b/tests/test-frobenius.C
@@ -1,11 +1,19 @@
-/* -*- mode: C++; tab-width: 2; indent-tabs-mode: t; c-basic-offset: 2 -*- */
-
+/* -*- 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
 /* tests/test-direct-sum.C
+ * Copyright (C) LinBox
  * Written by Austin Lobo, David Saunders
  *
  * See COPYING for license information.
  */
 
+/*! @file  tests/test-frobenius.C
+ * @ingroup tests
+ * @brief no doc.
+ * @test NO DOC
+ */
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -23,52 +31,52 @@ using namespace LinBox;
 
 int main (int argc, char **argv)
 {
-  bool pass = true;
-  
-  static size_t n = 10;
-  static integer q = 101;
-  static int iterations1 = 100;
-  static int iterations2 = 1;
-  
-  static Argument args[] = {
-    { 'n', "-n N", "Set dimension of test matrices to NxN.", TYPE_INT,     &n },
-    { 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
-    { 'i', "-i I", "Perform each test for I iterations.",   TYPE_INT,     &iterations1 },
-    { 'j', "-j J", "Apply test matrix to J vectors.",         TYPE_INT,     &iterations2 },
-	{ '\0' }
-  };
-  
-  typedef Modular<uint32> Field;
-  typedef vector<Field::Element> Vector;
-  typedef Vector Polynomial;
-  typedef vector<Polynomial> Plist;
-  
-  parseArguments (argc, argv, args);
-  Field F (q);
-  Plist plist(3);
-  
-  Field::RandIter r(F);
-  
-  size_t  pdeg = 10;
-  plist[0].resize(pdeg+1);
-  for ( size_t ideg=0; ideg < pdeg; ++ideg) r.random(plist[0][ideg]);
-  F.init(plist[0][pdeg],1);
-
-  pdeg = 6;
-  plist[1].resize(pdeg+1);
-  for ( size_t ideg=0; ideg < pdeg; ++ideg) r.random(plist[1][ideg]);
-  F.init(plist[1][pdeg],1);
-
-  pdeg = 4;
-  plist[2].resize(pdeg+1);
-  for ( size_t ideg=0; ideg < pdeg; ++ideg) r.random(plist[2][ideg]);
-  F.init(plist[2][pdeg],1);
+	bool pass = true;
+
+	static size_t n = 10;
+	static integer q = 101;
+	static int iterations1 = 100;
+	static int iterations2 = 1;
+
+	static Argument args[] = {
+		{ 'n', "-n N", "Set dimension of test matrices to NxN.", TYPE_INT,     &n },
+		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
+		{ 'i', "-i I", "Perform each test for I iterations.",   TYPE_INT,     &iterations1 },
+		{ 'j', "-j J", "Apply test matrix to J vectors.",         TYPE_INT,     &iterations2 },
+		END_OF_ARGUMENTS
+	};
+
+	typedef Modular<uint32_t> Field;
+	typedef vector<Field::Element> Vector;
+	typedef Vector Polynomial;
+	typedef vector<Polynomial> Plist;
+
+	parseArguments (argc, argv, args);
+	Field F (q);
+	Plist plist(3);
+
+	Field::RandIter r(F);
+
+	size_t  pdeg = 10;
+	plist[0].resize(pdeg+1);
+	for ( size_t ideg=0; ideg < pdeg; ++ideg) r.random(plist[0][ideg]);
+	F.init(plist[0][pdeg],1);
+
+	pdeg = 6;
+	plist[1].resize(pdeg+1);
+	for ( size_t ideg=0; ideg < pdeg; ++ideg) r.random(plist[1][ideg]);
+	F.init(plist[1][pdeg],1);
+
+	pdeg = 4;
+	plist[2].resize(pdeg+1);
+	for ( size_t ideg=0; ideg < pdeg; ++ideg) r.random(plist[2][ideg]);
+	F.init(plist[2][pdeg],1);
 
 	commentator.start("Frobenius form black box test suite", "frobenius");
-  Frobenius<Field>  A(F, plist.begin(), plist.end());
+	Frobenius<Field>  A(F, plist.begin(), plist.end());
+
+	pass = pass && testBlackbox(A);
 
-  pass = pass && testBlackbox(A);
-  
 	commentator.stop("Frobenius form black box test suite");
-  return pass ? 0 : -1;
+	return pass ? 0 : -1;
 }
diff --git a/tests/test-ftrmm.C b/tests/test-ftrmm.C
new file mode 100644
index 0000000..f4304f6
--- /dev/null
+++ b/tests/test-ftrmm.C
@@ -0,0 +1,943 @@
+/* -*- 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
+/* fflas/test-ftrmm.inl
+ * Copyright (C) 2010 LinBox
+ *
+ * Written by Brice Boyer <Brice.Boyer at imag.fr>
+ *
+ * See COPYING for license information.
+ */
+
+
+/*! @file  tests/test-ftrmm.C
+ * @ingroup tests
+ * @brief  tests all variants of applyP, ftrmm, ftrsm and fgemm for varions m,k,n and leading dimensions combinations.
+ * @bug ftrmm fails on non-double transposed versions.
+ * @bug is fgemm correct on null A and B ?
+ * @test FFLAS::ftrmm, FFPACK::applyP, FFLAS::ftrsm, FFLAS::fgemm
+ */
+
+
+
+//#define DEBUG
+
+#include <cassert>
+#include "linbox/linbox-config.h"
+#include "fflas-ffpack/fflas/fflas.h"
+#include "fflas-ffpack/ffpack/ffpack.h"
+#include "linbox/integer.h" // for fflas on integers...
+
+//!@todo !
+//#define __LINBOX_HAVE_INT64
+
+#include "linbox/field/modular-balanced-int32.h"
+#include "linbox/field/modular-int32.h"
+#ifdef __LINBOX_HAVE_INT64
+#include "linbox/field/modular-balanced-int64.h"
+#endif
+#include "linbox/field/modular-balanced-double.h"
+#include "linbox/field/modular-double.h"
+#include "linbox/field/modular-balanced-float.h"
+#include "linbox/field/modular-float.h"
+#include "fflas-ffpack/utils/Matio.h"
+#include "test-common.h"
+
+//#define _LB_TIME
+#define _LB_MAX_SZ 50
+#define _LB_ITERS 3
+//#define _LB_DEBUG
+
+
+using namespace LinBox ;
+
+template<class Field, FFLAS::FFLAS_SIDE Side,FFLAS::FFLAS_UPLO UpLo, FFLAS::FFLAS_TRANSPOSE Trans, FFLAS::FFLAS_DIAG Diag >
+int test_ftrmm(std::ostream & report, const Field & F)
+{
+	linbox_check(_LB_MAX_SZ>3);
+	size_t M    = random()%(_LB_MAX_SZ/2) ;
+	size_t N    = random()%(_LB_MAX_SZ/2) ; // B is £MxN£ in a £ldb x rows£ table
+	size_t ldb  = random()%_LB_MAX_SZ ;
+	size_t lda  = random()%_LB_MAX_SZ ;
+	size_t K    ;                           // A is £KxK£
+	while (ldb<N) ldb = random()%_LB_MAX_SZ; // £ldb >= N£
+	if (Side == FFLAS::FflasRight){
+		K = N ;
+	}
+	else {
+		K = M ;
+	}
+	while (lda<K) lda = random()%_LB_MAX_SZ; // £ldba>= N£
+
+	assert(N    <= ldb);
+	assert(K    <= lda);
+
+	size_t rows = std::max(N,M)+3; // number of rows in A and B as a big table. (it is still M or N as a matrix)
+
+#ifdef _LB_DEBUG
+	report << "#M x N :"<< M << 'x' << N << std::endl;
+	report << "#lda x ldb :"<< lda << 'x' << ldb << std::endl;
+#endif
+	assert(rows >= M);
+
+	typedef typename Field::Element Element;
+
+	Element * A = new Element[rows*lda];
+	assert(A);
+	Element * B = new Element[rows*ldb];
+	assert(B);
+	Element * C = new Element[M*N] ; // le résultat, le vrai, le bon.
+	assert(C);
+	Element * D = new Element[rows*ldb] ; // backup de B
+	assert(D);
+
+	typedef typename Field::RandIter RandIter;
+	report << '#' ;
+	RandIter G(F);
+	NonzeroRandIter<Field> Gn(F,G);
+
+	/* init A,B,C and more...*/
+	for (size_t i = 0 ; i < rows*lda ; ++i) G.random( *(A+i) ) ;
+#ifdef _LB_DEBUG
+	Element * E = new Element[rows*lda]; // copy of A
+	assert(E);
+	FFLAS::fcopy(F,rows*lda,E,1,A,1);
+	// for (size_t i = 0 ; i < rows*lda ; ++i) *(E+i) = *(A+i);
+#endif
+
+	for (size_t i = 0 ; i < rows*ldb  ; ++i) G.random( *(B+i) ) ;
+
+	Element zero ; F.init(zero,0UL);
+	for (size_t i = 0 ; i < M*N ; ++i) *(C+i) = zero;
+	// for (size_t i = 0 ; i < rows*ldb ; ++i) *(D+i) = *(B+i);
+	FFLAS::fcopy(F,rows*ldb,D,1,B,1);
+	Element alpha ;
+	//! @todo F.isInvertible()
+	//! @todo InvertibleRandomIter
+	Element invalpha ;
+	F.init(invalpha,0UL);
+	Gn.random(alpha);
+	// F.init(alpha,1UL);
+	F.inv(invalpha,alpha);
+
+	/* *************** */
+	/*  testing ftrmm  */
+	/* *************** */
+	report << "# testing ftrmm A = (" << alpha << ") " << ((Side == FFLAS::FflasLeft)?(""):("A")) ;
+	report << ((UpLo==FFLAS::FflasUpper)?(" U"):(" L")) ;
+	report << ((Trans==FFLAS::FflasTrans)?(""):("^t")) ;
+	report << ((Side == FFLAS::FflasLeft)?("A"):("")) ;
+	report << " on field \""  ;
+	F.write(report) ;
+	report << "\" "<< ((Diag==FFLAS::FflasUnit)?("and the diagonal is unit"):("")) << std::endl;
+
+
+	/*  compute C pedestrially :) */
+	if (Side == FFLAS::FflasRight) // right
+	{
+		if (UpLo == FFLAS::FflasLower)
+			if (Trans == FFLAS::FflasNoTrans) // C = M * L
+				for (size_t i = 0 ; i < M ; ++i)
+					for (size_t j = 0 ; j < N ; ++j)
+						for (size_t k = j+1 ; k < N ; ++k)
+							F.axpyin(*(C+i*N+j),*(B+i*ldb+k),*(A+k*lda+j));
+			else // C = M * L^t
+				for (size_t i = 0 ; i < M ; ++i)
+					for (size_t j = 0 ; j < N ; ++j)
+						for (size_t k = 0 ;  k < j ; ++k)
+							F.axpyin(*(C+i*N+j),*(B+i*ldb+k),*(A+j*lda+k));
+		else
+			if (Trans == FFLAS::FflasNoTrans) // C = M * U
+				for (size_t i = 0 ; i < M ; ++i)
+					for (size_t j = 0 ; j < N ; ++j)
+						for (size_t k = 0 ; k < j ; ++k)
+							F.axpyin(*(C+i*N+j),*(B+i*ldb+k),*(A+k*lda+j));
+			else // C = M * U^t
+				for (size_t i = 0 ; i < M ; ++i)
+					for (size_t j = 0 ; j < N ; ++j)
+						for (size_t k = j+1 ; k < N ; ++k)
+							F.axpyin(*(C+i*N+j),*(B+i*ldb+k),*(A+j*lda+k));
+	}
+	else // left
+	{
+		if (UpLo == FFLAS::FflasLower)
+			if (Trans == FFLAS::FflasNoTrans) // C = L*M
+				for (size_t i = 0 ; i < M ; ++i)
+					for (size_t j = 0 ; j < N ; ++j)
+						for (size_t k = 0 ; k < i ; ++k)
+							F.axpyin(*(C+i*N+j),*(A+i*lda+k),*(B+k*ldb+j));
+			else // C = L^t * M
+				for (size_t i = 0 ; i < M ; ++i)
+					for (size_t j = 0 ; j < N ; ++j)
+						for (size_t k = i+1 ; k < M ; ++k)
+							F.axpyin(*(C+i*N+j),*(A+k*lda+i),*(B+k*ldb+j));
+		else
+			if (Trans == FFLAS::FflasNoTrans) // C = U * M
+				for (size_t i = 0 ; i < M ; ++i)
+					for (size_t j = 0 ; j < N ; ++j)
+						for (size_t k = i+1 ; k < M ; ++k)
+							F.axpyin(*(C+i*N+j),*(A+i*lda+k),*(B+k*ldb+j));
+			else // C = U^t M
+				for (size_t i = 0 ; i < M ; ++i)
+					for (size_t j = 0 ; j < N ; ++j)
+						for (size_t k = 0 ; k < i ; ++k)
+							F.axpyin(*(C+i*N+j),*(A+k*lda+i),*(B+k*ldb+j));
+	}
+
+	if (Diag == FFLAS::FflasUnit) // unit
+		if (Side == FFLAS::FflasRight) // right
+		{
+			if (UpLo == FFLAS::FflasLower)
+				if (Trans == FFLAS::FflasNoTrans) // C = M * L
+					for (size_t i = 0 ; i < M ; ++i)
+						for (size_t j = 0 ; j < N ; ++j)
+							F.addin(*(C+i*N+j),*(B+i*ldb+j));
+				else // C = M * L^t
+					for (size_t i = 0 ; i < M ; ++i)
+						for (size_t j = 0 ; j < N ; ++j)
+							F.addin(*(C+i*N+j),*(B+i*ldb+j));
+			else
+				if (Trans == FFLAS::FflasNoTrans) // C = M * U
+					for (size_t i = 0 ; i < M ; ++i)
+						for (size_t j = 0 ; j < N ; ++j)
+							F.addin(*(C+i*N+j),*(B+i*ldb+j));
+				else // C = M * U^t
+					for (size_t i = 0 ; i < M ; ++i)
+						for (size_t j = 0 ; j < N ; ++j)
+							F.addin(*(C+i*N+j),*(B+i*ldb+j));
+		}
+		else // left
+		{
+			if (UpLo == FFLAS::FflasLower)
+				if (Trans == FFLAS::FflasNoTrans) // C = L*M
+					for (size_t i = 0 ; i < M ; ++i)
+						for (size_t j = 0 ; j < N ; ++j)
+							F.addin(*(C+i*N+j),*(B+i*ldb+j));
+				else // C = L^t * M
+					for (size_t i = 0 ; i < M ; ++i)
+						for (size_t j = 0 ; j < N ; ++j)
+							F.addin(*(C+i*N+j),*(B+i*ldb+j));
+			else
+				if (Trans == FFLAS::FflasNoTrans) // C = U * M
+					for (size_t i = 0 ; i < M ; ++i)
+						for (size_t j = 0 ; j < N ; ++j)
+							F.addin(*(C+i*N+j),*(B+i*ldb+j));
+				else // C = U^T M
+					for (size_t i = 0 ; i < M ; ++i)
+						for (size_t j = 0 ; j < N ; ++j)
+							F.addin(*(C+i*N+j),*(B+i*ldb+j));
+		}
+	else // non unit
+		if (Side == FFLAS::FflasRight) // right
+		{
+			if (UpLo == FFLAS::FflasLower)
+				if (Trans == FFLAS::FflasNoTrans) // C = M * L
+					for (size_t i = 0 ; i < M ; ++i)
+						for (size_t j = 0 ; j < N ; ++j)
+							F.axpyin(*(C+i*N+j),*(B+i*ldb+j),*(A+j*lda+j));
+				else // C = M * L^t
+					for (size_t i = 0 ; i < M ; ++i)
+						for (size_t j = 0 ; j < N ; ++j)
+							F.axpyin(*(C+i*N+j),*(B+i*ldb+j),*(A+j*lda+j));
+			else
+				if (Trans == FFLAS::FflasNoTrans) // C = M * U
+					for (size_t i = 0 ; i < M ; ++i)
+						for (size_t j = 0 ; j < N ; ++j)
+							F.axpyin(*(C+i*N+j),*(B+i*ldb+j),*(A+j*lda+j));
+				else // C = M * U^t
+					for (size_t i = 0 ; i < M ; ++i)
+						for (size_t j = 0 ; j < N ; ++j)
+							F.axpyin(*(C+i*N+j),*(B+i*ldb+j),*(A+j*lda+j));
+		}
+		else // left
+		{
+			if (UpLo == FFLAS::FflasLower)
+				if (Trans == FFLAS::FflasNoTrans) // C = L*M
+					for (size_t i = 0 ; i < M ; ++i)
+						for (size_t j = 0 ; j < N ; ++j)
+							F.axpyin(*(C+i*N+j),*(A+i*lda+i),*(B+i*ldb+j));
+				else // C = L^t * M
+					for (size_t i = 0 ; i < M ; ++i)
+						for (size_t j = 0 ; j < N ; ++j)
+							F.axpyin(*(C+i*N+j),*(A+i*lda+i),*(B+i*ldb+j));
+			else
+				if (Trans == FFLAS::FflasNoTrans) // C = U * M
+					for (size_t i = 0 ; i < M ; ++i)
+						for (size_t j = 0 ; j < N ; ++j)
+							F.axpyin(*(C+i*N+j),*(A+i*lda+i),*(B+i*ldb+j));
+				else // C = M * U^t
+					for (size_t i = 0 ; i < M ; ++i)
+						for (size_t j = 0 ; j < N ; ++j)
+							F.axpyin(*(C+i*N+j),*(A+i*lda+i),*(B+i*ldb+j));
+		}
+
+	for (size_t i = 0 ; i < M*N ; ++i)
+		F.mulin(*(C+i),alpha);
+
+	/*  compute B with ftrmm */
+	FFLAS::ftrmm(F,Side,UpLo,Trans,Diag,M,N,alpha,A,lda,B,ldb);
+
+	/*  checking C==B */
+	int err = 0 ;
+	for (size_t i = 0 ; i < M && !err ; ++i)
+		for (size_t j = 0 ; j < N && !err ; ++j)
+			if (!F.areEqual(*(C+i*N+j),*(B+i*ldb+j)))
+				err = -1  ;
+	if (err)
+		report << "# *** error *** ftrmm fails" << std::endl;
+	else {
+	// checking B has nothing written outside B...
+	for (size_t i = M ; i < rows && !err ; ++i)
+		for (size_t j = N ; j < ldb  && !err ; ++j)
+			if (!F.areEqual(*(D+i*ldb+j),*(B+i*ldb+j)))
+				err = -1  ;
+	if (err)
+		report << "# *** error *** ftrmm writes outside : failure." << std::endl;
+
+	}
+#ifdef _LB_DEBUG
+	{
+		if (err)
+		{
+			report<<"#-------------T-------------" <<std::endl;
+			report << "T :=" ;
+			write_field(F,report,UpLo,Diag,E,rows,lda,lda,true);
+			report << ':' << std::endl;
+			report<<"#------------TT--------------" <<std::endl;
+			report << "TT := " ; write_field(F,report,E,rows,lda,lda,true);
+			report << ':' << std::endl;
+
+			report<<"#-------------M-------------" <<std::endl;
+			report << "M :=" ;
+			write_field(F,report,D,M,N,ldb,true);
+			report << ':' << std::endl;
+			report<<"#------------a--------------" <<std::endl;
+			report << "alpha := " << alpha << ':' << std::endl;
+			report<<"#------------C--------------" <<std::endl;
+			report << "C := " ; write_field(F,report,C,M,N,N,true);
+			report << ':' << std::endl;
+			report << "#------------B--------------" << std::endl;
+			report << "B := " ; write_field(F,report,B,M,N,ldb,true);
+			report << ':' << std::endl;
+			report << "N := alpha * " ;
+			if (Side == FFLAS::FflasRight)
+				report << "M." ;
+			else
+				if (Trans == FFLAS::FflasNoTrans)
+					report << "T." ;
+				else
+					report << "LinearAlgebra:-Transpose(T)." ;
+			if (Side == FFLAS::FflasLeft)
+				report << "M" ;
+			else
+				if (Trans == FFLAS::FflasNoTrans)
+					report << "T" ;
+				else
+					report << "LinearAlgebra:-Transpose(T)" ;
+			report << "  mod " << F.characteristic() << ':' << std::endl;
+			report << "linalg:-iszero(C - N  mod " << F.characteristic() << "),";
+			report << "linalg:-iszero(B - N  mod " << F.characteristic() << ");"  <<  std::endl;
+
+		}
+
+		}
+#endif
+	if (err)
+		report << "# \033[1;31m>\033[0m ftrmm fail" ;
+	else
+		report << "# \033[1;32m>\033[0m ftrmm success";
+	report << std::endl;
+
+
+	/* *************** */
+	/*  testing ftrsm  */
+	/* *************** */
+	report << "# testing ftrsm A = (" << alpha << ") " << ((Side == FFLAS::FflasLeft)?(""):("A")) ;
+	report << ((UpLo==FFLAS::FflasUpper)?(" U^(-1)"):(" L^(-1)")) ;
+	report << ((Trans==FFLAS::FflasTrans)?(""):("^t")) ;
+	report << ((Side == FFLAS::FflasLeft)?("A"):("")) ;
+	report << " on field \""  ;
+	F.write(report) ;
+	report << "\" "<< ((Diag==FFLAS::FflasUnit)?("and the diagonal is unit"):("")) << std::endl;
+
+	int eur = 0 ;
+
+	// for (size_t i = 0 ; i < rows*ldb ; ++i) *(B+i) = *(D+i);
+	FFLAS::fcopy(F,rows*ldb,B,1,D,1);
+	if (Diag == FFLAS::FflasNonUnit)
+		for (size_t i = 0 ; i < K ; ++i) Gn.random(*(A+i*(lda+1))) ; // invertible diag !
+	FFLAS::ftrmm(F, Side, UpLo, Trans, Diag, M, N, alpha,    A, lda, B, ldb);
+	/* revert with ftrsm  */
+	FFLAS::ftrsm(F, Side, UpLo, Trans, Diag, M, N, invalpha, A, lda, B, ldb);
+	//! @todo check ftrsm fails nicely with non invertible A !
+
+	for (size_t i = 0 ; i < rows && !eur ; ++i)
+		for (size_t j = 0 ; j < ldb && !eur ; ++j)
+			if (!F.areEqual(*(D+i*ldb+j),*(B+i*ldb+j)))
+				eur = -1  ;
+
+#ifdef _LB_DEBUG
+	{
+		delete[] E ;
+	}
+#endif
+	if (eur)
+		report << "# \033[1;31m>\033[0m ftrsm fail" ;
+	else
+		report << "# \033[1;32m>\033[0m ftrsm success";
+	report << std::endl;
+
+
+	delete[] A;
+	delete[] B;
+	delete[] C;
+	delete[] D;
+
+	return err+eur ;
+}
+
+//!@todo  test \c NULL permutation
+template<class Field>
+int test_applyP(std::ostream & report, const Field & F)
+{
+	size_t M    = random()%_LB_MAX_SZ+1 ;
+	size_t N    = random()%_LB_MAX_SZ+1 ;
+	size_t lda  = random()%_LB_MAX_SZ+1 ;
+	if (lda<N) std::swap(lda,N);
+
+#ifdef _LB_DEBUG
+	report << "#M x N :"<< M << 'x' << N << std::endl;
+	report << "#lda :"<< lda << std::endl;
+#endif
+	typedef typename Field::Element Element;
+
+	Element * A = new Element[M*lda];
+	assert(A);
+	Element * B = new Element[M*lda];
+	assert(B);
+
+	typedef typename Field::RandIter RandIter;
+	report << '#' ;
+	RandIter G(F);
+	NonzeroRandIter<Field> Gn(F,G);
+
+	/* init A,B,C and more...*/
+	for (size_t i = 0 ; i < M*lda ; ++i) G.random( *(A+i) ) ;
+	for (size_t i = 0 ; i < M*lda ; ++i)  *(B+i) = *(A+i) ;
+
+	report << "# testing row applyP" << std::endl;
+	size_t * P = new size_t[M] ;
+
+	size_t r = random()%M ;
+	for (size_t i = 0 ; i < r ; ++i){
+		P[i] = i + (size_t)(M-i)*( (std::max(0.,drand48()-1e-6)) ); // histoire de pas tomber sur 1...
+		//                if (P[i] == M) P[i]-- ;
+		assert(P[i] < M);
+	}
+
+	FFPACK::applyP(F,FFLAS::FflasLeft,FFLAS::FflasNoTrans,
+		       N, 0,r,
+		       A,lda,P);
+
+	FFPACK::applyP(F,FFLAS::FflasLeft,FFLAS::FflasTrans,
+		       N, 0,r,
+		       A,lda,P);
+	delete[] P ;
+	int err = 0 ;
+	for (size_t i = 0 ; i < M && !err ; ++i)
+		for (size_t j = 0 ; j < N && !err ; ++j)
+			if (!F.areEqual(*(A+i*lda+j),*(B+i*lda+j)))
+				err = -1  ;
+	if (err)
+		report << "# \033[1;31m>\033[0m row applyP failed" << std::endl;
+	else
+		report << "# \033[1;32m>\033[0m row applyP success" << std::endl;
+
+	report << "# testing col applyP" << std::endl;
+	size_t * Q = new size_t[N] ;
+
+	r = random()%N ;
+	for (size_t i = 0 ; i < r ; ++i){
+		Q[i] = i + (size_t)(N-i)*( std::max(0.,drand48()-1e-6)) ;
+		//                if (Q[i] == N) P[i]-- ;
+		assert(Q[i] < N);
+	}
+
+	FFPACK::applyP(F,FFLAS::FflasRight,FFLAS::FflasNoTrans,
+		       M, 0,r,
+		       A,lda,Q);
+
+	FFPACK::applyP(F,FFLAS::FflasRight,FFLAS::FflasTrans,
+		       M, 0,r,
+		       A,lda,Q);
+	delete[] Q ;
+
+	int eur = 0 ;
+	for (size_t i = 0 ; i < M && !eur ; ++i)
+		for (size_t j = 0 ; j < N && !eur ; ++j)
+			if (!F.areEqual(*(A+i*lda+j),*(B+i*lda+j)))
+				err = -1  ;
+	if (eur)
+		report << "# \033[1;31m>\033[0mcol applyP failed" << std::endl;
+	else
+		report << "# \033[1;32m>\033[0mcol applyP success" << std::endl;
+
+	delete[] A;
+	delete[] B ;
+	return (err+eur);
+
+}
+
+template<class Field, FFLAS::FFLAS_TRANSPOSE ATRANS, FFLAS::FFLAS_TRANSPOSE BTRANS>
+int test_fgemm(std::ostream & report, const Field & F)
+{
+	size_t M    = random()%_LB_MAX_SZ+1 ; // rows of (t)A and C
+	size_t N    = random()%_LB_MAX_SZ+1 ; // cols of (t)B and C
+	size_t K    = random()%_LB_MAX_SZ+1 ; // cols of (t)A, rows of (t)B
+
+	//!@bug if beta != 0 but A and B are 0 (or don't exist) then C != beta C
+
+	size_t lda  = random()%(_LB_MAX_SZ/2) ;
+	if (ATRANS == FFLAS::FflasTrans) lda += M ; else lda += K ;
+	size_t ldb  = random()%(_LB_MAX_SZ/2) ;
+	if (BTRANS == FFLAS::FflasTrans) ldb += K ; else ldb += N ;
+	size_t ldc  = N+random()%(_LB_MAX_SZ/2) ;
+
+	size_t rowA = 5;
+	if (ATRANS == FFLAS::FflasTrans) rowA += K ; else rowA += M ;
+	size_t rowB = 5;
+	if (BTRANS == FFLAS::FflasTrans) rowB += N ; else rowB += K ;
+	size_t rowC = M+5;
+
+
+	// A is M x K
+#ifdef _LB_DEBUG
+	report <<"# A : " << M << 'x' << K << " ("<< rowA << 'x' << lda << ')' << std::endl;
+	report <<"# B : " << K << 'x' << N << " ("<< rowB << 'x' << ldb << ')' << std::endl;
+	report <<"# C : " << M << 'x' << N << " ("<< rowC << 'x' << ldc << ')' << std::endl;
+#endif
+
+	typedef typename Field::RandIter RandIter;
+	report << "#" ;
+	RandIter G(F);
+	NonzeroRandIter<Field> Gn(F,G);
+	typedef typename Field::Element Element;
+
+	Element alpha, beta ;
+	// G.random(alpha);
+	// G.random(beta);
+	alpha = Integer::random<false>(2);
+	if (abs(alpha) > 1.5 ) G.random(alpha);
+	//!@bug needs p prime.
+	beta  = Integer::random<false>(2);
+	if (abs(beta) >1.5 ) G.random(beta);
+	report << "#testing fgemm C = (" << alpha << ") A" << ((ATRANS==FFLAS::FflasTrans)?("^T"):("")) << ".B"  << ((BTRANS==FFLAS::FflasTrans)?("^T"):("")) << "+ (" << beta << ") C on " ; F.write(report) << std::endl;
+
+	F.init(alpha,alpha);
+	F.init(beta,beta);
+
+
+	Element * A = new Element[rowA*lda];
+	assert(A);
+	Element * B = new Element[rowB*ldb];
+	assert(B);
+	Element * C = new Element[rowC*ldc] ; // le résultat, le vrai, le bon.
+	assert(C);
+	Element * D = new Element[rowC*ldc] ; // backup de C
+	assert(D);
+
+	for (size_t i = 0 ; i < rowA*lda ; ++i) G.random( *(A+i) ) ;
+	for (size_t i = 0 ; i < rowB*ldb ; ++i) G.random( *(B+i) ) ;
+	for (size_t i = 0 ; i < rowC*ldc ; ++i) G.random( *(C+i) ) ;
+	for (size_t i = 0 ; i < rowC*ldc ; ++i) *(D+i) = *(C+i)  ;
+
+	if (ATRANS == FFLAS::FflasNoTrans)
+		if (BTRANS == FFLAS::FflasNoTrans) // A.B + C
+			for (size_t i = 0 ; i < M ; ++i)
+				for (size_t j = 0 ; j < N ; ++j) {
+					Element temp;
+					F.init(temp,0UL);
+					for (size_t k = 0 ; k < K ; ++k)
+						F.axpyin(temp,A[i*lda+k],B[k*ldb+j]);
+					F.mulin(C[i*ldc+j],beta);
+					F.axpyin(C[i*ldc+j],alpha,temp);
+				}
+		else // A.tB + C
+			for (size_t i = 0 ; i < M ; ++i)
+				for (size_t j = 0 ; j < N ; ++j) {
+					Element temp;
+					F.init(temp,0UL);
+					for (size_t k = 0 ; k < K ; ++k)
+						F.axpyin(temp,A[i*lda+k],B[j*ldb+k]);
+					F.mulin(C[i*ldc+j],beta);
+					F.axpyin(C[i*ldc+j],alpha,temp);
+				}
+	else
+		if (BTRANS == FFLAS::FflasNoTrans) // tA.B + C
+			for (size_t i = 0 ; i < M ; ++i)
+				for (size_t j = 0 ; j < N ; ++j) {
+					Element temp;
+					F.init(temp,0UL);
+					for (size_t k = 0 ; k < K ; ++k)
+						F.axpyin(temp,A[k*lda+i],B[k*ldb+j]);
+					F.mulin(C[i*ldc+j],beta);
+					F.axpyin(C[i*ldc+j],alpha,temp);
+				}
+		else // tA.tB + C
+			for (size_t i = 0 ; i < M ; ++i)
+				for (size_t j = 0 ; j < N ; ++j) {
+					Element temp;
+					F.init(temp,0UL);
+					for (size_t k = 0 ; k < K ; ++k)
+						F.axpyin(temp,A[k*lda+i],B[j*ldb+k]);
+					F.mulin(C[i*ldc+j],beta);
+					F.axpyin(C[i*ldc+j],alpha,temp);
+				}
+
+	FFLAS::fgemm(F,ATRANS,BTRANS,M,N,K,alpha,A,lda,B,ldb,beta,D,ldc);
+
+	int err = 0 ;
+	for (size_t i = 0 ; i < rowC && !err ; ++i)
+		for (size_t j = 0 ; j < ldc && !err ; ++j)
+			if (!F.areEqual(*(C+i*ldc+j),*(D+i*ldc+j)))
+				err = -1  ;
+
+	delete[] A ;
+	delete[] B ;
+	delete[] C ;
+	delete[] D ;
+
+	if (err) {
+		report << "# \033[1;31m>\033[0mfgemm failed  " << std::endl;
+	}
+	else{
+		report << "# \033[1;32m>\033[0mfgemm success " << std::endl;
+	}
+
+	return err ;
+}
+
+int main(int ac, char ** av)
+{
+	//typedef ModularBalanced<float>  FieldF;
+	typedef Modular<float>          FieldF;
+	//typedef ModularBalanced<double> FieldD;
+	typedef Modular<double>         FieldD;
+	//typedef ModularBalanced<int32_t>  FieldI;
+	typedef Modular<int32_t>          FieldI;
+	//!@bug : this one completely fails :
+	//typedef Modular<Integer>          FieldI;
+
+       	static Argument as[] = {
+		END_OF_ARGUMENTS
+        };
+
+	parseArguments (ac, av, as);
+
+	srand(time(NULL));
+	bool fail = false ;
+
+	LinBox::commentator.start("ftrmm and consorts full test suite", "ftrmm et al");
+	std::ostream &report = LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT,
+							   INTERNAL_DESCRIPTION);
+
+
+	// need to be prime for ftrsm
+	FieldD FD(13);
+	FieldD FD2(65563);
+	FieldF FF(13);
+	FieldF FF2(1069);
+	FieldI FI(13);
+	FieldI FI2(106739);
+	int tot = 6;
+#ifdef __LINBOX_HAVE_INT64
+	//        typedef ModularBalanced<int64_t>  FieldU;
+	typedef Modular<int64_t>          FieldU;
+	FieldU FU(13);
+	FieldU FU2(13132153);
+	tot += 2 ;
+#endif
+	tot *=2*16*_LB_ITERS ; // ftr(s/m)m 16 combinations, repeated _LB_ITERS times
+	int ret = tot;
+	//-----------//
+	/* FTR(S/M)M */
+	//-----------//
+	for (size_t r = 0 ; r < _LB_ITERS ; ++r)
+	{
+		ret+=test_ftrmm<FieldD,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasUnit>(report,FD);
+		ret+=test_ftrmm<FieldD,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FD);
+		ret+=test_ftrmm<FieldD,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasUnit>(report,FD);
+		ret+=test_ftrmm<FieldD,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FD);
+
+		ret+=test_ftrmm<FieldD,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasUnit>(report,FD);
+		ret+=test_ftrmm<FieldD,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FD);
+		ret+=test_ftrmm<FieldD,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasUnit>(report,FD);
+		ret+=test_ftrmm<FieldD,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FD);
+
+		ret+=test_ftrmm<FieldD,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FD);
+		ret+=test_ftrmm<FieldD,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FD);
+		ret+=test_ftrmm<FieldD,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FD);
+		ret+=test_ftrmm<FieldD,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FD);
+
+		ret+=test_ftrmm<FieldD,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FD);
+		ret+=test_ftrmm<FieldD,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FD);
+		ret+=test_ftrmm<FieldD,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FD);
+		ret+=test_ftrmm<FieldD,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FD);
+
+		ret+=test_ftrmm<FieldD,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FD2);
+		ret+=test_ftrmm<FieldD,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FD2);
+		ret+=test_ftrmm<FieldD,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FD2);
+		ret+=test_ftrmm<FieldD,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FD);
+
+		ret+=test_ftrmm<FieldD,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FD2);
+		ret+=test_ftrmm<FieldD,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FD2);
+		ret+=test_ftrmm<FieldD,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FD2);
+		ret+=test_ftrmm<FieldD,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FD2);
+
+		ret+=test_ftrmm<FieldD,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FD2);
+		ret+=test_ftrmm<FieldD,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FD2);
+		ret+=test_ftrmm<FieldD,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FD2);
+		ret+=test_ftrmm<FieldD,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FD2);
+
+		ret+=test_ftrmm<FieldD,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FD2);
+		ret+=test_ftrmm<FieldD,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FD2);
+		ret+=test_ftrmm<FieldD,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FD2);
+		ret+=test_ftrmm<FieldD,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FD2);
+
+		ret+=test_ftrmm<FieldF,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FF);
+		ret+=test_ftrmm<FieldF,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FF);
+		ret+=test_ftrmm<FieldF,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FF);
+		ret+=test_ftrmm<FieldF,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FF);
+
+		ret+=test_ftrmm<FieldF,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FF);
+		ret+=test_ftrmm<FieldF,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FF);
+		ret+=test_ftrmm<FieldF,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FF);
+		ret+=test_ftrmm<FieldF,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FF);
+
+		ret+=test_ftrmm<FieldF,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FF);
+		ret+=test_ftrmm<FieldF,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FF);
+		ret+=test_ftrmm<FieldF,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FF);
+		ret+=test_ftrmm<FieldF,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FF);
+
+		ret+=test_ftrmm<FieldF,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FF);
+		ret+=test_ftrmm<FieldF,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FF);
+		ret+=test_ftrmm<FieldF,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FF);
+		ret+=test_ftrmm<FieldF,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FF);
+
+		ret+=test_ftrmm<FieldF,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FF2);
+		ret+=test_ftrmm<FieldF,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FF2);
+		ret+=test_ftrmm<FieldF,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FF2);
+		ret+=test_ftrmm<FieldF,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FF2);
+
+		ret+=test_ftrmm<FieldF,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FF2);
+		ret+=test_ftrmm<FieldF,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FF2);
+		ret+=test_ftrmm<FieldF,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FF2);
+		ret+=test_ftrmm<FieldF,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FF2);
+
+		ret+=test_ftrmm<FieldF,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FF2);
+		ret+=test_ftrmm<FieldF,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FF2);
+		ret+=test_ftrmm<FieldF,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FF2);
+		ret+=test_ftrmm<FieldF,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FF2);
+
+		ret+=test_ftrmm<FieldF,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FF2);
+		ret+=test_ftrmm<FieldF,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FF2);
+		ret+=test_ftrmm<FieldF,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FF2);
+		ret+=test_ftrmm<FieldF,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FF2);
+
+
+		ret+=test_ftrmm<FieldI,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FI);
+		ret+=test_ftrmm<FieldI,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FI);
+		ret+=test_ftrmm<FieldI,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FI);
+		ret+=test_ftrmm<FieldI,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FI);
+
+		ret+=test_ftrmm<FieldI,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FI);
+		ret+=test_ftrmm<FieldI,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FI);
+		ret+=test_ftrmm<FieldI,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FI);
+		ret+=test_ftrmm<FieldI,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FI);
+
+		ret+=test_ftrmm<FieldI,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FI);
+		ret+=test_ftrmm<FieldI,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FI);
+		ret+=test_ftrmm<FieldI,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FI);
+		ret+=test_ftrmm<FieldI,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FI);
+
+		ret+=test_ftrmm<FieldI,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FI);
+		ret+=test_ftrmm<FieldI,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FI);
+		ret+=test_ftrmm<FieldI,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FI);
+		ret+=test_ftrmm<FieldI,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FI);
+
+		ret+=test_ftrmm<FieldI,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FI2);
+		ret+=test_ftrmm<FieldI,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FI2);
+		ret+=test_ftrmm<FieldI,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FI2);
+		ret+=test_ftrmm<FieldI,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FI2);
+
+		ret+=test_ftrmm<FieldI,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FI2);
+		ret+=test_ftrmm<FieldI,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FI2);
+		ret+=test_ftrmm<FieldI,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FI2);
+		ret+=test_ftrmm<FieldI,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FI2);
+
+		ret+=test_ftrmm<FieldI,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FI2);
+		ret+=test_ftrmm<FieldI,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FI2);
+		ret+=test_ftrmm<FieldI,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FI2);
+		ret+=test_ftrmm<FieldI,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FI2);
+
+		ret+=test_ftrmm<FieldI,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FI2);
+		ret+=test_ftrmm<FieldI,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FI2);
+		ret+=test_ftrmm<FieldI,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FI2);
+		ret+=test_ftrmm<FieldI,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FI2);
+
+#ifdef __LINBOX_HAVE_INT64
+		ret+=test_ftrmm<FieldU,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FU);
+		ret+=test_ftrmm<FieldU,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FU);
+		ret+=test_ftrmm<FieldU,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FU);
+		ret+=test_ftrmm<FieldU,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FU);
+
+		ret+=test_ftrmm<FieldU,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FU);
+		ret+=test_ftrmm<FieldU,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FU);
+		ret+=test_ftrmm<FieldU,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FU);
+		ret+=test_ftrmm<FieldU,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FU);
+
+		ret+=test_ftrmm<FieldU,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FU);
+		ret+=test_ftrmm<FieldU,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FU);
+		ret+=test_ftrmm<FieldU,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FU);
+		ret+=test_ftrmm<FieldU,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FU);
+
+		ret+=test_ftrmm<FieldU,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FU);
+		ret+=test_ftrmm<FieldU,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FU);
+		ret+=test_ftrmm<FieldU,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FU);
+		ret+=test_ftrmm<FieldU,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FU);
+
+		ret+=test_ftrmm<FieldU,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FU2);
+		ret+=test_ftrmm<FieldU,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FU2);
+		ret+=test_ftrmm<FieldU,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FU2);
+		ret+=test_ftrmm<FieldU,FFLAS::FflasLeft,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FU2);
+
+		ret+=test_ftrmm<FieldU,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FU2);
+		ret+=test_ftrmm<FieldU,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FU2);
+		ret+=test_ftrmm<FieldU,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FU2);
+		ret+=test_ftrmm<FieldU,FFLAS::FflasLeft,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FU2);
+
+		ret+=test_ftrmm<FieldU,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FU2);
+		ret+=test_ftrmm<FieldU,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FU2);
+		ret+=test_ftrmm<FieldU,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FU2);
+		ret+=test_ftrmm<FieldU,FFLAS::FflasRight,FFLAS::FflasUpper,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FU2);
+
+		ret+=test_ftrmm<FieldU,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasUnit>   (report,FU2);
+		ret+=test_ftrmm<FieldU,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasTrans,  FFLAS::FflasNonUnit>(report,FU2);
+		ret+=test_ftrmm<FieldU,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasUnit>   (report,FU2);
+		ret+=test_ftrmm<FieldU,FFLAS::FflasRight,FFLAS::FflasLower,FFLAS::FflasNoTrans,FFLAS::FflasNonUnit>(report,FU2);
+#endif
+	}
+
+
+#ifdef DEBUG
+	report << "# \033[1;33m>\033[0m ftr(s/m)m  passed " << ret << "/" << tot << "tests" <<std::endl;
+#endif
+	if (ret != tot) fail=true;
+#ifdef DEBUG
+	if (fail)
+		report << "# \033[1;31m>\033[0m ftr(s/m)m failed" << std::endl;
+#endif
+	int our = tot = 6*_LB_ITERS*2 ;
+#ifdef __LINBOX_HAVE_INT64
+	our = tot = tot+2*_LB_ITERS*2 ;
+#endif
+
+	//-------//
+	/* APPLY */
+	//-------//
+	for (size_t r = 0 ; r < _LB_ITERS ; ++r)
+	{
+		our+= test_applyP(report,FD);
+		our+= test_applyP(report,FD2);
+		our+= test_applyP(report,FI);
+		our+= test_applyP(report,FI2);
+		our+= test_applyP(report,FF);
+		our+= test_applyP(report,FF2);
+#ifdef __LINBOX_HAVE_INT64
+		our+= test_applyP(report,FU);
+		our+= test_applyP(report,FU2);
+#endif
+
+	}
+#ifdef DEBUG
+	report << "# \033[1;33m>\033[0m applyP  passed " << our << "/" << tot << "tests" <<std::endl;
+#endif
+	if (our != tot) fail = true;
+#ifdef DEBUG
+	if (our != tot)
+		report << "# \033[1;31m>\033[0m applyP failed" << std::endl;
+#endif
+
+
+	our = tot = 4*_LB_ITERS*6 ;
+#ifdef __LINBOX_HAVE_INT64
+	our = tot = tot+4*_LB_ITERS*2 ;
+#endif
+
+	//-------//
+	/* FGEMM */
+	//-------//
+	for (size_t r = 0 ; r < _LB_ITERS ; ++r)
+	{
+		our+= test_fgemm<FieldD,FFLAS::FflasNoTrans, FFLAS::FflasNoTrans>(report,FD);
+		our+= test_fgemm<FieldD,FFLAS::FflasNoTrans, FFLAS::FflasTrans>  (report,FD);
+		our+= test_fgemm<FieldD,FFLAS::FflasTrans,   FFLAS::FflasNoTrans>(report,FD);
+		our+= test_fgemm<FieldD,FFLAS::FflasTrans,   FFLAS::FflasTrans>  (report,FD);
+
+		our+= test_fgemm<FieldD,FFLAS::FflasNoTrans, FFLAS::FflasNoTrans>(report,FD2);
+		our+= test_fgemm<FieldD,FFLAS::FflasNoTrans, FFLAS::FflasTrans>  (report,FD2);
+		our+= test_fgemm<FieldD,FFLAS::FflasTrans,   FFLAS::FflasNoTrans>(report,FD2);
+		our+= test_fgemm<FieldD,FFLAS::FflasTrans,   FFLAS::FflasTrans>  (report,FD2);
+
+		our+= test_fgemm<FieldI,FFLAS::FflasNoTrans, FFLAS::FflasNoTrans>(report,FI);
+		our+= test_fgemm<FieldI,FFLAS::FflasNoTrans, FFLAS::FflasTrans>  (report,FI);
+		our+= test_fgemm<FieldI,FFLAS::FflasTrans,   FFLAS::FflasNoTrans>(report,FI);
+		our+= test_fgemm<FieldI,FFLAS::FflasTrans,   FFLAS::FflasTrans>  (report,FI);
+
+		our+= test_fgemm<FieldI,FFLAS::FflasNoTrans, FFLAS::FflasNoTrans>(report,FI2);
+		our+= test_fgemm<FieldI,FFLAS::FflasNoTrans, FFLAS::FflasTrans>  (report,FI2);
+		our+= test_fgemm<FieldI,FFLAS::FflasTrans,   FFLAS::FflasNoTrans>(report,FI2);
+		our+= test_fgemm<FieldI,FFLAS::FflasTrans,   FFLAS::FflasTrans>  (report,FI2);
+
+		our+= test_fgemm<FieldF,FFLAS::FflasNoTrans, FFLAS::FflasNoTrans>(report,FF);
+		our+= test_fgemm<FieldF,FFLAS::FflasNoTrans, FFLAS::FflasTrans>  (report,FF);
+		our+= test_fgemm<FieldF,FFLAS::FflasTrans,   FFLAS::FflasNoTrans>(report,FF);
+		our+= test_fgemm<FieldF,FFLAS::FflasTrans,   FFLAS::FflasTrans>  (report,FF);
+
+		our+= test_fgemm<FieldF,FFLAS::FflasNoTrans, FFLAS::FflasNoTrans>(report,FF2);
+		our+= test_fgemm<FieldF,FFLAS::FflasNoTrans, FFLAS::FflasTrans>  (report,FF2);
+		our+= test_fgemm<FieldF,FFLAS::FflasTrans,   FFLAS::FflasNoTrans>(report,FF2);
+		our+= test_fgemm<FieldF,FFLAS::FflasTrans,   FFLAS::FflasTrans>  (report,FF2);
+
+#ifdef __LINBOX_HAVE_INT64
+		our+= test_fgemm<FieldU,FFLAS::FflasNoTrans, FFLAS::FflasNoTrans>(report,FU);
+		our+= test_fgemm<FieldU,FFLAS::FflasNoTrans, FFLAS::FflasTrans>  (report,FU);
+		our+= test_fgemm<FieldU,FFLAS::FflasTrans,   FFLAS::FflasNoTrans>(report,FU);
+		our+= test_fgemm<FieldU,FFLAS::FflasTrans,   FFLAS::FflasTrans>  (report,FU);
+
+		our+= test_fgemm<FieldU,FFLAS::FflasNoTrans, FFLAS::FflasNoTrans>(report,FU2);
+		our+= test_fgemm<FieldU,FFLAS::FflasNoTrans, FFLAS::FflasTrans>  (report,FU2);
+		our+= test_fgemm<FieldU,FFLAS::FflasTrans,   FFLAS::FflasNoTrans>(report,FU2);
+		our+= test_fgemm<FieldU,FFLAS::FflasTrans,   FFLAS::FflasTrans>  (report,FU2);
+#endif
+
+	}
+#ifdef DEBUG
+	report << "# \033[1;33m>\033[0m fgemm  passed " << our << "/" << tot << "tests" <<std::endl;
+#endif
+	if(our != tot) fail = true;
+
+	commentator.stop(MSG_STATUS (!fail), (const char *) 0,"ftrmm et al full tests suite");
+#ifdef DEBUG
+	if (our != tot)
+		report << "# \033[1;31m>\033[0m fgemm failed" << std::endl;
+#endif
+	return fail ;
+	// return false ;
+
+}
+
+#undef _LB_TIME
+#undef _LB_MAX_SZ
+#undef _LB_ITERS
+#undef _LB_DEBUG
+
diff --git a/tests/test-generic-for-quad.h b/tests/test-generic-for-quad.h
deleted file mode 100644
index 1a880a4..0000000
--- a/tests/test-generic-for-quad.h
+++ /dev/null
@@ -1,2039 +0,0 @@
-/* -*- mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-
-/* linbox/tests/test-generic-for-quad.h
- *
- * Evolved from test-generic.h by Hui Wang, spring/summer 2006
- * The test-blackbox is substantially different.  
- * It is setup to compare blackbox/zo.h with blackbox/quad-matrix.h, 
- * two representations of zero-one matrices. (quad wins)
- *
- * See COPYING for license information.
- */
-
-#ifndef __TEST_GENERIC_H
-#define __TEST_GENERIC_H
-
-#include <iostream>
-#include <fstream>
-#include <sstream>
-#include <vector>
-#include <cstdio>
-
-#include "linbox/util/timer.h"
-#include "linbox/util/commentator.h"
-#include "linbox/util/field-axpy.h"
-#include "linbox/vector/stream.h"
-#include "linbox/vector/vector-domain.h"
-#include "linbox/blackbox/dense.h"
-#include "linbox/integer.h"
-
-#include "test-common.h" 
-
-/* Modular exponentiation */
-using namespace std;
-
-template <class Field>
-typename Field::Element expt (const Field &F, typename Field::Element &res, const typename Field::Element &a, LinBox::integer &n) 
-{
-	if (n == 0) {
-		F.init (res, 1);
-	}
-	else if (n == 1) {
-		F.assign (res, a);
-	}
-	else if (n[0] & 1) {
-		n -= 1;
-		expt (F, res, a, n);
-		F.mulin (res, a);
-	} else {
-		n /= 2;
-		expt (F, res, a, n);
-		F.mulin (res, res);
-	}
-
-	return res;
-}
-
-/// @name Generic field tests
-//@{
-/** Generic test 1: Test of field operations
- *
- * Test various field oeprations
- *
- * F - Field over which to perform computations
- * title - String to use as the descriptive title of this test
- *
- * Return true on success and false on failure
- */
-
-template<class Field>
-bool testField (Field &F, const char *title) 
-{
-	typename Field::Element zero, one, two, three;
-	typename Field::Element a, b, c, d, e, f;
-
-	commentator.start (title, "testField", 5);
-
-	// there is an extra char in the output - bds 3/02
-	ostream &report = commentator.report (LinBox::Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION);
-	report << "Field self description: " << F.write (report) << endl;
-	//	report << "field Element 2: " << F.write (report, two) << endl;
-
-	LinBox::integer n, m;
-	bool pass = true, part_pass;
-
-	commentator.start ("\t--Testing characteristic/cardinality match");
-	part_pass = true;
-
-	F.characteristic (n); 
-	F.cardinality (m);
-
-	if (n > 0 && !isPower (m, n)) {
-		pass = part_pass = false; 
-		commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-			<< "ERROR: Characteristic, cardinality mismatch" << endl;
-	}
-
-	commentator.stop (MSG_STATUS (part_pass));
-	commentator.progress ();
-
-	/* tests for presence of members with minimal check of semantics */
-	// these checks need improvement 
-
-	commentator.start ("\t--Testing correctness of 0 and 1");
-	part_pass = true;
-
-	F.init (zero, 0);
-	F.init (one, 1);
-
-	if (!F.isZero (zero)) {
-		pass = part_pass = false;
-		commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-			<< "ERROR: isZero (0) is false" << endl;
-	}
-
-	if (F.isZero (one)) {
-		pass = part_pass = false;
-		commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-			<< "ERROR: isZero (1) is true" << endl;
-	}
-
-	if (F.isOne (zero)) {
-		pass = part_pass = false;
-		commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-			<< "ERROR: isOne (0) is true" << endl;
-	}
-
-	if (!F.isOne (one)) {
-		pass = part_pass = false;
-		commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-			<< "ERROR: isOne (1) is false" << endl;
-	}
-
-	commentator.stop (MSG_STATUS (part_pass));
-	commentator.progress ();
-
-	commentator.start ("\t--Testing init/convert");
-	part_pass = true;
-
-	if (F.cardinality (m) <= 0)
-		n = 49193295;   // Just using some odd value
-	else
-		n -= 1;
-
-	F.init (a, n);  
-	
-	{
-		ostream &report = commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-		report << "Initial value: " << n << endl;
-		report << "Result of conversion: ";
-		F.write (report, a);
-		report << endl;
-	}
-
-	F.convert (m, a); 
-
-	if (m != n) {
-		pass = part_pass = false;
-		commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-			<< "ERROR: F.convert (m, F.init (a, n)) != n" << endl;
-	}
-
-	commentator.stop (MSG_STATUS (part_pass));
-	commentator.progress ();
-
-	commentator.start ("\t--Testing field arithmetic");
-	part_pass = true;
-
-	F.init (two, 2);
-	F.init (three, 3);
-
-	F.init (b, n-2);
-	F.init (d, n-2);
-	F.init (e, 3);
-
-	F.add (a, three, two); 
-	F.assign (d, three);
-	F.addin (d, two);
-
-	{
-		ostream &report = commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-		report << "Result of 2 + 3: ";
-		F.write (report, a);
-		report << endl;
-
-		report << "Result of 2 + 3 (inplace): ";
-		F.write (report, d);
-		report << endl;
-	}
-
-	if (!F.areEqual (a, F.init (f, 5)) || !F.areEqual (d, a)) {
-		pass = part_pass = false;
-		commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-			<< "ERROR: Results of add are incorrect" << endl;
-	}
-
-	F.neg (a, two); 
-	F.assign (d, two);
-	F.negin (d);
-
-	{
-		ostream &report = commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-		report << "Result of -2: ";
-		F.write (report, a);
-		report << endl;
-
-		report << "Result of -2 (inplace): ";
-		F.write (report, d);
-		report << endl;
-	}
-
-	if (!F.areEqual (a, F.init (f, -2)) || !F.areEqual (d, a)) {
-		pass = part_pass = false;
-		ostream &report = commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR);
-		report << "ERROR: Results of neg are incorrect (";
-		F.write (report, f);
-		report << ")" << endl;
-	}
-
-	F.sub (a, three, two);
-	F.init (d, 3);
-	F.subin (d, two);
-
-	if (!F.areEqual (a, one) || !F.areEqual (d, a)) {
-		pass = part_pass = false;
-		commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-			<< "ERROR: Results of sub are incorrect" << endl;
-	}
-
-	F.mul (a, two, three);
-	F.assign (d, two);
-	F.mulin (d, three);
-	F.init (f, 6);
-
-	if (!F.areEqual (a, f) || !F.areEqual (d, a)) {
-		pass = part_pass = false;
-		commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-			<< "ERROR: Results of mul are incorrect" << endl;
-	}
-
-	F.inv (a, one);
-	F.assign (d, one);
-	F.invin (d);
-
-	if (!F.areEqual (a, one) || !F.areEqual (d, a)) {
-		pass = part_pass = false;
-		F.write( F.write( F.write( 
-                    commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-                         << "ERROR: Results of inv are incorrect : 1/", one)
-                         << " != ", a) 
-                         << " or != ", d) << endl;
-	}
-
-        F.write( commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR) << " two : ", two) << ", is zero ? : " << F.isZero(two) << std::endl;
-        
-	if ( ! F.isZero(two) )
-	{
-	        F.div (a, two, two);
-		ostream &report = commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-		report << "Result of 2/2: ";
-		F.write (report, a);
-		report << endl;
-	        if (!F.areEqual (a, one) ) {
-		    pass = part_pass = false;
-		    report << "ERROR: Result of div is incorrect" << endl;
-	        }
-	}
-
-        F.write( commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR) << " three : ", three) << ", is zero ? : " << F.isZero(three) << std::endl;
-	if ( ! F.isZero(three) ) {
-		F.assign (d, three);
-		F.divin (d, three);
-		ostream &report = commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-		report << "Result of 3/3: ";
-		F.write (report, d);
-		report << endl;
-		if (!F.areEqual (d, one)) {
-		    pass = part_pass = false;
-		    report << "ERROR: Result of divin is incorrect" << endl;
-		}
-	}
-
-	F.axpy (a, two, three, two); 
-	F.assign (d, two);
-	F.axpyin (d, two, three);
-
-	if ( !F.areEqual (a, F.init (f, 8)) || !F.areEqual (d, a) ) {
-		pass = part_pass = false;
-		commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-			<< "ERROR: Resutls of axpy are incorrect" << endl;
-	}
-
-	commentator.stop (MSG_STATUS (part_pass));
-	commentator.progress ();
-
-	commentator.start ("\t--Testing summation of powers of 2");
-
-	//,..
-	// 2^101 - 1 vs 1 + 2 + 4 + ... + 2^100
-
-	F.init (a, 1);
-	F.init (b, 2);
-	F.init (c, 0);
-	
-	for (int i = 1; i <= 101; ++i) {
-		F.addin (c, a);
-		F.mulin (a, b);
-	}
-	F.init (f, 1);
-	F.subin (a, f);
-
-	if (!F.areEqual (a, c)) {
-		pass = part_pass = false;
-		commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-			<< "ERROR: Results are incorrect using mul/add" << endl;
-	}
-
-	F.assign (d, one);
-	for (int i = 1; i < 101; ++i)
-		F.axpy (d, two, d, one);
-
-	if (!F.areEqual (a, d)) {
-		pass = part_pass = false;
-		commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-			<< "ERROR: Results are incorrect using axpy" << endl;
-	}
-
-	commentator.stop (MSG_STATUS (part_pass));
-	commentator.progress ();
-
-	/* untested so far
-	   ostream &write (ostream &os) const 
-	   istream &read (istream &is)
-	   ostream &write (ostream &os, const Element &x) const 
-	   istream &read (istream &is, Element &x) const
-	   FieldArchetype (FieldAbstract*, ElementAbstract*, RandIterAbstract* = 0)
-	*/
-
-	commentator.stop (MSG_STATUS (pass), (const char *) 0, "testField");
-	
-	return pass;
-}
-
-/** Tests of algebraic properties of fields */
-
-/* Generic test 6: Negation of elements
- *
- * Negates random elements and checks that they are true negatives
- */
-
-template <class Field>
-bool testFieldNegation (const Field &F, const char *name, unsigned int iterations) 
-{
-	std::ostringstream str;
-	str << "\t--Testing " << name << " negation" << ends;
-	commentator.start (str.str ().c_str (), "testFieldNegation", iterations);
-
-	typename Field::Element a, neg_a, neg_a_a, zero;
-	typename Field::RandIter r (F);
-
-	bool ret = true;
-
-	F.init (zero, 0);
-
-	for (unsigned int i = 0; i < iterations; i++) {
-		commentator.startIteration (i);
-		
-		r.random (a);
-
-		ostream &report = commentator.report (LinBox::Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-		report << "Random element a: ";
-		F.write (report, a) << endl;
-
-		F.neg (neg_a, a);
-
-		report << "-a = ";
-		F.write (report, neg_a) << endl;
-
-		F.add (neg_a_a, neg_a, a);
-
-		report << "a + -a = ";
-		F.write (report, neg_a_a) << endl;
-
-		if (!F.areEqual (neg_a_a, zero)) {
-			commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: a + -a != 0" << endl;
-			ret = false;
-		}
-
-		commentator.stop ("done");
-		commentator.progress ();
-	}
-
-	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testFieldNegation");
-
-	return ret;
-}
-
-/** Generic test 5: Inversion of elements
- *
- * Inverts random elements and checks that they are true inverses
- */
-
-template <class Field>
-bool testFieldInversion (const Field &F, const char *name, unsigned int iterations) 
-{
-	std::ostringstream str;
-	str << "\t--Testing " << name << " inversion" << ends;
-	commentator.start (str.str ().c_str (), "testFieldInversion", iterations);
-
-	typename Field::Element a, ainv, aainv, one;
-	typename Field::RandIter r (F);
-
-	bool ret = true;
-
-	F.init (one, 1);
-
-	for (unsigned int i = 0; i < iterations; i++) {
-		commentator.startIteration (i);
-
-		do r.random (a); while (F.isZero (a));
-
-		ostream &report = commentator.report (LinBox::Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-		report << "Random element a: ";
-		F.write (report, a) << endl;
-
-		F.inv (ainv, a);
-
-		report << "a^{-1} = ";  F.write (report, ainv) << endl;
-
-		F.mul (aainv, ainv, a);
-
-		report << "a a^{-1} = ";  F.write (report, aainv) << endl;
-
-		if (!F.areEqual (aainv, one)) {
-			commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: a a^-1 != 1" << endl;
-			ret = false;
-		}
-
-		commentator.stop ("done");
-		commentator.progress ();
-	}
-
-	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testFieldInversion");
-
-	return ret;
-}
-
-/** @brief Generic test 7: Commutativity and distributivity of addition and multiplication
-
- * Given random field elements 'a', 'b', and 'c', checks that
- * (a + b) * c = a * c + b * c = c * (a + b) = b * c + a * c
- */
-
-template <class Field>
-bool testFieldAxioms (const Field &F, const char *name, unsigned int iterations) 
-{
-	std::ostringstream str;
-	str << "\t--Testing " << name << " commutativity, distributivity" << ends;
-	commentator.start (str.str ().c_str (), "testFieldAxioms", iterations);
-
-	typename Field::Element a, b, c, a_b, a_bc, ac, bc, ac_bc, ca_b, bc_ac;
-	typename Field::RandIter r (F);
-
-	bool ret = true;
-
-	for (unsigned int i = 0; i < iterations; i++) {
-		commentator.startIteration (i);
-
-		r.random (a);
-		r.random (b);
-		r.random (c);
-
-		ostream &report = commentator.report (LinBox::Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-		report << "Random elements a = ";
-		F.write (report, a) << ", b = ";
-		F.write (report, b) << ", c = ";
-		F.write (report, c) << endl;
-
-		F.add (a_b, a, b);
-		F.mul (a_bc, a_b, c);
-		F.mul (ca_b, c, a_b);
-		F.mul (ac, a, c);
-		F.mul (bc, b, c);
-		F.add (ac_bc, ac, bc);
-		F.add (bc_ac, bc, ac);
-
-		report << "(a + b) * c = ";
-		F.write (report, a_bc) << endl;
-
-		report << "a * c + b * c = ";
-		F.write (report, ac_bc) << endl;
-
-		report << "c * (a + b) = ";
-		F.write (report, ca_b) << endl;
-
-		report << "b * c + a * c = ";
-		F.write (report, bc_ac) << endl;
-		if (!F.areEqual (a_bc, ac_bc) || !F.areEqual (a_bc, ca_b) || !F.areEqual (a_bc, bc_ac)) {
-			commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: Results are not equal" << endl;
-			ret = false;
-		}
-
-		commentator.stop ("done");
-		commentator.progress ();
-	}
-
-	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testFieldAxioms");
-
-	return ret;
-}
-
-/** Generic test 7: Associativity of addition and multiplication
- *
- * Given random field elements 'a', 'b', and 'c', checks that
- * (a * b) * c = a * (b * c) and (a + b) + c = a + (b + c)
- */
-
-template <class Field>
-bool testFieldAssociativity (const Field &F, const char *name, unsigned int iterations) 
-{
-	std::ostringstream str;
-	str << "\t--Testing " << name << " associativity" << ends;
-	commentator.start (str.str ().c_str (), "testFieldAssociativity", iterations);
-
-	typename Field::Element a, b, c, a_b, b_c, a_bc, ab_c;
-	typename Field::RandIter r (F);
-
-	bool ret = true;
-
-	for (unsigned int i = 0; i < iterations; i++) {
-		commentator.startIteration (i);
-
-		r.random (a);
-		r.random (b);
-		r.random (c);
-
-		ostream &report = commentator.report (LinBox::Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-		report << "Random elements a = ";
-		F.write (report, a) << ", b = ";
-		F.write (report, b) << ", c = ";
-		F.write (report, c) << endl;
-
-		F.add (a_b, a, b);
-		F.add (ab_c, a_b, c);
-		F.add (b_c, b, c);
-		F.add (a_bc, a, b_c);
-
-		report << "(a + b) + c = ";
-		F.write (report, ab_c) << endl;
-
-		report << "a + (b + c) = ";
-		F.write (report, a_bc) << endl;
-
-		if (!F.areEqual (ab_c, a_bc)) {
-			commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: Results are not equal" << endl;
-			ret = false;
-		}
-
-		F.mul (a_b, a, b);
-		F.mul (ab_c, a_b, c);
-		F.mul (b_c, b, c);
-		F.mul (a_bc, a, b_c);
-
-		report << "(a * b) * c = ";
-		F.write (report, ab_c) << endl;
-
-		report << "a * (b * c) = ";
-		F.write (report, a_bc) << endl;
-
-		if (!F.areEqual (ab_c, a_bc)) {
-			commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: Results are not equal" << endl;
-			ret = false;
-		}
-
-		commentator.stop ("done");
-		commentator.progress ();
-	}
-
-	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testFieldAssociativity");
-
-	return ret;
-}
-
-/** Generic test 2: Geometric summation
- *
- * Generates a random field element 'a' and raises it through repeated
- * exponentiation to the power n. Takes the sum k of all intermediate values and
- * checks that a^n = (k-1)/(a-1).
- */
-
-template <class Field>
-bool testGeometricSummation (const Field &F, const char *name, unsigned int iterations, unsigned int n) 
-{
-	std::ostringstream str;
-	str << "\t--Testing " << name << " geometric summation" << ends;
-	commentator.start (str.str ().c_str (), "testGeometricSummation", iterations);
-
-	typename Field::Element a, a_n, k, zero, one;
-	typename Field::RandIter r (F);
-
-	F.init (zero, 0);
-	F.init (one, 1);
-
-	bool ret = true;
-
-	for (unsigned int i = 0; i < iterations; i++) {
-		commentator.startIteration (i);
-
-		do r.random (a); while (F.areEqual (a, one));
-
-		ostream &report = commentator.report (LinBox::Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-		report << "Random element a: ";
-		F.write (report, a) << endl;
-
-		F.assign (k, one);
-		F.assign (a_n, a);
-
-		for (unsigned int j = 0; j < n; ++j) {
-			F.addin (k, a_n);
-			F.mulin (a_n, a);
-		}
-
-		report << "n = " << n << " a^n = ";
-		F. write (report, a_n) << endl;
-		F. write(report);
-		report<<std::endl;
-
-		report << "sum(a^i, i = 0..n-1) = ";
-		F.write (report, k) << endl;
-
-		F.subin (a_n, one);
-		report << "(a^n - 1) = ";
-		F.write (report, a_n) << endl;
-
-		F.subin (a, one);
-		report << "(a - 1) = ";
-		F.write (report, a) << endl;
-
-		F.divin (a_n, a);
-
-		report << "(a^n - 1) / (a - 1) = ";
-		F.write (report, a_n) << endl;
-
-		if (!F.areEqual (k, a_n)) {
-			commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: Field elements are not equal" << endl;
-			ret = false;
-		}
-
-		commentator.stop ("done");
-		commentator.progress ();
-	}
-
-	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testGeometricSummation");
-
-	return ret;
-}
-
-/** Generic test 3: Test of field characteristic
- *
- * Take random field elements and add them p times, where p is the
- * characteristic of the field. Checks that the sum is 0. The test is not too
- * useful when the characteristic of the field is 0, but it should still work
- * correctly.
- */
-
-template <class Field>
-bool testFieldCharacteristic (const Field &F, const char *name, unsigned int iterations) 
-{
-	std::ostringstream str;
-	str << "\t--Testing " << name << " characteristic" << ends;
-	commentator.start (str.str ().c_str (), "testFieldCharacteristic", iterations);
-
-	LinBox::integer p, j;
-	typename Field::Element a, sigma, zero;
-	typename Field::RandIter r (F);
-
-	F.characteristic (p);
-	F.init (zero, 0);
-
-	bool ret = true;
-
-	ostream &report = commentator.report (LinBox::Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-	report << "Field characteristic: " << p << endl;
-
-	for (unsigned int i = 0; i < iterations; i++) {
-		commentator.startIteration (i);
-
-		r.random (a);
-
-		ostream &report = commentator.report (LinBox::Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-		report << "Random element a: ";
-		F.write (report, a) << endl;
-
-		F.assign (sigma, zero);
-
-		for (j = 0; j < p; j += 1)
-			F.addin (sigma, a);
-
-		report << "p a = ";
-		F.write (report, sigma) << endl;
-
-		if (!F.isZero (sigma)) {
-			commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: p a != 0" << endl;
-			ret = false;
-		}
-
-		commentator.stop ("done");
-		commentator.progress ();
-	}
-
-	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testFieldCharacteristic");
-
-	return ret;
-}
-
-/** Generic test 4: The Freshman's Dream
- *
- * Generates two random field elements 'a' and 'b', and checks whether
- * (a + b)^p = a^p + b^p, where p is the characteristic of the field. Bails out
- * with an error if the field is of characteristic 0.
- */
-
-template <class Field>
-bool testFreshmansDream (const Field &F, const char *name, unsigned int iterations) 
-{
-	std::ostringstream str;
-	str << "\t--Testing " << name << " Freshman's Dream" << ends;
-	commentator.start (str.str ().c_str (), "testFreshmansDream", iterations);
-
-	LinBox::integer c, j;
-	typename Field::Element cp; F.init(cp, c);
-
-	F.characteristic (c);
-
-	if (F.isZero (cp)) {
-		commentator.stop ("skipping", "Field characteristic is 0, so this test makes no sense", "testFreshmansDream");
-		return true;
-	}
-
-	bool ret = true;
-
-	typename Field::RandIter r (F);
-	typename Field::Element a, b, a_b, a_b_p, a_p, b_p, a_p_b_p;
-
-	for (unsigned int i = 0; i < iterations; i++) {
-		commentator.startIteration (i);
-
-		r.random (a);
-		r.random (b);
-
-		ostream &report = commentator.report (LinBox::Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-		report << "Random elements a = ";
-		F.write (report, a) << ", b = ";
-		F.write (report, b) << endl;
-
-		F.add (a_b, a, b);
-
-		j = c; expt (F, a_b_p, a_b, j);
-		j = c; expt (F, a_p, a, j);
-		j = c; expt (F, b_p, b, j);
-
-		F.add (a_p_b_p, a_p, b_p);
-
-		report << "(a + b)^p = ";
-		F.write (report, a_b_p);
-		report << endl;
-
-		report << "      a^p = ";
-		F.write (report, a_p);
-		report << endl;
-
-		report << "      b^p = ";
-		F.write (report, b_p);
-		report << endl;
-
-		report << "a^p + b^p = ";
-		F.write (report, a_p_b_p);
-		report << endl;
-
-		if (!F.areEqual (a_b_p, a_p_b_p)) {
-			commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: (a + b)^p != a^p + b^p" << endl;
-			ret = false;
-		}
-
-		commentator.stop ("done");
-		commentator.progress ();
-	}
-
-	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testFreshmansDream");
-
-	return ret;
-}
-
-
-/* Tests of field features */ 
-
-/** Generic test 7: Consistency of in-place and out-of-place arithmetic
- *
- * Generates random elements 'a' and 'b' and performs all basic arithmetic
- * operations in-place and out-of-place, checking for consistency
- */
-
-template <class Field>
-bool testArithmeticConsistency (const Field &F, const char *name, unsigned int iterations)
-{
-	std::ostringstream str;
-	str << "\t--Testing " << name << " in-place/out-of-place arithmetic consistency" << ends;
-	commentator.start (str.str ().c_str (), "testArithmeticConsistency", iterations);
-
-	bool ret = true;
-
-	typename Field::RandIter r (F);
-	typename Field::Element a, b, c1, c2;
-
-	for (unsigned int i = 0; i < iterations; i++) {
-		commentator.startIteration (i);
-
-		r.random (a);
-		r.random (b);
-
-		// This should be immaterial, since we have already "proven" commutativity
-		if (F.isZero (a) && !F.isZero (b))
-			std::swap (a, b);
-
-		ostream &report = commentator.report (LinBox::Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-		report << "Random elements a = ";
-		F.write (report, a) << ", b = ";
-		F.write (report, b) << endl;
-
-		F.add (c1, a, b);
-		F.assign (c2, a);
-		F.addin (c2, b);
-
-		report << "a + b = (out-of-place) ";
-		F.write (report, c1) << ", (in-place) ";
-		F.write (report, c2) << endl;
-
-		if (!F.areEqual (c1, c2)) {
-			commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: Consistency failure for addition" << endl;
-			ret = false;
-		}
-
-		F.sub (c1, a, b);
-		F.assign (c2, a);
-		F.subin (c2, b);
-
-		report << "a - b = (out-of-place) ";
-		F.write (report, c1) << ", (in-place) ";
-		F.write (report, c2) << endl;
-
-		if (!F.areEqual (c1, c2)) {
-			commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: Consistency failure for subtraction" << endl;
-			ret = false;
-		}
-
-		F.neg (c1, a);
-		F.assign (c2, a);
-		F.negin (c2);
-
-		report << "-a = (out-of-place) ";
-		F.write (report, c1) << ", (in-place) ";
-		F.write (report, c2) << endl;
-
-		if (!F.areEqual (c1, c2)) {
-			commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: Consistency failure for negation" << endl;
-			ret = false;
-		}
-
-		F.mul (c1, a, b);
-		F.assign (c2, a);
-		F.mulin (c2, b);
-
-		report << "a * b = (out-of-place) ";
-		F.write (report, c1) << ", (in-place) ";
-		F.write (report, c2) << endl;
-
-		if (!F.areEqual (c1, c2)) {
-			commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: Consistency failure for multiplication" << endl;
-			ret = false;
-		}
-
-		if (!F.isZero (a)) {
-			F.div (c1, b, a);
-			F.assign (c2, b);
-			F.divin (c2, a);
-
-			report << "b / a = (out-of-place) ";
-			F.write (report, c1) << ", (in-place) ";
-			F.write (report, c2) << endl;
-
-			if (!F.areEqual (c1, c2)) {
-				commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-					<< "ERROR: Consistency failure for division" << endl;
-				ret = false;
-			}
-
-			F.inv (c1, a);
-			F.assign (c2, a);
-			F.invin (c2);
-
-			report << "a^-1 = (out-of-place) ";
-			F.write (report, c1) << ", (in-place) ";
-			F.write (report, c2) << endl;
-
-			if (!F.areEqual (c1, c2)) {
-				commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-					<< "ERROR: Consistency failure for inversion" << endl;
-				ret = false;
-			}
-		}
-
-		commentator.stop ("done");
-		commentator.progress ();
-	}
-
-	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testArithmeticConsistency");
-
-	return ret;
-}
-
-/** Generic test 8: Consistency of axpy
- *
- * Generates random elements 'a', 'x', and 'y' and checks that a * x + y is the
- * same for axpy, axpyin, add/mul
- */
-
-template <class Field>
-bool testAxpyConsistency (const Field &F, const char *name, unsigned int iterations)
-{
-	std::ostringstream str;
-	str << "\t--Testing " << name << " axpy/add-mul consistency" << ends;
-	commentator.start (str.str ().c_str (), "testAxpyConsistency", iterations);
-
-	bool ret = true;
-
-	typename Field::RandIter r (F);
-	typename Field::Element a, x, y, c1, c2, c3;
-
-	for (unsigned int i = 0; i < iterations; i++) {
-		commentator.startIteration (i);
-
-		r.random (a);
-		r.random (x);
-		r.random (y);
-
-		ostream &report = commentator.report (LinBox::Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-		report << "Random elements a = ";
-		F.write (report, a) << ", x = ";
-		F.write (report, x) << ", y = ";
-		F.write (report, y) << endl;
-
-		F.mul (c1, a, x);
-		F.addin (c1, y);
-		F.axpy (c2, a, x, y);
-		F.assign (c3, y);
-		F.axpyin (c3, a, x);
-
-		report << "a * x + y = (add-mul) ";
-		F.write (report, c1) << ", (out-of-place) ";
-		F.write (report, c2) << ", (in-place) ";
-		F.write (report, c3) << endl;
-
-		if (!F.areEqual (c1, c2) || !F.areEqual (c1, c3)) {
-			commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: Consistency failure for axpy" << endl;
-			ret = false;
-		}
-
-		commentator.stop ("done");
-		commentator.progress ();
-	}
-
-	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testAxpyConsistency");
-
-	return ret;
-}
-
-/** Generic test 9: Basic concept check of RandIter
- *
- * In a loop, generates random element 'a', and fails
- * if it is always zero.
- */
-template <class Field>
-bool testRanditerBasic(const Field &F, const char *name, unsigned int iterations)
-{
-	bool ret=false;
-	std::ostringstream str;
-	str << "\t--Testing " << name << " randiter basic operation " << ends;
-	commentator.start (str.str ().c_str (), "testAxpyConsistency", iterations);
-
-	typename Field::RandIter r (F);
-	typename Field::Element a;
-
-	for (unsigned int i = 0; i < iterations; i++) {
-		r.random (a);
-		if ( ! F.isZero(a) ) {ret = true; break;}
-
-	}
-
-	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testRanditerBasic");
-
-	return ret;
-}
-
-
-/* Convenience function to run all of the field tests on a given field */
-
-template <class Field>
-bool runFieldTests (const Field &F, const char *desc, unsigned int iterations, size_t n, bool runCharacteristicTest) 
-{
-	bool pass = true;
-	ostringstream str1, str2;
-
-	str1 << "\t--Testing " << desc << " field" << ends;
-	str2 << "\t--Testing " << desc << " FieldAXPY" << ends;
-
-	commentator.start (str1.str ().c_str (), "runFieldTests", runCharacteristicTest ? 11 : 10);
-	
-	if (!testField                 (F, str1.str ().c_str ()))                pass = false; commentator.progress ();
-	if (!testFieldNegation         (F, desc, iterations))                    pass = false; commentator.progress ();
-	if (!testFieldInversion        (F, desc, iterations))                    pass = false; commentator.progress ();
-	if (!testFieldAxioms           (F, desc, iterations))                    pass = false; commentator.progress ();
-	if (!testFieldAssociativity    (F, desc, iterations))                    pass = false; commentator.progress ();
-
-	if (runCharacteristicTest) {
-		if (!testFieldCharacteristic (F, desc, iterations))
-			pass = false;
-
-		commentator.progress ();
-	}
-
-	if (!testGeometricSummation    (F, desc, iterations, 100))               pass = false; commentator.progress ();
-	if (!testFreshmansDream        (F, desc, iterations))                    pass = false; commentator.progress ();
-	if (!testArithmeticConsistency (F, desc, iterations))                    pass = false; commentator.progress ();
-	if (!testAxpyConsistency       (F, desc, iterations))                    pass = false; commentator.progress ();
-	if (!testRanditerBasic       (F, desc, iterations))                    pass = false; commentator.progress ();
-
-	commentator.stop (MSG_STATUS (pass), (const char *) 0, "runFieldTests");
-
-	return pass;
-}
-//@}
-
-
-///@name Generic tests for black boxes 
-//@{
-/** Generic Blackbox test 1: (u^T A) v = u^T (A v).
- *
- * Take the given black box and compute u^T A v via <A^T u, v> and <u, Av> for
- * randomly chosen u and v. Check whether the results are equal. In theory, this
- * should guarantee that tranpose is working correctly if apply and dot product
- * are also working correctly. Apply and dot product should, of course, be
- * independently checked.
- *
- * F - Field over which to perform computations
- * A - Black box of which to construct the transpose
- * iterations - Number of random vectors to which to apply matrix
- *
- * Return true on success and false on failure
- */
-
-template <class Field, class Blackbox, class Vector>
-static bool
-testTranspose (Field                             &F,
-			   Blackbox							 &A,
-			   LinBox::VectorStream<Vector>      &stream1,
-			   LinBox::VectorStream<Vector>      &stream2) 
-{
-	bool ret = true;
-
-	Vector u, v, uA, Av;
-
-	LinBox::VectorWrapper::ensureDim (u, A.rowdim ());
-	LinBox::VectorWrapper::ensureDim (uA, A.coldim ());
-	LinBox::VectorWrapper::ensureDim (v, A.coldim ());
-	LinBox::VectorWrapper::ensureDim (Av, A.rowdim ());
-
-	LinBox::VectorDomain <Field> VD (F);
-	typename Field::Element r1, r2;
-	ostream &report = LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-	report << "Blackbox transpose test [that u^T(Av) == (uA)^T v]" << std::endl;
-
-	while (stream1 && stream2) {
-		LinBox::commentator.startIteration (stream1.j ());
-
-		stream1.next (u);
-		stream2.next (v);
-
-		//ostream &report = LinBox::commentator.report (LinBox::Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-
-		VD.write( report << "Input vector u:            ", u) << endl;
-		VD.write( report << "Input vector v:            ", v) << endl;
-
-		A.apply (Av, v);
-
-		VD.write( report << "Result of apply:           ", Av) << endl;
-
-		VD.dot (r1, u, Av);
-		A.applyTranspose (uA, u);
-
-		VD.write( report << "Result of transpose apply: ", uA) << endl;
-
-		VD.dot (r2, uA, v);
-
-		F.write( report << "<u, Av>:  ", r1) << endl;
-
-		F.write( report << "<A^T u, v>:  ", r2) << endl;
-
-		if (!F.areEqual (r1, r2)) {
-			ret = false;
-			LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: Values are not equal" << endl;
-		}
-
-		LinBox::commentator.stop ("done");
-		LinBox::commentator.progress ();
-	}
-
-	return ret;
-}
-
-/** Generic Blackbox test 2: Linearity of black boxes.
- *
- * Given an arbitrary black box A, compute A(x+alpha y) and Ax+alphaAy and check equality.
- *
- * F - Field over which to perform computations
- * A - Black box of which to compute the dense representation
- * stream1 - Stream for x's
- * stream2 - Stream for y's
- *
- * Return true on success and false on failure
- */
-
-template <class Field, class BB, class Vector>
-static bool
-testLinearity (Field                             &F,
-	       BB 				 &A,
-	       LinBox::VectorStream<Vector>      &stream1,
-	       LinBox::VectorStream<Vector>      &stream2) 
-{
-	bool ret = true, iter_passed;
-
-	size_t n = A.rowdim ();
-	size_t m = A.coldim ();
-
-	Vector x, y, xpay, Axpay, Ax, Ay, AxpaAy;
-	LinBox::VectorDomain <Field> VD (F);
-	typename Field::RandIter r (F);
-	typename Field::Element alpha;
-
-	LinBox::VectorWrapper::ensureDim (x, m);
-	LinBox::VectorWrapper::ensureDim (y, m);
-	LinBox::VectorWrapper::ensureDim (xpay, m);
-	LinBox::VectorWrapper::ensureDim (Axpay, n);
-	LinBox::VectorWrapper::ensureDim (Ax, n);
-	LinBox::VectorWrapper::ensureDim (Ay, n);
-	LinBox::VectorWrapper::ensureDim (AxpaAy, n);
-
-	ostream &report = LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-	report << "Blackbox linearity test [that A.apply to (ax + y) == a A.apply to x + A.apply to y]" << std::endl;
-
-	while (stream1 && stream2) {
-		LinBox::commentator.startIteration (stream1.j ());
-
-		iter_passed = true;
-
-		stream1.next (x);
-		stream2.next (y);
-
-		r.random (alpha);
-
-		//ostream &report = LinBox::commentator.report (LinBox::Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-		VD.write( report << "Input vector x: ", x) << endl;
-
-		VD.write( report << "Input vector y: ", y) << endl;
-
-		F.write( report << "Input alpha: ", alpha) << endl;
-
-		VD.axpy ( xpay, alpha, y, x);
-		A.apply ( Axpay, xpay);
-
-		A.apply ( Ax, x);
-		A.apply ( Ay, y);
-		VD.axpy ( AxpaAy, alpha, Ay, Ax);
-
-		VD.write( report << "   x+alpha y = ", xpay) << endl;
- 
-		VD.write( report << "A(x+alpha y) = ", Axpay) << endl;
-
-		VD.write( report << "          Ax = ", Ax) << endl;
-
-		VD.write( report << "          Ay = ", Ay) << endl;
-
-		VD.write( report << " Ax+alpha Ay = ", AxpaAy) << endl;
-
-		if (!VD.areEqual (Axpay, AxpaAy))
-			ret = iter_passed = false;
-
-		if (!iter_passed)
-			LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: Vectors are not equal" << endl;
-
-		LinBox::commentator.stop ("done");
-		LinBox::commentator.progress ();
-	}
-
-	return ret;
-}
-
-/** Generic blackbox test 3: compare to a dense matrix.
- *
- * An equivalent dense matrix B is obtained with n applies.
- * Then it's behaviour is compared to A's.
- *
- * F - Field over which to perform computations
- * A - Black box of which to compute the dense representation
- */
-template <class Field, class Blackbox> 
-static bool 
-testSmallBlackbox(Field& F, Blackbox& A)
-{
-	size_t m = A.rowdim(), n = A.coldim();
-	typedef std::vector<typename Field::Element> Vector;
-
-	// e for cols of identity
-	typename Field::Element zero, one; 
-	F.init(zero, 0); F.init(one, 1);
-	Vector e(n, zero);
-	Vector v(m);
-
-	// construct dense matrix
-	LinBox::DenseMatrix<Field> B(F, m, n);
-	for(size_t j = 0; j < n; ++j)
-	{	e[(n + j-1)%n] = zero;
-		e[j] = one;
-		A.apply(v, e);
-		for (size_t i = 0; i < m; ++i) B.setEntry(i, j, v[i]);
-	}
-
-// really, you have to look at B to see if it is what is intended, else this is just another linearity test.
-
-	// display B in report
-	std::ostream &report = LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-	B.write(report);
-
-	// compare blackbox A and dense B on random vector
-	int iterations = 1; // could be higher if cardinality is small.
-	LinBox::RandomDenseStream<Field, Vector> stream (F, n, iterations);
-	Vector y(m), z(m), x(n);
-	stream.next(x);
-	A.apply(y, x); B.apply(z, x);
-
-	// display x, y, z in report
-	LinBox::VectorDomain<Field> VD(F); 
-	VD.write(report, x); report << " is x" << endl;
-	VD.write(report, y); report << " is y" << endl;
-	VD.write(report, z); report << " is z" << endl;
-
-	return VD.areEqual(y, z);
-}
-
-/** Generic blackbox test 4: combination of tests
- * 
- * Call testTranspose and testLinearity.
- * If large, time apply and applyTranspose.
- * if small, call testSmallBlackbox.
- */
-template <class Field, class BB> 
-//template <class Field, class AA, class BB> 
-static bool 
-testBlackbox(Field& F, BB &A)
-//testBlackbox(Field& F, AA &A, BB &B)
-{
-	size_t smallThresh = 20; // Below it do dense matrix comparison.
-	size_t largeThresh = 2000; // Above it do timing of apply and applyTr.
-	typedef std::vector<typename Field::Element> DenseVector;
-	std::ostream &report = LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-	report << "testBlackbox on " << A.rowdim() << " by " << A.coldim() << " matrix." << endl;
-	if (largeThresh < smallThresh) 
-		std::cout << "telling compiler not to issue warning";
-
-	//LinBox::VectorDomain<Field> VD (F);
-	
-	LinBox::commentator.setMaxDepth(-1);
-	bool ret = true;
-	UserTimer t;
-
-#if 0
-	size_t iterations = 1; 
-	LinBox::commentator.start ("\t--Testing A(ax+y) = a(Ax) + (Ay)", 
-							   "testLinearity", 1);
-	typename Field::RandIter r(F);
-	LinBox::RandomDenseStream<Field, DenseVector> stream1 (F, r, A.rowdim(), iterations); 
-	typename Field::Element x; 
-	r.random(x);
-	LinBox::RandomDenseStream<Field, DenseVector> stream2 (F, r, A.coldim(), iterations); 
-
-	ret = ret && testLinearity (F, A, stream1, stream2);
-	
-	LinBox::commentator.stop (MSG_STATUS (ret), 
-							  (const char *) 0, "testLinearity");
-	
-	/*
-	LinBox::commentator.start ("\t--Testing u^T(Av) = (u^T A)v", 
-							   "testTranspose", 1);
-	
-	r.random(x);
-	r.random(x);
-	LinBox::RandomDenseStream<Field, DenseVector> stream3 (F, r, A.rowdim(), iterations); 
-	r.random(x);
-	r.random(x);
-	r.random(x);
-	r.random(x);
-	LinBox::RandomDenseStream<Field, DenseVector> stream4 (F, r, A.coldim(), iterations); 
-
-	ret = ret && testTranspose (F, A, stream3, stream4); 
-	LinBox::commentator.stop (MSG_STATUS (ret), 
-							  (const char *) 0, "testTranspose");
-	*/
-	
-#endif
-#if 1
-	/* timing tests */   // I changed the order of all tests. Timing now is the first set of tests and then linearity and transpose
-	{
-		//{
-			DenseVector x(A.coldim()), ya(A.rowdim());
-			//DenseVector yb(B.rowdim());
-			for(size_t i = 0; i < A.coldim(); ++i) F.init(x[i], i);
-			for(size_t i = 0; i < A.rowdim(); ++i) F.init(ya[i], i);
-			//for(size_t i = 0; i < A.rowdim(); ++i) F.init(yb[i], i);
-			//std::cout << " -- testblackbox: correctness test --> ";
-			A.apply(ya, x);
-			//B.apply(yb, x);
-	    //}
-			//if (!VD.areEqual(ya, yb)) {std::cout << " wrong computation -- " << endl;  return ret = false;}
-			//else std::cout << " correct computation -- " << endl;
-
-		//if (A.coldim() >= largeThresh)
-			{
-				//LinBox::commentator.start ("\t--Timing Test (Av)","testApply", 1);
-				t.clear();
-				t.start();
-				//std::cout << " -- before call to apply -- " << std::endl;
-				for(size_t i = 0; i < 10; ++i )
-					{
-				        //DenseVector x(A.coldim()), y(A.rowdim());
-						//for(size_t i = 0; i < A.coldim(); ++i) F.init(x[i], i);
-						//for(size_t i = 0; i < A.rowdim(); ++i) F.init(y[i], i);
-						A.apply(ya, x);
-						//for(int j = 0; j < A.rowdim(); ++j)
-						//	report << ya[j] << " ";
-						//report << std::endl;
-					}
-				//LinBox::commentator.stop (MSG_STATUS (true), (const char *) 0, "testApply");
-				t.stop();
-				std::cout << t.time() << ", ";
-				//std::cout << " -- testblackbox: time of quad -- " << t.time() << std::endl;
-				//t.clear();
-				//t.start();
-				//for(size_t i = 0; i < 3; ++i )
-				//B.apply(yb, x);
-				//t.stop();
-				//std::cout << t.time() << ")" << endl;
-				//std::cout << " -- testblackbox: time of zo  -- " << t.time() << std::endl;
-			}
-
-		//if (A.rowdim() >= largeThresh)
-			{
-				//LinBox::commentator.start ("\t--Timing Test(v^T A)", "testApplyTranspose", 1);
-				//A.applyTranspose(x, y);
-	  			//LinBox::commentator.stop (MSG_STATUS (true), (const char *) 0, "testApplyTranspose");
-	   		}
-	   	
-	} // timing test block
-#endif
-#if 0	
-	/*  Testing against constructed dense matrix doesn't really add much.  
-	    May be useful to see the matrix in the report.
-	*/
-	if (A.rowdim() <= smallThresh && A.coldim() <= smallThresh)
-		{
-			LinBox::commentator.start ("\t--Testing A behaves like Dense A", 
-									   "testSmallBlackbox", 1);
-			ret = ret && testSmallBlackbox(F, A);
-			LinBox::commentator.stop (MSG_STATUS (ret), 
-									  (const char *) 0, "testSmallBlackbox");
-		}
-#endif
-	return ret;
-}
- 
-/** Generic blackbox test 5: test several sizes
- * 
- * Call testTranspose and testLinearity.
- * If large, time apply and applyTranspose.
- * if small, call test
-SmallBlackbox.
- */
-template <class Field, class Blackbox> 
-static bool 
-testBB(Field& F) 
-{
-	bool pass = true;
-
-	Blackbox A(10);
-	if (!testBlackbox<Field, vector<typename Field::Element> >(F, A, 1))
-		pass = false;
-	Blackbox B(10000);
-	if (!testBlackbox<Field, vector<typename Field::Element> >(F, B, 1))
-		pass = false;
-
-	return pass;
-}
-//@}
-
-/// @name Generic field tests
-//@{
-/** Random number test
- *
- * Test that the random iterator over the given field works.
- *
- * Test up to five times, accepting any one, to increase probability of 
- * passing statistical tests.
- */
-template <class Field>
-bool testRandomIterator (const Field &F, const char *text,
-			 unsigned int num_trials,
-			 unsigned int num_categories,
-			 unsigned int hist_len) 
-{
-	std::ostringstream str;
-
-	str << "\t--Testing " << text << "::RandIter" << std::ends;
-
-	LinBox::commentator.start (str.str ().c_str (), "testRandomIterator");
-
-	std::ostream &report = LinBox::commentator.report (LinBox::Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION);
-
-	/* This test either passes or runs forever */
-	for (int i = 1; 
-	     !  testRandomIteratorStep (F, text, num_trials, num_categories, hist_len) ;
-	     ++i ){
-		if (0 == i % 10)  
-			report << "Warning! Probable failure of uniformity" << std::endl;
-		};
-
-	LinBox::commentator.stop (MSG_STATUS (true), (const char *) 0, "testRandomIterator");
-	return true;
-
-}
-
-/* Random number test
- *
- * Test that the random iterator over the given field works
- */
-
-template <class Field>
-bool testRandomIteratorStep (const Field &F,
-			 const char *text,
-			 unsigned int num_trials,
-			 unsigned int num_categories,
-			 unsigned int hist_len) 
-{
-	//std::ostringstream str;
-
-	//str << "\t--Testing " << text << "::RandIter" << std::ends;
-
-	//LinBox::commentator.start (str.str ().c_str (), "testRandomIteratorStep");
-	std::ostream &report = LinBox::commentator.report (LinBox::Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION);
-
-	bool ret = true;
-
-	LinBox::integer card;
-	unsigned int i;
-	std::vector<int> categories1 (num_categories, 0);
-	std::vector<int> categories2 (num_categories, 0);
-	std::list<std::vector<int> > diff_categories;
-	std::list<typename Field::Element> x_queue;
-
-	F.cardinality (card);
-
-	typename Field::RandIter iter (F);
-	typename Field::Element x, x_prev, x_prev2, d;
-
-	std::list<std::vector<int> >::iterator diff_cat_iter;
-
-	for (i = 0; i < hist_len; ++i)
-		diff_categories.push_back (std::vector<int> (num_categories, 0));
-
-	// I make the simplifying assumption that field elements are actually
-	// C++ ints. Otherwise, I don't know how to place the numbers into
-	// categories in any well-defined manner.
-	for (i = 0; i < num_trials; ++i) {
-		F.assign (x_prev2, x_prev);
-		F.assign (x_prev, x);
-
-		iter.random (x);
-
-		categories1[x % num_categories]++;
-		categories2[(unsigned int) (double (x) / double (card) * num_categories)]++;
-
-		typename std::list<typename Field::Element>::iterator x_queue_iter = x_queue.begin ();
-		diff_cat_iter = diff_categories.begin ();
-
-		for (; x_queue_iter != x_queue.end (); ++x_queue_iter, ++diff_cat_iter) {
-			F.sub (d, *x_queue_iter, x);
-			(*diff_cat_iter)[d % num_categories]++;
-		}
-
-		x_queue.push_front (x);
-
-		while (x_queue.size () > hist_len)
-			x_queue.pop_back ();
-	}
-
-	double p, chi_squared = 0.0;
-
-	for (i = 0; i < num_categories; ++i)
-		chi_squared += pow (double (categories1[i]) -
-				    double (num_trials) / double (num_categories), 2);
-
-	p = chiSquaredCDF (chi_squared * num_categories / num_trials, num_categories - 1);
-
-	report << "Test of distribution uniformity (low-order): chi^2 = "
-	       << chi_squared * num_categories / num_trials << std::endl;
-	report << "Test of distribution uniformity (low-order):     p = " << p << std::endl;
-
-	if (p < 0.05 || p > 0.95) {
-		LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-			<< "ERROR: Random iterator's values do not appear to be uniformly distributed"
-			<< std::endl;
-		ret = false;
-	}
-
-	chi_squared = 0.0;
-
-	for (i = 0; i < num_categories; ++i)
-		chi_squared += pow (double (categories2[i]) -
-				    double (num_trials) / double (num_categories), 2);
-
-	p = chiSquaredCDF (chi_squared * num_categories / num_trials, num_categories - 1);
-
-	report << "Test of distribution uniformity (high-order): chi^2 = "
-	       << chi_squared * num_categories / num_trials << std::endl;
-	report << "Test of distribution uniformity (high-order):     p = " << p << std::endl;
-
-	if (p < 0.05 || p > 0.95) {
-		LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-			<< "ERROR: Random iterator's values do not appear to be uniformly distributed"
-			<< std::endl;
-		ret = false;
-	}
-
-	diff_cat_iter = diff_categories.begin ();
-
-	int idx = 0;
-
-	for (; diff_cat_iter != diff_categories.end (); ++diff_cat_iter, ++idx) {
-		chi_squared = 0.0;
-
-		for (i = 0; i < num_categories; ++i)
-			chi_squared += pow (double ((*diff_cat_iter)[i]) -
-					    double (num_trials) / double (num_categories), 2);
-
-		p = chiSquaredCDF (chi_squared * num_categories / num_trials, num_categories - 1);
-
-		report << "Test of " << idx + 1 << " spacing: chi^2 = "
-		       << chi_squared * num_categories / num_trials << std::endl;
-		report << "Test of " << idx + 1 << " spacing:     p = " << p << std::endl;
-
-		if (p < 0.05 || p > 0.95) {
-			LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: Difference values do not appear to be uniformly distributed"
-				<< std::endl;
-			ret = false;
-		}
-	}
-
-	//LinBox::commentator.stop (MSG_STATUS (ret), (const char *) 0, "testRandomIteratorStep");
-	return ret;
-}
-//@}
-/// @name Vector operation tests
-//@{
-
-/** Test 1: Dot product of vectors
- *
- * Construct two random vectors and compute their dot product
- *
- * F - Field over which to perform computations
- * n - Dimension to which to make vectors
- * stream1 - Stream for first family of vectors
- * stream2 - Stream for second family of vectors
- *
- * Return true on success and false on failure
- */
-
-template <class Field, class Vector1, class Vector2>
-static bool testDotProduct (Field &F, const char *text, LinBox::VectorStream<Vector1> &stream1, LinBox::VectorStream<Vector2> &stream2) 
-{
-	std::ostringstream str;
-
-	str << "\t--Testing " << text << " dot product" << std::ends;
-	LinBox::commentator.start (str.str ().c_str (), "testDotProduct", stream1.m ());
-
-	bool ret = true;
-
-	Vector1 v1;
-	Vector2 v2;
-	typename Field::Element sigma, rho;
-
-	LinBox::VectorDomain<Field> VD (F);
-
-	size_t j;
-
-	LinBox::VectorWrapper::ensureDim (v1, stream1.n ());
-	LinBox::VectorWrapper::ensureDim (v2, stream2.n ());
-
-	LinBox::Timer timer;
-	double totaltime = 0.0;
-
-	while (stream1 && stream2) {
-		LinBox::commentator.startIteration (stream1.j ());
-
-		F.init (sigma, 0);
-
-		stream1.next (v1);
-		stream2.next (v2);
-
-		for (j = 0; j < stream1.n (); j++)
-			F.axpyin (sigma,
-				  LinBox::VectorWrapper::constRef<Field> (v1, j),
-				  LinBox::VectorWrapper::constRef<Field> (v2, j));
-
-		std::ostream &report = LinBox::commentator.report (LinBox::Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
-		report << "Input vector 1:  ";
-		VD.write (report, v1) << std::endl;
-
-		report << "Input vector 2:  ";
-		VD.write (report, v2) << std::endl;
-
-		timer.start ();
-		VD.dot (rho, v1, v2);
-		timer.stop ();
-		totaltime += timer.realtime ();
-
-		report << "True dot product: ";
-		F.write (report, sigma) << std::endl;
-
-		report << "Dot product from vector domain: ";
-		F.write (report, rho) << std::endl;
-
-		if (!F.areEqual (sigma, rho)) {
-			ret = false;
-			LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: Dot products are not equal" << std::endl;
-		}
-
-		LinBox::commentator.stop ("done");
-		LinBox::commentator.progress ();
-	}
-
-	LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, TIMING_MEASURE)
-		<< "Average time for dot product: " << totaltime / stream1.m () << std::endl;
-
-	LinBox::commentator.stop (MSG_STATUS (ret), (const char *) 0, "testDotProduct");
-
-	stream1.reset ();
-	stream2.reset ();
-
-	return ret;
-}
-
-/** Test 2: Vector-vector addition, vector-scalar multiply
- *
- * Construct two random vectors x and y and a random element a and compute (x +
- * a*y) and a*(y + a^-1*x) using vector add, sub, and mul. Check whether the
- * results are equal.
- *
- * F - Field over which to perform computations
- * n - Dimension to which to make vectors
- * iterations - Number of iterations over which to run
- *
- * Return true on success and false on failure
- */
-
-template <class Field, class Vector>
-static bool testAddMul (Field &F, const char *text, LinBox::VectorStream<Vector> &stream1, LinBox::VectorStream<Vector> &stream2) 
-{
-	std::ostringstream str;
-
-	str << "\t--Testing " << text << " vector add, mul" << std::ends;
-	LinBox::commentator.start (str.str ().c_str (), "testAddMul", stream1.m ());
-
-	bool ret = true;
-	bool iter_passed;
-
-	Vector v1, v2, v3, v4;
-	typename Field::Element a;
-	typename Field::Element ainv;
-	typename Field::Element aneg;
-	typename Field::RandIter r (F);
-
-	LinBox::VectorWrapper::ensureDim (v1, stream1.n ());
-	LinBox::VectorWrapper::ensureDim (v2, stream2.n ());
-	LinBox::VectorWrapper::ensureDim (v3, stream1.n ());
-	LinBox::VectorWrapper::ensureDim (v4, stream1.n ());
-
-	LinBox::VectorDomain<Field> VD (F);
-
-	while (stream1 && stream2) {
-		LinBox::commentator.startIteration (stream1.j ());
-
-		iter_passed = true;
-
-		stream1.next (v1);
-		stream2.next (v2);
-
-		do r.random (a); while (F.isZero (a));
-
-		std::ostream &report = LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-		report << "Input vector 1:  ";
-		VD.write (report, v1) << std::endl;
-
-		report << "Input vector 2:  ";
-		VD.write (report, v2) << std::endl;
-
-		report << "Element a:  ";
-		F.write (report, a) << std::endl;
-
-		F.inv (ainv, a);
-		F.neg (aneg, a);
-		VD.mul (v3, v1, ainv);
-		report << "          a^-1 * x = ";
-		VD.write (report, v3) << std::endl;
-		report.flush ();
-
-		VD.addin (v3, v2);
-		report << "      y + a^-1 * x = ";
-		VD.write (report, v3) << std::endl;
-		report.flush ();
-
-		VD.mulin (v2, a);
-		report << "             a * y = ";
-		VD.write (report, v2) << std::endl;
-		report.flush ();
-
-		VD.add (v4, v1, v2);
-		report << "         x + a * y = ";
-		VD.write (report, v4) << std::endl;
-		report.flush ();
-
-		VD.mulin (v3, a);
-		report << "a * (y + a^-1 * x) = ";
-		VD.write (report, v3) << std::endl;
-		report.flush ();
-
-		if (!VD.areEqual (v3, v4))
-			ret = iter_passed = false;
-
-		if (!iter_passed)
-			LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: (x + a*y) != a*(y + a^-1*x)" << std::endl;
-
-		LinBox::commentator.stop ("done");
-		LinBox::commentator.progress ();
-	}
-
-	LinBox::commentator.stop (MSG_STATUS (ret), (const char *) 0, "testAddMul");
-
-	stream1.reset ();
-	stream2.reset ();
-
-	return ret;
-}
-
-/** Test 3: Vector-vector subtraction, vector-scalar multiply
- *
- * Construct two random vectors x and y and a random element a and compute (x -
- * a*y) and a*(a^-1*x - y) using vector add, sub, and mul. Check whether the
- * results are equal.
- *
- * F - Field over which to perform computations
- * n - Dimension to which to make vectors
- * iterations - Number of iterations over which to run
- *
- * Return true on success and false on failure
- */
-
-template <class Field, class Vector>
-static bool testSubMul (Field &F, const char *text, LinBox::VectorStream<Vector> &stream1, LinBox::VectorStream<Vector> &stream2) 
-{
-	std::ostringstream str;
-
-	str << "\t--Testing " << text << " vector sub, mul" << std::ends;
-	LinBox::commentator.start (str.str ().c_str (), "testSubMul", stream1.m ());
-
-	bool ret = true;
-	bool iter_passed;
-
-	Vector v1, v2, v3, v4;
-	typename Field::Element a;
-	typename Field::Element ainv;
-	typename Field::Element aneg;
-	typename Field::RandIter r (F);
-
-	LinBox::VectorWrapper::ensureDim (v1, stream1.n ());
-	LinBox::VectorWrapper::ensureDim (v2, stream2.n ());
-	LinBox::VectorWrapper::ensureDim (v3, stream1.n ());
-	LinBox::VectorWrapper::ensureDim (v4, stream1.n ());
-
-	LinBox::VectorDomain<Field> VD (F);
-
-	while (stream1 && stream2) {
-		LinBox::commentator.startIteration (stream1.j ());
-
-		iter_passed = true;
-
-		stream1.next (v1);
-		stream2.next (v2);
-
-		do r.random (a); while (F.isZero (a));
-
-		std::ostream &report = LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-		report << "Input vector 1:  ";
-		VD.write (report, v1) << std::endl;
-
-		report << "Input vector 2:  ";
-		VD.write (report, v2) << std::endl;
-
-		report << "Element a:  ";
-		F.write (report, a) << std::endl;
-
-		F.inv (ainv, a);
-		F.neg (aneg, a);
-		VD.mul (v3, v1, ainv);
-		report << "          a^-1 * x = ";
-		VD.write (report, v3) << std::endl;
-		report.flush ();
-
-		VD.subin (v3, v2);
-		report << "      a^-1 * x - y = ";
-		VD.write (report, v3) << std::endl;
-		report.flush ();
-
-		VD.mulin (v2, a);
-		report << "             a * y = ";
-		VD.write (report, v2) << std::endl;
-		report.flush ();
-
-		VD.sub (v4, v1, v2);
-		report << "         x - a * y = ";
-		VD.write (report, v4) << std::endl;
-		report.flush ();
-
-		VD.mulin (v3, a);
-		report << "a * (y - a^-1 * x) = ";
-		VD.write (report, v4) << std::endl;
-		report.flush ();
-
-		if (!VD.areEqual (v3, v4))
-			ret = iter_passed = false;
-
-		if (!iter_passed)
-			LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: (x - a*y) != a*(a^-1*x - y)" << std::endl;
-
-		LinBox::commentator.stop ("done");
-		LinBox::commentator.progress ();
-	}
-
-	LinBox::commentator.stop (MSG_STATUS (ret), (const char *) 0, "testSubMul");
-
-	stream1.reset ();
-	stream2.reset ();
-
-	return ret;
-}
-
-/** Test 4: Vector-vector axpy
- *
- * Construct two random vectors x and y and a random element a and compute (x +
- * a*y) - a*(y + a^-1*x) using vector axpy. Check whether the result is 0.
- *
- * F - Field over which to perform computations
- * n - Dimension to which to make vectors
- * iterations - Number of iterations over which to run
- *
- * Return true on success and false on failure
- */
-
-template <class Field, class Vector>
-static bool testAXPY (Field &F, const char *text, LinBox::VectorStream<Vector> &stream1, LinBox::VectorStream<Vector> &stream2) 
-{
-	std::ostringstream str;
-	str << "\t--Testing " << text << " vector axpy" << std::ends;
-	LinBox::commentator.start (str.str ().c_str (), "testAXPY", stream1.m ());
-
-	bool ret = true;
-	bool iter_passed;
-
-	Vector v1, v2, v3, v4;
-	typename Field::Element a;
-	typename Field::Element ainv;
-	typename Field::Element aneg;
-	typename Field::RandIter r (F);
-
-	LinBox::VectorWrapper::ensureDim (v1, stream1.n ());
-	LinBox::VectorWrapper::ensureDim (v2, stream2.n ());
-	LinBox::VectorWrapper::ensureDim (v3, stream1.n ());
-	LinBox::VectorWrapper::ensureDim (v4, stream1.n ());
-
-	LinBox::VectorDomain<Field> VD (F);
-
-	while (stream1 && stream2) {
-		LinBox::commentator.startIteration (stream1.j ());
-
-		iter_passed = true;
-
-		stream1.next (v1);
-		stream2.next (v2);
-
-		do r.random (a); while (F.isZero (a));
-
-		std::ostream &report = LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-		report << "Input vector 1:  ";
-		VD.write (report, v1) << std::endl;
-
-		report << "Input vector 2:  ";
-		VD.write (report, v2) << std::endl;
-
-		report << "Element a:  ";
-		F.write (report, a) << std::endl;
-
-		F.inv (ainv, a);
-		F.neg (aneg, a);
-		VD.axpy (v3, a, v2, v1);
-		VD.axpy (v4, ainv, v1, v2);
-		VD.axpyin (v3, aneg, v4);
-
-		report << "Output vector:  ";
-		VD.write (report, v3) << std::endl;
-
-		if (!VD.isZero (v3))
-			ret = iter_passed = false;
-
-		if (!iter_passed)
-			LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: (x + a*y) - a*(y + a^-1*x) != 0" << std::endl;
-
-		LinBox::commentator.stop ("done");
-		LinBox::commentator.progress ();
-	}
-
-	LinBox::commentator.stop (MSG_STATUS (ret), (const char *) 0, "testAXPY");
-
-	stream1.reset ();
-	stream2.reset ();
-
-	return ret;
-}
-
-/** Test 5: Copy and areEqual
- *
- * Constructs a random vector and copies it to another vector. Then checks equality.
- *
- * F - Field over which to perform computations
- * text - Text to use for test
- * stream - Stream generating vectors
- * stream2 - Dummy stream of second vector type to trick the compiler
- *
- * Return true on success and false on failure
- */
-template <class Field, class Vector1, class Vector2>
-static bool testCopyEqual (Field &F, const char *text, LinBox::VectorStream<Vector1> &stream, LinBox::VectorStream<Vector2> &stream2) 
-{
-	std::ostringstream str;
-
-	str << "\t--Testing " << text << " vector copy, areEqual" << std::ends;
-	LinBox::commentator.start (str.str ().c_str (), "testCopyEqual", stream.m ());
-
-	bool ret = true;
-	bool iter_passed;
-
-	Vector1 v;
-	Vector2 w;
-
-	LinBox::VectorWrapper::ensureDim (v, stream.n ());
-	LinBox::VectorWrapper::ensureDim (w, stream.n ());
-
-	LinBox::VectorDomain<Field> VD (F);
-
-	while (stream) {
-		LinBox::commentator.startIteration (stream.j ());
-
-		iter_passed = true;
-
-		stream.next (v);
-		VD.copy (w, v);
-
-		std::ostream &report = LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-		report << "Input vector:   ";
-		VD.write (report, v) << std::endl;
-
-		report << "Output vector:  ";
-		VD.write (report, w) << std::endl;
-
-		if (!VD.areEqual (v, w))
-			ret = iter_passed = false;
-
-		if (!iter_passed)
-			LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: Vectors are not equal" << std::endl;
-
-		LinBox::commentator.stop ("done");
-		LinBox::commentator.progress ();
-	}
-
-	LinBox::commentator.stop (MSG_STATUS (ret), (const char *) 0, "testCopyEqual");
-
-	stream.reset ();
-	stream2.reset ();
-
-	return ret;
-}
-//@}
-
-#endif // __TEST_GENERIC_H
diff --git a/tests/test-generic.h b/tests/test-generic.h
index 4be285f..6cafce6 100644
--- a/tests/test-generic.h
+++ b/tests/test-generic.h
@@ -1,5 +1,5 @@
-/* -*- mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-
+/* -*- 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
 /* linbox/tests/test-generic.h
  * Copyright (C) 2001, 2002 Bradford Hovinen
  * See COPYING for license information.
@@ -20,11 +20,11 @@
  * 2007June bds split into three files
  */
 
-#ifndef __TEST_GENERIC_H
-#define __TEST_GENERIC_H
+#ifndef __LINBOX_test_generic_H
+#define __LINBOX_test_generic_H
 
 #include "test-field.h"
 #include "test-blackbox.h"
 #include "test-vector-domain.h"
 
-#endif // __TEST_GENERIC_H
+#endif // __LINBOX_test_generic_H
diff --git a/tests/test-getentry.C b/tests/test-getentry.C
index 1ff82ab..f105e70 100644
--- a/tests/test-getentry.C
+++ b/tests/test-getentry.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-getentry.C
  * Copyright (C) 2002 Bradford Hovinen
@@ -10,6 +11,15 @@
  * See COPYING for license information
  */
 
+
+/*! @file  tests/test-getentry.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test NO DOC
+ */
+
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -22,6 +32,7 @@
 #include "linbox/util/commentator.h"
 #include "linbox/field/modular-int32.h"
 #include "linbox/solutions/getentry.h"
+#include "linbox/blackbox/compose.h"
 #include "linbox/blackbox/diagonal.h"
 #include "linbox/blackbox/scalar-matrix.h"
 #include "linbox/blackbox/sparse.h"
@@ -30,17 +41,26 @@
 
 using namespace LinBox;
 
-/* Test 1: getEntry of random diagonal matrix
- *
- * Construct a random diagonal matrix and check that its computed getEntry is the
- * correct i,j element
- *
- * F - Field over which to perform computations
- * stream - Stream that comprises source of diagonal vectors
- *
- * Return true on success and false on failure
- */
-
+/* getEntry of generic blackbox matrix */
+template <class Field>
+bool testGenericBBgetEntry (const Field &F, size_t n)
+{
+	bool ret = true;
+    typename Field::Element s, x, z;
+	ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+	F.init(x, 0);
+	F.init(s, 2);
+	F.init(z, 0);
+	ScalarMatrix<Field> B(F, n, s);
+	typename GetEntryTags::GenericBB t;
+	//getEntry(x, B, 0, n-1, t);
+	if (n > 1 && !F.isZero(x)) ret = false;
+	getEntry(x, B, 0, 0, t);
+	if ( !F.areEqual(s, x)) ret = false;
+	if (!ret) report << "testGenericBBgetEntry failure" << std::endl;
+	return ret;
+}
+/* getEntry of scalar matrix */
 template <class Field>
 bool testScalarMatrixgetEntry (const Field &F, size_t n)
 {
@@ -48,7 +68,7 @@ bool testScalarMatrixgetEntry (const Field &F, size_t n)
 	commentator.start ("Testing scalar matrix getEntry", "", 1);
 	ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
 	report << "scalarmatrix getEntry test (using specialization)" << endl;
-    	typename Field::Element s, t, r, th; 
+    typename Field::Element s, t, r, th;
 	F.init(r, 0);
 	F.init(s, 2);
 	F.init(th, 2);
@@ -63,26 +83,27 @@ bool testScalarMatrixgetEntry (const Field &F, size_t n)
 		report << "n-1 x n-1" << t << endl;
 	if (!F.areEqual(t, th)) {
 		report << "bad scalar matrix getEntry " << t << ", should be " << th << endl;
-		ret= false; 
-	} 
+		ret= false;
+	}
 	else ret= true;
 	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testScalarMatrixgetEntry");
 	return ret;
 }
 
+/* getEntry of sparse matrix */
 template <class Field>
 bool testSparseMatrixgetEntry (const Field &F, size_t n)
 {
 	commentator.start ("Building sparse matrix", "", 1);
 	bool ret = true;
 	ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-    	typename Field::Element s, t, th; 
+    	typename Field::Element s, t, th;
 	F.init(s, 2);
 	size_t m = (n > 10 ? 10 : n);
 	F.init(th, 2*m);
 	SparseMatrix<Field> B(F, n, n);
 	for (size_t i = 0; i <  m; ++i)
-		for (size_t j = 0; j < m; ++j) 
+		for (size_t j = 0; j < m; ++j)
 			B.setEntry(i,j,s);
 	commentator.stop ("", "done");
 	commentator.start ("Testing sparse matrix getEntry", "", 1);
@@ -92,41 +113,42 @@ bool testSparseMatrixgetEntry (const Field &F, size_t n)
 	if (!F.areEqual(t, s)) {
 	report << "bad sparse matrix getEntry 1,1 " << t << ", should be " << s << endl;
 
-		ret = false; 
-	} 
+		ret = false;
+	}
 	getEntry(t, B, 0, n-1);
 	if (!F.areEqual(t, s)) {
 	report << "bad sparse matrix getEntry 1,n" << t << ", should be " << s << endl;
 
-		ret = false; 
-	} 
+		ret = false;
+	}
 	getEntry(t, B, n-1, 0);
 	if (!F.areEqual(t, s)) {
 	report << "bad sparse matrix getEntry n,1" << t << ", should be " << s << endl;
 
-		ret = false; 
-	} 
+		ret = false;
+	}
 	getEntry(t, B, n-1, n-1);
 	if (!F.areEqual(t, s)) {
 	report << "bad sparse matrix getEntry n,n" << t << ", should be " << s << endl;
 
-		ret = false; 
-	} 
+		ret = false;
+	}
 	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testSparseMatrixgetEntry");
 	return ret;
 }
 
+/* getEntry of dense matrix */
 template <class Field>
 static bool testDenseMatrixgetEntry (const Field &F, size_t n)
 {
 	bool ret = true;
-    	typename Field::Element s, t, th; 
+    	typename Field::Element s, t, th;
 	F.init(s, 2);
 	size_t m = (n > 10 ? 10 : n);
 	F.init(th, 2*m);
 	DenseMatrix<Field> B(F, n, n);
 	for (size_t i = 0; i <  m; ++i)
-		for (size_t j = 0; j < n; ++j) 
+		for (size_t j = 0; j < n; ++j)
 			B.setEntry(i, j, s);
 	commentator.start ("Testing dense matrix getEntry", "", 1);
 	ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
@@ -136,32 +158,33 @@ static bool testDenseMatrixgetEntry (const Field &F, size_t n)
 	if (!F.areEqual(t, s)) {
 		report << "bad dense matrix getEntry 1,1 " << t << ", should be " << s << endl;
 
-		ret = false; 
-	} 
+		ret = false;
+	}
         getEntry(t, B, 0, n-1);
 	if (!F.areEqual(t, s)) {
 		report << "bad dense matrix getEntry 1,n " << t << ", should be " << s << endl;
 
-		ret = false; 
-	} 
+		ret = false;
+	}
         getEntry(t, B, n-1, 0);
 	if (!F.areEqual(t, s)) {
 		report << "bad dense matrix getEntry n,1 " << t << ", should be " << s << endl;
 
-		ret = false; 
-	} 
+		ret = false;
+	}
         getEntry(t, B, n-1, n-1);
 	if (!F.areEqual(t, s)) {
 		report << "bad dense matrix getEntry n,n " << t << ", should be " << s << endl;
 
-		ret = false; 
-	} 
+		ret = false;
+	}
 	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testDenseMatrixgetEntry");
 	return ret;
 }
 
+/* getEntry of diagonal matrix */
 template <class Field>
-static bool testDiagonalgetEntry (const Field &F, VectorStream<vector<typename Field::Element> > &stream) 
+static bool testDiagonalgetEntry (const Field &F, VectorStream<vector<typename Field::Element> > &stream)
 {
 	typedef vector <typename Field::Element> Vector;
 	typedef Diagonal <Field> Blackbox;
@@ -204,7 +227,7 @@ static bool testDiagonalgetEntry (const Field &F, VectorStream<vector<typename F
 			F.addin (res, getEntry (ge, D, i, i));
                 F.addin(res, getEntry (ge, D, 0,stream.n ()-1));
                 F.addin(res, getEntry (ge, D, stream.n ()-1, 0));
-               
+
 
 		report << "Computed getEntry: ";
 		F.write (report, res);
@@ -224,6 +247,42 @@ static bool testDiagonalgetEntry (const Field &F, VectorStream<vector<typename F
 	return ret;
 }
 
+/* getEntry of composed blackbox with diagonal component*/
+template <class Field>
+bool testSpecialCDgetEntry (const Field &F, size_t n)
+{
+	bool ret = true;
+	typedef typename Field::Element Elt;
+	typedef ScalarMatrix<Field> BB;
+	typedef Diagonal<Field> DD;
+    Elt s, x, t, u;
+	ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+	F.init(x, 0);
+	F.init(s, 2);
+	F.init(t, 0);
+	F.init(u, 0);
+	F.mul(u, s, t);
+	BB B(F, n, s);
+	vector<Elt> d(n, t);
+	DD D(F, d);
+	Compose<DD, BB> CDB (D, B);
+	Compose<BB, DD> CBD (B, D);
+	Compose<DD, DD> CDD (D, D);
+	getEntry(x, CDB, 0, n-1);
+	if (n > 1 && !F.isZero(x)) ret = false;
+	getEntry(x, CDB, 0, 0);
+	if ( !F.areEqual(u, x)) ret = false;
+	getEntry(x, CBD, 0, n-1);
+	if (n > 1 && !F.isZero(x)) ret = false;
+	getEntry(x, CBD, 0, 0);
+	if ( !F.areEqual(u, x)) ret = false;
+	getEntry(x, CDD, 0, n-1);
+	if (n > 1 && !F.isZero(x)) ret = false;
+	getEntry(x, CDD, 0, 0);
+	if ( !F.areEqual(F.mul(u,t,t), x)) ret = false;
+	if (!ret) report << "testSpecialCDgetEntry failure" << std::endl;
+	return ret;
+}
 int main (int argc, char **argv)
 {
 	bool pass = true;
@@ -237,10 +296,10 @@ int main (int argc, char **argv)
 		{ 'n', "-n N", "Set dimension of test matrices to NxN.", TYPE_INT,     &n },
 		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].",  TYPE_INTEGER, &q },
 		{ 'i', "-i I", "Perform each test for I iterations.",     TYPE_INT,     &iterations },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
-	typedef Modular<int32> Field;
+	typedef Modular<int32_t> Field;
 	typedef vector<Field::Element> Vector;
 
 	parseArguments (argc, argv, args);
@@ -251,10 +310,12 @@ int main (int argc, char **argv)
 
 	RandomDenseStream<Field, Vector> stream (F, n, iterations);
 
+	if (!testGenericBBgetEntry (F, n)) pass = false;
 	if (!testScalarMatrixgetEntry (F, n)) pass = false;
 	if (!testSparseMatrixgetEntry (F, n)) pass = false;
 	if (!testDenseMatrixgetEntry (F, n)) pass = false;
 	if (!testDiagonalgetEntry (F, stream)) pass = false;
+	if (!testSpecialCDgetEntry (F, n)) pass = false;
 
 	commentator.stop("getEntry solution test suite");
 	return pass ? 0 : -1;
diff --git a/tests/test-gf2.C b/tests/test-gf2.C
index c83e207..2bc3fa1 100644
--- a/tests/test-gf2.C
+++ b/tests/test-gf2.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-gf2.C
  * Copyright (C) 2003 Bradford Hovinen,
@@ -15,6 +16,15 @@
  * See COPYING for license information.
  */
 
+
+/*! @file  tests/test-gf2.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test NO DOC
+ */
+
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -26,15 +36,20 @@
 #include "linbox/field/gf2.h"
 #include "linbox/field/modular.h"
 
-#include "test-generic-for-quad.h"
+#include "test-field.h"
 // #include "test-generic.h"
 // #include "test-vector-domain.h"
 
 using namespace LinBox;
+//using uint16_t;
+//using uint32_t;
+
+#warning "much of the code is dead here"
 
-static bool testDotProductGF2 (const GF2 &F, const char *desc,
+#if 0 /*  dead code */
+static bool testDotProductGF2 (const GF2 &F, const char *, //desc,
 			       VectorStream<Vector<GF2>::Dense> &stream1,
-			       VectorStream<Vector<GF2>::Dense> &stream2) 
+			       VectorStream<Vector<GF2>::Dense> &stream2)
 {
 	LinBox::commentator.start ("Testing GF2 dot product (dense/dense)", "testDotProduct", stream1.size ());
 
@@ -42,12 +57,12 @@ static bool testDotProductGF2 (const GF2 &F, const char *desc,
 
 	Vector<GF2>::Dense v1, v2;
 
-	Modular<uint16> MF (2);
-	VectorDomain<Modular<uint16> > MF_VD (MF);
+	Modular<uint16_t> MF (2);
+	VectorDomain<Modular<uint16_t> > MF_VD (MF);
 
-	LinBox::Vector<Modular<uint16> >::Dense w1 (stream1.dim ()), w2 (stream1.dim ());
+	LinBox::Vector<Modular<uint16_t> >::Dense w1 (stream1.dim ()), w2 (stream1.dim ());
 
-	uint16 sigma;
+	uint16_t sigma;
 	bool rho;
 
 	LinBox::VectorDomain<GF2> VD (F);
@@ -57,7 +72,7 @@ static bool testDotProductGF2 (const GF2 &F, const char *desc,
 
 	Vector<GF2>::Dense::const_iterator i1;
 	Vector<GF2>::Dense::const_iterator i2;
-	Vector<Modular<uint16> >::Dense::iterator j1, j2;
+	Vector<Modular<uint16_t> >::Dense::iterator j1, j2;
 
 	Timer timer;
 	double totaltime = 0.0;
@@ -125,9 +140,9 @@ static bool testDotProductGF2 (const GF2 &F, const char *desc,
 	return ret;
 }
 
-static bool testDotProductGF2 (const GF2 &F, const char *desc,
+static bool testDotProductGF2 (const GF2 &F, const char *, //desc,
 			       VectorStream<Vector<GF2>::Dense> &stream1,
-			       VectorStream<Vector<GF2>::Sparse> &stream2) 
+			       VectorStream<Vector<GF2>::Sparse> &stream2)
 {
 	LinBox::commentator.start ("Testing GF2 dot product (dense/sparse)", "testDotProduct", stream1.size ());
 
@@ -136,13 +151,13 @@ static bool testDotProductGF2 (const GF2 &F, const char *desc,
 	Vector<GF2>::Dense v1;
 	Vector<GF2>::Sparse v2;
 
-	Modular<uint16> MF (2);
-	VectorDomain<Modular<uint16> > MF_VD (MF);
+	Modular<uint16_t> MF (2);
+	VectorDomain<Modular<uint16_t> > MF_VD (MF);
 
-	LinBox::Vector<Modular<uint16> >::Dense w1 (stream1.dim ());
-	LinBox::Vector<Modular<uint16> >::SparseSeq w2;
+	LinBox::Vector<Modular<uint16_t> >::Dense w1 (stream1.dim ());
+	LinBox::Vector<Modular<uint16_t> >::SparseSeq w2;
 
-	uint16 sigma;
+	uint16_t sigma;
 	bool rho;
 
 	LinBox::VectorDomain<GF2> VD (F);
@@ -151,7 +166,7 @@ static bool testDotProductGF2 (const GF2 &F, const char *desc,
 
 	Vector<GF2>::Dense::const_iterator i1;
 	Vector<GF2>::Sparse::const_iterator i2;
-	Vector<Modular<uint16> >::Dense::iterator j1;
+	Vector<Modular<uint16_t> >::Dense::iterator j1;
 
 	Timer timer;
 	double totaltime = 0.0;
@@ -173,7 +188,7 @@ static bool testDotProductGF2 (const GF2 &F, const char *desc,
 		w2.clear ();
 
 		for (i2 = v2.begin (); i2 != v2.end (); ++i2)
-			w2.push_back (std::pair<size_t, uint16> (*i2, 1));
+			w2.push_back (std::pair<size_t, uint16_t> (*i2, 1));
 
 		std::ostream &report = LinBox::commentator.report (LinBox::Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
 		report << "Input vector 1:  ";
@@ -216,6 +231,7 @@ static bool testDotProductGF2 (const GF2 &F, const char *desc,
 
 	return ret;
 }
+#endif
 
 int main (int argc, char **argv)
 {
@@ -231,7 +247,7 @@ int main (int argc, char **argv)
 		{ 't', "-t T", "Number of trials for the random iterator test.", TYPE_INT, &trials },
 		{ 'c', "-c C", "Number of categories for the random iterator test.", TYPE_INT, &categories },
 		{ 'H', "-H H", "History level for random iterator test.", TYPE_INT, &hist_level },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
@@ -241,7 +257,7 @@ int main (int argc, char **argv)
 
 	GF2 F;
 
-	uint32 seed = time (NULL);
+	uint32_t seed = time (NULL);
 
 	RandomDenseStreamGF2 stream1 (F, seed, n, iterations), stream2 (F, seed ^ 0xdeadbeef, n, iterations);
 	RandomSparseStreamGF2<Vector<GF2>::Sparse>
@@ -253,41 +269,9 @@ int main (int argc, char **argv)
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
 
 	commentator.start ("Testing GF2", "main", 10);
-	
-	if (!testFieldNegation         (F, "GF2", iterations))      pass = false; commentator.progress ();
-	if (!testFieldInversion        (F, "GF2", iterations))      pass = false; commentator.progress ();
-	if (!testFieldAxioms           (F, "GF2", iterations))      pass = false; commentator.progress ();
-	if (!testFieldAssociativity    (F, "GF2", iterations))      pass = false; commentator.progress ();
-	if (!testFieldCharacteristic   (F, "GF2", iterations))      pass = false; commentator.progress ();
-	if (!testGeometricSummation    (F, "GF2", iterations, 100)) pass = false; commentator.progress ();
-	if (!testFreshmansDream        (F, "GF2", iterations))      pass = false; commentator.progress ();
-	if (!testArithmeticConsistency (F, "GF2", iterations))      pass = false; commentator.progress ();
-	if (!testAxpyConsistency       (F, "GF2", iterations))      pass = false; commentator.progress ();
-
-	commentator.stop (MSG_STATUS (pass), (const char *) 0, "main");
-
-	if (!testRandomIterator (F, "GF2", trials, categories, hist_level)) pass = false;
-
-	commentator.start ("Testing VectorDomain <GF2>", "main");
-
-	if (!testDotProductGF2 (F, "dense/dense", stream1, stream2)) pass = false;
-	if (!testDotProductGF2 (F, "dense/sparse", stream1, stream3)) pass = false;
-
-	if (!testAddMul (F, "dense", stream1, stream2)) pass = false;
-	if (!testAddMul (F, "sparse", stream3, stream4)) pass = false;
-
-	if (!testSubMul (F, "dense", stream1, stream2)) pass = false;
-	if (!testSubMul (F, "sparse", stream3, stream4)) pass = false;
-
-	if (!testAXPY (F, "dense", stream1, stream2)) pass = false;
-	if (!testAXPY (F, "sparse", stream3, stream4)) pass = false;
 
-	if (!testCopyEqual (F, "dense/dense", stream1, stream2)) pass = false;
-	if (!testCopyEqual (F, "dense/sparse", stream1, stream3)) pass = false;
-	if (!testCopyEqual (F, "sparse/dense", stream3, stream1)) pass = false;
-	if (!testCopyEqual (F, "sparse/sparse", stream3, stream4)) pass = false;
 
-	commentator.stop (MSG_STATUS (pass), (const char *) 0, "main");
+	if (!testField (F, "GF2"))      pass = false; commentator.progress ();
 
 #if 0
 	FieldArchetype K(new LargeModular(101));
diff --git a/tests/test-givaro-zpz.C b/tests/test-givaro-zpz.C
index bd59384..5fa8915 100644
--- a/tests/test-givaro-zpz.C
+++ b/tests/test-givaro-zpz.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-givaro-zpz.C
  * Copyright (C) 2002 Pascal Giorgi
@@ -21,6 +22,15 @@
  * Boston, MA 02111-1307, USA.
  */
 
+
+/*! @file  tests/test-givaro-zpz.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test NO DOC
+ */
+
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -45,7 +55,7 @@ int main (int argc, char **argv)
 	static size_t n = 10000;
 	static int iterations = 10;
 	static int e = 3;
-	static int trials = 100000;
+	static int trials = 1000;
 	static int categories = 100;
 	static int hist_level = 1;
 
@@ -58,18 +68,19 @@ int main (int argc, char **argv)
 		{ 't', "-t T", "Number of trials for the random iterator test.", TYPE_INT, &trials },
 		{ 'c', "-c C", "Number of categories for the random iterator test.", TYPE_INT, &categories },
 		{ 'H', "-H H", "History level for random iterator test.", TYPE_INT, &hist_level },
-        { '\0' }
+		END_OF_ARGUMENTS
         };
 
         parseArguments (argc, argv, args);
 
-	//cout << endl << "GivaroZpz<Std16> field test suite" << endl;
+	//cout << endl << "GivaroZpz< ::Givaro::Std16> field test suite" << endl;
 	//cout.flush ();
 	bool pass = true;
-	
-	GivaroZpz<Std16> F1 (q);
-	GivaroZpz<Std32> F2 (q);
-//	GivaroZpz<Log16> F3 (q);
+
+//	GivaroZpz< ::Givaro::Std16> F1 (q); // Does not work with q > 256
+        GivaroZpz< ::Givaro::Std16> F1 ( (q<256?q:integer(101)) ); // Does not work with q > 256
+	GivaroZpz< ::Givaro::Std32> F2 (q);
+//	GivaroZpz< ::Givaro::Log16> F3 (q); // Does not work with q > 256
 	GivaroMontg F3 (39989);
 	GivaroGfq F4 (q, 1);
 	GivaroGfq F5 (11, e);
@@ -80,8 +91,8 @@ int main (int argc, char **argv)
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (4);
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
 
-	if (!runFieldTests (F1, "GivaroZpz<Std16>", iterations, n, false)) pass = false;
-	if (!runFieldTests (F2, "GivaroZpz<Std32>", iterations, n, false)) pass = false;
+	if (!runFieldTests (F1, "GivaroZpz< ::Givaro::Std16>", iterations, n, false)) pass = false;
+	if (!runFieldTests (F2, "GivaroZpz< ::Givaro::Std32>", iterations, n, false)) pass = false;
 	if (!runFieldTests (F3, "GivaroMontg", iterations, n, false)) pass = false;
 	if (!runFieldTests (F4, "GivaroGfq (prime)", iterations, n, false)) pass = false;
 	if (!runFieldTests (F5, "GivaroGfq (simple extension)", iterations, n, false)) pass = false;
@@ -89,8 +100,8 @@ int main (int argc, char **argv)
 	if (!runFieldTests (F7, "GivaroExtension (large polynomial extension)", iterations, n, false)) pass = false;
 
 
-	if (!testRandomIterator (F1,  "GivaroZpz<Std16>", trials, categories, hist_level)) pass = false;
-	if (!testRandomIterator (F2,  "GivaroZpz<Std32>", trials, categories, hist_level)) pass = false;
+	if (!testRandomIterator (F1,  "GivaroZpz< ::Givaro::Std16>", trials, categories, hist_level)) pass = false;
+	if (!testRandomIterator (F2,  "GivaroZpz< ::Givaro::Std32>", trials, categories, hist_level)) pass = false;
 	if (!testRandomIterator (F3,  "GivaroMontgomery", trials, categories, hist_level)) pass = false;
 	if (!testRandomIterator (F4,  "GivaroGfq (prime)", trials, categories, hist_level)) pass = false;
 	if (!testRandomIterator (F5,  "GivaroGfq (simple extension)", trials, categories, hist_level)) pass = false;
@@ -101,27 +112,27 @@ int main (int argc, char **argv)
 
 #if TEST_ARCHETYPES
 
-	GivaroZpz<Std16> * K1g = new GivaroZpz<Std16> (101);
+	GivaroZpz< ::Givaro::Std16> * K1g = new GivaroZpz< ::Givaro::Std16> (101);
 	FieldArchetype K1(K1g);
-	if (!testField<FieldArchetype> (K1, "Testing archetype with envelope of GivaroZpz<Std16> field"))
+	if (!testField<FieldArchetype> (K1, "Testing archetype with envelope of GivaroZpz< ::Givaro::Std16> field"))
 		pass = false;
 	delete K1g;
 #endif
 
 #if TEST_ARCHETYPES
-	GivaroZpz<Std32> * K2g = new GivaroZpz<Std32>(101);
+	GivaroZpz< ::Givaro::Std32> * K2g = new GivaroZpz< ::Givaro::Std32>(101);
 	FieldArchetype K2(K2g);
 
-	if (!testField<FieldArchetype> (K2, "Testing archetype with envelope of GivaroZpz<Std32> field"))
+	if (!testField<FieldArchetype> (K2, "Testing archetype with envelope of GivaroZpz< ::Givaro::Std32> field"))
 		pass = false;
 	delete K2g;
 #endif
 
 #if TEST_ARCHETYPES
-	GivaroZpz<Log16> * K3g = new GivaroZpz<Log16>(101);
+	GivaroZpz< ::Givaro::Log16> * K3g = new GivaroZpz< ::Givaro::Log16>(101);
 	FieldArchetype K3(K3g);
 
-	if (!testField<FieldArchetype> (K3, "Testing archetype with envelope of GivaroZpz<Log16> field"))
+	if (!testField<FieldArchetype> (K3, "Testing archetype with envelope of GivaroZpz< ::Givaro::Log16> field"))
 		pass = false;
 	delete K3g;
 #endif
diff --git a/tests/test-givaro-zpzuns.C b/tests/test-givaro-zpzuns.C
index 38c52df..193fc8b 100644
--- a/tests/test-givaro-zpzuns.C
+++ b/tests/test-givaro-zpzuns.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-givaro-zpz.C
  * Copyright (C) 2002 Pascal Giorgi
@@ -21,6 +22,15 @@
  * Boston, MA 02111-1307, USA.
  */
 
+
+/*! @file  tests/test-givaro-zpzuns.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test NO DOC
+ */
+
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -43,7 +53,7 @@ int main (int argc, char **argv)
 	static size_t n = 10000;
 	static int iterations = 10;
 	static int e;
-	static int trials = 100000;
+	static int trials = 1000;
 	static int categories = 100;
 	static int hist_level = 1;
 
@@ -56,59 +66,59 @@ int main (int argc, char **argv)
 		{ 't', "-t T", "Number of trials for the random iterator test.", TYPE_INT, &trials },
 		{ 'c', "-c C", "Number of categories for the random iterator test.", TYPE_INT, &categories },
 		{ 'H', "-H H", "History level for random iterator test.", TYPE_INT, &hist_level },
-                { '\0' }
+		END_OF_ARGUMENTS
         };
 
         parseArguments (argc, argv, args);
 
-	//cout << endl << "GivaroZpz<Unsigned32> field test suite" << endl;
+	//cout << endl << "GivaroZpz< ::Givaro::Unsigned32> field test suite" << endl;
 	//cout.flush ();
 	bool pass = true;
-	
-	GivaroZpz<Unsigned32> F1 (2);
-	GivaroZpz<Unsigned32> F2 (q);
-	GivaroZpz<Unsigned32> F3 (3);
-	GivaroZpz<Unsigned32> F4 (32749);
-	GivaroZpz<Unsigned32> F5 (65521);
+
+	GivaroZpz< ::Givaro::Unsigned32> F1 (2);
+	GivaroZpz< ::Givaro::Unsigned32> F2 (q);
+	GivaroZpz< ::Givaro::Unsigned32> F3 (3);
+	GivaroZpz< ::Givaro::Unsigned32> F4 (32749);
+	GivaroZpz< ::Givaro::Unsigned32> F5 (65521);
 
 	// Make sure some more detailed messages get printed
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (4);
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
 
-	if (!runFieldTests (F1, "2", iterations, n, false)) pass = false;
+	if (!runFieldTests (F1, "2",     iterations, n, false)) pass = false;
 	if (!runFieldTests (F2, "10733", iterations, n, false)) pass = false;
-	if (!runFieldTests (F3, "3", iterations, n, false)) pass = false;
+	if (!runFieldTests (F3, "3",     iterations, n, false)) pass = false;
 	if (!runFieldTests (F4, "32749", iterations, n, false)) pass = false;
 	if (!runFieldTests (F5, "65521", iterations, n, false)) pass = false;
 
-	if (!testRandomIterator (F1,  "GivaroZpz<Unsigned32>(2)", trials, categories, hist_level)) pass = false;
-	if (!testRandomIterator (F2,  "GivaroZpz<Unsigned32>(10733)", trials, categories, hist_level)) pass = false;
-	if (!testRandomIterator (F3,  "GivaroZpz<Unsigned32>(3)", trials, categories, hist_level)) pass = false;
-	if (!testRandomIterator (F4,  "GivaroZpz<Unsigned32>(32749)", trials, categories, hist_level)) pass = false;
-	if (!testRandomIterator (F5,  "GivaroZpz<Unsigned32>(65521)", trials, categories, hist_level)) pass = false;
+	if (!testRandomIterator (F1,  "GivaroZpz< ::Givaro::Unsigned32>(2)", trials, categories, hist_level)) pass = false;
+	if (!testRandomIterator (F2,  "GivaroZpz< ::Givaro::Unsigned32>(10733)", trials, categories, hist_level)) pass = false;
+	if (!testRandomIterator (F3,  "GivaroZpz< ::Givaro::Unsigned32>(3)", trials, categories, hist_level)) pass = false;
+	if (!testRandomIterator (F4,  "GivaroZpz< ::Givaro::Unsigned32>(32749)", trials, categories, hist_level)) pass = false;
+	if (!testRandomIterator (F5,  "GivaroZpz< ::Givaro::Unsigned32>(65521)", trials, categories, hist_level)) pass = false;
 
 #if TEST_ARCHETYPES
 
-	GivaroZpz<Std16> * K1g = new GivaroZpz<Std16> (101);
+	GivaroZpz< ::Givaro::Std16> * K1g = new GivaroZpz< ::Givaro::Std16> (101);
 	FieldArchetype K1(K1g);
-	if (!testField<FieldArchetype> (K1, "Testing archetype with envelope of GivaroZpz<Std16> field"))
+	if (!testField<FieldArchetype> (K1, "Testing archetype with envelope of GivaroZpz< ::Givaro::Std16> field"))
 		pass = false;
 	delete K1g;
 #endif
 
 #if TEST_ARCHETYPES
-	GivaroZpz<Unsigned32> * K2g = new GivaroZpz<Unsigned32> (101);
+	GivaroZpz< ::Givaro::Unsigned32> * K2g = new GivaroZpz< ::Givaro::Unsigned32> (101);
 	FieldArchetype K2(K2g);
-	if (!testField<FieldArchetype> (K2, "Testing archetype with envelope of GivaroZpz<Unsigned32> field"))
+	if (!testField<FieldArchetype> (K2, "Testing archetype with envelope of GivaroZpz< ::Givaro::Unsigned32> field"))
 		pass = false;
 	delete K2g;
 #endif
 
 #if TEST_ARCHETYPES
-	GivaroZpz<Log16> * K3g = new GivaroZpz<Log16>(101);
+	GivaroZpz< ::Givaro::Log16> * K3g = new GivaroZpz< ::Givaro::Log16>(101);
 	FieldArchetype K3(K3g);
 
-	if (!testField<FieldArchetype> (K3, "Testing archetype with envelope of GivaroZpz<Log16> field"))
+	if (!testField<FieldArchetype> (K3, "Testing archetype with envelope of GivaroZpz< ::Givaro::Log16> field"))
 		pass = false;
 	delete K3g;
 #endif
diff --git a/tests/test-gmp-rational.C b/tests/test-gmp-rational.C
index b3e9b8c..7890fc4 100644
--- a/tests/test-gmp-rational.C
+++ b/tests/test-gmp-rational.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-gmp-rational.C
  * Copyright (C) 2001, 2002 Bradford Hovinen,
@@ -12,6 +13,13 @@
  * See COPYING for license information.
  */
 
+
+/*! @file  tests/test-gmp-rational.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test NO DOC
+ */
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -33,7 +41,7 @@ int main (int argc, char **argv)
 	static Argument args[] = {
 		{ 'n', "-n N", "Set dimension of test vectors to NxN.", TYPE_INT, &n },
 		{ 'i', "-i I", "Perform each test for I iterations.",     TYPE_INT, &iterations },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
diff --git a/tests/test-hilbert.C b/tests/test-hilbert.C
index 8476fa6..ace7241 100644
--- a/tests/test-hilbert.C
+++ b/tests/test-hilbert.C
@@ -1,8 +1,35 @@
 /* -*- 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
+/* Copyright (C) LinBox
+ *
+ * written by bds
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
 
-/* tests/test-hilbert.C  -bds
+/*! @file  tests/test-hilbert.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test NO DOC
  */
 
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -30,11 +57,11 @@ int main (int argc, char **argv)
 		{ 'n', "-n N", "Set dimension of test matrices to NxN.", TYPE_INT,     &n },
 		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
-	typedef Modular<uint32> Field;
+	typedef Modular<uint32_t> Field;
 	Field F (q);
 
 	srand (time (NULL));
diff --git a/tests/test-hom.C b/tests/test-hom.C
index 4e6381f..70fbc96 100644
--- a/tests/test-hom.C
+++ b/tests/test-hom.C
@@ -1,12 +1,22 @@
 /* -*- 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
 /* tests/test-hom.C
+ * Copyright (C) LinBox
  *
  * Written by Dave Saunders <saunders at cis.udel.edu>
  *
  * See COPYING for license information.
  */
 
+
+/*! @file  tests/test-hom.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test NO DOC
+ */
+
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -31,13 +41,13 @@ int main (int argc, char **argv)
 	static int hist_level = 1;
 
 	static Argument args[] = {
-		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1] for uint16 modulus.", TYPE_INTEGER, &q },
+		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1] for uint16_t modulus.", TYPE_INTEGER, &q },
 		{ 'n', "-n N", "Set dimension of test vectors to NxN.", TYPE_INT,     &n },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
 		{ 't', "-t T", "Number of trials for the random iterator test.", TYPE_INT, &trials },
 		{ 'c', "-c C", "Number of categories for the random iterator test.", TYPE_INT, &categories },
 		{ 'H', "-H H", "History level for random iterator test.", TYPE_INT, &hist_level },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
@@ -45,19 +55,19 @@ int main (int argc, char **argv)
 	commentator.start("Hom test suite", "Hom");
 	bool pass = true;
 
-	Modular<uint32> F_uint32 ((uint32) q);
-	Modular<uint16> F_uint16 ((uint16) q);
-	Hom<Modular<uint16>, Modular<uint32> > iso(F_uint16, F_uint32);
+	Modular<uint32_t> F_uint32_t ((uint32_t) q);
+	Modular<uint16_t> F_uint16_t ((uint16_t) q);
+	Hom<Modular<uint16_t>, Modular<uint32_t> > iso(F_uint16_t, F_uint32_t);
 
-	uint16 x=2, y;
-	uint32 z=2, w;
+	uint16_t x=2, y;
+	uint32_t z=2, w;
 	iso.image(w, x);
-	pass = pass && F_uint32.areEqual(z, w);
+	pass = pass && F_uint32_t.areEqual(z, w);
 	iso.preimage(y, z);
-	pass = pass && F_uint16.areEqual(x, y);
+	pass = pass && F_uint16_t.areEqual(x, y);
 
 	/* for image field!
-	uint32 x, y, z, w;
+	uint32_t x, y, z, w;
 	iso.smul(x, 2, 3);
 	iso.mul(y, 2, 3);
 	pass = pass && iso.areEqual(x, y);
diff --git a/tests/test-inverse.C b/tests/test-inverse.C
index 16709d6..9f5990c 100644
--- a/tests/test-inverse.C
+++ b/tests/test-inverse.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-inverse.C
  * Copyright (C) 2001, 2002 Bradford Hovinen
@@ -10,6 +11,13 @@
  * See COPYING for license information
  */
 
+
+/*! @file  tests/test-inverse.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test NO DOC
+ */
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -44,9 +52,8 @@ using namespace LinBox;
  *
  * Return true on success and false on failure
  */
-
 template <class Field, class Vector>
-static bool testIdentityInverse (const Field &F, VectorStream<Vector> &stream) 
+static bool testIdentityInverse (const Field &F, VectorStream<Vector> &stream)
 {
 	typedef Diagonal<Field> Blackbox;
 
@@ -109,6 +116,7 @@ static bool testIdentityInverse (const Field &F, VectorStream<Vector> &stream)
 	return ret;
 }
 
+
 /* Test 2: Inverse of Hilbert matrix
  *
  * Constructs an n x n Hilbert matrix and a black box for its inverse. Applies
@@ -120,9 +128,8 @@ static bool testIdentityInverse (const Field &F, VectorStream<Vector> &stream)
  *
  * Return true on success and false on failure
  */
-
 template <class Field, class Vector>
-static bool testHilbertInverse (const Field &F, VectorStream<Vector> &stream) 
+static bool testHilbertInverse (const Field &F, VectorStream<Vector> &stream)
 {
 	typedef Hilbert <Field> Blackbox;
 
@@ -179,6 +186,7 @@ static bool testHilbertInverse (const Field &F, VectorStream<Vector> &stream)
 	return ret;
 }
 
+
 /* Test 3: Inverse of Vandermonde matrix
  *
  * Computes a random Vandermonde matrix and its inverse. This inverse is a
@@ -187,7 +195,7 @@ static bool testHilbertInverse (const Field &F, VectorStream<Vector> &stream)
  * vector. We then evaluate the polynomial in Horner fashion at each of the
  * evaluation points generated above to check whether the result is the original
  * input vector.
- * 
+ *
  * F - Field over which to perform computations
  * n - Dimension to which to make matrix
  * iterations - Number of random diagonal matrices to construct
@@ -195,11 +203,10 @@ static bool testHilbertInverse (const Field &F, VectorStream<Vector> &stream)
  *
  * Return true on success and false on failure
  */
-
 template <class Field, class Vector>
 static bool testVandermondeInverse (const Field           &F,
 				    VectorStream<Vector> &x_stream,
-				    VectorStream<Vector> &v_stream) 
+				    VectorStream<Vector> &v_stream)
 {
 	typedef DenseMatrix <Field> Blackbox;
 
@@ -290,21 +297,21 @@ static bool testVandermondeInverse (const Field           &F,
 	return ret;
 }
 
+
 /* Test 3: Inverse of diagonal inverse
  *
  * Constructs a random nonsingular diagonal matrix and its inverse, and extracts
  * the values along the diagonal of the inverse. Checks that those values are in
  * fact the inverses of the diagonal elements in the original.
- * 
+ *
  * F - Field over which to perform computations
  * n - Dimension to which to make matrix
  * iterations - Number of random diagonal matrices to construct
  *
  * Return true on success and false on failure
  */
-
 template <class Field, class Vector>
-static bool testDiagonalInverse (const Field &F, VectorStream<Vector> &stream) 
+static bool testDiagonalInverse (const Field &F, VectorStream<Vector> &stream)
 {
 	typedef Diagonal <Field> Blackbox;
 
@@ -376,6 +383,7 @@ static bool testDiagonalInverse (const Field &F, VectorStream<Vector> &stream)
 	return ret;
 }
 
+
 /* Test 3: Random transpose
  *
  * Compute the inverse of a random dense matrix and apply its transpose to
@@ -387,11 +395,10 @@ static bool testDiagonalInverse (const Field &F, VectorStream<Vector> &stream)
  *
  * Return true on success and false on failure
  */
-
 template <class Field, class Vector>
 static bool testRandomTranspose (Field &F,
 				 VectorStream<Vector> &stream1,
-				 VectorStream<Vector> &stream2) 
+				 VectorStream<Vector> &stream2)
 {
 	typedef DenseMatrix <Field> Blackbox;
 
@@ -418,6 +425,7 @@ static bool testRandomTranspose (Field &F,
 	return ret;
 }
 
+
 int main (int argc, char **argv)
 {
 	bool pass = true;
@@ -432,10 +440,10 @@ int main (int argc, char **argv)
 		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
 		{ 'N', "-N N", "Apply Vandermonde inverse to N vectors.", TYPE_INT,     &N },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
-	typedef Modular<LinBox::uint32> Field; //C.Pernet: avoids confusion with givaro::uint32
+	typedef Modular<uint32_t> Field; //C.Pernet: avoids confusion with givaro::uint32_t
 	typedef vector<Field::Element> Vector;
 
 	parseArguments (argc, argv, args);
diff --git a/tests/test-isposdef.C b/tests/test-isposdef.C
index 726686c..72b6b48 100644
--- a/tests/test-isposdef.C
+++ b/tests/test-isposdef.C
@@ -1,7 +1,7 @@
-
 /* -*- 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
 /* tests/test-isposdef.C
+ * Copyright (C) LinBox
  *
  * -----------------------------------------------------
  *
@@ -9,6 +9,14 @@
  * Public License. See COPYING for more information.
  */
 
+/*! @file  tests/test-isposdef.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test NO DOC
+ */
+
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -32,7 +40,7 @@ using namespace LinBox;
  */
 
 template <class Ring>
-bool testIsPosDef(const Ring &Z, size_t n, unsigned int iterations, double sparsity = 0.05) 
+bool testIsPosDef(const Ring &Z, size_t n, unsigned int iterations, double sparsity = 0.05)
 {
 	typedef SparseMatrix<Ring> Blackbox;
 
@@ -51,13 +59,13 @@ bool testIsPosDef(const Ring &Z, size_t n, unsigned int iterations, double spars
 		for (size_t j = 0; j < n; ++j)
 			A.setEntry(j, j, e);
 
-		std::ostream & report = 
+		std::ostream & report =
 		commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION);
 
-		Z.write( report ) << endl; 
-		A.write( report ) << endl; 
+		Z.write( report ) << endl;
+		A.write( report ) << endl;
 		bool p;
-		p = isPositiveDefinite(A); 
+		p = isPositiveDefinite(A);
 		report << "Positivedefiniteness on I computed by default (Hybrid) method: " << p << endl;
 		if (!p) {report << "ERROR: should be pos def" << endl; ret = false;}
 
@@ -65,9 +73,9 @@ bool testIsPosDef(const Ring &Z, size_t n, unsigned int iterations, double spars
 		Z. assign(A. refEntry(n/2, n/2), e);
 		A.setEntry(1, 2, e);
 		A.setEntry(2, 1, e);
-		p = isPositiveDefinite(A); 
+		p = isPositiveDefinite(A);
 		report << "Matrix:\n";
-		A.write( report ) << endl; 
+		A.write( report ) << endl;
 		report << "Positivedefiniteness on indefinite example computed by default (Hybrid) method: " << p << endl;
 		if (p) {report << "ERROR: should not be pos def" << endl; ret = false;}
 
@@ -87,7 +95,7 @@ int main (int argc, char **argv)
 
 //     commentator.setMaxDetailLevel( 100000 );
 //     commentator.setMaxDepth( 100000 );
-   
+
 	bool pass = true;
 
 	static size_t n = 80;
@@ -100,9 +108,8 @@ int main (int argc, char **argv)
 		{ 'n', "-n N", "Set dimension of test matrices to NxN.", TYPE_INT,     &n },
 		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
-        { 's', "-s S", "Sparse matrices with density S.", TYPE_DOUBLE,     &sparsity },
-		{ '\0' }
-
+		{ 's', "-s S", "Sparse matrices with density S.", TYPE_DOUBLE,     &sparsity },
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
@@ -114,7 +121,7 @@ int main (int argc, char **argv)
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
 
     PID_integer R;
-        
+
 	if (!testIsPosDef(R, n, iterations, sparsity)) pass = false;
 
 	commentator.stop("IsPositiveDefinite solution test suite");
diff --git a/tests/test-ispossemidef.C b/tests/test-ispossemidef.C
index dabb1a5..9acbc24 100644
--- a/tests/test-ispossemidef.C
+++ b/tests/test-ispossemidef.C
@@ -1,7 +1,7 @@
-
 /* -*- 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
 /* tests/test-isposdef.C
+ * Copyright (C) LinBox
  *
  * -----------------------------------------------------
  *
@@ -9,6 +9,15 @@
  * Public License. See COPYING for more information.
  */
 
+
+/*! @file  tests/test-ispossemidef.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test NO DOC
+ */
+
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -32,7 +41,7 @@ using namespace LinBox;
  */
 
 template <class Ring>
-bool testIsPosDef(const Ring &Z, size_t n, unsigned int iterations, double sparsity = 0.05) 
+bool testIsPosDef(const Ring &Z, size_t n, unsigned int iterations, double sparsity = 0.05)
 {
 	typedef SparseMatrix<Ring> Blackbox;
 
@@ -53,13 +62,13 @@ bool testIsPosDef(const Ring &Z, size_t n, unsigned int iterations, double spars
 
 		A.setEntry(1, 2, e);
 		A.setEntry(2, 1, e);
-		std::ostream & report = 
+		std::ostream & report =
 		commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION);
 
-		Z.write( report ) << endl; 
-		A.write( report ) << endl; 
+		Z.write( report ) << endl;
+		A.write( report ) << endl;
 		bool p;
-		p = isPositiveSemiDefinite(A); 
+		p = isPositiveSemiDefinite(A);
 		report << "PositiveSemidefiniteness on I computed by default (Hybrid) method: " << p << endl;
 		if (!p) {report << "ERROR: should be pos semidef" << endl; ret = false;}
 
@@ -67,9 +76,9 @@ bool testIsPosDef(const Ring &Z, size_t n, unsigned int iterations, double spars
 		Z. assign(A. refEntry(n/2, n/2), e);
 		//A.setEntry(1, 2, e);
 		//A.setEntry(2, 1, e);
-		p = isPositiveSemiDefinite(A); 
+		p = isPositiveSemiDefinite(A);
 		report << "Matrix:\n";
-		A.write( report ) << endl; 
+		A.write( report ) << endl;
 		report << "PositiveSemidefiniteness on indefinite example computed by default (Hybrid) method: " << p << endl;
 		if (p) {report << "ERROR: should not be pos semidef" << endl; ret = false;}
 
@@ -89,7 +98,7 @@ int main (int argc, char **argv)
 
 //     commentator.setMaxDetailLevel( 100000 );
 //     commentator.setMaxDepth( 100000 );
-   
+
 	bool pass = true;
 
 	static size_t n = 80;
@@ -103,7 +112,7 @@ int main (int argc, char **argv)
 		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
                 { 's', "-s S", "Sparse matrices with density S.", TYPE_DOUBLE,     &sparsity },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
@@ -117,9 +126,10 @@ int main (int argc, char **argv)
 //	commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
 
     PID_integer R;
-        
+
 	if (!testIsPosDef(R, n, iterations, sparsity)) pass = false;
 
 	commentator.stop("isPositiveSemiDefinite solution test suite");
 	return pass ? 0 : -1;
 }
+
diff --git a/tests/test-la-block-lanczos.C b/tests/test-la-block-lanczos.C
index f611488..05f271c 100644
--- a/tests/test-la-block-lanczos.C
+++ b/tests/test-la-block-lanczos.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-la-block-lanczos.C
  * Copyright (C) 2004 Bradford Hovinen
@@ -10,6 +11,15 @@
  * See COPYING for license information
  */
 
+
+/*! @file  tests/test-la-block-lanczos.C
+ * @ingroup tests
+ * @test NO DOC
+ * @brief  no doc
+ */
+
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -34,7 +44,7 @@ template <class Field, class Vector1, class Vector2>
 static bool testRandomSolve (const Field           &F,
 			     VectorStream<Vector1> &A_stream,
 			     VectorStream<Vector2> &y_stream,
-			     size_t                 N) 
+			     size_t                 N)
 {
 	typedef LABlockLanczosSolver<Field, DenseMatrixBase<typename Field::Element> > LABLSolver;
 
@@ -107,7 +117,7 @@ template <class Field, class Vector1>
 static bool testSampleNullspace (const Field           &F,
 				 VectorStream<Vector1> &A_stream,
 				 size_t                 N,
-				 unsigned int           num_iter) 
+				 unsigned int           num_iter)
 {
 	typedef DenseMatrixBase<typename Field::Element> Matrix;
 	typedef LABlockLanczosSolver<Field, Matrix> LABLSolver;
@@ -167,7 +177,7 @@ template <class Field, class Vector1>
 static bool testRank (const Field           &F,
 		      VectorStream<Vector1> &A_stream,
 		      size_t                 N,
-		      unsigned int           num_iter) 
+		      unsigned int           num_iter)
 {
 	typedef DenseMatrixBase<typename Field::Element> Matrix;
 	typedef LABlockLanczosSolver<Field, Matrix> LABLSolver;
@@ -220,7 +230,7 @@ static bool testRank (const Field           &F,
 
 int main (int argc, char **argv)
 {
-	static int i = 5; 
+	static int i = 5;
 	static int n = 10; // because it shows the problem
 	static int k = 5;
 	static int q = 2;
@@ -232,10 +242,10 @@ int main (int argc, char **argv)
 		{ 'k', "-k K", "K nonzero entries per row in test matrix.", TYPE_INT, &k },
 		{ 'N', "-N N", "Blocking factor.", TYPE_INT, &N },
 		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INT, &q },
-		{ '\0', NULL, NULL, TYPE_NONE, NULL }
+		END_OF_ARGUMENTS
 	};
 
-	typedef Modular<uint8> Field;
+	typedef Modular<uint8_t> Field;
 
 	parseArguments (argc, argv, args);
 	Field F (q);
diff --git a/tests/test-last-invariant-factor.C b/tests/test-last-invariant-factor.C
old mode 100755
new mode 100644
index d8d9a8f..7a18f95
--- a/tests/test-last-invariant-factor.C
+++ b/tests/test-last-invariant-factor.C
@@ -1,7 +1,36 @@
-/** File: test-last-invariant-factor.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
+/* Copyright (C) LinBox
+ *
  *  Author: Zhendong Wan
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
 
+
+
+/*! @file  tests/test-last-invariant-factor.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test NO DOC
+ */
+
+
+
 #include <linbox/field/PID-integer.h>
 #include <linbox/randiter/random-prime.h>
 #include <linbox/field/modular-int32.h>
@@ -17,14 +46,16 @@
 #include <linbox/util/commentator.h>
 #include <linbox/vector/stream.h>
 #include "test-common.h"
+using namespace LinBox;
 
 template <class Ring, class LIF, class Vector>
-bool testRandom(const Ring& R, 
+bool testRandom(const Ring& R,
 		const LIF& lif,
-		LinBox::VectorStream<Vector>& stream1) {
- 
+		LinBox::VectorStream<Vector>& stream1)
+{
+
 	std::ostringstream str;
-        
+
 	str << "Testing last invariant factor:";
 
         commentator.start (str.str ().c_str (), "testRandom", stream1.m ());
@@ -37,19 +68,19 @@ bool testRandom(const Ring& R,
 	Vector d;
 
 	typename Ring::Element x;
-	
+
 	VectorWrapper::ensureDim (d, stream1.n ());
-	
+
 	int n = d. size();
 
 	 while (stream1) {
-		 
+
 		 commentator.startIteration (stream1.j ());
-                 
-		 std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);  
+
+		 std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
 
                 iter_passed = true;
-		
+
 		stream1.next (d);
 
 		report << "Input vector:  ";
@@ -60,29 +91,29 @@ bool testRandom(const Ring& R,
 
 		int i, j;
 
-		for(i = 0; i < n; ++i) { 
-			R. assign (D[i][i], d[i]); 
+		for(i = 0; i < n; ++i) {
+			R. assign (D[i][i], d[i]);
 			R. init (L[i][i], 1);
 			R. init (U[i][i], 1);}
-		
-		for (i = 0; i < n; ++ i) 
-		
+
+		for (i = 0; i < n; ++ i)
+
 			for (j = 0; j < i; ++ j) {
-				
+
 				R.init(L[i][j], rand() % 10);
-				
+
 				R.init(U[j][i], rand() % 10);
 			}
-	
-	
+
+
 		std::vector<typename Ring::Element> tmp1(n), tmp2(n), e(n);
-		
+
 		typename DenseMatrix<Ring>::ColIterator col_p;
 
 		i = 0;
-		for (col_p = A.colBegin(); 
+		for (col_p = A.colBegin();
 		     col_p != A.colEnd(); ++ col_p, ++ i) {
-			
+
 			R.init(e[i],1);
 			U.apply(tmp1, e);
 			D.apply(tmp2, tmp1);
@@ -90,81 +121,82 @@ bool testRandom(const Ring& R,
 			R.init(e[i],0);
 		}
 
-		
-		
+
+
 		lif. lastInvariantFactor (x, A);
-       
-		
+
+
 		report << "Computed last invariant factor: \n";
-		
+
 		R. write (report, x);
-		
+
 		report << '\n';
-	
-				
+
+
 		typename std::vector<typename Ring::Element>::iterator p1;
-		
+
 		typename Ring::Element l;
-		
+
 		R. init (l , 1);
-		
-		for (p1 = d.begin(); p1 != d.end(); ++ p1) 
-			
+
+		for (p1 = d.begin(); p1 != d.end(); ++ p1)
+
 			R. lcmin (l, *p1);
 
-			
+
 
 		report << "Expected last invariant factor: \n";
-		
+
 		R. write (report, l);
 
 		report << '\n';
 
 		if (!R. areEqual (l, x))
-			
+
 			ret = iter_passed = false;
-		
-                if (!iter_passed) 
-			
+
+                if (!iter_passed)
+
                         commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
 				<< "ERROR: Computed last invariant factor is incorrect" << endl;
-			
-		
+
+
 
                 commentator.stop ("done");
 
                 commentator.progress ();
-		
+
 	 }
-	 
+
 	 //stream1.reset ();
-	  	  
+
 	  commentator.stop (MSG_STATUS (ret), (const char *) 0, "testRandom");
-                     
+
 	  return ret;
 
 }
 
-int main(int argc, char** argv) {
-        
+int main(int argc, char** argv)
+{
+
 
         bool pass = true;
-        
+
         static size_t n = 10;
-        
+
 	static int iterations = 1;
-        
+
         static Argument args[] = {
                 { 'n', "-n N", "Set order of test matrices to N.", TYPE_INT,     &n },
                 { 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
-				{ '\0' }
+		END_OF_ARGUMENTS
 
         };
-	
+
 	parseArguments (argc, argv, args);
-        
+
         typedef PID_integer      Ring;
-                                        
+
         Ring R;
 
 	commentator.start("Last invariant factor test suite", "LIF");
@@ -173,16 +205,17 @@ int main(int argc, char** argv) {
 
         RandomDenseStream<Ring> s1 (R, n, iterations);
 
-	typedef RationalSolver<Ring, Modular<LinBox::int32>, LinBox::RandomPrimeIterator> Solver;
+	typedef RationalSolver<Ring, Modular<int32_t>, LinBox::RandomPrimeIterator> Solver;
+	// typedef RationalSolver<Ring, Modular<double>, LinBox::RandomPrimeIterator> Solver;
 
 	typedef LastInvariantFactor<Ring, Solver> LIF;
 
 	LIF lif;
-	
+
 	lif.  setThreshold (30);
 
 	if (!testRandom(R, lif, s1)) pass = false;
-                              
+
 	commentator.stop("Last invariant factor test suite");
         return pass ? 0 : -1;
 }
diff --git a/tests/test-lidia-gfq.C b/tests/test-lidia-gfq.C
index 3737446..edc9dae 100644
--- a/tests/test-lidia-gfq.C
+++ b/tests/test-lidia-gfq.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-lidia-gfq.C
  * Copyright (C) 2002 Pascal Giorgi
@@ -21,6 +22,15 @@
  * Boston, MA 02111-1307, USA.
  */
 
+
+/*! @file  tests/test-lidia-gfq.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test NO DOC
+ */
+
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -45,7 +55,7 @@ int main (int argc, char **argv)
                 { 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
 		{ 'n', "-n N", "Set dimension of test vectors to NxN.", TYPE_INT,     &n },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
-                { '\0' }
+		END_OF_ARGUMENTS
         };
 
         parseArguments (argc, argv, args);
@@ -53,9 +63,9 @@ int main (int argc, char **argv)
 	cout << endl << "LiDIAGfq field test suite" << endl;
 	cout.flush ();
 	bool pass = true;
-	
+
 	LidiaGfq F (q, 1);
-	
+
 	// Make sure some more detailed messages get printed
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
 
diff --git a/tests/test-matrix-domain.C b/tests/test-matrix-domain.C
index 51d32b5..390114a 100644
--- a/tests/test-matrix-domain.C
+++ b/tests/test-matrix-domain.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-matrix-domain.C
  * Copyright (C) 2001, 2002 Bradford Hovinen
@@ -13,13 +14,22 @@
  * SparseMatrixBase, and TransposeMatrix
  */
 
-/* ERRORS:
+
+
+/*! @file  tests/test-matrix-domain.C
+ * @ingroup tests
+ * @brief  no real doc.
+ *
+ * \par ERRORS:
  *
  * X- Ambiguous specializations with RolColMatrixTag
  *  - Can't use leftMulin or rightMulin on some tests
  *  - VectorDomain needs subin, addin, etc. with multiple vector representations
+ * @test NO DOC
  */
 
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -52,7 +62,7 @@ TransposeMatrix<Matrix> transpose (Matrix &M)
 
 template <class Field, class Matrix1, class Matrix2>
 void eliminate (MatrixDomain<Field> &MD, Matrix1 &M, Matrix2 &pivotRow,
-		size_t row, size_t col, size_t rowdim, size_t coldim) 
+		size_t row, size_t col, size_t rowdim, size_t coldim)
 {
 	DenseMatrixBase<typename Matrix1::Element> pivotCol (rowdim, 1);
 	DenseSubmatrix<typename Matrix1::Element> realPivotCol (M, row, col, rowdim, 1);
@@ -69,7 +79,7 @@ void eliminate (MatrixDomain<Field> &MD, Matrix1 &M, Matrix2 &pivotRow,
  */
 
 template <class Field, class Matrix1, class Matrix2>
-Matrix1 &inv (MatrixDomain<Field> &MD, Matrix1 &res, const Matrix2 &A) 
+Matrix1 &inv (MatrixDomain<Field> &MD, Matrix1 &res, const Matrix2 &A)
 {
 	linbox_check (res.coldim () == A.coldim ());
 	linbox_check (res.rowdim () == A.rowdim ());
@@ -134,7 +144,7 @@ Matrix1 &inv (MatrixDomain<Field> &MD, Matrix1 &res, const Matrix2 &A)
  */
 
 template <class Field, class Matrix>
-static bool testCopyEqual (Field &F, const char *text, const Matrix &M) 
+static bool testCopyEqual (Field &F, const char *text, const Matrix &M)
 {
 	ostringstream str;
 
@@ -173,7 +183,7 @@ static bool testCopyEqual (Field &F, const char *text, const Matrix &M)
  */
 
 template <class Field, class Matrix>
-static bool testSubinIsZero (Field &F, const char *text, const Matrix &M) 
+static bool testSubinIsZero (Field &F, const char *text, const Matrix &M)
 {
 	ostringstream str;
 
@@ -213,7 +223,7 @@ static bool testSubinIsZero (Field &F, const char *text, const Matrix &M)
  */
 
 template <class Field, class Matrix>
-static bool testAddNegSub (Field &F, const char *text, const Matrix &M1, const Matrix &M2) 
+static bool testAddNegSub (Field &F, const char *text, const Matrix &M1, const Matrix &M2)
 {
 	ostringstream str;
 
@@ -265,7 +275,7 @@ static bool testAddNegSub (Field &F, const char *text, const Matrix &M1, const M
  */
 
 template <class Field, class Matrix>
-static bool testAddinNeginSub (Field &F, const char *text, const Matrix &M1, const Matrix &M2) 
+static bool testAddinNeginSub (Field &F, const char *text, const Matrix &M1, const Matrix &M2)
 {
 	ostringstream str;
 
@@ -321,7 +331,7 @@ static bool testAddinNeginSub (Field &F, const char *text, const Matrix &M1, con
 // Version for square matrices
 
 template <class Field, class Matrix>
-static bool testInvMulSquare (Field &F, const char *text, const Matrix &M) 
+static bool testInvMulSquare (Field &F, const char *text, const Matrix &M)
 {
 	linbox_check (M.rowdim () == M.coldim ());
 
@@ -392,7 +402,7 @@ static bool testInvMulSquare (Field &F, const char *text, const Matrix &M)
 // Version for over-determined matrices
 
 template <class Field, class Matrix>
-static bool testInvMulOver (Field &F, const char *text, Matrix &M) 
+static bool testInvMulOver (Field &F, const char *text, Matrix &M)
 {
 	linbox_check (M.coldim () <= M.rowdim ());
 
@@ -473,7 +483,7 @@ static bool testInvMulOver (Field &F, const char *text, Matrix &M)
 // Version for under-determined matrices
 
 template <class Field, class Matrix>
-static bool testInvMulUnder (Field &F, const char *text, Matrix &M) 
+static bool testInvMulUnder (Field &F, const char *text, Matrix &M)
 {
 	linbox_check (M.rowdim () <= M.coldim ());
 
@@ -558,7 +568,7 @@ static bool testInvMulUnder (Field &F, const char *text, Matrix &M)
 // Version for square matrices
 
 template <class Field, class Matrix>
-static bool testInvLeftMulinSquare (Field &F, const char *text, const Matrix &M) 
+static bool testInvLeftMulinSquare (Field &F, const char *text, const Matrix &M)
 {
 	linbox_check (M.rowdim () == M.coldim ());
 
@@ -617,7 +627,7 @@ static bool testInvLeftMulinSquare (Field &F, const char *text, const Matrix &M)
 // Version for over-determined matrices
 
 template <class Field, class Matrix>
-static bool testInvLeftMulinOver (Field &F, const char *text, Matrix &M) 
+static bool testInvLeftMulinOver (Field &F, const char *text, Matrix &M)
 {
 	linbox_check (M.coldim () <= M.rowdim ());
 
@@ -679,7 +689,7 @@ static bool testInvLeftMulinOver (Field &F, const char *text, Matrix &M)
 // Version for under-determined matrices
 
 template <class Field, class Matrix>
-static bool testInvLeftMulinUnder (Field &F, const char *text, Matrix &M) 
+static bool testInvLeftMulinUnder (Field &F, const char *text, Matrix &M)
 {
 	linbox_check (M.rowdim () <= M.coldim ());
 
@@ -746,7 +756,7 @@ static bool testInvLeftMulinUnder (Field &F, const char *text, Matrix &M)
 // Version for square matrices
 
 template <class Field, class Matrix>
-static bool testInvRightMulinSquare (Field &F, const char *text, const Matrix &M) 
+static bool testInvRightMulinSquare (Field &F, const char *text, const Matrix &M)
 {
 	linbox_check (M.rowdim () == M.coldim ());
 
@@ -805,7 +815,7 @@ static bool testInvRightMulinSquare (Field &F, const char *text, const Matrix &M
 // Version for over-determined matrices
 
 template <class Field, class Matrix>
-static bool testInvRightMulinOver (Field &F, const char *text, Matrix &M) 
+static bool testInvRightMulinOver (Field &F, const char *text, Matrix &M)
 {
 	linbox_check (M.coldim () <= M.rowdim ());
 
@@ -867,7 +877,7 @@ static bool testInvRightMulinOver (Field &F, const char *text, Matrix &M)
 // Version for under-determined matrices
 
 template <class Field, class Matrix>
-static bool testInvRightMulinUnder (Field &F, const char *text, Matrix &M) 
+static bool testInvRightMulinUnder (Field &F, const char *text, Matrix &M)
 {
 	linbox_check (M.rowdim () <= M.coldim ());
 
@@ -932,7 +942,7 @@ static bool testInvRightMulinUnder (Field &F, const char *text, Matrix &M)
  */
 
 template <class Field, class Matrix>
-static bool testAddMulAxpyin (Field &F, const char *text, Matrix &M1, Matrix &M2, Matrix &M3) 
+static bool testAddMulAxpyin (Field &F, const char *text, Matrix &M1, Matrix &M2, Matrix &M3)
 {
 	ostringstream str;
 
@@ -986,7 +996,7 @@ static bool testAddMulAxpyin (Field &F, const char *text, Matrix &M1, Matrix &M2
  */
 
 template <class Field, class Matrix>
-static bool testMVMulSub (Field &F, const char *text, const Matrix &M) 
+static bool testMVMulSub (Field &F, const char *text, const Matrix &M)
 {
 	ostringstream str;
 
@@ -1034,7 +1044,7 @@ static bool testMVMulSub (Field &F, const char *text, const Matrix &M)
  */
 
 template <class Field, class Matrix>
-static bool testMVAxpy (Field &F, const char *text, const Matrix &M) 
+static bool testMVAxpy (Field &F, const char *text, const Matrix &M)
 {
 	ostringstream str;
 
@@ -1093,7 +1103,7 @@ static bool testMVAxpy (Field &F, const char *text, const Matrix &M)
 
 template <class Field, class Vector, class Blackbox>
 static bool testLeftBlackboxMul (Field &F, const char *text, const Blackbox &A,
-				 VectorStream<Vector> &stream) 
+				 VectorStream<Vector> &stream)
 {
 	ostringstream str;
 
@@ -1147,7 +1157,7 @@ static bool testLeftBlackboxMul (Field &F, const char *text, const Blackbox &A,
 
 template <class Field, class Vector, class Blackbox>
 static bool testRightBlackboxMul (Field &F, const char *text, const Blackbox &A,
-				  VectorStream<Vector> &stream) 
+				  VectorStream<Vector> &stream)
 {
 	ostringstream str;
 
@@ -1196,7 +1206,7 @@ static bool testRightBlackboxMul (Field &F, const char *text, const Blackbox &A,
 
 std::ostream &reportPermutation
 	(std::ostream &out,
-	 const std::vector<std::pair<unsigned int, unsigned int> > &P) 
+	 const std::vector<std::pair<unsigned int, unsigned int> > &P)
 {
 	std::vector<std::pair<unsigned int, unsigned int> >::const_iterator i;
 
@@ -1207,7 +1217,7 @@ std::ostream &reportPermutation
 }
 
 template <class Field, class Matrix>
-bool testPermutation (const Field &F, const char *text, const Matrix &M) 
+bool testPermutation (const Field &F, const char *text, const Matrix &M)
 {
 	ostringstream str;
 
@@ -1319,7 +1329,7 @@ bool testMatrixDomain (const Field &F, const char *text,
 	bool pass = true;
 
 	RandomDenseStream<Field, typename LinBox::Vector<Field>::Dense> stream (F, A.coldim (), iterations);
-	
+
 	if (!testCopyEqual (F, text, M1)) pass = false;
 	if (!testSubinIsZero (F, text, M1)) pass = false;
 	if (!testAddNegSub (F, text, M1, M2)) pass = false;
@@ -1358,7 +1368,7 @@ bool testMatrixDomain (const Field &F, const char *text,
 		       Matrix &M1, Matrix &M2, Matrix &M3,
 		       const Blackbox &A,
 		       unsigned int iterations,
-		       MatrixCategories::RowMatrixTag) 
+		       MatrixCategories::RowMatrixTag)
 {
 	ostringstream str;
 	str << "Testing MatrixDomain with " << text << " matrices" << ends;
@@ -1398,7 +1408,7 @@ bool testMatrixDomain (const Field &F, const char *text,
 		       Matrix &M1, Matrix &M2, Matrix &M3,
 		       const Blackbox &A,
 		       unsigned int iterations,
-		       MatrixCategories::ColMatrixTag) 
+		       MatrixCategories::ColMatrixTag)
 {
 	ostringstream str;
 	str << "Testing MatrixDomain with " << text << " matrices" << ends;
@@ -1446,14 +1456,14 @@ int main (int argc, char **argv)
 		{ 'n', "-n N", "Set row of test matrices to N.", TYPE_INT,     &n },
 		{ 'm', "-m M", "Set column of test vectors to M.", TYPE_INT,     &m },
 		{ 'k', "-k K", "K nonzero elements per row/column in sparse matrices.", TYPE_INT,     &k },
-		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1] for uint32 modulus.", TYPE_INTEGER, &q },
+		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1] for uint32_t modulus.", TYPE_INTEGER, &q },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
 
-	typedef Modular<uint32> Field;
+	typedef Modular<uint32_t> Field;
 	typedef Field::Element Element;
 
 	Field F (q);
diff --git a/tests/test-matrix-stream.C b/tests/test-matrix-stream.C
index fdc88bb..a6e467e 100644
--- a/tests/test-matrix-stream.C
+++ b/tests/test-matrix-stream.C
@@ -1,3 +1,36 @@
+/* -*- 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
+/* Copyright (C) LinBox
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+
+/*! @file  tests/test-matrix-stream.C
+ * @ingroup tests
+ * @brief  no doc
+ * @bug this tests reveals memory leaks
+ * @test NO DOC
+ */
+
+
+
 #include <iostream>
 #include <fstream>
 #include <string>
@@ -12,10 +45,12 @@
 
 using namespace LinBox;
 
-/* 
-I would like to see a matrix writer that 
-writes sms format and generic dense format.  
-Then we could have a self contained test that 
+#warning "this test leaks memory at matrix-stream.h:134"
+
+/** @file tests/test-matrix-stream.C
+ at todo I would like to see a matrix writer that
+writes sms format and generic dense format.
+Then we could have a self contained test that
 checks the write/read cycle without depending on preexisting data files.
 
 ...but data files illustrating formats that we intend to read but not write would continue to be used.
@@ -42,7 +77,8 @@ TestField f;
 
 template <class BB>
 bool testMatrix( std::ostream& out, const char* filename, const char* BBName ) ;
-bool testMatrixStream(const string& matfile) {
+bool testMatrixStream(const string& matfile)
+{
 
 	bool pass = true;
 	commentator.start("Testing matrix-stream...", matfile.c_str());
@@ -149,7 +185,7 @@ bool testMatrixStream(const string& matfile) {
 					  << matfile
 					  << ", format " << ms2.getFormat()
 					  << std::endl
-					  << "Got " << array[i*colDim+j] 
+					  << "Got " << array[i*colDim+j]
 					  << " at index (" << i
 					  << "," << j << "), should be "
 					  << matrix[i][j] << std::endl;
@@ -176,9 +212,9 @@ bool testMatrixStream(const string& matfile) {
 	if( !testMatrix< BlasBlackbox<TestField> >
 			( out, matfile[0], "BLAS BlackBox Matrix" )
 	  ) pass = false;
-	
+
 */
-	if( !pass )	out << "FAIL: matrix-stream" << std::endl; 
+	if( !pass )	out << "FAIL: matrix-stream" << std::endl;
 	else 		out << "matrix-stream Passed" << std::endl;
 	commentator.stop(ms.getFormat());
 	//commentator.stop(MSG_STATUS(pass));
@@ -186,7 +222,8 @@ bool testMatrixStream(const string& matfile) {
 }
 
 template <class BB>
-bool testMatrix( std::ostream& out, const char* filename, const char* BBName ) {
+bool testMatrix( std::ostream& out, const char* filename, const char* BBName )
+{
 	out << "\tTesting " << BBName << std::endl;
 	std::ifstream fin( filename );
 	if( !fin ) {
@@ -220,7 +257,8 @@ bool testMatrix( std::ostream& out, const char* filename, const char* BBName ) {
 	return pass;
 }
 
-int main(int argc, char* argv[]){
+int main(int argc, char* argv[])
+{
 /*
     static size_t n = 10;
     static integer q = 4093U;
@@ -228,12 +266,13 @@ int main(int argc, char* argv[]){
 
 */
     static Argument args[] = {
-	/*
-    { 'n', "-n N", "Set dimension of test matrices to NxN", TYPE_INT,     &n },
-	{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1]", TYPE_INTEGER, &q },
-	{ 'i', "-i I", "Perform each test for I iterations",    TYPE_INT,     &iterations },
-	{ '\0' }
-	*/
+#if 0
+	    { 'n', "-n N", "Set dimension of test matrices to NxN", TYPE_INT,     &n },
+	    { 'q', "-q Q", "Operate over the \"field\" GF(Q) [1]", TYPE_INTEGER, &q },
+	    { 'i', "-i I", "Perform each test for I iterations",    TYPE_INT,     &iterations },
+	    { '\0' }
+#endif
+	    END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
diff --git a/tests/test-mg-block-lanczos.C b/tests/test-mg-block-lanczos.C
index 15ed445..30ec5d2 100644
--- a/tests/test-mg-block-lanczos.C
+++ b/tests/test-mg-block-lanczos.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-mg-block-lanczos.C
  * Copyright (C) 2004 Bradford Hovinen
@@ -10,6 +11,15 @@
  * See COPYING for license information
  */
 
+
+/*! @file  tests/test-mg-block-lanczos.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test NO DOC
+ */
+
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -107,7 +117,7 @@ template <class Field, class Vector1>
 static bool testSampleNullspace (const Field           &F,
 				 VectorStream<Vector1> &A_stream,
 				 size_t                 N,
-				 unsigned int           num_iter) 
+				 unsigned int           num_iter)
 {
 	typedef DenseMatrixBase<typename Field::Element> Matrix;
 	typedef MGBlockLanczosSolver<Field, Matrix> MGBLSolver;
@@ -162,7 +172,7 @@ static bool testSampleNullspace (const Field           &F,
 
 int main (int argc, char **argv)
 {
-	static int i = 5; 
+	static int i = 5;
 	static int n = 100;
 	static int k = 5;
 	static int q = 2;
@@ -176,16 +186,15 @@ int main (int argc, char **argv)
 		{ 'k', "-k K", "K nonzero entries per row in test matrix.", TYPE_INT, &k },
 		{ 'N', "-N N", "Blocking factor.", TYPE_INT, &N },
 		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INT, &q },
-		{ '\0', NULL, NULL, TYPE_NONE, NULL }
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
-	typedef Modular<uint8> Field;
+	typedef Modular<uint8_t_t> Field;
 
 	parseArguments (argc, argv, args);
 	Field F (q);
 
-	std::cout << "Montgomery block Lanczos test suite" << std::endl << std::endl;
+	commentator.start("Montgomery block Lanczos test suite");
 
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (10);
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
@@ -197,8 +206,10 @@ int main (int argc, char **argv)
 	RandomDenseStream<Field> y_stream (F, n, i);
 
 	if (!testRandomSolve (F, A_stream, y_stream, N)) pass=false;;
-	std::cout << "	Skipping Sample Nullspace test (which has mem problems)" << std::endl;
+	commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION)
+		<< "	Skipping Sample Nullspace test (which has mem problems)" << std::endl;
 	//if (!testSampleNullspace (F, A_stream, N, i)) pass=false;;
 
+	commentator.stop("Montgomery block Lanczos test suite");
 	return pass ? 0 : -1;
 }
diff --git a/tests/test-minpoly.C b/tests/test-minpoly.C
index 93ab125..2d2e95e 100644
--- a/tests/test-minpoly.C
+++ b/tests/test-minpoly.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-minpoly.C
  * Copyright (C) 2001, 2002 Bradford Hovinen
@@ -15,6 +16,15 @@
  * See COPYING for license information.
  */
 
+
+/*! @file  tests/test-minpoly.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test NO DOC
+ */
+
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -23,6 +33,7 @@
 #include <cstdio>
 
 #include "linbox/field/modular.h"
+#include "linbox/field/givaro-gfq.h"
 #include "linbox/blackbox/sparse.h"
 #include "linbox/util/commentator.h"
 #include "linbox/solutions/minpoly.h"
@@ -32,10 +43,47 @@
 
 using namespace LinBox;
 
+/* Test 0: Minimal polynomial of the zero matrix
+*/
+template <class Field, class Meth>
+static bool testZeroMinpoly (Field &F, size_t n, bool symmetrizing, const Meth& M)
+{
+	commentator.start ("Testing zero minpoly", "testZeroMinpoly");
+	typedef vector <typename Field::Element> Polynomial;
+	Polynomial phi;
+	SparseMatrix<Field> A(F, n, n);
+	minpoly(phi, A, M);
+
+	ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+        A.write(report, FORMAT_MAPLE);
+	report << "Minimal polynomial is: ";
+
+	printPolynomial<Field, Polynomial> (F, report, phi);
+
+	bool ret;
+	if (phi.size () == 2 && F.isZero (phi[0]) && F.isOne(phi[1]) )
+		ret = true;
+	else
+	{
+		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+			<< "ERROR: A = 0, should get x, got ";
+		printPolynomial<Field, Polynomial> (F, report, phi);
+		report << endl;
+		ret = false;
+	}
+	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testZeroMinpoly");
+	return ret;
+}
+template <class Field>
+static bool testZeroMinpoly (Field &F, size_t n)
+{
+	return testZeroMinpoly(F, n, false, Method::Blackbox());
+}
+
 /* Test 1: Minimal polynomial of the identity matrix
  *
  * Construct the identity matrix and compute its minimal polynomial. Confirm
- * that the result is 1-x
+ * that the result is x-1
  *
  * F - Field over which to perform computations
  * n - Dimension to which to make matrix
@@ -44,7 +92,7 @@ using namespace LinBox;
  */
 
 template <class Field, class Meth>
-static bool testIdentityMinpoly (Field &F, size_t n, bool symmetrizing, const Meth& M) 
+static bool testIdentityMinpoly (Field &F, size_t n, bool symmetrizing, const Meth& M)
 {
 	typedef vector <typename Field::Element> Vector;
 	typedef vector <typename Field::Element> Polynomial;
@@ -53,8 +101,6 @@ static bool testIdentityMinpoly (Field &F, size_t n, bool symmetrizing, const Me
 
 	commentator.start ("Testing identity minpoly", "testIdentityMinpoly");
 
-	bool ret = true;
-
 	typename Field::Element c0, c1;
 
 	StandardBasisStream<Field, Row> stream (F, n);
@@ -70,15 +116,18 @@ static bool testIdentityMinpoly (Field &F, size_t n, bool symmetrizing, const Me
 	report << "Minimal polynomial is: ";
 	printPolynomial<Field, Polynomial> (F, report, phi);
 
+	bool ret;
+
 	F.init (c0, -1);
 	F.init (c1, 1);
 
-	if (phi.size () != 2 ||
-	    !F.areEqual (phi[0], c0) ||
-	    !F.areEqual (phi[1], c1)) {
+	if (phi.size () == 2 && F.areEqual (phi[0], c0) && F.areEqual (phi[1], c1))
+		ret = true;
+	else {
 		ret = false;
 		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-			<< "ERROR: Minimal polynomial is incorrect" << endl;
+			<< "ERROR: A = I, should get x-1, got ";
+		printPolynomial<Field, Polynomial> (F, report, phi);
 	}
 
 	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testIdentityMinpoly");
@@ -87,9 +136,9 @@ static bool testIdentityMinpoly (Field &F, size_t n, bool symmetrizing, const Me
 }
 
 template <class Field>
-static bool testIdentityMinpoly (Field &F, size_t n, bool symmetrizing=false) 
+static bool testIdentityMinpoly (Field &F, size_t n, bool symmetrizing=false)
 {
-    return testIdentityMinpoly(F, n, symmetrizing, Method::Wiedemann());
+    return testIdentityMinpoly(F, n, symmetrizing, Method::Blackbox());
 }
 
 /* Test 2: Minimal polynomial of a nilpotent matrix
@@ -113,7 +162,7 @@ static bool testNilpotentMinpoly (Field &F, size_t n, const Meth& M)
 
 	commentator.start ("Testing nilpotent minpoly", "testNilpotentMinpoly");
 
-	bool ret = true;
+	bool ret;
 	bool lowerTermsCorrect = true;
 
 	size_t i;
@@ -128,6 +177,7 @@ static bool testNilpotentMinpoly (Field &F, size_t n, const Meth& M)
 	minpoly (phi, A, M);
 
 	ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+        A.write (report, FORMAT_MAPLE);
 	report << "Minimal polynomial is: ";
 	printPolynomial (F, report, phi);
 
@@ -135,10 +185,13 @@ static bool testNilpotentMinpoly (Field &F, size_t n, const Meth& M)
 		if (!F.isZero (phi[i]))
 			lowerTermsCorrect = false;
 
-	if (phi.size () != n + 1 || !F.isOne (phi[n]) || !lowerTermsCorrect) {
+	if (phi.size () == n + 1 && F.isOne (phi[n]) && lowerTermsCorrect)
+		ret = true;
+	else {
 		ret = false;
 		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-			<< "ERROR: Minimal polynomial is incorrect" << endl;
+			<< "ERROR: A^n = 0, should get x^" << n <<", got ";
+		printPolynomial (F, report, phi);
 	}
 
 	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testNilpotentMinpoly");
@@ -148,7 +201,7 @@ static bool testNilpotentMinpoly (Field &F, size_t n, const Meth& M)
 template <class Field>
 static bool testNilpotentMinpoly (Field &F, size_t n)
 {
-    return testNilpotentMinpoly(F, n, Method::Wiedemann());
+    return testNilpotentMinpoly(F, n, Method::Blackbox());
 }
 
 /* Test 3: Random minpoly of sparse matrix
@@ -194,7 +247,7 @@ bool testRandomMinpoly (Field                 &F,
 		iter_passed = true;
 
 		A_stream.reset ();
-		Blackbox A (F, A_stream);                
+		Blackbox A (F, A_stream);
 
 		ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
 		report << "Matrix:" << endl;
@@ -231,7 +284,7 @@ bool testRandomMinpoly (Field                 &F,
 
 		if (!iter_passed)
 			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: Output vector was incorrect" << endl;
+				<< "ERROR: A = rand, purported-minpoly(A) is not zero." << endl;
 		commentator.stop ("done");
 		commentator.progress ();
 	}
@@ -246,16 +299,81 @@ bool testRandomMinpoly (Field                 &F,
 			BBStream    &A_stream,
 			VectStream &v_stream)
 {
-    return testRandomMinpoly(F, iterations, A_stream, v_stream, Method::Wiedemann());
+    return testRandomMinpoly(F, iterations, A_stream, v_stream, Method::Blackbox());
+}
+
+/* Test 4: test gram matrix.
+     A test of behaviour with self-orthogonal rows and cols.
+
+	 Gram matrix is 1's offdiagonal and 0's on diagonal.  Self orthogonality when characteristic | n-1.
+
+	 Arg m is ignored.
+	 if p := characteristic is small then size is p+1 and minpoly is x^2 + x
+	 (because A^2 = (p-1)A).
+	 if p is large, size is 2 and minpoly is x^2 -1.
+*/
+template <class Field, class Meth>
+static bool testGramMinpoly (Field &F, size_t m, bool symmetrizing, const Meth& M)
+{
+	commentator.start ("Testing gram minpoly", "testGramMinpoly");
+	typedef vector <typename Field::Element> Polynomial;
+	integer n;
+	F.characteristic(n); n += 1;
+	if (n > 30) n = 2;
+	Polynomial phi;
+	typename Field::Element one, zero, neg1; F.init(one, 1); F.init(zero, 0); F.init(neg1); F.neg(neg1, one);
+	DenseMatrix<Field> A(F, n, n);
+	for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) A.setEntry(i, j, one);
+	for (int i = 0; i < n; ++i) A.setEntry(i, i, zero);
+	minpoly(phi, A, M);
+
+	ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+        A.write (report);
+	report << "Minimal polynomial is: ";
+	printPolynomial<Field, Polynomial> (F, report, phi);
+
+	bool ret;
+	if (n == 2)
+		if ( phi.size() == 3 && F.areEqual(phi[0], neg1) && F.isZero(phi[1]) && F.isOne(phi[2]))
+			ret = true;
+		else
+		{
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+				<< "ERROR: A = gram, should get x^2 - x, got ";
+			printPolynomial<Field, Polynomial> (F, report, phi);
+			ret = false;
+		}
+	else
+		if (phi.size() == 3 && F.isZero(phi[0]) && F.isOne(phi[1]) && F.isOne(phi[2]))
+			ret = true;
+		else
+		{
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+				<< "ERROR: A = gram, should get x^2 + x, got ";
+			printPolynomial<Field, Polynomial> (F, report, phi);
+			ret = false;
+		}
+		commentator.stop (MSG_STATUS (ret), (const char *) 0, "testGramMinpoly");
+		return ret;
+}
+
+template <class Field>
+static bool testGramMinpoly (Field &F, size_t n)
+{
+	return testGramMinpoly(F, n, false, Method::Blackbox());
 }
 
 
 int main (int argc, char **argv)
 {
+	commentator.setMaxDetailLevel (-1);
+
+	commentator.setMaxDepth (-1);
 	bool pass = true;
 
 	static size_t n = 10;
-	static integer q = 2147483647U;
+	//static integer q = 2147483647U;
+	static integer q = 1000003; // ok for both Modular<int> and Modular<double>
 	static int iterations = 1;
 	static int numVectors = 1;
 	static int k = 3;
@@ -266,40 +384,80 @@ int main (int argc, char **argv)
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
 		{ 'v', "-v V", "Use V test vectors for the random minpoly tests.", TYPE_INT,     &numVectors },
 		{ 'k', "-k K", "K nonzero Elements per row in sparse random apply test.", TYPE_INT,     &k },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
 
 	parseArguments (argc, argv, args);
-
-// /////////////// finite field part //////////////////
-	typedef Modular<LinBox::uint32> Field;
-	typedef vector<Field::Element> DenseVector;
-	typedef SparseMatrix<Field>::Row SparseVector;
-	//typedef pair<vector<size_t>, vector<Field::Element> > SparseVector;
-	Field F (q);
-	srand (time (NULL));
-
 	commentator.getMessageClass (TIMING_MEASURE).setMaxDepth (10);
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (10);
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
 
-	commentator.start("Wiedemann prime field minpoly test suite", "Wminpoly");
-	RandomDenseStream<Field, DenseVector, NonzeroRandIter<Field> >
-		v_stream (F, NonzeroRandIter<Field> (F, Field::RandIter (F)), n, numVectors);
-	RandomSparseStream<Field, SparseVector, NonzeroRandIter<Field> >
-		A_stream (F, NonzeroRandIter<Field> (F, Field::RandIter (F)), (double) k / (double) n, n, n);
+	// /////////////// finite field part //////////////////
+	if (q > 5 && q % 2 != 0 && q % 3 != 0 && q % 5 != 0 )
+	{
+		//typedef Modular<uint32_t> Field;
+		//typedef Modular<int> Field;
+		typedef Modular<double> Field;
+		Field F (q);
+		srand (time (NULL));
+
+		commentator.start("Blackbox prime field minpoly test suite", "Wminpoly");
+
+		//no symmetrizing
+		if (!testZeroMinpoly  	  (F, n)) pass = false;
+		if (!testIdentityMinpoly  (F, n)) pass = false;
+		if (!testNilpotentMinpoly (F, n)) pass = false;
+		//if (!testRandomMinpoly    (F, n)) pass = false;
+		if (!testGramMinpoly      (F, n)) pass = false;
+
+		// symmetrizing
+		//if (!testZeroMinpoly  	  (F, n, true)) pass = false;
+		if (!testIdentityMinpoly  (F, n, true)) pass = false;
+		//if (!testNilpotentMinpoly (F, n, true)) pass = false;
+		//if (!testRandomMinpoly    (F, n, true)) pass = false;
+		//if (!testGramMinpoly      (F, n, true)) pass = false;
+		//need other tests...
+
+		commentator.stop("Blackbox prime field minpoly test suite");
+	}
+	else{
+
+		int p;
+		if (q % 2 == 0) p = 2;
+		if (q % 3 == 0) p = 3;
+		if (q % 5 == 0) p = 5;
+		int e = 0;  do {++e; q = q/p; } while (q > 1);
+		typedef GivaroGfq Field;
+		Field F (p, e);
+		srand (time (NULL));
+
+		commentator.start("Blackbox non-prime field minpoly test suite", "Wminpoly");
+		ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+		F.write(report);
+
+		//no symmetrizing
+		if (!testZeroMinpoly  	  (F, n)) pass = false;
+		if (!testIdentityMinpoly  (F, n)) pass = false;
+		if (!testNilpotentMinpoly (F, n)) pass = false;
+		//if (!testRandomMinpoly    (F, n)) pass = false;
+		if (!testGramMinpoly      (F, n)) pass = false;
+
+		// symmetrizing
+		//if (!testZeroMinpoly  	  (F, n, true)) pass = false;
+		if (!testIdentityMinpoly  (F, n, true)) pass = false;
+		//if (!testNilpotentMinpoly (F, n, true)) pass = false;
+		//if (!testRandomMinpoly    (F, n, true)) pass = false;
+		//if (!testGramMinpoly      (F, n, true)) pass = false;
+		//need other tests...
+
+		commentator.stop("Blackbox non-prime field minpoly test suite");
+	}
 
-	//no symmetrizing
-	if (!testIdentityMinpoly  (F, n)) pass = false;
-	if (!testNilpotentMinpoly (F, n)) pass = false;
-	if (!testRandomMinpoly    (F, iterations, A_stream, v_stream)) pass = false;
+#if 0
 
-	// symmetrizing
-	if (!testIdentityMinpoly  (F, n, true)) pass = false;
-	//need other tests...
+	Modular<uint32_t> F (q);
 
-	commentator.stop("Wiedemann prime field minpoly test suite");
 
 	commentator.start("Hybrid prime field minpoly test suite", "Hminpoly");
 	if (!testIdentityMinpoly  (F, n, false,  Method::Hybrid())) pass = false;
@@ -316,7 +474,7 @@ int main (int argc, char **argv)
 	if (!testNilpotentMinpoly (F, n, Method::Elimination())) pass = false;
 	commentator.stop("Elimination prime field minpoly test suite");
 
-// /////////////// integer part //////////////////
+	// /////////////// integer part //////////////////
 	typedef vector<PID_integer::Element> ZDenseVector;
 	typedef SparseMatrix<PID_integer>::Row ZSparseVector;
 	//typedef pair<vector<size_t>, vector<Field::Element> > SparseVector;
@@ -327,14 +485,14 @@ int main (int argc, char **argv)
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (10);
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
 
-	commentator.start("Wiedemann integer minpoly test suite", "WIminpoly");
+	commentator.start("Blackbox integer minpoly test suite", "WIminpoly");
 
 	RandomDenseStream<PID_integer, ZDenseVector, NonzeroRandIter<PID_integer> >
-		zv_stream (Z, NonzeroRandIter<PID_integer> (Z, PID_integer::RandIter (Z)), n, numVectors);
+	zv_stream (Z, NonzeroRandIter<PID_integer> (Z, PID_integer::RandIter (Z)), n, numVectors);
 	RandomSparseStream<PID_integer, ZSparseVector, NonzeroRandIter<PID_integer> >
-		zA_stream (Z, NonzeroRandIter<PID_integer> (Z, PID_integer::RandIter (Z)), (double) k / (double) n, n, n);
+	zA_stream (Z, NonzeroRandIter<PID_integer> (Z, PID_integer::RandIter (Z)), (double) k / (double) n, n, n);
 
-            // Hybrid
+	// Hybrid
 	//no symmetrizing
 	if (!testIdentityMinpoly  (Z, n)) pass = false;
 	if (!testNilpotentMinpoly (Z, n)) pass = false;
@@ -344,7 +502,7 @@ int main (int argc, char **argv)
 	// symmetrizing
 	if (!testIdentityMinpoly  (Z, n, true)) pass = false;
 
-	commentator.stop("Wiedemann integer minpoly test suite");
+	commentator.stop("Blackbox integer minpoly test suite");
 
 	commentator.start("Hybrid integer minpoly test suite", "HIminpoly");
 	if (!testIdentityMinpoly  (Z, n, false,  Method::Hybrid())) pass = false;
@@ -361,5 +519,6 @@ int main (int argc, char **argv)
 	if (!testNilpotentMinpoly (Z, n, Method::Elimination())) pass = false;
 	commentator.stop("Elimination integer minpoly test suite");
 
+#endif
 	return pass ? 0 : -1;
 }
diff --git a/tests/test-modular-balanced-double.C b/tests/test-modular-balanced-double.C
new file mode 100644
index 0000000..e253018
--- /dev/null
+++ b/tests/test-modular-balanced-double.C
@@ -0,0 +1,102 @@
+/* -*- 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
+/* Copyright (C) LinBox
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+/*! @file  tests/test-modular-balanced-double.C
+ * @ingroup tests
+ * @brief  tests only runFieldTests on modular-balanced-double
+ * @test   tests only runFieldTests on modular-balanced-double
+ */
+
+
+
+#include "linbox/linbox-config.h"
+
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <vector>
+#include <queue>
+
+#include "linbox/field/modular-balanced-double.h"
+
+#include "linbox/util/commentator.h"
+#include "linbox/util/debug.h"
+
+
+#include "test-common.h"
+#include "test-generic.h"
+
+using namespace LinBox;
+
+/*! @bug testRandomIterator fails
+ */
+int main (int argc, char **argv)
+{
+	static size_t n = 1000;
+	static int iterations = 1;
+	static int trials = 100000;
+	static int categories = 100;
+	static int hist_level = 1;
+
+	static Argument args[] = {
+		{ 'n', "-n N", "Set dimension of test vectors to NxN.", TYPE_INT,     &n },
+		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
+		{ 't', "-t T", "Number of trials for the random iterator test.", TYPE_INT, &trials },
+		{ 'c', "-c C", "Number of categories for the random iterator test.", TYPE_INT, &categories },
+		{ 'H', "-H H", "History level for random iterator test.", TYPE_INT, &hist_level },
+		END_OF_ARGUMENTS
+	};
+
+	parseArguments (argc, argv, args);
+
+	commentator.start("ModularBalanced<double> field test suite", "ModularBalanced<double>");
+	bool pass = true;
+
+	ModularBalanced<double> F_int (67108859);
+	ModularBalanced<double> G_int (2011);
+	ModularBalanced<double> H_int (3);
+
+	integer k = FieldTraits<ModularBalanced<double> >::maxModulus() ;
+	prevprime(k,k);
+	ModularBalanced<double> I_int(k);
+
+	// Make sure some more detailed messages get printed
+	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (4);
+	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
+
+	if (!runFieldTests (F_int,  "ModularBalanced<double>",  iterations, n, false)) pass = false;
+	// if (!testRandomIterator (F_int,  "ModularBalanced<double>", trials, categories, hist_level)) pass = false;
+
+	if (!runFieldTests (G_int,  "ModularBalanced<double>",  iterations, n, false)) pass = false;
+	// if (!testRandomIterator (G_int,  "ModularBalanced<double>", trials, categories, hist_level)) pass = false;
+
+	if (!runFieldTests (H_int,  "ModularBalanced<double>",  iterations, n, false)) pass = false;
+	// if (!testRandomIterator (H_int,  "ModularBalanced<double>", trials, categories, hist_level)) pass = false;
+
+	if (!runFieldTests (I_int,  "ModularBalanced<double>",  iterations, n, false)) pass = false;
+	// if (!testRandomIterator (I_int,  "ModularBalanced<double>", trials, categories, hist_level)) pass = false;
+
+
+	commentator.stop("ModularBalanced<double> field test suite");
+	return pass ? 0 : -1;
+}
diff --git a/tests/test-modular-balanced-float.C b/tests/test-modular-balanced-float.C
new file mode 100644
index 0000000..2934251
--- /dev/null
+++ b/tests/test-modular-balanced-float.C
@@ -0,0 +1,99 @@
+/* -*- 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
+/* Copyright (C) LinBox
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+/*! @file  tests/test-modular-balanced-float.C
+ * @ingroup tests
+ * @brief  tests only runFieldTests on modular-balanced-float
+ * @test   tests only runFieldTests on modular-balanced-float
+ */
+
+
+
+#include "linbox/linbox-config.h"
+
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <vector>
+#include <queue>
+
+#include "linbox/field/modular-balanced-float.h"
+
+#include "test-common.h"
+#include "test-generic.h"
+
+using namespace LinBox;
+
+/*! @bug testRandomIterator fails
+ */
+int main (int argc, char **argv)
+{
+	static size_t n = 1000;
+	static int iterations = 1;
+	static int trials = 100000;
+	static int categories = 100;
+	static int hist_level = 1;
+
+	static Argument args[] = {
+		{ 'n', "-n N", "Set dimension of test vectors to NxN.", TYPE_INT,     &n },
+		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
+		{ 't', "-t T", "Number of trials for the random iterator test.", TYPE_INT, &trials },
+		{ 'c', "-c C", "Number of categories for the random iterator test.", TYPE_INT, &categories },
+		{ 'H', "-H H", "History level for random iterator test.", TYPE_INT, &hist_level },
+		END_OF_ARGUMENTS
+	};
+
+	parseArguments (argc, argv, args);
+
+	commentator.start("ModularBalanced<float> field test suite", "ModularBalanced<float>");
+	bool pass = true;
+
+	ModularBalanced<float> F_int (4093);//(2147483629);//(2147483647);
+	ModularBalanced<float> G_int (2011);
+	ModularBalanced<float> H_int (3);
+	integer k = FieldTraits<ModularBalanced<float> >::maxModulus() ;
+	prevprime(k,k);
+	ModularBalanced<float> I_int(k);
+
+	// Make sure some more detailed messages get printed
+	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (4);
+	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
+
+	if (!runFieldTests (F_int,  "ModularBalanced<float>",  iterations, n, false)) pass = false;
+	// if (!testRandomIterator (F_int,  "ModularBalanced<float>", trials, categories, hist_level)) pass = false;
+
+	if (!runFieldTests (G_int,  "ModularBalanced<float>",  iterations, n, false)) pass = false;
+	// if (!testRandomIterator (G_int,  "ModularBalanced<float>", trials, categories, hist_level)) pass = false;
+
+	if (!runFieldTests (H_int,  "ModularBalanced<float>",  iterations, n, false)) pass = false;
+	// if (!testRandomIterator (H_int,  "ModularBalanced<float>", trials, categories, hist_level)) pass = false;
+
+	if (!runFieldTests (I_int,  "ModularBalanced<float>",  iterations, n, false)) pass = false;
+	// if (!testRandomIterator (I_int,  "ModularBalanced<float>", trials, categories, hist_level)) pass = false;
+
+
+
+
+	commentator.stop("ModularBalanced<float> field test suite");
+	return pass ? 0 : -1;
+}
diff --git a/tests/test-modular-balanced-int.C b/tests/test-modular-balanced-int.C
index b6c8bd5..67600da 100644
--- a/tests/test-modular-balanced-int.C
+++ b/tests/test-modular-balanced-int.C
@@ -1,4 +1,33 @@
 /* -*- 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
+/* Copyright (C) LinBox
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+/*! @file  tests/test-modular-balanced-int.C
+ * @ingroup tests
+ * @brief  tests only runFieldTests on modular-balanced-int32_t
+ * @test   tests only runFieldTests on modular-balanced-int32_t
+ */
+
+
 
 #include "linbox/linbox-config.h"
 
@@ -8,13 +37,15 @@
 #include <vector>
 #include <queue>
 
-#include "linbox/field/modular-balanced-int.h"
+#include "linbox/field/modular-balanced-int32.h"
 
 #include "test-common.h"
 #include "test-generic.h"
 
 using namespace LinBox;
 
+/*! @bug the arguments are meaningless
+ */
 int main (int argc, char **argv)
 {
 	static integer q1("18446744073709551557");
@@ -29,31 +60,47 @@ int main (int argc, char **argv)
 
 	static Argument args[] = {
 		{ 'K', "-K Q", "Operate over the \"field\" GF(Q) [1] for integer modulus.", TYPE_INTEGER, &q1 },
-		{ 'Q', "-Q Q", "Operate over the \"field\" GF(Q) [1] for uint32 modulus.", TYPE_INTEGER, &q2 },
-		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1] for uint16 modulus.", TYPE_INTEGER, &q3 },
-		{ 'p', "-p P", "Operate over the \"field\" GF(Q) [1] for uint8 modulus.", TYPE_INT, &q4 },
+		{ 'Q', "-Q Q", "Operate over the \"field\" GF(Q) [1] for uint32_t modulus.", TYPE_INTEGER, &q2 },
+		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1] for uint16_t modulus.", TYPE_INTEGER, &q3 },
+		{ 'p', "-p P", "Operate over the \"field\" GF(Q) [1] for uint8_t modulus.", TYPE_INT, &q4 },
 		{ 'n', "-n N", "Set dimension of test vectors to NxN.", TYPE_INT,     &n },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
 		{ 't', "-t T", "Number of trials for the random iterator test.", TYPE_INT, &trials },
 		{ 'c', "-c C", "Number of categories for the random iterator test.", TYPE_INT, &categories },
 		{ 'H', "-H H", "History level for random iterator test.", TYPE_INT, &hist_level },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
 
-	commentator.start("ModularBalanced<int> field test suite", "ModularBalanced<int>");
+	commentator.start("ModularBalanced<int32_t> field test suite", "ModularBalanced<int32_t>");
 	bool pass = true;
 
-	ModularBalanced<int> F_int (1073741789);//(2147483629);//(2147483647);
+	ModularBalanced<int32_t> F_int (1073741789);//(2147483629);//(2147483647);
+	ModularBalanced<int32_t> G_int (2147483647);
+	ModularBalanced<int32_t> H_int (3);
+	integer k = FieldTraits<ModularBalanced<int32_t> >::maxModulus() ;
+	prevprime(k,k);
+	ModularBalanced<int32_t> I_int(k);
 
 	// Make sure some more detailed messages get printed
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (4);
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
 
-	if (!runFieldTests (F_int,  "ModularBalanced<int>",  iterations, n, false)) pass = false;
-	//if (!testRandomIterator (F_int,  "ModularBalanced<int>", trials, categories, hist_level)) pass = false;
+	if (!runFieldTests (F_int,  "ModularBalanced<int32_t>",  iterations, n, false)) pass = false;
+	if (!testRandomIterator (F_int,  "ModularBalanced<int32_t>", trials, categories, hist_level)) pass = false;
+
+	if (!runFieldTests (G_int,  "ModularBalanced<int32_t>",  iterations, n, false)) pass = false;
+	if (!testRandomIterator (G_int,  "ModularBalanced<int32_t>", trials, categories, hist_level)) pass = false;
+
+	if (!runFieldTests (H_int,  "ModularBalanced<int32_t>",  iterations, n, false)) pass = false;
+	if (!testRandomIterator (H_int,  "ModularBalanced<int32_t>", trials, categories, hist_level)) pass = false;
+
+
+	if (!runFieldTests (I_int,  "ModularBalanced<int32_t>",  iterations, n, false)) pass = false;
+	// if (!testRandomIterator (I_int,  "ModularBalanced<int32_t>", trials, categories, hist_level)) pass = false;
+
 
-	commentator.stop("ModularBalanced<int> field test suite");
+	commentator.stop("ModularBalanced<int32_t> field test suite");
 	return pass ? 0 : -1;
 }
diff --git a/tests/test-modular-byte.C b/tests/test-modular-byte.C
index 10d74cf..b1b6a56 100644
--- a/tests/test-modular-byte.C
+++ b/tests/test-modular-byte.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-modular.C
  * Copyright (C) 2001, 2002 Bradford Hovinen,
@@ -17,6 +18,15 @@
  * See COPYING for license information.
  */
 
+
+/*! @file  tests/test-modular-byte.C
+ * @ingroup tests
+ * @brief  run runFieldTests and testRandomIterator on modular-byte
+ * @test   run runFieldTests and testRandomIterator on modular-byte
+ */
+
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -48,14 +58,20 @@ int main (int argc, char **argv)
 		{ 't', "-t T", "Number of trials for the random iterator test.", TYPE_INT, &trials },
 		{ 'c', "-c C", "Number of categories for the random iterator test.", TYPE_INT, &categories },
 		{ 'H', "-H H", "History level for random iterator test.", TYPE_INT, &hist_level },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
 
-	commentator.start("Modular<int8> field test suite", "Modular<int8>");
+	commentator.start("Modular<int8_t> field test suite", "Modular<int8_t>");
 	bool pass = true;
-	Modular<int8> F(q);
+	Modular<int8_t> F(q);
+
+	integer k = FieldTraits<Modular<int8_t> >::maxModulus() ;
+	prevprime(k,k);
+	Modular<int8_t> I_int(k);
+
+
 
 	// Make sure some more detailed messages get printed
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (4);
@@ -64,6 +80,10 @@ int main (int argc, char **argv)
 	if (!runFieldTests (F,  "Modular<byte>",  iterations, n, false)) pass = false;
 	if (!testRandomIterator (F,  "Modular<byte>", trials, categories, hist_level)) pass = false;
 
-	commentator.stop("Modular<int8> field test suite");
+	if (!runFieldTests (I_int,  "Modular<int8_t>",  iterations, n, false)) pass = false;
+	if (!testRandomIterator (I_int,  "Modular<int8_t>", trials, categories, hist_level)) pass = false;
+
+
+	commentator.stop("Modular<int8_t> field test suite");
 	return pass ? 0 : -1;
 }
diff --git a/tests/test-modular-double.C b/tests/test-modular-double.C
index 307e270..e98f61e 100644
--- a/tests/test-modular-double.C
+++ b/tests/test-modular-double.C
@@ -1,9 +1,10 @@
 /* -*- 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
 
 /* tests/test-modular-double.C
- * Brazenly stolen by bds from 
+ * Brazenly stolen by bds from
  * tests/test-modular-short.C
- * Brazenly stolen by Zhendong Wan (Copyright (C) 2003) from 
+ * Brazenly stolen by Zhendong Wan (Copyright (C) 2003) from
  * tests/test-modular.C
  * Copyright (C) 2001, 2002 Bradford Hovinen,
  * Copyright (C) 2002 Dave Saunders
@@ -21,6 +22,13 @@
  * See COPYING for license information.
  */
 
+/*! @file  tests/test-modular-double.C
+ * @ingroup tests
+ * @brief tests only runFieldTests for modular-double.
+ * @test  tests only runFieldTests for modular-double.
+ */
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -44,7 +52,7 @@ int main (int argc, char **argv)
 	static Argument args[] = {
 		{ 'n', "-n N", "Set dimension of test vectors to NxN.", TYPE_INT,     &n },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
@@ -52,14 +60,18 @@ int main (int argc, char **argv)
 	commentator.start("Modular<double> field test suite", "Modular<double>");
 	bool pass = true;
 
-	//Modular<double> F2 (2); 
-	Modular<double> F3 (3); 
-	Modular<double> F5 (5); 
-	Modular<double> F7 (7); 
-	Modular<double> F11 (11); 
-	Modular<double> F (32749); 
-	Modular<double> G (65521); 
-	//Modular<double> H (1099511627689); 
+	//Modular<double> F2 (2);
+	Modular<double> F3 (3);
+	Modular<double> F5 (5);
+	Modular<double> F7 (7);
+	Modular<double> F11 (11);
+	Modular<double> F (32749);
+	Modular<double> G (65521);
+	//Modular<double> H (1099511627689);
+	integer k = FieldTraits<Modular<double> >::maxModulus() ;
+	prevprime(k,k);
+	Modular<double> I_int(k);
+
 
 	// Make sure some more detailed messages get printed
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (4);
@@ -80,6 +92,10 @@ int main (int argc, char **argv)
 	report << "Field G" << std::endl;
 	if (!runFieldTests (G,  "Modular<double>",  iterations, n, false)) pass = false;
 
+	if (!runFieldTests (I_int,  "Modular<double>",  iterations, n, false)) pass = false;
+	// if (!testRandomIterator (I_int,  "Modular<double>", trials, categories, hist_level)) pass = false;
+
+
 	commentator.stop("Modular<double> field test suite");
 	return pass ? 0 : -1;
 }
diff --git a/tests/test-modular-float.C b/tests/test-modular-float.C
new file mode 100644
index 0000000..ff4c97f
--- /dev/null
+++ b/tests/test-modular-float.C
@@ -0,0 +1,100 @@
+/* -*- 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
+
+/* tests/test-modular-float.C
+ * Brazenly stolen by bds from
+ * tests/test-modular-short.C
+ * Brazenly stolen by Zhendong Wan (Copyright (C) 2003) from
+ * tests/test-modular.C
+ * Copyright (C) 2001, 2002 Bradford Hovinen,
+ * Copyright (C) 2002 Dave Saunders
+ *
+ * Written by Bradford Hovinen <hovinen at cis.udel.edu>,
+ *            Dave Saunders <saunders at cis.udel.edu>
+ *
+ * ------------------------------------
+ * 2002-04-10 Bradford Hovinen <hovinen at cis.udel.edu>
+ *
+ * Rename from test-large-modular.C to test-modular.C; made other updates in
+ * accordance with changes to Modular interace.
+ * ------------------------------------
+ *
+ * See COPYING for license information.
+ */
+
+/*! @file  tests/test-modular-float.C
+ * @ingroup tests
+ * @warning F2 not tested
+ */
+
+
+#include "linbox/linbox-config.h"
+
+#include <iostream>
+#include <fstream>
+#include <sstream>
+#include <vector>
+#include <queue>
+
+#include "linbox/field/modular-float.h"
+
+#include "test-generic.h"
+#include "test-common.h"
+
+using namespace LinBox;
+
+int main (int argc, char **argv)
+{
+	static size_t n = 10000;
+	static int iterations = 1;
+
+	static Argument args[] = {
+		{ 'n', "-n N", "Set dimension of test vectors to NxN.", TYPE_INT,     &n },
+		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
+		END_OF_ARGUMENTS
+	};
+
+	parseArguments (argc, argv, args);
+
+	commentator.start("Modular<float> field test suite", "Modular<float>");
+	bool pass = true;
+
+	//Modular<float> F2 (2);
+	Modular<float> F3 (3);
+	Modular<float> F5 (5);
+	Modular<float> F7 (7);
+	Modular<float> F11 (11);
+	// Modular<float> F (2011);
+	// Modular<float> G (4093);
+	//Modular<float> H (1099511627689);
+	integer k = FieldTraits<Modular<float> >::maxModulus() ;
+	prevprime(k,k);
+	Modular<float> I_int(k);
+
+
+	// Make sure some more detailed messages get printed
+	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (4);
+	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
+	std::ostream& report = commentator.report();
+	// report << "Field F2" << std::endl;
+	//if (!runFieldTests (F2,  "Modular<float>",  iterations, n, false)) pass = false;
+	report << "Field F3" << std::endl;
+	if (!runFieldTests (F3,  "Modular<float>",  iterations, n, false)) pass = false;
+	report << "Field F5" << std::endl;
+	if (!runFieldTests (F5,  "Modular<float>",  iterations, n, false)) pass = false;
+	report << "Field F7" << std::endl;
+	if (!runFieldTests (F7,  "Modular<float>",  iterations, n, false)) pass = false;
+	report << "Field F11" << std::endl;
+	if (!runFieldTests (F11, "Modular<float>",  iterations, n, false)) pass = false;
+	// report << "Field F" << std::endl;
+	// if (!runFieldTests (F,   "Modular<float>",  iterations, n, false)) pass = false;
+	// report << "Field G" << std::endl;
+	// if (!runFieldTests (G,   "Modular<float>",  iterations, n, false)) pass = false;
+
+	if (!runFieldTests (I_int,  "Modular<float>",  iterations, n, false)) pass = false;
+	// if (!testRandomIterator (I_int,  "Modular<float>", trials, categories, hist_level)) pass = false;
+
+
+	commentator.stop("Modular<float> field test suite");
+	return pass ? 0 : -1;
+}
diff --git a/tests/test-modular-int.C b/tests/test-modular-int.C
index 62e35bc..a08421f 100644
--- a/tests/test-modular-int.C
+++ b/tests/test-modular-int.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-modular.C
  * Copyright (C) 2001, 2002 Bradford Hovinen,
@@ -17,6 +18,13 @@
  * See COPYING for license information.
  */
 
+/*! @file   tests/test-modular-int.C
+ * @ingroup tests
+ * @brief run runFieldTests testRandomIterator tests on modular-int32_t
+ * @test run runFieldTests testRandomIterator tests on modular-int32_t
+ */
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -25,7 +33,7 @@
 #include <vector>
 #include <queue>
 
-#include "linbox/field/modular-int.h"
+#include "linbox/field/modular-int32.h"
 
 #include "test-common.h"
 #include "test-generic.h"
@@ -46,31 +54,39 @@ int main (int argc, char **argv)
 
 	static Argument args[] = {
 		{ 'K', "-K Q", "Operate over the \"field\" GF(Q) [1] for integer modulus.", TYPE_INTEGER, &q1 },
-		{ 'Q', "-Q Q", "Operate over the \"field\" GF(Q) [1] for uint32 modulus.", TYPE_INTEGER, &q2 },
-		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1] for uint16 modulus.", TYPE_INTEGER, &q3 },
-		{ 'p', "-p P", "Operate over the \"field\" GF(Q) [1] for uint8 modulus.", TYPE_INT, &q4 },
+		{ 'Q', "-Q Q", "Operate over the \"field\" GF(Q) [1] for uint32_t modulus.", TYPE_INTEGER, &q2 },
+		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1] for uint16_t modulus.", TYPE_INTEGER, &q3 },
+		{ 'p', "-p P", "Operate over the \"field\" GF(Q) [1] for uint8_t modulus.", TYPE_INT, &q4 },
 		{ 'n', "-n N", "Set dimension of test vectors to NxN.", TYPE_INT,     &n },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
 		{ 't', "-t T", "Number of trials for the random iterator test.", TYPE_INT, &trials },
 		{ 'c', "-c C", "Number of categories for the random iterator test.", TYPE_INT, &categories },
 		{ 'H', "-H H", "History level for random iterator test.", TYPE_INT, &hist_level },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
 
-	commentator.start("Modular<int32> field test suite", "Modular<int32>");
+	commentator.start("Modular<int32_t> field test suite", "Modular<int32_t>");
 	bool pass = true;
 
-	Modular<int32> F_int (1073741789);//(2147483629);//(2147483647);
+	Modular<int32_t> F_int (1073741789);//(2147483629);//(2147483647);
+	integer k = FieldTraits<Modular<int32_t> >::maxModulus() ;
+	prevprime(k,k);
+	Modular<int32_t> I_int(k);
+
 
 	// Make sure some more detailed messages get printed
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (4);
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
 
-	if (!runFieldTests (F_int,  "Modular<int32>",  iterations, n, false)) pass = false;
-	if (!testRandomIterator (F_int,  "Modular<int32>", trials, categories, hist_level)) pass = false;
+	if (!runFieldTests (F_int,  "Modular<int32_t>",  iterations, n, false)) pass = false;
+	if (!testRandomIterator (F_int,  "Modular<int32_t>", trials, categories, hist_level)) pass = false;
+
+	if (!runFieldTests (I_int,  "Modular<int32_t>",  iterations, n, false)) pass = false;
+	if (!testRandomIterator (I_int,  "Modular<int32_t>", trials, categories, hist_level)) pass = false;
+
 
-	commentator.stop("Modular<int32> field test suite");
+	commentator.stop("Modular<int32_t> field test suite");
 	return pass ? 0 : -1;
 }
diff --git a/tests/test-modular-short.C b/tests/test-modular-short.C
index de6348d..242029c 100644
--- a/tests/test-modular-short.C
+++ b/tests/test-modular-short.C
@@ -1,6 +1,7 @@
 /* -*- 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
 
-/* tests/test-modular.C
+/* tests/test-modular-short.C
  * Copyright (C) 2001, 2002 Bradford Hovinen,
  * Copyright (C) 2002 Dave Saunders
  *
@@ -17,6 +18,14 @@
  * See COPYING for license information.
  */
 
+/*! @file  tests/test-modular-short.C
+ * @ingroup tests
+ * @brief run runFieldTests testRandomIterator tests on modular-short
+ * @test run runFieldTests testRandomIterator tests on modular-short
+ * short is int16_t
+ */
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -28,7 +37,7 @@
 #include "linbox/field/modular-short.h"
 
 #include "test-common.h"
-#include "test-generic.h"
+#include "test-field.h"
 
 using namespace LinBox;
 
@@ -46,15 +55,15 @@ int main (int argc, char **argv)
 
 	static Argument args[] = {
 		{ 'K', "-K Q", "Operate over the \"field\" GF(Q) [1] for integer modulus.", TYPE_INTEGER, &q1 },
-		{ 'Q', "-Q Q", "Operate over the \"field\" GF(Q) [1] for uint32 modulus.", TYPE_INTEGER, &q2 },
-		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1] for uint16 modulus.", TYPE_INTEGER, &q3 },
-		{ 'p', "-p P", "Operate over the \"field\" GF(Q) [1] for uint8 modulus.", TYPE_INT, &q4 },
+		{ 'Q', "-Q Q", "Operate over the \"field\" GF(Q) [1] for uint32_t modulus.", TYPE_INTEGER, &q2 },
+		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1] for uint16_t modulus.", TYPE_INTEGER, &q3 },
+		{ 'p', "-p P", "Operate over the \"field\" GF(Q) [1] for uint8_t modulus.", TYPE_INT, &q4 },
 		{ 'n', "-n N", "Set dimension of test vectors to NxN.", TYPE_INT,     &n },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
 		{ 't', "-t T", "Number of trials for the random iterator test.", TYPE_INT, &trials },
 		{ 'c', "-c C", "Number of categories for the random iterator test.", TYPE_INT, &categories },
 		{ 'H', "-H H", "History level for random iterator test.", TYPE_INT, &hist_level },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
@@ -63,6 +72,10 @@ int main (int argc, char **argv)
 	bool pass = true;
 
 	Modular<short> F_int (32749);
+	// Modular<short> F_int (101);
+	integer k = FieldTraits<Modular<short> >::maxModulus() ;
+	prevprime(k,k);
+	Modular<short> G_int(k);
 
 	// Make sure some more detailed messages get printed
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (4);
@@ -71,6 +84,11 @@ int main (int argc, char **argv)
 	if (!runFieldTests (F_int,  "Modular<short>",  iterations, n, false)) pass = false;
 	if (!testRandomIterator (F_int,  "Modular<short>", trials, categories, hist_level)) pass = false;
 
+	if (!runFieldTests (G_int,  "Modular<short>",  iterations, n, false)) pass = false;
+	if (!testRandomIterator (G_int,  "Modular<short>", trials, categories, hist_level)) pass = false;
+
+
+
 	commentator.stop("Modular<short> field test suite");
 	return pass ? 0 : -1;
 }
diff --git a/tests/test-modular.C b/tests/test-modular.C
index 22f0dc3..9791507 100644
--- a/tests/test-modular.C
+++ b/tests/test-modular.C
@@ -1,5 +1,5 @@
 /* -*- 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
 /* tests/test-modular.C
  * Copyright (C) 2001, 2002 Bradford Hovinen,
  * Copyright (C) 2002 Dave Saunders
@@ -17,6 +17,16 @@
  * See COPYING for license information.
  */
 
+
+/*! @file  tests/test-modular.C
+ * @ingroup tests
+ *
+ * @brief  runFieldTests on various <code>Modular<XXX></code> fields.
+ * @test   runFieldTests on various <code>Modular<XXX></code> fields.
+ */
+
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -47,15 +57,15 @@ int main (int argc, char **argv)
 
 	static Argument args[] = {
 		{ 'K', "-K Q", "Operate over the \"field\" GF(Q) [1] for integer modulus.", TYPE_INTEGER, &q1 },
-		{ 'Q', "-Q Q", "Operate over the \"field\" GF(Q) [1] for uint32 modulus.", TYPE_INTEGER, &q2 },
-		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1] for uint16 modulus.", TYPE_INTEGER, &q3 },
-		{ 'p', "-p P", "Operate over the \"field\" GF(Q) [1] for uint8 modulus.", TYPE_INT, &q4 },
+		{ 'Q', "-Q Q", "Operate over the \"field\" GF(Q) [1] for uint32_t modulus.", TYPE_INTEGER, &q2 },
+		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1] for uint16_t modulus.", TYPE_INTEGER, &q3 },
+		{ 'p', "-p P", "Operate over the \"field\" GF(Q) [1] for uint8_t modulus.", TYPE_INT, &q4 },
 		{ 'n', "-n N", "Set dimension of test vectors to NxN.", TYPE_INT,     &n },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
 		{ 't', "-t T", "Number of trials for the random iterator test.", TYPE_INT, &trials },
 		{ 'c', "-c C", "Number of categories for the random iterator test.", TYPE_INT, &categories },
 		{ 'H', "-H H", "History level for random iterator test.", TYPE_INT, &hist_level },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
@@ -64,25 +74,26 @@ int main (int argc, char **argv)
 	bool pass = true;
 
 	Modular<integer> F_integer (q1);
-	Modular<uint32> F_uint32 ((uint32) q2);
-	Modular<uint16> F_uint16 ((uint16) q3);
-	Modular<uint8> F_uint8 ((uint8) q4);
+	Modular<uint32_t> F_uint32_t ((uint32_t) q2);
+	Modular<uint16_t> F_uint16_t ((uint16_t) q3);
+	Modular<uint8_t> F_uint8_t ((uint8_t) q4);
 	Modular<float> F_float ((float) q4);
 
+
 	// Make sure some more detailed messages get printed
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (4);
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
 
-	if (!runFieldTests (F_integer, "Modular<integer>", iterations, n, false)) pass = false;
-	if (!runFieldTests (F_uint32,  "Modular<uint32>",  iterations, n, false)) pass = false;
-	if (!runFieldTests (F_uint16,  "Modular<uint16>",  iterations, n, false)) pass = false;
-	if (!runFieldTests (F_uint8,  "Modular<uint8>",  iterations, n, false)) pass = false;
-	if (!runFieldTests (F_float,  "Modular<float>",  iterations, n, false)) pass = false;
+	if (!runFieldTests (F_integer,"Modular<integer>", iterations, n, false)) pass = false;
+	if (!runFieldTests (F_uint32_t, "Modular<uint32_t>",  iterations, n, false)) pass = false;
+	if (!runFieldTests (F_uint16_t, "Modular<uint16_t>",  iterations, n, false)) pass = false;
+	if (!runFieldTests (F_uint8_t,  "Modular<uint8_t>",   iterations, n, false)) pass = false;
+	if (!runFieldTests (F_float,  "Modular<float>",   iterations, n, false)) pass = false;
 
-	//if (!testRandomIterator (F_integer, "Modular<integer>", trials, categories, hist_level)) pass = false;
-	if (!testRandomIterator (F_uint32,  "Modular<uint32>", trials, categories, hist_level)) pass = false;
-	if (!testRandomIterator (F_uint16,  "Modular<uint16>", trials, categories, hist_level)) pass = false;
-	if (!testRandomIterator (F_uint8,  "Modular<uint8>", trials, categories, hist_level)) pass = false;
+	if (!testRandomIterator (F_integer, "Modular<integer>", trials, categories, hist_level)) pass = false;
+	if (!testRandomIterator (F_uint32_t,  "Modular<uint32_t>",  trials, categories, hist_level)) pass = false;
+	if (!testRandomIterator (F_uint16_t,  "Modular<uint16_t>",  trials, categories, hist_level)) pass = false;
+	if (!testRandomIterator (F_uint8_t,    "Modular<uint8_t>",  trials, categories, hist_level)) pass = false;
 
 	commentator.stop("Modular test suite");
 	return pass ? 0 : -1;
diff --git a/tests/test-moore-penrose.C b/tests/test-moore-penrose.C
index 85eacf6..c8b5e54 100644
--- a/tests/test-moore-penrose.C
+++ b/tests/test-moore-penrose.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-moore-penrose.C
  * Copyright (C) 2001, 2002 Bradford Hovinen
@@ -21,6 +22,13 @@
  * Boston, MA 02111-1307, USA.
  */
 
+/*! @file  tests/test-moore-penrose.C
+ * @ingroup tests
+ * @brief no doc.
+ * @test no doc.
+ */
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -52,7 +60,7 @@ static SparseMatrix<Field,  Row>
 			  double                           K,
 			  vector<typename Field::Element> &dinv,
 			  VectorStream<Row>               &top_right_stream,
-			  VectorStream<Row>               &bottom_left_stream) 
+			  VectorStream<Row>               &bottom_left_stream)
 {
 	typedef SparseMatrix<Field, Row> Blackbox;
 
@@ -122,7 +130,7 @@ static bool testIdentityApply (Field                                           &
 			       size_t                                           n,
 			       size_t                                           m,
 			       size_t                                           r,
-			       VectorStream<vector<typename Field::Element> > &stream) 
+			       VectorStream<vector<typename Field::Element> > &stream)
 {
 	typedef vector <typename Field::Element> Vector;
 	typedef vector <pair <size_t, typename Field::Element> > Row;
@@ -215,7 +223,7 @@ static bool testRandomApply1 (Field                 &F,
 			      double                 K,
 			      VectorStream<Row>    &M_stream1,
 			      VectorStream<Row>    &M_stream2,
-			      VectorStream<Vector> &stream) 
+			      VectorStream<Vector> &stream)
 {
 	typedef SparseMatrix <Field, Row> Blackbox;
 
@@ -251,7 +259,7 @@ static bool testRandomApply1 (Field                 &F,
 		commentator.start ("Constructing Moore-Penrose inverse");
 		MoorePenrose<Blackbox> Adagger (A, r);
 		commentator.stop ("done");
-		
+
 		{
 			ostream &report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
 			report << "Input matrix" << endl;
@@ -259,12 +267,13 @@ static bool testRandomApply1 (Field                 &F,
 		}
 
 		Submatrix<Blackbox> Aprime (A, 0, 0, MIN (n, m), MIN (n, m));
-		rank (rank_A, Aprime, Method::Wiedemann());
+		LinBox::rank (rank_A, Aprime, Method::Wiedemann());
 
 		if (rank_A == r) {
 			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION)
 				<< "Rank is correct. Good." << endl;
-		} else
+		}
+		else
 			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
 				<< "Rank is incorrect (" << rank_A << "). Not good." << endl;
 
@@ -337,10 +346,10 @@ int main (int argc, char **argv)
 		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
 		{ 'k', "-k K", "Apply random Moore-Penrose to K vectors.", TYPE_INT,     &k },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
-	typedef Modular<LinBox::uint32> Field;  //C.Pernet: avoids confusion with givaro::uint32
+	typedef Modular<uint32_t> Field;  //C.Pernet: avoids confusion with givaro::uint32_t
 	typedef vector<Field::Element> DenseVector;
 	typedef pair<vector<size_t>, vector<Field::Element> > SparseVector;
 
diff --git a/tests/test-ntl-RR.C b/tests/test-ntl-RR.C
index 4ba048b..0919c6f 100644
--- a/tests/test-ntl-RR.C
+++ b/tests/test-ntl-RR.C
@@ -1,12 +1,24 @@
-/* -*- mode: c; style: linux -*- */
-
+/* -*- 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
 /* tests/test-ntl-zz_p.cpp
  * Copyright (C) 2002 William J. Turner
+ * Copyright (C) LinBox
  *
  * Written by William J. Turner <wjturner at math.ncsu.edu>
  *
+ * see COPYING file for license
+ *
+ */
+
+
+/*! @file  tests/test-ntl-RR.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test no doc
  */
 
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -20,15 +32,15 @@
 
 using namespace LinBox;
 
-int main (int argc, char **argv)
-{
+int main (int argc, char **argv) {
+
 	static size_t n = 10000;
 	static int iterations = 1;
 
         static Argument args[] = {
 		{ 'n', "-n N", "Set dimension of test vectors to NxN.", TYPE_INT,     &n },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
-                { '\0' }
+		END_OF_ARGUMENTS
         };
 
         parseArguments (argc, argv, args);
diff --git a/tests/test-ntl-ZZ_p.C b/tests/test-ntl-ZZ_p.C
index d284f3a..f746d67 100644
--- a/tests/test-ntl-ZZ_p.C
+++ b/tests/test-ntl-ZZ_p.C
@@ -1,3 +1,5 @@
+/* -*- 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; style: linux -*- */
 
 /* tests/test-ntl-ZZ_p.C
@@ -21,6 +23,15 @@
  * Boston, MA 02111-1307, USA.
  */
 
+
+/*! @file  tests/test-ntl-ZZ_p.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test no doc
+ */
+
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -44,7 +55,7 @@ int main (int argc, char **argv)
                 { 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
 		{ 'n', "-n N", "Set dimension of test vectors to NxN.", TYPE_INT,     &n },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
-                { '\0' }
+		END_OF_ARGUMENTS
         };
 
         parseArguments (argc, argv, args);
@@ -84,7 +95,7 @@ int main (int argc, char **argv)
 	}
         commentator.stop(MSG_STATUS (part_pass));
         pass &= part_pass;
-        
+
 	commentator.stop("UnparametricField<NTL::ZZ_p> field test suite");
 	return pass ? 0 : -1;
 }
diff --git a/tests/test-ntl-hankel.C b/tests/test-ntl-hankel.C
index e788870..11695ad 100644
--- a/tests/test-ntl-hankel.C
+++ b/tests/test-ntl-hankel.C
@@ -1,3 +1,36 @@
+/* -*- 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
+/* Copyright (C) LinBox
+ *
+ * Copyright (C) 2003 Austin Lobo, B. David Saunders
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+/*! @file  tests/test-ntl-hankel.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test no doc
+ */
+
+
+
+
 #include <iostream>
 #include <fstream>
 #include <vector>
@@ -7,7 +40,6 @@
 #include <linbox/integer.h>
 #include <linbox/blackbox/ntl-hankel.h>
 
-/* Copyright (C) 2003 Austin Lobo, B. David Saunders*/
 
 #include "test-generic.h"
 
@@ -17,102 +49,102 @@ using namespace std;
 
 int main(int argc, char* argv[])
 {
-  LinBox::commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (2);
-  ostream &report = LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-  
-  bool pass = true;
-  
-  static size_t n = 1000;
-  static long q = 2147483647;
-
-
-  static int iterations = 1;
-  
-  static Argument args[] = {
-    { 'n', "-n N", "Set dimension of test matrices to NxN.", TYPE_INT,     &n },
-    { 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INT, &q },
-    { 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
-	{ '\0' }
-  };
-  
-  parseArguments (argc, argv, args);
-  
-
-  
-  //------ Read q and construct F(q)
-  NTL::ZZ modulus; 	// prime modulus
-  modulus = q;
-  //std::cout << std::endl << "Enter a prime number for the modulus of the field: ";
-  //std::cin >> modulus;
-  report <<  "The modulus is " << modulus << std::endl;
-  NTL::ZZ_p::init(modulus); // NOTE: This is essential for using NTL
-  
-
-	commentator.start("Hankel black box test test suite", "Hankel");
-  report << "\tn= " <<  n << " \tq= " << q <<   endl ;
-
-  typedef LinBox::UnparametricField<NTL::ZZ_p> Field;
-  typedef Field::Element element;
-  typedef std::vector<element> Vector;  
-  
-  // Now we are using the NTL wrapper as the field, call the instance F
-  Field F;
-  element zero;
-  F.init(zero, 0);
-  
-  // Use the default constructor to create a matrix
-  LinBox::Hankel<Field> T;
-  
-  // Use a special constructor to construct a matrix of dim TSIZE
-  int TSIZE = 2*n-1;
-  Vector tdata(TSIZE); 
-  report << "The random vector is:" << std::endl;
-  for (unsigned int i=0; i < tdata.size(); i++) {
-    tdata[i] = NTL::random_ZZ_p() ;
-    report << tdata[i] << " ";
-  }
-  report << std::endl;
-  
-  LinBox::Hankel<Field> TT(F,tdata);
-  report << "The matrix is: " << std::endl;
-  TT.print(report);
-  
-  // Create an interesting input vector called idata
-  Vector idata((TSIZE+2)/2), odata((TSIZE+2)/2);
-  report << "A random col vector:\t" << std::endl;
-  for (unsigned int i=0; i < idata.size(); i++) {
-    idata[i] = NTL::random_ZZ_p() ;
-    report << idata[i] << " ";
-  }
-  report << std::endl;
-  
-  // Apply the matrix to the vector just created
-  // Testing the apply function when both input and output are over ZZ_p
-  TT.applyTranspose(odata, idata);
-  report << "\tTesting apply Transpose:----------------- \nResult is[";
-  for (unsigned int i = 0; i < odata.size(); i++)
-    report << odata[i] << " ";
-  report << "]\n";
-  
-  
-  
-  TT.apply(odata, idata);
-  report << "\n\nTesting  apply :--------------------- \nResult is[";
-  for (unsigned int i = 0; i < odata.size(); i++)
-    report << odata[i] << " ";
-  report << "]\n";
-  
-   report << "Setting the matrix to UniModular Lower Triangular";
-   TT.setToUniModLT();
-   TT.print(report);
-   report << "\nSetting the matrix to UniModular Upper Triangular";
-      TT.setToUniModUT();
-      TT.print(report);
-  
-  pass = testBlackbox(TT);
-
-	commentator.stop("Hankel black box test test suite");
-  return pass ? 0 : -1;
-  
+	LinBox::commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (2);
+	ostream &report = LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+
+	bool pass = true;
+
+	static size_t n = 1000;
+	static long q = 2147483647;
+
+
+	static int iterations = 1;
+
+	static Argument args[] = {
+		{ 'n', "-n N", "Set dimension of test matrices to NxN.", TYPE_INT,     &n },
+		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INT, &q },
+		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
+		END_OF_ARGUMENTS
+	};
+
+	parseArguments (argc, argv, args);
+
+
+
+	//------ Read q and construct F(q)
+	NTL::ZZ modulus; 	// prime modulus
+	modulus = q;
+	//std::cout << std::endl << "Enter a prime number for the modulus of the field: ";
+	//std::cin >> modulus;
+	report <<  "The modulus is " << modulus << std::endl;
+	NTL::ZZ_p::init(modulus); // NOTE: This is essential for using NTL
+
+
+	LinBox::commentator.start("Hankel black box test test suite", "Hankel");
+	report << "\tn= " <<  n << " \tq= " << q <<   endl ;
+
+	typedef LinBox::UnparametricField<NTL::ZZ_p> Field;
+	typedef Field::Element element;
+	typedef std::vector<element> Vector;
+
+	// Now we are using the NTL wrapper as the field, call the instance F
+	Field F;
+	element zero;
+	F.init(zero, 0);
+
+	// Use the default constructor to create a matrix
+	LinBox::Hankel<Field> T;
+
+	// Use a special constructor to construct a matrix of dim TSIZE
+	int TSIZE = 2*n-1;
+	Vector tdata(TSIZE);
+	report << "The random vector is:" << std::endl;
+	for (unsigned int i=0; i < tdata.size(); i++) {
+		tdata[i] = NTL::random_ZZ_p() ;
+		report << tdata[i] << " ";
+	}
+	report << std::endl;
+
+	LinBox::Hankel<Field> TT(F,tdata);
+	report << "The matrix is: " << std::endl;
+	TT.print(report);
+
+	// Create an interesting input vector called idata
+	Vector idata((TSIZE+2)/2), odata((TSIZE+2)/2);
+	report << "A random col vector:\t" << std::endl;
+	for (unsigned int i=0; i < idata.size(); i++) {
+		idata[i] = NTL::random_ZZ_p() ;
+		report << idata[i] << " ";
+	}
+	report << std::endl;
+
+	// Apply the matrix to the vector just created
+	// Testing the apply function when both input and output are over ZZ_p
+	TT.applyTranspose(odata, idata);
+	report << "\tTesting apply Transpose:----------------- \nResult is[";
+	for (unsigned int i = 0; i < odata.size(); i++)
+		report << odata[i] << " ";
+	report << "]\n";
+
+
+
+	TT.apply(odata, idata);
+	report << "\n\nTesting  apply :--------------------- \nResult is[";
+	for (unsigned int i = 0; i < odata.size(); i++)
+		report << odata[i] << " ";
+	report << "]\n";
+
+	report << "Setting the matrix to UniModular Lower Triangular";
+	TT.setToUniModLT();
+	TT.print(report);
+	report << "\nSetting the matrix to UniModular Upper Triangular";
+	TT.setToUniModUT();
+	TT.print(report);
+
+	pass = testBlackbox(TT);
+
+	LinBox::commentator.stop("Hankel black box test test suite");
+	return pass ? 0 : -1;
+
 }
 
diff --git a/tests/test-ntl-lzz_p.C b/tests/test-ntl-lzz_p.C
index b34e0e7..2837e07 100644
--- a/tests/test-ntl-lzz_p.C
+++ b/tests/test-ntl-lzz_p.C
@@ -1,3 +1,5 @@
+/* -*- 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; style: linux -*- */
 
 /* tests/test-ntl-lzz_p.cpp
@@ -21,6 +23,13 @@
  * Boston, MA 02111-1307, USA.
  */
 
+/*! @file  tests/test-ntl-lzz_p.C
+ * @ingroup tests
+ * @brief no doc.
+ * @test no doc.
+ */
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -44,7 +53,7 @@ int main (int argc, char **argv)
                 { 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
 		{ 'n', "-n N", "Set dimension of test vectors to NxN.", TYPE_INT,     &n },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
-                { '\0' }
+		END_OF_ARGUMENTS
         };
 
         parseArguments (argc, argv, args);
@@ -54,7 +63,7 @@ int main (int argc, char **argv)
 
 	//NTL::zz_p::init(q);
 	//UnparametricField<NTL::zz_p> F(q);
-	NTL_zz_p F(q); 
+	NTL_zz_p F(q);
 
 	// Make sure some more detailed messages get printed
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (2);
diff --git a/tests/test-ntl-sylvester.C b/tests/test-ntl-sylvester.C
index f29f38e..355c61f 100644
--- a/tests/test-ntl-sylvester.C
+++ b/tests/test-ntl-sylvester.C
@@ -1,12 +1,23 @@
-/* -*- mode: C++; tab-width: 6; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/* -*- 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
 /*-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  *    test-ntl-sylvester.C
  *    Copyright (C) 2003 Austin Lobo, B. David Saunders
+ *    Copyright (C) LinBox
  *
  *    Tests for  Sylvester matrix specification with ntl Arithmetic,
  *    for 2 polynomials in one variable.
- *    Linbox version 2003
+ *    LinBox version 2003
+ *    see COPYING for license information
  *-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+*/
+
+/*! @file  tests/test-ntl-sylvester.C
+ * @ingroup tests
+ * @brief no doc.
+ * @test no doc
+ */
+
+
 #include <iostream>
 #include <fstream>
 #include <vector>
@@ -23,125 +34,125 @@ using namespace std;
 
 int main(int argc, char* argv[])
 {
-  LinBox::commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (2);
-  ostream &report = LinBox::commentator.report(
-					       LinBox::Commentator::LEVEL_IMPORTANT, 
-					       INTERNAL_DESCRIPTION );
-    bool pass = true;
-  
-  static size_t n = 1000;
-  static long q = 134217689;
-  //   q = 101;
-  static int iterations = 1;
-  
-  static Argument args[] = {
-    { 'n', "-n N", "Set dimension of test matrices to NxN.", TYPE_INT, &n },
-    { 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", 
-                    TYPE_INT, &q },
-    { 'i', "-i I", "Perform each test for I iterations.", 
-                    TYPE_INT, &iterations },
-	{ '\0' }
-  };
-  
-  parseArguments (argc, argv, args);
-  
-
-
-  
-  //------ Read q and construct F(q)
-  NTL::ZZ modulus; 	// prime modulus
-  modulus = q;
-  size_t  m = n-3;
-  // std::cout << std::endl << "Enter a prime number for the modulus of the field: ";
-  // std::cin >> modulus;
-  report <<  "The modulus is " << modulus << std::endl;
-  report <<  "Dimension (m+n) is " << m+n << std::endl;
-  NTL::ZZ_p::init(modulus); // NOTE: This is essential for using NTL
-  
-	commentator.start("Sylvester black box test suite", "Sylvester");
-  report <<"Dimension(m+n)= " << m+n << "\t modulus= " << q << endl;
-
-  typedef LinBox::UnparametricField<NTL::ZZ_p> Field;
-  typedef Field::Element element;
-  typedef std::vector<element> Vector;  
-  
-  // Now we are using the NTL wrapper as the field, call the instance F
-  Field F;
-  element zero;
-  F.init(zero, 0);
-  
-  // Use the default constructor to create a matrix
-  LinBox::Sylvester<Field> T;
-  
-  // Use a special constructor to construct a matrix of dim TSIZE
-
-  Vector pdata(n), qdata(m); 
-
-  report << "\n\tpx:=";
-
-  for (size_t i=pdata.size()-1; i > 0; i-- ) {
-    pdata[i] = NTL::random_ZZ_p() ;
-    report << pdata[i] << "*X^" << i << " + ";
-  }
-  pdata[0] = NTL::random_ZZ_p() ;
-  report << pdata[0];
-
-  report << std::endl;
-  report << "\nqx is: \n\t";
-
-  for (size_t i=qdata.size()-1; i > 0; i-- ) {
-    qdata[i] = NTL::random_ZZ_p() ;
-    report << qdata[i] << "*X^" << i << " + ";
-  }
-
-  qdata[0] = NTL::random_ZZ_p() ;
-  report << qdata[0];
-  report << std::endl;
-
-
-  LinBox::Sylvester<Field> TT(F,pdata,qdata);
-  report << "The matrix is: " << std::endl;
-  //  TT.printcp( "cpout.txt");
-  //  TT.print(report);
-
-  report << std::endl;
-
-
-  // Create an interesting input vector called idata
-  Vector idata( TT.sysdim() ), odata( TT.sysdim() );
-  report << "A random col vector:\npx:=[" << std::endl;
-
-  for (unsigned int i=0; i < idata.size(); i++) {
-    idata[i] = NTL::random_ZZ_p() ;
-
-    if (i!= idata.size()-1)     report << idata[i] << ",";
-  }
-  report << "]\n";
-  
-  TT.apply(odata, idata);
-  report << "\n\nTesting  apply :--------------------- \nResult is[";
-
-  for (unsigned int i = 0; i < odata.size(); i++) 
-    report << odata[i] << " ";
-
-  report << "]\n";
-
-  // Apply the matrix to the vector just created
-  // Testing the apply function when both input and output are over ZZ_p
-
-  report << "Testing apply Transpose:----------------- \nResult is[";
-
-  TT.applyTranspose(odata, idata);
-
-  for (unsigned int i = 0; i < odata.size(); i++) 
-    report << odata[i] << " ";
-
-  pass = testBlackbox(TT);
-  report <<"<====\tDone Sylvester matrix black box test suite" << endl;
-
+	LinBox::commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (2);
+	ostream &report = LinBox::commentator.report(
+						     LinBox::Commentator::LEVEL_IMPORTANT,
+						     INTERNAL_DESCRIPTION );
+	bool pass = true;
+
+	static size_t n = 1000;
+	static long q = 134217689;
+	//   q = 101;
+	static int iterations = 1;
+
+	static Argument args[] = {
+		{ 'n', "-n N", "Set dimension of test matrices to NxN.", TYPE_INT, &n },
+		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].",
+			TYPE_INT, &q },
+		{ 'i', "-i I", "Perform each test for I iterations.",
+			TYPE_INT, &iterations },
+		END_OF_ARGUMENTS
+	};
+
+	parseArguments (argc, argv, args);
+
+
+
+
+	//------ Read q and construct F(q)
+	NTL::ZZ modulus; 	// prime modulus
+	modulus = q;
+	size_t  m = n-3;
+	// std::cout << std::endl << "Enter a prime number for the modulus of the field: ";
+	// std::cin >> modulus;
+	report <<  "The modulus is " << modulus << std::endl;
+	report <<  "Dimension (m+n) is " << m+n << std::endl;
+	NTL::ZZ_p::init(modulus); // NOTE: This is essential for using NTL
+
+	LinBox::commentator.start("Sylvester black box test suite", "Sylvester");
+	report <<"Dimension(m+n)= " << m+n << "\t modulus= " << q << endl;
+
+	typedef LinBox::UnparametricField<NTL::ZZ_p> Field;
+	typedef Field::Element element;
+	typedef std::vector<element> Vector;
+
+	// Now we are using the NTL wrapper as the field, call the instance F
+	Field F;
+	element zero;
+	F.init(zero, 0);
+
+	// Use the default constructor to create a matrix
+	LinBox::Sylvester<Field> T;
+
+	// Use a special constructor to construct a matrix of dim TSIZE
+
+	Vector pdata(n), qdata(m);
+
+	report << "\n\tpx:=";
+
+	for (size_t i=pdata.size()-1; i > 0; i-- ) {
+		pdata[i] = NTL::random_ZZ_p() ;
+		report << pdata[i] << "*X^" << i << " + ";
+	}
+	pdata[0] = NTL::random_ZZ_p() ;
+	report << pdata[0];
+
+	report << std::endl;
+	report << "\nqx is: \n\t";
+
+	for (size_t i=qdata.size()-1; i > 0; i-- ) {
+		qdata[i] = NTL::random_ZZ_p() ;
+		report << qdata[i] << "*X^" << i << " + ";
+	}
+
+	qdata[0] = NTL::random_ZZ_p() ;
+	report << qdata[0];
+	report << std::endl;
+
+
+	LinBox::Sylvester<Field> TT(F,pdata,qdata);
+	report << "The matrix is: " << std::endl;
+	//  TT.printcp( "cpout.txt");
+	//  TT.print(report);
+
+	report << std::endl;
+
+
+	// Create an interesting input vector called idata
+	Vector idata( TT.sysdim() ), odata( TT.sysdim() );
+	report << "A random col vector:\npx:=[" << std::endl;
+
+	for (unsigned int i=0; i < idata.size(); i++) {
+		idata[i] = NTL::random_ZZ_p() ;
+
+		if (i!= idata.size()-1)     report << idata[i] << ",";
+	}
+	report << "]\n";
+
+	TT.apply(odata, idata);
+	report << "\n\nTesting  apply :--------------------- \nResult is[";
+
+	for (unsigned int i = 0; i < odata.size(); i++)
+		report << odata[i] << " ";
+
+	report << "]\n";
+
+	// Apply the matrix to the vector just created
+	// Testing the apply function when both input and output are over ZZ_p
+
+	report << "Testing apply Transpose:----------------- \nResult is[";
+
+	TT.applyTranspose(odata, idata);
+
+	for (unsigned int i = 0; i < odata.size(); i++)
+		report << odata[i] << " ";
+
+	pass = testBlackbox(TT);
+	report <<"<====\tDone Sylvester matrix black box test suite" << endl;
+
 
-	commentator.stop("Sylvester black box test suite");
-  return pass ? 0 : -1;
+	LinBox::commentator.stop("Sylvester black box test suite");
+	return pass ? 0 : -1;
 
 }
 
diff --git a/tests/test-ntl-toeplitz.C b/tests/test-ntl-toeplitz.C
index ca8e601..86ec407 100644
--- a/tests/test-ntl-toeplitz.C
+++ b/tests/test-ntl-toeplitz.C
@@ -1,3 +1,35 @@
+/* -*- 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
+/* Copyright (C) LinBox
+ *
+ * Copyright (C) 2002 Austin Lobo, B. David Saunders
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+/*! @file  tests/test-ntl-toeplitz.C
+ * @ingroup tests
+ * @brief no doc.
+ * @test no doc
+ */
+
+
+
 #include <iostream>
 #include <fstream>
 #include <vector>
@@ -8,7 +40,6 @@
 //#include <linbox/blackbox/ntl-toeplitz.h>
 #include <linbox/blackbox/toeplitz.h>
 
-/* Copyright (C) 2002 Austin Lobo, B. David Saunders*/
 
 #include "test-generic.h"
 
@@ -18,98 +49,98 @@ using namespace std;
 
 int main(int argc, char* argv[])
 {
-  LinBox::commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (2);
-  ostream &report = LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-  
-  bool pass = true;
-  
-  static size_t n = 1000;
-  static long q = 2147483647;
-  static int iterations = 1;
-  
-  static Argument args[] = {
-    { 'n', "-n N", "Set dimension of test matrices to NxN.", TYPE_INT,     &n },
-    { 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INT, &q },
-    { 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
-	{ '\0' }
-  };
-  
-  parseArguments (argc, argv, args);
-  
-  
-  //------ Read q and construct F(q)
-  //NTL::ZZ modulus; 	// prime modulus
-  //modulus = q;
-
-
-  //std::cout << std::endl << "Enter a prime number for the modulus of the field: ";
-  //std::cin >> modulus;
-  //report <<  "The modulus is " << modulus << std::endl;
-  report <<  "The modulus is " << q << std::endl;
-  //NTL::ZZ_p::init(modulus); // NOTE: This is essential for using NTL
-
-	commentator.start("Toeplitz black box test suite", "Toeplitz");
-  report  <<"     \tDimension= " << n << "\t modulus= " << q << endl;
-  
-  typedef NTL_ZZ_p Field;
-  typedef Field::Element element;
-  typedef std::vector<element> Vector;  
-  
-  // Now we are using the NTL wrapper as the field, call the instance F
-  Field F(q);
-  element zero;
-  F.init(zero, 0);
-  
-  // Use the default constructor to create a matrix
-  LinBox::Toeplitz<Field> T(F);
-  
-  // Use a special constructor to construct a matrix of dim TSIZE
-  int TSIZE = 2*n-1;
-  Vector tdata(TSIZE); 
-  report << "The random vector is:" << std::endl;
-  for (unsigned int i=0; i < tdata.size(); i++) {
-    tdata[i] = NTL::random_ZZ_p() ;
-    report << tdata[i] << " ";
-  }
-  report << std::endl;
-  
-  LinBox::Toeplitz<Field> TT(F,tdata);
-  report << "The matrix is: " << std::endl;
-  TT.print(report);
-  
-  // Create an interesting input vector called idata
-  Vector idata((TSIZE+2)/2), odata((TSIZE+2)/2);
-  report << "A random col vector:\t" << std::endl;
-  for (unsigned int i=0; i < idata.size(); i++) {
-    idata[i] = NTL::random_ZZ_p() ;
-    report << idata[i] << " ";
-  }
-  report << std::endl;
-  
-  // Apply the matrix to the vector just created
-  // Testing the apply function when both input and output are over ZZ_p
-  TT.applyTranspose(odata, idata);
-  report << "Testing apply Transpose:----------------- \nResult is[";
-  for (unsigned int i = 0; i < odata.size(); i++)
-    report << odata[i] << " ";
-  report << "]\n";
-  
-  
-  
-  TT.apply(odata, idata);
-  report << "\n\nTesting  apply :--------------------- \nResult is[";
-  for (unsigned int i = 0; i < odata.size(); i++)
-    report << odata[i] << " ";
-  report << "]\n";
-  
-  // TT.setToUniModLT();
-  //  report << "Setting the matrix to UniModular Upper Triangular";
-  //  TT.setToUniModUT();
-  //  report << "The Upper Triangular matrix is: " << std::endl;
-  //TT.print();
-  
-  pass = testBlackbox(TT);
-	commentator.stop("Toeplitz black box test suite");
-  return pass ? 0 : -1;
+	LinBox::commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (2);
+	ostream &report = LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+
+	bool pass = true;
+
+	static size_t n = 1000;
+	static long q = 2147483647;
+	static int iterations = 1;
+
+	static Argument args[] = {
+		{ 'n', "-n N", "Set dimension of test matrices to NxN.", TYPE_INT,     &n },
+		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INT, &q },
+		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
+		END_OF_ARGUMENTS
+	};
+
+	parseArguments (argc, argv, args);
+
+
+	//------ Read q and construct F(q)
+	//NTL::ZZ modulus; 	// prime modulus
+	//modulus = q;
+
+
+	//std::cout << std::endl << "Enter a prime number for the modulus of the field: ";
+	//std::cin >> modulus;
+	//report <<  "The modulus is " << modulus << std::endl;
+	report <<  "The modulus is " << q << std::endl;
+	//NTL::ZZ_p::init(modulus); // NOTE: This is essential for using NTL
+
+	LinBox::commentator.start("Toeplitz black box test suite", "Toeplitz");
+	report  <<"     \tDimension= " << n << "\t modulus= " << q << endl;
+
+	typedef LinBox::NTL_ZZ_p Field;
+	typedef Field::Element element;
+	typedef std::vector<element> Vector;
+
+	// Now we are using the NTL wrapper as the field, call the instance F
+	Field F(q);
+	element zero;
+	F.init(zero, 0);
+
+	// Use the default constructor to create a matrix
+	LinBox::Toeplitz<Field> T(F);
+
+	// Use a special constructor to construct a matrix of dim TSIZE
+	int TSIZE = 2*n-1;
+	Vector tdata(TSIZE);
+	report << "The random vector is:" << std::endl;
+	for (unsigned int i=0; i < tdata.size(); i++) {
+		tdata[i] = NTL::random_ZZ_p() ;
+		report << tdata[i] << " ";
+	}
+	report << std::endl;
+
+	LinBox::Toeplitz<Field> TT(F,tdata);
+	report << "The matrix is: " << std::endl;
+	TT.print(report);
+
+	// Create an interesting input vector called idata
+	Vector idata((TSIZE+2)/2), odata((TSIZE+2)/2);
+	report << "A random col vector:\t" << std::endl;
+	for (unsigned int i=0; i < idata.size(); i++) {
+		idata[i] = NTL::random_ZZ_p() ;
+		report << idata[i] << " ";
+	}
+	report << std::endl;
+
+	// Apply the matrix to the vector just created
+	// Testing the apply function when both input and output are over ZZ_p
+	TT.applyTranspose(odata, idata);
+	report << "Testing apply Transpose:----------------- \nResult is[";
+	for (unsigned int i = 0; i < odata.size(); i++)
+		report << odata[i] << " ";
+	report << "]\n";
+
+
+
+	TT.apply(odata, idata);
+	report << "\n\nTesting  apply :--------------------- \nResult is[";
+	for (unsigned int i = 0; i < odata.size(); i++)
+		report << odata[i] << " ";
+	report << "]\n";
+
+	// TT.setToUniModLT();
+	//  report << "Setting the matrix to UniModular Upper Triangular";
+	//  TT.setToUniModUT();
+	//  report << "The Upper Triangular matrix is: " << std::endl;
+	//TT.print();
+
+	pass = testBlackbox(TT);
+	LinBox::commentator.stop("Toeplitz black box test suite");
+	return pass ? 0 : -1;
 }
 
diff --git a/tests/test-nullspace.C b/tests/test-nullspace.C
new file mode 100644
index 0000000..6248ccf
--- /dev/null
+++ b/tests/test-nullspace.C
@@ -0,0 +1,331 @@
+/* -*- 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
+/* Copyright (C) 2009 LinBox
+ * Written by <boyer.brice at gmail.com>
+ * Inspired and adapted from test-ffpack.C
+ * see COPYING for license details
+ */
+
+/** \file tests/test-nullspace.C
+ * \brief Tests the dense nullspace functions for Zp
+ * @ingroup tests
+ * @test dense nullspace
+ */
+
+#include "../linbox/linbox-config.h"
+#include <iostream>
+#include "../linbox/integer.h"
+#include "../linbox/matrix/matrix-domain.h"
+//#include "linbox/field/givaro-zpz.h"
+#include "../linbox/field/modular.h"
+//#include "fflas-ffpack/ffpack/ffpack.h"
+#include "../linbox/algorithms/dense-nullspace.h"
+#include <vector>
+#include "./test-common.h"
+// #include "fflas-ffpack/utils/Matio.h"
+#include "linbox/algorithms/linbox-tags.h"
+
+using namespace LinBox;
+
+
+/** @brief gives a random number such that \f$0 \leq RIII < s\f$.
+ * @details basic..
+ * @param [in]  s sup
+ * \param [in]  seed seed. If \p 0 (default) we create a new one.
+ * @param [out] RIII random integer in the interval  \f$[[0, s-1]]\f$.
+ * @return a reference to \p RIII
+ */
+size_t & RandIntInInt ( const size_t & s, size_t & RIII, const int & seed = 0 )
+{
+	/*
+	 * if (seed == 0)
+	 *	srandom( (unsigned) time(NULL) );
+	 *else
+	 *	srandom ( seed );
+	 */
+	double alea = rand();
+	RIII          = (size_t) ((double)s * (alea/(RAND_MAX+1.0)));
+	assert(RIII<s);
+	return RIII ;
+}
+
+/*!
+ * Creates a random Lapack style Permutation \p P of size \p len.
+ */
+void RandomPermutation ( size_t * P, const size_t & len)
+{
+	size_t alea = 0 ;
+	for (size_t i = 0 ; i < len ; ++i) {
+		RandIntInInt(len-i, alea);
+		*(P+i) = i + alea ;
+	}
+	return;
+}
+
+
+/*!
+ * Builds a \p m x \p n random matrix of rank \p rank over field \p F.
+ */
+template <class Field >
+void RandomMatrixWithRank(const Field & F,
+			  typename Field::Element * A,
+			  const size_t & m,
+			  const size_t & n,
+			  const size_t & rank)
+{
+	assert(rank <= m);
+	assert(rank <= n);
+
+	//                srandom( (unsigned) time(NULL)  ) ; // on met une nouvelle graine.
+	typename Field::RandIter G(F);
+	NonzeroRandIter<Field> Gn(F,G);
+	typename Field::Element one,zero;
+	F.init(one,1UL);
+	F.init(zero,0UL);
+
+	typename Field::Element * B = new typename Field::Element[m*m];
+	typename Field::Element * C = new typename Field::Element[m*n];
+	// Create B a random invertible matrix (m x m format)
+	for (size_t j=0 ; j<m ; ++j){
+		for (size_t i = 0 ; i<j ; ++i)
+			F.assign (*(B+i*m+j),zero); // triangulaire
+		F.assign(*(B+j*m+j),one  );
+		for (size_t i=j+1; i<m;++i)
+			Gn.random (*(B+i*m+j)); // random mais pas nul.. euh... et sur Z/2 ?? :/
+	}
+	// Create C a random matrix of rank \p ( m x n format)
+	// for (size_t i = 0; i < std::min(rank,m); ++i)
+	for (size_t i = 0; i < rank; ++i){
+		size_t j = 0;
+		for ( ; j < std::min(i,n) ; ++j)
+			F.assign (*(C+i*n+j),zero);
+		for ( ; j < n ; ++j)
+			Gn.random (*(C+i*n+j));
+	}
+	for (size_t i = n*rank; i < n*m; ++i){
+		F.assign (*(C+i),zero);
+	}
+	assert(CheckRank(F,C,m,n,n,rank));
+	// create P a random permutation of size \p n
+	size_t *P = new size_t[n];
+	//srandom( (unsigned) time(NULL) ) ; // on met une nouvelle graine.
+	RandomPermutation(P,n);
+	// create Q a random permutation of size \p m
+	size_t *Q = new size_t[m];
+	RandomPermutation(Q,m);
+	FFPACK::applyP(F, FFLAS::FflasLeft, FFLAS::FflasNoTrans, n, 0, m, C, n, Q );
+	//PrintLapackPermutation(P,n,std::cout << "P == ");
+	//write_field (F, std::cout<<"C_perm1="<<std::endl, C, m, n, n);
+	FFPACK::applyP(F, FFLAS::FflasRight, FFLAS::FflasNoTrans, m, 0, n, C, n, P );
+	//PrintLapackPermutation(Q,m,std::cout << "Q == ");
+	//write_field (F, std::cout<<"C_perm2="<<std::endl, C, m, n, n);
+	// A = B*C (m x n format), of rank \p rank
+	FFLAS::fgemm( F, FFLAS::FflasNoTrans, FFLAS::FflasNoTrans, m, n, m,
+		      one, B, m, C, n, zero, A, n );
+	delete[] B;
+	delete[] C;
+	delete[] P;
+	delete[] Q;
+	assert(CheckRank(F,A,m,n,n,rank));
+	return;
+
+}
+
+
+/**
+ * @brief Checks we got the right rank.
+ *
+ * @param F field
+ * @param A matrix
+ * @param m rows
+ * @param n cols
+ * @param lda leadin dimmension
+ * @param alledged_rank supposedly correct rank.
+ *
+ * @return \c alledged_rank==rank(A)
+ */
+template <class Field>
+bool CheckRank( const Field & F,
+		const typename Field::Element * A,
+		const size_t & m,
+		const size_t & n,
+		const size_t & lda,
+		const size_t & alledged_rank)
+{
+	//                std::cout << " is rank truely " << alledged_rank << " ?" << std::endl;
+	typename Field::Element * Acopy = new typename Field::Element[m*n] ;
+	FFLAS::fcopy(F,m*n,Acopy,1,A,1);
+	size_t true_rank = FFPACK::Rank(F,m,n,Acopy,lda);
+	delete[] Acopy ;
+	//                std::cout << "It is " << true_rank << "." << std::endl;
+	return (alledged_rank == true_rank);
+}
+
+/*!
+ * @brief Tests the NullSpace routines.
+ * @param F field
+ * @param m row
+ * @param n col
+ * @param rank \p n-rank is the size of the NullSpace
+ * @param iterations number of its
+ * @param a_droite \p true if.. \p false if on the left
+ * @return \p true hopefully if test's passed!
+ */
+template <class Field >
+static bool testNullSpaceBasis (const Field& F, size_t m, size_t n, size_t rank, int iterations, bool a_droite)
+{
+	typedef typename Field::Element			Element;
+
+	//Commentator commentator;
+	//commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
+	//commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
+	//commentator.start (pretty("Testing NullSpace Decomposition"),"testNullSpace",iterations);
+	typename Field::Element one,zero;
+	F.init(one,1UL);
+	F.init(zero,0UL);
+
+	bool ret = true;
+	{
+		size_t min = std::min(m,n);
+		if (rank > min ) {
+			rank = min; // rank <= min(m,n)...
+		}
+	}
+	for (int k=0; k<iterations; ++k) {
+
+		//commentator.progress(k);
+		Element * A = new Element[m*n];
+		size_t ld_a =  n ;
+		size_t wd_a =  m ;
+		RandomMatrixWithRank(F,A,m,n,rank);
+
+		Element * Abis = new Element[m*n]; // copie de A
+		for (size_t i=0; i<m*n; ++i)
+			*(Abis+i) = *(A+i);
+		size_t ker_dim = 0 ; // or coker_dim
+		Element * Kern  = NULL;
+		size_t ld_k = 0 ;
+		if (a_droite) {
+			NullSpaceBasis (F, LinBoxTag::Right,m,n,A,ld_a,Kern,ld_k,ker_dim);
+			if (ker_dim != (ld_a - rank)) {
+				ret = false;
+				cout << "faux : (1) mauvaises dim : " << ker_dim << " != " << (ld_a - rank) << endl;
+				delete[] Kern;
+				delete[] A;
+				delete[] Abis;
+				break ;
+			}
+		}
+		else {
+			NullSpaceBasis (F, LinBoxTag::Left,m,n,A,ld_a,Kern,ld_k,ker_dim);
+			if (ker_dim != (wd_a - rank) ) {
+				ret = false;
+				cout << "faux : (1) mauvaises dim " << ker_dim << " != " << (wd_a - rank)  << endl;
+				delete[] Kern;
+				delete[] A;
+				delete[] Abis;
+				break ;
+			}
+		}
+		size_t ld_ker = (a_droite)?ker_dim:m ;
+		size_t wd_ker = (a_droite)?n:ker_dim ;
+		assert(ld_ker == ld_k) ;
+		size_t ld_n = (a_droite)?ker_dim:ld_a;
+		size_t wd_n = (a_droite)?wd_a:ker_dim;
+		assert(CheckRank(F,Kern,wd_ker,ld_ker,ld_ker,ker_dim)); // ...il est bien de rang plein...
+		Element * NullMat = new Element[ld_n*wd_n] ;// ...et on s'attend à ce que ça soit nul !
+		if ( a_droite){
+			FFLAS::fgemm(F, FFLAS::FflasNoTrans, FFLAS::FflasNoTrans, wd_a, ld_ker, ld_a,
+				     one, Abis, ld_a, Kern, ld_ker , zero, NullMat, ld_n);
+		}
+		else{
+			FFLAS::fgemm(F, FFLAS::FflasNoTrans, FFLAS::FflasNoTrans, wd_ker,ld_a, ld_ker,
+				     one,  Kern, ld_ker , Abis, ld_a, zero, NullMat, ld_n);
+		}
+
+		//write_field (F, std::cout<<"A="<<endl, A, m, n, n,true);
+		//write_field (F, std::cout<<"Abis="<<endl, Abis, m, n, n, true);
+		delete[] Abis ;
+		delete[] A ;
+		delete[] Kern ;
+		for (size_t i = 0 ; i < wd_n ; ++i ){
+			for (size_t j = 0 ; j < ld_n ; ++j ) {
+				if (!F.isZero(*(NullMat + j+i*ld_n)) ){
+					    //	write_field (F, std::cout<<"faux : (3) NullMat pas nulle. "<<std::endl, NullMat, wd_n, ld_n, ld_n, true);
+					delete[] NullMat ;
+					ret = false;
+					break;
+				}
+			}
+			if (!ret)
+				break;
+		}
+		if (ret) delete[] NullMat ;
+		else break;
+
+		//delete[] Kern ;
+	}
+
+	//commentator.stop(MSG_STATUS (ret), (const char *) 0, "testNullSpace");
+
+	return ret;
+}
+
+
+int main(int argc, char** argv)
+{
+	//-----------------------------------------------------------------------
+	// Choice of the finite field representation
+	//typedef GivaroZpz<Std32> Field;
+	typedef Modular<double> Field;
+	//typedef Modular<float> Field;
+	//typedef Modular<uint32_t> Field;
+	//------------------------------------------------------------------------
+
+	bool pass = true;
+
+	static size_t n = 5;
+	static size_t m = 4;
+	static size_t r = 2;
+	static integer q = 11;
+	static int iterations =2;
+
+	static Argument args[] = {
+		{ 'n', "-n N", "Set width of test matrices.",			TYPE_INT,     &n },
+		{ 'm', "-m M", "Set hight of test matrices.",			TYPE_INT,     &m },
+		{ 'r', "-r R", "Set rank of test matrices.",			TYPE_INT,     &r },
+		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].",		TYPE_INTEGER, &q },
+		{ 'i', "-i I", "Perform each test for I iterations.",           TYPE_INT,     &iterations },
+		END_OF_ARGUMENTS
+	};
+
+	parseArguments (argc, argv, args);
+
+	Field F (q);
+
+	//srand(time (NULL));
+
+	//commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
+	//commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
+	commentator.start("NullSpace test suite", "nullspace");
+
+	std::ostream& report = commentator.report();
+
+	report << "\t \033[1;35m>>>\033[0;m \t testing left kernel" << endl ;
+	if (!testNullSpaceBasis (F, m,n,r, iterations, false))
+		pass=false;
+	if (pass) report << "\t \033[1;36m<<<\033[0;m \t left kernel passed :)" << endl; else {report << "\t \033[1;31m!!!\033[0;m \t left kernel failed :(" << endl ; exit(-1);}
+	report << "\t \033[1;35m>>>\033[0;m \t testing right kernel" << endl ;
+	if (!testNullSpaceBasis (F, m,n,r, iterations, true))
+		pass=false;
+	if (pass) report << "\t \033[1;36m<<<\033[0;m \t right kernel passed :)" << endl; else {report << "\t \033[1;31m!!!\033[0;m \t right kernel failed :(" << endl ; exit(-1);}
+
+	report << "\033[1;32m +++ ALL MY TESTS PASSED +++\033[0;m" << endl;
+
+
+	commentator.stop("NullSpace test suite");
+	return (pass ? 0 : -1);
+}
+
+
+
diff --git a/tests/test-optimization.C b/tests/test-optimization.C
new file mode 100644
index 0000000..79fc366
--- /dev/null
+++ b/tests/test-optimization.C
@@ -0,0 +1,87 @@
+/* -*- 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
+/* Copyright (C) LinBox
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+/*! @file tests/test-optimization.C
+ * @ingroup tests
+ * @brief no doc.
+ * @test no doc
+ */
+
+
+
+#include <iostream>
+#include <fstream>
+#include <linbox/config-blas.h>
+#include <linbox/linbox-config.h>
+#include <linbox/field/modular-double.h>
+#include <fflas-ffpack/fflas/fflas.h>
+#include <linbox/util/timer.h>
+
+#include "test-common.h"
+
+using namespace LinBox;
+int main (int argc, char ** argv)
+{
+	size_t n=300, nmax=1000, prec=256;
+
+	static Argument args[] = {
+		{ 'n', "-n n", "Operate over the \"field\" GF(Q) [1] for integer modulus.", TYPE_INT, &n },
+		{ 'm', "-m m", "Operate over the \"field\" GF(Q) [1] for uint32_t modulus.", TYPE_INT, &nmax },
+		{ 'p', "-p p", "Operate over the \"field\" GF(Q) [1] for uint16_t modulus.", TYPE_INT, &prec },
+		END_OF_ARGUMENTS
+	};
+
+	parseArguments (argc, argv, args);
+
+	commentator.start("Optimization suite", "Optim");
+	std::ostream& report = commentator.report();
+
+	Modular<double> F(17);
+	Timer chrono;
+
+	double *A, *C;
+	A = new double[nmax*nmax];
+	C = new double[nmax*nmax];
+	for (size_t i=0; i<nmax*nmax;++i){
+		A[i]=rand() % 17;
+	}
+
+	do {
+		chrono.start();
+		FFLAS::fgemm(F, FFLAS::FflasNoTrans, FFLAS::FflasNoTrans,
+			     n, n, n, 1., A, n, A, n, 0., C, n);
+		chrono.stop();
+		report << std::endl
+		<< "fgemm " << FFLAS::WinoSteps(n) << "Wino: " << n << "x" << n << ": "
+		<< chrono.usertime() << " s, "
+		<< (2.0/chrono.usertime()*n/100.0*n/100.0*n/100.0) << " Mffops"
+		<< std::endl;
+
+		n+=prec;
+	} while ((n < nmax));
+
+	delete[] A;
+	delete[] C;
+
+	return 0;
+}
diff --git a/tests/test-param-fuzzy.C b/tests/test-param-fuzzy.C
index 1253258..fd70d7f 100644
--- a/tests/test-param-fuzzy.C
+++ b/tests/test-param-fuzzy.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-param-fuzzy.C
  * Copyright (C) 2002 David Saunders
@@ -7,6 +8,15 @@
  * See COPYING for license information.
  */
 
+
+/*! @file  tests/test-param-fuzzy.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test no doc
+ */
+
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -29,13 +39,11 @@ int main (int argc, char **argv)
 	static Argument args[] = {
 		{ 'n', "-n N", "Set dimension of test vectors to NxN.", TYPE_INT,     &n },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
 
-	cout << endl << "ParamFuzzy field approximation test suite" << endl;
-	cout.flush ();
 	bool pass = true;
 
 	ParamFuzzy F(.0000001);
@@ -44,8 +52,11 @@ int main (int argc, char **argv)
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (4);
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
 
+	ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+        report << endl << "ParamFuzzy field approximation test suite" << endl;
+
 	/* I am distressed that this field passes the testField()
-	   We need a test that distinguishes exact fields from 
+	   We need a test that distinguishes exact fields from
 	   approximate ones.  -bds */
 
 	if (!runFieldTests (F, "ParamFuzzy", iterations, n, false)) pass = false;
diff --git a/tests/test-qlup.C b/tests/test-qlup.C
new file mode 100644
index 0000000..b7a86d8
--- /dev/null
+++ b/tests/test-qlup.C
@@ -0,0 +1,396 @@
+/* -*- 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
+/* tests/test-qlup.C
+ * Copyright (C) The LinBox group
+ *
+ * Time-stamp: <22 Jun 10 15:59:56 Jean-Guillaume.Dumas at imag.fr>
+ * -----------------------------------------------------
+ *
+ * This file is part of LinBox, licensed under the GNU Lesser General
+ * Public License. See COPYING for more information.
+ */
+
+
+/*! @file  tests/test-qlup.C
+ * @ingroup tests
+ * @brief  tests LQUP decomposition, solve, and nullspace of a random sparse matrice.
+ * @test tests LQUP decomposition, solve, and nullspace of a random sparse matrice.
+ */
+
+
+
+#include "linbox/linbox-config.h"
+
+#include <iostream>
+#include <fstream>
+#include <vector>
+#include <cstdio>
+
+#include "linbox/vector/sparse.h"
+#include "linbox/algorithms/gauss.h"
+#include "linbox/algorithms/gauss-gf2.h"
+#include "linbox/blackbox/permutation.h"
+#include "linbox/util/commentator.h"
+#include "linbox/field/modular.h"
+#include "linbox/field/PID-integer.h"
+#include "linbox/field/givaro-zpz.h"
+#include "linbox/blackbox/diagonal.h"
+#include "linbox/blackbox/sparse.h"
+#include "linbox/blackbox/scalar-matrix.h"
+#include "linbox/blackbox/direct-sum.h"
+#include "linbox/solutions/rank.h"
+
+#include "test-common.h"
+
+using namespace LinBox;
+
+/* Test 1: LQUP decomposition of a random sparse matrix
+ *
+ * Constructs a random sparse matrix and computes its QLUP decomposition
+ * using Sparse Gaussian elimination. Checks that the results match.
+ */
+template <class Field, class Blackbox, class RandStream >
+bool testQLUP(const Field &F, size_t n, unsigned int iterations, int rseed, double sparsity = 0.05)
+{
+	bool res = true;
+
+	commentator.start ("Testing Sparse elimination qlup", "testQLUP", iterations);
+
+	unsigned long Ni = n;
+	unsigned long Nj = n;
+        integer card; F.cardinality(card);
+	typename Field::RandIter generator (F,card,rseed);
+	RandStream stream (F, generator, sparsity, n, n);
+
+	for (size_t i = 0; i < iterations; ++i) {
+		commentator.startIteration (i);
+
+
+		stream.reset();
+
+		Blackbox A (F, stream);
+
+		std::ostream & report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+
+		F.write( report ) << endl;
+		A.write( report,FORMAT_MAPLE ) << endl;
+
+		std::vector<typename Field::Element> u(Nj), v(Ni), w1(Nj), w2(Ni), w3(Ni), w(Ni);
+		for(typename std::vector<typename Field::Element>::iterator it=u.begin();it!=u.end();++it)
+			generator.random (*it);
+
+		A.apply(v,u);
+
+
+		unsigned long rank;
+
+		Method::SparseElimination SE;
+		SE.strategy(Specifier::PIVOT_LINEAR);
+		GaussDomain<Field> GD ( F );
+		typename Field::Element determinant;
+		Blackbox L(F, A.rowdim(), A.coldim());
+		Permutation<Field> Q(A.rowdim(),F);
+		Permutation<Field> P(A.coldim(),F);
+
+		GD.QLUPin(rank, determinant,
+			  Q, L, A, P,
+			  A.rowdim(), A.coldim() );
+
+		Q.apply(w, L.apply(w3, A.apply(w2, P.apply(w1,u) ) ) );
+
+		bool error = false;
+		typename std::vector<typename Field::Element>::const_iterator itv=v.begin();
+		typename std::vector<typename Field::Element>::const_iterator itw=w.begin();
+		for( ; itw!=w.end();++itw,++itv) {
+			if (! F.areEqual(*itw,*itv) ) {
+				error = true;
+			}
+		}
+
+		if (error) {
+			res = false;
+
+			report << "ERROR : matrix(" << u.size() << ",1,[";
+			for(typename std::vector<typename Field::Element>::const_iterator itu=u.begin(); itu!=u.end();++itu)
+				report << *itu << ',';
+			report << "]);\n[";
+			for(typename std::vector<typename Field::Element>::const_iterator itv=v.begin(); itv!=v.end();++itv)
+				report << *itv << ' ';
+			report << "]  !=  [";
+			for(typename std::vector<typename Field::Element>::const_iterator itw=w.begin(); itw!=w.end();++itw)
+				report << *itw << ' ';
+			report << "]" << std::endl;
+
+
+			report << "w1: [";
+			for(typename std::vector<typename Field::Element>::const_iterator itw=w1.begin(); itw!=w1.end();++itw)
+				report << *itw << ' ';
+			report << "]" << std::endl;
+			report << "w2: [";
+			for(typename std::vector<typename Field::Element>::const_iterator itw=w2.begin(); itw!=w2.end();++itw)
+				report << *itw << ' ';
+			report << "]" << std::endl;
+			report << "w3: [";
+			for(typename std::vector<typename Field::Element>::const_iterator itw=w3.begin(); itw!=w3.end();++itw)
+				report << *itw << ' ';
+			report << "]" << std::endl;
+		}
+
+		commentator.stop ("done");
+		commentator.progress ();
+	}
+
+	commentator.stop (MSG_STATUS (res), (const char *) 0, "testQLUP");
+
+	return res;
+}
+
+/* Test 2: LQUP solve of a random sparse matrix and a random dense vector
+ *
+ * Constructs a random sparse matrix and computes its QLUP decomposition
+ * using Sparse Gaussian elimination.
+ * Then solve using the decomposition and checks that the results match.
+ */
+template <class Field, class Blackbox, class RandStream>
+bool testQLUPsolve(const Field &F, size_t n, unsigned int iterations, int rseed, double sparsity = 0.05)
+{
+	bool res = true;
+
+	commentator.start ("Testing Sparse elimination qlup solve", "testQLUPsolve", iterations);
+
+	unsigned long Ni = n;
+	unsigned long Nj = n;
+        integer card; F.cardinality(card);
+	typename Field::RandIter generator (F,card,rseed);
+	RandStream stream (F, generator, sparsity, n, n);
+
+        GF2 F2; GF2::RandIter bitgenerator(F2,2,rseed); GF2::Element randomsolve;
+
+	for (size_t i = 0; i < iterations; ++i) {
+		commentator.startIteration (i);
+
+		stream.reset();
+		Blackbox A (F, stream);
+
+		std::ostream & report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+
+		F.write( report ) << endl;
+		A.write( report, FORMAT_MAPLE ) << endl;
+
+		std::vector<typename Field::Element> u(Nj), v(Ni), x(Nj), y(Ni);
+		for(typename std::vector<typename Field::Element>::iterator it=u.begin();it!=u.end();++it)
+			generator.random (*it);
+
+		A.apply(v,u);
+
+
+		Method::SparseElimination SE;
+		SE.strategy(Specifier::PIVOT_LINEAR);
+		GaussDomain<Field> GD ( F );
+
+		Blackbox CopyA ( A );
+
+		GD.solvein(x, A, v, bitgenerator.random(randomsolve) );
+                report << "Random solving: " << randomsolve << std::endl;
+
+		CopyA.apply(y, x);
+
+		VectorDomain<Field> VD(F);
+
+
+		if (! VD.areEqual(v,y)) {
+			res=false;
+                        A.write( report, FORMAT_MAPLE ) << endl;
+
+			report << "ERROR v: matrix(" << v.size() << ",1,[";
+			for(typename std::vector<typename Field::Element>::const_iterator itu=v.begin(); itu!=v.end();++itu)
+				report << *itu << ',';
+			report << "]);\n[";
+			report << "ERROR y: matrix(" << y.size() << ",1,[";
+			for(typename std::vector<typename Field::Element>::const_iterator itu=y.begin(); itu!=y.end();++itu)
+				report << *itu << ',';
+			report << "]);\n[";
+			for(typename std::vector<typename Field::Element>::const_iterator itv=x.begin(); itv!=x.end();++itv)
+				report << *itv << ' ';
+			report << "]  !=  [";
+			for(typename std::vector<typename Field::Element>::const_iterator itw=y.begin(); itw!=y.end();++itw)
+				report << *itw << ' ';
+			report << "]" << std::endl;
+
+		}
+
+		commentator.stop ("done");
+		commentator.progress ();
+	}
+
+	commentator.stop (MSG_STATUS (res), (const char *) 0, "testQLUPsolve");
+
+	return res;
+}
+
+/* Test 2: LQUP nullspacebasis of a random sparse matrix
+ *
+ * Constructs a random sparse matrix and computes its QLUP decomposition
+ * using Sparse Gaussian elimination (stores only U and P).
+ * Then solve using the decomposition and checks that the results match.
+ */
+template <class Field, class Blackbox, class RandStream>
+bool testQLUPnullspace(const Field &F, size_t n, unsigned int iterations, int rseed, double sparsity = 0.05)
+{
+	bool res = true;
+
+	commentator.start ("Testing Sparse elimination qlup nullspacebasis", "testQLUPnullspace", iterations);
+
+	unsigned long Ni = n;
+	unsigned long Nj = n;
+        integer card; F.cardinality(card);
+	typename Field::RandIter generator (F,card,rseed);
+	RandStream stream (F, generator, sparsity, n, n, rseed);
+
+	for (size_t i = 0; i < iterations; ++i) {
+		commentator.startIteration (i);
+
+		stream.reset();
+		Blackbox A (F, stream);
+
+		std::ostream & report = commentator.report (Commentator::LEVEL_UNIMPORTANT, INTERNAL_DESCRIPTION);
+
+		F.write( report ) << endl;
+		A.write( report, FORMAT_MAPLE ) << endl;
+
+
+		Method::SparseElimination SE;
+		SE.strategy(Specifier::PIVOT_LINEAR);
+		GaussDomain<Field> GD ( F );
+
+		Blackbox CopyA ( A );
+                Blackbox X(F, A.coldim(), A.coldim() );
+
+		GD.nullspacebasisin(X, CopyA );
+
+                unsigned long nullity = X.coldim();
+
+                std::vector<typename Field::Element> u(nullity);
+                for(typename std::vector<typename Field::Element>::iterator it=u.begin();it!=u.end();++it)
+			generator.random (*it);
+                std::vector<typename Field::Element> v(Nj);
+                X.apply(v,u);
+                report << "Random combination of the rows of the NullSpace basis" << std::endl;
+
+		std::vector<typename Field::Element> w(Ni);
+                A.apply(w, v);
+
+		VectorDomain<Field> VD(F);
+
+		if (! VD.isZero(w)) {
+			res=false;
+                        A.write( report, FORMAT_MAPLE ) << endl;
+
+			report << "ERROR u: matrix(" << u.size() << ",1,[";
+			for(typename std::vector<typename Field::Element>::const_iterator itu=u.begin(); itu!=u.end();++itu)
+				report << *itu << ',';
+			report << "]);\n[";
+			report << "ERROR v: matrix(" << v.size() << ",1,[";
+			for(typename std::vector<typename Field::Element>::const_iterator itu=v.begin(); itu!=v.end();++itu)
+				report << *itu << ',';
+			report << "]);\n[";
+			for(typename std::vector<typename Field::Element>::const_iterator itv=w.begin(); itv!=w.end();++itv)
+				report << *itv << ' ';
+			report << "]  !=  0" << std::endl;
+
+		}
+
+		commentator.stop ("done");
+		commentator.progress ();
+	}
+
+	commentator.stop (MSG_STATUS (res), (const char *) 0, "testQLUPnullspace");
+
+	return res;
+}
+
+int main (int argc, char **argv)
+{
+
+	commentator.setMaxDepth (-1);
+	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
+// 	commentator.setMaxDetailLevel( 100000 );
+// 	commentator.setMaxDepth( 100000 );
+
+	bool pass = true;
+
+	static size_t n = 80;
+	static integer q = 65519U;
+        static integer bigQ("1234567890123456789012345678901234568123");
+	//static integer q = 1000003U;
+	static int iterations = 2;
+        static double sparsity = 0.05;
+        static int rseed = time(NULL);
+
+	static Argument args[] = {
+		{ 'n', "-n N", "Set dimension of test matrices to NxN.", TYPE_INT,     &n },
+		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
+		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
+                { 's', "-s S", "Sparse matrices with density S.", TYPE_DOUBLE,     &sparsity },
+                { 'r', "-r R", "Random generator seed.", TYPE_INT,     &rseed },
+		END_OF_ARGUMENTS
+	};
+
+	parseArguments (argc, argv, args);
+	srand (rseed);
+
+	commentator.start("QLUP  test suite", "qlup");
+        commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+            << "Seed: " << rseed << endl;
+
+        {
+            commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+                << "over Modular<uint32_t>" << endl;
+            typedef Modular<uint32_t> Field;
+            Field F (q);
+            typedef SparseMatrix<Field, Sparse_Vector<Field::Element> > Blackbox;
+            typedef RandomSparseStream<Field, Sparse_Vector<Field::Element> > RandStream;
+            if (!testQLUP<Field, Blackbox, RandStream> (F, n, iterations, rseed, sparsity)) pass = false;
+            if (!testQLUPsolve<Field, Blackbox, RandStream> (F, n, iterations, rseed, sparsity)) pass = false;
+            if (!testQLUPnullspace<Field, Blackbox, RandStream> (F, n, iterations, rseed, sparsity)) pass = false;
+        }
+
+        {
+            commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+                << "over Modular<double>" << endl;
+            typedef Modular<double> Field;
+            Field F (q);
+            typedef SparseMatrix<Field, Sparse_Vector<Field::Element> > Blackbox;
+            typedef RandomSparseStream<Field, Sparse_Vector<Field::Element> > RandStream;
+            if (!testQLUP<Field, Blackbox, RandStream> (F, n, iterations, rseed, sparsity)) pass = false;
+            if (!testQLUPsolve<Field, Blackbox, RandStream> (F, n, iterations, rseed, sparsity)) pass = false;
+            if (!testQLUPnullspace<Field, Blackbox, RandStream> (F, n, iterations, rseed, sparsity)) pass = false;
+        }
+
+        {
+
+            commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+                << "over GivaroZpz<Integer>" << endl;
+            typedef GivaroZpz<Integer> Field;
+            Field F (bigQ);
+            typedef SparseMatrix<Field, Sparse_Vector<Field::Element> > Blackbox;
+            typedef RandomSparseStream<Field, Sparse_Vector<Field::Element> > RandStream;
+            if (!testQLUP<Field, Blackbox, RandStream> (F, n, iterations, rseed, sparsity)) pass = false;
+            if (!testQLUPsolve<Field, Blackbox, RandStream> (F, n, iterations, rseed, sparsity)) pass = false;
+            if (!testQLUPnullspace<Field, Blackbox, RandStream> (F, n, iterations, rseed, sparsity)) pass = false;
+        }
+
+        {
+            commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+                << "specialized over GF2>" << endl;
+            typedef GF2 Field;
+            Field F2;
+            typedef LinBox::GaussDomain<LinBox::GF2>::Matrix Blackbox;
+            typedef RandomSparseStreamGF2<Blackbox::Row_t> RandStream;
+            if (!testQLUP<Field, Blackbox, RandStream> (F2, n, iterations, rseed, sparsity)) pass = false;
+            if (!testQLUPsolve<Field, Blackbox, RandStream> (F2, n, iterations, rseed, sparsity)) pass = false;
+        }
+
+	commentator.stop("QLUP test suite");
+	return pass ? 0 : -1;
+}
diff --git a/tests/test-quad-matrix.C b/tests/test-quad-matrix.C
deleted file mode 100644
index 29ecbaf..0000000
--- a/tests/test-quad-matrix.C
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* tests/test-quad-matrix.C
- * using generic testBlackbox  -bds
- */
-
-#include "linbox/linbox-config.h"
-
-#include <iostream>
-#include <fstream>
-#include <vector>
-#include <set>
-
-#include "linbox/field/modular.h"
-#include "linbox/blackbox/quad-matrix.h"
-
-#include "test-blackbox.h"
-//#include "test-generic-for-quad.h"
-
-using namespace LinBox;
-
-int main (int argc, char **argv)
-{
-	ofstream report;
-
-	bool pass = true;
-
-	static size_t n = 100000;
-	static integer q = 101;
-	static int iterations = 1;
-
-	static Argument args[] = {
-		{ 'n', "-n N", "Set dimension of test matrices to NxN.", TYPE_INT,     &n },
-		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
-		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
-		{ '\0' }
-	};
-
-	parseArguments (argc, argv, args);
-
-	srand (time (NULL));
-
-	typedef Modular<uint32> Field;
-	typedef ZOQuad <Field> BlackBox;
-
-	Field F (q);
-	Field::Element d; 
-	F.init (d, 1);
-
-       	//ScalarMatrix<Field> A (F, n, d); // a small identity.
-        //BlackBox AA(A);
-	//pass = pass && testBlackbox(AA);
-
-	size_t *rows, *cols, i;
-	const size_t npr = n / 10000;
-	rows = new size_t[npr * n];
-	cols = new size_t[npr * n];
-
-	/*
-	// "arrow" matrix
-	for(i = 0; i < n; i++) { rows[i] = 0; cols[i] = i; }
-	for(i = 0; i < n - 1; i++) { rows[n+2*i] = i + 1; cols[n+2*i] = 0; rows[n+2*i+1] = i + 1; cols[n+2*i+1] = i + 1; }
-	ZeroOne<Field> B(F, rows, cols, n, n, 3 * n - 2);
-	*/
-
-	// random 3 per row matrix
-	for(i = 0; i < n; i++) 
-		{
-			set<size_t> a;
-			while( a.size() < npr )
-				a.insert(rand()%n);
-			size_t j = 0;
-			for(set<size_t>::iterator iter = a.begin(); j < npr; ++j, ++iter)
-				{
-					rows[npr*i+j] = i;
-					cols[npr*i+j] = *iter;
-					//std::cout << rows[npr*i+j] << ", ";
-				}
-			//std::cout << std::endl;
-		}
-	ZeroOne<Field> B(F, rows, cols, n, n, npr * n );
-
-	/*
-	ZeroOne<Field> B(F);
-	//ifstream mat_in("data/m133.b3.200200x200200.sms");
-	//ifstream mat_in("data/n4c6.b9.186558x198895.sms");
-	//ifstream mat_in("data/small21x21.sms");
-	//ifstream mat_in("data/iso333");
-	ifstream mat_in("../examples/iso334");
-	B.read(mat_in);
-	*/
-
-	//std::cout << " -- main: " << B.rowdim() << " " << B.coldim() << " " << B.nnz() << std::endl;
-	//std::cout << " -- main: ZOQuad matrix blackbox test suite" << std::endl;
-
-    BlackBox BB(B);
-
-	//BB.write(cout) << endl; //just writes the sizes of the strips.
-
-	pass = pass && testBlackbox(BB);
-
-	return pass ? 0 : -1;
-}
-
diff --git a/tests/test-randiter-nonzero.C b/tests/test-randiter-nonzero.C
index 8e66659..ed8d697 100644
--- a/tests/test-randiter-nonzero.C
+++ b/tests/test-randiter-nonzero.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-randiter-nonzero.C
  * Copyright (C) 2001, 2002 Bradford Hovinen
@@ -10,6 +11,15 @@
  * See COPYING for license information.
  */
 
+
+/*! @file  tests/test-randiter-nonzero.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test no doc.
+ */
+
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -38,7 +48,7 @@ using namespace LinBox;
  */
 
 template <class Field>
-static bool testNonzeroRandom (Field &F, int iterations) 
+static bool testNonzeroRandom (Field &F, int iterations)
 {
 	int i;
 
@@ -86,11 +96,11 @@ int main (int argc, char **argv)
 	static Argument args[] = {
 		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
-	Modular<uint32> F (q);
+	Modular<uint32_t> F (q);
 
 	srand (time (NULL));
 
diff --git a/tests/test-rank.C b/tests/test-rank.C
index fe1cedb..1054309 100644
--- a/tests/test-rank.C
+++ b/tests/test-rank.C
@@ -1,5 +1,6 @@
-
 /* -*- 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
+
 
 /* tests/test-rank.C
  * Copyright (C) 2002 Bradford Hovinen
@@ -12,6 +13,15 @@
  * Public License. See COPYING for more information.
  */
 
+
+/*! @file  tests/test-rank.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test no doc.
+ */
+
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -22,10 +32,13 @@
 #include "linbox/util/commentator.h"
 #include "linbox/field/modular.h"
 #include "linbox/field/PID-integer.h"
+#include "linbox/field/givaro-zpz.h"
 #include "linbox/blackbox/diagonal.h"
 #include "linbox/blackbox/sparse.h"
 #include "linbox/blackbox/scalar-matrix.h"
 #include "linbox/blackbox/direct-sum.h"
+#include "linbox/algorithms/gauss.h"
+#include "linbox/algorithms/gauss-gf2.h"
 #include "linbox/solutions/rank.h"
 
 #include "test-common.h"
@@ -39,8 +52,9 @@ using namespace LinBox;
  * elimination (direct and blas) and Wiedemann's algorithm. Checks that the results match.
  */
 
+
 template <class Field>
-bool testRankMethods(const Field &F, size_t n, unsigned int iterations, double sparsity = 0.05) 
+bool testRankMethods(const Field &F, size_t n, unsigned int iterations, double sparsity = 0.05)
 {
 	typedef SparseMatrix<Field,typename Vector<Field>::SparseSeq> Blackbox;
 
@@ -60,25 +74,25 @@ bool testRankMethods(const Field &F, size_t n, unsigned int iterations, double s
 		RandomSparseStream<Field, typename Vector<Field>::SparseSeq> stream (F, ri, sparsity, n, n);
 		Blackbox A (F, stream);
 
-		F.write( commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)) << endl; 
-		A.write( commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION),FORMAT_MAPLE ) << endl; 
+		F.write( commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)) << endl;
+		A.write( commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION),FORMAT_MAPLE ) << endl;
 
-		rank (rank_blackbox, A, Method::Blackbox ());
+		LinBox::rank (rank_blackbox, A, Method::Blackbox ());
 			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
 				<< "blackbox rank " << rank_blackbox << endl;
-		rank (rank_elimination, A, Method::Elimination());
+		LinBox::rank (rank_elimination, A, Method::Elimination());
 		if (rank_blackbox != rank_elimination) {
 			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
 				<< "ERROR: blackbox rank != elimination rank " << rank_elimination << endl;
 			ret = false;
 		}
-		rank (rank_hybrid, A, Method::Hybrid());
+		LinBox::rank (rank_hybrid, A, Method::Hybrid());
 		if (rank_blackbox != rank_hybrid) {
 			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
 				<< "ERROR: blackbox rank != hybrid rank " << rank_hybrid << endl;
 			ret = false;
 		}
-		
+
 	/*
 		rank (rank_Wiedemann, A, Method::Wiedemann ());
 		//rank (rank_elimination, B, Method::SparseElimination());
@@ -106,12 +120,86 @@ bool testRankMethods(const Field &F, size_t n, unsigned int iterations, double s
 	return ret;
 }
 
+bool testRankMethodsGF2(const GF2& F2, size_t n, unsigned int iterations, double sparsity = 0.05)
+{
+	typedef ZeroOne<GF2> Blackbox;
+	typedef SparseMatrix<Modular<double>,Vector<Modular<double> >::SparseSeq> MdBlackbox;
+	Modular<double> MdF2(2);
+	GF2::Element one; Modular<double>::Element mdone;
+	F2.init(one,true);
+	MdF2.init(mdone,1UL);
+
+
+	commentator.start ("Testing elimination-based and blackbox rank over GF2", "testRankMethodsGF2", iterations);
+
+	bool ret = true;
+	unsigned int i;
+
+	unsigned long rank_blackbox, rank_elimination, rank_sparselimination, rank_sparse;
+	//unsigned long rank_Wiedemann, rank_elimination, rank_blas_elimination;
+
+	GF2::RandIter ri (F2);
+
+	for (i = 0; i < iterations; ++i) {
+		commentator.startIteration (i);
+
+		Blackbox A(F2,n,n);
+		MdBlackbox B(MdF2,n,n);
+		for(size_t ii=0; ii<n;++ii) {
+			for(size_t jj=0; jj<n; ++jj) {
+				if (drand48()<sparsity) {
+					A.setEntry(ii,jj,one);
+					B.setEntry(ii,jj,mdone);
+				}
+			}
+		}
+
+		F2.write( commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)) << endl;
+		B.write( commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION),FORMAT_GUILLAUME ) << endl;
+		A.write( commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION),FORMAT_GUILLAUME ) << endl;
+
+
+		rank (rank_blackbox, A, Method::Blackbox ());
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+				<< "blackbox rank " << rank_blackbox << endl;
+
+		rank (rank_elimination, B, Method::BlasElimination());
+		if (rank_blackbox != rank_elimination) {
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+				<< "ERROR: blackbox rank != BLAS elimination rank " << rank_elimination << endl;
+			ret = false;
+		}
+
+		rankin (rank_sparselimination, A, Method::SparseElimination());
+		if (rank_blackbox != rank_sparselimination) {
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+				<< "ERROR: blackbox rank != sparse elimination GF2 rank " << rank_elimination << endl;
+			ret = false;
+		}
+
+
+		rankin (rank_sparse, B, Method::SparseElimination());
+
+		if (rank_sparselimination != rank_sparse) {
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+				<< "ERROR: rank sparse elimination GF2 != sparse rank " << rank_sparse << endl;
+			ret = false;
+		}
+
+		commentator.stop ("done");
+		commentator.progress ();
+	}
+
+	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testEliminationRank");
+
+	return ret;
+}
 /* Test 4: Rank of zero and identity matrices by Wiedemann variants
  *
  */
 
 template <class Field>
-bool testZeroAndIdentRank (const Field &F, size_t n, unsigned int iterations) 
+bool testZeroAndIdentRank (const Field &F, size_t n, unsigned int iterations)
 {
 	typedef ScalarMatrix<Field> Blackbox;
 
@@ -152,7 +240,7 @@ bool testZeroAndIdentRank (const Field &F, size_t n, unsigned int iterations)
 				<< "ERROR: Wiedemann Rank of I+0 is " << r << ", should be " << n << endl;
 			ret = false;
 		}
-                
+
                 rank (r, B, Method::Wiedemann(Method::Wiedemann::SYMMETRIC));
 		if (r != n) {
 			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
@@ -173,49 +261,62 @@ int main (int argc, char **argv)
 
 //     commentator.setMaxDetailLevel( 100000 );
 //     commentator.setMaxDepth( 100000 );
-   
+
 	bool pass = true;
 
-	static size_t n = 80;
+	static size_t n = 40;
 	static integer q = 65519U;
 	//static integer q = 1000003U;
-	static int iterations = 2;
+	static integer bigQ("12345678901234567890123456789012345678901234568119");
+	static int iterations = 1;
         static double sparsity = 0.05;
 
 	static Argument args[] = {
 		{ 'n', "-n N", "Set dimension of test matrices to NxN.", TYPE_INT,     &n },
 		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
-        { 's', "-s S", "Sparse matrices with density S.", TYPE_DOUBLE,     &sparsity },
-		{ '\0' }
+		{ 's', "-s S", "Sparse matrices with density S.", TYPE_DOUBLE,     &sparsity },
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
 
 	srand (time (NULL));
+	// srand48 (time (NULL));
 
 	commentator.start("rank solution test suite", "rank");
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
 
 	commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
-	<< "over Modular<uint32>" << endl; 
-	Modular<LinBox::uint32> F (q);
+	<< "over Modular<uint32_t>" << endl;
+	Modular<uint32_t> F (q);
 	if (!testRankMethods (F, n, iterations, sparsity)) pass = false;
 	if (!testZeroAndIdentRank (F, n, 1)) pass = false;
 
-	commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION) 
-	<< "over Modular<int>" << endl; 
+	commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+	<< "over Modular<int>" << endl;
 	Modular<double> G (q);
-    if (!testRankMethods (G, n, iterations, sparsity)) pass = false;
+    	if (!testRankMethods (G, n, iterations, sparsity)) pass = false;
 	if (!testZeroAndIdentRank (G, n, 1)) pass = false;
 
-
-	commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION) 
-	<< "over PID_integer" << endl; 
-        PID_integer R;
+	commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+	<< "over PID_integer" << endl;
+	PID_integer R;
 	if (!testRankMethods (R, n, iterations, sparsity)) pass = false;
 
+	commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+	<< "over GivaroZpz<Integer>" << endl;
+        GivaroZpz<Integer> Gq(bigQ);
+	if (!testRankMethods (Gq, n, iterations, sparsity)) pass = false;
+	if (!testZeroAndIdentRank (Gq, n, 1)) pass = false;
+
+	commentator.report (Commentator::LEVEL_NORMAL, INTERNAL_DESCRIPTION)
+	<< "over GF2" << endl;
+        GF2 F2;
+	if (!testRankMethodsGF2 (F2, n, iterations, sparsity)) pass = false;
+
+
 	commentator.stop("rank solution test suite");
 	return pass ? 0 : -1;
 }
diff --git a/tests/test-rat-charpoly.C b/tests/test-rat-charpoly.C
new file mode 100644
index 0000000..bc248ef
--- /dev/null
+++ b/tests/test-rat-charpoly.C
@@ -0,0 +1,141 @@
+/* -*- 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
+
+/* tests/test-solve.C
+ * Copyright (C) 2001, 2002 Bradford Hovinen
+ *
+[12~ * Written by Bradford Hovinen <hovinen at cis.udel.edu>
+ *
+ * --------------------------------------------------------
+ *
+ * See COPYING for license information
+ */
+
+
+/*! @file  tests/test-solve.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test no doc.
+ */
+
+
+
+#include "linbox/linbox-config.h"
+
+#include <iostream>
+#include <fstream>
+#include <vector>
+#include <cstdio>
+
+#include "linbox/util/commentator.h"
+#include "linbox/blackbox/sparse.h"
+#include "linbox/blackbox/dense.h"
+#include "linbox/solutions/charpoly.h"
+
+#include "test-common.h"
+
+using namespace LinBox;
+
+/* Test 1: Charpoly of a diagonal matrix
+ *
+ * Constructs a random diagonal rational matrix D
+ * Computes its characteristic polynomial
+ * Checks if c[0] (determinant) and c[n-1] (trace) agree
+ *
+ * Return true on success and false on failure
+ */
+
+static bool testDiagRatCharpoly (size_t n, int iterations)
+{
+	commentator.start ("Testing rational charpoly of diagonal matrix ", "testNonsingularRatIntSolve", iterations);
+
+	bool ret = true;
+	int i;
+	size_t j;
+
+	GMPRationalField Q;
+	SparseMatrix<GMPRationalField > A(Q,n,n);
+	DenseMatrix <GMPRationalField > B(Q,n,n);
+	std::vector<GMPRationalField::Element> c;
+
+	for (i=0; i < iterations; i++) {
+        	GMPRationalField::Element c0,cn;
+	        Q.init(c0,1,1);
+	        Q.init(cn,0,1);
+
+
+		commentator.startIteration (i);
+
+		for (j=0; j < n; ++j) {
+			integer tmp_n, tmp_d;
+			GMPRationalField::Element tmp, abstmp;
+			tmp_n = (integer) rand() % (5*(i +1)) + 1;
+			tmp_d = (integer) rand() % (5*(i +1)) + 1;
+			if ( ( i%2) && (j % 2)) integer::negin(tmp_n);
+
+			Q.init(tmp, tmp_n,tmp_d);
+
+			A.setEntry(j,j,tmp);
+			B.setEntry(j,j,tmp);
+
+
+			Q.mulin(c0, tmp);
+			Q.addin(cn, tmp);
+		}
+		if (n%2==0) Q.negin(cn);
+
+		ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+		charpoly (c, A);
+		if ((!Q.areEqual(c[0] , c0)) || (!Q.areEqual(c[n-1] , cn) ) ) {
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+				<< "ERROR: Sparse charpoly failed" << endl;
+			ret = false;
+		}
+		c.clear();
+
+		charpoly (c, B);
+		if ((!Q.areEqual(c[0] , c0)) || (!Q.areEqual(c[n-1] , cn) ) ) {
+                        commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+                                << "ERROR: Dense charpoly failed" << endl;
+                        ret = false;
+                }
+
+		commentator.stop ("done");
+		commentator.progress ();
+	}
+
+	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testNonsingularRatIntSolve");
+
+	return ret;
+}
+
+int main (int argc, char **argv)
+{
+	bool pass = true;
+
+	static size_t n = 10;
+	static int iterations = 1;
+
+	static Argument args[] = {
+		{ 'n', "-n N", "Set column dimension of test matrices to N.", TYPE_INT,     &n },
+		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
+		END_OF_ARGUMENTS
+	};
+	parseArguments (argc, argv, args);
+
+	commentator.start("Rational solve test suite", "solve");
+
+	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (10);
+	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
+	commentator.getMessageClass (TIMING_MEASURE).setMaxDepth (10);
+	commentator.getMessageClass (TIMING_MEASURE).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
+	commentator.getMessageClass (PROGRESS_REPORT).setMaxDepth (5);
+	//commentator.getMessageClass (BRIEF_REPORT).setMaxDepth (4);
+
+    if ( ! testDiagRatCharpoly(n,iterations) ) pass = false;
+
+	commentator.stop("solve test suite");
+    //std::cout << (pass ? "passed" : "FAILED" ) << std::endl;
+
+	return pass ? 0 : -1;
+}
diff --git a/tests/test-rat-minpoly.C b/tests/test-rat-minpoly.C
new file mode 100644
index 0000000..baacf00
--- /dev/null
+++ b/tests/test-rat-minpoly.C
@@ -0,0 +1,147 @@
+/* -*- 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
+
+/* tests/test-solve.C
+ * Copyright (C) 2001, 2002 Bradford Hovinen
+ *
+[12~ * Written by Bradford Hovinen <hovinen at cis.udel.edu>
+ *
+ * --------------------------------------------------------
+ *
+ * See COPYING for license information
+ */
+
+
+/*! @file  tests/test-rat-minpoly.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test no doc.
+ */
+
+
+
+#include "linbox/linbox-config.h"
+
+#include <iostream>
+#include <fstream>
+#include <vector>
+#include <cstdio>
+
+#include "linbox/util/commentator.h"
+#include "linbox/blackbox/sparse.h"
+#include "linbox/blackbox/dense.h"
+#include "linbox/solutions/charpoly.h"
+
+#include "test-common.h"
+
+using namespace LinBox;
+
+/* Test 1: Minpoly of a diagonal matrix
+ *
+ * Constructs a random diagonal rational matrix D such that d[2i,2i]=d[2i+1,2i+1]
+ * Computes its characteristic polynomial
+ * Checks if c[0] (determinant) and c[n-1] (trace) agree
+ *
+ * Return true on success and false on failure
+ */
+
+static bool testDiagRatCharpoly (size_t n, int iterations)
+{
+	commentator.start ("Testing rational charpoly of diagonal matrix ", "testNonsingularRatIntSolve", iterations);
+
+	bool ret = true;
+	int i;
+	size_t j;
+
+	GMPRationalField Q;
+	SparseMatrix<GMPRationalField > A(Q,n,n);
+	DenseMatrix <GMPRationalField > B(Q,n,n);
+	std::vector<GMPRationalField::Element> c;
+
+	for (i=0; i < iterations; i++) {
+        	GMPRationalField::Element c0,cn;
+	        Q.init(c0,1,1);
+	        Q.init(cn,0,1);
+
+		commentator.startIteration (i);
+
+		size_t k = ceil(n/2);
+		for (j=0; j < k; ++j) {
+			integer tmp_n, tmp_d;
+			GMPRationalField::Element tmp, abstmp;
+			tmp_n = (integer) rand() % (5*(i +1)) + 1;
+			tmp_d = (integer) rand() % (5*(i +1)) + 1;
+			if ( ( i%2) && (j % 2)) integer::negin(tmp_n);
+
+			Q.init(tmp, tmp_n,tmp_d);
+
+			A.setEntry(2*j,2*j,tmp);
+			B.setEntry(2*j,2*j,tmp);
+
+			if (2*j +1 < n) {
+				A.setEntry(2*j+1,2*j+1,tmp);
+				B.setEntry(2*j+1,2*j+1,tmp);
+			}
+
+			Q.mulin(c0, tmp);
+			Q.addin(cn, tmp);
+		}
+		if (k%2==0) Q.negin(cn);
+
+
+		// ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+		charpoly (c, A);
+
+		if ( (c.size() == k+1) && ((!Q.areEqual(c[0] , c0)) || (!Q.areEqual(c[k-1] , cn) ) ) ) {
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+				<< "ERROR: Sparse charpoly failed" << endl;
+			ret = false;
+		}
+		c.clear();
+
+		charpoly (c, B);
+		if ( (c.size() == k+1) && ((!Q.areEqual(c[0] , c0)) || (!Q.areEqual(c[n-1] , cn) ) ) ) {
+                        commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+                                << "ERROR: Dense charpoly failed" << endl;
+                        ret = false;
+                }
+
+		commentator.stop ("done");
+		commentator.progress ();
+	}
+
+	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testNonsingularRatIntSolve");
+
+	return ret;
+}
+
+int main (int argc, char **argv)
+{
+	bool pass = true;
+
+	static size_t n = 10;
+	static int iterations = 2;
+
+	static Argument args[] = {
+		{ 'n', "-n N", "Set column dimension of test matrices to N.", TYPE_INT,     &n },
+		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
+		END_OF_ARGUMENTS
+	};
+	parseArguments (argc, argv, args);
+
+	commentator.start("Rational solve test suite", "solve");
+
+	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (10);
+	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
+	commentator.getMessageClass (TIMING_MEASURE).setMaxDepth (10);
+	commentator.getMessageClass (TIMING_MEASURE).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
+	commentator.getMessageClass (PROGRESS_REPORT).setMaxDepth (5);
+	//commentator.getMessageClass (BRIEF_REPORT).setMaxDepth (4);
+
+    if ( ! testDiagRatCharpoly(n,iterations) ) pass = false;
+
+	commentator.stop("solve test suite");
+    //std::cout << (pass ? "passed" : "FAILED" ) << std::endl;
+
+	return pass ? 0 : -1;
+}
diff --git a/tests/test-rat-solve.C b/tests/test-rat-solve.C
new file mode 100644
index 0000000..e3f9239
--- /dev/null
+++ b/tests/test-rat-solve.C
@@ -0,0 +1,193 @@
+/* -*- 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
+
+/* tests/test-solve.C
+ * Copyright (C) 2001, 2002 Bradford Hovinen
+ *
+[12~ * Written by Bradford Hovinen <hovinen at cis.udel.edu>
+ *
+ * --------------------------------------------------------
+ *
+ * See COPYING for license information
+ */
+
+
+/*! @file  tests/test-rat-solve.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test no doc.
+ */
+
+
+
+#include "linbox/linbox-config.h"
+
+#include <iostream>
+#include <fstream>
+#include <vector>
+#include <cstdio>
+
+#include "linbox/util/commentator.h"
+#include "linbox/blackbox/sparse.h"
+#include "linbox/solutions/solve.h"
+
+#include "test-common.h"
+
+using namespace LinBox;
+
+/* Test 1: Solution of diagonal system
+ *
+ * Constructs a random nonsingular diagonal rational matrix D and a random right-hand
+ * side integer b, and computes the solution to the Dx=b, checking the result
+ *
+ * Return true on success and false on failure
+ */
+
+static bool testNonsingularRatIntSolve (size_t n, int iterations)
+{
+	commentator.start ("Testing nonsingular solve with integer vector", "testNonsingularRatIntSolve", iterations);
+
+	bool ret = true;
+	int i;
+	size_t j;
+
+	GMPRationalField Q;
+	SparseMatrix<GMPRationalField > A(Q,n,n);
+
+	PID_integer Z;
+	std::vector<PID_integer::Element> b(n);
+	std::vector<GMPRationalField::Element> true_x(n),x(n);
+
+	for (i=0; i < iterations; i++) {
+		commentator.startIteration (i);
+
+		for (j=0; j < n; ++j) {
+			integer tmp_n, tmp_d, tmp_b;
+			GMPRationalField::Element tmp;
+			tmp_n = (integer) rand() % (2*(i + 1)) + 1;
+			tmp_d = (integer) rand() % (2*(i + 1)) + 1;
+			tmp_b = (integer) rand() % (2*(i + 1)) ;
+			Q.init(tmp, tmp_n,tmp_d);
+			A.setEntry(j,j,tmp);
+			b[j]= tmp_b;
+			if ( ( i%2) && (j % 2)) integer::negin(b[j]);
+			Q.init(true_x[j] , b[j] * tmp_d, tmp_n);
+		}
+
+		ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+		solve (x, A, b);
+		for (j=0; j < n; ++j) {
+			if (!Q.areEqual(x[j] ,true_x[j])) {
+				commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+					<< "ERROR: System solution failed" << endl;
+				ret = false;
+			}
+		}
+
+		commentator.stop ("done");
+		commentator.progress ();
+	}
+
+	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testNonsingularRatIntSolve");
+
+	return ret;
+}
+
+/* Test 2: Solution of diagonal system
+ *
+ * Constructs a random nonsingular diagonal rational matrix D and a random right-hand
+ * side rational b, and computes the solution to the Dx=b, checking the result
+ *
+ * Return true on success and false on failure
+ */
+
+static bool testNonsingularRatRatSolve (size_t n, int iterations)
+{
+	commentator.start ("Testing nonsingular solve with rational vector", "testNonsingularRatRatSolve", iterations);
+
+	bool ret = true;
+	int i;
+	size_t j;
+
+	GMPRationalField Q;
+	SparseMatrix<GMPRationalField > A(Q,n,n);
+
+	PID_integer Z;
+	std::vector<GMPRationalField::Element> b(n);
+	std::vector<GMPRationalField::Element> true_x(n),x(n);
+
+	for (i=0; i < iterations; i++) {
+		commentator.startIteration (i);
+
+		for (j=0; j < n; ++j) {
+			integer tmp_n, tmp_d, tmp_bn, tmp_bd;
+			GMPRationalField::Element tmp,tmpb;
+			tmp_n = (integer) rand() % (2*(i + 1)) + 1;
+			tmp_d = (integer) rand() % (2*(i + 1)) + 1;
+			tmp_bn = (integer) rand() % (2*(i + 1)) ;
+			tmp_bd = (integer) rand() % (2*(i + 1)) + 1;
+			//integer::nonzerorandom(tmp_n, 2*(i + 1) );
+			//integer::nonzerorandom(tmp_d, 2*(i + 1) );
+			//integer::random(tmp_bn, 2*(i + 1));
+			//integer::nonzerorandom(tmp_bd, 2*(i +1) );
+			if ( ( i%2) && (j % 2)) integer::negin(tmp_bn);
+			Q.init(tmp, tmp_n,tmp_d);
+			A.setEntry(j,j,tmp);
+			Q.init(tmpb,tmp_bn,tmp_bd);
+			b[j]= tmpb;
+
+			Q.init(true_x[j] , tmp_bn * tmp_d, tmp_bd * tmp_n);
+		}
+
+		ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+		solve (x, A, b);
+
+		for (j=0; j < n; ++j) {
+			if (!Q.areEqual(x[j] ,true_x[j])) {
+				commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+					<< "ERROR: System solution failed" << endl;
+				ret = false;
+			}
+		}
+
+		commentator.stop ("done");
+		commentator.progress ();
+	}
+
+	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testNonsingularRatRatSolve");
+
+	return ret;
+}
+
+
+int main (int argc, char **argv)
+{
+	bool pass = true;
+
+	static size_t n = 10;
+	static int iterations = 1;
+
+	static Argument args[] = {
+		{ 'n', "-n N", "Set column dimension of test matrices to N.", TYPE_INT,     &n },
+		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
+		END_OF_ARGUMENTS
+	};
+	parseArguments (argc, argv, args);
+
+	commentator.start("Rational solve test suite", "solve");
+
+	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (10);
+	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
+	commentator.getMessageClass (TIMING_MEASURE).setMaxDepth (10);
+	commentator.getMessageClass (TIMING_MEASURE).setMaxDetailLevel (Commentator::LEVEL_NORMAL);
+	commentator.getMessageClass (PROGRESS_REPORT).setMaxDepth (5);
+	//commentator.getMessageClass (BRIEF_REPORT).setMaxDepth (4);
+
+    if ( ! testNonsingularRatIntSolve(n,iterations) ) pass = false;
+    if ( ! testNonsingularRatRatSolve(n,iterations) ) pass = false;
+
+	commentator.stop("solve test suite");
+    //std::cout << (pass ? "passed" : "FAILED" ) << std::endl;
+
+	return pass ? 0 : -1;
+}
diff --git a/tests/test-rational-matrix-factory.C b/tests/test-rational-matrix-factory.C
new file mode 100644
index 0000000..4148944
--- /dev/null
+++ b/tests/test-rational-matrix-factory.C
@@ -0,0 +1,186 @@
+/* -*- 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
+
+/* tests/test-det.C
+ * Copyright (C) 2002 Bradford Hovinen
+ *
+ * Written by Bradford Hovinen <hovinen at cis.udel.edu>
+ *
+ * --------------------------------------------------------
+ *
+ * See COPYING for license information
+ */
+
+/*! @file  tests/test-rational-matrix-factory.C
+ * @ingroup tests
+ * @brief no doc.
+ * @test no doc.
+ */
+
+
+#include <iostream>
+#include <fstream>
+#include <vector>
+#include <cstdio>
+
+#include "linbox/linbox-config.h"
+
+#include "linbox/util/commentator.h"
+#include "linbox/field/PID-integer.h"
+#include "linbox/field/gmp-rational.h"
+#include "linbox/blackbox/dense.h"
+#include "linbox/blackbox/rational-matrix-factory.h"
+
+#include "test-common.h"
+
+using namespace LinBox;
+
+/* Test : For a diagonal rational matrix A = diag(1,1/2,1/3,...) compute
+ * -> rational norm |A|_r = n
+ * -> number of non-zero elements = n
+ * -> number of truly rational elements = n-1
+ * -> denA - the common denominator of A = lcm(1,...,n)
+ * -> d[i] - the common denominator for ith row = i
+ * -> Atilde = Id
+ * -> Aprim[j,j] = denA / j
+ *
+ * n - Dimension to which to make matrix
+ *
+ * Return true on success and false on failure
+ */
+
+static bool testDiagonalMatrix (size_t n)
+{
+	commentator.start ("Testing rational matrix factory for dense matrix", "testRationalMatrixFactory");
+
+	bool ret = true;
+	size_t j;
+
+	GMPRationalField Q;
+	DenseMatrix<GMPRationalField > A(Q,n,n);
+	integer lcm_n=1;
+
+	for (j = 0; j < n; j++) {
+		GMPRationalField::Element tmp;
+		Q.init(tmp, 1,j+1);
+		A.setEntry(j,j,tmp);
+		//Q.init(A.refEntry(j,j),1,j+1);
+		lcm(lcm_n,lcm_n,j+1);
+	}
+
+	RationalMatrixFactory<PID_integer, GMPRationalField, DenseMatrix<GMPRationalField > > FA(&A);
+
+	integer ratnorm,aprimnorm,atildenorm;
+	FA.getNorms(ratnorm,aprimnorm,atildenorm);
+
+	ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+
+	report << "True rational norm: " << n << endl;
+	report << "Computed rational norm: " << ratnorm << endl;
+
+	report << "True norm of A': " << lcm_n << endl;
+        report << "Computed norm of A': " << aprimnorm << endl;
+
+	report << "True norm of Atilde: " << 1 << endl;
+        report << "Computed norm of Atilde: " << atildenorm << endl;
+
+	if ( (ratnorm != (Integer)n) || ( aprimnorm != lcm_n) || (atildenorm != 1) ) {
+		ret = false;
+		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+			<< "ERROR: Norms are incorrect" << endl;
+	}
+
+	size_t omega, rat_omega;
+	FA.getOmega(omega,rat_omega);
+
+	report << "True Omega: " << n  << endl;
+	report << "Computed Omega: " << omega  << endl;
+
+        report << "True Rational Omega: " << n-1  << endl;
+        report << "Computed Rational Omega: " << rat_omega  << endl;
+
+	if ( (omega != n) || (rat_omega != n-1) ) {
+		ret = false;
+		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+			 << "ERROR: Number of rational/non-zero elements is incorrect" << endl;
+	}
+
+	integer d;
+	FA.denominator(d);
+
+	report << "True common denominator: " << lcm_n << endl;
+	report << "Computed common denominator: " << d << endl;
+
+	if (d != lcm_n) {
+		ret = false;
+		commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+			<< "ERROR: Common denominator is incorrect" << endl;
+	}
+
+	for (j=0; j < n; ++j) {
+		FA.denominator(d,j);
+		report << "True common denominator for " << j+1 <<  "th row: " << j+1 << endl;
+		report << "Computed common denominator for " << j+1 <<  "th row: " << d << endl;
+		if (d != (integer)(j+1)) {
+			ret  = false;
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+				<< "ERROR: Common denominator for " << j+1 <<  "th row is incorrect" << endl;
+		}
+	}
+
+	PID_integer Z;
+	DenseMatrix<PID_integer> Aprim(Z,n,n);
+	DenseMatrix<PID_integer> Atilde(Z,n,n);
+
+	FA.makeAprim(Aprim);
+	FA.makeAtilde(Atilde);
+
+	Aprim.write(report);
+	Atilde.write(report);
+
+	for (j=0; j <n; ++j) {
+		if (Aprim.getEntry(j,j) != lcm_n/(j+1)) {
+			ret  = false;
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+				<< "ERROR: Aprim is bad at " << j+1 <<  "diagonal entry" << endl;
+		}
+		if (Atilde.getEntry(j,j) != 1) {
+			ret  = false;
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+				<< "ERROR: Atilde is bad at " << j+1 <<  "diagonal entry" << endl;
+		}
+	}
+
+	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testRationalMatrixFactory");
+
+	return ret;
+}
+
+int main (int argc, char **argv)
+{
+	bool pass = true;
+
+	static size_t n = 10;
+	//static integer q = 4093U;
+	//static int iterations = 2;
+
+	static Argument args[] = {
+		{ 'n', "-n N", "Set dimension of test matrices to NxN", TYPE_INT,     &n },
+		//{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1]", TYPE_INTEGER, &q },
+		//{ 'i', "-i I", "Perform each test for I iterations",    TYPE_INT,     &iterations },
+		END_OF_ARGUMENTS
+	};
+
+	parseArguments (argc, argv, args);
+
+	commentator.start("Rational Matrix Factory test suite", "rmf");
+
+	// Make sure some more detailed messages get printed
+	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
+	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
+
+	if (!testDiagonalMatrix( n )) pass = false;
+
+	commentator.stop("Rational Matrix Factory test suite");
+	return pass ? 0 : -1;
+}
diff --git a/tests/test-rational-reconstruction-base.C b/tests/test-rational-reconstruction-base.C
new file mode 100644
index 0000000..2e1ae74
--- /dev/null
+++ b/tests/test-rational-reconstruction-base.C
@@ -0,0 +1,297 @@
+/* -*- 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
+
+/* tests/test-det.C
+ * Copyright (C) 2002 Bradford Hovinen
+ *
+ * Written by Bradford Hovinen <hovinen at cis.udel.edu>
+ *
+ * --------------------------------------------------------
+ *
+ * See COPYING for license information
+ */
+
+
+/*! @file  tests/test-rational-reconstruction-base.C
+ * @ingroup tests
+ * @ingroup CRA
+ * @brief  tests rational reconstruction using rational-cra2.h .
+ * @test no doc.
+ */
+
+
+
+#include <iostream>
+#include <fstream>
+#include <vector>
+#include <cstdio>
+
+#include "linbox/linbox-config.h"
+
+#include "linbox/util/commentator.h"
+#include "linbox/field/modular.h"
+#include "linbox/field/PID-integer.h"
+#include "linbox/field/gmp-rational.h"
+
+#include "linbox/algorithms/rational-cra2.h"
+#include "linbox/algorithms/varprec-cra-early-single.h"
+#include "linbox/algorithms/rational-reconstruction-base.h"
+#include "linbox/algorithms/classic-rational-reconstruction.h"
+#include "linbox/algorithms/fast-rational-reconstruction.h"
+#include "linbox/randiter/random-prime.h"
+
+#include "test-common.h"
+
+using namespace LinBox;
+
+/* Test: Rational reconstruction of random fraction using rational-cra2.h
+ *
+ * Constructs a random pair of numerator/denominator
+ * Reconstructs it based on rational reconstruction
+ *
+ * n - size of numerator
+ * d - size of denominator
+ * iterations - Number of iterations to run
+ *
+ * Return true on success and false on failure
+ */
+
+struct ModularFraction {
+	integer a_,b_;
+	ModularFraction(const integer& a, const integer& b) :
+		a_(a), b_(b)
+	{}
+	template<typename Field>
+	typename Field::Element& operator()(typename Field::Element& d, const Field& F) const
+	{
+		F.init(d,a_);
+		F.divin(d,b_);
+		return d;
+	}
+};
+
+static bool testRandomFraction (size_t n, size_t d, int iterations)
+{
+	commentator.start ("Testing rational reconstruction on random fractions", "testRandFrac", iterations);
+
+	bool ret = true;
+	// bool done;
+	int i;
+	// size_t j;
+	// size_t k;
+	integer num,den;
+
+	for (i = 0; i < iterations; i++) {
+		commentator.startIteration (i);
+
+		integer::nonzerorandom(num, n);
+		integer::nonzerorandom(den, d);
+		integer g; gcd(g,num, den);
+		num /= g; den /= g;
+		if (i %2 ) integer::negin(num);
+
+		ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+		report << "True fraction: " << num << " / " << den;
+		report << endl;
+
+		ModularFraction iteration(num,den);
+		int bits = 26;
+		RandomPrimeIterator genprime( bits);
+
+		PID_integer Z;
+		ClassicRationalReconstruction<PID_integer> RRB1(Z,false,false);
+		ClassicMaxQRationalReconstruction<PID_integer> RRB2(Z,false,false);
+
+		integer a1_1, b1_1, a2_1, b2_1, a3_1, b3_1, a4_1, b4_1;
+		integer a1_2, b1_2, a2_2, b2_2, a3_2, b3_2, a4_2, b4_2;
+		integer a1_3, b1_3, a2_3, b2_3, a3_3, b3_3, a4_3, b4_3;
+		integer a1_4, b1_4, a2_4, b2_4, a3_4, b3_4, a4_4, b4_4;
+
+		RReconstruction<PID_integer, FastRationalReconstruction<PID_integer> > RR1_1(Z,INCREMENTAL,5);
+		RationalRemainder2< VarPrecEarlySingleCRA< Modular<double> >,
+		RReconstruction<PID_integer, FastRationalReconstruction<PID_integer> > > cra1_1(4UL, RR1_1);
+		cra1_1(a1_1,b1_1,iteration,genprime);
+		if ((a1_1 != num)  || (b1_1 != den) ) {
+			ret = false;
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+			<< "ERROR: rational reconstruction (Wang, incremental, fast) failed" << endl;
+		}
+
+		RReconstruction<PID_integer, FastMaxQRationalReconstruction<PID_integer> > RR2_1(Z,INCREMENTAL,5);
+		RationalRemainder2< VarPrecEarlySingleCRA< Modular<double> >,
+		RReconstruction<PID_integer, FastMaxQRationalReconstruction<PID_integer> > > cra2_1(4UL, RR2_1);
+		cra2_1(a2_1,b2_1,iteration,genprime);
+		if ((a2_1 != num)  || (b2_1 != den) ) {
+			ret = false;
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+			<< "ERROR: rational reconstruction (MaxQ, incremental, fast) failed" << endl;
+		}
+
+		RReconstruction<PID_integer, ClassicRationalReconstruction<PID_integer> > RR3_1(RRB1,INCREMENTAL,5);
+		RationalRemainder2< VarPrecEarlySingleCRA< Modular<double> >,
+		RReconstruction<PID_integer, ClassicRationalReconstruction<PID_integer> > > cra3_1(4UL, RR3_1);
+		cra3_1(a3_1,b3_1,iteration,genprime);
+		if ((a3_1 != num)  || (b3_1 != den) ) {
+			ret = false;
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+			<< "ERROR: rational reconstruction (Wang, incremental, classic) failed" << endl;
+		}
+
+		RReconstruction<PID_integer, ClassicMaxQRationalReconstruction<PID_integer> > RR4_1(RRB2,INCREMENTAL,5);
+		RationalRemainder2< VarPrecEarlySingleCRA< Modular<double> >,
+		RReconstruction<PID_integer, ClassicMaxQRationalReconstruction<PID_integer> > > cra4_1(4UL, RR4_1);
+		cra4_1(a4_1,b4_1,iteration,genprime);
+		if ((a4_1 != num)  || (b4_1 != den) ) {
+			ret = false;
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+			<< "ERROR: rational reconstruction (MaxQ, incremental, classic) failed" << endl;
+		}
+
+		RReconstruction<PID_integer, FastRationalReconstruction<PID_integer> > RR1_2(Z,QUADRATIC,0,10);
+		RationalRemainder2< VarPrecEarlySingleCRA< Modular<double> >,
+		RReconstruction<PID_integer, FastRationalReconstruction<PID_integer> > > cra1_2(4UL, RR1_2);
+		cra1_2(a1_2,b1_2,iteration,genprime);
+		if ((a1_2 != num)  || (b1_2 != den) ) {
+			ret = false;
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+			<< "ERROR: rational reconstruction (Wang, quadratic, fast) failed" << endl;
+		}
+
+		RReconstruction<PID_integer, FastMaxQRationalReconstruction<PID_integer> > RR2_2(Z,QUADRATIC,0,10);
+		RationalRemainder2< VarPrecEarlySingleCRA< Modular<double> >,
+		RReconstruction<PID_integer, FastMaxQRationalReconstruction<PID_integer> > > cra2_2(4UL, RR2_2);
+		cra2_2(a2_2,b2_2,iteration,genprime);
+		if ((a2_2 != num)  || (b2_2 != den) ) {
+			ret = false;
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+			<< "ERROR: rational reconstruction (MaxQ, quadratic, fast) failed" << endl;
+		}
+
+		RReconstruction<PID_integer, ClassicRationalReconstruction<PID_integer> > RR3_2(RRB1,QUADRATIC,0,10);
+		RationalRemainder2< VarPrecEarlySingleCRA< Modular<double> >,
+		RReconstruction<PID_integer, ClassicRationalReconstruction<PID_integer> > > cra3_2(4UL, RR3_2);
+		cra3_2(a3_2,b3_2,iteration,genprime);
+		if ((a3_2 != num)  || (b3_2 != den) ) {
+			ret = false;
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+			<< "ERROR: rational reconstruction (Wang, quadratic, classic) failed" << endl;
+		}
+
+		RReconstruction<PID_integer, ClassicMaxQRationalReconstruction<PID_integer> > RR4_2(RRB2,QUADRATIC,0,10);
+		RationalRemainder2< VarPrecEarlySingleCRA< Modular<double> >,
+		RReconstruction<PID_integer, ClassicMaxQRationalReconstruction<PID_integer> > > cra4_2(4UL, RR4_2);
+		cra4_2(a4_2,b4_2,iteration,genprime);
+		if ((a4_2 != num)  || (b4_2 != den) ) {
+			ret = false;
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+			<< "ERROR: rational reconstruction (MaxQ, quadratic, classic) failed" << endl;
+		}
+
+
+		RReconstruction<PID_integer, FastRationalReconstruction<PID_integer> > RR1_3(Z,GEOMETRIC,0,5);
+		RationalRemainder2< VarPrecEarlySingleCRA< Modular<double> >,
+		RReconstruction<PID_integer, FastRationalReconstruction<PID_integer> > > cra1_3(4UL, RR1_3);
+		cra1_3(a1_3,b1_3,iteration,genprime);
+		if ((a1_3 != num)  || (b1_3 != den) ) {
+			ret = false;
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+			<< "ERROR: rational reconstruction (Wang, geometric, fast) failed" << endl;
+		}
+
+		RReconstruction<PID_integer, FastMaxQRationalReconstruction<PID_integer> > RR2_3(Z,GEOMETRIC,0,5);
+		RationalRemainder2< VarPrecEarlySingleCRA< Modular<double> >,
+		RReconstruction<PID_integer, FastMaxQRationalReconstruction<PID_integer> > > cra2_3(4UL, RR2_3);
+		cra2_3(a2_3,b2_3,iteration,genprime);
+		if ((a2_3 != num)  || (b2_3 != den) ) {
+			ret = false;
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+			<< "ERROR: rational reconstruction (MaxQ, geometric, fast) failed" << endl;
+		}
+
+		RReconstruction<PID_integer, ClassicRationalReconstruction<PID_integer> > RR3_3(RRB1,GEOMETRIC,0,5);
+		RationalRemainder2< VarPrecEarlySingleCRA< Modular<double> >,
+		RReconstruction<PID_integer, ClassicRationalReconstruction<PID_integer> > > cra3_3(4UL, RR3_3);
+		cra3_3(a3_3,b3_3,iteration,genprime);
+		if ((a3_3 != num)  || (b3_3 != den) ) {
+			ret = false;
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+			<< "ERROR: rational reconstruction (Wang, geometric, classic) failed" << endl;
+		}
+
+		RReconstruction<PID_integer, ClassicMaxQRationalReconstruction<PID_integer> > RR4_3(RRB2,GEOMETRIC,0,5);
+		RationalRemainder2< VarPrecEarlySingleCRA< Modular<double> >,
+		RReconstruction<PID_integer, ClassicMaxQRationalReconstruction<PID_integer> > > cra4_3(4UL, RR4_3);
+		cra4_3(a4_3,b4_3,iteration,genprime);
+		if ((a4_3 != num)  || (b4_3 != den) ) {
+			ret = false;
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+			<< "ERROR: rational reconstruction (MaxQ, geometric, classic) failed" << endl;
+		}
+
+		size_t H = (n > d) ? n : d;
+		H /= bits;
+		++H;
+		H *=2;
+		++H;
+		RReconstruction<PID_integer, FastRationalReconstruction<PID_integer> > RR1_4(Z,CERTIFIED,0,H);
+		RationalRemainder2< VarPrecEarlySingleCRA< Modular<double> >,
+		RReconstruction<PID_integer, FastRationalReconstruction<PID_integer> > > cra1_4(4UL, RR1_4);
+		cra1_4(a1_4,b1_4,iteration,genprime);
+		if ((a1_4 != num)  || (b1_4 != den) ) {
+			ret = false;
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+			<< "ERROR: rational reconstruction (Wang, certified, fast) failed" << endl;
+		}
+
+		//RReconstruction<PID_integer, FastMaxQRationalReconstruction<PID_integer> > RR2_4(Z,CERTIFIED);
+		RReconstruction<PID_integer, ClassicRationalReconstruction<PID_integer> > RR3_4(RRB1,CERTIFIED,0,H);
+		RationalRemainder2< VarPrecEarlySingleCRA< Modular<double> >,
+		RReconstruction<PID_integer, ClassicRationalReconstruction<PID_integer> > > cra3_4(4UL, RR3_4);
+		cra3_4(a3_4,b3_4,iteration,genprime);
+		if ((a3_4 != num)  || (b3_4 != den) ) {
+			ret = false;
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+			<< "ERROR: rational reconstruction (Wang, certified, classic) failed" << endl;
+		}
+
+		//RReconstruction<PID_integer, ClassicMaxQRationalReconstruction<PID_integer> > RR4_4(RRB2,CERTIFIED);
+
+		commentator.stop ("done");
+		commentator.progress ();
+		//commentator.progress (i, iterations);
+	}
+
+	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testRationalDeterminantGeneric");
+
+	return ret;
+}
+
+
+int main (int argc, char **argv)
+{
+	bool pass = true;
+
+	static size_t n = 5;
+	//static integer q = 4093U;
+	static int iterations = 2;
+
+	static Argument args[] = {
+		{ 'n', "-n N", "Set size of test numerator/denominator to N", TYPE_INT,     &n },
+		{ 'i', "-i I", "Perform each test for I iterations", TYPE_INT,     &iterations },
+		END_OF_ARGUMENTS
+	};
+
+	parseArguments (argc, argv, args);
+	//Modular<int> F (q);
+
+	commentator.start("Rational reconstruction test suite", "rr");
+
+	// Make sure some more detailed messages get printed
+	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
+	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
+
+	if (!testRandomFraction          (n, n,iterations)) pass = false;
+
+	commentator.stop("Rational reconstruction test suite");
+	return pass ? 0 : -1;
+}
diff --git a/tests/test-rational-solver-adaptive.C b/tests/test-rational-solver-adaptive.C
index dcd4438..bd96656 100644
--- a/tests/test-rational-solver-adaptive.C
+++ b/tests/test-rational-solver-adaptive.C
@@ -1,8 +1,36 @@
-/* -*- mode:C++ -*- */
-/* File: test-rational-solver.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
+/* Copyright (C) LinBox
+ *
  * Author: Zhendong Wan
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
 
+
+
+/*! @file  tests/test-rational-solver-adaptive.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test no doc.
+ */
+
+
+
 #include <linbox/field/PID-integer.h>
 #include <linbox/blackbox/dense.h>
 #include <linbox/blackbox/diagonal.h>
@@ -11,25 +39,27 @@
 #include "test-common.h"
 #include "linbox/vector/stream.h"
 #include "linbox/util/commentator.h"
+using namespace LinBox; // fragile
 
 /// Testing Nonsingular Random Diagonal solve.
 template <class Ring, class Field, class Vector>
 bool testRandomSolve (const Ring& R,
 		      const Field& f,
 		      LinBox::VectorStream<Vector>& stream1,
-		      LinBox::VectorStream<Vector>& stream2) {
+		      LinBox::VectorStream<Vector>& stream2)
+{
+
 
-	
 	std::ostringstream str;
-	
-	
+
+
 
 	commentator.start ("Testing Nonsingular Random Diagonal solve ", "testNonsingularRandomDiagonalSolve");
 
 	bool ret = true;
 
         bool iter_passed = true;
-	
+
 	VectorDomain<Ring> VD (R);
 
 	Vector d, b, x, y;
@@ -42,13 +72,13 @@ bool testRandomSolve (const Ring& R,
 	int n = d. size();
 
 	while (stream1 && stream2) {
-        
+
 		commentator.startIteration (stream1.j ());
-                                                                                                        
+
                 //ActivityState state = commentator.saveActivityState ();
-                                                                                                        
+
                 iter_passed = true;
-                
+
 		bool zeroEntry;
 		do {
 		  stream1.next (d);
@@ -56,40 +86,40 @@ bool testRandomSolve (const Ring& R,
 		  for (size_t i=0; i<stream1.n(); i++)
 		    zeroEntry |= R.isZero(d[i]);
 		} while (zeroEntry);
-		
+
                 stream2.next (b);
-                                                                                                        
+
                 std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
                 report << "Diagonal entries: ";
                 VD.write (report, d);
                 report << endl;
-                                                                                                        
+
                 report << "Right-hand side:  ";
                 VD.write (report, b);
                 report << endl;
 
-                //Diagonal<Ring> D(R, d);                                                                               
-		
+                //Diagonal<Ring> D(R, d);
+
 		DenseMatrix<Ring> D(R, n, n);
-	 
+
 		for(int i = 0; i < n; ++i) R.init (D[i][i],  d[i]);
-						
+
 		typedef RationalSolverAdaptive RSolver;
 		RSolver rsolver;
- 
+
 		//std::vector<std::pair<typename Ring::Element, typename Ring::Element> > answer(n);
 		std::vector<typename Ring::Element> num(n);
 		typename Ring::Element den;
- 
+
 		SolverReturnStatus solveResult = rsolver.solveNonsingular(num, den, D, b); //often 5 primes are not enough
-		
+
 		/*
 		typename Ring::Element lden;
 
 		R. init (lden, 1);
 
 		typename std::vector<std::pair<typename Ring::Element, typename Ring::Element> >::iterator p;
-		
+
 		for (p = answer.begin(); p != answer.end(); ++ p)
 			R. lcm (lden, lden, p->second);
 		typename Vector::iterator p_x;
@@ -98,22 +128,22 @@ bool testRandomSolve (const Ring& R,
 
 		if (solveResult == SS_OK) {
 		/*
-		  for (p = answer.begin(), p_x = x. begin(); 
+		  for (p = answer.begin(), p_x = x. begin();
 		       p != answer.end();
 		       ++ p, ++ p_x) {
-		    
+
 		    R. mul (*p_x, p->first, lden);
-		    
+
 		    R. divin (*p_x, p->second);
-		    
+
 		  }
-		  
+
 		  D. apply (y, x);
 		  */
 		  D. apply (y, num);
-		  
+
 		  VD. mulin(b, den);
-		  
+
 		  if (!VD.areEqual (y, b)) {
 		    ret = iter_passed = false;
 		    commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
@@ -123,55 +153,57 @@ bool testRandomSolve (const Ring& R,
 		else {
 		    ret = iter_passed = false;
 		    commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-		      << "ERROR: Did not return OK solving status" << endl;		  
+		      << "ERROR: Did not return OK solving status" << endl;
 		}
-		
+
 		commentator.stop ("done");
                 commentator.progress ();
-		
+
 	}
 
-	
+
 	stream1.reset ();
         stream2.reset ();
-	
+
         commentator.stop (MSG_STATUS (ret), (const char *) 0, "testNonsingularRandomDiagonalSolve");
 
 	return ret;
-}	
+}
 
-int main(int argc, char** argv) {
+int main(int argc, char** argv)
+{
 
 	bool pass = true;
- 
+
         static size_t n = 10;
-                
+
 	static int iterations = 1;
- 
+
         static Argument args[] = {
                 { 'n', "-n N", "Set order of test matrices to N.", TYPE_INT, &n },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT, &iterations },
-		{ '\0' }
+		END_OF_ARGUMENTS
         };
 
 
 	parseArguments (argc, argv, args);
-	
-	typedef Modular<LinBox::int32> Field;
-	
+
+	typedef Modular<int32_t> Field;
+	// typedef Modular<double> Field;
+
 	typedef PID_integer     Ring;
 
 	Ring R;
 
 	Field F(101);
-	
+
 	RandomDenseStream<Ring> s1 (R, n, iterations), s2 (R, n, iterations);
 
 
 
 	if (!testRandomSolve(R, F, s1, s2)) pass = false;
-	
+
 	return pass ? 0 : -1;
-	
+
 }
 
diff --git a/tests/test-rational-solver.C b/tests/test-rational-solver.C
index 2ecd908..8a825f4 100644
--- a/tests/test-rational-solver.C
+++ b/tests/test-rational-solver.C
@@ -1,8 +1,35 @@
-/* -*- mode:C++ -*- */
-/* File: test-rational-solver.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
+/* Copyright (C) LinBox
+ *
  * Author: Zhendong Wan
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
 
+
+/*! @file  tests/test-rational-solver.C
+ * @ingroup tests
+ * @brief no doc.
+ * @test no doc.
+ */
+
+
+
 #include <linbox/field/PID-integer.h>
 #include <linbox/field/modular-int32.h>
 #include <linbox/blackbox/dense.h>
@@ -13,22 +40,24 @@
 #include "test-common.h"
 #include "linbox/vector/stream.h"
 #include "linbox/util/commentator.h"
+using namespace LinBox;
 
 /// Testing Nonsingular Random Diagonal solve.
 template <class Ring, class Field, class Vector>
 bool testRandomSolve (const Ring& R,
 		      const Field& f,
 		      LinBox::VectorStream<Vector>& stream1,
-		      LinBox::VectorStream<Vector>& stream2) {
+		      LinBox::VectorStream<Vector>& stream2)
+{
 
 	std::ostringstream str;
-	
+
 	commentator.start ("Testing Nonsingular Random Diagonal solve ","testNonsingularRandomDiagonalSolve", stream1.size());// "testNonsingularRandomMatrixSolve", stream1.m ());
 
 	bool ret = true;
 
         bool iter_passed = true;
-	
+
 	VectorDomain<Ring> VD (R);
 
 	Vector d, b, x, y;
@@ -41,13 +70,13 @@ bool testRandomSolve (const Ring& R,
 	int n = d. size();
 
 	while (stream1 && stream2) {
-        
+
 		commentator.startIteration (stream1.j ());
-                                                                                                        
+
                 //ActivityState state = commentator.saveActivityState ();
-                                                                                                        
+
                 iter_passed = true;
-                
+
 		bool zeroEntry;
 		do {
 		  stream1.next (d);
@@ -55,40 +84,40 @@ bool testRandomSolve (const Ring& R,
 		  for (size_t i=0; i<stream1.n(); i++)
 		    zeroEntry |= R.isZero(d[i]);
 		} while (zeroEntry);
-		
+
                 stream2.next (b);
-                                                                                                        
+
                 std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
                 report << "Diagonal entries: ";
                 VD.write (report, d);
                 report << endl;
-                                                                                                        
+
                 report << "Right-hand side:  ";
                 VD.write (report, b);
                 report << endl;
 
-                //Diagonal<Ring> D(R, d);                                                                               
-		
+                //Diagonal<Ring> D(R, d);
+
 		DenseMatrix<Ring> D(R, n, n);
-	 
+
 		for(int i = 0; i < n; ++i) R.init (D[i][i],  d[i]);
-						
+
 		typedef RationalSolver<Ring, Field, LinBox::RandomPrimeIterator> RSolver;
 		RSolver rsolver;
- 
+
 		//std::vector<std::pair<typename Ring::Element, typename Ring::Element> > answer(n);
 		std::vector<typename Ring::Element> num(n);
 		typename Ring::Element den;
- 
+
 		SolverReturnStatus solveResult = rsolver.solve(num, den, D, b, 30); //often 5 primes are not enough
-		
+
 		/*
 		typename Ring::Element lden;
 
 		R. init (lden, 1);
 
 		typename std::vector<std::pair<typename Ring::Element, typename Ring::Element> >::iterator p;
-		
+
 		for (p = answer.begin(); p != answer.end(); ++ p)
 			R. lcm (lden, lden, p->second);
 		typename Vector::iterator p_x;
@@ -97,22 +126,22 @@ bool testRandomSolve (const Ring& R,
 
 		if (solveResult == SS_OK) {
 		/*
-		  for (p = answer.begin(), p_x = x. begin(); 
+		  for (p = answer.begin(), p_x = x. begin();
 		       p != answer.end();
 		       ++ p, ++ p_x) {
-		    
+
 		    R. mul (*p_x, p->first, lden);
-		    
+
 		    R. divin (*p_x, p->second);
-		    
+
 		  }
-		  
+
 		  D. apply (y, x);
 		  */
 		  D. apply (y, num);
-		  
+
 		  VD. mulin(b, den);
-		  
+
 		  if (!VD.areEqual (y, b)) {
 		    ret = iter_passed = false;
 		    commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
@@ -122,54 +151,56 @@ bool testRandomSolve (const Ring& R,
 		else {
 		    ret = iter_passed = false;
 		    commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-		      << "ERROR: Did not return OK solving status" << endl;		  
+		      << "ERROR: Did not return OK solving status" << endl;
 		}
-		
+
 		commentator.stop ("done");
                 commentator.progress ();
-		
+
 	}
 
-	
+
 	stream1.reset ();
         stream2.reset ();
-	
+
         commentator.stop (MSG_STATUS (ret), (const char *) 0, "testNonsingularRandomDiagonalSolve");
 
 	return ret;
-}	
+}
+
+int main(int argc, char** argv)
+{
 
-int main(int argc, char** argv) {
 
-	
 	bool pass = true;
- 
+
         static size_t n = 10;
-                
+
 	static int iterations = 1;
- 
+
         static Argument args[] = {
                 { 'n', "-n N", "Set order of test matrices to N.", TYPE_INT, &n},
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT, &iterations },
-		{ '\0' }
+		END_OF_ARGUMENTS
         };
 
 
 	parseArguments (argc, argv, args);
-	
-	typedef Modular<LinBox::int32> Field;
-	
+
+	typedef Modular<int32_t> Field;
+	// typedef Modular<double> Field;
+
 	typedef PID_integer     Ring;
 
 	Ring R;
 
 	Field F(101);
-	
+
 	RandomDenseStream<Ring> s1 (R, n, iterations), s2 (R, n, iterations);
 
 	if (!testRandomSolve(R, F, s1, s2)) pass = false;
-	
+
 	return pass ? 0 : -1;
-	
+
 }
 
diff --git a/tests/test-scalar-matrix.C b/tests/test-scalar-matrix.C
index 114e7f7..8694dde 100644
--- a/tests/test-scalar-matrix.C
+++ b/tests/test-scalar-matrix.C
@@ -1,9 +1,36 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* tests/test-scalar-matrix.C
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) LinBox
+ *
+ *
  * using generic testBlackbox  -bds
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+/*! @file  tests/test-scalar-matrix.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test no doc.
  */
 
+
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -19,8 +46,6 @@ using namespace LinBox;
 
 int main (int argc, char **argv)
 {
-	ofstream report;
-
 	bool pass = true;
 
 	static size_t n = 20;
@@ -31,7 +56,7 @@ int main (int argc, char **argv)
 		{ 'n', "-n N", "Set dimension of test matrices to NxN.", TYPE_INT,     &n },
 		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
@@ -40,10 +65,10 @@ int main (int argc, char **argv)
 
 	commentator.start("Scalar black box test suite", "Scalar");
 
-	typedef Modular<uint32> Field;
+	typedef Modular<uint32_t> Field;
 
 	Field F (q);
-	Field::Element d; 
+	Field::Element d;
 	F.init (d, -1);
 
 	typedef ScalarMatrix <Field> Blackbox;
diff --git a/tests/test-smith-form-adaptive.C b/tests/test-smith-form-adaptive.C
old mode 100755
new mode 100644
index dd192e1..e8fcd62
--- a/tests/test-smith-form-adaptive.C
+++ b/tests/test-smith-form-adaptive.C
@@ -1,179 +1,211 @@
-/*
+/* -*- 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
+/* Copyright (C) LinBox
+ *
  *  Author: Zhendong Wan
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
 
-#include <linbox/field/ntl-ZZ.h>
+
+/*! @file  tests/test-smith-form-adaptive.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test no doc.
+ */
+
+
+
+
+//#include <linbox/field/ntl-ZZ.h>
 #include <linbox/field/PID-integer.h>
 #include <time.h>
 #include <linbox/randiter/random-prime.h>
 #include <linbox/util/commentator.h>
 #include <linbox/vector/stream.h>
-#include "test-common.h"
-#include <linbox/blackbox/dense.h>
 #include <linbox/algorithms/smith-form-adaptive.h>
+#include <linbox/blackbox/dense.h>
+#include "test-common.h"
+using namespace LinBox; // fragile
 
 
 template <class Ring, class SmithForm, class Vector>
-bool testRandom(const Ring& R, 
+bool testRandom(const Ring& R,
 		const SmithForm& SF,
-		LinBox::VectorStream<Vector>& stream1) {
- 
-	
+		LinBox::VectorStream<Vector>& stream1)
+{
+
+
 	std::ostringstream str;
-        
+
 	str << "Testing the adaptive algorithm for Smith form computation:\n";
 
-        commentator.start (str.str ().c_str (), "testRandom");//, stream1.m ());
+	commentator.start (str.str ().c_str (), "testRandom");//, stream1.m ());
 
-        bool ret = true;
-        bool iter_passed = true;
+	bool ret = true;
+	bool iter_passed = true;
 
-        VectorDomain<Ring> VD (R);
+	VectorDomain<Ring> VD (R);
 
 	Vector d, x;
-	
+
 	VectorWrapper::ensureDim (d, stream1.n ());
-	
+
 	VectorWrapper::ensureDim (x, stream1.n ());
 
-	
+
 	int n = d. size();
 
-	 while (stream1) {
-                                                                                                        
-                commentator.startIteration (stream1.j ());
-                                                                                                        
-		std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);  
+	while (stream1) {
 
-                iter_passed = true;
-                                                                                                        
-                stream1.next (d);
+		commentator.startIteration (stream1.j ());
+
+		std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+
+		iter_passed = true;
+
+		stream1.next (d);
 
 		report << "Input vector:  ";
 		VD.write (report, d);
-                report << endl;
+		report << endl;
 
 		DenseMatrix<Ring> D(R, n, n), L(R, n, n), U(R, n, n), A(R,n,n);
 
 		int i, j;
 
-		for(i = 0; i < n; ++i) { 
-			R. assign (D[i][i], d[i]); 
+		for(i = 0; i < n; ++i) {
+			R. assign (D[i][i], d[i]);
 			R. init (L[i][i], 1);
 			R. init (U[i][i], 1);}
-		
-		for (i = 0; i < n; ++ i) 
-		
-			for (j = 0; j < i; ++ j) {
-				
-				R.init(L[i][j], rand() % 10);
-				
-				R.init(U[j][i], rand() % 10);
-			}
-	
-	
-		std::vector<typename Ring::Element> tmp1(n), tmp2(n), e(n);
-		
-		typename DenseMatrix<Ring>::ColIterator col_p;
-
-		i = 0;
-		for (col_p = A.colBegin(); 
-		     col_p != A.colEnd(); ++ col_p, ++ i) {
-			
-			R.init(e[i],1);
-			U.apply(tmp1, e);
-			D.apply(tmp2, tmp1);
-			L.apply(*col_p, tmp2);
-			R.init(e[i],0);
-		}
-
-		
-		
-		std::vector<integer> xi(A. rowdim());
-
-		SF.smithForm (xi, A);
-		typename Vector::iterator x_p; std::vector<integer>::iterator xi_p;
-		for (x_p = x. begin(), xi_p = xi. begin(); x_p != x. end(); ++ x_p, ++ xi_p)
-			A. field (). init (*x_p, *xi_p);
-       
-		
-		report << "Computed Smith form: \n";
-		
-		VD. write (report, x);
-		
-		report << '\n';
-	
-				
-		typename std::vector<typename Ring::Element>::iterator p1, p2;
-		typename Ring::Element g;
-		
-		
-		for (p1 = d.begin(); p1 != d.end(); ++ p1) {
-			
-			for ( p2 = p1 + 1; p2 != d.end(); ++ p2) {
-				
-				if (R. isUnit(*p1))  break;
- 
-				else if (R. isZero (*p2)) continue;
-				
-				else if (R. isZero (*p1)) {
-                                                std::swap (*p1, *p2);
+
+			for (i = 0; i < n; ++ i)
+
+				for (j = 0; j < i; ++ j) {
+
+					R.init(L[i][j], rand() % 10);
+
+					R.init(U[j][i], rand() % 10);
 				}
-				
-				else {
-					R. gcd (g, *p1, *p2);
-					
-					R. divin (*p2, g);
-					
-					R. mulin (*p2, *p1);
-					
-					R. assign (*p1, g);
+
+
+			std::vector<typename Ring::Element> tmp1(n), tmp2(n), e(n);
+
+			typename DenseMatrix<Ring>::ColIterator col_p;
+
+			i = 0;
+			for (col_p = A.colBegin();
+			     col_p != A.colEnd(); ++ col_p, ++ i) {
+
+				R.init(e[i],1);
+				U.apply(tmp1, e);
+				D.apply(tmp2, tmp1);
+				L.apply(*col_p, tmp2);
+				R.init(e[i],0);
+			}
+
+
+
+			std::vector<integer> xi(A. rowdim());
+
+			SF.smithForm (xi, A);
+			typename Vector::iterator x_p; std::vector<integer>::iterator xi_p;
+			for (x_p = x. begin(), xi_p = xi. begin(); x_p != x. end(); ++ x_p, ++ xi_p)
+				A. field (). init (*x_p, *xi_p);
+
+
+			report << "Computed Smith form: \n";
+
+			VD. write (report, x);
+
+			report << '\n';
+
+
+			typename std::vector<typename Ring::Element>::iterator p1, p2;
+			typename Ring::Element g;
+
+
+			for (p1 = d.begin(); p1 != d.end(); ++ p1) {
+
+				for ( p2 = p1 + 1; p2 != d.end(); ++ p2) {
+
+					if (R. isUnit(*p1))  break;
+
+					else if (R. isZero (*p2)) continue;
+
+					else if (R. isZero (*p1)) {
+						std::swap (*p1, *p2);
+					}
+
+					else {
+						R. gcd (g, *p1, *p2);
+
+						R. divin (*p2, g);
+
+						R. mulin (*p2, *p1);
+
+						R. assign (*p1, g);
+					}
 				}
 			}
-		}
-		
 
-		report << "Expected smith form:\n";
-		
-		VD.write (report, d);
 
-		report << '\n';
+			report << "Expected smith form:\n";
+
+			VD.write (report, d);
+
+			report << '\n';
+
+			if (!VD.areEqual (d, x))
+
+				ret = iter_passed = false;
+
+			if (!iter_passed)
 
-		if (!VD.areEqual (d, x))
-			
-			ret = iter_passed = false;
-		
-                if (!iter_passed) 
-			
-                        commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+				commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
 				<< "ERROR: Computed Smith form is incorrect" << endl;
-			
-		
 
-                commentator.stop ("done");
 
-                commentator.progress ();
-		
-	 }
-	 
-	 //stream1.reset ();
-	  	  
-	  commentator.stop (MSG_STATUS (ret), (const char *) 0, "testRandom");
-                                                                                                        
-	  return ret;
+
+			commentator.stop ("done");
+
+			commentator.progress ();
+
+	}
+
+	//stream1.reset ();
+
+	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testRandom");
+
+	return ret;
 
 }
 
-int main(int argc, char** argv) {
-                                                                                                        
+int main(int argc, char** argv)
+{
+
 	bool pass = true;
-	static size_t n = 35; 
+	static size_t n = 35;
 	static int iterations = 1;
 	static Argument args[] = {
 		{ 'n', "-n N", "Set order of test matrices to N.", TYPE_INT,  &n },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT, &iterations },
-		{ '\0' }
-		};
+		END_OF_ARGUMENTS
+	};
 
 	parseArguments (argc, argv, args);
 	SmithFormAdaptive sf;
@@ -181,15 +213,16 @@ int main(int argc, char** argv) {
 	commentator.start("Smith form adaptive algorithm test suite", "EGV++");
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (5);
 
-	typedef NTL_ZZ Ring; Ring R;
+	//typedef NTL_ZZ Ring; Ring R;
+	typedef PID_integer Ring; Ring R;
 	RandomDenseStream<Ring> s1 (R, n, iterations);
-	pass = testRandom(R, sf, s1); 
+	pass = testRandom(R, sf, s1);
 
 	typedef PID_integer Ring2; Ring2 S;
 	RandomDenseStream<Ring2> s2 (S, n, iterations);
-	pass = pass && testRandom(S, sf, s2); 
+	pass = pass && testRandom(S, sf, s2);
 
 	commentator.stop(MSG_STATUS(pass));
 	return pass ? 0 : -1;
-                                                                                                        
+
 }
diff --git a/tests/test-smith-form-binary.C b/tests/test-smith-form-binary.C
old mode 100755
new mode 100644
index fb679d3..29de3d9
--- a/tests/test-smith-form-binary.C
+++ b/tests/test-smith-form-binary.C
@@ -1,8 +1,40 @@
-/** File: test-smith-form.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
+/* Copyright (C) LinBox
+ *
+ *
  *  Author: Zhendong Wan
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
 
+
+/*! @file  tests/test-smith-form-binary.C
+ * @ingroup tests
+ * @brief no doc.
+ * @test no doc.
+ */
+
+
+
+
 #include <linbox/field/PID-integer.h>
+#ifdef __LINBOX_HAVE_NTL
+#include "linbox/field/ntl-ZZ.h"
+#endif
 #include <linbox/field/modular-int32.h>
 #include <linbox/randiter/random-prime.h>
 #include <linbox/blackbox/dense.h>
@@ -15,19 +47,19 @@
 #include <linbox/algorithms/rational-solver.h>
 #include <time.h>
 
-
-
 #include <linbox/util/commentator.h>
 #include <linbox/vector/stream.h>
 #include "test-common.h"
+using namespace LinBox;
 
 template <class Ring, class SmithForm, class Vector>
-bool testRandom(const Ring& R, 
+bool testRandom(const Ring& R,
 		const SmithForm& SF,
-		LinBox::VectorStream<Vector>& stream1) {
+		LinBox::VectorStream<Vector>& stream1)
+{
 
     std::ostringstream str;
-        
+
 	str << "Testing Smith Form binary(EGV++):";
 
         commentator.start (str.str ().c_str (), "testSmithform");//, stream1.m ());
@@ -38,22 +70,22 @@ bool testRandom(const Ring& R,
         LinBox::VectorDomain<Ring> VD (R);
 
 	Vector d, x;
-	
+
 	VectorWrapper::ensureDim (d, stream1.n ());
-	
+
 	VectorWrapper::ensureDim (x, stream1.n ());
 
-	
+
 	int n = d. size();
 
 	 while (stream1) {
-                                                                                                        
+
                 commentator.startIteration (stream1.j ());
-                                                                                                        
-		std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);  
+
+		std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
 
                 iter_passed = true;
-                                                                                                        
+
                 stream1.next (d);
 
 		report << "Input vector:  ";
@@ -64,29 +96,29 @@ bool testRandom(const Ring& R,
 
 		int i, j;
 
-		for(i = 0; i < n; ++i) { 
-			R. assign (D[i][i], d[i]); 
+		for(i = 0; i < n; ++i) {
+			R. assign (D[i][i], d[i]);
 			R. init (L[i][i], 1);
 			R. init (U[i][i], 1);}
-		
-		for (i = 0; i < n; ++ i) 
-		
+
+		for (i = 0; i < n; ++ i)
+
 			for (j = 0; j < i; ++ j) {
-				
+
 				R.init(L[i][j], rand() % 10);
-				
+
 				R.init(U[j][i], rand() % 10);
 			}
-	
-	
+
+
 		std::vector<typename Ring::Element> tmp1(n), tmp2(n), e(n);
-		
+
 		typename DenseMatrix<Ring>::ColIterator col_p;
 
 		i = 0;
-		for (col_p = A.colBegin(); 
+		for (col_p = A.colBegin();
 		     col_p != A.colEnd(); ++ col_p, ++ i) {
-			
+
 			R.init(e[i],1);
 			U.apply(tmp1, e);
 			D.apply(tmp2, tmp1);
@@ -94,124 +126,149 @@ bool testRandom(const Ring& R,
 			R.init(e[i],0);
 		}
 
-		
-		
+
+
 		SF.smithFormBinary (x, A);
-       
-		
+
+
 		report << "Computed Smith form: \n";
-		
+
 		VD. write (report, x);
-		
+
 		report << '\n';
-	
-				
+
+
 		typename std::vector<typename Ring::Element>::iterator p1, p2;
 		typename Ring::Element g;
-		
-		
+
+
 		for (p1 = d.begin(); p1 != d.end(); ++ p1) {
-			
+
 			for ( p2 = p1 + 1; p2 != d.end(); ++ p2) {
-				
+
 				if (R. isUnit(*p1))  break;
- 
+
 				else if (R. isZero (*p2)) continue;
-				
+
 				else if (R. isZero (*p1)) {
                                                 std::swap (*p1, *p2);
 				}
-				
+
 				else {
 					R. gcd (g, *p1, *p2);
-					
+
 					R. divin (*p2, g);
-					
+
 					R. mulin (*p2, *p1);
-					
+
 					R. assign (*p1, g);
 				}
 			}
 		}
-		
+
 
 		report << "Expected smith form:\n";
-		
+
 		VD.write (report, d);
 
 		report << '\n';
 
 		if (!VD.areEqual (d, x))
-			
+
 			ret = iter_passed = false;
-		
-                if (!iter_passed) 
-			
+
+                if (!iter_passed)
+
                         commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
 				<< "ERROR: Computed Smith form is incorrect" << endl;
-			
-		
+
+
 
                 commentator.stop ("done");
 
                 commentator.progress ();
-		
+
 	 }
-	 
+
 	 //stream1.reset ();
-	  	  
+
 	  commentator.stop (MSG_STATUS (ret), (const char *) 0, "testSmithform");
-                                                                                                        
+
 	  return ret;
 
 }
 
-int main(int argc, char** argv) {
-                                                                                                         
-        bool pass = true;
-                                                                                                        
-        static size_t n =5; 
-                                                                                                        
-        static int iterations = 1;
-                                                                                                        
-        static Argument args[] = {
-            { 'n', "-n N", "Set order of test matrices to N.", TYPE_INT,     &n },
-            { 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
-			{ '\0' }
-        };
-                                                                                                        
-                                                                                                        
-        parseArguments (argc, argv, args);
-                                                                                                        
-       	typedef PID_integer Ring;
-                                                                                              
-        Ring R;
+int main(int argc, char** argv)
+{
+
+	bool pass = true;
+
+	static size_t n =5;
+
+	static int iterations = 1;
+
+	static Argument args[] = {
+		{ 'n', "-n N", "Set order of test matrices to N.", TYPE_INT,     &n },
+		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
+		END_OF_ARGUMENTS
+	};
+
+	parseArguments (argc, argv, args);
 
 	commentator.start("SmithFormBinary test suite", "SmithFormBinary");
+	std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+
+	{
+		typedef PID_integer Ring;
+
+		Ring R;
+
+		report << std::endl << "EGV++ algorithm test suite with LinBox/Givaro PID:\n";
+
+		commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (5);
+
+		RandomDenseStream<Ring> s1 (R, n, iterations);
+
+		typedef Modular<int32_t> Field;
+		typedef RationalSolver<Ring, Field, LinBox::RandomPrimeIterator> Solver;
+		typedef LastInvariantFactor<Ring, Solver> LIF;
+		typedef OneInvariantFactor<Ring, LIF, SCompose, RandomMatrix>  OIF;
+		typedef SmithFormBinary<Ring, OIF, MatrixRank<Ring, Field > > SF;
 
-        commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (5);
+		SF sf;
+		sf. setOIFThreshold (30);
+		sf. setLIFThreshold (30);
 
-        RandomDenseStream<Ring> s1 (R, n, iterations);
+		if (!testRandom(R, sf, s1)) pass = false;
+	}
 
-	typedef Modular<LinBox::int32> Field;
+#if 0
+//#ifdef __LINBOX_HAVE_NTL
+// NTL_ZZ not working here
+	{
+		typedef NTL_ZZ Ring;
 
-	typedef RationalSolver<Ring, Field, LinBox::RandomPrimeIterator> Solver;
+		Ring R;
 
-	typedef LastInvariantFactor<Ring, Solver> LIF;
+		report << std::endl << "EGV++ algorithm test suite with NTL_ZZ :\n";
+		commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (5);
 
-	typedef OneInvariantFactor<Ring, LIF, SCompose, RandomMatrix>  OIF;
+		RandomDenseStream<Ring> s1 (R, n, iterations);
 
-	typedef SmithFormBinary<Ring, OIF, MatrixRank<Ring, Field > > SF;
+		typedef Modular<int32_t> Field;
+		typedef RationalSolver<Ring, Field, LinBox::RandomPrimeIterator> Solver;
+		typedef LastInvariantFactor<Ring, Solver> LIF;
+		typedef OneInvariantFactor<Ring, LIF, SCompose, RandomMatrix>  OIF;
+		typedef SmithFormBinary<Ring, OIF, MatrixRank<Ring, Field > > SF;
 
-	SF sf;
-	
-	sf.  setOIFThreshold (30);
+		SF sf;
+		sf. setOIFThreshold (30);
+		sf. setLIFThreshold (30);
 
-	sf. setLIFThreshold  (30);
+		if (!testRandom(R, sf, s1)) pass = false;
+	}
+#endif
 
-	if (!testRandom(R, sf, s1)) pass = false;
-                                                                                                        
 	commentator.stop("SmithFormBinary test suite");
-        return pass ? 0 : -1;
-                                                                                                        
+	return pass ? 0 : -1;
 }
diff --git a/tests/test-smith-form-iliopoulos.C b/tests/test-smith-form-iliopoulos.C
old mode 100755
new mode 100644
index ea6c0cb..1add3e2
--- a/tests/test-smith-form-iliopoulos.C
+++ b/tests/test-smith-form-iliopoulos.C
@@ -1,5 +1,31 @@
-/** File: test-iliopoulos-elimination.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
+/* Copyright (C) LinBox
+ *
  *  Author: Zhendong Wan
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+
+/*! @file   tests/test-smith-form-iliopoulos.C
+ * @ingroup tests
+ * @brief no doc.
+ * @test no doc.
  */
 
 
@@ -19,44 +45,47 @@
 #include "test-common.h"
 #include <linbox/algorithms/matrix-hom.h>
 
-#define int32 LinBox::int32
+#ifndef __LINBOX_HAVE_NTL
+#error "you can't compile this test without NTL enabled. Please make sure you configured Linbox with --with-ntl=path/to/ntl"
+#endif
 
 using namespace LinBox;
 
 template <class Ring, class Vector>
-bool testRandom(const Ring& R, 
-		LinBox::VectorStream<Vector>& stream1) {
- 
+bool testRandom(const Ring& R,
+		LinBox::VectorStream<Vector>& stream1)
+{
+
 	using namespace std;
-	
+
 	ostringstream str;
-        
+
 	str << "Testing Iloipoulos elimination:";
 
         commentator.start (str.str ().c_str (), "testRandom", stream1.m ());
 
         bool ret = true;
-                                                                                                        
+
         bool iter_passed = true;
-                                                                                                        
+
         VectorDomain<Ring> VD (R);
 
 	Vector d, x;
-	
+
 	VectorWrapper::ensureDim (d, stream1.n ());
-	
+
 	VectorWrapper::ensureDim (x, stream1.n ());
-	
+
 	int n = d. size();
 
 	 while (stream1) {
-                                                                                                        
+
                 commentator.startIteration (stream1.j ());
-                                                                                                        
-		ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);  
+
+		ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
 
                 iter_passed = true;
-                                                                                                        
+
                 stream1.next (d);
 
 		report << "Input vector:  ";
@@ -68,24 +97,24 @@ bool testRandom(const Ring& R,
 		int i, j;
 
 		for(i = 0; i < n; ++i) { R. assign (D[i][i], d[i]); R. init (L[i][i], 1); R. init (U[i][i], 1);}
-		
-		for (i = 0; i < n; ++ i) 
-		
+
+		for (i = 0; i < n; ++ i)
+
 			for (j = 0; j < i; ++ j) {
-				
+
 				R.init(L[i][j], rand() % 10);
-				
+
 				R.init(U[j][i], rand() % 10);
 			}
-	
-	
+
+
 		std::vector<typename Ring::Element> tmp1(n), tmp2(n), e(n);
-		
+
 		typename DenseMatrix<Ring>::ColIterator col_p;
 
 		i = 0;
 		for (col_p = A.colBegin(); col_p != A.colEnd(); ++ col_p, ++ i) {
-			
+
 			R.init(e[i],1);
 			U.apply(tmp1, e);
 			D.apply(tmp2, tmp1);
@@ -93,182 +122,180 @@ bool testRandom(const Ring& R,
 			R.init(e[i],0);
 		}
 
-		
-		
+
+
 		typename Ring::Element s;
-		
+
 		R. init (s, 1);
 
 		typename Vector::iterator d_p;
 
 		for(d_p = d.begin(); d_p!= d.end(); ++ d_p)
-			
+
 			R. lcm (s, s, *d_p);
 
 		report << "Last Invariant factor: " ;
-		
+
 		R. write (report, s);
 
 		report << '\n';
-		
-		
+
+
 		if (s >= LINBOX_MAX_MODULUS) {
 
 			report << "Using PIR_ntl_ZZ_p\n";
-			
+
 			PIR_ntl_ZZ_p PIR(s);
-			
-			DenseMatrix<PIR_ntl_ZZ_p>* Ap;
-			
+
+			DenseMatrix<PIR_ntl_ZZ_p> Ap(PIR, A.rowdim(), A.coldim());
+
 			MatrixHom::map (Ap, A, PIR);
-			
-			SmithFormIliopoulos::smithFormIn (*Ap);
-			
+
+			SmithFormIliopoulos::smithFormIn (Ap);
+
 			report << "Computed Smith form: \n";
-			
+
 			for ( unsigned int i = 0; i < A. rowdim(); ++ i)
-				report << (*Ap)[i][i] << " ";
-			
+				report << Ap[i][i] << " ";
+
 			report << '\n';
-			
+
 			int i = 0;
-			
+
 			typename std::vector<typename Ring::Element>::iterator p1;
-			
-			
+
+
 			for (p1 = x. begin(); p1 != x. end(); ++ p1, ++ i) {
-				
-				if (PIR.isZero((*Ap)[i][i])) 
-					
+
+				if (PIR.isZero(Ap[i][i]))
+
 					R.assign (*p1, s);
-				
+
 				else
-					
-					R.assign (*p1, NTL::rep((*Ap)[i][i]));
+
+					R.assign (*p1, NTL::rep(Ap[i][i]));
 			}
-			delete Ap;
 		}
 
 		else {
 
-			report << "Using PIRModular<int32>\n";
-		
-			PIRModular<int32> PIR(s % LINBOX_MAX_MODULUS);
-			
-			DenseMatrix<PIRModular<int32> >* Ap;
-			
+			report << "Using PIRModular<int32_t>\n";
+
+			PIRModular<int32_t> PIR(s % LINBOX_MAX_MODULUS);
+
+			DenseMatrix<PIRModular<int32_t> > Ap(PIR, A.rowdim(), A.coldim());
+
 			MatrixHom::map (Ap, A, PIR);
-			
-			SmithFormIliopoulos::smithFormIn (*Ap);
-			
-			
+
+			SmithFormIliopoulos::smithFormIn (Ap);
+
+
 			report << "Computed Smith form: \n";
- 
+
 			for ( unsigned int i = 0; i < A. rowdim(); ++ i)
-				report << (*Ap)[i][i] << " ";
-			
+				report << Ap[i][i] << " ";
+
 			report << '\n';
-			
-			
+
+
 			typename std::vector<typename Ring::Element>::iterator p1;
 			int i = 0;
-			
+
 			for (p1 = x. begin(); p1 != x. end(); ++ p1, ++ i) {
-				
-				if (PIR.isZero((*Ap)[i][i]))
-					
+
+				if (PIR.isZero(Ap[i][i]))
+
 					R.assign (*p1, s);
-				
+
 				else
- 
-					R.init (*p1, (*Ap)[i][i]);
+
+					R.init (*p1, Ap[i][i]);
 			}
-			delete Ap;
-						
 		}
-			
+
 		typename std::vector<typename Ring::Element>::iterator p1, p2;
 
 		typename Ring::Element g;
-		
+
 		for (p1 = d.begin(); p1 != d.end(); ++ p1) {
-			
+
 			for ( p2 = p1 + 1; p2 != d.end(); ++ p2) {
-				
+
 				if (R. isUnit(*p1))  break;
- 
+
 				else if (R. isZero (*p2)) continue;
-				
+
 				else if (R. isZero (*p1)) {
                                                 std::swap (*p1, *p2);
 				}
-				
+
 				else {
 					R. gcd (g, *p1, *p2);
-					
+
 					R. divin (*p2, g);
-					
+
 					R. mulin (*p2, *p1);
-					
+
 					R. assign (*p1, g);
 				}
 			}
 		}
-		
+
 
 		report << "Expected smith form:\n";
-		
+
 		for (p1 = d.begin(); p1 != d.end(); ++ p1)
 			report << * p1 << " ";
 
 		report << '\n';
 
 		if (!VD.areEqual (d, x))
-			
+
 			ret = iter_passed = false;
-		
-                if (!iter_passed) 
-			
+
+                if (!iter_passed)
+
                         commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
 				<< "ERROR: Computed Smith form is incorrect" << endl;
-			
-		
+
+
 
                 commentator.stop ("done");
 
                 commentator.progress ();
-		
+
 	 }
-	 
+
 	 //stream1.reset ();
-	  	  
+
 	  commentator.stop (MSG_STATUS (ret), (const char *) 0, "testRandom");
-                                                                                                        
+
 	  return ret;
 
 }
 
-int main(int argc, char** argv) {
-                                                                                                        
+int main(int argc, char** argv)
+{
+
         using namespace LinBox;
-                                                                                                        
+
         bool pass = true;
-                                                                                                        
+
         static size_t n = 20;
-                                                                                                        
+
         static int iterations = 1;
-                                                                                                        
+
         static Argument args[] = {
                 { 'n', "-n N", "Set order of test matrices to N.", TYPE_INT,     &n },
                 { 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
-				{ '\0' }
+		END_OF_ARGUMENTS
         };
-                                                                                                        
-                                                                                                        
+
+
         parseArguments (argc, argv, args);
-                                                                                                        
+
         typedef NTL_ZZ      Ring;
-                                                                                                        
+
         Ring R;
 
 	commentator.start("Ilioloulos Smith Form test suite", "Ilioloulos");
@@ -276,10 +303,11 @@ int main(int argc, char** argv) {
         commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (5);
 
         RandomDenseStream<Ring> s1 (R, n, iterations);
-                                                                                                        
+
         if (!testRandom(R, s1)) pass = false;
-                                                                                                        
+
 	commentator.stop("Ilioloulos Smith Form test suite");
         return pass ? 0 : -1;
-                                                                                                        
+
 }
+
diff --git a/tests/test-smith-form-local.C b/tests/test-smith-form-local.C
index 549e3f3..f51b0d3 100644
--- a/tests/test-smith-form-local.C
+++ b/tests/test-smith-form-local.C
@@ -1,28 +1,36 @@
 /* -*- 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
 /* tests/test-local-smith.C
+ * Copyright (C) LinBox
  *
- * Written by David Saunders 
+ * Written by David Saunders
  *
  * --------------------------------------------------------
  * See COPYING for license information
  */
 
+
+/*! @file  tests/test-smith-form-local.C
+ * @ingroup tests
+ * @brief  no doc
+ * @test no doc.
+ */
+
+
+
 #include "linbox/linbox-config.h"
 
-#include <iostream>
-#include <fstream>
 #include <vector>
 #include <functional>
 
 #include "test-common.h"
 
 #include "linbox/util/commentator.h"
-#include "linbox/field/ntl-pid-lzz_p.h"
+#include "linbox/field/PIR-modular-int32.h"
+//#include "linbox/field/PIR-modular-double.h"
 #include "linbox/field/local2_32.h"
 #include "linbox/blackbox/dense.h"
 #include "linbox/algorithms/smith-form-local.h"
-#include "linbox/vector/stream.h"
 #include <linbox/matrix/matrix-domain.h>
 #include <linbox/util/timer.h>
 
@@ -39,210 +47,148 @@ using namespace LinBox;
  * Return true on success and false on failure
  */
 
-template <class LocalPID>
+template <class LocalPIR>
 class foobar {
-	public:
-	typedef typename LocalPID::Element first_argument_type;
-	typedef LocalPID second_argument_type;
+public:
+	typedef typename LocalPIR::Element first_argument_type;
+	typedef LocalPIR second_argument_type;
 	typedef void result_type;
-	void operator()(typename LocalPID::Element& d, const LocalPID& R) const
-	{ 
-		typename LocalPID::Element x = d;
-		R.gcd(d, x, x);
+	void operator()(typename LocalPIR::Element& d, const LocalPIR& R) const
+	{
+		typename LocalPIR::Element x; R.init(x, 2);  R.mulin(x, d);
+		if (R.isUnit(d)) R.divin(d, d);
+		else R.gcd(d, d, x);
 	}
 };
+
 template<>
 class foobar<LinBox::Local2_32> {
 public:
-	typedef LinBox::Local2_32 LocalPID;
-	
-	typedef LocalPID::Element first_argument_type;
-	typedef LocalPID second_argument_type;
+	typedef LinBox::Local2_32 LocalPIR;
+
+	typedef LocalPIR::Element first_argument_type;
+	typedef LocalPIR second_argument_type;
 	typedef void result_type;
-	void operator()(LocalPID::Element& d, const LocalPID& R) const
+	void operator()(LocalPIR::Element& d, const LocalPIR& R) const
 	{
-
-
 		if(d != 0)    {
-
 			int r = 1;
-
 			while ( !(d & 1) ) {
 				d >>= 1;
 				r <<= 1;
 			}
-
 			d = r;
 		}
-		
-	 
 	}
 };
-				
-template <class LocalPID>
-class pplt
-{   public:
-	pplt(LocalPID R) : _R_(R){}
-	bool operator() (typename LocalPID::Element a, typename LocalPID::Element b)
-	{  
-	       if ( b == 0 ) return true;
-       	       else if ( a == 0 ) return false;
-	       else return a <= b;
- 	}		
-    //protected:
-        LocalPID _R_;
+
+template <class LocalPIR>
+class pplt { // prime power less than
+public:
+	pplt(LocalPIR R) : _R_(R){}
+	bool operator() (typename LocalPIR::Element a, typename LocalPIR::Element b)
+	{
+		if ( b == 0 ) return true;
+		else if ( a == 0 ) return false;
+		else return a <= b;
+	}
+	//protected:
+	LocalPIR _R_;
 };
 
+#if 0
 template<>
 class pplt<LinBox::NTL_PID_zz_p> {
 public:
-	typedef LinBox::NTL_PID_zz_p LocalPID;
-	
-	pplt(LocalPID R) : _R_(R){}
-	bool operator() (LocalPID::Element a, LocalPID::Element b)
-	{  
-	       if ( b == 0 ) return true;
-       	       else if ( a == 0 ) return false;
-	       else return NTL::rep(a) <= NTL::rep(b);
- 	}		
-    //protected:
-        LocalPID _R_;
+	typedef LinBox::NTL_PID_zz_p LocalPIR;
+
+	pplt(LocalPIR R) : _R_(R){}
+	bool operator() (LocalPIR::Element a, LocalPIR::Element b)
+	{
+		if ( b == 0 ) return true;
+		else if ( a == 0 ) return false;
+		else return NTL::rep(a) <= NTL::rep(b);
+	}
+	//protected:
+	LocalPIR _R_;
 };
+#endif
 
-template <class LocalPID>
-static bool testLocalSmith (const LocalPID &R, VectorStream<vector<typename LocalPID::Element> > &stream) 
+template <class LocalPIR>
+static bool testLocalSmith (const LocalPIR &R, vector<typename LocalPIR::Element>& d, string s)
 {
-	typedef vector <typename LocalPID::Element> Vector;
-	typedef typename LocalPID::Element Elt;
-	typedef DenseMatrix<LocalPID> Blackbox;
+	typedef typename LocalPIR::Element Elt;
+	typedef DenseMatrix<LocalPIR> Blackbox;
 
-	commentator.start ("Testing local smith on random dense matrices", "testLocalSmith", stream.m ());
+	ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+	report << s << endl;
 
-	VectorDomain<LocalPID> VD (R);
+	MatrixDomain<LocalPIR> MR (R);
+	VectorDomain<LocalPIR> VD (R);
 
 	bool ret = true;
-	size_t i;
-	size_t n = stream.n();
-
-	Vector d;
-
-	VectorWrapper::ensureDim (d, stream.dim ());
-
-	while (stream) {
-		commentator.startIteration (stream.j ());
-
-		stream.next (d);
-
-		ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-		//ostream &report = std::cout; 
-		report << "Input vector:  ";
-		VD.write (report, d);
-		report << endl;
-
-		Blackbox Lm (R, n, n), D (R, n, n), U (R, n, n), A (R, n, n);
-		for( i = 0; i < n; ++i ) {D[i][i] = d[i];Lm[i][i]=U[i][i]=1;}
-		
-		size_t j;
-		
-		for (i = 0; i < n; ++ i) 
-		       for ( j = 0; j < i; ++ j) {
-			       
-			       D[i][j] = D[j][i] = 0;
-			       
-			       Lm[i][j] = rand() % 10;
-			       Lm[j][i] = 0;
-			       
-			       U[j][i] = rand() % 10;
-			       U[i][j] = 0;
-		       }
-
-		MatrixDomain<LocalPID> MR(R);
-		
-		Timer timer;
-		
-		report << "D\n";
-		D.write(report);
-
-		report << "L\n";
-		Lm.write(report);
-
-		report << "U\n";
-		U.write(report);
-
-		timer.start();
-		MR.mul(A,Lm,D);
-
-		report << "L D\n";
-		A.write(report);
-
-		MR.mulin(A,U);
-		timer.stop();
-		report << "Two matrix multiplication: " << timer << "\n";
-		
-		report << "A \n";
-		A.write(report);
-		//for( i = 0; i < n; ++i ) D[i][i] = rand() % 10 + 1;
-
-		list< typename LocalPID::Element > L;
-		SmithFormLocal< LocalPID > SmithForm;
-		timer.start();
-		SmithForm( L, A, R );
-		timer.stop();
-		report << "Time " << timer <<"\n";
-			
-		report.flush();
-		report << "Computed invariants: ";
-		
-		report << "[";
-		typedef typename list<Elt>::iterator listptr;
-		for (listptr p = L.begin(); p != L.end(); ++p)
-		    report << *p << ", ";
-		report << "\b\b]" << endl;
-
-		pplt<LocalPID> lt(R);
-		report << "normalize done" << endl;
-		report.flush();
-
-		for_each(d.begin(), d.end(), bind2nd(foobar<LocalPID>(), R));
-		timer.start();
-		stable_sort(d.begin(), d.end(), lt);
-		timer.stop();
-		report << "Sorting " << timer <<"\n";
-
-		report << "sort done" << endl;
-		report.flush();
-
-		report << "True invariants: ";
-		VD.write (report, d);
-		report << endl;
-		report << flush;
-
-		if ( L.size() != D.rowdim() ) {ret = false; break;}
-		typedef typename Vector::iterator vectptr;
-		listptr p; vectptr q;
-		for (p = L.begin(), q = d.begin(); 
-		     q != d.end(); 
-		     ++p, ++q)
-		    if ( !R.areEqual (*p, *q ) )
-		    {
-			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: Computed invariants incorrect" << endl;
-			 ret = false;
-		    }
-		commentator.stop("done");
+	size_t i,j;
+	size_t n = d.size();
+
+	report << "Input vector:  ";
+	VD.write (report, d);
+	report << endl;
+
+	// set up A equiv diag d.
+	Blackbox L (R, n, n), D (R, n, n), U (R, n, n), A (R, n, n);
+	for( i = 0; i < n; ++i ) 
+		{ D[i][i] = d[i]; L[i][i]=U[i][i]=1; }
+	for (i = 0; i < n; ++ i)
+		for ( j = 0; j < i; ++ j) {
+			D[i][j] = D[j][i] = 0;
+			L[i][j] = rand() % 10;
+			L[j][i] = 0;
+			U[j][i] = rand() % 10;
+			U[i][j] = 0;
+		}
+	MR.mul(A,L,D);
+	MR.mulin(A,U);
+
+	list< Elt > Inv;
+	SmithFormLocal< LocalPIR > SmithForm;
+	//timer.start();
+	SmithForm( Inv, A, R );
+	//timer.stop();
+	//report << "Time " << timer <<"\n"; report.flush();
+
+	report << "Computed invariants: ";
+	report << "[";
+	typedef typename list<Elt>::iterator listptr;
+	for (listptr p = Inv.begin(); p != Inv.end(); ++p)
+		report << *p << ", ";
+	//report << "\b\b]" << endl;
+	report << "normalize done" << endl; report.flush();
+
+	// figure true invariants
+	pplt<LocalPIR> lt(R);
+	for_each(d.begin(), d.end(), bind2nd(foobar<LocalPIR>(), R));
+	stable_sort(d.begin(), d.end(), lt);
+	report << "True invariants: ";
+	VD.write (report, d) << endl; report.flush();
+
+	typename vector<Elt>::iterator q; 
+	listptr p; 
+	for (p = Inv.begin(), q = d.begin(); q != d.end(); ++p, ++q)
+	{
+		if ( !R.areEqual (*p, *q ) ) {
+			report << "ERROR: Computed invariants incorrect" << endl;
+			ret = false;
+		}
 		commentator.progress();
 	}
-
-	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testDiagonalTrace");
-
 	return ret;
 }
 
 int main (int argc, char **argv)
 {
-	bool pass = true;
+	bool pass = true, pass1 = true;
 
-	static size_t n = 100;
+	static size_t n = 6;
 	static integer q = 101;
 	static int iterations = 1;
 
@@ -250,31 +196,55 @@ int main (int argc, char **argv)
 		{ 'n', "-n N", "Set dimension of test matrices to NxN.", TYPE_INT,     &n },
 		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
 
-	typedef NTL_PID_zz_p Ring;
-	typedef vector<Ring::Element> Vector;
-
-	Ring R (536870912);
-
 	commentator.start("Local Smith Form test suite", "LocalSmith");
-
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (5);
-
-	RandomDenseStream<Ring, Vector> stream (R, n, iterations);
-
-	if (!testLocalSmith<Ring> (R, stream)) pass = false;
-
-	// power of 2 test
-	Local2_32 R2;
-	RandomDenseStream<Local2_32, vector<Local2_32::Element> > 
-		stream2 (R2, n, iterations);
-	if (!testLocalSmith<Local2_32> (R2, stream2)) pass = false;
+	ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+
+#if 0
+//PIRModular does not currently support the local ring interface -bds Mar2011
+  { // first local ring type
+	typedef PIRModular<int32_t> LocalPID;
+	LocalPID R (536870912); // 2^32
+	//typedef PIRModular<dense> LocalPID;
+	//LocalPID R (32768);
+	vector<LocalPID::Element> d(n);
+
+	commentator.start ("Testing local smith on singular dense mat over PIRModular", "testSingular");
+	for( size_t i = 0; i < n; ++i ) d[i] = i;
+	if (!testLocalSmith<LocalPID> (R, d, "PIRModular<int32_t>")) pass1 = false;
+	commentator.stop ("testSingular");
+
+	commentator.start ("Testing local smith on nonsingular dense mat over PIRModular", "testNonsingular");
+	for( size_t i = 0; i < n; ++i ) d[i] = i+1;
+	if (!testLocalSmith<LocalPID> (R, d, "PIRModular<int32_t>")) pass1 = false;
+	commentator.stop ("testNonsingular");
+  }
+  if (not pass1) report << "PIRModular FAIL" << std::endl;
+#endif
+
+  { // second local ring type
+	typedef Local2_32 LocalPID;
+	LocalPID R;
+	vector<LocalPID::Element> d(n);
+
+	commentator.start ("Testing local smith on singular dense mat over Local2_32", "testSingular");
+	for( size_t i = 0; i < n; ++i ) d[i] = i;
+	if (!testLocalSmith<LocalPID> (R, d, "Local2_32")) pass = false;
+	commentator.stop ("testSingular");
+
+	commentator.start ("Testing local smith on nonsingular dense mat over Local2_32", "testNonsingular");
+	for( size_t i = 0; i < n; ++i ) d[i] = i+1;
+	if (!testLocalSmith<LocalPID> (R, d, "Local2_32")) pass = false;
+	commentator.stop ("testNonsingular");
+  }
+  if (not pass) report << "PIRModular FAIL" << std::endl;
 
 	commentator.stop("Local Smith Form test suite");
-	return pass ? 0 : -1;
+	return pass and pass1 ? 0 : -1;
 }
 
diff --git a/tests/test-smith-form.C b/tests/test-smith-form.C
old mode 100755
new mode 100644
index cc27283..f355e7c
--- a/tests/test-smith-form.C
+++ b/tests/test-smith-form.C
@@ -1,21 +1,55 @@
-/*
+/* -*- 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
+/* Copyright (C) LinBox
+ *
  *  Author: Zhendong Wan
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
  */
 
+/*! @file tests/test-smith-form.C
+ * @ingroup tests
+ * @brief no doc.
+ * @test no doc.
+ */
+
+
 #include <time.h>
-#include <linbox/field/ntl-ZZ.h>
+//#ifdef __LINBOX_HAVE_NTL
+//#include <linbox/field/ntl-ZZ.h>
+//#endif
+#include <linbox/field/PID-integer.h>
 #include <linbox/util/commentator.h>
 #include <linbox/vector/stream.h>
 #include "test-common.h"
 #include <linbox/blackbox/dense.h>
 #include <linbox/solutions/smith-form.h>
+using LinBox::commentator;
+using LinBox::Commentator;
+using LinBox::integer; 
+using LinBox::DenseMatrix;
 
 template <class Ring, class Vector>
-bool testRandom(const Ring& R, 
-		LinBox::VectorStream<Vector>& stream1) {
- 
+bool testRandom(const Ring& R,
+		LinBox::VectorStream<Vector>& stream1)
+{
+
 	std::ostringstream str;
-        
+
 	str << "Testing the smithForm function in solutions directory:\n";
 
         commentator.start (str.str ().c_str (), "testRandom");//, stream1.m ());
@@ -23,25 +57,25 @@ bool testRandom(const Ring& R,
         bool ret = true;
         bool iter_passed = true;
 
-        VectorDomain<Ring> VD (R);
+        LinBox::VectorDomain<Ring> VD (R);
 
 	Vector d, x;
-	
-	VectorWrapper::ensureDim (d, stream1.n ());
-	
-	VectorWrapper::ensureDim (x, stream1.n ());
 
-	
+	LinBox::VectorWrapper::ensureDim (d, stream1.n ());
+
+	LinBox::VectorWrapper::ensureDim (x, stream1.n ());
+
+
 	int n = d. size();
 
 	 while (stream1) {
-                                                                                                        
+
                 commentator.startIteration (stream1.j ());
-                                                                                                        
-		std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);  
+
+		std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
 
                 iter_passed = true;
-                                                                                                        
+
                 stream1.next (d);
 
 		report << "Input vector:  ";
@@ -52,29 +86,29 @@ bool testRandom(const Ring& R,
 
 		int i, j;
 
-		for(i = 0; i < n; ++i) { 
-			R. assign (D[i][i], d[i]); 
+		for(i = 0; i < n; ++i) {
+			R. assign (D[i][i], d[i]);
 			R. init (L[i][i], 1);
 			R. init (U[i][i], 1);}
-		
-		for (i = 0; i < n; ++ i) 
-		
+
+		for (i = 0; i < n; ++ i)
+
 			for (j = 0; j < i; ++ j) {
-				
+
 				R.init(L[i][j], rand() % 10);
-				
+
 				R.init(U[j][i], rand() % 10);
 			}
-	
-	
+
+
 		std::vector<typename Ring::Element> tmp1(n), tmp2(n), e(n);
-		
+
 		typename DenseMatrix<Ring>::ColIterator col_p;
 
 		i = 0;
-		for (col_p = A.colBegin(); 
+		for (col_p = A.colBegin();
 		     col_p != A.colEnd(); ++ col_p, ++ i) {
-			
+
 			R.init(e[i],1);
 			U.apply(tmp1, e);
 			D.apply(tmp2, tmp1);
@@ -82,9 +116,7 @@ bool testRandom(const Ring& R,
 			R.init(e[i],0);
 		}
 
-		
-		
-		typename Vector::iterator x_p; 
+		typename Vector::iterator x_p;
 		std::vector<integer> xi(A. rowdim());
 		std::vector<integer>::iterator xi_p;
 		std::list<std::pair<integer, size_t> > cpt;
@@ -99,96 +131,77 @@ bool testRandom(const Ring& R,
 
 		for (x_p = x. begin(), xi_p = xi. begin(); x_p != x. end(); ++ x_p, ++ xi_p)
 			A. field (). init (*x_p, *xi_p);
-       
-		
+
 		report << "Computed Smith form: \n";
-		
 		VD. write (report, x);
-		
+
 		report << '\n';
-	
+
 		typename std::vector<typename Ring::Element>::iterator p1, p2;
 		typename Ring::Element g;
-		
-		
+
 		for (p1 = d.begin(); p1 != d.end(); ++ p1) {
-			
 			for ( p2 = p1 + 1; p2 != d.end(); ++ p2) {
-				
 				if (R. isUnit(*p1))  break;
- 
 				else if (R. isZero (*p2)) continue;
-				
-				else if (R. isZero (*p1)) {
-                                                std::swap (*p1, *p2);
-				}
-				
-				else {
+				else if (R. isZero (*p1)) std::swap (*p1, *p2);
+				else { // (*p1, *p2) <-- (g, *p1 * *p2 / g), where g = gcd(*p1, *p2)
 					R. gcd (g, *p1, *p2);
-					
 					R. divin (*p2, g);
-					
 					R. mulin (*p2, *p1);
-					
 					R. assign (*p1, g);
 				}
 			}
 		}
-		
 
 		report << "Expected smith form:\n";
-		
-		VD.write (report, d);
-
-		report << '\n';
+		VD.write (report, d) << endl;
 
 		if (!VD.areEqual (d, x))
-			
 			ret = iter_passed = false;
-		
-                if (!iter_passed) 
-			
-                        commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: Computed Smith form is incorrect" << endl;
-			
-		
 
-                commentator.stop ("done");
+		if (!iter_passed)
+			commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
+				<< "ERROR: Computed Smith form is incorrect" << endl;
 
-                commentator.progress ();
-		
+		commentator.stop ("done");
+		commentator.progress ();
 	 }
-	 
-	 //stream1.reset ();
-	  	  
-	  commentator.stop (MSG_STATUS (ret), (const char *) 0, "testRandom");
-                                                                                                        
-	  return ret;
 
+	//stream1.reset ();
+
+	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testRandom");
+
+	return ret;
 }
 
-int main(int argc, char** argv) {
-                                                                                                        
+int main(int argc, char** argv)
+{
+
 	bool pass = true;
-	static size_t n =3; 
+	static size_t n =3;
 	static int iterations = 2;
 	static Argument args[] = {
 		{ 'n', "-n N", "Set order of test matrices to N.", TYPE_INT,  &n },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT, &iterations },
-		{ '\0' }
-		};
+		END_OF_ARGUMENTS
+	};
 
 	parseArguments (argc, argv, args);
-	typedef NTL_ZZ      Ring;
+//#ifdef __LINBOX_HAVE_NTL
+//	typedef LinBox::NTL_ZZ      Ring;
+//#else
+	typedef LinBox::PID_integer      Ring;
+//#endif
 	Ring R;
 
 	commentator.start("Smith form test suite", "Smith");
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (5);
 
-	RandomDenseStream<Ring> s1 (R, n, iterations);
+	LinBox::RandomDenseStream<Ring> s1 (R, n, iterations);
 	if (!testRandom(R, s1)) pass = false;
 
 	commentator.stop("Smith form test suite");
 	return pass ? 0 : -1;
-                                                                                                        
+
 }
diff --git a/tests/test-solve-nonsingular.C b/tests/test-solve-nonsingular.C
new file mode 100644
index 0000000..c19f5b2
--- /dev/null
+++ b/tests/test-solve-nonsingular.C
@@ -0,0 +1,362 @@
+/* -*- mode:C++ -*- */
+/* File: solve-nonsigular.C
+	This file was used to generate solver comparison data for the paper "Symbolic-Numeric Exact Rational Linear System Solver" submitted to ISSAC'11
+*/
+
+#include <iostream>
+#include <fstream>
+#include <cstdlib>
+
+#include <linbox/linbox-config.h>
+
+#include <linbox/algorithms/rational-solver.h>
+#include <linbox/randiter/random-prime.h>
+
+#include <linbox/field/PID-integer.h>
+#include <linbox/field/param-fuzzy.h>
+#include <linbox/blackbox/blas-blackbox.h>
+#include "tests/test-common.h"
+#include "linbox/vector/stream.h"
+#include "linbox/util/commentator.h"
+#include "linbox/util/timer.h"
+
+#include <linbox/algorithms/numeric-solver-lapack.h>
+#ifdef __LINBOX_HAVE_MATLAB
+	#include <linbox/algorithms/numeric-solver-matlab.h>
+#endif
+
+//or #include "other-numeric-solver.h"
+/* a numeric solver is a FAIBB (fast approximate inverse blackbox). It provides
+ * 1. constructor from whatever parameters
+ * 2. init(A) // init from a matrix of double.  evolve this a bit...
+ *    LU or other initial prep may happen at this moment.
+ * 3. solve(x, b) // x <-- A^{-1}b approximately, for vector of double x, b.
+ * 4. apply(y, x) // y <-- Ax, approximately, for vector of double y, x.
+ */
+
+#include <linbox/algorithms/rational-solver-sn.h>
+/* rational-solver provides
+ * 1. constructor with a numerical solver as argument (call it NS).
+ * 2. solve(num, den, A, b, NS)
+ *    In our impl, solve prepares the double versions of A, b, initializes the NS,
+ *    and calls rsol().
+ */
+
+//  matrix types
+#include "matrix/coin.h"
+#include "matrix/invhilb.h"
+#include "matrix/randommat.h"
+#include "matrix/randomans.h"
+#include "matrix/hadamard.h"
+#include "matrix/minmax.h"
+#include "matrix/jmat.h"
+
+using namespace LinBox;
+
+enum MatType {diag=0, tref=1, hilb=2, zo=3, rand_sp=4,
+				I=5, jordan2=6, rand_near_sing=7, Hadamard=8, minIJ=9,
+				maxIJ=10, DlehmerD=11, je1=12, je2=13 };
+enum SolverType {diagonal, lapack, matlab, superlu, dixon};
+
+size_t nextPower2(size_t n){
+    size_t p = 1;
+    while(p < n) p <<= 1;
+    return p;
+}
+
+template<class Ring, class Matrix, class Vector>
+void generateProblem(const Ring& R, Matrix &D, Vector &b,
+		LinBox::VectorStream<Vector>& stream1,
+		LinBox::VectorStream<Vector>& stream2,
+		MatType mt,
+		int k = 10){
+
+	Vector d, x, y;
+	VectorWrapper::ensureDim (d, stream1.n ());
+	VectorWrapper::ensureDim (b, stream1.n ());
+	VectorWrapper::ensureDim (x, stream1.n ());
+	VectorWrapper::ensureDim (y, stream1.n ());
+
+	std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+
+	int n = d.size();
+
+	bool zeroEntry;
+	do {
+		stream1.next (d);
+		zeroEntry = false;
+		for (size_t i=0; i<stream1.n(); i++)
+			zeroEntry |= R.isZero(d[i]);
+	} while (zeroEntry);
+
+	//  set up RHS
+	report << "Setting up RHS... ";
+	int randLim = R_CEILING;
+ 	switch (mt) {
+		//  random RHSs
+		case zo: //randLim = 10000;
+		//case random:
+		case I:
+		case diag: stream2.next (b);
+			//  special case?
+			if (n == 4) for (size_t i = 0; i < b.size(); ++i) b[i] = 2*(i+1);
+			for (size_t i = 0; i < b.size(); ++i) b[i] %= randLim;
+			break;
+		//  RHS with just first element 1
+		//case zo:
+		case rand_sp:
+		case rand_near_sing:
+		case jordan2:
+		case Hadamard:
+		case tref:
+		case DlehmerD:
+		case minIJ:
+		case maxIJ:
+		case je1:
+		case hilb: b[0] = 1; break;
+		case je2: b[n-1] = 1; break;
+	}
+	report << "Done." << endl;
+
+	report << "Setting up matrix order " << n << "... ";
+	//  set up Matrix
+	typename Ring::Element tmp;
+ 	switch (mt) {
+		case rand_near_sing: randomAns(R, D, n, n); break;
+		case hilb: invhilb(R, D, n); break;
+		case Hadamard: hadamard(R, D, n); break;
+		case minIJ: minmat(R, D, n); break;
+		case maxIJ: maxmat(R, D, n); break;
+		case DlehmerD: qlehmer(R, D, n); break;
+		case je1:
+		case je2: jordanform(R, D, n); break;
+		case rand_sp:
+			randomMat(R, D, n, k); break;
+			//  modified for steffy's random model
+			/*
+			randomMat(R, D, n, n);
+			R.init(tmp, 10000);
+			for(int i=0; i<n; ++i)
+				D.setEntry(i, i, tmp);
+			break;
+			*/
+		case diag:
+		  {
+		  //typename Ring::Element product;
+		  //R.init(product, 1);
+		  randLim = 100000;
+		  for(int i = 0; i < n; ++i) {
+		    int x = d[i]%randLim;
+			if (x == 0) x = 1;
+			R.init (tmp,  x);
+			//R.mulin(product, tmp);
+			//if (n == 4) tmp = i+1;
+			//if (tmp == 4) tmp = -4;
+			D.setEntry(i, i, tmp);
+		  }
+		  }
+		  break;
+		case tref: //trefethen(R, D, n); break;
+		case I:
+			R.init(tmp, 1);
+			for(int i = 0; i < n; ++i)
+				D.setEntry(i, i, tmp);
+			break;
+		case jordan2:
+			//randomMat(R, D, n, n);
+			for(int i = 0; i < n; ++i){
+				R.init(tmp, 1);
+				D.setEntry(i, i, tmp);
+				R.init(tmp, 0);
+				for(int j = i+1; j < n; ++j)
+					D.setEntry(i, j, tmp);
+				R.init(tmp, 2);
+				if (i > 0) D.setEntry(i, i-1, tmp);
+			}
+			break;
+		case zo:
+			for(int i = 0; i < n; ++i)
+				for(int j = 0; j < n; ++j){
+					R.init(tmp, rand()%2);
+					D.setEntry(i, j, tmp);
+				}
+			break;
+	}
+	report << "Done." << endl;
+
+	stream1.reset ();
+   	stream2.reset ();
+}
+
+
+template <class Ring, class RSolver, class Matrix, class Vector>
+bool testRandomSolve (const Ring& R, RSolver& rsolver, Matrix& D, Vector &b) {
+
+	int n = b.size();
+	Vector d, tmpb, x, y;
+	VectorWrapper::ensureDim (d, n);
+	VectorWrapper::ensureDim (x, n);
+	VectorWrapper::ensureDim (y, n);
+	VectorWrapper::ensureDim (tmpb, n);
+	VectorDomain<Ring> VD (R);
+
+	for(int i=0; i<n; ++i) tmpb[i] = b[i];
+
+	//std::ostringstream str;
+	//std::ostream &report = cerr;
+	std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+
+	//  print small mats
+	if(n <= 20){
+		report << "Matrix: " << endl; D.write(report);
+		VD.write (report << "Right-hand side:  ", b) << endl;
+	}
+
+	std::vector<typename Ring::Element> num(n);
+	typename Ring::Element den;
+	Timer timer;
+
+	timer.clear(); timer.start();
+	int solveResult = rsolver.solve(num, den, D, b);
+	timer.stop();
+
+	report << "Total time: " << timer << endl;
+
+	if(n <= 20){
+		VD.write (report << "solution numerator: ", num) << endl;
+		report << "solution denominator: " << den << endl;
+	}
+
+#ifdef WRITE_MATRICES
+	/*  write matrices to file */
+	ofstream mat;
+	stringstream ms;
+	ms << n;
+	string file = "matrix." + ms.str();
+	mat.open(file.c_str());
+	D.write(mat);
+#endif
+#ifdef WRITE_RESULTS
+	ofstream out;
+	stringstream ss;
+	ss << n;
+	string res = "output." + ss.str();
+	out.open(res.c_str());
+	rsolver.writeVec(num, "first value in numerator", 0, 1, out);
+	out << endl << endl << "denominator: " << endl << den << endl;
+#endif
+
+	if ( solveResult != 0 ) {
+	    report << "ERROR: Did not return OK solving status" << endl;
+		return false;
+	}
+	if ( solveResult == 0 && R.isZero(den) ) {
+		report << "ERROR: Solver set denominator to zero" << endl;
+		return false;
+	}
+	if ( solveResult == 0 && !VD.areEqual(D.apply(y, num), VD.mulin(tmpb, den)) ) {
+		report << "ERROR: Computed solution is incorrect" << endl;
+		return false;
+	}
+	else {
+	   return true;
+	}
+}
+
+int main(int argc, char** argv) {
+	bool pass = true;
+	int run = 1;
+    static size_t n = 10;
+	static size_t k = 10;
+	bool e = false;
+	MatType mt = rand_sp;
+	string file;
+	SolverType st = lapack;
+
+   static Argument args[] = {
+		{ 't', NULL, "(0)diag, (1)tref, (2)ihilb (3)zo, (4)rand_sp\n\t\t(5)I (6)jordan2 (7)rand_near_sing (8)Hadamard\n\t\t(9)minIJ (10)maxIJ (11)DLehmerD (12)Je1 (13)Je2.\n\t\tFor benchmarking use: 2,3,4,6,8,9,10,11, with 6 a special case", TYPE_INT, &mt },
+		{ 's', NULL, "Set numerical solver to (0)diagonal, (1)lapack, (2)matlab, (3)superlu", TYPE_INT, &st },
+      { 'n', "-n N", "Set order of test matrices to N.", TYPE_INT, &n},
+		{ 'k', "-k K", "Set # entries per row to K (for rand_sp case).", TYPE_INT, &k},
+		{ 'e', NULL, "Use exact apply", TYPE_BOOL, &e},
+		{ 'r', "-r R", "Run solvers with corresponding bit on: numsym(1), zw(2), dixon(4)", TYPE_INT, &run},
+		//{ 'f', "-f FILE", "Set input file to FILE.", TYPE_STRING, &file },
+		END_OF_ARGUMENTS
+		//{ '\0' }
+   };
+	parseArguments (argc, argv, args);
+
+	commentator.getMessageClass (TIMING_MEASURE).setMaxDepth (10);
+	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (10);
+	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
+
+	std::ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+
+	typedef PID_integer	Ring;  		Ring R;
+
+	typedef ParamFuzzy Field;
+	typedef Modular<int32_t> ZField;
+	typedef Modular<double> DField;
+
+	typedef BlasBlackbox<Field> Matrix;
+	typedef BlasBlackbox<Ring> CommonMatrix;
+	typedef vector<Ring::Element> Vector;
+
+	if(mt == Hadamard)
+		n = nextPower2(n);
+
+	RandomDenseStream<Ring> s1 (R, n, 1), s2 (R, n, 1);
+
+	CommonMatrix A(R, n, n);
+	Vector b(n);
+	generateProblem(R, A, b, s1, s2, mt, k);
+
+	if(run & 1){
+		/*  choose your numerical solver */
+		switch (st){
+#ifdef __LINBOX_HAVE_LAPACK
+			case lapack: {
+				 report << "Using lapack numeric solver." << endl;
+				 typedef LPS<Matrix> NumSolver;	NumSolver numSolver;
+				 RationalSolverSN<Ring, NumSolver > rsolver(R, numSolver, e);
+				 pass = pass && testRandomSolve(R, rsolver, A, b);
+				}
+				break;
+#endif
+#ifdef __LINBOX_HAVE_MATLAB
+			case matlab: {
+				 report << "Using matlab numeric solver." << endl;
+				 typedef MLS<Matrix> NumSolver;	NumSolver numSolver;
+				 RationalSolverSN<Ring, NumSolver > rsolver(R, numSolver, e);
+				 pass = pass && testRandomSolve(R, rsolver, A, b);
+				}
+				break;
+#endif
+						 /*
+			case superlu: {
+				report << "Using SuperLU numeric solver." << endl;
+				typedef SLU<Matrix> NumSolver;	NumSolver numSolver(file);
+				SNRationalSolver<Ring, NumSolver > rsolver(R, numSolver);
+				pass = pass && testRandomSolve(R, rsolver, s1, s2, mt, 1, e, k);
+				}
+				break;
+						  */
+			default:
+				 break;
+		}
+		report << "numsym: " << (pass ? "pass" : "fail") << std::endl << std::endl;
+	}
+	if(run & 2){
+		RationalSolver<Ring, ZField, RandomPrimeIterator, WanTraits> rsolver(R);
+		pass = testRandomSolve(R, rsolver, A, b);
+		report << "zw: " << (pass ? "pass" : "fail") << std::endl << std::endl;
+	}
+	if(run & 4){
+		RandomPrimeIterator genprime( 26-(int)ceil(log((double)n)*0.7213475205) );
+		RationalSolver<Ring, DField, RandomPrimeIterator, DixonTraits> rsolver(R, genprime);
+		pass = testRandomSolve(R, rsolver, A, b);
+		report << "dixon: " << (pass ? "pass" : "fail") << std::endl << std::endl;
+	}
+
+	return pass ? 0 : -1;
+}
diff --git a/tests/test-solve.C b/tests/test-solve.C
index e13f4c5..e0b9095 100644
--- a/tests/test-solve.C
+++ b/tests/test-solve.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-solve.C
  * Copyright (C) 2001, 2002 Bradford Hovinen
@@ -10,6 +11,13 @@
  * See COPYING for license information
  */
 
+/*! @file   tests/test-solve.C
+ * @ingroup tests
+ * @brief no doc.
+ * @test no doc.
+ */
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -51,7 +59,7 @@ template <class Field, class Vector, class MethodTraits>
 static bool testIdentitySolve (const Field          &F,
 			       VectorStream<Vector> &stream,
 			       const char           *text,
-			       MethodTraits          method) 
+			       MethodTraits          method)
 {
 	typedef ScalarMatrix <Field> Blackbox;
 
@@ -130,7 +138,7 @@ static bool testIdentitySolve (const Field          &F,
  *
  * Constructs a random nonsingular diagonal matrix D and a random right-hand
  * side b, and computes the solution to the Dx=b, checking the result
- * 
+ *
  * F - Field over which to perform computations
  * stream1 - Vector stream for diagonal entries
  * stream2 - Vector stream for right-hand sides
@@ -142,10 +150,10 @@ static bool testIdentitySolve (const Field          &F,
 
 template <class Field, class Vector, class MethodTraits>
 static bool testNonsingularSolve (const Field          &F,
-				  VectorStream<Vector> &stream1, 
+				  VectorStream<Vector> &stream1,
 				  VectorStream<Vector> &stream2,
 				  const char           *text,
-				  MethodTraits          method) 
+				  MethodTraits          method)
 {
 	typedef Diagonal <Field, Vector> Blackbox;
 
@@ -241,7 +249,7 @@ static bool testNonsingularSolve (const Field          &F,
  *
  * Constructs a random diagonal matrix D of rank r and a random right-hand
  * side b, and computes the solution to the Dx=b, checking the result
- * 
+ *
  * F - Field over which to perform computations
  * n - Dimension to which to make matrix
  * stream1 - Vector stream for diagonal entries
@@ -258,7 +266,7 @@ static bool testSingularConsistentSolve (const Field          &F,
 					 VectorStream<Vector> &stream1,
 					 VectorStream<Vector> &stream2,
 					 const char           *text,
-					 MethodTraits          method) 
+					 MethodTraits          method)
 {
 	typedef Diagonal <Field, Vector> Blackbox;
 
@@ -364,7 +372,7 @@ static bool testSingularConsistentSolve (const Field          &F,
  *
  * Constructs a random diagonal matrix D of rank r and a random right-hand
  * side b, and computes the solution to the Dx=b, checking the result
- * 
+ *
  * F - Field over which to perform computations
  * stream1 - Vector stream for diagonal entries
  * stream2 - Vector stream for right-hand sides
@@ -379,7 +387,7 @@ static bool testSingularInconsistentSolve (const Field          &F,
 					   VectorStream<Vector> &stream1,
 					   VectorStream<Vector> &stream2,
 					   const char           *text,
-					   MethodTraits          method) 
+					   MethodTraits          method)
 {
 	typedef Diagonal <Field, Vector> Blackbox;
 
@@ -482,7 +490,7 @@ static bool testSingularInconsistentSolve (const Field          &F,
  *
  * Constructs a random diagonal matrix D of rank r and a random right-hand
  * side b, and computes the solution to the Dx=b, checking the result
- * 
+ *
  * F - Field over which to perform computations
  * stream1 - Vector stream for diagonal entries
  * stream2 - Vector stream for right-hand sides
@@ -497,7 +505,7 @@ static bool testSingularPreconditionedSolve (const Field                  &F,
 					     VectorStream<SparseVector>   &stream1,
 					     VectorStream<Vector>         &stream2,
 					     const char                   *text,
-					     Method::Wiedemann::Preconditioner preconditioner) 
+					     Method::Wiedemann::Preconditioner preconditioner)
 {
 	typedef SparseMatrix <Field> Blackbox;
 
@@ -751,10 +759,10 @@ int main (int argc, char **argv)
 		{ 'N', "-N N", "Set blocking factor to N.", TYPE_INT,     &N },
 		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
-	typedef Modular<LinBox::uint32> Field;
+	typedef Modular<uint32_t> Field;
 
 	parseArguments (argc, argv, args);
 	Field F (q);
@@ -788,7 +796,7 @@ int main (int argc, char **argv)
 					      "Wiedemann", Method::Wiedemann ()))
 		pass = false;
 	if (!testSingularPreconditionedSolve (F, stream6, stream2,
-					      "Sparse preconditioner", Method::Wiedemann::SPARSE)) 
+					      "Sparse preconditioner", Method::Wiedemann::SPARSE))
 		pass = false;
 	if (!testIdentitySolve               (F, stream1,
 					      "Lanczos", Method::Lanczos ()))
@@ -814,7 +822,7 @@ int main (int argc, char **argv)
 	if (!testRandomSolve (F, A_stream, stream1, "Block Lanczos", traits2))
 		pass = false;
 #endif
-    if ( ! testBasicMethodsSolve (F, n) ) 
+    if ( ! testBasicMethodsSolve (F, n) )
 		pass = false;
 
 	commentator.stop("solve test suite");
diff --git a/tests/test-sparse.C b/tests/test-sparse.C
index 3a0d87b..ed050bb 100644
--- a/tests/test-sparse.C
+++ b/tests/test-sparse.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-sparse.C
  * Copyright (C) 2001, 2002 Bradford Hovinen
@@ -10,6 +11,14 @@
  * See COPYING for license information
  */
 
+/*! @file  tests/test-sparse.C
+ * @ingroup tests
+ *
+ * @brief no doc
+ *
+ * @test no doc.
+ */
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -43,7 +52,7 @@ using namespace LinBox;
  */
 
 template <class Row, class Field, class Vector>
-static bool testIdentityApply (Field &F, const char *text, VectorStream<Vector> &stream) 
+static bool testIdentityApply (Field &F, const char *text, VectorStream<Vector> &stream)
 {
 	typedef SparseMatrix <Field, Row> Blackbox;
 
@@ -117,7 +126,7 @@ static bool testIdentityApply (Field &F, const char *text, VectorStream<Vector>
  */
 
 template <class Row, class Field, class Vector>
-static bool testNilpotentApply (Field &F, const char *text, VectorStream<Vector> &stream) 
+static bool testNilpotentApply (Field &F, const char *text, VectorStream<Vector> &stream)
 {
 	typedef SparseMatrix <Field, Row> Blackbox;
 
@@ -223,7 +232,7 @@ static bool testNilpotentApply (Field &F, const char *text, VectorStream<Vector>
  */
 
 template <class Vector, class Row, class Field>
-bool testRandomApply1 (Field &F, const char *text, unsigned int iterations, VectorStream<Row> &A_stream) 
+bool testRandomApply1 (Field &F, const char *text, unsigned int iterations, VectorStream<Row> &A_stream)
 {
 	typedef SparseMatrix <Field, Row> Blackbox;
 
@@ -298,7 +307,7 @@ bool testRandomApply1 (Field &F, const char *text, unsigned int iterations, Vect
  */
 
 template <class Vector, class Row, class Field>
-bool testRandomApply2 (Field &F, const char *text, unsigned int iterations, VectorStream<Row> &A_stream) 
+bool testRandomApply2 (Field &F, const char *text, unsigned int iterations, VectorStream<Row> &A_stream)
 {
 	typedef SparseMatrix <Field, Row> Blackbox;
 
@@ -386,7 +395,7 @@ static bool testRandomTranspose (Field                &F,
 				 const char           *text,
 				 VectorStream<Row>    &A_stream,
 				 VectorStream<Vector> &stream1,
-				 VectorStream<Vector> &stream2) 
+				 VectorStream<Vector> &stream2)
 {
 	typedef SparseMatrix <Field, Row> Blackbox;
 
@@ -427,7 +436,7 @@ static bool testRandomLinearity (Field                 &F,
 				 const char            *text,
 				 VectorStream<Row>    &A_stream,
 				 VectorStream<Vector> &stream1,
-				 VectorStream<Vector> &stream2) 
+				 VectorStream<Vector> &stream2)
 {
 	typedef SparseMatrix <Field, Row> Blackbox;
 
@@ -458,7 +467,7 @@ bool runSparseMatrixTestsByVector (const Field           &F,
 				   unsigned int           iterations,
 				   VectorStream<Vector> &v_stream1,
 				   VectorStream<Vector> &v_stream2,
-				   VectorStream<Row>    &A_stream) 
+				   VectorStream<Row>    &A_stream)
 {
 	bool pass = true;
 
@@ -483,7 +492,7 @@ template <class Field, class Row>
 bool runSparseMatrixTests (const Field       &F,
 			   const char        *desc,
 			   int                iterations,
-			   VectorStream<Row> &A_stream) 
+			   VectorStream<Row> &A_stream)
 {
 	typedef std::vector <typename Field::Element> DenseVector;
 	typedef std::vector <pair <size_t, typename Field::Element> > SparseSeqVector;
@@ -555,11 +564,11 @@ int main (int argc, char **argv)
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
 		{ 'k', "-k K", "K nonzero Elements per row in sparse random apply test.", TYPE_INT,     &k },
 		{ 'N', "-N N", "N nonzero Elements in sparse random apply test.", TYPE_INT,     &N },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 	parseArguments (argc, argv, args);
 
-	typedef	Modular<uint32> Field;
+	typedef	Modular<uint32_t> Field;
 	typedef Field::Element  Element;
 
 	typedef std::vector <Element> DenseVector;
diff --git a/tests/test-subiterator.C b/tests/test-subiterator.C
index d6fdf6c..621e6f1 100644
--- a/tests/test-subiterator.C
+++ b/tests/test-subiterator.C
@@ -1,13 +1,45 @@
+/* -*- 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
+/* Copyright (C) LinBox
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*! @file  tests/test-subiterator.C
+ * @ingroup tests
+ *
+ * @brief no doc
+ *
+ * @test no doc.
+ */
+
+
+
 #include <iostream>
 #include <linbox/util/commentator.h>
 #include "test-common.h"
 #include <linbox/vector/subiterator.h>
 using namespace LinBox;
-bool test() 
-;
+bool test() ;
 int main(int argc, char** argv)
-{	
+{
    static Argument args[] = {
+	   END_OF_ARGUMENTS
    };
    parseArguments (argc, argv, args);
 	commentator.start("Subiterator test suite", "Subiterator");
@@ -21,9 +53,9 @@ bool test()
 {
 	const char* title = "Subiterator test";
 	commentator.start(title, title, 1);
-	ostream &report = commentator.report 
+	ostream &report = commentator.report
 		(Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-	std::vector<int> v; 
+	std::vector<int> v;
 	for (int i = 1; i <= 10; ++i) v.push_back(i);
 
 	Subiterator<std::vector<int>::iterator> s(v.begin()+2, 2);
@@ -39,7 +71,7 @@ bool test()
 	if (*(s+1) != 5) {report << 8 << endl; res=false;}
 	if (*(s-1) != 1) {report << 9 << endl; res=false;}
 	if ((t-s) != 5) {report << 10 << endl; res=false;}
-	//	report << "10 " << t-s << endl; 
+	//	report << "10 " << t-s << endl;
 	if ((s[1]) != 5) {report << 11 << endl; res=false;}
 
 	if (s == t) {report << 12 << endl; res=false;}
diff --git a/tests/test-submatrix.C b/tests/test-submatrix.C
index 8768835..b12d462 100644
--- a/tests/test-submatrix.C
+++ b/tests/test-submatrix.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-submatrix.C
  * Copyright (C) 2001, 2002 Bradford Hovinen
@@ -21,6 +22,13 @@
  * Boston, MA 02111-1307, USA.
  */
 
+/*! @file  tests/test-submatrix.C
+ * @ingroup tests
+ * @brief no doc.
+ * @test no doc.
+ */
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -56,7 +64,7 @@ template <class Field>
 static bool testRandomApply (Field                                       &F,
 			     unsigned int                                 iterations,
 			     size_t                                       n,
-			     VectorStream<typename Vector<Field>::Dense> &stream) 
+			     VectorStream<typename Vector<Field>::Dense> &stream)
 {
 	typedef DenseMatrix <Field> Blackbox;
 
@@ -155,7 +163,7 @@ template <class Field>
 static bool testRandomLinearity (const Field                                 &F,
 				 VectorStream<typename Vector<Field>::Dense> &A_stream,
 				 VectorStream<typename Vector<Field>::Dense> &v1_stream,
-				 VectorStream<typename Vector<Field>::Dense> &v2_stream) 
+				 VectorStream<typename Vector<Field>::Dense> &v2_stream)
 {
 	commentator.start ("Testing random linearity", "testRandomLinearity", v1_stream.size ());
 
@@ -190,7 +198,7 @@ template <class Field>
 static bool testRandomTranspose (const Field                                 &F,
 				 VectorStream<typename Vector<Field>::Dense> &A_stream,
 				 VectorStream<typename Vector<Field>::Dense> &v1_stream,
-				 VectorStream<typename Vector<Field>::Dense> &v2_stream) 
+				 VectorStream<typename Vector<Field>::Dense> &v2_stream)
 {
 	commentator.start ("Testing random transpose", "testRandomTranspose", v1_stream.size ());
 
@@ -222,10 +230,10 @@ int main (int argc, char **argv)
 		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
 		{ 'N', "-N N", "Perform each test on N vectors.", TYPE_INT,     &N },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
-	typedef Modular<uint32> Field;
+	typedef Modular<uint32_t> Field;
 
 	parseArguments (argc, argv, args);
 	Field F (q);
diff --git a/tests/test-subvector.C b/tests/test-subvector.C
index 24e396a..ebb7e26 100644
--- a/tests/test-subvector.C
+++ b/tests/test-subvector.C
@@ -1,9 +1,35 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* tests/test-subvector.C
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) LinBox
+ *
  * Evolved from Will Turner's test-subvector.cpp  -bds
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*! @file  tests/test-subvector.C
+ * @ingroup tests
+ *
+ * @brief no doc
+ *
+ * @test no doc.
  */
 
+
 #include "linbox/linbox-config.h"
 
 #include "linbox/util/commentator.h"
@@ -15,34 +41,34 @@
 using namespace LinBox;
 
 template <class Field>
-static bool testSubvector(Field &F, size_t n); 
+static bool testSubvector(Field &F, size_t n);
 
 int main(int argc, char** argv)
-{	
+{
     // set up command line options
     static size_t n = 8;
-    static Argument args[] = 
+    static Argument args[] =
     {
  		{ 'n', "-n N", "Set size of vector to N.", TYPE_INT, &n},
-		{ '\0' }
+		END_OF_ARGUMENTS
     };
     parseArguments (argc, argv, args);
- 
+
     // start testing
 	commentator.start("Subvector test suite", "Subvector");
     bool pass = true;
- 
+
     // call tests
     typedef LinBox::UnparametricField<int> Field;
     Field F;
     pass = testSubvector<Field> (F, n);
- 
+
     // finish
 	commentator.stop("Subvector test suite");
     return pass? 0 : -1;
 }
 
-/* Test Subvector class 
+/* Test Subvector class
  * Subvector has the vector interface less those that
  * can invalidate iterators.
  */
@@ -50,12 +76,12 @@ int main(int argc, char** argv)
 using namespace LinBox;
 
 template <class Field>
-static bool testSubvector(Field &F, size_t n) 
+static bool testSubvector(Field &F, size_t n)
 {
 	// commentator setup
 	const char *  title = "Subvector test";
 	commentator.start(title, title, 1);
-	ostream &report = commentator.report 
+	ostream &report = commentator.report
 		(Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
 
 	report << "This test currently neglects several members including constructors." << endl;
@@ -88,20 +114,20 @@ static bool testSubvector(Field &F, size_t n)
 	Subvect w(sb, se);
 
 	// implicit (not stored) stride of 1
-	Subvector<typename Vector::iterator> 
-		z(v.begin(), v.end()); 
+	Subvector<typename Vector::iterator>
+		z(v.begin(), v.end());
 	// fixme: at least constructor compiles.
 
 	// explicit (stored) stride of 1
-	Subvect zz(v.begin(), v.end()); 
+	Subvect zz(v.begin(), v.end());
 	// fixme: at least constructor compiles.
-	
+
 	//report << "start = " << w._start << endl;
 	//report << "stride = " << w._stride << endl;
 	//report << "length = " << w._length << endl;
 
 	report << endl << "*** Testing forward iterator" << endl << endl;
-	
+
 	Subiter j = w.begin();
 
 //	report << "stride = " << j._stride << endl;
@@ -153,7 +179,7 @@ static bool testSubvector(Field &F, size_t n)
 	}
 	report << ')' << endl;
 
-	j = w.begin();	
+	j = w.begin();
 	report << "Random access through vector: (";
 	for (unsigned long i = 0; i < w.size(); i++)
 	{
@@ -164,7 +190,7 @@ static bool testSubvector(Field &F, size_t n)
 
 #if 1
 	report << endl << "*** Testing reverse iterator" << endl << endl;
-	
+
 	ReverseSubiterator jr(w.rbegin());
 
 	report << "*jr = 5 = " << *jr << endl;
@@ -198,7 +224,7 @@ static bool testSubvector(Field &F, size_t n)
 	report << "*jr = 5 = " << *jr << endl;
 	ret = ret && 5 == *jr;
 
-	if (jr != w.rbegin()) 
+	if (jr != w.rbegin())
 		report << "not at beginning" << endl;
 	ret = ret && 5 == *jr;
 
@@ -211,7 +237,7 @@ static bool testSubvector(Field &F, size_t n)
 	report << ')' << endl;
 	ret = ret && jr == w.rend();
 
-	jr = w.rbegin();	
+	jr = w.rbegin();
 	report << "Random access through vector: (";
 	for (unsigned long i = 0; i < w.size(); i++)
 	{
@@ -225,7 +251,7 @@ static bool testSubvector(Field &F, size_t n)
 	report << endl << "*** Testing vector" << endl << endl;
 
 	// Need to check on const_iterator variants of functions.
-	
+
 	report << "w.size() = 3 = " << w.size() << endl;
 	ret = ret && w.size() == 3;
 	report << "w.max_size() = 3 = " << w.max_size() << endl;
diff --git a/tests/test-sum.C b/tests/test-sum.C
index f6e9c03..82ca895 100644
--- a/tests/test-sum.C
+++ b/tests/test-sum.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-sum.C
  * Copyright (C) 2002 Bradford Hovinen
@@ -10,6 +11,15 @@
  * See COPYING for license information.
  */
 
+/*! @file  tests/test-sum.C
+ * @ingroup tests
+ *
+ * @brief no doc
+ *
+ * @test no doc.
+ */
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -20,7 +30,10 @@
 #include "linbox/vector/stream.h"
 #include "linbox/field/archetype.h"
 #include "linbox/field/modular.h"
+#include "linbox/field/givaro.h"
+#ifdef __LINBOX_HAVE_NTL
 #include "linbox/field/ntl-lzz_p.h"
+#endif
 #include "linbox/vector/vector-domain.h"
 #include "linbox/blackbox/diagonal.h"
 #include "linbox/blackbox/scalar-matrix.h"
@@ -31,6 +44,20 @@
 
 using namespace LinBox;
 
+
+
+template <class Field2, class Blackbox>
+static bool testBBrebind (const Field2 &F2, const Blackbox& B)
+{
+    typedef typename Blackbox::template rebind<Field2>::other FBlackbox;
+
+    FBlackbox A(B, F2);
+
+    return testBlackbox(A);
+}
+
+
+
 /* Test 1: Application of zero matrix onto random vectors
  *
  * Construct a random diagonal matrix and its opposite, then construct
@@ -42,9 +69,8 @@ using namespace LinBox;
  *
  * Return true on success and false on failure
  */
-
-template <class Field, class Vector>
-static bool testZeroApply (Field &F, VectorStream<Vector> &stream1, VectorStream<Vector> &stream2) 
+template <class Field1, class Field2, class Vector>
+static bool testZeroApply (Field1 &F1, Field2 &F2, VectorStream<Vector> &stream1, VectorStream<Vector> &stream2)
 {
 	commentator.start ("Testing zero apply", "testZeroApply", stream1.m ());
 
@@ -52,8 +78,8 @@ static bool testZeroApply (Field &F, VectorStream<Vector> &stream1, VectorStream
 	bool iter_passed = true;
 
 	Vector d1, d2, v, w, zero;
-	VectorDomain<Field> VD (F);
-	typename Field::Element neg_one;
+	VectorDomain<Field1> VD (F1);
+	typename Field1::Element neg_one;
 
 	VectorWrapper::ensureDim (zero, stream1.dim ());
 	VectorWrapper::ensureDim (d1, stream1.dim ());
@@ -62,7 +88,7 @@ static bool testZeroApply (Field &F, VectorStream<Vector> &stream1, VectorStream
 	VectorWrapper::ensureDim (w, stream2.dim ());
 // 	F.init (neg_one, 1);
 // 	F.negin (neg_one);
-	F.init (neg_one, -1);
+	F1.init (neg_one, -1);
 
 	while (stream1) {
 		commentator.startIteration (stream1.j ());
@@ -71,9 +97,9 @@ static bool testZeroApply (Field &F, VectorStream<Vector> &stream1, VectorStream
 		stream1.next (d1);
 		VD.mul (d2, d1, neg_one);
 
-		Diagonal <Field> D1 (F, d1), D2 (F, d2);
+		Diagonal <Field1> D1 (F1, d1), D2 (F1, d2);
 
-		Sum <Diagonal<Field>,Diagonal <Field> > A (&D1, &D2);
+		Sum <Diagonal<Field1>,Diagonal <Field1> > A (&D1, &D2);
 
 		ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
 		report << "Diagonal matrix:  ";
@@ -109,6 +135,9 @@ static bool testZeroApply (Field &F, VectorStream<Vector> &stream1, VectorStream
 
 		commentator.stop ("done");
 		commentator.progress ();
+
+                ret = ret && testBBrebind(F2, A);
+
 	}
 
 	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testZeroApply");
@@ -131,7 +160,7 @@ static bool testZeroApply (Field &F, VectorStream<Vector> &stream1, VectorStream
  */
 
 template <class Field>
-static bool testRandomTranspose (Field &F, size_t n, int iterations) 
+static bool testRandomTranspose (Field &F, size_t n, int iterations)
 {
 	typedef vector <typename Field::Element> Vector;
 
@@ -164,22 +193,31 @@ int main (int argc, char **argv)
 	bool pass = true;
 
 	static size_t n = 10;
-	static integer q = 101;
-	static int iterations1 = 10;
+	static integer q1 = 101;
+	static integer q2 = 1009;
+	static int iterations1 = 2;
 	static int iterations2 = 1;
 
 	static Argument args[] = {
 		{ 'n', "-n N", "Set dimension of test matrices to NxN.", TYPE_INT,     &n },
-		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
+		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q1 },
+		{ 'z', "-z Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q2 },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations1 },
 		{ 'j', "-j J", "Apply test matrix to J vectors.", TYPE_INT,     &iterations2 },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
+#ifdef __LINBOX_HAVE_NTL
 //        typedef UnparametricField<NTL::zz_p> Field;
         typedef NTL_zz_p Field;
-	NTL::zz_p::init(q);
-	Field F(q);
+// 	NTL::zz_p::init(q1); // Done in the constructor
+#else
+	typedef Modular<int32_t> Field ;
+#endif
+	Field F1(q1);
+
+        GivaroZpz< ::Givaro::Std32> F2(q2);
+
 	typedef vector<Field::Element> Vector;
 
 	parseArguments (argc, argv, args);
@@ -189,12 +227,12 @@ int main (int argc, char **argv)
 	// Make sure some more detailed messages get printed
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (2);
 
-	RandomDenseStream<Field> stream1 (F, n, iterations1), stream2 (F, n, iterations2);
+	RandomDenseStream<Field> stream1 (F1, n, iterations1), stream2 (F1, n, iterations2);
 
-	if (!testZeroApply (F, stream1, stream2)) pass = false;
+	if (!testZeroApply (F1, F2, stream1, stream2)) pass = false;
 
 	n = 10;
-	RandomDenseStream<Field> stream3 (F, n, iterations1), stream4 (F, n, iterations2);
+	RandomDenseStream<Field> stream3 (F1, n, iterations1), stream4 (F1, n, iterations2);
 
 	Vector d1(n), d2(n);
 	stream3.next (d1);
@@ -202,15 +240,16 @@ int main (int argc, char **argv)
 
 //	Diagonal <Field, Vector> D1 (F, d1), D2 (F, d2);
 
-	Field::Element d; F.init(d, 5);
-	ScalarMatrix<Field> D1(F, 10, d), D2(F, 10, d); 
+	Field::Element d; F1.init(d, 5);
+	ScalarMatrix<Field> D1(F1, 10, d), D2(F1, 10, d);
 	typedef ScalarMatrix<Field> Blackbox;
 
 	Sum <Blackbox, Blackbox> A (D1, D2);
-	pass = pass && testBlackbox(A);
+	pass = pass && testBlackbox(A) && testBBrebind(F2, A);
+
 
-	Sum <Blackbox, Blackbox> Aref (&D1, &D2);
-	pass = pass && testBlackbox(Aref);
+        Sum <Blackbox, Blackbox> Aref (&D1, &D2);
+	pass = pass && testBlackbox(Aref) && testBBrebind(F2, A);
 
 	commentator.stop("Sum black box test suite");
 	return pass ? 0 : -1;
diff --git a/tests/test-toeplitz-det.C b/tests/test-toeplitz-det.C
index 9988c83..9bf10a7 100644
--- a/tests/test-toeplitz-det.C
+++ b/tests/test-toeplitz-det.C
@@ -1,9 +1,41 @@
+/* -*- 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
+/* Copyright (C) LinBox
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*! @file  tests/test-toeplitz-det.C
+ * @ingroup tests
+ *
+ * @brief no doc
+ *
+ * @test no doc.
+ */
+
+
+
 #include <iostream>
 #include <vector>
 #include <linbox/blackbox/toeplitz.h>
 #ifdef __LINBOX_HAVE_NTL
-#include <linbox/field/ntl-lzz_pX.h>
 #include <linbox/field/ntl-lzz_p.h>
+#include <linbox/field/ntl-lzz_pX.h>
 #endif
 #include <linbox/solutions/det.h>
 #include <linbox/blackbox/dense.h>
@@ -17,11 +49,12 @@
 using namespace std;
 using namespace LinBox;
 
-int main(int argc, char* argv[]) {
+int main(int argc, char* argv[])
+{
 	static size_t N_BOUND = 100;
 	static Argument args[] = {
-    	{ 'n', "-n N", "Set dimension limit of test matrices to NxN.", TYPE_INT,     &N_BOUND },
-		{ '\0' }
+		{ 'n', "-n N", "Set dimension limit of test matrices to NxN.", TYPE_INT,     &N_BOUND },
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
@@ -33,44 +66,44 @@ int main(int argc, char* argv[]) {
 	ostream& report = commentator.report();
 	bool pass = true;
 #ifdef __LINBOX_HAVE_NTL
-	srandom(time(0));
+	srand(time(0));
 	RandomPrimeIterator rp;
-	NTL_zz_p::RandIter rand;
+	NTL_zz_p::RandIter randit;
 	report << "\tUsing random primes and square matrices of size 2 to " << N_BOUND << endl;
 	//for( int i = 0; pass && i < 2; ++i ) {
-		size_t n;
-		do { n = random() % N_BOUND; } while( n < 2 );
-
-		NTL_zz_p CF( *rp );
-		NTL_zz_pX PF(CF);
-		
-		DenseMatrix<NTL_zz_p> A(CF,n,n);
-		
-		NTL_zz_p::Element temp;
-		NTL_zz_pX::Element poly;
-		PF.init(poly,0);
-		size_t r,c;
-
-		for( int diff = 1 - ((int)n); diff <= ((int)n) - 1; ++diff ) {
-			rand.random(temp);
-			PF.setCoeff(poly,(size_t)(diff + n - 1), temp );
-			r = c = 0;
-			if( diff < 0 ) c = (size_t)(diff*-1);
-			else r = (size_t)diff;
-			for( ; r < n && c < n; ++r, ++c )
-				A.setEntry(r,c,temp);
-		}
-
-		Toeplitz<NTL_zz_p,NTL_zz_pX> T( PF, poly, n );
-
-		NTL_zz_p::Element res1, res2;
-		//det(res1,A);
-		det(res1,T);
-		det(res2,T);
-		
-		if( res1 != res2 ) pass = false;
+	size_t n;
+	do { n = rand() % N_BOUND; } while( n < 2 );
+
+	NTL_zz_p CF( *rp );
+	NTL_zz_pX PF(CF);
+
+	DenseMatrix<NTL_zz_p> A(CF,n,n);
+
+	NTL_zz_p::Element temp;
+	NTL_zz_pX::Element poly;
+	PF.init(poly,0);
+	size_t r,c;
+
+	for( int diff = 1 - ((int)n); diff <= ((int)n) - 1; ++diff ) {
+		randit.random(temp);
+		PF.setCoeff(poly,(size_t)(diff + n - 1), temp );
+		r = c = 0;
+		if( diff < 0 ) c = (size_t)(diff*-1);
+		else r = (size_t)diff;
+		for( ; r < n && c < n; ++r, ++c )
+			A.setEntry(r,c,temp);
+	}
+
+	Toeplitz<NTL_zz_p,NTL_zz_pX> T( PF, poly, n );
+
+	NTL_zz_p::Element res1, res2;
+	//det(res1,A);
+	det(res1,T);
+	det(res2,T);
+
+	if( res1 != res2 ) pass = false;
 	//}
-#else 
+#else
 	report << "No test, because no NTL." << endl;
 #endif
 	report << endl;
diff --git a/tests/test-trace.C b/tests/test-trace.C
index 32249b0..68c335f 100644
--- a/tests/test-trace.C
+++ b/tests/test-trace.C
@@ -1,308 +1,83 @@
 /* -*- 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
 
 /* tests/test-trace.C
- * Copyright (C) 2002 Bradford Hovinen
+ * Copyright (C) -bds
  *
- * Written by Bradford Hovinen <hovinen at cis.udel.edu>
+ * Earlier version by Bradford Hovinen <hovinen at cis.udel.edu>
  *
  * --------------------------------------------------------
  *
  * See COPYING for license information
  */
 
+/*! @file  tests/test-trace.C
+ * @ingroup tests
+ *
+ * @brief no doc
+ *
+ * @test no doc.
+ */
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
-#include <fstream>
 #include <vector>
-#include <cstdio>
 
 #include "test-common.h"
 
-#include "linbox/util/commentator.h"
-#include "linbox/field/modular-int.h"
+#include "linbox/field/modular-int32.h"
 #include "linbox/solutions/trace.h"
-#include "linbox/blackbox/compose.h"
-#include "linbox/blackbox/diagonal.h"
-#include "linbox/blackbox/scalar-matrix.h"
-#include "linbox/blackbox/sparse.h"
-#include "linbox/blackbox/dense.h"
-#include "linbox/vector/stream.h"
 
 using namespace LinBox;
 
-/* Test 1: Trace of random diagonal matrix
- *
- * Construct a random diagonal matrix and check that its computed trace is the
- * same as the sum of its entries
- *
- * F - Field over which to perform computations
- * stream - Stream that comprises source of diagonal vectors
- *
- * Return true on success and false on failure
- */
-
-template <class Field>
-bool testScalarMatrixTrace (const Field &F, size_t n)
-{
-	bool ret = true;
-	commentator.start ("Testing scalar matrix trace", "", 1);
-	ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-	report << "scalarmatrix trace test (using specialization)" << endl;
-    	typename Field::Element s, t, th; 
-	F.init(s, 2);
-	F.init(th, 2*n);
-	ScalarMatrix<Field> B(F, n, s);
-	trace(t, B);
-	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testScalarMatrixTrace");
-	if (!F.areEqual(t, th)) {
-	report << "bad scalar matrix trace " << t << ", should be " << th << endl;
-
-		return false; 
-	} 
-	else return true;
-}
-
-template <class Field>
-bool testSparseMatrixTrace (const Field &F, size_t n)
-{
-	commentator.start ("Building sparse matrix", "", 1);
-	bool ret = true;
-	ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-    	typename Field::Element s, t, th; 
-	F.init(s, 2);
-	size_t m = (n > 10 ? 10 : n);
-	F.init(th, 2*m);
-	SparseMatrix<Field> B(F, n, n);
-	for (size_t i = 0; i <  m; ++i)
-		for (size_t j = 0; j < m; ++j) 
-			B.setEntry(i,j,s);
-	commentator.stop ("", "done");
-	commentator.start ("Testing sparse matrix trace", "", 1);
-	report << "sparse matrix trace test (using specialization)" << endl;
-	trace(t, B);
-	if (!F.areEqual(t, th)) {
-	report << "bad sparse matrix trace " << t << ", should be " << th << endl;
-
-		ret = false; 
-	} 
-	else ret = true;
-	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testSparseMatrixTrace");
-	return ret;
-}
-
-template <class Field>
-static bool testDenseMatrixTrace (const Field &F, size_t n)
-{
-	bool ret = true;
-    	typename Field::Element s, t, th; 
-	F.init(s, 2);
-	size_t m = (n > 10 ? 10 : n);
-	F.init(th, 2*m);
-	DenseMatrix<Field> B(F, n, n);
-	for (size_t i = 0; i <  m; ++i)
-		for (size_t j = 0; j < n; ++j) 
-			B.setEntry(i, j, s);
-	commentator.start ("Testing dense matrix trace", "", 1);
-	ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-	report << "dense matrix trace test (using specialization)" << endl;
-	trace(t, B);
-	if (!F.areEqual(t, th)) {
-		report << "bad dense matrix trace " << t << ", should be " << th << endl;
-
-		ret = false; 
-	} 
-	else ret = true;
-	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testDenseMatrixTrace");
-	return ret;
-}
-
-template <class Field>
-static bool testDiagonalTrace (const Field &F, VectorStream<vector<typename Field::Element> > &stream) 
-{
-	typedef vector <typename Field::Element> Vector;
-	typedef Diagonal <Field> Blackbox;
-
-	commentator.start ("Testing diagonal trace", "testDiagonalTrace", stream.m ());
-	ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-
-	VectorDomain<Field> VD (F);
-
-	bool ret = true;
-	size_t i;
-
-	Vector d;
-	typename Field::Element sigma, res;
-
-	VectorWrapper::ensureDim (d, stream.dim ());
-
-	while (stream) {
-		commentator.startIteration (stream.j ());
-
-		stream.next (d);
-
-		report << "Input vector:  ";
-		VD.write (report, d);
-		report << endl;
-
-		F.init (sigma, 0);
-		for (i = 0; i < stream.n (); i++)
-			F.addin (sigma, VectorWrapper::constRef<Field, Vector> (d, i));
-
-		report << "True trace: ";
-		F.write (report, sigma);
-		report << endl;
-
-		Blackbox D (F, d);
-
-		trace (res, D);
-
-		report << "Computed trace: ";
-		F.write (report, res);
-		report << endl;
-
-		if (!F.areEqual (sigma, res)) {
-			ret = false;
-			report << "ERROR: Computed trace is incorrect" << endl;
-		}
-
-		commentator.stop ("done");
-		commentator.progress ();
-	}
-
-	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testDiagonalTrace");
-
-	return ret;
-}
-
-template <class Field>
-static bool testComposeTrace (const Field &F, size_t n, VectorStream<vector<typename Field::Element> > &stream)
-{
-	bool ret = true;
-    	typename Field::Element s; 
-	F.init(s, 2);
-
-	SparseMatrix<Field> B(F, n, n);
-	for (size_t i = 0; i < n; ++i)
-		for (size_t j = 0; j < n; ++j) 
-			B.setEntry(i, j, s);
-
-	VectorDomain<Field> VD (F);
-        
-
-	commentator.start ("Testing composed matrix trace", "", 1);
-	ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
-	report << "composed trace test (using specialization)" << endl;
-
-	typedef vector <typename Field::Element> Vector;
-
-	size_t i;
-
-	Vector d;
-	typename Field::Element sigma, res, th;
-
-	VectorWrapper::ensureDim (d, stream.dim ());
-
-	while (stream) {
-		commentator.startIteration (stream.j ());
-
-		stream.next (d);
-
-		report << "Input diagonal:  ";
-		VD.write (report, d);
-		report << endl;
-
-                B.write (report << "Input dense " , FORMAT_MAPLE) << endl;
-
-		F.init (sigma, 0);
-		F.init (th, 0);
-		for (i = 0; i < stream.n (); i++) {
-			F.addin (sigma, VectorWrapper::constRef<Field, Vector> (d, i));
-                        F.axpyin(th, VectorWrapper::constRef<Field, Vector> (d, i), VectorWrapper::constRef<Field, Vector> (d, i) );
-                }
-                F.mulin(sigma, s);
-                F.mulin(th, s);
-
-		report << "True trace: ";
-		F.write (report, sigma);
-		report << endl;
-
-		Diagonal<Field> D (F, d);
-
-                Compose< Diagonal<Field>, SparseMatrix<Field> > CDB(&D, &B);
-
-		trace (res, CDB);
-
-		report << "Computed trace: ";
-		F.write (report, res);
-		report << endl;
-                
-		if (!F.areEqual (sigma, res)) {
-			ret = false;
-			report << "ERROR: Computed trace is incorrect" << endl;
-		}
-
-
-		report << "True trace: ";
-		F.write (report, th);
-		report << endl;
-
-                Compose< Compose< Diagonal<Field>, SparseMatrix<Field> >, Diagonal<Field> > CDBD(&CDB, &D);
-
-		trace (res, CDBD);
-
-		report << "Computed trace: ";
-		F.write (report, res);
-		report << endl;
-                
-		if (!F.areEqual (th, res)) {
-			ret = false;
-			report << "ERROR: Computed trace is incorrect" << endl;
-		}
-
-		commentator.stop ("done");
-		commentator.progress ();
-	}
-
-	commentator.stop (MSG_STATUS (ret), (const char *) 0, "testComposedMatrixTrace");
-	return ret;
-}
-
-
-
 int main (int argc, char **argv)
 {
 	bool pass = true;
 
-	static size_t n = 256;
-	//static size_t n = 10;
+	static size_t n = 20;
 	static integer q = 101;
-	static int iterations = 1;
 
 	static Argument args[] = {
 		{ 'n', "-n N", "Set dimension of test matrices to NxN.", TYPE_INT,     &n },
 		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
-		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
-	typedef Modular<int> Field;
-	typedef vector<Field::Element> Vector;
-
 	parseArguments (argc, argv, args);
-	Field F (q);
 
-	commentator.start("Trace solution test suite", "Trace");
+	commentator.start("Trace test suite", "Trace");
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (3);
 
-	RandomDenseStream<Field, Vector> stream (F, n, iterations);
-
-	if (!testScalarMatrixTrace (F, n)) pass = false;
-	if (!testSparseMatrixTrace (F, n)) pass = false;
-	if (!testDenseMatrixTrace (F, n)) pass = false;
-	if (!testDiagonalTrace (F, stream)) pass = false;
-        stream.reset();
-	if (!testComposeTrace (F, n, stream)) pass = false;
+	typedef Modular<int> Field;
+	typedef Field::Element Element;
+	typedef vector<Element> Vector;
+	Field F (q);
+	Element t, t1, t2, t3;
+	F.init(t, 0); F.init(t1, 0); F.init(t2, 0); F.init(t3, 0);
+
+	Element s; F.init(s, 3);
+	ScalarMatrix<Field> A(F, n, s);
+	F.init(t, n*3);
+	trace(t1, A);
+	if (! F.areEqual(t1, t) ) pass = false;
+	trace(t2, A, TraceTags::Local() );
+	if (! F.areEqual(t1, t) ) pass = false;
+	trace(t3, A, TraceTags::Generic() );
+	if (! F.areEqual(t1, t) ) pass = false;
+
+/*
+	Vector v(2*n-1, s);
+	for (int i = 0; i < 2*n-1; ++i) if (i != n-1) F.init(v[i], i);
+	Toeplitz<Field> B(F, n, v);
+	trace(t1, B);
+	if (! F.areEqual(t1, t) pass = false;
+	trace(t2, B, TraceTags::Local() );
+	if (! F.areEqual(t1, t) pass = false;
+	trace(t3, B, TraceTags::Generic() );
+	if (! F.areEqual(t1, t) pass = false;
+*/
 
 	commentator.stop("Trace solution test suite");
 	return pass ? 0 : -1;
diff --git a/tests/test-triplesbb.C b/tests/test-triplesbb.C
index 5e3840a..c67c1ef 100644
--- a/tests/test-triplesbb.C
+++ b/tests/test-triplesbb.C
@@ -1,9 +1,34 @@
 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-/* tests/test-scalar-matrix.C
+// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,\:0,t0,+0,=s
+/* Copyright (C) LinBox
+ *
  * using generic testBlackbox  -bds
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*! @file  tests/test-triplesbb.C
+ * @ingroup tests
+ *
+ * @brief no doc
+ *
+ * @test no doc.
  */
 
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -18,12 +43,23 @@
 #include "test-generic.h"
 
 
+/*! Check vector equality.
+ *
+ * @param a a vector
+ * @param b another one
+ * @todo factorize somewhere!
+ *
+ */
 template<class Vec>
 bool eqVec(const Vec& a, const Vec& b)
-{       bool good = true;
+{
+	bool good = true;
+	if (a.size() != b.size())
+		return !good;
 	for (typename Vec::size_type i = 0; i < a.size(); ++i) good = good && (a[i] == b[i]);
 	return good;
 }
+
 using namespace LinBox;
 
 int main (int argc, char **argv)
@@ -40,7 +76,7 @@ int main (int argc, char **argv)
 		{ 'n', "-n N", "Set dimension of test matrices to NxN.", TYPE_INT,     &n },
 		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INTEGER, &q },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
@@ -49,19 +85,19 @@ int main (int argc, char **argv)
 
 	commentator.start("triplesbb black box test suite", "triplesbb");
 
-	typedef Modular<uint32> Field;
+	typedef Modular<uint32_t> Field;
 	typedef Field::Element Element;
 	typedef vector <Element> Vector;
 	typedef TriplesBB<Field> Blackbox;
 
 	Field F (q);
-	Element d; 
+	Element d;
 	F.init (d, -1);
 
 	// set up the matrix
-	std::vector<Element> values; 
-	std::vector<size_t> rowP; 
-	std::vector<size_t> colP; 
+	std::vector<Element> values;
+	std::vector<size_t> rowP;
+	std::vector<size_t> colP;
 	for(int i = 1; i < 12; ++i)
 	{
 		values.push_back(i);
diff --git a/tests/test-unparametric-field.C b/tests/test-unparametric-field.C
index cd8779b..71273b0 100644
--- a/tests/test-unparametric-field.C
+++ b/tests/test-unparametric-field.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-unparametric-field.C
  * Copyright (C) 2002 William J. Turner
@@ -15,6 +16,13 @@
  * See COPYING for license information.
  */
 
+/*! @file  tests/test-unparametric-field.C
+ * @ingroup tests
+ * @brief no doc.
+ * @test no doc.
+ */
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -36,12 +44,11 @@ int main (int argc, char **argv)
 	static Argument args[] = {
 		{ 'n', "-n N", "Set dimension of test vectors to NxN.", TYPE_INT,     &n },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
 
-	cout << endl << "Unparametrix<double> field test suite" << endl;
 	cout.flush ();
 	bool pass = true;
 
@@ -51,6 +58,9 @@ int main (int argc, char **argv)
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDepth (4);
 	commentator.getMessageClass (INTERNAL_DESCRIPTION).setMaxDetailLevel (Commentator::LEVEL_UNIMPORTANT);
 
+ostream &report = commentator.report (Commentator::LEVEL_IMPORTANT, INTERNAL_DESCRIPTION);
+        report << endl << "Unparametrix<double> field test suite" << endl;
+
 	if (!runFieldTests (F, "UnparametricField<double>", iterations, n, false)) pass = false;
 
 	FieldArchetype K(new UnparametricField<double>(F));
diff --git a/tests/test-vector-domain.C b/tests/test-vector-domain.C
index 8d13682..2cfac5b 100644
--- a/tests/test-vector-domain.C
+++ b/tests/test-vector-domain.C
@@ -1,4 +1,5 @@
 /* -*- 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
 
 /* tests/test-vector-domain.C
  * Copyright (C) 2001, 2002 Bradford Hovinen
@@ -21,6 +22,13 @@
  * Boston, MA 02111-1307, USA.
  */
 
+/*! @file  tests/test-vector-domain.C
+ * @ingroup tests
+ * @brief no doc.
+ * @test no doc.
+ */
+
+
 #include "linbox/linbox-config.h"
 
 #include <iostream>
@@ -38,7 +46,7 @@ using namespace std;
 using namespace LinBox;
 
 template <class Field>
-bool testVectorDomain (const Field &F, const char *text, size_t n, unsigned int iterations) 
+bool testVectorDomain (const Field &F, const char *text, size_t n, unsigned int iterations)
 {
 	typedef std::vector<typename Field::Element> DenseVector;
 	typedef std::vector<typename Field::Element> SparseSeqVector;
@@ -118,19 +126,19 @@ int main (int argc, char **argv)
 	static Argument args[] = {
 		{ 'n', "-n N", "Set dimension of test vectors to N.", TYPE_INT,     &n },
 		{ 'K', "-K Q", "Operate over the \"field\" GF(Q) [1] for integer modulus.", TYPE_INTEGER, &q1 },
-		{ 'Q', "-Q Q", "Operate over the \"field\" GF(Q) [1] for uint32 modulus.", TYPE_INTEGER, &q2 },
-		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1] for uint16 modulus.", TYPE_INTEGER, &q3 },
-		{ 'p', "-p P", "Operate over the \"field\" GF(P) [1] for uint8 modulus.", TYPE_INTEGER, &q4 },
+		{ 'Q', "-Q Q", "Operate over the \"field\" GF(Q) [1] for uint32_t modulus.", TYPE_INTEGER, &q2 },
+		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1] for uint16_t modulus.", TYPE_INTEGER, &q3 },
+		{ 'p', "-p P", "Operate over the \"field\" GF(P) [1] for uint8_t modulus.", TYPE_INTEGER, &q4 },
 		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT,     &iterations },
-		{ '\0' }
+		END_OF_ARGUMENTS
 	};
 
 	parseArguments (argc, argv, args);
 
 	Modular<integer> F_integer (q1);
-	Modular<uint32> F_uint32 ((uint32) q2);
-	Modular<uint16> F_uint16 ((uint16) q3);
-	Modular<uint8> F_uint8 ((uint8) q4);
+	Modular<uint32_t> F_uint32_t ((uint32_t) q2);
+	Modular<uint16_t> F_uint16_t ((uint16_t) q3);
+	Modular<uint8_t> F_uint8_t ((uint8_t) q4);
 
 	commentator.start("Vector domain test suite", "VectorDomain");
 
@@ -140,9 +148,9 @@ int main (int argc, char **argv)
 	commentator.getMessageClass (TIMING_MEASURE).setMaxDepth (3);
 
 	if (!testVectorDomain (F_integer, "Modular <integer>", n, iterations)) pass = false;
-	if (!testVectorDomain (F_uint32, "Modular <uint32>", n, iterations)) pass = false;
-	if (!testVectorDomain (F_uint16, "Modular <uint16>", n, iterations)) pass = false;
-	if (!testVectorDomain (F_uint8, "Modular <uint8>", n, iterations)) pass = false;
+	if (!testVectorDomain (F_uint32_t, "Modular <uint32_t>", n, iterations)) pass = false;
+	if (!testVectorDomain (F_uint16_t, "Modular <uint16_t>", n, iterations)) pass = false;
+	if (!testVectorDomain (F_uint8_t, "Modular <uint8_t>", n, iterations)) pass = false;
 
 	commentator.stop("Vector domain test suite");
 	return pass ? 0 : -1;
diff --git a/tests/test-vector-domain.h b/tests/test-vector-domain.h
index e39cce4..c6ffc4a 100644
--- a/tests/test-vector-domain.h
+++ b/tests/test-vector-domain.h
@@ -1,5 +1,5 @@
-/* -*- mode: C++; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
-
+/* -*- 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
 /* linbox/tests/test-vector-domain.h
  * Copyright (C) 2001, 2002 Bradford Hovinen
  * See COPYING for license information.
@@ -8,8 +8,8 @@
  * test-generic was written by Bradford Hovinen <hovinen at cis.udel.edu>
  */
 
-#ifndef __TEST_VECTOR_DOMAIN_H
-#define __TEST_VECTOR_DOMAIN_H
+#ifndef __LINBOX_test_vector_domain_H
+#define __LINBOX_test_vector_domain_H
 
 #include <iostream>
 #include <fstream>
@@ -24,8 +24,7 @@
 #include "linbox/blackbox/dense.h"
 #include "linbox/integer.h"
 
-#include "test-common.h" 
-//using namespace std;
+#include "test-common.h"
 
 
 /** Test 1: Dot product of vectors
@@ -41,7 +40,7 @@
  */
 
 template <class Field, class Vector1, class Vector2>
-static bool testDotProduct (Field &F, const char *text, LinBox::VectorStream<Vector1> &stream1, LinBox::VectorStream<Vector2> &stream2) 
+static bool testDotProduct (Field &F, const char *text, LinBox::VectorStream<Vector1> &stream1, LinBox::VectorStream<Vector2> &stream2)
 {
 	std::ostringstream str;
 
@@ -61,7 +60,7 @@ static bool testDotProduct (Field &F, const char *text, LinBox::VectorStream<Vec
 	LinBox::VectorWrapper::ensureDim (v1, stream1.n ());
 	LinBox::VectorWrapper::ensureDim (v2, stream2.n ());
 
-	LinBox::Timer timer;
+	::Givaro::Timer timer;
 	double totaltime = 0.0;
 
 	while (stream1 && stream2) {
@@ -98,7 +97,7 @@ static bool testDotProduct (Field &F, const char *text, LinBox::VectorStream<Vec
 		if (!F.areEqual (sigma, rho)) {
 			ret = false;
 			LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: Dot products are not equal" << std::endl;
+			<< "ERROR: Dot products are not equal" << std::endl;
 		}
 
 		LinBox::commentator.stop ("done");
@@ -106,7 +105,7 @@ static bool testDotProduct (Field &F, const char *text, LinBox::VectorStream<Vec
 	}
 
 	LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, TIMING_MEASURE)
-		<< "Average time for dot product: " << totaltime / stream1.m () << std::endl;
+	<< "Average time for dot product: " << totaltime / stream1.m () << std::endl;
 
 	LinBox::commentator.stop (MSG_STATUS (ret), (const char *) 0, "testDotProduct");
 
@@ -130,7 +129,7 @@ static bool testDotProduct (Field &F, const char *text, LinBox::VectorStream<Vec
  */
 
 template <class Field, class Vector>
-static bool testAddMul (Field &F, const char *text, LinBox::VectorStream<Vector> &stream1, LinBox::VectorStream<Vector> &stream2) 
+static bool testAddMul (Field &F, const char *text, LinBox::VectorStream<Vector> &stream1, LinBox::VectorStream<Vector> &stream2)
 {
 	std::ostringstream str;
 
@@ -205,7 +204,7 @@ static bool testAddMul (Field &F, const char *text, LinBox::VectorStream<Vector>
 
 		if (!iter_passed)
 			LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: (x + a*y) != a*(y + a^-1*x)" << std::endl;
+			<< "ERROR: (x + a*y) != a*(y + a^-1*x)" << std::endl;
 
 		LinBox::commentator.stop ("done");
 		LinBox::commentator.progress ();
@@ -233,7 +232,7 @@ static bool testAddMul (Field &F, const char *text, LinBox::VectorStream<Vector>
  */
 
 template <class Field, class Vector>
-static bool testSubMul (Field &F, const char *text, LinBox::VectorStream<Vector> &stream1, LinBox::VectorStream<Vector> &stream2) 
+static bool testSubMul (Field &F, const char *text, LinBox::VectorStream<Vector> &stream1, LinBox::VectorStream<Vector> &stream2)
 {
 	std::ostringstream str;
 
@@ -308,7 +307,7 @@ static bool testSubMul (Field &F, const char *text, LinBox::VectorStream<Vector>
 
 		if (!iter_passed)
 			LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: (x - a*y) != a*(a^-1*x - y)" << std::endl;
+			<< "ERROR: (x - a*y) != a*(a^-1*x - y)" << std::endl;
 
 		LinBox::commentator.stop ("done");
 		LinBox::commentator.progress ();
@@ -335,7 +334,7 @@ static bool testSubMul (Field &F, const char *text, LinBox::VectorStream<Vector>
  */
 
 template <class Field, class Vector>
-static bool testAXPY (Field &F, const char *text, LinBox::VectorStream<Vector> &stream1, LinBox::VectorStream<Vector> &stream2) 
+static bool testAXPY (Field &F, const char *text, LinBox::VectorStream<Vector> &stream1, LinBox::VectorStream<Vector> &stream2)
 {
 	std::ostringstream str;
 	str << "\t--Testing " << text << " vector axpy" << std::ends;
@@ -391,7 +390,7 @@ static bool testAXPY (Field &F, const char *text, LinBox::VectorStream<Vector> &
 
 		if (!iter_passed)
 			LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: (x + a*y) - a*(y + a^-1*x) != 0" << std::endl;
+			<< "ERROR: (x + a*y) - a*(y + a^-1*x) != 0" << std::endl;
 
 		LinBox::commentator.stop ("done");
 		LinBox::commentator.progress ();
@@ -417,7 +416,7 @@ static bool testAXPY (Field &F, const char *text, LinBox::VectorStream<Vector> &
  * Return true on success and false on failure
  */
 template <class Field, class Vector1, class Vector2>
-static bool testCopyEqual (Field &F, const char *text, LinBox::VectorStream<Vector1> &stream, LinBox::VectorStream<Vector2> &stream2) 
+static bool testCopyEqual (Field &F, const char *text, LinBox::VectorStream<Vector1> &stream, LinBox::VectorStream<Vector2> &stream2)
 {
 	std::ostringstream str;
 
@@ -455,7 +454,7 @@ static bool testCopyEqual (Field &F, const char *text, LinBox::VectorStream<Vect
 
 		if (!iter_passed)
 			LinBox::commentator.report (LinBox::Commentator::LEVEL_IMPORTANT, INTERNAL_ERROR)
-				<< "ERROR: Vectors are not equal" << std::endl;
+			<< "ERROR: Vectors are not equal" << std::endl;
 
 		LinBox::commentator.stop ("done");
 		LinBox::commentator.progress ();
@@ -469,4 +468,4 @@ static bool testCopyEqual (Field &F, const char *text, LinBox::VectorStream<Vect
 	return ret;
 }
 
-#endif // __TEST_VECTOR_DOMAIN_H
+#endif // __LINBOX_test_vector_domain_H
diff --git a/tests/test-zero-one.C b/tests/test-zero-one.C
index 51ca513..3998760 100644
--- a/tests/test-zero-one.C
+++ b/tests/test-zero-one.C
@@ -1,60 +1,92 @@
+/* -*- 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
+/* Copyright (C) LinBox
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*! @file   tests/test-zero-one.C
+ * @ingroup tests
+ * @brief no doc.
+ * @test no doc.
+ */
+
+
+
 #include <iostream>
 #include <vector>
 #include <utility>
 
 #include "linbox/blackbox/zero-one.h"
-#include "linbox/field/modular.h" 
+#include "linbox/field/modular.h"
 
 #include "test-common.h"
 #include "test-generic.h"
 
-int main(int argc, char **argv) {
-  bool pass = true;
-  uint32 prime = 31337;
-  size_t *rows, *cols, i;
-  static size_t n = 1000, iter = 1;
+int main(int argc, char **argv)
+{
+	using LinBox::commentator;
+	bool pass = true;
+	uint32_t prime = 31337;
+	size_t *rows, *cols, i;
+	static size_t n = 1000, iter = 1;
 
-  static Argument args[] = {
-    { 'n', "-n N", "Set dimension of test matrix to NxN.", TYPE_INT, &n },
-    { 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INT, &prime },
-    { 'i', "-i I", "Perform each test for I iterations.", TYPE_INT, &iter},
-	{ '\0' }
-  };
+	static Argument args[] = {
+		{ 'n', "-n N", "Set dimension of test matrix to NxN.", TYPE_INT, &n },
+		{ 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INT, &prime },
+		{ 'i', "-i I", "Perform each test for I iterations.", TYPE_INT, &iter},
+		END_OF_ARGUMENTS
+	};
 
-  parseArguments(argc, argv, args);
+	parseArguments(argc, argv, args);
 
-  typedef LinBox::ZeroOne<LinBox::Modular<LinBox::uint32> > Matrix;
+	typedef LinBox::ZeroOne<LinBox::Modular<uint32_t> > Matrix;
 
-  LinBox::Modular<LinBox::uint32> afield(prime);
+	LinBox::Modular<uint32_t> afield(prime);
 
-  rows = new size_t[3 * n];
-  cols = new size_t[3 * n];
+	rows = new size_t[3 * n];
+	cols = new size_t[3 * n];
 
-  // "arrow" matrix
-  for(i = 0; i < n; i++) { rows[i] = 0; cols[i] = i; } // first row
-  for(i = 0; i < n; i++) { rows[n+i] = i; cols[n+i] = 0; } // first col
-  for(i = 0; i < n; i++) { rows[2*n+i] = i; cols[2*n+i] = i; } // diag
-  Matrix testMatrix(afield, rows, cols, n, n, 3*n - 2);
+	// "arrow" matrix
+	for(i = 0; i < n; i++) { rows[i] = 0; cols[i] = i; } // first row
+	for(i = 0; i < n; i++) { rows[n+i] = i; cols[n+i] = 0; } // first col
+	for(i = 0; i < n; i++) { rows[2*n+i] = i; cols[2*n+i] = i; } // diag
+	Matrix testMatrix(afield, rows, cols, n, n, 3*n - 2);
 
-  /*
-  for(i = 0; i < n; i++) { rows[i] = i; cols[i] = i; } // diag
-  Matrix testMatrix(afield, rows, cols, n, n, n);
-  */
-/*
-  Matrix testMatrix(afield);
-  ifstream mat_in("data/n4c6.b9.186558x198895.sms");
-  testMatrix.read(mat_in);
-  std::cout << testMatrix.rowdim() << " " << testMatrix.coldim() << " " << testMatrix.nnz() << std::endl;
-*/
+	/*
+	   for(i = 0; i < n; i++) { rows[i] = i; cols[i] = i; } // diag
+	   Matrix testMatrix(afield, rows, cols, n, n, n);
+	   */
+	/*
+	   Matrix testMatrix(afield);
+	   ifstream mat_in("data/n4c6.b9.186558x198895.sms");
+	   testMatrix.read(mat_in);
+	   std::cout << testMatrix.rowdim() << " " << testMatrix.coldim() << " " << testMatrix.nnz() << std::endl;
+	   */
 
 
 	commentator.start("ZeroOne matrix blackbox test suite", "ZeroOne");
 
-  pass = pass && testBlackbox(testMatrix);
-  
-  delete [] rows;
-  delete [] cols;
+	pass = pass && testBlackbox(testMatrix);
+
+	delete [] rows;
+	delete [] cols;
 
 	commentator.stop("ZeroOne matrix blackbox test suite");
-  return pass ? 0 : -1;
+	return pass ? 0 : -1;
 }
diff --git a/tests/test-zo.C b/tests/test-zo.C
index b6877b2..2b37649 100644
--- a/tests/test-zo.C
+++ b/tests/test-zo.C
@@ -1,3 +1,35 @@
+/* -*- 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
+/* Copyright (C) LinBox
+ *
+ *
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*! @file  tests/test-zo.C
+ * @ingroup tests
+ *
+ * @brief no doc
+ *
+ * @test no doc.
+ */
+
+
+
 #include <fstream>
 #include <iostream>
 #include <vector>
@@ -6,40 +38,42 @@
 
 #include "linbox/blackbox/zo.h"
 #include "linbox/blackbox/transpose.h"
-#include "linbox/field/modular.h" 
+#include "linbox/field/modular.h"
 #include "linbox/util/commentator.h"
 
 
 #include "test-common.h"
 #include "test-blackbox.h"
 
-int main(int argc, char **argv) {
+int main(int argc, char **argv)
+{
   bool pass = true;
-  uint32 prime = 31337;
+  uint32_t prime = 31337;
   static size_t n = 100000;
 
-  static Argument args[] = 
-    {{ 'n', "-n N", "Set dimension of test matrix to NxN.", TYPE_INT, &n }, 
-     { 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INT, &prime }, 
-	 { '\0'}
-	};
+  static Argument args[] =
+  {
+	  { 'n', "-n N", "Set dimension of test matrix to NxN.", TYPE_INT, &n },
+	  { 'q', "-q Q", "Operate over the \"field\" GF(Q) [1].", TYPE_INT, &prime },
+	  END_OF_ARGUMENTS
+  };
 
   parseArguments(argc, argv, args);
 
-  typedef LinBox::Modular<uint32> Field;
-  //typedef LinBox::Modular<LinBox::uint32> Field;
+  typedef LinBox::Modular<uint32_t> Field;
+  //typedef LinBox::Modular<uint32_t> Field;
   typedef LinBox::ZeroOne<Field> Matrix;
 
   Field afield(prime);
 
-  /* 
+  /*
   // "arrow" matrix
   size_t *rows, *cols, i;
   rows = new size_t[3 * n + 1 - 2];
   cols = new size_t[3 * n + 1 - 2];
 
   for(i = 0; i < n; i++) { rows[i] = 0; cols[i] = i; } // first row
-  for(i = 0; i < n - 1; i++) 
+  for(i = 0; i < n - 1; i++)
     { rows[n+2*i] = i + 1; cols[n+2*i] = 0; rows[n+2*i+1] = i + 1; cols[n+2*i+1] = i + 1; } // first col and the diag
   Matrix testMatrix(afield, rows, cols, n, n, 3 * n - 2);
   */
@@ -64,7 +98,7 @@ int main(int argc, char **argv) {
                 }
             //std::cout << std::endl;
         }
-    ZeroOne<Field> testMatrix(afield, rows, cols, n, n, npr * n );
+    Matrix testMatrix(afield, rows, cols, n, n, npr * n );
 
   /*
   Matrix testMatrix(afield);
@@ -77,14 +111,14 @@ int main(int argc, char **argv) {
   */
 
   //print out the dimensions and the number of non-zero entries of the matrix
-  std::cout << testMatrix.rowdim() << " " << testMatrix.coldim() << " " << testMatrix.nnz() << std::endl;
+  //std::cout << testMatrix.rowdim() << " " << testMatrix.coldim() << " " << testMatrix.nnz() << std::endl;
 
 
-  std::cout << std::endl << "ZeroOne matrix blackbox test suite" << std::endl;
+  //std::cout << std::endl << "ZeroOne matrix blackbox test suite" << std::endl;
 
   pass = pass && testBlackbox(testMatrix);
   //bool pass2 = testBlackbox(testMat);
-  
+
   //delete [] rows;
   //delete [] cols;
 
diff --git a/tests/tests.doxy b/tests/tests.doxy
new file mode 100644
index 0000000..2e9cf90
--- /dev/null
+++ b/tests/tests.doxy
@@ -0,0 +1,17 @@
+/** \ingroup linbox
+ * \defgroup tests tests
+ *
+ *  \brief Correctness tests for LinBox components.
+ *
+ *  These tests are to aid development and serve for unit and regression testing.
+ *  Some contain useful timing measurements.
+ *
+ *  Do <code>make tests</code> to try the lot.
+ *  See checker.C for more information on LinBox tests.
+ *
+ *  There are some benchmarks.  For instance benchmark-fields is intended to help
+ *  choose the most efficient field representation on a given platform.
+ *
+ */
+
+// vim:syntax=doxygen

-- 
linbox: library for exact linear algebra



More information about the debian-science-commits mailing list